Selaa lähdekoodia

评估、财务的发票收款调整

lizhenhao 2 vuotta sitten
vanhempi
commit
66b770d508

+ 53 - 17
src/views/modules/cw/invoice/InvoiceForm.vue

@@ -637,7 +637,10 @@
           workAttachmentDtoList: [],
           financeInvoiceDetailDTOList: [],
           financeInvoiceReceivablesDTOList: [],
-          financeInvoiceInvalidDTO: {}
+          financeInvoiceInvalidDTO: {},
+          receivablesDate: '',
+          receivablesStatus: '',
+          isReceivables: ''
         },
         programRow: '',
         bankList: [],
@@ -722,7 +725,10 @@
             invalidStatus: '',
             invoiceId: '',
             remarks: ''
-          }
+          },
+          receivablesDate: '',
+          receivablesStatus: '',
+          isReceivables: ''
         }
         this.inputForm.id = id
         this.visible = true
@@ -811,20 +817,48 @@
           return
         }
         if (this.receivablesFlag === true) {
-          this.inputForm.financeInvoiceReceivablesDTOList.forEach((item, index) => {
-            if (this.commonJS.isEmpty(item.remittanceUnit)) {
-              this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款单位” 为空,请重新输入')
-              throw new Error()
-            }
-            if (this.commonJS.isEmpty(item.remittanceAmount) || item.remittanceAmount === 0 || item.remittanceAmount === '0') {
-              this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款金额” 为空,请重新输入')
-              throw new Error()
-            }
-            if (this.commonJS.isEmpty(item.remittanceDate)) {
-              this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款时间” 为空,请重新输入')
-              throw new Error()
+          this.inputForm.isReceivables = '1' // 当前的页面为收款页面时,将isReceivables赋值为:1,后端接收到isReceivables值为1时,则判定当前页面为收款页面
+          if (this.commonJS.isNotEmpty(this.inputForm.financeInvoiceReceivablesDTOList)) {
+            let allNumber = 0 // 获取收款明细中的总金额
+            this.inputForm.financeInvoiceReceivablesDTOList.forEach((item, index) => {
+              if (this.commonJS.isEmpty(item.remittanceUnit)) {
+                this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款单位” 为空,请重新输入')
+                throw new Error()
+              }
+              if (this.commonJS.isEmpty(item.remittanceAmount) || item.remittanceAmount === 0 || item.remittanceAmount === '0') {
+                this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款金额” 为空,请重新输入')
+                throw new Error()
+              } else {
+                allNumber = parseFloat(parseFloat(allNumber) + parseFloat(item.remittanceAmount))
+              }
+              if (this.commonJS.isEmpty(item.remittanceDate)) {
+                this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款时间” 为空,请重新输入')
+                throw new Error()
+              } else {
+                // this.inputForm.receivablesDate 是发票的收款时间
+                if (index === 0) {
+                  this.inputForm.receivablesDate = item.remittanceDate
+                } else {
+                  if (item.remittanceDate > this.inputForm.receivablesDate) {
+                    this.inputForm.receivablesDate = item.remittanceDate
+                  }
+                }
+              }
+            })
+            if (parseFloat(this.inputForm.account) < parseFloat(allNumber)) {
+              this.$message.warning('收款明细的总金额不能超过发票总金额,请重新输入')
+              throw new Error('收款明细的总金额不能超过发票总金额,请重新输入')
             }
-          })
+          }
+          if (this.commonJS.isNotEmpty(this.inputForm.financeInvoiceReceivablesDTOList)) {
+            // 如果收款明细中的数据不是空,则将是否收款的状态改为部分收款
+            this.inputForm.receivablesStatus = '2'
+          } else {
+            // 如果收款明细中的数据是空,则将是否收款的状态改为未收款
+            this.inputForm.receivablesStatus = '0'
+            // 如果收款明细中的数据是空,则将收款日期置空
+            this.inputForm.receivablesDate = ''
+          }
         }
         this.$refs['inputForm'].validate((valid) => {
           if (valid) {
@@ -882,7 +916,10 @@
           workAttachmentDtoList: [],
           financeInvoiceDetailDTOList: [],
           financeInvoiceReceivablesDTOList: [],
-          financeInvoiceInvalidDTO: {}
+          financeInvoiceInvalidDTO: {},
+          receivablesDate: '',
+          receivablesStatus: '',
+          isReceivables: ''
         }
         this.bankList = []
         this.detailFlag = false
@@ -1135,7 +1172,6 @@
         }
       },
       async beforeUploadDetailCode (file) {
-        console.log('110', this.inputForm.taxpayerIdentificationNo)
         await this.checkIdentificationNo()
         const formBody = new FormData()
         formBody.append('file', file.raw)

+ 2 - 2
src/views/modules/cw/invoice/InvoiceList.vue

@@ -710,7 +710,7 @@
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          let param = {id: row.id, receivablesStatus: '1', receivablesDate: this.moment(new Date()).format('YYYY-MM-DD')}
+          let param = {id: row.id, receivablesStatus: '1'}
           this.financeInvoiceService.isReceivables(param).then(({data}) => {
             this.$message.success(data)
             this.refreshList()
@@ -723,7 +723,7 @@
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          let param = {id: row.id, receivablesStatus: '0', receivablesDate: this.moment(new Date()).format('YYYY-MM-DD')}
+          let param = {id: row.id, receivablesStatus: '0'}
           this.financeInvoiceService.isReceivables(param).then(({data}) => {
             this.$message.success(data)
             this.refreshList()

+ 53 - 17
src/views/modules/finance/invoice/InvoiceForm.vue

@@ -635,7 +635,10 @@
           workAttachmentDtoList: [],
           financeInvoiceDetailDTOList: [],
           financeInvoiceReceivablesDTOList: [],
-          financeInvoiceInvalidDTO: {}
+          financeInvoiceInvalidDTO: {},
+          receivablesDate: '',
+          receivablesStatus: '',
+          isReceivables: ''
         },
         programRow: '',
         bankList: [],
@@ -720,7 +723,10 @@
             invalidStatus: '',
             invoiceId: '',
             remarks: ''
-          }
+          },
+          receivablesDate: '',
+          receivablesStatus: '',
+          isReceivables: ''
         }
         this.inputForm.id = id
         this.visible = true
@@ -801,20 +807,48 @@
           return
         }
         if (this.receivablesFlag === true) {
-          this.inputForm.financeInvoiceReceivablesDTOList.forEach((item, index) => {
-            if (this.commonJS.isEmpty(item.remittanceUnit)) {
-              this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款单位” 为空,请重新输入')
-              throw new Error()
-            }
-            if (this.commonJS.isEmpty(item.remittanceAmount) || item.remittanceAmount === 0 || item.remittanceAmount === '0') {
-              this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款金额” 为空,请重新输入')
-              throw new Error()
-            }
-            if (this.commonJS.isEmpty(item.remittanceDate)) {
-              this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款时间” 为空,请重新输入')
-              throw new Error()
+          this.inputForm.isReceivables = '1' // 当前的页面为收款页面时,将isReceivables赋值为:1,后端接收到isReceivables值为1时,则判定当前页面为收款页面
+          if (this.commonJS.isNotEmpty(this.inputForm.financeInvoiceReceivablesDTOList)) {
+            let allNumber = 0 // 获取收款明细中的总金额
+            this.inputForm.financeInvoiceReceivablesDTOList.forEach((item, index) => {
+              if (this.commonJS.isEmpty(item.remittanceUnit)) {
+                this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款单位” 为空,请重新输入')
+                throw new Error()
+              }
+              if (this.commonJS.isEmpty(item.remittanceAmount) || item.remittanceAmount === 0 || item.remittanceAmount === '0') {
+                this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款金额” 为空,请重新输入')
+                throw new Error()
+              } else {
+                allNumber = parseFloat(parseFloat(allNumber) + parseFloat(item.remittanceAmount))
+              }
+              if (this.commonJS.isEmpty(item.remittanceDate)) {
+                this.$message.warning('收款明细中第 ' + (index + 1) + ' 条数据的 “汇款时间” 为空,请重新输入')
+                throw new Error()
+              } else {
+                // this.inputForm.receivablesDate 是发票的收款时间
+                if (index === 0) {
+                  this.inputForm.receivablesDate = item.remittanceDate
+                } else {
+                  if (item.remittanceDate > this.inputForm.receivablesDate) {
+                    this.inputForm.receivablesDate = item.remittanceDate
+                  }
+                }
+              }
+            })
+            if (parseFloat(this.inputForm.account) < parseFloat(allNumber)) {
+              this.$message.warning('收款明细的总金额不能超过发票总金额,请重新输入')
+              throw new Error('收款明细的总金额不能超过发票总金额,请重新输入')
             }
-          })
+          }
+          if (this.commonJS.isNotEmpty(this.inputForm.financeInvoiceReceivablesDTOList)) {
+            // 如果收款明细中的数据不是空,则将是否收款的状态改为部分收款
+            this.inputForm.receivablesStatus = '2'
+          } else {
+            // 如果收款明细中的数据是空,则将是否收款的状态改为未收款
+            this.inputForm.receivablesStatus = '0'
+            // 如果收款明细中的数据是空,则将收款日期置空
+            this.inputForm.receivablesDate = ''
+          }
         }
         this.$refs['inputForm'].validate((valid) => {
           if (valid) {
@@ -872,7 +906,10 @@
           workAttachmentDtoList: [],
           financeInvoiceDetailDTOList: [],
           financeInvoiceReceivablesDTOList: [],
-          financeInvoiceInvalidDTO: {}
+          financeInvoiceInvalidDTO: {},
+          receivablesDate: '',
+          receivablesStatus: '',
+          isReceivables: ''
         }
         this.bankList = []
         this.detailFlag = false
@@ -1125,7 +1162,6 @@
         }
       },
       async beforeUploadDetailCode (file) {
-        console.log('110', this.inputForm.taxpayerIdentificationNo)
         await this.checkIdentificationNo()
         const formBody = new FormData()
         formBody.append('file', file.raw)

+ 2 - 2
src/views/modules/finance/invoice/InvoiceList.vue

@@ -702,7 +702,7 @@
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          let param = {id: row.id, receivablesStatus: '1', receivablesDate: this.moment(new Date()).format('YYYY-MM-DD')}
+          let param = {id: row.id, receivablesStatus: '1'}
           this.financeInvoiceService.isReceivables(param).then(({data}) => {
             this.$message.success(data)
             this.refreshList()
@@ -758,7 +758,7 @@
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          let param = {id: row.id, receivablesStatus: '0', receivablesDate: this.moment(new Date()).format('YYYY-MM-DD')}
+          let param = {id: row.id, receivablesStatus: '0'}
           this.financeInvoiceService.isReceivables(param).then(({data}) => {
             this.$message.success(data)
             this.refreshList()