| Line 1697... |
Line 1697... |
| 1697 |
List<InventoryMarginModel> allInventoryMarginModels = new ArrayList<>();
|
1697 |
List<InventoryMarginModel> allInventoryMarginModels = new ArrayList<>();
|
| 1698 |
allInventoryMarginModels.addAll(schemeMarginsInventoryModel);
|
1698 |
allInventoryMarginModels.addAll(schemeMarginsInventoryModel);
|
| 1699 |
allInventoryMarginModels.addAll(allPriceDrops);
|
1699 |
allInventoryMarginModels.addAll(allPriceDrops);
|
| 1700 |
allInventoryMarginModels.addAll(allOffers);
|
1700 |
allInventoryMarginModels.addAll(allOffers);
|
| 1701 |
|
1701 |
|
| 1702 |
List<List<?>> rows = allInventoryMarginModels.stream().map(InventoryMarginModel::toRow).collect(Collectors.toList());
|
1702 |
List<List<?>> rows = allInventoryMarginModels.stream()
|
| - |
|
1703 |
.map(InventoryMarginModel::toRow)
|
| - |
|
1704 |
.map(row -> (List<?>) row.subList(0, 10))
|
| - |
|
1705 |
.collect(Collectors.toList());
|
| 1703 |
|
1706 |
|
| 1704 |
// Add CN Number Header Row
|
- |
|
| 1705 |
List<List<?>> finalRows = new ArrayList<>();
|
1707 |
List<List<String>> headerRows = Arrays.asList(
|
| 1706 |
finalRows.add(Arrays.asList("CN Number:", cnNumber)); // First row with CN Number
|
1708 |
Arrays.asList("CN Number:", cnNumber),
|
| 1707 |
finalRows.add(Collections.emptyList()); // Blank row for separation
|
1709 |
Collections.emptyList(),
|
| 1708 |
finalRows.addAll(rows); // Add actual data
|
- |
|
| 1709 |
|
- |
|
| 1710 |
// Generate CSV
|
- |
|
| 1711 |
org.apache.commons.io.output.ByteArrayOutputStream byteArrayOutputStream = FileUtil.getCSVByteStream(
|
- |
|
| 1712 |
Arrays.asList("FofoId", "InvoiceNo", "SerialNumber", "Margin", "Description", "CGST", "IGST", "SGST", "Credited On"),
|
1710 |
Arrays.asList("CN Number", "FofoId", "InvoiceNo", "SerialNumber", "Margin", "Description",
|
| 1713 |
finalRows
|
1711 |
"CGST", "SGST", "IGST", "Credited On")
|
| 1714 |
);
|
1712 |
);
|
| 1715 |
|
1713 |
|
| - |
|
1714 |
org.apache.commons.io.output.ByteArrayOutputStream byteArrayOutputStream =
|
| - |
|
1715 |
FileUtil.getCSVByteStreamWithMultiHeaders(headerRows, rows);
|
| - |
|
1716 |
|
| 1716 |
return orderService.downloadReportInCsv(byteArrayOutputStream, finalRows, "CN Detail Report");
|
1717 |
return orderService.downloadReportInCsv(byteArrayOutputStream, rows, "CN Detail Report");
|
| 1717 |
}
|
1718 |
}
|
| 1718 |
|
1719 |
|
| 1719 |
@RequestMapping(value = "/credit-note/download-all", method = RequestMethod.GET)
|
1720 |
@RequestMapping(value = "/credit-note/download-all", method = RequestMethod.GET)
|
| 1720 |
public ResponseEntity<?> downloadAllCreditNotes(HttpServletRequest request,
|
1721 |
public ResponseEntity<?> downloadAllCreditNotes(HttpServletRequest request,
|
| 1721 |
@RequestParam("yearMonth") YearMonth yearMonth) throws Exception {
|
1722 |
@RequestParam("yearMonth") YearMonth yearMonth) throws Exception {
|