| Line 21... |
Line 21... |
| 21 |
import com.itextpdf.text.pdf.PdfPTable;
|
21 |
import com.itextpdf.text.pdf.PdfPTable;
|
| 22 |
import com.itextpdf.text.pdf.PdfWriter;
|
22 |
import com.itextpdf.text.pdf.PdfWriter;
|
| 23 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
23 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
| 24 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
24 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
| 25 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
25 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
| - |
|
26 |
import com.spice.profitmandi.common.model.CustomPaymentOption;
|
| 26 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
27 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 27 |
import com.spice.profitmandi.common.model.DebitNotePdfModel;
|
28 |
import com.spice.profitmandi.common.model.DebitNotePdfModel;
|
| 28 |
import com.spice.profitmandi.common.model.PdfModel;
|
29 |
import com.spice.profitmandi.common.model.PdfModel;
|
| 29 |
|
30 |
|
| 30 |
public class PdfUtils {
|
31 |
public class PdfUtils {
|
| Line 252... |
Line 253... |
| 252 |
grandTotalTable.addCell(amountParagraph);
|
253 |
grandTotalTable.addCell(amountParagraph);
|
| 253 |
|
254 |
|
| 254 |
document.add(grandTotalTable);
|
255 |
document.add(grandTotalTable);
|
| 255 |
|
256 |
|
| 256 |
PdfPTable amountInWordsTable = new PdfPTable(3);
|
257 |
PdfPTable amountInWordsTable = new PdfPTable(3);
|
| - |
|
258 |
amountInWordsTable.setWidthPercentage(90);
|
| - |
|
259 |
amountInWordsTable.addCell(new Paragraph("Amount in Words:", FONT_BOLD));
|
| 257 |
if (!stateGst) {
|
260 |
if (!stateGst) {
|
| 258 |
amountInWordsTable.setWidths(new float[] { 2, 5.1f, 0.9f });
|
261 |
amountInWordsTable.setWidths(new float[] { 2, 5.1f, 0.9f });
|
| 259 |
} else {
|
262 |
} else {
|
| 260 |
amountInWordsTable.setWidths(new float[] { 2, 5.2f, 0.8f });
|
263 |
amountInWordsTable.setWidths(new float[] { 2, 5.2f, 0.8f });
|
| 261 |
}
|
264 |
}
|
| 262 |
amountInWordsTable.setWidthPercentage(90);
|
- |
|
| 263 |
amountInWordsTable.addCell(new Paragraph("Amount in Words:", FONT_BOLD));
|
- |
|
| 264 |
|
265 |
|
| 265 |
String amountInWords = toAmountInWords(pdfModel.getTotalAmount());
|
266 |
String amountInWords = toAmountInWords(pdfModel.getTotalAmount());
|
| 266 |
amountInWordsTable.addCell(new Paragraph(amountInWords.toString(), FONT_BOLD));
|
267 |
amountInWordsTable.addCell(new Paragraph(amountInWords.toString(), FONT_BOLD));
|
| 267 |
amountInWordsTable.addCell(new Paragraph("E & O.E", FONT_NORMAL));
|
268 |
amountInWordsTable.addCell(new Paragraph("E & O.E", FONT_NORMAL));
|
| 268 |
document.add(amountInWordsTable);
|
269 |
document.add(amountInWordsTable);
|
| - |
|
270 |
|
| - |
|
271 |
if(pdfModel.getPaymentOptions() != null) {
|
| - |
|
272 |
PdfPTable paidAmountTable = new PdfPTable(3);
|
| - |
|
273 |
paidAmountTable.setWidthPercentage(90);
|
| - |
|
274 |
paidAmountTable.setWidths(new float[] { 2, 5.2f, 0.8f });
|
| - |
|
275 |
if (!stateGst) {
|
| - |
|
276 |
paidAmountTable.setWidths(new float[] { 2, 5.1f, 0.9f });
|
| - |
|
277 |
} else {
|
| - |
|
278 |
paidAmountTable.setWidths(new float[] { 2, 5.2f, 0.8f });
|
| - |
|
279 |
}
|
| - |
|
280 |
Paragraph para = new Paragraph("Paid Through", FONT_BOLD);
|
| - |
|
281 |
paidAmountTable.addCell(para);
|
| - |
|
282 |
for(CustomPaymentOption paymentOption : pdfModel.getPaymentOptions()) {
|
| - |
|
283 |
PdfPCell cell = new PdfPCell(new Paragraph(10, paymentOption.getPaymentOption(), FONT_BOLD));
|
| - |
|
284 |
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
| - |
|
285 |
cell.setPadding(5);
|
| - |
|
286 |
paidAmountTable.addCell(cell);
|
| - |
|
287 |
|
| - |
|
288 |
PdfPCell cell1 = new PdfPCell(new Paragraph(10, FormattingUtils.formatDecimalTwoDigits(paymentOption.getAmount()), FONT_BOLD));
|
| - |
|
289 |
cell1.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
| - |
|
290 |
cell1.setPadding(5);
|
| - |
|
291 |
paidAmountTable.addCell(cell1);
|
| - |
|
292 |
|
| - |
|
293 |
}
|
| - |
|
294 |
document.add(paidAmountTable);
|
| - |
|
295 |
}
|
| 269 |
|
296 |
|
| 270 |
StringBuffer sb = new StringBuffer();
|
297 |
StringBuffer sb = new StringBuffer();
|
| 271 |
List<String> tncs = pdfModel.getTncs();
|
298 |
List<String> tncs = pdfModel.getTncs();
|
| 272 |
for (String tnc : tncs) {
|
299 |
for (String tnc : tncs) {
|
| 273 |
sb.append(tnc).append("\n");
|
300 |
sb.append(tnc).append("\n");
|