summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-26 20:28:38 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-26 20:28:38 +0000
commit6c5c1c36fa682244c355f6c06808ec715f0a2baa (patch)
tree632efc981a5735f7b8d424a680469b71597dd495 /bin
parent6a118bd31a09a9b8aaabd84f8876952e1cdd6459 (diff)
Merging bugfixes from current branches/1.2
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1105 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r--bin/aa.pl12
-rw-r--r--bin/admin.pl124
-rw-r--r--bin/am.pl8
-rw-r--r--bin/arapprn.pl6
-rw-r--r--bin/cp.pl34
-rw-r--r--bin/ic.pl4
-rw-r--r--bin/io.pl15
-rw-r--r--bin/ir.pl23
-rw-r--r--bin/is.pl20
-rw-r--r--bin/jc.pl17
-rw-r--r--bin/login.pl6
-rw-r--r--bin/oe.pl9
-rw-r--r--bin/pos.pl15
13 files changed, 98 insertions, 195 deletions
diff --git a/bin/aa.pl b/bin/aa.pl
index 08a766f2..f4e6c1b1 100644
--- a/bin/aa.pl
+++ b/bin/aa.pl
@@ -117,6 +117,14 @@ sub display_form {
}
sub create_links {
+ if ( $form->{script} eq 'ap.pl' ) {
+ $form->{ARAP} = 'AP';
+ $form->{vc} = 'vendor';
+ }
+ elsif ( $form->{script} eq 'ar.pl' ) {
+ $form->{ARAP} = 'AR';
+ $form->{vc} = 'customer';
+ }
$form->create_links( $form->{ARAP}, \%myconfig, $form->{vc} );
@@ -1481,13 +1489,12 @@ qq|<input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
}
sub transactions {
-
if ( $form->{ $form->{vc} } ) {
$form->{ $form->{vc} } = $form->unescape( $form->{ $form->{vc} } );
( $form->{ $form->{vc} }, $form->{"$form->{vc}_id"} ) =
split( /--/, $form->{ $form->{vc} } );
}
-
+ my @column_index;
AA->transactions( \%myconfig, \%$form );
$href = "$form->{script}?action=transactions";
@@ -1640,7 +1647,6 @@ sub transactions {
$href .= "&l_$item=Y";
}
}
-
if ( !$form->{summary} ) {
foreach $item (qw(source debit credit accno description projectnumber))
{
diff --git a/bin/admin.pl b/bin/admin.pl
index 2754dac4..187235b3 100644
--- a/bin/admin.pl
+++ b/bin/admin.pl
@@ -155,7 +155,7 @@ sub login {
}
sub logout {
-
+ $form->{login} = 'admin';
$form->{callback} = "admin.pl?action=adminlogin";
Session::session_destroy($form);
$form->redirect( $locale->text('You are logged out') );
@@ -224,11 +224,13 @@ sub list_users {
my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH};
my $fetchMembers = $dbh->selectall_arrayref(
-"SELECT uc.name, uc.company, uc.templates, uc.dbuser, uc.dbdriver, uc.dbname, uc.dbhost, u.username
- FROM users as u, users_conf as uc
- WHERE u.id = uc.id
- AND u.id > 1
- ORDER BY u.username;", { Slice => {} }
+ "SELECT uc.name, uc.company, uc.templates,
+ uc.dbuser, uc.dbdriver, uc.dbname,
+ uc.dbhost, u.username
+ FROM users as u, users_conf as uc
+ WHERE u.id = uc.id
+ AND u.id > 1
+ ORDER BY u.username;", { Slice => {} }
);
my @memberArray = ();
@@ -327,7 +329,6 @@ sub list_users {
. qq|</button>
$dbdrivers
- $nologin
<button type="submit" class="submit" name="action" value="logout">|
. $locale->text('Logout')
@@ -407,7 +408,7 @@ sub form_header {
opendir TEMPLATEDIR, "${LedgerSMB::Sysconfig::templates}/."
or $form->error( __FILE__ . ':' . __LINE__ . ': ' . "$templates : $!" );
- @all = grep !/(^\.\.?|^\.svn)/, readdir TEMPLATEDIR;
+ @all = grep !/(^\.\.?$|^\.svn)/, readdir TEMPLATEDIR;
closedir TEMPLATEDIR;
@allhtml = sort grep /\.html/, @all;
@@ -820,8 +821,7 @@ sub save {
$form->{templates} =
"${LedgerSMB::Sysconfig::templates}/$form->{templates}";
- $myconfig = LedgerSMB::User->new( "${LedgerSMB::Sysconfig::memberfile}",
- "$form->{login}" );
+ $myconfig = LedgerSMB::User->new("$form->{login}");
# redo acs variable and delete all the acs codes
@acs = split /;/, $form->{acs};
@@ -1044,7 +1044,8 @@ sub check_password {
exit;
}
else {
- Session::session_create($root);
+ $form->{login} = 'admin';
+ Session::session_create($form);
}
}
else {
@@ -1323,107 +1324,6 @@ sub dbcreate {
|;
}
-sub delete_dataset {
-
- if ( @dbsources = LedgerSMB::User->dbsources_unused( \%$form ) ) {
-
- foreach $item ( sort @dbsources ) {
- $dbsources .=
-qq|<input name="db" class="radio" type="radio" value="$item" />&nbsp;$item |;
- }
-
- }
- else {
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text('Nothing to delete!') );
- }
-
- $form->{title} =
- "LedgerSMB "
- . $locale->text('Accounting') . " "
- . $locale->text('Database Administration') . " / "
- . $locale->text('Delete Dataset');
-
- $form->{login} = "admin";
- $form->header;
-
- print qq|
- <body class="admin">
- <h2>$form->{title}</h2>
- <form method="post" action="$form->{script}" />
- <input type="hidden" name="dbdriver" value="$form->{dbdriver}" />
- <input type="hidden" name="dbuser" value="$form->{dbuser}" />
- <input type="hidden" name="dbhost" value="$form->{dbhost}" />
- <input type="hidden" name="dbport" value="$form->{dbport}" />
- <input type="hidden" name="dbpasswd" value="$form->{dbpasswd}" />
- <input type="hidden" name="dbdefault" value="$form->{dbdefault}" />
- <input name=callback type="hidden" value="$form->{script}?action=list_users&amp;path=$form->{path}">
- <input type="hidden" name="path" value="$form->{path}" />
- <input type="hidden" name="nextsub" value="dbdelete" />
- <table width="100%">
- <tr class="listheading">
- <th>|
- . $locale->text(
- 'The following Datasets are not in use and can be deleted')
- . qq|</th>
- </tr>
- <tr>
- <td>
- $dbsources
- </td>
- </tr>
- <tr>
- <td>
- <hr size="3" noshade />
- <br />
- <button type="submit" class="submit" name="action" value="continue">|
- . $locale->text('Continue')
- . qq|</button>
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- |;
-
-}
-
-sub dbdelete {
-
- if ( !$form->{db} ) {
- $form->error( __FILE__ . ':' . __LINE__ . ': '
- . $locale->text('No Dataset selected!') );
- }
-
- LedgerSMB::User->dbdelete( \%$form );
-
- $form->{title} =
- "LedgerSMB "
- . $locale->text('Accounting') . " "
- . $locale->text('Database Administration') . " / "
- . $locale->text('Delete Dataset');
-
- $form->{login} = "admin";
- $form->header;
-
- print qq|
- <body class="admin">
- <center>
- <h2>$form->{title}</h2>
- $form->{db} | . $locale->text('successfully deleted!') . qq|
- <form method="post" action="$form->{script}" />
- <input type="hidden" name="path" value="$form->{path}" />
- <input type="hidden" name="nextsub" value="list_users" />
- <p><button type="submit" class="submit" name="action" value="continue">|
- . $locale->text('Continue')
- . qq|</button></p>
- </form>
- </body>
- </html>
- |;
-}
-
sub unlock_system {
# This needs to be done with a db tool
diff --git a/bin/am.pl b/bin/am.pl
index 1764384d..1eaec1f0 100644
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -1527,7 +1527,7 @@ sub save_language {
foreach $file (@templates) {
if ( -f "$myconfig{templates}/$file" ) {
- open( TEMP, '<', "$myconfig{templates}/$file" )
+ open( TEMP, '<,', "$myconfig{templates}/$file" )
or $form->error("$myconfig{templates}/$file : $!");
open( NEW, '>', "$myconfig{templates}/$form->{code}/$file" )
@@ -2291,9 +2291,9 @@ sub config {
<form method=post action=$form->{script}>
-<input type=hidden name=old_password value=$myconfig{password}>
+<input type=hidden name=old_password value="$myconfig{password}">
<input type=hidden name=type value=preferences>
-<input type=hidden name=role value=$myconfig{role}>
+<input type=hidden name=role value="$myconfig{role}">
<table width=100%>
<tr><th class=listtop>$form->{title}</th></tr>
@@ -2337,7 +2337,7 @@ sub config {
<table>
<tr>
<th align="right">| . $locale->text('Password') . qq|</th>
- <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
+ <td><input type=password name=new_password size=10 value="$myconfig{password}"></td>
</tr>
<tr>
<th align="right">| . $locale->text('Confirm') . qq|</th>
diff --git a/bin/arapprn.pl b/bin/arapprn.pl
index ceae64be..223518d0 100644
--- a/bin/arapprn.pl
+++ b/bin/arapprn.pl
@@ -256,9 +256,8 @@ sub print_check {
%queued = split / /, $form->{queued};
- $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
$form->{printmode} = '|-';
-
if ( $form->{printed} !~ /$form->{formname}/ ) {
$form->{printed} .= " $form->{formname}";
@@ -381,7 +380,6 @@ sub print_transaction {
$form->parse_amount( \%myconfig, $form->{"amount_$i"} );
}
-
foreach $accno ( split / /, $form->{taxaccounts} ) {
if ( $form->{"tax_$accno"} ) {
$form->format_string("${accno}_description");
@@ -530,7 +528,7 @@ sub print_transaction {
}
if ( $form->{media} !~ /(queue|screen)/ ) {
- $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
$form->{printmode} = '|-';
if ( $form->{printed} !~ /$form->{formname}/ ) {
diff --git a/bin/cp.pl b/bin/cp.pl
index c643b7d8..6a9fc309 100644
--- a/bin/cp.pl
+++ b/bin/cp.pl
@@ -45,9 +45,6 @@
#
#======================================================================
-use Error qw(:try);
-
-use LedgerSMB::Template;
use LedgerSMB::CP;
use LedgerSMB::OP;
use LedgerSMB::IS;
@@ -59,6 +56,12 @@ require "bin/arap.pl";
# end of main
+# This may need to get more sophisticated in the future
+# Anyway, it provides one point of control for date handling.
+sub default_date {
+ $form->{date} ||= 'current_date';
+}
+
sub payment {
if ( $form->{type} eq 'receipt' ) {
@@ -420,12 +423,13 @@ sub invoices_due {
$totalamount += $form->{"amount_$i"};
$totaldue += $form->{"due_$i"};
- if ( $form->{"paid_$i"} !~ /NaN/ ) {
- $totalpaid += $form->{"paid_$i"};
+ if ( $form->{"paid_$i"} =~ /NaN/ ) {
+ $form->{"paid_$i"} = '';
}
else {
- $form->{"paid_$i"} = '';
+ $totalpaid += $form->{"paid_$i"};
}
+
for (qw(amount due paid)) {
$form->{"${_}_$i"} =
$form->format_amount( \%myconfig, $form->{"${_}_$i"}, 2 );
@@ -441,6 +445,9 @@ sub invoices_due {
$column_data{due} = qq|<td align=right>$form->{"due_$i"}</td>
<input type=hidden name="due_$i" value=$form->{"due_$i"}>|;
+ if ( $form->{"paid_$i"} =~ /NaN/ ) {
+ $form->{"paid_$i"} = '';
+ }
$column_data{paid} =
qq|<td align=right><input name="paid_$i" size=10 value=$form->{"paid_$i"}></td>|;
@@ -1147,10 +1154,7 @@ sub list_invoices {
$totalamount += $form->{"amount_$i"};
$totaldue += $form->{"due_$i"};
- if ( $form->{"paid_$i"} =~ /NaN/ ) {
- $form->{"paid_$i"} = '';
- }
- else {
+ if ( $form->{"paid_$i"} !~ /NaN/ ) {
$totalpaid += $form->{"paid_$i"};
}
@@ -1170,6 +1174,10 @@ sub list_invoices {
$column_data{due} = qq|<td align=right width=15%>$form->{"due_$i"}</td>
<input type=hidden name="due_$i" value=$form->{"due_$i"}>|;
+ if ( $form->{"paid_$i"} =~ /NaN/ ) {
+ $form->{"paid_$i"} = '';
+ }
+
$column_data{paid} =
qq|<td align=right width=15%><input name="paid_$i" size=10 value=$form->{"paid_$i"}></td>|;
@@ -1307,7 +1315,10 @@ sub payment_footer {
}
-sub post { &{"post_$form->{payment}"} }
+sub post {
+ &default_date;
+ &{"post_$form->{payment}"};
+}
sub post_payments {
@@ -1533,7 +1544,6 @@ sub check_form {
$form->error( $locale->text('Cannot post payment for a closed period!') )
if ( $datepaid <= $closedto );
- # this is just to format the year
$form->{datepaid} = $locale->date( \%myconfig, $form->{datepaid} );
$amount = $form->parse_amount( \%myconfig, $form->{amount} );
diff --git a/bin/ic.pl b/bin/ic.pl
index 50de73fd..5ca97516 100644
--- a/bin/ic.pl
+++ b/bin/ic.pl
@@ -3642,8 +3642,8 @@ sub save {
$form->{"${_}_base"} += $amount;
}
if ( !$form->{taxincluded} ) {
- my @taxlist =
- Tax::init_taxes( $form, $form->{"taxaccounts_$i"} );
+ my @taxlist = Tax::init_taxes( $form, $form->{"taxaccounts_$i"},
+ $form->{taxaccounts} );
$amount += Tax::calculate_taxes( \@taxlist, $form, $amount, 0 );
}
diff --git a/bin/io.pl b/bin/io.pl
index 48c2caa0..4c41462d 100644
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -576,7 +576,7 @@ sub item_selected {
$form->{"${_}_$i"} = $form->{"new_${_}_$j"};
}
$form->{"sellprice_$i"} = $form->{"new_sellprice_$j"}
- unless $form->{"sellprice_$i"};
+ if not $form->{"sellprice_$i"};
$form->{"partsgroup_$i"} =
qq|$form->{"new_partsgroup_$j"}--$form->{"new_partsgroup_id_$j"}|;
@@ -622,8 +622,8 @@ sub item_selected {
$form->{"${_}_base"} += $amount;
}
if ( !$form->{taxincluded} ) {
- my @taxlist =
- Tax::init_taxes( $form, $form->{"taxaccounts_$i"} );
+ my @taxlist = Tax::init_taxes( $form, $form->{"taxaccounts_$i"},
+ $form->{taxaccounts} );
$amount += Tax::calculate_taxes( \@taxlist, $form, $amount, 0 );
}
@@ -696,7 +696,7 @@ sub new_item {
}
$i = $form->{rowcount};
- for (qw(partnumber description sellprice unit)) {
+ for (qw(partnumber description)) {
$form->{"${_}_$i"} = $form->quote( $form->{"${_}_$i"} );
}
@@ -1366,8 +1366,8 @@ sub print_options {
<input name=grouppartsgroup type=checkbox class=checkbox $form->{grouppartsgroup}>
| . $locale->text('Group') . qq|
</td>
-
</tr>
+
<tr>
<td colspan=6>| . $locale->text('Sort by') . qq| ->
<input name=sortby type=radio class=radio value=runningnumber $sortby{runningnumber}>
@@ -1404,7 +1404,6 @@ sub print {
sub print_form {
my ($old_form) = @_;
-
$inv = "inv";
$due = "due";
@@ -1569,7 +1568,6 @@ sub print_form {
else {
IS->invoice_details( \%myconfig, \%$form );
}
-
if ( exists $form->{longformat} ) {
$form->{"${due}date"} = $duedate;
for ( "${inv}date", "${due}date", "shippingdate", "transdate" ) {
@@ -1640,9 +1638,8 @@ sub print_form {
$form->{pre} = "<body bgcolor=#ffffff>\n<pre>" if $form->{format} eq 'txt';
if ( $form->{media} !~ /(screen|queue|email)/ ) {
- $form->{OUT} = "${LedgerSMB::SysConfig::printer}{$form->{media}}";
+ $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
$form->{printmode} = '|-';
-
$form->{OUT} =~ s/<%(fax)%>/<%$form->{vc}$1%>/;
$form->{OUT} =~ s/<%(.*?)%>/$form->{$1}/g;
diff --git a/bin/ir.pl b/bin/ir.pl
index 87866777..50c7c51f 100644
--- a/bin/ir.pl
+++ b/bin/ir.pl
@@ -484,12 +484,13 @@ qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</texta
if ( !$form->{taxincluded} ) {
my @taxset = Tax::init_taxes( $form, $form->{taxaccounts} );
- $form->{invtotal} +=
- $form->round_amount(
- Tax::calculate_taxes( \@taxset, $form, $form->{invsubtotal}, 0 ),
- 2 );
foreach $taxobj (@taxset) {
$item = $taxobj->account;
+ $form->{invtotal} += $form->round_amount(
+ $form->{"${item}_rate"} * $form->{"${item}_base"}, 2);
+ $form->{"${item}_total"} =
+ $form->format_amount( \%myconfig,
+ $form->{"${item}_rate"} * $form->{"${item}_base"}, 2 );
if ( $form->{"${item}_base"} ) {
$form->{"${item}_total"} =
$form->format_amount( \%myconfig,
@@ -692,9 +693,12 @@ qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></t
else {
if ( $transdate > $closedto ) {
- for ( 'update', 'post', 'schedule' ) { $a{$_} = 1 }
+ for ( 'update', 'post', 'schedule' ) { $allowed{$_} = 1 }
+ for ( keys %button ) { delete $button{$_} if !$allowed{$_} }
+ }
+ elsif ($closedto) {
+ %buttons = ();
}
- for ( keys %button ) { delete $button{$_} if !$a{$_} }
}
for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button )
@@ -963,8 +967,11 @@ sub update {
$form->{"${_}_base"} += $amount;
}
if ( !$form->{taxincluded} ) {
- my @taxes =
- Tax::init_taxes( $form, $form->{"taxaccounts_$i"} );
+ my @taxes = Tax::init_taxes(
+ $form,
+ $form->{"taxaccounts_$i"},
+ $form->{"taxaccounts"}
+ );
$amount +=
( Tax::calculate_taxes( \@taxes, $form, $amount, 0 ) );
}
diff --git a/bin/is.pl b/bin/is.pl
index 5d5c880f..ac2235d6 100644
--- a/bin/is.pl
+++ b/bin/is.pl
@@ -539,20 +539,20 @@ qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</texta
}
if ( !$form->{taxincluded} ) {
-
my @taxes = Tax::init_taxes( $form, $form->{taxaccounts} );
- $form->{invtotal} +=
- Tax::calculate_taxes( \@taxes, $form, $form->{invsubtotal}, 0 );
foreach $item (@taxes) {
my $taccno = $item->account;
+ $form->{invtotal} += $form->round_amount(
+ $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2);
$form->{"${taccno}_total"} =
- $form->format_amount( \%myconfig, $item->value, 2 );
+ $form->format_amount( \%myconfig,
+ $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2 );
$tax .= qq|
<tr>
<th align=right>$form->{"${taccno}_description"}</th>
<td align=right>$form->{"${taccno}_total"}</td>
</tr>
- | if $item->value;
+ | if $form->{"${taccno}_base"};
}
$form->{invsubtotal} =
@@ -777,12 +777,15 @@ qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></t
for ( "update", "ship_to", "print", "e_mail", "post",
"schedule" )
{
- $a{$_} = 1;
+ $allowed{$_} = 1;
}
$a{'print_and_post'} = 1 if ${LedgerSMB::Sysconfig::latex};
+ for ( keys %button ) { delete $button{$_} if !$allowed{$_} }
+ }
+ elsif ($closedto) {
+ %button = ();
}
- for ( keys %button ) { delete $button{$_} if !$a{$_} }
}
for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button )
@@ -988,7 +991,8 @@ sub update {
}
if ( !$form->{taxincluded} ) {
my @taxes =
- Tax::init_taxes( $form, $form->{"taxaccounts_$i"} );
+ Tax::init_taxes( $form, $form->{"taxaccounts_$i"},
+ $form->{taxaccounts} );
$amount +=
Tax::calculate_taxes( \@taxes, $form, $amount, 0 );
}
diff --git a/bin/jc.pl b/bin/jc.pl
index a5889c19..0675c2cd 100644
--- a/bin/jc.pl
+++ b/bin/jc.pl
@@ -2144,7 +2144,7 @@ qq|$form->{"${item}hour"}:$form->{"${item}min"}:$form->{"${item}sec"}|;
}
if ( $form->{media} !~ /(screen|queue)/ ) {
- $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
$form->{printmode} = '|-';
if ( $form->{printed} !~ /$form->{formname}/ ) {
@@ -2205,21 +2205,6 @@ qq|$form->{"${item}hour"}:$form->{"${item}min"}:$form->{"${item}sec"}|;
$form->audittrail( "", \%myconfig, \%audittrail );
}
- if ( ( $form->{'media'} eq 'screen' ) and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new( \%myconfig, $form->{'formname'}, 'HTML' );
- try {
- $template->render($form);
- $form->header;
- print $template->{'output'};
- exit;
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
- }
$form->parse_template( \%myconfig, ${LedgerSMB::Sysconfig::userspath} );
if ( defined %$old_form ) {
diff --git a/bin/login.pl b/bin/login.pl
index b9cfd65c..3d0e99b7 100644
--- a/bin/login.pl
+++ b/bin/login.pl
@@ -59,12 +59,6 @@ if ( -f "bin/custom/$form->{script}" ) {
$form->error( __FILE__ . ':' . __LINE__ . ': ' . $@ ) if ($@);
}
-# per login customization
-if ( -f "bin/custom/$form->{login}_$form->{script}" ) {
- eval { require "bin/custom/$form->{login}_$form->{script}"; };
- $form->error( __FILE__ . ':' . __LINE__ . ': ' . $@ ) if ($@);
-}
-
# window title bar, user info
$form->{titlebar} =
"LedgerSMB " . $locale->text('Version') . " $form->{version}";
diff --git a/bin/oe.pl b/bin/oe.pl
index 75309ec7..402563be 100644
--- a/bin/oe.pl
+++ b/bin/oe.pl
@@ -682,19 +682,20 @@ qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</texta
if ( !$form->{taxincluded} ) {
my @taxes = Tax::init_taxes( $form, $form->{taxaccounts} );
- $form->{invtotal} +=
- Tax::calculate_taxes( \@taxes, $form, $form->{invsubtotal}, 0 );
foreach my $item (@taxes) {
my $taccno = $item->account;
+ $form->{invtotal} += $form->round_amount(
+ $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2);
$form->{"${taccno}_total"} =
- $form->format_amount( \%myconfig, $item->value, 2 );
+ $form->format_amount( \%myconfig,
+ $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2 );
$tax .= qq|
<tr>
<th align=right>$form->{"${taccno}_description"}</th>
<td align=right>$form->{"${taccno}_total"}</td>
</tr>
- | if $item->value;
+ | if $form->{"${taccno}_base"};
}
$form->{invsubtotal} =
diff --git a/bin/pos.pl b/bin/pos.pl
index 6492ad35..f4192cb6 100644
--- a/bin/pos.pl
+++ b/bin/pos.pl
@@ -127,18 +127,19 @@ sub add {
}
sub openinvoices {
- undef $column_data;
- undef $column_heading;
+ undef %column_data;
+ undef %column_heading;
+ $form->{customer} = "";
+ $form->{customer_id} = 0;
+ delete $form->{l_subtotal};
+ delete $form->{subtotal};
$ENV{REMOTE_ADDR} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
$form->{till} = $4;
$form->{sort} = 'transdate';
- for (
- qw(open l_invnumber l_transdate l_name l_amount l_curr l_till l_subtotal)
- )
- {
+ for (qw(open l_invnumber l_transdate l_name l_amount l_curr l_till)) {
$form->{$_} = 'Y';
}
@@ -994,7 +995,7 @@ sub print_form {
}
if ( $form->{media} ne 'screen' ) {
- $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
$form->{printmode} = '|-';
}