public ActionResult Delete(int ExpenseID) { expense expense = ExpenseRepository.GetExpenseByID(ExpenseID); if (expense.PendingBillID > 0) { //reset bill status bill b = db.bills.Find(expense.PendingBillID); b.Status = "New"; db.SaveChanges(); } //get pending bills IEnumerable <bill> bills = BillRepository.GetAllBill(); ViewBag.PendingBills = bills; //get pedning expenses IEnumerable <expense> expenses = db.expenses.Where(e => e.Status == "Unpaid"); foreach (var i in expenses) { i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.subCategoryID); i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID); } ViewBag.PendingExpenses = expenses; ViewBag.ExpenseID = ExpenseID; expense.subcategory = SubCategoryRepository.GetBySubCategoryID(expense.subCategoryID); return(PartialView(expense)); }
public void CommitReconcileCheck(int expenseID, bool flag) { expense exp = db.expenses.Find(expenseID); exp.Reconcile = flag; db.SaveChanges(); }
public ActionResult Edit(int ExpenseID, string RequestType = "") { ViewBag.RequestType = RequestType; if (RequestType == "CommittedUpdate") { } else { //get pending bills IEnumerable <bill> bills = BillRepository.GetAllBill(); ViewBag.PendingBills = bills; //get pedning expenses IEnumerable <expense> expenses = db.expenses.Where(e => e.Status == "Unpaid"); foreach (var i in expenses) { i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.subCategoryID); i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID); } ViewBag.PendingExpenses = expenses; } expense expense = ExpenseRepository.GetExpenseByID(ExpenseID); GetData(); return(PartialView(expense)); }
// GET: Users/Delete/5 public ActionResult Delete(long id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } expense exp = _repo.ExpenseFind(id); ExpenseCreateVM model = new ExpenseCreateVM() { id = exp.id, name = exp.name, description = exp.description, expense_id = exp.expense_id, date_expense = (DateTime)exp.date_expense, }; if (exp == null) { return(HttpNotFound()); } ViewBagDetail(model.expense_id); return(View(model)); }
public async Task <ActionResult> UpdateExpense(int id, [FromBody] expense expense) { if (!ModelState.IsValid) { return(BadRequest(new ApiGeneralResponse { Status = false })); } try { var status = await _ExpenseRepository.UpdateExpenseAsync(expense); if (!status) { return(BadRequest(new ApiGeneralResponse { Status = false })); } return(Ok(new ApiGeneralResponse { Status = true, id = expense.expenseID })); } catch (Exception exp) { _Logger.LogError(exp.Message); return(BadRequest(new ApiGeneralResponse { Status = false })); } }
public ActionResult DeleteConfirmed(int ExpenseID) { expense expense = ExpenseRepository.GetExpenseByID(ExpenseID); ExpenseRepository.DeleteRecord(expense); return(RedirectToAction("Create")); }
public ActionResult Create(expense expense, [Bind(Prefix = "ExpenseDetail", Include = "ExpenseName,Amount")] List <ExpenseDetail> expenseDetails, FormCollection collection) { decimal maxExpncId = db.expenses.DefaultIfEmpty().Max(p => p == null ? 0 : p.Id); maxExpncId += 1; //decimal maxExpncDId = db.ExpenseDetails.DefaultIfEmpty().Max(p => p == null ? 0 : p.Id); //maxExpncDId += 1; decimal TotalAmount = 0; foreach (ExpenseDetail ed in expenseDetails) { TotalAmount += ed.Amount.Value; ed.ExpenseId = maxExpncId; db.ExpenseDetails.Add(ed); } expense.Id = maxExpncId; Business CurrentBusiness = (Business)Session["CurrentBusiness"]; expense.BizId = CurrentBusiness.Id; expense.expenseTotal = TotalAmount; db.expenses.Add(expense); db.SaveChanges(); return(RedirectToAction("Create")); }
public expense SetDbObject(expense dbItem, string user) { dbItem.id_rent = this.IdRent.Value; dbItem.date = this.Date; dbItem.updated_by = user; dbItem.updated_time = DateTimeOffset.Now; return(dbItem); }
/// <summary> /// Add New Expense to the Database /// </summary> /// <param name="prop_id"></param> /// <param name="exp_name"></param> /// <param name="exp_cost"></param> /// <param name="exp_desc"></param> /// <param name="contractor_name"></param> /// <param name="exp_type"></param> public void AddExpense(expense exp, int propertyId) { exp.expense_property_id = propertyId; context.expenses.Add(exp); context.SaveChanges(); MainWindow.ExpenseDataGrid.ItemsSource = context.expenses.ToList(); }
private void btnexp_Click(object sender, EventArgs e) { expense exp = new expense(); exp.usertype = this.usertype; exp.reftomain = this; exp.Show(); this.Hide(); }
public ViewResult Detail(Guid id) { expense dbItem = RepoExpense.FindByPk(id); //expense_item expenseItem = new expense_item(); //List<expense_item> expenseItemList = dbItem.expense_item.Where(x => x.id_expense == dbItem.id).ToList(); //expense_item dbItem = RepoExpense.FindItemByPk(id); CostPresentationStub model = new CostPresentationStub(dbItem); return(View(model)); }
public ActionResult DeleteConfirmed(long id) { expense exp = _repo.ExpenseFind(id); exp.activo = 0; //_repo.ExpenseDelete(exp); _repo.ExpenseUpdate(exp); return(RedirectToAction("Index")); }
public expense Insert_expense_select(int ID) { expense = expense.Select(ID); Insert_case_id_txt.Text = Convert.ToString(expense.case_id); Insert_client_id_txt.Text = Convert.ToString(expense.client_id); Insert_date_paid_txt.Text = Convert.ToString(expense.date_paid); Insert_expense_amt_paid_txt.Text = Convert.ToString(expense.expense_amt_paid); Insert_expense_amt_paid_to_txt.Text = Convert.ToString(expense.expense_amt_paid_to); return(expense); }
public void AddExpenseToWorkFlow(int workflowId, expense expense) { if (_workflowExpenses.ContainsKey(workflowId)) { _workflowExpenses[workflowId].ToList().Add(expense); } _workflowExpenses.Add(workflowId, new List <expense>() { expense }); }
public expense GetDbObject(string user) { expense dbItem = new expense(); dbItem.id = this.Id; dbItem.id_rent = this.IdRent.Value; dbItem.date = this.Date; dbItem.created_by = user; dbItem.created_time = DateTimeOffset.Now; return(dbItem); }
/// <summary> /// Deletes the passed Expense object from DataGrid and DB /// </summary> /// <param name="exp"></param> public void RemoveExpense(expense exp) { var delExp = (from ex in context.expenses where ex.expense_id == exp.expense_id select ex).Single(); context.expenses.Remove(delExp); context.SaveChanges(); MainWindow.ExpenseDataGrid.ItemsSource = context.expenses.ToList(); }
public expense Delete_expense_select(int ID) { expense = expense.Select(ID); Delete_expense_id_txt_lbl.Text = Convert.ToString(expense.expense_id); Delete_case_id_txt_lbl.Text = Convert.ToString(expense.case_id); Delete_client_id_txt_lbl.Text = Convert.ToString(expense.client_id); Delete_date_paid_txt_lbl.Text = Convert.ToString(expense.date_paid); Delete_expense_amt_paid_txt_lbl.Text = Convert.ToString(expense.expense_amt_paid); Delete_expense_amt_paid_to_txt_lbl.Text = Convert.ToString(expense.expense_amt_paid_to); return expense; }
public CostFormStub(expense dbItem) { DisplayFormatHelper dfh = new DisplayFormatHelper(); this.Id = dbItem.id; this.IdRent = dbItem.id_rent; this.CustomerName = dbItem.rent.customer.name; this.StartRent = dbItem.rent.start_rent.ToString(dfh.FullDateTimeFormat) + " s/d " + dbItem.rent.finish_rent.ToString(dfh.FullDateTimeFormat); this.Date = dbItem.date; this.RentCode = dbItem.rent.code; List <expense_item> expenseItemList = dbItem.expense_item.ToList(); }
public ActionResult Edit(ExpenseCreateVM model) { try { if (ModelState.IsValid) { expense exp = new expense() { id = model.id, name = model.name, description = model.description, expense_id = model.expense_id, date_expense = model.date_expense, register_date = DateTime.Now,//no se deberia modificar update_date = DateTime.Now, update_user_id = int.Parse(Session["UserID"].ToString()), amount_money = 0, activo = 1, selling_point = model.selling_point, tipo_comprobante_id = model.tipo_comprobante_id, nro_comprobante = model.nro_comprobante, cuit_cuil = model.cuit_cuil, nro_cuit_cuil = model.nro_cuit_cuil, denominacion_emisor = model.denominacion_emisor, imp_neto_gravado = model.imp_neto_gravado, imp_neto_no_gravado = model.imp_neto_no_gravado, imp_op_exentas = model.imp_op_exentas, iva = model.iva, importe_total = model.importe_total, proveedor_id = model.proveedor_id, periodo = model.periodo, pay_state = model.pay_state, pay_date = model.pay_date }; _repo.ExpenseUpdate(exp); return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("", "Se produjo un error, en caso de persistir, ponerse en contacto con el Administrador."); } ViewBagCreate(model.expense_id); ViewBagCreateTipoComprobante(model.tipo_comprobante_id); GetComboCC(); GetComboProv(); GetComboPeriodo(); return(View(model)); }
public IActionResult Post([FromBody] expense e) { try { db.Expenses.Add(e); db.SaveChanges(); return(StatusCode(StatusCodes.Status201Created)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex)); } }
//[Route("api/expense/add")] public IHttpActionResult AddExpense([FromBody] expense exp) { if (ModelState.IsValid) { dbContext.expenses.Add(exp); dbContext.SaveChanges(); return(Ok(exp)); } else { return(BadRequest()); } }
public expense expense_insert() { expense.case_id = Convert.ToInt32(Insert_case_id_txt.Text); expense.client_id = Convert.ToInt32(Insert_client_id_txt.Text); expense.date_paid = Convert.ToDateTime(Insert_date_paid_txt.Text); expense.expense_amt_paid = Convert.ToDecimal(Insert_expense_amt_paid_txt.Text); expense.expense_amt_paid_to = Insert_expense_amt_paid_to_txt.Text; expense = expense.Insert(expense); Insert_expense_GridView.DataBind(); Update_expense_GridView.DataBind(); Delete_expense_GridView.DataBind(); return(expense); }
public expense expense_insert() { expense.case_id = Convert.ToInt32(Insert_case_id_txt.Text); expense.client_id = Convert.ToInt32(Insert_client_id_txt.Text); expense.date_paid = Convert.ToDateTime(Insert_date_paid_txt.Text); expense.expense_amt_paid = Convert.ToDecimal(Insert_expense_amt_paid_txt.Text); expense.expense_amt_paid_to = Insert_expense_amt_paid_to_txt.Text; expense = expense.Insert(expense); Insert_expense_GridView.DataBind(); Update_expense_GridView.DataBind(); Delete_expense_GridView.DataBind(); return expense; }
public async Task <bool> UpdateExpenseAsync(expense expense) { _Context.expense.Attach(expense); _Context.Entry(expense).State = EntityState.Modified; try { return(await _Context.SaveChangesAsync() > 0 ? true : false); } catch (Exception exp) { _Logger.LogError($"Error in {nameof(UpdateExpenseAsync)}: " + exp.Message); } return(false); }
private void button1_Click(object sender, EventArgs e) { expense expData = new expense() { item = metroTextBox1.Text, price = metroTextBox1.Text, descripton = metroTextBox1.Text }; data.expenses.Add(expData); data.SaveChanges(); MessageBox.Show("Expense Submitted"); data_Load(); }
public List <SelectListItem> FillCategoryOption(expense dbItems) { List <SelectListItem> itemList = new List <SelectListItem>(); EnumHelper eh = new EnumHelper(); foreach (ExpenseItemCategory item in eh.EnumToList <ExpenseItemCategory>().ToList()) { int price = dbItems.expense_item.Where(x => x.id_expense == dbItems.id && x.category == item.ToString()).First().value; itemList.Add(new SelectListItem { Value = price.ToString(), Text = item.ToString() }); } return(itemList); }
public expense expense_update(int ID) { expense = expense.Select(ID); expense.expense_id = Convert.ToInt32(Update_expense_id_txt.Text); expense.case_id = Convert.ToInt32(Update_case_id_txt.Text); expense.client_id = Convert.ToInt32(Update_client_id_txt.Text); expense.date_paid = Convert.ToDateTime(Update_date_paid_txt.Text); expense.expense_amt_paid = Convert.ToDecimal(Update_expense_amt_paid_txt.Text); expense.expense_amt_paid_to = Update_expense_amt_paid_to_txt.Text; expense.Update(expense); Insert_expense_GridView.DataBind(); Update_expense_GridView.DataBind(); Delete_expense_GridView.DataBind(); return(expense); }
public expense expense_update(int ID) { expense = expense.Select(ID); expense.expense_id = Convert.ToInt32(Update_expense_id_txt.Text); expense.case_id = Convert.ToInt32(Update_case_id_txt.Text); expense.client_id = Convert.ToInt32(Update_client_id_txt.Text); expense.date_paid = Convert.ToDateTime(Update_date_paid_txt.Text); expense.expense_amt_paid = Convert.ToDecimal(Update_expense_amt_paid_txt.Text); expense.expense_amt_paid_to = Update_expense_amt_paid_to_txt.Text; expense.Update(expense); Insert_expense_GridView.DataBind(); Update_expense_GridView.DataBind(); Delete_expense_GridView.DataBind(); return expense; }
public void Save(expense dbItem) { if (dbItem.id == Guid.Empty) //create { dbItem.id = Guid.NewGuid(); context.expenses.Add(dbItem); } else //edit { var entry = context.Entry(dbItem); entry.State = EntityState.Modified; } context.SaveChanges(); }
public IActionResult ExpenseApproval([FromBody] expense n) { var existingExpense = db.Expenses.Where(s => s.ExpenseId == n.ExpenseId).FirstOrDefault <expense>(); if (existingExpense != null) { existingExpense.ExpenseStatus = n.ExpenseStatus; db.SaveChanges(); } else { return(NotFound()); } return(Ok()); }
private void button_Click(object sender, RoutedEventArgs e) { expense expense = new expense(); expense.amountSpecified = true; expense.amount = double.Parse(textBox_Copy1.Text); expense.expenseType = textBox.Text; expense.description = textBox_Copy.Text; expense.user = mainPage.CurrentUser; PartyCalculatorWebServiceWrapper.PartyCalculatorService.AddExpenseToWorkFlow(workflowId, expense); textBox_Copy1.Text = ""; textBox.Text = ""; textBox_Copy.Text = ""; mainPage.Navigate(typeof(AddExpense)); }
public ActionResult getImage(int id) { // expense exp = db.expenses.Find(id); expense exp = _repo.ExpenseFind(id); byte[] byteImage = exp.image; MemoryStream memoryStream = new MemoryStream(byteImage); System.Drawing.Image image = System.Drawing.Image.FromStream(memoryStream); memoryStream = new MemoryStream(); image.Save(memoryStream, ImageFormat.Jpeg); memoryStream.Position = 0; return(File(memoryStream, "image/jpg")); }
// GET: Users/Edit/5 public ActionResult Edit(long id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } expense exp = _repo.ExpenseGet(id); ExpenseCreateVM model = new ExpenseCreateVM() { id = exp.id, name = exp.name, description = exp.description, expense_id = exp.expense_id, date_expense = (DateTime)exp.date_expense, amount_money = exp.amount_money, selling_point = exp.selling_point, tipo_comprobante_id = exp.tipo_comprobante_id, nro_comprobante = exp.nro_comprobante, cuit_cuil = exp.cuit_cuil, nro_cuit_cuil = exp.nro_cuit_cuil, denominacion_emisor = exp.denominacion_emisor, imp_neto_gravado = exp.imp_neto_gravado, imp_neto_no_gravado = exp.imp_neto_no_gravado, imp_op_exentas = exp.imp_op_exentas, iva = exp.iva, importe_total = exp.importe_total, proveedor_id = exp.proveedor_id, periodo = exp.periodo, pay_state = exp.pay_state, pay_date = exp.pay_date }; if (exp == null) { return(HttpNotFound()); } ViewBagCreate(model.expense_id); ViewBagCreateTipoComprobante(model.tipo_comprobante_id); GetComboCC(); GetComboProv(); GetComboPeriodo(); return(View(model)); }
protected void INSERT(object sender, EventArgs e) { expense = expense_insert(); }
protected void UPDATE(object sender, EventArgs e) { expense = expense_update(Convert.ToInt32(Update_expense_GridView.SelectedValue)); }
protected void Update_Select_Record(object sender, EventArgs e) { expense = Update_expense_select(Convert.ToInt32(Update_expense_GridView.SelectedValue)); }
protected void Save_client_Expenses() { clientexpense.case_id = clientCase_intake.case_id; clientexpense.client_id = clientperson.person_id; foreach (GridViewRow rows in Gvpayment.Rows) { if (rows.Cells[1].Text != null && rows.Cells[1].Text != " ") { clientexpense.date_paid = Convert.ToDateTime(rows.Cells[1].Text); } else { clientexpense.date_paid = DateTime.Now; } if (rows.Cells[2].Text != null && rows.Cells[2].Text != " ") { clientexpense.expense_amt_paid = Convert.ToDecimal(rows.Cells[2].Text); } else { clientexpense.expense_amt_paid = 0; } if (rows.Cells[3].Text != null && rows.Cells[3].Text != " ") { clientexpense.expense_amt_paid_to = rows.Cells[3].Text; } else { clientexpense.expense_amt_paid_to = null; } if (rows.Cells[4].Text == null || rows.Cells[4].Text == " ") { clientexpense = clientexpense.Insert(clientexpense); } else { clientexpense.expense_id = Convert.ToInt32(rows.Cells[4].Text); clientexpense.Update(clientexpense); } } }