private void InitialiazeIssuanceEntry(string requestReferenceNumber) { RequisitionManager rManager = new RequisitionManager(); ItemManager itemManager = new ItemManager(); var items = rManager.FetchAll() .Where(r => r.ReferenceNumber.Equals(requestReferenceNumber) && !r.Status.Equals(Transaction.TransactionStatus.Completed.ToString())); decimal totalAmount = (from p in items let item = itemManager.FetchById(p.ItemId) select item.LastSellingPrice*p.QuantityIssued).Sum(); txtTotalAmount.Text = totalAmount.ToString("##0.00"); ItemClassificationManager classificationManager = new ItemClassificationManager(); ItemTypeManager itManager = new ItemTypeManager(); UnitManager uManager = new UnitManager(); List<RequestItem> requesItems = (from ri in items let classification = classificationManager.FetchById(ri.ItemClassificationId) let department = _dManager.FetchById(ri.DepartmentId) let item = itemManager.FetchById(ri.ItemId) let type = itManager.FetchById(item.TypeId) let unit = uManager.FetchById(ri.UnitId) select new RequestItem { Barcode = ri.BarCode, ClassificationName = classification.ClassificationName, ClassificationId = classification.Id, DepartmentId = department.Id, DepartmentName = department.Description, ItemCode = item.ItemCode, ItemId = item.Id, ItemName = item.ItemName, ReferenceNumber = ri.ReferenceNumber, RequestDate = ri.RequisitionDate, RequestTo = ri.DepartmentId, TypeId = type.Id, TypeName = type.ItemDesciption, UnitName = unit.Description, UnitId = unit.Id, Uid = ri.UniqueId, Quantity = ri.QuantityIssued, RequesitionId = ri.Id, ItemPrice = item.LastSellingPrice, ReceivedQuantity = ri.QuantityReceived, IssuedQuantity = ri.QuantityIssued }).ToList(); Session["REQUEST_ITEMS"] = requesItems; gvSelectedItems.DataSource = requesItems; gvSelectedItems.DataBind(); if (requesItems.Count>0) { divMessageBox.Visible = true; divMessageBox.Attributes.Add("class", "notify info"); ltrlMessageHeader.Text = "Search Result!"; ltrlMessage.Text = "(" + requesItems.Count + ") Requistion detail found!"; btnSubmitIssuance.Enabled = true; } else { divMessageBox.Visible = true; divMessageBox.Attributes.Add("class", "notify warning"); ltrlMessageHeader.Text = "Search Result!"; ltrlMessage.Text = "No Requistion found!"; btnSubmitIssuance.Enabled = false; } }
private void InitialiazeIssuanceDetails() { ItemManager itemManager = new ItemManager(); var items = _issuanceDetailManager.FetchAll(IssuanceId); txtTotalAmount.Text = Issuance.TotalAmount.ToString("##0.00"); ItemClassificationManager classificationManager = new ItemClassificationManager(); UnitManager uManager = new UnitManager(); List<RequestItem> requesItems = (from ri in items let item = itemManager.FetchById(ri.ItemId) let classification = classificationManager.FetchById(item.ClassificationId) let unit = uManager.FetchById(ri.UnitId) let request = _requisitionManager.FetchById(ri.RequisitionId) select new RequestItem { Barcode = ri.Barcode, ClassificationName = classification.ClassificationName, ClassificationId = classification.Id, DepartmentId = Issuance.DepartmentId, DepartmentName = Issuance.IssuedTo, ItemCode = item.ItemCode, ItemId = item.Id, ItemName = item.ItemName, ReferenceNumber = Issuance.ReferenceNumber, UnitName = unit.Description, UnitId = unit.Id, Uid = ri.Uid, Quantity = ri.Quantity, RequesitionId = ri.RequisitionId, ItemPrice = ri.Price, ReceivedQuantity = request.QuantityReceived, IssuedQuantity = request.QuantityIssued }).ToList(); gvSelectedItems.DataSource = requesItems; gvSelectedItems.DataBind(); if (requesItems.Count <= 0) { divMessageBox.Visible = true; divMessageBox.Attributes.Add("class", "notify warning"); ltrlMessageHeader.Text = "Issuance!"; ltrlMessage.Text = "No Requistion found!"; btnSubmitIssuance.Enabled = false; } }