710 lines
38 KiB
Perl
710 lines
38 KiB
Perl
|
|
sub logistics_load_db_vars {
|
||
|
|
|
||
|
|
&db_min_ro('organisations','*',"",'','') ;
|
||
|
|
&db_min_ro('logistics_locations','*',"",'','') ;
|
||
|
|
&db_min_ro('logistics_suppliers','*',"active = '1'",'','') ;
|
||
|
|
&db_min_ro('logistics_items','*',"",'','') ;
|
||
|
|
&db_min_ro('event_systems','id,logistics_location_id',"(`system_type` = 'mobile' OR `system_type` = 'solo' OR `description` lIKE 'cricket%')",'','') ;
|
||
|
|
|
||
|
|
foreach (keys %i) {
|
||
|
|
local @abc = split("_",$_) ;
|
||
|
|
if (substr($_,0,7) eq 'update_') {
|
||
|
|
$seen_event_id{$abc[-1]} = 1 ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
# create_waybill_out_5136
|
||
|
|
local @event_ids = () ;
|
||
|
|
foreach (keys %seen_event_id) {
|
||
|
|
push @event_ids , "`id` = '$_'" ;
|
||
|
|
}
|
||
|
|
local $e_q_sql = join (" OR ",@event_ids) ;
|
||
|
|
|
||
|
|
&db_min_ro($table,'id,event_system_id_multiple,logistics_suppliers,logistics_waybill_nrs,logistics_status_ids,logistics_venue_id,logistics_item_ids,poc_id,recipient_id,logistics_special_instructions,logistics_complete,logistics_dcb_waybill,date_from,date_to,logistics_delivery_datetime,logistics_received_by,logistics_location_other,logistics_system_location_id,logistics_last_changed_by,logistics_dcb_comments,logistics_shipment_operator_id',"$e_q_sql",'','') ;
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_dates {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
$nowrap = 'nowrap' ;
|
||
|
|
my ($year1,$month1,$day1) = split(/\-/,substr($db{$table}{$id}{date_from},0,10)) ;
|
||
|
|
my ($year2,$month2,$day2) = split(/\-/,substr($db{$table}{$id}{date_to},0,10)) ;
|
||
|
|
$val = qq~~ ;
|
||
|
|
if ($year1 ne $year2 && $month1 ne $month2 && $day1 ne $day2) {
|
||
|
|
$val = qq~ $day1 $month_names[$month1] $year1 -<br>$day2 $month_names[$month2] $year2~ ;
|
||
|
|
} elsif ($year1 eq $year2 && $month1 ne $month2) {
|
||
|
|
$val = qq~ $day1 $month_names[$month1] -<br>$day2 $month_names[$month2] $year2~ ;
|
||
|
|
} elsif ($year1 eq $year2 && $month1 eq $month2 && $day1 ne $day2) {
|
||
|
|
$val = qq~ $day1 - $day2 $month_names[$month2] $year2~ ;
|
||
|
|
} elsif ($year1 eq $year2 && $month1 eq $month2 && $day1 eq $day2) {
|
||
|
|
$val = qq~ $day2 $month_names[$month2] $year2~ ;
|
||
|
|
}
|
||
|
|
my $stime = substr($db{$table}{$id}{date_from},11,5) ;
|
||
|
|
my $etime = substr($db{$table}{$id}{date_to},11,5) ;
|
||
|
|
$valxlsx = $val ;
|
||
|
|
$valxlsx =~ s/<br>//g ;
|
||
|
|
# $val = qq~<a href='#' title data-toggle="tooltip" data-placement="top" data-original-title="Start Time : $stime<br>End Time : $etime">$val</a>~ ;
|
||
|
|
|
||
|
|
# &xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol+1,$stime,$formatting) ;
|
||
|
|
# &xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol+2,$etime,$formatting) ;
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_venue {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
$val = '' ; $nowrap = 'nowrap' ;
|
||
|
|
foreach my $_oid (@venue_ids) {
|
||
|
|
$val .= qq~$db{organisations}{$_oid}{name}~ ;
|
||
|
|
$val .= qq~ [$db{organisations}{$_oid}{region_code}]~ if $db{organisations}{$_oid}{region_code} ;
|
||
|
|
$val .= ',' ;
|
||
|
|
}
|
||
|
|
$val = substr($val,0,-1) if $val ;
|
||
|
|
$valxlsx = $val ;
|
||
|
|
$valxlsx =~ s/\,/\;/g ;
|
||
|
|
if (length($val) > 30) {
|
||
|
|
$val =~ s/\,/\<br>/g ;
|
||
|
|
$val = substr($val,0,27) . qq~<i class="glyphicons glyphicons-more" title data-toggle="tooltip" data-placement="top" data-original-title="$val"></i>~ ;
|
||
|
|
} else {
|
||
|
|
$val =~ s/\,/\<br>/g ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_system {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
$val = '' ; my $tooltip = '' ;
|
||
|
|
|
||
|
|
foreach my $event_sys_id (@system_name_ids) {
|
||
|
|
next unless $event_sys_id ;
|
||
|
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||
|
|
$system_count++ ;
|
||
|
|
$tooltip .= qq~<br>$db{event_systems}{$event_sys_id}{name}~ ;
|
||
|
|
$tooltip .= qq~ [$db{event_systems}{$event_sys_id}{description}]~ if $db{event_systems}{$event_sys_id}{description} ;
|
||
|
|
}
|
||
|
|
|
||
|
|
$tooltip = substr($tooltip,4) if $tooltip ;
|
||
|
|
$val = $tooltip ;
|
||
|
|
# $val = ($system_count > 1) ? qq~<i class="glyphicons glyphicons-laptop" title data-toggle="tooltip" data-placement="top" data-original-title="$tooltip"></i>~ : ($system_count == 1) ? qq~<i class="glyphicons glyphicons-facetime-video" title data-toggle="tooltip" data-placement="top" data-original-title="$tooltip"></i>~ : "" ;
|
||
|
|
$valxlsx = $tooltip ;
|
||
|
|
$valxlsx =~ s/\<br>/\;/g ;
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_from_to {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||
|
|
|
||
|
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||
|
|
$found_editable = 1 ;
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{1},#$ucfirstfield{2}").chosen({allow_single_deselect:true}) ; ~ ;
|
||
|
|
|
||
|
|
my $col_venue = ($from_to eq 'to') ? 10 : 11 ;
|
||
|
|
my $col_log_loc = ($from_to eq 'to') ? 11 : 10 ;
|
||
|
|
|
||
|
|
if (($_ eq 'to' && $from_to eq 'to') || ($_ eq 'from' && $iaction eq 'report_from')) { # && $iaction eq 'report') || ($_ eq 'from' && $_ eq 'report_from')
|
||
|
|
$val = qq~
|
||
|
|
<select class="form-control" name="$field{1}" id="$ucfirstfield{1}" data-placeholder="Select $preferred_title{$field{1}}" data-rel="chosen">
|
||
|
|
<option value=""></option>
|
||
|
|
$opts{venue_location}{$db{$table}{$id}{region_id}}
|
||
|
|
</select>
|
||
|
|
~ ;
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_venue)").css("z-index","$cali_cnt") ;
|
||
|
|
~ ;
|
||
|
|
if ($db{$table}{$id}{logistics_venue_id}) {
|
||
|
|
$valxlsx = "$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{name} [$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code}]" if $db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code} ;
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{1}").val("$db{$table}{$id}{logistics_venue_id}") ;
|
||
|
|
~ ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{1}" if $ucfirstfield{1} ;
|
||
|
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_venue)" ;
|
||
|
|
|
||
|
|
$default_javascript .= qq~"$field{1}":"$db{$table}{$id}{logistics_venue_id}",~ ;
|
||
|
|
} elsif ($venue_ids[0]) {
|
||
|
|
$valxlsx = "$db{organisations}{$venue_ids[0]}{name} [$db{organisations}{$venue_ids[0]}{region_code}]" if $db{organisations}{$venue_ids[0]}{region_code} ;
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{1}").val("$venue_ids[0]") ;
|
||
|
|
~ ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{1}" if $ucfirstfield{1} ;
|
||
|
|
$default_javascript .= qq~"$field{1}":"$venue_ids[0]",~ ;
|
||
|
|
} else {
|
||
|
|
$default_javascript .= qq~"$field{1}":"",~ ;
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
$val = qq~
|
||
|
|
<select class="form-control" name="$field{2}" id="$ucfirstfield{2}" data-placeholder="Select $preferred_title{$field{2}}" data-rel="chosen">
|
||
|
|
<option value=""></option>
|
||
|
|
$opts{system_location}
|
||
|
|
</select>
|
||
|
|
~ ;
|
||
|
|
my $found_loc = 0 ;
|
||
|
|
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_log_loc)").css("z-index","$cali_cnt") ;
|
||
|
|
~ ;
|
||
|
|
foreach my $event_sys_id (@system_name_ids) {
|
||
|
|
next unless $event_sys_id ;
|
||
|
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||
|
|
if ($db{event_systems}{$event_sys_id}{logistics_location_id}) {
|
||
|
|
$valxlsx = $db{logistics_locations}{$db{event_systems}{$event_sys_id}{logistics_location_id}}{location} ;
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{2}").val("$db{event_systems}{$event_sys_id}{logistics_location_id}") ;
|
||
|
|
~ ;
|
||
|
|
$found_loc = 1 ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||
|
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_log_loc)" ;
|
||
|
|
$default_javascript .= qq~"$field{2}":"$db{event_systems}{$event_sys_id}{logistics_location_id}",~ ;
|
||
|
|
}
|
||
|
|
last ;
|
||
|
|
}
|
||
|
|
if (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Johannesburg/) {
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{2}").val("1") ;
|
||
|
|
~ ;
|
||
|
|
$default_javascript .= qq~"$field{2}":"1",~ ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||
|
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Cape Town/) {
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{2}").val("2") ;
|
||
|
|
~ ;
|
||
|
|
$default_javascript .= qq~"$field{2}":"2",~ ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||
|
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Durban/) {
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{2}").val("3") ;
|
||
|
|
~ ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||
|
|
$default_javascript .= qq~"$field{2}":"3",~ ;
|
||
|
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Bloemfontein/) {
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{2}").val("4") ;
|
||
|
|
~ ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||
|
|
$default_javascript .= qq~"$field{2}":"4",~ ;
|
||
|
|
} elsif (!$found_loc) {
|
||
|
|
$default_javascript .= qq~"$field{2}":"",~ ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
push @dropdown_chosen_ids,"#$ucfirstfield{1}\_chosen,#$ucfirstfield{2}\_chosen" if $ucfirstfield{1} && $ucfirstfield{2} ;
|
||
|
|
} else {
|
||
|
|
if (($_ eq 'to' && $from_to eq 'to') || ($_ eq 'from' && $iaction eq 'report_from')) {
|
||
|
|
if ($db{$table}{$id}{logistics_venue_id}) {
|
||
|
|
$val = qq~$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{name}~ ;
|
||
|
|
$val .= qq~ [$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code}]~ if $db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code} ;
|
||
|
|
} elsif ($venue_ids[0]) {
|
||
|
|
$val = qq~$db{organisations}{$venue_ids[0]}{name}~ ;
|
||
|
|
$val .= qq~ [$db{organisations}{$venue_ids[0]}{region_code}]~ if $db{organisations}{$venue_ids[0]}{region_code} ;
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
my $found_loc = 0 ;
|
||
|
|
foreach my $event_sys_id (@system_name_ids) {
|
||
|
|
next unless $event_sys_id ;
|
||
|
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||
|
|
if ($db{event_systems}{$event_sys_id}{logistics_location_id}) {
|
||
|
|
$val = $db{logistics_locations}{$db{event_systems}{$event_sys_id}{logistics_location_id}}{location} ;
|
||
|
|
$found_loc = 1 ;
|
||
|
|
last ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Johannesburg/) {
|
||
|
|
$val = $db{logistics_locations}{1}{location} ;
|
||
|
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Cape Town/) {
|
||
|
|
$val = $db{logistics_locations}{2}{location} ;
|
||
|
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Durban/) {
|
||
|
|
$val = $db{logistics_locations}{3}{location} ;
|
||
|
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Bloemfontein/) {
|
||
|
|
$val = $db{logistics_locations}{4}{location} ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
$valxlsx = $val ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_supplier {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||
|
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||
|
|
$found_editable = 1 ;
|
||
|
|
$preferred_title{$field{supplier}} = "Supplier" ;
|
||
|
|
$opts{$field{supplier}} = $opts{logistics_supplier} ;
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{supplier}").chosen({ allow_single_deselect:true });~ ;
|
||
|
|
$val = qq~<select class="form-control" name="$field{supplier}" id="$ucfirstfield{supplier}" data-placeholder="Select $preferred_title{$field{supplier}}" data-rel="chosen">
|
||
|
|
<option value=""></option>
|
||
|
|
$opts{$field{supplier}}
|
||
|
|
</select>~ ;
|
||
|
|
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)").css("z-index","$cali_cnt") ;
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
if ($logistics_supplier_ids_hash{$id}{$from_to}) {
|
||
|
|
$valxlsx = $db{logistics_suppliers}{$logistics_supplier_ids_hash{$id}{$from_to}}{supplier} ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{supplier}" if $ucfirstfield{supplier} ;
|
||
|
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)" ;
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{supplier}").val("$logistics_supplier_ids_hash{$id}{$from_to}") ;
|
||
|
|
// \$("#$ucfirstfield{supplier}").trigger("chosen:updated") ;
|
||
|
|
// \$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)").css("background-color","#424949") ;
|
||
|
|
~ ;
|
||
|
|
}
|
||
|
|
push @dropdown_chosen_ids,"#$ucfirstfield{supplier}\_chosen" if $ucfirstfield{supplier} ;
|
||
|
|
} elsif ($logistics_supplier_ids_hash{$id}{$from_to}) {
|
||
|
|
$val = $db{logistics_suppliers}{$logistics_supplier_ids_hash{$id}{$from_to}}{supplier} ;
|
||
|
|
$valxlsx = $val ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_status {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
local %status_hash = (1 =>"Booked",2 => "Pending",3=>"In Transit",4 =>"Delivered") ;
|
||
|
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||
|
|
# if (($from_to eq 'to' && $current_date <= $end_date) || ($from_to eq 'from' && $current_date <= $start_date)) {
|
||
|
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||
|
|
$found_editable = 1 ;
|
||
|
|
$preferred_title{$field{status}} = "Status" ;
|
||
|
|
$opts{$field{status}} = $opts{status} ;
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{status}").chosen({ allow_single_deselect:true });~ ;
|
||
|
|
$val = qq~<select class="form-control" name="$field{status}" id="$ucfirstfield{status}" data-placeholder="Select $preferred_title{$field{status}}" data-rel="chosen">
|
||
|
|
<option value=""></option>
|
||
|
|
$opts{$field{status}}
|
||
|
|
</select>~ ;
|
||
|
|
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("z-index","$cali_cnt") ;
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
$val = &common_min_form_select_col($field{status},'') ; ########### >= OR >
|
||
|
|
if ($logistics_status_ids_hash{$id}{$from_to}) {
|
||
|
|
$valxlsx = $status_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{status}").val("$logistics_status_ids_hash{$id}{$from_to}") ;
|
||
|
|
// \$("#$ucfirstfield{status}").trigger("chosen:updated") ;
|
||
|
|
~ ;
|
||
|
|
$default_javascript .= qq~"$field{status}":"$logistics_status_ids_hash{$id}{$from_to}",~ ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{status}" if $ucfirstfield{status} ;
|
||
|
|
if ($logistics_status_ids_hash{$id}{$from_to} eq '1') { #Booked
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(81,203,242)") ; ~ ;
|
||
|
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '2') { #Pending
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(66,73,73)") ; ~ ;
|
||
|
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '3') { #In Transit
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(255,165,0) ") ; ~ ;
|
||
|
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '4') { #Delivered
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(46,204,113)") ; ~ ;
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
$default_javascript .= qq~"$field{status}":"2",~ ;
|
||
|
|
}
|
||
|
|
push @dropdown_chosen_ids,"#$ucfirstfield{status}\_chosen" if $ucfirstfield{status} ;
|
||
|
|
} elsif ($logistics_status_ids_hash{$id}{$from_to}) {
|
||
|
|
$val = $logistics_status_ids_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||
|
|
$valxlsx = $status_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_waybill_nr {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
my $fname = 'waybill_nr' ; $val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||
|
|
my $wb_code = 'AIS' . uc substr($from_to,0,1) . '_' ;
|
||
|
|
|
||
|
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||
|
|
$found_editable = 1 ;
|
||
|
|
my $print_field = &common_min_print_field($field{$fname}) ; $tindex++ ;
|
||
|
|
my $wb_nr = ($logistics_waybill_ids_hash{$id}{$from_to}) ? $logistics_waybill_ids_hash{$id}{$from_to} : $wb_code . $id ;
|
||
|
|
$default_javascript .= qq~"$field{$fname}":"$wb_nr",~ ;
|
||
|
|
$val = qq~<div class="control-group"><div class='controls'><input type='text' class='form-control' name='$field{$fname}' id='$ucfirstfield{$fname}' placeholder='$print_field' value="$wb_nr" tabindex="$tindex">
|
||
|
|
</div></div>~ ;
|
||
|
|
$valxlsx = $wb_nr ;
|
||
|
|
$trigger_jquery .= qq~ \$("#$ucfirstfield{$fname}").css("width","100%") ;~ ;
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(7)").css("background-color","#424949") ; ~ if $logistics_waybill_ids_hash{$id}{$from_to} ;
|
||
|
|
} else {
|
||
|
|
$val = ($logistics_waybill_ids_hash{$id}{$from_to}) ? $logistics_waybill_ids_hash{$id}{$from_to} : (!$readlonly_row) ? $id : "" ;
|
||
|
|
print "\n logistics_waybill_nr" ;
|
||
|
|
$valxlsx = $val ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_item {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||
|
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||
|
|
|
||
|
|
$all_ids .= qq~,$id~ ;
|
||
|
|
$found_editable = 1 ;
|
||
|
|
$preferred_title{$field{item}} = "Item" ;
|
||
|
|
$opts{$field{item}} = $opts{logistics_items} ;
|
||
|
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{item}").chosen({ allow_single_deselect:true });~ ;
|
||
|
|
|
||
|
|
if ($logistics_item_ids_hash{$id}) {
|
||
|
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(6)" ;
|
||
|
|
foreach my $item_id (split(/\,/,$logistics_item_ids_hash{$id})) {
|
||
|
|
next unless $item_id ;
|
||
|
|
$opts{$field{item}} =~ s/\Q"$item_id"/"$item_id" SELECTED/g ;
|
||
|
|
}
|
||
|
|
$valxlsx = join (';', map { $db{logistics_items}{$_}{name} } split /,/, $logistics_item_ids_hash{$id});
|
||
|
|
}
|
||
|
|
|
||
|
|
$val = qq~
|
||
|
|
<select class="form-control" name="$field{item}" id="$ucfirstfield{item}" multiple data-placeholder="Select $preferred_title{$field{item}}" data-rel="chosen">
|
||
|
|
<option value=""></option>
|
||
|
|
$opts{$field{item}}
|
||
|
|
</select>
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~ \$("#$ucfirstfield{item}\_chosen").css("width","100%") ;~ if $ucfirstfield{item} ;
|
||
|
|
|
||
|
|
$extra_form_fields .= qq~<input type="hidden" name="item$id" id="item-$id" value="">~;
|
||
|
|
|
||
|
|
$jquery_chosen_sel .= qq~
|
||
|
|
item_val = \$("#selectItem_$id").chosen().val() ;
|
||
|
|
\$('#item-$id').val(item_val) ;
|
||
|
|
~ ;
|
||
|
|
} elsif ($logistics_item_ids_hash{$id}) {
|
||
|
|
$val = join (',', map { $db{logistics_items}{$_}{name} } split /,/, $logistics_item_ids_hash{$id});
|
||
|
|
$valxlsx = $val ;
|
||
|
|
$valxlsx =~ s/\,/\;/g ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_poc {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||
|
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||
|
|
$found_editable = 1 ;
|
||
|
|
$preferred_title{$field{poc}} = "poc" ;
|
||
|
|
$opts{$field{poc}} = $opts{poc}{$id} ;
|
||
|
|
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{poc}").chosen({ allow_single_deselect:true }) ; \$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(5)").css("z-index","$cali_cnt") ;
|
||
|
|
~ ;
|
||
|
|
$val = qq~
|
||
|
|
<select class="form-control" name="$field{poc}" id="$ucfirstfield{poc}" data-placeholder="Select $preferred_title{$field{poc}}" data-rel="chosen">
|
||
|
|
<option value=""></option>
|
||
|
|
$opts{$field{poc}}
|
||
|
|
</select>
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
if ($logistics_poc_hash{$id}) {
|
||
|
|
$valxlsx = $logistics_poc_hash{$id} ;
|
||
|
|
$valxlsx =~ s/\_/ \[/g ;
|
||
|
|
$valxlsx .= qq~]~ ;
|
||
|
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(5)" ;
|
||
|
|
push @selects_with_default_ids,"#$ucfirstfield{poc}" ;
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$ucfirstfield{poc}").val("$logistics_poc_hash{$id}") ;
|
||
|
|
~ ;
|
||
|
|
$default_javascript .= qq~"$field{poc}":"$logistics_poc_hash{$id}",~ ;
|
||
|
|
} else {
|
||
|
|
$default_javascript .= qq~"$field{poc}":"",~ ;
|
||
|
|
}
|
||
|
|
push @dropdown_chosen_ids,"#$ucfirstfield{poc}\_chosen" if $ucfirstfield{poc} ;
|
||
|
|
|
||
|
|
} elsif ($logistics_poc_hash{$id}) {
|
||
|
|
$val = $logistics_poc_hash{$id} ;
|
||
|
|
$val =~ s/\_/\[/g ;
|
||
|
|
$val .= qq~]~ ;
|
||
|
|
$valxlsx = $val ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_special_instructions {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||
|
|
# if (($from_to eq 'to' && $current_date <= $end_date) || ($from_to eq 'from' && $current_date <= $start_date)) {
|
||
|
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||
|
|
$found_editable = 1 ;
|
||
|
|
my $print_field = &common_min_print_field($field{special_instructions}) ;
|
||
|
|
$tindex++ ;
|
||
|
|
|
||
|
|
my $defualt = ($logistics_special_instructions_hash{$id}{$from_to}) ? $logistics_special_instructions_hash{$id}{$from_to} : "" ;
|
||
|
|
|
||
|
|
$valxlsx = $defualt if $defualt ;
|
||
|
|
$val = qq~
|
||
|
|
<div class="control-group">
|
||
|
|
<div class='controls'>
|
||
|
|
<textarea type='text' class='form-control' name='$field{special_instructions}' id='$ucfirstfield{special_instructions}' placeholder='$print_field' value="$defualt" tabindex="$tindex">$defualt</textarea>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$ucfirstfield{special_instructions}").css("width","100%") ;
|
||
|
|
~ ;
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(4)").css("background-color","#424949") ;
|
||
|
|
~ if $logistics_special_instructions_hash{$id}{$from_to} ;
|
||
|
|
} elsif ($logistics_special_instructions_hash{$id}{$from_to}) {
|
||
|
|
$val = $logistics_special_instructions_hash{$id}{$from_to} ;
|
||
|
|
$valxlsx = $val ;
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_create_waybill {
|
||
|
|
|
||
|
|
my ($from_to,$id) = @_ ;
|
||
|
|
|
||
|
|
# if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||
|
|
if (!$readlonly_row) {
|
||
|
|
|
||
|
|
$ignore{"$_\_$id"} = 1 ;
|
||
|
|
$valxlsx = '' ;
|
||
|
|
|
||
|
|
# if ($_ eq 'process_complete') {
|
||
|
|
# $val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||
|
|
# } elsif (!$dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $items && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||
|
|
|
||
|
|
if ($logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) {
|
||
|
|
# if ($waybill_nr_default_val && $item_default_val && $supplier_default_val == 2) {
|
||
|
|
if ($dcb_waybill_nr{$from_to}) {
|
||
|
|
my $arrow_class = ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to}) ? 'success' : 'danger' ;
|
||
|
|
my $arrow_direction = ($from_to eq 'to') ? 'right' : 'left' ;
|
||
|
|
my $dlg = qq~javascript:dlgMdl('$useropts{'scripts'}/dialog/dcb_trackntrace.pl?debug=1&waybillnr~;
|
||
|
|
my $uc_from_to = uc $from_to ;
|
||
|
|
$val = qq~<a class="btn btn-$arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{$from_to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace $uc_from_to Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-$arrow_direction"></i></a>~ ;
|
||
|
|
$nowrap = 'nowrap' ;
|
||
|
|
} else {
|
||
|
|
$val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||
|
|
}
|
||
|
|
} elsif ($waybill_nr_default_val && $item_default_val && $supplier_default_val == 2) {
|
||
|
|
$val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||
|
|
} else {
|
||
|
|
|
||
|
|
my $tool_tip = qq~~ ;
|
||
|
|
|
||
|
|
$tool_tip .= qq~<br><b>- Add WayBillNr</b>~ unless $waybill_nr_default_val ;
|
||
|
|
$tool_tip .= qq~<br><b>- Add Item(s)</b>~ unless $item_default_val ;
|
||
|
|
$tool_tip .= qq~<br><b>- Set Supplier to DCB</b>~ if $supplier_default_val != 2 ;
|
||
|
|
|
||
|
|
$val = qq~<i class="glyphicon glyphicon-remove" data-toggle='tooltip' data-placement='left' data-title='Before sending to DCB:$tool_tip'></i>~ ;
|
||
|
|
}
|
||
|
|
|
||
|
|
# # # if (!$dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||
|
|
# # # $val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||
|
|
# # # } elsif ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||
|
|
|
||
|
|
# # # my $arrow_class = ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to}) ? 'success' : 'danger' ;
|
||
|
|
# # # # my $to_arrow_class = ($dcb_waybill_nr{to} && $logistics_waybill_ids_hash{$id}{to}) ? 'success' : 'danger' ;
|
||
|
|
# # # # my $from_arrow_class = ($dcb_waybill_nr{from} && $logistics_waybill_ids_hash{$id}{from}) ? 'success' : 'danger' ;
|
||
|
|
|
||
|
|
# # # my $arrow_direction = ($from_to eq 'to') ? 'rigth' : 'left' ;
|
||
|
|
|
||
|
|
# # # my $dlg = qq~javascript:dlgMdl('$useropts{'scripts'}/dialog/dcb_trackntrace.pl?debug=1&waybillnr~;
|
||
|
|
|
||
|
|
# # # my $uc_from_to = uc $from_to ;
|
||
|
|
|
||
|
|
# # # $val = qq~<a class="btn btn-$arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{$from_to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace $uc_from_to Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-$arrow_direction"></i></a>~ ;
|
||
|
|
# # # # $val = qq~<a class="btn btn-$to_arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace TO Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-right"></i></a>
|
||
|
|
# # # # <a class="btn btn-$from_arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{from}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace FROM Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-left"></i></a>~ ;
|
||
|
|
# # # $nowrap = 'nowrap' ;
|
||
|
|
# # # } else {
|
||
|
|
# # # $val = qq~<i class="glyphicon glyphicon-remove" data-toggle='tooltip' data-placement='left' data-title='Before sending to DCB:<br><b>- Add WayBillNr</b><br><b>- Add Item(s)</b><br><b>- Set Supplier to DCB</b>'></i>~ ;
|
||
|
|
# # # }
|
||
|
|
}
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub logistics_jquery {
|
||
|
|
|
||
|
|
my ($from_to) = @_ ;
|
||
|
|
|
||
|
|
foreach my $system_id (keys %seen_system_cnt) {
|
||
|
|
chop $all_location_ids_per_system{$system_id} if $all_location_ids_per_system{$system_id} ;
|
||
|
|
}
|
||
|
|
|
||
|
|
my $update_ids_str = join(',',@update_ids) ;
|
||
|
|
my $selects_with_default_ids_str = join(',',@selects_with_default_ids) ;
|
||
|
|
my $table_with_default_ids_str = join(',',@table_with_default_ids) ;
|
||
|
|
my $dropdown_chosen_ids_str = join(',',@dropdown_chosen_ids) ;
|
||
|
|
# <span title data-toggle="tooltip" data-original-title="System in use!">
|
||
|
|
my $plus_item = ($is_dcb_partner) ? qq~<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved items to see all options once the page is saved again!'>ITEM</span>~ : qq~<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved items to see all options once the page is saved!'>ITEM</span><a href=javascript:dlgMdl('$useropts{'scripts'}/dialog/add_logistics_item.pl?add&$all_ids&$from_to','Add Item','','medium-dialog'); class='btn btn-primary btn-xs' style='padding:0px 2px 0px 3px;margin-top:0px;margin-left:75%;' title='Add Item' data-toggle='tooltip' data-placement='top'><i class='glyphicon glyphicon-plus' style='padding:0;margin-top:0px;top:0px;'></i></a>~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").html("$plus_item") ;
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").html("<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved venues to see all options once the page is saved again!'>FROM</span>") ;
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").html("<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved venues to see all options once the page is saved again!'>TO</span>") ;
|
||
|
|
\$('[data-toggle="tooltip"]').tooltip({
|
||
|
|
container: 'body'
|
||
|
|
});
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
my $plus_poc = ($is_dcb_partner) ? 'POC' : qq~POC<a href=javascript:dlgMdl('$useropts{'scripts'}/dialog/add_poc.pl?add&$i{date_from}&$i{date_to}&$i{client_id}&$i{organisation_ids}&$i{supplier_id}&$i{status_id}&$i{region_id}&$from_to','Add POC','','medium-dialog'); class='btn btn-primary btn-xs' style='padding:0px 2px 0px 3px;margin-top:0px;margin-left:50%;' title='Add POC' data-toggle='tooltip' data-placement='top'><i class='glyphicon glyphicon-plus' style='padding:0;margin-top:0px;top:0px;'></i></a>~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").html("$plus_poc") ;
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
my $icon = qq~~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$useropts{table_id}_wrapper").css("overflow","scroll");
|
||
|
|
\$("#$useropts{table_id}_wrapper").css("height","60vh");
|
||
|
|
// \$("#$useropts{table_id}_wrapper").css("overflow-y","hidden");
|
||
|
|
\$("#$useropts{table_id}").css("width","175%") ;
|
||
|
|
\$("#$useropts{table_id}").css("max-width","175%");
|
||
|
|
\$("#$useropts{table_id} tr th").slice(-3, -1).css("width","0%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child(1)").css("width","0%");
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
# if ($from_to eq 'to') {
|
||
|
|
|
||
|
|
# $icon = qq~<a href=javascript:selectAll(1); style='color:black;'><i class='glyphicons glyphicons-disk-open' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill Out'></i></a>~ ;
|
||
|
|
|
||
|
|
# $trigger_jquery .= qq~
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child(3)").html("$icon") ;
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child(3) .glyphicons-disk-open").tooltip();
|
||
|
|
# ~ ;
|
||
|
|
|
||
|
|
# $trigger_jquery .= qq~
|
||
|
|
# \$("#$useropts{table_id} tr th").slice(-7, -3).css("width","7.5%");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("width","13%");
|
||
|
|
# \$("#$useropts{table_id} tr th").slice(-15, -10).css("width","7.5%");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("width","4%");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("width","4.5%");
|
||
|
|
# ~ ;
|
||
|
|
|
||
|
|
# $icon = qq~<a href=javascript:selectAll(4); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||
|
|
|
||
|
|
# } else {
|
||
|
|
|
||
|
|
# $icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-save' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill In'></i></a>~ ;
|
||
|
|
# $icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-save' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill'></i></a>~ ;
|
||
|
|
|
||
|
|
# $trigger_jquery .= qq~
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child(3)").html("$icon") ;
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child(3) .glyphicons-disk-save").tooltip();
|
||
|
|
# ~ ;
|
||
|
|
|
||
|
|
# foreach (keys %last_child) { $trigger_jquery .= qq~\$("#$useropts{table_id} tr th:nth-last-child($last_child{$_})").css("width","7.5%");~ ; }
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_from})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_to})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{system})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{supplier})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").css("width","7%");
|
||
|
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("width","16%");
|
||
|
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("width","4%");
|
||
|
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("width","4.5%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{special_instructions})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_special_instructions})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{waybill_nr})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{status})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{received_by})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{dcb_comments})").css("width","7%");
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{shipment_operator})").css("width","7%");
|
||
|
|
~ ;
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_from})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_to})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{system})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{supplier})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("min-width","320px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("max-width","320px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("min-width","105px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("max-width","105px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("max-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{special_instructions})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_special_instructions})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{waybill_nr})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{status})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{received_by})").css("min-width","120px");
|
||
|
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{dcb_comments})").css("min-width","120px");
|
||
|
|
# ~ ;
|
||
|
|
|
||
|
|
# $icon = qq~<a href=javascript:selectAll(3); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||
|
|
# }
|
||
|
|
|
||
|
|
# $icon = ($from_to eq 'from') ? qq~<a href=javascript:selectAll(3); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ : qq~<a href=javascript:selectAll(4); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||
|
|
|
||
|
|
$icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-open' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill'></i></a>~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child(2)").html("$icon").trigger("chosen:updated") ;
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child(2) .glyphicons-disk-open").tooltip();
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
$icon = qq~<i class='glyphicons glyphicons-ok' title data-toggle='tooltip' data-placement='top' data-original-title='Update'></i>~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child(1)").html("$icon") ;
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child(1) .glyphicons-ok").tooltip() ;
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
chop $quote_and_ops_ids if $quote_and_ops_ids ;
|
||
|
|
|
||
|
|
$trigger_jquery_raw .= qq~
|
||
|
|
function selectAll(col) {
|
||
|
|
|
||
|
|
let from_to = \$("#from_to").text() ;
|
||
|
|
let col_id = "" ;
|
||
|
|
if (col == '1') {
|
||
|
|
col_id = "create_waybill_out_" ;
|
||
|
|
} else if (col == '2') {
|
||
|
|
col_id = "create_waybill_in_" ;
|
||
|
|
}
|
||
|
|
// else if (col == '3') {
|
||
|
|
// col_id = "process_complete_from_" ;
|
||
|
|
// } else if (col == '4') {
|
||
|
|
// col_id = "process_complete_to_" ;
|
||
|
|
// }
|
||
|
|
let jsObject = {
|
||
|
|
$quote_and_ops_ids
|
||
|
|
};
|
||
|
|
for (let key in jsObject) {
|
||
|
|
let event_id = key ;
|
||
|
|
\$(\$("#$useropts{table_id}").dataTable().fnGetNodes()).find(\$("input[name='"+col_id+""+event_id+"']")).each(function () {
|
||
|
|
if(!\$(this).is(':checked')) {
|
||
|
|
\$(this).prop('checked',true);
|
||
|
|
} else {
|
||
|
|
\$(this).prop('checked',false);
|
||
|
|
}
|
||
|
|
}) ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").html("DELIVERY DATE BY") ;
|
||
|
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").html("$icon") ;
|
||
|
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date}) .glyphicons-calendar").tooltip() ;
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
$trigger_jquery .= qq~
|
||
|
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").html("DELIVERY TIME BY") ;
|
||
|
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").html("$icon") ;
|
||
|
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time}) .glyphicon-time").tooltip() ;
|
||
|
|
~ ;
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
1 ;
|