Esempio n. 1
0
  private void initColumnsAdnWidths(CleanwiseUser appUser) {
    mShowPrice = appUser.getShowPrice();
    String showSize = mRequest.getParameter("showSize");
    if (Utility.isSet(showSize) && !Utility.isTrue(showSize)) {
      mShowSize = false;
    }
    if (!catalogOnly) {
      mColumnCount++;
    }

    if (mShowSize) {
      mColumnCount++;
    }
    if (mShowPrice) {
      mColumnCount++;
    }

    itmColumnWidth = new int[mColumnCount];
    int i = 0;

    if (!catalogOnly) {
      itmColumnWidth[i++] = 8; // empty
      itmColumnWidth[i++] = 8; // qty
      itmColumnWidth[i++] = 10; // sku
      itmColumnWidth[i++] = 40; // name
      if (mShowSize) {
        itmColumnWidth[i++] = 10; // size
      }
      // itmColumnWidth[i++] = 6;
      // itmColumnWidth[i++] = 6;
      if (mShowPrice) {
        itmColumnWidth[i++] = 16; // price
      }
      itmColumnWidth[i] = 8; // empty

    } else {

      itmColumnWidth[i++] = 10; // empty
      itmColumnWidth[i++] = 12; // sku
      itmColumnWidth[i++] = 36; // name
      if (mShowSize) {
        itmColumnWidth[i++] = 20; // size
      }
      // itmColumnWidth[i++] = 4;
      // itmColumnWidth[i++] = 3;
      if (mShowPrice) {
        itmColumnWidth[i++] = 16; // price
      }
      itmColumnWidth[i] = 3; // spl
    }
  }
Esempio n. 2
0
  // utility function to make an item Element.
  private Table makeItemElement(ShoppingCartItemData pItm) throws DocumentException {

    Table itmTbl = new PTable(mColumnCount);
    itmTbl.setWidth(100);
    itmTbl.setWidths(itmColumnWidth);
    itmTbl.getDefaultCell().setBorderColor(java.awt.Color.black);
    itmTbl.getDefaultCell().setVerticalAlignment(Cell.ALIGN_TOP);
    itmTbl.setOffset(0);
    itmTbl.setBorder(Table.NO_BORDER);

    if (!catalogOnly) {
      String t0 = "";
      if (pItm.getIsaInventoryItem()) {
        t0 = "i";
      }

      if (null != mSiteData
          && mSiteData.isAnInventoryAutoOrderItem(pItm.getProduct().getProductId())) {
        t0 += "a";
      }

      Cell tpc0 = new Cell(makePhrase(t0, small, true));
      if (!pItm.getIsaInventoryItem()) {
        tpc0.setBorder(0);
      }
      itmTbl.addCell(tpc0);
    }

    Cell tpc01 = new Cell(makePhrase("", normal, true));
    itmTbl.addCell(tpc01);

    String t = "";
    if (pItm.getProduct().isPackProblemSku()) {
      t += "*";
    }
    if (t.length() > 0) t += " ";
    Cell tpc1 = new Cell(makePhrase(t + pItm.getActualSkuNum(), normal, true));
    itmTbl.addCell(tpc1);

    itmTbl.addCell(makePhrase(pItm.getProduct().getCatalogProductShortDesc(), normal, true));
    if (mShowSize) {
      itmTbl.addCell(makePhrase(pItm.getProduct().getSize(), normal, true));
    }
    // itmTbl.addCell(makePhrase(pItm.getProduct().getPack(), normal, true));
    // itmTbl.addCell(makePhrase(pItm.getProduct().getUom(), normal, true));
    // itmTbl.addCell(makePhrase(pItm.getProduct().getManufacturerName(),normal,true));

    if (mShowPrice) {
      BigDecimal price = new BigDecimal(pItm.getPrice());
      String priceStr = "";
      try {
        priceStr = mFormatter.priceFormatWithoutCurrency(price);
      } catch (Exception exc) {
        exc.printStackTrace();
      }
      Cell pcell = new Cell(makePhrase(priceStr, normal, true));
      pcell.setHorizontalAlignment(Element.ALIGN_RIGHT);
      itmTbl.addCell(pcell);
    }

    if (catalogOnly) {
      if (pItm.getProduct() != null
          && pItm.getProduct().getCatalogDistrMapping() != null
          && Utility.isTrue(pItm.getProduct().getCatalogDistrMapping().getStandardProductList())) {
        String yStr = ClwI18nUtil.getMessage(mRequest, "shoppingItems.text.y", null);
        itmTbl.addCell(makePhrase(yStr, normal, true));
      } else {
        String nStr = ClwI18nUtil.getMessage(mRequest, "shoppingItems.text.n", null);
        itmTbl.addCell(makePhrase(nStr, normal, true));
      }
    }

    if (!catalogOnly) {
      // BigDecimal amount = new BigDecimal(pItm.getAmount());
      itmTbl.addCell(makePhrase("", normal, true));
    }

    return itmTbl;
  }
Esempio n. 3
0
  public void extractItemIdentificationLIN(Loop inLoop) throws OBOEException {
    Segment segment = null;
    boolean ignoreMissingLineInfo =
        Utility.isTrue(
            getTranslator()
                .getConfigurationProperty(
                    RefCodeNames.ENTITY_PROPERTY_TYPE.IGNORE_MISSING_LINE_INFO));
    // valid = false;
    try {
      segment = inLoop.getSegment("LIN");
    } catch (Exception exc) {
      exc.printStackTrace();
    }
    if (segment == null && !ignoreMissingLineInfo) {
      errorMsgs.add("Segment LIN missing");
      setValid(false);
      return;
    }
    String orderLineNumS = getField(segment, 1, true, "Missing order line number in LIN segment");
    if (orderLineNumS == null && !ignoreMissingLineInfo) {
      errorMsgs.add("Order Line Number in LIN segment is null");
      setValid(false);
      return;
    }

    int orderLineNum = 0;
    try {
      orderLineNum = Integer.parseInt(orderLineNumS);
    } catch (Exception exc) {
      // JD China will use line num 3.1 for line 3 if order is split for shipment.
      int ix = orderLineNumS.indexOf('.');
      if (ix > 0) {
        String orderLineNumSs = orderLineNumS.substring(0, ix);
        try {
          orderLineNum = Integer.parseInt(orderLineNumSs);
        } catch (Exception ex) {
        }
      }

      if (orderLineNum == 0 && !ignoreMissingLineInfo) {
        errorMsgs.add("Invalid value of order line number in LIN segment: " + orderLineNumS);
        setValid(false);
        return;
      }
    }

    ediInp856ItemVw.setPurchOrderLineNum(orderLineNum);
    for (int fieldNum = 1; fieldNum <= 7; fieldNum += 2) {
      try {
        String productNumQualifier = getField(segment, 1 + fieldNum, false, "");
        if (productNumQualifier == null) {
          // errorMsgs.add("Product Service Id Qualifier is null");
          // setValid(false);
          // return;
          break;
        }
        String productNum = getField(segment, 1 + fieldNum + 1, false, "");
        if ("VP".equals(productNumQualifier) || "VN".equals(productNumQualifier)) {
          ediInp856ItemVw.setDistSkuNum(productNum);
        }
      } catch (Exception exc) {
        break;
      }
    }
    return;
  }