Ver código fonte

订单凭证生成时增加sourcenote

hu 2 anos atrás
pai
commit
58487d90ab

+ 15 - 14
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -1174,7 +1174,7 @@ public class Order extends Controller {
 
             } else {
                 if (Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
-                    CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单提交", "由" + sonum + "订单提交时自动产生");
+                    CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单提交",sonum, "由" + sonum + "订单提交时自动产生");
                     sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
                 } else {
                     return getErrReturnObject().setErrMsg("账户余额不足").toString();
@@ -1224,7 +1224,7 @@ public class Order extends Controller {
         //金额=金额-返利金金额
         BigDecimal amount = beans.order.Order.getAmount(this, sa_orderid);
         //创建支出凭证
-        CashbillEntity entity = getCashbillEntity(amount, sa_orderid, source, "由" + sonum + source + "时自动产生");
+        CashbillEntity entity = getCashbillEntity(amount, sa_orderid, source,sonum, "由" + sonum + source + "时自动产生");
         sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
         //创建返利金支出凭证
         Rows cashbillRows = dbConnect.runSqlQuery("SELECT * from sa_cashbill WHERE class='返利金' and STATUS ='审核' and rebate_enddate>=CURRENT_TIME and rebate_balance>0 and sys_enterpriseid= " + pay_enterpriseid + " and siteid = '" + siteid + "'  ORDER BY  rebate_enddate ");
@@ -1240,7 +1240,7 @@ public class Order extends Controller {
 
             //返利代金券小于返利金金额,例如:rebate_balance:10,rebateamount:50
             if (rebate_balance.compareTo(rebateamount) == -1) {
-                entity2 = getCashbillEntity(rebate_balance, sa_orderid, source, "【返利金】由" + sonum + source + "时自动产生");
+                entity2 = getCashbillEntity(rebate_balance, sa_orderid, source,sonum, "【返利金】由" + sonum + source + "时自动产生");
                 rebateamount = rebateamount.subtract(rebate_balance);
                 rebate_balance = BigDecimal.ZERO;
 
@@ -1248,14 +1248,14 @@ public class Order extends Controller {
             }
             //返利代金券等于返利金金额
             if (rebate_balance.compareTo(rebateamount) == 0) {
-                entity2 = getCashbillEntity(rebate_balance, sa_orderid, source, "【返利金】由" + sonum + source + "时自动产生");
+                entity2 = getCashbillEntity(rebate_balance, sa_orderid, source,sonum, "【返利金】由" + sonum + source + "时自动产生");
                 rebateamount = BigDecimal.ZERO;
                 rebate_balance = BigDecimal.ZERO;
 
             }
             //返利代金券大于返利金金额
             if (rebate_balance.compareTo(rebateamount) == 1) {
-                entity2 = getCashbillEntity(rebateamount, sa_orderid, source, "【返利金】由" + sonum + source + "时自动产生");
+                entity2 = getCashbillEntity(rebateamount, sa_orderid, source,sonum, "【返利金】由" + sonum + source + "时自动产生");
                 rebate_balance = rebate_balance.subtract(rebateamount);
                 rebateamount = BigDecimal.ZERO;
 
@@ -1336,7 +1336,7 @@ public class Order extends Controller {
 
             } else {
                 if (Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
-                    CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单审核", "由" + sonum + "订单审核时自动产生");
+                    CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "订单审核",sonum, "由" + sonum + "订单审核时自动产生");
                     sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
                 } else {
                     return getErrReturnObject().setErrMsg("账户余额不足").toString();
@@ -1400,7 +1400,7 @@ public class Order extends Controller {
         //订单扣款节点(1:订单提交、2:订单审核)
         String order_paymentnode = Parameter.get(siteid, "order_paymentnode");
         if (order_paymentnode.equals("2")) {
-            sqlList.addAll(returnPayBill(row, "订单反审核", "由" + sonum + "订单反审核时自动产生"));
+            sqlList.addAll(returnPayBill(row, "订单反审核", sonum,"由" + sonum + "订单反审核时自动产生"));
         }
 
 
@@ -1599,7 +1599,7 @@ public class Order extends Controller {
 //            sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
 //        }
 
-        sqlList.addAll(returnPayBill(row, "订单退回", "由" + sonum + "订单退回时自动产生"));
+        sqlList.addAll(returnPayBill(row, "订单退回", sonum,"由" + sonum + "订单退回时自动产生"));
 
         String message = "您的订单【" + sonum + "】 金额为【" + amount + "】 已退回,退回原因【" + content.getStringValue("backreason") + "】,请注意查看";
 
@@ -1662,7 +1662,7 @@ public class Order extends Controller {
         }
 
 
-        sqlList.addAll(returnPayBill(row, "订单撤回", "由" + sonum + "订单撤回时自动产生"));
+        sqlList.addAll(returnPayBill(row, "订单撤回", sonum,"由" + sonum + "订单撤回时自动产生"));
 
         String message = "您的订单【" + sonum + "】 金额为【" + amount + "】 已撤回!";
 
@@ -1788,7 +1788,7 @@ public class Order extends Controller {
         //订单扣款节点(1:订单提交、2:订单审核)
         String order_paymentnode = Parameter.get(siteid, "order_paymentnode");
         if (order_paymentnode.equals("2")) {
-            sqlList.addAll(returnPayBill(row, "订单_交期撤回", "由" + sonum + "订单交期撤回时自动产生"));
+            sqlList.addAll(returnPayBill(row, "订单_交期撤回",sonum, "由" + sonum + "订单交期撤回时自动产生"));
         }
 
         sqlList.add(DataContrlLog.createLog(this, "sa_order", sa_orderid, "订单交期撤回", "订单交期撤回:" + amount).getSQL());
@@ -1798,7 +1798,7 @@ public class Order extends Controller {
     }
 
 
-    public ArrayList<String> returnPayBill(Row orderrow, String source, String remarks) throws YosException {
+    public ArrayList<String> returnPayBill(Row orderrow, String source,String sourcenote, String remarks) throws YosException {
         Long sa_orderid = orderrow.getLong("sa_orderid");
         Long sa_accountclassid = orderrow.getLong("sa_accountclassid");
         //验证结算企业
@@ -1812,7 +1812,7 @@ public class Order extends Controller {
                 amount = rebateRow.getBigDecimal("amount");
                 if (amount.compareTo(BigDecimal.ZERO) > 0) {
                     Long sa_cashbillid_rebate = rebateRow.getLong("sa_cashbillid_rebate");
-                    CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, source, "【返利金】" + remarks);
+                    CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, source,sourcenote, "【返利金】" + remarks);
                     sqlList.addAll(beans.order.Order.createRebateBillPay(this, entity, pay_enterpriseid, sa_cashbillid_rebate));
                 }
             }
@@ -1824,7 +1824,7 @@ public class Order extends Controller {
         if (amountRows.isNotEmpty()) {
             amount = amountRows.get(0).getBigDecimal("amount");
             if (amount.compareTo(BigDecimal.ZERO) > 0) {
-                CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, source, remarks);
+                CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, source,sourcenote, remarks);
                 sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
             }
         }
@@ -2497,13 +2497,14 @@ public class Order extends Controller {
      * @return
      * @throws YosException
      */
-    public CashbillEntity getCashbillEntity(BigDecimal amount, Long ownerid, String source, String remarks) throws YosException {
+    public CashbillEntity getCashbillEntity(BigDecimal amount, Long ownerid, String source, String sourcenote, String remarks) throws YosException {
         CashbillEntity entity = new CashbillEntity();
         entity.setAmount(amount);
         entity.setOwnerid(ownerid);
         entity.setOwnertable("sa_order");
         entity.setSource(source);
         entity.setRemarks(remarks);
+        entity.setSourcenote(sourcenote);
         return entity;
 
     }