| Line 3... |
Line 3... |
| 3 |
import java.io.ByteArrayOutputStream;
|
3 |
import java.io.ByteArrayOutputStream;
|
| 4 |
import java.io.File;
|
4 |
import java.io.File;
|
| 5 |
import java.io.FileOutputStream;
|
5 |
import java.io.FileOutputStream;
|
| 6 |
import java.io.IOException;
|
6 |
import java.io.IOException;
|
| 7 |
import java.text.DateFormat;
|
7 |
import java.text.DateFormat;
|
| 8 |
import java.text.ParseException;
|
- |
|
| 9 |
import java.text.SimpleDateFormat;
|
- |
|
| 10 |
import java.util.Calendar;
|
8 |
import java.util.Calendar;
|
| 11 |
import java.util.Date;
|
9 |
import java.util.Date;
|
| 12 |
import java.util.Map;
|
10 |
import java.util.Map;
|
| 13 |
|
11 |
|
| 14 |
import org.apache.log4j.helpers.DateTimeDateFormat;
|
- |
|
| 15 |
import org.apache.thrift.TException;
|
12 |
import org.apache.thrift.TException;
|
| 16 |
import org.slf4j.Logger;
|
13 |
import org.slf4j.Logger;
|
| 17 |
import org.slf4j.LoggerFactory;
|
14 |
import org.slf4j.LoggerFactory;
|
| 18 |
|
15 |
|
| 19 |
import com.itextpdf.text.Document;
|
16 |
import com.itextpdf.text.Document;
|
| Line 29... |
Line 26... |
| 29 |
import com.itextpdf.text.pdf.PdfWriter;
|
26 |
import com.itextpdf.text.pdf.PdfWriter;
|
| 30 |
|
27 |
|
| 31 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
28 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
| 32 |
import in.shop2020.model.v1.inventory.StateInfo;
|
29 |
import in.shop2020.model.v1.inventory.StateInfo;
|
| 33 |
import in.shop2020.model.v1.inventory.VatType;
|
30 |
import in.shop2020.model.v1.inventory.VatType;
|
| - |
|
31 |
import in.shop2020.model.v1.order.BuyerInfo;
|
| - |
|
32 |
import in.shop2020.model.v1.order.WarehouseAddress;
|
| 34 |
import in.shop2020.purchase.PurchaseOrder;
|
33 |
import in.shop2020.purchase.PurchaseOrder;
|
| 35 |
import in.shop2020.purchase.Supplier;
|
34 |
import in.shop2020.purchase.Supplier;
|
| 36 |
import in.shop2020.purchase.TaxType;
|
35 |
import in.shop2020.purchase.TaxType;
|
| 37 |
import in.shop2020.thrift.clients.CatalogClient;
|
36 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 38 |
import in.shop2020.thrift.clients.InventoryClient;
|
37 |
import in.shop2020.thrift.clients.InventoryClient;
|
| 39 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
38 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 40 |
|
39 |
|
| 41 |
public class PdfPoSheetGenerator {
|
40 |
public class PdfPoSheetGenerator {
|
| 42 |
|
41 |
|
| 43 |
private static Logger logger = LoggerFactory
|
42 |
private static Logger logger = LoggerFactory
|
| 44 |
.getLogger(PdfPoSheetGenerator.class);
|
43 |
.getLogger(PdfPoSheetGenerator.class);
|
| 45 |
|
44 |
|
| 46 |
// private static final Properties properties = readProperties();
|
45 |
// private static final Properties properties = readProperties();
|
| 47 |
private static final String ourAddressDelhi = "Spice Online Retail Pvt. Ltd.\nC/O,PIBCO LIMITED, Basement,Punjsons\n2,Kalkaji Industrial Area, New Delhi-110019\n";
|
46 |
private static final String ourAddressDelhi = "Spice Online Retail Pvt. Ltd.\nC/O,PIBCO LIMITED, Basement,Punjsons\n2,Kalkaji Industrial Area, New Delhi-110019\n";
|
| 48 |
private static final String ourNewCompanyAddressDelhi = "New Spice Online Retail Pvt. Ltd.\nC/O,PIBCO LIMITED, Basement,Punjsons\n2,Kalkaji Industrial Area, New Delhi-110019\n";
|
- |
|
| 49 |
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";
|
47 |
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";
|
| 50 |
private static final String ourAddressGoregaon = "Spice Online Retail Pvt. Ltd.\n93/743, Motilal Nagar-1, Goregaon(WEST),\nMotilal Nagar, Mumbai, Maharashtra-400062\n";
|
48 |
private static final String ourAddressGoregaon = "Spice Online Retail Pvt. Ltd.\n93/743, Motilal Nagar-1, Goregaon(WEST),\nMotilal Nagar, Mumbai, Maharashtra-400062\n";
|
| 51 |
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";
|
49 |
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";
|
| 52 |
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";
|
50 |
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";
|
| 53 |
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";
|
51 |
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";
|
| Line 60... |
Line 58... |
| 60 |
private static final String amazonAddressDelhi = "Spice Online Retail Pvt Ltd., \nC/O Amazon Seller Services Pvt. Ltd., \nA43 GF MOHAN COOPERATIVE IND, \nESTATE MAIN MATHURA ROAD, \nBADARPUR SOUTH DELHI, Delhi -110044";
|
58 |
private static final String amazonAddressDelhi = "Spice Online Retail Pvt Ltd., \nC/O Amazon Seller Services Pvt. Ltd., \nA43 GF MOHAN COOPERATIVE IND, \nESTATE MAIN MATHURA ROAD, \nBADARPUR SOUTH DELHI, Delhi -110044";
|
| 61 |
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";
|
59 |
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";
|
| 62 |
private static final String flipkartAddressDelhi = "Spice Online Retail Pvt. Ltd.\n C/O Flipkart Internet Pvt. Ltd.\n Khasra No. 435,Road No.# 04 ,Lal Dora Extension,\nMahipalpur, New Delhi- 110037\n";
|
60 |
private static final String flipkartAddressDelhi = "Spice Online Retail Pvt. Ltd.\n C/O Flipkart Internet Pvt. Ltd.\n Khasra No. 435,Road No.# 04 ,Lal Dora Extension,\nMahipalpur, New Delhi- 110037\n";
|
| 63 |
private static final String snapdealAddressDelhi = "Spice Online Retail Pvt. Ltd, \nC/O. Gati Kintetsu Express Pvt Ltd.,\nPlot In Khasra No. 15/17,24, G/F, \nVillage- Samalkha, New Delhi - 110037";
|
61 |
private static final String snapdealAddressDelhi = "Spice Online Retail Pvt. Ltd, \nC/O. Gati Kintetsu Express Pvt Ltd.,\nPlot In Khasra No. 15/17,24, G/F, \nVillage- Samalkha, New Delhi - 110037";
|
| 64 |
private static final String tinNoDelhi = "07250399732";
|
62 |
private static final String tinNoDelhi = "07250399732";
|
| 65 |
private static final String newCompanyTinNoDelhi = "07250399733";
|
- |
|
| 66 |
private static final String tinNoMum = "27450984008";
|
63 |
private static final String tinNoMum = "27450984008";
|
| 67 |
private static final String tinNoBan = "29171183852";
|
64 |
private static final String tinNoBan = "29171183852";
|
| 68 |
private static final String tinNoFkGgn = "06681944625";
|
65 |
private static final String tinNoFkGgn = "06681944625";
|
| 69 |
private static final String tinNoOurGgn = "06681944625";
|
66 |
private static final String tinNoOurGgn = "06681944625";
|
| 70 |
private static final String tinNoOurHyd = "36601220768";
|
67 |
private static final String tinNoOurHyd = "36601220768";
|
| Line 78... |
Line 75... |
| 78 |
FontFactory.HELVETICA_BOLD, 8);
|
75 |
FontFactory.HELVETICA_BOLD, 8);
|
| 79 |
private static final Font helveticaBold12 = FontFactory.getFont(
|
76 |
private static final Font helveticaBold12 = FontFactory.getFont(
|
| 80 |
FontFactory.HELVETICA_BOLD, 12);
|
77 |
FontFactory.HELVETICA_BOLD, 12);
|
| 81 |
|
78 |
|
| 82 |
public static Map<Long, StateInfo> stateIdMap = null;
|
79 |
public static Map<Long, StateInfo> stateIdMap = null;
|
| 83 |
public static long cutoffTime = 0;
|
- |
|
| 84 |
|
80 |
|
| 85 |
static{
|
81 |
static{
|
| 86 |
try{
|
82 |
try{
|
| 87 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
83 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
| 88 |
stateIdMap = inventoryClient.getStateMaster();
|
84 |
stateIdMap = inventoryClient.getStateMaster();
|
| 89 |
String cutOffDate = ConfigClient.getClient().get("warehouse_company_cutoff_date");
|
- |
|
| 90 |
DateFormat df = new SimpleDateFormat("yyyy-mm-dd");
|
- |
|
| 91 |
cutoffTime = df.parse(cutOffDate).getTime();
|
- |
|
| 92 |
|
85 |
|
| 93 |
} catch(Exception e){
|
86 |
} catch(Exception e){
|
| 94 |
logger.error("Could not initialize static block", e);
|
87 |
logger.error("Unable to get State Info Map", e);
|
| 95 |
System.exit(0);
|
- |
|
| 96 |
}
|
88 |
}
|
| 97 |
}
|
89 |
}
|
| 98 |
|
90 |
|
| 99 |
public static String generatePdfSheet(PurchaseOrder purchaseOrder,
|
91 |
public static String generatePdfSheet(PurchaseOrder purchaseOrder,
|
| 100 |
Supplier supplier) throws IOException {
|
92 |
Supplier supplier) throws IOException {
|
| Line 158... |
Line 150... |
| 158 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
150 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
| 159 |
poExpiryDate))));
|
151 |
poExpiryDate))));
|
| 160 |
poSummaryTable.setSpacingBefore(10.0f);
|
152 |
poSummaryTable.setSpacingBefore(10.0f);
|
| 161 |
|
153 |
|
| 162 |
poTable.addCell(poTitleCell);
|
154 |
poTable.addCell(poTitleCell);
|
| 163 |
poTable.addCell(getAddressCell(purchaseOrder.getWarehouseId(), purchaseOrder.getShippingWarehouseId(), purchaseOrder.getCreatedAt()));
|
155 |
poTable.addCell(getAddressCell(purchaseOrder));
|
| 164 |
poTable.addCell(poSummaryTable);
|
156 |
poTable.addCell(poSummaryTable);
|
| 165 |
poTable.addCell(getSalutationTable(supplier));
|
157 |
poTable.addCell(getSalutationTable(supplier));
|
| 166 |
poTable.addCell(getPoDetailsTable(purchaseOrder, supplier));
|
158 |
poTable.addCell(getPoDetailsTable(purchaseOrder, supplier));
|
| 167 |
poTable.addCell(getBillToTable(purchaseOrder.getWarehouseId(), purchaseOrder.getTaxType()));
|
159 |
poTable.addCell(getBillToTable(purchaseOrder.getWarehouseId(), purchaseOrder.getTaxType()));
|
| 168 |
//poTable.addCell(getCFormCell(purchaseOrder.getTaxType()));
|
160 |
//poTable.addCell(getCFormCell(purchaseOrder.getTaxType()));
|
| 169 |
|
161 |
|
| 170 |
return poTable;
|
162 |
return poTable;
|
| 171 |
}
|
163 |
}
|
| 172 |
|
164 |
|
| 173 |
private static PdfPCell getCFormCell(TaxType taxType) {
|
165 |
/*private static PdfPCell getCFormCell(TaxType taxType) {
|
| 174 |
PdfPCell cFormCell = null;
|
166 |
PdfPCell cFormCell = null;
|
| 175 |
if(taxType == TaxType.CFORM) {
|
167 |
if(taxType == TaxType.CFORM) {
|
| 176 |
cFormCell = new PdfPCell(new Paragraph("*To be billed on CST Against C-Form ", new Font(FontFamily.TIMES_ROMAN, 8f)));
|
168 |
cFormCell = new PdfPCell(new Paragraph("*To be billed on CST Against C-Form ", new Font(FontFamily.TIMES_ROMAN, 8f)));
|
| 177 |
} else {
|
169 |
} else {
|
| 178 |
cFormCell = new PdfPCell();
|
170 |
cFormCell = new PdfPCell();
|
| 179 |
}
|
171 |
}
|
| 180 |
cFormCell.setBorder(Rectangle.NO_BORDER);
|
172 |
cFormCell.setBorder(Rectangle.NO_BORDER);
|
| 181 |
cFormCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
173 |
cFormCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
| 182 |
return cFormCell;
|
174 |
return cFormCell;
|
| 183 |
}
|
175 |
}*/
|
| 184 |
|
176 |
|
| 185 |
private static PdfPTable getAddressCell(long warehouseId, long shippingWarehouseId, long createdAt) {
|
177 |
private static PdfPTable getAddressCell(PurchaseOrder purchaseOrder) {
|
| 186 |
//TODO Write this code in a proper configurable way
|
178 |
//TODO Write this code in a proper configurable way
|
| - |
|
179 |
BuyerInfo binfo = null;
|
| 187 |
String address = "";
|
180 |
String address = "";
|
| 188 |
String tinNo = "";
|
181 |
String tinNo = "";
|
| 189 |
String shippingAddress = "";
|
182 |
String shippingAddress = "";
|
| 190 |
String shippingTinNo = "";
|
- |
|
| 191 |
if(warehouseId ==7) {
|
- |
|
| 192 |
if(createdAt < cutoffTime) {
|
- |
|
| 193 |
address = ourAddressDelhi;
|
- |
|
| 194 |
tinNo = tinNoDelhi;
|
- |
|
| 195 |
} else {
|
183 |
try {
|
| 196 |
address = ourNewCompanyAddressDelhi;
|
184 |
in.shop2020.model.v1.order.TransactionService.Client tClient = new TransactionClient().getClient();
|
| 197 |
tinNo = newCompanyTinNoDelhi;
|
- |
|
| 198 |
}
|
- |
|
| 199 |
} else if(warehouseId == 12) {
|
- |
|
| 200 |
address = ourAddressGoregaon;
|
- |
|
| 201 |
tinNo = tinNoMum;
|
- |
|
| 202 |
} else if(warehouseId == 13) {
|
- |
|
| 203 |
address = ourAddressBhiwandi;
|
- |
|
| 204 |
tinNo = tinNoMum;
|
- |
|
| 205 |
} else if(warehouseId ==16) {
|
- |
|
| 206 |
address = amazonAddress;
|
- |
|
| 207 |
tinNo = tinNoMum;
|
- |
|
| 208 |
} else if(warehouseId ==1765){
|
- |
|
| 209 |
address = ourAddressBangalore;
|
- |
|
| 210 |
tinNo = tinNoBan;
|
- |
|
| 211 |
} else if(warehouseId ==1768){
|
185 |
binfo = tClient.getBuyerByWarehouse(purchaseOrder.getWarehouseId());
|
| 212 |
address = ourAddressBangaloreSR;
|
186 |
WarehouseAddress addr = tClient.getWarehouseAddress(purchaseOrder.getShippingWarehouseAddressId());
|
| 213 |
tinNo = tinNoBan;
|
187 |
tinNo = binfo.getTin();
|
| 214 |
} else if(warehouseId ==1771){
|
- |
|
| 215 |
address = amazonAddreseBangalore;
|
188 |
address = binfo.getOrganisationName() + "\n" + addr.getAddress() + "\n" + "-" + addr.getPin();
|
| 216 |
tinNo = tinNoBan;
|
- |
|
| 217 |
} else if(warehouseId == 2854){
|
- |
|
| 218 |
address = flipkartAddressGgn;
|
- |
|
| 219 |
tinNo = tinNoFkGgn;
|
- |
|
| 220 |
} else if(warehouseId == 2857){
|
- |
|
| 221 |
address = ourAddressGurgaon;
|
- |
|
| 222 |
tinNo = tinNoOurGgn;
|
- |
|
| 223 |
} else if(warehouseId == 3295){
|
- |
|
| 224 |
address = amazonAddressMewat;
|
- |
|
| 225 |
tinNo = tinNoOurGgn;
|
- |
|
| 226 |
} else if(warehouseId == 3298){
|
189 |
} catch (Exception e) {
|
| 227 |
address = ourAddressHyderabad;
|
190 |
logger.error("This should not happen", e);
|
| 228 |
tinNo = tinNoOurHyd;
|
- |
|
| 229 |
} else if(warehouseId == 3931){
|
- |
|
| 230 |
address = ourAddressGurgaonS;
|
- |
|
| 231 |
tinNo = tinNoOurGgn;
|
- |
|
| 232 |
} else if(warehouseId == 4699){
|
- |
|
| 233 |
address = flipkartAddressDelhi;
|
- |
|
| 234 |
tinNo = tinNoFkDelhi;
|
- |
|
| 235 |
} else if(warehouseId == 5314){
|
- |
|
| 236 |
address = snapdealAddressDelhi;
|
- |
|
| 237 |
tinNo = tinNoFkDelhi;
|
- |
|
| 238 |
} else if(warehouseId == 5623){
|
- |
|
| 239 |
address = amazonAddressDelhi;
|
- |
|
| 240 |
tinNo = tinNoDelhi;
|
- |
|
| 241 |
}
|
191 |
}
|
| - |
|
192 |
|
| - |
|
193 |
|
| - |
|
194 |
|
| 242 |
PdfPTable billToShipToTable = new PdfPTable(2);
|
195 |
PdfPTable billToShipToTable = new PdfPTable(2);
|
| 243 |
Paragraph addressParagraph = new Paragraph(address + "\nTIN NO. "
|
196 |
Paragraph addressParagraph = new Paragraph(address + "\nTIN NO. "
|
| 244 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
197 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
| 245 |
PdfPCell addressCell = new PdfPCell();
|
198 |
PdfPCell addressCell = new PdfPCell();
|
| 246 |
if(warehouseId != shippingWarehouseId) {
|
199 |
if(purchaseOrder.getWarehouseId() != purchaseOrder.getShippingWarehouseId()) {
|
| 247 |
addressParagraph = new Paragraph("Bill To :\n" + address + "\n\nTIN NO. "
|
200 |
addressParagraph = new Paragraph("Bill To :\n" + address + "\n\nTIN NO. "
|
| 248 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
201 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f));
|
| 249 |
}
|
202 |
}
|
| 250 |
addressCell.addElement(addressParagraph);
|
203 |
addressCell.addElement(addressParagraph);
|
| 251 |
//addressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
204 |
//addressCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
| 252 |
addressCell.setBorder(Rectangle.NO_BORDER);
|
205 |
addressCell.setBorder(Rectangle.NO_BORDER);
|
| 253 |
|
206 |
|
| 254 |
if(warehouseId != shippingWarehouseId) {
|
207 |
if(purchaseOrder.getWarehouseId() != purchaseOrder.getShippingWarehouseId()) {
|
| - |
|
208 |
try {
|
| - |
|
209 |
in.shop2020.model.v1.order.TransactionService.Client tClient = new TransactionClient().getClient();
|
| - |
|
210 |
WarehouseAddress addr = tClient.getWarehouseAddress(purchaseOrder.getShippingWarehouseAddressId());
|
| - |
|
211 |
address = binfo.getOrganisationName() + "\n" + addr.getAddress() + "\n" + "-" + addr.getPin();
|
| - |
|
212 |
} catch (Exception e) {
|
| - |
|
213 |
logger.error("This should not happen", e);
|
| - |
|
214 |
}
|
| 255 |
if(shippingWarehouseId ==7) {
|
215 |
/* if(shippingWarehouseId ==7) {
|
| 256 |
shippingAddress = ourAddressDelhi;
|
216 |
shippingAddress = ourAddressDelhi;
|
| 257 |
shippingTinNo = tinNoDelhi;
|
217 |
shippingTinNo = tinNoDelhi;
|
| 258 |
} else if(shippingWarehouseId == 12) {
|
218 |
} else if(shippingWarehouseId == 12) {
|
| 259 |
shippingAddress = ourAddressGoregaon;
|
219 |
shippingAddress = ourAddressGoregaon;
|
| 260 |
shippingTinNo = tinNoMum;
|
220 |
shippingTinNo = tinNoMum;
|
| Line 295... |
Line 255... |
| 295 |
shippingAddress = snapdealAddressDelhi;
|
255 |
shippingAddress = snapdealAddressDelhi;
|
| 296 |
shippingTinNo = tinNoFkDelhi;
|
256 |
shippingTinNo = tinNoFkDelhi;
|
| 297 |
} else if(shippingWarehouseId == 5623){
|
257 |
} else if(shippingWarehouseId == 5623){
|
| 298 |
shippingAddress = amazonAddressDelhi;
|
258 |
shippingAddress = amazonAddressDelhi;
|
| 299 |
shippingTinNo = tinNoDelhi;
|
259 |
shippingTinNo = tinNoDelhi;
|
| 300 |
}
|
260 |
}*/
|
| 301 |
|
261 |
|
| 302 |
PdfPCell billToShipToCell = new PdfPCell();
|
262 |
PdfPCell billToShipToCell = new PdfPCell();
|
| 303 |
billToShipToCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
263 |
billToShipToCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
| 304 |
billToShipToCell.setBorder(Rectangle.NO_BORDER);
|
264 |
billToShipToCell.setBorder(Rectangle.NO_BORDER);
|
| 305 |
|
265 |
|
| 306 |
PdfPCell shippingAddressCell = new PdfPCell();
|
266 |
PdfPCell shippingAddressCell = new PdfPCell();
|
| 307 |
shippingAddressCell.addElement(new Paragraph("Ship To :\n" +shippingAddress + "\nTIN NO. "
|
267 |
shippingAddressCell.addElement(new Paragraph("Ship To :\n" +shippingAddress + "\nTIN NO. "
|
| 308 |
+ shippingTinNo, new Font(FontFamily.TIMES_ROMAN, 8f)));
|
268 |
+ tinNo, new Font(FontFamily.TIMES_ROMAN, 8f)));
|
| 309 |
shippingAddressCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
269 |
shippingAddressCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
| 310 |
shippingAddressCell.setBorder(Rectangle.LEFT);
|
270 |
shippingAddressCell.setBorder(Rectangle.LEFT);
|
| 311 |
billToShipToTable.addCell(addressCell);
|
271 |
billToShipToTable.addCell(addressCell);
|
| 312 |
billToShipToTable.addCell(shippingAddressCell);
|
272 |
billToShipToTable.addCell(shippingAddressCell);
|
| 313 |
billToShipToCell.addElement(billToShipToTable);
|
273 |
billToShipToCell.addElement(billToShipToTable);
|
| Line 355... |
Line 315... |
| 355 |
detailsTable.addCell(new Phrase("Description", helveticaBold8));
|
315 |
detailsTable.addCell(new Phrase("Description", helveticaBold8));
|
| 356 |
detailsTable.addCell(new Phrase("Quantity", helveticaBold8));
|
316 |
detailsTable.addCell(new Phrase("Quantity", helveticaBold8));
|
| 357 |
detailsTable.addCell(new Phrase("Mrp", helveticaBold8));
|
317 |
detailsTable.addCell(new Phrase("Mrp", helveticaBold8));
|
| 358 |
if(purchaseOrder.getTaxType()==TaxType.CFORM){
|
318 |
if(purchaseOrder.getTaxType()==TaxType.CFORM){
|
| 359 |
detailsTable.addCell(new Phrase("Rate Excl CST(Rs)", helveticaBold8));
|
319 |
detailsTable.addCell(new Phrase("Rate Excl CST(Rs)", helveticaBold8));
|
| 360 |
} else {
|
- |
|
| 361 |
detailsTable.addCell(new Phrase("Rate Excl VAT(Rs)", helveticaBold8));
|
- |
|
| 362 |
}
|
- |
|
| 363 |
if(purchaseOrder.getTaxType()==TaxType.CFORM){
|
- |
|
| 364 |
detailsTable.addCell(new Phrase("CST%",helveticaBold8));
|
320 |
detailsTable.addCell(new Phrase("CST%",helveticaBold8));
|
| 365 |
} else {
|
- |
|
| 366 |
detailsTable.addCell(new Phrase("VAT%",helveticaBold8));
|
- |
|
| 367 |
}
|
- |
|
| 368 |
if(purchaseOrder.getTaxType()==TaxType.CFORM){
|
- |
|
| 369 |
detailsTable.addCell(new Phrase("CST Amount",helveticaBold8));
|
321 |
detailsTable.addCell(new Phrase("CST Amount",helveticaBold8));
|
| 370 |
} else {
|
- |
|
| 371 |
detailsTable.addCell(new Phrase("VAT Amount",helveticaBold8));
|
- |
|
| 372 |
}
|
- |
|
| 373 |
if(purchaseOrder.getTaxType()==TaxType.CFORM){
|
- |
|
| 374 |
detailsTable.addCell(new Phrase("Rate Incl CST(Rs)", helveticaBold8));
|
322 |
detailsTable.addCell(new Phrase("Rate Incl CST(Rs)", helveticaBold8));
|
| 375 |
} else {
|
323 |
} else {
|
| - |
|
324 |
detailsTable.addCell(new Phrase("Rate Excl VAT(Rs)", helveticaBold8));
|
| - |
|
325 |
detailsTable.addCell(new Phrase("VAT%",helveticaBold8));
|
| - |
|
326 |
detailsTable.addCell(new Phrase("VAT Amount",helveticaBold8));
|
| 376 |
detailsTable.addCell(new Phrase("Rate Incl VAT(Rs)", helveticaBold8));
|
327 |
detailsTable.addCell(new Phrase("Rate Incl VAT(Rs)", helveticaBold8));
|
| 377 |
}
|
328 |
}
|
| 378 |
detailsTable.addCell(new Phrase("Amount (Rs)", helveticaBold8));
|
329 |
detailsTable.addCell(new Phrase("Amount (Rs)", helveticaBold8));
|
| 379 |
|
330 |
|
| 380 |
int slNo = 0;
|
331 |
int slNo = 0;
|
| Line 413... |
Line 364... |
| 413 |
vatFactor = catalogClient.getVatPercentageForItem(lineitem.getItemId(), supplier.getStateId(), lineitem.getUnitPrice());
|
364 |
vatFactor = catalogClient.getVatPercentageForItem(lineitem.getItemId(), supplier.getStateId(), lineitem.getUnitPrice());
|
| 414 |
}
|
365 |
}
|
| 415 |
}
|
366 |
}
|
| 416 |
double preVatPrice = lineitem.getUnitPrice()/(1+(vatFactor/100));
|
367 |
double preVatPrice = lineitem.getUnitPrice()/(1+(vatFactor/100));
|
| 417 |
double taxAmount = preVatPrice * (vatFactor/100);
|
368 |
double taxAmount = preVatPrice * (vatFactor/100);
|
| 418 |
detailsTable.addCell(new Phrase(String.format("%.2f", preVatPrice),
|
369 |
detailsTable.addCell(new Phrase(String.format("%.2f", preVatPrice), helvetica8));
|
| 419 |
helvetica8));
|
- |
|
| 420 |
detailsTable.addCell(new Phrase(String.format("%.2f", vatFactor),
|
370 |
detailsTable.addCell(new Phrase(String.format("%.2f", vatFactor), helvetica8));
|
| 421 |
helvetica8));
|
- |
|
| 422 |
detailsTable.addCell(new Phrase(String.format("%.2f", taxAmount),
|
371 |
detailsTable.addCell(new Phrase(String.format("%.2f", taxAmount), helvetica8));
|
| 423 |
helvetica8));
|
- |
|
| 424 |
detailsTable.addCell(new Phrase(String.format("%.2f", lineitem.getUnitPrice()),
|
372 |
detailsTable.addCell(new Phrase(String.format("%.2f", lineitem.getUnitPrice()), helvetica8));
|
| 425 |
helvetica8));
|
- |
|
| 426 |
double lineTotal = lineitem.getQuantity() * lineitem.getUnitPrice();
|
373 |
double lineTotal = lineitem.getQuantity() * lineitem.getUnitPrice();
|
| 427 |
totalUnits += lineitem.getQuantity();
|
374 |
totalUnits += lineitem.getQuantity();
|
| 428 |
total += lineTotal;
|
375 |
total += lineTotal;
|
| 429 |
detailsTable.addCell(new Phrase(String.format("%.2f", lineTotal), helvetica8));
|
376 |
detailsTable.addCell(new Phrase(String.format("%.2f", lineTotal), helvetica8));
|
| 430 |
}
|
377 |
}
|