| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import in.shop2020.config.ConfigException;
|
3 |
import in.shop2020.config.ConfigException;
|
| 4 |
import in.shop2020.logistics.DeliveryType;
|
4 |
import in.shop2020.logistics.DeliveryType;
|
| 5 |
import in.shop2020.logistics.LogisticsServiceException;
|
5 |
import in.shop2020.logistics.LogisticsServiceException;
|
| 6 |
import in.shop2020.logistics.PickUpType;
|
6 |
import in.shop2020.logistics.PickUpType;
|
| - |
|
7 |
import in.shop2020.logistics.PickupStore;
|
| 7 |
import in.shop2020.logistics.Provider;
|
8 |
import in.shop2020.logistics.Provider;
|
| 8 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
9 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
| 9 |
import in.shop2020.model.v1.catalog.Warehouse;
|
10 |
import in.shop2020.model.v1.catalog.Warehouse;
|
| 10 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
11 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
| 11 |
import in.shop2020.model.v1.order.Attribute;
|
12 |
import in.shop2020.model.v1.order.Attribute;
|
| Line 109... |
Line 110... |
| 109 |
|
110 |
|
| 110 |
private TransactionClient tsc = null;
|
111 |
private TransactionClient tsc = null;
|
| 111 |
private CatalogClient csc = null;
|
112 |
private CatalogClient csc = null;
|
| 112 |
private LogisticsClient lsc = null;
|
113 |
private LogisticsClient lsc = null;
|
| 113 |
|
114 |
|
| 114 |
private static final long SELF_PICKUP = 4;
|
- |
|
| 115 |
private static Locale indianLocale = new Locale("en", "IN");
|
115 |
private static Locale indianLocale = new Locale("en", "IN");
|
| 116 |
private DecimalFormat amountFormat = new DecimalFormat("#,##0.00");
|
116 |
private DecimalFormat amountFormat = new DecimalFormat("#,##0.00");
|
| 117 |
|
117 |
|
| 118 |
private static final Font helvetica8 = FontFactory.getFont(FontFactory.HELVETICA, 8);
|
118 |
private static final Font helvetica8 = FontFactory.getFont(FontFactory.HELVETICA, 8);
|
| 119 |
private static final Font helvetica10 = FontFactory.getFont(FontFactory.HELVETICA, 10);
|
119 |
private static final Font helvetica10 = FontFactory.getFont(FontFactory.HELVETICA, 10);
|
| Line 269... |
Line 269... |
| 269 |
PdfPTable logoTable = new PdfPTable(2);
|
269 |
PdfPTable logoTable = new PdfPTable(2);
|
| 270 |
logoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
270 |
logoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 271 |
logoTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
|
271 |
logoTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
|
| 272 |
logoTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
|
272 |
logoTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
|
| 273 |
logoTable.addCell(getLogoCell());
|
273 |
logoTable.addCell(getLogoCell());
|
| 274 |
if(order.isCod())
|
274 |
if(order.isLogisticsCod())
|
| 275 |
logoTable.addCell(new Phrase("COD ", helvetica28));
|
275 |
logoTable.addCell(new Phrase("COD ", helvetica28));
|
| 276 |
else
|
276 |
else
|
| 277 |
logoTable.addCell(new Phrase(" ", helvetica28));
|
277 |
logoTable.addCell(new Phrase(" ", helvetica28));
|
| 278 |
PdfPCell titleCell = getTitleCell();
|
278 |
PdfPCell titleCell = getTitleCell();
|
| 279 |
PdfPTable customerTable = getCustomerAddressTable(order, destCode, false, helvetica12);
|
279 |
PdfPTable customerTable = getCustomerAddressTable(order, destCode, false, helvetica12, false);
|
| 280 |
PdfPTable providerInfoTable = getProviderTable(order, provider, barCodeFont);
|
280 |
PdfPTable providerInfoTable = getProviderTable(order, provider, barCodeFont);
|
| 281 |
|
281 |
|
| 282 |
PdfPTable dispatchTable = new PdfPTable(new float[]{0.5f, 0.1f, 0.4f});
|
282 |
PdfPTable dispatchTable = new PdfPTable(new float[]{0.5f, 0.1f, 0.4f});
|
| 283 |
dispatchTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
283 |
dispatchTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 284 |
dispatchTable.addCell(customerTable);
|
284 |
dispatchTable.addCell(customerTable);
|
| Line 299... |
Line 299... |
| 299 |
addressCell = getAddressCell(warehouse.getLocation() + "\nPIN " + warehouse.getPincode() + "\n\n");
|
299 |
addressCell = getAddressCell(warehouse.getLocation() + "\nPIN " + warehouse.getPincode() + "\n\n");
|
| 300 |
|
300 |
|
| 301 |
PdfPTable chargesTable = new PdfPTable(1);
|
301 |
PdfPTable chargesTable = new PdfPTable(1);
|
| 302 |
chargesTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
302 |
chargesTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 303 |
chargesTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
|
303 |
chargesTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
|
| 304 |
if(order.isCod()){
|
304 |
if(order.isLogisticsCod()){
|
| 305 |
chargesTable.addCell(new Phrase("AMOUNT TO BE COLLECTED : Rs " + order.getTotal_amount(), helveticaBold12));
|
305 |
chargesTable.addCell(new Phrase("AMOUNT TO BE COLLECTED : Rs " + order.getTotal_amount(), helveticaBold12));
|
| 306 |
chargesTable.addCell(new Phrase("RTO ADDRESS:DEL/ITG-111117"));
|
306 |
chargesTable.addCell(new Phrase("RTO ADDRESS:DEL/ITG-111117"));
|
| 307 |
} else {
|
307 |
} else {
|
| 308 |
chargesTable.addCell(new Phrase("Do not pay any extra charges to the Courier."));
|
308 |
chargesTable.addCell(new Phrase("Do not pay any extra charges to the Courier."));
|
| 309 |
}
|
309 |
}
|
| Line 363... |
Line 363... |
| 363 |
awbNumberCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
363 |
awbNumberCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
| 364 |
awbNumberCell.setBorder(Rectangle.NO_BORDER);
|
364 |
awbNumberCell.setBorder(Rectangle.NO_BORDER);
|
| 365 |
|
365 |
|
| 366 |
providerInfoTable.addCell(providerNameCell);
|
366 |
providerInfoTable.addCell(providerNameCell);
|
| 367 |
providerInfoTable.addCell(awbNumberCell);
|
367 |
providerInfoTable.addCell(awbNumberCell);
|
| 368 |
if(order.isCod())
|
368 |
if(order.isLogisticsCod())
|
| 369 |
providerInfoTable.addCell(new Phrase("Account No : " + provider.getDetails().get(DeliveryType.COD).getAccountNo(), helvetica8));
|
369 |
providerInfoTable.addCell(new Phrase("Account No : " + provider.getDetails().get(DeliveryType.COD).getAccountNo(), helvetica8));
|
| 370 |
else
|
370 |
else
|
| 371 |
providerInfoTable.addCell(new Phrase("Account No : " + provider.getDetails().get(DeliveryType.PREPAID).getAccountNo(), helvetica8));
|
371 |
providerInfoTable.addCell(new Phrase("Account No : " + provider.getDetails().get(DeliveryType.PREPAID).getAccountNo(), helvetica8));
|
| 372 |
providerInfoTable.addCell(new Phrase("AWB Date : " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date()), helvetica8));
|
372 |
providerInfoTable.addCell(new Phrase("AWB Date : " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date()), helvetica8));
|
| 373 |
providerInfoTable.addCell(new Phrase("Weight : " + order.getTotal_weight() + " Kg", helvetica8));
|
373 |
providerInfoTable.addCell(new Phrase("Weight : " + order.getTotal_weight() + " Kg", helvetica8));
|
| Line 402... |
Line 402... |
| 402 |
|
402 |
|
| 403 |
private void populateTopInvoiceTable(Order order, PdfPTable invoiceTable) {
|
403 |
private void populateTopInvoiceTable(Order order, PdfPTable invoiceTable) {
|
| 404 |
List<LineItem> lineitems = order.getLineitems();
|
404 |
List<LineItem> lineitems = order.getLineitems();
|
| 405 |
for (LineItem lineitem : lineitems) {
|
405 |
for (LineItem lineitem : lineitems) {
|
| 406 |
invoiceTable.addCell(new Phrase(order.getId() + "", helvetica8));
|
406 |
invoiceTable.addCell(new Phrase(order.getId() + "", helvetica8));
|
| 407 |
if(order.isCod())
|
407 |
if(order.isLogisticsCod())
|
| 408 |
invoiceTable.addCell(new Phrase("COD", helvetica8));
|
408 |
invoiceTable.addCell(new Phrase("COD", helvetica8));
|
| 409 |
else
|
409 |
else
|
| 410 |
invoiceTable.addCell(new Phrase("Prepaid", helvetica8));
|
410 |
invoiceTable.addCell(new Phrase("Prepaid", helvetica8));
|
| 411 |
|
411 |
|
| 412 |
invoiceTable.addCell(getProductNameCell(lineitem, false));
|
412 |
invoiceTable.addCell(getProductNameCell(lineitem, false));
|
| Line 446... |
Line 446... |
| 446 |
Paragraph sorlAddress = new Paragraph(ourAddress + "TIN NO. " + tinNo, new Font(FontFamily.TIMES_ROMAN, 8f, Element.ALIGN_CENTER));
|
446 |
Paragraph sorlAddress = new Paragraph(ourAddress + "TIN NO. " + tinNo, new Font(FontFamily.TIMES_ROMAN, 8f, Element.ALIGN_CENTER));
|
| 447 |
PdfPCell sorlAddressCell = new PdfPCell(sorlAddress);
|
447 |
PdfPCell sorlAddressCell = new PdfPCell(sorlAddress);
|
| 448 |
sorlAddressCell.addElement(sorlAddress);
|
448 |
sorlAddressCell.addElement(sorlAddress);
|
| 449 |
sorlAddressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
449 |
sorlAddressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
| 450 |
|
450 |
|
| 451 |
PdfPTable customerAddress = getCustomerAddressTable(order, null, true, helvetica8);
|
451 |
PdfPTable customerAddress = getCustomerAddressTable(order, null, true, helvetica8, true);
|
| 452 |
PdfPTable orderDetails = getOrderDetails(order, provider);
|
452 |
PdfPTable orderDetails = getOrderDetails(order, provider);
|
| 453 |
|
453 |
|
| 454 |
PdfPTable addrAndOrderDetailsTable = new PdfPTable(new float[]{0.5f, 0.1f, 0.4f});
|
454 |
PdfPTable addrAndOrderDetailsTable = new PdfPTable(new float[]{0.5f, 0.1f, 0.4f});
|
| 455 |
addrAndOrderDetailsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
455 |
addrAndOrderDetailsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 456 |
addrAndOrderDetailsTable.addCell(customerAddress);
|
456 |
addrAndOrderDetailsTable.addCell(customerAddress);
|
| Line 471... |
Line 471... |
| 471 |
taxTable.addCell(disclaimerCell);
|
471 |
taxTable.addCell(disclaimerCell);
|
| 472 |
|
472 |
|
| 473 |
return taxTable;
|
473 |
return taxTable;
|
| 474 |
}
|
474 |
}
|
| 475 |
|
475 |
|
| 476 |
private PdfPTable getCustomerAddressTable(Order order, String destCode, boolean showPaymentMode, Font font){
|
476 |
private PdfPTable getCustomerAddressTable(Order order, String destCode, boolean showPaymentMode, Font font, boolean forInvoce){
|
| 477 |
PdfPTable customerTable = new PdfPTable(1);
|
477 |
PdfPTable customerTable = new PdfPTable(1);
|
| 478 |
customerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
478 |
customerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| - |
|
479 |
if(forInvoce || order.getPickupStoreId() == 0){
|
| 479 |
customerTable.addCell(new Phrase(order.getCustomer_name(), font));
|
480 |
customerTable.addCell(new Phrase(order.getCustomer_name(), font));
|
| 480 |
customerTable.addCell(new Phrase(order.getCustomer_address1(), font));
|
481 |
customerTable.addCell(new Phrase(order.getCustomer_address1(), font));
|
| 481 |
customerTable.addCell(new Phrase(order.getCustomer_address2(), font));
|
482 |
customerTable.addCell(new Phrase(order.getCustomer_address2(), font));
|
| 482 |
customerTable.addCell(new Phrase(order.getCustomer_city() + "," + order.getCustomer_state(), font));
|
483 |
customerTable.addCell(new Phrase(order.getCustomer_city() + "," + order.getCustomer_state(), font));
|
| 483 |
if(destCode != null)
|
484 |
if(destCode != null)
|
| 484 |
customerTable.addCell(new Phrase(order.getCustomer_pincode() + " - " + destCode, helvetica16));
|
485 |
customerTable.addCell(new Phrase(order.getCustomer_pincode() + " - " + destCode, helvetica16));
|
| 485 |
else
|
486 |
else
|
| 486 |
customerTable.addCell(new Phrase(order.getCustomer_pincode(), font));
|
487 |
customerTable.addCell(new Phrase(order.getCustomer_pincode(), font));
|
| 487 |
customerTable.addCell(new Phrase("Phone :" + order.getCustomer_mobilenumber(), font));
|
488 |
customerTable.addCell(new Phrase("Phone :" + order.getCustomer_mobilenumber(), font));
|
| - |
|
489 |
}else{
|
| - |
|
490 |
try {
|
| - |
|
491 |
in.shop2020.logistics.LogisticsService.Client lclient = (new LogisticsClient()).getClient();
|
| - |
|
492 |
PickupStore store = lclient.getPickupStore(order.getPickupStoreId());
|
| - |
|
493 |
customerTable.addCell(new Phrase(store.getName(), font));
|
| - |
|
494 |
customerTable.addCell(new Phrase(store.getLine1(), font));
|
| - |
|
495 |
customerTable.addCell(new Phrase(store.getLine2(), font));
|
| - |
|
496 |
customerTable.addCell(new Phrase(store.getCity() + "," + store.getState(), font));
|
| - |
|
497 |
if(destCode != null)
|
| - |
|
498 |
customerTable.addCell(new Phrase(store.getPin() + " - " + destCode, helvetica16));
|
| - |
|
499 |
else
|
| - |
|
500 |
customerTable.addCell(new Phrase(store.getPin(), font));
|
| - |
|
501 |
customerTable.addCell(new Phrase("Phone :" + store.getPhone(), font));
|
| - |
|
502 |
} catch (TException e) {
|
| - |
|
503 |
// TODO Auto-generated catch block
|
| - |
|
504 |
e.printStackTrace();
|
| - |
|
505 |
}
|
| - |
|
506 |
|
| - |
|
507 |
}
|
| - |
|
508 |
|
| 488 |
if(order.getOrderType().equals(OrderType.B2B)) {
|
509 |
if(order.getOrderType().equals(OrderType.B2B)) {
|
| 489 |
String tin = null;
|
510 |
String tin = null;
|
| 490 |
in.shop2020.model.v1.order.TransactionService.Client tclient = tsc.getClient();
|
511 |
in.shop2020.model.v1.order.TransactionService.Client tclient = tsc.getClient();
|
| 491 |
List<Attribute> attributes;
|
512 |
List<Attribute> attributes;
|
| 492 |
try {
|
513 |
try {
|