Invoice on work mailing. Check iban if still exist with vde. Station selector on edit

This commit is contained in:
ragu 2023-07-13 12:10:45 +02:00
parent a3d251e643
commit 1744cd35a3
15 changed files with 234 additions and 110 deletions

View file

@ -107,6 +107,27 @@ if($todo eq "send_occupied2hotline"){
$sendmail = send_occupied2hotline($sendref);
}
#send_invoice_onwork once a week as reminder
if($todo eq "send_invoice_onwork"){
#loop operators DB
while (my ($key, $op_name) = each %{ $dbt->{operator} }) {
if($op_name->{database}->{dbname}){
my $rows = 0;
my $sharee_operator = $op_name->{database}->{dbname};
my $dbh = "";
$dbh = $dbt->dbconnect_extern($sharee_operator);
$oprefix = $op_name->{oprefix} || "";
$sendref->{syshost} = "$syshost";
$sendmail = send_invoice_onwork($dbh,$oprefix,$sendref);
if($sendmail->{c_id}){
sendmailjob($sendmail);
}
}
}
}
if($sendmail->{c_id}){
sendmailjob($sendmail);
}else{
@ -341,6 +362,7 @@ $sendref->{message} = <<EOF
Hallo,
folgende konräder sind seit über 3 Tagen gemietet:
$bike
Bitte MieterInnen kontaktieren und den verbleib klären.
@ -355,6 +377,68 @@ EOF
return;
}
#send_invoice_onwork, done by operaor loop
sub send_invoice_onwork {
my $dbh = shift;
my $oprefix = shift || "";
my $sendref = shift;
my $ct_id = shift || "";
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
my $pref_ctu = {
table => "contentuser",
fetch => "one",
c_id => "1",#primary hotline
};
my $uadr = { c_id => 0 };
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
$sendref->{mail_to} = $uadr->{txt08};
my $pref = {
table => "contenttrans",
fetch => "all",
keyfield => "c_id",
txt22 => "in Arbeit",
state => "is::null",
};
my $ctt = $dbt->fetch_tablerecord($dbh,$pref);
my $ct_onwork = "";
foreach my $id (sort { $ctt->{$b}->{c_id} <=> $ctt->{$a}->{c_id} } keys(%$ctt)){
$ct_onwork .= $oprefix . " Faktura ID:$ctt->{$id}->{c_id}, " . " Nummer: " . $ctt->{$id}->{ct_name} . "\n";
$sendref->{c_id} = $ctt->{$id}->{c_id};#just one
print "$ctt->{$id}->{c_id}: $ct_onwork $sendref->{c_id}";
}
if($ct_onwork){
$ct_onwork =~ s/,$//;
$sendref->{subject} = "$oprefix wöchentliche Faktura in Arbeit Übersicht";
$sendref->{message} = <<EOF
Hallo,
folgende ungebuchte Rechnungen sind "in Arbeit":
$ct_onwork
Nicht aus dem Blick verlieren.
Grüße vom cron
EOF
;
$sendref->{message} =~ s/\n/\<br \/\>/g;
return $sendref;
}
return;
}#end send_invoice_onwork
#prepare email by cms markup
sub prepare_content {
my $sendref = shift;

View file

@ -189,7 +189,6 @@ print "Neue NutzerInnen mit Bonus Tarif: $swk_reg\n";
table => "contenttranspos",
fetch => "all",
keyfield => "c_id",
#int04 => "!=::99",#virtual end-station
int05 => "is::null",#not if sub workflow doc
int06 => "!=::99",#virtual start-station
int29 => "$bike_type_id",#nodes.type_id
@ -213,11 +212,7 @@ print "Neue NutzerInnen mit Bonus Tarif: $swk_reg\n";
$swk_i++;
}
if($pos->{$id}->{int06} && exists($start_station->{$pos->{$id}->{int06}})){
$start_station->{$pos->{$id}->{int06}} += 1;
}elsif($pos->{$id}->{int04} && exists($start_station->{$pos->{$id}->{int04}})){
$start_station->{$pos->{$id}->{int04}} += 1;
}
$start_station->{$pos->{$id}->{int06}} += 1 if($pos->{$id}->{int06} && exists($start_station->{$pos->{$id}->{int06}}));
$end_station->{$pos->{$id}->{int04}} += 1 if($pos->{$id}->{int04} && exists($start_station->{$pos->{$id}->{int04}}));
$diff_station += 1 if($pos->{$id}->{int06} && $pos->{$id}->{int04} && $pos->{$id}->{int06} != $pos->{$id}->{int04});