Browse Source

部分BUG修复

Zhouzhendong 5 years ago
parent
commit
e39d0143e2

+ 21 - 6
app/Http/Controllers/TestController.php

@@ -62,12 +62,14 @@ use App\OrderIssue;
 use App\OrderPackage;
 use App\Owner;
 use App\OwnerAreaReport;
+use App\OwnerBillReport;
 use App\OwnerFeeDetail;
 use App\OwnerFeeDetailLogistic;
 use App\OwnerMaterial;
 use App\OwnerPriceExpress;
 use App\OwnerPriceOperation;
 use App\OwnerPriceOperationItem;
+use App\OwnerPriceSystem;
 use App\OwnerReport;
 use App\OwnerStoragePriceModel;
 use App\Package;
@@ -175,14 +177,27 @@ class TestController extends Controller
 
     public function test()
     {
-        $owner = Owner::query()->with("taxRate")
-            ->whereHas("taxRate")
-            ->find(1);
-        dd($owner);
+        app('OwnerAreaReportService')->update(["id"=>99],["accounting_area"=>'60.0']);
     }
-    public function a(int $c)
+    public function restoreBillReport()
     {
-        return $c;
+        $areas = OwnerAreaReport::query()->where("counting_month",'like','2021-04%')->whereNotNull("accounting_area")->get();
+        foreach ($areas as $area){
+            $report = OwnerBillReport::query()->lockForUpdate()->where("owner_id",$area->owner_id)
+                ->where("counting_month",'like',$area->counting_month."%")->first();
+            if ($report){
+                if (!$area->ownerStoragePriceModel)return false;
+                $storeFee = app("OwnerStoragePriceModelService")->calculationAmount($area->ownerStoragePriceModel, $area->accounting_area, $area->owner_id, $area->counting_month);
+                if ($storeFee != 0){
+                    $up = ["storage_fee"=>$storeFee];
+                    if ($report->confirm_fee !== null || $report->confirmed == '是'){
+                        $initial = $report->work_fee + $report->logistic_fee + $storeFee;
+                        $up["difference"] = $initial - $report->confirm_fee;
+                    }
+                    $report->update($up);
+                }
+            }
+        }
     }
     public function restoreResetInstantBill()
     {

+ 7 - 6
app/Services/OwnerAreaReportService.php

@@ -62,12 +62,13 @@ class OwnerAreaReportService
                     ->where("counting_month",'like',$area->counting_month."%")->first();
                 if ($report){
                     if (!$area->ownerStoragePriceModel)return false;
-                    $diff = $area->accounting_area>0 ? $area->accounting_area - $values["accounting_area"] : $values["accounting_area"];
-                    $diffAmount = app("OwnerStoragePriceModelService")->calculationAmount($area->ownerStoragePriceModel, $diff, $area->owner_id, $area->counting_month);
-                    if ($diffAmount != 0){
-                        $up = ["storage_fee"=>$report->storage_fee - $diffAmount];
-                        $initial = $report->initial_fee - ($report->storage_fee - $diffAmount);
-                        if ($report->confirm_fee !== null)$up["difference"] = $initial - $report->confirm_fee;
+                    $storeFee = app("OwnerStoragePriceModelService")->calculationAmount($area->ownerStoragePriceModel, $values["accounting_area"], $area->owner_id, $area->counting_month);
+                    if ($storeFee != 0){
+                        $up = ["storage_fee"=>$storeFee];
+                        if ($report->confirm_fee !== null || $report->confirmed == '是'){
+                            $initial = $report->work_fee + $report->logistic_fee + $storeFee;
+                            $up["difference"] = $initial - $report->confirm_fee;
+                        }
                         $report->update($up);
                     }
                 }

+ 4 - 4
resources/views/customer/project/part/_auditComparison.blade.php

@@ -216,7 +216,7 @@
                                     <td v-if="s.items.length>0">
                                         <table class="table table-sm">
                                             <tr><th v-for="(val,key) in auditList.mapping.operation.child">@{{ val }}</th></tr>
-                                            <tr v-for="item in s.items">
+                                            <tr v-for="item in s.items" :class="item.operation=='C' ? 'bg-success' : (item.operation=='D' ? 'bg-danger' : '')">
                                                 <td v-for="(val,key) in auditList.mapping.operation.child" v-html="item[key]"></td>
                                             </tr>
                                         </table>
@@ -235,7 +235,7 @@
                                     <td v-if="s.details.length>0">
                                         <table class="table table-sm">
                                             <tr><th v-for="(val,key) in auditList.mapping.express.child">@{{ val }}</th></tr>
-                                            <tr v-for="item in s.details">
+                                            <tr v-for="item in s.details" :class="item.operation=='C' ? 'bg-success' : (item.operation=='D' ? 'bg-danger' : '')">
                                                 <td v-for="(val,key) in auditList.mapping.express.child" v-html="item[key]"></td>
                                             </tr>
                                         </table>
@@ -254,7 +254,7 @@
                                     <td v-if="s.details.length>0">
                                         <table class="table table-sm">
                                             <tr><th v-for="(val,key) in auditList.mapping.logistic.child">@{{ val }}</th></tr>
-                                            <tr v-for="item in s.details">
+                                            <tr v-for="item in s.details" :class="item.operation=='C' ? 'bg-success' : (item.operation=='D' ? 'bg-danger' : '')">
                                                 <td v-for="(val,key) in auditList.mapping.logistic.child" v-html="item[key]"></td>
                                             </tr>
                                         </table>
@@ -273,7 +273,7 @@
                                     <td v-if="s.details.length>0">
                                         <table class="table table-sm">
                                             <tr><th v-for="(val,key) in auditList.mapping.directLogistic.child">@{{ val }}</th></tr>
-                                            <tr v-for="item in s.details">
+                                            <tr v-for="item in s.details" :class="item.operation=='C' ? 'bg-success' : (item.operation=='D' ? 'bg-danger' : '')">
                                                 <td v-for="(val,key) in auditList.mapping.directLogistic.child" v-html="item[key]"></td>
                                             </tr>
                                         </table>

+ 1 - 1
resources/views/finance/instantBill.blade.php

@@ -195,7 +195,7 @@
                     before:[
                         {colspan:'2',value: ''},
                         {colspan:'9',value: '单据信息', class:"bg-light-info"},
-                        {colspan:'4',value: '物流作业信息', class:"bg-light-khaki"},
+                        {colspan:'5',value: '物流作业信息', class:"bg-light-khaki"},
                         {colspan:'4',value: '费用信息', class:"bg-light-cyanogen"},
                     ],
                 }).init();