示例#1
0
  private void btnCustomerActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnCustomerActionPerformed

    JCustomerFinder finder = JCustomerFinder.getCustomerFinder(this, dlCustomers);
    finder.search(ticket.getCustomer());
    finder.setVisible(true);
    ticket.setCustomer(finder.getSelectedCustomer());

    // The ticket name
    m_jTicketId.setText(ticket.getName(ticketext));
  } // GEN-LAST:event_btnCustomerActionPerformed
  public final void updateSharedTicket(final String id, final TicketInfo ticket)
      throws BasicException {

    Object[] values = new Object[] {id, ticket.getName(), ticket};
    Datas[] datas = new Datas[] {Datas.STRING, Datas.STRING, Datas.SERIALIZABLE};
    new PreparedSentence(
            s,
            "UPDATE SHAREDTICKETS SET NAME = ?, CONTENT = ? WHERE ID = ?",
            new SerializerWriteBasicExt(datas, new int[] {1, 2, 0}))
        .exec(values);
  }
  public final void insertSharedTicket(final String id, final TicketInfo ticket)
      throws BasicException {

    Object[] values = new Object[] {id, ticket.getName(), ticket};
    Datas[] datas = new Datas[] {Datas.STRING, Datas.STRING, Datas.SERIALIZABLE};

    new PreparedSentence(
            s,
            "INSERT INTO SHAREDTICKETS (ID, NAME,CONTENT) VALUES (?, ?, ?)",
            new SerializerWriteBasicExt(datas, new int[] {0, 1, 2}))
        .exec(values);
  }
示例#4
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();
  }
示例#5
0
  private void printTicket() {

    // imprimo m_ticket

    try {
      m_jEdit.setEnabled(
          m_ticket != null
              && (m_ticket.getTicketType() == TicketInfo.RECEIPT_NORMAL
                  || m_ticket.getTicketType() == TicketInfo.RECEIPT_REFUND)
              && m_dlSales.isCashActive(m_ticket.getActiveCash()));
    } catch (BasicException e) {
      m_jEdit.setEnabled(false);
    }
    m_jRefund.setEnabled(m_ticket != null && m_ticket.getTicketType() == TicketInfo.RECEIPT_NORMAL);
    m_jPrint.setEnabled(m_ticket != null);

    // Este deviceticket solo tiene una impresora, la de pantalla
    m_TP.getDevicePrinter("1").reset();

    if (m_ticket == null) {
      m_jTicketId.setText(null);
    } else {
      m_jTicketId.setText(m_ticket.getName());

      try {
        ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
        script.put("ticket", m_ticket);
        m_TTP.printTicket(
            script.eval(m_dlSystem.getResourceAsXML("Printer.TicketPreview")).toString());
      } catch (ScriptException e) {
        MessageInf msg =
            new MessageInf(
                MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotprintticket"), e);
        msg.show(this);
      } catch (TicketPrinterException eTP) {
        MessageInf msg =
            new MessageInf(
                MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotprintticket"), eTP);
        msg.show(this);
      }
    }
  }