coupon select and feedback

This commit is contained in:
Rainer Gümpelein 2022-02-16 15:56:45 +01:00
parent d2ef211f68
commit 7656e9d291
7 changed files with 67 additions and 58 deletions

View file

@ -656,7 +656,7 @@ sub payone_capture(){
#send_invoice infomail
if(-f "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf"){
system(`$varenv->{basedir}/src/scripts/mailTransport.pl "$varenv->{syshost}" "send_invoice" "$ctt->{c_id}" "$praefix-$ctt->{ct_name}.pdf"`);
print EMA "---> Sent Invoice Info e-mail\n";
print EMA "---> Sent Invoice e-mail command: $varenv->{basedir}/src/scripts/mailTransport.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'\n";
}
close EMA;
}

View file

@ -317,22 +317,24 @@ sub set_usertarif {
print FILE "-1-> txt15: $adr_bonus->{txt15}\n" if($debug);
$i++;
foreach my $sourcetarif (@{$adr_bonus->{txt30_array}}){
print FILE "-1.2-> activeTarif-source:$sourcetarif | Bonus-source:$bonus_collect->{$id}->{int21} | Bonus-target:$bonus_collect->{$id}->{int22}\n" if($debug);
print FILE "-1.2-> activeTarif:$sourcetarif | Bonus-source:$bonus_collect->{$id}->{int21} | Bonus-target:$bonus_collect->{$id}->{int22}\n" if($debug);
if($sourcetarif eq $bonus_collect->{$id}->{int22}){
print FILE "-2.1-> still activ Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug);
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
$ret = "success::txt15";
push(@new_txt30,$bonus_collect->{$id}->{int22});
#push(@new_txt30,$sourcetarif);
}elsif($bonus_collect->{$id}->{int21} eq $sourcetarif && $bonus_collect->{$id}->{int22}){
}elsif($sourcetarif eq $bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int22}){
print FILE "-2.2-> match-update Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug);
if($id > 3){#means if not file greped with static c_id <= 3
$dbt->update_content4comp($dbh_operator,$bonus_collect->{$id}->{c_id},"-","1");
}
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
print FILE "-2.2-> match-update Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug);
$ret = "success::txt15";
push(@new_txt30,$bonus_collect->{$id}->{int22});
}else{
print FILE "-2.3-> No matching Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}, keeping sourcetarif\n" if($debug);
push(@new_txt30,$sourcetarif);
print FILE "-2.3-> No matching Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}, doing nothing\n" if($debug);
#push(@new_txt30,$sourcetarif);
#$ret = "failure::txt15#top1";
}
}
@ -340,7 +342,6 @@ sub set_usertarif {
if(@new_txt30){
print FILE "-3-> txt30: @new_txt30\n" if($debug);
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@new_txt30'");
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
}
$ret = "failure::txt30#top2" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/);
}

View file

@ -917,17 +917,13 @@ sub preinit(){
if(1==1){#debugging
my $filesize = -s "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf";
open(EMA, ">> $varenv{logdir}/copri-print.log");
print EMA "$today4db\n$topdf --page-size $psize $varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&mandant_main_id=$mandant_main_id\&main_id=$node->{main_id}\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$c_id4print\&u_id=$users_dms->{u_id}\&wc=$wc_line $varenv{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n";
print EMA "$today4db\n$topdf --page-size $psize $varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&mandant_main_id=$mandant_main_id\&main_id=$node->{main_id}\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$c_id4print\&u_id=$users_dms->{u_id}\&wc=$wc_line $varenv{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\nset_state: $R::set_state\n";
close EMA;
#exit 0;
}
if($R::set_state ne "buchen"){#no redirect if buchen incl. print_pdf
if( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf" && $varenv{metahost}){
#print redirect("$varenv{metahost}$script/pdf/$praefix-$ctt->{ct_name}.pdf");
#exit 0;
print "<script type=\"text/javascript\">window.open('$varenv{metahost}$script/pdf/$praefix-$ctt->{ct_name}.pdf');</script>";
}elsif( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf"){
if( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf"){
#print redirect("$varenv{wwwhost}/pdf/$praefix-$ctt->{ct_name}.pdf");
#exit 0;
print "<script type=\"text/javascript\">window.open('$varenv{wwwhost}$script/pdf/$praefix-$ctt->{ct_name}.pdf');</script>";

View file

@ -343,17 +343,7 @@ td {
$ctf = $db->get_content1("contentuser","$mandant_main_id");
#my $umst1619 = $lb->umst_breaking($ctt,"");
my $txt20 = $ctt->{txt20};
my $max_timestamp = "210001012359";
if($node->{node_name} !~ /journal/){
if($txt20 =~ /(\d{2})\.(\d{2})\.(\d{4})$/){
$max_timestamp = $3 . $2 . $1 . "2359";
}elsif($ctf->{txt80} =~ /(\d{2})\.(\d{2})\.(\d{4})$/){
$max_timestamp = $3 . $2 . $1 . "2359";
}
}
my $max_sum = $ctf->{int03} || "10000";
my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int03=Menge","int02=Preis","int07=Rabatt","int04=Gesamt");
my ($cttpos,$rows) = $db->collect_contentpos("contenttrans",$c_id);
foreach my $id (keys(%$cttpos)){
@ -406,21 +396,21 @@ td {
foreach my $id (sort { $cttpos->{$b}->{$scol} cmp $cttpos->{$a}->{$scol} } keys(%$cttpos)){
my $cttpos_timestamp = $1 . $2 . $3 . "0000" if($cttpos->{$id}->{itime} =~ /(\d+)\-(\d+)\-(\d+)/);
my $gesamt = 0;
my $rabatt = "";
my $einzel = $cttpos->{$id}->{int02};
my $menge = $cttpos->{$id}->{int03} || 0;
my $unit = $cttpos->{$id}->{txt03};
my $gesamt = 0;
my $rabatt = "";
my $einzel = $cttpos->{$id}->{int02};
my $menge = $cttpos->{$id}->{int03} || 0;
my $unit = $cttpos->{$id}->{txt03};
($gesamt,$rabatt) = $pri->price2calc($cttpos->{$id});
$gesamt = $lb->round($gesamt);
$gesamt = $lb->cashme($gesamt,",");
($gesamt,$rabatt) = $pri->price2calc($cttpos->{$id});
#max. Rechnungspositionen
if(($gesamt == 0) && ($cttpos_timestamp <= $max_timestamp || $ctt->{int05} == 1) && ($sum_parts19 <= $max_sum)){
if($gesamt == 0){
$nullcount++;
}
if(($gesamt != 0) && ($cttpos_timestamp <= $max_timestamp || $ctt->{int05} == 1) && ($sum_parts19 <= $max_sum)){
if($gesamt != 0){
$gesamt = $lb->round($gesamt);
$gesamt = $lb->cashme($gesamt,",");
$j++;
if($j<=$max_table_wc || $break_table_wc){
@ -453,10 +443,10 @@ td {
}else{
$ct_pos = "$cttpos->{$id}->{ct_name}";
}
print $q->td({-class=>'tdint'},"$ct_pos&nbsp;"),"\n";
print $q->td({-class=>'tdint',-nowrap=>'1'},"$ct_pos&nbsp;"),"\n";
}
if($key =~ /txt01/){
print "<td class='tdtxt'>\n";
print "<td class='tdtxt' nowrap=1>\n";
if($cttpos->{$id}->{$key}){
$cttpos->{$id}->{$key} =~ s/\<br \/\>/; &nbsp; /g;
print "$cttpos->{$id}->{$key}<br />\n";
@ -481,7 +471,7 @@ td {
$cttpos->{$id}->{int26} =~ s/\./,/;
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
}
print $q->td({-class=>'tdint'},"$co2saving");
print $q->td({-class=>'tdint',-nowrap=>'1'},"$co2saving");
}
if($key =~ /int03/){
$cttpos->{$id}->{$key} =~ s/\./,/;
@ -498,16 +488,9 @@ td {
}
if($key =~ /int04/){
if($gesamt == "0"){
$gesamt="";
}else{
$gesamt .= " €";
$gesamt =~ s/\./,/;
}
$gesamt .= " €";
if($rabatt != 0){
my $proz="%";
$proz = "€" if($cttpos->{$id}->{int08} == 1);
print $q->td({-nowrap=>'1',-class=>'tdint'},"(Rabatt $rabatt $proz) $gesamt"),"\n";
print $q->td({-nowrap=>'1',-class=>'tdint'},"(Rabatt $rabatt) $gesamt"),"\n";
}else{
print $q->td({-nowrap=>'1',-class=>'tdint'},"$gesamt"),"\n";
}

View file

@ -358,6 +358,8 @@ sub save_account(){
};
print FILE "operator adr update preview with bonusnr:\n" . Dumper($adr_bonus) . "\n";
$ret = $pl->set_usertarif($dbh,$operator_conf->{database}->{dbname},$adr_bonus,$bonus_collect);
}else{
$ret = "failure::txt15#top7";
}
}else{
$ret = "failure::txt15#top5";