1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
<%doc>
Ce rapport permet de visualiser tous les projets de SLA en cours et d'en verifier leur rentabilité.
</%doc>
<html>
<head>
<style type="text/css">
thead{
background-color:#d0d0d0;
}
td{
height: 200px;
font-size: 10px;
page-break-inside: always;
}
table tr:nth-child(even){
background-color: #f0f0f0;
}
th{
text-align: left;
font-size: 12px;
}
td.centrer{
text-align: right;
font-size: 10px;
page-break-inside: always;
}
</style>
</head>
<body>
<h3>Rapport des SLA non complet</h2>
<h4>état au
<script>
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
var laDate = dd+"."+mm+"."+yyyy;
if(dd<10) {
dd='0'+dd
}
if(mm<10) {
mm='0'+mm
}
document.write(laDate);
</script>
</h4>
## Tableau représentant les différentes SLA
<table>
<thead>
<tr>
<th width="100px">Libellé</th>
<th width="85px">Prix facturé</th>
<th width="85px">Prix <br /> prévue</th>
<th width="85px">Prix <br /> consommé</th>
<th width="85px">Prestation <br /> gratuite</th>
<th width="85px">Montant restant</th>
<th width="85px">Pourcentage <br /> restant</th>
</tr>
</thead>
<tbody>
## Déclaration des variables pour le total
<%
affichage = 0
totalInvoiced = 0
totalPrevu = 0
totalcosomme = 0
totalgratuit = 0
totalSolde = 0
pourcentageTotal = 0
%>
## Boucle déclare en langage propre au webkit pour chaque SLA selectionée
% for o in objects:
% if "contract" in o.type:
## Bout de code en python pour assigner les variables que je vais afficher dans le rapport
## o._cr.execute("select line.quantity from account_invoice_line line where line.account_analytic_id="+str(o.id))
<%
o._cr.execute("select list_price*unit_amount from account_analytic_line inner join product_product on (account_analytic_line.product_id = product_product.id) inner join product_template on (product_product.id = product_template.id) where account_id="+str(o.id)+" AND journal_id=4")
res = o._cr.fetchall()
prixconsomme = 0
nom = o.partner_id.name
prixPrevu = o.amount_max
totalPrevu = totalPrevu + prixPrevu
%>
% for t in res:
<%
prixconsomme = prixconsomme + t[0]
totalcosomme = totalcosomme + t[0]
%>
%endfor
<%
o._cr.execute("select amount from account_analytic_line where account_id="+str(o.id)+" AND journal_id=1 AND amount!=0");
facture = o._cr.fetchall()
montantsInvoiced = 0
%>
% for t in facture:
<%
montantsInvoiced = montantsInvoiced + t[0]
totalInvoiced = totalInvoiced + t[0]
%>
%endfor
<%
o._cr.execute("select list_price*unit_amount from account_analytic_line inner join product_product on (account_analytic_line.product_id = product_product.id) inner join product_template on (product_product.id = product_template.id) where account_id="+str(o.id)+" AND journal_id=4 AND to_invoice=3");
free = o._cr.fetchall()
gratuit = 0
%>
% for t in free:
<%
gratuit = gratuit + t[0]
totalgratuit = totalgratuit + t[0]
%>
%endfor
% if prixPrevu != 0:
<%
solde = prixPrevu - prixconsomme
pourcentage = solde*100/prixPrevu
pourcentage = round(pourcentage,0)
pourcentage = int(pourcentage)
%>
% else:
<%
pourcentage = 0
%>
% endif
<%
#montantsInvoiced = float(montantsInvoiced)
#montantsInvoiced = "%10.2f"%(montantsInvoiced)
#gratuit = float(gratuit)
#prixPrevu = "%10.2f"%(prixPrevu)
#prixconsomme = "%10.2f"%(prixconsomme)
#gratuit = "%10.2f"%(gratuit)
#solde = "%10.2f"%(solde)
%>
## Condition Webkit pour remplir le tableau, avec une ligne par entreprise
% if prixPrevu == 0:
<tr>
<td>${nom} </td>
<td class="centrer">${montantsInvoiced} </td>
<td class="centrer">${prixPrevu} </td>
<td class="centrer">${prixconsomme} </td>
<td class="centrer">${gratuit} </td>
<td class="centrer">${solde} </td>
<td class="centrer">${pourcentage} %</td>
</tr>
%endif
## fin test type
% endif
%endfor
</tbody>
</table>
</body>
</html> |
Partager