|
|
@@ -25,6 +25,7 @@ use App\Jobs\LogisticAliJiSuSync;
|
|
|
use App\Jobs\LogisticYTOSync;
|
|
|
use App\Jobs\OrderCreateInstantBill;
|
|
|
use App\Jobs\OrderFreeze;
|
|
|
+use App\Jobs\ProcurementCheckConfirmInform;
|
|
|
use App\Jobs\StoreCreateInstantBill;
|
|
|
use App\Jobs\ResetInstantBill;
|
|
|
use App\LaborReport;
|
|
|
@@ -1362,13 +1363,31 @@ TEXT;
|
|
|
dd($result);
|
|
|
}
|
|
|
|
|
|
- public function testPrice()
|
|
|
+ public function createProcurementTotalBill()
|
|
|
{
|
|
|
- $procurement_unit_prices=[
|
|
|
- '1297'=>1.8,
|
|
|
- '1296'=>0.98,];
|
|
|
- foreach ($procurement_unit_prices as $key=>$value){
|
|
|
- Procurement::query()->find($key)->update(['unit_price'=>$value]);
|
|
|
+ $date='2021-05';
|
|
|
+ $procurementCheckSheets=ProcurementCheckSheet::query()
|
|
|
+ ->selectRaw('procurements.supplier_id supplier_id,procurement_check_sheets.created_at created_at,procurement_check_sheets.status status,SUM(procurement_check_sheets.account_payable) account_payable')
|
|
|
+ ->leftJoin('procurement_deliveries','procurement_check_sheets.procurement_delivery_id','procurement_deliveries.id')
|
|
|
+ ->leftJoin('procurements','procurement_deliveries.procurement_id','procurements.id')
|
|
|
+ ->where('procurement_check_sheets.created_at','like',$date."%")
|
|
|
+ ->groupBy('supplier_id')->where('procurements.supplier_id',84)
|
|
|
+ ->get();
|
|
|
+ $totalBill=[];
|
|
|
+ foreach ($procurementCheckSheets as $procurementCheckSheet){
|
|
|
+ if ($procurementCheckSheet->account_payable<1) continue;
|
|
|
+ $totalBill[]=[
|
|
|
+ 'counting_month'=>$date.'-01',
|
|
|
+ 'supplier_id'=>$procurementCheckSheet->supplier_id,
|
|
|
+ 'total_payable'=>$procurementCheckSheet->account_payable,
|
|
|
+ 'status'=>$procurementCheckSheet->status,
|
|
|
+ 'created_at'=>date('2021-06-01 00:00:00'),
|
|
|
+ 'updated_at'=>date('2021-06-01 00:00:00'),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if (count($totalBill)>0){
|
|
|
+ DB::table("procurement_total_bills")->insert($totalBill);
|
|
|
+ app('LogService')->log(__METHOD__,"采购管理-生成月账单报表",json_encode($totalBill));
|
|
|
}
|
|
|
}
|
|
|
}
|