Ejemplo n.º 1
0
def get_project(id):
    ids = recursion.get_recursion_prjs(str(id), "OA_Org")
    data =''
    for obj in ids:
        project = OA_Project.query.filter_by(id=obj).first();
        data=str(data)+str(obj)+","+str(project.project_name)
        data+="."
    data = data[:int(len(data)-1)]
    return json.dumps(data,ensure_ascii=False);
Ejemplo n.º 2
0
def fytj_Excel():
    beg_date = request.form['beg_date'] + " 00:00:00"
    end_date = request.form['end_date'] + " 23:59:59"
    is_paid = request.form['is_paid']
    node_id = request.form['node_id']
    node_type = request.form['node_type']
    sql = "SELECT b.name,c.real_name,d.project_name,a.amount,a.`describe`,a.create_date,(case is_paid when '0' then '未支付' \
        when '1' then '已支付' end) as paid,a.paid_date FROM oa_reimbursement a, oa_org b, oa_user c,oa_project d WHERE\
        a.org_id = b.id AND a.create_user = c.id and a.project_id=d.id"
    if is_paid != '-1':
        sql += " and a.is_paid = "+is_paid
    sql += " and a.create_date between '" + beg_date + "' and '" + end_date + "'"
    
    sql += " and a.project_id in ("
    ids = recursion.get_recursion_prjs(node_id, node_type)
    for obj in ids:
        sql += str(obj) + ","
    sql += "-1)"
    data=db.session.execute(sql).fetchall()

    exl_hdngs=['费用所属单位','申请人','项目','金额','报销事由','创建时间','审批状态','支付时间']
    types=     'text   text   text      text      text     datetime    text   datetime'.split()
    exl_hdngs_xf=ezxf('font: bold on;align: wrap on,vert centre,horiz center')
    types_to_xf_map={
        'int':ezxf(num_format_str='#,##0'),
        'date':ezxf(num_format_str='yyyy-mm-dd'),
        'datetime':ezxf(num_format_str='yyyy-mm-dd HH:MM:SS'),
        'ratio':ezxf(num_format_str='#,##0.00%'),
        'text':ezxf(),
        'price':ezxf(num_format_str='¥#,##0.00')
    }

    data_xfs=[types_to_xf_map[t] for t in types]
    date=datetime.datetime.now()
    year=date.year
    month=date.month
    day=date.day
    filename=str(year)+'_'+str(month)+'_'+str(day)+'_'+'报销费用支付详情'+'.xls'
    exp=export_excel()
    return exp.export_download(filename,'报销费用支付详情表',exl_hdngs,data,exl_hdngs_xf,data_xfs)
Ejemplo n.º 3
0
def fytj_list(page):
    if request.method == 'POST':
        beg_date = request.form['beg_date'] + " 00:00:00"
        end_date = request.form['end_date'] + " 23:59:59"
        is_paid = request.form['is_paid']
        node_id = request.form['node_id']
        node_type = request.form['node_type']
        
        sql = "1=1"
        if is_paid != '-1':
            sql += " and is_paid = "+is_paid
        sql += " and create_date between '" + beg_date + "' and '" + end_date + "'"
        
        sql += " and project_id in ("
        ids = recursion.get_recursion_prjs(node_id, node_type)
        for obj in ids:
            sql += str(obj) + ","
        sql += "-1)"
        
        data=OA_Reimbursement.query.filter(sql).order_by("id").paginate(page, per_page = PER_PAGE)
        
        return render_template("bxsq/fytj/fytj_list.html",data=data,beg_date=beg_date,end_date=end_date,is_paid=is_paid,node_id=node_id,node_type=node_type)