Adjusted formatting only

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@357 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-21 02:55:43 +00:00
parent c002f3f3ba
commit ae5d4763f9

View File

@@ -302,33 +302,33 @@ executeSchema();
#################################################################
## Test Contact
addRow('contacts',
{ 'first_name' => 'Abijah',
addRow('contacts', {
'first_name' => 'Abijah',
# 'middle_name' => 'M',
'last_name' => 'Perkins' });
addRow('contact_addresses',
{ 'address' => '1324 N Liberty Lake Rd\nPMB 263',
addRow('contact_addresses', {
'address' => '1324 N Liberty Lake Rd\nPMB 263',
'city' => 'Liberty Lake',
'state' => 'WA',
'postcode' => '99019',
'country' => 'USA' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
'method' => 'ADDRESS',
'type' => 'MAIN',
'preference' => 'PRIMARY' },
1);
addRow('contact_addresses',
{ 'address' => '5221 W Myrtlewood Ct',
addRow('contact_addresses', {
'address' => '5221 W Myrtlewood Ct',
'city' => 'Spokane',
'state' => 'WA',
'postcode' => '99208',
'country' => 'USA' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
'method' => 'ADDRESS',
'type' => 'HOME',
@@ -349,33 +349,33 @@ addRow('contacts_methods',
# 'preference' => 'ALTERNATE' },
# 1);
addRow('contact_phones',
{ 'type' => 'MOBILE',
addRow('contact_phones', {
'type' => 'MOBILE',
'phone' => '5098445573' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_phones'}{'autoid'},
'method' => 'PHONE',
'type' => 'MAIN',
'preference' => 'PRIMARY' },
1);
addRow('contact_phones',
{ 'type' => 'MOBILE',
addRow('contact_phones', {
'type' => 'MOBILE',
'phone' => '5098445973' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_phones'}{'autoid'},
'method' => 'PHONE',
'type' => 'MAIN',
'preference' => 'ALTERNATE' },
1);
addRow('contact_phones',
{ 'type' => 'VIRTUAL',
addRow('contact_phones', {
'type' => 'VIRTUAL',
'phone' => '5095901112' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_phones'}{'autoid'},
'method' => 'PHONE',
'type' => 'BUSINESS',
@@ -393,52 +393,52 @@ addRow('contacts_methods',
# 'preference' => 'ALTERNATE' },
# 1);
addRow('contact_phones',
{ 'type' => 'VIRTUAL',
addRow('contact_phones', {
'type' => 'VIRTUAL',
'phone' => '8774488664' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_phones'}{'autoid'},
'method' => 'PHONE',
'type' => 'BUSINESS',
'preference' => 'WORK' },
1);
addRow('contact_phones',
{ 'type' => 'FAX',
addRow('contact_phones', {
'type' => 'FAX',
'phone' => '8662960131' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_phones'}{'autoid'},
'method' => 'PHONE',
'type' => 'BUSINESS',
'preference' => 'WORK' },
1);
addRow('contact_emails',
{ 'email' => 'abijah\@PerkinsHouse.com' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contact_emails', {
'email' => 'abijah\@PerkinsHouse.com' });
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_emails'}{'autoid'},
'method' => 'EMAIL',
'type' => 'HOME',
'preference' => 'PRIMARY' },
1);
addRow('contact_emails',
{ 'email' => 'abijah\@PerkinsREI.com' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contact_emails', {
'email' => 'abijah\@PerkinsREI.com' });
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_emails'}{'autoid'},
'method' => 'EMAIL',
'type' => 'HOME',
'preference' => 'WORK' },
1);
addRow('contact_emails',
{ 'email' => 'abijah\@ValleyStorage.info' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
addRow('contact_emails', {
'email' => 'abijah\@ValleyStorage.info' });
addRow('contacts_methods', {
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'},
'method_id' => $newdb{'tables'}{'contact_emails'}{'autoid'},
'method' => 'EMAIL',
'type' => 'BUSINESS',
@@ -449,11 +449,11 @@ addRow('contacts_methods',
#################################################################
## GROUPS
addRow('groups',
{ 'code' => 'Owner',
addRow('groups', {
'code' => 'Owner',
'name' => 'Owner Group' });
addRow('group_permissions',
{ 'group_id' => $newdb{'tables'}{'groups'}{'autoid'},
addRow('group_permissions', {
'group_id' => $newdb{'tables'}{'groups'}{'autoid'},
'name' => 'EVERYTHING',
'access' => 'FORCED' },
1);
@@ -462,8 +462,8 @@ addRow('group_permissions',
#################################################################
## USERS
addRow('users',
{ 'code' => 'AP',
addRow('users', {
'code' => 'AP',
'login' => 'abijah',
'contact_id' => $newdb{'tables'}{'contacts'}{'autoid'} });
@@ -471,18 +471,18 @@ addRow('users',
#################################################################
## SITES
addRow('sites',
{ 'code' => 'VSS',
addRow('sites', {
'code' => 'VSS',
'name' => 'Valley Storage' });
addRow('site_memberships',
{ 'site_id' => $newdb{'tables'}{'sites'}{'autoid'},
addRow('site_memberships', {
'site_id' => $newdb{'tables'}{'sites'}{'autoid'},
'user_id' => $newdb{'tables'}{'users'}{'autoid'},
'group_id' => $newdb{'tables'}{'groups'}{'autoid'} },
1);
addRow('site_areas',
{ 'site_id' => $newdb{'tables'}{'sites'}{'autoid'},
addRow('site_areas', {
'site_id' => $newdb{'tables'}{'sites'}{'autoid'},
'code' => 'Main',
'name' => 'Main Facility Area' });
@@ -490,8 +490,8 @@ addRow('site_areas',
#################################################################
## LEASES
addRow('lease_types',
{ 'code' => 'SL',
addRow('lease_types', {
'code' => 'SL',
'name' => 'Storage Lease' });
@@ -503,8 +503,8 @@ $newdb{'lookup'}{'account'} = {};
$query = "SELECT * FROM pmgr_accounts";
$result = query($db_handle, $query);
foreach $row (@$result) {
addRow('ledgers',
{ 'account_id' => $row->{'id'},
addRow('ledgers', {
'account_id' => $row->{'id'},
'comment' => undef });
$newdb{'lookup'}{'account'}{$row->{'name'}}
@@ -606,8 +606,8 @@ $newdb{'lookup'}{'unit_type'} = {};
$query = "SELECT * FROM UnitType ORDER BY TypeID";
foreach $row (@{query($sdbh, $query)}) {
addRow('unit_types',
{ 'code' => 'xxx',
addRow('unit_types', {
'code' => 'xxx',
'name' => $row->{'UnitType'} });
$newdb{'lookup'}{'unit_type'}{$row->{'TypeID'}} =
$newdb{'tables'}{'unit_types'}{'autoid'};
@@ -623,8 +623,8 @@ foreach $row (@{query($sdbh, $query)}) {
my $sz = sizeCode($row->{'Width'}, $row->{'Depth'});
next if defined $newdb{'lookup'}{'unit_size'}{$sz};
addRow('unit_sizes',
{ 'unit_type_id' => $row->{'Type'},
addRow('unit_sizes', {
'unit_type_id' => $row->{'Type'},
'code' => $sz,
'name' => $sz,
'width' => $internal_adjustment_factor * $row->{'Width'},
@@ -647,8 +647,8 @@ foreach $row (@{query($sdbh, $query)}) {
my $sz = sizeCode($row->{'Width'}, $row->{'Depth'});
my $szid = $newdb{'lookup'}{'unit_size'}{$sz}{'id'};
addRow('units',
{ 'unit_size_id' => $szid,
addRow('units', {
'unit_size_id' => $szid,
'code' => $row->{'UnitID'},
'name' => $row->{'UnitID'},
'status' => $row->{'Rented'} ?'OCCUPIED' :($row->{'Rentable'} ?'VACANT' :'UNAVAILABLE'),
@@ -686,8 +686,8 @@ $info{'extents'}{'left'} = 0;
$info{'extents'}{'bottom'} = $internal_adjustment_factor * ($top_adjustment + $row->{'bot'} + 0);
$info{'extents'}{'right'} = $internal_adjustment_factor * ($left_adjustment + $row->{'rgt'} + 0);
addRow('maps',
{ 'name' => 'Main Facility Map',
addRow('maps', {
'name' => 'Main Facility Map',
'site_area_id' => $newdb{'tables'}{'site_areas'}{'autoid'},
'width' => $info{'extents'}{'right'} - $info{'extents'}{'left'},
'depth' => $info{'extents'}{'bottom'} - $info{'extents'}{'top'} });
@@ -703,8 +703,8 @@ $query .= " FROM UnitInfo U INNER JOIN mapUnitsV2 M ON M.unitID = U.UnitID";
# Go through each one, calculating the map location
foreach $row (@{query($sdbh, $query)}) {
addRow('maps_units',
{ 'map_id' => $newdb{'tables'}{'maps'}{'autoid'},
addRow('maps_units', {
'map_id' => $newdb{'tables'}{'maps'}{'autoid'},
'unit_id' => $newdb{'lookup'}{'unit'}{$row->{'UnitID'}}{'id'},
'pt_top' => $internal_adjustment_factor * ($row->{'pt_t'}),
'pt_left' => $internal_adjustment_factor * ($row->{'pt_l'}),
@@ -734,8 +734,8 @@ foreach $row (@{query($sdbh, $query)}) {
$newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}
= { 'name' => "$row->{'LastName'}, $row->{'FirstName'}" };
addRow('contacts',
{ 'first_name' => $row->{'FirstName'},
addRow('contacts', {
'first_name' => $row->{'FirstName'},
'middle_name' => $row->{'MiddleName'},
'last_name' => $row->{'LastName'},
'id_local' => $row->{'IDNum'} || undef,
@@ -744,29 +744,29 @@ foreach $row (@{query($sdbh, $query)}) {
$newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'} =
$newdb{'tables'}{'contacts'}{'autoid'};
addRow('customers',
{ 'name' => "$row->{'LastName'}, $row->{'FirstName'}",
addRow('customers', {
'name' => "$row->{'LastName'}, $row->{'FirstName'}",
'primary_contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
});
$newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'customer_id'} =
$newdb{'tables'}{'customers'}{'autoid'};
addRow('contacts_customers',
{ 'customer_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'customer_id'},
addRow('contacts_customers', {
'customer_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'customer_id'},
'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
'type' => 'TENANT' },
1);
if ($row->{'City'}) {
addRow('contact_addresses',
{ 'address' => $row->{'HomeAddress'} . ($row->{'HomeAddr2'} ? "\n".$row->{'HomeAddr2'} : "") || undef,
addRow('contact_addresses', {
'address' => $row->{'HomeAddress'} . ($row->{'HomeAddr2'} ? "\n".$row->{'HomeAddr2'} : "") || undef,
'city' => $row->{'City'},
'state' => $newdb{'lookup'}{'state'}{$row->{'StateID'}},
'postcode' => $row->{'Zip'} || undef,
'country' => 'USA' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
addRow('contacts_methods', {
'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
'method' => 'ADDRESS',
'type' => 'HOME',
@@ -782,12 +782,12 @@ foreach $row (@{query($sdbh, $query)}) {
{'type' => 'MOBILE', 'preference' => 'ALTERNATE', 'phone' => $row->{'CellPhone'}})
{
if ($_->{'phone'}) {
addRow('contact_phones',
{ 'type' => $_->{'type'},
addRow('contact_phones', {
'type' => $_->{'type'},
'phone' => $_->{'phone'},
'ext' => $_->{'ext'} });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
addRow('contacts_methods', {
'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
'method_id' => $newdb{'tables'}{'contact_phones'}{'autoid'},
'method' => 'PHONE',
'type' => 'MAIN',
@@ -797,10 +797,10 @@ foreach $row (@{query($sdbh, $query)}) {
}
if ($row->{'Email'}) {
addRow('contact_emails',
{ 'email' => $row->{'Email'} });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
addRow('contact_emails', {
'email' => $row->{'Email'} });
addRow('contacts_methods', {
'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'id'},
'method_id' => $newdb{'tables'}{'contact_emails'}{'autoid'},
'method' => 'EMAIL',
'type' => 'MAIN',
@@ -810,29 +810,29 @@ foreach $row (@{query($sdbh, $query)}) {
next unless $row->{'AltFirstName'} || $row->{'AltLastName'} || $row->{'AltAddress'} || $row->{'AltPhone'};
addRow('contacts',
{ 'first_name' => $row->{'AltFirstName'} || undef,
addRow('contacts', {
'first_name' => $row->{'AltFirstName'} || undef,
'middle_name' => $row->{'AltMI'} || undef,
'last_name' => $row->{'AltLastName'} || undef });
$newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'alt'} =
$newdb{'tables'}{'contacts'}{'autoid'};
addRow('contacts_customers',
{ 'customer_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'customer_id'},
addRow('contacts_customers', {
'customer_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'customer_id'},
'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'alt'},
'type' => 'ALTERNATE' },
1);
if ($row->{'AltCity'}) {
addRow('contact_addresses',
{ 'address' => $row->{'AltAddress'} . ($row->{'AltAddr2'} ? "\n".$row->{'AltAddr2'} : ""),
addRow('contact_addresses', {
'address' => $row->{'AltAddress'} . ($row->{'AltAddr2'} ? "\n".$row->{'AltAddr2'} : ""),
'city' => $row->{'AltCity'},
'state' => $newdb{'lookup'}{'state'}{$row->{'AltStateID'}},
'postcode' => $row->{'AltZip'},
'country' => 'USA' });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'alt'},
addRow('contacts_methods', {
'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'alt'},
'method_id' => $newdb{'tables'}{'contact_addresses'}{'autoid'},
'method' => 'ADDRESS',
'type' => 'MAIN',
@@ -841,12 +841,12 @@ foreach $row (@{query($sdbh, $query)}) {
}
if ($row->{'AltPhone'}) {
addRow('contact_phones',
{ 'type' => 'LANDLINE',
addRow('contact_phones', {
'type' => 'LANDLINE',
'phone' => $row->{'AltPhone'},
'ext' => undef });
addRow('contacts_methods',
{ 'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'alt'},
addRow('contacts_methods', {
'contact_id' => $newdb{'lookup'}{'tenant'}{$row->{'TenantID'}}{'alt'},
'method_id' => $newdb{'tables'}{'contact_phones'}{'autoid'},
'method' => 'PHONE',
'type' => 'MAIN',
@@ -869,8 +869,8 @@ foreach $row (@{query($sdbh, $query)}) {
'lease_date' => $row->{'DateIn'},
};
addRow('leases',
{ 'number' => $newdb{'tables'}{'leases'}{'autoid'}+1,
addRow('leases', {
'number' => $newdb{'tables'}{'leases'}{'autoid'}+1,
#'number' => $row->{'LedgerID'},
'lease_type_id' => $newdb{'tables'}{'lease_types'}{'autoid'},
'unit_id' => $newdb{'lookup'}{'unit'}{$row->{'UnitID'}}{'id'},
@@ -911,8 +911,8 @@ foreach $row (@{query($sdbh, $query)}) {
dates('invoice', $row->{'ChargeDate'}, $row->{'EndDate'},
$row->{'ChargeDescription'}, $row->{'LedgerID'});
addRow('transactions',
{ 'type' => 'INVOICE',
addRow('transactions', {
'type' => 'INVOICE',
'stamp' => $stamp,
#'amount' => $row->{'InvoiceAmount'},
#'comment' => "Invoice Transaction",
@@ -965,8 +965,8 @@ foreach $row (@{query($sdbh, $query)}) {
= $newdb{'lookup'}{'account'}{'A/R'}{'ledger_id'};
# debit: A/R credit: Rent/LateCharge/Etc
addRow('double_entries',
{ 'transaction_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'invoice'}{'id'},
addRow('double_entries', {
'transaction_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'invoice'}{'id'},
'effective_date' => $effective_date,
'customer_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'customer_id'},
'lease_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'lease_id'},
@@ -975,12 +975,13 @@ foreach $row (@{query($sdbh, $query)}) {
'amount' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'amount'},
'comment' => "Double Entry: $row->{'ChargeID'}; Ledger: $row->{'LedgerID'}",
});
$newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'double_entry_id'}
= $newdb{'tables'}{'double_entries'}{'autoid'};
# Add the Charge Entry
addRow('entries',
{ 'type' => 'CHARGE',
addRow('entries', {
'type' => 'CHARGE',
'through_date' => $through_date,
'double_entry_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'double_entry_id'},
'account_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'credit_account_id'},
@@ -993,8 +994,8 @@ foreach $row (@{query($sdbh, $query)}) {
= $newdb{'tables'}{'entries'}{'autoid'};
# Add the A/R entry
addRow('entries',
{ 'type' => 'TRANSFER',
addRow('entries', {
'type' => 'TRANSFER',
'double_entry_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'double_entry_id'},
'account_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'debit_account_id'},
'ledger_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'debit_ledger_id'},
@@ -1181,8 +1182,8 @@ foreach $row (@{query($sdbh, $query)}) {
if ($newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'type'}
== 'Concession');
addRow('transactions',
{ 'type' => 'RECEIPT',
addRow('transactions', {
'type' => 'RECEIPT',
'stamp' => $stamp,
});
@@ -1206,8 +1207,8 @@ foreach $row (@{query($sdbh, $query)}) {
= $newdb{'lookup'}{'account'}{'A/R'}{'ledger_id'};
# debit: Cash/Check/Etc credit: A/R
addRow('double_entries',
{ 'transaction_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'receipt_id'},
addRow('double_entries', {
'transaction_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'receipt_id'},
'effective_date' => $effective_date,
'customer_id' => undef, # This is set later...
'debit_ledger_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'debit_ledger_id'},
@@ -1220,8 +1221,8 @@ foreach $row (@{query($sdbh, $query)}) {
= $newdb{'tables'}{'double_entries'}{'autoid'};
# Add the Payment Entry
addRow('entries',
{ 'type' => 'PAYMENT',
addRow('entries', {
'type' => 'PAYMENT',
'account_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'debit_account_id'},
'ledger_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'debit_ledger_id'},
'crdr' => 'DEBIT',
@@ -1236,8 +1237,8 @@ foreach $row (@{query($sdbh, $query)}) {
= $newdb{'tables'}{'entries'}{'autoid'};
# Add the A/R Entry
addRow('entries',
{ 'type' => 'TRANSFER',
addRow('entries', {
'type' => 'TRANSFER',
'account_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'credit_account_id'},
'ledger_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'credit_ledger_id'},
'crdr' => 'CREDIT',
@@ -1281,15 +1282,15 @@ foreach $row (@{query($sdbh, $query)})
my $reconcile_amount = ($charge_amount < $payment_amount) ? $charge_amount : $payment_amount;
# Reconcile the A/R Account
addRow('reconciliations',
{ 'debit_entry_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'ar_entry_id'},
addRow('reconciliations', {
'debit_entry_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'ar_entry_id'},
'credit_entry_id' => $newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}{'ar_entry_id'},
'amount' => $reconcile_amount,
});
# Reconcile the payment to the charge
addRow('charges_payments',
{ 'charge_entry_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'entry_id'},
addRow('charges_payments', {
'charge_entry_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'entry_id'},
'payment_entry_id' => $newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}{'entry_id'},
'amount' => $reconcile_amount,
});
@@ -1324,28 +1325,28 @@ print("Set up Petty Cash...\n");
# Add the first loan
# debit: Equity credit: Loan
addRow('transactions',
{ 'type' => 'TRANSFER',
addRow('transactions', {
'type' => 'TRANSFER',
'stamp' => datefmt('03/25/2009 16:00'),
});
addRow('double_entries',
{ 'transaction_id' => $newdb{'tables'}{'transactions'}{'autoid'},
addRow('double_entries', {
'transaction_id' => $newdb{'tables'}{'transactions'}{'autoid'},
'effective_date' => $effective_date,
'debit_ledger_id' => $newdb{'lookup'}{'account'}{'Equity'}{'ledger_id'},
'credit_ledger_id' => $newdb{'lookup'}{'account'}{'Loan'}{'ledger_id'},
'amount' => 5000,
'comment' => "HTP Loan #1",
});
addRow('entries',
{ 'type' => 'TRANSFER',
addRow('entries', {
'type' => 'TRANSFER',
'account_id' => $newdb{'lookup'}{'account'}{'Equity'}{'account_id'},
'ledger_id' => $newdb{'lookup'}{'account'}{'Equity'}{'ledger_id'},
'crdr' => 'DEBIT',
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
'comment' => "Equity: HTP Loan #1",
});
addRow('entries',
{ 'type' => 'TRANSFER',
addRow('entries', {
'type' => 'TRANSFER',
'account_id' => $newdb{'lookup'}{'account'}{'Loan'}{'account_id'},
'ledger_id' => $newdb{'lookup'}{'account'}{'Loan'}{'ledger_id'},
'crdr' => 'CREDIT',
@@ -1355,28 +1356,28 @@ addRow('entries',
# Add the second loan
# debit: Equity credit: Loan
addRow('transactions',
{ 'type' => 'TRANSFER',
addRow('transactions', {
'type' => 'TRANSFER',
'stamp' => datefmt('04/01/2009 16:00'),
});
addRow('double_entries',
{ 'transaction_id' => $newdb{'tables'}{'transactions'}{'autoid'},
addRow('double_entries', {
'transaction_id' => $newdb{'tables'}{'transactions'}{'autoid'},
'effective_date' => $effective_date,
'debit_ledger_id' => $newdb{'lookup'}{'account'}{'Equity'}{'ledger_id'},
'credit_ledger_id' => $newdb{'lookup'}{'account'}{'Loan'}{'ledger_id'},
'amount' => 1000,
'comment' => "HTP Loan #2",
});
addRow('entries',
{ 'type' => 'TRANSFER',
addRow('entries', {
'type' => 'TRANSFER',
'account_id' => $newdb{'lookup'}{'account'}{'Equity'}{'account_id'},
'ledger_id' => $newdb{'lookup'}{'account'}{'Equity'}{'ledger_id'},
'crdr' => 'DEBIT',
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
'comment' => "Equity: HTP Loan #2",
});
addRow('entries',
{ 'type' => 'TRANSFER',
addRow('entries', {
'type' => 'TRANSFER',
'account_id' => $newdb{'lookup'}{'account'}{'Loan'}{'account_id'},
'ledger_id' => $newdb{'lookup'}{'account'}{'Loan'}{'ledger_id'},
'crdr' => 'CREDIT',
@@ -1386,28 +1387,28 @@ addRow('entries',
# Cheat for now, using equity for Petty Cash
# debit: Petty Cash credit: Equity
addRow('transactions',
{ 'type' => 'TRANSFER',
addRow('transactions', {
'type' => 'TRANSFER',
'stamp' => datefmt('03/25/2009 16:00'),
});
addRow('double_entries',
{ 'transaction_id' => $newdb{'tables'}{'transactions'}{'autoid'},
addRow('double_entries', {
'transaction_id' => $newdb{'tables'}{'transactions'}{'autoid'},
'effective_date' => $effective_date,
'debit_ledger_id' => $newdb{'lookup'}{'account'}{'Petty Cash'}{'ledger_id'},
'credit_ledger_id' => $newdb{'lookup'}{'account'}{'Equity'}{'ledger_id'},
'amount' => 750,
'comment' => "Petty Cash Funding",
});
addRow('entries',
{ 'type' => 'TRANSFER',
addRow('entries', {
'type' => 'TRANSFER',
'account_id' => $newdb{'lookup'}{'account'}{'Petty Cash'}{'account_id'},
'ledger_id' => $newdb{'lookup'}{'account'}{'Petty Cash'}{'ledger_id'},
'crdr' => 'DEBIT',
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
'comment' => "Petty Cash: Petty Cash Funding",
});
addRow('entries',
{ 'type' => 'TRANSFER',
addRow('entries', {
'type' => 'TRANSFER',
'account_id' => $newdb{'lookup'}{'account'}{'Equity'}{'account_id'},
'ledger_id' => $newdb{'lookup'}{'account'}{'Equity'}{'ledger_id'},
'crdr' => 'CREDIT',