0, (SELECT c.com_login FROM inscriptions_comptes c WHERE a.com_id = c.com_id), '') AS usager FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s WHERE s.sta_id = a.sta_id AND a.ach_id = " . intval($_GET['ach_id']);
$recCommandes = $db->fxGetRow($sqlCommandes);
if ($recCommandes == null) {
header('Location: commandes.php');
exit;
}
}
$sqlStatuts = "SELECT sta_id, sta_nom_fr FROM inscriptions_panier_statuts WHERE sta_actif = 1 AND sta_id >= 1 ORDER BY sta_nom_fr";
$recStatuts = $db->fxGetResults($sqlStatuts);
$sqlProvinces = "SELECT pro_id, pro_nom_fr FROM inscriptions_provinces ORDER BY pro_nom_fr";
$recProvinces = $db->fxGetResults($sqlProvinces);
$sqlPays = "SELECT pay_id, pay_nom_fr FROM inscriptions_pays ORDER BY pay_nom_fr";
$recPays = $db->fxGetResults($sqlPays);
?>
// ⚠️ CAPTURE_ID non fourni côté serveur.
//
';
return;
}
// Charger ta classe PayPal
require_once '../paypal_advanced/PaypalCheckout.class.php';
$paypal = new PayPalCheckout(); // adapte si nécessaire
// Préparation
$errors = [];
$successMsg = null;
// Devise par défaut si jamais les détails PayPal n’en donnent pas
$currencyUI = 'CAD';
// ====== Calculs initiaux côté serveur ======
// Solde dispo promoteur (ton helper existant)
$solde_dispo_ms1 = statut_payement($recCommandes["eve_id"]);
// Récupérer les détails PayPal de la capture
$paypaldetails = $paypal->paypaldetails($CAPTURE_ID);
// Harmoniser avec tes remboursements locaux si besoin
$paypaldetails = reconcileRefundsWithLocal($paypaldetails);
//print_rsl($paypaldetails);
// Déterminer le max remboursable PayPal
$max_remboursement_paypal = 0.0;
//print_rsl($paypaldetails);
// 1) S'il existe au moins un refund → on prend remaining (même si c’est 0)
if (isset($paypaldetails['refunds']['totals']['remaining'])) {
$max_remboursement_paypal = (float)$paypaldetails['refunds']['totals']['remaining'];
}
// 2) Sinon → fallback : montant total capturé
else {
if (!empty($paypaldetails['details']['amount']['value'])) {
$max_remboursement_paypal = (float)$paypaldetails['details']['amount']['value'];
} elseif (!empty($paypaldetails['delails']['amount']['value'])) {
$max_remboursement_paypal = (float)$paypaldetails['delails']['amount']['value'];
}
}
// Déterminer la devise d’affichage si fournie par PayPal
if (!empty($paypaldetails['refunds']['totals']['currency'])) {
$currencyUI = (string)$paypaldetails['refunds']['totals']['currency'];
} elseif (!empty($paypaldetails['details']['amount']['currency_code'])) {
$currencyUI = (string)$paypaldetails['details']['amount']['currency_code'];
} elseif (!empty($paypaldetails['delails']['amount']['currency_code'])) {
$currencyUI = (string)$paypaldetails['delails']['amount']['currency_code'];
}
// Frais MS1 (selon ta structure)
$frais_ms1 = (float)($recCommandes['fra_total'] ?? 0);
// Max remboursable à l’écran (ta logique actuelle)
$maxUI = $max_remboursement_paypal - $frais_ms1;
// maxblock = limite stricte d’input côté front, selon ton choix actuel
if ($max_remboursement_paypal < $solde_dispo_ms1) {
$maxblock = $max_remboursement_paypal;
} else {
$maxblock = 0;
$maxUI = 0;
}
// ******************** variable info
//print_rsl($recCommandes);
echosl( "no_commande : ".$recCommandes["no_commande"]);
echosl( "rem_ajoute_par : ".$_SESSION["usa_info"]["com_prenom"]." ".$_SESSION["usa_info"]["com_nom"]);
echosl( "eve_id : ".$recCommandes["eve_id"]) ;
echosl( "Montant remboursable : " . number_format($max_remboursement_paypal, 2) . " " . ($result['refunds']['totals']['currency'] ?? $result['delails']['amount']['currency_code'] ?? ''));
echo("solde dispo ms1 :");
echosl($solde_dispo_ms1);
echo("frais ms1 :");
$frais_ms1=$recCommandes['fra_total'];
echosl($frais_ms1);
echo("max Remboursement :");
// $maxUI le max Remboursement si on veux pas renbourcer les frais ms1
// $maxUI=$max_remboursement_paypal-$frais_ms1;
// $maxUI le max Remboursement
$maxUI=$max_remboursement_paypal;
echosl($maxUI);
$maxproposer = max(0, $maxUI - $frais_ms1);
// Helpers UI
?>
AjouterModifier une commande
Détails de la commande
PAYPAL
// ⚠️ CAPTURE_ID non fourni côté serveur.
// Remboursement PayPal (Checkout)
0): ?>
Capture: = h($CAPTURE_ID) ?>
Max remboursable (affiché): = h(money2($maxUI)) ?> = h($currencyUI) ?>
Aucun montant remboursable pour cette capture.
Détails PAYPAL
fxEscape($_GET['TrasactionID']) . "%'";
}
if (!empty($_GET['txt_commande'])) {
$where .= " AND a.no_commande LIKE '%" . $db->fxEscape($_GET['txt_commande']) . "%'";
$group = 0;
}
if (!empty($_GET['txt_no_panier'])) {
$where .= " AND a.no_panier LIKE '%" . $db->fxEscape($_GET['txt_no_panier']) . "%'";
$group = 0;
}
if (!empty($_GET['txt_prenom'])) {
$where .= " AND a.com_prenom LIKE '%" . $db->fxEscape($_GET['txt_prenom']) . "%'";
}
if (!empty($_GET['txt_nom'])) {
$where .= " AND a.com_nom LIKE '%" . $db->fxEscape($_GET['txt_nom']) . "%'";
}
if (!empty($_GET['txt_courriel'])) {
$where .= " AND a.com_courriel LIKE '%" . $db->fxEscape($_GET['txt_courriel']) . "%'";
}
if (!empty($_GET['TransactionID'])) {
$where .= " AND a.TransactionID LIKE '%" . $db->fxEscape($_GET['TransactionID']) . "%'";
}
if ($group == 1){
//$group = " GROUP BY a.no_commande";
$group = '';}
else{
$group = '';}
$sqlCommandes = "SELECT SQL_CALC_FOUND_ROWS (SELECT e.eve_nom_fr FROM inscriptions_evenements e WHERE e.eve_id = a.eve_id) AS evenement,a.ach_id, a.no_commande, a.TransactionID, a.com_prenom, a.com_nom, a.com_courriel, a.no_panier, a.ach_maj, s.sta_id, s.sta_nom_fr, a.ach_total, a.pai_id, a.ach_lang, a.com_id, IF(a.com_id <> 0, (SELECT c.com_login FROM inscriptions_comptes c WHERE a.com_id = c.com_id), '') AS usager,a.paypal_source,a.paypal_card_brand,a.paypal_card_last_digits FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s WHERE s.sta_id = a.sta_id $where $group ORDER BY a.ach_maj DESC, a.no_commande DESC";
$sqlCommandes .= $limit;
$recCommandes = $db->fxGetResults($sqlCommandes);
$nbTotal = $db->fxGetVar("SELECT FOUND_ROWS()");
//$nbTotal = 10000;
$sqlStatuts = "SELECT sta_id, sta_nom_fr FROM inscriptions_panier_statuts WHERE sta_actif = 1 ORDER BY sta_nom_fr";
$recStatuts = $db->fxGetResults($sqlStatuts);
$sqlEvenements = "SELECT eve_id, eve_nom_fr FROM inscriptions_evenements WHERE DATE_SUB(CURDATE(),INTERVAL 3 MONTH) <= eve_date_fin ORDER BY eve_nom_fr";
$recEvenements = $db->fxGetResults($sqlEvenements);
?>
Liste des commandes
| # | No commande | No panier | Nom, Prénom | Statut | TransactionID | Date de création | courriel | total | usager | paiement | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
0) { ?> | 1) { ?>facture | renvoyer confirmation | « précédent | suivant » | ||||||||
|
Il n'y a aucune commande pour le moment.
|
0) { echo fxShowPaging('commandes.php?' . $strQueryPager, $nbTotal, $nb, $page); } } ?>