Subversion Repositories SmartDukaan

Rev

Rev 33172 | Rev 33740 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33172 Rev 33737
Line 968... Line 968...
968
			default:
968
			default:
969
				return "";
969
				return "";
970
		}
970
		}
971
	}
971
	}
972
 
972
 
-
 
973
 
-
 
974
	public static void writePurchaseInvoicesReport(List<PurchaseInvoiceModel> purchaseInvoiceModels, OutputStream outputStream) {
-
 
975
		SXSSFWorkbook workbook = new SXSSFWorkbook();
-
 
976
 
-
 
977
		// CreationHelper createHelper = workbook.getCreationHelper();
-
 
978
 
-
 
979
		SXSSFSheet sheet = workbook.createSheet("PurchaseInvoicesReport");
-
 
980
		sheet.trackAllColumnsForAutoSizing();
-
 
981
 
-
 
982
		Row rowHeader = sheet.createRow(0);
-
 
983
		Cell cellPoIdHeader = rowHeader.createCell(0);
-
 
984
		cellPoIdHeader.setCellValue("PoId");
-
 
985
 
-
 
986
		Cell cellPoDateHeader = rowHeader.createCell(1);
-
 
987
		cellPoDateHeader.setCellValue("PoDate");
-
 
988
 
-
 
989
		Cell cellGrnNoHeader = rowHeader.createCell(2);
-
 
990
		cellGrnNoHeader.setCellValue("GRN_No");
-
 
991
 
-
 
992
		Cell cellGrnDateHeader = rowHeader.createCell(3);
-
 
993
		cellGrnDateHeader.setCellValue("GRN_Date");
-
 
994
 
-
 
995
		Cell cellSupplierNameHeader = rowHeader.createCell(4);
-
 
996
		cellSupplierNameHeader.setCellValue("Supplier_Name");
-
 
997
 
-
 
998
		Cell cellSupplierEmailHeader = rowHeader.createCell(5);
-
 
999
		cellSupplierEmailHeader.setCellValue("Supplier_Email");
-
 
1000
 
-
 
1001
		Cell cellSupplierContactNumberHeader = rowHeader.createCell(6);
-
 
1002
		cellSupplierContactNumberHeader.setCellValue("Supplier_Contact_Number");
-
 
1003
 
-
 
1004
		Cell cellInvoiceNumberHeader = rowHeader.createCell(7);
-
 
1005
		cellInvoiceNumberHeader.setCellValue("Invoice_Number");
-
 
1006
 
-
 
1007
		Cell cellInvoiceDateHeader = rowHeader.createCell(8);
-
 
1008
		cellInvoiceDateHeader.setCellValue("Invoice_Date");
-
 
1009
 
-
 
1010
		Cell cellReceivedFromHeader = rowHeader.createCell(9);
-
 
1011
		cellReceivedFromHeader.setCellValue("Received_From");
-
 
1012
 
-
 
1013
		Cell cellItemIdHeader = rowHeader.createCell(10);
-
 
1014
		cellItemIdHeader.setCellValue("Item_Id");
-
 
1015
 
-
 
1016
		Cell cellBrandHeader = rowHeader.createCell(11);
-
 
1017
		cellBrandHeader.setCellValue("Brand");
-
 
1018
 
-
 
1019
		Cell cellModelNameHeader = rowHeader.createCell(12);
-
 
1020
		cellModelNameHeader.setCellValue("Model_Name");
-
 
1021
 
-
 
1022
		Cell cellModelNumberHeader = rowHeader.createCell(13);
-
 
1023
		cellModelNumberHeader.setCellValue("Model_Number");
-
 
1024
 
-
 
1025
		Cell cellColorHeader = rowHeader.createCell(14);
-
 
1026
		cellColorHeader.setCellValue("Color");
-
 
1027
 
-
 
1028
		Cell cellUnitPriceHeader = rowHeader.createCell(15);
-
 
1029
		cellUnitPriceHeader.setCellValue("Unit_Price");
-
 
1030
 
-
 
1031
		Cell cellSGSTHeader = rowHeader.createCell(16);
-
 
1032
		cellSGSTHeader.setCellValue("SGST%");
-
 
1033
 
-
 
1034
		Cell cellSGSTAmountHeader = rowHeader.createCell(17);
-
 
1035
		cellSGSTAmountHeader.setCellValue("SGST_Amount");
-
 
1036
 
-
 
1037
		Cell cellCGSTHeader = rowHeader.createCell(18);
-
 
1038
		cellCGSTHeader.setCellValue("CGST%");
-
 
1039
 
-
 
1040
		Cell cellCGSTAmountHeader = rowHeader.createCell(19);
-
 
1041
		cellCGSTAmountHeader.setCellValue("CGST_Amount");
-
 
1042
 
-
 
1043
		Cell cellIGSTHeader = rowHeader.createCell(20);
-
 
1044
		cellIGSTHeader.setCellValue("IGST%");
-
 
1045
 
-
 
1046
		Cell cellIGSTAmountHeader = rowHeader.createCell(21);
-
 
1047
		cellIGSTAmountHeader.setCellValue("IGST_Amount");
-
 
1048
 
-
 
1049
		Cell cellQuantityHeader = rowHeader.createCell(22);
-
 
1050
		cellQuantityHeader.setCellValue("Quantity");
-
 
1051
 
-
 
1052
		Cell cellAmountHeader = rowHeader.createCell(23);
-
 
1053
		cellAmountHeader.setCellValue("Amount");
-
 
1054
 
-
 
1055
		Cell cellWarehouseHeader = rowHeader.createCell(24);
-
 
1056
		cellWarehouseHeader.setCellValue("Warehouse_Address");
-
 
1057
 
-
 
1058
		Font font = workbook.createFont();
-
 
1059
		CellStyle cellStyle = workbook.createCellStyle();
-
 
1060
		font.setBold(true);
-
 
1061
		cellStyle.setAlignment(HorizontalAlignment.CENTER);
-
 
1062
		// font.setFontHeight((short)16);
-
 
1063
		cellStyle.setFont(font);
-
 
1064
		for (int i = 0; i < 14; i++) {
-
 
1065
			if (rowHeader.getCell(i) != null) {
-
 
1066
				rowHeader.getCell(i).setCellStyle(cellStyle);
-
 
1067
			}
-
 
1068
		}
-
 
1069
 
-
 
1070
		for (int index = 0; index < purchaseInvoiceModels.size(); index++) {
-
 
1071
			PurchaseInvoiceModel purchaseInvoiceModel = purchaseInvoiceModels.get(index);
-
 
1072
 
-
 
1073
			Row rowValues = sheet.createRow(index + 1);
-
 
1074
			Cell cellPoId = rowValues.createCell(0);
-
 
1075
			cellPoId.setCellValue(purchaseInvoiceModel.getPoId());
-
 
1076
 
-
 
1077
			Cell cellPoDate = rowValues.createCell(1);
-
 
1078
			cellPoDate.setCellValue(String.valueOf(purchaseInvoiceModel.getPoDate()));
-
 
1079
 
-
 
1080
			Cell cellGRNNo = rowValues.createCell(2);
-
 
1081
			cellGRNNo.setCellValue(purchaseInvoiceModel.getGrnNo());
-
 
1082
 
-
 
1083
			Cell cellGRNDate = rowValues.createCell(3);
-
 
1084
			cellGRNDate.setCellValue(String.valueOf(purchaseInvoiceModel.getGrnDate()));
-
 
1085
 
-
 
1086
			Cell cellSupplierName = rowValues.createCell(4);
-
 
1087
			cellSupplierName.setCellValue(purchaseInvoiceModel.getSupplierName());
-
 
1088
 
-
 
1089
			Cell cellSupplierContactEmail = rowValues.createCell(5);
-
 
1090
			cellSupplierContactEmail.setCellValue(purchaseInvoiceModel.getSupplierContactEmail());
-
 
1091
 
-
 
1092
			Cell cellSupplierContactPhone = rowValues.createCell(6);
-
 
1093
			cellSupplierContactPhone.setCellValue(purchaseInvoiceModel.getSupplierContactPhone());
-
 
1094
 
-
 
1095
			Cell cellInvoiceNumber = rowValues.createCell(7);
-
 
1096
			cellInvoiceNumber.setCellValue(purchaseInvoiceModel.getInvoiceNumber());
-
 
1097
 
-
 
1098
			Cell cellInvoiceDate = rowValues.createCell(8);
-
 
1099
			cellInvoiceDate.setCellValue(String.valueOf(purchaseInvoiceModel.getInvoiceDate()));
-
 
1100
 
-
 
1101
			Cell cellReceivedFrom = rowValues.createCell(9);
-
 
1102
			cellReceivedFrom.setCellValue(purchaseInvoiceModel.getReceivedFrom());
-
 
1103
 
-
 
1104
			Cell cellItemId = rowValues.createCell(10);
-
 
1105
			cellItemId.setCellValue(purchaseInvoiceModel.getItemId());
-
 
1106
 
-
 
1107
			Cell cellBrand = rowValues.createCell(11);
-
 
1108
			cellBrand.setCellValue(purchaseInvoiceModel.getBrand());
-
 
1109
 
-
 
1110
			Cell cellModelName = rowValues.createCell(12);
-
 
1111
			cellModelName.setCellValue(purchaseInvoiceModel.getModelName());
-
 
1112
 
-
 
1113
			Cell cellModelNumber = rowValues.createCell(13);
-
 
1114
			cellModelNumber.setCellValue(purchaseInvoiceModel.getModelNumber());
-
 
1115
 
-
 
1116
			Cell cellColor = rowValues.createCell(14);
-
 
1117
			cellColor.setCellValue(purchaseInvoiceModel.getColor());
-
 
1118
 
-
 
1119
			Cell cellUnitPrice = rowValues.createCell(15);
-
 
1120
			cellUnitPrice.setCellValue(purchaseInvoiceModel.getUnitPrice());
-
 
1121
 
-
 
1122
			Cell cellSGSTPercent = rowValues.createCell(16);
-
 
1123
			cellSGSTPercent.setCellValue(purchaseInvoiceModel.getSgstRate());
-
 
1124
 
-
 
1125
			Cell cellSGSTAmount = rowValues.createCell(17);
-
 
1126
			cellSGSTAmount.setCellValue(purchaseInvoiceModel.getSgstAmount());
-
 
1127
 
-
 
1128
			Cell cellCGSTPercent = rowValues.createCell(18);
-
 
1129
			cellCGSTPercent.setCellValue(purchaseInvoiceModel.getCgstRate());
-
 
1130
 
-
 
1131
			Cell cellCGSTAmount = rowValues.createCell(19);
-
 
1132
			cellCGSTAmount.setCellValue(purchaseInvoiceModel.getCgstAmount());
-
 
1133
 
-
 
1134
			Cell cellIGSTPercent = rowValues.createCell(20);
-
 
1135
			cellIGSTPercent.setCellValue(purchaseInvoiceModel.getIgstRate());
-
 
1136
 
-
 
1137
			Cell cellIGSTAmount = rowValues.createCell(21);
-
 
1138
			cellIGSTAmount.setCellValue(purchaseInvoiceModel.getIgstAmount());
-
 
1139
 
-
 
1140
			Cell cellQuantity = rowValues.createCell(22);
-
 
1141
			cellQuantity.setCellValue(purchaseInvoiceModel.getQuantity());
-
 
1142
 
-
 
1143
			Cell cellAmount = rowValues.createCell(23);
-
 
1144
			cellAmount.setCellValue(purchaseInvoiceModel.getAmount());
-
 
1145
 
-
 
1146
			Cell cellWarehouseAddress = rowValues.createCell(24);
-
 
1147
			cellWarehouseAddress.setCellValue(purchaseInvoiceModel.getWarehouseAddress());
-
 
1148
		}
-
 
1149
 
-
 
1150
		for (int index = 0; index < 14; index++) {
-
 
1151
			sheet.autoSizeColumn(index);
-
 
1152
		}
-
 
1153
 
-
 
1154
		try {
-
 
1155
			workbook.write(outputStream);
-
 
1156
			workbook.close();
-
 
1157
		} catch (IOException ioException) {
-
 
1158
			LOGGER.error("Unable to generate excel file", ioException);
-
 
1159
		}
-
 
1160
	}
-
 
1161
 
973
}
1162
}