Compare commits
1 commit
main
...
batch_clas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb7cbc9d3b |
26 changed files with 412 additions and 1676 deletions
172
_archives.html
172
_archives.html
|
|
@ -1,28 +1,14 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{* Liste des immobilisations archivées *}}
|
||||
<p class="help">
|
||||
Cette page liste les immobilisations sorties du bilan
|
||||
</p>
|
||||
|
||||
{{* Immobilisation avec une écriture de sortie de bilan *}}
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
|
||||
{{:assign accounts_condition="("}}
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||
{{:assign accounts_condition=$accounts_condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign accounts_condition=$accounts_condition|cat:"0)"}}
|
||||
{{:assign condition=$accounts_condition|cat:" AND acc2.code = account.code AND line.debit > 0 AND line.debit = line2.credit AND NOT (trans.status & 16)"}}
|
||||
|
||||
{{: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)"}}
|
||||
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
|
||||
{{* Immobilisation archivées prises en charge *}}
|
||||
{{#load type="immo" where="$$.status = 'archived'"}}
|
||||
{{:assign var="lines." value="'%s'"|args:$line}}
|
||||
{{/load}}
|
||||
{{:assign lines=$lines|implode:","}}
|
||||
{{:assign lines="("|cat:$lines|cat:")"}}
|
||||
{{:assign condition="line.id IN %s"|args:$lines}}
|
||||
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
|
|
@ -34,11 +20,50 @@
|
|||
account.label as account_label,
|
||||
line.debit AS debit,
|
||||
project.label as project_label,
|
||||
trans.id_year as trans_id_year,
|
||||
trans2.date as exit_date
|
||||
trans.id_year as trans_id_year
|
||||
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
|
||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
||||
WHERE !condition
|
||||
ORDER BY trans.date DESC;
|
||||
!condition=$condition
|
||||
assign="immo_archivee"
|
||||
}}
|
||||
{{:assign var="immo_archivees.%s"|args:$trans_id value=$immo_archivee}}
|
||||
{{/select}}
|
||||
|
||||
{{* Immobilisation avec une écriture de sortie de bilan *}}
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||
{{:assign condition=$condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
{{:assign cond2=$condition|replace:"account.":"acc2."}}
|
||||
{{:assign condition=$condition|cat:" AND "|cat:$cond2}}
|
||||
{{:assign condition=$condition|cat:" AND line.debit > 0 AND NOT (trans.status & 16)"}}
|
||||
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
trans.label as trans_label,
|
||||
trans.date as trans_date,
|
||||
line.id as immo_id,
|
||||
account.id as account_id,
|
||||
account.code as account_code,
|
||||
account.label as account_label,
|
||||
line.debit AS debit,
|
||||
project.label as project_label,
|
||||
trans.id_year as trans_id_year
|
||||
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
|
||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||
INNER JOIN acc_transactions_lines AS line2 ON line.debit = line2.credit
|
||||
INNER JOIN acc_transactions AS trans2 ON trans2.id = line2.id_transaction
|
||||
INNER JOIN acc_accounts AS acc2 ON acc2.id = line2.id_account
|
||||
|
|
@ -48,16 +73,20 @@
|
|||
!condition=$condition
|
||||
assign="immo_archivee"
|
||||
}}
|
||||
{{:assign var="immo_archivees.%s"|args:$trans_id value=$immo_archivee}}
|
||||
{{if ! $trans_id|key_in:$immo_archivees}}
|
||||
{{:assign var="immo_archivees.%s"|args:$trans_id value=$immo_archivee}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
|
||||
<section class="immobilisation">
|
||||
<h2 class="ruler">Immobilisations archivées</h2>
|
||||
|
||||
{{:assign nb_immo=0}}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>N°</th>
|
||||
<th>Mise en service</th>
|
||||
<th>Date sortie</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th>N° compte</th>
|
||||
|
|
@ -67,112 +96,23 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{:assign nb_immo=0}}
|
||||
{{:assign total_immo = 0}}
|
||||
{{:assign total_cessions = 0}}
|
||||
{{#foreach from=$immo_archivees}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
|
||||
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
|
||||
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
|
||||
<tr>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||
<td>{{$trans_date|date_short}}</td>
|
||||
<td>{{$exit_date|date_short}}</td>
|
||||
<td>{{$trans_label}}</td>
|
||||
<td class="money">{{"%f"|math:$debit|money_html:false|raw}}</td>
|
||||
<td class="money">{{"%f"|math:$debit|money:false}}</td>
|
||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td>{{$project_label}}</td>
|
||||
<td class="actions">
|
||||
</td>
|
||||
</tr>
|
||||
{{* voir s'il y a une écriture de cession associée à cette immo *}}
|
||||
{{#select
|
||||
trans.id,
|
||||
trans.label,
|
||||
trans.date,
|
||||
line.id,
|
||||
line.debit,
|
||||
acc.code,
|
||||
acc.label
|
||||
FROM acc_transactions_links AS link
|
||||
INNER JOIN acc_transactions AS trans ON (CASE
|
||||
WHEN link.id_transaction = :trans_id THEN link.id_related
|
||||
WHEN link.id_related = :trans_id THEN link.id_transaction
|
||||
END) = trans.id
|
||||
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 (link.id_transaction = :trans_id OR link.id_related = :trans_id) AND acc.code = 462
|
||||
;
|
||||
:trans_id = $trans_id
|
||||
}}
|
||||
{{:assign var="montant" from="montant_cessions.%d"|args:$account_code}}
|
||||
{{:assign var="montant_cessions.%d"|args:$account_code value="%d+%d"|math:$montant:$debit}}
|
||||
{{:assign total_cessions="%d+%d"|math:$total_cessions:$debit}}
|
||||
{{/select}}
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
{{if $total_immo != 0}}
|
||||
{{#foreach from=$sommes_immo|ksort key="code" item="value"}}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Total du compte {{$code}}</td>
|
||||
<td class="money">{{$value|money_html:false|raw}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="strong">Total des immobilisations</td>
|
||||
<td class="money strong">{{$total_immo|money_html:false|raw}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{if $total_cessions != 0}}
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
</tr>
|
||||
{{#foreach from=$montant_cessions|ksort key="code" item="value"}}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Cessions du compte {{$code}}</td>
|
||||
<td class="money">{{$value|money_html:false|raw}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="strong">Total des cessions</td>
|
||||
<td class="money strong">{{$total_cessions|money_html:false|raw}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</tfoot>
|
||||
</table>
|
||||
{{if $nb_immo == 0}}
|
||||
<p class="block alert">Aucune immobilisation</p>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
|
||||
{{:assign account_code=$account|keys|value:0}}
|
||||
{{:assign account_code=$account|keys|key:0}}
|
||||
{{#sql
|
||||
select="code"
|
||||
tables="acc_accounts"
|
||||
|
|
|
|||
|
|
@ -2,13 +2,9 @@
|
|||
|
||||
{{*
|
||||
déterminer le numéro du compte passé en paramètre dans un tableau
|
||||
la clé est parfois l'identifiant du compte, parfois son code...
|
||||
d'où l'obligation d'extraire le code de la valeur qui a toujours
|
||||
la forme : code — libellé
|
||||
*}}
|
||||
|
||||
{{:assign values=$account|values}}
|
||||
{{:assign label=$values.0}}
|
||||
{{:assign label=$account|values|key:0}}
|
||||
{{:assign pos=$label|strpos:" "}}
|
||||
{{:assign account_code=$label|substr:0:$pos}}
|
||||
{{:assign var="account_code.%s"|args:$account_code value=$label}}
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Récupérer la config
|
||||
*}}
|
||||
|
||||
{{* config par défaut *}}
|
||||
{{:read file="./defaut.json" assign="config_defaut"}}
|
||||
{{:assign config_defaut=$config_defaut|json_decode}}
|
||||
|
||||
{{if $module.config.prefixes == null}}
|
||||
{{:assign var="module.config.prefixes" value=$config_defaut.prefixes}}
|
||||
{{/if}}
|
||||
|
||||
{{if $module.config.unfinished == null}}
|
||||
{{:assign var="module.config.unfinished" value=$config_defaut.unfinished}}
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
{{if $module.config.tva == null}}
|
||||
{{:assign var="module.config.tva" value=$config_defaut.tva}}
|
||||
{{/if}}
|
||||
*}}
|
||||
|
|
@ -3,52 +3,40 @@
|
|||
{{* Liste des immobilisations en cours ou amorties *}}
|
||||
|
||||
<section class="immobilisation">
|
||||
|
||||
<p class="help">
|
||||
{{if $type_immo == "managed"}}
|
||||
Cette page liste les immobilisations en cours d'amortissement
|
||||
{{elseif $type_immo == "amortized"}}
|
||||
Cette page liste les immobilisations dont l'amortissement est terminé
|
||||
{{/if}}
|
||||
</p>
|
||||
{{if $type_immo == "encours"}}
|
||||
<h2 class="ruler">Immobilisations en cours</h2>
|
||||
{{elseif $type_immo == "amortie"}}
|
||||
<h2 class="ruler">Immobilisations amorties</h2>
|
||||
{{/if}}
|
||||
{{:assign nb_immo=0}}
|
||||
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="num">N°</th>
|
||||
<th>N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th class="nombre">Durée</th>
|
||||
<th class="nombre">Amortissements</th>
|
||||
<th class="nombre">Valeur nette</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{* lister les immobilisations *}}
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||
|
||||
{{: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)"}}
|
||||
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
|
||||
|
||||
{{:assign nb_immo=0}}
|
||||
{{:assign total_immo = 0}}
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
trans.label as trans_label,
|
||||
|
|
@ -143,37 +131,33 @@
|
|||
{{/if}}
|
||||
{{/select}}
|
||||
|
||||
{{* classement par onglet *}}
|
||||
{{if $type_immo == "managed" && $amort_amount >= $debit}}{{:continue}}{{/if}}
|
||||
{{if $type_immo == "managed" && $status == "amortized"}}{{:continue}}{{/if}}
|
||||
{{if $status == "unknown" && ! $exist_amort}}{{:continue}}{{/if}}
|
||||
{{if $type_immo == "amortized" && $amort_amount < $debit && $status != "amortized"}}{{:continue}}{{/if}}
|
||||
|
||||
{{* classement par onglet *}}
|
||||
{{if $type_immo == "encours" && $amort_amount >= $debit}}{{:continue}}{{/if}}
|
||||
{{if $type_immo == "encours" && $status == "amortized"}}{{:continue}}{{/if}}
|
||||
{{if $status == "unknown" && ! $exist_amort}}{{:continue}}{{/if}}
|
||||
{{if $type_immo == "amortie" && $amort_amount < $debit && $status != "amortized"}}{{:continue}}{{/if}}
|
||||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
|
||||
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
|
||||
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
|
||||
<tr>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||
<td>{{$trans_date|date_short}}</td>
|
||||
<td>{{$trans_label}}</td>
|
||||
<td class="money">{{$debit|money_html:false|raw}}</td>
|
||||
<td class="money">{{"%f"|math:$debit|money}}</td>
|
||||
<td class="money">{{if $duration != null}}{{$duration}}{{/if}}</td>
|
||||
<td class="money">{{$amort_amount|money_html:false|raw}}</td>
|
||||
<td class="money">{{"%d-%d"|math:$debit:$amort_amount|money_html:false|raw}}</td>
|
||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td class="actions">
|
||||
{{if ! $exist_amort}}
|
||||
{{:linkbutton
|
||||
label="Paramètres"
|
||||
href="add_infos.html?immo_id=%s&type_immo=%s"|args:$immo_id:$type_immo
|
||||
href="add_infos.html?immo_id=%s&amort=1&op=modif&type_immo=%s"|args:$immo_id:$type_immo
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{elseif $status == "unknown"}}
|
||||
{{:linkbutton
|
||||
label="Paramètres"
|
||||
href="add_infos.html?immo_id=%s&type_immo=%s"|args:$immo_id:$type_immo
|
||||
href="add_infos.html?immo_id=%s&amort=1&op=new&type_immo=%s"|args:$immo_id:$type_immo
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
|
|
@ -187,34 +171,6 @@
|
|||
</tr>
|
||||
{{/select}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
{{if $total_immo != 0}}
|
||||
{{#foreach from=$sommes_immo|ksort key="code" item="value"}}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Total du compte {{$code}}</td>
|
||||
<td class="money">{{$value|money_html:false|raw}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="strong">Total des immobilisations</td>
|
||||
<td class="money strong">{{$total_immo|money_html|raw}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</tfoot>
|
||||
</table>
|
||||
{{if $nb_immo == 0}}
|
||||
<p class="block alert">Aucune immobilisation</p>
|
||||
|
|
|
|||
|
|
@ -3,20 +3,17 @@
|
|||
{{* Liste des immobilisations non amortissables ou non (encore) gérées *}}
|
||||
|
||||
<section class="immobilisation">
|
||||
<h2 class="ruler">Autres immobilisations</h2>
|
||||
{{:assign nb_immo=0}}
|
||||
|
||||
<p class="help">
|
||||
Cette page liste les écritures pas (encore) prises en charges par le module ou classées non amortissables
|
||||
</p>
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
{{:input type="checkbox" value=1 name="unhide" label="Afficher les écritures marquées ignorées" }}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<form method="post" action="confirm_action.html?target=_dialog" target="_dialog">
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="check">
|
||||
<input type="checkbox" title="Tout cocher / décocher" id="f_all" />
|
||||
<label for="f_all" title="Tout cocher / décocher"></label>
|
||||
</td>
|
||||
<th>N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
|
|
@ -29,25 +26,17 @@
|
|||
<tbody>
|
||||
|
||||
{{* lister les immobilisations *}}
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||
|
||||
{{: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)"}}
|
||||
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
|
||||
|
||||
{{:assign nb_immo=0}}
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
trans.label as trans_label,
|
||||
|
|
@ -75,14 +64,8 @@
|
|||
{{else}}
|
||||
{{:assign status="unknown"}}
|
||||
{{/load}}
|
||||
{{if $_POST.unhide == null}}
|
||||
{{if $status != "unknown"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{if $status != "ignored" && $status != "unknown"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
{{if $status != "unknown"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{* voir s'il existe des écritures d'amortissement associées *}}
|
||||
|
|
@ -110,7 +93,7 @@
|
|||
account.code LIKE '28%';
|
||||
:line_id = $immo_id|intval
|
||||
}}
|
||||
{{if $amort_amount != null}}
|
||||
{{if $status == "unknown" && $amort_amount != null}}
|
||||
{{:assign ignore=true}}
|
||||
{{else}}
|
||||
{{:assign ignore=false}}
|
||||
|
|
@ -123,51 +106,67 @@
|
|||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
{{:input type="checkbox" name="check[%s]"|args:$immo_id value=$immo_id default=0}}
|
||||
<input type="hidden" name="label[{{$immo_id}}]" value="{{$trans_label}}">
|
||||
<input type="hidden" name="trans[{{$immo_id}}]" value="{{$trans_id}}">
|
||||
</td>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||
<td>{{$trans_date|date_short}}</td>
|
||||
<td>{{$trans_label}}</td>
|
||||
<td class="money">{{"%f"|math:$debit|money_html:false|raw}}</td>
|
||||
<td class="money">{{"%f"|math:$debit|money:false}}</td>
|
||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td class="actions">
|
||||
{{if $status == "unknown"}}
|
||||
{{:linkbutton
|
||||
label="Paramètres"
|
||||
href="add_infos.html?immo_id=%s&type_immo=other"|args:$immo_id
|
||||
href="add_infos.html?immo_id=%s&amort=0&op=new&type_immo=autre"|args:$immo_id
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{else}}
|
||||
{{:linkbutton
|
||||
label="Paramètres"
|
||||
href="add_infos.html?immo_id=%s&type_immo=other"|args:$immo_id
|
||||
href="add_infos.html?immo_id=%s&amort=0&op=modif&type_immo=autre"|args:$immo_id
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Amortissements"
|
||||
href="amortization.html?immo_id=%s&type_immo=other"|args:$immo_id
|
||||
href="amortization.html?immo_id=%s&type_immo=autre"|args:$immo_id
|
||||
shape="table"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/select}}
|
||||
</tbody>
|
||||
|
||||
{{:assign var="actions.amortize" value="Marquer l'immobilisation amortie"}}
|
||||
{{:assign var="actions.ignore" value="Ignorer l'écriture"}}
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="check"><input type="checkbox" value="Tout cocher / décocher" id="f_all2" />
|
||||
<label for="f_all2"></label>
|
||||
</td>
|
||||
<td class="actions" colspan="10">
|
||||
<em>Pour les écritures cochées :</em>
|
||||
{{*
|
||||
<input type="hidden" name="from" value="{$self_url}" />
|
||||
<input type="hidden" name="year" value="{$year.id}" />
|
||||
{csrf_field key="projects_action"}
|
||||
*}}
|
||||
|
||||
{{:input type="select" name="actions" options=$actions default_empty="— Choisir une action à effectuer —"}}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
{{if $nb_immo == 0}}
|
||||
<p class="block alert">Aucune immobilisation</p>
|
||||
{{/if}}
|
||||
</section>
|
||||
|
||||
<script type="text/javascript">
|
||||
function changeVisibility(evt, idcheck = 'f_unhide_1') {
|
||||
this.form.dispatchEvent(new Event('submit'));
|
||||
this.form.submit();
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_unhide_1').onclick = changeVisibility;
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
|
|
|||
37
_nav.html
37
_nav.html
|
|
@ -1,43 +1,36 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
<nav class="tabs">
|
||||
{{if $current == "index" && $subsubcurrent == null}}
|
||||
{{if $current == 'index' && $subsubcurrent == null}}
|
||||
<aside>
|
||||
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html" target="_dialog"}}
|
||||
</aside>
|
||||
{{elseif $subsubcurrent == "amortization" && $type_immo == null || $type_immo == "managed" || $type_immo == "other"}}
|
||||
{{elseif $subsubcurrent == "amortization" && $type_immo == null || $type_immo == "encours" || $type_immo == "autre"}}
|
||||
<aside>
|
||||
{{if $autres_amort != null}}
|
||||
{{:linkbutton label="Rattacher une écriture" href="other_amortizations.html?immo_id=%s"|args:$_GET.immo_id shape="link" target="_dialog"}}
|
||||
{{:linkbutton label="Attacher un amortissement" href="other_amortizations.html?immo_id=%s"|args:$_GET.immo_id shape="plus" target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton label="Enregistrer un amortissement" shape="plus"
|
||||
href="save_amort.html?immo_id=%s"|args:$_GET.immo_id target="_dialog"}}
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
<ul>
|
||||
<li {{if $subcurrent == "managed"}}class="current"{{/if}}><a href="index.html?type_immo=managed">Amortissables</a></li>
|
||||
<li {{if $subcurrent == "amortized"}}class="current"{{/if}}><a href="index.html?type_immo=amortized">Amorties</a></li>
|
||||
<li {{if $subcurrent == "archived"}}class="current"{{/if}}><a href="index.html?type_immo=archived">Sorties du bilan</a></li>
|
||||
<li {{if $subcurrent == "unfinished"}}class="current"{{/if}}><a href="index.html?type_immo=unfinished">En cours</a></li>
|
||||
<li {{if $subcurrent == "other"}}class="current"{{/if}}><a href="index.html?type_immo=other">Autres</a></li>
|
||||
<li {{if $current == "config"}} class="current"{{/if}}><a href="config.html">Configuration</a></li>
|
||||
</ul>
|
||||
|
||||
{{if $subsubcurrent == "amortization"}}
|
||||
<ul class="sub">
|
||||
<li class="title strong">Amortissements</li>
|
||||
</ul>
|
||||
{{elseif $subsubcurrent == "balance_exit"}}
|
||||
<ul class="sub">
|
||||
<li class="title strong">Sortie de bilan</li>
|
||||
{{if $current == 'index'}} {{* && $subsubcurrent != 'balance_exit' *}}
|
||||
<ul>
|
||||
<li {{if $subcurrent == 'encours'}}class="current"{{/if}}><a href="index.html?type_immo=encours">En cours</a></li>
|
||||
<li {{if $subcurrent == 'amortie'}}class="current"{{/if}}><a href="index.html?type_immo=amortie">Amorties</a></li>
|
||||
<li {{if $subcurrent == 'sortie'}}class="current"{{/if}}><a href="index.html?type_immo=sortie">Sorties du bilan</a></li>
|
||||
<li {{if $subcurrent == 'autre'}}class="current"{{/if}}><a href="index.html?type_immo=autre">Autres</a></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
||||
{{if $current == "config"}}
|
||||
{{if $subsubcurrent == 'amortization'}}
|
||||
<ul class="sub">
|
||||
<li {{if $subcurrent == null}} class="current"{{/if}}><a href="config.html">Comptes d'immobilisation</a></li>
|
||||
<li {{if $subcurrent == "filters"}} class="current"{{/if}}><a href="filters.html">Filtres de libellés</a></li>
|
||||
<li class="title"><strong>Amortissements</strong></li>
|
||||
</ul>
|
||||
{{elseif $subsubcurrent == 'balance_exit'}}
|
||||
<ul class="sub">
|
||||
<li class="title"><strong>Sortie de bilan</strong></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
</nav>
|
||||
|
|
|
|||
203
_unfinished.html
203
_unfinished.html
|
|
@ -1,203 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{* Liste des immobilisations en cours de constitution *}}
|
||||
|
||||
<section class="immobilisation">
|
||||
|
||||
<p class="help">
|
||||
Cette page liste les immobilisations en cours de constitution, donc non amortissables
|
||||
</p>
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset class="shortFormLeft">
|
||||
<legend>Transférer une ou plusieurs lignes vers une immobilisation amortissable</legend>
|
||||
<p class="help">
|
||||
Cocher les lignes concernées ; les montants seront additionnés par numéro de compte
|
||||
</p>
|
||||
<div class="shortFormRight informations" id="total_amount">
|
||||
<legend>Montants sélectionnés</legend>
|
||||
<table class="montant">
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<p class="submit">
|
||||
{{:linkbutton
|
||||
label="Transférer"
|
||||
href="transfer.html?trans="
|
||||
shape="right"
|
||||
id="transfer"
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
{{:input type="checkbox" value=1 name="unhide" label="Afficher les écritures marquées ignorées" }}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="check"></th>
|
||||
<th class="num">N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{* lister les immobilisations en cours de constitution *}}
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
|
||||
{{:assign accounts_condition="("}}
|
||||
{{#foreach from=$module.config.unfinished item="elem"}}
|
||||
{{:assign code=$elem.code|cat:"%"|quote_sql}}
|
||||
{{:assign accounts_condition=$accounts_condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign accounts_condition=$accounts_condition|cat:"0)"}}
|
||||
{{:assign condition=$accounts_condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||
|
||||
{{: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)"}}
|
||||
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
|
||||
|
||||
{{:assign nb_immo=0}}
|
||||
{{:assign total_immo = 0}}
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
trans.label as trans_label,
|
||||
trans.date as trans_date,
|
||||
line.id as immo_id,
|
||||
account.id as account_id,
|
||||
account.code as account_code,
|
||||
account.label as account_label,
|
||||
sum(line.debit) AS debit,
|
||||
trans.id_year as trans_id_year
|
||||
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
|
||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||
WHERE !condition
|
||||
GROUP BY trans.id
|
||||
ORDER BY trans.date DESC;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{* voir si l'écriture a été marquée ignorée *}}
|
||||
{{:assign ignore=false}}
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id AND $$.status = 'ignored'" :line_id=$immo_id|intval}}
|
||||
{{:assign ignore=true}}
|
||||
{{/load}}
|
||||
{{if $ignore && $_POST.unhide == null}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{* voir s'il existe une écriture qui solde l'immobilisation *}}
|
||||
{{#select
|
||||
count(*) AS count
|
||||
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
|
||||
WHERE line.credit = :amount AND code = :account_code
|
||||
;
|
||||
:amount = $debit
|
||||
:account_code = $account_code
|
||||
}}
|
||||
{{:assign count=$count}}
|
||||
{{/select}}
|
||||
|
||||
{{* S'il y a plus d'une écriture de même montant on ne peut pas décider *}}
|
||||
{{if $count == 1}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
|
||||
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
|
||||
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
|
||||
|
||||
<tr>
|
||||
<td class="check">{{:input type="checkbox" name="selected[]" value=$trans_id}}</td>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||
<td>{{$trans_date|date_short}}</td>
|
||||
<td>{{$trans_label}}</td>
|
||||
<td class="money">{{"%f"|math:$debit|money_html:false|raw}}</td>
|
||||
<td class="account_code"><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td class="actions">
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="ignore.html?immo_id=%s"|args:$immo_id
|
||||
shape="edit"
|
||||
target="_dialog"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/select}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
{{if $total_immo != 0}}
|
||||
{{#foreach from=$sommes_immo|ksort key="code" item="value"}}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Total du compte {{$code}}</td>
|
||||
<td class="money">{{$value|money_html|raw}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="strong">Total des immobilisations</td>
|
||||
<td class="money strong">{{$total_immo|money_html|raw}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</tfoot>
|
||||
</table>
|
||||
{{if $nb_immo == 0}}
|
||||
<p class="block alert">Aucune immobilisation</p>
|
||||
{{/if}}
|
||||
</section>
|
||||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript" async="async">
|
||||
|
||||
let lines = document.querySelectorAll('.list tbody tr');
|
||||
for (const line of lines) {
|
||||
let button = line.querySelector('input[type=checkbox]');
|
||||
button.onchange = () => {
|
||||
computeTotal('total_amount', 'transfer');
|
||||
};
|
||||
}
|
||||
|
||||
function changeVisibility(evt, idcheck = 'f_unhide_1') {
|
||||
this.form.dispatchEvent(new Event('submit'));
|
||||
this.form.submit();
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_unhide_1').onclick = changeVisibility;
|
||||
})();
|
||||
|
||||
</script>
|
||||
124
add_asset.html
124
add_asset.html
|
|
@ -1,6 +1,8 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
|
||||
{{#years closed=false order="start_date" assign=years.}}
|
||||
{{:assign ts_debut=$start_date|strtotime}}
|
||||
|
|
@ -12,8 +14,6 @@
|
|||
{{if $ts_debut <= $now && $now <= $ts_fin}}
|
||||
{{:assign selected_year=$id}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:error message="Aucun exercice ouvert"}}
|
||||
{{/years}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
|
|
@ -34,6 +34,23 @@
|
|||
{{:error message="La date saisie n'est pas dans l'exercice choisi !"}}
|
||||
{{/if}}
|
||||
|
||||
{{if ! $_POST.amortir}}
|
||||
{{* ne pas amortir *}}
|
||||
{{:assign duration=0}}
|
||||
{{:assign date_debut=$_POST.date_achat|parse_date}}
|
||||
{{:assign status="ignored"}}
|
||||
{{else}}
|
||||
{{* 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}}
|
||||
{{:assign dd=$date_debut|date_short}}
|
||||
{{:assign da=$_POST.date_achat|date_short}}
|
||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
||||
{{/if}}
|
||||
{{:assign duration=$_POST.duree|intval}}
|
||||
{{:assign status="managed"}}
|
||||
{{/if}}
|
||||
|
||||
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
|
||||
{{:include
|
||||
file="_get_codes.html"
|
||||
|
|
@ -53,13 +70,6 @@
|
|||
- est présent dans le PC de l'exercice correspondant à la date
|
||||
*}}
|
||||
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{:assign var="prefix_array." value=$code}}
|
||||
{{/foreach}}
|
||||
{{#foreach from=$module.config.unfinished item="code"}}
|
||||
{{:assign var="prefix_array." value=$code}}
|
||||
{{/foreach}}
|
||||
|
||||
{{:include
|
||||
file="_check_account.html"
|
||||
account=$debit_account
|
||||
|
|
@ -70,34 +80,7 @@
|
|||
|
||||
{{if $account_ok == null}}
|
||||
{{:assign compte=$debit_account|implode:""}}
|
||||
{{:redirect url="add_account.html?account=%s&chart=%s&immo_id=%s"|args:$compte:$selected_chart:$_GET.immo_id}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign debit_account=$debit_account|keys|value:0}}
|
||||
{{:assign credit_account=$credit_account|keys|value:0}}
|
||||
|
||||
{{* déterminer si le compte d'immo est un compte d'immo en cours *}}
|
||||
{{#foreach from=$module.config.unfinished item="code"}}
|
||||
{{if $debit_account|strpos:$code === 0}}
|
||||
{{:assign status="unfinished"}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{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}}
|
||||
{{:assign dd=$date_debut|date_short}}
|
||||
{{:assign da=$_POST.date_achat|date_short}}
|
||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
||||
{{/if}}
|
||||
{{:assign duration=$_POST.duree|intval}}
|
||||
{{:assign status="managed"}}
|
||||
{{:error message="Le compte « %s » n'est pas un compte d'immobilisation ou n'est pas dans le plan comptable de l'exercice choisi"|args:$compte}}
|
||||
{{/if}}
|
||||
|
||||
{{* enregistrer l'écriture *}}
|
||||
|
|
@ -110,41 +93,35 @@
|
|||
date=$_POST.date_achat
|
||||
label=$_POST.designation
|
||||
amount=$_POST.montant
|
||||
debit=$debit_account
|
||||
credit=$credit_account
|
||||
debit=$debit_account|keys|key:0
|
||||
credit=$credit_account|keys|key:0
|
||||
id_project=$_POST.id_project
|
||||
}}
|
||||
|
||||
{{if $status != "unfinished"}}
|
||||
{{* vérifier s'il y a déjà un document avec le même numéro de ligne *}}
|
||||
{{:assign var="immo_id" value=$result.lines.1.id}}
|
||||
{{#load where="$$.line = :line_id" :line_id=$immo_id}}
|
||||
{{:assign key=$key}}
|
||||
{{else}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{/load}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
duration=$duration
|
||||
date=$date_debut
|
||||
status=$status
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{if $status == "unfinished"}}
|
||||
{{:assign type_immo="unfinished"}}
|
||||
{{elseif $_POST.amortir}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{* vérifier s'il y a déjà un document avec le même numéro de ligne *}}
|
||||
{{:assign var="immo_id" value=$result.lines.1.id}}
|
||||
{{#load where="$$.line = :line_id" :line_id=$immo_id}}
|
||||
{{:assign key=$key}}
|
||||
{{else}}
|
||||
{{:assign type_immo="other"}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{/load}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
duration=$duration
|
||||
date=$date_debut
|
||||
status=$status
|
||||
}}
|
||||
{{if $_POST.amortir}}
|
||||
{{:assign type_immo="encours"}}
|
||||
{{else}}
|
||||
{{:assign type_immo="autre"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}}
|
||||
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
||||
|
|
@ -157,17 +134,16 @@
|
|||
|
||||
{{* formulaire d'ajout d'immobilisation *}}
|
||||
|
||||
{{:assign var="immo_account.2" value="2 — Classe 2 — Comptes d'immobilisations"}}
|
||||
|
||||
{{#select id,label FROM acc_projects WHERE archived = 0;}}
|
||||
{{:assign var="projects.%d"|args:$id value=$label}}
|
||||
{{/select}}
|
||||
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||
{{/foreach}}
|
||||
{{#foreach from=$module.config.unfinished item="code"}}
|
||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||
{{/foreach}}
|
||||
{{:assign var="patterns" value=$pattern_array|implode:"|"}}
|
||||
{{:assign patterns=$pattern_array|implode:"|"}}
|
||||
|
||||
<div id="erreur" class="hidden">
|
||||
<p class="block error">La date choisie n'est dans aucun exercice ouvert !</p>
|
||||
|
|
@ -179,7 +155,7 @@
|
|||
<dl>
|
||||
{{:input type="select" name="id_year" label="Exercice" default=$selected_year required=true default_empty="— Faire un choix —" options=$open_years}}
|
||||
{{:input type="date" name="date_achat" label="Date d'acquisition" required=true default=$now|date_short}}
|
||||
{{:input type="text" name="designation" label="Libellé" required=true}}
|
||||
{{:input type="text" name="designation" label="Désignation" required=true}}
|
||||
{{:input type="money" name="montant" label="Montant" required=true}}
|
||||
{{:input
|
||||
type="list"
|
||||
|
|
@ -206,7 +182,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"}}
|
||||
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur plusieurs années" checked="cheched" 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"}}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,19 @@
|
|||
|
||||
{{*
|
||||
@param immo_id
|
||||
@param type_immo : managed, amortized, archived, other
|
||||
@param amort = 1 si immo amortissable, 0 si non
|
||||
@param op = new ou modif
|
||||
@param type_immo : encours, amortie, sortie, autre
|
||||
*}}
|
||||
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||
{{/load}}
|
||||
{{if $_GET.op == "modif"}}
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
{{:debug post=$_POST}}
|
||||
{{if $_POST.classify == null}}
|
||||
{{:error message="Vous devez choisir une action"}}
|
||||
{{/if}}
|
||||
|
|
@ -51,11 +56,13 @@
|
|||
{{/if}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{if $info_immo == null}}
|
||||
{{if $_GET.op == "new"}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{else}}
|
||||
{{:assign key=$info_immo.key}}
|
||||
{{/if}}
|
||||
{{:debug duree=$duration date=$date_debut classif=$_POST.classify status=$status}}
|
||||
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="schema.json"
|
||||
|
|
@ -66,8 +73,10 @@
|
|||
status=$status
|
||||
}}
|
||||
|
||||
{{if $_POST.classify == "managed" || $_POST.classify == "amortized"}}
|
||||
{{:assign type_immo=$_POST.classify}}
|
||||
{{if $_POST.classify == "managed"}}
|
||||
{{:assign type_immo="encours"}}
|
||||
{{elseif $_POST.classify == "amortized"}}
|
||||
{{:assign type_immo="amortie"}}
|
||||
{{else}}
|
||||
{{:assign type_immo=$_GET.type_immo}}
|
||||
{{/if}}
|
||||
|
|
@ -76,43 +85,31 @@
|
|||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Informations amortissement" custom_css=$custom_css current="module_amortissement"}}
|
||||
{{:admin_header title="Renseigner informations amortissement" custom_css=$custom_css current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
{{/if}}
|
||||
|
||||
{{if $info_immo == null}}
|
||||
{{:assign default=$_GET.type_immo}}
|
||||
{{else}}
|
||||
{{:assign default=$info_immo.status}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_GET.type_immo == "managed" || $_GET.type_immo == "amortized"}}
|
||||
{{:assign disabled=0}}
|
||||
{{else}}
|
||||
{{* renseigner ou modifier la date de mise en service et la durée d'amortissement *}}
|
||||
{{if $_GET.amort == 0}}
|
||||
{{:assign disabled=1}}
|
||||
{{:assign default=""}}
|
||||
{{else}}
|
||||
{{:assign disabled=0}}
|
||||
{{:assign default="managed"}}
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
- classer l'immobilisation
|
||||
- renseigner ou modifier la date de mise en service et la durée d'amortissement
|
||||
*}}
|
||||
<form method="post" action="">
|
||||
<fieldset id="classement_immo">
|
||||
<legend>Classement</legend>
|
||||
<fieldset id="infos_immo">
|
||||
<legend></legend>
|
||||
<dl>
|
||||
<dt><label>Faites un choix</label> <b>(obligatoire)</b></dt>
|
||||
{{:input type="radio-btn" name="classify" value="managed" label="Amortir" default=$default}}
|
||||
{{:input type="radio-btn" name="classify" value="amortized" label="Amortissement terminé" help="Cette immobilisation sera classée parmi les immobilisations amorties" default=$default}}
|
||||
{{:input type="radio-btn" name="classify" value="ignored" label="Ignorer l'écriture" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" default=$default}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
{{:input type="radio" name="classify" value="managed" label="Amortir" help="Amortir cette immobilisation" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}}
|
||||
{{:input type="radio" name="classify" value="amortized" label="Marquer amortie" help="Cette immobilisation sera classée parmi les immobilisations amorties" onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}}
|
||||
{{:input type="radio" name="classify" value="ignored" label="Ignorer l'écriture" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}}
|
||||
|
||||
<fieldset id="infos_immo">
|
||||
<legend>Informations</legend>
|
||||
<dl>
|
||||
{{if $info_immo != null}}
|
||||
{{:assign date_defaut=$info_immo.date}}
|
||||
{{:assign duree_defaut=$info_immo.duration}}
|
||||
|
|
@ -132,12 +129,11 @@
|
|||
|
||||
</form>
|
||||
|
||||
{{:admin_footer}}
|
||||
|
||||
{{* activer/désactiver les champs de saisie *}}
|
||||
<script type="text/javascript">
|
||||
function toggleInputFields(idiv, idrb1) {
|
||||
function toggleInputs(idiv, idrb1, idrb2) {
|
||||
const rb1 = document.getElementById(idrb1);
|
||||
const rb2 = document.getElementById(idrb2);
|
||||
const fs = document.getElementById(idiv);
|
||||
for (let field of fs.querySelectorAll("input")) {
|
||||
if (! rb1.checked) {
|
||||
|
|
@ -148,16 +144,6 @@ function toggleInputFields(idiv, idrb1) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleInputs(event) {
|
||||
toggleInputFields('div_inputs', 'f_classify_managed');
|
||||
}
|
||||
|
||||
(function () {
|
||||
const radios = document.querySelectorAll('input[name="classify"]');
|
||||
radios.forEach(radio => {
|
||||
radio.addEventListener("change", toggleInputs);
|
||||
});
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
{{:admin_footer}}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{{*
|
||||
Lister les écritures d'amortissement associées à une immobilisation
|
||||
@param immo_id : id de la ligne d'immo
|
||||
@param type_immo : managed, amortized, archived, others
|
||||
@param type_immo : encours, amortie, sortie, autres
|
||||
*}}
|
||||
|
||||
{{* récupérer les infos de l'immobilisation *}}
|
||||
|
|
@ -79,14 +79,6 @@
|
|||
{{/if}}
|
||||
|
||||
{{* Autres amortissements non rattachés *}}
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
{{: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)"}}
|
||||
|
||||
{{#select
|
||||
line.id as l_id,
|
||||
line.id_transaction as t_id,
|
||||
|
|
@ -102,9 +94,8 @@
|
|||
INNER JOIN acc_accounts AS account ON account.id = line.id_account
|
||||
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
|
||||
INNER JOIN acc_years AS y ON y.id = trans.id_year
|
||||
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) AND !filter_condition
|
||||
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16)
|
||||
ORDER BY trans.date, trans.label;
|
||||
!filter_condition=$filter_condition
|
||||
assign=autre_amort
|
||||
}}
|
||||
{{#select
|
||||
|
|
@ -123,14 +114,14 @@
|
|||
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if $_GET.type_immo == "amortized" || $valeur_residuelle== 0 }}
|
||||
{{:assign subcurrent="amortized"}}
|
||||
{{elseif $_GET.type_immo == "archived"}}
|
||||
{{:assign subcurrent="archived"}}
|
||||
{{elseif $_GET.type_immo == null || $_GET.type_immo == "managed"}}
|
||||
{{:assign subcurrent="managed"}}
|
||||
{{if $_GET.type_immo == "amortie" || $valeur_residuelle== 0 }}
|
||||
{{:assign subcurrent="amortie"}}
|
||||
{{elseif $_GET.type_immo == "sortie"}}
|
||||
{{:assign subcurrent="sortie"}}
|
||||
{{elseif $_GET.type_immo == null || $_GET.type_immo == "encours"}}
|
||||
{{:assign subcurrent="encours"}}
|
||||
{{else}}
|
||||
{{:assign subcurrent="other"}}
|
||||
{{:assign subcurrent="autre"}}
|
||||
{{/if}}
|
||||
|
||||
{{:include
|
||||
|
|
@ -179,30 +170,28 @@
|
|||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href={{$trans_url}}>#{{$ligne_immo.trans_id}}</a></span> {{$ligne_immo.label}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||
<dt>Début d'amortissement</dt>
|
||||
<dd>{{$date_debut|date_short}}</dd>
|
||||
{{if $duree != null}}
|
||||
<dt>Durée</dt>
|
||||
<dd>{{$duree}} ans</dd>
|
||||
{{/if}}
|
||||
{{if $valeur_residuelle > 0}}
|
||||
<dt>Montant des amortissements</dt>
|
||||
<dd>{{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
||||
<dt>Valeur nette comptable</dt>
|
||||
<dd>{{$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
||||
{{/if}}
|
||||
{{if $duree != null && $valeur_residuelle > 0}}
|
||||
<dt>Annuité estimée</dt>
|
||||
<dd>{{"%f/%d"|math:$ligne_immo.montant:$duree|money_currency_html:false|raw}}</dd>
|
||||
{{/if}}
|
||||
</dl>
|
||||
</div>
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href={{$trans_url}}>#{{$ligne_immo.trans_id}}</a></span> {{$ligne_immo.label}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd><strong class="money">{{"%f"|math:$ligne_immo.montant|money_currency}}</strong></dd>
|
||||
<dt>Début d'amortissement</dt>
|
||||
<dd>{{$date_debut|date_short}}</dd>
|
||||
{{if $duree != null}}
|
||||
<dt>Durée</dt>
|
||||
<dd>{{$duree}} ans</dd>
|
||||
{{/if}}
|
||||
{{if $valeur_residuelle > 0}}
|
||||
<dt>Montant déjà amorti</dt>
|
||||
<dd>{{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency:false}}</dd>
|
||||
<dt>Valeur résiduelle</dt>
|
||||
<dd>{{$valeur_residuelle|money_currency}}</dd>
|
||||
{{/if}}
|
||||
{{if $duree != null && $valeur_residuelle > 0}}
|
||||
<dt>Annuité estimée</dt>
|
||||
<dd>{{"%f/%d"|math:$ligne_immo.montant:$duree|money_currency}}</dd>
|
||||
{{/if}}
|
||||
</dl>
|
||||
|
||||
<h3 class="center-block ruler">Amortissements enregistrés</h3>
|
||||
{{if $linked_lines != null}}
|
||||
|
|
@ -229,8 +218,8 @@
|
|||
<tr>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$line.amort_trans_id}}</a></td>
|
||||
<td>{{$line.amort_date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amort_amount|money_html:false|raw}}</td>
|
||||
<td class="money">{{"%f"|math:$solde|money_html:false|raw}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
||||
<td class="money">{{"%f"|math:$solde|money:false}}</td>
|
||||
<td>
|
||||
{{if $line.amort_label == null}}
|
||||
{{$line.trans_label}}
|
||||
|
|
@ -252,14 +241,14 @@
|
|||
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation</p>
|
||||
{{/if}}
|
||||
|
||||
{{if $_GET.type_immo == null || $_GET.type_immo != "amortized"}}
|
||||
{{if $_GET.type_immo == null || $_GET.type_immo != "amortie"}}
|
||||
|
||||
{{* Autres amortissements non rattachés *}}
|
||||
|
||||
{{if $autres_amortissements != null}}
|
||||
<p class="block alert">
|
||||
Il existe des écritures d'amortissement qui ne sont pas rattachés à une immobilisation ! <br />
|
||||
Utilisez le bouton « Rattacher une écriture » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||
Utilisez le bouton « Attacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||
</p>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,18 @@
|
|||
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$amort_amount}}
|
||||
|
||||
{{*
|
||||
lister les exercices ouverts dont la date de fin est postérieure à la date du dernier amortissment
|
||||
lister les exercices ouverts :
|
||||
- dont la date de fin est postérieure à la date du dernier amortissment
|
||||
- dont la date de début est antérieure ou égale à la date du jour
|
||||
*}}
|
||||
{{:assign default_exit_date=""}}
|
||||
{{#years closed=false order="start_date" where=":debut <= end_date" :debut=$date_debut}}
|
||||
{{if $start_date|strtotime <= $now && $now <= $end_date|strtotime}}
|
||||
{{:assign default_exit_date=$now|date_short}}
|
||||
{{/if}}
|
||||
{{if $start_date|strtotime > $now}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{:assign var="years." id=$id label=$label start_date=$start_date end_date=$end_date}}
|
||||
{{:assign debut=$start_date|date_short}}
|
||||
{{:assign fin=$end_date|date_short}}
|
||||
|
|
@ -185,7 +190,7 @@
|
|||
<legend>Données de l'imobilisation</legend>
|
||||
<dl class="describe">
|
||||
<dt>Montant</dt>
|
||||
<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||
<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency:false}}</dd>
|
||||
<dt>Date d'acquisition</dt>
|
||||
<dd >{{$ligne_immo.date_achat|date_short}}</dd>
|
||||
{{if $info_immo.date != null && $info_immo.date != $ligne_immo.date_achat}}
|
||||
|
|
@ -197,9 +202,9 @@
|
|||
<dd id="duree_amort" class="num">{{$info_immo.duration}} ans</dd>
|
||||
{{/if}}
|
||||
<dt>Montant des amortissements</dt>
|
||||
<dd id="montant_amort" class="money">{{$amort_amount|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dd id="montant_amort" class="money">{{$amort_amount|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{$valeur_nette|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
</dl>
|
||||
</div>
|
||||
{{if $valeur_nette > 0}}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
<legend>Données de l'imobilisation</legend>
|
||||
<dl class="describe">
|
||||
<dt>Montant</dt>
|
||||
<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||
<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency:false}}</dd>
|
||||
<dt>Date d'acquisition</dt>
|
||||
<dd >{{$ligne_immo.date_achat|date_short}}</dd>
|
||||
{{if $_GET.date_mes != $ligne_immo.date_achat|strtotime}}
|
||||
|
|
@ -74,18 +74,18 @@
|
|||
<dd id="duree_amort" class="num">{{$_GET.duree_amort}} ans</dd>
|
||||
{{/if}}
|
||||
<dt>Montant des amortissements</dt>
|
||||
<dd id="montant_amort" class="money">{{$_GET.amort_amount|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dd id="montant_amort" class="money">{{$_GET.amort_amount|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{$valeur_nette|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Date de sortie</dt>
|
||||
<dd>{{$_GET.exit_date|date:"d/m/Y"}}</dd>
|
||||
{{if $amort_comp > 0}}
|
||||
<dt>Amortissement complémentaire</dt>
|
||||
<dd class="money">{{$amort_comp|money_currency_html:false|raw}} <span class="help">(jusqu'à la date de sortie)</span></dd>
|
||||
<dd class="money">{{$amort_comp|money_currency:false}} <span class="help">(jusqu'à la date de sortie)</span></dd>
|
||||
<dt>Total des amortissements</dt>
|
||||
<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency:false}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{"%f-%f"|math:$valeur_nette:$amort_comp|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dd class="money">{{"%f-%f"|math:$valeur_nette:$amort_comp|money_currency:false}} <span class="help">(à la date de sortie)</span></dd>
|
||||
{{/if}}
|
||||
</dl>
|
||||
</div>
|
||||
|
|
|
|||
241
config.html
241
config.html
|
|
@ -1,241 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{if $_GET.ok == 1}}
|
||||
<p class="block confirm">Configuration enregistrée.</p>
|
||||
{{/if}}
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="./_get_config.html" keep="module.config, config_defaut"}}
|
||||
|
||||
{{#form on="save"}}
|
||||
{{:assign ok=0}}
|
||||
{{#foreach from=$_POST.immo_accounts item="line"}}
|
||||
{{:assign elem=$line|values}}
|
||||
{{:assign elem=$elem.0}}
|
||||
{{:assign var="fields" value=$elem|explode:" — "}}
|
||||
{{if $fields.0|strpos:$config_defaut.unfinished.0.code === 0}}
|
||||
{{:error message="Le compte « %s » n'est pas un compte d'immobilisation amortissable"|args:$fields.0}}
|
||||
{{/if}}
|
||||
{{:assign var="account_codes." value=$fields.0}}
|
||||
{{/foreach}}
|
||||
|
||||
{{#foreach from=$_POST.unfinished_accounts item="line"}}
|
||||
{{:assign elem=$line|values}}
|
||||
{{:assign elem=$elem.0}}
|
||||
{{:assign var="fields" value=$elem|explode:" — "}}
|
||||
{{:assign var="unfinished_codes." value=$fields.0}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* vérifier qu'il n'y a pas d'intersection entre les deux listes de codes *}}
|
||||
{{#foreach from=$account_codes item="i_code"}}
|
||||
{{#foreach from=$unfinished_codes item="u_code"}}
|
||||
{{if $i_code|strpos:$u_code === 0}}
|
||||
{{:error message="Le compte d'immobilisation amortissable « %s » est incompatible avec le compte d'immobilisation en cours « %s »"|args:$i_code:$u_code}}
|
||||
{{/if}}
|
||||
{{if $u_code|strpos:$i_code === 0}}
|
||||
{{:error message="Le compte d'immobilisation amortissable « %s » est incompatible avec le compte d'immobilisation en cours « %s »"|args:$i_code:$u_code}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
{{:save
|
||||
key="config"
|
||||
prefixes=$account_codes|sort
|
||||
unfinished=$unfinished_codes|sort
|
||||
}}
|
||||
{{:assign ok=1}}
|
||||
{{:redirect to="./config.html?ok=%d"|args:$ok}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortissement"}}
|
||||
{{:include file="_nav.html" current="config"}}
|
||||
|
||||
{{* récupérer l'exercice courant ou sinon le plus récent *}}
|
||||
{{:assign var="selected_year" from="logged_user.preferences.accounting_year"}}
|
||||
{{if $selected_year == null}}
|
||||
{{* sélectionner l'exercice le plus probable *}}
|
||||
{{#years}}
|
||||
{{if $start_date|strtotime <= $now && $end_date|strtotime >= $now}}
|
||||
{{:assign selected_year=$id}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{:assign last_year=$id}}
|
||||
{{/years}}
|
||||
{{/if}}
|
||||
|
||||
{{if $selected_year == null}}
|
||||
{{if $last_year == null}}
|
||||
<p class="block alert">Aucun exercice</p>
|
||||
{{else}}
|
||||
{{:assign selected_year=$last_year}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $selected_year != null}}
|
||||
|
||||
{{* libellés des comptes d'immobilisation amortissables *}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{:assign code=$code|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" account.code = "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
{{:assign condition=$condition|cat:" AND year.id = %s"|args:$selected_year}}
|
||||
|
||||
{{#select
|
||||
account.id as account_id,
|
||||
account.code,
|
||||
account.label
|
||||
FROM acc_accounts AS account
|
||||
INNER JOIN acc_charts AS chart ON chart.id = account.id_chart
|
||||
INNER JOIN acc_years AS year ON year.id_chart = chart.id
|
||||
WHERE !condition
|
||||
;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{:assign var="immo_accounts.%s"|args:$code label=$label}}
|
||||
{{/select}}
|
||||
|
||||
{{* libellés des comptes d'immobilisation en cours de constitution *}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$module.config.unfinished item="elem"}}
|
||||
{{:assign code=$elem.code|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" account.code = "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
{{:assign condition=$condition|cat:" AND year.id = %s"|args:$selected_year}}
|
||||
|
||||
{{#select
|
||||
account.id as account_id,
|
||||
account.code,
|
||||
account.label
|
||||
FROM acc_accounts AS account
|
||||
INNER JOIN acc_charts AS chart ON chart.id = account.id_chart
|
||||
INNER JOIN acc_years AS year ON year.id_chart = chart.id
|
||||
WHERE !condition
|
||||
;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{:assign var="unfinished_accounts.%s"|args:$code label=$label}}
|
||||
{{/select}}
|
||||
{{if $unfinished_accounts|count == 0}}
|
||||
{{:assign var="unfinished_accounts.%s"|args:$config_defaut.unfinished.0.code label=$config_defaut.unfinished.0.label}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<h3>Comptes d'immobilisation amortissables</h3>
|
||||
<p class="help">
|
||||
Les immobilisations amortissables sont cherchées dans les comptes sélectionnés et leurs sous-comptes.
|
||||
</p>
|
||||
|
||||
<table class="list transaction-lines" id="asset_prefixes">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Compte</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$immo_accounts key=code item=elem}}
|
||||
<tr>
|
||||
<td>
|
||||
{{:assign var="immo_account.%s.%s"|args:$code:$code value="%s — "|args:$code|cat:$elem.label}}
|
||||
{{:assign var="current_account" from="immo_account.%s"|args:$code}}
|
||||
{{:input
|
||||
type="list"
|
||||
name="immo_accounts[]"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s*&id_year=%d"|args:$code:$selected_year
|
||||
default=$current_account
|
||||
}}
|
||||
</td>
|
||||
<td class="actions">
|
||||
{{:button
|
||||
label="Enlever"
|
||||
title="Enlever une ligne"
|
||||
shape="minus"
|
||||
min="1"
|
||||
name="remove_line"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="actions">{{:button shape="plus" label="Ajouter" title="Ajouter un compte"}}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<h3>Comptes d'immobilisation en cours de constitution</h3>
|
||||
<p class="help">
|
||||
Ces immobilisations ne sont pas amortissables ; elles sont cherchées dans les comptes sélectionnés et leurs sous-comptes.
|
||||
</p>
|
||||
|
||||
<table class="list transaction-lines" id="unfinished_accounts">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Compte</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{#foreach from=$unfinished_accounts key=code item=elem}}
|
||||
<tr>
|
||||
<td>
|
||||
{{:assign var="unfinished_account.%s.%s"|args:$code:$code value="%s — "|args:$code|cat:$elem.label}}
|
||||
{{:assign var="current_account" from="unfinished_account.%s"|args:$code}}
|
||||
{{:input
|
||||
type="list"
|
||||
name="unfinished_accounts[]"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s*&id_year=%d"|args:$code:$selected_year
|
||||
default=$current_account
|
||||
}}
|
||||
</td>
|
||||
<td class="actions">
|
||||
{{:button
|
||||
label="Enlever"
|
||||
title="Enlever une ligne"
|
||||
shape="minus"
|
||||
min="1"
|
||||
name="remove_line"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="actions">{{:button shape="plus" label="Ajouter" title="Ajouter un compte"}}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
</form>
|
||||
{{/if}}
|
||||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript" async="async">
|
||||
|
||||
// bouton - : supprimer une ligne
|
||||
let lines = $('.transaction-lines tbody tr');
|
||||
lines.forEach(initLine);
|
||||
|
||||
// bouton + : dupliquer une ligne de la 1ère table
|
||||
for (const b of $('#asset_prefixes tfoot button')) {
|
||||
addLine(b, "2*");
|
||||
}
|
||||
|
||||
// bouton + : dupliquer une ligne de la 2ème table
|
||||
for (const b of $('#unfinished_accounts tfoot button')) {
|
||||
addLine(b, "23*");
|
||||
}
|
||||
|
||||
</script>
|
||||
50
confirm_action.html
Normal file
50
confirm_action.html
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#form on="validate"}}
|
||||
{{:debug get=$_GET post=$_POST}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Confirmer"}}
|
||||
{{:assign .="infos"}}
|
||||
{{*:debug post=$_POST*}}
|
||||
{{if $_POST.actions == "amortize"}}
|
||||
{{:assign action="Marquer l'immobilisation amortie"}}
|
||||
{{elseif $_POST.actions == "ignore"}}
|
||||
{{:assign action="Ignorer l'écriture"}}
|
||||
{{/if}}
|
||||
{{:assign msg_titre="Appliquer l'opération « %s » sur les écritures : "|args:$action}}
|
||||
|
||||
{{:assign msg_lines=""}}
|
||||
|
||||
{{:admin_header title="Confirmer l'opération" custom_css="./style.css" current="module_amortissement"*}}
|
||||
|
||||
<form method="post" action="">
|
||||
<div class="block alert">
|
||||
<p>Appliquer l'opération « {{$action}} » sur les écritures :</p>
|
||||
</div>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="num">N°</td>
|
||||
<td>Libellé</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$_POST.check item="line"}}
|
||||
<tr>
|
||||
{{:assign var="label" from="_POST.label.%s"|args:$line}}
|
||||
{{:assign var="trans_id" from="_POST.trans.%s"|args:$line}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
||||
<td>{{$label}}</td>
|
||||
</tr>
|
||||
<input type="hidden" name="trans[{{$trans_id}}]" value="{{$line}}">
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="validate" label="Confirmer" shape="right" class="main"}}
|
||||
</p>
|
||||
</form>
|
||||
|
||||
{{:admin_footer}}
|
||||
16
defaut.json
16
defaut.json
|
|
@ -1,14 +1,8 @@
|
|||
{
|
||||
"tva": false,
|
||||
"prefixes": [
|
||||
"20",
|
||||
"21",
|
||||
"27"
|
||||
],
|
||||
"unfinished": [
|
||||
{
|
||||
"code" : "23",
|
||||
"label" : "Immobilisations en cours"
|
||||
}
|
||||
]
|
||||
"prefixes": {
|
||||
"20": "Immobilisations incorporelles",
|
||||
"21": "Immobilisations corporelles",
|
||||
"27": "Immobilisations financières"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
94
filters.html
94
filters.html
|
|
@ -1,94 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortissement"}}
|
||||
{{:include file="_nav.html" current="config" subcurrent="filters"}}
|
||||
|
||||
{{if $_GET.ok == 1}}
|
||||
<p class="block confirm">Configuration enregistrée.</p>
|
||||
{{/if}}
|
||||
|
||||
{{* lecture config *}}
|
||||
{{:include file="./_get_config.html" keep="module.config"}}
|
||||
|
||||
{{#form on="save"}}
|
||||
{{* enregistrer les filtres dans la config *}}
|
||||
{{#foreach from=$_POST.filters item="filter"}}
|
||||
{{if $filter != ""}}
|
||||
{{:assign var="filters." value=$filter}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{:save key="config" filters=$filters}}
|
||||
{{:redirect to="./filters.html"}}
|
||||
{{/form}}
|
||||
|
||||
<form method="post" action="">
|
||||
<h3>Liste de libellés à ignorer</h3>
|
||||
<p class="help">
|
||||
Les écritures dont le libellé contient un des textes ci-dessous seront ignorées
|
||||
</p>
|
||||
|
||||
<table class="list" id="filter_list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Libellé</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if $module.config.filters == null}}
|
||||
<tr>
|
||||
<td>
|
||||
{{:input type="text" name="filters[]" required=false}}
|
||||
</td>
|
||||
<td class="actions">
|
||||
{{:button
|
||||
label="Enlever"
|
||||
title="Enlever une ligne"
|
||||
shape="minus"
|
||||
name="remove_line"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
{{#foreach from=$module.config.filters item="filter"}}
|
||||
<tr>
|
||||
<td>
|
||||
{{:input type="text" name="filters[]" default=$filter required=false}}
|
||||
</td>
|
||||
<td class="actions">
|
||||
{{:button
|
||||
label="Enlever"
|
||||
title="Enlever une ligne"
|
||||
shape="minus"
|
||||
name="remove_line"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="actions">{{:button shape="plus" label="Ajouter" title="Ajouter un libellé"}}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript" async="async">
|
||||
|
||||
// bouton - : supprimer une ligne
|
||||
let lines = $('#filter_list tbody tr');
|
||||
lines.forEach(initLine);
|
||||
|
||||
// bouton + : dupliquer une ligne de la 1ère table
|
||||
for (const b of $('#filter_list tfoot button')) {
|
||||
copyLine(b);
|
||||
}
|
||||
|
||||
</script>
|
||||
85
ignore.html
85
ignore.html
|
|
@ -1,85 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Marquer la ligne d'écriture « à ignorer »
|
||||
@param immo_id : numéro de ligne
|
||||
*}}
|
||||
|
||||
{{#select
|
||||
trans.id AS trans_id,
|
||||
trans.date AS date,
|
||||
trans.label AS label,
|
||||
line.debit AS amount
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
WHERE line.id = :line_id
|
||||
;
|
||||
:line_id = $_GET.immo_id
|
||||
assign=ligne_immo
|
||||
}}
|
||||
{{else}}
|
||||
{{:error message="Il n'y a aucune écriture avec le numéro de ligne %s !"|args:$_GET.immo_id}}
|
||||
{{/select}}
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}{{/load}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="proceed"}}
|
||||
{{if $_POST.ignore != null && $info_immo == null}}
|
||||
{{* ignorer l'écriture *}}
|
||||
{{:assign duration=0}}
|
||||
{{:assign status="ignored"}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$_GET.immo_id|intval
|
||||
duration=$duration
|
||||
date=$ligne_immo.date
|
||||
status=$status
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=unfinished"}}
|
||||
{{elseif $_POST.ignore == null && $info_immo != null}}
|
||||
{{* dés-ignorer l'écriture *}}
|
||||
{{:delete id=$info_immo.id}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=unfinished"}}
|
||||
{{else}}
|
||||
{{:redirect force="index.html?type_immo=unfinished"}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Ignorer l'écriture" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset id="classement_immo">
|
||||
<legend>Ignorer</legend>
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Écriture</dt>
|
||||
<dd><span class="num"><a href={{$trans_url}}>#{{$ligne_immo.trans_id}}</a></span> {{$ligne_immo.label}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dl>
|
||||
{{if $info_immo != null && $info_immo.status == "ignored"}}
|
||||
{{:input type="checkbox" name="ignore" checked="checked" value="1" label="Ignoré" help="Décocher pour ne plus ignorer l'écriture"}}
|
||||
{{else}}
|
||||
{{:input type="checkbox" name="ignore" value="1" label="Ignoré" help="Cocher pour ignorer l'écriture ; elle n'apparaitra plus dans la liste des immobilisations"}}
|
||||
{{/if}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="proceed" label="Confirmer" shape="right" class="main"}}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
{{:admin_footer}}
|
||||
23
index.html
23
index.html
|
|
@ -1,24 +1,13 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
{{:admin_header title="Immobilisations et amortissements" custom_css="./style.css" current="module_amortization"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if $_GET.type_immo == null}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{:assign type_immo="encours"}}
|
||||
{{else}}
|
||||
{{:assign type_immo=$_GET.type_immo}}
|
||||
{{/if}}
|
||||
|
||||
{{if $type_immo == "managed"}}
|
||||
{{:admin_header title="Immobilisations en cours d'amortissement" custom_css="./style.css" current="module_amortization"}}
|
||||
{{elseif $type_immo == "amortized"}}
|
||||
{{:admin_header title="Immobilisations amorties" custom_css="./style.css" current="module_amortization"}}
|
||||
{{elseif $type_immo == "archived"}}
|
||||
{{:admin_header title="Immobilisations archivées" custom_css="./style.css" current="module_amortization"}}
|
||||
{{elseif $type_immo == "other"}}
|
||||
{{:admin_header title="Autres immobilisations" custom_css="./style.css" current="module_amortization"}}
|
||||
{{elseif $type_immo == "unfinished"}}
|
||||
{{:admin_header title="Immobilisations en cours" custom_css="./style.css" current="module_amortization"}}
|
||||
{{/if}}
|
||||
|
||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$type_immo}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
|
|
@ -45,13 +34,11 @@
|
|||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
{{if $type_immo == "other"}}
|
||||
{{if $type_immo == "autre"}}
|
||||
{{:include file="_immobilisations_autres.html"}}
|
||||
{{elseif $type_immo == "archived"}}
|
||||
{{elseif $type_immo == "sortie"}}
|
||||
{{:include file="_archives.html"}}
|
||||
{{elseif $type_immo == "unfinished"}}
|
||||
{{:include file="_unfinished.html"}}
|
||||
{{elseif $type_immo == "managed" || $type_immo == "amortized"}}
|
||||
{{elseif $type_immo == "encours" || $type_immo == "amortie"}}
|
||||
{{:include file="_immobilisations.html"}}
|
||||
{{/if}}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
name="Amortissements"
|
||||
description="Immobilisations et amortissements\nversion 0.25"
|
||||
description="Gestion des amortissements pour le logiciel de comptabilité Paheko"
|
||||
author="Jean-Christophe Engel"
|
||||
author_url="https://gitea.zaclys.com/lesanges"
|
||||
home_button=false
|
||||
|
|
|
|||
|
|
@ -23,14 +23,6 @@
|
|||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||
{{/select}}
|
||||
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
{{: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)"}}
|
||||
|
||||
{{#select
|
||||
line.id as l_id,
|
||||
line.id_transaction as t_id,
|
||||
|
|
@ -46,9 +38,8 @@
|
|||
INNER JOIN acc_accounts AS account ON account.id = line.id_account
|
||||
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
|
||||
INNER JOIN acc_years AS y ON y.id = trans.id_year
|
||||
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) AND !filter_condition
|
||||
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16)
|
||||
ORDER BY trans.date, trans.label;
|
||||
!filter_condition=$filter_condition
|
||||
assign=autre_amort
|
||||
}}
|
||||
{{#select
|
||||
|
|
@ -70,9 +61,9 @@
|
|||
{{:include
|
||||
file="_nav.html"
|
||||
current="index"
|
||||
subcurrent="other"
|
||||
subcurrent="autre"
|
||||
subsubcurrent="amortization"
|
||||
type_immo="other"
|
||||
type_immo="autre"
|
||||
autres_amort=$autres_amortissements
|
||||
}}
|
||||
{{/if}}
|
||||
|
|
@ -99,7 +90,7 @@
|
|||
<tr>
|
||||
<td class="num"><a href={{$trans_url}}>#{{$line.t_id}}</a></td>
|
||||
<td>{{$line.t_date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amort_amount|money_html:false|raw}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
||||
<td>{{if $line.l_label == null}}
|
||||
{{$line.t_label}}
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -147,8 +147,10 @@
|
|||
- que le compte d'amortissement débute par un préfixe correct (280, 281, ...)
|
||||
- est présent dans le PC de l'exercice correspondant à la date
|
||||
*}}
|
||||
{{:include file="_get_config.html" keep="module.config.prefixes"}}
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{* déterminer le numéro du compte d'amortissement associé au compte d'immobilisation *}}
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
|
|
@ -181,14 +183,14 @@
|
|||
{{:assign
|
||||
var="lines."
|
||||
debit=$_POST.montant
|
||||
account=$debit_account|keys|value:0
|
||||
account=$debit_account|keys|key:0
|
||||
id_project=$_GET.project_id
|
||||
label=$_POST.designation
|
||||
}}
|
||||
{{:assign
|
||||
var="lines."
|
||||
credit=$_POST.montant
|
||||
account=$credit_account|keys|value:0
|
||||
account=$credit_account|keys|key:0
|
||||
id_project=$_GET.project_id
|
||||
label=$_POST.designation
|
||||
}}
|
||||
|
|
@ -212,7 +214,7 @@
|
|||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="managed" subsubcurrent="amortization"}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="encours" subsubcurrent="amortization"}}
|
||||
{{/if}}
|
||||
|
||||
{{:form_errors}}
|
||||
|
|
@ -252,7 +254,7 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="credit_account"
|
||||
label="Compte d'amortissement (28xx)"
|
||||
label="Compte d'amortissement (280xx ou 281xx)"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"28*":$selected_year
|
||||
default=$credit_account
|
||||
|
|
|
|||
134
scripts.js
134
scripts.js
|
|
@ -80,7 +80,7 @@ function setDateEnd(id_exercices, id_date, id_years) {
|
|||
|
||||
// renvoyer la valeur numérique d'un montant formaté en €
|
||||
function getNumber(text) {
|
||||
return Number(text.replace(/[ \xa0]/g, '').replace(/,/, '.').replace(/€/, ''));
|
||||
return Number(text.replace(/ /g, '').replace(/,/, '.').replace(/€/, ''));
|
||||
}
|
||||
|
||||
// calculer le montant d'un amortissement
|
||||
|
|
@ -119,6 +119,7 @@ function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_mo
|
|||
}
|
||||
if (id_date != null) {
|
||||
const date_choisie = str2sec(document.getElementById(id_date).value);
|
||||
console.log("date_choisie = " + date_choisie + ", date_debut=" + date_debut + ", date_fin = " + date_fin);
|
||||
if (date_debut <= date_choisie && date_choisie <= date_fin) {
|
||||
date_fin = date_choisie;
|
||||
} else {
|
||||
|
|
@ -138,134 +139,3 @@ function setSelectorYear(button_names, f_years_selector) {
|
|||
const selected_year = document.getElementById(f_years_selector).value;
|
||||
setAccountYear(button_names, selected_year);
|
||||
}
|
||||
|
||||
// config : gestion des ajouts/suppression comptes immo
|
||||
|
||||
// Associer au bouton « Enlever » de chaque ligne l'action de suppression de la ligne
|
||||
function initLine(row) {
|
||||
var removeBtn = row.querySelector('button[name="remove_line"]');
|
||||
removeBtn.onclick = () => {
|
||||
let count = removeBtn.closest("table").querySelectorAll('tbody tr').length;
|
||||
var min = removeBtn.getAttribute('min');
|
||||
|
||||
if (count <= min) {
|
||||
alert("Il n'est pas possible d'avoir moins de " + min + " ligne(s).");
|
||||
return false;
|
||||
}
|
||||
|
||||
row.parentNode.removeChild(row);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
// Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne
|
||||
function addLine(button, codes) {
|
||||
button.onclick = () => {
|
||||
let lines = button.closest("table").querySelectorAll('tbody tr');
|
||||
let line = lines[lines.length - 1];
|
||||
let newNode = line.cloneNode(true);
|
||||
|
||||
// Réinitialiser le sélecteur de compte
|
||||
let selectButton = newNode.querySelector('.input-list button');
|
||||
let url = selectButton.value;
|
||||
let new_url = url.replace(/codes=[0-9]+\*?/, "codes=" + codes);
|
||||
selectButton.value = new_url;
|
||||
|
||||
// gestionnaire d'événement du sélecteur
|
||||
selectButton.onclick = () => {
|
||||
g.current_list_input = selectButton.parentNode;
|
||||
let url = selectButton.value + (selectButton.value.indexOf('?') > 0 ? '&' : '?') + '_dialog';
|
||||
g.openFrameDialog(url);
|
||||
return false;
|
||||
};
|
||||
|
||||
// réinitialiser le libellé associé au sélecteur
|
||||
let lib = newNode.querySelector('.input-list span.label');
|
||||
lib.innerText = '';
|
||||
|
||||
// ajouter la nouvelle ligne
|
||||
line.parentNode.appendChild(newNode);
|
||||
initLine(newNode);
|
||||
};
|
||||
}
|
||||
|
||||
// afficher le montant
|
||||
function addAmountLine(amount, label, parent) {
|
||||
const node = document.createElement("tr");
|
||||
const col_compte = document.createElement("td");
|
||||
col_compte.classList.add("label");
|
||||
const col_montant = document.createElement("td");
|
||||
col_montant.classList.add("money");
|
||||
const montant = document.createTextNode(new Intl.NumberFormat("fr-FR", { style: "currency", currency: "EUR" }).format(amount / 100., ));
|
||||
col_compte.appendChild(document.createTextNode(label));
|
||||
col_montant.appendChild(montant);
|
||||
node.appendChild(col_compte);
|
||||
node.appendChild(col_montant);
|
||||
parent.appendChild(node);
|
||||
}
|
||||
|
||||
// calculer et afficher le total des lignes sélectionnées
|
||||
function computeTotal(id_total, id_url) {
|
||||
|
||||
// calculer le total par compte et le total général
|
||||
let total = new Object;
|
||||
let total_general = 0;
|
||||
const transactions = [];
|
||||
let lines = document.querySelectorAll('.list tbody tr');
|
||||
for (const line of lines) {
|
||||
let button = line.querySelector('input[type=checkbox]');
|
||||
if (button.checked) {
|
||||
let money = line.querySelector('.money');
|
||||
let code = line.querySelector('.account_code a').innerText;
|
||||
if (code in total) {
|
||||
total[code] += getNumber(money.innerText) * 100;
|
||||
} else {
|
||||
total[code] = getNumber(money.innerText) * 100;
|
||||
}
|
||||
total_general += getNumber(money.innerText) * 100;
|
||||
const number = line.querySelector('.num a').innerText.slice(1);
|
||||
transactions.push(number);
|
||||
}
|
||||
}
|
||||
// afficher les totaux
|
||||
const body = document.getElementById(id_total).querySelector('table tbody');
|
||||
const new_body = document.createElement('tbody');
|
||||
|
||||
for (const code in total) {
|
||||
addAmountLine(total[code], "Compte " + code + " : ", new_body);
|
||||
}
|
||||
body.parentNode.replaceChild(new_body, body);
|
||||
|
||||
// et le total général
|
||||
const foot = document.getElementById(id_total).querySelector('table tfoot');
|
||||
if (Object.keys(total).length > 1) {
|
||||
const new_foot = document.createElement('tfoot');
|
||||
addAmountLine(total_general, "Total : ", new_foot);
|
||||
foot.parentNode.replaceChild(new_foot, foot);
|
||||
} else {
|
||||
// pas besoin de total général si moins de 2 comptes
|
||||
for (const e of foot.children) {
|
||||
foot.removeChild(e);
|
||||
}
|
||||
}
|
||||
|
||||
// mettre à jour les paramètres de l'url
|
||||
let url = document.getElementById(id_url);
|
||||
let new_href = url.href.replace(/trans=.*/, 'trans=' + Object.values(transactions));
|
||||
url.href = new_href;
|
||||
}
|
||||
|
||||
// dupliquer la dernière ligne d'une table
|
||||
function copyLine(button) {
|
||||
button.onclick = () => {
|
||||
let lines = button.closest("table").querySelectorAll('tbody tr');
|
||||
let line = lines[lines.length - 1];
|
||||
let newNode = line.cloneNode(true);
|
||||
let libelle = newNode.querySelector('input');
|
||||
libelle.value = '';
|
||||
|
||||
// ajouter la nouvelle ligne
|
||||
line.parentNode.appendChild(newNode);
|
||||
initLine(newNode);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
23
style.css
23
style.css
|
|
@ -31,16 +31,10 @@ h2[class="aide"], h3[class="aide"] {
|
|||
}
|
||||
|
||||
.informations dt::after {
|
||||
content: ' : ';
|
||||
content: ' :';
|
||||
}
|
||||
|
||||
.informations dl.describe > dt {
|
||||
flex: 0 0 15rem;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.informations dl.describe > dd {
|
||||
flex: 0 0 calc(100% - 20rem);
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
|
|
@ -48,17 +42,6 @@ nav.amort aside {
|
|||
margin-top : 0;
|
||||
}
|
||||
|
||||
fieldset.shortFormLeft div.informations {
|
||||
border: 1px solid var(--gLightBorderColor);
|
||||
background: rgba(var(--gSecondColor), 0.2);
|
||||
border-radius: .5em;
|
||||
}
|
||||
|
||||
.strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.montant td.label {
|
||||
text-align : right;
|
||||
padding-right : 1em;
|
||||
.describe dt::after {
|
||||
content: ' :';
|
||||
}
|
||||
|
|
|
|||
335
transfer.html
335
transfer.html
|
|
@ -1,335 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{:admin_header title="Transfert d'immobilisation en cours" current="module_amortissement"}}
|
||||
{{:include file="_get_config.html" keep="module.config.prefixes"}}
|
||||
|
||||
{{#years closed=false order="start_date" assign=years.}}
|
||||
{{:assign ts_debut=$start_date|strtotime}}
|
||||
{{:assign ts_fin=$end_date|strtotime}}
|
||||
{{:assign debut=$start_date|date_short}}
|
||||
{{:assign fin=$end_date|date_short}}
|
||||
{{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
|
||||
{{:assign var="open_years.%d"|args:$id value=$label|cat:" ("|cat:$debut|cat:" - "|cat:$fin|cat:")"}}
|
||||
{{if $ts_debut <= $now && $now <= $ts_fin}}
|
||||
{{:assign selected_year=$id}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:error message="Aucun exercice ouvert"}}
|
||||
{{/years}}
|
||||
|
||||
{{* déterminer les comptes d'immo en cours *}}
|
||||
{{:include file="_get_config.html" keep="module.config.unfinished"}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$module.config.unfinished item="elem"}}
|
||||
{{:assign code=$elem.code|cat:"%"|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
|
||||
{{* détails des écritures paramètres *}}
|
||||
{{:assign trans=$_GET.trans|explode:","}}
|
||||
{{:assign var="trans_list" value=$trans|map:quote_sql}}
|
||||
{{:assign trans_list=$trans_list|implode:","}}
|
||||
{{:assign trans_list="("|cat:$trans_list|cat:")"}}
|
||||
{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}}
|
||||
{{:assign condition=$condition|cat:" AND NOT (trans.status & 16)"}}
|
||||
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
trans.label AS trans_label,
|
||||
trans.date AS trans_date,
|
||||
SUM(line.debit) AS line_debit,
|
||||
account.code AS account_code,
|
||||
account.label AS account_label,
|
||||
line.id_project as project_id
|
||||
FROM acc_transactions AS trans
|
||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||
WHERE !condition
|
||||
GROUP BY trans.id
|
||||
;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{:assign var="transactions.%s"|args:$trans_id
|
||||
amount=$line_debit
|
||||
date=$trans_date
|
||||
code=$account_code
|
||||
label=$account_label
|
||||
project=$project_id
|
||||
}}
|
||||
{{if $max_date == null || $trans_date > $max_date}}
|
||||
{{:assign max_date=$trans_date}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="transfer"}}
|
||||
{{* vérifier que la date de mise en service est postérieure aux dates d'acquisition *}}
|
||||
{{if $_POST.date_mes|parse_date < $max_date}}
|
||||
{{:assign dacq=$max_date|date_short}}
|
||||
{{:error message="La date de mise en service (%s) doit être postérieure à la date d'acquisition d'immobilisation la plus récente (%s) !"|args:$_POST.date_mes:$dacq}}
|
||||
{{/if}}
|
||||
|
||||
{{* vérifier que la date de mise en service est située dans l'exercice sélectionné *}}
|
||||
{{:assign ts_date = $_POST.date_mes|parse_date|strtotime}}
|
||||
{{:assign ok=false}}
|
||||
{{#foreach from=$years}}
|
||||
{{if $id == $_POST.id_year}}
|
||||
{{:assign selected_chart=$id_chart}}
|
||||
{{if $start_date|strtotime <= $ts_date && $ts_date <= $end_date|strtotime}}
|
||||
{{:assign ok=true}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{if ! $ok}}
|
||||
{{:error message="La date saisie n'est pas dans l'exercice choisi !"}}
|
||||
{{/if}}
|
||||
|
||||
{{if ! $_POST.amortir}}
|
||||
{{* ne pas amortir *}}
|
||||
{{:assign duration=0}}
|
||||
{{:assign date_debut=$_POST.date_achat|parse_date}}
|
||||
{{:assign status="ignored"}}
|
||||
{{else}}
|
||||
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
||||
{{:assign date_debut=$_POST.date_mes|parse_date}}
|
||||
{{:assign duration=$_POST.duree|intval}}
|
||||
{{:assign status="managed"}}
|
||||
{{/if}}
|
||||
|
||||
{{* comptes de débit *}}
|
||||
{{#foreach from=$_POST.credit_accounts key="rang" item="elem"}}
|
||||
{{:include
|
||||
file="_get_codes.html"
|
||||
account=$elem
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign debit_account=$account_code|keys|value:0}}
|
||||
{{:assign var="amount" from="_POST.credit_lines.%s"|args:$rang}}
|
||||
{{:assign var="label" from="_POST.line_labels.%s"|args:$rang}}
|
||||
{{:assign
|
||||
var="lines."
|
||||
account=$debit_account
|
||||
credit=$amount
|
||||
label=$label
|
||||
}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* compte de crédit *}}
|
||||
{{:include
|
||||
file="_get_codes.html"
|
||||
account=$_POST.debit_account
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign credit_account=$account_code|keys|value:0}}
|
||||
{{:assign var="amount" from="_POST.debit_lines.%s"|args:0}}
|
||||
{{:assign count=$_POST.line_labels|count}}
|
||||
{{:assign count="%d-1"|math:$count}}
|
||||
{{:assign var="label" from="_POST.line_labels.%s"|args:$count}}
|
||||
{{:assign
|
||||
var="lines."
|
||||
account=$credit_account
|
||||
debit=$amount
|
||||
label=$label
|
||||
}}
|
||||
|
||||
{{* vérifier :
|
||||
- que le compte d'immo débute par un préfixe correct (20, 21, ...)
|
||||
- est présent dans le PC de l'exercice correspondant à la date
|
||||
*}}
|
||||
|
||||
{{:include
|
||||
file="_check_account.html"
|
||||
account=$account_code
|
||||
chart_id=$selected_chart
|
||||
prefix_array=$module.config.prefixes
|
||||
keep="account_ok"
|
||||
}}
|
||||
|
||||
{{if $account_ok == null}}
|
||||
{{:assign compte=$credit_account|implode:""}}
|
||||
{{:error message="Le compte « %s » n'est pas un compte d'immobilisation ou n'est pas dans le plan comptable de l'exercice choisi"|args:$compte}}
|
||||
{{/if}}
|
||||
|
||||
{{* écritures liées *}}
|
||||
{{:assign var="linked_transactions" value=$_GET.trans|explode:","}}
|
||||
|
||||
{{* enregistrer l'écriture *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction"
|
||||
assign="result"
|
||||
id_year=$_POST.id_year
|
||||
type="advanced"
|
||||
date=$_POST.date_mes
|
||||
label=$_POST.designation|trim
|
||||
lines=$lines
|
||||
linked_transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
{{:assign lines_count=$lines|count}}
|
||||
{{:assign lines_count="%d-1"|math:$lines_count}}
|
||||
{{:assign var="immo_id" from="result.lines.%s.id"|args:$lines_count}}
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
duration=$duration
|
||||
date=$date_debut
|
||||
status=$status
|
||||
}}
|
||||
{{if $_POST.amortir}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{else}}
|
||||
{{:assign type_immo="other"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}}
|
||||
{{/form}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
{{/if}}
|
||||
|
||||
{{:form_errors}}
|
||||
|
||||
{{* formulaire d'ajout d'immobilisation *}}
|
||||
{{if $_GET.trans == null}}
|
||||
{{:error message="Vous n'avez sélectionné aucune écriture !"}}
|
||||
{{/if}}
|
||||
|
||||
{{if $max_date|strtotime > $now}}
|
||||
{{:assign default_date=$max_date}}
|
||||
{{else}}
|
||||
{{:assign default_date=$now|date_short}}
|
||||
{{/if}}
|
||||
|
||||
{{#select id,label FROM acc_projects WHERE archived = 0;}}
|
||||
{{:assign var="projects.%d"|args:$id value=$label}}
|
||||
{{/select}}
|
||||
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||
{{/foreach}}
|
||||
{{:assign var="patterns" value=$pattern_array|implode:"|"}}
|
||||
|
||||
<div id="erreur" class="hidden">
|
||||
<p class="block error">La date choisie n'est dans aucun exercice ouvert !</p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Données de l'immobilisation</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="id_year" label="Exercice" default=$selected_year required=true
|
||||
default_empty="— Faire un choix —" options=$open_years}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" required=true default=$default_date}}
|
||||
{{:input type="text" name="designation" label="Libellé" required=true}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Comptes</legend>
|
||||
<dl>
|
||||
<table class="list transaction-lines">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Compte</th>
|
||||
<th>Débit</th>
|
||||
<th>Crédit</th>
|
||||
<th>Libellé ligne</th>
|
||||
<th>Projet</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{:assign total=0}}
|
||||
{{#foreach from=$transactions key="id"}}
|
||||
{{:assign total="%f+%f"|math:$total:$amount}}
|
||||
{{:assign current_account=null}}
|
||||
{{:assign var="current_account.%s"|args:$code value="%s — %s"|args:$code:$label}}
|
||||
<tr>
|
||||
<td>
|
||||
{{:input
|
||||
type="list"
|
||||
name="credit_accounts[]"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$code:$selected_year
|
||||
default=$current_account
|
||||
}}
|
||||
</td>
|
||||
<td>{{:input name="credit_lines[]" type="text" class="money" size="8" default=$amount|money}}</td>
|
||||
<td>{{:input name="debit_lines[]" type="text" class="money" size="8" disabled=true}}</td>
|
||||
<td>{{:input type="text" name="line_labels[]" size="40"}}</td>
|
||||
<td>
|
||||
{{if $projects != null}}
|
||||
{{:input type="select" name="id_project" options=$projects default_empty="— Aucun —"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>
|
||||
{{:input
|
||||
type="list"
|
||||
name="debit_account"
|
||||
label="Compte d'immobilisation amortissable"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$patterns:$selected_year
|
||||
}}
|
||||
</td>
|
||||
<td>{{:input name="credit_lines[]" type="text" class="money" size="8" disabled=true}}</td>
|
||||
<td>{{:input name="debit_lines[]" type="text" class="money" size="8" default=$total|money}}</td>
|
||||
<td>{{:input type="text" name="line_labels[]" size="40"}}</td>
|
||||
<td>
|
||||
{{if $projects != null}}
|
||||
{{:input type="select" name="id_project" options=$projects default_empty="— Aucun —"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<div id="donnees" class="hidden">
|
||||
{{:input type="select" name="years_data" options=$years_data}}
|
||||
</div>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<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)"}}
|
||||
</div>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="transfer" label="Transférer" shape="right" class="main"}}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
{{:admin_footer}}
|
||||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function changeYear(evt, f_accounts = ['credit_accounts', 'debit_account'], f_years_select = 'f_id_year') {
|
||||
setSelectorYear(f_accounts, f_years_select);
|
||||
}
|
||||
|
||||
function changeVisibility(evt, idcheck = 'f_amortir_1', fields = ['div_amort']) {
|
||||
toggleVisibility(idcheck, fields);
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_id_year').onchange = changeYear;
|
||||
document.getElementById('f_amortir_1').onclick = changeVisibility;
|
||||
})();
|
||||
</script>
|
||||
126
write_exit.html
126
write_exit.html
|
|
@ -33,6 +33,21 @@
|
|||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||
{{/load}}
|
||||
|
||||
{{* date de début de l'exercice *}}
|
||||
{{#select start_date FROM acc_years WHERE id = :year_id; :year_id = $_GET.year}}
|
||||
{{*
|
||||
{{if $start_date < "2025-01-01"
|
||||
*}}
|
||||
{{:assign vnc_code="675"}}
|
||||
{{:assign cession_code="775"}}
|
||||
{{*
|
||||
{{else}}
|
||||
{{:assign vnc_code="657"}}
|
||||
{{:assign cession_code="757"}}
|
||||
{{/if}}
|
||||
*}}
|
||||
{{/select}}
|
||||
|
||||
{{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$_GET.amort_amount}}
|
||||
{{:assign amort_comp=0}} {{* amortissement complémentaire jqà date sortie *}}
|
||||
{{:assign amort_except=0}} {{* amortissement exceptionnel jqà date fin amortissement *}}
|
||||
|
|
@ -73,7 +88,7 @@
|
|||
account=$account
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign amort_account_code=$account_code|keys|value:0}}
|
||||
{{:assign amort_account_code=$account_code|keys|key:0}}
|
||||
|
||||
{{if $valeur_nette > 0}}
|
||||
{{* immo non totalement amortie *}}
|
||||
|
|
@ -84,7 +99,7 @@
|
|||
account=$_POST.comp_account
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign comp_account_code=$account_code|keys|value:0}}
|
||||
{{:assign comp_account_code=$account_code|keys|key:0}}
|
||||
|
||||
{{:assign libelle="Amortissement complémentaire "|cat:$ligne_immo.label}}
|
||||
{{:assign
|
||||
|
|
@ -110,7 +125,7 @@
|
|||
account=$_POST.except_account
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign except_account_code=$account_code|keys|value:0}}
|
||||
{{:assign except_account_code=$account_code|keys|key:0}}
|
||||
{{:assign libelle="Amortissement exceptionnel "|cat:$ligne_immo.label}}
|
||||
{{:assign
|
||||
var="lines."
|
||||
|
|
@ -150,7 +165,7 @@
|
|||
account=$_POST.immo_account
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign immo_account_code=$account_code|keys|value:0}}
|
||||
{{:assign immo_account_code=$account_code|keys|key:0}}
|
||||
{{:assign libelle="Sortie du bilan de "|cat:$ligne_immo.label}}
|
||||
{{:assign
|
||||
var="lines."
|
||||
|
|
@ -172,7 +187,7 @@
|
|||
account=$_POST.vnc_account
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign vnc_account_code=$account_code|keys|value:0}}
|
||||
{{:assign vnc_account_code=$account_code|keys|key:0}}
|
||||
{{:assign
|
||||
var="lines."
|
||||
account=$vnc_account_code
|
||||
|
|
@ -203,13 +218,13 @@
|
|||
account=$_POST.creance_account
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign creance_account=$account_code|keys|value:0}}
|
||||
{{:assign creance_account=$account_code|keys|key:0}}
|
||||
{{:include
|
||||
file="_get_codes.html"
|
||||
account=$_POST.cession_account
|
||||
keep="account_code"
|
||||
}}
|
||||
{{:assign cession_account=$account_code|keys|value:0}}
|
||||
{{:assign cession_account=$account_code|keys|key:0}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction"
|
||||
|
|
@ -245,7 +260,7 @@
|
|||
}}
|
||||
{{/if}}
|
||||
|
||||
{{:redirect to="index.html?type_immo=archived"}}
|
||||
{{:redirect to="index.html?type_immo=sortie"}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
|
@ -254,25 +269,16 @@
|
|||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index" subcurrent="balance_exit"}}
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{*
|
||||
Préparer les infos pour le formulaire
|
||||
déterminer les comptes pour les différentes écritures
|
||||
*}}
|
||||
{{* Préparer les infos pour le formulaire *}}
|
||||
|
||||
{{* déterminer les comptes pour les différentes écritures *}}
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
code_immo=$ligne_immo.code
|
||||
keep="code_amort"
|
||||
}}
|
||||
|
||||
{{*
|
||||
Utilisation des « anciens » numéros de comptes because conflit
|
||||
avec les nouveaux numéros ; voir info.org
|
||||
*}}
|
||||
{{:assign vnc_code="652"}}
|
||||
{{:assign cession_code="757"}}
|
||||
|
||||
{{:assign var="liste_codes.6811" name="comp_account"}}
|
||||
{{:assign var="liste_codes.687" name="except_account"}}
|
||||
{{:assign var="liste_codes.462" name="creance_account"}}
|
||||
|
|
@ -283,36 +289,31 @@
|
|||
{{:assign condition=$liste_codes|keys|implode:","}}
|
||||
{{:assign condition="acc.code IN ("|cat:$condition|cat:")"}}
|
||||
|
||||
{{#select
|
||||
chart.id
|
||||
FROM acc_charts AS chart
|
||||
INNER JOIN acc_years AS year ON chart.id = year.id_chart
|
||||
WHERE year.id = :year_id;
|
||||
:year_id = $_GET.year
|
||||
}}
|
||||
{{:assign chart_id=$id}}
|
||||
{{/select}}
|
||||
|
||||
{{#select
|
||||
acc.id,
|
||||
acc.code as acc_code,
|
||||
acc.label as acc_label
|
||||
acc.label as acc_label,
|
||||
year.label as year_label
|
||||
FROM acc_accounts as acc
|
||||
INNER JOIN acc_charts as chart ON chart.id = acc.id_chart
|
||||
WHERE chart.id = :chart_id AND !condition;
|
||||
:chart_id = $chart_id
|
||||
INNER JOIN acc_years as year ON chart.id = year.id_chart
|
||||
WHERE year.id = 1 AND !condition;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{:assign var="liste_codes.%s.id"|args:$acc_code value=$id}}
|
||||
{{:assign var="liste_codes.%s.acc_label"|args:$acc_code value=$acc_label}}
|
||||
{{:assign var="liste_codes.%s.year_label"|args:$acc_code value=$year_label}}
|
||||
{{/select}}
|
||||
|
||||
{{#foreach from=$liste_codes key=code}}
|
||||
{{:assign var="%s.%s"|args:$name:$code value="%s — %s"|args:$code:$acc_label}}
|
||||
{{/foreach}}
|
||||
|
||||
{{:include file="_get_config.html" keep="module.config.prefixes"}}
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||
{{/foreach}}
|
||||
{{:assign patterns=$pattern_array|implode:"|"}}
|
||||
|
|
@ -324,7 +325,7 @@
|
|||
<legend>Données de l'imobilisation</legend>
|
||||
<dl class="describe">
|
||||
<dt>Montant</dt>
|
||||
<dd class="money">{{$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||
<dd class="money">{{$ligne_immo.montant|money_currency:false}}</dd>
|
||||
<dt>Date d'acquisition</dt>
|
||||
<dd >{{$ligne_immo.date_achat|date_short}}</dd>
|
||||
{{if $_GET.date_mes != $ligne_immo.date_achat|strtotime}}
|
||||
|
|
@ -336,28 +337,28 @@
|
|||
<dd class="num">{{$_GET.duree_amort}} ans</dd>
|
||||
{{/if}}
|
||||
<dt>Montant des amortissements</dt>
|
||||
<dd class="money">{{$_GET.amort_amount|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dd class="money">{{$_GET.amort_amount|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{$valeur_nette|money_currency_html:false|raw}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd>
|
||||
<dt>Date de sortie</dt>
|
||||
<dd>{{$_GET.exit_date|date:"d/m/Y"}}</dd>
|
||||
{{if $amort_comp > 0}}
|
||||
{{:assign valeur_nette="%f-%f"|math:$valeur_nette:$amort_comp}}
|
||||
<dt>Amortissement complémentaire</dt>
|
||||
<dd class="money">{{$amort_comp|money_currency_html:false|raw}} <span class="help">(jusqu'à la date de sortie)</span></dd>
|
||||
<dd class="money">{{$amort_comp|money_currency:false}} <span class="help">(jusqu'à la date de sortie)</span></dd>
|
||||
<dt>Total des amortissements</dt>
|
||||
<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency:false}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dt>Valeur nette résiduelle</dt>
|
||||
<dd class="money">{{$valeur_nette|money_currency_html:false|raw}} <span class="help">(à la date de sortie)</span></dd>
|
||||
<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de sortie)</span></dd>
|
||||
{{/if}}
|
||||
{{if $montant_cession == 0}}
|
||||
{{if $amort_except > 0}}
|
||||
<dt>Amortissement exceptionnel</dt>
|
||||
<dd class="money">{{$amort_except|money_currency_html:false|raw}}</dd>
|
||||
<dd class="money">{{$amort_except|money_currency:false}}</dd>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<dt>Montant de la cession</dt>
|
||||
<dd class="money">{{$montant_cession|money_currency_html:false|raw}}</dd>
|
||||
<dd class="money">{{$montant_cession|money_currency:false}}</dd>
|
||||
{{/if}}
|
||||
</dl>
|
||||
</div>
|
||||
|
|
@ -385,11 +386,11 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="comp_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"68*":$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"68*":$_GET.year
|
||||
default=$comp_account
|
||||
}}
|
||||
</td>
|
||||
<td>{{$amort_comp|money_currency_html:false|raw}}</td>
|
||||
<td>{{$amort_comp|money_currency:false}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -397,12 +398,12 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="amort_comp_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$_GET.year
|
||||
default=$amort_account
|
||||
}}
|
||||
</td>
|
||||
<td></td>
|
||||
<td>{{$amort_comp|money_currency_html:false|raw}}</td>
|
||||
<td>{{$amort_comp|money_currency:false}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -429,11 +430,11 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="except_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"687*":$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"687*":$_GET.year
|
||||
default=$except_account
|
||||
}}
|
||||
</td>
|
||||
<td>{{$amort_except|money_currency_html:false|raw}}</td>
|
||||
<td>{{$amort_except|money_currency:false}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -441,12 +442,12 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="amort_except_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$_GET.year
|
||||
default=$amort_account
|
||||
}}
|
||||
</td>
|
||||
<td></td>
|
||||
<td>{{$amort_except|money_currency_html:false|raw}}</td>
|
||||
<td>{{$amort_except|money_currency:false}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -467,7 +468,7 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="amort_sortie_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"28*":$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$_GET.year
|
||||
default=$amort_account
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -476,7 +477,7 @@
|
|||
{{else}}
|
||||
{{:assign montant="%f+%f"|math:$_GET.amort_amount:$amort_comp}}
|
||||
{{/if}}
|
||||
<td>{{$montant|money_currency_html:false|raw}}</td>
|
||||
<td>{{$montant|money_currency:false}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{if $montant_cession > 0 && $valeur_nette > 0}}
|
||||
|
|
@ -485,25 +486,25 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="vnc_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s*&id_chart=%s"|args:$vnc_code:$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s*&year=%d"|args:$vnc_code:$_GET.year
|
||||
default=$vnc_account
|
||||
}}
|
||||
</td>
|
||||
<td>{{$valeur_nette|money_currency_html:false|raw}}</td>
|
||||
<td>{{$valeur_nette|money_currency:false}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
<tr>
|
||||
<td>
|
||||
<td> {{* style="pointer-events: none; opacity: 0.6;">*}}
|
||||
{{:input
|
||||
type="list"
|
||||
name="immo_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:$patterns:$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:$patterns:$_GET.year
|
||||
default=$immo_account
|
||||
}}
|
||||
</td>
|
||||
<td></td>
|
||||
<td>{{$ligne_immo.montant|money_currency_html:false|raw}}</td>
|
||||
<td>{{$ligne_immo.montant|money_currency:false}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -524,11 +525,11 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="creance_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&id_chart=%s"|args:"462*":$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"462*":$_GET.year
|
||||
default=$creance_account
|
||||
}}
|
||||
</td>
|
||||
<td>{{$montant_cession|money_currency_html:false|raw}}</td>
|
||||
<td>{{$montant_cession|money_currency:false}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -536,12 +537,12 @@
|
|||
{{:input
|
||||
type="list"
|
||||
name="cession_account"
|
||||
target="!acc/charts/accounts/selector.php?codes=%s*&id_chart=%s"|args:$cession_code:$chart_id
|
||||
target="!acc/charts/accounts/selector.php?codes=%s*&year=%d"|args:$cession_code:$_GET.year
|
||||
default=$cession_account
|
||||
}}
|
||||
</td>
|
||||
<td></td>
|
||||
<td>{{$montant_cession|money_currency_html:false|raw}}</td>
|
||||
<td>{{$montant_cession|money_currency:false}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -552,5 +553,4 @@
|
|||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
</form>
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue