Package com.structis.fichesst.shared.dto

Examples of com.structis.fichesst.shared.dto.LigTransfertppModel


    }
  }

  @Override
  public LigTransfertppModel sumByType() {
    LigTransfertppModel lig = new LigTransfertppModel();
    lig.set(LigTransfertppModel.TotalDeVers, totalDevers);
    lig.set(LigTransfertppModel.TotalObj, totalObj);
    lig.set(LigTransfertppModel.TotalRD, totalRd);
    lig.set(LigTransfertppModel.TotalTS, totalTs);
    totalDevers = 0;
    totalObj = 0;
    totalTs = 0;
    totalRd = 0;
    return lig;
View Full Code Here


   
    NumberField pu = createNumberField(null);
    pu.setName(LigTransfertppModel.PU);
    formPanel.add(pu, new FormData(ANCHOR_SPEC));
    pu.setFieldLabel("PU");
    LigTransfertppModel dataModel = new LigTransfertppModel(new SimpleDto(1, "Obj"), "de");
    storeLigModel = new ListStore<LigTransfertppModel>();
    storeLigModel.add(dataModel);
    formPanel.add(typeBudj, new FormData(ANCHOR_SPEC));
    formBinding = new FormBinding(formPanel);
   
View Full Code Here

    final AddTransfertPpForm addTransferPpForm = new AddTransfertPpForm();
    dialog.add(addTransferPpForm, new BorderLayoutData(LayoutRegion.CENTER));
    okButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
        @Override
        public void componentSelected(ButtonEvent ce) {
      LigTransfertppModel model = addTransferPpForm.getDataModel();
      gridligModel.getStore().add(model);
      isSave = false;
        }
    });
    dialog.show();
View Full Code Here

      @Override
      public Double render(Object v, ModelData m, String field, Map<String, Object> data) {
    if (v == null) {
        v = 0d;
    }
    LigTransfertppModel lig = (LigTransfertppModel) m;

    return ((Double) v).doubleValue() + (lig.getQuantite() * lig.getPu());
      }

  });
  montant.setRenderer(new GridCellRenderer<LigTransfertppModel>() {
      @Override
      public String render(LigTransfertppModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<LigTransfertppModel> store, Grid<LigTransfertppModel> grid) {
    LigTransfertppModel lig = model;
    if (lig.getDeVers().equalsIgnoreCase("vers")) {
        return NumberFormat.getCurrencyFormat().format(lig.getPu() * lig.getQuantite() * (-1));
    } else {
        return NumberFormat.getCurrencyFormat().format(lig.getPu() * lig.getQuantite());
    }

      }
  });
  configs.add(montant);

  SummaryColumnConfig<Integer> quantity = new SummaryColumnConfig<Integer>(LigTransfertppModel.QUANTITY, "Quantite", 100);
  NumberField nfQuantity = createIntegerField(null, true);
  nfQuantity.setAutoValidate(true);
  nfQuantity.setAllowNegative(false);
  nfQuantity.setAllowDecimals(false);
  quantity.setSummaryType(new SummaryType<Integer>() {

      @Override
      public Integer render(Object v, ModelData m, String field, Map<String, Object> data) {
    if (v == null) {
        v = 1;
    }
    return ((Integer) v).intValue();
      }
  });
  CellEditor ce1 = new CellEditor(nfQuantity);
  ce1.setCancelOnEsc(true);
  quantity.setMenuDisabled(true);
  quantity.setAlignment(HorizontalAlignment.CENTER);
  quantity.setSortable(false);
  quantity.setEditor(ce1);
  quantity.setSummaryType(SummaryType.COUNT);

  configs.add(quantity);

  SummaryColumnConfig<Double> pu = new SummaryColumnConfig<Double>(LigTransfertppModel.PU, "Pu", 100);
  pu.setSortable(false);
  pu.setMenuDisabled(true);
  pu.setAlignment(HorizontalAlignment.CENTER);
  pu.setSummaryFormat(NumberFormat.getCurrencyFormat());
  pu.setNumberFormat(NumberFormat.getCurrencyFormat());
  pu.setSummaryType(new SummaryType<Double>() {

      @Override
      public Double render(Object v, ModelData m, String field, Map<String, Object> data) {
    if (v == null) {
        v = 0d;
    }
    return ((Double) v).doubleValue();
      }
  });
  /* pu.setAlignment(HorizontalAlignment.RIGHT); */
  NumberField nf = new NumberField();
  nf.setAutoValidate(true);
  CellEditor ce = new CellEditor(nf);
  ce.setCancelOnEsc(true);
  pu.setEditor(ce);
  pu.setAlignment(HorizontalAlignment.CENTER);
  configs.add(pu);
  column = new ColumnConfig();
  /* column.setWidth(300); */
  column.setId(LigTransfertppModel.COMMENTAIRES);
  column.setHeader("Commentaire");
  column.setAlignment(HorizontalAlignment.LEFT);
  column.setFixed(true);
  column.setSortable(false);
  column.setMenuDisabled(true);
  column.setResizable(false);

  TextArea comment = new TextArea();
  comment.setHeight(100);
  comment.setMaxLength(MAX_LENGTH_5);
  column.setEditor(new CellEditor(comment));
  column.setRenderer(createTextAreaRenderer());
  configs.add(column);
  ColumnModel cm = new ColumnModel(configs);
  storeLig = new GroupingStore<LigTransfertppModel>();
  gridligModel = new EditorGrid<LigTransfertppModel>(storeLig, cm);
  gridligModel.setStripeRows(true);
  /* gridligModel.setWidth(1100); */
  // gridligModel.setEnabled(false);
  gridligModel.setHeight(230);
  gridligModel.setAutoWidth(true);
  gridligModel.setBorders(true);
  gridligModel.setAutoExpandColumn(LigTransfertppModel.COMMENTAIRES);
  gridligModel.setAutoExpandMax(700);
  gridligModel.setAutoExpandMin(150);
  gridligModel.setColumnReordering(true);
  gridligModel.setColumnLines(true);
  // WindowResizeBinder.bind(gridligModel);
  gridligModel.getStore().addStoreListener(new StoreListener<LigTransfertppModel>() {
      @Override
      public void handleEvent(StoreEvent<LigTransfertppModel> e) {
    double totalObjPositive = 0.0;
    double totalObjNegative = 0.0;
    double amountObj = 0.0;
    double totalDeversPositive = 0.0;
    double totalDeversNegative = 0.0;
    double amountDevers = 0.0;
    double totalTsPositive = 0.0;
    double totalTsNegative = 0.0;
    double amountTs = 0.0;
    double totalRDPositive = 0.0;
    double totalRDNegative = 0.0;
    double amountRD = 0.0;
    List<LigTransfertppModel> ligModels = gridligModel.getStore().getModels();

    for (LigTransfertppModel lig : ligModels) {
        if (lig.getRefTypeBudjConf().getId() == 1 && lig.getDeVers().equalsIgnoreCase("vers")) {
      totalObjNegative += lig.getPu() * lig.getQuantite() * (-1);
        }
        if (lig.getRefTypeBudjConf().getId() == 1 && lig.getDeVers().equalsIgnoreCase("de")) {
      totalObjPositive += lig.getPu() * lig.getQuantite();
        }
        if (lig.getRefTypeBudjConf().getId() == 2 && lig.getDeVers().equalsIgnoreCase("vers")) {
      totalDeversNegative += lig.getPu() * lig.getQuantite() * (-1);
        }
        if (lig.getRefTypeBudjConf().getId() == 2 && lig.getDeVers().equalsIgnoreCase("de")) {
      totalDeversPositive += lig.getPu() * lig.getQuantite();
        }
        if (lig.getRefTypeBudjConf().getId() == 3 && lig.getDeVers().equalsIgnoreCase("vers")) {
      totalRDNegative += lig.getPu() * lig.getQuantite() * (-1);
        }
        if (lig.getRefTypeBudjConf().getId() == 3 && lig.getDeVers().equalsIgnoreCase("de")) {
      totalRDPositive += lig.getPu() * lig.getQuantite();
        }
        if (lig.getRefTypeBudjConf().getId() == 4 && lig.getDeVers().equalsIgnoreCase("vers")) {
      totalTsNegative += lig.getPu() * lig.getQuantite() * (-1);
        }
        if (lig.getRefTypeBudjConf().getId() == 4 && lig.getDeVers().equalsIgnoreCase("de")) {
      totalTsPositive += lig.getPu() * lig.getQuantite();
        }

    }
    amountObj = totalObjNegative + totalObjPositive;
    amountDevers = totalDeversNegative + totalDeversPositive;
    amountRD = totalRDNegative + totalRDPositive;
    amountTs = totalTsNegative + totalTsPositive;
    LigTransfertppModel ligModel = new LigTransfertppModel();
    ligModel.setTotalDevers(amountDevers);
    ligModel.setTotalObj(amountObj);
    ligModel.setTotalTs(amountTs);
    ligModel.setTotalRd(amountRD);
    storeTotal.removeAll();
    // gridligTotal.getStore().add(ligModel);
    storeTotal.add(ligModel);
      }
  });
View Full Code Here

TOP

Related Classes of com.structis.fichesst.shared.dto.LigTransfertppModel

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.