conn = globals.conn # See if we have the data needed to run and build the base part of the query if parms.basedate.upper().startswith('M'): basemonth = int(parms.basedate[1:]) if not isMonthFinal(basemonth, curs): sys.exit(1) basepart = 'monthstart = "%s" AND entrytype = "M"' % getMonthStart( basemonth, curs) friendlybase = 'New Members on %s' % neaten(getMonthEnd(basemonth)) msgdate = datetime.date(globals.today.year, basemonth + 1, 1) if basemonth == 12: msgdate = datetime.date(globals.today.year, 1, 1) else: basedate = cleandate(parms.basedate) if not haveDataFor(basedate, curs): sys.exit(1) basepart = 'asof = "%s"' % basedate msgdate = datetime.datetime.strptime(basedate, '%Y-%m-%d') friendlybase = 'New Members on %s' % neaten(msgdate) msgbase = dateAsWords(msgdate) # Figure out the end date and build that part of the query yesterday = cleandate('yesterday') if parms.finaldate.upper().startswith('M'): finalmonth = int(parms.finaldate[1:]) msgdate = getMonthEnd(finalmonth) if isMonthFinal(finalmonth, curs): finalpart = 'monthstart = "%s" AND entrytype = "M"' % getMonthStart( finalmonth, curs) final = True
conn = globals.conn # See if we have the data needed to run and build the base part of the query if parms.basedate.upper().startswith('M'): basemonth = int(parms.basedate[1:]) if not isMonthFinal(basemonth, curs): sys.exit(1) basepart = 'monthstart = "%s" AND entrytype = "M"' % getMonthStart(basemonth, curs) friendlybase = 'New Members on %s' % neaten(getMonthEnd(basemonth)) msgdate = datetime.date(globals.today.year, basemonth+1, 1) if basemonth == 12: msgdate = datetime.date(globals.today.year, 1, 1) else: basedate = cleandate(parms.basedate) if not haveDataFor(basedate, curs): sys.exit(1) basepart = 'asof = "%s"' % basedate msgdate = datetime.datetime.strptime(basedate, '%Y-%m-%d') friendlybase = 'New Members on %s' % neaten(msgdate) msgbase = dateAsWords(msgdate) # Figure out the end date and build that part of the query yesterday = cleandate('yesterday') if parms.finaldate.upper().startswith('M'): finalmonth = int(parms.finaldate[1:]) msgdate = getMonthEnd(finalmonth) if isMonthFinal(finalmonth, curs): finalpart = 'monthstart = "%s" AND entrytype = "M"' % getMonthStart(finalmonth, curs) final = True reportdate = msgdate