| Line 260... |
Line 260... |
| 260 |
workbook.close();
|
260 |
workbook.close();
|
| 261 |
} catch (IOException ioException) {
|
261 |
} catch (IOException ioException) {
|
| 262 |
LOGGER.error("Unable to generate excel file", ioException);
|
262 |
LOGGER.error("Unable to generate excel file", ioException);
|
| 263 |
}
|
263 |
}
|
| 264 |
}
|
264 |
}
|
| - |
|
265 |
|
| 265 |
|
266 |
|
| 266 |
public static void writeItemCompleteLedgerModels(List<ItemCompleteLedgerModel> itemCompleteLedgerModels,
|
267 |
public static void writeItemCompleteLedgerModels(Map<String,List<ItemCompleteLedgerModel>> itemCompleteLedgerModelsMap,
|
| 267 |
OutputStream outputStream) {
|
268 |
OutputStream outputStream) {
|
| 268 |
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
269 |
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
| 269 |
|
270 |
|
| 270 |
// CreationHelper createHelper = workbook.getCreationHelper();
|
271 |
// CreationHelper createHelper = workbook.getCreationHelper();
|
| 271 |
|
272 |
|
| - |
|
273 |
for(Map.Entry<String, List<ItemCompleteLedgerModel>> itemCompleteLedgerModelsEntry : itemCompleteLedgerModelsMap.entrySet()) {
|
| 272 |
SXSSFSheet sheet = workbook.createSheet("ItemCompleteLeger");
|
274 |
SXSSFSheet sheet = workbook.createSheet(itemCompleteLedgerModelsEntry.getKey());
|
| - |
|
275 |
List<ItemCompleteLedgerModel> itemCompleteLedgerModels = itemCompleteLedgerModelsEntry.getValue();
|
| 273 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
|
276 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
|
| 274 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 1, 1));
|
277 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 1, 1));
|
| 275 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
|
278 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
|
| 276 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
|
279 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
|
| 277 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 4, 4));
|
280 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 4, 4));
|
| 278 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 5, 5));
|
281 |
sheet.addMergedRegion(new CellRangeAddress(0, 1, 5, 5));
|
| 279 |
sheet.trackAllColumnsForAutoSizing();
|
282 |
sheet.trackAllColumnsForAutoSizing();
|
| 280 |
|
283 |
|
| 281 |
Row rowHeader = sheet.createRow(0);
|
284 |
Row rowHeader = sheet.createRow(0);
|
| 282 |
Cell cellItemIdHeader = rowHeader.createCell(0);
|
285 |
Cell cellItemIdHeader = rowHeader.createCell(0);
|
| 283 |
cellItemIdHeader.setCellValue("Item Id");
|
286 |
cellItemIdHeader.setCellValue("Item Id");
|
| 284 |
Cell cellBrandHeader = rowHeader.createCell(1);
|
287 |
Cell cellBrandHeader = rowHeader.createCell(1);
|
| 285 |
cellBrandHeader.setCellValue("Brand");
|
288 |
cellBrandHeader.setCellValue("Brand");
|
| 286 |
Cell cellModelNameHeader = rowHeader.createCell(2);
|
289 |
Cell cellModelNameHeader = rowHeader.createCell(2);
|
| 287 |
cellModelNameHeader.setCellValue("Model Name");
|
290 |
cellModelNameHeader.setCellValue("Model Name");
|
| 288 |
Cell cellModelNumberHeader = rowHeader.createCell(3);
|
291 |
Cell cellModelNumberHeader = rowHeader.createCell(3);
|
| 289 |
cellModelNumberHeader.setCellValue("Model Number");
|
292 |
cellModelNumberHeader.setCellValue("Model Number");
|
| 290 |
Cell cellColorHeader = rowHeader.createCell(4);
|
293 |
Cell cellColorHeader = rowHeader.createCell(4);
|
| 291 |
cellColorHeader.setCellValue("Color");
|
294 |
cellColorHeader.setCellValue("Color");
|
| 292 |
Cell cellTypeHeader = rowHeader.createCell(5);
|
295 |
Cell cellTypeHeader = rowHeader.createCell(5);
|
| 293 |
cellTypeHeader.setCellValue("Item Type");
|
296 |
cellTypeHeader.setCellValue("Item Type");
|
| 294 |
Cell cellOpeningBalanceHeader = rowHeader.createCell(6);
|
297 |
Cell cellOpeningBalanceHeader = rowHeader.createCell(6);
|
| 295 |
cellOpeningBalanceHeader.setCellValue("Opening Balance");
|
298 |
cellOpeningBalanceHeader.setCellValue("Opening Balance");
|
| 296 |
Cell cellInwardsHeader = rowHeader.createCell(9);
|
299 |
Cell cellInwardsHeader = rowHeader.createCell(9);
|
| 297 |
cellInwardsHeader.setCellValue("Inwards");
|
300 |
cellInwardsHeader.setCellValue("Inwards");
|
| 298 |
Cell cellOutwardsHeader = rowHeader.createCell(12);
|
301 |
Cell cellOutwardsHeader = rowHeader.createCell(12);
|
| 299 |
cellOutwardsHeader.setCellValue("Outwards");
|
302 |
cellOutwardsHeader.setCellValue("Outwards");
|
| 300 |
Cell cellClosingBalanceHeader = rowHeader.createCell(15);
|
303 |
Cell cellClosingBalanceHeader = rowHeader.createCell(15);
|
| 301 |
cellClosingBalanceHeader.setCellValue("Closing Balance");
|
304 |
cellClosingBalanceHeader.setCellValue("Closing Balance");
|
| 302 |
Row rowQuantityRateValue = sheet.createRow(1);
|
305 |
Row rowQuantityRateValue = sheet.createRow(1);
|
| 303 |
|
306 |
|
| 304 |
for (int index = 6; index < 18; index = index + 3) {
|
307 |
for (int index = 6; index < 18; index = index + 3) {
|
| 305 |
Cell cellQuantityHeader = rowQuantityRateValue.createCell(index);
|
308 |
Cell cellQuantityHeader = rowQuantityRateValue.createCell(index);
|
| 306 |
cellQuantityHeader.setCellValue("Quantity");
|
309 |
cellQuantityHeader.setCellValue("Quantity");
|
| 307 |
Cell cellRateHeader = rowQuantityRateValue.createCell(index + 1);
|
310 |
Cell cellRateHeader = rowQuantityRateValue.createCell(index + 1);
|
| 308 |
cellRateHeader.setCellValue("Rate");
|
311 |
cellRateHeader.setCellValue("Rate");
|
| 309 |
Cell cellValueHeader = rowQuantityRateValue.createCell(index + 2);
|
312 |
Cell cellValueHeader = rowQuantityRateValue.createCell(index + 2);
|
| 310 |
cellValueHeader.setCellValue("Value");
|
313 |
cellValueHeader.setCellValue("Value");
|
| 311 |
sheet.addMergedRegion(new CellRangeAddress(0, 0, index, index + 2));
|
314 |
sheet.addMergedRegion(new CellRangeAddress(0, 0, index, index + 2));
|
| 312 |
}
|
- |
|
| 313 |
Font font = workbook.createFont();
|
- |
|
| 314 |
CellStyle cellStyle = workbook.createCellStyle();
|
- |
|
| 315 |
font.setBold(true);
|
- |
|
| 316 |
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
- |
|
| 317 |
// font.setFontHeight((short)16);
|
- |
|
| 318 |
cellStyle.setFont(font);
|
- |
|
| 319 |
for (int i = 0; i < 18; i++) {
|
- |
|
| 320 |
if (rowHeader.getCell(i) != null) {
|
- |
|
| 321 |
rowHeader.getCell(i).setCellStyle(cellStyle);
|
- |
|
| 322 |
}
|
315 |
}
|
| 323 |
}
|
316 |
Font font = workbook.createFont();
|
| 324 |
int openingQuantityTotal = 0;
|
317 |
CellStyle cellStyle = workbook.createCellStyle();
|
| 325 |
float openingValueTotal = 0;
|
318 |
font.setBold(true);
|
| 326 |
int inwardsQuantityTotal = 0;
|
319 |
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
| 327 |
float inwardsValueTotal = 0;
|
320 |
// font.setFontHeight((short)16);
|
| 328 |
int outwardsQuantityTotal = 0;
|
321 |
cellStyle.setFont(font);
|
| 329 |
float outwardsValueTotal = 0;
|
322 |
for (int i = 0; i < 18; i++) {
|
| 330 |
int closingQuantityTotal = 0;
|
323 |
if (rowHeader.getCell(i) != null) {
|
| 331 |
float closingValueTotal = 0;
|
324 |
rowHeader.getCell(i).setCellStyle(cellStyle);
|
| 332 |
for (int index = 0; index < itemCompleteLedgerModels.size(); index++) {
|
325 |
}
|
| 333 |
ItemCompleteLedgerModel itemCompleteLedgerModel = itemCompleteLedgerModels.get(index);
|
326 |
}
|
| 334 |
Row rowValues = sheet.createRow(index + 2);
|
327 |
int openingQuantityTotal = 0;
|
| 335 |
Cell cellItemId = rowValues.createCell(0);
|
328 |
float openingValueTotal = 0;
|
| 336 |
cellItemId.setCellValue(itemCompleteLedgerModel.getItemValue().getItemId());
|
329 |
int inwardsQuantityTotal = 0;
|
| 337 |
Cell cellBrand = rowValues.createCell(1);
|
330 |
float inwardsValueTotal = 0;
|
| 338 |
cellBrand.setCellValue(itemCompleteLedgerModel.getItemValue().getBrand());
|
331 |
int outwardsQuantityTotal = 0;
|
| 339 |
Cell cellModelName = rowValues.createCell(2);
|
332 |
float outwardsValueTotal = 0;
|
| 340 |
cellModelName.setCellValue(itemCompleteLedgerModel.getItemValue().getModelName());
|
333 |
int closingQuantityTotal = 0;
|
| 341 |
Cell cellModelNumber = rowValues.createCell(3);
|
334 |
float closingValueTotal = 0;
|
| 342 |
cellModelNumber.setCellValue(itemCompleteLedgerModel.getItemValue().getModelNumber());
|
335 |
for (int index = 0; index < itemCompleteLedgerModels.size(); index++) {
|
| 343 |
Cell cellColor = rowValues.createCell(4);
|
336 |
ItemCompleteLedgerModel itemCompleteLedgerModel = itemCompleteLedgerModels.get(index);
|
| 344 |
cellColor.setCellValue(itemCompleteLedgerModel.getItemValue().getColor());
|
337 |
Row rowValues = sheet.createRow(index + 2);
|
| 345 |
Cell cellType = rowValues.createCell(5);
|
338 |
Cell cellItemId = rowValues.createCell(0);
|
| 346 |
cellType.setCellValue(itemCompleteLedgerModel.getItemValue().getItemType().toString());
|
339 |
cellItemId.setCellValue(itemCompleteLedgerModel.getItemValue().getItemId());
|
| 347 |
Cell cellOpeningQuantity = rowValues.createCell(6);
|
340 |
Cell cellBrand = rowValues.createCell(1);
|
| 348 |
Cell cellOpeningRate = rowValues.createCell(7);
|
341 |
cellBrand.setCellValue(itemCompleteLedgerModel.getItemValue().getBrand());
|
| 349 |
Cell cellOpeningValue = rowValues.createCell(8);
|
342 |
Cell cellModelName = rowValues.createCell(2);
|
| 350 |
if (itemCompleteLedgerModel.getOpeningLedger() == null) {
|
343 |
cellModelName.setCellValue(itemCompleteLedgerModel.getItemValue().getModelName());
|
| 351 |
cellOpeningQuantity.setCellValue("-");
|
344 |
Cell cellModelNumber = rowValues.createCell(3);
|
| 352 |
cellOpeningRate.setCellValue("-");
|
345 |
cellModelNumber.setCellValue(itemCompleteLedgerModel.getItemValue().getModelNumber());
|
| 353 |
cellOpeningValue.setCellValue("-");
|
346 |
Cell cellColor = rowValues.createCell(4);
|
| 354 |
} else {
|
347 |
cellColor.setCellValue(itemCompleteLedgerModel.getItemValue().getColor());
|
| 355 |
cellOpeningQuantity.setCellValue(itemCompleteLedgerModel.getOpeningLedger().getQuantity());
|
348 |
Cell cellType = rowValues.createCell(5);
|
| 356 |
cellOpeningRate.setCellValue(itemCompleteLedgerModel.getOpeningLedger().getRate());
|
349 |
cellType.setCellValue(itemCompleteLedgerModel.getItemValue().getItemType().toString());
|
| 357 |
cellOpeningValue.setCellValue(itemCompleteLedgerModel.getOpeningLedger().getValue());
|
350 |
Cell cellOpeningQuantity = rowValues.createCell(6);
|
| 358 |
openingQuantityTotal = openingQuantityTotal + itemCompleteLedgerModel.getOpeningLedger().getQuantity();
|
351 |
Cell cellOpeningRate = rowValues.createCell(7);
|
| 359 |
openingValueTotal = openingValueTotal + itemCompleteLedgerModel.getOpeningLedger().getValue();
|
352 |
Cell cellOpeningValue = rowValues.createCell(8);
|
| 360 |
}
|
353 |
if (itemCompleteLedgerModel.getOpeningLedger() == null) {
|
| 361 |
Cell cellInwardsQuantity = rowValues.createCell(9);
|
354 |
cellOpeningQuantity.setCellValue("-");
|
| 362 |
Cell cellInwardsRate = rowValues.createCell(10);
|
355 |
cellOpeningRate.setCellValue("-");
|
| 363 |
Cell cellInwardsValue = rowValues.createCell(11);
|
356 |
cellOpeningValue.setCellValue("-");
|
| 364 |
if (itemCompleteLedgerModel.getInwardsLedger() == null) {
|
357 |
} else {
|
| 365 |
cellInwardsQuantity.setCellValue("-");
|
358 |
cellOpeningQuantity.setCellValue(itemCompleteLedgerModel.getOpeningLedger().getQuantity());
|
| 366 |
cellInwardsRate.setCellValue("-");
|
359 |
cellOpeningRate.setCellValue(itemCompleteLedgerModel.getOpeningLedger().getRate());
|
| 367 |
cellInwardsValue.setCellValue("-");
|
360 |
cellOpeningValue.setCellValue(itemCompleteLedgerModel.getOpeningLedger().getValue());
|
| 368 |
} else {
|
361 |
openingQuantityTotal = openingQuantityTotal + itemCompleteLedgerModel.getOpeningLedger().getQuantity();
|
| 369 |
cellInwardsQuantity.setCellValue(itemCompleteLedgerModel.getInwardsLedger().getQuantity());
|
362 |
openingValueTotal = openingValueTotal + itemCompleteLedgerModel.getOpeningLedger().getValue();
|
| 370 |
cellInwardsRate.setCellValue(itemCompleteLedgerModel.getInwardsLedger().getRate());
|
363 |
}
|
| 371 |
cellInwardsValue.setCellValue(itemCompleteLedgerModel.getInwardsLedger().getValue());
|
364 |
Cell cellInwardsQuantity = rowValues.createCell(9);
|
| 372 |
inwardsQuantityTotal = inwardsQuantityTotal + itemCompleteLedgerModel.getInwardsLedger().getQuantity();
|
365 |
Cell cellInwardsRate = rowValues.createCell(10);
|
| 373 |
inwardsValueTotal = inwardsValueTotal + itemCompleteLedgerModel.getInwardsLedger().getValue();
|
366 |
Cell cellInwardsValue = rowValues.createCell(11);
|
| 374 |
}
|
367 |
if (itemCompleteLedgerModel.getInwardsLedger() == null) {
|
| 375 |
Cell cellOutwardsQuantity = rowValues.createCell(12);
|
368 |
cellInwardsQuantity.setCellValue("-");
|
| 376 |
Cell cellOutwardsRate = rowValues.createCell(13);
|
369 |
cellInwardsRate.setCellValue("-");
|
| 377 |
Cell cellOutwardsValue = rowValues.createCell(14);
|
370 |
cellInwardsValue.setCellValue("-");
|
| 378 |
if (itemCompleteLedgerModel.getOutwardsLedger() == null) {
|
371 |
} else {
|
| 379 |
cellOutwardsQuantity.setCellValue("-");
|
372 |
cellInwardsQuantity.setCellValue(itemCompleteLedgerModel.getInwardsLedger().getQuantity());
|
| 380 |
cellOutwardsRate.setCellValue("-");
|
373 |
cellInwardsRate.setCellValue(itemCompleteLedgerModel.getInwardsLedger().getRate());
|
| 381 |
cellOutwardsValue.setCellValue("-");
|
374 |
cellInwardsValue.setCellValue(itemCompleteLedgerModel.getInwardsLedger().getValue());
|
| 382 |
} else {
|
375 |
inwardsQuantityTotal = inwardsQuantityTotal + itemCompleteLedgerModel.getInwardsLedger().getQuantity();
|
| 383 |
cellOutwardsQuantity.setCellValue(itemCompleteLedgerModel.getOutwardsLedger().getQuantity());
|
376 |
inwardsValueTotal = inwardsValueTotal + itemCompleteLedgerModel.getInwardsLedger().getValue();
|
| 384 |
cellOutwardsRate.setCellValue(itemCompleteLedgerModel.getOutwardsLedger().getRate());
|
377 |
}
|
| 385 |
cellOutwardsValue.setCellValue(itemCompleteLedgerModel.getOutwardsLedger().getValue());
|
378 |
Cell cellOutwardsQuantity = rowValues.createCell(12);
|
| 386 |
outwardsQuantityTotal = outwardsQuantityTotal
|
379 |
Cell cellOutwardsRate = rowValues.createCell(13);
|
| 387 |
+ itemCompleteLedgerModel.getOutwardsLedger().getQuantity();
|
380 |
Cell cellOutwardsValue = rowValues.createCell(14);
|
| 388 |
outwardsValueTotal = outwardsValueTotal + itemCompleteLedgerModel.getOutwardsLedger().getValue();
|
381 |
if (itemCompleteLedgerModel.getOutwardsLedger() == null) {
|
| 389 |
}
|
382 |
cellOutwardsQuantity.setCellValue("-");
|
| 390 |
Cell cellClosingQuantity = rowValues.createCell(15);
|
383 |
cellOutwardsRate.setCellValue("-");
|
| 391 |
Cell cellClosingRate = rowValues.createCell(16);
|
384 |
cellOutwardsValue.setCellValue("-");
|
| 392 |
Cell cellClosingValue = rowValues.createCell(17);
|
385 |
} else {
|
| 393 |
if (itemCompleteLedgerModel.getClosingLedger() == null) {
|
386 |
cellOutwardsQuantity.setCellValue(itemCompleteLedgerModel.getOutwardsLedger().getQuantity());
|
| 394 |
cellClosingQuantity.setCellValue("-");
|
387 |
cellOutwardsRate.setCellValue(itemCompleteLedgerModel.getOutwardsLedger().getRate());
|
| 395 |
cellClosingRate.setCellValue("-");
|
388 |
cellOutwardsValue.setCellValue(itemCompleteLedgerModel.getOutwardsLedger().getValue());
|
| 396 |
cellClosingValue.setCellValue("-");
|
389 |
outwardsQuantityTotal = outwardsQuantityTotal
|
| 397 |
} else {
|
390 |
+ itemCompleteLedgerModel.getOutwardsLedger().getQuantity();
|
| 398 |
cellClosingQuantity.setCellValue(itemCompleteLedgerModel.getClosingLedger().getQuantity());
|
391 |
outwardsValueTotal = outwardsValueTotal + itemCompleteLedgerModel.getOutwardsLedger().getValue();
|
| 399 |
cellClosingRate.setCellValue(itemCompleteLedgerModel.getClosingLedger().getRate());
|
392 |
}
|
| 400 |
cellClosingValue.setCellValue(itemCompleteLedgerModel.getClosingLedger().getValue());
|
393 |
Cell cellClosingQuantity = rowValues.createCell(15);
|
| 401 |
closingQuantityTotal = closingQuantityTotal + itemCompleteLedgerModel.getClosingLedger().getQuantity();
|
394 |
Cell cellClosingRate = rowValues.createCell(16);
|
| 402 |
closingValueTotal = closingValueTotal + itemCompleteLedgerModel.getClosingLedger().getValue();
|
395 |
Cell cellClosingValue = rowValues.createCell(17);
|
| - |
|
396 |
if (itemCompleteLedgerModel.getClosingLedger() == null) {
|
| - |
|
397 |
cellClosingQuantity.setCellValue("-");
|
| - |
|
398 |
cellClosingRate.setCellValue("-");
|
| - |
|
399 |
cellClosingValue.setCellValue("-");
|
| - |
|
400 |
} else {
|
| - |
|
401 |
cellClosingQuantity.setCellValue(itemCompleteLedgerModel.getClosingLedger().getQuantity());
|
| - |
|
402 |
cellClosingRate.setCellValue(itemCompleteLedgerModel.getClosingLedger().getRate());
|
| - |
|
403 |
cellClosingValue.setCellValue(itemCompleteLedgerModel.getClosingLedger().getValue());
|
| - |
|
404 |
closingQuantityTotal = closingQuantityTotal + itemCompleteLedgerModel.getClosingLedger().getQuantity();
|
| - |
|
405 |
closingValueTotal = closingValueTotal + itemCompleteLedgerModel.getClosingLedger().getValue();
|
| - |
|
406 |
}
|
| - |
|
407 |
}
|
| - |
|
408 |
|
| - |
|
409 |
Row rowTotal = sheet.createRow(itemCompleteLedgerModels.size() + 2);
|
| - |
|
410 |
|
| - |
|
411 |
if (openingQuantityTotal > 0) {
|
| - |
|
412 |
Cell cellOpeningQuantityTotal = rowTotal.createCell(6);
|
| - |
|
413 |
cellOpeningQuantityTotal.setCellValue(openingQuantityTotal);
|
| - |
|
414 |
Cell cellOpeningValueTotal = rowTotal.createCell(8);
|
| - |
|
415 |
cellOpeningValueTotal.setCellValue(openingValueTotal);
|
| - |
|
416 |
}
|
| - |
|
417 |
|
| - |
|
418 |
if (inwardsQuantityTotal > 0) {
|
| - |
|
419 |
Cell cellInwardsQuantityTotal = rowTotal.createCell(9);
|
| - |
|
420 |
cellInwardsQuantityTotal.setCellValue(inwardsQuantityTotal);
|
| - |
|
421 |
Cell cellInwardsValueTotal = rowTotal.createCell(11);
|
| - |
|
422 |
cellInwardsValueTotal.setCellValue(inwardsValueTotal);
|
| - |
|
423 |
}
|
| - |
|
424 |
|
| - |
|
425 |
if (outwardsQuantityTotal > 0) {
|
| - |
|
426 |
Cell cellOutwardsQuantityTotal = rowTotal.createCell(12);
|
| - |
|
427 |
cellOutwardsQuantityTotal.setCellValue(outwardsQuantityTotal);
|
| - |
|
428 |
Cell cellOutwardsValueTotal = rowTotal.createCell(14);
|
| - |
|
429 |
cellOutwardsValueTotal.setCellValue(outwardsValueTotal);
|
| - |
|
430 |
}
|
| - |
|
431 |
|
| - |
|
432 |
if (closingQuantityTotal > 0) {
|
| - |
|
433 |
Cell cellClosingQuantityTotal = rowTotal.createCell(15);
|
| - |
|
434 |
cellClosingQuantityTotal.setCellValue(closingQuantityTotal);
|
| - |
|
435 |
Cell cellClosingValueTotal = rowTotal.createCell(17);
|
| - |
|
436 |
cellClosingValueTotal.setCellValue(closingValueTotal);
|
| - |
|
437 |
}
|
| - |
|
438 |
|
| - |
|
439 |
for (int index = 0; index < 18; index++) {
|
| - |
|
440 |
sheet.autoSizeColumn(index);
|
| - |
|
441 |
}
|
| - |
|
442 |
|
| - |
|
443 |
try {
|
| - |
|
444 |
workbook.write(outputStream);
|
| - |
|
445 |
workbook.close();
|
| - |
|
446 |
} catch (IOException ioException) {
|
| - |
|
447 |
LOGGER.error("Unable to generate excel file", ioException);
|
| 403 |
}
|
448 |
}
|
| 404 |
}
|
- |
|
| 405 |
|
- |
|
| 406 |
Row rowTotal = sheet.createRow(itemCompleteLedgerModels.size() + 2);
|
- |
|
| 407 |
|
- |
|
| 408 |
if (openingQuantityTotal > 0) {
|
- |
|
| 409 |
Cell cellOpeningQuantityTotal = rowTotal.createCell(6);
|
- |
|
| 410 |
cellOpeningQuantityTotal.setCellValue(openingQuantityTotal);
|
- |
|
| 411 |
Cell cellOpeningValueTotal = rowTotal.createCell(8);
|
- |
|
| 412 |
cellOpeningValueTotal.setCellValue(openingValueTotal);
|
- |
|
| 413 |
}
|
- |
|
| 414 |
|
- |
|
| 415 |
if (inwardsQuantityTotal > 0) {
|
- |
|
| 416 |
Cell cellInwardsQuantityTotal = rowTotal.createCell(9);
|
- |
|
| 417 |
cellInwardsQuantityTotal.setCellValue(inwardsQuantityTotal);
|
- |
|
| 418 |
Cell cellInwardsValueTotal = rowTotal.createCell(11);
|
- |
|
| 419 |
cellInwardsValueTotal.setCellValue(inwardsValueTotal);
|
- |
|
| 420 |
}
|
- |
|
| 421 |
|
- |
|
| 422 |
if (outwardsQuantityTotal > 0) {
|
- |
|
| 423 |
Cell cellOutwardsQuantityTotal = rowTotal.createCell(12);
|
- |
|
| 424 |
cellOutwardsQuantityTotal.setCellValue(outwardsQuantityTotal);
|
- |
|
| 425 |
Cell cellOutwardsValueTotal = rowTotal.createCell(14);
|
- |
|
| 426 |
cellOutwardsValueTotal.setCellValue(outwardsValueTotal);
|
- |
|
| 427 |
}
|
- |
|
| 428 |
|
- |
|
| 429 |
if (closingQuantityTotal > 0) {
|
- |
|
| 430 |
Cell cellClosingQuantityTotal = rowTotal.createCell(15);
|
- |
|
| 431 |
cellClosingQuantityTotal.setCellValue(closingQuantityTotal);
|
- |
|
| 432 |
Cell cellClosingValueTotal = rowTotal.createCell(17);
|
- |
|
| 433 |
cellClosingValueTotal.setCellValue(closingValueTotal);
|
- |
|
| 434 |
}
|
- |
|
| 435 |
|
- |
|
| 436 |
for (int index = 0; index < 18; index++) {
|
- |
|
| 437 |
sheet.autoSizeColumn(index);
|
- |
|
| 438 |
}
|
- |
|
| 439 |
|
- |
|
| 440 |
try {
|
- |
|
| 441 |
workbook.write(outputStream);
|
- |
|
| 442 |
workbook.close();
|
- |
|
| 443 |
} catch (IOException ioException) {
|
- |
|
| 444 |
LOGGER.error("Unable to generate excel file", ioException);
|
- |
|
| 445 |
}
|
449 |
}
|
| 446 |
}
|
450 |
}
|
| 447 |
|
451 |
|
| 448 |
public static void writeSchemeModels(List<SchemeModel> schemeModels, OutputStream outputStream) {
|
452 |
public static void writeSchemeModels(List<SchemeModel> schemeModels, OutputStream outputStream) {
|
| 449 |
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
453 |
SXSSFWorkbook workbook = new SXSSFWorkbook();
|