Exemplo n.º 1
0
 /**
  * 获取saler的名称
  *
  * @return
  */
 public String getSalerName() {
   int id = 0;
   String msg = "";
   try {
     id = Integer.parseInt(Struts2Util.getParameter("orderNo"));
     Map m = this.apInvoiceDao.getInfoByOrder(id);
     msg =
         "{ state:'success', currency:'"
             + m.get("currency")
             + "', name : '"
             + m.get("name")
             + "',saleId:'"
             + m.get("saleId")
             + "',amt:"
             + m.get("amt")
             + ",currency:'"
             + m.get("currency")
             + "',symbol:'"
             + m.get("symbol")
             + "' }";
   } catch (Exception e) {
     e.printStackTrace();
     msg = "{ state:'error',msg:'" + e.getMessage() + "' }";
   }
   Struts2Util.renderJson(msg);
   return null;
 }
Exemplo n.º 2
0
 /**
  * 浏览历史付款
  *
  * @return
  */
 public String viewAllocationHistory() {
   int id = Tools.String2Integer(Struts2Util.getParameter("invoiceId"));
   if (id != 0) {
     String hql = "from ApTransactionAllocation a where a.invoiceId= ? ";
     apInvoiceAllocationList =
         (List<ApTransactionAllocation>) this.apInvoiceAllocationDao.createQuery(hql, id).list();
   }
   return "view_allocation_history";
 }
Exemplo n.º 3
0
 public String getCategoryByCatalogAndCategory() {
   Map<String, Object> rt = new HashMap<String, Object>();
   String catalogId = Struts2Util.getParameter("catalogId");
   String categoryId = Struts2Util.getParameter("categoryId");
   String categoryLevel = Struts2Util.getParameter("categoryLevel");
   if (categoryLevel.equals("2")) {
     this.serviceCCategoryOfPriceList =
         this.servService.getServiceCategoryByCatalogId(catalogId, Integer.valueOf(categoryId), 2);
     categoryLevel = "3";
     if (this.serviceCCategoryOfPriceList != null && !this.serviceCCategoryOfPriceList.isEmpty()) {
       this.serviceCategoryOfPriceList =
           this.servService.getServiceCategoryByCatalogId(
               catalogId, serviceCCategoryOfPriceList.get(0).getCategoryId(), 3);
     }
   } else if (categoryLevel.equals("3")) {
     this.serviceCategoryOfPriceList =
         this.servService.getServiceCategoryByCatalogId(catalogId, Integer.valueOf(categoryId), 3);
   }
   rt.put("serviceCategoryOfPriceList", serviceCategoryOfPriceList);
   rt.put("serviceCCategoryOfPriceList", serviceCCategoryOfPriceList);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemplo n.º 4
0
  /**
   * 检查该发票是否对过账,如果已经对过账,则不能修改currency
   *
   * @return
   */
  public String checkInvoiceIsAllocatied() {
    int invoiceId = 0;
    String msg = "";
    try {
      invoiceId = Integer.parseInt(Struts2Util.getParameter("invoiceId"));

      boolean flag = this.apInvoiceDao.isAllocation(invoiceId);
      msg = "{ state:'success',flag : " + flag + "}";
    } catch (Exception e) {
      e.printStackTrace();
      msg = "{ state:'error',msg:'" + e.getMessage() + "' }";
    }
    Struts2Util.renderJson(msg);
    return null;
  }
Exemplo n.º 5
0
  public String priceApprovedSaveSession() {
    Map<String, Object> rt = new HashMap<String, Object>();
    String key = Struts2Util.getParameter("priceId");
    String approved = Struts2Util.getParameter("approved");
    String groupApproved = Struts2Util.getParameter("groupApproved");
    String approvedReason = Struts2Util.getParameter("approvedReason");
    String oldVal = Struts2Util.getParameter("oldPriceApproved");
    ServicePriceDTO dto = new ServicePriceDTO();
    if (key == null) {
      key = Struts2Util.getParameter("subPriceId");
      if (key != null) {
        dto.setPriceId(Integer.valueOf(key));
        dto.setServiceSubPriceApprove(Double.valueOf(approved));
        dto.setServicePriceReason(approvedReason);
        dto.setServicePriceOldVal(Double.valueOf(oldVal));
        SessionUtil.updateOneRow(
            SessionPdtServ.ServiceSubPriceApproved.value(), sessionServiceId, key, dto);
        rt.put("key", key);
      }
    } else {
      dto.setPriceId(Integer.valueOf(key));
      if (groupApproved != null && !groupApproved.equals("")) {
        dto.setServiceRuleGroupPriceApprove(Integer.valueOf(groupApproved));
      }
      if (approved != null && !approved.equals("")) {
        dto.setServicePriceApprove(Double.valueOf(approved));
      }
      dto.setServicePriceReason(approvedReason);
      if (oldVal != null && !oldVal.equals("")) {
        dto.setServicePriceOldVal(Double.valueOf(oldVal));
      } else {
        dto.setServicePriceOldVal(Double.valueOf(0));
      }

      SessionUtil.updateOneRow(
          SessionPdtServ.ServicePriceApproved.value(), sessionServiceId, key, dto);
      rt.put("key", key);
    }

    rt.put("message", SUCCESS);
    Struts2Util.renderJson(rt);
    return null;
  }
Exemplo n.º 6
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";
  }
Exemplo n.º 7
0
 public String delete() throws Exception {
   String ids = Struts2Util.getParameter("invoiceIds");
   Struts2Util.getRequest().setAttribute("invoiceIds", ids);
   return "delete_invoice_page";
 }