示例#1
0
文件: views.py 项目: KGPython/scm2
def writeDataToSheet1(wb, code, tbody, thead, total):

    sheet = wb.add_sheet("往来单据额调整单明细", cell_overwrite_ok=True)

    titles = [[("往来单据额调整单明细", 0, 1, 8)], [("单位:承德宽广", 5, 1, 3)],
              [("单号:" + code, 0, 1, 2),
               ("审核日期:" + thead['chdate'].strftime('%Y-%m-%d'), 2, 1, 3),
               ("生成日期:" + thead['edate'].strftime('%Y-%m-%d'), 5, 1, 3)],
              [("门店:" + thead['shopname'], 0, 1, 2),
               ("供应商代码:" + thead['spercode'], 2, 1, 3),
               ("供应商名称:" + thead['spername'], 5, 1, 3)],
              [("供应商编码", 0, 1, 1), ("批次号", 1, 1, 1), ("商品条码", 2, 1, 1),
               ('品名', 3, 1, 1), ('调整数量', 4, 1, 1), ('原含税单价', 5, 1, 1),
               ('新含税单价', 6, 1, 1), ('含税调整金额', 7, 1, 1)]]

    keylist = [
        'adbatchseq', 'pcode', 'barcode', 'pname', 'anum', 'cprice_notax',
        'dqhsjj', 'sum4'
    ]

    widthList = [1000, 1000, 1000, 2500, 1000, 1000, 1000, 1000]

    #日销售报表
    mtu.insertTitle2(sheet, titles, keylist, widthList)
    mtu.insertCell2(sheet, 6, tbody, keylist, None)
    titlesLen = len(titles)
    listTopLen = len(tbody)
    mtu.insertSum2(sheet, keylist, titlesLen + listTopLen + 1, total, 4)
示例#2
0
def writeDataToSheet2(wb,listShops,listShopTotal,listDept):
    date = DateUtil.get_day_of_day(-1)
    year = date.year
    month = date.month

    titlesSheetShop = [[("(%s月)零库存课组明细日报" % month,0,1,7)],
              [("报表日期",3,1,1),("%s年-%s月-%s日"%(year,month,date.day),4,1,3)],
              [("门店编号",0,1,1),("门店名称",1,1,1),("课组编码",2,1,1),("课组名称",3,1,1),("课组汇总",4,1,1),("零库存数",3,1,1),("占比",3,1,1)]
              ]
    titlesSheetLast = [[("(%s月)零库存课组汇总日报" % month,0,1,5)],
              [("报表日期",2,1,1),("%s年-%s月-%s日"%(year,month,date.day),3,1,2)],
              [("课组编码",0,1,1),("课组名称",1,1,1),("课组汇总",2,1,1),("零库存数",3,1,1),("占比",4,1,1)]
              ]
    keylistSheet2 = ['ShopID','shopname','deptid','deptidname','qtyz','qtyl','zhonbi']
    keylistSheet3 = ['deptid','deptidname','qtyz','qtyl','zhonbi']
    widthList = [600,1100,600,600,600,600]
    sheets = []
    for i in range(0,len(listShops)):
        sheets.append(wb.add_sheet(listShops[i][0]['shopname'],cell_overwrite_ok=True))
    sheets.append(wb.add_sheet("(月)零库存课组汇总日报",cell_overwrite_ok=True))
    for j in range(0,len(sheets)-1):
        mtu.insertTitle2(sheets[j],titlesSheetShop,keylistSheet2,widthList)
        mtu.insertCell2(sheets[j],3,listShops[j-2],keylistSheet2,None)
        titlesLen = len(titlesSheetShop)
        listShopsLen = len(listShops)
        totalDict = {'dict':listShopTotal[j-2]}
        mtu.insertSum2(sheets[j],keylistSheet2,titlesLen+listShopsLen,totalDict,2)

    mtu.insertTitle2(sheets[len(sheets)-1],titlesSheetLast,keylistSheet3,widthList)
    mtu.insertCell2(sheets[len(sheets)-1],3,listDept,keylistSheet3,None)
示例#3
0
def writeDataToSheet1(wb, listTop, TotalDict):
    date = DateUtil.get_day_of_day(-1)
    year = date.year
    month = date.month
    lastDay = calendar.monthrange(year, month)[1]

    sheet = wb.add_sheet("(月)负库存排名日报", cell_overwrite_ok=True)

    titles = [[("(%s月)负库存排名日报" % month, 0, 1, 15)],
              [("门店编号", 0, 2, 1), ("门店名称", 1, 2, 1), ("月累计排名(不含联营)", 2, 1, 4)],
              [('有效商品数', 2, 1, 1), ('合计', 3, 1, 1), ('占比', 4, 1, 1),
               ('名次', 5, 1, 1)]]

    keylist = [
        'ShopID', 'shopname', 'qtyzSum', 'qtylSum', 'zhonbiSum', 'mingciSum'
    ]

    widthList = [600, 1100, 600, 600, 600, 600]

    trow1 = titles[1]
    trow2 = titles[2]

    n = 6
    for d in range(1, lastDay + 1):
        trow1.append((str(d) + '日排名(不含联营)', n, 1, 4))
        trow2.append(('有效商品数', n, 1, 1))
        trow2.append(('合计', n + 1, 1, 1))
        trow2.append(('占比', n + 2, 1, 1))
        trow2.append(('名次', n + 3, 1, 1))
        widthList.append(600)
        widthList.append(400)
        widthList.append(400)
        widthList.append(400)
        n += 4
        if d < 10:
            keylist.append('qtyz_0' + str(d))
            keylist.append('qtyl_0' + str(d))
            keylist.append('zhonbi_0' + str(d))
            keylist.append('mingci_0' + str(d))
        else:
            keylist.append('qtyz_' + str(d))
            keylist.append('qtyl_' + str(d))
            keylist.append('zhonbi_' + str(d))
            keylist.append('mingci_' + str(d))
    #日销售报表
    mtu.insertTitle2(sheet, titles, keylist, widthList)
    mtu.insertCell2(sheet, 3, listTop, keylist, None)
    titlesLen = len(titles)
    listTopLen = len(listTop)
    mtu.insertSum2(sheet, keylist, titlesLen + listTopLen, TotalDict, 2)
示例#4
0
def writeDataToSheet1(wb, listtop, TotalDict):
    date = DateUtil.get_day_of_day(-1)
    year = date.year
    month = date.month
    lastDay = calendar.monthrange(year, month)[1]

    sheet1 = wb.add_sheet("门店顾客退货率", cell_overwrite_ok=True)

    titles = [[("(%s月)门店顾客退货率" % month, 0, 1, 13)],
              [("序号", 0, 2, 1), ("门店编码", 1, 2, 1), ("门店名称", 2, 2, 1),
               ('月累计退货', 3, 1, 3)],
              [('销售金额', 3, 1, 1), ('退货金额', 4, 1, 1), ('退货率', 5, 1, 1)]]

    keylist = [
        'sequenceNumber', 'shopid', 'shopname', 'shopsalesum', 'retsum',
        'retrate'
    ]

    widthList = [600, 300, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600]

    trow1 = titles[1]
    trow2 = titles[2]

    n = 6
    for d in range(1, lastDay + 1):
        trow1.append((str(month) + '月' + str(d) + '日', n, 1, 3))
        trow2.append(('销售金额', n, 1, 1))
        trow2.append(('退货金额', n + 1, 1, 1))
        trow2.append(('退货率', n + 2, 1, 1))
        widthList.append(600)
        widthList.append(400)
        widthList.append(400)
        n += 3
        if d < 10:
            keylist.append('retsum_0' + str(d))
            keylist.append('shopsalesum_0' + str(d))
            keylist.append('retrate_0' + str(d))
        else:
            keylist.append('retsum_' + str(d))
            keylist.append('shopsalesum_' + str(d))
            keylist.append('retrate_' + str(d))

    # 日销售报表
    mtu.insertTitle2(sheet1, titles, keylist, widthList)
    mtu.insertCell2(sheet1, 3, listtop, keylist, None)
    titlesLen = len(titles)
    listTopLen = len(listtop)
    mtu.insertSum2(sheet1, keylist, titlesLen + listTopLen, TotalDict, 3)
示例#5
0
def writeDataToSheet1(wb,listTop,TotalDict):
    date = DateUtil.get_day_of_day(-1)
    year = date.year
    month = date.month
    lastDay = calendar.monthrange(year,month)[1]

    sheet = wb.add_sheet("(月)零库存排名日报",cell_overwrite_ok=True)

    titles = [[("(%s月)零库存排名日报" % month,0,1,15)],
              [("门店编号",0,2,1),("门店名称",1,2,1),("月累计排名(不含联营)",2,1,4)],
              [('有效商品数',2,1,1),('合计',3,1,1),('占比',4,1,1),('名次',5,1,1)]
              ]

    keylist = ['ShopID','shopname','qtyzSum','qtylSum','zhonbiSum','mingciSum']

    widthList = [600,1100,600,600,600,600]

    trow1 = titles[1]
    trow2 = titles[2]

    n = 6
    for d in range(1,lastDay+1):
        trow1.append((str(d)+'日排名(不含联营)',n,1,4))
        trow2.append(('有效商品数',n,1,1))
        trow2.append(('合计',n+1,1,1))
        trow2.append(('占比',n+2,1,1))
        trow2.append(('名次',n+3,1,1))
        widthList.append(600)
        widthList.append(400)
        widthList.append(400)
        widthList.append(400)
        n += 4
        if d<10:
            keylist.append('qtyz_0'+str(d))
            keylist.append('qtyl_0'+str(d))
            keylist.append('zhonbi_0'+str(d))
            keylist.append('mingci_0'+str(d))
        else:
            keylist.append('qtyz_'+str(d))
            keylist.append('qtyl_'+str(d))
            keylist.append('zhonbi_'+str(d))
            keylist.append('mingci_'+str(d))
    #日销售报表
    mtu.insertTitle2(sheet,titles,keylist,widthList)
    mtu.insertCell2(sheet,3,listTop,keylist,None)
    titlesLen = len(titles)
    listTopLen = len(listTop)
    mtu.insertSum2(sheet,keylist,titlesLen+listTopLen,TotalDict,2)
示例#6
0
def writeDataToSheet1(wb, listtop, TotalDict):
    date = DateUtil.get_day_of_day(-1)
    year = date.year
    month = date.month
    lastDay = calendar.monthrange(year, month)[1]

    sheet1 = wb.add_sheet("门店顾客退货率", cell_overwrite_ok=True)

    titles = [
        [("(%s月)门店顾客退货率" % month, 0, 1, 13)],
        [("序号", 0, 2, 1), ("门店编码", 1, 2, 1), ("门店名称", 2, 2, 1), ('月累计退货', 3, 1, 3)],
        [('销售金额', 3, 1, 1), ('退货金额', 4, 1, 1), ('退货率', 5, 1, 1)]
    ]

    keylist = ['sequenceNumber', 'shopid', 'shopname', 'shopsalesum', 'retsum', 'retrate']

    widthList = [600, 300, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600]

    trow1 = titles[1]
    trow2 = titles[2]

    n = 6
    for d in range(1, lastDay + 1):
        trow1.append((str(month) + '月' + str(d) + '日', n, 1, 3))
        trow2.append(('销售金额', n, 1, 1))
        trow2.append(('退货金额', n + 1, 1, 1))
        trow2.append(('退货率', n + 2, 1, 1))
        widthList.append(600)
        widthList.append(400)
        widthList.append(400)
        n += 3
        if d < 10:
            keylist.append('retsum_0' + str(d))
            keylist.append('shopsalesum_0' + str(d))
            keylist.append('retrate_0' + str(d))
        else:
            keylist.append('retsum_' + str(d))
            keylist.append('shopsalesum_' + str(d))
            keylist.append('retrate_' + str(d))


    # 日销售报表
    mtu.insertTitle2(sheet1, titles, keylist, widthList)
    mtu.insertCell2(sheet1, 3, listtop, keylist, None)
    titlesLen = len(titles)
    listTopLen = len(listtop)
    mtu.insertSum2(sheet1, keylist, titlesLen + listTopLen, TotalDict, 3)
示例#7
0
def writeDataToSheet1(wb, shopTop, TotalDict):
    date = DateUtil.get_day_of_day(-1)
    year = date.year
    month = date.month
    lastDay = calendar.monthrange(year, month)[1]

    sheet = wb.add_sheet("(月)水果报损率日报", cell_overwrite_ok=True)

    titles = [[("(%s月)水果报损率日报" % month, 0, 1, 15)],
              [("门店编号", 0, 2, 1), ("门店名称", 1, 2, 1), ("月累计报损", 2, 1, 3)],
              [
                  ('成本金额', 2, 1, 1),
                  ('销售成本金额', 3, 1, 1),
                  ('报损率', 4, 1, 1),
              ]]

    keylist = [
        'shopid', 'shopname', 'lostvalueSum', 'costvalueSum', 'lrateSum'
    ]

    widthList = [600, 1100, 600, 600, 600, 600]

    trow1 = titles[1]
    trow2 = titles[2]

    n = 5  #1日单元格开始位置
    for d in range(1, lastDay + 1):
        trow1.append((str(d) + '日', n, 1, 3))
        trow2.append(('成本金额', n, 1, 1))
        trow2.append(('销售成本金额', n + 1, 1, 1))
        trow2.append(('报损率', n + 2, 1, 1))
        widthList.append(600)
        widthList.append(400)
        widthList.append(400)
        widthList.append(400)
        n += 3  #每日单元格数量
        dStr = '0' + str(d) if d < 10 else str(d)
        keylist.append('lostvalue_' + dStr)
        keylist.append('costvalue_' + dStr)
        keylist.append('lrate_' + dStr)

    #日销售报表
    mtu.insertTitle2(sheet, titles, keylist, widthList)
    mtu.insertCell2(sheet, 3, shopTop, keylist, None)
    titlesLen = len(titles)
    listTopLen = len(shopTop)
    mtu.insertSum2(sheet, keylist, titlesLen + listTopLen, TotalDict, 2)
示例#8
0
文件: fruitLost.py 项目: KGPython/scm
def writeDataToSheet1(wb,shopTop,TotalDict):
    date = DateUtil.get_day_of_day(-1)
    year = date.year
    month = date.month
    lastDay = calendar.monthrange(year,month)[1]

    sheet = wb.add_sheet("(月)水果报损率日报",cell_overwrite_ok=True)

    titles = [[("(%s月)水果报损率日报" % month,0,1,15)],
              [("门店编号",0,2,1),("门店名称",1,2,1),("月累计报损",2,1,3)],
              [('成本金额',2,1,1),('销售成本金额',3,1,1),('报损率',4,1,1),]
              ]

    keylist = ['shopid','shopname','lostvalueSum','costvalueSum','lrateSum']

    widthList = [600,1100,600,600,600,600]

    trow1 = titles[1]
    trow2 = titles[2]

    n = 5 #1日单元格开始位置
    for d in range(1,lastDay+1):
        trow1.append((str(d)+'日',n,1,3))
        trow2.append(('成本金额',n,1,1))
        trow2.append(('销售成本金额',n+1,1,1))
        trow2.append(('报损率',n+2,1,1))
        widthList.append(600)
        widthList.append(400)
        widthList.append(400)
        widthList.append(400)
        n += 3  #每日单元格数量
        dStr = '0'+str(d) if d<10 else str(d)
        keylist.append('lostvalue_'+dStr)
        keylist.append('costvalue_'+dStr)
        keylist.append('lrate_'+dStr)

    #日销售报表
    mtu.insertTitle2(sheet,titles,keylist,widthList)
    mtu.insertCell2(sheet,3,shopTop,keylist,None)
    titlesLen = len(titles)
    listTopLen = len(shopTop)
    mtu.insertSum2(sheet,keylist,titlesLen+listTopLen,TotalDict,2)
示例#9
0
def writeDataToSheet1(wb,rlist,sumDict):
    date = DateUtil.get_day_of_day(-1)
    yesterday = date.strftime("%Y-%m-%d")

    sheet = wb.add_sheet("宽广集团销售日报表",cell_overwrite_ok=True)

    titles = [[("宽广集团销售日报表",2,1,13)],
              [("数据日期:",0,1,2),(yesterday,2,1,1),("单位:元",4,1,1)],
              [("机构编码",0,2,1),("机构名称",1,2,1),("POS销售数据",3,1,9),("批发销售数据",4,1,4)],
              [("总客流量",2,1,1),("平均客单价",3,1,1),("销售金额",4,1,1),("折扣金额",5,1,1),("实际销售",6,1,1),("销售成本",7,1,1),
               ("毛利",8,1,1),("毛利率",9,1,1),("优惠占比",10,1,1),("实际销售",11,1,1),("销售成本",12,1,1),("毛利",13,1,1),("毛利率",14,1,1)],
            ]

    keylist = ['shopid','shopnm','tradenumber','tradeprice','salevalue','discvalue','sale','costvalue',
               'salegain','gaintx','yhzhanbi','wsalevalue','wcostvalue','wsalegain',
               'wgaintx']

    widthList = [600,400,1000,800,400,800,800,800,800,800,800,800,800,800,800]

    mtu.insertTitle2(sheet,titles,keylist,widthList)
    count = mtu.insertCell2(sheet,4,rlist,keylist,None)
    mtu.insertSum2(sheet,keylist,count,sumDict,2)
示例#10
0
def writeDataToSheet1(wb,rlist,sumDict):
    date = DateUtil.get_day_of_day(-1)
    yesterday = date.strftime("%Y-%m-%d")

    sheet = wb.add_sheet("宽广集团销售日报表",cell_overwrite_ok=True)

    titles = [[("宽广集团销售日报表",2,1,13)],
              [("数据日期:",0,1,2),(yesterday,2,1,1),("单位:元",4,1,1)],
              [("机构编码",0,2,1),("机构名称",1,2,1),("POS销售数据",3,1,9),("批发销售数据",4,1,4)],
              [("总客流量",2,1,1),("平均客单价",3,1,1),("销售金额",4,1,1),("折扣金额",5,1,1),("实际销售",6,1,1),("销售成本",7,1,1),
               ("毛利",8,1,1),("毛利率",9,1,1),("优惠占比",10,1,1),("实际销售",11,1,1),("销售成本",12,1,1),("毛利",13,1,1),("毛利率",14,1,1)],
            ]

    keylist = ['shopid','shopnm','tradenumber','tradeprice','salevalue','discvalue','sale','costvalue',
               'salegain','gaintx','yhzhanbi','wsalevalue','wcostvalue','wsalegain',
               'wgaintx']

    widthList = [600,400,1000,800,400,800,800,800,800,800,800,800,800,800,800]

    mtu.insertTitle2(sheet,titles,keylist,widthList)
    count = mtu.insertCell2(sheet,4,rlist,keylist,None)
    mtu.insertSum2(sheet,keylist,count,sumDict,2)
示例#11
0
def writeDataToSheet2(wb, listShops, listShopTotal, listDept):
    date = DateUtil.get_day_of_day(-1)
    year = date.year
    month = date.month

    titlesSheetShop = [[("(%s月)零库存课组明细日报" % month, 0, 1, 7)],
                       [("报表日期", 3, 1, 1),
                        ("%s年-%s月-%s日" % (year, month, date.day), 4, 1, 3)],
                       [("门店编号", 0, 1, 1), ("门店名称", 1, 1, 1),
                        ("课组编码", 2, 1, 1), ("课组名称", 3, 1, 1),
                        ("课组汇总", 4, 1, 1), ("零库存数", 3, 1, 1), ("占比", 3, 1, 1)]]
    titlesSheetLast = [[("(%s月)零库存课组汇总日报" % month, 0, 1, 5)],
                       [("报表日期", 2, 1, 1),
                        ("%s年-%s月-%s日" % (year, month, date.day), 3, 1, 2)],
                       [("课组编码", 0, 1, 1), ("课组名称", 1, 1, 1),
                        ("课组汇总", 2, 1, 1), ("零库存数", 3, 1, 1), ("占比", 4, 1, 1)]]
    keylistSheet2 = [
        'ShopID', 'shopname', 'deptid', 'deptidname', 'qtyz', 'qtyl', 'zhonbi'
    ]
    keylistSheet3 = ['deptid', 'deptidname', 'qtyz', 'qtyl', 'zhonbi']
    widthList = [600, 1100, 600, 600, 600, 600]
    sheets = []
    for i in range(0, len(listShops)):
        sheets.append(
            wb.add_sheet(listShops[i][0]['shopname'], cell_overwrite_ok=True))
    sheets.append(wb.add_sheet("(月)零库存课组汇总日报", cell_overwrite_ok=True))
    for j in range(0, len(sheets) - 1):
        mtu.insertTitle2(sheets[j], titlesSheetShop, keylistSheet2, widthList)
        mtu.insertCell2(sheets[j], 3, listShops[j - 2], keylistSheet2, None)
        titlesLen = len(titlesSheetShop)
        listShopsLen = len(listShops)
        totalDict = {'dict': listShopTotal[j - 2]}
        mtu.insertSum2(sheets[j], keylistSheet2, titlesLen + listShopsLen,
                       totalDict, 2)

    mtu.insertTitle2(sheets[len(sheets) - 1], titlesSheetLast, keylistSheet3,
                     widthList)
    mtu.insertCell2(sheets[len(sheets) - 1], 3, listDept, keylistSheet3, None)
示例#12
0
文件: views.py 项目: KGPython/scm
def writeDataToSheet1(wb,code,tbody, thead,total):

    sheet = wb.add_sheet("往来单据额调整单明细",cell_overwrite_ok=True)

    titles = [
        [("往来单据额调整单明细",0,1,8)],
        [("单位:承德宽广",5,1,3)],
        [("单号:" + code,0,1,2), ("审核日期:" + thead['chdate'].strftime('%Y-%m-%d'),2,1,3), ("生成日期:" + thead['edate'].strftime('%Y-%m-%d'),5,1,3)],
        [("门店:" + thead['shopname'],0,1,2), ("供应商代码:" + thead['spercode'],2,1,3),("供应商名称:" + thead['spername'],5,1,3)],
        [("供应商编码",0,1,1),("批次号",1,1,1),("商品条码",2,1,1),('品名',3,1,1),('调整数量',4,1,1),('原含税单价',5,1,1),('新含税单价',6,1,1),('含税调整金额',7,1,1)]
    ]

    keylist = ['adbatchseq','pcode','barcode','pname','anum','cprice_notax','dqhsjj','sum4']

    widthList = [1000,1000,1000,2500,1000,1000,1000,1000]


    #日销售报表
    mtu.insertTitle2(sheet,titles,keylist,widthList)
    mtu.insertCell2(sheet,6,tbody,keylist,None)
    titlesLen = len(titles)
    listTopLen = len(tbody)
    mtu.insertSum2(sheet,keylist,titlesLen+listTopLen+1,total,4)