| Line 5257... |
Line 5257... |
| 5257 |
return orders
|
5257 |
return orders
|
| 5258 |
|
5258 |
|
| 5259 |
def get_store_order_advance_invoice(orderId, storeId):
|
5259 |
def get_store_order_advance_invoice(orderId, storeId):
|
| 5260 |
order = Order.get_by(id = orderId)
|
5260 |
order = Order.get_by(id = orderId)
|
| 5261 |
storeOrderDetail = StoreOrderDetail.query.filter(StoreOrderDetail.orderId == orderId).filter(StoreOrderDetail.storeId == storeId).first()
|
5261 |
storeOrderDetail = StoreOrderDetail.query.filter(StoreOrderDetail.orderId == orderId).filter(StoreOrderDetail.storeId == storeId).first()
|
| - |
|
5262 |
store = HotspotStore.get_by(id = storeId)
|
| 5262 |
|
5263 |
|
| 5263 |
modelName = " "
|
5264 |
modelName = " "
|
| 5264 |
modelNumber = " "
|
5265 |
modelNumber = " "
|
| 5265 |
color = " "
|
5266 |
color = " "
|
| 5266 |
if order.lineitems[0].model_name:
|
5267 |
if order.lineitems[0].model_name:
|
| Line 5287... |
Line 5288... |
| 5287 |
|
5288 |
|
| 5288 |
if order.status in (15, 34) and (storeOrderDetail.cashRefundAmount > 0 or storeOrderDetail.cashRefundAmount > 0):
|
5289 |
if order.status in (15, 34) and (storeOrderDetail.cashRefundAmount > 0 or storeOrderDetail.cashRefundAmount > 0):
|
| 5289 |
filename = "/tmp/order-refund-" + str(order.id) + ".pdf"
|
5290 |
filename = "/tmp/order-refund-" + str(order.id) + ".pdf"
|
| 5290 |
inCash = storeOrderDetail.cashRefundAmount
|
5291 |
inCash = storeOrderDetail.cashRefundAmount
|
| 5291 |
byCard = storeOrderDetail.cardRefundAmount
|
5292 |
byCard = storeOrderDetail.cardRefundAmount
|
| 5292 |
return __printStoreOrderCancellationReceipt(order.id, filename, customerName, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin, product, advanceAmount,inCash, byCard, order.created_timestamp.date())
|
5293 |
return __printStoreOrderCancellationReceipt(store, order.id, filename, customerName, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin, product, advanceAmount,inCash, byCard, order.created_timestamp.date(), order.refund_timestamp.date())
|
| 5293 |
else:
|
5294 |
else:
|
| 5294 |
filename = "/tmp/order-" + str(order.id) + ".pdf"
|
5295 |
filename = "/tmp/order-" + str(order.id) + ".pdf"
|
| 5295 |
#payMethod = recharge.payMethod
|
5296 |
#payMethod = recharge.payMethod
|
| 5296 |
# if order.status == 15 or order.status == 34:
|
5297 |
# if order.status == 15 or order.status == 34:
|
| 5297 |
# return __printStoreOrderAdvanceInvoice(filename, product, advanceAmount, totalAmount, customerName, delivery, mode, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin)
|
5298 |
# return __printStoreOrderAdvanceInvoice(filename, product, advanceAmount, totalAmount, customerName, delivery, mode, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin)
|
| 5298 |
return __printStoreOrderAdvanceInvoice(order.id, filename, product, advanceAmount, totalAmount, customerName, delivery, inCash, byCard, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin)
|
5299 |
return __printStoreOrderAdvanceInvoice(store, order.id, filename, product, advanceAmount, totalAmount, customerName, delivery, inCash, byCard, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin)
|
| 5299 |
|
5300 |
|
| 5300 |
def __printStoreOrderCancellationReceipt(orderId, filename, customerName, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin, product, advanceAmount,inCash, byCard, createdDate):
|
5301 |
def __printStoreOrderCancellationReceipt(store, orderId, filename, customerName, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin, product, advanceAmount,inCash, byCard, createdDate, cancelDate):
|
| 5301 |
PAGE_HEIGHT=defaultPageSize[1];
|
5302 |
PAGE_HEIGHT=defaultPageSize[1];
|
| 5302 |
styles = getSampleStyleSheet()
|
5303 |
styles = getSampleStyleSheet()
|
| 5303 |
styles.add(ParagraphStyle(name='prologue', alignment=TA_CENTER, fontName="Courier", rightIndent = 5, fontSize=10), alias='sH')
|
5304 |
styles.add(ParagraphStyle(name='prologue', alignment=TA_CENTER, fontName="Courier", rightIndent = 5, fontSize=10), alias='sH')
|
| 5304 |
styles.add(ParagraphStyle(name='text', alignment=TA_JUSTIFY, fontName="Courier", fontSize=10), alias='text')
|
5305 |
styles.add(ParagraphStyle(name='text', alignment=TA_JUSTIFY, fontName="Courier", fontSize=10), alias='text')
|
| 5305 |
styles.add(ParagraphStyle(name='line', alignment=TA_CENTER, fontName="Courier", fontSize=10), alias='line')
|
5306 |
styles.add(ParagraphStyle(name='line', alignment=TA_CENTER, fontName="Courier", fontSize=10), alias='line')
|
| Line 5315... |
Line 5316... |
| 5315 |
|
5316 |
|
| 5316 |
#Two Columns
|
5317 |
#Two Columns
|
| 5317 |
frame1 = Frame(58, doc.bottomMargin, doc.width/2 + 25, doc.height + 7, id='col1')
|
5318 |
frame1 = Frame(58, doc.bottomMargin, doc.width/2 + 25, doc.height + 7, id='col1')
|
| 5318 |
|
5319 |
|
| 5319 |
|
5320 |
|
| 5320 |
############### TODO ###############################################################
|
- |
|
| 5321 |
Story.append(Paragraph("""Spice Retail Limited<br></br>
|
5321 |
Story.append(Paragraph(store.line1, prologueStyle))
|
| 5322 |
C/O,PIBCO LIMITED,Basement,Punjsons<br></br>
|
- |
|
| 5323 |
2,Kalkaji Industrial Area,New Delhi<br></br>
|
5322 |
Story.append(Paragraph(store.line2 + ', ' + store.city, prologueStyle))
|
| 5324 |
.<br></br>""", prologueStyle))
|
5323 |
Story.append(Paragraph(store.state + ' - ' + store.pin, prologueStyle))
|
| 5325 |
############### ADDRESS TO BE DYNAMIC ##############################################
|
- |
|
| 5326 |
|
5324 |
|
| 5327 |
drawLine(Story, lineStyle)
|
5325 |
drawLine(Story, lineStyle)
|
| 5328 |
|
5326 |
|
| 5329 |
Story.append(Paragraph("{0:^39s}".format("*** ADVANCE CANCELLATION RECEIPT ***").replace(" ", " "), textStyle))
|
5327 |
Story.append(Paragraph("{0:^39s}".format("*** ADVANCE CANCELLATION RECEIPT ***").replace(" ", " "), textStyle))
|
| 5330 |
|
5328 |
|
| Line 5332... |
Line 5330... |
| 5332 |
|
5330 |
|
| 5333 |
Story.append(Paragraph("{0:<6s}{1:<34s}".format("NAME:", customerName).replace(" ", " "), textStyle))
|
5331 |
Story.append(Paragraph("{0:<6s}{1:<34s}".format("NAME:", customerName).replace(" ", " "), textStyle))
|
| 5334 |
Story.append(Paragraph("{0:<10s}{1:<29s}".format("MOBILE:", customerMobile).replace(" ", " "), textStyle))
|
5332 |
Story.append(Paragraph("{0:<10s}{1:<29s}".format("MOBILE:", customerMobile).replace(" ", " "), textStyle))
|
| 5335 |
Story.append(Paragraph("{0:<10s}{1:<29s}".format("ORDER ID:", str(orderId)).replace(" ", " "), textStyle))
|
5333 |
Story.append(Paragraph("{0:<10s}{1:<29s}".format("ORDER ID:", str(orderId)).replace(" ", " "), textStyle))
|
| 5336 |
Story.append(Paragraph("{0:<20s}{1: %d/%m/%Y}".format("ORDER DATE:", createdDate).replace(" ", " "), textStyle))
|
5334 |
Story.append(Paragraph("{0:<20s}{1: %d/%m/%Y}".format("ORDER DATE:", createdDate).replace(" ", " "), textStyle))
|
| - |
|
5335 |
Story.append(Paragraph("{0:<20s}{1: %d/%m/%Y}".format("CANCELLATION DATE:", cancelDate).replace(" ", " "), textStyle))
|
| 5337 |
Story.append(Paragraph("{0:<20s}{1: %d/%m/%Y}".format("CANCEL DATE:", datetime.datetime.now().date()).replace(" ", " "), textStyle))
|
5336 |
Story.append(Paragraph("{0:<20s}{1: %d/%m/%Y}".format("CURRENT DATE:", datetime.datetime.now().date()).replace(" ", " "), textStyle))
|
| 5338 |
|
5337 |
|
| 5339 |
drawLine(Story, lineStyle)
|
5338 |
drawLine(Story, lineStyle)
|
| 5340 |
|
5339 |
|
| 5341 |
Story.append(Paragraph("{0:^39s}".format("DELIVERY ADDRESS").replace(" ", " "), textStyle))
|
5340 |
Story.append(Paragraph("{0:^39s}".format("DELIVERY ADDRESS").replace(" ", " "), textStyle))
|
| 5342 |
|
5341 |
|
| Line 5396... |
Line 5395... |
| 5396 |
return pdfFile
|
5395 |
return pdfFile
|
| 5397 |
|
5396 |
|
| 5398 |
|
5397 |
|
| 5399 |
|
5398 |
|
| 5400 |
|
5399 |
|
| 5401 |
def __printStoreOrderAdvanceInvoice(orderId, filename, product, advanceAmount, totalAmount, customerName, delivery, inCash, byCard, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin):
|
5400 |
def __printStoreOrderAdvanceInvoice(store, orderId, filename, product, advanceAmount, totalAmount, customerName, delivery, inCash, byCard, customerAdd1, customerAdd2, customerCity, customerState, customerMobile, customerPin):
|
| 5402 |
PAGE_HEIGHT=defaultPageSize[1];
|
5401 |
PAGE_HEIGHT=defaultPageSize[1];
|
| 5403 |
styles = getSampleStyleSheet()
|
5402 |
styles = getSampleStyleSheet()
|
| 5404 |
styles.add(ParagraphStyle(name='prologue', alignment=TA_CENTER, fontName="Courier", rightIndent = 5, fontSize=10), alias='sH')
|
5403 |
styles.add(ParagraphStyle(name='prologue', alignment=TA_CENTER, fontName="Courier", rightIndent = 5, fontSize=10), alias='sH')
|
| 5405 |
styles.add(ParagraphStyle(name='text', alignment=TA_JUSTIFY, fontName="Courier", fontSize=10), alias='text')
|
5404 |
styles.add(ParagraphStyle(name='text', alignment=TA_JUSTIFY, fontName="Courier", fontSize=10), alias='text')
|
| 5406 |
styles.add(ParagraphStyle(name='line', alignment=TA_CENTER, fontName="Courier", fontSize=10), alias='line')
|
5405 |
styles.add(ParagraphStyle(name='line', alignment=TA_CENTER, fontName="Courier", fontSize=10), alias='line')
|
| Line 5416... |
Line 5415... |
| 5416 |
|
5415 |
|
| 5417 |
#Two Columns
|
5416 |
#Two Columns
|
| 5418 |
frame1 = Frame(58, doc.bottomMargin, doc.width/2 + 25, doc.height + 7, id='col1')
|
5417 |
frame1 = Frame(58, doc.bottomMargin, doc.width/2 + 25, doc.height + 7, id='col1')
|
| 5419 |
|
5418 |
|
| 5420 |
|
5419 |
|
| 5421 |
############### TODO ###############################################################
|
- |
|
| 5422 |
Story.append(Paragraph("""Spice Retail Limited<br></br>
|
5420 |
Story.append(Paragraph(store.line1, prologueStyle))
|
| 5423 |
C/O,PIBCO LIMITED,Basement,Punjsons<br></br>
|
- |
|
| 5424 |
2,Kalkaji Industrial Area,New Delhi<br></br>
|
5421 |
Story.append(Paragraph(store.line2 + ', ' + store.city, prologueStyle))
|
| 5425 |
.<br></br>""", prologueStyle))
|
5422 |
Story.append(Paragraph(store.state + ' - ' + store.pin, prologueStyle))
|
| 5426 |
############### ADDRESS TO BE DYNAMIC ##############################################
|
- |
|
| - |
|
5423 |
|
| 5427 |
|
5424 |
|
| 5428 |
drawLine(Story, lineStyle)
|
5425 |
drawLine(Story, lineStyle)
|
| 5429 |
Story.append(Paragraph("{0:^39s}".format("*** ADVANCE RECEIPT ***").replace(" ", " "), textStyle))
|
5426 |
Story.append(Paragraph("{0:^39s}".format("*** ADVANCE RECEIPT ***").replace(" ", " "), textStyle))
|
| 5430 |
drawLine(Story, lineStyle)
|
5427 |
drawLine(Story, lineStyle)
|
| 5431 |
|
5428 |
|