예제 #1
0
        public ActionResult Ledger(GeneralVoucherPostingViewModel model)
        {
            bool status = false;

            if (!ModelState.IsValid)
            {
                FlashMessage.Danger(ModelState.Values.ToString());
                return(RedirectToAction("Ledger", "Accounting"));
            }
            if (model == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            else
            {
                GeneralVoucherPosting Obj = new GeneralVoucherPosting();
                Obj.Amount       = model.Amount;
                Obj.Notes        = model.Notes;
                Obj.LedgerHeadId = model.GeneralLedgerHeadId;
                Obj.UserID       = User.Identity.GetUserId();
                Obj.LedgerDate   = model.LedgerDate;
                status           = new AccountingDA().InsertGeneralVoucherPosting(Obj);
                if (status)
                {
                    FlashMessage.Confirmation("New Ledger Posted");
                }
                else
                {
                    FlashMessage.Danger("Some error occured!!");
                }
                return(RedirectToAction("Ledger", "Accounting"));
            }
        }
        public ActionResult Index()
        {
            List <InvoiceListViewModel> ilObj     = new SearchDA().GetLatestInvoiceList();
            List <FloatChequeViewModel> fcObj     = new AccountingDA().GetFloatingChequeList(1);
            List <FloatChequeViewModel> bfcObj    = new AccountingDA().GetBulkFloatingChequeList(1);
            List <InvoiceListViewModel> lstLstObj = new SearchDA().GetDraftInvoiceList();
            HomeViewModel model = new HomeViewModel();

            model.InvoiceList         = ilObj.Take(10).ToList();
            model.DraftList           = lstLstObj.Take(10).ToList();
            model.FloatingCheques     = fcObj.Take(10).ToList();
            model.BulkFloatingCheques = bfcObj.Take(10).ToList();
            ViewBag.AgentList         = new SelectList(db.Agents.Where(a => a.ProfileType == ProfileType.Agent).OrderBy(a => a.Name).ToList(), "Id", "Name");
            ViewBag.UserList          = new SelectList(db.Users.OrderBy(x => x.PersonName).ToList(), "Id", "PersonName");
            return(View(model));
        }
예제 #3
0
 public ActionResult LedgerList(string type)
 {
     if (type == "Income")
     {
         List <GeneralLedgerListViewModel> model = new AccountingDA().GetGeneralLedgerList(1);
         ViewBag._LedgerHead = new SelectList(db.GeneralLeaderHeads, "Id", "GeneralLedgerHeadName");
         ViewBag.Type        = "Income";
         return(View(model));
     }
     else
     {
         List <GeneralLedgerListViewModel> model = new AccountingDA().GetGeneralLedgerList(2);
         ViewBag._LedgerHead = new SelectList(db.GeneralLeaderHeads, "Id", "GeneralLedgerHeadName");
         ViewBag.Type        = "Expense";
         return(View(model));
     }
 }
예제 #4
0
        public ActionResult FloatingCheque()
        {
            List <FloatChequeViewModel> model = new AccountingDA().GetFloatingChequeList((int)ChequeStatus.Floating);

            return(View(model));
        }
예제 #5
0
        public PartialViewResult FilterLedgerList(string FromDate, string ToDate, int?LedgerHead, int?PaymentMethod, int?StatementType)
        {
            List <GeneralLedgerListViewModel> model = new List <GeneralLedgerListViewModel>();
            string locFromDate      = string.Empty;
            string locToDate        = string.Empty;
            string locLedgerHead    = string.Empty;
            string locPaymentMethod = string.Empty;
            string locStatementType = string.Empty;

            if (!string.IsNullOrEmpty(FromDate))
            {
                if (string.IsNullOrEmpty(ToDate) && LedgerHead == null && PaymentMethod == null)
                {
                    locFromDate = String.Format("WHERE CONVERT(varchar(10), [dbo].[GeneralLedgers].SysDateTime, 101) >= CONVERT(varchar(10), '{0}', 101)", FromDate);
                }
                else
                {
                    locFromDate = String.Format("WHERE CONVERT(varchar(10), [dbo].[GeneralLedgers].SysDateTime, 101) >= CONVERT(varchar(10), '{0}', 101) AND ", FromDate);
                }
            }
            if (!string.IsNullOrEmpty(ToDate))
            {
                if (LedgerHead == null && PaymentMethod == null)
                {
                    if (string.IsNullOrEmpty(locFromDate))
                    {
                        locToDate = String.Format("WHERE CONVERT(varchar(10), [dbo].[GeneralLedgers].SysDateTime, 101) <= CONVERT(varchar(10), '{0}', 101) ", ToDate);
                    }
                    else
                    {
                        locToDate = String.Format("CONVERT(varchar(10), [dbo].[GeneralLedgers].SysDateTime, 101) <= CONVERT(varchar(10), '{0}', 101) ", ToDate);
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(locFromDate))
                    {
                        locToDate = String.Format("WHERE CONVERT(varchar(10), [dbo].[GeneralLedgers].SysDateTime, 101) <= CONVERT(varchar(10), '{0}', 101) ", ToDate);
                    }
                    else
                    {
                        locToDate = String.Format("CONVERT(varchar(10), [dbo].[GeneralLedgers].SysDateTime, 101) <= CONVERT(varchar(10), '{0}', 101) AND ", ToDate);
                    }
                }
            }
            if (LedgerHead != null)
            {
                if (PaymentMethod == null)
                {
                    if (string.IsNullOrEmpty(locFromDate) && string.IsNullOrEmpty(locToDate))
                    {
                        locLedgerHead = String.Format("WHERE [dbo].[GeneralLedgers].GeneralLedgerHeadId = {0} ", LedgerHead);
                    }
                    else
                    {
                        locLedgerHead = String.Format("[dbo].[GeneralLedgers].GeneralLedgerHeadId = {0} ", LedgerHead);
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(locFromDate) && string.IsNullOrEmpty(locToDate))
                    {
                        locLedgerHead = String.Format("WHERE [dbo].[GeneralLedgers].GeneralLedgerHeadId = {0} AND ", LedgerHead);
                    }
                    else
                    {
                        locLedgerHead = String.Format("[dbo].[GeneralLedgers].GeneralLedgerHeadId = {0} AND ", LedgerHead);
                    }
                }
            }
            if (PaymentMethod != null)
            {
                if (string.IsNullOrEmpty(locFromDate) && string.IsNullOrEmpty(locToDate) && locLedgerHead == null)
                {
                    locPaymentMethod = String.Format("WHERE [dbo].[GeneralLedgers].PaymentMethods = {0} ", PaymentMethod);
                }
                else
                {
                    locPaymentMethod = String.Format("[dbo].[GeneralLedgers].PaymentMethods = {0} ", PaymentMethod);
                }
            }
            if (string.IsNullOrEmpty(locFromDate) && string.IsNullOrEmpty(locToDate) && locLedgerHead == null && locPaymentMethod == null)
            {
                locStatementType = String.Format("WHERE [dbo].[GeneralLedgers].StatementTypes = {0} ", StatementType);
            }
            else
            {
                locStatementType = String.Format("[dbo].[GeneralLedgers].StatementTypes = {0} ", StatementType);
            }

            string Query = String.Format("USE [TravelBilling] GO SELECT FORMAT([dbo].[GeneralLedgers].[SysDateTime], N'yyyy-MM-dd') AS LedgerDate, [dbo].[AspNetUsers].PersonName AS UserName, [dbo].[GeneralLedgerHeads].GeneralLedgerHeadName AS LedgerHead, [dbo].[GeneralLedgers].PaymentMethods AS PaymentMethod, [dbo].[GeneralLedgers].Notes AS Notes, (CASE WHEN[dbo].[GeneralLedgers].GeneralLedgerType = 1 THEN 'Debit' WHEN[dbo].[GeneralLedgers].GeneralLedgerType = 2 THEN 'Credit' END) AS LedgerType, [dbo].[GeneralLedgers].Amount AS Amount FROM[dbo].[GeneralLedgers] INNER JOIN[dbo].[AspNetUsers] ON[dbo].[GeneralLedgers].ApplicationUserId = [dbo].[AspNetUsers].Id INNER JOIN[dbo].[GeneralLedgerHeads] ON[dbo].[GeneralLedgers].GeneralLedgerHeadId = [dbo].[GeneralLedgerHeads].Id {0} {1} {2} {3} {4} ORDER BY[dbo].[GeneralLedgers].SysDateTime DESC END", locFromDate, locToDate, locLedgerHead, locPaymentMethod, locStatementType);

            model = new AccountingDA().FilterGeneralLedgerList(Query);
            return(PartialView("LedgerListPartial", model));
        }