// item type...
Response res = ClientUtils.getData("loadItemTypes",new GridParams());
Domain d = new Domain("ITEM_TYPES");
if (!res.isError()) {
ItemTypeVO vo = null;
itemTypesList = ((VOListResponse)res).getRows();
for(int i=0;i<itemTypesList.size();i++) {
vo = (ItemTypeVO)itemTypesList.get(i);
d.addDomainPair(vo.getProgressiveHie02ITM02(),vo.getDescriptionSYS10());
}
}
controlItemType.setDomain(d);
controlItemType.getComboBox().addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange()==e.SELECTED) {
ReorderFromMinStockFilterVO vo = (ReorderFromMinStockFilterVO)filterPanel.getVOModel().getValueObject();
vo.setProgressiveHie02ITM01((BigDecimal)controlItemType.getValue());
}
}
});
if (d.getDomainPairList().length>=1)
controlItemType.getComboBox().setSelectedIndex(0);
else
controlItemType.getComboBox().setSelectedIndex(-1);
// warehouse lookup...
wareDataLocator.setGridMethodName("loadWarehouses");
wareDataLocator.setValidationMethodName("validateWarehouseCode");
controlWarehouse.setLookupController(wareController);
controlWarehouse.setControllerMethodName("getWarehousesList");
wareController.setForm(filterPanel);
wareController.setLookupDataLocator(wareDataLocator);
wareController.setFrameTitle("warehouses");
wareController.setLookupValueObjectClassName("org.jallinone.warehouse.java.WarehouseVO");
wareController.addLookup2ParentLink("companyCodeSys01WAR01", "companyCode");
wareController.addLookup2ParentLink("warehouseCodeWAR01", "warehouseCode");
wareController.addLookup2ParentLink("descriptionWAR01","warehouseDescription");
wareController.setAllColumnVisible(false);
wareController.setVisibleColumn("warehouseCodeWAR01", true);
wareController.setVisibleColumn("descriptionWAR01", true);
wareController.setVisibleColumn("addressWAR01", true);
wareController.setVisibleColumn("cityWAR01", true);
wareController.setVisibleColumn("zipWAR01", true);
wareController.setVisibleColumn("provinceWAR01", true);
wareController.setVisibleColumn("countryWAR01", true);
wareController.setPreferredWidthColumn("descriptionWAR01",200);
wareController.setFramePreferedSize(new Dimension(750,500));
wareController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {}
public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
if (wareController.getLookupVO()==null) {
controlSupplierCode.setValue(null);
supplierController.forceValidate();
controlSupplierCode.setEnabled(false);
warehouseVO = null;
}
else {
warehouseVO = (WarehouseVO)wareController.getLookupVO();
supplierDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01,warehouseVO.getCompanyCodeSys01WAR01());
supplierDataLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01,warehouseVO.getCompanyCodeSys01WAR01());
grid.getOtherGridParams().put(ApplicationConsts.COMPANY_CODE_SYS01,warehouseVO.getCompanyCodeSys01WAR01());
controlSupplierCode.setEnabled(true);
Response res = ClientUtils.getData("loadCompany",warehouseVO.getCompanyCodeSys01WAR01());
if (!res.isError()) {
OrganizationVO compVO = (OrganizationVO)((VOResponse)res).getVo();
if (compVO!=null && compVO.getCurrencyCodeReg03()!=null && !compVO.getCurrencyCodeReg03().equals("")) {
controlCurrency.setValue(compVO.getCurrencyCodeReg03());
controlCurrency.getLookupController().forceValidate();
}
}
}
}
public void beforeLookupAction(ValueObject parentVO) { }
public void forceValidate() {}
});
// supplier lookup...
supplierDataLocator.setGridMethodName("loadSuppliers");
supplierDataLocator.setValidationMethodName("validateSupplierCode");
controlSupplierCode.setLookupController(supplierController);
controlSupplierCode.setControllerMethodName("getSuppliersList");
supplierController.setForm(filterPanel);
supplierController.setLookupDataLocator(supplierDataLocator);
supplierController.setFrameTitle("suppliers");
supplierController.setLookupValueObjectClassName("org.jallinone.purchases.suppliers.java.GridSupplierVO");
supplierController.addLookup2ParentLink("supplierCodePUR01","supplierCode");
supplierController.addLookup2ParentLink("progressiveREG04","progressiveREG04");
supplierController.addLookup2ParentLink("name_1REG04", "name_1REG04");
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));
// supplier lookup for column...
supplierDataLocator2.setGridMethodName("loadSuppliers");
supplierDataLocator2.setValidationMethodName("validateSupplierCode");
colSupplierCode.setLookupController(supplierController2);
colSupplierCode.setControllerMethodName("getSuppliersList");
supplierController2.setForm(filterPanel);
supplierController2.setLookupDataLocator(supplierDataLocator2);
supplierController2.setFrameTitle("suppliers");
supplierController2.setLookupValueObjectClassName("org.jallinone.purchases.suppliers.java.GridSupplierVO");
supplierController2.addLookup2ParentLink("supplierCodePUR01","supplierCode");
supplierController2.addLookup2ParentLink("name_1REG04", "name_1REG04");
supplierController2.setAllColumnVisible(false);
supplierController2.setVisibleColumn("companyCodeSys01REG04", true);
supplierController2.setVisibleColumn("supplierCodePUR01", true);
supplierController2.setVisibleColumn("name_1REG04", true);
supplierController2.setVisibleColumn("name_2REG04", true);
supplierController2.setVisibleColumn("cityREG04", true);
supplierController2.setVisibleColumn("provinceREG04", true);
supplierController2.setVisibleColumn("countryREG04", true);
supplierController2.setVisibleColumn("taxCodeREG04", true);
supplierController2.setHeaderColumnName("name_1REG04", "corporateName1");
supplierController2.setHeaderColumnName("cityREG04", "city");
supplierController2.setHeaderColumnName("provinceREG04", "prov");
supplierController2.setHeaderColumnName("countryREG04", "country");
supplierController2.setHeaderColumnName("taxCodeREG04", "taxCode");
supplierController2.setPreferredWidthColumn("name_1REG04", 200);
supplierController2.setPreferredWidthColumn("name_2REG04", 150);
supplierController2.setFramePreferedSize(new Dimension(750,500));
supplierController2.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {}
public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
ReorderFromMinStockVO vo = (ReorderFromMinStockVO)grid.getVOListTableModel().getObjectForRow(grid.getSelectedRow());
GridSupplierVO lookupVO = (GridSupplierVO)supplierController2.getLookupVO();
if (lookupVO!=null && lookupVO.getProgressiveREG04()!=null) {
vo.setProgressiveREG04(lookupVO.getProgressiveREG04());
// retrieve pricelist...
GridParams gridParams = new GridParams();
gridParams.getOtherGridParams().put(ApplicationConsts.PROGRESSIVE_REG04,lookupVO.getProgressiveREG04());
gridParams.getOtherGridParams().put(ApplicationConsts.DATE_FILTER,new java.sql.Date(System.currentTimeMillis()));
gridParams.getOtherGridParams().put(ApplicationConsts.ITEM_PK,new ItemPK(vo.getCompanyCodeSys01(),vo.getItemCode()));
Response res = ClientUtils.getData("loadSupplierPrices",gridParams);
if (res.isError())
vo.setPricelistCodePUR03(null);
else {
SupplierPriceVO priceVO = (SupplierPriceVO)((VOListResponse)res).getRows().get(0);
vo.setPricelistCodePUR03(priceVO.getPricelistCodePur03PUR04());
vo.setPricelistDescription(priceVO.getPricelistDescriptionSYS10());
}
}
else
vo.setProgressiveREG04(null);
}
public void beforeLookupAction(ValueObject parentVO) {
ReorderFromMinStockVO vo = (ReorderFromMinStockVO)grid.getVOListTableModel().getObjectForRow(grid.getSelectedRow());
supplierDataLocator2.getLookupFrameParams().put(ApplicationConsts.ITEM,vo.getItemCode());
supplierDataLocator2.getLookupValidationParameters().put(ApplicationConsts.ITEM,vo.getItemCode());
}
public void forceValidate() {}
});