[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3422] trunk
- Subject: SF.net SVN: ledger-smb:[3422] trunk
- From: ..hidden..
- Date: Mon, 04 Jul 2011 10:12:58 +0000
Revision: 3422
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3422&view=rev
Author: einhverfr
Date: 2011-07-04 10:12:58 +0000 (Mon, 04 Jul 2011)
Log Message:
-----------
Manual tax calculations partly done
Modified Paths:
--------------
trunk/bin/ir.pl
trunk/bin/is.pl
trunk/sql/Pg-database.sql
Added Paths:
-----------
trunk/sql/upgrade/3422-tax_tabes.sql
Modified: trunk/bin/ir.pl
===================================================================
--- trunk/bin/ir.pl 2011-07-04 08:15:12 UTC (rev 3421)
+++ trunk/bin/ir.pl 2011-07-04 10:12:58 UTC (rev 3422)
@@ -479,6 +479,22 @@
}
sub form_footer {
+ my $manual_tax;
+ if ($form->{id}){
+ $manual_tax =
+ qq|<input type="hidden" name="manual_tax" value="|
+ . $form->{manual_tax} . qq|" />|;
+ } else {
+ $manual_tax =
+ qq|<label for="manual-tax-0">|.
+ $locale->text("Automatic"). qq|</label>
+ <input type="radio" name="manual_tax" value="0"
+ id="manual-tax-0">
+ <label for="manual-tax-1">|.
+ $locale->text("Manual"). qq|</label>
+ <input type="radio" name="manual_tax" value="1"
+ id="manual-tax-1">|;
+ }
_calc_taxes();
$form->{invtotal} = $form->{invsubtotal};
@@ -505,17 +521,53 @@
}
if ( !$form->{taxincluded} ) {
+ if ($form->{manual_tax}){
+ $tax .= qq|<tr class="listtop">
+ <td> </td>
+ <th align="center">|.$locale->text('Amount').qq|</th>
+ <th align="center">|.$locale->text('Rate').qq|</th>
+ <th align="center">|.$locale->text('Basis').qq|</th>
+ <th align="center">|.$locale->text('Reference').qq|</th>
+ <th align="center">|.$locale->text('Memo').qq|</th>
+ <td> </td>
+ </tr>|;
+ }
foreach $item (keys %{$form->{taxes}}) {
my $taccno = $item;
- $form->{invtotal} += $form->round_amount($form->{taxes}{$item}, 2);
- $form->{"${taccno}_total"} =
- $form->round_amount($form->{taxes}{$item}, 2);
- $tax .= qq|
- <tr>
- <th align=right>$form->{"${item}_description"}</th>
- <td align=right>$form->{"${item}_total"}</td>
- </tr>
+ if ($form->{manual_tax}){
+ $form->{invtotal} += $form->round_amount(
+ $form->{"mt_amount_$item"}, 2);
+ $tax .= qq|<tr>
+ <th align=right>$form->{"${taccno}_description"}</th>
+ <td><input type="text" name="mt_amount_$item"
+ id="mt-amount-$item" value="|
+ .$form->{"mt_amount_$item"} .qq|" /><td>
+ <td><input type="text" name="mt_rate_$item"
+ id="mt-rate-$item" value="|
+ .$form->{"mt_rate_$item"} .qq|" /></td>
+ <td><input type="text" name="mt_basis_$item"
+ id="mt-basis-$item" value="|
+ .$form->{"mt_basis_$item"} .qq|" /></td>
+ <td><input type="text" name="mt_ref_$item"
+ id="mt-ref-$item" value="|
+ .$form->{"mt_ref_$item"} .qq|" /></td>
+ <td><input type="text" name="mt_memo_$item"
+ id="mt-memo-$item" value="|
+ .$form->{"mt_memo_$item"} .qq|" /></td>
+ <td><button id="mt-calc-$item name="mt_calc_$item"
+ >|.$locale->text('Calc').qq|</button></td>
+ </tr>|;
+ } else {
+ $form->{invtotal} += $form->round_amount($form->{taxes}{$item}, 2);
+ $form->{"${taccno}_total"} =
+ $form->round_amount($form->{taxes}{$item}, 2);
+ $tax .= qq|
+ <tr>
+ <th align=right>$form->{"${item}_description"}</th>
+ <td align=right>$form->{"${item}_total"}</td>
+ </tr>
|;
+ }
}
$form->{invsubtotal} =
@@ -563,9 +615,14 @@
</table>
</td>
<td align=right>
- $taxincluded
- <br>
+ $taxincluded <br/>
<table>
+ <tr><th align="center" colspan="2">|.
+ $locale->text('Calculate Taxes').qq|</th>
+ </tr>
+ <tr>
+ <td colspan=2>$manual_tax</td>
+ </tr>
$subtotal
$tax
<tr>
Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl 2011-07-04 08:15:12 UTC (rev 3421)
+++ trunk/bin/is.pl 2011-07-04 10:12:58 UTC (rev 3422)
@@ -426,6 +426,22 @@
shipped oldtransdate recurring reverse batch_id subtype)
);
+ my $manual_tax;
+ if ($form->{id}){
+ $manual_tax =
+ qq|<input type="hidden" name="manual_tax" value="|
+ . $form->{manual_tax} . qq|" />|;
+ } else {
+ $manual_tax = $locale->text("Calculate Taxes") .
+ qq|<label for="manual-tax-0">|.
+ $locale->text("Automatic"). qq|</label>
+ <input type="radio" name="manual_tax" value="0"
+ id="manual-tax-0">
+ <label for="manual-tax-1">|.
+ $locale->text("Manual"). qq|</label>
+ <input type="radio" name="manual_tax" value="1"
+ id="manual-tax-1">|;
+ }
print qq|
<table width=100%>
<tr class=listtop>
@@ -537,6 +553,22 @@
}
sub form_footer {
+ my $manual_tax;
+ if ($form->{id}){
+ $manual_tax =
+ qq|<input type="hidden" name="manual_tax" value="|
+ . $form->{manual_tax} . qq|" />|;
+ } else {
+ $manual_tax =
+ qq|<label for="manual-tax-0">|.
+ $locale->text("Automatic"). qq|</label>
+ <input type="radio" name="manual_tax" value="0"
+ id="manual-tax-0">
+ <label for="manual-tax-1">|.
+ $locale->text("Manual"). qq|</label>
+ <input type="radio" name="manual_tax" value="1"
+ id="manual-tax-1">|;
+ }
_calc_taxes();
$form->{invtotal} = $form->{invsubtotal};
@@ -568,20 +600,55 @@
}
if ( !$form->{taxincluded} ) {
+ if ($form->{manual_tax}){
+ $tax .= qq|<tr class="listtop">
+ <td> </td>
+ <th align="center">|.$locale->text('Amount').qq|</th>
+ <th align="center">|.$locale->text('Rate').qq|</th>
+ <th align="center">|.$locale->text('Basis').qq|</th>
+ <th align="center">|.$locale->text('Reference').qq|</th>
+ <th align="center">|.$locale->text('Memo').qq|</th>
+ <td> </td>
+ </tr>|;
+ }
foreach $item (keys %{$form->{taxes}}) {
my $taccno = $item;
- $form->{invtotal} += $form->round_amount($form->{taxes}{$item}, 2);
- $form->{"${taccno}_total"} =
- $form->format_amount( \%myconfig,
- $form->round_amount( $form->{taxes}{$item}, 2 ), 2 );
- next if !$form->{"${taccno}_total"};
- $tax .= qq|
- <tr>
- <th align=right>$form->{"${taccno}_description"}</th>
- <td align=right>$form->{"${taccno}_total"}</td>
- </tr>|;
+ if ($form->{manual_tax}){
+ $form->{invtotal} += $form->round_amount(
+ $form->{"mt_amount_$item"}, 2);
+ $tax .= qq|<tr>
+ <th align=right>$form->{"${taccno}_description"}</th>
+ <td><input type="text" name="mt_amount_$item"
+ id="mt-amount-$item" value="|
+ .$form->{"mt_amount_$item"} .qq|" /><td>
+ <td><input type="text" name="mt_rate_$item"
+ id="mt-rate-$item" value="|
+ .$form->{"mt_rate_$item"} .qq|" /></td>
+ <td><input type="text" name="mt_basis_$item"
+ id="mt-basis-$item" value="|
+ .$form->{"mt_basis_$item"} .qq|" /></td>
+ <td><input type="text" name="mt_ref_$item"
+ id="mt-ref-$item" value="|
+ .$form->{"mt_ref_$item"} .qq|" /></td>
+ <td><input type="text" name="mt_memo_$item"
+ id="mt-memo-$item" value="|
+ .$form->{"mt_memo_$item"} .qq|" /></td>
+ <td><button id="mt-calc-$item name="mt_calc_$item"
+ >|.$locale->text('Calc').qq|</button></td>
+ </tr>|;
+ } else {
+ $form->{invtotal} += $form->round_amount($form->{taxes}{$item}, 2);
+ $form->{"${taccno}_total"} =
+ $form->format_amount( \%myconfig,
+ $form->round_amount( $form->{taxes}{$item}, 2 ), 2 );
+ next if !$form->{"${taccno}_total"};
+ $tax .= qq|
+ <tr>
+ <th align=right>$form->{"${taccno}_description"}</th>
+ <td align=right>$form->{"${taccno}_total"}</td>
+ </tr>|;
+ }
}
-
$form->{invsubtotal} =
$form->format_amount( \%myconfig, $form->{invsubtotal}, 2, 0 );
@@ -625,6 +692,12 @@
</td>
<td align=right>
<table>
+ <tr><th align="center"
+ colspan="2">|.$locale->text('Calculate Taxes').qq|</th>
+ </tr>
+ <tr>
+ <td colspan="2">$manual_tax</td>
+ </tr>
$subtotal
$tax
<tr>
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2011-07-04 08:15:12 UTC (rev 3421)
+++ trunk/sql/Pg-database.sql 2011-07-04 10:12:58 UTC (rev 3422)
@@ -3428,13 +3428,10 @@
$$ Tracks ship_to information for orders and invoices.$$;
CREATE TABLE tax_extended (
- account_id int references account(id),
- tx_id int references transactions(id),
- reference text not null,
tax_basis numeric,
rate numeric,
- tax_amount numeric,
- check (tax_amount = rate*tax_basis/100)
+ entry_id int primary key,
+ foreign key entry_id references acc_trans(entry_id)
);
COMMENT ON TABLE tax_extended IS
Added: trunk/sql/upgrade/3422-tax_tabes.sql
===================================================================
--- trunk/sql/upgrade/3422-tax_tabes.sql (rev 0)
+++ trunk/sql/upgrade/3422-tax_tabes.sql 2011-07-04 10:12:58 UTC (rev 3422)
@@ -0,0 +1,7 @@
+ALTER TABLE tax_extended DROP COLUMN account_id;
+ALTER TABLE tax_extended DROP COLUMN tx_id;
+ALTER TABLE tax_extended DROP COLUMN reference;
+ALTER TABLE tax_extended DROP COLUMN tax_amount;
+ALTER TABLE tax_extended ADD entry_id int primary key;
+ALTER TABLE tax_extended
+ADD FOREIGN KEY(entry_id) references acc_trans(entry_id);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.