115 |
$author->id = $contrat->user_author_id; |
$author->id = $contrat->user_author_id; |
116 |
$author->fetch(); |
$author->fetch(); |
117 |
|
|
118 |
|
/* Remplacé par fonctions des contacts de contrat |
119 |
$commercial_signature = new User($db); |
$commercial_signature = new User($db); |
120 |
$commercial_signature->id = $contrat->commercial_signature_id; |
$commercial_signature->id = $contrat->commercial_signature_id; |
121 |
$commercial_signature->fetch(); |
$commercial_signature->fetch(); |
123 |
$commercial_suivi = new User($db); |
$commercial_suivi = new User($db); |
124 |
$commercial_suivi->id = $contrat->commercial_suivi_id; |
$commercial_suivi->id = $contrat->commercial_suivi_id; |
125 |
$commercial_suivi->fetch(); |
$commercial_suivi->fetch(); |
126 |
|
*/ |
127 |
$h = 0; |
$h = 0; |
128 |
$head[$h][0] = DOL_URL_ROOT.'/contrat/fiche.php?id='.$contrat->id; |
$head[$h][0] = DOL_URL_ROOT.'/contrat/fiche.php?id='.$contrat->id; |
129 |
$head[$h][1] = $langs->trans("ContractCard"); |
$head[$h][1] = $langs->trans("ContractCard"); |
145 |
dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").': '.$contrat->id); |
dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").': '.$contrat->id); |
146 |
|
|
147 |
|
|
148 |
|
/* |
149 |
|
* Confirmation de la validation activation |
150 |
|
*/ |
151 |
|
if ($_GET["action"] == 'active' && $user->rights->contrat->activer) |
152 |
|
{ |
153 |
|
$dateactstart = mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); |
154 |
|
$dateactend = mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); |
155 |
|
$html->form_confirm("ligne.php?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend,$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",strftime("%A %d %B %Y", $dateactstart)),"confirm_active"); |
156 |
|
print '<br />'; |
157 |
|
} |
158 |
|
|
159 |
/* |
/* |
160 |
* Contrat |
* Confirmation de la validation fermeture |
161 |
*/ |
*/ |
162 |
|
if ($_GET["action"] == 'close' && $user->rights->contrat->activer) |
163 |
|
{ |
164 |
|
$dateactstart = mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); |
165 |
|
$dateactend = mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); |
166 |
|
$html->form_confirm("ligne.php?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend,$langs->trans("CloseService"),$langs->trans("ConfirmCloseService",strftime("%A %d %B %Y", $dateactstart)),"confirm_close"); |
167 |
|
print '<br />'; |
168 |
|
} |
169 |
|
|
170 |
|
|
171 |
|
/* |
172 |
|
* Contrat |
173 |
|
*/ |
174 |
print '<table class="border" width="100%">'; |
print '<table class="border" width="100%">'; |
175 |
|
|
176 |
// Reference du contrat |
// Reference du contrat |
177 |
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="3">'; |
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'; |
178 |
print $contrat->ref; |
print $contrat->ref; |
179 |
print "</td></tr>"; |
print "</td></tr>"; |
180 |
|
|
190 |
|
|
191 |
// Date |
// Date |
192 |
print '<tr><td>'.$langs->trans("Date").'</td>'; |
print '<tr><td>'.$langs->trans("Date").'</td>'; |
193 |
print '<td colspan="3">'.dolibarr_print_date($contrat->date_contrat,"%A %d %B %Y")."</td></tr>\n"; |
print '<td colspan="3">'.dolibarr_print_date($contrat->date_contrat,"%A %d %B %Y")."</td></tr>\n"; |
194 |
|
|
195 |
// Factures associées |
// Factures associées |
196 |
/* |
/* |
197 |
TODO |
TODO |
198 |
*/ |
*/ |
199 |
|
|
200 |
// Projet |
// Projet |
201 |
if ($conf->projet->enabled) |
if ($conf->projet->enabled) |
202 |
{ |
{ |
203 |
$langs->load("projects"); |
$langs->load("projects"); |
204 |
print '<tr><td>'; |
print '<tr><td>'; |
205 |
print '<table width="100%" class="nobordernopadding"><tr><td>'; |
print '<table width="100%" class="nobordernopadding"><tr><td>'; |
206 |
print $langs->trans("Project"); |
print $langs->trans("Project"); |
207 |
print '</td>'; |
print '</td>'; |
208 |
if ($_GET["action"] != "classer") print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classer&id='.$id.'&ligne='.$_GET["ligne"].'">'.img_edit($langs->trans("SetProject")).'</a></td>'; |
if ($_GET["action"] != "classer") print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classer&id='.$id.'&ligne='.$_GET["ligne"].'">'.img_edit($langs->trans("SetProject")).'</a></td>'; |
209 |
print '</tr></table>'; |
print '</tr></table>'; |
210 |
print '</td><td colspan="3">'; |
print '</td><td colspan="3">'; |
211 |
if ($_GET["action"] == "classer") |
if ($_GET["action"] == "classer") |
212 |
{ |
{ |
213 |
$html->form_project($_SERVER["PHP_SELF"]."?id=$id&ligne=".$_GET["ligne"],$contrat->fk_soc,$contrat->fk_projet,"projetid"); |
$html->form_project($_SERVER["PHP_SELF"]."?id=$id&ligne=".$_GET["ligne"],$contrat->fk_soc,$contrat->fk_projet,"projetid"); |
214 |
} |
} |
219 |
print "</td></tr>"; |
print "</td></tr>"; |
220 |
} |
} |
221 |
|
|
222 |
|
/* Fonction remplacé par les contacts de contrat |
223 |
|
// Commerciaux |
224 |
print '<tr><td width="25%">'.$langs->trans("SalesRepresentativeFollowUp").'</td><td>'.$commercial_suivi->fullname.'</td>'; |
print '<tr><td width="25%">'.$langs->trans("SalesRepresentativeFollowUp").'</td><td>'.$commercial_suivi->fullname.'</td>'; |
225 |
print '<td width="25%">'.$langs->trans("SalesRepresentativeSignature").'</td><td>'.$commercial_signature->fullname.'</td></tr>'; |
print '<td width="25%">'.$langs->trans("SalesRepresentativeSignature").'</td><td>'.$commercial_signature->fullname.'</td></tr>'; |
226 |
|
*/ |
227 |
print "</table>"; |
print "</table>"; |
228 |
|
|
229 |
|
|
230 |
/* |
/* |
|
* Confirmation de la validation activation |
|
|
*/ |
|
|
if ($_GET["action"] == 'active' && $user->rights->contrat->activer) |
|
|
{ |
|
|
print '<br />'; |
|
|
$dateactstart = mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); |
|
|
$dateactend = mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); |
|
|
$html->form_confirm("ligne.php?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend,$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",strftime("%A %d %B %Y", $dateactstart)),"confirm_active"); |
|
|
} |
|
|
|
|
|
/* |
|
|
* Confirmation de la validation fermeture |
|
|
*/ |
|
|
if ($_GET["action"] == 'close' && $user->rights->contrat->activer) |
|
|
{ |
|
|
print '<br />'; |
|
|
$dateactstart = mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); |
|
|
$dateactend = mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); |
|
|
$html->form_confirm("ligne.php?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend,$langs->trans("CloseService"),$langs->trans("ConfirmCloseService",strftime("%A %d %B %Y", $dateactstart)),"confirm_close"); |
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
231 |
* Lignes de contrats |
* Lignes de contrats |
232 |
*/ |
*/ |
233 |
print '<br><table class="noborder" width="100%">'; |
print '<br><table class="noborder" width="100%">'; |
234 |
|
|
235 |
$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 = "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,"; |
236 |
$sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_debut, ".$db->pdate("cd.date_ouverture")." as date_debut_reelle,"; |
$sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_debut, ".$db->pdate("cd.date_ouverture")." as date_debut_reelle,"; |
237 |
$sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin, ".$db->pdate("cd.date_cloture")." as date_fin_reelle"; |
$sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin, ".$db->pdate("cd.date_cloture")." as date_fin_reelle,"; |
238 |
|
$sql.= " p.ref, p.label"; |
239 |
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; |
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; |
240 |
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; |
241 |
$sql.= " WHERE cd.fk_contrat = ".$id; |
$sql.= " WHERE cd.fk_contrat = ".$id; |
242 |
$sql.= " AND rowid = ".$_GET["ligne"]; |
$sql.= " AND cd.rowid = ".$_GET["ligne"]; |
243 |
$sql.= " ORDER BY cd.rowid"; |
$sql.= " ORDER BY cd.rowid"; |
244 |
|
|
245 |
$result = $db->query($sql); |
$result = $db->query($sql); |
257 |
print '<td width="30" align="center">'.$langs->trans("Qty").'</td>'; |
print '<td width="30" align="center">'.$langs->trans("Qty").'</td>'; |
258 |
print '<td width="50" align="right">'.$langs->trans("Discount").'</td>'; |
print '<td width="50" align="right">'.$langs->trans("Discount").'</td>'; |
259 |
print '<td width="16"> </td>'; |
print '<td width="16"> </td>'; |
|
print '<td width="16"> </td>'; |
|
260 |
print '<td width="30" align="center">'.$langs->trans("Status").'</td>'; |
print '<td width="30" align="center">'.$langs->trans("Status").'</td>'; |
261 |
print "</tr>\n"; |
print "</tr>\n"; |
262 |
} |
} |
268 |
$var=!$var; |
$var=!$var; |
269 |
print "<tr $bc[$var] valign=\"top\">\n"; |
print "<tr $bc[$var] valign=\"top\">\n"; |
270 |
|
|
271 |
// Libell |
// Libelle |
272 |
if ($objp->fk_product > 0) |
if ($objp->fk_product > 0) |
|
{ |
|
|
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) |
|
273 |
{ |
{ |
274 |
print '<br />'.stripslashes(nl2br($objp->description)); |
print '<td>'; |
275 |
|
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'; |
276 |
|
print img_object($langs->trans("ShowService"),"service").' '.$objp->ref.'</a>'; |
277 |
|
print $objp->label?' - '.$objp->label:''; |
278 |
|
if ($objp->description) print '<br />'.stripslashes(nl2br($objp->description)); |
279 |
|
print '</td>'; |
280 |
|
} |
281 |
|
else |
282 |
|
{ |
283 |
|
print "<td>".stripslashes(nl2br($objp->description))."</td>\n"; |
284 |
} |
} |
285 |
|
|
286 |
print '</td>'; |
// TVA |
|
} |
|
|
else |
|
|
{ |
|
|
print '<td>'.stripslashes(nl2br($objp->description))."</td>\n"; |
|
|
} |
|
287 |
print '<td align="center">'.$objp->tva_tx.'%</td>'; |
print '<td align="center">'.$objp->tva_tx.'%</td>'; |
288 |
|
|
289 |
print '<td align="right">'.price($objp->subprice)."</td>\n"; |
print '<td align="right">'.price($objp->subprice)."</td>\n"; |
299 |
print '<td> </td>'; |
print '<td> </td>'; |
300 |
} |
} |
301 |
|
|
302 |
print '<td> </td><td> </td>'; |
print '<td> </td>'; |
303 |
|
|
304 |
// Statut |
// Statut |
305 |
print '<td align="center">'.img_statut($objp->statut,$langs->trans("ServiceStatusInitial")).'</td>'; |
print '<td align="center">'.img_statut($objp->statut,$langs->trans("ServiceStatusInitial")).'</td>'; |
309 |
if ($objp->date_debut) $dateactstart=$objp->date_debut; |
if ($objp->date_debut) $dateactstart=$objp->date_debut; |
310 |
if ($objp->date_fin) $dateactend=$objp->date_fin; |
if ($objp->date_fin) $dateactend=$objp->date_fin; |
311 |
|
|
312 |
// Dates mise en service |
// Dates de en service prévues et effectives |
313 |
print '<tr '.$bc[$var].'>'; |
|
314 |
print '<td colspan="7">'; |
print '<tr '.$bc[$var].'>'; |
315 |
// Si pas encore activé |
print '<td colspan="7">'; |
|
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 ' - '; |
|
316 |
|
|
317 |
// Si pas encore activé |
// Date prévues |
318 |
if (! $objp->date_debut_reelle) { |
print $langs->trans("DateStartPlanned").': '; |
319 |
print $langs->trans("DateEndPlanned").': '; |
if ($objp->date_debut) { |
320 |
if ($objp->date_fin) { |
print dolibarr_print_date($objp->date_debut); |
321 |
print dolibarr_print_date($objp->date_fin); |
// Warning si date prevu passée et pas en service |
322 |
|
if ($objp->statut == 0 && $objp->date_debut < time() - $conf->contrat->warning_delay) { print " ".img_warning($langs->trans("Late")); } |
323 |
} |
} |
324 |
else print $langs->trans("Unknown"); |
else print $langs->trans("Unknown"); |
325 |
} |
print ' - '; |
|
// Si activé |
|
|
if ($objp->date_debut_reelle && ! $objp->date_fin_reelle) { |
|
326 |
print $langs->trans("DateEndPlanned").': '; |
print $langs->trans("DateEndPlanned").': '; |
327 |
if ($objp->date_fin) { |
if ($objp->date_fin) { |
328 |
print dolibarr_print_date($objp->date_fin); |
print dolibarr_print_date($objp->date_fin); |
329 |
if ($objp->date_fin < time()) { print " ".img_warning($langs->trans("Late")); } |
if ($objp->statut == 4 && $objp->date_fin < time() - $conf->contrat->warning_delay) { print " ".img_warning($langs->trans("Late")); } |
330 |
} |
} |
331 |
else print $langs->trans("Unknown"); |
else print $langs->trans("Unknown"); |
332 |
} |
|
333 |
// Si désactivé |
print '<br>'; |
334 |
if ($objp->date_debut_reelle && $objp->date_fin_reelle) { |
|
335 |
print $langs->trans("DateEndReal").': '; |
// Si pas encore activé |
336 |
print dolibarr_print_date($objp->date_fin_reelle); |
if (! $objp->date_debut_reelle) { |
337 |
} |
print $langs->trans("DateStartReal").': '; |
338 |
print '</td>'; |
if ($objp->date_debut_reelle) print dolibarr_print_date($objp->date_debut_reelle); |
339 |
print '<td> </td>'; |
else print $langs->trans("ContractStatusNotRunning"); |
340 |
print '</tr>'; |
} |
341 |
|
// Si activé et en cours |
342 |
|
if ($objp->date_debut_reelle && ! $objp->date_fin_reelle) { |
343 |
|
print $langs->trans("DateStartReal").': '; |
344 |
|
print dolibarr_print_date($objp->date_debut_reelle); |
345 |
|
} |
346 |
|
// Si désactivé |
347 |
|
if ($objp->date_debut_reelle && $objp->date_fin_reelle) { |
348 |
|
print $langs->trans("DateStartReal").': '; |
349 |
|
print dolibarr_print_date($objp->date_debut_reelle); |
350 |
|
print ' - '; |
351 |
|
print $langs->trans("DateEndReal").': '; |
352 |
|
print dolibarr_print_date($objp->date_fin_reelle); |
353 |
|
} |
354 |
|
print '</td>'; |
355 |
|
print '</tr>'; |
356 |
|
|
357 |
|
|
358 |
$i++; |
$i++; |
406 |
|
|
407 |
print '</tr>'; |
print '</tr>'; |
408 |
|
|
409 |
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="3"><input size="70" type="text" name="commentaire" value="'.$_POST["commentaire"].'"></td></tr>'; |
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="3"><input size="80" type="text" name="commentaire" value="'.$_POST["commentaire"].'"></td></tr>'; |
410 |
|
|
411 |
print '</table>'; |
print '</table>'; |
412 |
|
|