Subversion Repositories SmartDukaan

Rev

Rev 17199 | Rev 17244 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17199 Rev 17234
Line 55... Line 55...
55
datetime_format = xlwt.XFStyle()
55
datetime_format = xlwt.XFStyle()
56
datetime_format.num_format_str = 'dd/mm/yyyy HH:MM AM/PM'
56
datetime_format.num_format_str = 'dd/mm/yyyy HH:MM AM/PM'
57
categoryMap = {3:"Mobiles", 5:"Tablets"}
57
categoryMap = {3:"Mobiles", 5:"Tablets"}
58
 
58
 
59
curDate = date.today()
59
curDate = date.today()
60
cutOffMonth = (datetime.now().month + 10)%12
60
cutOffMonth = (datetime.now().month + 11)%12
61
cutOffYear = curDate.year - (0 if curDate.month-2 > 0 else 1)
61
cutOffYear = curDate.year - (0 if curDate.month-1 > 0 else 1)
62
cutOff = datetime(cutOffYear, cutOffMonth, 1)
62
cutOff = datetime(cutOffYear, cutOffMonth, 1)
63
 
63
 
64
 
64
 
65
def generateFlipkartReco():
65
def generateFlipkartReco():
66
    global i
66
    global i
67
    i = -1
67
    i = -1
68
    curs = getOrdersAfterDate(datetime.now() - timedelta(days=30), 2)
68
    curs = getOrdersAfterDate(cutOff, 2)
69
    db = client.Dtr
69
    db = client.Dtr
70
    wb = xlwt.Workbook()
70
    wb = xlwt.Workbook()
71
    #rb = open_workbook(XLS_F_FILENAME)
71
    #rb = open_workbook(XLS_F_FILENAME)
72
    #wb = copy(rb)
72
    #wb = copy(rb)
73
    #wb = xlwt.Workbook()
73
    #wb = xlwt.Workbook()
Line 302... Line 302...
302
                for aff in affs:
302
                for aff in affs:
303
                    if subOrder['productTitle']==aff['productCode']:
303
                    if subOrder['productTitle']==aff['productCode']:
304
                        worksheet.write(row, inc(), utils.fromTimeStamp(aff['saleDate']),datetime_format)
304
                        worksheet.write(row, inc(), utils.fromTimeStamp(aff['saleDate']),datetime_format)
305
                        worksheet.write(row, inc(), aff['unitPrice'])
305
                        worksheet.write(row, inc(), aff['unitPrice'])
306
                        worksheet.write(row, inc(), 0 if not aff.get('payOut') else aff['payOut']/aff.get('quantity'))
306
                        worksheet.write(row, inc(), 0 if not aff.get('payOut') else aff['payOut']/aff.get('quantity'))
-
 
307
                        worksheet.write(row, inc(), aff.get('status'))
-
 
308
                        subOrder['affStatus'] = aff.get('status')
307
                        matched=True
309
                        matched=True
308
                        break
310
                        break
309
                if not matched:
311
                if not matched:
310
                    inc()
312
                    inc()
311
                    inc()
313
                    inc()
312
                    inc()
314
                    inc()
-
 
315
                    inc()
313
                worksheet.write(row, inc(), subOrder['productTitle'])
316
                worksheet.write(row, inc(), subOrder['productTitle'])
314
                worksheet.write(row, inc(), subOrder['amountPaid'])
317
                worksheet.write(row, inc(), subOrder['amountPaid'])
315
                worksheet.write(row, inc(), subOrder['quantity'])
318
                worksheet.write(row, inc(), subOrder['quantity'])
316
                worksheet.write(row, inc(), subOrder['status'])
319
                worksheet.write(row, inc(), subOrder['status'])
317
                worksheet.write(row, inc(), subOrder['cashBackStatus'])
320
                worksheet.write(row, inc(), subOrder['cashBackStatus'])
Line 807... Line 810...
807
    worksheet.write(row, inc(), 'Dtr Sale Date', boldStyle)
810
    worksheet.write(row, inc(), 'Dtr Sale Date', boldStyle)
808
    worksheet.write(row, inc(), 'Sale Amount', boldStyle)
811
    worksheet.write(row, inc(), 'Sale Amount', boldStyle)
809
    worksheet.write(row, inc(), 'Aff Sale Date', boldStyle)
812
    worksheet.write(row, inc(), 'Aff Sale Date', boldStyle)
810
    worksheet.write(row, inc(), 'Aff Sale Amt', boldStyle)
813
    worksheet.write(row, inc(), 'Aff Sale Amt', boldStyle)
811
    worksheet.write(row, inc(), 'Aff PayOut', boldStyle)
814
    worksheet.write(row, inc(), 'Aff PayOut', boldStyle)
-
 
815
    worksheet.write(row, inc(), 'Aff Status', boldStyle)
812
    worksheet.write(row, inc(), 'Product Title', boldStyle)
816
    worksheet.write(row, inc(), 'Product Title', boldStyle)
813
    worksheet.write(row, inc(), 'Price', boldStyle)
817
    worksheet.write(row, inc(), 'Price', boldStyle)
814
    worksheet.write(row, inc(), 'Quantity', boldStyle)
818
    worksheet.write(row, inc(), 'Quantity', boldStyle)
815
    worksheet.write(row, inc(), 'Status', boldStyle)
819
    worksheet.write(row, inc(), 'Status', boldStyle)
816
    worksheet.write(row, inc(), 'Cashback Status', boldStyle)
820
    worksheet.write(row, inc(), 'Cashback Status', boldStyle)
Line 908... Line 912...
908
    sh1.write(row, inc(), 'State', boldStyle)
912
    sh1.write(row, inc(), 'State', boldStyle)
909
    sh1.write(row, inc(), 'Pincode', boldStyle)
913
    sh1.write(row, inc(), 'Pincode', boldStyle)
910
    sh1.write(row, inc(), 'SubOrder Id', boldStyle)
914
    sh1.write(row, inc(), 'SubOrder Id', boldStyle)
911
    sh1.write(row, inc(), 'Cashback Status', boldStyle)
915
    sh1.write(row, inc(), 'Cashback Status', boldStyle)
912
    sh1.write(row, inc(), 'Cashback Amount', boldStyle)
916
    sh1.write(row, inc(), 'Cashback Amount', boldStyle)
-
 
917
    sh1.write(row, inc(), 'Quantity', boldStyle)
-
 
918
    sh1.write(row, inc(), 'Reconciled', boldStyle)
-
 
919
    sh1.write(row, inc(), 'Aff Status', boldStyle)
913
    i =-1
920
    i =-1
914
    sh2.write(row, inc(), 'User Id', boldStyle)
921
    sh2.write(row, inc(), 'User Id', boldStyle)
915
    sh2.write(row, inc(), 'User name', boldStyle)
922
    sh2.write(row, inc(), 'User name', boldStyle)
916
    sh2.write(row, inc(), 'Created On', boldStyle)
923
    sh2.write(row, inc(), 'Created On', boldStyle)
917
    sh2.write(row, inc(), 'Store', boldStyle)
924
    sh2.write(row, inc(), 'Store', boldStyle)