Added ability to toggle between one big closing ledger entry, and one per house

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@390 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-25 08:08:47 +00:00
parent f9635419dd
commit d4292a85a0
2 changed files with 22 additions and 10 deletions

View File

@@ -4,8 +4,7 @@ use DBI;
use Data::Dumper;
use File::Copy;
my $use_invoice = 0;
my $use_receipt = 1;
my $closing_one_transaction = 0;
# Internally adjust all numbers coming from the database to
# be in inches. Not necessary to go to this detail, but the
@@ -1266,7 +1265,7 @@ foreach $row (@{query($sdbh, $query)}) {
# Special case for closing
if ($stamp eq $newdb{'lookup'}{'_closing'}{'stamp'}) {
if ($closing_one_transaction && $stamp eq $newdb{'lookup'}{'_closing'}{'stamp'}) {
$newdb{'lookup'}{'_closing'}{'transaction_id'} =
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'receipt_id'};
$newdb{'lookup'}{'_closing'}{'debit_entry_id'} =
@@ -1342,12 +1341,16 @@ foreach $row (@{query($sdbh, $query)})
######################################################################
## Special case - Fix the entries for our closing transaction
$newdb{'tables'}{'ledger_entries'}{'rows'}[
$newdb{'lookup'}{'_closing'}{'debit_entry_id'}
]{'amount'} = $newdb{'lookup'}{'_closing'}{'amount'};
$newdb{'tables'}{'ledger_entries'}{'rows'}[
$newdb{'lookup'}{'_closing'}{'credit_entry_id'}
]{'amount'} = $newdb{'lookup'}{'_closing'}{'amount'};
if ($newdb{'lookup'}{'_closing'}{'debit_entry_id'}) {
$newdb{'tables'}{'ledger_entries'}{'rows'}[
$newdb{'lookup'}{'_closing'}{'debit_entry_id'}
]{'amount'} = $newdb{'lookup'}{'_closing'}{'amount'};
}
if ($newdb{'lookup'}{'_closing'}{'credit_entry_id'}) {
$newdb{'tables'}{'ledger_entries'}{'rows'}[
$newdb{'lookup'}{'_closing'}{'credit_entry_id'}
]{'amount'} = $newdb{'lookup'}{'_closing'}{'amount'};
}
######################################################################