| Line 615... |
Line 615... |
| 615 |
|
615 |
|
| 616 |
double totalAmount = 0.0;
|
616 |
double totalAmount = 0.0;
|
| 617 |
double totalWeight = 0.0;
|
617 |
double totalWeight = 0.0;
|
| 618 |
|
618 |
|
| 619 |
for (Order o: orderList){
|
619 |
for (Order o: orderList){
|
| 620 |
totalAmount = totalAmount + o.getTotal_amount()-o.getGvAmount()-o.getAdvanceAmount();
|
620 |
totalAmount = totalAmount + o.getTotal_amount() +o.getShippingCost()-o.getGvAmount()-o.getAdvanceAmount();
|
| 621 |
totalWeight = totalWeight + o.getTotal_weight();
|
621 |
totalWeight = totalWeight + o.getTotal_weight();
|
| 622 |
}
|
622 |
}
|
| 623 |
|
623 |
|
| 624 |
PdfPTable table = new PdfPTable(1);
|
624 |
PdfPTable table = new PdfPTable(1);
|
| 625 |
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
625 |
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
|
| Line 894... |
Line 894... |
| 894 |
invoiceTable.addCell(new Phrase("Product Name", helvetica8));
|
894 |
invoiceTable.addCell(new Phrase("Product Name", helvetica8));
|
| 895 |
invoiceTable.addCell(new Phrase("Quantity", helvetica8));
|
895 |
invoiceTable.addCell(new Phrase("Quantity", helvetica8));
|
| 896 |
invoiceTable.addCell(new Phrase("Rate", helvetica8));
|
896 |
invoiceTable.addCell(new Phrase("Rate", helvetica8));
|
| 897 |
invoiceTable.addCell(new Phrase("Amount", helvetica8));
|
897 |
invoiceTable.addCell(new Phrase("Amount", helvetica8));
|
| 898 |
double totalAmount = 0.0;
|
898 |
double totalAmount = 0.0;
|
| - |
|
899 |
double totalShippingCost = 0.0;
|
| 899 |
double insuranceAmount = 0.0;
|
900 |
double insuranceAmount = 0.0;
|
| 900 |
double advanceAmount = 0.0;
|
901 |
double advanceAmount = 0.0;
|
| 901 |
|
902 |
|
| 902 |
|
903 |
|
| 903 |
if("Bulk".equalsIgnoreCase(invoiceFormat)){
|
904 |
if("Bulk".equalsIgnoreCase(invoiceFormat)){
|
| Line 907... |
Line 908... |
| 907 |
Map<Long, Double> itemTotalAmtMap = new HashMap<Long, Double>();
|
908 |
Map<Long, Double> itemTotalAmtMap = new HashMap<Long, Double>();
|
| 908 |
String paymentMode = "";
|
909 |
String paymentMode = "";
|
| 909 |
for(Order order : orderList){
|
910 |
for(Order order : orderList){
|
| 910 |
LineItem lineitem = order.getLineitems().get(0);
|
911 |
LineItem lineitem = order.getLineitems().get(0);
|
| 911 |
totalAmount = totalAmount + order.getTotal_amount()-order.getAdvanceAmount();
|
912 |
totalAmount = totalAmount + order.getTotal_amount()-order.getAdvanceAmount();
|
| - |
|
913 |
totalShippingCost = totalShippingCost + order.getShippingCost();
|
| 912 |
if(order.getInsurer() > 0) {
|
914 |
if(order.getInsurer() > 0) {
|
| 913 |
insuranceAmount =insuranceAmount + order.getInsuranceAmount();
|
915 |
insuranceAmount =insuranceAmount + order.getInsuranceAmount();
|
| 914 |
}
|
916 |
}
|
| 915 |
if(order.getSource() == OrderSource.STORE.getValue()) {
|
917 |
if(order.getSource() == OrderSource.STORE.getValue()) {
|
| 916 |
advanceAmount = advanceAmount + order.getAdvanceAmount();
|
918 |
advanceAmount = advanceAmount + order.getAdvanceAmount();
|
| Line 978... |
Line 980... |
| 978 |
invoiceTable.addCell(getAdvanceAmountCell(4));
|
980 |
invoiceTable.addCell(getAdvanceAmountCell(4));
|
| 979 |
invoiceTable.addCell(getPriceCell(order.getAdvanceAmount()));
|
981 |
invoiceTable.addCell(getPriceCell(order.getAdvanceAmount()));
|
| 980 |
invoiceTable.addCell(getPriceCell(order.getAdvanceAmount()));
|
982 |
invoiceTable.addCell(getPriceCell(order.getAdvanceAmount()));
|
| 981 |
}
|
983 |
}
|
| 982 |
totalAmount = totalAmount + order.getTotal_amount()-order.getAdvanceAmount();
|
984 |
totalAmount = totalAmount + order.getTotal_amount()-order.getAdvanceAmount();
|
| - |
|
985 |
totalShippingCost = totalShippingCost + order.getShippingCost();
|
| 983 |
}
|
986 |
}
|
| 984 |
}
|
987 |
}
|
| - |
|
988 |
if(totalShippingCost>0){
|
| - |
|
989 |
invoiceTable.addCell(getShippingCostCell(4));
|
| - |
|
990 |
invoiceTable.addCell(getRupeesCell());
|
| - |
|
991 |
invoiceTable.addCell(getTotalAmountCell(totalShippingCost));
|
| 985 |
|
992 |
}
|
| 986 |
invoiceTable.addCell(getTotalCell(4));
|
993 |
invoiceTable.addCell(getTotalCell(4));
|
| 987 |
invoiceTable.addCell(getRupeesCell());
|
994 |
invoiceTable.addCell(getRupeesCell());
|
| 988 |
invoiceTable.addCell(getTotalAmountCell(totalAmount));
|
995 |
invoiceTable.addCell(getTotalAmountCell(totalAmount+totalShippingCost));
|
| 989 |
|
996 |
|
| 990 |
|
997 |
|
| 991 |
PdfPCell tinCell = new PdfPCell(new Phrase("TIN NO. " + tinNo, helvetica8));
|
998 |
PdfPCell tinCell = new PdfPCell(new Phrase("TIN NO. " + tinNo, helvetica8));
|
| 992 |
tinCell.setColspan(6);
|
999 |
tinCell.setColspan(6);
|
| 993 |
tinCell.setPadding(2);
|
1000 |
tinCell.setPadding(2);
|
| Line 1435... |
Line 1442... |
| 1435 |
invoiceTable.addCell(new Phrase("Tax Rate%", helveticaBold8));
|
1442 |
invoiceTable.addCell(new Phrase("Tax Rate%", helveticaBold8));
|
| 1436 |
invoiceTable.addCell(new Phrase("Tax (Rs)", helveticaBold8));
|
1443 |
invoiceTable.addCell(new Phrase("Tax (Rs)", helveticaBold8));
|
| 1437 |
invoiceTable.addCell(new Phrase("Item Total (Rs)", helveticaBold8));;
|
1444 |
invoiceTable.addCell(new Phrase("Item Total (Rs)", helveticaBold8));;
|
| 1438 |
double totalAmount = 0.0;
|
1445 |
double totalAmount = 0.0;
|
| 1439 |
double insuranceAmount = 0.0;
|
1446 |
double insuranceAmount = 0.0;
|
| - |
|
1447 |
double totalShippingCost = 0.0;
|
| 1440 |
int i=1;
|
1448 |
int i=1;
|
| 1441 |
if("Bulk".equalsIgnoreCase(invoiceFormat)){
|
1449 |
if("Bulk".equalsIgnoreCase(invoiceFormat)){
|
| 1442 |
Map<Long, String> itemNamesMap= new HashMap<Long, String>();
|
1450 |
Map<Long, String> itemNamesMap= new HashMap<Long, String>();
|
| 1443 |
Map<Long, Double> itemQuantityMap = new HashMap<Long, Double>();
|
1451 |
Map<Long, Double> itemQuantityMap = new HashMap<Long, Double>();
|
| 1444 |
Map<Long, Double> itemRateMap = new HashMap<Long, Double>();
|
1452 |
Map<Long, Double> itemRateMap = new HashMap<Long, Double>();
|
| Line 1451... |
Line 1459... |
| 1451 |
|
1459 |
|
| 1452 |
double orderAmount = order.getTotal_amount();
|
1460 |
double orderAmount = order.getTotal_amount();
|
| 1453 |
double rate = lineitem.getVatRate();
|
1461 |
double rate = lineitem.getVatRate();
|
| 1454 |
double salesTax = (rate * (orderAmount - order.getInsuranceAmount()))/(100 + rate);
|
1462 |
double salesTax = (rate * (orderAmount - order.getInsuranceAmount()))/(100 + rate);
|
| 1455 |
totalAmount = totalAmount + orderAmount;
|
1463 |
totalAmount = totalAmount + orderAmount;
|
| - |
|
1464 |
totalShippingCost = totalShippingCost + order.getShippingCost();
|
| 1456 |
double itemPrice = lineitem.getUnit_price();
|
1465 |
double itemPrice = lineitem.getUnit_price();
|
| 1457 |
double showPrice = (100 * itemPrice)/(100 + rate);
|
1466 |
double showPrice = (100 * itemPrice)/(100 + rate);
|
| 1458 |
double totalPrice = lineitem.getTotal_price();
|
1467 |
double totalPrice = lineitem.getTotal_price();
|
| 1459 |
double showTotalPrice = (100 * totalPrice)/(100 + rate);
|
1468 |
double showTotalPrice = (100 * totalPrice)/(100 + rate);
|
| 1460 |
|
1469 |
|
| Line 1535... |
Line 1544... |
| 1535 |
|
1544 |
|
| 1536 |
if(order.getInsurer() > 0) {
|
1545 |
if(order.getInsurer() > 0) {
|
| 1537 |
insuranceAmount =insuranceAmount + order.getInsuranceAmount();
|
1546 |
insuranceAmount =insuranceAmount + order.getInsuranceAmount();
|
| 1538 |
}
|
1547 |
}
|
| 1539 |
totalAmount = totalAmount+ orderAmount;
|
1548 |
totalAmount = totalAmount+ orderAmount;
|
| - |
|
1549 |
totalShippingCost = totalShippingCost + order.getShippingCost();
|
| 1540 |
i++;
|
1550 |
i++;
|
| 1541 |
}
|
1551 |
}
|
| 1542 |
}
|
1552 |
}
|
| 1543 |
|
1553 |
|
| 1544 |
if(insuranceAmount>0){
|
1554 |
if(insuranceAmount>0){
|
| 1545 |
invoiceTable.addCell(getInsuranceCell(7));
|
1555 |
invoiceTable.addCell(getInsuranceCell(7));
|
| 1546 |
invoiceTable.addCell(getPriceCell(insuranceAmount));
|
1556 |
invoiceTable.addCell(getPriceCell(insuranceAmount));
|
| 1547 |
}
|
1557 |
}
|
| - |
|
1558 |
if(totalShippingCost>0){
|
| - |
|
1559 |
invoiceTable.addCell(getShippingCostCell(4));
|
| - |
|
1560 |
invoiceTable.addCell(getRupeesCell());
|
| - |
|
1561 |
invoiceTable.addCell(getTotalAmountCell(totalShippingCost));
|
| 1548 |
|
1562 |
}
|
| 1549 |
invoiceTable.addCell(getTotalCell(6));
|
1563 |
invoiceTable.addCell(getTotalCell(6));
|
| 1550 |
invoiceTable.addCell(getRupeesCell());
|
1564 |
invoiceTable.addCell(getRupeesCell());
|
| 1551 |
invoiceTable.addCell(getTotalAmountCell(totalAmount));
|
1565 |
invoiceTable.addCell(getTotalAmountCell(totalAmount+totalShippingCost));
|
| 1552 |
|
1566 |
|
| 1553 |
invoiceTable.addCell(new Phrase("Amount in Words:", helveticaBold8));
|
1567 |
invoiceTable.addCell(new Phrase("Amount in Words:", helveticaBold8));
|
| 1554 |
invoiceTable.addCell(getAmountInWordsCell(totalAmount));
|
1568 |
invoiceTable.addCell(getAmountInWordsCell(totalAmount+totalShippingCost));
|
| 1555 |
|
1569 |
|
| 1556 |
invoiceTable.addCell(getEOECell(8));
|
1570 |
invoiceTable.addCell(getEOECell(8));
|
| 1557 |
|
1571 |
|
| 1558 |
return invoiceTable;
|
1572 |
return invoiceTable;
|
| 1559 |
}
|
1573 |
}
|
| Line 1659... |
Line 1673... |
| 1659 |
private PdfPCell getEmptyCell(int colspan) {
|
1673 |
private PdfPCell getEmptyCell(int colspan) {
|
| 1660 |
PdfPCell emptyCell = new PdfPCell(new Phrase(" ", helvetica8));
|
1674 |
PdfPCell emptyCell = new PdfPCell(new Phrase(" ", helvetica8));
|
| 1661 |
emptyCell.setColspan(colspan);
|
1675 |
emptyCell.setColspan(colspan);
|
| 1662 |
return emptyCell;
|
1676 |
return emptyCell;
|
| 1663 |
}
|
1677 |
}
|
| - |
|
1678 |
|
| - |
|
1679 |
private PdfPCell getShippingCostCell(int colspan) {
|
| - |
|
1680 |
PdfPCell shippingCostCell = new PdfPCell(new Phrase("Shipping Charges", helvetica8));
|
| - |
|
1681 |
shippingCostCell.setColspan(colspan);
|
| - |
|
1682 |
return shippingCostCell;
|
| - |
|
1683 |
}
|
| - |
|
1684 |
|
| - |
|
1685 |
private PdfPCell getCodChargesCell(int colspan) {
|
| - |
|
1686 |
PdfPCell codChargesCell = new PdfPCell(new Phrase("COD Charges", helvetica8));
|
| - |
|
1687 |
codChargesCell.setColspan(colspan);
|
| - |
|
1688 |
return codChargesCell;
|
| - |
|
1689 |
}
|
| 1664 |
|
1690 |
|
| 1665 |
private PdfPCell getTotalCell(int colspan) {
|
1691 |
private PdfPCell getTotalCell(int colspan) {
|
| 1666 |
PdfPCell totalCell = new PdfPCell(new Phrase("Grand Total", helveticaBold8));
|
1692 |
PdfPCell totalCell = new PdfPCell(new Phrase("Grand Total", helveticaBold8));
|
| 1667 |
totalCell.setColspan(colspan);
|
1693 |
totalCell.setColspan(colspan);
|
| 1668 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
1694 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|