77 |
|
|
78 |
if ($_GET["id"] > 0) |
if ($_GET["id"] > 0) |
79 |
{ |
{ |
80 |
$commande = new Commande($db); |
$commande = new Commande($db); |
81 |
if ( $commande->fetch($_GET["id"]) > 0) |
if ( $commande->fetch($_GET["id"]) > 0) |
82 |
{ |
{ |
83 |
$soc = new Societe($db); |
$soc = new Societe($db); |
84 |
$soc->fetch($commande->soc_id); |
$soc->fetch($commande->soc_id); |
85 |
$author = new User($db); |
$author = new User($db); |
86 |
$author->id = $commande->user_author_id; |
$author->id = $commande->user_author_id; |
87 |
$author->fetch(); |
$author->fetch(); |
88 |
|
|
89 |
$h=0; |
$h=0; |
90 |
|
|
91 |
if ($conf->commande->enabled && $user->rights->commande->lire) |
if ($conf->commande->enabled && $user->rights->commande->lire) |
92 |
{ |
{ |
93 |
$head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; |
$head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; |
94 |
$head[$h][1] = $langs->trans("OrderCard"); |
$head[$h][1] = $langs->trans("OrderCard"); |
95 |
$h++; |
$h++; |
96 |
} |
} |
97 |
|
|
98 |
if ($conf->expedition->enabled && $user->rights->expedition->lire) |
if ($conf->expedition->enabled && $user->rights->expedition->lire) |
99 |
{ |
{ |
100 |
$head[$h][0] = DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id; |
$head[$h][0] = DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id; |
101 |
$head[$h][1] = $langs->trans("SendingCard"); |
$head[$h][1] = $langs->trans("SendingCard"); |
102 |
$h++; |
$h++; |
103 |
} |
} |
104 |
|
|
105 |
if ($conf->compta->enabled) |
if ($conf->compta->enabled) |
106 |
{ |
{ |
107 |
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; |
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; |
108 |
$head[$h][1] = $langs->trans("ComptaCard"); |
$head[$h][1] = $langs->trans("ComptaCard"); |
109 |
$hselected = $h; |
$hselected = $h; |
110 |
$h++; |
$h++; |
111 |
} |
} |
112 |
|
|
113 |
$head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id; |
$head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id; |
114 |
$head[$h][1] = $langs->trans("Info"); |
$head[$h][1] = $langs->trans("Info"); |
115 |
$h++; |
$h++; |
116 |
|
|
117 |
dolibarr_fiche_head($head, $hselected, $langs->trans("Order").": $commande->ref"); |
dolibarr_fiche_head($head, $hselected, $langs->trans("Order").": $commande->ref"); |
118 |
|
|
119 |
/* |
/* |
120 |
* Commande |
* Commande |
121 |
*/ |
*/ |
122 |
print '<table class="border" width="100%">'; |
print '<table class="border" width="100%">'; |
123 |
print '<tr><td width="15%">'.$langs->trans("Ref")."</td>"; |
|
124 |
print '<td colspan="2">'.$commande->ref.'</td>'; |
print '<tr><td width="15%">'.$langs->trans("Ref")."</td>"; |
125 |
print '<td>'.$langs->trans("Source").' : ' . $commande->sources[$commande->source] ; |
print '<td colspan="2">'.$commande->ref.'</td>'; |
126 |
if ($commande->source == 0) |
print '<td>'.$langs->trans("Source").' : ' . $commande->sources[$commande->source] ; |
127 |
{ |
if ($commande->source == 0) |
128 |
/* Propale */ |
{ |
129 |
$propal = new Propal($db); |
/* Propale */ |
130 |
$propal->fetch($commande->propale_id); |
$propal = new Propal($db); |
131 |
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id.'">'.$propal->ref.'</a>'; |
$propal->fetch($commande->propale_id); |
132 |
} |
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id.'">'.$propal->ref.'</a>'; |
133 |
print "</td></tr>"; |
} |
134 |
|
print "</td></tr>"; |
135 |
print "<tr><td>".$langs->trans("Customer")."</td>"; |
|
136 |
print '<td colspan="3">'; |
// Client |
137 |
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>'; |
print "<tr><td>".$langs->trans("Customer")."</td>"; |
138 |
print '</tr>'; |
print '<td colspan="3">'; |
139 |
|
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>'; |
140 |
print '<tr><td>'.$langs->trans("Status").'</td>'; |
print '</tr>'; |
141 |
print "<td colspan=\"2\">".$commande->statuts[$commande->statut]."</td>\n"; |
|
142 |
|
// Statut |
143 |
|
print '<tr><td>'.$langs->trans("Status").'</td>'; |
144 |
|
print "<td colspan=\"2\">".$commande->statuts[$commande->statut]."</td>\n"; |
145 |
$nbrow=6; |
$nbrow=6; |
146 |
if ($conf->projet->enabled) $nbrow++; |
if ($conf->projet->enabled) $nbrow++; |
147 |
print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans("Note").' :<br>'; |
print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans("Note").' :<br>'; |
148 |
if ($commande->brouillon == 1 && $user->rights->commande->creer) |
if ($commande->brouillon == 1 && $user->rights->commande->creer) |
149 |
{ |
{ |
150 |
print '<form action="fiche.php?id='.$id.'" method="post">'; |
print '<form action="fiche.php?id='.$id.'" method="post">'; |
151 |
print '<input type="hidden" name="action" value="setnote">'; |
print '<input type="hidden" name="action" value="setnote">'; |
152 |
print '<textarea name="note" style="width:95%;height:"80%">'.$commande->note.'</textarea><br>'; |
print '<textarea name="note" style="width:95%;height:"80%">'.$commande->note.'</textarea><br>'; |
153 |
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>'; |
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>'; |
154 |
print '</form>'; |
print '</form>'; |
155 |
} |
} |
156 |
else |
else |
157 |
{ |
{ |
158 |
print nl2br($commande->note); |
print nl2br($commande->note); |
159 |
} |
} |
160 |
print '</td></tr>'; |
print '</td></tr>'; |
161 |
|
|
162 |
print '<tr><td>'.$langs->trans("Date").'</td>'; |
// Date |
163 |
print "<td colspan=\"2\">".dolibarr_print_date($commande->date,"%A %d %B %Y")."</td>\n"; |
print '<tr><td>'.$langs->trans("Date").'</td>'; |
164 |
print '</tr>'; |
print "<td colspan=\"2\">".dolibarr_print_date($commande->date,"%A %d %B %Y")."</td>\n"; |
165 |
|
print '</tr>'; |
166 |
|
|
167 |
|
// Projet |
168 |
|
print '<tr>'; |
169 |
|
if ($conf->projet->enabled) |
170 |
|
{ |
171 |
|
$langs->load("projects"); |
172 |
|
print '<td>'; |
173 |
|
print '<table class="nobordernopadding" width="100%"><tr><td>'; |
174 |
|
print $langs->trans("Project"); |
175 |
|
print '</td>'; |
176 |
|
//if ($_GET["action"] != "classer") print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classer&id='.$commande->id.'">'.img_edit($langs->trans("SetProject")).'</a></td>'; |
177 |
|
print '</tr></table>'; |
178 |
|
print '</td><td colspan="2">'; |
179 |
|
if ($_GET["action"] == "classer") |
180 |
|
{ |
181 |
|
$html->form_project($_SERVER["PHP_SELF"]."?id=$commande->id",$commande->fk_soc,$commande->projetid,"projetid"); |
182 |
|
} |
183 |
|
else |
184 |
|
{ |
185 |
|
$html->form_project($_SERVER["PHP_SELF"]."?id=$commande->id",$commande->fk_soc,$commande->projetid,"none"); |
186 |
|
} |
187 |
|
print "</td>"; |
188 |
|
} |
189 |
|
else |
190 |
|
{ |
191 |
|
print '<td> </td><td colspan="2"> </td>'; |
192 |
|
} |
193 |
|
print '</tr>'; |
194 |
|
|
195 |
|
// Lignes de 3 colonnes |
196 |
|
print '<tr><td>'.$langs->trans("AmountHT").'</td>'; |
197 |
|
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>'; |
198 |
|
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
199 |
|
|
200 |
// Projet |
print '<tr><td>'.$langs->trans("GlobalDiscount").'</td><td align="right">'; |
201 |
if ($conf->projet->enabled) |
print $commande->remise_percent.'%</td><td> '; |
202 |
|
print '</td></tr>'; |
203 |
|
|
204 |
|
print '<tr><td>'.$langs->trans("VAT").'</td><td align="right">'.price($commande->total_tva).'</td>'; |
205 |
|
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
206 |
|
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>'; |
207 |
|
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
208 |
|
|
209 |
|
print '</table><br>'; |
210 |
|
|
211 |
|
/* |
212 |
|
* Lignes de commandes |
213 |
|
* |
214 |
|
*/ |
215 |
|
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,'; |
216 |
|
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid'; |
217 |
|
$sql.= ' FROM '.MAIN_DB_PREFIX."commandedet as l"; |
218 |
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid'; |
219 |
|
$sql.= " WHERE l.fk_commande = ".$commande->id; |
220 |
|
$sql.= " ORDER BY l.rowid"; |
221 |
|
|
222 |
|
$resql = $db->query($sql); |
223 |
|
if ($resql) |
224 |
|
{ |
225 |
|
$num = $db->num_rows($resql); |
226 |
|
$i = 0; $total = 0; |
227 |
|
|
228 |
|
print '<table class="noborder" width="100%">'; |
229 |
|
if ($num) |
230 |
|
{ |
231 |
|
print '<tr class="liste_titre">'; |
232 |
|
print '<td>'.$langs->trans('Description').'</td>'; |
233 |
|
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>'; |
234 |
|
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>'; |
235 |
|
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>'; |
236 |
|
print '<td align="right">'.$langs->trans('Discount').'</td>'; |
237 |
|
print '<td align="right">'.$langs->trans('AmountHT').'</td>'; |
238 |
|
print '<td> </td><td> </td>'; |
239 |
|
print "</tr>\n"; |
240 |
|
} |
241 |
|
|
242 |
|
$var=true; |
243 |
|
while ($i < $num) |
244 |
{ |
{ |
245 |
$langs->load("projects"); |
$objp = $db->fetch_object($resql); |
246 |
print '<td height="10">'; |
|
247 |
print '<table class="nobordernopadding" width="100%"><tr><td>'; |
$var=!$var; |
248 |
print $langs->trans("Project"); |
print '<tr '.$bc[$var].'>'; |
249 |
print '</td>'; |
if ($objp->fk_product > 0) |
|
//if ($_GET["action"] != "classer") print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classer&id='.$commande->id.'">'.img_edit($langs->trans("SetProject")).'</a></td>'; |
|
|
print '</tr></table>'; |
|
|
print '</td><td colspan="2">'; |
|
|
if ($_GET["action"] == "classer") |
|
250 |
{ |
{ |
251 |
$html->form_project($_SERVER["PHP_SELF"]."?id=$commande->id",$commande->fk_soc,$commande->projetid,"projetid"); |
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'; |
252 |
|
if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service'); |
253 |
|
else print img_object($langs->trans('ShowProduct'),'product'); |
254 |
|
print ' '.$objp->ref.'</a> - '.stripslashes(nl2br($objp->product)); |
255 |
|
print ($objp->description && $objp->description!=$objp->product)?'<br>'.$objp->description:''; |
256 |
|
print '</td>'; |
257 |
} |
} |
258 |
else |
else |
259 |
{ |
{ |
260 |
$html->form_project($_SERVER["PHP_SELF"]."?id=$commande->id",$commande->fk_soc,$commande->projetid,"none"); |
print '<td>'.stripslashes(nl2br($objp->description)); |
261 |
|
print "</td>\n"; |
262 |
|
} |
263 |
|
print '<td align="right">'.$objp->tva_tx.'%</td>'; |
264 |
|
|
265 |
|
print '<td align="right">'.price($objp->subprice)."</td>\n"; |
266 |
|
|
267 |
|
print '<td align="right">'.$objp->qty.'</td>'; |
268 |
|
|
269 |
|
if ($objp->remise_percent > 0) |
270 |
|
{ |
271 |
|
print '<td align="right">'.$objp->remise_percent."%</td>\n"; |
272 |
} |
} |
273 |
print "</td>"; |
else |
274 |
} else { |
{ |
275 |
print '<td height="10"> </td><td colspan="2"> </td>'; |
print '<td> </td>'; |
276 |
|
} |
277 |
|
|
278 |
|
print '<td align="right">'.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."</td>\n"; |
279 |
|
|
280 |
|
print '<td> </td><td> </td>'; |
281 |
|
print '</tr>'; |
282 |
|
|
283 |
|
$i++; |
284 |
} |
} |
285 |
|
$db->free($resql); |
286 |
// Lignes de 3 colonnes |
} |
287 |
print '<tr><td>'.$langs->trans("AmountHT").'</td>'; |
else |
288 |
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>'; |
{ |
289 |
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
dolibarr_print_error($db); |
290 |
|
} |
291 |
print '<tr><td>'.$langs->trans("GlobalDiscount").'</td><td align="right">'; |
print '</table>'; |
292 |
print $commande->remise_percent.'%</td><td> '; |
|
293 |
print '</td></tr>'; |
print '</div>'; |
|
|
|
|
print '<tr><td>'.$langs->trans("VAT").'</td><td align="right">'.price($commande->total_tva).'</td>'; |
|
|
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
|
|
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>'; |
|
|
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; |
|
|
|
|
|
print '</table><br>'; |
|
|
|
|
|
/* |
|
|
* Lignes de commandes |
|
|
* |
|
|
*/ |
|
|
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,'; |
|
|
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid'; |
|
|
$sql.= ' FROM '.MAIN_DB_PREFIX."commandedet as l"; |
|
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid'; |
|
|
$sql.= " WHERE l.fk_commande = ".$commande->id; |
|
|
$sql.= " ORDER BY l.rowid"; |
|
|
|
|
|
$resql = $db->query($sql); |
|
|
if ($resql) |
|
|
{ |
|
|
$num = $db->num_rows($resql); |
|
|
$i = 0; $total = 0; |
|
|
|
|
|
print '<table class="noborder" width="100%">'; |
|
|
if ($num) |
|
|
{ |
|
|
print '<tr class="liste_titre">'; |
|
|
print '<td>'.$langs->trans('Description').'</td>'; |
|
|
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>'; |
|
|
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>'; |
|
|
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>'; |
|
|
print '<td align="right">'.$langs->trans('Discount').'</td>'; |
|
|
print '<td align="right">'.$langs->trans('AmountHT').'</td>'; |
|
|
print '<td> </td><td> </td>'; |
|
|
print "</tr>\n"; |
|
|
} |
|
|
|
|
|
$var=true; |
|
|
while ($i < $num) |
|
|
{ |
|
|
$objp = $db->fetch_object($resql); |
|
|
|
|
|
$var=!$var; |
|
|
print '<tr '.$bc[$var].'>'; |
|
|
if ($objp->fk_product > 0) |
|
|
{ |
|
|
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'; |
|
|
if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service'); |
|
|
else print img_object($langs->trans('ShowProduct'),'product'); |
|
|
print ' '.$objp->ref.'</a> - '.stripslashes(nl2br($objp->product)); |
|
|
print ($objp->description && $objp->description!=$objp->product)?'<br>'.$objp->description:''; |
|
|
print '</td>'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print '<td>'.stripslashes(nl2br($objp->description)); |
|
|
print "</td>\n"; |
|
|
} |
|
|
print '<td align="right">'.$objp->tva_tx.'%</td>'; |
|
|
|
|
|
print '<td align="right">'.price($objp->subprice)."</td>\n"; |
|
|
|
|
|
print '<td align="right">'.$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*$objp->qty*(100-$objp->remise_percent)/100)."</td>\n"; |
|
|
|
|
|
print '<td> </td><td> </td>'; |
|
|
print '</tr>'; |
|
|
|
|
|
$i++; |
|
|
} |
|
|
$db->free($resql); |
|
|
} |
|
|
else |
|
|
{ |
|
|
dolibarr_print_error($db); |
|
|
} |
|
|
print '</table>'; |
|
|
|
|
|
print '</div>'; |
|
294 |
|
|
295 |
|
|
296 |
/* |
/* |
297 |
* Boutons actions |
* Boutons actions |
298 |
*/ |
*/ |
299 |
|
|
300 |
if (! $user->societe_id && ! $commande->facturee) |
if (! $user->societe_id && ! $commande->facturee) |
301 |
{ |
{ |
302 |
print "<div class=\"tabsAction\">\n"; |
print "<div class=\"tabsAction\">\n"; |
303 |
|
|
304 |
if ($commande->statut > 0 && $user->rights->facture->creer) |
if ($commande->statut > 0 && $user->rights->facture->creer) |
305 |
{ |
{ |
306 |
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&commandeid='.$commande->id.'&socidp='.$commande->soc_id.'">'.$langs->trans("CreateBill").'</a>'; |
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&commandeid='.$commande->id.'&socidp='.$commande->soc_id.'">'.$langs->trans("CreateBill").'</a>'; |
307 |
} |
} |
308 |
|
|
309 |
if ($user->rights->commande->creer) |
if ($user->rights->commande->creer) |
310 |
{ |
{ |
311 |
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/commande/fiche.php?action=facturee&id='.$commande->id.'">'.$langs->trans("ClassifyBilled").'</a>'; |
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/commande/fiche.php?action=facturee&id='.$commande->id.'">'.$langs->trans("ClassifyBilled").'</a>'; |
312 |
} |
} |
313 |
print '</div>'; |
print '</div>'; |
314 |
} |
} |
|
|
|
315 |
|
|
|
print "<table width=\"100%\"><tr><td width=\"50%\" valign=\"top\">"; |
|
316 |
|
|
317 |
|
print "<table width=\"100%\"><tr><td width=\"50%\" valign=\"top\">"; |
318 |
|
|
319 |
/* |
|
320 |
* Documents générés |
/* |
321 |
* |
* Documents générés |
322 |
*/ |
* |
323 |
$file = $conf->facture->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf"; |
*/ |
324 |
$relativepath = $commande->ref."/".$commande->ref.".pdf"; |
$file = $conf->facture->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf"; |
325 |
|
$relativepath = $commande->ref."/".$commande->ref.".pdf"; |
326 |
$var=true; |
|
327 |
|
$var=true; |
328 |
if (file_exists($file)) |
|
329 |
{ |
if (file_exists($file)) |
|
print_titre($langs->trans("Documents")); |
|
|
print '<table width="100%" class="border">'; |
|
|
|
|
|
print "<tr $bc[$var]><td>".$langs->trans("Order")." PDF</td>"; |
|
|
print '<td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>'; |
|
|
print '<td align="right">'.filesize($file). ' bytes</td>'; |
|
|
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>'; |
|
|
print '</tr>'; |
|
|
|
|
|
print "</table>\n"; |
|
|
|
|
|
} |
|
|
|
|
|
/* |
|
|
* Liste des factures |
|
|
*/ |
|
|
$sql = "SELECT f.rowid,f.facnumber, f.total_ttc, ".$db->pdate("f.datef")." as df"; |
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."co_fa as cf"; |
|
|
$sql .= " WHERE f.rowid = cf.fk_facture AND cf.fk_commande = ". $commande->id; |
|
|
|
|
|
$result = $db->query($sql); |
|
|
if ($result) |
|
|
{ |
|
|
$num = $db->num_rows($result); |
|
|
if ($num) |
|
|
{ |
|
|
print '<br>'; |
|
|
print_titre($langs->trans("RelatedBills")); |
|
|
$i = 0; $total = 0; |
|
|
print '<table class="noborder" width="100%">'; |
|
|
print '<tr class="liste_titre"><td>'.$langs->trans("Ref")."</td>"; |
|
|
print '<td align="center">'.$langs->trans("Date").'</td>'; |
|
|
print '<td align="right">'.$langs->trans("Price").'</td>'; |
|
|
print "</tr>\n"; |
|
|
|
|
|
$var=True; |
|
|
while ($i < $num) |
|
|
{ |
|
|
$objp = $db->fetch_object($result); |
|
|
$var=!$var; |
|
|
print "<tr $bc[$var]>"; |
|
|
print '<td><a href="../facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.'</a></td>'; |
|
|
print '<td align="center">'.dolibarr_print_date($objp->df).'</td>'; |
|
|
print '<td align="right">'.$objp->total_ttc.'</td></tr>'; |
|
|
$i++; |
|
|
} |
|
|
print "</table>"; |
|
|
} |
|
|
} |
|
|
else |
|
|
{ |
|
|
dolibarr_print_error($db); |
|
|
} |
|
|
|
|
|
print '</td><td valign="top" width="50%">'; |
|
|
|
|
|
/* |
|
|
* Liste des expéditions |
|
|
*/ |
|
|
$sql = "SELECT e.rowid,e.ref,".$db->pdate("e.date_expedition")." as de"; |
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; |
|
|
$sql .= " WHERE e.fk_commande = ". $commande->id; |
|
|
|
|
|
$result = $db->query($sql); |
|
|
if ($result) |
|
|
{ |
|
|
$num = $db->num_rows($result); |
|
|
if ($num) |
|
330 |
{ |
{ |
331 |
print_titre($langs->trans("Sendings")); |
print_titre($langs->trans("Documents")); |
332 |
$i = 0; $total = 0; |
print '<table width="100%" class="border">'; |
333 |
print '<table class="border" width="100%">'; |
|
334 |
print "<tr $bc[$var]><td>".$langs->trans("Sendings")."</td><td>".$langs->trans("Date")."</td></tr>\n"; |
print "<tr $bc[$var]><td>".$langs->trans("Order")." PDF</td>"; |
335 |
|
print '<td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>'; |
336 |
$var=True; |
print '<td align="right">'.filesize($file). ' bytes</td>'; |
337 |
while ($i < $num) |
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>'; |
338 |
|
print '</tr>'; |
339 |
|
|
340 |
|
print "</table>\n"; |
341 |
|
|
342 |
|
} |
343 |
|
|
344 |
|
/* |
345 |
|
* Liste des factures |
346 |
|
*/ |
347 |
|
$sql = "SELECT f.rowid,f.facnumber, f.total_ttc, ".$db->pdate("f.datef")." as df"; |
348 |
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."co_fa as cf"; |
349 |
|
$sql .= " WHERE f.rowid = cf.fk_facture AND cf.fk_commande = ". $commande->id; |
350 |
|
|
351 |
|
$result = $db->query($sql); |
352 |
|
if ($result) |
353 |
|
{ |
354 |
|
$num = $db->num_rows($result); |
355 |
|
if ($num) |
356 |
{ |
{ |
357 |
$objp = $db->fetch_object($result); |
print '<br>'; |
358 |
$var=!$var; |
print_titre($langs->trans("RelatedBills")); |
359 |
print "<tr $bc[$var]>"; |
$i = 0; $total = 0; |
360 |
print '<td><a href="../../expedition/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowSending"),"sending").' '.$objp->ref.'</a></td>'; |
print '<table class="noborder" width="100%">'; |
361 |
print "<td>".dolibarr_print_date($objp->de)."</td></tr>\n"; |
print '<tr class="liste_titre"><td>'.$langs->trans("Ref")."</td>"; |
362 |
$i++; |
print '<td align="center">'.$langs->trans("Date").'</td>'; |
363 |
|
print '<td align="right">'.$langs->trans("Price").'</td>'; |
364 |
|
print "</tr>\n"; |
365 |
|
|
366 |
|
$var=True; |
367 |
|
while ($i < $num) |
368 |
|
{ |
369 |
|
$objp = $db->fetch_object($result); |
370 |
|
$var=!$var; |
371 |
|
print "<tr $bc[$var]>"; |
372 |
|
print '<td><a href="../facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.'</a></td>'; |
373 |
|
print '<td align="center">'.dolibarr_print_date($objp->df).'</td>'; |
374 |
|
print '<td align="right">'.$objp->total_ttc.'</td></tr>'; |
375 |
|
$i++; |
376 |
|
} |
377 |
|
print "</table>"; |
378 |
} |
} |
|
print "</table>"; |
|
379 |
} |
} |
380 |
} |
else |
381 |
else |
{ |
382 |
{ |
dolibarr_print_error($db); |
383 |
dolibarr_print_error($db); |
} |
384 |
} |
|
385 |
|
print '</td><td valign="top" width="50%">'; |
386 |
|
|
387 |
|
/* |
388 |
|
* Liste des expéditions |
389 |
|
*/ |
390 |
|
$sql = "SELECT e.rowid,e.ref,".$db->pdate("e.date_expedition")." as de"; |
391 |
|
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; |
392 |
|
$sql .= " WHERE e.fk_commande = ". $commande->id; |
393 |
|
|
394 |
|
$result = $db->query($sql); |
395 |
|
if ($result) |
396 |
|
{ |
397 |
|
$num = $db->num_rows($result); |
398 |
|
if ($num) |
399 |
|
{ |
400 |
|
print_titre($langs->trans("Sendings")); |
401 |
|
$i = 0; $total = 0; |
402 |
|
print '<table class="border" width="100%">'; |
403 |
|
print "<tr $bc[$var]><td>".$langs->trans("Sendings")."</td><td>".$langs->trans("Date")."</td></tr>\n"; |
404 |
|
|
405 |
|
$var=True; |
406 |
|
while ($i < $num) |
407 |
|
{ |
408 |
|
$objp = $db->fetch_object($result); |
409 |
|
$var=!$var; |
410 |
|
print "<tr $bc[$var]>"; |
411 |
|
print '<td><a href="../../expedition/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowSending"),"sending").' '.$objp->ref.'</a></td>'; |
412 |
|
print "<td>".dolibarr_print_date($objp->de)."</td></tr>\n"; |
413 |
|
$i++; |
414 |
|
} |
415 |
|
print "</table>"; |
416 |
|
} |
417 |
|
} |
418 |
|
else |
419 |
|
{ |
420 |
|
dolibarr_print_error($db); |
421 |
|
} |
422 |
|
|
423 |
|
print "</td></tr></table>"; |
424 |
|
|
|
print "</td></tr></table>"; |
|
|
|
|
425 |
} |
} |
426 |
else |
else |
427 |
{ |
{ |
428 |
// Commande non trouvée |
// Commande non trouvée |
429 |
print "Commande inexistante"; |
print "Commande inexistante"; |
430 |
} |
} |
431 |
} |
} |
432 |
|
|