Package com.openbravo.pos.ticket

Examples of com.openbravo.pos.ticket.TaxInfo


                stateToZero();
            } else {
                // Se anade directamente una unidad con el precio y todo
                if (m_jaddtax.isSelected()) {
                    // debemos quitarle los impuestos ya que el precio es con iva incluido...
                    TaxInfo tax = taxeslogic.getTaxInfo(oProduct.getTaxCategoryID(), m_oTicket.getCustomer());
                    addTicketLine(oProduct, 1.0, dPriceSell / (1.0 + tax.getRate()));
                } else {
                    addTicketLine(oProduct, 1.0, dPriceSell);
                }               
            }
        } catch (BasicException eData) {
View Full Code Here


    private void jTakeAwayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTakeAwayActionPerformed
        List<TicketLineInfo> tLines;
        // TicketLineInfo currentLine;
        TicketTaxInfo[] taxes;
        TaxInfo taxline;
        Double marge;

/*
* Mettre le client à Emporter à "invisible"
* remplacer les données ci-dessous par les bonnes
*
*
*
*/
        Double taxTakeAway = 1.06//taxe à emporter = 6%
        String takeAwayID = "8ba8e7e2-197f-4296-9531-ed27ad875ad8"; // ID du client "A Emporter"
        String taxTakeAwayName = "Sur Place"; // Nom de la taxe "Sur Place"

        double total = m_oTicket.getTotal();
        if (total <= 0.0) {
            java.awt.Toolkit.getDefaultToolkit().beep();
            return;
        }

        tLines = m_oTicket.getLines();

        try {
            m_oTicket.setCustomer(dlSales.loadCustomerExt(takeAwayID));

        } catch (BasicException e) {
            MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfindcustomer"), e);
            msg.show(this);
        }

//        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

      }
     
      HashMap<String, Double> localTaxes = new HashMap<String, Double>();
      Iterator<TaxInfo> taxList = dlsales.getTaxList().list().iterator();
      while (taxList.hasNext()) {
        TaxInfo ti = (TaxInfo) taxList.next();
        localTaxes.put(ti.getTaxCategoryID(),ti.getRate());
      }
      HashMap<Double, String> remoteTaxes = externalsales.getTaxes();

       Produit[] products = externalsales.getProductsCatalog();
View Full Code Here

    }


    @Override
    protected TaxInfo map2VO(ResultSet rs) throws SQLException {
        TaxInfo tax = new TaxInfo();
        tax.setId(rs.getString("id"));
        tax.setName(rs.getString("name"));
        tax.setTaxcategoryid(rs.getString("category"));
        tax.setTaxcustcategoryid(rs.getString("custcategory"));
        tax.setParentID(rs.getString("parentid"));
        tax.setRate(rs.getDouble("rate"));
        tax.setCascade(rs.getBoolean("ratecascade"));
        tax.setOrder(rs.getInt("rateorder"));

        return tax;
    }
View Full Code Here

    public final SentenceList getTaxList() {
        return new StaticSentence(s
            , "SELECT ID, NAME, CATEGORY, CUSTCATEGORY, PARENTID, RATE, RATECASCADE, RATEORDER FROM TAXES ORDER BY NAME"
            , null
            , new SerializerRead() { public Object readValues(DataRead dr) throws BasicException {
                return new TaxInfo(
                        dr.getString(1),
                        dr.getString(2),
                        dr.getString(3),
                        dr.getString(4),
                        dr.getString(5),
View Full Code Here

                    // Synchonization of taxcategories
                    TaxCategoryInfo tc = new TaxCategoryInfo(product.getTax().getId(), product.getTax().getName());
                    dlintegration.syncTaxCategory(tc);
                   
                    // Synchonization of taxes
                    TaxInfo t = new TaxInfo(
                            product.getTax().getId(),
                            product.getTax().getName(),
                            tc.getID(),
                            null,
                            null,
View Full Code Here

                    // Synchonization of taxcategories
                    TaxCategoryInfo tc = new TaxCategoryInfo(product.getTax().getId(), product.getTax().getName());
                    dlintegration.syncTaxCategory(tc);
                   
                    // Synchonization of taxes
                    TaxInfo t = new TaxInfo(
                            product.getTax().getId(),
                            product.getTax().getName(),
                            tc.getID(),
                            new Date(Long.MIN_VALUE),
                            null,
View Full Code Here

    public double getTaxRate(String tcid, Date date, CustomerInfoExt customer) {
       
        if (tcid == null) {
            return 0.0;
        } else {
            TaxInfo tax = getTaxInfo(tcid, date, customer);
            if (tax == null) {
                return 0.0;
            } else {
                return tax.getRate();
            }           
        }
    }
View Full Code Here

        return getTaxInfo(tc.getID(), date, customer);
    }   
   
    public TaxInfo getTaxInfo(String tcid, Date date, CustomerInfoExt customer) {
       
        TaxInfo candidatetax = null;
        TaxInfo defaulttax = null;
       
        for (TaxInfo tax : taxlist) {
            if (tax.getParentID() == null && tax.getTaxCategoryID().equals(tcid) && tax.getValidFrom().compareTo(date) <= 0) {


                if (candidatetax == null || tax.getValidFrom().compareTo(candidatetax.getValidFrom()) > 0) {
                    // is valid date
                    if ((customer == null || customer.getTaxCustCategoryID() == null) && tax.getTaxCustCategoryID() == null) {
                        candidatetax = tax;
                    } else if (customer != null && customer.getTaxCustCategoryID() != null && customer.getTaxCustCategoryID().equals(tax.getTaxCustCategoryID())) {
                        candidatetax = tax;
                    }
                }
               
                if (tax.getTaxCustCategoryID() == null) {
                    if (defaulttax == null || tax.getValidFrom().compareTo(defaulttax.getValidFrom()) > 0) {
                        defaulttax = tax;
                    }
                }
            }
        }
View Full Code Here

        }
   }

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

TOP

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

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.