From: Bill Erickson Date: Thu, 11 Oct 2018 15:02:58 +0000 (-0400) Subject: JBAS-2101 Use all_payments; receipt updates X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0b123738e1a5dfe26a49b6e1258eebf589612cb8;p=working%2FEvergreen.git JBAS-2101 Use all_payments; receipt updates Reference money.all_payments view to pick up aged payments. Remove staff initials from receipts. Add Final vs. Partial payment info to receipts. Signed-off-by: Bill Erickson --- diff --git a/KCLS/sql/schema/deploy/lost-paid-receipts-data.sql b/KCLS/sql/schema/deploy/lost-paid-receipts-data.sql index 1fdda60ee7..bbda897edb 100644 --- a/KCLS/sql/schema/deploy/lost-paid-receipts-data.sql +++ b/KCLS/sql/schema/deploy/lost-paid-receipts-data.sql @@ -160,12 +160,18 @@ $TEMPLATE$ - Paid At - [% mrps.payment_ou.name %] + Partial/Final Payment? + + [%- IF mrps.final_payment == 't' -%] + Final Payment + [%- ELSE -%] + Partial Payment + [%- END -%] + - Payment Accepted By - [% helpers.name_to_initials(mrps.staff_name) %] + Paid At + [% mrps.payment_ou.name %] Payment Date @@ -260,8 +266,8 @@ Payment Type: [% SWITCH mrps.payment_type -%] [%- CASE "credit_card_payment" %]Credit Card [%- CASE ; mrps.payment_type -%] [%- END %] +Partial/Final Payment?: [% mrps.final_payment == 't' ? 'Final Payment' : 'Partial Payment' %] Paid At: [% mrps.payment_ou.name %] -Payment Accepted By: [% helpers.name_to_initials(mrps.staff_name) %] Payment Date: [% date.format(helpers.format_date(mrps.payment_time), '%m/%d/%Y %l:%M %p') %] Receipt Printed On: [% date.format(date.now, '%m/%d/%Y %l:%M %p') %] diff --git a/KCLS/sql/schema/deploy/lost-paid-receipts.sql b/KCLS/sql/schema/deploy/lost-paid-receipts.sql index a70181f920..6a11e38819 100644 --- a/KCLS/sql/schema/deploy/lost-paid-receipts.sql +++ b/KCLS/sql/schema/deploy/lost-paid-receipts.sql @@ -99,12 +99,12 @@ CREATE OR REPLACE VIEW money.refundable_xact_summary AS ON (summary.id = xact.id) JOIN ( SELECT pay.xact, SUM(pay.amount) amount - FROM money.payment pay WHERE amount > 0 GROUP BY 1 + FROM money.all_payments pay WHERE amount > 0 GROUP BY 1 ) total_paid ON (total_paid.xact = xact.xact) JOIN ( SELECT mrp.refundable_xact, SUM(pay.amount) AS amount FROM money.refundable_payment mrp - JOIN money.payment pay ON (mrp.payment = pay.id) + JOIN money.all_payments pay ON (mrp.payment = pay.id) GROUP BY 1 ) refundable_paid ON (refundable_paid.refundable_xact = xact.id) LEFT JOIN ( @@ -129,12 +129,11 @@ CREATE OR REPLACE VIEW money.refundable_payment_summary AS LPAD(mrp.receipt_number::TEXT, 6, '0') AS receipt_code, pay.payment_ts AS payment_time, pay.amount AS amount, - pview.payment_type, + pay.payment_type, aws.name AS workstation FROM money.refundable_payment mrp - JOIN money.payment pay ON (pay.id = mrp.payment) + JOIN money.all_payments pay ON (pay.id = mrp.payment) JOIN actor.org_unit aou ON (aou.id = mrp.payment_ou) - JOIN money.payment_view pview ON (pview.id = pay.id) LEFT JOIN money.cash_payment cash ON (cash.id = pay.id) LEFT JOIN actor.workstation aws ON (aws.id = cash.cash_drawer) ;