diff --git a/_unfinished.html b/_unfinished.html index 0c2d86b..5db1083 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -8,13 +8,39 @@ Cette page liste les immobilisations en cours de constitution, donc non amortissables
+ +| N° | +{{*:input type="checkbox" name="all" value="all"*}} | +N° | Date | Libellé | -Montant | +Montant | N° compte | Compte | @@ -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}} |
|---|---|---|---|---|---|---|---|---|---|
| {{:input type="checkbox" name="selected[]" value=$trans_id}} | #{{$trans_id}} | {{$trans_date|date_short}} | {{$trans_label}} | {{"%f"|math:$debit|money:false}} | -{{$account_code}} | +{{$account_code}} | {{$account_label}} |