Classer ou déclasser manuellement une écriture « à ignorer »
This commit is contained in:
parent
4c160e054a
commit
262b25889b
3 changed files with 120 additions and 1 deletions
|
|
@ -31,6 +31,9 @@
|
|||
</p>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
{{:input type="checkbox" value=1 name="unhide" label="Afficher les écritures marquées ignorées" }}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<table class="list">
|
||||
|
|
@ -79,6 +82,15 @@
|
|||
ORDER BY trans.date DESC;
|
||||
!condition=$condition
|
||||
}}
|
||||
{{* voir si l'écriture a été marquée ignorée *}}
|
||||
{{:assign ignore=false}}
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id AND $$.status = 'ignored'" :line_id=$immo_id|intval}}
|
||||
{{:assign ignore=true}}
|
||||
{{/load}}
|
||||
{{if $ignore && $_POST.unhide == null}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{* voir s'il existe une écriture qui solde l'immobilisation *}}
|
||||
{{#select
|
||||
count(*) AS count
|
||||
|
|
@ -92,6 +104,7 @@
|
|||
}}
|
||||
{{:assign count=$count}}
|
||||
{{/select}}
|
||||
|
||||
{{* S'il y a plus d'une écriture de même montant on ne peut pas décider *}}
|
||||
{{if $count == 1}}
|
||||
{{:continue}}
|
||||
|
|
@ -109,7 +122,14 @@
|
|||
<td class="money">{{"%f"|math:$debit|money:false}}</td>
|
||||
<td class="account_code"><a href={{$compte_url}}>{{$account_code}}</a></td>
|
||||
<td>{{$account_label}}</td>
|
||||
<td class="actions"></td>
|
||||
<td class="actions">
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="ignore.html?immo_id=%s"|args:$immo_id
|
||||
shape="edit"
|
||||
target="_dialog"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/select}}
|
||||
</tbody>
|
||||
|
|
@ -132,4 +152,13 @@
|
|||
|
||||
}
|
||||
|
||||
function changeVisibility(evt, idcheck = 'f_unhide_1') {
|
||||
this.form.dispatchEvent(new Event('submit'));
|
||||
this.form.submit();
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_unhide_1').onclick = changeVisibility;
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
|
|
|||
85
ignore.html
Normal file
85
ignore.html
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Marquer la ligne d'écriture « à ignorer »
|
||||
@param immo_id : numéro de ligne
|
||||
*}}
|
||||
|
||||
{{#select
|
||||
trans.id AS trans_id,
|
||||
trans.date AS date,
|
||||
trans.label AS label,
|
||||
line.debit AS amount
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
||||
WHERE line.id = :line_id
|
||||
;
|
||||
:line_id = $_GET.immo_id
|
||||
assign=ligne_immo
|
||||
}}
|
||||
{{else}}
|
||||
{{:error message="Il n'y a aucune écriture avec le numéro de ligne %s !"|args:$_GET.immo_id}}
|
||||
{{/select}}
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}{{/load}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="proceed"}}
|
||||
{{if $_POST.ignore != null && $info_immo == null}}
|
||||
{{* ignorer l'écriture *}}
|
||||
{{:assign duration=0}}
|
||||
{{:assign status="ignored"}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="schema.json"
|
||||
type="immo"
|
||||
line=$_GET.immo_id|intval
|
||||
duration=$duration
|
||||
date=$ligne_immo.date
|
||||
status=$status
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=unfinished"}}
|
||||
{{elseif $_POST.ignore == null && $info_immo != null}}
|
||||
{{* dés-ignorer l'écriture *}}
|
||||
{{:delete id=$info_immo.id}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=unfinished"}}
|
||||
{{else}}
|
||||
{{:redirect force="index.html?type_immo=unfinished"}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Ignorer l'écriture" custom_css="./style.css" current="module_amortissement"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset id="classement_immo">
|
||||
<legend>Ignorer</legend>
|
||||
<div class="informations">
|
||||
<dl class="describe">
|
||||
<dt>Écriture</dt>
|
||||
<dd><span class="num"><a href={{$trans_url}}>#{{$ligne_immo.trans_id}}</a></span> {{$ligne_immo.label}}</dd>
|
||||
<dt>Montant</dt>
|
||||
<dd><strong class="money">{{"%f"|math:$ligne_immo.amount|money_currency}}</strong></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dl>
|
||||
{{if $info_immo != null && $info_immo.status == "ignored"}}
|
||||
{{:input type="checkbox" name="ignore" checked="checked" value="1" label="Ignoré" help="Décocher pour ne plus ignorer l'écriture"}}
|
||||
{{else}}
|
||||
{{:input type="checkbox" name="ignore" value="1" label="Ignoré" help="Cocher pour ignorer l'écriture ; elle n'apparaitra plus dans la liste des immobilisations"}}
|
||||
{{/if}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="proceed" label="Confirmer" shape="right" class="main"}}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
{{:admin_footer}}
|
||||
|
|
@ -38,6 +38,11 @@ h2[class="aide"], h3[class="aide"] {
|
|||
margin-right: 0;
|
||||
}
|
||||
|
||||
.informations dl.describe > dd {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
nav.amort aside {
|
||||
margin-top : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue