244 lines
7.6 KiB
Plaintext
244 lines
7.6 KiB
Plaintext
|
|
|
|
|
|
|
|
%p
|
|
%center
|
|
-date = (Date.today - 2.year).beginning_of_month
|
|
|
|
-while date < Date.today
|
|
-Date.today.beginning_of_month
|
|
-Date.today.end_of_month
|
|
|
|
=link_to raw("#{l(date, :format => '%B')} #{date.year}"), admin_p_stats_path(:start => date, :stop => date.end_of_month)
|
|
="-"
|
|
|
|
-date = date + 1.month
|
|
|
|
|
|
.qi_row
|
|
.qi_pannel.qi_plain.padding
|
|
=form_tag "", :method => "get", :remote => false, :onsubmit => "set_busy();" do
|
|
|
|
.row.qi_cancel_margins
|
|
.col-xs-4
|
|
.input-group
|
|
=text_field_tag :start, params[:start],:class => "form-control datepicker", :placeholder => "Début"
|
|
%span.input-group-addon.btn{:onclick => "$(this).prev('input').val('');"}
|
|
=ic(:times)
|
|
|
|
.col-xs-4
|
|
.input-group
|
|
=text_field_tag :stop, params[:stop],:class => "form-control datepicker", :placeholder => "Fin"
|
|
%span.input-group-addon.btn{:onclick => "$(this).prev('input').val('');"}
|
|
=ic(:times)
|
|
|
|
|
|
|
|
.col-xs-2
|
|
|
|
=submit_tag "filtrer", :class => "btn btn-default", :style => "margin-bottom: 10px;"
|
|
|
|
%p
|
|
-if @start and @stop
|
|
=link_to "< Mois précédent","?start=#{CGI.escape((@start - 1.month).beginning_of_month.strftime('%d/%m/%Y'))}&stop=#{CGI.escape((@stop - 1.month).end_of_month.strftime('%d/%m/%Y'))}", :class => "btn btn-default"
|
|
-if @start and @stop
|
|
=link_to "Mois suivant >","?start=#{CGI.escape((@start + 1.month).beginning_of_month.strftime('%d/%m/%Y'))}&stop=#{CGI.escape((@stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}", :class => "btn btn-default"
|
|
|
|
|
|
%p
|
|
-if @start and @stop
|
|
=link_to "< Année précédente","?start=#{CGI.escape((@start - 1.year).beginning_of_month.strftime('%d/%m/%Y'))}&stop=#{CGI.escape((@stop - 1.year).end_of_month.strftime('%d/%m/%Y'))}", :class => "btn btn-default"
|
|
-if @start and @stop
|
|
=link_to "Année suivante >","?start=#{CGI.escape((@start + 1.year).beginning_of_month.strftime('%d/%m/%Y'))}&stop=#{CGI.escape((@stop + 1.year).end_of_month.strftime('%d/%m/%Y'))}", :class => "btn btn-default"
|
|
|
|
|
|
%hr
|
|
|
|
|
|
|
|
.qi_row.padding
|
|
|
|
.table-area
|
|
.table-area-inner
|
|
|
|
|
|
.freezeTable
|
|
%table.table.table-striped.table-hover.table-bordered.data_table
|
|
%tbody
|
|
%tr
|
|
%th
|
|
%th HT
|
|
%th TVA
|
|
%th TTC
|
|
%tr
|
|
%td
|
|
Factures
|
|
|
|
-docs = PriceDocument.where(:price_document_type_id => 1).where("date >= ? and date <= ?", @start, @stop)
|
|
|
|
%td
|
|
|
|
=number_to_currency docs.sum(:cc_tot_amount_ht)
|
|
|
|
|
|
%td
|
|
=number_to_currency docs.sum(:cc_tot_amount_tva)
|
|
|
|
%td
|
|
=number_to_currency docs.sum(:cc_tot_amount_ttc)
|
|
|
|
%tr
|
|
%td
|
|
Avoirs
|
|
-docs_avoirs = PriceDocument.where(:price_document_type_id => 2).where("date >= ? and date <= ?", @start, @stop)
|
|
|
|
%td
|
|
|
|
=number_to_currency docs_avoirs.sum(:cc_tot_amount_ht)
|
|
|
|
|
|
%td
|
|
=number_to_currency docs_avoirs.sum(:cc_tot_amount_tva)
|
|
|
|
%td
|
|
=number_to_currency docs_avoirs.sum(:cc_tot_amount_ttc)
|
|
|
|
|
|
%tr
|
|
%td
|
|
%strong Chiffre d'affaire
|
|
-docs_avoirs = PriceDocument.where(:price_document_type_id => 2).where("date >= ? and date <= ?", @start, @stop)
|
|
|
|
%td
|
|
|
|
%strong=number_to_currency docs.sum(:cc_tot_amount_ht) - docs_avoirs.sum(:cc_tot_amount_ht)
|
|
|
|
|
|
%td
|
|
%strong=number_to_currency docs.sum(:cc_tot_amount_tva) - docs_avoirs.sum(:cc_tot_amount_tva)
|
|
|
|
%td
|
|
%strong=number_to_currency docs.sum(:cc_tot_amount_ttc) - docs_avoirs.sum(:cc_tot_amount_ttc)
|
|
|
|
|
|
|
|
|
|
-if false
|
|
|
|
%div{:style => "width:350px;display:inline-block;"}
|
|
<canvas id="ordersChart" width="400" height="400"></canvas>
|
|
|
|
|
|
|
|
:javascript
|
|
var myPieChart = new Chart("ordersChart",{
|
|
type: 'pie',
|
|
data: {
|
|
labels: ["Finalisées", "Non finalisées"],
|
|
datasets: [{
|
|
label: '# of Votes',
|
|
data: [#{orders_ok},#{orders_not_ok}],
|
|
backgroundColor: [
|
|
'#4BC0C0',
|
|
'#FF6384',
|
|
|
|
],
|
|
borderColor: [
|
|
'white',
|
|
'white',
|
|
|
|
],
|
|
borderWidth: 2
|
|
}]
|
|
},
|
|
options: {
|
|
title: {
|
|
display: true,
|
|
text: 'Finalisation des commandes'
|
|
}
|
|
}
|
|
// options: options
|
|
});
|
|
|
|
|
|
%div{:style => "width:350px;display:inline-block;"}
|
|
<canvas id="margeChart" width="400" height="400"></canvas>
|
|
|
|
|
|
|
|
:javascript
|
|
var myPieChart = new Chart("margeChart",{
|
|
type: 'pie',
|
|
data: {
|
|
labels: ["Marge", "Cout"],
|
|
datasets: [{
|
|
label: '# of Votes',
|
|
data: [#{marge},#{cout}],
|
|
backgroundColor: [
|
|
'#4BC0C0',
|
|
'#FF6384',
|
|
|
|
],
|
|
borderColor: [
|
|
'white',
|
|
'white',
|
|
|
|
],
|
|
borderWidth: 2
|
|
}]
|
|
},
|
|
options: {
|
|
title: {
|
|
display: true,
|
|
text: 'Marges'
|
|
}
|
|
}
|
|
// options: options
|
|
});
|
|
|
|
|
|
-if false
|
|
<canvas id="myChart" width="400" height="200"></canvas>
|
|
|
|
:javascript
|
|
var ctx = document.getElementById("myChart");
|
|
var myChart = new Chart(ctx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
|
|
datasets: [{
|
|
label: '# of Votes',
|
|
data: [12, 19, 3, 5, 2, 3],
|
|
backgroundColor: [
|
|
'rgba(255, 99, 132, 0.2)',
|
|
'rgba(54, 162, 235, 0.2)',
|
|
'rgba(255, 206, 86, 0.2)',
|
|
'rgba(75, 192, 192, 0.2)',
|
|
'rgba(153, 102, 255, 0.2)',
|
|
'rgba(255, 159, 64, 0.2)'
|
|
],
|
|
borderColor: [
|
|
'rgba(255,99,132,1)',
|
|
'rgba(54, 162, 235, 1)',
|
|
'rgba(255, 206, 86, 1)',
|
|
'rgba(75, 192, 192, 1)',
|
|
'rgba(153, 102, 255, 1)',
|
|
'rgba(255, 159, 64, 1)'
|
|
],
|
|
borderWidth: 0
|
|
}]
|
|
},
|
|
options: {
|
|
scales: {
|
|
yAxes: [{
|
|
ticks: {
|
|
beginAtZero:true
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
});
|
|
|
|
|