@@ -174,10 +174,10 @@ class SapovalTdb(models.Model):
...
@@ -174,10 +174,10 @@ class SapovalTdb(models.Model):
(select sum(amount_untaxed) from account_invoice where state!='draft' and type='out_invoice' and date >= date_trunc('year', current_date) ) as facture,
(select sum(amount_untaxed) from account_invoice where state!='draft' and type='out_invoice' and date >= date_trunc('year', current_date) ) as facture,
(select sum(amount_untaxed) from account_invoice where state!='draft' and type='out_invoice' and date >= date_trunc('month', current_date) ) as facture_mois,
(select sum(amount_untaxed) from account_invoice where state!='draft' and type='out_invoice' and date >= date_trunc('month', current_date) ) as facture_mois,
(select sum(residual_company_signed) from account_invoice where state!='draft' and type='out_invoice' ) as a_encaisser,
(select sum(residual_company_signed) from account_invoice where state!='draft' and type='out_invoice' ) as a_encaisser,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and type='opportunity' and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe,
(select count(*) from crm_lead where active=True and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as nb_opp,
(select count(*) from crm_lead where active=True and type='opportunity' and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as nb_opp,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and date_deadline >= date_trunc('year', current_date + interval '1' year) ) as pipe_n1,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and type='opportunity' and date_deadline >= date_trunc('year', current_date + interval '1' year) ) as pipe_n1,
(select count(*) from crm_lead where active=True and date_deadline >= date_trunc('year', current_date + interval '1' year) ) as nb_opp_n1,
(select count(*) from crm_lead where active=True and type='opportunity' and date_deadline >= date_trunc('year', current_date + interval '1' year) ) as nb_opp_n1,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability=95 and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe_win,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability=95 and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe_win,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability=100 and date_deadline >= date_trunc('year', current_date + interval '1' year) ) as pipe_win_n1,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability=100 and date_deadline >= date_trunc('year', current_date + interval '1' year) ) as pipe_win_n1,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability!=100 and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe_to_win,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability!=100 and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe_to_win,