Compare commits
No commits in common. "d6bcaedd0514ea98e2e1e810befe8aa48f9478fc" and "50ea449dad892d236478b0ce30f4b888e11a26ff" have entirely different histories.
d6bcaedd05
...
50ea449dad
9 changed files with 92 additions and 93 deletions
|
|
@ -41,7 +41,6 @@
|
||||||
{{* pas de ligne d'immo liée à cette ligne d'amort => garder cette ligne d'amortissement *}}
|
{{* pas de ligne d'immo liée à cette ligne d'amort => garder cette ligne d'amortissement *}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if $keep_amort && $amort_amount < $amort_line.amount}}
|
{{if $keep_amort && $amort_amount < $amort_line.amount}}
|
||||||
{{:assign var="amort_line.amount" value="%d-%d"|math:$amort_line.amount:$amort_amount}}
|
|
||||||
{{:assign var="free_amort_lines." value=$amort_line}}
|
{{:assign var="free_amort_lines." value=$amort_line}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Détails"
|
label="Voir"
|
||||||
href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="eye"
|
href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="eye"
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@
|
||||||
|
|
||||||
{{:assign var="immo_lines." value=$immo_line}}
|
{{:assign var="immo_lines." value=$immo_line}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
{{*:debug lines=$immo_lines nb_lines=$immo_lines|count nb_null=$nb_null nb_managed=$nb_managed nb_ignored=$nb_ignored nb_other=$nb_other unhide=$unhide*}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|
@ -147,7 +148,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* vérifier si le libellé aurait pu être filtré *}}
|
{{* vérifier si le libellé aurait pu être filtré *}}
|
||||||
{{#foreach from=$module.config.filters item="filter"}}
|
{{#foreach from=$module.config.filters item="filter"}}
|
||||||
{{if $trans_label|strpos:$filter !== false}}
|
{{if $filter|strpos:$trans_label !== false}}
|
||||||
{{:assign status="ignored"}}
|
{{:assign status="ignored"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{if $module.table}}
|
|
||||||
{{* supprimer les documents sans écriture associée *}}
|
{{* supprimer les documents sans écriture associée *}}
|
||||||
{{:assign var="docs." type="amort_link" field="amort_line_id"}}
|
{{:assign var="docs." type="amort_link" field="amort_line_id"}}
|
||||||
{{:assign var="docs." type="credit_link" field="credit_line_id"}}
|
{{:assign var="docs." type="credit_link" field="credit_line_id"}}
|
||||||
|
|
@ -14,32 +13,16 @@
|
||||||
{{:assign type_name=$type|quote_sql}}
|
{{:assign type_name=$type|quote_sql}}
|
||||||
{{:assign type_cond="$$.type"|cat:" = "|cat:$type_name}}
|
{{:assign type_cond="$$.type"|cat:" = "|cat:$type_name}}
|
||||||
|
|
||||||
{{* vérifier existence écriture associée au doc *}}
|
|
||||||
{{#select
|
{{#select
|
||||||
info.id as info_id,
|
info.id
|
||||||
$$.immo_doc_id as immo_doc_id,
|
|
||||||
line.id as line_id
|
|
||||||
FROM !table AS info
|
FROM !table AS info
|
||||||
LEFT JOIN acc_transactions_lines as line ON !join_field = line.id
|
LEFT JOIN acc_transactions_lines as line ON !join_field = line.id
|
||||||
WHERE !type_cond
|
WHERE !type_cond AND line.id IS NULL
|
||||||
;
|
;
|
||||||
!table=$module.table
|
!table=$module.table
|
||||||
!type_cond = $type_cond
|
!type_cond = $type_cond
|
||||||
!join_field = $join_field
|
!join_field = $join_field
|
||||||
assign="line"
|
|
||||||
}}
|
}}
|
||||||
{{if $line.line_id == null}}
|
{{:delete id=$id}}
|
||||||
{{:delete id=$line.info_id}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* vérifier existence doc immo *}}
|
|
||||||
{{if $type != "immo"}}
|
|
||||||
{{#load id=$immo_doc_id assign="immo_doc"}}
|
|
||||||
{{else}}
|
|
||||||
{{:delete id=$line.info_id}}
|
|
||||||
{{/load}}
|
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{/if}}
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,13 @@
|
||||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
{{* 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"}}
|
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
||||||
{{:assign solde="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
{{:assign solde="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
||||||
|
|
||||||
|
{{if $info_immo.status == "amortized"}}
|
||||||
|
{{:assign amort_amount=$solde}}
|
||||||
|
{{:assign valeur_residuelle=0}}
|
||||||
|
{{else}}
|
||||||
{{:assign valeur_residuelle=$solde}}
|
{{:assign valeur_residuelle=$solde}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* lister les amortissements liés à l'immobilisation *}}
|
{{* 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, created_amort"}}
|
||||||
|
|
@ -107,14 +113,15 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3 class="ruler">Immobilisation</h3>
|
<h3 class="ruler">Immobilisation</h3>
|
||||||
<nav class="actions">
|
<p class="actions-center">
|
||||||
{{if $total_amort == 0}}
|
{{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="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}}
|
{{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"}}
|
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</nav>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<div class="informations">
|
<div class="informations">
|
||||||
<dl class="describe">
|
<dl class="describe">
|
||||||
|
|
@ -138,7 +145,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $valeur_residuelle > 0}}
|
{{if $valeur_residuelle > 0}}
|
||||||
<dt>Montant des amortissements</dt>
|
<dt>Montant des amortissements</dt>
|
||||||
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
<dd>{{"%d-%d"|math:$solde:$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
||||||
<dt>Valeur nette résiduelle</dt>
|
<dt>Valeur nette résiduelle</dt>
|
||||||
<dd>{{$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
<dd>{{$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -149,43 +156,8 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 class="ruler">Avoirs</h3>
|
|
||||||
<nav class="actions">
|
|
||||||
{{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}}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
{{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}}
|
|
||||||
|
|
||||||
<h3 class="ruler">Amortissements</h3>
|
<h3 class="ruler">Amortissements</h3>
|
||||||
<nav class="actions">
|
<p class="actions-center">
|
||||||
{{if $free_amort_lines && ! $created_amort}}
|
{{if $free_amort_lines && ! $created_amort}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Attacher un amortissement"
|
label="Attacher un amortissement"
|
||||||
|
|
@ -200,7 +172,7 @@
|
||||||
href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
|
href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
|
||||||
shape="plus"
|
shape="plus"
|
||||||
}}
|
}}
|
||||||
</nav>
|
</p>
|
||||||
|
|
||||||
{{if $linked_amort != null}}
|
{{if $linked_amort != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
|
|
@ -259,5 +231,40 @@
|
||||||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation ; utilisez le bouton « Enregistrer un amortissement » pour enregistrer un nouvel amortissement</p>
|
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation ; utilisez le bouton « Enregistrer un amortissement » pour enregistrer un nouvel amortissement</p>
|
||||||
{{/if}}
|
{{/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}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
{{if $_GET.from == "exit"}}
|
{{if $_GET.from == "exit"}}
|
||||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
{{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
|
{{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,14 +188,14 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Paramètres de l'amortissement</legend>
|
<legend>Paramètres de l'amortissement</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" min=1 default=$info_immo.duration suffix="année(s)"}}
|
{{: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}}
|
{{if $info_immo.amount != null}}
|
||||||
{{:assign max_aff="%f"|math:$max_disponible|money_currency:false}}
|
{{:assign max_aff="%f"|math:$max_disponible|money_currency:false}}
|
||||||
{{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum : %s"|args:$max_aff}}
|
{{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum : %s"|args:$max_aff}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat help="si différente de la date de l'écriture d'immobilisation"}}
|
{{: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 help="si différente de la date d'acquisition"}}
|
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes}}
|
||||||
{{:input type="text" name="libelle" label="Libellé" default=$info_immo.label help="si différent du libellé de l'écriture d'immobilisation"}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,14 @@
|
||||||
code_immo=$ligne_immo.account_code
|
code_immo=$ligne_immo.account_code
|
||||||
keep="code_amort"
|
keep="code_amort"
|
||||||
}}
|
}}
|
||||||
{{:assign filter_condition="account.code = "|cat:$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 ("}}
|
||||||
|
{{#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}}
|
{{else}}
|
||||||
{{:assign account_filter="28%"|quote_sql}}
|
{{:assign account_filter="28%"|quote_sql}}
|
||||||
{{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
|
{{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign var="amort_label" value="Amortissement %s"|args:$amort_label}}
|
{{:assign var="amort_label" value="Amortissement %s"|args:$amort_label}}
|
||||||
|
|
||||||
|
{{if $info_immo.status == "amortized" || $info_immo.status == "archived"}}
|
||||||
|
{{:error message="Cette immobilisation est complètement amortie ; il est impossible d'ajouter une écriture d'amortissement"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
{{* 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="total_credits"}}
|
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_credits"}}
|
||||||
{{:assign var="ligne_immo.amount" value="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
{{:assign var="ligne_immo.amount" value="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
||||||
|
|
@ -78,9 +82,7 @@
|
||||||
{{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
|
{{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
|
||||||
{{:assign msg_years=$msg_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "|cat:$debut|cat:" à "|cat:$fin}}
|
{{:assign msg_years=$msg_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "|cat:$debut|cat:" à "|cat:$fin}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign date_debut=$date_debut|date_short}}
|
{{:error message="Aucun exercice ouvert pour enregistrer un amortissement"}}
|
||||||
{{:assign msg="Pas d'exercice ouvert pour enregistrer un amortissement à partir du %s"|args:$date_debut}}
|
|
||||||
{{:error message=$msg}}
|
|
||||||
{{/years}}
|
{{/years}}
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue