diff --git a/functions/functions.php b/functions/functions.php index c9e16c2..1fd3c31 100644 --- a/functions/functions.php +++ b/functions/functions.php @@ -757,6 +757,9 @@ function formatDate($original='', $originalFormat="mysql_datetime", $destination case 'print_date': // "j mois annee" return $infos['tm_mday']." ".$GLOBALS['PRINT_MOIS_COURT'][intVal($infos['tm_mon'])]." ".$infos['tm_year']; break; + case 'print_time': // "%H:%M" + return $infos['tm_hour'].":".$infos['tm_min']; + break; case 'print_date_with_day': // "jour j mois annee" return $GLOBALS['PRINT_JOUR'][$infos['tm_wday']]." ".$infos['tm_mday']." ".$GLOBALS['PRINT_MOIS_COURT'][intVal($infos['tm_mon'])]." ".$infos['tm_year']; break; diff --git a/functions/functions_clients.php b/functions/functions_clients.php index 7a47fc4..497a648 100644 --- a/functions/functions_clients.php +++ b/functions/functions_clients.php @@ -303,6 +303,7 @@ function getClientAbsenceAtDate($client, $date) { ." WHERE ".CLIENTS_ABSENCES_TABLE.".`client`=".intval($client) ." AND ".CLIENTS_ABSENCES_TABLE.".`debut`<='".$date_checked."'" ." AND ".CLIENTS_ABSENCES_TABLE.".`fin`>='".$date_checked."'" + ." AND ".CLIENTS_ABSENCES_TABLE.".`del`=0" ." ORDER BY ".CLIENTS_ABSENCES_TABLE.".`fin` DESC LIMIT 0,1"; $r = $GLOBALS['db_admin']['man']->select($sql); diff --git a/functions/functions_contrats.php b/functions/functions_contrats.php index 1fa1a7f..77de17b 100644 --- a/functions/functions_contrats.php +++ b/functions/functions_contrats.php @@ -280,3 +280,80 @@ function eraseContrat($id) { "du contrat" // ERROR STRING ); } + +//////////////////////////////////////////////////////////////////////// +// PRINT LIST ////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// + +function printContratsList($list) { + $GLOBALS['smarty'] -> assign('logo', PUBLIC_HTML_ADMIN.'img/logo.png'); + $GLOBALS['smarty'] -> assign('date', formatDate('', '', 'print_date')); + $GLOBALS['smarty'] -> assign('time', formatDate('', '', 'print_time')); + + $cssFiles = array( + PUBLIC_HTML_ADMIN.'css/bootstrap_print_light.css', + PUBLIC_HTML_ADMIN.'css/print.css' + ); + $GLOBALS['smarty'] -> assign('cssFiles',$cssFiles); + + // LIST + $pList = array(); + foreach($list as $i) { + // GROUP BY - GROUPE / LIEU / TYPE DE PANNIER + $groupe = intval($i['groupe_ref']); + $lieu = intval($i['lieu_depot_ref']); + $pType = intval($i['panier_type_ref']); + + // CREATION DU GROUPE + if(!array_key_exists($groupe, $pList)) { + $pList[$groupe] = array( + "ref" => $groupe, + "nom" => $i['groupe_nom'], + "nb_contrats" => 0, + "lieux" => array() + ); + } + + // CREATION DU LIEU + if(!array_key_exists($lieu, $pList[$groupe]["lieux"])) { + $pList[$groupe]["lieux"][$lieu] = array( + "ref" => $lieu, + "nom" => $i['lieu_depot_nom'], + "nb_contrats" => 0, + "paniers" => array() + ); + } + + // CREATION DU TYPE DE PANIER + if(!array_key_exists($pType, $pList[$groupe]["lieux"][$lieu]["paniers"])) { + $pList[$groupe]["lieux"][$lieu]["paniers"][$pType] = array( + "type_ref" => $pType, + "type_nom" => $i['panier_type_nom'], + "nb_contrats" => 0, + "contrats" => array() + ); + } + + // AJOUT + $pList[$groupe]["lieux"][$lieu]["paniers"][$pType]["contrats"][] = $i; + $pList[$groupe]["nb_contrats"]++; + $pList[$groupe]["lieux"][$lieu]["nb_contrats"]++; + $pList[$groupe]["lieux"][$lieu]["paniers"][$pType]["nb_contrats"]++; + } + + $GLOBALS['smarty'] -> assign('list',$pList); + $html = $GLOBALS['smarty']->fetch("contrats/contrats_list_print.tpl"); +// die($html); + + $dompdf = new Dompdf\Dompdf(); + $dompdf->loadHtml($html); + $dompdf->setPaper('A4', "portrait"); + $options = $dompdf->getOptions(); + $options->setIsRemoteEnabled(true); + $dompdf->setOptions($options); + + $dompdf->render(); + $dompdf->stream("Liste des contrats (".formatDate('', '', 'strdate').").pdf"); + + die(); +} \ No newline at end of file diff --git a/functions/functions_legumes.php b/functions/functions_legumes.php index 66feb87..60039f2 100644 --- a/functions/functions_legumes.php +++ b/functions/functions_legumes.php @@ -212,7 +212,7 @@ function getLegumeTarifsList($legume) { $sql = getLegumesTarifsTableSelectBaseSQL() ." WHERE ".LEGUMES_TARIFS_TABLE.".`legume`=".intval($legume) ." AND ".LEGUMES_TARIFS_TABLE.".`del`=0" - ." ORDER BY ".LEGUMES_TARIFS_TABLE.".`date` DESC"; + ." ORDER BY ".LEGUMES_TARIFS_TABLE.".`date` DESC, ".LEGUMES_TARIFS_TABLE.".`ref` DESC"; $r = $GLOBALS['db_admin']['man']->select($sql); @@ -220,6 +220,7 @@ function getLegumeTarifsList($legume) { foreach($r['datas'] as $i) { $i["print"] = $i["prix"]." €/".$i["unite"]; $i["date_print"] = formatDate($i["date"], "mysql_date", "print_date"); + $i["use"] = getLegumeTarifUtilise($i['ref']); $list[] = $i; } } @@ -244,29 +245,15 @@ function getLegumeTarifs($legume, $date=false) { "ref" => 0 ); - // TARIF TOUT GROUPE - if(is_array($tarifToutGrp)) { - $tarif["ref"] = intval($tarifToutGrp["ref"]); - $tarif["prix"] = $tarifToutGrp["prix"]; - $tarif["unite"] = $tarifToutGrp["unite"]; - $tarif["print"] = $tarifToutGrp["print"]; - $tarif["date"] = $tarifToutGrp["date"]; - $tarif["date_print"] = $tarifToutGrp["date_print"]; - $tarif["tarif_groupe"] = 0; - } - - // TARIF SPECIFIQUE - $tarifGrp = getLegumeTarif($legume, $g['ref'], $date); + $tarifGrp = getLegumeTarif($legume, $g['ref'], $date, false); if(is_array($tarifGrp)) { - if(!is_array($tarifToutGrp) || (is_array($tarifToutGrp) && $tarifToutGrp["dateObj"] < $tarifGrp["dateObj"])) { - $tarif["ref"] = intval($tarifGrp["ref"]); - $tarif["prix"] = $tarifGrp["prix"]; - $tarif["unite"] = $tarifGrp["unite"]; - $tarif["print"] = $tarifGrp["print"]; - $tarif["date"] = $tarifGrp["date"]; - $tarif["date_print"] = $tarifGrp["date_print"]; - $tarif["tarif_groupe"] = $g['ref']; - } + $tarif["ref"] = intval($tarifGrp["ref"]); + $tarif["prix"] = $tarifGrp["prix"]; + $tarif["unite"] = $tarifGrp["unite"]; + $tarif["print"] = $tarifGrp["print"]; + $tarif["date"] = $tarifGrp["date"]; + $tarif["date_print"] = $tarifGrp["date_print"]; + $tarif["tarif_groupe"] = $g['ref']; } $list[$g['ref']] = $tarif; @@ -301,7 +288,7 @@ function getLegumeTarif($legume, $groupe, $date=false, $groupe_exclusif=true) { $sql .= " AND ".LEGUMES_TARIFS_TABLE.".`date`<='".$date."'"; } - $sql .= " ORDER BY ".LEGUMES_TARIFS_TABLE.".`date` DESC"; + $sql .= " ORDER BY ".LEGUMES_TARIFS_TABLE.".`date` DESC, ".LEGUMES_TARIFS_TABLE.".`ref` DESC"; $r = $GLOBALS['db_admin']['man']->select($sql); @@ -321,6 +308,23 @@ function getLegumeTarif($legume, $groupe, $date=false, $groupe_exclusif=true) { return $i; } +function getLegumeTarifUtilise($tarif) { + $use = false; + + $sql = "SELECT COUNT(*) as 'use' FROM ".LIVRAISONS_LEGUMES_TABLE." WHERE tarif=".intval($tarif); + addDebug($sql); + + $r = $GLOBALS['db_admin']['man']->select($sql,1); + + if(!$r['erreur']) $use = (int)$r['datas']["use"]>0; + else { + $er = "
sql: ".$sql."
error: ".getReadableVar($r['erreur']); + $GLOBALS['errors'][] = "Une erreur est survenue durant l'analyse d'utilisation du tarif de légume dans le base de données !".$er; + } + + return $use; +} + function addLegumeTarif($datas) { return addDatasInTable( $GLOBALS['db_admin']['man'], // DB MANAGER @@ -331,6 +335,18 @@ function addLegumeTarif($datas) { ); } +function updateLegumeTarif($id, $datas) { + return updateDatasInTable( + $GLOBALS['db_admin']['man'], // DB MANAGER + LEGUMES_TARIFS_TABLE, // TABLE NAME + LEGUMES_TARIFS_TABLE_STRUCT, // TABLE STRUCTURE + $id, // ID + $datas, // DATAS + "du tarif", // NULL STRING + "au tarif" // ERROR STRING + ); +} + function deleteLegumeTarif($id) { return deleteItemInTable( $GLOBALS['db_admin']['man'], // DB MANAGER @@ -349,38 +365,33 @@ function eraseLegumeTarif($id) { ); } -function getLegumeTarifHistorique($id, $current = 0) { - $list = array(); - - $sql = getLegumesTarifsTableSelectBaseSQL() - ." WHERE ".LEGUMES_TARIFS_TABLE.".legume=".intval($id) - ." AND ".LEGUMES_TARIFS_TABLE.".del=0"; - - // ORDRE - $sql.=" ORDER BY ".LEGUMES_TARIFS_TABLE.".date DESC"; - - $r = $GLOBALS['db_admin']['man']->select($sql); +//////////////////////////////////////////////////////////////////////// +// PRINT LIST ////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// - if(!$r['erreur']) { - $last_date = ""; - foreach($r['datas'] as $i) { - $i["tarif_print"] = $i["tarif_prix"]." €/".$i["tarif_unite"]; - $i["tarif_date_print"] = formatDate($i["tarif_date"], "mysql_date", "print_date"); - $i["tarif_end_date"] = ($last_date!="") ? $last_date : NULL; - $i["tarif_end_date_print"] = ($last_date!="") ? formatDate($last_date, "mysql_date", "print_date") : NULL; - - $i["tarif_periode"] = (is_null($i["tarif_end_date"]) ? "depuis le " : "du ").$i["tarif_date_print"]; - if(!is_null($i["tarif_end_date"])) $id["tarif_periode"] .= " au ".$i["tarif_end_date_print"]; - - if($i['ref'] != $current) $list[] = $i; - - $last_date = $i["tarif_date"]; - } - } - else { - $er = "
sql: ".$sql."
error: ".getReadableVar($r['erreur']); - $GLOBALS['errors'][] = "Une erreur est survenue durant la récupération de l'historique de tarif du légume dans le base de données !".$er; - } +function printLegumesList() { + $GLOBALS['smarty'] -> assign('logo', PUBLIC_HTML_ADMIN.'img/logo.png'); + $GLOBALS['smarty'] -> assign('date', formatDate('', '', 'print_date')); + $GLOBALS['smarty'] -> assign('time', formatDate('', '', 'print_time')); + + $cssFiles = array( + PUBLIC_HTML_ADMIN.'css/bootstrap_print_light.css', + PUBLIC_HTML_ADMIN.'css/print.css' + ); + $GLOBALS['smarty'] -> assign('cssFiles',$cssFiles); + + $html = $GLOBALS['smarty']->fetch("legumes/legumes_list_print.tpl"); +// die($html); + + $dompdf = new Dompdf\Dompdf(); + $dompdf->loadHtml($html); + $dompdf->setPaper('A4', "portrait"); + $options = $dompdf->getOptions(); + $options->setIsRemoteEnabled(true); + $dompdf->setOptions($options); + + $dompdf->render(); + $dompdf->stream("Liste des légumes (".formatDate('', '', 'strdate').").pdf"); - return $list; + die(); } \ No newline at end of file diff --git a/functions/functions_livraisons.php b/functions/functions_livraisons.php index c4f57fb..b390238 100644 --- a/functions/functions_livraisons.php +++ b/functions/functions_livraisons.php @@ -116,11 +116,13 @@ function getLivraisonDatas($id) { $i["lieux"] = getLivraisonLieux($id); $i["paniers"] = getLivraisonPaniers($id); + $i["paniers_types"] = getLivraisonPaniers($id, 0, true); $i["paniers_contrats"] = getLivraisonPaniersContratsList($id); $i["contrats_list"] = getLivraisonPaniersContratsList($id, $i["paniers_contrats"]); $i["nb_paniers"] = getLivraisonNbPaniers($id); - $i["legumes"] = getLivraisonLegumes($id, $i["nb_paniers"]); + $i["legumes"] = getLivraisonLegumes($id, "type", $i["nb_paniers"]); $i["total_legumes"] = calcLivraisonTotalLegumes($i["legumes"]); + $i["legumes_distrib"] = getLivraisonLegumes($id, "legume", $i["nb_paniers"]); $i["paniers_eligibles"] = getLivraisonPaniersEligibles($i["paniers_groupe_ref"], $i["date"], $i["quinz_groupe"], $i['paniers']); $i["emargement_list"] = getLivraisonEmargementList($i["paniers_eligibles"], $i["date"]); @@ -380,7 +382,6 @@ function getLivraisonPaniersEligibles($paniers_groupe, $date, $quinz_groupe, $pa $list[$lieu]["nb_paniers"]++; $list[$lieu]["paniers"][$pType]["nb_paniers"]++; } - } } } @@ -575,7 +576,7 @@ function updateLivraisonComplement($livraison, $contrat, $datas) { // LIVRAISONS - LEGUMES //////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// -function getLivraisonLegumes($livraison, $nbPaniers=[]) { +function getLivraisonLegumes($livraison, $groupBy=false, $nbPaniers=[]) { $list = array(); $sql = getLivraisonsLegumesTableSelectBaseSQL(); @@ -587,24 +588,40 @@ function getLivraisonLegumes($livraison, $nbPaniers=[]) { if(!$r['erreur']) { foreach($r['datas'] as $i) { $i['tarif_unite_acro'] = LEGUMES_TARIFS_UNITES_ACRONYMES[$i['tarif_unite']]; + $i['quantite_print'] = floatval($i['quantite'])." ".$i['tarif_unite_acro']; + if($i["tarif_unite"]=="kg" && floatval($i["quantite"])*1000<1000) $i['quantite_print'] = (floatval($i["quantite"])*1000)." g"; // GROUPE PAR TYPE DE PANIER - if(!array_key_exists($i["panier_type_ref"], $list)) { - $list[$i["panier_type_ref"]] = array( - "ref" => $i["panier_type_ref"], - "nom" => $i["panier_type_nom"], - "nb" => 0, - "montant" => 0.0, - "legumes" => array() - ); - - if(array_key_exists($i["panier_type_ref"], $nbPaniers)) $list[$i["panier_type_ref"]]['nb'] = $nbPaniers[$i["panier_type_ref"]]['nb']; + if($groupBy == "type") { + if(!array_key_exists($i["panier_type_ref"], $list)) { + $list[$i["panier_type_ref"]] = array( + "ref" => $i["panier_type_ref"], + "nom" => $i["panier_type_nom"], + "nb" => 0, + "montant" => 0.0, + "legumes" => array() + ); + + if(array_key_exists($i["panier_type_ref"], $nbPaniers)) $list[$i["panier_type_ref"]]['nb'] = $nbPaniers[$i["panier_type_ref"]]['nb']; + } + $list[$i["panier_type_ref"]]["legumes"][] = $i; + $list[$i["panier_type_ref"]]["montant"] += floatval($i["quantite"]) * floatval($i["tarif_prix"]); } - $list[$i["panier_type_ref"]]["legumes"][] = $i; - $list[$i["panier_type_ref"]]["montant"] += floatval($i["quantite"]) * floatval($i["tarif_prix"]); + // GROUPE PAR LEGUME + else if($groupBy == "legume") { + if(!array_key_exists($i["ref"], $list)) { + $list[$i["ref"]] = array( + "ref" => $i["ref"], + "nom" => $i["nom"], + "paniers" => array() + ); + } + $list[$i["ref"]]["paniers"][$i["panier_type_ref"]] = $i; + } + else $list[] = $i; } - $list = orderListByKey($list, "nom", "ASC"); + if($groupBy == "type") $list = orderListByKey($list, "nom", "ASC"); } else { $er = "
sql: ".$sql."
error: ".getReadableVar($r['erreur']); @@ -674,6 +691,7 @@ function exportLivraisonTemplateToPDF($templateFile, $outputFileName, $orientati $cssFiles = array( PUBLIC_HTML_ADMIN.'css/bootstrap_print_light.css', + PUBLIC_HTML_ADMIN.'css/print.css', PUBLIC_HTML_ADMIN.'css/livraisons.css' ); $GLOBALS['smarty'] -> assign('cssFiles',$cssFiles); diff --git a/paniers.sql b/paniers.sql index 08a7983..29cd922 100644 --- a/paniers.sql +++ b/paniers.sql @@ -163,7 +163,7 @@ DEFAULT CHARSET=utf8; CREATE TABLE `legumes_tarifs` ( `ref` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, `legume` smallint(5) UNSIGNED NOT NULL, - `groupe` smallint(5) UNSIGNED NULL DEFAULT NULL, + `groupe` smallint(5) UNSIGNED NOT NULL DEFAULT '0' `prix` float(5,2) UNSIGNED NOT NULL, `unite` set('kg','pièce','botte') NOT NULL DEFAULT 'kg', `date` date NOT NULL, diff --git a/public_html_admin/contrats.php b/public_html_admin/contrats.php index 7344c84..4744e8a 100644 --- a/public_html_admin/contrats.php +++ b/public_html_admin/contrats.php @@ -127,6 +127,9 @@ switch($action) { case "autocomplete_list": die( json_encode( getClientsAutocompleteList() ) ); break; // DEFAULT - LIST default: { + // PRINT + $print = isset($_REQUEST["action"]) && $_REQUEST["action"]=="printList"; + // REQUIRED LISTS & FILTRE $groupesList = getPaniersGroupesList(); $groupe = getRequestAndSessionSave("groupe", "livraisons_filtre_groupe", "groupe", "int", 0, $groupesList, true); @@ -144,18 +147,22 @@ switch($action) { $search = getSearch("contrats_search"); // LIMITS - $limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbContratsInList($filtres, $search)); - if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) { - $limits['start'] = intval($_REQUEST['startListAt']); - $limits['end'] = $limits['start'] + $limits['nbItemsByPage']; - if($limits['end'] > $limits['max']) $limits['end'] = $limits['max']; + if($print) $limits = false; + else { + $limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbContratsInList($filtres, $search)); + if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) { + $limits['start'] = intval($_REQUEST['startListAt']); + $limits['end'] = $limits['start'] + $limits['nbItemsByPage']; + if($limits['end'] > $limits['max']) $limits['end'] = $limits['max']; + } + $limits['rest'] = $limits['max'] - $limits['end']; + $GLOBALS['smarty'] -> assign('list_limits',$limits); } - $limits['rest'] = $limits['max'] - $limits['end']; - $GLOBALS['smarty'] -> assign('list_limits',$limits); // LIST $order = getListOrder('contrats_list_order', 'contrats_list_sens', $allowContratsListOrder, 'prenom'); $list = getContratsList($order["order"], $order["sens"], $filtres, $search, $limits); + if($print) die( printContratsList($list) ); $GLOBALS['smarty'] -> assign('list',$list); // LIST PART diff --git a/public_html_admin/css/admin.css b/public_html_admin/css/admin.css index 8c3186a..baf6c09 100644 --- a/public_html_admin/css/admin.css +++ b/public_html_admin/css/admin.css @@ -85,6 +85,8 @@ div.secondbar form.navbar_filtre { margin-left: auto!important; } +div.secondbar form.navbar-right { padding-right: 0; } + div.secondbar ul.navbar-nav li > a:hover, div.secondbar ul.navbar-nav li.active > a:hover, div.secondbar ul.navbar-nav li.active > a { @@ -490,9 +492,9 @@ table.modal-body tr:last-child { border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; } -table.modal-body tr:last-child td:first-child { border-bottom-left-radius: 6px; } -table.modal-body tr:last-child th:first-child { border-bottom-left-radius: 6px; } -table.modal-body tr:last-child td:last-child { border-bottom-right-radius: 6px; } +table.modal-body tr:last-child td:first-child { border-bottom-left-radius: 6px; !important } +table.modal-body tr:last-child th:first-child { border-bottom-left-radius: 6px; !important } +table.modal-body tr:last-child td:last-child { border-bottom-right-radius: 6px; !important } /* INLINE SELECT MANAGER */ @@ -543,18 +545,21 @@ div.formTabs table.modal-body tr:first-child td { border-top: none; } /* MODAL VIEW LEGUME */ -.has-next-tarif { background-color: azure; } +.has-next-tarif { background-color: #e5ffe7; } #modalViewLegume tr.tarifs_titre { background-color: #f2f2f2; border-top: 3px solid #ddd; } #modalViewLegume tr.tarifs_titre th.groupe { border-left: 1px solid #999999; border-right: 1px solid #999999; } -#modalViewLegume tr.tarif td { border: 1px solid #999999; } +#modalViewLegume tr.tarif td { border-top: 1px solid #999999; } +#modalViewLegume tr.tarif:not(:last-child) td { border-bottom: 1px solid #999999; } +#modalViewLegume tr.tarif td:not(:first-child) { border-left: 1px solid #999999; } +#modalViewLegume tr.tarif td:not(:first-last) { border-right: 1px solid #999999; } #modalViewLegume td.tarif { text-align: center; } -#modalViewLegume tr.tarif.courant td { - background-color: rgba(51, 122, 183, .2); - border-color: #999999; -} -#modalViewLegume td.tarif.groupe-null { background-color: #ddd!important; } + +#modalViewLegume td.tarif.next { background-color: #e5ffe7!important; } +#modalViewLegume td.tarif.current { background-color: #bfe2ff;!important; } +#modalViewLegume td.tarif.old { background-color: #f2f2f2!important; } +#modalViewLegume td.tarif.not_apply { background-color: #ccc!important; } /* FORM LEGUME */ .formLegume div.tarif { margin-bottom: 5px; } diff --git a/public_html_admin/css/livraisons.css b/public_html_admin/css/livraisons.css index 2125779..c0332b4 100644 --- a/public_html_admin/css/livraisons.css +++ b/public_html_admin/css/livraisons.css @@ -136,25 +136,41 @@ .formLivraison div.formTabs > div.tabLegumes table.panier th.total.montant { font-size: 1.5em; } .formLivraison div.formTabs > div.tabLegumes table.panier th.total.unite { font-size: 1.5em; } -/* PRINT */ +/* BTN PRINT */ #modalViewLivraison div.btnPrint { margin-right: 10px; } -body.printLivraison { font-size: 8pt; } -body.printLivraison[orientation=landscape] { margin-top: -20px; } +/* PRINT - DISTRIB */ -table.printHeader { width: 100%; margin-bottom: 10px; } -table.printHeader th.titre { width: 25%; font-size: 10pt; vertical-align: middle; } -table.printHeader th.page { width: 50%; font-size: 16pt; text-align: center; } -table.printHeader th.logo { width: 25%; text-align: right; padding: 10pt; } -table.printHeader th.logo > img { height: 50pt; } -.page_break { page-break-before: always; } +table.distrib { + width: 100%; + border-collapse: true; + table-layout: fixed; +} +table.distrib thead tr { background-color: rgba(51, 122, 183, .1); } -table.emargement { - width: 100%; - border-collapse: true; +table.distrib th, table.distrib td { + padding: 10px; + border: 1px dotted #333333; + text-align: center; + font-size: 20px; } +table.distrib td.legume { + font-weight: bold; + font-size: 20px; + background-color: rgba(51, 122, 183, .1); +} + +table.distrib td.quantite { + font-weight: bold; + font-size: 20px; +} + +/* PRINT - EMARGEMENT */ + +table.emargement { width: 100%; border-collapse: true; } + table.emargement thead tr { background-color: rgba(51, 122, 183, .1); } table.emargement th, table.emargement td { diff --git a/public_html_admin/css/print.css b/public_html_admin/css/print.css new file mode 100644 index 0000000..c376219 --- /dev/null +++ b/public_html_admin/css/print.css @@ -0,0 +1,75 @@ +body.print { font-size: 8pt; margin-top: -10px; } + +table.printHeader { width: 100%; margin-top: -25px; margin-bottom: 10px; } +table.printHeader th.titre { width: 25%; font-size: 9pt; vertical-align: middle; } +table.printHeader th.page { width: 50%; font-size: 13pt; text-align: center; } +table.printHeader th.logo { width: 25%; text-align: right; padding: 5px; } +table.printHeader th.logo > img { height: 50pt; } +.page_break { page-break-before: always; } + +.center { text-align: center!important; } +.right { text-align: right!important; } + +/* TABLE LIST PRINT */ + +table.listPrint { + width: 100%; + border-collapse: collapse; + box-sizing: border-box; + margin: 0; +} +table.listPrint.no-break { page-break-inside: avoid; break-inside: avoid; } + +table.listPrint th, table.listPrint td { padding: 3px !important; } + +table.listPrint tr.main_title th { + background-color: black; + color: white; + font-size: 1.5em; + border: none; +} + +table.listPrint thead th { + background-color: #3296c8; + border: 1px solid white; + color: white; +} +table.listPrint thead th:first-child { border-left: none; } +table.listPrint thead th:last-child { border-right: none; } + +table.listPrint tr.second_title th { + background-color: #CECECE; + border: none!important; +} +table.listPrint tr.second_title th > small { float: right; } + +/* LIST TARIFS LEGUMES */ +body.legumes th.tarif, body.legumes td.tarif { width: 100px; } + +/* LIST CONTRATS */ +body.contrats table.printHeader th.page { line-height: 18px; } +body.contrats table.printHeader th.page span.groupe { + text-transform : uppercase; + color: #3296c8; +} + +body.contrats table.printHeader th.page span.nb_contrats { + font-size: 10px; + font-style: italic; + color: grey; + line-height: 10px; + font-weight: 400; +} + +body.contrats h1.groupe_contrat { + text-align: center; + text-transform : uppercase; + color: #3296c8; + margin-bottom: 0; +} +body.contrats h3.groupe_nb_contrat { + text-align: center; + margin-top: 0; + font-style: italic; + color: grey; +} \ No newline at end of file diff --git a/public_html_admin/js/contrats.js b/public_html_admin/js/contrats.js index f441562..8a8db8a 100644 --- a/public_html_admin/js/contrats.js +++ b/public_html_admin/js/contrats.js @@ -4,6 +4,7 @@ var contratsConf = { baseURL : "contrats.php", // LIST list_selector : "#contratsList", + btn_list_print_selector : "#btnPrintContratsList", // SEARCH search_selector : "#contratsSearch .searchGrp", filtres_selector : "#contratsSearch select", @@ -33,8 +34,12 @@ var modalArchiveContrat = false; var modalDeleteContrat = false; $(document).ready( function() { - // LIST LOADER + // LIST initListProgressLoad($(contratsConf.list_selector), contratsConf.baseURL, contratsConf.type+" list"); + $(contratsConf.btn_list_print_selector).click(function(e) { + e.preventDefault(); $(this).blur(); + window.open(contratsConf.baseURL+"?action=printList", '_blank'); + }); // SEARCH / FILTRES $(contratsConf.search_selector).initSearchGroup(); diff --git a/public_html_admin/js/functions.js b/public_html_admin/js/functions.js index d6dd549..4ddfe1f 100644 --- a/public_html_admin/js/functions.js +++ b/public_html_admin/js/functions.js @@ -555,7 +555,6 @@ function initListProgressLoad(list, url, listName) { if(isDefined(list)) { var contentH = list.innerHeight(); - list.listProgressLoad_resize(); $(window).resize( function() { list.listProgressLoad_resize(); } ); list.scroll(function(e) { @@ -577,6 +576,8 @@ function initListProgressLoad(list, url, listName) { list.trigger( "loaded" ); tr.remove(); + + list.listProgressLoad_resize(); }).fail(function(xhr) { errMsg = "SERVER ERROR ("+(( isDefined( listName ) && listName != "" ) ? listName : "list")+" - load items)"; if( xhr['responseText']!="" ) errMsg += " : " + xhr['responseText']; @@ -750,6 +751,22 @@ function initFloatInput(elem) { }); } +function initDateInput(elem) { + elem.unbind('keypress').unbind('keyup').keypress( function(event) { + if(event.keyCode==13) { + event.preventDefault(); + setTimeout(function() { elem.blur(); },50); + } + }).blur(function(e) { + var date = parseDate($(this).val(), 'yyyy-mm-dd'); + var minDate = parseDate($(this).attr("min"), 'yyyy-mm-dd'); + var maxDate = parseDate($(this).attr("max"), 'yyyy-mm-dd'); + if(!date) $(this).val("") + else if(minDate && date0) { modal.find("table.modal-body tbody tr.nullchild").addClass("hide"); var tarifs_courant = {}; - $.each(datas.tarifs, function(n,e) { tarifs_courant[e.ref] = e.print }); - $.each(datas.tarifs_list, function(n,e) { modalViewLegume_addTarif(modal, e, tarifs_courant); }); + $.each(datas.tarifs, function(n,e) { tarifs_courant[e.ref] = e }); + $.each(datas.tarifs_list, function(n,e) { modalViewLegume_addTarif(modal, e, datas.tarifs); }); } modal.modal('show'); @@ -101,57 +106,151 @@ function modalViewLegume_clear(modal) { modal.find("td.nom").html(""); modal.find("table.modal-body tbody tr.nullchild").removeClass("hide"); modal.find("table.modal-body tbody tr.tarif").remove(); - - modal.find("table.modal-body tfoot").addClass("hide").find("tr:not(.header)").remove(); } function modalViewLegume_addTarif(modal, datas, tarifs_courant) { - var tr = $("") - .append( $("").html(datas.date_print) ); - - if(tarifs_courant.hasOwnProperty(datas.ref)) tr.addClass("courant"); - - var grps = modal.find("table.modal-body tbody th.titre.groupe"); - - if(parseInt(datas.groupe_ref)>0) { - grps.each(function(n,e) { - if(parseInt($(this).attr('ref')) == parseInt(datas.groupe_ref)) { - tr.append( $("").html(datas.print) ); + // ANALYSE DATAS + var date = parseDate(datas.date, 'yyyy-mm-dd'); + var grp_ref = parseInt(datas.groupe_ref); + var is_all = !(parseInt(datas.groupe_ref)>0); + var is_all_next = true; + var is_all_current = true; + var is_all_old = true; + var grps = []; + var grps_by_id = {}; + modal.find("table.modal-body tbody th.titre.groupe").each(function(n,e) { + var g = { + ref : parseInt($(this).attr('ref')), + apply : false, + is_next : false, + is_current : false, + is_old : false + }; + g.apply = ((!grp_ref>0) || (grp_ref == g.ref)); + if(g.apply) { + var current = tarifs_courant[ g.ref ]; + if(current.ref == datas.ref) { g.is_current = true; is_all_next = false; is_all_old = false; } + else { + is_all_current = false; + currentDate = parseDate(current.date, 'yyyy-mm-dd'); + if(date>currentDate) { g.is_next = true; is_all_old = false; } + else { g.is_old = true; is_all_next = false; } } - else tr.append( $(".") ); - }); - } - else { - tr.append( $("").attr("colspan", grps.length).html(datas.print) ); - } - modal.find("table.modal-body tbody").append(tr); -} - -function modalViewLegume_addTarifLegumeHist(modal, datas) { - var tr = $("").attr("ref", datas.ref); - tr.append($("").html(datas.tarif_print)); - tr.append($("").html(datas.tarif_periode)); - btnDel = $('').attr('ref', datas.ref).attr('tarif', datas.tarif_print).attr('periode', datas.tarif_periode); - tr.append($("").append(btnDel)); - modal.find("table.modal-body tfoot").append(tr); - - btnDel.click(function(e) { - e.preventDefault(); $(this).blur(); - tr = $(this).parent().parent(); - id = parseInt( $(this).attr("ref") ); - if(!id>0) return; - msg = "Êtes vous sûr de vouloir supprimer le tarif de "+$(this).attr("tarif")+" en application "+$(this).attr("periode")+" ?"; - if(confirm(msg)) { - datas = { 'action' : 'deleteTarif', 'tarif' : id }; - $.post( legumesConf.baseURL, datas, function( result ) { - if(parseInt(result)>0) { - tr.remove(); - if(modal.find("table.modal-body tfoot tr:not(.header)").length == 0) modal.find("table.modal-body tfoot").addClass("hide"); - } - else { console.error(result); alert(result); } - }).fail(function() { alert("("+legumesConf.type+" - delete tarif)"); }); } - }) + else { is_all_next = false; is_all_current = false; is_all_old = false; } + grps_by_id[g.ref] = g; + grps.push(g); + }); + + // BUILD + var tr = $("") + .append( $("").html(datas.date_print).attr("date", datas.date)); + + // FIND OLD ROW AT SAME DATE + var trOld = []; + modal.find("table.modal-body tbody tr.tarif td.date").each(function(n,e) { + if($(this).attr('date') == datas.date && trOld.length==0) trOld = $(this).parent(); + }); + replace_cell = false; + + // APPLY TO ALL GROUPES + if(is_all && (is_all_next || is_all_current || is_all_old)) { + // REPLACE CELL IF POSSIBLE + if(trOld.length>0) { + td = trOld.find('td.tarif.not_apply'); + if(td.length>0) { + td.each(function(n,e) { + $(this).removeClass("not_apply").html(datas.print); + if(is_all_next) td.addClass('next'); + else if(is_all_current) td.addClass('current'); + else td.addClass('old'); + }) + replace_cell = true; + } + } + // ADD NEW ROW + if(!replace_cell) { + td = $("").attr("colspan", grps.length).html(datas.print); + if(is_all_next) td.addClass('next'); + else if(is_all_current) td.addClass('current'); + else td.addClass('old'); + tr.append( td ); + modal.find("table.modal-body tbody").append(tr); + } + } + // APPLY BY GROUP + else { + // REPLACE IF POSSIBLE + if(trOld.length>0) { + // REPLACE CELL BY CELL IF POSSIBLE + if(grp_ref>0) { + // REPLACE NOT_APPLY + td = trOld.find('td.tarif.not_apply[grp='+grp_ref+']'); + if(td.length>0) { + td.removeClass('not_apply').html( datas.print ); + g = grps_by_id[grp_ref]; + if(g.is_next) td.addClass('next'); + else if(g.is_current) td.addClass('current'); + else td.addClass('old'); + replace_cell = true; + } + // SPLIT ALL + else { + td = trOld.find('td.tarif[colspan='+grps.length+']'); + if(td.length>0) { + old = { + 'print' : td.html(), + 'class' : td.attr("class") + } + td.remove(); + for(var i=0; i.").attr('grp', g.ref); + if(g.ref == grp_ref) { + td.html( datas.print ); + if(g.is_next) td.addClass('next'); + else if(g.is_current) td.addClass('current'); + else td.addClass('old'); + } + else td.html( old.print ).attr('class', old.class); + trOld.append( td ); + } + replace_cell = true; + } + } + } + // APPLY TO NOT ALREADY APPLY IF POSSIBLE + else { + td = trOld.find('td.tarif.not_apply'); + if(td.length>0) { + td.each(function(n,e) { + $(this).removeClass('not_apply').html( datas.print ); + g = grps_by_id[$(this).attr('grp')]; + if(g.is_next) $(this).addClass('next'); + else if(g.is_current) $(this).addClass('current'); + else $(this).addClass('old'); + }); + replace_cell = true; + } + } + } + // ADD CELL BY GROUPE + if(!replace_cell) { + for(var i=0; i.").attr('grp', g.ref); + if(g.apply) { + td.html( datas.print ); + if(g.is_next) td.addClass('next'); + else if(g.is_current) td.addClass('current'); + else td.addClass('old'); + } + else td.addClass("not_apply"); + tr.append( td ); + } + modal.find("table.modal-body tbody").append(tr); + } + } } /***** MODAL FORM ADD/EDIT *****/ @@ -174,17 +273,9 @@ function modalFormLegume_loadDatas(modal,id) { var datas = JSON.parse(jsonTxt); modal.find("input[name=nom]").val(datas.nom); - $.each(datas.tarifs, function(n,e) { - if(e.ref>0) { - e.is_next = false; - modalFormLegume_addTarif(modal, e); - } - }); - $.each(datas.next_tarifs, function(n,e) { - if(e.ref>0) { - e.is_next = true; - modalFormLegume_addTarif(modal, e); - } + + $.each(datas.tarifs_list, function(n,e) { + if(e.ref>0) modalFormLegume_addTarif(modal, e); }); if(modal) modal.modal('show'); @@ -206,21 +297,19 @@ function modalFormLegume_addTarif(modal, datas) { if(isDefined(datas) && typeof(datas)==="object") { iptGrp.attr('ref', datas.ref); - iptGrp.find("select[name=groupe]").val(datas.tarif_groupe).prop("disabled", true); - iptGrp.find("input[name=prix]").val(datas.prix).prop("disabled", true); - iptGrp.find("select[name=unite]").val(datas.unite).prop("disabled", true); - iptGrp.find("input[name=date]").val(datas.date).prop("disabled", true); - if(datas.is_next) iptGrp.find("button.btnDel").prop("disabled", false); - } - else { - iptGrp.find("input[name=date]").val(getTodayDate("yyyy-mm-dd")); - iptGrp.find("button.btnDel").prop("disabled", false); + iptGrp.find("select[name=groupe]").val(datas.groupe_ref).prop("disabled", datas.use); + iptGrp.find("input[name=prix]").val(datas.prix).prop("disabled", datas.use); + iptGrp.find("select[name=unite]").val(datas.unite).prop("disabled", datas.use); + iptGrp.find("input[name=date]").val(datas.date).prop("disabled", datas.use); + iptGrp.find("button.btnDel").prop("disabled", datas.use); } + else iptGrp.find("input[name=date]").val(getTodayDate("yyyy-mm-dd")).attr('min', getTodayDate("yyyy-mm-dd")); modal.find("div.tarifs").append(iptGrp); // INIT initFloatInput( iptGrp.find("input[name=prix]") ); + initDateInput( iptGrp.find("input[name=date]") ); iptGrp.find("button.btnDel").click(function(e) { e.preventDefault(); $(this).blur(); @@ -263,8 +352,14 @@ function modalFormLegume_getDatas(modal) { return datas; } -function modalFormLegume_checkDatas(datas) { - if(datas.nom=="" || JSON.parse(datas.tarifs).length==0) { +function modalFormLegume_checkDatas(datas) { + tarifs = JSON.parse(datas.tarifs); + var nb_valid_tarifs = 0; + $.each(tarifs, function(n,e) { + if(e.prix>0 && parseDate(e.date, 'yyyy-mm-dd') && e.del==0) nb_valid_tarifs++; + }); + + if(datas.nom=="" || nb_valid_tarifs==0) { alert("ERREUR : au minimum, un nom et un tarif doivent être renseigné !"); return false; } diff --git a/public_html_admin/js/livraisons.js b/public_html_admin/js/livraisons.js index 0816a28..dcf316d 100644 --- a/public_html_admin/js/livraisons.js +++ b/public_html_admin/js/livraisons.js @@ -106,6 +106,7 @@ function initViewLivraison() { function modalViewLivraison_loadDatas(modal, id) { $.post(livraisonsConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) { var datas = JSON.parse(jsonTxt); + modal.find("small.db_ref > span").html(datas.ref); // PRINT EMARGEMENT PAR LIEU @@ -165,6 +166,7 @@ function modalViewLivraison_clear(modal) { modal.find("small.db_ref > span").html(""); + modal.find("div.btnPrint li").removeClass("hide"); modal.find(".print_emargement_par_lieu").remove(); modal.find("td.groupe").html(""); @@ -181,7 +183,7 @@ function modalViewLivraison_loadPaniers() { modalViewLivraison.find("div.tabPaniers").html(result); // COMPLEMENT - modalViewLivraison.find("div.tabPaniers td.complement").each(function(n,e) { + modalViewLivraison.find("div.tabPaniers tr:not(.absent) td.complement").each(function(n,e) { $(this).addClass("editable").dblclick(function(e) { e.preventDefault(); val = parseFloat( $(this).html() ); @@ -206,7 +208,7 @@ function modalViewLivraison_loadPaniers() { }); // COMPLEMENT REGLE - modalViewLivraison.find("div.tabPaniers td.complement_regle").each(function(n,e) { + modalViewLivraison.find("div.tabPaniers tr:not(.absent) td.complement_regle").each(function(n,e) { $(this).addClass("editable").dblclick(function(e) { e.preventDefault(); val = parseFloat( $(this).html() ); diff --git a/public_html_admin/legumes.php b/public_html_admin/legumes.php index ea256d3..56d2019 100644 --- a/public_html_admin/legumes.php +++ b/public_html_admin/legumes.php @@ -49,15 +49,22 @@ if(isset($_REQUEST["ref"]) && (int)$_REQUEST["ref"]>0 && $action) { // TARIFS foreach($datas["tarifs"] as $t) { + // ADD if($t['ref'] == "new") { $t['legume'] = $id; $r = addLegumeTarif($t); if(!(int)$r>0) die("ERREUR : une errreur est survenue durant l'enregistrement du nouveau tarif du légume. ($r)"); } + // DELETE else if((int)$t['ref']>0 && (int)$t['del']>0) { $r = eraseLegumeTarif(intval($t['ref'])); if(!(int)$r>0) die("ERREUR : une errreur est survenue durant la suppression du tarif du légume. ($r)"); } + // UPDATE + else if((int)$t['ref']>0) { + $r = updateLegumeTarif(intval($t['ref']), $t); + if(!(int)$r>0) die("ERREUR : une errreur est survenue durant la mise à jour du tarif du légume. ($r)"); + } } die( strval( updateLegume($id,$datas) ) ); @@ -99,18 +106,24 @@ switch($action) { case "autocomplete_list": die( json_encode( getLegumesAutocompleteList() ) ); break; // DEFAULT - LIST default: { + // PRINT + $print = isset($_REQUEST["action"]) && $_REQUEST["action"]=="printList"; + // SEARCH $search = getSearch("legumes_search"); // LIMITS - $limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbLegumesInList($search)); - if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) { - $limits['start'] = intval($_REQUEST['startListAt']); - $limits['end'] = $limits['start'] + $limits['nbItemsByPage']; - if($limits['end'] > $limits['max']) $limits['end'] = $limits['max']; - } - $limits['rest'] = $limits['max'] - $limits['end']; - $GLOBALS['smarty'] -> assign('list_limits',$limits); + if($print) $limits = false; + else { + $limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbLegumesInList($search)); + if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) { + $limits['start'] = intval($_REQUEST['startListAt']); + $limits['end'] = $limits['start'] + $limits['nbItemsByPage']; + if($limits['end'] > $limits['max']) $limits['end'] = $limits['max']; + } + $limits['rest'] = $limits['max'] - $limits['end']; + $GLOBALS['smarty'] -> assign('list_limits',$limits); + } // LIST $grps = getPaniersGroupesList(); @@ -133,6 +146,8 @@ switch($action) { $limits["list"] = $GLOBALS['smarty']->fetch("legumes/legumes_list_builder.tpl"); die(json_encode($limits)); } + // PRINT + else if($print) printLegumesList(); // TEMPLATE $GLOBALS['template'] = 'legumes/legumes_list.tpl'; diff --git a/public_html_admin/livraisons.php b/public_html_admin/livraisons.php index f295274..21eaa7c 100644 --- a/public_html_admin/livraisons.php +++ b/public_html_admin/livraisons.php @@ -53,11 +53,12 @@ if(isset($_REQUEST["ref"]) && (int)$_REQUEST["ref"]>0 && $action) { $GLOBALS['smarty'] -> assign('infos', $infos); $types = array( - "full" => array("tpl" => "livraisons/prints/livraison_print_full.tpl", "fn" => "", "orientation" => "portrait"), - "paniers" => array("tpl" => "livraisons/prints/livraison_print_paniers.tpl", "fn" => "-liste_paniers_", "orientation" => "portrait"), - "compo" => array("tpl" => "livraisons/prints/livraison_print_compo.tpl", "fn" => "-compo_paniers_", "orientation" => "portrait"), - "legumes" => array("tpl" => "livraisons/prints/livraison_print_legumes.tpl", "fn" => "-total_legumes_", "orientation" => "portrait"), - "emargement" => array("tpl" => "livraisons/prints/livraison_print_emargement.tpl", "fn" => "-emargement_", "orientation" => "landscape") + "full" => array("tpl" => "livraisons/prints/livraison_print_full.tpl", "fn" => "", "orientation" => "portrait"), + "paniers" => array("tpl" => "livraisons/prints/livraison_print_paniers.tpl", "fn" => "-liste_paniers_", "orientation" => "portrait"), + "compo" => array("tpl" => "livraisons/prints/livraison_print_compo.tpl", "fn" => "-compo_paniers_", "orientation" => "portrait"), + "legumes" => array("tpl" => "livraisons/prints/livraison_print_legumes.tpl", "fn" => "-total_legumes_", "orientation" => "portrait"), + "legumes_distrib" => array("tpl" => "livraisons/prints/livraison_print_legumes_distrib.tpl", "fn" => "-distribution_", "orientation" => "landscape"), + "emargement" => array("tpl" => "livraisons/prints/livraison_print_emargement.tpl", "fn" => "-emargement_", "orientation" => "landscape") ); if(isset($_REQUEST['type']) && array_key_exists($_REQUEST['type'], $types)) { $type = $types[$_REQUEST['type']]; @@ -80,6 +81,7 @@ if(isset($_REQUEST["ref"]) && (int)$_REQUEST["ref"]>0 && $action) { // EDIT case "edit": { $datas = getLivraisonDatasFromRequest(); + $r = updateLivraison($id,$datas); if((int)$r>0) { @@ -89,12 +91,12 @@ if(isset($_REQUEST["ref"]) && (int)$_REQUEST["ref"]>0 && $action) { // ADD PANIERS foreach($datas['paniers'] as $i => $contrat) { - $datas = array( 'livraison' => $id, 'contrat' => intval($contrat) ); + $p = array( 'livraison' => $id, 'contrat' => intval($contrat) ); if(array_key_exists($contrat, $infos["paniers"])) { - $datas["complement"] = $infos["paniers"][$contrat]["complement"]; - $datas["complement_regle"] = $infos["paniers"][$contrat]["complement_regle"]; + $p["complement"] = $infos["paniers"][$contrat]["complement"]; + $p["complement_regle"] = $infos["paniers"][$contrat]["complement_regle"]; } - $r = addLivraisonPanier($datas); + $r = addLivraisonPanier($p); if($r!==true) die("ERREUR : une erreur est survenu durant l'enregistrement du panier de la livraison ($r)"); } diff --git a/public_html_admin/templates/contrats/contrats_list_print.tpl b/public_html_admin/templates/contrats/contrats_list_print.tpl new file mode 100644 index 0000000..6eacbd1 --- /dev/null +++ b/public_html_admin/templates/contrats/contrats_list_print.tpl @@ -0,0 +1,58 @@ + +{foreach from=$cssFiles item=file} + +{/foreach} + + + + + + + + + +
{$date}
{$time}
+ LISTE DES CONTRATS + {if $list|@count==1} + {assign var=first value=$list|@key} +
{$list.$first.nom} + {if $list.$first.lieux|@count>1}
({$list.$first.nb_contrats} contrat{if $list.$first.nb_contrats>1}s{/if}){/if} + {/if} +
+ +{foreach from=$list item=groupe name=list} + {if $list|@count>1} +

{$groupe.nom}

+

({$groupe.nb_contrats} contrat{if $groupe.nb_contrats>1}s{/if})

+ {/if} + {foreach from=$groupe.lieux item=lieu} + + + + + + + + + + + + + + {foreach from=$lieu.paniers item=pType} + + + + {foreach from=$pType.contrats item=c} + + + + + + {/foreach} + {/foreach} + +
{if $list|@count>1}{$groupe.nom|upper} - {/if}{$lieu.nom}{$lieu.nb_contrats} contrat{if $lieu.nb_contrats>1}s{/if}
clientfréquencenb. de paniers restant
{$pType.type_nom} (x{$pType.nb_contrats})
{$c.client_prenom} {$c.client_nom}{$c.frequence_print}{$c.nb_paniers_restants} / {$c.nb_paniers}
+ {/foreach} +{/foreach} + \ No newline at end of file diff --git a/public_html_admin/templates/contrats/contrats_secondbar.tpl b/public_html_admin/templates/contrats/contrats_secondbar.tpl index 185e49a..791fdcb 100644 --- a/public_html_admin/templates/contrats/contrats_secondbar.tpl +++ b/public_html_admin/templates/contrats/contrats_secondbar.tpl @@ -52,6 +52,8 @@ {if $search!=""}{/if} + + diff --git a/public_html_admin/templates/legumes/legume_form.tpl b/public_html_admin/templates/legumes/legume_form.tpl index cd42e76..6f0dccd 100644 --- a/public_html_admin/templates/legumes/legume_form.tpl +++ b/public_html_admin/templates/legumes/legume_form.tpl @@ -27,7 +27,7 @@ date : - + diff --git a/public_html_admin/templates/legumes/legumes_list_print.tpl b/public_html_admin/templates/legumes/legumes_list_print.tpl new file mode 100644 index 0000000..7372783 --- /dev/null +++ b/public_html_admin/templates/legumes/legumes_list_print.tpl @@ -0,0 +1,37 @@ + +{foreach from=$cssFiles item=file} + +{/foreach} + + + + + + + + + +
{$date}
{$time}
TARIF{if $groupes|@count>1}S{/if} LEGUMES
+ + + + + {foreach from=$groupes item=g}{/foreach} + + + + {foreach from=$list item=i} + + + {foreach from=$groupes item=g} + + {/foreach} + + {foreachelse} + + + + {/foreach} + +
légumetarif {$g.nom}
{$i.nom}{if $i.tarifs[$g.ref].ref>0}{$i.tarifs[$g.ref].print}{else}.{/if}
aucun légume
+ \ No newline at end of file diff --git a/public_html_admin/templates/legumes/legumes_secondbar.tpl b/public_html_admin/templates/legumes/legumes_secondbar.tpl index 19f8709..5942b70 100644 --- a/public_html_admin/templates/legumes/legumes_secondbar.tpl +++ b/public_html_admin/templates/legumes/legumes_secondbar.tpl @@ -14,6 +14,7 @@ {if $search!=""}{/if} + diff --git a/public_html_admin/templates/livraisons/livraison_modal_view.tpl b/public_html_admin/templates/livraisons/livraison_modal_view.tpl index e886962..9a05f8f 100644 --- a/public_html_admin/templates/livraisons/livraison_modal_view.tpl +++ b/public_html_admin/templates/livraisons/livraison_modal_view.tpl @@ -20,6 +20,7 @@
  • Complet
  • +
  • Feuille de distribution
  • diff --git a/public_html_admin/templates/livraisons/prints/livraison_print_compo.tpl b/public_html_admin/templates/livraisons/prints/livraison_print_compo.tpl index a422dbd..f5cb052 100644 --- a/public_html_admin/templates/livraisons/prints/livraison_print_compo.tpl +++ b/public_html_admin/templates/livraisons/prints/livraison_print_compo.tpl @@ -4,7 +4,7 @@ {/foreach} - +
    diff --git a/public_html_admin/templates/livraisons/prints/livraison_print_emargement.tpl b/public_html_admin/templates/livraisons/prints/livraison_print_emargement.tpl index be51e97..2e14b92 100644 --- a/public_html_admin/templates/livraisons/prints/livraison_print_emargement.tpl +++ b/public_html_admin/templates/livraisons/prints/livraison_print_emargement.tpl @@ -4,7 +4,7 @@ {/foreach} - +
    diff --git a/public_html_admin/templates/livraisons/prints/livraison_print_full.tpl b/public_html_admin/templates/livraisons/prints/livraison_print_full.tpl index cb129c8..d009e58 100644 --- a/public_html_admin/templates/livraisons/prints/livraison_print_full.tpl +++ b/public_html_admin/templates/livraisons/prints/livraison_print_full.tpl @@ -4,7 +4,7 @@ {/foreach} - +
    diff --git a/public_html_admin/templates/livraisons/prints/livraison_print_legumes.tpl b/public_html_admin/templates/livraisons/prints/livraison_print_legumes.tpl index 7f88789..afa1896 100644 --- a/public_html_admin/templates/livraisons/prints/livraison_print_legumes.tpl +++ b/public_html_admin/templates/livraisons/prints/livraison_print_legumes.tpl @@ -4,7 +4,7 @@ {/foreach} - +
    diff --git a/public_html_admin/templates/livraisons/prints/livraison_print_legumes_distrib.tpl b/public_html_admin/templates/livraisons/prints/livraison_print_legumes_distrib.tpl new file mode 100644 index 0000000..bf5615e --- /dev/null +++ b/public_html_admin/templates/livraisons/prints/livraison_print_legumes_distrib.tpl @@ -0,0 +1,45 @@ + +{foreach from=$cssFiles item=file} + +{/foreach} + +{assign var=repeatLegume value=$infos.paniers_types|@count==2} + + +
    +
    + + + + + +
    + LIVRAISON {$infos.paniers_groupe_nom|upper}
    + {$infos.date_long_print} +
    FEUILLE DE DISTRIBUTION
    + + + + {foreach from=$infos.paniers_types item=p name=types} + {if ($repeatLegume && !$smarty.foreach.types.first && $infos.paniers_types|@count>1) + || (!$repeatLegume && $smarty.foreach.types.first) } + {/if} + + {/foreach} + + + + {foreach from=$infos.legumes_distrib item=l name=legumes} + + {foreach from=$infos.paniers_types item=p name=types} + {if ($repeatLegume && !$smarty.foreach.types.first && $infos.paniers_types|@count>1) + || (!$repeatLegume && $smarty.foreach.types.first) } + {/if} + + {/foreach} + + {/foreach} + +
    {$p.type_nom|upper}
    {$l.nom|upper}{if $l.paniers[$p.type_ref].quantite>0}{$l.paniers[$p.type_ref].quantite_print}{else}/{/if}
    +
    + \ No newline at end of file diff --git a/public_html_admin/templates/livraisons/prints/livraison_print_paniers.tpl b/public_html_admin/templates/livraisons/prints/livraison_print_paniers.tpl index 6e1dae6..4b17918 100644 --- a/public_html_admin/templates/livraisons/prints/livraison_print_paniers.tpl +++ b/public_html_admin/templates/livraisons/prints/livraison_print_paniers.tpl @@ -4,7 +4,7 @@ {/foreach} - +