First pass implementation at generating an invoice, which seems to be working. Largely untested, but worth checking in. Next is to get receipts using the same algorithm, and after that will be to work on a reconciling mechanism, creating payments, and matching them to charges. This checkin includes an additional customer_id fields as part of the transactions table. I think it was an oversight not to be there, as we need some way to keep track of monies which have been paid by a customer, yet not applied. If there is a different way to do it (short of actually having each ledger entry hold customer_id), it escapes me at the moment.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@372 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-23 21:24:49 +00:00
parent 708759765f
commit 04bc284a76
4 changed files with 324 additions and 67 deletions

View File

@@ -915,6 +915,7 @@ foreach $row (@{query($sdbh, $query)}) {
addRow('transactions', {
'type' => 'INVOICE',
'stamp' => $stamp,
'customer_id' => $newdb{'lookup'}{'ledger'}{$row->{'LedgerID'}}{'customer_id'},
'account_id' => $newdb{'lookup'}{'account'}{'A/R'}{'account_id'},
'ledger_id' => $newdb{'lookup'}{'account'}{'A/R'}{'ledger_id'},
'crdr' => 'DEBIT',
@@ -1109,6 +1110,7 @@ foreach $row (@{query($sdbh, $query)}) {
addRow('transactions', {
'type' => 'RECEIPT',
'stamp' => $stamp,
'customer_id' => undef, # Must be set later
'account_id' => $newdb{'lookup'}{'account'}{'A/R'}{'account_id'},
'ledger_id' => $newdb{'lookup'}{'account'}{'A/R'}{'ledger_id'},
'crdr' => 'CREDIT',
@@ -1200,7 +1202,12 @@ foreach $row (@{query($sdbh, $query)})
'account_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'credit_account_id'},
};
# Update the receipt customer_id, now that we have payment info
$newdb{'tables'}{'transactions'}{'rows'}[
$newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}{'receipt_id'}
]{'customer_id'} = $newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}{'customer_id'};
# Use the Memo as our comment, if it exists
my $comment = $row->{'Memo'} || "Payment: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}";
# Add the Payment Statement Entry