Possibilit de dfinir le descriptif sur la ligne de propale meme pour un produit prdfini.

This commit is contained in:
Laurent Destailleur 2005-08-13 19:16:50 +00:00
parent ac5c989d84
commit 0844b857e4
2 changed files with 35 additions and 25 deletions

View File

@ -597,6 +597,8 @@ if ($_GET['propalid'])
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<tr><td height="10">'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2">'.price($propal->total_ttc).'</td>';
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
// Statut
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="3">'.$propal->getLibStatut().'</td></tr>';
print '</table><br>';
if ($propal->brouillon == 1 && $user->rights->propale->creer)
@ -612,10 +614,10 @@ if ($_GET['propalid'])
$sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt 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';
$result = $db->query($sql);
if ($result)
$resql = $db->query($sql);
if ($resql)
{
$num_lignes = $db->num_rows($result);
$num_lignes = $db->num_rows($resql);
$i = 0;
$total = 0;
@ -632,10 +634,10 @@ if ($_GET['propalid'])
print '<td>&nbsp;</td><td>&nbsp;</td>';
print "</tr>\n";
}
$var=True;
$var=true;
while ($i < $num_lignes)
{
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$var=!$var;
if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid)
{
@ -722,14 +724,12 @@ if ($_GET['propalid'])
print '<td align="right"><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 '</tr></form>';
}
//
$total = $total + ($objp->qty * $objp->price);
$i++;
}
$db->free($result);
$db->free($resql);
}
else
{
@ -824,7 +824,7 @@ if ($_GET['propalid'])
/*
* Barre d'actions
* Boutons Actions
*/
if ($propal->statut < 2)
{
@ -972,10 +972,10 @@ if ($_GET['propalid'])
$sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ;
$sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
$sql .= ' WHERE a.fk_soc = '.$obj->idp.' AND a.propalrowid = '.$propal->id ;
$result = $db->query($sql);
if ($result)
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($result);
$num = $db->num_rows($resql);
if ($num)
{
print_titre($langs->trans('ActionsOnPropal'));
@ -989,7 +989,7 @@ if ($_GET['propalid'])
while ($i < $num)
{
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';

View File

@ -181,35 +181,44 @@ if ($_GET["propalid"])
// Receiver
$langs->load('mails');
print '<tr><td>'.$langs->trans('MailTo').'</td>';
print '<td colspan="3">';
$dests=$societe->contact_array($societe->id);
$numdest = count($dests);
if ($numdest==0)
{
print '<td colspan="3">';
print '<font class="error">Cette societe n\'a pas de contact, veuillez en créer un avant de faire votre proposition commerciale</font><br>';
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$langs->trans('AddContact').'</a>';
print '</td>';
}
else
{
if ($propal->statut == 0 && $user->rights->propale->creer)
{
print '<td colspan="2">';
print '<form action="propal.php?propalid='.$propal->id.'" method="post">';
print '<input type="hidden" name="action" value="set_contact">';
$form->select_contacts($societe->id, $propal->contactid, 'contactidp');
print '</td><td>';
print '<input type="submit" value="'.$langs->trans('Modify').'">';
print '</form>';
print '</td>';
}
else
{
if (!empty($propal->contactid))
{
print '<td colspan="3">';
require_once(DOL_DOCUMENT_ROOT.'/contact.class.php');
$contact=new Contact($db);
$contact->fetch($propal->contactid);
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$propal->contactid.'" title="'.$langs->trans('ShowContact').'">';
print $contact->firstname.' '.$contact->name;
print '</a>';
print '</td>';
}
else {
print '<td colspan="3">&nbsp;</td>';
}
}
}
@ -319,12 +328,12 @@ if ($_GET["propalid"])
if ($num_lignes)
{
print '<tr class="liste_titre">';
print '<td width="54%">'.$langs->trans('Description').'</td>';
print '<td width="8%" align="right">'.$langs->trans('VAT').'</td>';
print '<td width="12%" align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td width="8%" align="right">'.$langs->trans('Qty').'</td>';
print '<td width="8%" align="right">'.$langs->trans('Discount').'</td>';
print '<td width="10%" align="right">'.$langs->trans('AmountHT').'</td>';
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 align="right">'.$langs->trans('AmountHT').'</td>';
print '<td>&nbsp;</td><td>&nbsp;</td>';
print "</tr>\n";
}
@ -343,7 +352,7 @@ if ($_GET["propalid"])
print img_object($langs->trans('ShowService'),'service');
else
print img_object($langs->trans('ShowProduct'),'product');
print ' '.stripslashes(nl2br($objp->description?$objp->description:$objp->product)).'</a>';
print ' '.stripslashes(nl2br($objp->product)).'</a>';
if ($objp->date_start && $objp->date_end)
{
print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
@ -356,6 +365,7 @@ if ($_GET["propalid"])
{
print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
}
print $objp->description?'<br>'.$objp->description:'';
print '</td>';
}
else
@ -392,8 +402,7 @@ if ($_GET["propalid"])
print '</tr>';
}
// Update ligne de facture
// \todo
$total = $total + ($objp->qty * $objp->price);
@ -605,10 +614,11 @@ if ($_GET["propalid"])
if (! $sortorder) $sortorder="DESC";
if ($page == -1) $page = 0 ;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.fk_statut, ".$db->pdate("p.datep")." as dp";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p ";