80 lines
3.5 KiB
PHP
Executable File
80 lines
3.5 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
$totTtcCde=0;
|
|
$poidsCde=0;
|
|
$nbLignes=0;
|
|
$reducCdeTmp=0.00;
|
|
$reductionCde=0;
|
|
$tvaCde=0;
|
|
$etatCde='Pn';
|
|
$totalHtCde=0;
|
|
$totalTtcCde=0;
|
|
|
|
// ---------------------------------------------------
|
|
// Formatage pour calculs
|
|
// ---------------------------------------------------
|
|
$nbLignes=intval($nbLignes);
|
|
if (isset($debug[1]) && $debug[1] == '1' ) { $debugMsg .= monDebug (1, ['codeOpe' =>$codeOpe ] , 'panier.calculCde.php');
|
|
}
|
|
|
|
// ---------------------------------------------------
|
|
// Calcul qui ne changent pas //seront mis à jour apres
|
|
// ---------------------------------------------------
|
|
if (empty($today)) {
|
|
date_default_timezone_set( 'Europe/Paris' );
|
|
$dateTimeObj = new DateTime('now', new DateTimeZone('Europe/Paris'));
|
|
$today = IntlDateFormatter::formatObject( $dateTimeObj, "y-MM-dd_HH-mm", 'fr' );
|
|
}
|
|
$dateCdeCrea=$today;
|
|
include ("./pages/panier/_modeLivraison/modeLiv.takeDefaut.php");
|
|
include ("./pages/panier/_modePaiement/modePaie.takeDefaut.php");
|
|
|
|
// ---------------------------------------------------
|
|
// Boucle sur les lignes on recalcule tout
|
|
// quelque soit le codeOpe
|
|
include ("_reqPanier/panier.reqSelectLignes.php");
|
|
for($i=0;$i< count($idPrdTab);$i++) {
|
|
if ($idPrdTab[$i]!='') {
|
|
$nbLignes=$nbLignes+1;
|
|
$poidsCde=(float)$poidsCde+(float)$poidsTab[$i]; // => tout en kilos fait dans calcul lignes
|
|
$reductionCde=(float)$reductionCde+(float)$montantReducLigneTab[$i];
|
|
$totalHtCde=(float)$totalHtCde+(float)$prixUnitRemiseHtTab[$i]; //abandonné a l'affichage
|
|
$tvaCde=(float)$tvaCde+(float)$montantTvaLigneTab[$i];
|
|
$totalTtcCde=(float)$totalTtcCde+(float)$totTtcLigneTab[$i];
|
|
if (isset($debug[1]) && $debug[1] == '1') { $debugMsg .= monDebug (1, ['poidsCde' => $poidsCde, 'totalTtcCde' => $totalTtcCde ] , '') ; }
|
|
}
|
|
else {if (isset($debug[1]) && $debug[1] == '1' ) $debugMsg .= monDebug (1, ['poidsCde' => $poidsCde, 'idPrdTab vide dans panierCalculCde.php' => $idPrdTab[$i] ] , '') ; }
|
|
}
|
|
|
|
|
|
|
|
if (isset($debug[1]) && $debug[1] == '1') { $debugMsg .= monDebug (1, ['nbLignes' => $nbLignes, 'poidsCde' => $poidsCde , 'reductionCde' => $reductionCde , 'totalHtCde' => $totalHtCde , 'tvaCde' => $tvaCde , 'totalTtcCde' => $totalTtcCde ] , '') ; }
|
|
|
|
// ---------------------------------------------------
|
|
// Boucle sur les options et on continue le calcul general commande
|
|
// quelque soit le codeOpe
|
|
include ("panier.calculOptions.php");
|
|
|
|
// le float remet une virgule ....
|
|
$tvaCde = formatNB($tvaCde , $lg);
|
|
$totalHtCde=(float)$totalHtCde + (float)$montOptionHT;
|
|
$totalHtCde = str_replace(',' , '' , $totalHtCde);
|
|
$totalTtcCde=(float)$totalTtcCde + (float)$montOptionTTC;
|
|
$totalTtcCde = formatNB($totalTtcCde , $lg);
|
|
|
|
if (empty($totalCde) && isset($fpCdeTTC) ) {
|
|
$fpCdeTTC=(float)$fpCdeTTC + (float)$fpCdeTTC;
|
|
$fpCdeTTC = formatNB($fpCdeTTC , $lg);
|
|
$totalCde=(float)$totalTtcCde+(float)$fpCdeTTC;
|
|
}
|
|
|
|
if (isset($debug[1]) && $debug[1] == '1') { $debugMsg .= monDebug (1, ['montOptionHT' => $montOptionHT, 'montOptionTTC' => $montOptionTTC , 'totalHtCde' => $totalHtCde , 'totalTtcCde' => $totalTtcCde , 'totalCde' => $totalCde ] , '') ; }
|
|
|
|
// ---------------------------------------------------
|
|
// Si le panier a été vidé
|
|
// ---------------------------------------------------
|
|
if (count($idPrdTab)==0 || empty($idPrdTab)) {$totalHtCde=0 ; $totalTtcCde=0 ; $totalCde=0;}
|
|
$debugP=0;
|
|
if ($debugP==1) {include ("panier.debugCde.php");}
|
|
|
|
?>
|