adding sum_total and owner into invoive mailing. calc freed_time fix

This commit is contained in:
ragu 2023-09-07 19:04:02 +02:00
parent 76fe0eb26a
commit 8cc46ff9e0
4 changed files with 24 additions and 13 deletions

View file

@ -205,16 +205,7 @@ sub preinit(){
};
$ctt = $dbt->fetch_tablerecord($dbh,$pref_ctt);
}
my $ctadr = { c_id => 0 };
if(looks_like_number($ctt->{int10})){
my $pref_adr = {
table => "contentadr",
fetch => "one",
c_id => $ctt->{int10},
};
$ctadr = $dbt->fetch_tablerecord($dbh,$pref_adr);
}
my $ctadr = { c_id => $ctt->{int10} };
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct,"",$ctadr,"","","","0",$users_dms->{u_id},"");
$i_rows += 1 if($pos_id > 0);

View file

@ -64,7 +64,7 @@ sub count_freedrental {
open(FILE,">>$varenv->{logdir}/count_freedrental.log") if($debug);
print FILE "\n*-->$today4db $varenv->{dbname}\n" if($debug);
print FILE Dumper($q) if($debug);
print FILE "--> c_id:$pos->{c_id} rental_minute_all: $pricing->{rentalog}->{rental_minute_all} > 0\n" if($debug);
print FILE "--> pos.c_id:$pos->{c_id}, user:$pos->{ca_id}, bike:$pos->{ct_name} rental_minute_all: $pricing->{rentalog}->{rental_minute_all} > 0\n" if($debug);
#freed mangement will be only dony on accountable rental
if($pricing->{rentalog}->{rental_minute_all} > 0){
@ -88,7 +88,8 @@ sub count_freedrental {
my ($nyear,$nmon,$nday) = Add_Delta_YMD($year,$mon,$day, 0,0,1);
$pref_pos->{time_range} = "((start_time >= '$year-$mon-$day' and start_time < '$nyear-$nmon-$nday' and start_time != end_time) OR int10=3)";
}
my $record_pos = $dbt->fetch_tablerecord($dbh,$pref_pos);
my $record_pos = { c_id => 0 };
$record_pos = $dbt->fetch_tablerecord($dbh,$pref_pos);
foreach my $pid (sort { $record_pos->{$a}->{c_id} <=> $record_pos->{$b}->{c_id} } keys (%$record_pos)){
$freed_count++;
print FILE "if($freed_count > 1 && $pos->{c_id} != $record_pos->{$pid}->{c_id})\n" if($debug);