| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682 | 
							- function chart(reporting) {
 
-     "use strict";
 
-     var model = openerp;
 
-     reporting.ReportChartWidget = reporting.Base.extend({
 
-         BuildDemoChart: function (label,data,CurrencyBase) {
 
-             var self = this;
 
-             Chart.scaleService.updateScaleDefaults('linear', {
 
-                 ticks: {
 
-                     callback: function(tick) {
 
-                         return tick.toLocaleString('de-DE');
 
-                     }
 
-                 }
 
-             });
 
-             Chart.defaults.global.tooltips.callbacks.label = function(tooltipItem, data) {
 
-                 var dataset = data.datasets[tooltipItem.datasetIndex];
 
-                 var datasetLabel = dataset.label || '';
 
-                 return datasetLabel +  dataset.data[tooltipItem.index].toLocaleString('de-DE');
 
-             };
 
-             var chartData = {
 
-     			labels: label,
 
-     			datasets: [{
 
-     				type: 'line',
 
-     				label: 'Balance',
 
-     				borderColor: '#0288d1',
 
-                     fill:false,
 
-     				data: [
 
-                         '10500',
 
-                         '5000',
 
-                         '3000',
 
-                         '19000',
 
-                         '4000',
 
-                         '70000',
 
-                         '8000',
 
-                         '43000',
 
-                         '25000',
 
-                         '39000',
 
-                         '36000',
 
-                         '47000',
 
-     				],
 
-     				borderWidth: 2
 
-     			}, {
 
-     				type: 'bar',
 
-     				label: 'Ventas',
 
-                     backgroundColor: '#81c784',
 
-     				borderWidth: 1,
 
-     				data: [
 
-                         '10000',
 
-                         '5000',
 
-                         '3000',
 
-                         '15000',
 
-                         '45000',
 
-                         '70000',
 
-                         '90000',
 
-                         '40000',
 
-                         '25000',
 
-                         '70000',
 
-                         '30000',
 
-                         '50000',
 
-     				]
 
-     			}, {
 
-     				type: 'bar',
 
-     				label: 'Compras',
 
-     				backgroundColor: '#ffb74d',
 
-     				data: [
 
-                         '10000',
 
-                         '5000',
 
-                         '3000',
 
-                         '15000',
 
-                         '4000',
 
-                         '70000',
 
-                         '8000',
 
-                         '40000',
 
-                         '25000',
 
-                         '35000',
 
-                         '30000',
 
-                         '40000',
 
-     				],
 
-     				borderWidth: 1
 
-     			}, {
 
-     				type: 'bar',
 
-     				label: 'Gastos',
 
-     				backgroundColor: '#e57373',
 
-     				data: [
 
-                         '10500',
 
-                         '5000',
 
-                         '3000',
 
-                         '19000',
 
-                         '4000',
 
-                         '70000',
 
-                         '8000',
 
-                         '43000',
 
-                         '25000',
 
-                         '39000',
 
-                         '36000',
 
-                         '47000',
 
-     				],
 
-     				borderWidth: 1
 
-     			}]
 
-     		};
 
-             var chart = new Chart($(".reporting-chart"), {
 
-                 type: 'bar',
 
-                 data: chartData,
 
-                 options: {
 
-                     responsive: true,
 
-                     responsiveAnimationDuration:10,
 
-                     maintainAspectRatio:false,
 
-                     title: {
 
-                         display: false,
 
-                     },
 
-                     hover: {
 
-                         mode: 'nearest',
 
-                         intersect: true
 
-                     },
 
-                     legend: {
 
-                        display: false,
 
-                     },
 
-                     layout: {
 
-                         padding: {
 
-                             top: 0,
 
-                             bottom: 0,
 
-                             left : 0,
 
-                             rigth: 0,
 
-                         }
 
-                     },
 
-                     // events: ['click'],
 
-                     tooltips: {
 
-                         callbacks: {
 
-                             label: function(tooltipItem, data) {
 
-                                 var label = data.datasets[tooltipItem.datasetIndex].label || '';
 
-                                 if (label) {
 
-                                     label += ': ';
 
-                                 }
 
-                                 label += accounting.formatMoney(tooltipItem.yLabel, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
 
-                                 return label;
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             });
 
-         },
 
-         BuildLineChart: function (label,data,CurrencyBase) {
 
-             var self = this;
 
-             Chart.scaleService.updateScaleDefaults('linear', {
 
-                 ticks: {
 
-                     callback: function(tick) {
 
-                         return tick.toLocaleString('de-DE');
 
-                     }
 
-                 }
 
-             });
 
-             Chart.defaults.global.tooltips.callbacks.label = function(tooltipItem, data) {
 
-                 var dataset = data.datasets[tooltipItem.datasetIndex];
 
-                 var datasetLabel = dataset.label || '';
 
-                 return datasetLabel +  dataset.data[tooltipItem.index].toLocaleString('de-DE');
 
-             };
 
-             var chart = new Chart($(".reporting-chart"), {
 
-                 type: 'line',
 
-                 data: {
 
-                     labels: label,
 
-                     datasets: [
 
-                         {
 
-                             label: false,
 
-                             data: data,
 
-                             backgroundColor: '#bbdefb',
 
-                             borderColor: '#0288d1',
 
-                             borderWidth: 1,
 
-                             fill: true,
 
-                         }
 
-                     ]
 
-                 },
 
-                 options: {
 
-                     responsive: true,
 
-                     responsiveAnimationDuration:10,
 
-                     maintainAspectRatio:false,
 
-                     title: {
 
-                         display: false,
 
-                     },
 
-                     hover: {
 
-                         mode: 'nearest',
 
-                         intersect: true
 
-                     },
 
-                     legend: {
 
-                        display: false,
 
-                     },
 
-                     layout: {
 
-                         padding: {
 
-                             top: 0,
 
-                             bottom: 0,
 
-                             left : 0,
 
-                             rigth: 0,
 
-                         }
 
-                     },
 
-                     events: ['click'],
 
-                     tooltips: {
 
-                         callbacks: {
 
-                             label: function(tooltipItem, data) {
 
-                                 var label = data.datasets[tooltipItem.datasetIndex].label || '';
 
-                                 if (label) {
 
-                                     label += ': ';
 
-                                 }
 
-                                 label += accounting.formatMoney(tooltipItem.yLabel, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
 
-                                 return label;
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             });
 
-         },
 
-         BuildBarChart: function (data,CurrencyBase,label,body) {
 
-             var self = this;
 
-             Chart.scaleService.updateScaleDefaults('linear', {
 
-               ticks: {
 
-                 callback: function(tick) {
 
-                     return tick.toLocaleString('de-DE');
 
-                 }
 
-               }
 
-             });
 
-             Chart.defaults.global.tooltips.callbacks.label = function(tooltipItem, data) {
 
-                 var dataset = data.datasets[tooltipItem.datasetIndex];
 
-                 var datasetLabel = dataset.label || '';
 
-                 return datasetLabel +  dataset.data[tooltipItem.index].toLocaleString('de-DE');
 
-             };
 
-             var color = [];
 
-             color.push('#BCCEF4');
 
-             color.push('#A9E5E3');
 
-             color.push('#A0D995');
 
-             color.push('#C5D084');
 
-             color.push('#FAE187');
 
-             color.push('#FFBD82');
 
-             color.push('#FFA8B8');
 
-             color.push('#E5BEDD');
 
-             color.push('#C4ABFE');
 
-             color.push('#D8D8D8');
 
-             var chart = new Chart($(".reporting-chart"), {
 
-                 type: 'horizontalBar',
 
-                 data: {
 
-                     labels: label,
 
-                     datasets: [
 
-                         {
 
-                             label: false,
 
-                             data: body,
 
-                             backgroundColor: color,
 
-                             fill: true,
 
-                         }
 
-                     ]
 
-                 },
 
-                 options: {
 
-                     responsive: true,
 
-                     responsiveAnimationDuration:10,
 
-                     maintainAspectRatio:false,
 
-                     title: {
 
-                         display: false,
 
-                     },
 
-                     hover: {
 
-                         mode: 'nearest',
 
-                         intersect: true
 
-                     },
 
-                     legend: {
 
-                        display: false,
 
-                     },
 
-                     layout: {
 
-                         padding: {
 
-                             top: 0,
 
-                             bottom: 0,
 
-                             left : 0,
 
-                             rigth: 0,
 
-                         }
 
-                     },
 
-                     tooltips: {
 
-                         callbacks: {
 
-                             label: function(tooltipItem, data) {
 
-                                 var label = data.datasets[tooltipItem.datasetIndex].label || '';
 
-                                 if (label) {
 
-                                     label += ': ';
 
-                                 }
 
-                                 label += accounting.formatMoney(tooltipItem.xLabel, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
 
-                                 return label;
 
-                             }
 
-                         }
 
-                     },
 
-                     events: ['click'],
 
-                 }
 
-             });
 
-         },
 
-         BuildPieChart: function (data,CurrencyBase,label,body) {
 
-             var self = this;
 
-             var color = [];
 
-             color.push('#BCCEF4');
 
-             color.push('#A9E5E3');
 
-             color.push('#A0D995');
 
-             color.push('#C5D084');
 
-             color.push('#FAE187');
 
-             color.push('#FFBD82');
 
-             color.push('#FFA8B8');
 
-             color.push('#E5BEDD');
 
-             color.push('#C4ABFE');
 
-             color.push('#D8D8D8');
 
-             color.push('#f3e5f5');
 
-             var chart = new Chart($(".reporting-pie-chart"), {
 
-                 type: 'pie',
 
-                 data: {
 
-                     labels: label,
 
-                     datasets: [
 
-                         {
 
-                             label: false,
 
-                             data: body,
 
-                             backgroundColor: color,
 
-                             fill: true,
 
-                         }
 
-                     ]
 
-                 },
 
-                 options: {
 
-                     responsive: true,
 
-                     responsiveAnimationDuration:10,
 
-                     maintainAspectRatio:false,
 
-                     hover: {
 
-                         mode: 'nearest',
 
-                         intersect: true
 
-                     },
 
-                     legend: {
 
-                         position: 'right',
 
-                         // position: 'none',
 
-                     },
 
-                     layout: {
 
-                         padding: {
 
-                             top: 0,
 
-                             bottom: 0,
 
-                             left : 0,
 
-                             rigth: 0,
 
-                         }
 
-                     },
 
-                     tooltips: {
 
-                         callbacks: {
 
-                             label: function(tooltipItem, data) {
 
-                                 var label = data.labels[tooltipItem.index] || '';
 
-                                 if (label) {
 
-                                     label += ': ';
 
-                                 }
 
-                                 label += accounting.formatMoney(data.datasets[0].data[tooltipItem.index],{
 
-                                     symbol: "%",
 
-                                     format: "%v%s",
 
-                                     precision: 2,
 
-                                     thousand: ".",
 
-                                     decimal: ","
 
-                                 });
 
-                                 return label;
 
-                             }
 
-                         }
 
-                     },
 
-                     events: ['click'],
 
-                 }
 
-             });
 
-         },
 
-         BuildDoughnutChart: function (data,CurrencyBase,label,body) {
 
-             var self = this;
 
-             var color = [];
 
-             color.push('#BCCEF4');
 
-             color.push('#A9E5E3');
 
-             color.push('#A0D995');
 
-             color.push('#C5D084');
 
-             color.push('#FAE187');
 
-             color.push('#FFBD82');
 
-             color.push('#FFA8B8');
 
-             color.push('#E5BEDD');
 
-             color.push('#C4ABFE');
 
-             color.push('#D8D8D8');
 
-             var chart = new Chart($(".reporting-doughnut-chart"), {
 
-                 type: 'doughnut',
 
-                 data: {
 
-                     labels: label,
 
-                     datasets: [
 
-                         {
 
-                             label: false,
 
-                             data: body,
 
-                             backgroundColor: color,
 
-                             fill: true,
 
-                         }
 
-                     ]
 
-                 },
 
-                 options: {
 
-                     responsive: true,
 
-                     responsiveAnimationDuration:10,
 
-                     maintainAspectRatio:false,
 
-                     hover: {
 
-                         mode: 'nearest',
 
-                         intersect: true
 
-                     },
 
-                     legend: {
 
-                         position: 'left',
 
-                         // position: 'none',
 
-                     },
 
-                     layout: {
 
-                         padding: {
 
-                             top: 0,
 
-                             bottom: 0,
 
-                             left : 0,
 
-                             rigth: 0,
 
-                         }
 
-                     },
 
-                     tooltips: {
 
-                         callbacks: {
 
-                             label: function(tooltipItem, data) {
 
-                                 var label = data.labels[tooltipItem.index] || '';
 
-                                 if (label) {
 
-                                     label += ': ';
 
-                                 }
 
-                                 label += accounting.formatMoney(data.datasets[0].data[tooltipItem.index],{
 
-                                     symbol: "%",
 
-                                     format: "%v%s",
 
-                                     precision: 2,
 
-                                     thousand: ".",
 
-                                     decimal: ","
 
-                                 });
 
-                                 return label;
 
-                             }
 
-                         }
 
-                     },
 
-                     events: ['click'],
 
-                 }
 
-             });
 
-         },
 
-         BuildMultipleChart: function (CurrencyBase,label,body_subtotal,body_tax,body_cost,body_total,body_profit) {
 
-             var self = this;
 
-             Chart.scaleService.updateScaleDefaults('linear', {
 
-                 ticks: {
 
-                     callback: function(tick) {
 
-                         return tick.toLocaleString('de-DE');
 
-                     }
 
-                 }
 
-             });
 
-             Chart.defaults.global.tooltips.callbacks.label = function(tooltipItem, data) {
 
-                 var dataset = data.datasets[tooltipItem.datasetIndex];
 
-                 var datasetLabel = dataset.label || '';
 
-                 return datasetLabel +  dataset.data[tooltipItem.index].toLocaleString('de-DE');
 
-             };
 
-             var chartData = {
 
-     			labels: label,
 
-     			datasets: [
 
-                     /*
 
-                     ================
 
-                         BENEFICIO
 
-                     ================
 
-                     */
 
-                     {
 
-     				type: 'line',
 
-     				label: 'Beneficio',
 
-                     borderColor: '#03a9f4',
 
-                     fill: false,
 
-                     borderWidth: 2,
 
-     				data: body_profit,
 
-                     },
 
-                     /*
 
-                     ================
 
-                         TOTAL
 
-                     ================
 
-                     */
 
-                     {
 
-     				type: 'bar',
 
-     				label: 'Total',
 
-                     borderColor: '#BCCEF4',
 
-     				backgroundColor: '#BCCEF4',
 
-                     borderWidth: 1,
 
-     				data: body_total,
 
-                     },
 
-                     /*
 
-                     ================
 
-                         SUB TOTAL
 
-                     ================
 
-                     */
 
-                     {
 
-     				type: 'bar',
 
-     				label: 'Sub-Total',
 
-     				borderColor: '#A9E5E3',
 
-                     backgroundColor: '#A9E5E3',
 
-     				borderWidth: 1,
 
-     				data: body_subtotal,
 
-     			    },
 
-                     /*
 
-                     ================
 
-                         IMPUESTOS
 
-                     ================
 
-                     */
 
-                     {
 
-     				type: 'bar',
 
-     				label: 'Impuestos',
 
-                     borderColor: '#A0D995',
 
-     				backgroundColor: '#A0D995',
 
-                     borderWidth: 1,
 
-     				data:body_tax,
 
-     			    },
 
-                     /*
 
-                     ================
 
-                         COSTE
 
-                     ================
 
-                     */
 
-                     {
 
-     				type: 'bar',
 
-     				label: 'Coste',
 
-                     borderColor: '#C5D084',
 
-     				backgroundColor: '#C5D084',
 
-                     borderWidth: 1,
 
-     				data: body_cost,
 
-                     },
 
-                 ]
 
-     		};
 
-             var chart = new Chart($(".reporting-chart"), {
 
-                 type: 'bar',
 
-                 data: chartData,
 
-                 options: {
 
-                     responsive: true,
 
-                     responsiveAnimationDuration:20,
 
-                     maintainAspectRatio:false,
 
-                     title: {
 
-                         display: false,
 
-                     },
 
-                     hover: {
 
-                         mode: 'nearest',
 
-                         intersect: true
 
-                     },
 
-                     legend: {
 
-                        display: false,
 
-                     },
 
-                     layout: {
 
-                         padding: {
 
-                             top: 15,
 
-                             bottom: 0,
 
-                             left : 0,
 
-                             rigth: 0,
 
-                         }
 
-                     },
 
-                     events: ['click'],
 
-                     tooltips: {
 
-                         callbacks: {
 
-                             label: function(tooltipItem, data) {
 
-                                 var label = data.datasets[tooltipItem.datasetIndex].label || '';
 
-                                 if (label) {
 
-                                     label += ': ';
 
-                                 }
 
-                                 label += accounting.formatMoney(tooltipItem.yLabel, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
 
-                                 return label;
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             });
 
-         },
 
-         BuildMultipleBarChart: function (
 
-             data,
 
-             CurrencyBase,
 
-             first_label,
 
-             first_body,
 
-             second_label,
 
-             second_body,
 
-             third_label,
 
-             third_body,
 
-             fourth_label,
 
-             fourth_body,
 
-             label
 
-             ) {
 
-             var self = this;
 
-             Chart.scaleService.updateScaleDefaults('linear', {
 
-                 ticks: {
 
-                     callback: function(tick) {
 
-                         return tick.toLocaleString('de-DE');
 
-                     }
 
-                 }
 
-             });
 
-             Chart.defaults.global.tooltips.callbacks.label = function(tooltipItem, data) {
 
-                 var dataset = data.datasets[tooltipItem.datasetIndex];
 
-                 var datasetLabel = dataset.label || '';
 
-                 return datasetLabel +  dataset.data[tooltipItem.index].toLocaleString('de-DE');
 
-             };
 
-             var chartData = {
 
-     			labels: label,
 
-     			datasets: [
 
-                     {
 
-     				type: 'bar',
 
-     				label: first_label,
 
-                     borderColor: '#BCCEF4',
 
-     				backgroundColor: '#BCCEF4',
 
-                     borderWidth: 1,
 
-     				data: first_body,
 
-                     },
 
-                     {
 
-     				type: 'bar',
 
-     				label: second_label,
 
-     				borderColor: '#A9E5E3',
 
-                     backgroundColor: '#A9E5E3',
 
-     				borderWidth: 1,
 
-     				data: second_body,
 
-     			    },
 
-                     {
 
-     				type: 'bar',
 
-     				label: third_label,
 
-                     borderColor: '#A0D995',
 
-     				backgroundColor: '#A0D995',
 
-                     borderWidth: 1,
 
-     				data: third_body,
 
-     			    },
 
-                     {
 
-     				type: 'bar',
 
-     				label: fourth_label,
 
-                     borderColor: '#0288d1',
 
-     				backgroundColor: '#0288d1',
 
-                     borderWidth: 1,
 
-     				data: fourth_body,
 
-     			    },
 
-                 ]
 
-     		};
 
-             var chart = new Chart($(".reporting-chart"), {
 
-                 type: 'bar',
 
-                 data: chartData,
 
-                 options: {
 
-                     responsive: true,
 
-                     responsiveAnimationDuration:10,
 
-                     maintainAspectRatio:false,
 
-                     title: {
 
-                         display: false,
 
-                     },
 
-                     hover: {
 
-                         mode: 'nearest',
 
-                         intersect: true
 
-                     },
 
-                     legend: {
 
-                        display: false,
 
-                     },
 
-                     layout: {
 
-                         padding: {
 
-                             top: 0,
 
-                             bottom: 0,
 
-                             left : 0,
 
-                             rigth: 0,
 
-                         }
 
-                     },
 
-                     tooltips: {
 
-                         callbacks: {
 
-                             label: function(tooltipItem, data) {
 
-                                 var label = data.datasets[tooltipItem.datasetIndex].label || '';
 
-                                 if (label) {
 
-                                     label += ': ';
 
-                                 }
 
-                                 label += accounting.formatMoney(tooltipItem.yLabel, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
 
-                                 return label;
 
-                             }
 
-                         }
 
-                     },
 
-                     events: ['click'],
 
-                 }
 
-             });
 
-         },
 
-     });
 
- }
 
 
  |