Package org.jallinone.sales.customers.java

Examples of org.jallinone.sales.customers.java.GridCustomerVO


      customerController.addLookupListener(new LookupListener() {

        public void codeValidated(boolean validated) {}

        public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
          GridCustomerVO custVO = (GridCustomerVO)customerController.getLookupVO();
          JournalHeaderWithVatVO vo = (JournalHeaderWithVatVO)headerPanel.getVOModel().getValueObject();
          vo.setCreditAccountCodeAcc02SAL07(custVO.getCreditAccountCodeAcc02SAL07());
        }

        public void beforeLookupAction(ValueObject parentVO) {
          customerDataLocator.getLookupFrameParams().put(ApplicationConsts.SUBJECT_TYPE,ApplicationConsts.SUBJECT_ORGANIZATION_CUSTOMER);
          customerDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,controlCompaniesCombo.getValue());
View Full Code Here


      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("");
            grid.getOtherGridParams().remove(ApplicationConsts.COMPANY_CODE_SYS01);
            grid.getOtherGridParams().remove(ApplicationConsts.PROGRESSIVE_REG04);
          }
          else {
            controlCodCustomer.setValue(vo.getCustomerCodeSAL07());
            controlCustName1.setText(vo.getName_1REG04());
            controlCustName2.setText(vo.getName_2REG04());
            controlCodSupplier.setValue("");
            controlSupplierName1.setText("");
            controlSupplierName2.setText("");
            grid.getOtherGridParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01REG04());
            grid.getOtherGridParams().put(ApplicationConsts.PROGRESSIVE_REG04,vo.getProgressiveREG04());
          }
        }

        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("");
            grid.getOtherGridParams().remove(ApplicationConsts.COMPANY_CODE_SYS01);
            grid.getOtherGridParams().remove(ApplicationConsts.PROGRESSIVE_REG04);
          }
          else {
            controlCodSupplier.setValue(vo.getSupplierCodePUR01());
            controlSupplierName1.setText(vo.getName_1REG04());
            controlSupplierName2.setText(vo.getName_2REG04());
            controlCodCustomer.setValue("");
            controlCustName1.setText("");
            controlCustName2.setText("");
            grid.getOtherGridParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01REG04());
            grid.getOtherGridParams().put(ApplicationConsts.PROGRESSIVE_REG04,vo.getProgressiveREG04());
          }
        }

        public void beforeLookupAction(ValueObject parentVO) {}

        public void forceValidate() {}

      });

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

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

      final Domain d = new Domain("INVOICE_DOC_TYPES");
      d.addDomainPair("","all invoices");
      d.addDomainPair(ApplicationConsts.SALE_DESK_DOC_TYPE,"desk selling");
      d.addDomainPair(ApplicationConsts.SALE_GENERIC_INVOICE,"sale invoice");
      d.addDomainPair(ApplicationConsts.PURCHASE_GENERIC_INVOICE,"purchase invoice");
      controlDocType.setDomain(d);
      controlDocType.getComboBox().addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
          if (e.getStateChange() == e.SELECTED) {
            if (controlDocType.getValue()==null ||
                controlDocType.getValue().equals(""))
              grid.getOtherGridParams().remove(ApplicationConsts.DOC_TYPE);
            else
              grid.getOtherGridParams().put(ApplicationConsts.DOC_TYPE,controlDocType.getValue());
          }
        }
      });


      controlShowPayed.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
          if (controlShowPayed.isSelected())
            // show all expirations: remove filter...
            grid.getOtherGridParams().remove(ApplicationConsts.PAYED);
          else
            // show NOT yet payed expirations: apply filter on "N" (not payed)
            grid.getOtherGridParams().put(ApplicationConsts.PAYED,"N");
        }
      });
//      controlShowPayed.setSelected(true);
      grid.getOtherGridParams().put(ApplicationConsts.PAYED,"N");

      colValue.setDynamicSettings(this);
      colPayedValue.setDynamicSettings(this);
      colAlreadyPayed.setDynamicSettings(this);



      Domain docTypeDomain = new Domain("DOC_TYPE");
      docTypeDomain.addDomainPair(ApplicationConsts.PURCHASE_INVOICE_DOC_TYPE,"purchase invoice");
      docTypeDomain.addDomainPair(ApplicationConsts.PURCHASE_INVOICE_FROM_DN_DOC_TYPE,"purchase invoice from delivery notes");
      docTypeDomain.addDomainPair(ApplicationConsts.PURCHASE_INVOICE_FROM_PD_DOC_TYPE,"purchase invoice from purchase document");
      docTypeDomain.addDomainPair(ApplicationConsts.PURCHASE_DEBIT_NOTE_DOC_TYPE,"debiting note");
      docTypeDomain.addDomainPair(ApplicationConsts.PURCHASE_GENERIC_INVOICE,"purchase generic document");
      docTypeDomain.addDomainPair(ApplicationConsts.SALE_INVOICE_DOC_TYPE,"sale invoice");
      docTypeDomain.addDomainPair(ApplicationConsts.SALE_INVOICE_FROM_DN_DOC_TYPE,"sale invoice from delivery notes");
      docTypeDomain.addDomainPair(ApplicationConsts.SALE_INVOICE_FROM_SD_DOC_TYPE,"sale invoice from sale document");
      docTypeDomain.addDomainPair(ApplicationConsts.SALE_CREDIT_NOTE_DOC_TYPE,"credit note");
      docTypeDomain.addDomainPair(ApplicationConsts.SALE_GENERIC_INVOICE,"sale generic document");
      docTypeDomain.addDomainPair(ApplicationConsts.SALE_DESK_DOC_TYPE,"desk selling");
      colDocType.setDomain(docTypeDomain);


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

      colRealPayTipeCode.setLookupController(payTypeController);
      colRealPayTipeCode.setControllerMethodName("getPaymentTypesList");
      payTypeController.setLookupDataLocator(payTypeDataLocator);
      payTypeController.setFrameTitle("payment types");
      payTypeController.setLookupValueObjectClassName("org.jallinone.registers.payments.java.PaymentTypeVO");
      payTypeController.addLookup2ParentLink("paymentTypeCodeREG11", "realPaymentTypeCodeReg11DOC19");
      payTypeController.addLookup2ParentLink("descriptionSYS10","realPaymentDescriptionSYS10");
      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();
          ExpirationVO expVO = (ExpirationVO)parentVO;
          if (vo==null || vo.getAccountCodeAcc02REG11()==null) {
            expVO.setRealAccountCodeAcc02DOC19(null);
            expVO.setRealAcc02DescriptionSYS10(null);
          }
          else {
            expVO.setRealAccountCodeAcc02DOC19(vo.getAccountCodeAcc02REG11());
            expVO.setRealAcc02DescriptionSYS10(vo.getAcc02DescriptionSYS10());
          }
        }

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

          if (customerController.getLookupVO()==null) {
            controlCustName1.setText("");
            controlCustName2.setText("");
          }
          else {
            GridCustomerVO vo = (GridCustomerVO)customerController.getLookupVO();
            controlCustName1.setText(vo.getName_1REG04());
            controlCustName2.setText(vo.getName_2REG04());
          }
        }

        public void beforeLookupAction(ValueObject parentVO) {
          customerDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,controlComp.getValue());
          customerDataLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,controlComp.getValue());
        }

        public void forceValidate() {}

      });




      pivotTable.setController(new PivotTableController(){

        public Response getPivotTableModel(PivotTableParameters pars) {
          filterPanel.pull();
          SalesPivotVO vo= (SalesPivotVO)filterPanel.getVOModel().getValueObject();
          vo.setPivotPars(pars);
          pars.setInputFilter(new InputFilter());
          Response res = ClientUtils.getData("salesPivot",vo);
          if (res.isError())
            OptionPane.showMessageDialog(SalesPivotFrame.this,res.getErrorMessage(),"Error while loading data",JOptionPane.ERROR_MESSAGE);
          return res;
        }

      });

      RowField rowFieldItem = new RowField("itemCodeItm01DOC02",100);
      RowField rowFieldCustomer = new RowField("customerCodeSAL07",150);
      RowField rowFieldWarehouse = new RowField("warehouseCodeWar01DOC01",100);

      pivotTable.getAllRowFields().add(rowFieldItem);
      pivotTable.getAllRowFields().add(rowFieldCustomer);
      pivotTable.getAllRowFields().add(rowFieldWarehouse);

      pivotTable.addRowField(rowFieldWarehouse);
//      pivotTable.addRowField(rowFieldItem);

      ColumnField columnFieldYear = new ColumnField("docDateDOC01","year",new YearAggregator());
      ColumnField columnFieldQuarter = new ColumnField("docDateDOC01","quarter",new QuarterAggregator());

      pivotTable.getAllColumnFields().add(columnFieldYear);
      pivotTable.getAllColumnFields().add(columnFieldQuarter);

      pivotTable.addColumnField(columnFieldYear);
      pivotTable.addColumnField(columnFieldQuarter);

      NumberFormat nf = NumberFormat.getCurrencyInstance();
      Currency currency = Currency.getInstance(Locale.getDefault()); // to review...
      nf.setCurrency(currency);
      nf.setMaximumFractionDigits(2);
      nf.setMinimumFractionDigits(2);
      nf.setGroupingUsed(true);

      DataField dataFieldTotal = new DataField("totalDOC01",80,"sellAmount",new SumFunction()); // sum function...
      dataFieldTotal.setFormatter(nf);

      NumberFormat nf2 = NumberFormat.getIntegerInstance();

      DataField dataFieldItemQty = new DataField("qtyDOC02",80,"sellQty",new SumFunction()); // sum function...
      dataFieldItemQty.setFormatter(nf2);

      pivotTable.getAllDataFields().add(dataFieldTotal);
      pivotTable.getAllDataFields().add(dataFieldItemQty);
      pivotTable.addDataField(dataFieldTotal);


      pivotTable.setDataFieldRenderer(new DataFieldRenderer() {

        /**
         * @param currentColor current color to set
         * @param rowPath GenericNodeKey row fields path that identify current row
         * @param colPath GenericNodeKey column fields path that identify current column
         * @param value value to show in the specified cell
         * @param row current row
         * @param col current column
         * @return Color background color to set
         */
        public Color getBackgroundColor(Color currentColor,GenericNodeKey rowPath,GenericNodeKey colPath,Object value,int row,int col) {
          if (rowPath.getPath().length<pivotTable.getPivotTableParameters().getRowFields().size() ||
              colPath.getPath().length<pivotTable.getPivotTableParameters().getColumnFields().size()+1) {
            int c = 200+rowPath.getPath().length*colPath.getPath().length*5;
            return new Color(c,c,c);
          }
          return currentColor;
        }


        /**
         * @param currentColor current color to set
         * @param rowPath GenericNodeKey row fields path that identify current row
         * @param colPath GenericNodeKey column fields path that identify current column
         * @param value value to show in the specified cell
         * @param row current row
         * @param col current column
         * @return Color foreground color to set
         */
        public Color getForegroundColor(Color currentColor,GenericNodeKey rowPath,GenericNodeKey colPath,Object value,int row,int col) {
          return currentColor;
        }


        /**
         * @param currentFont current font to set
         * @param rowPath GenericNodeKey row fields path that identify current row
         * @param colPath GenericNodeKey column fields path that identify current column
         * @param value value to show in the specified cell
         * @param row current row
         * @param col current column
         * @return font to set
         */
        public Font getFont(Font currentFont,GenericNodeKey rowPath,GenericNodeKey colPath,Object value,int row,int col) {
          if (rowPath.getPath().length<pivotTable.getPivotTableParameters().getRowFields().size() ||
              colPath.getPath().length<pivotTable.getPivotTableParameters().getColumnFields().size()+1)
            return new Font(currentFont.getFontName(),Font.BOLD,currentFont.getSize());
          return currentFont;
        }

      });



      controlComp.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
          Object companyCodeSys01 = controlComp.getValue();
          if (companyCodeSys01==null)
            companyCodeSys01 = controlComp.getDomain().getDomainPairList()[0].getCode();

          SalesPivotVO vo= (SalesPivotVO)filterPanel.getVOModel().getValueObject();
          vo.setCompanyCode((String)companyCodeSys01);
        }

      });

  }
View Full Code Here

      customerController.addLookupListener(new LookupListener() {

        public void codeValidated(boolean validated) {}

        public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
          GridCustomerVO custVO = (GridCustomerVO)customerController.getLookupVO();
          JournalRowVO vo = (JournalRowVO)detailPanel.getVOModel().getValueObject();
          vo.setAccountCodeAcc02ACC06(custVO.getCreditAccountCodeAcc02SAL07());
          vo.setAccountCodeACC06(custVO.getCustomerCodeSAL07());
          controlCcode.setValue(custVO.getCustomerCodeSAL07());
          controlDebit.requestFocus();
        }

        public void beforeLookupAction(ValueObject parentVO) {
          customerDataLocator.getLookupFrameParams().put(ApplicationConsts.SUBJECT_TYPE,ApplicationConsts.SUBJECT_ORGANIZATION_CUSTOMER);
View Full Code Here

      return;
    }

    HashMap params = new HashMap();

    GridCustomerVO vo = (GridCustomerVO)custPanel.getVOModel().getValueObject();
    params.put("COMPANY_CODE",controlCompaniesCombo.getValue());
    params.put("PROGRESSIVE_REG04",vo.getProgressiveREG04());
    params.put("CUSTOMER_CODE",vo.getCustomerCodeSAL07());

    HashMap map = new HashMap();
    map.put(ApplicationConsts.COMPANY_CODE_SYS01,controlCompaniesCombo.getValue());
    map.put(ApplicationConsts.FUNCTION_CODE_SYS06,"ACC06_CUST_ACCOUNT");
    map.put(ApplicationConsts.EXPORT_PARAMS,params);
View Full Code Here

      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

    // load customer info...
    pars = new LookupValidationParams(customerCode,new HashMap());
    pars.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,companyCodeSys01);
    res = ClientUtils.getData("validateCustomerCode",pars);
    GridCustomerVO gridCustomerVO = null;
    if (!res.isError()) {
      java.util.List vos = ((VOListResponse)res).getRows();
      if (vos.size()==1)
        gridCustomerVO = (GridCustomerVO)vos.get(0);
      else
        gridCustomerVO = null;
    }
    else
      gridCustomerVO = null;


    // load customer detail vo...
    res = ClientUtils.getData("loadCustomer",new CustomerPK(
        gridCustomerVO.getCompanyCodeSys01REG04(),
        gridCustomerVO.getProgressiveREG04(),
        ApplicationConsts.SUBJECT_PEOPLE_CUSTOMER
    ));
    if (!res.isError()) {
      customerVO = (PeopleCustomerVO)((VOResponse)res).getVo();
      if (customerVO.getCurrencyCodeReg03SAL01()==null ||
          customerVO.getPricelistCodeSal01SAL07()==null) {
        OptionPane.showMessageDialog(MDIFrame.getInstance(),"you need to specify a pricelist for the default customer","Attention",JOptionPane.OK_OPTION);
        return false;
      }
    }
    else {
      customerVO = null;
      OptionPane.showMessageDialog(MDIFrame.getInstance(),"you need to specifify the default customer for retail sale","Attention",JOptionPane.OK_OPTION);
      return false;
    }

    // load currency info...
    pars = new LookupValidationParams(customerVO.getCurrencyCodeReg03SAL01(),new HashMap());
    res = ClientUtils.getData("validateCurrencyCode",pars);
    if (!res.isError())
      currVO = (CurrencyVO)((VOListResponse)res).getRows().get(0);
    else
      currVO = null;


    // set currency format...
    controlChange.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    controlChange.setDecimalSymbol(currVO.getDecimalSymbolREG03().charAt(0));
    controlChange.setGroupingSymbol(currVO.getThousandSymbolREG03().charAt(0));
    controlChange.setDecimals(currVO.getDecimalsREG03().intValue());
    controlDiscount.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    controlDiscount.setDecimalSymbol(currVO.getDecimalSymbolREG03().charAt(0));
    controlDiscount.setGroupingSymbol(currVO.getThousandSymbolREG03().charAt(0));
    controlDiscount.setDecimals(currVO.getDecimalsREG03().intValue());
    controlPaid.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    controlPaid.setDecimalSymbol(currVO.getDecimalSymbolREG03().charAt(0));
    controlPaid.setGroupingSymbol(currVO.getThousandSymbolREG03().charAt(0));
    controlPaid.setDecimals(currVO.getDecimalsREG03().intValue());
    controlSubtotal.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    controlSubtotal.setDecimalSymbol(currVO.getDecimalSymbolREG03().charAt(0));
    controlSubtotal.setGroupingSymbol(currVO.getThousandSymbolREG03().charAt(0));
    controlSubtotal.setDecimals(currVO.getDecimalsREG03().intValue());
    controlTotal.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    controlTotal.setDecimalSymbol(currVO.getDecimalSymbolREG03().charAt(0));
    controlTotal.setGroupingSymbol(currVO.getThousandSymbolREG03().charAt(0));
    controlTotal.setDecimals(currVO.getDecimalsREG03().intValue());
    controlQty.setDecimals(0);
    controlItemValDiscount.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    controlItemValDiscount.setDecimalSymbol(currVO.getDecimalSymbolREG03().charAt(0));
    controlItemValDiscount.setGroupingSymbol(currVO.getThousandSymbolREG03().charAt(0));
    controlItemValDiscount.setDecimals(currVO.getDecimalsREG03().intValue());
    controlValDiscountTotal.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    controlValDiscountTotal.setDecimalSymbol(currVO.getDecimalSymbolREG03().charAt(0));
    controlValDiscountTotal.setGroupingSymbol(currVO.getThousandSymbolREG03().charAt(0));
    controlValDiscountTotal.setDecimals(currVO.getDecimalsREG03().intValue());
    controlValPaidTotal.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    controlValPaidTotal.setDecimalSymbol(currVO.getDecimalSymbolREG03().charAt(0));
    controlValPaidTotal.setGroupingSymbol(currVO.getThousandSymbolREG03().charAt(0));
    controlValPaidTotal.setDecimals(currVO.getDecimalsREG03().intValue());
    colTot.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    colTot.setDecimals(currVO.getDecimalsREG03().intValue());
    colTotDisc.setCurrencySymbol(currVO.getCurrencySymbolREG03());
    colTotDisc.setDecimals(currVO.getDecimalsREG03().intValue());

    controlDiscountPerc.setDecimals(3);
    controlDiscountPerc.setColumns(5);
    panControlDiscountPerc.add(controlDiscountPerc, BorderLayout.CENTER);
    panControlDiscountPerc.add(new JLabel("%"), BorderLayout.EAST);

    // barcode lookup...
    controlBarcode.setTrimText(true);
    controlBarcode.setUpperCase(true);
/*
    controlBarcode.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent e) {
        checkBarcode();
      }
    });
*/
    controlBarcode.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode()==e.VK_ENTER || e.getKeyCode()==e.VK_TAB)
          checkBarcode();
      }
    });


/*
          try {
            if (barCodeController.getLookupVO()!=null) {
              StoredSerialNumberVO snVO = (StoredSerialNumberVO)barCodeController.getLookupVO();

              LookupValidationParams pars = new LookupValidationParams(snVO.getItemCodeItm01WAR05(),new HashMap());
              pars.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,snVO.getCompanyCodeSys01WAR05());
              pars.getLookupValidationParameters().put(ApplicationConsts.PRICELIST,customerVO.getPricelistCodeSal01SAL07());
              Response res = ClientUtils.getData("validatePriceItemCode",pars);
              PriceItemVO priceItemVO = null;
              if (!res.isError()) {
                java.util.List vos = ((VOListResponse)res).getRows();
                if (vos.size()==1)
                  priceItemVO = (PriceItemVO)vos.get(0);
                else
                  priceItemVO = null;
              }
              else
                priceItemVO = null;

              if (priceItemVO!=null) {
                if (snVO.getSerialNumberWAR05()==null) {
                  // no bar code found in WAR05, but barcode found in ITM01:
                  // check if the item ha not variants...
                  if (priceItemVO.getUseVariant1ITM01().equals(ApplicationConsts.JOLLY) &&
                      priceItemVO.getUseVariant2ITM01().equals(ApplicationConsts.JOLLY) &&
                      priceItemVO.getUseVariant3ITM01().equals(ApplicationConsts.JOLLY) &&
                      priceItemVO.getUseVariant4ITM01().equals(ApplicationConsts.JOLLY) &&
                      priceItemVO.getUseVariant5ITM01().equals(ApplicationConsts.JOLLY))
                    maybeAddRow(snVO,priceItemVO);
                }
                else {
                  // serial num & bar code found:
                  maybeAddRow(snVO,priceItemVO);
                }
              }
            }

            controlBarcode.setValue(null);
          }
          catch (Exception ex) {
            ex.printStackTrace();
          }

      public void beforeLookupAction(ValueObject parentVO) {
        barcodeLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,customerVO.getCompanyCodeSys01REG04());
        barcodeLocator.getLookupFrameParams().put(ApplicationConsts.PROGRESSIVE_HIE01,warehouseVO.getProgressiveHie01HIE02());
        barcodeLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,customerVO.getCompanyCodeSys01REG04());
        barcodeLocator.getLookupValidationParameters().put(ApplicationConsts.PROGRESSIVE_HIE01,warehouseVO.getProgressiveHie01HIE02());
        barcodeLocator.getLookupValidationParameters().put(ApplicationConsts.VALIDATE_BARCODE,Boolean.TRUE);
        barcodeLocator.getLookupValidationParameters().put(ApplicationConsts.PRICELIST,customerVO.getPricelistCodeSal01SAL07());
      }
*/


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

    controlCustomerCode.setLookupController(customerController);
    controlCustomerCode.setControllerMethodName("getCustomersList");
    customerController.setLookupDataLocator(customerDataLocator);
    customerController.setFrameTitle("customers");
    customerController.setLookupValueObjectClassName("org.jallinone.sales.customers.java.GridCustomerVO");
/*
    customerController.addLookup2ParentLink("companyCodeSys01REG04", "companyCodeSys01DOC01");
    customerController.addLookup2ParentLink("customerCodeSAL07","customerCodeSAL07");
    customerController.addLookup2ParentLink("progressiveREG04","progressiveReg04DOC01");
    customerController.addLookup2ParentLink("name_1REG04", "name_1REG04");
    customerController.addLookup2ParentLink("name_2REG04", "name_2REG04");
    customerController.addLookup2ParentLink("paymentCodeReg10SAL07", "paymentCodeReg10DOC01");
    customerController.addLookup2ParentLink("paymentDescriptionSAL07", "paymentDescriptionDOC01");
    customerController.addLookup2ParentLink("vatCodeReg01SAL07", "customerVatCodeReg01DOC01");
*/
    customerController.setAllColumnVisible(false);
    customerController.setOnInvalidCode(customerController.ON_INVALID_CODE_RESTORE_LAST_VALID_CODE);
    customerController.setVisibleColumn("companyCodeSys01REG04", true);
    customerController.setFilterableColumn("companyCodeSys01REG04", true);
    customerController.setFilterableColumn("customerCodeSAL07", true);
    customerController.setFilterableColumn("name_1REG04", true);
    customerController.setFilterableColumn("name_2REG04", true);
    customerController.setFilterableColumn("cityREG04", true);
    customerController.setFilterableColumn("provinceREG04", true);

    customerController.setSortableColumn("companyCodeSys01REG04", true);
    customerController.setSortableColumn("customerCodeSAL07", true);
    customerController.setSortableColumn("name_1REG04", true);
    customerController.setSortableColumn("name_2REG04", true);
    customerController.setSortableColumn("cityREG04", true);
    customerController.setSortableColumn("provinceREG04", 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.setHeaderColumnName("name_1REG04", "corporateName1");
    customerController.setHeaderColumnName("name_2REG04", "corporateName2");
    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) {
        if (customerController.getLookupVO()==null) {
        }
        else {
          GridCustomerVO vo = (GridCustomerVO)customerController.getLookupVO();
          Response res = ClientUtils.getData("loadCustomer",new CustomerPK(
              vo.getCompanyCodeSys01REG04(),
              vo.getProgressiveREG04(),
              ApplicationConsts.SUBJECT_PEOPLE_CUSTOMER
          ));
          if (!res.isError()) {
            customerVO = (PeopleCustomerVO)((VOResponse)res).getVo();
            controlName1.setText(customerVO.getName_1REG04());
            controlName2.setText(customerVO.getName_2REG04());
            controlCustomer.setText(customerVO.getCustomerCodeSAL07());

            if (customerVO.getPricelistCodeSal01SAL07()!=null) {
              detailSaleDocVO.setPricelistCodeSal01DOC01(customerVO.getPricelistCodeSal01SAL07());
              detailSaleDocVO.setPricelistDescriptionDOC01(customerVO.getPricelistDescriptionSYS10());
            }
          }
        }
      }

      public void beforeLookupAction(ValueObject parentVO) {
        customerDataLocator.getLookupFrameParams().put(ApplicationConsts.SUBJECT_TYPE,ApplicationConsts.SUBJECT_PEOPLE_CUSTOMER);
      }

      public void forceValidate() {}

    });
    controlCustomerCode.setValue(customerVO.getCustomerCodeSAL07());
    controlName1.setText(customerVO.getName_1REG04());
    controlName2.setText(customerVO.getName_2REG04());


    // payment lookup...
    payDataLocator.setGridMethodName("loadPayments");
    payDataLocator.setValidationMethodName("validatePaymentCode");

    controlPaymentCode.setLookupController(payController);
    controlPaymentCode.setControllerMethodName("getPaymentsList");
    payController.setOnInvalidCode(customerController.ON_INVALID_CODE_RESTORE_LAST_VALID_CODE);
    payController.setLookupDataLocator(payDataLocator);
    payController.setFrameTitle("payments");
    payController.setLookupValueObjectClassName("org.jallinone.registers.payments.java.PaymentVO");
    payController.addLookup2ParentLink("paymentCodeREG10", "paymentCodeReg10DOC01");
    payController.addLookup2ParentLink("descriptionSYS10","paymentDescriptionDOC01");
    payController.setAllColumnVisible(false);
    payController.setVisibleColumn("paymentCodeREG10", true);
    payController.setVisibleColumn("descriptionSYS10", true);
    payController.setPreferredWidthColumn("paymentCodeREG10",100);
    payController.setPreferredWidthColumn("descriptionSYS10",250);
    payController.setFramePreferedSize(new Dimension(400,300));

    payController.addLookupListener(new LookupListener() {

      public void codeValidated(boolean validated) {}

      public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
        PaymentVO vo = (PaymentVO)payController.getLookupVO();
        if (payController.getLookupVO()==null) {
        }
        else {
           detailSaleDocVO.setPaymentCodeReg10DOC01(vo.getPaymentCodeREG10());
           detailSaleDocVO.setPaymentDescriptionDOC01(vo.getDescriptionSYS10());
           controlPayDescr.setText(detailSaleDocVO.getPaymentDescriptionDOC01());
        }
      }

      public void beforeLookupAction(ValueObject parentVO) {
        GridCustomerVO vo = (GridCustomerVO)customerController.getLookupVO();
        customerDataLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01REG04());
        customerDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01REG04());
        customerDataLocator.getLookupFrameParams().put(ApplicationConsts.SUBJECT_TYPE,ApplicationConsts.SUBJECT_PEOPLE_CUSTOMER);
      }

      public void forceValidate() {}

View Full Code Here

    labelSuggstmt.setText("\n \n");

    LookupValidationParams pars = new LookupValidationParams(defaultCustomerCode,new HashMap());
    pars.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,defaultCompanyCodeSys01);
    res = ClientUtils.getData("validateCustomerCode",pars);
    GridCustomerVO gridCustomerVO = null;
    if (!res.isError()) {
      java.util.List vos = ((VOListResponse)res).getRows();
      if (vos.size()==1)
        gridCustomerVO = (GridCustomerVO)vos.get(0);
      else
View Full Code Here

TOP

Related Classes of org.jallinone.sales.customers.java.GridCustomerVO

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.