|
@@ -1785,7 +1785,7 @@ ORDER BY
|
|
|
BOI.quantity AS quantity,
|
|
BOI.quantity AS quantity,
|
|
|
BO.debit_amount AS amount,
|
|
BO.debit_amount AS amount,
|
|
|
BOI.actualQuantity AS actualQuantity,
|
|
BOI.actualQuantity AS actualQuantity,
|
|
|
- Round(BOI.arrivalAmount,2) AS arrivalAmount,
|
|
|
|
|
|
|
+ Round( bdf.delivery_amount ,2) AS arrivalAmount,
|
|
|
BO.this_used_profit AS thisUsedProfit,
|
|
BO.this_used_profit AS thisUsedProfit,
|
|
|
BO.gross_profit AS netGrossProfit,
|
|
BO.gross_profit AS netGrossProfit,
|
|
|
BO.predict_ocean_freight AS predictOceanFreight
|
|
BO.predict_ocean_freight AS predictOceanFreight
|
|
@@ -1805,6 +1805,21 @@ ORDER BY
|
|
|
GROUP BY
|
|
GROUP BY
|
|
|
pid
|
|
pid
|
|
|
) BOI ON BOI.pid = BO.id
|
|
) BOI ON BOI.pid = BO.id
|
|
|
|
|
+ LEFT JOIN (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ bd.org_order_no,
|
|
|
|
|
+ bd.actual_arrival_amount AS delivery_amount,
|
|
|
|
|
+ SUM( bdi.actual_quantity ) AS actual_quantity
|
|
|
|
|
+ FROM
|
|
|
|
|
+ business_delivery bd
|
|
|
|
|
+ LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ bd.tenant_id = '681169'
|
|
|
|
|
+ AND bd.is_deleted = 0
|
|
|
|
|
+ AND bd.bill_type = 'FH'
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ bd.org_order_no
|
|
|
|
|
+ ) bdf ON BO.morder_no = bdf.org_order_no
|
|
|
LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
|
|
LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
|
|
|
<where>
|
|
<where>
|
|
|
BO.tenant_id = #{statisticsVo.tenantId}
|
|
BO.tenant_id = #{statisticsVo.tenantId}
|
|
@@ -1982,7 +1997,7 @@ ORDER BY
|
|
|
BOI.quantity AS quantity,
|
|
BOI.quantity AS quantity,
|
|
|
BO.debit_amount AS amount,
|
|
BO.debit_amount AS amount,
|
|
|
BOI.actualQuantity AS actualQuantity,
|
|
BOI.actualQuantity AS actualQuantity,
|
|
|
- Round(BOI.arrivalAmount,2) AS arrivalAmount,
|
|
|
|
|
|
|
+ Round(bdf.delivery_amount,2) AS arrivalAmount,
|
|
|
IFNULL(BOF.feesAmount, 0) AS feesAmount,
|
|
IFNULL(BOF.feesAmount, 0) AS feesAmount,
|
|
|
BO.this_used_profit AS thisUsedProfit,
|
|
BO.this_used_profit AS thisUsedProfit,
|
|
|
BO.gross_profit AS netGrossProfit,
|
|
BO.gross_profit AS netGrossProfit,
|
|
@@ -2016,6 +2031,21 @@ ORDER BY
|
|
|
GROUP BY
|
|
GROUP BY
|
|
|
pid
|
|
pid
|
|
|
) BOF ON BOF.pid = BO.id
|
|
) BOF ON BOF.pid = BO.id
|
|
|
|
|
+ LEFT JOIN (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ bd.org_order_no,
|
|
|
|
|
+ bd.actual_arrival_amount AS delivery_amount,
|
|
|
|
|
+ SUM( bdi.actual_quantity ) AS actual_quantity
|
|
|
|
|
+ FROM
|
|
|
|
|
+ business_delivery bd
|
|
|
|
|
+ LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ bd.tenant_id = '681169'
|
|
|
|
|
+ AND bd.is_deleted = 0
|
|
|
|
|
+ AND bd.bill_type = 'FH'
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ bd.org_order_no
|
|
|
|
|
+ ) bdf ON BO.morder_no = bdf.org_order_no
|
|
|
LEFT JOIN basic_corps_desc BCD ON BCD.id = BO.corp_id
|
|
LEFT JOIN basic_corps_desc BCD ON BCD.id = BO.corp_id
|
|
|
LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
|
|
LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
|
|
|
<where>
|
|
<where>
|
|
@@ -2185,7 +2215,7 @@ ORDER BY
|
|
|
BOI.quantity AS quantity,
|
|
BOI.quantity AS quantity,
|
|
|
BO.debit_amount AS amount,
|
|
BO.debit_amount AS amount,
|
|
|
BOI.actualQuantity AS actualQuantity,
|
|
BOI.actualQuantity AS actualQuantity,
|
|
|
- Round(BOI.arrivalAmount,2) AS arrivalAmount,
|
|
|
|
|
|
|
+ Round(bdf.delivery_amount,2) AS arrivalAmount,
|
|
|
BO.this_used_profit AS thisUsedProfit,
|
|
BO.this_used_profit AS thisUsedProfit,
|
|
|
BO.gross_profit AS netGrossProfit,
|
|
BO.gross_profit AS netGrossProfit,
|
|
|
BO.predict_ocean_freight AS predictOceanFreight
|
|
BO.predict_ocean_freight AS predictOceanFreight
|
|
@@ -2205,6 +2235,21 @@ ORDER BY
|
|
|
GROUP BY
|
|
GROUP BY
|
|
|
pid
|
|
pid
|
|
|
) BOI ON BOI.pid = BO.id
|
|
) BOI ON BOI.pid = BO.id
|
|
|
|
|
+ LEFT JOIN (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ bd.org_order_no,
|
|
|
|
|
+ bd.actual_arrival_amount AS delivery_amount,
|
|
|
|
|
+ SUM( bdi.actual_quantity ) AS actual_quantity
|
|
|
|
|
+ FROM
|
|
|
|
|
+ business_delivery bd
|
|
|
|
|
+ LEFT JOIN business_delivery_items bdi ON bd.id = bdi.pid
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ bd.tenant_id = '681169'
|
|
|
|
|
+ AND bd.is_deleted = 0
|
|
|
|
|
+ AND bd.bill_type = 'FH'
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ bd.org_order_no
|
|
|
|
|
+ ) bdf ON BO.morder_no = bdf.org_order_no
|
|
|
LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
|
|
LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
|
|
|
<where>
|
|
<where>
|
|
|
BO.tenant_id = #{statisticsVo.tenantId}
|
|
BO.tenant_id = #{statisticsVo.tenantId}
|