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 -
$day2 $month_names[$month2] $year2~ ; } elsif ($year1 eq $year2 && $month1 ne $month2) { $val = qq~ $day1 $month_names[$month1] -
$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/
//g ; # $val = qq~$val~ ; # &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/\,/\
/g ; $val = substr($val,0,27) . qq~~ ; } else { $val =~ s/\,/\
/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~
$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~~ : ($system_count == 1) ? qq~~ : "" ; $valxlsx = $tooltip ; $valxlsx =~ s/\
/\;/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~ ~ ; $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~ ~ ; 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~~ ; $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~~ ; $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~
~ ; $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~ ~ ; $trigger_jquery .= qq~ \$("#$ucfirstfield{item}\_chosen").css("width","100%") ;~ if $ucfirstfield{item} ; $extra_form_fields .= qq~~; $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~ ~ ; 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~
~ ; $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~~ ; # } 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~~ ; $nowrap = 'nowrap' ; } else { $val = qq~~ ; } } elsif ($waybill_nr_default_val && $item_default_val && $supplier_default_val == 2) { $val = qq~~ ; } else { my $tool_tip = qq~~ ; $tool_tip .= qq~
- Add WayBillNr~ unless $waybill_nr_default_val ; $tool_tip .= qq~
- Add Item(s)~ unless $item_default_val ; $tool_tip .= qq~
- Set Supplier to DCB~ if $supplier_default_val != 2 ; $val = qq~~ ; } # # # 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~~ ; # # # } 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~~ ; # # # # $val = qq~ # # # # ~ ; # # # $nowrap = 'nowrap' ; # # # } else { # # # $val = qq~~ ; # # # } } } #------------------------------------------------------------------------------------------ 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) ; # my $plus_item = ($is_dcb_partner) ? qq~ITEM~ : qq~ITEM~ ; $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("FROM") ; \$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").html("TO") ; \$('[data-toggle="tooltip"]').tooltip({ container: 'body' }); ~ ; my $plus_poc = ($is_dcb_partner) ? 'POC' : qq~POC~ ; $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~~ ; # $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~~ ; # } else { # $icon = qq~~ ; # $icon = qq~~ ; # $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~~ ; # } # $icon = ($from_to eq 'from') ? qq~~ : qq~~ ; $icon = qq~~ ; $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~~ ; $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 ;