feat(WarehouseLogic): 新增交易金额和获得利润统计功能,优化库存计算

This commit is contained in:
mkm 2024-09-01 22:23:15 +08:00
parent 14ffe62487
commit 0aa79334ac

View File

@ -4,6 +4,7 @@ namespace app\admin\logic\statistic;
use app\common\logic\BaseLogic; use app\common\logic\BaseLogic;
use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_finance_flow\StoreFinanceFlow;
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;
@ -48,6 +49,23 @@ class WarehouseLogic extends BaseLogic
'value' => [], 'value' => [],
'type' => 1, 'type' => 1,
]; ];
$pay_price=StoreOrder::where('paid',1)->where('refund_status',0)->sum('pay_price');
// $refund_price=StoreOrder::where('paid',1)->sum('refund_price');
$topData[] = [
'title' => '交易金额',
'desc' => '平台发生交易的金额',
'total_money' =>$pay_price,
'value' => [],
'type' => 1,
];
$number=StoreFinanceFlow::where('financial_type',3)->where('financial_pm',1)->sum('number');
$topData[] = [
'title' => '获得利润',
'desc' => '平台订单产生的手续费',
'total_money' =>$number,
'value' => [],
'type' => 1,
];
// $toreProduct = StoreProduct::where('stock', '>', 0)->field('sum(stock) as stock,sum(total_price) as total_price')->find(); // $toreProduct = StoreProduct::where('stock', '>', 0)->field('sum(stock) as stock,sum(total_price) as total_price')->find();
$warehouseProductStorege = WarehouseProductStorege::where('nums', '>', 0)->field('sum(nums) as nums,sum(total_price) as total_price')->find(); $warehouseProductStorege = WarehouseProductStorege::where('nums', '>', 0)->field('sum(nums) as nums,sum(total_price) as total_price')->find();