Пример #1
0
 // GET: PurchaseReturn
 public ActionResult PurchaseReturn(string errMsg)
 {
     if (Session["UserID"] != null)
     {
         DateTime datetime = DateTime.Now;
         ViewBag.GLProvition = Counter("PR");
         ViewBag.GLEntries   = CountEntries("PR", datetime);
         ViewBag.LocCode     = new SelectList(_locationService.All().Where(s => s.LocCode != "900").ToList(), "LocCode", "LocName");
         ViewBag.CustCode    = new SelectList(_subsidiaryInfoService.All().ToList().Where(x => x.SubType == "2").OrderBy(x => x.SubName), "SubCode", "SubName");
         ViewBag.ItemCode    = LoadDropDown.LoadEmpDlList();
         var sysSet = _sysSetService.All().ToList().FirstOrDefault();
         ViewBag.MaintJob    = sysSet.MaintJob;
         Session["MaintLot"] = sysSet.MaintLot;
         ViewBag.MaintVAT    = sysSet.MaintVAT;
         Session["MaintVAT"] = sysSet.MaintVAT;
         ViewBag.Reason      = LoadDropDown.LoadAdjReason();
         ViewBag.ApprBy      = new SelectList(_EmployeeService.All().ToList(), "Id", "UserName");
         ViewBag.JobNo       = LoadDropDown.LoadJobInfo();
         var VchrConv = _vchrSetService.All().ToList().FirstOrDefault().VchrConv;
         Session["VchrConv"] = VchrConv;
         ViewBag.PurRetNo    = LoadDropDown.GeneratePurRetNo(_PurRetMainService, "", Session["BranchCode"].ToString(), "", Session["VchrConv"].ToString());
         ViewBag.errMsg      = errMsg;
         return(View());
     }
     else
     {
         return(RedirectToAction("SecUserLogin", "SecUserLogin"));
     }
 }
Пример #2
0
        // GET: StockLedgerRpt
        public ActionResult StockLedgerRpt(string errMsg)
        {
            if (Session["UserID"] != null)
            {
                ViewBag.BranchCode  = new SelectList(_BranchService.All().ToList(), "BranchCode", "BranchName"); //GardenSelection();
                ViewBag.AccountCode = new SelectList(_ItemService.All().ToList(), "ItemCode", "ItemName");
                ViewBag.ItemType    = new SelectList(_itemTypeService.All().ToList(), "ItemTypeCode", "ItemTypeName");
                var Fydd = _FYDDService.All().FirstOrDefault(s => s.FinYear == Session["FinYear"].ToString());
                ViewBag.FyddFDate = Fydd.FYDF;
                ViewBag.FyddTDate = Fydd.FYDT;
                var sysSet = _sysSetService.All().ToList().FirstOrDefault();

                ViewBag.Group       = LoadDropDown.LoadGroupInfoByItemType("", _CommonVmService);
                ViewBag.SubGroup    = LoadDropDown.LoadSGroupByGroupId("", "", _CommonVmService);
                ViewBag.SubSubGroup = LoadDropDown.LoadSSGroupInfo("", "", "", _CommonVmService);
                #region For item Filtering option
                ViewBag.NoGrp        = sysSet.NoGrp;
                ViewBag.OnlyGrp      = sysSet.OnlyGrp;
                ViewBag.GrpAndSubGrp = sysSet.GrpAndSubGrp;
                ViewBag.SubSubGrp    = sysSet.SubSubGrp;
                #endregion

                ViewBag.Message = errMsg;
                return(View());
            }
            else
            {
                return(RedirectToAction("SecUserLogin", "SecUserLogin"));
            }
        }
Пример #3
0
        public ActionResult GetCashBook(RptSearchVModel vmodel)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(vmodel.fDate), Convert.ToString(vmodel.toDate), Session["FinYear"].ToString());

            if (ChkFYR != "")
            {
                return(RedirectToAction("Search", "CashBook", new { errMsg = ChkFYR }));
            }

            RBACUser rUser = new RBACUser(Session["UserName"].ToString());

            if (!rUser.HasPermission("RptCashBook_Preview"))
            {
                string errMsg = "No Preview Permission for this User !!";
                return(RedirectToAction("Search", "CashBook", new { errMsg }));
            }
            Session["fDate"] = vmodel.fDate;
            Session["tDate"] = vmodel.toDate;
            string finyear = Session["FinYear"].ToString();

            vmodel.BranchCode = (vmodel.BranchCode == "0") ? "" : vmodel.BranchCode;
            Session["Branch"] = vmodel.BranchCode;

            ViewBag.HasBranch = _sysSetService.All().FirstOrDefault().HasBranch;
            if (vmodel.BranchCode != "" && vmodel.BranchCode != "0")
            {
                ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == vmodel.BranchCode.Trim()).BranchName.ToString();
            }
            else
            {
                ViewBag.Branch = "All";
            }
            string sql = string.Format("EXEC rptCashBook '" + finyear + "','" + Session["ProjCode"].ToString() + "','" + vmodel.BranchCode + "','" + vmodel.fDate.ToString("yyyy/MM/dd") + "','" + vmodel.toDate.ToString("yyyy/MM/dd") + "'");

            List <CashBook> cashBook = _CashBookService.SqlQueary(sql).ToList();
            //For us Culture Ex: 0.00
            const string culture = "en-US";
            CultureInfo  ci      = CultureInfo.GetCultureInfo(culture);

            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;

            if (cashBook.Count == 0)
            {
                string errMsg = "There is no data on this date. Please try another !!!";
                return(RedirectToAction("Search", "CashBook", new { errMsg }));
            }
            else
            {
                ViewBag.Datef = InWord.GetAbbrMonthNameDate(vmodel.fDate);
                ViewBag.Datet = InWord.GetAbbrMonthNameDate(vmodel.toDate);
                return(View(cashBook));
            }
        }
Пример #4
0
        public ActionResult GetDynaSysSet()
        {
            VMDynSysSet DsSet = new VMDynSysSet();

            DsSet.SysSet  = _sysSetService.All().ToList().FirstOrDefault();
            DsSet.DynaCap = _dynaCapService.All().ToList().FirstOrDefault();

            if (DsSet.SysSet != null && DsSet.DynaCap != null)
            {
                return(Json(DsSet, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("0", JsonRequestBehavior.AllowGet));
            }
        }
 public ActionResult ChequeReceipts(string errMsg)
 {
     if (Session["UserID"] != null)
     {
         ViewBag.BranchCode  = new SelectList(_branchService.All().ToList(), "BranchCode", "BranchName");
         ViewBag.Accode      = LoadDropDown.LoadMRAgainstDDL();
         ViewBag.SubCode     = new SelectList(_subsidiaryService.All().Where(x => x.SubType == "1").ToList(), "SubCode", "SubName");//LoadDropDown.LoadSubsidiaryByPurpuse("", _subsidiaryService, _subsidiaryCtrlService);
         ViewBag.BankCode    = new SelectList(_bankInfoService.All().ToList(), "BankCode", "BankName");
         ViewBag.DepositBank = LoadDropDown.LoadDepositBankDDL();
         ViewBag.UpdateBy    = new SelectList(_employeeInfoService.All().ToList(), "Id", "UserName");
         DateTime datetime = DateTime.Now;
         ViewBag.GLProvition = Counter("BR");
         ViewBag.GLEntries   = CountEntries("BR", datetime);
         var sysSet = _sysSetService.All().ToList().FirstOrDefault();
         ViewBag.MaintJob = sysSet.MaintJob;
         ViewBag.JobNo    = LoadDropDown.LoadJobInfo();
         var VchrConv = _vchrSetService.All().ToList().FirstOrDefault().VchrConv;
         Session["VchrConv"] = VchrConv;
         ViewBag.errMsg      = errMsg;
         return(View());
     }
     else
     {
         return(RedirectToAction("SecUserLogin", "SecUserLogin"));
     }
 }
 // GET: OnlineMoneyReceipt
 public ActionResult OnlineMoneyReceipt()
 {
     if (Session["UserID"] != null)
     {
         ViewBag.BranchCode  = new SelectList(_branchService.All().ToList(), "BranchCode", "BranchName");
         ViewBag.MRAgainst   = LoadDropDown.LoadMRAgainstDDL();
         ViewBag.CustCode    = new SelectList(_subsidiaryInfoService.All().Where(x => x.SubType == "1").ToList(), "SubCode", "SubName");
         ViewBag.bankCode    = new SelectList(_bankInfoService.All().ToList(), "BankCode", "BankName");
         ViewBag.DepositBank = LoadDropDown.LoadDepositBankDDL();
         ViewBag.CollectedBy = new SelectList(_employeeInfoService.All().ToList(), "Id", "UserName");
         var CashAc = _defACService.All().ToList().FirstOrDefault().CashAc;
         ViewBag.Accode = LoadDropDown.LoadGLAc(CashAc, _newChartService);
         DateTime datetime = DateTime.Now;
         ViewBag.GLProvition = Counter("BR");
         ViewBag.GLEntries   = CountEntries("BR", datetime);
         var sysSet = _sysSetService.All().ToList().FirstOrDefault();
         ViewBag.MaintJob = sysSet.MaintJob;
         ViewBag.JobNo    = LoadDropDown.LoadJobInfo();
         ViewBag.GetwayId = LoadDropDown.LoadGetwayProvider();
         var VchrConv = _vchrSetService.All().ToList().FirstOrDefault().VchrConv;
         Session["VchrConv"] = VchrConv;
         return(View());
     }
     else
     {
         return(RedirectToAction("SecUserLogin", "SecUserLogin"));
     }
 }
 // GET: CashMoneyReceipt
 public ActionResult CashMoneyReceipt(string errMsg)
 {
     if (Session["UserID"] != null)
     {
         ViewBag.ProjCode   = new SelectList(_ProjInfoService.All().ToList(), "ProjCode", "ProjName");
         ViewBag.BranchCode = new SelectList(_branchService.All().ToList(), "BranchCode", "BranchName");
         ViewBag.MRAgainst  = LoadDropDown.LoadMRAgainstDDL();
         ViewBag.CustCode   = new SelectList(_subsidiaryInfoService.All().ToList().Where(x => x.SubType == "1"), "SubCode", "SubName");
         var VchrConv = _vchrSetService.All().ToList().FirstOrDefault().VchrConv;
         Session["VchrConv"] = VchrConv;
         ViewBag.MRSL        = LoadDropDown.GenerateRecvSlNo(_moneyReceiptService, "", Session["BranchCode"].ToString(), "", Session["VchrConv"].ToString());
         DateTime datetime = DateTime.Now;
         ViewBag.GLProvition = Counter("CR");
         ViewBag.GLEntries   = CountEntries("CR", datetime);
         var sysSet = _sysSetService.All().ToList().FirstOrDefault();
         ViewBag.MaintJob = sysSet.MaintJob;
         ViewBag.JobNo    = LoadDropDown.LoadJobInfo();
         ViewBag.errMsg   = errMsg;
         return(View());
     }
     else
     {
         return(RedirectToAction("SecUserLogin", "SecUserLogin"));
     }
 }
Пример #8
0
 public ActionResult Item(string errMsg)
 {
     if (Session["UserID"] != null)
     {
         ViewBag.ItemCode = GenerateItemCode();
         var item = _ItemInfoService.All().ToList().LastOrDefault();
         ViewBag.ItemType     = new SelectList(_ItemTypeService.All().ToList(), "ItemTypeCode", "ItemTypeName");
         ViewBag.UnitCode     = new SelectList(_UnitService.All().ToList(), "UnitCode", "UnitName");
         ViewBag.DetUnitCode  = new SelectList(_UnitService.All().ToList(), "UnitCode", "UnitName");
         ViewBag.PackItemCode = new SelectList(_ItemInfoService.All().ToList(), "ItemCode", "ItemName");
         ViewBag.AltItemCode  = new SelectList(_ItemInfoService.All().ToList(), "ItemCode", "ItemName");
         ViewBag.Items        = GetItemAll();
         ViewBag.Group        = LoadDropDown.LoadGroupInf(_CommonVmService);
         ViewBag.SubGroup     = LoadDropDown.LoadSGroupInfo(_CommonVmService);
         ViewBag.SubSubGroup  = LoadDropDown.LoadAllSSGroupInfo(_CommonVmService);
         var sysSet = _sysSetService.All().ToList().FirstOrDefault();
         ViewBag.MaintVAT    = sysSet.MaintVAT;
         Session["MaintVAT"] = sysSet.MaintVAT;
         #region For item Filtering option
         ViewBag.NoGrp        = sysSet.NoGrp;
         ViewBag.OnlyGrp      = sysSet.OnlyGrp;
         ViewBag.GrpAndSubGrp = sysSet.GrpAndSubGrp;
         ViewBag.SubSubGrp    = sysSet.SubSubGrp;
         #endregion
         ViewBag.errMsg = errMsg;
         return(View());
     }
     else
     {
         return(RedirectToAction("SecUserLogin", "SecUserLogin"));
     }
 }
Пример #9
0
 // GET: VM_CrNote
 public ActionResult VM_CrNote()
 {
     if (Session["UserID"] != null)
     {
         ViewBag.Reason   = LoadDropDown.LoadCrNoteReason();
         ViewBag.NoteList = GetCrNote();
         ViewBag.CrNoteNo = GetNewCrNote();
         var sysSet = _sysSetService.All().ToList().FirstOrDefault();
         ViewBag.MaintVAT    = sysSet.MaintVAT;
         Session["MaintVAT"] = sysSet.MaintVAT;
         return(View());
     }
     else
     {
         return(RedirectToAction("SecUserLogin", "SecUserLogin"));
     }
 }
Пример #10
0
 // GET: CustAdjustment
 public ActionResult CustAdjustment()
 {
     if (Session["UserID"] != null)
     {
         DateTime datetime = DateTime.Now;
         ViewBag.GLProvition = Counter("JB");
         ViewBag.GLEntries   = CountEntries("JB", datetime);
         var sysSet = _sysSetService.All().ToList().FirstOrDefault();
         ViewBag.MaintJob  = sysSet.MaintJob;
         ViewBag.CustCode  = new SelectList(_subsidiaryInfoService.All().ToList().Where(x => x.SubType == "1").OrderBy(x => x.SubName), "SubCode", "SubName");
         ViewBag.InvNo     = LoadDropDown.LoadEmpDlList();
         ViewBag.AdjReason = LoadDropDown.LoadAdjReason();
         ViewBag.ApprBy    = new SelectList(_EmployeeService.All().ToList(), "Id", "UserName");
         ViewBag.JobNo     = LoadDropDown.LoadJobInfo();
         var VchrConv = _vchrSetService.All().ToList().FirstOrDefault().VchrConv;
         Session["VchrConv"] = VchrConv;
         ViewBag.AdjNo       = LoadDropDown.GenerateAdjustmentNo(_custAdjustmentService, "", Session["BranchCode"].ToString(), "", Session["VchrConv"].ToString());
         return(View());
     }
     else
     {
         return(RedirectToAction("SecUserLogin", "SecUserLogin"));
     }
 }
Пример #11
0
        //public ActionResult ListOfTransectionPreview(RptSearchVModel vmodel, string pType)
        //{
        //    string finyear = Session["FinYear"].ToString();
        //    Session["Branch"] = vmodel.BranchCode;
        //    Session["LedgerType"] = vmodel.LedgerTypeCode;
        //    Session["fDate"] = vmodel.fDate;
        //    Session["tDate"] = vmodel.tDate;

        //    var BranchCode = Session["BranchCode"].ToString();
        //    if (BranchCode != null)
        //    {
        //        ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == BranchCode).BranchName.ToString();
        //    }
        //    else
        //    {
        //        ViewBag.Branch = "All";
        //    }
        //    string sql = string.Format("EXEC rptListTran '" + finyear + "','01','" + vmodel.BranchCode + "','" + vmodel.JTrGrpId + "','" + Convert.ToDateTime(vmodel.fDate) + "','" + Convert.ToDateTime(vmodel.tDate) + "'");
        //    List<JarnalVoucher> glReport = _jarnalVoucherService.SqlQueary(sql).ToList();
        //    if (glReport.Count == 0)
        //    {
        //        string errMsg = "Data not found !!!";
        //        //ViewBag.msg = errMsg;
        //        return RedirectToAction("CashOperation", "CashOperation", new { errMsg });
        //    }
        //    else
        //    {
        //        if (pType == "A4") { return new Rotativa.ViewAsPdf("~/Views/CashOperation/ListOfTransectionPreview.cshtml", glReport) { PageSize = Rotativa.Options.Size.A4 }; }
        //        else if (pType == "A3") { return new Rotativa.ViewAsPdf("~/Views/CashOperation/ListOfTransectionPreview.cshtml", glReport) { PageSize = Rotativa.Options.Size.A3 }; }
        //        else { return new Rotativa.ViewAsPdf("~/Views/CashOperation/ListOfTransectionPreview.cshtml", glReport) { PageSize = Rotativa.Options.Size.A5 }; }
        //    }
        //}


        public ActionResult ListOfTransactionPreview(RptSearchVModel vmodel)
        {
            vmodel.fDate      = Convert.ToDateTime(Session["fDate"]);
            vmodel.toDate     = Convert.ToDateTime(Session["tDate"]);
            vmodel.BranchCode = Session["Branch"].ToString();
            string finyear = Session["FinYear"].ToString();

            if (Session["Data"] == null)
            {
                vmodel.JTrGrpId = "";
            }
            else
            {
                vmodel.JTrGrpId = Session["Data"].ToString();
            }
            //vmodel.JTrGrpId = Session["Data"].ToString();
            //if (vmodel.JTrGrpId == null)
            //{
            //    vmodel.JTrGrpId = "";
            //}

            // string x = "" = Session["NullData"].ToString();
            string sql = string.Format("EXEC rptListTran '" + finyear + "','01','" + vmodel.BranchCode + "','" + vmodel.JTrGrpId + "','" + vmodel.fDate.ToString("MM/dd/yyyy") + "','" + vmodel.toDate.ToString("MM/dd/yyyy") + "'");
            List <JarnalVoucher> glReport = _jarnalVoucherService.SqlQueary(sql).ToList();

            ViewBag.BranchCode = vmodel.BranchCode;
            ViewBag.fDate      = InWord.GetAbbrMonthNameDate(vmodel.fDate);
            ViewBag.tDate      = InWord.GetAbbrMonthNameDate(vmodel.toDate);
            ViewBag.HasBranch  = _sysSetService.All().FirstOrDefault().HasBranch;
            if (ViewBag.HasBranch == true)
            {
                if (vmodel.BranchCode != null && vmodel.BranchCode != "0")
                {
                    ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == vmodel.BranchCode.Trim()).BranchName.ToString();
                }
                else
                {
                    ViewBag.Branch = "All";
                }
            }
            //  var glReport = Session["Data"].ToString();
            //if (glReport == null)
            //{
            //    string errMsg = "Data not found !!!";
            //    return RedirectToAction("ListOfTransaction", "Search", new { errMsg });
            //}
            //else
            //{
            double amt = 0;
            //foreach (var item in glReport)
            //{
            //    double amt = 0;
            List <JarnalVoucher> sList = new List <JarnalVoucher>();  //InWord.ConvertToWords(amt.ToString()).ToList();

            foreach (var item in glReport)
            {
                if (item.DrAmount > 0)
                {
                    amt = item.DrAmount;
                }
                else if (item.CrAmount > 0)
                {
                    amt = item.CrAmount;
                }

                JarnalVoucher sAmt = new JarnalVoucher();
                sAmt.ACCode     = item.ACCode;
                sAmt.VDate      = item.VDate;
                sAmt.AcName     = item.AcName;
                sAmt.InWords    = InWord.ConvertToWords(amt.ToString());
                sAmt.AcName     = item.AcName;
                sAmt.Narration  = item.Narration;
                sAmt.SubSidiary = item.SubSidiary;
                sAmt.CrAmount   = item.CrAmount;
                sAmt.DrAmount   = item.DrAmount;
                sAmt.VchrNo     = item.VchrNo;
                sAmt.Posted     = item.Posted;
                sAmt.Sub_Ac     = item.Sub_Ac;
                sList.Add(sAmt);
                // }
            }
            //string InWordsamt = InWord.ConvertToWords(amt.ToString());
            //ViewBag.InWordsAmt = InWordsamt;

            // ViewBag.glDate = date;
            //  return View("~/Views/ListOfTransection/TransectionList.cshtml", glReport);
            return(new Rotativa.ViewAsPdf("ListOfTransactionPreview", sList)
            {
                CustomSwitches = "--footer-left \"Reporting Date: " + DateTime.Now.ToString("dd-MM-yyyy") + "\" " + "--footer-right \"Page: [page] of [toPage]\"        --footer-font-size \"9\" --footer-spacing 5  --footer-font-name \"calibri light\""
            });
            //}
        }
        public ActionResult SaveDepositToBank(Deposit deposit)
        {
            RBACUser rUser = new RBACUser(Session["UserName"].ToString());

            if (!rUser.HasPermission("BankDeposit_Insert"))
            {
                return(Json("X", JsonRequestBehavior.AllowGet));
            }
            List <CashOperationVModel> CashOPVM = new List <CashOperationVModel>();

            try
            {
                var IfExit = _DepositToBankService.All().Where(x => x.DepositNo == deposit.DepositNo).FirstOrDefault();
                if (IfExit == null)
                {
                    if (!string.IsNullOrEmpty(deposit.bankAccode) && deposit.bankAccode.Trim() != "Select Bank A/C")
                    {
                        deposit.BranchCode = Session["BranchCode"].ToString();
                        var GCa = _AcBrService.All().Where(s => s.BranchCode == deposit.BranchCode && s.Ca_Ba == "Ca").Select(x => x.Accode).FirstOrDefault();
                        if (GCa == null)
                        {
                            var gset = _gsetService.All().LastOrDefault();
                            GCa = gset.GCa;
                        }

                        deposit.FinYear  = Session["FinYear"].ToString();
                        deposit.NewChart = _NewChartService.All().ToList().FirstOrDefault(x => x.Accode == deposit.bankAccode.Trim());
                        //cashReceipt.Customer = _CustomerService.All().ToList().FirstOrDefault(x => x.CustCode == cashReceipt.CustCode);
                        CashOperation cashOperation   = new CashOperation(deposit.DepositDate, 0.0, 0.0, 0.0, 0.0, "", DateTime.Now, false, deposit.FinYear, false, deposit.BranchCode);
                        var           isAlreadyClosed = _CashOperationService.All().ToList().FirstOrDefault(x => x.BranchCode == deposit.BranchCode && x.TrDate.ToString("MM-dd-yyyy") == deposit.DepositDate.ToString("MM-dd-yyyy"));


                        var           openBal       = GetOpenBal(deposit.DepositDate, deposit.bankAccode);
                        var           rcecBal       = GetAllRemittances(deposit.DepositDate, deposit.BranchCode, deposit.bankAccode).Sum(x => x.Amount);
                        var           payTotal      = GetAllPayment(deposit.DepositDate, deposit.BranchCode, deposit.bankAccode).Sum(x => x.Amount);
                        var           closBal       = openBal + rcecBal - payTotal;
                        BankOperation bankOperation = new BankOperation(deposit.DepositDate, openBal, deposit.Amount, 0.0, closBal, deposit.BranchCode, deposit.FinYear, false, deposit.bankAccode);

                        var sysSet = _sysSetService.All().FirstOrDefault();


                        var isAlreadySaved = _BankOperationService.All().ToList().FirstOrDefault(x => x.TrDate.ToString("MM-dd-yyyy") == deposit.DepositDate.ToString("MM-dd-yyyy") && x.BranchCode == deposit.BranchCode && x.bankAccode == deposit.bankAccode);

                        if (isAlreadyClosed == null || isAlreadySaved == null)
                        {
                            using (var transaction = new TransactionScope())
                            {
                                try
                                {
                                    _CashOperationService.Add(cashOperation);
                                    _CashOperationService.Save();
                                    _BankOperationService.Add(bankOperation);
                                    _BankOperationService.Save();
                                    _DepositToBankService.Add(deposit);
                                    _DepositToBankService.Save();
                                    TransactionLogService.SaveTransactionLog(_transactionLogService, "Deposit To Bank", "Save", deposit.DepositNo, Session["UserName"].ToString());
                                    LoadDropDown.journalVoucherSave("BD", "I", deposit.DepositNo, deposit.VoucherNo, deposit.FinYear, "01", deposit.BranchCode, deposit.DepositDate, GCa, Session["UserName"].ToString());
                                    CashOPVM = GetAllExpenseAndDeposit(deposit.DepositDate, deposit.BranchCode);
                                    transaction.Complete();
                                }
                                catch (Exception)
                                {
                                    transaction.Dispose();
                                    return(Json("0", JsonRequestBehavior.AllowGet));
                                }
                                return(Json(CashOPVM, JsonRequestBehavior.AllowGet));
                            }
                        }
                        else if (isAlreadyClosed != null && sysSet.CashRule == "O" ? true : isAlreadyClosed.IsClosed == false)
                        {
                            var rcecBals = GetAllRemittances(deposit.DepositDate, deposit.BranchCode, deposit.bankAccode).Sum(x => x.Amount);
                            isAlreadySaved.RecTotal = rcecBals + deposit.Amount;
                            isAlreadySaved.CloseBal = isAlreadySaved.OpenBal + isAlreadySaved.RecTotal - isAlreadySaved.PayTotal;

                            using (var transaction = new TransactionScope())
                            {
                                try
                                {
                                    _BankOperationService.Update(isAlreadySaved);
                                    _BankReceiptAppService.Save();
                                    _DepositToBankService.Add(deposit);
                                    _DepositToBankService.Save();
                                    TransactionLogService.SaveTransactionLog(_transactionLogService, "Deposit To Bank", "Save", deposit.DepositNo, Session["UserName"].ToString());
                                    LoadDropDown.journalVoucherSave("BD", "I", deposit.DepositNo, deposit.VoucherNo, deposit.FinYear, "01", deposit.BranchCode, deposit.DepositDate, GCa, Session["UserName"].ToString());
                                    if (sysSet.CashRule == "O")
                                    {
                                        LoadDropDown.CashRecalculate(Session["ProjCode"].ToString(), deposit.BranchCode, deposit.FinYear, Convert.ToDecimal(deposit.Amount), deposit.DepositDate);
                                    }
                                    CashOPVM = GetAllExpenseAndDeposit(deposit.DepositDate, deposit.BranchCode);
                                    transaction.Complete();
                                }
                                catch (Exception)
                                {
                                    transaction.Dispose();
                                    return(Json("0", JsonRequestBehavior.AllowGet));
                                }
                                return(Json(CashOPVM, JsonRequestBehavior.AllowGet));
                            }
                        }
                        else
                        {
                            return(Json("2", JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        return(Json("1", JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json("3", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json("0", JsonRequestBehavior.AllowGet));
            }
        }
Пример #13
0
        public ActionResult GetVoucherPreviewPdf(string FinYear, string vchrNo, string pType)
        {
            var ledger = _LedgerCapService.All().ToList().FirstOrDefault(x => x.SP_Name == "rptVoucher");

            ViewBag.RptCap    = ledger.RptCap;
            ViewBag.Col1Cap   = ledger.Col1Cap;
            ViewBag.Col2Cap   = ledger.Col2Cap;
            ViewBag.Col3Cap   = ledger.Col3Cap;
            ViewBag.Col4Cap   = ledger.Col4Cap;
            ViewBag.Col5Cap   = ledger.Col5Cap;
            ViewBag.Col6Cap   = ledger.Col6Cap;
            ViewBag.Col7Cap   = ledger.Col7Cap;
            ViewBag.HasBranch = _sysSetService.All().FirstOrDefault().HasBranch;
            if (ViewBag.HasBranch == true)
            {
                var BranchCode = Session["BranchCode"].ToString();
                if (BranchCode != null)
                {
                    ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == BranchCode).BranchName.ToString();
                }
                else
                {
                    ViewBag.Branch = "All";
                }
            }

            string sql = string.Format("EXEC rptVoucher '" + FinYear + "','" + vchrNo + "'");
            List <VchrPreviewVM> rptVchr = _VchrPreviewVMService.SqlQueary(sql).ToList();
            //if (rptVchr.Count == 0)
            //{
            //    string errMsg = "There is no data in this combination. Please try again !!!";
            //    return RedirectToAction("SearchVoucher", "VchrPreview", new { errMsg });
            //}
            //else
            //{
            double amt = 0;

            foreach (var item in rptVchr)
            {
                if (item.cramount != 0)
                {
                    amt += item.cramount;
                }
            }
            string InWordsamt = InWord.ConvertToWords(amt.ToString());

            ViewBag.InWordsAmt = InWordsamt;
            if (pType == "A4")
            {
                return(new Rotativa.ViewAsPdf("~/Views/VchrPreview/VchrPreviewPdf.cshtml", rptVchr)
                {
                    PageSize = Rotativa.Options.Size.A4
                });
            }
            else if (pType == "A3")
            {
                return(new Rotativa.ViewAsPdf("~/Views/VchrPreview/VchrPreviewPdf.cshtml", rptVchr)
                {
                    PageSize = Rotativa.Options.Size.A3
                });
            }
            else
            {
                return(new Rotativa.ViewAsPdf("~/Views/VchrPreview/VchrPreviewPdf.cshtml", rptVchr)
                {
                    PageSize = Rotativa.Options.Size.A5
                });
            }
            //}
        }
Пример #14
0
        public ActionResult SavePayment(Payment payment)
        {
            RBACUser rUser = new RBACUser(Session["UserName"].ToString());

            if (!rUser.HasPermission("BankPayment_Insert"))
            {
                return(Json("X", JsonRequestBehavior.AllowGet));
            }
            List <BankOperationVModel> CashOPVM = new List <BankOperationVModel>();
            var gset = _gsetService.All().LastOrDefault();

            try
            {
                var IfExit = _paymentService.All().Where(x => x.PayCode == payment.PayCode).FirstOrDefault();
                if (IfExit == null)
                {
                    payment.BranchCode = Session["BranchCode"].ToString();
                    payment.FinYear    = Session["FinYear"].ToString();
                    payment.bankAccode = Session["BankAccode"].ToString();


                    var openBal  = GetOpenBal(payment.PayDate);
                    var rcecBal  = GetAllRemittances(payment.PayDate, payment.BranchCode, payment.bankAccode).Sum(x => x.Amount);
                    var payTotal = GetAllPayment(payment.PayDate, payment.BranchCode, payment.bankAccode).Sum(x => x.Amount);
                    var closBal  = openBal + rcecBal - payTotal;

                    BankOperation bankOperation = new BankOperation(payment.PayDate, openBal, 0.0, payment.Amount, closBal, payment.BranchCode, payment.FinYear, false, payment.bankAccode);
                    // BankOperation bankOperation = new BankOperation(payment.PayDate, 0.0, 0.0, 0.0, 0.0, payment.BranchCode, payment.FinYear, false, payment.bankAccode);
                    var isAlreadySaved = _bankOperationService.All().ToList().FirstOrDefault(x => x.TrDate.ToString("MM-dd-yyyy") == payment.PayDate.ToString("MM-dd-yyyy") && x.BranchCode == payment.BranchCode && x.bankAccode == payment.bankAccode);

                    if (isAlreadySaved == null)
                    {
                        using (var transaction = new TransactionScope())
                        {
                            try
                            {
                                _bankOperationService.Add(bankOperation);
                                _bankOperationService.Save();
                                _paymentService.Add(payment);
                                _paymentService.Save();
                                //Insert to provision
                                LoadDropDown.journalVoucherSave("BP", "I", payment.PayCode, payment.VoucherNo, payment.FinYear, "01", payment.BranchCode, payment.PayDate, payment.bankAccode, Session["UserName"].ToString());
                                TransactionLogService.SaveTransactionLog(_transactionLogService, "Payment", "Save", payment.PayCode, User.Identity.Name);
                                CashOPVM = GetAllPayment(payment.PayDate, payment.BranchCode, payment.bankAccode);
                                transaction.Complete();
                            }
                            catch (Exception)
                            {
                                transaction.Dispose();
                                return(Json("0", JsonRequestBehavior.AllowGet));
                            }
                        }
                        return(Json(CashOPVM, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        var payTotals = GetAllPayment(payment.PayDate, payment.BranchCode, payment.bankAccode).Sum(x => x.Amount);
                        isAlreadySaved.PayTotal = payTotals + payment.Amount;
                        isAlreadySaved.CloseBal = isAlreadySaved.OpenBal + isAlreadySaved.RecTotal - isAlreadySaved.PayTotal;
                        using (var transaction = new TransactionScope())
                        {
                            try
                            {
                                _bankOperationService.Update(isAlreadySaved);
                                _bankOperationService.Save();
                                _paymentService.Add(payment);
                                _paymentService.Save();
                                //Insert to provision
                                LoadDropDown.journalVoucherSave("BP", "I", payment.PayCode, payment.VoucherNo, payment.FinYear, "01", payment.BranchCode, payment.PayDate, payment.bankAccode, Session["UserName"].ToString());
                                var sysSet = _sysSetService.All().FirstOrDefault();
                                if (sysSet.CashRule == "O")
                                {
                                    LoadDropDown.BankRecalculate(payment.PayDate, Convert.ToDecimal(payment.Amount), Session["ProjCode"].ToString(), payment.BranchCode, payment.FinYear, payment.bankAccode);
                                }
                                TransactionLogService.SaveTransactionLog(_transactionLogService, "Payment", "Save", payment.PayCode, User.Identity.Name);
                                CashOPVM = GetAllPayment(payment.PayDate, payment.BranchCode, payment.bankAccode);
                                transaction.Complete();
                            }
                            catch (Exception)
                            {
                                transaction.Dispose();
                                return(Json("0", JsonRequestBehavior.AllowGet));
                            }
                        }

                        return(Json(CashOPVM, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json("1", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception)
            {
                return(Json("0", JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult SummaryReportPdf(RptSearchVModel vmodel, string finyear)
        {
            vmodel.BranchCode     = Session["Branch"].ToString();
            vmodel.LedgerTypeCode = Session["LedgerType"].ToString();
            if (Session["LevelNo"] == null)
            {
                vmodel.LevelNo = "0";
            }
            else
            {
                vmodel.LevelNo = Session["LevelNo"].ToString();
            }
            // vmodel.LevelNo =Session["LevelNo"].ToString();
            var rptCap = _LedgerCapService.All().ToList().FirstOrDefault(x => x.SP_Name == vmodel.LedgerTypeCode);


            ViewBag.LedgerCap  = rptCap.LedgerCap;
            ViewBag.RptCap     = rptCap.RptCap;
            ViewBag.Col1Cap    = rptCap.Col1Cap;
            ViewBag.Col2Cap    = rptCap.Col2Cap;
            ViewBag.Col3Cap    = rptCap.Col3Cap;
            ViewBag.Col4Cap    = rptCap.Col4Cap;
            ViewBag.Col5Cap    = rptCap.Col5Cap;
            ViewBag.Col6Cap    = rptCap.Col6Cap;
            ViewBag.Col7Cap    = rptCap.Col7Cap;
            ViewBag.Col8Cap    = rptCap.Col8Cap;
            ViewBag.fDate      = InWord.GetAbbrMonthNameDate(vmodel.fDate);
            ViewBag.tDate      = InWord.GetAbbrMonthNameDate(vmodel.tDate);
            ViewBag.BranchCode = vmodel.BranchCode;
            if (vmodel.BranchCode != "" && vmodel.BranchCode != "0")
            {
                ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == vmodel.BranchCode.Trim()).BranchName.ToString();
            }
            else
            {
                ViewBag.Branch = "All";
            }
            ViewBag.HasBranch = _sysSetService.All().FirstOrDefault().HasBranch;
            ViewBag.PrintDate = DateTime.Now.ToShortDateString();

            finyear = Session["FinYear"].ToString();
            if (Session["LevelNo"] == null)
            {
                vmodel.LevelNo = "0";
            }
            else
            {
                vmodel.LevelNo = Session["LevelNo"].ToString();
            }
            string sql = string.Format(" EXEC " + rptCap.SP_Name + " '" + finyear + "','','" + vmodel.BranchCode + "','" + vmodel.fDate.ToString("MM/dd/yyyy") + "','" + vmodel.tDate.ToString("MM/dd/yyyy") + "','" + Session["Discardcntl"] + "','" + vmodel.LevelNo + "'");
            List <SummaryReport> summaryReport = _SumRptService.SqlQueary(sql).ToList();

            Session["Discardcntl"] = "";
            Session["LevelNo"]     = "";
            //if (summaryReport.Count == 0)
            //{
            //    string errMsg = "There is no data in this combination. Please try again !!!";
            //    return RedirectToAction("GetSummaryReport2", "SummaryReport", new { errMsg });
            //}
            //else
            //{
            //For us Culture Ex: 0.00
            const string culture = "en-US";
            CultureInfo  ci      = CultureInfo.GetCultureInfo(culture);

            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;
            if (rptCap.RptCap == "Stock Summary")
            {
                return(new Rotativa.ViewAsPdf("SummaryStockReportPdf", summaryReport)
                {
                    CustomSwitches = "--footer-left \"Reporting Date: " + DateTime.Now.ToString("dd-MM-yyyy") + "\" " + "--footer-right \"Page: [page] of [toPage]\"        --footer-font-size \"9\" --footer-spacing 5  --footer-font-name \"calibri light\""
                });
            }
            return(new Rotativa.ViewAsPdf("SummaryReportPdf", summaryReport)
            {
                CustomSwitches = "--footer-left \"Reporting Date: " + DateTime.Now.ToString("dd-MM-yyyy") + "\" " + "--footer-right \"Page: [page] of [toPage]\"        --footer-font-size \"9\" --footer-spacing 5  --footer-font-name \"calibri light\""
            });
            //}
        }
Пример #16
0
        public ActionResult SaveBankReceipt(BankReceipt bankReceipt)
        {
            RBACUser rUser = new RBACUser(Session["UserName"].ToString());

            if (!rUser.HasPermission("BankReceipt_Insert"))
            {
                return(Json("X", JsonRequestBehavior.AllowGet));
            }
            List <BankOperationVModel> CashOPVM = new List <BankOperationVModel>();
            var gset = _gsetService.All().LastOrDefault();

            try
            {
                var IfExit = _BankReceiptAppService.All().Where(x => x.BReceiptNo == bankReceipt.BReceiptNo).FirstOrDefault();
                if (IfExit == null)
                {
                    if (!string.IsNullOrEmpty(bankReceipt.purAccode) && bankReceipt.purAccode.Trim() != "Select Purpose")
                    {
                        bankReceipt.BranchCode   = Session["BranchCode"].ToString();
                        bankReceipt.bankAccode   = Session["BankAccode"].ToString();
                        bankReceipt.FinYear      = Session["FinYear"].ToString();
                        bankReceipt.NewChart     = _NewChartService.All().ToList().FirstOrDefault(x => x.Accode == bankReceipt.purAccode.Trim());
                        bankReceipt.bankNewChart = _NewChartService.All().ToList().FirstOrDefault(x => x.Accode == bankReceipt.bankAccode.Trim());


                        var           openBal       = GetOpenBal(bankReceipt.BReceiptDate);
                        var           rcecBal       = GetAllRemittances(bankReceipt.BReceiptDate, bankReceipt.BranchCode, bankReceipt.bankAccode).Sum(x => x.Amount);
                        var           payTotal      = GetAllPayment(bankReceipt.BReceiptDate, bankReceipt.BranchCode, bankReceipt.bankAccode).Sum(x => x.Amount);
                        var           closBal       = openBal + rcecBal - payTotal;
                        BankOperation bankOperation = new BankOperation(bankReceipt.BReceiptDate, openBal, bankReceipt.Amount, 0.0, closBal, bankReceipt.BranchCode, bankReceipt.FinYear, false, bankReceipt.bankAccode);


                        //cashReceipt.Customer = _CustomerService.All().ToList().FirstOrDefault(x => x.CustCode == cashReceipt.CustCode);
                        //BankOperation bankOperation = new BankOperation(bankReceipt.BReceiptDate, 0.0, 0.0, 0.0, 0.0, bankReceipt.BranchCode, bankReceipt.FinYear, false, bankReceipt.bankAccode);
                        var isAlreadySaved = _BankOperationService.All().ToList().FirstOrDefault(x => x.TrDate.ToString("MM-dd-yyyy") == bankReceipt.BReceiptDate.ToString("MM-dd-yyyy") && x.BranchCode == bankReceipt.BranchCode && x.bankAccode == bankReceipt.bankAccode);

                        if (isAlreadySaved == null)
                        {
                            using (var transaction = new TransactionScope())
                            {
                                try
                                {
                                    _BankOperationService.Add(bankOperation);
                                    _BankOperationService.Save();

                                    _BankReceiptAppService.Add(bankReceipt);
                                    _BankReceiptAppService.Save();

                                    //insert to provision
                                    LoadDropDown.journalVoucherSave("BR", "I", bankReceipt.BReceiptNo, bankReceipt.VoucherNo, bankReceipt.FinYear, "01", bankReceipt.BranchCode, bankReceipt.BReceiptDate, bankReceipt.bankAccode, Session["UserName"].ToString());

                                    TransactionLogService.SaveTransactionLog(_transactionLogService, "BankReceipt", "Save", bankReceipt.BReceiptNo, User.Identity.Name);
                                    CashOPVM = GetAllRemittances(bankReceipt.BReceiptDate, bankReceipt.BranchCode, bankReceipt.bankAccode);
                                    transaction.Complete();
                                }
                                catch (Exception)
                                {
                                    transaction.Dispose();
                                    return(Json("0", JsonRequestBehavior.AllowGet));
                                }
                            }
                            return(Json(CashOPVM, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            var rcecBals = GetAllRemittances(bankReceipt.BReceiptDate, bankReceipt.BranchCode, bankReceipt.bankAccode).Sum(x => x.Amount);
                            isAlreadySaved.RecTotal = rcecBals + bankReceipt.Amount;
                            isAlreadySaved.CloseBal = isAlreadySaved.OpenBal + isAlreadySaved.RecTotal - isAlreadySaved.PayTotal;

                            using (var transaction = new TransactionScope())
                            {
                                try
                                {
                                    _BankOperationService.Update(isAlreadySaved);
                                    _BankReceiptAppService.Save();

                                    _BankReceiptAppService.Add(bankReceipt);
                                    _BankReceiptAppService.Save();
                                    var sysSet = _sysSetService.All().FirstOrDefault();
                                    if (sysSet.CashRule == "O")
                                    {
                                        LoadDropDown.journalVoucherSave("BR", "I", bankReceipt.BReceiptNo, bankReceipt.VoucherNo, bankReceipt.FinYear, "01", bankReceipt.BranchCode, bankReceipt.BReceiptDate, bankReceipt.bankAccode, Session["UserName"].ToString());
                                    }
                                    //insert to provision
                                    LoadDropDown.BankRecalculate(bankReceipt.BReceiptDate, Convert.ToDecimal(bankReceipt.Amount), Session["ProjCode"].ToString(), bankReceipt.BranchCode, bankReceipt.FinYear, bankReceipt.bankAccode);
                                    TransactionLogService.SaveTransactionLog(_transactionLogService, "BankReceipt", "Save", bankReceipt.BReceiptNo, User.Identity.Name);
                                    CashOPVM = GetAllRemittances(bankReceipt.BReceiptDate, bankReceipt.BranchCode, bankReceipt.bankAccode);
                                    transaction.Complete();
                                }
                                catch (Exception)
                                {
                                    transaction.Dispose();
                                    return(Json("0", JsonRequestBehavior.AllowGet));
                                }
                            }

                            return(Json(CashOPVM, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        return(Json("0", JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json("1", JsonRequestBehavior.AllowGet));
                }
            }

            catch (Exception)
            {
                return(Json("0", JsonRequestBehavior.AllowGet));
            }
        }
Пример #17
0
        public ActionResult Login(VMLogin user)
        {
            try
            {
                string Pass = SHA1.Encode(user.Password);

                var UserInfo = (from mi in _secUserInfoService.All().ToList()
                                where mi.UserName == user.UserName && mi.Password == SHA1.Encode(user.Password)
                                select new
                {
                    UserID = mi.UserID,
                    UserName = mi.UserName,
                    Password = mi.Password,
                    Email = mi.Email
                }).FirstOrDefault();

                var HasBranch = _sysSetService.All().FirstOrDefault().HasBranch;
                if (HasBranch == true)
                {
                    if (UserInfo != null)
                    {
                        Session["ProjCode"] = "01";
                        Session["UserID"]   = UserInfo.UserID;
                        Session["UserName"] = UserInfo.UserName;
                        Session["FinYear"]  = user.FinYear;
                        var sysSet = _sysSetService.All().FirstOrDefault();
                        if (sysSet.HasSale == true)
                        {
                            string token = GetToken(ConfigurationManager.AppSettings["ApiUrl"], UserInfo.UserName, UserInfo.Password);
                            Session["token"] = token;
                        }

                        return(RedirectToAction("LogInWithBranch", "SecUserLogin"));
                    }
                    else
                    {
                        ViewBag.Message = "Login data is incorrect!";
                        return(RedirectToAction("SecUserLogin", "SecUserLogin"));
                    }
                }
                else
                {
                    if (UserInfo != null)
                    {
                        Session["ProjCode"]   = "01";
                        Session["UserID"]     = UserInfo.UserID;
                        Session["UserName"]   = UserInfo.UserName;
                        Session["FinYear"]    = user.FinYear;
                        Session["BranchCode"] = _branchService.All().FirstOrDefault().BranchCode;
                        var sysSet = _sysSetService.All().FirstOrDefault();
                        if (sysSet.HasSale == true)
                        {
                            string token = GetToken(ConfigurationManager.AppSettings["ApiUrl"], UserInfo.UserName, UserInfo.Password);
                            Session["token"] = token;
                        }
                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        ViewBag.Message = "Login data is incorrect!";
                        return(RedirectToAction("SecUserLogin", "SecUserLogin"));
                    }
                }
            }
            catch (System.Exception)
            {
                throw;
            }
        }
        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());
        }
        // GET: NewFile

        public ActionResult NewFile()
        {
            ViewBag.ActID = LoadDropDown.LoadAllActions(_actionListService);
            ViewBag.Lang  = _sysSet.All().Select(x => x.Lang).First();
            return(View());
        }
Пример #20
0
        public ActionResult GetReportLedger(RptSearchVModel vmodel, string finyear)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(vmodel.fDate), Convert.ToString(vmodel.toDate), Session["FinYear"].ToString());

            if (ChkFYR != "")
            {
                return(RedirectToAction("Search", "Report", new { errMsg = ChkFYR }));
            }

            RBACUser rUser = new RBACUser(Session["UserName"].ToString());

            if (!rUser.HasPermission("RptGeneralLedger_Preview"))
            {
                string errMsg = "No Preview Permission for this User !!";
                return(RedirectToAction("Search", "Report", new { errMsg }));
            }

            Session["Branch"]      = vmodel.BranchCode;
            Session["LedgerType"]  = vmodel.LedgerTypeCode;
            Session["AccountCode"] = vmodel.AccountCode;
            Session["fDate"]       = vmodel.fDate;
            Session["tDate"]       = vmodel.toDate;


            var ledger = _LedgerCapService.All().ToList().FirstOrDefault(x => x.LedgerTypeCode == vmodel.LedgerTypeCode);


            ViewBag.LedgerCap   = ledger.LedgerCap;
            ViewBag.RptCap      = ledger.RptCap;
            ViewBag.OpeningCap  = ledger.OpeningCap;
            ViewBag.ClosingCap  = ledger.ClosingCap;
            ViewBag.Col1Cap     = ledger.Col1Cap;
            ViewBag.Col2Cap     = ledger.Col2Cap;
            ViewBag.Col3Cap     = ledger.Col3Cap;
            ViewBag.Col4Cap     = ledger.Col4Cap;
            ViewBag.Col5Cap     = ledger.Col5Cap;
            ViewBag.Col6Cap     = ledger.Col6Cap;
            ViewBag.Col7Cap     = ledger.Col7Cap;
            ViewBag.Col8Cap     = ledger.Col8Cap;
            ViewBag.fDate       = InWord.GetAbbrMonthNameDate(vmodel.fDate);
            ViewBag.tDate       = InWord.GetAbbrMonthNameDate(vmodel.toDate);
            ViewBag.AccountCode = vmodel.AccountCode;
            ViewBag.BranchCode  = vmodel.BranchCode;
            ViewBag.HasBranch   = _sysSetService.All().FirstOrDefault().HasBranch;

            if (vmodel.BranchCode != null && vmodel.BranchCode != "0")
            {
                ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == vmodel.BranchCode.Trim()).BranchName.ToString();
            }
            else
            {
                ViewBag.Branch = "All";
            }


            if (vmodel.LedgerTypeCode == "01")
            {
                ViewBag.Account = _NewChartService.All().FirstOrDefault(x => x.Accode == vmodel.AccountCode.Trim()).AcName.ToString();
            }
            else if (vmodel.LedgerTypeCode == "02")
            {
                ViewBag.Account = _SubsidiaryService.All().FirstOrDefault(x => x.SubCode == vmodel.AccountCode.Trim()).SubName.ToString();
            }
            else
            {
                ViewBag.Account = _ItemService.All().FirstOrDefault(x => x.ItemCode == vmodel.AccountCode.Trim()).ItemName.ToString();
            }

            finyear = Session["FinYear"].ToString();


            string sql = string.Format(" EXEC " + ledger.SP_Name + " '" + finyear + "','" + Session["ProjCode"].ToString() + "','" + vmodel.BranchCode + "','" + vmodel.AccountCode + "','" + vmodel.fDate.ToString("MM-dd-yyyy") + "','" + vmodel.toDate.ToString("MM-dd-yyyy") + "'");
            List <ReportLedger> rptLedger = _ReportLedgerService.SqlQueary(sql).ToList();
            //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(rptLedger));
        }