52 | | self.report.append(_("*** Report for %s quota on printer %s") % ((self.isgroup and "group") or "user", printer.Name)) |
53 | | self.report.append(_("Pages grace time: %i days") % self.tool.config.getGraceDelay(printer.Name)) |
54 | | if printer.PricePerJob is not None : |
55 | | self.report.append(_("Price per job: %.3f") % printer.PricePerJob) |
56 | | if printer.PricePerPage is not None : |
57 | | self.report.append(_("Price per page: %.3f") % printer.PricePerPage) |
| 57 | self.report.append(self.getPrinterTitle(printer)) |
| 58 | self.report.append(self.getPrinterGraceDelay(printer)) |
| 59 | (pjob, ppage) = self.getPrinterPrices(printer) |
| 60 | self.report.append(pjob) |
| 61 | self.report.append(ppage) |
| 62 | |
64 | | (pages, money) = self.printQuota(group, grouppquota) |
| 70 | (pages, money, name, reached, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid) = self.getQuota(group, grouppquota) |
| 71 | self.report.append("%-9.9s %s %7i %7s %7s %10s %-10.10s %8i %10s" % (name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid)) |
72 | | (pages, money) = self.printQuota(user, userpquota) |
| 80 | (pages, money, name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid) = self.getQuota(user, userpquota) |
| 81 | self.report.append("%-9.9s %s %7i %7s %7s %10s %-10.10s %8i %10s" % (name, reached, pagecounter, soft, hard, balance, datelimit, lifepagecounter, lifetimepaid)) |
87 | | def printQuota(self, entry, quota) : |
88 | | """Prints the quota information.""" |
89 | | lifepagecounter = int(quota.LifePageCounter or 0) |
90 | | pagecounter = int(quota.PageCounter or 0) |
91 | | balance = float(entry.AccountBalance or 0.0) |
92 | | lifetimepaid = float(entry.LifeTimePaid or 0.0) |
93 | | |
94 | | if entry.LimitBy and (entry.LimitBy.lower() == "balance") : |
95 | | if balance <= 0 : |
96 | | datelimit = "DENY" |
97 | | reached = "+B" |
98 | | else : |
99 | | datelimit = "" |
100 | | reached = "-B" |
101 | | else : |
102 | | if quota.DateLimit is not None : |
103 | | now = DateTime.now() |
104 | | datelimit = DateTime.ISO.ParseDateTime(quota.DateLimit) |
105 | | if now >= datelimit : |
106 | | datelimit = "DENY" |
107 | | elif (quota.HardLimit is not None) and (pagecounter >= quota.HardLimit) : |
108 | | datelimit = "DENY" |
109 | | elif (quota.HardLimit is None) and (quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) : |
110 | | datelimit = "DENY" |
111 | | else : |
112 | | datelimit = "" |
113 | | reached = (((quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) and "+") or "-") + "Q" |
114 | | |
115 | | strbalance = ("%5.2f" % balance)[:10] |
116 | | strlifetimepaid = ("%6.2f" % lifetimepaid)[:10] |
117 | | self.report.append("%-9.9s %s %7i %7s %7s %10s %-10.10s %8i %10s" % (entry.Name, reached, pagecounter, str(quota.SoftLimit), str(quota.HardLimit), strbalance, str(datelimit)[:10], lifepagecounter, strlifetimepaid)) |
118 | | return (lifepagecounter, lifetimepaid) |
119 | | |