ryxeo-glpi-git / plugins / anet_epacks / front / plugin_anet_epacks.view_endcontract.php @ e8a2f7fa
Historique | Voir | Annoter | Télécharger (3,31 ko)
1 |
<?php
|
---|---|
2 |
|
3 |
// Génère le fichier ODT/PDF pour le revendeur avec son numéro de pack à utiliser. Ce fichier doit contenir un certain nombre d'informations (url pour enregistrer son pack etc.)
|
4 |
|
5 |
if(!defined('GLPI_ROOT')){ |
6 |
define('GLPI_ROOT', '../../..'); |
7 |
} |
8 |
include_once (GLPI_ROOT . "/inc/includes.php"); |
9 |
|
10 |
checkRight("config","w"); |
11 |
//checkSeveralRightsOr(array("config" => "w", "profile" => "w"));
|
12 |
|
13 |
commonHeader("anet_epacks",$_SERVER['PHP_SELF'],"config","plugins"); |
14 |
|
15 |
print "<p>Liste : <a href=\"" . $PHP_SELF . "\">Tous</a> - <a href=\"" . $PHP_SELF . "?year=2008\">2008</a> - <a href=\"" . $PHP_SELF . "?year=2009\">2009</a> - <a href=\"" . $PHP_SELF . "?year=2010\">2010</a> - <a href=\"" . $PHP_SELF . "?year=2011\">2011</a>.</p>"; |
16 |
|
17 |
|
18 |
global $DB; |
19 |
|
20 |
if($_GET['year']) |
21 |
$condition = "AND `begin_date`+INTERVAL `duration` MONTH < '" . $_GET['year'] . "-12-31' AND `begin_date`+INTERVAL `duration` MONTH > '" . $_GET['year'] . "-01-01'"; |
22 |
|
23 |
//Les contrats attribués
|
24 |
//Permet de limiter un peu l'affichage, il faudra faire un système de recherche ou pagination à terme
|
25 |
$query = "SELECT c.*,`begin_date`+INTERVAL `duration` MONTH as endcontract FROM glpi_plugin_anet_epacks |
26 |
LEFT JOIN glpi_contracts AS c ON FK_contract=c.ID
|
27 |
WHERE FK_contract > 0 $condition GROUP BY FK_contract";
|
28 |
//print $query;
|
29 |
//$DB->query($query) or die($DB->error());
|
30 |
$result = $DB->query($query); |
31 |
|
32 |
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n"; |
33 |
print "<tr class='tab_bg_3'> |
34 |
<td>Client</td>
|
35 |
<td>Nom du contrat</td>
|
36 |
<td>Numéro</td>
|
37 |
<td>Coût</td>
|
38 |
<td>Début / Fin</td>
|
39 |
<td>Durée (mois)</td>
|
40 |
<td>ePacks concernés</td>
|
41 |
<td>Documents</td>
|
42 |
</tr>\n";
|
43 |
|
44 |
for($i = 0; $i < $DB->numrows($result); $i++) { |
45 |
$data=$DB->fetch_array($result); |
46 |
|
47 |
$query2="SELECT g.name as clientderyxeo FROM glpi_plugin_anet_epacks AS e LEFT JOIN glpi_entities AS g ON FK_clientderyxeo=g.ID |
48 |
LEFT JOIN glpi_contracts AS c ON FK_contract=c.ID
|
49 |
WHERE FK_contract= '" . $data['ID'] . "'"; |
50 |
//print $query2 . "<br />" . "<br />";
|
51 |
//$DB->query($query) or die($DB->error());
|
52 |
$epacks = ""; |
53 |
$result2 = $DB->query($query2); |
54 |
for($j = 0; $j < $DB->numrows($result2); $j++) { |
55 |
$data2=$DB->fetch_array($result2); |
56 |
$epacks .= $data2['code'] . "<br />"; |
57 |
} |
58 |
|
59 |
$query3="SELECT e.*,g.name as enduser FROM glpi_plugin_anet_epacks AS e LEFT JOIN glpi_entities AS g ON FK_enduser=g.ID |
60 |
LEFT JOIN glpi_contracts AS c ON FK_contract=c.ID
|
61 |
WHERE FK_enduser= '" . $data['FK_entities'] . "' |
62 |
LIMIT 500;";
|
63 |
//print $query3 . "<br />" . "<br />";
|
64 |
$result3 = $DB->query($query3); |
65 |
$enduser = " "; |
66 |
for($j = 0; $j < $DB->numrows($result3); $j++) { |
67 |
if($j>0) |
68 |
$enduser .= " :: "; |
69 |
$data3=$DB->fetch_array($result3); |
70 |
$enduser .= stripslashes($data3['enduser']); |
71 |
} |
72 |
|
73 |
print "<tr class='tab_bg_3'>\n"; |
74 |
print " <td>" . $data2['clientderyxeo'] . " <br /> " . $enduser . "</td> |
75 |
<td>" . $data['name'] . "</td> |
76 |
<td>" . $data['num'] . "</td> |
77 |
<td>" . $data['cost'] . "</td> |
78 |
<td>" . $data['begin_date'] . " <br /> " . $data['endcontract'] . "</td> |
79 |
<td>" . $data['duration'] . "</td> |
80 |
<td>" . $epacks . "</td>\n"; |
81 |
print " <td> |
82 |
<a href=\"plugin_anet_epacks.generate_odt_courrier_end_contract.form.php?clientid=" . $data['FK_entities'] . "&cid=" . $data['ID'] . "&niveau=courrier_endcontract\">Courrier de fin de maintenance</a><br /> |
83 |
</td>
|
84 |
</tr>\n";
|
85 |
} |
86 |
|
87 |
|
88 |
print "</table>"; |
89 |
|
90 |
commonFooter(); |
91 |
?>
|