|
|
@@ -1271,11 +1271,21 @@ where purch.islower=1 and deliver.id>'.$id);
|
|
|
ProcurementCheckSheet::query()->insert($insert_);
|
|
|
}
|
|
|
public function testPro(){
|
|
|
+ $status=0;
|
|
|
$procurements=Procurement::query()
|
|
|
->withCount('procurementQuotations')
|
|
|
->with('ownerMaterial.material')
|
|
|
- ->where('status',0)
|
|
|
+ ->where('status',$status)
|
|
|
->get();
|
|
|
+ $keys = [];
|
|
|
+ foreach ($procurements as $key=>$procurement){
|
|
|
+ if ($procurement->procurement_quotations_count>0 && $status==0 )$keys[]= $key;
|
|
|
+ if ($procurement->type==2 && $procurement->supplier_id )$keys[]= $key;
|
|
|
+ if (Carbon::parse($procurement->deadline)->gt(Carbon::now())) $procurement->deadline=Carbon::parse($procurement->deadline)->diffInMilliseconds();
|
|
|
+ else $procurement->deadline=0;
|
|
|
+ }
|
|
|
+ $procurements = $procurements->diffKeys($keys);
|
|
|
dd($procurements);
|
|
|
+ if (!empty($procurements)) return $this->success($procurements);
|
|
|
}
|
|
|
}
|