expController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {}
public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
ExpirationVO vo = (ExpirationVO)expController.getLookupVO();
PaymentDistributionVO pVO = (PaymentDistributionVO)grid.getVOListTableModel().getObjectForRow(grid.getSelectedRow());
if (vo!=null && vo.getProgressiveDOC19()!=null) {
BigDecimal res = vo.getValueDOC19().subtract(vo.getAlreadyPayedDOC19());
CurrencyConvVO convVO = null;
if (vo.getCurrencyCodeReg03DOC19().equals(controlCurrency.getValue()))
pVO.setPaymentValueDOC28( res );
else {
for(int i=0;i<currConvs.size();i++) {
convVO = (CurrencyConvVO)currConvs.get(i);
if (convVO.getCurrencyCode2Reg03REG06().equals(vo.getCurrencyCodeReg03DOC19())) {
pVO.setPaymentValueDOC28( res.divide(convVO.getValueREG06(),vo.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP) );
break;
}
}
}
}
else {
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) {
}