public ActionResult GetDonorName(Guid id) { StringBuilder blineOption = new StringBuilder(); using (var dbcontenxt = new SCMSEntities()) { Model.ProjectDonor pd = dbcontenxt.ProjectDonors.SingleOrDefault(p => p.Id == id); blineOption.Append("<label for=\"EntityOrderRequest_ProjectDonor_Donor_Name\">" + pd.Donor.Name + "</label>"); } ViewBag.Html = blineOption.ToString(); return(View("SelectIndexChangeResponse")); }
private DataTable GetDetailsTable(Guid orderId) { DataTable table = new DataTable(); var dbContext = new SCMSEntities(); IEnumerable <Model.OrderRequestItem> items = dbContext.OrderRequestItems.Where(i => i.OrderRequestId == orderId); table.Columns.Add("No.", typeof(string)); table.Columns.Add("Description", typeof(string)); table.Columns.Add("Unit", typeof(string)); table.Columns.Add("Qty", typeof(string)); table.Columns.Add("Estimated Price", typeof(string)); table.Columns.Add("Estimated Total Price", typeof(string)); table.Columns.Add("BL", typeof(string)); table.Columns.Add("PN", typeof(string)); table.Columns.Add("Remarks", typeof(string)); decimal total1 = 0; decimal total2 = 0; if (items != null) { int count = 1; foreach (Model.OrderRequestItem i in items) { Model.Item it = dbContext.Items.First(t => t.Id == i.ItemId); Model.UnitOfMeasure um = dbContext.UnitOfMeasures.First(m => m.Id == i.Item.UnitOfMeasure.Id); Model.ProjectBudget line = dbContext.ProjectBudgets.First(m => m.Id == i.BudgetLineId); Model.ProjectDonor pDonor = dbContext.ProjectDonors.First(m => m.Id == i.OrderRequest.ProjectDonorId); table.Rows.Add(count.ToString(), it.Name, um.Code, i.Quantity.ToString(), i.EstimatedUnitPrice.ToString("#,###.##"), i.EstimatedPrice.ToString("#,###.##"), line.LineNumber, pDonor.ProjectNumber, i.Remarks); count++; total1 += i.EstimatedPrice; total2 += i.EstimatedPrice; } table.Rows.Add("", "", "", "", "Total", total1.ToString("#,###.##"), "OR Value", "", ""); //Currency of Request table.Rows.Add("", "", "", "", "Total", total2.ToString("#,###.##"), "OR Value", "", ""); //Master Budget Currency } return(table); // Return reference. }
public string GenerateAssetNo(Guid ProjectDId) { using (var dbContext = new SCMSEntities()) { Model.ProjectDonor pd = dbContext.ProjectDonors.FirstOrDefault(p => p.Id == ProjectDId); string code = pd.Donor.ShortName + "/"; code += pd.Project.ShortName + "/"; long count = 1; Model.Asset m = dbContext.Assets.OrderByDescending(p => p.Index).FirstOrDefault(); if (m != null) { count = m.Index + 1; } if (count < 10000) { if (count < 10) { return(code + "0000" + count); } if (count < 100 & count >= 10) { return(code + "000" + count); } if (count < 1000 & count >= 100) { return(code + "00" + count); } if (count < 10000 & count >= 1000) { return(code + "0" + count); } } return(code + count); } }
private ActionResult RegisterAsset(Guid id) { var grnItem = SessionData.CurrentSession.GoodsReceivedNoteItemList.FirstOrDefault(p => p.Id == id); Model.ProjectDonor pd = SessionData.CurrentSession.GoodsReceivedNoteItemList.FirstOrDefault(p => p.Id == id).PurchaseOrderItem.ProjectDonor; var model = new Asset() { Warehouses = new SelectList(SessionData.CurrentSession.WarehouseList, "Id", "Name"), DepreciationCurrencyId = grnItem.PurchaseOrderItem.PurchaseOrder.Currency.Id, CurrentProjectDonorId = pd.Id, OpeningAccDepreciaiton = 0, AssetNumber = gRNService.GenerateAssetNo(SessionData.CurrentSession.GoodsReceivedNoteItemList.FirstOrDefault(p => p.Id == id)), PurchaseValue = SessionData.CurrentSession.GoodsReceivedNoteItemList.FirstOrDefault(p => p.Id == id).PurchaseOrderItem.UnitPrice, PercentageDepr = SessionData.CurrentSession.GoodsReceivedNoteItemList.FirstOrDefault(p => p.Id == id).PurchaseOrderItem.Item.ItemClassification.PercentageDepr }; ViewBag.TotalItems = grnItem.QuantityDelivered; ViewBag.CurrentItem = SessionData.CurrentSession.AssetList.Count(p => p.GoodsReceivedNoteItemId == id) + 1; ViewBag.GRNItemId = id; ViewBag.Currency = grnItem.PurchaseOrderItem.PurchaseOrder.Currency.ShortName; ViewBag.ItemName = grnItem.PurchaseOrderItem.Item.Name; ViewBag.CurrentProject = pd.ProjectNumber; return(View("LoadRegsiterAsset", model)); }