Compare commits
No commits in common. "50ea449dad892d236478b0ce30f4b888e11a26ff" and "6f2750d2488ad1a8d4e3105e1318b0bbf24e75eb" have entirely different histories.
50ea449dad
...
6f2750d248
24 changed files with 499 additions and 311 deletions
|
|
@ -1,37 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Enregistrer 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 trans_id : id de l'écriture à attacher
|
||||
*}}
|
||||
{{* données de l'immobilisation *}}
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$immo_doc_id|intval keep="ligne_immo, message"}}
|
||||
{{if $message != null}}
|
||||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||
{{#select
|
||||
CASE links.id_related = :immo_trans_id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
END as linked_id
|
||||
FROM acc_transactions_links as links
|
||||
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||
:immo_trans_id = $ligne_immo.trans_id
|
||||
}}
|
||||
{{:assign var="linked_transactions." value=$linked_id}}
|
||||
{{/select}}
|
||||
|
||||
{{* ajouter la nouvelle liaison *}}
|
||||
{{:assign var="linked_transactions." value=$trans_id}}
|
||||
{{* Enregistrer les liaisons *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||
assign="result"
|
||||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
@param immo_doc_id : id du doc associé à l'immobilisation
|
||||
@result linked_amort : lignes d'amortissement liées à la ligne d'immobilisation
|
||||
@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}}
|
||||
|
|
@ -34,10 +33,6 @@
|
|||
assign="amort_line"
|
||||
}}
|
||||
{{:assign var="amort_line.amount" value=$amort_info.amount|or:$amort_line.amount}}
|
||||
{{if $amort_info.created}}
|
||||
{{:assign var="amort_line.created" value=true}}
|
||||
{{:assign var="created_amort" value=true}}
|
||||
{{/if}}
|
||||
{{:assign var="linked_amort.%s_%d"|args:$amort_line.date:$amort_info.id value=$amort_line}}
|
||||
{{:assign total_amort="%d+%d"|math:$total_amort:$amort_line.amount}}
|
||||
{{/select}}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_accounts AS account ON account.id = line.id_account
|
||||
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
|
||||
WHERE credit > 0 AND (NOT trans.status & 16) AND !filter_condition
|
||||
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) AND !filter_condition
|
||||
ORDER BY trans.date, trans.label;
|
||||
!filter_condition=$filter_condition
|
||||
assign="amort_line"
|
||||
|
|
|
|||
|
|
@ -68,9 +68,6 @@
|
|||
!table=$module.table
|
||||
!condition=$condition
|
||||
}}
|
||||
{{if $status != "managed" && $status != "amortized"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$immo_trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||
{{:assign montant_immo=$doc_amount|or:$debit}}
|
||||
|
|
@ -96,8 +93,9 @@
|
|||
{{/if}}
|
||||
{{/load}}
|
||||
|
||||
{{* Immobilisation soldée ? *}}
|
||||
{{* TODO ¿ marquer archivée ? *}}
|
||||
{{if $montant_immo == 0}}
|
||||
{{* Immobilisation soldée *}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -123,9 +121,17 @@
|
|||
<td class="money">{{"%d-%d"|math:$montant_immo:$amort_amount|money_html:false|raw}}</td>
|
||||
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||
<td class="actions">
|
||||
{{*if $amort_amount == 0*}}
|
||||
{{:linkbutton
|
||||
label="Voir"
|
||||
href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="eye"
|
||||
label="Détails"
|
||||
href="details_immo.html?immo_doc_id=%s"|args:$immo_doc_id
|
||||
shape="eye"
|
||||
}}
|
||||
{{* target="_dialog"*}}
|
||||
{{*/if*}}
|
||||
{{:linkbutton
|
||||
label="Amortissements"
|
||||
href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="table"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{* 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"}}
|
||||
|
||||
{{#foreach from=$docs}}
|
||||
|
||||
{{:assign join_field="$$."|cat:$field}}
|
||||
{{:assign type_name=$type|quote_sql}}
|
||||
{{:assign type_cond="$$.type"|cat:" = "|cat:$type_name}}
|
||||
|
||||
{{#select
|
||||
info.id
|
||||
FROM !table AS info
|
||||
LEFT JOIN acc_transactions_lines as line ON !join_field = line.id
|
||||
WHERE !type_cond AND line.id IS NULL
|
||||
;
|
||||
!table=$module.table
|
||||
!type_cond = $type_cond
|
||||
!join_field = $join_field
|
||||
}}
|
||||
{{:delete id=$id}}
|
||||
{{/select}}
|
||||
{{/foreach}}
|
||||
|
|
@ -93,7 +93,12 @@
|
|||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{if $status != "unfinished"}}
|
||||
{{if $status != "unfinished" && ! $_POST.amortir}}
|
||||
{{* ne pas amortir *}}
|
||||
{{:assign duration=0}}
|
||||
{{:assign date_debut=$_POST.date_achat|parse_date}}
|
||||
{{:assign status="ignored"}}
|
||||
{{elseif $status != "unfinished"}}
|
||||
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
||||
{{:assign date_debut=$_POST.date_mes|or:$_POST.date_achat|parse_date}}
|
||||
{{if $date_debut|strtotime < $_POST.date_achat|parse_date|strtotime}}
|
||||
|
|
@ -106,7 +111,7 @@
|
|||
{{if $_POST.date_mes == null || $_POST.date_mes == $_POST.date_achat}}
|
||||
{{:assign date_mes=null}}
|
||||
{{else}}
|
||||
{{:assign date_mes=$_POST.date_mes|parse_date}}
|
||||
{{:assign date_mes=$_POST.date_mes|date_short}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -137,19 +142,18 @@
|
|||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="asset.schema.json"
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_line_id
|
||||
duration=$duration
|
||||
date_mes=$date_mes
|
||||
status=$status
|
||||
created=true
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{if $status == "unfinished"}}
|
||||
{{:assign type_immo="unfinished"}}
|
||||
{{elseif $status == "managed"}}
|
||||
{{elseif $_POST.amortir}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{else}}
|
||||
{{:assign type_immo="other"}}
|
||||
|
|
@ -202,7 +206,7 @@
|
|||
name="credit_account"
|
||||
label="Compte de décaissement"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"512*|530*|404*":$selected_year
|
||||
target="!acc/charts/accounts/selector.php?types=%s&id_year=%d"|args:"1|2|3|4":$selected_year
|
||||
}}
|
||||
{{:input
|
||||
type="list"
|
||||
|
|
@ -222,6 +226,7 @@
|
|||
<fieldset>
|
||||
<legend>Amortissement</legend>
|
||||
<dl>
|
||||
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}}
|
||||
<div id="div_amort">
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" help="C'est la date de première utilisation ; à renseigner uniquement si différente de la date d'acquisition"}}
|
||||
|
|
@ -243,7 +248,13 @@ function changeYear(evt, f_accounts = ['credit_account', 'debit_account'], f_yea
|
|||
setSelectorYear(f_accounts, f_years_select);
|
||||
}
|
||||
|
||||
function changeVisibility(evt, idcheck = 'f_amortir_1', iddiv = 'div_amort')
|
||||
{
|
||||
toggleVisibility(idcheck, document.querySelectorAll('#' + iddiv));
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_id_year').onchange = changeYear;
|
||||
document.getElementById('f_amortir_1').onclick = changeVisibility;
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
{{* immobilisation sortie du bilan *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="asset.schema.json"
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$_GET.immo_line_id|intval
|
||||
duration=0
|
||||
|
|
@ -129,7 +129,7 @@
|
|||
{{/if}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="asset.schema.json"
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$_GET.immo_line_id|intval
|
||||
duration=$duration
|
||||
|
|
|
|||
|
|
@ -38,14 +38,12 @@
|
|||
{{/if}}
|
||||
|
||||
{{* lister les amortissements liés à l'immobilisation *}}
|
||||
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, total_amort, created_amort"}}
|
||||
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, total_amort"}}
|
||||
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$total_amort}}
|
||||
|
||||
{{if $valeur_residuelle > 0}}
|
||||
{{* lister les amortissements non attachés à une immo *}}
|
||||
{{:assign account_filter="28%"|quote_sql}}
|
||||
{{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
|
||||
{{:include file="./_get_free_amort.html" filter_condition=$filter_condition keep="free_amort_lines"}}
|
||||
{{:include file="./_get_free_amort.html" filter_condition="1" keep="free_amort_lines"}}
|
||||
{{/if}}
|
||||
|
||||
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortization"}}
|
||||
|
|
@ -81,8 +79,6 @@
|
|||
{{:assign msg="Détachement avoir affectué"}}
|
||||
{{elseif $_GET.msg|match:"amortissement"}}
|
||||
{{:assign msg="Amortissement enregistré"}}
|
||||
{{elseif $_GET.msg|match:"modif"}}
|
||||
{{:assign msg="Modifications enregistrées"}}
|
||||
{{/if}}
|
||||
<p class="block confirm">{{$msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
|
|
@ -112,16 +108,48 @@
|
|||
</fieldset>
|
||||
</form>
|
||||
|
||||
<h3 class="ruler">Immobilisation</h3>
|
||||
<p class="actions-center">
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Modifier les paramètres" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
||||
{{if ! $info_immo.created}}
|
||||
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
||||
<nav style="margin-bottom: 1em;">
|
||||
<aside> {{* class="right">*}}
|
||||
{{if $free_amort_lines}}
|
||||
{{:linkbutton
|
||||
label="Attacher un amortissement"
|
||||
title="Attacher un amortissement existant"
|
||||
href="other_amortizations.html?immo_doc_id=%s"|args:$_GET.immo_doc_id
|
||||
shape="link"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</p>
|
||||
{{:linkbutton
|
||||
label="Enregistrer un amortissement"
|
||||
title="Enregistrer un nouvel amortissement"
|
||||
href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
|
||||
shape="plus"
|
||||
}}
|
||||
</aside>
|
||||
</nav>
|
||||
|
||||
{{if $linked_immos != null}}
|
||||
<aside class="right">
|
||||
<table class="list">
|
||||
<caption>Écritures d'avoir liées</caption>
|
||||
<tbody>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.label}}</td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
<td>
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
|
|
@ -156,24 +184,7 @@
|
|||
</dl>
|
||||
</div>
|
||||
|
||||
<h3 class="ruler">Amortissements</h3>
|
||||
<p class="actions-center">
|
||||
{{if $free_amort_lines && ! $created_amort}}
|
||||
{{:linkbutton
|
||||
label="Attacher un amortissement"
|
||||
title="Attacher un amortissement existant"
|
||||
href="other_amortizations.html?immo_doc_id=%s&filter=true"|args:$_GET.immo_doc_id
|
||||
shape="link"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Enregistrer un amortissement"
|
||||
title="Enregistrer un nouvel amortissement"
|
||||
href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
|
||||
shape="plus"
|
||||
}}
|
||||
</p>
|
||||
|
||||
<h3 class="ruler">Amortissements enregistrés</h3>
|
||||
{{if $linked_amort != null}}
|
||||
<section class="amortissement">
|
||||
<table class="list">
|
||||
|
|
@ -209,9 +220,7 @@
|
|||
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
||||
<td>{{$line.account_label}}</td>
|
||||
<td>
|
||||
{{if ! $created_amort}}
|
||||
{{:linkbutton label="Détacher" href="detach_amort.html?immo_doc_id=%s&amort_line_id=%s"|args:$_GET.immo_doc_id:$line.line_id shape="minus"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
|
|
@ -220,7 +229,7 @@
|
|||
</section>
|
||||
{{/if}}
|
||||
|
||||
{{if $free_amort_lines && ! $created_amort}}
|
||||
{{if $free_amort_lines}}
|
||||
<p class="block alert">
|
||||
Il y a des écritures d'amortissement qui ne sont pas attachées à une immobilisation ! <br />
|
||||
Utilisez le bouton « Attacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||
|
|
@ -230,41 +239,5 @@
|
|||
{{if $linked_amort == null}}
|
||||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation ; utilisez le bouton « Enregistrer un amortissement » pour enregistrer un nouvel amortissement</p>
|
||||
{{/if}}
|
||||
|
||||
<h3 class="ruler">Avoirs</h3>
|
||||
<p class="actions-center">
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||
{{/if}}
|
||||
</p>
|
||||
|
||||
{{if $linked_immos != null}}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<th class="num">N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th class="actions"></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>{{$line.label}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
<td>
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
||||
|
|
|
|||
|
|
@ -93,8 +93,28 @@
|
|||
{{:error message="Le montant de l'amortissement (%s) dépasse la valeur résiduelle de l'immobilisation (%s)"|args:$ma:$vnc}}
|
||||
{{/if}}
|
||||
|
||||
{{* Lier l'écriture d'amortissement à l'écriture d'immobilisation *}}
|
||||
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$amort_line.trans_id}}
|
||||
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||
{{#select
|
||||
CASE links.id_related = :immo_trans_id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
END as linked_id
|
||||
FROM acc_transactions_links as links
|
||||
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||
:immo_trans_id = $ligne_immo.trans_id
|
||||
}}
|
||||
{{:assign var="linked_transactions." value=$linked_id}}
|
||||
{{/select}}
|
||||
|
||||
{{* ajouter la nouvelle liaison *}}
|
||||
{{:assign var="linked_transactions." value=$amort_line.trans_id}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||
assign="result"
|
||||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
{{* vérifier si cette liaison est déjà présente dans les documents pour éviter les doublons *}}
|
||||
{{* TODO voir si nécessaire ? *}}
|
||||
|
|
@ -114,7 +134,7 @@
|
|||
}}
|
||||
{{/load}}
|
||||
|
||||
{{* À VÉRIFIER immo soldée ? *}}
|
||||
{{* immo soldée ? *}}
|
||||
{{if $total_amort == $montant_immo}}
|
||||
{{:assign status="amortized"}}
|
||||
{{:save
|
||||
|
|
|
|||
|
|
@ -20,13 +20,35 @@
|
|||
WHERE id = :line_id;
|
||||
:line_id = $_GET.cession_line_id|intval
|
||||
}}
|
||||
{{:assign cession_id=$id_transaction}}
|
||||
{{:assign rebut_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=$_GET.immo_doc_id trans_id=$cession_id}}
|
||||
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||
{{#select
|
||||
CASE links.id_related = :immo_trans_id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
END as linked_id
|
||||
FROM acc_transactions_links as links
|
||||
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||
:immo_trans_id = $ligne_immo.trans_id
|
||||
}}
|
||||
{{:assign var="linked_transactions." value=$linked_id}}
|
||||
{{/select}}
|
||||
|
||||
{{* ajouter la nouvelle liaison *}}
|
||||
{{:assign var="linked_transactions." value=$rebut_id}}
|
||||
|
||||
{{* Enregistrer les liaisons *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||
assign="result"
|
||||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
{{* enregistrer la liaison de l'écriture de cession *}}
|
||||
{{:save
|
||||
|
|
|
|||
|
|
@ -79,8 +79,30 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* Lier l'écriture de crédit à l'écriture d'immobilisation *}}
|
||||
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$credit_line.trans_id}}
|
||||
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||
{{#select
|
||||
CASE links.id_related = :immo_trans_id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
END as linked_id
|
||||
FROM acc_transactions_links as links
|
||||
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||
:immo_trans_id = $ligne_immo.trans_id
|
||||
}}
|
||||
{{:assign var="linked_transactions." value=$linked_id}}
|
||||
{{/select}}
|
||||
|
||||
{{* ajouter la nouvelle liaison *}}
|
||||
{{:assign var="linked_transactions." value=$credit_line.trans_id}}
|
||||
|
||||
{{* Enregistrer les liaisons *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||
assign="result"
|
||||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
{{*
|
||||
TODO ? vérifier le succès avant d'enregistrer le doc ?
|
||||
|
|
@ -95,19 +117,18 @@
|
|||
amount=$saved_credit
|
||||
}}
|
||||
|
||||
{{*
|
||||
{{if $montant_credit == $solde_immo}}
|
||||
{{:save
|
||||
id=$_GET.immo_doc_id
|
||||
status="archived"
|
||||
}}
|
||||
{{/if}}
|
||||
*}}
|
||||
|
||||
{{if $_GET.from == "exit"}}
|
||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
||||
{{else}}
|
||||
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id}}
|
||||
{{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id}}
|
||||
{{*:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id*}}
|
||||
{{/if}}
|
||||
{{/form}}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,30 @@
|
|||
{{: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=$_GET.immo_doc_id trans_id=$rebut_id}}
|
||||
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||
{{#select
|
||||
CASE links.id_related = :immo_trans_id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
END as linked_id
|
||||
FROM acc_transactions_links as links
|
||||
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||
:immo_trans_id = $ligne_immo.trans_id
|
||||
}}
|
||||
{{:assign var="linked_transactions." value=$linked_id}}
|
||||
{{/select}}
|
||||
|
||||
{{* ajouter la nouvelle liaison *}}
|
||||
{{:assign var="linked_transactions." value=$rebut_id}}
|
||||
|
||||
{{* Enregistrer les liaisons *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction/%s/transactions"|args:$ligne_immo.trans_id
|
||||
assign="result"
|
||||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
{{* enregistrer la liaison de l'écriture de sortie *}}
|
||||
{{:save
|
||||
|
|
|
|||
|
|
@ -18,8 +18,15 @@
|
|||
{{:delete id=$id}}
|
||||
{{/load}}
|
||||
|
||||
{{* TODO : À VÉRIFIER *}}
|
||||
{{:save
|
||||
id=$_GET.immo_doc_id|intval
|
||||
status="managed"
|
||||
}}
|
||||
|
||||
{{if $_GET.from == "exit"}}
|
||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}}
|
||||
{{else}}
|
||||
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}}
|
||||
{{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=detach&"|args:$_GET.immo_doc_id}}
|
||||
{{*:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id*}}
|
||||
{{/if}}
|
||||
|
|
|
|||
145
details_immo.html
Normal file
145
details_immo.html
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
|
||||
{{*
|
||||
Afficher les détails d'une immmo
|
||||
- permettre l'association d'une immo au crédit du compte de l'immo
|
||||
- permettre de modifier les paramètres de l'immo
|
||||
@param immo_doc_id : numéro du doc d'immo
|
||||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
||||
{{if $message != null}}
|
||||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign var="info_immo.amount" value=$info_immo.amount|or:$ligne_immo.amount}}
|
||||
{{:assign var="info_immo.date_achat" value=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign var="info_immo.date_mes" value=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign var="info_immo.label" value=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $info_immo.label}}
|
||||
{{:assign var="info_immo.label" value=$info_immo.label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
|
||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
||||
{{:assign solde="%d-%d"|math:$info_immo.amount:$total_credits}}
|
||||
|
||||
{{* lister les amortissements liés à l'immobilisation *}}
|
||||
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_amort"}}
|
||||
|
||||
{{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
|
||||
{{if ! $dialog}}
|
||||
{{:assign subsubcurrent=null}}
|
||||
{{if $total_amort == 0}}
|
||||
{{:assign subsubcurrent="credit"}}
|
||||
{{/if}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="details" subsubcurrent=$subsubcurrent}}
|
||||
{{/if}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
||||
|
||||
{{*
|
||||
<nav class="tabs">
|
||||
<aside>
|
||||
{{:linkbutton label="Rattacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||
</aside>
|
||||
<nav style="margin-bottom: 1em;">
|
||||
{{:linkbutton shape="left" label="Retour à la liste des immobilisations" href="index.html}}
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Modifier les paramètres" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
||||
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
||||
{{/if}}
|
||||
</nav>
|
||||
</nav>
|
||||
*}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"attach_amort"}}
|
||||
{{:assign msg="Écriture d'amortissement attachée"}}
|
||||
{{elseif $_GET.msg|match:"attach_credit"}}
|
||||
{{:assign msg="Écriture au crédit attachée"}}
|
||||
{{elseif $_GET.msg|match:"info"}}
|
||||
{{:assign msg="Données de l'immobilisation enregistrées"}}
|
||||
{{elseif $_GET.msg|match:"detach"}}
|
||||
{{:assign msg="Écriture au crédit détachée"}}
|
||||
{{else}}
|
||||
{{:assign msg="Opération effectuée avec succès"}}
|
||||
{{/if}}
|
||||
<p class="block confirm">{{$msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
{{:assign msg="L'opération a échoué"}}
|
||||
<p class="block error">{{$msg}}</p>
|
||||
{{/if}}
|
||||
|
||||
<h3 class="ruler">
|
||||
Immobilisation
|
||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span>
|
||||
{{$info_immo.label}}
|
||||
</h3>
|
||||
{{if $linked_immos != null}}
|
||||
<aside class="right">
|
||||
<table class="list">
|
||||
<caption>Écritures d'avoir liées</caption>
|
||||
<tbody>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.label}}</td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
<td>
|
||||
{{if $total_amort == 0}}
|
||||
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
{{*
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span><span class="label"> {{$info_immo.label}}</span></dd>
|
||||
*}}
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||
<dt>Date d'acquisition</dt>
|
||||
<dd>{{$info_immo.date_achat|date_short}}</dd>
|
||||
{{if $info_immo.date_mes != null && $info_immo.date_mes != $info_immo.date_achat}}
|
||||
<dt>Date de mise en service</dt>
|
||||
<dd>{{$info_immo.date_mes|date_short}}</dd>
|
||||
{{/if}}
|
||||
<dt>Durée d'amortissement</dt>
|
||||
<dd>{{$info_immo.duration}} ans</dd>
|
||||
<dt>Montant de l'immobilisation</dt>
|
||||
<dd class="money">{{"%f"|math:$info_immo.amount|money_currency_html:false|raw}}</dd>
|
||||
{{if $total_credits > 0}}
|
||||
<dt>Montant des avoirs</dt>
|
||||
<dd class="money">{{"%f"|math:$total_credits|money_currency_html:false|raw}}</dd>
|
||||
{{*
|
||||
<dt>Écritures d'avoir</dt>
|
||||
<dd>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.id}}
|
||||
<span class="num"><a href="{{$url}}">#{{$line.id}}</a></span>
|
||||
{{/foreach}}
|
||||
</dd>
|
||||
*}}
|
||||
<dt>Montant à amortir</dt>
|
||||
<dd class="money">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
||||
{{/if}}
|
||||
{{if $total_amort > 0}}
|
||||
<dt>Montant des amortissements</dt>
|
||||
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd>{{"%d-%d-%d"|math:$info_immo.amount:$total_credits:$total_amort|money_currency_html:false|raw}}</dd>
|
||||
{{/if}}
|
||||
</dl>
|
||||
</div>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
{{:assign status="ignored"}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="asset.schema.json"
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$_GET.immo_line_id|intval
|
||||
duration=$duration
|
||||
|
|
|
|||
19
index.html
19
index.html
|
|
@ -19,7 +19,7 @@
|
|||
{{:admin_header title="Immobilisations en cours de constitution" custom_css="./style.css" current="module_amortization" subcurrent="unfinished"}}
|
||||
{{/if}}
|
||||
|
||||
{{:include file="_nav.html" current="index" subcurrent=$type_immo}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$type_immo}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"immobilisation"}}
|
||||
|
|
@ -34,8 +34,21 @@
|
|||
<p class="block error">Échec enregistrement immobilisation</p>
|
||||
{{/if}}
|
||||
|
||||
{{* supprimer les documents sans écriture associée *}}
|
||||
{{:include file="_remove_orphan_docs.tpl"}}
|
||||
{{#load type="immo"}}
|
||||
{{* supprimer les documents sans écriture associée *}}
|
||||
{{#select
|
||||
line.id as line_id
|
||||
FROM acc_transactions_lines as line
|
||||
WHERE line.id = :line_id;
|
||||
:line_id = $line
|
||||
}}
|
||||
{{else}}
|
||||
{{:delete key=$key}}
|
||||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
{{* chercher des immos antérieures à la date de début du 1er exercice *}}
|
||||
{{*:include file="_old_assets.html"*}}
|
||||
|
||||
{{if $type_immo == "other"}}
|
||||
{{:include file="_immobilisations_autres.html"}}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"description": "Schéma des liens entre écritures",
|
||||
"description": "Schéma des liens entre documents",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
"exclusiveMinimum": 0
|
||||
},
|
||||
"exit_line_id": {
|
||||
"description": "ligne de sortie du bilan de l'immobilisation",
|
||||
"description": "ligne d'amortissement de sortie du bilan de l'immobilisation",
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
},
|
||||
|
|
@ -35,10 +35,6 @@
|
|||
"amount": {
|
||||
"description": "montant de la ligne d'amortissement ou de crédit",
|
||||
"type": ["number", "null"]
|
||||
},
|
||||
"created" : {
|
||||
"description" : "vrai si amortissement créé dans le module",
|
||||
"type" : ["boolean", "null"]
|
||||
}
|
||||
},
|
||||
"required": ["type", "immo_doc_id"],
|
||||
|
|
|
|||
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
{{*
|
||||
@param immo_doc_id
|
||||
|
||||
TODO ? :
|
||||
- séparer les cas des immo simples et complexes (BOI)
|
||||
par exemple pour la durée d'amort par défaut {{:input ...}}
|
||||
- prise en charge immo => param = immo_line_id
|
||||
- modif param immo => param = immo_doc_id
|
||||
- DONE possibilité supprimer liaison écriture avoir
|
||||
*}}
|
||||
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
||||
|
|
@ -32,6 +39,15 @@
|
|||
|
||||
{{* traiter la saisie *}}
|
||||
{{#form on="save"}}
|
||||
{{if ! $_POST.amortir}}
|
||||
{{* ne pas amortir *}}
|
||||
{{:assign duration=0}}
|
||||
{{:assign libelle=null}}
|
||||
{{:assign montant=null}}
|
||||
{{:assign date_achat=null}}
|
||||
{{:assign date_mes=null}}
|
||||
{{:assign status="ignored"}}
|
||||
{{else}}
|
||||
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
||||
{{:assign da=$ligne_immo.date_achat|date_short}}
|
||||
{{:error message="Erreur : la date d'achat (%s) ne peut être postérieure à la date de l'écriture d'immobilisation (%s)"|args:$_POST.date_achat:$da}}
|
||||
|
|
@ -92,6 +108,7 @@
|
|||
{{/if}}
|
||||
|
||||
{{:assign status="managed"}}
|
||||
{{/if}}
|
||||
|
||||
{{* écritures de crédit *}}
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
|
|
@ -134,7 +151,7 @@
|
|||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$info_immo.key
|
||||
validate_schema="asset.schema.json"
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$info_immo.line
|
||||
duration=$duration
|
||||
|
|
@ -146,8 +163,12 @@
|
|||
assign_new_id="new_id"
|
||||
}}
|
||||
|
||||
{{if $_POST.amortir}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=modif"|args:$_GET.immo_doc_id:$type_immo}}
|
||||
{{else}}
|
||||
{{:assign type_immo="other"}}
|
||||
{{/if}}
|
||||
{{:redirect force="details_immo.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=infos"|args:$_GET.immo_doc_id:$type_immo}}
|
||||
|
||||
{{/form}}
|
||||
|
||||
|
|
@ -188,6 +209,8 @@
|
|||
<fieldset>
|
||||
<legend>Paramètres de l'amortissement</legend>
|
||||
<dl>
|
||||
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}}
|
||||
<div class="masquable">
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" min=1 default=$info_immo.duration}}
|
||||
{{:input type="text" name="libelle" label="Libellé" default=$info_immo.label}}
|
||||
{{if $info_immo.amount != null}}
|
||||
|
|
@ -196,6 +219,23 @@
|
|||
{{/if}}
|
||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes}}
|
||||
{{*
|
||||
{{if $linked_immos != null}}
|
||||
<dt><label>Écritures d'avoir liées à l'immobilisation</label></dt>
|
||||
<dd>
|
||||
<span class="input-list avoirs">
|
||||
<label for="credit_id">Écritures :</label>
|
||||
{{#foreach from=$linked_immos item="line"}}
|
||||
<span class="label">
|
||||
<input type="hidden" name="credit_id[]" value="{{$line.trans_id}}">{{$line.trans_id}}
|
||||
<button data-icon="✘" type="button" class=" icn-btn" title="Cliquer pour supprimer la liaison"></button>
|
||||
</span>
|
||||
{{/foreach}}
|
||||
</span>
|
||||
</dd>
|
||||
{{/if}}
|
||||
*}}
|
||||
</div>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
|
|
@ -204,3 +244,17 @@
|
|||
</form>
|
||||
|
||||
{{:admin_footer}}
|
||||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function changeVisibility(evt, idcheck = 'f_amortir_1', hiddenclass = 'masquable')
|
||||
{
|
||||
toggleVisibility(idcheck, document.querySelectorAll('.' + hiddenclass));
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_amortir_1').onclick = changeVisibility;
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
Lister les écritures d'amortissement indépendantes
|
||||
et proposer des les attacher à l'immo sélectionnée
|
||||
@param immo_doc_id id du doc d'immo associé
|
||||
*}}
|
||||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
||||
{{if $message != null}}
|
||||
|
|
@ -16,29 +17,27 @@
|
|||
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_GET.filter}}
|
||||
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
code_immo=$ligne_immo.account_code
|
||||
keep="code_amort"
|
||||
}}
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
{{:assign account_condition="account.code = "|cat:$code_amort}}
|
||||
{{:assign filter_condition=$account_condition|cat:" AND NOT ("}}
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
{{if $_POST.unhide == null}}
|
||||
{{:assign filter_condition=" NOT ("}}
|
||||
{{#foreach from=$module.config.filters item="filter"}}
|
||||
{{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}}
|
||||
{{:assign filter_condition=$filter_condition|cat:" trans.label LIKE "|cat:$filter|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign filter_condition=$filter_condition|cat:"0)"}}
|
||||
{{else}}
|
||||
{{:assign account_filter="28%"|quote_sql}}
|
||||
{{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
|
||||
{{:assign filter_condition="1"}}
|
||||
{{/if}}
|
||||
|
||||
{{* lister les amortissements non rattachés à une immo *}}
|
||||
{{:include file="./_get_free_amort.html" filter_condition=$filter_condition keep="free_amort_lines"}}
|
||||
|
||||
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
code_immo=$ligne_immo.account_code
|
||||
keep="code_amort"
|
||||
}}
|
||||
{{:admin_header title="Amortissements non rattachés" custom_css="./style.css" current="module_amortization"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
|
|
@ -46,27 +45,22 @@
|
|||
{{:include
|
||||
file="_nav.html"
|
||||
current="index"
|
||||
subcurrent="managed"
|
||||
subcurrent="other"
|
||||
subsubcurrent="amortization"
|
||||
type_immo="managed"
|
||||
type_immo="other"
|
||||
autres_amort=$free_amort_lines
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
<nav class="tabs">
|
||||
<ul>
|
||||
<li {{if $_GET.filter}}class="current"{{/if}}>
|
||||
<a href="other_amortizations.html?immo_doc_id={{$_GET.immo_doc_id}}{{if $dialog}}&_dialog{{/if}}&filter=true">
|
||||
Amortissements du compte {{$code_amort}}
|
||||
</a>
|
||||
</li>
|
||||
<li {{if ! $_GET.filter}}class="current"{{/if}}>
|
||||
<a href="other_amortizations.html?immo_doc_id={{$_GET.immo_doc_id}}{{if $dialog}}&_dialog{{/if}}">
|
||||
Tous les amortissements
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
{{if $_POST.unhide != null}}
|
||||
{{:assign checked="checked"}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
{{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher toutes les écritures"}}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
{{if $free_amort_lines != null}}
|
||||
<section class="amortissement">
|
||||
|
|
@ -85,11 +79,9 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$free_amort_lines item="line"}}
|
||||
{{*
|
||||
{{if $_GET.filter && $line.account_code != $code_amort}}
|
||||
{{if $_POST.unhide == null && $line.account_code != $code_amort}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
*}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
<tr>
|
||||
|
|
@ -117,10 +109,8 @@
|
|||
</table>
|
||||
</section>
|
||||
{{else}}
|
||||
<p class="block alert">Aucun amortissement pour le compte {{$code_amort}}</p>
|
||||
<p class="block alert">Aucun amortissement à rattacher</p>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
||||
|
||||
|
|
|
|||
|
|
@ -185,7 +185,6 @@
|
|||
type="amort_link"
|
||||
immo_doc_id=$_GET.immo_doc_id|intval
|
||||
amort_line_id=$line.id
|
||||
created=true
|
||||
}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
|
|
@ -241,7 +240,6 @@
|
|||
name="debit_account"
|
||||
label="Compte de débit"
|
||||
required=true
|
||||
readonly=true
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"68*":$selected_year
|
||||
default=$debit_account
|
||||
}}
|
||||
|
|
@ -250,7 +248,6 @@
|
|||
name="credit_account"
|
||||
label="Compte d'amortissement (28xx)"
|
||||
required=true
|
||||
readonly=true
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"28*":$selected_year
|
||||
default=$credit_account
|
||||
}}
|
||||
|
|
@ -289,8 +286,8 @@ function redisplayData(evt,
|
|||
)
|
||||
{
|
||||
setDateEnd(f_years_select, f_date, f_years_data);
|
||||
displayAmort(f_immo, f_duree, f_amort, f_years_data, f_years_select, f_montant, f_erreur);
|
||||
setSelectorYear(['credit_account', 'debit_account'], f_years_select);
|
||||
displayAmort(f_immo, f_duree, f_amort, f_years_data, f_years_select, f_montant, f_erreur);
|
||||
}
|
||||
|
||||
function redisplayAmort(evt,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"description": "Donnée d'une immobilisation",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
|
|
@ -36,10 +35,6 @@
|
|||
"status" : {
|
||||
"type" : ["string", "null"],
|
||||
"enum" : ["managed", "amortized", "archived", "ignored"]
|
||||
},
|
||||
"created" : {
|
||||
"description" : "vrai si immobilisation créée dans le module",
|
||||
"type" : ["boolean", "null"]
|
||||
}
|
||||
},
|
||||
"required": ["type", "line", "duration", "status"]
|
||||
|
|
@ -27,12 +27,10 @@ function toggleVisibility(idcheck, fields) {
|
|||
function setAccountYear(button_names, id_year) {
|
||||
for (const name of button_names) {
|
||||
const button = document.querySelector("button[data-name=" + name + "]");
|
||||
if (button != null) {
|
||||
const b_value = button.value;
|
||||
const new_value = b_value.replace(/id_year=\d+/, 'id_year=' + id_year);
|
||||
button.setAttribute('value', new_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -133,9 +131,7 @@ function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_mo
|
|||
case_montant.innerText = montant_amort;
|
||||
}
|
||||
|
||||
function setSelectorYear(button_names, f_years_selector)
|
||||
{
|
||||
const selector = document.getElementById(f_years_selector);
|
||||
function setSelectorYear(button_names, f_years_selector) {
|
||||
const selected_year = document.getElementById(f_years_selector).value;
|
||||
setAccountYear(button_names, selected_year);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@
|
|||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="asset.schema.json"
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_line_id
|
||||
duration=$duration
|
||||
|
|
@ -257,7 +257,6 @@
|
|||
type="list"
|
||||
name="credit_accounts[]"
|
||||
required=true
|
||||
readonly=true
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$code:$selected_year
|
||||
default=$current_account
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -392,7 +392,6 @@
|
|||
type="list"
|
||||
name="comp_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"68*":$chart_id
|
||||
readonly=true
|
||||
default=$comp_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -405,7 +404,6 @@
|
|||
type="list"
|
||||
name="amort_comp_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
readonly=true
|
||||
default=$amort_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -438,7 +436,6 @@
|
|||
type="list"
|
||||
name="except_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"687*":$chart_id
|
||||
readonly=true
|
||||
default=$except_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -451,7 +448,6 @@
|
|||
type="list"
|
||||
name="amort_except_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
readonly=true
|
||||
default=$amort_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -478,7 +474,6 @@
|
|||
type="list"
|
||||
name="amort_sortie_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
readonly=true
|
||||
default=$amort_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -497,7 +492,6 @@
|
|||
type="list"
|
||||
name="vnc_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s*&id_chart=%s"|args:$vnc_code:$chart_id
|
||||
readonly=true
|
||||
default=$vnc_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -511,7 +505,6 @@
|
|||
type="list"
|
||||
name="immo_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:$patterns:$chart_id
|
||||
readonly=true
|
||||
default=$immo_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -538,7 +531,6 @@
|
|||
type="list"
|
||||
name="creance_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"462*":$chart_id
|
||||
readonly=true
|
||||
default=$creance_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -551,7 +543,6 @@
|
|||
type="list"
|
||||
name="cession_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s*&id_chart=%s"|args:$cession_code:$chart_id
|
||||
readonly=true
|
||||
default=$cession_account
|
||||
}}
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue