Created
April 10, 2018 06:12
-
-
Save worstn8mare/b461e5da20897db9fcbdc4a0e00f8397 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select | |
| CONCAT(SUM(b.amount),'|',c.cb) as detail | |
| from gl_accounts as a | |
| LEFT JOIN posting_gls as b on b.gl_account_id = a.id | |
| LEFT JOIN postings as c on c.id = b.posting_id | |
| LEFT JOIN cv_post_details as d on d.id = IF(c.doc_type = 'CV',c.attachment_no,1) | |
| where d.type = 'Posting' | |
| and c.status = 'Posted' | |
| -- ----------------------------------- | |
| and ( | |
| CASE | |
| WHEN (c.doc_type = "Closing" and DATE(c.post_date) < '2018-04-10') THEN TRUE | |
| WHEN (c.doc_type = "Closing" and DATE(c.post_date) >= '2018-04-10') THEN FALSE | |
| ELSE | |
| TRUE | |
| END | |
| ) | |
| -- ----------------------------------------------------------- | |
| and b.entry_type = 'Internal' and c.cb = 0 and c.post_date <= '2018-04-10' | |
| and x.f1 = a.f1 and x.f2 = a.f2 and x.f3 = a.f3 and x.f4 = a.f4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment