private void cmbLedgerCR_Leave(object sender, EventArgs e) { _entities = new MicroAccountsEntities1(); if (cmbLedgerCR.Text != string.Empty && cmbLedgerCR.SelectedIndex > 0) { var checkLedgername = _entities.tbl_AccLedger.Where(x => x.ledgerName == cmbLedgerCR.Text.Trim().ToString()).FirstOrDefault(); if (checkLedgername == null) { DialogResult myResult; myResult = MessageBox.Show("No such party exists. Want to create new party?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (myResult == DialogResult.OK) { AccountLedger ledger = new AccountLedger(0, cmbLedgerCR.Text.Trim().ToString()); ledger.ShowDialog(); cmbLedgerCR.Focus(); } else { cmbLedgerCR.Focus(); } } } }
public static BaseAccountLedgerModel ToBaseAccountLedger(this AccountLedger accountLedger) { BaseAccountLedgerModel _result = new BaseAccountLedgerModel(); _result.Id = accountLedger.Id; _result.AccountGroupId = accountLedger.AccountGroupId; _result.PricingLevelId = accountLedger.PricingLevelId; _result.AreaId = accountLedger.AreaId; _result.RouteId = accountLedger.RouteId; _result.LedgerName = accountLedger.LedgerName; _result.OpeningBalance = accountLedger.OpeningBalance; _result.IsDefault = accountLedger.IsDefault; _result.CrOrDr = accountLedger.CrOrDr; _result.AffectGrossProfit = accountLedger.AffectGrossProfit; _result.MailingName = accountLedger.MailingName; _result.Narration = accountLedger.Narration; _result.Address = accountLedger.Address; _result.Phone = accountLedger.Phone; _result.Mobile = accountLedger.Mobile; _result.Email = accountLedger.Email; _result.CreditPeriod = accountLedger.CreditPeriod; _result.CreditLimit = accountLedger.CreditLimit; _result.BillByBill = accountLedger.BillByBill; _result.TIN = accountLedger.TIN; _result.CST = accountLedger.CST; _result.PAN = accountLedger.PAN; _result.BankAccountNumber = accountLedger.BankAccountNumber; _result.BranchName = accountLedger.BranchName; _result.BranchCode = accountLedger.BranchCode; _result.CreatedDate = accountLedger.CreatedDate; _result.ModifiedDate = accountLedger.ModifiedDate; return(_result); }
private void btnCreate_Click(object sender, EventArgs e) { AccountLedger acc = new AccountLedger(0, ""); acc.ShowDialog(); dataGridBind(); }
public ActionResult Create(AccountLedger category) { var result = category; if (ModelState.IsValid) { category.IsDefault = false; result = service.Save(category); if (result != null && result.Id > 0) { LedgerPosting post = new LedgerPosting(); post.InvoiceNo = ""; post.LedgerId = result.Id; post.PostingDate = DateTime.Now; if (category.CrOrDr == "Cr") { post.Credit = category.OpeningBalance; } if (category.CrOrDr == "Dr") { post.Debit = category.OpeningBalance; } post.VoucherTypeId = 1; post.VoucherNo = category.Id.ToString(); post.InvoiceNo = category.Id.ToString(); var postingResult = postingService.Save(post); } } return(Json("Sucess", JsonRequestBehavior.AllowGet)); }
public ActionResult Create(Employee employee) { var result = employee; if (ModelState.IsValid) { employee.CreationDate = DateTime.Now; employee.Creator = CurrentSession.GetCurrentSession().UserName; employee.IsActive = true; employee.Photo = ImageViewModel.bufferByte; AccountLedger ledger = new AccountLedger(); ledger.AccountGroupId = 1; ledger.Address = employee.Address; ledger.BankAccountNumber = ""; ledger.BillByBill = true; ledger.BranchCode = ""; ledger.BranchName = ""; ledger.CreditLimit = 0.0m; ledger.CreditPeriod = 1; ledger.CrOrDr = "Dr"; ledger.Email = employee.Email; ledger.IsDefault = false; ledger.LedgerName = employee.Code + "-" + employee.FirstName; ledger.Mobile = employee.Phone; ledger.OpeningBalance = 0.0m; // var saved = Accounts.Save(ledger); // employee.LedgerId = saved.Id; result = db.Save(employee); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult GetById(int Id) { AccountLedger group = this.service.GetById(Id); var expenses = Mapper.Map <AccountLedger, AccountLedgerResponse>(group); return(Json(expenses, 0)); }
public async Task <Account> GetAccountAsync(int id, DateTimeOffset startDate, DateTimeOffset endDate) { Account account; IEnumerable <dto.Tags> tags = new dto.Tags[0]; IEnumerable <AccountLedger> accountLedgers = new AccountLedger[0]; using (var transactionHelper = this._repositoryService.GetTransactionHelper()) { var tagsRepository = this._repositoryService.GetTagsRepository(transactionHelper); tags = (await tagsRepository.GetTagsForAccountAsync(id)).ToList(); } using (var transactionHelper = this._repositoryService.GetTransactionHelper()) { var accountRepository = this._repositoryService.GetAccountRepository(transactionHelper); account = new model.Account(await accountRepository.GetAccountAsync(id)); } using (var transactionHelper = this._repositoryService.GetTransactionHelper()) { var accountLedgerRepository = this._repositoryService.GetAccountLedgerRepository(transactionHelper); accountLedgers = (await accountLedgerRepository.GetEntriesBetweenDatesAsync(id, startDate, endDate)).Select(e => new AccountLedger(e, id)).ToList(); } account.Tags = tags; account.LedgerEntries = accountLedgers; return(account); }
public async Task <Account> GetAccountAsync(int id, int numEntries = 1000) { Account account; IEnumerable <dto.Tags> tags = new dto.Tags[0]; IEnumerable <AccountLedger> accountLedgers = new AccountLedger[0]; using (var transactionHelper = this._repositoryService.GetTransactionHelper()) { var tagsRepository = this._repositoryService.GetTagsRepository(transactionHelper); tags = (await tagsRepository.GetTagsForAccountAsync(id)).ToList(); } using (var transactionHelper = this._repositoryService.GetTransactionHelper()) { var accountRepository = this._repositoryService.GetAccountRepository(transactionHelper); account = new Account(await accountRepository.GetAccountAsync(id)); } if (numEntries > 0) { using (var transactionHelper = this._repositoryService.GetTransactionHelper()) { var accountLedgerRepository = this._repositoryService.GetAccountLedgerRepository(transactionHelper); accountLedgers = (await accountLedgerRepository.GetLastNumEntriesAsync(id, numEntries)).Select(e => new AccountLedger(e, id)).ToList(); } } account.Tags = tags; account.LedgerEntries = accountLedgers; return(account); }
public static AccountLedger GetAccountLedgerByID(int accountLedgerID) { DataRow AccountLedgerRow = AccountLedgerDataAccess.GetInstance.GetAccountLedgerByID(accountLedgerID); AccountLedger TheAccountLedger = DataRowToObject(AccountLedgerRow); return(TheAccountLedger); }
public ActionResult PaymentDelete(int id) { ActionResult actionResult; try { LedgerPosting postingObj = this.postingService.GetById(new int?(id)); foreach (LedgerPosting item in this.postingService.GetAll(postingObj.VoucherNo, true)) { item.IsActive = false; this.postingService.Update(item, item.Id); } PartyBalanceService partyBalanceService = this.partyBalanceService; int? ledgerId = postingObj.LedgerId; PartyBalance paymentObj = partyBalanceService.GetByVoucher((ledgerId.HasValue ? ledgerId.GetValueOrDefault() : 0), postingObj.VoucherNo); this.partyBalanceService.Delete(paymentObj.PartyBalanceId); AccountLedger customer = this.accledgerService.GetById(postingObj.LedgerId); CustomerService customerService = new CustomerService(); ledgerId = postingObj.LedgerId; rptIndividualLedger_Result due = customerService.GetBalance((ledgerId.HasValue ? ledgerId.GetValueOrDefault() : 0)); string balanceText = ""; decimal?balance = due.Balance; decimal num = new decimal(); if ((balance.GetValueOrDefault() < num ? !balance.HasValue : true)) { balance = due.Balance; balanceText = string.Concat("Balance with Dada Rice Tk=", string.Format("{0:#,#.}", decimal.Round((balance.HasValue ? balance.GetValueOrDefault() : decimal.Zero)), ""), "="); } else { decimal minusOne = decimal.MinusOne; balance = due.Balance; balanceText = string.Concat("Balance with Dada Rice Tk=", string.Format("{0:#,#.}", minusOne * decimal.Round((balance.HasValue ? balance.GetValueOrDefault() : decimal.Zero)), ""), "="); } var isSendSMS = false; if (isSendSMS) { SMSEmailService sMSEmailService = new SMSEmailService(); string[] ledgerName = new string[] { "Dear ", customer.LedgerName, ",Tk=", null, null, null, null, null, null }; balance = postingObj.Credit; ledgerName[3] = string.Format("{0:#,#.}", decimal.Round((balance.HasValue ? balance.GetValueOrDefault() : decimal.Zero)), ""); ledgerName[4] = " payment was wrong posted. Your Ref No:"; ledgerName[5] = postingObj.VoucherNo; ledgerName[6] = " has been deleted,"; ledgerName[7] = balanceText; ledgerName[8] = " Dada Rice."; sMSEmailService.SendOneToOneSingleSms("01739110321", string.Concat(ledgerName)); } actionResult = base.Json("Sucess", 0); } catch (Exception exception) { actionResult = base.Json(exception.Message, 0); } return(actionResult); }
private void dgCustomerDetails_DoubleClick(object sender, EventArgs e) { if (dgCustomerDetails.CurrentRow.Index != -1) { var lID = Convert.ToInt32(dgCustomerDetails.CurrentRow.Cells[0].Value); AccountLedger acc = new AccountLedger(lID, ""); acc.ShowDialog(); } }
public IActionResult Create(AccountLedgerViewModel viewModel) { // Check for valid FiscalYearId if (_fiscalYearData.GetFiscalYearById(viewModel.FiscalYearId) == null) { ModelState.AddModelError("FiscalYearId", $"Fiscal Year does not exist."); } // Check for valid AccountId if (_accountData.GetAccountById(viewModel.AccountId) == null) { ModelState.AddModelError("AccountId", $"Account ID does not exist."); } // Check to see if ledger already exists if (_accountLedgerData .GetAccountLedger(viewModel.FiscalYearId, viewModel.AccountId, viewModel.LedgerNo) != null) { ModelState.AddModelError("", $"ERROR: A ledger with the Fiscal Year ID, Account ID, and Ledger Number you specified already exists."); } if (ModelState.IsValid) { var accountLedger = new AccountLedger { FiscalYearId = viewModel.FiscalYearId, AccountId = viewModel.AccountId, LedgerNo = viewModel.LedgerNo, Ledger = viewModel.Ledger, UserId = viewModel.UserId, Remarks = viewModel.Remarks }; try { _accountLedgerData.AddAccountLedger(accountLedger); _accountLedgerData.Save(); } catch (Exception e) { // TODO: Log this exception ModelState.AddModelError(string.Empty, $"ERROR: Unable to save data. Please review your input and try again."); ViewData["FiscalYearId"] = new SelectList(_fiscalYearData.GetFiscalYears(), "FiscalYearId", "YearDescription", viewModel.FiscalYearId); return(View(viewModel)); } return(RedirectToAction(nameof(Index))); } ViewData["FiscalYearId"] = new SelectList(_fiscalYearData.GetFiscalYears(), "FiscalYearId", "YearDescription", viewModel.FiscalYearId); return(View(viewModel)); }
public static AccountLedger DataRowToObject(DataRow dr) { AccountLedger TheAccountLedger = new AccountLedger(); TheAccountLedger.AccountLedgerID = int.Parse(dr["AccountLedgerID"].ToString()); TheAccountLedger.AccountLedgerDescription = (dr["AccountLedgerDescription"].ToString()); TheAccountLedger.AccountLedgerAlias = (dr["AccountLedgerAlias"].ToString()); TheAccountLedger.AccountGroupID = int.Parse(dr["AccountGroupID"].ToString()); TheAccountLedger.AccountGroupDescription = (dr["AccountGroupDescription"].ToString()); return(TheAccountLedger); }
public AccountLedger Save(AccountLedger cus) { var isExists = service.GetAll().Where(a => a.AccountGroupId == cus.AccountGroupId && a.LedgerName == cus.LedgerName).FirstOrDefault(); var max = service.LastRow().OrderByDescending(a => a.Id).FirstOrDefault().Id; cus.Id = max + 1; cus.OrderNo = cus.Id + 1; if (isExists != null) { return(isExists); } service.Save(cus); return(cus); }
public static List <AccountLedger> GetAccountLedgerList(String searchText) { List <AccountLedger> AccountLedgerList = new List <AccountLedger>(); DataTable AccountLedgerTable = new DataTable(); AccountLedgerTable = AccountLedgerDataAccess.GetInstance.GetAccountLedgerList(searchText); foreach (DataRow dr in AccountLedgerTable.Rows) { AccountLedger TheAccountLedger = DataRowToObject(dr); AccountLedgerList.Add(TheAccountLedger); } return(AccountLedgerList); }
public IActionResult Create(AccountLedger accountLedger) { if (ModelState.IsValid) { _work.AccountLedger.Add(accountLedger); bool isSaved = _work.Save() > 0; if (isSaved) { return(Json(true)); } } return(Json(false)); }
public static List <AccountLedger> GetBankLedgerList(bool allOffices = false, bool showDeleted = false) { List <AccountLedger> AccountLedgerList = new List <AccountLedger>(); DataTable AccountLedgerTable = new DataTable(); AccountLedgerTable = AccountLedgerDataAccess.GetInstance.GetBankLedgerList(allOffices, showDeleted); foreach (DataRow dr in AccountLedgerTable.Rows) { AccountLedger TheAccountLedger = DataRowToObject(dr); AccountLedgerList.Add(TheAccountLedger); } return(AccountLedgerList); }
public int DeleteAccountLedger(AccountLedger theAccountLedger) { int ReturnValue = 0; SqlCommand DeleteCommand = new SqlCommand(); DeleteCommand.CommandType = CommandType.StoredProcedure; DeleteCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; DeleteCommand.Parameters.Add(GetParameter("@AccountLedgerID", SqlDbType.Int, theAccountLedger.AccountLedgerID)); DeleteCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); DeleteCommand.CommandText = "pFIN_AccountLedgers_Delete"; ExecuteStoredProcedure(DeleteCommand); ReturnValue = int.Parse(DeleteCommand.Parameters[0].Value.ToString()); return(ReturnValue); }
private void dgLedgerDetails_DoubleClick(object sender, EventArgs e) { try { if (dgLedgerDetails.CurrentRow.Index != -1 && dgLedgerDetails.CurrentRow.Cells[1].Value != null) { var lID = Convert.ToInt32(dgLedgerDetails.CurrentRow.Cells[0].Value); AccountLedger acc = new AccountLedger(lID, ""); acc.ShowDialog(); dataGridBind(); } } catch (Exception x) { MessageBox.Show("Something went wrong. Contact your system administrator"); } }
private void dgLedgerDetails_DoubleClick(object sender, EventArgs e) { try { if (dgLedgerDetails.CurrentRow.Index != -1 && dgLedgerDetails.CurrentRow.Cells[1].Value != null) { var lID = Convert.ToInt32(dgLedgerDetails.CurrentRow.Cells[0].Value); AccountLedger acc = new AccountLedger(lID, ""); acc.ShowDialog(); dataGridBind(); } } catch (Exception x) { MessageBox.Show(x.ToString()); } }
public int InsertAccountLedger(AccountLedger theAccountLedger) { int ReturnValue = 0; SqlCommand InsertCommand = new SqlCommand(); InsertCommand.CommandType = CommandType.StoredProcedure; InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; InsertCommand.Parameters.Add(GetParameter("@AccountLedgerDescription", SqlDbType.VarChar, theAccountLedger.AccountLedgerDescription)); InsertCommand.Parameters.Add(GetParameter("@AccountLedgerAlias", SqlDbType.VarChar, theAccountLedger.AccountLedgerAlias)); InsertCommand.Parameters.Add(GetParameter("@AccountGroupID", SqlDbType.Int, theAccountLedger.AccountGroupID)); InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); InsertCommand.CommandText = "pFIN_AccountLedgers_Insert"; ExecuteStoredProcedure(InsertCommand); ReturnValue = int.Parse(InsertCommand.Parameters[0].Value.ToString()); return(ReturnValue); }
public IActionResult Edit(AccountLedger ledger) { if (ModelState.IsValid) { var accountLedger = _work.AccountLedger.Get(ledger.Id); accountLedger.AccountLedgerName = ledger.AccountLedgerName; accountLedger.TrackingId = ledger.TrackingId; _work.AccountLedger.Update(accountLedger); bool isSaved = _work.Save() > 0; if (isSaved) { return(Json(true)); } } return(PartialView("_AccountLedgerEditView")); }
private void txtLedgerName_Leave(object sender, EventArgs e) { try { _entities = new MicroAccountsEntities1(); if (txtLedgerName.Text != string.Empty) { var checkLedgername = _entities.tbl_AccLedger.Where(x => x.ledgerName == txtLedgerName.Text.Trim().ToString()).FirstOrDefault(); if (checkLedgername == null) { DialogResult myResult; myResult = MessageBox.Show("No such party exists. Want to create new party?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (myResult == DialogResult.OK) { AccountLedger ledger = new AccountLedger(0, txtLedgerName.Text.Trim().ToString()); ledger.ShowDialog(); ledgerNameAutoComplete(); txtLedgerName.Focus(); } else { txtLedgerName.Focus(); } } decimal drLedgerId = Convert.ToDecimal(checkLedgername.Id); CrDrDifference crdrDiff = new CrDrDifference(); string valueAmt = crdrDiff.DifferenceCrDr(Convert.ToInt32(drLedgerId), 0); lblBalance.Text = valueAmt; } } catch (Exception x) { } }
public ActionResult Create(Customer customer, int create, AccountLedger accountLedger) { var result = customer; var resultAccountLedger = accountLedger; resultAccountLedger = dbAccountLedgerService.Save(accountLedger); if (ModelState.IsValid) { var sesssion = CurrentSession.GetCurrentSession(); if (sesssion != null) { } customer.CreatedDate = DateTime.Now; customer.UpdatedDate = DateTime.Now; customer.CreatedBy = CurrentSession.GetCurrentSession().UserName; customer.LedgerId = resultAccountLedger.Id; customer.IsActive = true; result = db.Save(customer); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public AccountLedger AddAccountLedger(AccountLedger newAccountLedger) { _database.AccountsLedgers.Add(newAccountLedger); return(newAccountLedger); }
public ActionResult Create(Supplier supplier, decimal OpeningBalance, string CrOrDr, int create) { try { var result = supplier; if (ModelState.IsValid) { supplier.CreationDate = DateTime.Now; supplier.UpdateDate = DateTime.Now; supplier.Creator = CurrentSession.GetCurrentSession().UserName; supplier.IsActive = true; AccountLedger ledger = new AccountLedger(); var accountGroup = new AccountGroupService().GetById(22); //sundry creditor ledger.AccountGroupId = 22; ledger.Address = supplier.Address; ledger.BankAccountNumber = ""; ledger.BillByBill = true; ledger.BranchCode = ""; ledger.BranchName = ""; ledger.CreditLimit = 0.0m; ledger.CreditPeriod = 1; ledger.CrOrDr = Accounts.CheckDrOrCr(accountGroup.Nature); ledger.Email = supplier.Email; ledger.IsDefault = false; ledger.LedgerName = supplier.Name; ledger.Extra2 = supplier.Code; ledger.Mobile = supplier.ContactPersonPhone; ledger.Phone = supplier.Phone; ledger.OpeningBalance = OpeningBalance; var saved = Accounts.Save(ledger); supplier.LedgerId = saved.Id; result = db.Save(supplier); if (ledger.OpeningBalance > 0.0m) { var party = new PartyBalance(); LedgerPosting post = new LedgerPosting(); post.InvoiceNo = ""; post.LedgerId = supplier.LedgerId; post.PostingDate = DateTime.Now; if (CrOrDr == "Cr") { post.Credit = ledger.OpeningBalance; party.Credit = ledger.OpeningBalance; } if (CrOrDr == "Dr") { party.Debit = ledger.OpeningBalance; post.Debit = ledger.OpeningBalance; } post.VoucherTypeId = 1; post.VoucherNo = ledger.Id.ToString(); post.InvoiceNo = ledger.Id.ToString(); var postingResult = postingService.Save(post); party.AgainstInvoiceNo = postingResult.Id.ToString(); party.LedgerId = supplier.LedgerId ?? 0; party.CreditPeriod = 60; party.FinancialYearId = CurrentSession.GetCurrentSession().FinancialYear; party.PostingDate = DateTime.Now; party.VoucherTypeId = 1; party.extra1 = "Opening Balance"; partyBalanceService.Save(party); } } return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex, JsonRequestBehavior.AllowGet)); } }
public AccountLedger UpdateAccountLedger(AccountLedger updatedAccountLedger) { _db.AccountsLedgers.Update(updatedAccountLedger); return(updatedAccountLedger); }
public ActionResult Create(EmployeeRequest request) { if (ModelState.IsValid) { //var file = request.imageView.ImageFile; //if (file != null) //{ // //file.SaveAs(Server.MapPath("/UploadEmployeeImage" + file.FileName)); // BinaryReader reader = new BinaryReader(file.InputStream); // ImageByte = reader.ReadBytes(file.ContentLength); // employee.Photo = ImageByte; //} var package = _packageService.GetById(request.SalaryPackage); if (!string.IsNullOrEmpty(request.Photo)) { request.Photo = UtilClass.SaveImage(request.Photo, request.MimeType); } AccountLedger ledger = new AccountLedger(); ledger.AccountGroupId = 1; ledger.Address = request.Address; ledger.BankAccountNumber = ""; ledger.BillByBill = true; ledger.BranchCode = ""; ledger.BranchName = ""; ledger.CreditLimit = 0.0m; ledger.CreditPeriod = 1; ledger.CrOrDr = "Dr"; ledger.Email = request.Email; ledger.IsDefault = false; ledger.LedgerName = request.Code + "-" + request.FirstName; ledger.Mobile = request.Phone; ledger.OpeningBalance = 0.0m; var saved = Accounts.Save(ledger); var employee = new Employee() { CreationDate = DateTime.Now, Creator = CurrentSession.GetCurrentSession().UserName, IsActive = true, Code = request.Code, Address = request.Address, City = request.City, Email = request.Email, FatherName = request.FatherName, FirstName = request.FirstName, LastName = request.LastName, MotherName = request.MotherName, Phone = request.Phone, Remarks = request.Remarks, Salary = package.TotalAmount ?? 0, ZipCode = request.ZipCode, LedgerId = saved.Id, DepartmentId = request.DepartmentId, DesignationId = request.DesignationId, BloodGroup = request.BloodGroup, DOB = request.DOB, EmployeeType = request.EmployeeType, Gender = request.Gender, JoiningDate = request.JoiningDate, Photo = request.Photo, Qualification = request.Qualification, SalaryPackage = request.SalaryPackage, TerminationDate = request.TerminationDate, ShiftId = request.ShiftId //,SalaryType=request.SalaryType }; var res = db.Save(employee); return(Json(new { Id = res.Id }, JsonRequestBehavior.AllowGet)); } return(Json("Failed", JsonRequestBehavior.AllowGet)); }
public static int DeleteAccountLedger(AccountLedger theAccountLedger) { return(AccountLedgerDataAccess.GetInstance.DeleteAccountLedger(theAccountLedger)); }
public AccountLedger Update(AccountLedger t, int id) { return(service.Update(t, id)); }