Package com.openbravo.pos.ticket

Examples of com.openbravo.pos.ticket.TicketLineInfo


                taxes = m_oTicket.getTaxLines();
                for (int i = 0; i < taxes.length; i++) {

                    taxline = taxes[i];
                    m_oTicket.insertLine(m_oTicket.getLinesCount(),
                            new TicketLineInfo(
                            "Remise totale " + sdiscount,
                            taxline.getTaxInfo().getTaxCategoryID(),
                            1.0,
                            -taxline.getSubTotal() * discountrate,
                            taxline.getTaxInfo()));
View Full Code Here


//        refreshTicket();
           
        for (int i = 0; i < tLines.size(); i++) {

            TicketLineInfo currentLine = tLines.get(i);
            taxline = currentLine.getTaxInfo();
           
            if (taxline.getName().contains(taxTakeAwayName)) {

                marge = (currentLine.getPriceTax() / taxTakeAway);
                currentLine.setPrice(marge);
                m_oTicket.setLine(i, currentLine);
            }
        }


        refreshTicket();
        if (closeTicket(m_oTicket, m_oTicketExt)) {
            m_ticketsbag.deleteTicket();

        } else {
            m_oTicket.setCustomer(null);
             refreshTicket();
            for (int i = 0; i < tLines.size(); i++) {

                // taxline = taxes[i];
                TicketLineInfo currentLine = tLines.get(i);
                taxline = currentLine.getTaxInfo();

               
                if (taxline.getName().contains(taxTakeAwayName)) {
                    Double tax = (taxline.getRate())+1.0;

                    marge = ((currentLine.getPrice()*taxTakeAway) / tax);
                    currentLine.setPrice(marge);

                    m_oTicket.setLine(i, currentLine);
                }

            }
View Full Code Here

                taxes = m_oTicket.getTaxLines();
                for (int i = 0; i < taxes.length; i++) {

                    taxline = taxes[i];
                    m_oTicket.insertLine(m_oTicket.getLinesCount(),
                            new TicketLineInfo(
                            "Service supp. " + sdiscount,
                            taxline.getTaxInfo().getTaxCategoryID(),
                            1.0,
                            +taxline.getSubTotal() * discountrate,
                            taxline.getTaxInfo()));
View Full Code Here

          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("Supplément " + 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

                    }
                }
                manager.updateLineFromTicket(place, ticket);
                for (Object line : linesList) {
                    TicketLineInfo li = (TicketLineInfo) line;
                    products.add(manager.findProductById(li.getProductid()));
                }

                request.setAttribute("product", products.get(0));
                request.setAttribute("place", place);
                request.setAttribute("placeName", manager.findPlaceNameById(place));
                request.setAttribute("line", linesList.get(Integer.valueOf(array[0])));
                request.setAttribute("lineNo", array[0]);
                request.setAttribute("total", manager.getTotalOfaTicket(place));

                return mapping.findForward(UPDATE);

            case 4:
                ticket = manager.findTicket(place);
                linesList = ticket.getM_aLines();
                array = floorForm.getParameters();
                int var = Integer.parseInt(array[0]);
                linesList.remove(var);
                if (linesList.size() > var && manager.findProductById(linesList.get(var).getProductid()).isCom()) {
                    linesList.remove(var);
                    while (linesList.size() > var && manager.findProductById(linesList.get(var).getProductid()).isCom()) {
                        linesList.remove(var);
                        if (linesList.size() == var) {
                            break;
                        }
                    }
                }
                manager.updateLineFromTicket(place, ticket);
                for (Object line : linesList) {
                    TicketLineInfo li = (TicketLineInfo) line;
                    products.add(manager.findProductById(li.getProductid()));
                }

                request.setAttribute("floorName", manager.findFloorById(manager.findPlaceById(place).getFloor()).getName());
                request.setAttribute("place", place);
                request.setAttribute("placeName", manager.findPlaceNameById(place));
                request.setAttribute("floorId", floorId);
                request.setAttribute("lines", linesList);
                request.setAttribute("products", products);
                request.setAttribute("total", manager.getTotalOfaTicket(place));

                return mapping.findForward(SUCCESS);

            //edits lines
            case 2:
                ticket = manager.findTicket(place);
                linesList = ticket.getM_aLines();
                String[] index = floorForm.getParameters();
                //if null go to default and refresh products. that's why no break
                linesList.get(Integer.valueOf(index[0])).setMultiply(Double.valueOf(index[1]));

                manager.updateLineFromTicket(floorForm.getId(), ticket);
                for (Object line : linesList) {
                    TicketLineInfo li = (TicketLineInfo) line;
                    products.add(manager.findProductById(li.getProductid()));
                }

                break;

            //increment product
            case 3:
                ticket = manager.findTicket(place);
                linesList = ticket.getM_aLines();
                array = floorForm.getParameters();
                if (array != null) {
                    for (int i = 0; i < array.length; i++) {
                        linesList.get(Integer.valueOf(array[i])).setMultiply(linesList.get(Integer.valueOf(array[i])).getMultiply() + 1);    //strange
                    }
                }
                manager.updateLineFromTicket(place, ticket);
                for (Object line : linesList) {
                    TicketLineInfo li = (TicketLineInfo) line;
                    products.add(manager.findProductById(li.getProductid()));
                }
                request.setAttribute("product", products.get(0));
                request.setAttribute("place", place);
                request.setAttribute("placeName", manager.findPlaceNameById(place));
                request.setAttribute("line", linesList.get(Integer.valueOf(array[0])));
                request.setAttribute("lineNo", array[0]);
                request.setAttribute("total", manager.getTotalOfaTicket(place));

                return mapping.findForward(UPDATE);

            //adds new products or just refresh
            default:
                if (manager.findTicket(place) == null) {
                    manager.initTicket(place);
                } else {
                    linesList = manager.findTicketLines(place);
                }
                for (Object line : linesList) {
                    TicketLineInfo li = (TicketLineInfo) line;
                    products.add(manager.findProductById(li.getProductid()));
                }
                break;
        }

        request.setAttribute("floorName", manager.findFloorById(manager.findPlaceById(place).getFloor()).getName());
View Full Code Here

            orders[i].setBusinessPartner(bp);

            //Saco las lineas del pedido
            OrderLine[] orderLine = new OrderLine[ticket.getLines().size()];
            for (int j = 0; j < ticket.getLines().size(); j++){
                TicketLineInfo line = ticket.getLines().get(j);

                orderLine[j] = new OrderLine();
                orderLine[j].setOrderLineId(String.valueOf(line.getTicketLine()));// o simplemente "j"
                if (line.getProductID() == null) {
                    orderLine[j].setProductId("0");
                } else {
                    orderLine[j].setProductId(line.getProductID()); // capturar error
                }
                orderLine[j].setUnits(line.getMultiply());
                orderLine[j].setPrice(line.getPrice());
                orderLine[j].setTaxId(line.getTaxInfo().getId());    
            }
            orders[i].setLines(orderLine);

            //Saco las lineas de pago
            Payment[] paymentLine = new Payment[ticket.getPayments().size()];
View Full Code Here

                    orders.setVendor_id(externalsales.getWsPosid());

                    Product[] products = new Product[ticket.getLines().size()];

                    for (int j = 0; j < ticket.getLines().size(); j++) {
                        TicketLineInfo line = ticket.getLines().get(j);
                        // String pDesc = line.getProductName();
                        String pDesc = "";
                        products[j] = new Product();

                        System.out.println("> " + line.getProductName());

                        try {
                            if (line.getProductID().equals("0")) {
                                pDesc = line.getProductName();
                                products[j].setProduct_id(productsMap.get(line.getProductID()));
                                products[j].setQuantity(String.valueOf(line.getMultiply() * line.getPriceTax() * 100));
                                //pDesc += " " + String.valueOf(line.getMultiply()) + " > " + line.getPriceTax();
                            } else {
                                products[j].setProduct_id(productsMap.get(line.getProductID()));
                                products[j].setQuantity(String.valueOf(line.getMultiply()));
                            }
                        } catch (NullPointerException npe) {
                            pDesc = line.getProductName();
                            products[j].setProduct_id(productsMap.get("0"));
                            products[j].setQuantity(String.valueOf(line.getMultiply() * line.getPriceTax() * 100));

                        }
                        if (line.getProductAttSetInstDesc() != null && !line.getProductAttSetInstDesc().equals("")) {
                            if (pDesc.equalsIgnoreCase("")) {
                                pDesc += ", ";
                            }
                            pDesc += line.getProductAttSetInstDesc();
                        }
                        products[j].setDescription(pDesc);
                        //System.out.println(products[j].getProduct_id()+" "+products[j].getDescription());
                    }

View Full Code Here

        if (oLine.getTaxInfo() == null) {
            throw new BasicException(AppLocal.getIntString("message.cannotcalculatetaxes"));
        }

        m_oLine = new TicketLineInfo(oLine);
        m_bunitsok = true;
        m_bpriceok = true;

        m_jName.setEnabled(m_oLine.getProductID() == null && app.getAppUserView().getUser().hasPermission("com.openbravo.pos.sales.JPanelTicketEdits"));
        m_jPrice.setEnabled(app.getAppUserView().getUser().hasPermission("com.openbravo.pos.sales.JPanelTicketEdits"));
View Full Code Here

            }
        }
        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();
View Full Code Here

            }
        }
        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();
View Full Code Here

TOP

Related Classes of com.openbravo.pos.ticket.TicketLineInfo

Copyright © 2018 www.massapicom. 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.