Subversion Repositories SmartDukaan

Rev

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

Rev 11977 Rev 19412
Line 44... Line 44...
44
 
44
 
45
    date_style = xlwt.XFStyle()
45
    date_style = xlwt.XFStyle()
46
    date_style.num_format_str = "M/D/YY"
46
    date_style.num_format_str = "M/D/YY"
47
    
47
    
48
    sheet.write(0, 0, "Order ID", heading_xf)
48
    sheet.write(0, 0, "Order ID", heading_xf)
-
 
49
    sheet.write(0, 1, "Transaction ID", heading_xf)
49
    sheet.write(0, 1, "Source", heading_xf)
50
    sheet.write(0, 2, "Source", heading_xf)
50
    sheet.write(0, 2, "Mode.", heading_xf)
51
    sheet.write(0, 3, "Mode.", heading_xf)
51
    sheet.write(0, 3, "Brand", heading_xf)
52
    sheet.write(0, 4, "Brand", heading_xf)
52
    sheet.write(0, 4, "Model Name", heading_xf)
53
    sheet.write(0, 5, "Model Name", heading_xf)
53
    sheet.write(0, 5, "Model Number", heading_xf)
54
    sheet.write(0, 6, "Model Number", heading_xf)
54
    sheet.write(0, 6, "Colour", heading_xf)
55
    sheet.write(0, 7, "Colour", heading_xf)
-
 
56
    sheet.write(0, 8, "Quantity", heading_xf)
55
    sheet.write(0, 7, "Creation Date", heading_xf)
57
    sheet.write(0, 9, "Creation Date", heading_xf)
56
    sheet.write(0, 8, "Promised Shipping Date", heading_xf)
58
    sheet.write(0, 10, "Promised Shipping Date", heading_xf)
57
    sheet.write(0, 9, "Expected Shipping Date", heading_xf)
59
    sheet.write(0, 11, "Expected Shipping Date", heading_xf)
58
    sheet.write(0, 10, "Delay Reason", heading_xf)
60
    sheet.write(0, 12, "Delay Reason", heading_xf)
59
    sheet.write(0, 11, "Detailed Reason Text", heading_xf)    
61
    sheet.write(0, 13, "Detailed Reason Text", heading_xf)    
60
    
62
 
61
    html = """\
63
    html = """\
62
    <html>
64
    <html>
63
        <head>
65
        <head>
64
            <style type="text/css">
66
            <style type="text/css">
65
                table, tr, th { border :1px solid black;}
67
                table, tr, th { border :1px solid black;}
Line 68... Line 70...
68
        <body>
70
        <body>
69
            <center><h3>Delayed Orders</h3></center>
71
            <center><h3>Delayed Orders</h3></center>
70
            <table>
72
            <table>
71
                <tr>
73
                <tr>
72
                    <th>Order ID</th>
74
                    <th>Order ID</th>
-
 
75
                    <th>Txn Id</th>
73
                    <th>Source</th>
76
                    <th>Source</th>
74
                    <th>Mode</th>
77
                    <th>Mode</th>
75
                    <th>Brand</th>
78
                    <th>Brand</th>
76
                    <th>Model Name</th>
79
                    <th>Model Name</th>
77
                    <th>Model Number</th>
80
                    <th>Model Number</th>
78
                    <th>Colour</th>
81
                    <th>Colour</th>
-
 
82
                    <th>Quantity</th>
79
                    <th>Creation Date</th>
83
                    <th>Creation Date</th>
80
                    <th>Promised Shipping Date</th>
84
                    <th>Promised Shipping Date</th>
81
                    <th>Expected Shipping Date</th>
85
                    <th>Expected Shipping Date</th>
82
                    <th>Delay Reason</th>
86
                    <th>Delay Reason</th>
83
                    <th>Detailed Reason Text</th>
87
                    <th>Detailed Reason Text</th>
Line 105... Line 109...
105
        if order.source ==8 and order.status == OrderStatus.BILLED:
109
        if order.source ==8 and order.status == OrderStatus.BILLED:
106
            continue            
110
            continue            
107
        html +="<tr>"
111
        html +="<tr>"
108
        sheet.write(i, 0, order.id)
112
        sheet.write(i, 0, order.id)
109
        html +="<td>" + str(order.id) + "</td>" 
113
        html +="<td>" + str(order.id) + "</td>" 
-
 
114
        sheet.write(i, 1, order.transaction_id)
-
 
115
        html +="<td>" + str(order.transaction_id) + "</td>" 
110
        sheet.write(i, 1, source[order.source])
116
        sheet.write(i, 2, source[order.source])
111
        html +="<td>" + str(source[order.source]) + "</td>"
117
        html +="<td>" + str(source[order.source]) + "</td>"
112
        sheet.write(i, 2, mode[order.cod])
118
        sheet.write(i, 3, mode[order.cod])
113
        html +="<td>" + str(mode[order.cod]) + "</td>"
119
        html +="<td>" + str(mode[order.cod]) + "</td>"
114
        lineitem = order.lineitems[0]
120
        lineitem = order.lineitems[0]
115
        sheet.write(i, 3, lineitem.brand)
121
        sheet.write(i, 4, lineitem.brand)
116
        html +="<td>" + str(lineitem.brand) + "</td>"
122
        html +="<td>" + str(lineitem.brand) + "</td>"
117
        sheet.write(i, 4, lineitem.model_name)
123
        sheet.write(i, 5, lineitem.model_name)
118
        html +="<td>" + str(lineitem.model_name) + "</td>"
124
        html +="<td>" + str(lineitem.model_name) + "</td>"
119
        sheet.write(i, 5, lineitem.model_number)
125
        sheet.write(i, 6, lineitem.model_number)
120
        html +="<td>" + str(lineitem.model_number) + "</td>"
126
        html +="<td>" + str(lineitem.model_number) + "</td>"
121
        sheet.write(i, 6, lineitem.color)
127
        sheet.write(i, 7, lineitem.color)
122
        html +="<td>" + str(lineitem.color) + "</td>"
128
        html +="<td>" + str(lineitem.color) + "</td>"
-
 
129
        sheet.write(i, 8, lineitem.quantity)
-
 
130
        html +="<td>" + str(lineitem.quantity) + "</td>"
123
        sheet.write(i, 7, to_py_date(order.created_timestamp), date_style)
131
        sheet.write(i, 9, to_py_date(order.created_timestamp), date_style)
124
        html +="<td>" + str(to_py_date(order.created_timestamp)) + "</td>"
132
        html +="<td>" + str(to_py_date(order.created_timestamp)) + "</td>"
125
        sheet.write(i, 8, to_py_date(order.promised_shipping_time), date_style)
133
        sheet.write(i, 10, to_py_date(order.promised_shipping_time), date_style)
126
        html +="<td>" + str(to_py_date(order.promised_shipping_time)) + "</td>"
134
        html +="<td>" + str(to_py_date(order.promised_shipping_time)) + "</td>"
127
        sheet.write(i, 9, to_py_date(order.expected_shipping_time), date_style)
135
        sheet.write(i, 11, to_py_date(order.expected_shipping_time), date_style)
128
        html +="<td>" + str(to_py_date(order.expected_shipping_time)) + "</td>"
136
        html +="<td>" + str(to_py_date(order.expected_shipping_time)) + "</td>"
129
        if order.delayReason:
137
        if order.delayReason:
130
            sheet.write(i, 10, DelayReason._VALUES_TO_NAMES[order.delayReason])
138
            sheet.write(i, 12, DelayReason._VALUES_TO_NAMES[order.delayReason])
131
            html +="<td>" + str(DelayReason._VALUES_TO_NAMES[order.delayReason]) + "</td>"
139
            html +="<td>" + str(DelayReason._VALUES_TO_NAMES[order.delayReason]) + "</td>"
132
        sheet.write(i, 11, order.delayReasonText)
140
        sheet.write(i, 13, order.delayReasonText)
133
        html +="<td>" + str(order.delayReasonText) + "</td>"
141
        html +="<td>" + str(order.delayReasonText) + "</td>"
134
        html +="</tr>"
142
        html +="</tr>"
135
        i= i+1
143
        i= i+1
136
    
144
    
137
    today = datetime.date.today()
145
    today = datetime.date.today()