|
|
@@ -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()
|
|
|
{
|