952 lines
41 KiB
Perl
952 lines
41 KiB
Perl
|
|
sub fixed_systems_update {
|
||
|
|
|
||
|
|
foreach (keys %i) {
|
||
|
|
local @abc = split("_",$_) ;
|
||
|
|
if (substr($_,0,14) eq 'online_status_') {
|
||
|
|
$seen_event_id{$abc[-2]} = 1 ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
local @event_ids = () ;
|
||
|
|
foreach (keys %seen_event_id) {
|
||
|
|
push @event_ids , "`id` = '$_'" ;
|
||
|
|
}
|
||
|
|
local $e_q_sql = join (" OR ",@event_ids) ;
|
||
|
|
|
||
|
|
if ($sss_side) {
|
||
|
|
$e_q_sql =~ s/\id/\sss_quote_nr/g ;
|
||
|
|
$e_q_sql .= qq~ AND ~ if $e_q_sql ;
|
||
|
|
$e_q_sql .= qq~sss_quote_nr <> '0'~ ;
|
||
|
|
}
|
||
|
|
|
||
|
|
&db_switch_conn('sss') ;
|
||
|
|
|
||
|
|
&db_min_ro($table,'id,aisa_quote_nr,event_system_id_multiple,fixed_system_online_status,fixed_system_network_test,fixed_system_system_test,fixed_system_test_event,fixed_system_sound_test,fixed_system_overall_status,fixed_system_additional_comments',"$srch_where_sql AND `quote_accepted` = '1'",'','') ; #### $srch_wh
|
||
|
|
|
||
|
|
my %sss_fields = () ; my $cnt = 0 ;
|
||
|
|
|
||
|
|
foreach my $id (sort keys %{$db{$table}}) {
|
||
|
|
|
||
|
|
my $upd_field = ($sss_side) ? "update_$id" : "update_$db{$table}{$id}{aisa_quote_nr}" ;
|
||
|
|
|
||
|
|
my $found_upd = 0 ;
|
||
|
|
foreach (keys %i) {
|
||
|
|
$found_upd = 1 if $i{$_} && $_ =~ /$upd_field/ ;
|
||
|
|
last if $found_upd ;
|
||
|
|
}
|
||
|
|
|
||
|
|
next unless $found_upd ;
|
||
|
|
|
||
|
|
$sss_fields{$id}{event_system_id_multiple} = $db{$table}{$id}{event_system_id_multiple} ;
|
||
|
|
$sss_fields{$id}{fixed_system_online_status} = $db{$table}{$id}{fixed_system_online_status} ;
|
||
|
|
$sss_fields{$id}{fixed_system_network_test} = $db{$table}{$id}{fixed_system_network_test} ;
|
||
|
|
$sss_fields{$id}{fixed_system_system_test} = $db{$table}{$id}{fixed_system_system_test} ;
|
||
|
|
$sss_fields{$id}{fixed_system_test_event} = $db{$table}{$id}{fixed_system_test_event} ;
|
||
|
|
$sss_fields{$id}{fixed_system_sound_test} = $db{$table}{$id}{fixed_system_sound_test} ;
|
||
|
|
$sss_fields{$id}{fixed_system_overall_status} = $db{$table}{$id}{fixed_system_overall_status} ;
|
||
|
|
$sss_fields{$id}{fixed_system_additional_comments} = $db{$table}{$id}{fixed_system_additional_comments} ;
|
||
|
|
|
||
|
|
if ($db{$table}{$id}{aisa_quote_nr}) {
|
||
|
|
$sss_event_id_AISA{$id} = $db{$table}{$id}{aisa_quote_nr} ;
|
||
|
|
$AISA_event_id_sss{$db{$table}{$id}{aisa_quote_nr}} = $id ;
|
||
|
|
} else {
|
||
|
|
$cnt++ ;
|
||
|
|
$sss_event_id_AISA{$id} = "none_$cnt" ;
|
||
|
|
$AISA_event_id_sss{"none_$cnt"} = $id ;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
&db_switch_conn('aisa') ;
|
||
|
|
|
||
|
|
%db = () ;
|
||
|
|
|
||
|
|
&db_min_ro($table,'id,event_system_id_multiple,fixed_system_online_status,fixed_system_network_test,fixed_system_system_test,fixed_system_test_event,fixed_system_sound_test,fixed_system_overall_status,fixed_system_additional_comments,sss_quote_nr',"$e_q_sql",'','') ;
|
||
|
|
|
||
|
|
foreach (keys %sss_fields) {
|
||
|
|
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{sss_quote_nr} = $_ ;
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{event_system_id_multiple} = ($db{$table}{$sss_event_id_AISA{$_}}{event_system_id_multiple} ) ? $db{$table}{$sss_event_id_AISA{$_}}{event_system_id_multiple} : $sss_fields{$_}{event_system_id_multiple} ;
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{fixed_system_online_status} = ($db{$table}{$sss_event_id_AISA{$_}}{fixed_system_online_status} ) ? $db{$table}{$sss_event_id_AISA{$_}}{fixed_system_online_status} : $sss_fields{$_}{fixed_system_online_status} ;
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{fixed_system_network_test} = ($db{$table}{$sss_event_id_AISA{$_}}{fixed_system_network_test} ) ? $db{$table}{$sss_event_id_AISA{$_}}{fixed_system_network_test} : $sss_fields{$_}{fixed_system_network_test} ;
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{fixed_system_system_test} = ($db{$table}{$sss_event_id_AISA{$_}}{fixed_system_system_test} ) ? $db{$table}{$sss_event_id_AISA{$_}}{fixed_system_system_test} : $sss_fields{$_}{fixed_system_system_test} ;
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{fixed_system_test_event} = ($db{$table}{$sss_event_id_AISA{$_}}{fixed_system_test_event} ) ? $db{$table}{$sss_event_id_AISA{$_}}{fixed_system_test_event} : $sss_fields{$_}{fixed_system_test_event} ;
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{fixed_system_sound_test} = ($db{$table}{$sss_event_id_AISA{$_}}{fixed_system_sound_test} ) ? $db{$table}{$sss_event_id_AISA{$_}}{fixed_system_sound_test} : $sss_fields{$_}{fixed_system_sound_test} ;
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{fixed_system_overall_status} = ($db{$table}{$sss_event_id_AISA{$_}}{fixed_system_overall_status} ) ? $db{$table}{$sss_event_id_AISA{$_}}{fixed_system_overall_status} : $sss_fields{$_}{fixed_system_overall_status} ;
|
||
|
|
$db{$table}{$sss_event_id_AISA{$_}}{fixed_system_additional_comments} = ($db{$table}{$sss_event_id_AISA{$_}}{fixed_system_additional_comments}) ? $db{$table}{$sss_event_id_AISA{$_}}{fixed_system_additional_comments} : $sss_fields{$_}{fixed_system_additional_comments} ;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
&db_min_ro('event_systems','id,name',"system_type='fixed'",'','') ;
|
||
|
|
|
||
|
|
my %update_event = () ; my %saved_values = () ;
|
||
|
|
|
||
|
|
foreach my $event_id (keys %{$db{$table}}) {
|
||
|
|
|
||
|
|
$sss_event_id_AISA{$db{$table}{$event_id}{sss_quote_nr}} = $event_id ;
|
||
|
|
$AISA_event_id_sss{$event_id} = $db{$table}{$event_id}{sss_quote_nr} ;
|
||
|
|
|
||
|
|
my @fixed_system_online_status = split(/\;/,$db{$table}{$event_id}{fixed_system_online_status}) ;
|
||
|
|
my @fixed_system_network_test = split(/\;/,$db{$table}{$event_id}{fixed_system_network_test}) ;
|
||
|
|
my @fixed_system_system_test = split(/\;/,$db{$table}{$event_id}{fixed_system_system_test}) ;
|
||
|
|
my @fixed_system_test_event = split(/\;/,$db{$table}{$event_id}{fixed_system_test_event}) ;
|
||
|
|
my @fixed_system_sound_test = split(/\;/,$db{$table}{$event_id}{fixed_system_sound_test}) ;
|
||
|
|
my @fixed_system_overall_status = split(/\;/,$db{$table}{$event_id}{fixed_system_overall_status}) ;
|
||
|
|
my @fixed_system_additional_comments = split(/\;/,$db{$table}{$event_id}{fixed_system_additional_comments}) ;
|
||
|
|
|
||
|
|
my $system_cnt = 0 ;
|
||
|
|
|
||
|
|
foreach my $system_id (split(/\;/,$db{$table}{$event_id}{event_system_id_multiple})) {
|
||
|
|
|
||
|
|
my $system_id_2 = $system_id ;
|
||
|
|
my $system_id_3 = $system_id ;
|
||
|
|
$system_id_2 =~ s/f-/f/g ;
|
||
|
|
$system_id_3 =~ s/f-//g ;
|
||
|
|
|
||
|
|
if ($system_id_3 && $db{event_systems}{$system_id_3}{name}) {
|
||
|
|
|
||
|
|
my $update_field_AISA = "update_$event_id\_$system_id_2" ;
|
||
|
|
my $update_field_SSS = "update_$AISA_event_id_sss{$event_id}\_$system_id_2" ;
|
||
|
|
|
||
|
|
if ($sss_side && $i{$update_field_SSS}) {
|
||
|
|
$update_event{AISA_on_SSS}{$event_id} = 1 ;
|
||
|
|
$update_event{SSS_on_SSS}{$AISA_event_id_sss{$event_id}} = 1 ;
|
||
|
|
} elsif (!$sss_side && $i{$update_field_AISA}) {
|
||
|
|
$update_event{AISA_on_AISA}{$event_id} = 1 ;
|
||
|
|
$update_event{SSS_on_AISA}{$AISA_event_id_sss{$event_id}} = 1 ;
|
||
|
|
}
|
||
|
|
|
||
|
|
$saved_values{$event_id}{fixed_system_online_status}{$system_id_2} = $fixed_system_online_status[$system_cnt] ;
|
||
|
|
$saved_values{$event_id}{fixed_system_network_test}{$system_id_2} = $fixed_system_network_test[$system_cnt] ;
|
||
|
|
$saved_values{$event_id}{fixed_system_system_test}{$system_id_2} = $fixed_system_system_test[$system_cnt] ;
|
||
|
|
$saved_values{$event_id}{fixed_system_test_event}{$system_id_2} = $fixed_system_test_event[$system_cnt] ;
|
||
|
|
$saved_values{$event_id}{fixed_system_sound_test}{$system_id_2} = $fixed_system_sound_test[$system_cnt] ;
|
||
|
|
$saved_values{$event_id}{fixed_system_overall_status}{$system_id_2} = $fixed_system_overall_status[$system_cnt] ;
|
||
|
|
$saved_values{$event_id}{fixed_system_additional_comments}{$system_id_2} = $fixed_system_additional_comments[$system_cnt] ;
|
||
|
|
}
|
||
|
|
$system_cnt++ ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
my %ii = () ; my %iii = %i ;
|
||
|
|
foreach (keys %i) {
|
||
|
|
|
||
|
|
local @a = split("_",$_) ;
|
||
|
|
|
||
|
|
my $upd_field = "update_$a[-2]\_$a[-1]" ;
|
||
|
|
|
||
|
|
next unless $i{$upd_field} ;
|
||
|
|
|
||
|
|
my $event_id = ($sss_side) ? $sss_event_id_AISA{$a[-2]} : $a[-2] ;
|
||
|
|
|
||
|
|
if (substr($_,0,14) eq 'online_status_') {
|
||
|
|
$ii{$event_id}{fixed_system_online_status}{$a[-1]} = $i{$_} ;
|
||
|
|
} elsif (substr($_,0,13) eq 'network_test_') {
|
||
|
|
$ii{$event_id}{fixed_system_network_test}{$a[-1]} = $i{$_} ;
|
||
|
|
} elsif (substr($_,0,12) eq 'system_test_') {
|
||
|
|
$ii{$event_id}{fixed_system_system_test}{$a[-1]} = $i{$_} ;
|
||
|
|
} elsif (substr($_,0,11) eq 'test_event_') {
|
||
|
|
$ii{$event_id}{fixed_system_test_event}{$a[-1]} = $i{$_} ;
|
||
|
|
} elsif (substr($_,0,11) eq 'sound_test_') {
|
||
|
|
$ii{$event_id}{fixed_system_sound_test}{$a[-1]} = $i{$_} ;
|
||
|
|
} elsif (substr($_,0,15) eq 'overall_status_') {
|
||
|
|
$ii{$event_id}{fixed_system_overall_status}{$a[-1]} = $i{$_} ;
|
||
|
|
} elsif (substr($_,0,20) eq 'additional_comments_') {
|
||
|
|
$ii{$event_id}{fixed_system_additional_comments}{$a[-1]} = $i{$_} ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
foreach my $event_id (sort keys %ii) {
|
||
|
|
|
||
|
|
next if $event_id =~ /none/ ;
|
||
|
|
|
||
|
|
next if !$update_event{AISA_on_SSS}{$event_id} && !$update_event{AISA_on_AISA}{$event_id} ;
|
||
|
|
|
||
|
|
%i = () ;
|
||
|
|
$upd_event{$event_id} = 0 ;
|
||
|
|
|
||
|
|
foreach my $col (keys %{$ii{$event_id}}) {
|
||
|
|
foreach my $sys_id (split(/\;/,$db{$table}{$event_id}{event_system_id_multiple})) {
|
||
|
|
my $sys_id_2 = $sys_id ;
|
||
|
|
$sys_id_2 =~ s/f-/f/g ;
|
||
|
|
my $upd_field = ($sss_side) ? "update_$AISA_event_id_sss{$event_id}\_$sys_id_2" : "update_$event_id\_$sys_id_2" ;
|
||
|
|
$i{$col} .= ($ii{$event_id}{$col}{$sys_id_2} && $iii{$upd_field}) ? qq~$ii{$event_id}{$col}{$sys_id_2};~ : (!$iii{$upd_field}) ? qq~$saved_values{$event_id}{$col}{$sys_id_2};~ : qq~;~ ;
|
||
|
|
# next unless $ii{$event_id}{$col}{$sys_id} ;
|
||
|
|
next if !$ii{$event_id}{$col}{$sys_id_2} && !$db{$table}{$event_id}{$col} ;
|
||
|
|
$upd_event{$event_id} = 1 ;
|
||
|
|
}
|
||
|
|
$ignore{$col} = ((!$i{$col} && !$db{$table}{$event_id}{$col}) || $i{$col} eq $db{$table}{$event_id}{$col}) ? 1 : 0 ;
|
||
|
|
}
|
||
|
|
# my $col_updates = qq~~ ;
|
||
|
|
# foreach my $col (keys %{$ii{$event_id}}) {
|
||
|
|
# $ignore{$col} = 1 if $i{$col} eq $db{$table}{$event_id}{$col} ;
|
||
|
|
# $col_updates .= qq~`$col`='$i{$col}',~ if $i{$col} ne $db{$table}{$event_id}{$col} ;
|
||
|
|
# }
|
||
|
|
# chop $col_updates if $col_updates ;
|
||
|
|
|
||
|
|
next unless $upd_event{$event_id} ;
|
||
|
|
|
||
|
|
&db_min_upd($table,"`id`='$event_id'") ;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
&db_switch_conn('sss') ;
|
||
|
|
|
||
|
|
foreach my $event_id (sort keys %ii) {
|
||
|
|
|
||
|
|
# next if $event_id !~ /none/ ;
|
||
|
|
|
||
|
|
$event_id = $AISA_event_id_sss{$event_id} ;
|
||
|
|
|
||
|
|
next if !$sss_side && $event_id =~ /none/ ;
|
||
|
|
|
||
|
|
next if !$update_event{SSS_on_SSS}{$event_id} && !$update_event{SSS_on_AISA}{$event_id} ;
|
||
|
|
|
||
|
|
# next unless $update_event{$event_id} ;
|
||
|
|
%i = () ;
|
||
|
|
$upd_event{$event_id} = 0 ;
|
||
|
|
|
||
|
|
foreach my $col (keys %{$ii{$sss_event_id_AISA{$event_id}}}) {
|
||
|
|
foreach my $sys_id (split(/\;/,$db{$table}{$sss_event_id_AISA{$event_id}}{event_system_id_multiple})) {
|
||
|
|
my $sys_id_2 = $sys_id ;
|
||
|
|
$sys_id_2 =~ s/f-/f/g ;
|
||
|
|
my $upd_field = "update_$event_id\_$sys_id_2" ;
|
||
|
|
$i{$col} .= ($ii{$sss_event_id_AISA{$event_id}}{$col}{$sys_id_2} && $iii{$upd_field}) ? qq~$ii{$sss_event_id_AISA{$event_id}}{$col}{$sys_id_2};~ : (!$iii{$upd_field}) ? qq~$saved_values{$sss_event_id_AISA{$event_id}}{$col}{$sys_id_2};~ : qq~;~ ;
|
||
|
|
# next unless $ii{$event_id}{$col}{$sys_id} ;
|
||
|
|
next if !$ii{$sss_event_id_AISA{$event_id}}{$col}{$sys_id_2} && !$db{$table}{$sss_event_id_AISA{$event_id}}{$col} ;
|
||
|
|
$upd_event{$event_id} = 1 ;
|
||
|
|
}
|
||
|
|
$ignore{$col} = ((!$i{$col} && !$db{$table}{$sss_event_id_AISA{$event_id}}{$col}) || $i{$col} eq $db{$table}{$sss_event_id_AISA{$event_id}}{$col}) ? 1 : 0 ;
|
||
|
|
}
|
||
|
|
|
||
|
|
# my $col_updates = qq~~ ;
|
||
|
|
# foreach my $col (keys %{$ii{$event_id}}) {
|
||
|
|
# $ignore{$col} = 1 if $i{$col} eq $db{$table}{$event_id}{$col} ;
|
||
|
|
# $col_updates .= qq~`$col`='$i{$col}',~ if $i{$col} ne $db{$table}{$event_id}{$col} ;
|
||
|
|
# }
|
||
|
|
# chop $col_updates if $col_updates ;
|
||
|
|
|
||
|
|
next unless $upd_event{$event_id} ;
|
||
|
|
|
||
|
|
&db_min_upd($table,"`id`='$event_id'") ;
|
||
|
|
}
|
||
|
|
|
||
|
|
# exit ;
|
||
|
|
|
||
|
|
&db_switch_conn('aisa') ;
|
||
|
|
|
||
|
|
%i = %iii ;
|
||
|
|
# exit ;
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub fixed_systems_report_ifields {
|
||
|
|
|
||
|
|
if ($i{customer_id}) {
|
||
|
|
push @report_sql,"`quote_to`='$i{customer_id}'" ;
|
||
|
|
&db_min_ro('customers','id,name',"`id`='$i{customer_id}'",'','') ;
|
||
|
|
push @report_results,"`CLIENT` = '$db{customers}{$i{customer_id}}{name}'" ;
|
||
|
|
} else {
|
||
|
|
if ($is_installation_partner || $glob_custids{$userid}) {
|
||
|
|
@report_sql_or = () ;
|
||
|
|
foreach $_cust_id (keys %{$glob_custids{$userid}}) {
|
||
|
|
push @report_sql_or, "quote_to = '$_cust_id'"
|
||
|
|
}
|
||
|
|
my $sql_or = join(' OR ',@report_sql_or) ;
|
||
|
|
push @report_sql, "($sql_or)" if $sql_or ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($i{region_id} and $i{region_id} ne 'all') {
|
||
|
|
push @report_sql,"`region_id`='$i{region_id}'" ;
|
||
|
|
&db_min_ro('regions','id,name,code',"`id`='$i{region_id}'",'','') ;
|
||
|
|
push @report_results,"`REGION` = '$db{regions}{$i{region_id}}{name} [$db{regions}{$i{region_id}}{code}]'" ;
|
||
|
|
} else {
|
||
|
|
if ($is_schools_manager || $is_operator || $glob_regids{$userid}) {
|
||
|
|
@report_sql_or = () ;
|
||
|
|
foreach $_reg_id (keys %{$glob_regids{$userid}}) {
|
||
|
|
push @report_sql_or, "region_id = '$_reg_id'"
|
||
|
|
}
|
||
|
|
my $sql_or = join(' OR ',@report_sql_or) ;
|
||
|
|
push @report_sql, "($sql_or)" if $sql_or ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($i{date_from} and $i{date_to}) { # check dates
|
||
|
|
my $date_from_check = $i{date_from} ;
|
||
|
|
$date_from_check =~ s/\-//g ;
|
||
|
|
my $date_to_check = $i{date_to} ;
|
||
|
|
$date_to_check =~ s/\-//g ;
|
||
|
|
if ($date_from_check > $date_to_check) {
|
||
|
|
$error = qq~'$i{date_from}' > '$i{date_to}'~ ; &report_screen ;
|
||
|
|
}
|
||
|
|
# push @report_sql, "((`date_from` >= '$i{date_from} 00:00:00' AND `date_from` <= '$i{date_to} 23:59:59') OR (`date_to` <= '$i{date_to} 23:59:59' AND `date_to` >= '$i{date_from} 00:00:00'))" ;
|
||
|
|
# push @report_sql, "(('$i{date_from} 23:59:59' >= `date_from` AND '$i{date_from} 00:00:00' <= `date_to`) OR ('$i{date_to} 23:59:59' >= `date_from` AND '$i{date_to} 00:00:00' <= `date_to`))" ;
|
||
|
|
# push @report_sql, "((`date_from` >= '$i{date_from} 00:00:00' AND `date_from` <= '$i{date_to} 23:59:59') OR (`date_to` >= '$i{date_from} 00:00:00' AND `date_to` <= '$i{date_to} 23:59:59'))" ;
|
||
|
|
|
||
|
|
my @srch_ed_from = &common_split_sql_time($i{date_from}) ;
|
||
|
|
my @srch_ed_to = &common_split_sql_time($i{date_to}) ;
|
||
|
|
|
||
|
|
&common_date_array("$srch_ed_from[0]$srch_ed_from[1]$srch_ed_from[2]","$srch_ed_to[0]$srch_ed_to[1]$srch_ed_to[2]") ;
|
||
|
|
|
||
|
|
@report_sql_or = () ;
|
||
|
|
|
||
|
|
foreach my $_srch_date (@common_date_array) {
|
||
|
|
my $srch_ccyy_mm_dd = substr($_srch_date,0,4) . '-' . substr($_srch_date,4,2) . '-' . substr($_srch_date,6,2) ;
|
||
|
|
push @report_sql_or, "('$srch_ccyy_mm_dd 23:59:59' >= date_from AND '$srch_ccyy_mm_dd 00:00:00' <= date_to)"
|
||
|
|
}
|
||
|
|
|
||
|
|
my $sql_or = join(' OR ',@report_sql_or) ;
|
||
|
|
push @report_sql, "($sql_or)" if $sql_or ;
|
||
|
|
|
||
|
|
push @report_results, "(BETWEEN '$i{date_from}' AND '$i{date_to}')" ;
|
||
|
|
} elsif (not $i{date_from}) {
|
||
|
|
$error = qq~PLEASE ENTER A START DATE!~ ;
|
||
|
|
&report_screen;
|
||
|
|
} elsif (not $i{date_to}) {
|
||
|
|
$error = qq~PLEASE ENTER AN END DATE!~ ;
|
||
|
|
&report_screen;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($i{overall_status} and $i{overall_status} ne 'all') {
|
||
|
|
&db_min_ro('fixed_system_status','id,status',"`id`='$i{overall_status}'",'','') ;
|
||
|
|
push @report_results,"`STATUS` = '$db{fixed_system_status}{$i{overall_status}}{status}'" ;
|
||
|
|
push @report_sql, "(`fixed_system_overall_status` LIKE '$i{overall_status};%' OR `fixed_system_overall_status` LIKE '%;$i{overall_status};%' OR `fixed_system_overall_status` LIKE '%;$i{overall_status}')" ;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($i{system_id} and $i{system_id} ne '-1') {
|
||
|
|
&db_min_ro('event_systems',"id,name,description","`id`='$i{system_id}'",'','') ;
|
||
|
|
push @report_sql, "(event_system_id_multiple LIKE '%;$i{system_id};%' OR event_system_id_multiple LIKE '$i{system_id};%' OR event_system_id_multiple LIKE '%;$i{system_id} OR 'event_system_id_multiple LIKE '%;f-$i{system_id};%' OR event_system_id_multiple LIKE 'f-$i{system_id};%' OR event_system_id_multiple LIKE '%;f-$i{system_id}' OR event_system_id_multiple = 'f-$i{system_id}' OR event_system_id_multiple = '$i{system_id}')" ;
|
||
|
|
push @report_results, "event_systems = `$db{event_systems}{$i{system_id}}{name} [$db{event_systems}{$i{system_id}}{description}]`" if $db{event_systems}{$i{system_id}}{description} ;
|
||
|
|
push @report_results, "event_systems = `$db{event_systems}{$i{system_id}}{name}`" unless $db{event_systems}{$i{system_id}}{description} ;
|
||
|
|
}
|
||
|
|
|
||
|
|
$report_results_msg = uc join(', ', @report_results) ;
|
||
|
|
|
||
|
|
if (not $report_results_msg) {
|
||
|
|
$error = qq(ENTER AT LEAST ONE SEARCH PARAMETER);
|
||
|
|
&report_screen;
|
||
|
|
} else {
|
||
|
|
$isaved = qq(SELECT WHERE $report_results_msg) ;
|
||
|
|
}
|
||
|
|
|
||
|
|
our $srch_where_sql = join(' AND ',@report_sql) ;
|
||
|
|
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub fixed_systems_list_screen {
|
||
|
|
|
||
|
|
$print_box_content_rows .= &common_min_forms_start($lcpage) ;
|
||
|
|
|
||
|
|
# $fcol = 2 ;
|
||
|
|
|
||
|
|
# $print_box_content_rows .= qq~<div style = "display:none;">~ ;
|
||
|
|
# $print_box_content_rows .= &common_min_form_input_col('customer_id',"$i{customer_id}") ;
|
||
|
|
# $print_box_content_rows .= &common_min_form_input_col('region_id',"$i{region_id}") ;
|
||
|
|
# $print_box_content_rows .= &common_min_form_input_col('date_from',"$i{date_from}") ;
|
||
|
|
# $print_box_content_rows .= &common_min_form_input_col('date_to',"$i{date_to}") ;
|
||
|
|
# $print_box_content_rows .= &common_min_form_input_col('overall_status',"$i{overall_status}") ;
|
||
|
|
# $print_box_content_rows .= qq~</div>~ ;
|
||
|
|
|
||
|
|
$fcol = 12 ;
|
||
|
|
|
||
|
|
my $report = 1 ;
|
||
|
|
|
||
|
|
our $xlsxdir = "fixed_systems_report" ;
|
||
|
|
our $xlsxreportname = "Fixed_Systems_Report" ;
|
||
|
|
my $date = &common_write_date_interval($i{date_from},$i{date_to}) ;
|
||
|
|
our $xlsx_title_heading = "Fixed System Report $date" ;
|
||
|
|
|
||
|
|
# &db_switch_conn('aisa') ;
|
||
|
|
|
||
|
|
&common_min_select_opts('overall_status','fixed_system_status','status','',0,'','','','',"",'name') ;
|
||
|
|
&common_min_select_opts('sound_test','fixed_system_sound_test','name','',0,'','','','',"",'name') ;
|
||
|
|
$opts{online_status} = qq~<option value="-1">Offline</option><option value="1">Online</option>~ ;
|
||
|
|
$opts{network_test} = qq~<option value="-1">Failed</option><option value="1">Passed</option>~ ;
|
||
|
|
$opts{system_test} = qq~<option value="-1">Failed</option><option value="1">Passed</option>~ ;
|
||
|
|
$opts{test_event} = qq~<option value="-1">Not Good</option><option value="1">Good</option>~ ;
|
||
|
|
|
||
|
|
&db_min_ro('event_systems','*',"`system_type` = 'fixed'",'','') ;
|
||
|
|
&db_min_ro('regions','*','','','') ;
|
||
|
|
&db_min_ro('organisations','*','','','') ;
|
||
|
|
|
||
|
|
# &db_switch_conn('sss') ;
|
||
|
|
|
||
|
|
# &db_min_ro($table,'aisa_quote_nr,id',"`quote_accepted` = '1' AND `aisa_quote_nr` <> '0'",'','') ; #### $srch_where_sql AND `id` = 5136
|
||
|
|
|
||
|
|
&fixedsystem_build_table_and_or_excel(1) ;
|
||
|
|
|
||
|
|
$fnsortorder = 'asc' ;
|
||
|
|
|
||
|
|
&common_min_extra_crumb("$lcpage","Search Screen") ;
|
||
|
|
|
||
|
|
# if $glod_user_level > 2 ;
|
||
|
|
|
||
|
|
if ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager) {
|
||
|
|
$trigger_jquery_raw .= qq~\$("#savebutt").click(function() { \$("#$lcpage-form").submit(); });~ ;
|
||
|
|
} else {
|
||
|
|
$trigger_jquery_raw .= qq~\$("#savebutt").css("display","none");~ ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub fixedsystem_build_table_and_or_excel {
|
||
|
|
|
||
|
|
my ($report) = @_ ;
|
||
|
|
|
||
|
|
$useropts{table_id} = "$useropts{titlc}-table" unless $useropts{table_id} ;
|
||
|
|
|
||
|
|
our @sql_col_display = ("cnt","event","start_date","start_time","venue","region","system_name","online_status","network_test","system_test","test_event","sound_test","overall_status","additional_comments") ;
|
||
|
|
|
||
|
|
&report_xlsx_export_header("$xlsxreportname",$xlsxdir,'',$xlsx_title_heading) ;
|
||
|
|
|
||
|
|
push @sql_col_display,"update" ;
|
||
|
|
|
||
|
|
my @rev_sql_col_display = reverse @sql_col_display ;
|
||
|
|
|
||
|
|
foreach (@rev_sql_col_display) { $lastchild++ ; $last_child{$_} = $lastchild ; } # &common_debug("last-child : $_ [$last_child{$_}]");
|
||
|
|
|
||
|
|
$xlsxrow-- ;
|
||
|
|
|
||
|
|
my $event_cnt = 0 ; our $found_after_date = 0 ;
|
||
|
|
|
||
|
|
# $format84->set_align('center');
|
||
|
|
# $format88->set_align('center');
|
||
|
|
# $format89->set_align('center');
|
||
|
|
# $format90->set_align('center');
|
||
|
|
# $format91->set_align('center');
|
||
|
|
|
||
|
|
my %defualt_color = () ;
|
||
|
|
$defualt_color{-1} = "#F90D0D" ;
|
||
|
|
$defualt_color{1} = "#51B529" ;
|
||
|
|
$defualt_color{"Offline"} = "#F90D0D" ;
|
||
|
|
$defualt_color{"Online"} = "#51B529" ;
|
||
|
|
|
||
|
|
my %defualt_color2 = () ;
|
||
|
|
$defualt_color2{1} = "#51B529" ;
|
||
|
|
$defualt_color2{2} = "#F6E305" ;
|
||
|
|
$defualt_color2{3} = "#F90D0D" ;
|
||
|
|
|
||
|
|
my $z_index = 0 ;
|
||
|
|
|
||
|
|
foreach my $id (sort {$db{$table}{$a}{date_from} cmp $db{$table}{$b}{date_from} || $a cmp $b} keys %{$db{$table}}) {
|
||
|
|
|
||
|
|
next unless $id ;
|
||
|
|
|
||
|
|
unless (&common_check_if_string_contains_an_integer($db{$table}{$id}{event_system_id_multiple})) {
|
||
|
|
$db{$table}{$id}{event_system_id_multiple} = ";-1;" ;
|
||
|
|
}
|
||
|
|
|
||
|
|
my $now_date = int("$now_year$now_mm$now_dd") ;
|
||
|
|
my $end_date = substr($db{$table}{$id}{date_to},0,10) ;
|
||
|
|
$end_date =~ s/\-//g ;
|
||
|
|
$end_date = int($end_date) ;
|
||
|
|
my $is_in_future = ($now_date < $end_date) ? 1 : 0 ;
|
||
|
|
|
||
|
|
my @system_name_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||
|
|
|
||
|
|
my @fixed_system_online_status = split(/\;/,$db{$table}{$id}{fixed_system_online_status}) ;
|
||
|
|
my @fixed_system_network_test = split(/\;/,$db{$table}{$id}{fixed_system_network_test}) ;
|
||
|
|
my @fixed_system_system_test = split(/\;/,$db{$table}{$id}{fixed_system_system_test}) ;
|
||
|
|
my @fixed_system_test_event = split(/\;/,$db{$table}{$id}{fixed_system_test_event}) ;
|
||
|
|
my @fixed_system_sound_test = split(/\;/,$db{$table}{$id}{fixed_system_sound_test}) ;
|
||
|
|
my @fixed_system_overall_status = split(/\;/,$db{$table}{$id}{fixed_system_overall_status}) ;
|
||
|
|
my @fixed_system_additional_comments = split(/\;/,$db{$table}{$id}{fixed_system_additional_comments}) ;
|
||
|
|
|
||
|
|
my %default_vals = () ;
|
||
|
|
|
||
|
|
my $cnt_sys_ids = 0 ;
|
||
|
|
|
||
|
|
foreach (@system_name_ids) {
|
||
|
|
|
||
|
|
$default_vals{online_status}{$cnt_sys_ids} = $fixed_system_online_status[$cnt_sys_ids] ;
|
||
|
|
$default_vals{network_test}{$cnt_sys_ids} = $fixed_system_network_test[$cnt_sys_ids] ;
|
||
|
|
$default_vals{system_test}{$cnt_sys_ids} = $fixed_system_system_test[$cnt_sys_ids] ;
|
||
|
|
$default_vals{test_event}{$cnt_sys_ids} = $fixed_system_test_event[$cnt_sys_ids] ;
|
||
|
|
$default_vals{sound_test}{$cnt_sys_ids} = $fixed_system_sound_test[$cnt_sys_ids] ;
|
||
|
|
$default_vals{overall_status}{$cnt_sys_ids} = $fixed_system_overall_status[$cnt_sys_ids] ;
|
||
|
|
$default_vals{additional_comments}{$cnt_sys_ids} = $fixed_system_additional_comments[$cnt_sys_ids] ;
|
||
|
|
$cnt_sys_ids++ ;
|
||
|
|
}
|
||
|
|
|
||
|
|
$cnt_sys_ids = -1 ;
|
||
|
|
|
||
|
|
# my @table_op_ids = () ;
|
||
|
|
|
||
|
|
# for (1 .. $cnt_rows) {
|
||
|
|
# push @table_op_ids,$op_ids[$_ - 1] if $op_ids[$_ - 1] ;
|
||
|
|
# push @table_op_ids,0 unless $op_ids[$_ - 1] ;
|
||
|
|
# }
|
||
|
|
|
||
|
|
my $system_count = 0 ;
|
||
|
|
|
||
|
|
# foreach my $event_id (split(";",$db{$table}{$id}{event_system_id_multiple})) {
|
||
|
|
foreach my $event_id (@system_name_ids) {
|
||
|
|
|
||
|
|
$cnt_sys_ids++ ;
|
||
|
|
|
||
|
|
next if $event_id =~ /f-/ && ($db{$table}{$id}{supplier_ids} !~ /\b62\b/ || $db{$table}{$id}{supplier_type_ids} !~ /\b6\b/) ;
|
||
|
|
|
||
|
|
my $event_id_2 = $event_id ;
|
||
|
|
my $event_id_3 = $event_id ;
|
||
|
|
|
||
|
|
$event_id_2 =~ s/f-/f/g ;
|
||
|
|
$event_id_3 =~ s/f-//g ;
|
||
|
|
|
||
|
|
next unless $event_id_3 ;
|
||
|
|
next unless $db{event_systems}{$event_id_3}{system_type} eq 'fixed' ;
|
||
|
|
next if $i{overall_status} ne 'all' and $i{overall_status} and $i{overall_status} ne $fixed_system_overall_status[$cnt_sys_ids] ;
|
||
|
|
|
||
|
|
$event_cnt++ ;
|
||
|
|
$system_count++ ;
|
||
|
|
$xlsxcol = 0 ;
|
||
|
|
$print_tbody .= qq~<tr id="$id">~ if $report ;
|
||
|
|
|
||
|
|
our %field = () ;
|
||
|
|
|
||
|
|
$field{online_status} = qq~online_status_$id\_$event_id_2~ ;
|
||
|
|
$field{network_test} = qq~network_test_$id\_$event_id_2~ ;
|
||
|
|
$field{system_test} = qq~system_test_$id\_$event_id_2~ ;
|
||
|
|
$field{test_event} = qq~test_event_$id\_$event_id_2~ ;
|
||
|
|
$field{sound_test} = qq~sound_test_$id\_$event_id_2~ ;
|
||
|
|
$field{overall_status} = qq~overall_status_$id\_$event_id_2~ ;
|
||
|
|
$field{additional_comments} = qq~additional_comments_$id\_$event_id_2~ ;
|
||
|
|
$field{update} = qq~update_$id\_$event_id_2~ ;
|
||
|
|
|
||
|
|
# $opts{$field{status_id}} = $opts{status_id} ;
|
||
|
|
# $opts{$field{sport}} = $opts{sport} ;
|
||
|
|
# $opts{$field{event_operations_manager}} = $opts{event_operations_manager} ;
|
||
|
|
|
||
|
|
our %ucfirstfield = () ;
|
||
|
|
|
||
|
|
foreach (keys %field) {
|
||
|
|
$ucfirstfield{$field{$_}} = ucfirst $field{$_} ;
|
||
|
|
if ($_ eq 'update') {
|
||
|
|
$ucfirstfield{$field{$_}} = qq~checkbox~ . $ucfirstfield{$field{$_}} ;
|
||
|
|
} elsif ($_ eq 'additional_comments') {
|
||
|
|
$ucfirstfield{$field{$_}} = qq~textarea~ . $ucfirstfield{$field{$_}} ;
|
||
|
|
} else {
|
||
|
|
$ucfirstfield{$field{$_}} = qq~select~ . $ucfirstfield{$field{$_}} ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
our $default_javascript = '' ; my $found_non_readonly = 0 ;
|
||
|
|
|
||
|
|
foreach (@sql_col_display) {
|
||
|
|
|
||
|
|
next unless $_ ; # blank for the buttons column
|
||
|
|
|
||
|
|
my $formatting = $format84 ;
|
||
|
|
our $val = $db{$table}{$id}{$_} ;
|
||
|
|
our $val_min = $val ;
|
||
|
|
my $align = '' ;
|
||
|
|
my $nowrap = '' ;
|
||
|
|
my $style = '' ;
|
||
|
|
my $default_val = $default_vals{$_}{$cnt_sys_ids} ; my $only_display_val = '' ; my $default_val_is_saved = 1 ; my $background_color = '' ;
|
||
|
|
|
||
|
|
if ($_ eq 'online_status' || $_ eq 'network_test' || $_ eq 'system_test' || $_ eq 'test_event' || $_ eq 'sound_test' || $_ eq 'overall_status') {
|
||
|
|
|
||
|
|
$background_color = $defualt_color{$default_val} if $default_val ;
|
||
|
|
$formatting = $format94 if $default_val eq '1' ;
|
||
|
|
$formatting = $format95 if $default_val eq '2' ;
|
||
|
|
$formatting = $format96 if $default_val eq '-1' || $default_val eq '3' ;
|
||
|
|
|
||
|
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||
|
|
$only_display_val = 0 ;
|
||
|
|
$opts{$field{$_}} = $opts{$_} ;
|
||
|
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||
|
|
$val_min = get_displyed_value($_,$val_min) ;
|
||
|
|
|
||
|
|
$found_non_readonly = 1 ;
|
||
|
|
} else {
|
||
|
|
$only_display_val = 1 ;
|
||
|
|
$default_val = get_displyed_value($_,$default_val) ;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($_ eq 'cnt') {
|
||
|
|
my $sort_val = sprintf("%09d",$event_cnt) ;
|
||
|
|
$val = qq~<span style="display:none;">$sort_val</span>~ . $event_cnt ;
|
||
|
|
# $nowrap = 'nowrap' ;
|
||
|
|
# $val = $db{$table}{$id}{date_from} ;
|
||
|
|
# $val =~ s/[-: ]//g;
|
||
|
|
# $val = qq~$val$id~ ;
|
||
|
|
# $val = qq~<span style="display:none;">$val</span>~ . &common_min_get_event_quote_button($id,$table) ;
|
||
|
|
# $val .= qq~<span title="AISA : $db{$table}{$id}{id}" data-toggle="tooltip" data-placement="top"><i class="glyphicons glyphicons-pin-flag icon-white"></i></span>~ if $sss_side ;
|
||
|
|
} elsif ($_ eq 'event') {
|
||
|
|
$val = "$db{$table}{$id}{ref} [$id]" ;
|
||
|
|
} elsif ($_ eq 'start_date') {
|
||
|
|
$nowrap = 'nowrap' ;
|
||
|
|
$val = substr($db{$table}{$id}{date_from},0,10) ; $align = qq~ class="dt-center"~ ;
|
||
|
|
} elsif ($_ eq 'venue') {
|
||
|
|
my @oids = split(/\,/,$db{$table}{$id}{organisation_ids}) ;
|
||
|
|
foreach $_oid (@oids) {
|
||
|
|
$val .= $db{organisations}{$_oid}{name} . '<br>' ;
|
||
|
|
}
|
||
|
|
$val = substr($val,0,-4) if $val ; ;
|
||
|
|
} elsif ($_ eq 'region') {
|
||
|
|
$val = $db{regions}{$db{$table}{$id}{region_id}}{code} ; $align = qq~ class="dt-center"~ ;
|
||
|
|
} elsif ($_ eq 'system_name') {
|
||
|
|
$val = '' ;
|
||
|
|
$val = qq~$db{event_systems}{$event_id_3}{name}~ ;
|
||
|
|
$val .= qq~ ($db{event_systems}{$event_id_3}{description})~ if $db{event_systems}{$event_id_3}{description} ;
|
||
|
|
} elsif ($_ eq 'sport') {
|
||
|
|
$val = '' ;
|
||
|
|
foreach my $sport_id (split(",",$db{$table}{$id}{sport_type_ids})) {
|
||
|
|
$db{sport_types}{$sport_id}{name} = uc $db{sport_types}{$sport_id}{name} ;
|
||
|
|
$val .= qq~$db{sport_types}{$sport_id}{name}<br>~ ;
|
||
|
|
}
|
||
|
|
$val = substr($val,0,-4) if $val ;
|
||
|
|
} elsif ($_ eq 'operator') {
|
||
|
|
$val = '' ;
|
||
|
|
$val = $db{users}{$op_ids[$system_count - 1]}{name} if $op_ids[$system_count - 1] ;
|
||
|
|
} elsif ($_ eq 'start_time') {
|
||
|
|
$val = substr($db{$table}{$id}{date_from},11,5) ; $align = qq~ class="dt-center"~ ;
|
||
|
|
} elsif ($_ eq 'online_status') {
|
||
|
|
$preferred_title{$field{$_}} = "Online Status" ;
|
||
|
|
$z_index++ ; # $style = qq~style="z-index:$z_index;"~ ;
|
||
|
|
$val = &common_min_table_select($field{$_},$default_val,$only_display_val,$event_cnt,$last_child{$_},$background_color,$default_val_is_saved) ;
|
||
|
|
} elsif ($_ eq 'network_test') {
|
||
|
|
$preferred_title{$field{$_}} = "Test Network" ;
|
||
|
|
$z_index++ ; # $style = qq~style="z-index:$z_index;"~ ;
|
||
|
|
$val = &common_min_table_select($field{$_},$default_val,$only_display_val,$event_cnt,$last_child{$_},$background_color,$default_val_is_saved) ;
|
||
|
|
} elsif ($_ eq 'system_test') {
|
||
|
|
$preferred_title{$field{$_}} = "System Test" ;
|
||
|
|
$z_index++ ; # $style = qq~style="z-index:$z_index;"~ ;
|
||
|
|
$val = &common_min_table_select($field{$_},$default_val,$only_display_val,$event_cnt,$last_child{$_},$background_color,$default_val_is_saved) ;
|
||
|
|
} elsif ($_ eq 'test_event') {
|
||
|
|
$preferred_title{$field{$_}} = "Test Event" ;
|
||
|
|
$z_index++ ; # $style = qq~style="z-index:$z_index;"~ ;
|
||
|
|
$val = &common_min_table_select($field{$_},$default_val,$only_display_val,$event_cnt,$last_child{$_},$background_color,$default_val_is_saved) ;
|
||
|
|
} elsif ($_ eq 'sound_test') {
|
||
|
|
if (!$only_display_val) {
|
||
|
|
$val = "None" unless $val ;
|
||
|
|
$val_min = $db{fixed_system_sound_test}{$default_val}{name} if $default_val ;
|
||
|
|
$val_min = "None" unless $val_min ;
|
||
|
|
} else {
|
||
|
|
$val = $db{fixed_system_sound_test}{$default_val}{name} if $default_val ;
|
||
|
|
|
||
|
|
# $default_val = $val ;
|
||
|
|
$val = "None" unless $val ;
|
||
|
|
$val_min = $val ;
|
||
|
|
}
|
||
|
|
$formatting = $format94 if $default_val eq '1' ;
|
||
|
|
$formatting = $format95 if $default_val eq '2' ;
|
||
|
|
$formatting = $format96 if $default_val eq '3' ;
|
||
|
|
$preferred_title{$field{$_}} = "Test Sound" ;
|
||
|
|
$background_color = $defualt_color2{$fixed_system_sound_test[$cnt_sys_ids]} ;
|
||
|
|
$z_index++ ; # $style = qq~style="z-index:$z_index;"~ ;
|
||
|
|
$val = &common_min_table_select($field{$_},$default_val,$only_display_val,$event_cnt,$last_child{$_},$background_color,$default_val_is_saved) ;
|
||
|
|
} elsif ($_ eq 'overall_status') {
|
||
|
|
if (!$only_display_val) {
|
||
|
|
$preferred_title{$field{$_}} = "Overall Status" ;
|
||
|
|
$val_min = $db{fixed_system_status}{$default_val}{status} if $default_val ;
|
||
|
|
$val_min = "None" unless $val_min ;
|
||
|
|
} else {
|
||
|
|
$val = $db{fixed_system_status}{$default_val}{status} if $default_val ;
|
||
|
|
$val = "None" unless $val ;
|
||
|
|
$val_min = $val ;
|
||
|
|
}
|
||
|
|
$formatting = $format94 if $fixed_system_overall_status[$cnt_sys_ids] eq '1' ;
|
||
|
|
$formatting = $format95 if $fixed_system_overall_status[$cnt_sys_ids] eq '2' ;
|
||
|
|
$formatting = $format96 if $fixed_system_overall_status[$cnt_sys_ids] eq '3' ;
|
||
|
|
$preferred_placeholder{$field} = "Select Overall Status" ;
|
||
|
|
$background_color = $defualt_color2{$fixed_system_overall_status[$cnt_sys_ids]} ;
|
||
|
|
$z_index++ ; # $style = qq~style="z-index:$z_index;"~ ;
|
||
|
|
$val = &common_min_table_select($field{$_},$default_val,$only_display_val,$event_cnt,$last_child{$_},$background_color,$default_val_is_saved) ;
|
||
|
|
|
||
|
|
} elsif ($_ eq 'additional_comments') {
|
||
|
|
|
||
|
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||
|
|
$only_display_val = 0 ;
|
||
|
|
$align = qq~ class="dt-center $_ controls"~ ;
|
||
|
|
$preferred_title{$field{$_}} = "Additional Comments" ;
|
||
|
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||
|
|
$val_min = $default_val ;
|
||
|
|
$val_min = "None" unless $val_min ;
|
||
|
|
$found_non_readonly = 1 ;
|
||
|
|
print "\n 1 : $found_non_readonly" ;
|
||
|
|
} else {
|
||
|
|
$only_display_val = 1 ;
|
||
|
|
$val = $default_val ;
|
||
|
|
$val = "None" unless $val ;
|
||
|
|
$val_min = $val ;
|
||
|
|
}
|
||
|
|
|
||
|
|
$val = &common_min_table_textarea($field{$_},$default_val,$only_display_val,$table_row,$last_child{$_},$background_color,$default_val_is_saved) ;
|
||
|
|
|
||
|
|
} elsif ($_ eq 'update') {
|
||
|
|
|
||
|
|
if ($found_non_readonly) { #
|
||
|
|
$align = qq~ class="dt-center"~ ;
|
||
|
|
$val = &common_min_table_checkbox($field{update}) ;
|
||
|
|
chop $default_javascript if $default_javascript ;
|
||
|
|
if ($default_javascript) {
|
||
|
|
push @default_javascript_by_id, qq~"$id\_$event_id_2":{$default_javascript}~ ;
|
||
|
|
push @all_update_field_ids,"#$ucfirstfield{$field{online_status}},#$ucfirstfield{$field{network_test}},#$ucfirstfield{$field{system_test}},#$ucfirstfield{$field{test_event}},#$ucfirstfield{$field{sound_test}},#$ucfirstfield{$field{overall_status}},#$ucfirstfield{$field{additional_comments}}" ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($_ ne 'online_status' && $_ ne 'network_test' && $_ ne 'system_test' && $_ ne 'test_event' && $_ ne 'sound_test' && $_ ne 'overall_status' && $_ ne 'additional_comments') {
|
||
|
|
$val_min = $val ;
|
||
|
|
$val_min =~ s/\<br>/\;/g ;
|
||
|
|
}
|
||
|
|
$print_tbody .= qq~<td $align $nowrap $style>$val</td>~ if $report ;
|
||
|
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val_min,$formatting) if $_ ne 'update' ;
|
||
|
|
$xlsxcol++ ;
|
||
|
|
}
|
||
|
|
$print_tbody .= qq~</tr>~ if $report ;
|
||
|
|
$xlsxrow++ ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$worksheet{$ws}->set_column(0,0,10);
|
||
|
|
$worksheet{$ws}->set_column(1,1,30);
|
||
|
|
$worksheet{$ws}->set_column(2,3,15);
|
||
|
|
$worksheet{$ws}->set_column(4,4,45);
|
||
|
|
$worksheet{$ws}->set_column(5,5,15);
|
||
|
|
$worksheet{$ws}->set_column(6,6,45);
|
||
|
|
$worksheet{$ws}->set_column(7,12,15);
|
||
|
|
$worksheet{$ws}->set_column(13,13,45);
|
||
|
|
|
||
|
|
&report_xlsx_export_footer('N',15,$xlsxdir) ;
|
||
|
|
|
||
|
|
&common_min_table_update_checkbox_col(2) ;
|
||
|
|
|
||
|
|
# our @sql_col_display = ("cnt","event","start_date","start_time","venue","region","system_name","online_status","network_test","system_test","test_event","sound_test","overall_status","additional_comments","update") ;
|
||
|
|
|
||
|
|
&common_min_table_select_jquery("#$useropts{table_id} td:nth-last-child($last_child{overall_status}),#$useropts{table_id} td:nth-last-child($last_child{sound_test}),#$useropts{table_id} td:nth-last-child($last_child{test_event}),#$useropts{table_id} td:nth-last-child($last_child{system_test}),#$useropts{table_id} td:nth-last-child($last_child{network_test}),#$useropts{table_id} td:nth-last-child($last_child{online_status})") ;
|
||
|
|
|
||
|
|
# &common_min_table_select_prevent_dropdown_overlap_jquery_1("$useropts{table_id}") ;
|
||
|
|
|
||
|
|
# &common_min_table_select_default_values_jquery ;
|
||
|
|
|
||
|
|
# my $dropdown_chosen_ids_str = join(',',@dropdown_chosen_ids) ;
|
||
|
|
|
||
|
|
# $trigger_jquery_raw .= qq~
|
||
|
|
# \$('th').click(function() {
|
||
|
|
# var filteredrows = \$("#$useropts{table_id}").dataTable()._('tr', {"filter": "applied"});
|
||
|
|
# var table = \$('#$useropts{table_id}').DataTable();
|
||
|
|
# let z_index = 10000 ;
|
||
|
|
# for (let i = 0; i < 5; i++) {
|
||
|
|
# \$(filteredrows[i]).find('td').each(function(index, td) {
|
||
|
|
# \$(td).css('z-index',z_index) ;
|
||
|
|
# z_index-- ;
|
||
|
|
# });
|
||
|
|
# }
|
||
|
|
# }) ;
|
||
|
|
# ~ ;
|
||
|
|
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub get_displyed_value {
|
||
|
|
|
||
|
|
my ($col,$def_val) = @_ ;
|
||
|
|
|
||
|
|
if ($col eq 'online_status') {
|
||
|
|
$def_val = "Online" if $def_val eq '1' ;
|
||
|
|
$def_val = "Offline" if $def_val eq '-1' ;
|
||
|
|
} elsif ($col eq 'network_test' || $col eq 'system_test') {
|
||
|
|
$def_val = "Passed" if $def_val eq '1' ;
|
||
|
|
$def_val = "Failed" if $def_val eq '-1' ;
|
||
|
|
} elsif ($col eq 'test_event') {
|
||
|
|
$def_val = "Good" if $def_val eq '1' ;
|
||
|
|
$def_val = "Not Good" if $def_val eq '-1' ;
|
||
|
|
} elsif ($col eq 'sound_test') {
|
||
|
|
$def_val = "Good" if $def_val eq '1' ;
|
||
|
|
$def_val = "Static" if $def_val eq '2' ;
|
||
|
|
$def_val = "No Sound" if $def_val eq '3' ;
|
||
|
|
} elsif ($col eq 'overall_status') {
|
||
|
|
$def_val = "All Clear" if $def_val eq '1' ;
|
||
|
|
$def_val = "Sound Issue" if $def_val eq '2' ;
|
||
|
|
$def_val = "Not Clear" if $def_val eq '3' ;
|
||
|
|
}
|
||
|
|
$def_val = "None" unless $def_val ;
|
||
|
|
|
||
|
|
return $def_val ;
|
||
|
|
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub fixedsystem_check_for_overlapping_dates {
|
||
|
|
|
||
|
|
my ($check_table,$checked_column,$date_from_input,$date_to_input,$sys_ids_input,$get_periods) = @_ ;
|
||
|
|
|
||
|
|
my %seen_system_id = () ; my %checked_system_id = () ; my %system_start_date = () ; my %system_end_date = () ;
|
||
|
|
|
||
|
|
my $sys_ids = "" ;
|
||
|
|
|
||
|
|
if ($get_periods) {
|
||
|
|
$sys_ids = $sys_ids_input ;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
foreach my $id (sort keys %{$db{$table}}) {
|
||
|
|
|
||
|
|
unless ($get_periods) {
|
||
|
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||
|
|
}
|
||
|
|
foreach (split(";",$sys_ids)) {
|
||
|
|
|
||
|
|
$system_start_date{$_}{$id} = $db{$table}{$id}{date_from} ;
|
||
|
|
$system_end_date{$_}{$id} = $db{$table}{$id}{date_to} ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($date_from_input and $date_to_input and $sys_ids_input) {
|
||
|
|
|
||
|
|
foreach (split(";",$sys_ids_input)) {
|
||
|
|
|
||
|
|
$system_start_date{$_}{-1} = $date_from_input ;
|
||
|
|
$system_end_date{$_}{-1} = $date_to_input ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
foreach my $id (sort keys %{$db{$table}}) {
|
||
|
|
|
||
|
|
unless ($get_periods) {
|
||
|
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||
|
|
}
|
||
|
|
|
||
|
|
foreach my $sys_id (split(";",$sys_ids)) {
|
||
|
|
|
||
|
|
next unless $sys_id ;
|
||
|
|
|
||
|
|
if ($seen_system_id{$sys_id} and not $checked_system_id{$sys_id}) {
|
||
|
|
|
||
|
|
$checked_system_id{$sys_id} = 1 ;
|
||
|
|
foreach my $id2 (keys %{$system_start_date{$sys_id}}) {
|
||
|
|
|
||
|
|
next if $id2 eq $id ;
|
||
|
|
my $t1 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 21<12
|
||
|
|
my $t2 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 22<12
|
||
|
|
my $t3 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 21<11
|
||
|
|
my $t4 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 22<11
|
||
|
|
|
||
|
|
if (($t1 and not $t2) or ($t3 and not $t4) or (not $t3 and $t2) or ($t3 and not $t2)) {
|
||
|
|
my $system_name = qq~$db{$check_table}{$sys_id}{name}~ ;
|
||
|
|
$system_name .= qq~ ($db{$check_table}{$sys_id}{description})~ if $db{$check_table}{$sys_id}{description} ;
|
||
|
|
|
||
|
|
if ($get_periods) {
|
||
|
|
$overlap_dates{$sys_id}{$id2} = "$db{$table}{$id2}{date_from} - $db{$table}{$id2}{date_to}" ;
|
||
|
|
} else {
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
noty({text:'System $system_name and cannot be used in both event $db{$table}{$id}{ref} and $db{$table}{$id2}{ref} as the times ovelap!!',layout:"center",type:"error",timeout:30000}) ;
|
||
|
|
~ ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
$seen_system_id{$sys_id} = 1 ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub fixed_systems_page_opts {
|
||
|
|
|
||
|
|
our $glyphicon = 'list' ;
|
||
|
|
our $lcpage = 'fixed-systems-report' ;
|
||
|
|
|
||
|
|
&common_page_name ;
|
||
|
|
|
||
|
|
our $table = 'event_quotes' ;
|
||
|
|
$page_title = 'Fixed Systems Report' ;
|
||
|
|
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub fixed_systems_report_screen {
|
||
|
|
|
||
|
|
|
||
|
|
our $lcol = 3 ;
|
||
|
|
our $fcol = 5 ;
|
||
|
|
|
||
|
|
$print_box_content_rows .= &common_min_forms_start('report') ;
|
||
|
|
|
||
|
|
my ($sql_next_day) = &common_add_delta_days(1) ;
|
||
|
|
my ($next_year,$next_month,$next_day) = split(/\-/,$sql_next_day) ;
|
||
|
|
|
||
|
|
$preferred_title{customer_id} = "Client" ;
|
||
|
|
# $selected{customer_id}{5} = 'SELECTED' if $glod_user_level < 4 ; # 5 = SuperSport Schools (Pty) Ltd
|
||
|
|
|
||
|
|
if ($is_installation_partner || $glob_custids{$userid}) {
|
||
|
|
foreach $_cust_id (keys %{$glob_custids{$userid}}) {
|
||
|
|
$filter_val{customers}{$_cust_id} = 1 ;
|
||
|
|
}
|
||
|
|
$filter_select_opts{customers} = 1 ;
|
||
|
|
}
|
||
|
|
|
||
|
|
&common_min_select_opts('customer_id','customers','name',5,'','','','','',"id,name",'name') ;
|
||
|
|
|
||
|
|
if ($is_schools_manager || $is_operator || $glob_regids{$userid}) {
|
||
|
|
foreach $_reg_id (keys %{$glob_regids{$userid}}) {
|
||
|
|
$filter_val{regions}{$_reg_id} = 1 ;
|
||
|
|
}
|
||
|
|
$filter_select_opts{regions} = 1 ;
|
||
|
|
}
|
||
|
|
|
||
|
|
$opts{region_id} .= qq~<option value="all" SELECTED>All</option>~ ;
|
||
|
|
&common_min_select_opts('region_id','regions','name','','','code','','','',"id,code,name",'name') ;
|
||
|
|
|
||
|
|
$selected{overall_status}{all} = 'SELECTED' ;
|
||
|
|
$opts{overall_status} .= qq~<option value="all" $selected{overall_status}{all} >All</option>~ ;
|
||
|
|
$preferred_title{overall_status} = "Status" ;
|
||
|
|
&common_min_select_opts('overall_status','fixed_system_status','status','',0,'','','','',"",'name') ;
|
||
|
|
|
||
|
|
$print_box_content_rows .= &common_min_form_select('customer_id','') ;
|
||
|
|
$print_box_content_rows .= &common_min_form_select('region_id','') ;
|
||
|
|
|
||
|
|
&common_min_select_opts('system_id','event_systems','name','','','description','','','','','name') ;
|
||
|
|
$print_box_content_rows .= &common_min_form_select('system_id','') ;
|
||
|
|
|
||
|
|
$print_box_content_rows .= &common_min_form_datepicker('date_from',"$next_year-$next_month-$next_day") ; #unless $i{date_from} ;
|
||
|
|
$print_box_content_rows .= &common_min_form_datepicker('date_to',"$next_year-$next_month-$next_day") ;
|
||
|
|
$print_box_content_rows .= &common_min_form_select('overall_status','') ;
|
||
|
|
|
||
|
|
$print_box_content_rows .= &common_min_forms_end('','','report') ;
|
||
|
|
|
||
|
|
&common_min_search_screen ;
|
||
|
|
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub fixed_systems_screen3 {
|
||
|
|
|
||
|
|
$custom_column_styles{online_status} = qq~style="width:9%;min-width:120px;"~ ;
|
||
|
|
$custom_column_styles{network_test} = $custom_column_styles{online_status} ;
|
||
|
|
$custom_column_styles{system_test} = $custom_column_styles{online_status} ;
|
||
|
|
$custom_column_styles{test_event} = $custom_column_styles{online_status} ;
|
||
|
|
$custom_column_styles{sound_test} = $custom_column_styles{online_status} ;
|
||
|
|
$custom_column_styles{overall_status} = $custom_column_styles{online_status} ;
|
||
|
|
$custom_column_styles{additional_comments} = $custom_column_styles{online_status} ;
|
||
|
|
|
||
|
|
&thead;
|
||
|
|
|
||
|
|
if ($isaved) { $alert = &common_min_alert('success',"$ucpage $isaved!",'ok') ; } else { &common_min_alert_type ; }
|
||
|
|
|
||
|
|
# my $page = "$lcpage\s" ;
|
||
|
|
|
||
|
|
my $page = "event-quotes" ;
|
||
|
|
|
||
|
|
if ($s{no}) { $page = $lcpage ; }
|
||
|
|
|
||
|
|
&common_min_table('id',$page,'list') ;
|
||
|
|
|
||
|
|
our $savjqy = 1 ;
|
||
|
|
|
||
|
|
$extra_form_fields .= qq~
|
||
|
|
<input type="hidden" name="date_from" value="$i{date_from}">
|
||
|
|
<input type="hidden" name="date_to" value="$i{date_to}">
|
||
|
|
<input type="hidden" name="region_id" value="$i{region_id}">
|
||
|
|
<input type="hidden" name="customer_id" value="$i{customer_id}">
|
||
|
|
<input type="hidden" name="overall_status" value="$i{overall_status}">~;
|
||
|
|
|
||
|
|
$print_box_content_rows .= &common_min_forms_end('','','save') ;
|
||
|
|
|
||
|
|
$useropts{'common'}{'css'} .= qq~tbody tr td { font-size: 10px; } ~ ;
|
||
|
|
|
||
|
|
require _blank ;
|
||
|
|
|
||
|
|
exit ;
|
||
|
|
|
||
|
|
} #-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
1 ;
|