Subversion Repositories SmartDukaan

Rev

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

Rev 1976 Rev 2050
Line 219... Line 219...
219
        <table>
219
        <table>
220
        <tr><td colspan="5"><hr /></td></tr>
220
        <tr><td colspan="5"><hr /></td></tr>
221
        <tr><td colspan="5" align="left"><b>Order Details</b></td></tr>
221
        <tr><td colspan="5" align="left"><b>Order Details</b></td></tr>
222
        <tr><td colspan="5"><hr /></td></tr>
222
        <tr><td colspan="5"><hr /></td></tr>
223
        <tr>
223
        <tr>
224
            <th>&nbsp;&nbsp;Order No.&nbsp;&nbsp;</th>
224
            <th width="100">Order No.</th>
225
            <th>&nbsp;&nbsp;Product&nbsp;&nbsp;</th>
225
            <th>Product</th>
226
            <th>&nbsp;&nbsp;Quantity&nbsp;&nbsp;</th>
226
            <th width="100">Quantity</th>
227
            <th>&nbsp;&nbsp;Unit Price&nbsp;&nbsp;</th>
227
            <th width="100">Unit Price</th>
228
            <th>&nbsp;&nbsp;Amount&nbsp;&nbsp;</th>
228
            <th width="100">Amount</th>
229
        </tr>
229
        </tr>
230
    """
230
    """
231
    user_email = ""
231
    user_email = ""
232
    total_amount = 0.0
232
    total_amount = 0.0
233
    html_table = ""
233
    html_table = ""
Line 237... Line 237...
237
        order_date = order.created_timestamp
237
        order_date = order.created_timestamp
238
        user_email = order.customer_email
238
        user_email = order.customer_email
239
        html_tr = "<tr><td align='center'>" + str(order.id) + "</td>"
239
        html_tr = "<tr><td align='center'>" + str(order.id) + "</td>"
240
        
240
        
241
        for lineitem in order.lineitems:
241
        for lineitem in order.lineitems:
-
 
242
            lineitem_total_price = round(lineitem.total_price, 2)
-
 
243
            
242
            html_tr += "<td>" + str(lineitem) + "</td>"
244
            html_tr += "<td>" + str(lineitem) + "</td>"
243
            html_tr += "<td align='center'>" + str(lineitem.quantity) + "</td>"
245
            html_tr += "<td align='center'>" + ("%.0f" % lineitem.quantity) + "</td>"
244
            html_tr += "<td align='center'>" + str(lineitem.unit_price) + "</td>"
246
            html_tr += "<td align='center'> Rs. " + ("%.2f" % lineitem.unit_price) + "</td>"
245
            html_tr += "<td align='center'>" + str(lineitem.total_price) + "</td></tr>"
247
            html_tr += "<td align='center'> Rs. " + ("%.2f" % lineitem_total_price) + "</td></tr>"
246
            total_amount += lineitem.total_price
248
            total_amount += lineitem_total_price
247
            html_table += html_tr
249
            html_table += html_tr
-
 
250
    
248
    html_footer = """
251
    html_footer = """
249
        <tr><td colspan=5>&nbsp;</td></tr>
252
        <tr><td colspan=5>&nbsp;</td></tr>
250
        <tr><td colspan=5><hr /></td></tr>
253
        <tr><td colspan=5><hr /></td></tr>
251
        <tr>
254
        <tr>
252
            <td colspan=4>Total Amount</td>
255
            <td colspan=4>Total Amount</td>
253
            <td>$total_amount</td>
256
            <td> Rs. $total_amount</td>
254
        </tr>
257
        </tr>
255
        <tr><td colspan=5><hr /></td></tr>
258
        <tr><td colspan=5><hr /></td></tr>
256
        </table>
259
        </table>
257
    </div>
260
    </div>
258
    <p>
261
    <p>
Line 266... Line 269...
266
 
269
 
267
    dt = datetime.datetime.strptime(str(order_date), "%Y-%m-%d %H:%M:%S")
270
    dt = datetime.datetime.strptime(str(order_date), "%Y-%m-%d %H:%M:%S")
268
    formated_order_date = dt.strftime("%A, %d. %B %Y %I:%M%p")
271
    formated_order_date = dt.strftime("%A, %d. %B %Y %I:%M%p")
269
    
272
    
270
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date))
273
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date))
271
    email_footer = Template(html_footer).substitute(dict(total_amount = total_amount))
274
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount))
272
    
275
    
273
    try:
276
    try:
274
        helper_client = HelperClient().get_client()
277
        helper_client = HelperClient().get_client()
275
        helper_client.saveUserEmailForSending(user_email, "", "Saholic - Order Details", email_header + html_table + email_footer, str(transaction_id), "TransactionInfo")
278
        helper_client.saveUserEmailForSending(user_email, "", "Saholic - Order Details", email_header + html_table + email_footer, str(transaction_id), "TransactionInfo")
276
        return True
279
        return True