adding sum_total and owner into invoive mailing. calc freed_time fix

This commit is contained in:
ragu 2023-09-07 19:04:02 +02:00
parent 76fe0eb26a
commit 8cc46ff9e0
4 changed files with 24 additions and 13 deletions

View file

@ -178,6 +178,18 @@ sub send_invoice {
};
my $ctt = { c_id => 0 };
$ctt = $dbt->fetch_tablerecord($dbh,$fetchctt);
$ctt->{fibu_user} = "";
if($ctt->{owner} > 1000){
my $adref = {
table => "contentadr",
fetch => "one",
template_id => "202",
c_id => $ctt->{owner},
};
my $fibu_owner = $dbt->fetch_record($dbh,$adref);
$ctt->{fibu_user} = "$fibu_owner->{txt01}" if($fibu_owner->{txt01});
}
$sendref = prepare_content($sendref,$ctadr,$uadr,$ctt,$varenv{cms}->{$cms_message_key}->{txt},$with_pdf);
@ -472,12 +484,17 @@ sub prepare_content {
$app_name = $dbt->{operator}->{$varenv{dbname}}->{app_name};
my $invoice_name = "";
my $invoice_nr = "";
my $sum_total = "";
my $sharee_ticket = "";
my $fibu_user = "";
if(ref($ctt) eq "HASH" && $ctt->{ct_name}){
$invoice_name = "$ctt->{txt00}-$varenv{dbname}-$ctt->{ct_name}.pdf";
$sendref->{attachment} = "$invoice_name" if($with_pdf);
$invoice_nr = "$varenv{dbname}-$ctt->{ct_name}";
$sum_total = "$ctt->{int01}";
$sum_total =~ s/\./,/;
$sharee_ticket = "[$invoice_nr]";
$fibu_user = "\n$ctt->{fibu_user}\n" if($ctt->{fibu_user});
}
my $subject = "TeilRad Mietradsystem";#default
@ -487,7 +504,7 @@ sub prepare_content {
$cms_prim =~ s/\n//;
my $signature = <<EOF
--
--$fibu_user
$uadr->{txt01}
$uadr->{txt03}
$uadr->{txt06}
@ -511,6 +528,7 @@ EOF
$sendref->{message} =~ s/::user_name::/$ctadr->{txt01}/g;
$sendref->{message} =~ s/::app_name::/$app_name/g;
$sendref->{message} =~ s/::invoice_nr::/\<b\>$invoice_nr\<\/b\>/g if($invoice_nr);
$sendref->{message} =~ s/::sum_total::/\<b\>$sum_total €\<\/b\>/g if($sum_total);
$sendref->{message} =~ s/::invoice_name::/$invoice_name/g if($invoice_name);
$sendref->{message} =~ s/::txid::/$ctt->{txt16}/;
$sendref->{message} =~ s/::email_temppassword::/\<b\>$ctadr->{txt04}\<\/b\>/g;