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 80 81 82 83 84 85 86 87 88 89 90 91 92
|
<?php
/* ===== FRAIS GENERAUX ====================
1/ Connexion à la base
2/ On récupère l'ID du bien
*/
function record($compte)
{
if( !isset( $codeHtml ) ) $codeHtml = '';
if( !isset( $_POST['Button'] ) ) $_POST['Button'] = '';
if ($_POST['Button'] == 'Enregistrer')
{
$montant[] = isset($_POST[$compte.'n']) ? $_POST[$compte.'n'] : '';
$montant[] = isset($_POST[$compte.'n1']) ? $_POST[$compte.'n1'] : '';
$montant[] = isset($_POST[$compte.'n2']) ? $_POST[$compte.'n2'] : '';
$codeHtml = '<tr><td class="libelle">'.ucfirst($compte).'</td>
<td class="montant">'. $montant[0].'</td>
<td class="montant">'. $montant[1].'</td>
<td class="montant">'. $montant[2].'</td>
</tr>';
'<pre>'.print_r($montant).'</pre>';
}
elseif ($_POST['Button'] == 'Modifier')
{
}
else // (empty($_POST['Button']))
{
$codeHtml= '<tr>
<td class="libelle"><label for="'.str_replace(' ','', $compte).'">'.ucfirst($compte).'</label></td>
<td class="montant"><input type="text" class="" id="" size="6" name="'.str_replace(' ','',lcfirst($compte)).'n" /></td>
<td class="montant"><input type="text" class="" id="" size="6" name="'.str_replace(' ','',lcfirst($compte)).'n1" /></td>
<td class="montant"><input type="text" class="" id="" size="6" name="'.str_replace(' ','',lcfirst($compte)).'n2" /></td>
</tr>';
}
return $codeHtml;
}
?>
<div class="col-sm-8 blog-main">
<?php
if( !isset( $_POST['Button'] ) ) {
?>
<form id="" name="frmFraisgeneraux" method="post" action="index.php?page=4">
<?php
}
?>
<table class="table-width" cellspacing='0'>
<?php
echo '<tr><td colspan="4">ACHATS</td></tr>';
echo record('fournitures');
echo record('autres approvisionnements');
echo record('achat de materiel');
echo record('achat non stockes');
/*
echo '<tr><td colspan="4">AUTRES CHARGES EXTERNES</td></tr>';
echo record('sous traitance');
echo record('credit bail');
echo record('location immobilieres');
echo record('charges locatives');
echo record('entretien');
echo record('assurances');
echo record('divers');
echo '<tr><td colspan="4">AUTRES SERVICES EXTERIEURS</td></tr>';
echo record('sous traitance');
*/
?>
<tr>
<td colspan="4" style="text-align:center;">
<input type="submit" class="btn btn-primary" name="Button" value="Enregistrer">
<input type="submit" class="btn btn-primary" name="Button" value="Modifier">
</td>
</tr>
<?php //} ?>
<thead>
<th>Compte</th>
<th class="entete">Année N</th>
<th class="entete">Année N+1(P)</th>
<th class="entete">Année N+2(P)</th>
</thead>
</table>
<?php
if( !isset( $_POST['Button'] ) ) { echo '</form>'; }
?>
</div><!-- /.blog-main -->
</div><!-- /.row -->
</div><!-- /.container --> |
Partager