|
|
@@ -1461,7 +1461,7 @@ ORDER BY
|
|
|
SELECT
|
|
|
BO.charge_member as chargeMember,
|
|
|
SUM(BOI.quantity) AS quantity,
|
|
|
- SUM(BO.gross_profit) AS grossProfit,
|
|
|
+ SUM(BO.debit_amount) - SUM(BOI.purchaseAmount) AS grossProfit,
|
|
|
SUM(BO.debit_amount) AS amount
|
|
|
FROM
|
|
|
business_order BO
|
|
|
@@ -1469,7 +1469,8 @@ ORDER BY
|
|
|
SELECT
|
|
|
pid,
|
|
|
item_id,
|
|
|
- IFNULL( SUM( actual_quantity ), 0 ) AS quantity
|
|
|
+ IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
|
|
|
+ IFNULL( sum( actual_quantity * purchase_amount ), 0 ) AS purchaseAmount
|
|
|
FROM
|
|
|
business_order_items
|
|
|
WHERE is_deleted = 0
|
|
|
@@ -1558,10 +1559,10 @@ ORDER BY
|
|
|
SUM(BOI.quantity) AS quantity,
|
|
|
SUM(BOI.purchaseAmount) AS purchaseAmount,
|
|
|
SUM(BO.this_used_profit) AS thisUsedProfit,
|
|
|
- SUM(BO.gross_profit) AS grossProfit,
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
|
|
|
SUM(BO.predict_ocean_freight) AS predictOceanFreight,
|
|
|
- SUM(BO.gross_profit) - SUM(BO.predict_ocean_freight) AS netGrossProfit,
|
|
|
- SUM( BO.gross_profit ) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
|
|
|
+ (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1611,10 +1612,10 @@ ORDER BY
|
|
|
SUM(BOI.quantity) AS quantity,
|
|
|
SUM(BOI.purchaseAmount) AS purchaseAmount,
|
|
|
SUM(BO.this_used_profit) AS thisUsedProfit,
|
|
|
- SUM(BO.gross_profit) AS grossProfit,
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
|
|
|
SUM(BO.predict_ocean_freight) AS predictOceanFreight,
|
|
|
- SUM(BO.gross_profit) - SUM(BO.predict_ocean_freight) AS netGrossProfit,
|
|
|
- SUM( BO.gross_profit ) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
|
|
|
+ (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1664,10 +1665,10 @@ ORDER BY
|
|
|
SUM( BOI.quantity ) AS quantity,
|
|
|
SUM( BOI.purchaseAmount ) AS purchaseAmount,
|
|
|
SUM( BO.this_used_profit ) AS thisUsedProfit,
|
|
|
- SUM( BO.gross_profit ) AS grossProfit,
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
|
|
|
SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
|
|
|
- SUM( BO.gross_profit ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
|
|
|
- SUM( BO.gross_profit ) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
|
|
|
+ (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1715,10 +1716,10 @@ ORDER BY
|
|
|
SUM( BOI.quantity ) AS quantity,
|
|
|
SUM( BOI.purchaseAmount ) AS purchaseAmount,
|
|
|
SUM( BO.this_used_profit ) AS thisUsedProfit,
|
|
|
- SUM( BO.gross_profit ) AS grossProfit,
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
|
|
|
SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
|
|
|
- SUM( BO.gross_profit ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
|
|
|
- SUM( BO.gross_profit ) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
|
|
|
+ (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1767,11 +1768,11 @@ ORDER BY
|
|
|
SUM( BOI.quantity ) AS quantity,
|
|
|
SUM( BO.this_used_profit ) AS thisUsedProfit,
|
|
|
( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ) AS price,
|
|
|
- (SUM( BO.gross_profit ) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ) AS singleGrossProfit,
|
|
|
+ ((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ) AS singleGrossProfit,
|
|
|
SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
|
|
|
- SUM( BO.gross_profit ) AS netGrossProfit,
|
|
|
- SUM( BO.gross_profit ) + (-SUM( BO.this_used_profit )) AS grossProfit,
|
|
|
- (SUM( BO.gross_profit ) + (-SUM( BO.this_used_profit ))) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
+ SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS netGrossProfit,
|
|
|
+ (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit )) AS grossProfit,
|
|
|
+ ((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|