def review(facility_name, year = None, month = None): # options for dropdowns select_years = util.get_last_x_years(5) select_months = util.get_months_dict() if not month or not year: #mostly we default to last_month # default to last month, get start and end dates last_month = util.get_last_month() year = last_month.year month = last_month.month from_date, to_date = util.start_and_end_month(year, month) # get line_items for month criteria = { ('line_item', 'date_created'): {'from': from_date, 'to': to_date}, ('line_item', 'price_per_unit'): {'compare': 'greater than', 'value': 0} } tqc = TableQueryCollection('line_item', criteria) table_query = tqc.get_first() pt = PageTemplate(MODULE_NAME, 'review') return pt.page_template_context( year = year, month = month, select_years = select_years, select_months = select_months, table_name = 'line_item', table_query = table_query )
def reports(facility_name, year = None, month = None): # options for dropdowns select_years = util.get_last_x_years(5) select_months = util.get_months_dict() if not month or not year: #mostly we default to last_month # default to last month, get start and end dates last_month = util.get_last_month() year = last_month.year month = last_month.month lc = LineItemCollection(year, month) lc.populate_report_data() pt = PageTemplate(MODULE_NAME, 'reports') return pt.page_template_context( lc = lc, year = year, month = month, select_years = select_years, select_months = select_months)
def __init__ (self, year = None, month = None, org_list = []): # default to last month last_month = util.get_last_month() if not year: year = last_month.year if not month: month = last_month.month self.month = month self.year = year self.org_list = org_list self.from_date, self.to_date = util.start_and_end_month(self.year, self.month) # create invoice objects self.oac = g_helper.get_org_access_control() self.invoices = self.get_invoices(self.from_date, self.to_date, self.org_list) self.set_invoices() # creates invoice rows in DB
def __init__ (self, year = None, month = None, org_list = [], invoiced = False): # default to last month last_month = util.get_last_month() if not year: year = last_month.year if not month: month = last_month.month self.month = month self.year = year self.org_list = org_list self.invoiced = invoiced self.from_date, self.to_date = util.start_and_end_month(self.year, self.month) self.reports = OrderedDict() self.oac = g_helper.get_org_access_control() self.line_items = self.oac.get_line_items(self.from_date, self.to_date, self.org_list, self.invoiced)