Browse Source

资金模块-调整核销单选择来源单据的条件

huangx 7 years ago
parent
commit
275bce98b4

+ 1 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -86,7 +86,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     BANK_AMOUNT_NOTENOUGH(74004, "资金账号不足"),
     SUBLEDGER_NOT_EXIS(74005,"来源单据不存在"),
     CHECK_SETACOUNT_EXIS(74006, "不能删除单据日期小于等于结账期间<u>%s</u>的单据"),
-    VERIFICATION_CHECK_BALANCE(74007,"保存失败,本次核销金额不相等!"),
+    VERIFICATION_CHECK_BALANCE(74007,"本次核销金额不相等!"),
     DELETE_NOT_EXIS(74008,"删除失败,当前单据不存在!"),
     DOCUMENTS_AUDITED(74009,"存在已审核单据:%S"),
     DOCUMENTS_UNAUDITED(74009,"存在未审核单据:%S"),

+ 21 - 9
frontend/saas-web/app/view/money/verification/FormPanel.js

@@ -590,18 +590,30 @@ Ext.define('saas.view.money.verification.FormPanel', {
         },
 
         defaultConditions: {
-            receipts_offset_receivable: ['ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)<>0 and ifnull(sl_namount,0)<>0',
+            receipts_offset_receivable: ['ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)<>0 and ifnull(sl_namount,0)<>0 ' +
+            ' and ((sl_kind=\'收款单\') or (sl_kind=\'期初余额\' and sl_ym=' +
+            '(select min(pd_detno) from periodsdetail  where pd_status=0 and periodsdetail.companyid=subledger.companyid)))',
                 'ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0 ' +
-                ' and sl_kind in (\'期初余额\',\'出货单\',\'销售退货单\')'],
-            prepaid_offset_payable: ['ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)<>0 and ifnull(sl_namount,0)<>0',
+                ' and (sl_kind in (\'出货单\',\'销售退货单\') or (sl_kind in (\'期初余额\') and sl_ym=' +
+                '(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid)))'],
+            prepaid_offset_payable: ['ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)<>0 and ifnull(sl_namount,0)<>0 ' +
+            ' and ((sl_kind=\'付款单\') or (sl_kind=\'期初余额\' and sl_ym=' +
+            '(select min(pd_detno) from periodsdetail  where pd_status=0 and periodsdetail.companyid=subledger.companyid)))',
                 'ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0' +
-                ' and sl_kind in (\'期初余额\',\'采购验收单\',\'采购验退单\')'],
-            receivable_offset_payable: ['ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0',
-                'ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0'],
+                ' and (sl_kind in (\'采购验收单\',\'采购验退单\') or (sl_kind in (\'期初余额\') and sl_ym=' +
+                '(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid)))'],
+            receivable_offset_payable: ['ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0 ' +
+            ' and ((sl_kind in (\'出货单\',\'销售退货单\')) or (sl_kind=\'期初余额\' and sl_ym=' +
+            '(select min(pd_detno) from periodsdetail  where pd_status=0 and periodsdetail.companyid=subledger.companyid)))',
+                'ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0' +
+                ' and (sl_kind in (\'采购验收单\',\'采购验退单\') or (sl_kind in (\'期初余额\') and sl_ym=' +
+                '(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid)))'],
             receivable_to_receivable: ['ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0 ' +
-            ' and sl_kind in (\'期初余额\',\'出货单\',\'销售退货单\')'],
-            payable_to_payable: ['ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0 ' +
-            ' and sl_kind in (\'期初余额\',\'采购验收单\',\'采购验退单\')']
+            ' and ((sl_kind in (\'出货单\',\'销售退货单\')) or (sl_kind=\'期初余额\' and sl_ym=' +
+            '(select min(pd_detno) from periodsdetail  where pd_status=0 and periodsdetail.companyid=subledger.companyid)))'],
+            payable_to_payable: ['ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0' +
+            ' and (sl_kind in (\'采购验收单\',\'采购验退单\') or (sl_kind in (\'期初余额\') and sl_ym=' +
+            '(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid)))']
         }
     },