Skip to content

Commit

Permalink
20069 - All Partners Monthly reports with details of transactions (#1574
Browse files Browse the repository at this point in the history
)

* updated %%sql monthly_reconciliation_summary  <<

* updated monthly_reconciliation_disbursed to consider 5 processing days
  • Loading branch information
hanlunBCRegistries authored Jun 18, 2024
1 parent c6084bf commit 997bec9
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions jobs/notebook-report/monthly/cso_reconciliation_summary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"outputs": [],
"source": [
"%%sql\n",
"select now() AT TIME ZONE 'PST' as current_date"
"set time zone 'UTC';"
]
},
{
Expand All @@ -161,14 +161,26 @@
"outputs": [],
"source": [
"%%sql monthly_reconciliation_summary <<\n",
"SELECT count(*) as transaction_count, sum(total - service_fees) as subtotal, sum(service_fees) as service_fees, sum(total) as total, (created_on)::date, payment_method_code, corp_type_code\n",
"FROM invoices\n",
"WHERE corp_type_code = :partner_code\n",
"AND invoice_status_code = 'PAID'\n",
"AND payment_method_code in ('PAD','EJV', 'DRAWDOWN')\n",
"AND date(created_on) > date(current_date - 1 - interval '1 months')\n",
"AND date(created_on) <= date(current_date - 1)\n",
"GROUP BY (created_on)::date, payment_method_code, corp_type_code;"
"SELECT \n",
" id, \n",
" (created_on AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver')::date AS created_date, \n",
" total, \n",
" service_fees, \n",
" payment_method_code, \n",
" corp_type_code, \n",
" created_by, \n",
" payment_date\n",
"FROM \n",
" invoices\n",
"WHERE \n",
" corp_type_code = 'CSO'\n",
" AND total > 0\n",
" AND invoice_status_code = 'PAID'\n",
" AND payment_method_code in ('PAD','EJV')\n",
" AND created_on AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver' > (current_date - 1 - interval '1 months' - interval '5 days')::date\n",
" AND created_on AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver' <= (current_date - 1)::date\n",
"ORDER BY \n",
" 1;"
]
},
{
Expand Down Expand Up @@ -213,15 +225,15 @@
"outputs": [],
"source": [
"%%sql monthly_reconciliation_disbursed <<\n",
"SELECT count(*) as transaction_count, sum(total - service_fees) as subtotal, sum(service_fees) as service_fees, sum(total) as total, (updated_on)::date, payment_method_code, corp_type_code\n",
"SELECT id, (disbursement_date AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver')::date, total, service_fees, payment_method_code, corp_type_code,created_by\n",
"FROM invoices\n",
"WHERE corp_type_code = :partner_code\n",
"WHERE corp_type_code = 'CSO'\n",
"AND invoice_status_code = 'PAID'\n",
"AND payment_method_code in ('PAD','EJV')\n",
"AND disbursement_status_code = 'COMPLETED'\n",
"AND date(updated_on) > date(current_date - 1 - interval '1 months')\n",
"AND date(updated_on) <= date(current_date - 1)\n",
"GROUP BY (updated_on)::date, payment_method_code, corp_type_code;"
"AND disbursement_date AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver' > (current_date - 1 - interval '1 months')::date\n",
"AND disbursement_date AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver' <= (current_date - 1)::date\n",
"order by 1;"
]
},
{
Expand Down

0 comments on commit 997bec9

Please sign in to comment.