|
|
@@ -1509,7 +1509,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
|
|
|
@@ -1517,7 +1517,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
|
|
|
@@ -1562,7 +1563,7 @@ ORDER BY
|
|
|
SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
|
|
|
SUM(BO.predict_ocean_freight) AS predictOceanFreight,
|
|
|
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
|
|
|
+ FORMAT(( SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) ) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1615,7 +1616,7 @@ ORDER BY
|
|
|
SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
|
|
|
SUM(BO.predict_ocean_freight) AS predictOceanFreight,
|
|
|
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
|
|
|
+ FORMAT(( SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) ) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1668,7 +1669,7 @@ ORDER BY
|
|
|
SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
|
|
|
SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
|
|
|
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
|
|
|
+ FORMAT((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1719,7 +1720,7 @@ ORDER BY
|
|
|
SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
|
|
|
SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
|
|
|
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
|
|
|
+ FORMAT((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1767,12 +1768,12 @@ ORDER BY
|
|
|
SUM( BOI.purchaseAmount ) AS purchaseAmount,
|
|
|
SUM( BOI.quantity ) AS quantity,
|
|
|
SUM( BO.this_used_profit ) AS thisUsedProfit,
|
|
|
- ( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ) AS price,
|
|
|
- ((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ) AS singleGrossProfit,
|
|
|
+ FORMAT(( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ),2) AS price,
|
|
|
+ FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ),2) AS singleGrossProfit,
|
|
|
SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
|
|
|
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
|
|
|
+ FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|
|
|
@@ -1818,12 +1819,12 @@ ORDER BY
|
|
|
SUM( BOI.purchaseAmount ) AS purchaseAmount,
|
|
|
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,
|
|
|
+ FORMAT(( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ),2) AS price,
|
|
|
+ FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ),2) 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,
|
|
|
+ FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
|
|
|
FROM
|
|
|
business_order BO
|
|
|
LEFT JOIN (
|