HP CloudSystem Matrix/Matrix Operating Environment 7.2 Integration Interfaces API and CLI Operations Reference Guide

reportPeriod = PeriodInformation(startDate=self.fromVariable.get(), endDate=self.toVariable.get())
print reportPeriod.end
filters = Filters(organizationid=self.orgVariable.get(), billingcode=self.billingcodeVariable.get(),
owner=self.ownerVariable.get(), service=self.servicenameVariable.get())
if self.reporttypeVariable.get() == 1:
report = ServiceUsageReport (reportPeriod, chargebackService, filters, self.reporttitleVariable.get())
elif self.reporttypeVariable.get() == 2:
report = ServiceUsageDetailReport(reportPeriod, chargebackService, filters,
self.reporttitleVariable.get())
elif self.reporttypeVariable.get() == 3:
report = AggregateUsageReport(reportPeriod, chargebackService, filters, self.reporttitleVariable.get())
else:
raise "Error: Report type does not exist"
if report :
report.generate(self.reportfileVariable.get())
return True
return False
def validate_entries(self):
result = False
if (self.cmsVariable.get() <> "") and (self.usernameVariable.get() <> "") and (self.passwordVariable.get()
<> "") and (self.fromVariable.get() <> "") and (self.fromVariable.get() <> "YYYY-MM-DD") and
(self.toVariable.get() <> "") and (self.toVariable.get() <> "YYYY-MM-DD") and (self.reportfileVariable.get()
<> "") :
result = True
print result
return result
def OnButtonClick(self):
if (self.validate_entries() == True) :
try:
if (self.generateReport() == True) :
tkMessageBox.showinfo("Report generated", self.reportfileVariable.get())
except BaseException as e:
tkMessageBox.showerror("Report could not be generated", e)
else:
tkMessageBox.showwarning("Missing required field", "All required fields must be filled!")
if __name__ == "__main__":
locale.setlocale( locale.LC_ALL, '' )
app = chargeback_app(None)
app.title('HP CloudSystem Matrix Showback/Chargeback Reports Generation')
app.mainloop()
119