Transférer immobilisations en cours vers immobilisation amortissable
This commit is contained in:
parent
9bfc389fa2
commit
4c160e054a
4 changed files with 430 additions and 27 deletions
|
|
@ -8,13 +8,39 @@
|
|||
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>
|
||||
<ul>
|
||||
<li> </li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<p class="submit">
|
||||
{{:linkbutton
|
||||
label="Transférer"
|
||||
href="transfer.html?trans="
|
||||
shape="right"
|
||||
id="transfer"
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>N°</th>
|
||||
<th class="check">{{*:input type="checkbox" name="all" value="all"*}}</th>
|
||||
<th class="num">N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th class="money">Montant</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th class="actions"></th>
|
||||
|
|
@ -25,13 +51,13 @@
|
|||
{{* lister les immobilisations en cours de constitution *}}
|
||||
{{:include file="_get_config.html" keep="module.config.unfinished"}}
|
||||
|
||||
{{:assign condition="("}}
|
||||
{{:assign accounts_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 "}}
|
||||
{{:assign accounts_condition=$accounts_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 accounts_condition=$accounts_condition|cat:"0)"}}
|
||||
{{:assign condition=$accounts_condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||
{{:assign nb_immo=0}}
|
||||
|
||||
{{#select
|
||||
|
|
@ -54,27 +80,20 @@
|
|||
!condition=$condition
|
||||
}}
|
||||
{{* voir s'il existe une écriture qui solde l'immobilisation *}}
|
||||
{{:assign ignore=false}}
|
||||
{{#select
|
||||
line.id AS line,
|
||||
line.id_transaction AS trans,
|
||||
line.debit,
|
||||
line.label,
|
||||
line2.id AS line2,
|
||||
line2.id_transaction AS trans2,
|
||||
line2.credit,
|
||||
line2.label
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_accounts AS acc ON acc.id = line.id_account
|
||||
INNER JOIN acc_transactions_lines AS line2 ON line2.id_account = acc.id
|
||||
WHERE
|
||||
line.id = :line_id
|
||||
AND line2.credit = line.debit;
|
||||
:line_id = $immo_id|intval
|
||||
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 ignore=true}}
|
||||
{{:assign count=$count}}
|
||||
{{/select}}
|
||||
{{if $ignore}}
|
||||
{{* S'il y a plus d'une écriture de même montant on ne peut pas décider *}}
|
||||
{{if $count == 1}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -83,11 +102,12 @@
|
|||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||
|
||||
<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:false}}</td>
|
||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
<td class="account_code"><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
|
|
@ -98,3 +118,18 @@
|
|||
<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');
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue