Пример #1
0
  public List<TicketLineInfo> getAffectedLines() {
    List<TicketLineInfo> lines = new ArrayList<TicketLineInfo>();

    int i = ticketlines.getSelectedIndex();
    if (i >= 0) {
      TicketLineInfo line = ticket.getLine(i);

      /* Si el producto seleccionado es axuliar o descuento, no podemos transferirlo */
      if (line.isProductCom() || line.isDiscount()) return lines;

      ticket.removeLine(i);
      ticketlines.removeTicketLine(i);
      lines.add(line);

      /* Comprobamos si la linea corresponde a un producto con productos auxiliares
       * como puede ser un menu o si tiene algun descuento por linea asociado
       */
      if (!line.isProductCom() && !line.isDiscount()) {
        while (i < ticket.getLinesCount()
            && ((line = (TicketLineInfo) ticket.getLine(i)).isProductCom() || line.isDiscount())) {
          lines.add(new TicketLineInfo(line));
          ticket.removeLine(i);
          ticketlines.removeTicketLine(i);
        }
      }
      printTotals();
    }
    return lines;
  }
Пример #2
0
  public void setTicket(TicketInfo ticket, Object ticketext) {

    this.ticket = ticket;
    this.ticketext = ticketext;

    // The ticket name
    m_jTicketId.setText(ticket.getName(ticketext));

    ticketlines.clearTicketLines();
    for (int i = 0; i < ticket.getLinesCount(); i++) {
      ticketlines.addTicketLine(ticket.getLine(i));
    }

    if (ticket.getLinesCount() > 0) {
      ticketlines.setSelectedIndex(0);
    }

    printTotals();
  }
Пример #3
0
  private void printTotals() {

    if (ticket.getLinesCount() > 0) {
      m_jSubtotalEuros.setText(Formats.CURRENCY.formatValue(new Double(ticket.getSubTotal())));
      m_jTaxesEuros.setText(Formats.CURRENCY.formatValue(new Double(ticket.getTax())));
      m_jTotalEuros.setText(Formats.CURRENCY.formatValue(new Double(ticket.getTotal())));
    } else {
      m_jSubtotalEuros.setText(null);
      m_jTaxesEuros.setText(null);
      m_jTotalEuros.setText(null);
    }
  }
Пример #4
0
  private void m_jRefundActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_m_jRefundActionPerformed

    java.util.List aRefundLines = new ArrayList();

    for (int i = 0; i < m_ticket.getLinesCount(); i++) {
      TicketLineInfo newline = new TicketLineInfo(m_ticket.getLine(i));
      aRefundLines.add(newline);
    }

    m_ticketCopy = null;
    m_TicketsBagTicketBag.showRefund();
    m_panelticketedit.showRefundLines(aRefundLines);

    TicketInfo refundticket = new TicketInfo();
    refundticket.setTicketType(TicketInfo.RECEIPT_REFUND);
    refundticket.setCustomer(m_ticket.getCustomer());
    m_panelticketedit.setActiveTicket(refundticket, null);
  } // GEN-LAST:event_m_jRefundActionPerformed
  private void saveCurrentTicket() {

    if (m_sCurrentTicket != null) {
      try {
        dlReceipts.insertSharedTicket(
            m_sCurrentTicket,
            m_panelticket.getActiveTicket(),
            m_panelticket.getActiveTicket().getPickupId());
        m_jListTickets.setText("*");
        TicketInfo l = dlReceipts.getSharedTicket(m_sCurrentTicket);
        if (l.getLinesCount() == 0) {
          //                      throw new
          // BasicException(AppLocal.getIntString("message.nullticket"));
          //                    }else{
          dlReceipts.deleteSharedTicket(m_sCurrentTicket);
        }
      } catch (BasicException e) {
        new MessageInf(e).show(this);
      }
    }
  }