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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="check">{{*:input type="checkbox" name="all" value="all"*}}</th>
|
||||
<th class="check"></th>
|
||||
<th class="num">N°</th>
|
||||
<th>Date</th>
|
||||
<th>Libellé</th>
|
||||
|
|
@ -72,7 +72,6 @@
|
|||
{{/foreach}}
|
||||
{{:assign filter_condition=$filter_condition|cat:"0)"}}
|
||||
{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}}
|
||||
{{*:debug condition=$condition*}}
|
||||
|
||||
{{:assign nb_immo=0}}
|
||||
{{:assign total_immo = 0}}
|
||||
|
|
|
|||
106
add_asset.html
106
add_asset.html
|
|
@ -1,6 +1,6 @@
|
|||
{{* -*- 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.}}
|
||||
{{:assign ts_debut=$start_date|strtotime}}
|
||||
|
|
@ -34,23 +34,6 @@
|
|||
{{: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|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 *}}
|
||||
{{:include
|
||||
file="_get_codes.html"
|
||||
|
|
@ -70,17 +53,51 @@
|
|||
- 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
|
||||
file="_check_account.html"
|
||||
account=$debit_account
|
||||
chart_id=$selected_chart
|
||||
prefix_array=$module.config.prefixes
|
||||
prefix_array=$prefix_array
|
||||
keep="account_ok"
|
||||
}}
|
||||
|
||||
{{if $account_ok == null}}
|
||||
{{: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}}
|
||||
|
||||
{{* enregistrer l'écriture *}}
|
||||
|
|
@ -93,35 +110,41 @@
|
|||
date=$_POST.date_achat
|
||||
label=$_POST.designation
|
||||
amount=$_POST.montant
|
||||
debit=$debit_account|keys|value:0
|
||||
credit=$credit_account|keys|value:0
|
||||
debit=$debit_account
|
||||
credit=$credit_account
|
||||
id_project=$_POST.id_project
|
||||
}}
|
||||
|
||||
{{* vérifier s'il y a déjà un document avec le même numéro de ligne *}}
|
||||
{{:assign var="immo_id" value=$result.lines.1.id}}
|
||||
{{#load where="$$.line = :line_id" :line_id=$immo_id}}
|
||||
{{:assign key=$key}}
|
||||
{{else}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{/load}}
|
||||
{{if $status != "unfinished"}}
|
||||
{{* vérifier s'il y a déjà un document avec le même numéro de ligne *}}
|
||||
{{:assign var="immo_id" value=$result.lines.1.id}}
|
||||
{{#load where="$$.line = :line_id" :line_id=$immo_id}}
|
||||
{{:assign key=$key}}
|
||||
{{else}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{/load}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
duration=$duration
|
||||
date=$date_debut
|
||||
status=$status
|
||||
}}
|
||||
{{if $_POST.amortir}}
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$immo_id
|
||||
duration=$duration
|
||||
date=$date_debut
|
||||
status=$status
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{if $status == "unfinished"}}
|
||||
{{:assign type_immo="unfinished"}}
|
||||
{{elseif $_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}}
|
||||
|
||||
{{:admin_header title="Ajout immobilisation" current="module_amortissement"}}
|
||||
|
|
@ -141,6 +164,9 @@
|
|||
{{#foreach from=$module.config.prefixes item="code"}}
|
||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||
{{/foreach}}
|
||||
{{#foreach from=$module.config.unfinished item="code"}}
|
||||
{{:assign var="pattern_array." value="%s*"|args:$code}}
|
||||
{{/foreach}}
|
||||
{{:assign var="patterns" value=$pattern_array|implode:"|"}}
|
||||
|
||||
<div id="erreur" class="hidden">
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ h2[class="aide"], h3[class="aide"] {
|
|||
}
|
||||
|
||||
.informations dl.describe > dt {
|
||||
flex: 0 0 10rem;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue