| Line 1009... |
Line 1009... |
| 1009 |
invoiceTable.addCell(new Phrase("Amount", helvetica8));
|
1009 |
invoiceTable.addCell(new Phrase("Amount", helvetica8));
|
| 1010 |
double totalAmount = 0.0;
|
1010 |
double totalAmount = 0.0;
|
| 1011 |
double totalShippingCost = 0.0;
|
1011 |
double totalShippingCost = 0.0;
|
| 1012 |
double insuranceAmount = 0.0;
|
1012 |
double insuranceAmount = 0.0;
|
| 1013 |
double advanceAmount = 0.0;
|
1013 |
double advanceAmount = 0.0;
|
| - |
|
1014 |
double totalGvAmount = 0.0;
|
| 1014 |
|
1015 |
|
| 1015 |
|
1016 |
|
| 1016 |
if("Bulk".equalsIgnoreCase(invoiceFormat)){
|
1017 |
if("Bulk".equalsIgnoreCase(invoiceFormat)){
|
| 1017 |
Map<Long, String> itemNamesMap= new HashMap<Long, String>();
|
1018 |
Map<Long, String> itemNamesMap= new HashMap<Long, String>();
|
| 1018 |
Map<Long, Double> itemQuantityMap = new HashMap<Long, Double>();
|
1019 |
Map<Long, Double> itemQuantityMap = new HashMap<Long, Double>();
|
| 1019 |
Map<Long, Double> itemRateMap = new HashMap<Long, Double>();
|
1020 |
Map<Long, Double> itemRateMap = new HashMap<Long, Double>();
|
| 1020 |
Map<Long, Double> itemTotalAmtMap = new HashMap<Long, Double>();
|
1021 |
Map<Long, Double> itemTotalAmtMap = new HashMap<Long, Double>();
|
| 1021 |
String paymentMode = "";
|
1022 |
String paymentMode = "";
|
| 1022 |
for(Order order : orderList){
|
1023 |
for(Order order : orderList){
|
| 1023 |
LineItem lineitem = order.getLineitems().get(0);
|
1024 |
LineItem lineitem = order.getLineitems().get(0);
|
| 1024 |
totalAmount = totalAmount + order.getTotal_amount()-order.getAdvanceAmount();
|
1025 |
totalAmount = totalAmount + order.getTotal_amount()-order.getAdvanceAmount()-order.getGvAmount();
|
| 1025 |
totalShippingCost = totalShippingCost + order.getShippingCost();
|
1026 |
totalShippingCost = totalShippingCost + order.getShippingCost();
|
| - |
|
1027 |
totalGvAmount = totalGvAmount + order.getGvAmount();
|
| 1026 |
if(order.getInsurer() > 0) {
|
1028 |
if(order.getInsurer() > 0) {
|
| 1027 |
insuranceAmount =insuranceAmount + order.getInsuranceAmount();
|
1029 |
insuranceAmount =insuranceAmount + order.getInsuranceAmount();
|
| 1028 |
}
|
1030 |
}
|
| 1029 |
if(order.getSource() == OrderSource.STORE.getValue()) {
|
1031 |
if(order.getSource() == OrderSource.STORE.getValue()) {
|
| 1030 |
advanceAmount = advanceAmount + order.getAdvanceAmount();
|
1032 |
advanceAmount = advanceAmount + order.getAdvanceAmount();
|
| Line 1067... |
Line 1069... |
| 1067 |
invoiceTable.addCell(new Phrase(itemQuantityMap.get(itemId)+"", helvetica8));
|
1069 |
invoiceTable.addCell(new Phrase(itemQuantityMap.get(itemId)+"", helvetica8));
|
| 1068 |
invoiceTable.addCell(new Phrase(itemRateMap.get(itemId)+"", helvetica8));
|
1070 |
invoiceTable.addCell(new Phrase(itemRateMap.get(itemId)+"", helvetica8));
|
| 1069 |
invoiceTable.addCell(new Phrase(itemTotalAmtMap.get(itemId)+"", helvetica8));
|
1071 |
invoiceTable.addCell(new Phrase(itemTotalAmtMap.get(itemId)+"", helvetica8));
|
| 1070 |
}
|
1072 |
}
|
| 1071 |
|
1073 |
|
| 1072 |
if(insuranceAmount>0){
|
- |
|
| 1073 |
invoiceTable.addCell(getInsuranceCell(4));
|
- |
|
| 1074 |
invoiceTable.addCell(getPriceCell(insuranceAmount));
|
- |
|
| 1075 |
invoiceTable.addCell(getPriceCell(insuranceAmount));
|
- |
|
| 1076 |
}
|
- |
|
| 1077 |
if(advanceAmount>0){
|
- |
|
| 1078 |
invoiceTable.addCell(getAdvanceAmountCell(4));
|
- |
|
| 1079 |
invoiceTable.addCell(getPriceCell(advanceAmount));
|
- |
|
| 1080 |
invoiceTable.addCell(getPriceCell(advanceAmount));
|
- |
|
| 1081 |
}
|
- |
|
| 1082 |
}else{
|
1074 |
}else{
|
| 1083 |
for(Order order : orderList){
|
1075 |
for(Order order : orderList){
|
| 1084 |
populateTopInvoiceTable(order, invoiceTable);
|
1076 |
populateTopInvoiceTable(order, invoiceTable);
|
| 1085 |
if(order.getInsurer() > 0) {
|
1077 |
if(order.getInsurer() > 0) {
|
| 1086 |
invoiceTable.addCell(getInsuranceCell(4));
|
1078 |
invoiceTable.addCell(getInsuranceCell(4));
|
| Line 1091... |
Line 1083... |
| 1091 |
if(order.getSource() == OrderSource.STORE.getValue()) {
|
1083 |
if(order.getSource() == OrderSource.STORE.getValue()) {
|
| 1092 |
invoiceTable.addCell(getAdvanceAmountCell(4));
|
1084 |
invoiceTable.addCell(getAdvanceAmountCell(4));
|
| 1093 |
invoiceTable.addCell(getPriceCell(order.getAdvanceAmount()));
|
1085 |
invoiceTable.addCell(getPriceCell(order.getAdvanceAmount()));
|
| 1094 |
invoiceTable.addCell(getPriceCell(order.getAdvanceAmount()));
|
1086 |
invoiceTable.addCell(getPriceCell(order.getAdvanceAmount()));
|
| 1095 |
}
|
1087 |
}
|
| - |
|
1088 |
if(order.getInsurer() > 0) {
|
| - |
|
1089 |
insuranceAmount =insuranceAmount + order.getInsuranceAmount();
|
| - |
|
1090 |
}
|
| - |
|
1091 |
if(order.getSource() == OrderSource.STORE.getValue()) {
|
| - |
|
1092 |
advanceAmount = advanceAmount + order.getAdvanceAmount();
|
| - |
|
1093 |
}
|
| 1096 |
totalAmount = totalAmount + order.getTotal_amount()-order.getAdvanceAmount();
|
1094 |
totalAmount = totalAmount + order.getTotal_amount()-order.getAdvanceAmount()-order.getGvAmount();
|
| 1097 |
totalShippingCost = totalShippingCost + order.getShippingCost();
|
1095 |
totalShippingCost = totalShippingCost + order.getShippingCost();
|
| - |
|
1096 |
totalGvAmount = totalGvAmount + order.getGvAmount();
|
| 1098 |
}
|
1097 |
}
|
| 1099 |
}
|
1098 |
}
|
| - |
|
1099 |
if(insuranceAmount>0){
|
| - |
|
1100 |
invoiceTable.addCell(getInsuranceCell(4));
|
| - |
|
1101 |
invoiceTable.addCell(getPriceCell(insuranceAmount));
|
| - |
|
1102 |
invoiceTable.addCell(getPriceCell(insuranceAmount));
|
| - |
|
1103 |
}
|
| - |
|
1104 |
if(advanceAmount>0){
|
| - |
|
1105 |
invoiceTable.addCell(getAdvanceAmountCell(4));
|
| - |
|
1106 |
invoiceTable.addCell(getPriceCell(advanceAmount));
|
| - |
|
1107 |
invoiceTable.addCell(getPriceCell(advanceAmount));
|
| - |
|
1108 |
}
|
| 1100 |
if(totalShippingCost>0){
|
1109 |
if(totalShippingCost>0){
|
| 1101 |
invoiceTable.addCell(getShippingCostCell(4));
|
1110 |
invoiceTable.addCell(getShippingCostCell(4));
|
| 1102 |
invoiceTable.addCell(getRupeesCell(false));
|
1111 |
invoiceTable.addCell(getRupeesCell(false));
|
| 1103 |
invoiceTable.addCell(getPriceCell(totalShippingCost));
|
1112 |
invoiceTable.addCell(getPriceCell(totalShippingCost));
|
| 1104 |
}
|
1113 |
}
|
| - |
|
1114 |
if(totalGvAmount>0){
|
| - |
|
1115 |
totalGvAmount = 0-totalGvAmount;
|
| - |
|
1116 |
invoiceTable.addCell(getGvAmountCell(4));
|
| - |
|
1117 |
invoiceTable.addCell(getRupeesCell(false));
|
| - |
|
1118 |
invoiceTable.addCell(getPriceCell(totalGvAmount));
|
| - |
|
1119 |
}
|
| 1105 |
invoiceTable.addCell(getTotalCell(4));
|
1120 |
invoiceTable.addCell(getTotalCell(4));
|
| 1106 |
invoiceTable.addCell(getRupeesCell(true));
|
1121 |
invoiceTable.addCell(getRupeesCell(true));
|
| 1107 |
invoiceTable.addCell(getTotalAmountCell(totalAmount+totalShippingCost));
|
1122 |
invoiceTable.addCell(getTotalAmountCell(totalAmount+totalShippingCost));
|
| 1108 |
|
1123 |
|
| 1109 |
|
1124 |
|
| Line 1128... |
Line 1143... |
| 1128 |
|
1143 |
|
| 1129 |
invoiceTable.addCell(getProductNameCell(lineitem, false, order.getFreebieItemId()));
|
1144 |
invoiceTable.addCell(getProductNameCell(lineitem, false, order.getFreebieItemId()));
|
| 1130 |
|
1145 |
|
| 1131 |
invoiceTable.addCell(new Phrase(lineitem.getQuantity() + "", helvetica8));
|
1146 |
invoiceTable.addCell(new Phrase(lineitem.getQuantity() + "", helvetica8));
|
| 1132 |
|
1147 |
|
| 1133 |
invoiceTable.addCell(getPriceCell(lineitem.getUnit_price()-order.getGvAmount()));
|
1148 |
invoiceTable.addCell(getPriceCell(lineitem.getUnit_price()));
|
| 1134 |
|
1149 |
|
| 1135 |
invoiceTable.addCell(getPriceCell(lineitem.getTotal_price()-order.getGvAmount()));
|
1150 |
invoiceTable.addCell(getPriceCell(lineitem.getTotal_price()));
|
| 1136 |
}
|
1151 |
}
|
| 1137 |
}
|
1152 |
}
|
| 1138 |
|
1153 |
|
| 1139 |
private PdfPCell getAddressCell(String address) {
|
1154 |
private PdfPCell getAddressCell(String address) {
|
| 1140 |
Paragraph addressParagraph = new Paragraph(address, new Font(FontFamily.TIMES_ROMAN, 8f));
|
1155 |
Paragraph addressParagraph = new Paragraph(address, new Font(FontFamily.TIMES_ROMAN, 8f));
|
| Line 1873... |
Line 1888... |
| 1873 |
private PdfPCell getCodChargesCell(int colspan) {
|
1888 |
private PdfPCell getCodChargesCell(int colspan) {
|
| 1874 |
PdfPCell codChargesCell = new PdfPCell(new Phrase("COD Charges", helvetica8));
|
1889 |
PdfPCell codChargesCell = new PdfPCell(new Phrase("COD Charges", helvetica8));
|
| 1875 |
codChargesCell.setColspan(colspan);
|
1890 |
codChargesCell.setColspan(colspan);
|
| 1876 |
return codChargesCell;
|
1891 |
return codChargesCell;
|
| 1877 |
}
|
1892 |
}
|
| - |
|
1893 |
|
| - |
|
1894 |
private PdfPCell getGvAmountCell(int colspan) {
|
| - |
|
1895 |
PdfPCell codChargesCell = new PdfPCell(new Phrase("GV Amount", helvetica8));
|
| - |
|
1896 |
codChargesCell.setColspan(colspan);
|
| - |
|
1897 |
return codChargesCell;
|
| - |
|
1898 |
}
|
| 1878 |
|
1899 |
|
| 1879 |
private PdfPCell getTotalCell(int colspan) {
|
1900 |
private PdfPCell getTotalCell(int colspan) {
|
| 1880 |
PdfPCell totalCell = new PdfPCell(new Phrase("Grand Total", helveticaBold8));
|
1901 |
PdfPCell totalCell = new PdfPCell(new Phrase("Grand Total", helveticaBold8));
|
| 1881 |
totalCell.setColspan(colspan);
|
1902 |
totalCell.setColspan(colspan);
|
| 1882 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
1903 |
totalCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|