Example #1
0
    def __init__(self, path, db_url, output_path=None, asof=None, name=None, filename="%Y%m%d_cashbalance_report.html"):

        self.name = name or 'CashBalancesReport'
        asof = (asof and datetime.datetime.strptime(asof, '%Y-%m-%d')) or datetime.datetime.now()
        logging.info("Using asof date {}".format(asof)) 
        self.lpath = output_path or path
        logging.info("Using path {}".format(self.lpath))
        if not os.path.isdir(self.lpath):
            os.makedirs(self.lpath)
        self.filename = asof.strftime(filename)
        date_rel_path = asof.strftime(os.path.sep.join(['%Y', '%B', '%d']))
        make_path(self.lpath, date_rel_path)
        self.lfilename = os.path.join(self.lpath, date_rel_path, self.filename)
        self.timestamp = asof.strftime('%Y-%m-%d')
        self.report = CashBalanceReport(db_url, name=self.lfilename, asof=asof)
Example #2
0
    def __init__(
        self, path, db_url, output_path=None, asof=None, name=None, filename="%Y%m%d_cashexception_report.html"
    ):

        self.name = name or self.report_dir
        asof = (asof and datetime.datetime.strptime(asof, "%Y-%m-%d")) or datetime.datetime.now()
        logging.info("Using asof date {}".format(asof))
        self.lpath = output_path or path
        logging.info("Using path {}".format(self.lpath))
        if not os.path.isdir(self.lpath):
            logging.debug("creating directory: %s" % path)
            os.makedirs(self.lpath)
        self.filename = asof.strftime(filename)
        date_rel_path = asof.strftime(os.path.sep.join(["%Y", "%B", "%d"]))
        make_path(self.lpath, date_rel_path)
        self.lfilename = os.path.join(self.lpath, date_rel_path, self.filename)
        self.timestamp = asof.strftime("%Y-%m-%d")
        self.report = CashExceptionReport(db_url, name=self.lfilename, asof=asof)