예제 #1
0
파일: search.py 프로젝트: JohnCny/banksaler
    def POST(self):
        params=web.input()
        try:
            type=params.type
            saler_manager=int(params.saler_manager)
            customer_number=str(params.customer_number)
            credit_type=int(params.credit_type)
            beg_date=str(params.beg_date)
            end_date=str(params.end_date)
            page_num=params.page if hasattr(params, 'page') else 1
            per_page =params.per_page if hasattr(params, 'per_page') else 10



            if type=='1':
                credit=models.credit()
                result=credit.get_credit_list_query_paged(page_num,per_page,saler_manager,
                                                          customer_number,credit_type,
                                                          beg_date,end_date)
                return dm.download_report(1,result)
            elif type=='2':
                credit_grant=models.credit_grant()
                result=credit_grant.get_credit_grant_list_query_paged(page_num,per_page,saler_manager,
                                                                      customer_number,credit_type,
                                                                      beg_date,end_date)

                return dm.download_report(2,result)
            elif type=='3':
                credit_manage=models.credit_manage()
                result=credit_manage.get_credit_manage_list_query_paged(page_num,per_page,saler_manager,
                                                                        customer_number,credit_type,
                                                                        beg_date,end_date)

                return dm.download_report(3,result)
            elif type=='4':
                saler_target=saler.saler_target
                result=saler_target.get_saler_target_list_by_condition(self,page_num,per_page,saler_manager,beg_date,end_date)
                return dm.download_report(4,result)


        except:
            return sr.show_result_fail()+traceback.print_exc()
예제 #2
0
파일: search.py 프로젝트: JohnCny/banksaler
    def GET(self):
        params=web.input()
        try:
            type=params.type
            saler_manager=int(params.saler_manager)
            customer_number=str(params.customer_number)
            credit_type=int(params.credit_type)
            beg_date=str(params.beg_date)
            end_date=str(params.end_date)
            page_num=params.page if hasattr(params, 'page') else 1
            per_page =params.per_page if hasattr(params, 'per_page') else 10



            if type=='1':
                credit=models.credit()
                result=credit.get_credit_list_query_paged(page_num,per_page,saler_manager,
                                                          customer_number,credit_type,
                                                          beg_date,end_date)
                return json.dumps(result,cls=encoder.DateEncoder,ensure_ascii=False)
            elif type=='2':
                credit_grant=models.credit_grant()
                result=credit_grant.get_credit_grant_list_query_paged(page_num,per_page,saler_manager,
                                                          customer_number,credit_type,
                                                          beg_date,end_date)

                return json.dumps(result,cls=encoder.DateEncoder,ensure_ascii=False)
            elif type=='3':
                credit_manage=models.credit_manage()
                result=credit_manage.get_credit_manage_list_query_paged(page_num,per_page,saler_manager,
                                                                      customer_number,credit_type,
                                                                      beg_date,end_date)

                return json.dumps(result,cls=encoder.DateEncoder,ensure_ascii=False)
            elif type=='4':
                saler_target=saler.saler_target
                result=saler_target.get_saler_target_list_by_condition(self,page_num,per_page,saler_manager,beg_date,end_date)
                return json.dumps(result,cls=encoder.DateEncoder,ensure_ascii=False)


        except:
            return sr.show_result_fail()+traceback.print_exc()
#coding:utf8

import web
import models
import json
import tools.show_result as sr
import tools.json_encoding as encoder

urls=(
    '/list','get_credit_manage_list',
    '/create','create_credit_manage',
    '/(\d+)','manage_credit_manage'
)

credit_manage=models.credit_manage()

"""只返回id,公司名称,公司法人"""
class get_credit_manage_list:

    def GET(self):
        try:
            params=web.input()
            credit_type=params.credit_type
            page=params.page if hasattr(params, 'page') else 1
            perpage = params.perpage if hasattr(params, 'perpage') else 10

            return json.dumps(credit_manage.get_credit_manage_list_paged(credit_type,page,perpage),
                              cls=encoder.DateEncoder,ensure_ascii=False)
        except:
            return sr.show_result_fail()
        
예제 #4
0
#coding:utf8

import web
import models
import json
import tools.show_result as sr
import tools.json_encoding as encoder

urls=(
    '/list','get_credit_manage_list',
    '/create','create_credit_manage',
    '/(\d+)','manage_credit_manage'
)

credit_manage=models.credit_manage()

"""只返回id,公司名称,公司法人"""
class get_credit_manage_list:

    def GET(self):
        try:
            params=web.input()
            credit_type=params.credit_type
            page=params.page if hasattr(params, 'page') else 1
            perpage = params.perpage if hasattr(params, 'perpage') else 10

            return json.dumps(credit_manage.get_credit_manage_list_paged(credit_type,page,perpage),
                              cls=encoder.DateEncoder,ensure_ascii=False)
        except:
            return sr.show_result_fail()