[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4618] trunk
- Subject: SF.net SVN: ledger-smb:[4618] trunk
- From: ..hidden..
- Date: Wed, 28 Mar 2012 10:40:32 +0000
Revision: 4618
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4618&view=rev
Author: einhverfr
Date: 2012-03-28 10:40:32 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
Merging branches/1.3
Modified Paths:
--------------
trunk/LedgerSMB/Scripts/payment.pm
trunk/UI/payments/payments_detail.html
trunk/sql/modules/Payment.sql
Property Changed:
----------------
trunk/
trunk/LedgerSMB/Scripts/account.pm
trunk/LedgerSMB/Scripts/admin.pm
trunk/LedgerSMB/Scripts/customer.pm
trunk/LedgerSMB/Scripts/employee.pm
trunk/LedgerSMB/Scripts/file.pm
trunk/LedgerSMB/Scripts/journal.pm
trunk/LedgerSMB/Scripts/login.pm
trunk/LedgerSMB/Scripts/menu.pm
trunk/LedgerSMB/Scripts/payment.pm
trunk/LedgerSMB/Scripts/recon.pm
trunk/LedgerSMB/Scripts/setup.pm
trunk/LedgerSMB/Scripts/taxform.pm
trunk/LedgerSMB/Scripts/vendor.pm
trunk/sql/upgrade/1.2-1.3-manual.sql
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3:3711-4615
+ /branches/1.3:3711-4617
Property changes on: trunk/LedgerSMB/Scripts/account.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4615
/branches/1.3/scripts/account.pl:3711-4368
+ /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4617
/branches/1.3/scripts/account.pl:3711-4368
Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4615
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287
+ /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4617
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287
Property changes on: trunk/LedgerSMB/Scripts/customer.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4615
/branches/1.3/scripts/customer.pl:4273-4287
+ /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4617
/branches/1.3/scripts/customer.pl:4273-4287
Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4615
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
+ /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4617
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4615
/branches/1.3/scripts/file.pl:3711-4138
+ /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4617
/branches/1.3/scripts/file.pl:3711-4138
Property changes on: trunk/LedgerSMB/Scripts/journal.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4615
/branches/1.3/scripts/journal.pl:3711-4328
+ /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4617
/branches/1.3/scripts/journal.pl:3711-4328
Property changes on: trunk/LedgerSMB/Scripts/login.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4615
/branches/1.3/scripts/login.pl:3711-4192
+ /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4617
/branches/1.3/scripts/login.pl:3711-4192
Property changes on: trunk/LedgerSMB/Scripts/menu.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4615
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
+ /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4617
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
Modified: trunk/LedgerSMB/Scripts/payment.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payment.pm 2012-03-28 10:30:49 UTC (rev 4617)
+++ trunk/LedgerSMB/Scripts/payment.pm 2012-03-28 10:40:32 UTC (rev 4618)
@@ -593,7 +593,8 @@
money => 1);
$invoice->[6] = $payment->format_amount(amount => (
$payment->parse_amount(amount => $invoice->[3])
- - $payment->parse_amount(amount => $invoice->[4])),
+ - $payment->parse_amount(amount => $invoice->[4])
+ - $payment->parse_amount(amount => $invoice->[5])),
money => 1);
$contact_to_pay += $payment->parse_amount(amount => $invoice->[6]);
my $fld = "payment_" . $invoice->[0];
Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4615
/branches/1.3/scripts/payment.pl:3711-4615
+ /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4617
/branches/1.3/scripts/payment.pl:3711-4617
Property changes on: trunk/LedgerSMB/Scripts/recon.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4615
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
+ /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4617
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4615
/branches/1.3/scripts/setup.pl:3711-4550
+ /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4617
/branches/1.3/scripts/setup.pl:3711-4550
Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4615
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
+ /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4617
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
Property changes on: trunk/LedgerSMB/Scripts/vendor.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4615
/branches/1.3/scripts/vendor.pl:4273-4287
+ /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4617
/branches/1.3/scripts/vendor.pl:4273-4287
Modified: trunk/UI/payments/payments_detail.html
===================================================================
--- trunk/UI/payments/payments_detail.html 2012-03-28 10:30:49 UTC (rev 4617)
+++ trunk/UI/payments/payments_detail.html 2012-03-28 10:40:32 UTC (rev 4618)
@@ -291,6 +291,7 @@
</th>
<th class="total_due_list"><?lsmb text('Total') ?></th>
<th class="paid_list"><?lsmb text('Paid') ?></th>
+ <th class="discount_list"><?lsmb text('Discount') ?></th>
<th class="net_due_list"><?lsmb text('Net Due') ?> </th>
<th class="to_pay_list"><?lsmb text('To Pay') ?></th>
</tr>
@@ -316,6 +317,8 @@
/>
<td class="paid_list">
<?lsmb i.4 ?></td>
+ <td class="discount_list">
+ <?lsmb i.5 ?></td>
<td class="net_due_list">
<?lsmb i.6 ?>
<?lsmb currency ?></td>
Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql 2012-03-28 10:30:49 UTC (rev 4617)
+++ trunk/sql/modules/Payment.sql 2012-03-28 10:40:32 UTC (rev 4618)
@@ -329,13 +329,13 @@
a.id::text, a.invnumber, a.transdate::text,
a.amount::text, (a.amount - p.due)::text,
(CASE WHEN c.discount_terms
- > extract('days' FROM age(a.transdate))
+ < extract('days' FROM age(a.transdate))
THEN 0
- ELSE (a.amount - coalesce((a.amount - p.due), 0)) * coalesce(c.discount, 0) / 100
+ ELSE (coalesce(p.due, 0) * coalesce(c.discount, 0) / 100)
END)::text,
(coalesce(p.due, 0) -
(CASE WHEN c.discount_terms
- > extract('days' FROM age(a.transdate))
+ < extract('days' FROM age(a.transdate))
THEN 0
ELSE (coalesce(p.due, 0)) * coalesce(c.discount, 0) / 100
END))::text,
@@ -559,6 +559,47 @@
t_voucher_id, in_payment_date, in_source
FROM bulk_payments_in where amount <> 0;
+ -- early payment discounts
+ INSERT INTO acc_trans
+ (trans_id, chart_id, amount, approved,
+ voucher_id, transdate, source)
+ SELECT bpi.id, eca.discount_account_id,
+ amount * t_cash_sign * t_exchangerate/fxrate
+ / (1 - discount::numeric/100)
+ * (discount::numeric/100),
+ CASE WHEN t_voucher_id IS NULL THEN true
+ ELSE false END,
+ t_voucher_id, in_payment_date, in_source
+ FROM bulk_payments_in bpi
+ JOIN (select entity_credit_account, id, transdate FROM ar
+ WHERE in_account_class = 2
+ UNION
+ SELECT entity_credit_account, id, transdate FROM ap
+ WHERE in_account_class = 1) gl ON gl.id = bpi.id
+ JOIN entity_credit_account eca ON gl.entity_credit_account = eca.id
+ WHERE bpi.amount <> 0
+ AND extract('days' from age(gl.transdate)) < eca.discount_terms;
+
+ INSERT INTO acc_trans
+ (trans_id, chart_id, amount, approved,
+ voucher_id, transdate, source)
+ SELECT bpi.id, t_ar_ap_id,
+ amount * t_cash_sign * -1 * t_exchangerate/fxrate
+ / (1 - discount::numeric/100)
+ * (discount::numeric/100),
+ CASE WHEN t_voucher_id IS NULL THEN true
+ ELSE false END,
+ t_voucher_id, in_payment_date, in_source
+ FROM bulk_payments_in bpi
+ JOIN (select entity_credit_account, id, transdate FROM ar
+ WHERE in_account_class = 2
+ UNION
+ SELECT entity_credit_account, id, transdate FROM ap
+ WHERE in_account_class = 1) gl ON gl.id = bpi.id
+ JOIN entity_credit_account eca ON gl.entity_credit_account = eca.id
+ WHERE bpi.amount <> 0
+ AND extract('days' from age(gl.transdate)) < eca.discount_terms;
+
-- Insert ar/ap side
INSERT INTO acc_trans
(trans_id, chart_id, amount, approved,
Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4615
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
+ /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4617
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.