Package no.ugland.utransprod.model

Examples of no.ugland.utransprod.model.NokkelProduksjonV


   */
  @Override
  public NokkelProduksjonVModel getBufferedObjectModel(
      PresentationModel presentationModel) {
    NokkelProduksjonVModel model = new NokkelProduksjonVModel(
        new NokkelProduksjonV());
    model.setBudgetDeviationProcString((String) presentationModel
        .getBufferedValue(PROPERTY_BUDGET_DEVIATION_PROC_STRING));
    model.setBudgetDeviationString((String) presentationModel
        .getBufferedValue(PROPERTY_BUDGET_DEVIATION_STRING));
    model.setBudgetValueString((String) presentationModel
View Full Code Here


                                        year)).add(
                                Restrictions.eq(
                                        "nokkelProduksjonVPK.orderReadyWeek",
                                        week)).list();

                        NokkelProduksjonV nokkelProduksjonV = null;
                        if (list != null) {
                            nokkelProduksjonV = new NokkelProduksjonV(null, 0,
                                    BigDecimal.valueOf(0), 0, BigDecimal
                                            .valueOf(0), BigDecimal.valueOf(0),
                                    BigDecimal.valueOf(0), BigDecimal
                                            .valueOf(0));
                            for (NokkelProduksjonV nokkel : list) {
                                if (nokkel != null) {
                                    nokkelProduksjonV
                                            .setBudgetDeviation(nokkelProduksjonV
                                                    .getBudgetDeviation()
                                                    .add(
                                                            nokkel
                                                                    .getBudgetDeviation()));
                                    nokkelProduksjonV.setBudgetValue(nokkel
                                            .getBudgetValue());
                                    nokkelProduksjonV
                                            .setCountOrderReady(nokkelProduksjonV
                                                    .getCountOrderReady()
                                                    + nokkel
                                                            .getCountOrderReady());
                                    nokkelProduksjonV
                                            .setPackageSumWeek(nokkelProduksjonV
                                                    .getPackageSumWeek()
                                                    .add(
                                                            Util
                                                                    .convertNullToBigDecimal(nokkel
                                                                            .getPackageSumWeek())));
                                    nokkelProduksjonV.calculateDeviationProc();
                                }
                            }
                        }

                        return nokkelProduksjonV;
View Full Code Here

        return (NokkelProduksjonV) getHibernateTemplate().execute(
                new HibernateCallback() {

                    @SuppressWarnings("unchecked")
                    public Object doInHibernate(final Session session) {
                        NokkelProduksjonV nokkelProduksjonV = null;
                        List<Object> list = session
                                .createQuery(
                                        "select sum(nokkelProduksjonV.packageSumWeek),"
                                                + "sum(nokkelProduksjonV.budgetValue),"
                                                + "sum(nokkelProduksjonV.budgetDeviation),"
                                                + "sum(nokkelProduksjonV.countOrderReady),"
                                                + "sum(nokkelProduksjonV.deviationCount),"
                                                + "sum(nokkelProduksjonV.internalCost)"
                                                + "from NokkelProduksjonV nokkelProduksjonV "
                                                + "where nokkelProduksjonV.nokkelProduksjonVPK.orderReadyYear"
                                                + "=:year and "
                                                + "nokkelProduksjonV.nokkelProduksjonVPK.orderReadyWeek "
                                                + "<=:week and "
                                                + "nokkelProduksjonV.nokkelProduksjonVPK.productArea="
                                                + ":productArea")
                                .setParameter("year", currentYearWeek.getYear())
                                .setParameter("week", currentYearWeek.getWeek())
                                .setParameter("productArea", productArea)
                                .list();
                        if (list != null && list.size() == 1) {
                            Object[] result = (Object[]) list.get(0);
                            nokkelProduksjonV = new NokkelProduksjonV();
                            nokkelProduksjonV
                                    .setNokkelProduksjonVPK(new NokkelProduksjonVPK(
                                            currentYearWeek.getYear(),
                                            currentYearWeek.getWeek(),
                                            productArea, null));
                            nokkelProduksjonV
                                    .setCountOrderReady((Integer) result[3]);
                            nokkelProduksjonV
                                    .setDeviationCount((Integer) result[4]);
                            nokkelProduksjonV
                                    .setInternalCost((BigDecimal) result[5]);
                            nokkelProduksjonV
                                    .setPackageSumWeek((BigDecimal) result[0]);
                            nokkelProduksjonV
                                    .setBudgetValue((BigDecimal) result[1]);
                            nokkelProduksjonV
                                    .setBudgetDeviation((BigDecimal) result[2]);

                            if (nokkelProduksjonV.getBudgetValue() != null
                                    && nokkelProduksjonV.getBudgetValue()
                                            .intValue() != 0) {
                                nokkelProduksjonV
                                        .setBudgetDeviationProc(nokkelProduksjonV
                                                .getBudgetDeviation()
                                                .divide(
                                                        nokkelProduksjonV
                                                                .getBudgetValue(),
                                                        2, RoundingMode.HALF_UP)
                                                .multiply(
                                                        BigDecimal.valueOf(100),
                                                        new MathContext(
                                                                100,
                                                                RoundingMode.HALF_UP)));
                            } else {
                                nokkelProduksjonV
                                        .setBudgetDeviationProc(BigDecimal
                                                .valueOf(100));
                            }

                        }
View Full Code Here

  /**
   * Oppdaterer info
   */
  public void refresh() {
    NokkelProduksjonV nokkelProduksjonV = nokkelProduksjonVManager
        .findByWeek(currentYear, currentWeek);
    if (nokkelProduksjonV == null) {
      nokkelProduksjonV = new NokkelProduksjonV(null, 0, BigDecimal
          .valueOf(0), 0, null, BigDecimal.valueOf(0), BigDecimal
          .valueOf(0), BigDecimal.valueOf(0));
    }
    if (presentationModelProduksjon == null) {
      presentationModelProduksjon = new PresentationModel(
          new NokkelProduksjonVModel(nokkelProduksjonV));
    } else {
      presentationModelProduksjon.setBean(new NokkelProduksjonVModel(
          nokkelProduksjonV));
    }

    NokkelProduksjonV sumNokkelProduksjonV = nokkelProduksjonVManager
        .aggreagateYearWeek(new YearWeek(currentYear, currentWeek),"Garasje villa");
    if (sumNokkelProduksjonV == null) {
      sumNokkelProduksjonV = new NokkelProduksjonV(null, 0, BigDecimal
          .valueOf(0), 0, null, BigDecimal.valueOf(0), BigDecimal
          .valueOf(0), BigDecimal.valueOf(0));
    }
    if (presentationModelSumProduksjon == null) {
      presentationModelSumProduksjon = new PresentationModel(
View Full Code Here

    }

    public final List<NokkelProduksjonV> getNokkelTallProduksjonWeek(
            final YearWeek yearWeek) {
        initReportProduksjon();
        NokkelProduksjonV produksjon = nokkelProduksjonMap.get(yearWeek);
        if (produksjon != null) {
            return Arrays.asList(new NokkelProduksjonV[] {produksjon});
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of no.ugland.utransprod.model.NokkelProduksjonV

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.