mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 23:26:29 +02:00
operator accounting fix
This commit is contained in:
parent
7f4becd901
commit
7744e1dccc
13 changed files with 325 additions and 403 deletions
|
@ -104,6 +104,7 @@ td {
|
|||
padding:0.1em 0.5em;
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.tdint {
|
||||
|
@ -159,7 +160,7 @@ td {
|
|||
my $site_all=1;
|
||||
|
||||
my $header_top = 0;
|
||||
my $footer_px = 1780;
|
||||
my $footer_px = 1800;
|
||||
my $footer_top = $footer_px;#end 1.site
|
||||
|
||||
my $sum_paid = 0;
|
||||
|
@ -199,13 +200,36 @@ td {
|
|||
my $ctt_accounting = $dbt->fetch_record($dbh,$pref);
|
||||
($cttpos,$break_table_wc) = $dbt->collect_contenttrans($dbh,$ctt_accounting->{content_id});
|
||||
}else{
|
||||
($cttpos,$break_table_wc) = $dbt->collect_contenttrans($dbh,$ctt->{c_id});
|
||||
($cttpos,$break_table_wc) = $dbt->collect_contenttrans($dbh,$ctt->{c_id});
|
||||
}
|
||||
}else{
|
||||
$max_table_wc = "10";
|
||||
($cttpos,$break_table_wc) = $dbt->collect_contentpos("contenttrans",$ctt->{c_id});
|
||||
}
|
||||
print PMA "break_table_wc: $break_table_wc > max_table_wc:$max_table_wc\n";
|
||||
#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}){
|
||||
($pricing,$counting) = $pri->counting_rental(\%varenv,$cttpos->{$id},"calc_price");
|
||||
$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";
|
||||
|
||||
if($break_table_wc > $max_table_wc){
|
||||
$site_all = $break_table_wc / $max_table_wc;
|
||||
|
@ -224,20 +248,11 @@ td {
|
|||
|
||||
#operator invoices int02=2 Operator-Faktura else position accounting
|
||||
if($ctt->{int10} && $ctt->{int10} == 2){
|
||||
my $ctf_operator = { c_id => 0 };
|
||||
my $pref_cuop = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => 2,
|
||||
};
|
||||
$ctf_operator = $dbt->fetch_tablerecord($dbh,$pref_cuop);
|
||||
|
||||
($break_table_wc,$nullcount) = &accounting_data_table(\%varenv,$ctf_operator,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
|
||||
($break_table_wc,$nullcount) = &accounting_data_table(\%varenv,$ctf,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
|
||||
}else{
|
||||
($sum_paid,$break_table_wc,$nullcount) = &data_table(\%varenv,$ctf,$ctt,$cttpos,$sum_paid,$break_table_wc,$max_table_wc,$header_top);
|
||||
($break_table_wc,$nullcount) = &data_table(\%varenv,$ctf,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
|
||||
}
|
||||
|
||||
&text_description(\%varenv,$ctf,$ctt,$nullcount,0);
|
||||
print PMA "1.$site) text_footer: footer_top: $footer_top | $site/$site_all\n";
|
||||
&text_footer(\%varenv,$ctf,$ctt,$footer_top,$site,$site_all);
|
||||
}
|
||||
|
@ -248,7 +263,7 @@ td {
|
|||
|
||||
$header_top = $header_px * ($site -1);
|
||||
$footer_top = $footer_px * $site + ($header_px - $footer_px -10);
|
||||
$footer_top = $footer_px * $site + ($site * (0.65 * ($header_px - $footer_px))) if($site > 2);
|
||||
$footer_top = $footer_px * $site + ($site * (0.70 * ($header_px - $footer_px))) if($site > 2);
|
||||
|
||||
print PMA "2.$site) text_footer footer_top: $footer_top | $site/$site_all\n";
|
||||
&text_footer(\%varenv,$ctf,$ctt,$footer_top,$site,$site_all);
|
||||
|
@ -265,20 +280,13 @@ td {
|
|||
$header_top +=60;
|
||||
#operator invoices int02=2 Operator-Faktura else position accounting
|
||||
if($ctt->{int10} && $ctt->{int10} == 2){
|
||||
my $ctf_operator = { c_id => 0 };
|
||||
my $pref_cuop = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => 2,
|
||||
};
|
||||
$ctf_operator = $dbt->fetch_tablerecord($dbh,$pref_cuop);
|
||||
|
||||
($exit_table_wc,$nullcount) = &accounting_data_table(\%varenv,$ctf_operator,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
|
||||
($exit_table_wc,$nullcount) = &accounting_data_table(\%varenv,$ctf,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
|
||||
}else{
|
||||
(my $sum_paidxxx,$exit_table_wc,$nullcount) = &data_table(\%varenv,$ctf,$ctt,$cttpos,$sum_paid,$break_table_wc,$max_table_wc,$header_top);
|
||||
($exit_table_wc,$nullcount) = &data_table(\%varenv,$ctf,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
|
||||
}
|
||||
}#end > 2.site
|
||||
}
|
||||
&text_description(\%varenv,$ctf,$ctt,$nullcount,$footer_top);
|
||||
}
|
||||
|
||||
close PMA;
|
||||
|
@ -378,7 +386,7 @@ td {
|
|||
my $line = "";
|
||||
$line = $header_top if($debug);
|
||||
|
||||
my $kd_nr = " Kunden Nr. $ctt->{int10}" if($ctt->{txt00} ne "Abrechnung");
|
||||
my $kd_nr = " Kunden Nr. $ctt->{int10}" if($ctt->{int10} != 2);
|
||||
my $mandat_nr = "";
|
||||
$mandat_nr = " Mandatsreferenz: $ctt->{txt26}" if($ctt->{txt26} =~ /\w{2}-/);
|
||||
|
||||
|
@ -387,7 +395,8 @@ td {
|
|||
table => "contenttrans",
|
||||
pay_time => "$invoice_time",
|
||||
};
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
#necersarry for non payone capture
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt) if(!$ctt->{pay_time});
|
||||
my $mtime = $lb->time4de("$invoice_time","");
|
||||
|
||||
my $position = "";
|
||||
|
@ -454,10 +463,18 @@ td {
|
|||
print $q->th({-class=>'tdint'},"$val");
|
||||
}
|
||||
|
||||
my $ctf_operator = { c_id => 0 };
|
||||
my $pref_cuop = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => 2,
|
||||
};
|
||||
$ctf_operator = $dbt->fetch_tablerecord($dbh,$pref_cuop);
|
||||
|
||||
foreach my $id (sort { $cttpos->{$b}->{c_id} <=> $cttpos->{$a}->{c_id} } keys(%$cttpos)){
|
||||
#print Dumper($cttpos->{$id}); exit;
|
||||
my $oac = { c_id => 0 };
|
||||
$oac = $pri->operator_accounting2calc($varenv,$cttpos->{$id},$ctf);
|
||||
$oac = $pri->operator_accounting2calc($varenv,$cttpos->{$id},$ctf_operator);
|
||||
$oac->{int01} = sprintf('%.2f', $oac->{int01});
|
||||
|
||||
$j++;
|
||||
|
@ -611,19 +628,26 @@ td {
|
|||
my $ctf = shift;
|
||||
my $ctt = shift;
|
||||
my $cttpos = shift;
|
||||
my $sum_break = shift || 0;
|
||||
my $break_table_wc = shift || 0;
|
||||
my $max_table_wc = shift || 0;
|
||||
my $header_top = shift || 0;
|
||||
|
||||
#again to keep time format#TODO
|
||||
#($cttpos,my $rows) = $dbt->collect_contentpos($dbh,"contenttrans",$ctt->{c_id});
|
||||
|
||||
my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int03=Menge (Std:Min)","int02=Preis","int07=Rabatt","int04=Gesamt");
|
||||
#my ($cttpos,$rows) = $dbt->collect_contentpos("contenttrans",$ctt->{c_id});
|
||||
foreach my $id (keys(%$cttpos)){
|
||||
if($cttpos->{$id}->{int26}){
|
||||
@tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int26=Einsparung","int03=Menge (Std:Min)","int02=Preis","int07=Rabatt","int04=Gesamt");
|
||||
}
|
||||
}
|
||||
|
||||
my $sum_parts19=0;
|
||||
my $diff19 = 100 + 19;
|
||||
my $sum_umst19=0;
|
||||
my $j=0;
|
||||
my $nullcount=0;
|
||||
|
||||
my $header_toppx = "$header_top" . "px";
|
||||
my $position;
|
||||
$position = "position:absolute; top: $header_toppx;" if($header_top);
|
||||
|
@ -634,24 +658,15 @@ td {
|
|||
print $q->start_table({ -border=>'0', -width=>"$width",-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
|
||||
|
||||
#Tableheader
|
||||
my $h=0;
|
||||
my $tc=0;
|
||||
print $q->Tr(),"\n";
|
||||
foreach (@tpl_order){
|
||||
my ($key,$val) = split /=/,$_;
|
||||
$h++ if($val && $key !~ /int07/);
|
||||
$tc++ if($val && $key !~ /int07/);
|
||||
print $q->th({-class=>'tdint'},"$line $val"),"\n" if("$key" eq "ct_name");
|
||||
print $q->th({-class=>'tdtxt2'},"$val"),"\n" if($key =~ /txt01/);
|
||||
print $q->th({-class=>'tdint'},"$val"),"\n" if($key =~ /int02|int03|int04|int26/);
|
||||
}
|
||||
$h--;
|
||||
|
||||
#Tablecontent (ct_name(primary key))
|
||||
my $sum_parts19=0;
|
||||
my $diff19 = 100 + 19;
|
||||
my $sum_umst19=0;
|
||||
my $j=0;
|
||||
my $k=0;
|
||||
my $nullcount=0;
|
||||
|
||||
foreach my $id (sort { $cttpos->{$b}->{c_id} <=> $cttpos->{$a}->{c_id} } keys(%$cttpos)){
|
||||
|
||||
|
@ -682,20 +697,10 @@ td {
|
|||
if($gesamt != 0){
|
||||
|
||||
$j++;
|
||||
if($j<=$max_table_wc || $break_table_wc){
|
||||
if($j<=$max_table_wc){
|
||||
|
||||
#2. empty loop for sum
|
||||
if($break_table_wc){
|
||||
#print "$j|";
|
||||
next if($j<=$max_table_wc);
|
||||
}
|
||||
|
||||
|
||||
#Tablecontent (parameter)
|
||||
print $q->Tr(),"\n";
|
||||
my $k=0;
|
||||
foreach (@tpl_order){
|
||||
#$k++;
|
||||
my ($key,$val) = split /=/,$_;
|
||||
$cttpos->{$id}->{$key} = $q->unescapeHTML("$cttpos->{$id}->{$key}");
|
||||
$cttpos->{$id}->{$key} = $lb->newline($cttpos->{$id}->{$key},"");
|
||||
|
@ -773,28 +778,15 @@ td {
|
|||
}
|
||||
}
|
||||
}
|
||||
delete $cttpos->{$id};
|
||||
}
|
||||
}
|
||||
}#end foreach
|
||||
|
||||
#Zahlungstext Text & Vorbelegungen
|
||||
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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#Sum Endrechnung
|
||||
if($break_table_wc > 0 && $break_table_wc <= $max_table_wc){
|
||||
|
||||
my $sum_parts19 = $ctt->{int01} || 0;
|
||||
if($sum_parts19 && $sum_parts19 != 0){
|
||||
$sum_umst19 = $sum_parts19 / $diff19 * 19;
|
||||
$sum_umst19 = $pri->round($sum_umst19);
|
||||
|
@ -813,40 +805,58 @@ td {
|
|||
$sum_umst19 = sprintf('%.2f', $sum_umst19);
|
||||
$sum_umst19 =~ s/\./,/;
|
||||
|
||||
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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print $q->Tr(),"\n";
|
||||
print $q->td({-class=>'Oline',-colspan=>6}," "),"\n";
|
||||
|
||||
print "<tr>\n";
|
||||
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";
|
||||
|
||||
###print sum
|
||||
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";
|
||||
|
||||
#Summe Endrechnung
|
||||
if($j <= $max_table_wc || $break_table_wc){
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdint',-colspan=>2},"Nettobetrag");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_netto19 €");
|
||||
|
||||
print $q->Tr(),"\n";
|
||||
print $q->td({-class=>'tdint'},"<b>Summe:</b>"),"\n";
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_paid €<b/>"),"\n";
|
||||
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 €");
|
||||
}
|
||||
|
||||
|
||||
print $q->Tr(),"\n";
|
||||
print $q->td({-class=>'tdint'},"Betrag Netto:"),"\n";
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_netto19 €"),"\n";
|
||||
if($sum_parts19 != "0"){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"19% UmSt auf $sum_netto19 €:"),"\n";
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_umst19 €"),"\n";
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
print $q->end_table,"\n";
|
||||
print "</td>\n";
|
||||
###print sum end
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
print $q->end_table,"\n";
|
||||
print "</div>\n";
|
||||
return ("$sum_paid","$j","$nullcount");
|
||||
return ($j,$nullcount);
|
||||
}#end sub data_table
|
||||
|
||||
#Beschreibungs-Text
|
||||
|
@ -855,13 +865,14 @@ td {
|
|||
my $ctf = shift;
|
||||
my $ctt = shift;
|
||||
my $nullcount = shift || 0;
|
||||
my $header_top = shift || 0;
|
||||
my $footer_top = shift || 0;
|
||||
|
||||
my $position = "";
|
||||
my $header_toppx = "$header_top" . "px";
|
||||
$position = "position:absolute; top: $header_toppx;" if($header_top);
|
||||
$footer_top -= 170;
|
||||
my $footer_toppx = "$footer_top" . "px";
|
||||
$position = "position:absolute; top: $footer_toppx;" if($footer_top);
|
||||
my $line = "";
|
||||
$line = $header_top if($debug);
|
||||
$line = $footer_top if($debug);
|
||||
|
||||
print "\n<div style='width:$width;$position border:0px solid black;'>$line\n";
|
||||
print $q->start_table({-style=>"margin-top:0.5em;", -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'0', -cellspacing=>'0'});
|
||||
|
@ -870,14 +881,14 @@ td {
|
|||
my $style = "padding:0.4em;text-align:left;font-size:0.91em;";
|
||||
if($nullcount > 0){
|
||||
print $q->Tr();
|
||||
print $q->td({-style=>"$style",-colspan=>3},"In diesem Zeitraum gab es $nullcount kostenfreie Buchungsvorgänge.");
|
||||
print $q->td({-style=>"$style"},"In diesem Zeitraum gab es $nullcount kostenfreie Buchungsvorgänge.");
|
||||
}
|
||||
|
||||
if($ctt->{txt12}){
|
||||
$ctt->{txt12} = $q->unescapeHTML("$ctt->{txt12}");
|
||||
$ctt->{txt12} = $lb->newline($ctt->{txt12},"","");
|
||||
print $q->Tr();
|
||||
print $q->td({-style=>"$style",-colspan=>3},"$ctt->{txt12}");
|
||||
print $q->td({-style=>"$style"},"$ctt->{txt12}");
|
||||
}
|
||||
#Text & Vorbelegungen
|
||||
print $q->Tr();
|
||||
|
@ -890,9 +901,8 @@ td {
|
|||
my @rechnungstext = split(/\<br \/\>/,$ctf->{$key});
|
||||
if($ctt->{txt21} =~ /$key/){
|
||||
foreach(@rechnungstext){
|
||||
$style = "padding:0.4em;text-align:left;font-size:1em;";
|
||||
print $q->Tr();
|
||||
print $q->td({-style=>"$style",-colspan=>3},"$_");
|
||||
print $q->td({-style=>"$style"},"$_");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -923,10 +933,6 @@ td {
|
|||
my $line = "";
|
||||
$line = $footer_top if($debug);
|
||||
|
||||
#if($ctf->{img01} =~ /empty/){
|
||||
# print $q->div({-style=>"min-width:1799px;position:absolute;top:$footer_top;"},"");
|
||||
#}else{
|
||||
|
||||
print "<div style='border:0px solid black;background-color:white;height:150px;width:$width;position:absolute;top:$footer_top;'>$line\n";
|
||||
if($ctt->{txt00} eq "Abrechnung"){
|
||||
my $tplop = $dbt->get_tpl($dbh,"196");#Operator-Faktura
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue