<div dir="ltr"><div dir="ltr" class="gmail_attr"><div>Hi,</div><div><br></div>On Thu, Jan 16, 2020 at 12:42 PM Tiffany Little <<a href="mailto:tlittle@georgialibraries.org">tlittle@georgialibraries.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:tahoma,sans-serif;font-size:small">Thank you, Galen! Even if this isn't very functional--depending on testing it, which I now absolutely want to do--it's cool to know that it exists.</div></div></blockquote></div><div><br></div><div>Great, I'll be curious to hear what you find out when you try.</div><div><br></div><div>For reference, here's the code comment describing the stored procedure's calculation:<br><br>"Function to attribute expenditures and encumbrances to funding source credits,<br>and thereby to funding sources.<br><br>Read the debits in chonological order, attributing each one to one or<br>more funding source credits.  Constraints:<br><br>1. Don't attribute more to a credit than the amount of the credit.<br><br>2. For a given fund, don't attribute more to a funding source than the<br>source has allocated to that fund.<br><br>3. Attribute debits to credits with deadlines before attributing them to<br>credits without deadlines.  Otherwise attribute to the earliest credits<br>first, based on the deadline date when present, or on the effective date<br>when there is no deadline.  Use <a href="http://funding_source_credit.id">funding_source_credit.id</a> as a tie-breaker.<br>This ordering is defined by an ORDER BY clause on the view<br>acq.ordered_funding_source_credit.<br><br>Start by truncating the table acq.debit_attribution.  Then insert a row<br>into that table for each attribution.  If a debit cannot be fully<br>attributed, insert a row for the unattributable balance, with the<br>funding_source_credit and credit_amount columns NULL."</div><div><br></div><div>Caveat: I have not examined the code to try to verify whether the comment matches reality.<br></div><div><br></div><div>Regards,</div><div><br></div><div>Galen<br></div><div>-- </div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Galen Charlton<br>Implementation and Services Manager<br>Equinox Open Library Initiative<br>phone:  1-877-OPEN-ILS (673-6457)<br>email:  gmc@equinoxInitiative.org<br>web:  <a href="https://equinoxInitiative.org" target="_blank">https://equinoxInitiative.org</a><br>direct: +1 770-709-5581<br>cell:   +1 404-984-4366</div></div></div></div>