Esempio n. 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) {
    }
  }
Esempio n. 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();
    }
  }
Esempio n. 4
0
 public void setTiming(int i) {
   int j = i / 2 % (this.msglength + 20);
   if (j < 20) {
     this.currentLine1 =
         DeviceTicket.alignLeft(DeviceTicket.getWhiteString(20 - j) + this.baseLine1, 20);
     this.currentLine2 =
         DeviceTicket.alignLeft(DeviceTicket.getWhiteString(20 - j) + this.baseLine2, 20);
   } else {
     this.currentLine1 = DeviceTicket.alignLeft(this.baseLine1.substring(j - 20), 20);
     this.currentLine2 = DeviceTicket.alignLeft(this.baseLine2.substring(j - 20), 20);
   }
 }
Esempio n. 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);
      }
    }
  }
Esempio n. 6
0
  /** 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);
  }
Esempio n. 7
0
 public ScrollAnimator(String line1, String line2) {
   this.msglength = Math.max(line1.length(), line2.length());
   this.baseLine1 = DeviceTicket.alignLeft(line1, this.msglength);
   this.baseLine2 = DeviceTicket.alignLeft(line2, this.msglength);
 }