6819 lines
362 KiB
PHP
6819 lines
362 KiB
PHP
<?php
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/inc_fx_panier.php';
|
|
|
|
require_once($_SERVER["DOCUMENT_ROOT"] . "/php/inc_fx_rabais_batch.php");
|
|
|
|
|
|
|
|
$strTitreRapportTQ="";
|
|
// Variables
|
|
$intLimitNb = 200;
|
|
$tabValMessages = array(
|
|
"required" => array("fr" => 'required: "Veuillez entrer une valeur pour %label%"', "en" => 'required: "Please enter a value for %label%"'),
|
|
"email" => array("fr" => 'email: "%label% doit être une adresse courriel valide"', "en" => 'email: "%label% must be a valid email address"'),
|
|
"url" => array("fr" => 'url: "%label% doit être un URL valide commen?ant par http://"', "en" => 'url: "%label%must be a valid URL starting with http://"'),
|
|
"digits" => array("fr" => 'digits: "%label% doit être un nombre entier"', "en" => 'digits: "%label% must be an integer"'),
|
|
"number" => array("fr" => 'number: "%label% doit être un nombre décimal"', "en" => 'number: "%label% must be a decimal"'),
|
|
"image" => array("fr" => 'extension: "%label% doit être un fichier image (jpg, png ou gif)"', "en" => 'extension: "%label% must be an image file (jpg, png or gif)"'),
|
|
"document" => array("fr" => 'extension: "%label% doit être un fichier doc, docx ou pdf"', "en" => 'extension: "%label% must be a doc, docx or pdf file"'),
|
|
"pdf" => array("fr" => 'extension: "%label% doit être un fichier pdf"', "en" => 'extension: "%label% must be a pdf file"'),
|
|
"dateCA" => array("fr" => 'dateCA: "%label% doit être une date au format AAAA-MM-JJ"', "en" => 'dateCA: "%label% must be a date under the format YYYY-MM-DD"')
|
|
);
|
|
|
|
use setasign\Fpdi\Fpdi;
|
|
|
|
// fonction pour récupérer la clé primaire (JSP)
|
|
// param : id de la table
|
|
function fxGetPK($intMenu)
|
|
{
|
|
global $objDatabase;
|
|
|
|
$sqlMenu = "SELECT men_table FROM adm_menus WHERE men_id = " . intval($intMenu);
|
|
$strTable = $objDatabase->fxGetVar($sqlMenu);
|
|
|
|
$sqlPK = "SHOW INDEX FROM " . $strTable . " WHERE Key_name = 'PRIMARY';";
|
|
$tabPK = $objDatabase->fxGetRow($sqlPK);
|
|
|
|
if ($tabPK != null)
|
|
return $tabPK['Column_name'];
|
|
else
|
|
return '-';
|
|
}
|
|
|
|
// fonction pour mettre à jour la clé primaire (JSP)
|
|
// param : id du menu
|
|
function fxUpdatePK($intMenu)
|
|
{
|
|
global $objDatabase;
|
|
|
|
// Vérifier que la PK est enregistrée dans la table
|
|
$sqlPK = "SELECT men_pk FROM adm_menus WHERE men_id = " . intval($intMenu);
|
|
$strPK = $objDatabase->fxGetVar($sqlPK);
|
|
|
|
if ($strPK == '' || $strPK == null) {
|
|
$strPK2 = fxGetPK($intMenu);
|
|
|
|
$sqlUpdate = "UPDATE adm_menus SET men_pk = '" . $strPK2 . "' WHERE men_id = " . intval($intMenu);
|
|
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
|
}
|
|
|
|
return $strPK;
|
|
}
|
|
|
|
// fonction qui récpère les infos nécessaires pour afficher les listes d'items (JSP)
|
|
// param : table, order by, where, id de début, nb total à afficher, langue d'affichage, id à chercher
|
|
function fxGetListData($intMenu, $strOrder, $strWhere, $strGroup, $intPage, $strLangue, $intId = '', $mem_actif = 1)
|
|
{
|
|
global $objDatabase;
|
|
|
|
$intMenu = base64_decode(urldecode($intMenu));
|
|
|
|
// récupérer les infos du menu
|
|
if (isset($_GET['a']) && $_GET['a'] == 'report') {
|
|
$intRapport = 1;
|
|
} else {
|
|
$intRapport = 0;
|
|
}
|
|
|
|
$tabMenu = fxGetMenussuperadm($intMenu, 0, $intRapport, 0, 0, $mem_actif);
|
|
|
|
$intNb = $tabMenu['men_nb_page'];
|
|
if ($tabMenu['sous_men_id'] != 0) {
|
|
$intNb = 999;
|
|
}
|
|
$intStart = ($intNb * $intPage) - $intNb;
|
|
|
|
if (count($tabMenu) > 0) {
|
|
// récupérer les noms des champs à afficher
|
|
$sqlFields = "SELECT f.*, l.lab_texte_list FROM adm_forms f, adm_labels l WHERE f.for_field = l.lab_code AND f.men_id = l.men_id AND l.lab_langue = '" . $objDatabase->fxEscape($strLangue) . "' AND f.for_list = 1 AND f.men_id = " . intval($intMenu) . " AND f.for_actif = 1 ORDER BY f.for_tri";
|
|
$tabFields = $objDatabase->fxGetResults($sqlFields);
|
|
|
|
// récupérer les données de la table
|
|
$sqlData = "SELECT SQL_CALC_FOUND_ROWS " . $tabMenu['men_select'] . " FROM " . $tabMenu['men_from'];
|
|
|
|
// ajouter la clause WHERE
|
|
if (trim($tabMenu['men_where']) != '')
|
|
$sqlData .= " WHERE " . fxUnescape(str_replace('%id%', intval($intId), $tabMenu['men_where']));
|
|
if (trim($strWhere) != '') {
|
|
$tabWhere = explode(',', $strWhere);
|
|
$strWhere = implode(' AND ', $tabWhere);
|
|
|
|
if (trim($tabMenu['men_where']) != '')
|
|
$sqlData .= " AND " . fxUnescape($strWhere);
|
|
else
|
|
$sqlData .= " WHERE " . fxUnescape($strWhere);
|
|
} else {
|
|
if (trim($tabMenu['men_where_default']) != '') {
|
|
$strWhere = trim($tabMenu['men_where_default']);
|
|
|
|
if (trim($tabMenu['men_where']) != '')
|
|
$sqlData .= " AND " . fxUnescape($strWhere);
|
|
else
|
|
$sqlData .= " WHERE " . fxUnescape($strWhere);
|
|
}
|
|
}
|
|
|
|
// ajouter le GROUP BY
|
|
if (trim($tabMenu['men_group']) != '') {
|
|
$sqlData .= " GROUP BY " . fxUnescape($tabMenu['men_group']);
|
|
} elseif (trim($strGroup) != '') {
|
|
$sqlData .= " GROUP BY " . fxUnescape($strGroup);
|
|
}
|
|
|
|
// ajouter le ORDER BY
|
|
if (trim($strOrder) != '')
|
|
$sqlData .= " ORDER BY " . fxUnescape($strOrder);
|
|
elseif (trim($tabMenu['men_order']) != '')
|
|
$sqlData .= " ORDER BY " . fxUnescape($tabMenu['men_order']);
|
|
|
|
// limiter le nombre +de ligne à retourner
|
|
if ($intNb > 0)
|
|
$sqlData .= " LIMIT " . intval($intStart) . ", " . intval($intNb);
|
|
|
|
//echo $sqlData;
|
|
$tabData = $objDatabase->fxGetResults($sqlData);
|
|
|
|
// construire le tableau de retour
|
|
$tabRetour['total'] = $nbTotal = $objDatabase->fxGetVar("SELECT FOUND_ROWS()");;
|
|
$tabRetour['key'] = $tabMenu['men_pk'];
|
|
$tabRetour['table'] = $tabMenu['men_table'];
|
|
$tabRetour['menu'] = $tabMenu;
|
|
$tabRetour['fields'] = $tabFields;
|
|
$tabRetour['data'] = $tabData;
|
|
$tabRetour['nb_page'] = $tabMenu['men_nb_page'];
|
|
$tabRetour['intStart'] = $intStart;
|
|
$tabRetour['nb_data'] = count((array)$tabData);
|
|
$tabRetour['nb_fields'] = count((array)$tabFields);
|
|
|
|
// prépare l'information pour les sousgroupe
|
|
for ($intgroupe = 1; $intgroupe <= 5; $intgroupe++) {
|
|
$memselect = "men_groupe_sqlselect_" . $intgroupe;
|
|
$memfrom = "men_groupe_sqlfrom_" . $intgroupe;
|
|
$memwhere = "men_groupe_sqlwhere_" . $intgroupe;
|
|
$memorder = "men_groupe_sqlorder_" . $intgroupe;
|
|
$memgroup = "men_groupe_sqlgroup_" . $intgroupe;
|
|
$memgroupe = "groupe_" . $intgroupe;
|
|
|
|
if ($tabMenu[$memselect] != "") {
|
|
// récupérer les données de la table
|
|
$sqlData = "SELECT " . $tabMenu[$memselect] . " FROM " . $tabMenu[$memfrom];
|
|
|
|
// ajouter la clause WHERE
|
|
if (trim($tabMenu[$memwhere]) != '')
|
|
$sqlData .= " WHERE " . fxUnescape(str_replace('%id%', intval($intId), $tabMenu[$memwhere]));
|
|
// ajouter le GROUP BY
|
|
if (trim($tabMenu[$memgroup]) != '')
|
|
$sqlData .= " GROUP BY " . fxUnescape($tabMenu[$memgroup]);
|
|
// ajouter le ORDER BY
|
|
$sqlData .= " ORDER BY " . fxUnescape($tabMenu[$memorder]);
|
|
|
|
$sqlTotal = $sqlData;
|
|
|
|
$tabData = $objDatabase->fxFetchArray(4, $sqlData);
|
|
|
|
$intTotal = count($tabData);
|
|
$tabRetour[$memgroupe]['data'] = $tabData;
|
|
$tabRetour[$memgroupe]['total'] = $intTotal;
|
|
}
|
|
}
|
|
|
|
return $tabRetour;
|
|
} else
|
|
return false;
|
|
}
|
|
|
|
// fonction pour afficher le tableau de la liste (JSP)
|
|
// param : tableau des données, nom de la table, order by, where, début, nb à afficher. # de la page, langue
|
|
function fxShowList($tabResults, $intMenu, $strOrder, $strWhere, $strGroup, $intPage, $strLangue, $eve_id = 0)
|
|
{
|
|
|
|
if ($tabResults['menu']['sous_men_id'] == 0) {
|
|
$tabSearchData = fxGetSearchData($intMenu, $strLangue);
|
|
|
|
|
|
if ($tabSearchData != false)
|
|
include('inc_search.php');
|
|
}
|
|
|
|
include('inc_list.php');
|
|
}
|
|
|
|
// fonction qui récupère les infos nécessaires pour afficher les formulaires de recherche (JSP)
|
|
// param : table, langue d'affichage
|
|
function fxGetSearchData($intMenu, $strLangue)
|
|
{
|
|
global $objDatabase;
|
|
$intMenu = base64_decode(urldecode($intMenu));
|
|
|
|
// récupérer les noms des champs à afficher
|
|
$sqlFields = "SELECT f.*, l.lab_texte_form, l.lab_list, l.lab_data_type FROM adm_forms f, adm_labels l WHERE f.for_field = l.lab_code AND f.men_id = l.men_id AND l.lab_langue = '" . $objDatabase->fxEscape($strLangue) . "' AND f.for_search = 1 AND f.men_id = " . intval($intMenu) . " AND f.for_actif = 1 ORDER BY f.for_tri";
|
|
$tabFields = $objDatabase->fxGetResults($sqlFields);
|
|
|
|
if ($tabFields != null)
|
|
return $tabFields;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
// fonction qui récupère les infos nécessaires pour afficher les formulaires d'ajout et modification (JSP)
|
|
// param : action (add/mod), table, langue d'affichage
|
|
function fxGetFormData($strAction, $intMenu, $strLangue, $men_actif)
|
|
{
|
|
global $objDatabase;
|
|
$intMenu = base64_decode(urldecode($intMenu));
|
|
|
|
// récupérer les infos du menu
|
|
$tabMenu = fxGetMenussuperadm($intMenu, 0, 0, 0, 0, $men_actif);
|
|
|
|
if (count($tabMenu) > 0) {
|
|
// récupérer les noms des champs à afficher
|
|
$sqlFields = "SELECT f.*, l.lab_texte_form, l.lab_list, l.lab_data_type, l.lab_default, l.lab_autocomplete_where, l.lab_autocomplete_search, l.lab_autocomplete_id FROM adm_forms f, adm_labels l WHERE f.for_field = l.lab_code AND f.men_id = l.men_id AND l.lab_langue = '" . $objDatabase->fxEscape($strLangue) . "' AND f.for_" . $strAction . " = 1 AND f.men_id = " . intval($intMenu) . " AND f.for_actif = 1
|
|
UNION SELECT f.*, '' AS lab_texte_form, '' AS lab_list, '' AS lab_data_type, '' AS lab_default, '' AS lab_autocomplete_where, '' AS lab_autocomplete_search, '' AS lab_autocomplete_id FROM adm_forms f WHERE f.for_" . $strAction . " = 1 AND f.men_id = " . intval($intMenu) . " AND f.for_actif = 1 AND f.for_type = 'hidden'
|
|
ORDER BY for_tri";
|
|
$tabFields = $objDatabase->fxGetResults($sqlFields);
|
|
|
|
|
|
// construire le tableau de retour
|
|
$tabRetour['key'] = $tabMenu['men_pk'];
|
|
$tabRetour['table'] = $tabMenu['men_table'];
|
|
$tabRetour['menu'] = $tabMenu;
|
|
$tabRetour['fields'] = $tabFields;
|
|
|
|
// récupérer les données de la table, si action = mod
|
|
if ($strAction == 'mod') {
|
|
$sqlData = "SELECT * FROM " . $tabMenu['men_table'] . " WHERE " . $tabRetour['key'] . " = " . intval($_GET['id']);
|
|
$tabData = $objDatabase->fxGetRow($sqlData);
|
|
|
|
$tabRetour['data'] = $tabData;
|
|
}
|
|
|
|
return $tabRetour;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// fonction pour afficher le formulaire d'ajout ou modification (JSP)
|
|
// param : action (add/mod), table, langue
|
|
function fxShowForm($strAction, $intMenu, $strLangue, $eve_id = 0, $epr_id = 0, $men_actif = 1)
|
|
{
|
|
|
|
$tabResults = fxGetFormData($strAction, $intMenu, $strLangue, $men_actif);
|
|
|
|
include('inc_form.php');
|
|
|
|
}
|
|
|
|
// fonction qui affiche le HTML de la pagination
|
|
// param: le url de la page, nb total de records, nb par page, page courante
|
|
function fxShowPaging($strUrl, $intTotal, $intNb, $intPage)
|
|
{
|
|
$strOutput = '';
|
|
|
|
if ($intTotal > $intNb) {
|
|
// déterminer le nb de pages totales, le no de page précédente et suivante
|
|
$intNbPages = ceil($intTotal / $intNb);
|
|
$intMidRange = 7;
|
|
$intPrev = $intPage - 1;
|
|
$intNext = $intPage + 1;
|
|
$tabRange = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
|
|
|
if ($intNbPages > 10) {
|
|
$intStartRange = $intPage - floor($intMidRange / 2);
|
|
$intEndRange = $intPage + floor($intMidRange / 2);
|
|
|
|
if ($intStartRange <= 0) {
|
|
$intEndRange += abs($intStartRange) + 1;
|
|
$intStartRange = 1;
|
|
}
|
|
|
|
if ($intEndRange > $intNbPages) {
|
|
$intStartRange -= $intEndRange - $intNbPages;
|
|
$intEndRange = $intNbPages;
|
|
}
|
|
|
|
$tabRange = range($intStartRange, $intEndRange);
|
|
}
|
|
|
|
$strOutput .= '
|
|
<nav aria-label="Page navigation">
|
|
<ul class="pagination pagination-lg justify-content-center">
|
|
';
|
|
|
|
if ($intPrev > 0) {
|
|
$strOutput .= '
|
|
<li class="page-item">
|
|
<a class="page-link" href="' . $strUrl . '&pg=' . $intPrev . '" aria-label="Previous">
|
|
<span aria-hidden="true">«</span>
|
|
</a>
|
|
</li>
|
|
';
|
|
}
|
|
|
|
for ($intCtr = 1; $intCtr <= $intNbPages; $intCtr++) {
|
|
if (isset($tabRange) && $tabRange[0] > 2 && $intCtr == $tabRange[0]) {
|
|
$strOutput .= '
|
|
<li class="disabled page-item">
|
|
<a class="page-link" href="#">...</a>
|
|
</li>
|
|
';
|
|
}
|
|
|
|
if ($intCtr == 1 || $intCtr == $intNbPages || in_array($intCtr, $tabRange)) {
|
|
if ($intCtr == $intPage) {
|
|
$strActif = ' active';
|
|
} else {
|
|
$strActif = '';
|
|
}
|
|
|
|
$strOutput .= '
|
|
<li class="page-item' . $strActif . '">
|
|
<a class="page-link" href="' . $strUrl . '&pg=' . $intCtr . '">' . $intCtr . '</a>
|
|
</li>
|
|
';
|
|
}
|
|
|
|
if ($intNbPages > 10) {
|
|
if (isset($tabRange) && $tabRange[$intMidRange - 1] < $intNbPages - 1 && $intCtr == $tabRange[$intMidRange - 1]) {
|
|
$strOutput .= '
|
|
<li class="disabled page-item">
|
|
<a class="page-link" href="#">...</a>
|
|
</li>
|
|
';
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($intNext <= $intNbPages) {
|
|
$strOutput .= '
|
|
<li class="page-item">
|
|
<a class="page-link" href="' . $strUrl . '&pg=' . $intNext . '" aria-label="Next">
|
|
<span aria-hidden="true">»</span>
|
|
</a>
|
|
</li>
|
|
';
|
|
}
|
|
|
|
$strOutput .= '
|
|
</ul>
|
|
</nav>
|
|
';
|
|
}
|
|
|
|
return $strOutput;
|
|
}
|
|
|
|
// fonction qui récupère les champs et leurs types pour créer le SQL (JSP)
|
|
// param : action, nom de la table
|
|
function fxGetFormFields($strAction, $intMenu)
|
|
{
|
|
global $objDatabase;
|
|
$intMenu = base64_decode(urldecode($intMenu));
|
|
|
|
$sqlMenu = "SELECT men_table FROM adm_menus WHERE men_id = " . intval($intMenu);
|
|
$strTable = $objDatabase->fxGetVar($sqlMenu);
|
|
|
|
$sqlFields = "SELECT for_field FROM adm_forms WHERE men_id = " . intval($intMenu) . " AND for_$strAction = 1 AND for_type <> 'static' AND for_type <> 'file' AND for_type <> 'autocomplete' AND for_actif = 1";
|
|
$tabFields = $objDatabase->fxGetResults($sqlFields);
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabFields); $intCtr++)
|
|
$tabFields3[] = $tabFields[$intCtr]['for_field'];
|
|
|
|
$sqlFields2 = "SELECT " . implode(',', $tabFields3) . " FROM " . $objDatabase->fxEscape($strTable) . " LIMIT 1";
|
|
$tabFields2 = $objDatabase->fxGetFields($sqlFields2);
|
|
|
|
if ($tabFields != null)
|
|
return $tabFields2;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
// fonction qui récupère les champs et leurs types pour créer le SQL (JSP)
|
|
// param : action, nom de la table
|
|
function fxGetFormFields2($strAction, $intMenu, $strField = "")
|
|
{
|
|
global $objDatabase;
|
|
$intMenu = base64_decode(urldecode($intMenu));
|
|
|
|
if ($strField == "")
|
|
$memwhere = "";
|
|
else
|
|
$memwhere = " AND for_field = '" . $strField . "'";
|
|
|
|
$sqlFields = "SELECT for_field, for_alias, for_date, for_datetime FROM adm_forms WHERE men_id = " . intval($intMenu) . " AND for_$strAction = 1 AND for_type <> 'static' AND for_actif = 1 AND for_type <> 'file' AND for_type <> 'autocomplete'" . $memwhere;
|
|
$tabFields = $objDatabase->fxGetResults($sqlFields);
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabFields); $intCtr++) {
|
|
$tabFields3[$intCtr]['name'] = $tabFields[$intCtr]['for_field'];
|
|
$tabFields3[$intCtr]['alias'] = $tabFields[$intCtr]['for_alias'];
|
|
$tabFields3[$intCtr]['date'] = $tabFields[$intCtr]['for_date'];
|
|
$tabFields3[$intCtr]['datetime'] = $tabFields[$intCtr]['for_datetime'];
|
|
}
|
|
|
|
if ($tabFields != null)
|
|
return $tabFields3;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
// fonction qui ajoute ou efface les fichiers et retourne le SQL (JSP)
|
|
// param : action, nom de la table, fichiers, clé primaire, valeur de cette clé, numéro du fichier
|
|
function fxSetUploadFiles($strAction, $intMenu, $tabFiles, $strPk, $intPk, $intFile = 0)
|
|
{
|
|
global $objDatabase;
|
|
$strSql = '';
|
|
|
|
$sqlMenu = "SELECT men_table FROM adm_menus WHERE men_id = " . intval($intMenu);
|
|
$strTable = $objDatabase->fxGetVar($sqlMenu);
|
|
|
|
$sqlFields = "SELECT for_field, for_validation, for_file_path, for_image_dimensions, for_image_thumb, for_image_thumb_dimensions FROM adm_forms WHERE men_id = " . intval($intMenu) . " AND for_type = 'file' AND for_actif = 1 ORDER BY for_tri";
|
|
$tabFields = $objDatabase->fxGetResults($sqlFields);
|
|
|
|
if ($tabFields != null) {
|
|
for ($intCtr = 1; $intCtr <= count($tabFields); $intCtr++) {
|
|
$tabPath = $GLOBALS[$tabFields[$intCtr]['for_file_path']];
|
|
|
|
// si l'action est ajout ou modifier
|
|
if ($strAction != 'del') {
|
|
if ($tabFiles[$tabFields[$intCtr]['for_field']]['name'] != '') {
|
|
$strFileName = $tabFiles[$tabFields[$intCtr]['for_field']]['name'];
|
|
$strFileTmp = $tabFiles[$tabFields[$intCtr]['for_field']]['tmp_name'];
|
|
|
|
if ($tabFields[$intCtr]['for_validation'] == 'image') {
|
|
// vérifier si on doit créer une miniature
|
|
if ($tabFields[$intCtr]['for_image_thumb'] == 1) {
|
|
$tabParam1 = explode(',', $tabFields[$intCtr]['for_image_dimensions']);
|
|
$tabParam2 = explode(',', $tabFields[$intCtr]['for_image_thumb_dimensions']);
|
|
|
|
$strImageOriginale = fxUploadFile($strFileName, $strFileTmp, $tabPath['virtual']);
|
|
|
|
$strImageBig = fxResizeImage($strImageOriginale, $tabPath['virtual'], $tabParam1[0], $tabParam1[1], $tabParam1[2], $tabParam1[3], 'big');
|
|
|
|
$strImageSmall = fxResizeImage($strImageOriginale, $tabPath['virtual'], $tabParam2[0], $tabParam2[1], $tabParam2[2], $tabParam2[3], 'small');
|
|
|
|
// effacer l'image originale
|
|
if (($strImageOriginale != $strImageBig && $strImageOriginale != $strImageSmall) && file_exists($tabPath['virtual'] . $strImageOriginale))
|
|
unlink($tabPath['virtual'] . $strImageOriginale);
|
|
|
|
// créer le SQL
|
|
$strSql = "UPDATE " . $strTable . " SET " . $tabFields[$intCtr]['for_field'] . "_big = '" . $strImageBig . "', " . $tabFields[$intCtr]['for_field'] . "_small = '" . $strImageSmall . "' WHERE " . $strPk . " = " . intval($intPk);
|
|
} else {
|
|
$tabParam1 = explode(',', $tabFields[$intCtr]['for_image_dimensions']);
|
|
|
|
$strImageOriginale = fxUploadFile($strFileName, $strFileTmp, $tabPath['virtual']);
|
|
|
|
$strImage = fxResizeImage($strImageOriginale, $tabPath['virtual'], $tabParam1[0], $tabParam1[1], $tabParam1[2], $tabParam1[3], '');
|
|
|
|
// effacer l'image originale
|
|
if ($strImageOriginale != $strImage && file_exists($tabPath['virtual'] . $strImageOriginale))
|
|
unlink($tabPath['virtual'] . $strImageOriginale);
|
|
|
|
// créer le SQL
|
|
$strSql = "UPDATE " . $strTable . " SET " . $tabFields[$intCtr]['for_field'] . " = '" . $strImage . "' WHERE " . $strPk . " = " . intval($intPk);
|
|
}
|
|
} else {
|
|
$strFileUploaded = fxUploadFile($strFileName, $strFileTmp, $tabPath['virtual']);
|
|
|
|
// créer le SQL
|
|
$strSql = "UPDATE " . $strTable . " SET " . $tabFields[$intCtr]['for_field'] . " = '" . $strFileUploaded . "' WHERE " . $strPk . " = " . intval($intPk);
|
|
}
|
|
|
|
$qryUpdate = $objDatabase->fxQuery($strSql);
|
|
}
|
|
} else {
|
|
if ($intFile == 0 || ($intFile > 0 && $intCtr == $intFile)) {
|
|
if ($tabFields[$intCtr]['for_validation'] == 'image') {
|
|
// vérifier si on a une miniature
|
|
if ($tabFields[$intCtr]['for_image_thumb'] == 1) {
|
|
// effacer les images
|
|
if (file_exists($tabPath['virtual'] . $tabFields[$intCtr]['for_field'] . '_big'))
|
|
unlink($tabPath['virtual'] . $tabFields[$intCtr]['for_field'] . '_big');
|
|
if (file_exists($tabPath['virtual'] . $tabFields[$intCtr]['for_field'] . '_small'))
|
|
unlink($tabPath['virtual'] . $tabFields[$intCtr]['for_field'] . '_small');
|
|
|
|
// créer le SQL
|
|
$strSql = "UPDATE " . $strTable . " SET " . $tabFields[$intCtr]['for_field'] . "_big = '', " . $tabFields[$intCtr]['for_field'] . "_small = '' WHERE " . $strPk . " = " . intval($intPk);
|
|
} else {
|
|
// effacer l'image
|
|
if (file_exists($tabPath['virtual'] . $tabFields[$intCtr]['for_field']))
|
|
unlink($tabPath['virtual'] . $tabFields[$intCtr]['for_field']);
|
|
|
|
// créer le SQL
|
|
$strSql = "UPDATE " . $strTable . " SET " . $tabFields[$intCtr]['for_field'] . " = '' WHERE " . $strPk . " = " . intval($intPk);
|
|
}
|
|
} else { // effacer le fichier
|
|
if (file_exists($tabPath['virtual'] . $tabFields[$intCtr]['for_field']))
|
|
unlink($tabPath['virtual'] . $tabFields[$intCtr]['for_field']);
|
|
|
|
// créer le SQL
|
|
$strSql = "UPDATE " . $strTable . " SET " . $tabFields[$intCtr]['for_field'] . " = '' WHERE " . $strPk . " = " . intval($intPk);
|
|
}
|
|
|
|
$qryUpdate = $objDatabase->fxQuery($strSql);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// fonction qui ajoute, modifie ou supprime (JSP)
|
|
// param : action (add, mod, del), nom de la table, données, fichiers
|
|
function fxSetForm($strAction, $intMenu, $tabData, $tabFiles, $pasdesuite = 0, $mem_actif = 1)
|
|
{
|
|
global $objDatabase;
|
|
$tabResults = array();
|
|
|
|
if ($strAction != 'del' && $strAction != 'copy') {
|
|
// récupérer la clé et le nom des champs à mettre à jour
|
|
$tabResults = fxGetFormFields2($strAction, $intMenu);
|
|
}
|
|
|
|
$intMenu = base64_decode(urldecode($intMenu));
|
|
$tabMenu = fxGetMenussuperadm($intMenu, 0, 0, 0, 0, $mem_actif);
|
|
$strPk = $tabMenu['men_pk'];
|
|
if (isset($tabData['btn_add_multiple'])) {
|
|
$strAction = "add_multiple_rabais";
|
|
}
|
|
|
|
switch ($strAction) {
|
|
case 'add_multiple_rabais':
|
|
// error_reporting(E_ALL);
|
|
// ini_set("display_errors", 1);
|
|
$tabFields = $tabValues = array();
|
|
$intNbAjout = 1;
|
|
$strUniqueId = uniqid('', true);
|
|
if (isset($tabData['multiple'])) {
|
|
$intNbAjout = intval($tabData['multiple']);
|
|
}
|
|
|
|
$tabResults[]['name'] = 'rab_key';
|
|
// $tabResults[]['name']='rab_adresse_ip';
|
|
|
|
$tabData['rab_key'] = $strUniqueId;
|
|
$tabData['rab_code_manuel'] = 1;
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabResults); $intCtr++) {
|
|
|
|
|
|
if ($tabResults[$intCtr]['name'] != 'multiple') {
|
|
// stocker les nom de champs
|
|
$tabFields[] = fxUnescape($tabResults[$intCtr]['name']);
|
|
|
|
// stocker les valeurs
|
|
if (is_array($tabData[$tabResults[$intCtr]['name']])) {
|
|
$strValue = implode(',', $tabData[$tabResults[$intCtr]['name']]);
|
|
} else {
|
|
if ($tabResults[$intCtr]['name'] == 'rab_code') {
|
|
$multiple_code = $tabData[$tabResults[$intCtr]['name']];
|
|
$strValue = '%multiple%';
|
|
} else {
|
|
$strValue = $tabData[$tabResults[$intCtr]['name']];
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$tabValues[] = "'" . $objDatabase->fxEscape($strValue) . "'";
|
|
}
|
|
}
|
|
|
|
for ($intCtr = 1; $intCtr <= $intNbAjout; $intCtr++) { // ajouter plusieurs items, si demandé
|
|
$strCodeRabais = fxGetNoConfimation($multiple_code);
|
|
|
|
$mem_value = implode(', ', $tabValues);
|
|
$mem_value = str_replace('%multiple%', $strCodeRabais, $mem_value);
|
|
|
|
$sqlInsert1 = "INSERT INTO " . $tabMenu['men_table'] . "(" . implode(', ', $tabFields) . ") VALUES(" . $mem_value . ")";
|
|
|
|
|
|
$qryInsert1 = $objDatabase->fxQuery($sqlInsert1);
|
|
//echo($sqlInsert1);echo('<br>');
|
|
// récupérer le id inséré
|
|
$intPk = $objDatabase->fxGetLastId();
|
|
|
|
// vérifier si on doit téléverser des fichiers
|
|
|
|
}
|
|
|
|
$_SESSION['msg'] = 101;
|
|
break;
|
|
|
|
case 'add':
|
|
$tabFields = $tabValues = array();
|
|
$intNbAjout = 1;
|
|
|
|
if (isset($tabData['nb_ajout'])) {
|
|
$intNbAjout = intval($tabData['nb_ajout']);
|
|
}
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabResults); $intCtr++) {
|
|
if ($tabResults[$intCtr]['name'] != 'nb_ajout') {
|
|
// stocker les nom de champs
|
|
$tabFields[] = fxUnescape($tabResults[$intCtr]['name']);
|
|
|
|
// stocker les valeurs
|
|
if (is_array($tabData[$tabResults[$intCtr]['name']])) {
|
|
$strValue = implode(',', $tabData[$tabResults[$intCtr]['name']]);
|
|
} else {
|
|
$strValue = $tabData[$tabResults[$intCtr]['name']];
|
|
}
|
|
|
|
$tabValues[] = "'" . $objDatabase->fxEscape($strValue) . "'";
|
|
}
|
|
}
|
|
|
|
for ($intCtr = 1; $intCtr <= $intNbAjout; $intCtr++) { // ajouter plusieurs items, si demandé
|
|
$sqlInsert1 = "INSERT INTO " . $tabMenu['men_table'] . "(" . implode(', ', $tabFields) . ") VALUES(" . implode(', ', $tabValues) . ")";
|
|
$qryInsert1 = $objDatabase->fxQuery($sqlInsert1);
|
|
|
|
// récupérer le id inséré
|
|
$intPk = $objDatabase->fxGetLastId();
|
|
|
|
// vérifier si on doit téléverser des fichiers
|
|
if ($tabFiles != '')
|
|
fxSetUploadFiles($strAction, $intMenu, $tabFiles, $strPk, $intPk, 0);
|
|
|
|
if (intval($intMenu) == 4) { // si on ajoute un événement, ajouter les champs par défaut
|
|
$blnChamps = fxAjouterInfosParticipant($intPk);
|
|
}
|
|
if (intval($intMenu) == 5) { // si on ajoute une épreuve, ajouter prix = 0$
|
|
$sqlInsert2 = "INSERT INTO inscriptions_epreuves_prix SET eve_id = " . intval($tabData['eve_id']) . ", epr_id = " . intval($intPk) . ", ep_date_limite = '" . $objDatabase->fxEscape($tabData['epr_date']) . "'";
|
|
$qryInsert2 = $objDatabase->fxQuery($sqlInsert2);
|
|
}
|
|
}
|
|
|
|
$_SESSION['msg'] = 101;
|
|
break;
|
|
case 'add_batch':
|
|
$tabFields = $tabValues = array();
|
|
$strHeureDebut = $tabData['txt_heure_debut'] . ':00'; // HH:mm et ajouter les secondes
|
|
$strHeureFin = $tabData['txt_heure_fin'] . ':00'; // HH:mm et ajouter les secondes
|
|
$intRepetition = intval($tabData['txt_repetition']); // en minute
|
|
$intDuree = strtotime($strHeureFin) - strtotime($strHeureDebut); // Durée de la journée en secondes
|
|
$intNbRepetitions = $intDuree / ($intRepetition * 60);
|
|
|
|
for ($intCtr = 0; $intCtr < $intNbRepetitions; $intCtr++) { // ajouter chaque plage horaire
|
|
$tabFields = $tabValues = array();
|
|
$intHeureEpreuve = strtotime($strHeureDebut) + ($intCtr * $intRepetition * 60); // heure en second
|
|
$strHeureEpreuve = date('H:i:s', $intHeureEpreuve);
|
|
$strHeureEpreuveSS = date('H:i', $intHeureEpreuve);
|
|
|
|
for ($intCtr2 = 1; $intCtr2 <= count($tabResults); $intCtr2++) { // créer le SQL à ajouter
|
|
$tabFields[] = fxUnescape($tabResults[$intCtr2]['name']);
|
|
$strValue = str_replace('%heure%', $strHeureEpreuveSS, $tabData[$tabResults[$intCtr2]['name']]);
|
|
$tabValues[] = "'" . $objDatabase->fxEscape($strValue) . "'";
|
|
}
|
|
|
|
$tabFields[] = 'epr_heure';
|
|
$tabValues[] = "'" . $strHeureEpreuve . "'";
|
|
|
|
$sqlInsert1 = "INSERT INTO " . $tabMenu['men_table'] . "(" . implode(', ', $tabFields) . ") VALUES(" . implode(', ', $tabValues) . ")";
|
|
$qryInsert1 = $objDatabase->fxQuery($sqlInsert1);
|
|
|
|
// récupérer le id inséré
|
|
$intPk = $objDatabase->fxGetLastId();
|
|
|
|
if (intval($intMenu) == 5) { // si on ajoute une épreuve, ajouter prix = 0$
|
|
$sqlInsert2 = "INSERT INTO inscriptions_epreuves_prix SET eve_id = " . intval($tabData['eve_id']) . ", epr_id = " . intval($intPk) . ", ep_date_limite = '" . $objDatabase->fxEscape($tabData['epr_date']) . "'";
|
|
$qryInsert2 = $objDatabase->fxQuery($sqlInsert2);
|
|
}
|
|
}
|
|
|
|
$_SESSION['msg'] = 101;
|
|
break;
|
|
case 'mod':
|
|
$tabSql = array();
|
|
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabResults); $intCtr++) {
|
|
// stocker les valeurs
|
|
if (is_array($tabData[$tabResults[$intCtr]['name']])) {
|
|
$strValue = implode(',', $tabData[$tabResults[$intCtr]['name']]);
|
|
} else {
|
|
$strValue = $tabData[$tabResults[$intCtr]['name']];
|
|
}
|
|
|
|
$tabSql[] = fxUnescape($tabResults[$intCtr]['name']) . " = '" . $objDatabase->fxEscape($strValue) . "'";
|
|
}
|
|
|
|
$sqlUpdate = "UPDATE " . $tabMenu['men_table'] . " SET " . implode(', ', $tabSql) . " WHERE " . $strPk . " = " . intval($tabData[$strPk]);
|
|
|
|
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
|
|
|
|
|
// CON-265
|
|
// vérifier si on doit téléverser des fichiers
|
|
if ($tabFiles != '')
|
|
fxSetUploadFiles($strAction, $intMenu, $tabFiles, $strPk, $tabData[$strPk], 0);
|
|
|
|
$_SESSION['msg'] = 102;
|
|
break;
|
|
case 'del':
|
|
case 'copy':
|
|
$qryDelete = false;
|
|
foreach ($tabData['chk_' . $intMenu] as $intId) {
|
|
if ($strAction == 'del') { // effacer les items
|
|
// effacer les fichiers
|
|
fxSetUploadFiles($strAction, $intMenu, $tabFiles, $strPk, $intId, 0);
|
|
|
|
$sqlDelete = "DELETE FROM " . $tabMenu['men_table'] . " WHERE " . $strPk . " = " . intval($intId);
|
|
$qryDelete = $objDatabase->fxQuery($sqlDelete);
|
|
|
|
$_SESSION['msg'] = 103;
|
|
} elseif ($strAction == 'copy') { // dupliquer les items et leur sous-items
|
|
fxDuplicate($intMenu, $intId);
|
|
$_SESSION['msg'] = 105;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* if ($tabMenu['sous_men_id'] != 0)
|
|
$strLinkRetour = 'index.php?t=' . urlencode(base64_encode(fxUnescape($tabMenu['sous_men_id']))) . '&a=mod&id=' . intval($tabData[fxGetPK($tabMenu['sous_men_id'])]);
|
|
else
|
|
$strLinkRetour = 'index.php?t=' . urlencode(base64_encode($intMenu)) . '&a=list';
|
|
|
|
header('Location: ' . $strLinkRetour); */
|
|
if ($pasdesuite == 0) {
|
|
header('Location: ' . fxGetReferer());
|
|
if ($strAction == 'add' || $strAction == 'add_batch') {
|
|
if ($tabMenu['sous_men_id'] != 0)
|
|
$strLinkRetour = 'index.php?t=' . urlencode(base64_encode(fxUnescape($tabMenu['sous_men_id']))) . '&a=mod&id=' . intval($tabData[fxGetPK($tabMenu['sous_men_id'])]);
|
|
else
|
|
$strLinkRetour = 'index.php?t=' . urlencode(base64_encode($intMenu)) . '&a=list';
|
|
|
|
header('Location: ' . $strLinkRetour);
|
|
} elseif ($strAction == 'del') {
|
|
return $qryDelete;
|
|
} else {
|
|
header('Location: ' . fxGetReferer());
|
|
}
|
|
exit;
|
|
}
|
|
}
|
|
|
|
// fonction pour effacer une image en particulier (JSP)
|
|
// param : nom de la table, données post, numéro du fichier à effacer
|
|
function fxDeleteFile($intMenu, $intKey, $intFile)
|
|
{
|
|
$intMenu = base64_decode(urldecode($intMenu));
|
|
$tabMenu = fxGetMenussuperadm($intMenu);
|
|
$strPk = $tabMenu['men_pk'];
|
|
|
|
fxSetUploadFiles('del', $intMenu, '', $strPk, $intKey, $intFile);
|
|
|
|
$_SESSION['msg'] = 104;
|
|
$arrReturn['state'] = 'success';
|
|
$arrReturn['message'] = fxMessage(104, 'fr');
|
|
return $arrReturn;
|
|
|
|
/*if ($tabMenu['sous_men_id'] != 0)
|
|
$strLinkRetour = 'index.php?t=' . urlencode(base64_encode(fxUnescape($tabMenu['sous_men_id']))) . '&a=mod&id=' . intval($tabData[fxGetPK($tabMenu['sous_men_id'])]);
|
|
else
|
|
$strLinkRetour = 'index.php?t=' . urlencode(base64_encode($intMenu)) . '&a=list';
|
|
|
|
header('Location: ' . $strLinkRetour);
|
|
exit;*/
|
|
}
|
|
|
|
// fonction qui récupère les menus à afficher (JSP)
|
|
// param : id du menu, id du sous-menu, rapport (oui/non)
|
|
function fxGetMenussuperadm($intMenu = 0, $intSousMenu = 0, $intRapport = 0, $intRef = 0, $intCanmore = 0, $men_actif = 1)
|
|
{
|
|
global $objDatabase;
|
|
|
|
if ($intMenu != 0) {
|
|
fxUpdatePK($intMenu);
|
|
|
|
$strWhere = "men_id = " . intval($intMenu);
|
|
} elseif ($intSousMenu != 0) {
|
|
$strWhere = "sous_men_id = " . intval($intSousMenu);
|
|
} else {
|
|
$strWhere = "sous_men_id = 0";
|
|
}
|
|
|
|
if ($intRef != 0) {
|
|
$strWhere = "(men_ref = " . intval($intRef) . " OR men_id IN(144, 145))";
|
|
}
|
|
|
|
if ($intRapport == 0) {
|
|
$strWhere .= " AND men_rapport <> 1";
|
|
} else {
|
|
$strWhere .= " AND men_rapport = 1";
|
|
}
|
|
|
|
$strWhere .= " AND men_canmore = " . intval($intCanmore);
|
|
if ($intMenu != 30)
|
|
$strWhere .= " and men_id<>30";
|
|
$sqlMenus = "SELECT * FROM adm_menus WHERE men_actif = " . $men_actif . " and " . $strWhere . " ORDER BY men_tri";
|
|
|
|
if ($intMenu != 0) {
|
|
$tabMenus = $objDatabase->fxGetRow($sqlMenus);
|
|
|
|
if ($tabMenus['men_include'] != '') {
|
|
include_once($tabMenus['men_include']);
|
|
|
|
if (isset($_SESSION['rapports'][$tabMenus['men_id']])) {
|
|
$tabMenus['men_from'] = $tabMenus['men_table'] = $_SESSION['rapports'][$tabMenus['men_id']];
|
|
}
|
|
}
|
|
} else {
|
|
$tabMenus = $objDatabase->fxGetResults($sqlMenus);
|
|
}
|
|
|
|
return $tabMenus;
|
|
}
|
|
|
|
// fonction qui récupère la valeur retounée par le autocomplete. Sert lors de la modification (JSP)
|
|
// param : code SQL, code WHERE, le champ à chercher, la valeur du champ à chercher
|
|
function fxGetAutocompleteValue($sqlList, $strWhere, $strKey, $intValue)
|
|
{
|
|
global $objDatabase;
|
|
$sqlSearch = $sqlList;
|
|
|
|
if ($strWhere != '')
|
|
$sqlSearch .= " WHERE " . $strWhere . " AND " . $strKey . " = " . intval($intValue);
|
|
else
|
|
$sqlSearch .= " WHERE " . $strKey . " = " . intval($intValue);
|
|
|
|
$tabSearch = $objDatabase->fxGetRow($sqlSearch);
|
|
|
|
return fxUnescape($tabSearch['value']);
|
|
}
|
|
|
|
function fxGetEvenement($intEpreuve)
|
|
{
|
|
global $objDatabase;
|
|
|
|
$sqlEvenement = "SELECT eve_id FROM inscriptions_epreuves WHERE epr_id = " . intval($intEpreuve);
|
|
$intEvenement = $objDatabase->fxGetVar($sqlEvenement);
|
|
|
|
return $intEvenement;
|
|
}
|
|
|
|
function fxRemoveAccents($string)
|
|
{
|
|
$unwanted_array = array(
|
|
'Š' => 'S', 'š' => 's', 'Ž' => 'Z', 'ž' => 'z', 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'A', 'Ç' => 'C', 'È' => 'E', 'É' => 'E',
|
|
'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ø' => 'O', 'Ù' => 'U',
|
|
'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ý' => 'Y', 'Þ' => 'B', 'ß' => 'Ss', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'a', 'ç' => 'c',
|
|
'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ð' => 'o', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o',
|
|
'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ý' => 'y', 'þ' => 'b', 'ÿ' => 'y'
|
|
);
|
|
|
|
return strtr($string, $unwanted_array);
|
|
}
|
|
|
|
|
|
function fxShowReport($intEvenement, $strReport, $strWhere, $strOrder, $strLangue, $blnExcel = false, $blnSansAccents = false, $blnCSV = false, $strType = '', $chk = '', $typeoutput = 'html')
|
|
{
|
|
global $strTitreRapportTQ;
|
|
$mem_pdf_output = 'P';
|
|
$mem_pdf_format = 'Letter';
|
|
if ($typeoutput == 'pdf_pay') {
|
|
$typeoutput = 'pdf';
|
|
$mem_pdf_output = 'L';
|
|
}
|
|
if ($typeoutput == 'pdf_leg') {
|
|
$typeoutput = 'pdf';
|
|
$mem_pdf_output = 'P';
|
|
$mem_pdf_format = 'Legal';
|
|
}
|
|
if ($typeoutput == 'pdf_pay_leg') {
|
|
$typeoutput = 'pdf';
|
|
$mem_pdf_output = 'L';
|
|
$mem_pdf_format = 'Legal';
|
|
}
|
|
$chkbypass = 'false';
|
|
|
|
if ($chk == 'false') {
|
|
|
|
$chk = array(
|
|
"9999" => "1"
|
|
|
|
);
|
|
$chkbypass = 'true';
|
|
|
|
|
|
}
|
|
|
|
|
|
global $objDatabase, $vDomaine, $objDatabasePreProd, $objDatabasecrm,$objDatabaseProd;
|
|
$com_id = 0;
|
|
|
|
if (isset($_SESSION['com_info']['com_id'])) {
|
|
$com_id = $_SESSION['com_info']['com_id'];
|
|
}
|
|
$result = conf_getFiltreData($com_id, 'rapp_chronoquestion', 'chk_col', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60', 0, 1);
|
|
$array = explode(',', $result);
|
|
$keycheck = array_fill_keys($array, '1');
|
|
|
|
$result = conf_getFiltreData($com_id, 'rapp_chronoquestion', 'chk_ques', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60', 0, 1);
|
|
$array = explode(',', $result);
|
|
$keycheckques = array_fill_keys($array, '1');
|
|
|
|
$result = conf_getFiltreData($com_id, 'rapp_chronoquestion', 'trie', 'N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N', 0, 1);
|
|
$keytrie = explode(',', $result);
|
|
array_unshift($keytrie, '');
|
|
|
|
$result = conf_getFiltreData($com_id, 'rapp_chronoquestion', 'trie_ordre', '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0', 0, 1);
|
|
$keytrie_ordre = explode(',', $result);
|
|
array_unshift($keytrie_ordre, '');
|
|
$keytrie_ordresort = $keytrie_ordre;
|
|
asort($keytrie_ordresort);
|
|
$mem_groupe_field = 0;
|
|
foreach ($keytrie_ordresort as $key => $val) {
|
|
|
|
if ($val > 0) {
|
|
if ($key < 36) {
|
|
$mem_groupe_field = $key + 1;
|
|
break;
|
|
} else {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
if ($mem_groupe_field == 0) {
|
|
$mem_groupe_field_oui = conf_getFiltreData($com_id, 'rapp_chronoquestion', 'trie_groupe', 'false', 1, 1);
|
|
|
|
|
|
} else {
|
|
|
|
$mem_groupe_field_oui = conf_getFiltreData($com_id, 'rapp_chronoquestion', 'trie_groupe', '0', 0, 1);
|
|
|
|
}
|
|
|
|
$objPHPExcel = $sharedStyle1 = $sharedStyle2 = $sharedStyle3 = $tabQuestions1 = $tabQuestions2 = null;
|
|
$arrBoutonExcel = array();
|
|
$strStartTime = microtime(true);
|
|
$strOutput = $memexcfichier = '';
|
|
$intNbParPage = 3000;
|
|
$intNbTotal = 0;
|
|
$intPage = (isset($_GET['pg'])) ? trim($_GET['pg']) : 1;
|
|
$blnPager = false;
|
|
$strWarning = '
|
|
<div class="alert alert-primary" role="alert">
|
|
<i class="fa fa-info-circle mr-2" aria-hidden="true"></i>
|
|
<strong>Nouveau:</strong> le rapport transactions finances ouvre maintenant que sur les transactions du mois courant. Utilisez la recherche par date d\'achat pour voir les transactions précédentes.
|
|
</div>
|
|
';
|
|
$strWarning2 = '
|
|
<div class="alert alert-danger" role="alert">
|
|
<i class="fa fa-exclamation-circle mr-2" aria-hidden="true"></i>
|
|
<strong>AVERTISSEMENT:</strong> Pour le moment, les rapports fonctionnent sans erreur seulement qu\'avec <a href="https://www.mozilla.org/fr/firefox/new/" target="_blank">Mozilla Firefox</a>. Nous travaillons à ce qu\'ils fonctionnent bien dans tous les fureteurs.
|
|
</div>
|
|
';
|
|
$strWarning = '';
|
|
//$strOutput .= $strWarning2;
|
|
|
|
// préparation excel
|
|
|
|
|
|
if ($typeoutput == 'excel') {
|
|
|
|
|
|
/** Include PHPExcel */
|
|
include_once dirname(__FILE__) . '/Classes/PHPExcel.php';
|
|
|
|
// Create new PHPExcel object
|
|
$objPHPExcel = new PHPExcel();
|
|
$sharedStyle1 = new PHPExcel_Style();
|
|
$sharedStyle1->applyFromArray(
|
|
array('fill' => array(
|
|
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
|
'color' => array('argb' => 'FF969696')
|
|
)));
|
|
|
|
$sharedStyle2 = new PHPExcel_Style();
|
|
$sharedStyle2->applyFromArray(
|
|
array('fill' => array(
|
|
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
|
'color' => array('argb' => 'FFC0C0C0')
|
|
)));
|
|
|
|
$sharedStyle3 = new PHPExcel_Style();
|
|
$sharedStyle3->applyFromArray(
|
|
array('fill' => array(
|
|
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
|
'color' => array('argb' => 'FFFFFF00')
|
|
))
|
|
);
|
|
}
|
|
|
|
if ($typeoutput == 'html') {
|
|
if ($strLangue == 'fr') {
|
|
$arrBoutonExcel[] = array('excel', "Exportation excel", "ico_excel.png");
|
|
} else {
|
|
$arrBoutonExcel[] = array('excel', "Export to excel", "ico_excel.png");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
// événement
|
|
$sqlEvenement = "SELECT * FROM inscriptions_evenements WHERE eve_id = " . intval($intEvenement);
|
|
$tabEvenement = $objDatabase->fxGetRow($sqlEvenement);
|
|
$strNomEvenement = $tabEvenement['eve_nom_' . $strLangue];
|
|
|
|
switch ($strReport) {
|
|
case 'chrono':
|
|
$memexcfichier = "rapport-chrono";
|
|
$intNbQuestions = $intWidthQuestions = 0;
|
|
|
|
// colonne
|
|
if ($blnCSV) {
|
|
switch ($strType) {
|
|
case 'mailchimp':
|
|
$strClef = 'rap_mailchimp';
|
|
break;
|
|
case 'animateur':
|
|
$strClef = 'rap_animateur';
|
|
$strOrder = "p.no_bib ASC";
|
|
break;
|
|
}
|
|
} else {
|
|
$sqlQuestions1 = "
|
|
SELECT
|
|
que_id, que_question_" . $strLangue . ", que_rapport_label_" . $strLangue . "
|
|
FROM
|
|
inscriptions_questions
|
|
WHERE
|
|
que_rapport = 1 AND eve_id = " . intval($intEvenement) . "
|
|
ORDER BY
|
|
que_tri, que_id
|
|
";
|
|
$tabQuestions1 = $objDatabase->fxGetResults($sqlQuestions1);
|
|
|
|
if ($tabQuestions1 != null) {
|
|
$intNbQuestions = count($tabQuestions1);
|
|
$intWidthQuestions = $intNbQuestions * 200;
|
|
}
|
|
|
|
$sqlQuestions2 = "
|
|
SELECT
|
|
rq.que_validation,rq.pec_id, rq.par_id, rq.que_id, rq.que_question_" . $strLangue . ", rq.que_choix_" . $strLangue . ", iq.que_rapport_label_" . $strLangue . "
|
|
FROM
|
|
resultats_questions rq, inscriptions_questions iq
|
|
WHERE
|
|
rq.que_id = iq.que_id AND iq.que_rapport = 1 AND iq.eve_id = " . intval($intEvenement) . "
|
|
ORDER BY
|
|
rq.pec_id, rq.par_id, rq.que_id
|
|
";
|
|
$qryQuestions2 = $objDatabase->fxQuery($sqlQuestions2);
|
|
$nbQuestions2 = $objDatabase->fxGetNumRows($qryQuestions2);
|
|
$tabQuestions2 = array();
|
|
|
|
if ($nbQuestions2 > 0) {
|
|
while ($rowQuestions = $objDatabase->fxFetchAssoc($qryQuestions2))
|
|
$tabQuestions2[$rowQuestions['pec_id']][$rowQuestions['par_id']][$rowQuestions['que_id']] = $rowQuestions;
|
|
}
|
|
}
|
|
|
|
|
|
$strClef = 'rap_questions';
|
|
$sqlCol = "select * from info where info_actif = 1 AND info_clef='" . $strClef . "' and info_langue='" . $strLangue . "' order by info_trie";
|
|
|
|
$tabCol = $objDatabase->fxGetResults($sqlCol);
|
|
|
|
|
|
// SQL
|
|
$sqlParticipants = "
|
|
SELECT
|
|
|
|
(SELECT com_affilie FROM inscriptions_comptes WHERE com_id = p.com_id) AS associe,a.no_panier, p.par_categorie_1_court_fr,p.par_categorie_1_long_fr,ec.no_commande, p.par_id_original, p.no_bib AS bib, p.par_prenom AS firstname, p.par_nom AS lastname, p.par_sexe AS sexe, p.par_ville AS city,no_bib_remis_date,no_bib_remis,no_bib_remis_par,(SELECT pro_iso FROM inscriptions_provinces WHERE pro_id = p.pro_id) AS state_iso, (SELECT pro_nom_" . $strLangue . " FROM inscriptions_provinces WHERE pro_id = p.pro_id) AS state, CONCAT(e.epr_type_" . $strLangue . ",' - ',e.epr_nom_" . $strLangue . ") AS race, (SELECT pay_iso FROM inscriptions_pays WHERE pay_id = p.pay_id) AS country_iso,(SELECT pay_nom_" . $strLangue . " FROM inscriptions_pays WHERE pay_id = p.pay_id) AS country, p.par_age AS age, (SELECT rq.que_choix_" . $strLangue . " FROM resultats_questions rq, inscriptions_questions q WHERE rq.que_id = q.que_id AND rq.que_actif = 1 AND rq.pec_id = ec.pec_id_original AND q.que_validation = 'categorie' LIMIT 1) AS categorie, 0 AS vip, p.par_naissance AS DOB, ec.pec_equipe AS team, ec.no_equipe AS no_team, ec.pec_equipe, ec.pec_nom_equipe AS team_name, (SELECT SUM(par_age) FROM resultats_participants WHERE pec_id = p.pec_id AND is_cancelled = 0 AND rol_id <= 2) AS team_age, IF(p.par_modification_promoteur = 1, p.par_maj, (SELECT ach_maj FROM inscriptions_panier_acheteurs WHERE no_commande = ec.no_commande)) AS date_inscription, p.par_adresse, p.par_adresse2, p.par_codepostal, p.par_telephone1, p.par_courriel, p.pec_id, e.epr_categorie_" . $strLangue . ", e.epr_type_" . $strLangue . " AS type, e.epr_nom_" . $strLangue . " AS details, (SELECT rol_nom_" . $strLangue . " FROM inscriptions_roles WHERE p.rol_id = rol_id) AS role, p.par_contact_urgence_nom, p.par_contact_urgence_telephone, a.ach_maj
|
|
FROM
|
|
resultats_participants p
|
|
JOIN resultats_epreuves_commandees ec ON p.pec_id = ec.pec_id_original
|
|
JOIN inscriptions_epreuves e ON ec.epr_id = e.epr_id
|
|
JOIN inscriptions_panier_acheteurs a ON ec.no_panier = a.no_panier
|
|
";
|
|
|
|
$sqlParticipants .= " WHERE ec.pec_actif = 1 AND ec.is_cancelled = 0 AND p.is_cancelled = 0 AND p.eve_id = " . intval($intEvenement);
|
|
// $sqlParticipants .= " WHERE p.eve_id = " . intval($intEvenement);
|
|
|
|
|
|
|
|
if (isset($strWhere['acheteur']) && trim($strWhere['acheteur']) != '') {
|
|
$sqlParticipants .= " AND " . $strWhere['acheteur'];
|
|
}
|
|
|
|
|
|
// print_r($keytrie_ordresort);
|
|
$mem_order = '';
|
|
foreach ($keytrie_ordresort as $key => $val) {
|
|
|
|
if ($val > 0) {
|
|
if ($key < 36) {
|
|
if ($keytrie[$key] == 'A')
|
|
$mem_asdes = 'ASC';
|
|
else
|
|
$mem_asdes = 'DESC';
|
|
if ($tabCol[$key + 1]['info_description'] == 'num')
|
|
$mem_field = ' CAST(' . $tabCol[$key + 1]['info_option2'] . ' AS unsigned)';
|
|
else
|
|
$mem_field = $tabCol[$key + 1]['info_option2'];
|
|
$mem_order = $mem_order . $mem_field . ' ' . $mem_asdes . ',';
|
|
} else {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
// echo ( $key);
|
|
// echo ( $mem_order);
|
|
// print("<pre>".print_r($tabCol,true)."</pre>") ;
|
|
// exit;
|
|
|
|
$mem_order = rtrim($mem_order, ',');
|
|
//echo ( $mem_order);
|
|
//print("<pre>".print_r($tabCol,true)."</pre>") ;
|
|
|
|
|
|
if (trim($strOrder) != '') {
|
|
$sqlParticipants .= " ORDER BY " . $strOrder;
|
|
} else {
|
|
if ($mem_order <> '')
|
|
$sqlParticipants .= " ORDER BY " . $mem_order;
|
|
else
|
|
$sqlParticipants .= " ORDER BY date_inscription, p.par_id_original, p.no_bib, p.par_nom, p.par_prenom";
|
|
}
|
|
|
|
|
|
$tabParticipants = $objDatabase->fxGetResults($sqlParticipants);
|
|
|
|
// print("<pre>".print_r($tabParticipants,true)."</pre>");
|
|
|
|
if (($typeoutput == 'html')) {
|
|
if ($strLangue == 'fr') {
|
|
$strTitreRapport = "Rapport: chrono + questions";
|
|
$arrBoutonExcel[] = array('excel_na', "Exportation excel <small>(sans accents)</small>", "ico_excel.png");
|
|
$arrBoutonExcel[] = array('excel_mc', "Exportation CSV <small>(mail chimp)</small>", "ico_excel.png");
|
|
|
|
$arrBoutonExcel[] = array('pdf', "Rapport PDF <small>(portrait)</small>", "ico_pdf.png");
|
|
$arrBoutonExcel[] = array('pdf_pay', "Rapport PDF <small>(paysage)</small>", "ico_pdf.png");
|
|
$arrBoutonExcel[] = array('pdf_leg', "Rapport PDF <small>(portrait legal)</small>", "ico_pdf.png");
|
|
$arrBoutonExcel[] = array('pdf_pay_leg', "Rapport PDF <small>(paysage legal)</small>", "ico_pdf.png");
|
|
|
|
|
|
} else {
|
|
$strTitreRapport = "Report: chrono + questions";
|
|
$arrBoutonExcel[] = array('excel_na', "Export to excel <small>(w/o accents)</small>", "ico_excel.png");
|
|
$arrBoutonExcel[] = array('excel_mc', "Export to CSV <small>(mail chimp)</small>", "ico_excel.png");
|
|
|
|
$arrBoutonExcel[] = array('pdf', "Rapport PDF <small>(portrait)</small>", "ico_pdf.png");
|
|
$arrBoutonExcel[] = array('pdf_pay', "Rapport PDF <small>(paysage)</small>", "ico_pdf.png");
|
|
$arrBoutonExcel[] = array('pdf_leg', "Rapport PDF <small>(portrait legal)</small>", "ico_pdf.png");
|
|
$arrBoutonExcel[] = array('pdf_pay_leg', "Rapport PDF <small>(paysage legal)</small>", "ico_pdf.png");
|
|
|
|
}
|
|
|
|
$strOutput .= fxShowRapportHeader($strTitreRapport, $strNomEvenement, $arrBoutonExcel);
|
|
}
|
|
|
|
$GLOBALS["Evenement"] = $strNomEvenement;
|
|
$GLOBALS["mem_groupe_field_oui"] = $mem_groupe_field_oui;
|
|
if ($typeoutput == 'pdf') {
|
|
// prepare pdf
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . '/fpdf182/fpdf.php');
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . '/fpdi2/src/autoload.php');
|
|
|
|
|
|
ob_end_clean();
|
|
|
|
class PDF extends Fpdi
|
|
{
|
|
// Page header
|
|
function FancyTable($header, $data, $memwidth)
|
|
{
|
|
|
|
|
|
// Colors, line width and bold font
|
|
$this->SetFillColor(0, 0, 0);
|
|
$this->SetTextColor(255);
|
|
$this->SetDrawColor(0, 0, 0);
|
|
$this->SetLineWidth(.3);
|
|
$this->SetFont('', 'B');
|
|
$this->SetFontSize(8);
|
|
// Header
|
|
|
|
for ($i = 0; $i < count($header); $i++)
|
|
$this->Cell($memwidth[$i], 7, utf8_decode($header[$i]), 1, 0, 'L', true);
|
|
$this->Ln();
|
|
// Color and font restoration
|
|
$this->SetFillColor(215, 219, 219);
|
|
$this->SetTextColor(0);
|
|
$this->SetFont('', '');
|
|
$this->SetFontSize(8);
|
|
|
|
// Data
|
|
$fill = false;
|
|
foreach ($data as $row) {
|
|
$nb = 0;
|
|
for ($i = 0; $i < count($row); $i++) {
|
|
$nb = max($nb, $this->NbLines($memwidth[$i], $row[$i]));
|
|
|
|
}
|
|
$h = 5 * $nb;
|
|
|
|
$this->CheckPageBreak($h);
|
|
// print("<pre>".print_r($row,true)."</pre>") ;exit;
|
|
if ($GLOBALS["mem_groupe_field_oui"] == 'true') {
|
|
if ($GLOBALS["mem_sous_groupe"] <> $row[$GLOBALS["mem_groupe_fieldnew"]]) {
|
|
$GLOBALS["mem_sous_groupe"] = $row[$GLOBALS["mem_groupe_fieldnew"]];
|
|
$this->AddPage();
|
|
// Colors, line width and bold font
|
|
$this->SetFillColor(0, 0, 0);
|
|
$this->SetTextColor(255);
|
|
$this->SetDrawColor(0, 0, 0);
|
|
$this->SetLineWidth(.3);
|
|
$this->SetFont('', 'B');
|
|
$this->SetFontSize(8);
|
|
// Header
|
|
|
|
for ($i = 0; $i < count($header); $i++)
|
|
$this->Cell($memwidth[$i], 7, utf8_decode($header[$i]), 1, 0, 'L', true);
|
|
$this->Ln();
|
|
// Color and font restoration
|
|
$this->SetFillColor(215, 219, 219);
|
|
$this->SetTextColor(0);
|
|
$this->SetFont('', '');
|
|
$this->SetFontSize(8);
|
|
|
|
}
|
|
}
|
|
$l = 0;
|
|
$x = $this->x;
|
|
$y = $this->y;
|
|
$push_right = 0;
|
|
foreach ($row as $ligne) {
|
|
$x = $this->GetX();
|
|
$y = $this->GetY();
|
|
if ($fill)
|
|
$this->Rect($x, $y, $memwidth[$l], $h, 'F');
|
|
$this->MultiCell($memwidth[$l], 5, utf8_decode($ligne), 0, 'L');
|
|
|
|
$this->SetXY($x + $memwidth[$l], $y);
|
|
|
|
|
|
$l = $l + 1;
|
|
}
|
|
|
|
$this->Ln($h);
|
|
$fill = !$fill;
|
|
}
|
|
// Closing line
|
|
|
|
}
|
|
|
|
function NbLines($w, $txt)
|
|
{
|
|
// Compute the number of lines a MultiCell of width w will take
|
|
if (!isset($this->CurrentFont))
|
|
$this->Error('No font has been set');
|
|
$cw = $this->CurrentFont['cw'];
|
|
if ($w == 0)
|
|
$w = $this->w - $this->rMargin - $this->x;
|
|
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
|
|
$s = str_replace("\r", '', (string)$txt);
|
|
$nb = strlen($s);
|
|
if ($nb > 0 && $s[$nb - 1] == "\n")
|
|
$nb--;
|
|
$sep = -1;
|
|
$i = 0;
|
|
$j = 0;
|
|
$l = 0;
|
|
$nl = 1;
|
|
while ($i < $nb) {
|
|
$c = $s[$i];
|
|
if ($c == "\n") {
|
|
$i++;
|
|
$sep = -1;
|
|
$j = $i;
|
|
$l = 0;
|
|
$nl++;
|
|
continue;
|
|
}
|
|
if ($c == ' ')
|
|
$sep = $i;
|
|
$l += $cw[$c];
|
|
if ($l > $wmax) {
|
|
if ($sep == -1) {
|
|
if ($i == $j)
|
|
$i++;
|
|
} else
|
|
$i = $sep + 1;
|
|
$sep = -1;
|
|
$j = $i;
|
|
$l = 0;
|
|
$nl++;
|
|
} else
|
|
$i++;
|
|
}
|
|
return $nl;
|
|
}
|
|
|
|
function CheckPageBreak($h)
|
|
{
|
|
|
|
$mem_header_pdf = $GLOBALS["mem_header_pdf"];
|
|
$mem_width_pdf = $GLOBALS["mem_width_pdf"];
|
|
|
|
// If the height h would cause an overflow, add a new page immediately
|
|
if ($this->GetY() + $h > $this->PageBreakTrigger) {
|
|
$this->AddPage();
|
|
// Colors, line width and bold font
|
|
$this->SetFillColor(0, 0, 0);
|
|
$this->SetTextColor(255);
|
|
$this->SetDrawColor(0, 0, 0);
|
|
$this->SetLineWidth(.3);
|
|
$this->SetFont('', 'B');
|
|
$this->SetFontSize(8);
|
|
// Header
|
|
|
|
for ($i = 0; $i < count($mem_header_pdf); $i++)
|
|
$this->Cell($mem_width_pdf[$i], 7, utf8_decode($mem_header_pdf[$i]), 1, 0, 'L', true);
|
|
$this->Ln();
|
|
// Color and font restoration
|
|
$this->SetFillColor(215, 219, 219);
|
|
$this->SetTextColor(0);
|
|
$this->SetFont('', '');
|
|
$this->SetFontSize(8);
|
|
}
|
|
}
|
|
|
|
function Header()
|
|
{
|
|
|
|
// Logo
|
|
// $this->Image('logo.png',10,6,30);
|
|
// Arial bold 15
|
|
$this->SetFont('Arial', 'B', 15);
|
|
// Move to the right
|
|
|
|
// Title
|
|
$this->Cell(0, 0, utf8_decode($GLOBALS["Evenement"]), 0, 0, 'L');
|
|
$this->SetFont('Arial', '', 12);
|
|
$this->Cell(0, 0, utf8_decode(date("F j, Y, g:i a")), 0, 0, 'R');
|
|
|
|
//if ($GLOBALS["mem_groupe_field_oui"]=='true') {
|
|
$this->Ln(5);
|
|
$this->Cell(0, 0, utf8_decode($GLOBALS["mem_sous_groupe"]), 0, 0, 'L');
|
|
|
|
|
|
// }
|
|
// Line break
|
|
$this->Ln(10);
|
|
}
|
|
|
|
// Page footer
|
|
function Footer()
|
|
{
|
|
// Position at 1.5 cm from bottom
|
|
$this->SetY(-8);
|
|
// Arial italic 8
|
|
$this->SetFont('Arial', 'I', 8);
|
|
// Page number
|
|
$this->Cell(0, 5, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'R');
|
|
}
|
|
}
|
|
|
|
|
|
$pdf = new PDF($mem_pdf_output, 'mm', $mem_pdf_format);
|
|
$pdf->SetMargins(6, 6, 6);
|
|
$pdf->AliasNbPages();
|
|
$pdf->SetAutoPageBreak(true, 4);
|
|
|
|
|
|
}
|
|
|
|
if ($tabParticipants != null) {
|
|
$intTotal = count($tabParticipants);
|
|
$intNbCol = 19 + $intNbQuestions;
|
|
// HEADER
|
|
if (($typeoutput == 'html')) { // HTML ICI
|
|
|
|
|
|
if ($mem_groupe_field != 0) {
|
|
|
|
|
|
if ($mem_groupe_field_oui == 'true')
|
|
$check = 'checked';
|
|
else
|
|
$check = '';
|
|
|
|
if ($strLangue == 'fr') {
|
|
$strTitregrouper = "Faire des sauts de page (PDF) pour chacun des groupes du tri: ";
|
|
} else {
|
|
$strTitregrouper = "Add page break for each priority 1 sorting group (PDF):";
|
|
}
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: left; width: 200px;">
|
|
<input id="groupe" class="" type="checkbox" name="groupe" value="' . $mem_groupe_field_oui . '" ' . $check . '> ' . $strTitregrouper . $tabCol[$mem_groupe_field]['info_texte'] . '
|
|
</th>
|
|
';
|
|
|
|
|
|
}
|
|
|
|
$intWidthQuestions += 2140;
|
|
$strOutput .= '
|
|
<table class="rapport table" style="width: ' . $intWidthQuestions . 'px;">
|
|
<thead> ';
|
|
|
|
|
|
$strOutput .= ' <tr><th style="text-align: left; width: 10px"> </th>
|
|
';
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: ' . $tabCol[$intCtrcol]['info_option1'] . 'px;">
|
|
' . $tabCol[$intCtrcol]['info_texte'] . '
|
|
</th>
|
|
';
|
|
}
|
|
|
|
if ($tabEvenement['te_id'] == 13) {
|
|
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 10px;">
|
|
Membre No
|
|
</th>
|
|
';
|
|
|
|
|
|
}
|
|
// compte affilie
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 10px;">
|
|
Compte associé
|
|
</th>
|
|
';
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$strLabel = $tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$strLabel = $tabQuestions1[$intCtr2]['que_id'];
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: left; width: 200px;">' . $strLabel . '</th>
|
|
';
|
|
}
|
|
}
|
|
$strOutput .= '
|
|
</tr>';
|
|
$strOutput .= '<tr> <th><i id="checkall" class="fa fa-check-circle" aria-hidden="true"></i></th>';
|
|
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
if (array_key_exists($intCtrcol, $keycheck))
|
|
$check = 'checked';
|
|
else
|
|
$check = '';
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: ' . $tabCol[$intCtrcol]['info_option1'] . 'px;">
|
|
<input id="checkallid" class="check" type="checkbox" name="chk_col[' . $intCtrcol . ']" value="' . $intCtrcol . '" ' . $check . '>
|
|
</th>
|
|
';
|
|
}
|
|
|
|
|
|
if ($tabEvenement['te_id'] == 13) {
|
|
$check = '';
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 10px;">
|
|
<input class="check" type="checkbox" name="chk_colmembre" value="chk_colmembre" ' . $check . '>
|
|
</th>
|
|
';
|
|
}
|
|
// compte affilie
|
|
|
|
|
|
if (array_key_exists('chk_affilie', $keycheck))
|
|
$check = 'checked';
|
|
else
|
|
$check = '';
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 10px;">
|
|
<input class="check" type="checkbox" name="chk_affilie" value="chk_affilie" ' . $check . '>
|
|
|
|
</th>
|
|
';
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
|
|
if (array_key_exists($intCtr2, $keycheckques))
|
|
$check = 'checked';
|
|
else
|
|
$check = '';
|
|
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$strLabel = $tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$strLabel = $tabQuestions1[$intCtr2]['que_id'];
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: left; width: 200px;"> <input class="check_ques" type="checkbox" name="chk_ques[' . $intCtr2 . ']" value="' . $intCtr2 . '" ' . $check . '>
|
|
</th>
|
|
';
|
|
}
|
|
}
|
|
|
|
$strOutput .= '<tr><th><i id="checkalltrie" class="fa fa-check-circle" aria-hidden="true"></i></th><th> </th>';
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
$mem_index = $intCtrcol - 1;
|
|
|
|
switch ($keytrie[$mem_index]) {
|
|
case 'A':
|
|
$strImage = '<i class="fa fa-sort-asc" aria-hidden="true"></i>';
|
|
|
|
break;
|
|
case 'D':
|
|
$strImage = '<i class="fa fa-sort-desc" aria-hidden="true"></i>';
|
|
|
|
break;
|
|
case 'N':
|
|
$strImage = '<i class="fa fa-sort" aria-hidden="true"></i>';
|
|
|
|
break;
|
|
}
|
|
if ($keytrie_ordre[$mem_index] == 0) {
|
|
$mem_trie_ordre = '';
|
|
$mem_trie_ordretxt = ' ';
|
|
} else {
|
|
$mem_trie_ordre = $keytrie_ordre[$mem_index];
|
|
$mem_trie_ordretxt = '<span class="circle">' . $mem_trie_ordre . '</span>';
|
|
}
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: ' . $tabCol[$mem_index]['info_option1'] . 'px;">';
|
|
|
|
$strOutput .= '<span id="' . $mem_index . '"><a class="checktrie" href="#" data-action="trie" data-index="' . $mem_index . '" data-trie="' . $keytrie[$mem_index] . '" data-trie-ordre="' . $mem_trie_ordre . '" data-field="no_bib_remis" data-key="par_id" data-valeur=" " data-id=" ">' . $strImage . '</span>' . $mem_trie_ordretxt . '
|
|
';
|
|
$strOutput .= ' </th>
|
|
';
|
|
}
|
|
|
|
|
|
if ($tabEvenement['te_id'] == 13) {
|
|
$check = '';
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 10px;">
|
|
<input class="check" type="checkbox" name="chk_colmembre" value="chk_colmembre" ' . $check . '>
|
|
</th>
|
|
';
|
|
}
|
|
// compte affilie
|
|
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 10px;">
|
|
|
|
|
|
</th>
|
|
';
|
|
if ($intNbQuestions > 0) {
|
|
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
|
|
|
|
$strOutput .= ' <th></th>
|
|
';
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
$strOutput .= '</thead>
|
|
|
|
<tbody>
|
|
';
|
|
}
|
|
//header
|
|
if (($typeoutput == 'excel')) { // EXCEL ICI
|
|
$c = 'A';
|
|
$mem_int_ligne_entete = 1;
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
if (array_key_exists($intCtrcol, $chk['chk_col']) || $chkbypass == 'true') {
|
|
if ($blnSansAccents) {
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabCol[$intCtrcol]['info_texte'])));
|
|
} else {
|
|
$memtitre = $tabCol[$intCtrcol]['info_texte'];
|
|
}
|
|
|
|
$memwidth = $tabCol[$intCtrcol]['info_option1'] / 5;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
}
|
|
|
|
if (intval($tabEvenement['te_id']) == 13) {
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth(15);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ('Membre No'));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
if (array_key_exists(33, $chk['chk_col']) || $chkbypass == 'true') {
|
|
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth(15);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ('Compte associé'));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
|
|
|
|
if (array_key_exists($intCtr2, $chk['chk_ques']) || $chkbypass == 'true') {
|
|
|
|
if ($blnSansAccents) {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue])));
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
} else {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
}
|
|
|
|
$memwidth = 20;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//header
|
|
if (($typeoutput == 'pdf')) { // EXCEL ICI
|
|
$header_pdf = (array)null;;
|
|
$width_pdf = (array)null;;
|
|
|
|
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
if (array_key_exists($intCtrcol, $chk['chk_col']) || $chkbypass == 'true') {
|
|
|
|
if ($blnSansAccents) {
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabCol[$intCtrcol]['info_texte'])));
|
|
} else {
|
|
$memtitre = $tabCol[$intCtrcol]['info_texte'];
|
|
}
|
|
|
|
$memwidth = $tabCol[$intCtrcol]['info_option1'] / 4;
|
|
|
|
|
|
$width_pdf[] = $memwidth;
|
|
$header_pdf[] = $memtitre;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (intval($tabEvenement['te_id']) == 13) {
|
|
|
|
$width_pdf[] = 20;
|
|
$header_pdf[] = 'Membre No';
|
|
}
|
|
if (array_key_exists(33, $chk['chk_col']) || $chkbypass == 'true') {
|
|
|
|
|
|
$width_pdf[] = 20;
|
|
$header_pdf[] = 'Compte associé';
|
|
}
|
|
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
|
|
|
|
if (array_key_exists($intCtr2, $chk['chk_ques']) || $chkbypass == 'true') {
|
|
|
|
if ($blnSansAccents) {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue])));
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
} else {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
}
|
|
|
|
$memwidth = 30;
|
|
|
|
// $objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
// $objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
// $objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
// $objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
// ++$c;
|
|
$width_pdf[] = $memwidth;
|
|
$header_pdf[] = $memtitre;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
$mem_ligne = 2;
|
|
for ($intCtr = 1; $intCtr <= count($tabParticipants); $intCtr++) {
|
|
// IFS
|
|
|
|
|
|
switch ($tabParticipants[$intCtr]['sexe']) {
|
|
case 'f':
|
|
$tabParticipants[$intCtr]['sexe'] = 'F';
|
|
break;
|
|
case 'h':
|
|
$tabParticipants[$intCtr]['sexe'] = 'M';
|
|
break;
|
|
}
|
|
switch ($tabParticipants[$intCtr]['no_bib_remis']) {
|
|
case '1':
|
|
$tabParticipants[$intCtr]['no_bib_remis'] = 'OUI';
|
|
break;
|
|
case '0':
|
|
$tabParticipants[$intCtr]['no_bib_remis'] = '';
|
|
break;
|
|
}
|
|
if ($tabParticipants[$intCtr]['no_bib_remis_date'] == '0000-00-00 00:00:00') {
|
|
$tabParticipants[$intCtr]['no_bib_remis_date'] = '';
|
|
}
|
|
/* if ($tabParticipants[$intCtr]['pec_equipe'] == 0) {
|
|
$tabParticipants[$intCtr]['team_name'] = '';
|
|
} */
|
|
|
|
|
|
// BODY - PARTICIPANTS
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strClass = ($intCtr & 1) ? '' : ' class="table-secondary"';
|
|
|
|
$strOutput .= '
|
|
<tr' . $strClass . '>
|
|
<td style="text-align: center;"> </td>
|
|
<td style="text-align: center;">' . $intCtr . '</td>
|
|
';
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$mem_val = $tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
|
|
// valide email associe
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'par_courriel') {
|
|
|
|
//MSIN-4354
|
|
if ($tabParticipants[$intCtr]['associe'] == 1) {
|
|
$sqlClient = "SELECT com_courriel FROM inscriptions_comptes WHERE com_id = " . intval($tabParticipants[$intCtr]['associe']);
|
|
$nbClient = $objDatabase->fxGetRow($sqlClient);
|
|
$mem_val = $nbClient['com_courriel'];
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td style="text-align: ' . $tabCol[$intCtrcol]['info_option3'] . ';">' . $mem_val . '</td>
|
|
';
|
|
}
|
|
|
|
if (intval($tabEvenement['te_id']) == 13) {
|
|
$membre = fxGetAbonnement(0, 0, 0, $tabParticipants[$intCtr]['pec_id']);
|
|
isset($membre['mem_numero']) ? $m_membre = $membre['mem_numero'] : $m_membre = "";
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 10px;">
|
|
' . $m_membre . '
|
|
</th>
|
|
';
|
|
}
|
|
// membre associe
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 10px;">
|
|
' . $tabParticipants[$intCtr]['associe'] . '
|
|
</th>
|
|
';
|
|
|
|
// QUESTIONS
|
|
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
else
|
|
$strValue = ' ';
|
|
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']])) {
|
|
$mem_validation = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_validation'];
|
|
|
|
|
|
// if (($mem_validation == "image" || $mem_validation == "pdf") && trim($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr']) != "") {
|
|
if (($mem_validation == "image" || $mem_validation == "pdf") && trim($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue]) != "") {
|
|
|
|
|
|
$image_path = "temp/" . $tabParticipants[$intCtr]["no_panier"];
|
|
$strValue = $strValue . ' <a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/superadm/download.php?rep=' . $image_path . '&nom=' . trim($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue]) . '" target="_blank">télécharger</a>';
|
|
|
|
// $strValue = $strValue . ' <a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/rapport_new?rep=' . $intEvenement . '&nom=' . $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr'] . '" target="_blank">télécharger 1</a>';
|
|
}
|
|
}
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']])) {
|
|
$mem_validation = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_validation'];
|
|
if (($mem_validation == "image" || $mem_validation == "pdf") && trim($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr']) != "") {
|
|
|
|
$image_path = "temp/" . $tabParticipants[$intCtr]["no_panier"];
|
|
// $strValue = $strValue . ' <a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/superadm/download.php?rep=' . $image_path . '&nom=' . $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr'] . '" target="_blank">télécharger 2</a>';
|
|
|
|
$strValue = $strValue . ' <a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/superadm/download.php?rep=' . $intEvenement . '&nom=' . $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr'] . '" target="_blank">télécharger</a>';
|
|
} else {
|
|
}
|
|
}
|
|
|
|
// if ($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_validation'] == "image" || $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_validation'] == "pdf"){
|
|
// echo('file');
|
|
// }
|
|
|
|
$strOutput .= '
|
|
<td>' . $strValue . '</td>
|
|
';
|
|
}
|
|
}
|
|
$strOutput .= '
|
|
</tr>
|
|
</tbody>
|
|
';
|
|
}
|
|
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
|
|
if (!$blnCSV) {
|
|
|
|
if (array_key_exists(1, $chk['chk_col']) || $chkbypass == 'true') {
|
|
$mem_result = $intCtr;
|
|
$mem_align = 'center';
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $mem_result);
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
// }
|
|
++$c;
|
|
|
|
$intAjustecol + 1;
|
|
} else {
|
|
|
|
$intAjustecol = 0;
|
|
}
|
|
$intCtrcol = 2;
|
|
} else {
|
|
$intCtrcol = 1;
|
|
|
|
}
|
|
|
|
for ($intCtrcol; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
if (array_key_exists($intCtrcol + $intAjustecol, $chk['chk_col']) || $chkbypass == 'true') {
|
|
|
|
if ($blnSansAccents) {
|
|
$mem_result = ucwords(strtolower(fxRemoveAccents($tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']])));
|
|
} else {
|
|
$mem_result = $tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
|
|
// valide email associe
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'par_courriel') {
|
|
|
|
if ($tabParticipants[$intCtr]['associe'] != '') {
|
|
$sqlClient = "SELECT com_courriel FROM inscriptions_comptes WHERE com_id = " . intval($tabParticipants[$intCtr]['associe']);
|
|
$nbClient = $objDatabase->fxGetRow($sqlClient);
|
|
|
|
$mem_result = $nbClient['com_courriel'];
|
|
}
|
|
}
|
|
|
|
$mem_align = $tabCol[$intCtrcol]['info_option3'];
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
// }
|
|
++$c;
|
|
}
|
|
}
|
|
// membre
|
|
if ($tabEvenement['te_id'] == 13) {
|
|
$membre = fxGetAbonnement(0, 0, 0, $tabParticipants[$intCtr]['pec_id']);
|
|
isset($membre['mem_numero']) ? $m_membre = $membre['mem_numero'] : $m_membre = "";
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($m_membre));
|
|
// $objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
}
|
|
// membre associe
|
|
|
|
if (array_key_exists(33, $chk['chk_col']) || $chkbypass == 'true') {
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($tabParticipants[$intCtr]['associe']));
|
|
// $objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
++$c;
|
|
}
|
|
// QUESTIONS
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if ($blnSansAccents) {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = ucwords(strtolower(fxRemoveAccents($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue])));
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = ucwords(strtolower(fxRemoveAccents($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue])));
|
|
else
|
|
$strValue = '';
|
|
} else {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
else
|
|
$strValue = '';
|
|
}
|
|
if (array_key_exists($intCtr2, $chk['chk_ques']) || $chkbypass == 'true') {
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValueExplicit($c . $mem_ligne, trim($strValue));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal('left');
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
|
|
$mem_ligne = $mem_ligne + 1;
|
|
}
|
|
if ($typeoutput == 'pdf') { // pdf
|
|
$c = 'A';
|
|
|
|
|
|
if (array_key_exists(1, $chk['chk_col']) || $chkbypass == 'true') {
|
|
$mem_result = $intCtr;
|
|
$mem_align = 'center';
|
|
|
|
// $objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $mem_result);
|
|
// $objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
// }
|
|
$data_pdf[$mem_ligne - 1][] = $mem_result;
|
|
|
|
++$c;
|
|
|
|
$intAjustecol + 1;
|
|
} else {
|
|
|
|
$intAjustecol = 0;
|
|
}
|
|
$intCtrcol = 2;
|
|
|
|
|
|
for ($intCtrcol; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
if (array_key_exists($intCtrcol + $intAjustecol, $chk['chk_col']) || $chkbypass == 'true') {
|
|
|
|
if ($blnSansAccents) {
|
|
$mem_result = ucwords(strtolower(fxRemoveAccents($tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']])));
|
|
} else {
|
|
$mem_result = $tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
|
|
// valide email associe
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'par_courriel') {
|
|
|
|
if ($tabParticipants[$intCtr]['associe'] != '') {
|
|
$sqlClient = "SELECT com_courriel FROM inscriptions_comptes WHERE com_id = " . intval($tabParticipants[$intCtr]['associe']);
|
|
$nbClient = $objDatabase->fxGetRow($sqlClient);
|
|
|
|
$mem_result = $nbClient['com_courriel'];
|
|
}
|
|
}
|
|
|
|
$mem_align = $tabCol[$intCtrcol]['info_option3'];
|
|
|
|
//$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
//$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
$data_pdf[$mem_ligne - 1][] = $mem_result;
|
|
|
|
// }
|
|
++$c;
|
|
}
|
|
}
|
|
// membre
|
|
if ($tabEvenement['te_id'] == 13) {
|
|
$membre = fxGetAbonnement(0, 0, 0, $tabParticipants[$intCtr]['pec_id']);
|
|
isset($membre['mem_numero']) ? $m_membre = $membre['mem_numero'] : $m_membre = "";
|
|
|
|
//$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($m_membre));
|
|
// $objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
}
|
|
// membre associe
|
|
|
|
if (array_key_exists(33, $chk['chk_col']) || $chkbypass == 'true') {
|
|
//$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($tabParticipants[$intCtr]['associe']));
|
|
// $objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
++$c;
|
|
}
|
|
|
|
|
|
// QUESTIONS
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if ($blnSansAccents) {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = ucwords(strtolower(fxRemoveAccents($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue])));
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = ucwords(strtolower(fxRemoveAccents($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue])));
|
|
else
|
|
$strValue = '';
|
|
} else {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
else
|
|
$strValue = '';
|
|
}
|
|
if (array_key_exists($intCtr2, $chk['chk_ques']) || $chkbypass == 'true') {
|
|
|
|
// $objPHPExcel->getActiveSheet()->setCellValueExplicit($c . $mem_ligne, trim($strValue));
|
|
// $objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal('left');
|
|
$data_pdf[$mem_ligne - 1][] = trim($strValue);
|
|
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
|
|
$mem_ligne = $mem_ligne + 1;
|
|
}
|
|
|
|
}
|
|
} else {
|
|
if ($typeoutput == 'html') { //HTML ICI
|
|
$strOutput .= fxShowRapportEmpty($strLangue);
|
|
}
|
|
}
|
|
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strOutput .= fxShowRapportFooter($arrBoutonExcel);
|
|
}
|
|
break;
|
|
/********************
|
|
* RAPPORT FINANCES *
|
|
********************/
|
|
case 'finances':
|
|
|
|
$strResultat = fxUpdateFinancesMembership($intEvenement);
|
|
|
|
$memexcfichier = "rapport-finances";
|
|
$arrSum = array();
|
|
$strWhere2 = $strFields2 = '';
|
|
$blnDon = false;
|
|
$intWidthQuestions = $intNbQuestions = 0;
|
|
|
|
if ($tabEvenement != null && intval($tabEvenement['te_id']) == 9) {
|
|
$blnDon = true;
|
|
$strFields2 .= ', a.com_adresse AS par_adresse, a.com_ville AS par_ville, (SELECT pro_nom_fr FROM inscriptions_provinces WHERE a.pro_id = pro_id) AS province, (SELECT pay_nom_fr FROM inscriptions_pays WHERE a.pay_id = pay_id) AS pays, a.com_codepostal AS par_codepostal, a.com_telephone1 AS par_telephone1, a.com_courriel AS par_courriel';
|
|
$strWhere2 .= " OR info_clef = 'rap_finances2'";
|
|
}
|
|
|
|
if ($tabEvenement != null && intval($tabEvenement['eve_id_membership']) != 0) {
|
|
$strFields2 = ', fm.ach_total AS montant_promoteur_mem, fm.ach_taxe1 AS ach_taxe1_mem, fm.ach_taxe2 AS ach_taxe2_mem, (fm.ach_total - (fm.ach_taxe1 + fm.ach_taxe2 + fm.ach_taxe3)) AS montant_promoteur_avant_tx_mem, fm.rabais_total AS rab_montant_mem';
|
|
$strWhere2 = " OR info_clef = 'rap_finances2_membership'";
|
|
}
|
|
|
|
// colonne
|
|
$sqlCol = "SELECT *, (SELECT SUM(info_option1) FROM info WHERE info_actif = 1 AND (info_clef = 'rap_finances' $strWhere2) AND info_langue = '" . $strLangue . "') AS width FROM info WHERE info_actif = 1 AND (info_clef = 'rap_finances' $strWhere2) AND info_langue = '" . $strLangue . "' ORDER BY info_trie";
|
|
$tabCol = $objDatabase->fxGetResults($sqlCol);
|
|
|
|
|
|
// print("tabCol<pre>".print_r($tabCol,true)."</pre>");
|
|
// produits
|
|
$sqlColProduits = "SELECT pro_id, pro_nom_$strLangue FROM inscriptions_produits_new WHERE eve_id IN(" . intval($intEvenement) . "," . intval($tabEvenement['eve_id_membership']) . ")";
|
|
$tabColProduits = $objDatabase->fxGetResults($sqlColProduits);
|
|
|
|
// MSIN-4228 correction 2025-11-20
|
|
$sqlAcheteurs = "
|
|
SELECT
|
|
a.eve_id, a.no_commande, a.no_panier, a.com_nom, a.com_prenom, a.ach_maj, a.TransactionID, s.sta_nom_fr AS statut, p.pai_nom_fr AS paiement, a.ach_total, a.fra_total, a.fra_taxe1, a.fra_taxe2, a.fra_avant_tx,
|
|
IF(a.pai_id = 6 ,
|
|
0,
|
|
GREATEST( (a.ach_total - a.fra_total - COALESCE(fm.ach_total, 0, 0)),0)) AS montant_promoteur,
|
|
GREATEST( (a.ach_taxe1 - COALESCE(fm.ach_taxe1, 0)),0) AS ach_taxe1,
|
|
GREATEST((a.ach_taxe2 - COALESCE(fm.ach_taxe2, 0)),0) AS ach_taxe2,
|
|
GREATEST((a.ach_total - (a.fra_total + a.ach_taxe1 + a.ach_taxe2 + a.ach_taxe3)) - (COALESCE(fm.ach_total, 0) - (COALESCE(fm.ach_taxe1, 0) + COALESCE(fm.ach_taxe2, 0))),0) AS montant_promoteur_avant_tx
|
|
$strFields2
|
|
FROM
|
|
inscriptions_panier_acheteurs a
|
|
JOIN inscriptions_paiements p ON a.pai_id = p.pai_id
|
|
JOIN inscriptions_panier_statuts s ON a.sta_id = s.sta_id
|
|
LEFT JOIN rapport_finances_membership fm ON a.no_panier = fm.no_panier
|
|
WHERE
|
|
a.sta_id = 3 AND a.eve_id = " . intval($intEvenement) . "
|
|
";
|
|
|
|
// MSIN-4228 correction test
|
|
$sqlAcheteurs = "
|
|
SELECT
|
|
a.eve_id, a.no_commande, a.no_panier, a.com_nom, a.com_prenom, a.ach_maj, a.TransactionID, s.sta_nom_fr AS statut, p.pai_nom_fr AS paiement, a.ach_total, a.fra_total, a.fra_taxe1, a.fra_taxe2, a.fra_avant_tx,
|
|
IF(a.pai_id = 6 ,
|
|
0,
|
|
GREATEST( (a.ach_total - a.fra_total - COALESCE(fm.ach_total, 0, 0)),0)) AS montant_promoteur,
|
|
GREATEST( (a.ach_taxe1 - COALESCE(fm.ach_taxe1, 0)),0) AS ach_taxe1,
|
|
GREATEST((a.ach_taxe2 - COALESCE(fm.ach_taxe2, 0)),0) AS ach_taxe2,
|
|
GREATEST((a.ach_total - (a.fra_total + a.ach_taxe1 + a.ach_taxe2 + a.ach_taxe3)) - (COALESCE(fm.ach_total, 0) - (COALESCE(fm.ach_taxe1, 0) + COALESCE(fm.ach_taxe2, 0))),0) AS montant_promoteur_avant_tx
|
|
$strFields2
|
|
FROM
|
|
inscriptions_panier_acheteurs a
|
|
JOIN inscriptions_paiements p ON a.pai_id = p.pai_id
|
|
JOIN inscriptions_panier_statuts s ON a.sta_id = s.sta_id
|
|
LEFT JOIN rapport_finances_membership fm ON a.no_panier = fm.no_panier
|
|
WHERE
|
|
a.sta_id = 3 AND a.eve_id = " . intval($intEvenement) . "
|
|
";
|
|
$sqlAcheteurs = "
|
|
SELECT
|
|
a.eve_id, a.no_commande, a.no_panier, a.com_nom, a.com_prenom, a.ach_maj, a.TransactionID, s.sta_nom_fr AS statut, p.pai_nom_fr AS paiement, a.ach_total, a.fra_total, a.fra_taxe1, a.fra_taxe2, a.fra_avant_tx,
|
|
IF(a.pai_id = 6 ,
|
|
0,
|
|
GREATEST( (a.ach_total - a.fra_total - COALESCE(fm.ach_total, 0, 0)),0)) AS montant_promoteur,
|
|
GREATEST( (a.ach_taxe1 - COALESCE(fm.ach_taxe1, 0)),0) AS ach_taxe1,
|
|
GREATEST((a.ach_taxe2 - COALESCE(fm.ach_taxe2, 0)),0) AS ach_taxe2,
|
|
GREATEST((a.ach_total - (a.fra_total + a.ach_taxe1 + a.ach_taxe2 + a.ach_taxe3)) - (COALESCE(fm.ach_total, 0) - (COALESCE(fm.ach_taxe1, 0) + COALESCE(fm.ach_taxe2, 0))),0) AS montant_promoteur_avant_tx
|
|
$strFields2
|
|
FROM
|
|
inscriptions_panier_acheteurs a
|
|
JOIN inscriptions_paiements p ON a.pai_id = p.pai_id
|
|
JOIN inscriptions_panier_statuts s ON a.sta_id = s.sta_id
|
|
LEFT JOIN rapport_finances_membership fm ON a.no_panier = fm.no_panier
|
|
WHERE
|
|
a.sta_id = 3 AND a.eve_id = " . intval($intEvenement) . "
|
|
";
|
|
|
|
|
|
|
|
if (isset($strWhere['acheteur']) && trim($strWhere['acheteur']) != '') {
|
|
$sqlAcheteurs .= " AND " . $strWhere['acheteur'];
|
|
} else { // mettre la recherche par défaut:
|
|
// $sqlAcheteurs .= " AND a.ach_maj = '" . fxGetDate() . "'"; // aujourd'hui
|
|
//$sqlAcheteurs .= " AND MONTH(a.ach_maj) = '" . date('m') . "' AND YEAR(a.ach_maj) = '" . date('Y') . "'"; // cse mois-ci
|
|
}
|
|
|
|
if (trim($strOrder) != '') {
|
|
$sqlAcheteurs .= " ORDER BY " . $strOrder;
|
|
} else {
|
|
$sqlAcheteurs .= " ORDER BY a.ach_maj, a.no_panier";
|
|
}
|
|
|
|
/*************
|
|
* SQl COUNT *
|
|
*************/
|
|
$blnPager = true;
|
|
$sqlCount = "SELECT COUNT(*) AS nb " . substr($sqlAcheteurs, strrpos($sqlAcheteurs, 'FROM'));
|
|
|
|
|
|
|
|
$intNbTotal = $objDatabase->fxGetVar($sqlCount);
|
|
|
|
/*************
|
|
* SQl COUNT *
|
|
*************/
|
|
|
|
/*************
|
|
* SQl LIMIT *
|
|
*************/
|
|
if ($typeoutput == 'html') {
|
|
$intStart = ($intNbParPage * $intPage) - $intNbParPage;
|
|
// limiter le nombre de ligne à retourner
|
|
if ($intNbParPage > 0)
|
|
$sqlAcheteurs .= " LIMIT " . intval($intStart) . ", " . intval($intNbParPage);
|
|
}
|
|
/*************
|
|
* SQl LIMIT *
|
|
*************/
|
|
|
|
|
|
$tabAcheteurs = $objDatabase->fxGetResults($sqlAcheteurs);
|
|
|
|
if ($blnDon) {
|
|
$sqlQuestions1 = "
|
|
SELECT
|
|
que_id, que_question_" . $strLangue . ", que_rapport_label_" . $strLangue . "
|
|
FROM
|
|
inscriptions_questions
|
|
WHERE
|
|
que_rapport = 1 AND eve_id = " . intval($intEvenement) . "
|
|
ORDER BY
|
|
que_tri, que_id
|
|
";
|
|
$tabQuestions1 = $objDatabase->fxGetResults($sqlQuestions1);
|
|
|
|
if ($tabQuestions1 != null) {
|
|
$intNbQuestions = count($tabQuestions1);
|
|
$intWidthQuestions = $intNbQuestions * 200;
|
|
}
|
|
|
|
$sqlQuestions2 = "
|
|
SELECT
|
|
rq.no_panier, rq.pec_id, rq.par_id, rq.que_id, rq.que_question_" . $strLangue . ", rq.que_choix_" . $strLangue . ", iq.que_rapport_label_" . $strLangue . "
|
|
FROM
|
|
resultats_questions rq, inscriptions_questions iq
|
|
WHERE
|
|
rq.que_id = iq.que_id AND iq.que_rapport = 1 AND iq.eve_id = " . intval($intEvenement) . "
|
|
ORDER BY
|
|
rq.pec_id, rq.par_id, rq.que_id
|
|
";
|
|
$qryQuestions2 = $objDatabase->fxQuery($sqlQuestions2);
|
|
$nbQuestions2 = $objDatabase->fxGetNumRows($qryQuestions2);
|
|
$tabQuestions2 = array();
|
|
|
|
if ($nbQuestions2 > 0) {
|
|
while ($rowQuestions = $objDatabase->fxFetchAssoc($qryQuestions2))
|
|
$tabQuestions2[$rowQuestions['no_panier']][$rowQuestions['que_id']] = $rowQuestions;
|
|
}
|
|
}
|
|
|
|
if ($typeoutput == 'html') {
|
|
if ($strLangue == 'fr') {
|
|
$strTitreRapport = "Rapport finances ".$strTitreRapportTQ;
|
|
} else {
|
|
$strTitreRapport = "Financial report ".$strTitreRapportTQ;
|
|
}
|
|
|
|
$strOutput .= $strWarning;
|
|
$strOutput .= fxShowRapportHeader($strTitreRapport, $strNomEvenement, $arrBoutonExcel);
|
|
}
|
|
|
|
if ($tabAcheteurs != null) {
|
|
$intTotal = count($tabAcheteurs);
|
|
// HEADER
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$intWidth = $tabCol[1]['width'];
|
|
|
|
if ($tabColProduits != null) {
|
|
$intWidth += (count($tabColProduits) * 150);
|
|
}
|
|
|
|
$strOutput .= '
|
|
<table class="rapport table" style="width: ' . ($intWidth + $intWidthQuestions) . 'px;">
|
|
<thead>
|
|
<tr>
|
|
';
|
|
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: ' . $tabCol[$intCtrcol]['info_option1'] . 'px;">
|
|
' . $tabCol[$intCtrcol]['info_texte'] . '
|
|
</th>
|
|
';
|
|
}
|
|
|
|
for ($intCtrcolProduits = 1; $intCtrcolProduits <= count($tabColProduits); $intCtrcolProduits++) {
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: 150px;">
|
|
' . $tabColProduits[$intCtrcolProduits]['pro_nom_' . $strLangue] . '
|
|
</th>
|
|
';
|
|
}
|
|
|
|
if ($blnDon) {
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtrQuestions = 1; $intCtrQuestions <= $intNbQuestions; $intCtrQuestions++) {
|
|
if (trim($tabQuestions1[$intCtrQuestions]['que_rapport_label_' . $strLangue]) != '')
|
|
$strLabel = $tabQuestions1[$intCtrQuestions]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$strLabel = $tabQuestions1[$intCtrQuestions]['que_id'];
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: left; width: 200px;">
|
|
' . $strLabel . '
|
|
</th>
|
|
';
|
|
}
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
';
|
|
}
|
|
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
|
|
$c = 'A';
|
|
$mem_int_ligne_entete = 1;
|
|
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$memtitre = $tabCol[$intCtrcol]['info_texte'];
|
|
$memwidth = $tabCol[$intCtrcol]['info_option1'] / 5;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
for ($intCtrcolProduits = 1; $intCtrcolProduits <= count($tabColProduits); $intCtrcolProduits++) {
|
|
$memtitre = $tabColProduits[$intCtrcolProduits]['pro_nom_' . $strLangue];
|
|
$memwidth = 20;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
if ($blnDon) {
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtrQuestions = 1; $intCtrQuestions <= $intNbQuestions; $intCtrQuestions++) {
|
|
if ($blnSansAccents) {
|
|
if (trim($tabQuestions1[$intCtrQuestions]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabQuestions1[$intCtrQuestions]['que_rapport_label_' . $strLangue])));
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtrQuestions]['que_id'];
|
|
} else {
|
|
if (trim($tabQuestions1[$intCtrQuestions]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = $tabQuestions1[$intCtrQuestions]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtrQuestions]['que_id'];
|
|
}
|
|
|
|
$memwidth = 20;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$mem_ligne = 2;
|
|
$arrLignesAcheteurs = array();
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabAcheteurs); $intCtr++) {
|
|
$arrData = $arrDataEpreuves = $arrDataParticipants = $arrLignesEpreuves = $arrLignesParticipants = array();
|
|
$intNoLigne = 1;
|
|
|
|
$arrLignesAcheteurs[$tabAcheteurs[$intCtr]['no_panier']] = $intNoLigne;
|
|
|
|
// QUERY DES RABAIS
|
|
// $sqlRabais = "SELECT r.rab_id, ra.rab_montant, r.rab_code, r.rab_description_$strLangue AS rabais_description FROM inscriptions_panier_rabais_acheteurs ra, inscriptions_panier_rabais r WHERE ra.no_panier = '" . $objDatabase->fxEscape($tabAcheteurs[$intCtr]['no_panier']) . "' AND r.pra_id = ra.pra_id and (r.rab_eve_id IS NULL OR r.rab_eve_id != 649) ORDER BY ra.rab_montant";
|
|
|
|
//$sqlRabais = "SELECT r.rab_id, ra.rab_montant, r.rab_code, r.rab_description_$strLangue AS rabais_description FROM inscriptions_panier_rabais_acheteurs ra, inscriptions_panier_rabais r WHERE ra.no_panier = '" . $objDatabase->fxEscape($tabAcheteurs[$intCtr]['no_panier']) . "' AND r.pra_id = ra.pra_id and r.rab_description_fr NOT LIKE '%tq%' and (r.rab_eve_id IS NULL OR r.rab_eve_id != 649) ORDER BY ra.rab_montant";
|
|
$sqlRabais = "SELECT r.rab_id, ra.rab_montant, r.rab_code, r.rab_description_$strLangue AS rabais_description FROM inscriptions_panier_rabais_acheteurs ra, inscriptions_panier_rabais r WHERE ra.no_panier = '" . $objDatabase->fxEscape($tabAcheteurs[$intCtr]['no_panier']) . "' AND r.pra_id = ra.pra_id and (r.rab_eve_id IS NULL OR r.rab_eve_id != 649) ORDER BY ra.rab_montant";
|
|
|
|
$arrRabais = $objDatabase->fxGetResults($sqlRabais);
|
|
// mettre le tq rabais apres MSIN-4191
|
|
|
|
|
|
|
|
// QUERY DES PRODUITS
|
|
$sqlProduitspourrabais = "SELECT sum(p.rab_montant) AS rab_montant FROM inscriptions_panier_produits_new p WHERE p.eve_id!='649' and p.no_panier = '" . $objDatabase->fxEscape($tabAcheteurs[$intCtr]['no_panier']) . "'";
|
|
$arrProduitsrab = $objDatabase->fxGetResults($sqlProduitspourrabais);
|
|
|
|
|
|
// print_rsl( $arrRabais );
|
|
// echosl($sqlProduits );
|
|
// QUERY DES ÉPREUVVES
|
|
$sqlEpreuvespourrabais = "SELECT sum(ec.rab_montant) AS rab_montant FROM inscriptions_panier_epreuves_commandees ec WHERE ec.eve_id!='649' and ec.no_panier = '" . $objDatabase->fxEscape($tabAcheteurs[$intCtr]['no_panier'])."'" ;
|
|
|
|
|
|
$arrEpreuvesrab = $objDatabase->fxGetResults( $sqlEpreuvespourrabais);
|
|
$total_rabais = 0;
|
|
|
|
if (isset($arrEpreuvesrab[1]['rab_montant'])) {
|
|
$total_rabais += (float)$arrEpreuvesrab[1]['rab_montant'];
|
|
}
|
|
|
|
if (isset($arrProduitsrab[1]['rab_montant'])) {
|
|
$total_rabais += (float)$arrProduitsrab[1]['rab_montant'];
|
|
}
|
|
|
|
|
|
if($arrRabais!=null){
|
|
usort($arrRabais, function ($a, $b) {
|
|
$aTQ = stripos($a['rabais_description'], 'TQ') !== false;
|
|
$bTQ = stripos($b['rabais_description'], 'TQ') !== false;
|
|
|
|
if ($aTQ === $bTQ) {
|
|
return 0; // garde l'ordre d'origine si les deux sont identiques
|
|
}
|
|
return $aTQ ? 1 : -1; // si $a contient TQ, il va après
|
|
});
|
|
}
|
|
|
|
if ($blnDon) {
|
|
// QUERY DES DONS
|
|
$sqlDonations = "SELECT d.pec_id, d.pd_recu, d.pd_anonyme, d.pd_recu_pdf, CONCAT(d.eve_prefixe, d.pd_recu_numero) AS no_recu, IF(d.par_id <> 0, (SELECT CONCAT(par_prenom, ' ', par_nom) FROM resultats_participants WHERE d.par_id = par_id_original), e.pec_nom_equipe) AS recipiendaire FROM inscriptions_panier_dons d, resultats_epreuves_commandees e WHERE d.pec_id = e.pec_id_original AND d.no_panier = '" . $objDatabase->fxEscape($tabAcheteurs[$intCtr]['no_panier']) . "'";
|
|
$arrDonations = $objDatabase->fxGetResults($sqlDonations);
|
|
|
|
|
|
}
|
|
|
|
// QUERY DES PRODUITS
|
|
$sqlProduits = "SELECT p.pro_id, p.pec_id, p.par_id, p.pro_nom_$strLangue AS pro_desc, p.pro_prix FROM inscriptions_panier_produits_new p WHERE p.no_panier = '" . $objDatabase->fxEscape($tabAcheteurs[$intCtr]['no_panier']) . "'";
|
|
$arrProduits = $objDatabase->fxGetResults($sqlProduits);
|
|
// print_rsl( $arrRabais );
|
|
// echosl($sqlProduits );
|
|
// QUERY DES ÉPREUVVES
|
|
$sqlEpreuves = "SELECT (ec.pec_montant_don - ec.rab_montant) AS don_epreuve, ec.pec_id, e.epr_nom_$strLangue AS epreuve_nom, e.epr_categorie_$strLangue AS epreuve_categorie, e.epr_type_$strLangue AS epreuve_type, ec.pec_prix FROM inscriptions_panier_epreuves_commandees ec, inscriptions_epreuves e WHERE ec.no_panier = '" . $objDatabase->fxEscape($tabAcheteurs[$intCtr]['no_panier']) . "' AND ec.epr_id = e.epr_id";
|
|
|
|
/* if (isset($strWhere['epreuves']) && trim($strWhere['epreuves']) != '') {
|
|
$sqlEpreuves .= " AND " . $strWhere['epreuves'];
|
|
} */
|
|
|
|
$arrEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
|
|
|
if ($arrEpreuves != null) {
|
|
for ($intCtr2 = 1; $intCtr2 <= count($arrEpreuves); $intCtr2++) {
|
|
$arrDataEpreuves[$intNoLigne] = $arrEpreuves[$intCtr2];
|
|
$arrLignesEpreuves[$arrEpreuves[$intCtr2]['pec_id']] = $intNoLigne;
|
|
|
|
// QUERY DES PARTICIPANTS
|
|
$sqlParticipants = "SELECT p.par_id, p.par_nom_equipe, p.par_nom, p.par_prenom, p.par_naissance, p.par_age, p.par_sexe, p.par_adresse, p.par_ville, (SELECT pro_nom_fr FROM inscriptions_provinces WHERE p.pro_id = pro_id) AS province, (SELECT pay_nom_fr FROM inscriptions_pays WHERE p.pay_id = pay_id) AS pays, p.par_codepostal, p.par_telephone1, p.par_courriel FROM inscriptions_panier_participants p WHERE p.pec_id = " . intval($arrEpreuves[$intCtr2]['pec_id']);
|
|
$arrParticipants = $objDatabase->fxGetResults($sqlParticipants);
|
|
|
|
if ($arrParticipants != null) {
|
|
for ($intCtr3 = 1; $intCtr3 <= count($arrParticipants); $intCtr3++) {
|
|
$arrDataParticipants[$intNoLigne] = $arrParticipants[$intCtr3];
|
|
$arrLignesParticipants[$arrParticipants[$intCtr3]['par_id']] = $intNoLigne;
|
|
$intNoLigne++;
|
|
}
|
|
}
|
|
|
|
if ($intCtr2 == count($arrEpreuves)) {
|
|
$intNoLigne--;
|
|
}
|
|
}
|
|
}
|
|
|
|
// CRÉER LE TABLEAU DE DONNÉES FINAL
|
|
for ($intCtr4 = 1; $intCtr4 <= $intNoLigne; $intCtr4++) {
|
|
$arrData[$intCtr4]['eve_id'] = $tabAcheteurs[$intCtr]['eve_id'];
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
if (isset($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) && ($intCtr4 == 1 || $tabCol[$intCtrcol]['info_option2'] == 'no_commande')) {
|
|
/*if ($tabEvenement != null && intval($tabEvenement['eve_id_membership']) != 0) {
|
|
switch($tabCol[$intCtrcol]['info_option2']) {
|
|
case 'montant_promoteur':
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = floatval($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) - floatval($tabAcheteurs[$intCtr]['montant_promoteur_mem']);
|
|
break;
|
|
case 'montant_promoteur_avant_tx':
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = floatval($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) - floatval($tabAcheteurs[$intCtr]['montant_promoteur_avant_tx_mem']);
|
|
break;
|
|
case 'ach_taxe1':
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = floatval($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) - floatval($tabAcheteurs[$intCtr]['ach_taxe1_mem']);
|
|
break;
|
|
case 'ach_taxe2':
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = floatval($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) - floatval($tabAcheteurs[$intCtr]['ach_taxe2_mem']);
|
|
break;
|
|
default:
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
} else {*/
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
//}
|
|
} elseif (isset($arrDataEpreuves[$intCtr4][$tabCol[$intCtrcol]['info_option2']])) {
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $arrDataEpreuves[$intCtr4][$tabCol[$intCtrcol]['info_option2']];
|
|
} elseif (isset($arrDataParticipants[$intCtr4][$tabCol[$intCtrcol]['info_option2']])) {
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $arrDataParticipants[$intCtr4][$tabCol[$intCtrcol]['info_option2']];
|
|
} elseif ($blnDon && isset($arrDonations[$intCtr4][$tabCol[$intCtrcol]['info_option2']])) {
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'pd_recu_pdf') {
|
|
if ($typeoutput == 'excel') { // EXCEL
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $vDomaine . '/pdf/dons/' . $arrDonations[$intCtr4][$tabCol[$intCtrcol]['info_option2']];
|
|
} else { // HTML
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = '<a href="' . $vDomaine . '/pdf/dons/' . $arrDonations[$intCtr4][$tabCol[$intCtrcol]['info_option2']] . '" target="_blank">' . $arrDonations[$intCtr4][$tabCol[$intCtrcol]['info_option2']] . '</a>';
|
|
}
|
|
}
|
|
// if ($typeoutput == 'html') {
|
|
if (isset($arrDonations[$intCtr4][$tabCol[$intCtrcol]['info_option2']])) {
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $arrDonations[$intCtr4][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
} else {
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = '';
|
|
}
|
|
}
|
|
|
|
// patch rabais
|
|
$totalTQ = 0;
|
|
if($arrRabais!=null){
|
|
foreach ($arrRabais as $rabais) {
|
|
if (stripos($rabais['rabais_description'], 'TQ') !== false) {
|
|
$totalTQ += (float) $rabais['rab_montant'];
|
|
}
|
|
}
|
|
}
|
|
//$arrData[$intCtr4]["rab_montant_mem"]=$totalTQ;
|
|
|
|
// PRODUITS
|
|
for ($intCtrcolProduits = 1; $intCtrcolProduits <= count($tabColProduits); $intCtrcolProduits++) {
|
|
$arrData[$intCtr4][$tabColProduits[$intCtrcolProduits]['pro_id']] = '';
|
|
}
|
|
if ($blnDon) {
|
|
// QUESTIONS
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtrQuestions = 1; $intCtrQuestions <= $intNbQuestions; $intCtrQuestions++) {
|
|
if (isset($tabQuestions2[$tabAcheteurs[$intCtr]['no_panier']]) && isset($tabQuestions2[$tabAcheteurs[$intCtr]['no_panier']][$tabQuestions1[$intCtrQuestions]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabAcheteurs[$intCtr]['no_panier']][$tabQuestions1[$intCtrQuestions]['que_id']]['que_choix_' . $strLangue];
|
|
else
|
|
$strValue = '';
|
|
|
|
$arrData[$intCtr4][$tabQuestions1[$intCtrQuestions]['que_id']] = $strValue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//echosl("sl2");
|
|
// print_rsl($arrData);
|
|
// print("stop2a<pre>".print_r( $arrProduits,true)."</pre>");
|
|
// RABAIS-DATA
|
|
if ($arrRabais != null) {
|
|
// if (1==2) {
|
|
|
|
foreach ($arrRabais as $id => $rabais) {
|
|
$id=$id+1;
|
|
if (
|
|
($rabais['rab_id'] != 0 && $total_rabais > 0)
|
|
|| $rabais['rab_id'] == 0
|
|
) {
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'no_commande') {
|
|
$arrData[$id]['no_commande'] = $tabAcheteurs[$intCtr]['no_commande'];
|
|
} elseif (isset($rabais[$tabCol[$intCtrcol]['info_option2']])) {
|
|
$arrData[$id][$tabCol[$intCtrcol]['info_option2']] = $rabais[$tabCol[$intCtrcol]['info_option2']];
|
|
} elseif (!isset($arrData[$id][$tabCol[$intCtrcol]['info_option2']])) {
|
|
$arrData[$id][$tabCol[$intCtrcol]['info_option2']] = '';
|
|
}
|
|
|
|
|
|
} }
|
|
if ($rabais["rab_id"]!=0 ){
|
|
|
|
$arrData[$id]["rab_montant"]=$total_rabais;
|
|
|
|
}
|
|
|
|
// PRODUITS
|
|
for ($intCtrcolProduits = 1; $intCtrcolProduits <= count($tabColProduits); $intCtrcolProduits++) {
|
|
$arrData[$id][$tabColProduits[$intCtrcolProduits]['pro_id']] = '';
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// print("stop2<pre>".print_r( $arrProduits,true)."</pre>");
|
|
// PRODUITS-DATA
|
|
if ($arrProduits != null) {
|
|
|
|
foreach ($arrProduits as $produit) {
|
|
if ($produit['par_id'] != 0 && isset($arrLignesParticipants[$produit['par_id']])) {
|
|
$intLigne = $arrLignesParticipants[$produit['par_id']];
|
|
} elseif (isset($arrLignesEpreuves[$produit['pec_id']])) {
|
|
$intLigne = $arrLignesEpreuves[$produit['pec_id']];
|
|
} elseif ($arrEpreuves == null) {
|
|
$intLigne = $arrLignesAcheteurs[$tabAcheteurs[$intCtr]['no_panier']];
|
|
} else {
|
|
$intLigne = 0;
|
|
}
|
|
|
|
if ($intLigne != 0) {
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'no_commande') {
|
|
$arrData[$intLigne]['no_commande'] = $tabAcheteurs[$intCtr]['no_commande'];
|
|
} elseif (isset($produit[$tabCol[$intCtrcol]['info_option2']])) {
|
|
$arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']] = $produit[$tabCol[$intCtrcol]['info_option2']];
|
|
} elseif (!isset($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']])) {
|
|
$arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']] = '';
|
|
}
|
|
}
|
|
|
|
$arrData[$intLigne][$produit['pro_id']] = $produit['pro_prix'];
|
|
}
|
|
}
|
|
}
|
|
// print("<pre>".print_r($arrData,true)."</pre>");
|
|
// BODY - PARTICIPANTS
|
|
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
|
|
foreach ($arrData as $intLigne => $data) {
|
|
$strClass = ($intCtr & 1) ? '' : ' class="table-secondary"';
|
|
|
|
if (intval($data['eve_id']) !== intval($intEvenement)) {
|
|
$strClass = ' class="table-info"';
|
|
}
|
|
|
|
$strOutput .= '
|
|
<tr' . $strClass . '>
|
|
<td style="text-align: center;">' . ($intCtr + $intStart) . '</td>
|
|
';
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strValue = '';
|
|
|
|
if (trim($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]) != '') {
|
|
switch ($tabCol[$intCtrcol]['info_description']) {
|
|
case 'date':
|
|
$strValue = fxShowDate($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
break;
|
|
case 'datetime':
|
|
$strValue = fxShowDate($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue) . ' @ ' . fxShowTime($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]);
|
|
break;
|
|
case 'money':
|
|
$strValue = fxShowMoney($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
if (!array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum))
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] = 0;
|
|
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] += $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
break;
|
|
default:
|
|
$strValue = $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td style="text-align: ' . $tabCol[$intCtrcol]['info_option3'] . ';">
|
|
' . $strValue . '
|
|
</td>
|
|
';
|
|
}
|
|
// PRODUITS
|
|
for ($intCtrcolProduits = 1; $intCtrcolProduits <= count($tabColProduits); $intCtrcolProduits++) {
|
|
$strValue = '';
|
|
|
|
if (isset($arrData[$intLigne][$tabColProduits[$intCtrcolProduits]['pro_id']]) && trim($arrData[$intLigne][$tabColProduits[$intCtrcolProduits]['pro_id']]) != '') {
|
|
$strValue = fxShowMoney($arrData[$intLigne][$tabColProduits[$intCtrcolProduits]['pro_id']], $strLangue);
|
|
|
|
if (!array_key_exists($tabColProduits[$intCtrcolProduits]['pro_id'], $arrSum))
|
|
$arrSum[$tabColProduits[$intCtrcolProduits]['pro_id']] = 0;
|
|
|
|
$arrSum[$tabColProduits[$intCtrcolProduits]['pro_id']] += $arrData[$intLigne][$tabColProduits[$intCtrcolProduits]['pro_id']];
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td style="text-align: right;">
|
|
' . $strValue . '
|
|
</td>
|
|
';
|
|
}
|
|
// QUESTIONS
|
|
|
|
if ($blnDon) {
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtrQuestions = 1; $intCtrQuestions <= $intNbQuestions; $intCtrQuestions++) {
|
|
$strValue = '';
|
|
|
|
if (isset($arrData[$intLigne][$tabQuestions1[$intCtrQuestions]['que_id']]) && trim($arrData[$intLigne][$tabQuestions1[$intCtrQuestions]['que_id']]) != '') {
|
|
$strValue = $arrData[$intLigne][$tabQuestions1[$intCtrQuestions]['que_id']];
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td style="text-align: right;">
|
|
' . $strValue . '
|
|
</td>
|
|
';
|
|
}
|
|
}
|
|
}
|
|
|
|
$strOutput .= '</tr>';
|
|
}
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
|
|
// print("stop1<pre>".print_r($arrData,true)."</pre>");
|
|
//exit;
|
|
foreach ($arrData as $intLigne => $data) {
|
|
$c = 'A';
|
|
$mem_result = ($intCtr + $intStart);
|
|
$mem_align = 'center';
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $mem_result);
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$mem_result = $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
$mem_align = $tabCol[$intCtrcol]['info_option3'];
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
|
|
if (trim($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]) != '') {
|
|
switch ($tabCol[$intCtrcol]['info_description']) {
|
|
case 'money':
|
|
if (!array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum))
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] = 0;
|
|
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] += $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
// PRODUITS
|
|
for ($intCtrcolProduits = 1; $intCtrcolProduits <= count($tabColProduits); $intCtrcolProduits++) {
|
|
$mem_result = $arrData[$intLigne][$tabColProduits[$intCtrcolProduits]['pro_id']];
|
|
$mem_align = 'right';
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
|
|
if (!array_key_exists($tabColProduits[$intCtrcolProduits]['pro_id'], $arrSum))
|
|
$arrSum[$tabColProduits[$intCtrcolProduits]['pro_id']] = 0;
|
|
|
|
$arrSum[$tabColProduits[$intCtrcolProduits]['pro_id']] += $arrData[$intLigne][$tabColProduits[$intCtrcolProduits]['pro_id']];
|
|
}
|
|
// QUESTIONS
|
|
if ($blnDon) {
|
|
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtrQuestions = 1; $intCtrQuestions <= $intNbQuestions; $intCtrQuestions++) {
|
|
$mem_result = $arrData[$intLigne][$tabQuestions1[$intCtrQuestions]['que_id']];
|
|
$mem_align = 'left';
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
|
|
$mem_ligne++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (count($arrSum) > 0) {
|
|
if ($typeoutput == 'html') {
|
|
$strOutput .= '
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<th style="text-align: center;"> </th>
|
|
';
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strValue = '';
|
|
|
|
if (array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum)) {
|
|
$strValue = fxShowMoney($arrSum[$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
}
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: right;">
|
|
' . $strValue . '
|
|
</th>
|
|
';
|
|
}
|
|
// PRODUITS
|
|
for ($intCtrcolProduits = 1; $intCtrcolProduits <= count($tabColProduits); $intCtrcolProduits++) {
|
|
$strValue = '';
|
|
|
|
if (array_key_exists($tabColProduits[$intCtrcolProduits]['pro_id'], $arrSum)) {
|
|
$strValue = fxShowMoney($arrSum[$tabColProduits[$intCtrcolProduits]['pro_id']], $strLangue);
|
|
}
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: right;">
|
|
' . $strValue . '
|
|
</th>
|
|
';
|
|
}
|
|
// QUESTIONS
|
|
if ($blnDon) {
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtrQuestions = 1; $intCtrQuestions <= $intNbQuestions; $intCtrQuestions++) {
|
|
$strOutput .= '
|
|
<th style="text-align: left;">
|
|
|
|
</th>
|
|
';
|
|
}
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
</tr>
|
|
</tfoot>
|
|
';
|
|
}
|
|
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, '');
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_ligne);
|
|
++$c;
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
if (array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum)) {
|
|
$strValue = $arrSum[$tabCol[$intCtrcol]['info_option2']];
|
|
} else {
|
|
$strValue = '';
|
|
}
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $strValue);
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_ligne);
|
|
++$c;
|
|
}
|
|
// PRODUITS
|
|
for ($intCtrcolProduits = 1; $intCtrcolProduits <= count($tabColProduits); $intCtrcolProduits++) {
|
|
if (array_key_exists($tabColProduits[$intCtrcolProduits]['pro_id'], $arrSum)) {
|
|
$strValue = $arrSum[$tabColProduits[$intCtrcolProduits]['pro_id']];
|
|
} else {
|
|
$strValue = '';
|
|
}
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $strValue);
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_ligne);
|
|
++$c;
|
|
}
|
|
// QUESTIONS
|
|
if ($blnDon) {
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtrQuestions = 1; $intCtrQuestions <= $intNbQuestions; $intCtrQuestions++) {
|
|
$strValue = '';
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $strValue);
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_ligne);
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
if ($typeoutput == 'html') { //HTML ICI
|
|
$strOutput .= fxShowRapportEmpty($strLangue);
|
|
}
|
|
}
|
|
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strOutput .= fxShowRapportFooter($arrBoutonExcel);
|
|
}
|
|
break;
|
|
/***********************************************
|
|
* RAPPORT FINANCES POUR ÉVÉNEMENTS MEMBERSHIP *
|
|
***********************************************/
|
|
case 'finances-membership':
|
|
$mem_where_tq = "tout";
|
|
$strTitreRapportTQ=" - Tout";
|
|
$memexcfichier = "rapport-finances-membership-tout";
|
|
require_once 'inc_case_finances-membership.php';
|
|
break;
|
|
case 'finances-membership-tq':
|
|
$mem_where_tq = "tq";
|
|
$strTitreRapportTQ="- Adhésions seul";
|
|
$memexcfichier = "rapport-finances-membership-adhesions-seul";
|
|
require_once 'inc_case_finances-membership.php';
|
|
break;
|
|
case 'finances-membership-promoteur':
|
|
$mem_where_tq = "promoteur";
|
|
$strTitreRapportTQ="- Événements seul";
|
|
$memexcfichier = "rapport-finances-membership";
|
|
require_once 'inc_case_finances-membership.php';
|
|
break;
|
|
|
|
case 'finances-membership-autre':
|
|
$mem_where_tq = "autre";
|
|
$strTitreRapportTQ="- Événements seul";
|
|
$memexcfichier = "rapport-finances-membership-evenements-autre";
|
|
require_once 'inc_case_finances-membership.php';
|
|
break;
|
|
/**************************
|
|
* RAPPORT REMBOURSEMENTS *
|
|
**************************/
|
|
case 'remboursements':
|
|
|
|
//$strResultat = fxUpdateFinancesMembership($intEvenement);
|
|
$strResultat =fxUpdateFinancesMembershipall();
|
|
$memexcfichier = "rapport-remboursements";
|
|
$arrSum = array();
|
|
$strWhere2 = $strFields2 = '';
|
|
$blnDon = false;
|
|
$intWidthQuestions = $intNbQuestions = 0;
|
|
|
|
// colonne
|
|
$sqlCol = "SELECT *, (SELECT SUM(info_option1) FROM info WHERE info_actif = 1 AND (info_clef = 'rap_remboursements' $strWhere2) AND info_langue = '" . $strLangue . "') AS width FROM info WHERE info_actif = 1 AND (info_clef = 'rap_remboursements' $strWhere2) AND info_langue = '" . $strLangue . "' ORDER BY info_trie";
|
|
$tabCol = $objDatabase->fxGetResults($sqlCol);
|
|
|
|
// SQL
|
|
$sqlAcheteurs = "
|
|
(SELECT
|
|
'montant promoteur' AS label, DATE(a.ach_maj) AS date1, (SUM(a.ach_total) - SUM(a.fra_total) - COALESCE(SUM(rfm.ach_total), 0)) AS montant, '' AS date2, '' AS mode, '' AS details, '' AS par
|
|
FROM
|
|
inscriptions_panier_acheteurs a
|
|
LEFT JOIN rapport_finances_membership rfm ON rfm.no_panier = a.no_panier
|
|
";
|
|
|
|
$sqlAcheteurs .= " WHERE a.sta_id = 3 AND a.pai_id <> 6 AND a.ach_total > 0 AND a.eve_id = " . intval($intEvenement);
|
|
|
|
if (isset($strWhere['acheteur']) && trim($strWhere['acheteur']) != '') {
|
|
$strWhere2 = $strWhere['acheteur'];
|
|
$sqlAcheteurs .= " AND " . $strWhere2;
|
|
}
|
|
|
|
$sqlAcheteurs .= " GROUP BY DATE(a.ach_maj))";
|
|
// événement membershi p
|
|
$sqlAcheteurs .= "
|
|
UNION (SELECT
|
|
CONCAT('montant promoteur adhésion ', (SELECT e.eve_nom_" . $strLangue . " FROM inscriptions_evenements e WHERE e.eve_id = rfm.eve_id)) AS label, DATE(a2.ach_maj) AS date1, (SUM(rfm.ach_total)) AS montant, '' AS date2, '' AS mode, '' AS details, '' AS par
|
|
FROM
|
|
rapport_finances_membership rfm
|
|
JOIN inscriptions_panier_acheteurs a2 ON rfm.no_panier = a2.no_panier
|
|
";
|
|
|
|
$sqlAcheteurs .= " WHERE a2.sta_id = 3 AND a2.pai_id <> 6 AND rfm.ach_total > 0 AND rfm.eve_id_membership = " . intval($intEvenement);
|
|
|
|
if (isset($strWhere['acheteur']) && trim($strWhere['acheteur']) != '') {
|
|
$strWhere2 = $strWhere['acheteur'];
|
|
$sqlAcheteurs .= " AND " . $strWhere2;
|
|
}
|
|
|
|
$sqlAcheteurs .= " GROUP BY rfm.eve_id, DATE(a2.ach_maj))";
|
|
// remboursements
|
|
$sqlAcheteurs .= "
|
|
UNION (SELECT
|
|
t.tr_nom AS label, r.rem_date_pour AS date1, (SELECT r.rem_montant *-1) AS montant, r.rem_date AS date2, m.mr_nom_fr AS mode, CONCAT_WS(' ', r.rem_details, r.no_commande) AS details, rem_ajoute_par AS par
|
|
FROM
|
|
remboursements r, types_remboursements t, modes_remboursements m
|
|
";
|
|
$sqlAcheteurs .= " WHERE r.tr_id = t.tr_id AND r.mr_id = m.mr_id AND r.rem_deleted = 0 AND r.eve_id = " . intval($intEvenement);
|
|
|
|
if (isset($strWhere['remboursement']) && trim($strWhere['remboursement']) != '') {
|
|
$strWhere2 = $strWhere['remboursement'];
|
|
$sqlAcheteurs .= " AND " . $strWhere2;
|
|
}
|
|
|
|
$sqlAcheteurs .= ") ORDER BY date1 DESC, mode DESC";
|
|
/* echo $sqlAcheteurs . '<br><pre>';
|
|
print_r($strWhere);
|
|
echo '</pre>'; */
|
|
|
|
|
|
$tabAcheteurs = $objDatabase->fxGetResults($sqlAcheteurs);
|
|
|
|
if ($typeoutput == 'html') {
|
|
if ($strLangue == 'fr') {
|
|
$strTitreRapport = "Montant Promoteur";
|
|
} else {
|
|
$strTitreRapport = "Promoter's Amount";
|
|
}
|
|
|
|
$strOutput .= fxShowRapportHeader($strTitreRapport, $strNomEvenement, $arrBoutonExcel);
|
|
}
|
|
|
|
if ($tabAcheteurs != null) {
|
|
$intTotal = count($tabAcheteurs);
|
|
// HEADER
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$intWidth = $tabCol[1]['width'];
|
|
$strOutput .= '
|
|
<table class="rapport table" style="width: ' . ($intWidth + $intWidthQuestions) . 'px;">
|
|
<thead>
|
|
<tr>
|
|
';
|
|
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: ' . $tabCol[$intCtrcol]['info_option1'] . 'px;">' . $tabCol[$intCtrcol]['info_texte'] . '</th>
|
|
';
|
|
}
|
|
|
|
$strOutput .= '
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
';
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
$mem_int_ligne_entete = 1;
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$memtitre = $tabCol[$intCtrcol]['info_texte'];
|
|
$memwidth = $tabCol[$intCtrcol]['info_option1'] / 5;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
}
|
|
|
|
$mem_ligne = 2;
|
|
$arrLignesAcheteurs = array();
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabAcheteurs); $intCtr++) {
|
|
$arrData = $arrDataEpreuves = $arrDataParticipants = $arrLignesEpreuves = $arrLignesParticipants = array();
|
|
$intNoLigne = 1;
|
|
|
|
// $arrLignesAcheteurs[$tabAcheteurs[$intCtr]['no_panier']] = $intNoLigne;
|
|
|
|
// CRÉER LE TABLEAU DE DONNÉES FINAL
|
|
for ($intCtr4 = 1; $intCtr4 <= $intNoLigne; $intCtr4++) {
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
}
|
|
|
|
// BODY - PARTICIPANTS
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
foreach ($arrData as $intLigne => $data) {
|
|
$strClass = ($intCtr & 1) ? '' : ' class="table-secondary"';
|
|
$strOutput .= '
|
|
<tr' . $strClass . '>
|
|
<td style="text-align: center;">' . $intCtr . '</td>
|
|
';
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<td style="text-align: ' . $tabCol[$intCtrcol]['info_option3'] . ';">
|
|
';
|
|
|
|
if (trim($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]) != '') {
|
|
switch ($tabCol[$intCtrcol]['info_description']) {
|
|
case 'date':
|
|
$strOutput .= fxShowDate($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
break;
|
|
case 'datetime':
|
|
$strOutput .= fxShowDate($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue) . ' @ ' . fxShowTime($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]);
|
|
break;
|
|
case 'money':
|
|
if ($tabEvenement != null && intval($tabEvenement['eve_id_membership']) != 0) {
|
|
switch ($tabCol[$intCtrcol]['info_option2']) {
|
|
case 'montant_promoteur':
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = floatval($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) - floatval($tabAcheteurs[$intCtr]['montant_promoteur_mem']);
|
|
break;
|
|
case 'montant_promoteur_avant_tx':
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = floatval($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) - floatval($tabAcheteurs[$intCtr]['montant_promoteur_avant_tx_mem']);
|
|
break;
|
|
case 'ach_taxe1':
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = floatval($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) - floatval($tabAcheteurs[$intCtr]['ach_taxe1_mem']);
|
|
break;
|
|
case 'ach_taxe2':
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = floatval($tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']]) - floatval($tabAcheteurs[$intCtr]['ach_taxe2_mem']);
|
|
break;
|
|
default:
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
} else {
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $tabAcheteurs[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
|
|
$strOutput .= fxShowMoney($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
|
|
if (!array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum))
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] = 0;
|
|
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] += $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
break;
|
|
default:
|
|
$strOutput .= $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
</td>
|
|
';
|
|
}
|
|
|
|
$strOutput .= '
|
|
</tr>
|
|
';
|
|
}
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
foreach ($arrData as $intLigne => $data) {
|
|
$c = 'A';
|
|
$mem_result = $intCtr;
|
|
$mem_align = 'center';
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $mem_result);
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$mem_result = $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
$mem_align = $tabCol[$intCtrcol]['info_option3'];
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
if (trim($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]) != '') {
|
|
switch ($tabCol[$intCtrcol]['info_description']) {
|
|
case 'money':
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
|
|
|
if (!array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum))
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] = 0;
|
|
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] += floatval($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]);
|
|
break;
|
|
}
|
|
}
|
|
|
|
++$c;
|
|
}
|
|
|
|
$mem_ligne++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (count($arrSum) > 0) {
|
|
if ($typeoutput == 'html') {
|
|
$strOutput .= '
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<th style="text-align: center;"> </th>
|
|
';
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<th style="text-align: right;">
|
|
';
|
|
|
|
if (array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum)) {
|
|
$strValue = fxShowMoney($arrSum[$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
} else
|
|
$strValue = ' ';
|
|
|
|
$strOutput .= '
|
|
' . $strValue . '
|
|
</th>
|
|
';
|
|
}
|
|
|
|
$strOutput .= '
|
|
</tr>
|
|
</tfoot>
|
|
';
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, '');
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_ligne);
|
|
++$c;
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
if (array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum)) {
|
|
$strValue = $arrSum[$tabCol[$intCtrcol]['info_option2']];
|
|
} else {
|
|
$strValue = '';
|
|
}
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $strValue);
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_ligne);
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if ($typeoutput == 'html') { //HTML ICI
|
|
$strOutput .= fxShowRapportEmpty($strLangue);
|
|
}
|
|
}
|
|
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strOutput .= fxShowRapportFooter($arrBoutonExcel);
|
|
}
|
|
break;
|
|
/********************************
|
|
* RAPPORT REMBOURSEMENTS BILAN *
|
|
********************************/
|
|
case 'remboursements-bilan':
|
|
|
|
//$strResultat = fxUpdateFinancesMembership($intEvenement);
|
|
$strResultat =fxUpdateFinancesMembershipall();
|
|
|
|
|
|
$memexcfichier = "rapport-remboursements-bilan";
|
|
$arrSum = array();
|
|
$strWhere2 = $strFields2 = $sqlWherePromoteur = $sqlWhereRemboursement = '';
|
|
$blnDon = false;
|
|
$tabPromoteurFinal = null;
|
|
$intWidthQuestions = $intNbQuestions = 0;
|
|
|
|
// colonne
|
|
$sqlCol = "SELECT *, (SELECT SUM(info_option1) FROM info WHERE info_actif = 1 AND (info_clef = 'rap_remboursements_bilan' $strWhere2) AND info_langue = '" . $strLangue . "') AS width FROM info WHERE info_actif = 1 AND (info_clef = 'rap_remboursements_bilan' $strWhere2) AND info_langue = '" . $strLangue . "' ORDER BY info_trie";
|
|
$tabCol = $objDatabase->fxGetResults($sqlCol);
|
|
|
|
// SQL
|
|
if (isset($strWhere['acheteur']) && trim($strWhere['acheteur']) != '') {
|
|
$strWhere2 = $strWhere['acheteur'];
|
|
$sqlWherePromoteur = " AND " . $strWhere2;
|
|
}
|
|
if (isset($strWhere['remboursement']) && trim($strWhere['remboursement']) != '') {
|
|
$strWhere2 = $strWhere['remboursement'];
|
|
$sqlWhereRemboursement = " AND " . $strWhere2;
|
|
}
|
|
|
|
$sqlPromoteur1 = "
|
|
SELECT
|
|
a.eve_id, (SUM(a.ach_total) - SUM(a.fra_total) - COALESCE(SUM(rfm.ach_total), 0)) AS promoteur1
|
|
FROM
|
|
inscriptions_panier_acheteurs a
|
|
LEFT JOIN rapport_finances_membership rfm ON rfm.no_panier = a.no_panier
|
|
WHERE
|
|
a.sta_id = 3 AND a.pai_id <> 6 AND a.ach_total > 0 $sqlWherePromoteur
|
|
GROUP BY a.eve_id
|
|
ORDER BY a.eve_id
|
|
";
|
|
|
|
$tabPromoteur1 = $objDatabase->fxGetResultsKey($sqlPromoteur1);
|
|
|
|
$sqlPromoteur2 = "
|
|
SELECT
|
|
rfm.eve_id_membership AS eve_id, (SUM(rfm.ach_total)) AS promoteur2
|
|
FROM
|
|
rapport_finances_membership rfm
|
|
JOIN inscriptions_panier_acheteurs a ON rfm.no_panier = a.no_panier
|
|
WHERE
|
|
a.sta_id = 3 AND a.pai_id <> 6 AND rfm.ach_total > 0 $sqlWherePromoteur
|
|
GROUP BY rfm.eve_id_membership
|
|
ORDER BY rfm.eve_id_membership
|
|
";
|
|
$tabPromoteur2 = $objDatabase->fxGetResultsKey($sqlPromoteur2);
|
|
|
|
$sqlPromoteur3 = "
|
|
SELECT
|
|
r.eve_id, SUM(r.rem_montant) AS remboursement
|
|
FROM
|
|
remboursements r
|
|
WHERE
|
|
r.rem_deleted = 0 AND r.tr_id = 2 $sqlWhereRemboursement
|
|
GROUP BY r.eve_id
|
|
ORDER BY r.eve_id
|
|
";
|
|
$tabPromoteur3 = $objDatabase->fxGetResultsKey($sqlPromoteur3);
|
|
|
|
$sqlPromoteur4 = "
|
|
SELECT
|
|
e.eve_id, SUM(r.rem_montant) AS paiement
|
|
FROM
|
|
remboursements r
|
|
JOIN inscriptions_evenements e ON e.eve_id = r.eve_id
|
|
WHERE
|
|
r.rem_deleted = 0 AND r.tr_id = 1 $sqlWhereRemboursement
|
|
GROUP BY e.eve_id
|
|
ORDER BY e.eve_id
|
|
";
|
|
$tabPromoteur4 = $objDatabase->fxGetResultsKey($sqlPromoteur4);
|
|
|
|
$sqlPromoteur5 = "
|
|
SELECT
|
|
sub.eve_id,
|
|
sub.rem_date,
|
|
sub.rem_montant
|
|
FROM (
|
|
SELECT
|
|
e.eve_id,
|
|
r.rem_date,
|
|
r.rem_montant,
|
|
ROW_NUMBER() OVER (PARTITION BY e.eve_id ORDER BY r.rem_date DESC) as rn
|
|
FROM
|
|
remboursements r
|
|
JOIN inscriptions_evenements e ON e.eve_id = r.eve_id
|
|
WHERE
|
|
r.rem_deleted = 0 AND r.tr_id = 1
|
|
) sub
|
|
WHERE sub.rn = 1
|
|
";
|
|
$tabPromoteur5 = $objDatabase->fxGetResultsKey($sqlPromoteur5);
|
|
|
|
$sqlPromoteur6 = "
|
|
SELECT
|
|
sub.eve_id,
|
|
sub.rem_date,
|
|
sub.rem_montant
|
|
FROM (
|
|
SELECT
|
|
e.eve_id,
|
|
r.rem_date,
|
|
r.rem_montant,
|
|
ROW_NUMBER() OVER (PARTITION BY e.eve_id ORDER BY r.rem_date DESC) as rn
|
|
FROM
|
|
remboursements r
|
|
JOIN inscriptions_evenements e ON e.eve_id = r.eve_id
|
|
WHERE
|
|
r.rem_deleted = 0 AND r.tr_id = 1
|
|
) sub
|
|
WHERE sub.rn = 1
|
|
";
|
|
// old
|
|
// $tabPromoteur6 = $objDatabase->fxGetResultsKey($sqlPromoteur6);
|
|
|
|
|
|
// old
|
|
$sqlEvenements = "
|
|
SELECT
|
|
e.eve_id, e.eve_nom_$strLangue,eve_date_fin AS evenement
|
|
FROM
|
|
remboursements r
|
|
JOIN inscriptions_evenements e ON e.eve_id = r.eve_id
|
|
WHERE
|
|
e.eve_actif = 1
|
|
GROUP BY e.eve_id
|
|
ORDER BY e.eve_nom_$strLangue
|
|
";
|
|
$sqlEvenements = "
|
|
SELECT
|
|
e.eve_date_fin,e.eve_id, e.eve_nom_$strLangue AS evenement
|
|
FROM
|
|
inscriptions_evenements e
|
|
|
|
|
|
|
|
ORDER BY e.eve_date_fin desc
|
|
";
|
|
|
|
|
|
$tabEvenements = $objDatabase->fxGetResults($sqlEvenements);
|
|
|
|
$host = $_SERVER['HTTP_HOST'];
|
|
|
|
// Enlève "www." s'il est présent
|
|
$host = preg_replace('/^www\./', '', $host);
|
|
|
|
// Enlève "preprod." s'il est présent
|
|
$host = preg_replace('/^preprod\./', '', $host);
|
|
|
|
$host = "" . $host;
|
|
|
|
|
|
if ($tabEvenements != null) {
|
|
$intRow = 1;
|
|
|
|
foreach ($tabEvenements as $index => $array) {
|
|
$fltRemboursement = floatval($tabPromoteur3[$array['eve_id']]['remboursement']);
|
|
$fltPaiement = floatval($tabPromoteur4[$array['eve_id']]['paiement']);
|
|
$fltMontantPromoteur = floatval($tabPromoteur1[$array['eve_id']]['promoteur1']) + floatval($tabPromoteur2[$array['eve_id']]['promoteur2']);
|
|
|
|
$fltSolde = floatval($fltMontantPromoteur - ($fltPaiement + $fltRemboursement));
|
|
$fltPaiementdernier = floatval($tabPromoteur5[$array['eve_id']]['rem_montant']);
|
|
$fltPaiementdernierdate = $tabPromoteur5[$array['eve_id']]['rem_date'];
|
|
// $fltPaiementdernierpre = floatval($tabPromoteur6[$array['eve_id']]['rem_montant']);
|
|
// $fltPaiementdernierdatepre = $tabPromoteur6[$array['eve_id']]['rem_date'];
|
|
// alez voir dans crm
|
|
|
|
$sqlcrm = "SELECT * FROM proj_entete LEFT JOIN proj_genres on proj_transfert=gen_id WHERE proj_eve_id=".$array['eve_id'];
|
|
|
|
$tabcrm = $objDatabasecrm->fxGetResults($sqlcrm);
|
|
// Sécurise le comptage même si fxGetResults renvoie null/false
|
|
$nb = is_array($tabcrm) ? count($tabcrm) : 0;
|
|
$crm_info="";
|
|
// 2) Les 3 scénarios
|
|
if ($nb === 0) {
|
|
// --- CAS 1 : aucune ligne trouvée ---
|
|
// ➜ Fais ton action ici (exemples)
|
|
// log_message('info', "[proj_entete] Aucune ligne pour eve_id={$eveId}");
|
|
// return; // ou redirection, ou valeur par défaut, etc.
|
|
}
|
|
elseif ($nb === 1) {
|
|
// --- CAS 2 : une seule ligne ---
|
|
// ➜ Récupérer le GEN_NOM_FR dans une variable
|
|
$crm_info = isset($tabcrm[1]['gen_nom_fr']) ? $tabcrm[1]['gen_nom_fr'] : null;
|
|
$crm_info = $crm_info ."(".$tabcrm[1]['proj_numero'].")" ;
|
|
// $gen_nom_fr contient maintenant la valeur voulue
|
|
|
|
}
|
|
else {
|
|
// --- CAS 3 : plusieurs lignes ---
|
|
// ➜ Construire une liste séparée par virgules de tous les numéros PROJ_*
|
|
// Indique ici le nom exact de ta colonne « numéro » dans proj_entete
|
|
$colNumero = 'proj_numero'; // <-- adapte au vrai nom (ex.: 'proj_no', 'proj_num')
|
|
|
|
// Récupère la colonne, enlève les vides, déduplique au besoin, puis join avec des virgules
|
|
$numeros = array_column($tabcrm, $colNumero);
|
|
$numeros = array_filter($numeros, static fn($v) => $v !== null && $v !== '');
|
|
$numeros = array_unique($numeros); // retire si tu veux garder les doublons
|
|
|
|
$crm_info = "erreur plusieur projets ".implode(',', $numeros);
|
|
// $liste_projs contient par ex. "123,124,130"
|
|
}
|
|
|
|
if (intval(abs($fltSolde)) > 0) {
|
|
$tabPromoteurFinal[$intRow] = array(
|
|
'eve_id' => $array['eve_id'],
|
|
'evenement' => $array['evenement'] . ' (' . $array['eve_id'] . ')',
|
|
'datefin' => $array['eve_date_fin'],
|
|
'remboursement' => $fltRemboursement,
|
|
'paiement' => $fltPaiement,
|
|
'promoteur' => $fltMontantPromoteur,
|
|
'solde' => $fltSolde,
|
|
'paiementdernprod' => $fltPaiementdernier,
|
|
'paiementdernproddate' => $fltPaiementdernierdate,
|
|
'paiementdernpreprod' => $fltPaiementdernierpre,
|
|
'paiementdernpreproddate' => $fltPaiementdernierdatepre,
|
|
'crm_info' => $crm_info
|
|
);
|
|
|
|
$intRow++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($typeoutput == 'html') {
|
|
if ($strLangue == 'fr') {
|
|
$strTitreRapport = "Remboursements bilan <small>";
|
|
} else {
|
|
$strTitreRapport = "Remboursements bilan <small>";
|
|
}
|
|
|
|
if (isset($strWhere['dates'])) {
|
|
$strTitreRapport .= fxShowDate($strWhere['dates'][0], $strLangue);
|
|
|
|
if ($strLangue == 'fr') {
|
|
$strTitreRapport .= " au ";
|
|
} else {
|
|
$strTitreRapport .= " to ";
|
|
}
|
|
|
|
$strTitreRapport .= fxShowDate($strWhere['dates'][1], $strLangue);
|
|
} else {
|
|
if ($strLangue == 'fr') {
|
|
$strTitreRapport .= "en date d'aujourd'hui";
|
|
} else {
|
|
$strTitreRapport .= "as of today";
|
|
}
|
|
}
|
|
|
|
$strTitreRapport .= '</small>';
|
|
|
|
$strOutput .= fxShowRapportHeader($strTitreRapport, '', $arrBoutonExcel);
|
|
}
|
|
|
|
$strOutput .= '<table style="border-collapse:collapse; width:100%; max-width:500px; background:#fff; font-family:Segoe UI,Arial,sans-serif; border:2px solid #102848; border-radius:8px; box-shadow:0 1px 6px rgba(16,40,72,0.05);">';
|
|
$strOutput .= '<tr style="background:#102848;color:#fff;"><th colspan="2" style="padding:12px;text-align:left; border-top-left-radius:8px; border-top-right-radius:8px;">Fiche de remboursement ';
|
|
$strOutput .= '
|
|
<button type="submit" class="btn btn-light rounded-0" id="btn_paiement" name="btn_paiement">
|
|
créer les paiements
|
|
</button>';
|
|
|
|
$strOutput .= ' </th></tr>';
|
|
|
|
$datePour = $strWhere['dates'][1];
|
|
$dt = new DateTime($datePour);
|
|
$dt->modify('first day of next month');
|
|
$dt->setDate($dt->format('Y'), $dt->format('m'), 8);
|
|
// $date8 = $dt->format('Y-m-d'); // Résultat: '2025-01-08'
|
|
$date8 = date('Y-m-d');
|
|
$strOutput .= '<input type="hidden" name="info_paiement[date_payele]" id="date_payele" value="' . htmlspecialchars($date8) . '">';
|
|
$strOutput .= '<input type="hidden" name="info_paiement[details]" id="details" value="Solde au ' . htmlspecialchars($datePour) . '">';
|
|
$strOutput .= '<input type="hidden" name="info_paiement[ajouter_par]" id="ajouter_par" value="' . htmlspecialchars(fxUnescape($_SESSION['usa_info']['com_prenom'])) . '">';
|
|
$strOutput .= '<input type="hidden" name="info_paiement[date_pour]" id="date_pour" value="' . htmlspecialchars($strWhere['dates'][1]) . '">';
|
|
|
|
$strOutput .= '<tr><td style="font-weight:bold;color:#1a355a; background:#f7fafd; padding:8px; border-bottom:1px solid #e1e5ea;">Type remboursement :</td><td style="padding:8px; border-bottom:1px solid #e1e5ea;">Paiement</td></tr>';
|
|
$strOutput .= '<tr><td style="font-weight:bold;color:#1a355a; background:#f7fafd; padding:8px; border-bottom:1px solid #e1e5ea;">Montant :</td><td style="padding:8px; border-bottom:1px solid #e1e5ea;">solde restant</td></tr>';
|
|
$strOutput .= '<tr><td style="font-weight:bold;color:#1a355a; background:#f7fafd; padding:8px; border-bottom:1px solid #e1e5ea;">Payé le :</td><td style="padding:8px; border-bottom:1px solid #e1e5ea;">' . htmlspecialchars($date8) . '</td></tr>';
|
|
$strOutput .= '<tr><td style="font-weight:bold;color:#1a355a; background:#f7fafd; padding:8px; border-bottom:1px solid #e1e5ea;">Payé pour :</td><td style="padding:8px; border-bottom:1px solid #e1e5ea;">' . htmlspecialchars($datePour) . '</td></tr>';
|
|
$strOutput .= '<tr><td style="font-weight:bold;color:#1a355a; background:#f7fafd; padding:8px; border-bottom:1px solid #e1e5ea;">Mode remboursement :</td><td style="padding:8px; border-bottom:1px solid #e1e5ea;">Transfert bancaire au promoteur</td></tr>';
|
|
$strOutput .= '<tr><td style="font-weight:bold;color:#1a355a; background:#f7fafd; padding:8px; border-bottom:1px solid #e1e5ea;">Détails :</td><td style="padding:8px; border-bottom:1px solid #e1e5ea;">' . 'Solde au ' . htmlspecialchars($datePour) . '</td></tr>';
|
|
$strOutput .= '<tr><td style="font-weight:bold;color:#1a355a; background:#f7fafd; padding:8px;">Ajouté par :</td><td style="padding:8px;">' . htmlspecialchars(fxUnescape($_SESSION['usa_info']['com_prenom'])) . '</td></tr>';
|
|
$strOutput .= '</table>';
|
|
|
|
|
|
if ($tabPromoteurFinal != null) {
|
|
$intTotal = count($tabPromoteurFinal);
|
|
// HEADER
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$intWidth = $tabCol[1]['width'];
|
|
$strOutput .= '
|
|
<table class="rapport table" style="width: ' . ($intWidth + $intWidthQuestions) . 'px;">
|
|
<thead>
|
|
<tr>
|
|
';
|
|
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: ' . $tabCol[$intCtrcol]['info_option1'] . 'px;">' . $tabCol[$intCtrcol]['info_texte'] . '</th>
|
|
';
|
|
}
|
|
$strOutput .= '<th style="text-align: center;">
|
|
<input type="checkbox" id="checkAll" onclick="toggleAllCheckboxes(this)">
|
|
</th>';
|
|
$strOutput .= '<th style="text-align: center;">
|
|
|
|
</th>';
|
|
|
|
$strOutput .= '
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
';
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
$mem_int_ligne_entete = 1;
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$memtitre = $tabCol[$intCtrcol]['info_texte'];
|
|
$memwidth = $tabCol[$intCtrcol]['info_option1'] / 5;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
}
|
|
|
|
$mem_ligne = 2;
|
|
$arrLignesAcheteurs = array();
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabPromoteurFinal); $intCtr++) {
|
|
$arrData = $arrDataEpreuves = $arrDataParticipants = $arrLignesEpreuves = $arrLignesParticipants = array();
|
|
$intNoLigne = 1;
|
|
|
|
// $arrLignesAcheteurs[$tabPromoteurFinal[$intCtr]['no_panier']] = $intNoLigne;
|
|
|
|
// CRÉER LE TABLEAU DE DONNÉES FINAL
|
|
for ($intCtr4 = 1; $intCtr4 <= $intNoLigne; $intCtr4++) {
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$arrData[$intCtr4][$tabCol[$intCtrcol]['info_option2']] = $tabPromoteurFinal[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
}
|
|
|
|
// BODY - PARTICIPANTS
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
foreach ($arrData as $intLigne => $data) {
|
|
|
|
|
|
$strClass = ($intCtr & 1) ? '' : ' class="table-secondary"';
|
|
$strOutput .= '
|
|
<tr' . $strClass . '>
|
|
<td style="text-align: center;">' . $intCtr . '</td>
|
|
';
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<td style="text-align: ' . $tabCol[$intCtrcol]['info_option3'] . ';">
|
|
';
|
|
|
|
if (trim($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]) != '') {
|
|
switch ($tabCol[$intCtrcol]['info_description']) {
|
|
case 'date':
|
|
$strOutput .= fxShowDate($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
break;
|
|
case 'datetime':
|
|
$strOutput .= fxShowDate($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue) . ' @ ' . fxShowTime($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]);
|
|
break;
|
|
case 'money':
|
|
$strOutput .= fxShowMoney($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
|
|
if (!array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum))
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] = 0;
|
|
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] += $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
break;
|
|
default:
|
|
$strOutput .= $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
</td>
|
|
';
|
|
}
|
|
$strOutput .= '<td style="text-align: center;">';
|
|
$strOutput .= '<input class="eve_id_checkbox" type="checkbox" name="eve_id[]" value="' . $arrData[$intLigne]['eve_id'] . ';' . $arrData[$intLigne]['solde'] . '">';
|
|
|
|
$strOutput .= '</td>';
|
|
// Toujours s'assurer d'avoir le protocole devant (https)
|
|
if (strpos($host, 'http') !== 0) {
|
|
$host = 'https://www.' . $host;
|
|
}
|
|
$host = rtrim($host, '/');
|
|
|
|
$url = '/superadm/index.php?t=NA%3D%3D&a=mod&id=' . $arrData[$intLigne]['eve_id'];
|
|
|
|
$strOutput .= '<td style="text-align: center;">';
|
|
$strOutput .= '<a href="' . $url . '" target="_blank" style="display: inline-block; padding: 6px 14px; background: #2196f3; color: #fff; border-radius: 6px; text-decoration: none; font-size: 15px;">';
|
|
$strOutput .= '🔗 ';// Affiche juste le domaine
|
|
$strOutput .= '</a>';
|
|
$strOutput .= '</td>';
|
|
|
|
|
|
$strOutput .= '
|
|
</tr>
|
|
';
|
|
}
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
foreach ($arrData as $intLigne => $data) {
|
|
$c = 'A';
|
|
$mem_result = $intCtr;
|
|
$mem_align = 'center';
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $mem_result);
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$mem_result = $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
$mem_align = $tabCol[$intCtrcol]['info_option3'];
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
if (trim($arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']]) != '') {
|
|
switch ($tabCol[$intCtrcol]['info_description']) {
|
|
case 'money':
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
|
|
|
if (!array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum))
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] = 0;
|
|
|
|
$arrSum[$tabCol[$intCtrcol]['info_option2']] += $arrData[$intLigne][$tabCol[$intCtrcol]['info_option2']];
|
|
break;
|
|
}
|
|
}
|
|
|
|
++$c;
|
|
}
|
|
|
|
$mem_ligne++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (count($arrSum) > 0) {
|
|
if ($typeoutput == 'html') {
|
|
$strOutput .= '
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<th style="text-align: center;"> </th>
|
|
';
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<th style="text-align: right;">
|
|
';
|
|
|
|
if (array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum)) {
|
|
$strValue = fxShowMoney($arrSum[$tabCol[$intCtrcol]['info_option2']], $strLangue);
|
|
} else
|
|
$strValue = ' ';
|
|
|
|
$strOutput .= '
|
|
' . $strValue . '
|
|
</th>
|
|
';
|
|
}
|
|
|
|
$strOutput .= '
|
|
</tr>
|
|
</tfoot>
|
|
';
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, '');
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_ligne);
|
|
++$c;
|
|
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
if (array_key_exists($tabCol[$intCtrcol]['info_option2'], $arrSum)) {
|
|
$strValue = $arrSum[$tabCol[$intCtrcol]['info_option2']];
|
|
} else {
|
|
$strValue = '';
|
|
}
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $strValue);
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_ligne);
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_ligne)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if ($typeoutput == 'html') { //HTML ICI
|
|
$strOutput .= fxShowRapportEmpty($strLangue);
|
|
}
|
|
}
|
|
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strOutput .= fxShowRapportFooter($arrBoutonExcel);
|
|
}
|
|
break;
|
|
/****************************
|
|
* RAPPORT ADÉSIONS ACTIVES *
|
|
****************************/
|
|
case 'adhesions':
|
|
$memexcfichier = "rapport-memberships-actifs";
|
|
$intNbQuestions = $intNbQuestionsAdhesions = $intWidthQuestions = 0;
|
|
|
|
// colonne
|
|
$strClef = 'rap_abonnements';
|
|
|
|
$sqlQuestions1 = "
|
|
SELECT
|
|
que_id, que_question_" . $strLangue . ", que_rapport_label_" . $strLangue . "
|
|
FROM
|
|
inscriptions_questions
|
|
WHERE
|
|
que_rapport = 1 AND eve_id = " . intval($intEvenement) . "
|
|
ORDER BY
|
|
que_tri, que_id
|
|
";
|
|
$tabQuestions1 = $objDatabase->fxGetResults($sqlQuestions1);
|
|
|
|
if ($tabQuestions1 != null) {
|
|
$intNbQuestions = count($tabQuestions1);
|
|
$intWidthQuestions += $intNbQuestions * 200;
|
|
}
|
|
|
|
// QUESTI0NS ADHÉSIONS
|
|
$sqlQuestionsAdhesions = "
|
|
SELECT
|
|
mq_id, mq_colonne_rapport_" . $strLangue . ", mq_validation
|
|
FROM
|
|
memberships_questions
|
|
WHERE
|
|
mq_actif = 1 AND mt_id IN(SELECT mt_id FROM memberships_types WHERE eve_id = " . intval($intEvenement) . ")
|
|
ORDER BY
|
|
mt_id, mq_ordre, mq_id
|
|
";
|
|
$tabQuestionsAdhesions = $objDatabase->fxGetResults($sqlQuestionsAdhesions);
|
|
|
|
if ($tabQuestionsAdhesions != null) {
|
|
$intNbQuestionsAdhesions = count($tabQuestionsAdhesions);
|
|
$intWidthQuestions += $intNbQuestionsAdhesions * 200;
|
|
}
|
|
|
|
$sqlQuestions2 = "
|
|
SELECT
|
|
rq.que_validation,rq.pec_id, rq.par_id, rq.que_id, rq.que_question_" . $strLangue . ", rq.que_choix_" . $strLangue . ", iq.que_rapport_label_" . $strLangue . "
|
|
FROM
|
|
resultats_questions rq, inscriptions_questions iq
|
|
WHERE
|
|
rq.que_id = iq.que_id AND iq.que_rapport = 1 AND iq.eve_id = " . intval($intEvenement) . "
|
|
ORDER BY
|
|
rq.pec_id, rq.par_id, rq.que_id
|
|
";
|
|
$qryQuestions2 = $objDatabase->fxQuery($sqlQuestions2);
|
|
$nbQuestions2 = $objDatabase->fxGetNumRows($qryQuestions2);
|
|
$tabQuestions2 = array();
|
|
|
|
if ($nbQuestions2 > 0) {
|
|
while ($rowQuestions = $objDatabase->fxFetchAssoc($qryQuestions2))
|
|
$tabQuestions2[$rowQuestions['pec_id']][$rowQuestions['par_id']][$rowQuestions['que_id']] = $rowQuestions;
|
|
}
|
|
|
|
$sqlCol = "select * from info where info_actif = 1 AND info_clef='" . $strClef . "' and info_langue='" . $strLangue . "' order by info_trie";
|
|
$tabCol = $objDatabase->fxGetResults($sqlCol);
|
|
|
|
// SQL
|
|
$sqlParticipants = "
|
|
SELECT
|
|
m.mem_numero, m.mem_date_debut, m.mem_date_fin,
|
|
mt.mt_nom_" . $strLangue . " AS type_membership,
|
|
mst.mst_nom_" . $strLangue . " AS sous_type_membership,
|
|
(SELECT com_affilie FROM inscriptions_comptes WHERE com_id = m.com_id) AS associe,
|
|
ec.no_commande,
|
|
c.com_prenom AS firstname,
|
|
c.com_nom AS lastname,
|
|
c.com_sexe AS sexe,
|
|
c.com_ville AS city,
|
|
prov.pro_nom_" . $strLangue . " AS state,
|
|
pays.pay_nom_" . $strLangue . " AS country,
|
|
prov.pro_iso AS state_iso,
|
|
pays.pay_iso AS country_iso,
|
|
|
|
p.par_age AS age,
|
|
c.com_naissance AS DOB,
|
|
IF(p.par_modification_promoteur = 1, p.par_maj, (SELECT ach_maj FROM inscriptions_panier_acheteurs WHERE no_commande = ec.no_commande)) AS date_inscription,
|
|
c.com_adresse AS par_adresse,
|
|
c.com_adresse2 AS par_adresse2,
|
|
c.com_codepostal AS par_codepostal,
|
|
c.com_telephone1 AS par_telephone1,
|
|
c.com_courriel AS par_courriel,
|
|
p.pec_id,
|
|
p.par_id_original,
|
|
e.epr_id,
|
|
e.epr_type_" . $strLangue . " AS type,
|
|
e.epr_categorie_" . $strLangue . " AS categorie,
|
|
ev.eve_label_url,
|
|
(SELECT eve_nom_" . $strLangue . " FROM inscriptions_evenements WHERE eve_id = a.eve_id) AS provenance
|
|
FROM memberships m
|
|
JOIN memberships_types mt ON mt.mt_id = m.mt_id
|
|
JOIN memberships_sous_types mst ON mst.mst_id = m.mst_id
|
|
JOIN resultats_epreuves_commandees ec ON ec.pec_id_original = m.pec_id
|
|
JOIN resultats_participants p ON p.pec_id = m.pec_id
|
|
JOIN inscriptions_epreuves e ON e.epr_id = m.epr_id
|
|
JOIN inscriptions_evenements ev ON ev.eve_id = e.eve_id
|
|
JOIN inscriptions_panier_acheteurs a ON a.no_commande = m.no_commande
|
|
JOIN inscriptions_comptes c ON c.com_id = m.com_id
|
|
JOIN inscriptions_provinces prov ON prov.pro_id = c.pro_id
|
|
JOIN inscriptions_pays pays ON pays.pay_id = c.pay_id
|
|
WHERE
|
|
m.mem_actif = 1 AND
|
|
m.mem_date_fin >= '" . fxGetDate() . "' AND
|
|
ec.pec_actif = 1 AND
|
|
ec.is_cancelled = 0 AND
|
|
p.is_cancelled = 0 AND
|
|
p.rol_id = 1 AND
|
|
p.eve_id = " . intval($intEvenement);
|
|
|
|
if (isset($strWhere['acheteur']) && trim($strWhere['acheteur']) != '') {
|
|
$sqlParticipants .= " AND " . $strWhere['acheteur'];
|
|
}
|
|
if (isset($strWhere['membership']) && trim($strWhere['membership']) != '') {
|
|
$sqlParticipants .= " AND " . $strWhere['membership'];
|
|
} else { // mettre la recherche par défaut:
|
|
// $sqlAcheteurs .= " AND a.ach_maj = '" . fxGetDate() . "'"; // aujourd'hui
|
|
//$sqlParticipants .= " AND MONTH(a.ach_maj) = '" . date('m') . "' AND YEAR(a.ach_maj) = '" . date('Y') . "'"; // cse mois-ci
|
|
}
|
|
|
|
/*************
|
|
* SQl COUNT *
|
|
*************/
|
|
$blnPager = true;
|
|
$sqlCount = "SELECT COUNT(*) AS nb " . substr($sqlParticipants, strrpos($sqlParticipants, 'FROM'));
|
|
$intNbTotal = $objDatabase->fxGetVar($sqlCount);
|
|
/*************
|
|
* SQl COUNT *
|
|
*************/
|
|
|
|
if (trim($strOrder) != '') {
|
|
$sqlParticipants .= " ORDER BY " . $strOrder;
|
|
} else {
|
|
$sqlParticipants .= " ORDER BY date_inscription, p.par_nom, p.par_prenom";
|
|
}
|
|
|
|
/*************
|
|
* SQl LIMIT *
|
|
*************/
|
|
if ($typeoutput == 'html') {
|
|
$intStart = ($intNbParPage * $intPage) - $intNbParPage;
|
|
// limiter le nombre de ligne à retourner
|
|
if ($intNbParPage > 0)
|
|
$sqlParticipants .= " LIMIT " . intval($intStart) . ", " . intval($intNbParPage);
|
|
}
|
|
/*************
|
|
* SQl LIMIT *
|
|
*************/
|
|
|
|
$tabParticipants = $objDatabase->fxGetResults($sqlParticipants);
|
|
//print("<pre>".print_r($tabParticipants,true)."</pre>");
|
|
//exit;
|
|
|
|
if ($typeoutput == 'html') {
|
|
if ($strLangue == 'fr') {
|
|
$strTitreRapport = "Rapport: adhésions actives";
|
|
$strBoutonExcel = "Exportation excel";
|
|
$strBoutonExcel2 = "Exportation excel <small>(sans accents)</small>";
|
|
} else {
|
|
$strTitreRapport = "Report: active memberships";
|
|
$strBoutonExcel = "Export to excel";
|
|
$strBoutonExcel2 = "Export to excel <small>(w/o accents)</small>";
|
|
}
|
|
$strOutput .= $strWarning;
|
|
$strOutput .= fxShowRapportHeader($strTitreRapport, $strNomEvenement, $arrBoutonExcel);
|
|
}
|
|
|
|
if ($tabParticipants != null) {
|
|
$intTotal = count($tabParticipants);
|
|
$intNbCol = 19 + $intNbQuestions;
|
|
|
|
// HEADER
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$intWidthQuestions += 2140;
|
|
$strOutput .= '
|
|
<table class="rapport table" style="width: ' . $intWidthQuestions . 'px;">
|
|
<thead>
|
|
<tr>
|
|
';
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: ' . $tabCol[$intCtrcol]['info_option1'] . 'px;">
|
|
' . $tabCol[$intCtrcol]['info_texte'] . '
|
|
</th>
|
|
';
|
|
}
|
|
// QUESTIONS
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$strLabel = $tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$strLabel = $tabQuestions1[$intCtr2]['que_id'];
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: left; width: 200px;">' . $strLabel . '</th>
|
|
';
|
|
}
|
|
}
|
|
// QUESTI0NS ADHÉSIONS
|
|
if ($intNbQuestionsAdhesions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestionsAdhesions; $intCtr2++) {
|
|
if (trim($tabQuestionsAdhesions[$intCtr2]['mq_colonne_rapport_' . $strLangue]) != '')
|
|
$strLabel = $tabQuestionsAdhesions[$intCtr2]['mq_colonne_rapport_' . $strLangue];
|
|
else
|
|
$strLabel = 'mq' . $tabQuestionsAdhesions[$intCtr2]['mq_id'];
|
|
|
|
$strOutput .= '
|
|
<th style="text-align: left; width: 200px;">' . $strLabel . '</th>
|
|
';
|
|
}
|
|
}
|
|
$strOutput .= '
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
';
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
$mem_int_ligne_entete = 1;
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
if ($blnSansAccents) {
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabCol[$intCtrcol]['info_texte'])));
|
|
} else {
|
|
$memtitre = $tabCol[$intCtrcol]['info_texte'];
|
|
}
|
|
|
|
$memwidth = $tabCol[$intCtrcol]['info_option1'] / 5;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if ($blnSansAccents) {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue])));
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
} else {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
}
|
|
|
|
$memwidth = 20;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
}
|
|
// QUESTI0NS ADHÉSIONS
|
|
if ($intNbQuestionsAdhesions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestionsAdhesions; $intCtr2++) {
|
|
if ($blnSansAccents) {
|
|
if (trim($tabQuestionsAdhesions[$intCtr2]['mq_colonne_rapport_' . $strLangue]) != '')
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabQuestionsAdhesions[$intCtr2]['mq_colonne_rapport_' . $strLangue])));
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
} else {
|
|
if (trim($tabQuestionsAdhesions[$intCtr2]['mq_colonne_rapport_' . $strLangue]) != '')
|
|
$memtitre = $tabQuestionsAdhesions[$intCtr2]['mq_colonne_rapport_' . $strLangue];
|
|
else
|
|
$memtitre = 'mq' . $tabQuestionsAdhesions[$intCtr2]['mq_id'];
|
|
}
|
|
|
|
$memwidth = 20;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
|
|
$mem_ligne = 2;
|
|
// print("<pre>".print_r($tabParticipants,true)."</pre>");
|
|
for ($intCtr = 1; $intCtr <= count($tabParticipants); $intCtr++) {
|
|
// Trover les réponses aux quextions adhésions
|
|
if ($intNbQuestionsAdhesions > 0) {
|
|
$sqlReponsesQuestionsAdhesions = "
|
|
SELECT
|
|
mq_id, mr_reponse
|
|
FROM
|
|
memberships_reponses
|
|
WHERE
|
|
mr_actif = 1 AND mem_numero = '" . $tabParticipants[$intCtr]['mem_numero'] . "'
|
|
ORDER BY
|
|
mq_id
|
|
";
|
|
$tabReponsesQuestionsAdhesions = $objDatabase->fxGetResultsKey($sqlReponsesQuestionsAdhesions);
|
|
} else {
|
|
$tabReponsesQuestionsAdhesions = null;
|
|
}
|
|
|
|
// IFS
|
|
switch ($tabParticipants[$intCtr]['sexe']) {
|
|
case 'f':
|
|
$tabParticipants[$intCtr]['sexe'] = 'F';
|
|
break;
|
|
case 'h':
|
|
$tabParticipants[$intCtr]['sexe'] = 'M';
|
|
break;
|
|
}
|
|
|
|
// BODY - PARTICIPANTS
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strClass = ($intCtr & 1) ? '' : ' class="table-secondary"';
|
|
|
|
$strOutput .= '
|
|
<tr' . $strClass . '>
|
|
<td style="text-align: center;">' . ($intCtr + $intStart) . '</td>
|
|
';
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'modifier') {
|
|
$mem_val = '
|
|
<button class="btn btn-primary btn-sm btn-block rounded-0 btn_edit_event_promo" id="modifier_' . $tabParticipants[$intCtr]['pec_id'] . '" data-eve_code="' . $tabParticipants[$intCtr]['eve_label_url'] . '" data-epr_id="' . $tabParticipants[$intCtr]['epr_id'] . '" data-eve_id="' . $intEvenement . '" value="' . $tabParticipants[$intCtr]['pec_id'] . '">
|
|
' . $tabCol[$intCtrcol]['info_texte'] . '
|
|
</button>
|
|
';
|
|
} else {
|
|
$mem_val = $tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
|
|
// valide email associe
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'par_courriel') {
|
|
if ($tabParticipants[$intCtr]['associe'] != '') {
|
|
$sqlClient = "SELECT com_courriel FROM inscriptions_comptes WHERE com_id = " . intval($tabParticipants[$intCtr]['associe']);
|
|
$nbClient = $objDatabase->fxGetRow($sqlClient);
|
|
|
|
$mem_val = $nbClient['com_courriel'];
|
|
}
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td style="text-align: ' . $tabCol[$intCtrcol]['info_option3'] . ';">' . $mem_val . '</td>
|
|
';
|
|
}
|
|
|
|
// QUESTIONS
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
else
|
|
$strValue = ' ';
|
|
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']])) {
|
|
$mem_validation = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_validation'];
|
|
|
|
if (($mem_validation == "image" || $mem_validation == "pdf") && trim($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr']) != "") {
|
|
$strValue = $strValue . ' <a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/rapport_new?rep=' . $intEvenement . '&nom=' . $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr'] . '" target="_blank">télécharger</a>';
|
|
}
|
|
}
|
|
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']])) {
|
|
$mem_validation = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_validation'];
|
|
|
|
if (($mem_validation == "image" || $mem_validation == "pdf") && trim($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr']) != "") {
|
|
$strValue = $strValue . ' <a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/superadm/download.php?rep=' . $intEvenement . '&nom=' . $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr'] . '" target="_blank">télécharger</a>';
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td>' . $strValue . '</td>
|
|
';
|
|
}
|
|
}
|
|
// QUESTI0NS ADHÉSIONS
|
|
if ($intNbQuestionsAdhesions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestionsAdhesions; $intCtr2++) {
|
|
if ($tabReponsesQuestionsAdhesions != null && isset($tabReponsesQuestionsAdhesions[$tabQuestionsAdhesions[$intCtr2]['mq_id']]) && trim($tabReponsesQuestionsAdhesions[$tabQuestionsAdhesions[$intCtr2]['mq_id']]['mr_reponse']) != '') {
|
|
$strValue = $tabReponsesQuestionsAdhesions[$tabQuestionsAdhesions[$intCtr2]['mq_id']]['mr_reponse'];
|
|
|
|
if ($tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'document' || $tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'image') {
|
|
$strValue = '<a class="btn btn-primary rounded-pill" href="' . $vDomaine . '/membership/' . $tabParticipants[$intCtr]['mem_numero'] . '/' . $strValue . '" target="_blank">' . $strValue . '</a>';
|
|
} elseif ($tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'facebook') {
|
|
$strValue = '<a class="btn btn-primary rounded-pill" href="https://facebook.com/' . $strValue . '" target="_blank">' . $strValue . '</a>';
|
|
} elseif ($tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'instagram') {
|
|
$strValue = '<a class="btn btn-primary rounded-pill" href="https://instagram.com/' . $strValue . '" target="_blank">' . $strValue . '</a>';
|
|
} elseif ($tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'email') {
|
|
$strValue = '<a class="btn btn-primary rounded-pill" href="mailto:' . $strValue . '" target="_blank">' . $strValue . '</a>';
|
|
}
|
|
} else {
|
|
$strValue = '';
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td>' . $strValue . '</td>
|
|
';
|
|
}
|
|
}
|
|
$strOutput .= '</tr>';
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
|
|
if (!$blnCSV) {
|
|
$mem_result = ($intCtr + $intStart);
|
|
$mem_align = 'center';
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, $mem_result);
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
// }
|
|
++$c;
|
|
$intCtrcol = 2;
|
|
} else {
|
|
$intCtrcol = 1;
|
|
}
|
|
|
|
for ($intCtrcol; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
if ($blnSansAccents) {
|
|
$mem_result = ucwords(strtolower(fxRemoveAccents($tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']])));
|
|
} else {
|
|
$mem_result = $tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
|
|
// valide email associe
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'par_courriel') {
|
|
if ($tabParticipants[$intCtr]['associe'] != '') {
|
|
$sqlClient = "SELECT com_courriel FROM inscriptions_comptes WHERE com_id = " . intval($tabParticipants[$intCtr]['associe']);
|
|
$nbClient = $objDatabase->fxGetRow($sqlClient);
|
|
|
|
$mem_result = $nbClient['com_courriel'];
|
|
}
|
|
}
|
|
|
|
$mem_align = $tabCol[$intCtrcol]['info_option3'];
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
}
|
|
|
|
// QUESTIONS
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if ($blnSansAccents) {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = ucwords(strtolower(fxRemoveAccents($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue])));
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = ucwords(strtolower(fxRemoveAccents($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue])));
|
|
else
|
|
$strValue = '';
|
|
} else {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
else
|
|
$strValue = '';
|
|
}
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValueExplicit($c . $mem_ligne, ($strValue));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal('left');
|
|
++$c;
|
|
}
|
|
}
|
|
// QUESTI0NS ADHÉSIONS
|
|
if ($intNbQuestionsAdhesions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestionsAdhesions; $intCtr2++) {
|
|
if ($tabReponsesQuestionsAdhesions != null && isset($tabReponsesQuestionsAdhesions[$tabQuestionsAdhesions[$intCtr2]['mq_id']]) && trim($tabReponsesQuestionsAdhesions[$tabQuestionsAdhesions[$intCtr2]['mq_id']]['mr_reponse']) != '') {
|
|
$strValue = $tabReponsesQuestionsAdhesions[$tabQuestionsAdhesions[$intCtr2]['mq_id']]['mr_reponse'];
|
|
|
|
if ($tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'document' || $tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'image') {
|
|
$strValue = $vDomaine . '/membership/' . $tabParticipants[$intCtr]['mem_numero'] . '/' . $strValue;
|
|
} elseif ($tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'facebook') {
|
|
$strValue = 'https://facebook.com/' . $strValue;
|
|
} elseif ($tabQuestionsAdhesions[$intCtr2]['mq_validation'] == 'instagram') {
|
|
$strValue = 'https://instagram.com/' . $strValue;
|
|
}
|
|
} else {
|
|
$strValue = '';
|
|
}
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValueExplicit($c . $mem_ligne, ($strValue));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal('left');
|
|
++$c;
|
|
}
|
|
}
|
|
$mem_ligne += 1;
|
|
}
|
|
}
|
|
} else {
|
|
if ($typeoutput == 'html') { //HTML ICI
|
|
$strOutput .= fxShowRapportEmpty($strLangue);
|
|
}
|
|
}
|
|
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strOutput .= fxShowRapportFooter($arrBoutonExcel);
|
|
}
|
|
break;
|
|
/****************************
|
|
* RAPPORT ADÉSIONS VENDUES *
|
|
****************************/
|
|
case 'adhesions-ventes':
|
|
$memexcfichier = "rapport-memberships-vendues";
|
|
$intNbQuestions = $intWidthQuestions = 0;
|
|
|
|
// colonne
|
|
$strClef = 'rap_abonnements_ventes';
|
|
$sqlCol = "SELECT * FROM info WHERE info_actif = 1 AND info_clef = '" . $strClef . "' AND info_langue = '" . $strLangue . "' ORDER BY info_trie";
|
|
$tabCol = $objDatabase->fxGetResults($sqlCol);
|
|
|
|
$sqlQuestions1 = "
|
|
SELECT
|
|
que_id, que_question_" . $strLangue . ", que_rapport_label_" . $strLangue . "
|
|
FROM
|
|
inscriptions_questions
|
|
WHERE
|
|
que_rapport = 1 AND eve_id = " . intval($intEvenement) . "
|
|
ORDER BY
|
|
que_tri, que_id
|
|
";
|
|
$tabQuestions1 = $objDatabase->fxGetResults($sqlQuestions1);
|
|
|
|
if ($tabQuestions1 != null) {
|
|
$intNbQuestions = count($tabQuestions1);
|
|
$intWidthQuestions = $intNbQuestions * 200;
|
|
}
|
|
|
|
$sqlQuestions2 = "
|
|
SELECT
|
|
rq.que_validation,rq.pec_id, rq.par_id, rq.que_id, rq.que_question_" . $strLangue . ", rq.que_choix_" . $strLangue . ", iq.que_rapport_label_" . $strLangue . "
|
|
FROM
|
|
resultats_questions rq, inscriptions_questions iq
|
|
WHERE
|
|
rq.que_id = iq.que_id AND iq.que_rapport = 1 AND iq.eve_id = " . intval($intEvenement) . "
|
|
ORDER BY
|
|
rq.pec_id, rq.par_id, rq.que_id
|
|
";
|
|
$qryQuestions2 = $objDatabase->fxQuery($sqlQuestions2);
|
|
$nbQuestions2 = $objDatabase->fxGetNumRows($qryQuestions2);
|
|
$tabQuestions2 = array();
|
|
|
|
if ($nbQuestions2 > 0) {
|
|
while ($rowQuestions = $objDatabase->fxFetchAssoc($qryQuestions2))
|
|
$tabQuestions2[$rowQuestions['pec_id']][$rowQuestions['par_id']][$rowQuestions['que_id']] = $rowQuestions;
|
|
}
|
|
|
|
// SQL
|
|
$sqlParticipants = "
|
|
SELECT
|
|
m.mem_numero, m.mem_date_debut, m.mem_date_fin,
|
|
mt.mt_nom_" . $strLangue . " AS type_membership,
|
|
mst.mst_nom_" . $strLangue . " AS sous_type_membership,
|
|
c.com_affilie AS associe,
|
|
ec.no_commande,
|
|
c.com_prenom AS firstname,
|
|
c.com_nom AS lastname,
|
|
c.com_sexe AS sexe,
|
|
c.com_ville AS city,
|
|
prov.pro_nom_" . $strLangue . " AS state,
|
|
pays.pay_nom_" . $strLangue . " AS country,
|
|
p.par_age AS age,
|
|
c.com_naissance AS DOB,
|
|
a.ach_maj AS date_inscription,
|
|
c.com_adresse AS par_adresse,
|
|
c.com_adresse2 AS par_adresse2,
|
|
c.com_codepostal AS par_codepostal,
|
|
c.com_telephone1 AS par_telephone1,
|
|
c.com_courriel AS par_courriel,
|
|
p.pec_id,
|
|
p.par_id_original,
|
|
e.epr_id,
|
|
e.epr_type_" . $strLangue . " AS type,
|
|
e.epr_categorie_" . $strLangue . " AS categorie,
|
|
ec.is_cancelled,
|
|
ec.pec_membership_start, ec.pec_membership_end
|
|
FROM memberships m
|
|
JOIN memberships_types mt ON mt.mt_id = m.mt_id
|
|
JOIN memberships_sous_types mst ON mst.mst_id = m.mst_id
|
|
JOIN resultats_epreuves_commandees ec ON ec.pec_id_original = m.pec_id
|
|
JOIN resultats_participants p ON p.pec_id = m.pec_id
|
|
JOIN inscriptions_epreuves e ON e.epr_id = m.epr_id
|
|
JOIN inscriptions_evenements ev ON ev.eve_id = e.eve_id
|
|
JOIN inscriptions_panier_acheteurs a ON a.no_commande = m.no_commande
|
|
JOIN inscriptions_comptes c ON c.com_id = m.com_id
|
|
JOIN inscriptions_provinces prov ON prov.pro_id = c.pro_id
|
|
JOIN inscriptions_pays pays ON pays.pay_id = c.pay_id
|
|
WHERE
|
|
/*m.mem_actif = 1 AND*/
|
|
ec.pec_actif = 1 AND
|
|
ec.is_cancelled = 0 AND
|
|
p.is_cancelled = 0 AND
|
|
p.rol_id = 1 AND
|
|
ec.eve_id = " . intval($intEvenement);
|
|
|
|
if (isset($strWhere['acheteur']) && trim($strWhere['acheteur']) != '') {
|
|
$sqlParticipants .= " AND " . $strWhere['acheteur'];
|
|
}
|
|
if (isset($strWhere['membership']) && trim($strWhere['membership']) != '') {
|
|
$sqlParticipants .= " AND " . $strWhere['membership'];
|
|
} elseif (!isset($strWhere['acheteur'])) { // mettre la recherche par défaut:
|
|
// $sqlAcheteurs .= " AND a.ach_maj = '" . fxGetDate() . "'"; // aujourd'hui
|
|
//$sqlParticipants .= " AND MONTH(a.ach_maj) = '" . date('m') . "' AND YEAR(a.ach_maj) = '" . date('Y') . "'"; // cse mois-ci
|
|
}
|
|
|
|
/*************
|
|
* SQl COUNT *
|
|
*************/
|
|
$blnPager = true;
|
|
$sqlCount = "SELECT COUNT(*) AS nb " . substr($sqlParticipants, strpos($sqlParticipants, 'FROM'));
|
|
$intNbTotal = $objDatabase->fxGetVar($sqlCount);
|
|
/*************
|
|
* SQl COUNT *
|
|
*************/
|
|
|
|
if (trim($strOrder) != '') {
|
|
$sqlParticipants .= " ORDER BY " . $strOrder;
|
|
} else {
|
|
$sqlParticipants .= " ORDER BY date_inscription, p.par_nom, p.par_prenom";
|
|
}
|
|
|
|
/*************
|
|
* SQl LIMIT *
|
|
*************/
|
|
if ($typeoutput == 'html') {
|
|
$intStart = ($intNbParPage * $intPage) - $intNbParPage;
|
|
// limiter le nombre de ligne à retourner
|
|
if ($intNbParPage > 0)
|
|
$sqlParticipants .= " LIMIT " . intval($intStart) . ", " . intval($intNbParPage);
|
|
}
|
|
/*************
|
|
* SQl LIMIT *
|
|
*************/
|
|
|
|
$tabParticipants = $objDatabase->fxGetResults($sqlParticipants);
|
|
//print("<pre>".print_r($tabParticipants,true)."</pre>");
|
|
//echo $sqlParticipants;
|
|
//exit;
|
|
|
|
if ($typeoutput == 'html') {
|
|
if ($strLangue == 'fr') {
|
|
$strTitreRapport = "liste d'adhésions annuelles";
|
|
} else {
|
|
$strTitreRapport = "liste d'adhésions annuelles";
|
|
}
|
|
|
|
$strOutput .= $strWarning;
|
|
$strOutput .= fxShowRapportHeader($strTitreRapport, $strNomEvenement, $arrBoutonExcel);
|
|
|
|
}
|
|
|
|
if ($tabParticipants != null) {
|
|
// HEADER
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$intWidthQuestions += 2140;
|
|
$strOutput .= '
|
|
<table class="rapport table" style="width: ' . $intWidthQuestions . 'px;">
|
|
<thead>
|
|
<tr>
|
|
';
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$strOutput .= '
|
|
<th style="text-align: center; width: ' . $tabCol[$intCtrcol]['info_option1'] . 'px;">
|
|
' . $tabCol[$intCtrcol]['info_texte'] . '
|
|
</th>
|
|
';
|
|
}
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$strLabel = $tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$strLabel = $tabQuestions1[$intCtr2]['que_id'];
|
|
$strOutput .= '
|
|
<th style="text-align: left; width: 200px;">' . $strLabel . '</th>
|
|
';
|
|
}
|
|
}
|
|
$strOutput .= '
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
';
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
$c = 'A';
|
|
$mem_int_ligne_entete = 1;
|
|
for ($intCtrcol = 1; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
if ($blnSansAccents) {
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabCol[$intCtrcol]['info_texte'])));
|
|
} else {
|
|
$memtitre = $tabCol[$intCtrcol]['info_texte'];
|
|
}
|
|
|
|
$memwidth = $tabCol[$intCtrcol]['info_option1'] / 5;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
|
|
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if ($blnSansAccents) {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = ucwords(strtolower(fxRemoveAccents($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue])));
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
} else {
|
|
if (trim($tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue]) != '')
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_rapport_label_' . $strLangue];
|
|
else
|
|
$memtitre = $tabQuestions1[$intCtr2]['que_id'];
|
|
}
|
|
|
|
$memwidth = 20;
|
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension($c)->setWidth($memwidth);
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_int_ligne_entete, ($memtitre));
|
|
$objPHPExcel->getActiveSheet()->getStyle($c . $mem_int_ligne_entete)->getFont()->setBold(true);
|
|
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, $c . $mem_int_ligne_entete);
|
|
++$c;
|
|
}
|
|
}
|
|
}
|
|
|
|
$mem_ligne = 2;
|
|
// print("<pre>".print_r($tabParticipants,true)."</pre>");
|
|
for ($intCtr = 1; $intCtr <= count($tabParticipants); $intCtr++) {
|
|
// IFS
|
|
switch ($tabParticipants[$intCtr]['sexe']) {
|
|
case 'f':
|
|
$tabParticipants[$intCtr]['sexe'] = 'F';
|
|
break;
|
|
case 'h':
|
|
$tabParticipants[$intCtr]['sexe'] = 'M';
|
|
break;
|
|
}
|
|
|
|
// BODY - PARTICIPANTS
|
|
|
|
$strColCancelled = '';
|
|
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strClass = ($intCtr & 1) ? '' : ' class="table-secondary"';
|
|
|
|
if (intval($tabParticipants[$intCtr]['is_cancelled']) == 1) {
|
|
$strClass = ' class="table-danger"';
|
|
$strColCancelled = 'ANNULÉE';
|
|
}
|
|
|
|
$strOutput .= '
|
|
<tr' . $strClass . '>
|
|
<td style="text-align: center;">' . ($intCtr + $intStart) . '</td>
|
|
';
|
|
for ($intCtrcol = 2; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
$mem_val = $tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
|
|
// valide email associe
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'par_courriel') {
|
|
if (trim($tabParticipants[$intCtr]['associe']) != '') {
|
|
$sqlClient = "SELECT com_courriel FROM inscriptions_comptes WHERE com_id = " . intval($tabParticipants[$intCtr]['associe']);
|
|
$nbClient = $objDatabase->fxGetRow($sqlClient);
|
|
|
|
$mem_val = $nbClient['com_courriel'];
|
|
}
|
|
}
|
|
// affiche si annulée
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'is_cancelled') {
|
|
$mem_val = $strColCancelled;
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td style="text-align: ' . $tabCol[$intCtrcol]['info_option3'] . ';">' . $mem_val . '</td>
|
|
';
|
|
}
|
|
// QUESTIONS
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
else
|
|
$strValue = ' ';
|
|
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']])) {
|
|
$mem_validation = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_validation'];
|
|
|
|
if (($mem_validation == "image" || $mem_validation == "pdf") && trim($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr']) != "") {
|
|
$strValue = $strValue . ' <a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/rapport_new?rep=' . $intEvenement . '&nom=' . $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr'] . '" target="_blank">télécharger</a>';
|
|
}
|
|
}
|
|
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']])) {
|
|
$mem_validation = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_validation'];
|
|
|
|
if (($mem_validation == "image" || $mem_validation == "pdf") && trim($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr']) != "") {
|
|
$strValue = $strValue . ' <a class="btn btn-primary rounded-pill btn-sm" href="' . $vDomaine . '/superadm/download.php?rep=' . $intEvenement . '&nom=' . $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_fr'] . '" target="_blank">télécharger</a>';
|
|
}
|
|
}
|
|
|
|
$strOutput .= '
|
|
<td>' . $strValue . '</td>
|
|
';
|
|
}
|
|
}
|
|
$strOutput .= '</tr>';
|
|
}
|
|
if ($typeoutput == 'excel') { // EXCEL ICI
|
|
|
|
|
|
if (intval($tabParticipants[$intCtr]['is_cancelled']) == 1) {
|
|
$strColCancelled = 'ANNULÉE';
|
|
}
|
|
$c = 'A';
|
|
|
|
if (!$blnCSV) {
|
|
|
|
|
|
$intCtrcol = 2;
|
|
} else {
|
|
$intCtrcol = 1;
|
|
}
|
|
|
|
for ($intCtrcol; $intCtrcol <= count($tabCol); $intCtrcol++) {
|
|
|
|
if ($blnSansAccents) {
|
|
$mem_result = ucwords(strtolower(fxRemoveAccents($tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']])));
|
|
} else {
|
|
$mem_result = $tabParticipants[$intCtr][$tabCol[$intCtrcol]['info_option2']];
|
|
}
|
|
|
|
// valide email associe
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'par_courriel') {
|
|
if (trim($tabParticipants[$intCtr]['associe']) != '') {
|
|
$sqlClient = "SELECT com_courriel FROM inscriptions_comptes WHERE com_id = " . intval($tabParticipants[$intCtr]['associe']);
|
|
$nbClient = $objDatabase->fxGetRow($sqlClient);
|
|
|
|
$mem_result = $nbClient['com_courriel'];
|
|
}
|
|
}
|
|
// affiche si annulée
|
|
if ($tabCol[$intCtrcol]['info_option2'] == 'is_cancelled') {
|
|
$mem_result = $strColCancelled;
|
|
}
|
|
|
|
$mem_align = $tabCol[$intCtrcol]['info_option3'];
|
|
|
|
|
|
$objPHPExcel->getActiveSheet()->setCellValue($c . $mem_ligne, ($mem_result));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal($mem_align);
|
|
|
|
++$c;
|
|
|
|
|
|
}
|
|
// QUESTIONS
|
|
|
|
if ($intNbQuestions > 0) {
|
|
for ($intCtr2 = 1; $intCtr2 <= $intNbQuestions; $intCtr2++) {
|
|
if ($blnSansAccents) {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = ucwords(strtolower(fxRemoveAccents($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue])));
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = ucwords(strtolower(fxRemoveAccents($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue])));
|
|
else
|
|
$strValue = '';
|
|
} else {
|
|
if (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']]) && isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][$tabParticipants[$intCtr]['par_id_original']][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
elseif (isset($tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]))
|
|
$strValue = $tabQuestions2[$tabParticipants[$intCtr]['pec_id']][0][$tabQuestions1[$intCtr2]['que_id']]['que_choix_' . $strLangue];
|
|
else
|
|
$strValue = '';
|
|
}
|
|
$objPHPExcel->getActiveSheet()->setCellValueExplicit($c . $mem_ligne, ($strValue));
|
|
$objPHPExcel->getActiveSheet()->getstyle($c . $mem_ligne)->getAlignment()->setHorizontal('left');
|
|
++$c;
|
|
|
|
}
|
|
}
|
|
|
|
$mem_ligne = $mem_ligne + 1;
|
|
}
|
|
}
|
|
} else {
|
|
if ($typeoutput == 'html') { //HTML ICI
|
|
$strOutput .= fxShowRapportEmpty($strLangue);
|
|
}
|
|
}
|
|
|
|
if ($typeoutput == 'html') { // HTML ICI
|
|
$strOutput .= fxShowRapportFooter($arrBoutonExcel);
|
|
}
|
|
|
|
|
|
break;
|
|
}
|
|
|
|
if ($typeoutput == 'html') {
|
|
if ($blnPager && intval($intNbTotal) > $intNbParPage) {
|
|
// afficher pagination
|
|
$tabQuery = $_GET;
|
|
unset($tabQuery['pg']);
|
|
$strQuery = http_build_query($tabQuery, '', '&');
|
|
|
|
$strOutput .= fxShowPaging($vDomaine . '/superadm/rapport_new.php?' . $strQuery, $intNbTotal, $intNbParPage, $intPage);
|
|
}
|
|
//echo $strOutput;
|
|
|
|
|
|
echobig($strOutput);
|
|
//$output = ob_get_contents();
|
|
//ob_end_clean();
|
|
|
|
$strEndTime = microtime(true);
|
|
$strRunTime = $strEndTime - $strStartTime;
|
|
|
|
echo /*$output . */ '<br>' . $strRunTime . '<br>';
|
|
}
|
|
|
|
if ($typeoutput == 'pdf') {
|
|
|
|
if ($GLOBALS["mem_groupe_field_oui"] == 'true') {
|
|
foreach ($header_pdf as $key => $value) {
|
|
if ($tabCol[$mem_groupe_field]['info_texte'] == $value) {
|
|
$GLOBALS["mem_groupe_fieldnew"] = $key;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
$GLOBALS["mem_sous_groupe"] = $data_pdf[1][$GLOBALS["mem_groupe_fieldnew"]];
|
|
// echo($GLOBALS["mem_sous_groupe"]);
|
|
// print("<pre>".print_r($data_pdf,true)."</pre>") ;
|
|
// // print("<pre>".print_r($header_pdf,true)."</pre>") ;
|
|
// print("<pre>".print_r($tabCol,true)."</pre>") ;
|
|
// exit;
|
|
|
|
}
|
|
$pdf->AddPage();
|
|
$GLOBALS["mem_width_pdf"] = $width_pdf;
|
|
$GLOBALS["mem_header_pdf"] = $header_pdf;
|
|
$pdf->FancyTable($header_pdf, $data_pdf, $width_pdf);
|
|
|
|
|
|
$pdf->Output('D', 'RapportPDF.pdf');
|
|
echo('fin pdf');
|
|
exit;
|
|
|
|
}
|
|
if ($typeoutput == 'excel') {
|
|
|
|
|
|
// EXCEL ICI
|
|
// Rename worksheet
|
|
$objPHPExcel->getActiveSheet()->setTitle($strReport);
|
|
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
|
$objPHPExcel->setActiveSheetIndex(0);
|
|
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
|
// Save Excel 2007 file
|
|
$mem_file_location = $_SERVER['DOCUMENT_ROOT'] . '/data/' . $memexcfichier . '.xls';
|
|
$mem_file = $memexcfichier . '.xls';
|
|
$objWriter->save($mem_file_location);
|
|
|
|
if ($blnCSV) {
|
|
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
|
$objWriter->save($mem_file_location);
|
|
|
|
$reader = PHPExcel_IOFactory::createReader('Excel5');
|
|
$reader->setReadDataOnly(false);
|
|
|
|
$path = $_SERVER['DOCUMENT_ROOT'] . '/data/' . $memexcfichier . '.xls';
|
|
$excel = $reader->load($path);
|
|
|
|
$objWriter = PHPExcel_IOFactory::createWriter($excel, 'CSV');
|
|
$mem_file_location = $_SERVER['DOCUMENT_ROOT'] . '/data/' . $memexcfichier . '.csv';
|
|
$mem_file = $memexcfichier . '.csv';
|
|
$objWriter->setUseBOM(true);
|
|
$objWriter->save($mem_file_location);
|
|
}
|
|
|
|
$memurl = "?fl=" . $mem_file_location . "&f=" . $mem_file;
|
|
|
|
header('location: ../php/download.php' . $memurl);
|
|
}
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
function fxShowRapportHeader($strTitreRapport, $strNomEvenement, $arrBoutonExcel)
|
|
{
|
|
$strOutput = '
|
|
<h1>
|
|
' . $strTitreRapport . '
|
|
<small>' . $strNomEvenement . '</small>
|
|
</h1>
|
|
';
|
|
|
|
$strOutput .= fxShowRapportButtons('_top', $arrBoutonExcel, 1);
|
|
|
|
$strOutput .= '
|
|
<div class="tableresponsive">
|
|
<table class="table">
|
|
';
|
|
|
|
return $strOutput;
|
|
}
|
|
|
|
function fxShowRapportFooter($arrBoutonExcel)
|
|
{
|
|
$strOutput = '
|
|
</table>
|
|
</div>
|
|
';
|
|
|
|
$strOutput .= fxShowRapportButtons('_bot', $arrBoutonExcel, 0);
|
|
|
|
return $strOutput;
|
|
}
|
|
|
|
function fxShowRapportButtons($strSuffix, $arrBoutonExcel, $top = 1)
|
|
{
|
|
global $vDomaine;
|
|
$strOutput = '';
|
|
if ($top == 1) {
|
|
$strOutput = '
|
|
|
|
<form action="' . $vDomaine . '/superadm/rapport_new.php? ' . $_SERVER['QUERY_STRING'] . '" method="post">
|
|
';
|
|
}
|
|
$strOutput .= '
|
|
<div class="buttons my-3">
|
|
';
|
|
|
|
foreach ($arrBoutonExcel as $index => $button) {
|
|
$strOutput .= '
|
|
<button type="submit" class="btn btn-light rounded-0" id="btn_' . $button[0] . $strSuffix . '" name="btn_' . $button[0] . $strSuffix . '">
|
|
<img width="16" class="mr-2" src="' . $vDomaine . '/superadm/images/' . $button[2] . '" alt="">
|
|
' . $button[1] . '
|
|
</button>
|
|
';
|
|
}
|
|
|
|
$strOutput .= '
|
|
|
|
|
|
</div>
|
|
';
|
|
if ($top != 1) {
|
|
$strOutput .= '
|
|
</form>
|
|
|
|
';
|
|
}
|
|
return $strOutput;
|
|
}
|
|
|
|
function fxShowRapportEmpty($strLangue)
|
|
{
|
|
$strOutput = '';
|
|
|
|
if ($strLangue == 'fr') {
|
|
$strMessage = "Il n'y a aucun résultat.";
|
|
} else {
|
|
$strMessage = "There is no result.";
|
|
}
|
|
$strOutput .= '
|
|
<tr class="py-5 table-secondary">
|
|
<td>
|
|
<strong>' . $strMessage . '</strong>
|
|
</td>
|
|
</tr>
|
|
';
|
|
|
|
return $strOutput;
|
|
}
|
|
|
|
function fxShowFormSearch($intEvenement, $strReport, $tabData, $strLangue)
|
|
{
|
|
global $vDomaine, $objDatabase;
|
|
|
|
switch ($strReport) {
|
|
case 'chrono':
|
|
$sqlCategories = "SELECT DISTINCT epr_categorie_$strLangue FROM inscriptions_epreuves WHERE eve_id = " . intval($intEvenement) . " ORDER BY tep_id, epr_categorie_$strLangue +0";
|
|
$arrCategories = $objDatabase->fxGetResults($sqlCategories);
|
|
|
|
$sqlTypes = "SELECT DISTINCT epr_type_$strLangue FROM inscriptions_epreuves WHERE eve_id = " . intval($intEvenement) . " ORDER BY tep_id, epr_type_$strLangue +0";
|
|
$arrTypes = $objDatabase->fxGetResults($sqlTypes);
|
|
|
|
$sqlNoms = "SELECT DISTINCT epr_nom_$strLangue FROM inscriptions_epreuves WHERE eve_id = " . intval($intEvenement) . " ORDER BY tep_id, epr_nom_$strLangue +0";
|
|
$arrNoms = $objDatabase->fxGetResults($sqlNoms);
|
|
?>
|
|
<h1>
|
|
<?php
|
|
if ($strLangue == 'fr')
|
|
echo "Rechercher";
|
|
else
|
|
echo "Search";
|
|
?>
|
|
</h1>
|
|
<form action="<?php echo $vDomaine; ?>/superadm/rapport_new.php" method="get" id="frm_search"
|
|
name="frm_search">
|
|
<div class="error"></div>
|
|
<fieldset>
|
|
<input type="hidden" name="e" value="<?php echo urlencode(base64_encode($intEvenement)); ?>">
|
|
<input type="hidden" name="r" value="<?php echo $strReport; ?>">
|
|
<input type="hidden" name="lng" value="<?php echo $strLangue; ?>">
|
|
<?php /* <label for="ach_maj" class="form">Date achat :</label>
|
|
<label class="form_nw">de</label>
|
|
<input type="text" id="date_inscription_from" name="date_inscription_from" size="20" maxlength="20" value="<?php if (isset($tabData['date_inscription_from'])) { echo $tabData['date_inscription_from']; } ?>">
|
|
<label class="form_nw">à</label>
|
|
<input type="text" id="date_inscription_to" name="date_inscription_to" size="20" maxlength="20" value="<?php if (isset($tabData['date_inscription_to'])) { echo $tabData['date_inscription_to']; } ?>">
|
|
<br> */ ?>
|
|
<div class="form-group row">
|
|
<label for="pec_maj"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Date d'achat"; else echo "Order date"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7 no-gutters">
|
|
<label class="col-control-label col"
|
|
for="pec_maj_from"><?php if ($strLangue == 'fr') { ?>de<?php } else { ?>from<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='pec_maj_from_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="pec_maj_from"
|
|
name="pec_maj_from"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['pec_maj_from'])) { ?> value="<?php echo $_GET['pec_maj_from']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#pec_maj_from_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="col-control-label col"
|
|
for="pec_maj_to"><?php if ($strLangue == 'fr') { ?>à<?php } else { ?>to<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='pec_maj_to_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="pec_maj_to" name="pec_maj_to"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['pec_maj_to'])) { ?> value="<?php echo $_GET['pec_maj_to']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#pec_maj_to_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="no_panier" class="col-control-label col-sm-3">No bib:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="no_bib" name="p-no_bib" size="20"
|
|
maxlength="20" value="<?php if (isset($tabData['p-no_bib'])) {
|
|
echo $tabData['p-no_bib'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="no_commande" class="col-control-label col-sm-3">No commande :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="no_commande" name="ec-no_commande"
|
|
size="20" maxlength="20" value="<?php if (isset($tabData['ec-no_commande'])) {
|
|
echo $tabData['ec-no_commande'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="firstname" class="col-control-label col-sm-3">firstname :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="firstname" name="p-par_prenom"
|
|
size="30" maxlength="50" value="<?php if (isset($tabData['p-par_prenom'])) {
|
|
echo $tabData['p-par_prenom'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="lastname" class="col-control-label col-sm-3">lastname :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="lastname" name="p-par_nom" size="30"
|
|
maxlength="50" value="<?php if (isset($tabData['p-par_nom'])) {
|
|
echo $tabData['p-par_nom'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="rol_id" class="col-control-label col-sm-3">Role :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0" id="rol_id" name="p-rol_id">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['p-rol_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<option value="1"<?php if (isset($_GET['btn_search']) && $_GET['p-rol_id'] == 1) { ?> selected="selected"<?php } ?>>
|
|
Capitaines seulement
|
|
</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="tep_id" class="col-control-label col-sm-3">Type:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0" id="tep_id" name="e-tep_id">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['e-tep_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<option value="1"<?php if (isset($_GET['btn_search']) && $_GET['e-tep_id'] == 1) { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Course normale"; else echo "Standard race"; ?></option>
|
|
<option value="2"<?php if (isset($_GET['btn_search']) && $_GET['e-tep_id'] == 2) { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Bénévoles"; else echo "Volunteers"; ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="categorie"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Catégorie"; else echo "Category"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0 selectpicker" id="categorie"
|
|
name="e-epr_categorie_<?php echo $strLangue; ?>[]" multiple>
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['e-epr_categorie_' . $strLangue] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($arrCategories); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo($arrCategories[$intCtr]['epr_categorie_' . $strLangue]); ?>"<?php if (isset($tabData['e-epr_categorie_' . $strLangue]) && in_array($arrCategories[$intCtr]['epr_categorie_' . $strLangue], $tabData['e-epr_categorie_' . $strLangue])) { ?> selected="selected"<?php } ?>><?php echo $arrCategories[$intCtr]['epr_categorie_' . $strLangue]; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="type"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Épreuve"; else echo "Race"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0 selectpicker" id="type"
|
|
name="e-epr_type_<?php echo $strLangue; ?>[]" multiple>
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['e-epr_type_' . $strLangue] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($arrTypes); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo($arrTypes[$intCtr]['epr_type_' . $strLangue]); ?>"<?php if (isset($tabData['e-epr_type_' . $strLangue]) && in_array($arrTypes[$intCtr]['epr_type_' . $strLangue], $tabData['e-epr_type_' . $strLangue])) { ?> selected="selected"<?php } ?>><?php echo $arrTypes[$intCtr]['epr_type_' . $strLangue]; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="details"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Détails"; else echo "Details"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0 selectpicker" id="details"
|
|
name="e-epr_nom_<?php echo $strLangue; ?>[]" multiple>
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['e-epr_nom_' . $strLangue] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($arrNoms); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo($arrNoms[$intCtr]['epr_nom_' . $strLangue]); ?>"<?php if (isset($tabData['e-epr_nom_' . $strLangue]) && in_array($arrNoms[$intCtr]['epr_nom_' . $strLangue], $tabData['e-epr_nom_' . $strLangue])) { ?> selected="selected"<?php } ?>><?php echo $arrNoms[$intCtr]['epr_nom_' . $strLangue]; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<div class="form-group row">
|
|
<div class="offset-sm-3 col-sm-9 col-lg-7">
|
|
<button type="submit" class="btn btn-primary rounded-0" id="btn_search" name="btn_search"><i
|
|
class="fa fa-search"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Trouver"; else echo "Find"; ?>
|
|
</button>
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
?>
|
|
<button type="button" class="btn btn-danger rounded-0" id="btn_clear_search"
|
|
name="btn_clear_search"><i class="fa fa-times"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Effacer recherche"; else echo "Clear search"; ?>
|
|
</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<br>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
$().ready(function () {
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
$strLinkRetour = $vDomaine . '/superadm/rapport_new.php?e=' . urlencode(base64_encode($intEvenement)) . '&r=' . $strReport . '&lng=' . $strLangue;
|
|
?>
|
|
$('#btn_clear_search').click(function () {
|
|
document.location.href = '<?php echo $strLinkRetour; ?>';
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$('#pec_maj_from_cal').datetimepicker({
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
locale: '<?php echo $strLangue; ?>-ca',
|
|
sideBySide: true
|
|
});
|
|
$('#pec_maj_to_cal').datetimepicker({
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
locale: '<?php echo $strLangue; ?>-ca',
|
|
sideBySide: true,
|
|
useCurrent: false
|
|
});
|
|
$("#pec_maj_from_cal").on("dp.change", function (e) {
|
|
$('#pec_maj_to_cal').data("DateTimePicker").minDate(e.date);
|
|
});
|
|
$("#pec_maj_to_cal").on("dp.change", function (e) {
|
|
$('#pec_maj_from_cal').data("DateTimePicker").maxDate(e.date);
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
break;
|
|
case 'finances':
|
|
case 'finances-pnq':
|
|
case 'finances-membership':
|
|
?>
|
|
<h1>
|
|
<?php
|
|
if ($strLangue == 'fr')
|
|
echo "Rechercher";
|
|
else
|
|
echo "Search";
|
|
?>
|
|
</h1>
|
|
<form action="<?php echo $vDomaine; ?>/superadm/rapport_new.php" class="form-horizontal" method="get"
|
|
id="frm_search" name="frm_search">
|
|
<div class="error"></div>
|
|
<fieldset>
|
|
<input type="hidden" name="e" value="<?php echo urlencode(base64_encode($intEvenement)); ?>">
|
|
<input type="hidden" name="r" value="<?php echo $strReport; ?>">
|
|
<input type="hidden" name="lng" value="<?php echo $strLangue; ?>">
|
|
<div class="form-group row">
|
|
<label for="ach_maj"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Date d'achat"; else echo "Order date"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7 no-gutters">
|
|
<label class="col-control-label col"
|
|
for="ach_maj_from"><?php if ($strLangue == 'fr') { ?>de<?php } else { ?>from<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_from_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_from"
|
|
name="a-ach_maj_from"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_from'])) { ?> value="<?php echo $_GET['a-ach_maj_from']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_from_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="col-control-label col"
|
|
for="ach_maj_to"><?php if ($strLangue == 'fr') { ?>à<?php } else { ?>to<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_to_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_to"
|
|
name="a-ach_maj_to"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_to'])) { ?> value="<?php echo $_GET['a-ach_maj_to']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_to_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="no_panier"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "No panier"; else echo "Cart #"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="no_panier" name="a-no_panier"
|
|
size="20" maxlength="20" value="<?php if (isset($tabData['a-no_panier'])) {
|
|
echo $tabData['a-no_panier'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="no_commande"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "No commande"; else echo "Order #"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="no_commande" name="a-no_commande"
|
|
size="20" maxlength="20" value="<?php if (isset($tabData['a-no_commande'])) {
|
|
echo $tabData['a-no_commande'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="firstname"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Prénom (acheteur)"; else echo "First name (buyer)"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="firstname" name="a-com_prenom"
|
|
size="30" maxlength="50" value="<?php if (isset($tabData['a-com_prenom'])) {
|
|
echo $tabData['a-com_prenom'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="lastname"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Nom de famille (acheteur)"; else echo "Last name (buyer)"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="lastname" name="a-com_nom" size="30"
|
|
maxlength="50" value="<?php if (isset($tabData['a-com_nom'])) {
|
|
echo $tabData['a-com_nom'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="TransactionID" class="col-control-label col-sm-3">TransactionID:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="TransactionID" name="a-TransactionID"
|
|
size="20" maxlength="20" value="<?php if (isset($tabData['a-TransactionID'])) {
|
|
echo $tabData['a-TransactionID'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<?php /* <div class="form-group row">
|
|
<label for="tep_id" class="col-control-label col-sm-3">Type:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0" id="tep_id" name="e-tep_id">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['e-tep_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>Tous les résultats</option>
|
|
<option value="1"<?php if (isset($_GET['btn_search']) && $_GET['e-tep_id'] == 1) { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Course normale"; else echo "Standard race"; ?></option>
|
|
<option value="2"<?php if (isset($_GET['btn_search']) && $_GET['e-tep_id'] == 2) { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Bénévoles"; else echo "Volunteers"; ?></option>
|
|
</select>
|
|
</div>
|
|
</div> */ ?>
|
|
<div class="form-group row">
|
|
<label for="ach_lang"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Langue de transaction"; else echo "Transaction language"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0" id="ach_lang" name="a-ach_lang">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['a-ach_lang'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Toutes"; else echo "Any"; ?></option>
|
|
<option value="en"<?php if (isset($_GET['btn_search']) && $_GET['a-ach_lang'] == 'en') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Anglais"; else echo "Engiish"; ?></option>
|
|
<option value="fr"<?php if (isset($_GET['btn_search']) && $_GET['a-ach_lang'] == 'fr') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Français"; else echo "French"; ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<div class="form-group row">
|
|
<div class="offset-sm-3 col-sm-9 col-lg-7">
|
|
<button class="btn btn-primary rounded-0" type="submit" id="btn_search" name="btn_search"><i
|
|
class="fa fa-search"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Trouver"; else echo "Find"; ?>
|
|
</button>
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
?>
|
|
<button type="button" class="btn btn-danger rounded-0" id="btn_clear_search"
|
|
name="btn_clear_search"><i class="fa fa-times"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Effacer recherche"; else echo "Clear search"; ?>
|
|
</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
$().ready(function () {
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
$strLinkRetour = $vDomaine . '/superadm/rapport_new.php?e=' . urlencode(base64_encode($intEvenement)) . '&r=' . $strReport . '&lng=' . $strLangue;
|
|
?>
|
|
$('#btn_clear_search').click(function () {
|
|
document.location.href = '<?php echo $strLinkRetour; ?>';
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$('#ach_maj_from_cal,#ach_maj_to_cal').datetimepicker({
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
locale: '<?php echo $strLangue; ?>-ca',
|
|
sideBySide: true
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
break;
|
|
case 'finances-membership-promoteur':
|
|
case 'finances-membership-tq':
|
|
case 'finances-membership-autre':
|
|
?>
|
|
<h1>
|
|
<?php
|
|
if ($strLangue == 'fr')
|
|
echo "Rechercher";
|
|
else
|
|
echo "Search";
|
|
?>
|
|
</h1>
|
|
<form action="<?php echo $vDomaine; ?>/superadm/rapport_new.php" class="form-horizontal" method="get"
|
|
id="frm_search" name="frm_search">
|
|
<div class="error"></div>
|
|
<fieldset>
|
|
<input type="hidden" name="e" value="<?php echo urlencode(base64_encode($intEvenement)); ?>">
|
|
<input type="hidden" name="r" value="<?php echo $strReport; ?>">
|
|
<input type="hidden" name="lng" value="<?php echo $strLangue; ?>">
|
|
<div class="form-group row">
|
|
<label for="ach_maj"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Date d'achat"; else echo "Order date"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7 no-gutters">
|
|
<label class="col-control-label col"
|
|
for="ach_maj_from"><?php if ($strLangue == 'fr') { ?>de<?php } else { ?>from<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_from_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_from"
|
|
name="a-ach_maj_from"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_from'])) { ?> value="<?php echo $_GET['a-ach_maj_from']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_from_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="col-control-label col"
|
|
for="ach_maj_to"><?php if ($strLangue == 'fr') { ?>à<?php } else { ?>to<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_to_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_to"
|
|
name="a-ach_maj_to"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_to'])) { ?> value="<?php echo $_GET['a-ach_maj_to']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_to_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="no_panier"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "No panier"; else echo "Cart #"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="no_panier" name="a-no_panier"
|
|
size="20" maxlength="20" value="<?php if (isset($tabData['a-no_panier'])) {
|
|
echo $tabData['a-no_panier'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="no_commande"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "No commande"; else echo "Order #"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="no_commande" name="a-no_commande"
|
|
size="20" maxlength="20" value="<?php if (isset($tabData['a-no_commande'])) {
|
|
echo $tabData['a-no_commande'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="firstname"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Prénom (acheteur)"; else echo "First name (buyer)"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="firstname" name="a-com_prenom"
|
|
size="30" maxlength="50" value="<?php if (isset($tabData['a-com_prenom'])) {
|
|
echo $tabData['a-com_prenom'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="lastname"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Nom de famille (acheteur)"; else echo "Last name (buyer)"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="lastname" name="a-com_nom" size="30"
|
|
maxlength="50" value="<?php if (isset($tabData['a-com_nom'])) {
|
|
echo $tabData['a-com_nom'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="TransactionID" class="col-control-label col-sm-3">TransactionID:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="TransactionID" name="a-TransactionID"
|
|
size="20" maxlength="20" value="<?php if (isset($tabData['a-TransactionID'])) {
|
|
echo $tabData['a-TransactionID'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<?php /* <div class="form-group row">
|
|
<label for="tep_id" class="col-control-label col-sm-3">Type:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0" id="tep_id" name="e-tep_id">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['e-tep_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>Tous les résultats</option>
|
|
<option value="1"<?php if (isset($_GET['btn_search']) && $_GET['e-tep_id'] == 1) { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Course normale"; else echo "Standard race"; ?></option>
|
|
<option value="2"<?php if (isset($_GET['btn_search']) && $_GET['e-tep_id'] == 2) { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Bénévoles"; else echo "Volunteers"; ?></option>
|
|
</select>
|
|
</div>
|
|
</div> */ ?>
|
|
<div class="form-group row">
|
|
<label for="ach_lang"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Langue de transaction"; else echo "Transaction language"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0" id="ach_lang" name="a-ach_lang">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['a-ach_lang'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Toutes"; else echo "Any"; ?></option>
|
|
<option value="en"<?php if (isset($_GET['btn_search']) && $_GET['a-ach_lang'] == 'en') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Anglais"; else echo "Engiish"; ?></option>
|
|
<option value="fr"<?php if (isset($_GET['btn_search']) && $_GET['a-ach_lang'] == 'fr') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Français"; else echo "French"; ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<div class="form-group row">
|
|
<div class="offset-sm-3 col-sm-9 col-lg-7">
|
|
<button class="btn btn-primary rounded-0" type="submit" id="btn_search" name="btn_search"><i
|
|
class="fa fa-search"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Trouver"; else echo "Find"; ?>
|
|
</button>
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
?>
|
|
<button type="button" class="btn btn-danger rounded-0" id="btn_clear_search"
|
|
name="btn_clear_search"><i class="fa fa-times"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Effacer recherche"; else echo "Clear search"; ?>
|
|
</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
$().ready(function () {
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
$strLinkRetour = $vDomaine . '/superadm/rapport_new.php?e=' . urlencode(base64_encode($intEvenement)) . '&r=' . $strReport . '&lng=' . $strLangue;
|
|
?>
|
|
$('#btn_clear_search').click(function () {
|
|
document.location.href = '<?php echo $strLinkRetour; ?>';
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$('#ach_maj_from_cal,#ach_maj_to_cal').datetimepicker({
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
locale: '<?php echo $strLangue; ?>-ca',
|
|
sideBySide: true
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
break;
|
|
case 'remboursements':
|
|
?>
|
|
<h1>
|
|
<?php
|
|
if ($strLangue == 'fr')
|
|
echo "Rechercher";
|
|
else
|
|
echo "Search";
|
|
?>
|
|
</h1>
|
|
<form action="<?php echo $vDomaine; ?>/superadm/rapport_new.php" class="form-horizontal" method="get"
|
|
id="frm_search" name="frm_search">
|
|
<div class="error"></div>
|
|
<fieldset>
|
|
<input type="hidden" name="e" value="<?php echo urlencode(base64_encode($intEvenement)); ?>">
|
|
<input type="hidden" name="r" value="<?php echo $strReport; ?>">
|
|
<input type="hidden" name="lng" value="<?php echo $strLangue; ?>">
|
|
<div class="form-group row">
|
|
<label for="ach_maj"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Date d'achat"; else echo "Order date"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7 no-gutters">
|
|
<label class="col-control-label col"
|
|
for="ach_maj_from"><?php if ($strLangue == 'fr') { ?>de<?php } else { ?>from<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_from_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_from"
|
|
name="a-ach_maj_from"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_from'])) { ?> value="<?php echo $_GET['a-ach_maj_from']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_from_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="col-control-label col"
|
|
for="ach_maj_to"><?php if ($strLangue == 'fr') { ?>à<?php } else { ?>to<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_to_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_to"
|
|
name="a-ach_maj_to"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_to'])) { ?> value="<?php echo $_GET['a-ach_maj_to']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_to_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="tr_id" class="col-control-label col-sm-3">Type:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0" id="tr_id" name="r-tr_id">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['r-tr_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<option value="0"<?php if (isset($_GET['btn_search']) && $_GET['r-tr_id'] == '0') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Montant promoteur"; else echo "Montant promoteur"; ?></option>
|
|
<option value="1"<?php if (isset($_GET['btn_search']) && $_GET['r-tr_id'] == '1') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Paiement"; else echo "Paiement"; ?></option>
|
|
<option value="2"<?php if (isset($_GET['btn_search']) && $_GET['r-tr_id'] == '2') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Remboursement"; else echo "Remboursement"; ?></option>
|
|
<option value="1-2"<?php if (isset($_GET['btn_search']) && $_GET['r-tr_id'] == '1-2') { ?> selected="selected"<?php } ?>><?php if ($strLangue == 'fr') echo "Paiement et Remboursement"; else echo "Paiement et Remboursement"; ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<div class="form-group row">
|
|
<div class="offset-sm-3 col-sm-9 col-lg-7">
|
|
<button class="btn btn-primary rounded-0" type="submit" id="btn_search" name="btn_search"><i
|
|
class="fa fa-search"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Trouver"; else echo "Find"; ?>
|
|
</button>
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
?>
|
|
<button type="button" class="btn btn-danger rounded-0" id="btn_clear_search"
|
|
name="btn_clear_search"><i class="fa fa-times"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Effacer recherche"; else echo "Clear search"; ?>
|
|
</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
$().ready(function () {
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
$strLinkRetour = $vDomaine . '/superadm/rapport_new.php?e=' . urlencode(base64_encode($intEvenement)) . '&r=' . $strReport . '&lng=' . $strLangue;
|
|
?>
|
|
$('#btn_clear_search').click(function () {
|
|
document.location.href = '<?php echo $strLinkRetour; ?>';
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$('#ach_maj_from_cal,#ach_maj_to_cal').datetimepicker({
|
|
format: 'YYYY-MM-DD',
|
|
locale: '<?php echo $strLangue; ?>-ca'
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
break;
|
|
case 'remboursements-bilan':
|
|
?>
|
|
<h1>
|
|
<?php
|
|
if ($strLangue == 'fr')
|
|
echo "Rechercher";
|
|
else
|
|
echo "Search";
|
|
?>
|
|
</h1>
|
|
<form action="<?php echo $vDomaine; ?>/superadm/rapport_new.php" class="form-horizontal" method="get"
|
|
id="frm_search" name="frm_search">
|
|
<div class="error"></div>
|
|
<fieldset>
|
|
<input type="hidden" name="e" value="<?php echo urlencode(base64_encode($intEvenement)); ?>">
|
|
<input type="hidden" name="r" value="<?php echo $strReport; ?>">
|
|
<input type="hidden" name="lng" value="<?php echo $strLangue; ?>">
|
|
<div class="form-group row">
|
|
<label for="ach_maj"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Date d'achat"; else echo "Order date"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7 no-gutters">
|
|
<label class="col-control-label col"
|
|
for="ach_maj_from"><?php if ($strLangue == 'fr') { ?>de<?php } else { ?>from<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_from_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_from"
|
|
name="a-ach_maj_from"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_from'])) { ?> value="<?php echo $_GET['a-ach_maj_from']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_from_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="col-control-label col"
|
|
for="ach_maj_to"><?php if ($strLangue == 'fr') { ?>à<?php } else { ?>to<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_to_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_to"
|
|
name="a-ach_maj_to"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_to'])) { ?> value="<?php echo $_GET['a-ach_maj_to']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_to_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<div class="form-group row">
|
|
<div class="offset-sm-3 col-sm-9 col-lg-7">
|
|
<button class="btn btn-primary rounded-0" type="submit" id="btn_search" name="btn_search"><i
|
|
class="fa fa-search"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Trouver"; else echo "Find"; ?>
|
|
</button>
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
?>
|
|
<button type="button" class="btn btn-danger rounded-0" id="btn_clear_search"
|
|
name="btn_clear_search"><i class="fa fa-times"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Effacer recherche"; else echo "Clear search"; ?>
|
|
</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
$().ready(function () {
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
$strLinkRetour = $vDomaine . '/superadm/rapport_new.php?r=' . $strReport . '&lng=' . $strLangue;
|
|
?>
|
|
$('#btn_clear_search').click(function () {
|
|
document.location.href = '<?php echo $strLinkRetour; ?>';
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$('#ach_maj_from_cal,#ach_maj_to_cal').datetimepicker({
|
|
format: 'YYYY-MM-DD',
|
|
locale: '<?php echo $strLangue; ?>-ca'
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
break;
|
|
case 'adhesions':
|
|
case 'adhesions-ventes':
|
|
$sqlTypes = "SELECT mt_id, mt_nom_$strLangue FROM memberships_types WHERE FIND_IN_SET(" . intval($intEvenement) . ", eve_id) AND mt_actif = 1 ORDER BY mt_nom_$strLangue";
|
|
$arrTypes = $objDatabase->fxGetResults($sqlTypes);
|
|
|
|
$sqlSousTypes = "SELECT mst_id, mst_nom_$strLangue FROM memberships_sous_types WHERE mst_actif = 1 ORDER BY mst_nom_$strLangue";
|
|
$arrSousTypes = $objDatabase->fxGetResults($sqlSousTypes);
|
|
|
|
$sqlCategories = "SELECT DISTINCT epr_categorie_$strLangue FROM inscriptions_epreuves WHERE eve_id = " . intval($intEvenement) . " ORDER BY tep_id, epr_categorie_$strLangue +0";
|
|
$arrCategories = $objDatabase->fxGetResults($sqlCategories);
|
|
|
|
$sqlCategories2 = "SELECT DISTINCT epr_type_$strLangue FROM inscriptions_epreuves WHERE eve_id = " . intval($intEvenement) . " ORDER BY tep_id, epr_type_$strLangue +0";
|
|
$arrCategories2 = $objDatabase->fxGetResults($sqlCategories2);
|
|
?>
|
|
<h1>
|
|
<?php
|
|
if ($strLangue == 'fr')
|
|
echo "Rechercher";
|
|
else
|
|
echo "Search";
|
|
?>
|
|
</h1>
|
|
<form action="<?php echo $vDomaine; ?>/superadm/rapport_new.php" class="form-horizontal" method="get"
|
|
id="frm_search" name="frm_search">
|
|
<div class="error"></div>
|
|
<fieldset>
|
|
<input type="hidden" name="e" value="<?php echo urlencode(base64_encode($intEvenement)); ?>">
|
|
<input type="hidden" name="r" value="<?php echo $strReport; ?>">
|
|
<input type="hidden" name="lng" value="<?php echo $strLangue; ?>">
|
|
<div class="form-group row">
|
|
<label for="no_commande" class="col-control-label col-sm-3">No commande :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="no_commande" name="ec-no_commande"
|
|
size="20" maxlength="20" value="<?php if (isset($tabData['ec-no_commande'])) {
|
|
echo $tabData['ec-no_commande'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="firstname" class="col-control-label col-sm-3">Prénom :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="firstname" name="p-par_prenom"
|
|
size="30" maxlength="50" value="<?php if (isset($tabData['p-par_prenom'])) {
|
|
echo $tabData['p-par_prenom'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="lastname" class="col-control-label col-sm-3">Nom :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="lastname" name="p-par_nom" size="30"
|
|
maxlength="50" value="<?php if (isset($tabData['p-par_nom'])) {
|
|
echo $tabData['p-par_nom'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="mem_numero" class="col-control-label col-sm-3">No membre :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input class="form-control rounded-0" type="text" id="mem_numero" name="m-mem_numero"
|
|
value="<?php if (isset($tabData['m-mem_numero'])) {
|
|
echo $tabData['m-mem_numero'];
|
|
} ?>">
|
|
</div>
|
|
</div>
|
|
<?php
|
|
//if ($strReport == 'adhesions-ventes') {
|
|
?>
|
|
<div class="form-group row">
|
|
<label for="ach_maj"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Date d'achat"; else echo "Order date"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7 no-gutters">
|
|
<label class="col-control-label col"
|
|
for="ach_maj_from"><?php if ($strLangue == 'fr') { ?>de<?php } else { ?>from<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_from_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_from"
|
|
name="a-ach_maj_from"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_from'])) { ?> value="<?php echo $_GET['a-ach_maj_from']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_from_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="col-control-label col"
|
|
for="ach_maj_to"><?php if ($strLangue == 'fr') { ?>à<?php } else { ?>to<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='ach_maj_to_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="ach_maj_to"
|
|
name="a-ach_maj_to"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['a-ach_maj_to'])) { ?> value="<?php echo $_GET['a-ach_maj_to']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#ach_maj_to_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
//} else {
|
|
?>
|
|
<div class="form-group row">
|
|
<label for="ach_maj"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Date valide"; else echo "Valid date"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7 no-gutters">
|
|
<label class="col-control-label col"
|
|
id="mem_date_debut"><?php if ($strLangue == 'fr') { ?>de<?php } else { ?>from<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='mem_date_debut_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="mem_date_debut"
|
|
name="mem_date_debut"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['mem_date_debut'])) { ?> value="<?php echo $_GET['mem_date_debut']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#mem_date_debut_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="col-control-label col"
|
|
id="mem_date_fin"><?php if ($strLangue == 'fr') { ?>à<?php } else { ?>to<?php } ?></label>
|
|
<div class="col">
|
|
<div class="input-group" id='mem_date_fin_cal' data-target-input="nearest">
|
|
<input class="form-control rounded-0" type="text" id="mem_date_fin"
|
|
name="mem_date_fin"
|
|
maxlength="10"<?php if (isset($_GET['btn_search']) && isset($_GET['mem_date_fin'])) { ?> value="<?php echo $_GET['mem_date_fin']; ?>" <?php } ?>>
|
|
<div class="input-group-append rounded-0" data-target="#mem_date_fin_cal"
|
|
data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
//}
|
|
?>
|
|
<div class="form-group row">
|
|
<label for="type"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Type d'adhésion"; else echo "Membership type"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0 selectpicker" id="type" name="m-mt_id[]" multiple>
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['m-mt_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<?php
|
|
if ((isset($_GET['btn_search']) && $_GET['m-mt_id'] != '')) {
|
|
$arrTypesSearched = $_GET['m-mt_id'];
|
|
}
|
|
for ($intCtr = 1; $intCtr <= count($arrTypes); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo($arrTypes[$intCtr]['mt_id']); ?>"<?php if (isset($arrTypesSearched) && in_array(intval($arrTypes[$intCtr]['mt_id']), $arrTypesSearched)) { ?> selected="selected"<?php } ?>><?php echo $arrTypes[$intCtr]['mt_nom_' . $strLangue]; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="stype"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Sous sype d'adhésion"; else echo "Membership subtype"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0 selectpicker" id="stype" name="m-mst_id">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['m-mst_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($arrSousTypes); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo($arrSousTypes[$intCtr]['mst_id']); ?>"<?php if (isset($tabData['m-mst_id']) && intval($arrSousTypes[$intCtr]['mst_id']) == intval($tabData['m-mst_id'])) { ?> selected="selected"<?php } ?>><?php echo $arrSousTypes[$intCtr]['mst_nom_' . $strLangue]; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
if ($strReport != 'adhesions') {
|
|
?>
|
|
<div class="form-group row">
|
|
<label for="categorie"
|
|
class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Catégorie d'adhésion"; else echo "Membership category"; ?>
|
|
:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0 selectpicker" id="categorie"
|
|
name="e-epr_categorie_<?php echo $strLangue; ?>[]" multiple>
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['e-epr_categorie_' . $strLangue] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>
|
|
Tous les résultats
|
|
</option>
|
|
<?php
|
|
if ((isset($_GET['btn_search']) && $_GET['e-epr_categorie_' . $strLangue] != '')) {
|
|
$arrCategoriesSearched = $_GET['e-epr_categorie_' . $strLangue];
|
|
}
|
|
for ($intCtr = 1; $intCtr <= count($arrCategories); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo($arrCategories[$intCtr]['epr_categorie_' . $strLangue]); ?>"<?php if (isset($arrCategoriesSearched) && in_array($arrCategories[$intCtr]['epr_categorie_' . $strLangue], $arrCategoriesSearched)) { ?> selected="selected"<?php } ?>><?php echo $arrCategories[$intCtr]['epr_categorie_' . $strLangue]; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
<?php /*
|
|
<div class="form-group row">
|
|
<label for="epreuve" class="col-control-label col-sm-3"><?php if ($strLangue == 'fr') echo "Sous catégorie d'adhésion"; else echo "Membership sbb category"; ?>:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select class="form-control rounded-0 selectpicker" id="epreuve" name="e-epr_id[]" multiple>
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['e-epr_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>Tous les résultats</option>
|
|
<?php
|
|
for($intCtr = 1; $intCtr <= count($arrCategories2); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo ($arrCategories2[$intCtr]['epr_id']); ?>"<?php if (isset($tabData['e-epr_id']) && in_array($arrCategories2[$intCtr]['epr_id'], $tabData['e-epr_id'])) { ?> selected="selected"<?php } ?>><?php echo $arrCategories2[$intCtr]['epr_type_' . $strLangue]; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
*/ ?>
|
|
</fieldset>
|
|
<div class="form-group row">
|
|
<div class="offset-sm-3 col-sm-9 col-lg-7">
|
|
<button type="submit" class="btn btn-primary rounded-0" id="btn_search" name="btn_search"><i
|
|
class="fa fa-search"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Trouver"; else echo "Find"; ?>
|
|
</button>
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
?>
|
|
<button type="button" class="btn btn-danger rounded-0" id="btn_clear_search"
|
|
name="btn_clear_search"><i class="fa fa-times"
|
|
aria-hidden="true"></i> <?php if ($strLangue == 'fr') echo "Effacer recherche"; else echo "Clear search"; ?>
|
|
</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<br>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
$().ready(function () {
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
$strLinkRetour = $vDomaine . '/superadm/rapport_new.php?e=' . urlencode(base64_encode($intEvenement)) . '&r=' . $strReport . '&lng=' . $strLangue;
|
|
?>
|
|
$('#btn_clear_search').click(function () {
|
|
document.location.href = '<?php echo $strLinkRetour; ?>';
|
|
});
|
|
<?php
|
|
}
|
|
?>
|
|
$('#mem_date_debut_cal,#mem_date_fin_cal,#ach_maj_from_cal,#ach_maj_to_cal').datetimepicker({
|
|
format: 'YYYY-MM-DD',
|
|
locale: '<?php echo $strLangue; ?>-ca'
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function fxSetWhere($strReport, $tabData)
|
|
{
|
|
global $objDatabase;
|
|
$strWhere = array();
|
|
|
|
// vérifier la clause WHERE
|
|
if (isset($tabData['btn_search'])) {
|
|
$tabWhere = array();
|
|
|
|
switch ($strReport) {
|
|
case 'chrono':
|
|
$tabKeys = array_keys($tabData);
|
|
|
|
foreach ($tabKeys as $key) {
|
|
if (is_array($tabData[$key])) {
|
|
$arrSearch = array();
|
|
foreach ($tabData[$key] as $id => $value) {
|
|
if (trim($value) != '') {
|
|
$arrSearch[] = $objDatabase->fxEscape($value);
|
|
}
|
|
}
|
|
|
|
if (!empty($arrSearch)) {
|
|
$tabWhere['acheteur'][] = str_replace('-', '.', $key) . " IN('" . implode("','", $arrSearch) . "')";
|
|
}
|
|
} elseif ($key != 'e' && $key != 'r' && $key != 'lng' && $key != 'btn_search' && trim($tabData[$key]) != '') {
|
|
switch ($key) {
|
|
case 'pec_maj_from':
|
|
$tabWhere['acheteur'][] = "pec_maj >= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'pec_maj_to':
|
|
$tabWhere['acheteur'][] = "pec_maj <= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
default:
|
|
$tabWhere['acheteur'][] = str_replace('-', '.', $key) . " LIKE LOWER('%" . $objDatabase->fxEscape($tabData[$key]) . "%') COLLATE utf8_unicode_ci";
|
|
}
|
|
}
|
|
}
|
|
// pousser le WHERE dans une variable
|
|
if (isset($tabWhere['acheteur'])) {
|
|
$strWhere['acheteur'] = implode(' AND ', $tabWhere['acheteur']);
|
|
}
|
|
|
|
break;
|
|
case 'finances':
|
|
case 'finances-pnq':
|
|
case 'finances-membership':
|
|
$tabKeys = array_keys($tabData);
|
|
|
|
foreach ($tabKeys as $key) {
|
|
if ($key != 'e' && $key != 'r' && $key != 'lng' && $key != 'pg' && $key != 'btn_search' && trim($tabData[$key]) != '') {
|
|
switch ($key) {
|
|
case 'a-ach_maj_from':
|
|
$tabWhere['acheteur'][] = "a.ach_maj >= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'a-ach_maj_to':
|
|
$tabWhere['acheteur'][] = "a.ach_maj <= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'a-ach_lang':
|
|
$tabWhere['acheteur'][] = "a.ach_lang = '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'e-tep_id':
|
|
$tabWhere['epreuves'][] = "e.tep_id = " . intval($tabData[$key]);
|
|
break;
|
|
default:
|
|
$tabWhere['acheteur'][] = str_replace('-', '.', $key) . " LIKE LOWER('%" . $objDatabase->fxEscape($tabData[$key]) . "%') COLLATE utf8_unicode_ci";
|
|
}
|
|
|
|
}
|
|
}
|
|
// pousser le WHERE dans une variable
|
|
if (isset($tabWhere['acheteur'])) {
|
|
$strWhere['acheteur'] = implode(' AND ', $tabWhere['acheteur']);
|
|
}
|
|
if (isset($tabWhere['epreuves'])) {
|
|
$strWhere['epreuves'] = implode(' AND ', $tabWhere['epreuves']);
|
|
}
|
|
break;
|
|
case 'finances-membership-promoteur':
|
|
case 'finances-membership-tq':
|
|
case 'finances-membership-autre':
|
|
$tabKeys = array_keys($tabData);
|
|
|
|
foreach ($tabKeys as $key) {
|
|
if ($key != 'e' && $key != 'r' && $key != 'lng' && $key != 'pg' && $key != 'btn_search' && trim($tabData[$key]) != '') {
|
|
switch ($key) {
|
|
case 'a-ach_maj_from':
|
|
$tabWhere['acheteur'][] = "a.ach_maj >= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'a-ach_maj_to':
|
|
$tabWhere['acheteur'][] = "a.ach_maj <= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'a-ach_lang':
|
|
$tabWhere['acheteur'][] = "a.ach_lang = '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'e-tep_id':
|
|
$tabWhere['epreuves'][] = "e.tep_id = " . intval($tabData[$key]);
|
|
break;
|
|
default:
|
|
$tabWhere['acheteur'][] = str_replace('-', '.', $key) . " LIKE LOWER('%" . $objDatabase->fxEscape($tabData[$key]) . "%') COLLATE utf8_unicode_ci";
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
// pousser le WHERE dans une variable
|
|
if (isset($tabWhere['acheteur'])) {
|
|
$strWhere['acheteur'] = implode(' AND ', $tabWhere['acheteur']);
|
|
}
|
|
if (isset($tabWhere['epreuves'])) {
|
|
$strWhere['epreuves'] = implode(' AND ', $tabWhere['epreuves']);
|
|
}
|
|
break;
|
|
case 'remboursements':
|
|
case 'remboursements-bilan':
|
|
$tabKeys = array_keys($tabData);
|
|
|
|
foreach ($tabKeys as $key) {
|
|
if ($key != 'e' && $key != 'r' && $key != 'lng' && $key != 'btn_search' && trim($tabData[$key]) != '') {
|
|
switch ($key) {
|
|
case 'a-ach_maj_from':
|
|
$tabWhere['acheteur'][] = "DATE(ach_maj) >= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
$tabWhere['remboursement'][] = "rem_date_pour >= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
$strWhere['dates'][] = $tabData[$key];
|
|
break;
|
|
case 'a-ach_maj_to':
|
|
$tabWhere['acheteur'][] = "DATE(ach_maj) <= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
$tabWhere['remboursement'][] = "rem_date_pour <= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
$strWhere['dates'][] = $tabData[$key];
|
|
break;
|
|
case 'r-tr_id':
|
|
switch ($tabData[$key]) {
|
|
case '':
|
|
break;
|
|
case '0':
|
|
$tabWhere['remboursement'][] = "1=2";
|
|
break;
|
|
case '1-2':
|
|
$tabWhere['acheteur'][] = "1=2";
|
|
break;
|
|
default:
|
|
$tabWhere['acheteur'][] = "1=2";
|
|
$tabWhere['remboursement'][] = "t.tr_id = " . intval($tabData[$key]);
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
// pousser le WHERE dans une variable
|
|
if (isset($tabWhere['acheteur'])) {
|
|
$strWhere['acheteur'] = implode(' AND ', $tabWhere['acheteur']);
|
|
}
|
|
if (isset($tabWhere['remboursement'])) {
|
|
$strWhere['remboursement'] = implode(' AND ', $tabWhere['remboursement']);
|
|
}
|
|
break;
|
|
case 'adhesions':
|
|
case 'adhesions-ventes':
|
|
$tabKeys = array_keys($tabData);
|
|
|
|
foreach ($tabKeys as $key) {
|
|
if (is_array($tabData[$key])) {
|
|
$arrSearch = array();
|
|
foreach ($tabData[$key] as $id => $value) {
|
|
if (trim($value) != '') {
|
|
$arrSearch[] = $objDatabase->fxEscape($value);
|
|
}
|
|
}
|
|
|
|
if (!empty($arrSearch)) {
|
|
$tabWhere['membership'][] = str_replace('-', '.', $key) . " IN('" . implode("','", $arrSearch) . "')";
|
|
}
|
|
} elseif ($key != 'e' && $key != 'r' && $key != 'lng' && $key != 'pg' && $key != 'btn_search' && trim($tabData[$key]) != '') {
|
|
switch ($key) {
|
|
case 'a-ach_maj_from':
|
|
$tabWhere['acheteur'][] = "a.ach_maj >= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'a-ach_maj_to':
|
|
$tabWhere['acheteur'][] = "a.ach_maj <= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'mem_date_debut':
|
|
$tabWhere['membership'][] = "mem_date_debut >= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'mem_date_fin':
|
|
$tabWhere['membership'][] = "mem_date_fin <= '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
case 'mem_numero':
|
|
$tabWhere['membership'][] = str_replace('-', '.', $key) . " LIKE LOWER('%" . $objDatabase->fxEscape($tabData[$key]) . "%') COLLATE utf8_unicode_ci";
|
|
break;
|
|
case 'mst_id':
|
|
$tabWhere['membership'][] = str_replace('-', '.', $key) . " = " . intval($tabData[$key]);
|
|
break;
|
|
default:
|
|
$tabWhere['acheteur'][] = str_replace('-', '.', $key) . " LIKE LOWER('%" . $objDatabase->fxEscape($tabData[$key]) . "%') COLLATE utf8_unicode_ci";
|
|
}
|
|
}
|
|
}
|
|
|
|
// pousser le WHERE dans une variable
|
|
if (isset($tabWhere['acheteur'])) {
|
|
$strWhere['acheteur'] = implode(' AND ', $tabWhere['acheteur']);
|
|
}
|
|
if (isset($tabWhere['membership'])) {
|
|
$strWhere['membership'] = implode(' AND ', $tabWhere['membership']);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
return $strWhere;
|
|
}
|
|
|
|
// fonction qui récupère les champs et leurs types pour créer le SQL (JSP)
|
|
// param : action, données POST
|
|
function fxAdminCreateQuerySet($strAction, $tabData)
|
|
{
|
|
global $objDatabase;
|
|
$tabOutput = false;
|
|
$tabFields = $tabData;
|
|
|
|
if ($tabFields != null) {
|
|
$strFields = implode(',', array_keys($tabFields));
|
|
$tabFields2 = $objDatabase->fxGetInfoFields('', $strFields);
|
|
|
|
if ($tabFields2 != null) {
|
|
$tabKeys = array_keys($tabFields2);
|
|
|
|
foreach ($tabKeys as $key) {
|
|
$strAlias = '';
|
|
|
|
if ($strAction == 'search') {
|
|
if ($tabFields[$key]['for_alias'] != '')
|
|
$strAlias = str_replace('.', '', $tabFields[$key]['for_alias']) . '.';
|
|
}
|
|
|
|
switch ($tabFields2[$key]['DATA_TYPE']) {
|
|
case 'tinyint':
|
|
case 'int':
|
|
case 'smallint':
|
|
case 'mediumint':
|
|
case 'bigint':
|
|
if ($strAction == 'search' && $tabData[$key] == '') {
|
|
// rien faire
|
|
} else
|
|
$tabOutput[] = $strAlias . $key . " = " . intval($tabData[$key]);
|
|
break;
|
|
case 'double':
|
|
case 'float':
|
|
if ($strAction == 'search' && $tabData[$key] == '') {
|
|
// rien faire
|
|
} else
|
|
$tabOutput[] = $strAlias . $key . " = " . floatval($tabData[$key]);
|
|
break;
|
|
case 'date':
|
|
case 'datetime':
|
|
case 'time':
|
|
if ($strAction == 'search') { // former le WHERE selon les from et to
|
|
if ($tabData[$key . '_from'] != '' || $tabData[$key . '_to'] != '') {
|
|
$tabOutput[] = $strAlias . $key . " >= '" . $objDatabase->fxEscape($tabData[$key . '_from']) . "'";
|
|
$tabOutput[] = $strAlias . $key . " <= '" . $objDatabase->fxEscape($tabData[$key . '_to']) . "'";
|
|
}
|
|
} else
|
|
$tabOutput[] = $strAlias . $key . " = '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
break;
|
|
default:
|
|
if ($strAction == 'search') { // si c'est une recherche, mettre $key LIKE '%$value%'
|
|
if (trim($tabData[$key]) != '')
|
|
$tabOutput[] = $strAlias . $key . " LIKE '%" . $objDatabase->fxEscape($tabData[$key]) . "%'";
|
|
} else
|
|
$tabOutput[] = $strAlias . $key . " = '" . $objDatabase->fxEscape($tabData[$key]) . "'";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return $tabOutput;
|
|
}
|
|
|
|
function fxGetStatutPanier($strTable, $ntId)
|
|
{
|
|
global $objDatabase;
|
|
$arrRetour = array();
|
|
|
|
switch ($strTable) {
|
|
case 'inscriptions_epreuves': // NOTE: nouvraux champs épreuve #NCEPR
|
|
$sqlPanierEpreuve = "SELECT epr_type_fr, epr_type_en, epr_nom_fr, epr_nom_en, epr_date, epr_heure, epr_taxes_incluses, epr_equipe, epr_nb_participants, epr_categorie_fr, epr_categorie_en, epr_code, epr_tandem, epr_qte_limitee, epr_nb_camping, epr_nb_benevole, epr_nb_pit_manager, epr_nb_participants_min, epr_invitation, epr_sexe, tep_id, epr_description_fr, epr_description_en, epr_genere_don, epr_montant_min_don, mt_id, mst_id FROM inscriptions_panier_epreuves WHERE epr_id = " . intval($ntId);
|
|
$arrPanierEpreuve = $objDatabase->fxGetRow($sqlPanierEpreuve);
|
|
|
|
if ($arrPanierEpreuve != null) { // NOTE: nouvraux champs épreuve #NCEPR
|
|
$sqlEpreuve = "SELECT epr_type_fr, epr_type_en, epr_nom_fr, epr_nom_en, epr_date, epr_heure, epr_taxes_incluses, epr_equipe, epr_nb_participants, epr_categorie_fr, epr_categorie_en, epr_code, epr_tandem, epr_qte_limitee, epr_nb_camping, epr_nb_benevole, epr_nb_pit_manager, epr_nb_participants_min, epr_invitation, epr_sexe, tep_id, epr_description_fr, epr_description_en, epr_genere_don, epr_montant_min_don, mt_id, mst_id FROM inscriptions_epreuves WHERE epr_id = " . intval($ntId);
|
|
$arrEpreuve = $objDatabase->fxGetRow($sqlEpreuve);
|
|
|
|
if ($arrPanierEpreuve == $arrEpreuve) {
|
|
$arrRetour['statut'] = 'pareil';
|
|
} else {
|
|
$arrRetour['statut'] = 'different';
|
|
}
|
|
|
|
$sqlPanierUpdate = "SELECT pep_update_date, pep_update_qui FROM inscriptions_panier_epreuves WHERE epr_id = " . intval($ntId);
|
|
$arrPanierUpdate = $objDatabase->fxGetRow($sqlPanierUpdate);
|
|
|
|
$arrRetour['date'] = $arrPanierUpdate['pep_update_date'];
|
|
$arrRetour['qui'] = $arrPanierUpdate['pep_update_qui'];
|
|
} else {
|
|
$arrRetour['statut'] = 'non-existant';
|
|
}
|
|
break;
|
|
case 'inscriptions_evenements':
|
|
$sqlPanierEvenement = "SELECT eve_nom_fr, eve_nom_en, eve_date_debut, eve_date_fin, eve_trousses_fr, eve_trousses_en, eve_siteweb, eve_prive, eve_paypal, eve_frais, tt_id, eve_couleur, eve_gratuit FROM inscriptions_panier_evenements WHERE eve_id = " . intval($ntId);
|
|
$arrPanierEvenement = $objDatabase->fxGetRow($sqlPanierEvenement);
|
|
|
|
if ($arrPanierEvenement != null) {
|
|
$sqlEvenement = "SELECT eve_nom_fr, eve_nom_en, eve_date_debut, eve_date_fin, eve_trousses_fr, eve_trousses_en, eve_siteweb, eve_prive, eve_paypal, eve_frais, tt_id, eve_couleur, eve_gratuit FROM inscriptions_evenements WHERE eve_id = " . intval($ntId);
|
|
$arrEvenement = $objDatabase->fxGetRow($sqlEvenement);
|
|
|
|
if (fxCompareArrays($arrPanierEvenement, $arrEvenement)) {
|
|
$arrRetour['statut'] = 'pareil';
|
|
} else {
|
|
$arrRetour['statut'] = 'different';
|
|
}
|
|
|
|
$sqlPanierUpdate = "SELECT pan_update_date, pan_update_qui FROM inscriptions_panier_evenements WHERE eve_id = " . intval($ntId);
|
|
$arrPanierUpdate = $objDatabase->fxGetRow($sqlPanierUpdate);
|
|
|
|
$arrRetour['date'] = $arrPanierUpdate['pan_update_date'];
|
|
$arrRetour['qui'] = $arrPanierUpdate['pan_update_qui'];
|
|
} else {
|
|
$arrRetour['statut'] = 'non-existant';
|
|
}
|
|
break;
|
|
case 'inscriptions_rabais':
|
|
$sqlPanierRabais = "SELECT rab_description_fr, rab_description_en, rab_code, rab_pourcent, rab_montant, rab_date_limite, rab_priorite, rab_effacable, rab_epreuves, rab_produits, rab_taxes, rab_epr_diff, rab_nb_epr_diff, rab_plus_moins_cher, rab_produits_inclus, rab_nb_epr_diff2 FROM inscriptions_panier_rabais WHERE rab_id = " . intval($ntId);
|
|
$arrPanierRabais = $objDatabase->fxGetRow($sqlPanierRabais);
|
|
|
|
if ($arrPanierRabais != null) {
|
|
$sqlRabais = "SELECT rab_description_fr, rab_description_en, rab_code, rab_pourcent, rab_montant, rab_date_limite, rab_priorite, rab_effacable, rab_epreuves, rab_produits, rab_taxes, rab_epr_diff, rab_nb_epr_diff, rab_plus_moins_cher, rab_produits_inclus, rab_nb_epr_diff2 FROM inscriptions_rabais WHERE rab_id = " . intval($ntId);
|
|
$arrRabais = $objDatabase->fxGetRow($sqlRabais);
|
|
|
|
if ($arrPanierRabais == $arrRabais) {
|
|
$arrRetour['statut'] = 'pareil';
|
|
} else {
|
|
$arrRetour['statut'] = 'different';
|
|
}
|
|
|
|
$sqlPanierUpdate = "SELECT pra_update_date, pra_update_qui FROM inscriptions_panier_rabais WHERE rab_id = " . intval($ntId);
|
|
$arrPanierUpdate = $objDatabase->fxGetRow($sqlPanierUpdate);
|
|
|
|
$arrRetour['date'] = $arrPanierUpdate['pra_update_date'];
|
|
$arrRetour['qui'] = $arrPanierUpdate['pra_update_qui'];
|
|
} else {
|
|
$arrRetour['statut'] = 'non-existant';
|
|
}
|
|
break;
|
|
}
|
|
|
|
return $arrRetour;
|
|
}
|
|
|
|
function fxUpdateInfosPanier($strTable, $intId)
|
|
{
|
|
global $objDatabase;
|
|
$arrRetour = array();
|
|
$arrRetour['statut'] = 'error';
|
|
$arrRetour['sql'] = '-';
|
|
|
|
$arrRetour['date'] = fxGetDateTime();
|
|
$arrRetour['qui'] = fxUnescape($_SESSION['usa_info']['com_prenom']);
|
|
|
|
switch ($strTable) {
|
|
case 'inscriptions_epreuves':
|
|
// NOTE: nouvraux champs épreuve #NCEPR
|
|
$sqlEpreuve = "SELECT epr_type_fr, epr_type_en, epr_nom_fr, epr_nom_en, epr_date, epr_heure, epr_taxes_incluses, epr_equipe, epr_nb_participants, epr_categorie_fr, epr_categorie_en, epr_code, epr_tandem, epr_qte_limitee, epr_nb_camping, epr_nb_benevole, epr_nb_pit_manager, epr_nb_participants_min, epr_invitation, epr_sexe, tep_id, epr_description_fr, epr_description_en, epr_genere_don, epr_montant_min_don, mt_id, mst_id FROM inscriptions_epreuves WHERE epr_id = " . intval($intId);
|
|
$arrEpreuve = $objDatabase->fxGetRow($sqlEpreuve);
|
|
|
|
if ($arrEpreuve != null) { // NOTE: nouvraux champs épreuve #NCEPR
|
|
$sqlPanierUpdate = "UPDATE inscriptions_panier_epreuves SET epr_type_fr = '" . $objDatabase->fxEscape($arrEpreuve['epr_type_fr']) . "', epr_type_en = '" . $objDatabase->fxEscape($arrEpreuve['epr_type_en']) . "', epr_nom_fr = '" . $objDatabase->fxEscape($arrEpreuve['epr_nom_fr']) . "', epr_nom_en = '" . $objDatabase->fxEscape($arrEpreuve['epr_nom_en']) . "', epr_date = '" . $objDatabase->fxEscape($arrEpreuve['epr_date']) . "', epr_heure = '" . $objDatabase->fxEscape($arrEpreuve['epr_heure']) . "', epr_taxes_incluses = " . intval($arrEpreuve['epr_taxes_incluses']) . ", epr_equipe = " . intval($arrEpreuve['epr_equipe']) . ", epr_nb_participants = " . intval($arrEpreuve['epr_nb_participants']) . ", epr_categorie_fr = '" . $objDatabase->fxEscape($arrEpreuve['epr_categorie_fr']) . "', epr_categorie_en = '" . $objDatabase->fxEscape($arrEpreuve['epr_categorie_en']) . "', epr_code = '" . $objDatabase->fxEscape($arrEpreuve['epr_code']) . "', epr_tandem = " . intval($arrEpreuve['epr_tandem']) . ", epr_qte_limitee = " . intval($arrEpreuve['epr_qte_limitee']) . ", epr_nb_camping = " . intval($arrEpreuve['epr_nb_camping']) . ", epr_nb_benevole = " . intval($arrEpreuve['epr_nb_benevole']) . ", epr_nb_pit_manager = " . intval($arrEpreuve['epr_nb_pit_manager']) . ", epr_nb_participants_min = " . intval($arrEpreuve['epr_nb_participants_min']) . ", epr_invitation = " . intval($arrEpreuve['epr_invitation']) . ", epr_sexe = '" . $objDatabase->fxEscape($arrEpreuve['epr_sexe']) . "', pep_update_date = '" . $arrRetour['date'] . "', pep_update_qui = '" . $arrRetour['qui'] . "', tep_id = " . intval($arrEpreuve['tep_id']) . ", epr_description_fr = '" . $objDatabase->fxEscape($arrEpreuve['epr_description_fr']) . "', epr_description_en = '" . $objDatabase->fxEscape($arrEpreuve['epr_description_en']) . "', epr_genere_don = " . intval($arrEpreuve['epr_genere_don']) . ", epr_montant_min_don = " . floatval($arrEpreuve['epr_montant_min_don']) . ", mt_id = " . $arrEpreuve['mt_id'] . ", mst_id = " . $arrEpreuve['mst_id'] . " WHERE epr_id = " . intval($intId);
|
|
$arrPanierUpdate = $objDatabase->fxQuery($sqlPanierUpdate);
|
|
|
|
$arrRetour['sql'] = $sqlPanierUpdate;
|
|
|
|
if ($arrPanierUpdate !== false) {
|
|
$arrRetour['statut'] = 'success';
|
|
} else {
|
|
$arrRetour['statut'] = 'error';
|
|
}
|
|
} else {
|
|
$arrRetour['statut'] = 'non-existant';
|
|
}
|
|
break;
|
|
case 'inscriptions_evenements':
|
|
$sqlEvenement = "SELECT eve_nom_fr, eve_nom_en, eve_date_debut, eve_date_fin, eve_trousses_fr, eve_trousses_en, eve_siteweb, eve_prive, eve_paypal, eve_frais, tt_id, eve_couleur, eve_gratuit FROM inscriptions_evenements WHERE eve_id = " . intval($intId);
|
|
$arrEvenement = $objDatabase->fxGetRow($sqlEvenement);
|
|
|
|
if ($arrEvenement != null) {
|
|
$sqlPanierUpdate = "UPDATE inscriptions_panier_evenements SET eve_nom_fr = '" . $objDatabase->fxEscape($arrEvenement['eve_nom_fr']) . "', eve_nom_en = '" . $objDatabase->fxEscape($arrEvenement['eve_nom_en']) . "', eve_date_debut = '" . $objDatabase->fxEscape($arrEvenement['eve_date_debut']) . "', eve_date_fin = '" . $objDatabase->fxEscape($arrEvenement['eve_date_fin']) . "', eve_trousses_fr = '" . $objDatabase->fxEscape($arrEvenement['eve_trousses_fr']) . "', eve_trousses_en = '" . $objDatabase->fxEscape($arrEvenement['eve_trousses_en']) . "', eve_siteweb = '" . $objDatabase->fxEscape($arrEvenement['eve_siteweb']) . "', eve_prive = " . intval($arrEvenement['eve_prive']) . ", eve_paypal = " . intval($arrEvenement['eve_paypal']) . ", eve_frais = " . intval($arrEvenement['eve_frais']) . ", tt_id = " . intval($arrEvenement['tt_id']) . ", pan_update_date = '" . $arrRetour['date'] . "', pan_update_qui = '" . $arrRetour['qui'] . "', eve_couleur = '" . $objDatabase->fxEscape($arrEvenement['eve_couleur']) . "', eve_gratuit = " . intval($arrEvenement['eve_gratuit']) . " WHERE eve_id = " . intval($intId);
|
|
$arrPanierUpdate = $objDatabase->fxQuery($sqlPanierUpdate);
|
|
|
|
$arrRetour['sql'] = $sqlPanierUpdate;
|
|
|
|
if ($arrPanierUpdate !== false) {
|
|
$arrRetour['statut'] = 'success';
|
|
} else {
|
|
$arrRetour['statut'] = 'error';
|
|
}
|
|
} else {
|
|
$arrRetour['statut'] = 'non-existant';
|
|
}
|
|
break;
|
|
case 'inscriptions_rabais':
|
|
$sqlRabais = "SELECT rab_description_fr, rab_description_en, rab_code, rab_pourcent, rab_montant, rab_date_limite, rab_priorite, rab_effacable, rab_epreuves, rab_produits, rab_taxes, rab_epr_diff, rab_nb_epr_diff, rab_plus_moins_cher, rab_produits_inclus, rab_nb_epr_diff2 FROM inscriptions_rabais WHERE rab_id = " . intval($intId);
|
|
$arrRabais = $objDatabase->fxGetRow($sqlRabais);
|
|
|
|
if ($arrRabais != null) {
|
|
$sqlPanierUpdate = "UPDATE inscriptions_panier_rabais SET rab_description_fr = '" . $objDatabase->fxEscape($arrRabais['rab_description_fr']) . "', rab_description_en = '" . $objDatabase->fxEscape($arrRabais['rab_description_en']) . "', rab_code = '" . $objDatabase->fxEscape($arrRabais['rab_code']) . "', rab_pourcent = " . intval($arrRabais['rab_pourcent']) . ", rab_montant = " . floatval($arrRabais['rab_montant']) . ", rab_date_limite = '" . $objDatabase->fxEscape($arrRabais['rab_date_limite']) . "', rab_priorite = " . intval($arrRabais['rab_priorite']) . ", rab_effacable = " . intval($arrRabais['rab_effacable']) . ", rab_epreuves = '" . $objDatabase->fxEscape($arrRabais['rab_epreuves']) . "', rab_produits = '" . $objDatabase->fxEscape($arrRabais['rab_produits']) . "', rab_taxes = " . intval($arrRabais['rab_taxes']) . ", rab_epr_diff = " . intval($arrRabais['rab_epr_diff']) . ", rab_nb_epr_diff = " . intval($arrRabais['rab_nb_epr_diff']) . ", rab_plus_moins_cher = " . intval($arrRabais['rab_plus_moins_cher']) . ", rab_produits_inclus = " . intval($arrRabais['rab_produits_inclus']) . ", rab_nb_epr_diff2 = " . intval($arrRabais['rab_nb_epr_diff2']) . ", pra_update_date = '" . $arrRetour['date'] . "', pra_update_qui = '" . $arrRetour['qui'] . "' WHERE rab_id = " . intval($intId);
|
|
$arrPanierUpdate = $objDatabase->fxQuery($sqlPanierUpdate);
|
|
|
|
$arrRetour['sql'] = $sqlPanierUpdate;
|
|
|
|
if ($arrPanierUpdate !== false) {
|
|
$arrRetour['statut'] = 'success';
|
|
} else {
|
|
$arrRetour['statut'] = 'error';
|
|
}
|
|
} else {
|
|
$arrRetour['statut'] = 'non-existant';
|
|
}
|
|
break;
|
|
}
|
|
|
|
return $arrRetour;
|
|
}
|
|
|
|
function fxCompareArrays($array1, $array2)
|
|
{
|
|
foreach (array_keys($array1) as $key) {
|
|
if ($array1[$key] != $array2[$key]) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function fxGetStatutProd($strTable, $strKey, $intId)
|
|
{
|
|
global $objDatabaseProd;
|
|
$arrRetour = array();
|
|
|
|
$sqlEvenement = "SELECT * FROM $strTable WHERE $strKey = " . intval($intId);
|
|
|
|
$arrEvenement = $objDatabaseProd->fxGetRow($sqlEvenement);
|
|
|
|
if ($arrEvenement != null) {
|
|
$arrRetour['date'] = $arrEvenement['prod_update_date'];
|
|
$arrRetour['qui'] = $arrEvenement['prod_update_qui'];
|
|
$arrRetour['statut'] = 'existant';
|
|
} else {
|
|
$arrRetour['date'] = '';
|
|
$arrRetour['qui'] = '';
|
|
$arrRetour['statut'] = 'non-existant';
|
|
}
|
|
|
|
return $arrRetour;
|
|
}
|
|
|
|
function fxUpdateInfosProd($strTable, $strKey, $intId)
|
|
{
|
|
global $objDatabase, $objDatabaseProd, $arrConFTP;
|
|
$arrRetour = array();
|
|
$arrRetour['statut'] = 'error';
|
|
$arrRetour['resume'] = '';
|
|
|
|
switch ($strTable) {
|
|
case 'inscriptions_evenements':
|
|
// BACKUP
|
|
/* $arrRetour2[] = fxBackupTable('inscriptions_epreuves');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_epreuves_prix');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_infos_participants');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_produits_new');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_questions');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_rabais');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_evenements');
|
|
// TAXES
|
|
$arrRetour2[] = fxBackupTable('inscriptions_taux_types_taux');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_taux_types');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_taux');
|
|
// FRAIS
|
|
$arrRetour2[] = fxBackupTable('inscriptions_evenements_frais');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_frais');*/
|
|
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_epreuves', $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_epreuves_prix', $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_infos_participants', $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_produits_new', $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_questions', $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxInsertInfosProd('logs_questions_epreuves', $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_rabais', $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_evenements', $strKey, $intId, 'DEV');
|
|
// LOGOS, PDF ET CSS
|
|
/* Connect using basic FTP */
|
|
//$ftpConnection = ftp_connect($arrConFTP['host']);
|
|
/* Login to FTP */
|
|
// $login_result = ftp_login($ftpConnection, $arrConFTP['user'], $arrConFTP['pass']);
|
|
//ftp_pasv($ftpConnection, true);
|
|
// $arrRetour2[] = fxUploadFolder($arrConFTP['path_preprod'] . '/css', $arrConFTP['path_prod'] . '/css', $ftpConnection);
|
|
//$arrRetour2[] = fxUploadFolder($arrConFTP['path_preprod'] . '/images/evenements', $arrConFTP['path_prod'] . '/images/evenements', $ftpConnection);
|
|
//$arrRetour2[] = fxUploadFolder($arrConFTP['path_preprod'] . '/images/backgrounds', $arrConFTP['path_prod'] . '/images/backgrounds', $ftpConnection);
|
|
// $arrRetour2[] = fxUploadFolder($arrConFTP['path_preprod'] . '/pdf/questions', $arrConFTP['path_prod'] . '/pdf/questions', $ftpConnection);
|
|
// $arrRetour2[] = fxUploadFolder($arrConFTP['path_preprod'] . '/pdf/template_dons', $arrConFTP['path_prod'] . '/pdf/template_dons', $ftpConnection);
|
|
//envoie les fichier
|
|
fx_copy_tout($_SERVER['DOCUMENT_ROOT'] . '/preprod/css/', $_SERVER['DOCUMENT_ROOT'] . '/css/');
|
|
fx_copy_tout($_SERVER['DOCUMENT_ROOT'] . '/preprod/images/evenements/', $_SERVER['DOCUMENT_ROOT'] . '/images/evenements/');
|
|
fx_copy_tout($_SERVER['DOCUMENT_ROOT'] . '/preprod/images/backgrounds/', $_SERVER['DOCUMENT_ROOT'] . '/images/backgrounds/');
|
|
fx_copy_tout($_SERVER['DOCUMENT_ROOT'] . '/preprod/pdf/questions/', $_SERVER['DOCUMENT_ROOT'] . '/pdf/questions/');
|
|
fx_copy_tout($_SERVER['DOCUMENT_ROOT'] . '/preprod/pdf/template_dons', $_SERVER['DOCUMENT_ROOT'] . '/pdf/template_dons');
|
|
|
|
$inttUpdate = fxGetVariable('update');
|
|
$inttUpdate++;
|
|
|
|
$sqlUpdate = "UPDATE variables SET var_valeur = " . $inttUpdate . " WHERE var_nom = 'update'";
|
|
$qryUpdateDEV = $objDatabase->fxQuery($sqlUpdate);
|
|
$qryUpdatePROD = $objDatabaseProd->fxQuery($sqlUpdate);
|
|
|
|
/* Close the connection */
|
|
// ftp_close($ftpConnection);
|
|
// TAXES
|
|
$arrRetour2[] = fxReplaceTable('inscriptions_taux_types_taux');
|
|
$arrRetour2[] = fxReplaceTable('inscriptions_taux_types');
|
|
$arrRetour2[] = fxReplaceTable('inscriptions_taux');
|
|
// FRAIS
|
|
$arrRetour2[] = fxReplaceTable('inscriptions_evenements_frais');
|
|
$arrRetour2[] = fxReplaceTable('inscriptions_frais');
|
|
// INSCRITIONS CONFIRMÉES
|
|
/*$arrRetour2[] = fxReplaceTable('config_query');
|
|
$arrRetour2[] = fxReplaceTable('config_tableau');
|
|
$arrRetour2[] = fxReplaceTable('regles_niveau');
|
|
// RAPORTS
|
|
$arrRetour2[] = fxReplaceTable('adm_menus');
|
|
$arrRetour2[] = fxReplaceTable('adm_forms');
|
|
$arrRetour2[] = fxReplaceTable('adm_labels');
|
|
$arrRetour2[] = fxReplaceTable('adm_messages');
|
|
// AUTRES
|
|
$arrRetour2[] = fxReplaceTable('info');*/
|
|
break;
|
|
case 'inscriptions_epreuves':
|
|
/*$arrRetour2[] = fxBackupTable('inscriptions_epreuves');
|
|
$arrRetour2[] = fxBackupTable('inscriptions_epreuves_prix');*/
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_epreuves', $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxInsertInfosProd('inscriptions_epreuves_prix', $strKey, $intId, 'DEV');
|
|
break;
|
|
case 'remboursements':
|
|
$arrRetour2[] = fxInsertInfosProd($strTable, $strKey, $intId, 'DEV');
|
|
$arrRetour2[] = fxReplaceTable('modes_remboursements');
|
|
$arrRetour2[] = fxReplaceTable('types_remboursements');
|
|
break;
|
|
case "images":
|
|
$arrRetour2[] = fxInsertInfosProd('images', $strKey, $intId, 'DEV');
|
|
/* Connect using basic FTP */
|
|
//$ftpConnection = ftp_connect($arrConFTP['host']);
|
|
/* Login to FTP */
|
|
//$login_result = ftp_login($ftpConnection, $arrConFTP['user'], $arrConFTP['pass']);
|
|
//ftp_pasv($ftpConnection, true);
|
|
// $arrRetour2[] = fxUploadFolder($arrConFTP['path_preprod'] . '/images/evenements', $arrConFTP['path_prod'] . '/images/evenements', $ftpConnection);
|
|
/* Close the connection */
|
|
// ftp_close($ftpConnection);
|
|
$sqlDEV = "SELECT * FROM images WHERE $strKey = " . intval($intId);
|
|
$arrDEV = $objDatabase->fxGetResults($sqlDEV);
|
|
|
|
error_log("Copie des image preprod : " . $_SERVER['DOCUMENT_ROOT'] . '/preprod/images/evenements/' . $arrDEV[1]['ima_file_big']);
|
|
if (copy($_SERVER['DOCUMENT_ROOT'] . '/preprod/images/evenements/' . $arrDEV[1]['ima_file_big'], $_SERVER['DOCUMENT_ROOT'] . '/images/evenements/' . $arrDEV[1]['ima_file_big'])) {
|
|
|
|
} else {
|
|
$error = error_get_last();
|
|
error_log("Détails de l'erreur : " . $error['message']);
|
|
error_log($_SERVER['DOCUMENT_ROOT'] . '/preprod/images/evenements/' . $arrDEV[1]['ima_file_big']);
|
|
error_log("La copie du fichier a échoué. ");
|
|
}
|
|
error_log("Copie des image preprod : " . $_SERVER['DOCUMENT_ROOT'] . '/preprod/images/evenements/' . $arrDEV[1]['ima_file_small']);
|
|
if (copy($_SERVER['DOCUMENT_ROOT'] . '/preprod/images/evenements/' . $arrDEV[1]['ima_file_small'], $_SERVER['DOCUMENT_ROOT'] . '/images/evenements/' . $arrDEV[1]['ima_file_small'])) {
|
|
|
|
} else {
|
|
$error = error_get_last();
|
|
error_log("Détails de l'erreur : " . $error['message']);
|
|
error_log($_SERVER['DOCUMENT_ROOT'] . '/preprod/images/evenements/' . $arrDEV[1]['ima_file_small']);
|
|
error_log("La copie du fichier a échoué. ");
|
|
}
|
|
|
|
|
|
break;
|
|
case 'inscriptions_taux_types':
|
|
$arrRetour2[] = fxReplaceTable('inscriptions_taux_types_taux');
|
|
$arrRetour2[] = fxReplaceTable('inscriptions_taux_types');
|
|
break;
|
|
default:
|
|
//$arrRetour2[] = fxBackupTable($strTable);
|
|
$arrRetour2[] = fxInsertInfosProd($strTable, $strKey, $intId, 'DEV');
|
|
}
|
|
|
|
/* $arrSQL = array_map(function($arr) { return $arr['sql']; }, $arrRetour2);
|
|
$arrRetour['sql'] = implode( "\n", $arrSQL); */
|
|
|
|
$arrResume = array_map(function ($arr) {
|
|
return $arr['resume'];
|
|
}, $arrRetour2);
|
|
$arrRetour['resume'] = implode("\n", $arrResume);
|
|
|
|
return $arrRetour;
|
|
}
|
|
|
|
function fxInsertInfosProd($strTable, $strKey, $intId, $strSource)
|
|
{
|
|
global $objDatabase, $objDatabaseProd;
|
|
$arrRetour = array();
|
|
$arrRetour['statut'] = 'error';
|
|
$arrRetour['sql'] = $arrRetour['resume'] = '';
|
|
$arrRetour['date'] = fxGetDateTime();
|
|
$arrRetour['qui'] = 'admin';
|
|
|
|
if (isset($_SESSION['usa_info']['com_prenom'])) {
|
|
$arrRetour['qui'] = fxUnescape($_SESSION['usa_info']['com_prenom']);
|
|
}
|
|
|
|
$sqlDEV = "SELECT * FROM $strTable WHERE $strKey = " . intval($intId);
|
|
|
|
switch ($strSource) {
|
|
case 'PROD':
|
|
$arrDEV = $objDatabaseProd->fxGetResults($sqlDEV);
|
|
break;
|
|
case 'DEV':
|
|
$arrDEV = $objDatabase->fxGetResults($sqlDEV);
|
|
break;
|
|
}
|
|
|
|
if ($arrDEV != null) {
|
|
if (count($arrDEV) > 0) {
|
|
for ($intCtr = 1; $intCtr <= count($arrDEV); $intCtr++) {
|
|
$arrKeys = array_keys($arrDEV[$intCtr]);
|
|
$arrValues = array_values($arrDEV[$intCtr]);
|
|
$intId = $arrValues[0];
|
|
$strKey = $arrKeys[0];
|
|
$sqlInsertPROD = "INSERT INTO $strTable(`" . implode('`,`', array_keys($arrDEV[$intCtr])) . "`) VALUES('" . implode("','", $objDatabaseProd->fxEscape(array_values($arrDEV[$intCtr]))) . "')";
|
|
$qryInsertPROD = $objDatabaseProd->fxQuery($sqlInsertPROD);
|
|
|
|
if ($qryInsertPROD !== false) {
|
|
$intLastId = $objDatabaseProd->fxGetLastId();
|
|
|
|
$sqlUpdatePROD = "UPDATE $strTable SET prod_update_date = '" . $arrRetour['date'] . "', prod_update_qui = '" . $arrRetour['qui'] . "' WHERE $strKey = " . intval($intLastId);
|
|
$qryUpdatePROD = $objDatabaseProd->fxQuery($sqlUpdatePROD);
|
|
|
|
$arrRetour['resume'] .= $strTable . ": " . $intId . " = OK<br>";
|
|
} else {
|
|
$arrRetour['resume'] .= $strTable . ": " . $intId . " = ERREUR<br>";
|
|
}
|
|
|
|
$arrRetour['sql'] .= $strTable . '<br>' . $sqlInsertPROD . '<br>';
|
|
}
|
|
} else {
|
|
$arrRetour['resume'] .= $strTable . " = AUCUN<br>";
|
|
}
|
|
} else {
|
|
$arrRetour['statut'] = 'non-existant';
|
|
$arrRetour['resume'] .= $strTable . " = AUCUN<br>";
|
|
}
|
|
|
|
return $arrRetour;
|
|
}
|
|
|
|
function fxBackupTable($strTable)
|
|
{
|
|
global $objDatabase, $objDatabaseProd;
|
|
$strTimestamp = fxGetDateTime();
|
|
$strTimestamp = str_replace(array('-', ' ', ':'), array('', '_', ''), $strTimestamp);
|
|
|
|
$sqlCreate = "SHOW CREATE TABLE $strTable";
|
|
$arrCreate = $objDatabase->fxGetRow($sqlCreate);
|
|
$sqlRename = "RENAME TABLE $strTable TO $strTable" . "_" . $strTimestamp;
|
|
$qryRename = $objDatabaseProd->fxQuery($sqlRename);
|
|
|
|
$sqlCreate2 = $arrCreate['Create Table'];
|
|
$qryCreate2 = $objDatabaseProd->fxQuery($sqlCreate2);
|
|
|
|
$arrRetour[] = fxInsertInfosProd($strTable, 1, 1, 'PROD');
|
|
|
|
$arrRetour['resume'] .= $strTable . ": BACKUP = OK<br>";
|
|
|
|
return $arrRetour;
|
|
}
|
|
|
|
function fxReplaceTable($strTable)
|
|
{
|
|
global $objDatabaseProd;
|
|
$arrRetour['resume'] = '';
|
|
|
|
$sqlRename = "TRUNCATE TABLE $strTable";
|
|
$qryRename = $objDatabaseProd->fxQuery($sqlRename);
|
|
|
|
$arrRetour = fxInsertInfosProd($strTable, 1, 1, 'DEV');
|
|
$arrRetour['resume'] .= $strTable . ": REPLACE = OK<br>";
|
|
|
|
return $arrRetour;
|
|
}
|
|
|
|
function fxUploadFolder($strSource, $strDestination, $ftpConnection)
|
|
{
|
|
$arrRetour = array();
|
|
$directory = dir($strSource);
|
|
$upload = false;
|
|
$mem_file = '';
|
|
|
|
while ($file = $directory->read()) {
|
|
|
|
if ($file != "." && $file != "..") {
|
|
if (is_dir($strSource . "/" . $file)) {
|
|
if (!@ftp_chdir($ftpConnection, $strDestination . "/" . $file)) {
|
|
ftp_mkdir($ftpConnection, $strDestination . "/" . $file);
|
|
}
|
|
|
|
fxUploadFolder($strSource . "/" . $file, $strDestination . "/" . $file, $ftpConnection);
|
|
} else {
|
|
$upload = ftp_put($ftpConnection, $strDestination . "/" . $file, $strSource . "/" . $file, FTP_BINARY);
|
|
|
|
$mem_file = $mem_file . $file;
|
|
}
|
|
}
|
|
$mem_file = $mem_file . $file;
|
|
}
|
|
|
|
$directory->close();
|
|
|
|
if ($upload) {
|
|
$arrRetour['resume'] = "Répertoire " . str_replace('../', '', $strSource) . " copié<br>";
|
|
} else {
|
|
$arrRetour['resume'] = "ERREUR: Répertoire " . str_replace('../', '', $strSource . ' ' . $strDestination) . " NON copié<br>";
|
|
}
|
|
|
|
return $arrRetour;
|
|
}
|
|
|
|
function fxAjouterInfosParticipant($intPk)
|
|
{
|
|
global $objDatabase;
|
|
$blnRetour = false;
|
|
|
|
$sqlInsert = "INSERT INTO inscriptions_infos_participants(eve_id, cha_id, inf_participant1, inf_required, inf_tri, inf_actif, inf_benevole) SELECT " . intval($intPk) . ", cha_id, 0, 1, cha_tri, cha_actif, 1 FROM inscriptions_infos_participants_champs WHERE cha_defaut = 1";
|
|
$qryInsert = $objDatabase->fxQuery($sqlInsert);
|
|
|
|
if ($qryInsert != false) {
|
|
$blnRetour = true;
|
|
}
|
|
|
|
return $blnRetour;
|
|
}
|
|
|
|
function fxDuplicate($intMenu, $intId)
|
|
{
|
|
global $objDatabase;
|
|
|
|
/*
|
|
* 1. Trouver la table de la ligne à duplique
|
|
* 2. Trouver les champs à dupliquer
|
|
* 3. Copier la ligne
|
|
* 4. Récupérer le dernier ID inséré
|
|
* 4. Vérifier la présence de SOUS MENU
|
|
* 5. Pòur chaque sous menu:
|
|
* a.Trouver les lignes à copier
|
|
*
|
|
*/
|
|
$tabMenu = fxGetMenussuperadm($intMenu);
|
|
|
|
$sqlFields = "SELECT for_field FROM adm_forms WHERE men_id = " . intval($intMenu) . " AND for_add = 1 AND for_type <> 'static' AND for_type <> 'file' AND for_type <> 'autocomplete' AND for_actif = 1";
|
|
$tabFields = $objDatabase->fxGetResultsKey($sqlFields);
|
|
|
|
$sqlInsert = "INSERT INTO " . $tabMenu['men_table'] . "(" . implode(', ', $tabFields) . ") SELECT " . implode(', ', $tabFields) . " FROM " . $tabMenu['men_table'] . " WHERE " . $tabMenu['men_pk'] . " = " . intval($intId);
|
|
$qryInsert = $objDatabase->fxQuery($sqlInsert);
|
|
|
|
if ($tabMenu['sous_men_id'] > 0) {
|
|
$tabSousMenu = fxGetMenussuperadm($tabMenu['sous_men_id']);
|
|
}
|
|
}
|
|
|
|
function __chunk($string, $chunkSize = 1024)
|
|
{
|
|
$splitString = str_split($string, $chunkSize);
|
|
|
|
foreach ($splitString as $chunk) {
|
|
echo $chunk;
|
|
}
|
|
}
|
|
|
|
function echobig($string, $bufferSize = 4096)
|
|
{
|
|
// suggest doing a test for Integer & positive bufferSize
|
|
for ($chars = strlen($string) - 1, $start = 0; $start <= $chars; $start += $bufferSize) {
|
|
echo substr($string, $start, $bufferSize);
|
|
}
|
|
}
|
|
|
|
function fxGetQuestionLabelselect($choix, $question_id)
|
|
{
|
|
global $objDatabase;
|
|
$sql = "SELECT DISTINCT que_banque_label FROM inscriptions_questions WHERE que_banque_actif=1 and que_banque_label!=''";
|
|
$tab = $objDatabase->fxGetResults($sql);
|
|
|
|
?>
|
|
<!-- Liste déroulante -->
|
|
<select id="select-<?= $question_id ?>" onchange="toggleInput(<?= $question_id ?>, this)">
|
|
<option value="vide">Choisir un label</option>
|
|
|
|
<?php foreach ($tab as $option): ?>
|
|
<option value="<?= htmlspecialchars($option['que_banque_label']) ?>" <?= $choix === $option['que_banque_label'] ? 'selected' : '' ?>>
|
|
<?= htmlspecialchars($option['que_banque_label']) ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
<option value="custom">Personnalisé...</option>
|
|
</select>
|
|
|
|
<?php
|
|
|
|
|
|
}
|
|
|
|
|
|
function badfxGetSerial($debut_code)
|
|
{
|
|
$strTemplate = '9X9XX9X9';
|
|
$intMax = strlen($strTemplate);
|
|
$strSerial = $debut_code;
|
|
|
|
for ($intCtr = 0; $intCtr < $intMax; $intCtr++) {
|
|
switch ($strTemplate[$intCtr]) {
|
|
case 'X':
|
|
$strSerial .= chr(rand(65, 90));
|
|
break;
|
|
|
|
case '9':
|
|
$strSerial .= rand(0, 9);
|
|
break;
|
|
|
|
case '-':
|
|
$strSerial .= '-';
|
|
}
|
|
}
|
|
|
|
return $strSerial;
|
|
}
|
|
|
|
function badfxCheckValue($strTable, $strField, $strValue)
|
|
{
|
|
global $objDatabase;
|
|
$sqlSelect = "SELECT COUNT(*) AS nb FROM " . $objDatabase->fxEscape($strTable) . " WHERE " . $objDatabase->fxEscape($strField) . " = '" . $objDatabase->fxEscape($strValue) . "'";
|
|
$nbSelect = $objDatabase->fxGetVar($sqlSelect);
|
|
|
|
if ($nbSelect > 0)
|
|
return false;
|
|
else
|
|
return true;
|
|
}
|
|
|
|
function fxcopiecompte($mem_email)
|
|
{
|
|
global $objDatabaseProd, $objDatabasePreProd;
|
|
// Requête pour récupérer l'enregistrement source
|
|
$sqlCourriel = "SELECT * FROM inscriptions_comptes WHERE com_login = '" . $mem_email . "'";
|
|
$infoCompte = $objDatabaseProd->fxGetRow($sqlCourriel);
|
|
|
|
// Vérifier si un enregistrement a été trouvé
|
|
if ($infoCompte) {
|
|
|
|
// effacer compte en preprod
|
|
$sqlDelete = "DELETE FROM inscriptions_comptes WHERE com_login = '" . $mem_email . "'";
|
|
$qryDelete = $objDatabasePreProd->fxQuery($sqlDelete);
|
|
|
|
|
|
// Préparer les colonnes et les valeurs pour l'insertion
|
|
$columns = array_keys($infoCompte);
|
|
$values = array_map(function ($value) use ($objDatabasePreProd) {
|
|
return "'" . $value . "'";
|
|
}, array_values($infoCompte));
|
|
|
|
// Construire la requête d'insertion
|
|
$sqlInsert = "INSERT INTO inscriptions_comptes (" . implode(", ", $columns) . ") VALUES (" . implode(", ", $values) . ")";
|
|
|
|
// Exécuter la requête sur la base cible
|
|
$result = $objDatabasePreProd->fxQuery($sqlInsert);
|
|
|
|
// Vérifier si l'insertion a réussi
|
|
if ($result) {
|
|
echo "Enregistrement copié avec succès dans la base de données pré-production.";
|
|
} else {
|
|
echo "Erreur lors de la copie : " . $objDatabasePreProd->error;
|
|
}
|
|
} else {
|
|
echo "Aucun enregistrement trouvé avec cet email.";
|
|
}
|
|
|
|
|
|
}
|