|
SELECT D.ID as deptId, MAX(D.NAME) as deptName,
|
|
SELECT D.ID as deptId, MAX(D.NAME) as deptName,
|
|
COALESCE(SUM(COALESCE(PA.invoiceAmount - PA.returnAmount,0)),0) as receivableAmount,
|
|
COALESCE(SUM(COALESCE(PA.invoiceAmount - PA.returnAmount,0)),0) as receivableAmount,
|
|
COALESCE(SUM(COALESCE(c.CONTRACT_AMOUNT,0)),0) - COALESCE(SUM(COALESCE(PA.invoiceAmount,0)),0) as contractBalance,
|
|
COALESCE(SUM(COALESCE(c.CONTRACT_AMOUNT,0)),0) - COALESCE(SUM(COALESCE(PA.invoiceAmount,0)),0) as contractBalance,
|