Skip to content

Commit

Permalink
Merge pull request #1864 from patryllus/monthly-revenue-report
Browse files Browse the repository at this point in the history
Updated monthly revenue summaries to include totals per reporting period
  • Loading branch information
njorocs authored Apr 19, 2024
2 parents 0f1e89b + 2118a4f commit 5ef2cb9
Showing 1 changed file with 63 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,69 @@

public class FacilityRevenueSummaries {
public static final String getMonthlySummaryQueryM1() {
return "SELECT transaction_date,\n" +
" total_sales,\n" +
" ipd_cash,\n" +
" maternity,\n" +
" xray,\n" +
" lab,\n" +
" theatre,\n" +
" mortuary,\n" +
" op_treatment,\n" +
" pharmacy,\n" +
" medical_exam,\n" +
" medical_reports_including_P3,\n" +
" dental,\n" +
" physio_therapy,\n" +
" occupational_therapy,\n" +
" medical_records_cards_and_files,\n" +
" booking_fees,\n" +
" rental_services,\n" +
" ambulance,\n" +
" public_health_services,\n" +
" ent_and_other_clinics,\n" +
" other,\n" +
" cash_receipts_cash_from_daily_services,\n" +
" cash_receipt_nhif_receipt,\n" +
" cash_receipt_other_debtors_receipt,\n" +
" revenue_not_collected_patient_not_yet_paid_nhif_patients,\n" +
" revenue_not_collected_patient_not_yet_paid_other_debtors,\n" +
" revenue_not_collected_patient_not_yet_paid_waivers,\n" +
" revenue_not_collected_write_offs_exemptions,\n" +
" revenue_not_collected_write_offs_absconders\n" +
" FROM kenyaemr_etl.etl_daily_revenue_summary dr WHERE dr.transaction_date BETWEEN :startDate AND :endDate";
return "select tbl.transaction_date as transaction_date,\n" +
" SUM(tbl.total_sales) as total_sales,\n" +
" SUM(tbl.ipd_cash) as ipd_cash,\n" +
" SUM(tbl.maternity) as maternity,\n" +
" SUM(tbl.xray) as xray,\n" +
" SUM(tbl.lab) as lab,\n" +
" SUM(tbl.theatre) as theatre,\n" +
" SUM(tbl.mortuary) as mortuary,\n" +
" SUM(tbl.op_treatment) as op_treatment,\n" +
" SUM(tbl.pharmacy) as pharmacy,\n" +
" SUM(tbl.medical_exam) as medical_exam,\n" +
" SUM(tbl.medical_reports_including_P3) as medical_reports_including_P3,\n" +
" SUM(tbl.dental) as dental,\n" +
" SUM(tbl.physio_therapy) as physio_therapy,\n" +
" SUM(tbl.occupational_therapy) as occupational_therapy,\n" +
" SUM(tbl.medical_records_cards_and_files) as medical_records_cards_and_files,\n" +
" SUM(tbl.booking_fees) as booking_fees,\n" +
" SUM(tbl.rental_services) as rental_services,\n" +
" SUM(tbl.ambulance) as ambulance,\n" +
" SUM(tbl.public_health_services) as public_health_services,\n" +
" SUM(tbl.ent_and_other_clinics) as ent_and_other_clinics,\n" +
" SUM(tbl.other) as other,\n" +
" SUM(tbl.cash_receipts_cash_from_daily_services) as cash_receipts_cash_from_daily_services,\n" +
" SUM(tbl.cash_receipt_nhif_receipt) as cash_receipt_nhif_receipt,\n" +
" SUM(tbl.cash_receipt_other_debtors_receipt) as cash_receipt_other_debtors_receipt,\n" +
" SUM(tbl.revenue_not_collected_patient_not_yet_paid_nhif_patients) as revenue_not_collected_patient_not_yet_paid_nhif_patients,\n" +
" SUM(tbl.revenue_not_collected_patient_not_yet_paid_other_debtors) as revenue_not_collected_patient_not_yet_paid_other_debtors,\n" +
" SUM(tbl.revenue_not_collected_patient_not_yet_paid_waivers) as revenue_not_collected_patient_not_yet_paid_waivers,\n" +
" SUM(tbl.revenue_not_collected_write_offs_exemptions) as revenue_not_collected_write_offs_exemptions,\n" +
" SUM(tbl.revenue_not_collected_write_offs_absconders) as revenue_not_collected_write_offs_absconders\n" +
"from (\n" +
" select transaction_date,\n" +
" total_sales,\n" +
" ipd_cash,\n" +
" maternity,\n" +
" xray,\n" +
" lab,\n" +
" theatre,\n" +
" mortuary,\n" +
" op_treatment,\n" +
" pharmacy,\n" +
" medical_exam,\n" +
" medical_reports_including_P3,\n" +
" dental,\n" +
" physio_therapy,\n" +
" occupational_therapy,\n" +
" medical_records_cards_and_files,\n" +
" booking_fees,\n" +
" rental_services,\n" +
" ambulance,\n" +
" public_health_services,\n" +
" ent_and_other_clinics,\n" +
" other,\n" +
" cash_receipts_cash_from_daily_services,\n" +
" cash_receipt_nhif_receipt,\n" +
" cash_receipt_other_debtors_receipt,\n" +
" revenue_not_collected_patient_not_yet_paid_nhif_patients,\n" +
" revenue_not_collected_patient_not_yet_paid_other_debtors,\n" +
" revenue_not_collected_patient_not_yet_paid_waivers,\n" +
" revenue_not_collected_write_offs_exemptions,\n" +
" revenue_not_collected_write_offs_absconders\n" +
" FROM kenyaemr_etl.etl_daily_revenue_summary dr WHERE dr.transaction_date BETWEEN :startDate AND :endDate\n" +
" ) tbl group by transaction_date WITH ROLLUP ;";
}

public static final String getMonthlySummaryQueryM2() {
Expand Down

0 comments on commit 5ef2cb9

Please sign in to comment.