mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 15:16:38 +02:00
operator faktura config
This commit is contained in:
parent
819592a77d
commit
ae4ff98d9b
16 changed files with 186 additions and 260 deletions
|
@ -1120,6 +1120,7 @@ sub collect_transpos {
|
|||
$search->{offset} = 0 if(!$search->{offset});
|
||||
|
||||
my $where = "where cp.ct_id=ct.c_id";
|
||||
$where .= " and cp.int05 is null";#do not select sub workflow docs like storno
|
||||
foreach my $key (keys (%$search)){
|
||||
$search->{$key} =~ s/^\s//g;
|
||||
$search->{$key} =~ s/\s$//g;
|
||||
|
@ -1443,7 +1444,9 @@ sub insert_contenttrans(){
|
|||
$sth->bind_columns(\$last_id);
|
||||
my $c_id = $sth->fetchrow_array();
|
||||
|
||||
my $sth3 = $dbh->prepare("INSERT INTO relation (ca_id,main_id,content_id,template_id,change) VALUES('$ctadr->{c_id}','$main_id','$c_id','$tpl_id','now()')");
|
||||
my $foreign_key = "ca_id";
|
||||
$foreign_key = "cu_id" if($ctadr->{c_id} == 2);#operator-faktura config
|
||||
my $sth3 = $dbh->prepare("INSERT INTO relation ($foreign_key,main_id,content_id,template_id,change) VALUES('$ctadr->{c_id}','$main_id','$c_id','$tpl_id','now()')");
|
||||
$sth3->execute();
|
||||
return $c_id;
|
||||
}
|
||||
|
|
|
@ -185,15 +185,15 @@ EOF
|
|||
my $pre = "";
|
||||
$kind_of_trans = "Transaktions" if(!$kind_of_trans);
|
||||
my $feedb = "";
|
||||
$feedb = "neue $pre Daten eingefuegt" if($i_pm);
|
||||
$feedb = "neue $pre Daten eingefügt" if($i_pm);
|
||||
$feedb = "insert successfully " if($i_pm && $varenv{html_lang} eq "en");
|
||||
$feedb = "$pre Daten gespeichert" if($s_pm);
|
||||
$feedb = "saved successfully" if($s_pm && $varenv{html_lang} eq "en");
|
||||
$feedb = "$pre Daten geloescht" if($d_pm);
|
||||
$feedb = "$pre Daten gelöscht" if($d_pm);
|
||||
$feedb = "deleted successfully" if($d_pm && $varenv{html_lang} eq "en");
|
||||
$feedb = "neue $kind_of_trans Daten eingefuegt" if($i_pl);
|
||||
$feedb = "neue $kind_of_trans Daten eingefügt" if($i_pl);
|
||||
$feedb = "$kind_of_trans Daten gespeichert" if($s_pl);
|
||||
$feedb = "$kind_of_trans Daten geloescht" if($d_pl);
|
||||
$feedb = "$kind_of_trans Daten gelöscht" if($d_pl);
|
||||
$feedb = "Artikel eingefügt" if($i_pl =~ /ctpos_id=\d+/);
|
||||
my $debug;
|
||||
$debug = "($ret_pm|$ret_pl)" if($owner eq "101");
|
||||
|
|
|
@ -1304,7 +1304,6 @@ sub search_jsonadr(){
|
|||
my $dbh = $dbt->dbconnect();#because of ajax external handle request
|
||||
my $template_id=200;#$table eq content
|
||||
$template_id=202 if($table eq "contentadr");
|
||||
$template_id=203 if($table eq "contentuser");
|
||||
|
||||
my $mjkey;
|
||||
$mjkey = $1 if($retype =~ /combobox_(txt\d+)/);
|
||||
|
|
|
@ -121,7 +121,7 @@ sub admin_tpl(){
|
|||
print $q->hidden(-name=>'owner', -value=>"$users_dms->{u_id}");
|
||||
print $q->hidden(-name=>'parent_id', -value=>"$node_meta->{parent_id}");
|
||||
print $q->hidden(-name=>'main_id', -value=>"$node_meta->{main_id}");
|
||||
print $q->hidden(-name=>'template_id', -value=>"$node_meta->{template_id}");
|
||||
#print $q->hidden(-name=>'template_id', -value=>"$node_meta->{template_id}");
|
||||
print $q->hidden(-name=>'mode', -value=>"admin");
|
||||
|
||||
print $q->start_table({-style=>'margin-top:6px;', -border=>'0', -width=>'100%', -align=>'left', -cellpadding=>'3', -cellspacing=>'3'});
|
||||
|
|
|
@ -409,9 +409,8 @@ sub set_workflow {
|
|||
foreach my $id (sort { lc($cttpos->{$a}->{sort}) cmp lc($cttpos->{$b}->{sort}) } keys(%$cttpos)){
|
||||
#reverse pos sum for example by Storno
|
||||
$cttpos->{$id}->{int01} = $cttpos->{$id}->{int01} * -1 if($cttpos->{$id}->{int01} != 0);
|
||||
$cttpos->{$id}->{txt23} = "Storno" if($cttpos->{$id}->{int01} == -1);
|
||||
#$cttpos->{$id}->{int02} = $cttpos->{$id}->{int02} * -1 if($cttpos->{$id}->{int02} != 0);
|
||||
#$cttpos->{$id}->{int07} = $cttpos->{$id}->{int07} * -1 if($cttpos->{$id}->{int07} != 0 && $cttpos->{$id}->{int08} == 1);#if Rabatt int08 != 1 alias €;
|
||||
$cttpos->{$id}->{int05} = $cttpos->{$id}->{c_id};# set source pos id if sub doc
|
||||
$cttpos->{$id}->{txt23} = "workflow doc" if($cttpos->{$id}->{int01} == -1);
|
||||
|
||||
delete $cttpos->{$id}->{c_id};
|
||||
delete $cttpos->{$id}->{ct_id};
|
||||
|
@ -827,7 +826,6 @@ sub operator_accounting {
|
|||
|
||||
print FILE "Invoice c_id's ck4ex: $ck4ex\n";
|
||||
|
||||
close FILE;
|
||||
|
||||
my $accounting_main_id = 300029;
|
||||
my $node_faktura = $dbt->get_node($dbh,$dbt->{shareedms_conf}->{faktura});
|
||||
|
@ -835,13 +833,21 @@ sub operator_accounting {
|
|||
|
||||
my $praefix = "$node->{node_name}-$varenv{praefix}";
|
||||
my $ret = "";
|
||||
my $auth = $users_sharee;#workaround, must be operator addr.
|
||||
my $c_idnew = "";
|
||||
|
||||
if($ck4ex){
|
||||
$c_idnew = $dbt->insert_contenttrans($dbh,$auth,$accounting_main_id,"208","----",$users_dms->{u_id});
|
||||
|
||||
my $opuser = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => 2,
|
||||
};
|
||||
my $ctuser = $dbt->fetch_tablerecord($dbh,$opuser);
|
||||
|
||||
$c_idnew = $dbt->insert_contenttrans($dbh,$ctuser,$accounting_main_id,"208","----",$users_dms->{u_id});
|
||||
|
||||
if($c_idnew){
|
||||
print FILE "c_idnew: $c_idnew\n";
|
||||
$i_rows++;
|
||||
my $ctt = { c_id => $c_idnew };
|
||||
my $update_ctt = {
|
||||
|
@ -851,6 +857,11 @@ 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});
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
|
||||
my $pref = {
|
||||
|
@ -865,6 +876,7 @@ sub operator_accounting {
|
|||
|
||||
$ck4ex =~ s/\s/,/g;
|
||||
$dbt->update_sql($dbh,"UPDATE contenttrans set int20='$ctt->{c_id}' where c_id IN ($ck4ex)");
|
||||
print FILE "UPDATE contenttrans set int20='$ctt->{c_id}' where c_id IN ($ck4ex)\n";
|
||||
|
||||
|
||||
if(1==2){#should only be done on buchen
|
||||
|
@ -902,6 +914,8 @@ sub operator_accounting {
|
|||
}else{
|
||||
$ret = "failure::Abbruch, es wurden keine Belege selektiert.";
|
||||
}
|
||||
|
||||
close FILE;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -472,5 +472,45 @@ sub price2calc {
|
|||
return ($total,$discount);
|
||||
}
|
||||
|
||||
#computes operator invoices for accounting
|
||||
sub operator_accounting2calc {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $ctpos = shift;#client invoices
|
||||
my $ctf = shift;#Operator-Faktura config
|
||||
my $tplf = shift;#Operator-Faktura template
|
||||
my @tplf_order = split /,/,$tplf->{tpl_order};
|
||||
|
||||
#returned values
|
||||
my $oac = {
|
||||
int01 => 0,
|
||||
int02 => 0,
|
||||
int91 => 0,
|
||||
int92 => 0,
|
||||
int93 => 0,
|
||||
};
|
||||
|
||||
|
||||
foreach(@tplf_order){
|
||||
my ($key,$val,$size) = split /=/,$_;
|
||||
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
|
||||
}
|
||||
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->{int02} = $oac->{int01} + $oac->{int91} + $oac->{int92} + $oac->{int93};#operator accounting
|
||||
}
|
||||
}
|
||||
|
||||
return $oac;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue