| Line 84... |
Line 84... |
| 84 |
document.addAuthor(pdfModel.getAuther());
|
84 |
document.addAuthor(pdfModel.getAuther());
|
| 85 |
|
85 |
|
| 86 |
Paragraph paragraphTitle = new Paragraph(INVOICE_TITLE, FONT_TITLE);
|
86 |
Paragraph paragraphTitle = new Paragraph(INVOICE_TITLE, FONT_TITLE);
|
| 87 |
paragraphTitle.setAlignment(Element.ALIGN_CENTER);
|
87 |
paragraphTitle.setAlignment(Element.ALIGN_CENTER);
|
| 88 |
|
88 |
|
| - |
|
89 |
document.add(paragraphTitle);
|
| - |
|
90 |
|
| - |
|
91 |
Rectangle rectangle = document.getPageSize();
|
| - |
|
92 |
|
| - |
|
93 |
/*Paragraph paragraphTitle = new Paragraph(INVOICE_TITLE, FONT_TITLE);
|
| - |
|
94 |
paragraphTitle.setAlignment(Element.ALIGN_CENTER);*/
|
| 89 |
PdfPCell blankCell = new PdfPCell();
|
95 |
/*pdfCell.addElement(paragraphTitle);
|
| 90 |
blankCell.setBorder(Rectangle.NO_BORDER);
|
96 |
pdfCell.setBorder(Rectangle.NO_BORDER);*/
|
| - |
|
97 |
if (pdfModel.getIrnModel() != null) {
|
| - |
|
98 |
addIrnDetails(pdfModel.getIrnModel(), rectangle, document);
|
| - |
|
99 |
}
|
| - |
|
100 |
|
| - |
|
101 |
|
| 91 |
PdfPTable tableCustomerRetailer = new PdfPTable(3);
|
102 |
PdfPTable tableCustomerRetailer = new PdfPTable(2);
|
| 92 |
tableCustomerRetailer.setWidthPercentage(90);
|
103 |
tableCustomerRetailer.setWidthPercentage(90);
|
| 93 |
tableCustomerRetailer.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
104 |
tableCustomerRetailer.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| 94 |
PdfPCell columnCustomerInfo = new PdfPCell();
|
105 |
PdfPCell columnCustomerInfo = new PdfPCell();
|
| 95 |
columnCustomerInfo.addElement(new Paragraph("Customer Details", FONT_BOLD));
|
106 |
columnCustomerInfo.addElement(new Paragraph("Customer Details", FONT_BOLD));
|
| 96 |
columnCustomerInfo.addElement(new Paragraph(
|
107 |
columnCustomerInfo.addElement(new Paragraph(
|
| Line 141... |
Line 152... |
| 141 |
tableInvoiceDate.addCell(dateValue);
|
152 |
tableInvoiceDate.addCell(dateValue);
|
| 142 |
tableInvoiceDateRetailer.addCell(tableInvoiceDate);
|
153 |
tableInvoiceDateRetailer.addCell(tableInvoiceDate);
|
| 143 |
tableInvoiceDateRetailer.addCell(columnRetailerInfo);
|
154 |
tableInvoiceDateRetailer.addCell(columnRetailerInfo);
|
| 144 |
|
155 |
|
| 145 |
tableCustomerRetailer.addCell(columnCustomerInfo);
|
156 |
tableCustomerRetailer.addCell(columnCustomerInfo);
|
| 146 |
tableCustomerRetailer.addCell(blankCell);
|
- |
|
| 147 |
tableCustomerRetailer.addCell(tableInvoiceDateRetailer);
|
157 |
tableCustomerRetailer.addCell(tableInvoiceDateRetailer);
|
| 148 |
|
158 |
|
| 149 |
PdfPTable orders = null;
|
159 |
PdfPTable orders = null;
|
| 150 |
if (stateGst) {
|
160 |
if (stateGst) {
|
| 151 |
orders = new PdfPTable(stateWidthsWithDiscount.length);
|
161 |
orders = new PdfPTable(stateWidthsWithDiscount.length);
|
| Line 221... |
Line 231... |
| 221 |
sgstTotalAmount = sgstTotalAmount + insurancePolicy.getSgstAmount();
|
231 |
sgstTotalAmount = sgstTotalAmount + insurancePolicy.getSgstAmount();
|
| 222 |
}
|
232 |
}
|
| 223 |
orders.addCell(new Paragraph(String.format("%.0f", insurancePolicy.getNetAmount()), FONT_NORMAL));
|
233 |
orders.addCell(new Paragraph(String.format("%.0f", insurancePolicy.getNetAmount()), FONT_NORMAL));
|
| 224 |
}
|
234 |
}
|
| 225 |
}
|
235 |
}
|
| 226 |
Rectangle rectangle = document.getPageSize();
|
- |
|
| - |
|
236 |
|
| 227 |
iconImg.setAbsolutePosition(25, rectangle.getHeight() - 100);
|
237 |
iconImg.setAbsolutePosition(25, rectangle.getHeight() - 100);
|
| 228 |
iconImg.scalePercent(30);
|
238 |
iconImg.scalePercent(30);
|
| 229 |
|
239 |
|
| 230 |
if (pdfModel.getQrCode() != null) {
|
- |
|
| 231 |
Image img = Image.getInstance(pdfModel.getQrCode().toURI().toURL());
|
- |
|
| 232 |
img.setAbsolutePosition(450f, rectangle.getHeight() - 140);
|
- |
|
| 233 |
document.add(img);
|
- |
|
| 234 |
}
|
- |
|
| 235 |
document.add(iconImg);
|
240 |
document.add(iconImg);
|
| 236 |
document.add(paragraphTitle);
|
- |
|
| 237 |
document.add(Chunk.NEWLINE);
|
241 |
document.add(Chunk.NEWLINE);
|
| 238 |
document.add(Chunk.NEWLINE);
|
242 |
document.add(Chunk.NEWLINE);
|
| 239 |
document.add(tableCustomerRetailer);
|
243 |
document.add(tableCustomerRetailer);
|
| 240 |
|
244 |
|
| 241 |
document.add(Chunk.NEWLINE);
|
245 |
document.add(Chunk.NEWLINE);
|
| Line 309... |
Line 313... |
| 309 |
totalPaidValueCell.setPadding(5);
|
313 |
totalPaidValueCell.setPadding(5);
|
| 310 |
paidAmountTable.addCell(totalPaidValueCell);
|
314 |
paidAmountTable.addCell(totalPaidValueCell);
|
| 311 |
|
315 |
|
| 312 |
document.add(paidAmountTable);
|
316 |
document.add(paidAmountTable);
|
| 313 |
}
|
317 |
}
|
| - |
|
318 |
Paragraph autoGenerateParagraph = new Paragraph("Note - This is computer generated Invoice, no signature is required", FONT_NORMAL);
|
| - |
|
319 |
autoGenerateParagraph.setAlignment(Element.ALIGN_CENTER);
|
| - |
|
320 |
document.add(autoGenerateParagraph);
|
| 314 |
|
321 |
|
| 315 |
if (pdfModel.getTncs() != null) {
|
322 |
if (pdfModel.getTncs() != null) {
|
| 316 |
StringBuffer sb = new StringBuffer();
|
323 |
StringBuffer sb = new StringBuffer();
|
| 317 |
for (String tnc : pdfModel.getTncs()) {
|
324 |
for (String tnc : pdfModel.getTncs()) {
|
| 318 |
sb.append(tnc).append("\n");
|
325 |
sb.append(tnc).append("\n");
|
| Line 335... |
Line 342... |
| 335 |
e.printStackTrace();
|
342 |
e.printStackTrace();
|
| 336 |
}
|
343 |
}
|
| 337 |
|
344 |
|
| 338 |
}
|
345 |
}
|
| 339 |
|
346 |
|
| - |
|
347 |
private static void addIrnDetails(IrnModel irnModel, Rectangle rectangle, Document document) throws IOException, DocumentException {
|
| - |
|
348 |
PdfPTable taxTable = new PdfPTable(1);
|
| - |
|
349 |
taxTable.setWidthPercentage(45);
|
| - |
|
350 |
PdfPCell pdfCell = new PdfPCell();
|
| - |
|
351 |
pdfCell.setBorder(Rectangle.NO_BORDER);
|
| - |
|
352 |
Image img = Image.getInstance(irnModel.getQrCode().toURI().toURL());
|
| - |
|
353 |
img.setAbsolutePosition(450f, rectangle.getHeight() - 140);
|
| - |
|
354 |
document.add(img);
|
| - |
|
355 |
Paragraph irnParagraph = new Paragraph("IRN No - " + irnModel.getIrnNumber(), FONT_NORMAL);
|
| - |
|
356 |
irnParagraph.setAlignment(Element.ALIGN_LEFT);
|
| - |
|
357 |
pdfCell.addElement(irnParagraph);
|
| - |
|
358 |
|
| - |
|
359 |
Paragraph ackParagraph = new Paragraph("Ack No - " + irnModel.getAcknowledgeNumber(), FONT_NORMAL);
|
| - |
|
360 |
ackParagraph.setAlignment(Element.ALIGN_LEFT);
|
| - |
|
361 |
pdfCell.addElement(ackParagraph);
|
| - |
|
362 |
|
| - |
|
363 |
Paragraph ackDateParagraph = new Paragraph("Ack Date - " + FormattingUtils.format(irnModel.getAcknowledgeDate()), FONT_NORMAL);
|
| - |
|
364 |
ackDateParagraph.setAlignment(Element.ALIGN_LEFT);
|
| - |
|
365 |
pdfCell.addElement(ackDateParagraph);
|
| - |
|
366 |
taxTable.addCell(pdfCell);
|
| - |
|
367 |
document.add(taxTable);
|
| - |
|
368 |
}
|
| - |
|
369 |
|
| 340 |
private static void stampCancelled(ByteArrayOutputStream byteStream, List<Integer> cancelledPage) throws IOException, DocumentException {
|
370 |
private static void stampCancelled(ByteArrayOutputStream byteStream, List<Integer> cancelledPage) throws IOException, DocumentException {
|
| 341 |
ByteArrayInputStream bais = new ByteArrayInputStream(byteStream.toByteArray());
|
371 |
ByteArrayInputStream bais = new ByteArrayInputStream(byteStream.toByteArray());
|
| 342 |
PdfReader pdfReader = new PdfReader(bais);
|
372 |
PdfReader pdfReader = new PdfReader(bais);
|
| 343 |
int n = pdfReader.getNumberOfPages();
|
373 |
int n = pdfReader.getNumberOfPages();
|
| 344 |
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
374 |
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
| Line 356... |
Line 386... |
| 356 |
float h = imgCancelled.getScaledHeight() / 2;
|
386 |
float h = imgCancelled.getScaledHeight() / 2;
|
| 357 |
float wWaterMark = imgWatermark.getScaledWidth() / 2;
|
387 |
float wWaterMark = imgWatermark.getScaledWidth() / 2;
|
| 358 |
float hWatermark = imgWatermark.getScaledHeight() / 2;
|
388 |
float hWatermark = imgWatermark.getScaledHeight() / 2;
|
| 359 |
// transparency
|
389 |
// transparency
|
| 360 |
PdfGState gs1 = new PdfGState();
|
390 |
PdfGState gs1 = new PdfGState();
|
| 361 |
gs1.setFillOpacity(0.5f);
|
391 |
gs1.setFillOpacity(0.4f);
|
| 362 |
PdfGState gs2 = new PdfGState();
|
392 |
PdfGState gs2 = new PdfGState();
|
| 363 |
gs2.setFillOpacity(0.1f);
|
393 |
gs2.setFillOpacity(0.05f);
|
| 364 |
// properties
|
394 |
// properties
|
| 365 |
PdfContentByte over;
|
395 |
PdfContentByte over;
|
| 366 |
Rectangle pagesize;
|
396 |
Rectangle pagesize;
|
| 367 |
float x, y;
|
397 |
float x, y;
|
| 368 |
|
398 |
|
| Line 690... |
Line 720... |
| 690 |
tableInvoiceDate.addCell(debitNoteDetails);
|
720 |
tableInvoiceDate.addCell(debitNoteDetails);
|
| 691 |
tableInvoiceDate.addCell(debitNoteNumberKey);
|
721 |
tableInvoiceDate.addCell(debitNoteNumberKey);
|
| 692 |
tableInvoiceDate.addCell(debitNoteNumberValue);
|
722 |
tableInvoiceDate.addCell(debitNoteNumberValue);
|
| 693 |
tableInvoiceDate.addCell(debitNoteDateKey);
|
723 |
tableInvoiceDate.addCell(debitNoteDateKey);
|
| 694 |
tableInvoiceDate.addCell(debitNoteDateValue);
|
724 |
tableInvoiceDate.addCell(debitNoteDateValue);
|
| 695 |
if (pdfModel.getIrnNumber() != null) {
|
725 |
if (pdfModel.getInvoiceNumber() != null) {
|
| 696 |
PdfPCell dateKey = new PdfPCell(new Paragraph("Invoice Dt:", FONT_NORMAL));
|
726 |
PdfPCell dateKey = new PdfPCell(new Paragraph("Invoice Dt:", FONT_NORMAL));
|
| 697 |
dateKey.setBorder(Rectangle.NO_BORDER);
|
727 |
dateKey.setBorder(Rectangle.NO_BORDER);
|
| 698 |
PdfPCell dateValue = new PdfPCell(new Paragraph(pdfModel.getInvoiceDate(), FONT_NORMAL));
|
728 |
PdfPCell dateValue = new PdfPCell(new Paragraph(pdfModel.getInvoiceDate(), FONT_NORMAL));
|
| 699 |
dateValue.setBorder(Rectangle.NO_BORDER);
|
729 |
dateValue.setBorder(Rectangle.NO_BORDER);
|
| 700 |
|
730 |
|