Mutualisation infos immo, écritures crédit, amortissements liés et libres
This commit is contained in:
parent
91795c69a8
commit
780eb206ce
21 changed files with 410 additions and 879 deletions
|
|
@ -9,84 +9,25 @@
|
|||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
{{#load type="immo" id=$_GET.immo_doc_id|intval assign="info_immo"}}
|
||||
{{else}}
|
||||
{{:error message="Immobilisation non trouvée"}}
|
||||
{{/load}}
|
||||
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
|
||||
{{if $message != null}}
|
||||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{#select
|
||||
trans.id as immo_trans_id,
|
||||
trans.label as label,
|
||||
trans.date as date_achat,
|
||||
line.id as immo_line_id,
|
||||
line.debit as montant,
|
||||
line.label as line_label,
|
||||
account.code as account_code,
|
||||
account.label as account_label
|
||||
FROM acc_transactions_lines AS line
|
||||
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 = $info_immo.line
|
||||
assign="ligne_immo"
|
||||
}}
|
||||
{{else}}
|
||||
{{:error message="Immobilisation non trouvée"}}
|
||||
{{/select}}
|
||||
|
||||
{{:assign var="info_immo.amount" value=$info_immo.amount|or:$ligne_immo.montant}}
|
||||
{{:assign var="info_immo.amount" value=$info_immo.amount|or:$ligne_immo.amount}}
|
||||
{{:assign var="info_immo.date_achat" value=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign var="info_immo.date_mes" value=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
{{:assign var="info_immo.label" value=$info_immo.label|or:$ligne_immo.label}}
|
||||
{{:assign var="info_immo.label" value=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $info_immo.label}}
|
||||
{{:assign var="info_immo.label" value=$info_immo.label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
chercher des écritures liées à l'immo courante au crédit du même compte
|
||||
et déduire leur montant de celui de l'immo
|
||||
*}}
|
||||
{{:assign linked_immos=null}}
|
||||
{{:assign total_credits=0}}
|
||||
{{#load type="credit_link" where="$$.immo_doc_id=:immo_doc_id" :immo_doc_id=$_GET.immo_doc_id|intval}}
|
||||
{{#select
|
||||
line.credit,
|
||||
line.id as line_id,
|
||||
trans.id as trans_id,
|
||||
trans.label,
|
||||
trans.date
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
WHERE line.id = :credit_line_id;
|
||||
:credit_line_id=$credit_line_id
|
||||
}}
|
||||
{{:assign credit=$credit}}
|
||||
{{:assign var="linked_immos." trans_id=$trans_id credit_line_id=$line_id label=$label amount=$credit date=$date}}
|
||||
{{/select}}
|
||||
{{if $amount == null}}
|
||||
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
||||
{{else}}
|
||||
{{:assign total_credits="%d+%d"|math:$total_credits:$amount}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
||||
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}}
|
||||
{{:assign solde="%d-%d"|math:$info_immo.amount:$total_credits}}
|
||||
|
||||
{{:assign total_amort=0}}
|
||||
{{* lister les docs d'amortissement liées à la ligne d'immobilisation *}}
|
||||
{{#load type="amort_link"
|
||||
where="$$.immo_doc_id = :immo_doc_id"
|
||||
:immo_doc_id=$_GET.immo_doc_id|intval
|
||||
}}
|
||||
{{if $amount != null}}
|
||||
{{:assign total_amort="%d+%d"|math:$total_amort:$amount}}
|
||||
{{else}}
|
||||
{{#select credit FROM acc_transactions_lines WHERE id = :amort_line_id;
|
||||
:amort_line_id=$amort_line_id
|
||||
}}
|
||||
{{:assign total_amort="%d+%d"|math:$total_amort:$credit}}
|
||||
{{/select}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{* lister les amortissements liés à l'immobilisation *}}
|
||||
{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_amort"}}
|
||||
|
||||
{{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
|
||||
|
|
@ -102,7 +43,7 @@
|
|||
{{:include file="_nav.html" current="index" subcurrent="details" subsubcurrent=$subsubcurrent}}
|
||||
{{/if}}
|
||||
*}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.immo_trans_id}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
||||
|
||||
<nav class="tabs">
|
||||
<aside>
|
||||
|
|
@ -122,7 +63,7 @@
|
|||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg|match:"attach_amort"}}
|
||||
{{:assign msg="Écriture d'amortissement attachée"}}
|
||||
{{elseif $_GET.msg|match:"attach_immo"}}
|
||||
{{elseif $_GET.msg|match:"attach_credit"}}
|
||||
{{:assign msg="Écriture au crédit attachée"}}
|
||||
{{elseif $_GET.msg|match:"info"}}
|
||||
{{:assign msg="Données de l'immobilisation enregistrées"}}
|
||||
|
|
@ -139,7 +80,7 @@
|
|||
|
||||
<h3 class="ruler">
|
||||
Immobilisation
|
||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span>
|
||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span>
|
||||
{{$info_immo.label}}
|
||||
</h3>
|
||||
{{if $linked_immos != null}}
|
||||
|
|
@ -155,7 +96,7 @@
|
|||
<td>{{$line.date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
<td>
|
||||
{{:linkbutton label="Détacher" href="detach_immo.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
|
|
@ -163,11 +104,12 @@
|
|||
</table>
|
||||
</aside>
|
||||
{{/if}}
|
||||
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
{{*
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span><span class="label"> {{$info_immo.label}}</span></dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span><span class="label"> {{$info_immo.label}}</span></dd>
|
||||
*}}
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue