public ActionResult Update(string key, List <spView_WebTemplate_ViralLoadReagentsGetAll_Result> changed, List <spView_WebTemplate_ViralLoadReagentsGetAll_Result> added, List <spView_WebTemplate_ViralLoadReagentsGetAll_Result> deleted) { Formulas formulas = new Formulas(); var order_no = TempData.Peek("OrderNumber").ToString(); OrderViralLoadReagentsModels obj = new OrderViralLoadReagentsModels(); ////Performing update operation if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; //obj.StartDate = System.Convert.ToDateTime(temp.StartDate); //obj.EndDate = System.Convert.ToDateTime(temp.EndDate); //obj.FacilityCode = System.Convert.ToInt32(temp.FacilityCode); obj.ProductCode = System.Convert.ToInt32(temp.ProductCode); obj.OpeningBalance = temp.OpeningBalance; obj.QuantityRecieved = temp.QuantityRecieved; obj.Consumption = temp.Consumption; obj.LossesAndAdjustments = temp.LossesAndAdjustments; obj.TotalClosingBalance = temp.TotalClosingBalance; obj.QuantityOrdered = Convert.ToDouble(formulas.Allocated(temp.QuantityOrdered)); obj.QuantityAllocated = (formulas.Allocated(temp.QuantityOrdered)); obj.Comments = temp.Comment; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Update(string key, List <spView_WebTemplate_TBGetAll_Result> changed, List <spView_WebTemplate_TBGetAll_Result> added, List <spView_WebTemplate_TBGetAll_Result> deleted) { Formulas formulas = new Formulas(); var order_no = TempData.Peek("OrderNumber").ToString(); OrderTBModels obj = new OrderTBModels(); ////Performing update operation if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; //obj.StartDate = System.Convert.ToDateTime(temp.StartDate); //obj.EndDate = System.Convert.ToDateTime(temp.EndDate); //obj.FacilityCode = System.Convert.ToInt32(temp.FacilityCode); obj.ProductCode = System.Convert.ToInt32(temp.ProductCode); obj.OpeningBalance = temp.OpeningBalance; obj.QtyRecieved = temp.QtyRecieved; obj.Dispensed2MonthsReview = temp.Dispensed2MonthsReview; obj.DaysOutofStock = temp.DaysOutofStock; obj.ClosingBalance = temp.ClosingBalance; obj.LossesAndAdjustments = temp.LossesAndAdjustments; obj.AdjustedAMC = ((temp.Dispensed2MonthsReview * 30) / (60 - temp.DaysOutofStock)); obj.MonthsOfStock = ((temp.ClosingBalance) / (temp.AdjustedAMC)); obj.QuantityRequired = Convert.ToDouble(formulas.Allocated((4 * (temp.AdjustedAMC)) - (temp.ClosingBalance))); // obj.MaximumStockQuantity = (2 * temp.QuantityUsedDuringTwoMonths); obj.Comments = temp.Comments; obj.Quantity_Allocated = Convert.ToDouble(formulas.Allocated((temp.QuantityRequired))); obj.RFSONotes = temp.RFSONotes; obj.Update(); } } //Performing delete operation //if (deleted != null && deleted.Count() > 0) //{ // foreach (var temp in deleted) // { // db.core_householdmember.Remove(db.core_householdmember.FirstOrDefault(o => o.id == temp.id)); // } //} //db.SaveChanges(); //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Update(string key, List <spView_WebTemplate_OI_STIGetAll_Result> changed, List <spView_WebTemplate_OI_STIGetAll_Result> added, List <spView_WebTemplate_OI_STIGetAll_Result> deleted) { Formulas formulas = new Formulas(); var order_no = TempData.Peek("OrderNumber").ToString(); OrderOISTIModels obj = new OrderOISTIModels(); ////Performing update operation if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; //obj.StartDate = System.Convert.ToDateTime(temp.StartDate); //obj.EndDate = System.Convert.ToDateTime(temp.EndDate); //obj.FacilityCode = System.Convert.ToInt32(temp.FacilityCode); obj.ProductCode = System.Convert.ToInt32(temp.ProductCode); obj.PhysicalCountAtBeginningOfReviewPeriod = temp.PhysicalCountAtBeginningOfReviewPeriod; obj.QuantityReceivedDuringTheTwoMonthsCycle = temp.QuantityReceivedDuringTheTwoMonthsCycle; obj.QuantityUsedDuringTwoMonths = temp.QuantityUsedDuringTwoMonths; obj.NumberOfDaysOutOfStock = temp.NumberOfDaysOutOfStock; obj.ThisMonthPhysicalCount = temp.ThisMonthPhysicalCount; obj.LossesAndAdjustments = temp.LossesAndAdjustments; obj.AMC = ((temp.QuantityUsedDuringTwoMonths * 30) / (60 - temp.NumberOfDaysOutOfStock)); obj.MonthsOfStock = ((temp.ThisMonthPhysicalCount) / (temp.AMC)); obj.QuantityRequired = Convert.ToDouble(formulas.Allocated((4 * (temp.AMC) - (temp.ThisMonthPhysicalCount)))); obj.MaximumStockQuantity = (2 * temp.QuantityUsedDuringTwoMonths); obj.Notes = temp.Notes; obj.Quantity_Allocated = Convert.ToDouble(formulas.Allocated((temp.QuantityRequired))); obj.RFSONotes = temp.RFSONotes; obj.Update(); } } //Performing delete operation //if (deleted != null && deleted.Count() > 0) //{ // foreach (var temp in deleted) // { // db.core_householdmember.Remove(db.core_householdmember.FirstOrDefault(o => o.id == temp.id)); // } //} //db.SaveChanges(); //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Update(string key, List <spView_WebTemplate_SMC_SLMGetAll_Result> changed, List <spView_WebTemplate_SMC_SLMGetAll_Result> added, List <spView_WebTemplate_SMC_SLMGetAll_Result> deleted) { Formulas formulas = new Formulas(); var order_no = TempData.Peek("OrderNumber").ToString(); OrderSMCModels obj = new OrderSMCModels(); ////Performing update operation if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; //obj.StartDate = System.Convert.ToDateTime(temp.StartDate); //obj.EndDate = System.Convert.ToDateTime(temp.EndDate); //obj.FacilityCode = System.Convert.ToInt32(temp.FacilityCode); obj.ProductCode = System.Convert.ToInt32(temp.ProductCode); obj.OpeningBalance = temp.OpeningBalance; obj.QtyRecieved = temp.QtyRecieved; obj.Consumption = temp.Consumption; obj.LossesAndAdjustments = temp.LossesAndAdjustments; obj.TotalClosingBalance = temp.TotalClosingBalance; obj.QuantityToOrder = Convert.ToDouble(formulas.Allocated((3 * temp.Consumption) - temp.TotalClosingBalance)); obj.QuantityAllocated = (formulas.Allocated((3 * temp.Consumption) - temp.TotalClosingBalance)); obj.Comments = temp.Comments; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } //Performing delete operation //if (deleted != null && deleted.Count() > 0) //{ // foreach (var temp in deleted) // { // db.core_householdmember.Remove(db.core_householdmember.FirstOrDefault(o => o.id == temp.id)); // } //} //db.SaveChanges(); //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Update(string key, List <spView_WebTemplate_LaboratoryGetAll_MA_WFA_Result> changed, List <spView_WebTemplate_LaboratoryGetAll_MA_WFA_Result> added, List <spView_WebTemplate_LaboratoryGetAll_MA_WFA_Result> deleted) { Formulas formulas = new Formulas(); var order_no = TempData.Peek("OrderNumber").ToString(); OrderLaboratoryModels obj = new OrderLaboratoryModels(); ////Performing Addation operation if (added != null && added.Count() > 0) { foreach (var temp in added) { obj.OrderNumber = order_no; obj.ItemCode = System.Convert.ToInt32(temp.product_code); obj.opening_balance = temp.opening_balance; obj.quantity_recieved = temp.quantity_recieved; obj.consumption = temp.consumption; obj.losses_adjustment = temp.losses_adjustment; obj.closing_balance = temp.closing_balance; obj.quantity_to_order = Convert.ToDouble(formulas.Allocated((2 * temp.consumption) - (temp.closing_balance))); obj.quantity_allocated = (formulas.Allocated(temp.quantity_to_order)); //obj.quantity_allocated = (formulas.Allocated((2 * temp.consumption) - temp.closing_balance)); obj.total_cost = temp.total_cost; obj.comments = temp.comments; obj.RFSONotes = temp.RFSONotes; obj.Update(); if (temp.product_code == 20) { obj = new OrderLaboratoryModels(); obj.OrderNumber = order_no; var lab_cat = context.A_Product_Lab_Category.FirstOrDefault(f => f.product_code == 140029); obj.ItemCode = System.Convert.ToInt32(lab_cat.product_category_code); obj.opening_balance = temp.opening_balance; obj.quantity_recieved = temp.quantity_recieved; obj.consumption = temp.consumption; obj.losses_adjustment = temp.losses_adjustment; obj.closing_balance = temp.closing_balance; obj.quantity_to_order = Convert.ToDouble(formulas.Allocated((2 * temp.consumption) - (temp.closing_balance))); obj.quantity_allocated = (formulas.Allocated(temp.quantity_to_order)); obj.total_cost = temp.total_cost; obj.comments = temp.comments; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } } ////Performing update operation if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; obj.ItemCode = System.Convert.ToInt32(temp.product_code); obj.opening_balance = temp.opening_balance; obj.quantity_recieved = temp.quantity_recieved; obj.consumption = temp.consumption; obj.losses_adjustment = temp.losses_adjustment; obj.closing_balance = temp.closing_balance; obj.quantity_to_order = Convert.ToDouble(formulas.Allocated((2 * temp.consumption) - (temp.closing_balance))); obj.quantity_allocated = (formulas.Allocated(temp.quantity_to_order)); obj.total_cost = temp.total_cost; obj.comments = temp.comments; obj.RFSONotes = temp.RFSONotes; obj.Update(); if (temp.product_code == 20) { obj = new OrderLaboratoryModels(); obj.OrderNumber = order_no; var lab_cat = context.A_Product_Lab_Category.FirstOrDefault(f => f.product_code == 140029); obj.ItemCode = System.Convert.ToInt32(lab_cat.product_category_code); obj.opening_balance = temp.opening_balance; obj.quantity_recieved = temp.quantity_recieved; obj.consumption = temp.consumption; obj.losses_adjustment = temp.losses_adjustment; obj.closing_balance = temp.closing_balance; obj.quantity_to_order = Convert.ToDouble(formulas.Allocated((2 * temp.consumption) - (temp.closing_balance))); obj.quantity_allocated = (formulas.Allocated(temp.quantity_to_order)); obj.total_cost = temp.total_cost; obj.comments = temp.comments; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } } //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateCustom(string key, List <spView_WebTemplate_Lab_CustomGetAll_Result> changed, List <spView_WebTemplate_Lab_CustomGetAll_Result> added, List <spView_WebTemplate_Lab_CustomGetAll_Result> deleted) { Formulas formulas = new Formulas(); var order_no = TempData.Peek("OrderNumber").ToString(); OrderLaboratoryCustomModels obj = new OrderLaboratoryCustomModels(); ////Performing Additon operation if (added != null && added.Count() > 0) { foreach (var temp in added) { obj.OrderNumber = order_no; obj.ProductCode = System.Convert.ToInt32(temp.product_code); obj.Quantity_Required = Convert.ToDouble(formulas.Allocated(temp.Quantity_Required)); obj.Quantity_Allocated = Convert.ToDouble(formulas.Allocated(temp.Quantity_Required)); obj.Notes = temp.Notes; obj.RFSONotes = temp.RFSONotes; obj.Update(); if (temp.product_code == 130018) { obj = new OrderLaboratoryCustomModels(); obj.OrderNumber = order_no; // var lab_cat = context.A_Product_Lab_Category.FirstOrDefault(f => f.product_code == 140029); obj.ProductCode = 140029 /*System.Convert.ToInt32(lab_cat.product_category_code)*/; obj.Quantity_Required = Convert.ToDouble(formulas.Allocated(temp.Quantity_Required)); obj.Quantity_Allocated = Convert.ToDouble(formulas.Allocated(temp.Quantity_Required)); obj.Notes = temp.Notes; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } } ////Performing update operation if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; obj.ProductCode = System.Convert.ToInt32(temp.product_code); obj.Quantity_Required = Convert.ToDouble(formulas.Allocated(temp.Quantity_Required)); obj.Quantity_Allocated = Convert.ToDouble(formulas.Allocated(temp.Quantity_Required)); obj.Notes = temp.Notes; obj.RFSONotes = temp.RFSONotes; obj.Update(); if (temp.product_code == 20) { obj = new OrderLaboratoryCustomModels(); obj.OrderNumber = order_no; var lab_cat = context.A_Product_Lab_Category.FirstOrDefault(f => f.product_code == 140029); obj.ProductCode = System.Convert.ToInt32(lab_cat.product_category_code); obj.Quantity_Required = Convert.ToDouble(formulas.Allocated(temp.Quantity_Required)); obj.Quantity_Allocated = Convert.ToDouble(formulas.Allocated(temp.Quantity_Required)); obj.Notes = temp.Notes; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } } var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); // var data = 0; return Json(data, JsonRequestBehavior.AllowGet); }