Skip to content
Extraits de code Groupes Projets
Valider a0181a5b rédigé par Benjamin's avatar Benjamin
Parcourir les fichiers

add fonds propres

parent 9bbc42cf
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -191,10 +191,12 @@ class LeFilamentTdb(models.Model):
tresorerie = self._cr.dictfetchall()
self._cr.execute("""SELECT
sum(es.total_amount) as cca
from hr_expense_sheet es, hr_expense e
where es.id = e.sheet_id and e.payment_mode='own_account' and es.state!='done';""")
cca = self._cr.fetchone()[0]
(select sum(es.total_amount) as fonds_propres from hr_expense_sheet es, hr_expense e where es.id = e.sheet_id and e.payment_mode='own_account' and es.state!='done') as cca,
(select sum(capital) as capital from hr_employee) as capital;""")
fonds_propres = self._cr.dictfetchall()[0]
return { 'tresorerie': tresorerie, 'cca': cca }
if not fonds_propres['cca']:
fonds_propres['cca'] = 0
return { 'tresorerie': tresorerie, 'fonds_propres': fonds_propres }
......@@ -51,6 +51,7 @@ odoo.define('lefilament_tdb.tresorerie', function (require) {
var variation = [];
var treso = [];
var cca = [];
var fonds_propres = []
var labels = [];
var tabLength = this.values.tresorerie.length - 1;
......@@ -69,28 +70,48 @@ odoo.define('lefilament_tdb.tresorerie', function (require) {
entree.push(this.values.tresorerie[i].entree);
sortie.push(this.values.tresorerie[i].sortie * (-1) );
variation.push(this.values.tresorerie[i].variation);
cca.push(this.values.cca);
cca.push(this.values.fonds_propres.cca);
fonds_propres.push(this.values.fonds_propres.cca+this.values.fonds_propres.capital);
labels.push(moment(this.values.tresorerie[i].mois).format('MMM YYYY'));
}
console.log(this.values);
var datasets = [
{ label: 'Trésorerie', data: treso.slice(tabLength-11, tabLength+1), backgroundColor: 'transparent',borderColor: '#5E8ED5' },
{ label: 'CCA', data: cca, backgroundColor: 'transparent',borderColor: '#FFA063' },
{ label: 'Variation', data: variation, backgroundColor: 'rgba(255, 197, 98, 0.3)',borderColor: '#FFC562' },
{ label: 'Entrées', data: entree, backgroundColor: 'rgba(81, 210, 183, 0.3)', borderColor: '#51d2b7' },
{ label: 'Sorties', data: sortie, backgroundColor: 'rgba(249, 96, 117, 0.3)', borderColor: '#F96075' },
{ label: 'Trésorerie', data: treso.slice(tabLength-11, tabLength+1), backgroundColor: 'transparent',borderColor: '#5E8ED5', },
{ label: 'CCA', data: cca, backgroundColor: 'transparent',borderColor: '#FFA063', borderWidth: 1, radius: 0, },
{ label: 'Fonds Propres', data: fonds_propres, backgroundColor: 'transparent',borderColor: '#A65520', borderWidth: 1, radius: 0, },
{ label: 'Variation', data: variation, backgroundColor: 'rgba(255, 197, 98, 0.3)',borderColor: '#FFC562', borderWidth: 1, radius: 1, },
{ label: 'Entrées', data: entree, backgroundColor: 'rgba(81, 210, 183, 0.3)', borderColor: '#51d2b7', borderWidth: 1, radius: 1, },
{ label: 'Sorties', data: sortie, backgroundColor: 'rgba(249, 96, 117, 0.3)', borderColor: '#F96075', borderWidth: 1, radius: 1, },
];
// var label = 'Année ' + moment(Date.now()).format('YYYY');
var options = {
scales: {
yAxes: [{
ticks: {
beginAtZero:true,
}
}]
},
tooltips: {
backgroundColor: 'rgba(255,255,255,0.8)',
titleFontStyle: 'normal',
titleFontColor: '#999',
bodyFontColor: '#777',
callbacks: {
label: function(tooltipItems, data) {
return ' ' + (tooltipItems.yLabel / 1000).toLocaleString('fr', { maximumFractionDigits: 1 }) + ' k€';
}
}
},
responsive: true,
}
this.targetData = {
labels : labels,
datasets : datasets
};
var myLineChart = new Chart(this.ctx, { type: 'line', data: this.targetData, } );
var myLineChart = new Chart(this.ctx, { type: 'line', data: this.targetData, options: options } );
},
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter