Another snapshot. I think I'll be taking the CREDIT/DEBIT reconcile functionality out.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@353 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -981,12 +981,13 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
# Add the Charge Entry
|
||||
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'},
|
||||
'crdr' => 'CREDIT',
|
||||
'comment' => "Charge: $row->{'ChargeID'}; Ledger: $row->{'LedgerID'}",
|
||||
});
|
||||
'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'},
|
||||
'ledger_id' => $newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'credit_ledger_id'},
|
||||
'crdr' => 'CREDIT',
|
||||
'comment' => "Charge: $row->{'ChargeID'}; Ledger: $row->{'LedgerID'}",
|
||||
});
|
||||
|
||||
$newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'entry_id'}
|
||||
= $newdb{'tables'}{'entries'}{'autoid'};
|
||||
@@ -994,11 +995,12 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
# Add the A/R entry
|
||||
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'},
|
||||
'crdr' => 'DEBIT',
|
||||
'comment' => "Charge A/R: $row->{'ChargeID'}; Ledger: $row->{'LedgerID'}",
|
||||
});
|
||||
'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'},
|
||||
'crdr' => 'DEBIT',
|
||||
'comment' => "Charge A/R: $row->{'ChargeID'}; Ledger: $row->{'LedgerID'}",
|
||||
});
|
||||
|
||||
$newdb{'lookup'}{'charge'}{$row->{'ChargeID'}}{'ar_entry_id'}
|
||||
= $newdb{'tables'}{'entries'}{'autoid'};
|
||||
@@ -1206,13 +1208,13 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
# debit: Cash/Check/Etc credit: A/R
|
||||
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'},
|
||||
'credit_ledger_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'credit_ledger_id'},
|
||||
'amount' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'amount'},
|
||||
'comment' => "Double Entry Receipt: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}",
|
||||
});
|
||||
'effective_date' => $effective_date,
|
||||
'customer_id' => undef, # This is set later...
|
||||
'debit_ledger_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'debit_ledger_id'},
|
||||
'credit_ledger_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'credit_ledger_id'},
|
||||
'amount' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'amount'},
|
||||
'comment' => "Double Entry Receipt: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}",
|
||||
});
|
||||
|
||||
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'double_entry_id'}
|
||||
= $newdb{'tables'}{'double_entries'}{'autoid'};
|
||||
@@ -1220,14 +1222,15 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
# Add the Payment Entry
|
||||
addRow('entries',
|
||||
{ 'type' => 'PAYMENT',
|
||||
'account_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'debit_account_id'},
|
||||
'crdr' => 'DEBIT',
|
||||
'double_entry_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'double_entry_id'},
|
||||
'name' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'name'},
|
||||
'monetary_type' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'type'},
|
||||
'data1' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'data1'},
|
||||
'comment' => "Receipt: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}",
|
||||
});
|
||||
'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',
|
||||
'double_entry_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'double_entry_id'},
|
||||
'name' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'name'},
|
||||
'monetary_type' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'type'},
|
||||
'data1' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'data1'},
|
||||
'comment' => "Receipt: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}",
|
||||
});
|
||||
|
||||
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'entry_id'}
|
||||
= $newdb{'tables'}{'entries'}{'autoid'};
|
||||
@@ -1235,11 +1238,12 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
# Add the A/R Entry
|
||||
addRow('entries',
|
||||
{ 'type' => 'TRANSFER',
|
||||
'account_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'credit_account_id'},
|
||||
'crdr' => 'CREDIT',
|
||||
'double_entry_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'double_entry_id'},
|
||||
'comment' => "Receipt A/R: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}",
|
||||
});
|
||||
'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',
|
||||
'double_entry_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'double_entry_id'},
|
||||
'comment' => "Receipt A/R: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}",
|
||||
});
|
||||
|
||||
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'ar_entry_id'}
|
||||
= $newdb{'tables'}{'entries'}{'autoid'};
|
||||
@@ -1322,87 +1326,93 @@ print("Set up Petty Cash...\n");
|
||||
# debit: Equity credit: Loan
|
||||
addRow('transactions',
|
||||
{ 'type' => 'TRANSFER',
|
||||
'stamp' => datefmt('03/25/2009 16:00'),
|
||||
'stamp' => datefmt('03/25/2009 16:00'),
|
||||
});
|
||||
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",
|
||||
'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',
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Equity'}{'account_id'},
|
||||
'crdr' => 'DEBIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Equity: HTP Loan #1",
|
||||
'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',
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Loan'}{'account_id'},
|
||||
'crdr' => 'CREDIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Loan: HTP Loan #1",
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Loan'}{'account_id'},
|
||||
'ledger_id' => $newdb{'lookup'}{'account'}{'Loan'}{'ledger_id'},
|
||||
'crdr' => 'CREDIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Loan: HTP Loan #1",
|
||||
});
|
||||
|
||||
# Add the second loan
|
||||
# debit: Equity credit: Loan
|
||||
addRow('transactions',
|
||||
{ 'type' => 'TRANSFER',
|
||||
'stamp' => datefmt('04/01/2009 16:00'),
|
||||
'stamp' => datefmt('04/01/2009 16:00'),
|
||||
});
|
||||
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",
|
||||
'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',
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Equity'}{'account_id'},
|
||||
'crdr' => 'DEBIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Equity: HTP Loan #2",
|
||||
'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',
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Loan'}{'account_id'},
|
||||
'crdr' => 'CREDIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Loan: HTP Loan #2",
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Loan'}{'account_id'},
|
||||
'ledger_id' => $newdb{'lookup'}{'account'}{'Loan'}{'ledger_id'},
|
||||
'crdr' => 'CREDIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Loan: HTP Loan #2",
|
||||
});
|
||||
|
||||
# Cheat for now, using equity for Petty Cash
|
||||
# debit: Petty Cash credit: Equity
|
||||
addRow('transactions',
|
||||
{ 'type' => 'TRANSFER',
|
||||
'stamp' => datefmt('03/25/2009 16:00'),
|
||||
'stamp' => datefmt('03/25/2009 16:00'),
|
||||
});
|
||||
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",
|
||||
'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',
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Petty Cash'}{'account_id'},
|
||||
'crdr' => 'DEBIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Petty Cash: Petty Cash Funding",
|
||||
'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',
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Equity'}{'account_id'},
|
||||
'crdr' => 'CREDIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Equity: Petty Cash Funding",
|
||||
'account_id' => $newdb{'lookup'}{'account'}{'Equity'}{'account_id'},
|
||||
'ledger_id' => $newdb{'lookup'}{'account'}{'Equity'}{'ledger_id'},
|
||||
'crdr' => 'CREDIT',
|
||||
'double_entry_id' => $newdb{'tables'}{'double_entries'}{'autoid'},
|
||||
'comment' => "Equity: Petty Cash Funding",
|
||||
});
|
||||
|
||||
######################################################################
|
||||
|
||||
Reference in New Issue
Block a user