Subversion Repositories SmartDukaan

Rev

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

Rev 4938 Rev 4966
Line 1041... Line 1041...
1041
        Delivery Address:
1041
        Delivery Address:
1042
 
1042
 
1043
        %(warehouse_executive)s
1043
        %(warehouse_executive)s
1044
        %(warehouse_address)s
1044
        %(warehouse_address)s
1045
        PIN %(warehouse_pin)s
1045
        PIN %(warehouse_pin)s
1046
        Phone: %(warehouse_phone)s
-
 
1047
        
1046
        
1048
        Thanks and Regards
1047
        Thanks and Regards
1049
        Sandeep Sachdeva
1048
        Sandeep Sachdeva
1050
        '''
1049
        '''
1051
        
1050
        
1052
        if warehouse.id == 7:
1051
        if warehouse.id == 7:
1053
            executive = 'Amit Kumar'
1052
            executive = 'Amit Kumar'
1054
            executive_phone = '9911122634'
-
 
1055
        else:
1053
        else:
1056
            executive = 'Prashant Sharma'
1054
            executive = 'Dinesh Kumar'
1057
            executive_phone = '8826894193'
-
 
1058
        
-
 
1059
        
1055
        
1060
        message = dedent(raw_message) % { 'customer_city' : order.customer_city,
1056
        message = dedent(raw_message) % { 'customer_city' : order.customer_city,
1061
                                          'provider_code' : provider.details[DeliveryType.PREPAID].accountNo,
1057
                                          'provider_code' : provider.details[DeliveryType.PREPAID].accountNo,
1062
                                          'order_weight' : str(order.total_weight),
1058
                                          'order_weight' : str(order.total_weight),
1063
                                          'customer_address' : __get_order_address(order),
1059
                                          'customer_address' : __get_order_address(order),
1064
                                          'warehouse_executive' : executive,
1060
                                          'warehouse_executive' : executive,
1065
                                          'warehouse_address' : warehouse.location,
1061
                                          'warehouse_address' : warehouse.location,
1066
                                          'warehouse_pin' : warehouse.pincode,
1062
                                          'warehouse_pin' : warehouse.pincode}
1067
                                          'warehouse_phone': executive_phone}
-
 
1068
        #FIXME Email is hardcoded for bluedart
1063
        #FIXME Email is hardcoded for bluedart
1069
        if providerId == 1:
1064
        if providerId == 1:
1070
            to_addresses = [to_addr, 'sonikap@bluedart.com']
1065
            to_addresses = [to_addr, 'sonikap@bluedart.com']
1071
        else:
1066
        else:
1072
            to_addresses = [to_addr]
1067
            to_addresses = [to_addr]
1073
            
1068
        
1074
        mail(from_user, from_pwd, to_addresses, subject, message)
1069
        mail(from_user, from_pwd, to_addresses, subject, message)
1075
        if order.status == OrderStatus.RET_REQUEST_AUTHORIZED:
1070
        if order.status == OrderStatus.RET_REQUEST_AUTHORIZED:
1076
            order.status = OrderStatus.RET_PICKUP_REQUEST_RAISED
1071
            order.status = OrderStatus.RET_PICKUP_REQUEST_RAISED
1077
            order.statusDescription = "Pick up requested for RETURN"
1072
            order.statusDescription = "Pick up requested for RETURN"
1078
        else:
1073
        else:
Line 1664... Line 1659...
1664
    return address
1659
    return address
1665
 
1660
 
1666
def __generate_return_advice(order, warehouse, provider, filename):
1661
def __generate_return_advice(order, warehouse, provider, filename):
1667
    if warehouse.id == 7:
1662
    if warehouse.id == 7:
1668
        executive = 'Amit Kumar'
1663
        executive = 'Amit Kumar'
1669
        executive_phone = 'Phone: 9911122634'
-
 
1670
    else:
1664
    else:
1671
        executive = 'Prashant Sharma'
1665
        executive = 'Dinesh Kumar'
1672
        executive_phone = 'Phone: 8826894193'
-
 
1673
    pdf = Canvas(filename)
1666
    pdf = Canvas(filename)
1674
    pdf.setFont('Times-Bold',16)
1667
    pdf.setFont('Times-Bold',16)
1675
    address_text = pdf.beginText(inch, PAGE_HEIGHT - inch)
1668
    address_text = pdf.beginText(inch, PAGE_HEIGHT - inch)
1676
    address_text.textLine("To")
1669
    address_text.textLine("To")
1677
    address_text.textLine(executive)
1670
    address_text.textLine(executive)
1678
    for line in warehouse.location.split("\n"):
1671
    for line in warehouse.location.split("\n"):
1679
        address_text.textLine(line)
1672
        address_text.textLine(line)
1680
    address_text.textLine("PIN " + warehouse.pincode)
1673
    address_text.textLine("PIN " + warehouse.pincode)
1681
    address_text.textLine("")
-
 
1682
    address_text.textLine(executive_phone)
-
 
1683
    pdf.drawText(address_text)
1674
    pdf.drawText(address_text)
1684
    
1675
    
1685
    pdf.setFont('Times-Roman',12)
1676
    pdf.setFont('Times-Roman',12)
1686
    order_text = pdf.beginText(inch, PAGE_HEIGHT - 4 * inch)
1677
    order_text = pdf.beginText(inch, PAGE_HEIGHT - 4 * inch)
1687
    order_text.textLine("Pickup CODE: " + provider.details[DeliveryType.PREPAID].accountNo)
1678
    order_text.textLine("Pickup CODE: " + provider.details[DeliveryType.PREPAID].accountNo)