mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-07-03 12:36:32 +02:00
adding fees by rental editor
This commit is contained in:
parent
876d1e6df2
commit
80f7e5efe2
13 changed files with 103 additions and 80 deletions
|
@ -1422,7 +1422,6 @@ sub booking_update(){
|
|||
$update_cc->{int14} = $1;
|
||||
#$self->service_automatic($q) if($1 <= 40);
|
||||
}
|
||||
$update_cc->{txt15} = $q->escapeHTML($q->param('firmware')) if($q->param('firmware'));
|
||||
$update_cc->{txt17} = $Ilockit_GUID if($Ilockit_GUID);
|
||||
}
|
||||
#end Ilockit || sigo
|
||||
|
@ -1451,6 +1450,7 @@ sub booking_update(){
|
|||
mtime => "now()",
|
||||
owner => "$owner",
|
||||
};
|
||||
$update_cc->{txt28} = $q->escapeHTML($q->param('firmware')) if($q->param('firmware'));
|
||||
|
||||
#only by system=Ilockit
|
||||
if($record_pos->{int11} eq "2" && $q->param('voltage') && $q->param('voltage') =~ /(\d+)/){
|
||||
|
@ -1469,6 +1469,7 @@ sub booking_update(){
|
|||
$update_pos->{txt21} = $q->escapeHTML($q->param('user_device')) if($q->param('user_device'));
|
||||
$update_pos->{txt26} = $q->escapeHTML($user_agent) if($user_agent);
|
||||
$update_pos->{txt27} = $q->escapeHTML($q->param('app_debug')) if($q->param('app_debug'));
|
||||
$update_pos->{txt28} = $q->escapeHTML($q->param('firmware')) if($q->param('firmware'));
|
||||
}
|
||||
|
||||
my $lock_value = 0;
|
||||
|
|
|
@ -921,7 +921,7 @@ sub update_record(){
|
|||
$set .= " $key=null,";#we need this for null values in operators loop
|
||||
}
|
||||
}
|
||||
if($key =~ /(mtime|atime)$/){
|
||||
if($key =~ /(mtime|atime|pay_time|invoice_time)$/){
|
||||
if($value && $value =~ /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/){
|
||||
$set .= " $key='$value',";
|
||||
}else{
|
||||
|
@ -1104,8 +1104,6 @@ sub collect_transpos {
|
|||
my $search = shift;
|
||||
|
||||
$search->{offset} = 0 if(!$search->{offset});
|
||||
my $updown = "ASC";
|
||||
$updown = "DESC" if($search->{cal_sort_updown} && $search->{cal_sort_updown} eq "down");
|
||||
|
||||
my $where = "where cp.ct_id=ct.c_id";
|
||||
foreach my $key (keys (%$search)){
|
||||
|
@ -1118,6 +1116,7 @@ sub collect_transpos {
|
|||
$where .= " and cp.ct_name = '$search->{$key}'" if($key eq "cp_ct_name" && $search->{$key});
|
||||
$where .= " and ct.ct_name = '$search->{$key}'" if($key eq "ct_ct_name" && $search->{$key});
|
||||
$where .= " and ct.txt06 ilike '$search->{$key}%'" if($key eq "ct_txt06" && $search->{$key});#PLZ
|
||||
$where .= " and cp.$key = '$search->{$key}'" if($key eq "ct_id" && looks_like_number($search->{$key}));
|
||||
$where .= " and cp.$key = $search->{$key}" if($key eq "int10" && looks_like_number($search->{$key}));#bike_state
|
||||
$where .= " and cp.$key = $search->{$key}" if($key eq "int20" && looks_like_number($search->{$key}));#lock_state
|
||||
$where .= " and cp.$key = $search->{$key}" if($key eq "barcode" && looks_like_number($search->{$key}));
|
||||
|
@ -1133,7 +1132,7 @@ sub collect_transpos {
|
|||
$where .= " and cp.start_time <= $search->{start_time_interval}";
|
||||
}
|
||||
|
||||
$where .= " ORDER BY cp.end_time $updown LIMIT $search->{limit} OFFSET $search->{offset}" if($search->{limit});
|
||||
$where .= " ORDER BY cp.c_id DESC LIMIT $search->{limit} OFFSET $search->{offset}" if($search->{limit});
|
||||
my $sql = "SELECT cp.*,ct.txt07 AS phone from $search->{table} cp, contenttrans ct $where";
|
||||
my $sth = $dbh->prepare($sql);
|
||||
my $rc = $sth->execute();
|
||||
|
@ -1149,8 +1148,6 @@ sub collect_theftpos {
|
|||
my $search = shift;
|
||||
|
||||
$search->{offset} = 0 if(!$search->{offset});
|
||||
my $updown = "ASC";
|
||||
$updown = "DESC" if($search->{cal_sort_updown} && $search->{cal_sort_updown} eq "down");
|
||||
|
||||
my $where = "where 1=1";
|
||||
foreach my $key (keys (%$search)){
|
||||
|
@ -1167,7 +1164,7 @@ sub collect_theftpos {
|
|||
$where .= " and cp.$key = $search->{$key}" if($key eq "int13" && looks_like_number($search->{$key}));#deviceId
|
||||
$where .= " and cp.$key = $search->{$key}" if($key eq "owner" && looks_like_number($search->{$key}));
|
||||
}
|
||||
$where .= " ORDER BY cp.end_time $updown LIMIT $search->{limit} OFFSET $search->{offset}" if($search->{limit});
|
||||
$where .= " ORDER BY cp.c_id DESC LIMIT $search->{limit} OFFSET $search->{offset}" if($search->{limit});
|
||||
my $sth = $dbh->prepare("SELECT cp.* from $search->{table} cp $where");
|
||||
my $rc = $sth->execute();
|
||||
my $ct = $sth->fetchall_hashref("c_id");
|
||||
|
|
|
@ -383,10 +383,17 @@ sub handler {
|
|||
$return = "failure::Abbruch. Schreibender Zugriff \"Faktura\" verweigert.";
|
||||
}
|
||||
}
|
||||
|
||||
#DMS Mietjournal
|
||||
if($node_meta->{ct_table} eq "contenttranspos" && $R::base_edit eq "save_pos"){
|
||||
$return = $pl->save_contenttranspos($R::c_id,$users_dms->{u_id});
|
||||
}
|
||||
|
||||
#DMS insert part or fee
|
||||
if($node_meta->{ct_table} eq "contenttranspos" && $R::insert_contenttranspos){
|
||||
$return = $pl->insert_contenttranspos($R::c_id,$R::ca_id,$R::ct_id,$users_dms->{u_id});
|
||||
}
|
||||
|
||||
$users_dms = $dbt->select_users($dbh,$users_dms->{u_id},"");#just to get update after save
|
||||
|
||||
#none DMS hosts ----------------------------------------------------
|
||||
|
|
|
@ -1314,7 +1314,7 @@ sub search_jsonadr(){
|
|||
$sth = $dbh->prepare("SELECT ct.c_id AS id ,ct.$mjkey AS name FROM $table ct, relation rel WHERE ct.c_id=rel.content_id and rel.template_id=$template_id and $sel");
|
||||
}else{
|
||||
my $sel = "txt01 ilike '%$search%'";
|
||||
$sth = $dbh->prepare("SELECT ct.txt01 || ' ,Nr. ' || ct.ct_name AS value, ct.txt01 AS vorname_name, ct.c_id FROM $table ct, relation rel WHERE ct.c_id=rel.content_id and rel.template_id=$template_id and $sel");
|
||||
$sth = $dbh->prepare("SELECT ct.txt01 || ', ' || ct.txt08 AS value, ct.txt01 AS vorname_name, ct.c_id FROM $table ct, relation rel WHERE ct.c_id=rel.content_id and rel.template_id=$template_id and $sel");
|
||||
}
|
||||
my $rc = $sth->execute();
|
||||
my $rows = $sth->rows;
|
||||
|
@ -1333,25 +1333,12 @@ sub search_json(){
|
|||
my $sel = "1=1";
|
||||
my $sel2;
|
||||
|
||||
#pre_lager select only
|
||||
if($mandant_id){
|
||||
my $lager_id = $mandant_id . "0";
|
||||
my $sth2 = $dbh->prepare("SELECT ct_name from contentuser where c_id='$lager_id'");
|
||||
my $rc = $sth2->execute();
|
||||
my $rel = $sth2->fetchrow_hashref();
|
||||
my $pre_lager = "$rel->{ct_name}" || "";
|
||||
$sel2 = " and (txt12 ilike '$pre_lager%' OR txt12 like '_')" if($pre_lager);
|
||||
}
|
||||
|
||||
if($ct_name =~ /^\d+$/ && $table eq "content"){
|
||||
$sel .= " and (ct_name ilike '$ct_name%' OR CAST(barcode AS text) like '$ct_name%')";
|
||||
}else{
|
||||
$sel .= " and ct_name ilike '$ct_name%'";
|
||||
}
|
||||
my $sth;
|
||||
#$sel .= " and rel.template_id IN ($tpl_ids)";
|
||||
#my $sth = $dbh->prepare("SELECT ct.ct_name || ' , Lager ' || ct.txt12 AS label, ct.ct_name AS value, ct.c_id FROM relation rel, content ct WHERE $sel");
|
||||
#my $sth = $dbh->prepare("SELECT ct.ct_name || ' , Lager ' || ct.txt12 AS label, ct.ct_name AS value, ct.c_id FROM content ct WHERE $sel");
|
||||
my $sth = "";
|
||||
|
||||
#If select only mandant specific warenstamm
|
||||
if($dbt->{shareedms_conf}->{waren}){
|
||||
|
@ -1363,13 +1350,6 @@ sub search_json(){
|
|||
my $rc = $sth->execute();
|
||||
my $rows = $sth->rows;
|
||||
|
||||
#if false lager (txt12) then global
|
||||
if(!$varenv{waren_main_id} && $rows < 1){
|
||||
$sth = $dbh->prepare("SELECT ct.ct_name || ' , Lager ' || ct.txt12 AS value, ct.ct_name AS spart_ct_name, ct.c_id FROM $table ct WHERE $sel");
|
||||
$rc = $sth->execute();
|
||||
$rows = $sth->rows;
|
||||
}
|
||||
|
||||
$dbh->disconnect;
|
||||
return $sth;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ sub preauthorizationSEPA_main {
|
|||
$reference = $dbt->{operator}->{$varenv->{dbname}}->{oprefix} . "-S-" . $ctt->{ct_name};
|
||||
}
|
||||
#if reference still set then count
|
||||
if($ctt->{txt25}){
|
||||
if($ctt->{txt25} && $ctt_rec->{payone_reset}){
|
||||
if($ctt->{txt25} =~ /\d-\d$/){
|
||||
my ($refbase,$sub) = split(/-/,$ctt->{txt25});
|
||||
$sub++;
|
||||
|
@ -279,7 +279,7 @@ sub preauthorizationCC_main {
|
|||
$reference = $dbt->{operator}->{$varenv->{dbname}}->{oprefix} . "-C-" . $ctt->{ct_name};
|
||||
}
|
||||
#if reference still set then count
|
||||
if($ctt->{txt25}){
|
||||
if($ctt->{txt25} && $ctt_rec->{payone_reset}){
|
||||
if($ctt->{txt25} =~ /\d-\d$/){
|
||||
my ($refbase,$sub) = split(/-/,$ctt->{txt25});
|
||||
$sub++;
|
||||
|
|
|
@ -52,6 +52,56 @@ my %varenv = $cf->envonline();
|
|||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $debug=1;
|
||||
|
||||
#part or fee to invoice
|
||||
sub insert_contenttranspos {
|
||||
my $self = shift;
|
||||
my $c_id = shift || "";#part
|
||||
my $ca_id = shift || "";#adr
|
||||
my $ct_id = shift || "";#invoice
|
||||
my $owner = shift || "";
|
||||
|
||||
my $dbh = "";
|
||||
my $feedb = { message => "" };
|
||||
|
||||
if(looks_like_number($c_id) && looks_like_number($ca_id) && looks_like_number($ct_id)){
|
||||
my $pref_cc = {
|
||||
table => "content",
|
||||
fetch => "one",
|
||||
template_id => "IN::(229)",
|
||||
c_id => $c_id,
|
||||
};
|
||||
|
||||
my $cc_part = { c_id => 0 };
|
||||
$cc_part = $dbt->fetch_record($dbh,$pref_cc);
|
||||
|
||||
my $pref_ca = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
template_id => "202",
|
||||
c_id => "$ca_id",
|
||||
};
|
||||
my $ctadr = { c_id => 0 };
|
||||
$ctadr = $dbt->fetch_record($dbh,$pref_ca);
|
||||
|
||||
my $pos_id = 0;
|
||||
if($cc_part->{int02}){
|
||||
$pos_id = $dbt->insert_pos($dbh,$ct_id,$cc_part,"",$ctadr,"","",$cc_part->{barcode},"0",$owner,"");
|
||||
}else{
|
||||
$feedb->{message} = "failure::Fehler, VK Preis von Artikel Nr. $cc_part->{barcode} nicht definiert.";
|
||||
}
|
||||
if($pos_id > 0){
|
||||
$i_rows += 1;
|
||||
$dbt->update_content4comp($dbh,$cc_part->{c_id},"-","1");
|
||||
$feedb->{message} = "Artikel Nr. $cc_part->{barcode} erfolgreich hinzugefügt.";
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Fehler, es fehlt mindestens ein Key! ($c_id && $ca_id && $ct_id)";
|
||||
}
|
||||
$feedb->{u_rows} = $u_rows;
|
||||
return $feedb;
|
||||
}#end insert_contenttranspos
|
||||
|
||||
|
||||
sub save_contenttranspos {
|
||||
my $self = shift;
|
||||
my $c_id = shift;
|
||||
|
@ -341,6 +391,7 @@ 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 €;
|
||||
|
||||
|
|
|
@ -199,6 +199,7 @@ sub preinit(){
|
|||
|
||||
|
||||
###ADD PARTS/DATE TO Transactions
|
||||
#FIXME, refactorit
|
||||
if((($ib_key =~ /add_transpos|add_transdate/) || ($R::select_part && ($R::spart_ct_name || $R::json_select))) && (!$ctt->{close_time})){
|
||||
$table = "contenttranspos";
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ sub handler {
|
|||
|
||||
print $q->header(-type => "application/json", -charset => "utf-8");
|
||||
|
||||
open(FILE,">>/var/log/copri4/ajax_json.log") if($debug);
|
||||
open(FILE,">>/var/log/copri-bike/ajax_json.log") if($debug);
|
||||
print FILE "$now_dt|$main_id\n" if($debug);
|
||||
|
||||
foreach(@keywords){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue