Compare commits
2 commits
c07b77e942
...
49b207c0e1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49b207c0e1 | ||
|
|
e62b2a9f70 |
2 changed files with 45 additions and 7 deletions
|
|
@ -206,7 +206,7 @@
|
|||
name="credit_account"
|
||||
label="Compte de décaissement"
|
||||
required=true
|
||||
target="!acc/charts/accounts/selector.php?types=%s&id_year=%d"|args:"1|2|3":$selected_year
|
||||
target="!acc/charts/accounts/selector.php?types=%s&id_year=%d"|args:"1|2|3|4":$selected_year
|
||||
}}
|
||||
{{:input
|
||||
type="list"
|
||||
|
|
|
|||
|
|
@ -2,16 +2,15 @@
|
|||
{{:admin_header title="Modifier l'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
||||
|
||||
{{*
|
||||
@param immo_line_id
|
||||
@param immo_doc_id
|
||||
¿ @param type_immo : managed, amortized, archived, other ?
|
||||
|
||||
TODO :
|
||||
- ¿ faire une ligne modifiable pour chaque avoir avec un bouton de suppression ?
|
||||
- séparer les cas des immo simples et complexes (BOI)
|
||||
par exemple pour la durée d'amort par défaut {{:input ...}}
|
||||
- prise en charge immo => param = immo_line_id
|
||||
- modif param immo => param = immo_doc_id
|
||||
- DONE possibilité supprimer liaison écriture avoir
|
||||
*}}
|
||||
|
||||
{{* données de l'immobilisation *}}
|
||||
|
|
@ -61,7 +60,7 @@
|
|||
{{:assign credit=$credit}}
|
||||
{{:assign credit_trans_id=$id}}
|
||||
{{/select}}
|
||||
{{:assign var="linked_immos." value=$credit_trans_id}}
|
||||
{{:assign var="linked_immos." doc=$id trans=$credit_trans_id}}
|
||||
{{if $amount == null}}
|
||||
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
|
||||
{{else}}
|
||||
|
|
@ -146,6 +145,44 @@
|
|||
{{:assign status="managed"}}
|
||||
{{/if}}
|
||||
|
||||
{{* écritures de crédit *}}
|
||||
{{#foreach from=$linked_immos item="elem"}}
|
||||
{{if ! $_POST.credit_id|has:$elem.trans}}
|
||||
{{:assign var="docs_to_remove." value=$elem.doc}}
|
||||
{{:assign var="links_to_remove." value=$elem.trans}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{if $docs_to_remove != null}}
|
||||
{{:assign remove_set=$docs_to_remove|implode:","}}
|
||||
{{:assign remove_set="("|cat:$remove_set|cat:")"}}
|
||||
{{:delete where="id IN %s"|args:$remove_set}}
|
||||
|
||||
{{* idem avec acc_transactions_links *}}
|
||||
{{#select
|
||||
CASE links.id_related = :immo_trans_id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
END as linked_id
|
||||
FROM acc_transactions_links as links
|
||||
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
||||
:immo_trans_id = $ligne_immo.immo_trans_id
|
||||
}}
|
||||
{{if ! $linked_id|in:$links_to_remove}}
|
||||
{{:assign var="linked_transactions." value=$linked_id}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
|
||||
{{* Enregistrer les liaisons *}}
|
||||
{{:api
|
||||
method="POST"
|
||||
path="accounting/transaction/%s/transactions"|args:$ligne_immo.immo_trans_id
|
||||
assign="result"
|
||||
assign_code="result_code"
|
||||
transactions=$linked_transactions
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{* enregistrer les infos de l'immobilisation *}}
|
||||
{{:save
|
||||
key=$info_immo.key
|
||||
|
|
@ -167,6 +204,7 @@
|
|||
{{:assign type_immo="other"}}
|
||||
{{/if}}
|
||||
{{:redirect force="index.html?ok=1&msg=infos&type_immo=%s"|args:$type_immo}}
|
||||
|
||||
{{/form}}
|
||||
{{:form_errors}}
|
||||
|
||||
|
|
@ -216,14 +254,14 @@
|
|||
{{/if}}
|
||||
{{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat}}
|
||||
{{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes}}
|
||||
{{if $linked_immos}}
|
||||
{{if $linked_immos != null}}
|
||||
<dt><label>Écritures d'avoir liées à l'immobilisation</label></dt>
|
||||
<dd>
|
||||
<span class="input-list avoirs">
|
||||
<label for="credit_id">Écritures :</label>
|
||||
{{#foreach from=$linked_immos item="id"}}
|
||||
{{#foreach from=$linked_immos item="elem"}}
|
||||
<span class="label">
|
||||
{{:input type="hidden" name="credit_id" value=$id}}{{$id}}
|
||||
<input type="hidden" name="credit_id[]" value="{{$elem.trans}}">{{$elem.trans}}
|
||||
<button data-icon="✘" type="button" class=" icn-btn" title="Cliquer pour supprimer la liaison"></button>
|
||||
</span>
|
||||
{{/foreach}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue