Subversion Repositories SmartDukaan

Rev

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

Rev 1246 Rev 1263
Line 86... Line 86...
86
    workbook = xlrd.open_workbook(filename)
86
    workbook = xlrd.open_workbook(filename)
87
    sheet = workbook.sheet_by_index(0)
87
    sheet = workbook.sheet_by_index(0)
88
    num_rows = sheet.nrows
88
    num_rows = sheet.nrows
89
    picked_up_orders = {}
89
    picked_up_orders = {}
90
    for rownum in range(1, num_rows):
90
    for rownum in range(1, num_rows):
91
        unused_customer_code, awb, date, time = sheet.row_values(rownum)[0:4]
91
        unused_customer_code, awb, timeval, date = sheet.row_values(rownum)[0:4]
92
        picked_up_orders[awb] = str(get_py_datetime(date, time))
92
        picked_up_orders[awb] = str(get_py_datetime(date, timeval))
93
    
93
    
94
    print "Picked up Orders:"
94
    print "Picked up Orders:"
95
    print picked_up_orders
95
    print picked_up_orders
96
    return picked_up_orders
96
    return picked_up_orders
97
 
97
 
Line 163... Line 163...
163
 
163
 
164
def todays_date_string():
164
def todays_date_string():
165
    today_date = time.strftime("%d-%b-%Y")
165
    today_date = time.strftime("%d-%b-%Y")
166
    return '"' + today_date + '"'
166
    return '"' + today_date + '"'
167
 
167
 
168
def get_py_datetime(date, time):
168
def get_py_datetime(date, timeval):
169
    # This should be a command line argument.
169
    # This should be a command line argument.
170
    # Refer http://docs.python.org/library/time.html#time.strftime to
170
    # Refer http://docs.python.org/library/time.html#time.strftime to
171
    # get a complete list of format specifiers available for date time.
171
    # get a complete list of format specifiers available for date time.
172
    time_format = "%d-%b-%y %H%M"
172
    time_format = "%d-%b-%y %H%M"
173
    time_string = date + " " + time
173
    time_string = date + " " + timeval
174
    mytime = time.strptime(time_string, time_format)
174
    mytime = time.strptime(time_string, time_format)
175
    return datetime.datetime(*mytime[:6])
175
    return datetime.datetime(*mytime[:6])
176
 
176
 
177
def main():
177
def main():
178
    parser = optparse.OptionParser()
178
    parser = optparse.OptionParser()