Couplage des deux montants en php

maria -  
ChrisCompote Messages postés 44 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

j'ais un tableau contient les listes des deux tables en php (factures et attachement)
dans ce tableau la table facture contient: Num_attachement ,Montanttotale
et la table attachement : num_attachement,montanttotale
dans ce tableux j ai ajouter un colonne pour coupler ces deux table par
le numero
d attachement qui est commun entre les deux tables
"un couple (fature, attachement)avait le meme numero d attachement"
je veux mettre a l utilisateur le choix de choisir :si le couple (montant facture = montant attachement )dans ce cas le montant
choisi par defaut c ést le montant facture

- si le couple (montant fature # montant attachement) dans ce cas on met le
choix a l utilisateur de choisir soit montant facture soit montant attachement
ou le minimum entre les deux
mai je sais comment faire Pourriez-vous m'aider svp ?
et merci en avance

1 réponse

  1. ChrisCompote Messages postés 44 Date d'inscription   Statut Membre Dernière intervention   8
     
    J'imagine un tableau php
    $tab = array(
    array('num_attachement'=>...,'montanttotale_facture'=>...,'montanttotale_attachement'=>...),(...)
    );

    L'idée est la suivante
    $html = "<table>";
    foreach($tab as $sous_tab)
    {
    $html .= "<tr><td>";
    $html .= $sous_tab['num_attachement'];
    $html .= "</td><td>";
    $html .= $sous_tab['montanttotale_facture'];
    $html .= "</td><td>";
    $html .= $sous_tab['montanttotale_attachement'];
    $html .= "</td><td>";
    if($sous_tab['montanttotale_facture'] == $sous_tab['montanttotale_attachement'])
    {
    $html .= "Aucun choix";
    }
    if($sous_tab['montanttotale_facture'] == '')
    {
    $html .= "Choix 'montanttotale_attachement'";
    }
    if($sous_tab['montanttotale_attachement'] == '')
    {
    $html .= "Choix 'montanttotale_facture'";
    }
    if($sous_tab['montanttotale_facture'] != '' &&
    $sous_tab['montanttotale_attachement'] != '' &&
    $sous_tab['montanttotale_facture'] != sous_tab['montanttotale_attachement'])
    {
    $html .= "Choix 'montanttotale_facture' ou 'attachement'";
    if($sous_tab['montanttotale_facture'] < sous_tab['montanttotale_attachement'])
    $html .= "Choix minimum ( 'montanttotale_facture')";
    if($sous_tab['montanttotale_attachement'] < sous_tab['montanttotale_facture'])
    $html .= "Choix minimum ( 'montanttotale_attachement')";
    }
    $html .= "</td></tr>";
    }
    $html .= "</table>";

    Voilà l'idée, à toi de faire la présentation pour laisser effectivement le choix
    (case à cocher, liste déroulante, lien ...)
    0