def _print_row(self): try: identifier = '%s_%s' % (self[4].id, self[2]) ## for titles ajax fetching title = '<span class="ajax_changeable" data-id="%s">%s</span>' % ( identifier, escape(self[5])) except AttributeError as e: title = 'Multiple entries' row = [ escape(self._mos(self[0], 'name')), escape(self._mos(self[1], 'name')), self[2], escape(self._mos(self[3], 'name')), title, self._mos(self[6], lambda x: x.strftime('%d.%m.%Y')), comma_number(self[7]), ] for i, entry in enumerate(row): if entry == 'Multiple entries': row[i] = '<b>Multiple entries</b>' if self._subrows: row[-1] = '<b>%s</b>' % row[-1] return row
def _print_row(self): try: identifier = "%s_%s" % (self[4].id, self[2]) ## for titles ajax fetching title = '<span class="ajax_changeable" data-id="%s">%s</span>' % (identifier, escape(self[5])) except AttributeError as e: title = "Multiple entries" row = [ escape(self._mos(self[0], "name")), escape(self._mos(self[1], "name")), self[2], escape(self._mos(self[3], "name")), title, self._mos(self[6], lambda x: x.strftime("%d.%m.%Y")), comma_number(self[7]), ] for i, entry in enumerate(row): if entry == "Multiple entries": row[i] = "<b>Multiple entries</b>" if self._subrows: row[-1] = "<b>%s</b>" % row[-1] return row
def _print_row(self): date_xf = xlwt.easyxf(num_format_str="DD/MM/YYYY") row = [ (self._mos(self[0], "name"),), (self._mos(self[1], "name"),), (self[2],), (self._mos(self[3], "name"),), (self[5],), (self._mos(self[6], lambda x: x.strftime("%d.%m.%Y")), date_xf), (comma_number(self[7]),), ] return row
def _print_row(self): date_xf = xlwt.easyxf(num_format_str='DD/MM/YYYY') row = [ (self._mos(self[0], 'name'), ), (self._mos(self[1], 'name'), ), (self[2], ), (self._mos(self[3], 'name'), ), (self[5], ), (self._mos(self[6], lambda x: x.strftime('%d.%m.%Y')), date_xf), (comma_number(self[7]), ), ] return row
def _print_subrow(self, subrow): identifier = "%s_%s" % (subrow[4].id, subrow[2]) ## for titles ajax fetching title = '<span class="ajax_changeable" data-id="%s">%s</span>' % (identifier, escape(subrow[5])) row = [ escape(subrow[0].name), escape(subrow[1].name), subrow[2], escape(subrow[3].name), title, subrow[6].strftime("%d.%m.%Y"), comma_number(subrow[7]), ] return row
def _print_subrow(self, subrow): identifier = '%s_%s' % (subrow[4].id, subrow[2]) ## for titles ajax fetching title = '<span class="ajax_changeable" data-id="%s">%s</span>' % (identifier, escape(subrow[5])) row = [ escape(subrow[0].name), escape(subrow[1].name), subrow[2], escape(subrow[3].name), title, subrow[6].strftime('%d.%m.%Y'), comma_number(subrow[7]), ] return row
def create_row(cls, entries, groupby): printful_entries = cls._to_print(entries) row = printful_entries[0][:] if len(entries) == 1: return cls(row, []) for i, gb in enumerate(groupby): if not gb: row[i] = '<b>Multiple entries</b>' if not groupby[2]: row[4] = '<b>Multiple entries</b>' row[5] = '<b>Multiple entries</b>' asum = sum([arow[7] for arow in entries]) row[6] = '<b>%s</b>' % comma_number(asum) return cls(row, printful_entries)
def _to_print(cls, entries): result = [] for entry in entries: identifier = '%s_%s' % (entry[4].id, entry[2]) ## for titles ajax fetching title = '<span class="ajax_changeable" data-id="%s">%s</span>' % (identifier, escape(entry[5])) row = [ escape(entry[0].name), escape(entry[1].name), entry[2], escape(entry[3].name), title, entry[6].strftime('%d.%m.%Y'), comma_number(entry[7]), ] result.append(row) return result