Facture en php
nahac83
-
titi5494 Messages postés 50 Date d'inscription Statut Membre Dernière intervention -
titi5494 Messages postés 50 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
je suis debutante en php je suis en train de realiser une application de gestion en php lors de la creation de la facture j'ai mis le code suivant:<?php
session_start (); // création d'une nouvelle session ***********************
//réinitialisation des sessions ********************************************
if(isset($_POST['reset']))
{
session_unregister('selectp');
}
// fin réinitialisation des sessions ****************************************
// deselectionner un produit ***********************************************
$sDelProd = (isset($_GET['iDelProd'])) ? $_GET['iDelProd'] : '';
if($sDelProd !="")
{ if(isset($_SESSION['selectp']))
{
$aDelProd[] = $_GET['iDelProd'];
$aSelectedProd = explode(",", $_SESSION['selectp']);
$iNbr = count($aSelectedProd);
$aSelectedProd = array_diff($aSelectedProd,$aDelProd);
$_SESSION['selectp'] = implode(',', $aSelectedProd);
if($iNbr ==1) session_unregister('selectp');
header('location:Ajouter_facture2.php');
}
}
// fin deselctionner un produit *********************************************
// variables de connexion **************************************************
$database = "gestion_stock";
$user = "root";
$pwd = "";
$host = "localhost";
// fin variables de connexion **********************************************
// connexion au serveur mysql
mysql_pconnect($host,$user,$pwd) or die("Erreur d'accès au serveur Mysql");
// selection de la base de données
mysql_select_db($database) or die("Erreur de selection de la base de données");
// Inialisation des variables utilisateur ********************************
$iSelectedProd = (isset($_POST['refp'])) ? $_POST['refp'] : '';
if($iSelectedProd != "")
{
if(isset($_SESSION['selectp'])) {$_SESSION['selectp'] .= ",".$iSelectedProd;
}
else{$_SESSION['selectp'] = $iSelectedProd;
}
}
// Fin Inialisation des variables utilisateur ****************************
$sSql = "SELECT ref FROM produit";
$iRes = mysql_query($sSql) or die(mysql_error());
$iNbr = mysql_num_rows($iRes);
while($aData = mysql_fetch_assoc($iRes))
{
$aListProd[] = $aData['ref'];
}
if(isset($_SESSION['selectp']) && isset($aListProd))
{
$aSelectedProd = explode(",", $_SESSION['selectp']);
$aProdNotSelected = array_diff($aListProd,$aSelectedProd);
}
else
{
$aProdNotSelected = $aListProd;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Facture</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="Layer5a">
<table width="402" height="219" border="0">
<tr>
<td width="396" bgcolor="#CCCCCC"><p><strong>MICROHARD Vente Materiel et Accessoire </strong></p>
<p><strong>Compte bancaire:</strong><strong><br />
</strong><strong>R.C:</strong></p>
<p><strong>Id_fiscal:</strong></p>
<p><strong>Art_impo:</strong></p>
<p><strong>Tel:0553524888</strong></p>
<p><strong>Adresse:Local N°2 Immeuble HADRI Azeffoun Centre </strong></p></td>
</tr>
</table>
</div>
<div id="Layer8"><img src="../../../EasyPHP 3.0/www/facture/IMAGES/Ajouter_facture_clip_image001_0002.gif" width="184" height="34" />
<div id="Layer18"> <strong><?php echo date("d/F/Y"); ?></strong></div>
</div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<form action="#" name="prod" method="post" enctype="multipart/form-data">
<p>
<label>
<select name="refp" size="0" onchange="javascript:document.prod.submit();">
<option value="">Choisir</option>
<?php
print_r($aProdNotSelected);
foreach($aProdNotSelected as $k=>$v)
{
?>
<option value="<?php echo $v; ?>">
<?php echo $v; ?>
</option>
<?php
}
?>
</select>
</label>
<label> </label>
<div id="Layer14">
<table width="1209" height="54" border="1">
<tr>
<td width="185"><strong>Reference</strong></td>
<td width="487"><strong>Designation</strong></td>
<td width="126"><strong>Quantite</strong></td>
<td width="135"><strong>Prix Unitaire </strong></td>
<td width="111"><strong>T.V.A</strong></td>
</tr>
</table>
</td>
<?php
mysql_free_result($iRes);
if(isset($aSelectedProd))
{
$aSelectedProd = array_unique($aSelectedProd);
foreach($aSelectedProd as $k=>$v)
{
$Sqlp = "SELECT * FROM produit WHERE ref ='".$v."' " ;
$ress = mysql_query($Sqlp);
$data = mysql_fetch_assoc($ress);
?>
<label> </label>
<table width="1208" border="1">
<tr>
<td width="208"> <label></label> <strong><spacer /><?php echo $data['ref'];?></strong>
<br/>
<td width="547" height="35"><strong><?php echo $data['nom'];?>
</strong></td>
<td width="142" height="35"><strong><?php echo $data['Quantite'];?></strong></td>
<td width="152" height="35"><strong><?php echo $data['prix_achat'];?></strong></td>
<td width="125" height="35"><label>
<select name="select2">
<option>07</option>
<option>17</option>
</select>
</label><a href="Ajouter_facture2.php?iDelProd=<?php echo $data['ref']; ?>">Enlever</a></td>
</tr>
</table>
<div align="right">
<?php
}
}
?>
</div>
<p align="right"> </p>
</div>
</p>
<div id="Layer17">
<label>
<input type="submit" name="valider" value="Valider" />
</label>
<label>
<input type="submit" name="reset" value="Réinitialiser" />
</label>
</div> <p> </p>
<p> </p>
<div id="Layer10">
<p>
</p>
</form>
<p> </p>
</div>
</div>
</body>
</html>
//***************************************************
A la place de quantite recupere de la base de donnee je veux ecrire moi meme la quantite et dès que je clique ca va calculer le montant.
comment faire svp.
je suis debutante en php je suis en train de realiser une application de gestion en php lors de la creation de la facture j'ai mis le code suivant:<?php
session_start (); // création d'une nouvelle session ***********************
//réinitialisation des sessions ********************************************
if(isset($_POST['reset']))
{
session_unregister('selectp');
}
// fin réinitialisation des sessions ****************************************
// deselectionner un produit ***********************************************
$sDelProd = (isset($_GET['iDelProd'])) ? $_GET['iDelProd'] : '';
if($sDelProd !="")
{ if(isset($_SESSION['selectp']))
{
$aDelProd[] = $_GET['iDelProd'];
$aSelectedProd = explode(",", $_SESSION['selectp']);
$iNbr = count($aSelectedProd);
$aSelectedProd = array_diff($aSelectedProd,$aDelProd);
$_SESSION['selectp'] = implode(',', $aSelectedProd);
if($iNbr ==1) session_unregister('selectp');
header('location:Ajouter_facture2.php');
}
}
// fin deselctionner un produit *********************************************
// variables de connexion **************************************************
$database = "gestion_stock";
$user = "root";
$pwd = "";
$host = "localhost";
// fin variables de connexion **********************************************
// connexion au serveur mysql
mysql_pconnect($host,$user,$pwd) or die("Erreur d'accès au serveur Mysql");
// selection de la base de données
mysql_select_db($database) or die("Erreur de selection de la base de données");
// Inialisation des variables utilisateur ********************************
$iSelectedProd = (isset($_POST['refp'])) ? $_POST['refp'] : '';
if($iSelectedProd != "")
{
if(isset($_SESSION['selectp'])) {$_SESSION['selectp'] .= ",".$iSelectedProd;
}
else{$_SESSION['selectp'] = $iSelectedProd;
}
}
// Fin Inialisation des variables utilisateur ****************************
$sSql = "SELECT ref FROM produit";
$iRes = mysql_query($sSql) or die(mysql_error());
$iNbr = mysql_num_rows($iRes);
while($aData = mysql_fetch_assoc($iRes))
{
$aListProd[] = $aData['ref'];
}
if(isset($_SESSION['selectp']) && isset($aListProd))
{
$aSelectedProd = explode(",", $_SESSION['selectp']);
$aProdNotSelected = array_diff($aListProd,$aSelectedProd);
}
else
{
$aProdNotSelected = $aListProd;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Facture</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="Layer5a">
<table width="402" height="219" border="0">
<tr>
<td width="396" bgcolor="#CCCCCC"><p><strong>MICROHARD Vente Materiel et Accessoire </strong></p>
<p><strong>Compte bancaire:</strong><strong><br />
</strong><strong>R.C:</strong></p>
<p><strong>Id_fiscal:</strong></p>
<p><strong>Art_impo:</strong></p>
<p><strong>Tel:0553524888</strong></p>
<p><strong>Adresse:Local N°2 Immeuble HADRI Azeffoun Centre </strong></p></td>
</tr>
</table>
</div>
<div id="Layer8"><img src="../../../EasyPHP 3.0/www/facture/IMAGES/Ajouter_facture_clip_image001_0002.gif" width="184" height="34" />
<div id="Layer18"> <strong><?php echo date("d/F/Y"); ?></strong></div>
</div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<form action="#" name="prod" method="post" enctype="multipart/form-data">
<p>
<label>
<select name="refp" size="0" onchange="javascript:document.prod.submit();">
<option value="">Choisir</option>
<?php
print_r($aProdNotSelected);
foreach($aProdNotSelected as $k=>$v)
{
?>
<option value="<?php echo $v; ?>">
<?php echo $v; ?>
</option>
<?php
}
?>
</select>
</label>
<label> </label>
<div id="Layer14">
<table width="1209" height="54" border="1">
<tr>
<td width="185"><strong>Reference</strong></td>
<td width="487"><strong>Designation</strong></td>
<td width="126"><strong>Quantite</strong></td>
<td width="135"><strong>Prix Unitaire </strong></td>
<td width="111"><strong>T.V.A</strong></td>
</tr>
</table>
</td>
<?php
mysql_free_result($iRes);
if(isset($aSelectedProd))
{
$aSelectedProd = array_unique($aSelectedProd);
foreach($aSelectedProd as $k=>$v)
{
$Sqlp = "SELECT * FROM produit WHERE ref ='".$v."' " ;
$ress = mysql_query($Sqlp);
$data = mysql_fetch_assoc($ress);
?>
<label> </label>
<table width="1208" border="1">
<tr>
<td width="208"> <label></label> <strong><spacer /><?php echo $data['ref'];?></strong>
<br/>
<td width="547" height="35"><strong><?php echo $data['nom'];?>
</strong></td>
<td width="142" height="35"><strong><?php echo $data['Quantite'];?></strong></td>
<td width="152" height="35"><strong><?php echo $data['prix_achat'];?></strong></td>
<td width="125" height="35"><label>
<select name="select2">
<option>07</option>
<option>17</option>
</select>
</label><a href="Ajouter_facture2.php?iDelProd=<?php echo $data['ref']; ?>">Enlever</a></td>
</tr>
</table>
<div align="right">
<?php
}
}
?>
</div>
<p align="right"> </p>
</div>
</p>
<div id="Layer17">
<label>
<input type="submit" name="valider" value="Valider" />
</label>
<label>
<input type="submit" name="reset" value="Réinitialiser" />
</label>
</div> <p> </p>
<p> </p>
<div id="Layer10">
<p>
</p>
</form>
<p> </p>
</div>
</div>
</body>
</html>
//***************************************************
A la place de quantite recupere de la base de donnee je veux ecrire moi meme la quantite et dès que je clique ca va calculer le montant.
comment faire svp.
A voir également:
- Facture en php
- Facture aliexpress ✓ - Forum Consommation & Internet
- Logiciel devis facture - Télécharger - Comptabilité & Facturation
- Easy php - Télécharger - Divers Web & Internet
- Free devis facture - Télécharger - Comptabilité & Facturation
- Payer facture free sans identifiant - Forum Consommation & Internet