| Line 33... |
Line 33... |
| 33 |
|
33 |
|
| 34 |
// private static final Properties properties = readProperties();
|
34 |
// private static final Properties properties = readProperties();
|
| 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";
|
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";
|
| 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";
|
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";
|
| 37 |
private static final String ourAddressGoregaon = "Spice Online Retail Pvt. Ltd.\n93/743, Motilal Nagar-1, Goregaon(WEST),\nMotilal Nagar, Mumbai, Maharashtra-400062\n";
|
37 |
private static final String ourAddressGoregaon = "Spice Online Retail Pvt. Ltd.\n93/743, Motilal Nagar-1, Goregaon(WEST),\nMotilal Nagar, Mumbai, Maharashtra-400062\n";
|
| 38 |
private static final String amazonAddress = "Spice Online Retail Pvt. Ltd. \nC/O Amazon Seller Services Pvt. Ltd.,\nBuilding H Prathmesh Complex, Saravali Village,\nOpp Hotel Vatika Kalyan, Bhivandi Junction,\nBhiwandi, Maharashtra\n";
|
38 |
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";
|
| 39 |
private static final String tinNoDelhi = "07250399732";
|
39 |
private static final String tinNoDelhi = "07250399732";
|
| 40 |
private static final String tinNoMum = "27450984008";
|
40 |
private static final String tinNoMum = "27450984008";
|
| 41 |
|
41 |
|
| 42 |
private static final Font helvetica8 = FontFactory.getFont(
|
42 |
private static final Font helvetica8 = FontFactory.getFont(
|
| 43 |
FontFactory.HELVETICA, 8);
|
43 |
FontFactory.HELVETICA, 8);
|
| Line 98... |
Line 98... |
| 98 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
98 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
| 99 |
poDate))));
|
99 |
poDate))));
|
| 100 |
poSummaryTable.setSpacingBefore(10.0f);
|
100 |
poSummaryTable.setSpacingBefore(10.0f);
|
| 101 |
|
101 |
|
| 102 |
poTable.addCell(poTitleCell);
|
102 |
poTable.addCell(poTitleCell);
|
| 103 |
poTable.addCell(getAddressCell(purchaseOrder.getWarehouseId()));
|
103 |
poTable.addCell(getAddressCell(purchaseOrder.getWarehouseId(), purchaseOrder.getShippingWarehouseId()));
|
| 104 |
poTable.addCell(poSummaryTable);
|
104 |
poTable.addCell(poSummaryTable);
|
| 105 |
poTable.addCell(getSalutationTable(supplier));
|
105 |
poTable.addCell(getSalutationTable(supplier));
|
| 106 |
poTable.addCell(getPoDetailsTable(purchaseOrder));
|
106 |
poTable.addCell(getPoDetailsTable(purchaseOrder));
|
| 107 |
poTable.addCell(getBillToTable(purchaseOrder.getWarehouseId(), purchaseOrder.getTaxType()));
|
107 |
poTable.addCell(getBillToTable(purchaseOrder.getWarehouseId(), purchaseOrder.getTaxType()));
|
| 108 |
//poTable.addCell(getCFormCell(purchaseOrder.getTaxType()));
|
108 |
//poTable.addCell(getCFormCell(purchaseOrder.getTaxType()));
|
| Line 120... |
Line 120... |
| 120 |
cFormCell.setBorder(Rectangle.NO_BORDER);
|
120 |
cFormCell.setBorder(Rectangle.NO_BORDER);
|
| 121 |
cFormCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
121 |
cFormCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
| 122 |
return cFormCell;
|
122 |
return cFormCell;
|
| 123 |
}
|
123 |
}
|
| 124 |
|
124 |
|
| 125 |
private static PdfPCell getAddressCell(long warehouseId) {
|
125 |
private static PdfPTable getAddressCell(long warehouseId, long shippingWarehouseId) {
|
| 126 |
//TODO Write this code in a proper configurable way
|
126 |
//TODO Write this code in a proper configurable way
|
| 127 |
String address = "";
|
127 |
String address = "";
|
| 128 |
String tinNo = "";
|
128 |
String tinNo = "";
|
| - |
|
129 |
String shippingAddress = "";
|
| - |
|
130 |
String shippingTinNo = "";
|
| 129 |
if(warehouseId ==7) {
|
131 |
if(warehouseId ==7) {
|
| 130 |
address = ourAddressDelhi;
|
132 |
address = ourAddressDelhi;
|
| 131 |
tinNo = tinNoDelhi;
|
133 |
tinNo = tinNoDelhi;
|
| 132 |
} else if(warehouseId == 12) {
|
134 |
} else if(warehouseId == 12) {
|
| 133 |
address = ourAddressGoregaon;
|
135 |
address = ourAddressGoregaon;
|
| Line 137... |
Line 139... |
| 137 |
tinNo = tinNoMum;
|
139 |
tinNo = tinNoMum;
|
| 138 |
} else if(warehouseId ==16) {
|
140 |
} else if(warehouseId ==16) {
|
| 139 |
address = amazonAddress;
|
141 |
address = amazonAddress;
|
| 140 |
tinNo = tinNoMum;
|
142 |
tinNo = tinNoMum;
|
| 141 |
}
|
143 |
}
|
| - |
|
144 |
PdfPTable billToShipToTable = new PdfPTable(2);
|
| 142 |
Paragraph addressParagraph = new Paragraph(address + "\nTIN NO. "
|
145 |
Paragraph addressParagraph = new Paragraph(address + "\nTIN NO. "
|
| 143 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
146 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
| 144 |
PdfPCell addressCell = new PdfPCell();
|
147 |
PdfPCell addressCell = new PdfPCell();
|
| - |
|
148 |
if(warehouseId != shippingWarehouseId) {
|
| - |
|
149 |
addressParagraph = new Paragraph("Bill To :\n" + address + "\n\nTIN NO. "
|
| - |
|
150 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
| - |
|
151 |
}
|
| 145 |
addressCell.addElement(addressParagraph);
|
152 |
addressCell.addElement(addressParagraph);
|
| 146 |
addressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
153 |
//addressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
| 147 |
addressCell.setBorder(Rectangle.NO_BORDER);
|
154 |
addressCell.setBorder(Rectangle.NO_BORDER);
|
| - |
|
155 |
|
| - |
|
156 |
if(warehouseId != shippingWarehouseId) {
|
| - |
|
157 |
if(shippingWarehouseId ==7) {
|
| - |
|
158 |
shippingAddress = ourAddressDelhi;
|
| - |
|
159 |
shippingTinNo = tinNoDelhi;
|
| - |
|
160 |
} else if(shippingWarehouseId == 12) {
|
| - |
|
161 |
shippingAddress = ourAddressGoregaon;
|
| - |
|
162 |
shippingTinNo = tinNoMum;
|
| - |
|
163 |
} else if(shippingWarehouseId == 13) {
|
| - |
|
164 |
shippingAddress = ourAddressBhiwandi;
|
| - |
|
165 |
shippingTinNo = tinNoMum;
|
| - |
|
166 |
} else if(shippingWarehouseId ==16) {
|
| - |
|
167 |
shippingAddress = amazonAddress;
|
| - |
|
168 |
shippingTinNo = tinNoMum;
|
| - |
|
169 |
}
|
| - |
|
170 |
|
| - |
|
171 |
PdfPCell billToShipToCell = new PdfPCell();
|
| - |
|
172 |
billToShipToCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
| - |
|
173 |
billToShipToCell.setBorder(Rectangle.NO_BORDER);
|
| - |
|
174 |
|
| - |
|
175 |
PdfPCell shippingAddressCell = new PdfPCell();
|
| - |
|
176 |
shippingAddressCell.addElement(new Paragraph("Ship To :\n" +shippingAddress + "\nTIN NO. "
|
| - |
|
177 |
+ shippingTinNo, new Font(FontFamily.TIMES_ROMAN, 8f)));
|
| - |
|
178 |
shippingAddressCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
| - |
|
179 |
shippingAddressCell.setBorder(Rectangle.LEFT);
|
| - |
|
180 |
billToShipToTable.addCell(addressCell);
|
| - |
|
181 |
billToShipToTable.addCell(shippingAddressCell);
|
| - |
|
182 |
billToShipToCell.addElement(billToShipToTable);
|
| - |
|
183 |
return billToShipToTable;
|
| - |
|
184 |
|
| - |
|
185 |
}
|
| - |
|
186 |
billToShipToTable.addCell(addressCell);
|
| - |
|
187 |
PdfPCell placeHolderCell = new PdfPCell();
|
| - |
|
188 |
placeHolderCell.setBorder(Rectangle.NO_BORDER);
|
| - |
|
189 |
billToShipToTable.addCell(placeHolderCell);
|
| 148 |
return addressCell;
|
190 |
return billToShipToTable;
|
| 149 |
}
|
191 |
}
|
| 150 |
|
192 |
|
| 151 |
private static PdfPTable getSalutationTable(Supplier supplier)
|
193 |
private static PdfPTable getSalutationTable(Supplier supplier)
|
| 152 |
throws Exception {
|
194 |
throws Exception {
|
| 153 |
PdfPTable salutationTable = new PdfPTable(1);
|
195 |
PdfPTable salutationTable = new PdfPTable(1);
|
| Line 231... |
Line 273... |
| 231 |
}
|
273 |
}
|
| 232 |
|
274 |
|
| 233 |
PdfPTable billToTable = new PdfPTable(new float[] { 0.2f, 0.8f });
|
275 |
PdfPTable billToTable = new PdfPTable(new float[] { 0.2f, 0.8f });
|
| 234 |
billToTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
|
276 |
billToTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
|
| 235 |
|
277 |
|
| 236 |
billToTable.addCell(new Phrase("Bill To and Ship To:", helvetica8));
|
278 |
billToTable.addCell(new Phrase("Bill To :", helvetica8));
|
| 237 |
billToTable.addCell(new PdfPCell(new Paragraph(address
|
279 |
billToTable.addCell(new PdfPCell(new Paragraph(address
|
| 238 |
+ "\nTIN NO. " + tinNo, helvetica8)));
|
280 |
+ "\nTIN NO. " + tinNo, helvetica8)));
|
| 239 |
|
281 |
|
| 240 |
billToTable.addCell(new Phrase("Contact Person:", helvetica8));
|
282 |
billToTable.addCell(new Phrase("Contact Person:", helvetica8));
|
| 241 |
billToTable.addCell(new Phrase(contactPerson, helvetica8));
|
283 |
billToTable.addCell(new Phrase(contactPerson, helvetica8));
|