| Line 154... |
Line 154... |
| 154 |
|
154 |
|
| 155 |
try {
|
155 |
try {
|
| 156 |
baosPDF = new ByteArrayOutputStream();
|
156 |
baosPDF = new ByteArrayOutputStream();
|
| 157 |
|
157 |
|
| 158 |
Document document = new Document();
|
158 |
Document document = new Document();
|
| 159 |
PdfWriter writer = PdfWriter.getInstance(document, baosPDF);
|
159 |
PdfWriter.getInstance(document, baosPDF);
|
| 160 |
document.addAuthor("shop2020");
|
160 |
document.addAuthor("shop2020");
|
| 161 |
//document.addTitle("Invoice No: " + order.getInvoice_number());
|
161 |
//document.addTitle("Invoice No: " + order.getInvoice_number());
|
| 162 |
document.open();
|
162 |
document.open();
|
| 163 |
|
163 |
|
| 164 |
List<Order> orders = new ArrayList<Order>();
|
164 |
List<Order> orders = new ArrayList<Order>();
|
| Line 214... |
Line 214... |
| 214 |
}
|
214 |
}
|
| 215 |
document.add(getExtraInfoTable(order, provider, 16, warehouse.getBillingType()));
|
215 |
document.add(getExtraInfoTable(order, provider, 16, warehouse.getBillingType()));
|
| 216 |
continue;
|
216 |
continue;
|
| 217 |
}
|
217 |
}
|
| 218 |
|
218 |
|
| 219 |
PdfPTable dispatchAdviceTable = getDispatchAdviceTable(order, warehouse, provider, barcodeFontSize, destCode, withBill, shippingLocation, writer.getDirectContent());
|
219 |
PdfPTable dispatchAdviceTable = getDispatchAdviceTable(order, warehouse, provider, barcodeFontSize, destCode, withBill, shippingLocation);
|
| 220 |
dispatchAdviceTable.setSpacingAfter(10.0f);
|
220 |
dispatchAdviceTable.setSpacingAfter(10.0f);
|
| 221 |
dispatchAdviceTable.setWidthPercentage(90.0f);
|
221 |
dispatchAdviceTable.setWidthPercentage(90.0f);
|
| 222 |
|
222 |
|
| 223 |
document.add(dispatchAdviceTable);
|
223 |
document.add(dispatchAdviceTable);
|
| 224 |
if(withBill){
|
224 |
if(withBill){
|
| Line 255... |
Line 255... |
| 255 |
logger.error("Error while generating Invoice: ", e);
|
255 |
logger.error("Error while generating Invoice: ", e);
|
| 256 |
}
|
256 |
}
|
| 257 |
return baosPDF;
|
257 |
return baosPDF;
|
| 258 |
}
|
258 |
}
|
| 259 |
|
259 |
|
| 260 |
private PdfPTable getDispatchAdviceTable(Order order, Warehouse warehouse, Provider provider, float barcodeFontSize, String destCode, boolean withBill, Warehouse shippingLocation, PdfContentByte pcb){
|
260 |
private PdfPTable getDispatchAdviceTable(Order order, Warehouse warehouse, Provider provider, float barcodeFontSize, String destCode, boolean withBill, Warehouse shippingLocation){
|
| 261 |
Font barCodeFont = getBarCodeFont(provider, barcodeFontSize);
|
261 |
Font barCodeFont = getBarCodeFont(provider, barcodeFontSize);
|
| 262 |
|
262 |
|
| 263 |
PdfPTable table = new PdfPTable(1);
|
263 |
PdfPTable table = new PdfPTable(1);
|
| 264 |
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
264 |
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 265 |
|
265 |
|
| 266 |
PdfPTable logoTable = new PdfPTable(2);
|
266 |
PdfPTable logoTable = new PdfPTable(2);
|
| 267 |
addLogoTable(logoTable, order);
|
267 |
addLogoTable(logoTable, order);
|
| 268 |
|
268 |
|
| 269 |
PdfPCell titleCell = getTitleCell();
|
269 |
PdfPCell titleCell = getTitleCell();
|
| 270 |
PdfPTable customerTable = getCustomerAddressTable(order, destCode, false, helvetica12, false);
|
270 |
PdfPTable customerTable = getCustomerAddressTable(order, destCode, false, helvetica12, false);
|
| 271 |
PdfPTable providerInfoTable = getProviderTable(order, provider, barCodeFont, pcb);
|
271 |
PdfPTable providerInfoTable = getProviderTable(order, provider, barCodeFont);
|
| 272 |
|
272 |
|
| 273 |
PdfPTable dispatchTable = new PdfPTable(new float[]{0.5f, 0.1f, 0.4f});
|
273 |
PdfPTable dispatchTable = new PdfPTable(new float[]{0.5f, 0.1f, 0.4f});
|
| 274 |
dispatchTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
274 |
dispatchTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 275 |
dispatchTable.addCell(customerTable);
|
275 |
dispatchTable.addCell(customerTable);
|
| 276 |
dispatchTable.addCell(new Phrase(" "));
|
276 |
dispatchTable.addCell(new Phrase(" "));
|
| Line 302... |
Line 302... |
| 302 |
Barcode128 code128 = new Barcode128();
|
302 |
Barcode128 code128 = new Barcode128();
|
| 303 |
code128.setGenerateChecksum(true);
|
303 |
code128.setGenerateChecksum(true);
|
| 304 |
code128.setCode("*"+fedexCodReturnBarcode+"*");
|
304 |
code128.setCode("*"+fedexCodReturnBarcode+"*");
|
| 305 |
chargesTable.addCell(new Phrase("PRIORITY OVERNIGHT ", helvetica8));
|
305 |
chargesTable.addCell(new Phrase("PRIORITY OVERNIGHT ", helvetica8));
|
| 306 |
chargesTable.addCell(formIdCell);
|
306 |
chargesTable.addCell(formIdCell);
|
| 307 |
chargesTable.addCell(code128.createImageWithBarcode(pcb, null, null));
|
307 |
chargesTable.addCell(new Phrase(code128.getCode(),new Font(code128.getFont())));
|
| 308 |
|
308 |
|
| 309 |
|
309 |
|
| 310 |
}
|
310 |
}
|
| 311 |
//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
|
311 |
//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
|
| 312 |
} else {
|
312 |
} else {
|
| Line 373... |
Line 373... |
| 373 |
titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
373 |
titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
| 374 |
titleCell.setBorder(Rectangle.NO_BORDER);
|
374 |
titleCell.setBorder(Rectangle.NO_BORDER);
|
| 375 |
return titleCell;
|
375 |
return titleCell;
|
| 376 |
}
|
376 |
}
|
| 377 |
|
377 |
|
| 378 |
private PdfPTable getProviderTable(Order order, Provider provider, Font barCodeFont, PdfContentByte pcb) {
|
378 |
private PdfPTable getProviderTable(Order order, Provider provider, Font barCodeFont) {
|
| 379 |
PdfPTable providerInfoTable = new PdfPTable(1);
|
379 |
PdfPTable providerInfoTable = new PdfPTable(1);
|
| 380 |
providerInfoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
380 |
providerInfoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 381 |
if(order.isLogisticsCod()){
|
381 |
if(order.isLogisticsCod()){
|
| 382 |
PdfPCell deliveryTypeCell = new PdfPCell(new Phrase("COD ", helvetica28));
|
382 |
PdfPCell deliveryTypeCell = new PdfPCell(new Phrase("COD ", helvetica28));
|
| 383 |
deliveryTypeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
383 |
deliveryTypeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
| Line 430... |
Line 430... |
| 430 |
providerInfoTable.addCell(awbNumberCell);
|
430 |
providerInfoTable.addCell(awbNumberCell);
|
| 431 |
if(order.getLogistics_provider_id()==7L && fedexPackageBarcode!=null ){
|
431 |
if(order.getLogistics_provider_id()==7L && fedexPackageBarcode!=null ){
|
| 432 |
Barcode128 code128 = new Barcode128();
|
432 |
Barcode128 code128 = new Barcode128();
|
| 433 |
code128.setGenerateChecksum(true);
|
433 |
code128.setGenerateChecksum(true);
|
| 434 |
code128.setCode("*"+fedexPackageBarcode+"*");
|
434 |
code128.setCode("*"+fedexPackageBarcode+"*");
|
| 435 |
providerInfoTable.addCell(code128.createImageWithBarcode(pcb, null, null));
|
435 |
providerInfoTable.addCell(new Phrase(code128.getCode(),new Font(code128.getFont())));
|
| 436 |
}
|
436 |
}
|
| 437 |
|
437 |
|
| 438 |
Warehouse warehouse = null;
|
438 |
Warehouse warehouse = null;
|
| 439 |
try{
|
439 |
try{
|
| 440 |
InventoryClient isc = new InventoryClient();
|
440 |
InventoryClient isc = new InventoryClient();
|