|
|
@@ -149,19 +149,20 @@ class WaybillService
|
|
|
return $waybills->get();
|
|
|
}
|
|
|
public function dailyBilling(array $param){
|
|
|
+ if (($param['screenDate']??false)==false || ($param['billing']??false)==false) return 0; //入参错误
|
|
|
$waybills = Waybill::query()->with(['owner','logistic','originationCity','destinationCity.parent',
|
|
|
'uploadFiles','amountUnit','warehouseWeightUnit','carrierWeightUnit','district','order',
|
|
|
- 'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFiles','waybillAuditLogs.user'])
|
|
|
+ 'warehouseWeightUnitOther','carrierWeightUnitOther','carType','waybillAuditLogs.user'])
|
|
|
->selectRaw('waybills.* ,waybill_on_tops.id top_id,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
|
|
|
->leftJoin('waybill_on_tops','waybill_on_tops.waybill_id','=','waybills.id')
|
|
|
->whereNull('waybill_on_tops.deleted_at')
|
|
|
->orderBy('waybill_on_tops.updated_at','desc')
|
|
|
->orderBy('waybills.id','desc')
|
|
|
->where('waybills.type','专线')
|
|
|
- ->where('waybills.amount','>',0);
|
|
|
- if ($param['screenDate'] ?? false)$waybills->where('waybills.deliver_at','like',$param['screenDate'].'%');
|
|
|
- $waybills = $waybills->get();
|
|
|
- if ($waybills->isEmpty()) return '无数据';
|
|
|
+ ->where('waybills.amount','>',0)
|
|
|
+ ->where('waybills.deliver_at','like',$param['screenDate'].'%')
|
|
|
+ ->get();
|
|
|
+ if ($waybills->isEmpty()) return 1;//无数据
|
|
|
foreach ($waybills as $waybill){
|
|
|
if (!$waybill['carrier_weight_other'] && !$waybill['carrier_weight']) return null;
|
|
|
if (!$waybill['carrier_weight_other'] || $waybill['carrier_weight_other']<=0) $waybill['carrier_weight_other']=($waybill['carrier_weight']/0.25*100);
|