Sortie immobilisation du bilan
This commit is contained in:
		
							parent
							
								
									d669b5c95b
								
							
						
					
					
						commit
						ea8d805dba
					
				
					 8 changed files with 939 additions and 21 deletions
				
			
		|  | @ -18,4 +18,3 @@ | ||||||
| 
 | 
 | ||||||
| {{* pour simplifier : 360 jours par an *}} | {{* pour simplifier : 360 jours par an *}} | ||||||
| {{:assign nbjours="round(%f/365*360)"|math:$nbjours}} | {{:assign nbjours="round(%f/365*360)"|math:$nbjours}} | ||||||
| {{:debug nbjours=$nbjours}} |  | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								_nav.html
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								_nav.html
									
										
									
									
									
								
							|  | @ -13,11 +13,11 @@ | ||||||
| 	</ul> | 	</ul> | ||||||
| 
 | 
 | ||||||
| 	{{if $current == 'index'}} | 	{{if $current == 'index'}} | ||||||
| 	<ul class="sub"> | 		<ul class="sub"> | ||||||
| 		<li {{if $subcurrent == 'encours'}}class="current"{{/if}}><a href="index.html?amort=encours">En cours</a></li> | 			<li {{if $subcurrent == 'encours'}}class="current"{{/if}}><a href="index.html?amort=encours">En cours</a></li> | ||||||
| 		<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li> | 			<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li> | ||||||
| 		<li {{if $subcurrent == 'archive'}}class="current"{{/if}}><a href="index.html?amort=archive">Archivées</a></li> | 			<li {{if $subcurrent == 'archive'}}class="current"{{/if}}><a href="index.html?amort=archive">Archivées</a></li> | ||||||
| 		<li {{if $subcurrent == 'autres'}}class="current"{{/if}}><a href="index.html?amort=autres">Autres</a></li> | 			<li {{if $subcurrent == 'autres'}}class="current"{{/if}}><a href="index.html?amort=autres">Autres</a></li> | ||||||
| 		</ul> | 		</ul> | ||||||
| 
 | 
 | ||||||
| 		{{if $subsubcurrent == 'amortization'}} | 		{{if $subsubcurrent == 'amortization'}} | ||||||
|  |  | ||||||
							
								
								
									
										66
									
								
								archives.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								archives.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,66 @@ | ||||||
|  | {{* -*- brindille -*- *}} | ||||||
|  | 
 | ||||||
|  | {{* Liste des immobilisations archivées *}} | ||||||
|  | 
 | ||||||
|  | <section class="immobilisation"> | ||||||
|  | 	<h2 class="ruler">Immobilisations archivées</h2> | ||||||
|  | 
 | ||||||
|  | 	<table class="list"> | ||||||
|  | 		<thead> | ||||||
|  | 			<tr> | ||||||
|  | 				<th>N°</th> | ||||||
|  | 				<th>Date</th> | ||||||
|  | 				<th>Libellé</th> | ||||||
|  | 				<th class="nombre">Montant</th> | ||||||
|  | 				<th>N° compte</th> | ||||||
|  | 				<th>Compte</th> | ||||||
|  | 				<th>Projet</th> | ||||||
|  | 				<th class="actions"></th> | ||||||
|  | 			</tr> | ||||||
|  | 		</thead> | ||||||
|  | 		<tbody> | ||||||
|  | 
 | ||||||
|  | 			{{#load type="immo" where="$$.status = 'archived'"}} | ||||||
|  | 				{{:assign var="lines." value="'%s'"|args:$line}} | ||||||
|  | 			{{/load}} | ||||||
|  | 			{{:assign lines=$lines|implode:","}} | ||||||
|  | 			{{:assign lines="("|cat:$lines|cat:")"}} | ||||||
|  | 			{{:assign condition="line.id IN %s"|args:$lines}} | ||||||
|  | {{*:debug condition=$condition*}} | ||||||
|  | 			{{#select | ||||||
|  | 				trans.id as trans_id, | ||||||
|  | 				trans.label as trans_label, | ||||||
|  | 				trans.date as trans_date, | ||||||
|  | 				line.id as immo_id, | ||||||
|  | 				account.id as account_id, | ||||||
|  | 				account.code as account_code, | ||||||
|  | 				account.label as account_label, | ||||||
|  | 				line.debit AS debit, | ||||||
|  | 				project.label as project_label, | ||||||
|  | 				trans.id_year as trans_id_year | ||||||
|  | 				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 | ||||||
|  | 				INNER JOIN acc_years AS years ON trans.id_year = years.id | ||||||
|  | 				LEFT JOIN acc_projects AS project ON line.id_project = project.id | ||||||
|  | 				WHERE !condition | ||||||
|  | 				ORDER BY trans.date DESC; | ||||||
|  | 				!condition=$condition | ||||||
|  | 			}} | ||||||
|  | 				{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} | ||||||
|  | 				{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}} | ||||||
|  | 			<tr> | ||||||
|  | 				<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td> | ||||||
|  | 				<td>{{$trans_date|date_short}}</td> | ||||||
|  | 				<td>{{$trans_label}}</td> | ||||||
|  | 				<td class="money">{{"%f"|math:$debit|money:false}}</td> | ||||||
|  | 				<td><a href={{$compte_url}}>{{$account_code}}</a></td> | ||||||
|  | 				<td>{{$account_label}}</td> | ||||||
|  | 				<td>{{$project_label}}</td> | ||||||
|  | 				<td class="actions"> | ||||||
|  | 				</td> | ||||||
|  | 			</tr> | ||||||
|  | 			{{/select}} | ||||||
|  | 		</tbody> | ||||||
|  | 	</table> | ||||||
|  | </section> | ||||||
							
								
								
									
										247
									
								
								balance_sheet_exit.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										247
									
								
								balance_sheet_exit.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,247 @@ | ||||||
|  | {{* -*- brindille -*- *}} | ||||||
|  | 
 | ||||||
|  | {{* | ||||||
|  | 	Sortir une immobilisation du bilan | ||||||
|  | 	@param : | ||||||
|  | 	- immo_id : numéro de ligne de l'immo | ||||||
|  | *}} | ||||||
|  | 
 | ||||||
|  | {{* récupérer les infos de l'immobilisation *}} | ||||||
|  | {{#select | ||||||
|  | 	line.id as line_id, | ||||||
|  | 	line.debit as montant, | ||||||
|  | 	line.id_project as project_id, | ||||||
|  | 	trans.id as trans_id, | ||||||
|  | 	trans.date as trans_date, | ||||||
|  | 	trans.label as trans_label, | ||||||
|  | 	acc.id as account_id, | ||||||
|  | 	y.id as year_id | ||||||
|  | 	FROM acc_transactions_lines AS line | ||||||
|  | 	INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id | ||||||
|  | 	INNER JOIN acc_accounts as acc ON line.id_account = acc.id | ||||||
|  | 	INNER JOIN acc_years AS y ON trans.id_year = y.id | ||||||
|  | 	WHERE line.id = :line_id; | ||||||
|  | 	:line_id = $_GET.immo_id|intval | ||||||
|  | 	assign=ligne_immo | ||||||
|  | }} | ||||||
|  | {{else}} | ||||||
|  | 	{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}} | ||||||
|  | {{/select}} | ||||||
|  | 
 | ||||||
|  | {{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}} | ||||||
|  | {{/load}} | ||||||
|  | 
 | ||||||
|  | {{* voir s'il existe des écritures d'amortissement associées *}} | ||||||
|  | {{#select | ||||||
|  | 	sum(l_amort.credit) as amort_amount, | ||||||
|  | 	CASE | ||||||
|  | 		WHEN links.id_related = t_immo.id THEN links.id_transaction | ||||||
|  | 		ELSE links.id_related | ||||||
|  | 	END as amort_trans_id | ||||||
|  | 	FROM acc_transactions_lines as l_immo | ||||||
|  | 	INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction | ||||||
|  | 	INNER JOIN acc_transactions_links as links | ||||||
|  | 	ON ( | ||||||
|  | 		t_immo.id = links.id_transaction | ||||||
|  | 		OR | ||||||
|  | 		t_immo.id = links.id_related | ||||||
|  | 	) | ||||||
|  | 	INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction | ||||||
|  | 	INNER JOIN acc_accounts AS account ON l_amort.id_account = account.id | ||||||
|  | 	WHERE | ||||||
|  | 		l_immo.id = :line_id | ||||||
|  | 	AND | ||||||
|  | 		l_amort.credit <> 0 | ||||||
|  | 	AND | ||||||
|  | 		account.code LIKE '28%'; | ||||||
|  | 	:line_id = $_GET.immo_id|intval | ||||||
|  | }} | ||||||
|  | 	{{if $amort_amount == null}} | ||||||
|  | 		{{:assign amort_amount=0}} | ||||||
|  | 	{{else}} | ||||||
|  | 		{{:assign amort_amount=$amort_amount}} | ||||||
|  | 	{{/if}} | ||||||
|  | {{/select}} | ||||||
|  | {{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$amort_amount}} | ||||||
|  | 
 | ||||||
|  | {{* Traiter l'envoi du formulaire *}} | ||||||
|  | {{#form on="proceed"}} | ||||||
|  | 
 | ||||||
|  | 	{{* | ||||||
|  | 		vérifier que la date de sortie est située après la date de mise en | ||||||
|  | 		service ou à défaut de la date d'acquisition de l'immobilisation | ||||||
|  | 	*}} | ||||||
|  | 	{{if $info_immo.date != null}} | ||||||
|  | 		{{if $_POST.date_sortie|parse_date < $info_immo.date}} | ||||||
|  | 			{{:assign immo_date=$info_immo.date|date_short}} | ||||||
|  | 			{{:error message="La date choisie doit être postérieure à la date de mise en service de l'immobilisation (%s)"|args:$immo_date}} | ||||||
|  | 		{{/if}} | ||||||
|  | 	{{else}} | ||||||
|  | 		{{if $_POST.date_sortie|parse_date < $ligne_immo.trans_date}} | ||||||
|  | 			{{:assign immo_date=$ligne_immo.trans_date|date_short}} | ||||||
|  | 			{{:error message="La date choisie doit être postérieure à la date d'acquisition de l'immobilisation (%s)"|args:$immo_date}} | ||||||
|  | 		{{/if}} | ||||||
|  | 	{{/if}} | ||||||
|  | 
 | ||||||
|  | 	{{* vérifier que la date est située dans un exercice ouvert *}} | ||||||
|  | 	{{:include | ||||||
|  | 		file="_check_date.html" | ||||||
|  | 		date=$_POST.date_sortie | ||||||
|  | 		keep="open_years, selected_year, selected_chart" | ||||||
|  | 	}} | ||||||
|  | 	{{if $selected_year == null}} | ||||||
|  | 		{{:assign msg_years=""}} | ||||||
|  | 		{{#foreach from=$open_years}} | ||||||
|  | 			{{:assign debut=$start_date|date_short}} | ||||||
|  | 			{{:assign fin=$end_date|date_short}} | ||||||
|  | 			{{:assign msg_years=$msg_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "|cat:$debut|cat:" à "|cat:$fin}} | ||||||
|  | 		{{/foreach}} | ||||||
|  | 		{{:error message="La date choisie n'est dans aucun exercice ouvert !!\nExercices ouverts : %s"|args:$msg_years}} | ||||||
|  | 	{{/if}} | ||||||
|  | 
 | ||||||
|  | 	{{if $valeur_nette > 0}} | ||||||
|  | 		{{if $info_immo.duration == null}} | ||||||
|  | 			{{if $_POST.duree == null}} | ||||||
|  | 				{{:error message="Vous devez renseigner la durée de l'amortissement"}} | ||||||
|  | 			{{else}} | ||||||
|  | 				{{:assign var=info_immo.duration value=$_POST.duree}} | ||||||
|  | 			{{/if}} | ||||||
|  | 		{{/if}} | ||||||
|  | 	{{/if}} | ||||||
|  | 
 | ||||||
|  | 	{{* Cession de l'immobilisation  | ||||||
|  | 	{{if $_POST.cession}} | ||||||
|  | 		{{if $_POST.montant_cession == ""}} | ||||||
|  | 			{{:error message="Le montant de la cession doit être renseigné"}} | ||||||
|  | 		{{/if}} | ||||||
|  | 		{{if $_POST.montant_cession <= 0}} | ||||||
|  | 			{{:error message="Le montant de la cession doit être strictement positif"}} | ||||||
|  | 		{{/if}} | ||||||
|  | 	{{/if}} | ||||||
|  | *}} | ||||||
|  | 	{{:redirect to="compute_exit_data.html?immo_id=%s&amort_amount=%s&year=%s&exit_date=%s&duree_amort=%s"|args:$_GET.immo_id:$amort_amount:$selected_year:$_POST.date_sortie:$_POST.duree}} | ||||||
|  | {{* | ||||||
|  | 	{{:redirect to="write_exit.html?immo_id=%s&amort_amount=%s&year=%s&exit_date=%s&cession=%s&duree_amort=%s"|args:$_GET.immo_id:$amort_amount:$selected_year:$_POST.date_sortie:$_POST.montant_cession:$_POST.duree}} | ||||||
|  | *}} | ||||||
|  | {{/form}} | ||||||
|  | 
 | ||||||
|  | {{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortissement"}} | ||||||
|  | {{* barre de navigation *}} | ||||||
|  | {{if ! $dialog}} | ||||||
|  | 	{{:include file="_nav.html" current="index"}} | ||||||
|  | {{/if}} | ||||||
|  | {{:form_errors}} | ||||||
|  | 
 | ||||||
|  | {{*:debug ligne_immo=$ligne_immo amort_amount=$amort_amount*}} | ||||||
|  | 
 | ||||||
|  | {{* formulaire de sortie du bilan *}} | ||||||
|  | <h3>Sortir l'immobilisation « {{$ligne_immo.trans_label}} » du bilan</h3> | ||||||
|  | <form method="post" action=""> | ||||||
|  | 
 | ||||||
|  | 	<div class="informations"> | ||||||
|  | 		<legend>Données de l'imobilisation</legend> | ||||||
|  | 		<dl class="describe"> | ||||||
|  | 			<dt><label>Montant</label></dt> | ||||||
|  | 			<dd id="montant_immo" class="money">{{$ligne_immo.montant|money_currency:false}}</dd> | ||||||
|  | 			<dt><label>Date d'acquisition</label></dt> | ||||||
|  | 			<dd >{{$ligne_immo.trans_date|date_short}}</dd> | ||||||
|  | 			{{if $info_immo.date != null && $info_immo.date != $ligne_immo.trans_date}} | ||||||
|  | 				<dt><label>Date de mise en service</label></dt> | ||||||
|  | 				<dd>{{$info_immo.date|date_short}}</dd> | ||||||
|  | 			{{/if}} | ||||||
|  | 			{{if $info_immo.duration != null}} | ||||||
|  | 				<dt>Durée de l'amortissement</dt> | ||||||
|  | 				<dd id="duree_amort" class="num">{{$info_immo.duration}} ans</dd> | ||||||
|  | 			{{/if}} | ||||||
|  | 			<dt><label>Montant des amortissements</label></dt> | ||||||
|  | 			<dd id="montant_amort" class="money">{{$amort_amount|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd> | ||||||
|  | 			<dt><label>Valeur nette résiduelle</label></dt> | ||||||
|  | 			<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd> | ||||||
|  | 		</dl> | ||||||
|  | 	</div> | ||||||
|  | 
 | ||||||
|  | 	<fieldset> | ||||||
|  | 		<legend>Informations de sortie</legend> | ||||||
|  | 		<dl> | ||||||
|  | 			{{:input type="date" name="date_sortie" label="Date de sortie du bilan" required=true default=$now|date_short}} | ||||||
|  | 			{{if $info_immo.date == null && $valeur_nette > 0}} | ||||||
|  | 				{{:input type="date" name="date_mes" label="Date de mise en service" help="à renseigner uniquement si différente de la date d'acquisition"}} | ||||||
|  | 				{{/if}} | ||||||
|  | 			{{if $info_immo.duration == null && $valeur_nette > 0}} | ||||||
|  | 				{{:input type="number" name="duree" label="Durée d'amortissement" required=true min=1 onchange="computeAmort()" help="La durée est nécessaire pour calculer l'amortissement résiduel"}} | ||||||
|  | 			{{/if}} | ||||||
|  | {{* | ||||||
|  | 			{{:input type="checkbox" value=1 name="cession" label="Cession" help="Cocher si la sortie est due à une cession" onclick="toggleHiddenAndFocus('f_cession_1', ['infos_cession'], 'f_montant_cession')"}} | ||||||
|  | 			<div id="infos_cession" class="hidden"> | ||||||
|  | 				{{:input type="money" name="montant_cession" label="Montant de la cession" required=true}} | ||||||
|  | 			</div> | ||||||
|  | *}} | ||||||
|  | 		</dl> | ||||||
|  | 	</fieldset> | ||||||
|  | 
 | ||||||
|  | 	<p class="submit"> | ||||||
|  | 		{{:button type="submit" name="proceed" label="Poursuivre" shape="right" class="main"}} | ||||||
|  | 	</p> | ||||||
|  | 
 | ||||||
|  | </form> | ||||||
|  | 
 | ||||||
|  | <script type="text/javascript"> | ||||||
|  | /* | ||||||
|  | 	- activer/désactiver les champs passés en paramètres | ||||||
|  | 	- donner le focus au champ de saisie du montant | ||||||
|  | */ | ||||||
|  | function toggleHiddenAndFocus(idcb, idfields, idinput) { | ||||||
|  | 	const cession = document.getElementById(idcb); | ||||||
|  | 	for (let id of idfields) { | ||||||
|  | 		const field = document.getElementById(id); | ||||||
|  | 		if (cession.checked) { | ||||||
|  | 			field.setAttribute("class", ""); | ||||||
|  | 			document.getElementById(idinput).focus(); | ||||||
|  | 		 } | ||||||
|  | 		 else { | ||||||
|  | 			 field.setAttribute("class","hidden") | ||||||
|  | 		 } | ||||||
|  | 	 } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function getDate(name) { | ||||||
|  | 	const elem = document.getElementsByName(name)[0].value; | ||||||
|  | 	const jma = elem.split('/'); | ||||||
|  | 	const dd = new Date(jma[2], jma[1]-1, jma[0]); | ||||||
|  | 	return dd; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function getNumber(text) { | ||||||
|  | 	return num = Number(text.replace(/ /g, '').replace(/,/, '.').replace(/€/, '')); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function computeAmort() { | ||||||
|  | 	const exitDate = getDate('date_sortie'); | ||||||
|  | //	console.log('exit = ' + exitDate); | ||||||
|  | 	const year = exitDate.getFullYear(); | ||||||
|  | 	const yearStart = new Date(year, 0); | ||||||
|  | 	const oneDay = 24 * 60 * 60 * 1000; | ||||||
|  | 	const nbDays = Math.round((exitDate - yearStart) / oneDay); | ||||||
|  | 	console.log("nb jours = " + nbDays); | ||||||
|  | 	const montantImmo = getNumber(document.getElementById('montant_immo').innerText); | ||||||
|  | 	//	console.log('montant_immo= ' + montantImmo); | ||||||
|  | 	// durée d'amortissement | ||||||
|  | 	let elem = document.getElementById('duree_amort'); | ||||||
|  | 	let duree_amort; | ||||||
|  | 	if (elem == null) { | ||||||
|  | 		duree_amort = document.getElementById('f_duree').value; | ||||||
|  | 	} else { | ||||||
|  | 		duree_amort = Number(elem.innerText.replace(/ .*/, '')); | ||||||
|  | 	} | ||||||
|  | 	const annuite = montantImmo / duree_amort; | ||||||
|  | 	const amort_comp = annuite / 360 * nbDays; | ||||||
|  | 	console.log("durée amort = " + duree_amort + ", annuité=" + annuite + ", amort comp = " + amort_comp); | ||||||
|  | } | ||||||
|  | /* | ||||||
|  | (function () { | ||||||
|  | 	toggleHiddenAndFocus('f_cession_1', ['infos_cession'], 'f_montant_cession'); | ||||||
|  | 	})(); | ||||||
|  | */ | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | {{:admin_footer}} | ||||||
|  | @ -28,10 +28,10 @@ | ||||||
| 			{{:read file="./defaut.json" assign="config_json"}} | 			{{:read file="./defaut.json" assign="config_json"}} | ||||||
| 			{{:assign config_defaut=$config_json|json_decode}} | 			{{:assign config_defaut=$config_json|json_decode}} | ||||||
| 			{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}} | 			{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}} | ||||||
| 			{{:assign quote="'"}} |  | ||||||
| 			{{:assign condition="("}} | 			{{:assign condition="("}} | ||||||
| 			{{#foreach from=$prefix_array item="code"}} | 			{{#foreach from=$prefix_array item="code"}} | ||||||
| 				{{:assign condition=$condition|cat:" account.code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}} | 				{{:assign code=$code|cat:"%"|quote_sql}} | ||||||
|  | 				{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}} | ||||||
| 			{{/foreach}} | 			{{/foreach}} | ||||||
| 			{{:assign condition=$condition|cat:"0)"}} | 			{{:assign condition=$condition|cat:"0)"}} | ||||||
| 			{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}} | 			{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}} | ||||||
|  | @ -60,7 +60,7 @@ | ||||||
| 				{{* voir si l'immo est prise en charge *}} | 				{{* voir si l'immo est prise en charge *}} | ||||||
| 				{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}} | 				{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}} | ||||||
| 					{{:assign duration=$duration}} | 					{{:assign duration=$duration}} | ||||||
| 					{{if $noamort}} | 					{{if $status == "ignored"}} | ||||||
| 						{{:assign amortissable="non"}} | 						{{:assign amortissable="non"}} | ||||||
| 					{{else}} | 					{{else}} | ||||||
| 						{{:assign amortissable="oui"}} | 						{{:assign amortissable="oui"}} | ||||||
|  | @ -71,6 +71,32 @@ | ||||||
| 				{{if $amortissable == "non"}} | 				{{if $amortissable == "non"}} | ||||||
| 					{{:continue}} | 					{{:continue}} | ||||||
| 				{{/if}} | 				{{/if}} | ||||||
|  | 
 | ||||||
|  | 				{{* voir s'il existe une écriture qui solde l'immobilisation *}} | ||||||
|  | 				{{:assign ignore=false}} | ||||||
|  | 				{{#select | ||||||
|  | 						line.id AS line, | ||||||
|  | 						line.id_transaction AS trans, | ||||||
|  | 						line.debit, | ||||||
|  | 						line.label, | ||||||
|  | 						line2.id AS line2, | ||||||
|  | 						line2.id_transaction AS trans2, | ||||||
|  | 						line2.credit, | ||||||
|  | 						line2.label | ||||||
|  | 					FROM acc_transactions_lines AS line | ||||||
|  | 					INNER JOIN acc_accounts AS acc ON acc.id = line.id_account | ||||||
|  | 					INNER JOIN acc_transactions_lines AS line2 ON line2.id_account = acc.id | ||||||
|  | 					WHERE | ||||||
|  | 						line.id = :line_id | ||||||
|  | 						AND line2.credit = line.debit; | ||||||
|  | 					:line_id = $immo_id|intval | ||||||
|  | 					}} | ||||||
|  | 					{{:assign ignore=true}} | ||||||
|  | 				{{/select}} | ||||||
|  | 				{{if $ignore}} | ||||||
|  | 					{{:continue}} | ||||||
|  | 				{{/if}} | ||||||
|  | 
 | ||||||
| 				{{* voir s'il existe des écritures d'amortissement associées *}} | 				{{* voir s'il existe des écritures d'amortissement associées *}} | ||||||
| 				{{#select | 				{{#select | ||||||
| 					sum(l_amort.credit) as amort_amount, | 					sum(l_amort.credit) as amort_amount, | ||||||
|  | @ -104,7 +130,8 @@ | ||||||
| 						{{:assign exist_amort=true}} | 						{{:assign exist_amort=true}} | ||||||
| 					{{/if}} | 					{{/if}} | ||||||
| 				{{/select}} | 				{{/select}} | ||||||
| 				{{* immo amortie ? *}} | 
 | ||||||
|  | 				{{* classement par onglet *}} | ||||||
| 				{{if $amort == "encours" && $amort_amount >= $debit || | 				{{if $amort == "encours" && $amort_amount >= $debit || | ||||||
| 					 $amort == "fini" && $amort_amount < $debit || | 					 $amort == "fini" && $amort_amount < $debit || | ||||||
| 					 $amortissable == "nsp" && ! $exist_amort | 					 $amortissable == "nsp" && ! $exist_amort | ||||||
|  | @ -135,19 +162,13 @@ | ||||||
| 							target="_dialog" | 							target="_dialog" | ||||||
| 						}} | 						}} | ||||||
| 					{{/if}} | 					{{/if}} | ||||||
| 					{{if $amort == "encours"}} | 					{{if $amort == "encours" || $amort == "fini"}} | ||||||
| 						{{:linkbutton | 						{{:linkbutton | ||||||
| 							label="Cession" | 							label="Sortir du bilan" | ||||||
| 							href="" | 							href="balance_sheet_exit.html?immo_id=%s"|args:$immo_id | ||||||
| 							shape="money" |  | ||||||
| 						}} |  | ||||||
| 					{{elseif $amort == "fini"}} |  | ||||||
| 						{{:linkbutton |  | ||||||
| 							label="Rebut" |  | ||||||
| 							href="" |  | ||||||
| 							shape="export" | 							shape="export" | ||||||
| 						}} | 						}} | ||||||
| 				{{/if}} | 					{{/if}} | ||||||
| 					{{:linkbutton | 					{{:linkbutton | ||||||
| 						label="Amortissements" | 						label="Amortissements" | ||||||
| 						href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort | 						href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ | ||||||
| 		{{:delete key=$key}} | 		{{:delete key=$key}} | ||||||
| 	{{/select}} | 	{{/select}} | ||||||
| 
 | 
 | ||||||
| 	{{* supprimer les documents correspondant à une écriture de la balance d'ouverture *}} | 	{{* supprimer les documents correspondant à une écriture de la balance d'ouverture | ||||||
| 	{{#select | 	{{#select | ||||||
| 		line.id as line_id, | 		line.id as line_id, | ||||||
| 		trans.status | 		trans.status | ||||||
|  | @ -45,10 +45,13 @@ | ||||||
| 		}} | 		}} | ||||||
| 		{{:delete key=$key}} | 		{{:delete key=$key}} | ||||||
| 	{{/select}} | 	{{/select}} | ||||||
|  | 	 *}} | ||||||
| {{/load}} | {{/load}} | ||||||
| 
 | 
 | ||||||
| {{if $amort == "autres"}} | {{if $amort == "autres"}} | ||||||
| 	{{:include file="./immobilisations_autres.html"}} | 	{{:include file="./immobilisations_autres.html"}} | ||||||
|  | {{elseif $amort == "archive"}} | ||||||
|  | 	{{:include file="archives.html"}} | ||||||
| {{elseif $amort == "encours" || $amort == "fini"}} | {{elseif $amort == "encours" || $amort == "fini"}} | ||||||
| 	{{:include file="./immobilisations.html"}} | 	{{:include file="./immobilisations.html"}} | ||||||
| {{/if}} | {{/if}} | ||||||
|  |  | ||||||
							
								
								
									
										20
									
								
								style.css
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								style.css
									
										
									
									
									
								
							|  | @ -17,3 +17,23 @@ h2[class="aide"], h3[class="aide"] { | ||||||
| 	margin-top: 0.5em; | 	margin-top: 0.5em; | ||||||
| 	margin-bottom: 0.5em; | 	margin-bottom: 0.5em; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .informations { | ||||||
|  | 	margin-top : 0.5em; | ||||||
|  | 	margin-bottom : 0.5em; | ||||||
|  | 	padding : 0.5em; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .informations legend { | ||||||
|  | 	font-weight: bold; | ||||||
|  | 	border-bottom : solid 1px var(--gLightBorderColor); | ||||||
|  | 	margin-bottom : 0.5em; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .informations dt::after { | ||||||
|  | 	content: ' :'; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .informations dl.describe > dt { | ||||||
|  | 	margin-right: 0; | ||||||
|  | } | ||||||
|  |  | ||||||
							
								
								
									
										562
									
								
								write_exit.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										562
									
								
								write_exit.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,562 @@ | ||||||
|  | {{* -*- brindille -*- *}} | ||||||
|  | 
 | ||||||
|  | {{* | ||||||
|  | 	Enregistrer les écritures de sortie du bilan | ||||||
|  | 	paramètres : | ||||||
|  | 	- immo_id		: numéro de ligne de l'écriture d'immobilisation | ||||||
|  | 	- amort_amount	: montant des amortissements | ||||||
|  | 	- year			: exercice de la date de sortie de l'immobilisation | ||||||
|  | 	- exit_date		: date de sortie de l'immobilisation | ||||||
|  | 	- cession		: montant de la cession (optionnel) | ||||||
|  | 	- duree_amort	: durée de l'amortiseement (optionnel) | ||||||
|  | *}} | ||||||
|  | 
 | ||||||
|  | {{* TEMPORAIRE *}} | ||||||
|  | {{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortissement"}} | ||||||
|  | 
 | ||||||
|  | {{* barre de navigation *}} | ||||||
|  | {{if ! $dialog}} | ||||||
|  | 	{{:include file="_nav.html" current="amortization"}} | ||||||
|  | {{/if}} | ||||||
|  | {{* /TEMPORAIRE *}} | ||||||
|  | 
 | ||||||
|  | {{#select | ||||||
|  | 	id_transaction, | ||||||
|  | 	id_account, | ||||||
|  | 	debit, | ||||||
|  | 	label, | ||||||
|  | 	id_project | ||||||
|  | 	FROM acc_transactions_lines | ||||||
|  | 	WHERE id = :immo_id; | ||||||
|  | 	:immo_id = $_GET.immo_id|intval | ||||||
|  | 	assign="ligne_immo" | ||||||
|  | }} | ||||||
|  | {{/select}} | ||||||
|  | 
 | ||||||
|  | {{#select | ||||||
|  | 	label,date | ||||||
|  | 	FROM acc_transactions | ||||||
|  | 	WHERE id = :trans_id; | ||||||
|  | 	:trans_id = $ligne_immo.id_transaction | ||||||
|  | 	assign="trans_immo" | ||||||
|  | }} | ||||||
|  | {{/select}} | ||||||
|  | 
 | ||||||
|  | {{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}} | ||||||
|  | {{/load}} | ||||||
|  | 
 | ||||||
|  | {{* date de début de l'exercice *}} | ||||||
|  | {{#select start_date FROM acc_years WHERE id = :year_id; :year_id = $_GET.year}} | ||||||
|  | 	{{:assign date_debut=$start_date}} | ||||||
|  | {{/select}} | ||||||
|  | 
 | ||||||
|  | {{*if $date_debut < "2025-01-01"*}} | ||||||
|  | 	{{:assign vnc_code=675}} | ||||||
|  | 	{{:assign cession_code=775}} | ||||||
|  | {{* | ||||||
|  | {{else}} | ||||||
|  | 	{{:assign vnc_code=657}} | ||||||
|  | 	{{:assign cession_code=757}} | ||||||
|  | {{/if}} | ||||||
|  | *}} | ||||||
|  | 
 | ||||||
|  | {{if $info_immo.duration == null}} | ||||||
|  | 	{{:assign duree_amort=$_GET.duree_amort}} | ||||||
|  | {{else}} | ||||||
|  | 	{{:assign duree_amort=$info_immo.duration}} | ||||||
|  | {{/if}} | ||||||
|  | 
 | ||||||
|  | {{:assign valeur_nette="%f-%f"|math:$ligne_immo.debit:$_GET.amort_amount}} | ||||||
|  | {{:assign amort_comp=0}}		{{* amortissement complémentaire jqà date sortie *}} | ||||||
|  | {{:assign amort_except=0}}		{{* amortissement exceptionnel jqà date fin amortissement *}} | ||||||
|  | {{if $valeur_nette > 0}} | ||||||
|  | 	{{:include | ||||||
|  | 		file="_calcul_dates.html" | ||||||
|  | 		date_debut=$date_debut|parse_date | ||||||
|  | 		date_fin=$_GET.exit_date|parse_date | ||||||
|  | 		keep="nbjours" | ||||||
|  | 	}} | ||||||
|  | {{:debug nbjours=$nbjours}} | ||||||
|  | 	{{:assign annuite="%f/%f"|math:$ligne_immo.debit:$duree_amort}} | ||||||
|  | 	{{:assign amort_comp="round(%f/360*%f, 0)"|math:$annuite:$nbjours}} | ||||||
|  | 	{{:assign amort_comp="min(%f, %f)"|math:$valeur_nette:$amort_comp}} | ||||||
|  | 
 | ||||||
|  | 	{{if $_GET.cession == null}} | ||||||
|  | 		{{:assign amort_except="%f-%f-%f"|math:$ligne_immo.debit:$_GET.amort_amount:$amort_comp}} | ||||||
|  | 	{{/if}} | ||||||
|  | {{/if}} | ||||||
|  | 
 | ||||||
|  | {{if $_GET.cession == null}} | ||||||
|  | 	{{:assign montant_cession=0}} | ||||||
|  | {{else}} | ||||||
|  | 	{{:assign montant_cession="%f*100"|math:$_GET.cession}} | ||||||
|  | {{/if}} | ||||||
|  | 
 | ||||||
|  | {{*:debug | ||||||
|  | 	get=$_GET | ||||||
|  | 	montant=$ligne_immo.debit | ||||||
|  | 	amort_comp=$amort_comp | ||||||
|  | 	amort_except=$amort_except | ||||||
|  | 	montant_cession=$montant_cession | ||||||
|  | *}} | ||||||
|  | 
 | ||||||
|  | {{* Traiter l'envoi du formulaire *}} | ||||||
|  | {{#form on="save"}} | ||||||
|  | {{*:debug post=$_POST*}} | ||||||
|  | 
 | ||||||
|  | 	{{if $valeur_nette > 0}} | ||||||
|  | 		{{* immo non totalement amortie *}} | ||||||
|  | 
 | ||||||
|  | 		{{* lignes d'écriture de l'amortissement complémentaire *}} | ||||||
|  | 		{{:include | ||||||
|  | 			file="_get_codes.html" | ||||||
|  | 			account=$_POST.comp_account | ||||||
|  | 			keep="account_code" | ||||||
|  | 		}} | ||||||
|  | 		{{:assign comp_account=$account_code|keys|key:0}} | ||||||
|  | 		{{:include | ||||||
|  | 			file="_get_codes.html" | ||||||
|  | 			account=$_POST.amort_comp_account | ||||||
|  | 			keep="account_code" | ||||||
|  | 		}} | ||||||
|  | 		{{:assign amort_account=$account_code|keys|key:0}} | ||||||
|  | 
 | ||||||
|  | 		{{* ? Faut-il vérifier la validité des comptes ? *}} | ||||||
|  | 
 | ||||||
|  | 		{{:assign libelle="Amortissement complémentaire "|cat:$trans_immo.label}} | ||||||
|  | 		{{:assign | ||||||
|  | 			var="lines." | ||||||
|  | 			debit="%f/100"|math:$amort_comp | ||||||
|  | 			account=$comp_account | ||||||
|  | 			id_project=$ligne_immo.id_project | ||||||
|  | 			label=$libelle | ||||||
|  | 		}} | ||||||
|  | 		{{:assign | ||||||
|  | 			var="lines." | ||||||
|  | 			credit="%f/100"|math:$amort_comp | ||||||
|  | 			account=$amort_account | ||||||
|  | 			id_project=$ligne_immo.id_project | ||||||
|  | 			label=$libelle | ||||||
|  | 		}} | ||||||
|  | 		{{:assign valeur_nette="%f-%f"|math:$valeur_nette:$amort_comp}} | ||||||
|  | 
 | ||||||
|  | 		{{if $_GET.cession == null}} | ||||||
|  | 			{{* lignes d'écriture de l'amortissement exceptionnel *}} | ||||||
|  | 			{{:include | ||||||
|  | 				file="_get_codes.html" | ||||||
|  | 				account=$_POST.except_account | ||||||
|  | 				keep="account_code" | ||||||
|  | 			}} | ||||||
|  | 			{{:assign except_account=$account_code|keys|key:0}} | ||||||
|  | 			{{:assign libelle="Amortissement exceptionnel "|cat:$trans_immo.label}} | ||||||
|  | 			{{:assign | ||||||
|  | 				var="lines." | ||||||
|  | 				debit="%f/100"|math:$amort_except | ||||||
|  | 				account=$except_account | ||||||
|  | 				id_project=$ligne_immo.id_project | ||||||
|  | 				label=$libelle | ||||||
|  | 			}} | ||||||
|  | 			{{:assign | ||||||
|  | 				var="lines." | ||||||
|  | 				credit="%f/100"|math:$amort_except | ||||||
|  | 				account=$amort_account | ||||||
|  | 				id_project=$ligne_immo.id_project | ||||||
|  | 				label=$libelle | ||||||
|  | 				}} | ||||||
|  | 			{{:assign valeur_nette="%f-%f"|math:$valeur_nette:$amort_except}} | ||||||
|  | 		{{/if}} | ||||||
|  | {{*:debug lines=$lines*}} | ||||||
|  | 
 | ||||||
|  | 		{{:api | ||||||
|  | 			method="POST" | ||||||
|  | 			path="accounting/transaction" | ||||||
|  | 			assign="result" | ||||||
|  | 			assign_code="result_code" | ||||||
|  | 			id_year=$_GET.year | ||||||
|  | 			type="advanced" | ||||||
|  | 			date=$_GET.exit_date | ||||||
|  | 			label="Amortissement final "|cat:$trans_immo.label | ||||||
|  | 			lines=$lines | ||||||
|  | 			linked_transactions=$ligne_immo.id_transaction | ||||||
|  | 		}} | ||||||
|  | 	{{/if}} | ||||||
|  | 
 | ||||||
|  | 	{{* écriture de sortie du bilan *}} | ||||||
|  | {{*:debug valeur_nette=$valeur_nette*}} | ||||||
|  | 	{{:assign libelle="Sortie du bilan de "|cat:$trans_immo.label}} | ||||||
|  | 	{{:assign lines=null}} | ||||||
|  | 	{{:assign | ||||||
|  | 		var="lines." | ||||||
|  | 		id_account=$ligne_immo.id_account | ||||||
|  | 		credit="%f/100"|math:$ligne_immo.debit | ||||||
|  | 		id_project=$ligne_immo.id_project | ||||||
|  | 		label=$libelle | ||||||
|  | 	}} | ||||||
|  | 	{{:assign | ||||||
|  | 		var="lines." | ||||||
|  | 		account=$amort_account | ||||||
|  | 		debit="(%f-%f)/100"|math:$ligne_immo.debit:$valeur_nette | ||||||
|  | 		id_project=$ligne_immo.id_project | ||||||
|  | 		label=$libelle | ||||||
|  | 	}} | ||||||
|  | 	{{if $valeur_nette > 0}} | ||||||
|  | 		{{:assign | ||||||
|  | 			var="lines." | ||||||
|  | 			account=$vnc_code | ||||||
|  | 			debit="%f/100"|math:$valeur_nette | ||||||
|  | 			id_project=$ligne_immo.id_project | ||||||
|  | 			label=$libelle | ||||||
|  | 		}} | ||||||
|  | 	{{/if}} | ||||||
|  | {{*:debug lines=$lines*}} | ||||||
|  | 	{{:api | ||||||
|  | 		method="POST" | ||||||
|  | 		path="accounting/transaction" | ||||||
|  | 		assign="result" | ||||||
|  | 		assign_code="result_code" | ||||||
|  | 		id_year=$_GET.year | ||||||
|  | 		type="advanced" | ||||||
|  | 		date=$_GET.exit_date | ||||||
|  | 		label=$libelle | ||||||
|  | 		lines=$lines | ||||||
|  | 		linked_transactions=$ligne_immo.id_transaction | ||||||
|  | 	}} | ||||||
|  | 
 | ||||||
|  | 	{{if $montant_cession > 0}} | ||||||
|  | 		{{* Cession de l'immobilisation *}} | ||||||
|  | 		{{:assign libelle="Produit cession "|cat:$trans_immo.label}} | ||||||
|  | 		{{:include | ||||||
|  | 			file="_get_codes.html" | ||||||
|  | 			account=$_POST.creance_account | ||||||
|  | 			keep="account_code" | ||||||
|  | 		}} | ||||||
|  | 		{{:assign creance_account=$account_code|keys|key:0}} | ||||||
|  | 		{{:include | ||||||
|  | 			file="_get_codes.html" | ||||||
|  | 			account=$_POST.cession_account | ||||||
|  | 			keep="account_code" | ||||||
|  | 		}} | ||||||
|  | 		{{:assign cession_account=$account_code|keys|key:0}} | ||||||
|  | 		{{:api | ||||||
|  | 			method="POST" | ||||||
|  | 			path="accounting/transaction" | ||||||
|  | 			assign="result" | ||||||
|  | 			assign_code="result_code" | ||||||
|  | 			id_year=$_GET.year | ||||||
|  | 			type="credit" | ||||||
|  | 			date=$_GET.exit_date | ||||||
|  | 			label=$libelle | ||||||
|  | 			amount="%f/100"|math:$montant_cession | ||||||
|  | 			debit=$creance_account | ||||||
|  | 			credit=$cession_account | ||||||
|  | 			id_project=$ligne_immo.id_project | ||||||
|  | 			linked_transactions=$ligne_immo.id_transaction | ||||||
|  | 		}} | ||||||
|  | 	{{/if}} | ||||||
|  | 
 | ||||||
|  | 	{{* mettre à jour l'état de l'immobilisation *}} | ||||||
|  | 	{{:save | ||||||
|  | 		key=$info_immo.key | ||||||
|  | 		status="archived" | ||||||
|  | 	}} | ||||||
|  | 
 | ||||||
|  | 	{{:redirect to="index.html?amort=archive"}} | ||||||
|  | 
 | ||||||
|  | {{/form}} | ||||||
|  | 
 | ||||||
|  | {{:form_errors}} | ||||||
|  | {{*:debug get=$_GET*}} | ||||||
|  | 
 | ||||||
|  | {{* Préparer les infos pour le formulaire *}} | ||||||
|  | 
 | ||||||
|  | {{* déterminer les comptes pour les différentes écritures *}} | ||||||
|  | {{:assign var="comp_account.6811" value="6811 — Dot. aux amortissements des immobilisations"}} | ||||||
|  | {{:assign var="except_account.687" value="687 — Dot. aux amortissements & provisions - Charges exceptionnelles"}} | ||||||
|  | 
 | ||||||
|  | {{#select code, label from acc_accounts where id = :id; | ||||||
|  | 	:id=$ligne_immo.id_account | ||||||
|  | 	assign=immo_account_info | ||||||
|  | }} | ||||||
|  | {{/select}} | ||||||
|  | {{*:debug immo_account_info=$immo_account_info*}} | ||||||
|  | 
 | ||||||
|  | {{:include | ||||||
|  | 	file="./_get_amort_code.html" | ||||||
|  | 	code_immo=$immo_account_info.code | ||||||
|  | 	keep="code_amort" | ||||||
|  | }} | ||||||
|  | {{:assign | ||||||
|  | 	var="amort_account.%s"|args:$code_amort | ||||||
|  | 	value="%s — Amortissements "|args:$code_amort|cat:$immo_account_info.label}} | ||||||
|  | {{:assign | ||||||
|  | 	var="immo_account.%s"|args:$immo_account_info.code | ||||||
|  | 	value="%s — Immobilisation "|args::$immo_account_info.code|cat:$immo_account_info.label}} | ||||||
|  | {{:assign | ||||||
|  | 	var="vnc_account.%s"|args:$vnc_code | ||||||
|  | 	value="%s — Valeurs comptables des éléments d'actifs cédés"|args:$vnc_code}} | ||||||
|  | {{:assign | ||||||
|  | 	var="cession_account.%s"|args:$cession_code | ||||||
|  | 	value="%s — Produits des cessions d'actif"|args:$cession_code}} | ||||||
|  | {{:assign var="creance_account.462" value="462 — Créances sur cessions d'immobilisations"}} | ||||||
|  | 
 | ||||||
|  | {{*:debug | ||||||
|  | comp_account=$comp_account | ||||||
|  | except_account=$except_account | ||||||
|  | amort_account=$amort_account | ||||||
|  | immo_account=$immo_account | ||||||
|  | vnc_account=$vnc_account | ||||||
|  | *}} | ||||||
|  | 
 | ||||||
|  | {{#select * from acc_years where start_date <= :date AND :date <= end_date; | ||||||
|  | 	:date=$_GET.exit_date|parse_date | ||||||
|  | 	assign=year | ||||||
|  | }} | ||||||
|  | {{/select}} | ||||||
|  | 
 | ||||||
|  | {{:read file="./defaut.json" assign="config_json"}} | ||||||
|  | {{:assign config_defaut=$config_json|json_decode}} | ||||||
|  | {{:assign var="prefix_array" value=$config_defaut.prefixes|keys}} | ||||||
|  | 
 | ||||||
|  | {{#foreach from=$prefix_array item="code"}} | ||||||
|  | 	{{:assign var="pattern_array." value="%s*"|args:$code}} | ||||||
|  | {{/foreach}} | ||||||
|  | {{:assign patterns=$pattern_array|implode:"|"}} | ||||||
|  | 
 | ||||||
|  | {{*:debug comp_account=$comp_account amort_account=$amort_account except_account=$except_account year=$year*}} | ||||||
|  | 
 | ||||||
|  | <h3>Sortir l'immobilisation « {{$trans_immo.label}} » du bilan</h3> | ||||||
|  | <form method="post" action=""> | ||||||
|  | 
 | ||||||
|  | 	<div class="informations"> | ||||||
|  | 		<legend>Données de l'imobilisation</legend> | ||||||
|  | 		<dl class="describe"> | ||||||
|  | 			<dt><label>Montant</label></dt> | ||||||
|  | 			<dd class="money">{{$ligne_immo.debit|money_currency:false}}</dd> | ||||||
|  | 			<dt><label>Date d'acquisition</label></dt> | ||||||
|  | 			<dd >{{$trans_immo.date|date_short}}</dd> | ||||||
|  | 			{{if $info_immo.date != null && $info_immo.date != $trans_immo.date}} | ||||||
|  | 				<dt><label>Date de mise en service</label></dt> | ||||||
|  | 				<dd>{{$info_immo.date|date_short}}</dd> | ||||||
|  | 			{{/if}} | ||||||
|  | 			{{if $duree_amort != null}} | ||||||
|  | 				<dt>Durée de l'amortissement</dt> | ||||||
|  | 				<dd class="num">{{$duree_amort}} ans</dd> | ||||||
|  | 			{{/if}} | ||||||
|  | 			<dt><label>Montant des amortissements</label></dt> | ||||||
|  | 			<dd class="money">{{$_GET.amort_amount|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd> | ||||||
|  | 			<dt><label>Valeur nette résiduelle</label></dt> | ||||||
|  | 			<dd class="money">{{$valeur_nette|money_currency:false}} <span class="help">(à la date de début de l'exercice)</span></dd> | ||||||
|  | 			<dt><label>Date de sortie</label></dt> | ||||||
|  | 			<dd>{{$_GET.exit_date}}</dd> | ||||||
|  | 			{{if $amort_comp > 0}} | ||||||
|  | 				<dt><label>Montant amortissement complémentaire</label></dt> | ||||||
|  | 				<dd class="money">{{$amort_comp|money_currency:false}}</dd> | ||||||
|  | 				<dt><label>Montant des amortissements</label></dt> | ||||||
|  | 				<dd class="money">{{"%f+%f"|math:$_GET.amort_amount:$amort_comp|money_currency:false}} <span class="help">(à la date de sortie)</span></dd> | ||||||
|  | 				<dt><label>Valeur nette résiduelle</label></dt> | ||||||
|  | 				<dd class="money">{{"%f-%f"|math:$valeur_nette:$amort_comp|money_currency:false}} <span class="help">(à la date de sortie)</span></dd> | ||||||
|  | 			{{/if}} | ||||||
|  | 			{{if $montant_cession == 0}} | ||||||
|  | 				{{if $amort_except > 0}} | ||||||
|  | 					<dt><label>Montant amortissement exceptionnel</label></dt> | ||||||
|  | 					<dd class="money">{{$amort_except|money_currency:false}}</dd> | ||||||
|  | 				{{/if}} | ||||||
|  | 			{{else}} | ||||||
|  | 				<dt><label>Montant de la cession</label></dt> | ||||||
|  | 				<dd class="money">{{$montant_cession|money_currency:false}}</dd> | ||||||
|  | 			{{/if}} | ||||||
|  | 		</dl> | ||||||
|  | 	</div> | ||||||
|  | 
 | ||||||
|  | 	<fieldset> | ||||||
|  | 		<legend>Écritures de sortie du bilan</legend> | ||||||
|  | 		{{* Amortissement complémentaire *}} | ||||||
|  | 		{{if $valeur_nette > 0}} | ||||||
|  | 			<table class="list"> | ||||||
|  | 				<thead> | ||||||
|  | 					<tr> | ||||||
|  | 						<td>Amortissement complémentaire</td> | ||||||
|  | 						<td>Débit</td> | ||||||
|  | 						<td>Crédit</td> | ||||||
|  | 					</tr> | ||||||
|  | 				</thead> | ||||||
|  | 				<tbody> | ||||||
|  | 					<tr> | ||||||
|  | 						<td colspan="3" class="help"> | ||||||
|  | 							Entre la date de début de l'exercice et la date de sortie du bilan | ||||||
|  | 						</td> | ||||||
|  | 					</tr> | ||||||
|  | 					<tr> | ||||||
|  | 						<td> | ||||||
|  | 							{{:input | ||||||
|  | 							type="list" | ||||||
|  | 							name="comp_account" | ||||||
|  | 							target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"68*":$year.id | ||||||
|  | 							default=$comp_account | ||||||
|  | 							}} | ||||||
|  | 						</td> | ||||||
|  | 						<td>{{$amort_comp|money_currency:false}}</td> | ||||||
|  | 						<td></td> | ||||||
|  | 					</tr> | ||||||
|  | 					<tr> | ||||||
|  | 						<td> | ||||||
|  | 							{{:input | ||||||
|  | 							type="list" | ||||||
|  | 							name="amort_comp_account" | ||||||
|  | 							target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$year.id | ||||||
|  | 							default=$amort_account | ||||||
|  | 							}} | ||||||
|  | 						</td> | ||||||
|  | 						<td></td> | ||||||
|  | 						<td>{{$amort_comp|money_currency:false}}</td> | ||||||
|  | 					</tr> | ||||||
|  | 				</tbody> | ||||||
|  | 			</table> | ||||||
|  | 
 | ||||||
|  | 			{{* Amortissement exceptionnel *}} | ||||||
|  | 			{{if $montant_cession == 0}} | ||||||
|  | 				<table class="list"> | ||||||
|  | 					<thead> | ||||||
|  | 						<tr> | ||||||
|  | 							<td>Amortissement exceptionnel</td> | ||||||
|  | 							<td>Débit</td> | ||||||
|  | 							<td>Crédit</td> | ||||||
|  | 						</tr> | ||||||
|  | 					</thead> | ||||||
|  | 					<tbody> | ||||||
|  | 					<tr> | ||||||
|  | 						<td colspan="3" class="help"> | ||||||
|  | 							Montant de l'immobilisation non encore amortie (valeur nette résiduelle à la date de sortie) | ||||||
|  | 						</td> | ||||||
|  | 					</tr> | ||||||
|  | 						<tr> | ||||||
|  | 							<td> | ||||||
|  | 								{{:input | ||||||
|  | 								type="list" | ||||||
|  | 								name="except_account" | ||||||
|  | 								target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"687*":$year.id | ||||||
|  | 								default=$except_account | ||||||
|  | 								}} | ||||||
|  | 							</td> | ||||||
|  | 							<td>{{$amort_except|money_currency:false}}</td> | ||||||
|  | 							<td></td> | ||||||
|  | 						</tr> | ||||||
|  | 						<tr> | ||||||
|  | 							<td> | ||||||
|  | 								{{:input | ||||||
|  | 								type="list" | ||||||
|  | 								name="amort_except_account" | ||||||
|  | 								target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$year.id | ||||||
|  | 								default=$amort_account | ||||||
|  | 								}} | ||||||
|  | 							</td> | ||||||
|  | 							<td></td> | ||||||
|  | 							<td>{{$amort_except|money_currency:false}}</td> | ||||||
|  | 						</tr> | ||||||
|  | 					</tbody> | ||||||
|  | 				</table> | ||||||
|  | 			{{/if}} | ||||||
|  | 		{{/if}} | ||||||
|  | 
 | ||||||
|  | 		{{* Sortie du bilan *}} | ||||||
|  | 		<table class="list"> | ||||||
|  | 			<thead> | ||||||
|  | 				<tr> | ||||||
|  | 					<td>Sortie du bilan</td> | ||||||
|  | 					<td>Débit</td> | ||||||
|  | 					<td>Crédit</td> | ||||||
|  | 				</tr> | ||||||
|  | 			</thead> | ||||||
|  | 			<tbody> | ||||||
|  | 				<tr> | ||||||
|  | 					<td> | ||||||
|  | 						{{:input | ||||||
|  | 						type="list" | ||||||
|  | 						name="amort_sortie_account" | ||||||
|  | 						target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"28*":$year.id | ||||||
|  | 						default=$amort_account | ||||||
|  | 						}} | ||||||
|  | 					</td> | ||||||
|  | 					{{if $montant_cession == 0}} | ||||||
|  | 						{{:assign montant=$ligne_immo.debit}} | ||||||
|  | 					{{else}} | ||||||
|  | 						{{:assign montant="%f+%f"|math:$_GET.amort_amount:$amort_comp}} | ||||||
|  | 					{{/if}} | ||||||
|  | 					<td>{{$montant|money_currency:false}}</td> | ||||||
|  | 					<td></td> | ||||||
|  | 				</tr> | ||||||
|  | 				{{if $montant_cession > 0}} | ||||||
|  | 					<tr> | ||||||
|  | 						<td> | ||||||
|  | 							{{:input | ||||||
|  | 							type="list" | ||||||
|  | 							name="vnc_account" | ||||||
|  | 							target="!acc/charts/accounts/selector.php?codes=%s*&year=%d"|args:$vnc_code:$year.id | ||||||
|  | 							default=$vnc_account | ||||||
|  | 							}} | ||||||
|  | 						</td> | ||||||
|  | 						{{:assign montant="%f-%f"|math:$valeur_nette:$amort_comp}} | ||||||
|  | 						<td>{{$montant|money_currency:false}}</td> | ||||||
|  | 						<td></td> | ||||||
|  | 					</tr> | ||||||
|  | 				{{/if}} | ||||||
|  | 				<tr> | ||||||
|  | 					<td> {{* style="pointer-events: none; opacity: 0.6;">*}} | ||||||
|  | 						{{:input | ||||||
|  | 						type="list" | ||||||
|  | 						name="immo_account" | ||||||
|  | 						target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:$patterns:$year.id | ||||||
|  | 						default=$immo_account | ||||||
|  | 						}} | ||||||
|  | 					</td> | ||||||
|  | 					<td></td> | ||||||
|  | 					<td>{{$ligne_immo.debit|money_currency:false}}</td> | ||||||
|  | 				</tr> | ||||||
|  | 			</tbody> | ||||||
|  | 		</table> | ||||||
|  | 
 | ||||||
|  | 		{{* comptabilisation du produit de la cession *}} | ||||||
|  | 		{{if $montant_cession > 0}} | ||||||
|  | 			<table class="list"> | ||||||
|  | 				<thead> | ||||||
|  | 					<tr> | ||||||
|  | 						<td>Comptabilisation de la cession</td> | ||||||
|  | 						<td>Débit</td> | ||||||
|  | 						<td>Crédit</td> | ||||||
|  | 					</tr> | ||||||
|  | 				</thead> | ||||||
|  | 				<tbody> | ||||||
|  | 					<tr> | ||||||
|  | 						<td> | ||||||
|  | 							{{:input | ||||||
|  | 								type="list" | ||||||
|  | 								name="creance_account" | ||||||
|  | 								target="!acc/charts/accounts/selector.php?codes=%s&year=%d"|args:"462*":$year.id | ||||||
|  | 								default=$creance_account | ||||||
|  | 							}} | ||||||
|  | 						</td> | ||||||
|  | 						<td>{{$montant_cession|money_currency:false}}</td> | ||||||
|  | 						<td></td> | ||||||
|  | 					</tr> | ||||||
|  | 					<tr> | ||||||
|  | 						<td> | ||||||
|  | 							{{:input | ||||||
|  | 								type="list" | ||||||
|  | 								name="cession_account" | ||||||
|  | 								target="!acc/charts/accounts/selector.php?codes=%s*&year=%d"|args:$cession_code:$year.id | ||||||
|  | 								default=$cession_account | ||||||
|  | 							}} | ||||||
|  | 						</td> | ||||||
|  | 						<td></td> | ||||||
|  | 						<td>{{$montant_cession|money_currency:false}}</td> | ||||||
|  | 					</tr> | ||||||
|  | 				</tbody> | ||||||
|  | 			</table> | ||||||
|  | 		{{/if}} | ||||||
|  | </fieldset> | ||||||
|  | 
 | ||||||
|  | <p class="submit"> | ||||||
|  | 	{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}} | ||||||
|  | </p> | ||||||
|  | </form> | ||||||
|  | {{:admin_footer}} | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Jean-Christophe Engel
						Jean-Christophe Engel