Masquer titre tableau si aucune immobilisation
This commit is contained in:
parent
0511f22c44
commit
f9df1210bc
1 changed files with 193 additions and 185 deletions
378
_unfinished.html
378
_unfinished.html
|
|
@ -2,214 +2,222 @@
|
||||||
|
|
||||||
{{* Liste des immobilisations en cours de constitution *}}
|
{{* Liste des immobilisations en cours de constitution *}}
|
||||||
|
|
||||||
<section class="immobilisation">
|
<p class="block help">
|
||||||
|
Cet onglet liste les immobilisations en cours de
|
||||||
|
constitution ; vous pouvez les sélectionner pour créer une
|
||||||
|
immobilisation amortissable (exemple : achat de matériaux pour
|
||||||
|
la construction d'un bâtiment destiné à être amorti)
|
||||||
|
</p>
|
||||||
|
|
||||||
<p class="block help">
|
{{:include file="_get_config.html" keep="module.config"}}
|
||||||
Cet onglet liste les immobilisations en cours de
|
{{:assign saved_hides=$module.config.hides}}
|
||||||
constitution ; vous pouvez les sélectionner pour créer une
|
{{:assign var="user_hides" from="saved_hides.%s"|args:$logged_user.id}}
|
||||||
immobilisation amortissable (exemple : achat de matériaux pour
|
|
||||||
la construction d'un bâtiment destiné à être amorti)
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{{:include file="_get_config.html" keep="module.config"}}
|
{{if $_POST|count == 0}}
|
||||||
{{:assign saved_hides=$module.config.hides}}
|
{{:assign unhide=$user_hides.unhide_unfinished}}
|
||||||
{{:assign var="user_hides" from="saved_hides.%s"|args:$logged_user.id}}
|
{{else}}
|
||||||
|
{{if $_POST.unhide == null}}
|
||||||
{{if $_POST|count == 0}}
|
{{:assign unhide=0}}
|
||||||
{{:assign unhide=$user_hides.unhide_unfinished}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if $_POST.unhide == null}}
|
{{:assign unhide=1}}
|
||||||
{{:assign unhide=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign unhide=1}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign var="user_hides.unhide_unfinished" value=$unhide"}}
|
|
||||||
{{:assign var="saved_hides.%s"|args:$logged_user.id value=$user_hides}}
|
|
||||||
{{:save key="config" hides=$saved_hides}}
|
|
||||||
{{/if}}
|
|
||||||
{{if $unhide}}
|
|
||||||
{{:assign checked="checked"}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{:assign var="user_hides.unhide_unfinished" value=$unhide"}}
|
||||||
|
{{:assign var="saved_hides.%s"|args:$logged_user.id value=$user_hides}}
|
||||||
|
{{:save key="config" hides=$saved_hides}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $unhide}}
|
||||||
|
{{:assign checked="checked"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset class="shortFormLeft">
|
<fieldset class="shortFormLeft">
|
||||||
<legend>Transférer une ou plusieurs lignes vers une immobilisation amortissable</legend>
|
<legend>Transférer une ou plusieurs lignes vers une immobilisation amortissable</legend>
|
||||||
<p class="help">
|
<p class="help">
|
||||||
Cocher les lignes concernées
|
Cocher les lignes concernées
|
||||||
|
</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>
|
</p>
|
||||||
<div class="shortFormRight informations" id="total_amount">
|
</div>
|
||||||
<legend>Montants sélectionnés</legend>
|
</fieldset>
|
||||||
<table class="montant">
|
<fieldset>
|
||||||
<tbody>
|
{{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher toutes les écritures" }}
|
||||||
</tbody>
|
</fieldset>
|
||||||
<tfoot>
|
</form>
|
||||||
</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" checked="%s"|args:$checked label="Afficher toutes les écritures" }}
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<table class="list">
|
{{* lister les immobilisations en cours de constitution *}}
|
||||||
<thead>
|
{{:assign first_code=null}}
|
||||||
<tr>
|
{{:assign accounts_condition="("}}
|
||||||
<th class="check"></th>
|
{{#foreach from=$module.config.unfinished item="elem"}}
|
||||||
<th class="num">N°</th>
|
{{if $elem.code != null}}
|
||||||
<th>Date</th>
|
{{:assign code=$elem.code}}
|
||||||
<th>Libellé</th>
|
{{else}}
|
||||||
<th class="nombre">Montant</th>
|
{{:assign code=$elem}}
|
||||||
<th>N° compte</th>
|
{{/if}}
|
||||||
<th>Compte</th>
|
{{if $first_code == null}}
|
||||||
<th class="actions"></th>
|
{{:assign first_code=$code}}
|
||||||
</tr>
|
{{/if}}
|
||||||
</thead>
|
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||||
<tbody>
|
{{: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)"}}
|
||||||
|
|
||||||
{{* lister les immobilisations en cours de constitution *}}
|
{{: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 accounts_condition="("}}
|
{{#select
|
||||||
{{#foreach from=$module.config.unfinished item="elem"}}
|
trans.id as trans_id,
|
||||||
{{if $elem.code != null}}
|
trans.label as trans_label,
|
||||||
{{:assign code=$elem.code}}
|
trans.date as trans_date,
|
||||||
{{else}}
|
line.id as immo_line_id,
|
||||||
{{:assign code=$elem}}
|
account.id as account_id,
|
||||||
{{/if}}
|
account.code as account_code,
|
||||||
{{:assign code=$code|cat:"%"|quote_sql}}
|
account.label as account_label,
|
||||||
{{:assign accounts_condition=$accounts_condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
sum(line.debit) AS debit,
|
||||||
{{/foreach}}
|
trans.id_year as trans_id_year
|
||||||
{{:assign accounts_condition=$accounts_condition|cat:"0)"}}
|
FROM acc_transactions AS trans
|
||||||
{{:assign condition=$accounts_condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
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
|
||||||
|
assign="immo_line"
|
||||||
|
}}
|
||||||
|
{{* 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_line_id|intval}}
|
||||||
|
{{:assign ignore=true}}
|
||||||
|
{{/load}}
|
||||||
|
{{if $ignore && $unhide == null}}
|
||||||
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{:assign filter_condition=" NOT ("}}
|
{{*
|
||||||
{{#foreach from=$module.config.filters item="filter"}}
|
TODO cas où :
|
||||||
{{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}}
|
- il y a (au moins) une écriture d'avoir
|
||||||
{{: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_line_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_line_id|intval}}
|
|
||||||
{{:assign ignore=true}}
|
|
||||||
{{/load}}
|
|
||||||
{{if $ignore && $unhide == null}}
|
|
||||||
{{:continue}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{*
|
{{* voir s'il existe une écriture qui solde l'immobilisation (voir ci-dessus) *}}
|
||||||
TODO cas où :
|
{{#select
|
||||||
- il y a (au moins) une écriture d'avoir
|
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}}
|
||||||
|
|
||||||
{{* voir s'il existe une écriture qui solde l'immobilisation (voir ci-dessus) *}}
|
{{* S'il y a plus d'une écriture de même montant on ne peut pas décider *}}
|
||||||
{{#select
|
{{if $count == 1}}
|
||||||
count(*) AS count
|
{{:continue}}
|
||||||
FROM acc_transactions AS trans
|
{{/if}}
|
||||||
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 *}}
|
{{:assign var="immo_lines." value=$immo_line}}
|
||||||
{{if $count == 1}}
|
{{/select}}
|
||||||
{{:continue}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
{{if $immo_lines|count > 0}}
|
||||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
<section class="immobilisation">
|
||||||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
<table class="list">
|
||||||
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
|
<thead>
|
||||||
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
|
<tr>
|
||||||
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
|
<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>
|
||||||
|
|
||||||
<tr {{if $ignore}}class="checked"{{/if}}>
|
{{:assign total_immo = 0}}
|
||||||
<td class="check">{{:input type="checkbox" name="selected[]" value=$trans_id}}</td>
|
{{#foreach from=$immo_lines}}
|
||||||
<td class="num"><a href="{{$trans_url}}">#{{$trans_id}}</a></td>
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||||
<td>{{$trans_date|date_short}}</td>
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||||
<td>{{$trans_label}}</td>
|
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
|
||||||
<td class="money">{{"%f"|math:$debit|money_html:false|raw}}</td>
|
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
|
||||||
<td class="account_code"><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
|
||||||
<td>{{$account_label}}</td>
|
|
||||||
<td class="actions">
|
<tr {{if $ignore}}class="checked"{{/if}}>
|
||||||
{{:linkbutton
|
<td class="check">{{:input type="checkbox" name="selected[]" value=$trans_id}}</td>
|
||||||
label="Modifier"
|
<td class="num"><a href="{{$trans_url}}">#{{$trans_id}}</a></td>
|
||||||
href="ignore.html?immo_line_id=%s"|args:$immo_line_id
|
<td>{{$trans_date|date_short}}</td>
|
||||||
shape="edit"
|
<td>{{$trans_label}}</td>
|
||||||
target="_dialog"
|
<td class="money">{{"%f"|math:$debit|money_html:false|raw}}</td>
|
||||||
}}
|
<td class="account_code"><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||||
</td>
|
<td>{{$account_label}}</td>
|
||||||
</tr>
|
<td class="actions">
|
||||||
{{/select}}
|
{{:linkbutton
|
||||||
</tbody>
|
label="Modifier"
|
||||||
<tfoot>
|
href="ignore.html?immo_line_id=%s"|args:$immo_line_id
|
||||||
{{if $total_immo != 0}}
|
shape="edit"
|
||||||
{{#foreach from=$sommes_immo|ksort key="code" item="value"}}
|
target="_dialog"
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
</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>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>Total du compte {{$code}}</td>
|
<td class="strong">Total des immobilisations</td>
|
||||||
<td class="money">{{$value|money_html|raw}}</td>
|
<td class="money strong">{{$total_immo|money_html|raw}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td class="actions"></td>
|
<td class="actions"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/if}}
|
||||||
<tr>
|
</tfoot>
|
||||||
<td></td>
|
</table>
|
||||||
<td></td>
|
</section>
|
||||||
<td></td>
|
{{else}}
|
||||||
<td class="strong">Total des immobilisations</td>
|
<p class="block alert">Aucune écriture d'immobilisation trouvée dans la comptabilité (compte {{$first_code}} et sous-comptes)</p>
|
||||||
<td class="money strong">{{$total_immo|money_html|raw}}</td>
|
{{/if}}
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td class="actions"></td>
|
|
||||||
</tr>
|
|
||||||
{{/if}}
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
{{if $nb_immo == 0}}
|
|
||||||
<p class="block alert">Aucune écriture d'immobilisation trouvée dans la comptabilité (comptes N° xxx)</p>
|
|
||||||
{{/if}}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="scripts.js"></script>
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
<script type="text/javascript" async="async">
|
<script type="text/javascript" async="async">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue