Incorporation écritures comptes 23xx créées hors Paheko
This commit is contained in:
parent
f1738f2197
commit
54273c6707
6 changed files with 186 additions and 91 deletions
|
|
@ -30,33 +30,38 @@
|
|||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
|
||||
{{* détails des écritures paramètres *}}
|
||||
{{:assign trans=$_GET.trans|explode:","}}
|
||||
{{:assign var="trans_list" value=$trans|map:quote_sql}}
|
||||
{{:assign trans_list=$trans_list|implode:","}}
|
||||
{{:assign trans_list="("|cat:$trans_list|cat:")"}}
|
||||
{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}}
|
||||
{{:assign docs=$_GET.doc|explode:","}}
|
||||
{{:assign var="doc_list" value=$docs|map:quote_sql}}
|
||||
{{:assign doc_list=$doc_list|implode:","}}
|
||||
{{:assign doc_list="("|cat:$doc_list|cat:")"}}
|
||||
{{:assign doc_condition="doc.id IN "|cat:$doc_list}}
|
||||
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
trans.label AS trans_label,
|
||||
trans.date AS trans_date,
|
||||
SUM(line.debit) AS line_debit,
|
||||
doc.id as doc_id,
|
||||
IFNULL(json_extract(doc.document, '$.label'),
|
||||
CASE WHEN line.label IS NOT NULL AND line.label != trans.label
|
||||
THEN trans.label || " - " || line.label
|
||||
ELSE trans.label
|
||||
END) AS label,
|
||||
IFNULL(json_extract(doc.document, '$.date_achat'), trans.date) AS date,
|
||||
IFNULL(json_extract(doc.document, '$.amount'), line.debit) AS amount,
|
||||
account.code AS account_code,
|
||||
account.label AS account_label,
|
||||
line.id_project as project_id
|
||||
FROM acc_transactions AS trans
|
||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
FROM module_data_amortization AS doc
|
||||
INNER JOIN acc_transactions_lines AS line ON json_extract(doc.document, '$.line') = line.id
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||
WHERE !condition
|
||||
GROUP BY trans.id
|
||||
WHERE json_extract(document, '$.type') = "immo"
|
||||
AND !doc_condition
|
||||
;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{:assign var="transactions.%s"|args:$trans_id
|
||||
amount=$line_debit
|
||||
line_label=$trans_label
|
||||
date=$trans_date
|
||||
!doc_condition=$doc_condition
|
||||
assign="doc_line"
|
||||
}}
|
||||
{{:assign var="transactions.%s"|args:$doc_id
|
||||
amount=$amount
|
||||
line_label=$label
|
||||
date=$date
|
||||
code=$account_code
|
||||
label=$account_label
|
||||
project=$project_id
|
||||
|
|
@ -139,7 +144,6 @@
|
|||
- que le compte d'immo débute par un préfixe correct (20, 21, ...)
|
||||
- est présent dans le PC de l'exercice correspondant à la date
|
||||
*}}
|
||||
|
||||
{{:include
|
||||
file="_check_account.html"
|
||||
account=$account_code
|
||||
|
|
@ -153,9 +157,6 @@
|
|||
{{:error message="Le compte « %s » n'est pas un compte d'immobilisation ou n'est pas dans le plan comptable de l'exercice choisi"|args:$compte}}
|
||||
{{/if}}
|
||||
|
||||
{{* écritures liées *}}
|
||||
{{:assign var="linked_transactions" value=$transactions|keys}}
|
||||
|
||||
{{* enregistrer l'écriture *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
|
|
@ -166,7 +167,6 @@
|
|||
date=$_POST.date_mes
|
||||
label=$_POST.designation|trim
|
||||
lines=$lines
|
||||
linked_transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
{{:assign lines_count=$lines|count}}
|
||||
|
|
@ -183,6 +183,18 @@
|
|||
status=$status
|
||||
created=true
|
||||
}}
|
||||
|
||||
{{* changer le statut des immos transférées *}}
|
||||
{{#select
|
||||
id
|
||||
FROM module_data_amortization AS doc
|
||||
WHERE id IN !id_list;
|
||||
!id_list=$doc_list
|
||||
assign="doc"
|
||||
}}
|
||||
{{:save id=$id status="transferred"}}
|
||||
{{/select}}
|
||||
|
||||
{{if $_POST.amortir}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{else}}
|
||||
|
|
@ -199,7 +211,7 @@
|
|||
{{:form_errors}}
|
||||
|
||||
{{* formulaire d'ajout d'immobilisation *}}
|
||||
{{if $_GET.trans == null}}
|
||||
{{if $_GET.doc == null}}
|
||||
{{:error message="Vous n'avez sélectionné aucune écriture !"}}
|
||||
{{/if}}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue