mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix sign in llx_bank of amount_main_currency
This commit is contained in:
parent
3bb2d21534
commit
14fd90dbad
|
|
@ -569,14 +569,19 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL
|
|||
DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee';
|
||||
|
||||
|
||||
-- Sequence to fix the content of llx_bank.amount_main_currency
|
||||
-- Note: amount is amount in currency of bank account
|
||||
|
||||
-- Sequence to fix the content of llx_bank.amount_main_currency (value was empty and should not for payment on bank account with a different currency so when amount_main_currency is different than amount)
|
||||
-- Note: amount is amount in the currency of the bank account
|
||||
-- Note: pamount is always amount into the main currency
|
||||
-- Note: pmulticurrencyamount is in currency of invoice
|
||||
-- Note: amount_main_currency must be amount in main currency
|
||||
-- Note: pmulticurrencyamount is in the currency of invoice
|
||||
-- Note: amount_main_currency must be NULL or amount in main currency of company (we set it when the currency of the bank account differs from main currency)
|
||||
-- DROP TABLE tmp_bank;
|
||||
-- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
|
||||
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL;
|
||||
-- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount, b.datec FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
|
||||
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL AND b.rowid IN (SELECT rowid FROM tmp_bank);
|
||||
-- DROP TABLE tmp_bank2;
|
||||
-- CREATE TABLE tmp_bank2 SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment_supplier' INNER JOIN llx_paiementfourn as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
|
||||
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank2 as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL;
|
||||
-- CREATE TABLE tmp_bank2 SELECT b.rowid, b.amount, p.rowid as pid, - p.amount as pamount, - p.multicurrency_amount as pmulticurrencyamount, b.datec FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment_supplier' INNER JOIN llx_paiementfourn as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
|
||||
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank2 as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL AND b.rowid IN (SELECT rowid FROM tmp_bank2);
|
||||
|
||||
-- Sequence to fix the content of llx_bank.amount_main_currency (sign was wrong with some version)
|
||||
-- UPDATE llx_bank as b SET b.amount_main_currency = -b.amount_main_currency WHERE b.amount IS NOT NULL AND b.amount_main_currency IS NOT NULL AND SIGN(b.amount_main_currency) <> SIGN(b.amount);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ create table llx_bank
|
|||
datev date, -- date de valeur
|
||||
dateo date, -- date operation
|
||||
amount double(24,8) NOT NULL default 0, -- amount in the currency of the bank account
|
||||
amount_main_currency double(24,8) NULL, -- amount in the main currency of the company
|
||||
amount_main_currency double(24,8) NULL, -- amount in the main currency of the company when payment done in a bank account with a different currency
|
||||
label varchar(255),
|
||||
fk_account integer,
|
||||
fk_user_author integer,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user