bayern invoice layout

This commit is contained in:
ragu 2022-07-08 07:32:42 +02:00
parent 3bb934ee18
commit c2238c9932
5 changed files with 97 additions and 91 deletions

View file

@ -222,7 +222,7 @@ elsif($q->param('request') eq "booking_request"){
}
if(!$still_requested){
#only if not debug
#only if not App debuglevel defined
if(!$authraw->{int11} && $count >= 3){
$response->{response_state} = "Failure: booking_request declined. max count of 3 occupied bikes has been reached";
$response->{response_text} = "Die maximale Anzahl von 3 Reservierungen wurde erreicht";
@ -367,7 +367,8 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
}
$response = {%$response, %$booking_values};
}elsif($q->param('request') eq "booking_update" && (($q->param('state') && $q->param('state') =~ /occupied|available/) || ($q->param('lock_state') && $q->param('lock_state') =~ /locking|locked|unlocking|unlocked/))){
}
elsif($q->param('request') eq "booking_update" && (($q->param('state') && $q->param('state') =~ /occupied|available/) || ($q->param('lock_state') && $q->param('lock_state') =~ /locking|locked|unlocking|unlocked/))){
my $booking_values = {};
#update on sig
@ -398,6 +399,10 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
}
}#end occupied|available
else{
my $record = $apif->user_bikes_occupied($q,$authraw,"");
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
}
}else{
$response->{response_state} = "Failure: no bike defined";

View file

@ -573,6 +573,7 @@ sub set_usertarif {
my $dbh_operator = $dbt->dbconnect_extern($dbname);#operator connect
if($adr_bonus->{txt15} =~ /\w+/){
if(1==1){
my %tarif_hash = ();
my @new_txt30 = ();
#collect multiple tarif by bonusnr
my $pref_cc = {
@ -594,8 +595,8 @@ sub set_usertarif {
print FILE "-2.1-> still activ Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug);
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
$ret = "success::txt15";
push(@new_txt30,$bonus_collect->{$id}->{int22});
#push(@new_txt30,$sourcetarif);
#push(@new_txt30,$bonus_collect->{$id}->{int22});
$tarif_hash{$bonus_collect->{$id}->{int22}} = 1;
}elsif($sourcetarif eq $bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int22}){
print FILE "-2.2-> match-update Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug);
if($id > 3){#means if not file greped with static c_id <= 3
@ -603,15 +604,21 @@ sub set_usertarif {
}
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
$ret = "success::txt15";
push(@new_txt30,$bonus_collect->{$id}->{int22});
#push(@new_txt30,$bonus_collect->{$id}->{int22});
$tarif_hash{$bonus_collect->{$id}->{int22}} = 1;
}else{
#if no matching Bonusnr then keep sourcetarif
print FILE "-2.3-> No matching Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}, doing nothing and keep sourcetarif\n" if($debug);
push(@new_txt30,$sourcetarif);
#$ret = "failure::txt15#top1";
#push(@new_txt30,$sourcetarif);
if($sourcetarif && $sourcetarif =~ /\w\s\w/){
%tarif_hash = map { $_ => 1 } split(/\s+/,$sourcetarif);
}else{
$tarif_hash{$sourcetarif} = 1;
}
}
}
}
@new_txt30 = keys %tarif_hash;
if(@new_txt30){
print FILE "-3-> txt30: @new_txt30\n" if($debug);
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@new_txt30'");

View file

@ -16,9 +16,9 @@ use DateTime;
use DateTime::Format::Pg;
use Scalar::Util qw(looks_like_number);
use Lib::Config;
use Mod::Buttons;
use Mod::Libenz;
use Mod::Libenzdb;
use Mod::DBtank;
use Mod::Pricing;
sub new {
@ -33,14 +33,13 @@ sub printpre(){
my $cf = new Config;
my $lb = new Libenz;
my $db = new Libenzdb;
my $but = new Buttons;
my $dbt = new DBtank;
my $pri = new Pricing;
my %varenv = $cf->envonline();
my $path = $q->path_info();
my $script = $q->script_name();
my $user_agent = $q->user_agent();
my %ib = $but->ibuttons();
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
my $lang="de";
@ -154,12 +153,6 @@ td {
my $ctt = $db->get_content1("contenttrans",$c_id);
#payone Bank
my $footer_bank = $ctf->{txt19};
#manuel Bank
#$footer_bank = $ctf->{txt20} if($ctt->{state} !~ /payone/i);
my $ctt_users = $db->get_owner($ctt->{owner});
my $vendor = $ctt_users->{u_name};#Login-ID
$vendor = $ctt->{txt13} if($ctt->{txt13});#full Name
@ -177,12 +170,7 @@ td {
my $i=0;
my $tplf = $db->get_tpl("201");#Firma tpl
my @tplf_order = split /,/,$tplf->{tpl_order};
my $logo = "$ctf->{img01}" || "";
if($printer_id =~ /Briefpapier/){
#Ohne Logo da Briefpapier
$logo = "";
}
#logging siteformat
open(PMA, ">> $varenv{logdir}/Printpreview.log");
@ -193,10 +181,9 @@ td {
my ($address_wc,$table_wc) = split(/\./,$wc);
$wc = $address_wc + $table_wc;
print PMA "wc: $wc = $address_wc + $table_wc\n";
$wc += 3 if($ctt->{txt00} !~ /Lieferschein/);#Netto+UmSt+Summe Zeilen
print PMA "wc: $wc\n";
my $max_site_wc = "40";
my $max_table_wc = "14";
my $max_table_wc = "10";
print PMA "max_site_wc: $max_site_wc | max_table_wc: $max_table_wc\n";
my $h_top = "0";
@ -204,11 +191,9 @@ td {
print PMA "top: $h_top | $footer_top\n";
#1.seite
&header_small("0",$mandant_main_id,$logo) if("$ctt->{txt00}" =~ /Quittung/);
&header_big("0",$mandant_main_id,$c_id,$logo) if("$ctt->{txt00}" !~ /Quittung/);
&header_big("0",$mandant_main_id,$c_id,$logo);
&data_invoice("0",$vendor,$kd_nr,$mandat_nr,$ctt->{txt00},$ct_name2print,$mtime);
#table
my ($sum_paid,$break_table_wc,$nullcount) = &data_table("0",$c_id,$scol,"",$mandant_main_id,"0",$max_table_wc,$ctt);
#print "$site_all++ if(($wc > $max_site_wc) || ($table_wc > $max_table_wc)) --> $break_table_wc";
@ -222,9 +207,9 @@ td {
print PMA "$site_all,$footer_top,$site,$site_all,$wc\n";
if($site_all == 1){
&text_description("0",$mandant_main_id,$ctt->{txt21},$ctt->{txt12},$ctt->{txt00},$nullcount);
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc,$footer_bank,$logo);
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc);
}else{
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc,$footer_bank,$logo);
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc);
}
#2.seite
@ -244,10 +229,10 @@ td {
#print "$h_top | $table_wc | $break_table_wc >= $max_table_wc";
&text_description($h_top,$mandant_main_id,$ctt->{txt21},$ctt->{txt12},$ctt->{txt00},$nullcount);
$footer_top +=130;
$footer_top +=100;
$site++;
print PMA "$site_all,$footer_top,$site,$site_all,$wc\n";
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc,$footer_bank,$logo);
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc);
}
##########
#
@ -259,7 +244,14 @@ td {
my $position;
my $h_toppx = "$h_top" . "px";
$position = "position:absolute; top: $h_toppx;" if($h_top);
print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:0 0 200px 0;"},$q->span({-style=>'margin:0em;'},$q->img({-src=>"$varenv{metahost}/img/$logo",-height=>'120px;'})),$q->span({-style=>'font-size:1em;'},"\n"));
my $height = "120px;";
my $margin = "0 0 200px 0;";
if($dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern"){
$height = "200px;";
$margin = "0;";
}
print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:$margin"},$q->img({-src=>"$varenv{metahost}/img/$logo",-height=>"$height"})),"\n";
}
#Briefkopf + Adresse
@ -267,9 +259,15 @@ td {
my ($h_top,$mandant_main_id,$c_id,$logo) = @_;
$ctf = $db->get_content1("contentuser","$mandant_main_id");
my $ctt = $db->get_content1("contenttrans",$c_id);
$ctt->{txt01} = $lb->newline($ctt->{txt01},$users->{tiny_mce},"0");
$ctt->{txt01} = $lb->newline($ctt->{txt01},"","0");
print $q->div({-style=>"width:$width; text-align:right;border:0px solid black;margin:0 0 200px 0;"},$q->span({-style=>'margin:0em;'},$q->img({-src=>"$varenv{metahost}/img/$logo",-height=>'120px;'})),$q->span({-style=>'font-size:1em;'},"")),"\n";
my $height = "120px;";
my $margin = "0 0 200px 0;";
if($dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern"){
$height = "200px;";
$margin = "0;";
}
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";
print $q->start_table({-width=>'100%',-border=>'0',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
print "<tr>\n";
@ -277,17 +275,17 @@ td {
print "<td style='border:0px solid black;vertical-align:top;width:60%;height:250px;padding:0 0 0 2em;'>\n";
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->{txt02} | $ctf->{txt03}","\n");
print $q->td({-class=>'tdpdf4', -style=>'padding-bottom:0.8em;text-decoration:underline;color:black;'}, "$ctf->{txt01} | $ctf->{txt02} | $ctf->{txt03}"),"\n";
#print $q->Tr();
#print $q->td({-class=>'tdpdf1'}, "$ctt->{txt02} &nbsp;","\n");
#print $q->td({-class=>'tdpdf1'}, "$ctt->{txt02} &nbsp;"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt01} &nbsp;","\n");
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt01} &nbsp;"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt03} &nbsp;","\n");
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt03} &nbsp;"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt06} &nbsp;","\n");
print $q->td({-class=>'tdpdf1'}, "$ctt->{txt06} &nbsp;"),"\n";
print $q->Tr();
print $q->td({-style=>'padding:0.8em 0;'},"\n");
print $q->td({-style=>'padding:0.8em 0;'}),"\n";
print $q->end_table;
print "</td>";
@ -370,20 +368,19 @@ td {
$h--;
#Übertrag Zwischensumme
if($break_table_wc){
print "<tr>\n";
print "<td colspan='2'></td>\n";
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";
print $q->Tr("\n");
print $q->td({-class=>'tdsum',-colspan=>"$h"},"<b>Übertrag:</b>");
print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_break €<b/>");
print $q->end_table,"\n";
print "</td>\n";
print "</tr>\n";
}
#if($break_table_wc){
# print "<tr>\n";
# print "<td colspan='2'></td>\n";
# 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";
#
# print $q->Tr("\n");
# print $q->td({-class=>'tdsum',-colspan=>"$h"},"<b>Übertrag:</b>");
# print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_break €<b/>");
# print $q->end_table,"\n";
# print "</td>\n";
# print "</tr>\n";
#}
#Tablecontent (ct_name(primary key))
my $sum_parts19=0;
@ -571,7 +568,6 @@ td {
print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_paid €<b/>"),"\n";
if($ctt->{txt00} !~ /steuerfrei/){#dirty hack
print $q->Tr(),"\n";
print $q->td({-class=>'tdint'},"Betrag Netto:"),"\n";
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_netto19 €"),"\n";
@ -580,14 +576,12 @@ td {
print $q->td({-class=>'tdint',-nowrap=>"1"},"19% UmSt auf $sum_netto19 €:"),"\n";
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_umst19 €"),"\n";
}
}
#Zwischensumme
}else{
print $q->Tr(),"\n";
print $q->td({-class=>'tdsum',-colspan=>"$h"},"<b>Zwischensumme:</b>"),"\n";
print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_paid €</b>"),"\n";
#print $q->end_table;
#}else{
# print $q->Tr(),"\n";
# print $q->td({-class=>'tdsum',-colspan=>"$h"},"<b>Zwischensumme:</b>"),"\n";
# print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_paid €</b>"),"\n";
}
print $q->end_table,"\n";
print "</td>\n";
@ -618,7 +612,7 @@ td {
if($ctt_txt12){
$ctt_txt12 = $q->unescapeHTML("$ctt_txt12");
$ctt_txt12 = $lb->newline($ctt_txt12,$users->{tiny_mce},"");
$ctt_txt12 = $lb->newline($ctt_txt12,"","");
print $q->Tr();
print $q->td({-style=>"$style",-colspan=>3},"$ctt_txt12");
}
@ -629,7 +623,7 @@ td {
if($key =~ /txt6/){
$ctf->{$key} = $q->unescapeHTML("$ctf->{$key}");
$ctf->{$key} = $lb->newline($ctf->{$key},$users->{tiny_mce},"");
$ctf->{$key} = $lb->newline($ctf->{$key},"","");
my @rechnungstext = split(/\<br \/\>/,$ctf->{$key});
if($ctt_txt21 =~ /$key/){
foreach(@rechnungstext){
@ -648,12 +642,12 @@ td {
sub text_footer(){
my ($mandant_main_id,$top,$site,$site_all,$wc,$footer_bank,$logo) = @_;
my ($mandant_main_id,$top,$site,$site_all,$wc) = @_;
my $ctf = $db->get_content1("contentuser","$mandant_main_id");
$ctf->{txt01} = $q->unescapeHTML("$ctf->{txt01}");
my @txt11 = split (/;/,"$ctf->{txt11}");#Tel usw.
my @txt12 = split (/;/,"$ctf->{txt12}");#Geschäftsführer
my @txt19 = split (/;/,"$footer_bank");#Bank usw.
my @txt19 = split (/;/,"$ctf->{txt19}");#Bank usw.
$top *= $site;
my $top2 = $top + 120;
@ -673,65 +667,65 @@ td {
print "<td style='width:25%;'>";
print $q->start_table({-border=>'0',-align=>'left'});
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "Geschäftsführer:","\n");
print $q->td({-class=>'tdpdf2'}, "$txt12[0]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt12[0]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt12[1]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt12[1]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt12[2]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt12[2]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt12[3]"),"\n";
print $q->end_table;
print "</td>";
print "<td style='width:25%;'>";
print $q->start_table({-border=>'0',-align=>'left'});
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "TEL: $ctf->{txt08}","\n");
print $q->td({-class=>'tdpdf2'}, "TEL: $ctf->{txt08}"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$ctf->{txt10}","\n");
print $q->td({-class=>'tdpdf2'}, "$ctf->{txt10}"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt11[0]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt11[0]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt11[1]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt11[1]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt11[2]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt11[2]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt11[3]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt11[3]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt11[4]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt11[4]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt11[5]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt11[5]"),"\n";
print $q->end_table;
print "</td>";
print "<td style='width:25%'>";
print $q->start_table({-border=>'0',-align=>'left'});
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[0]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[0]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[1]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[1]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[2]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[2]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[3]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[3]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[4]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[4]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[5]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[5]"),"\n";
print $q->end_table;
print "</td>";
print "<td style='width:25%;'>";
print $q->start_table({-width=>'100%',-border=>'0',-align=>'left'});
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[6]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[6]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[7]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[7]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[8]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[8]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[9]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[9]"),"\n";
print $q->Tr();
print $q->td({-class=>'tdpdf2'}, "$txt19[10]","\n");
print $q->td({-class=>'tdpdf2'}, "$txt19[10]"),"\n";
print $q->end_table;
print "</td>";

View file

@ -99,12 +99,12 @@ sub tpl(){
my ($key,$des,$size) = split /=/,$_;
$size = "60" if($key =~ /ct_name|txt|img/ && !$size);
$ct->{$key} = $q->unescapeHTML("$ct->{$key}");
$ct->{$key} = $lb->newline($ct->{$key});
$des .= " ($key)" if($users_dms->{u_id} eq $varenv{superu_id});
my $value = "";
if($R::config2edit){
$ct->{$key} = $lb->newline($ct->{$key},"","1");
if($size eq "area"){
$value = "<textarea class='etxtarea' name='$key' rows=2 cols=60>$ct->{$key}</textarea>";
$value = "<textarea class='etxtarea' name='$key' rows=8 cols=60>$ct->{$key}</textarea>";
}elsif($size =~ /\w\+\w/){
my ($a,$b) = split /\+/,$size;
my $a_checked;
@ -120,7 +120,7 @@ sub tpl(){
$value = "<input class='etxt' type='text' name='$key' value='$ct->{$key}' size=$size maxlength=200>";
}
}else{
$value = "$ct->{$key}";
$value = $lb->newline($ct->{$key},"","");
}
print $q->Tr();
if($key =~ /ct_name/){

View file

@ -283,7 +283,7 @@ sub tpl(){
}
$debug = "syshost: $varenv->{syshost}, merchant_id: $varenv->{merchant_id}, (c_id4trans:$users_dms->{c_id4trans} && tpl_id4trans:$users_dms->{tpl_id4trans} && kind_of_trans:$users_dms->{kind_of_trans}) $node_meta->{tpl_name},$node_meta->{tpl_id},$node_meta->{ct_table},$parent_id,$main_id, permissions: ($users_dms->{int01},$users_dms->{int02},$users_dms->{int03},$users_dms->{int07},$users_dms->{int08},$users_dms->{int09})" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
print $q->div({-style=>'position:fixed;bottom:0%;right:1%;z-index:10;padding:2px;font-size:13px;'},"$debug",$q->a({-style=>'color:black;text-decoration: none;',-href=>'https://sharee.bike',-target=>'_blank'},"sharee.bike &copy; TeilRad GmbH 2021")),"\n";
print $q->div({-style=>'position:fixed;bottom:0%;right:1%;z-index:10;padding:2px;font-size:13px;'},"$debug",$q->a({-style=>'color:black;text-decoration: none;',-href=>'https://sharee.bike',-target=>'_blank'},"sharee.bike &copy; TeilRad GmbH 2022")),"\n";
#update c_id4trans on changing browser tab 2019-10-08