sharee.bike/copri4/main/src/Tpl/Address3.pm

490 lines
20 KiB
Perl
Raw Normal View History

2021-12-30 12:05:56 +01:00
package Address3;
#
##
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
#
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
use Scalar::Util qw(looks_like_number);
2021-12-30 12:05:56 +01:00
use Lib::Config;
use Mod::Buttons;
use Mod::Libenz;
use Mod::Libenzdb;
use Mod::DBtank;
use Tpl::TransPositionen;
2022-10-14 08:28:51 +02:00
use Tpl::TransInvoices;
2022-01-26 15:52:25 +01:00
use Data::Dumper;
2021-12-30 12:05:56 +01:00
sub new {
my $class = shift;
my $self = {};
bless($self,$class);
return $self;
}
#Template
sub tpl(){
2022-02-10 16:45:22 +01:00
my $node_meta = shift;
my $users_dms = shift;
my $return = shift || "";
2021-12-30 12:05:56 +01:00
my $q = new CGI;
my $cf = new Config;
my $lb = new Libenz;
my $db = new Libenzdb;
my $dbt = new DBtank;
my $but = new Buttons;
my $transp = new TransPositionen;
2022-10-14 08:28:51 +02:00
my $trin = new TransInvoices;
2021-12-30 12:05:56 +01:00
my %varenv = $cf->envonline();
my $lang = "de";
my %ib = $but->ibuttons();
2022-02-10 16:45:22 +01:00
my $line_count1 = 0;
2022-10-14 08:28:51 +02:00
my $line_count2 = 0;
2022-10-31 08:11:53 +01:00
my $dbh = "";
2021-12-30 12:05:56 +01:00
2022-10-18 20:15:11 +02:00
#Kunden Faktura ex Firma
2022-10-31 08:11:53 +01:00
#my $ctf = $db->get_content1("contentuser",$dbt->{shareedms_conf}->{parent_id});
my $ctf = { c_id => 0 };
my $pref_cu = {
table => "contentuser",
fetch => "one",
c_id => $dbt->{shareedms_conf}->{parent_id},
};
$ctf = $dbt->fetch_tablerecord($dbh,$pref_cu);
my $ctt = { c_id => 0 };
my $pref = {
table => "contenttrans",
fetch => "one",
template_id => "IN::(208,209,218)",
2022-10-31 08:11:53 +01:00
c_id => $users_dms->{c_id4trans},
};
$ctt = $dbt->fetch_record($dbh,$pref);
2022-12-16 08:37:05 +01:00
my $warn_time = $ctt->{warn_time} || "";
$warn_time = $lb->time4de($warn_time,0) if($warn_time);
2022-01-26 15:52:25 +01:00
2022-10-18 20:15:11 +02:00
my $ctadr = { c_id => 0 };
my $rel_adr = { rel_id => 0 };
2022-10-31 08:11:53 +01:00
my $c_idadr = $ctt->{int10} || "";#c_id orig from contentadr
2021-12-30 12:05:56 +01:00
2022-10-18 20:15:11 +02:00
if($node_meta->{tpl_id} == 208){
$ctadr = $db->get_content1("contentuser","2");
}else{
$ctadr = $db->get_content1("contentadr",$c_idadr);
$rel_adr = $db->get_rel4tpl("","$lang","$c_idadr","202");
}
2021-12-30 12:05:56 +01:00
if(("$R::trans2edit" eq "client" && $R::c_idadr) || ($R::ct_trans eq "add_transadr")){
2022-03-18 14:51:25 +01:00
$ctadr = $db->get_content1("contentadr",$R::c_idadr);
$c_idadr = $ctadr->{c_id};
$ctt->{txt01} = $ctadr->{txt01};
$ctt->{txt03} = $ctadr->{txt03};
$ctt->{txt06} = $ctadr->{txt06};
$ctt->{txt07} = $ctadr->{txt07};
$ctt->{txt08} = $ctadr->{txt08};
2021-12-30 12:05:56 +01:00
}
print<<EOF
<style>
.ui-autocomplete {
text-align:left;
background:#eeeeee;
border:1px solid silver;
}
</style>
<script>
\$(function() {
\$('#json_selectadr').autocomplete({
2023-03-05 20:01:47 +01:00
source: '/ajax_json?table=contentadr&template_id=202&catch_equal=0',
2021-12-30 12:05:56 +01:00
minLength: 2,
select: function(event, ui) {
\$('#vorname_name').val(ui.item.vorname_name);
\$('#c_idadr').val(ui.item.c_id);
}
});
});
</script>
EOF
;
2022-10-31 08:11:53 +01:00
my $main_id = $ctt->{main_id};
2022-02-10 16:45:22 +01:00
my $set_main_id = $dbt->{shareedms_conf}->{invoice};
2021-12-30 12:05:56 +01:00
print "\n<div style='position:absolute;text-align:left;background-color:white;width:100%;'>\n";
2022-10-31 08:11:53 +01:00
if(!$ctt->{c_id}){
2021-12-30 12:05:56 +01:00
$lb->failure3("Das Formular wurde gelöscht bzw. ist nicht vorhanden");
}
#######Verkauf Header
print $q->start_form(),"\n";
2022-03-17 20:28:28 +01:00
print $q->hidden(-name=>'printer_id', -override=>'1', -value=>"PDF");
print "\n<div style='background-color:#a7a18f;height:25px;text-align:left;width:100%;' nowrap=1>\n";
2021-12-30 12:05:56 +01:00
#submit Header
my $invoice_time = "";
if($ctt->{invoice_time}){#since 2020-03-16 will be set on Printpreview
$invoice_time = $lb->time4de($ctt->{invoice_time},1);
}else{
$invoice_time = $lb->time4de($ctt->{mtime},1);
}
my $channel_map = $dbt->channel_map();
my $buchen_users = { txt01 => "" };
if($channel_map->{$ctt->{owner}}){
$buchen_users = { txt01 => "$channel_map->{$ctt->{owner}}" };
}else{
$buchen_users = $db->get_content1("contentadr",$ctt->{owner});
}
my $journalhead = "";
$journalhead = "<br /><span style='color:silver;font-size:0.81em;'>Journal</span>" if($ctt->{template_id} == 209);
2022-10-31 08:11:53 +01:00
$set_main_id=$main_id if($ctt->{main_id} > "300000");
2022-03-17 20:28:28 +01:00
print $q->hidden(-name=>'set_main_id', -override=>'1', -value=>"$set_main_id");
print $q->span({-style=>'margin:0em 0.5em 0 0.5em;padding:0.5em 3em;background-color:white;border:solid thin gray;position:absolute;left:3px;'}, "$ctt->{txt00} $journalhead");
2021-12-30 12:05:56 +01:00
2022-03-18 14:51:25 +01:00
print "<span style='margin:0 0.2em;position:absolute;left:180px;'>\n";
2022-10-31 08:11:53 +01:00
print $q->b({-style=>'padding:0 1em;'}, "\# $ctt->{ct_name}"), "\n";
if($ctt->{ct_name} =~ /\d+/ && $ctt->{txt00} eq "Storno"){
2022-03-18 14:51:25 +01:00
print $but->singlesubmit3("ct_trans","set_workflow2invoice","","",""),"\n";
print $q->hidden(-name=>'set_main_id4workflow', -override=>'1', -value=>"300008"), "\n";
2022-03-17 20:28:28 +01:00
}
if($ctt->{ct_name} =~ /\d+/ && $ctt->{txt00} =~ /Rechnung|Mahnung/ && $ctt->{int10} != 2){#only for client invoice
2022-03-18 14:51:25 +01:00
print $but->singlesubmit3("ct_trans","set_workflow2storno","","",""), "\n";
print $q->hidden(-name=>'set_main_id4workflow', -override=>'1', -value=>"300009"), "\n";
2021-12-30 12:05:56 +01:00
}
2022-10-31 08:11:53 +01:00
if($ctt->{ct_name} =~ /\d+/ && $ctt->{txt00} eq "Abrechnung"){
print $but->singlesubmit3("ct_trans","set_accounting2invoice","","",""), "\n";
print $q->hidden(-name=>'set_main_id4workflow', -override=>'1', -value=>"300008"), "\n";
}
2022-03-18 14:51:25 +01:00
print "</span>\n";
2021-12-30 12:05:56 +01:00
2023-02-12 08:23:52 +01:00
my $praefix = "$ctt->{txt00}-$varenv{praefix}";
if(!$journalhead && (!looks_like_number($ctt->{int01}) || $ctt->{ct_name} =~ /-/)){
2023-02-12 08:23:52 +01:00
print $q->span({-style=>'margin:0 0.2em;position:absolute;right:3px;'}, $but->singlesubmit7("ct_trans","remove_chk4rel","$ib{remove_chk4rel}","")),"\n";
2022-10-31 08:11:53 +01:00
print $q->hidden(-name=>'c_id', -override=>'1', -value=>"$ctt->{content_id}");
print $q->hidden(-name=>'template_id', -override=>'1', -value=>"$ctt->{template_id}");
print $q->hidden(-name=>'main_id', -override=>'1', -value=>"$ctt->{main_id}");
print $q->hidden(-name=>'rel_id', -override=>'1', -value=>"$ctt->{rel_id}");
2023-02-12 08:23:52 +01:00
}elsif(looks_like_number($ctt->{int01}) && ! -f "$varenv{basedir}/pdfinvoice/$praefix-$ctt->{ct_name}.pdf"){
print $q->span({-style=>'margin:0 0.2em;position:absolute;right:3px;'}, $but->singlesubmit3("ct_trans","print_pdf","","","")),"\n";
2021-12-30 12:05:56 +01:00
}
2023-02-12 08:23:52 +01:00
print $q->span({-style=>'margin:0 0.2em;position:absolute;right:100px;'}, "$buchen_users->{txt01} / $invoice_time "),"\n";
2021-12-30 12:05:56 +01:00
print "</div>\n";
2022-01-26 15:52:25 +01:00
print $q->hidden(-name=>'owner', -override=>'1', -value=>"$users_dms->{owner}");
2021-12-30 12:05:56 +01:00
print $q->hidden(-name=>'c_idadr', -override=>'1', -value=>"$c_idadr");
print $q->hidden(-name=>'offset', -override=>'1', -value=>"$R::offset");
print $q->hidden(-name=>'limit', -override=>'1', -value=>"$R::limit");
print $q->hidden(-name=>'relids', -override=>'1', -value=>"$R::relids");
2022-10-31 08:11:53 +01:00
print $q->hidden(-name=>'ct_name4workflow', -override=>1, -value=>"$ctt->{ct_name}");
print $q->hidden(-name=>'c_id4trans', -override=>'1', -value=>"$ctt->{c_id}");
print $q->hidden(-name=>'tpl_id4trans', -override=>'1', -value=>"$ctt->{template_id}");
print $q->hidden(-name=>'close_time', -override=>'1', -value=>"$ctt->{close_time}");
2021-12-30 12:05:56 +01:00
print $q->end_form,"\n";
2022-10-31 08:11:53 +01:00
print $q->div({-style=>'position:fixed;bottom:2%;right:1%;z-index:10;font-size:13px;'}," (c_id: $ctt->{c_id} | rel_id: $ctt->{rel_id} | tpl_id: $ctt->{tpl_id})"),"\n" if($users_dms->{u_id} eq $varenv{superu_id});
2021-12-30 12:05:56 +01:00
##########
2023-02-10 12:04:30 +01:00
#Relationen
if($ctt->{barcode}){
my $pref_rel = {
table => "contenttrans",
fetch => "all",
keyfield => "c_id",
template_id => "IN::(209,218)",
2023-02-10 12:04:30 +01:00
barcode => $ctt->{barcode},
};
my $ctt_rel = "";
$ctt_rel = $dbt->fetch_record($dbh,$pref_rel);
if(ref($ctt_rel) eq "HASH"){
my $top = 30;
foreach my $id (sort { $ctt_rel->{$b}->{c_id} <=> $ctt_rel->{$a}->{c_id} } keys (%$ctt_rel)){
my $toppx = $top . "px";
2023-02-12 08:23:52 +01:00
my $rel_color = "#f7ae37";
$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";
2023-02-10 12:04:30 +01:00
$top += 22;
}
}
}
2021-12-30 12:05:56 +01:00
#Form for AdressData
print $q->start_form(-name=>'addressform'),"\n";
#Big table
2023-02-10 12:04:30 +01:00
print $q->start_table({-border=>'0', -width=>'100%',-align=>'left', -cellpadding=>'0', -cellspacing=>'0'}),"\n";
2021-12-30 12:05:56 +01:00
print "<tr><td width='50%' style='font-size:1em;'>\n";
2023-02-10 12:04:30 +01:00
print $q->start_table({-class=>'list', -height=>'10em',-border=>'0', -width=>'100%',-align=>'left', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
2021-12-30 12:05:56 +01:00
###Content #Edit Address --> template=Adressenliste
$ctt->{txt01} = $q->unescapeHTML("$ctt->{txt01}");
2022-02-20 09:10:00 +01:00
my $int05 = "";
$int05 = "(manuell)" if($ctt->{int05});
2022-01-26 15:52:25 +01:00
if($users_dms->{u_id} && ($R::trans2edit eq "client" || $R::ct_trans eq "add_transadr")){
2022-03-18 14:51:25 +01:00
#my @_anrede = ("","Frau","Herr","Firma");
2022-10-31 08:11:53 +01:00
print $q->hidden(-name=>'c_id4trans', -override=>'1', -value=>"$ctt->{c_id}"),"\n";
2023-02-16 19:52:49 +01:00
print $q->hidden(-name=>'tpl_id4trans', -override=>'1', -value=>"$ctt->{template_id}");
2021-12-30 12:05:56 +01:00
print $q->hidden(-name=>'int10', -override=>'1', -value=>"$c_idadr"),"\n";
print $q->hidden(-name=>'c_idadr', -override=>'1', -value=>"$c_idadr"),"\n";
2022-10-31 08:11:53 +01:00
print $q->hidden(-name=>'rel_id', -override=>'1', -value=>"$ctt->{rel_id}"),"\n";
2022-03-18 14:51:25 +01:00
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print "<td class='tdescr4' nowrap>";
2023-02-10 12:04:30 +01:00
print $but->singlesubmit7("ct_trans","save_adr","$ib{save_adr}","","","autofocus"),"\n";
2021-12-30 12:05:56 +01:00
#print $q->span($q->a({-class=>"ebutton3",-href=>'javascript:history.back()'}, " back "));
print "</td>\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdval4',-colspan=>'2'},"Kunden ID $c_idadr"),"\n";
2021-12-30 12:05:56 +01:00
$ctt->{txt01} = $lb->newline($ctt->{txt01},"","1");
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"Vorname Name<br />Zusatz"),"\n";
print $q->td({-class=>'tdval4',-colspan=>'2'},$q->textarea(-class=>'autos',-style=>'border:1px solid #ededed;background-color: #ededed;', -name=>'txt01', -default=>"$ctt->{txt01}", -rows=>1, -columns=>38)),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"Straße Nr."),"\n";
print $q->td({-class=>'tdval4',-colspan=>'2',-nowrap=>1}, $q->textfield(-class=>'etxt',-name=>'txt03', -default=>"$ctt->{txt03}", -size=>'34', maxlength=>'45')),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"PLZ Ort"),"\n";
print $q->td({-class=>'tdval4',-colspan=>'2'}, $q->textfield(-class=>'etxt',-name=>'txt06', -default=>"$ctt->{txt06}", -size=>'34', maxlength=>'45')),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"eMail"),"\n";
print $q->td({-class=>'tdval4',-colspan=>'2'}, $q->textfield(-class=>'etxt',-name=>'txt08', -default=>"$ctt->{txt08}", -size=>'34', maxlength=>'45')),"\n";
2022-02-20 09:10:00 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"Telefon"),"\n";
print $q->td({-class=>'tdval4',-colspan=>'2'}, $q->textfield(-class=>'etxt',-name=>'txt07', -default=>"$ctt->{txt07}", -size=>'34', maxlength=>'40')),"\n";
2022-02-20 09:10:00 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"Leistungsdatum"),"\n";
print $q->td({-class=>'tdval4',-colspan=>'2'}, $q->textfield(-class=>'etxt',-name=>'txt20', -default=>"$ctt->{txt20}", -size=>'34', maxlength=>'60'),$but->checkbox("1","int05","$ctt->{int05}"),"manuell"),"\n";
2022-02-20 09:10:00 +01:00
print $q->hidden(-name=>"int05",-override=>1,-value=>"");
2022-01-26 15:52:25 +01:00
}elsif($users_dms->{u_id}){
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
if(!$ctt->{close_time} && (!$ctt->{int10} || $ctt->{int10} != 2)){
print "<td class='tdescr4' style='width:8em;' nowrap>";
2021-12-30 12:05:56 +01:00
print $but->singlesubmit2glyph("trans2edit","client","Kunden bearbeiten","background-color:white;"),"\n";
2022-10-31 08:11:53 +01:00
print $q->hidden(-name=>'c_id4trans', -override=>'1', -value=>"$ctt->{c_id}"),"\n";
2023-02-16 19:52:49 +01:00
print $q->hidden(-name=>'tpl_id4trans', -override=>'1', -value=>"$ctt->{template_id}");
2021-12-30 12:05:56 +01:00
#from json_selectadr
print $q->hidden(-id=>'c_idadr', -name=>"c_idadr", -override=>'1'),"\n";
print $q->hidden(-id=>'vorname_name', -name=>"vorname_name", -override=>'1'),"\n";
print $q->textfield(-style=>'border:1px solid silver;vertical-align: top;',-id=>"json_selectadr",-name=>"json_selectadr", -value=>""),"\n";
print "</td>\n";
}else{
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"&nbsp;"),"\n";
2021-12-30 12:05:56 +01:00
}
2022-11-02 20:14:57 +01:00
#print $q->td({-class=>'tdval4'},"$ctt->{txt02}"),"\n";
2022-03-18 14:51:25 +01:00
if($c_idadr && $rel_adr->{rel_id}){
my $vde = "";
$vde = " Vde $ctadr->{int12}" if($ctadr->{int12});
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdval4',-colspan=>'2'},$q->span({-style=>"background-color:#dcd77f;"},$q->a({-class=>"linknav",-href=>"/DMS/Kunden?node2edit=editpart\&mode=manager\&rel_id=$rel_adr->{rel_id}\&tpl_id=202",-title=>"Kunden Stammdaten öffnen"}," Kunden ID $c_idadr ")), $q->span({-style=>"color:red;padding-left:10px;"}," $vde")),"\n";
2022-03-18 14:51:25 +01:00
}
2021-12-30 12:05:56 +01:00
$ctt->{txt01} = $lb->newline($ctt->{txt01},"","");
print $q->Tr(),"\n"; $line_count1++;
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"&nbsp;"),"\n";
print $q->td({-class=>'tdval4',-colspan=>2},"$ctt->{txt01}"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n"; $line_count1++;
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"&nbsp;"),"\n";
print $q->td({-class=>'tdval4',-colspan=>2},"$ctt->{txt03}"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n"; $line_count1++;
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"&nbsp;"),"\n";
print $q->td({-class=>'tdval4',-colspan=>2},"$ctt->{txt06}"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n"; $line_count1++;
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"&nbsp;"),"\n";
print $q->td({-class=>'tdval4',-colspan=>2},"$ctt->{txt08}"),"\n";
2022-02-20 09:10:00 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"&nbsp;"),"\n";
print $q->td({-class=>'tdval4',-colspan=>2},"$ctt->{txt07}"),"\n";
2022-02-20 09:10:00 +01:00
print $q->Tr(),"\n";$line_count1++;
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"&nbsp;"),"\n";
print $q->td({-class=>'tdval4',-colspan=>2},"$ctt->{txt20} $int05"),"\n";
2021-12-30 12:05:56 +01:00
}
print $q->end_table;
print "</td>\n";
print "<td width='50%' style='font-size:1em;'>\n";
2023-02-10 12:04:30 +01:00
print $q->start_table({-class=>'list', -border=>'0', -width=>'100%',-align=>'left', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
2022-11-02 20:14:57 +01:00
#if operator accounting/invoice
if($node_meta->{tpl_id} == 208 || $ctt->{int10} == 2){
2022-10-31 08:11:53 +01:00
my $tplop = $dbt->get_tpl($dbh,"196");#Operator-Faktura
2022-10-18 20:15:11 +02:00
my @tplop_order = split /,/,$tplop->{tpl_order};
foreach(@tplop_order){
my ($key,$val,$size,$unit) = split /=/,$_;
2022-10-31 08:11:53 +01:00
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;
$ctt->{$ctt_key} =~ s/\./,/;
2022-10-18 20:15:11 +02:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4', -style=>'width:50%;'},"$val"),"\n";
2022-10-31 08:11:53 +01:00
if($ctt->{$ctt_key}){
$ctt->{$ctt_key} =~ s/\./,/;
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdval4'},"$ctt->{$ctt_key} $unit"),"\n";
2022-10-31 08:11:53 +01:00
}else{
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdval4'},""),"\n";
2022-10-31 08:11:53 +01:00
}
2022-10-18 20:15:11 +02:00
}
}
}else{
my $pay_sequence = " | sequencenr: $ctt->{int18}" if($ctt->{int18});
2022-10-14 08:28:51 +02:00
my @_paymentstate = split(/\|/,$dbt->{shareedms_conf}->{payment_state});
2021-12-30 12:05:56 +01:00
my $kind_of_payment = "fehlt";
2022-08-01 15:13:43 +02:00
$kind_of_payment = "$_paymentstate[0]" if($ctadr->{int03} == 1);
$kind_of_payment = "$_paymentstate[1]" if($ctadr->{int03} == 2);
2022-12-16 08:37:05 +01:00
my $payteaser = "";
if($ctadr->{txt28}){
$payteaser = substr($ctadr->{txt28},0,50) . " ...";
}
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"Payone Zahlungsart"),"\n";
2022-12-16 08:37:05 +01:00
print $q->td({-class=>'tdval4'},"$kind_of_payment"),"\n";
print $q->Tr(),"\n";
print $q->td({-class=>'tdescr4'},"Payone log Kunde"),"\n";
2022-12-16 08:37:05 +01:00
print $q->td({-class=>'tdval4'},"$payteaser"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"Payone TXID"),"\n";
print $q->td({-class=>'tdval4'},"$ctt->{txt16}"),"\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"Payone Saldo"),"\n";
print $q->td({-class=>'tdval4'},"$ctt->{int16} $pay_sequence"),"\n";
2022-02-20 09:10:00 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
print $q->td({-class=>'tdescr4'},"Payone Referenz"),"\n";
print $q->td({-class=>'tdval4'},"$ctt->{txt25}"),"\n";
2022-02-20 09:10:00 +01:00
2022-10-18 20:15:11 +02:00
}
2021-12-30 12:05:56 +01:00
print $q->end_table;
print "</td></tr>\n";
###end
print $q->end_form,"\n";
###Content #Edit Parts
print "<tr><td colspan='5' style='font-size:1em;'>\n";
2022-10-14 08:28:51 +02:00
#operator invoices else position accounting
2022-10-31 08:11:53 +01:00
if($ctt->{template_id} == 208 || $ctt->{int10} == 2){
$line_count2 = $trin->tpl($node_meta,$users_dms,$set_main_id,$ctt,$return);
2022-10-14 08:28:51 +02:00
}else{
2022-10-31 08:11:53 +01:00
$line_count2 = $transp->tpl($node_meta,$users_dms,$set_main_id,$ctt,$return);
2022-10-14 08:28:51 +02:00
}
2021-12-30 12:05:56 +01:00
print "</td></tr>\n";
###end Edit Parts
#Text & Vorbelegungen
my $tplf = $db->get_tpl("201");#Firma tpl
my @tplf_order = split /,/,$tplf->{tpl_order};
print $q->start_form(),"\n";
2022-10-31 08:11:53 +01:00
print $q->hidden(-name=>'c_id4trans', -override=>'1', -value=>"$ctt->{c_id}");
2022-03-17 20:28:28 +01:00
print $q->hidden(-name=>'set_main_id', -override=>'1', -value=>"$set_main_id"),"\n";
2022-11-02 20:14:57 +01:00
#Text save area
2023-02-10 12:04:30 +01:00
#Internas und Bearbeitungstatus
print "<tr><td colspan='1'>\n";
print $q->start_table({-border=>'0', -width=>'100%',-align=>'left', -cellpadding=>'0', -cellspacing=>'0'}),"\n";
2021-12-30 12:05:56 +01:00
2023-02-10 12:04:30 +01:00
#1.
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2023-02-10 12:04:30 +01:00
print $q->td({-class=>'tdval5',-style=>'height:40px;',-colspan=>"1"},$q->span({-style=>'font-weight:bold;'},"Internas und Bearbeitungstatus")),"\n";
if($ctt->{txt00} ne "Storno"){
my @_orderstate = split(/\|/,$dbt->{shareedms_conf}->{order_state});
print $q->td({-class=>'tdval5',-colspan=>1},$but->selector("txt22","180px",$ctt->{txt22},@_orderstate)),"\n";
}else{
2023-02-10 12:04:30 +01:00
print $q->td({-class=>'tdval5',-colspan=>"1"},"&nbsp;"),"\n";
}
#2.
print $q->Tr(),"\n";
if($ctt->{txt00} eq "Storno" || $ctt->{ct_name} =~ /\d+-\d/){
print $q->td({-class=>'tdval5',-colspan=>"2"},"&nbsp;"),"\n";
}else{
my @s_valxx = ("");
my $s_hash = {};
$s_hash = $dbt->{shareedms_conf}->{warning_state};
foreach my $s_key (sort keys (%{ $s_hash })) {
push @s_valxx, "$s_key:$s_key";
}
2023-02-12 08:23:52 +01:00
if($ctt->{ct_name} !~ /\d+-\d/){
2023-02-01 10:19:56 +01:00
undef @s_valxx[3];
undef @s_valxx[4];
undef @s_valxx[5];
}
2023-02-10 12:04:30 +01:00
print $q->td({-class=>'tdval5',-colspan=>"1"},"Zahlungserinnerung",$but->selector_class("int06","","",$ctt->{int06},@s_valxx)),"\n";
print $q->td({-class=>'tdval5',-colspan=>1},"Fälligkeit",$q->textfield(-id=>'datepicker3',-class=>'etxt',-name=>"warn_time",-default=>"$warn_time",-override=>1,-size=>"8",-maxlength=>10)),"\n";
}
2023-02-10 12:04:30 +01:00
#3.
2021-12-30 12:05:56 +01:00
$ctt->{txt23} = $q->unescapeHTML("$ctt->{txt23}") if($ctt->{txt23});
print $q->Tr(),"\n";
print $q->td({-class=>'tdval5',-colspan=>'2'},$q->textarea(-class=>'etxt',-name=>'txt23', -default=>"$ctt->{txt23}", -rows=>8, -columns=>55)),"\n";
2021-12-30 12:05:56 +01:00
2023-02-10 12:04:30 +01:00
print $q->end_table,"\n";
print "</td>\n";
#------------------------------
#PDF Formular Text
print "<td colspan='1'>\n";
print $q->start_table({-border=>'0', -width=>'100%',-align=>'left', -cellpadding=>'0', -cellspacing=>'0'}),"\n";
#1.
print $q->Tr(),"\n";
print $q->td({-class=>'tdval5',-style=>'height:40px;',-colspan=>"2"},$q->span({-style=>'font-weight:bold;'},"PDF Formular Text "),$q->span({-style=>'color:silver;font-weight:normal;'}," ( für den Kunden sichtbar )")),"\n";
#2.
print $q->Tr(),"\n";
print $q->td({-class=>'tdval5',-style=>'',-colspan=>"2"},"&nbsp;"),"\n";
#print $q->td({-class=>'tdval5',-style=>'height:45px;',-colspan=>"2"},"Zahlungseingang",$but->rev_checkbox("4","int14","$ctt->{int14}")),"\n";
#3.
2021-12-30 12:05:56 +01:00
$ctt->{txt12} = $q->unescapeHTML($ctt->{txt12}) || "";
2023-02-10 12:04:30 +01:00
print $q->Tr(),"\n";
print $q->td({-class=>'tdval5',-colspan=>'2'},$q->textarea(-class=>'etxt',-name=>'txt12', -default=>"$ctt->{txt12}", -rows=>8, -columns=>55)),"\n";
2021-12-30 12:05:56 +01:00
2023-02-10 12:04:30 +01:00
print $q->end_table,"\n";
print "</td></tr>\n";
2021-12-30 12:05:56 +01:00
print $q->Tr(),"\n";
2022-11-02 20:14:57 +01:00
if($ctt->{close_time}){
2023-02-10 12:04:30 +01:00
print $q->td({-class=>'tdval5',-style=>'width:90%;',-colspan=>2}, $but->singlesubmit7("ct_trans","save_text_internas","$ib{save_text}","","","autofocus")),"\n";
2022-11-02 20:14:57 +01:00
}else{
2023-02-10 12:04:30 +01:00
print $q->td({-class=>'tdval5',-style=>'width:90%;',-colspan=>2}, $but->singlesubmit7("ct_trans","save_text","$ib{save_text}","","","autofocus")),"\n";
2022-11-02 20:14:57 +01:00
}
2021-12-30 12:05:56 +01:00
2022-11-02 20:14:57 +01:00
print $q->hidden(-name=>'c_id4trans', -override=>'1', -value=>"$ctt->{c_id}"),"\n";
2023-02-10 12:04:30 +01:00
#print $q->hidden(-name=>'set_main_id', -override=>'1', -value=>"$set_main_id"),"\n";
2022-11-02 20:14:57 +01:00
2021-12-30 12:05:56 +01:00
print $q->end_form,"\n";
print $q->end_table,"\n";
###end Big
2022-11-02 20:14:57 +01:00
2022-12-16 08:37:05 +01:00
#payone-return log
$ctt->{txt28} = $lb->newline($ctt->{txt28},"","");
print $q->div({-id=>'Oline'},""),"\n";
print $q->div({-style=>'padding: 0 15px 20px 15px;font-size:0.91em;'},"<b>payone-response log</b><br />$ctt->{txt28}"),"\n";
2021-12-30 12:05:56 +01:00
print "</div>\n";
2023-02-10 12:04:30 +01:00
return;
2021-12-30 12:05:56 +01:00
}
1;