40 | | phistoryurl = { "printername" : printer.Name, "history" : 1 } |
41 | | self.report.append('<a href="%s?%s"><h2 class="printername">%s</h2></a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode(phistoryurl), self.getPrinterTitle(printer))) |
42 | | self.report.append('<h3 class="printergracedelay">%s</h3>' % self.getPrinterGraceDelay(printer)) |
43 | | (pjob, ppage) = self.getPrinterPrices(printer) |
44 | | self.report.append('<h4 class="priceperjob">%s</h4>' % pjob) |
45 | | self.report.append('<h4 class="priceperpage">%s</h4>' % ppage) |
46 | | total = 0 |
47 | | totalmoney = 0.0 |
48 | | self.report.append('<table class="pykotatable" border="1">') |
49 | | headers = self.getReportHeader().split() |
50 | | headers.insert(1, "LimitBy") |
51 | | self.report.append('<tr class="pykotacolsheader">%s</tr>' % "".join(["<th>%s</th>" % h for h in headers])) |
52 | | oddeven = 0 |
53 | | for (entry, entrypquota) in getattr(self.tool.storage, "getPrinter%ssAndQuotas" % prefix)(printer, self.ugnames) : |
54 | | oddeven += 1 |
55 | | if oddeven % 2 : |
56 | | oddevenclass = "odd" |
57 | | else : |
58 | | oddevenclass = "even" |
59 | | (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid, overcharge, warncount) = self.getQuota(entry, entrypquota) |
60 | | if datelimit : |
61 | | if datelimit == "DENY" : |
62 | | oddevenclass = "deny" |
| 40 | entries = getattr(self.tool.storage, "getPrinter%ssAndQuotas" % prefix)(printer, self.ugnames) |
| 41 | if entries : |
| 42 | phistoryurl = { "printername" : printer.Name, "history" : 1 } |
| 43 | self.report.append('<a href="%s?%s"><h2 class="printername">%s</h2></a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode(phistoryurl), self.getPrinterTitle(printer))) |
| 44 | self.report.append('<h3 class="printergracedelay">%s</h3>' % self.getPrinterGraceDelay(printer)) |
| 45 | (pjob, ppage) = self.getPrinterPrices(printer) |
| 46 | self.report.append('<h4 class="priceperjob">%s</h4>' % pjob) |
| 47 | self.report.append('<h4 class="priceperpage">%s</h4>' % ppage) |
| 48 | total = 0 |
| 49 | totalmoney = 0.0 |
| 50 | self.report.append('<table class="pykotatable" border="1">') |
| 51 | headers = self.getReportHeader().split() |
| 52 | headers.insert(1, "LimitBy") |
| 53 | self.report.append('<tr class="pykotacolsheader">%s</tr>' % "".join(["<th>%s</th>" % h for h in headers])) |
| 54 | oddeven = 0 |
| 55 | for (entry, entrypquota) in entries : |
| 56 | oddeven += 1 |
| 57 | if oddeven % 2 : |
| 58 | oddevenclass = "odd" |
64 | | oddevenclass = "warn" |
65 | | if (not self.tool.config.getDisableHistory()) and (not self.isgroup) : |
66 | | name = '<a href="%s?username=%s&printername=%s&history=1">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), name, printer.Name, name) |
67 | | self.report.append('<tr class="%s">%s</tr>' % (oddevenclass, "".join(["<td>%s</td>" % h for h in (name, reached, overcharge, pagecounter, soft, hard, balance, datelimit or " ", lifepagecounter, lifetimepaid, warncount)]))) |
68 | | total += pages |
69 | | totalmoney += money |
| 60 | oddevenclass = "even" |
| 61 | (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid, overcharge, warncount) = self.getQuota(entry, entrypquota) |
| 62 | if datelimit : |
| 63 | if datelimit == "DENY" : |
| 64 | oddevenclass = "deny" |
| 65 | else : |
| 66 | oddevenclass = "warn" |
| 67 | if (not self.tool.config.getDisableHistory()) and (not self.isgroup) : |
| 68 | name = '<a href="%s?username=%s&printername=%s&history=1">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), name, printer.Name, name) |
| 69 | self.report.append('<tr class="%s">%s</tr>' % (oddevenclass, "".join(["<td>%s</td>" % h for h in (name, reached, overcharge, pagecounter, soft, hard, balance, datelimit or " ", lifepagecounter, lifetimepaid, warncount)]))) |
| 70 | total += pages |
| 71 | totalmoney += money |
71 | | if total or totalmoney : |
72 | | (tpage, tmoney) = self.getTotals(total, totalmoney) |
73 | | self.report.append('<tr class="totals"><td colspan="8"> </td><td align="right">%s</td><td align="right">%s</td><td> </td></tr>' % (tpage, tmoney)) |
74 | | self.report.append('<tr class="realpagecounter"><td colspan="8"> </td><td align="right">%s</td><td> </td></tr>' % self.getPrinterRealPageCounter(printer)) |
75 | | self.report.append('</table>') |
| 73 | if total or totalmoney : |
| 74 | (tpage, tmoney) = self.getTotals(total, totalmoney) |
| 75 | self.report.append('<tr class="totals"><td colspan="8"> </td><td align="right">%s</td><td align="right">%s</td><td> </td></tr>' % (tpage, tmoney)) |
| 76 | self.report.append('<tr class="realpagecounter"><td colspan="8"> </td><td align="right">%s</td><td> </td></tr>' % self.getPrinterRealPageCounter(printer)) |
| 77 | self.report.append('</table>') |