| Line 33... |
Line 33... |
| 33 |
private static Font FONT_NORMAL = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL);
|
33 |
private static Font FONT_NORMAL = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL);
|
| 34 |
private static Font FONT_BOLD = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD);
|
34 |
private static Font FONT_BOLD = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD);
|
| 35 |
// private static Font fontTableHeader = new
|
35 |
// private static Font fontTableHeader = new
|
| 36 |
// Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD);
|
36 |
// Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD);
|
| 37 |
private static final String INVOICE_TITLE = "TAX INVOICE";
|
37 |
private static final String INVOICE_TITLE = "TAX INVOICE";
|
| - |
|
38 |
private static final String DEBIT_NOTE_TITLE = "DEBIT NOTE";
|
| 38 |
|
39 |
|
| 39 |
private static float[] igstWidthsWithDiscount = new float[] { .3f, 2.6f, 0.7f, .4f, 0.7f, 0.5f, .7f, .6f, 0.6f,
|
40 |
private static float[] igstWidthsWithDiscount = new float[] { .3f, 2.6f, 0.7f, .4f, 0.7f, 0.5f, .7f, .6f, 0.6f,
|
| 40 |
0.9f };
|
41 |
0.9f };
|
| 41 |
private static float[] stateWidthsWithDiscount = new float[] { .2f, 2.1f, 0.7f, .3f, 0.6f, 0.4f, .7f, .5f, .6f, .5f,
|
42 |
private static float[] stateWidthsWithDiscount = new float[] { .2f, 2.1f, 0.7f, .3f, 0.6f, 0.4f, .7f, .5f, .6f, .5f,
|
| 42 |
.6f, .8f };
|
43 |
.6f, .8f };
|
| - |
|
44 |
|
| - |
|
45 |
private static float[] igstWidths = new float[] { .3f, 2.6f, 0.7f, .4f, 0.7f, 0.5f, .7f, .6f, 0.6f,
|
| - |
|
46 |
0.9f };
|
| - |
|
47 |
private static float[] stateWidths = new float[] { .2f, 2.1f, 0.7f, .3f, 0.6f, 0.4f, .7f, .5f, .6f, .5f,
|
| - |
|
48 |
.6f, .8f };
|
| 43 |
|
49 |
|
| 44 |
private static final Locale indianLocale = Locale.getDefault();
|
50 |
private static final Locale indianLocale = Locale.getDefault();
|
| 45 |
|
51 |
|
| 46 |
private static final Logger LOGGER = LoggerFactory.getLogger(PdfUtils.class);
|
52 |
private static final Logger LOGGER = LoggerFactory.getLogger(PdfUtils.class);
|
| 47 |
|
53 |
|
| Line 305... |
Line 311... |
| 305 |
|
311 |
|
| 306 |
document.open();
|
312 |
document.open();
|
| 307 |
document.addTitle(pdfModel.getTitle());
|
313 |
document.addTitle(pdfModel.getTitle());
|
| 308 |
document.addAuthor(pdfModel.getAuther());
|
314 |
document.addAuthor(pdfModel.getAuther());
|
| 309 |
|
315 |
|
| 310 |
Paragraph paragraphTitle = new Paragraph(INVOICE_TITLE, FONT_TITLE);
|
316 |
Paragraph paragraphTitle = new Paragraph(DEBIT_NOTE_TITLE, FONT_TITLE);
|
| 311 |
paragraphTitle.setAlignment(Element.ALIGN_CENTER);
|
317 |
paragraphTitle.setAlignment(Element.ALIGN_CENTER);
|
| 312 |
|
318 |
|
| 313 |
PdfPCell blankCell = new PdfPCell();
|
319 |
PdfPCell blankCell = new PdfPCell();
|
| 314 |
blankCell.setBorder(Rectangle.NO_BORDER);
|
320 |
blankCell.setBorder(Rectangle.NO_BORDER);
|
| 315 |
PdfPTable tableCustomerRetailer = new PdfPTable(3);
|
321 |
PdfPTable tableCustomerRetailer = new PdfPTable(3);
|
| 316 |
tableCustomerRetailer.setWidthPercentage(90);
|
322 |
tableCustomerRetailer.setWidthPercentage(90);
|
| 317 |
tableCustomerRetailer.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
323 |
tableCustomerRetailer.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 318 |
PdfPCell columnCustomerInfo = new PdfPCell();
|
324 |
PdfPCell partnerInfo = new PdfPCell();
|
| 319 |
columnCustomerInfo.addElement(new Paragraph("Customer Details", FONT_BOLD));
|
- |
|
| 320 |
columnCustomerInfo.addElement(new Paragraph(
|
- |
|
| 321 |
StringUtils.capitalize(customer.getFirstName() + " " + customer.getLastName()), FONT_NORMAL));
|
325 |
partnerInfo.addElement(new Paragraph(StringUtils.capitalize(customer.getAddress().getName()), FONT_NORMAL));
|
| 322 |
columnCustomerInfo.addElement(new Paragraph(StringUtils.capitalize(customer.getAddress().getLine1())
|
326 |
partnerInfo.addElement(new Paragraph(StringUtils.capitalize(customer.getAddress().getLine1())
|
| 323 |
+ ", " + StringUtils.capitalize(customer.getAddress().getLine2()), FONT_NORMAL));
|
327 |
+ customer.getAddress().getLine2() == null ? "" : StringUtils.capitalize(retailer.getAddress().getLine2()) + ", "));
|
| 324 |
columnCustomerInfo.addElement(new Paragraph(
|
328 |
partnerInfo.addElement(new Paragraph(
|
| 325 |
StringUtils.capitalize(customer.getAddress().getCity()) + ", "
|
329 |
StringUtils.capitalize(customer.getAddress().getCity()) + ", "
|
| 326 |
+ StringUtils.capitalize(customer.getAddress().getState()) + "("
|
330 |
+ StringUtils.capitalize(customer.getAddress().getState()) + "("
|
| 327 |
+ customerAddressStateCode + ")" + "\n" + customer.getAddress().getPinCode(),
|
331 |
+ customerAddressStateCode + ")" + "\n" + customer.getAddress().getPinCode(),
|
| 328 |
FONT_NORMAL));
|
332 |
FONT_NORMAL));
|
| 329 |
columnCustomerInfo.addElement(new Paragraph("Mobile - " + customer.getMobileNumber(), FONT_NORMAL));
|
333 |
partnerInfo.addElement(new Paragraph("Mobile - " + customer.getMobileNumber(), FONT_NORMAL));
|
| 330 |
if (customer.getGstNumber() != null && !customer.getGstNumber().isEmpty()) {
|
334 |
if (customer.getGstNumber() != null && !customer.getGstNumber().isEmpty()) {
|
| 331 |
columnCustomerInfo
|
335 |
partnerInfo
|
| 332 |
.addElement(new Paragraph("GST Number - " + customer.getGstNumber(), FONT_NORMAL));
|
336 |
.addElement(new Paragraph("GST Number - " + customer.getGstNumber(), FONT_NORMAL));
|
| 333 |
}
|
337 |
}
|
| 334 |
columnCustomerInfo.setBorder(Rectangle.NO_BORDER);
|
338 |
partnerInfo.setBorder(Rectangle.NO_BORDER);
|
| - |
|
339 |
|
| - |
|
340 |
|
| 335 |
PdfPCell columnRetailerInfo = new PdfPCell();
|
341 |
PdfPCell sellerParty = new PdfPCell();
|
| 336 |
columnRetailerInfo
|
- |
|
| 337 |
.addElement(new Paragraph(StringUtils.capitalize(retailer.getAddress().getName()), FONT_BOLD));
|
342 |
sellerParty.addElement(new Paragraph(StringUtils.capitalize(retailer.getAddress().getName()), FONT_BOLD));
|
| - |
|
343 |
sellerParty.addElement(new Paragraph(
|
| 338 |
columnRetailerInfo.addElement(new Paragraph(StringUtils.capitalize(retailer.getAddress().getLine1())
|
344 |
(retailer.getAddress().getLine1() == null ? "" : StringUtils.capitalize(retailer.getAddress().getLine1()) + ", ")
|
| 339 |
+ ", " + StringUtils.capitalize(retailer.getAddress().getLine2()) + ", "
|
345 |
+ (retailer.getAddress().getLine2() == null ? "" : StringUtils.capitalize(retailer.getAddress().getLine2()) + ", ")
|
| 340 |
+ StringUtils.capitalize(retailer.getAddress().getCity()) + "-"
|
346 |
+ StringUtils.capitalize(retailer.getAddress().getCity()) + "-"
|
| 341 |
+ retailer.getAddress().getPinCode() + ", " + retailer.getAddress().getState() + "("
|
347 |
+ retailer.getAddress().getPinCode() + ", " + retailer.getAddress().getState() + "("
|
| 342 |
+ (stateGst ? customerAddressStateCode : retailerAddressStateCode) + ")", FONT_BOLD));
|
348 |
+ (stateGst ? customerAddressStateCode : retailerAddressStateCode) + ")", FONT_BOLD));
|
| 343 |
columnRetailerInfo
|
349 |
sellerParty
|
| 344 |
.addElement(new Paragraph("Contact No.- " + retailer.getAddress().getPhoneNumber(), FONT_BOLD));
|
350 |
.addElement(new Paragraph("Contact No.- " + retailer.getAddress().getPhoneNumber(), FONT_BOLD));
|
| 345 |
columnRetailerInfo.addElement(new Paragraph("GST NO. " + retailer.getGstNumber(), FONT_BOLD));
|
351 |
sellerParty.addElement(new Paragraph("GST NO. " + retailer.getGstNumber(), FONT_BOLD));
|
| 346 |
columnRetailerInfo.setBorder(Rectangle.NO_BORDER);
|
352 |
sellerParty.setBorder(Rectangle.NO_BORDER);
|
| 347 |
|
353 |
|
| 348 |
PdfPTable tableInvoiceDateRetailer = new PdfPTable(1);
|
354 |
PdfPTable tableInvoiceDateRetailer = new PdfPTable(1);
|
| 349 |
tableInvoiceDateRetailer.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
355 |
tableInvoiceDateRetailer.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 350 |
|
356 |
|
| 351 |
PdfPTable tableInvoiceDate = new PdfPTable(2);
|
357 |
PdfPTable tableInvoiceDate = new PdfPTable(2);
|
| 352 |
tableInvoiceDate.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
358 |
tableInvoiceDate.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 353 |
|
359 |
|
| 354 |
PdfPCell invoiceNumberKey = new PdfPCell(new Paragraph("Invoice No:", FONT_NORMAL));
|
360 |
PdfPCell debitNoteNumberKey = new PdfPCell(new Paragraph("Debit Note No:", FONT_NORMAL));
|
| 355 |
invoiceNumberKey.setBorder(Rectangle.NO_BORDER);
|
361 |
debitNoteNumberKey.setBorder(Rectangle.NO_BORDER);
|
| - |
|
362 |
PdfPCell debitNoteNumberValue = new PdfPCell(new Paragraph(debitNotePdfModel.getDebitNoteNumber(), FONT_NORMAL));
|
| - |
|
363 |
debitNoteNumberValue.setBorder(Rectangle.NO_BORDER);
|
| - |
|
364 |
|
| - |
|
365 |
PdfPCell debitNoteDateKey = new PdfPCell(new Paragraph("Debit Note Dt:", FONT_NORMAL));
|
| - |
|
366 |
debitNoteDateKey.setBorder(Rectangle.NO_BORDER);
|
| - |
|
367 |
|
| - |
|
368 |
PdfPCell debitNoteDateValue = new PdfPCell(new Paragraph(debitNotePdfModel.getDebitNoteDate(), FONT_NORMAL));
|
| - |
|
369 |
debitNoteDateValue.setBorder(Rectangle.NO_BORDER);
|
| 356 |
|
370 |
|
| - |
|
371 |
PdfPCell invoiceNumberKey = new PdfPCell(new Paragraph("For Invoice No:", FONT_NORMAL));
|
| - |
|
372 |
invoiceNumberKey.setBorder(Rectangle.NO_BORDER);
|
| 357 |
PdfPCell invoiceNumberValue = new PdfPCell(new Paragraph(pdfModel.getInvoiceNumber(), FONT_NORMAL));
|
373 |
PdfPCell invoiceNumberValue = new PdfPCell(new Paragraph(pdfModel.getInvoiceNumber(), FONT_NORMAL));
|
| 358 |
invoiceNumberValue.setBorder(Rectangle.NO_BORDER);
|
374 |
invoiceNumberValue.setBorder(Rectangle.NO_BORDER);
|
| 359 |
|
375 |
|
| 360 |
PdfPCell dateKey = new PdfPCell(new Paragraph("Date:", FONT_NORMAL));
|
376 |
PdfPCell dateKey = new PdfPCell(new Paragraph("Invoice Dt:", FONT_NORMAL));
|
| 361 |
dateKey.setBorder(Rectangle.NO_BORDER);
|
377 |
dateKey.setBorder(Rectangle.NO_BORDER);
|
| 362 |
|
- |
|
| 363 |
PdfPCell dateValue = new PdfPCell(new Paragraph(pdfModel.getInvoiceDate(), FONT_NORMAL));
|
378 |
PdfPCell dateValue = new PdfPCell(new Paragraph(pdfModel.getInvoiceDate(), FONT_NORMAL));
|
| 364 |
dateValue.setBorder(Rectangle.NO_BORDER);
|
379 |
dateValue.setBorder(Rectangle.NO_BORDER);
|
| - |
|
380 |
|
| - |
|
381 |
tableInvoiceDate.addCell(debitNoteNumberKey);
|
| - |
|
382 |
tableInvoiceDate.addCell(debitNoteNumberValue);
|
| - |
|
383 |
|
| - |
|
384 |
tableInvoiceDate.addCell(debitNoteDateKey);
|
| - |
|
385 |
tableInvoiceDate.addCell(debitNoteDateValue);
|
| - |
|
386 |
|
| 365 |
tableInvoiceDate.addCell(invoiceNumberKey);
|
387 |
tableInvoiceDate.addCell(invoiceNumberKey);
|
| 366 |
// tableInvoiceDate.addCell(blankCell);
|
- |
|
| 367 |
tableInvoiceDate.addCell(invoiceNumberValue);
|
388 |
tableInvoiceDate.addCell(invoiceNumberValue);
|
| - |
|
389 |
|
| 368 |
tableInvoiceDate.addCell(dateKey);
|
390 |
tableInvoiceDate.addCell(dateKey);
|
| 369 |
// tableInvoiceDate.addCell(blankCell);
|
- |
|
| 370 |
tableInvoiceDate.addCell(dateValue);
|
391 |
tableInvoiceDate.addCell(dateValue);
|
| 371 |
tableInvoiceDateRetailer.addCell(tableInvoiceDate);
|
392 |
tableInvoiceDateRetailer.addCell(tableInvoiceDate);
|
| 372 |
tableInvoiceDateRetailer.addCell(columnRetailerInfo);
|
393 |
tableInvoiceDateRetailer.addCell(sellerParty);
|
| 373 |
|
394 |
|
| 374 |
tableCustomerRetailer.addCell(columnCustomerInfo);
|
395 |
tableCustomerRetailer.addCell(partnerInfo);
|
| 375 |
tableCustomerRetailer.addCell(blankCell);
|
396 |
tableCustomerRetailer.addCell(blankCell);
|
| 376 |
tableCustomerRetailer.addCell(tableInvoiceDateRetailer);
|
397 |
tableCustomerRetailer.addCell(tableInvoiceDateRetailer);
|
| 377 |
|
398 |
|
| 378 |
PdfPTable orders = null;
|
399 |
PdfPTable orders = null;
|
| 379 |
if (stateGst) {
|
400 |
if (stateGst) {
|
| 380 |
orders = new PdfPTable(stateWidthsWithDiscount.length);
|
401 |
orders = new PdfPTable(stateWidths.length);
|
| 381 |
orders.setWidths(stateWidthsWithDiscount);
|
402 |
orders.setWidths(stateWidths);
|
| 382 |
} else {
|
403 |
} else {
|
| 383 |
orders = new PdfPTable(igstWidthsWithDiscount.length);
|
404 |
orders = new PdfPTable(igstWidths.length);
|
| 384 |
orders.setWidths(igstWidthsWithDiscount);
|
405 |
orders.setWidths(igstWidths);
|
| 385 |
}
|
406 |
}
|
| 386 |
orders.setWidthPercentage(90);
|
407 |
orders.setWidthPercentage(90);
|
| 387 |
orders.addCell(new Paragraph("Sl", FONT_BOLD));
|
408 |
orders.addCell(new Paragraph("Sl", FONT_BOLD));
|
| 388 |
orders.addCell(new Paragraph("Description", FONT_BOLD));
|
409 |
orders.addCell(new Paragraph("Description", FONT_BOLD));
|
| 389 |
orders.addCell(new Paragraph("HSN", FONT_BOLD));
|
410 |
orders.addCell(new Paragraph("HSN", FONT_BOLD));
|
| 390 |
orders.addCell(new Paragraph("Qty", FONT_BOLD));
|
411 |
orders.addCell(new Paragraph("Qty", FONT_BOLD));
|
| 391 |
orders.addCell(new Paragraph("Rate\n(Per pc)", FONT_BOLD));
|
412 |
orders.addCell(new Paragraph("Rate\n(Per pc)", FONT_BOLD));
|
| 392 |
orders.addCell(new Paragraph("Disc.", FONT_BOLD));
|
- |
|
| 393 |
orders.addCell(new Paragraph("Total\nTaxable", FONT_BOLD));
|
413 |
orders.addCell(new Paragraph("Total\nTaxable", FONT_BOLD));
|
| 394 |
if (!stateGst) {
|
414 |
if (!stateGst) {
|
| 395 |
orders.addCell(new Paragraph("IGST\n%", FONT_BOLD));
|
415 |
orders.addCell(new Paragraph("IGST\n%", FONT_BOLD));
|
| 396 |
orders.addCell(new Paragraph("IGST", FONT_BOLD));
|
416 |
orders.addCell(new Paragraph("IGST", FONT_BOLD));
|
| 397 |
// orders.setWidths(new float[]{1, 3, 1, 1, 1, 1, 1, 1});
|
417 |
// orders.setWidths(new float[]{1, 3, 1, 1, 1, 1, 1, 1});
|
| Line 405... |
Line 425... |
| 405 |
// 1});
|
425 |
// 1});
|
| 406 |
// total 8f
|
426 |
// total 8f
|
| 407 |
}
|
427 |
}
|
| 408 |
orders.addCell(new Paragraph("Total", FONT_BOLD));
|
428 |
orders.addCell(new Paragraph("Total", FONT_BOLD));
|
| 409 |
|
429 |
|
| 410 |
// orders.addCell(new Paragraph("Item Total (Rs)", FONT_BOLD));
|
- |
|
| 411 |
|
430 |
|
| 412 |
orders.setHeaderRows(1);
|
431 |
orders.setHeaderRows(1);
|
| 413 |
// orders.setSkipFirstHeader(true);
|
- |
|
| 414 |
|
432 |
|
| 415 |
float igstTotalAmount = 0, cgstTotalAmount = 0, sgstTotalAmount = 0;
|
433 |
float igstTotalAmount = 0, cgstTotalAmount = 0, sgstTotalAmount = 0;
|
| 416 |
int index = 1;
|
434 |
int index = 1;
|
| 417 |
for (CustomOrderItem orderItem : orderItems) {
|
435 |
for (CustomOrderItem orderItem : orderItems) {
|
| 418 |
orders.addCell(new Paragraph(String.valueOf(index++), FONT_NORMAL));
|
436 |
orders.addCell(new Paragraph(String.valueOf(index++), FONT_NORMAL));
|
| 419 |
orders.addCell(new Paragraph(orderItem.getDescription(), FONT_NORMAL));
|
437 |
orders.addCell(new Paragraph(orderItem.getDescription(), FONT_NORMAL));
|
| 420 |
orders.addCell(new Paragraph(orderItem.getHsnCode(), FONT_NORMAL));
|
438 |
orders.addCell(new Paragraph(orderItem.getHsnCode(), FONT_NORMAL));
|
| 421 |
orders.addCell(new Paragraph(String.valueOf(orderItem.getQuantity()), FONT_NORMAL));
|
439 |
orders.addCell(new Paragraph(String.valueOf(orderItem.getQuantity()), FONT_NORMAL));
|
| 422 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getRate()), FONT_NORMAL));
|
440 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getRate()), FONT_NORMAL));
|
| 423 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getDiscount()), FONT_NORMAL));
|
- |
|
| 424 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getAmount()), FONT_NORMAL));
|
441 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getAmount()), FONT_NORMAL));
|
| 425 |
if (!stateGst) {
|
442 |
if (!stateGst) {
|
| 426 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getIgstRate()), FONT_NORMAL));
|
443 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getIgstRate()), FONT_NORMAL));
|
| 427 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getIgstAmount()), FONT_NORMAL));
|
444 |
orders.addCell(new Paragraph(String.format("%.2f", orderItem.getIgstAmount()), FONT_NORMAL));
|
| 428 |
igstTotalAmount = igstTotalAmount + orderItem.getIgstAmount();
|
445 |
igstTotalAmount = igstTotalAmount + orderItem.getIgstAmount();
|
| Line 437... |
Line 454... |
| 437 |
orders.addCell(new Paragraph(String.format("%.0f", orderItem.getNetAmount()), FONT_NORMAL));
|
454 |
orders.addCell(new Paragraph(String.format("%.0f", orderItem.getNetAmount()), FONT_NORMAL));
|
| 438 |
// orders.addCell(new Paragraph(String.format("%.2f",
|
455 |
// orders.addCell(new Paragraph(String.format("%.2f",
|
| 439 |
// orderItem.getItemTotal()), FONT_NORMAL));
|
456 |
// orderItem.getItemTotal()), FONT_NORMAL));
|
| 440 |
}
|
457 |
}
|
| 441 |
|
458 |
|
| 442 |
for (CustomInsurancePolicy insurancePolicy : pdfModel.getInsurancePolicies()) {
|
- |
|
| 443 |
orders.addCell(new Paragraph(String.valueOf(index++), FONT_NORMAL));
|
- |
|
| 444 |
orders.addCell(new Paragraph(insurancePolicy.getDescription(), FONT_NORMAL));
|
- |
|
| 445 |
orders.addCell(new Paragraph(insurancePolicy.getHsnCode(), FONT_NORMAL));
|
- |
|
| 446 |
orders.addCell(new Paragraph("1", FONT_NORMAL));
|
- |
|
| 447 |
orders.addCell(new Paragraph(String.format("%.2f", insurancePolicy.getRate()), FONT_NORMAL));
|
- |
|
| 448 |
orders.addCell(new Paragraph("-", FONT_NORMAL));
|
- |
|
| 449 |
orders.addCell(new Paragraph(String.format("%.2f", insurancePolicy.getRate()), FONT_NORMAL));
|
- |
|
| 450 |
if (!stateGst) {
|
- |
|
| 451 |
orders.addCell(
|
- |
|
| 452 |
new Paragraph(String.format("%.2f", insurancePolicy.getIgstRate()), FONT_NORMAL));
|
- |
|
| 453 |
orders.addCell(
|
- |
|
| 454 |
new Paragraph(String.format("%.2f", insurancePolicy.getIgstAmount()), FONT_NORMAL));
|
- |
|
| 455 |
igstTotalAmount = igstTotalAmount + insurancePolicy.getIgstAmount();
|
- |
|
| 456 |
} else {
|
- |
|
| 457 |
orders.addCell(
|
- |
|
| 458 |
new Paragraph(String.format("%.2f", insurancePolicy.getCgstRate()), FONT_NORMAL));
|
- |
|
| 459 |
orders.addCell(
|
- |
|
| 460 |
new Paragraph(String.format("%.2f", insurancePolicy.getCgstAmount()), FONT_NORMAL));
|
- |
|
| 461 |
orders.addCell(
|
- |
|
| 462 |
new Paragraph(String.format("%.2f", insurancePolicy.getSgstRate()), FONT_NORMAL));
|
- |
|
| 463 |
orders.addCell(
|
- |
|
| 464 |
new Paragraph(String.format("%.2f", insurancePolicy.getSgstAmount()), FONT_NORMAL));
|
- |
|
| 465 |
cgstTotalAmount = cgstTotalAmount + insurancePolicy.getCgstAmount();
|
- |
|
| 466 |
sgstTotalAmount = sgstTotalAmount + insurancePolicy.getSgstAmount();
|
- |
|
| 467 |
}
|
- |
|
| 468 |
orders.addCell(new Paragraph(String.format("%.0f", insurancePolicy.getNetAmount()), FONT_NORMAL));
|
- |
|
| 469 |
}
|
- |
|
| 470 |
|
- |
|
| 471 |
document.add(paragraphTitle);
|
459 |
document.add(paragraphTitle);
|
| 472 |
document.add(Chunk.NEWLINE);
|
460 |
document.add(Chunk.NEWLINE);
|
| 473 |
document.add(Chunk.NEWLINE);
|
461 |
document.add(Chunk.NEWLINE);
|
| 474 |
document.add(tableCustomerRetailer);
|
462 |
document.add(tableCustomerRetailer);
|
| 475 |
|
463 |
|
| Line 506... |
Line 494... |
| 506 |
String amountInWords = toAmountInWords(pdfModel.getTotalAmount());
|
494 |
String amountInWords = toAmountInWords(pdfModel.getTotalAmount());
|
| 507 |
amountInWordsTable.addCell(new Paragraph(amountInWords.toString(), FONT_BOLD));
|
495 |
amountInWordsTable.addCell(new Paragraph(amountInWords.toString(), FONT_BOLD));
|
| 508 |
amountInWordsTable.addCell(new Paragraph("E & O.E", FONT_NORMAL));
|
496 |
amountInWordsTable.addCell(new Paragraph("E & O.E", FONT_NORMAL));
|
| 509 |
document.add(amountInWordsTable);
|
497 |
document.add(amountInWordsTable);
|
| 510 |
|
498 |
|
| 511 |
StringBuffer sb = new StringBuffer();
|
499 |
/* StringBuffer sb = new StringBuffer();
|
| 512 |
List<String> tncs = pdfModel.getTncs();
|
500 |
List<String> tncs = pdfModel.getTncs();
|
| 513 |
for (String tnc : tncs) {
|
501 |
for (String tnc : tncs) {
|
| 514 |
sb.append(tnc).append("\n");
|
502 |
sb.append(tnc).append("\n");
|
| 515 |
}
|
503 |
}
|
| 516 |
|
504 |
|
| 517 |
Paragraph warningParagraph = new Paragraph(sb.toString(), FONT_NORMAL);
|
505 |
Paragraph warningParagraph = new Paragraph(sb.toString(), FONT_NORMAL);
|
| 518 |
warningParagraph.setIndentationLeft(40);
|
506 |
warningParagraph.setIndentationLeft(40);
|
| 519 |
document.add(Chunk.NEWLINE);
|
507 |
document.add(Chunk.NEWLINE);
|
| 520 |
document.add(warningParagraph);
|
508 |
document.add(warningParagraph);*/
|
| 521 |
document.newPage();
|
509 |
document.newPage();
|
| 522 |
}
|
510 |
}
|
| 523 |
document.close(); // no need to close PDFwriter?
|
511 |
document.close(); // no need to close PDFwriter?
|
| 524 |
} catch (DocumentException e) {
|
512 |
} catch (DocumentException e) {
|
| 525 |
LOGGER.error("Unable to write data to pdf file : ", e);
|
513 |
LOGGER.error("Unable to write data to pdf file : ", e);
|