Examples of TicketLineInfo


Examples of com.openbravo.pos.ticket.TicketLineInfo

        int i = findFirstNonAuxiliarLine();
       
        if (i >= 0) {      
           
            TicketLineInfo line = ticket.getLine(i);
           
            if (line.getMultiply() >= 1.0) {
               
                List<TicketLineInfo> l = new ArrayList<TicketLineInfo>();
               
                if (line.getMultiply() > 1.0) {
                    line.setMultiply(line.getMultiply() -1.0);
                    ticketlines.setTicketLine(i, line);
                    line = line.copyTicketLine();
                    line.setMultiply(1.0);
                    l.add(line)
                    i++;
                } else { // == 1.0
                    l.add(line);
                    ticket.removeLine(i);
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

    public void addSelectedLines(TicketLineInfo[] lines) {
       
        int i = findFirstNonAuxiliarLine();        
             
        TicketLineInfo firstline = lines[0];
       
        if (i >= 0
                && ticket.getLine(i).getProductID() != null && firstline.getProductID() != null && ticket.getLine(i).getProductID().equals(firstline.getProductID())
                && ticket.getLine(i).getTaxInfo().getId().equals(firstline.getTaxInfo().getId())
                && ticket.getLine(i).getPrice() == firstline.getPrice()) { 
           
            // add the auxiliars.
            for (int j = 1; j < lines.length; j++) {
                ticket.insertLine(i + 1, lines[j]);
                ticketlines.insertTicketLine(i + 1, lines[j]);
            }
           
            // inc the line
            ticket.getLine(i).setMultiply(ticket.getLine(i).getMultiply() + firstline.getMultiply());
            ticketlines.setTicketLine(i, ticket.getLine(i))
            ticketlines.setSelectedIndex(i);
           
        } else {
            // add all at the end in inverse order.
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

    }// </editor-fold>//GEN-END:initComponents

    private void m_jbtnAddAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddAllActionPerformed

        for (int i = 0; i < m_aLines.size(); i++) {
            TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(i);
            TicketLineInfo oNewLine = new TicketLineInfo(oLine);           
            oNewLine.setMultiply(-oLine.getMultiply());
            m_jTicketEdit.addTicketLine(oNewLine);
        }
       
    }//GEN-LAST:event_m_jbtnAddAllActionPerformed
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

    private void m_jbtnAddOneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddOneActionPerformed

        int index = ticketlines.getSelectedIndex();
        if (index >= 0) {
            TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(index);
            TicketLineInfo oNewLine = new TicketLineInfo(oLine);
            oNewLine.setMultiply(-1.0);
            m_jTicketEdit.addTicketLine(oNewLine);
        }  
       
    }//GEN-LAST:event_m_jbtnAddOneActionPerformed
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

    private void m_jbtnAddLineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddLineActionPerformed

        int index = ticketlines.getSelectedIndex();
        if (index >= 0) {
            TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(index);
            TicketLineInfo oNewLine = new TicketLineInfo(oLine);           
            oNewLine.setMultiply(-oLine.getMultiply());
            m_jTicketEdit.addTicketLine(oNewLine);
        }       
    }//GEN-LAST:event_m_jbtnAddLineActionPerformed
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

    private void addTicketLine(ProductInfoExt oProduct, double dMul, double dPrice) {  
       
        TaxInfo tax = taxeslogic.getTaxInfo(oProduct.getTaxCategoryID(), m_oTicket.getCustomer());
       
        addTicketLine(new TicketLineInfo(oProduct, dMul, dPrice, tax, (java.util.Properties) (oProduct.getProperties().clone())));
    }
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

                    Toolkit.getDefaultToolkit().beep();
                } else if (m_App.getDeviceScale().existsScale()) {
                    try {
                        Double value = m_App.getDeviceScale().readWeight();
                        if (value != null) {
                            TicketLineInfo newline = new TicketLineInfo(m_oTicket.getLine(i));
                            newline.setMultiply(value.doubleValue());
                            newline.setPrice(Math.abs(newline.getPrice()));
                            paintTicketLine(i, newline);
                        }
                    } catch (ScaleException e) {
                        // Error de pesada.
                        Toolkit.getDefaultToolkit().beep();
                        new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.noweight"), e).show(this);          
                        stateToZero();
                    }
                } else {
                    // No existe la balanza;
                    Toolkit.getDefaultToolkit().beep();
                }     
               
            // Add one product more to the selected line
            } else if (cTrans == '+'
                    && m_iNumberStatusInput == NUMBERZERO && m_iNumberStatusPor == NUMBERZERO) {
                int i = m_ticketlines.getSelectedIndex();
                if (i < 0){
                    Toolkit.getDefaultToolkit().beep();
                } else {
                    TicketLineInfo newline = new TicketLineInfo(m_oTicket.getLine(i));
                    //If it's a refund + button means one unit less
                    if (m_oTicket.getTicketType() == TicketInfo.RECEIPT_REFUND){
                        newline.setMultiply(newline.getMultiply() - 1.0);
                        paintTicketLine(i, newline);                  
                    }
                    else {
                        // add one unit to the selected line
                        newline.setMultiply(newline.getMultiply() + 1.0);
                        paintTicketLine(i, newline);
                    }
                }

            // Delete one product of the selected line
            } else if (cTrans == '-'
                    && m_iNumberStatusInput == NUMBERZERO && m_iNumberStatusPor == NUMBERZERO
                    && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
               
                int i = m_ticketlines.getSelectedIndex();
                if (i < 0){
                    Toolkit.getDefaultToolkit().beep();
                } else {
                    TicketLineInfo newline = new TicketLineInfo(m_oTicket.getLine(i));
                    //If it's a refund - button means one unit more
                    if (m_oTicket.getTicketType() == TicketInfo.RECEIPT_REFUND){
                        newline.setMultiply(newline.getMultiply() + 1.0);
                        if (newline.getMultiply() >= 0) {
                            removeTicketLine(i);
                        } else {
                            paintTicketLine(i, newline);
                        }
                    } else {
                        // substract one unit to the selected line
                        newline.setMultiply(newline.getMultiply() - 1.0);
                        if (newline.getMultiply() <= 0.0) {                  
                            removeTicketLine(i); // elimino la linea
                        } else {
                            paintTicketLine(i, newline);                  
                        }
                    }
                }

            // Set n products to the selected line
            } else if (cTrans == '+'
                    && m_iNumberStatusInput == NUMBERZERO && m_iNumberStatusPor == NUMBERVALID) {
                int i = m_ticketlines.getSelectedIndex();
                if (i < 0){
                    Toolkit.getDefaultToolkit().beep();
                } else {
                    double dPor = getPorValue();
                    TicketLineInfo newline = new TicketLineInfo(m_oTicket.getLine(i));
                    if (m_oTicket.getTicketType() == TicketInfo.RECEIPT_REFUND) {
                        newline.setMultiply(-dPor);
                        newline.setPrice(Math.abs(newline.getPrice()));
                        paintTicketLine(i, newline);               
                    } else {
                        newline.setMultiply(dPor);
                        newline.setPrice(Math.abs(newline.getPrice()));
                        paintTicketLine(i, newline);
                    }
                }

            // Set n negative products to the selected line
            } else if (cTrans == '-'
                    && m_iNumberStatusInput == NUMBERZERO && m_iNumberStatusPor == NUMBERVALID
                    && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
               
                int i = m_ticketlines.getSelectedIndex();
                if (i < 0){
                    Toolkit.getDefaultToolkit().beep();
                } else {
                    double dPor = getPorValue();
                    TicketLineInfo newline = new TicketLineInfo(m_oTicket.getLine(i));
                    if (m_oTicket.getTicketType() == TicketInfo.RECEIPT_NORMAL) {
                        newline.setMultiply(dPor);
                        newline.setPrice(-Math.abs(newline.getPrice()));
                        paintTicketLine(i, newline);
                    }          
                }

            // Anadimos 1 producto
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

        int i = m_ticketlines.getSelectedIndex();
        if (i < 0){
            Toolkit.getDefaultToolkit().beep(); // no line selected
        } else {
            try {
                TicketLineInfo newline = JProductLineEdit.showMessage(this, m_App, m_oTicket.getLine(i));
                if (newline != null) {
                    // line has been modified
                    paintTicketLine(i, newline);
                }
            } catch (BasicException e) {
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

        int i = m_ticketlines.getSelectedIndex();
        if (i < 0) {
            Toolkit.getDefaultToolkit().beep(); // no line selected
        } else {
            try {
                TicketLineInfo line = m_oTicket.getLine(i);
                JProductAttEdit attedit = JProductAttEdit.getAttributesEditor(this, m_App.getSession());
                attedit.editAttributes(line.getProductAttSetId(), line.getProductAttSetInstId());
                attedit.setVisible(true);
                if (attedit.isOK()) {
                    // The user pressed OK
                    line.setProductAttSetInstId(attedit.getAttributeSetInst());
                    line.setProductAttSetInstDesc(attedit.getAttributeSetInstDescription());
                    paintTicketLine(i, line);
                }
            } catch (BasicException ex) {
                MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfindattributes"), ex);
                msg.show(this);
View Full Code Here

Examples of com.openbravo.pos.ticket.TicketLineInfo

          discountrate/=100;

          int index = m_ticketlines.getSelectedIndex();
          String sdiscount;
        TicketLineInfo remise;

          if (index >= 0) {
             TicketLineInfo line = m_oTicket.getLine(index);
             if (line.getPrice() > 0.0 && discountrate > 0.0) {

                 sdiscount = Formats.PERCENT.formatValue(discountrate);
                remise = new TicketLineInfo("Remise " + line.getProductName() + " " + sdiscount,
                     line.getProductTaxCategoryID(),
                     line.getMultiply(),
                     -line.getPrice () * discountrate,
                     line.getTaxInfo());
                int i = index + 1;
                 m_oTicket.insertLine(i, remise);
                 refreshTicket();
                  setSelectedIndex(i);
             }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.