18 |
* |
* |
19 |
* $Id$ |
* $Id$ |
20 |
* $Source$ |
* $Source$ |
|
* |
|
21 |
*/ |
*/ |
22 |
|
|
23 |
/** |
/** |
72 |
|
|
73 |
if ($socid) |
if ($socid) |
74 |
{ |
{ |
75 |
$sql .= " AND s.idp=$socid"; |
$sql .= " AND s.idp=$socid"; |
76 |
} |
} |
77 |
|
|
78 |
if (strlen($_GET["statut"])) |
if (strlen($_GET["statut"])) |
79 |
{ |
{ |
80 |
$sql .= " AND fk_statut =".$_GET["statut"]; |
$sql .= " AND fk_statut =".$_GET["statut"]; |
81 |
} |
} |
82 |
|
|
83 |
if (strlen($_GET["search_ref"])) |
if (strlen($_GET["search_ref"])) |
84 |
{ |
{ |
85 |
$sql .= " AND cf.ref LIKE '%".$_GET["search_ref"]."%'"; |
$sql .= " AND cf.ref LIKE '%".$_GET["search_ref"]."%'"; |
86 |
} |
} |
87 |
|
|
88 |
if (strlen($_GET["search_nom"])) |
if (strlen($_GET["search_nom"])) |
89 |
{ |
{ |
90 |
$sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'"; |
$sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'"; |
91 |
} |
} |
92 |
|
|
93 |
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); |
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); |
95 |
$resql = $db->query($sql); |
$resql = $db->query($sql); |
96 |
if ($resql) |
if ($resql) |
97 |
{ |
{ |
98 |
$num = $db->num_rows($resql); |
$num = $db->num_rows($resql); |
99 |
$i = 0; |
$i = 0; |
100 |
|
|
101 |
|
|
102 |
print_barre_liste($title, $page, "liste.php", "", $sortfield, $sortorder, '', $num); |
print_barre_liste($title, $page, "liste.php", "", $sortfield, $sortorder, '', $num); |
103 |
|
|
104 |
print '<table class="liste">'; |
print '<table class="liste">'; |
105 |
print '<tr class="liste_titre">'; |
print '<tr class="liste_titre">'; |
106 |
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref"); |
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref"); |
107 |
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom"); |
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom"); |
108 |
print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc"); |
print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","","",'align="center"'); |
109 |
print "</tr>\n"; |
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","","",'align="center"'); |
110 |
|
print "</tr>\n"; |
111 |
print '<tr class="liste_titre">'; |
|
112 |
print '<form action="liste.php" method="GET">'; |
print '<tr class="liste_titre">'; |
113 |
print '<td><input type="text" class="flat" name="search_ref" value="'.$_GET["search_ref"].'"></td>'; |
print '<form action="liste.php" method="GET">'; |
114 |
print '<td><input type="text" class="flat" name="search_nom" value="'.$_GET["search_nom"].'"></td>'; |
print '<td><input type="text" class="flat" name="search_ref" value="'.$_GET["search_ref"].'"></td>'; |
115 |
print '<td><input class="button" type="submit" value="'.$langs->trans("Search").'"></td>'; |
print '<td><input type="text" class="flat" name="search_nom" value="'.$_GET["search_nom"].'"></td>'; |
116 |
print '</form>'; |
print '<td colspan="2" class="liste_titre" align="right">'; |
117 |
print '</tr>'; |
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">'; |
118 |
|
print '</td>'; |
119 |
|
print '</form>'; |
120 |
|
print '</tr>'; |
121 |
|
|
122 |
$var=true; |
$var=true; |
123 |
|
|
124 |
while ($i < min($num,$conf->liste_limit)) |
while ($i < min($num,$conf->liste_limit)) |
125 |
{ |
{ |
126 |
$obj = $db->fetch_object($resql); |
$obj = $db->fetch_object($resql); |
127 |
$var=!$var; |
$var=!$var; |
128 |
|
|
129 |
|
print "<tr $bc[$var]>"; |
130 |
|
|
131 |
|
// Ref |
132 |
|
print '<td><a href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.'</a></td>'."\n"; |
133 |
|
|
134 |
|
// Société |
135 |
|
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '; |
136 |
|
print $obj->nom.'</a></td>'."\n"; |
137 |
|
|
138 |
|
// Date |
139 |
|
print "<td align=\"center\" width=\"100\">"; |
140 |
|
if ($obj->dc) |
141 |
|
{ |
142 |
|
print dolibarr_print_date($obj->dc,"%e %b %Y"); |
143 |
|
} |
144 |
|
else |
145 |
|
{ |
146 |
|
print "-"; |
147 |
|
} |
148 |
|
print '</td>'; |
149 |
|
|
150 |
|
// Statut |
151 |
|
print '<td align="center"><img src="statut'.$obj->fk_statut.'.png"></td>'; |
152 |
|
|
153 |
print "<tr $bc[$var]>"; |
print "</tr>\n"; |
154 |
print '<td><img src="statut'.$obj->fk_statut.'.png">'; |
$i++; |
|
print ' <a href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$obj->rowid.'">'.$obj->ref.'</a></td>'."\n"; |
|
|
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '; |
|
|
print $obj->nom.'</a></td>'."\n"; |
|
|
|
|
|
print "<td align=\"right\" width=\"100\">"; |
|
|
if ($obj->dc) |
|
|
{ |
|
|
print dolibarr_print_date($obj->dc,"%e %b %Y"); |
|
|
} |
|
|
else |
|
|
{ |
|
|
print "-"; |
|
|
} |
|
|
print '</td>'; |
|
|
print "</tr>\n"; |
|
|
$i++; |
|
155 |
} |
} |
156 |
print "</table>"; |
print "</table>"; |
157 |
$db->free($resql); |
$db->free($resql); |
158 |
} |
} |
159 |
else |
else |
160 |
{ |
{ |
161 |
dolibarr_print_error($db); |
dolibarr_print_error($db); |
162 |
} |
} |
163 |
|
|
164 |
$db->close(); |
$db->close(); |