Bläddra i källkod

发票-添加红冲原因

huangguoce 2 månader sedan
förälder
incheckning
fc4cfcfd99
2 ändrade filer med 85 tillägg och 17 borttagningar
  1. 43 14
      src/views/cw/invoice/InvoiceFormTask.vue
  2. 42 3
      src/views/finance/invoice/InvoiceFormTask.vue

+ 43 - 14
src/views/cw/invoice/InvoiceFormTask.vue

@@ -313,6 +313,7 @@
 							{{ item.label }}</el-radio>
 					</el-form-item>
 				</el-col>
+
 				<el-col :span="12" v-if="inputForm.redInvoiceFlag === '1'">
 					<el-form-item label="是否关联发票" prop="relatedInvoice" :rules="[
 						{ required: true, message: '是否关联发票', trigger: 'blur' }
@@ -323,6 +324,16 @@
 							{{ item.label }}</el-radio>
 					</el-form-item>
 				</el-col>
+				<el-col :span="12" v-if="inputForm.redInvoiceFlag === '1' && inputForm.relatedInvoice === '1'">
+					<el-form-item label="红冲原因" prop="redFlushReason" :rules="[
+						{ required: true, message: '红冲原因不能为空', trigger: 'blur' }
+					]">
+						<el-radio-group v-model="inputForm.redFlushReason">
+							<el-radio label="01" size="large">开票有误</el-radio>
+							<el-radio label="04" size="large">销售折让</el-radio>
+						</el-radio-group>
+					</el-form-item>
+				</el-col>
 				<el-col :span="24" v-if="inputForm.redInvoiceFlag === '1' && inputForm.relatedInvoice === '0'">
 					<el-form-item label="红冲情况说明" prop="situationDetail" :rules="[
 						{ required: true, message: '红冲情况说明不能为空', trigger: 'blur' }
@@ -846,6 +857,7 @@ export default {
 				checkType: '',
 				programId: '',
 				accountTotal: '',//发票汇总金额
+				originalAccount: '',//原发票金额
 				id: '',
 				financeInvoiceBaseDTOList: [],
 				programName: '',
@@ -894,6 +906,7 @@ export default {
 				procDefId: '',
 				procDefKey: '',
 				redInvoiceFlag: '0',	//是否红字发票
+				redFlushReason: '',	//红冲原因
 				redInvoiceRelevancyNumber: '',	//红字发票编号
 				invoiceNumberStr: '',	//红字发票号
 				redInvoiceRelevancyId: '',	//红字发票id
@@ -979,6 +992,7 @@ export default {
 			this.inputForm = {
 				checkType: '',
 				accountTotal: '',//发票汇总金额
+				originalAccount: '',//原发票金额
 				id: '',
 				financeInvoiceBaseDTOList: [],
 				programName: '',
@@ -1030,6 +1044,7 @@ export default {
 				tenantId: '',
 				actualDrawerEmailAddress: '',
 				redInvoiceFlag: '0',
+				redFlushReason: '',	//红冲原因
 				redInvoiceRelevancyNumber: '',	//红字发票编号
 				invoiceNumberStr: '',	//红字发票号
 				redInvoiceRelevancyId: '',	//红字发票id
@@ -1097,6 +1112,9 @@ export default {
 					if (this.commonJS.isEmpty(this.inputForm.redInvoiceFlag)) {
 						this.inputForm.redInvoiceFlag = '0'
 					}
+					if (this.commonJS.isEmpty(this.inputForm.redFlushReason)) {
+						this.inputForm.redFlushReason = '01'
+					}
 
 					if (this.commonJS.isEmpty(this.inputForm.relatedInvoice)) {
 						this.inputForm.relatedInvoice = '1'
@@ -1110,12 +1128,10 @@ export default {
 					if (this.commonJS.isEmpty(this.inputForm.billingPeopleId)) {
 						this.inputForm.billingPeopleId = this.$store.state.user.id
 					}
-					console.log('billingPeopleReal', this.inputForm.billingPeopleReal)
 					if (this.commonJS.isEmpty(this.inputForm.billingPeopleReal)) {
 						this.inputForm.billingPeopleReal = this.$store.state.user.id
 						this.inputForm.billingPeopleRealName = this.$store.state.user.name
 					}
-					console.log('reconciliationPeople', this.inputForm.reconciliationPeople)
 					if (this.commonJS.isEmpty(this.inputForm.reconciliationPeople)) {
 						this.inputForm.reconciliationPeople = this.$store.state.user.id
 						this.inputForm.reconciliationPeopleName = this.$store.state.user.name
@@ -1188,10 +1204,12 @@ export default {
 					this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachmentDtoList, 'invoice')
 					this.$refs.uploadComponentSignContract.newUpload(method, this.inputForm.workAttachmenSignContract, 'signContract')
 
+					if (this.commonJS.isNotEmpty(this.inputForm.originalAccount)) {
+						this.inputForm.originalAccount = -Math.abs(this.inputForm.originalAccount)
+					}
+
 					//针对红冲处理
 					if (redInvoice == "1") {
-						console.log("我再红冲");
-
 						this.inputForm.redInvoiceRelevancyId = this.inputForm.id
 						this.inputForm.redInvoiceRelevancyNumber = this.inputForm.no
 						this.inputForm.invoiceNumberStr = this.inputForm.financeInvoiceDetailDTOList[0].number
@@ -1209,8 +1227,10 @@ export default {
 						this.inputForm.id = ''
 						this.$nextTick(() => {
 							this.inputForm.redInvoiceFlag = '1';
+							this.inputForm.redFlushReason = '01';
 							this.inputForm.relatedInvoice = '1';
 							this.inputForm.accountTotal = -Math.abs(this.inputForm.accountTotal);
+							this.inputForm.originalAccount = -Math.abs(this.inputForm.accountTotal);
 						})
 						this.inputForm.financeInvoiceDetailDTOList = []
 						this.inputForm.no = ""
@@ -1245,7 +1265,6 @@ export default {
 			}
 		},
 		async agreeForm(callback) {
-			console.log('进入方法')
 			this.loading = true
 			await financeInvoiceService.queryById(this.inputForm.id).then((data) => {
 				if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
@@ -1368,6 +1387,24 @@ export default {
 				}
 			}
 
+			if (this.inputForm.redInvoiceFlag === '1' && this.inputForm.relatedInvoice === '1') {
+				if (this.inputForm.redFlushReason === "01") {
+					if (-Math.abs(this.inputForm.originalAccount) != -Math.abs(this.inputForm.accountTotal)) {
+						this.loading = false
+						this.$message.error('发票金额必须和需要红冲的金额相同')
+						throw new Error()
+					}
+				}
+				if (this.inputForm.redFlushReason === "04") {
+					-14999 - 45000
+					if (-Math.abs(this.inputForm.originalAccount) >= -Math.abs(this.inputForm.accountTotal)) {
+						this.loading = false
+						this.$message.error('发票金额必须大于需要红冲的金额')
+						throw new Error()
+					}
+				}
+			}
+
 			if (this.commonJS.isNotEmpty(this.inputForm.financeInvoiceBaseDTOList)) {
 				let i = this.inputForm.financeInvoiceBaseDTOList.length
 				for (let j = 0; j < i; j++) {
@@ -1441,7 +1478,6 @@ export default {
 					throw new Error('开票时间不可以为空')
 				}
 			}
-			console.log('this.isPreInvoice', this.isPreInvoice)
 			if (this.commonJS.isNotEmpty(this.isPreInvoice) && this.isPreInvoice === '1') {
 				await processService.getByName('会计-预开票申请').then((data) => {
 					if (!this.commonJS.isEmpty(data.id)) {
@@ -1482,7 +1518,6 @@ export default {
 							}
 						}
 						this.inputForm.id = data.businessId
-						console.log('data22', data)
 						callback(data.businessTable, data.businessId, this.inputForm, data.recordType)
 						this.loading = false
 					}).catch(() => {
@@ -1567,7 +1602,6 @@ export default {
 					this.inputForm.financeInvoiceDetailDTOList.push(data)
 					this.detailKey = Math.random()
 				})
-				console.log('this.inputForm.financeInvoiceDetailDTOList', this.inputForm.financeInvoiceDetailDTOList)
 			}
 			if (type === 'receivables') {
 				this.$refs.receivablesTable.insert().then((data) => {
@@ -1591,7 +1625,6 @@ export default {
 			}
 		},
 		openProgramPageForm(rowIndex) {
-			console.log("进入openProgramPageForm方法")
 			if (this.commonJS.isEmpty(this.inputForm.financeInvoiceBaseDTOList[0].programName) || this.inputForm.financeInvoiceBaseDTOList.length === 1) {
 				this.$refs.programPageForm.init()
 			} else {
@@ -1604,8 +1637,6 @@ export default {
 			this.programRow = rowIndex
 		},
 		getProgram(rows, type) {
-			console.log('rows', rows)
-			console.log('type', type)
 			if (rows.length > 0) {
 				rows.forEach((item, index) => {
 					this.inputForm.programId = item.id
@@ -1719,10 +1750,10 @@ export default {
 			this.$refs.workInvoiceForm.init()
 		},
 		getWorkInvoice(row) {
-			console.log("getWorkInvoice", row)
 			this.inputForm.redInvoiceRelevancyNumber = row.no
 			this.inputForm.invoiceNumberStr = row.number
 			this.inputForm.redInvoiceRelevancyId = row.id
+			this.inputForm.originalAccount = row.account
 			this.$forceUpdate()
 		},
 		getWorkClient(row) {
@@ -2048,7 +2079,6 @@ export default {
 			this.$refs.userSelect1.init()
 		},
 		selectUser1(user) {
-			console.log(user[0].name)
 			this.inputForm.billingPeopleRealName = user[0].name
 			this.inputForm.billingPeopleReal = user[0].id
 		},
@@ -2056,7 +2086,6 @@ export default {
 			this.$refs.userSelect2.init()
 		},
 		selectUser2(user) {
-			console.log(user[0].name)
 			this.inputForm.reconciliationPeopleName = user[0].name
 			this.inputForm.reconciliationPeople = user[0].id
 		},

+ 42 - 3
src/views/finance/invoice/InvoiceFormTask.vue

@@ -291,6 +291,16 @@
               {{ item.label }}</el-radio>
           </el-form-item>
         </el-col>
+        <el-col :span="12" v-if="inputForm.redInvoiceFlag === '1' && inputForm.relatedInvoice === '1'">
+          <el-form-item label="红冲原因" prop="redFlushReason" :rules="[
+            { required: true, message: '红冲原因不能为空', trigger: 'blur' }
+          ]">
+            <el-radio-group v-model="inputForm.redFlushReason">
+              <el-radio label="01" size="large">开票有误</el-radio>
+              <el-radio label="04" size="large">销售折让</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
         <el-col :span="24" v-if="inputForm.redInvoiceFlag === '1' && inputForm.relatedInvoice === '0'">
           <el-form-item label="红冲情况说明" prop="situationDetail" :rules="[
             { required: true, message: '红冲情况说明不能为空', trigger: 'blur' }
@@ -712,6 +722,7 @@ export default {
         receivablesType: '2',
         billingContent: '',
         account: '',
+        originalAccount: '',//原发票金额
         billingContentTerms: '',
         billingPeople: this.$store.state.user.name,
         billingPeopleId: this.$store.state.user.id,
@@ -734,6 +745,7 @@ export default {
         isMultiple: '',
         actualDrawerEmailAddress: '',
         redInvoiceFlag: '0',	//是否红字发票
+        redFlushReason: '', //红冲原因
         redInvoiceRelevancyNumber: '',	//红字发票编号
         invoiceNumberStr: '',	//红字发票号
         redInvoiceRelevancyId: '',	//红字发票id
@@ -831,6 +843,7 @@ export default {
         receivablesType: '2',
         billingContent: '',
         account: '',
+        originalAccount: '',//原发票金额
         billingContentTerms: '',
         billingPeople: this.$store.state.user.name,
         billingPeopleId: this.$store.state.user.id,
@@ -858,6 +871,7 @@ export default {
         isMultiple: '',
         actualDrawerEmailAddress: '',
         redInvoiceFlag: '0',	//是否红字发票
+        redFlushReason: '', //红冲原因
         redInvoiceRelevancyNumber: '',	//红字发票编号
         invoiceNumberStr: '',	//红字发票号
         redInvoiceRelevancyId: '',	//红字发票id
@@ -912,6 +926,10 @@ export default {
           if (this.commonJS.isEmpty(this.inputForm.redInvoiceFlag)) {
             this.inputForm.redInvoiceFlag = '0'
           }
+          if (this.commonJS.isEmpty(this.inputForm.redFlushReason)) {
+            this.inputForm.redFlushReason = '01'
+          }
+
           if (this.commonJS.isEmpty(this.inputForm.relatedInvoice)) {
             this.inputForm.relatedInvoice = '1'
           }
@@ -967,6 +985,10 @@ export default {
 
           this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachmentDtoList, 'invoice')
 
+
+          if (this.commonJS.isNotEmpty(this.inputForm.originalAccount)) {
+            this.inputForm.originalAccount = -Math.abs(this.inputForm.originalAccount)
+          }
           //针对红冲处理
           if (redInvoice == "1") {
             this.inputForm.redInvoiceRelevancyId = this.inputForm.id
@@ -984,6 +1006,7 @@ export default {
             this.inputForm.redInvoiceFlag = '1';
             this.inputForm.relatedInvoice = '1';
             this.inputForm.account = -Math.abs(this.inputForm.account);
+            this.inputForm.originalAccount = -Math.abs(this.inputForm.account);
             this.inputForm.financeInvoiceDetailDTOList = []
             this.inputForm.no = ""
             this.inputForm.billingPeople = ""
@@ -1081,6 +1104,24 @@ export default {
           }
         }
       }
+
+
+      if (this.inputForm.redInvoiceFlag === '1' && this.inputForm.relatedInvoice === '1') {
+        if (this.inputForm.redFlushReason === "01") {
+          if (-Math.abs(this.inputForm.originalAccount) != -Math.abs(this.inputForm.account)) {
+            this.loading = false
+            this.$message.error('发票金额必须和需要红冲的金额相同')
+            throw new Error()
+          }
+        }
+        if (this.inputForm.redFlushReason === "04") {
+          if (-Math.abs(this.inputForm.originalAccount) >= -Math.abs(this.inputForm.account)) {
+            this.loading = false
+            this.$message.error('发票金额必须大于需要红冲的金额')
+            throw new Error()
+          }
+        }
+      }
       //判断是否是红字发票
       if (this.inputForm.account > 0 && this.inputForm.redInvoiceFlag == '1') {
         this.loading = false
@@ -1636,7 +1677,6 @@ export default {
       this.$refs.userSelect1.init()
     },
     selectUser1(user) {
-      console.log(user[0].name)
       this.inputForm.billingPeopleRealName = user[0].name
       this.inputForm.billingPeopleReal = user[0].id
     },
@@ -1644,7 +1684,6 @@ export default {
       this.$refs.userSelect2.init()
     },
     selectUser2(user) {
-      console.log(user[0].name)
       this.inputForm.reconciliationPeopleName = user[0].name
       this.inputForm.reconciliationPeople = user[0].id
     },
@@ -1652,10 +1691,10 @@ export default {
       this.$refs.workInvoiceForm.init()
     },
     getWorkInvoice(row) {
-      console.log("getWorkInvoice", row)
       this.inputForm.redInvoiceRelevancyNumber = row.no
       this.inputForm.invoiceNumberStr = row.number
       this.inputForm.redInvoiceRelevancyId = row.id
+      this.inputForm.originalAccount = row.account
       this.$forceUpdate()
     },
     // 修改是否关联发票