Package org.jallinone.sales.documents.java

Examples of org.jallinone.sales.documents.java.DetailSaleDocRowVO


  public boolean beforeInsertData(Form form) {
    boolean ok = super.beforeInsertData(form);

    if (ok) {
      frame.getRowsPanel().getGrid().clearData();
      frame.getRowsPanel().getDetailPanel().getVOModel().setValueObject(new DetailSaleDocRowVO());
      frame.getRowsPanel().getDetailPanel().pull();
      frame.getDiscPanel().getGrid().clearData();
      frame.getChargePanel().getGrid().clearData();
      frame.getActPanel().getGrid().clearData();
      frame.setButtonsEnabled(false);
View Full Code Here


  public boolean beforeInsertData(Form form) {
    boolean ok = super.beforeInsertData(form);

    if (ok) {
      frame.getRowsPanel().getGrid().clearData();
      frame.getRowsPanel().getDetailPanel().getVOModel().setValueObject(new DetailSaleDocRowVO());
      frame.getRowsPanel().getDetailPanel().pull();
      frame.getDiscPanel().getGrid().clearData();
      frame.getChargePanel().getGrid().clearData();
      frame.getActPanel().getGrid().clearData();
      frame.setButtonsEnabled(false);
View Full Code Here

   * @param valueObjectClass value object class
   * @return a VOResponse object if data loading is successfully completed, or an ErrorResponse object if an error occours
   */
  public Response loadData(Class valueObjectClass) {
    if (pk==null)
      return new VOResponse(new DetailSaleDocRowVO());
    else
      return ClientUtils.getData("loadSaleDocRow",pk);
  }
View Full Code Here

      res = ClientUtils.getData("insertSaleDocRow",newPersistentObject);
    }
    else {
      // check for already existing item for qty 1 and serial num enabled...
      if (panel.isSerialNumberRequired()) {
        DetailSaleDocRowVO itemVO = (DetailSaleDocRowVO)newPersistentObject;

        for(int i=0;i<panel.getGrid().getVOListTableModel().getRowCount();i++) {
          GridSaleDocRowVO vo =(GridSaleDocRowVO)panel.getGrid().getVOListTableModel().getObjectForRow(i);
          if (vo.getItemCodeItm01DOC02().equals(itemVO.getItemCodeItm01DOC02()) &&
              vo.getVariantCodeItm11DOC02().equals(itemVO.getVariantCodeItm11DOC02()) &&
              vo.getVariantCodeItm12DOC02().equals(itemVO.getVariantCodeItm12DOC02()) &&
              vo.getVariantCodeItm13DOC02().equals(itemVO.getVariantCodeItm13DOC02()) &&
              vo.getVariantCodeItm14DOC02().equals(itemVO.getVariantCodeItm14DOC02()) &&
              vo.getVariantCodeItm15DOC02().equals(itemVO.getVariantCodeItm15DOC02()) &&
              vo.getVariantTypeItm06DOC02().equals(itemVO.getVariantTypeItm06DOC02()) &&
              vo.getVariantTypeItm07DOC02().equals(itemVO.getVariantTypeItm07DOC02()) &&
              vo.getVariantTypeItm08DOC02().equals(itemVO.getVariantTypeItm08DOC02()) &&
              vo.getVariantTypeItm09DOC02().equals(itemVO.getVariantTypeItm09DOC02()) &&
              vo.getVariantTypeItm10DOC02().equals(itemVO.getVariantTypeItm10DOC02())) {

            // load old row..
            SaleDocRowPK pk = new SaleDocRowPK(
              vo.getCompanyCodeSys01DOC02(),
              vo.getDocTypeDOC02(),vo.getDocYearDOC02(),
              vo.getDocNumberDOC02(),
              vo.getItemCodeItm01DOC02(),
              vo.getVariantTypeItm06DOC02(),
              vo.getVariantCodeItm11DOC02(),
              vo.getVariantTypeItm07DOC02(),
              vo.getVariantCodeItm12DOC02(),
              vo.getVariantTypeItm08DOC02(),
              vo.getVariantCodeItm13DOC02(),
              vo.getVariantTypeItm09DOC02(),
              vo.getVariantCodeItm14DOC02(),
              vo.getVariantTypeItm10DOC02(),
              vo.getVariantCodeItm15DOC02()
            );
            res = ClientUtils.getData("loadSaleDocRow",pk);
            if (res.isError())
              return res;
            DetailSaleDocRowVO oldVO = (DetailSaleDocRowVO)((VOResponse)res).getVo();
            DetailSaleDocRowVO newVO = (DetailSaleDocRowVO)oldVO.clone();
            newVO.setQtyDOC02(oldVO.getQtyDOC02().add(new BigDecimal(1)));
            newVO.setSerialNumbers(itemVO.getSerialNumbers());
            newVO.getSerialNumbers().addAll(oldVO.getSerialNumbers());

            // update qty...
            res = ClientUtils.getData(
              "updateSaleDocRow",
              new ValueObject[]{
                oldVO,
                newVO
              }
            );
            return res;
          }
        }
      }


      // the item has variants...
      res = ClientUtils.getData(
        "insertSaleDocRows",
        new Object[]{
          newPersistentObject,
          panel.getVariantsPanel().getVariantsMatrixVO(),
          panel.getVariantsPanel().getCells(),
          panel.getParentVO().getDecimalsREG03()
        }
      );
    }


    //Response res = ClientUtils.getData("insertSaleDocRow",newPersistentObject);
    if (!res.isError()) {
      DetailSaleDocRowVO vo = (DetailSaleDocRowVO)((VOResponse)res).getVo();
      pk = new SaleDocRowPK(
          vo.getCompanyCodeSys01DOC02(),
          vo.getDocTypeDOC02(),
          vo.getDocYearDOC02(),
          vo.getDocNumberDOC02(),
          vo.getItemCodeItm01DOC02(),
          vo.getVariantTypeItm06DOC02(),
          vo.getVariantCodeItm11DOC02(),
          vo.getVariantTypeItm07DOC02(),
          vo.getVariantCodeItm12DOC02(),
          vo.getVariantTypeItm08DOC02(),
          vo.getVariantCodeItm13DOC02(),
          vo.getVariantTypeItm09DOC02(),
          vo.getVariantCodeItm14DOC02(),
          vo.getVariantTypeItm10DOC02(),
          vo.getVariantCodeItm15DOC02()

      );
    }
    return res;
  }
View Full Code Here

      buttonDiscount.setEnabled(false);
      buttonCustomer.setEnabled(false);
      buttonClose.setEnabled(false);
      buttonExit.setEnabled(false);

      DetailSaleDocRowVO vo = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(grid.getSelectedRow());
      controlQty.setValue(vo.getQtyDOC02());
      ((JTextField)controlQty.getBindingComponent()).selectAll();

      SwingUtilities.invokeLater(new Runnable() {

        public void run() {
          controlQty.requestFocus();
        }

      });

    }
    else if (state==INS_DISCOUNT) {

      removeItemsPanelContent();
      itemsPanel.add(labelItemValDiscount,          new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
              ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
      itemsPanel.add(controlItemValDiscount,        new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
                  ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
      itemsPanel.revalidate();
      itemsPanel.repaint();

      buttonBack.setEnabled(true);
      buttonDel.setEnabled(false);
      buttonQty.setEnabled(false);
      buttonDiscount.setEnabled(false);
      buttonCustomer.setEnabled(false);
      buttonClose.setEnabled(false);
      buttonExit.setEnabled(false);

      DetailSaleDocRowVO vo = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(grid.getSelectedRow());
      controlItemValDiscount.setValue(vo.getDiscountValue());

      SwingUtilities.invokeLater(new Runnable() {

        public void run() {
          controlItemValDiscount.requestFocus();
View Full Code Here

  private void updateTotals() {
    detailSaleDocVO.setTaxableIncomeDOC01(new BigDecimal(0));
    detailSaleDocVO.setTotalVatDOC01(new BigDecimal(0));
    BigDecimal subtotal = new BigDecimal(0);
    DetailSaleDocRowVO vo = null;
    for(int i=0;i<grid.getVOListTableModel().getRowCount();i++) {
      vo = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(i);
      vo.setPricelistCodeSal01DOC02(detailSaleDocVO.getPricelistCodeSal01DOC01());
      vo.setPricelistDescriptionDOC02(detailSaleDocVO.getPricelistDescriptionDOC01());

      subtotal = subtotal.add(vo.getValueDOC02());

      detailSaleDocVO.setTaxableIncomeDOC01(detailSaleDocVO.getTaxableIncomeDOC01().add(vo.getTaxableIncomeDOC02()));
      detailSaleDocVO.setTotalVatDOC01(detailSaleDocVO.getTotalVatDOC01().add(vo.getVatValueDOC02()));
    }
    controlSubtotal.setValue(subtotal);
    controlTotal.setValue(subtotal);

    BigDecimal discount = controlDiscount.getBigDecimal();
View Full Code Here

        null
      );
      return;
    }
    detailSaleDocVO = (DetailSaleDocVO)((VOResponse)res).getVo();
    DetailSaleDocRowVO rowVO = null;
    for(int i=0;i<grid.getVOListTableModel().getRowCount();i++) {
      rowVO = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(i);
      rowVO.setDocNumberDOC02(detailSaleDocVO.getDocNumberDOC01());
      res = ClientUtils.getData("insertSaleDocRow",rowVO);
      if (res.isError()) {
          Logger.error(
            this.getClass().getName(),
            "buttonClose_actionPerformed",
View Full Code Here

    else if (controlBarcode.isEnabled() &&
            !controlBarcode.hasFocus())
      controlBarcode.requestFocus();
    else if (controlQty.isVisible() &&
             controlQty.getBigDecimal()!=null) {
      DetailSaleDocRowVO vo = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(grid.getSelectedRow());
      vo.setQtyDOC02(controlQty.getBigDecimal());
      updateRow(vo);
      updateTotals();
      controlQty.setValue(null);
      state = INS_BARCODE;
      updateContext();
    }
    else if (controlItemValDiscount.isVisible() &&
             controlItemValDiscount.getBigDecimal()!=null) {
      DetailSaleDocRowVO vo = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(grid.getSelectedRow());
      vo.setDiscountValue(controlItemValDiscount.getBigDecimal());

      BigDecimal vat = vo.getValueReg01DOC02();
      BigDecimal x = vo.getDiscountValue();
      BigDecimal d = null;
      if (x!=null)
        d = x.divide(
          new BigDecimal(1).add(
            vat.divide(
              new BigDecimal(100),
              BigDecimal.ROUND_HALF_UP
            )
          ),
          currVO.getDecimalsREG03().intValue(),
          BigDecimal.ROUND_HALF_UP
        );
      vo.setDiscountValueDOC02(d);
      vo.setDiscountPercDOC02(null);
      vo.setTotalDiscountDOC02(vo.getDiscountValueDOC02());


      updateRow(vo);
      updateTotals();
      controlItemValDiscount.setValue(null);
View Full Code Here



  private void addRow(VariantBarcodeVO barcodeVO,PriceItemVO priceItemVO) {
    ArrayList sn = new ArrayList();
    DetailSaleDocRowVO vo = new DetailSaleDocRowVO();
    if (barcodeVO!=null) {
      vo.setVariantCodeItm11DOC02(barcodeVO.getVariantCodeItm11ITM22());
      vo.setVariantCodeItm12DOC02(barcodeVO.getVariantCodeItm12ITM22());
      vo.setVariantCodeItm13DOC02(barcodeVO.getVariantCodeItm13ITM22());
      vo.setVariantCodeItm14DOC02(barcodeVO.getVariantCodeItm14ITM22());
      vo.setVariantCodeItm15DOC02(barcodeVO.getVariantCodeItm15ITM22());
      vo.setVariantTypeItm06DOC02(barcodeVO.getVariantTypeItm06ITM22());
      vo.setVariantTypeItm07DOC02(barcodeVO.getVariantTypeItm07ITM22());
      vo.setVariantTypeItm08DOC02(barcodeVO.getVariantTypeItm08ITM22());
      vo.setVariantTypeItm09DOC02(barcodeVO.getVariantTypeItm09ITM22());
      vo.setVariantTypeItm10DOC02(barcodeVO.getVariantTypeItm10ITM22());
    }
    else {
      vo.setVariantCodeItm11DOC02(ApplicationConsts.JOLLY);
      vo.setVariantCodeItm12DOC02(ApplicationConsts.JOLLY);
      vo.setVariantCodeItm13DOC02(ApplicationConsts.JOLLY);
      vo.setVariantCodeItm14DOC02(ApplicationConsts.JOLLY);
      vo.setVariantCodeItm15DOC02(ApplicationConsts.JOLLY);
      vo.setVariantTypeItm06DOC02(ApplicationConsts.JOLLY);
      vo.setVariantTypeItm07DOC02(ApplicationConsts.JOLLY);
      vo.setVariantTypeItm08DOC02(ApplicationConsts.JOLLY);
      vo.setVariantTypeItm09DOC02(ApplicationConsts.JOLLY);
      vo.setVariantTypeItm10DOC02(ApplicationConsts.JOLLY);
    }

    // check for variants level price...
    if (priceItemVO.getUseVariant1ITM01().equals(Boolean.TRUE) ||
        priceItemVO.getUseVariant2ITM01().equals(Boolean.TRUE) ||
        priceItemVO.getUseVariant3ITM01().equals(Boolean.TRUE) ||
        priceItemVO.getUseVariant4ITM01().equals(Boolean.TRUE) ||
        priceItemVO.getUseVariant5ITM01().equals(Boolean.TRUE)) {
      Response res = ClientUtils.getData("loadVariantsPrice",new Object[]{barcodeVO,customerVO.getPricelistCodeSal01SAL07()});
      if (!res.isError()) {
        java.util.List rows = ((VOListResponse)res).getRows();
        if (rows.size()==1) {
          VariantsPriceVO vpVO = (VariantsPriceVO)rows.get(0);
          priceItemVO.setValueSAL02(vpVO.getValueSAL11());
        }
      }
    }


    vo.setCompanyCodeSys01DOC02(priceItemVO.getCompanyCodeSys01());
    Calendar cal = Calendar.getInstance();
    vo.setDocYearDOC02(new BigDecimal(cal.get(cal.YEAR)));
    vo.setDocTypeDOC02(ApplicationConsts.SALE_DESK_DOC_TYPE);
    vo.setDeliveryDateDOC02(new java.sql.Date(System.currentTimeMillis()));
    vo.setCurrencyCodeReg03DOC01(customerVO.getCurrencyCodeReg03SAL01());
    vo.setProgressiveHie01DOC02(priceItemVO.getProgressiveHie01ITM01());
    vo.setDecimalsReg02DOC02(priceItemVO.getDecimalsREG02());
    vo.setDescriptionSYS10(priceItemVO.getItemDescriptionSYS10());
    vo.setItemCodeItm01DOC02(priceItemVO.getItemCodeItm01());
    vo.setMinSellingQtyItm01DOC02(priceItemVO.getMinSellingQtyITM01());
    vo.setMinSellingQtyUmCodeReg02DOC02(priceItemVO.getMinSellingQtyUmCodeReg02ITM01());
    vo.setProgressiveHie01ITM01(priceItemVO.getProgressiveHie01ITM01());
    vo.setProgressiveHie02DOC02(warehouseVO.getProgressiveHie02WAR01());
    vo.setQtyDOC02(new BigDecimal(1));
    vo.setSerialNumbers(sn);
    vo.setStartDateSal02DOC02(priceItemVO.getStartDateSAL02());
    vo.setEndDateSal02DOC02(priceItemVO.getEndDateSAL02());
    vo.setValueReg01DOC02(priceItemVO.getValueREG01());
    vo.setValueSal02DOC02(priceItemVO.getValueSAL02());
    vo.setVatCodeItm01DOC02(priceItemVO.getVatCodeReg01ITM01());
    vo.setVatDescriptionDOC02(priceItemVO.getVatDescriptionSYS10());
    vo.setDeductibleReg01DOC02(priceItemVO.getDeductibleREG01());

    // check if there already exist another row for the same item + variants...
    DetailSaleDocRowVO oldVO = null;
    int rowFound = -1;
    for(int i=0;i<grid.getVOListTableModel().getRowCount();i++) {
      oldVO = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(i);
      if (oldVO.getCompanyCodeSys01DOC02().equals(vo.getCompanyCodeSys01DOC02()) &&
          oldVO.getItemCodeItm01DOC02().equals(vo.getItemCodeItm01DOC02()) &&
          oldVO.getVariantCodeItm11DOC02().equals(vo.getVariantCodeItm11DOC02()) &&
          oldVO.getVariantCodeItm12DOC02().equals(vo.getVariantCodeItm12DOC02()) &&
          oldVO.getVariantCodeItm13DOC02().equals(vo.getVariantCodeItm13DOC02()) &&
          oldVO.getVariantCodeItm14DOC02().equals(vo.getVariantCodeItm14DOC02()) &&
          oldVO.getVariantCodeItm15DOC02().equals(vo.getVariantCodeItm15DOC02()) &&
          oldVO.getVariantTypeItm06DOC02().equals(vo.getVariantTypeItm06DOC02()) &&
          oldVO.getVariantTypeItm07DOC02().equals(vo.getVariantTypeItm07DOC02()) &&
          oldVO.getVariantTypeItm08DOC02().equals(vo.getVariantTypeItm08DOC02()) &&
          oldVO.getVariantTypeItm09DOC02().equals(vo.getVariantTypeItm09DOC02()) &&
          oldVO.getVariantTypeItm10DOC02().equals(vo.getVariantTypeItm10DOC02())) {
        rowFound = i;
        break;
      }
    }
    int selRow = rowFound;
    if (rowFound!=-1) {
      DetailSaleDocRowVO voFound = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(rowFound);
      vo = voFound;
      vo.setQtyDOC02(vo.getQtyDOC02().add(new BigDecimal(1)));
    }
    else {
      grid.getVOListTableModel().addObject(vo);
      selRow = grid.getVOListTableModel().getRowCount()-1;
    }

    updateRow(vo);
    grid.repaint();
    grid.setRowSelectionInterval(selRow,selRow);

    updateContext();
    updateTotals();

    new Thread() {
      public void run() {
        ArrayList items = new ArrayList();
        DetailSaleDocRowVO rowVO = null;
        for(int i=0;i<grid.getVOListTableModel().getRowCount();i++) {
          rowVO = (DetailSaleDocRowVO)grid.getVOListTableModel().getObjectForRow(i);
          items.add(rowVO.getItemCodeItm01DOC02());
        }
        Response res = ClientUtils.getData("loadItemsSoldToOtherCustomers",new Object[]{defaultCompanyCodeSys01,items});
        if (!res.isError()) {
          java.util.List rows = ((VOListResponse)res).getRows();
          if (rows.size()==0)
View Full Code Here

TOP

Related Classes of org.jallinone.sales.documents.java.DetailSaleDocRowVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.