public void BindStock() { BookCode2 = Txtbkcode1.Text.ToString().Split(':')[0].Trim(); // GrdStock.DataSource = StockUpdate.GetStockUpdate(); // GrdStock.DataBind(); //DataTable dt = new DataTable(); //dt = Idv.Chetana.BAL.StockUpdate.GetStockUpdateRep(bookcode).Tables[0]; //DataView dv = new DataView(dt); //return dv; GrdStock.DataSource = StockUpdate.GetStockUpdateRep(BookCode2); GrdStock.DataBind(); }
// save stock adjustment data private void Save_StockUpdate() { try { if (txtStockLevel.Text == "") { txtStockLevel.Text = "0"; } else if (txtAdd.Text == "") { txtAdd.Text = "0"; } else if (txtDeduct.Text == "") { txtDeduct.Text = "0"; } else if (txtStockBal.Text == "") { txtStockBal.Text = "0"; } var newStockUpdate = new StockUpdate(); newStockUpdate.ItemId = txtItemid.Text; newStockUpdate.ItemCode = txtCode.Text; newStockUpdate.ItemName = txtItemName.Text; newStockUpdate.StockLevel = int.Parse(txtStockLevel.Text); newStockUpdate.QuantityAdded = int.Parse(txtAdd.Text); newStockUpdate.QuantityDeducted = int.Parse(txtDeduct.Text); newStockUpdate.StockBalance = int.Parse(txtStockBal.Text); newStockUpdate.UpdatedAt = DateTime.Now; newStockUpdate.UpdatedBy = Environment.UserName; using (var ctx = new InventoryModel()) { ctx.StockUpdates.Add(newStockUpdate); ctx.SaveChanges(); } MessageBox.Show("New Stock Level successfully saved"); //this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "New Drug / Item"); } }
public async Task <bool> UpdateStockPrice(Guid stockId, double unitPrice) { //validate stock from repo //update stock await _tradeRepository.UpdateStockPrice(stockId, unitPrice); StockUpdate stockUpdate = new StockUpdate() { Id = stockId, UnitPrice = unitPrice }; _messageHandler.Send(stockUpdate, "Stock - " + stockId); return(true); }
public int InsertStockUpdate(StockUpdate model, IDbConnection connection, IDbTransaction txn) { try { string sql = @"INSERT INTO StockUpdate( StockPointId, ItemId, Quantity, StockType, StockInOut, stocktrnDate, StocktrnId, StockUserId, CreatedBy, CreatedDate, OrganizationId) VALUES( @StockPointId, @ItemId, (@Quantity), @StockType, @StockInOut, @stocktrnDate, @StocktrnId, @StockUserId, @CreatedBy, @CreatedDate, @OrganizationId); SELECT CAST(SCOPE_IDENTITY() AS INT);"; var id = connection.Query <int>(sql, model, txn).Single(); return(id); } catch (Exception) { throw; } }
protected void btnSave_Click(object sender, EventArgs e) { StockUpdate objstk = new StockUpdate(); bookcode = Txtbkcode.Text.Split(':')[0].Trim(); objstk.BookCode = bookcode; objstk.OldStock = Convert.ToInt32(TxtCStock.Text); objstk.NewStock = Convert.ToInt32(TxtNStock.Text); objstk.TotalStock = Convert.ToInt32(TxtTStock.Text); objstk.Comment = TxtCom.Text.Trim(); objstk.CreatedBy = Convert.ToString(Session["UserName"]); if (LblStockUpdateID.Text == "0") { objstk.Save(); MessageBox(Constants.save); // BindStock(); PnlAddStock.Visible = true; // PnlStockDetails.Visible = false; } else { } try { Txtbkcode.Text = ""; TxtCStock.Text = ""; TxtNStock.Text = ""; TxtTStock.Text = ""; TxtCom.Text = ""; PnlAddStock.Visible = true; //PnlStockDetails.Visible = false; } catch { } }
public ActionResult Index(StockUpdate objcust) { if (ModelState.IsValid) { if (objcust.stat == true) { try { string circleId = ""; try { circleId = GlobalSettings.oUserData.CircleID; } catch { } if (circleId != "") { objDbTrx.InsertInReqStokDetails(objcust, Convert.ToInt64(circleId)); Response.Write("<script> alert ('Data has been submitted successfully...') </script> "); } else { RedirectToAction("Index", "CircleLogin"); } } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } finally { } } } return(RedirectToAction("Index", "StockUpdate")); }
protected override void Seed(InventoryModel context) { var aUser = new User { FirstName = "Irene", LastName = "A.", UserName = "******", Password = "******", Role = "Admin", Email = "*****@*****.**", Phone = "0801" }; context.Users.Add(aUser); var aSupplier1 = new Supplier { Name = "XYZ Drugs Limited", ContactPerson = "Mr Chacha Nedo", Address = "Ikeja, Lagos, Nigeria", Email = "*****@*****.**", Phone = "080333222" }; var aSupplier2 = new Supplier { Name = "Makinga", ContactPerson = "Mr Toba", Address = "Iwaya Road, Yaba, Lagos", Email = "*****@*****.**", Phone = "080000" }; context.Suppliers.AddRange(new[] { aSupplier1, aSupplier2 }); var aDispese1 = new Dispense { ItemId = "1", GroupId = "27695", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 20, UnitPrice = 5, DispenseQuantity = 1, SubAmount = 5, StockBalance = 20, DateDispensed = new DateTime(2017, 07, 01, 17, 51, 25) }; var aDispese2 = new Dispense { ItemId = "1", GroupId = "11358", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 18, UnitPrice = 5, DispenseQuantity = 2, SubAmount = 10, StockBalance = 18, DateDispensed = new DateTime(2017, 07, 01, 18, 01, 29) }; var aDispese3 = new Dispense { ItemId = "1", GroupId = "3439", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 15, UnitPrice = 4, DispenseQuantity = 3, SubAmount = 12, StockBalance = 15, DateDispensed = new DateTime(2017, 07, 01, 18, 06, 06) }; var aDispese4 = new Dispense { ItemId = "1", GroupId = "85908", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 13, UnitPrice = 3, DispenseQuantity = 2, SubAmount = 6, StockBalance = 13, DateDispensed = new DateTime(2017, 07, 01, 18, 12, 02) }; var aDispese5 = new Dispense { ItemId = "1", GroupId = "21550", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 10, UnitPrice = 3, DispenseQuantity = 3, SubAmount = 9, StockBalance = 10, DateDispensed = new DateTime(2017, 07, 01, 18, 16, 45), DispenseCompleted = "YES" }; var aDispese6 = new Dispense { ItemId = "1", GroupId = "18689", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 8, UnitPrice = 5, DispenseQuantity = 2, SubAmount = 10, StockBalance = 8, DateDispensed = new DateTime(2017, 07, 01, 18, 28, 35) }; var aDispese7 = new Dispense { ItemId = "1", GroupId = "71243", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 6, UnitPrice = 3, DispenseQuantity = 2, SubAmount = 6, StockBalance = 6, DateDispensed = new DateTime(2017, 07, 01, 18, 35, 20) }; var aDispese8 = new Dispense { ItemId = "1", GroupId = "60611", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 5, UnitPrice = 5, DispenseQuantity = 1, SubAmount = 5, StockBalance = 5, DateDispensed = new DateTime(2017, 07, 01, 18, 39, 10), DispenseCompleted = "YES" }; var aDispese9 = new Dispense { ItemId = "1", GroupId = "26130", GroupDate = new DateTime(2017, 07, 01), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 4, UnitPrice = 2, DispenseQuantity = 1, SubAmount = 2, StockBalance = 4, DateDispensed = new DateTime(2017, 07, 01, 20, 09, 37) }; var aDispese10 = new Dispense { ItemId = "2", GroupId = "88108", GroupDate = new DateTime(2017, 07, 01), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 14, UnitPrice = 5, DispenseQuantity = 2, SubAmount = 10, StockBalance = 14, DateDispensed = new DateTime(2017, 07, 01, 20, 10, 18) }; var aDispese11 = new Dispense { ItemId = "2", GroupId = "10657", GroupDate = new DateTime(2017, 07, 01), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 13, UnitPrice = 5, DispenseQuantity = 1, SubAmount = 5, StockBalance = 13, DateDispensed = new DateTime(2017, 07, 01, 20, 11, 28), DispenseCompleted = "YES" }; var aDispese12 = new Dispense { ItemId = "2", GroupId = "21132", GroupDate = new DateTime(2017, 07, 02), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 3, UnitPrice = 10, DispenseQuantity = 1, SubAmount = 10, StockBalance = 3, DateDispensed = new DateTime(2017, 07, 02, 15, 21, 21), DispenseCompleted = "YES" }; var aDispese13 = new Dispense { ItemId = "3", GroupId = "21132", GroupDate = new DateTime(2017, 07, 02), ItemName = "Felvin", StockLevel = 47, UnitPrice = 50, DispenseQuantity = 1, SubAmount = 50, StockBalance = 47, DateDispensed = new DateTime(2017, 07, 02, 15, 21, 21), DispenseCompleted = "YES" }; var aDispese14 = new Dispense { ItemId = "3", GroupId = "4141", GroupDate = new DateTime(2017, 07, 02), ItemName = "Felvin", StockLevel = 46, UnitPrice = 50, DispenseQuantity = 1, SubAmount = 50, StockBalance = 46, DateDispensed = new DateTime(2017, 07, 02, 15, 25, 04), DispenseCompleted = "YES" }; var aDispese15 = new Dispense { ItemId = "1", GroupId = "4141", GroupDate = new DateTime(2017, 07, 02), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 3, UnitPrice = 40, DispenseQuantity = 1, SubAmount = 40, StockBalance = 3, DateDispensed = new DateTime(2017, 07, 02, 15, 25, 04), DispenseCompleted = "YES" }; var aDispese16 = new Dispense { ItemId = "3", GroupId = "42799", GroupDate = new DateTime(2017, 07, 11), ItemName = "Felvin", StockLevel = 43, UnitPrice = 55, DispenseQuantity = 1, SubAmount = 55, StockBalance = 43, DateDispensed = new DateTime(2017, 07, 11, 22, 07, 18) }; var aDispese17 = new Dispense { ItemId = "3", GroupId = "60105", GroupDate = new DateTime(2017, 07, 11), ItemName = "Felvin", StockLevel = 42, UnitPrice = 55, DispenseQuantity = 1, SubAmount = 55, StockBalance = 42, DateDispensed = new DateTime(2017, 07, 11, 22, 27, 23), DispenseCompleted = "YES" }; var aDispese18 = new Dispense { ItemId = "1", GroupId = "60105", GroupDate = new DateTime(2017, 07, 11), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 2, UnitPrice = 12, DispenseQuantity = 1, SubAmount = 12, StockBalance = 2, DateDispensed = new DateTime(2017, 07, 11, 22, 27, 23), DispenseCompleted = "YES" }; var aDispese19 = new Dispense { ItemId = "3", GroupId = "26499", GroupDate = new DateTime(2017, 07, 11), ItemName = "Felvin", StockLevel = 41, UnitPrice = 55, DispenseQuantity = 1, SubAmount = 55, StockBalance = 41, DateDispensed = new DateTime(2017, 07, 11, 22, 37, 54) }; var aDispese20 = new Dispense { ItemId = "1", GroupId = "26499", GroupDate = new DateTime(2017, 07, 11), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 1, UnitPrice = 12, DispenseQuantity = 1, SubAmount = 12, StockBalance = 1, DateDispensed = new DateTime(2017, 07, 11, 22, 37, 54) }; var aDispese21 = new Dispense { ItemId = "3", GroupId = "71337", GroupDate = new DateTime(2017, 07, 16), ItemName = "Felvin", StockLevel = 17, UnitPrice = 70, DispenseQuantity = 1, SubAmount = 70, StockBalance = 17, DateDispensed = new DateTime(2017, 07, 16, 15, 48, 51) }; var aDispese22 = new Dispense { ItemId = "3", GroupId = "37887", GroupDate = new DateTime(2017, 07, 16), ItemName = "Felvin", StockLevel = 13, UnitPrice = 70, DispenseQuantity = 1, SubAmount = 0, StockBalance = 0, DateDispensed = new DateTime(2017, 07, 16, 20, 17, 35) }; var aDispese23 = new Dispense { ItemId = "3", GroupId = "66011", GroupDate = new DateTime(2017, 07, 16), ItemName = "Felvin", StockLevel = 13, UnitPrice = 70, DispenseQuantity = 1, SubAmount = 0, StockBalance = 12, DateDispensed = new DateTime(2017, 07, 16, 20, 52, 25) }; var aDispese24 = new Dispense { ItemId = "3", GroupId = "60419", GroupDate = new DateTime(2017, 07, 16), ItemName = "Felvin", StockLevel = 12, UnitPrice = 70, DispenseQuantity = 1, SubAmount = 70, StockBalance = 11, DateDispensed = new DateTime(2017, 07, 16, 20, 54, 54), DispenseCompleted = "YES" }; var aDispese25 = new Dispense { ItemId = "3", GroupId = "84483", GroupDate = new DateTime(2017, 07, 16), ItemName = "Felvin", StockLevel = 11, UnitPrice = 70, DispenseQuantity = 1, SubAmount = 70, StockBalance = 10, DateDispensed = new DateTime(2017, 07, 16, 21, 19, 07), DispenseCompleted = "YES" }; var aDispese26 = new Dispense { ItemId = "2", GroupId = "84483", GroupDate = new DateTime(2017, 07, 16), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 8, UnitPrice = 58, DispenseQuantity = 2, SubAmount = 116, StockBalance = 6, DateDispensed = new DateTime(2017, 07, 16, 21, 19, 07), DispenseCompleted = "YES" }; var aDispese27 = new Dispense { ItemId = "1", GroupId = "84483", GroupDate = new DateTime(2017, 07, 16), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 10, UnitPrice = 10, DispenseQuantity = 1, SubAmount = 10, StockBalance = 9, DateDispensed = new DateTime(2017, 07, 16, 21, 19, 07), DispenseCompleted = "YES" }; var aDispese28 = new Dispense { ItemId = "1", GroupId = "84269", GroupDate = new DateTime(2017, 07, 16), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 9, UnitPrice = 10, DispenseQuantity = 1, SubAmount = 10, StockBalance = 8, DateDispensed = new DateTime(2017, 07, 16, 21, 35, 23), DispenseCompleted = "YES" }; var aDispese29 = new Dispense { ItemId = "1", GroupId = "84269", GroupDate = new DateTime(2017, 07, 16), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 8, UnitPrice = 10, DispenseQuantity = 1, SubAmount = 10, StockBalance = 7, DateDispensed = new DateTime(2017, 07, 16, 21, 35, 23) }; var aDispese30 = new Dispense { ItemId = "1", GroupId = "74996", GroupDate = new DateTime(2017, 07, 16), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 7, UnitPrice = 10, DispenseQuantity = 1, SubAmount = 10, StockBalance = 6, DateDispensed = new DateTime(2017, 07, 16, 21, 36, 32), DispenseCompleted = "YES" }; var aDispese31 = new Dispense { ItemId = "2", GroupId = "74996", GroupDate = new DateTime(2017, 07, 16), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 7, UnitPrice = 58, DispenseQuantity = 1, SubAmount = 58, StockBalance = 6, DateDispensed = new DateTime(2017, 07, 16, 21, 36, 32), DispenseCompleted = "YES" }; var aDispese32 = new Dispense { ItemId = "2", GroupId = "74996", GroupDate = new DateTime(2017, 07, 16), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 6, UnitPrice = 58, DispenseQuantity = 1, SubAmount = 58, StockBalance = 5, DateDispensed = new DateTime(2017, 07, 16, 21, 36, 32) }; var aDispese33 = new Dispense { ItemId = "3", GroupId = "11913", GroupDate = new DateTime(2017, 07, 16), ItemName = "Felvin", StockLevel = 10, UnitPrice = 70, DispenseQuantity = 1, SubAmount = 70, StockBalance = 9, DateDispensed = new DateTime(2017, 07, 16, 21, 41, 06), DispenseCompleted = "YES" }; var aDispese34 = new Dispense { ItemId = "2", GroupId = "11913", GroupDate = new DateTime(2017, 07, 16), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 5, UnitPrice = 58, DispenseQuantity = 1, SubAmount = 58, StockBalance = 4, DateDispensed = new DateTime(2017, 07, 16, 21, 41, 06), DispenseCompleted = "YES" }; var aDispese35 = new Dispense { ItemId = "2", GroupId = "11913", GroupDate = new DateTime(2017, 07, 16), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 4, UnitPrice = 58, DispenseQuantity = 1, SubAmount = 58, StockBalance = 3, DateDispensed = new DateTime(2017, 07, 16, 21, 41, 06), DispenseCompleted = "YES" }; var aDispese36 = new Dispense { ItemId = "1", GroupId = "11913", GroupDate = new DateTime(2017, 07, 16), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 6, UnitPrice = 10, DispenseQuantity = 1, SubAmount = 10, StockBalance = 5, DateDispensed = new DateTime(2017, 07, 16, 21, 41, 06), DispenseCompleted = "YES" }; var aDispese37 = new Dispense { ItemId = "3", GroupId = "31610", GroupDate = new DateTime(2017, 07, 22), ItemName = "Felvin", StockLevel = 9, UnitPrice = 80, DispenseQuantity = 1, SubAmount = 80, StockBalance = 8, DateDispensed = new DateTime(2017, 07, 22, 11, 40, 06), DispenseCompleted = "YES" }; var aDispese38 = new Dispense { ItemId = "2", GroupId = "31610", GroupDate = new DateTime(2017, 07, 22), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 2, UnitPrice = 60, DispenseQuantity = 2, SubAmount = 120, StockBalance = 0, DateDispensed = new DateTime(2017, 07, 22, 11, 40, 06), DispenseCompleted = "YES" }; var aDispese39 = new Dispense { ItemId = "3", GroupId = "31610", GroupDate = new DateTime(2017, 07, 22), ItemName = "Felvin", StockLevel = 8, UnitPrice = 80, DispenseQuantity = 1, SubAmount = 80, StockBalance = 7, DateDispensed = new DateTime(2017, 07, 22, 11, 40, 06), DispenseCompleted = "YES" }; var aDispese40 = new Dispense { ItemId = "2", GroupId = "2304", GroupDate = new DateTime(2017, 07, 22), ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 19, UnitPrice = 60, DispenseQuantity = 1, SubAmount = 60, StockBalance = 18, DateDispensed = new DateTime(2017, 07, 22, 20, 03, 00), DispenseCompleted = "YES" }; var aDispese41 = new Dispense { ItemId = "1", GroupId = "2304", GroupDate = new DateTime(2017, 07, 22), ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 19, UnitPrice = 20, DispenseQuantity = 1, SubAmount = 20, StockBalance = 18, DateDispensed = new DateTime(2017, 07, 22, 20, 03, 00), DispenseCompleted = "YES" }; var aDispese42 = new Dispense { ItemId = "3", GroupId = "2304", GroupDate = new DateTime(2017, 07, 22), ItemName = "Felvin", StockLevel = 19, UnitPrice = 80, DispenseQuantity = 1, SubAmount = 80, StockBalance = 18, DateDispensed = new DateTime(2017, 07, 22, 20, 03, 00), DispenseCompleted = "YES" }; context.Dispenses.AddRange(new[] { aDispese1, aDispese2, aDispese3, aDispese4, aDispese5, aDispese6, aDispese7, aDispese8, aDispese9, aDispese10, aDispese11, aDispese12, aDispese13, aDispese14, aDispese15, aDispese16, aDispese17, aDispese18, aDispese19, aDispese20, aDispese21, aDispese22, aDispese23, aDispese24, aDispese25, aDispese26, aDispese27, aDispese28, aDispese29, aDispese30, aDispese31, aDispese32, aDispese33, aDispese34, aDispese35, aDispese36, aDispese37, aDispese38, aDispese39, aDispese40, aDispese41 }); var stockUpdate1 = new StockUpdate { ItemId = "1", ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 21, QuantityAdded = 20, StockBalance = 21, UpdatedAt = new DateTime(2017, 7, 1, 17, 50, 14) }; var stockUpdate2 = new StockUpdate { ItemId = "2", ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 20, QuantityAdded = 20, StockBalance = 20, UpdatedAt = new DateTime(2017, 7, 1, 20, 0, 21) }; var stockUpdate3 = new StockUpdate { ItemId = "2", ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 20, QuantityAdded = 20, StockBalance = 20, UpdatedAt = new DateTime(2017, 7, 1, 20, 0, 21) }; var stockUpdate4 = new StockUpdate { ItemId = "3", ItemCode = string.Empty, ItemName = "Felvin", StockLevel = 50, QuantityAdded = 50, StockBalance = 50, UpdatedAt = new DateTime(2017, 7, 2, 10, 59, 47) }; var stockUpdate5 = new StockUpdate { ItemId = "2", ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 10, QuantityAdded = 10, StockBalance = 10, UpdatedAt = new DateTime(2017, 7, 11, 22, 39, 12) }; var stockUpdate6 = new StockUpdate { ItemId = "1", ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 11, QuantityAdded = 10, StockBalance = 11, UpdatedAt = new DateTime(2017, 7, 11, 22, 48, 53) }; var stockUpdate7 = new StockUpdate { ItemId = "1", ItemCode = "PARA-01", ItemName = "Paracetamol", StockLevel = 20, QuantityAdded = 14, StockBalance = 20, UpdatedAt = new DateTime(2017, 7, 22, 11, 41, 36) }; var stockUpdate8 = new StockUpdate { ItemId = "2", ItemCode = "Asp01", ItemName = "Aspirin", StockLevel = 20, QuantityAdded = 18, StockBalance = 20, UpdatedAt = new DateTime(2017, 7, 22, 11, 41, 36) }; var stockUpdate9 = new StockUpdate { ItemId = "3", ItemCode = string.Empty, ItemName = "Felvin", StockLevel = 20, QuantityAdded = 12, StockBalance = 20, UpdatedAt = new DateTime(2017, 7, 22, 11, 41, 36) }; context.StockUpdates.AddRange(new[] { stockUpdate1, stockUpdate2, stockUpdate3, stockUpdate4, stockUpdate5, stockUpdate6, stockUpdate7, stockUpdate8, stockUpdate9 }); var item1 = new Item { Code = "PARA-01", Name = "Paracetamol", Description = "500mg tablet", Manufacturer = "Emzor", MajorSupplier = "Emzor Distributor", PackQuantity = "10", PackDescription = "Sachet", AlternativeItem = "2", StandardIssueQuantity = "Aspirin", EconomicOrderQuantity = "100", PurchasePrice = 10, MarkupPercent = 0, SellingPrice = 20, StockLevel = 19, MinimumLevel = 40, ReOrderLevel = 500, MaximumLevel = 50, LeadDays = 3, CreatedAt = new DateTime(2017, 6, 26, 19, 49, 1), ModifiedAt = new DateTime(2017, 7, 22, 20, 3, 0) }; var item2 = new Item { Code = "Asp01", Name = "Aspirin", Description = "300mg", Manufacturer = "Emzor", MajorSupplier = "Emzor Distributor", PackQuantity = "20", PackDescription = "Sachet", AlternativeItem = "2", StandardIssueQuantity = "Aspirin", EconomicOrderQuantity = "100", PurchasePrice = 55, MarkupPercent = 15, SellingPrice = 65, StockLevel = 19, MinimumLevel = 100, ReOrderLevel = 200, MaximumLevel = 2000, LeadDays = 3, CreatedAt = new DateTime(2017, 7, 1, 19, 57, 12), ModifiedAt = new DateTime(2017, 7, 22, 22, 03, 47) }; var item3 = new Item { Code = "", Name = "Felvin", Description = "pain killer, 2mg", AlternativeName = "Piroxicam", MajorSupplier = "Nich", PackQuantity = "10", PackDescription = "Pack", StandardIssueQuantity = "Ricam", EconomicOrderQuantity = "5", PurchasePrice = 70, MarkupPercent = 0, SellingPrice = 80, StockLevel = 19, MinimumLevel = 10, ReOrderLevel = 5, MaximumLevel = 0, LeadDays = 1, CreatedAt = new DateTime(2017, 7, 2, 10, 43, 40), ModifiedAt = new DateTime(2017, 7, 22, 20, 3, 0) }; context.Items.AddRange(new[] { item1, item2, item3 }); var dis1 = new DispenseSummary { GroupId = "21550", GroupDate = new DateTime(2017, 07, 01), SubAmount = 9, Discount = 1, Vat = 5f, Total = 8, DateDispensed = new DateTime(2017, 07, 01, 18, 16, 45) }; var dis2 = new DispenseSummary { GroupId = "60611", GroupDate = new DateTime(2017, 07, 01), SubAmount = 5, Discount = 2, Vat = 4.5f, Total = 3, DateDispensed = new DateTime(2017, 07, 01, 18, 39, 10) }; var dis3 = new DispenseSummary { GroupId = "10657", GroupDate = new DateTime(2017, 07, 01), SubAmount = 5, Discount = 1, Vat = 5f, Total = 4, DateDispensed = new DateTime(2017, 07, 01, 20, 11, 28) }; var dis4 = new DispenseSummary { GroupId = "21132", GroupDate = new DateTime(2017, 07, 02), SubAmount = 60, Discount = 10, Vat = 0f, Total = 50, DateDispensed = new DateTime(2017, 07, 02, 15, 21, 21) }; var dis5 = new DispenseSummary { GroupId = "60105", GroupDate = new DateTime(2017, 07, 11), SubAmount = 67, Discount = 7, Vat = 0f, Total = 60, DateDispensed = new DateTime(2017, 07, 11, 22, 27, 23) }; var dis6 = new DispenseSummary { GroupId = "60419", GroupDate = new DateTime(2017, 07, 16), SubAmount = 70, Discount = 0, Vat = 0f, Total = 70, DateDispensed = new DateTime(2017, 07, 16, 20, 54, 54) }; var dis7 = new DispenseSummary { GroupId = "84269", GroupDate = new DateTime(2017, 07, 16), SubAmount = 10, Discount = 0, Vat = 0f, Total = 10, DateDispensed = new DateTime(2017, 07, 16, 21, 35, 23) }; var dis8 = new DispenseSummary { GroupId = "74996", GroupDate = new DateTime(2017, 07, 16), SubAmount = 68, Discount = 0, Vat = 0f, Total = 68, DateDispensed = new DateTime(2017, 07, 16, 21, 36, 32) }; var dis9 = new DispenseSummary { GroupId = "11913", GroupDate = new DateTime(2017, 07, 16), SubAmount = 196, Discount = 0, Vat = 0f, Total = 196, DateDispensed = new DateTime(2017, 07, 16, 21, 41, 06) }; var dis10 = new DispenseSummary { GroupId = "31610", GroupDate = new DateTime(2017, 07, 22), SubAmount = 280, Discount = 50, Vat = 0f, Total = 230, DateDispensed = new DateTime(2017, 07, 22, 11, 40, 06) }; var dis11 = new DispenseSummary { GroupId = "2304", GroupDate = new DateTime(2017, 07, 22), SubAmount = 160, Discount = 0, Vat = 0f, Total = 160, DateDispensed = new DateTime(2017, 07, 22, 20, 03, 00) }; context.DispenseSummaries.AddRange(new[] { dis1, dis2, dis3, dis4, dis5, dis6, dis7, dis8, dis9, dis10, dis11 }); base.Seed(context); }
public PartialViewResult GetReqListTrnf(int distid, int destcrclid, long catid, long langid) { StockUpdate lst_req = new StockUpdate(); List <StockTrxDtl> lst_requisition = new List <StockTrxDtl>(); try { #region [GetStockLockDetails] string objSsn = ((SARASWATIPRESSNEW.UserSec)System.Web.HttpContext.Current.Session["UserSec"]) != null ? ((SARASWATIPRESSNEW.UserSec)System.Web.HttpContext.Current.Session["UserSec"]).CircleID : default(int).ToString(); int _circleId = Convert.ToInt32(objSsn); List <CircleLock> lstCircleLock = new List <CircleLock>(); DataTable dtCircleLock = objDbTrx.GetCircleLockByCircleId(_circleId); if (dtCircleLock != null && dtCircleLock.Rows.Count > default(int)) { for (int i = 0; i < dtCircleLock.Rows.Count; i++) { CircleLock objCircleLock = new CircleLock(); objCircleLock.id = Convert.ToInt32(dtCircleLock.Rows[i]["id"]); objCircleLock.circle_id = Convert.ToInt32(dtCircleLock.Rows[i]["circle_id"]); objCircleLock.Req_lock = dtCircleLock.Rows[i]["Req_lock"].ToString(); objCircleLock.Req_year = dtCircleLock.Rows[i]["Req_year"].ToString(); objCircleLock.Stock_lock = dtCircleLock.Rows[i]["Stock_lock"].ToString(); //objCircleLock.ReqLockDate = DateTime.Parse(dtCircleLock.Rows[i]["Stock_lock"].ToString()); lstCircleLock.Add(objCircleLock); } //lstCircleLock.RemoveAll(c => !c.Req_year.Contains("/19")); ViewBag.StockLock = lstCircleLock.FirstOrDefault() != null?lstCircleLock.FirstOrDefault().Stock_lock : default(int).ToString(); } #endregion [GetStockLockDetails] DataTable dtMastData = objDbTrx.GetReqStokDetailsWithTrnf(catid, langid, _circleId, destcrclid); //dtMastData = dtMastData.AsEnumerable().OrderBy(r => r.Field<int>("ID")).CopyToDataTable(); if (dtMastData.Rows.Count > 0) { ViewBag.IsAlreadyConfirmed = dtMastData.Rows[0]["ISCONFIRMED"] != null && !string.IsNullOrWhiteSpace(dtMastData.Rows[0]["ISCONFIRMED"].ToString()) ? Convert.ToInt32(dtMastData.Rows[0]["ISCONFIRMED"].ToString()) : default(int); //ViewBag.IsAlreadyConfirmed = 0; for (int i = 0; i < dtMastData.Rows.Count; i++) { StockTrxDtl rq = new StockTrxDtl(); rq.AutoID = Convert.ToInt64(!string.IsNullOrWhiteSpace(dtMastData.Rows[i]["CIRCLE_STOCK_UPDATE_AUTO_ID"].ToString()) ? dtMastData.Rows[i]["CIRCLE_STOCK_UPDATE_AUTO_ID"].ToString() : "0"); rq.BookName = Convert.ToString(dtMastData.Rows[i]["BOOK_NAME"].ToString()); rq.BOOK_CODE = dtMastData.Rows[i]["BOOK_CODE"].ToString(); rq.BookID = Convert.ToInt32(dtMastData.Rows[i]["ID"].ToString()); rq.tot = 0; rq.StockUpdateQuantity = 0; if (Convert.ToString(dtMastData.Rows[i]["TOT"]).Trim() != "") { rq.tot = Convert.ToInt16(dtMastData.Rows[i]["TOT"].ToString()); } if (Convert.ToString(dtMastData.Rows[i]["STOCK_UPDATE_QTY"]).Trim() != "") { rq.StockUpdateQuantity = Convert.ToInt16(dtMastData.Rows[i]["STOCK_UPDATE_QTY"].ToString()); } if (Convert.ToString(dtMastData.Rows[i]["STOCK_DAMAGE_QTY"]).Trim() != "") { rq.StockDamageQuantity = Convert.ToInt16(dtMastData.Rows[i]["STOCK_DAMAGE_QTY"].ToString()); } if (Convert.ToString(dtMastData.Rows[i]["STOCK_DAMAGE_QTY_AFTERCONF"]).Trim() != "") { rq.STOCK_DAMAGE_QTY_AFTERCONF = Convert.ToInt16(dtMastData.Rows[i]["STOCK_DAMAGE_QTY_AFTERCONF"].ToString()); } if (Convert.ToString(dtMastData.Rows[i]["TOTAL_TRNF_BOOKS"]).Trim() != "") { rq.TOTAL_TRNF_BOOKS = Convert.ToInt32(dtMastData.Rows[i]["TOTAL_TRNF_BOOKS"].ToString()); } if (Convert.ToString(dtMastData.Rows[i]["TMP_ORGN_CIRCLE"]).Trim() != "") { rq.TMP_ORGN_CIRCLE = Convert.ToInt32(dtMastData.Rows[i]["TMP_ORGN_CIRCLE"].ToString()); } if (Convert.ToString(dtMastData.Rows[i]["TMP_DESTN_CIRCLE"]).Trim() != "") { rq.TMP_DESTN_CIRCLE = Convert.ToInt32(dtMastData.Rows[i]["TMP_DESTN_CIRCLE"].ToString()); } if (Convert.ToString(dtMastData.Rows[i]["STOCK_UPDATE_TIMESTAMP"]).Trim() != "") { rq.TimeStamp = dtMastData.Rows[i]["STOCK_UPDATE_TIMESTAMP"].ToString(); } else { rq.TimeStamp = DateTime.Now.ToString("dd-MMM-yyyy hh:mm tt"); } rq.ISCONFIRMED = Convert.ToInt32(Convert.ToString(dtMastData.Rows[i]["ISCONFIRMED"] != null && !string.IsNullOrWhiteSpace(dtMastData.Rows[i]["ISCONFIRMED"].ToString()) ? dtMastData.Rows[i]["ISCONFIRMED"] : default(int))); try { var noOfBooks = Convert.ToInt16(rq.tot); var stockUpdateQuantity = Convert.ToInt16(rq.StockUpdateQuantity); var stockDamageQty = Convert.ToInt16(rq.StockDamageQuantity); var balance = 0; if (stockUpdateQuantity < noOfBooks) { balance = (Convert.ToInt16(rq.tot) - Convert.ToInt16(Math.Abs(Convert.ToInt32(rq.StockUpdateQuantity) - Convert.ToInt32(rq.StockDamageQuantity)))); } rq.Balance = balance; } catch { rq.Balance = 0; } lst_requisition.Add(rq); } } lst_req.reqStockCollection = lst_requisition; } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } //return Json(new { lst_req.reqStockCollection }, JsonRequestBehavior.AllowGet); return(PartialView("_reqCollectionTrnf", lst_req)); }
private void OnStocUpdate() => StockUpdate?.Invoke(this);
public void StockUpdate(PatientRecordModel medicineGiven) { PractitionerData data = new PractitionerData(); List <StockUpdate> stock = new List <StockUpdate>(); StockUpdate medicine = new StockUpdate(); if (medicineGiven.QuantityForMedicine1 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId1), Quantity = medicineGiven.QuantityForMedicine1, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine2 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId2), Quantity = medicineGiven.QuantityForMedicine2, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine3 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId3), Quantity = medicineGiven.QuantityForMedicine3, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine4 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId4), Quantity = medicineGiven.QuantityForMedicine4, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine5 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId5), Quantity = medicineGiven.QuantityForMedicine5, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine6 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId6), Quantity = medicineGiven.QuantityForMedicine6, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine7 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId7), Quantity = medicineGiven.QuantityForMedicine7, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine8 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId8), Quantity = medicineGiven.QuantityForMedicine8, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine9 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId9), Quantity = medicineGiven.QuantityForMedicine9, }; stock.Add(medicine); } if (medicineGiven.QuantityForMedicine10 > 0) { medicine = new StockUpdate() { MedicineId = Guid.Parse(medicineGiven.MedicinesId10), Quantity = medicineGiven.QuantityForMedicine10, }; stock.Add(medicine); } data.StockUpdate(stock, medicineGiven); }
public Models.StockUpdate get_language(string CategoryID, string LanguageID) { //CategoryID, Int64 LanguageID, Int64 CircleID StockUpdate lst_req = new StockUpdate(); List <Language> lst_language = new List <Language>(); try { DataTable dtMastData = objDbTrx.GetLanguageMasterDetails(); if (dtMastData.Rows.Count > 0) { for (int iCnt = 0; iCnt < dtMastData.Rows.Count; iCnt++) { Language rq = new Language(); rq.language_name = Convert.ToString(dtMastData.Rows[iCnt]["LANGUAGE"].ToString()); rq.LanguageID = Convert.ToInt32(dtMastData.Rows[iCnt]["ID"].ToString()); lst_language.Add(rq); } dtMastData.Dispose(); } lst_req.languageCollection = lst_language; } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } List <Category> lst_category = new List <Category>(); try { //DataTable dtMastData = objDbTrx.GetBookCategoryMasterDetails(); DataTable dtMastData = objDbTrx.GetChallanBookCeategory(); if (dtMastData.Rows.Count > 0) { for (int iCnt = 0; iCnt < dtMastData.Rows.Count; iCnt++) { Category rq = new Category(); rq.Category_name = Convert.ToString(dtMastData.Rows[iCnt]["CHALLAN_BOOK_CATEGORY"].ToString()); rq.CategoryID = Convert.ToInt32(dtMastData.Rows[iCnt]["ID"].ToString()); lst_category.Add(rq); } dtMastData.Dispose(); } lst_req.categoryCollection = lst_category; } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } if (Convert.ToString(CategoryID) != null && Convert.ToString(LanguageID) != null) { lst_req.cat_id = Convert.ToString(CategoryID.ToString()); lst_req.lan_id = Convert.ToString(LanguageID.ToString()); } else { lst_req.cat_id = "Select"; lst_req.lan_id = "Select"; } return(lst_req); }