Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
f509cd42c9 | |||
8b87ce74cf | |||
b6ced673dc | |||
9ac427415a | |||
17d132ffa2 | |||
f17ccd1bc8 | |||
4b63ad4560 | |||
2aa64cc525 | |||
022e324bea | |||
5ab7d628a8 | |||
ad4b76695d | |||
f1bea6bda2 | |||
993ded84d3 |
@ -1,69 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{*
|
|
||||||
Trouver les lignes d'amortissement et d'immobilisation qui sont dans la même écriture
|
|
||||||
- param : aucun
|
|
||||||
- résultat : amort_exclus = tableau des amortissements à exclure
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{* lignes des immo non amorties *}}
|
|
||||||
{{#load type="immo" where="$$.noamort = true"}}
|
|
||||||
{{:assign var="lines." value="'%s'"|args:$line}}
|
|
||||||
{{/load}}
|
|
||||||
{{:assign lines=$lines|implode:","}}
|
|
||||||
{{:assign lines="("|cat:$lines|cat:")"}}
|
|
||||||
{{:assign condition="line.id IN %s"|args:$lines}}
|
|
||||||
{{*:debug condition=$condition*}}
|
|
||||||
|
|
||||||
{{* écritures et comptes associés *}}
|
|
||||||
{{#select
|
|
||||||
line.id as line_id,
|
|
||||||
line.id_transaction as trans_id,
|
|
||||||
account.id as account_id,
|
|
||||||
account.code as account_code,
|
|
||||||
account.id_chart as id_chart
|
|
||||||
FROM acc_transactions_lines AS line
|
|
||||||
INNER JOIN acc_transactions AS trans on trans.id = line.id_transaction
|
|
||||||
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;
|
|
||||||
!condition=$condition
|
|
||||||
assign="ecriture"
|
|
||||||
}}
|
|
||||||
{{:assign var="ecritures." value="'%s'"|args:$trans_id}}
|
|
||||||
{{* déterminer le numéro du compte d'amortissement associé au compte d'immobilisation *}}
|
|
||||||
{{:include
|
|
||||||
file="./_get_amort_code.html"
|
|
||||||
code_immo=$account_code
|
|
||||||
keep="code_amort"
|
|
||||||
}}
|
|
||||||
{{:assign var="accounts." value="'%s'"|args:$code_amort}}
|
|
||||||
{{/select}}
|
|
||||||
{{*:debug ecritures=$ecritures accounts=$accounts*}}
|
|
||||||
|
|
||||||
{{* écritures d'amortissement avec :
|
|
||||||
- numéro d'écritures obtenus ci-dessus
|
|
||||||
- numéros de comptes d'amortissement déduits des comptes d'immo ci-dessus
|
|
||||||
*}}
|
|
||||||
|
|
||||||
{{:assign ecritures=$ecritures|implode:","}}
|
|
||||||
{{:assign ecritures="("|cat:$ecritures|cat:")"}}
|
|
||||||
{{:assign accounts=$accounts|implode:","}}
|
|
||||||
{{:assign accounts="("|cat:$accounts|cat:")"}}
|
|
||||||
{{:assign condition="line.id_transaction IN %s AND account.code IN %s"|args:$ecritures:$accounts}}
|
|
||||||
|
|
||||||
{{#select
|
|
||||||
line.id as line_id,
|
|
||||||
line.id_transaction as trans_id,
|
|
||||||
account.id as account_id,
|
|
||||||
account.code as account_code
|
|
||||||
FROM acc_transactions_lines AS line
|
|
||||||
INNER JOIN acc_transactions AS trans on trans.id = line.id_transaction
|
|
||||||
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;
|
|
||||||
!condition=$condition
|
|
||||||
assign="amort"
|
|
||||||
}}
|
|
||||||
{{:assign var="amort_exclus." value=$trans_id}}
|
|
||||||
{{/select}}
|
|
@ -9,13 +9,12 @@
|
|||||||
|
|
||||||
{{:assign ts_debut=$date_debut|strtotime}}
|
{{:assign ts_debut=$date_debut|strtotime}}
|
||||||
{{:assign ts_fin=$date_fin|strtotime}}
|
{{:assign ts_fin=$date_fin|strtotime}}
|
||||||
{{:assign nbjours="1+(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
|
||||||
|
|
||||||
{{* au cas où les deux dates seraient inversées ... *}}
|
{{if $ts_debut <= $ts_fin}}
|
||||||
{{if $nbjours < 0}}
|
{{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}}
|
||||||
{{:assign nbjours="-1*%d"|math:$nbjours}}
|
{{else}}
|
||||||
|
{{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_debut:$ts_fin}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* pour simplifier : 360 jours par an *}}
|
{{* pour simplifier : 360 jours par an *}}
|
||||||
{{if $nbjours > 360}}
|
{{:assign nbjours="round(%f/365*360)"|math:$nbjours}}
|
||||||
{{:assign nbjours=360}}
|
|
||||||
{{/if}}
|
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
- account_ok
|
- account_ok
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{:assign quote="'"}}
|
|
||||||
{{:assign condition=" AND ("}}
|
{{:assign condition=" AND ("}}
|
||||||
{{#foreach from=$prefix_array item="code"}}
|
{{#foreach from=$prefix_array item="code"}}
|
||||||
{{:assign condition=$condition|cat:" code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}}
|
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||||
|
{{:assign condition=$condition|cat:" code LIKE "|cat:$code|cat:" OR "}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign condition=$condition|cat:"0)"}}
|
{{:assign condition=$condition|cat:"0)"}}
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
{{if $current == 'index'}}
|
{{if $current == 'index'}}
|
||||||
<aside>
|
<aside>
|
||||||
@ -16,9 +18,10 @@
|
|||||||
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li>
|
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li>
|
||||||
<li {{if $subcurrent == 'no_amort'}}class="current"{{/if}}><a href="index.html?amort=no_amort">Non amortissables</a></li>
|
<li {{if $subcurrent == 'no_amort'}}class="current"{{/if}}><a href="index.html?amort=no_amort">Non amortissables</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{if $subsubcurrent == 'amortization'}}
|
{{if $subsubcurrent == 'amortization'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li class="current"><a>Amortissements</a></li>
|
<li class="title"><strong>Amortissements</strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
{{:include file="_nav.html" current="index"}}
|
{{:include file="_nav.html" current="index"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{:read file="./defaut.json" assign="config_json"}}
|
||||||
|
{{:assign config_defaut=$config_json|json_decode}}
|
||||||
|
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
{{#form on="add"}}
|
{{#form on="add"}}
|
||||||
|
|
||||||
@ -55,10 +59,6 @@
|
|||||||
- est présent dans le PC de l'exercice correspondant à la date
|
- est présent dans le PC de l'exercice correspondant à la date
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{:read file="./defaut.json" assign="config_json"}}
|
|
||||||
{{:assign config_defaut=$config_json|json_decode}}
|
|
||||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
|
||||||
|
|
||||||
{{:include
|
{{:include
|
||||||
file="_check_account.html"
|
file="_check_account.html"
|
||||||
account=$debit_account
|
account=$debit_account
|
||||||
@ -123,22 +123,28 @@
|
|||||||
{{:assign var="projects.%d"|args:$id value=$label}}
|
{{:assign var="projects.%d"|args:$id value=$label}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
|
{{#foreach from=$prefix_array item="code"}}
|
||||||
|
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign patterns=$pattern_array|implode:"|"}}
|
||||||
|
{{:assign date=$now|date:'Y-m-d'}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Ajouter une immobilisation</legend>
|
<legend>Ajouter une immobilisation</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" help="Cocher pour ne pas amortir" onclick="toggleInputs('f_no_amort_1', ['f_date_mes','f_duree'])"}}
|
{{:input id="no_amort" type="checkbox" value=1 name="no_amort" label="Ne pas amortir" help="Cocher pour ne pas amortir" onclick="toggleInputs('f_no_amort_1', ['f_date_mes','f_duree'])"}}
|
||||||
{{:input type="date" name="date_achat" label="Date d'acquisition" required=true default=$now|date_short}}
|
{{:input type="date" name="date_achat" label="Date d'acquisition" required=true default=$now|date_short onchange="setDate('date_achat', ['credit_account', 'debit_account'])"}}
|
||||||
{{:input type="date" name="date_mes" label="Date de mise en service" help="à renseigner uniquement si différente de la date d'acquisition"}}
|
{{:input type="date" name="date_mes" label="Date de mise en service" help="à renseigner uniquement si différente de la date d'acquisition"}}
|
||||||
{{:input type="text" name="designation" label="Désignation" required=true}}
|
{{:input type="text" name="designation" label="Désignation" required=true}}
|
||||||
{{:input type="money" name="montant" label="Montant" required=true}}
|
{{:input type="money" name="montant" label="Montant" required=true}}
|
||||||
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1}}
|
{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}}
|
||||||
{{:input
|
{{:input
|
||||||
type="list"
|
type="list"
|
||||||
name="credit_account"
|
name="credit_account"
|
||||||
label="Compte de décaissement"
|
label="Compte de décaissement"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?targets=1:2:3&key=code"
|
target="!acc/charts/accounts/selector.php?types=%s&date=%s"|args:"1|2|3":$date
|
||||||
default=$bank_account
|
default=$bank_account
|
||||||
}}
|
}}
|
||||||
{{:input
|
{{:input
|
||||||
@ -146,7 +152,7 @@
|
|||||||
name="debit_account"
|
name="debit_account"
|
||||||
label="Compte d'immobilisation (20xx, 21xx, ...)"
|
label="Compte d'immobilisation (20xx, 21xx, ...)"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?key=code"
|
target="!acc/charts/accounts/selector.php?date=%s&codes=%s"|args:$date:$patterns
|
||||||
default=$immo_account
|
default=$immo_account
|
||||||
}}
|
}}
|
||||||
{{if $projects != null}}
|
{{if $projects != null}}
|
||||||
@ -161,9 +167,9 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{* activer/désactiver les champs passés en paramètres *}}
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function toggleInputs(idcb, idfields) {
|
{{* activer/désactiver les champs passés en paramètres *}}
|
||||||
|
function toggleInputs(idcb, idfields) {
|
||||||
const noamort = document.getElementById(idcb);
|
const noamort = document.getElementById(idcb);
|
||||||
for (let id of idfields) {
|
for (let id of idfields) {
|
||||||
const field = document.getElementById(id);
|
const field = document.getElementById(id);
|
||||||
@ -174,7 +180,22 @@
|
|||||||
field.removeAttribute("disabled");
|
field.removeAttribute("disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
{{* fixer la date des sélecteurs *}}
|
||||||
|
function setDate(b_date, button_names) {
|
||||||
|
const elem_date = document.querySelector("input[name=" + b_date + "]");
|
||||||
|
const date_fr = elem_date.value;
|
||||||
|
const new_date = date_fr.replace(/([0-9]+)\/([0-9]+)\/([0-9]+)/, "$3-$2-$1");
|
||||||
|
for (const name of button_names) {
|
||||||
|
const button = document.querySelector("button[data-name=" + name + "]");
|
||||||
|
const b_value = button.value;
|
||||||
|
const new_value = b_value.replace(/date=[0-9]+-[0-9]+-[0-9]+/, 'date=' + new_date);
|
||||||
|
console.log(" date = " + new_date + " old_val = " + b_value + " new_val = " + new_value);
|
||||||
|
button.setAttribute('value', new_value);
|
||||||
|
console.log("button_value = " + button.value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg|match:"attach"}}
|
{{if $_GET.msg|match:"attach"}}
|
||||||
{{:assign msg="Attachement effectué (écriture %s)"|args:$_GET.trans_id}}
|
{{:assign msg="Attachement écriture %s effectué"|args:$_GET.trans_id}}
|
||||||
{{elseif $_GET.msg|match:"detach"}}
|
{{elseif $_GET.msg|match:"detach"}}
|
||||||
{{:assign msg="Attachement supprimé (écriture %s)"|args:$_GET.trans_id}}
|
{{:assign msg="Détachement écriture %s affectué"|args:$_GET.trans_id}}
|
||||||
{{elseif $_GET.msg|match:"amortissement"}}
|
{{elseif $_GET.msg|match:"amortissement"}}
|
||||||
{{:assign msg="Amortissement enregistré"}}
|
{{:assign msg="Amortissement enregistré"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
@ -38,20 +38,22 @@
|
|||||||
line.debit as montant,
|
line.debit as montant,
|
||||||
trans.id as trans_id,
|
trans.id as trans_id,
|
||||||
trans.label as label,
|
trans.label as label,
|
||||||
|
trans.date,
|
||||||
y.id as year_id,
|
y.id as year_id,
|
||||||
y.end_date as date_amort,
|
y.end_date as date_amort,
|
||||||
project.label as project_label
|
project.label as project_label
|
||||||
from acc_transactions_lines as line
|
FROM acc_transactions_lines AS line
|
||||||
inner join acc_transactions as trans on line.id_transaction = trans.id
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||||
inner join acc_years as y on trans.id_year = y.id
|
INNER JOIN acc_years AS y ON trans.id_year = y.id
|
||||||
left join acc_projects AS project ON line.id_project = project.id
|
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
||||||
where line.id = :line_id;
|
WHERE line.id = :line_id;
|
||||||
:line_id = $_GET.immo_id|intval
|
:line_id = $_GET.immo_id|intval
|
||||||
assign=ligne_immo
|
assign=ligne_immo
|
||||||
}}
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
{{:assign date_debut=$ligne_immo.date}}
|
||||||
|
|
||||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
||||||
@ -70,11 +72,10 @@
|
|||||||
trans.date as amort_date,
|
trans.date as amort_date,
|
||||||
trans.label as trans_label,
|
trans.label as trans_label,
|
||||||
trans.id_year as amort_year,
|
trans.id_year as amort_year,
|
||||||
acc.id as account_id,
|
account.id as account_id,
|
||||||
acc.code as account_code,
|
account.code as account_code,
|
||||||
acc.label as account_name
|
account.label as account_label
|
||||||
FROM
|
FROM acc_transactions_lines as l_immo
|
||||||
acc_transactions_lines as l_immo
|
|
||||||
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
||||||
INNER JOIN acc_transactions_links as links
|
INNER JOIN acc_transactions_links as links
|
||||||
ON (
|
ON (
|
||||||
@ -84,11 +85,13 @@
|
|||||||
)
|
)
|
||||||
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||||
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
INNER join acc_accounts as acc on l_amort.id_account = acc.id
|
INNER join acc_accounts as account on l_amort.id_account = account.id
|
||||||
WHERE
|
WHERE
|
||||||
l_immo.id = :line_id
|
l_immo.id = :line_id
|
||||||
AND
|
AND
|
||||||
l_amort.credit <> 0
|
l_amort.credit <> 0
|
||||||
|
AND
|
||||||
|
account.code LIKE '28%'
|
||||||
ORDER BY trans.date;
|
ORDER BY trans.date;
|
||||||
:line_id = $_GET.immo_id|intval
|
:line_id = $_GET.immo_id|intval
|
||||||
assign=linked_lines.
|
assign=linked_lines.
|
||||||
@ -99,7 +102,13 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
<h2>Amortissement de « {{$ligne_immo.label}} » d'un montant de {{"%f"|math:$ligne_immo.montant|money_currency}} en date du {{$date_debut|date_short}}{{if $duree != null}} sur {{$duree}} ans{{/if}}</h2>
|
<h3>Amortissement de «
|
||||||
|
<a class="num"
|
||||||
|
href={{"%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}>#{{$ligne_immo.trans_id}}</a>
|
||||||
|
{{$ligne_immo.label}} » d'un montant de
|
||||||
|
{{"%f"|math:$ligne_immo.montant|money_currency}}
|
||||||
|
en date du {{$date_debut|date_short}}{{if $duree != null}} sur {{$duree}} ans{{/if}}
|
||||||
|
</h3>
|
||||||
|
|
||||||
{{if $duree != null}}
|
{{if $duree != null}}
|
||||||
{{* montant de l'annuité théorique *}}
|
{{* montant de l'annuité théorique *}}
|
||||||
@ -122,12 +131,7 @@
|
|||||||
{{:assign solde=$ligne_immo.montant}}
|
{{:assign solde=$ligne_immo.montant}}
|
||||||
{{if $linked_lines != null}}
|
{{if $linked_lines != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h3 class="ruler">
|
<h3 class="center-block ruler">Amortissements rattachés</h3>
|
||||||
Amortissements attachés à « <a class="num"
|
|
||||||
href={{"%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}>{{$ligne_immo.trans_id}}</a>
|
|
||||||
{{$ligne_immo.label}} »
|
|
||||||
({{"%f"|math:$ligne_immo.montant|money_currency}}, {{$date_debut|date_short}})
|
|
||||||
</h3>
|
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -162,7 +166,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
||||||
<td>{{$line.account_name}}</td>
|
<td>{{$line.account_label}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line:$ligne_immo.immo_id shape="plus"}}
|
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line:$ligne_immo.immo_id shape="plus"}}
|
||||||
</td>
|
</td>
|
||||||
@ -182,7 +186,7 @@
|
|||||||
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
||||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite_courante:$solde}}
|
{{:assign annuite_courante="min(%f,%f)"|math:$annuite_courante:$solde}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h3 class="ruler">Amortissements à enregistrer</h3>
|
<h3 class="center-block ruler">Amortissements à enregistrer</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -198,7 +202,7 @@
|
|||||||
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
||||||
{{:assign solde_prec=$solde}}
|
{{:assign solde_prec=$solde}}
|
||||||
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
||||||
{{#select id from acc_years where :amort_date >= start_date and :amort_date <= end_date and status == 0; :amort_date=$date_amort|parse_date}}
|
{{#select id FROM acc_years WHERE :amort_date >= start_date AND :amort_date <= end_date AND status == 0; :amort_date=$date_amort|parse_date}}
|
||||||
{{:assign enregistrer=1}}
|
{{:assign enregistrer=1}}
|
||||||
{{:assign current_year=$id}}
|
{{:assign current_year=$id}}
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -237,50 +241,41 @@
|
|||||||
|
|
||||||
{{if $_GET.amort == null || $_GET.amort != "fini"}}
|
{{if $_GET.amort == null || $_GET.amort != "fini"}}
|
||||||
|
|
||||||
{{* amortissement à exclure *}}
|
|
||||||
{{:include
|
|
||||||
file="_amort_exclus.html"
|
|
||||||
keep="amort_exclus"
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{* Autres amortissements non rattachés *}}
|
{{* Autres amortissements non rattachés *}}
|
||||||
{{#select
|
{{#select
|
||||||
li.id as l_id,
|
line.id as l_id,
|
||||||
li.id_transaction as t_id,
|
line.id_transaction as t_id,
|
||||||
li.credit as montant,
|
line.credit as amort_amount,
|
||||||
li.reference,
|
line.label as l_label,
|
||||||
li.label as l_label,
|
|
||||||
trans.date as t_date,
|
trans.date as t_date,
|
||||||
trans.label as t_label,
|
trans.label as t_label,
|
||||||
acc.code as a_code,
|
trans.id_year as amort_year,
|
||||||
acc.label as a_label,
|
account.id as account_id,
|
||||||
y.label as y_label
|
account.code as account_code,
|
||||||
from acc_transactions_lines as li
|
account.label as account_label
|
||||||
inner join acc_accounts as acc on acc.id = li.id_account
|
FROM acc_transactions_lines AS line
|
||||||
inner join acc_transactions as trans on trans.id = li.id_transaction
|
INNER JOIN acc_accounts AS account ON account.id = line.id_account
|
||||||
inner join acc_years as y on y.id = trans.id_year
|
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
|
||||||
where acc.code like "28%" AND credit > 0 AND (NOT trans.status & 16)
|
INNER JOIN acc_years AS y ON y.id = trans.id_year
|
||||||
order by trans.date, trans.label;
|
WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16)
|
||||||
|
ORDER BY trans.date, trans.label;
|
||||||
assign=autre_amort
|
assign=autre_amort
|
||||||
}}
|
}}
|
||||||
{{#select
|
{{#select
|
||||||
id_transaction,
|
id_transaction,
|
||||||
id_related
|
id_related
|
||||||
from acc_transactions_links
|
FROM acc_transactions_links
|
||||||
where id_transaction = :id_amort or id_related = :id_amort;
|
WHERE id_transaction = :id_amort OR id_related = :id_amort;
|
||||||
:id_amort=$t_id
|
:id_amort=$t_id
|
||||||
}}
|
}}
|
||||||
{{else}}
|
|
||||||
{{if $autre_amort.t_id|in:$amort_exclus}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign var="autres_amortissements." value=$autre_amort}}
|
{{:assign var="autres_amortissements." value=$autre_amort}}
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{if $autres_amortissements != null}}
|
{{if $autres_amortissements != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h3 class="ruler">Autres amortissements non rattachés</h3>
|
<h3 class="center-block ruler">Autres amortissements non rattachés</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -294,21 +289,21 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{{#foreach from=$autres_amortissements item="line"}}
|
{{#foreach from=$autres_amortissements item="line"}}
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
|
||||||
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.amort_year}}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="num"><a href={{$trans_url}}>#{{$line.t_id}}</a></td>
|
<td class="num"><a href={{$trans_url}}>#{{$line.t_id}}</a></td>
|
||||||
<td>{{$line.t_date|date_short}}</td>
|
<td>{{$line.t_date|date_short}}</td>
|
||||||
<td class="money">{{"%f"|math:$line.montant|money}}</td>
|
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
||||||
<td>{{if $line.l_label == null}}
|
<td>{{if $line.l_label == null}}
|
||||||
{{$line.t_label}}
|
{{$line.t_label}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{$line.l_label}}
|
{{$line.l_label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td>{{$line.a_code}}</td>
|
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
||||||
<td>{{$line.a_label}}</td>
|
<td>{{$line.account_label}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
|
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
|
||||||
</td>
|
</td>
|
||||||
|
@ -29,10 +29,10 @@
|
|||||||
{{:read file="./defaut.json" assign="config_json"}}
|
{{:read file="./defaut.json" assign="config_json"}}
|
||||||
{{:assign config_defaut=$config_json|json_decode}}
|
{{:assign config_defaut=$config_json|json_decode}}
|
||||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||||
{{:assign quote="'"}}
|
|
||||||
{{:assign condition="("}}
|
{{:assign condition="("}}
|
||||||
{{#foreach from=$prefix_array item="code"}}
|
{{#foreach from=$prefix_array item="code"}}
|
||||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}}
|
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||||
|
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign condition=$condition|cat:"0)"}}
|
{{:assign condition=$condition|cat:"0)"}}
|
||||||
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||||
@ -90,10 +90,13 @@
|
|||||||
t_immo.id = links.id_related
|
t_immo.id = links.id_related
|
||||||
)
|
)
|
||||||
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||||
|
INNER JOIN acc_accounts AS account ON l_amort.id_account = account.id
|
||||||
WHERE
|
WHERE
|
||||||
l_immo.id = :line_id
|
l_immo.id = :line_id
|
||||||
AND
|
AND
|
||||||
l_amort.credit <> 0;
|
l_amort.credit <> 0
|
||||||
|
AND
|
||||||
|
account.code LIKE '28%';
|
||||||
:line_id = $immo_id|intval
|
:line_id = $immo_id|intval
|
||||||
}}
|
}}
|
||||||
{{if $amort_amount == null}}
|
{{if $amort_amount == null}}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{* Liste des immobilisations non amortissable *}}
|
{{* Liste des immobilisations non amortissables *}}
|
||||||
|
|
||||||
<section class="immobilisation">
|
<section class="immobilisation">
|
||||||
<h2 class="ruler">Immobilisations non amortissables</h2>
|
<h2 class="ruler">Immobilisations non amortissables</h2>
|
||||||
|
14
index.html
14
index.html
@ -21,8 +21,8 @@
|
|||||||
<p class="block error">Échec enregistrement immobilisation</p>
|
<p class="block error">Échec enregistrement immobilisation</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* supprimer les documents sans écriture associée *}}
|
|
||||||
{{#load type="immo"}}
|
{{#load type="immo"}}
|
||||||
|
{{* supprimer les documents sans écriture associée *}}
|
||||||
{{#select
|
{{#select
|
||||||
line.id as line_id
|
line.id as line_id
|
||||||
FROM acc_transactions_lines as line
|
FROM acc_transactions_lines as line
|
||||||
@ -33,6 +33,18 @@
|
|||||||
{{else}}
|
{{else}}
|
||||||
{{:delete key=$key}}
|
{{:delete key=$key}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
|
{{* supprimer les documents correspondant à une écriture de la balance d'ouverture *}}
|
||||||
|
{{#select
|
||||||
|
line.id as line_id,
|
||||||
|
trans.status
|
||||||
|
FROM acc_transactions_lines as line
|
||||||
|
INNER JOIN acc_transactions AS trans on line.id_transaction = trans.id
|
||||||
|
WHERE line.id = :line_id AND (trans.status & 16);
|
||||||
|
:line_id = $line
|
||||||
|
}}
|
||||||
|
{{:delete key=$key}}
|
||||||
|
{{/select}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{if $amort == "no_amort"}}
|
{{if $amort == "no_amort"}}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name="Amortissements"
|
name="Amortissements"
|
||||||
description="Gestion des amortissements pour le logiciel de comptabilité Paheko (v0.12)"
|
description="Gestion des amortissements pour le logiciel de comptabilité Paheko (v0.16)"
|
||||||
author="Jean-Christophe Engel"
|
author="Jean-Christophe Engel"
|
||||||
author_url="https://git.roflcopter.fr/lesanges"
|
author_url="https://git.roflcopter.fr/lesanges"
|
||||||
home_button=false
|
home_button=false
|
||||||
|
@ -147,7 +147,7 @@
|
|||||||
name="debit_account"
|
name="debit_account"
|
||||||
label="Compte de débit"
|
label="Compte de débit"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?&key=code&year=%d"|args:$year.id
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"68*":$year.id
|
||||||
default=$debit_account
|
default=$debit_account
|
||||||
}}
|
}}
|
||||||
{{:input
|
{{:input
|
||||||
@ -155,7 +155,7 @@
|
|||||||
name="credit_account"
|
name="credit_account"
|
||||||
label="Compte d'amortissement (280xx ou 281xx)"
|
label="Compte d'amortissement (280xx ou 281xx)"
|
||||||
required=true
|
required=true
|
||||||
target="!acc/charts/accounts/selector.php?key=code&year=%d"|args:$year.id
|
target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$year.id
|
||||||
default=$credit_account
|
default=$credit_account
|
||||||
}}
|
}}
|
||||||
</dl>
|
</dl>
|
||||||
|
Loading…
Reference in New Issue
Block a user