sharee.bike/copri4/main/src/Mod/Printpreview.pm

1054 lines
33 KiB
Perl
Raw Normal View History

2021-12-30 12:05:56 +01:00
package Printpreview;
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
#
#
use strict;
use warnings;
use POSIX;
use CGI::Cookie ();
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
use DateTime;
use DateTime::Format::Pg;
use Scalar::Util qw(looks_like_number);
use Lib::Config;
use Mod::Libenz;
2022-07-08 07:32:42 +02:00
use Mod::DBtank;
2022-02-10 16:45:22 +01:00
use Mod::Pricing;
2022-10-31 08:11:53 +01:00
use Data::Dumper;
2021-12-30 12:05:56 +01:00
sub new {
my $class = shift;
my $self = {};
bless($self,$class);
return $self;
}
sub printpre(){
my $q = new CGI;
my $cf = new Config;
my $lb = new Libenz;
2022-07-08 07:32:42 +02:00
my $dbt = new DBtank;
2022-02-10 16:45:22 +01:00
my $pri = new Pricing;
2021-12-30 12:05:56 +01:00
my %varenv = $cf->envonline();
my $path = $q->path_info();
my $script = $q->script_name();
my $user_agent = $q->user_agent();
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
my $lang="de";
2022-10-31 08:11:53 +01:00
my $dbh = "";
2021-12-30 12:05:56 +01:00
my $printer_id=$R::printer_id;
my $u_id=$R::u_id;
my $c_id=$R::c_id4trans;
my $mandant_main_id=$R::mandant_main_id;
my $main_id=$R::main_id;
my $ct_name2print=$R::ct_name2print;
2022-11-14 21:16:22 +01:00
my $pkey = $R::pkey || "";
2022-10-31 08:11:53 +01:00
my $debug = 0;#print line to doc if debug
2021-12-30 12:05:56 +01:00
2022-11-14 21:16:22 +01:00
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
my $aconf = Config::General->new($api_file);
my %apikeyconf = $aconf->getall;
2022-02-01 20:53:23 +01:00
print $q->start_html(-title=>'',
2021-12-30 12:05:56 +01:00
-base=>'true',
2022-10-31 08:11:53 +01:00
-target=>'Printpre',
-title=>"$R::ct_name2print"
2021-12-30 12:05:56 +01:00
);
my $width="1400px";
if(1==1){
print "<style type='text/css'><!--
body,html {
background-color: white;
width: $width;
margin: 0px; padding: 0;
border: 0px solid black;
text-align: left;
font-family: Arial,sans-serif;
font-size:22px;
}
.Oline {
border-bottom-width:1px;
border-bottom-style:solid;
border-color:black;
margin:0.5em 0;
}
th {
2022-10-31 08:11:53 +01:00
font-size:0.91em;
2021-12-30 12:05:56 +01:00
border-bottom: solid thin gray;
2022-10-31 08:11:53 +01:00
border-right: solid thin gray;
2021-12-30 12:05:56 +01:00
}
td {
border:0px;
}
.tdtxt {
2022-05-01 18:31:03 +02:00
font-size:0.91em;
2021-12-30 12:05:56 +01:00
padding:0.1em 0.5em;
vertical-align: top;
text-align: left;
min-width:5em;
}
.tdtxt2 {
font-size:1em;
padding:0.1em 0.5em;
vertical-align: top;
text-align: left;
width:50%;
}
2022-03-02 14:16:30 +01:00
2021-12-30 12:05:56 +01:00
.tdsum {
font-size:1em;
padding:0.1em 0.5em;
vertical-align: top;
text-align: right;
2022-11-02 20:14:57 +01:00
font-weight:bold;
2021-12-30 12:05:56 +01:00
}
.tdint {
2022-05-01 18:31:03 +02:00
font-size:0.91em;
2021-12-30 12:05:56 +01:00
padding:0.1em 0.5em;
vertical-align: top;
text-align: right;
min-width:20px;
}
.tdpdf1 {
font-size:1.2em;
padding:0.1em 0;
vertical-align: top;
text-align: left;
}
.tdpdf2 {
background-color:white;
padding:0.1em 1.2em 0 0;
vertical-align: top;
text-align: left;
font-size:0.85em;
}
.tdpdf3 {
padding:0.1em 0 0.3em 0;
vertical-align: top;
text-align: center;
font-size:1em;
}
.tdpdf4 {
padding:0.2em 0;
vertical-align: top;
text-align: left;
font-size:1em;
}
.tdpdf5 {
padding:0.2em 0;
vertical-align: top;
text-align: right;
font-size:1em;
}
//--></style>";
}
2022-10-31 08:11:53 +01:00
my $tplf = $dbt->get_tpl($dbh,201);#Kunden-Faktura alias Firma tpl
2021-12-30 12:05:56 +01:00
my @tplf_order = split /,/,$tplf->{tpl_order};
#logging siteformat
open(PMA, ">> $varenv{logdir}/Printpreview.log");
2022-10-31 08:11:53 +01:00
print PMA "\n-->$now_dt --> $varenv{dbname}-$ct_name2print\n";
2021-12-30 12:05:56 +01:00
2022-11-14 21:16:22 +01:00
if(!$apikeyconf{pdfprinter}->{pkey} || !$pkey || $apikeyconf{pdfprinter}->{pkey} ne $pkey){
print "Failure: access denied, api-key doesn't match";
return Apache2::Const::OK;
exit 0;
}
2021-12-30 12:05:56 +01:00
my $site=1;
my $site_all=1;
2022-10-31 08:11:53 +01:00
my $header_top = 0;
2023-08-01 14:26:20 +02:00
my $footer_px = 1800;
2022-10-31 08:11:53 +01:00
my $footer_top = $footer_px;#end 1.site
2021-12-30 12:05:56 +01:00
2022-10-31 08:11:53 +01:00
my $sum_paid = 0;
my $exit_table_wc = 0;
my $nullcount = 0;
my $cttpos = { c_id => 0 };
my $max_table_wc = "10";
my $break_table_wc = 0;
my $ctf = { c_id => 0 };
my $pref_cu = {
table => "contentuser",
fetch => "one",
c_id => $mandant_main_id,
};
$ctf = $dbt->fetch_tablerecord($dbh,$pref_cu) if($mandant_main_id);
my $ctt = { c_id => 0 };
my $pref_ctt = {
table => "contenttrans",
fetch => "one",
c_id => $c_id,
};
$ctt = $dbt->fetch_record($dbh,$pref_ctt) if($c_id);
#pre-count position rows
if($ctt->{int10} && $ctt->{int10} == 2){
$max_table_wc = "41";
#take original operator accounting c_id to collect related invoices
if($ctt->{template_id} != 208){#not equal Abrechnung
my $pref = {
table => "contenttrans",
fetch => "one",
barcode => $ctt->{barcode},
txt00 => "Abrechnung",
};
my $ctt_accounting = $dbt->fetch_record($dbh,$pref);
($cttpos,$break_table_wc) = $dbt->collect_contenttrans($dbh,$ctt_accounting->{content_id});
}else{
2022-11-02 20:14:57 +01:00
($cttpos,$break_table_wc) = $dbt->collect_contenttrans($dbh,$ctt->{c_id});
2022-10-31 08:11:53 +01:00
}
}
2022-11-02 20:14:57 +01:00
#client rental position
else{
$max_table_wc = "12";
($cttpos,my $rows) = $dbt->collect_contentpos($dbh,"contenttrans",$ctt->{c_id});
#pre counting rentals with gesamt > 0 to get line count
foreach my $id (sort { $cttpos->{$b}->{c_id} <=> $cttpos->{$a}->{c_id} } keys(%$cttpos)){
my $gesamt = 0;
my $pricing = {};
my $counting = {};
if($cttpos->{$id}->{int35} && $cttpos->{$id}->{start_time} && $cttpos->{$id}->{end_time}){
$pri->count_freedrental("Printpreview",\%varenv,$ctt->{int10},$cttpos->{$id});
($pricing,$counting) = $pri->counting_rental(\%varenv,$cttpos->{$id});
2022-11-02 20:14:57 +01:00
$gesamt = $pri->round($pricing->{total_price});
$gesamt = sprintf('%.2f', $gesamt);
}else{
($gesamt,my $rabatt) = $pri->price2calc($cttpos->{$id});
$gesamt = $pri->round($gesamt);
$gesamt = sprintf('%.2f', $gesamt);
}
if($gesamt != 0){
$break_table_wc++;
}
}
}
print PMA "ctt.c_id: $ctt->{c_id} | ctt.int10: $ctt->{int10} | break_table_wc: $break_table_wc > max_table_wc:$max_table_wc\n";
2021-12-30 12:05:56 +01:00
if($break_table_wc > $max_table_wc){
2022-10-31 08:11:53 +01:00
$site_all = $break_table_wc / $max_table_wc;
$site_all += 1 if($site_all =~ /\d\.\d/);
$site_all = sprintf('%.1d',$site_all);
print PMA "2) site_all: $site_all if($break_table_wc > $max_table_wc)\n";
2021-12-30 12:05:56 +01:00
}
2022-10-31 08:11:53 +01:00
if(1==1){
for($site=1; $site <= $site_all; $site++){
#1.site
if($site == 1){
print PMA "1.$site) header_big header_top: $header_top | $site\n";
&header_big(\%varenv,$ctf,$ctt,$header_top);
&data_invoice(\%varenv,$ctt,$ct_name2print,$header_top);
#operator invoices int02=2 Operator-Faktura else position accounting
if($ctt->{int10} && $ctt->{int10} == 2){
2022-11-02 20:14:57 +01:00
($break_table_wc,$nullcount) = &accounting_data_table(\%varenv,$ctf,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
2022-10-31 08:11:53 +01:00
}else{
2022-11-02 20:14:57 +01:00
($break_table_wc,$nullcount) = &data_table(\%varenv,$ctf,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
2022-10-31 08:11:53 +01:00
}
2021-12-30 12:05:56 +01:00
2022-10-31 08:11:53 +01:00
print PMA "1.$site) text_footer: footer_top: $footer_top | $site/$site_all\n";
&text_footer(\%varenv,$ctf,$ctt,$footer_top,$site,$site_all);
2021-12-30 12:05:56 +01:00
}
2022-10-31 08:11:53 +01:00
# > 2.site
else{
my $header_px = 2000;
$header_top = $header_px;#2. site
$header_top = $header_px * ($site -1);
$footer_top = $footer_px * $site + ($header_px - $footer_px -10);
2022-11-02 20:14:57 +01:00
$footer_top = $footer_px * $site + ($site * (0.70 * ($header_px - $footer_px))) if($site > 2);
2022-10-31 08:11:53 +01:00
print PMA "2.$site) text_footer footer_top: $footer_top | $site/$site_all\n";
&text_footer(\%varenv,$ctf,$ctt,$footer_top,$site,$site_all);
print PMA "2.$site) header_small header_top: $header_top | $site/$site_all\n";
&header_small(\%varenv,$ctf,$header_top);
$header_top = $header_top + 250;
&data_invoice(\%varenv,$ctt,$ct_name2print,$header_top);
#table_break
$break_table_wc -= $max_table_wc;
print PMA "2.$site) break_table_wc: $break_table_wc > max_table_wc:$max_table_wc\n";
$header_top +=60;
#operator invoices int02=2 Operator-Faktura else position accounting
if($ctt->{int10} && $ctt->{int10} == 2){
2022-11-02 20:14:57 +01:00
($exit_table_wc,$nullcount) = &accounting_data_table(\%varenv,$ctf,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
2022-10-31 08:11:53 +01:00
}else{
2022-11-02 20:14:57 +01:00
($exit_table_wc,$nullcount) = &data_table(\%varenv,$ctf,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
2022-10-31 08:11:53 +01:00
}
}#end > 2.site
}
2022-11-02 20:14:57 +01:00
&text_description(\%varenv,$ctf,$ctt,$nullcount,$footer_top);
2021-12-30 12:05:56 +01:00
}
2022-10-31 08:11:53 +01:00
2021-12-30 12:05:56 +01:00
close PMA;
2022-10-31 08:11:53 +01:00
#header_small
2021-12-30 12:05:56 +01:00
sub header_small(){
2022-10-31 08:11:53 +01:00
my $varenv = shift;
my $ctf = shift;
my $header_top = shift || 0;
my $position = "";
my $header_toppx = "$header_top" . "px";
$position = "position:absolute; top: $header_toppx;" if($header_top);
my $line = "";
$line = $header_top if($debug);
2022-07-08 07:32:42 +02:00
my $height = "120px;";
2022-09-21 19:24:42 +02:00
my $margin = "0 0 100px 0;";
2022-10-31 08:11:53 +01:00
if($dbt->{operator}->{$varenv->{dbname}}->{project} =~ /Bayern|Freiburg/){
2022-07-08 07:32:42 +02:00
$height = "200px;";
$margin = "0;";
}
my $logo = $ctf->{img01};
$logo = "Logo-sharee_right.png" if($ctt->{int10} == 2);
print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:$margin"},"$line",$q->img({-src=>"$varenv->{metahost}/img/$logo",-height=>"$height"})),"\n";
2022-10-31 08:11:53 +01:00
}#end header_small
2021-12-30 12:05:56 +01:00
2022-10-31 08:11:53 +01:00
#header_big
2021-12-30 12:05:56 +01:00
sub header_big(){
2022-10-31 08:11:53 +01:00
my $varenv = shift;
my $ctf = shift;
my $ctt = shift;
my $header_top = shift || 0;
2022-07-08 07:32:42 +02:00
$ctt->{txt01} = $lb->newline($ctt->{txt01},"","0");
2022-10-31 08:11:53 +01:00
my $line = "";
$line = $header_top if($debug);
2021-12-30 12:05:56 +01:00
2022-07-08 07:32:42 +02:00
my $height = "120px;";
2022-09-21 19:24:42 +02:00
my $margin = "0 0 100px 0;";
2022-10-31 08:11:53 +01:00
if($dbt->{operator}->{$varenv->{dbname}}->{project} =~ /Bayern|Freiburg/){
2022-07-08 07:32:42 +02:00
$height = "200px;";
$margin = "0;";
}
2022-10-31 08:11:53 +01:00
my $logo = $ctf->{img01};
$logo = "Logo-sharee_right.png" if($ctt->{int10} == 2);
print $q->div({-style=>"width:$width;text-align:right;border:0px solid black;margin:$margin"},$q->img({-src=>"$varenv->{metahost}/img/$logo",-height=>"$height"})),"\n";
2021-12-30 12:05:56 +01:00
print $q->start_table({-width=>'100%',-border=>'0',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
print "<tr>\n";
2022-02-04 15:42:58 +01:00
print "<td style='border:0px solid black;vertical-align:top;width:60%;height:250px;padding:0 0 0 2em;'>\n";
2021-12-30 12:05:56 +01:00
print $q->start_table({-width=>'100%',-border=>'0',-align=>'left', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf4', -style=>'padding-bottom:0.8em;text-decoration:underline;color:black;'}, "$ctf->{txt01} | $ctf->{txt03} | $ctf->{txt06}"),"\n";
2021-12-30 12:05:56 +01:00
#print $q->Tr();
2022-07-08 07:32:42 +02:00
#print $q->td({-class=>'tdpdf1'}, "$ctt->{txt02} &nbsp;"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt01} &nbsp;"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt03} &nbsp;"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt06} &nbsp;"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-style=>'padding:0.8em 0;'}),"\n";
2021-12-30 12:05:56 +01:00
print $q->end_table;
print "</td>";
my $txid = "";
2022-02-01 20:53:23 +01:00
$txid = "Verwendungszweck TXID: $ctt->{txt16}" if($ctt->{txt16} && $ctt->{state} =~ /payone/i);
2021-12-30 12:05:56 +01:00
my $mailaccount = "";
$mailaccount = "Account: $ctt->{txt08}" if($ctt->{txt08});
2022-02-04 15:42:58 +01:00
my $invoice_period = "";
$invoice_period = "Leistungszeitraum: $ctt->{txt20}" if($ctt->{txt20});
2021-12-30 12:05:56 +01:00
2022-02-04 15:42:58 +01:00
print "<td style='width:40%;vertical-align:right;border:0px solid black;'>";
2021-12-30 12:05:56 +01:00
print $q->start_table({-border=>'0',-align=>'right', -cellpadding=>'0', -cellspacing=>'0'});
print $q->Tr();
print $q->td({-style=>'padding:2em 0;'},"&nbsp;"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf5'}, "$txid"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf5'}, "$mailaccount"),"\n";
print $q->Tr();
2022-02-04 15:42:58 +01:00
print $q->td({-class=>'tdpdf5'}, "$invoice_period"),"\n";
2021-12-30 12:05:56 +01:00
print $q->end_table;
print "</td>";
print "</tr>";
print $q->end_table;
2022-10-31 08:11:53 +01:00
}#end header_big
2021-12-30 12:05:56 +01:00
2022-10-31 08:11:53 +01:00
#head line
2021-12-30 12:05:56 +01:00
sub data_invoice(){
2022-10-31 08:11:53 +01:00
my $varenv = shift;
my $ctt = shift;
my $ct_name2print = shift;
my $header_top = shift || 0;
my $line = "";
$line = $header_top if($debug);
2022-11-02 20:14:57 +01:00
my $kd_nr = " Kunden Nr. $ctt->{int10}" if($ctt->{int10} != 2);
2022-10-31 08:11:53 +01:00
my $mandat_nr = "";
$mandat_nr = " Mandatsreferenz: $ctt->{txt26}" if($ctt->{txt26} =~ /\w{2}-/);
my $invoice_time = $ctt->{invoice_time} || $ctt->{mtime};
2023-02-10 12:04:30 +01:00
my $update_ctt = {
table => "contenttrans",
invoice_time => "$invoice_time",
};
$dbt->update_record($dbh,$update_ctt,$ctt);
2022-10-31 08:11:53 +01:00
my $mtime = $lb->time4de("$invoice_time","");
my $position = "";
my $header_toppx = "$header_top" . "px";
$position = "position:absolute; top: $header_toppx;" if($header_top);
2021-12-30 12:05:56 +01:00
print $q->div({-style=>"width:$width;$position border: 0px solid black;"},
2022-10-31 08:11:53 +01:00
$q->span({-style=>'font-size:1.5em;margin:0.5em 0 0.5em 0.5em;'},"$line","$ctt->{txt00}"),
$q->span({-style=>'font-size:1em;margin:0.5em 0.5em 0.5em 0;'},"Nr. $varenv->{dbname}-$ct_name2print"),
2021-12-30 12:05:56 +01:00
$q->span({-style=>'float:right;text-align:right;font-size:1em;margin:0.5em 0 0.5em 0;'},"Datum: $mtime&nbsp;"),
$q->span({-style=>'font-size:1em;margin:0.5em;'}," $kd_nr"),
$q->span({-style=>'font-size:1em;margin:0.5em;'}," $mandat_nr"),
);
}
2022-10-31 08:11:53 +01:00
#operator accounting invoice
sub accounting_data_table {
my $varenv = shift;
my $ctf = shift;
my $ctt = shift;
my $cttpos = shift;
my $break_table_wc = shift || 0;
my $max_table_wc = shift || 0;
my $header_top = shift || 0;
my @tpl_order = ();
#int9x are not in db
2022-11-06 18:45:59 +01:00
#operator invoice
2022-10-31 08:11:53 +01:00
if($ctt->{txt00} eq "Rechnung"){
2022-12-02 07:25:27 +01:00
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int93=Entgelt TeilRad GmbH");
2022-10-31 08:11:53 +01:00
}
2022-11-06 18:45:59 +01:00
#operator accounting
2022-10-31 08:11:53 +01:00
else{
2022-11-06 18:45:59 +01:00
if($varenv->{dbname} eq "sharee_sx"){
2022-12-02 07:25:27 +01:00
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int94=Disagio","int02=Gutschrift");
2022-11-06 18:45:59 +01:00
}else{
2022-12-02 07:25:27 +01:00
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int94=Disagio","int95=Transaktion","int96=Zahlungsmeldung","int97=Kreditkarte Zuordnung","int02=Gutschrift");
2022-10-31 08:11:53 +01:00
}
}
my $sum_operatorcredit=0;
my $diff19 = 100 + 19;
my $sum_umst19=0;
my $i=0;
my $j=0;
my $rows = 0;
my $header_toppx = "$header_top" . "px";
my $position = "";;
$position = "position:absolute; top: $header_toppx;" if($header_top);
my $line = "";
$line = $header_top if($debug);
print "\n<div style='width:$width;$position border:0px solid black;'>\n";
print $q->start_table({ -border=>'0', -width=>"$width",-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
my $tc=0;
print $q->Tr();
#print $q->th("$line Pos."),"\n";
foreach (@tpl_order){
my ($key,$val) = split /=/,$_;
$tc++;
$val = "$line $val" if($key eq "c_id");
print $q->th({-class=>'tdint'},"$val");
}
2022-11-02 20:14:57 +01:00
my $ctf_operator = { c_id => 0 };
my $pref_cuop = {
table => "contentuser",
fetch => "one",
c_id => 2,
};
$ctf_operator = $dbt->fetch_tablerecord($dbh,$pref_cuop);
2022-10-31 08:11:53 +01:00
foreach my $id (sort { $cttpos->{$b}->{c_id} <=> $cttpos->{$a}->{c_id} } keys(%$cttpos)){
#print Dumper($cttpos->{$id}); exit;
my $oac = { c_id => 0 };
2022-11-02 20:14:57 +01:00
$oac = $pri->operator_accounting2calc($varenv,$cttpos->{$id},$ctf_operator);
2022-10-31 08:11:53 +01:00
$oac->{int01} = sprintf('%.2f', $oac->{int01});
$j++;
#if($j<=$max_table_wc || $break_table_wc)
if($j<=$max_table_wc){
$now_dt =~ s/[-:\s]//g;
open(CSV, ">> $varenv->{pdf}/$ctt->{txt00}-$ctt->{c_id}-$now_dt.csv") or die "Can't opencsv\n";
$i++;
print $q->Tr(),"\n";
#print $q->td({-class=>'tdint'},"$i"),"\n";
foreach (@tpl_order){
my ($key,$val) = split /=/,$_;
$cttpos->{$id}->{$key} = $q->unescapeHTML($cttpos->{$id}->{$key});
if(1==1){
if($key =~ /ct_name/){
print CSV "$cttpos->{$id}->{$key};";
#print $q->td({-class=>'tdtxt'},"\# $cttpos->{$id}->{$key} $cttpos->{$id}->{txt01}"),"\n";
print $q->td({-class=>'tdtxt'},"\# $cttpos->{$id}->{$key}"),"\n";
}
elsif($key =~ /c_id/){
print CSV "$cttpos->{$id}->{$key};";
if($debug){
2022-11-14 21:16:22 +01:00
print $q->td({-class=>'tdint'},"$i) $cttpos->{$id}->{$key}"),"\n";
2022-10-31 08:11:53 +01:00
}else{
2022-11-14 21:16:22 +01:00
print $q->td({-class=>'tdint'},"$cttpos->{$id}->{$key}"),"\n";
2022-10-31 08:11:53 +01:00
}
}
elsif($key =~ /int/){
$oac->{$key} =~ s/\./,/;
if($key =~ /int02|int93/){
2022-10-31 08:11:53 +01:00
print CSV "$oac->{$key}\n";
}else{
print CSV "$oac->{$key};";
}
print $q->td({-class=>'tdint',-nowrap=>1},"$oac->{$key} €"),"\n";
}
elsif($key =~ /state/){
$cttpos->{$id}->{$key} =~ s/ \(payone\)//;
print CSV "$cttpos->{$id}->{$key};";
print $q->td({-class=>'tdint',-nowrap=>1},"$cttpos->{$id}->{$key}"),"\n";
}
elsif($key =~ /txt/){
print CSV "$cttpos->{$id}->{$key};";
print $q->td({-class=>'tdtxt'},"$cttpos->{$id}->{$key}"),"\n";
}
}
}
delete $cttpos->{$id};
close CSV;
}
}
2022-11-28 18:28:06 +01:00
#Sum Operator invoice
2022-10-31 08:11:53 +01:00
if($break_table_wc > 0 && $break_table_wc <= $max_table_wc){
2021-12-30 12:05:56 +01:00
2022-12-02 07:25:27 +01:00
#print "$ctt->{int01}|$ctt->{int02}|";
2022-11-28 18:28:06 +01:00
my $sum_brutto = $ctt->{int01} || 0;
2022-12-02 07:25:27 +01:00
$sum_brutto =~ s/,/\./;#hm
2022-11-28 18:28:06 +01:00
my $sum_operatorcredit = $ctt->{int02} || 0;
my $total_operatorcredit = $sum_operatorcredit - $sum_brutto;
2022-12-02 07:25:27 +01:00
$total_operatorcredit =~ s/\./,/;
2022-11-28 18:28:06 +01:00
if($sum_brutto && $sum_brutto != 0){
$sum_umst19 = $sum_brutto / $diff19 * 19;
2022-10-31 08:11:53 +01:00
$sum_umst19 = $pri->round($sum_umst19);
}
2022-11-28 18:28:06 +01:00
my $sum_netto19 = $sum_brutto - $sum_umst19;
2022-10-31 08:11:53 +01:00
$sum_netto19 = sprintf('%.2f', $sum_netto19);
$sum_netto19 =~ s/\./,/;
2022-11-28 18:28:06 +01:00
$sum_brutto =~ s/\./,/;
2022-10-31 08:11:53 +01:00
$sum_umst19 = sprintf('%.2f', $sum_umst19);
$sum_umst19 =~ s/\./,/;
$sum_operatorcredit = sprintf('%.2f', $sum_operatorcredit);
$sum_operatorcredit =~ s/\./,/;
print $q->Tr(),"\n";
print $q->td({-class=>'Oline',-colspan=>$tc},"&nbsp;"),"\n";
my $payment_text = "";
foreach(@tplf_order){
my ($key,$des,$size) = split /=/,$_;
if($key =~ /txt5\d/){
$ctf->{$key} = $q->unescapeHTML("$ctf->{$key}");
$ctf->{$key} = $lb->newline($ctf->{$key},"","");
$ctt->{state} =~ s/\(payone.*//;
if($des =~ /$ctt->{state}/){
2022-11-28 18:28:06 +01:00
if($sum_brutto < 0){
2022-10-31 08:11:53 +01:00
$payment_text = "$ctf->{txt58}";
}else{
$payment_text = "$ctf->{$key}";
}
}
}
}
2022-11-28 18:28:06 +01:00
my $sc = 2;
$sc = 1 if($ctt->{template_id} != 208);
my $pt = $tc - $sc;
2022-10-31 08:11:53 +01:00
print "<tr>\n";
2022-11-28 18:28:06 +01:00
print "<td colspan='$pt' style='border:0px solid silver;vertical-align:top;padding:0.2em 0.5em;font-size:0.91em;'>$payment_text</td>\n";
2021-12-30 12:05:56 +01:00
2022-10-31 08:11:53 +01:00
###print sum
2022-11-28 18:28:06 +01:00
print "<td colspan='$sc' style='font-size:1em;max-width:200px;'>\n";
print $q->start_table({-style=>'border:1px solid silver;', -border=>'0', -width=>'100%',-align=>'right', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
2022-10-31 08:11:53 +01:00
2022-11-28 18:28:06 +01:00
#Sum operator invoive
2022-10-31 08:11:53 +01:00
if($ctt->{template_id} != 208){#not equal Abrechnung
print $q->Tr("\n");
2022-11-14 21:16:22 +01:00
print $q->td({-class=>'tdint',-colspan=>1},"Nettobetrag");
2022-10-31 08:11:53 +01:00
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_netto19 €");
if($sum_netto19 != 0){
print $q->Tr("\n");
2022-11-14 21:16:22 +01:00
print $q->td({-class=>'tdint',-colspan=>1,-nowrap=>"1"},"19% UmSt auf $sum_netto19 €");
2022-10-31 08:11:53 +01:00
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_umst19 €");
}
print $q->Tr("\n");
2022-12-02 07:25:27 +01:00
print $q->td({-class=>'tdsum',-colspan=>1},"Entgelt TeilRad GmbH");
2022-11-28 18:28:06 +01:00
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_brutto €");
2022-10-31 08:11:53 +01:00
}
#Summe Betreiber Abrechnung (Gutschrift)
else{
print $q->Tr("\n");
2022-12-02 07:25:27 +01:00
print $q->td({-class=>'tdsum',-colspan=>1},"Summe Gutschrift");
2022-10-31 08:11:53 +01:00
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_operatorcredit €");
2022-11-28 18:28:06 +01:00
print $q->Tr("\n");
2022-12-02 07:25:27 +01:00
print $q->td({-class=>'tdsum',-colspan=>1},"Entgelt TeilRad GmbH");
2022-11-28 18:28:06 +01:00
print $q->td({-class=>'tdint',-nowrap=>"1"},"- $sum_brutto €");
print $q->Tr("\n");
print $q->td({-class=>'tdsum',-colspan=>1},"Auszahlungsbetrag");
print $q->td({-class=>'tdint',-nowrap=>"1"},"$total_operatorcredit €");
2022-10-31 08:11:53 +01:00
}
print $q->end_table,"\n";
print "</td>\n";
###print sum end
print "</tr>\n";
}
print $q->end_table,"\n";
print "</div>\n";
return ($j,$nullcount);
}#end sub accounting_data_table
#client invoice
sub data_table(){
my $varenv = shift;
my $ctf = shift;
my $ctt = shift;
my $cttpos = shift;
my $break_table_wc = shift || 0;
my $max_table_wc = shift || 0;
my $header_top = shift || 0;
2022-11-02 20:14:57 +01:00
#again to keep time format#TODO
#($cttpos,my $rows) = $dbt->collect_contentpos($dbh,"contenttrans",$ctt->{c_id});
2022-05-01 18:31:03 +02:00
my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int03=Menge (Std:Min)","int02=Preis","int07=Rabatt","int04=Gesamt");
2022-02-10 16:45:22 +01:00
foreach my $id (keys(%$cttpos)){
if($cttpos->{$id}->{int26}){
2022-05-01 18:31:03 +02:00
@tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int26=Einsparung","int03=Menge (Std:Min)","int02=Preis","int07=Rabatt","int04=Gesamt");
2022-02-10 16:45:22 +01:00
}
}
2022-11-02 20:14:57 +01:00
my $sum_parts19=0;
my $diff19 = 100 + 19;
my $sum_umst19=0;
my $j=0;
my $nullcount=0;
2022-10-31 08:11:53 +01:00
my $header_toppx = "$header_top" . "px";
2021-12-30 12:05:56 +01:00
my $position;
2022-10-31 08:11:53 +01:00
$position = "position:absolute; top: $header_toppx;" if($header_top);
my $line = "";
$line = $header_top if($debug);
2021-12-30 12:05:56 +01:00
print "\n<div style='width:$width;$position border:0px solid black;'>\n";
2022-03-02 14:16:30 +01:00
print $q->start_table({ -border=>'0', -width=>"$width",-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
2021-12-30 12:05:56 +01:00
#Tableheader
2022-11-02 20:14:57 +01:00
my $tc=0;
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
foreach (@tpl_order){
my ($key,$val) = split /=/,$_;
2022-11-02 20:14:57 +01:00
$tc++ if($val && $key !~ /int07/);
2022-10-31 08:11:53 +01:00
print $q->th({-class=>'tdint'},"$line $val"),"\n" if("$key" eq "ct_name");
2021-12-30 12:05:56 +01:00
print $q->th({-class=>'tdtxt2'},"$val"),"\n" if($key =~ /txt01/);
2022-02-10 16:45:22 +01:00
print $q->th({-class=>'tdint'},"$val"),"\n" if($key =~ /int02|int03|int04|int26/);
2021-12-30 12:05:56 +01:00
}
2022-10-31 08:11:53 +01:00
foreach my $id (sort { $cttpos->{$b}->{c_id} <=> $cttpos->{$a}->{c_id} } keys(%$cttpos)){
2021-12-30 12:05:56 +01:00
2022-02-16 15:56:45 +01:00
my $gesamt = 0;
my $rabatt = "";
2022-05-01 18:31:03 +02:00
my $pricing = {};
my $counting = {};
my $rental_feed = {};
if($cttpos->{$id}->{int35} && $cttpos->{$id}->{start_time} && $cttpos->{$id}->{end_time}){
$pri->count_freedrental("Printpreview",\%varenv,$ctt->{int10},$cttpos->{$id});
($pricing,$counting) = $pri->counting_rental($varenv,$cttpos->{$id});
2023-07-20 09:08:37 +02:00
$rental_feed = $pri->fetch_rentalfeed($varenv,$varenv,$cttpos->{$id},$counting);
2022-05-01 18:31:03 +02:00
$rabatt = $pricing->{discount};
$sum_parts19 += $pricing->{total_price};
$gesamt = $pri->round($pricing->{total_price});
$gesamt = sprintf('%.2f', $gesamt);
}else{
($gesamt,$rabatt) = $pri->price2calc($cttpos->{$id});
$sum_parts19 += $gesamt;
$gesamt = $pri->round($gesamt);
$gesamt = sprintf('%.2f', $gesamt);
}
2021-12-30 12:05:56 +01:00
2022-02-16 15:56:45 +01:00
if($gesamt == 0){
2021-12-30 12:05:56 +01:00
$nullcount++;
}
2022-02-16 15:56:45 +01:00
if($gesamt != 0){
2021-12-30 12:05:56 +01:00
$j++;
2022-11-02 20:14:57 +01:00
if($j<=$max_table_wc){
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
foreach (@tpl_order){
my ($key,$val) = split /=/,$_;
$cttpos->{$id}->{$key} = $q->unescapeHTML("$cttpos->{$id}->{$key}");
$cttpos->{$id}->{$key} = $lb->newline($cttpos->{$id}->{$key},"");
if("$key" eq "ct_name"){
my $ct_pos = "";
if($cttpos->{$id}->{int09}){#if Tarif defined
2022-05-24 10:46:05 +02:00
$ct_pos = "Mietrad: $cttpos->{$id}->{ct_name}";
$ct_pos .= "<br />Endstation: $cttpos->{$id}->{txt13}$cttpos->{$id}->{int04}" if($cttpos->{$id}->{int04});
2021-12-30 12:05:56 +01:00
}else{
$ct_pos = "$cttpos->{$id}->{ct_name}";
}
2022-02-16 15:56:45 +01:00
print $q->td({-class=>'tdint',-nowrap=>'1'},"$ct_pos&nbsp;"),"\n";
2021-12-30 12:05:56 +01:00
}
if($key =~ /txt01/){
2022-03-02 14:16:30 +01:00
print "<td class='tdtxt'>\n";
2021-12-30 12:05:56 +01:00
if($cttpos->{$id}->{$key}){
2022-05-01 18:31:03 +02:00
$cttpos->{$id}->{$key} =~ s/\<br \/\>/, &nbsp; /g;
my $tariff = "";
$tariff = "<br />Tarif: $cttpos->{$id}->{int09} $cttpos->{$id}->{txt04}" if($cttpos->{$id}->{txt04});
print "$cttpos->{$id}->{$key} $tariff<br />\n";
2021-12-30 12:05:56 +01:00
}
2022-02-10 16:45:22 +01:00
if($cttpos->{$id}->{start_time} && $cttpos->{$id}->{end_time}){
2021-12-30 12:05:56 +01:00
#print "<br />\n";
2022-02-10 16:45:22 +01:00
$cttpos->{$id}->{start_time} = $lb->time4de($cttpos->{$id}->{start_time},"1");
$cttpos->{$id}->{end_time} = $lb->time4de($cttpos->{$id}->{end_time},"1");
2022-05-01 18:31:03 +02:00
print $q->span("$cttpos->{$id}->{start_time} $cttpos->{$id}->{end_time}"),"\n";
2021-12-30 12:05:56 +01:00
}
print "</td>\n";
}
2022-02-10 16:45:22 +01:00
if($key eq "int26"){
my $co2saving = "";
if($cttpos->{$id}->{int26}){
$co2saving = "Einsparung</br>";
my $co2diff = $pri->co2calc($cttpos->{$id});
2022-10-31 08:11:53 +01:00
#my $sprit_price = $pri->sprit2calc($cttpos->{$id});
2022-02-10 16:45:22 +01:00
$co2saving .= "$co2diff kg CO&sup2;<br />";
2022-10-31 08:11:53 +01:00
#$co2saving .= "$sprit_price EUR<br />" if($sprit_price !~ /-/);
2022-02-10 16:45:22 +01:00
$cttpos->{$id}->{int26} =~ s/\./,/;
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
}
2022-02-16 15:56:45 +01:00
print $q->td({-class=>'tdint',-nowrap=>'1'},"$co2saving");
2022-02-10 16:45:22 +01:00
}
2021-12-30 12:05:56 +01:00
if($key =~ /int03/){
2022-05-01 18:31:03 +02:00
if($cttpos->{$id}->{int35} && $cttpos->{$id}->{start_time} && $cttpos->{$id}->{end_time}){
print $q->td({-class=>'tdint',-nowrap=>1},"$pricing->{real_clock} $pricing->{freed_time}"),"\n";
}else{
$cttpos->{$id}->{$key} =~ s/\./,/;
print $q->td({-class=>'tdint'},"$cttpos->{$id}->{$key}"),"\n";
}
2021-12-30 12:05:56 +01:00
}
2022-05-01 18:31:03 +02:00
if($key =~ /int02/){
if($cttpos->{$id}->{int35} && $cttpos->{$id}->{start_time} && $cttpos->{$id}->{end_time}){
print "<td class='tdint' nowrap>\n";
2022-05-04 17:50:14 +02:00
foreach my $fid (sort keys(%{ $rental_feed->{rental_description}->{tarif_elements} })){
if(ref($rental_feed->{rental_description}->{tarif_elements}->{$fid}) eq "ARRAY"){
print "$rental_feed->{rental_description}->{tarif_elements}->{$fid}[0]: $rental_feed->{rental_description}->{tarif_elements}->{$fid}[1]<br />\n";
2022-05-01 18:31:03 +02:00
}
}
print "</td>\n";
2021-12-30 12:05:56 +01:00
}else{
2022-05-01 18:31:03 +02:00
$cttpos->{$id}->{$key} =~ s/\./,/;
print $q->td({-class=>'tdint',-nowrap=>1},"$cttpos->{$id}->{$key} €"),"\n";
}
}
2021-12-30 12:05:56 +01:00
2022-05-01 18:31:03 +02:00
if($key =~ /int04/){
$gesamt =~ s/\./,/;
2022-02-10 16:45:22 +01:00
if($rabatt != 0){
2022-05-01 18:31:03 +02:00
$rabatt =~ s/\./,/;
print $q->td({-nowrap=>'1',-class=>'tdint'},"$rabatt $gesamt €"),"\n";
2021-12-30 12:05:56 +01:00
}else{
2022-05-01 18:31:03 +02:00
print $q->td({-nowrap=>'1',-class=>'tdint'},"$gesamt €"),"\n";
2021-12-30 12:05:56 +01:00
}
}
}
2022-11-02 20:14:57 +01:00
delete $cttpos->{$id};
2021-12-30 12:05:56 +01:00
}
}
}#end foreach
2022-11-02 20:14:57 +01:00
#Sum Endrechnung
if($break_table_wc > 0 && $break_table_wc <= $max_table_wc){
2021-12-30 12:05:56 +01:00
2022-11-02 20:14:57 +01:00
my $sum_parts19 = $ctt->{int01} || 0;
2022-05-01 18:31:03 +02:00
if($sum_parts19 && $sum_parts19 != 0){
$sum_umst19 = $sum_parts19 / $diff19 * 19;
$sum_umst19 = $pri->round($sum_umst19);
}
2021-12-30 12:05:56 +01:00
my $sum_netto19 = $sum_parts19 - $sum_umst19;
2022-05-01 18:31:03 +02:00
$sum_netto19 = sprintf('%.2f', $sum_netto19);
$sum_netto19 =~ s/\./,/;
2022-02-10 16:45:22 +01:00
my $sum_paid = $sum_parts19;
2022-05-01 18:31:03 +02:00
$sum_paid = $pri->round($sum_paid);
my $sum_preauth = $sum_paid || 0;
$sum_paid = sprintf('%.2f', $sum_paid);
$sum_paid =~ s/\./,/;
$sum_parts19 = sprintf('%.2f', $sum_parts19);
$sum_umst19 = sprintf('%.2f', $sum_umst19);
$sum_umst19 =~ s/\./,/;
2021-12-30 12:05:56 +01:00
2022-11-02 20:14:57 +01:00
my $payment_text = "";
foreach(@tplf_order){
my ($key,$des,$size) = split /=/,$_;
if($key =~ /txt5\d/){
$ctf->{$key} = $q->unescapeHTML("$ctf->{$key}");
$ctf->{$key} = $lb->newline($ctf->{$key},"","");
$ctt->{state} =~ s/\(payone.*//;
if($des =~ /$ctt->{state}/ && ($j <= $max_table_wc || $break_table_wc)){
if($sum_parts19 < 0){
$payment_text = "$ctf->{txt58}";
}else{
$payment_text = "$ctf->{$key}";
}
}
}
}
2021-12-30 12:05:56 +01:00
2022-10-31 08:11:53 +01:00
print $q->Tr(),"\n";
print $q->td({-class=>'Oline',-colspan=>6},"&nbsp;"),"\n";
2021-12-30 12:05:56 +01:00
print "<tr>\n";
2022-10-04 12:14:03 +02:00
print "<td colspan='3' style='border:0px solid silver;vertical-align:top;padding:0.2em 0.5em;font-size:0.91em;'>$payment_text</td>\n";
2022-11-02 20:14:57 +01:00
###print sum
2021-12-30 12:05:56 +01:00
print "<td colspan='3' style='font-size:1em;'>\n";
print $q->start_table({-style=>'border:1px solid silver;', -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
2022-11-02 20:14:57 +01:00
print $q->Tr("\n");
print $q->td({-class=>'tdint',-colspan=>2},"Nettobetrag");
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_netto19 €");
2021-12-30 12:05:56 +01:00
2022-11-02 20:14:57 +01:00
if($sum_netto19 != 0){
print $q->Tr("\n");
print $q->td({-class=>'tdint',-colspan=>2,-nowrap=>"1"},"19% UmSt auf $sum_netto19 €");
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_umst19 €");
}
2021-12-30 12:05:56 +01:00
2022-11-02 20:14:57 +01:00
print $q->Tr("\n");
print $q->td({-class=>'tdsum',-colspan=>2},"Summe");
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_paid €");
}#end break_table_wc
2022-10-31 08:11:53 +01:00
2021-12-30 12:05:56 +01:00
print $q->end_table,"\n";
print "</td>\n";
2022-11-02 20:14:57 +01:00
###print sum end
2021-12-30 12:05:56 +01:00
print "</tr>\n";
print $q->end_table,"\n";
print "</div>\n";
2022-11-02 20:14:57 +01:00
return ($j,$nullcount);
2022-10-31 08:11:53 +01:00
}#end sub data_table
2021-12-30 12:05:56 +01:00
#Beschreibungs-Text
sub text_description(){
2022-10-31 08:11:53 +01:00
my $varenv = shift;
my $ctf = shift;
my $ctt = shift;
my $nullcount = shift || 0;
2022-11-02 20:14:57 +01:00
my $footer_top = shift || 0;
2022-10-31 08:11:53 +01:00
my $position = "";
2022-11-02 20:14:57 +01:00
$footer_top -= 170;
my $footer_toppx = "$footer_top" . "px";
$position = "position:absolute; top: $footer_toppx;" if($footer_top);
2022-10-31 08:11:53 +01:00
my $line = "";
2022-11-02 20:14:57 +01:00
$line = $footer_top if($debug);
2022-10-31 08:11:53 +01:00
print "\n<div style='width:$width;$position border:0px solid black;'>$line\n";
2021-12-30 12:05:56 +01:00
print $q->start_table({-style=>"margin-top:0.5em;", -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'0', -cellspacing=>'0'});
#Frei-Text
2022-10-04 12:14:03 +02:00
my $style = "padding:0.4em;text-align:left;font-size:0.91em;";
2021-12-30 12:05:56 +01:00
if($nullcount > 0){
print $q->Tr();
2022-11-02 20:14:57 +01:00
print $q->td({-style=>"$style"},"In diesem Zeitraum gab es $nullcount kostenfreie Buchungsvorgänge.");
2021-12-30 12:05:56 +01:00
}
2022-10-31 08:11:53 +01:00
if($ctt->{txt12}){
$ctt->{txt12} = $q->unescapeHTML("$ctt->{txt12}");
$ctt->{txt12} = $lb->newline($ctt->{txt12},"","");
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-11-02 20:14:57 +01:00
print $q->td({-style=>"$style"},"$ctt->{txt12}");
2021-12-30 12:05:56 +01:00
}
#Text & Vorbelegungen
print $q->Tr();
foreach(@tplf_order){
my ($key,$des,$size) = split /=/,$_;
if($key =~ /txt6/){
$ctf->{$key} = $q->unescapeHTML("$ctf->{$key}");
2022-07-08 07:32:42 +02:00
$ctf->{$key} = $lb->newline($ctf->{$key},"","");
2021-12-30 12:05:56 +01:00
my @rechnungstext = split(/\<br \/\>/,$ctf->{$key});
2022-10-31 08:11:53 +01:00
if($ctt->{txt21} =~ /$key/){
2021-12-30 12:05:56 +01:00
foreach(@rechnungstext){
print $q->Tr();
2022-11-02 20:14:57 +01:00
print $q->td({-style=>"$style"},"$_");
2021-12-30 12:05:56 +01:00
}
}
}
}
print $q->end_table;
print "</div>\n";
2022-10-31 08:11:53 +01:00
}#end text_description
2021-12-30 12:05:56 +01:00
2022-10-31 08:11:53 +01:00
#site footer
2021-12-30 12:05:56 +01:00
sub text_footer(){
2022-10-31 08:11:53 +01:00
my $varenv = shift;
my $ctf = shift;
my $ctt = shift;
my $footer_top = shift || 0;
my $site = shift || 1;
my $site_all = shift || 1;
2022-07-05 11:44:00 +02:00
my @txt11 = split (/;/,"$ctf->{txt11}");#Tel usw.
my @txt12 = split (/;/,"$ctf->{txt12}");#Geschäftsführer
2022-07-08 07:32:42 +02:00
my @txt19 = split (/;/,"$ctf->{txt19}");#Bank usw.
2021-12-30 12:05:56 +01:00
2023-08-01 14:26:20 +02:00
my $top2 = $footer_top + 150;
2022-10-31 08:11:53 +01:00
$footer_top .= "px";
2021-12-30 12:05:56 +01:00
$top2 .= "px";
2022-10-31 08:11:53 +01:00
print PMA "sub text_footer --> footer_top: $footer_top | top2: $top2\n";
my $line = "";
$line = $footer_top if($debug);
2021-12-30 12:05:56 +01:00
2022-10-31 08:11:53 +01:00
print "<div style='border:0px solid black;background-color:white;height:150px;width:$width;position:absolute;top:$footer_top;'>$line\n";
2022-11-06 18:45:59 +01:00
if($ctt->{int10} == 2){
2022-11-28 18:28:06 +01:00
print $q->span({-style=>'padding:0.2em;text-align:center;font-size:0.81em;'},"Gebühren der Zahlungsdienstleistung:"),"\n" if($ctt->{template_id} == 208);
2022-10-31 08:11:53 +01:00
my $tplop = $dbt->get_tpl($dbh,"196");#Operator-Faktura
my @tplop_order = split /,/,$tplop->{tpl_order};
foreach(@tplop_order){
my ($key,$val,$size,$unit) = split /=/,$_;
2022-11-28 18:28:06 +01:00
if($ctt->{template_id} != 208){
if($key eq "int01"){
$ctt->{$key} =~ s/\./,/;
print $q->span({-style=>'padding:0.2em;text-align:center;font-size:0.81em;'},"$val $ctt->{int21} $unit "),"\n";
2022-10-31 08:11:53 +01:00
}
2022-11-28 18:28:06 +01:00
}else{
if($key ne "int01" && $key =~ /int(\d+)/){
#take fee values used by creating operator accounting invoice
my $count_key = $1 + 20;#cu.int to ctt.int
my $ctt_key = "int" . $count_key;
if($ctt->{$ctt_key}){
$ctt->{$ctt_key} =~ s/\./,/;
print $q->span({-style=>'padding:0.2em;text-align:center;font-size:0.81em;'},"$val $ctt->{$ctt_key} $unit | "),"\n";
}
}
2022-10-31 08:11:53 +01:00
}
}
print "<br />\n";
print "<br />\n";
}
2023-08-01 14:26:20 +02:00
print $q->start_table({-width=>'100%',-border=>'0',-align=>'left', -cellpadding=>'0', -cellspacing=>'0'});
2021-12-30 12:05:56 +01:00
print "<tr>";
2023-08-01 14:26:20 +02:00
print "<td>";
2021-12-30 12:05:56 +01:00
print $q->start_table({-border=>'0',-align=>'left'});
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt12[0]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt12[1]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt12[2]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt12[3]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->end_table;
print "</td>";
2023-08-01 14:26:20 +02:00
print "<td>";
2021-12-30 12:05:56 +01:00
print $q->start_table({-border=>'0',-align=>'left'});
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "TEL: $ctf->{txt07}"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$ctf->{txt08}"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt11[0]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt11[1]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->end_table;
print "</td>";
2023-08-01 14:26:20 +02:00
print "<td>";
2021-12-30 12:05:56 +01:00
print $q->start_table({-border=>'0',-align=>'left'});
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt19[0]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt19[1]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt19[2]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt19[3]"),"\n";
2023-08-01 14:26:20 +02:00
print $q->end_table;
print "</td>";
print "<td>";
print $q->start_table({-border=>'0',-align=>'left'});
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt19[4]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt19[5]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr();
2022-07-08 07:32:42 +02:00
print $q->td({-class=>'tdpdf2'}, "$txt19[6]"),"\n";
2021-12-30 12:05:56 +01:00
print $q->end_table;
print "</td>";
print "</tr>";
print $q->end_table;
print "</div>";
#end Adresse
#}
my $debug = "";
2022-10-31 08:11:53 +01:00
print $q->div({-style=>"text-align:right;width:$width;position:absolute;top:$top2;font-size:0.61em;"},"$debug Seite: $site/$site_all");
2021-12-30 12:05:56 +01:00
}
print $q->end_html;
return Apache2::Const::OK;
}
1;