#!/bin/env python
 
import sys
import AccountingReports

def main(argv=None):
    AccountingReports.UseArgs(argv)

    if not AccountingReports.CheckDB() :
        return 1

    argOutput = AccountingReports.gOutput
    if (argOutput == "all"):
       text = {}
       for iterOutput in ("text","csv","html"):
          text[iterOutput] = ( AccountingReports. NewUsers(range_begin = AccountingReports.gBegin, range_end = AccountingReports.gEnd ,output=iterOutput) )

       AccountingReports.sendAll(text)

    else:
       print AccountingReports. NewUsers(range_begin = AccountingReports.gBegin,range_end = AccountingReports.gEnd ,output=argOutput)

if __name__ == "__main__":
    sys.exit(main())



