Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75cb25fbb9 | ||
|
|
4f1b0ffead | ||
|
|
3173b06cf1 | ||
|
|
d149a85018 |
8 changed files with 198 additions and 199 deletions
|
|
@ -4,11 +4,13 @@
|
|||
<p class="block help">
|
||||
Cet onglet liste les immobilisations sorties du bilan car elles ne
|
||||
sont plus utilisées dans l'association (vétusté, fin de vie,
|
||||
vente, cession...).
|
||||
vente...).
|
||||
</p>
|
||||
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
|
||||
{{if $module.table != null}}
|
||||
|
||||
{{* lister les immobilisations *}}
|
||||
{{:assign account_condition="("}}
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
|
|
@ -16,16 +18,16 @@
|
|||
{{:assign account_condition=$account_condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign account_condition=$account_condition|cat:"0)"}}
|
||||
{{:assign status_condition="($$.status = 'archived')"}}
|
||||
|
||||
{{:assign filter_condition=" AND NOT ("}}
|
||||
{{:assign filter_condition=" ("}}
|
||||
{{#foreach from=$module.config.filters item="filter"}}
|
||||
{{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}}
|
||||
{{:assign filter_condition=$filter_condition|cat:" trans_label LIKE "|cat:$filter|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign filter_condition=$filter_condition|cat:"0)"}}
|
||||
{{:assign condition=$account_condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"|cat:$filter_condition}}
|
||||
{{:assign condition=$account_condition|cat:" AND debit > 0 AND NOT (trans.status & 16) AND NOT "|cat:$filter_condition|cat:" AND "|cat:$status_condition}}
|
||||
|
||||
{{:assign nb_immo=0}}
|
||||
{{:assign total_cessions = 0}}
|
||||
|
||||
{{#select
|
||||
|
|
@ -38,32 +40,31 @@
|
|||
line.debit AS debit,
|
||||
account.id as account_id,
|
||||
account.code as account_code,
|
||||
account.label as account_label
|
||||
account.label as account_label,
|
||||
info.id as immo_doc_id,
|
||||
$$.label as doc_label,
|
||||
$$.amount as doc_amount,
|
||||
$$.date_achat as doc_date_achat,
|
||||
$$.date_mes as doc_date_mes,
|
||||
$$.status as status
|
||||
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
|
||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||
INNER JOIN !table AS info ON $$.line = line.id
|
||||
WHERE !condition
|
||||
ORDER BY trans.date DESC;
|
||||
!table=$module.table
|
||||
!condition=$condition
|
||||
assign="immo_line"
|
||||
}}
|
||||
|
||||
{{* voir si l'immo est prise en charge *}}
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_line_id assign="info_immo"}}
|
||||
{{:assign status=$status}}
|
||||
{{else}}
|
||||
{{:assign status=null}}
|
||||
{{/load}}
|
||||
{{if $status != "archived"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
{{:assign var="immo_line.date_mes" value=$info_immo.date_mes|or:$trans_date}}
|
||||
{{:assign var="immo_line.montant_immo" value=$debit}}
|
||||
{{:assign var="immo_line.date_mes" value=$doc_date_mes|or:$doc_date_achat|or:$trans_date}}
|
||||
{{:assign var="immo_line.montant_immo" value=$doc_amount|or:$debit}}
|
||||
|
||||
{{* chercher le doc de sortie du bilan *}}
|
||||
{{:assign var="immo_line.exit_date" value=null}}
|
||||
{{#load type="exit_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id=$info_immo.id}}
|
||||
{{#load type="exit_link" where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id=$immo_doc_id}}
|
||||
{{:assign exit_line_id=$exit_line_id}}
|
||||
{{#select
|
||||
trans.date
|
||||
|
|
@ -81,7 +82,7 @@
|
|||
{{:assign total_credits=0}}
|
||||
{{#load
|
||||
type="credit_link"
|
||||
where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id = $info_immo.id
|
||||
where="$$.immo_doc_id = :immo_doc_id" :immo_doc_id = $immo_doc_id
|
||||
}}
|
||||
{{if $amount == null}}
|
||||
{{#select credit FROM acc_transactions_lines WHERE id = :credit_line_id;
|
||||
|
|
@ -94,37 +95,28 @@
|
|||
{{/if}}
|
||||
{{/load}}
|
||||
{{:assign solde_immo="%d-%d"|math:$immo_line.montant_immo:$total_credits}}
|
||||
|
||||
{{if $solde_immo == 0}}
|
||||
{{:assign status="archived"}}
|
||||
{{/if}}
|
||||
|
||||
{{if $status != "archived"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
|
||||
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$immo_line.montant_immo}}
|
||||
|
||||
{{* voir s'il y a une écriture de cession associée à cette immo *}}
|
||||
{{#select
|
||||
trans.id,
|
||||
line.debit
|
||||
FROM acc_transactions_links AS link
|
||||
INNER JOIN acc_transactions AS trans ON (CASE
|
||||
WHEN link.id_transaction = :trans_id THEN link.id_related
|
||||
WHEN link.id_related = :trans_id THEN link.id_transaction
|
||||
END) = trans.id
|
||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
INNER JOIN acc_accounts AS acc ON line.id_account = acc.id
|
||||
WHERE (link.id_transaction = :trans_id OR link.id_related = :trans_id) AND acc.code = 462
|
||||
trans.id as cession_id,
|
||||
trans.label,
|
||||
line.id as line_id,
|
||||
line.credit
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
INNER JOIN !table AS cession_link ON json_extract(cession_link.document, '$.cession_line_id') = line.id
|
||||
INNER JOIN !table AS immo_doc ON json_extract(cession_link.document, '$.immo_doc_id') = immo_doc.id
|
||||
WHERE json_extract(immo_doc.document, '$.line') = :immo_line_id
|
||||
;
|
||||
:trans_id = $trans_id
|
||||
!table=$module.table
|
||||
:immo_line_id = $immo_line.immo_line_id
|
||||
assign="cession_line"
|
||||
}}
|
||||
{{:assign var="montant" from="montant_cessions.%d"|args:$account_code}}
|
||||
{{:assign var="montant_cessions.%d"|args:$account_code value="%d+%d"|math:$montant:$debit}}
|
||||
{{:assign total_cessions="%d+%d"|math:$total_cessions:$debit}}
|
||||
{{:assign var="montant_cessions.%d"|args:$account_code value="%d+%d"|math:$montant:$credit}}
|
||||
{{:assign total_cessions="%d+%d"|math:$total_cessions:$credit}}
|
||||
{{/select}}
|
||||
{{:assign var="immo_lines." value=$immo_line}}
|
||||
{{/select}}
|
||||
|
|
@ -151,17 +143,20 @@
|
|||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
||||
{{:assign total_immo="%d+%d"|math:$total_immo:$montant_immo}}
|
||||
|
||||
{{:assign label_immo=$doc_label|or:$trans_label}}
|
||||
{{if $label_immo|strpos:$line_label === false}}
|
||||
{{:assign label_immo=$label_immo|cat:" — "|cat:$line_label}}
|
||||
{{/if}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$trans_id}}</a></td>
|
||||
<td>{{$date_mes|date_short}}</td>
|
||||
<td>{{$exit_date|date_short}}</td>
|
||||
<td>{{$trans_label}}{{if $line_label != null && $line_label != $trans_label}} — {{$line_label}}{{/if}}</td>
|
||||
<td>{{$label_immo}}</td>
|
||||
<td class="money">{{"%f"|math:$montant_immo|money_html:false|raw}}</td>
|
||||
<td><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td class="actions">
|
||||
{{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s&from=exit"|args:$info_immo.id shape="edit"}}
|
||||
{{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s&from=exit"|args:$immo_doc_id shape="edit"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
|
|
@ -224,6 +219,8 @@
|
|||
</tfoot>
|
||||
</table>
|
||||
</section>
|
||||
{{else}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $immo_lines|count == 0 || $module.table == null}}
|
||||
<p class="block alert">Aucune immobilisation</p>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@
|
|||
|
||||
{{:assign ts_debut=$date_debut|strtotime}}
|
||||
{{:assign ts_fin=$date_fin|strtotime}}
|
||||
{{:assign nbjours="1+abs(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
||||
{{:assign nbjours="round(1+abs(%d-%d)/(60*60*24), 0)"|math:$ts_fin:$ts_debut}}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
id_transaction
|
||||
FROM acc_transactions_lines
|
||||
WHERE id = :line_id;
|
||||
:line_id = $line_id|intval
|
||||
:line_id = $line_id
|
||||
}}
|
||||
{{:assign trans_id=$id_transaction}}
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@
|
|||
exit_line_id=$_GET.exit_line_id|intval
|
||||
}}
|
||||
|
||||
{{:redirect to="exit_step4.html?immo_doc_id=%s&from=exit&ok=1&msg=attach_exit"|args:$_GET.immo_doc_id}}
|
||||
{{:redirect force="exit_step4.html?immo_doc_id=%s&from=exit&ok=1&msg=attach_exit"|args:$_GET.immo_doc_id}}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
{{:include file="_nav.html" current=$type_immo}}
|
||||
|
||||
{{* Mise à niveau *}}
|
||||
{{:assign module_version="0.40.3"}}
|
||||
{{:assign module_version="0.40.4"}}
|
||||
{{:include file="upgrade.html" module_version=$module_version}}
|
||||
|
||||
{{* supprimer les documents sans écriture associée *}}
|
||||
|
|
|
|||
|
|
@ -120,8 +120,6 @@
|
|||
{{/if}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{:assign choix_defaut=$_GET.type_immo}}
|
||||
|
||||
{{*
|
||||
modifier la date de mise en service, les écritures associées ou la durée d'amortissement
|
||||
*}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
name="Amortissements"
|
||||
description="Immobilisations et amortissements\nversion 0.40.3"
|
||||
description="Immobilisations et amortissements\nversion 0.40.4"
|
||||
author="Jean-Christophe Engel"
|
||||
author_url="https://gitea.zaclys.com/lesanges"
|
||||
home_button=false
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@
|
|||
{{:assign amort_label=$line_label|or:$trans_label}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* date de début du 1er exercice dans paheko *}}
|
||||
{{#years order="start_date" limit=1}}
|
||||
{{:assign first_date=$start_date}}
|
||||
{{/years}}
|
||||
|
||||
{{if $total_amort == 0}}
|
||||
{{* 1er amortissement *}}
|
||||
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
|
||||
|
|
@ -55,9 +60,11 @@
|
|||
{{:assign var=libelle value="Amortissement %s"|args:$ligne_immo.trans_label}}
|
||||
{{else}}
|
||||
{{* amortissements suivants *}}
|
||||
{{if $date_debut != $first_date}}
|
||||
{{:assign date_debut=$date_debut|strtotime}}
|
||||
{{:assign date_debut="%d+(60*60*24)"|math:$date_debut|date:"Y-m-d"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
lister les exercices qui englobent la date de mise en service de l'immo
|
||||
|
|
@ -244,9 +251,6 @@
|
|||
{{:input type="text" name="designation" label="Libellé" required=true default=$amort_label size="50"}}
|
||||
{{if $total_amort == 0 || $nbjours < 365 || $nbjours > 366}}
|
||||
{{:assign msg="Montant calculé au prorata du nombre de jours d'amortissement dans l'exercice"}}
|
||||
{{if $nbjours != null}}
|
||||
{{:assign msg=$msg|cat:" (%s)"|args:$nbjours}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:input type="money" name="montant" label="Montant" required=true default=$montant_amort help=$msg}}
|
||||
{{:input
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue