I'm working on a pledge query for finance. I'm able to find all of the components of the pledge and payments EXCEPT for the actual date that the payment was received.
The script I've developed for this is below. Any suggestions would be greatly appreciated. Thank you.
Clint DawleyDallas Zoo
SELECT c.lname, c.fname, a.ref_no, a.customer_no, CONVERT(DATE,b.due_dt) as date_due, CONVERT(DATE,a.cont_dt) as pledge_date, b.amt_due as pledge_payment_amount_due, b.amt_recd as pledge_payment_amount_received, CONVERT(DATE,b.due_dt) as pledge_payment_due_date,d.description as pledge_status, CAST(a.recd_amt as money) as total_amount_received, CAST(a.cont_amt as money) as original_pledge_amount, a.cont_amt - a.recd_amt as pledge_balance,g.description as campaign_description, h.description as appeal_description, i.description as fund_description, e.street1, e.street2, e.street3, e.city, e.state, LEFT(e.postal_code, 5) + '-' + RIGHT(e.postal_code,4) as postal_code, f.address as emailFROM T_CONTRIBUTION a JOIN T_SCHEDULE b on a.ref_no = b.ref_noJOIN T_CUSTOMER c on a.customer_no = c.customer_noLEFT JOIN TR_PLEDGE_STATUS d on a.pledge_status = d.idJOIN T_ADDRESS e on c.customer_no = e.customer_no and primary_ind = 'Y'LEFT JOIN T_EADDRESS f on c.customer_no = f.customer_no and f.primary_ind = 'Y'JOIN T_CAMPAIGN g on a.campaign_no = g.campaign_noJOIN T_APPEAL h on a.appeal_no = h.appeal_noJOIN T_FUND i on a.fund_no = i.fund_noWHERE a.cont_type = 'P' and a.recd_amt <> a.cont_amt and a.campaign_no = 8
You may need to look at T_TRANSACTION for that.
Much thanks, Sir. Appreciated.
And thanks for the code Clint. I've borrowed it and turned it into a lovely SSRS report. My Philanthropy team send their thanks.
What I noticed is that unfortunately the transaction_no in T_SCHEDULE is inherited from T_CONTRIBUTION and not the individual payment transaction_no in T_TRANSACTION
The issue I'm still having problems with is taking the pledge payment date from T_TRANSACTION and joining it to the above. Were you able to find a way to do this and if so will you share the code for your solution? Have a great day!C
Clint,
My memory is that T_SCHEDULE simply doesn't connect to actual payments in any satisfying way. I'll try looking through my notes later today.
--Gawain