From 440e3e8118df60fe9dbec6399d9f5a600b71d6c0 Mon Sep 17 00:00:00 2001
From: xxssyyyyssxx <xxssyyyyssxx@126.com>
Date: Mon, 22 Nov 2021 10:32:36 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=B0=8Fbug=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../static/assets/js/project_common.js        | 24 +++++--------------
 .../static/assets/js/project_estimate.js      | 19 +++++----------
 .../templates/admin/project_estimate_edit.ftl |  1 +
 .../templates/admin/project_list.ftl          | 10 ++++----
 4 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/src/main/resources/static/assets/js/project_common.js b/src/main/resources/static/assets/js/project_common.js
index e6bb101..5af16c7 100644
--- a/src/main/resources/static/assets/js/project_common.js
+++ b/src/main/resources/static/assets/js/project_common.js
@@ -131,15 +131,9 @@ function calCostInclude() {
 
     var $costTotalTaxInclude = $("input[name='costTotalTaxInclude']");
 
-    if(costPurchaseDeviceTaxInclude && costPurchaseBuildTaxInclude
-        && costPurchaseServiceTaxInclude && costPurchaseOtherTaxInclude
-        && costProjectManageTaxInclude && costOtherOtherTaxInclude){
-        $costTotalTaxInclude.val(f2(costPurchaseDeviceTaxInclude) +f2(costPurchaseBuildTaxInclude)
-            +f2(costPurchaseServiceTaxInclude)+f2(costPurchaseOtherTaxInclude)
-            +f2(costProjectManageTaxInclude)+f2(costOtherOtherTaxInclude));
-    }else {
-        $costTotalTaxInclude.val("");
-    }
+    $costTotalTaxInclude.val(f2(costPurchaseDeviceTaxInclude) +f2(costPurchaseBuildTaxInclude)
+        +f2(costPurchaseServiceTaxInclude)+f2(costPurchaseOtherTaxInclude)
+        +f2(costProjectManageTaxInclude)+f2(costOtherOtherTaxInclude));
 }
 /**
  * 统计成本(不含税),有一项没填就置空
@@ -155,13 +149,7 @@ function calCostExclude() {
 
     var $costTotalTaxExclude = $("input[name='costTotalTaxExclude']");
 
-    if(costPurchaseDeviceTaxExclude && costPurchaseBuildTaxExclude
-        && costPurchaseServiceTaxExclude && costPurchaseOtherTaxExclude
-        && costProjectManageTaxExclude && costOtherOtherTaxExclude){
-        $costTotalTaxExclude.val(f2(costPurchaseDeviceTaxExclude)+f2(costPurchaseBuildTaxExclude)
-            +f2(costPurchaseServiceTaxExclude)+f2(costPurchaseOtherTaxExclude)
-            +f2(costProjectManageTaxExclude)+f2(costOtherOtherTaxExclude));
-    }else {
-        $costTotalTaxExclude.val("");
-    }
+    $costTotalTaxExclude.val(f2(costPurchaseDeviceTaxExclude)+f2(costPurchaseBuildTaxExclude)
+        +f2(costPurchaseServiceTaxExclude)+f2(costPurchaseOtherTaxExclude)
+        +f2(costProjectManageTaxExclude)+f2(costOtherOtherTaxExclude));
 }
\ No newline at end of file
diff --git a/src/main/resources/static/assets/js/project_estimate.js b/src/main/resources/static/assets/js/project_estimate.js
index cbcbf93..f8327d7 100644
--- a/src/main/resources/static/assets/js/project_estimate.js
+++ b/src/main/resources/static/assets/js/project_estimate.js
@@ -102,11 +102,7 @@ function calIncomeInclude() {
 
     var $incomeTotalTaxInclude = $("input[name='incomeTotalTaxInclude']");
 
-    if(incomeDeviceTaxInclude && incomeEngineerTaxInclude && incomeServiceTaxInclude){
-        $incomeTotalTaxInclude.val(f2(incomeDeviceTaxInclude)+f2(incomeEngineerTaxInclude)+f2(incomeServiceTaxInclude));
-    }else {
-        $incomeTotalTaxInclude.val("");
-    }
+    $incomeTotalTaxInclude.val(f2(incomeDeviceTaxInclude)+f2(incomeEngineerTaxInclude)+f2(incomeServiceTaxInclude));
 }
 /**
  * 统计收入(不含税),有一项没填就置空
@@ -118,11 +114,7 @@ function calIncomeExclude() {
 
     var $incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']");
 
-    if(incomeDeviceTaxExclude && incomeEngineerTaxExclude && incomeServiceTaxExclude){
-        $incomeTotalTaxExclude.val(f2(incomeDeviceTaxExclude)+f2(incomeEngineerTaxExclude)+f2(incomeServiceTaxExclude));
-    }else {
-        $incomeTotalTaxExclude.val("");
-    }
+    $incomeTotalTaxExclude.val(f2(incomeDeviceTaxExclude)+f2(incomeEngineerTaxExclude)+f2(incomeServiceTaxExclude));
 }
 
 /**
@@ -139,15 +131,16 @@ function calIncomeCost() {
     var $projectContributionProfit = $("input[name='projectContributionProfit']");
     var $projectContributionProfitRate = $("input[name='projectContributionProfitRate']");
 
-    if (incomeTotalTaxExclude && costTotalTaxExclude && costExpropriationTaxExclude) {
+    var incomeTotalTaxExcludeValue = f2(incomeTotalTaxExclude);
+    if (incomeTotalTaxExcludeValue != 0) {
         $projectGrossProfit.val(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude));
-        $projectGrossProfitRate.val(f2($projectGrossProfit.val()) * 100 / f2(incomeTotalTaxExclude));
+        $projectGrossProfitRate.val(f2($projectGrossProfit.val()) * 100 / incomeTotalTaxExcludeValue);
     } else {
         $projectGrossProfit.val("");
         $projectGrossProfitRate.val("");
     }
 
-    if ($projectGrossProfit.val() && costCompanyManageTaxExclude) {
+    if ($projectGrossProfit.val()) {
         $projectContributionProfit.val(f2($projectGrossProfit.val()) - f2(costCompanyManageTaxExclude));
         $projectContributionProfitRate.val(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude))
     } else {
diff --git a/src/main/resources/templates/admin/project_estimate_edit.ftl b/src/main/resources/templates/admin/project_estimate_edit.ftl
index a3d575a..4a38aac 100644
--- a/src/main/resources/templates/admin/project_estimate_edit.ftl
+++ b/src/main/resources/templates/admin/project_estimate_edit.ftl
@@ -330,6 +330,7 @@
 
 </div>
 </div>
+<script src="${base}/assets/js/project_common.js"></script>
 <script src="${base}/assets/js/project_estimate.js"></script>
 <script>
     $(function () {
diff --git a/src/main/resources/templates/admin/project_list.ftl b/src/main/resources/templates/admin/project_list.ftl
index 1b7ea07..5cfe8e3 100644
--- a/src/main/resources/templates/admin/project_list.ftl
+++ b/src/main/resources/templates/admin/project_list.ftl
@@ -94,14 +94,13 @@
                                         <div class="am-form-group am-form-icon">
                                             <i class="am-icon-calendar"></i>
                                             <input type="text" class="am-form-field am-input-sm" id="startDate"
-                                                   value="${startDate!}" placeholder="开始日期" data-am-datepicker>
+                                                   value="${startDate!}" placeholder="开始日期" autocomplete="off" data-am-datepicker>
                                         </div>
                                         <div class="am-form-group">至</div>
                                         <div class="am-form-group am-form-icon">
                                             <i class="am-icon-calendar"></i>
                                             <input type="text" class="am-form-field am-input-sm" id="endDate"
-                                                   value="${endDate!}"
-                                                   placeholder="结束日期" data-am-datepicker>
+                                                   value="${endDate!}" placeholder="结束日期" autocomplete="off" data-am-datepicker>
                                         </div>
                                     </div>
                                 </div>
@@ -113,14 +112,13 @@
                                         <div class="am-form-group am-form-icon">
                                             <i class="am-icon-calendar"></i>
                                             <input type="text" class="am-form-field am-input-sm" id="startUpdateDate"
-                                                   value="${startUpdateDate!}" placeholder="开始日期" data-am-datepicker>
+                                                   value="${startUpdateDate!}" placeholder="开始日期" autocomplete="off" data-am-datepicker>
                                         </div>
                                         <div class="am-form-group">至</div>
                                         <div class="am-form-group am-form-icon">
                                             <i class="am-icon-calendar"></i>
                                             <input type="text" class="am-form-field am-input-sm" id="endUpdateDate"
-                                                   value="${endUpdateDate!}"
-                                                   placeholder="结束日期" data-am-datepicker>
+                                                   value="${endUpdateDate!}" placeholder="结束日期" autocomplete="off" data-am-datepicker>
                                         </div>
                                     </div>
                                 </div>

From 47136c3e8b21d6fbf005a49f5ab5e0bf90e0991c Mon Sep 17 00:00:00 2001
From: xxssyyyyssxx <xxssyyyyssxx@126.com>
Date: Mon, 22 Nov 2021 10:36:35 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E7=8E=87=E8=AE=A1?=
 =?UTF-8?q?=E7=AE=97=E4=BF=9D=E7=95=99=E4=B8=A4=E4=BD=8D=E5=B0=8F=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/main/resources/static/assets/js/project_estimate.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/static/assets/js/project_estimate.js b/src/main/resources/static/assets/js/project_estimate.js
index f8327d7..ed0a1b1 100644
--- a/src/main/resources/static/assets/js/project_estimate.js
+++ b/src/main/resources/static/assets/js/project_estimate.js
@@ -134,7 +134,7 @@ function calIncomeCost() {
     var incomeTotalTaxExcludeValue = f2(incomeTotalTaxExclude);
     if (incomeTotalTaxExcludeValue != 0) {
         $projectGrossProfit.val(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude));
-        $projectGrossProfitRate.val(f2($projectGrossProfit.val()) * 100 / incomeTotalTaxExcludeValue);
+        $projectGrossProfitRate.val(f2(f2($projectGrossProfit.val()) * 100 / incomeTotalTaxExcludeValue));
     } else {
         $projectGrossProfit.val("");
         $projectGrossProfitRate.val("");
@@ -142,7 +142,7 @@ function calIncomeCost() {
 
     if ($projectGrossProfit.val()) {
         $projectContributionProfit.val(f2($projectGrossProfit.val()) - f2(costCompanyManageTaxExclude));
-        $projectContributionProfitRate.val(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude))
+        $projectContributionProfitRate.val(f2(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude)))
     } else {
         $projectContributionProfit.val("");
         $projectContributionProfitRate.val("");