New: Possibilit d'diter les lignes contrats
This commit is contained in:
parent
05c30f7d78
commit
2e3d89379f
@ -109,7 +109,8 @@ if ($_POST["action"] == 'add')
|
||||
{
|
||||
for ($i = 1 ; $i <= $NBLINES ; $i++)
|
||||
{
|
||||
if ($_POST["idprod${i}"]) {
|
||||
if ($_POST["idprod${i}"])
|
||||
{
|
||||
$startday='';
|
||||
$endday='';
|
||||
if ($_POST["date_start${i}year"] && $_POST["date_start${i}month"] && $_POST["date_start${i}day"]) {
|
||||
|
||||
@ -318,60 +318,136 @@ class Contrat
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Ajoute une ligne de commande
|
||||
* \return int <0 si KO, =0 si OK
|
||||
*/
|
||||
function addline($desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$qty = ereg_replace(",",".",$qty);
|
||||
$pu = ereg_replace(",",".",$pu);
|
||||
|
||||
if (strlen(trim($qty))==0)
|
||||
/**
|
||||
* \brief Ajoute une ligne de contrat en base
|
||||
* \param rowid Id de la ligne de facture
|
||||
* \param desc Description de la ligne
|
||||
* \param pu Prix unitaire
|
||||
* \param qty Quantité
|
||||
* \param remise_percent Pourcentage de remise de la ligne
|
||||
* \param datestart Date de debut prévue
|
||||
* \param dateend Date de fin prévue
|
||||
* \return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function addline($desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $datestart, $dateend)
|
||||
{
|
||||
$qty=1;
|
||||
}
|
||||
|
||||
if ($fk_product > 0)
|
||||
{
|
||||
$prod = new Product($this->db, $fk_product);
|
||||
if ($prod->fetch($fk_product) > 0)
|
||||
global $langs;
|
||||
|
||||
$qty = ereg_replace(",",".",$qty);
|
||||
$pu = ereg_replace(",",".",$pu);
|
||||
|
||||
if (strlen(trim($qty))==0)
|
||||
{
|
||||
$label = $prod->libelle;
|
||||
$pu = $prod->price;
|
||||
$txtva = $prod->tva_tx;
|
||||
$qty=1;
|
||||
}
|
||||
|
||||
if ($fk_product > 0)
|
||||
{
|
||||
$prod = new Product($this->db, $fk_product);
|
||||
if ($prod->fetch($fk_product) > 0)
|
||||
{
|
||||
$label = $prod->libelle;
|
||||
$pu = $prod->price;
|
||||
$txtva = $prod->tva_tx;
|
||||
}
|
||||
}
|
||||
|
||||
$remise = 0;
|
||||
$price = round(ereg_replace(",",".",$pu), 2);
|
||||
$subprice = $price;
|
||||
if (trim(strlen($remise_percent)) > 0)
|
||||
{
|
||||
$remise = round(($pu * $remise_percent / 100), 2);
|
||||
$price = $pu - $remise;
|
||||
}
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet ";
|
||||
$sql.= "(fk_contrat,label,description,fk_product, price_ht,qty,tva_tx, remise_percent, subprice, remise";
|
||||
if ($datestart > 0) { $sql.= ",date_ouverture_prevue"; }
|
||||
if ($dateend > 0) { $sql.= ",date_fin_validite"; }
|
||||
$sql.= ") VALUES ($this->id, '" . addslashes($label) . "','" . addslashes($desc) . "',$fk_product,".ereg_replace(",",".",$price).", '$qty', $txtva, $remise_percent,'".ereg_replace(",",".",$subprice)."','".ereg_replace(",",".", $remise)."'";
|
||||
if ($datestart > 0) { $sql.= ",".$this->db->idate($datestart); }
|
||||
if ($dateend > 0) { $sql.= ",".$this->db->idate($dateend); }
|
||||
$sql.= ");";
|
||||
|
||||
// Retour
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
//$this->update_price();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$remise = 0;
|
||||
$price = round(ereg_replace(",",".",$pu), 2);
|
||||
$subprice = $price;
|
||||
if (trim(strlen($remise_percent)) > 0)
|
||||
/**
|
||||
* \brief Mets à jour une ligne de contrat
|
||||
* \param rowid Id de la ligne de facture
|
||||
* \param desc Description de la ligne
|
||||
* \param pu Prix unitaire
|
||||
* \param qty Quantité
|
||||
* \param remise_percent Pourcentage de remise de la ligne
|
||||
* \param datestart Date de debut prévue
|
||||
* \param dateend Date de fin prévue
|
||||
* \return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $datestart='', $dateend='')
|
||||
{
|
||||
$remise = round(($pu * $remise_percent / 100), 2);
|
||||
$price = $pu - $remise;
|
||||
}
|
||||
dolibarr_syslog("Contrat::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $datestart, $dateend");
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet ";
|
||||
$sql .= "(fk_contrat,label,description,fk_product, price_ht,qty,tva_tx, remise_percent, subprice, remise)";
|
||||
$sql .= " VALUES ($this->id, '" . addslashes($label) . "','" . addslashes($desc) . "',$fk_product,".ereg_replace(",",".",$price).", '$qty', $txtva, $remise_percent,'".ereg_replace(",",".",$subprice)."','".ereg_replace(",",".", $remise)."') ;";
|
||||
if (strlen(trim($qty))==0)
|
||||
{
|
||||
$qty=1;
|
||||
}
|
||||
$remise = 0;
|
||||
$price = ereg_replace(",",".",$pu);
|
||||
$subprice = $price;
|
||||
if (trim(strlen($remise_percent)) > 0)
|
||||
{
|
||||
$remise = round(($pu * $remise_percent / 100), 2);
|
||||
$price = $pu - $remise;
|
||||
}
|
||||
else
|
||||
{
|
||||
$remise_percent=0;
|
||||
}
|
||||
|
||||
// Retour
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
//$this->update_price();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".addslashes($desc)."'";
|
||||
$sql .= ",price_ht='" . ereg_replace(",",".",$price)."'";
|
||||
$sql .= ",subprice='" . ereg_replace(",",".",$subprice)."'";
|
||||
$sql .= ",remise='". ereg_replace(",",".",$remise)."'";
|
||||
$sql .= ",remise_percent='".ereg_replace(",",".",$remise_percent)."'";
|
||||
$sql .= ",qty='$qty'";
|
||||
|
||||
if ($datestart > 0) { $sql.= ",date_ouverture_prevue=".$this->db->idate($datestart); }
|
||||
else { $sql.=",date_ouverture_prevue=null"; }
|
||||
if ($dateend > 0) { $sql.= ",date_fin_validite=".$this->db->idate($dateend); }
|
||||
else { $sql.=",date_fin_validite=null"; }
|
||||
|
||||
$sql .= " WHERE rowid = $rowid ;";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Supprime une ligne de detail du contrat
|
||||
* \param idligne id de la ligne detail de contrat à supprimer
|
||||
|
||||
@ -43,6 +43,11 @@ require("../project.class.php");
|
||||
require("../propal.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
||||
|
||||
$date_start_update=mktime(12, 0 , 0, $_POST["date_start_updatemonth"], $_POST["date_start_updateday"], $_POST["date_start_updateyear"]);
|
||||
$date_end_update=mktime(12, 0 , 0, $_POST["date_end_updatemonth"], $_POST["date_end_updateday"], $_POST["date_end_updateyear"]);
|
||||
$date_start=mktime(12, 0 , 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]);
|
||||
$date_end=mktime(12, 0 , 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]);
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
@ -106,7 +111,10 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
||||
$_POST["pqty"],
|
||||
$_POST["tva_tx"],
|
||||
$_POST["p_idprod"],
|
||||
$_POST["premise"]);
|
||||
$_POST["premise"],
|
||||
$date_start,
|
||||
$date_end
|
||||
);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
@ -122,13 +130,25 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
||||
if ($_POST["action"] == 'updateligne' && $user->rights->contrat->creer)
|
||||
{
|
||||
$contrat = new Contrat($db,"",$_GET["id"]);
|
||||
if ($contrat->fetch($_GET["id"]) )
|
||||
if ($contrat->fetch($_GET["id"]))
|
||||
{
|
||||
$result = $contrat->update_line($_POST["elrowid"],
|
||||
$_POST["eldesc"],
|
||||
$_POST["elprice"],
|
||||
$_POST["elqty"],
|
||||
$_POST["elremise_percent"]);
|
||||
$result = $contrat->updateline($_POST["elrowid"],
|
||||
$_POST["eldesc"],
|
||||
$_POST["elprice"],
|
||||
$_POST["elqty"],
|
||||
$_POST["elremise_percent"],
|
||||
$date_start_update,
|
||||
$date_end_update
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db,"result=$result");
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -212,13 +232,13 @@ if ($_GET["action"] == 'create')
|
||||
$sql .= "FROM ".MAIN_DB_PREFIX."societe as s ";
|
||||
$sql .= "WHERE s.idp = ".$_GET["socid"];
|
||||
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($obj->idp);
|
||||
@ -230,26 +250,27 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Customer").' :</td><td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$obj->nom.'</a></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Customer").':</td><td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$obj->nom.'</a></td></tr>';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("Commercial").'</td><td>';
|
||||
|
||||
print '<select name="commercial">';
|
||||
$sql = "SELECT rowid, name, firstname FROM ".MAIN_DB_PREFIX."user ORDER BY name ";
|
||||
if ( $db->query( $sql) )
|
||||
$resql=$db->query( $sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
if ( $num > 0 )
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($i);
|
||||
$row = $db->fetch_row($resql);
|
||||
print '<option value="'.$row[0].'">'.$row[1] . " " . $row[2];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
|
||||
}
|
||||
print '</select></td></tr>';
|
||||
@ -303,7 +324,7 @@ if ($_GET["action"] == 'create')
|
||||
{
|
||||
print '<tr><td><select name="idprod'.$i.'">'.$opt.'</select></td>';
|
||||
print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>';
|
||||
print '<td><input type="text" size="4" name="remise_percent'.$i.'" value="0"> %</td></tr>';
|
||||
print '<td><input type="text" size="4" name="remise_percent'.$i.'" value="0">%</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@ -336,17 +357,17 @@ if ($_GET["action"] == 'create')
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object();
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td>[$objp->ref]</td>\n";
|
||||
print '<td>'.$objp->product.'</td>';
|
||||
print "<td align=\"right\">".price($objp->price)."</td>";
|
||||
print '<td align="center">'.$objp->remise_percent.' %</td>';
|
||||
print '<td align="center">'.$objp->remise_percent.'%</td>';
|
||||
print "<td align=\"center\">".$objp->qty."</td></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
@ -354,18 +375,19 @@ if ($_GET["action"] == 'create')
|
||||
$sql = "SELECT pt.rowid, pt.description as product, pt.price, pt.qty, pt.remise_percent";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt WHERE pt.fk_propal = $propalid AND pt.fk_product = 0";
|
||||
$sql .= " ORDER BY pt.rowid ASC";
|
||||
if ($db->query($sql))
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object();
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td> </td>\n";
|
||||
print '<td>'.$objp->product.'</td>';
|
||||
print '<td align="right">'.price($objp->price).'</td>';
|
||||
print '<td align="center">'.$objp->remise_percent.' %</td>';
|
||||
print '<td align="center">'.$objp->remise_percent.'%</td>';
|
||||
print "<td align=\"center\">".$objp->qty."</td></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
@ -501,8 +523,8 @@ else
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans("Commercial suivi").'</td><td>'.$commercial_suivi->fullname.'</td>';
|
||||
print '<td width="25%">'.$langs->trans("Commercial signature").'</td><td>'.$commercial_signature->fullname.'</td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans("SalesRepresentativeFollowUp").'</td><td>'.$commercial_suivi->fullname.'</td>';
|
||||
print '<td width="25%">'.$langs->trans("SalesRepresentativeSignature").'</td><td>'.$commercial_signature->fullname.'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
if ($contrat->brouillon == 1 && $user->rights->contrat->creer)
|
||||
@ -523,7 +545,6 @@ else
|
||||
$sql.= " ORDER BY cd .rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
@ -532,13 +553,14 @@ else
|
||||
if ($num)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="30">'.$langs->trans("Status").'</td>';
|
||||
print '<td>'.$langs->trans("Service").'</td>';
|
||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Discount").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PriceU").'</td>';
|
||||
print '<td> </td><td> </td>';
|
||||
print '<td width="50" align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td width="50" align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
print '<td width="30" align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td width="50" align="right">'.$langs->trans("Discount").'</td>';
|
||||
print '<td width="16"> </td>';
|
||||
print '<td width="16"> </td>';
|
||||
print '<td width="30" align="center">'.$langs->trans("Status").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
@ -547,117 +569,131 @@ else
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/ligne.php?id='.$contrat->id.'&ligne='.$objp->rowid.'">';;
|
||||
print '<img src="./statut'.$objp->statut.'.png" border="0" alt="statut"></a></td><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
|
||||
print img_object($langs->trans("ShowService"),"service").' '.$objp->label.'</a>';
|
||||
|
||||
if ($objp->description)
|
||||
if ($_GET["action"] != 'editline' || $_GET["rowid"] != $objp->rowid)
|
||||
{
|
||||
|
||||
print '<tr '.$bc[$var].' valign="top">';
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
|
||||
print '<br />'.stripslashes(nl2br($objp->description));
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
|
||||
print img_object($langs->trans("ShowService"),"service").' '.$objp->label.'</a>';
|
||||
if ($objp->description) print '<br />'.stripslashes(nl2br($objp->description));
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
|
||||
}
|
||||
// TVA
|
||||
print '<td align="center">'.$objp->tva_tx.'%</td>';
|
||||
// Prix
|
||||
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||
// Quantité
|
||||
print '<td align="center">'.$objp->qty.'</td>';
|
||||
// Remise
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right">'.$objp->remise_percent."%</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
// Icon update et delete
|
||||
if ($contrat->statut == 0 && $objp->statut == 0 && $user->rights->contrat->creer)
|
||||
{
|
||||
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 colspan="2"> </td>';
|
||||
}
|
||||
|
||||
if ($objp->fk_product > 0) {
|
||||
print '<td align="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/ligne.php?id='.$contrat->id.'&ligne='.$objp->rowid.'">';;
|
||||
print '<img src="./statut'.$objp->statut.'.png" border="0" alt="statut"></a></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
// Dates mise en service
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td colspan="7">';
|
||||
// Si pas encore activé
|
||||
if (! $objp->date_debut_reelle) {
|
||||
print $langs->trans("DateStartPlanned").': ';
|
||||
if ($objp->date_debut) print dolibarr_print_date($objp->date_debut);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
// Si activé
|
||||
if ($objp->date_debut_reelle) {
|
||||
print $langs->trans("DateStartReal").': ';
|
||||
if ($objp->date_debut_reelle) print dolibarr_print_date($objp->date_debut_reelle);
|
||||
else print $langs->trans("ContractStatusNotRunning");
|
||||
}
|
||||
|
||||
print ' - ';
|
||||
|
||||
// Si pas encore activé
|
||||
if (! $objp->date_debut_reelle) {
|
||||
print $langs->trans("DateEndPlanned").': ';
|
||||
if ($objp->date_fin) {
|
||||
print dolibarr_print_date($objp->date_fin);
|
||||
}
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
// Si activé
|
||||
if ($objp->date_debut_reelle && ! $objp->date_fin_reelle) {
|
||||
print $langs->trans("DateEndPlanned").': ';
|
||||
if ($objp->date_fin) {
|
||||
print dolibarr_print_date($objp->date_fin);
|
||||
if ($objp->date_fin < time()) { print " ".img_warning($langs->trans("Late")); }
|
||||
}
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($objp->date_debut_reelle && $objp->date_fin_reelle) {
|
||||
print $langs->trans("DateEndReal").': ';
|
||||
dolibarr_print_date($objp->date_fin_reelle);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
|
||||
}
|
||||
print '<td align="center">'.$objp->tva_tx.' %</td>';
|
||||
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";
|
||||
|
||||
// Icon delete
|
||||
if ($contrat->statut == 0 && $objp->statut == 0 && $user->rights->contrat->creer)
|
||||
{
|
||||
// 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" colspan="2"><a href="fiche.php?id='.$id.'&action=deleteline&lineid='.$objp->rowid.'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="2"> </td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
// Dates mise en service
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td> </td>';
|
||||
print '<td colspan="7">';
|
||||
// Si pas encore activé
|
||||
if (! $objp->date_debut_reelle) {
|
||||
print $langs->trans("DateStartPlanned").': ';
|
||||
if ($objp->date_debut) print dolibarr_print_date($objp->date_debut);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
// Si activé
|
||||
if ($objp->date_debut_reelle) {
|
||||
print $langs->trans("DateStartReal").': ';
|
||||
if ($objp->date_debut_reelle) print dolibarr_print_date($objp->date_debut_reelle);
|
||||
else print $langs->trans("ContractStatusNotRunning");
|
||||
}
|
||||
|
||||
print ' - ';
|
||||
|
||||
// Si pas encore activé
|
||||
if (! $objp->date_debut_reelle) {
|
||||
print $langs->trans("DateEndPlanned").': ';
|
||||
if ($objp->date_fin) {
|
||||
print dolibarr_print_date($objp->date_fin);
|
||||
}
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
// Si activé
|
||||
if ($objp->date_debut_reelle && ! $objp->date_fin_reelle) {
|
||||
print $langs->trans("DateEndPlanned").': ';
|
||||
if ($objp->date_fin) {
|
||||
print dolibarr_print_date($objp->date_fin);
|
||||
if ($objp->date_fin < time()) { print " ".img_warning($langs->trans("Late")); }
|
||||
}
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($objp->date_debut_reelle && $objp->date_fin_reelle) {
|
||||
print $langs->trans("DateEndReal").': ';
|
||||
dolibarr_print_date($objp->date_fin_reelle);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
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"].'">';
|
||||
// Ligne carac
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td> </td>';
|
||||
print '<td colspan="2"><textarea name="eldesc" cols="60" rows="2">'.$objp->description.'</textarea></td>';
|
||||
print '<td align="center"><input size="4" type="text" name="elqty" value="'.$objp->qty.'"></td>';
|
||||
print '<td align="right"><input size="3" type="text" name="elremise_percent" value="'.$objp->remise_percent.'"> %</td>';
|
||||
print '<td align="right"><input size="8" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||
print '<td align="right" colspan="2"><input type="submit" value="'.$langs->trans("Save").'"></td>';
|
||||
print '<td align="right"><input size="6" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||
print '<td align="center"><input size="3" type="text" name="elqty" value="'.$objp->qty.'"></td>';
|
||||
print '<td align="right"><input size="3" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
|
||||
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td>';
|
||||
// Ligne dates prévues
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="8">';
|
||||
print 'Date prévue mise en service ';
|
||||
$html->select_date($objp->date_debut,"date_start_update",0,0,($objp->date_debut>0?0:1));
|
||||
print ' Date prévue fin de service ';
|
||||
$html->select_date($objp->date_fin,"date_end_update",0,0,($objp->date_fin>0?0:1));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</tr>' . "\n";
|
||||
print "</form>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -675,13 +711,14 @@ else
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("Service").'</td>';
|
||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Discount").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PriceU").'</td>';
|
||||
print '<td> </td><td> </td>'."</tr>\n";
|
||||
print '<td> </td><td> </td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
/*
|
||||
print "<tr $bc[$var]>".'<td><textarea name="desc" cols="60" rows="1"></textarea></td>';
|
||||
@ -695,22 +732,29 @@ else
|
||||
print '<td align="center" colspan="3"><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
|
||||
*/
|
||||
|
||||
$var=!$var;
|
||||
$var=false;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td> </td>';
|
||||
print '<td colspan="2">';
|
||||
$html->select_produits('','p_idprod');
|
||||
print '</td>';
|
||||
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
|
||||
print '<td align="right"><input type="text" class="flat" size="2" name="premise" value="0">%</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center" colspan="3" rowspan="2"><input type="submit" class="buttton" value="'.$langs->trans("Add").'"></td></tr>';
|
||||
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
|
||||
print '<td align="right" nowrap><input type="text" class="flat" size="2" name="premise" value="0">%</td>';
|
||||
print '<td align="center" colspan="3" rowspan="2"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print "</tr>\n";
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td> </td>';
|
||||
print '<td colspan="6"><textarea name="desc" cols="60" rows="1"></textarea></td>';
|
||||
print '<td colspan="7"><textarea name="desc" cols="60" rows="1"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="8">';
|
||||
print 'Date prévue mise en service ';
|
||||
$html->select_date('',"date_start",0,0,1);
|
||||
print ' Date prévue fin de service ';
|
||||
$html->select_date('',"date_end",0,0,1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</form>";
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
@ -154,8 +154,8 @@ $html = new Form($db);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans("Commercial suivi").'</td><td>'.$commercial_suivi->fullname.'</td>';
|
||||
print '<td width="25%">'.$langs->trans("Commercial signature").'</td><td>'.$commercial_signature->fullname.'</td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans("SalesRepresentativeFollowUp").'</td><td>'.$commercial_suivi->fullname.'</td>';
|
||||
print '<td width="25%">'.$langs->trans("SalesRepresentativeSignature").'</td><td>'.$commercial_signature->fullname.'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
|
||||
@ -194,15 +194,16 @@ $html = new Form($db);
|
||||
|
||||
if ($num)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="20">'.$langs->trans("Status").'</td>';
|
||||
print '<td>'.$langs->trans("Service").'</td>';
|
||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Discount").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PriceU").'</td>';
|
||||
print '<td> </td><td width="10%"> </td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Service").'</td>';
|
||||
print '<td width="50" align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td width="50" align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
print '<td width="30" align="center">'.$langs->trans("Qty").'</td>';
|
||||
print '<td width="50" align="right">'.$langs->trans("Discount").'</td>';
|
||||
print '<td width="16"> </td>';
|
||||
print '<td width="16"> </td>';
|
||||
print '<td width="30" align="center">'.$langs->trans("Status").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
@ -210,10 +211,11 @@ $html = new Form($db);
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>\n";
|
||||
if ($objp->fk_product > 0)
|
||||
print "<tr $bc[$var] valign=\"top\">\n";
|
||||
|
||||
// Libellé
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
print '<td><img src="./statut'.$objp->statut.'.png" border="0" alt="statut"></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowService"),"service").' '.$objp->label.'</a>';
|
||||
|
||||
if ($objp->description)
|
||||
@ -227,20 +229,29 @@ $html = new Form($db);
|
||||
{
|
||||
print '<td> </td><td>'.stripslashes(nl2br($objp->description))."</td>\n";
|
||||
}
|
||||
print '<td align="center">'.$objp->tva_tx.' %</td>';
|
||||
print '<td align="center">'.$objp->tva_tx.'%</td>';
|
||||
|
||||
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||
|
||||
print '<td align="center">'.$objp->qty.'</td>';
|
||||
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right">'.$objp->remise_percent." %</td>\n";
|
||||
print '<td align="right">'.$objp->remise_percent."%</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||
|
||||
print '<td> </td><td> </td>';
|
||||
|
||||
if ($objp->fk_product > 0) {
|
||||
print '<td align="center"><img src="./statut'.$objp->statut.'.png" border="0" alt="statut"></td>';
|
||||
} else {
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
if ($objp->date_debut) $dateactstart=$objp->date_debut;
|
||||
@ -248,7 +259,6 @@ $html = new Form($db);
|
||||
|
||||
// Dates mise en service
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td> </td>';
|
||||
print '<td colspan="7">';
|
||||
// Si pas encore activé
|
||||
if (! $objp->date_debut_reelle) {
|
||||
@ -287,6 +297,7 @@ $html = new Form($db);
|
||||
dolibarr_print_date($objp->date_fin_reelle);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -316,8 +327,6 @@ $html = new Form($db);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ActivateService").'</td></tr>';
|
||||
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("User").'</td><td>'.$user->fullname.'</td></tr>';
|
||||
|
||||
// Definie date debut et fin par defaut
|
||||
if ($_POST["remonth"]) $dateactstart = mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
elseif (! $dateactstart) $dateactstart = time();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user