Differentiate Fibu fees on accounting

This commit is contained in:
ragu 2023-07-07 08:50:13 +02:00
parent b32214c15d
commit a3d251e643
7 changed files with 74 additions and 22 deletions

View file

@ -137,7 +137,7 @@ sub handler {
c_id => $ctadr->{c_id},
};
$ctadr = $dbt->fetch_tablerecord($dbh,$fetch_ctadr) if($ctadr->{c_id});
my $vde_on_fail = $ctadr->{int12} || 1;#keep last or set 1
my $vde_on_fail = $ctadr->{int12} || 2;#keep last or set 1 #2023-07-05 changed to set 2
if($ctt->{c_id} > 0){

View file

@ -565,7 +565,8 @@ sub preinit(){
my $sum_paid = "null";
my $sum_operatorcredit = "null";
my $sum_fibugeb = "null";
my $sumgeb_teil = "null";
my $sumgeb_bank = "null";
my $state = $R::state || "";
$update_ctt->{state} = "$state";
$update_ctt->{int14} = 2;#set OPOS
@ -583,10 +584,16 @@ sub preinit(){
$update_ctt->{int14} = "null";
}
if($R::set_state eq "buchen" && $R::sum_fibugeb){
$sum_fibugeb = $R::sum_fibugeb;
$sum_fibugeb =~ s/,/\./;
$update_ctt->{int08} = $sum_fibugeb;
if($R::set_state eq "buchen" && $R::sumgeb_teil){
$sumgeb_teil = $R::sumgeb_teil;
$sumgeb_teil =~ s/,/\./;
$update_ctt->{int08} = $sumgeb_teil;
}
if($R::set_state eq "buchen" && $R::sumgeb_bank){
$sumgeb_bank = $R::sumgeb_bank;
$sumgeb_bank =~ s/,/\./;
$update_ctt->{int07} = $sumgeb_bank;
}
$u_rows += $dbt->update_record($dbh,$update_ctt,$ctt);

View file

@ -526,15 +526,17 @@ sub operator_accounting2calc {
int100 => 0,
};
#TODO #accounting Bank Gebühren
foreach(@tplf_order){
my ($key,$val,$size) = split /=/,$_;
if($key =~ /int/){
my $invoice_brutto = 0;
if($key eq "int01" && $ctpos->{int01}){
$invoice_brutto = $ctpos->{int01};
#substract Fibu Gebühren like Rücklastschrift or Mahnung
#substract TeilRad Gebühren
$invoice_brutto = $ctpos->{int01} - $ctpos->{int08} if($ctpos->{int08} && $ctpos->{int08} > 0);
#substract Bank Gebühren
$invoice_brutto = $ctpos->{int01} - $ctpos->{int07} if($ctpos->{int07} && $ctpos->{int07} > 0);
$oac->{int99} = $invoice_brutto;
#invoice capture netto
$oac->{int01} = $invoice_brutto / 119 * 100;

View file

@ -88,7 +88,14 @@ sub sms_ack_digest {
my $ret_json = "";
if($sms_to =~ /^\+1/){
#no routing fix
$dbt->update_one($dbh,$ctadr,"int13=1");
my $upsms_ack = {
table => "contentadr",
mtime => "now()",
owner => "$owner",
c_id => "$ctadr->{c_id}",
};
$dbt->update_one($dbh,$upsms_ack,"int13=1");
print FILE "no routing fix for $sms_to\n";
}else{
$ret_json = $self->get_sms_gtx($request);

View file

@ -215,7 +215,9 @@ EOF
$rel_color = "silver" if($ctt->{c_id} == $ctt_rel->{$id}->{c_id});
my $journal = "";
$journal = "<span style='color:silver;background-color:white;'>Journal </span>" if($ctt_rel->{$id}->{template_id} == 209);
print $q->div({-style=>"position:absolute;top:$toppx;right:10px;font-size:0.91em;background-color:$rel_color"}, "$journal ", $q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Faktura/$ctt_rel->{$id}->{node_name}?ct_trans=open\&c_id4trans=$ctt_rel->{$id}->{c_id}\&tpl_id4trans=$ctt_rel->{$id}->{template_id}\&owner=$users_dms->{u_id}",-title=>"Faktura Terminal öffnen"},"[ $ctt_rel->{$id}->{txt00} #$ctt_rel->{$id}->{ct_name} ]")),"\n";
my $rel_opos = "";
$rel_opos = "<span style='color:red'>&bull;</span>" if($ctt_rel->{$id}->{int14});
print $q->div({-style=>"position:absolute;top:$toppx;right:10px;font-size:0.91em;background-color:$rel_color"}, "$journal ", $q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Faktura/$ctt_rel->{$id}->{node_name}?ct_trans=open\&c_id4trans=$ctt_rel->{$id}->{c_id}\&tpl_id4trans=$ctt_rel->{$id}->{template_id}\&owner=$users_dms->{u_id}",-title=>"Faktura Terminal öffnen"},"[ $rel_opos $ctt_rel->{$id}->{txt00} #$ctt_rel->{$id}->{ct_name} ]")),"\n";
$top += 22;
}
}

View file

@ -347,9 +347,9 @@ print<<EOF
</script>
EOF
;
my $checked = 0;
$checked = 1 if($users_dms->{faksum});
print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect | ",$q->checkbox(-name=>" ∑ sum ", -title=>'Faktura Positionen summieren ∑ — kostet Zeit', -onclick=>"postave(1)", -checked=>"$checked"),$q->span({-style=>"$header_style"},"$message")),"\n";
my $checked_sum = 0;
$checked_sum = 1 if($users_dms->{faksum});
print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect | ",$q->checkbox(-name=>" ∑ sum ", -title=>'Faktura Positionen summieren ∑ — kostet Zeit', -onclick=>"postave(1)", -checked=>"$checked_sum"),$q->span({-style=>"$header_style"},"$message")),"\n";
}else{
print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect",$q->span({-style=>"$header_style"},"$message")),"\n";
}
@ -634,7 +634,11 @@ EOF
foreach my $s_key (sort keys (%{ $s_hash })) {
push @s_valxx, "$s_key:$s_hash->{$s_key}";#[2:unlocked]
}
print $q->td({-class=>'search_line'},$but->selector_class("s_$key","","",$s_val,@s_valxx)),"\n";
if(scalar @s_valxx < 2){
print $q->td({-class=>'search_line',readonly=>},""),"\n";
}else{
print $q->td({-class=>'search_line'},$but->selector_class("s_$key","","",$s_val,@s_valxx)),"\n";
}
}else{
print $q->td({-class=>"search_line"},$q->textfield(-class=>'stxt',-name=>"s_$key",-default=>"$s_val",-size=>"$size",-maxlength=>40)),"\n";
}
@ -822,7 +826,7 @@ EOF
my $checked = 0;
if($R::accounting_select && $node_meta->{template_id} == 209 && $ct4rel->{$id}->{int01} > 0 && $ct4rel->{$id}->{state} =~ /payone/i && !$ct4rel->{$id}->{int14} && $ct4rel->{$id}->{int16} == 0 && !$ct4rel->{$id}->{txt22} && $ct4rel->{$id}->{int18} eq "1"){
$checked = 1
$checked = 1;
}
print $q->td({-style=>"background-color:silver;"}, $q->checkbox(-name=>"ck4ex", -checked=>"$checked", -value=>"$ct4rel->{$id}->{c_id}", -label=>'')),"\n";
@ -855,9 +859,11 @@ EOF
}
##
print "</td>\n";
}elsif($users_dms->{u_id} > 0 && "$table" =~ /contenttrans|contenttver/){
print "<td class='tb_inst' style='$set_style' nowrap>\n";
print "</td>\n";
}elsif($users_dms->{u_id} > 0 && $table eq "contenttrans"){
my $accounting_id = "";
$accounting_id = "AbrID $ct4rel->{$id}->{int20}" if($ct4rel->{$id}->{int20});
print $q->td({-class=>'tdtxt', -style=>"$set_style; color:grey;", -nowrap=>1}, "$accounting_id"),"\n";
}else{
$ecol++;
print $q->td({-style=>"$set_style"}),"\n";
@ -959,6 +965,27 @@ EOF
}else{
print $q->td({-class=>'tdint',-style=>"font-weight:bold;$set_style4nr"},""),"\n";
}
}elsif($key eq "int13" && $table eq "contenttrans"){
my $pref_rel = {
table => "contenttrans",
fetch => "all",
keyfield => "c_id",
template_id => "IN::(209,218)",
barcode => $ct4rel->{$id}->{barcode},
};
my $ctt_rel = "";
$ctt_rel = $dbt->fetch_record($dbh,$pref_rel) if($ct4rel->{$id}->{barcode});
print "<td class='tdint' style='$set_style4nr' nowrap>\n";
if(ref($ctt_rel) eq "HASH"){
foreach my $irid (sort { $ctt_rel->{$b}->{c_id} <=> $ctt_rel->{$a}->{c_id} } keys (%$ctt_rel)){
if($ct4rel->{$id}->{c_id} != $ctt_rel->{$irid}->{c_id}){
my $rel_opos = "";
$rel_opos = "<span style='color:red'>&bull;</span>" if($ctt_rel->{$irid}->{int14});
print $q->a({-class=>"linknav3",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Faktura/$ctt_rel->{$irid}->{node_name}?ct_trans=open\&c_id4trans=$ctt_rel->{$irid}->{c_id}\&tpl_id4trans=$ctt_rel->{$irid}->{template_id}\&owner=$users_dms->{u_id}\&offset=$searchref->{offset}\&limit=$searchref->{limit}",-title=>"Terminal öffnen"},"$rel_opos $ctt_rel->{$irid}->{ct_name}<br />");
}
}
}
print "</td>\n";
}elsif($key =~ /txt01/ && $table =~ /contenttrans|contenttver/){
print $q->td({-class=>'tdtxt',-style=>"font-weight:normal;$set_style4nr"},$q->a({-class=>"linknav3",-href=>"?ct_trans=open\&mode=manager\&c_id4trans=$ct4rel->{$id}->{c_id}\&tpl_id4trans=$ct4rel->{$id}->{template_id}\&kind_of_trans=$node_meta->{node_name}\&owner=$users_dms->{u_id}\&offset=$searchref->{offset}\&limit=$searchref->{limit}",-title=>"Terminal öffnen"},"$ct4rel->{$id}->{$key}")),"\n";

View file

@ -160,7 +160,8 @@ EOF
#my $scol = "c_id";#changed to itime because of Storno resorts
my $scol = "itime";
my $sum_parts19=0;
my $sum_fibugeb=0;
my $sumgeb_teil=0;
my $sumgeb_bank=0;
my $diff19 = 100 + 19;
my $sum_umst19=0;
my $i=0;
@ -185,7 +186,11 @@ EOF
}else{
($gesamt,my $rabatt) = $pri->price2calc($cttpos->{$id});
$sum_parts19 += $gesamt;
$sum_fibugeb += $gesamt if($cttpos->{$id}->{int16});
if($cttpos->{$id}->{int16} && $cttpos->{$id}->{int16} == 2){
$sumgeb_bank += $gesamt;
}elsif($cttpos->{$id}->{int16}){
$sumgeb_teil += $gesamt;
}
$gesamt = $pri->round($gesamt);
$gesamt = sprintf('%.2f', $gesamt);
}
@ -510,7 +515,8 @@ EOF
print $q->td({-class=>'tdsum'},"<b>$summe:</b>");
print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_paid €<b/>");
print $q->hidden(-name=>'sum_paid', -override=>'1',-value=>"$sum_paid");
print $q->hidden(-name=>'sum_fibugeb', -override=>'1',-value=>"$sum_fibugeb") if($sum_fibugeb);
print $q->hidden(-name=>'sumgeb_teil', -override=>'1',-value=>"$sumgeb_teil") if($sumgeb_teil);
print $q->hidden(-name=>'sumgeb_bank', -override=>'1',-value=>"$sumgeb_bank") if($sumgeb_bank);
print $q->end_table;
print "</td><td>&nbsp;</td>";
@ -567,7 +573,8 @@ EOF
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> Summe $ctt->{int01} € gebucht per \"$ctt->{state}\" | Payone Saldo $ctt->{int16} € | $vibuchen_mtime "),"\n";
}else{
my $fibutext = "";
$fibutext = "<span style='color:silver;'>(Fibu Gebühr $ctt->{int08})</span>" if($ctt->{int08});
$fibutext = "<span style='color:silver;'>(TeilRad Gebühr $ctt->{int08})</span>" if($ctt->{int08});
$fibutext .= "<span style='color:silver;'>(Bank Gebühr $ctt->{int07})</span>" if($ctt->{int07});
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> Summe $ctt->{int01} € $fibutext gebucht per \"$ctt->{state}\" | $vibuchen_mtime "),"\n";
}
}else{