private void UpdatePurchaseOrder(int purchaseOrderId) { try { PurchaseOrder purchaseOrder = new PurchaseOrder(); purchaseOrder = _functionalService.GetById <PurchaseOrder>(purchaseOrderId); if (purchaseOrder != null) { List <PurchaseOrderLine> lines = new List <PurchaseOrderLine>(); lines = _functionalService.GetList <PurchaseOrderLine>() .Where(x => x.PurchaseOrderId.Equals(purchaseOrderId)) .ToList(); //update master data by its lines purchaseOrder.Amount = lines.Sum(x => x.Amount); purchaseOrder.SubTotal = lines.Sum(x => x.SubTotal); purchaseOrder.Discount = lines.Sum(x => x.DiscountAmount); purchaseOrder.Tax = lines.Sum(x => x.TaxAmount); purchaseOrder.Total = purchaseOrder.Freight + lines.Sum(x => x.Total); _functionalService.Update <PurchaseOrder>(purchaseOrder); } } catch (Exception) { throw; } }
public IActionResult GetNotPaidYet() { List <Bill> bills = new List <Bill>(); try { List <PaymentVoucher> vouchers = new List <PaymentVoucher>(); vouchers = _functionalService.GetList <PaymentVoucher>().ToList(); List <int> ids = new List <int>(); foreach (var item in vouchers) { ids.Add(item.BillId); } bills = _functionalService.GetList <Bill>() .Where(x => !ids.Contains(x.BillId)) .ToList(); } catch (Exception) { throw; } return(Ok(bills)); }
public IActionResult GetNotReceivedYet() { List <PurchaseOrder> purchaseOrders = new List <PurchaseOrder>(); try { List <GoodsReceivedNote> grns = new List <GoodsReceivedNote>(); grns = _functionalService.GetList <GoodsReceivedNote>().ToList(); List <int> ids = new List <int>(); foreach (var item in grns) { ids.Add(item.PurchaseOrderId); } purchaseOrders = _functionalService.GetList <PurchaseOrder>() .Where(x => !ids.Contains(x.PurchaseOrderId)) .ToList(); } catch (Exception) { throw; } return(Ok(purchaseOrders)); }
public IActionResult GetNotInvoicedYet() { List <Shipment> shipments = new List <Shipment>(); try { List <Invoice> invoices = new List <Invoice>(); invoices = _functionalService.GetList <Invoice>().ToList(); List <int> ids = new List <int>(); foreach (var item in invoices) { ids.Add(item.ShipmentId); } shipments = _functionalService.GetList <Shipment>() .Where(x => !ids.Contains(x.ShipmentId)) .ToList(); } catch (Exception) { throw; } return(Ok(shipments)); }
public IActionResult GetNotPaidYet() { List <Invoice> invoices = new List <Invoice>(); try { List <PaymentReceive> receives = new List <PaymentReceive>(); receives = _functionalService.GetList <PaymentReceive>().ToList(); List <int> ids = new List <int>(); foreach (var item in receives) { ids.Add(item.InvoiceId); } invoices = _functionalService.GetList <Invoice>() .Where(x => !ids.Contains(x.InvoiceId)) .ToList(); } catch (Exception) { throw; } return(Ok(invoices)); }
public IActionResult GetNotBilledYet() { List <GoodsReceivedNote> goodsReceivedNotes = new List <GoodsReceivedNote>(); try { List <Bill> bills = new List <Bill>(); bills = _functionalService.GetList <Bill>().ToList(); List <int> ids = new List <int>(); foreach (var item in bills) { ids.Add(item.GoodsReceivedNoteId); } goodsReceivedNotes = _functionalService.GetList <GoodsReceivedNote>() .Where(x => !ids.Contains(x.GoodsReceivedNoteId)) .ToList(); } catch (Exception) { throw; } return(Ok(goodsReceivedNotes)); }
public IActionResult GetNotShippedYet() { List <SalesOrder> salesOrders = new List <SalesOrder>(); try { List <Shipment> shipments = new List <Shipment>(); shipments = _functionalService.GetList <Shipment>().ToList(); List <int> ids = new List <int>(); foreach (var item in shipments) { ids.Add(item.SalesOrderId); } salesOrders = _functionalService.GetList <SalesOrder>() .Where(x => !ids.Contains(x.SalesOrderId)) .ToList(); } catch (Exception) { throw; } return(Ok(salesOrders)); }
public IActionResult GetUser() { List <UserProfile> Items = new List <UserProfile>(); Items = _functionalService.GetList <UserProfile>().ToList(); int Count = Items.Count(); return(Ok(new { Items, Count })); }
public async Task <IActionResult> Get() { ApplicationUser appUser = await _userManager.GetUserAsync(User); List <MyAgenda> books = new List <MyAgenda>(); if (appUser != null) { books = _functionalService.GetList <MyAgenda>() .Where(x => x.CreateBy.Equals(appUser.Id)).ToList(); } return(Ok(books)); }
public IActionResult Get() { List <Vendor> Items = _functionalService.GetList <Vendor>().ToList(); int Count = Items.Count(); return(Ok(new { Items, Count })); }
public IActionResult GetPaymentReceive() { List <PaymentReceive> Items = _functionalService.GetList <PaymentReceive>().ToList(); int Count = Items.Count(); return(Ok(new { Items, Count })); }
public IActionResult GetSalesOrderLineByShipmentId() { var headers = Request.Headers["ShipmentId"]; int shipmentId = Convert.ToInt32(headers); Shipment shipment = _functionalService.GetById <Shipment>(shipmentId); List <SalesOrderLine> Items = new List <SalesOrderLine>(); if (shipment != null) { int salesOrderId = shipment.SalesOrderId; Items = _functionalService.GetList <SalesOrderLine>() .Where(x => x.SalesOrderId.Equals(salesOrderId)) .ToList(); } int Count = Items.Count(); return(Ok(new { Items, Count })); }
public IActionResult ProductByProductType() { List <ChartViewModel> result = new List <ChartViewModel>(); List <ProductType> productTypes = _functionalService.GetList <ProductType>() .ToList(); foreach (var item in productTypes) { int count = _functionalService.GetList <Product>() .Where(x => x.ProductTypeId.Equals(item.ProductTypeId)) .Count(); result.Add(new ChartViewModel { x = item.ProductTypeName, text = item.ProductTypeName, y = count }); } return(Ok(result)); }
public IActionResult BookingTrends() { List <ChartViewModel> meetingRoom = new List <ChartViewModel>(); List <ChartViewModel> car = new List <ChartViewModel>(); List <ChartViewModel> general = new List <ChartViewModel>(); DateTime start = new DateTime(DateTime.Now.Year, 1, 1); DateTime end = start.Date.AddMonths(11); for (DateTime i = start.Date; i <= end.Date; i = i.Date.AddMonths(1)) { double countMeetingRoom = _functionalService.GetList <BookMeetingRoom>() .Where(x => x.StartTime.Month.Equals(i.Month) && x.StartTime.Year.Equals(i.Year)).Count(); meetingRoom.Add(new ChartViewModel { x = i.Date.ToString("MMM"), y = countMeetingRoom }); double countCar = _functionalService.GetList <BookCar>() .Where(x => x.StartTime.Month.Equals(i.Month) && x.StartTime.Year.Equals(i.Year)).Count(); car.Add(new ChartViewModel { x = i.Date.ToString("MMM"), y = countCar }); double countGeneral = _functionalService.GetList <BookGeneral>() .Where(x => x.StartTime.Month.Equals(i.Month) && x.StartTime.Year.Equals(i.Year)).Count(); general.Add(new ChartViewModel { x = i.Date.ToString("MMM"), y = countGeneral }); } return(Ok(new { dataMeetingRoom = meetingRoom, textMeetingRoom = "Meeting Room", dataCar = car, textCar = "Car", dataGeneral = general, textGeneral = "General" })); }
public IActionResult Get() { List <BookGeneral> books = _functionalService.GetList <BookGeneral>().ToList(); return(Ok(books)); }
public IActionResult Get() { List <BookMeetingRoom> books = _functionalService.GetList <BookMeetingRoom>().ToList(); return(Ok(books)); }