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
| <?php
$categories = array( 1=>'Freins', 2=>'Eclairage', 3=>'Filtres' );
$pieces[] = array('categorie'=> 2, 'designation' => 'Ampoule Narva R5W 12V 5W', 'ref' => '', 'ht' => 0, 'qte' => 1, 'tva' => 20);
$pieces[] = array('categorie'=> 2, 'designation' => 'Ampoule Narva P21W 12V', 'ref' => '', 'ht' => 0, 'qte' => 1, 'tva' => 20);
$pieces[] = array('categorie'=> 1, 'designation' => 'Disques de frein', 'ref' => 'DF1533', 'ht' => 107.42, 'qte' => 1, 'tva' => 20);
$pieces[] = array('categorie'=> 3, 'designation' => 'Filtre a air', 'ref' => 'A1045', 'ht' => 17.50, 'qte' => 1, 'tva' => 20);
$pieces[] = array('categorie'=> 3, 'designation' => 'Filtre a huile', 'ref' => 'ELH4213', 'ht' => 9.92, 'qte' => 1, 'tva' => 20);
$pieces[] = array('categorie'=> 3, 'designation' => 'Filtre habitacle', 'ref' => 'MFELR7004', 'ht' => 13.38, 'qte' => 1, 'tva' => 20);
$pieces[] = array('categorie'=> 1, 'designation' => 'Plaquettes de frein', 'ref' => '598488', 'ht' => 53.17, 'qte' => 1, 'tva' => 20);
$i = 0;
foreach ( $categories as $catid => $catnom )
{
echo '<h5>'.$catnom.'</h5>'."\n";
foreach ( $pieces as $i => $piece )
{
if( $piece['categorie'] == $catid){
echo '<div class="row">'."\n";
echo ' <label class="col-xs-5 col-sm-4 col-md-4 control-label" for="piece_' . $i . '">' . $piece['designation'] . '</label>'."\n";
echo ' <input type="checkbox" name="piece_' . $i . '" id="piece_' . $i . '">'."\n";
echo ' <input type="hidden" name="des_' . $i . '" id="des_' . $i . '" value="' . $piece['designation'] . '">'."\n";
echo ' <div class="col-xs-4 col-sm-3 col-md-2"><input type="text" class="form-control" name="ref_' . $i . '" id="ref_' . $i . '" value="' . $piece['ref'] . '"></div>'."\n";
echo ' <div class="col-xs-4 col-sm-3 col-md-2"><input type="text" class="form-control" name="ht_' . $i . '" id="ht_' . $i . '" value="' . $piece['ht'] . '"></div>'."\n";
echo ' <div class="col-xs-3 col-sm-2 col-md-1"><input type="text" class="form-control" name="qte_' . $i . '" id="qte_' . $i . '" value="' . $piece['qte'] . '"></div>'."\n";
echo ' <div class="col-xs-3 col-sm-2 col-md-1"><input type="text" class="form-control" name="tva_' . $i . '" id="tva_' . $i . '" value="' . $piece['tva'] . '"></div>'."\n";
echo '</div>'."\n";
}
}
}
?> |
Partager