Transférer immobilisations en cours vers immobilisation amortissable
This commit is contained in:
parent
9bfc389fa2
commit
4c160e054a
4 changed files with 430 additions and 27 deletions
|
|
@ -8,13 +8,39 @@
|
||||||
Cette page liste les immobilisations en cours de constitution, donc non amortissables
|
Cette page liste les immobilisations en cours de constitution, donc non amortissables
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
<fieldset class="shortFormLeft">
|
||||||
|
<legend>Transférer une ou plusieurs lignes vers une immobilisation amortissable</legend>
|
||||||
|
<p class="help">
|
||||||
|
Cocher les lignes concernées ; les montants seront additionnés par numéro de compte
|
||||||
|
</p>
|
||||||
|
<div class="shortFormRight informations" id="total_amount">
|
||||||
|
<legend>Montants sélectionnés</legend>
|
||||||
|
<ul>
|
||||||
|
<li> </li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p class="submit">
|
||||||
|
{{:linkbutton
|
||||||
|
label="Transférer"
|
||||||
|
href="transfer.html?trans="
|
||||||
|
shape="right"
|
||||||
|
id="transfer"
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>N°</th>
|
<th class="check">{{*:input type="checkbox" name="all" value="all"*}}</th>
|
||||||
|
<th class="num">N°</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Libellé</th>
|
<th>Libellé</th>
|
||||||
<th class="nombre">Montant</th>
|
<th class="money">Montant</th>
|
||||||
<th>N° compte</th>
|
<th>N° compte</th>
|
||||||
<th>Compte</th>
|
<th>Compte</th>
|
||||||
<th class="actions"></th>
|
<th class="actions"></th>
|
||||||
|
|
@ -25,13 +51,13 @@
|
||||||
{{* lister les immobilisations en cours de constitution *}}
|
{{* lister les immobilisations en cours de constitution *}}
|
||||||
{{:include file="_get_config.html" keep="module.config.unfinished"}}
|
{{:include file="_get_config.html" keep="module.config.unfinished"}}
|
||||||
|
|
||||||
{{:assign condition="("}}
|
{{:assign accounts_condition="("}}
|
||||||
{{#foreach from=$module.config.unfinished item="elem"}}
|
{{#foreach from=$module.config.unfinished item="elem"}}
|
||||||
{{:assign code=$elem.code|cat:"%"|quote_sql}}
|
{{:assign code=$elem.code|cat:"%"|quote_sql}}
|
||||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
{{:assign accounts_condition=$accounts_condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign condition=$condition|cat:"0)"}}
|
{{:assign accounts_condition=$accounts_condition|cat:"0)"}}
|
||||||
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
{{:assign condition=$accounts_condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||||
{{:assign nb_immo=0}}
|
{{:assign nb_immo=0}}
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
|
|
@ -54,27 +80,20 @@
|
||||||
!condition=$condition
|
!condition=$condition
|
||||||
}}
|
}}
|
||||||
{{* voir s'il existe une écriture qui solde l'immobilisation *}}
|
{{* voir s'il existe une écriture qui solde l'immobilisation *}}
|
||||||
{{:assign ignore=false}}
|
|
||||||
{{#select
|
{{#select
|
||||||
line.id AS line,
|
count(*) AS count
|
||||||
line.id_transaction AS trans,
|
FROM acc_transactions AS trans
|
||||||
line.debit,
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
||||||
line.label,
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
line2.id AS line2,
|
WHERE line.credit = :amount AND code = :account_code
|
||||||
line2.id_transaction AS trans2,
|
;
|
||||||
line2.credit,
|
:amount = $debit
|
||||||
line2.label
|
:account_code = $account_code
|
||||||
FROM acc_transactions_lines AS line
|
|
||||||
INNER JOIN acc_accounts AS acc ON acc.id = line.id_account
|
|
||||||
INNER JOIN acc_transactions_lines AS line2 ON line2.id_account = acc.id
|
|
||||||
WHERE
|
|
||||||
line.id = :line_id
|
|
||||||
AND line2.credit = line.debit;
|
|
||||||
:line_id = $immo_id|intval
|
|
||||||
}}
|
}}
|
||||||
{{:assign ignore=true}}
|
{{:assign count=$count}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{if $ignore}}
|
{{* 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}}
|
||||||
|
|
||||||
|
|
@ -83,11 +102,12 @@
|
||||||
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
<td class="check">{{:input type="checkbox" name="selected[]" value=$trans_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:false}}</td>
|
<td class="money">{{"%f"|math:$debit|money:false}}</td>
|
||||||
<td><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>
|
<td class="actions"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -98,3 +118,18 @@
|
||||||
<p class="block alert">Aucune immobilisation</p>
|
<p class="block alert">Aucune immobilisation</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
|
<script type="text/javascript" async="async">
|
||||||
|
|
||||||
|
let lines = document.querySelectorAll('.list tbody tr');
|
||||||
|
for (const line of lines) {
|
||||||
|
let button = line.querySelector('input[type=checkbox]');
|
||||||
|
|
||||||
|
button.onchange = () => {
|
||||||
|
computeTotal('total_amount', 'transfer');
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
|
||||||
49
scripts.js
49
scripts.js
|
|
@ -119,7 +119,6 @@ function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_mo
|
||||||
}
|
}
|
||||||
if (id_date != null) {
|
if (id_date != null) {
|
||||||
const date_choisie = str2sec(document.getElementById(id_date).value);
|
const date_choisie = str2sec(document.getElementById(id_date).value);
|
||||||
console.log("date_choisie = " + date_choisie + ", date_debut=" + date_debut + ", date_fin = " + date_fin);
|
|
||||||
if (date_debut <= date_choisie && date_choisie <= date_fin) {
|
if (date_debut <= date_choisie && date_choisie <= date_fin) {
|
||||||
date_fin = date_choisie;
|
date_fin = date_choisie;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -161,7 +160,6 @@ function initLine(row) {
|
||||||
|
|
||||||
// Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne
|
// Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne
|
||||||
function addLine(button, codes) {
|
function addLine(button, codes) {
|
||||||
console.log("codes=" + JSON.stringify(codes));
|
|
||||||
button.onclick = () => {
|
button.onclick = () => {
|
||||||
let lines = button.closest("table").querySelectorAll('tbody tr');
|
let lines = button.closest("table").querySelectorAll('tbody tr');
|
||||||
let line = lines[lines.length - 1];
|
let line = lines[lines.length - 1];
|
||||||
|
|
@ -190,3 +188,50 @@ function addLine(button, codes) {
|
||||||
initLine(newNode);
|
initLine(newNode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculer et afficher le total des lignes sélectionnées
|
||||||
|
function computeTotal(id_total, id_url) {
|
||||||
|
|
||||||
|
// calculer le total par compte
|
||||||
|
let total = new Object;
|
||||||
|
const transactions = [];
|
||||||
|
let lines = document.querySelectorAll('.list tbody tr');
|
||||||
|
for (const line of lines) {
|
||||||
|
let button = line.querySelector('input[type=checkbox]');
|
||||||
|
if (button.checked) {
|
||||||
|
let money = line.querySelector('.money');
|
||||||
|
let code = line.querySelector('.account_code a').innerText;
|
||||||
|
if (code in total) {
|
||||||
|
total[code] += getNumber(money.innerText) * 100;
|
||||||
|
} else {
|
||||||
|
total[code] = getNumber(money.innerText) * 100;
|
||||||
|
}
|
||||||
|
const number = line.querySelector('.num a').innerText.slice(1);
|
||||||
|
transactions.push(number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// afficher les totaux
|
||||||
|
const liste = document.getElementById(id_total).querySelector('ul');
|
||||||
|
while (liste.firstChild) {
|
||||||
|
liste.removeChild(liste.firstChild);
|
||||||
|
}
|
||||||
|
for (const code in total) {
|
||||||
|
const node = document.createElement("li");
|
||||||
|
const para = document.createElement("p");
|
||||||
|
const libelle = document.createTextNode("Compte " + code + " : ");
|
||||||
|
const span = document.createElement("strong");
|
||||||
|
span.classList.add("money");
|
||||||
|
const montant = document.createTextNode(new Intl.NumberFormat("fr-FR", { style: "currency", currency: "EUR" }).format(total[code] / 100., ));
|
||||||
|
|
||||||
|
span.appendChild(montant);
|
||||||
|
para.appendChild(libelle);
|
||||||
|
para.appendChild(span);
|
||||||
|
node.appendChild(para);
|
||||||
|
liste.appendChild(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,3 +41,9 @@ h2[class="aide"], h3[class="aide"] {
|
||||||
nav.amort aside {
|
nav.amort aside {
|
||||||
margin-top : 0;
|
margin-top : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fieldset.shortFormLeft div.informations {
|
||||||
|
border: 1px solid var(--gLightBorderColor);
|
||||||
|
background: rgba(var(--gSecondColor), 0.2);
|
||||||
|
border-radius: .5em;
|
||||||
|
}
|
||||||
|
|
|
||||||
317
transfer.html
Normal file
317
transfer.html
Normal file
|
|
@ -0,0 +1,317 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{:admin_header title="Transfert d'immobilisation en cours" current="module_amortissement"}}
|
||||||
|
{{:include file="_get_config.html" keep="module.config.prefixes"}}
|
||||||
|
|
||||||
|
{{#years closed=false order="start_date" assign=years.}}
|
||||||
|
{{:assign ts_debut=$start_date|strtotime}}
|
||||||
|
{{:assign ts_fin=$end_date|strtotime}}
|
||||||
|
{{:assign debut=$start_date|date_short}}
|
||||||
|
{{:assign fin=$end_date|date_short}}
|
||||||
|
{{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}}
|
||||||
|
{{:assign var="open_years.%d"|args:$id value=$label|cat:" ("|cat:$debut|cat:" - "|cat:$fin|cat:")"}}
|
||||||
|
{{if $ts_debut <= $now && $now <= $ts_fin}}
|
||||||
|
{{:assign selected_year=$id}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Aucun exercice ouvert"}}
|
||||||
|
{{/years}}
|
||||||
|
|
||||||
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
|
{{#form on="transfer"}}
|
||||||
|
{{* vérifier que la date de mise en service est située dans l'exercice sélectionné *}}
|
||||||
|
{{:assign ts_date = $_POST.date_mes|parse_date|strtotime}}
|
||||||
|
{{:assign ok=false}}
|
||||||
|
{{#foreach from=$years}}
|
||||||
|
{{if $id == $_POST.id_year}}
|
||||||
|
{{:assign selected_chart=$id_chart}}
|
||||||
|
{{if $start_date|strtotime <= $ts_date && $ts_date <= $end_date|strtotime}}
|
||||||
|
{{:assign ok=true}}
|
||||||
|
{{:break}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{if ! $ok}}
|
||||||
|
{{:error message="La date saisie n'est pas dans l'exercice choisi !"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if ! $_POST.amortir}}
|
||||||
|
{{* ne pas amortir *}}
|
||||||
|
{{:assign duration=0}}
|
||||||
|
{{:assign date_debut=$_POST.date_achat|parse_date}}
|
||||||
|
{{:assign status="ignored"}}
|
||||||
|
{{else}}
|
||||||
|
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
||||||
|
{{:assign date_debut=$_POST.date_mes|parse_date}}
|
||||||
|
{{:assign duration=$_POST.duree|intval}}
|
||||||
|
{{:assign status="managed"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* comptes de débit *}}
|
||||||
|
{{#foreach from=$_POST.credit_accounts key="rang" item="elem"}}
|
||||||
|
{{:include
|
||||||
|
file="_get_codes.html"
|
||||||
|
account=$elem
|
||||||
|
keep="account_code"
|
||||||
|
}}
|
||||||
|
{{:assign debit_account=$account_code|keys|key:0}}
|
||||||
|
{{:assign var="amount" from="_POST.credit_lines.%s"|args:$rang}}
|
||||||
|
{{:assign var="label" from="_POST.line_labels.%s"|args:$rang}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
account=$debit_account
|
||||||
|
credit=$amount
|
||||||
|
label=$label
|
||||||
|
}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{* compte de crédit *}}
|
||||||
|
{{:include
|
||||||
|
file="_get_codes.html"
|
||||||
|
account=$_POST.debit_account
|
||||||
|
keep="account_code"
|
||||||
|
}}
|
||||||
|
{{:assign credit_account=$account_code|keys|key:0}}
|
||||||
|
{{:assign var="amount" from="_POST.debit_lines.%s"|args:0}}
|
||||||
|
{{:assign count=$_POST.line_labels|count}}
|
||||||
|
{{:assign count="%d-1"|math:$count}}
|
||||||
|
{{:assign var="label" from="_POST.line_labels.%s"|args:$count}}
|
||||||
|
{{:assign
|
||||||
|
var="lines."
|
||||||
|
account=$credit_account
|
||||||
|
debit=$amount
|
||||||
|
label=$label
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{* vérifier :
|
||||||
|
- 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
|
||||||
|
chart_id=$selected_chart
|
||||||
|
prefix_array=$module.config.prefixes
|
||||||
|
keep="account_ok"
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{if $account_ok == null}}
|
||||||
|
{{:assign compte=$credit_account|implode:""}}
|
||||||
|
{{: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=$_GET.trans|explode:","}}
|
||||||
|
|
||||||
|
{{* enregistrer l'écriture *}}
|
||||||
|
{{:api
|
||||||
|
method="POST"
|
||||||
|
path="accounting/transaction"
|
||||||
|
assign="result"
|
||||||
|
id_year=$_POST.id_year
|
||||||
|
type="advanced"
|
||||||
|
date=$_POST.date_mes
|
||||||
|
label=$_POST.designation|trim
|
||||||
|
lines=$lines
|
||||||
|
linked_transactions=$linked_transactions
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{:assign lines_count=$lines|count}}
|
||||||
|
{{:assign lines_count="%d-1"|math:$lines_count}}
|
||||||
|
{{:assign var="immo_id" from="result.lines.%s.id"|args:$lines_count}}
|
||||||
|
|
||||||
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
|
{{:save
|
||||||
|
key=""|uuid
|
||||||
|
validate_schema="schema.json"
|
||||||
|
type="immo"
|
||||||
|
line=$immo_id
|
||||||
|
duration=$duration
|
||||||
|
date=$date_debut
|
||||||
|
status=$status
|
||||||
|
}}
|
||||||
|
{{if $_POST.amortir}}
|
||||||
|
{{:assign type_immo="managed"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign type_immo="other"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}}
|
||||||
|
|
||||||
|
{{/form}}
|
||||||
|
|
||||||
|
{{* barre de navigation *}}
|
||||||
|
{{if ! $dialog}}
|
||||||
|
{{:include file="_nav.html" current="index"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:form_errors}}
|
||||||
|
|
||||||
|
{{* formulaire d'ajout d'immobilisation *}}
|
||||||
|
|
||||||
|
{{#select id,label FROM acc_projects WHERE archived = 0;}}
|
||||||
|
{{:assign var="projects.%d"|args:$id value=$label}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{#foreach from=$module.config.prefixes item="code"}}
|
||||||
|
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign var="patterns" value=$pattern_array|implode:"|"}}
|
||||||
|
|
||||||
|
<div id="erreur" class="hidden">
|
||||||
|
<p class="block error">La date choisie n'est dans aucun exercice ouvert !</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{if $_GET.trans == null}}
|
||||||
|
{{:error message="Vous n'avez sélectionné aucune écriture !"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* déterminer les comptes d'immo en cours *}}
|
||||||
|
{{:include file="_get_config.html" keep="module.config.unfinished"}}
|
||||||
|
{{:assign condition="("}}
|
||||||
|
{{#foreach from=$module.config.unfinished item="elem"}}
|
||||||
|
{{:assign code=$elem.code|cat:"%"|quote_sql}}
|
||||||
|
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||||
|
{{/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 condition=$condition|cat:" AND NOT (trans.status & 16)"}}
|
||||||
|
|
||||||
|
{{#select
|
||||||
|
trans.id as trans_id,
|
||||||
|
trans.label AS trans_label,
|
||||||
|
trans.date AS trans_date,
|
||||||
|
SUM(line.debit) AS line_debit,
|
||||||
|
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
|
||||||
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
||||||
|
WHERE !condition
|
||||||
|
GROUP BY trans.id
|
||||||
|
;
|
||||||
|
!condition=$condition
|
||||||
|
}}
|
||||||
|
{{:assign var="transactions.%s"|args:$trans_id amount=$line_debit date=$trans_date code=$account_code label=$account_label project=$project_id}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Données de l'immobilisation</legend>
|
||||||
|
<dl>
|
||||||
|
{{:input type="select" name="id_year" label="Exercice" default=$selected_year required=true
|
||||||
|
default_empty="— Faire un choix —" options=$open_years}}
|
||||||
|
{{:input type="date" name="date_mes" label="Date de mise en service" required=true default=$now|date_short}}
|
||||||
|
{{:input type="text" name="designation" label="Libellé" required=true}}
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Comptes</legend>
|
||||||
|
<dl>
|
||||||
|
<table class="list transaction-lines">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Compte</th>
|
||||||
|
<th>Débit</th>
|
||||||
|
<th>Crédit</th>
|
||||||
|
<th>Libellé ligne</th>
|
||||||
|
<th>Projet</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{:assign total=0}}
|
||||||
|
{{#foreach from=$transactions key="id"}}
|
||||||
|
{{:assign total="%f+%f"|math:$total:$amount}}
|
||||||
|
{{:assign current_account=null}}
|
||||||
|
{{:assign var="current_account.%s"|args:$code value="%s — %s"|args:$code:$label}}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="credit_accounts[]"
|
||||||
|
required=true
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$code:$selected_year
|
||||||
|
default=$current_account
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>{{:input name="credit_lines[]" type="text" class="money" size="8" default=$amount|money}}</td>
|
||||||
|
<td>{{:input name="debit_lines[]" type="text" class="money" size="8" disabled=true}}</td>
|
||||||
|
<td>{{:input type="text" name="line_labels[]" size="40"}}</td>
|
||||||
|
<td>
|
||||||
|
{{if $projects != null}}
|
||||||
|
{{:input type="select" name="id_project" options=$projects default_empty="— Aucun —"}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/foreach}}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{:input
|
||||||
|
type="list"
|
||||||
|
name="debit_account"
|
||||||
|
label="Compte d'immobilisation amortissable"
|
||||||
|
required=true
|
||||||
|
target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$patterns:$selected_year
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>{{:input name="credit_lines[]" type="text" class="money" size="8" disabled=true}}</td>
|
||||||
|
<td>{{:input name="debit_lines[]" type="text" class="money" size="8" default=$total|money}}</td>
|
||||||
|
<td>{{:input type="text" name="line_labels[]" size="40"}}</td>
|
||||||
|
<td>
|
||||||
|
{{if $projects != null}}
|
||||||
|
{{:input type="select" name="id_project" options=$projects default_empty="— Aucun —"}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div id="donnees" class="hidden">
|
||||||
|
{{:input type="select" name="years_data" options=$years_data}}
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Amortissement</legend>
|
||||||
|
<dl>
|
||||||
|
{{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}}
|
||||||
|
<div id="div_amort">
|
||||||
|
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}}
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<p class="submit">
|
||||||
|
{{:button type="submit" name="transfer" label="Transférer" shape="right" class="main"}}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
{{:admin_footer}}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function changeYear(evt, f_accounts = ['credit_accounts', 'debit_account'], f_years_select = 'f_id_year') {
|
||||||
|
setSelectorYear(f_accounts, f_years_select);
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeVisibility(evt, idcheck = 'f_amortir_1', fields = ['div_amort']) {
|
||||||
|
toggleVisibility(idcheck, fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
document.getElementById('f_id_year').onchange = changeYear;
|
||||||
|
document.getElementById('f_amortir_1').onclick = changeVisibility;
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Loading…
Add table
Reference in a new issue