| Line 141... |
Line 141... |
| 141 |
poSummaryTable.addCell(new PdfPCell(new Phrase("PO No: "
|
141 |
poSummaryTable.addCell(new PdfPCell(new Phrase("PO No: "
|
| 142 |
+ purchaseOrder.getPoNumber())));
|
142 |
+ purchaseOrder.getPoNumber())));
|
| 143 |
poSummaryTable.addCell(new PdfPCell(new Phrase("Date: "
|
143 |
poSummaryTable.addCell(new PdfPCell(new Phrase("Date: "
|
| 144 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
144 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
| 145 |
poDate))));
|
145 |
poDate))));
|
| 146 |
poSummaryTable.addCell(new PdfPCell(new Phrase("PO Valid for delivery by <Expiry Date>: "
|
146 |
poSummaryTable.addCell(new PdfPCell(new Phrase("PO Valid for delivery by: "
|
| 147 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
147 |
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(
|
| 148 |
poExpiryDate))));
|
148 |
poExpiryDate))));
|
| 149 |
poSummaryTable.setSpacingBefore(10.0f);
|
149 |
poSummaryTable.setSpacingBefore(10.0f);
|
| 150 |
|
150 |
|
| 151 |
poTable.addCell(poTitleCell);
|
151 |
poTable.addCell(poTitleCell);
|
| Line 367... |
Line 367... |
| 367 |
for (in.shop2020.purchase.LineItem lineitem : purchaseOrder
|
367 |
for (in.shop2020.purchase.LineItem lineitem : purchaseOrder
|
| 368 |
.getLineitems()) {
|
368 |
.getLineitems()) {
|
| 369 |
slNo++;
|
369 |
slNo++;
|
| 370 |
detailsTable.addCell(new Phrase(slNo + "", helvetica8));
|
370 |
detailsTable.addCell(new Phrase(slNo + "", helvetica8));
|
| 371 |
detailsTable.addCell(getProductNameCell(lineitem));
|
371 |
detailsTable.addCell(getProductNameCell(lineitem));
|
| 372 |
detailsTable.addCell(new Phrase(lineitem.getQuantity() + "",
|
372 |
detailsTable.addCell(new Phrase(String.format("%.0f", lineitem.getQuantity()),
|
| 373 |
helvetica8));
|
373 |
helvetica8));
|
| 374 |
if(lineitem.isSetMrp() && lineitem.getMrp()>0){
|
374 |
if(lineitem.isSetMrp() && lineitem.getMrp()>0){
|
| 375 |
detailsTable.addCell(new Phrase(lineitem.getMrp() + "",
|
375 |
detailsTable.addCell(new Phrase(String.format("%.2f", lineitem.getMrp()),
|
| 376 |
helvetica8));
|
376 |
helvetica8));
|
| 377 |
} else {
|
377 |
} else {
|
| 378 |
detailsTable.addCell(new Phrase(" ",
|
378 |
detailsTable.addCell(new Phrase(" ",
|
| 379 |
helvetica8));
|
379 |
helvetica8));
|
| 380 |
}
|
380 |
}
|
| Line 386... |
Line 386... |
| 386 |
}else{
|
386 |
}else{
|
| 387 |
vatFactor = catalogClient.getVatPercentageForItem(lineitem.getItemId(), supplier.getStateId(), lineitem.getUnitPrice());
|
387 |
vatFactor = catalogClient.getVatPercentageForItem(lineitem.getItemId(), supplier.getStateId(), lineitem.getUnitPrice());
|
| 388 |
}
|
388 |
}
|
| 389 |
}
|
389 |
}
|
| 390 |
double taxAmount = (lineitem.getUnitPrice() * vatFactor)/100;
|
390 |
double taxAmount = (lineitem.getUnitPrice() * vatFactor)/100;
|
| 391 |
detailsTable.addCell(new Phrase((lineitem.getUnitPrice()-taxAmount) + "",
|
391 |
detailsTable.addCell(new Phrase((String.format("%.2f", lineitem.getUnitPrice()-taxAmount)) + "",
|
| 392 |
helvetica8));
|
392 |
helvetica8));
|
| 393 |
detailsTable.addCell(new Phrase(vatFactor + "",
|
393 |
detailsTable.addCell(new Phrase(String.format("%.2f", vatFactor),
|
| 394 |
helvetica8));
|
394 |
helvetica8));
|
| 395 |
detailsTable.addCell(new Phrase(taxAmount + "",
|
395 |
detailsTable.addCell(new Phrase(String.format("%.2f", taxAmount),
|
| 396 |
helvetica8));
|
396 |
helvetica8));
|
| 397 |
detailsTable.addCell(new Phrase(lineitem.getUnitPrice() + "",
|
397 |
detailsTable.addCell(new Phrase(String.format("%.2f", lineitem.getUnitPrice()),
|
| 398 |
helvetica8));
|
398 |
helvetica8));
|
| 399 |
double lineTotal = lineitem.getQuantity() * lineitem.getUnitPrice();
|
399 |
double lineTotal = lineitem.getQuantity() * lineitem.getUnitPrice();
|
| 400 |
totalUnits += lineitem.getQuantity();
|
400 |
totalUnits += lineitem.getQuantity();
|
| 401 |
total += lineTotal;
|
401 |
total += lineTotal;
|
| 402 |
detailsTable.addCell(new Phrase("" + lineTotal, helvetica8));
|
402 |
detailsTable.addCell(new Phrase(String.format("%.2f", lineTotal), helvetica8));
|
| 403 |
}
|
403 |
}
|
| 404 |
detailsTable.addCell(getTotalCell(2));
|
404 |
detailsTable.addCell(getTotalCell(2));
|
| 405 |
detailsTable.addCell(new Phrase(BigDecimal.valueOf(totalUnits).toPlainString(), helvetica8));
|
405 |
detailsTable.addCell(new Phrase(String.format("%.0f", totalUnits), helvetica8));
|
| 406 |
detailsTable.addCell(getTotalAmountCell(6,total));
|
406 |
detailsTable.addCell(getTotalAmountCell(6,total));
|
| 407 |
return detailsTable;
|
407 |
return detailsTable;
|
| 408 |
}
|
408 |
}
|
| 409 |
|
409 |
|
| 410 |
private static PdfPTable getBillToTable(long warehouseId, TaxType taxType) {
|
410 |
private static PdfPTable getBillToTable(long warehouseId, TaxType taxType) {
|
| Line 532... |
Line 532... |
| 532 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
532 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
| 533 |
return totalCell;
|
533 |
return totalCell;
|
| 534 |
}
|
534 |
}
|
| 535 |
|
535 |
|
| 536 |
private static PdfPCell getTotalAmountCell(int colspan, double totalAmount){
|
536 |
private static PdfPCell getTotalAmountCell(int colspan, double totalAmount){
|
| 537 |
PdfPCell totalCell = new PdfPCell(new Phrase(BigDecimal.valueOf(totalAmount).toPlainString(), helvetica8));
|
537 |
PdfPCell totalCell = new PdfPCell(new Phrase(String.format("%.2f", totalAmount), helvetica8));
|
| 538 |
totalCell.setColspan(colspan);
|
538 |
totalCell.setColspan(colspan);
|
| 539 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
539 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
| 540 |
return totalCell;
|
540 |
return totalCell;
|
| 541 |
}
|
541 |
}
|
| 542 |
|
542 |
|