18 |
* |
* |
19 |
* $Id$ |
* $Id$ |
20 |
* $Source$ |
* $Source$ |
|
* |
|
21 |
*/ |
*/ |
22 |
|
|
23 |
/** |
/** |
24 |
\file htdocs/compta/paiement.php |
\file htdocs/compta/paiement.php |
25 |
\ingroup compta |
\ingroup compta |
26 |
\brief Page de création d'un paiement |
\brief Page de création d'un paiement |
27 |
\version $Revision$ |
\version $Revision$ |
28 |
*/ |
*/ |
29 |
|
|
30 |
include_once("./pre.inc.php"); |
include_once("./pre.inc.php"); |
32 |
include_once(DOL_DOCUMENT_ROOT."/facture.class.php"); |
include_once(DOL_DOCUMENT_ROOT."/facture.class.php"); |
33 |
include_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); |
include_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); |
34 |
|
|
35 |
|
$langs->load("bills"); |
36 |
|
$langs->load("banks"); |
37 |
|
|
38 |
$facid=isset($_GET["facid"])?$_GET["facid"]:$_POST["facid"]; |
$facid=isset($_GET["facid"])?$_GET["facid"]:$_POST["facid"]; |
39 |
$socname=isset($_GET["socname"])?$_GET["socname"]:$_POST["socname"]; |
$socname=isset($_GET["socname"])?$_GET["socname"]:$_POST["socname"]; |
40 |
|
|
48 |
*/ |
*/ |
49 |
if ($_POST["action"] == 'add_paiement') |
if ($_POST["action"] == 'add_paiement') |
50 |
{ |
{ |
51 |
$error = 0; |
$error = 0; |
52 |
|
|
53 |
if ($_POST["paiementid"] > 0) |
if ($_POST["paiementid"] > 0) |
54 |
{ |
{ |
55 |
$datepaye = $db->idate(mktime(12, 0 , 0, |
$datepaye = $db->idate(mktime(12, 0 , 0, |
56 |
$_POST["remonth"], |
$_POST["remonth"], |
57 |
$_POST["reday"], |
$_POST["reday"], |
58 |
$_POST["reyear"])); |
$_POST["reyear"])); |
59 |
|
|
60 |
$paiement_id = 0; |
$paiement_id = 0; |
61 |
$total = 0; |
$total = 0; |
62 |
$amounts = array(); |
$amounts = array(); |
63 |
foreach ($_POST as $key => $value) |
foreach ($_POST as $key => $value) |
64 |
{ |
{ |
65 |
if (substr($key,0,7) == 'amount_') |
if (substr($key,0,7) == 'amount_') |
66 |
{ |
{ |
67 |
$other_facid = substr($key,7); |
$other_facid = substr($key,7); |
68 |
|
|
69 |
$amounts[$other_facid] = $_POST[$key]; |
$amounts[$other_facid] = $_POST[$key]; |
70 |
$total = $total + $amounts[$other_facid]; |
$total = $total + $amounts[$other_facid]; |
71 |
} |
} |
72 |
} |
} |
73 |
|
|
74 |
if ($total > 0) |
if ($total > 0) |
75 |
{ |
{ |
76 |
|
|
77 |
$db->begin(); |
$db->begin(); |
78 |
|
|
79 |
// Creation de la ligne paiement |
// Creation de la ligne paiement |
80 |
$paiement = new Paiement($db); |
$paiement = new Paiement($db); |
81 |
$paiement->datepaye = $datepaye; |
$paiement->datepaye = $datepaye; |
82 |
$paiement->amounts = $amounts; // Tableau de montant |
$paiement->amounts = $amounts; // Tableau de montant |
83 |
$paiement->paiementid = $_POST["paiementid"]; |
$paiement->paiementid = $_POST["paiementid"]; |
84 |
$paiement->num_paiement = $_POST["num_paiement"]; |
$paiement->num_paiement = $_POST["num_paiement"]; |
85 |
$paiement->note = $_POST["comment"]; |
$paiement->note = $_POST["comment"]; |
86 |
|
|
87 |
$paiement_id = $paiement->create($user); |
$paiement_id = $paiement->create($user); |
88 |
|
|
89 |
if ($paiement_id > 0) |
if ($paiement_id > 0) |
90 |
{ |
{ |
91 |
// On determine le montant total du paiement |
// On determine le montant total du paiement |
92 |
$total=0; |
$total=0; |
93 |
foreach ($paiement->amounts as $key => $value) |
foreach ($paiement->amounts as $key => $value) |
94 |
{ |
{ |
95 |
$facid = $key; |
$facid = $key; |
96 |
$value = trim($value); |
$value = trim($value); |
97 |
$amount = round(ereg_replace(",",".",$value), 2); |
$amount = round(ereg_replace(",",".",$value), 2); |
98 |
if (is_numeric($amount)) |
if (is_numeric($amount)) |
99 |
{ |
{ |
100 |
$total += $amount; |
$total += $amount; |
101 |
} |
} |
102 |
} |
} |
103 |
|
|
104 |
if ($conf->banque->enabled && $_POST["accountid"]) |
if ($conf->banque->enabled) |
105 |
{ |
{ |
106 |
// Insertion dans llx_bank |
// Si module bank actif, un compte est obligatoire lors de la saisie |
107 |
$label = "Règlement facture"; |
// d'un paiement |
108 |
$acc = new Account($db, $_POST["accountid"]); |
if (! $_POST["accountid"]) |
109 |
//paiementid contient "CHQ ou VIR par exemple" |
{ |
110 |
$bank_line_id = $acc->addline($paiement->datepaye, |
$fiche_erreur_message = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("AccountToCredit")).'</div>'; |
111 |
$paiement->paiementid, |
$error++; |
112 |
$label, |
} |
113 |
$total, |
else |
114 |
$paiement->num_paiement, |
{ |
115 |
'', |
// Insertion dans llx_bank |
116 |
$user); |
$label = "Règlement facture"; |
117 |
|
$acc = new Account($db, $_POST["accountid"]); |
118 |
|
//paiementid contient "CHQ ou VIR par exemple" |
119 |
// Mise a jour fk_bank dans llx_paiement. |
$bank_line_id = $acc->addline($paiement->datepaye, |
120 |
// On connait ainsi le paiement qui a généré l'écriture bancaire |
$paiement->paiementid, |
121 |
if ($bank_line_id > 0) |
$label, |
122 |
{ |
$total, |
123 |
$paiement->update_fk_bank($bank_line_id); |
$paiement->num_paiement, |
124 |
|
'', |
125 |
// Mise a jour liens (pour chaque facture concernées par le paiement) |
$user); |
126 |
foreach ($paiement->amounts as $key => $value) |
|
127 |
{ |
|
128 |
$facid = $key; |
// Mise a jour fk_bank dans llx_paiement. |
129 |
$fac = new Facture($db); |
// On connait ainsi le paiement qui a généré l'écriture bancaire |
130 |
$fac->fetch($facid); |
if ($bank_line_id > 0) |
131 |
$fac->fetch_client(); |
{ |
132 |
$acc->add_url_line($bank_line_id, |
$paiement->update_fk_bank($bank_line_id); |
133 |
$paiement_id, |
|
134 |
DOL_URL_ROOT.'/compta/paiement/fiche.php?id=', |
// Mise a jour liens (pour chaque facture concernées par le paiement) |
135 |
"(paiement)", |
foreach ($paiement->amounts as $key => $value) |
136 |
'payment'); |
{ |
137 |
$acc->add_url_line($bank_line_id, |
$facid = $key; |
138 |
$fac->client->id, |
$fac = new Facture($db); |
139 |
DOL_URL_ROOT.'/compta/fiche.php?socid=', |
$fac->fetch($facid); |
140 |
$fac->client->nom, |
$fac->fetch_client(); |
141 |
'company'); |
$acc->add_url_line($bank_line_id, |
142 |
} |
$paiement_id, |
143 |
|
DOL_URL_ROOT.'/compta/paiement/fiche.php?id=', |
144 |
} |
"(paiement)", |
145 |
else |
'payment'); |
146 |
{ |
$acc->add_url_line($bank_line_id, |
147 |
$error++; |
$fac->client->id, |
148 |
} |
DOL_URL_ROOT.'/compta/fiche.php?socid=', |
149 |
} |
$fac->client->nom, |
150 |
|
'company'); |
151 |
} |
} |
152 |
else |
|
153 |
{ |
} |
154 |
$error++; |
else |
155 |
} |
{ |
156 |
|
$error++; |
157 |
|
} |
158 |
if ($error == 0) |
} |
159 |
{ |
} |
160 |
$loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id; |
|
161 |
$db->commit(); |
} |
162 |
Header("Location: $loc"); |
else |
163 |
} |
{ |
164 |
else |
$error++; |
165 |
{ |
} |
166 |
// Il y a eu erreur |
|
167 |
$db->rollback(); |
|
168 |
$fiche_erreur_message = $langs->trans("ErrorUnknown"); |
if ($error == 0) |
169 |
} |
{ |
170 |
} |
$loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id; |
171 |
else |
$db->commit(); |
172 |
{ |
Header("Location: $loc"); |
173 |
$fiche_erreur_message = '<div class="error">Aucun montants indiqués</div>'; |
} |
174 |
} |
else |
175 |
|
{ |
176 |
|
$db->rollback(); |
177 |
|
} |
178 |
|
} |
179 |
|
else |
180 |
|
{ |
181 |
|
$fiche_erreur_message = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Amount")).'</div>'; |
182 |
|
} |
183 |
} |
} |
184 |
else |
else |
185 |
{ |
{ |
186 |
$fiche_erreur_message = '<div class="error">Vous devez sélectionner un mode de paiement</div>'; |
$fiche_erreur_message = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("PaymentMode")).'</div>'; |
187 |
} |
} |
188 |
} |
} |
189 |
|
|
190 |
/* |
// Sécurité accés client |
|
* Sécurité accés client |
|
|
*/ |
|
191 |
if ($user->societe_id > 0) |
if ($user->societe_id > 0) |
192 |
{ |
{ |
193 |
$action = ''; |
$action = ''; |
194 |
$socidp = $user->societe_id; |
$socidp = $user->societe_id; |
195 |
} |
} |
196 |
|
|
197 |
|
|
198 |
/* |
/* |
199 |
* Affichage |
* Affichage |
200 |
*/ |
*/ |
205 |
|
|
206 |
if ($fiche_erreur_message) |
if ($fiche_erreur_message) |
207 |
{ |
{ |
208 |
print '<tr><td colspan="3" align="center">'.$fiche_erreur_message.'</td></tr>'; |
print '<tr><td colspan="3" align="center">'.$fiche_erreur_message.'</td></tr>'; |
209 |
} |
} |
210 |
|
|
211 |
|
if ($_GET["action"] == 'create' || $_POST["action"] == 'add_paiement') |
|
if ($_GET["action"] == 'create' || $_POST["action"] == 'add_paiement') |
|
212 |
{ |
{ |
213 |
$facture = new Facture($db); |
$facture = new Facture($db); |
214 |
$facture->fetch($facid); |
$facture->fetch($facid); |
215 |
|
|
216 |
$sql = "SELECT s.nom,s.idp, f.amount, f.total_ttc as total, f.facnumber"; |
$sql = "SELECT s.nom,s.idp, f.amount, f.total_ttc as total, f.facnumber"; |
217 |
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp"; |
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp"; |
218 |
$sql .= " AND f.rowid = $facid"; |
$sql .= " AND f.rowid = $facid"; |
219 |
|
|
220 |
$resql = $db->query($sql); |
$resql = $db->query($sql); |
221 |
if ($resql) |
if ($resql) |
222 |
{ |
{ |
223 |
$num = $db->num_rows($resql); |
$num = $db->num_rows($resql); |
224 |
if ($num) |
if ($num) |
225 |
{ |
{ |
226 |
$obj = $db->fetch_object($resql); |
$obj = $db->fetch_object($resql); |
227 |
|
|
228 |
$total = $obj->total; |
$total = $obj->total; |
229 |
|
|
230 |
print_titre($langs->trans("DoPayment")); |
print_titre($langs->trans("DoPayment")); |
231 |
|
|
232 |
print '<form action="paiement.php" method="post">'; |
print '<form action="paiement.php" method="post">'; |
233 |
print '<input type="hidden" name="action" value="add_paiement">'; |
print '<input type="hidden" name="action" value="add_paiement">'; |
234 |
print "<input type=\"hidden\" name=\"facid\" value=\"$facid\">"; |
print "<input type=\"hidden\" name=\"facid\" value=\"$facid\">"; |
235 |
print "<input type=\"hidden\" name=\"facnumber\" value=\"$obj->facnumber\">"; |
print "<input type=\"hidden\" name=\"facnumber\" value=\"$obj->facnumber\">"; |
236 |
print "<input type=\"hidden\" name=\"socid\" value=\"$obj->idp\">"; |
print "<input type=\"hidden\" name=\"socid\" value=\"$obj->idp\">"; |
237 |
print "<input type=\"hidden\" name=\"societe\" value=\"$obj->nom\">"; |
print "<input type=\"hidden\" name=\"societe\" value=\"$obj->nom\">"; |
238 |
|
|
239 |
print '<table class="border" width="100%">'; |
print '<table class="border" width="100%">'; |
240 |
|
|
241 |
print "<tr><td>".$langs->trans("Company")." :</td><td colspan=\"2\">$obj->nom</td></tr>\n"; |
print "<tr><td>".$langs->trans("Company")."</td><td colspan=\"2\">$obj->nom</td></tr>\n"; |
242 |
|
|
243 |
print "<tr><td>".$langs->trans("Date")." :</td><td>"; |
print "<tr><td>".$langs->trans("Date")."</td><td>"; |
244 |
$html->select_date(); |
$html->select_date(); |
245 |
print '</td>'; |
print '</td>'; |
246 |
print '<td>'.$langs->trans("Comments").'</td></tr>'; |
print '<td>'.$langs->trans("Comments").'</td></tr>'; |
247 |
|
|
248 |
print '<tr><td>'.$langs->trans("Type").' :</td><td><select name="paiementid">'; |
print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>'; |
249 |
|
$html->select_types_paiements('','paiementid'); |
250 |
$sql = "SELECT id, libelle FROM ".MAIN_DB_PREFIX."c_paiement ORDER BY id"; |
print "</td>\n"; |
251 |
|
|
252 |
$resql = $db->query($sql); |
print '<td rowspan="3" valign="top">'; |
253 |
if ($resql) |
print '<textarea name="comment" wrap="soft" cols="40" rows="4"></textarea></td></tr>'; |
254 |
{ |
|
255 |
$num = $db->num_rows($resql); |
print "<tr><td>".$langs->trans("Numero")."</td><td><input name=\"num_paiement\" type=\"text\"><br><em>Numéro du chèque / virement</em></td></tr>\n"; |
256 |
$i = 0; |
|
257 |
while ($i < $num) |
|
258 |
{ |
if ($conf->banque->enabled) |
259 |
$objopt = $db->fetch_object($resql); |
{ |
260 |
print "<option value=\"$objopt->id\">$objopt->libelle</option>\n"; |
print "<tr><td>".$langs->trans("AccountToCredit")."</td><td>"; |
261 |
$i++; |
$html->select_comptes('','accountid',0,'',1); |
262 |
} |
print "</td></tr>\n"; |
263 |
} |
} |
264 |
print "</select>"; |
else |
265 |
print "</td>\n"; |
{ |
266 |
|
print '<tr><td colspan="2"> </td></tr>'; |
267 |
print '<td rowspan="3" valign="top">'; |
} |
268 |
print '<textarea name="comment" wrap="soft" cols="40" rows="4"></textarea></td></tr>'; |
|
269 |
|
/* |
270 |
print "<tr><td>Numéro :</td><td><input name=\"num_paiement\" type=\"text\"><br><em>Numéro du chèque / virement</em></td></tr>\n"; |
* Autres factures impayées |
271 |
|
*/ |
272 |
|
$sql = "SELECT f.rowid as facid,f.facnumber,f.total_ttc,".$db->pdate("f.datef")." as df"; |
273 |
if ($conf->banque->enabled) |
$sql .= ", sum(pf.amount) as am"; |
274 |
{ |
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; |
275 |
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON pf.fk_facture = f.rowid"; |
276 |
print "<tr><td>Compte à créditer :</td><td><select name=\"accountid\">\n"; |
$sql .= " WHERE f.fk_soc = ".$facture->socidp; |
277 |
|
$sql .= " AND f.paye = 0"; |
278 |
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_account ORDER BY rowid"; |
$sql .= " AND f.fk_statut = 1"; // Statut=0 => non validée, Statut=2 => annulée |
279 |
|
$sql .= " GROUP BY f.facnumber"; |
280 |
$resql = $db->query($sql); |
|
281 |
if ($resql) |
$resql = $db->query($sql); |
282 |
{ |
|
283 |
$num = $db->num_rows(); |
if ($resql) |
284 |
$i = 0; |
{ |
285 |
while ($i < $num) |
$num = $db->num_rows($resql); |
286 |
{ |
|
287 |
$objopt = $db->fetch_object($resql); |
if ($num > 0) |
288 |
print '<option value="'.$objopt->rowid.'"'; |
{ |
289 |
if (defined("FACTURE_RIB_NUMBER") && FACTURE_RIB_NUMBER == $objopt->rowid) |
$i = 0; |
290 |
{ |
print '<tr><td colspan="3">'; |
291 |
print ' selected'; |
print '<table class="noborder" width="100%">'; |
292 |
} |
print '<tr class="liste_titre">'; |
293 |
print '>'.$objopt->label.'</option>'; |
print '<td>'.$langs->trans("Bill").'</td><td align="center">'.$langs->trans("Date").'</td>'; |
294 |
$i++; |
print '<td align="right">'.$langs->trans("AmountTTC").'</td>'; |
295 |
} |
print '<td align="right">'.$langs->trans("Received").'</td>'; |
296 |
$db->free($resql); |
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>'; |
297 |
} |
print '<td align="center">'.$langs->trans("Amount").'</td>'; |
298 |
print "</select>"; |
print "</tr>\n"; |
299 |
print "</td></tr>\n"; |
|
300 |
|
$var=True; |
301 |
} |
$total=0; |
302 |
else |
$totalrecu=0; |
303 |
{ |
|
304 |
print '<tr><td colspan="2"> </td></tr>'; |
while ($i < $num) |
305 |
} |
{ |
306 |
|
$objp = $db->fetch_object($resql); |
307 |
/* |
$var=!$var; |
308 |
* Autres factures impayées |
|
309 |
*/ |
print "<tr $bc[$var]>"; |
310 |
|
|
311 |
$sql = "SELECT f.rowid as facid,f.facnumber,f.total_ttc,".$db->pdate("f.datef")." as df"; |
print '<td><a href="facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber; |
312 |
$sql .= ", sum(pf.amount) as am"; |
print "</a></td>\n"; |
313 |
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; |
|
314 |
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON pf.fk_facture = f.rowid"; |
if ($objp->df > 0 ) |
315 |
$sql .= " WHERE f.fk_soc = ".$facture->socidp; |
{ |
316 |
$sql .= " AND f.paye = 0"; |
print "<td align=\"center\">"; |
317 |
$sql .= " AND f.fk_statut = 1"; // Statut=0 => non validée, Statut=2 => annulée |
print strftime("%d %b %Y",$objp->df)."</td>\n"; |
318 |
$sql .= " GROUP BY f.facnumber"; |
} |
319 |
|
else |
320 |
$resql = $db->query($sql); |
{ |
321 |
|
print "<td align=\"center\"><b>!!!</b></td>\n"; |
322 |
if ($resql) |
} |
323 |
{ |
|
324 |
$num = $db->num_rows($resql); |
print '<td align="right">'.price($objp->total_ttc)."</td>"; |
325 |
|
print '<td align="right">'.price($objp->am)."</td>"; |
326 |
if ($num > 0) |
print '<td align="right">'.price($objp->total_ttc - $objp->am)."</td>"; |
327 |
{ |
|
328 |
$i = 0; |
print '<td align="center">'; |
329 |
print '<tr><td colspan="3">'; |
|
330 |
print '<table class="noborder" width="100%">'; |
$namef = "amount_".$objp->facid; |
331 |
print '<tr class="liste_titre">'; |
print '<input type="text" size="8" name="'.$namef.'">'; |
332 |
print '<td>'.$langs->trans("Bill").'</td><td align="center">'.$langs->trans("Date").'</td>'; |
|
333 |
print '<td align="right">'.$langs->trans("AmountTTC").'</td>'; |
print "</td></tr>\n"; |
334 |
print '<td align="right">'.$langs->trans("Received").'</td>'; |
$total+=$objp->total; |
335 |
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>'; |
$total_ttc+=$objp->total_ttc; |
336 |
print '<td align="center">'.$langs->trans("Amount").'</td>'; |
$totalrecu+=$objp->am; |
337 |
print "</tr>\n"; |
$i++; |
338 |
|
} |
339 |
$var=True; |
if ($i > 1) |
340 |
$total=0; |
{ |
341 |
$totalrecu=0; |
// Print total |
342 |
|
print '<tr class="liste_total">'; |
343 |
while ($i < $num) |
print '<td colspan="2" align="left">'.$langs->trans("TotalTTC").':</td>'; |
344 |
{ |
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>"; |
345 |
$objp = $db->fetch_object($resql); |
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>"; |
346 |
$var=!$var; |
print "<td align=\"right\"><b>".price($total_ttc - $totalrecu)."</b></td>"; |
347 |
|
print '<td align="center"> </td>'; |
348 |
print "<tr $bc[$var]>"; |
print "</tr>\n"; |
349 |
|
} |
350 |
print '<td><a href="facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber; |
print "</table></td></tr>\n"; |
351 |
print "</a></td>\n"; |
} |
352 |
|
$db->free($resql); |
353 |
if ($objp->df > 0 ) |
} |
354 |
{ |
else |
355 |
print "<td align=\"center\">"; |
{ |
356 |
print strftime("%d %b %Y",$objp->df)."</td>\n"; |
dolibarr_print_error($db); |
357 |
} |
} |
358 |
else |
|
359 |
{ |
/* |
360 |
print "<td align=\"center\"><b>!!!</b></td>\n"; |
* |
361 |
} |
*/ |
362 |
|
print '<tr><td colspan="3" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>'; |
363 |
print '<td align="right">'.price($objp->total_ttc)."</td>"; |
print "</table>"; |
364 |
print '<td align="right">'.price($objp->am)."</td>"; |
print "</form>\n"; |
365 |
print '<td align="right">'.price($objp->total_ttc - $objp->am)."</td>"; |
} |
|
|
|
|
print '<td align="center">'; |
|
|
|
|
|
$namef = "amount_".$objp->facid; |
|
|
print '<input type="text" size="8" name="'.$namef.'">'; |
|
|
|
|
|
print "</td></tr>\n"; |
|
|
$total+=$objp->total; |
|
|
$total_ttc+=$objp->total_ttc; |
|
|
$totalrecu+=$objp->am; |
|
|
$i++; |
|
|
} |
|
|
if ($i > 1) |
|
|
{ |
|
|
// Print total |
|
|
print "<tr ".$bc[!$var].">"; |
|
|
print '<td colspan="2" align="left">'.$langs->trans("TotalTTC").':</td>'; |
|
|
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>"; |
|
|
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>"; |
|
|
print "<td align=\"right\"><b>".price($total_ttc - $totalrecu)."</b></td>"; |
|
|
print '<td align="center"> </td>'; |
|
|
print "</tr>\n"; |
|
|
} |
|
|
print "</table></td></tr>\n"; |
|
|
} |
|
|
$db->free($resql); |
|
|
} |
|
|
else |
|
|
{ |
|
|
dolibarr_print_error($db); |
|
|
} |
|
|
/* |
|
|
* |
|
|
*/ |
|
|
|
|
|
print '<tr><td colspan="3" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>'; |
|
|
print "</table>"; |
|
|
print "</form>\n"; |
|
|
} |
|
366 |
} |
} |
367 |
} |
} |
368 |
|
|