Examples of TaxRegionProductCustTax


Examples of com.jada.jpa.entity.TaxRegionProductCustTax

        customer.put("custClassName", cust.getCustomerClass().getCustClassName());
       
        Iterator<?> taxesIterator = cust.getTaxes().iterator();
        Vector<JSONEscapeObject> taxesVector = new Vector<JSONEscapeObject>();
        while (taxesIterator.hasNext()) {
          TaxRegionProductCustTax trTax = (TaxRegionProductCustTax) taxesIterator.next();
          Tax tax = trTax.getTax();
        TaxLanguage taxLanguage = null;
        for (TaxLanguage language : tax.getTaxLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
            taxLanguage = language;
          }
        }
          JSONEscapeObject taxObj = new JSONEscapeObject();
          taxObj.put("taxRegionProductCustTaxId", trTax.getTaxRegionProductCustTaxId());
          taxObj.put("taxId", tax.getTaxId());
          taxObj.put("seqNum", trTax.getSeqNum());
          taxObj.put("taxName", taxLanguage.getTaxName());
          taxObj.put("taxRate", tax.getTaxRate());
          taxesVector.add(taxObj);
        }
        customer.put("taxes", taxesVector);
View Full Code Here

Examples of com.jada.jpa.entity.TaxRegionProductCustTax

        TaxRegionProductCust taxRegionProductCust = (TaxRegionProductCust) em.find(TaxRegionProductCust.class, trProductCustId);
        Tax tax = (Tax) em.find(Tax.class, taxId);
       
        Iterator<?> iterator = taxRegionProductCust.getTaxes().iterator();
        while (iterator.hasNext()) {
          TaxRegionProductCustTax t = (TaxRegionProductCustTax) iterator.next();
          if (t.getTax().getTaxId().equals(tax.getTaxId())) {
              jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
              jsonResult.put("message", "Tax code already exist");
              streamWebService(response, jsonResult.toHtmlString());
            return null;
          }
        }
       
        TaxRegionProductCustTax trProductCustTax = new TaxRegionProductCustTax();
        trProductCustTax.setTaxRegionProductCust(taxRegionProductCust);
        trProductCustTax.setTax(tax);
        trProductCustTax.setRecUpdateBy(adminBean.getUser().getUserId());
        trProductCustTax.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        trProductCustTax.setRecCreateBy(adminBean.getUser().getUserId());
        trProductCustTax.setRecCreateDatetime(new Date(System.currentTimeMillis()));
   
    em.persist(trProductCustTax);
   
    String result = getJSONProduct(request, taxRegionProductCust.getTaxRegionProduct());
    streamWebService(response, result);
View Full Code Here

Examples of com.jada.jpa.entity.TaxRegionProductCustTax

        TaxRegionProductCust taxRegionProductCust = (TaxRegionProductCust) em.find(TaxRegionProductCust.class, trProductCustId);
    
        String trProductCustTaxIds[] = form.getTaxRegionProductCustTaxIds();     
        for (int i = 0; i < trProductCustTaxIds.length; i++) {
          Long id = Format.getLong(trProductCustTaxIds[i]);
          TaxRegionProductCustTax tax = (TaxRegionProductCustTax) em.find(TaxRegionProductCustTax.class, id);
          tax.getTaxRegionProductCust().getTaxes().remove(tax);
          em.remove(tax);
        }
    String result = getJSONProduct(request, taxRegionProductCust.getTaxRegionProduct());
    streamWebService(response, result);
    return null;
View Full Code Here

Examples of com.jada.jpa.entity.TaxRegionProductCustTax

        while (true) {
          String taxRegionProductCustTaxId = (String) hashtable.get("tax_" + Integer.valueOf(i).toString());
          if (taxRegionProductCustTaxId == null) {
            break;
          }
          TaxRegionProductCustTax trProductCustTax = (TaxRegionProductCustTax) em.find(TaxRegionProductCustTax.class, Format.getLong(taxRegionProductCustTaxId));
          String seqNum = (String) hashtable.get("seqNum_" + Integer.valueOf(i).toString());
          trProductCustTax.setSeqNum(Format.getInt(seqNum));
          em.persist(trProductCustTax);
          i++;
        }
    String result = getJSONProduct(request, taxRegionProductCust.getTaxRegionProduct());
    streamWebService(response, result);
View Full Code Here

Examples of com.jada.jpa.entity.TaxRegionProductCustTax

      Iterator<TaxRegionProductCustTax> txTaxes = txProductCust.getTaxes().iterator();
      int seqNum = -1;
      float total = amount;
      float taxAmount = 0;
      while (txTaxes.hasNext()) {
        TaxRegionProductCustTax txTax = (TaxRegionProductCustTax) txTaxes.next();
        Tax tax = txTax.getTax();
        if (tax.getPublished() != Constants.VALUE_YES) {
          continue;
        }
        if (txTax.getSeqNum() != seqNum) {
          total += taxAmount;
          taxAmount = 0;
        }
        ItemTax itemTax = new ItemTax();
        itemTax.setTax(tax);
        itemTax.setTaxRate(tax.getTaxRate().floatValue());
        itemTax.setTaxCode(tax.getTaxLanguage().getTaxCode());
        if (!contentSessionKey.isSiteProfileClassDefault()) {
          for (TaxLanguage language : tax.getTaxLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentSessionKey.getSiteProfileClassId())) {
              if (language.getTaxCode() != null) {
                itemTax.setTaxCode(language.getTaxCode());
              }
              break;
            }
          }
        }
        float value = Utility.round(tax.getTaxRate().floatValue() * total / 100, 2);
        itemTax.setTaxAmount(value);
        vector.add(itemTax);
        taxAmount += value;
        seqNum = txTax.getSeqNum();
      }
    }
    itemTaxes = new ItemTax[vector.size()];
    vector.copyInto(itemTaxes);
    return itemTaxes;
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.