예제 #1
0
  /** @return */
  public String afteredit_invoiceline() {

    ActionContext ctx = ActionContext.getContext();
    String dispatch = Struts2Util.getRequest().getParameter("dispatch").trim();
    if (null != ctx.getSession().get("apInvoice")) {
      apInvoice = (ApInvoice) ctx.getSession().get("apInvoice");
      param = (Map) ctx.getSession().get("param");
      //						ctx.getSession().remove("apInvoice");
    }
    String LineNo = "" + apInvoiceLine.getLineNo();

    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");
    String[] creationDate =
        param.get("creationDate") == null ? null : (String[]) param.get("creationDate");
    String[] creationBy = param.get("createdBy") == null ? null : (String[]) param.get("createdBy");
    //			        String[] modify_dates = param.get("modifyDate")== null ? null :
    // (String[])param.get("modifyDate");
    //					String[] modified_by = param.get("modifiedBy")== null ? null :
    // (String[])param.get("modifiedBy");
    //			        ctx.getSession().remove("param");
    int i = 0;
    for (i = 0; i < lineNo.length; i++) {
      if (LineNo.equals(lineNo[i])) {
        break;
      }
    }
    amounts[i] = "" + apInvoiceLine.getAmount();
    catalogNo[i] = apInvoiceLine.getCatalogNo();
    itemNos[i] = "" + apInvoiceLine.getItemNo();
    names[i] = apInvoiceLine.getName();
    qtys[i] = "" + apInvoiceLine.getQty();
    qtyUoms[i] = "" + apInvoiceLine.getQtyUom();
    unitPrices[i] = "" + apInvoiceLine.getUnitPrice();
    taxs[i] = "" + apInvoiceLine.getTax();
    sizes[i] = "" + apInvoiceLine.getSize();
    lineNo[i] = "" + apInvoiceLine.getLineNo();
    creationDate[i] = Tools.getCurrentTime("yyyy-MM-dd");
    creationBy[i] = "" + SessionUtil.getUserId();

    //			        modify_dates[i]=Tools.getCurrentTime("yyyy-MM-dd");
    //			        modified_by[i]=""+SessionUtil.getUserId();

    Struts2Util.getRequest().setAttribute("paramEL", param);
    return dispatch;
  }
예제 #2
0
  /**
   * 新增一个发票点击save后,但是数据还没有保存到数据库
   *
   * @return
   */
  public String afteradd_invoiceline() {

    ActionContext ctx = ActionContext.getContext();
    String dispatch = Struts2Util.getRequest().getParameter("dispatch").trim();

    if (null != ctx.getSession().get("apInvoice")) {
      apInvoice = (ApInvoice) ctx.getSession().get("apInvoice");
      //		 			ctx.getSession().remove("apInvoice");
    }

    if (null != ctx.getSession().get("param")) {
      param = (Map) ctx.getSession().get("param");

      String[] invoiceLineIds =
          param.get("invoiceLineIds") == null ? null : (String[]) param.get("invoiceLineIds");
      String[] invoiceIds =
          param.get("invoiceIds") == null ? null : (String[]) param.get("invoiceIds");
      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");
      String[] discounts = param.get("discount") == null ? null : (String[]) param.get("discount");
      String[] creation_dates =
          param.get("creationDate") == null ? null : (String[]) param.get("creationDate");
      String[] created_by =
          param.get("createdBy") == null ? null : (String[]) param.get("createdBy");
      String[] modify_dates =
          param.get("modifyDate") == null ? null : (String[]) param.get("modifyDate");
      String[] modified_by =
          param.get("modifiedBy") == null ? null : (String[]) param.get("modifiedBy");

      //		 			ctx.getSession().remove("param");

      String[] invoiceLineIds1 = Tools.add(invoiceLineIds, "0");
      String[] invoiceIds1 = Tools.add(invoiceIds, "0");
      String itemNo1[] = Tools.add(itemNos, this.apInvoiceLine.getItemNo() + "");
      String catalogNo1[] = Tools.add(catalogNo, this.apInvoiceLine.getCatalogNo());
      String names1[] = Tools.add(names, this.apInvoiceLine.getName()); // name 未填
      String qtys1[] = Tools.add(qtys, this.apInvoiceLine.getQty() + "");
      String qtyUoms1[] = Tools.add(qtyUoms, this.apInvoiceLine.getQtyUom());
      String unitPrices1[] = Tools.add(unitPrices, this.apInvoiceLine.getUnitPrice() + "");
      String amounts1[] = Tools.add(amounts, this.apInvoiceLine.getAmount() + "");
      String taxs1[] = Tools.add(taxs, this.apInvoiceLine.getTax() + "");
      String[] sizes1 = Tools.add(sizes, this.apInvoiceLine.getSize() + "");
      String[] lineNo1 = Tools.add(lineNo, this.apInvoiceLine.getLineNo() + "");
      String[] discounts1 = Tools.add(discounts, this.apInvoiceLine.getDiscount() + "");
      String[] creation_dates1 = Tools.add(creation_dates, Tools.getCurrentTime("yyyy-MM-dd"));
      String[] created_by1 = Tools.add(created_by, SessionUtil.getUserId() + "");
      String[] modify_dates1 = Tools.add(modify_dates, Tools.getCurrentTime("yyyy-MM-dd") + "");
      String[] modified_by1 = Tools.add(modified_by, SessionUtil.getUserId() + "");

      param.put("invoiceLineIds", invoiceLineIds1);
      param.put("invoiceIds", invoiceIds1);
      param.put("itemNo", itemNo1);
      param.put("catalogNo", catalogNo1);
      param.put("name", names1);
      param.put("qty", qtys1);
      param.put("qtyUom", qtyUoms1);
      param.put("amount", amounts1);
      param.put("tax", taxs1);
      param.put("unitPrice", unitPrices1);
      param.put("size", sizes1);
      param.put("lineNo", lineNo1);
      param.put("discount", discounts1);
      param.put("creationDate", creation_dates1);
      param.put("createdBy", created_by1);
      param.put("modifyDate", modify_dates1);
      param.put("modifiedBy", modified_by1);

      //		 			ctx.getSession().put("param", param);
    } else {
      String[] invoiceLineIds = new String[1];
      invoiceLineIds[0] = "0";
      String[] invoiceIds = new String[1];
      invoiceIds[0] = "0";
      String itemNo[] = new String[1];
      itemNo[0] = this.apInvoiceLine.getItemNo() + "";
      String catalogNo[] = new String[1];
      catalogNo[0] = apInvoiceLine.getCatalogNo();
      String names[] = new String[1];
      names[0] = apInvoiceLine.getName(); // 还未给值
      String qtys[] = new String[1];
      qtys[0] = apInvoiceLine.getQty() + "";
      String qtyUoms[] = new String[1];
      qtyUoms[0] = apInvoiceLine.getQtyUom();
      String unitPrices[] = new String[1];
      unitPrices[0] = this.apInvoiceLine.getUnitPrice() + "";
      String amounts[] = new String[1];
      amounts[0] = this.apInvoiceLine.getAmount() + "";
      String taxs[] = new String[1];
      taxs[0] = this.apInvoiceLine.getTax() + "";
      String[] sizes = new String[1];
      sizes[0] = this.apInvoiceLine.getSize() + "";
      String[] lineNo = new String[1];
      lineNo[0] = this.apInvoiceLine.getLineNo() + "";
      String[] discount = new String[1];
      discount[0] = this.apInvoiceLine.getDiscount() + "";
      String[] creation_dates = Tools.add(null, Tools.getCurrentTime("yyyy-MM-dd") + "");
      String[] created_by = Tools.add(null, SessionUtil.getUserId() + "");
      String[] modify_dates = Tools.add(null, Tools.getCurrentTime("yyyy-MM-dd") + "");
      String[] modified_by = Tools.add(null, SessionUtil.getUserId() + "");

      param.put("invoiceLineIds", invoiceLineIds);
      param.put("invoiceIds", invoiceIds);
      param.put("itemNo", itemNo);
      param.put("catalogNo", catalogNo);
      param.put("name", names);
      param.put("qty", qtys);
      param.put("qtyUom", qtyUoms);
      param.put("amount", amounts);
      param.put("tax", taxs);
      param.put("unitPrice", unitPrices);
      param.put("size", sizes);
      param.put("lineNo", lineNo);
      param.put("discount", discount);
      param.put("creationDate", creation_dates);
      param.put("createdBy", created_by);
      param.put("modifyDate", modify_dates);
      param.put("modifiedBy", modified_by);
      //		 			ctx.getSession().put("param", param);
    }

    Struts2Util.getRequest().setAttribute("paramEL", param);
    return dispatch;
  }
예제 #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";
  }