alpha_full/pages/panier/options.lignes.php
2026-04-06 22:58:51 +02:00

104 lines
5.4 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
$prixOptTab=array();
$quantiteOptTab=array();
$libTraduitOptTab=array();
$tvaTauxOptTab=array();
$tvaMontOptTab=array();
// ---------------------------------------------------
// Formulaire des options : recup des options payantes en BD
// ---------------------------------------------------
if ($idCde!='' && $idPrd!='') {
// ---------------------------------------------------
// Recup options
// ---------------------------------------------------
$reqSelect="SELECT * from prdOptions WHERE idCde =" .$idCde. " and idLgCde=" .$idLgCdeTab[$j]. " and idPrd=" .$idPrd. ";";
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['Requête Select options from cde' => $reqSelect ] , ''); }
$resConn='';
try {
$resConn=$idPdo->query($reqSelect);
if ($resConn) {
try {
$o = 0;
$libellesArt .= "<ul>";
while ($result = $resConn->fetch(PDO::FETCH_ASSOC)) {
// pour le formulaire on veut retrouver les items depuis la db et pas la session
// $_SESSION['itemNumberFromDb'][$o]=$result['itemNumber'];
// fetch suite
$idLigneOpt[$o] = $result['idLigne'];
$numListe[$o] = $result['numListe'];
$prixOptTab[$o] = $result['prixTotTTC'];
$quantiteOptTab[$o] = $result['quantite'];
$libTraduitOptTab[$o] = $result['libTraduit'];
$tvaTauxOptTab[$o] = $result['tvaTaux'];
$tvaMontOptTab[$o] = $result['tvaMontant'];
$prixOptTab[$o] = formatNB($prixOptTab[$o], $lg);
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug (2, ['quantiteOptTab' => $quantiteOptTab[$o], 'libTraduitOptTab' => $libTraduitOptTab[$o], 'prixOptTab' => $prixOptTab[$o] ] , ''); }
// ---------------------------------------------------
// Pour le mail
// ---------------------------------------------------
$libellesArt .= "<li>" . $quantiteOptTab[$o] . " " . $libTraduitOptTab[$o] . " " . $prixOptTab[$o] . " &#128;</li>";
// ---------------------------------------------------
// Formulaire des options : affichage
// ---------------------------------------------------
echo '<div style="display:flex; width:100%; border-top:1px dashed lightblue;" >';
// ---------------------------------------------------
// Affichage du nom option
// ---------------------------------------------------
if ( $affMContext === true ) echo '<div class="champsPanierCell" cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanierCell\', 6, \'cde\', 4, 0, event);" >';
else echo '<div class="champsPanierCell" >';
echo '<i data-tooltip="Options" style="cursor:pointer;" onClick="window.location=\'panier-valide-' . $qteTab[$j] . '-' . $idPrd . '-' . $numListe[$o] . '-' . $idCde . '-' . $idLgCdeTab[$j] . '-' . $idLigneOpt[$o] . '\';" ></i>';
echo '&#160;';
if ( $affMContext === true ) echo '<span class="champsPanier" style="cursor:context-menu" ' .$mouseOverMenuContext. ' onContextMenu="return mContextuel(this, \'champsPanier\', \'cde\', 4, event);" >';
// if ( $affMContext === true ) echo '<span class="champsPanier" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanier\', 7, \'cde\', 4, 0, event);" >';
else echo '<span class="champsPanier" >';
echo $libTraduitOptTab[$o];
echo '</span>';
echo '</div>';
// ---------------------------------------------------
// Affichage de rien (pas de reduc)
// ---------------------------------------------------
echo '<div class="champsPanierCell" >';
echo '<span class="champsPanier" >';
echo '</span>';
echo '</div>';
// ---------------------------------------------------
// Quantité opt
// ---------------------------------------------------
if ( $affMContext === true ) echo '<div class="champsPanierCell" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanierCell\', 6, \'cde\', 4, 0, event);" >&#160;';
else echo '<div class="champsPanierCell">&#160;';
echo $quantiteOptTab[$o];
echo '</div>';
// ---------------------------------------------------
// TTC opt
// ---------------------------------------------------
if ( $affMContext === true ) echo '<div class="champsPanierCell" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanierCell\', 6, \'cde\', 4, 0, event);" >';
else echo '<div class="champsPanierCell" >';
echo '<span class="champsPanier">' . $prixOptTab[$o] . '&#160;&#128;&#160;</span>';
echo '</div>';
echo '</div>';
$o++;
}
$libellesArt .= "</ul>";
} catch (PDOException $e) {
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug (1, ['Erreur fetch options :' => $e->getMessage() ] , '');
}
}
}
} catch (PDOException $e) {
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug (1, ['Erreur PDO :' => $e->getMessage(), 'Erreur reqSelect :' => $reqSelect(), ] , ''); }
}
}
else if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (1, ['dCde ou idPrd vide dans options.lignes.php ! ' => $dCde ] , '') ;}
?>