fetchArray("SELECT an_anagrafiche.idanagrafica AS id FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE deleted_at IS NULL AND descrizione='Tecnico'"); $_SESSION['dashboard']['idtecnici'] = ["'-1'"]; for ($i = 0; $i < count($rs); ++$i) { $_SESSION['dashboard']['idtecnici'][] = "'".$rs[$i]['id']."'"; } } if (!isset($_SESSION['dashboard']['idstatiintervento'])) { $rs = $dbo->fetchArray('SELECT idstatointervento AS id, descrizione FROM in_statiintervento WHERE deleted_at IS NULL'); $_SESSION['dashboard']['idstatiintervento'] = ["'-1'"]; for ($i = 0; $i < count($rs); ++$i) { $_SESSION['dashboard']['idstatiintervento'][] = "'".$rs[$i]['id']."'"; } } if (!isset($_SESSION['dashboard']['idtipiintervento'])) { $rs = $dbo->fetchArray('SELECT idtipointervento AS id, descrizione FROM in_tipiintervento'); $_SESSION['dashboard']['idtipiintervento'] = ["'-1'"]; for ($i = 0; $i < count($rs); ++$i) { $_SESSION['dashboard']['idtipiintervento'][] = "'".$rs[$i]['id']."'"; } } if (!isset($_SESSION['dashboard']['idzone'])) { $rs = $dbo->fetchArray('SELECT id, descrizione FROM an_zone'); $_SESSION['dashboard']['idzone'] = ["'-1'"]; // "Nessuna zona" di default $_SESSION['dashboard']['idzone'][] = "'0'"; for ($i = 0; $i < count($rs); ++$i) { $_SESSION['dashboard']['idzone'][] = "'".$rs[$i]['id']."'"; } } // Stati intervento $checks = ''; $count = 0; $total = 0; $rs = $dbo->fetchArray('SELECT idstatointervento AS id, descrizione, colore FROM in_statiintervento WHERE deleted_at IS NULL ORDER BY descrizione ASC'); $total = count($rs); $allchecksstati = ''; for ($i = 0; $i < count($rs); ++$i) { $attr = ''; foreach ($_SESSION['dashboard']['idstatiintervento'] as $idx => $val) { if ($val == "'".$rs[$i]['id']."'") { $attr = 'checked="checked"'; ++$count; } } $checks .= "
  • \n"; $allchecksstati .= "session_set_array( 'dashboard,idstatiintervento', '".$rs[$i]['id']."', 0 ); "; } if ($count == $total) { $class = 'btn-success'; } elseif ($count == 0) { $class = 'btn-danger'; } else { $class = 'btn-warning'; } if ($total == 0) { $class = 'btn-primary disabled'; } ?>
    fetchArray('SELECT idtipointervento AS id, descrizione FROM in_tipiintervento ORDER BY descrizione ASC'); $total = count($rs); $allcheckstipi = ''; for ($i = 0; $i < count($rs); ++$i) { $attr = ''; foreach ($_SESSION['dashboard']['idtipiintervento'] as $idx => $val) { if ($val == "'".$rs[$i]['id']."'") { $attr = 'checked="checked"'; ++$count; } } $checks .= "
  • \n"; $allcheckstipi .= "session_set_array( 'dashboard,idtipiintervento', '".$rs[$i]['id']."', 0 ); "; } if ($count == $total) { $class = 'btn-success'; } elseif ($count == 0) { $class = 'btn-danger'; } else { $class = 'btn-warning'; } if ($total == 0) { $class = 'btn-primary disabled'; } ?> fetchArray("SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale, colore FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica LEFT OUTER JOIN in_interventi_tecnici ON in_interventi_tecnici.idtecnico = an_anagrafiche.idanagrafica INNER JOIN in_interventi ON in_interventi_tecnici.idintervento=in_interventi.id WHERE an_anagrafiche.deleted_at IS NULL AND an_tipianagrafiche.descrizione='Tecnico' ".Modules::getAdditionalsQuery('Interventi').' GROUP BY an_anagrafiche.idanagrafica ORDER BY ragione_sociale ASC'); $total = count($rs); $totale_tecnici += $total; $allchecktecnici = ''; for ($i = 0; $i < count($rs); ++$i) { $attr = ''; foreach ($_SESSION['dashboard']['idtecnici'] as $idx => $val) { if ($val == "'".$rs[$i]['id']."'") { $attr = 'checked="checked"'; ++$count; } } $checks .= "
  • \n"; $allchecktecnici .= "session_set_array( 'dashboard,idtecnici', '".$rs[$i]['id']."', 0 ); "; } // TECNICI ELIMINATI CON ALMENO 1 INTERVENTO $rs = $dbo->fetchArray("SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica INNER JOIN in_interventi_tecnici ON in_interventi_tecnici.idtecnico = an_anagrafiche.idanagrafica WHERE deleted_at IS NOT NULL AND descrizione='Tecnico' GROUP BY an_anagrafiche.idanagrafica ORDER BY ragione_sociale ASC"); $total = count($rs); $totale_tecnici += $total; if ($total > 0) { $checks .= "

  • Tecnici eliminati:
  • \n"; for ($i = 0; $i < count($rs); ++$i) { $attr = ''; foreach ($_SESSION['dashboard']['idtecnici'] as $idx => $val) { if ($val == "'".$rs[$i]['id']."'") { $attr = 'checked="checked"'; ++$count; } } $checks .= "
  • \n"; $allchecktecnici .= "session_set_array( 'dashboard,idtecnici', '".$rs[$i]['id']."', 0 ); "; } // end for } // end if if ($count == $totale_tecnici) { $class = 'btn-success'; } elseif ($count == 0) { $class = 'btn-danger'; } else { $class = 'btn-warning'; } if ($totale_tecnici == 0) { $class = 'btn-primary disabled'; } ?> fetchArray('(SELECT 0 AS ordine, \'0\' AS id, \'Nessuna zona\' AS descrizione) UNION (SELECT 1 AS ordine, id, descrizione FROM an_zone) ORDER BY ordine, descrizione ASC'); $total = count($rs); for ($i = 0; $i < count($rs); ++$i) { $attr = ''; foreach ($_SESSION['dashboard']['idzone'] as $idx => $val) { if ($val == "'".$rs[$i]['id']."'") { $attr = 'checked="checked"'; ++$count; } } $checks .= "
  • \n"; $allcheckzone = "session_set_array( 'dashboard,idzone', '".$rs[$i]['id']."', 0 ); "; } if ($count == $total) { $class = 'btn-success'; } elseif ($count == 0) { $class = 'btn-danger'; } else { $class = 'btn-warning'; } if ($total == 0) { $class = 'btn-primary disabled'; } ?>

    fetchArray($qp); if (!empty($rsp)) { echo '
    '; } echo '
    '; if (!empty($rsp)) { echo '
    '; } $vista = setting('Vista dashboard'); if ($vista == 'mese') { $def = 'month'; } elseif ($vista == 'giorno') { $def = 'agendaDay'; } else { $def = 'agendaWeek'; } ?>