void printButton_actionPerformed(ActionEvent e) { DetailSaleDocVO vo = (DetailSaleDocVO) headerFormPanel.getVOModel().getValueObject(); HashMap params = new HashMap(); params.put("COMPANY_CODE", vo.getCompanyCodeSys01DOC01()); params.put("DOC_TYPE", vo.getDocTypeDOC01()); params.put("DOC_YEAR", vo.getDocYearDOC01()); params.put("DOC_NUMBER", vo.getDocNumberDOC01()); HashMap map = new HashMap(); map.put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01DOC01()); map.put(ApplicationConsts.FUNCTION_CODE_SYS06, headerFormPanel.getFunctionId()); map.put(ApplicationConsts.EXPORT_PARAMS, params); Response res = ClientUtils.getData("getJasperReport", map); if (!res.isError()) { JasperPrint print = (JasperPrint) ((VOResponse) res).getVo(); JRViewer viewer = new JRViewer(print); JFrame frame = new JFrame(); frame.setSize(MDIFrame.getInstance().getSize()); frame.setContentPane(viewer); frame.setTitle(this.getTitle()); frame.setIconImage(MDIFrame.getInstance().getIconImage()); frame.setVisible(true); } else JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("print document"), JOptionPane.ERROR_MESSAGE); }
/** Retrieve item types and fill in the item types combo box. */ private void init() { Response res = ClientUtils.getData("loadItemTypes", new GridParams()); Domain d = new Domain("ITEM_TYPES"); if (!res.isError()) { ItemTypeVO vo = null; list = ((VOListResponse) res).getRows(); for (int i = 0; i < list.size(); i++) { vo = (ItemTypeVO) list.get(i); d.addDomainPair(vo.getProgressiveHie02ITM02(), vo.getDescriptionSYS10()); } } controlHierarchy.setDomain(d); controlHierarchy .getComboBox() .addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == e.SELECTED) { ItemTypeVO typeVO = (ItemTypeVO) list.get(controlHierarchy.getSelectedIndex()); treePanel.setCompanyCode(typeVO.getCompanyCodeSys01ITM02()); treePanel.setProgressiveHIE02((BigDecimal) controlHierarchy.getValue()); DetailSupplierVO vo = (DetailSupplierVO) supplierPanel.getVOModel().getValueObject(); treePanel.setCompanyCode(vo.getCompanyCodeSys01REG04()); treePanel.reloadTree(); itemsGrid.clearData(); } } }); if (d.getDomainPairList().length == 1) controlHierarchy.getComboBox().setSelectedIndex(0); else controlHierarchy.getComboBox().setSelectedIndex(-1); }
/** * Method invoked when the user has clicked on delete button and the grid is in READONLY mode. * * @param persistentObjects value objects to delete (related to the currently selected rows) * @return an ErrorResponse value object in case of errors, VOResponse if the operation is * successfully completed */ public Response deleteRecords(ArrayList persistentObjects) throws Exception { AccountVO vo = null; for (int i = 0; i < persistentObjects.size(); i++) { vo = (AccountVO) persistentObjects.get(i); if (!vo.getCanDelACC02().booleanValue()) return new ErrorResponse("deleting not allowed"); } return ClientUtils.getData("deleteAccounts", persistentObjects); }
/** * Method invoked when pressing import all items button: it add all items to the supplier items * collection. */ void impAllItemsButton_actionPerformed(ActionEvent e) { DetailSupplierVO vo = (DetailSupplierVO) supplierPanel.getVOModel().getValueObject(); SupplierItemVO itemVO = new SupplierItemVO(); itemVO.setCompanyCodeSys01PUR02(vo.getCompanyCodeSys01REG04()); itemVO.setProgressiveReg04PUR02(vo.getProgressiveREG04()); itemVO.setProgressiveHie02PUR02((BigDecimal) controlHierarchy.getValue()); Response res = ClientUtils.getData("importAllItemsToSupplier", itemVO); if (!res.isError()) itemsGrid.reloadData(); }
void printButton_actionPerformed(ActionEvent e) { if (controlFromDate.getValue() == null || controlToDate.getValue() == null) { JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), ClientSettings.getInstance().getResources().getResource("please set a from/to date"), ClientSettings.getInstance().getResources().getResource("Attention"), JOptionPane.WARNING_MESSAGE); return; } if (controlCompaniesCombo.getValue() == null) { JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), ClientSettings.getInstance().getResources().getResource("please select a company"), ClientSettings.getInstance().getResources().getResource("Attention"), JOptionPane.WARNING_MESSAGE); return; } HashMap params = new HashMap(); params.put("COMPANY_CODE", controlCompaniesCombo.getValue()); params.put("START_DATE", controlFromDate.getValue()); params.put("END_DATE", controlToDate.getValue()); if (controlFromItemNr.getValue() != null) params.put( "FROM_PROGRESSIVE", " and ACC05_JOURNAL_HEADER.PROGRESSIVE>=" + controlFromItemNr.getValue()); else params.remove("FROM_PROGRESSIVE"); HashMap map = new HashMap(); map.put(ApplicationConsts.COMPANY_CODE_SYS01, controlCompaniesCombo.getValue()); map.put(ApplicationConsts.FUNCTION_CODE_SYS06, "ACC05"); map.put(ApplicationConsts.EXPORT_PARAMS, params); Response res = ClientUtils.getData("getJasperReport", map); if (!res.isError()) { JasperPrint print = (JasperPrint) ((VOResponse) res).getVo(); JRViewer viewer = new JRViewer(print); JFrame frame = new JFrame(); frame.setSize(MDIFrame.getInstance().getSize()); frame.setContentPane(viewer); frame.setTitle(this.getTitle()); frame.setIconImage(MDIFrame.getInstance().getIconImage()); frame.setVisible(true); } else JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("print journal"), JOptionPane.ERROR_MESSAGE); }
/** * Method invoked when the user has clicked on delete button and the grid is in READONLY mode. * * @param persistentObjects value objects to delete (related to the currently selected rows) * @return an ErrorResponse value object in case of errors, VOResponse if the operation is * successfully completed */ public Response deleteRecords(ArrayList persistentObjects) throws Exception { ArrayList pks = new ArrayList(); DeliveryNotePK pk = null; GridDeliveryNoteVO vo = null; for (int i = 0; i < persistentObjects.size(); i++) { vo = (GridDeliveryNoteVO) persistentObjects.get(i); pk = new DeliveryNotePK( vo.getCompanyCodeSys01DOC08(), vo.getDocTypeDOC08(), vo.getDocYearDOC08(), vo.getDocNumberDOC08()); pks.add(pk); } return ClientUtils.getData("deleteDeliveryNotes", pks); }
/** * Method invoked when the user has clicked on save button and the grid is in EDIT mode. * * @param rowNumbers row indexes related to the changed rows * @param oldPersistentObjects old value objects, previous the changes * @param persistentObjects value objects relatied to the changed rows * @return an ErrorResponse value object in case of errors, VOListResponse if the operation is * successfully completed */ public Response updateRecords( int[] rowNumbers, ArrayList oldPersistentObjects, ArrayList persistentObjects) throws Exception { Response response = null; ItemDiscountVO vo = null; for (int i = 0; i < persistentObjects.size(); i++) { vo = (ItemDiscountVO) persistentObjects.get(i); response = validateDiscount(vo); if (response.isError()) return response; } response = ClientUtils.getData( "updateItemDiscounts", new ArrayList[] {oldPersistentObjects, persistentObjects}); return response; }
/** * Method invoked when the user has clicked on save button and the grid is in INSERT mode. * * @param rowNumbers row indexes related to the new rows to save * @param newValueObjects list of new value objects to save * @return an ErrorResponse value object in case of errors, VOListResponse if the operation is * successfully completed */ public Response insertRecords(int[] rowNumbers, ArrayList newValueObjects) throws Exception { ItemDiscountVO vo = null; Response response = null; DetailItemVO itemVO = (DetailItemVO) frame.getFormPanel().getVOModel().getValueObject(); for (int i = 0; i < newValueObjects.size(); i++) { vo = (ItemDiscountVO) newValueObjects.get(i); response = validateDiscount(vo); if (response.isError()) return response; vo.setCompanyCodeSys01SAL03(itemVO.getCompanyCodeSys01ITM01()); vo.setItemCodeItm01SAL04(itemVO.getItemCodeITM01()); } response = ClientUtils.getData("insertItemDiscounts", newValueObjects); return response; }
/** * Callback method invoked when the user has clicked on the insert button * * @param valueObject empty value object just created: the user can manage it to fill some * attribute values */ public void createValueObject(ValueObject valueObject) throws Exception { ItemDiscountVO vo = (ItemDiscountVO) valueObject; vo.setMinQtySAL03(new BigDecimal(1)); vo.setMultipleQtySAL03(Boolean.FALSE); DetailItemVO itemVO = (DetailItemVO) frame.getFormPanel().getVOModel().getValueObject(); itemVO.setCompanyCodeSys01ITM01(itemVO.getCompanyCodeSys01()); Response res = ClientUtils.getData("loadCompany", itemVO.getCompanyCodeSys01()); if (!res.isError()) { OrganizationVO compVO = (OrganizationVO) ((VOResponse) res).getVo(); if (compVO.getCurrencyCodeReg03() != null && !compVO.getCurrencyCodeReg03().equals("")) { vo.setCurrencyCodeReg03SAL03(compVO.getCurrencyCodeReg03()); frame .getColCurrencyCode() .forceValidate( frame.getDiscountsGrid().getSelectedRow() == -1 ? 0 : frame.getDiscountsGrid().getSelectedRow()); } } }
void confirmButton_actionPerformed(ActionEvent e) { // view close dialog... if (JOptionPane.showConfirmDialog( ClientUtils.getParentFrame(this), ClientSettings.getInstance().getResources().getResource("close credit note?"), ClientSettings.getInstance().getResources().getResource("credit note closing"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { Response res = ClientUtils.getData("closeSaleDoc", controller.getPk()); if (!res.isError()) { confirmButton.setEnabled(false); headerFormPanel.setMode(Consts.READONLY); headerFormPanel.executeReload(); if (getInvoices() != null) getInvoices().reloadCurrentBlockOfData(); } else JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("credit note closing"), JOptionPane.ERROR_MESSAGE); } }
/** * Method invoked when the user has clicked on delete button and the grid is in READONLY mode. * * @param persistentObjects value objects to delete (related to the currently selected rows) * @return an ErrorResponse value object in case of errors, VOResponse if the operation is * successfully completed */ public Response deleteRecords(ArrayList persistentObjects) throws Exception { return ClientUtils.getData("deleteLevelProperties", persistentObjects); }
/** * Method invoked when the user has clicked on save button and the grid is in EDIT mode. * * @param rowNumbers row indexes related to the changed rows * @param oldPersistentObjects old value objects, previous the changes * @param persistentObjects value objects relatied to the changed rows * @return an ErrorResponse value object in case of errors, VOListResponse if the operation is * successfully completed */ public Response updateRecords( int[] rowNumbers, ArrayList oldPersistentObjects, ArrayList persistentObjects) throws Exception { return ClientUtils.getData( "updateLevelProperties", new ArrayList[] {oldPersistentObjects, persistentObjects}); }
/** * Method invoked when the user has clicked on save button and the grid is in INSERT mode. * * @param rowNumbers row indexes related to the new rows to save * @param newValueObjects list of new value objects to save * @return an ErrorResponse value object in case of errors, VOListResponse if the operation is * successfully completed */ public Response insertRecords(int[] rowNumbers, ArrayList newValueObjects) throws Exception { return ClientUtils.getData("insertLevelProperties", newValueObjects); }
/** Load data from server and construct panel content. */ public final void reloadData(DocumentsFrame frame) { try { // remove all panel content... clearData(); frame.getGrid().getOtherGridParams().put(ApplicationConsts.PROPERTIES_FILTER, filters); // retrieve customized input controls list... GridParams gridParams = new GridParams(); DefaultMutableTreeNode node = frame.getHierarTreePanel().getSelectedNode(); if (node != null) { HierarchyLevelVO vo = (HierarchyLevelVO) node.getUserObject(); HierarchyLevelVO root = (HierarchyLevelVO) ((DefaultMutableTreeNode) node.getRoot()).getUserObject(); gridParams .getOtherGridParams() .put(ApplicationConsts.PROGRESSIVE_HIE01, vo.getProgressiveHIE01()); gridParams .getOtherGridParams() .put(ApplicationConsts.ROOT_PROGRESSIVE_HIE01, root.getProgressiveHIE01()); } else gridParams.getOtherGridParams().remove(ApplicationConsts.PROGRESSIVE_HIE01); gridParams .getOtherGridParams() .put( ApplicationConsts.PROGRESSIVE_HIE02, frame.getHierarTreePanel().getProgressiveHIE02()); gridParams.getOtherGridParams().put(ApplicationConsts.LOAD_ANCIENTS, Boolean.TRUE); Response res = ClientUtils.getData("loadLevelProperties", gridParams); if (res.isError()) { JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), ClientSettings.getInstance().getResources().getResource("Error while loading data") + ":\n" + res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("Loading Data Error"), JOptionPane.ERROR_MESSAGE); return; } ArrayList rows = ((VOListResponse) res).getRows(); if (rows.size() > 0) { // adding customized input controls... LevelPropertyVO inputControlInfo = null; int row = 0; int col = 0; LabelControl labelControl = null; TextControl textControl = null; DateControl dateControl = null; NumericControl numericControl = null; for (int i = 0; i < rows.size(); i++) { inputControlInfo = (LevelPropertyVO) rows.get(i); labelControl = new LabelControl(); labelControl.setText(inputControlInfo.getDescriptionSYS10()); innerPanel.add( labelControl, new GridBagConstraints( col++, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_TEXT)) { textControl = new TextControl(); textControl.setMaxCharacters(255); textControl.setLinkLabel(labelControl); innerPanel.add( textControl, new GridBagConstraints( col, row, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 15), 0, 0)); textControl.addFocusListener(new ControlFocusListener(inputControlInfo, textControl)); } else if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_DATE)) { dateControl = new DateControl(); dateControl.setLinkLabel(labelControl); innerPanel.add( dateControl, new GridBagConstraints( col, row, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 15), 0, 0)); dateControl.addFocusListener(new ControlFocusListener(inputControlInfo, dateControl)); } else if (inputControlInfo.getPropertyTypeDOC21().equals(ApplicationConsts.TYPE_NUM)) { numericControl = new NumericControl(); numericControl.setDecimals(5); numericControl.setLinkLabel(labelControl); innerPanel.add( numericControl, new GridBagConstraints( col, row, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 15), 0, 0)); numericControl.addFocusListener( new ControlFocusListener(inputControlInfo, numericControl)); } col++; if (col >= 2) { innerPanel.add( new JPanel(), new GridBagConstraints( col, row, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); row++; col = 0; } } row++; innerPanel.add( new JPanel(), new GridBagConstraints( col, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); innerPanel.add( new JPanel(), new GridBagConstraints( 0, row, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(5, 5, 5, 5), 0, 0)); this.revalidate(); this.repaint(); } } catch (Exception ex) { ex.printStackTrace(); } }
/** * Method invoked when the user has clicked on delete button and the grid is in READONLY mode. * * @param persistentObjects value objects to delete (related to the currently selected rows) * @return an ErrorResponse value object in case of errors, VOResponse if the operation is * successfully completed */ public Response deleteRecords(ArrayList persistentObjects) throws Exception { Response response = ClientUtils.getData("deleteItemDiscounts", persistentObjects); return response; }