Package org.jallinone.sales.reports.java

Examples of org.jallinone.sales.reports.java.SalesPivotVO


      MDIFrame.add(this);
      filterPanel.setMode(Consts.INSERT);

      Calendar cal = Calendar.getInstance();
      SalesPivotVO vo= (SalesPivotVO)filterPanel.getVOModel().getValueObject();
      controlYear.setValue(new BigDecimal(String.valueOf(cal.get(cal.YEAR))));
      vo.setDocYear((BigDecimal)controlYear.getValue());
      controlDocStates.setValue(ApplicationConsts.CLOSED);


    }
    catch(Exception e) {
View Full Code Here


      pivotTable.setController(new PivotTableController(){

        public Response getPivotTableModel(PivotTableParameters pars) {
          filterPanel.pull();
          SalesPivotVO vo= (SalesPivotVO)filterPanel.getVOModel().getValueObject();
          vo.setPivotPars(pars);
          pars.setInputFilter(new InputFilter());
          Response res = ClientUtils.getData("salesPivot",vo);
          if (res.isError())
            OptionPane.showMessageDialog(SalesPivotFrame.this,res.getErrorMessage(),"Error while loading data",JOptionPane.ERROR_MESSAGE);
          return res;
        }

      });

      RowField rowFieldItem = new RowField("itemCodeItm01DOC02",100);
      RowField rowFieldCustomer = new RowField("customerCodeSAL07",150);
      RowField rowFieldWarehouse = new RowField("warehouseCodeWar01DOC01",100);

      pivotTable.getAllRowFields().add(rowFieldItem);
      pivotTable.getAllRowFields().add(rowFieldCustomer);
      pivotTable.getAllRowFields().add(rowFieldWarehouse);

      pivotTable.addRowField(rowFieldWarehouse);
//      pivotTable.addRowField(rowFieldItem);

      ColumnField columnFieldYear = new ColumnField("docDateDOC01","year",new YearAggregator());
      ColumnField columnFieldQuarter = new ColumnField("docDateDOC01","quarter",new QuarterAggregator());

      pivotTable.getAllColumnFields().add(columnFieldYear);
      pivotTable.getAllColumnFields().add(columnFieldQuarter);

      pivotTable.addColumnField(columnFieldYear);
      pivotTable.addColumnField(columnFieldQuarter);

      NumberFormat nf = NumberFormat.getCurrencyInstance();
      Currency currency = Currency.getInstance(Locale.getDefault()); // to review...
      nf.setCurrency(currency);
      nf.setMaximumFractionDigits(2);
      nf.setMinimumFractionDigits(2);
      nf.setGroupingUsed(true);

      DataField dataFieldTotal = new DataField("totalDOC01",80,"sellAmount",new SumFunction()); // sum function...
      dataFieldTotal.setFormatter(nf);

      NumberFormat nf2 = NumberFormat.getIntegerInstance();

      DataField dataFieldItemQty = new DataField("qtyDOC02",80,"sellQty",new SumFunction()); // sum function...
      dataFieldItemQty.setFormatter(nf2);

      pivotTable.getAllDataFields().add(dataFieldTotal);
      pivotTable.getAllDataFields().add(dataFieldItemQty);
      pivotTable.addDataField(dataFieldTotal);


      pivotTable.setDataFieldRenderer(new DataFieldRenderer() {

        /**
         * @param currentColor current color to set
         * @param rowPath GenericNodeKey row fields path that identify current row
         * @param colPath GenericNodeKey column fields path that identify current column
         * @param value value to show in the specified cell
         * @param row current row
         * @param col current column
         * @return Color background color to set
         */
        public Color getBackgroundColor(Color currentColor,GenericNodeKey rowPath,GenericNodeKey colPath,Object value,int row,int col) {
          if (rowPath.getPath().length<pivotTable.getPivotTableParameters().getRowFields().size() ||
              colPath.getPath().length<pivotTable.getPivotTableParameters().getColumnFields().size()+1) {
            int c = 200+rowPath.getPath().length*colPath.getPath().length*5;
            return new Color(c,c,c);
          }
          return currentColor;
        }


        /**
         * @param currentColor current color to set
         * @param rowPath GenericNodeKey row fields path that identify current row
         * @param colPath GenericNodeKey column fields path that identify current column
         * @param value value to show in the specified cell
         * @param row current row
         * @param col current column
         * @return Color foreground color to set
         */
        public Color getForegroundColor(Color currentColor,GenericNodeKey rowPath,GenericNodeKey colPath,Object value,int row,int col) {
          return currentColor;
        }


        /**
         * @param currentFont current font to set
         * @param rowPath GenericNodeKey row fields path that identify current row
         * @param colPath GenericNodeKey column fields path that identify current column
         * @param value value to show in the specified cell
         * @param row current row
         * @param col current column
         * @return font to set
         */
        public Font getFont(Font currentFont,GenericNodeKey rowPath,GenericNodeKey colPath,Object value,int row,int col) {
          if (rowPath.getPath().length<pivotTable.getPivotTableParameters().getRowFields().size() ||
              colPath.getPath().length<pivotTable.getPivotTableParameters().getColumnFields().size()+1)
            return new Font(currentFont.getFontName(),Font.BOLD,currentFont.getSize());
          return currentFont;
        }

      });



      controlComp.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
          Object companyCodeSys01 = controlComp.getValue();
          if (companyCodeSys01==null)
            companyCodeSys01 = controlComp.getDomain().getDomainPairList()[0].getCode();

          SalesPivotVO vo= (SalesPivotVO)filterPanel.getVOModel().getValueObject();
          vo.setCompanyCode((String)companyCodeSys01);
        }

      });

  }
View Full Code Here

TOP

Related Classes of org.jallinone.sales.reports.java.SalesPivotVO

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.