V3QTRVNR5EVDZ2O2WRK7ZCVKSGGYBSNILH44OWXKOJK2ME5JC7UQC
TLRGOVFX6KIWQSWRPXS73WW4EHJQ5L5W5NYMO6UM2EF2H3EPAHHQC
KNH5OGCTL3YCOQQPA32M76SGWHGHAPQRIZ7S2CBC5DGIEV32SOYQC
7MCTB5G2W6IB7JQXGO2HCMRHBUYIOKXI4MBODKLAJIK66EMLC5ZQC
QHVOZBISIQ3E3P5F6GGKWVDSXC4OA23HCIH2OMXEVGXKSF5W4APAC
3DZWNZUZGMHJH3JL3H7KN746C6XVNBRBFHBSVSB5AH7YYUFVYVDAC
P7KZ25R4CNS4PZITRWPBVXRFSLY5TKCOFO6U3SDKX45ITNVU773QC
FERLNXU2QISSKOUBSPABB2ERHOWHQRI2GVKDJ352Y4B2FUXBRGRQC
async function saveModal(_e: Event) {
if(!saveModal_) {
saveModal_ = new bootstrap.Modal('#grainSaveModal', {
focus: true,
keyboard: true,
})
}
saveModal_?.show()
}
let save: SubmitFunction = async ({ formData }) => {
console.log("save called")
formData.set('data', JSON.stringify(p))
formData.set('prms', JSON.stringify(data.prms))
saveModal_?.hide()
return async ({ result }) => {
await applyAction(result);
};
}
$: CAMoyen10 = new Array(10).fill(0).reduce((acc, _, i) => acc + chiffreAffaires(i), 0) / 10
$: tarifLocalMoyen10 = new Array(10).fill(0).reduce((acc, _, i) => acc + tarifLocal(i), 0) / 10
$: netMoyenFutur = (new Array(10).fill(0)).reduce((acc, _, i) => acc + resultatNet(interetsAnnuels.length + i), 0) / 10
$: resultatNet30 = (new Array(30).fill(0)).reduce((acc, _, i) => acc + resultatNet(i), 0)
$: rentabilite = resultatNet30 / apport
$: CA30 = (new Array(30).fill(0)).reduce((acc, _, i) => acc + chiffreAffaires(i), 0)
$: dscrMoyen = remboursementAnnuel.reduce((acc, _, i) => acc + dscr(i), 0) / remboursementAnnuel.length
let bootstrap: any;
onMount(async () => {
bootstrap = await import('bootstrap')
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
for(let t of popoverTriggerList) {
new bootstrap.Popover(t)
}
})
let saveModal_: null | bootstrap.Modal = null;
async function saveModal(e: Event) {
console.log("saveModal", e, data.guest)
if(!saveModal_) {
saveModal_ = new bootstrap.Modal('#faisanSaveModal', {
focus: true,
keyboard: true,
})
}
saveModal_?.show()
function sum(x: (_: number) => number, n: number){
return new Array(n).fill(0).reduce((a, _, i) => a + x(i), 0)
let save: SubmitFunction = async ({ formData }) => {
console.log("enhance")
formData.set('data', JSON.stringify(p))
formData.set('prms', JSON.stringify(data.prms))
saveModal_?.hide()
return async ({ result }) => {
await applyAction(result);
};
function format(x : number){
let f = 0
let s = ''
if (Math.abs(x) <= 1000){
s = ' €'
f = x
} else if (Math.abs(x) < 1000000) {
s = ' k€'
f = x/1000
} else if(Math.abs(x) < 1000000000) {
s = ' M€'
f = x/1000000
} else {
s = ' mds€'
f = x/1000000000
}
return Intl.NumberFormat('fr-FR').format(f).toString()+ s
function sum(x: (number) => number, n: number){
return new Array(n).fill(0).reduce((a, _, i) => a + x(i))
}
function formateur(x : number){
let X:number = 0
let s:string = '';
if (Math.abs(x) <= 1000){
s = ' €'
X = x.toFixed(0)
} else if (Math.abs(x) < 1000000) {
s = ' k€'
X = (x/1000).toFixed(2)
} else if(Math.abs(x) < 1000000000) {
s = ' M€'
X = x/1000000
} else {
s = ' mds€'
X = x/1000000000
}
return Intl.NumberFormat('fr-FR').format(X).toString()+ s
}
function rentabiliteTaux(x:number,y:number){
function rentabiliteTaux(x:number,y:number){
let pr:number = 0
if (i>0){pr = a[i-1]}
a.push((x(i)+pr))
b.push(i)
}
let rapx:number=50/(Math.max(...a)-Math.min(...a))// COMMENT GERER LES CAS >0 ?
let rapy:number=300/(Math.max(...b)-Math.min(...b))
for (let i = 0; i < n; i ++ ){
c += (' ' + (i*rapy).toFixed(arr).toString()+ ',' + (50-a[i]*rapx).toFixed(arr).toString() )
ai += f(i)
maxa = Math.max(maxa, ai)
mina = Math.min(mina, ai)
c += ` ${c ? 'L':'M'} ${i.toFixed(arr)}, ${(-ai.toFixed(arr))}`
$: rembPret = (n:number) => {
let totalRembAnnuel_n =remboursementAnnuel.slice(0,n).reduce((a, b) => a + b,0)
let totalInteret_n = sum(interetsDetteSenior,n)
let totalRembAnnuel =remboursementAnnuel.reduce((a, b) => a + b,0)
let totalInteret = sum(interetsDetteSenior,N)
$: rembPret = (n:number) => {
let totalRembAnnuel_n =remboursementAnnuel.slice(0, n).reduce((a, b) => a + b, 0)
let totalInteret_n = sum(interetsDetteSenior, n)
let totalRembAnnuel =remboursementAnnuel.reduce((a, b) => a + b, 0)
let totalInteret = sum(interetsDetteSenior, n)
<h5 > Synthèse durée totale {N} ans</h5>
<div class="row flex-row-reverse px-4 ">
<div class="d-flex justify-content-between p-5">
<div class="flex-column justify-content-between text-center ">
<div class="donnee"> {formateur(sum(chiffreAffaires,N))}</div>
<h5>Synthèse durée totale {N} ans</h5>
<div class="row px-4">
<div class="d-flex justify-content-between p-5">
<div class="flex-column text-center">
<div class="donnee">{format(sum(chiffreAffaires,N))}</div>
<div class="row flex-row-reverse px-4 ">
<div class="d-flex justify-content-between p-5">
<div class="flex-column justify-content-between text-center ">
<div class="donnee"> {formateur(sum(resultatNet,N)/N)}</div>
<div class="row flex-row-reverse px-4">
<div class="d-flex justify-content-around p-5">
<div class="me-3 flex-column text-center">
<div class="donnee">{N ? format(sum(resultatNet,N)/N) : "0€"}</div>
<div class="flex-column justify-content-between text-center ">
<div class="donnee">{formateur((coutElec() - coutElecAuto()))}</div><!-- coutelec10, sur 10 ans ? possible de le prolonger sur la durée du projet ? -->
<div>Economies consommateur </div>
</div>
<div class="flex-column justify-content-between text-center">
<div class="donnee">{economieFoyerMois} mois </div>
<div>d'éléctricité économisés par foyer</div>
<div class="ms-3 flex-column text-center">
<div class="donnee">
{#if (coutElec() - coutElecAuto()) > 0}
{format((coutElec() - coutElecAuto()))}
({economieFoyerMois} mois)
{:else}
Aucune 😢
{/if}
</div>
<div>Economies consommateur</div>
<div class="flex-column justify-content-between text-center ">
<div class="donnee ">{formateur(sum(resultatNet,N)/N)}</div>
<div>bénéfices moyen </div>
<div class="flex-column text-center">
<div class="donnee ">{format(sum(resultatNet,N)/N)}</div>
<div>Bénéfices moyen </div>
<div class="flex-column justify-content-between text-center ">
<div class="donnee">{formateur(sum(chiffreAffaires,N)/N)}</div>
<div>chiffre d'affaire</div>
<div class="flex-column text-center">
<div class="donnee">{format(sum(chiffreAffaires,N)/N)}</div>
<div>Chiffre d'affaire</div>
{#if coutElec() > 0}
<div class="flex-column justify-content-between text-center">
<div class="donnee">{((coutElec() - coutElecAuto()) * 100 / coutElec()).toFixed(0)}%</div>
<div>économies consommateur</div>
</div>{/if}
<div class="flex-column text-center">
<div class="donnee">
{#if (coutElec() - coutElecAuto()) > 0}
{((coutElec() - coutElecAuto()) * 100 / coutElec()).toFixed(0)}%
{:else}
Aucune 😢
{/if}
</div>
<div>Économies consommateur</div>
</div>
<div class="fw-bold fs-4 ">Cumulé : <span class="text-primary"> {formateur(sum(resultatNet,N))}</span>
</div>
<div class="fw-bold fs-4">Cumulé : <span class="text-primary">{format(sum(resultatNet,N))}</span></div>
<div class="ws-100 overflow-auto">
<table class="table table-striped d-inline-block">
<tbody>
<tr class="titreligne"><td>Année</td>{#each Array(N) as _, i}<td>{an + i}</td>{/each}</tr>
<tr ><td class="titreligne border-0">Résultat net</td>
{#each Array(N) as _, i}
<td class=" border-bottom-0">{resultatNet(i).toFixed(arr)}</td>
{/each}
</tr>
</tbody>
</table>
<div class="d-flex flex-wrap">
<div class="d-flex flex-column my-3">
<div class="titreligne tcellt">Année</div>
<div class="titreligne tcellt">Résultat net</div>
<div class="ms-3 row">
<div>
<h5 class="mt-5">Chiffre d'affaires</h5>
<div class="fw-bold fs-4 ">Cumulé : <span class="text-primary"> {formateur(sum(chiffreAffaires,N))}</span>
<div class="ms-3">
<h5 class="mt-5">Chiffre d'affaires</h5>
<div class="fw-bold fs-4">Cumulé : <span class="text-primary">{format(sum(chiffreAffaires,N))}</span></div>
<div class="d-flex flex-wrap">
<div class="d-flex flex-column my-4">
<div class="titreligne tcellt">Année</div>
<div class="titreligne tcellt">Autoproduction (€)</div>
<div class="titreligne tcellt">Vente locale (€)</div>
<div class="titreligne tcellt">Vente de surplus (€)</div>
<div class="titreligne tcellt">Prime</div>
<div class="titreligne tcellt">Chiffre d'affaires</div>
<div class="ws-100 overflow-auto">
<table class="table table-striped d-inline-block">
<tbody>
<tr class="titreligne"><td >Année</td>{#each Array(N) as _, i}<td>{an + i}</td>{/each}</tr>
<tr><td class="titreligne">Autoproduction (€)</td>
{#each Array(N) as _, i}
<td >{(productionAnnuelle(i) * (p.autoprod * tarifAllo(i) / 100)).toFixed(0)}</td>
{/each}
</tr>
{#each Array(Math.ceil(N)) as _, i}
<div class="d-flex flex-column my-4">
<div class="tcellt">{an + i}</div>
<div class="tcellt">{(productionAnnuelle(i) * (p.autoprod * tarifAllo(i) / 100)).toFixed(0)}</div>
<div class="tcellt">{(productionAnnuelle(i) * (autoconso * tarifLocal(i))).toFixed(0)}</div>
<div class="tcellt">{(productionAnnuelle(i) * ((1 - autoconso) * tarifSurplus(i))).toFixed(0)}</div>
<div class="tcellt"> </div>
<div class="tcellt">{chiffreAffaires(i).toFixed(arr)}</div>
</div>
{/each}
</div>
<tr><td class="titreligne">Vente locale (€)</td>
{#each Array(N) as _, i}
<td>{(productionAnnuelle(i) * (autoconso * tarifLocal(i))).toFixed(0)}</td>
{/each}
</tr>
<h5 class="my-3">Charges d'exploitation</h5>
<div class="fw-bold fs-4">Cumulé : <span class="text-primary">{format(sum(charges,N))}</span></div>
<tr><td class="titreligne">Vente de surplus (€)</td>
{#each Array(N) as _, i}
<td>{(productionAnnuelle(i) * ((1 - autoconso) * tarifSurplus(i))).toFixed(0)}</td>
{/each}
</tr>
<div class="d-flex flex-wrap">
<div class="d-flex flex-column my-4">
<div class="titreligne tcellt">Année</div>
<div class="titreligne tcellt">Maintenance (€)</div>
<div class="titreligne tcellt">TURPE (€)</div>
<div class="titreligne tcellt">Assurance (€)</div>
<div class="titreligne tcellt">Divers</div>
<div class="titreligne tcellt">Total charges</div>
</div>
{#each Array(Math.ceil(N)) as _, i}
<div class="d-flex flex-column my-4">
<div class="tcellt">{an + i}</div>
<div class="tcellt">{exploitation(i).toFixed(arr)}</div>
<div class="tcellt">{turpe(i).toFixed(arr)}</div>
<div class="tcellt">{assurance(i).toFixed(arr)}</div>
<div class="tcellt">{divers(i).toFixed(arr)}</div>
<div class="tcellt">{charges(i).toFixed(arr)}</div>
</div>
{/each}
</div>
<tr><td class="titreligne">Prime</td>
<td>{primeInvestissement}</td>
{#each Array(N-1) as _}
<td></td>
{/each}
</tr>
</tbody>
<h5 class="my-3">Excédent brut d'exploitation</h5>
<div class="fw-bold fs-4">Cumulé : <span class="text-primary">{format(sum(ebe,N))}</span></div>
<tfoot class="table-group-divider">
<tr><td class="titreligne border-0">Chiffre d'affaires</td>
{#each Array(N) as _, i}
<td class="border-0">{chiffreAffaires(i).toFixed(arr)}</td>
{/each}
</tr>
</tfoot>
</table>
<div class="d-flex flex-wrap">
<div class="d-flex flex-column my-4">
<div class="titreligne tcellt">Année</div>
<div class="titreligne tcellt">Valeur ajoutée (€)</div>
<div class="titreligne tcellt">Accise (€)</div>
<div class="titreligne tcellt">IFER (€)</div>
<div class="titreligne tcellt">Taxe foncière</div>
<div class="titreligne tcellt">Cotisation foncière des entreprises</div>
<div class="titreligne tcellt">Excédent brut d'exploitation</div>
<h5 class="my-3">Charges d'exploitation</h5>
<div class="fw-bold fs-4 ">Cumulé : <span class="text-primary"> {formateur(sum(charges,N))}</span>
{#each Array(Math.ceil(N)) as _, i}
<div class="d-flex flex-column my-4">
<div class="tcellt">{an + i}</div>
<div class="tcellt">{valeurAjoutee(i).toFixed(arr)}</div>
<div class="tcellt">{accise(i).toFixed(arr)}</div>
<div class="tcellt">{ifer(i).toFixed(arr)}</div>
<div class="tcellt">{taxeFonciere(i).toFixed(arr)}</div>
<div class="tcellt">{cfe(i).toFixed(arr)}</div>
<div class="tcellt">{ebe(i).toFixed(arr)}</div>
<div class="ws-100 overflow-auto">
<table class="table table-striped d-inline-block">
<tbody>
<tr class="titreligne"><td >Année</td>{#each Array(N) as _, i}<td>{an + i}</td>{/each}</tr>
<tr><td class="titreligne">Maintenance</td>
{#each Array(N) as _, i}
<td>{exploitation(i).toFixed(arr)}</td>
{/each}
</tr>
<tr><td class="titreligne">TURPE</td>
{#each Array(N) as _, i}
<td>{turpe(i).toFixed(arr)}</td>
{/each}
</tr>
{/each}
</div>
<h5 class="my-3">Résultat net</h5>
<div class="fw-bold fs-4">Cumulé : <span class="text-primary">{format(sum(resultatNet,N))}</span></div>
<tr><td class="titreligne">Assurance</td>
{#each Array(N) as _, i}
<td>{assurance(i).toFixed(arr)}</td>
{/each}
</tr>
<tr><td class="titreligne">Divers</td>
{#each Array(N) as _, i}
<td>{divers(i).toFixed(arr)}</td>
{/each}
</tr>
</tbody>
<tfoot class="table-group-divider">
<tr ><td class="titreligne border-0">Total charges</td>
{#each Array(N) as _, i}
<td class="border-0">{charges(i).toFixed(arr)}</td>
{/each}
</tr>
</tfoot>
</table>
<div class="d-flex flex-wrap">
<div class="d-flex flex-column my-4">
<div class="titreligne tcellt">Année</div>
<div class="titreligne tcellt">Onduleurs</div>
<div class="titreligne tcellt">Amortissement</div>
<div class="titreligne tcellt">Intérêts dette senior</div>
<div class="titreligne tcellt">Intérêts DSRA</div>
<div class="titreligne tcellt">Résultat fiscal</div>
<div class="titreligne tcellt">Impôt sur les sociétés</div>
<div class="titreligne tcellt">Résultat net</div>
<h5 class="my-3">Excédent brut d'exploitation</h5>
<div class="fw-bold fs-4 ">Cumulé : <span class="text-primary"> {formateur(sum(ebe,N))}</span>
{#each Array(Math.ceil(N)) as _, i}
<div class="d-flex flex-column my-4">
<div class="tcellt">{an + i}</div>
<div class="tcellt">{provisionOnduleurs(i).toFixed(arr)}</div>
<div class="tcellt">{amortissement(i).toFixed(arr)}</div>
<div class="tcellt">{interetsDetteSenior(i).toFixed(arr)}</div>
<div class="tcellt">{interetsDSRA(i).toFixed(arr)}</div>
<div class="tcellt">{resultatFiscal(i).toFixed(arr)}</div>
<div class="tcellt">{is(i).toFixed(arr)}</div>
<div class="tcellt">{resultatNet(i).toFixed(arr)}</div>
<div class="ws-100 overflow-auto">
<table class="table table-striped d-inline-block">
<tbody>
<tr class="titreligne"><td >Année</td>{#each Array(N) as _, i}<td>{an + i}</td>{/each}</tr>
<tr><td class="titreligne">Valeur ajoutée</td>
{#each Array(N) as _, i}
<td>{valeurAjoutee(i).toFixed(arr)}</td>
{/each}
</tr>
<tr><td class="titreligne">Accise</td>
{#each Array(N) as _, i}
<td>{accise(i).toFixed(arr)}</td>
{/each}
</tr>
<tr><td class="titreligne">IFER</td>
{#each Array(N) as _, i}
<td>{ifer(i).toFixed(arr)}</td>
{/each}
</tr>
<tr><td class="titreligne">Taxe foncière</td>
{#each Array(N) as _, i}
<td>{taxeFonciere(i).toFixed(arr)}</td>
{/each}
</tr>
<tr><td class="titreligne">Cotisation foncière des entreprises</td>
{#each Array(N) as _, i}
<td>{cfe(i).toFixed(arr)}</td>
{/each}
</tr>
</tbody>
<tfoot class="table-group-divider">
<tr ><td class="titreligne border-0">Excédent brut d'exploitation</td>
{#each Array(N) as _, i}
<td class="border-0">{ebe(i).toFixed(arr)}</td>
{/each}
</tr>
</tfoot>
</table>
{/each}
</div>
{#if investissement > apport }
<h5 class="my-3">Couverture de la dette</h5>
<div class="d-flex flex-wrap">
<div class="d-flex flex-column my-3">
<div class="titreligne tcellt">Année</div>
<div class="titreligne tcellt">DSCR</div>
<h5 class="my-3">Résultat net</h5>
<div class="ws-100 overflow-auto">
<div class="fw-bold fs-4 ">Cumulé : <span class="text-primary"> {formateur(sum(resultatNet,N))}</span>
</div>
<table class="table table-striped d-inline-block">
<tbody>
<tr class="titreligne"><td >Année</td>{#each Array(N) as _, i}<td>{an + i}</td>{/each}</tr>
<tr><td class="titreligne">Onduleurs</td>
{#each Array(N) as _, i}
<td>{provisionOnduleurs(i).toFixed(arr)}</td>
{/each}
</tr>
<tr><td class="titreligne">Amortissement</td>
{#each Array(N) as _, i}
<td>{amortissement(i).toFixed(arr)}</td>
{/each}
</tr>
{#if investissement > apport}
<tr><td class="titreligne">Intérêts dette senior</td>
{#each Array(N) as _, i}
<td>{(interetsDetteSenior(i)).toFixed(arr)}</td>
{/each}
</tr>
<tr><td class="titreligne">Intérêts DSRA</td>
{#each Array(N) as _, i}
<td>{interetsDSRA(i).toFixed(arr)}</td>
{/each}
</tr>
{/if}
<tr><td class="titreligne">Résultat fiscal</td>
{#each Array(N) as _, i}
<td>{resultatFiscal(i).toFixed(arr)}</td>
{/each}
</tr>
<tr ><td class="titreligne ">Impôt sur les sociétés</td>
{#each Array(N) as _, i}
<td>{is(i).toFixed(arr)}</td>
{/each}
</tr>
</tbody>
<tfoot class="table-group-divider">
<tr class="border-0"><td class="titreligne border-0">Résultat net</td>
{#each Array(N) as _, i}
<td class="border-0">{resultatNet(i).toFixed(arr)}</td>
{/each}
</tr>
</tfoot>
</table>
{#each Array(Math.ceil(N)) as _, i}
<div class="d-flex flex-column my-3">
<div class="tcellt">{an + i}</div>
<div class="tcellt">{dscr(i).toFixed(arr)}</div>
{#if investissement > apport }
<h5 class="my-3">Couverture de la dette</h5>
<div class="ws-100 overflow-auto">
<table class="table table-striped d-inline-block">
<tbody>
<tr class="titreligne"><td >Année</td>{#each Array(N) as _, i}<td>{an + i}</td>{/each}</tr>
<tr><td class="titreligne border-0">DSCR</td>
{#each Array(N) as _, i}
<td class="border-0">{dscr(i).toFixed(2)}</td>
{/each}
</tr>
</tbody>
</table>
</div>
{/if}
{/each}
table {
font-size: 90%;
}
.table td {
padding: 5px 7px 5px 10px;
text-align:end;
border:none;
border-bottom:solid $primary 1px;
h5 {
font-size: 1.5rem;
font-weight: bold;
<div class="border-primary border-bottom border-5">
<div class="img" style="background-image: url(/trace.svg);background-size: 100% 100%;width: 100%;">
<div style="padding-top:100px" class="container-md ">
<h2 class="text-uppercase lh-1" style="font-size:4rem;width:50%">No GRAIN,<br/>No gain.</h2>
<h1 class="my-4 fw-bold" style="font-size:1.4rem">L'outil <span class="text-primary">gratuit</span> de faisabilité d'autoconsommation.</h1>
<a class="mt-3 btn btn-primary" href="{base}/projet/nouveau">Lancer ma simulation</a>
<div>
<div class="img">
<div style="padding-top:100px" class="container-md">
<h1 class="text-uppercase lh-1" style="font-size:4rem;width:50%">No GRAIN,<br/>No gain.</h1>
<h2 class="sub">L'outil <span class="text-primary">gratuit</span> de faisabilité d'autoconsommation.</h2>
<a class="mt-3 btn btn-primary" href="{base}/projet/nouveau">Lancer ma simulation</a>
</div>
<h1 class="my-5 lh-1 text-center" style="font-size:3rem;">Simulez <span class="text-primary fw-bold">gratuitement</span> vos <span class="text-primary fw-bold">revenus</span> photovoltaïques.</h1>
<h1 class="my-5 lh-1 text-center">Simulez <span class="text-primary fw-bold">gratuitement</span> vos <span class="text-primary fw-bold">revenus</span> photovoltaïques.</h1>
.img{
height:90vh;
background-position:bottom 0px right 0px;
background-repeat:no-repeat;
@media(min-width:360px){
height:90vh
}}
.sub {
font-size: 1.4rem;
font-weight: bold;
margin: 20px 0;
}
.img{
height:calc(100vh - 80px);
background-image: url(/trace.svg);
background-size: 75% auto;
width: 100%;
background-position:bottom 0px right 0px;
background-repeat:no-repeat;
}