Changeset 1251
- Timestamp:
- 01/06/04 16:51:46 (21 years ago)
- Location:
- pykota/trunk/pykota/reporters
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/reporters/html.py
r1240 r1251 22 22 # 23 23 # $Log$ 24 # Revision 1.4 2004/01/06 15:51:46 jalet 25 # Code factorization 26 # 24 27 # Revision 1.3 2003/12/27 16:49:25 uid67467 25 28 # Should be ok now. … … 40 43 """Produces a simple HTML report.""" 41 44 self.report = [] 45 if self.isgroup : 46 prefix = "Group" 47 else : 48 prefix = "User" 42 49 for printer in self.printers : 43 50 self.report.append('<h2 class="printername">%s</h2>' % self.getPrinterTitle(printer)) … … 53 60 self.report.append('<tr class="pykotacolsheader">%s</tr>' % "".join(["<th>%s</th>" % h for h in headers])) 54 61 oddeven = 0 55 if self.isgroup : 56 for (group, grouppquota) in self.tool.storage.getPrinterGroupsAndQuotas(printer, self.ugnames) : 57 oddeven += 1 58 if oddeven % 2 : 59 oddevenclass = "odd" 62 for (entry, entrypquota) in getattr(self.tool.storage, "getPrinter%ssAndQuotas" % prefix)(printer, self.ugnames) : 63 oddeven += 1 64 if oddeven % 2 : 65 oddevenclass = "odd" 66 else : 67 oddevenclass = "even" 68 (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid) = self.getQuota(entry, entrypquota) 69 if datelimit : 70 if datelimit == "DENY" : 71 oddevenclass = "deny" 60 72 else : 61 oddevenclass = "even" 62 (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid) = self.getQuota(group, grouppquota) 63 self.report.append('<tr class="%s">%s</tr>' % (oddevenclass, "".join(["<td>%s</td>" % h for h in (name, reached, pagecounter, soft, hard, balance, datelimit or " ", lifepagecounter, lifetimepaid)]))) 64 total += pages 65 totalmoney += money 66 else : 67 # default is user quota report 68 for (user, userpquota) in self.tool.storage.getPrinterUsersAndQuotas(printer, self.ugnames) : 69 oddeven += 1 70 if oddeven % 2 : 71 oddevenclass = "odd" 72 else : 73 oddevenclass = "even" 74 (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid) = self.getQuota(user, userpquota) 75 self.report.append('<tr class="%s">%s</tr>' % (oddevenclass, "".join(["<td>%s</td>" % h for h in (name, reached, pagecounter, soft, hard, balance, datelimit or " ", lifepagecounter, lifetimepaid)]))) 76 total += pages 77 totalmoney += money 73 oddevenclass = "warn" 74 self.report.append('<tr class="%s">%s</tr>' % (oddevenclass, "".join(["<td>%s</td>" % h for h in (name, reached, pagecounter, soft, hard, balance, datelimit or " ", lifepagecounter, lifetimepaid)]))) 75 total += pages 76 totalmoney += money 77 78 78 if total or totalmoney : 79 79 (tpage, tmoney) = self.getTotals(total, totalmoney) -
pykota/trunk/pykota/reporters/text.py
r1240 r1251 22 22 # 23 23 # $Log$ 24 # Revision 1.8 2004/01/06 15:51:46 jalet 25 # Code factorization 26 # 24 27 # Revision 1.7 2003/12/27 16:49:25 uid67467 25 28 # Should be ok now. … … 55 58 """Produces a simple text report.""" 56 59 self.report = [] 60 if self.isgroup : 61 prefix = "Group" 62 else : 63 prefix = "User" 57 64 for printer in self.printers : 58 65 self.report.append(self.getPrinterTitle(printer)) … … 64 71 total = 0 65 72 totalmoney = 0.0 66 if self.isgroup : 67 header = self.getReportHeader() 68 self.report.append(header) 69 self.report.append('-' * len(header)) 70 for (group, grouppquota) in self.tool.storage.getPrinterGroupsAndQuotas(printer, self.ugnames) : 71 (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid) = self.getQuota(group, grouppquota) 72 self.report.append("%-9.9s %s %7i %7s %7s %10s %-10.10s %8i %10s" % (name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid)) 73 total += pages 74 totalmoney += money 75 else : 76 # default is user quota report 77 header = self.getReportHeader() 78 self.report.append(header) 79 self.report.append('-' * len(header)) 80 for (user, userpquota) in self.tool.storage.getPrinterUsersAndQuotas(printer, self.ugnames) : 81 (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid) = self.getQuota(user, userpquota) 82 self.report.append("%-9.9s %s %7i %7s %7s %10s %-10.10s %8i %10s" % (name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid)) 83 total += pages 84 totalmoney += money 73 header = self.getReportHeader() 74 self.report.append(header) 75 self.report.append('-' * len(header)) 76 for (entry, entrypquota) in getattr(self.tool.storage, "getPrinter%ssAndQuotas" % prefix)(printer, self.ugnames) : 77 (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid) = self.getQuota(entry, entrypquota) 78 self.report.append("%-9.9s %s %7i %7s %7s %10s %-10.10s %8i %10s" % (name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid)) 79 total += pages 80 totalmoney += money 81 85 82 if total or totalmoney : 86 83 (tpage, tmoney) = self.getTotals(total, totalmoney)