Subversion Repositories SmartDukaan

Rev

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

Rev 7427 Rev 7428
Line 522... Line 522...
522
            
522
            
523
 
523
 
524
def enqueue_transaction_info_email(transaction_id):
524
def enqueue_transaction_info_email(transaction_id):
525
    transaction = get_transaction(transaction_id)
525
    transaction = get_transaction(transaction_id)
526
    subject = source_name + " - Order Details"
526
    subject = source_name + " - Order Details"
-
 
527
    orders = transaction.orders
-
 
528
    advance_amount = orders[0].advanceAmount
-
 
529
    saddress = ""
-
 
530
    if advance_amount  > 0:
-
 
531
        saddress += " at" + __get_hotspot_store_address_html(get_hotspot_store(orders[0].storeId, ""))
527
    otgLink = ""
532
    otgLink = ""
528
    inOrderOtg = "<div>On Time Guarantee<br><span style=color:red>We pay if we delay</span></div>"
533
    inOrderOtg = "<div>On Time Guarantee<br><span style=color:red>We pay if we delay</span></div>"
529
    if len(transaction.orders) == 1:
534
    if len(transaction.orders) == 1:
530
        inOrderOtg = ""
535
        inOrderOtg = ""
531
        if transaction.orders[0].otg :
536
        if transaction.orders[0].otg :
Line 537... Line 542...
537
<html>
542
<html>
538
<body>
543
<body>
539
<div>
544
<div>
540
    <p>
545
    <p>
541
        Hello $customer_name,<br /><br />
546
        Hello $customer_name,<br /><br />
542
        Thanks for placing order with us.$otgLink Following are the details of your order:
547
        Thanks for placing order with us $saddress .$otgLink Following are the details of your order:
543
    </p>
548
    </p>
544
    <div>
549
    <div>
545
        Order Date: $order_date
550
        Order Date: $order_date
546
    </div>
551
    </div>
547
    <div>
552
    <div>
Line 561... Line 566...
561
    user_email = ""
566
    user_email = ""
562
    total_amount = 0.0
567
    total_amount = 0.0
563
    html_table = ""
568
    html_table = ""
564
    order_date = datetime.datetime.now()
569
    order_date = datetime.datetime.now()
565
 
570
 
566
    orders = transaction.orders
-
 
567
    html_pickup_text = ""
571
    html_pickup_text = ""
568
    random_text = ""
572
    random_text = ""
569
    if orders[0].pickupStoreId:
573
    if orders[0].pickupStoreId:
570
        random_text = str(randrange(100000, 999999)) 
574
        random_text = str(randrange(100000, 999999)) 
571
    
575
    
Line 626... Line 630...
626
        total_amount += emi_amount
630
        total_amount += emi_amount
627
        html_footer = html_footer + "<tr>\
631
        html_footer = html_footer + "<tr>\
628
                        <td colspan=5>EMI Processing Charges</td>\
632
                        <td colspan=5>EMI Processing Charges</td>\
629
                        <td> Rs. $emi_amount</td>\
633
                        <td> Rs. $emi_amount</td>\
630
                    </tr>"
634
                    </tr>"
-
 
635
    
-
 
636
    if advance_amount > 0:
-
 
637
        total_amount -= advance_amount
-
 
638
        html_footer = html_footer + "<tr>\
-
 
639
                        <td colspan=5>Advance Paid</td>\
-
 
640
                        <td> Rs. $advance_amount</td>\
-
 
641
                    </tr>"
631
                
642
                
632
    html_footer = html_footer + "<tr>\
643
    html_footer = html_footer + "<tr>\
633
                <td colspan=5>Total Amount</td>\
644
                <td colspan=5>Total Amount</td>\
634
                <td> Rs. $total_amount</td>\
645
                <td> Rs. $total_amount</td>\
635
                </tr>\
646
                </tr>\
Line 663... Line 674...
663
            <br>
674
            <br>
664
            In case you have any questions please visit <a href="$source_url/static/buy-online-and-pickup-in-store">Details on Pickup in Store</a>. If you still have more questions feel free to contact us 24/7 via <a href="$source_url/contact-us">$source_url/contact-us</a>
675
            In case you have any questions please visit <a href="$source_url/static/buy-online-and-pickup-in-store">Details on Pickup in Store</a>. If you still have more questions feel free to contact us 24/7 via <a href="$source_url/contact-us">$source_url/contact-us</a>
665
            </br><hr />
676
            </br><hr />
666
            """
677
            """
667
            
678
            
-
 
679
    html_store_cust_address = ""
-
 
680
    if advance_amount > 0:
-
 
681
        html_store_cust_address += "Your order shall be delivered at " + __get_order_address_html(orders[0]) 
668
    html_footer = html_footer + html_pickup_text + """
682
    html_footer = html_footer + html_pickup_text + html_store_cust_address + """
669
    <p>
683
    <p>
670
        Best Wishes,<br />
684
        Best Wishes,<br />
671
        $source_name Team
685
        $source_name Team
672
    </p>
686
    </p>
673
</div>
687
</div>
Line 679... Line 693...
679
    formated_order_date = dt.strftime("%A, %d. %B %Y %I:%M%p")
693
    formated_order_date = dt.strftime("%A, %d. %B %Y %I:%M%p")
680
 
694
 
681
    sdt = datetime.datetime.strptime(str(orders[0].expected_delivery_time), "%Y-%m-%d %H:%M:%S")
695
    sdt = datetime.datetime.strptime(str(orders[0].expected_delivery_time), "%Y-%m-%d %H:%M:%S")
682
    store_delivery_date = sdt.strftime("%A, %d %B %Y")
696
    store_delivery_date = sdt.strftime("%A, %d %B %Y")
683
 
697
 
684
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, source_url = source_url, otgLink = otgLink))
698
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, source_url = source_url, otgLink = otgLink, saddress = saddress))
685
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, emi_amount = "%.2f" % emi_amount, net_amount = "%.2f" % (total_amount-order.gvAmount), secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date, source_url = source_url, source_name = source_name))
699
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, emi_amount = "%.2f" % emi_amount, advance_amount = "%.2f" % advance_amount, net_amount = "%.2f" % (total_amount-order.gvAmount), secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date, source_url = source_url, source_name = source_name))
686
    
700
    
687
    try:
701
    try:
688
        helper_client = HelperClient().get_client()
702
        helper_client = HelperClient().get_client()
689
        helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], [])
703
        helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], [])
690
         
704
         
Line 2745... Line 2759...
2745
    address = address + order.customer_state + "\n"
2759
    address = address + order.customer_state + "\n"
2746
    address = address + "PIN " + order.customer_pincode + "\n"
2760
    address = address + "PIN " + order.customer_pincode + "\n"
2747
    address = address + "Phone: " + order.customer_mobilenumber
2761
    address = address + "Phone: " + order.customer_mobilenumber
2748
    return address
2762
    return address
2749
 
2763
 
-
 
2764
def __get_order_address_html(order):
-
 
2765
    address = order.customer_name + "<br>" + order.customer_address1 + "<br>"
-
 
2766
    if order.customer_address2:
-
 
2767
        address = address + order.customer_address2 + "<br>"
-
 
2768
    address = address + order.customer_city + "<br>"
-
 
2769
    address = address + order.customer_state + "<br>"
-
 
2770
    address = address + "PIN " + order.customer_pincode + "<br>"
-
 
2771
    address = address + "Phone: " + order.customer_mobilenumber
-
 
2772
    return address
-
 
2773
 
2750
def __get_store_address(store):
2774
def __get_store_address(store):
2751
    address = store.name + "\n" + store.line1 + "\n"
2775
    address = store.name + "\n" + store.line1 + "\n"
2752
    if store.line2:
2776
    if store.line2:
2753
        address = address + store.line2 + "\n"
2777
        address = address + store.line2 + "\n"
2754
    address = address + store.city + "\n"
2778
    address = address + store.city + "\n"
Line 2769... Line 2793...
2769
    if store.phone:
2793
    if store.phone:
2770
        address = address + "Phone - " + store.phone + "<br>"
2794
        address = address + "Phone - " + store.phone + "<br>"
2771
    address = address +  "Store timings - 7 days: 11AM to 8PM  (7 days)<br>"
2795
    address = address +  "Store timings - 7 days: 11AM to 8PM  (7 days)<br>"
2772
    return address
2796
    return address
2773
 
2797
 
-
 
2798
def __get_hotspot_store_address_html(store):
-
 
2799
    address = store.name + "<br>" + store.line1 + "<br>"
-
 
2800
    if store.line2:
-
 
2801
        address = address + store.line2 + "<br>"
-
 
2802
    address = address + store.city + "<br>"
-
 
2803
    address = address + store.state + "<br>"
-
 
2804
    address = address + "PIN - " + store.pin + "<br>"
-
 
2805
    if store.phone:
-
 
2806
        address = address + "Phone - " + store.phone + "<br>"
-
 
2807
    return address
-
 
2808
 
2774
def __generate_return_advice(order, warehouse, provider, filename):
2809
def __generate_return_advice(order, warehouse, provider, filename):
2775
    if warehouse.id == 7:
2810
    if warehouse.id == 7:
2776
        executive = 'Shiv Kumar'
2811
        executive = 'Shiv Kumar'
2777
    else:
2812
    else:
2778
        executive = 'Dinesh Kumar'
2813
        executive = 'Dinesh Kumar'