コード例 #1
0
ファイル: views.py プロジェクト: rumz/rbmo
def getLackingQuarterReqs(agency, year, quarter):
    cursor = connection.cursor()
    query = '''
            select * from quarterly_req 
              where id not in (select requirement_id from 
                               quarter_req_submitted 
                                 where agency_id=%s 
                                       and year=%s
                                       and quarter=%s)
            '''
    cursor.execute(query,[agency.id, year, quarter])
    return dictfetchall(cursor)
コード例 #2
0
ファイル: views.py プロジェクト: rumz/rbmo
def getWFPTotal(agency, year):
    cursor = connection.cursor()
    query = '''
            select sum(jan) as jan_total, sum(feb) as feb_total, sum(mar) as mar_total,
                   sum(apr) as apr_total, sum(may) as may_total, sum(jun) as jun_total,
                   sum(jul) as jul_total, sum(aug) as aug_total, sum(sept) as sept_total,
                   sum(oct) as oct_total, sum(nov) as nov_total, sum(`dec`) as dec_total,
                   sum(total) as total
            from wfp_data
                 where agency_id=%s and year=%s
            '''

    cursor.execute(query, [agency.id, year])    
    return dictfetchall(cursor)[0]
コード例 #3
0
ファイル: views.py プロジェクト: rumz/rbmo
def getYears(agency_id):
    cursor = connection.cursor()
    query = '''select distinct(year) from wfp_data where agency_id=%s'''
    cursor.execute(query, [agency_id])
    return dictfetchall(cursor)