|
|
@@ -301,6 +301,7 @@ class StatSaleClass extends BaseClass
|
|
|
|
|
|
//零售开单
|
|
|
$payCodeIncome = 0;
|
|
|
+ $lsAfterSale = 0;
|
|
|
$lsIncome = 0;
|
|
|
$lsSendCost = 0;
|
|
|
$lsServiceFee = 0;
|
|
|
@@ -312,31 +313,32 @@ class StatSaleClass extends BaseClass
|
|
|
$onlinePay = $hdOrder['onlinePay'] ?? 1;
|
|
|
$repeat = $hdOrder['repeat'] ?? 0;
|
|
|
$forward = $hdOrder['forward'] ?? 0;
|
|
|
- if ($forward == 1) {
|
|
|
- //售后付款不属于收入
|
|
|
- continue;
|
|
|
- }
|
|
|
|
|
|
if ($hdOrder['tkPrice'] && $hdOrder['tkPrice'] > 0) {
|
|
|
$actPrice = bcsub($actPrice, $hdOrder['tkPrice'], 2);
|
|
|
}
|
|
|
- $cash = $hdOrder['cash'] ?? 0;
|
|
|
- $serviceFee = $hdOrder['serviceFee'] ?? 0;
|
|
|
- $sendCost = $hdOrder['sendCost'] ?? 0;
|
|
|
- $lsIncome = bcadd($actPrice, $lsIncome, 2);
|
|
|
- $lsIncome = bcadd($lsIncome, $cash, 2);
|
|
|
- //退款取消先不计算成本
|
|
|
- if ($actPrice > 0) {
|
|
|
- $lsSendCost = bcadd($lsSendCost, $sendCost, 2);
|
|
|
- $lsServiceFee = bcadd($lsServiceFee, $serviceFee, 2);
|
|
|
- }
|
|
|
- $totalOrderNum++;
|
|
|
|
|
|
- if ($onlinePay == 2 && floatval($cash) <= 0 && $repeat == 1) {
|
|
|
- $payCodeIncome = bcadd($payCodeIncome, $actPrice, 2);
|
|
|
- $payCodeIncome = floatval($payCodeIncome);
|
|
|
- }
|
|
|
+ if ($forward == 1) {
|
|
|
+ //零售售后付款
|
|
|
+ $lsAfterSale = bcadd($lsAfterSale, $actPrice, 2);
|
|
|
+ } else {
|
|
|
+ $cash = $hdOrder['cash'] ?? 0;
|
|
|
+ $serviceFee = $hdOrder['serviceFee'] ?? 0;
|
|
|
+ $sendCost = $hdOrder['sendCost'] ?? 0;
|
|
|
+ $lsIncome = bcadd($actPrice, $lsIncome, 2);
|
|
|
+ $lsIncome = bcadd($lsIncome, $cash, 2);
|
|
|
+ //如果$actPrice<=0,则退款取消先不计算成本
|
|
|
+ if ($actPrice > 0) {
|
|
|
+ $lsSendCost = bcadd($lsSendCost, $sendCost, 2);
|
|
|
+ $lsServiceFee = bcadd($lsServiceFee, $serviceFee, 2);
|
|
|
+ }
|
|
|
+ $totalOrderNum++;
|
|
|
|
|
|
+ if ($onlinePay == 2 && floatval($cash) <= 0 && $repeat == 1) {
|
|
|
+ $payCodeIncome = bcadd($payCodeIncome, $actPrice, 2);
|
|
|
+ $payCodeIncome = floatval($payCodeIncome);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$condition = ['mainId' => $mainId, 'addTime' => ['between', [$currentStartTime, $currentEndTime]],];
|
|
|
@@ -362,7 +364,7 @@ class StatSaleClass extends BaseClass
|
|
|
$type = $item->type ?? 0;
|
|
|
$amount = $item->amount ?? 0;
|
|
|
$name = $expendTypeMap[$type] ?? '暂无';
|
|
|
- if (isset($expendAmount[$type]['amount']) == false) {
|
|
|
+ if (!isset($expendAmount[$type]['amount'])) {
|
|
|
$expendAmount[$type]['amount'] = 0;
|
|
|
}
|
|
|
$expendAmount[$type]['name'] = $name;
|
|
|
@@ -379,6 +381,7 @@ class StatSaleClass extends BaseClass
|
|
|
['name' => '批发运费', 'id' => 'pfSendCost', 'amount' => floatval($pfSendCost)],
|
|
|
['name' => '批发包装费', 'id' => 'pfSendCost', 'amount' => floatval($pfPack)],
|
|
|
['name' => '零售运费', 'id' => 'lsSendCost', 'amount' => floatval($lsSendCost)],
|
|
|
+ ['name' => '零售售后付款', 'id' => 'lsSendCost', 'amount' => floatval($lsAfterSale)],
|
|
|
['name' => '美团手续费', 'id' => 'mtFee', 'amount' => floatval($lsServiceFee)],
|
|
|
['name' => '花材采购', 'id' => 'cg', 'amount' => floatval($cg)],
|
|
|
['name' => '绿植资材采购', 'id' => 'cg', 'amount' => floatval($lzCgAmount)],
|