Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Tax


    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);

    Tax tax = new Tax();
    if (!insertMode) {
      tax = TaxDAO.load(site.getSiteId(), Format.getLong(form.getTaxId()));
    }

    ActionMessages errors = validate(form);
    if (errors.size() != 0) {
      saveMessages(request, errors);
          initListInfo(form, tax);
          initSearchInfo(form, request);
          if (insertMode) {
              FormUtils.setFormDisplayMode(request, form, FormUtils.CREATE_MODE);
          }
          else {
              FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
          }
      return mapping.findForward("error");
    }

    if (insertMode) {
      tax.setRecCreateBy(adminBean.getUser().getUserId());
      tax.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      tax.setSite(site);
    }
   
    if (form.isSiteProfileClassDefault()) {
      saveDefault(tax, form, adminBean);
      if (insertMode) {
        em.persist(tax);
      }
    }
    else {
      saveLanguage(tax, form, adminBean);     
    }
        form.setTaxId(Format.getLong(tax.getTaxId()));
    form.setMode("U");
       
        initListInfo(form, tax);
        initSearchInfo(form, request);
       
View Full Code Here


        TaxMaintActionForm form = (TaxMaintActionForm) actionForm;
    initSiteProfiles(form, getAdminBean(request).getSite());
    Site site = getAdminBean(request).getSite();
  
        Long taxId = Format.getLong(form.getTaxId());
        Tax tax = TaxDAO.load(site.getSiteId(), taxId);

        String countries[] = form.getCountries();
        if (countries != null) {
          for (int i = 0; i < countries.length; i++) {
              Country country = CountryDAO.load(site.getSiteId(), Format.getLong(countries[i]));
            tax.getCountries().add(country);
          }
        }

        String states[] = form.getStates();
        if (states != null) {
          for (int i = 0; i < states.length; i++) {
              State state = StateDAO.load(site.getSiteId(), Format.getLong(states[i]));
            tax.getStates().add(state);
          }
        }
        em.flush();
        initListInfo(form, tax);
        initSearchInfo(form, request);
View Full Code Here

    initSiteProfiles(form, getAdminBean(request).getSite());
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        Site site = getAdminBean(request).getSite();
       
        Long taxId = Format.getLong(form.getTaxId());
        Tax tax = TaxDAO.load(site.getSiteId(), taxId);

        String removeCountries[] = form.getRemoveCountries();
        if (removeCountries != null) {
          for (int i = 0; i < removeCountries.length; i++) {
              Country country = CountryDAO.load(site.getSiteId(), Format.getLong(removeCountries[i]));
            tax.getCountries().remove(country);
          }
        }

        String removeStates[] = form.getRemoveStates();
        if (removeStates != null) {
          for (int i = 0; i < removeStates.length; i++) {
              State state = StateDAO.load(site.getSiteId(), Format.getLong(removeStates[i]));
            tax.getStates().remove(state);
          }
        }
        em.flush();
       
        initListInfo(form, tax);
View Full Code Here

      ItemTax taxes[] = shoppingCart.getTaxes();
       Vector<ShoppingCartTaxInfo> taxVector = new Vector<ShoppingCartTaxInfo>();
      if (taxes != null) {
        for (int i = 0; i < taxes.length; i++) {
          ShoppingCartTaxInfo taxInfo = new ShoppingCartTaxInfo();
          Tax tax = taxes[i].getTax();
          taxInfo.setTaxName(tax.getTaxLanguage().getTaxName());
          if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
            for (TaxLanguage language : tax.getTaxLanguages()) {
              if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                if (language.getTaxName() != null) {
                  taxInfo.setTaxName(language.getTaxName());
                }
                break;
View Full Code Here

public class TaxDAO extends Tax {
  private static final long serialVersionUID = 93652739634851609L;

  public static Tax load(String siteId, Long taxId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Tax tax = (Tax) em.find(Tax.class, taxId);
    if (!tax.getSiteId().equals(siteId)) {
      throw new SecurityException();
    }
    return tax;
  }
View Full Code Here

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

TOP

Related Classes of com.jada.jpa.entity.Tax

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.