1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| <button id="add_article" class="btn btn-success">Ajouter un produit</button>
<button id="del_article" class="btn btn-danger">Supprimer le(s) produit(s)</button>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th width="2"></th>
<th width="80">Ref</th>
<th width="20">Ref Article</th>
<th width="20">Désign Article</th>
<th width="5">Unite</th>
<th width="10">Prix Unitaire</th>
<th width="10">Quantité</th>
<th width="5">Prix Net Unité</th>
<th width="15">Total</th>
</tr>
</thead>
<tbody id="table_article"> </tbody>
</table>
<!-- lignes ajoutés au tableau -->
<table id="fantome" style="display:none">
<tbody>
<tr>
<td><input type="checkbox" name="chkbox[]"></td>
<td>
<select type="text" class="form-control scope article_ref" style="width: 100%;" onchange="ref_to_rearticle(this.value)">
<option></option>
<?php $list = $bdd->query('SELECT * FROM produit WHERE produit_contact = "'.$_SESSION['Contact_id'].'" ORDER BY `produit_ref` ASC');
while ($data = $list->fetch()) { ?>
<option value="<?php echo $data['produit_ref']; ?>"><?php echo $data['produit_ref']; ?></option>
<?php } $list->closeCursor(); ?>
</select>
</td>
<td>
<div id="article_refarticle">
<?php $article_ref = isset($_POST['article_ref'])? $_POST['article_ref']:'null';
$requete = "SELECT * FROM produit WHERE produit_ref = $article_ref";
$requete = $bdd->prepare("SELECT * FROM produit WHERE produit_ref = $article_ref");
$stmt = $bdd->prepare($requete);
$stmt->bindValue('article_ref',strtoupper(($article_ref)),PDO::PARAM_STR);
$stmt->execute(); ?>
<?php while( $donnees = $stmt->fetch() ) { ?>
<input type="text" value="<?php echo $donnees['produit_nom'] ?>" />
<?php } ?>
</div>
</td>
<td><input type="text" class="form-control article_devis"></td>
<td><input type="text" class="form-control article_designationarticle"></td>
<td><input type="text" class="form-control article_pu"></td>
<td><input type="text" class="form-control article_unite"></td>
<td><input type="text" class="form-control article_quantite"></td>
<td><input type="text" class="form-control article_prixnetunite"></td>
</tr>
</tbody>
</table>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Retour</button>
<button id="bt_Envoi" class="btn btn-primary submit">Enregistrer le devis</button>
</div>
</div>
</div>
</div>
</div>
<script>
function ref_to_rearticle(name) {
$.ajax({
method: "POST",
url: "modal_header/Actions/ajoutdevis.php",
data: { article_ref: name }
})
.done(function( retour_html ) {
$("#article_refarticle").html( retour_html );
})
.fail(function() {
alert( "error facture creation ajax" );
});
}
</script> |
Partager