Example #1
0
  private void printerStart() {

    String sresource = m_dlSystem.getResourceAsXML("Printer.Start");
    if (sresource == null) {
      m_TP.getDeviceDisplay().writeVisor(AppLocal.APP_NAME, AppLocal.APP_VERSION);
    } else {
      try {
        m_TTP.printTicket(sresource);
      } catch (TicketPrinterException eTP) {
        m_TP.getDeviceDisplay().writeVisor(AppLocal.APP_NAME, AppLocal.APP_VERSION);
      }
    }
  }
  /**
   * Creates new form JTicketsBagTicket
   *
   * @param app
   * @param panelticket
   */
  public JTicketsBagTicket(AppView app, JPanelTicketEdits panelticket) {

    super(app, panelticket);
    m_panelticketedit = panelticket;
    m_dlSystem = (DataLogicSystem) m_App.getBean("com.openbravo.pos.forms.DataLogicSystem");
    m_dlSales = (DataLogicSales) m_App.getBean("com.openbravo.pos.forms.DataLogicSales");
    dlCustomers =
        (DataLogicCustomers) m_App.getBean("com.openbravo.pos.customers.DataLogicCustomers");

    // Inicializo la impresora...
    // JG July 2014 - Thank you Ron Isaacson        m_TP = new DeviceTicket();
    m_TP = new DeviceTicket(app.getProperties());

    // Inicializo el parser de documentos de ticket
    m_TTP = new TicketParser(m_TP, m_dlSystem); // para visualizar el ticket
    m_TTP2 = new TicketParser(m_App.getDeviceTicket(), m_dlSystem); // para imprimir el ticket

    initComponents();

    m_TicketsBagTicketBag = new JTicketsBagTicketBag(this);

    m_jTicketEditor.addEditorKeys(m_jKeys);

    // Este deviceticket solo tiene una impresora, la de pantalla
    m_jPanelTicket.add(m_TP.getDevicePrinter("1").getPrinterComponent(), BorderLayout.CENTER);

    try {
      taxeslogic = new TaxesLogic(m_dlSales.getTaxList().list());
    } catch (BasicException ex) {
    }
  }
Example #3
0
  public void tryToClose() {

    if (closeAppView()) {

      // success. continue with the shut down

      // apago el visor
      m_TP.getDeviceDisplay().clearVisor();
      // me desconecto de la base de datos.
      session.close();

      // Download Root form
      SwingUtilities.getWindowAncestor(this).dispose();
    }
  }
  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);
      }
    }
  }
  /** Creates new form JTicketsBagTicket */
  public JTicketsBagTicket(AppView app, JPanelTicketEdits panelticket) {

    super(app, panelticket);
    m_panelticketedit = panelticket;
    m_dlSystem = (DataLogicSystem) m_App.getBean("com.openbravo.pos.forms.DataLogicSystemCreate");

    // Inicializo la impresora...
    m_TP = new DeviceTicket();

    // Inicializo el parser de documentos de ticket
    m_TTP = new TicketParser(m_TP, m_dlSystem); // para visualizar el ticket
    m_TTP2 = new TicketParser(m_App.getDeviceTicket(), m_dlSystem); // para imprimir el ticket

    initComponents();

    m_TicketsBagTicketBag = new JTicketsBagTicketBag(this);

    m_jTicketEditor.addEditorKeys(m_jKeys);

    // Este deviceticket solo tiene una impresora, la de pantalla
    m_jPanelTicket.add(m_TP.getDevicePrinter("1").getPrinterComponent(), BorderLayout.CENTER);
  }