Browse Source

项目开票相关修改

chenjun 10 months ago
parent
commit
0305e597f2

+ 3 - 0
zjugis-business/src/main/java/com/zjugis/business/service/impl/ProjectServiceImpl.java

@@ -333,6 +333,9 @@ public class ProjectServiceImpl implements ProjectService {
         child.setXmzt(parent.getXmzt());
         child.setFlowStatus(FlowStatusConstants.FLOW_CHILD);
         child.setLxsj(LocalDate.now());
+        child.setHyId(parent.getHyId());
+        child.setXsryId(parent.getXsryId());
+        child.setXsry(parent.getXsry());
         int res = projectMapper.insert(child);
         if(res > 0){
             contractService.updateChildContract(child);

+ 32 - 0
zjugis-business/src/main/resources/templates/FlowContractInvoice/js/apply.js

@@ -158,6 +158,38 @@
             all({success: false});
             return;
         }
+        let allInvoiceAmount = 0;
+        for (let key of Object.keys(postData)) {
+            let mealName = postData[key];
+            if (key.startsWith("Contract")) {
+                allInvoiceAmount += Number(mealName.invoiceAmount);
+            }
+        }
+        if(Number(postData.contractInvoice.invoiceAmount) != Number(allInvoiceAmount)){
+            all({success: false, errorMsg: "开票金额与所有项目开票金额之和不相等!"});
+            return;
+        }
+        for (let key of Object.keys(postData)) {
+            let mealName = postData[key];
+            if (key.startsWith("Contract")) {
+                z.ui.ajax({
+                    url: z.ui.comm.getEntranceUrl("/contract-invoice-relation"),
+                    type: 'put',
+                    contentType: 'application/json',
+                    data: JSON.stringify({
+                        'id': mealName.id,
+                        'returnAmount': mealName.returnAmount,
+                        'invoiceAmount': mealName.invoiceAmount
+                    }),
+                    success: function (res) {
+
+                    },
+                    error: function () {
+
+                    }
+                })
+            }
+        }
         z.ui.ajax({
             url: z.ui.comm.getEntranceUrl("/flow/invoice/update"),
             data: z.ui.form.childStringify(postData),