Browse Source

销售出库单判断金额为0不生成支出凭证

hu 4 months ago
parent
commit
aa9c751788
1 changed files with 13 additions and 6 deletions
  1. 13 6
      src/custom/beans/stockbill/bills/XSCK.java

+ 13 - 6
src/custom/beans/stockbill/bills/XSCK.java

@@ -127,8 +127,9 @@ public class XSCK extends BasicBill {
                 if (order_paymentnode.equals("3")) {
                     CashbillEntity entity = getCashbillEntity(billRow.getBigDecimal("payamount"), billRow.getBigDecimal("paydiscountamount"), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成","货款");
                     JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
-                    sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
-
+                    if(!(billRow.getBigDecimal("payamount").compareTo(BigDecimal.ZERO)==0 && billRow.getBigDecimal("paydiscountamount").compareTo(BigDecimal.ZERO)==0)){
+                        sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    }
                 }
                 Rows rowsDispatchDetailGroup = dbConnect.runSqlQuery("select sum(t1.qty) qty,t1.sa_orderitemsid,t1.siteid from st_stockbill_items t1  where t1.sa_orderitemsid>0 and t1.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
                 for (Row row : rowsDispatchDetailGroup) {
@@ -183,7 +184,10 @@ public class XSCK extends BasicBill {
                 if (order_paymentnode.equals("3")) {
                     CashbillEntity entity = getCashbillEntity(billRow.getBigDecimal("payamount").negate(), billRow.getBigDecimal("paydiscountamount").negate(), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成","货款");
                     JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
-                    sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    if(!(billRow.getBigDecimal("payamount").compareTo(BigDecimal.ZERO)==0 && billRow.getBigDecimal("paydiscountamount").compareTo(BigDecimal.ZERO)==0)){
+                        sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    }
+
                 }
                 if(!billRow.getString("sourceobject").equals("tpartreimbursement")){
                     Rows rowsOrderDetail = dbConnect.runSqlQuery("select t1.undeliqty,t1.deliedqty,t1.qty,t1.sa_orderitemsid from sa_orderitems t1 where t1.sa_orderitemsid in (select sa_orderitemsid from st_stockbill_items where sa_orderitemsid>0 and st_stockbillid=" + st_stockbillid + ")");
@@ -243,8 +247,9 @@ public class XSCK extends BasicBill {
                     Rows cashbillRows =dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid="+st_stockbillid +" and ownertable='st_stockbill' and type=0 and class='货款'");
                     CashbillEntity entity = getCashbillEntity(cashbillRows.sum("amount").negate(), cashbillRows.sum("discountamount").negate(), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成","货款");
                     JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
-                    sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
-
+                    if(!(cashbillRows.sum("amount").negate().compareTo(BigDecimal.ZERO)==0 && cashbillRows.sum("discountamount").negate().compareTo(BigDecimal.ZERO)==0)){
+                        sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    }
                 }
                 Rows rowsOrderDetail = dbConnect.runSqlQuery("select t1.undeliqty,t1.deliedqty,t1.qty,t1.sa_orderitemsid from sa_orderitems t1 where t1.sa_orderitemsid in (select sa_orderitemsid from st_stockbill_items where sa_orderitemsid>0 and st_stockbillid=" + st_stockbillid + ")");
                 RowsMap rowsMap = rowsOrderDetail.toRowsMap("sa_orderitemsid");
@@ -273,7 +278,9 @@ public class XSCK extends BasicBill {
                     Rows cashbillRows =dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid="+st_stockbillid +" and ownertable='st_stockbill' and type=0 and class='货款'");
                     CashbillEntity entity = getCashbillEntity(cashbillRows.sum("amount").negate(), cashbillRows.sum("discountamount").negate(), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成","货款");
                     JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
-                    sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    if(!(cashbillRows.sum("amount").negate().compareTo(BigDecimal.ZERO)==0 && cashbillRows.sum("discountamount").negate().compareTo(BigDecimal.ZERO)==0)){
+                        sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    }
 
                 }
                 if(!billRow.getString("sourceobject").equals("tpartreimbursement")){