| ';
+ print '';
+ print ' | ';
+ if ($_GET["action"] == "classer")
{
- $html->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete");
- print ' ';
- }
-
- /*
- * Confirmation de la validation
- */
- if ($_GET["action"] == 'valid')
- {
- //$numfa = contrat_get_num($soc);
- $html->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid");
- print ' ';
- }
-
- /*
- * Confirmation de la fermeture
- */
- if ($_GET["action"] == 'close')
- {
- $html->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close");
- print ' ';
- }
-
- /*
- * Contrat
- */
- if ($contrat->brouillon == 1 && $user->rights->contrat->creer)
- {
- print '';
- }
-
- /*
- * Lignes de contrats
- */
- echo '
';
-
- $sql = "SELECT cd.statut, cd.label, cd.fk_product, cd.description, cd.price_ht, cd.qty, cd.rowid, cd.tva_tx, cd.remise_percent, cd.subprice,";
- $sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_debut, ".$db->pdate("cd.date_ouverture")." as date_debut_reelle,";
- $sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin, ".$db->pdate("cd.date_cloture")." as date_fin_reelle";
- $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
- $sql.= " WHERE cd.fk_contrat = ".$id;
- $sql.= " ORDER BY cd .rowid";
-
- $result = $db->query($sql);
- if ($result)
- {
- $num = $db->num_rows($result);
- $i = 0; $total = 0;
-
- if ($num)
- {
- print '';
- print '| '.$langs->trans("Service").' | ';
- print ''.$langs->trans("VAT").' | ';
- print ''.$langs->trans("PriceUHT").' | ';
- print ''.$langs->trans("Qty").' | ';
- print ''.$langs->trans("Discount").' | ';
- print ' | ';
- print ''.$langs->trans("Status").' | ';
- print " \n";
- }
- $var=true;
- while ($i < $num)
- {
- $objp = $db->fetch_object($result);
-
- $var=!$var;
-
- if ($_GET["action"] != 'editline' || $_GET["rowid"] != $objp->rowid)
- {
-
- print '';
- if ($objp->fk_product > 0)
- {
- print '';
- print '';
- print img_object($langs->trans("ShowService"),"service").' '.$objp->label.'';
- if ($objp->description) print ' '.stripslashes(nl2br($objp->description));
- print ' | ';
- }
- else
- {
- print "".stripslashes(nl2br($objp->description))." | \n";
- }
- // TVA
- print ''.$objp->tva_tx.'% | ';
- // Prix
- print ''.price($objp->subprice)." | \n";
- // Quantité
- print ''.$objp->qty.' | ';
- // Remise
- if ($objp->remise_percent > 0)
- {
- print ''.$objp->remise_percent."% | \n";
- }
- else
- {
- print ' | ';
- }
- // Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé)
- print '';
- if ($contrat->statut != 2 && $user->rights->contrat->creer)
- {
- print '';
- print img_edit();
- print '';
- }
- else {
- print ' ';
- }
- if ($contrat->statut == 0 && $user->rights->contrat->creer)
- {
- print ' ';
- print '';
- print img_delete();
- print '';
- }
- print ' | ';
-
- // Statut
- print '';
- if ($contrat->statut > 0) print '';;
- print img_statut($objp->statut);
- if ($contrat->statut > 0) print '';
- print ' | ';
-
- print " \n";
-
- // Dates mise en service
- print '';
- print '| ';
- // 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");
- }
- // Si désactivé
- if ($objp->date_debut_reelle && $objp->date_fin_reelle) {
- print $langs->trans("DateEndReal").': ';
- print dolibarr_print_date($objp->date_fin_reelle);
- }
- print ' | ';
- print ' ';
- }
-
- // Ligne en mode update
- else
- {
- print "\n";
- }
- $i++;
- }
- $db->free($result);
+ $html->form_project("fiche.php?id=$id",$contrat->fk_soc,$contrat->fk_projet,"projetid");
}
else
{
- dolibarr_print_error($db);
+ $html->form_project("fiche.php?id=$id",$contrat->fk_soc,$contrat->fk_projet,"none");
}
+ print "";
+ }
+ print '| '.$langs->trans("SalesRepresentativeFollowUp").' | '.$commercial_suivi->fullname.' | ';
+ print ''.$langs->trans("SalesRepresentativeSignature").' | '.$commercial_signature->fullname.' | ';
+ print " ";
- /*
- * Ajouter une ligne produit/service
- */
- if ($user->rights->contrat->creer && $contrat->statut == 0)
+ if ($contrat->brouillon == 1 && $user->rights->contrat->creer)
+ {
+ print '';
+ }
+
+ /*
+ * Lignes de contrats
+ */
+ echo '
';
+
+ $sql = "SELECT cd.statut, cd.label, cd.fk_product, cd.description, cd.price_ht, cd.qty, cd.rowid, cd.tva_tx, cd.remise_percent, cd.subprice,";
+ $sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_debut, ".$db->pdate("cd.date_ouverture")." as date_debut_reelle,";
+ $sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin, ".$db->pdate("cd.date_cloture")." as date_fin_reelle";
+ $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
+ $sql.= " WHERE cd.fk_contrat = ".$id;
+ $sql.= " ORDER BY cd .rowid";
+
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $num = $db->num_rows($result);
+ $i = 0; $total = 0;
+
+ if ($num)
{
- print "";
+ print ' ';
print '| '.$langs->trans("Service").' | ';
- print ''.$langs->trans("VAT").' | ';
- print ''.$langs->trans("PriceUHT").' | ';
- print ''.$langs->trans("Qty").' | ';
- print ''.$langs->trans("Discount").' | ';
- print ' | ';
- print ' | ';
+ print ''.$langs->trans("VAT").' | ';
+ print ''.$langs->trans("PriceUHT").' | ';
+ print ''.$langs->trans("Qty").' | ';
+ print ''.$langs->trans("Discount").' | ';
+ print ' | ';
+ print ''.$langs->trans("Status").' | ';
print " \n";
-
- $var=false;
-
- print '';
+ }
+ $var=true;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($result);
$var=!$var;
-
- print '';
+ // Dates mise en service
+ print '';
+ print '| ';
+ // 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");
+ }
+ // Si désactivé
+ if ($objp->date_debut_reelle && $objp->date_fin_reelle) {
+ print $langs->trans("DateEndReal").': ';
+ print dolibarr_print_date($objp->date_fin_reelle);
+ }
+ print ' | ';
+ print ' ';
+ }
+
+ // Ligne en mode update
+ else
+ {
+ print "\n";
+ }
+ $i++;
}
- print " ";
- /*
- * Fin Ajout ligne
- */
-
- print '';
-
- /*************************************************************
- * Boutons Actions
- *************************************************************/
-
- if ($user->societe_id == 0)
- {
- print '";
- }
-
+ $db->free($result);
}
else
{
- // Contrat non trouvé
- print "Contrat inexistant ou accés refusé";
+ dolibarr_print_error($db);
}
+
+
+ /*
+ * Ajouter une ligne produit/service
+ */
+ if ($user->rights->contrat->creer && $contrat->statut == 0)
+ {
+ print " |