Compare commits
2 commits
a043e893c5
...
aec5a83eef
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aec5a83eef | ||
|
|
5c2798c734 |
3 changed files with 68 additions and 42 deletions
|
|
@ -42,7 +42,7 @@
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="check">{{*:input type="checkbox" name="all" value="all"*}}</th>
|
<th class="check"></th>
|
||||||
<th class="num">N°</th>
|
<th class="num">N°</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Libellé</th>
|
<th>Libellé</th>
|
||||||
|
|
@ -72,7 +72,6 @@
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign filter_condition=$filter_condition|cat:"0)"}}
|
{{:assign filter_condition=$filter_condition|cat:"0)"}}
|
||||||
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
|
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
|
||||||
{{*:debug condition=$condition*}}
|
|
||||||
|
|
||||||
{{:assign nb_immo=0}}
|
{{:assign nb_immo=0}}
|
||||||
{{:assign total_immo = 0}}
|
{{:assign total_immo = 0}}
|
||||||
|
|
|
||||||
106
add_asset.html
106
add_asset.html
|
|
@ -1,6 +1,6 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{:include file="_get_config.html" keep="module.config.prefixes"}}
|
{{:include file="_get_config.html" keep="module.config"}}
|
||||||
|
|
||||||
{{#years closed=false order="start_date" assign=years.}}
|
{{#years closed=false order="start_date" assign=years.}}
|
||||||
{{:assign ts_debut=$start_date|strtotime}}
|
{{:assign ts_debut=$start_date|strtotime}}
|
||||||
|
|
@ -34,23 +34,6 @@
|
||||||
{{:error message="La date saisie n'est pas dans l'exercice choisi !"}}
|
{{:error message="La date saisie n'est pas dans l'exercice choisi !"}}
|
||||||
{{/if}}
|
{{/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|or:$_POST.date_achat|parse_date}}
|
|
||||||
{{if $date_debut|strtotime < $_POST.date_achat|parse_date|strtotime}}
|
|
||||||
{{:assign dd=$date_debut|date_short}}
|
|
||||||
{{:assign da=$_POST.date_achat|date_short}}
|
|
||||||
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign duration=$_POST.duree|intval}}
|
|
||||||
{{:assign status="managed"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
|
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
|
||||||
{{:include
|
{{:include
|
||||||
file="_get_codes.html"
|
file="_get_codes.html"
|
||||||
|
|
@ -70,17 +53,51 @@
|
||||||
- est présent dans le PC de l'exercice correspondant à la date
|
- est présent dans le PC de l'exercice correspondant à la date
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
|
{{#foreach from=$module.config.prefixes item="code"}}
|
||||||
|
{{:assign var="prefix_array." value=$code}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{#foreach from=$module.config.unfinished item="code"}}
|
||||||
|
{{:assign var="prefix_array." value=$code}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
{{:include
|
{{:include
|
||||||
file="_check_account.html"
|
file="_check_account.html"
|
||||||
account=$debit_account
|
account=$debit_account
|
||||||
chart_id=$selected_chart
|
chart_id=$selected_chart
|
||||||
prefix_array=$module.config.prefixes
|
prefix_array=$prefix_array
|
||||||
keep="account_ok"
|
keep="account_ok"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{if $account_ok == null}}
|
{{if $account_ok == null}}
|
||||||
{{:assign compte=$debit_account|implode:""}}
|
{{:assign compte=$debit_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}}
|
{{:redirect url="add_account.html?account=%s&chart=%s&immo_id=%s"|args:$compte:$selected_chart:$_GET.immo_id}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:assign debit_account=$debit_account|keys|value:0}}
|
||||||
|
{{:assign credit_account=$credit_account|keys|value:0}}
|
||||||
|
|
||||||
|
{{* déterminer si le compte d'immo est un compte d'immo en cours *}}
|
||||||
|
{{#foreach from=$module.config.unfinished item="code"}}
|
||||||
|
{{if $debit_account|strpos:$code === 0}}
|
||||||
|
{{:assign status="unfinished"}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{if $status != "unfinished" && ! $_POST.amortir}}
|
||||||
|
{{* ne pas amortir *}}
|
||||||
|
{{:assign duration=0}}
|
||||||
|
{{:assign date_debut=$_POST.date_achat|parse_date}}
|
||||||
|
{{:assign status="ignored"}}
|
||||||
|
{{elseif $status != "unfinished"}}
|
||||||
|
{{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}}
|
||||||
|
{{:assign date_debut=$_POST.date_mes|or:$_POST.date_achat|parse_date}}
|
||||||
|
{{if $date_debut|strtotime < $_POST.date_achat|parse_date|strtotime}}
|
||||||
|
{{:assign dd=$date_debut|date_short}}
|
||||||
|
{{:assign da=$_POST.date_achat|date_short}}
|
||||||
|
{{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign duration=$_POST.duree|intval}}
|
||||||
|
{{:assign status="managed"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* enregistrer l'écriture *}}
|
{{* enregistrer l'écriture *}}
|
||||||
|
|
@ -93,35 +110,41 @@
|
||||||
date=$_POST.date_achat
|
date=$_POST.date_achat
|
||||||
label=$_POST.designation
|
label=$_POST.designation
|
||||||
amount=$_POST.montant
|
amount=$_POST.montant
|
||||||
debit=$debit_account|keys|value:0
|
debit=$debit_account
|
||||||
credit=$credit_account|keys|value:0
|
credit=$credit_account
|
||||||
id_project=$_POST.id_project
|
id_project=$_POST.id_project
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{* vérifier s'il y a déjà un document avec le même numéro de ligne *}}
|
{{if $status != "unfinished"}}
|
||||||
{{:assign var="immo_id" value=$result.lines.1.id}}
|
{{* vérifier s'il y a déjà un document avec le même numéro de ligne *}}
|
||||||
{{#load where="$$.line = :line_id" :line_id=$immo_id}}
|
{{:assign var="immo_id" value=$result.lines.1.id}}
|
||||||
{{:assign key=$key}}
|
{{#load where="$$.line = :line_id" :line_id=$immo_id}}
|
||||||
{{else}}
|
{{:assign key=$key}}
|
||||||
{{:assign key=""|uuid}}
|
{{else}}
|
||||||
{{/load}}
|
{{:assign key=""|uuid}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
{{* enregistrer les infos de l'immobilisation *}}
|
{{* enregistrer les infos de l'immobilisation *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$key
|
key=$key
|
||||||
validate_schema="schema.json"
|
validate_schema="schema.json"
|
||||||
type="immo"
|
type="immo"
|
||||||
line=$immo_id
|
line=$immo_id
|
||||||
duration=$duration
|
duration=$duration
|
||||||
date=$date_debut
|
date=$date_debut
|
||||||
status=$status
|
status=$status
|
||||||
}}
|
}}
|
||||||
{{if $_POST.amortir}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $status == "unfinished"}}
|
||||||
|
{{:assign type_immo="unfinished"}}
|
||||||
|
{{elseif $_POST.amortir}}
|
||||||
{{:assign type_immo="managed"}}
|
{{:assign type_immo="managed"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign type_immo="other"}}
|
{{:assign type_immo="other"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}}
|
{{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}}
|
||||||
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
||||||
|
|
@ -141,6 +164,9 @@
|
||||||
{{#foreach from=$module.config.prefixes item="code"}}
|
{{#foreach from=$module.config.prefixes item="code"}}
|
||||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
{{#foreach from=$module.config.unfinished item="code"}}
|
||||||
|
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||||
|
{{/foreach}}
|
||||||
{{:assign var="patterns" value=$pattern_array|implode:"|"}}
|
{{:assign var="patterns" value=$pattern_array|implode:"|"}}
|
||||||
|
|
||||||
<div id="erreur" class="hidden">
|
<div id="erreur" class="hidden">
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ h2[class="aide"], h3[class="aide"] {
|
||||||
}
|
}
|
||||||
|
|
||||||
.informations dl.describe > dt {
|
.informations dl.describe > dt {
|
||||||
|
flex: 0 0 10rem;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue