forked from Bahmni/default-config
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-4068 | Add. Reports for OpenElis report and Odoo report (#47)
* BAH-4068 | Add. Reports for OpenElis report and Odoo report * BAH-4068 | Fix. Missing empty line issues in reports sql files
- Loading branch information
Showing
3 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
SELECT | ||
DATE(invoice_date) AS "Date", | ||
COUNT(id) AS "Number of Invoices", | ||
SUM((amount_total - discount) + round_off_amount) AS "Total Invoice Value" | ||
FROM | ||
account_move | ||
WHERE | ||
move_type = 'out_invoice' | ||
AND state = 'posted' | ||
AND DATE(invoice_date) BETWEEN '#startDate#' AND '#endDate#' | ||
GROUP BY | ||
DATE(invoice_date) | ||
ORDER BY | ||
invoice_date ASC; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,6 @@ | ||
SELECT DISTINCT | ||
ts.name AS DDepartment, | ||
t.name AS test, | ||
count(r.id) AS total_count, | ||
CASE WHEN t.id IN (SELECT test_id FROM test_result WHERE tst_rslt_type = 'D') THEN count(r1.id) ELSE NULL END AS positive, | ||
CASE WHEN t.id IN (SELECT test_id FROM test_result WHERE tst_rslt_type = 'D') THEN count(r2.id) ELSE NULL END AS negative | ||
FROM test_section ts | ||
INNER JOIN test t ON ts.id = t.test_section_id AND t.is_active = 'Y' | ||
LEFT OUTER JOIN analysis a ON t.id = a.test_id | ||
LEFT OUTER JOIN result r ON a.id = r.analysis_id and cast(r.lastupdated as date) BETWEEN '#startDate#' and '#endDate#' and r.value != '' | ||
LEFT OUTER JOIN result r1 ON r1.result_type = 'D' and r1.value != '' and r.id=r1.id and r1.abnormal=false | ||
LEFT OUTER JOIN result r2 on r2.result_type = 'D' and r2.value != '' and r.id=r2.id and r2.abnormal=true | ||
GROUP BY ts.name, t.name, t.id | ||
order by ts.name; | ||
SELECT DATE(lastupdated) AS "Date", | ||
COUNT(id) AS "Number of Test Results Captured" | ||
FROM result | ||
WHERE DATE(lastupdated) BETWEEN '#startDate#' AND '#endDate#' | ||
GROUP BY DATE(lastupdated) | ||
ORDER BY DATE(lastupdated) ASC; |