Vérification date transfert immo en cours
This commit is contained in:
parent
b50de139f8
commit
bdef57545c
1 changed files with 61 additions and 43 deletions
104
transfer.html
104
transfer.html
|
|
@ -17,8 +17,59 @@
|
|||
{{:error message="Aucun exercice ouvert"}}
|
||||
{{/years}}
|
||||
|
||||
{{* 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
|
||||
}}
|
||||
{{if $max_date == null || $trans_date > $max_date}}
|
||||
{{:assign max_date=$trans_date}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="transfer"}}
|
||||
{{* vérifier que la date de mise en service est postérieure aux dates d'acquisition *}}
|
||||
{{if $_POST.date_mes|parse_date < $max_date}}
|
||||
{{:assign dacq=$max_date|date_short}}
|
||||
{{:error message="La date de mise en service (%s) doit être postérieure à la date d'acquisition d'immobilisation la plus récente (%s) !"|args:$_POST.date_mes:$dacq}}
|
||||
{{/if}}
|
||||
|
||||
{{* 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}}
|
||||
|
|
@ -120,7 +171,6 @@
|
|||
{{: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
|
||||
|
|
@ -137,7 +187,6 @@
|
|||
{{:assign type_immo="other"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}}
|
||||
|
||||
{{/form}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
|
|
@ -148,6 +197,15 @@
|
|||
{{:form_errors}}
|
||||
|
||||
{{* formulaire d'ajout d'immobilisation *}}
|
||||
{{if $_GET.trans == null}}
|
||||
{{:error message="Vous n'avez sélectionné aucune écriture !"}}
|
||||
{{/if}}
|
||||
|
||||
{{if $max_date|strtotime > $now}}
|
||||
{{:assign default_date=$max_date}}
|
||||
{{else}}
|
||||
{{:assign default_date=$now|date_short}}
|
||||
{{/if}}
|
||||
|
||||
{{#select id,label FROM acc_projects WHERE archived = 0;}}
|
||||
{{:assign var="projects.%d"|args:$id value=$label}}
|
||||
|
|
@ -162,53 +220,13 @@
|
|||
<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="date" name="date_mes" label="Date de mise en service" required=true default=$default_date}}
|
||||
{{:input type="text" name="designation" label="Libellé" required=true}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue