Examples of SaleDocChargeVO


Examples of org.jallinone.sales.documents.headercharges.java.SaleDocChargeVO

        res = rowsAction.loadSaleDocCharges(gridParams,serverLanguageId,username);
        if (res.isError()) {
          throw new Exception(res.getErrorMessage());
        }

        SaleDocChargeVO chargeVO = null;
        rows = new ArrayList(((VOListResponse)res).getRows());
        BigDecimal valueDOC03,invoicedValueDOC03 = new BigDecimal(0);
        for(int i=0;i<rows.size();i++) {
          chargeVO = (SaleDocChargeVO)rows.get(i);
          if (chargeVO.getValueDOC03()!=null) {

            pstmt = conn.prepareStatement(
              "select VALUE,INVOICED_VALUE from DOC03_SELLING_CHARGES where COMPANY_CODE_SYS01=? and DOC_TYPE=? and DOC_YEAR=? and DOC_NUMBER=? and CHARGE_CODE_SAL06=?"
            );
            pstmt.setString(1,refPK.getCompanyCodeSys01DOC01());
            pstmt.setString(2,refPK.getDocTypeDOC01());
            pstmt.setBigDecimal(3,refPK.getDocYearDOC01());
            pstmt.setBigDecimal(4,refPK.getDocNumberDOC01());
            pstmt.setString(5,chargeVO.getChargeCodeSal06DOC03());
            rset = pstmt.executeQuery();
            if (rset.next()) {
              valueDOC03 = rset.getBigDecimal(1);
              invoicedValueDOC03 = rset.getBigDecimal(2);

              invoicedValueDOC03 = invoicedValueDOC03.add(chargeVO.getValueDOC03()).setScale(docVO.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP);
              if (invoicedValueDOC03.doubleValue()>valueDOC03.doubleValue())
                invoicedValueDOC03 = valueDOC03;

            }
            rset.next();
            pstmt.close();

            pstmt = conn.prepareStatement(
              "update DOC03_SELLING_CHARGES set INVOICED_VALUE=?,LAST_UPDATE_USER=?,LAST_UPDATE_DATE=?  where COMPANY_CODE_SYS01=? and DOC_TYPE=? and DOC_YEAR=? and DOC_NUMBER=? and CHARGE_CODE_SAL06=?"
            );
            pstmt.setBigDecimal(1,invoicedValueDOC03);
            pstmt.setString(2,username);
            pstmt.setTimestamp(3,new java.sql.Timestamp(System.currentTimeMillis()));
            pstmt.setString(4,refPK.getCompanyCodeSys01DOC01());
            pstmt.setString(5,refPK.getDocTypeDOC01());
            pstmt.setBigDecimal(6,refPK.getDocYearDOC01());
            pstmt.setBigDecimal(7,refPK.getDocNumberDOC01());
            pstmt.setString(8,chargeVO.getChargeCodeSal06DOC03());
            pstmt.execute();
            pstmt.close();

          }
        } // end for (used to update invoice qtys in referred docs...)
View Full Code Here

Examples of org.jallinone.sales.documents.headercharges.java.SaleDocChargeVO

  /**
   * 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 {
    SaleDocChargeVO vo = (SaleDocChargeVO)valueObject;
    vo.setCompanyCodeSys01DOC03(panel.getParentVO().getCompanyCodeSys01DOC01());
    vo.setDocTypeDOC03(panel.getParentVO().getDocTypeDOC01());
    vo.setDocYearDOC03(panel.getParentVO().getDocYearDOC01());
    vo.setDocNumberDOC03(panel.getParentVO().getDocNumberDOC01());
  }
View Full Code Here

Examples of org.jallinone.sales.documents.headercharges.java.SaleDocChargeVO

   * @param oldValue old cell value (before cell editing)
   * @param newValue new cell value (just edited)
   * @return <code>true</code> if cell value is valid, <code>false</code> otherwise
   */
  public boolean validateCell(int rowNumber,String attributeName,Object oldValue,Object newValue) {
    SaleDocChargeVO vo = (SaleDocChargeVO)panel.getGrid().getVOListTableModel().getObjectForRow(rowNumber);
    if (attributeName.equals("percDOC03") && newValue!=null) {
      vo.setVatCodeSal06DOC03(null);
      vo.setVatDeductibleDOC03(null);
      vo.setVatDescriptionDOC03(null);
      vo.setVatValueDOC03(null);
      vo.setValueDOC03(null);
    }
    else if (attributeName.equals("valueDOC03") && newValue!=null) {
      vo.setPercDOC03(null);
    }
    return true;
  }
View Full Code Here

Examples of org.jallinone.sales.documents.headercharges.java.SaleDocChargeVO

   * @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 {
    SaleDocChargeVO vo = null;
    Response res = null;

    for(int i=0;i<newValueObjects.size();i++) {
      vo = (SaleDocChargeVO)newValueObjects.get(i);
      res = checkCharge(vo);
View Full Code Here

Examples of org.jallinone.sales.documents.headercharges.java.SaleDocChargeVO

   * @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 {
    SaleDocChargeVO vo = null;
    for(int i=0;i<persistentObjects.size();i++) {
      vo = (SaleDocChargeVO)persistentObjects.get(i);
      Response res = checkCharge(vo);
      if (res.isError())
        return res;
View Full Code Here

Examples of org.jallinone.sales.documents.headercharges.java.SaleDocChargeVO

   * @param row selected row index
   * @param attributeName attribute name that identifies the selected grid column
   * @return <code>true</code> if the selected cell is editable, <code>false</code> otherwise
   */
  public boolean isCellEditable(GridControl grid,int row,String attributeName) {
    SaleDocChargeVO vo = (SaleDocChargeVO)grid.getVOListTableModel().getObjectForRow(row);
    if (vo.getPercSal06DOC03()==null && attributeName.equals("percDOC03")) {
      return false;
    }
    else if (vo.getPercSal06DOC03()!=null) {
      if (attributeName.equals("valueDOC03") || attributeName.equals("vatCodeSal06DOC03"))
        return false;
    }
    return grid.isFieldEditable(row,attributeName);
  }
View Full Code Here

Examples of org.jallinone.sales.documents.headercharges.java.SaleDocChargeVO

      // retrieve all charges rows...
      rowsResponse = rowsBean.loadSaleDocCharges(pars,serverLanguageId,username);
      if (rowsResponse.isError())
        throw new Exception(rowsResponse.getErrorMessage());
      java.util.List chargesRows = ((VOListResponse)rowsResponse).getRows();
      SaleDocChargeVO chargeVO = null;
      for(int i=0;i<chargesRows.size();i++) {
        chargeVO = (SaleDocChargeVO)chargesRows.get(i);
        if (chargeVO.getValueDOC03()!=null) {
          chargeVO.setTaxableIncomeDOC03(
            chargeVO.getValueDOC03().setScale(vo.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP)
          );

          // apply taxable income to total taxable income...
          totalTaxableIncome = totalTaxableIncome.add(chargeVO.getTaxableIncomeDOC03());
        }
      }

      // fill in coeff...
      Hashtable coeff = new Hashtable(); // collection of <item/act/valuecharge,taxableincome/totaltaxableincome>
      for(int i=0;i<detailItemRows.size();i++) {
        detailItemVO = (DetailSaleDocRowVO)detailItemRows.get(i);
        coeff.put(detailItemVO,detailItemVO.getTaxableIncomeDOC02().divide(totalTaxableIncome,BigDecimal.ROUND_HALF_UP));
      }

      for(int i=0;i<actsRows.size();i++) {
        actVO = (SaleDocActivityVO)actsRows.get(i);
        coeff.put(actVO,actVO.getTaxableIncomeDOC13().divide(totalTaxableIncome,BigDecimal.ROUND_HALF_UP));
      }

      for(int i=0;i<chargesRows.size();i++) {
        chargeVO = (SaleDocChargeVO)chargesRows.get(i);
        if (chargeVO.getValueDOC03()!=null) {
          coeff.put(chargeVO,chargeVO.getTaxableIncomeDOC03().divide(totalTaxableIncome,BigDecimal.ROUND_HALF_UP));
        }
      }

      // apply % charges to all taxable incomes...
      SaleDocChargeVO percVO = null;
      for(int k=0;k<chargesRows.size();k++) {
        percVO = (SaleDocChargeVO)chargesRows.get(k);
        if (percVO.getPercDOC03()!=null) {
          for(int i=0;i<detailItemRows.size();i++) {
            detailItemVO = (DetailSaleDocRowVO)detailItemRows.get(i);
            detailItemVO.setTaxableIncomeDOC02(
              detailItemVO.getTaxableIncomeDOC02().add(detailItemVO.getTaxableIncomeDOC02().multiply(percVO.getPercDOC03().divide(new BigDecimal(100),BigDecimal.ROUND_HALF_UP))).
              setScale(vo.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP)
            );
          }

          for(int i=0;i<actsRows.size();i++) {
            actVO = (SaleDocActivityVO)actsRows.get(i);
            actVO.setTaxableIncomeDOC13(
              actVO.getTaxableIncomeDOC13().add(actVO.getTaxableIncomeDOC13().multiply(percVO.getPercDOC03().divide(new BigDecimal(100),BigDecimal.ROUND_HALF_UP))).
              setScale(vo.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP)
            );
          }

          for(int i=0;i<chargesRows.size();i++) {
            chargeVO = (SaleDocChargeVO)chargesRows.get(i);
            if (chargeVO.getValueDOC03()!=null) {
              chargeVO.setTaxableIncomeDOC03(
                chargeVO.getTaxableIncomeDOC03().add(chargeVO.getTaxableIncomeDOC03().multiply(percVO.getPercDOC03().divide(new BigDecimal(100),BigDecimal.ROUND_HALF_UP))).
                setScale(vo.getDecimalsREG03().intValue(),BigDecimal.ROUND_HALF_UP)
              );
            }
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.