Harmonisation identifiants immobilisations et amortissements
This commit is contained in:
parent
8357b39d39
commit
92c47983e5
17 changed files with 109 additions and 110 deletions
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
{{*
|
||||
Lister les écritures d'amortissement associées à une immobilisation
|
||||
@param immo_id : id de la ligne d'immo
|
||||
@param immo_line_id : id de la ligne d'immo
|
||||
@param type_immo : managed, amortized, archived, others
|
||||
*}}
|
||||
|
||||
{{* récupérer les infos de l'immobilisation *}}
|
||||
{{#select
|
||||
line.id as immo_id,
|
||||
line.id as immo_line_id,
|
||||
line.debit as montant,
|
||||
line.label as line_label,
|
||||
trans.id as trans_id,
|
||||
trans.id as immo_trans_id,
|
||||
trans.label as label,
|
||||
trans.date,
|
||||
account.code as account_code
|
||||
|
|
@ -19,16 +19,16 @@
|
|||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||
WHERE line.id = :line_id;
|
||||
:line_id = $_GET.immo_id|intval
|
||||
:line_id = $_GET.immo_line_id|intval
|
||||
assign=ligne_immo
|
||||
}}
|
||||
{{else}}
|
||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_line_id}}
|
||||
{{/select}}
|
||||
{{:assign date_debut=$ligne_immo.date}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.immo_trans_id}}
|
||||
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_line_id|intval}}
|
||||
{{:assign duree=$duration}}
|
||||
{{:assign date_debut=$date}}
|
||||
{{:assign status=$status}}
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
*}}
|
||||
{{:assign total_credits=0}}
|
||||
{{#select
|
||||
CASE links.id_related = :immo_id
|
||||
CASE links.id_related = :immo_trans_id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
END as other_id,
|
||||
|
|
@ -53,8 +53,8 @@
|
|||
ON (trans.id = links.id_transaction OR trans.id = links.id_related)
|
||||
INNER JOIN acc_transactions_lines AS line on line.id_transaction = other_id
|
||||
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||
WHERE trans.id = :immo_id AND line.credit > 0 AND acc.code = :account;
|
||||
:immo_id=$ligne_immo.trans_id
|
||||
WHERE trans.id = :immo_trans_id AND line.credit > 0 AND acc.code = :account;
|
||||
:immo_trans_id=$ligne_immo.immo_trans_id
|
||||
:account=$ligne_immo.account_code
|
||||
}}
|
||||
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
{{:assign var="ligne_immo.montant" value="%d-%d"|math:$ligne_immo.montant:$total_credits}}
|
||||
{{:assign solde=$ligne_immo.montant}}
|
||||
|
||||
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||
{{* lister les lignes des écritures d'amortissement liées à l'immobilisation *}}
|
||||
{{#select
|
||||
l_amort.credit as amort_amount,
|
||||
l_amort.label as amort_label,
|
||||
|
|
@ -84,18 +84,17 @@
|
|||
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||
INNER join acc_accounts as account on l_amort.id_account = account.id
|
||||
WHERE
|
||||
l_immo.id = :line_id
|
||||
AND account.code LIKE '28%'
|
||||
WHERE l_immo.id = :line_id AND account.code LIKE '28%'
|
||||
ORDER BY trans.date;
|
||||
:line_id = $_GET.immo_id|intval
|
||||
:line_id = $_GET.immo_line_id|intval
|
||||
assign="amort_line"
|
||||
}}
|
||||
|
||||
{{#load type="link"
|
||||
where="$$.immo_line_id = :immo_line_id AND $$.amort_trans_id = :amort_trans_id"
|
||||
assign="line"
|
||||
:immo_line_id=$_GET.immo_id|intval :amort_trans_id=$amort_line.amort_trans_id
|
||||
:immo_line_id=$_GET.immo_line_id|intval
|
||||
:amort_trans_id=$amort_line.amort_trans_id
|
||||
}}
|
||||
{{if $line.amort_line_id == $amort_line.amort_line_id}}
|
||||
{{:assign var="linked_amort." value=$amort_line}}
|
||||
|
|
@ -226,7 +225,7 @@
|
|||
<p class="submit">
|
||||
{{:linkbutton
|
||||
label="Sortir du bilan"
|
||||
href="balance_sheet_exit.html?immo_id=%s&type_immo=%s"|args:$_GET.immo_id:$_GET.type_immo
|
||||
href="balance_sheet_exit.html?immo_line_id=%s&type_immo=%s"|args:$_GET.immo_line_id:$_GET.type_immo
|
||||
shape="export"
|
||||
class="main"
|
||||
}}
|
||||
|
|
@ -242,7 +241,7 @@
|
|||
<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}}{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.label}} — {{$ligne_immo.line_label}}{{/if}}</dd>
|
||||
<dd><span class="num"><a href={{$trans_url}}>#{{$ligne_immo.immo_trans_id}}</a></span> {{$ligne_immo.label}}{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.label}} — {{$ligne_immo.line_label}}{{/if}}</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>
|
||||
|
|
@ -300,7 +299,7 @@
|
|||
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
||||
<td>{{$line.account_label}}</td>
|
||||
<td>
|
||||
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line_id:$ligne_immo.immo_id shape="minus"}}
|
||||
{{:linkbutton label="Détacher" href="detach_amort.html?amort_line_id=%d&immo_line_id=%d"|args:$line.amort_line_id:$ligne_immo.immo_line_id shape="minus"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue