| [dfe03b8] | 1 | @model List<StockMaster.ViewModels.AnnualSalesReportViewModel>
|
|---|
| 2 | @{
|
|---|
| 3 | ViewData["Title"] = "Annual Sales Report";
|
|---|
| 4 | }
|
|---|
| 5 |
|
|---|
| 6 | <div class="d-flex justify-content-between align-items-center mb-3">
|
|---|
| 7 | <h2>Annual Sales Report (Last 12 Months)</h2>
|
|---|
| 8 | <div>
|
|---|
| 9 | <a href="/Report/Index" class="btn btn-secondary"><i class="fas fa-arrow-left"></i> Back</a>
|
|---|
| 10 | <a href="/Report/ExportAnnualSales" class="btn btn-success"><i class="fas fa-file-csv"></i> CSV</a>
|
|---|
| 11 | <button onclick="exportToPDF()" class="btn btn-danger"><i class="fas fa-file-pdf"></i> PDF</button>
|
|---|
| 12 | </div>
|
|---|
| 13 | </div>
|
|---|
| 14 |
|
|---|
| 15 | <div id="reportContent">
|
|---|
| 16 | <table class="table table-bordered table-hover">
|
|---|
| 17 | <thead class="table-light">
|
|---|
| 18 | <tr>
|
|---|
| 19 | <th>Month</th>
|
|---|
| 20 | <th>Warehouse</th>
|
|---|
| 21 | <th>Category</th>
|
|---|
| 22 | <th>Supplier</th>
|
|---|
| 23 | <th>Orders</th>
|
|---|
| 24 | <th>Units Sold</th>
|
|---|
| 25 | <th>Revenue</th>
|
|---|
| 26 | </tr>
|
|---|
| 27 | </thead>
|
|---|
| 28 | <tbody>
|
|---|
| 29 | @foreach (var item in Model)
|
|---|
| 30 | {
|
|---|
| 31 | <tr>
|
|---|
| 32 | <td><strong>@item.SalesMonth</strong></td>
|
|---|
| 33 | <td>@item.WarehouseName</td>
|
|---|
| 34 | <td>@item.CategoryName</td>
|
|---|
| 35 | <td>@item.SupplierName</td>
|
|---|
| 36 | <td class="text-center">@item.TotalOrderCount</td>
|
|---|
| 37 | <td class="text-center">@item.TotalUnitsSold</td>
|
|---|
| 38 | <td class="text-end">@item.TotalGrossRevenue.ToString("N2") MKD</td>
|
|---|
| 39 | </tr>
|
|---|
| 40 | }
|
|---|
| 41 | </tbody>
|
|---|
| 42 | </table>
|
|---|
| 43 | </div>
|
|---|
| 44 |
|
|---|
| 45 | @section Scripts {
|
|---|
| 46 | <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
|
|---|
| 47 | <script>
|
|---|
| 48 | function exportToPDF() {
|
|---|
| 49 | var element = document.getElementById('reportContent');
|
|---|
| 50 | var opt = {
|
|---|
| 51 | margin: 0.3, filename: 'AnnualSales.pdf',
|
|---|
| 52 | image: { type: 'jpeg', quality: 0.98 },
|
|---|
| 53 | html2canvas: { scale: 2 },
|
|---|
| 54 | jsPDF: { unit: 'in', format: 'letter', orientation: 'landscape' }
|
|---|
| 55 | };
|
|---|
| 56 | html2pdf().set(opt).from(element).save();
|
|---|
| 57 | }
|
|---|
| 58 | </script>
|
|---|
| 59 | } |
|---|