mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 23:26:29 +02:00
operator accounting disagio
This commit is contained in:
parent
ae4ff98d9b
commit
7f4becd901
22 changed files with 920 additions and 478 deletions
|
@ -1469,9 +1469,9 @@ sub booking_update(){
|
|||
if($booking->{int26}){
|
||||
$co2saving = "Einsparung: ";
|
||||
my $co2diff = $pri->co2calc($booking);
|
||||
my $sprit_price = $pri->sprit2calc($booking);
|
||||
#my $sprit_price = $pri->sprit2calc($booking);
|
||||
$co2saving .= "$co2diff kg CO2, ";
|
||||
$co2saving .= "$sprit_price EUR " if($sprit_price !~ /-/);
|
||||
#$co2saving .= "$sprit_price EUR " if($sprit_price !~ /-/);
|
||||
$booking->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei einer Strecke von $booking->{int26} KM";
|
||||
$booking_values->{co2saving} = $co2saving;
|
||||
|
@ -1724,9 +1724,9 @@ sub rental_to_feedback{
|
|||
if($ctpos->{int26}){
|
||||
my $co2saving = "Einsparung: ";
|
||||
my $co2diff = $pri->co2calc($ctpos);
|
||||
my $sprit_price = $pri->sprit2calc($ctpos);
|
||||
#my $sprit_price = $pri->sprit2calc($ctpos);
|
||||
$co2saving .= "$co2diff kg CO2, ";
|
||||
$co2saving .= "$sprit_price EUR " if($sprit_price !~ /-/);
|
||||
#$co2saving .= "$sprit_price EUR " if($sprit_price !~ /-/);
|
||||
$ctpos->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei einer Strecke von $ctpos->{int26} KM";
|
||||
$show_dialog->{co2saving} = $co2saving;
|
||||
|
@ -1797,8 +1797,8 @@ sub rentals(){
|
|||
$return->{$id}->{K_u} = "$K_val" if($K_key eq "K_u");
|
||||
}
|
||||
}
|
||||
$bw->log("user_bikes_occupied rentals bike $return->{$id}->{bike} | station $return->{$id}->{station} | state $return->{$id}->{state}, auth:$auth->{c_id}",$return->{$id}->{c_id},"");
|
||||
}
|
||||
|
||||
return $return;
|
||||
}#end rentals
|
||||
|
||||
|
@ -2631,7 +2631,7 @@ sub auth_verify(){
|
|||
my $auth_primary = { c_id => 0 };
|
||||
my $auth_operator = { c_id => 0 };
|
||||
$auth_operator = $dbt->fetch_record($dbh,$authref);
|
||||
$bw->log("auth_verified on operator $varenv{dbname} anchor 1",$auth_operator->{c_id},"");
|
||||
#$bw->log("auth_verified on operator $varenv{dbname} anchor 1",$auth_operator->{c_id},"");
|
||||
|
||||
#just part of operator-routing (sharee account management)
|
||||
if($varenv{dbname} ne "sharee_primary"){
|
||||
|
@ -2640,7 +2640,7 @@ sub auth_verify(){
|
|||
$auth_primary = $dbt->fetch_record($dbh_primary,$authref);
|
||||
|
||||
if($auth_primary->{c_id} && $auth_primary->{c_id} > 0){
|
||||
$bw->log("auth_verified on primary anchor 2 by dbname $varenv{dbname}",$auth_primary->{c_id},"");
|
||||
#$bw->log("auth_verified on primary anchor 2 by dbname $varenv{dbname}",$auth_primary->{c_id},"");
|
||||
print FILE "auth_verified on primary anchor 2 by dbname $varenv{dbname} | pri $auth_primary->{c_id}\n" if($debug);
|
||||
|
||||
#On booking_request, user must be authenticated and addr must exist
|
||||
|
@ -2649,7 +2649,7 @@ sub auth_verify(){
|
|||
|
||||
#first, save operator array which are used
|
||||
my %operator_hash = ();#local DB
|
||||
$bw->log("booking_request auth_verified by dbname $varenv{dbname}",$auth_primary->{c_id},"");
|
||||
#$bw->log("booking_request auth_verified by dbname $varenv{dbname}",$auth_primary->{c_id},"");
|
||||
print FILE "booking_request auth_verified by dbname $varenv{dbname} | pri $auth_primary->{c_id}\n if($debug)";
|
||||
|
||||
if($auth_primary->{txt17} && $auth_primary->{txt17} =~ /\w\s\w/){#append DB's
|
||||
|
@ -2660,7 +2660,7 @@ sub auth_verify(){
|
|||
$operator_hash{$varenv{dbname}} = 1 if($varenv{dbname} ne "sharee_lv");#LastenVelo dbname will be only set by xml
|
||||
|
||||
my @operator_array = keys %operator_hash;
|
||||
$bw->log("auth_verified update operator keys by array: @operator_array",\%operator_hash,"");
|
||||
#$bw->log("auth_verified update operator keys by array: @operator_array",\%operator_hash,"");
|
||||
print FILE "auth_verified update operator keys by array: @operator_array | pri $auth_primary->{c_id}\n" if($debug);
|
||||
my $update_primary = {
|
||||
table => "contentadr",
|
||||
|
@ -2696,13 +2696,13 @@ sub auth_verify(){
|
|||
};
|
||||
my $auth_operator3 = { c_id => 0 };
|
||||
$auth_operator3 = $dbt->fetch_record($dbh,$authref);# if($uid);
|
||||
$bw->log("auth_verified on operator anchor 3 by dbname $varenv{dbname}",$auth_operator3->{c_id},"");
|
||||
#$bw->log("auth_verified on operator anchor 3 by dbname $varenv{dbname}",$auth_operator3->{c_id},"");
|
||||
print FILE "auth_verified on operator anchor 3 by dbname $varenv{dbname} | op3 $auth_operator3->{c_id}\n" if($debug);
|
||||
|
||||
#if user on operator available by userid c_id, then update authcookie
|
||||
if($auth_operator3->{c_id} && $auth_operator3->{c_id} > 0){
|
||||
my $authcookies = $auth_operator3->{txt05} . "|" . $cgi_authcookie;
|
||||
$bw->log("UPDATE adr on operator by dbname $varenv{dbname}",$auth_operator3->{c_id},"");
|
||||
#$bw->log("UPDATE adr on operator by dbname $varenv{dbname}",$auth_operator3->{c_id},"");
|
||||
print FILE "UPDATE adr on operator by dbname $varenv{dbname} | op3 $auth_operator3->{c_id}\n" if($debug);
|
||||
my $update = {
|
||||
table => "contentadr",
|
||||
|
@ -2730,31 +2730,27 @@ sub auth_verify(){
|
|||
$c_id = $dbt->insert_contentoid($dbh,$insert,"reset_adropkeys");
|
||||
}
|
||||
}else{
|
||||
$bw->log("auth_verified on operator anchor 3 FAILS by dbname $varenv{dbname}. user seem not be activated",$auth_operator->{c_id},"");
|
||||
#$bw->log("auth_verified on operator anchor 3 FAILS by dbname $varenv{dbname}. user seem not be activated",$auth_operator->{c_id},"");
|
||||
print FILE "auth_verified on operator anchor 3 FAILS by dbname $varenv{dbname}. user seem not be activated | op $auth_operator->{c_id}\n" if($debug);
|
||||
}
|
||||
}
|
||||
$auth_operator = $dbt->fetch_record($dbh,$authref);
|
||||
if($auth_operator->{c_id} && $auth_operator->{c_id} > 0){
|
||||
$record = $auth_operator;#At first try using operator to get Tarif
|
||||
$bw->log("auth_verified on operator anchor 2.2 by dbname $varenv{dbname}",$auth_operator->{c_id},"");
|
||||
#$bw->log("auth_verified on operator anchor 2.2 by dbname $varenv{dbname}",$auth_operator->{c_id},"");
|
||||
print FILE "auth_verified on operator anchor 2.2 by dbname $varenv{dbname} | op $auth_operator->{c_id}\n" if($debug);
|
||||
}else{
|
||||
$record = $auth_primary;
|
||||
$bw->log("auth_verified on primary anchor 2.3 by dbname $varenv{dbname}",$auth_primary->{c_id},"");
|
||||
#$bw->log("auth_verified on primary anchor 2.3 by dbname $varenv{dbname}",$auth_primary->{c_id},"");
|
||||
print FILE "auth_verified on primary anchor 2.3 by dbname $varenv{dbname} | pri $auth_primary->{c_id}\n" if($debug);
|
||||
}
|
||||
}else{# if($auth_primary->{c_id}) fails
|
||||
$bw->log("auth_verified on primary anchor 4 FAILS by dbname $varenv{dbname}.",$auth_primary->{c_id},"");
|
||||
#$bw->log("auth_verified on primary anchor 4 FAILS by dbname $varenv{dbname}.",$auth_primary->{c_id},"");
|
||||
print FILE "auth_verified on primary anchor 4 FAILS by dbname $varenv{dbname} | pri $auth_primary->{c_id}\n" if($debug);
|
||||
#$auth_operator = $dbt->fetch_record($dbh,$authref);
|
||||
#$record = $auth_operator;
|
||||
#$bw->log("auth_verified on operator anchor 9 by dbname $varenv{dbname}.",$auth_operator->{c_id},"");
|
||||
#print FILE "auth_verified on operator anchor 9 by dbname $varenv{dbname} | op $auth_operator->{c_id}\n" if($debug);
|
||||
}
|
||||
}else{# if($varenv{dbname} eq "sharee_primary")
|
||||
$auth_primary = $dbt->fetch_record($dbh,$authref);
|
||||
$bw->log("auth_verified on operator anchor 4 by dbname $varenv{dbname}",$auth_primary->{c_id},"");
|
||||
#$bw->log("auth_verified on operator anchor 4 by dbname $varenv{dbname}",$auth_primary->{c_id},"");
|
||||
print FILE "auth_verified on operator anchor 4 by dbname $varenv{dbname} | pri $auth_primary->{c_id}\n" if($debug);
|
||||
$record = $auth_primary;
|
||||
}#end if($varenv{dbname} ne "sharee_primary")
|
||||
|
@ -2797,14 +2793,14 @@ sub auth_verify(){
|
|||
$return->{response_text} = "Danke, die Anmeldebestätigung war erfolgreich.";
|
||||
}
|
||||
}else{
|
||||
$bw->log("auth_verified on operator anchor FAILS by dbname $varenv{dbname}, no authcookie, dump \$q",$q,"");
|
||||
#$bw->log("auth_verified on operator anchor FAILS by dbname $varenv{dbname}, no authcookie, dump \$q",$q,"");
|
||||
print FILE "auth_verified on operator anchor FAILS by dbname $varenv{dbname}, no authcookie\n" if($debug);
|
||||
}
|
||||
$return->{agb_checked} = "0";
|
||||
$return->{agb_checked} = "1" if($record->{int14});#sharee AGB global
|
||||
|
||||
my $last_used_operator = $record->{txt19};#check if this is primary and/or useable
|
||||
$bw->log("last_used_operator selected by txt19:",$last_used_operator,"");
|
||||
#$bw->log("last_used_operator selected by txt19:",$last_used_operator,"");
|
||||
if($last_used_operator){
|
||||
my $dbh_operator = $dbt->dbconnect_extern("$last_used_operator");
|
||||
my $hotline_hash = {
|
||||
|
@ -2831,19 +2827,19 @@ sub auth_verify(){
|
|||
$return->{last_used_operator}->{operator_email} = $hotline_data->{txt08} if($hotline_data->{txt08});
|
||||
}
|
||||
|
||||
$bw->log("auth_verify done on txt05 authcookies by dbname $varenv{dbname}:",$record->{txt05},"");
|
||||
#$bw->log("auth_verify done on txt05 authcookies by dbname $varenv{dbname}:",$record->{txt05},"");
|
||||
|
||||
#Servicetool only users with users.int09=1
|
||||
#shareetool
|
||||
if($varenv{dbname} ne "sharee_primary" && $return->{merchant_id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id} == 187){
|
||||
my $users_serviceapp = { u_id => 0 };
|
||||
$users_serviceapp = $dbt->select_users($dbh,$record->{c_id},"and int09=1");
|
||||
$bw->log("users_serviceapp: $users_serviceapp->{u_id} && $varenv{dbname} && $return->{merchant_id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id}","","");
|
||||
#$bw->log("users_serviceapp: $users_serviceapp->{u_id} && $varenv{dbname} && $return->{merchant_id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id}","","");
|
||||
|
||||
if(!$users_serviceapp->{u_id} || $users_serviceapp->{u_id} == 0){
|
||||
$record = { c_id => 0 };
|
||||
$return = { c_id => 0 };
|
||||
$bw->log("reset auth_verify because of only Servicetool users access:",$record,"");
|
||||
#$bw->log("reset auth_verify because of only Servicetool users access:",$record,"");
|
||||
}
|
||||
print FILE "users_serviceapp: $users_serviceapp->{u_id} | $return->{authcookie}\n" if($debug);
|
||||
}
|
||||
|
@ -2945,14 +2941,14 @@ sub authcookie_manager {
|
|||
my @registered_cookies;
|
||||
my $registered_cookies;
|
||||
my @check_cookies = split(/\|/,$record->{txt05});
|
||||
$bw->log("check_cookies","@check_cookies","");
|
||||
#$bw->log("check_cookies","@check_cookies","");
|
||||
@check_cookies = reverse(@check_cookies);
|
||||
my $i=0;
|
||||
foreach(@check_cookies){
|
||||
$i++;
|
||||
#secure shortage cookies
|
||||
if(length($_) > 20 && $i < 8){#max 8 clients
|
||||
$bw->log("$i < 8 cookies",$_,"");
|
||||
#$bw->log("$i < 8 cookies",$_,"");
|
||||
push @registered_cookies,$_;
|
||||
}
|
||||
}
|
||||
|
@ -2963,7 +2959,7 @@ sub authcookie_manager {
|
|||
}
|
||||
$registered_cookies =~ s/\|$//;
|
||||
|
||||
$bw->log("generated authcookie",$authcookie,"");
|
||||
#$bw->log("generated authcookie",$authcookie,"");
|
||||
|
||||
#return still existing authcookie
|
||||
if($registered_cookies && $registered_cookies =~ /$authcookie/){
|
||||
|
|
|
@ -78,10 +78,9 @@ sub loop_sharees {
|
|||
$bw->log("shareetool select_users $return_merchant->{aowner} on $value->{database}->{dbname} $authraw->{c_id} $authraw->{txt17}",$users_serviceapp->{u_id},"");
|
||||
}
|
||||
#every sharee client must have a merchant_id which associate a project
|
||||
#if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project} || $return_merchant->{project_id} eq "all")))
|
||||
if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project}))){
|
||||
|
||||
$bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $value->{operatorApp}, netloc: $netloc if($return_merchant->{project_id} eq $value->{project} || $users_serviceapp->{u_id} > 0)\n","","");
|
||||
#$bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $value->{operatorApp}, netloc: $netloc if($return_merchant->{project_id} eq $value->{project} || $users_serviceapp->{u_id} > 0)\n","","");
|
||||
$ret_json = $self->fetch_operator_json("$value->{operatorApp}/APIjsonserver",$rest);
|
||||
#print Dumper($ret_json);
|
||||
|
||||
|
@ -124,7 +123,7 @@ sub loop_sharees {
|
|||
}else{
|
||||
$bw->log("NO json from Operator:",$value->{operatorApp},"");
|
||||
}
|
||||
$bw->log("--> LOOP-end jsonclient loop_sharees user_group:\n",\@user_group,"");
|
||||
#$bw->log("--> LOOP-end jsonclient loop_sharees user_group:\n",\@user_group,"");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -139,7 +138,7 @@ sub fetch_operator_json {
|
|||
my $rest = shift || "";
|
||||
my $operator_request = "$operator_server?$rest";
|
||||
|
||||
$bw->log("fetch_operator_json >> ","$operator_request","");
|
||||
#$bw->log("fetch_operator_json >> ","$operator_request","");
|
||||
|
||||
my $req = HTTP::Request->new(GET => "$operator_request");
|
||||
$req->content_type('application/x-www-form-urlencoded');
|
||||
|
|
|
@ -466,7 +466,7 @@ elsif($q->param('request') eq "bikes_available"){
|
|||
#on operator loop select, operator adr must be select to get user_group
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
$response = { %$response, %$auth };
|
||||
$bw->log("Y bikes_available by c_id $authraw->{c_id}, Tarif:",$authraw->{txt30},"");
|
||||
#$bw->log("Y bikes_available by c_id $authraw->{c_id}, Tarif:",$authraw->{txt30},"");
|
||||
|
||||
#sig first save
|
||||
#if($varenv{syshost} eq "shareeapp-sx"){
|
||||
|
@ -700,7 +700,7 @@ elsif($q->param('request') eq "user_feedback" || $q->param('request') eq "user_m
|
|||
my $customer = $auth->{c_id};
|
||||
#print Dumper($auth);
|
||||
(my $xresponse->{$customer}, my $responseraw, my $node_template, my $crecord) = $apif->service_select($q,$authraw,"","1");
|
||||
$bw->log("c_id: $crecord->{c_id} |user_feedback OR user_minianswer node_template",$node_template,"");
|
||||
#$bw->log("c_id: $crecord->{c_id} |user_feedback OR user_minianswer node_template",$node_template,"");
|
||||
|
||||
my $back_id = "";
|
||||
my $rows=0;
|
||||
|
@ -749,10 +749,10 @@ elsif($q->param('request') eq "service_done"){
|
|||
|
||||
#select services with max work_duration of 1 day and service_worker alias contentadr.c_id = contenttranspo.owner match
|
||||
(my $xresponse->{$article}, my $responseraw, my $node_template, my $crecord) = $apif->service_select($q,$authraw,"","1");
|
||||
$bw->log("service_done OOO: node",$node_template,"");
|
||||
#$bw->log("service_done OOO: node",$node_template,"");
|
||||
|
||||
if(ref($xresponse->{$article}) eq "HASH"){
|
||||
$bw->log("service_done xresponse",$xresponse->{$article},"");
|
||||
#$bw->log("service_done xresponse",$xresponse->{$article},"");
|
||||
|
||||
my $service_id = "";
|
||||
#select last service_id with work_duration < 1 day
|
||||
|
@ -896,7 +896,7 @@ elsif($q->param('request') eq "service_work"){
|
|||
|
||||
#$bw->log("service_work bike_id $bike_id pos_record",$pos_record,"");
|
||||
($response_work, $node) = $apif->service_work($pos_record,$bikes_allraw,$history,$node_template);
|
||||
$bw->log("service_work bike_id $bike_id response_work",$response_work,"");
|
||||
#$bw->log("service_work bike_id $bike_id response_work",$response_work,"");
|
||||
if(ref($response_work) ne "HASH"){#if fails
|
||||
$response->{response_state} = "Failure 4010: no service found";
|
||||
}
|
||||
|
@ -970,7 +970,7 @@ else{
|
|||
my $jrout = $json->pretty->encode({shareejson => $response});
|
||||
print $jrout;
|
||||
|
||||
$bw->log("APIjsonserver response by $user_agent mapped aowner:$aowner",$jrout,"");
|
||||
$bw->log("APIjsonserver response by $user_agent mapped aowner:$aowner",$jrout,"") if($user_agent !~ /APIclient/);
|
||||
#end JSON ----------------------------------------------------------------------------
|
||||
|
||||
return Apache2::Const::OK;
|
||||
|
|
|
@ -75,6 +75,7 @@ sub ibuttons(){
|
|||
'set_workflow' => 'Workflow',
|
||||
'set_workflow2invoice' => 'Rechnung generieren',
|
||||
'set_workflow2storno' => 'Storno generieren',
|
||||
'set_accounting2invoice' => 'Rechnung generieren',
|
||||
'relate_content' => 'Content-Menu Relation',
|
||||
'relate_dialog' => 'Relation herstellen',
|
||||
'relate_dialog4menu' => 'Relation herstellen',
|
||||
|
|
|
@ -62,7 +62,7 @@ sub dbconnect_extern {
|
|||
my $conf = Config::General->new($globalconf_file);
|
||||
my %globalconf = $conf->getall;
|
||||
|
||||
$bw->log("dbconnect_extern call with instance_type:$instance_type and copri_instance:",$dbname,"");
|
||||
#$bw->log("dbconnect_extern call with instance_type:$instance_type and copri_instance:",$dbname,"");
|
||||
|
||||
#keep in mind, only one DB can be returned by this way
|
||||
#while (my ($key, $value) = each %{ $self->{$instance_type} }) {
|
||||
|
@ -91,7 +91,7 @@ sub get_operator_conf {
|
|||
|
||||
while (my ($key, $operator) = each %{ $globalconf{operator} }) {
|
||||
if($oprefix && $oprefix eq $operator->{oprefix}){
|
||||
$bw->log("get operator conf by oprefix: $oprefix",$operator->{oprefix},"");
|
||||
#$bw->log("get operator conf by oprefix: $oprefix",$operator->{oprefix},"");
|
||||
return $operator;
|
||||
}
|
||||
}
|
||||
|
@ -1437,7 +1437,7 @@ sub insert_contenttrans(){
|
|||
my $owner = shift || 0;
|
||||
|
||||
$owner="199" if(!$owner);
|
||||
my $sth = $dbh->prepare("INSERT INTO contenttrans (ct_name,txt00,int10,int03,txt02,txt01,txt03,txt06,txt07,txt08,txt09,txt15,txt17,txt18,txt19,owner,itime) VALUES('$invoice_nr','Rechnung','$ctadr->{c_id}','$ctadr->{int03}','$ctadr->{txt02}','$ctadr->{txt01}','$ctadr->{txt03}','$ctadr->{txt06}','$ctadr->{txt07}','$ctadr->{txt08}','$ctadr->{txt09}','$ctadr->{txt15}','$ctadr->{txt17}','$ctadr->{txt18}','$ctadr->{txt19}','$owner','now()') RETURNING c_id");
|
||||
my $sth = $dbh->prepare("INSERT INTO contenttrans (ct_name,txt00,int10,txt02,txt01,txt03,txt06,txt07,txt08,txt09,txt15,txt17,txt18,txt19,owner,itime) VALUES('$invoice_nr','Rechnung','$ctadr->{c_id}','$ctadr->{txt02}','$ctadr->{txt01}','$ctadr->{txt03}','$ctadr->{txt06}','$ctadr->{txt07}','$ctadr->{txt08}','$ctadr->{txt09}','$ctadr->{txt15}','$ctadr->{txt17}','$ctadr->{txt18}','$ctadr->{txt19}','$owner','now()') RETURNING c_id");
|
||||
|
||||
my $rows = $sth->execute();
|
||||
my $last_id;
|
||||
|
|
|
@ -21,7 +21,7 @@ use Apache2::Const -compile => qw(OK );
|
|||
use Scalar::Util qw(looks_like_number);
|
||||
use JSON;
|
||||
use LWP::UserAgent;
|
||||
|
||||
use Time::Piece;
|
||||
use Lib::Config;
|
||||
use Mod::DBtank;
|
||||
use Mod::APIfunc;
|
||||
|
@ -103,9 +103,9 @@ sub station_information {
|
|||
#$gbfs_station{$station}{is_charging_station} = 1 if(grep(/300102/, @{$response_stations->{shareejson}->{stations}->{$station}->{station_group}}));#E-L
|
||||
push (@gbfs_stations, $gbfs_station{$station});
|
||||
}
|
||||
|
||||
my $last_updated = time();
|
||||
$gbfs_resp = {
|
||||
"last_updated" => 1653031183,
|
||||
"last_updated" => $last_updated,
|
||||
"ttl" => 10,
|
||||
"version" => "2.2",
|
||||
"data" => {
|
||||
|
@ -160,8 +160,9 @@ sub vehicle_status {
|
|||
#"pricing_plan_id":"plan3"
|
||||
#}
|
||||
|
||||
my $last_updated = time();
|
||||
$gbfs_resp = {
|
||||
"last_updated" => 1653031183,
|
||||
"last_updated" => $last_updated,
|
||||
"ttl" => 0,
|
||||
"version" => "3.0",
|
||||
"data" => {
|
||||
|
|
|
@ -375,6 +375,8 @@ sub handler {
|
|||
$db->update_users4trans($R::c_id4trans,$R::tpl_id4trans,"",$users_dms->{u_id}) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans));
|
||||
if($R::ct_trans =~ /set_workflow2invoice|set_workflow2storno/){
|
||||
$return = $pl->set_workflow($users_dms,$R::c_id4trans,$R::set_main_id4workflow) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans) && looks_like_number($R::set_main_id4workflow));
|
||||
}elsif($R::ct_trans =~ /set_accounting2invoice/){
|
||||
$return = $pl->set_accounting2invoice($users_dms,$R::c_id4trans,$R::set_main_id4workflow) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans) && looks_like_number($R::set_main_id4workflow));
|
||||
}elsif($R::detail_search && $R::detail_search eq "operator_accounting"){
|
||||
my $ck4ex = "@R::ck4ex" || "";
|
||||
$return = $pl->operator_accounting($users_dms,$users_sharee,$R::accounting_type,$ck4ex);
|
||||
|
|
|
@ -509,7 +509,6 @@ sub rpc {
|
|||
$update_ctt->{ct_name} = $ctt->{ct_name} if($ctt->{ct_name});
|
||||
|
||||
if($txidval && $ctt->{c_id} && $ctadr->{c_id}){
|
||||
$update_ctt->{int03} = $ctadr->{int03};
|
||||
$update_ctt->{int17} = $useridval if($useridval);
|
||||
$update_ctt->{txt16} = $txidval;
|
||||
$update_ctt->{txt22} = $ctt->{payone_reset} if($ctt->{payone_reset});
|
||||
|
|
|
@ -406,7 +406,7 @@ sub set_workflow {
|
|||
#position copy
|
||||
if($c_idnew > 0){
|
||||
my ($cttpos,$rows) = $db->collect_contentpos("contenttrans",$c_id);
|
||||
foreach my $id (sort { lc($cttpos->{$a}->{sort}) cmp lc($cttpos->{$b}->{sort}) } keys(%$cttpos)){
|
||||
foreach my $id (sort { $cttpos->{$a}->{c_id} <=> $cttpos->{$b}->{c_id} } keys(%$cttpos)){
|
||||
#reverse pos sum for example by Storno
|
||||
$cttpos->{$id}->{int01} = $cttpos->{$id}->{int01} * -1 if($cttpos->{$id}->{int01} != 0);
|
||||
$cttpos->{$id}->{int05} = $cttpos->{$id}->{c_id};# set source pos id if sub doc
|
||||
|
@ -436,6 +436,69 @@ sub set_workflow {
|
|||
exit 0;
|
||||
}#end set_workflow
|
||||
|
||||
|
||||
#generate invoice from operator accounting
|
||||
sub set_accounting2invoice {
|
||||
my $self = shift;
|
||||
my $users_dms = shift;
|
||||
my $c_id = shift;
|
||||
my $set_main_id = shift || "";
|
||||
my %varenv = $cf->envonline();
|
||||
my $dbh = "";
|
||||
my $node = $dbt->get_node($dbh,$set_main_id);
|
||||
|
||||
my $pref = {
|
||||
table => "contenttrans",
|
||||
fetch => "one",
|
||||
c_id => $c_id,
|
||||
};
|
||||
|
||||
my $ctt = { c_id => 0 };
|
||||
$ctt = $dbt->fetch_tablerecord($dbh,$pref);
|
||||
|
||||
#barcode setting logic reset. keep barcode from orignal for backlinking
|
||||
#counter invoice subnr
|
||||
if($ctt->{ct_name} =~ /\d+-\d+/){
|
||||
my ($ct_name,$subname) = split(/-/,$ctt->{ct_name});
|
||||
$subname++;
|
||||
$ctt->{ct_name} = "$ct_name-$subname";
|
||||
}else{
|
||||
$ctt->{ct_name} = "$ctt->{ct_name}-1";
|
||||
}
|
||||
delete $ctt->{c_id};
|
||||
delete $ctt->{txt00};
|
||||
delete $ctt->{state};
|
||||
delete $ctt->{itime};
|
||||
delete $ctt->{mtime};
|
||||
delete $ctt->{close_time};
|
||||
delete $ctt->{invoice_time};
|
||||
delete $ctt->{pay_time};
|
||||
|
||||
my $insert_ctt = {
|
||||
%$ctt,
|
||||
table => "contenttrans",
|
||||
itime => 'now()',
|
||||
mtime => 'now()',
|
||||
owner => "$users_dms->{u_id}",
|
||||
ct_name => "$ctt->{ct_name}",
|
||||
txt00 => "$node->{node_name}",
|
||||
template_id => "218",
|
||||
main_id => "$node->{main_id}",
|
||||
};
|
||||
my $c_idnew = 0;
|
||||
$c_idnew = $dbt->insert_contentoid($dbh,$insert_ctt,"");
|
||||
$i_rows = 1 if($c_idnew);
|
||||
#taking just same (operator_accounting) invoices detected by int10=2
|
||||
|
||||
$db->update_users4trans($c_idnew,"218","",$users_dms->{u_id});
|
||||
|
||||
my $uri_path = $dbt->recurse_node($dbh,$node->{main_id});
|
||||
print "$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows\n";
|
||||
print redirect("$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows");
|
||||
exit 0;
|
||||
|
||||
}#end set_accounting2invoice
|
||||
|
||||
#new node relation with option to create subnode for Servicelog
|
||||
sub new_relation {
|
||||
my $self = shift;
|
||||
|
@ -857,11 +920,18 @@ sub operator_accounting {
|
|||
mtime => "now()",
|
||||
owner => $users_dms->{u_id},
|
||||
};
|
||||
$update_ctt->{int21} = $ctuser->{int01} if($ctuser->{int01});
|
||||
$update_ctt->{int22} = $ctuser->{int02} if($ctuser->{int02});
|
||||
$update_ctt->{int23} = $ctuser->{int03} if($ctuser->{int03});
|
||||
$update_ctt->{int24} = $ctuser->{int04} if($ctuser->{int04});
|
||||
$update_ctt->{int25} = $ctuser->{int05} if($ctuser->{int05});
|
||||
|
||||
my $tplop = $dbt->get_tpl($dbh,"196");#Operator-Faktura
|
||||
my @tplop_order = split /,/,$tplop->{tpl_order};
|
||||
foreach(@tplop_order){
|
||||
my ($key,$val,$size,$unit) = split /=/,$_;
|
||||
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;
|
||||
$update_ctt->{$ctt_key} = $ctuser->{$key} if($ctuser->{$key});
|
||||
}
|
||||
}
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
|
||||
my $pref = {
|
||||
|
|
|
@ -598,9 +598,16 @@ sub preinit(){
|
|||
if($R::set_state eq "buchen" && $R::sum_paid){
|
||||
$sum_paid = $R::sum_paid;
|
||||
$sum_paid =~ s/,/\./;
|
||||
$update_ctt->{int01} = $sum_paid;
|
||||
}
|
||||
|
||||
my $sum_operatorcredit = "null";
|
||||
if($R::set_state eq "buchen" && $R::sum_operatorcredit){
|
||||
$sum_operatorcredit = $R::sum_operatorcredit;
|
||||
$sum_operatorcredit =~ s/,/\./;
|
||||
$update_ctt->{int02} = $sum_operatorcredit;
|
||||
}
|
||||
|
||||
$update_ctt->{int01} = "$sum_paid";
|
||||
$update_ctt->{state} = "$state";
|
||||
$update_ctt->{int14} = 2 if($state =~ /payone/);#set OPOS
|
||||
$u_rows += $dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
|
|
|
@ -411,6 +411,7 @@ sub co2calc {
|
|||
}
|
||||
|
||||
#calculates sprit saving
|
||||
#disabled
|
||||
sub sprit2calc {
|
||||
my $self = shift;
|
||||
my $ctpos = shift;
|
||||
|
@ -434,6 +435,7 @@ sub sprit2calc {
|
|||
$sprit_price = sprintf('%.2f',$sprit_price);
|
||||
$sprit_price =~ s/\./,/;
|
||||
|
||||
$sprit_price = "";
|
||||
return $sprit_price;
|
||||
}
|
||||
|
||||
|
@ -478,16 +480,22 @@ sub operator_accounting2calc {
|
|||
my $varenv = shift;
|
||||
my $ctpos = shift;#client invoices
|
||||
my $ctf = shift;#Operator-Faktura config
|
||||
my $tplf = shift;#Operator-Faktura template
|
||||
|
||||
my $tplf = $dbt->get_tpl($dbh,"196");#Operator-Faktura
|
||||
my @tplf_order = split /,/,$tplf->{tpl_order};
|
||||
|
||||
#returned values
|
||||
my $oac = {
|
||||
int01 => 0,
|
||||
int02 => 0,
|
||||
int91 => 0,
|
||||
int92 => 0,
|
||||
int93 => 0,
|
||||
int94 => 0,
|
||||
int95 => 0,
|
||||
int96 => 0,
|
||||
int97 => 0,
|
||||
int98 => 0,
|
||||
int99 => 0,
|
||||
int100 => 0,
|
||||
};
|
||||
|
||||
|
||||
|
@ -496,16 +504,26 @@ sub operator_accounting2calc {
|
|||
if($key =~ /int/){
|
||||
$oac->{int01} = $oac->{int01} + $ctpos->{int01} if($key eq "int01" && $ctpos->{int01});#invoice capture
|
||||
if($ctpos->{state} =~ /Lastschrift/){
|
||||
$oac->{int91} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int01");#7,5%
|
||||
$oac->{int92} = $ctf->{$key} * -1 if($key eq "int04");#Trans
|
||||
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int02");#Disagio
|
||||
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int01");#7,5%
|
||||
$oac->{int98} = $oac->{int93} * 0.19 if($oac->{int93});#UmSt auf 7,5%
|
||||
$oac->{int94} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int02");#Disagio %
|
||||
$oac->{int99} = $oac->{int94} * 0.19 if($varenv->{dbname} eq "sharee_sx" && $oac->{int94});#UmSt TeilRad Disagio
|
||||
$oac->{int95} = $ctf->{$key} * -1 if($key eq "int04");#Trans
|
||||
$oac->{int96} = $ctf->{$key} * -1 if($key eq "int06");#Zahlungsmeldung
|
||||
$oac->{int97} = 0;
|
||||
}
|
||||
if($ctpos->{state} =~ /Kreditkarte/){
|
||||
$oac->{int91} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int01");#7,5%
|
||||
$oac->{int92} = $ctf->{$key} * -1 if($key eq "int05");#Trans
|
||||
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int03");#Disagio
|
||||
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int01");#7,5%
|
||||
$oac->{int98} = $oac->{int93} * 0.19 if($oac->{int93});#UmSt auf 7,5%
|
||||
$oac->{int94} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int03");#Disagio %
|
||||
$oac->{int99} = $oac->{int94} * 0.19 if($varenv->{dbname} eq "sharee_sx" && $oac->{int94});#UmSt TeilRad Disagio
|
||||
$oac->{int95} = $ctf->{$key} * -1 if($key eq "int05");#Trans
|
||||
$oac->{int96} = $ctf->{$key} * -1 if($key eq "int06");#Zahlungsmeldung
|
||||
$oac->{int97} = $ctf->{$key} * -1 if($key eq "int07");#CC Zuordnung
|
||||
}
|
||||
$oac->{int02} = $oac->{int01} + $oac->{int91} + $oac->{int92} + $oac->{int93};#operator accounting
|
||||
#operator accounting
|
||||
$oac->{int02} = $oac->{int01} + $oac->{int93} + $oac->{int98} + $oac->{int94} + $oac->{int99} + $oac->{int95} + $oac->{int96} + $oac->{int97};
|
||||
$oac->{int100} = ($oac->{int93} + $oac->{int98} + $oac->{int94} + $oac->{int99}) * -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ use DateTime::Format::Pg;
|
|||
use Scalar::Util qw(looks_like_number);
|
||||
use Lib::Config;
|
||||
use Mod::Libenz;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
use Mod::Pricing;
|
||||
use Data::Dumper;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -32,7 +32,6 @@ sub printpre(){
|
|||
my $q = new CGI;
|
||||
my $cf = new Config;
|
||||
my $lb = new Libenz;
|
||||
my $db = new Libenzdb;
|
||||
my $dbt = new DBtank;
|
||||
my $pri = new Pricing;
|
||||
|
||||
|
@ -42,6 +41,7 @@ sub printpre(){
|
|||
my $user_agent = $q->user_agent();
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $lang="de";
|
||||
my $dbh = "";
|
||||
|
||||
my $printer_id=$R::printer_id;
|
||||
my $u_id=$R::u_id;
|
||||
|
@ -49,13 +49,12 @@ sub printpre(){
|
|||
my $mandant_main_id=$R::mandant_main_id;
|
||||
my $main_id=$R::main_id;
|
||||
my $ct_name2print=$R::ct_name2print;
|
||||
my $wc= $1 if($R::wc =~ /(\d+\.\d+)/);
|
||||
my $node = $db->get_node4multi($R::main_id,$lang);
|
||||
|
||||
my $debug = 0;#print line to doc if debug
|
||||
|
||||
print $q->start_html(-title=>'',
|
||||
-base=>'true',
|
||||
-target=>'Printpre'
|
||||
-target=>'Printpre',
|
||||
-title=>"$R::ct_name2print"
|
||||
);
|
||||
|
||||
my $width="1400px";
|
||||
|
@ -77,7 +76,9 @@ body,html {
|
|||
margin:0.5em 0;
|
||||
}
|
||||
th {
|
||||
font-size:0.91em;
|
||||
border-bottom: solid thin gray;
|
||||
border-right: solid thin gray;
|
||||
}
|
||||
td {
|
||||
border:0px;
|
||||
|
@ -147,127 +148,181 @@ td {
|
|||
//--></style>";
|
||||
}
|
||||
|
||||
my $users = $db->select_users($u_id);
|
||||
my $ctf = $db->get_content1("contentuser","$mandant_main_id");
|
||||
$ctf->{txt13} = $1 if($ctf->{txt13} =~ /(\d+)/);
|
||||
|
||||
my $ctt = $db->get_content1("contenttrans",$c_id);
|
||||
|
||||
my $ctt_users = $db->get_owner($ctt->{owner});
|
||||
my $vendor = $ctt_users->{u_name};#Login-ID
|
||||
$vendor = $ctt->{txt13} if($ctt->{txt13});#full Name
|
||||
my $kd_nr = " Kunden Nr.: $ctt->{int10}";
|
||||
my $mandat_nr;
|
||||
$mandat_nr = " Mandatsreferenz: $ctt->{txt26}" if($ctt->{txt26} =~ /PO-/);
|
||||
|
||||
my $invoice_time = $ctt->{invoice_time} || $ctt->{mtime};
|
||||
my $mtime = $lb->time4de("$invoice_time","");
|
||||
|
||||
$db->updater("contenttrans","c_id",$ctt->{c_id},"invoice_time","$invoice_time","");
|
||||
|
||||
#my $scol = "c_id";
|
||||
my $scol = "itime";
|
||||
my $i=0;
|
||||
my $tplf = $db->get_tpl("201");#Firma tpl
|
||||
my $tplf = $dbt->get_tpl($dbh,201);#Kunden-Faktura alias Firma tpl
|
||||
my @tplf_order = split /,/,$tplf->{tpl_order};
|
||||
my $logo = "$ctf->{img01}" || "";
|
||||
|
||||
#logging siteformat
|
||||
open(PMA, ">> $varenv{logdir}/Printpreview.log");
|
||||
print PMA "$now_dt --> $ct_name2print\n";
|
||||
print PMA "\n-->$now_dt --> $varenv{dbname}-$ct_name2print\n";
|
||||
|
||||
my $site=1;
|
||||
my $site_all=1;
|
||||
my ($address_wc,$table_wc) = split(/\./,$wc);
|
||||
$wc = $address_wc + $table_wc;
|
||||
print PMA "wc: $wc = $address_wc + $table_wc\n";
|
||||
print PMA "wc: $wc\n";
|
||||
my $max_site_wc = "40";
|
||||
|
||||
my $header_top = 0;
|
||||
my $footer_px = 1780;
|
||||
my $footer_top = $footer_px;#end 1.site
|
||||
|
||||
my $sum_paid = 0;
|
||||
my $exit_table_wc = 0;
|
||||
my $nullcount = 0;
|
||||
my $cttpos = { c_id => 0 };
|
||||
my $max_table_wc = "10";
|
||||
print PMA "max_site_wc: $max_site_wc | max_table_wc: $max_table_wc\n";
|
||||
my $break_table_wc = 0;
|
||||
|
||||
my $ctf = { c_id => 0 };
|
||||
my $pref_cu = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => $mandant_main_id,
|
||||
};
|
||||
$ctf = $dbt->fetch_tablerecord($dbh,$pref_cu) if($mandant_main_id);
|
||||
|
||||
my $h_top = "0";
|
||||
my $footer_top = "1820";#ende der 1.seite
|
||||
print PMA "top: $h_top | $footer_top\n";
|
||||
my $ctt = { c_id => 0 };
|
||||
my $pref_ctt = {
|
||||
table => "contenttrans",
|
||||
fetch => "one",
|
||||
c_id => $c_id,
|
||||
};
|
||||
$ctt = $dbt->fetch_record($dbh,$pref_ctt) if($c_id);
|
||||
|
||||
#1.seite
|
||||
&header_big("0",$mandant_main_id,$c_id,$logo);
|
||||
&data_invoice("0",$vendor,$kd_nr,$mandat_nr,$ctt->{txt00},$ct_name2print,$mtime);
|
||||
|
||||
my ($sum_paid,$break_table_wc,$nullcount) = &data_table("0",$c_id,$scol,"",$mandant_main_id,"0",$max_table_wc,$ctt);
|
||||
|
||||
#print "$site_all++ if(($wc > $max_site_wc) || ($table_wc > $max_table_wc)) --> $break_table_wc";
|
||||
#$site_all++ if(($wc > $max_site_wc) || ($table_wc > $max_table_wc));
|
||||
if($break_table_wc > $max_table_wc){
|
||||
$site_all++;
|
||||
print PMA "max_site_wc: $max_site_wc | max_table_wc: $max_table_wc\n";
|
||||
print PMA "site_all: $site_all if($break_table_wc > $max_table_wc)\n";
|
||||
}
|
||||
|
||||
print PMA "$site_all,$footer_top,$site,$site_all,$wc\n";
|
||||
if($site_all == 1){
|
||||
&text_description("0",$mandant_main_id,$ctt->{txt21},$ctt->{txt12},$ctt->{txt00},$nullcount);
|
||||
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc);
|
||||
}else{
|
||||
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc);
|
||||
}
|
||||
|
||||
#2.seite
|
||||
if($site_all > 1){
|
||||
#Alles horizontal absolut zum obersten Punkt ausrichten
|
||||
$h_top = $footer_top + 220;# second header top, depence from footer_top
|
||||
&header_small($h_top,$mandant_main_id,$logo);
|
||||
$h_top +=250;
|
||||
&data_invoice($h_top,$vendor,$kd_nr,$mandat_nr,$ctt->{txt00},$ct_name2print,$mtime);
|
||||
$h_top +=60;
|
||||
#table_break
|
||||
if($break_table_wc >= $max_table_wc){
|
||||
my ($sum_paid,$exit_table_wc,$nullcount) = &data_table($h_top,$c_id,$scol,"",$mandant_main_id,$break_table_wc,$max_table_wc,$ctt,$sum_paid);
|
||||
$h_top += ($table_wc - $max_table_wc) * 65;
|
||||
print PMA "h_top: $h_top += ($table_wc - $max_table_wc) * 65\n";
|
||||
#pre-count position rows
|
||||
if($ctt->{int10} && $ctt->{int10} == 2){
|
||||
$max_table_wc = "41";
|
||||
#take original operator accounting c_id to collect related invoices
|
||||
if($ctt->{template_id} != 208){#not equal Abrechnung
|
||||
my $pref = {
|
||||
table => "contenttrans",
|
||||
fetch => "one",
|
||||
barcode => $ctt->{barcode},
|
||||
txt00 => "Abrechnung",
|
||||
};
|
||||
my $ctt_accounting = $dbt->fetch_record($dbh,$pref);
|
||||
($cttpos,$break_table_wc) = $dbt->collect_contenttrans($dbh,$ctt_accounting->{content_id});
|
||||
}else{
|
||||
($cttpos,$break_table_wc) = $dbt->collect_contenttrans($dbh,$ctt->{c_id});
|
||||
}
|
||||
|
||||
#print "$h_top | $table_wc | $break_table_wc >= $max_table_wc";
|
||||
&text_description($h_top,$mandant_main_id,$ctt->{txt21},$ctt->{txt12},$ctt->{txt00},$nullcount);
|
||||
$footer_top +=100;
|
||||
$site++;
|
||||
print PMA "$site_all,$footer_top,$site,$site_all,$wc\n";
|
||||
&text_footer($mandant_main_id,$footer_top,$site,$site_all,$wc);
|
||||
}else{
|
||||
$max_table_wc = "10";
|
||||
($cttpos,$break_table_wc) = $dbt->collect_contentpos("contenttrans",$ctt->{c_id});
|
||||
}
|
||||
##########
|
||||
#
|
||||
print PMA "break_table_wc: $break_table_wc > max_table_wc:$max_table_wc\n";
|
||||
|
||||
if($break_table_wc > $max_table_wc){
|
||||
$site_all = $break_table_wc / $max_table_wc;
|
||||
$site_all += 1 if($site_all =~ /\d\.\d/);
|
||||
$site_all = sprintf('%.1d',$site_all);
|
||||
print PMA "2) site_all: $site_all if($break_table_wc > $max_table_wc)\n";
|
||||
}
|
||||
|
||||
if(1==1){
|
||||
for($site=1; $site <= $site_all; $site++){
|
||||
#1.site
|
||||
if($site == 1){
|
||||
print PMA "1.$site) header_big header_top: $header_top | $site\n";
|
||||
&header_big(\%varenv,$ctf,$ctt,$header_top);
|
||||
&data_invoice(\%varenv,$ctt,$ct_name2print,$header_top);
|
||||
|
||||
#operator invoices int02=2 Operator-Faktura else position accounting
|
||||
if($ctt->{int10} && $ctt->{int10} == 2){
|
||||
my $ctf_operator = { c_id => 0 };
|
||||
my $pref_cuop = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => 2,
|
||||
};
|
||||
$ctf_operator = $dbt->fetch_tablerecord($dbh,$pref_cuop);
|
||||
|
||||
($break_table_wc,$nullcount) = &accounting_data_table(\%varenv,$ctf_operator,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
|
||||
}else{
|
||||
($sum_paid,$break_table_wc,$nullcount) = &data_table(\%varenv,$ctf,$ctt,$cttpos,$sum_paid,$break_table_wc,$max_table_wc,$header_top);
|
||||
}
|
||||
|
||||
&text_description(\%varenv,$ctf,$ctt,$nullcount,0);
|
||||
print PMA "1.$site) text_footer: footer_top: $footer_top | $site/$site_all\n";
|
||||
&text_footer(\%varenv,$ctf,$ctt,$footer_top,$site,$site_all);
|
||||
}
|
||||
# > 2.site
|
||||
else{
|
||||
my $header_px = 2000;
|
||||
$header_top = $header_px;#2. site
|
||||
|
||||
$header_top = $header_px * ($site -1);
|
||||
$footer_top = $footer_px * $site + ($header_px - $footer_px -10);
|
||||
$footer_top = $footer_px * $site + ($site * (0.65 * ($header_px - $footer_px))) if($site > 2);
|
||||
|
||||
print PMA "2.$site) text_footer footer_top: $footer_top | $site/$site_all\n";
|
||||
&text_footer(\%varenv,$ctf,$ctt,$footer_top,$site,$site_all);
|
||||
|
||||
print PMA "2.$site) header_small header_top: $header_top | $site/$site_all\n";
|
||||
&header_small(\%varenv,$ctf,$header_top);
|
||||
|
||||
$header_top = $header_top + 250;
|
||||
&data_invoice(\%varenv,$ctt,$ct_name2print,$header_top);
|
||||
|
||||
#table_break
|
||||
$break_table_wc -= $max_table_wc;
|
||||
print PMA "2.$site) break_table_wc: $break_table_wc > max_table_wc:$max_table_wc\n";
|
||||
$header_top +=60;
|
||||
#operator invoices int02=2 Operator-Faktura else position accounting
|
||||
if($ctt->{int10} && $ctt->{int10} == 2){
|
||||
my $ctf_operator = { c_id => 0 };
|
||||
my $pref_cuop = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => 2,
|
||||
};
|
||||
$ctf_operator = $dbt->fetch_tablerecord($dbh,$pref_cuop);
|
||||
|
||||
($exit_table_wc,$nullcount) = &accounting_data_table(\%varenv,$ctf_operator,$ctt,$cttpos,$break_table_wc,$max_table_wc,$header_top);
|
||||
}else{
|
||||
(my $sum_paidxxx,$exit_table_wc,$nullcount) = &data_table(\%varenv,$ctf,$ctt,$cttpos,$sum_paid,$break_table_wc,$max_table_wc,$header_top);
|
||||
}
|
||||
}#end > 2.site
|
||||
}
|
||||
}
|
||||
|
||||
close PMA;
|
||||
|
||||
#Briefkopf
|
||||
#header_small
|
||||
sub header_small(){
|
||||
my ($h_top,$mandant_main_id,$logo) = @_;
|
||||
my $position;
|
||||
my $h_toppx = "$h_top" . "px";
|
||||
$position = "position:absolute; top: $h_toppx;" if($h_top);
|
||||
my $varenv = shift;
|
||||
my $ctf = shift;
|
||||
my $header_top = shift || 0;
|
||||
|
||||
my $position = "";
|
||||
my $header_toppx = "$header_top" . "px";
|
||||
$position = "position:absolute; top: $header_toppx;" if($header_top);
|
||||
my $line = "";
|
||||
$line = $header_top if($debug);
|
||||
|
||||
my $height = "120px;";
|
||||
my $margin = "0 0 100px 0;";
|
||||
if($dbt->{operator}->{$varenv{dbname}}->{project} =~ /Bayern|Freiburg/){
|
||||
if($dbt->{operator}->{$varenv->{dbname}}->{project} =~ /Bayern|Freiburg/){
|
||||
$height = "200px;";
|
||||
$margin = "0;";
|
||||
}
|
||||
print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:$margin"},$q->img({-src=>"$varenv{metahost}/img/$logo",-height=>"$height"})),"\n";
|
||||
}
|
||||
print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:$margin"},"$line",$q->img({-src=>"$varenv->{metahost}/img/$ctf->{img01}",-height=>"$height"})),"\n";
|
||||
}#end header_small
|
||||
|
||||
#Briefkopf + Adresse
|
||||
#header_big
|
||||
sub header_big(){
|
||||
my ($h_top,$mandant_main_id,$c_id,$logo) = @_;
|
||||
$ctf = $db->get_content1("contentuser","$mandant_main_id");
|
||||
my $ctt = $db->get_content1("contenttrans",$c_id);
|
||||
my $varenv = shift;
|
||||
my $ctf = shift;
|
||||
my $ctt = shift;
|
||||
my $header_top = shift || 0;
|
||||
|
||||
$ctt->{txt01} = $lb->newline($ctt->{txt01},"","0");
|
||||
my $line = "";
|
||||
$line = $header_top if($debug);
|
||||
|
||||
my $height = "120px;";
|
||||
my $margin = "0 0 100px 0;";
|
||||
if($dbt->{operator}->{$varenv{dbname}}->{project} =~ /Bayern|Freiburg/){
|
||||
if($dbt->{operator}->{$varenv->{dbname}}->{project} =~ /Bayern|Freiburg/){
|
||||
$height = "200px;";
|
||||
$margin = "0;";
|
||||
}
|
||||
print $q->div({-style=>"width:$width;text-align:right;border:0px solid black;margin:$margin"},$q->img({-src=>"$varenv{metahost}/img/$logo",-height=>"$height"})),"\n";
|
||||
|
||||
print $q->div({-style=>"width:$width;text-align:right;border:0px solid black;margin:$margin"},$q->img({-src=>"$varenv->{metahost}/img/$ctf->{img01}",-height=>"$height"})),"\n";
|
||||
|
||||
print $q->start_table({-width=>'100%',-border=>'0',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
|
||||
print "<tr>\n";
|
||||
|
@ -312,45 +367,268 @@ td {
|
|||
|
||||
print "</tr>";
|
||||
print $q->end_table;
|
||||
}
|
||||
#end Adresse
|
||||
}#end header_big
|
||||
|
||||
#head line
|
||||
sub data_invoice(){
|
||||
my ($h_top,$vendor,$kd_nr,$mandat_nr,$node_name,$ct_name2print,$mtime) = @_;
|
||||
my $position;
|
||||
my $h_toppx = "$h_top" . "px";
|
||||
$position = "position:absolute; top: $h_toppx;" if($h_top);
|
||||
$node_name =~ s/steuerfrei//;
|
||||
my $varenv = shift;
|
||||
my $ctt = shift;
|
||||
my $ct_name2print = shift;
|
||||
my $header_top = shift || 0;
|
||||
my $line = "";
|
||||
$line = $header_top if($debug);
|
||||
|
||||
my $praefix = "$varenv{praefix}";
|
||||
my $kd_nr = " Kunden Nr. $ctt->{int10}" if($ctt->{txt00} ne "Abrechnung");
|
||||
my $mandat_nr = "";
|
||||
$mandat_nr = " Mandatsreferenz: $ctt->{txt26}" if($ctt->{txt26} =~ /\w{2}-/);
|
||||
|
||||
my $invoice_time = $ctt->{invoice_time} || $ctt->{mtime};
|
||||
my $update_ctt = {
|
||||
table => "contenttrans",
|
||||
pay_time => "$invoice_time",
|
||||
};
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
my $mtime = $lb->time4de("$invoice_time","");
|
||||
|
||||
my $position = "";
|
||||
my $header_toppx = "$header_top" . "px";
|
||||
$position = "position:absolute; top: $header_toppx;" if($header_top);
|
||||
|
||||
print $q->div({-style=>"width:$width;$position border: 0px solid black;"},
|
||||
$q->span({-style=>'font-size:1.5em;margin:0.5em 0 0.5em 0.5em;'},"$node_name"),
|
||||
$q->span({-style=>'font-size:1em;margin:0.5em 0.5em 0.5em 0;'},"Nr.: $praefix-$ct_name2print"),
|
||||
$q->span({-style=>'font-size:1.5em;margin:0.5em 0 0.5em 0.5em;'},"$line","$ctt->{txt00}"),
|
||||
$q->span({-style=>'font-size:1em;margin:0.5em 0.5em 0.5em 0;'},"Nr. $varenv->{dbname}-$ct_name2print"),
|
||||
$q->span({-style=>'float:right;text-align:right;font-size:1em;margin:0.5em 0 0.5em 0;'},"Datum: $mtime "),
|
||||
$q->span({-style=>'font-size:1em;margin:0.5em;'}," $kd_nr"),
|
||||
$q->span({-style=>'font-size:1em;margin:0.5em;'}," $mandat_nr"),
|
||||
#$q->span({-style=>'font-size:1.1em;margin:0.5em;'},$q->img({-src=>"$varenv{metahost}/pdf/barcode-$ctt->{ct_name}.jpeg", -height=>'60px;'})),
|
||||
);
|
||||
}
|
||||
|
||||
#operator accounting invoice
|
||||
sub accounting_data_table {
|
||||
my $varenv = shift;
|
||||
my $ctf = shift;
|
||||
my $ctt = shift;
|
||||
my $cttpos = shift;
|
||||
my $break_table_wc = shift || 0;
|
||||
my $max_table_wc = shift || 0;
|
||||
my $header_top = shift || 0;
|
||||
my @tpl_order = ();
|
||||
|
||||
#int9x are not in db
|
||||
if($ctt->{txt00} eq "Rechnung"){
|
||||
@tpl_order = ("c_id=ID","int01=Summe Einzug","state=Zahlungsart","int93=TeilRad Gebühren","int98=TeilRad Gebühren 19%","int100=Summe");
|
||||
if($varenv->{dbname} eq "sharee_sx"){
|
||||
@tpl_order = ("c_id=ID","int01=Summe Einzug","state=Zahlungsart","int93=TeilRad Gebühren","int98=TeilRad Gebühren 19%","int94=TeilRad Disagio","int99=TeilRad Disagio 19%","int100=Summe");
|
||||
}
|
||||
}
|
||||
#default to Abrechnung
|
||||
else{
|
||||
@tpl_order = ("c_id=ID","int01=Summe Einzug","state=Zahlungsart","int93=TeilRad Gebühren","int98=TeilRad Gebühren 19%","int94=payone Disagio","int95=payone Transaktion","int96=payone Zahlungs-meldung","int97=payone Kreditkarte Zuordnung","int02=Summe Gutschrift");
|
||||
if($varenv->{dbname} eq "sharee_sx"){
|
||||
@tpl_order = ("c_id=ID","int01=Summe Einzug","state=Zahlungsart","int93=TeilRad Gebühren","int98=TeilRad Gebühren 19%","int94=TeilRad Disagio","int99=TeilRad Disagio 19%","int02=Summe Gutschrift");
|
||||
}
|
||||
}
|
||||
|
||||
my $sum_operatorcredit=0;
|
||||
my $diff19 = 100 + 19;
|
||||
my $sum_umst19=0;
|
||||
my $i=0;
|
||||
my $j=0;
|
||||
my $rows = 0;
|
||||
|
||||
my $header_toppx = "$header_top" . "px";
|
||||
my $position = "";;
|
||||
$position = "position:absolute; top: $header_toppx;" if($header_top);
|
||||
my $line = "";
|
||||
$line = $header_top if($debug);
|
||||
print "\n<div style='width:$width;$position border:0px solid black;'>\n";
|
||||
print $q->start_table({ -border=>'0', -width=>"$width",-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
|
||||
|
||||
my $tc=0;
|
||||
print $q->Tr();
|
||||
#print $q->th("$line Pos."),"\n";
|
||||
foreach (@tpl_order){
|
||||
my ($key,$val) = split /=/,$_;
|
||||
$tc++;
|
||||
$val = "$line $val" if($key eq "c_id");
|
||||
print $q->th({-class=>'tdint'},"$val");
|
||||
}
|
||||
|
||||
foreach my $id (sort { $cttpos->{$b}->{c_id} <=> $cttpos->{$a}->{c_id} } keys(%$cttpos)){
|
||||
#print Dumper($cttpos->{$id}); exit;
|
||||
my $oac = { c_id => 0 };
|
||||
$oac = $pri->operator_accounting2calc($varenv,$cttpos->{$id},$ctf);
|
||||
$oac->{int01} = sprintf('%.2f', $oac->{int01});
|
||||
|
||||
$j++;
|
||||
#if($j<=$max_table_wc || $break_table_wc)
|
||||
if($j<=$max_table_wc){
|
||||
$now_dt =~ s/[-:\s]//g;
|
||||
open(CSV, ">> $varenv->{pdf}/$ctt->{txt00}-$ctt->{c_id}-$now_dt.csv") or die "Can't opencsv\n";
|
||||
|
||||
$i++;
|
||||
print $q->Tr(),"\n";
|
||||
#print $q->td({-class=>'tdint'},"$i"),"\n";
|
||||
|
||||
foreach (@tpl_order){
|
||||
my ($key,$val) = split /=/,$_;
|
||||
$cttpos->{$id}->{$key} = $q->unescapeHTML($cttpos->{$id}->{$key});
|
||||
my $txtstyle = "text-align:left;min-width:100px;";
|
||||
if($key =~ /int\d+/){
|
||||
$txtstyle = "text-align:right;min-width:50px;";
|
||||
}
|
||||
|
||||
if(1==1){
|
||||
if($key =~ /ct_name/){
|
||||
print CSV "$cttpos->{$id}->{$key};";
|
||||
#print $q->td({-class=>'tdtxt'},"\# $cttpos->{$id}->{$key} $cttpos->{$id}->{txt01}"),"\n";
|
||||
print $q->td({-class=>'tdtxt'},"\# $cttpos->{$id}->{$key}"),"\n";
|
||||
}
|
||||
elsif($key =~ /c_id/){
|
||||
print CSV "$cttpos->{$id}->{$key};";
|
||||
if($debug){
|
||||
print $q->td({-class=>'tdint',-nowrap=>1},"$i) $cttpos->{$id}->{$key}"),"\n";
|
||||
}else{
|
||||
print $q->td({-class=>'tdint',-nowrap=>1},"$cttpos->{$id}->{$key}"),"\n";
|
||||
}
|
||||
}
|
||||
elsif($key =~ /int/){
|
||||
$oac->{$key} =~ s/\./,/;
|
||||
if($key eq "int02"){
|
||||
print CSV "$oac->{$key}\n";
|
||||
}else{
|
||||
print CSV "$oac->{$key};";
|
||||
}
|
||||
print $q->td({-class=>'tdint',-nowrap=>1},"$oac->{$key} €"),"\n";
|
||||
}
|
||||
elsif($key =~ /state/){
|
||||
$cttpos->{$id}->{$key} =~ s/ \(payone\)//;
|
||||
print CSV "$cttpos->{$id}->{$key};";
|
||||
print $q->td({-class=>'tdint',-nowrap=>1},"$cttpos->{$id}->{$key}"),"\n";
|
||||
}
|
||||
elsif($key =~ /txt/){
|
||||
print CSV "$cttpos->{$id}->{$key};";
|
||||
print $q->td({-class=>'tdtxt'},"$cttpos->{$id}->{$key}"),"\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
delete $cttpos->{$id};
|
||||
close CSV;
|
||||
}
|
||||
}
|
||||
|
||||
#Sum Endrechnung
|
||||
if($break_table_wc > 0 && $break_table_wc <= $max_table_wc){
|
||||
|
||||
my $sum_parts19 = $ctt->{int01} || 0;
|
||||
if($sum_parts19 && $sum_parts19 != 0){
|
||||
$sum_umst19 = $sum_parts19 / $diff19 * 19;
|
||||
$sum_umst19 = $pri->round($sum_umst19);
|
||||
}
|
||||
my $sum_netto19 = $sum_parts19 - $sum_umst19;
|
||||
$sum_netto19 = sprintf('%.2f', $sum_netto19);
|
||||
$sum_netto19 =~ s/\./,/;
|
||||
|
||||
my $sum_paid = $sum_parts19;
|
||||
$sum_paid = $pri->round($sum_paid);
|
||||
$sum_paid = sprintf('%.2f', $sum_paid);
|
||||
$sum_paid =~ s/\./,/;
|
||||
|
||||
$sum_parts19 = sprintf('%.2f', $sum_parts19);
|
||||
$sum_umst19 = sprintf('%.2f', $sum_umst19);
|
||||
$sum_umst19 =~ s/\./,/;
|
||||
|
||||
my $sum_operatorcredit = $ctt->{int02} || 0;
|
||||
$sum_operatorcredit = $pri->round($sum_operatorcredit);
|
||||
$sum_operatorcredit = sprintf('%.2f', $sum_operatorcredit);
|
||||
$sum_operatorcredit =~ s/\./,/;
|
||||
|
||||
print $q->Tr(),"\n";
|
||||
print $q->td({-class=>'Oline',-colspan=>$tc}," "),"\n";
|
||||
|
||||
my $cs = $tc - 3;
|
||||
my $payment_text = "";
|
||||
foreach(@tplf_order){
|
||||
my ($key,$des,$size) = split /=/,$_;
|
||||
if($key =~ /txt5\d/){
|
||||
$ctf->{$key} = $q->unescapeHTML("$ctf->{$key}");
|
||||
$ctf->{$key} = $lb->newline($ctf->{$key},"","");
|
||||
$ctt->{state} =~ s/\(payone.*//;
|
||||
if($des =~ /$ctt->{state}/){
|
||||
if($sum_parts19 < 0){
|
||||
$payment_text = "$ctf->{txt58}";
|
||||
}else{
|
||||
$payment_text = "$ctf->{$key}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print "<tr>\n";
|
||||
print "<td colspan='$cs' style='border:0px solid silver;vertical-align:top;padding:0.2em 0.5em;font-size:0.91em;'>$payment_text</td>\n";
|
||||
|
||||
###print sum
|
||||
print "<td colspan='3' style='font-size:1em;'>\n";
|
||||
print $q->start_table({-style=>'border:1px solid silver;', -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
|
||||
|
||||
#Summe Betreiber Rechnung
|
||||
if($ctt->{template_id} != 208){#not equal Abrechnung
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdint',-colspan=>2},"Nettobetrag");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_netto19 €");
|
||||
|
||||
if($sum_netto19 != 0){
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdint',-colspan=>2,-nowrap=>"1"},"19% UmSt auf $sum_netto19 €");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_umst19 €");
|
||||
}
|
||||
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdsum',-colspan=>2},"Summe $ctt->{state}");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_paid €");
|
||||
}
|
||||
#Summe Betreiber Abrechnung (Gutschrift)
|
||||
else{
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdsum',-colspan=>2},"Summe $ctt->{state}");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_operatorcredit €");
|
||||
}
|
||||
|
||||
print $q->end_table,"\n";
|
||||
print "</td>\n";
|
||||
###print sum end
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print $q->end_table,"\n";
|
||||
print "</div>\n";
|
||||
return ($j,$nullcount);
|
||||
}#end sub accounting_data_table
|
||||
|
||||
#client invoice
|
||||
sub data_table(){
|
||||
my ($h_top,$c_id,$scol,$ctt_dummy,$mandant_main_id,$break_table_wc,$max_table_wc,$ctt,$sum_break) = @_;
|
||||
$ctf = $db->get_content1("contentuser","$mandant_main_id");
|
||||
#my $umst1619 = $lb->umst_breaking($ctt,"");
|
||||
|
||||
|
||||
my $varenv = shift;
|
||||
my $ctf = shift;
|
||||
my $ctt = shift;
|
||||
my $cttpos = shift;
|
||||
my $sum_break = shift || 0;
|
||||
my $break_table_wc = shift || 0;
|
||||
my $max_table_wc = shift || 0;
|
||||
my $header_top = shift || 0;
|
||||
|
||||
my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int03=Menge (Std:Min)","int02=Preis","int07=Rabatt","int04=Gesamt");
|
||||
my ($cttpos,$rows) = $db->collect_contentpos("contenttrans",$c_id);
|
||||
#my ($cttpos,$rows) = $dbt->collect_contentpos("contenttrans",$ctt->{c_id});
|
||||
foreach my $id (keys(%$cttpos)){
|
||||
if($cttpos->{$id}->{int26}){
|
||||
@tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int26=Einsparung","int03=Menge (Std:Min)","int02=Preis","int07=Rabatt","int04=Gesamt");
|
||||
}
|
||||
}
|
||||
|
||||
my $h_toppx = "$h_top" . "px";
|
||||
my $header_toppx = "$header_top" . "px";
|
||||
my $position;
|
||||
$position = "position:absolute; top: $h_toppx;" if($h_top);
|
||||
$position = "position:absolute; top: $header_toppx;" if($header_top);
|
||||
my $line = "";
|
||||
$line = $header_top if($debug);
|
||||
|
||||
print "\n<div style='width:$width;$position border:0px solid black;'>\n";
|
||||
print $q->start_table({ -border=>'0', -width=>"$width",-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
|
||||
|
@ -361,27 +639,12 @@ td {
|
|||
foreach (@tpl_order){
|
||||
my ($key,$val) = split /=/,$_;
|
||||
$h++ if($val && $key !~ /int07/);
|
||||
print $q->th({-class=>'tdint'},"$val"),"\n" if("$key" eq "ct_name");
|
||||
print $q->th({-class=>'tdint'},"$line $val"),"\n" if("$key" eq "ct_name");
|
||||
print $q->th({-class=>'tdtxt2'},"$val"),"\n" if($key =~ /txt01/);
|
||||
print $q->th({-class=>'tdint'},"$val"),"\n" if($key =~ /int02|int03|int04|int26/);
|
||||
}
|
||||
$h--;
|
||||
|
||||
#Übertrag Zwischensumme
|
||||
#if($break_table_wc){
|
||||
# print "<tr>\n";
|
||||
# print "<td colspan='2'></td>\n";
|
||||
# print "<td colspan='3' style='font-size:1em;'>\n";
|
||||
# print $q->start_table({-style=>'border:1px solid silver;', -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
|
||||
#
|
||||
# print $q->Tr("\n");
|
||||
# print $q->td({-class=>'tdsum',-colspan=>"$h"},"<b>Übertrag:</b>");
|
||||
# print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_break €<b/>");
|
||||
# print $q->end_table,"\n";
|
||||
# print "</td>\n";
|
||||
# print "</tr>\n";
|
||||
#}
|
||||
|
||||
#Tablecontent (ct_name(primary key))
|
||||
my $sum_parts19=0;
|
||||
my $diff19 = 100 + 19;
|
||||
|
@ -389,9 +652,8 @@ td {
|
|||
my $j=0;
|
||||
my $k=0;
|
||||
my $nullcount=0;
|
||||
#foreach my $id (sort { $cttpos->{$a}->{$scol} <=> $cttpos->{$b}->{$scol} } keys(%$cttpos)){
|
||||
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+)/);
|
||||
|
||||
foreach my $id (sort { $cttpos->{$b}->{c_id} <=> $cttpos->{$a}->{c_id} } keys(%$cttpos)){
|
||||
|
||||
my $gesamt = 0;
|
||||
my $rabatt = "";
|
||||
|
@ -400,8 +662,8 @@ td {
|
|||
my $rental_feed = {};
|
||||
|
||||
if($cttpos->{$id}->{int35} && $cttpos->{$id}->{start_time} && $cttpos->{$id}->{end_time}){
|
||||
($pricing,$counting) = $pri->counting_rental(\%varenv,$cttpos->{$id},"calc_price");
|
||||
$rental_feed = $pri->fetch_rentalfeed(\%varenv,$cttpos->{$id},$counting);
|
||||
($pricing,$counting) = $pri->counting_rental($varenv,$cttpos->{$id},"calc_price");
|
||||
$rental_feed = $pri->fetch_rentalfeed($varenv,$cttpos->{$id},$counting);
|
||||
$rabatt = $pricing->{discount};
|
||||
$sum_parts19 += $pricing->{total_price};
|
||||
$gesamt = $pri->round($pricing->{total_price});
|
||||
|
@ -469,9 +731,9 @@ td {
|
|||
if($cttpos->{$id}->{int26}){
|
||||
$co2saving = "Einsparung</br>";
|
||||
my $co2diff = $pri->co2calc($cttpos->{$id});
|
||||
my $sprit_price = $pri->sprit2calc($cttpos->{$id});
|
||||
#my $sprit_price = $pri->sprit2calc($cttpos->{$id});
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price !~ /-/);
|
||||
#$co2saving .= "$sprit_price EUR<br />" if($sprit_price !~ /-/);
|
||||
$cttpos->{$id}->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
|
||||
}
|
||||
|
@ -552,8 +814,8 @@ td {
|
|||
$sum_umst19 =~ s/\./,/;
|
||||
|
||||
|
||||
print $q->Tr(),"\n";
|
||||
print $q->td({-class=>'Oline',-colspan=>6}," "),"\n";
|
||||
print $q->Tr(),"\n";
|
||||
print $q->td({-class=>'Oline',-colspan=>6}," "),"\n";
|
||||
|
||||
print "<tr>\n";
|
||||
print "<td colspan='3' style='border:0px solid silver;vertical-align:top;padding:0.2em 0.5em;font-size:0.91em;'>$payment_text</td>\n";
|
||||
|
@ -576,13 +838,8 @@ td {
|
|||
print $q->td({-class=>'tdint',-nowrap=>"1"},"19% UmSt auf $sum_netto19 €:"),"\n";
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_umst19 €"),"\n";
|
||||
}
|
||||
|
||||
#Zwischensumme
|
||||
#}else{
|
||||
# print $q->Tr(),"\n";
|
||||
# print $q->td({-class=>'tdsum',-colspan=>"$h"},"<b>Zwischensumme:</b>"),"\n";
|
||||
# print $q->td({-class=>'tdint',-nowrap=>"1"},"<b>$sum_paid €</b>"),"\n";
|
||||
}
|
||||
|
||||
print $q->end_table,"\n";
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
@ -590,17 +847,23 @@ td {
|
|||
print $q->end_table,"\n";
|
||||
print "</div>\n";
|
||||
return ("$sum_paid","$j","$nullcount");
|
||||
}
|
||||
}#end sub data_table
|
||||
|
||||
#Beschreibungs-Text
|
||||
sub text_description(){
|
||||
my ($h_top,$mandant_main_id,$ctt_txt21,$ctt_txt12,$node_name,$nullcount) = @_;
|
||||
my $ctf = $db->get_content1("contentuser","$mandant_main_id");
|
||||
my $position;
|
||||
my $h_toppx = "$h_top" . "px";
|
||||
$position = "position:absolute; top: $h_toppx;" if($h_top);
|
||||
my $varenv = shift;
|
||||
my $ctf = shift;
|
||||
my $ctt = shift;
|
||||
my $nullcount = shift || 0;
|
||||
my $header_top = shift || 0;
|
||||
|
||||
print "\n<div style='width:$width;$position border:0px solid black;'>\n";
|
||||
my $position = "";
|
||||
my $header_toppx = "$header_top" . "px";
|
||||
$position = "position:absolute; top: $header_toppx;" if($header_top);
|
||||
my $line = "";
|
||||
$line = $header_top if($debug);
|
||||
|
||||
print "\n<div style='width:$width;$position border:0px solid black;'>$line\n";
|
||||
print $q->start_table({-style=>"margin-top:0.5em;", -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'0', -cellspacing=>'0'});
|
||||
|
||||
#Frei-Text
|
||||
|
@ -610,11 +873,11 @@ td {
|
|||
print $q->td({-style=>"$style",-colspan=>3},"In diesem Zeitraum gab es $nullcount kostenfreie Buchungsvorgänge.");
|
||||
}
|
||||
|
||||
if($ctt_txt12){
|
||||
$ctt_txt12 = $q->unescapeHTML("$ctt_txt12");
|
||||
$ctt_txt12 = $lb->newline($ctt_txt12,"","");
|
||||
if($ctt->{txt12}){
|
||||
$ctt->{txt12} = $q->unescapeHTML("$ctt->{txt12}");
|
||||
$ctt->{txt12} = $lb->newline($ctt->{txt12},"","");
|
||||
print $q->Tr();
|
||||
print $q->td({-style=>"$style",-colspan=>3},"$ctt_txt12");
|
||||
print $q->td({-style=>"$style",-colspan=>3},"$ctt->{txt12}");
|
||||
}
|
||||
#Text & Vorbelegungen
|
||||
print $q->Tr();
|
||||
|
@ -625,10 +888,9 @@ td {
|
|||
$ctf->{$key} = $q->unescapeHTML("$ctf->{$key}");
|
||||
$ctf->{$key} = $lb->newline($ctf->{$key},"","");
|
||||
my @rechnungstext = split(/\<br \/\>/,$ctf->{$key});
|
||||
if($ctt_txt21 =~ /$key/){
|
||||
if($ctt->{txt21} =~ /$key/){
|
||||
foreach(@rechnungstext){
|
||||
$style = "padding:0.4em;text-align:left;font-size:1em;";
|
||||
$style = "padding:0.4em;text-align:left;font-size:1em;" if($_ =~ s/\<b\>// && $node_name ne "Rückgabe");
|
||||
print $q->Tr();
|
||||
print $q->td({-style=>"$style",-colspan=>3},"$_");
|
||||
}
|
||||
|
@ -638,29 +900,53 @@ td {
|
|||
|
||||
print $q->end_table;
|
||||
print "</div>\n";
|
||||
}
|
||||
}#end text_description
|
||||
|
||||
|
||||
#site footer
|
||||
sub text_footer(){
|
||||
my ($mandant_main_id,$top,$site,$site_all,$wc) = @_;
|
||||
my $ctf = $db->get_content1("contentuser","$mandant_main_id");
|
||||
$ctf->{txt01} = $q->unescapeHTML("$ctf->{txt01}");
|
||||
my $varenv = shift;
|
||||
my $ctf = shift;
|
||||
my $ctt = shift;
|
||||
my $footer_top = shift || 0;
|
||||
my $site = shift || 1;
|
||||
my $site_all = shift || 1;
|
||||
|
||||
my @txt11 = split (/;/,"$ctf->{txt11}");#Tel usw.
|
||||
my @txt12 = split (/;/,"$ctf->{txt12}");#Geschäftsführer
|
||||
my @txt19 = split (/;/,"$ctf->{txt19}");#Bank usw.
|
||||
|
||||
$top *= $site;
|
||||
my $top2 = $top + 120;
|
||||
$top .= "px";
|
||||
my $top2 = $footer_top + 120;
|
||||
$footer_top .= "px";
|
||||
$top2 .= "px";
|
||||
my $zeilen;
|
||||
#$zeilen = "Top: $top , Zeilen: $wc , " if($wc);
|
||||
print PMA "sub text_footer --> footer_top: $footer_top | top2: $top2\n";
|
||||
my $line = "";
|
||||
$line = $footer_top if($debug);
|
||||
|
||||
#if($logo =~ /empty/){
|
||||
# print $q->div({-style=>"min-width:1799px;position:absolute;top:$top;"},"");
|
||||
#if($ctf->{img01} =~ /empty/){
|
||||
# print $q->div({-style=>"min-width:1799px;position:absolute;top:$footer_top;"},"");
|
||||
#}else{
|
||||
|
||||
print "<div style='border:0px solid black;background-color:white;height:150px;width:$width;position:absolute;top:$top;'>";
|
||||
print "<div style='border:0px solid black;background-color:white;height:150px;width:$width;position:absolute;top:$footer_top;'>$line\n";
|
||||
if($ctt->{txt00} eq "Abrechnung"){
|
||||
my $tplop = $dbt->get_tpl($dbh,"196");#Operator-Faktura
|
||||
my @tplop_order = split /,/,$tplop->{tpl_order};
|
||||
foreach(@tplop_order){
|
||||
my ($key,$val,$size,$unit) = split /=/,$_;
|
||||
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;
|
||||
if($ctt->{$ctt_key}){
|
||||
$ctt->{$ctt_key} =~ s/\./,/;
|
||||
print $q->span({-style=>'padding:0.2em;text-align:center;font-size:0.81em;'},"$val $ctt->{$ctt_key} $unit | "),"\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
print "<br />\n";
|
||||
print "<br />\n";
|
||||
}
|
||||
|
||||
print $q->start_table({-width=>'100%',-border=>'0',-align=>'center', -cellpadding=>'2', -cellspacing=>'0'});
|
||||
print "<tr>";
|
||||
|
||||
|
@ -735,8 +1021,7 @@ td {
|
|||
#end Adresse
|
||||
#}
|
||||
my $debug = "";
|
||||
#$debug = "(address_wc:$address_wc + table_wc:$table_wc) site_all:$site_all++ | break_table_wc:$break_table_wc if((wc:$wc > max_site_wc:$max_site_wc) || (table_wc:$table_wc > max_table_wc:$max_table_wc)) ... (sum_paid:$sum_paid,break_table_wc:$break_table_wc) = &data_table" if($ctt->{owner} eq "101");
|
||||
print $q->div({-style=>"text-align:right;width:$width;position:absolute;top:$top2;font-size:0.61em;"},"$debug $zeilen Seite: $site/$site_all");
|
||||
print $q->div({-style=>"text-align:right;width:$width;position:absolute;top:$top2;font-size:0.61em;"},"$debug Seite: $site/$site_all");
|
||||
}
|
||||
|
||||
print $q->end_html;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue