feat: 修改库存计算方式以增加库存总量的显示
This commit is contained in:
parent
20095c8085
commit
6b0d5e3edb
@ -92,6 +92,11 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
->each(function ($item) {
|
||||
// 计算总库存
|
||||
$unit_name=StoreProductUnit::where('id',$item->unit)->value('name');
|
||||
if($item->total_stock){
|
||||
$item->total_stock=bcadd($item->total_stock??0,$item->warehouse_stock??0,2).'|'.$unit_name;
|
||||
}else{
|
||||
$item->total_stock='';
|
||||
}
|
||||
$item->sales=$item->sales.'|'.$unit_name;
|
||||
$item->store_stock=$item->store_stock.'|'.$unit_name;
|
||||
$item->warehouse_stock=$item->warehouse_stock.'|'.$unit_name;
|
||||
@ -115,11 +120,6 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
}else{
|
||||
$item->total_price='0元';
|
||||
}
|
||||
if($item->total_stock){
|
||||
$item->total_stock=bcadd($item->total_stock,$item->warehouse_stock,2).'|'.$unit_name;
|
||||
}else{
|
||||
$item->total_stock='';
|
||||
}
|
||||
})
|
||||
->toArray();
|
||||
return $list;
|
||||
|
Loading…
x
Reference in New Issue
Block a user