'Store this report in dvr_site_activity'

def store(self, authorised=None):

    db = current.db
    s3db = current.s3db
    auth = current.auth
    settings = current.deployment_settings
    tablename = 'dvr_site_activity'
    table = s3db.table(tablename)
    if (not table):
        return None
    query = (((table.date == self.date) & (table.site_id == self.site_id)) & (table.deleted != True))
    row = db(query).select(table.id, limitby=(0, 1), orderby=(~ table.created_on)).first()
    if (authorised is None):
        has_permission = current.auth.s3_has_permission
        if row:
            authorised = has_permission('update', tablename, record_id=row.id)
        else:
            authorised = has_permission('create', tablename)
    if (not authorised):
        from s3 import S3PermissionError
        raise S3PermissionError
    data = self.extract()
    settings.base.xls_title_row = (lambda sheet: self.summary(sheet, data))
    title = current.T('Resident    List')
    from s3.s3export import S3Exporter
    exporter = S3Exporter().xls
    report = exporter(data['report'], title=title, as_stream=True)
    filename = ('%s_%s_%s.xls' % (title, self.site_id, str(self.date)))
    report_ = table.report.store(report, filename)
    record = {'site_id': self.site_id, 'old_total': data['old_total'], 'new_total': data['new_total'], 'cases_new': data['ins'], 'cases_closed': data['outs'], 'date': self.date, 'report': report_}
    from s3 import S3Request
    r = S3Request('dvr', 'site_activity', current.request, args=[], get_vars={})
    r.customise_resource('dvr_site_activity')
    if row:
        row.update_record(report=None)
        success = row.update_record(**record)
        if success:
            s3db.onaccept(table, record, method='create')
            result = row.id
        else:
            result = None
    else:
        record_id = table.insert(**record)
        if record_id:
            record['id'] = record_id
            s3db.update_super(table, record)
            auth.s3_set_record_owner(table, record_id)
            auth.s3_make_session_owner(table, record_id)
            s3db.onaccept(table, record, method='create')
            result = record_id
        else:
            result = None
    return result
