|
@@ -50,9 +50,10 @@
|
|
|
sc.contract_amount AS contractAmount,
|
|
|
(
|
|
|
SELECT
|
|
|
- IFNULL( sum( sjd.price * sjd.quantity ), 0 )
|
|
|
+ IFNULL(sum( IF ( sj.op_type = 2,( sjd.price * sjd.quantity ),-(sjd.price * sjd.quantity )) ),0)
|
|
|
FROM
|
|
|
bytesailing_wms.stock_journal_details sjd
|
|
|
+ LEFT JOIN bytesailing_wms.stock_journal sj ON sjd.stock_journal_id = sj.id
|
|
|
JOIN bytesailing_wms.stock_wait_details swd ON sjd.business_details_id = swd.id
|
|
|
JOIN bytesailing_wms.stock_wait sw ON swd.stock_wait_id = sw.id
|
|
|
JOIN bytesailing_mes.production_task pt ON sw.business_id = pt.id
|