| Line 4... |
Line 4... |
| 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.PickupStore;
|
| 8 |
import in.shop2020.logistics.Provider;
|
8 |
import in.shop2020.logistics.Provider;
|
| - |
|
9 |
import in.shop2020.model.v1.inventory.BillingType;
|
| 9 |
import in.shop2020.model.v1.inventory.InventoryServiceException;
|
10 |
import in.shop2020.model.v1.inventory.InventoryServiceException;
|
| 10 |
import in.shop2020.model.v1.inventory.Warehouse;
|
11 |
import in.shop2020.model.v1.inventory.Warehouse;
|
| 11 |
import in.shop2020.model.v1.order.Attribute;
|
12 |
import in.shop2020.model.v1.order.Attribute;
|
| 12 |
import in.shop2020.model.v1.order.LineItem;
|
13 |
import in.shop2020.model.v1.order.LineItem;
|
| 13 |
import in.shop2020.model.v1.order.Order;
|
14 |
import in.shop2020.model.v1.order.Order;
|
| Line 213... |
Line 214... |
| 213 |
} catch (TException te) {
|
214 |
} catch (TException te) {
|
| 214 |
logger.error("Error while getting some essential information from the services", te);
|
215 |
logger.error("Error while getting some essential information from the services", te);
|
| 215 |
return baosPDF;
|
216 |
return baosPDF;
|
| 216 |
}
|
217 |
}
|
| 217 |
|
218 |
|
| - |
|
219 |
if(printAll && warehouse.getBillingType() == BillingType.OURS_EXTERNAL){
|
| - |
|
220 |
document.add(getExtraInfoTable(order, provider, 16, warehouse.getBillingType()));
|
| - |
|
221 |
continue;
|
| - |
|
222 |
}
|
| - |
|
223 |
|
| 218 |
PdfPTable dispatchAdviceTable = getDispatchAdviceTable(order, warehouse, provider, barcodeFontSize, destCode, withBill);
|
224 |
PdfPTable dispatchAdviceTable = getDispatchAdviceTable(order, warehouse, provider, barcodeFontSize, destCode, withBill);
|
| 219 |
dispatchAdviceTable.setSpacingAfter(10.0f);
|
225 |
dispatchAdviceTable.setSpacingAfter(10.0f);
|
| 220 |
dispatchAdviceTable.setWidthPercentage(90.0f);
|
226 |
dispatchAdviceTable.setWidthPercentage(90.0f);
|
| 221 |
|
227 |
|
| 222 |
document.add(dispatchAdviceTable);
|
228 |
document.add(dispatchAdviceTable);
|
| Line 225... |
Line 231... |
| 225 |
taxTable.setSpacingBefore(5.0f);
|
231 |
taxTable.setSpacingBefore(5.0f);
|
| 226 |
taxTable.setWidthPercentage(90.0f);
|
232 |
taxTable.setWidthPercentage(90.0f);
|
| 227 |
document.add(new DottedLineSeparator());
|
233 |
document.add(new DottedLineSeparator());
|
| 228 |
document.add(taxTable);
|
234 |
document.add(taxTable);
|
| 229 |
}else{
|
235 |
}else{
|
| 230 |
PdfPTable extraInfoTable = getExtraInfoTable(order, provider, 16);
|
236 |
PdfPTable extraInfoTable = getExtraInfoTable(order, provider, 16, warehouse.getBillingType());
|
| 231 |
extraInfoTable.setSpacingBefore(5.0f);
|
237 |
extraInfoTable.setSpacingBefore(5.0f);
|
| 232 |
extraInfoTable.setWidthPercentage(90.0f);
|
238 |
extraInfoTable.setWidthPercentage(90.0f);
|
| 233 |
document.add(new DottedLineSeparator());
|
239 |
document.add(new DottedLineSeparator());
|
| 234 |
document.add(extraInfoTable);
|
240 |
document.add(extraInfoTable);
|
| 235 |
}
|
241 |
}
|
| Line 613... |
Line 619... |
| 613 |
invoiceTableHeader.setColspan(colspan);
|
619 |
invoiceTableHeader.setColspan(colspan);
|
| 614 |
invoiceTableHeader.setPaddingTop(10);
|
620 |
invoiceTableHeader.setPaddingTop(10);
|
| 615 |
return invoiceTableHeader;
|
621 |
return invoiceTableHeader;
|
| 616 |
}
|
622 |
}
|
| 617 |
|
623 |
|
| 618 |
private double getTaxRate(double orderAmount) {
|
- |
|
| 619 |
double rate;
|
- |
|
| 620 |
if(orderAmount < salesTaxCutOff){
|
- |
|
| 621 |
rate = salesTaxLowRate;
|
- |
|
| 622 |
} else {
|
- |
|
| 623 |
rate = salesTaxHighRate;
|
- |
|
| 624 |
}
|
- |
|
| 625 |
return rate;
|
- |
|
| 626 |
}
|
- |
|
| 627 |
|
- |
|
| 628 |
private void populateBottomInvoiceTable(Order order, PdfPTable invoiceTable, double rate) {
|
624 |
private void populateBottomInvoiceTable(Order order, PdfPTable invoiceTable, double rate) {
|
| 629 |
for (LineItem lineitem : order.getLineitems()) {
|
625 |
for (LineItem lineitem : order.getLineitems()) {
|
| 630 |
invoiceTable.addCell(new Phrase("" + order.getId() , helvetica8));
|
626 |
invoiceTable.addCell(new Phrase("" + order.getId() , helvetica8));
|
| 631 |
|
627 |
|
| 632 |
invoiceTable.addCell(getProductNameCell(lineitem, true));
|
628 |
invoiceTable.addCell(getProductNameCell(lineitem, true));
|
| Line 751... |
Line 747... |
| 751 |
eoeCell.setColspan(colspan);
|
747 |
eoeCell.setColspan(colspan);
|
| 752 |
eoeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
748 |
eoeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
| 753 |
return eoeCell;
|
749 |
return eoeCell;
|
| 754 |
}
|
750 |
}
|
| 755 |
|
751 |
|
| 756 |
private PdfPTable getExtraInfoTable(Order order, Provider provider, float barcodeFontSize){
|
752 |
private PdfPTable getExtraInfoTable(Order order, Provider provider, float barcodeFontSize, BillingType billingType){
|
| 757 |
PdfPTable extraInfoTable = new PdfPTable(1);
|
753 |
PdfPTable extraInfoTable = new PdfPTable(1);
|
| 758 |
extraInfoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
754 |
extraInfoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 759 |
extraInfoTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
|
755 |
extraInfoTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
|
| 760 |
|
756 |
|
| 761 |
String fontPath = InvoiceGenerationService.class.getResource("/saholic-wn.TTF").getPath();
|
757 |
String fontPath = InvoiceGenerationService.class.getResource("/saholic-wn.TTF").getPath();
|
| 762 |
FontFactoryImp ttfFontFactory = new FontFactoryImp();
|
758 |
FontFactoryImp ttfFontFactory = new FontFactoryImp();
|
| 763 |
ttfFontFactory.register(fontPath, "barcode");
|
759 |
ttfFontFactory.register(fontPath, "barcode");
|
| 764 |
Font barCodeFont = ttfFontFactory.getFont("barcode", BaseFont.CP1252, true, barcodeFontSize);
|
760 |
Font barCodeFont = ttfFontFactory.getFont("barcode", BaseFont.CP1252, true, barcodeFontSize);
|
| 765 |
|
761 |
|
| - |
|
762 |
PdfPCell extraInfoCell;
|
| - |
|
763 |
if(billingType == BillingType.EXTERNAL){
|
| 766 |
PdfPCell extraInfoCell = new PdfPCell(new Paragraph( "*" + order.getId() + "* *" + order.getCustomer_name() + "* *" + order.getTotal_amount() + "*", barCodeFont));
|
764 |
extraInfoCell = new PdfPCell(new Paragraph( "*" + order.getId() + "* *" + order.getCustomer_name() + "* *" + order.getTotal_amount() + "*", barCodeFont));
|
| - |
|
765 |
}else{
|
| - |
|
766 |
extraInfoCell = new PdfPCell(new Paragraph( "*" + order.getId() + "* *" + "Spice Online Retail Pvt Ltd" + "* *" + order.getLineitems().get(0).getTransfer_price() + "*", barCodeFont));
|
| - |
|
767 |
}
|
| - |
|
768 |
|
| 767 |
extraInfoCell.setPaddingTop(20.0f);
|
769 |
extraInfoCell.setPaddingTop(20.0f);
|
| 768 |
extraInfoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
770 |
extraInfoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
| 769 |
extraInfoCell.setBorder(Rectangle.NO_BORDER);
|
771 |
extraInfoCell.setBorder(Rectangle.NO_BORDER);
|
| 770 |
|
772 |
|
| 771 |
extraInfoTable.addCell(extraInfoCell);
|
773 |
extraInfoTable.addCell(extraInfoCell);
|