accounting and statistik adjustments

This commit is contained in:
ragu 2022-11-28 18:28:06 +01:00
parent e6c7010f28
commit 4435999ac2
10 changed files with 122 additions and 87 deletions

View file

@ -37,8 +37,7 @@ sub log {
$now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
my $logfile = "/var/log/copri4/$varenv{syshost}-process.log";
#if($varenv{debug}){
if(1==1){
if($varenv{debug}){
warn "$$ $what" . "\n" . Dumper($message) . "\n";#to apache2/error.log
#2021-07-21 disabled. error.log is enough

View file

@ -157,6 +157,7 @@ sub update_operatorsloop {
#delete $record_primary->{int12};#Vde (remove delete for global setting)
delete $record_primary->{int23};#mini_answer count will be saved on operator
delete $record_primary->{txt29};#Sonstiges
delete $record_primary->{txt35};#Umfragelink
#}
my $update = {

View file

@ -119,6 +119,7 @@ sub counting_rental {
#init with some defaults
my $total_price = 0;
my $ctpos_freed = { c_id => 0 };
$ctpos->{int35} = 0 if(!$ctpos->{int35});
#convert tariff unit by minute time
my $tariff_unitbyminute = 60;#defaults to Stundentarif
@ -252,7 +253,7 @@ sub counting_rental {
$return->{end_time} = "$computed_end_time";
$return->{freed_time} = "$freed_time";
$return->{computed_hours} = "$computed_hours";
$return->{unit_price} = "$ctpos->{int35}";
$return->{unit_price} = "$ctpos->{int35}" || "";
$return->{real_clock} = "$real_clock";
$return->{total_price} = "$total_price";
$return->{discount} = "$discount";
@ -536,7 +537,8 @@ sub operator_accounting2calc {
$oac->{int02} = $oac->{int01} + $oac->{int94} + $oac->{int95} + $oac->{int96} + $oac->{int97};
$oac->{int02} = sprintf('%.3f', $oac->{int02});
#operator invoice
$oac->{int100} = $oac->{int93} + $oac->{int98};
#$oac->{int100} = $oac->{int93} + $oac->{int98};#brutto
$oac->{int100} = $oac->{int93};#netto
$oac->{int100} = sprintf('%.3f', $oac->{int100});
}
}

View file

@ -171,7 +171,7 @@ td {
my $site_all=1;
my $header_top = 0;
my $footer_px = 1790;
my $footer_px = 1780;
my $footer_top = $footer_px;#end 1.site
my $sum_paid = 0;
@ -447,9 +447,9 @@ td {
#operator accounting
else{
if($varenv->{dbname} eq "sharee_sx"){
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int94=payone Disagio","int02=Summe Gutschrift");
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int94=Disagio","int02=Summe Gutschrift");
}else{
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int94=payone Disagio","int95=payone Transaktion","int96=payone Zahlungsmeldung","int97=payone Kreditkarte Zuordnung","int02=Summe Gutschrift");
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int94=Disagio","int95=Transaktion","int96=Zahlungsmeldung","int97=Kreditkarte Zuordnung","int02=Summe Gutschrift");
}
}
@ -545,36 +545,32 @@ td {
}
}
#Sum Endrechnung
#Sum Operator invoice
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;
my $sum_brutto = $ctt->{int01} || 0;
my $sum_operatorcredit = $ctt->{int02} || 0;
my $total_operatorcredit = $sum_operatorcredit - $sum_brutto;
if($sum_brutto && $sum_brutto != 0){
$sum_umst19 = $sum_brutto / $diff19 * 19;
$sum_umst19 = $pri->round($sum_umst19);
}
my $sum_netto19 = $sum_parts19 - $sum_umst19;
my $sum_netto19 = $sum_brutto - $sum_umst19;
$sum_netto19 = sprintf('%.2f', $sum_netto19);
$sum_netto19 =~ s/\./,/;
$sum_brutto =~ s/\./,/;
my $sum_paid = $sum_parts19;
$sum_paid = $pri->round($sum_paid);
$sum_paid = sprintf('%.2f', $sum_paid);
$sum_paid =~ s/\./,/;
$sum_parts19 = sprintf('%.2f', $sum_parts19);
$sum_umst19 = sprintf('%.2f', $sum_umst19);
$sum_umst19 =~ s/\./,/;
my $sum_operatorcredit = $ctt->{int02} || 0;
$sum_operatorcredit = $pri->round($sum_operatorcredit);
$sum_operatorcredit = sprintf('%.2f', $sum_operatorcredit);
$sum_operatorcredit =~ s/\./,/;
print $q->Tr(),"\n";
print $q->td({-class=>'Oline',-colspan=>$tc},"&nbsp;"),"\n";
my $cs = $tc - 2;
my $payment_text = "";
foreach(@tplf_order){
my ($key,$des,$size) = split /=/,$_;
@ -583,7 +579,7 @@ td {
$ctf->{$key} = $lb->newline($ctf->{$key},"","");
$ctt->{state} =~ s/\(payone.*//;
if($des =~ /$ctt->{state}/){
if($sum_parts19 < 0){
if($sum_brutto < 0){
$payment_text = "$ctf->{txt58}";
}else{
$payment_text = "$ctf->{$key}";
@ -591,14 +587,18 @@ td {
}
}
}
my $sc = 2;
$sc = 1 if($ctt->{template_id} != 208);
my $pt = $tc - $sc;
print "<tr>\n";
print "<td colspan='$cs' style='border:0px solid silver;vertical-align:top;padding:0.2em 0.5em;font-size:0.91em;'>$payment_text</td>\n";
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";
###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";
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";
#Summe Betreiber Rechnung
#Sum operator invoive
if($ctt->{template_id} != 208){#not equal Abrechnung
print $q->Tr("\n");
print $q->td({-class=>'tdint',-colspan=>1},"Nettobetrag");
@ -612,13 +612,21 @@ td {
print $q->Tr("\n");
print $q->td({-class=>'tdsum',-colspan=>1},"Entgeld TeilRad GmbH");
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_paid €");
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_brutto €");
}
#Summe Betreiber Abrechnung (Gutschrift)
else{
print $q->Tr("\n");
print $q->td({-class=>'tdsum',-colspan=>1},"Summe");
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_operatorcredit €");
print $q->Tr("\n");
print $q->td({-class=>'tdsum',-colspan=>1},"Entgeld TeilRad GmbH");
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 €");
}
print $q->end_table,"\n";
@ -946,18 +954,26 @@ td {
print "<div style='border:0px solid black;background-color:white;height:150px;width:$width;position:absolute;top:$footer_top;'>$line\n";
if($ctt->{int10} == 2){
print $q->span({-style=>'padding:0.2em;text-align:center;font-size:0.81em;'},"Gebühren der Zahlungsdienstleistung:"),"\n" if($ctt->{template_id} == 208);
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 /=/,$_;
if($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";
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";
}
}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";
}
}
}
}
print "<br />\n";

View file

@ -188,14 +188,20 @@ sub save_account(){
my $fkeys = "";
my $pw_dummy = "";
@keywords = grep {!/txt31/} @keywords;
print FILE Dumper($q) if($debug);
#print FILE Dumper($q) if($debug);
foreach(@keywords){
$fkeys .= "$_,";
my $val = $q->param("$_");
my $valxx = $q->escapeHTML("$val");
$valxx =~ s/^\s+//;
$valxx =~ s/\s+$//;
print FILE "$_:$valxx \n" if($debug);
if($debug){
if($_ !~ /txt04/){
print FILE "$_:$valxx \n";
}else{
print FILE "$_:is not logged\n";
}
}
if($_ =~ /^int|barcode/){
$valxx =~ s/,/./g;
if(looks_like_number($valxx)){