public ActionResult BankOperation(BankOperation bankOperation, string errMsg)
        {
            if (bankOperation.bankAccode == null)
            {
                bankOperation.bankAccode = Session["BankAccode"].ToString();
                var bankInfo = _newChartService.All().ToList().FirstOrDefault(x => x.Accode == bankOperation.bankAccode);
                ViewBag.bankAccode    = bankInfo.AcName;
                Session["BankAccode"] = bankInfo.Accode;
            }
            else
            {
                var bankInfo = _newChartService.All().ToList().FirstOrDefault(x => x.Accode == bankOperation.bankAccode);
                ViewBag.bankAccode    = bankInfo.AcName;
                Session["BankAccode"] = bankInfo.Accode;
            }
            List <NewChart> charts = _newChartService.All().ToList().Where(x => x.Accode.Substring(0, 1) == "1" || x.Accode.Substring(0, 1) == "3" || x.Accode.Substring(0, 1) == "2").ToList();
            // List<NewChart> charts = _newChartService.All().ToList().Where(x => x.Accode.Substring(0, 1) == "3").ToList();
            List <NewChart> finalList = new List <NewChart>();

            foreach (var chart in charts)
            {
                bool key = true;
                foreach (var temp in charts)
                {
                    if (chart == temp)
                    {
                    }
                    else
                    {
                        if (chart.Accode == temp.ParentAcCode)
                        {
                            key = false;
                        }
                    }
                }
                if (key)
                {
                    finalList.Add(chart);
                }
            }
            ViewBag.brPurAccode = new SelectList(finalList, "Accode", "AcName");

            List <NewChart> echarts    = _newChartService.All().ToList().Where(x => x.Accode.Substring(0, 1) == "1" || x.Accode.Substring(0, 1) == "2" || x.Accode.Substring(0, 1) == "4").ToList();
            List <NewChart> efinalList = new List <NewChart>();

            foreach (var chart in echarts)
            {
                bool key = true;
                foreach (var temp in echarts)
                {
                    if (chart == temp)
                    {
                    }
                    else
                    {
                        if (chart.Accode == temp.ParentAcCode)
                        {
                            key = false;
                        }
                    }
                }
                if (key)
                {
                    efinalList.Add(chart);
                }
            }
            ViewBag.purAccode = new SelectList(efinalList, "Accode", "AcName");
            ViewBag.SubCode   = new SelectList(_subsidiaryService.All().ToList(), "SubCode", "SubName");
            ViewBag.bankCode  = new SelectList(_BankInfoService.All().ToList(), "BankCode", "BankName");
            DateTime datetime = DateTime.Now;

            ViewBag.Date = datetime.ToString("dd/MM/yyyy");
            string branchCode = Session["BranchCode"].ToString();
            string bankAccode = Session["BankAccode"].ToString();

            //ViewBag.OpenBal = GetOpenBal(DateTime.Now, bankAccode);
            ViewBag.OpenBal = GetOpenBal(datetime);

            ViewBag.GLProvition  = Counter("BOR", "PV");
            ViewBag.GLEntries    = CountVoucherMain("BOR", "MV", datetime);
            ViewBag.GLProvitionB = Counter("BOP", "PV");
            ViewBag.GLEntriesB   = CountVoucherMain("BOP", "MV", datetime);

            var bank = new List <BankOperationVModel>();

            bank = GetAllRemittances(datetime, branchCode, bankAccode);
            GetAllPayment(datetime, branchCode, bankAccode).ForEach(x => bank.Add(x));
            ViewBag.Items = bank;
            ViewBag.JobNo = LoadDropDown.LoadJobInfo();
            //By Farhad For Remittance button/popup will be show/hide.
            var sysSet = _sysSetService.All().ToList().FirstOrDefault();

            ViewBag.MrConv           = sysSet.MRConv;
            ViewBag.MaintJob         = sysSet.MaintJob;
            Session["MaintLot"]      = sysSet.MaintLot;
            ViewBag.MaintLot         = sysSet.MaintLot;
            ViewBag.HasRemittance    = sysSet.HasRemittance;
            ViewBag.IsSubsidiaryCtrl = sysSet.IsSubsidiaryCtrl;
            if (sysSet.IsSubsidiaryCtrl == true)
            {
                ViewBag.brSubCode = LoadDropDown.LoadSubsidiaryByPurpuse("", _subsidiaryService, _subsidiaryCtrlService);
            }
            else
            {
                ViewBag.brSubCode = LoadDropDown.LoadSubsidiary(_subsidiaryService);
            }
            ViewBag.errMsg = errMsg;
            //For us Culture Ex: 0.00
            const string culture = "en-US";
            CultureInfo  ci      = CultureInfo.GetCultureInfo(culture);

            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;
            return(View());
        }
 public ActionResult GetSubsidiaryByPurpose(string purAccode)
 {
     return(Json(LoadDropDown.LoadSubsidiaryByPurpuse(purAccode, _subsidiaryService, _subsidiaryCtrlService), JsonRequestBehavior.AllowGet));
 }