public async Task Create(CreateStockLedgerDto input) { var @stockLedger = input.MapTo <StockLedger>(); var @stock = _stockLedgerRepository.GetAll().WhereIf(true, x => x.ItemCode == input.ItemCode).OrderByDescending(x => x.CreationTime).FirstOrDefault(); int balancestock = 0; int balance = 0; if (@stock == null) { balance = 0; } else { balance = @stock.BalanceStock; } if (input.TransactionType == "Job" || input.TransactionType == "Stock Cancel") { balancestock = balance - input.UsedStock; } else if (input.TransactionType == "Stock Receive" || input.TransactionType == "Job Cancel") { balancestock = balance + input.UsedStock; } @stockLedger = StockLedger.Create(AbpSession.GetTenantId(), input.ItemCode, input.Date.Value, input.TransactionType, input.DocNo, input.UsedStock, balancestock, input.Status); await _stockLedgerRepository.InsertAsync(@stockLedger); }
public ActionResult StockLedger(StockLedger obj, string SubmitBtn) { obj.CMD = SubmitBtn == "Save" ? "Save" : SubmitBtn == "Update" ? "Update" : "Delete"; obj.hid = Convert.ToInt32(Session["hospital"].ToString()); obj.getMultipleItems(); obj.getMultipleUnit(); switch (obj.CMD) { case "Save": obj.hid = Convert.ToInt32(Session["hospital"].ToString()); string[] str = obj.PerformAction(); ViewBag.msg = str[1]; return(View("StockLedger", obj)); case "Update": string[] str1 = obj.PerformAction(); ViewBag.msg = str1[2]; return(View("StockLedger", obj)); case "Delete": string[] str2 = obj.PerformAction(); ViewBag.msg = str2[3]; return(View("StockLedger", obj)); default: return(View(obj)); } }
public ActionResult StockLedgerUpdate(StockLedger obj, string SubmitBtn) { StockLedger(obj, SubmitBtn); if (SubmitBtn == "Delete") { return(Redirect("~/StockManagement/ViewStockLeader")); } return(View("StockLeader", obj)); }
public StockLedger GetStockLedger(StockLedger item) { return((StockLedger)stockledgerDAL.GetItem <StockLedger>(item)); }
public bool DeleteStockLedger(StockLedger item) { return(stockledgerDAL.Delete(item)); }
public bool SaveStockLedger(StockLedger newItem) { return(stockledgerDAL.Save(newItem)); }