Apply Dolibarr best practices for monetary and date formatting
- Use price2num(amount, 'MT') to clean monetary values - Use dol_mktime() to properly format dates - Ensure amounts are properly formatted for accounting - Follow Dolibarr standards for data formatting
This commit is contained in:
parent
0745de8093
commit
2a6ac36d0e
@ -1248,12 +1248,12 @@ class DeclarationTVA
|
||||
}
|
||||
|
||||
$debit = new Bookkeeping($this->db);
|
||||
$debit->doc_date = $declaration->end_date;
|
||||
$debit->doc_date = dol_mktime(0, 0, 0, date('m', strtotime($declaration->end_date)), date('d', strtotime($declaration->end_date)), date('Y', strtotime($declaration->end_date)));
|
||||
$debit->doc_ref = $declaration->declaration_name;
|
||||
$debit->code_journal = 'OD';
|
||||
$debit->numero_compte = $entry['account_code'];
|
||||
$debit->label_compte = $entry['account_label'];
|
||||
$debit->montant = $debit_amount;
|
||||
$debit->montant = price2num($debit_amount, 'MT');
|
||||
$debit->sens = 'D';
|
||||
$debit->fk_doc = $declaration->rowid;
|
||||
$debit->fk_user_author = $user->id;
|
||||
@ -1294,12 +1294,12 @@ class DeclarationTVA
|
||||
}
|
||||
|
||||
$credit = new Bookkeeping($this->db);
|
||||
$credit->doc_date = $declaration->end_date;
|
||||
$credit->doc_date = dol_mktime(0, 0, 0, date('m', strtotime($declaration->end_date)), date('d', strtotime($declaration->end_date)), date('Y', strtotime($declaration->end_date)));
|
||||
$credit->doc_ref = $declaration->declaration_name;
|
||||
$credit->code_journal = 'OD';
|
||||
$credit->numero_compte = $entry['account_code'];
|
||||
$credit->label_compte = $entry['account_label'];
|
||||
$credit->montant = $credit_amount;
|
||||
$credit->montant = price2num($credit_amount, 'MT');
|
||||
$credit->sens = 'C';
|
||||
$credit->fk_doc = $declaration->rowid;
|
||||
$credit->fk_user_author = $user->id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user