Uniformisation lignes de commande, propal, facture
This commit is contained in:
parent
a7318c4e73
commit
f9c1769c1c
@ -335,15 +335,15 @@ if ($_socid > 0)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
}
|
}
|
||||||
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
|
$i = 0;
|
||||||
while ($i < $num && $i < $MAXLIST)
|
while ($i < $num && $i < $MAXLIST)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print "<td nowrap><a href=\"propal.php?propalid=$objp->propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a>\n";
|
print "<td nowrap><a href=\"propal.php?propalid=$objp->propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a>\n";
|
||||||
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 )
|
if ( ($objp->dp < time() - $conf->propal->cloture->warning_delay) && $objp->statutid == 1 )
|
||||||
{
|
{
|
||||||
print " <b>> 15 jours</b>";
|
print " ".img_warning();
|
||||||
}
|
}
|
||||||
print '</td><td align="right" width="80">'.dolibarr_print_date($objp->dp)."</td>\n";
|
print '</td><td align="right" width="80">'.dolibarr_print_date($objp->dp)."</td>\n";
|
||||||
print '<td align="right" width="120">'.price($objp->price).'</td>';
|
print '<td align="right" width="120">'.price($objp->price).'</td>';
|
||||||
@ -385,7 +385,7 @@ if ($_socid > 0)
|
|||||||
print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/liste.php?socidp='.$objsoc->id.'">'.$langs->trans("AllOrders").' ('.$num.')</td></tr></table></td>';
|
print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/liste.php?socidp='.$objsoc->id.'">'.$langs->trans("AllOrders").' ('.$num.')</td></tr></table></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
|
$i = 0;
|
||||||
while ($i < $num && $i < $MAXLIST)
|
while ($i < $num && $i < $MAXLIST)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
@ -432,7 +432,7 @@ if ($_socid > 0)
|
|||||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/contrat/liste.php?socid='.$objsoc->id.'">'.$langs->trans("AllContracts").' ('.$num.')</td></tr></table></td>';
|
print '<td align="right"><a href="'.DOL_URL_ROOT.'/contrat/liste.php?socid='.$objsoc->id.'">'.$langs->trans("AllContracts").' ('.$num.')</td></tr></table></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
|
$i = 0;
|
||||||
while ($i < $num && $i < $MAXLIST)
|
while ($i < $num && $i < $MAXLIST)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
@ -478,7 +478,7 @@ if ($_socid > 0)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
}
|
}
|
||||||
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
|
$i = 0;
|
||||||
while ($i < $num && $i < $MAXLIST)
|
while ($i < $num && $i < $MAXLIST)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
@ -857,15 +857,6 @@ if ($_socid > 0)
|
|||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
// Notes sur la societe
|
|
||||||
/*
|
|
||||||
if ($objsoc->note)
|
|
||||||
{
|
|
||||||
print '<table class="border" width="100%" bgcolor="#e0e0e0">';
|
|
||||||
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
|
|
||||||
print "</table>";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
|
|||||||
@ -65,6 +65,8 @@ $NBLINES=4;
|
|||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Actions */
|
/* Actions */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -179,20 +181,7 @@ if ($_POST['action'] == 'send')
|
|||||||
}
|
}
|
||||||
$actionmsg2='Envoi Propal par mail';
|
$actionmsg2='Envoi Propal par mail';
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if ($_POST["action"] == 'relance')
|
|
||||||
{
|
|
||||||
$subject = "Relance facture $propal->ref";
|
|
||||||
$actiontypeid=10;
|
|
||||||
$actionmsg="Mail envoyé par $from à $sendto.<br>";
|
|
||||||
if ($message)
|
|
||||||
{
|
|
||||||
$actionmsg.="Texte utilisé dans le corps du message:<br>";
|
|
||||||
$actionmsg.=$message;
|
|
||||||
}
|
|
||||||
$actionmsg2="Relance Facture par mail";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
$filepath[0] = $file;
|
$filepath[0] = $file;
|
||||||
$filename[0] = $propal->ref.'.pdf';
|
$filename[0] = $propal->ref.'.pdf';
|
||||||
$mimetype[0] = 'application/pdf';
|
$mimetype[0] = 'application/pdf';
|
||||||
@ -279,7 +268,7 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
|
|||||||
* Ajout d'une ligne produit dans la propale
|
* Ajout d'une ligne produit dans la propale
|
||||||
*/
|
*/
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$propal->fetch($_POST['propalid']);
|
$ret=$propal->fetch($_POST['propalid']);
|
||||||
|
|
||||||
if (isset($_POST['np_tva_tx']))
|
if (isset($_POST['np_tva_tx']))
|
||||||
{
|
{
|
||||||
@ -611,18 +600,20 @@ if ($_GET['propalid'])
|
|||||||
* Lignes de propale
|
* Lignes de propale
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$sql = 'SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
|
$sql = 'SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice,";
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
|
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
|
||||||
$sql .= ' WHERE pt.fk_propal = '.$propal->id;
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
|
||||||
$sql .= ' ORDER BY pt.rowid ASC';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
|
||||||
|
$sql.= ' WHERE pt.fk_propal = '.$propal->id;
|
||||||
|
$sql.= ' ORDER BY pt.rowid ASC';
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num_lignes = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0; $total = 0;
|
$i = 0; $total = 0;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
if ($num_lignes)
|
if ($num)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans('Description').'</td>';
|
print '<td>'.$langs->trans('Description').'</td>';
|
||||||
@ -635,7 +626,7 @@ if ($_GET['propalid'])
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
$var=true;
|
$var=true;
|
||||||
while ($i < $num_lignes)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -662,7 +653,7 @@ if ($_GET['propalid'])
|
|||||||
{
|
{
|
||||||
print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
|
print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
|
||||||
}
|
}
|
||||||
print $objp->description?'<br>'.$objp->description:'';
|
print ($objp->description && $objp->description!=$obj->product)?'<br>'.$objp->description:'';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -724,7 +715,8 @@ if ($_GET['propalid'])
|
|||||||
print '<td align="right"><input name="qty" type="text" size="2" value="'.$objp->qty.'"></td>';
|
print '<td align="right"><input name="qty" type="text" size="2" value="'.$objp->qty.'"></td>';
|
||||||
print '<td align="right" nowrap><input name="remise" type="text" size="2" value="'.$objp->remise_percent.'"> %</td>';
|
print '<td align="right" nowrap><input name="remise" type="text" size="2" value="'.$objp->remise_percent.'"> %</td>';
|
||||||
print '<td align="center" colspan="3"><input type="submit" value="'.$langs->trans("Save").'"></td>';
|
print '<td align="center" colspan="3"><input type="submit" value="'.$langs->trans("Save").'"></td>';
|
||||||
print '</tr></form>';
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$total = $total + ($objp->qty * $objp->price);
|
$total = $total + ($objp->qty * $objp->price);
|
||||||
|
|||||||
@ -45,16 +45,16 @@ require_once(DOL_DOCUMENT_ROOT."/project.class.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||||
|
|
||||||
/*
|
// Sécurité accés client
|
||||||
* Sécurité accés client
|
|
||||||
*/
|
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socidp = $user->societe_id;
|
$socidp = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Actions
|
||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'classin' && $user->rights->commande->creer)
|
if ($_POST["action"] == 'classin' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
@ -94,7 +94,6 @@ if ($_POST["action"] == 'add' && $user->rights->commande->creer)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer)
|
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
@ -112,27 +111,33 @@ if ($_POST["action"] == 'setnote' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
if ($_POST["action"] == 'addligne' && $user->rights->commande->creer)
|
if ($_POST["action"] == 'addligne' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
/*
|
||||||
$commande->fetch($_GET["id"]);
|
* Ajout d'une ligne produit dans la commande
|
||||||
|
*/
|
||||||
|
$commande = new Commande($db);
|
||||||
|
$ret=$commande->fetch($_POST["id"]);
|
||||||
|
|
||||||
if ($_POST["p_idprod"] > 0)
|
if (isset($_POST["p_idprod"]))
|
||||||
{
|
{
|
||||||
$result = $commande->addline("DESC",
|
$result = $commande->addline(
|
||||||
$_POST["pu"],
|
$_POST["np_desc"],
|
||||||
$_POST["pqty"],
|
$_POST["pu"],
|
||||||
$_POST["tva_tx"],
|
$_POST["pqty"],
|
||||||
$_POST["p_idprod"],
|
$_POST["tva_tx"],
|
||||||
$_POST["premise"]);
|
$_POST["p_idprod"],
|
||||||
|
$_POST["premise"]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = $commande->addline($_POST["desc"],
|
$result = $commande->addline(
|
||||||
$_POST["pu"],
|
$_POST["desc"],
|
||||||
$_POST["qty"],
|
$_POST["pu"],
|
||||||
$_POST["tva_tx"],
|
$_POST["qty"],
|
||||||
0,
|
$_POST["tva_tx"],
|
||||||
$_POST["remise_percent"]);
|
0,
|
||||||
|
$_POST["remise_percent"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer)
|
if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer)
|
||||||
@ -566,7 +571,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $commande->remise_percent.' %</td><td> ';
|
print $commande->remise_percent.'%</td><td> ';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -575,8 +580,7 @@ else
|
|||||||
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>';
|
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>';
|
||||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||||
|
|
||||||
print "</table>";
|
print '</table><br>';
|
||||||
|
|
||||||
if ($commande->brouillon == 1 && $user->rights->commande->creer)
|
if ($commande->brouillon == 1 && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -586,162 +590,174 @@ else
|
|||||||
* Lignes de commandes
|
* Lignes de commandes
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
echo '<br><table class="noborder" width="100%">';
|
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,';
|
||||||
|
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX."commandedet as l";
|
||||||
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
||||||
|
$sql.= " WHERE l.fk_commande = ".$commande->id;
|
||||||
|
$sql.= " ORDER BY l.rowid";
|
||||||
|
|
||||||
$sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice";
|
$resql = $db->query($sql);
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as l";
|
if ($resql)
|
||||||
$sql .= " WHERE l.fk_commande = ".$commande->id;
|
|
||||||
$sql .= " ORDER BY l.rowid";
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$i = 0; $total = 0;
|
|
||||||
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td width="54%">'.$langs->trans("Description").'</td>';
|
|
||||||
print '<td width="8%" align="center">'.$langs->trans("VAT").'</td>';
|
|
||||||
print '<td width="8%" align="center">'.$langs->trans("Qty").'</td>';
|
|
||||||
print '<td width="8%" align="right">'.$langs->trans("Discount").'</td>';
|
|
||||||
print '<td width="12%" align="right">'.$langs->trans("PriceU").'</td>';
|
|
||||||
print '<td width="10%"> </td><td width="10%"> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$var=true;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0; $total = 0;
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans('Description').'</td>';
|
||||||
|
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
||||||
|
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
|
||||||
|
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
|
||||||
|
print '<td align="right" width="50">'.$langs->trans('Discount').'</td>';
|
||||||
|
print '<td align="right" width="50">'.$langs->trans('AmountHT').'</td>';
|
||||||
|
print '<td> </td><td> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
$var=true;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($resql);
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
// Update ligne de propale
|
||||||
|
if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid)
|
||||||
|
{
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
if ($objp->fk_product > 0)
|
||||||
|
{
|
||||||
|
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
|
||||||
|
if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
|
||||||
|
else print img_object($langs->trans('ShowProduct'),'product');
|
||||||
|
print ' '.$objp->ref.'</a> - '.stripslashes(nl2br($objp->product));
|
||||||
|
print ($objp->description && $objp->description!=$objp->product)?'<br>'.$objp->description:'';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td>'.stripslashes(nl2br($objp->description));
|
||||||
|
print "</td>\n";
|
||||||
|
}
|
||||||
|
print '<td align="right">'.$objp->tva_tx.'%</td>';
|
||||||
|
|
||||||
|
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||||
|
|
||||||
|
print '<td align="right">'.$objp->qty.'</td>';
|
||||||
|
|
||||||
|
if ($objp->remise_percent > 0)
|
||||||
|
{
|
||||||
|
print '<td align="right">'.$objp->remise_percent."%</td>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td> </td>';
|
||||||
|
}
|
||||||
|
print '<td align="right">'.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."</td>\n";
|
||||||
|
|
||||||
|
// Icone d'edition et suppression
|
||||||
|
if ($commande->statut == 0 && $user->rights->commande->creer && $_GET["action"] == '')
|
||||||
|
{
|
||||||
|
print '<td align="right"><a href="fiche.php?id='.$id.'&action=editline&rowid='.$objp->rowid.'">';
|
||||||
|
print img_edit();
|
||||||
|
print '</a></td>';
|
||||||
|
print '<td align="right"><a href="fiche.php?id='.$id.'&action=deleteline&lineid='.$objp->rowid.'">';
|
||||||
|
print img_delete();
|
||||||
|
print '</a></td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td> </td><td> </td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update ligne de commande
|
||||||
|
if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid)
|
||||||
|
{
|
||||||
|
print "<form action=\"fiche.php?id=$id\" method=\"post\">";
|
||||||
|
print '<input type="hidden" name="action" value="updateligne">';
|
||||||
|
print '<input type="hidden" name="elrowid" value="'.$_GET["rowid"].'">';
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td colspan="2"><textarea name="eldesc" cols="60" rows="2">'.stripslashes($objp->description).'</textarea></td>';
|
||||||
|
print '<td align="right"><input size="7" type="text" class="flat" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||||
|
print '<td align="right"><input size="4" type="text" class="flat" name="elqty" value="'.$objp->qty.'"></td>';
|
||||||
|
print '<td align="right"><input size="3" type="text" class="flat" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
|
||||||
|
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$total = $total + ($objp->qty * $objp->price);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$db->free($resql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ajouter une ligne
|
||||||
|
*/
|
||||||
|
if ($commande->statut == 0 && $user->rights->commande->creer && $_GET["action"] == '')
|
||||||
|
{
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans('Description').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans('Discount').'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Ajout produit produits/services personalisés
|
||||||
|
print "<form action=\"fiche.php?id=$id\" method=\"post\">";
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
print '<input type="hidden" name="action" value="addligne">';
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
print '<tr '.$bc[$var].">\n";
|
||||||
|
print ' <td><textarea cols="50" name="desc" rows="1"></textarea></td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
print $html->select_tva("tva_tx",$conf->defaulttx);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right"><input type="text" name="pu" size="5"></td>';
|
||||||
|
print '<td align="right"><input type="text" name="qty" value="1" size="2"></td>';
|
||||||
|
print '<td align="right" nowrap><input type="text" name="remise_percent" size="2" value="0">%</td>';
|
||||||
|
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
// Ajout de produits/services prédéfinis
|
||||||
|
print "<form action=\"fiche.php?id=$id\" method=\"post\">";
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
print '<input type="hidden" name="action" value="addligne">';
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print '<tr '.$bc[$var].'>';
|
||||||
if ($objp->fk_product > 0)
|
print '<td colspan="2">';
|
||||||
{
|
$html->select_produits('','p_idprod','',20);
|
||||||
print '<td>';
|
print '<br>';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.stripslashes(nl2br($objp->description)).'</a></td>';
|
print '<textarea cols="50" name="np_desc" rows="1"></textarea>';
|
||||||
}
|
print '</td>';
|
||||||
else
|
print '<td> </td>';
|
||||||
{
|
print '<td align="right"><input type="text" size="2" name="pqty" value="1"></td>';
|
||||||
print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
|
print '<td align="right" nowrap><input type="text" size="2" name="premise" value="0">%</td>';
|
||||||
}
|
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
||||||
print '<td align="center">'.$objp->tva_tx.'%</td>';
|
print "</tr>\n";
|
||||||
print '<td align="center">'.$objp->qty.'</td>';
|
|
||||||
if ($objp->remise_percent > 0)
|
|
||||||
{
|
|
||||||
print '<td align="right">'.$objp->remise_percent."%</td>\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td> </td>';
|
|
||||||
}
|
|
||||||
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
|
||||||
if ($commande->statut == 0 && $user->rights->commande->creer && $_GET["action"] == '')
|
|
||||||
{
|
|
||||||
print '<td align="right"><a href="fiche.php?id='.$id.'&action=editline&rowid='.$objp->rowid.'">';
|
|
||||||
print img_edit();
|
|
||||||
print '</a></td>';
|
|
||||||
print '<td align="right"><a href="fiche.php?id='.$id.'&action=deleteline&lineid='.$objp->rowid.'">';
|
|
||||||
print img_delete();
|
|
||||||
print '</a></td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td> </td><td> </td>';
|
|
||||||
}
|
|
||||||
print "</tr>";
|
|
||||||
|
|
||||||
if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid)
|
print '</form>';
|
||||||
{
|
}
|
||||||
print "<form action=\"fiche.php?id=$id\" method=\"post\">";
|
|
||||||
print '<input type="hidden" name="action" value="updateligne">';
|
|
||||||
print '<input type="hidden" name="elrowid" value="'.$_GET["rowid"].'">';
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td colspan="2"><textarea name="eldesc" cols="60" rows="2">'.stripslashes($objp->description).'</textarea></td>';
|
|
||||||
print '<td align="center"><input size="4" type="text" class="flat" name="elqty" value="'.$objp->qty.'"></td>';
|
|
||||||
print '<td align="right"><input size="3" type="text" class="flat" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
|
|
||||||
print '<td align="right"><input size="7" type="text" class="flat" name="elprice" value="'.price($objp->subprice).'"></td>';
|
|
||||||
print '<td align="right" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td>';
|
|
||||||
print '</tr>' . "\n";
|
|
||||||
print "</form>\n";
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$db->free($result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ajouter une ligne
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($commande->statut == 0 && $user->rights->commande->creer && $_GET["action"] == '')
|
|
||||||
{
|
|
||||||
$sql = "SELECT p.rowid,p.label,p.ref,p.price FROM ".MAIN_DB_PREFIX."product as p ";
|
|
||||||
$sql .= " WHERE envente = 1";
|
|
||||||
$sql .= " ORDER BY p.nbvente DESC";
|
|
||||||
$sql .= " LIMIT 20";
|
|
||||||
if ( $db->query($sql) )
|
|
||||||
{
|
|
||||||
$opt = "<option value=\"0\" selected></option>";
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows();
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$objp = $db->fetch_object();
|
|
||||||
$opt .= "<option value=\"$objp->rowid\">[$objp->ref] $objp->label : $objp->price</option>\n";
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$db->free();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
print "<form action=\"fiche.php?id=$id\" method=\"post\">";
|
print '</table>';
|
||||||
print "<tr class=\"liste_titre\">";
|
|
||||||
print '<td width="54%">'.$langs->trans("Description").'</td>';
|
|
||||||
print '<td width="8%" align="center">'.$langs->trans("VAT").'</td>';
|
|
||||||
print '<td width="8%" align="center">'.$langs->trans("Qty").'</td>';
|
|
||||||
print '<td width="8%" align="right">'.$langs->trans("Discount").'</td>';
|
|
||||||
print '<td width="12%" align="right">'.$langs->trans("PriceU").'</td>';
|
|
||||||
print '<td> </td><td> </td>'."</tr>\n";
|
|
||||||
print '<input type="hidden" name="action" value="addligne">';
|
|
||||||
print "<tr $bc[$var]>".'<td><textarea name="desc" cols="60" rows="1"></textarea></td>';
|
|
||||||
print '<td align="center">';
|
|
||||||
print $html->select_tva("tva_tx",$conf->defaulttx);
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="center"><input type="text" name="qty" value="1" size="2"></td>';
|
|
||||||
print '<td align="right" nowrap><input type="text" name="remise_percent" size="2" value="0">%</td>';
|
|
||||||
print '<td align="right"><input type="text" name="pu" size="6"></td>';
|
|
||||||
|
|
||||||
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print "<tr $bc[$var]><td colspan=\"2\"><select name=\"p_idprod\">$opt</select></td>";
|
|
||||||
print '<td align="center"><input type="text" size="2" name="pqty" value="1"></td>';
|
|
||||||
print '<td align="right" nowrap><input type="text" size="2" name="premise" value="0">%</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</form>";
|
|
||||||
}
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fin Ajout ligne
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user