Przeglądaj źródła

Merge branch 'Haozi' of ssh://was.baoshi56.com:10022/var/git/bswas

 Conflicts:
	app/Http/Controllers/TestController.php
LD 5 lat temu
rodzic
commit
f7d5342b9f
1 zmienionych plików z 29 dodań i 0 usunięć
  1. 29 0
      app/Http/Controllers/TestController.php

+ 29 - 0
app/Http/Controllers/TestController.php

@@ -1437,6 +1437,35 @@ TEXT;
         MeasuringMachine::query()->firstOrCreate(['code'=>'hengli003'],['name'=>'hengli003']);
     }
 
+    public function testProcurement()
+    {
+        $procurementDeliveries=ProcurementDeliverie::query()
+            ->where('receipt_amount',0)
+            ->where('created_at','>=','2021-04-01 00:00:00')
+            ->where('created_at','<',Carbon::now()->toDateTimeString())
+            ->get();
+        foreach ($procurementDeliveries as $procurementDelivery){
+            $procurementDelivery->update(['receipt_amount'=>$procurementDelivery->amount]);
+        }
+        $procurementCheckSheets=ProcurementCheckSheet::query()
+            ->with('procurementDelivery.procurement')
+            ->where('account_payable',0)
+            ->where('created_at','>=','2021-04-01 00:00:00')
+            ->where('created_at','<',Carbon::now()->toDateTimeString())
+            ->get();
+        foreach ($procurementCheckSheets as $procurementCheckSheet){
+            if ($procurementCheckSheet->id==913)continue;
+            $procurementCheckSheet->update(['account_payable'=>$procurementCheckSheet['procurementDelivery']['receipt_amount']*$procurementCheckSheet['procurementDelivery']['procurement']['cost_price']]);
+        }
+        $procurementCheckSheet=ProcurementCheckSheet::query()->find(914);
+        ProcurementTotalBill::query()->create([
+            'counting_month'=>'2021-05-01',
+            'supplier_id'=>84,
+            'status'=>0,
+            'total_payable'=>$procurementCheckSheet->account_payable,
+        ]);
+    }
+
     public function testHttp()
     {
         return view('httpTest');