Browse Source

生成收入凭证是否上传k3更新

hu 2 years ago
parent
commit
ae6965bdfd

+ 9 - 3
src/custom/beans/accountbalance/Accountbalance.java

@@ -97,7 +97,7 @@ public class Accountbalance extends BaseClass {
      * @return
      * @throws YosException
      */
-    public static ArrayList<String> createCashbillIncome(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
+    public static ArrayList<String> createCashbillIncome(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck,boolean isupdatek3flag) throws YosException {
         ArrayList<String> sqlList = new ArrayList<>();
         long sa_cashbillid = controller.createTableID("sa_cashbill");
         String billcode = controller.createBillCode("cashbill");
@@ -122,6 +122,11 @@ public class Accountbalance extends BaseClass {
         if (ischeck) {
             BigDecimal balance = BigDecimal.ZERO;  //当前账户余额
             sqlFactory.addParameter("status", "审核");
+            if(isupdatek3flag){
+                sqlFactory.addParameter("updatek3flag", "0");
+            }else{
+                sqlFactory.addParameter("updatek3flag", "");
+            }
             sqlFactory.addParameter("checkby", StringUtils.isBlank(controller.username)?"autocheck":controller.username);
             sqlFactory.addParameter_SQL("checkdate", "CURRENT_TIME");
 
@@ -163,6 +168,7 @@ public class Accountbalance extends BaseClass {
             sqlFactory.addParameter("status", "新建");
             sqlFactory.addParameter("checkby", "null");
             sqlFactory.addParameter("checkdate", "null");
+            sqlFactory.addParameter("updatek3flag", "");
             sqlFactory.addParameter("balance", 0);
         }
         sqlList.add(sqlFactory.getSQL());
@@ -332,8 +338,8 @@ public class Accountbalance extends BaseClass {
      */
     public static void createCashbillIncomeWithoutSQL(Controller controller, long sys_enterpriseid, long sa_accountclassid,
                                                       CashbillEntity cashbillEntity,
-                                                      boolean ischeck) throws YosException {
-        ArrayList<String> sqlList = createCashbillIncome(controller, sys_enterpriseid, sa_accountclassid, cashbillEntity, ischeck);
+                                                      boolean ischeck,boolean isupdatek3flag) throws YosException {
+        ArrayList<String> sqlList = createCashbillIncome(controller, sys_enterpriseid, sa_accountclassid, cashbillEntity, ischeck,isupdatek3flag);
         controller.dbConnect.runSqlUpdate(sqlList);
 
     }

+ 2 - 2
src/custom/beans/accountbalance/SQL/收支凭证新增.sql

@@ -1,4 +1,4 @@
 insert into sa_cashbill (siteid, sa_cashbillid, createuserid,createby, createdate, billno,changeuserid,changeby, changedate,checkby,checkdate,
-                                sys_enterpriseid, sa_accountclassid,type,remarks,amount,status,source,sourcenote,ownertable,ownerid,balance,sa_cashbillid_rebate,class,subclass,period)
+                                sys_enterpriseid, sa_accountclassid,type,remarks,amount,status,source,sourcenote,ownertable,ownerid,balance,sa_cashbillid_rebate,class,subclass,period,updatek3flag)
 values ($siteid$, $sa_cashbillid$,$userid$,$username$, CURRENT_TIME, $billno$,$userid$, $username$, CURRENT_TIME,$checkby$,$checkdate$,$sys_enterpriseid$,$sa_accountclassid$,$type$,$remarks$,
-        $amount$,$status$,$source$,$sourcenote$,$ownertable$,$ownerid$,$balance$,$sa_cashbillid_rebate$,$class$,$subclass$,current_date);
+        $amount$,$status$,$source$,$sourcenote$,$ownertable$,$ownerid$,$balance$,$sa_cashbillid_rebate$,$class$,$subclass$,current_date,$updatek3flag$);

+ 3 - 3
src/custom/restcontroller/webmanage/lsak3/stockbill/stockbill.java

@@ -219,7 +219,7 @@ public class stockbill extends Controller {
                         entity.setOwnertable("st_stockbill");
                         entity.setSource("");
                         entity.setRemarks("销售出库单" + fbillnum + "返利");
-                        sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true));
+                        sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true,false));
                     }
 
 
@@ -253,7 +253,7 @@ public class stockbill extends Controller {
                     entity.setOwnertable("st_stockbill");
                     entity.setSource("");
                     entity.setRemarks("销售出库单" + fbillnum + "反返利");
-                    sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true));
+                    sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true,false));
 
                     /**
                      * 更新发货单数量
@@ -295,7 +295,7 @@ public class stockbill extends Controller {
                     entity.setOwnertable("st_stockbill");
                     entity.setSource("");
                     entity.setRemarks("销售出库单" + fbillnum + "反返利");
-                    sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true));
+                    sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true,false));
                     /**
                      * 更新发货单数量
                      */

+ 1 - 1
src/custom/restcontroller/webmanage/sale/paybill/Paybill.java

@@ -266,7 +266,7 @@ public class Paybill extends Controller {
         for (Row row : accountclassRows) {
             BigDecimal amount = row.getBigDecimal("amount");
             CashbillEntity cashbillEntity = new CashbillEntity(amount, remarks, "打款凭证", billno, "sa_paybill", sa_paybillid, "货款", "");
-            sqlList = Accountbalance.createCashbillIncome(this, sys_enterpriseid, row.getLong("sa_accountclassid"), cashbillEntity, false);
+            sqlList = Accountbalance.createCashbillIncome(this, sys_enterpriseid, row.getLong("sa_accountclassid"), cashbillEntity, false,true);
             dbConnect.runSqlUpdate(sqlList);
 
             String message = "您的打款凭证已审核通过,【"+row.getString("accountname")+"】账户已成功充值【"+amount+"】元";

+ 1 - 1
src/custom/restcontroller/webmanage/sale/promotion/promotion.java

@@ -614,7 +614,7 @@ public class promotion extends Controller {
                entity.setSource("返利");
                entity.setSourcenote("经销商【"+agentnum+"】,【"+promotionauthRows.get(0).getString("promname")+"】方案返利促销");
                entity.setRemarks("【"+promotionauthRows.get(0).getString("promname")+"】方案返利促销");
-               sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid,sa_accountclassid,entity,true));
+               sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid,sa_accountclassid,entity,true,true));
                sqlList.add("update sa_promotion_auth set settlestatus=1 where sa_promotion_authid="+sa_promotion_authid+" and siteid='"+siteid+"'");
            }
         }

+ 5 - 5
src/custom/restcontroller/webmanage/sale/rebateaccount/rebateaccounthead.java

@@ -484,9 +484,9 @@ public class rebateaccounthead extends Controller {
                     entity.setOwnerid(row.getLong("sa_rebateaccountid"));
                     entity.setOwnertable("sa_rebateaccount");
                     entity.setSource("返利");
-                    entity.setSourcenote(row.getString("billno")+"结算单返利");
-                    entity.setRemarks(row.getString("billno")+"结算单装修补贴返利");
-                    sqlList.addAll(Accountbalance.createCashbillIncome(this, row.getLong("sys_enterpriseid"),sa_accountclassid,entity,true));
+                    entity.setSourcenote(rows.get(0).getString("billno")+"结算单返利");
+                    entity.setRemarks(rows.get(0).getString("billno")+"结算单装修补贴返利");
+                    sqlList.addAll(Accountbalance.createCashbillIncome(this, row.getLong("sys_enterpriseid"),sa_accountclassid,entity,true,true));
                     sqlList.addAll(Accountbalance.rebateupdate(this, row.getLong("sys_enterpriseid"), true, row.getBigDecimal("approvedamount")));
                 }
 
@@ -499,9 +499,9 @@ public class rebateaccounthead extends Controller {
                     entity.setOwnerid(row.getLong("sa_rebateaccountid"));
                     entity.setOwnertable("sa_rebateaccount");
                     entity.setSource("返利");
-                    entity.setSourcenote(row.getString("billno")+"结算单反审核");
+                    entity.setSourcenote(rows.get(0).getString("billno")+"结算单反审核");
                     entity.setRemarks("装修补贴返利反审核生成");
-                    sqlList.addAll(Accountbalance.createCashbillIncome(this, row.getLong("sys_enterpriseid"),sa_accountclassid,entity,true));
+                    sqlList.addAll(Accountbalance.createCashbillIncome(this, row.getLong("sys_enterpriseid"),sa_accountclassid,entity,true,true));
                     sqlList.addAll(Accountbalance.rebateupdate(this, row.getLong("sys_enterpriseid"), false, row.getBigDecimal("approvedamount")));
                 }
 

+ 2 - 2
src/custom/restcontroller/webmanage/sale/stockbill/stockbill.java

@@ -185,7 +185,7 @@ public class stockbill extends Controller {
         entity.setOwnertable("st_stockbill");
         entity.setSource("");
         entity.setRemarks("销售出库单" + rows.get(0).getString("billno") + "返利");
-        sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true));
+        sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true,false));
 
         SQLFactory sqlFactoryupdate = new SQLFactory(this, "出入库单审核");
         sqlFactoryupdate.addParameter("siteid", siteid);
@@ -244,7 +244,7 @@ public class stockbill extends Controller {
         if (! Accountbalance.judgeBalance(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),rebateamount)) {
             return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(), rebateamount) + "元!").toString();
         }
-        sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true));
+        sqlList.addAll(Accountbalance.createCashbillIncome(this,sys_enterpriseid,Long.valueOf(icstockbillrebateaccount).longValue(),entity,true,false));
 
         SQLFactory sqlFactoryupdate = new SQLFactory(this, "出入库单反审核");
         sqlFactoryupdate.addParameter("siteid", siteid);

+ 2 - 2
src/custom/restcontroller/webmanage/sale/toolbill/ToolBill.java

@@ -587,7 +587,7 @@ public class ToolBill extends Controller {
 
         BigDecimal amount = getAmount(sa_orderid);
         CashbillEntity entity = getCashbillEntity(amount, sa_orderid, "押金收入凭证", "由" + sonum + "工具借用单审核时自动产生");
-        sqlList.addAll(Accountbalance.createCashbillIncome(this, pay_enterpriseid, sa_accountclassid, entity, true));
+        sqlList.addAll(Accountbalance.createCashbillIncome(this, pay_enterpriseid, sa_accountclassid, entity, true,false));
 
         //操作记录
         sqlList.add(DataContrlLog.createLog(this, "sa_order", sa_orderid, "审核", "工具借用单:审核" + sa_orderid).getSQL());
@@ -665,7 +665,7 @@ public class ToolBill extends Controller {
 
         BigDecimal amount = getAmount(sa_orderid);
         CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, "押金收入凭证", "由" + sonum + "工具借用反单审核时自动产生");
-        sqlList.addAll(Accountbalance.createCashbillIncome(this, pay_enterpriseid, sa_accountclassid, entity, true));
+        sqlList.addAll(Accountbalance.createCashbillIncome(this, pay_enterpriseid, sa_accountclassid, entity, true,false));
 
         //操作记录
         sqlList.add(DataContrlLog.createLog(this, "sa_order", sa_orderid, "反审核", "工具借用单:反审核" + sa_orderid).getSQL());

+ 2 - 2
src/custom/restcontroller/webmanage/sale/transferbill/Transferbill.java

@@ -119,9 +119,9 @@ public class Transferbill extends Controller {
         ArrayList<String> sqlList = new ArrayList<>();
         sqlList.add("update sa_transferbill set checkby='" + username + "',checkdate=current_date,status='审核' where siteid='" + siteid + "' and sa_transferbillid=" + sa_transferbillid);
         CashbillEntity cashbillEntity = new CashbillEntity(amount.negate(), "", "转账单", rows.get(0).getString("billno"), "sa_transferbill", sa_transferbillid,"货款","");
-        sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid, sa_accountclassid, cashbillEntity, true));
+        sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid, sa_accountclassid, cashbillEntity, true,false));
         cashbillEntity.setAmount(amount);
-        sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid, inaccountclassid, cashbillEntity, true));
+        sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid, inaccountclassid, cashbillEntity, true,false));
         dbConnect.runSqlUpdate(sqlList);
         return getSucReturnObject().toString();
     }