creditController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {}
public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
AccountVO vo = (AccountVO)creditController.getLookupVO();
controlCreditsCode.setValue(vo.getAccountCodeACC02());
controlCreditsDescr.setValue(vo.getDescriptionSYS10());
}
public void beforeLookupAction(ValueObject parentVO) {
}
public void forceValidate() {}
});
// items account code lookup...
itemsDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
itemsDataLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
controlItemsCode.setLookupController(itemsController);
controlItemsCode.setControllerMethodName("getAccounts");
itemsController.setLookupDataLocator(itemsDataLocator);
itemsDataLocator.setGridMethodName("loadAccounts");
itemsDataLocator.setValidationMethodName("validateAccountCode");
itemsController.setFrameTitle("accounts");
itemsController.setLookupValueObjectClassName("org.jallinone.accounting.accounts.java.AccountVO");
// itemsController.addLookup2ParentLink("accountCodeACC02", "itemsAccountCodeAcc02SAL07");
// itemsController.addLookup2ParentLink("descriptionSYS10","itemsAccountDescrSAL07");
itemsController.setFramePreferedSize(new Dimension(400,400));
itemsController.setAllColumnVisible(false);
itemsController.setVisibleColumn("accountCodeACC02", true);
itemsController.setVisibleColumn("descriptionSYS10", true);
itemsController.setPreferredWidthColumn("accountCodeACC02", 100);
itemsController.setPreferredWidthColumn("descriptionSYS10", 290);
itemsController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {}
public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
AccountVO vo = (AccountVO)itemsController.getLookupVO();
controlItemsCode.setValue(vo.getAccountCodeACC02());
controlItemsDescr.setValue(vo.getDescriptionSYS10());
}
public void beforeLookupAction(ValueObject parentVO) { }
public void forceValidate() {}
});
// activities account code lookup...
actDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
actDataLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
controlActCode.setLookupController(actController);
controlActCode.setControllerMethodName("getAccounts");
actController.setLookupDataLocator(actDataLocator);
actDataLocator.setGridMethodName("loadAccounts");
actDataLocator.setValidationMethodName("validateAccountCode");
actController.setFrameTitle("accounts");
actController.setLookupValueObjectClassName("org.jallinone.accounting.accounts.java.AccountVO");
// actController.addLookup2ParentLink("accountCodeACC02", "activitiesAccountCodeAcc02SAL07");
// actController.addLookup2ParentLink("descriptionSYS10","activitiesAccountDescrSAL07");
actController.setFramePreferedSize(new Dimension(400,400));
actController.setAllColumnVisible(false);
actController.setVisibleColumn("accountCodeACC02", true);
actController.setVisibleColumn("descriptionSYS10", true);
actController.setPreferredWidthColumn("accountCodeACC02", 100);
actController.setPreferredWidthColumn("descriptionSYS10", 290);
actController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {}
public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
AccountVO vo = (AccountVO)actController.getLookupVO();
controlActCode.setValue(vo.getAccountCodeACC02());
controlActDescr.setValue(vo.getDescriptionSYS10());
}
public void beforeLookupAction(ValueObject parentVO) { }
public void forceValidate() {}
});
// charges account code lookup...
chargesDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
chargesDataLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
controlChargesCode.setLookupController(chargesController);
controlChargesCode.setControllerMethodName("getAccounts");
chargesController.setLookupDataLocator(chargesDataLocator);
chargesDataLocator.setGridMethodName("loadAccounts");
chargesDataLocator.setValidationMethodName("validateAccountCode");
chargesController.setFrameTitle("accounts");
chargesController.setLookupValueObjectClassName("org.jallinone.accounting.accounts.java.AccountVO");
// chargesController.addLookup2ParentLink("accountCodeACC02", "chargesAccountCodeAcc02SAL07");
// chargesController.addLookup2ParentLink("descriptionSYS10","chargesAccountDescrSAL07");
chargesController.setFramePreferedSize(new Dimension(400,400));
chargesController.setAllColumnVisible(false);
chargesController.setVisibleColumn("accountCodeACC02", true);
chargesController.setVisibleColumn("descriptionSYS10", true);
chargesController.setPreferredWidthColumn("accountCodeACC02", 100);
chargesController.setPreferredWidthColumn("descriptionSYS10", 290);
chargesController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {}
public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
AccountVO vo = (AccountVO)chargesController.getLookupVO();
controlChargesCode.setValue(vo.getAccountCodeACC02());
controlChargesDescr.setValue(vo.getDescriptionSYS10());
}
public void beforeLookupAction(ValueObject parentVO) { }
public void forceValidate() {}
});
// set default values...
HashMap map = new HashMap();
map.put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
map.put(ApplicationConsts.PARAM_CODE,ApplicationConsts.CREDITS_ACCOUNT);
Response response = ClientUtils.getData("loadUserParam",map);
if (!response.isError()) {
String code = (String)((VOResponse)response).getVo();
controlCreditsCode.setValue(code);
controlCreditsCode.getLookupController().forceValidate();
}
map.clear();
map.put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
map.put(ApplicationConsts.PARAM_CODE,ApplicationConsts.ITEMS_ACCOUNT);
response = ClientUtils.getData("loadUserParam",map);
if (!response.isError()) {
String code = (String)((VOResponse)response).getVo();
controlItemsCode.setValue(code);
controlItemsCode.getLookupController().forceValidate();
}
map.clear();
map.put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
map.put(ApplicationConsts.PARAM_CODE,ApplicationConsts.ACTIVITIES_ACCOUNT);
response = ClientUtils.getData("loadUserParam",map);
if (!response.isError()) {
String code = (String)((VOResponse)response).getVo();
controlActCode.setValue(code);
controlActCode.getLookupController().forceValidate();
}
map.clear();
map.put(ApplicationConsts.COMPANY_CODE_SYS01,vo.getCompanyCodeSys01SCH03());
map.put(ApplicationConsts.PARAM_CODE,ApplicationConsts.CHARGES_ACCOUNT);
response = ClientUtils.getData("loadUserParam",map);
if (!response.isError()) {
String code = (String)((VOResponse)response).getVo();
controlChargesCode.setValue(code);
controlChargesCode.getLookupController().forceValidate();
}
// check if there exist a customer with the specified progressive in REG04...
String subjectTypeREG04 = null;
if (vo.getSubjectTypeReg04SCH03().equals(ApplicationConsts.SUBJECT_ORGANIZATION))
subjectTypeREG04 = ApplicationConsts.SUBJECT_ORGANIZATION_CUSTOMER;
else
subjectTypeREG04 = ApplicationConsts.SUBJECT_PEOPLE_CUSTOMER;
CustomerPK pk = new CustomerPK(vo.getCompanyCodeSys01SCH03(),vo.getProgressiveReg04SCH03(),subjectTypeREG04);
Response res = ClientUtils.getData("loadCustomer",pk);
if (!res.isError()) {
if (subjectTypeREG04.equals(ApplicationConsts.SUBJECT_ORGANIZATION_CUSTOMER)) {
OrganizationCustomerVO custVO = (OrganizationCustomerVO)((VOResponse)res).getVo();
controlCustCode.setValue(custVO.getCustomerCodeSAL07());