public ActionResult TrailBalanceDetails(DateTime fromDate, DateTime toDate, int groupId) { LedgerPostingService ledgerPosting = new LedgerPostingService(); var res = ledgerPosting.TrailBalanceDetails(fromDate, toDate, groupId); return(Json(res, JsonRequestBehavior.AllowGet)); }
public ActionResult GetIncomeStatement(DateTime fromDate, DateTime toDate) { LedgerPostingService ledgerPosting = new LedgerPostingService(); ledgerPosting.GetIncomeStatement(fromDate, toDate); return(Json("")); }
public ActionResult TrailBalanceSheet(DateTime fromDate, DateTime toDate) { LedgerPostingService ledgerPosting = new LedgerPostingService(); var res = ledgerPosting.TrailBalance(fromDate, toDate); return(Json(res, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(Supplier model, decimal OpeningBalance, string CrOrDr, int create) { if (model == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Supplier supplier = db.GetById(model.Id); if (supplier == null) { return(HttpNotFound()); } supplier.Address = model.Address; supplier.City = model.City; supplier.Code = model.Code; supplier.Name = model.Name; supplier.Phone = model.Phone; supplier.ContactPersonName = model.ContactPersonName; supplier.ContactPersonPhone = model.ContactPersonPhone; supplier.Email = model.Email; supplier.IsActive = true; supplier.UpdateDate = DateTime.Now; supplier.UpdateBy = CurrentSession.GetCurrentSession().UserName; db.Update(supplier, model.Id); //account ledger update AccountLedger ledger = new AccountLedgerService().GetById(supplier.LedgerId); ledger.Address = supplier.Address; ledger.BankAccountNumber = ""; ledger.BillByBill = true; ledger.BranchCode = ""; ledger.BranchName = ""; ledger.CreditLimit = 0.0m; ledger.CreditPeriod = 1; 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.Update(ledger, supplier.LedgerId ?? 0); if (OpeningBalance > 0.0m) { var party = new PartyBalanceService().GetAll().Where(a => a.VoucherTypeId == 1 && a.LedgerId == supplier.LedgerId).FirstOrDefault(); LedgerPosting post = new LedgerPostingService().GetAll().Where(a => a.VoucherTypeId == 1 && a.LedgerId == supplier.LedgerId).FirstOrDefault(); if (post == null) { if (party == null) { party = new PartyBalance(); } post = new LedgerPosting(); 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(); } else { if (party == null) { party = new PartyBalance(); } if (CrOrDr == "Cr") { post.Credit = ledger.OpeningBalance; party.Credit = ledger.OpeningBalance; } if (CrOrDr == "Dr") { party.Debit = ledger.OpeningBalance; post.Debit = ledger.OpeningBalance; } postingService.Update(post, post.Id); } if (party == null || party.PartyBalanceId == 0) { party = new PartyBalance(); if (CrOrDr == "Cr") { post.Credit = ledger.OpeningBalance; party.Credit = ledger.OpeningBalance; } if (CrOrDr == "Dr") { party.Debit = ledger.OpeningBalance; post.Debit = ledger.OpeningBalance; } 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); } else { if (CrOrDr == "Cr") { post.Credit = ledger.OpeningBalance; party.Credit = ledger.OpeningBalance; } if (CrOrDr == "Dr") { party.Debit = ledger.OpeningBalance; post.Debit = ledger.OpeningBalance; } party.PostingDate = DateTime.Now; party.Balance = party.Balance + OpeningBalance; partyBalanceService.Update(party, party.PartyBalanceId); } } return(Json("Updated", JsonRequestBehavior.AllowGet)); //return View(); }