Compare commits
2 commits
main
...
incorporat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54273c6707 | ||
|
|
f1738f2197 |
23 changed files with 225 additions and 136 deletions
|
|
@ -148,7 +148,7 @@
|
|||
{{:assign label_immo=$label_immo|cat:" — "|cat:$line_label}}
|
||||
{{/if}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$trans_id}}</a></td>
|
||||
<td>{{$date_mes|date_short}}</td>
|
||||
<td>{{$exit_date|date_short}}</td>
|
||||
<td>{{$label_immo}}</td>
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@
|
|||
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$montant_immo}}
|
||||
|
||||
<tr>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$immo_trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$immo_trans_id}}</a></td>
|
||||
<td>{{$immo_date|date_short}}</td>
|
||||
<td>{{$label_immo}}</td>
|
||||
<td class="money">{{$montant_immo|money_html:false|raw}}</td>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
{{else}}
|
||||
{{:assign unhide=1}}
|
||||
{{/if}}
|
||||
{{:assign var="user_hides.unhide_other" value=$unhide}}
|
||||
{{:assign var="user_hides.unhide_other" value=$unhide"}}
|
||||
{{:assign var="saved_hides.%s"|args:$logged_user.id value=$user_hides}}
|
||||
{{:save key="config" hides=$saved_hides}}
|
||||
{{/if}}
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
{{:assign checked="checked"}}
|
||||
{{/if}}
|
||||
|
||||
{{* vérifier l'existence de la table du module' *}}
|
||||
{{* vérifier l'existence de la table du module *}}
|
||||
{{if $module.table != null}}
|
||||
{{:assign columns="$$.status as status, SUM($$.amount) as amount,"}}
|
||||
{{:assign table_join="LEFT JOIN !table AS info ON $$.line = line.id"}}
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
{{*
|
||||
lister les immobilisations non prises en charge par le module
|
||||
ou dont le montant n'a pas été totalement affecté'
|
||||
ou dont le montant n'a pas été totalement affecté
|
||||
*}}
|
||||
{{:assign account_condition="("}}
|
||||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
|
|
@ -137,7 +137,7 @@
|
|||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.trans_id_year}}
|
||||
{{:assign reste="%d-%d"|math:$line.debit:$line.amount}}
|
||||
<tr {{if $status == "ignored"}}class="ignored"{{/if}}>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$line.immo_trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$line.immo_trans_id}}</a></td>
|
||||
<td class="nombre">{{$line.immo_line_id}}</td>
|
||||
<td>{{$trans_date|date_short}}</td>
|
||||
<td>{{$line.trans_label}}{{if $line.line_label != null && $line.line_label != $line.trans_label}} — {{$line.line_label}}{{/if}}</td>
|
||||
|
|
|
|||
130
_unfinished.html
130
_unfinished.html
|
|
@ -9,6 +9,15 @@
|
|||
la construction d'un bâtiment destiné à être amorti)
|
||||
</p>
|
||||
|
||||
{{#form on="transfer"}}
|
||||
{{if $_POST.selected == null}}
|
||||
<p class="block error">Vous n'avez sélectionné aucune écriture !</p>
|
||||
{{else}}
|
||||
{{:assign doc_list=$_POST.selected|implode:","}}
|
||||
{{:redirect to="transfer.html?doc=%s"|args:$doc_list}}
|
||||
{{/if}}
|
||||
{{/form}}
|
||||
|
||||
{{:include file="_get_config.html" keep="module.config"}}
|
||||
{{:assign saved_hides=$module.config.hides}}
|
||||
{{:assign var="user_hides" from="saved_hides.%s"|args:$logged_user.id}}
|
||||
|
|
@ -64,57 +73,83 @@
|
|||
account.id as account_id,
|
||||
account.code as account_code,
|
||||
account.label as account_label,
|
||||
sum(line.debit) AS debit,
|
||||
line.debit AS debit,
|
||||
trans.id_year as trans_id_year
|
||||
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
|
||||
WHERE !condition
|
||||
GROUP BY trans.id
|
||||
ORDER BY trans.date DESC;
|
||||
!condition=$condition
|
||||
assign="immo_line"
|
||||
}}
|
||||
{{* voir si l'écriture a été marquée ignorée *}}
|
||||
{{:assign var="immo_line.ignore" value=false}}
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id AND $$.status = 'ignored'" :line_id=$immo_line_id|intval}}
|
||||
{{:assign var="immo_line.ignore" value=true}}
|
||||
{{* document associé *}}
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_line_id assign="info_immo"}}
|
||||
{{:assign var="immo_line.doc_id" value=$info_immo.id}}
|
||||
{{* *}}
|
||||
{{if $status == "unfinished"}}
|
||||
{{* voir si l'immo a été ventilée *}}
|
||||
{{:assign var="immo_line.allocated_amount" value=0}}
|
||||
{{#load type="immo" where="$$.line = :immo_line_id AND ($$.status = 'inprogress' OR $$.status = "transferred")" :immo_line_id=$immo_line_id}}
|
||||
{{:assign var="immo_line.allocated_amount" value="%d+%d"|math:$immo_line.allocated_amount:$amount}}
|
||||
{{/load}}
|
||||
{{elseif $status == 'ignored'}}
|
||||
{{:assign nb_ignored="%d + 1"|math:$nb_ignored}}
|
||||
{{if $unhide == null}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{* cas d'une immo sans doc associé => créer le doc *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="asset.schema.json"
|
||||
type="immo"
|
||||
line=$immo_line_id|intval
|
||||
duration=0
|
||||
status="unfinished"
|
||||
assign_new_id="immo_doc_id"
|
||||
}}
|
||||
{{:assign var="immo_line.doc_id" value=$immo_doc_id|intval}}
|
||||
{{/load}}
|
||||
{{if $immo_line.ignore}}
|
||||
{{:assign nb_ignored="%d + 1"|math:$nb_ignored}}
|
||||
{{/if}}
|
||||
{{if $immo_line.ignore && $unhide == null}}
|
||||
|
||||
{{if $info_immo.status == 'transferred'}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
TODO cas où :
|
||||
- il y a (au moins) une écriture d'avoir
|
||||
*}}
|
||||
|
||||
{{* voir s'il existe une écriture qui solde l'immobilisation (voir ci-dessus) *}}
|
||||
{{#select
|
||||
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 count=$count}}
|
||||
{{/select}}
|
||||
|
||||
{{* S'il y a plus d'une écriture de même montant on ne peut pas décider *}}
|
||||
{{if $count == 1}}
|
||||
{{if $immo_line.allocated_amount == $debit}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign var="immo_lines." value=$immo_line}}
|
||||
{{/select}}
|
||||
|
||||
{{* lister les immos incorporées de la balance d'ouverture *}}
|
||||
{{#load type="immo" where="$$.status='inprogress'" assign="unfinished_immo"}}
|
||||
{{* chercher l'écriture dont est tirée l'immo *}}
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
line.id as immo_line_id,
|
||||
account.id as account_id,
|
||||
account.code as account_code,
|
||||
account.label as account_label,
|
||||
trans.id_year as trans_id_year
|
||||
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
|
||||
WHERE line.id = :unfinished_immo_line;
|
||||
:unfinished_immo_line = $unfinished_immo.line
|
||||
assign="immo_line"
|
||||
}}
|
||||
{{:assign var="immo_line.trans_label" value=$unfinished_immo.label}}
|
||||
{{:assign var="immo_line.trans_date" value=$unfinished_immo.date_achat}}
|
||||
{{:assign var="immo_line.debit" value=$unfinished_immo.amount}}
|
||||
{{:assign var="immo_line.doc_id" value=$id}}
|
||||
{{:assign var="immo_lines." value=$immo_line}}
|
||||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
<form method="post" action="">
|
||||
{{if $immo_lines|count > 0}}
|
||||
<fieldset class="shortFormLeft">
|
||||
|
|
@ -133,9 +168,10 @@
|
|||
</div>
|
||||
<div>
|
||||
<p class="submit">
|
||||
{{:linkbutton
|
||||
{{:button
|
||||
type="submit"
|
||||
name="transfer"
|
||||
label="Transférer"
|
||||
href="transfer.html?trans="
|
||||
shape="right"
|
||||
id="transfer"
|
||||
}}
|
||||
|
|
@ -148,7 +184,6 @@
|
|||
{{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher les écritures ignorées" }}
|
||||
</fieldset>
|
||||
{{/if}}
|
||||
</form>
|
||||
|
||||
{{if $immo_lines|count > 0}}
|
||||
<section class="immobilisation">
|
||||
|
|
@ -160,6 +195,8 @@
|
|||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
<th class="nombre">Montant</th>
|
||||
<th class="nombre">Affecté</th>
|
||||
<th class="nombre">Reste</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th class="actions"></th>
|
||||
|
|
@ -174,21 +211,24 @@
|
|||
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
|
||||
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
|
||||
{{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}}
|
||||
{{:assign var="row_value" value=$trans_id|cat:"_"|cat:$doc_id}}
|
||||
|
||||
<tr {{if $ignore}}class="checked"{{/if}}>
|
||||
<td class="check">{{:input type="checkbox" name="selected[]" value=$trans_id}}</td>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$trans_id}}</a></td>
|
||||
<tr {{if $ignore}}class="checked"{{/if}}{{if $allocated_amount > 0}}class="strong"{{/if}}>
|
||||
<td class="check">{{:input type="checkbox" name="selected[]" value=$doc_id}}</td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$trans_id}}</a></td>
|
||||
<td>{{$trans_date|date_short}}</td>
|
||||
<td>{{$trans_label}}</td>
|
||||
<td class="money">{{"%f"|math:$debit|money_html:false|raw}}</td>
|
||||
<td class="money">{{"%f"|math:$allocated_amount|money_html:false|raw}}</td>
|
||||
<td class="money remainder">{{"%f-%f"|math:$debit:$allocated_amount|money_html:false|raw}}</td>
|
||||
<td class="account_code"><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td class="actions">
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="ignore.html?immo_line_id=%s"|args:$immo_line_id
|
||||
shape="edit"
|
||||
target="_dialog"
|
||||
label="Paramètres"
|
||||
href="add_infos.html?immo_line_id=%s"|args:$immo_line_id
|
||||
shape="settings"
|
||||
target="_dialog"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -226,6 +266,7 @@
|
|||
{{else}}
|
||||
<p class="block alert">Aucune écriture d'immobilisation trouvée dans la comptabilité (compte {{$first_code}} et sous-comptes)</p>
|
||||
{{/if}}
|
||||
</form>
|
||||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript" async="async">
|
||||
|
|
@ -244,7 +285,10 @@ function changeVisibility(evt, idcheck = 'f_unhide_1') {
|
|||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_unhide_1').onclick = changeVisibility;
|
||||
let unhide_button = document.getElementById('f_unhide_1');
|
||||
if (unhide_button != null) {
|
||||
unhide_button.onclick = changeVisibility;
|
||||
}
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
{{*
|
||||
Classer une immobilisation non prise en charge
|
||||
@param immo_line_id
|
||||
|
|
@ -53,12 +54,12 @@
|
|||
{{:assign status="ignored"}}
|
||||
{{elseif $_POST.classify == "archived"}}
|
||||
{{* voir s'il y a déjà un doc associé à cette immo *}}
|
||||
{{#load type="immo" where="$$.line = :immo_line_id" :immo_line_id=$_GET.immo_line_id|intval}}
|
||||
{{:assign uuid=$key}}
|
||||
{{:assign immo_doc_id=$id}}
|
||||
{{if $info_immo != null}}
|
||||
{{:assign uuid=$info_immo.key}}
|
||||
{{:assign immo_doc_id=$info_immo.id}}
|
||||
{{else}}
|
||||
{{:assign uuid=""|uuid}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{* immobilisation sortie du bilan *}}
|
||||
{{:save
|
||||
|
|
@ -71,7 +72,7 @@
|
|||
assign_new_id="immo_doc_id"
|
||||
}}
|
||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&from=exit"|args:$immo_doc_id}}
|
||||
{{else}}
|
||||
{{elseif $_POST.classify == "managed"}}
|
||||
{{* immobilisation amortissable *}}
|
||||
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
||||
{{:assign da=$ligne_immo.date_achat|date_short}}
|
||||
|
|
@ -124,12 +125,46 @@
|
|||
{{:assign montant_nb="%f"|math:$montant|money_currency:false}}
|
||||
{{:error message="Le montant (%s) ne peut être supérieur au reste (%s)"|args:$montant_nb:$reste_nb}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign status="managed"}}
|
||||
{{elseif $_POST.classify == "unfinished"}}
|
||||
{{* immobilisation en cours de constitution *}}
|
||||
{{if $_POST.date_achat|parse_date > $ligne_immo.date_achat}}
|
||||
{{: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}}
|
||||
{{/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.libelle != $ligne_immo.line_label && $_POST.libelle != $ligne_immo.trans_label}}
|
||||
{{:assign libelle=$_POST.libelle}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_POST.montant == null || $_POST.montant|money_int == 0 }}
|
||||
{{if $montant_affecte > 0}}
|
||||
{{:assign montant=$reste}}
|
||||
{{else}}
|
||||
{{:assign montant=null}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign montant=$_POST.montant|money_int}}
|
||||
{{if $montant == $ligne_immo.montant}}
|
||||
{{:assign montant=null}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $montant > $reste}}
|
||||
{{:assign reste_nb="%f"|math:$reste|money_currency:false}}
|
||||
{{:assign montant_nb="%f"|math:$montant|money_currency:false}}
|
||||
{{:error message="Le montant (%s) ne peut être supérieur au reste (%s)"|args:$montant_nb:$reste_nb}}
|
||||
{{/if}}
|
||||
{{:assign status="inprogress"}}
|
||||
{{/if}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{if $info_immo == null || $montant_affecte > 0}}
|
||||
{{if $info_immo == null || $_POST.classify == "unfinished" || $montant_affecte > 0}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{else}}
|
||||
{{:assign key=$info_immo.key}}
|
||||
|
|
@ -139,7 +174,7 @@
|
|||
validate_schema="asset.schema.json"
|
||||
type="immo"
|
||||
line=$_GET.immo_line_id|intval
|
||||
duration=$duration
|
||||
duration=0
|
||||
label=$libelle
|
||||
amount=$montant
|
||||
date_achat=$date_achat
|
||||
|
|
@ -149,13 +184,14 @@
|
|||
|
||||
{{if $_POST.classify == "managed"}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{elseif $_POST.classify == "unfinished"}}
|
||||
{{:assign type_immo="unfinished"}}
|
||||
{{else}}
|
||||
{{:assign type_immo="other"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=%s"|args:$type_immo}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="other" subcurrent="parameter"}}
|
||||
|
|
@ -178,7 +214,7 @@
|
|||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd>
|
||||
<span class="num"><a href="{{$trans_url}}">{{$ligne_immo.immo_trans_id}}</a> </span>{{$immo_label}}
|
||||
<span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a> </span>{{$immo_label}}
|
||||
</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
||||
|
|
@ -194,14 +230,19 @@
|
|||
<dd>{{$ligne_immo.code}} — {{$ligne_immo.account_label}}
|
||||
</dl>
|
||||
</div>
|
||||
{{:assign unfinished_prefix=$ligne_immo.code|strpos:"23"}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Classement</legend>
|
||||
<dl id="classement_immo">
|
||||
<dt><label>Faites un choix</label> <b>(obligatoire)</b></dt>
|
||||
{{:input type="radio-btn" name="classify" value="managed" label="Immobilisation à amortir" default=$choix_defaut}}
|
||||
{{if $ligne_immo.date_achat > $first_date}}
|
||||
{{if $unfinished_prefix === 0}}
|
||||
{{:input type="radio-btn" name="classify" value="unfinished" label="Immobilisation en cours de constitution" default=$choix_defaut}}
|
||||
{{else}}
|
||||
{{:input type="radio-btn" name="classify" value="managed" label="Immobilisation à amortir" default=$choix_defaut}}
|
||||
{{/if}}
|
||||
{{if $ligne_immo.date_achat > $first_date && $unfinished_prefix !== 0}}
|
||||
{{:input type="radio-btn" name="classify" value="archived" label="Immobilisation sortie du bilan" default=$choix_defaut}}
|
||||
{{/if}}
|
||||
{{:input type="radio-btn" name="classify" value="ignored" label="Immobilisation à ignorer" help="L'écriture n'apparaitra plus dans la liste des immobilisations" default=$choix_defaut}}
|
||||
|
|
@ -214,8 +255,10 @@
|
|||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$date_achat_defaut help="à modifier si nécessaire"}}
|
||||
{{:input type="text" name="libelle" label="Libellé" default=$immo_label help="à modifier si nécessaire"}}
|
||||
{{:input type="money" name="montant" label="Montant de l'immobilisation" required=true default=$reste help="à modifier si différent du montant de l'écriture d'immobilisation"}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 suffix="année(s)"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_mes_defaut help="à modifier si différente de la date d'acquisition"}}
|
||||
{{if $unfinished_prefix !== 0}}
|
||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 suffix="année(s)"}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$date_mes_defaut help="à modifier si différente de la date d'acquisition"}}
|
||||
{{/if}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
|
@ -234,7 +277,8 @@
|
|||
function toggleInputs(event) {
|
||||
const classement_immo = document.getElementById('classement_immo');
|
||||
const managed = classement_immo.querySelector('input[type=radio][value=managed]');
|
||||
if (managed.checked) {
|
||||
const unfinished = classement_immo.querySelector('input[type=radio][value=unfinished]');
|
||||
if ((managed != null && managed.checked) || (unfinished != null && unfinished.checked)) {
|
||||
g.toggle('.masquable', true);
|
||||
} else {
|
||||
g.toggle('.masquable', false);
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||
<dt>Début d'amortissement</dt>
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
{{#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 class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>{{$line.label}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
|
|
@ -260,7 +260,7 @@
|
|||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
{{:assign solde="%f-%d"|math:$solde:$line.amount}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$line.trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>
|
||||
{{$line.trans_label}}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
},
|
||||
"status" : {
|
||||
"type" : ["string", "null"],
|
||||
"enum" : ["managed", "amortized", "archived", "ignored"]
|
||||
"enum" : ["managed", "amortized", "archived", "unfinished", "ignored", "inprogress", "transferred"]
|
||||
},
|
||||
"created" : {
|
||||
"description" : "vrai si immobilisation créée dans le module",
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@
|
|||
<dt>Immobilisation</dt>
|
||||
<dd>{{$label_immo}}</dd>
|
||||
<dt>Amortissement</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$amort_line.trans_id}}</a></span> {{$amort_label}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$amort_line.trans_id}}</a></span> {{$amort_label}}</dd>
|
||||
<dt>Montant de l'écriture d'amortissement</dt>
|
||||
<dd>{{$amort_line.amount|money_currency_html:false|raw}}</dd>
|
||||
{{if $montant_affecte > 0}}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
<dt>Immobilisation</dt>
|
||||
<dd>{{$label_immo}}</dd>
|
||||
<dt>Écriture au crédit du compte d'immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$credit_trans_url}}">{{$credit_line.trans_id}}</a></span> {{$credit_line.trans_label}}{{if $credit_line.line_label != null && $credit_line.line_label != $credit_line.trans_label}} — {{$credit_line.line_label}}{{/if}}</dd>
|
||||
<dd><span class="num"><a href="{{$credit_trans_url}}">#{{$credit_line.trans_id}}</a></span> {{$credit_line.trans_label}}{{if $credit_line.line_label != null && $credit_line.line_label != $credit_line.trans_label}} — {{$credit_line.line_label}}{{/if}}</dd>
|
||||
<dt>Montant de l'écriture</dt>
|
||||
<dd>{{$credit_line.amount|money_currency_html:false|raw}}</dd>
|
||||
<dt>Montant déjà affecté</dt>
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||
<dt>Montant de l'immobilisation</dt>
|
||||
|
|
@ -199,7 +199,7 @@
|
|||
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$url}}">{{$line.trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>{{$line.label}}</td>
|
||||
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||
<dt>Montant de l'immobilisation</dt>
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$line.trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>
|
||||
{{if $line.line_label != null}}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||
<dt>Montant de l'immobilisation</dt>
|
||||
|
|
@ -178,7 +178,7 @@
|
|||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$line.trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>
|
||||
{{if $line.line_label != null}}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
||||
<dt>Montant de l'immobilisation</dt>
|
||||
|
|
@ -332,7 +332,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="num"><a href="{{$exit_url}}">{{$exit_line.trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$exit_url}}">#{{$exit_line.trans_id}}</a></td>
|
||||
<td>{{$exit_line.date|date_short}}</td>
|
||||
<td>
|
||||
{{if $exit_line.line_label != null}}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Écriture</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$ligne_immo.label}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$ligne_immo.label}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -42,19 +42,13 @@
|
|||
{{:assign account_code=$account_code|cat:"%"|quote_sql}}
|
||||
{{:assign account_condition=$account_condition|cat:" account.code LIKE "|cat:$account_code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign account_array=$module.config.prefixes}}
|
||||
{{#foreach from=$module.config.unfinished item="account_code"}}
|
||||
{{if $account_code.code != null}}
|
||||
{{:assign var="account_array." value=$account_code.code}}
|
||||
{{:assign account_code=$account_code.code|cat:"%"|quote_sql}}
|
||||
{{else}}
|
||||
{{:assign var="account_array." value=$account_code}}
|
||||
{{:assign account_code=$account_code|cat:"%"|quote_sql}}
|
||||
{{/if}}
|
||||
{{:assign account_code=$account_code|cat:"%"|quote_sql}}
|
||||
{{:assign account_condition=$account_condition|cat:" account.code LIKE "|cat:$account_code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign account_condition=$account_condition|cat:"0)"}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign date_immo=$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
||||
|
||||
{{#select
|
||||
|
|
@ -75,6 +69,7 @@
|
|||
INNER JOIN acc_years AS y ON y.id = trans.id_year
|
||||
WHERE !account_condition
|
||||
AND credit > 0
|
||||
AND trans.date > :date_immo
|
||||
AND credit_line_id NOT IN (
|
||||
SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link
|
||||
WHERE json_extract(link.document, '$.type') == "credit_link"
|
||||
|
|
@ -84,6 +79,7 @@
|
|||
ORDER BY trans.date, trans.label;
|
||||
!account_condition = $account_condition
|
||||
!table = $module.table
|
||||
:date_immo = $date_immo
|
||||
assign="credit_line"
|
||||
}}
|
||||
{{if $credit_line.credit_amount < $solde}}
|
||||
|
|
@ -122,7 +118,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
||||
<dt>Date de l'immobilisation</dt>
|
||||
|
|
@ -148,7 +144,7 @@
|
|||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.credit_trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.credit_year}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$line.credit_trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$line.credit_trans_id}}</a></td>
|
||||
<td>{{$line.trans_date|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$line.credit_amount|money_html:false|raw}}</td>
|
||||
<td>{{$line.trans_label}}
|
||||
|
|
@ -168,9 +164,7 @@
|
|||
{{if $_GET.filter}}
|
||||
<p class="block alert">Aucune écriture au crédit du compte {{$ligne_immo.account_code}} et sous-comptes</p>
|
||||
{{else}}
|
||||
{{:assign account_array=$account_array|sort}}
|
||||
{{:assign account_list=$account_array|implode:","}}
|
||||
<p class="block alert">Aucune écriture au crédit des comptes {{$account_list}} et sous-comptes</p>
|
||||
<p class="block alert">Aucune écriture au crédit du compte {{$ligne_immo.account_code|substr:0:2}} et sous-comptes</p>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
||||
<dt>Date de l'immobilisation</dt>
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
{{:assign cession_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$cession_url}}">{{$line.trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$cession_url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>
|
||||
{{if $line.line_label != null}}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
||||
<dt>Date de l'immobilisation</dt>
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
{{:assign exit_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$exit_url}}">{{$line.trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$exit_url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.date|date_short}}</td>
|
||||
<td>{{$line.trans_label}}
|
||||
{{if $line.line_label != null && $line.line_label != $line.trans_label}} — {{$line.line_label}}{{/if}}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$immo_label}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$immo_label}}</dd>
|
||||
<dt>Compte d'immobilisation</dt>
|
||||
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}
|
||||
<dt>Montant</dt>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
name="Amortissements"
|
||||
description="Immobilisations et amortissements\nversion 0.41.4"
|
||||
description="Immobilisations et amortissements\nversion 0.41.2"
|
||||
author="Jean-Christophe Engel"
|
||||
author_url="https://gitea.zaclys.com/lesanges"
|
||||
home_button=false
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Immobilisation</dt>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd class="money strong">{{"%f"|math:$montant_immo|money_currency_html:false|raw}}</dd>
|
||||
<dt>Début d'amortissement</dt>
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
||||
<tr>
|
||||
<td class="num"><a href="{{$trans_url}}">{{$line.trans_id}}</a></td>
|
||||
<td class="num"><a href="{{$trans_url}}">#{{$line.trans_id}}</a></td>
|
||||
<td>{{$line.trans_date|date_short}}</td>
|
||||
<td>
|
||||
{{if $line.line_label != null}}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@
|
|||
{{:assign var=date_amort value=$years.0.end_date}}
|
||||
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
||||
{{* montant de l'amortissement *}}
|
||||
{{:assign montant_amort="round(%f/%f/365*%d,2)"|math:$ligne_immo.amount:$info_immo.duration:$nbjours|intval}}
|
||||
{{:assign montant_amort="%f/%f/365*%d"|math:$ligne_immo.amount:$info_immo.duration:$nbjours|intval}}
|
||||
{{:assign montant_amort="min(%f, %d-%d)"|math:$montant_amort:$ligne_immo.amount:$total_amort}}
|
||||
{{/if}}
|
||||
|
||||
|
|
|
|||
13
scripts.js
13
scripts.js
|
|
@ -93,7 +93,7 @@ function getNumber(text) {
|
|||
// @param date de fin
|
||||
// @result montant de l'amortissement
|
||||
function computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fin) {
|
||||
const nbjours = Math.round(1 + Math.abs((date_fin - date_debut)) / (60*60*24));
|
||||
const nbjours = 1 + (date_fin - date_debut) / (60*60*24);
|
||||
return Math.round(Math.min(montant_immo / duree_immo / 365 * nbjours, montant_immo - somme_amort));
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_mo
|
|||
const somme_amort = Number(document.getElementById(id_amort).value);
|
||||
const montant_amort = computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fin);
|
||||
case_montant.value = montant_amort/100;
|
||||
case_montant.innerText = montant_amort/100;
|
||||
case_montant.innerText = montant_amort;
|
||||
}
|
||||
|
||||
function setSelectorYear(button_names, f_years_selector)
|
||||
|
|
@ -241,7 +241,7 @@ function computeTotal(id_total, id_url) {
|
|||
for (const line of lines) {
|
||||
let button = line.querySelector('input[type=checkbox]');
|
||||
if (button.checked) {
|
||||
let money = line.querySelector('.money');
|
||||
let money = line.querySelector('.remainder');
|
||||
let code = line.querySelector('.account_code a').innerText;
|
||||
if (code in total) {
|
||||
total[code] += getNumber(money.innerText) * 100;
|
||||
|
|
@ -249,7 +249,7 @@ function computeTotal(id_total, id_url) {
|
|||
total[code] = getNumber(money.innerText) * 100;
|
||||
}
|
||||
total_general += getNumber(money.innerText) * 100;
|
||||
const number = line.querySelector('.num a').innerText;
|
||||
const number = line.querySelector('.num a').innerText.slice(1);
|
||||
transactions.push(number);
|
||||
}
|
||||
}
|
||||
|
|
@ -274,11 +274,6 @@ function computeTotal(id_total, id_url) {
|
|||
foot.removeChild(e);
|
||||
}
|
||||
}
|
||||
|
||||
// mettre à jour les paramètres de l'url
|
||||
let url = document.getElementById(id_url);
|
||||
let new_href = url.href.replace(/trans=.*/, 'trans=' + Object.values(transactions));
|
||||
url.href = new_href;
|
||||
}
|
||||
|
||||
// dupliquer la dernière ligne d'une table
|
||||
|
|
|
|||
|
|
@ -30,33 +30,38 @@
|
|||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
|
||||
{{* détails des écritures paramètres *}}
|
||||
{{:assign trans=$_GET.trans|explode:","}}
|
||||
{{:assign var="trans_list" value=$trans|map:quote_sql}}
|
||||
{{:assign trans_list=$trans_list|implode:","}}
|
||||
{{:assign trans_list="("|cat:$trans_list|cat:")"}}
|
||||
{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}}
|
||||
{{:assign docs=$_GET.doc|explode:","}}
|
||||
{{:assign var="doc_list" value=$docs|map:quote_sql}}
|
||||
{{:assign doc_list=$doc_list|implode:","}}
|
||||
{{:assign doc_list="("|cat:$doc_list|cat:")"}}
|
||||
{{:assign doc_condition="doc.id IN "|cat:$doc_list}}
|
||||
|
||||
{{#select
|
||||
trans.id as trans_id,
|
||||
trans.label AS trans_label,
|
||||
trans.date AS trans_date,
|
||||
SUM(line.debit) AS line_debit,
|
||||
doc.id as doc_id,
|
||||
IFNULL(json_extract(doc.document, '$.label'),
|
||||
CASE WHEN line.label IS NOT NULL AND line.label != trans.label
|
||||
THEN trans.label || " - " || line.label
|
||||
ELSE trans.label
|
||||
END) AS label,
|
||||
IFNULL(json_extract(doc.document, '$.date_achat'), trans.date) AS date,
|
||||
IFNULL(json_extract(doc.document, '$.amount'), line.debit) AS amount,
|
||||
account.code AS account_code,
|
||||
account.label AS account_label,
|
||||
line.id_project as project_id
|
||||
FROM acc_transactions AS trans
|
||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||
FROM module_data_amortization AS doc
|
||||
INNER JOIN acc_transactions_lines AS line ON json_extract(doc.document, '$.line') = line.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
|
||||
WHERE !condition
|
||||
GROUP BY trans.id
|
||||
WHERE json_extract(document, '$.type') = "immo"
|
||||
AND !doc_condition
|
||||
;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{:assign var="transactions.%s"|args:$trans_id
|
||||
amount=$line_debit
|
||||
line_label=$trans_label
|
||||
date=$trans_date
|
||||
!doc_condition=$doc_condition
|
||||
assign="doc_line"
|
||||
}}
|
||||
{{:assign var="transactions.%s"|args:$doc_id
|
||||
amount=$amount
|
||||
line_label=$label
|
||||
date=$date
|
||||
code=$account_code
|
||||
label=$account_label
|
||||
project=$project_id
|
||||
|
|
@ -139,7 +144,6 @@
|
|||
- que le compte d'immo débute par un préfixe correct (20, 21, ...)
|
||||
- est présent dans le PC de l'exercice correspondant à la date
|
||||
*}}
|
||||
|
||||
{{:include
|
||||
file="_check_account.html"
|
||||
account=$account_code
|
||||
|
|
@ -153,9 +157,6 @@
|
|||
{{:error message="Le compte « %s » n'est pas un compte d'immobilisation ou n'est pas dans le plan comptable de l'exercice choisi"|args:$compte}}
|
||||
{{/if}}
|
||||
|
||||
{{* écritures liées *}}
|
||||
{{:assign var="linked_transactions" value=$transactions|keys}}
|
||||
|
||||
{{* enregistrer l'écriture *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
|
|
@ -166,7 +167,6 @@
|
|||
date=$_POST.date_mes
|
||||
label=$_POST.designation|trim
|
||||
lines=$lines
|
||||
linked_transactions=$linked_transactions
|
||||
}}
|
||||
|
||||
{{:assign lines_count=$lines|count}}
|
||||
|
|
@ -183,6 +183,18 @@
|
|||
status=$status
|
||||
created=true
|
||||
}}
|
||||
|
||||
{{* changer le statut des immos transférées *}}
|
||||
{{#select
|
||||
id
|
||||
FROM module_data_amortization AS doc
|
||||
WHERE id IN !id_list;
|
||||
!id_list=$doc_list
|
||||
assign="doc"
|
||||
}}
|
||||
{{:save id=$id status="transferred"}}
|
||||
{{/select}}
|
||||
|
||||
{{if $_POST.amortir}}
|
||||
{{:assign type_immo="managed"}}
|
||||
{{else}}
|
||||
|
|
@ -199,7 +211,7 @@
|
|||
{{:form_errors}}
|
||||
|
||||
{{* formulaire d'ajout d'immobilisation *}}
|
||||
{{if $_GET.trans == null}}
|
||||
{{if $_GET.doc == null}}
|
||||
{{:error message="Vous n'avez sélectionné aucune écriture !"}}
|
||||
{{/if}}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue