| 4687 |
mandeep.dh |
1 |
package in.shop2020.inventory.service;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.purchase.PurchaseOrder;
|
|
|
4 |
import in.shop2020.purchase.Supplier;
|
| 9416 |
amar.kumar |
5 |
import in.shop2020.purchase.TaxType;
|
| 4687 |
mandeep.dh |
6 |
|
|
|
7 |
import java.io.ByteArrayOutputStream;
|
|
|
8 |
import java.io.File;
|
|
|
9 |
import java.io.FileOutputStream;
|
|
|
10 |
import java.io.IOException;
|
|
|
11 |
import java.text.DateFormat;
|
|
|
12 |
import java.util.Date;
|
|
|
13 |
|
|
|
14 |
import org.slf4j.Logger;
|
|
|
15 |
import org.slf4j.LoggerFactory;
|
|
|
16 |
|
|
|
17 |
import com.itextpdf.text.Document;
|
|
|
18 |
import com.itextpdf.text.Element;
|
|
|
19 |
import com.itextpdf.text.Font;
|
|
|
20 |
import com.itextpdf.text.Font.FontFamily;
|
|
|
21 |
import com.itextpdf.text.FontFactory;
|
|
|
22 |
import com.itextpdf.text.Paragraph;
|
|
|
23 |
import com.itextpdf.text.Phrase;
|
|
|
24 |
import com.itextpdf.text.Rectangle;
|
|
|
25 |
import com.itextpdf.text.pdf.PdfPCell;
|
|
|
26 |
import com.itextpdf.text.pdf.PdfPTable;
|
|
|
27 |
import com.itextpdf.text.pdf.PdfWriter;
|
|
|
28 |
|
|
|
29 |
public class PdfPoSheetGenerator {
|
|
|
30 |
|
|
|
31 |
private static Logger logger = LoggerFactory
|
|
|
32 |
.getLogger(PdfPoSheetGenerator.class);
|
|
|
33 |
|
|
|
34 |
// private static final Properties properties = readProperties();
|
| 7410 |
amar.kumar |
35 |
private static final String ourAddressDelhi = "Spice Online Retail Pvt. Ltd.\nC/O,PIBCO LIMITED, Basement,Punjsons\n2,Kalkaji Industrial Area, New Delhi-110019\n";
|
| 7676 |
amar.kumar |
36 |
private static final String ourAddressBhiwandi = "Spice Online Retail Pvt. Ltd.\nC/O. FedEx Express Transportation and Supply Chain Services (India) Private Limited.\nC/O NDR WAREHOUSING, SURVEY NO.95, MUMBAI - NASIK HIGHWAY, WADAPE VILLAGE\nBHIWANDI (NR. SAI DHABA), Thane,Maharashtra -421302\n";
|
| 7410 |
amar.kumar |
37 |
private static final String ourAddressGoregaon = "Spice Online Retail Pvt. Ltd.\n93/743, Motilal Nagar-1, Goregaon(WEST),\nMotilal Nagar, Mumbai, Maharashtra-400062\n";
|
| 10877 |
manish.sha |
38 |
private static final String ourAddressBangalore = "Spice Online Retail Pvt. Ltd.\n C/O.Drive India Enterprise Solutions Limited)\n Survey No. 86, Korulur Village, Kasab Hobli\n Hoskote Taluka\n Bangalore – 560067, Karnataka\n";
|
|
|
39 |
private static final String ourAddressBangaloreSR = "Spice Online Retail Pvt. Ltd.\n Shop No. 320, Municipal 59th Cross,\n Next to Rammandir Ground,\n 3rd Block, Rajaji Nagar,\nBangalore - 560010, Karnataka\n";
|
| 12543 |
manish.sha |
40 |
private static final String ourAddressGurgaon = "Spice online Retail Private Limited,\n SHOP NO. 10 & 11,\n OLD DELHI ROAD,OPP SECTOR-14, GURGAON-122001 Haryana\n";
|
| 10877 |
manish.sha |
41 |
|
| 9925 |
amar.kumar |
42 |
private static final String amazonAddress = "Spice Online Retail Pvt. Ltd. C/O Amazon Seller Services Pvt. Ltd.,\nBuilding H Prathmesh Complex, Saravali Village,\nOpp Hotel Vatika Kalyan, Bhivandi Junction,\nBhiwandi, Maharashtra\n";
|
| 10877 |
manish.sha |
43 |
private static final String amazonAddreseBangalore = "Spice Online Retail Pvt. Ltd.\n C/O Amazon Seller Services Pvt. Ltd.\n 38 & 39, Soukya Road,\n kacherakanahalli,\n Hoskote Taluka,\n Bangalore -560067, Karnataka\n";
|
| 12752 |
manish.sha |
44 |
private static final String amazonAddressMewat = "Spice Online Retail Pvt. Ltd.\n C/O AMAZON Seller Services Pvt. Limited,\n Gokaldas Warehousing Corporation, Unit No 1,\n Village Taoru, Tehsil Taoru, Distt Mewat - 122105";
|
| 12543 |
manish.sha |
45 |
private static final String flipkartAddressGgn = "Spice Online Retail Pvt. Ltd.\n C/O. Flipkart Internet Pvt. Ltd, \n KILLA NO.219/15-16 25/1 220/11 12/1 12/2 13/1/113/1/2 20 21/1 21/2/1 22/1 23/1/1,\n Bohra Kalan, PATAUDI, GURGAON - 122001, Haryana\n";
|
| 7410 |
amar.kumar |
46 |
private static final String tinNoDelhi = "07250399732";
|
|
|
47 |
private static final String tinNoMum = "27450984008";
|
| 10877 |
manish.sha |
48 |
private static final String tinNoBan = "29171183852";
|
| 12543 |
manish.sha |
49 |
private static final String tinNoFkGgn = "06681944625";
|
|
|
50 |
private static final String tinNoOurGgn = "06681944625";
|
|
|
51 |
|
| 4687 |
mandeep.dh |
52 |
|
|
|
53 |
private static final Font helvetica8 = FontFactory.getFont(
|
|
|
54 |
FontFactory.HELVETICA, 8);
|
|
|
55 |
|
|
|
56 |
private static final Font helveticaBold8 = FontFactory.getFont(
|
|
|
57 |
FontFactory.HELVETICA_BOLD, 8);
|
|
|
58 |
private static final Font helveticaBold12 = FontFactory.getFont(
|
|
|
59 |
FontFactory.HELVETICA_BOLD, 12);
|
|
|
60 |
|
|
|
61 |
public static String generatePdfSheet(PurchaseOrder purchaseOrder,
|
|
|
62 |
Supplier supplier) throws IOException {
|
|
|
63 |
ByteArrayOutputStream baosPDF = null;
|
|
|
64 |
try {
|
|
|
65 |
baosPDF = new ByteArrayOutputStream();
|
|
|
66 |
|
|
|
67 |
Document document = new Document();
|
|
|
68 |
PdfWriter.getInstance(document, baosPDF);
|
|
|
69 |
document.addAuthor("shop2020");
|
|
|
70 |
document.addTitle("Purchase Order No: "
|
|
|
71 |
+ purchaseOrder.getPoNumber());
|
|
|
72 |
document.open();
|
|
|
73 |
|
|
|
74 |
PdfPTable poTable = getPoTable(purchaseOrder, supplier);
|
|
|
75 |
poTable.setSpacingAfter(10.0f);
|
|
|
76 |
poTable.setWidthPercentage(90.0f);
|
|
|
77 |
|
|
|
78 |
document.add(poTable);
|
|
|
79 |
document.close();
|
|
|
80 |
baosPDF.close();
|
|
|
81 |
} catch (Exception e) {
|
|
|
82 |
logger.error("Error while generating Invoice: ", e);
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
String tmpDir = System.getProperty("java.io.tmpdir");
|
|
|
86 |
String filename = tmpDir + "/po-" + purchaseOrder.getId() + ".pdf";
|
|
|
87 |
File f = new File(filename);
|
|
|
88 |
FileOutputStream fos = new FileOutputStream(f);
|
|
|
89 |
baosPDF.writeTo(fos);
|
|
|
90 |
return filename;
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
private static PdfPTable getPoTable(PurchaseOrder purchaseOrder,
|
|
|
94 |
Supplier supplier) throws Exception {
|
|
|
95 |
PdfPTable poTable = new PdfPTable(1);
|
|
|
96 |
poTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
|
|
97 |
poTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
98 |
|
|
|
99 |
PdfPCell poTitleCell = new PdfPCell(new Phrase("Purchase Order",
|
|
|
100 |
helveticaBold12));
|
|
|
101 |
poTitleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
102 |
poTitleCell.setBorder(Rectangle.NO_BORDER);
|
|
|
103 |
|
|
|
104 |
Date poDate = new Date(purchaseOrder.getCreatedAt());
|
|
|
105 |
PdfPTable poSummaryTable = new PdfPTable(new float[] { 0.5f, 0.5f });
|
|
|
106 |
poSummaryTable.addCell(new PdfPCell(new Phrase("PO No: "
|
|
|
107 |
+ purchaseOrder.getPoNumber())));
|
| 9416 |
amar.kumar |
108 |
poSummaryTable.addCell(new PdfPCell(new Phrase("Date: "
|
|
|
109 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
|
|
110 |
poDate))));
|
| 4687 |
mandeep.dh |
111 |
poSummaryTable.setSpacingBefore(10.0f);
|
|
|
112 |
|
|
|
113 |
poTable.addCell(poTitleCell);
|
| 9925 |
amar.kumar |
114 |
poTable.addCell(getAddressCell(purchaseOrder.getWarehouseId(), purchaseOrder.getShippingWarehouseId()));
|
| 4687 |
mandeep.dh |
115 |
poTable.addCell(poSummaryTable);
|
|
|
116 |
poTable.addCell(getSalutationTable(supplier));
|
|
|
117 |
poTable.addCell(getPoDetailsTable(purchaseOrder));
|
| 9591 |
amar.kumar |
118 |
poTable.addCell(getBillToTable(purchaseOrder.getWarehouseId(), purchaseOrder.getTaxType()));
|
|
|
119 |
//poTable.addCell(getCFormCell(purchaseOrder.getTaxType()));
|
| 4687 |
mandeep.dh |
120 |
|
|
|
121 |
return poTable;
|
|
|
122 |
}
|
|
|
123 |
|
| 9416 |
amar.kumar |
124 |
private static PdfPCell getCFormCell(TaxType taxType) {
|
|
|
125 |
PdfPCell cFormCell = null;
|
|
|
126 |
if(taxType == TaxType.CFORM) {
|
| 9586 |
amar.kumar |
127 |
cFormCell = new PdfPCell(new Paragraph("*To be billed on CST Against C-Form ", new Font(FontFamily.TIMES_ROMAN, 8f)));
|
| 9416 |
amar.kumar |
128 |
} else {
|
|
|
129 |
cFormCell = new PdfPCell();
|
|
|
130 |
}
|
|
|
131 |
cFormCell.setBorder(Rectangle.NO_BORDER);
|
|
|
132 |
cFormCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
133 |
return cFormCell;
|
|
|
134 |
}
|
|
|
135 |
|
| 9925 |
amar.kumar |
136 |
private static PdfPTable getAddressCell(long warehouseId, long shippingWarehouseId) {
|
| 7410 |
amar.kumar |
137 |
//TODO Write this code in a proper configurable way
|
|
|
138 |
String address = "";
|
|
|
139 |
String tinNo = "";
|
| 9925 |
amar.kumar |
140 |
String shippingAddress = "";
|
|
|
141 |
String shippingTinNo = "";
|
| 7410 |
amar.kumar |
142 |
if(warehouseId ==7) {
|
|
|
143 |
address = ourAddressDelhi;
|
|
|
144 |
tinNo = tinNoDelhi;
|
|
|
145 |
} else if(warehouseId == 12) {
|
|
|
146 |
address = ourAddressGoregaon;
|
|
|
147 |
tinNo = tinNoMum;
|
|
|
148 |
} else if(warehouseId == 13) {
|
|
|
149 |
address = ourAddressBhiwandi;
|
|
|
150 |
tinNo = tinNoMum;
|
| 7466 |
amar.kumar |
151 |
} else if(warehouseId ==16) {
|
| 7464 |
amar.kumar |
152 |
address = amazonAddress;
|
|
|
153 |
tinNo = tinNoMum;
|
| 10877 |
manish.sha |
154 |
} else if(warehouseId ==1765){
|
|
|
155 |
address = ourAddressBangalore;
|
|
|
156 |
tinNo = tinNoBan;
|
|
|
157 |
} else if(warehouseId ==1768){
|
|
|
158 |
address = ourAddressBangaloreSR;
|
|
|
159 |
tinNo = tinNoBan;
|
|
|
160 |
} else if(warehouseId ==1771){
|
|
|
161 |
address = amazonAddreseBangalore;
|
|
|
162 |
tinNo = tinNoBan;
|
| 12543 |
manish.sha |
163 |
} else if(warehouseId == 2854){
|
|
|
164 |
address = flipkartAddressGgn;
|
|
|
165 |
tinNo = tinNoFkGgn;
|
|
|
166 |
} else if(warehouseId == 2857){
|
|
|
167 |
address = ourAddressGurgaon;
|
|
|
168 |
tinNo = tinNoOurGgn;
|
| 7410 |
amar.kumar |
169 |
}
|
| 9925 |
amar.kumar |
170 |
PdfPTable billToShipToTable = new PdfPTable(2);
|
| 7410 |
amar.kumar |
171 |
Paragraph addressParagraph = new Paragraph(address + "\nTIN NO. "
|
| 4687 |
mandeep.dh |
172 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
|
|
173 |
PdfPCell addressCell = new PdfPCell();
|
| 9925 |
amar.kumar |
174 |
if(warehouseId != shippingWarehouseId) {
|
|
|
175 |
addressParagraph = new Paragraph("Bill To :\n" + address + "\n\nTIN NO. "
|
|
|
176 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
|
|
177 |
}
|
| 4687 |
mandeep.dh |
178 |
addressCell.addElement(addressParagraph);
|
| 9925 |
amar.kumar |
179 |
//addressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
| 4687 |
mandeep.dh |
180 |
addressCell.setBorder(Rectangle.NO_BORDER);
|
| 9925 |
amar.kumar |
181 |
|
|
|
182 |
if(warehouseId != shippingWarehouseId) {
|
|
|
183 |
if(shippingWarehouseId ==7) {
|
|
|
184 |
shippingAddress = ourAddressDelhi;
|
|
|
185 |
shippingTinNo = tinNoDelhi;
|
|
|
186 |
} else if(shippingWarehouseId == 12) {
|
|
|
187 |
shippingAddress = ourAddressGoregaon;
|
|
|
188 |
shippingTinNo = tinNoMum;
|
|
|
189 |
} else if(shippingWarehouseId == 13) {
|
|
|
190 |
shippingAddress = ourAddressBhiwandi;
|
|
|
191 |
shippingTinNo = tinNoMum;
|
|
|
192 |
} else if(shippingWarehouseId ==16) {
|
|
|
193 |
shippingAddress = amazonAddress;
|
|
|
194 |
shippingTinNo = tinNoMum;
|
| 10877 |
manish.sha |
195 |
} else if(shippingWarehouseId ==1765){
|
|
|
196 |
shippingAddress = ourAddressBangalore;
|
|
|
197 |
shippingTinNo = tinNoBan;
|
|
|
198 |
} else if(shippingWarehouseId ==1768){
|
|
|
199 |
shippingAddress = ourAddressBangaloreSR;
|
|
|
200 |
shippingTinNo = tinNoBan;
|
|
|
201 |
} else if(shippingWarehouseId ==1771){
|
|
|
202 |
shippingAddress = amazonAddreseBangalore;
|
|
|
203 |
shippingTinNo = tinNoBan;
|
| 12543 |
manish.sha |
204 |
} else if(shippingWarehouseId == 2854){
|
|
|
205 |
shippingAddress = flipkartAddressGgn;
|
|
|
206 |
shippingTinNo = tinNoFkGgn;
|
|
|
207 |
} else if(shippingWarehouseId == 2857){
|
|
|
208 |
shippingAddress = ourAddressGurgaon;
|
|
|
209 |
shippingTinNo = tinNoOurGgn;
|
| 12729 |
manish.sha |
210 |
} else if(shippingWarehouseId == 3295){
|
|
|
211 |
shippingAddress = amazonAddressMewat;
|
|
|
212 |
shippingTinNo = tinNoOurGgn;
|
| 9925 |
amar.kumar |
213 |
}
|
|
|
214 |
|
|
|
215 |
PdfPCell billToShipToCell = new PdfPCell();
|
|
|
216 |
billToShipToCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
217 |
billToShipToCell.setBorder(Rectangle.NO_BORDER);
|
|
|
218 |
|
|
|
219 |
PdfPCell shippingAddressCell = new PdfPCell();
|
|
|
220 |
shippingAddressCell.addElement(new Paragraph("Ship To :\n" +shippingAddress + "\nTIN NO. "
|
|
|
221 |
+ shippingTinNo, new Font(FontFamily.TIMES_ROMAN, 8f)));
|
|
|
222 |
shippingAddressCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
223 |
shippingAddressCell.setBorder(Rectangle.LEFT);
|
|
|
224 |
billToShipToTable.addCell(addressCell);
|
|
|
225 |
billToShipToTable.addCell(shippingAddressCell);
|
|
|
226 |
billToShipToCell.addElement(billToShipToTable);
|
|
|
227 |
return billToShipToTable;
|
|
|
228 |
|
|
|
229 |
}
|
|
|
230 |
billToShipToTable.addCell(addressCell);
|
|
|
231 |
PdfPCell placeHolderCell = new PdfPCell();
|
|
|
232 |
placeHolderCell.setBorder(Rectangle.NO_BORDER);
|
|
|
233 |
billToShipToTable.addCell(placeHolderCell);
|
|
|
234 |
return billToShipToTable;
|
| 4687 |
mandeep.dh |
235 |
}
|
|
|
236 |
|
|
|
237 |
private static PdfPTable getSalutationTable(Supplier supplier)
|
|
|
238 |
throws Exception {
|
|
|
239 |
PdfPTable salutationTable = new PdfPTable(1);
|
|
|
240 |
salutationTable.getDefaultCell().setHorizontalAlignment(
|
|
|
241 |
Element.ALIGN_LEFT);
|
|
|
242 |
salutationTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
|
|
243 |
salutationTable.addCell(new Phrase("To", helvetica8));
|
| 8712 |
amar.kumar |
244 |
if(supplier.getName().equals("Smobility Ltd.")) {
|
|
|
245 |
salutationTable.addCell(new Phrase("Spice Retail Ltd.", helvetica8));
|
| 8713 |
amar.kumar |
246 |
} else if(supplier.getName().equals("Smobility Ltd. - Mumbai")) {
|
|
|
247 |
salutationTable.addCell(new Phrase("Spice Retail Ltd. Mumbai", helvetica8));
|
| 8712 |
amar.kumar |
248 |
} else {
|
|
|
249 |
salutationTable.addCell(new Phrase(supplier
|
|
|
250 |
.getName(), helvetica8));
|
|
|
251 |
}
|
|
|
252 |
|
| 4687 |
mandeep.dh |
253 |
salutationTable.addCell(new Paragraph(supplier
|
|
|
254 |
.getCommunicationAddress(), helvetica8));
|
|
|
255 |
salutationTable.addCell(new Phrase("Dear Sir/Madam", helveticaBold8));
|
|
|
256 |
salutationTable
|
|
|
257 |
.addCell(new Phrase(
|
|
|
258 |
"Please supply the following stocks as per the details given below:",
|
|
|
259 |
helvetica8));
|
|
|
260 |
salutationTable.addCell(new Phrase(" "));
|
|
|
261 |
return salutationTable;
|
|
|
262 |
}
|
|
|
263 |
|
|
|
264 |
private static PdfPTable getPoDetailsTable(PurchaseOrder purchaseOrder) {
|
|
|
265 |
PdfPTable detailsTable = new PdfPTable(new float[] { 0.1f, 0.5f, 0.1f,
|
| 9591 |
amar.kumar |
266 |
0.1f, 0.15f, 0.15f });
|
| 4687 |
mandeep.dh |
267 |
detailsTable.addCell(new Phrase("Sl. No.", helveticaBold8));
|
|
|
268 |
detailsTable.addCell(new Phrase("Description", helveticaBold8));
|
|
|
269 |
detailsTable.addCell(new Phrase("Quantity", helveticaBold8));
|
| 9591 |
amar.kumar |
270 |
detailsTable.addCell(new Phrase("Mrp", helveticaBold8));
|
| 4687 |
mandeep.dh |
271 |
detailsTable.addCell(new Phrase("Rate (Rs)", helveticaBold8));
|
|
|
272 |
detailsTable.addCell(new Phrase("Amount (Rs)", helveticaBold8));
|
|
|
273 |
|
|
|
274 |
int slNo = 0;
|
|
|
275 |
double total = 0;
|
|
|
276 |
for (in.shop2020.purchase.LineItem lineitem : purchaseOrder
|
|
|
277 |
.getLineitems()) {
|
|
|
278 |
slNo++;
|
|
|
279 |
detailsTable.addCell(new Phrase(slNo + "", helvetica8));
|
|
|
280 |
detailsTable.addCell(getProductNameCell(lineitem));
|
|
|
281 |
detailsTable.addCell(new Phrase(lineitem.getQuantity() + "",
|
|
|
282 |
helvetica8));
|
| 9591 |
amar.kumar |
283 |
detailsTable.addCell(new Phrase(lineitem.getMrp() + "",
|
|
|
284 |
helvetica8));
|
| 4687 |
mandeep.dh |
285 |
detailsTable.addCell(new Phrase(lineitem.getUnitPrice() + "",
|
|
|
286 |
helvetica8));
|
|
|
287 |
double lineTotal = lineitem.getQuantity() * lineitem.getUnitPrice();
|
|
|
288 |
total += lineTotal;
|
|
|
289 |
detailsTable.addCell(new Phrase("" + lineTotal, helvetica8));
|
|
|
290 |
}
|
| 9634 |
amar.kumar |
291 |
detailsTable.addCell(getTotalCell(5));
|
| 4687 |
mandeep.dh |
292 |
detailsTable.addCell(new Phrase("" + total, helvetica8));
|
|
|
293 |
return detailsTable;
|
|
|
294 |
}
|
|
|
295 |
|
| 9591 |
amar.kumar |
296 |
private static PdfPTable getBillToTable(long warehouseId, TaxType taxType) {
|
| 7410 |
amar.kumar |
297 |
//TODO Write this code in a proper configurable way
|
|
|
298 |
String address = "";
|
|
|
299 |
String tinNo = "";
|
|
|
300 |
String contactPerson = "";
|
|
|
301 |
if(warehouseId ==7) {
|
|
|
302 |
address = ourAddressDelhi;
|
|
|
303 |
tinNo = tinNoDelhi;
|
| 12729 |
manish.sha |
304 |
contactPerson = "Mr. Shiv Kumar, Contact No. +91 9953858076";
|
| 7410 |
amar.kumar |
305 |
} else if(warehouseId == 12) {
|
|
|
306 |
address = ourAddressGoregaon;
|
|
|
307 |
tinNo = tinNoMum;
|
| 7421 |
amar.kumar |
308 |
contactPerson = "Mr. Avinash Sambhaji Lavange, Contact No. +91 9004049589";
|
| 7410 |
amar.kumar |
309 |
} else if(warehouseId == 13) {
|
|
|
310 |
address = ourAddressBhiwandi;
|
|
|
311 |
tinNo = tinNoMum;
|
| 12729 |
manish.sha |
312 |
contactPerson = "Mr. Vishal Tayade, Contact No. +91 9819231651";
|
| 7466 |
amar.kumar |
313 |
} else if(warehouseId ==16) {
|
|
|
314 |
address = amazonAddress;
|
|
|
315 |
tinNo = tinNoMum;
|
|
|
316 |
contactPerson = "Mr. Sandeep Sachdeva, Contact No. +91 9716691287";
|
| 10877 |
manish.sha |
317 |
} else if(warehouseId ==16) {
|
|
|
318 |
address = amazonAddress;
|
|
|
319 |
tinNo = tinNoMum;
|
|
|
320 |
contactPerson = "Mr. Sandeep Sachdeva, Contact No. +91 9716691287";
|
|
|
321 |
} else if(warehouseId ==16) {
|
|
|
322 |
address = amazonAddress;
|
|
|
323 |
tinNo = tinNoMum;
|
|
|
324 |
contactPerson = "Mr. Sandeep Sachdeva, Contact No. +91 9716691287";
|
| 7410 |
amar.kumar |
325 |
}
|
| 10877 |
manish.sha |
326 |
else if(warehouseId ==1765) {
|
|
|
327 |
address = ourAddressBangalore;
|
|
|
328 |
tinNo = tinNoBan;
|
| 12729 |
manish.sha |
329 |
contactPerson = "Mr. Ravi Kumar, Contact No. +91 9686392567";
|
| 10877 |
manish.sha |
330 |
}
|
|
|
331 |
else if(warehouseId ==1768) {
|
|
|
332 |
address = ourAddressBangaloreSR;
|
|
|
333 |
tinNo = tinNoBan;
|
| 12729 |
manish.sha |
334 |
contactPerson = "Mr. Ravi Kumar, Contact No. +91 9686392567";
|
| 10877 |
manish.sha |
335 |
}
|
|
|
336 |
else if(warehouseId ==1771) {
|
|
|
337 |
address = amazonAddreseBangalore;
|
|
|
338 |
tinNo = tinNoBan;
|
| 12729 |
manish.sha |
339 |
contactPerson = "Mr. Ravi Kumar, Contact No. +91 9686392567";
|
| 10877 |
manish.sha |
340 |
}
|
| 12543 |
manish.sha |
341 |
else if(warehouseId ==2854) {
|
|
|
342 |
address = flipkartAddressGgn;
|
|
|
343 |
tinNo = tinNoFkGgn;
|
|
|
344 |
contactPerson = "Mr. Sandeep Sachdeva, Contact No. +91 9716691287";
|
|
|
345 |
}
|
|
|
346 |
else if(warehouseId ==2857) {
|
|
|
347 |
address = ourAddressGurgaon;
|
|
|
348 |
tinNo = tinNoOurGgn;
|
|
|
349 |
contactPerson = "Mr. Sandeep Sachdeva, Contact No. +91 9716691287";
|
| 12729 |
manish.sha |
350 |
}
|
|
|
351 |
else if(warehouseId == 3295) {
|
|
|
352 |
address = amazonAddressMewat;
|
|
|
353 |
tinNo = tinNoOurGgn;
|
|
|
354 |
contactPerson = "Mr. Sandeep Sachdeva, Contact No. +91 9716691287";
|
| 12543 |
manish.sha |
355 |
}
|
| 7410 |
amar.kumar |
356 |
|
| 4687 |
mandeep.dh |
357 |
PdfPTable billToTable = new PdfPTable(new float[] { 0.2f, 0.8f });
|
|
|
358 |
billToTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
359 |
|
| 9925 |
amar.kumar |
360 |
billToTable.addCell(new Phrase("Bill To :", helvetica8));
|
| 7410 |
amar.kumar |
361 |
billToTable.addCell(new PdfPCell(new Paragraph(address
|
| 4687 |
mandeep.dh |
362 |
+ "\nTIN NO. " + tinNo, helvetica8)));
|
|
|
363 |
|
|
|
364 |
billToTable.addCell(new Phrase("Contact Person:", helvetica8));
|
| 7410 |
amar.kumar |
365 |
billToTable.addCell(new Phrase(contactPerson, helvetica8));
|
| 4687 |
mandeep.dh |
366 |
|
|
|
367 |
billToTable.addCell(new Phrase("Taxes:", helvetica8));
|
| 9591 |
amar.kumar |
368 |
if(taxType == TaxType.CFORM) {
|
|
|
369 |
billToTable.addCell(new Phrase("Prices inclusive of all taxes (To be billed on CST Against C-Form)",
|
|
|
370 |
helvetica8));
|
|
|
371 |
} else {
|
|
|
372 |
billToTable.addCell(new Phrase("Prices inclusive of all taxes",
|
|
|
373 |
helvetica8));
|
|
|
374 |
}
|
| 4687 |
mandeep.dh |
375 |
|
|
|
376 |
return billToTable;
|
|
|
377 |
}
|
|
|
378 |
|
|
|
379 |
private static PdfPCell getProductNameCell(
|
|
|
380 |
in.shop2020.purchase.LineItem lineitem) {
|
|
|
381 |
String itemName = getItemDisplayName(lineitem);
|
|
|
382 |
PdfPCell productNameCell = new PdfPCell(
|
|
|
383 |
new Phrase(itemName, helvetica8));
|
|
|
384 |
productNameCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
385 |
return productNameCell;
|
|
|
386 |
}
|
|
|
387 |
|
|
|
388 |
private static String getItemDisplayName(
|
|
|
389 |
in.shop2020.purchase.LineItem lineitem) {
|
|
|
390 |
StringBuffer itemName = new StringBuffer();
|
|
|
391 |
if (lineitem.getBrand() != null)
|
|
|
392 |
itemName.append(lineitem.getBrand() + " ");
|
|
|
393 |
if (lineitem.getModelName() != null)
|
|
|
394 |
itemName.append(lineitem.getModelName() + " ");
|
|
|
395 |
if (lineitem.getModelNumber() != null)
|
|
|
396 |
itemName.append(lineitem.getModelNumber() + " ");
|
|
|
397 |
if (lineitem.getColor() != null
|
|
|
398 |
&& !lineitem.getColor().trim().equals("NA"))
|
|
|
399 |
itemName.append("(" + lineitem.getColor() + ")");
|
|
|
400 |
|
|
|
401 |
return itemName.toString();
|
|
|
402 |
}
|
|
|
403 |
|
|
|
404 |
private static PdfPCell getTotalCell(int colspan) {
|
|
|
405 |
PdfPCell totalCell = new PdfPCell(new Phrase("Total", helveticaBold8));
|
|
|
406 |
totalCell.setColspan(colspan);
|
|
|
407 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
|
|
408 |
return totalCell;
|
|
|
409 |
}
|
|
|
410 |
|
|
|
411 |
}
|