Compare commits
No commits in common. "main" and "v0.41.4" have entirely different histories.
32 changed files with 247 additions and 178 deletions
|
|
@ -65,12 +65,13 @@
|
|||
{{* chercher le doc de sortie du bilan *}}
|
||||
{{:assign var="immo_line.exit_date" value=null}}
|
||||
{{#load type="exit_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id=$immo_doc_id}}
|
||||
{{:assign exit_line_id=$exit_line_id}}
|
||||
{{#select
|
||||
trans.date
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
WHERE line.id = :exit_line_id;
|
||||
:exit_line_id=$line_id
|
||||
:exit_line_id=$exit_line_id
|
||||
}}
|
||||
{{:assign var="immo_line.exit_date" value=$date}}
|
||||
{{/select}}
|
||||
|
|
@ -85,7 +86,7 @@
|
|||
}}
|
||||
{{if $amount == null}}
|
||||
{{#select credit FROM acc_transactions_lines WHERE id = :credit_line_id;
|
||||
:credit_line_id=$line_id
|
||||
:credit_line_id=$credit_line_id
|
||||
}}
|
||||
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
||||
{{/select}}
|
||||
|
|
@ -105,7 +106,7 @@
|
|||
line.credit
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
INNER JOIN !table AS cession_link ON json_extract(cession_link.document, '$.line_id') = line.id
|
||||
INNER JOIN !table AS cession_link ON json_extract(cession_link.document, '$.cession_line_id') = line.id
|
||||
INNER JOIN !table AS immo_doc ON json_extract(cession_link.document, '$.immo_doc_id') = immo_doc.id
|
||||
WHERE json_extract(immo_doc.document, '$.line') = :immo_line_id
|
||||
;
|
||||
|
|
|
|||
37
_attach_cession.html
Normal file
37
_attach_cession.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Enregistrer la liaison entre une écriture d'immobilisation et
|
||||
une écriture de cession
|
||||
@param immo_doc_id : id du document associé à l'immobilisation
|
||||
@param cession_line_id : ligne de l'écriture de cession
|
||||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id keep="info_immo, ligne_immo, message"}}
|
||||
{{if $message != null}}
|
||||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{* chercher l'écriture de cession de l'immobilisation *}}
|
||||
{{#select
|
||||
id_transaction
|
||||
FROM acc_transactions_lines
|
||||
WHERE id = :line_id;
|
||||
:line_id = $cession_line_id|intval
|
||||
}}
|
||||
{{:assign cession_id=$id_transaction}}
|
||||
{{else}}
|
||||
{{:error message="Impossible de trouver l'écriture de cession de l'immobilisation"}}
|
||||
{{/select}}
|
||||
|
||||
{{* Lier l'écriture de cession à l'écriture d'immobilisation *}}
|
||||
{{:include file="_common_attach.html" immo_doc_id=$immo_doc_id trans_id=$cession_id}}
|
||||
|
||||
{{* enregistrer la liaison de l'écriture de cession *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
type="cession_link"
|
||||
immo_doc_id=$info_immo.id
|
||||
cession_line_id=$cession_line_id|intval
|
||||
}}
|
||||
37
_attach_exit.html
Normal file
37
_attach_exit.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Enregistrer la liaison entre une écriture d'immobilisation et
|
||||
une écriture de sortie d'immobilisation
|
||||
@param immo_doc_id : id du document associé à l'immobilisation
|
||||
@param exit_line_id : ligne de l'écriture de sortie d'immobilisation
|
||||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id keep="info_immo, ligne_immo, message"}}
|
||||
{{if $message != null}}
|
||||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{* chercher l'écriture de sortie d'immobilisation *}}
|
||||
{{#select
|
||||
id_transaction
|
||||
FROM acc_transactions_lines
|
||||
WHERE id = :line_id;
|
||||
:line_id = $exit_line_id|intval
|
||||
}}
|
||||
{{:assign rebut_id=$id_transaction}}
|
||||
{{else}}
|
||||
{{:error message="Impossible de trouver l'écriture de sortie d'immobilisation"}}
|
||||
{{/select}}
|
||||
|
||||
{{* Lier l'écriture de sortie à l'écriture d'immobilisation *}}
|
||||
{{:include file="_common_attach.html" immo_doc_id=$immo_doc_id trans_id=$rebut_id}}
|
||||
|
||||
{{* enregistrer la liaison de l'écriture de sortie *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
type="exit_link"
|
||||
immo_doc_id=$info_immo.id
|
||||
exit_line_id=$exit_line_id|intval
|
||||
}}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Enregistrer la liaison entre une ligne d'immobilisation et une ligne
|
||||
@param immo_doc_id : id du document associé à l'immobilisation
|
||||
@param line_id : ligne de l'écriture à associer
|
||||
@param type : type de ligne à associer (cession, exit, ...)
|
||||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id keep="info_immo, ligne_immo, message"}}
|
||||
{{if $message != null}}
|
||||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{* chercher l'écriture de la ligne à associer *}}
|
||||
{{#select
|
||||
id_transaction
|
||||
FROM acc_transactions_lines
|
||||
WHERE id = :line_id;
|
||||
:line_id = $line_id|intval
|
||||
}}
|
||||
{{:assign trans_id=$id_transaction}}
|
||||
{{else}}
|
||||
{{if $type == "cession"}}
|
||||
{{:assign mtype="cession"}}
|
||||
{{elseif $type == "exit"}}
|
||||
{{:assign mtype="sortie"}}
|
||||
{{/if}}
|
||||
{{:error message="Impossible de trouver l'écriture de %s de l'immobilisation"|args:$mtype}}
|
||||
{{/select}}
|
||||
|
||||
{{* Lier cette écriture à l'écriture d'immobilisation *}}
|
||||
{{:include file="_common_attach.html" immo_doc_id=$immo_doc_id trans_id=$trans_id}}
|
||||
|
||||
{{* enregistrer la liaison *}}
|
||||
{{:assign link_type=$type|cat:"_link"}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
type=$link_type
|
||||
immo_doc_id=$info_immo.id
|
||||
line_id=$line_id|intval
|
||||
}}
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Supprimer l'association entre une ligne d'immobilisation et une ligne associée
|
||||
@param immo_doc_id : id du doc associé à l'immo
|
||||
@param line_id : id de la ligne associée
|
||||
@param type : type de ligne associée (amort, credit, cession, exit, ...)
|
||||
Supprimer l'association entre une ligne d'immo et une autre ligne (amort, credit, cession, sortie)
|
||||
@param immo_doc_id : id du doc associé à la ligne d'immobilisation
|
||||
@param line_id : id de la ligne à détacher
|
||||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
|
|
@ -51,23 +50,3 @@
|
|||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
{{* supprimer le doc de liaison entre les lignes *}}
|
||||
{{:assign link_type=$type|cat:"_link"}}
|
||||
{{#load type=$link_type
|
||||
where="$$.immo_doc_id = :immo_doc_id AND $$.line_id = :line_id"
|
||||
:immo_doc_id=$immo_doc_id|intval
|
||||
:line_id = $line_id|intval
|
||||
}}
|
||||
{{:delete id=$id}}
|
||||
{{/load}}
|
||||
|
||||
{{if $type == "amort"}}
|
||||
{{if $info_immo.status == "amortized"}}
|
||||
{{* marquer immo non soldée *}}
|
||||
{{:save
|
||||
key=$info_immo.key
|
||||
status="managed"
|
||||
}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
27
_detach_amort.html
Normal file
27
_detach_amort.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Supprimer l'association entre une écriture d'amortissement et
|
||||
une écriture d'immobilisation
|
||||
@param immo_doc_id : id du doc associé à l'immo
|
||||
@param amort_line_id : id de la ligne d'amortissement
|
||||
*}}
|
||||
|
||||
{{:include file="_common_detach.html" immo_doc_id=$immo_doc_id line_id=$amort_line_id keep="info_immo"}}
|
||||
|
||||
{{* supprimer le doc de liaison entre les lignes *}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.immo_doc_id = :immo_doc_id AND $$.amort_line_id = :amort_line_id"
|
||||
:immo_doc_id=$immo_doc_id|intval
|
||||
:amort_line_id = $amort_line_id|intval
|
||||
}}
|
||||
{{:delete id=$id}}
|
||||
{{/load}}
|
||||
|
||||
{{* marquer immo non soldée *}}
|
||||
{{if $info_immo.status == "amortized"}}
|
||||
{{:save
|
||||
key=$info_immo.key
|
||||
status="managed"
|
||||
}}
|
||||
{{/if}}
|
||||
19
_detach_cession.html
Normal file
19
_detach_cession.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Supprimer l'association entre une écriture d'immobilisation et
|
||||
une écriture de cession
|
||||
@param immo_doc_id : id du doc associé à l'immo
|
||||
@param cession_line_id : id de la ligne de cession
|
||||
*}}
|
||||
|
||||
{{:include file="_common_detach.html" immo_doc_id=$immo_doc_id line_id=$cession_line_id}}
|
||||
|
||||
{{* supprimer le doc de liaison entre les lignes *}}
|
||||
{{#load type="cession_link"
|
||||
where="$$.immo_doc_id = :immo_doc_id AND $$.cession_line_id = :cession_line_id"
|
||||
:immo_doc_id=$immo_doc_id|intval
|
||||
:cession_line_id = $cession_line_id|intval
|
||||
}}
|
||||
{{:delete id=$id}}
|
||||
{{/load}}
|
||||
19
_detach_credit.html
Normal file
19
_detach_credit.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Supprimer l'association entre une écriture d'immobilisation et
|
||||
une écriture au crédit du compte d'immobilisation
|
||||
@param immo_doc_id : id du doc associé à l'immo
|
||||
@param credit_line_id : id de la ligne de crédit
|
||||
*}}
|
||||
|
||||
{{:include file="_common_detach.html" immo_doc_id=$immo_doc_id line_id=$credit_line_id}}
|
||||
|
||||
{{* supprimer le doc de liaison entre les lignes *}}
|
||||
{{#load type="credit_link"
|
||||
where="$$.immo_doc_id = :immo_doc_id AND $$.credit_line_id = :credit_line_id"
|
||||
:immo_doc_id=$immo_doc_id|intval
|
||||
:credit_line_id = $credit_line_id|intval
|
||||
}}
|
||||
{{:delete id=$id}}
|
||||
{{/load}}
|
||||
19
_detach_exit.html
Normal file
19
_detach_exit.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Supprimer l'association entre une écriture d'immobilisation et
|
||||
une écriture de sortie de bilan
|
||||
@param immo_doc_id : id du doc associé à l'immo
|
||||
@param exit_line_id : id de la ligne de sortie de bilan
|
||||
*}}
|
||||
|
||||
{{:include file="_common_detach.html" immo_doc_id=$immo_doc_id line_id=$exit_line_id}}
|
||||
|
||||
{{* supprimer le doc de liaison entre les lignes *}}
|
||||
{{#load type="exit_link"
|
||||
where="$$.immo_doc_id = :immo_doc_id AND $$.exit_line_id = :exit_line_id"
|
||||
:immo_doc_id=$immo_doc_id|intval
|
||||
:exit_line_id = $exit_line_id|intval
|
||||
}}
|
||||
{{:delete id=$id}}
|
||||
{{/load}}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
@result total_amort : montant total des amortissements de l'immobilisation
|
||||
@result created_amort : vrai s'il y a au moins un amortissement créé par le module dans la liste
|
||||
*}}
|
||||
|
||||
{{:assign total_amort=0}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.immo_doc_id = :immo_doc_id"
|
||||
|
|
@ -30,7 +31,7 @@
|
|||
INNER join acc_accounts AS account on line.id_account = account.id
|
||||
WHERE line.id = :amort_line_id
|
||||
;
|
||||
:amort_line_id = $amort_info.line_id
|
||||
:amort_line_id = $amort_line_id
|
||||
assign="amort_line"
|
||||
}}
|
||||
{{:assign var="amort_line.amount" value=$amort_info.amount|or:$amort_line.amount}}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*}}
|
||||
{{:assign linked_immos=null}}
|
||||
{{:assign total_credits=0}}
|
||||
{{#load type="credit_link" where="$$.immo_doc_id=:immo_doc_id" :immo_doc_id=$immo_doc_id|intval assign="credit_info"}}
|
||||
{{#load type="credit_link" where="$$.immo_doc_id=:immo_doc_id" :immo_doc_id=$immo_doc_id|intval}}
|
||||
{{#select
|
||||
line.credit,
|
||||
line.id as line_id,
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
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 line.id = :credit_line_id;
|
||||
:credit_line_id=$credit_info.line_id
|
||||
:credit_line_id=$credit_line_id
|
||||
}}
|
||||
{{:assign credit=$credit}}
|
||||
{{:assign var="linked_immos." doc=$id trans_id=$trans_id credit_line_id=$line_id label=$label amount=$credit date=$date account_id=$account_id account_code=$account_code account_label=$account_label year=$year}}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
{{:assign amort_amount=0}}
|
||||
{{:assign keep_amort=true}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.line_id = :amort_line_id"
|
||||
where="$$.amort_line_id = :amort_line_id"
|
||||
:amort_line_id=$amort_line.line_id|intval
|
||||
assign="amort_link"
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
}}
|
||||
{{if $amount == null}}
|
||||
{{#select credit FROM acc_transactions_lines WHERE id = :credit_line_id;
|
||||
:credit_line_id=$line_id
|
||||
:credit_line_id=$credit_line_id
|
||||
}}
|
||||
{{:assign montant_immo="%d-%d"|math:$montant_immo:$credit}}
|
||||
{{/select}}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
{{if $module.table}}
|
||||
{{* supprimer les documents sans écriture associée *}}
|
||||
{{:assign var="docs." type="amort_link" field="amort_line_id"}}
|
||||
{{:assign var="docs." type="credit_link" field="credit_line_id"}}
|
||||
{{:assign var="docs." type="cession_link" field="cession_line_id"}}
|
||||
{{:assign var="docs." type="exit_link" field="exit_line_id"}}
|
||||
{{:assign var="docs." type="immo" field="line"}}
|
||||
{{:assign var="docs." type="amort_link" field="line_id"}}
|
||||
{{:assign var="docs." type="credit_link" field="line_id"}}
|
||||
{{:assign var="docs." type="cession_link" field="line_id"}}
|
||||
{{:assign var="docs." type="exit_link" field="line_id"}}
|
||||
|
||||
{{#foreach from=$docs}}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,21 +34,6 @@
|
|||
<p class="block info">Mise à jour vers version {{$tag}} terminée</p>
|
||||
{{/if}}
|
||||
|
||||
{{* version 0.42 *}}
|
||||
{{:assign tag="0.42"}}
|
||||
|
||||
{{:include file="_compare_version.tpl" nv1=$module_version nv2=$tag keep="comp"}}
|
||||
{{:assign module_comp=$comp}}
|
||||
{{:include file="_compare_version.tpl" nv1=$module.config.version nv2=$tag keep="comp"}}
|
||||
{{:assign config_comp=$comp}}
|
||||
|
||||
{{if $module_comp >= 0 && $config_comp < 0}}
|
||||
{{* $module_version >= '0.42' && $module.config.version < '0.42' *}}
|
||||
|
||||
{{:include file="_upgrade_to042.tpl"}}
|
||||
<p class="block info">Mise à jour vers version {{$tag}} terminée</p>
|
||||
{{/if}}
|
||||
|
||||
{{* enregistrer le nouveau numéro de version dans la config du module *}}
|
||||
{{:include file="_compare_version.tpl" nv1=$module_version nv2=$module.config.version keep="comp"}}
|
||||
{{if $comp > 0}}
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{* remplacer xxx_line_id par line_id pour simplifier et mutualiser le code *}}
|
||||
|
||||
{{:assign var="link_types." type="amort"}}
|
||||
{{:assign var="link_types." type="credit"}}
|
||||
{{:assign var="link_types." type="cession"}}
|
||||
{{:assign var="link_types." type="exit"}}
|
||||
|
||||
{{* lister les liens actuels *}}
|
||||
{{#foreach from=$link_types}}
|
||||
{{:assign link_type=$type|cat:"_link"}}
|
||||
{{:assign line_id=$type|cat:"_line_id"}}
|
||||
{{#load type=$link_type assign="link"}}
|
||||
{{:assign new_link=null}}
|
||||
{{:assign var="new_link.key" value=$link.key}}
|
||||
{{:assign var="new_link.type" value=$link.type}}
|
||||
{{:assign var="new_link.immo_doc_id" value=$link.immo_doc_id}}
|
||||
{{:assign var="new_link.line_id" from="link.%s"|args:$line_id}}
|
||||
{{:assign var="new_link.amount" value=$link.amount}}
|
||||
{{:assign var="new_link.created" value=$link.created}}
|
||||
{{* mémoriser les infos des docs *}}
|
||||
{{:assign var="new_links." value=$new_link}}
|
||||
{{/load}}
|
||||
{{:delete type=$link_type}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* créer les nouveaux documents de liaisons *}}
|
||||
{{#foreach from=$new_links item="link"}}
|
||||
{{:save
|
||||
key=$link.key
|
||||
type=$link.type
|
||||
immo_doc_id=$link.immo_doc_id
|
||||
line_id=$link.line_id
|
||||
amount=$link.amount
|
||||
created=$link.created
|
||||
}}
|
||||
{{/foreach}}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
une écriture au crédit du compte d'immobilisation
|
||||
*}}
|
||||
{{#form on="detach_credit"}}
|
||||
{{:include file="_detach_line.html" immo_doc_id=$_POST.immo_doc_id line_id=$_POST.detach_credit type="credit"}}
|
||||
{{:include file="_detach_credit.html" immo_doc_id=$_POST.immo_doc_id credit_line_id=$_POST.detach_credit}}
|
||||
{{:redirect to="?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_POST.immo_doc_id}}
|
||||
{{/form}}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
une écriture d'immobilisation
|
||||
*}}
|
||||
{{#form on="detach_amort"}}
|
||||
{{:include file="_detach_line.html" immo_doc_id=$_POST.immo_doc_id line_id=$_POST.detach_amort type="amort"}}
|
||||
{{:include file="_detach_amort.html" immo_doc_id=$_POST.immo_doc_id amort_line_id=$_POST.detach_amort}}
|
||||
{{:redirect to="?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_POST.immo_doc_id:}}
|
||||
{{/form}}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
{{* montant de l'écriture d'amortissement déjà affecté *}}
|
||||
{{:assign montant_affecte=0}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.line_id = :amort_line_id"
|
||||
where="$$.amort_line_id = :amort_line_id"
|
||||
:amort_line_id = $_GET.amort_line_id|intval
|
||||
}}
|
||||
{{:assign montant_affecte="%d+%d"|math:$montant_affecte:$amount}}
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
{{* vérifier si cette liaison est déjà présente dans les documents pour éviter les doublons *}}
|
||||
{{* TODO voir si nécessaire ? *}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.immo_doc_id = :immo_doc_id AND $$.line_id = :amort_line_id"
|
||||
where="$$.immo_doc_id = :immo_doc_id AND $$.amort_line_id = :amort_line_id"
|
||||
:immo_doc_id=$_GET.immo_doc_id|intval
|
||||
:amort_line_id = $_GET.amort_line_id|intval
|
||||
limit=1
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
key=""|uuid
|
||||
type="amort_link"
|
||||
immo_doc_id=$_GET.immo_doc_id|intval
|
||||
line_id=$_GET.amort_line_id|intval
|
||||
amort_line_id=$_GET.amort_line_id|intval
|
||||
amount=$saved_amount
|
||||
}}
|
||||
{{/load}}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
{{* montant de l'écriture de crédit déjà affecté *}}
|
||||
{{:assign montant_affecte=0}}
|
||||
{{#load type="credit_link"
|
||||
where="$$.line_id = :credit_line_id"
|
||||
where="$$.credit_line_id = :credit_line_id"
|
||||
:credit_line_id = $_GET.credit_line_id|intval
|
||||
}}
|
||||
{{:assign montant_affecte="%d+%d"|math:$montant_affecte:$amount}}
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
key=""|uuid
|
||||
type="credit_link"
|
||||
immo_doc_id=$_GET.immo_doc_id|intval
|
||||
line_id=$_GET.credit_line_id|intval
|
||||
credit_line_id=$_GET.credit_line_id|intval
|
||||
amount=$saved_credit
|
||||
}}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
{{#select
|
||||
trans.id
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN !table AS credit_link ON $$.line_id = line.id
|
||||
INNER JOIN !table AS credit_link ON $$.credit_line_id = line.id
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
WHERE $$.type = "credit_link" AND $$.immo_doc_id = :immo_doc_id
|
||||
;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
une écriture au crédit du compte d'immobilisation
|
||||
*}}
|
||||
{{#form on="detach_credit"}}
|
||||
{{:include file="_detach_line.html" immo_doc_id=$_POST.immo_doc_id line_id=$_POST.detach_credit type="credit"}}
|
||||
{{:include file="_detach_credit.html" immo_doc_id=$_POST.immo_doc_id credit_line_id=$_POST.detach_credit}}
|
||||
{{:redirect to="?immo_doc_id=%s&from=exit&ok=1&msg=detach_avoir"|args:$_POST.immo_doc_id}}
|
||||
{{/form}}
|
||||
|
||||
|
|
@ -56,15 +56,15 @@
|
|||
FROM acc_transactions AS trans
|
||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.line_id') = line.id
|
||||
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
|
||||
WHERE
|
||||
account.code LIKE :account_code
|
||||
AND line.credit > 0
|
||||
AND credit_line_id NOT IN (
|
||||
SELECT json_extract(credit_link.document, '$.line_id') AS line_id FROM !table as credit_link
|
||||
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
|
||||
WHERE json_extract(credit_link.document, '$.type') == "credit_link"
|
||||
UNION
|
||||
SELECT json_extract(exit_link.document, '$.line_id') AS line_id FROM !table as exit_link
|
||||
SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link
|
||||
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
|
||||
)
|
||||
;
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
{{:assign amort_amount=0}}
|
||||
{{:assign keep_amort=true}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.line_id = :amort_line_id"
|
||||
where="$$.amort_line_id = :amort_line_id"
|
||||
:amort_line_id=$amort_line.amort_line_id
|
||||
assign="amort_link"
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
une écriture d'immobilisation
|
||||
*}}
|
||||
{{#form on="detach_amort"}}
|
||||
{{:include file="_detach_line.html" immo_doc_id=$_POST.immo_doc_id line_id=$_POST.detach_amort type="amort"}}
|
||||
{{:include file="_detach_amort.html" immo_doc_id=$_POST.immo_doc_id amort_line_id=$_POST.detach_amort}}
|
||||
{{:redirect to="?immo_doc_id=%s&from=exit&ok=1&msg=detach_amort"|args:$_POST.immo_doc_id}}
|
||||
{{/form}}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@
|
|||
{{:assign amort_amount=0}}
|
||||
{{:assign keep_amort=true}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.line_id = :amort_line_id"
|
||||
where="$$.amort_line_id = :amort_line_id"
|
||||
:amort_line_id=$amort_line.amort_line_id|intval
|
||||
assign="amort_link"
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
une écriture de cession
|
||||
*}}
|
||||
{{#form on="detach_cession"}}
|
||||
{{:include file="_detach_line.html" immo_doc_id=$_POST.immo_doc_id line_id=$_POST.detach_cession type="cession"}}
|
||||
{{:include file="_detach_cession.html" immo_doc_id=$_POST.immo_doc_id cession_line_id=$_POST.detach_cession}}
|
||||
{{:redirect to="exit_step3.html?immo_doc_id=%s&from=exit&ok=1&msg=detach_cession"|args:$_GET.immo_doc_id}}
|
||||
{{/form}}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
{{* voir si l'écriture de cession est déjà liée à une immo *}}
|
||||
{{* TODO VOIR SI UTILE
|
||||
{{#load type="cession_link"
|
||||
where="$$.line_id = :cession_line_id"
|
||||
where="$$.cession_line_id = :cession_line_id"
|
||||
:cession_line_id = $line.line_id
|
||||
assign="cession_link"
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
{{#select credit
|
||||
FROM acc_transactions_lines
|
||||
WHERE id = :cession_line_id;
|
||||
:cession_line_id = $line_id
|
||||
:cession_line_id = $cession_line_id
|
||||
}}
|
||||
{{:assign montant_cession=$credit}}
|
||||
{{/select}}
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||
WHERE line.id = :exit_line_id;
|
||||
:exit_line_id = $exit_info.line_id
|
||||
:exit_line_id = $exit_info.exit_line_id
|
||||
assign="exit_line"
|
||||
}}
|
||||
{{/select}}
|
||||
|
|
@ -125,15 +125,15 @@
|
|||
FROM acc_transactions AS trans
|
||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.line_id') = line.id
|
||||
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
|
||||
WHERE
|
||||
acc.code = :acc_code
|
||||
AND line.credit > 0
|
||||
AND credit_line_id NOT IN (
|
||||
SELECT json_extract(credit_link.document, '$.line_id') AS line_id FROM !table as credit_link
|
||||
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
|
||||
WHERE json_extract(credit_link.document, '$.type') == "credit_link"
|
||||
UNION
|
||||
SELECT json_extract(exit_link.document, '$.line_id') AS line_id FROM !table as exit_link
|
||||
SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link
|
||||
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
|
||||
)
|
||||
;
|
||||
|
|
@ -181,7 +181,7 @@
|
|||
{{:assign amort_amount=0}}
|
||||
{{:assign keep_amort=true}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.line_id = :amort_line_id"
|
||||
where="$$.amort_line_id = :amort_line_id"
|
||||
:amort_line_id=$amort_line.amort_line_id|intval
|
||||
assign="amort_link"
|
||||
}}
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
une écriture de sortie de bilan
|
||||
*}}
|
||||
{{#form on="detach_exit"}}
|
||||
{{:include file="_detach_line.html" immo_doc_id=$_POST.immo_doc_id line_id=$_POST.detach_exit type="exit"}}
|
||||
{{:include file="_detach_exit.html" immo_doc_id=$_POST.immo_doc_id exit_line_id=$_POST.detach_exit}}
|
||||
{{:redirect to="?immo_doc_id=%s&from=exit&ok=1&msg=detach_exit"|args:$_POST.immo_doc_id}}
|
||||
{{/form}}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
{{:include file="_nav.html" current=$type_immo}}
|
||||
|
||||
{{* Mise à niveau *}}
|
||||
{{:assign module_version="0.42"}}
|
||||
{{:assign module_version="0.41"}}
|
||||
{{:include file="_upgrade.html" module_version=$module_version}}
|
||||
|
||||
{{* supprimer les documents sans écriture associée *}}
|
||||
|
|
|
|||
|
|
@ -12,19 +12,45 @@
|
|||
"type" : "integer",
|
||||
"exclusiveMinimum": 0
|
||||
},
|
||||
"line_id" : {
|
||||
"description": "ligne d'écriture associée à l'immobilisation",
|
||||
"amort_line_id" : {
|
||||
"description": "ligne d'amortissement associée à l'immobilisation",
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
},
|
||||
"credit_line_id": {
|
||||
"description": "ligne au crédit du compte de l'immobilisation",
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
},
|
||||
"exit_line_id": {
|
||||
"description": "ligne de sortie du bilan de l'immobilisation",
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
},
|
||||
"cession_line_id": {
|
||||
"description": "ligne de cession de l'immobilisation",
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
},
|
||||
"amount": {
|
||||
"description": "montant de la ligne associée à l'immobilisation",
|
||||
"description": "montant de la ligne d'amortissement ou de crédit",
|
||||
"type": ["number", "null"]
|
||||
},
|
||||
"created" : {
|
||||
"description" : "vrai si ligne créée dans le module",
|
||||
"description" : "vrai si amortissement créé dans le module",
|
||||
"type" : ["boolean", "null"]
|
||||
}
|
||||
},
|
||||
"required": ["type", "immo_doc_id", "line_id"]
|
||||
}
|
||||
"required": ["type", "immo_doc_id"],
|
||||
"if": {"properties": {"type": {"const": "amort_link"}}, "required": ["type"]},
|
||||
"then": {"required": ["amort_line_id"]},
|
||||
"else":
|
||||
"if": {"properties": {"type": {"const": "credit_link"}}, "required": ["type"]},
|
||||
"then": {"required": ["credit_line_id"]},
|
||||
"else":
|
||||
"if": {"properties": {"type": {"const": "cession_link"}}, "required": ["type"]},
|
||||
"then": {"required": ["cession_line_id"]},
|
||||
"else":
|
||||
"if": {"properties": {"type": {"const": "exit_link"}}, "required": ["type"]},
|
||||
"then": {"required": ["exit_line_id"]},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,10 +76,10 @@
|
|||
WHERE !account_condition
|
||||
AND credit > 0
|
||||
AND credit_line_id NOT IN (
|
||||
SELECT json_extract(credit_link.document, '$.line_id') AS line_id FROM !table as credit_link
|
||||
WHERE json_extract(credit_link.document, '$.type') == "credit_link"
|
||||
SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link
|
||||
WHERE json_extract(link.document, '$.type') == "credit_link"
|
||||
UNION
|
||||
SELECT json_extract(exit_link.document, '$.line_id') AS line_id FROM !table as exit_link
|
||||
SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link
|
||||
WHERE json_extract(exit_link.document, '$.type') == "exit_link")
|
||||
ORDER BY trans.date, trans.label;
|
||||
!account_condition = $account_condition
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
une écriture de cession
|
||||
*}}
|
||||
{{#form on="attach_cession"}}
|
||||
{{:include file="_attach_line.html" immo_doc_id=$_POST.immo_doc_id line_id=$_POST.attach_cession type="cession"}}
|
||||
{{:include file="_attach_cession.html" immo_doc_id=$_POST.immo_doc_id cession_line_id=$_POST.attach_cession}}
|
||||
{{:redirect force="exit_step3.html?immo_doc_id=%s&from=exit&ok=1&msg=attach_cession"|args:$_POST.immo_doc_id}}
|
||||
{{/form}}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
une écriture de sortie d'immobilisation
|
||||
*}}
|
||||
{{#form on="attach_exit"}}
|
||||
{{:include file="_attach_line.html" immo_doc_id=$_POST.immo_doc_id line_id=$_POST.attach_exit type="exit"}}
|
||||
{{:include file="_attach_exit.html" immo_doc_id=$_POST.immo_doc_id exit_line_id=$_POST.attach_exit}}
|
||||
{{:redirect force="exit_step4.html?immo_doc_id=%s&from=exit&ok=1&msg=attach_exit"|args:$_POST.immo_doc_id}}
|
||||
{{/form}}
|
||||
|
||||
|
|
@ -47,15 +47,15 @@
|
|||
FROM acc_transactions AS trans
|
||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.line_id') = line.id
|
||||
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
|
||||
WHERE
|
||||
acc.code = :acc_code
|
||||
AND line.credit > 0
|
||||
AND credit_line_id NOT IN (
|
||||
SELECT json_extract(credit_link.document, '$.line_id') AS line_id FROM !table as credit_link
|
||||
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
|
||||
WHERE json_extract(credit_link.document, '$.type') == "credit_link"
|
||||
UNION
|
||||
SELECT json_extract(exit_link.document, '$.line_id') AS line_id FROM !table as exit_link
|
||||
SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link
|
||||
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
|
||||
)
|
||||
;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
name="Amortissements"
|
||||
description="Immobilisations et amortissements\nversion 0.42"
|
||||
description="Immobilisations et amortissements\nversion 0.41.4"
|
||||
author="Jean-Christophe Engel"
|
||||
author_url="https://gitea.zaclys.com/lesanges"
|
||||
home_button=false
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@
|
|||
key=""|uuid
|
||||
type="amort_link"
|
||||
immo_doc_id=$_GET.immo_doc_id|intval
|
||||
line_id=$line.id
|
||||
amort_line_id=$line.id
|
||||
created=true
|
||||
}}
|
||||
{{:break}}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@
|
|||
key=""|uuid
|
||||
type="amort_link"
|
||||
immo_doc_id=$info_immo.id
|
||||
line_id=$line.id
|
||||
amort_line_id=$line.id
|
||||
created=true
|
||||
}}
|
||||
{{/if}}
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
key=""|uuid
|
||||
type="exit_link"
|
||||
immo_doc_id=$info_immo.id
|
||||
line_id=$line.id
|
||||
exit_line_id=$line.id
|
||||
created=true
|
||||
}}
|
||||
{{:break}}
|
||||
|
|
@ -270,7 +270,7 @@
|
|||
key=""|uuid
|
||||
type="cession_link"
|
||||
immo_doc_id=$info_immo.id
|
||||
line_id=$line.id
|
||||
cession_line_id=$line.id
|
||||
created=true
|
||||
}}
|
||||
{{:break}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue