Package org.jallinone.expirations.java

Examples of org.jallinone.expirations.java.PaymentVO



  public final Response executeCommand(Object inputPar,UserSessionParameters userSessionPars,HttpServletRequest request, HttpServletResponse response,HttpSession userSession,ServletContext context) {
    try {
      Object[] pars = (Object[])inputPar;
      PaymentVO vo = (PaymentVO)pars[0];
      ArrayList vos = (ArrayList)pars[1];

      // retrieve internationalization settings (Resources object)...
      ServerResourcesFactory factory = (ServerResourcesFactory)context.getAttribute(Controller.RESOURCES_FACTORY);
      Resources resources = factory.getResources(userSessionPars.getLanguageId());
View Full Code Here


   * Callback method called when the data loading is completed.
   * @param error <code>true</code> if an error occours during data loading, <code>false</code> if data loading is successfully completed
   */
  public void loadDataCompleted(boolean error) {
    if (!error) {
      PaymentVO vo = (PaymentVO)frame.getPayForm().getVOModel().getValueObject();

      frame.getControlValue().setCurrencySymbol(vo.getCurrencySymbolREG03());
      frame.getControlValue().setDecimals(vo.getDecimalsREG03().intValue());
      frame.getControlValue().setValue(vo.getPaymentValueDOC27());

      frame.getGrid().reloadData();
    }
    else
      frame.getGrid().clearData();
View Full Code Here

   * Callback method called by the Form panel when the Form is set to INSERT mode.
   * The method can pre-set some v.o. attributes, so that some input controls will have a predefined value associated.
   * @param persistentObject new value object
   */
  public void createPersistentObject(ValueObject PersistentObject) throws Exception {
    PaymentVO payVO = (PaymentVO)frame.getPayForm().getVOModel().getValueObject();
    payVO.setCompanyCodeSys01DOC27((String)frame.getPayGrid().getOtherGridParams().get(ApplicationConsts.COMPANY_CODE_SYS01));
    payVO.setPaymentDateDOC27(new java.sql.Date(System.currentTimeMillis()));
    payVO.setProgressiveReg04DOC27((BigDecimal)frame.getPayGrid().getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_REG04));

    if (frame.getControlCodCustomer().getValue()!=null && !frame.getControlCodCustomer().getValue().equals(""))
      payVO.setCustomerSupplierCodeDOC27((String)frame.getControlCodCustomer().getValue());
    else
      payVO.setCustomerSupplierCodeDOC27((String)frame.getControlCodSupplier().getValue());

    if (frame.getCompVO()!=null &&
        frame.getCompVO().getCurrencyCodeReg03()!=null &&
        !frame.getCompVO().getCurrencyCodeReg03().equals("")) {
      frame.getControlCurrency().setValue(frame.getCompVO().getCurrencyCodeReg03());
View Full Code Here

    ArrayList exp = new ArrayList();
    for(int i=0;i<frame.getGrid().getVOListTableModel().getRowCount();i++)
      exp.add( frame.getGrid().getVOListTableModel().getObjectForRow(i) );
    if (exp.size()==0)
      return new ErrorResponse("you need to specify at least one expiration");
    PaymentVO payVO = (PaymentVO)frame.getPayForm().getVOModel().getValueObject();

  // check total amount...
    BigDecimal total = new BigDecimal(0);
    PaymentDistributionVO vo = null;
    for(int i=0;i<exp.size();i++) {
      vo = (PaymentDistributionVO)exp.get(i);
      if (vo.getPaymentValueDOC28()==null)
        return new ErrorResponse("expirations must have a payment value");

      total = total.add(vo.getPaymentValueDOC28());
    }
    if ( payVO.getPaymentValueDOC27().subtract(total).doubleValue()!=0)
      return new ErrorResponse("payments specified for expirations are not equal to the total payment value");

    Response res = ClientUtils.getData("insertPayment",new Object[]{
      newPersistentObject,
      exp
View Full Code Here

  /**
   * Callback method invoked when the user has clicked on the insert button
   * @param valueObject empty value object just created: the user can manage it to fill some attribute values
   */
  public void createValueObject(ValueObject valueObject) throws Exception {
    PaymentVO payVO = (PaymentVO)frame.getPayForm().getVOModel().getValueObject();
    PaymentDistributionVO vo = (PaymentDistributionVO)valueObject;
    vo.setCompanyCodeSys01DOC28(payVO.getCompanyCodeSys01DOC27());
    vo.setPayedDOC28(Boolean.FALSE);
  }
View Full Code Here

   * @param newValue new cell value (just edited)
   * @return <code>true</code> if cell value is valid, <code>false</code> otherwise
   */
  public boolean validateCell(int rowNumber,String attributeName,Object oldValue,Object newValue) {
    PaymentDistributionVO vo = (PaymentDistributionVO)frame.getGrid().getVOListTableModel().getObjectForRow(rowNumber);
    PaymentVO payVO = (PaymentVO)frame.getPayForm().getVOModel().getValueObject();
    BigDecimal res = new BigDecimal(0);
    if (vo!=null && vo.getValueDOC19()!=null && vo.getAlreadyPayedDOC19()!=null)
      res = vo.getValueDOC19().subtract(vo.getAlreadyPayedDOC19());


    if (attributeName.equals("payedDOC28") &&
        Boolean.TRUE.equals(newValue) &&
        vo.getPaymentValueDOC28()==null
    ) {
      if (vo.getCurrencyCodeREG03().equals(payVO.getCurrencyCodeReg03DOC27()))
        vo.setPaymentValueDOC28( res );
      else {
        CurrencyConvVO convVO = null;
        for(int i=0;i<frame.getCurrConvs().size();i++) {
          convVO = (CurrencyConvVO)frame.getCurrConvs().get(i);
          if (convVO.getCurrencyCode2Reg03REG06().equals(vo.getCurrencyCodeREG03())) {
            vo.setPaymentValueDOC28( res.divide(convVO.getValueREG06(),vo.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP) );
            break;
          }
        }
      }
    }
    else if (attributeName.equals("paymentValueDOC28")) {
      // check for total amount...
      BigDecimal total = new BigDecimal(0);
      if (newValue!=null)
        total = total.add((BigDecimal)newValue);
      for(int i=0;i<frame.getGrid().getVOListTableModel().getRowCount();i++) {
        vo = (PaymentDistributionVO)frame.getGrid().getVOListTableModel().getObjectForRow(i);
        if (i!=rowNumber &&
            vo.getPaymentValueDOC28()!=null)
          total = total.add(vo.getPaymentValueDOC28());
      }
      if (payVO.getPaymentValueDOC27()==null || payVO.getPaymentValueDOC27().subtract(total).doubleValue()<0)
        return false;

      vo = (PaymentDistributionVO)frame.getGrid().getVOListTableModel().getObjectForRow(rowNumber);
      if (newValue!=null) {
        BigDecimal conv = (BigDecimal)newValue;
        if (!vo.getCurrencyCodeREG03().equals(payVO.getCurrencyCodeReg03DOC27())) {
          CurrencyConvVO convVO = null;
          for(int i=0;i<frame.getCurrConvs().size();i++) {
            convVO = (CurrencyConvVO)frame.getCurrConvs().get(i);
            if (convVO.getCurrencyCode2Reg03REG06().equals(vo.getCurrencyCodeREG03())) {
              conv = conv.multiply(convVO.getValueREG06());
View Full Code Here

      public Response loadData(int action, int startIndex, Map filteredColumns,
                               ArrayList currentSortedColumns,
                               ArrayList currentSortedVersusColumns,
                               Class valueObjectType, Map otherGridParams) {

        PaymentVO vo = (PaymentVO)payGrid.getVOListTableModel().getObjectForRow(payGrid.getSelectedRow());
        if (vo!=null)
          return ClientUtils.getData("loadPaymentDistributions",new Object[]{
            vo.getCompanyCodeSys01DOC27(),
            vo.getProgressiveDOC27()
          });
        else
          return new VOListResponse(new ArrayList(),false,0);
      }
View Full Code Here

            pVO.setPaymentValueDOC28(null);
          }
        }

        public void beforeLookupAction(ValueObject parentVO) {
          PaymentVO vo = (PaymentVO)payForm.getVOModel().getValueObject();
          expDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01DOC27());
          expDataLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01DOC27());
          expDataLocator.getLookupFrameParams().put(ApplicationConsts.PROGRESSIVE_REG04,vo.getProgressiveReg04DOC27());
          expDataLocator.getLookupValidationParameters().put(ApplicationConsts.PROGRESSIVE_REG04,vo.getProgressiveReg04DOC27());
          expDataLocator.getLookupFrameParams().put(ApplicationConsts.PAYED,"N");
          expDataLocator.getLookupValidationParameters().put(ApplicationConsts.PAYED,"N");
          expDataLocator.getLookupFrameParams().put(ApplicationConsts.CURRENCY_CODE_REG03,vo.getCurrencyCodeReg03DOC27());
          expDataLocator.getLookupValidationParameters().put(ApplicationConsts.CURRENCY_CODE_REG03,vo.getCurrencyCodeReg03DOC27());
          expDataLocator.getLookupFrameParams().put(ApplicationConsts.DATE_FILTER,vo.getPaymentDateDOC27());
          expDataLocator.getLookupValidationParameters().put(ApplicationConsts.DATE_FILTER,vo.getPaymentDateDOC27());
        }

        public void forceValidate() {}

      });

      // banks lookup...
      bankDataLocator.setGridMethodName("loadBanks");
      bankDataLocator.setValidationMethodName("validateBankCode");
      controlBankCode.setLookupController(bankController);
      controlBankCode.setControllerMethodName("getBanksList");
      bankController.setLookupDataLocator(bankDataLocator);
      bankController.setFrameTitle("banks");
      bankController.setLookupValueObjectClassName("org.jallinone.registers.bank.java.BankVO");
      bankController.addLookup2ParentLink("bankCodeREG12", "bankCodeReg12DOC27");
      bankController.addLookup2ParentLink("descriptionREG12","descriptionREG12");
      bankController.setAllColumnVisible(false);
      bankController.setVisibleColumn("bankCodeREG12", true);
      bankController.setVisibleColumn("descriptionREG12", true);
      bankController.setPreferredWidthColumn("descriptionREG12",200);
      new CustomizedColumns(new BigDecimal(232),bankController);

      // customer lookup...
      customerDataLocator.setGridMethodName("loadCustomers");
      customerDataLocator.setValidationMethodName("validateCustomerCode");

      controlCodCustomer.setLookupController(customerController);
      controlCodCustomer.setControllerMethodName("getCustomersList");
      customerController.setLookupDataLocator(customerDataLocator);
//      customerController.setForm(filterPanel);
      customerController.setFrameTitle("customers");
      customerController.setLookupValueObjectClassName("org.jallinone.sales.customers.java.GridCustomerVO");
      customerController.setAllColumnVisible(false);
      customerController.setVisibleColumn("companyCodeSys01REG04", true);
      customerController.setVisibleColumn("customerCodeSAL07", true);
      customerController.setVisibleColumn("name_1REG04", true);
      customerController.setVisibleColumn("name_2REG04", true);
      customerController.setVisibleColumn("cityREG04", true);
      customerController.setVisibleColumn("provinceREG04", true);
      customerController.setVisibleColumn("countryREG04", true);
      customerController.setVisibleColumn("taxCodeREG04", true);
      customerController.setHeaderColumnName("cityREG04", "city");
      customerController.setHeaderColumnName("provinceREG04", "prov");
      customerController.setHeaderColumnName("countryREG04", "country");
      customerController.setHeaderColumnName("taxCodeREG04", "taxCode");
      customerController.setPreferredWidthColumn("name_1REG04", 200);
      customerController.setPreferredWidthColumn("name_2REG04", 150);
      customerController.setFramePreferedSize(new Dimension(750,500));
//      customerDataLocator.getLookupFrameParams().put(ApplicationConsts.FILTER_COMPANY_FOR_INSERT,"DOC01_ORDERS");
//      customerDataLocator.getLookupValidationParameters().put(ApplicationConsts.FILTER_COMPANY_FOR_INSERT,"DOC01_ORDERS");
      customerController.addLookupListener(new LookupListener() {

        public void codeValidated(boolean validated) {}

        public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
          GridCustomerVO vo = (GridCustomerVO)customerController.getLookupVO();
          if (vo.getCustomerCodeSAL07()==null || vo.getCustomerCodeSAL07().equals("")) {
            controlCustName1.setText("");
            controlCustName2.setText("");
            payGrid.getOtherGridParams().remove(ApplicationConsts.COMPANY_CODE_SYS01);
            payGrid.getOtherGridParams().remove(ApplicationConsts.PROGRESSIVE_REG04);
            buttonSearch.setEnabled(false);
            payGrid.clearData();
            payForm.setMode(Consts.READONLY);
            compVO = null;

            insertButton1.setEnabled(false);
            saveButton.setEnabled(false);
            reloadButton.setEnabled(false);
            grid.clearData();
          }
          else {
            controlCodCustomer.setValue(vo.getCustomerCodeSAL07());
            controlCustName1.setText(vo.getName_1REG04());
            controlCustName2.setText(vo.getName_2REG04());
            controlCodSupplier.setValue("");
            controlSupplierName1.setText("");
            controlSupplierName2.setText("");
            payGrid.getOtherGridParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01REG04());
            payGrid.getOtherGridParams().put(ApplicationConsts.PROGRESSIVE_REG04,vo.getProgressiveREG04());
            buttonSearch.setEnabled(true);
            payGrid.clearData();
            payForm.setMode(Consts.READONLY);
            grid.clearData();

            Response res =  ClientUtils.getData("loadCompany",vo.getCompanyCodeSys01REG04());
            if (!res.isError())
              compVO = (OrganizationVO)((VOResponse)res).getVo();
            else
              compVO = null;

            insertButton1.setEnabled(true);
            saveButton.setEnabled(false);
            reloadButton.setEnabled(true);
          }
        }

        public void beforeLookupAction(ValueObject parentVO) {}

        public void forceValidate() {}

      });


      // supplier lookup...
      supplierDataLocator.setGridMethodName("loadSuppliers");
      supplierDataLocator.setValidationMethodName("validateSupplierCode");

      controlCodSupplier.setLookupController(supplierController);
      controlCodSupplier.setControllerMethodName("getSuppliersList");
      supplierController.setLookupDataLocator(supplierDataLocator);
//      supplierController.setForm(filterPanel);
      supplierController.setFrameTitle("suppliers");
      supplierController.setLookupValueObjectClassName("org.jallinone.purchases.suppliers.java.GridSupplierVO");
      supplierController.setAllColumnVisible(false);
      supplierController.setVisibleColumn("companyCodeSys01REG04", true);
      supplierController.setVisibleColumn("supplierCodePUR01", true);
      supplierController.setVisibleColumn("name_1REG04", true);
      supplierController.setVisibleColumn("name_2REG04", true);
      supplierController.setVisibleColumn("cityREG04", true);
      supplierController.setVisibleColumn("provinceREG04", true);
      supplierController.setVisibleColumn("countryREG04", true);
      supplierController.setVisibleColumn("taxCodeREG04", true);
      supplierController.setHeaderColumnName("name_1REG04", "corporateName1");
      supplierController.setHeaderColumnName("cityREG04", "city");
      supplierController.setHeaderColumnName("provinceREG04", "prov");
      supplierController.setHeaderColumnName("countryREG04", "country");
      supplierController.setHeaderColumnName("taxCodeREG04", "taxCode");
      supplierController.setPreferredWidthColumn("name_1REG04", 200);
      supplierController.setPreferredWidthColumn("name_2REG04", 150);
      supplierController.setFramePreferedSize(new Dimension(750,500));
//      supplierDataLocator.getLookupFrameParams().put(ApplicationConsts.FILTER_COMPANY_FOR_INSERT,"DOC06_ORDERS");
//      supplierDataLocator.getLookupValidationParameters().put(ApplicationConsts.FILTER_COMPANY_FOR_INSERT,"DOC06_ORDERS");
      supplierController.addLookupListener(new LookupListener() {

        public void codeValidated(boolean validated) {}

        public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
          GridSupplierVO vo = (GridSupplierVO)supplierController.getLookupVO();
          if (vo.getSupplierCodePUR01()==null || vo.getSupplierCodePUR01().equals("")) {
            controlSupplierName1.setText("");
            controlSupplierName2.setText("");
            payGrid.getOtherGridParams().remove(ApplicationConsts.COMPANY_CODE_SYS01);
            payGrid.getOtherGridParams().remove(ApplicationConsts.PROGRESSIVE_REG04);
            buttonSearch.setEnabled(false);
            payGrid.clearData();
            payForm.setMode(Consts.READONLY);

            insertButton1.setEnabled(false);
            saveButton.setEnabled(false);
            reloadButton.setEnabled(false);
          }
          else {
            controlCodSupplier.setValue(vo.getSupplierCodePUR01());
            controlSupplierName1.setText(vo.getName_1REG04());
            controlSupplierName2.setText(vo.getName_2REG04());
            controlCodCustomer.setValue("");
            controlCustName1.setText("");
            controlCustName2.setText("");
            payGrid.getOtherGridParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01REG04());
            payGrid.getOtherGridParams().put(ApplicationConsts.PROGRESSIVE_REG04,vo.getProgressiveREG04());
            buttonSearch.setEnabled(true);
            payGrid.clearData();
            payForm.setMode(Consts.READONLY);

            Response res =  ClientUtils.getData("loadCompany",vo.getCompanyCodeSys01REG04());
            if (!res.isError())
              compVO = (OrganizationVO)((VOResponse)res).getVo();
            else
              compVO = null;

            insertButton1.setEnabled(true);
            reloadButton.setEnabled(true);
            saveButton.setEnabled(false);
          }
        }

        public void beforeLookupAction(ValueObject parentVO) {}

        public void forceValidate() {}

      });

      controlStartDate.addDateChangedListener(new DateChangedListener() {
        public void dateChanged(Date oldDate,Date newDate) {
          if (newDate!=null)
            payGrid.getOtherGridParams().put(ApplicationConsts.START_DATE,newDate);
          else
            payGrid.getOtherGridParams().remove(ApplicationConsts.START_DATE);
        }
      });

      controlEndDate.addDateChangedListener(new DateChangedListener() {
        public void dateChanged(Date oldDate,Date newDate) {
          if (newDate!=null)
            payGrid.getOtherGridParams().put(ApplicationConsts.END_DATE,newDate);
          else
            payGrid.getOtherGridParams().remove(ApplicationConsts.END_DATE);
        }
      });


      colValueDOC27.setDynamicSettings(payGridCurrencySettings);

      colValue.setDynamicSettings(expCurrencySettings);
      colPayedValue.setDynamicSettings(payCurrencySettings);
      colAlreadyPayed.setDynamicSettings(expCurrencySettings);

      // payment lookup...
      payTypeDataLocator.setGridMethodName("loadPaymentTypes");
      payTypeDataLocator.setValidationMethodName("validatePaymentTypeCode");

      controlPayCode.setLookupController(payTypeController);
      controlPayCode.setControllerMethodName("getPaymentTypesList");
      payTypeController.setLookupDataLocator(payTypeDataLocator);
      payTypeController.setFrameTitle("payment types");
      payTypeController.setLookupValueObjectClassName("org.jallinone.registers.payments.java.PaymentTypeVO");
      payTypeController.addLookup2ParentLink("paymentTypeCodeREG11", "paymentTypeCodeReg11DOC27");
      payTypeController.addLookup2ParentLink("descriptionSYS10","paymentDescriptionSYS10");
      payTypeController.setAllColumnVisible(false);
      payTypeController.setVisibleColumn("paymentTypeCodeREG11", true);
      payTypeController.setVisibleColumn("descriptionSYS10", true);
      new CustomizedColumns(new BigDecimal(222),payTypeController);
      payTypeController.addLookupListener(new LookupListener() {

        public void beforeLookupAction(ValueObject parentVO) {
        }

        public void codeChanged(ValueObject parentVO,
                                Collection parentChangedAttributes) {
          PaymentTypeVO vo = (PaymentTypeVO)payTypeController.getLookupVO();
          PaymentVO payVO = (PaymentVO)parentVO;
          if (vo==null || vo.getAccountCodeAcc02REG11()==null) {
            payVO.setAccountCodeAcc02DOC27(null);
            payVO.setAcc02DescriptionSYS10(null);
          }
          else {
            payVO.setAccountCodeAcc02DOC27(vo.getAccountCodeAcc02REG11());
            payVO.setAcc02DescriptionSYS10(vo.getAcc02DescriptionSYS10());
          }
        }

        public void codeValidated(boolean validated) {
        }
View Full Code Here

      return true;
    }


    public int getDecimals(int row) {
      PaymentVO vo = (PaymentVO)payForm.getVOModel().getValueObject();
      if (vo!=null && vo.getDecimalsREG03()!=null)
        return vo.getDecimalsREG03().intValue();
      else
        return 0;
    }
View Full Code Here

        return 0;
    }


    public String getCurrencySymbol(int row) {
      PaymentVO vo = (PaymentVO)payForm.getVOModel().getValueObject();
      if (vo!=null && vo.getCurrencySymbolREG03()!=null)
        return vo.getCurrencySymbolREG03();
      else
      return "E";
    }
View Full Code Here

TOP

Related Classes of org.jallinone.expirations.java.PaymentVO

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.