[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in Taxable sales report



Sales -> Reports -> Taxable Sales

with From = 1/1/2012 and To 31/3/2012

gives the following error

Error!



SELECT gl.transdate, gl.id, gl.invnumber, e.name, e.id as entity_id,
eca.id as credit_id, eca.meta_number, gl.netamount,
sum(CASE WHEN a.id IS NOT NULL then ac.amount ELSE 0 END) as tax,
gl.invoice, gl.netamount
+ sum(CASE WHEN a.id IS NOT NULL then ac.amount ELSE 0 END) as total
FROM (select id, transdate, amount, netamount, entity_credit_account,
invnumber, invoice
from ar where ? = 2
UNION
select id, transdate, amount, netamount, entity_credit_account,
invnumber, invoice
from ap where ? = 1) gl
JOIN entity_credit_account eca ON eca.id = gl.entity_credit_account
JOIN entity e ON eca.entity_id = e.id
JOIN acc_trans ac ON ac.trans_id = gl.id
LEFT JOIN (select * from account where tax is true and accno = ?
UNION
SELECT * from account where tax is true and ? is null
) a on a.id = ac.chart_id
LEFT JOIN dpt_trans dpt ON (gl.id = dpt.trans_id)
WHERE (? is null or dpt.department_id = ?)
AND (gl.transdate >= ? or ? is null)
AND (gl.transdate <= ? or ? is null)
GROUP BY gl.transdate, gl.id, gl.invnumber, e.name, e.id, eca.id,
eca.meta_number, gl.amount, gl.netamount, gl.invoice
HAVING (sum(CASE WHEN a.id is not null then ac.amount else 0 end)
<> 0 AND ? IS NOT NULL)
OR (? IS NULL and sum(CASE WHEN a.id is not null then ac.amount
ELSE 0 END) = 0)
ERROR: date/time field value out of range: "31/3/2012"
LINE 25: AND (gl.transdate <= '31/3/2012' or '31/3/2012' is...
^
HINT: Perhaps you need a different "datestyle" setting.