upd
This commit is contained in:
@ -567,7 +567,21 @@ class BudgetAdapter extends Adapter{
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
let qry = `SELECT v.*, b.currency_id, COALESCE(c.rate, 1) AS currency_rate,
|
let qry = `SELECT v.*, b.currency_id, COALESCE(c.rate, 1) AS currency_rate,
|
||||||
c.currency AS currency_code, c.symbol AS currency_symbol
|
c.currency AS currency_code, c.symbol AS currency_symbol,
|
||||||
|
(v.amount
|
||||||
|
- COALESCE((
|
||||||
|
SELECT SUM(rb.amount * COALESCE(rb.rate_snapshot, COALESCE(rc.rate, 1)) / NULLIF(COALESCE(c.rate, 1), 0))
|
||||||
|
FROM tbl_requestbudget rb
|
||||||
|
LEFT JOIN tbl_currency rc ON rc._idx = rb.currency_id
|
||||||
|
WHERE rb.idxbudgetid = v._idx AND rb.crdb = 'K' AND rb.isdeleted = 0
|
||||||
|
), 0)
|
||||||
|
+ COALESCE((
|
||||||
|
SELECT SUM(rb.amount * COALESCE(rb.rate_snapshot, COALESCE(rc.rate, 1)) / NULLIF(COALESCE(c.rate, 1), 0))
|
||||||
|
FROM tbl_requestbudget rb
|
||||||
|
LEFT JOIN tbl_currency rc ON rc._idx = rb.currency_id
|
||||||
|
WHERE rb.idxbudgetid = v._idx AND rb.crdb = 'D' AND rb.isdeleted = 0
|
||||||
|
), 0)
|
||||||
|
) AS due_converted
|
||||||
FROM vw_budgetlistbyrequest v
|
FROM vw_budgetlistbyrequest v
|
||||||
LEFT JOIN tbl_budgetcapexinfo b ON b._idx = v._idx
|
LEFT JOIN tbl_budgetcapexinfo b ON b._idx = v._idx
|
||||||
LEFT JOIN tbl_currency c ON c._idx = b.currency_id
|
LEFT JOIN tbl_currency c ON c._idx = b.currency_id
|
||||||
|
|||||||
Reference in New Issue
Block a user