Incorporation écritures comptes 23xx créées hors Paheko
This commit is contained in:
parent
f1738f2197
commit
54273c6707
6 changed files with 186 additions and 91 deletions
|
|
@ -79,7 +79,7 @@
|
||||||
!condition=$condition
|
!condition=$condition
|
||||||
assign="immo_line"
|
assign="immo_line"
|
||||||
}}
|
}}
|
||||||
{{if $immo_line.status == 'managed'}}
|
{{if $immo_line.status == 'managed' || $immo_line.status == 'amortized'}}
|
||||||
{{if $immo_line.amount == null || $immo_line.amount == 0 || $immo_line.amount == $immo_line.debit}}
|
{{if $immo_line.amount == null || $immo_line.amount == 0 || $immo_line.amount == $immo_line.debit}}
|
||||||
{{:continue}}
|
{{:continue}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
130
_unfinished.html
130
_unfinished.html
|
|
@ -9,6 +9,15 @@
|
||||||
la construction d'un bâtiment destiné à être amorti)
|
la construction d'un bâtiment destiné à être amorti)
|
||||||
</p>
|
</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"}}
|
{{:include file="_get_config.html" keep="module.config"}}
|
||||||
{{:assign saved_hides=$module.config.hides}}
|
{{:assign saved_hides=$module.config.hides}}
|
||||||
{{:assign var="user_hides" from="saved_hides.%s"|args:$logged_user.id}}
|
{{:assign var="user_hides" from="saved_hides.%s"|args:$logged_user.id}}
|
||||||
|
|
@ -21,7 +30,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign unhide=1}}
|
{{:assign unhide=1}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign var="user_hides.unhide_unfinished" value=$unhide"}}
|
{{:assign var="user_hides.unhide_unfinished" value=$unhide}}
|
||||||
{{:assign var="saved_hides.%s"|args:$logged_user.id value=$user_hides}}
|
{{:assign var="saved_hides.%s"|args:$logged_user.id value=$user_hides}}
|
||||||
{{:save key="config" hides=$saved_hides}}
|
{{:save key="config" hides=$saved_hides}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -64,57 +73,83 @@
|
||||||
account.id as account_id,
|
account.id as account_id,
|
||||||
account.code as account_code,
|
account.code as account_code,
|
||||||
account.label as account_label,
|
account.label as account_label,
|
||||||
sum(line.debit) AS debit,
|
line.debit AS debit,
|
||||||
trans.id_year as trans_id_year
|
trans.id_year as trans_id_year
|
||||||
FROM acc_transactions AS trans
|
FROM acc_transactions AS trans
|
||||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
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_accounts AS account ON line.id_account = account.id
|
||||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
||||||
WHERE !condition
|
WHERE !condition
|
||||||
GROUP BY trans.id
|
|
||||||
ORDER BY trans.date DESC;
|
ORDER BY trans.date DESC;
|
||||||
!condition=$condition
|
!condition=$condition
|
||||||
assign="immo_line"
|
assign="immo_line"
|
||||||
}}
|
}}
|
||||||
{{* voir si l'écriture a été marquée ignorée *}}
|
{{* document associé *}}
|
||||||
{{:assign var="immo_line.ignore" value=false}}
|
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_line_id assign="info_immo"}}
|
||||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id AND $$.status = 'ignored'" :line_id=$immo_line_id|intval}}
|
{{:assign var="immo_line.doc_id" value=$info_immo.id}}
|
||||||
{{:assign var="immo_line.ignore" value=true}}
|
{{* *}}
|
||||||
|
{{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}}
|
{{/load}}
|
||||||
{{if $immo_line.ignore}}
|
|
||||||
{{:assign nb_ignored="%d + 1"|math:$nb_ignored}}
|
{{if $info_immo.status == 'transferred'}}
|
||||||
{{/if}}
|
|
||||||
{{if $immo_line.ignore && $unhide == null}}
|
|
||||||
{{:continue}}
|
{{:continue}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $immo_line.allocated_amount == $debit}}
|
||||||
{{*
|
|
||||||
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}}
|
|
||||||
{{:continue}}
|
{{:continue}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:assign var="immo_lines." value=$immo_line}}
|
{{:assign var="immo_lines." value=$immo_line}}
|
||||||
{{/select}}
|
{{/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="">
|
<form method="post" action="">
|
||||||
{{if $immo_lines|count > 0}}
|
{{if $immo_lines|count > 0}}
|
||||||
<fieldset class="shortFormLeft">
|
<fieldset class="shortFormLeft">
|
||||||
|
|
@ -133,9 +168,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
{{:linkbutton
|
{{:button
|
||||||
|
type="submit"
|
||||||
|
name="transfer"
|
||||||
label="Transférer"
|
label="Transférer"
|
||||||
href="transfer.html?trans="
|
|
||||||
shape="right"
|
shape="right"
|
||||||
id="transfer"
|
id="transfer"
|
||||||
}}
|
}}
|
||||||
|
|
@ -148,7 +184,6 @@
|
||||||
{{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher les écritures ignorées" }}
|
{{:input type="checkbox" value=1 name="unhide" checked="%s"|args:$checked label="Afficher les écritures ignorées" }}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</form>
|
|
||||||
|
|
||||||
{{if $immo_lines|count > 0}}
|
{{if $immo_lines|count > 0}}
|
||||||
<section class="immobilisation">
|
<section class="immobilisation">
|
||||||
|
|
@ -160,6 +195,8 @@
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Libellé</th>
|
<th>Libellé</th>
|
||||||
<th class="nombre">Montant</th>
|
<th class="nombre">Montant</th>
|
||||||
|
<th class="nombre">Affecté</th>
|
||||||
|
<th class="nombre">Reste</th>
|
||||||
<th>N° compte</th>
|
<th>N° compte</th>
|
||||||
<th>Compte</th>
|
<th>Compte</th>
|
||||||
<th class="actions"></th>
|
<th class="actions"></th>
|
||||||
|
|
@ -174,21 +211,24 @@
|
||||||
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
|
{{:assign total_immo="%d+%d"|math:$total_immo:$debit}}
|
||||||
{{:assign var="montant" from="sommes_immo.%s"|args:$account_code}}
|
{{: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="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}}>
|
<tr {{if $ignore}}class="checked"{{/if}}{{if $allocated_amount > 0}}class="strong"{{/if}}>
|
||||||
<td class="check">{{:input type="checkbox" name="selected[]" value=$trans_id}}</td>
|
<td class="check">{{:input type="checkbox" name="selected[]" value=$doc_id}}</td>
|
||||||
<td class="num"><a href="{{$trans_url}}">#{{$trans_id}}</a></td>
|
<td class="num"><a href="{{$trans_url}}">#{{$trans_id}}</a></td>
|
||||||
<td>{{$trans_date|date_short}}</td>
|
<td>{{$trans_date|date_short}}</td>
|
||||||
<td>{{$trans_label}}</td>
|
<td>{{$trans_label}}</td>
|
||||||
<td class="money">{{"%f"|math:$debit|money_html:false|raw}}</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 class="account_code"><a href="{{$compte_url}}">{{$account_code}}</a></td>
|
||||||
<td>{{$account_label}}</td>
|
<td>{{$account_label}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Modifier"
|
label="Paramètres"
|
||||||
href="ignore.html?immo_line_id=%s"|args:$immo_line_id
|
href="add_infos.html?immo_line_id=%s"|args:$immo_line_id
|
||||||
shape="edit"
|
shape="settings"
|
||||||
target="_dialog"
|
target="_dialog"
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -226,6 +266,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<p class="block alert">Aucune écriture d'immobilisation trouvée dans la comptabilité (compte {{$first_code}} et sous-comptes)</p>
|
<p class="block alert">Aucune écriture d'immobilisation trouvée dans la comptabilité (compte {{$first_code}} et sous-comptes)</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
</form>
|
||||||
|
|
||||||
<script type="text/javascript" src="scripts.js"></script>
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
<script type="text/javascript" async="async">
|
<script type="text/javascript" async="async">
|
||||||
|
|
@ -244,7 +285,10 @@ function changeVisibility(evt, idcheck = 'f_unhide_1') {
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(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>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||||
{{*
|
{{*
|
||||||
Classer une immobilisation non prise en charge
|
Classer une immobilisation non prise en charge
|
||||||
@param immo_line_id
|
@param immo_line_id
|
||||||
|
|
@ -53,12 +54,12 @@
|
||||||
{{:assign status="ignored"}}
|
{{:assign status="ignored"}}
|
||||||
{{elseif $_POST.classify == "archived"}}
|
{{elseif $_POST.classify == "archived"}}
|
||||||
{{* voir s'il y a déjà un doc associé à cette immo *}}
|
{{* 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}}
|
{{if $info_immo != null}}
|
||||||
{{:assign uuid=$key}}
|
{{:assign uuid=$info_immo.key}}
|
||||||
{{:assign immo_doc_id=$id}}
|
{{:assign immo_doc_id=$info_immo.id}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign uuid=""|uuid}}
|
{{:assign uuid=""|uuid}}
|
||||||
{{/load}}
|
{{/if}}
|
||||||
|
|
||||||
{{* immobilisation sortie du bilan *}}
|
{{* immobilisation sortie du bilan *}}
|
||||||
{{:save
|
{{:save
|
||||||
|
|
@ -71,7 +72,7 @@
|
||||||
assign_new_id="immo_doc_id"
|
assign_new_id="immo_doc_id"
|
||||||
}}
|
}}
|
||||||
{{:redirect force="exit_step1.html?immo_doc_id=%s&from=exit"|args:$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 *}}
|
{{* immobilisation amortissable *}}
|
||||||
{{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}}
|
||||||
|
|
@ -124,12 +125,46 @@
|
||||||
{{:assign montant_nb="%f"|math:$montant|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}}
|
{{:error message="Le montant (%s) ne peut être supérieur au reste (%s)"|args:$montant_nb:$reste_nb}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:assign status="managed"}}
|
{{: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}}
|
{{/if}}
|
||||||
|
|
||||||
{{* enregistrer les infos de l'immobilisation *}}
|
{{* 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}}
|
{{:assign key=""|uuid}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign key=$info_immo.key}}
|
{{:assign key=$info_immo.key}}
|
||||||
|
|
@ -139,7 +174,7 @@
|
||||||
validate_schema="asset.schema.json"
|
validate_schema="asset.schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$_GET.immo_line_id|intval
|
line=$_GET.immo_line_id|intval
|
||||||
duration=$duration
|
duration=0
|
||||||
label=$libelle
|
label=$libelle
|
||||||
amount=$montant
|
amount=$montant
|
||||||
date_achat=$date_achat
|
date_achat=$date_achat
|
||||||
|
|
@ -149,13 +184,14 @@
|
||||||
|
|
||||||
{{if $_POST.classify == "managed"}}
|
{{if $_POST.classify == "managed"}}
|
||||||
{{:assign type_immo="managed"}}
|
{{:assign type_immo="managed"}}
|
||||||
|
{{elseif $_POST.classify == "unfinished"}}
|
||||||
|
{{:assign type_immo="unfinished"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign type_immo="other"}}
|
{{:assign type_immo="other"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=%s"|args:$type_immo}}
|
{{:redirect force="index.html?ok=1&msg=infos&type_immo=%s"|args:$type_immo}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Classer l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="_nav.html" current="other" subcurrent="parameter"}}
|
{{:include file="_nav.html" current="other" subcurrent="parameter"}}
|
||||||
|
|
@ -194,14 +230,19 @@
|
||||||
<dd>{{$ligne_immo.code}} — {{$ligne_immo.account_label}}
|
<dd>{{$ligne_immo.code}} — {{$ligne_immo.account_label}}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
{{:assign unfinished_prefix=$ligne_immo.code|strpos:"23"}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Classement</legend>
|
<legend>Classement</legend>
|
||||||
<dl id="classement_immo">
|
<dl id="classement_immo">
|
||||||
<dt><label>Faites un choix</label> <b>(obligatoire)</b></dt>
|
<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 $unfinished_prefix === 0}}
|
||||||
{{if $ligne_immo.date_achat > $first_date}}
|
{{: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}}
|
{{:input type="radio-btn" name="classify" value="archived" label="Immobilisation sortie du bilan" default=$choix_defaut}}
|
||||||
{{/if}}
|
{{/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}}
|
{{: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="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="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="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)"}}
|
{{if $unfinished_prefix !== 0}}
|
||||||
{{: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"}}
|
{{: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>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
@ -234,7 +277,8 @@
|
||||||
function toggleInputs(event) {
|
function toggleInputs(event) {
|
||||||
const classement_immo = document.getElementById('classement_immo');
|
const classement_immo = document.getElementById('classement_immo');
|
||||||
const managed = classement_immo.querySelector('input[type=radio][value=managed]');
|
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);
|
g.toggle('.masquable', true);
|
||||||
} else {
|
} else {
|
||||||
g.toggle('.masquable', false);
|
g.toggle('.masquable', false);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
},
|
},
|
||||||
"status" : {
|
"status" : {
|
||||||
"type" : ["string", "null"],
|
"type" : ["string", "null"],
|
||||||
"enum" : ["managed", "amortized", "archived", "ignored"]
|
"enum" : ["managed", "amortized", "archived", "unfinished", "ignored", "inprogress", "transferred"]
|
||||||
},
|
},
|
||||||
"created" : {
|
"created" : {
|
||||||
"description" : "vrai si immobilisation créée dans le module",
|
"description" : "vrai si immobilisation créée dans le module",
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ function computeTotal(id_total, id_url) {
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
let button = line.querySelector('input[type=checkbox]');
|
let button = line.querySelector('input[type=checkbox]');
|
||||||
if (button.checked) {
|
if (button.checked) {
|
||||||
let money = line.querySelector('.money');
|
let money = line.querySelector('.remainder');
|
||||||
let code = line.querySelector('.account_code a').innerText;
|
let code = line.querySelector('.account_code a').innerText;
|
||||||
if (code in total) {
|
if (code in total) {
|
||||||
total[code] += getNumber(money.innerText) * 100;
|
total[code] += getNumber(money.innerText) * 100;
|
||||||
|
|
@ -274,11 +274,6 @@ function computeTotal(id_total, id_url) {
|
||||||
foot.removeChild(e);
|
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
|
// dupliquer la dernière ligne d'une table
|
||||||
|
|
|
||||||
|
|
@ -30,33 +30,38 @@
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign condition=$condition|cat:"0)"}}
|
{{:assign condition=$condition|cat:"0)"}}
|
||||||
|
|
||||||
{{* détails des écritures paramètres *}}
|
{{:assign docs=$_GET.doc|explode:","}}
|
||||||
{{:assign trans=$_GET.trans|explode:","}}
|
{{:assign var="doc_list" value=$docs|map:quote_sql}}
|
||||||
{{:assign var="trans_list" value=$trans|map:quote_sql}}
|
{{:assign doc_list=$doc_list|implode:","}}
|
||||||
{{:assign trans_list=$trans_list|implode:","}}
|
{{:assign doc_list="("|cat:$doc_list|cat:")"}}
|
||||||
{{:assign trans_list="("|cat:$trans_list|cat:")"}}
|
{{:assign doc_condition="doc.id IN "|cat:$doc_list}}
|
||||||
{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}}
|
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
trans.id as trans_id,
|
doc.id as doc_id,
|
||||||
trans.label AS trans_label,
|
IFNULL(json_extract(doc.document, '$.label'),
|
||||||
trans.date AS trans_date,
|
CASE WHEN line.label IS NOT NULL AND line.label != trans.label
|
||||||
SUM(line.debit) AS line_debit,
|
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.code AS account_code,
|
||||||
account.label AS account_label,
|
account.label AS account_label,
|
||||||
line.id_project as project_id
|
line.id_project as project_id
|
||||||
FROM acc_transactions AS trans
|
FROM module_data_amortization AS doc
|
||||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
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
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
WHERE !condition
|
WHERE json_extract(document, '$.type') = "immo"
|
||||||
GROUP BY trans.id
|
AND !doc_condition
|
||||||
;
|
;
|
||||||
!condition=$condition
|
!doc_condition=$doc_condition
|
||||||
}}
|
assign="doc_line"
|
||||||
{{:assign var="transactions.%s"|args:$trans_id
|
}}
|
||||||
amount=$line_debit
|
{{:assign var="transactions.%s"|args:$doc_id
|
||||||
line_label=$trans_label
|
amount=$amount
|
||||||
date=$trans_date
|
line_label=$label
|
||||||
|
date=$date
|
||||||
code=$account_code
|
code=$account_code
|
||||||
label=$account_label
|
label=$account_label
|
||||||
project=$project_id
|
project=$project_id
|
||||||
|
|
@ -139,7 +144,6 @@
|
||||||
- que le compte d'immo débute par un préfixe correct (20, 21, ...)
|
- 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
|
- est présent dans le PC de l'exercice correspondant à la date
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{:include
|
{{:include
|
||||||
file="_check_account.html"
|
file="_check_account.html"
|
||||||
account=$account_code
|
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}}
|
{{: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}}
|
{{/if}}
|
||||||
|
|
||||||
{{* écritures liées *}}
|
|
||||||
{{:assign var="linked_transactions" value=$transactions|keys}}
|
|
||||||
|
|
||||||
{{* enregistrer l'écriture *}}
|
{{* enregistrer l'écriture *}}
|
||||||
{{:api
|
{{:api
|
||||||
method="POST"
|
method="POST"
|
||||||
|
|
@ -166,7 +167,6 @@
|
||||||
date=$_POST.date_mes
|
date=$_POST.date_mes
|
||||||
label=$_POST.designation|trim
|
label=$_POST.designation|trim
|
||||||
lines=$lines
|
lines=$lines
|
||||||
linked_transactions=$linked_transactions
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{:assign lines_count=$lines|count}}
|
{{:assign lines_count=$lines|count}}
|
||||||
|
|
@ -183,6 +183,18 @@
|
||||||
status=$status
|
status=$status
|
||||||
created=true
|
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}}
|
{{if $_POST.amortir}}
|
||||||
{{:assign type_immo="managed"}}
|
{{:assign type_immo="managed"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
@ -199,7 +211,7 @@
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
{{* formulaire d'ajout d'immobilisation *}}
|
{{* formulaire d'ajout d'immobilisation *}}
|
||||||
{{if $_GET.trans == null}}
|
{{if $_GET.doc == null}}
|
||||||
{{:error message="Vous n'avez sélectionné aucune écriture !"}}
|
{{:error message="Vous n'avez sélectionné aucune écriture !"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue