FIX bad sign of amount stored for multicurrency columns on credit notes
This commit is contained in:
parent
d591a83085
commit
e8b3875e2e
@ -3852,6 +3852,7 @@ if ($action == 'create') {
|
|||||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||||
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
|
|
||||||
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
@ -5089,7 +5090,7 @@ if ($action == 'create') {
|
|||||||
print '<span class="opacitymedium">';
|
print '<span class="opacitymedium">';
|
||||||
print $langs->trans('RemainderToPay');
|
print $langs->trans('RemainderToPay');
|
||||||
if ($resteapayeraffiche < 0) {
|
if ($resteapayeraffiche < 0) {
|
||||||
print ' ('.$langs->trans('ExcessReceived').')';
|
print ' ('.$langs->trans('NegativeIfExcessReceived').')';
|
||||||
}
|
}
|
||||||
print '</span>';
|
print '</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -5117,23 +5118,25 @@ if ($action == 'create') {
|
|||||||
print ' :</td><td align="right">'.price($retainedWarranty).'</td><td> </td></tr>';
|
print ' :</td><td align="right">'.price($retainedWarranty).'</td><td> </td></tr>';
|
||||||
}
|
}
|
||||||
} else { // Credit note
|
} else { // Credit note
|
||||||
|
|
||||||
|
$resteapayeraffiche = $resteapayer;
|
||||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||||
|
|
||||||
// Total already paid back
|
// Total already paid back
|
||||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||||
print $langs->trans('AlreadyPaidBack');
|
print '<span class="opacitymedium">'.$langs->trans('AlreadyPaidBack').'</span>';
|
||||||
print ' :</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
||||||
|
|
||||||
// Billed
|
// Billed
|
||||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right">'.price($sign * $object->total_ttc).'</td><td> </td></tr>';
|
print '<tr><td colspan="'.$nbcols.'" class="right"><span class="opacitymedium">'.$langs->trans("Billed").'</span></td><td class="right">'.price($sign * $object->total_ttc).'</td><td> </td></tr>';
|
||||||
|
|
||||||
// Remainder to pay back
|
// Remainder to pay back
|
||||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||||
print $langs->trans('RemainderToPayBack');
|
print '<span class="opacitymedium">'.$langs->trans('RemainderToPayBack');
|
||||||
if ($resteapayeraffiche > 0) {
|
if ($resteapayeraffiche > 0) {
|
||||||
print ' ('.$langs->trans('ExcessPaid').')';
|
print ' ('.$langs->trans('NegativeIfExcessRefunded').')';
|
||||||
}
|
}
|
||||||
print ' :</td>';
|
print '</span></td>';
|
||||||
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopayback' : (' '.$cssforamountpaymentcomplete)).'">'.price($sign * $resteapayeraffiche).'</td>';
|
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopayback' : (' '.$cssforamountpaymentcomplete)).'">'.price($sign * $resteapayeraffiche).'</td>';
|
||||||
print '<td class="nowrap"> </td></tr>';
|
print '<td class="nowrap"> </td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -3337,10 +3337,11 @@ class Facture extends CommonInvoice
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
$this->line->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise
|
||||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ht) : $multicurrency_total_ht); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_tva) : $multicurrency_total_tva); // For credit note and if qty is negative, total is negative
|
||||||
|
$this->line->multicurrency_total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ttc) : $multicurrency_total_ttc); // For credit note and if qty is negative, total is negative
|
||||||
|
|
||||||
if (is_array($array_options) && count($array_options) > 0) {
|
if (is_array($array_options) && count($array_options) > 0) {
|
||||||
$this->line->array_options = $array_options;
|
$this->line->array_options = $array_options;
|
||||||
|
|||||||
@ -1968,10 +1968,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
|
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
|
||||||
|
|
||||||
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
|
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva);
|
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax1) : $total_localtax1);
|
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax2) : $total_localtax2);
|
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc);
|
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
|
||||||
|
|
||||||
$this->line->fk_product = $fk_product;
|
$this->line->fk_product = $fk_product;
|
||||||
$this->line->product_type = $type;
|
$this->line->product_type = $type;
|
||||||
@ -1992,10 +1992,11 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
$this->line->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise
|
||||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ht) : $multicurrency_total_ht); // For credit note and if qty is negative, total is negative
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_tva) : $multicurrency_total_tva); // For credit note and if qty is negative, total is negative
|
||||||
|
$this->line->multicurrency_total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ttc) : $multicurrency_total_ttc); // For credit note and if qty is negative, total is negative
|
||||||
|
|
||||||
if (is_array($array_options) && count($array_options) > 0) {
|
if (is_array($array_options) && count($array_options) > 0) {
|
||||||
$this->line->array_options = $array_options;
|
$this->line->array_options = $array_options;
|
||||||
|
|||||||
@ -87,6 +87,26 @@ DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', '
|
|||||||
|
|
||||||
-- For v14
|
-- For v14
|
||||||
|
|
||||||
|
--Fix bad sign on multicompany column for customer invoice lines
|
||||||
|
UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
|
||||||
|
UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
|
||||||
|
UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
|
||||||
|
UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
|
||||||
|
--Fix bad sign on multicompany column for customer invoices
|
||||||
|
UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
|
||||||
|
UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
|
||||||
|
UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
|
||||||
|
--Fix bad sign on multicurrency column for supplier invoice lines
|
||||||
|
UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
|
||||||
|
UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
|
||||||
|
UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
|
||||||
|
UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
|
||||||
|
--Fix bad sign on multicompany column for customer invoices
|
||||||
|
UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
|
||||||
|
UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
|
||||||
|
UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
|
||||||
|
|
||||||
|
|
||||||
UPDATE llx_c_ticket_type set label = 'Issue or bug' WHERE code = 'ISSUE';
|
UPDATE llx_c_ticket_type set label = 'Issue or bug' WHERE code = 'ISSUE';
|
||||||
INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROBLEM', '22', 'Problem', 0, 0, NULL);
|
INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROBLEM', '22', 'Problem', 0, 0, NULL);
|
||||||
|
|
||||||
|
|||||||
@ -236,9 +236,11 @@ Abandoned=Abandoned
|
|||||||
RemainderToPay=Remaining unpaid
|
RemainderToPay=Remaining unpaid
|
||||||
RemainderToTake=Remaining amount to take
|
RemainderToTake=Remaining amount to take
|
||||||
RemainderToPayBack=Remaining amount to refund
|
RemainderToPayBack=Remaining amount to refund
|
||||||
|
NegativeIfExcessRefunded=negative if excess refunded
|
||||||
Rest=Pending
|
Rest=Pending
|
||||||
AmountExpected=Amount claimed
|
AmountExpected=Amount claimed
|
||||||
ExcessReceived=Excess received
|
ExcessReceived=Excess received
|
||||||
|
NegativeIfExcessReceived=negative if excess received
|
||||||
ExcessPaid=Excess paid
|
ExcessPaid=Excess paid
|
||||||
EscompteOffered=Discount offered (payment before term)
|
EscompteOffered=Discount offered (payment before term)
|
||||||
EscompteOfferedShort=Discount
|
EscompteOfferedShort=Discount
|
||||||
|
|||||||
@ -1195,7 +1195,7 @@ select.flat.selectlimit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Styles for amount on card */
|
/* Styles for amount on card */
|
||||||
table.paymenttable td.amountpaymentcomplete, table.paymenttable td.amountremaintopay {
|
table.paymenttable td.amountpaymentcomplete, table.paymenttable td.amountremaintopay, table.paymenttable td.amountremaintopayback {
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user