def convertxlsx(data_list, filePath, ids):
    ret = True
    try:
        # 数据库字段值,转化为电子表格值。 电子表格标题栏。1、与数据库字段保持一致。
        headings = ['序号', '日期','名称','入库单号码','产品名称',\
                    '数量','单价','金额','备注','经办人']

        date = [
            str(i.date + datetime.timedelta(hours=8)).split('+')[0]
            for i in data_list
        ]  #日期+时差
        name = [i.name for i in data_list]
        receipt = [i.product_name for i in data_list]
        product_name = [i.product_name for i in data_list]

        number = [i.number for i in data_list]
        univalence = [i.univalence for i in data_list]
        money = [i.money for i in data_list]

        remarks = [i.remarks for i in data_list]
        operator = [i.operator for i in data_list]

        data = [ids, date, name, receipt, product_name,\
                number, univalence, money,  remarks, operator]

        if not list_to_xlsx(data, headings, filePath):  # 保存为电子表格
            ret = False
    except Exception as _e:
        print('err: %s' % _e)
        ret = False
    return ret
예제 #2
0
def convertxlsx(data_list, filePath, ids):
    ret = True
    try:
        # 数据库字段值,转化为电子表格值。 电子表格标题栏。1、与数据库字段保持一致。
        headings = ["序号", "采购日期", "客户名称", "送货单号码","摘要", \
                    "送货数量", "单价", "金额", "收款", "余额", "备注", \
                    "日期1", "发票号码", "金额1", "欠客户票","经办人"]
                
        date = [str(i.date + datetime.timedelta(hours=8)).split('+')[0] for i in data_list] #日期+时差                      
        name = [i.name for i in data_list]                                  
        receipt = [i.receipt for i in data_list]        
        abstract = [i.abstract for i in data_list ]            
        number = [i.number for i in data_list ]         
        univalence = [i.univalence for i in data_list ]        
        money = [i.money for i in data_list ] 
        collection = [i.collection for i in data_list ] 
        balance = [i.balance for i in data_list ]        
        note = [i.note for i in data_list ] 
        date1 = [str(i.date1 + datetime.timedelta(hours=8)).split('+')[0] for i in data_list] #日期+时差                      
        Invoice_number = [i.Invoice_number for i in data_list ]        
        money1 = [i.money1 for i in data_list ] 
        owe_ticket = [i.owe_ticket for i in data_list ]        
        operator = [i.operator for i in data_list ]                
        
        data = [ids, date,name,receipt,abstract,number,univalence,\
        money,collection,balance,note,date1,Invoice_number,money1,owe_ticket,operator ]
        if not list_to_xlsx(data, headings, filePath): # 保存为电子表格
            ret = False
    except Exception as _e:
        print('err: %s' %_e)
        ret = False
    return ret
예제 #3
0
def convertxlsx(data_list, filePath, ids):
    ret = True
    try:
        # 数据库字段值,转化为电子表格值。 电子表格标题栏。1、与数据库字段保持一致。
        headings = ['序号','采购日期','送货单位','送货单号码','客户名称','送货产品名称','数量',\
                    '单价','金额','经办人','备注']

        dates = [
            str(i.date + datetime.timedelta(hours=8)).split('+')[0]
            for i in data_list
        ]  #采购日期+时差
        names = [i.name for i in data_list]  #送货单位
        nums = [i.num for i in data_list]  #送货单号码
        customer = [i.customer for i in data_list]  #客户名称
        product = [i.product for i in data_list]  #送货产品名称
        number = [i.number for i in data_list]  #数量
        price = [i.price for i in data_list]  #单价
        money = [i.money for i in data_list]  #金额
        operator = [i.operator for i in data_list]  #经办人
        note = [i.note for i in data_list]  #备注

        data = [ids, dates, names, nums, customer, product, number, \
            price, money, operator, note, ]
        if not list_to_xlsx(data, headings, filePath):  # 保存为电子表格
            ret = False
    except Exception as _e:
        ret = False
    return ret
def convertxlsx(data_list, filePath, ids): #??
    ret = True
    try:
        # 数据库字段值,转化为电子表格值。 电子表格标题栏。1、与数据库字段保持一致。
        headings = ['序号', '日期','名称','产品名称','上月结存数量','上月结存单价','上月结存金额',\
            '本月生产数量','本月生产单价','本月生产材料','本月直接人工','本月制造费用','本月生产金额',\
            '本月退货数量','本月退货金额','本月购入数量','本月购入金额','本月领用数量','本月领用金额',\
            '加权数量','加权单价','加权金额','本月退回数量','本月退回金额','本月作废数量','本月作废金额',\
            '本月样品销售数量','本月样品销售金额','本月结存数量','本月结存单价','本月结存金额','经办人']
                
        date = [str(i.date + datetime.timedelta(hours=8)).split('+')[0] for i in data_list] #日期+时差                      
        name = [i.name for i in data_list]                                  
        product_name = [i.product_name for i in data_list]        
        lastmonth_number = [i.lastmonth_number for i in data_list ]            
        lastmonth_univalence = [i.lastmonth_univalence for i in data_list ]         
        lastmonth_money = [i.lastmonth_money for i in data_list ]        
        thismonth_production_number = [i.thismonth_production_number for i in data_list ] 
        thismonth_production_univalence = [i.thismonth_production_univalence for i in data_list ] 
        thismonth_material = [i.thismonth_material for i in data_list ]        
        thismonth_artificial = [i.thismonth_artificial for i in data_list ] 
        thismonth_cost = [i.thismonth_cost for i in data_list]                  
        thismonth_production_money = [i.thismonth_production_money for i in data_list ]        
        return_number = [i.return_number for i in data_list ] 
        return_money = [i.return_money for i in data_list ]        
        purchase_number = [i.purchase_number for i in data_list ]                
        purchase_money = [i.purchase_money for i in data_list ] 
        collaruse_number = [i.collaruse_number for i in data_list ]        
        collaruse_money = [i.collaruse_money for i in data_list ] 
        weighting_number = [i.weighting_number for i in data_list ]        
        weighting_univalence = [i.weighting_univalence for i in data_list ]                
        weighting_money = [i.weighting_money for i in data_list ] 
        goback_number = [i.goback_number for i in data_list ] 
        goback_money = [i.goback_money for i in data_list ] 
        nullify_number = [i.nullify_number for i in data_list ]  
        nullify_money = [i.nullify_money for i in data_list ]     
        sample_sales_number = [i.sample_sales_number for i in data_list ]          
        sample_sales_money = [i.sample_sales_money for i in data_list ]        
        thismonth_number = [i.thismonth_number for i in data_list ]      
        thismonth_univalence = [i.thismonth_univalence for i in data_list ]         
        thismonth_money = [i.thismonth_money for i in data_list ]   
        operator = [i.operator for i in data_list ] 
                 
        data = [ids, date, name,product_name,lastmonth_number, lastmonth_univalence,lastmonth_money,\
        thismonth_production_number,thismonth_production_univalence,thismonth_material,thismonth_artificial,thismonth_cost,\
        thismonth_production_money,return_number,return_money,purchase_number,purchase_money,\
        collaruse_number,collaruse_money,weighting_number,weighting_univalence,weighting_money,\
        goback_number,goback_money,nullify_number, nullify_money,sample_sales_number,\
        sample_sales_money,thismonth_number,thismonth_univalence,thismonth_money,operator]

        if not list_to_xlsx(data, headings, filePath): # 保存为电子表格
            ret = False
    except Exception as _e:
        print('err: %s' %_e)
        ret = False
    return ret
예제 #5
0
def convertxlsx(data_list, filePath, ids):
    ret = True
    try:
        # 数据库字段值,转化为电子表格值。 电子表格标题栏。1、与数据库字段保持一致。
        headings = ['序号','日期','客户名称','收货单号码','摘要','付款','收货数量',\
                    '单价','金额','余额','备注','日期1','发票号码','金额1',\
                    '欠票','经办人']

        date = [
            str(i.date + datetime.timedelta(hours=8)).split('+')[0]
            for i in data_list
        ]  #日期+时差
        name = [i.name for i in data_list]
        receipt = [i.receipt for i in data_list]
        abstract = [i.abstract for i in data_list]
        payment = [i.payment for i in data_list]
        number = [i.number for i in data_list]
        univalence = [i.univalence for i in data_list]
        money = [i.money for i in data_list]
        balance = [i.balance for i in data_list]
        note = [i.note for i in data_list]
        date1 = [
            str(i.date1 + datetime.timedelta(hours=8)).split('+')[0]
            for i in data_list
        ]  #日期+时差
        Invoice_number = [i.Invoice_number for i in data_list]
        money1 = [i.money1 for i in data_list]
        owe_ticket = [i.owe_ticket for i in data_list]
        operator = [i.operator for i in data_list]

        data = [ids, date,name,receipt,abstract,payment,number,univalence,\
        money,balance,note,date1,Invoice_number,money1,owe_ticket,operator ]
        if not list_to_xlsx(data, headings, filePath):  # 保存为电子表格
            ret = False
    except Exception as _e:
        print('err: %s' % _e)
        ret = False
    return ret