Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20069 - All Partners Monthly reports with details of transactions #1574

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading