Bonjour,
Je construits des rapports en HTML.
J'en ai fait une qui fait des sections par chargé de projet, et dans cette section, des sous sections par "statut" de projet, et pour chacun de ces statuts, un total des coûts planifiés et des prix.
Mon problème c'est que lorsqu'on est sur un nouveau chargé de projet, il me crée la section avant les sous-totaux de la précédente.
Voici un exemple ci-dessous. En clair, la somme de Amy apparaît après le changement de chargé de projet en Aymar.
Ensuite, les totaux se font bien par statuts, mais dès qu'on change de chargé de projet, rebelote.
Qty, Qty1 et ctr sont bien évidemment déclarés.
Pièce jointe 513031
Voici mes différent scripts:
Cette fonction vérifie sur quel chargé de projet on est:
celle-ci vérifie le statuts de chaque projetCode:
1
2
3
4
5
6
7
8
9
10
11
12 function CheckTechnician(value) { if(previous_tech!=value){ document.writeln('<tr><td></td></tr>'); document.writeln('<tr style="background-color: lightgray">'); document.writeln('<th colspan="2" style="background-color: lightgray;color: red">Project Manager:</th>'); document.writeln('<th colspan="10" style="background-color: lightgray;color:red ">'+value+'</th>'); document.writeln('</tr style="background-color: lightgray">'); document.writeln('<tr><td></td></tr>'); } previous_tech = value; }
Enfin, c'est ici que j'appelle les fonctionsCode:
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 function Checkstatus(value) { if(previous_status!=value){ if(ctr>0) { document.writeln('<td colspan="5"></td>'); document.writeln('<td colspan="1" style="border-top-style:solid;border-top-width: thin;font-weight: bold">Sums:</td>'); document.writeln('<td colspan="1" style="border-top-style:solid;border-top-width: thin;font-weight: bold">' + qty + '</td>'); document.writeln('<td colspan="1" style="border-top-style:solid;border-top-width: thin;font-weight: bold">' + qty1 + '</td>'); qty = 0.0; qty1 = 0.0; } ctr++; document.writeln('<tr><td></td></tr>'); document.writeln('<tr>'); document.writeln('<th colspan="3"></th>'); document.writeln('<th colspan="10">'+value+'</th>'); document.writeln('</tr>'); document.writeln('<th width="3%">Req_ID</th>') document.writeln('<th width="25%">PM</th>') document.writeln('<th width="45%">Name</th>') document.writeln('<th width="10%">Status</th>') document.writeln('<th width="5%">Start Date</th>') document.writeln('<th width="5%">End Date</th>') document.writeln('<th width="5%">Pl. Cost</th>') document.writeln('<th width="5%">Pl. Price</th>') document.writeln('<th width="5%">Margin</th>') document.writeln('<tr><td></td></tr>'); } previous_status = value; }
Code:
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 <tbody> {{#rec.rows}} <script>CheckTechnician('{{fields.pm}}')</script> <script>Checkstatus('{{fields.status}}')</script> <tr> <td width="3%">{{fields.request}}</td> <td width="25%">{{fields.pm}}</td> <td width="45%">{{fields.name}}</td> <td width="10%">{{fields.status1}}</td> <td width="5%">{{fields.planned_start_date}}</td> <td width="5%">{{fields.planned_end_date}}</td> <td width="5%">{{fields.planned_cost}} <script>QuantitySum({{fields.planned_cost}})</script></td> <td width="5%">{{fields.planned_price}}<script>QuantitySum1({{fields.planned_price}})</script></td> <td width="5%">{{fields.planned_margin}}</td> </tr> {{/rec.rows}} </tbody>
Également, j'ai le petit soucis que mes totaux ne se font pas à la dernière section.
Merci