use SL::DBUtils;
use SL::MoreCommon;
+use strict;
+
our (%myconfig, $form);
sub post_transaction {
$amount = $form->round_amount( $form->{"paid_$i"} * ($form->{exchangerate} - $form->{"exchangerate_$i"}) * -1, 2);
if ($amount != 0) {
- $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno};
+ my $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno};
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey)
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|;
@values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $accno);
my ($self, $form) = @_;
- my ($exchangerate, $key, $akey, $i, $j, $k, $index, $taxamount, $totaltax, $taxrate, $diff);
+ my ($exchangerate, $key, $akey, $i, $j, $k, $index, $taxamount, $totaltax, $taxrate, $diff, $totalwithholding, $withholdingrate,
+ $totalamount, $taxincluded, $tax);
# forex
$form->{forex} = $form->{exchangerate};
create_sort_spec does_table_exist
add_token);
+use strict;
+
sub conv_i {
my ($value, $default) = @_;
return (defined($value) && "$value" ne "") ? $value * 1 : $default;
use vars qw(@required_modules @optional_modules);
+use strict;
+
@required_modules = (
{ "name" => "Class::Accessor", "url" => "http://search.cpan.org/~kasei/" },
{ "name" => "CGI", "url" => "http://search.cpan.org/~lds/" },
use SL::DBUtils;
+use strict;
+
sub partsgroups {
$main::lxdebug->enter_sub();
$form->{discount} /= 100;
my @values = ($form->{partsgroup});
+ my $query;
if ($form->{id}) {
$query = qq|UPDATE partsgroup SET partsgroup = ? WHERE id = ?|;
qq|WHERE pg.id = ?|;
my $sth = prepare_execute_query($form, $dbh, $query, $form->{id},
$form->{id});
- my $ref = $sth->fetchrow_hashref(NAME_lc);
+ my $ref = $sth->fetchrow_hashref("NAME_lc");
map({ $form->{$_} = $ref->{$_} } keys(%{$ref}));
$sth->finish;
my $table = $form->{type} eq "pricegroup" ? "pricegroup" : "partsgroup";
- $query = qq|DELETE FROM $table WHERE id = ?|;
+ my $query = qq|DELETE FROM $table WHERE id = ?|;
do_query($form, $dbh, $query, $form->{id});
$dbh->disconnect;
my $query = qq|SELECT id, pricegroup FROM pricegroup WHERE id = ?|;
my $sth = prepare_execute_query($form, $dbh, $query, $form->{id});
- my $ref = $sth->fetchrow_hashref(NAME_lc);
+ my $ref = $sth->fetchrow_hashref("NAME_lc");
map({ $form->{$_} = $ref->{$_} } keys(%{$ref}));
package User;
-#use strict;
-
use IO::File;
use Fcntl qw(:seek);
use SL::Iconv;
use SL::Inifile;
+use strict;
+
sub new {
$main::lxdebug->enter_sub();
my $dbh =
DBI->connect($myconfig{dbconnect}, $myconfig{dbuser},
$myconfig{dbpasswd})
- or $self->error(DBI::errstr);
+ or $self->error($DBI::errstr);
# we got a connection, check the version
my $query = qq|SELECT version FROM defaults|;
last if ($version < $mindb);
# apply upgrade
- $main::lxdebug->message(LXDebug::DEBUG2, "Applying Update $upgradescript");
+ $main::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $upgradescript");
if ($file_type eq "sql") {
$self->process_query($form, $dbh, "sql/" . $form->{"dbdriver"} .
"-upgrade/$upgradescript", $str_maxdb, $db_charset);
my $file_type = $1;
# apply upgrade
- $main::lxdebug->message(LXDebug::DEBUG2, "Applying Update $control->{file}");
+ $main::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $control->{file}");
print $form->parse_html_template("dbupgrade/upgrade_message2", $control);
if ($file_type eq "sql") {