feat: 添加统计商品采购总价功能
This commit is contained in:
parent
a0814641c8
commit
884f319ddb
@ -299,6 +299,17 @@ class WorkbenchController extends BaseAdminController
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function total_warehouse_list()
|
public function total_warehouse_list()
|
||||||
|
{
|
||||||
|
$parmas=$this->request->get();
|
||||||
|
$data =WarehouseLogic::total_warehouse_list($parmas,$parmas['type']??1);
|
||||||
|
return $this->data($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计门店仓库总库存
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function total_warehouse_product_list()
|
||||||
{
|
{
|
||||||
$parmas=$this->request->get();
|
$parmas=$this->request->get();
|
||||||
$data =WarehouseLogic::total_warehouse_list($parmas,$parmas['type']??1);
|
$data =WarehouseLogic::total_warehouse_list($parmas,$parmas['type']??1);
|
||||||
|
@ -7,6 +7,7 @@ use app\common\model\store_branch_product\StoreBranchProduct;
|
|||||||
use app\common\model\store_order\StoreOrder;
|
use app\common\model\store_order\StoreOrder;
|
||||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
|
use app\common\model\supplier\Supplier;
|
||||||
use app\common\model\system_store\SystemStore;
|
use app\common\model\system_store\SystemStore;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\model\user\UserVisit;
|
use app\common\model\user\UserVisit;
|
||||||
@ -135,4 +136,47 @@ class WarehouseLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
return ['lists'=>$list,'count'=>$count];
|
return ['lists'=>$list,'count'=>$count];
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 统计商品采购总价 已结未结
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function total_warehouse_product_list($parmas,$type=1) {
|
||||||
|
$list=[];
|
||||||
|
$count=0;
|
||||||
|
if($type==1){
|
||||||
|
//总采购价
|
||||||
|
$where=[['product_id','=',$parmas['product_id']],['nums','>',0],['financial_pm','=',1]];
|
||||||
|
$list=WarehouseProduct::where($where)->select()->each(function ($item){
|
||||||
|
$item->warehouse_name = Warehouse::where('id',$item['warehouse_id'])->value('name');
|
||||||
|
$item->supplier_name = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
||||||
|
$find = StoreProduct::where('id',$item['product_id'])->find();
|
||||||
|
$item->store_name=$find['store_name'];
|
||||||
|
$item->image=$find['image'];
|
||||||
|
});
|
||||||
|
$count=WarehouseProduct::where($where)->count();
|
||||||
|
}elseif($type==2){
|
||||||
|
//已结算采购价
|
||||||
|
$where=[['product_id','=',$parmas['product_id']],['nums','>',0],['financial_pm','=',1]];
|
||||||
|
$list=WarehouseProduct::where($where)->select()->each(function ($item){
|
||||||
|
$item->warehouse_name = Warehouse::where('id',$item['warehouse_id'])->value('name');
|
||||||
|
$item->supplier_name = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
||||||
|
$find = StoreProduct::where('id',$item['product_id'])->find();
|
||||||
|
$item->store_name=$find['store_name'];
|
||||||
|
$item->image=$find['image'];
|
||||||
|
});
|
||||||
|
$count=WarehouseProduct::where($where)->count();
|
||||||
|
}elseif($type==3){
|
||||||
|
//未结算采购价
|
||||||
|
$where=[['product_id','=',$parmas['product_id']],['nums','>',0],['financial_pm','=',1]];
|
||||||
|
$list=WarehouseProduct::where($where)->select()->each(function ($item){
|
||||||
|
$item->warehouse_name = Warehouse::where('id',$item['warehouse_id'])->value('name');
|
||||||
|
$item->supplier_name = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
||||||
|
$find = StoreProduct::where('id',$item['product_id'])->find();
|
||||||
|
$item->store_name=$find['store_name'];
|
||||||
|
$item->image=$find['image'];
|
||||||
|
});
|
||||||
|
$count=WarehouseProduct::where($where)->count();
|
||||||
|
}
|
||||||
|
return ['lists'=>$list,'count'=>$count];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user