Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
titleSQL - Update / View transactions with more than 2 decimals in Evolution
select * from PostGL where ROUND(Debit+Credit,4) <> Round(debit+credit,2)

update PostGL set debit = round(debit,2), credit = round(credit,2) where ROUND(Debit+Credit,4) <> Round(debit+credit,2)


SQL - View transaction differences between _etblAccBlnc and PostGL

Code Block


SELECT *,DiffDebit = t1.Debit - t2.fActualDebit , DiffCredit = t1.Credit - t2.fActualCredit, TotalDiff = ABS(t1.Debit - t2.fActualDebit) + ABS(t1.Credit - t2.fActualCredit)
	FROM (
		SELECT AccountLink, Period, Project, SUM(ROUND(Debit,2)) as Debit, SUM(ROUND(Credit,2)) as Credit FROM PostGL GROUP BY AccountLink, Period, Project ) t1
		LEFT JOIN (SELECT AB.iAccBlncAccountID, AB.iAccBlncProjectID, AB.iAccBlncPeriodID, AB.fActualDebit, AB.fActualCredit FROM _etblAccBlnc AB) t2 ON t1.AccountLink = t2.iAccBlncAccountID AND t1.Project = t2.iAccBlncProjectID AND t1.Period = t2.iAccBlncPeriodID
		WHERE 
			ABS(t1.Debit - t2.fActualDebit) > 0.049 or ABS(t1.Credit - t2.fActualCredit)> 0.049
		order by TotalDiff desc