Subversion Repositories SmartDukaan

Rev

Rev 21844 | Rev 23081 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4687 mandeep.dh 1
package in.shop2020.inventory.service;
2
 
21844 amit.gupta 3
import in.shop2020.model.v1.catalog.CatalogServiceException;
4
import in.shop2020.model.v1.catalog.GstRate;
5
import in.shop2020.model.v1.catalog.StateGstRates;
6
import in.shop2020.model.v1.inventory.StateInfo;
7
import in.shop2020.model.v1.order.BuyerInfo;
8
import in.shop2020.model.v1.order.WarehouseAddress;
9
import in.shop2020.purchase.PurchaseOrder;
10
import in.shop2020.purchase.Supplier;
11
import in.shop2020.purchase.TaxType;
12
import in.shop2020.thrift.clients.CatalogClient;
13
import in.shop2020.thrift.clients.InventoryClient;
14
import in.shop2020.thrift.clients.TransactionClient;
15
 
4687 mandeep.dh 16
import java.io.ByteArrayOutputStream;
17
import java.io.File;
18
import java.io.FileOutputStream;
19
import java.io.IOException;
20
import java.text.DateFormat;
21844 amit.gupta 21
import java.text.MessageFormat;
14082 manish.sha 22
import java.util.Calendar;
4687 mandeep.dh 23
import java.util.Date;
14072 manish.sha 24
import java.util.Map;
4687 mandeep.dh 25
 
21844 amit.gupta 26
import org.apache.commons.lang.StringUtils;
14072 manish.sha 27
import org.apache.thrift.TException;
4687 mandeep.dh 28
import org.slf4j.Logger;
29
import org.slf4j.LoggerFactory;
30
 
31
import com.itextpdf.text.Document;
32
import com.itextpdf.text.Element;
33
import com.itextpdf.text.Font;
34
import com.itextpdf.text.Font.FontFamily;
35
import com.itextpdf.text.FontFactory;
36
import com.itextpdf.text.Paragraph;
37
import com.itextpdf.text.Phrase;
38
import com.itextpdf.text.Rectangle;
39
import com.itextpdf.text.pdf.PdfPCell;
40
import com.itextpdf.text.pdf.PdfPTable;
41
import com.itextpdf.text.pdf.PdfWriter;
19950 amit.gupta 42
 
4687 mandeep.dh 43
public class PdfPoSheetGenerator {
44
 
21844 amit.gupta 45
	private static Logger logger = LoggerFactory.getLogger(PdfPoSheetGenerator.class);
4687 mandeep.dh 46
 
21844 amit.gupta 47
	private static final Font helvetica8 = FontFactory.getFont(FontFactory.HELVETICA, 8);
4687 mandeep.dh 48
 
21844 amit.gupta 49
	private static final Font helveticaBold8 = FontFactory.getFont(FontFactory.HELVETICA_BOLD, 8);
50
	private static final Font helveticaBold12 = FontFactory.getFont(FontFactory.HELVETICA_BOLD, 12);
4687 mandeep.dh 51
 
21844 amit.gupta 52
	public static Map<Long, StateInfo> stateIdMap = null;
4687 mandeep.dh 53
 
21844 amit.gupta 54
	static String CONTACT_FORMAT = "Mr. {0}, Contact No. +91 {1}";
55
 
56
	static {
57
		try {
14072 manish.sha 58
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
59
			stateIdMap = inventoryClient.getStateMaster();
21844 amit.gupta 60
 
61
		} catch (Exception e) {
20025 amit.gupta 62
			logger.error("Unable to get State Info Map", e);
14072 manish.sha 63
		}
64
	}
65
 
21844 amit.gupta 66
	public static String generatePdfSheet(PurchaseOrder purchaseOrder, Supplier supplier) throws IOException {
67
		ByteArrayOutputStream baosPDF = null;
68
		try {
69
			in.shop2020.model.v1.order.TransactionService.Client tClient = new TransactionClient().getClient();
70
			BuyerInfo binfo = tClient.getBuyerByWarehouse(purchaseOrder.getWarehouseId());
71
			baosPDF = new ByteArrayOutputStream();
4687 mandeep.dh 72
 
21844 amit.gupta 73
			Document document = new Document();
74
			PdfWriter.getInstance(document, baosPDF);
75
			document.addAuthor("shop2020");
76
			document.addTitle("Purchase Order No: " + purchaseOrder.getPoNumber());
77
			document.open();
4687 mandeep.dh 78
 
21844 amit.gupta 79
			PdfPTable poTable = getPoTable(purchaseOrder, supplier, binfo);
80
			poTable.setSpacingAfter(10.0f);
81
			poTable.setWidthPercentage(100.0f);
4687 mandeep.dh 82
 
21844 amit.gupta 83
			document.add(poTable);
84
			document.close();
85
			baosPDF.close();
86
		} catch (Exception e) {
87
			logger.error("Error while generating Invoice: ", e);
88
			e.printStackTrace();
89
		}
4687 mandeep.dh 90
 
21844 amit.gupta 91
		String tmpDir = System.getProperty("java.io.tmpdir");
92
		String filename = tmpDir + "/po-" + purchaseOrder.getId() + ".pdf";
93
		File f = new File(filename);
94
		FileOutputStream fos = new FileOutputStream(f);
95
		baosPDF.writeTo(fos);
96
		return filename;
97
	}
4687 mandeep.dh 98
 
21844 amit.gupta 99
	private static PdfPTable getPoTable(PurchaseOrder purchaseOrder, Supplier supplier, BuyerInfo binfo) throws Exception {
100
		PdfPTable poTable = new PdfPTable(1);
101
		poTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
102
		poTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
4687 mandeep.dh 103
 
21844 amit.gupta 104
		PdfPCell poTitleCell = new PdfPCell(new Phrase("Purchase Order", helveticaBold12));
105
		poTitleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
106
		poTitleCell.setBorder(Rectangle.NO_BORDER);
4687 mandeep.dh 107
 
21844 amit.gupta 108
		long poValidityLimit = supplier.getPoValidityLimit();
109
		Calendar cal1 = Calendar.getInstance();
110
		cal1.setTimeInMillis(purchaseOrder.getCreatedAt());
111
		cal1.add(Calendar.DAY_OF_MONTH, (int) poValidityLimit);
112
		Date poDate = new Date(purchaseOrder.getCreatedAt());
113
		Date poExpiryDate = new Date(cal1.getTimeInMillis());
4687 mandeep.dh 114
 
21844 amit.gupta 115
		PdfPTable poSummaryTable = new PdfPTable(new float[] { 0.3f, 0.3f, 0.4f });
116
		poSummaryTable.addCell(new PdfPCell(new Phrase("PO No: " + purchaseOrder.getPoNumber())));
117
		poSummaryTable.addCell(new PdfPCell(new Phrase("Date: " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(poDate))));
118
		poSummaryTable.addCell(new PdfPCell(new Phrase("PO Valid for delivery by: "
119
				+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(poExpiryDate))));
120
		poSummaryTable.setSpacingBefore(10.0f);
4687 mandeep.dh 121
 
21844 amit.gupta 122
		poTable.addCell(poTitleCell);
123
		poTable.addCell(getAddressCell(purchaseOrder, binfo));
124
		poTable.addCell(poSummaryTable);
125
		poTable.addCell(getSalutationTable(supplier));
126
		poTable.addCell(getPoDetailsTable(purchaseOrder, supplier, binfo));
127
		poTable.addCell(getBillToTable(purchaseOrder));
128
		// poTable.addCell(getCFormCell(purchaseOrder.getTaxType()));
4687 mandeep.dh 129
 
21844 amit.gupta 130
		return poTable;
131
	}
9416 amar.kumar 132
 
21844 amit.gupta 133
	/*
134
	 * private static PdfPCell getCFormCell(TaxType taxType) { PdfPCell
135
	 * cFormCell = null; if(taxType == TaxType.CFORM) { cFormCell = new
136
	 * PdfPCell(new Paragraph("*To be billed on CST Against C-Form ", new
137
	 * Font(FontFamily.TIMES_ROMAN, 8f))); } else { cFormCell = new PdfPCell();
138
	 * } cFormCell.setBorder(Rectangle.NO_BORDER);
139
	 * cFormCell.setHorizontalAlignment(Element.ALIGN_LEFT); return cFormCell; }
140
	 */
141
 
142
	private static PdfPTable getAddressCell(PurchaseOrder purchaseOrder, BuyerInfo binfo) {
143
		// TODO Write this code in a proper configurable way
144
		String address = "";
145
		String tinNo = "";
146
		String shippingAddress = "";
147
		try {
148
			in.shop2020.model.v1.order.TransactionService.Client tClient = new TransactionClient().getClient();
20073 amit.gupta 149
			WarehouseAddress addr = tClient.getWarehouseAddress(purchaseOrder.getWarehouseAddressId());
20025 amit.gupta 150
			tinNo = binfo.getTin();
151
			address = binfo.getOrganisationName() + "\n" + addr.getAddress() + "\n" + "-" + addr.getPin();
21844 amit.gupta 152
		} catch (Exception e) {
153
			logger.error("This should not happen", e);
154
		}
155
 
156
		PdfPTable billToShipToTable = new PdfPTable(2);
157
		Paragraph addressParagraph = new Paragraph(address, new Font(FontFamily.TIMES_ROMAN, 8f));
158
		PdfPCell addressCell = new PdfPCell();
159
		if (purchaseOrder.getWarehouseId() != purchaseOrder.getShippingWarehouseId()) {
160
			addressParagraph = new Paragraph("Bill To :\n" + address + "\n\nTIN NO. " + tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
161
		}
162
		addressCell.addElement(addressParagraph);
163
		// addressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
164
		addressCell.setBorder(Rectangle.NO_BORDER);
165
 
166
		if (purchaseOrder.getWarehouseId() != purchaseOrder.getShippingWarehouseId()) {
167
			try {
168
				in.shop2020.model.v1.order.TransactionService.Client tClient = new TransactionClient().getClient();
169
				WarehouseAddress addr = tClient.getWarehouseAddress(purchaseOrder.getShippingWarehouseAddressId());
170
				address = binfo.getOrganisationName() + "\n" + addr.getAddress() + "\n" + "-" + addr.getPin();
171
			} catch (Exception e) {
172
				logger.error("This should not happen", e);
173
			}
9925 amar.kumar 174
			PdfPCell billToShipToCell = new PdfPCell();
175
			billToShipToCell.setHorizontalAlignment(Element.ALIGN_LEFT);
176
			billToShipToCell.setBorder(Rectangle.NO_BORDER);
21844 amit.gupta 177
 
9925 amar.kumar 178
			PdfPCell shippingAddressCell = new PdfPCell();
21844 amit.gupta 179
			shippingAddressCell.addElement(new Paragraph("Ship To :\n" + shippingAddress + "\nTIN NO. " + tinNo, new Font(
180
					FontFamily.TIMES_ROMAN, 8f)));
9925 amar.kumar 181
			shippingAddressCell.setHorizontalAlignment(Element.ALIGN_LEFT);
21844 amit.gupta 182
			shippingAddressCell.setBorder(Rectangle.LEFT);
183
			billToShipToTable.addCell(addressCell);
184
			billToShipToTable.addCell(shippingAddressCell);
185
			billToShipToCell.addElement(billToShipToTable);
186
			return billToShipToTable;
4687 mandeep.dh 187
 
21844 amit.gupta 188
		}
189
		billToShipToTable.addCell(addressCell);
190
		PdfPCell placeHolderCell = new PdfPCell();
191
		placeHolderCell.setBorder(Rectangle.NO_BORDER);
192
		billToShipToTable.addCell(placeHolderCell);
193
		return billToShipToTable;
194
	}
4687 mandeep.dh 195
 
21844 amit.gupta 196
	private static PdfPTable getSalutationTable(Supplier supplier) throws Exception {
197
		PdfPTable salutationTable = new PdfPTable(1);
198
		salutationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
199
		salutationTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
200
		salutationTable.addCell(new Phrase("To", helvetica8));
201
		if (supplier.getName().equals("Smobility Ltd.")) {
202
			salutationTable.addCell(new Phrase("Spice Retail Ltd.", helvetica8));
203
		} else if (supplier.getName().equals("Smobility Ltd. - Mumbai")) {
204
			salutationTable.addCell(new Phrase("Spice Retail Ltd. Mumbai", helvetica8));
205
		} else {
206
			salutationTable.addCell(new Phrase(supplier.getName(), helvetica8));
207
		}
4687 mandeep.dh 208
 
21844 amit.gupta 209
		salutationTable.addCell(new Paragraph(supplier.getCommunicationAddress(), helvetica8));
210
		salutationTable.addCell(new Phrase("Dear Sir/Madam", helveticaBold8));
211
		salutationTable.addCell(new Phrase("Please supply the following stocks as per the details given below:", helvetica8));
212
		salutationTable.addCell(new Phrase(" "));
213
		return salutationTable;
214
	}
215
 
216
	private static PdfPTable getPoDetailsTable(PurchaseOrder purchaseOrder, Supplier supplier, BuyerInfo binfo)
217
			throws CatalogServiceException, TException {
218
		float[] widths;
21854 amit.gupta 219
		TaxType taxType = purchaseOrder.getTaxType();
21844 amit.gupta 220
		if(taxType.equals(TaxType.SGST)){
221
			widths = new float[] { 0.05f, 0.25f, 0.09f, 0.1f, 0.09f, 0.09f, 0.09f, 0.07f, 0.1f, 0.07f, 0.1f };
222
		} else {
223
			widths = new float[] { 0.1f, 0.27f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.08f, 0.1f };
14072 manish.sha 224
		}
21844 amit.gupta 225
		PdfPTable detailsTable = new PdfPTable(widths);
226
 
227
		PdfPCell slNoCell = getHeaderCell("Sl. No");
228
		detailsTable.addCell(slNoCell);
229
 
230
		PdfPCell description = getHeaderCell("Description");
231
		detailsTable.addCell(description);
4687 mandeep.dh 232
 
21844 amit.gupta 233
 
234
		PdfPCell hsnCodeCell = getHeaderCell("HSN Code");
235
		detailsTable.addCell(hsnCodeCell);
236
 
237
		PdfPCell qtyCell = getHeaderCell("Qty");
238
		detailsTable.addCell(qtyCell);
239
 
240
		PdfPCell rateCell = getHeaderCell("Rate");
241
		detailsTable.addCell(rateCell);
242
 
243
		PdfPCell totalCell = getHeaderCell("Total Value");
244
		detailsTable.addCell(totalCell);
245
 
246
		PdfPCell taxableAmontCell = getHeaderCell("Taxable Value");
247
		taxableAmontCell.setRowspan(2);
248
		detailsTable.addCell(taxableAmontCell);
249
 
250
 
251
		if(taxType.equals(TaxType.SGST)) {
252
			PdfPCell cell1 = new PdfPCell(new Phrase("CGST", helveticaBold8));
253
			cell1.setColspan(2);
254
			cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
255
			detailsTable.addCell(cell1);
256
 
257
			PdfPCell cell2 = new PdfPCell(new Phrase("SGST", helveticaBold8));
258
			cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
259
			cell2.setColspan(2);
260
			detailsTable.addCell(cell2);
261
		} else {
262
			PdfPCell cell3 = new PdfPCell(new Phrase("IGST", helveticaBold8));
263
			cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
264
			cell3.setRowspan(2);
21854 amit.gupta 265
			detailsTable.addCell(cell3);
21844 amit.gupta 266
		}
267
 
268
		if(taxType.equals(TaxType.SGST)) {
269
			detailsTable.addCell(new Phrase("Rate(%)", helveticaBold8));
270
			detailsTable.addCell(new Phrase("Amount", helveticaBold8));
271
			detailsTable.addCell(new Phrase("Rate(%)", helveticaBold8));
272
			detailsTable.addCell(new Phrase("Amount", helveticaBold8));
273
		}else {
274
			detailsTable.addCell(new Phrase("Rate(%)", helveticaBold8));
275
			detailsTable.addCell(new Phrase("Amount", helveticaBold8));
276
		}
277
 
278
		int slNo = 0;
279
		double total = 0;
280
		double vatFactor = 0;
281
		double totalUnits = 0;
282
		String stateCode = null;
283
		CatalogClient cClient = new CatalogClient();
284
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = cClient.getClient();
285
		for (in.shop2020.purchase.LineItem lineitem : purchaseOrder.getLineitems()) {
286
			slNo++;
287
			detailsTable.addCell(new Phrase(slNo + "", helvetica8));
288
			detailsTable.addCell(getProductNameCell(lineitem));
289
			detailsTable.addCell(new Phrase(lineitem.getHsnCode(), helvetica8));
290
			detailsTable.addCell(new Phrase(String.format("%d Units", (int)lineitem.getQuantity()), helvetica8));
291
			detailsTable.addCell(new Phrase(String.format("%.2f", lineitem.getUnitPrice()), helvetica8));
292
 
293
			double totalAmount = lineitem.getUnitPrice()*lineitem.getQuantity();
294
			detailsTable.addCell(new Phrase(String.format("%.2f", totalAmount), helvetica8));
295
 
296
			double totalTaxRate = lineitem.getIgstRate() + lineitem.getSgstRate() + lineitem.getCgstRate();
297
			double taxableAmount = totalAmount / (1 + (totalTaxRate / 100));
298
			detailsTable.addCell(new Phrase(String.format("%.2f", taxableAmount), helvetica8));
299
 
300
			if(purchaseOrder.getTaxType().equals(TaxType.SGST)) {
301
				double cgstAmount = taxableAmount * (lineitem.getCgstRate() / 100);
302
				detailsTable.addCell(new Phrase(String.format("%.2f", lineitem.getCgstRate()), helvetica8));
303
				detailsTable.addCell(new Phrase(String.format("%.2f", cgstAmount), helvetica8));
304
 
305
				double sgstAmount = taxableAmount * (lineitem.getSgstRate() / 100);
306
				detailsTable.addCell(new Phrase(String.format("%.2f", lineitem.getSgstRate()), helvetica8));
307
				detailsTable.addCell(new Phrase(String.format("%.2f", sgstAmount), helvetica8));
308
			} else {
309
				double igstAmount = taxableAmount * (lineitem.getIgstRate() / 100);
310
				detailsTable.addCell(new Phrase(String.format("%.2f", lineitem.getIgstRate()), helvetica8));
311
				detailsTable.addCell(new Phrase(String.format("%.2f", igstAmount), helvetica8));
312
			}
313
 
314
			totalUnits += lineitem.getQuantity();
315
			total += totalAmount;
316
		}
317
		detailsTable.addCell(getTotalCell(2));
318
		detailsTable.addCell(new Phrase(String.format("%.0f", totalUnits), helvetica8));
319
		detailsTable.addCell(getTotalAmountCell(6, total));
320
		return detailsTable;
321
	}
322
 
323
	private static PdfPCell getHeaderCell(String headerName) {
324
		PdfPCell cell = new PdfPCell(new Phrase(headerName, helveticaBold8));
325
		cell.setRowspan(2);
326
		cell.setHorizontalAlignment(Element.ALIGN_CENTER);
327
		cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
328
		return cell;
329
	}
330
 
331
	private static PdfPTable getBillToTable(PurchaseOrder po) {
332
		// TODO Write this code in a proper configurable way
333
		String address = "";
334
		String gstin = "";
335
		String contactPerson = "Neeraj Gupta";
336
		String contactNumber = "9873802000";
337
		BuyerInfo binfo = new BuyerInfo();
338
		try {
339
			in.shop2020.model.v1.order.TransactionService.Client tClient = new TransactionClient().getClient();
20067 amit.gupta 340
			binfo = tClient.getBuyerByWarehouse(po.getWarehouseId());
21844 amit.gupta 341
			gstin = binfo.getGstin();
20067 amit.gupta 342
			WarehouseAddress addr = tClient.getWarehouseAddress(po.getWarehouseAddressId());
343
			address = binfo.getOrganisationName() + "\n" + addr.getAddress() + "\n" + "-" + addr.getPin();
21844 amit.gupta 344
			if (StringUtils.isNotBlank(addr.getContact_person())) {
345
				contactPerson = addr.getContact_person();
346
			}
347
			if (StringUtils.isNotBlank(addr.getContact_number())) {
348
				contactNumber = addr.getContact_number();
349
			}
350
		} catch (Exception e) {
351
			logger.error("This should not happen", e);
352
		}
7410 amar.kumar 353
 
21844 amit.gupta 354
		contactPerson = MessageFormat.format(CONTACT_FORMAT, contactPerson, contactNumber);
355
		PdfPTable billToTable = new PdfPTable(new float[] { 0.2f, 0.8f });
356
		billToTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
4687 mandeep.dh 357
 
21844 amit.gupta 358
		billToTable.addCell(new Phrase("Bill To :", helvetica8));
359
		billToTable.addCell(new PdfPCell(new Paragraph(address 
360
				+ "\n\nPlace of Supply - " 
361
				+ MessageFormat.format("{0}({1})", stateIdMap.get(binfo.getStateId()).getStateName(),stateIdMap.get(binfo.getStateId()).getStateCode())
362
				+ "\nGST NO. " + gstin, helvetica8)));
4687 mandeep.dh 363
 
21844 amit.gupta 364
		billToTable.addCell(new Phrase("Contact Person:", helvetica8));
365
		billToTable.addCell(new Phrase(contactPerson, helvetica8));
4687 mandeep.dh 366
 
21844 amit.gupta 367
		billToTable.addCell(new Phrase("Taxes:", helvetica8));
368
		if (po.getTaxType() == TaxType.CFORM) {
369
			billToTable.addCell(new Phrase("Prices inclusive of all taxes (To be billed on CST Against C-Form)", helvetica8));
370
		} else {
371
			billToTable.addCell(new Phrase("Prices inclusive of all taxes", helvetica8));
372
		}
4687 mandeep.dh 373
 
21844 amit.gupta 374
		return billToTable;
375
	}
4687 mandeep.dh 376
 
21844 amit.gupta 377
	private static PdfPCell getProductNameCell(in.shop2020.purchase.LineItem lineitem) {
378
		String itemName = getItemDisplayName(lineitem);
379
		PdfPCell productNameCell = new PdfPCell(new Phrase(itemName, helvetica8));
380
		productNameCell.setHorizontalAlignment(Element.ALIGN_LEFT);
381
		return productNameCell;
382
	}
4687 mandeep.dh 383
 
21844 amit.gupta 384
	private static String getItemDisplayName(in.shop2020.purchase.LineItem lineitem) {
385
		StringBuffer itemName = new StringBuffer();
386
		if (lineitem.getBrand() != null)
387
			itemName.append(lineitem.getBrand() + " ");
388
		if (lineitem.getModelName() != null)
389
			itemName.append(lineitem.getModelName() + " ");
390
		if (lineitem.getModelNumber() != null)
391
			itemName.append(lineitem.getModelNumber() + " ");
392
		if (lineitem.getColor() != null && !lineitem.getColor().trim().equals("NA"))
393
			itemName.append("(" + lineitem.getColor() + ")");
4687 mandeep.dh 394
 
21844 amit.gupta 395
		return itemName.toString();
396
	}
4687 mandeep.dh 397
 
21844 amit.gupta 398
	private static PdfPCell getTotalCell(int colspan) {
399
		PdfPCell totalCell = new PdfPCell(new Phrase("Total", helveticaBold8));
400
		totalCell.setColspan(colspan);
401
		totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
402
		return totalCell;
403
	}
4687 mandeep.dh 404
 
21844 amit.gupta 405
	private static PdfPCell getTotalAmountCell(int colspan, double totalAmount) {
406
		PdfPCell totalCell = new PdfPCell(new Phrase(String.format("%.2f", totalAmount), helvetica8));
407
		totalCell.setColspan(colspan);
408
		totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
409
		return totalCell;
410
	}
411
 
4687 mandeep.dh 412
}