| Line 29... |
Line 29... |
| 29 |
|
29 |
|
| 30 |
private static Logger logger = LoggerFactory
|
30 |
private static Logger logger = LoggerFactory
|
| 31 |
.getLogger(PdfPoSheetGenerator.class);
|
31 |
.getLogger(PdfPoSheetGenerator.class);
|
| 32 |
|
32 |
|
| 33 |
// private static final Properties properties = readProperties();
|
33 |
// private static final Properties properties = readProperties();
|
| 34 |
private static final String ourAddress = "Spice Online Retail Pvt. Ltd.\nC/O,PIBCO LIMITED, Basement,Punjsons\n2,Kalkaji Industrial Area, New Delhi-110019\n";
|
34 |
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 ourAddressBhiwandi = "Spice Online Retail Pvt. Ltd.\nBhivandi Junction, Bhiwandi, Thane,\nMaharashtra -421302\n";
|
| - |
|
36 |
private static final String ourAddressGoregaon = "Spice Online Retail Pvt. Ltd.\n93/743, Motilal Nagar-1, Goregaon(WEST),\nMotilal Nagar, Mumbai, Maharashtra-400062\n";
|
| 35 |
private static final String tinNo = "07250399732";
|
37 |
private static final String tinNoDelhi = "07250399732";
|
| - |
|
38 |
private static final String tinNoMum = "27450984008";
|
| 36 |
|
39 |
|
| 37 |
private static final Font helvetica8 = FontFactory.getFont(
|
40 |
private static final Font helvetica8 = FontFactory.getFont(
|
| 38 |
FontFactory.HELVETICA, 8);
|
41 |
FontFactory.HELVETICA, 8);
|
| 39 |
|
42 |
|
| 40 |
private static final Font helveticaBold8 = FontFactory.getFont(
|
43 |
private static final Font helveticaBold8 = FontFactory.getFont(
|
| Line 94... |
Line 97... |
| 94 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
97 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
| 95 |
poDate))));
|
98 |
poDate))));
|
| 96 |
poSummaryTable.setSpacingBefore(10.0f);
|
99 |
poSummaryTable.setSpacingBefore(10.0f);
|
| 97 |
|
100 |
|
| 98 |
poTable.addCell(poTitleCell);
|
101 |
poTable.addCell(poTitleCell);
|
| 99 |
poTable.addCell(getAddressCell());
|
102 |
poTable.addCell(getAddressCell(purchaseOrder.getWarehouseId()));
|
| 100 |
poTable.addCell(poSummaryTable);
|
103 |
poTable.addCell(poSummaryTable);
|
| 101 |
poTable.addCell(getSalutationTable(supplier));
|
104 |
poTable.addCell(getSalutationTable(supplier));
|
| 102 |
poTable.addCell(getPoDetailsTable(purchaseOrder));
|
105 |
poTable.addCell(getPoDetailsTable(purchaseOrder));
|
| 103 |
poTable.addCell(getBillToTable());
|
106 |
poTable.addCell(getBillToTable(purchaseOrder.getWarehouseId()));
|
| 104 |
|
107 |
|
| 105 |
return poTable;
|
108 |
return poTable;
|
| 106 |
}
|
109 |
}
|
| 107 |
|
110 |
|
| 108 |
private static PdfPCell getAddressCell() {
|
111 |
private static PdfPCell getAddressCell(long warehouseId) {
|
| - |
|
112 |
//TODO Write this code in a proper configurable way
|
| - |
|
113 |
String address = "";
|
| - |
|
114 |
String tinNo = "";
|
| - |
|
115 |
if(warehouseId ==7) {
|
| - |
|
116 |
address = ourAddressDelhi;
|
| - |
|
117 |
tinNo = tinNoDelhi;
|
| - |
|
118 |
} else if(warehouseId == 12) {
|
| - |
|
119 |
address = ourAddressGoregaon;
|
| - |
|
120 |
tinNo = tinNoMum;
|
| - |
|
121 |
} else if(warehouseId == 13) {
|
| - |
|
122 |
address = ourAddressBhiwandi;
|
| - |
|
123 |
tinNo = tinNoMum;
|
| - |
|
124 |
}
|
| 109 |
Paragraph addressParagraph = new Paragraph(ourAddress + "\nTIN NO. "
|
125 |
Paragraph addressParagraph = new Paragraph(address + "\nTIN NO. "
|
| 110 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
126 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
| 111 |
PdfPCell addressCell = new PdfPCell();
|
127 |
PdfPCell addressCell = new PdfPCell();
|
| 112 |
addressCell.addElement(addressParagraph);
|
128 |
addressCell.addElement(addressParagraph);
|
| 113 |
addressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
129 |
addressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
| 114 |
addressCell.setBorder(Rectangle.NO_BORDER);
|
130 |
addressCell.setBorder(Rectangle.NO_BORDER);
|
| Line 162... |
Line 178... |
| 162 |
detailsTable.addCell(getTotalCell(4));
|
178 |
detailsTable.addCell(getTotalCell(4));
|
| 163 |
detailsTable.addCell(new Phrase("" + total, helvetica8));
|
179 |
detailsTable.addCell(new Phrase("" + total, helvetica8));
|
| 164 |
return detailsTable;
|
180 |
return detailsTable;
|
| 165 |
}
|
181 |
}
|
| 166 |
|
182 |
|
| 167 |
private static PdfPTable getBillToTable() {
|
183 |
private static PdfPTable getBillToTable(long warehouseId) {
|
| - |
|
184 |
//TODO Write this code in a proper configurable way
|
| - |
|
185 |
String address = "";
|
| - |
|
186 |
String tinNo = "";
|
| - |
|
187 |
String contactPerson = "";
|
| - |
|
188 |
if(warehouseId ==7) {
|
| - |
|
189 |
address = ourAddressDelhi;
|
| - |
|
190 |
tinNo = tinNoDelhi;
|
| - |
|
191 |
contactPerson = "Mr. Shiv Kumar, Contact No. +91 9911232226";
|
| - |
|
192 |
} else if(warehouseId == 12) {
|
| - |
|
193 |
address = ourAddressGoregaon;
|
| - |
|
194 |
tinNo = tinNoMum;
|
| - |
|
195 |
contactPerson = "Mr. Sandeep Sachdeva, Contact No. +91 9716691287";
|
| - |
|
196 |
} else if(warehouseId == 13) {
|
| - |
|
197 |
address = ourAddressBhiwandi;
|
| - |
|
198 |
tinNo = tinNoMum;
|
| - |
|
199 |
contactPerson = "Mr. Sandeep Sachdeva, Contact No. +91 9716691287";
|
| - |
|
200 |
}
|
| - |
|
201 |
|
| 168 |
PdfPTable billToTable = new PdfPTable(new float[] { 0.2f, 0.8f });
|
202 |
PdfPTable billToTable = new PdfPTable(new float[] { 0.2f, 0.8f });
|
| 169 |
billToTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
|
203 |
billToTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
|
| 170 |
|
204 |
|
| 171 |
billToTable.addCell(new Phrase("Bill To and Ship To:", helvetica8));
|
205 |
billToTable.addCell(new Phrase("Bill To and Ship To:", helvetica8));
|
| 172 |
billToTable.addCell(new PdfPCell(new Paragraph(ourAddress
|
206 |
billToTable.addCell(new PdfPCell(new Paragraph(address
|
| 173 |
+ "\nTIN NO. " + tinNo, helvetica8)));
|
207 |
+ "\nTIN NO. " + tinNo, helvetica8)));
|
| 174 |
|
208 |
|
| 175 |
billToTable.addCell(new Phrase("Contact Person:", helvetica8));
|
209 |
billToTable.addCell(new Phrase("Contact Person:", helvetica8));
|
| 176 |
billToTable.addCell(new Phrase(
|
210 |
billToTable.addCell(new Phrase(contactPerson, helvetica8));
|
| 177 |
"Mr. Shiv Kumar, Contact No. +91 9911232226", helvetica8));
|
- |
|
| 178 |
|
211 |
|
| 179 |
billToTable.addCell(new Phrase("Taxes:", helvetica8));
|
212 |
billToTable.addCell(new Phrase("Taxes:", helvetica8));
|
| 180 |
billToTable.addCell(new Phrase("Prices inclusive of all taxes",
|
213 |
billToTable.addCell(new Phrase("Prices inclusive of all taxes",
|
| 181 |
helvetica8));
|
214 |
helvetica8));
|
| 182 |
|
215 |
|