Compare commits
2 commits
baf3ffd367
...
4b504f6eb9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b504f6eb9 | ||
|
|
ab8f695e31 |
3 changed files with 94 additions and 114 deletions
|
|
@ -2,38 +2,6 @@
|
|||
|
||||
{{* Liste des immobilisations archivées *}}
|
||||
|
||||
{{* 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,
|
||||
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
|
||||
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}}
|
||||
|
|
@ -44,9 +12,7 @@
|
|||
{{: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)"}}
|
||||
{{:assign condition=$condition|cat:" AND acc2.code = account.code AND line.debit > 0 AND line.debit = line2.credit AND NOT (trans.status & 16)"}}
|
||||
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
|
|
@ -58,7 +24,8 @@
|
|||
account.label as account_label,
|
||||
line.debit AS debit,
|
||||
project.label as project_label,
|
||||
trans.id_year as trans_id_year
|
||||
trans.id_year as trans_id_year,
|
||||
trans2.date as exit_date
|
||||
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
|
||||
|
|
@ -72,9 +39,7 @@
|
|||
!condition=$condition
|
||||
assign="immo_archivee"
|
||||
}}
|
||||
{{if ! $trans_id|key_in:$immo_archivees}}
|
||||
{{:assign var="immo_archivees.%s"|args:$trans_id value=$immo_archivee}}
|
||||
{{/if}}
|
||||
{{:assign var="immo_archivees.%s"|args:$trans_id value=$immo_archivee}}
|
||||
{{/select}}
|
||||
|
||||
<section class="immobilisation">
|
||||
|
|
@ -83,7 +48,8 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>N°</th>
|
||||
<th>Date</th>
|
||||
<th>Mise en service</th>
|
||||
<th>Date sortie</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th>N° compte</th>
|
||||
|
|
@ -100,6 +66,7 @@
|
|||
<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:false}}</td>
|
||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
{{if $ts_debut <= $now && $now <= $ts_fin}}
|
||||
{{:assign selected_year=$id}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:error message="Aucun exercice ouvert"}}
|
||||
{{/years}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
|
|
|
|||
159
config.html
159
config.html
|
|
@ -3,6 +3,7 @@
|
|||
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortissement"}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="_nav.html" current="config"}}
|
||||
|
||||
{{if $_GET.ok == 1}}
|
||||
<p class="block confirm">Configuration enregistrée.</p>
|
||||
{{/if}}
|
||||
|
|
@ -39,97 +40,107 @@
|
|||
{{:redirect to="./config.html?ok=%d"|args:$ok}}
|
||||
{{/form}}
|
||||
|
||||
{{* récupérer l'exercice courant *}}
|
||||
{{* 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 closed=false order="start_date"}}
|
||||
{{:assign var="open_years.%d"|args:$id value=$label}}
|
||||
{{#years}}
|
||||
{{if $start_date|strtotime <= $now && $end_date|strtotime >= $now}}
|
||||
{{:assign selected_year=$id}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{:assign last_year=$id}}
|
||||
{{/years}}
|
||||
{{/if}}
|
||||
|
||||
{{* libellés des comptes d'immobilisation *}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$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}}
|
||||
{{if $selected_year == null}}
|
||||
{{if $last_year == null}}
|
||||
<p class="block alert">Aucun exercice</p>
|
||||
{{else}}
|
||||
{{:assign selected_year=$last_year}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#select
|
||||
account.id as account_id,
|
||||
account.code,
|
||||
account.id_chart,
|
||||
account.label,
|
||||
year.label as year_label,
|
||||
chart.label as chart_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="accounts.%s"|args:$code label=$label id=$account_id}}
|
||||
{{/select}}
|
||||
{{if $selected_year != null}}
|
||||
|
||||
<h3>Comptes d'immobilisation</h3>
|
||||
<form method="post" action="">
|
||||
{{* libellés des comptes d'immobilisation *}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$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}}
|
||||
|
||||
<p class="help">
|
||||
Les immobilisations sont cherchées dans les comptes sélectionnées et leurs sous-comptes.
|
||||
</p>
|
||||
{{#select
|
||||
account.id as account_id,
|
||||
account.code,
|
||||
account.id_chart,
|
||||
account.label,
|
||||
year.label as year_label,
|
||||
chart.label as chart_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="accounts.%s"|args:$code label=$label id=$account_id}}
|
||||
{{/select}}
|
||||
|
||||
<table class="list transaction-lines" id="asset_prefixes">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Compte</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$accounts key=code item=elem}}
|
||||
<h3>Comptes d'immobilisation</h3>
|
||||
<form method="post" action="">
|
||||
|
||||
<p class="help">
|
||||
Les immobilisations sont cherchées dans les comptes sélectionnées et leurs sous-comptes.
|
||||
</p>
|
||||
|
||||
<table class="list transaction-lines" id="asset_prefixes">
|
||||
<thead>
|
||||
<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}}
|
||||
{{*:debug immo_account=$immo_account current_account=$current_account*}}
|
||||
{{: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>
|
||||
<td>Compte</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="actions">{{:button shape="plus" label="Ajouter" title="Ajouter un compte"}}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$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>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
</form>
|
||||
<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">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue