line_fcs = ['GPS_GasMain_Line_Delivered',
            'GPS_ServiceLine_G_Line_Delivered',
            'GPS_GasMain_Line_Approved',
            'GPS_ServiceLine_G_Line_Approved',
            ]
c_file = open('Cobb0_Footages.csv', 'wb')
c_writer = csv.writer(c_file, quoting=csv.QUOTE_NONNUMERIC, dialect='excel')

heading = ('State', 'Vendor', 'Main Del', 'Service Del',
           'Main App', 'Service App', 'End Date')
c_writer.writerow(heading)

for current_state in states:
    dest_env_folder = 'E:/Richard/FileGBs/'
    # dest_env_db = "{}_Cobbler_{}.gdb".format(current_state, datetime.datetime.now().strftime("%m%d"))
    dest_env_db = "{}_Cobbler_0815.gdb".format(current_state)
    arcpy.env.workspace = dest_env_folder + dest_env_db

    vendors = cobb_common.build_vendor_list(line_fcs)

    start, end, boy, bot = cobb_common.satandsun(datetime.date.today())

    calc_feet(current_state, bot, end, line_fcs, vendors, c_writer)

    # for day in cobb_common.datespan(datetime.date(2016, 1, 2), datetime.date.today(), delta=datetime.timedelta(days=7)):
    #     # start = day - datetime.timedelta(days=6)
    #     # print current_state, start.isoformat(), day.isoformat()
    #     calc_feet(current_state, bot, day.isoformat(), line_fcs, vendors, c_writer)

c_file.close()
           'Service <> 100', 'Service = 500:600:700', 'Service = 700', 'Service = 600',
           'CHPO <> 100', 'CHPO = 500:600:700', 'CHPO = 700', 'CHPO = 600',
           'CusConn <> 100', 'CusConn = 500:600:700', 'CusConn = 700', 'CusConn = 600',
           'Valve <> 100', 'Valve = 500:600:700', 'Valve = 700', 'Valve = 600',
           'Main <> 600', 'Main = 1000',
           'Service <> 600', 'Service = 1000',
           'CHPO <> 600', 'CHPO = 1000',
           'CusConn <> 600', 'CusConn = 1000',
           'Valve <> 600', 'Valve = 1000',
           'End Date')
c_writer.writerow(heading)

for current_state in states:
    dest_env_folder = 'E:/Richard/FileGBs/'
    # dest_env_db = "{}_Cobbler_{}.gdb".format(current_state, datetime.datetime.now().strftime("%m%d"))
    dest_env_db = "{}_Cobbler_0815.gdb".format(current_state)
    arcpy.env.workspace = dest_env_folder + dest_env_db

    vendors = cobb_common.build_vendor_list(point_fcs, """"POINTRECORD_ID" IS NOT NULL""")

    start, end, boy, bot = cobb_common.satandsun(datetime.date.today())

    calc_points(current_state, bot, end, point_fcs, vendors, c_writer)

    # for day in cobb_common.datespan(datetime.date(2016, 1, 2), datetime.date.today(), delta=datetime.timedelta(days=7)):
    #     # start = day - datetime.timedelta(days=6)
    #     # print current_state, start.isoformat(), day.isoformat()
    #     calc_points(current_state, bot, day, point_fcs, vendors, c_writer)

c_file.close()