WHERE asa.id_agence = :id_agence AND a.code_action = :code";
WHERE asa.id_agence = :id_agence AND a.code_action = :code";
}
}
else{
else{
$q="SELECT clts.id_client,clts.civ as civ_client, clts.nom AS nom_client, clts.prenom AS prenom_client,unix_timestamp(date_arrivee) as date_arrivee, unix_timestamp(clts.date_priseencharge) as date_priseencharge, unix_timestamp(clts.date_cloture) as date_cloture, c.civ as civ_conseiller, c.nom as nom_conseiller, cd.nom as nom_conseiller_rdv, rdv, c.prenom as prenom_conseiller, cd.prenom as prenom_conseiller_rdv, c.id_conseiller, c.id_agent, cd.id_agent as id_agent_rdv, clts.rdv, clts.nfcprov as nfc, TIMEDIFF(date_priseencharge,date_arrivee) AS 'attente', TIMEDIFF(date_cloture,date_priseencharge) AS 'entretien', a.id_agence, a.nom_agence, a.eds, (SELECT GROUP_CONCAT(m.titre) FROM ca_motifs m LEFT JOIN ca_historique_client_motifs cm ON m.id_motif = cm.id_motif WHERE cm.id_client = clts.id_client) as motifs
$q="SELECT clts.id_client,clts.civ as civ_client, clts.nom AS nom_client, clts.prenom AS prenom_client, clts.matricule,unix_timestamp(date_arrivee) as date_arrivee, unix_timestamp(clts.date_priseencharge) as date_priseencharge, unix_timestamp(clts.date_cloture) as date_cloture, c.civ as civ_conseiller, c.nom as nom_conseiller, cd.nom as nom_conseiller_rdv, rdv, c.prenom as prenom_conseiller, cd.prenom as prenom_conseiller_rdv, c.id_conseiller, c.id_agent, cd.id_agent as id_agent_rdv, clts.rdv, clts.nfcprov as nfc, TIMEDIFF(date_priseencharge,date_arrivee) AS 'attente', TIMEDIFF(date_cloture,date_priseencharge) AS 'entretien', a.id_agence, a.nom_agence, a.eds, (SELECT GROUP_CONCAT(m.titre) FROM ca_motifs m LEFT JOIN ca_historique_client_motifs cm ON m.id_motif = cm.id_motif WHERE cm.id_client = clts.id_client) as motifs
FROM ca_clients clts
FROM ca_clients clts
LEFT JOIN ca_agences a ON a.id_agence = clts.id_agence
LEFT JOIN ca_agences a ON a.id_agence = clts.id_agence
LEFT JOIN ca_conseillers c ON c.id_conseiller = clts.id_action".$agencyQuery."
LEFT JOIN ca_conseillers c ON c.id_conseiller = clts.id_action".$agencyQuery."
...
@@ -112,7 +111,7 @@
...
@@ -112,7 +111,7 @@
if($val!==FALSE)
if($val!==FALSE)
{
{
$q.=" UNION ".
$q.=" UNION ".
"SELECT clts.id_client,clts.civ as civ_client, clts.nom AS nom_client, clts.prenom AS prenom_client,unix_timestamp(date_arrivee) as date_arrivee, unix_timestamp(clts.date_priseencharge) as date_priseencharge, unix_timestamp(clts.date_cloture) as date_cloture, c.civ as civ_conseiller, c.nom as nom_conseiller, cd.nom as nom_conseiller_rdv, rdv, c.prenom as prenom_conseiller, cd.prenom as prenom_conseiller_rdv, c.id_conseiller, c.id_agent, cd.id_agent as id_agent_rdv, clts.rdv, clts.nfcprov as nfc, TIMEDIFF(date_priseencharge,date_arrivee) AS 'attente', TIMEDIFF(date_cloture,date_priseencharge) AS 'entretien', a.id_agence, a.nom_agence, a.eds, (SELECT GROUP_CONCAT(m.titre) FROM ca_motifs m LEFT JOIN ca_historique_client_motifs cm ON m.id_motif = cm.id_motif WHERE cm.id_client = clts.id_client) as motifs
"SELECT clts.id_client,clts.civ as civ_client, clts.nom AS nom_client, clts.prenom AS prenom_client, clts.matricule,unix_timestamp(date_arrivee) as date_arrivee, unix_timestamp(clts.date_priseencharge) as date_priseencharge, unix_timestamp(clts.date_cloture) as date_cloture, c.civ as civ_conseiller, c.nom as nom_conseiller, cd.nom as nom_conseiller_rdv, rdv, c.prenom as prenom_conseiller, cd.prenom as prenom_conseiller_rdv, c.id_conseiller, c.id_agent, cd.id_agent as id_agent_rdv, clts.rdv, clts.nfcprov as nfc, TIMEDIFF(date_priseencharge,date_arrivee) AS 'attente', TIMEDIFF(date_cloture,date_priseencharge) AS 'entretien', a.id_agence, a.nom_agence, a.eds, (SELECT GROUP_CONCAT(m.titre) FROM ca_motifs m LEFT JOIN ca_historique_client_motifs cm ON m.id_motif = cm.id_motif WHERE cm.id_client = clts.id_client) as motifs
FROM ca_historique_clients clts
FROM ca_historique_clients clts
LEFT JOIN ca_agences a ON a.id_agence = clts.id_agence
LEFT JOIN ca_agences a ON a.id_agence = clts.id_agence
LEFT JOIN ca_conseillers c ON c.id_conseiller = clts.id_action".$agencyQuery."
LEFT JOIN ca_conseillers c ON c.id_conseiller = clts.id_action".$agencyQuery."
id_agence;nom_agence;DSA;"LIB DSA";AG;"LIB AG";EDS;"LIB EDS";"Année + Mois";"Année + Mois + Jours";"Jour de la semaine";date_arrivee;date_arrivee_annee;date_arrivee_mois;date_arrivee_jour;date_arrivee_heure;date_arrivee_minute;date_arrivee_seconde;date_priseencharge;date_priseencharge_annee;date_priseencharge_mois;date_priseencharge_jour;date_priseencharge_heure;date_priseencharge_minute;date_priseencharge_seconde;date_cloture;date_cloture_annee;date_cloture_mois;date_cloture_jour;date_cloture_heure;date_cloture_minute;date_cloture_seconde;rdv;"Matricule Conseiller RDV";"nom_conseiller RDV";"prenom_conseiller RDV";"Matricule Conseiller";nom_conseiller;prenom_conseiller;civ_client;nom_client;prenom_client;Matricule;NFC;Motifs
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:32:05";2024;05;30;13;32;05;"30/05/2024 13:47:26";2024;05;30;13;47;26;"30/05/2024 14:03:25";2024;05;30;14;03;25;1;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;DAMAS;MOUNA;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:33:56";2024;05;30;13;33;56;"30/05/2024 13:47:27";2024;05;30;13;47;27;"30/05/2024 14:03:26";2024;05;30;14;03;26;1;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;EEE;TTT;IOP;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:42:12";2024;05;30;13;42;12;"30/05/2024 13:47:30";2024;05;30;13;47;30;"30/05/2024 14:03:26";2024;05;30;14;03;26;1;V000003;JARDIN;"A Chaqun";V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";;;;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:43:26";2024;05;30;13;43;26;"30/05/2024 14:03:18";2024;05;30;14;03;18;"30/05/2024 14:03:27";2024;05;30;14;03;27;1;V000003;JARDIN;"A Chaqun";V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;AZE;TTT;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:53:51";2024;05;30;13;53;51;"30/05/2024 14:03:19";2024;05;30;14;03;19;"30/05/2024 14:03:28";2024;05;30;14;03;28;1;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;ZZ;RRR;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:54:20";2024;05;30;13;54;20;"30/05/2024 14:03:20";2024;05;30;14;03;20;"30/05/2024 14:03:28";2024;05;30;14;03;28;1;V000003;JARDIN;"A Chaqun";V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;EE;TT;IO;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:55:04";2024;05;30;13;55;04;"30/05/2024 14:03:21";2024;05;30;14;03;21;"30/05/2024 14:03:29";2024;05;30;14;03;29;1;V000001;JEREMY;Damien;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";;;;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:56:09";2024;05;30;13;56;09;"30/05/2024 14:03:21";2024;05;30;14;03;21;"30/05/2024 14:03:30";2024;05;30;14;03;30;1;V000001;JEREMY;Damien;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;ZE;TYU;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:57:01";2024;05;30;13;57;01;"30/05/2024 14:03:22";2024;05;30;14;03;22;"30/05/2024 14:03:31";2024;05;30;14;03;31;1;V000001;JEREMY;Damien;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;"JEAN MARC";DFGH;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:57:40";2024;05;30;13;57;40;"30/05/2024 14:03:23";2024;05;30;14;03;23;"30/05/2024 14:03:31";2024;05;30;14;03;31;1;;;;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;GG;TTT;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 13:59:59";2024;05;30;13;59;59;"30/05/2024 14:03:23";2024;05;30;14;03;23;"30/05/2024 14:03:32";2024;05;30;14;03;32;1;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";Mme;RRRYY;TTT;;Non;
1;FONTAINE-IT;;;;;00003;FONTAINE-IT;202405;20240530;Jeudi;"30/05/2024 18:58:11";2024;05;30;18;58;11;"01/01/1970 01:00:00";1970;01;01;01;00;00;"01/01/1970 01:00:00";1970;01;01;01;00;00;1;V000002;"SAUNIER MARC ENTOINE EMIL";"Anne-Charlotte De Testing";;;;Mme;FRRF;TTG;IIK;Non;