diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index a78e64f675e..152dde9dee3 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -2947,16 +2947,7 @@ if ($action == 'create')
print '
';
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote,
// $filtercreditnote, $resteapayer);
- $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We
- // must
- // allow
- // credit
- // not
- // even
- // if
- // amount
- // is
- // higher
+ $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We allow credit note even if amount is higher
}
}
if (! $absolute_discount && ! $absolute_creditnote) {
@@ -3044,14 +3035,17 @@ if ($action == 'create')
$sql .= ' ORDER BY p.datep, p.tms';
$result = $db->query($sql);
- if ($result) {
+ if ($result)
+ {
$num = $db->num_rows($result);
$i = 0;
// if ($object->type != 2)
// {
- if ($num > 0) {
- while ($i < $num) {
+ if ($num > 0)
+ {
+ while ($i < $num)
+ {
$objp = $db->fetch_object($result);
$var = ! $var;
print '
| ';
@@ -3059,7 +3053,8 @@ if ($action == 'create')
print dol_print_date($db->jdate($objp->dp), 'day') . ' | ';
$label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label;
print '' . $label . ' ' . $objp->num_paiement . ' | ';
- if (! empty($conf->banque->enabled)) {
+ if (! empty($conf->banque->enabled))
+ {
$bankaccountstatic->id = $objp->baid;
$bankaccountstatic->ref = $objp->ref;
$bankaccountstatic->label = $objp->ref;
@@ -3082,7 +3077,8 @@ if ($action == 'create')
dol_print_error($db);
}
- if ($object->type != Facture::TYPE_CREDIT_NOTE) {
+ if ($object->type != Facture::TYPE_CREDIT_NOTE)
+ {
// Total already paid
print '
| ';
if ($object->type != Facture::TYPE_DEPOSIT)
@@ -3101,11 +3097,13 @@ if ($action == 'create')
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
$sql .= " WHERE fk_facture = " . $object->id;
$resql = $db->query($sql);
- if ($resql) {
+ if ($resql)
+ {
$num = $db->num_rows($resql);
$i = 0;
$invoice = new Facture($db);
- while ($i < $num) {
+ while ($i < $num)
+ {
$obj = $db->fetch_object($resql);
$invoice->fetch($obj->fk_facture_source);
print ' |
| ';
@@ -3173,7 +3171,8 @@ if ($action == 'create')
print ' : | ';
print '' . price($resteapayeraffiche) . ' | ';
print ' |
';
- } else // Credit note
+ }
+ else // Credit note
{
// Total already paid back
print '| ';
@@ -3219,7 +3218,8 @@ if ($action == 'create')
print ' | id . '">' . img_edit($langs->trans('SetConditions'), 1) . ' | ';
print '
';
print '';
- if ($object->type != Facture::TYPE_CREDIT_NOTE) {
+ if ($object->type != Facture::TYPE_CREDIT_NOTE)
+ {
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
} else {
@@ -3239,7 +3239,8 @@ if ($action == 'create')
print ' | id . '">' . img_edit($langs->trans('SetDate'), 1) . ' | ';
print '';
print '';
- if ($object->type != Facture::TYPE_CREDIT_NOTE) {
+ if ($object->type != Facture::TYPE_CREDIT_NOTE)
+ {
if ($action == 'editpaymentterm') {
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_lim_reglement, 'paymentterm');
} else {
@@ -3294,67 +3295,67 @@ if ($action == 'create')
// Situations
if (! empty($conf->global->INVOICE_US_SITUATION))
{
- if ($object->type == 5 && ($object->situation_counter > 1))
- {
- $prevsits = $object->get_prev_sits();
- print ' | | ';
- print $langs->trans('SituationAmount');
- print ' ';
-
- print $prevsits[0]->situation_counter;
- for ($i = 1; $i < count($prevsits); $i++) {
- print ' + ';
- print $prevsits[$i]->situation_counter;
- }
- print ' + ';
- print $object->situation_counter;
-
- print ' | ';
- print '';
-
- $prevsits_total_amount = 0;
- foreach ($prevsits as $situation) {
- $prevsits_total_amount += $situation->total_ht;
- }
- $prevsits_total_amount += $object->total_ht;
-
- print price($prevsits_total_amount);
- print ' | ';
- print '' . $langs->trans('Currency' . $conf->currency) . ' |
';
-
- // Previous situation(s) deduction(s)
- for ($i = 0; $i < count($prevsits); $i++) {
+ if ($object->type == 5 && ($object->situation_counter > 1))
+ {
+ $prevsits = $object->get_prev_sits();
print '| ';
- print '';
- print $langs->trans('SituationDeduction');
+ print $langs->trans('SituationAmount');
print ' ';
- print $prevsits[$i]->situation_counter;
- print ' | ';
+ print $prevsits[0]->situation_counter;
+ for ($i = 1; $i < count($prevsits); $i++) {
+ print ' + ';
+ print $prevsits[$i]->situation_counter;
+ }
+ print ' + ';
+ print $object->situation_counter;
+
+ print '';
print '';
- print '- ' . price($prevsits[$i]->total_ht);
+
+ $prevsits_total_amount = 0;
+ foreach ($prevsits as $situation) {
+ $prevsits_total_amount += $situation->total_ht;
+ }
+ $prevsits_total_amount += $object->total_ht;
+
+ print price($prevsits_total_amount);
print ' | ';
print '' . $langs->trans('Currency' . $conf->currency) . ' |
';
+
+ // Previous situation(s) deduction(s)
+ for ($i = 0; $i < count($prevsits); $i++) {
+ print '| ';
+ print '';
+ print $langs->trans('SituationDeduction');
+ print ' ';
+ print $prevsits[$i]->situation_counter;
+ print ' | ';
+
+ print '';
+ print '- ' . price($prevsits[$i]->total_ht);
+ print ' | ';
+ print '' . $langs->trans('Currency' . $conf->currency) . ' |
';
+ }
}
}
- }
// Amount
print '| ' . $langs->trans('AmountHT') . ' | ';
- print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ' |
';
- print '| ' . $langs->trans('AmountVAT') . ' | ' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ' |
';
+ print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
+ print '| ' . $langs->trans('AmountVAT') . ' | ' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ' |
';
print '';
// Amount Local Taxes
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
{
print '| ' . $langs->transcountry("AmountLT1", $mysoc->country_code) . ' | ';
- print '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . ' |
';
+ print '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
}
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2
{
print '| ' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ' | ';
- print '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . ' |
';
+ print '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
}
// Revenue stamp
@@ -3367,7 +3368,7 @@ if ($action == 'create')
if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer)
print 'id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . ' | ';
print '';
- print '';
+ print ' | ';
if ($action == 'editrevenuestamp') {
print ' |