-#=====================================================================
+#====================================================================
# LX-Office ERP
# Copyright (C) 2004
# Based on SQL-Ledger Version 2.1.9
$jsscript = qq|
<style type="text/css">\@import url(js/jscalendar/calendar-win2k-1.css);</style>
<script type="text/javascript" src="js/jscalendar/calendar.js"></script>
- <script type="text/javascript" src="js/jscalendar/lang/calendar-de.js"></script>
- <script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
+ <script type="text/javascript" src="js/jscalendar/lang/calendar-de.js"></script>
+ <script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
$self->{javascript}
|;
}
$trigger_1 = qq|
Calendar.setup(
- {
- inputField : "$inputField_1",
- ifFormat :"$ifFormat",
- align : "$align_1",
- button : "$button_1"
- }
- );
+ {
+ inputField : "$inputField_1",
+ ifFormat :"$ifFormat",
+ align : "$align_1",
+ button : "$button_1"
+ }
+ );
|;
if ($qty == 2) {
$trigger_2 = qq|
Calendar.setup(
{
- inputField : "$inputField_2",
- ifFormat :"$ifFormat",
- align : "$align_2",
- button : "$button_2"
- }
- );
+ inputField : "$inputField_2",
+ ifFormat :"$ifFormat",
+ align : "$align_2",
+ button : "$button_2"
+ }
+ );
|;
}
$jsscript = qq|
$amount =~ s/\d{3,}?/$&,/g;
$amount =~ s/,$//;
$amount = join '', reverse split //, $amount;
- $amount .= "\.$dec".$fillup;
+ $amount .= "\.$dec".$fillup if ($places ne '' && $places*1 != 0);
}
if ($myconfig->{numberformat} eq '1.000,00') {
$amount =~ s/\d{3,}?/$&./g;
$amount =~ s/\.$//;
$amount = join '', reverse split //, $amount;
- $amount .= ",$dec" .$fillup;
+ $amount .= ",$dec".$fillup if ($places ne '' && $places*1 != 0);
}
if ($myconfig->{numberformat} eq '1000,00') {
$amount = "$whole";
- $amount .= ",$dec" .$fillup;
+ $amount .= ",$dec" .$fillup if ($places ne '' && $places*1 != 0);
}
if ($dash =~ /-/) {
$main::lxdebug->leave_sub();
return $round_amount;
+
}
# Some variables used for page breaks
my ($chars_per_line, $lines_on_first_page, $lines_on_second_page) =
(0, 0, 0);
- my ($current_page, $current_line) = (1, 1);
+ my ($current_page, $current_line, $current_row) = (1, 1, 0);
my $pagebreak = "";
my $sum = 0;
$lpp = $lines_on_second_page;
}
- # Yes we need a manual page break
- if (($current_line + $lines) > $lpp) {
+ # Yes we need a manual page break -- or the user has forced one
+ if ((($current_line + $lines) > $lpp) ||
+ ($self->{"_forced_pagebreaks"} && grep(/^${current_row}$/, @{$self->{"_forced_pagebreaks"}}))) {
my $pb = $pagebreak;
# replace the special variables <%sumcarriedforward%>
$current_line = 1;
}
$current_line += $lines;
+ $current_row++;
}
$sum += $self->parse_amount($myconfig, $self->{"linetotal"}[$i]);
%unique_fields = map({ $_ => 1 } @fields);
@fields = keys(%unique_fields);
+
+ foreach my $field (@fields) {
+ next unless ($self->{$field} =~ /\<pagebreak\>/);
+ $self->{$field} =~ s/\<pagebreak\>//g;
+ if ($field =~ /.*_(\d+)$/) {
+ if (!$self->{"_forced_pagebreaks"}) {
+ $self->{"_forced_pagebreaks"} = [];
+ }
+ push(@{ $self->{"_forced_pagebreaks"} }, "$1");
+ }
+ }
+
my $format = $self->{format};
if ($self->{format} =~ /(postscript|pdf)/) {
$format = 'tex';
'u' => 'underline');
foreach my $field (@fields) {
- if ($field =~ /descrip/) {
- print(STDERR "QFT: ${field}: " . $self->{$field} . "\n");
- }
foreach my $key (keys(%markup_replace)) {
my $new = $markup_replace{$key};
$self->{$field} =~
$main::lxdebug->enter_sub();
my ($self, $dbh, $curr, $transdate, $fld) = @_;
+
+ unless ($transdate) {
+ $main::lxdebug->leave_sub();
+ return "";
+ }
my $query = qq|SELECT e.$fld FROM exchangerate e
WHERE e.curr = '$curr'
$where = "quotation = '1'";
}
- my $query = qq|SELECT id FROM $arap
- WHERE id IN (SELECT MAX(id) FROM $arap
+ my $query = qq|SELECT MAX(id) FROM $arap
WHERE $where
- AND ${table}_id > 0)|;
+ AND ${table}_id > 0|;
my $sth = $dbh->prepare($query);
$sth->execute || $self->dberror($query);
}
+sub get_pricegroup {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $p) = @_;
+
+ my $dbh = $self->dbconnect($myconfig);
+
+ my $query = qq|SELECT p.id, p.pricegroup
+ FROM pricegroup p|;
+
+ $query .= qq|
+ ORDER BY pricegroup|;
+
+ if ($p->{all}) {
+ $query = qq|SELECT id, pricegroup FROM pricegroup
+ ORDER BY pricegroup|;
+ }
+
+ my $sth = $dbh->prepare($query);
+ $sth->execute || $self->dberror($query);
+
+ $self->{all_pricegroup} = ();
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ push @{ $self->{all_pricegroup} }, $ref;
+ }
+ $sth->finish;
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
+
sub audittrail {
my ($self, $dbh, $myconfig, $audittrail) = @_;
$query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
formname, action, employee_id, transdate) VALUES (
$audittrail->{id}, '$audittrail->{tablename}', |
- .$dbh->quote($audittrail->{reference}).qq|',
+ .$dbh->quote($audittrail->{reference}).qq|,
'$audittrail->{formname}', '$audittrail->{action}',
$employee_id, '$audittrail->{transdate}')|;
} else {