| 1 | @model List<StockMaster.ViewModels.StockByWarehouseViewModel>
|
|---|
| 2 | @{
|
|---|
| 3 | ViewData["Title"] = "Stock by Warehouse";
|
|---|
| 4 | }
|
|---|
| 5 |
|
|---|
| 6 | <div class="d-flex justify-content-between align-items-center mb-3">
|
|---|
| 7 | <h2>Stock by Warehouse</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/ExportStockByWarehouse" 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-striped">
|
|---|
| 17 | <thead class="table-dark">
|
|---|
| 18 | <tr>
|
|---|
| 19 | <th>Warehouse</th>
|
|---|
| 20 | <th>Total Units</th>
|
|---|
| 21 | <th>Total Stock Value</th>
|
|---|
| 22 | </tr>
|
|---|
| 23 | </thead>
|
|---|
| 24 | <tbody>
|
|---|
| 25 | @foreach (var item in Model)
|
|---|
| 26 | {
|
|---|
| 27 | <tr>
|
|---|
| 28 | <td>@item.WarehouseName</td>
|
|---|
| 29 | <td>@item.TotalUnits</td>
|
|---|
| 30 | <td>@item.TotalStockValue.ToString("N2") MKD</td>
|
|---|
| 31 | </tr>
|
|---|
| 32 | }
|
|---|
| 33 | </tbody>
|
|---|
| 34 | </table>
|
|---|
| 35 | </div>
|
|---|
| 36 |
|
|---|
| 37 | @section Scripts {
|
|---|
| 38 | <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
|
|---|
| 39 | <script>
|
|---|
| 40 | function exportToPDF() {
|
|---|
| 41 | var element = document.getElementById('reportContent');
|
|---|
| 42 | var opt = {
|
|---|
| 43 | margin: 0.5, filename: 'StockByWarehouse.pdf',
|
|---|
| 44 | image: { type: 'jpeg', quality: 0.98 },
|
|---|
| 45 | html2canvas: { scale: 2 },
|
|---|
| 46 | jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
|
|---|
| 47 | };
|
|---|
| 48 | html2pdf().set(opt).from(element).save();
|
|---|
| 49 | }
|
|---|
| 50 | </script>
|
|---|
| 51 | } |
|---|