Compare commits
5 commits
49b207c0e1
...
23fac6ecea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23fac6ecea | ||
|
|
18ce7b0edd | ||
|
|
b83942efd2 | ||
|
|
b15eab168c | ||
|
|
e4a637c652 |
8 changed files with 305 additions and 55 deletions
|
|
@ -73,6 +73,18 @@
|
||||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$_POST.date_mes:$da}}
|
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$_POST.date_mes:$da}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $_POST.date_achat == null || $_POST.date_achat|parse_date == $ligne_immo.date_achat}}
|
||||||
|
{{:assign date_achat=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign date_achat=$_POST.date_achat|parse_date}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $_POST.date_mes == null || $_POST.date_mes == $_POST.date_achat}}
|
||||||
|
{{:assign date_mes=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign date_mes=$_POST.date_mes|parse_date}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{:assign duration=$_POST.duree|intval}}
|
{{:assign duration=$_POST.duree|intval}}
|
||||||
{{if $duration <= 0}}
|
{{if $duration <= 0}}
|
||||||
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
{{:error message="Erreur : la durée d'amortissement doit être strictement positive"}}
|
||||||
|
|
@ -100,17 +112,6 @@
|
||||||
{{:error message="Le montant (%s) ne peut être supérieur au reste (%s)"|args:$montant_nb:$reste_nb}}
|
{{:error message="Le montant (%s) ne peut être supérieur au reste (%s)"|args:$montant_nb:$reste_nb}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $_POST.date_achat == null || $_POST.date_achat|parse_date == $ligne_immo.date_achat}}
|
|
||||||
{{:assign date_achat=null}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign date_achat=$_POST.date_achat|parse_date}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $_POST.date_mes == null || $_POST.date_mes == $_POST.date_achat || $_POST.date_mes|parse_date == $ligne_immo.date_achat}}
|
|
||||||
{{:assign date_mes=null}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign date_mes=$_POST.date_mes|parse_date}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign status="managed"}}
|
{{:assign status="managed"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{:assign solde="%d-%d"|math:$ligne_immo.montant:$total_credits}}
|
{{:assign solde="%d-%d"|math:$ligne_immo.montant:$total_credits}}
|
||||||
{{*:debug info_immo=$info_immo ligne_immo=$ligne_immo total_credits=$total_credits solde=$solde*}}
|
|
||||||
|
|
||||||
{{if $info_immo.status == "amortized"}}
|
{{if $info_immo.status == "amortized"}}
|
||||||
{{:assign amort_amount=$solde}}
|
{{:assign amort_amount=$solde}}
|
||||||
|
|
@ -213,7 +212,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $info_immo.duration != null && $valeur_residuelle > 0}}
|
{{if $info_immo.duration != null && $valeur_residuelle > 0}}
|
||||||
<dt>Annuité estimée</dt>
|
<dt>Annuité estimée</dt>
|
||||||
<dd>{{"min(%d, %f/%d)"|math:$valeur_residuelle:solde:$info_immo.duration|money_currency_html:false|raw}}</dd>
|
<dd>{{"min(%d, %f/%d)"|math:$valeur_residuelle:$solde:$info_immo.duration|money_currency_html:false|raw}}</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
100
delete_infos.html
Normal file
100
delete_infos.html
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Supprimer les infos d'une immo et les liaisons d'immo associées
|
||||||
|
@param immo_doc_id
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{#load id=$_GET.immo_doc_id|intval assign="info_immo"}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Immobilisation non trouvée"}}
|
||||||
|
{{/load}}
|
||||||
|
{{#select
|
||||||
|
trans.id as immo_trans_id,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.date as date_achat,
|
||||||
|
line.debit as montant,
|
||||||
|
line.label as line_label,
|
||||||
|
acc.code,
|
||||||
|
acc.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 acc ON line.id_account = acc.id
|
||||||
|
WHERE line.id = :line_id;
|
||||||
|
:line_id = $info_immo.line
|
||||||
|
assign="ligne_immo"
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Immobilisation non trouvée"}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.immo_trans_id}}
|
||||||
|
{{:assign immo_label=$info_immo.label|or:$ligne_immo.trans_label}}
|
||||||
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $immo_label}}
|
||||||
|
{{:assign immo_label=$immo_label|cat::" — "|cat:$ligne_immo.line_label}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#form on="delete"}}
|
||||||
|
{{#select
|
||||||
|
trans.id
|
||||||
|
FROM acc_transactions_lines AS line
|
||||||
|
INNER JOIN !table ON $$.credit_line_id = line.id
|
||||||
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
|
WHERE $$.type =
|
||||||
|
"credit_link" AND $$.immo_doc_id = :immo_doc_id
|
||||||
|
;
|
||||||
|
!table = $module.table
|
||||||
|
:immo_doc_id = $_GET.immo_doc_id|intval
|
||||||
|
}}
|
||||||
|
{{:assign var="linked_trans." value=$id}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{:debug linked_trans=$linked_trans}}
|
||||||
|
{{if $linked_trans != null}}
|
||||||
|
{{* chercher et supprimer les écritures liées *}}
|
||||||
|
{{#select
|
||||||
|
CASE links.id_related = trans.id
|
||||||
|
WHEN true THEN links.id_transaction
|
||||||
|
WHEN false THEN links.id_related
|
||||||
|
END as linked_id
|
||||||
|
FROM acc_transactions AS trans
|
||||||
|
INNER JOIN acc_transactions_links as links
|
||||||
|
ON (links.id_transaction = trans.id OR links.id_related = trans.id)
|
||||||
|
WHERE trans.id = :immo_trans_id
|
||||||
|
;
|
||||||
|
:immo_trans_id=$ligne_immo.immo_trans_id
|
||||||
|
}}
|
||||||
|
{{if ! $linked_trans|has:$linked_id}}
|
||||||
|
{{:assign var="linked_transactions." value=$linked_id}}
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{* enregistrer les liaisons restantes *}}
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction/%s/transactions"|args:$ligne_immo.immo_trans_id
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
transactions=$linked_transactions
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{* supprimer les docs de liaison *}}
|
||||||
|
{{:delete type="immo_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id = $_GET.immo_doc_id|intval}}
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* supprimer les infos de l'immobilisation *}}
|
||||||
|
{{:delete id=$_GET.immo_doc_id|intval}}
|
||||||
|
{{:redirect force="index.html?ok=1&msg=suppr_infos&type_immo=other"}}
|
||||||
|
{{/form}}
|
||||||
|
|
||||||
|
|
||||||
|
{{:admin_header title="Supprimer" current="module_amortization"}}
|
||||||
|
{{:form_errors}}
|
||||||
|
{{:delete_form
|
||||||
|
legend="Immobilisation « #%s %s »"|args:$ligne_immo.immo_trans_id:$immo_label
|
||||||
|
warning="Supprimer les paramètres de l'immobilisation « #%s %s » ?"|args:$ligne_immo.immo_trans_id:$immo_label
|
||||||
|
info="L'écriture d'immobilisation ne sera pas supprimée ; les nouveaux paramètres pourront être saisis depuis l'onglet « À classer »"
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{:admin_footer}}
|
||||||
73
detach_immo.html
Normal file
73
detach_immo.html
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Supprimer l'association entre une écriture d'immobilisation et
|
||||||
|
une écriture au crédit du compte d'immobilisation
|
||||||
|
@param immo_line_id : id de la ligne d'immo
|
||||||
|
@param credit__line_id : id de la ligne de crédit
|
||||||
|
@param immo_doc_id : id du doc associé à l'immo
|
||||||
|
*}}
|
||||||
|
{{:debug get=$_GET}}
|
||||||
|
{{* chercher l'écriture d'immobilisation *}}
|
||||||
|
{{#select
|
||||||
|
id_transaction
|
||||||
|
FROM acc_transactions_lines
|
||||||
|
WHERE id = :line_id;
|
||||||
|
:line_id = $_GET.immo_line_id|intval
|
||||||
|
}}
|
||||||
|
{{:assign immo_trans_id=$id_transaction}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Immobilisation non trouvée"}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{* chercher l'écriture au crédit *}}
|
||||||
|
{{#select
|
||||||
|
id_transaction
|
||||||
|
FROM acc_transactions_lines
|
||||||
|
WHERE id = :line_id;
|
||||||
|
:line_id = $_GET.credit_line_id|intval
|
||||||
|
}}
|
||||||
|
{{:assign credit_id=$id_transaction}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Écriture au crédit non trouvée"}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
chercher les liaisons de l'écriture d'immobilisation
|
||||||
|
et supprimer la liaison avec l'écriture au crédit
|
||||||
|
*}}
|
||||||
|
{{#select
|
||||||
|
CASE links.id_related = :immo_trans_id
|
||||||
|
WHEN true THEN links.id_transaction
|
||||||
|
WHEN false THEN links.id_related
|
||||||
|
END as linked_id
|
||||||
|
FROM acc_transactions_links as links
|
||||||
|
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||||
|
:immo_trans_id = $immo_trans_id
|
||||||
|
}}
|
||||||
|
{{if $linked_id != $credit_id}}
|
||||||
|
{{:assign var="linked_transactions." value=$linked_id}}
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
{{:debug linked_transactions=$linked_transactions}}
|
||||||
|
{{* Enregistrer les liaisons *}}
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction/%s/transactions"|args:$immo_trans_id
|
||||||
|
assign="result"
|
||||||
|
assign_code="result_code"
|
||||||
|
transactions=$linked_transactions
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{* supprimer le doc de liaison entre les lignes *}}
|
||||||
|
{{#load type="credit_link"
|
||||||
|
where="$$.immo_doc_id = :immo_doc_id AND $$.credit_line_id = :credit_line_id"
|
||||||
|
:immo_doc_id=$_GET.immo_doc_id|intval
|
||||||
|
:credit_line_id = $_GET.credit_line_id|intval
|
||||||
|
}}
|
||||||
|
{{:delete id=$id}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{:redirect
|
||||||
|
to="details_immo.html?immo_doc_id=%s&ok=1&msg=detach&"|args:$_GET.immo_doc_id}}
|
||||||
|
*}}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
Afficher les détails d'une immmo
|
Afficher les détails d'une immmo
|
||||||
|
|
@ -32,7 +31,7 @@
|
||||||
account.code as account_code,
|
account.code as account_code,
|
||||||
account.label as account_label
|
account.label as account_label
|
||||||
FROM acc_transactions_lines AS line
|
FROM acc_transactions_lines AS line
|
||||||
INNER join acc_transactions AS trans ON line.id_transaction = trans.id
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
WHERE line.id = :line_id;
|
WHERE line.id = :line_id;
|
||||||
:line_id = $info_immo.line
|
:line_id = $info_immo.line
|
||||||
|
|
@ -44,7 +43,7 @@
|
||||||
|
|
||||||
{{: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.montant}}
|
||||||
{{:assign var="info_immo.date_achat" value=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
{{: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:$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.label}}
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $info_immo.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}}
|
{{:assign var="info_immo.label" value=$info_immo.label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||||
|
|
@ -56,19 +55,21 @@
|
||||||
*}}
|
*}}
|
||||||
{{:assign linked_immos=null}}
|
{{:assign linked_immos=null}}
|
||||||
{{:assign total_credits=0}}
|
{{:assign total_credits=0}}
|
||||||
{{#load type="immo_link" where="$$.immo_doc_id=:immo_doc_id" :immo_doc_id=$_GET.immo_doc_id|intval}}
|
{{#load type="credit_link" where="$$.immo_doc_id=:immo_doc_id" :immo_doc_id=$_GET.immo_doc_id|intval}}
|
||||||
{{#select
|
{{#select
|
||||||
line.credit,
|
line.credit,
|
||||||
trans.id
|
line.id as line_id,
|
||||||
|
trans.id as trans_id,
|
||||||
|
trans.label,
|
||||||
|
trans.date
|
||||||
FROM acc_transactions_lines AS line
|
FROM acc_transactions_lines AS line
|
||||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
WHERE line.id = :credit_line_id;
|
WHERE line.id = :credit_line_id;
|
||||||
:credit_line_id=$credit_line_id
|
:credit_line_id=$credit_line_id
|
||||||
}}
|
}}
|
||||||
{{:assign credit=$credit}}
|
{{:assign credit=$credit}}
|
||||||
{{:assign credit_trans_id=$id}}
|
{{:assign var="linked_immos." trans_id=$trans_id credit_line_id=$line_id label=$label amount=$credit date=$date}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{:assign var="linked_immos." value=$credit_trans_id}}
|
|
||||||
{{if $amount == null}}
|
{{if $amount == null}}
|
||||||
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
@ -94,24 +95,48 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{:admin_header title="Détails de l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||||
|
|
||||||
|
{{*
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
|
{{:assign subsubcurrent=null}}
|
||||||
{{if $total_credits == 0 && $total_amort == 0}}
|
{{if $total_credits == 0 && $total_amort == 0}}
|
||||||
{{:assign subsubcurrent="credit"}}
|
{{:assign subsubcurrent="credit"}}
|
||||||
{{else}}
|
{{/if}}
|
||||||
{{:assign subsubcurrent=null}}
|
{{if $total_amort == 0}}
|
||||||
|
{{:assign subsubcurrent=$subsubcurrent|cat:"-modif"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:include file="_nav.html" current="index" subcurrent="details" subsubcurrent=$subsubcurrent}}
|
{{:include file="_nav.html" current="index" subcurrent="details" subsubcurrent=$subsubcurrent}}
|
||||||
{{/if}}
|
{{/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.immo_trans_id}}
|
||||||
|
|
||||||
|
<nav class="tabs">
|
||||||
|
<aside>
|
||||||
|
{{*if $total_credits == 0*}}
|
||||||
|
{{:linkbutton label="Rattacher une écriture d'immobilisation" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}}
|
||||||
|
{{*/if*}}
|
||||||
|
</aside>
|
||||||
|
<nav style="margin-bottom: 1em;">
|
||||||
|
{{*:linkbutton shape="left" label="Retour à la liste des immobilisations" href="index.html*}}
|
||||||
|
{{if $total_amort == 0}}
|
||||||
|
{{:linkbutton label="Modifier les paramètres" href="modify_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="edit" target="_dialog"}}
|
||||||
|
{{:linkbutton label="Supprimer les paramètres" href="delete_infos.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="delete" target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
|
</nav>
|
||||||
|
</nav>
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg|match:"attach_amort"}}
|
{{if $_GET.msg|match:"attach_amort"}}
|
||||||
{{:assign msg="Attachement amortissement effectué"}}
|
{{:assign msg="Écriture d'amortissement attachée"}}
|
||||||
{{elseif $_GET.msg|match:"attach_immo"}}
|
{{elseif $_GET.msg|match:"attach_immo"}}
|
||||||
{{:assign msg="Attachement avoir effectué"}}
|
{{:assign msg="Écriture au crédit attachée"}}
|
||||||
{{elseif $_GET.msg|match:"info"}}
|
{{elseif $_GET.msg|match:"info"}}
|
||||||
{{:assign msg="Données de l'immobilisation enregistrées"}}
|
{{:assign msg="Données de l'immobilisation enregistrées"}}
|
||||||
|
{{elseif $_GET.msg|match:"detach"}}
|
||||||
|
{{:assign msg="Écriture au crédit détachée"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign msg="Opération effectuée avec succès"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<p class="block confirm">{{$msg}}</p>
|
<p class="block confirm">{{$msg}}</p>
|
||||||
{{elseif $_GET.err}}
|
{{elseif $_GET.err}}
|
||||||
|
|
@ -120,31 +145,39 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<h3 class="ruler">
|
<h3 class="ruler">
|
||||||
Paramètres de l'immobilisation
|
Immobilisation
|
||||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span>
|
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span>
|
||||||
|
{{$info_immo.label}}
|
||||||
</h3>
|
</h3>
|
||||||
|
{{if $linked_immos != null}}
|
||||||
|
<aside class="right">
|
||||||
|
<table class="list">
|
||||||
|
<caption>Écritures d'avoir liées</caption>
|
||||||
|
<tbody>
|
||||||
|
{{#foreach from=$linked_immos item="line"}}
|
||||||
|
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||||
|
<tr>
|
||||||
|
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||||
|
<td>{{$line.label}}</td>
|
||||||
|
<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?credit_line_id=%d&immo_line_id=%d&immo_doc_id=%s"|args:$line.credit_line_id:$ligne_immo.immo_line_id:$_GET.immo_doc_id shape="minus"}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/foreach}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</aside>
|
||||||
|
{{/if}}
|
||||||
<div class="informations">
|
<div class="informations">
|
||||||
<dl class="describe">
|
<dl class="describe">
|
||||||
|
{{*
|
||||||
<dt>Immobilisation</dt>
|
<dt>Immobilisation</dt>
|
||||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span> {{$info_immo.label}}</dd>
|
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span><span class="label"> {{$info_immo.label}}</span></dd>
|
||||||
|
*}}
|
||||||
<dt>Compte d'immobilisation</dt>
|
<dt>Compte d'immobilisation</dt>
|
||||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||||
<dt>Montant de l'immobilisation</dt>
|
|
||||||
<dd class="money strong">{{"%f"|math:$info_immo.amount|money_currency_html:false|raw}}</dd>
|
|
||||||
{{if $total_credits > 0}}
|
|
||||||
<dt>Montant des avoirs</dt>
|
|
||||||
<dd class="money">{{"%f"|math:$total_credits|money_currency_html:false|raw}}</dd>
|
|
||||||
<dt>Écritures d'avoir</dt>
|
|
||||||
<dd>
|
|
||||||
{{#foreach from=$linked_immos item="id"}}
|
|
||||||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$id}}
|
|
||||||
<span class="num"><a href="{{$url}}">#{{$id}}</a></span>
|
|
||||||
{{/foreach}}
|
|
||||||
{{*:debug linked_immos=$linked_immos*}}
|
|
||||||
</dd>
|
|
||||||
<dt>Montant à amortir</dt>
|
|
||||||
<dd class="money strong">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
|
||||||
{{/if}}
|
|
||||||
<dt>Date d'acquisition</dt>
|
<dt>Date d'acquisition</dt>
|
||||||
<dd>{{$info_immo.date_achat|date_short}}</dd>
|
<dd>{{$info_immo.date_achat|date_short}}</dd>
|
||||||
{{if $info_immo.date_mes != null && $info_immo.date_mes != $info_immo.date_achat}}
|
{{if $info_immo.date_mes != null && $info_immo.date_mes != $info_immo.date_achat}}
|
||||||
|
|
@ -153,7 +186,28 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<dt>Durée d'amortissement</dt>
|
<dt>Durée d'amortissement</dt>
|
||||||
<dd>{{$info_immo.duration}} ans</dd>
|
<dd>{{$info_immo.duration}} ans</dd>
|
||||||
|
<dt>Montant de l'immobilisation</dt>
|
||||||
|
<dd class="money">{{"%f"|math:$info_immo.amount|money_currency_html:false|raw}}</dd>
|
||||||
|
{{if $total_credits > 0}}
|
||||||
|
<dt>Montant des avoirs</dt>
|
||||||
|
<dd class="money">{{"%f"|math:$total_credits|money_currency_html:false|raw}}</dd>
|
||||||
|
{{*
|
||||||
|
<dt>Écritures d'avoir</dt>
|
||||||
|
<dd>
|
||||||
|
{{#foreach from=$linked_immos item="line"}}
|
||||||
|
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.id}}
|
||||||
|
<span class="num"><a href="{{$url}}">#{{$line.id}}</a></span>
|
||||||
|
{{/foreach}}
|
||||||
|
</dd>
|
||||||
|
*}}
|
||||||
|
<dt>Montant à amortir</dt>
|
||||||
|
<dd class="money">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
||||||
|
{{/if}}
|
||||||
|
{{if $total_amort > 0}}
|
||||||
<dt>Montant des amortissements</dt>
|
<dt>Montant des amortissements</dt>
|
||||||
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
<dd>{{$total_amort|money_currency_html:false|raw}}</dd>
|
||||||
|
<dt>Valeur nette comptable</dt>
|
||||||
|
<dd>{{"%d-%d-%d"|math:$info_immo.amount:$total_credits:$total_amort|money_currency_html:false|raw}}</dd>
|
||||||
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -91,22 +91,30 @@
|
||||||
{{:assign date_mes=null}}
|
{{:assign date_mes=null}}
|
||||||
{{:assign status="ignored"}}
|
{{:assign status="ignored"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if $_POST.date_achat == null || $_POST.date_achat|parse_date == $ligne_immo.date_achat}}
|
|
||||||
{{:assign date_achat=null}}
|
|
||||||
{{elseif $_POST.date_achat|parse_date == $info_immo.date_achat}}
|
|
||||||
{{:assign date_achat=$info_immo.date_achat}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign date_achat=$_POST.date_achat|parse_date}}
|
|
||||||
{{/if}}
|
|
||||||
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
||||||
{{:assign da=$ligne_immo.date_achat|date_short}}
|
{{:assign da=$ligne_immo.date_achat|date_short}}
|
||||||
{{:error message="Erreur : la date d'achat (%s) ne peut être postérieure à la date de l'écriture d'immobilisation (%s)"|args:$_POST.date_achat:$da}}
|
{{:error message="Erreur : la date d'achat (%s) ne peut être postérieure à la date de l'écriture d'immobilisation (%s)"|args:$_POST.date_achat:$da}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $_POST.date_mes == null || $_POST.date_mes|parse_date == $ligne_immo.date_achat}}
|
{{if $_POST.date_achat == null || $_POST.date_achat|parse_date == $info_immo.date_achat}}
|
||||||
{{:assign date_mes=null}}
|
{{:assign date_achat=$info_immo.date_achat}}
|
||||||
|
{{elseif $_POST.date_achat|parse_date == $ligne_immo.date_achat}}
|
||||||
|
{{:assign date_achat=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign date_achat=$_POST.date_achat|parse_date}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* TODO : simplifier ? *}}
|
||||||
|
{{if $_POST.date_mes == null || $_POST.date_mes|parse_date == $info_immo.date_mes}}
|
||||||
|
{{:assign date_mes=$info_immo.date_mes}}
|
||||||
{{elseif $_POST.date_mes|parse_date == $info_immo.date_achat}}
|
{{elseif $_POST.date_mes|parse_date == $info_immo.date_achat}}
|
||||||
{{:assign date_mes=null}}
|
{{:assign date_mes=null}}
|
||||||
|
{{elseif $_POST.date_mes|parse_date == $ligne_immo.date_achat}}
|
||||||
|
{{if $info_immo.date_achat == null}}
|
||||||
|
{{:assign date_mes=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign date_mes=$ligne_immo.date_achat}}
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign date_mes=$_POST.date_mes|parse_date}}
|
{{:assign date_mes=$_POST.date_mes|parse_date}}
|
||||||
{{:assign date_achat_comp=$ligne_immo.date_achat}}
|
{{:assign date_achat_comp=$ligne_immo.date_achat}}
|
||||||
|
|
@ -250,7 +258,7 @@
|
||||||
{{:input type="text" name="libelle" label="Libellé" default=$info_immo.label}}
|
{{:input type="text" name="libelle" label="Libellé" default=$info_immo.label}}
|
||||||
{{if $info_immo.amount != null}}
|
{{if $info_immo.amount != null}}
|
||||||
{{:assign max_aff="%f"|math:$max_disponible|money_currency:false}}
|
{{:assign max_aff="%f"|math:$max_disponible|money_currency:false}}
|
||||||
{{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum = %s"|args:$max_aff}}
|
{{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum : %s"|args:$max_aff}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat}}
|
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat}}
|
||||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes}}
|
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes}}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@
|
||||||
|
|
||||||
{{#load id=$_GET.immo_doc_id|intval assign="info_immo"}}
|
{{#load id=$_GET.immo_doc_id|intval assign="info_immo"}}
|
||||||
{{:assign duree=$duration}}
|
{{:assign duree=$duration}}
|
||||||
|
{{if $date_achat != null}}
|
||||||
|
{{:assign date_debut=$date_achat}}
|
||||||
|
{{/if}}
|
||||||
{{if $date_mes != null}}
|
{{if $date_mes != null}}
|
||||||
{{:assign date_debut=$date_mes}}
|
{{:assign date_debut=$date_mes}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -42,6 +45,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Informations de l'immobilisation « %s » non trouvées ; vous devez d'abord les renseigner"|args:$ligne_immo.label}}
|
{{:error message="Informations de l'immobilisation « %s » non trouvées ; vous devez d'abord les renseigner"|args:$ligne_immo.label}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $amort_label}}
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $amort_label}}
|
||||||
{{:assign amort_label=$amort_label|cat:" — "|cat:$ligne_immo.line_label}}
|
{{:assign amort_label=$amort_label|cat:" — "|cat:$ligne_immo.line_label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -83,6 +87,7 @@
|
||||||
{{#select
|
{{#select
|
||||||
line.credit,
|
line.credit,
|
||||||
trans.date as amort_date,
|
trans.date as amort_date,
|
||||||
|
COALESCE(trans.label, line.label) as amort_label,
|
||||||
account.code as account_code,
|
account.code as account_code,
|
||||||
account.label as account_label
|
account.label as account_label
|
||||||
FROM acc_transactions_lines AS line
|
FROM acc_transactions_lines AS line
|
||||||
|
|
@ -106,6 +111,7 @@
|
||||||
{{:assign date_debut=$line.amort_date}}
|
{{:assign date_debut=$line.amort_date}}
|
||||||
{{:assign code_amort=$line.account_code}}
|
{{:assign code_amort=$line.account_code}}
|
||||||
{{:assign amort_account_label=$line.account_label}}
|
{{:assign amort_account_label=$line.account_label}}
|
||||||
|
{{:assign amort_label=$amort_label}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
{{if $valeur_residuelle == 0}}
|
{{if $valeur_residuelle == 0}}
|
||||||
|
|
|
||||||
|
|
@ -98,3 +98,12 @@ html.dark .block.alert {
|
||||||
span.input-list.avoirs label {
|
span.input-list.avoirs label {
|
||||||
padding : 0.4rem 0.6rem;
|
padding : 0.4rem 0.6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aside.right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.label {
|
||||||
|
font-size : 120%;
|
||||||
|
font-weight : bold;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue