// 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() {}