Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model DenTotal.ViewModels.InventoriesViewModel
- @{
- var currentUnixTimestamp = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
- decimal stockValue = 0; long reorderUnit = 0; int reorderProduct = 0;
- foreach (var product in Model.Products)
- {
- stockValue += product.UnitsInStock * product.SellPrice;
- if (product.UnitsInStock < product.ReorderLevel)
- {
- reorderUnit += product.ReorderLevel - product.UnitsInStock;
- reorderProduct += 1;
- }
- }
- ViewBag.Title = "Index";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- <section class="content-header">
- <h1>
- Inventory DashBoard
- <small></small>
- </h1>
- </section>
- <br>
- <section class="content">
- <div class="box">
- <div class="box-header">
- <h3 class="box-title"></h3>
- </div>
- <div class="box-body">
- <div class="row col-lg-12 col-xs-24">
- <div class="col-lg-3 col-xs-6">
- <!-- Supplier Number-->
- <div class="small-box bg-aqua">
- <div class="inner">
- <h3>@Model.Suppliers.Count()</h3>
- <p>Suppliers</p>
- </div>
- <div class="icon">
- <i class="ion ion-man"></i>
- </div>
- <a id="OpenSupplier" onclick="OpenSupplier(@Model.Suppliers)" href='@Url.Action("Index", "Suppliers")' target='_blank' class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
- </div>
- </div>
- <!-- ./col -->
- <div class="col-lg-3 col-xs-6">
- <!-- Product Number -->
- <div class="small-box bg-yellow-gradient">
- <div class="inner">
- <h3>@Model.Products.Count()</h3>
- <p>Products</p>
- </div>
- <div class="icon">
- <i class="ion ion-bag"></i>
- </div>
- <a href='@Url.Action("PrintAllProducts", "Inventories")' target='_blank' class="small-box-footer" >More info <i class="fa fa-arrow-circle-right"></i></a>
- </div>
- </div>
- <!-- ./col -->
- <div class="col-lg-3 col-xs-6">
- <!-- small box -->
- <div class="small-box bg-blue">
- <div class="inner">
- <h3>@Model.Products.Sum(a => a.UnitsInStock)</h3>
- <p>Total Units in Stock</p>
- </div>
- <div class="icon">
- <i class="ion ion-stats-bars"></i>
- </div>
- <a href='@Url.Action("Index", "Products")' target='_blank' class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
- </div>
- </div>
- <!-- ./col -->
- <!-- /.row -->
- @*second Row*@
- <div class="col-lg-3 col-xs-6">
- <!-- small box -->
- <div class="small-box bg-gray">
- <div class="inner">
- <h3>@reorderUnit</h3>
- <p>Quantity to be Reordered(units)</p>
- </div>
- <div class="icon">
- <i class="fa fa-sort-numeric-asc"></i>
- </div>
- <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
- </div>
- </div>
- <!-- ./col -->
- <div class="col-lg-3 col-xs-6">
- <!-- small box -->
- <div class="small-box bg-red">
- <div class="inner">
- <h3>@Model.Products.Where(a => a.UnitsInStock == 0).Count()</h3>
- <p>Zero Stock Product</p>
- </div>
- <div class="icon">
- <i class="ion ion-alert-circled"></i>
- </div>
- <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
- </div>
- </div>
- <!-- ./col -->
- <div class="col-lg-3 col-xs-6">
- <!-- small box -->
- <div class="small-box bg-orange">
- <div class="inner">
- <h3>@Model.Products.Where(a => a.Discontinued == true).Count()</h3>
- <p>Discontinued Products</p>
- </div>
- <div class="icon">
- <i class="ion ion-crop"></i>
- </div>
- <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
- </div>
- </div>
- <!-- ./col -->
- <!-- /.row -->
- @*third Row*@
- <div class="col-lg-3 col-xs-6">
- <!-- small box -->
- <div class="small-box bg-maroon">
- <div class="inner">
- <h3>@reorderProduct</h3>
- <p>Products below Reorder Level</p>
- </div>
- <div class="icon">
- <i class="fa fa-book"></i>
- </div>
- <a href='@Url.Action("PrintReorderedProducts", "Inventories")' target='_blank' class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
- </div>
- </div>
- <!-- ./col -->
- <div class="col-lg-3 col-xs-6">
- <!-- small box -->
- <div class="small-box bg-red-gradient">
- <div class="inner">
- <h3>@Model.expiredProducts</h3>
- <p>Products to be Expired</p>
- </div>
- <div class="icon">
- <i class="fa fa-money"></i>
- @*<ion-icon name="person"></ion-icon>*@
- </div>
- <a href='@Url.Action("PrintExpiredProducts", "Inventories")' target='_blank' class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
- </div>
- </div>
- </div>
- @*box Body Div*@
- </div>
- <div class="box-body">
- <table id="PurchaseOrders" class="table table-bordered table-hover" style="cursor:pointer">
- <thead>
- <tr>
- <th>Supplier</th>
- <th>Company</th>
- <th>Purchase Date</th>
- <th>Total Price</th>
- <th>Status</th>
- </tr>
- </thead>
- <tbody></tbody>
- </table>
- </div>
- </div>
- </section>
- @section scripts{
- <script>
- function format(value) {
- Row = Row + '<tr>' +
- '<td class="text-center">' + value.Product.ProductName + '</td>' +
- '<td class="text-center">' + value.Quantity + '</td>' +
- '<td class="text-center">' + value.Product.UnitsInStock + '</td>' +
- '<td class="text-center">' + value.UnitPrice + '</td>' +
- '</tr>' ;
- return Row;
- }
- var Row;
- var iTableCounter = 1;
- var oTable;
- var detailsTableHtml;
- $(document).ready(function () {
- var OpenSupplier = function (supplier) {
- bootbox.confirm({
- title: "Supplier List",
- message: supplier.CompanyName,
- buttons: {
- cancel: {
- label: '<i class="fa fa-times"></i> Cancel'
- },
- confirm: {
- label: '<i class="fa fa-check"></i> Confirm'
- }
- },
- callback: function (result) {
- console.log('This was logged in the callback: ' + result);
- }
- });
- }
- //$("#OpenSupplier").click(function () {
- // bootbox.confirm({
- // title: "Destroy planet?",
- // message: "Do you want to activate the Deathstar now? This cannot be undone.",
- // buttons: {
- // cancel: {
- // label: '<i class="fa fa-times"></i> Cancel'
- // },
- // confirm: {
- // label: '<i class="fa fa-check"></i> Confirm'
- // }
- // },
- // callback: function (result) {
- // console.log('This was logged in the callback: ' + result);
- // }
- // });
- //});
- var nCloneTh = document.createElement('th');
- $('#PurchaseOrders thead tr').each(function () {
- this.insertBefore(nCloneTh, this.childNodes[0]);
- });
- var expandIcon = function (data, type) {
- if (type === 'display') {
- return '<i class="fa fa-plus-circle"/>';
- }
- return data;
- };
- var oTable = $("#PurchaseOrders").DataTable({
- ajax: {
- url: '@Url.Action("GetPurchaseOrder", "Inventories")',
- method: "GET",
- dataType: "json"
- },
- autoWidth: false,
- columnDefs: [
- { width: "10px", targets: 0 },
- { className: "details-control text-center", targets: "_all" }
- ],
- columns: [
- {
- data: null,
- render: expandIcon
- },
- {
- render: function (data, type, supplier) {
- return supplier.PurchaseOrder.Supplier.ContactTitle+' '+supplier.PurchaseOrder.Supplier.ContactName;
- }
- },
- {
- data: "PurchaseOrder.Supplier.CompanyName"
- },
- {
- data: "PurchaseOrder.OrderDate",
- render: function (data) {
- return moment(data).format('DD-MMM-YYYY');
- }
- },
- {
- data: "PurchaseOrder.TotalPrice"
- },
- {
- data: "PurchaseOrder.POStatus"
- }
- ]
- });
- $('#PurchaseOrders tbody').on('click', 'tr td.details-control', function () {
- var tr = $(this).closest('tr');
- var row = oTable.row(tr);
- var details = row.data().Details;
- if (row.child.isShown()) {
- tr.removeClass('details');
- row.child.hide();
- }
- else {
- Row = '<table class="table" style="background-color: #ffffcc; cursor:auto">' +
- '<tr>' +
- '<th class="text-center">Product Name</th>' +
- '<th class="text-center">Quantity</th>' +
- '<th class="text-center">In Stock</th>' +
- '<th class="text-center">Unit Price</th>' +
- '</tr>';
- $.each(details, function (i, val) {
- tr.addClass('details');
- row.child(format(val)).show();
- });
- Row = Row + '</table>';
- }
- });
- });
- </script>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement