Exemple #1
0
  /**
   * @function 创建invoiceline信息
   * @author 周勇 @
   */
  public String add_invoiceline() {
    ActionContext ctx = ActionContext.getContext();
    String symbol = currency_Dao.getCurrencySymbol(apInvoice.getCurrency());
    apInvoice.setSymbol(symbol);
    ctx.getSession().put("apInvoice", apInvoice);
    ctx.getSession().put("param", param);

    Struts2Util.getRequest().setAttribute("paramEL", param);

    int maxLineNo = 0;
    if (param.get("lineNo") == null) {
      maxLineNo = 1;
    } else {
      String[] lineNo = (String[]) param.get("lineNo");
      //			maxLineNo = Integer.parseInt(lineNo[lineNo.length-1] )+1;
      maxLineNo = lineNo.length + 1;
    }
    apInvoiceLine.setLineNo(maxLineNo);
    return "add_invoiceline";
  }
Exemple #2
0
  /**
   * @function 修改
   * @author 陈文擎 @
   */
  public String edit_invoiceline() {
    ActionContext ctx = ActionContext.getContext();
    String symbol = currency_Dao.getCurrencySymbol(apInvoice.getCurrency());
    apInvoice.setSymbol(symbol);
    ctx.getSession().put("apInvoice", apInvoice);
    ctx.getSession().put("param", param);

    Struts2Util.getRequest().setAttribute("paramEL", param);

    String LineNo = Struts2Util.getRequest().getParameter("LineNo").trim();
    if (0 == param.size()) return "edit_invoiceline";

    String[] itemNos = param.get("itemNo") == null ? null : (String[]) param.get("itemNo");
    String[] catalogNo = param.get("catalogNo") == null ? null : (String[]) param.get("catalogNo");
    String[] names = param.get("name") == null ? null : (String[]) param.get("name");
    String[] qtys = param.get("qty") == null ? null : (String[]) param.get("qty");
    String[] qtyUoms = param.get("qtyUom") == null ? null : (String[]) param.get("qtyUom");
    String[] unitPrices = param.get("unitPrice") == null ? null : (String[]) param.get("unitPrice");
    String[] amounts = param.get("amount") == null ? null : (String[]) param.get("amount");
    String[] taxs = param.get("tax") == null ? null : (String[]) param.get("tax");
    String[] sizes = param.get("size") == null ? null : (String[]) param.get("size");
    String[] lineNo = param.get("lineNo") == null ? null : (String[]) param.get("lineNo");

    int i = 0;
    for (i = 0; i < lineNo.length; i++) {
      if (LineNo.equals(lineNo[i])) {
        break;
      }
    }
    apInvoiceLine.setAmount(Tools.String2Float(amounts[i]));
    apInvoiceLine.setCatalogNo(catalogNo[i]);
    apInvoiceLine.setItemNo(Tools.String2Integer(itemNos[i]));
    apInvoiceLine.setName(names[i]);
    apInvoiceLine.setQty(Tools.String2Integer(qtys[i]));
    apInvoiceLine.setQtyUom(qtyUoms[i]);
    apInvoiceLine.setUnitPrice(Tools.String2Float(unitPrices[i]));
    apInvoiceLine.setTax(Tools.String2Float(taxs[i]));
    apInvoiceLine.setSize(Tools.String2Float(sizes[i]));
    apInvoiceLine.setLineNo(Tools.String2Integer(lineNo[i]));
    return "edit_invoiceline";
  }
Exemple #3
0
  /**
   * 修改invocie
   *
   * @return
   */
  public String edit() {
    int invoiceId = Tools.String2Integer(Struts2Util.getParameter("invoiceId"));
    List<ApInvoiceLine> apInvoiceLines = null;
    try {
      apInvoice = new ApInvoice();
      apInvoice = (ApInvoice) this.apInvoiceDao.getSession().get(ApInvoice.class, invoiceId);
      apInvoice.setOldStatus(apInvoice.getStatus());
      apInvoiceLines = apInvoiceLineDao.queryInvoiceByInvoiceId(apInvoice.getInvoiceId());
      String symbol = currency_Dao.getCurrencySymbol(apInvoice.getCurrency());
      apInvoice.setSymbol(symbol);
    } catch (Exception e) {
      e.printStackTrace();
    }

    if ((null == apInvoiceLines) || (0 == apInvoiceLines.size())) {
      return "edit_invoice";
    }
    int length = apInvoiceLines.size();

    String[] itemNos = new String[length];
    String[] invoiceLineIds = new String[length];
    String[] invoiceIds = new String[length];
    String[] catalogNo = new String[length];
    String[] names = new String[length];
    String[] qtys = new String[length];
    String[] qtyUoms = new String[length];
    String[] unitPrices = new String[length];
    String[] amounts = new String[length];
    String[] taxs = new String[length];
    String[] sizes = new String[length];
    String[] lineNo = new String[length];
    String[] discounts = new String[length];
    String[] createDate = new String[length];
    String[] createBy = new String[length];
    String[] modifyDate = new String[length];
    String[] modifyBy = new String[length];
    ApInvoiceLine InvoiceLine = null;

    for (int i = 0; i < apInvoiceLines.size(); i++) {
      InvoiceLine = apInvoiceLines.get(i);
      invoiceLineIds[i] = "" + InvoiceLine.getInvoiceLineId();
      invoiceIds[i] = "" + InvoiceLine.getInvoiceId();
      amounts[i] = "" + InvoiceLine.getAmount();
      catalogNo[i] = InvoiceLine.getCatalogNo();
      itemNos[i] = "" + InvoiceLine.getItemNo();
      names[i] = InvoiceLine.getName();
      qtys[i] = "" + InvoiceLine.getQty();
      qtyUoms[i] = "" + InvoiceLine.getQtyUom();
      unitPrices[i] = "" + InvoiceLine.getUnitPrice();
      taxs[i] = "" + InvoiceLine.getTax();
      sizes[i] = "" + InvoiceLine.getSize();
      lineNo[i] = "" + InvoiceLine.getLineNo();
      discounts[i] = "" + InvoiceLine.getDiscount();
      createDate[i] = "" + InvoiceLine.getCreationDate();
      createBy[i] = "" + InvoiceLine.getCreatedBy();
      modifyDate[i] = "" + InvoiceLine.getModifyDate();
      modifyBy[i] = "" + InvoiceLine.getModifiedBy();
    }

    param.put("invoiceLineIds", invoiceLineIds);
    param.put("invoiceIds", invoiceIds);
    param.put("itemNo", itemNos);
    param.put("catalogNo", catalogNo);
    param.put("name", names);
    param.put("qty", qtys);
    param.put("qtyUom", qtyUoms);
    param.put("unitPrice", unitPrices);
    param.put("amount", amounts);
    param.put("tax", taxs);
    param.put("size", sizes);
    param.put("lineNo", lineNo);
    param.put("discount", discounts);
    param.put("creationDate", createDate);
    param.put("createdBy", createBy);
    param.put("modifyDate", modifyDate);
    param.put("modifiedBy", modifyBy);

    Struts2Util.getRequest().setAttribute("paramEL", param);
    return "edit_invoice";
  }