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

            vmodel.BranchCode = Session["Branch"].ToString();
            string          sql      = string.Format("EXEC rptCashBook '" + finyear + "','" + Session["ProjCode"].ToString() + "','" + vmodel.BranchCode + "','" + vmodel.fDate.ToString("MM/dd/yyyy") + "','" + vmodel.toDate.ToString("MM/dd/yyyy") + "'");
            List <CashBook> cashBook = _CashBookService.SqlQueary(sql).ToList();

            ViewBag.Datef     = InWord.GetAbbrMonthNameDate(vmodel.fDate);
            ViewBag.Datet     = InWord.GetAbbrMonthNameDate(vmodel.toDate);
            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";
            }
            //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(new Rotativa.ViewAsPdf("CashBookPdf", cashBook)
            {
                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\""
            });
        }
Example #2
0
        public ActionResult StockLedgerPdf(RptSearchVModel vmodel, string finyear)
        {
            vmodel.BranchCode  = Session["Branch"].ToString();
            vmodel.AccountCode = Session["AccountCode"].ToString();
            var ledger = _LedgerCapService.All().ToList().FirstOrDefault(x => x.SP_Name == "rptStoreLedger");

            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;
            if (vmodel.BranchCode != "")
            {
                ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == vmodel.BranchCode.Trim()).BranchName.ToString();
            }
            else
            {
                ViewBag.Branch = "All";
            }
            if (vmodel.AccountCode != "")
            {
                ViewBag.Account = _ItemService.All().FirstOrDefault(x => x.ItemCode == vmodel.AccountCode.Trim()).ItemName.ToString();
            }
            else
            {
                ViewBag.Account = "All";
            }

            ViewBag.PrintDate = DateTime.Now.ToShortDateString();

            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(new Rotativa.ViewAsPdf("StockLedgerPdf", rptLedger)
            {
                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 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));
            }
        }
        public ActionResult GetCustomerLedger(RptSearchVModel vmodel, string finyear)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(vmodel.fDate), Convert.ToString(vmodel.tDate), Session["FinYear"].ToString());

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

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

            if (!rUser.HasPermission("CustomerLedgerGDS_Preview"))
            {
                string errMsg = "No Preview Permission for this User !!";
                return(RedirectToAction("SecUserLogin", "SecUserLogin", new { 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;

            finyear       = Session["FinYear"].ToString();
            ViewBag.fDate = InWord.GetAbbrMonthNameDate(vmodel.fDate);
            ViewBag.tDate = InWord.GetAbbrMonthNameDate(vmodel.tDate);


            ViewBag.CustCode = vmodel.SubCode;
            ViewBag.Customer = _ISubsidiaryInfoAppService.All().FirstOrDefault(x => x.SubCode == vmodel.SubCode.Trim()).SubName.ToString();
            ViewBag.SubCode  = vmodel.SubCode;



            string sql = string.Format("exec rpt_CustLedger_GDS '" + vmodel.fDate.ToString("yyyy/MM/dd") + "','" + vmodel.tDate.ToString("yyyy/MM/dd") + "','" + vmodel.SubCode + "','" + Session["FinYear"].ToString() + "','" + Session["UserName"] + "'  ");


            IEnumerable <CustomerLedgerVM> VchrLst;

            using (AcclineERPContext dbContext = new AcclineERPContext())
            {
                VchrLst = dbContext.Database.SqlQuery <CustomerLedgerVM>(sql).ToList();
            }

            return(new Rotativa.ViewAsPdf("CustomerLedgerPdf", "", VchrLst)
            {
                PageOrientation = Rotativa.Options.Orientation.Portrait,
                PageSize = Rotativa.Options.Size.A4,
                CustomSwitches = "--footer-left \"Reporting Date: " + DateTime.Now.ToString("dd-MM-yyyy") + "\" " + "--footer-right \"Page: [page] of [toPage]\" --footer-line --footer-font-size \"9\" --footer-spacing 5 --footer-font-name \"calibri light\""
            });
        }
Example #5
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\""
            });
            //}
        }
Example #6
0
        public ActionResult GetGLEntries(RptSearchVModel vmodel)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(vmodel.fDate), Convert.ToString(vmodel.toDate), Session["FinYear"].ToString());

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

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

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

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

            Session["Branch"]     = vmodel.BranchCode;
            Session["LedgerType"] = vmodel.LedgerTypeCode;
            Session["fDate"]      = vmodel.fDate;
            Session["tDate"]      = vmodel.toDate;
            Session["Data"]       = vmodel.JTrGrpId;
            ViewBag.fDate         = InWord.GetAbbrMonthNameDate(vmodel.fDate);
            ViewBag.tDate         = InWord.GetAbbrMonthNameDate(vmodel.toDate);
            if (vmodel.JTrGrpId == null)
            {
                vmodel.JTrGrpId = "";
            }
            // Session["NullData"] = vmodel.JTrGrpId = "";

            string sql = string.Format("EXEC rptListTran '" + finyear + "','01','" + vmodel.BranchCode + "','" + vmodel.JTrGrpId.Trim() + "','" + vmodel.fDate.ToString("MM-dd-yyyy") + "','" + vmodel.toDate.ToString("MM-dd-yyyy") + "'");
            List <JarnalVoucher> glReport = _jarnalVoucherService.SqlQueary(sql).ToList();
            // Session["Data"] = glReport;
            //if (glReport.Count == 0)
            //{
            //    string errMsg = "Data not found !!!";
            //    return RedirectToAction("Search", "ListOfTransaction", new { errMsg });
            //}
            //else
            //{
            double amt = 0;
            List <JarnalVoucher> sList = new List <JarnalVoucher>();  //InWord.ConvertToWords(amt.ToString()).ToList();

            foreach (var item in glReport)
            {
                //if (item.CrAmount != 0)
                // {
                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);
                // }
            }
            return(View("~/Views/ListOfTransaction/TransactionList.cshtml", sList));
            //}
        }
        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\""
            });
            //}
        }
        //public SelectList GardenSelection()
        //{

        //    var UserName = User.Identity.Name;
        //    var brans = _employeeService.All().Where(x => x.Email == UserName).ToList().FirstOrDefault();
        //    var UserId = brans.Id;
        //    var items = _userbranchService.All().ToList().Where(x => x.Userid == UserId.ToString()).ToList();
        //    List<Branch> branchList = new List<Branch>();
        //    foreach (var item in items)
        //    {
        //        var branch = _BranchService.All().ToList().FirstOrDefault(x => x.BranchCode == item.BranchCode);
        //        branchList.Add(branch);
        //    }
        //    branchList.Insert(0, new Branch() { BranchCode = "0", BranchName = "---- Select ----" });
        //    //List<Branch> BranchCode = new SelectList(branchList, "BranchCode", "BranchName");
        //    return new SelectList(branchList.OrderBy(x => x.BranchCode), "BranchCode", "BranchName");

        //}
        public ActionResult GetSummaryReport(RptSearchVModel vmodel, string finyear)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(vmodel.fDate), Convert.ToString(vmodel.toDate), Session["FinYear"].ToString());

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

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

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

            Session["Branch"]     = (vmodel.BranchCode == null) ? "" : vmodel.BranchCode;
            Session["LedgerType"] = vmodel.LedgerTypeCode;
            Session["fDate"]      = vmodel.fDate;
            Session["tDate"]      = vmodel.toDate;
            if (vmodel.LevelNo == null)
            {
                vmodel.LevelNo = "0";
            }

            Session["LevelNo"] = vmodel.LevelNo;
            //  Session["LevelNo"] = vmodel.LevelNo;



            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.toDate);
            ViewBag.foDate     = vmodel.fDate.ToString("MM/dd/yyyy");
            ViewBag.toDate     = vmodel.toDate.ToString("MM/dd/yyyy");
            ViewBag.LocCode    = vmodel.LocCode;//----location---//
            ViewBag.BranchCode = vmodel.BranchCode;
            if (vmodel.BranchCode != null && vmodel.BranchCode != "0")
            {
                ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == vmodel.BranchCode.Trim()).BranchName.ToString();
            }
            else
            {
                ViewBag.Branch = "All";
            }
            //---------------Location---------------------------//

            if (vmodel.LocCode != null && vmodel.LocCode != "0")
            {
                ViewBag.Location = _locationService.All().FirstOrDefault(x => x.LocCode == vmodel.LocCode.Trim()).LocName.ToString();
            }
            else
            {
                ViewBag.Location = "All";
            }

            finyear = Session["FinYear"].ToString();
            if (vmodel.LevelNo == null)
            {
                vmodel.LevelNo = "0";
            }

            string sql = string.Format(" EXEC " + rptCap.SP_Name + " '" + finyear + "','01','" + vmodel.LocCode + "','" + vmodel.fDate.ToString("MM/dd/yyyy") + "','" + vmodel.toDate.ToString("MM/dd/yyyy") + "','" + vmodel.DisControl + "','" + vmodel.LevelNo + "'");
            List <SummaryReport> summaryReport = _SumRptService.SqlQueary(sql).ToList();

            Session["Discardcntl"] = vmodel.DisControl;
            //if (summaryReport.Count == 0)
            //{
            //    string errMsg = "There is no data in this combination. Please try again !!!";
            //    return RedirectToAction("Search", "SummaryReport", new { errMsg });
            //}
            //else
            //{
            if (rptCap.RptCap == "Stock Summary")
            {
                return(View("~/Views/SummaryReport/GetSummaryStockReport.cshtml", summaryReport));
            }
            //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(summaryReport));
            //}
        }
Example #9
0
        public ActionResult rptSalesCollectionComparisonPdf(RptSearchVModel vmodel, string finyear)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(vmodel.fDate), Convert.ToString(vmodel.tDate), Session["FinYear"].ToString());

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

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

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

            finyear            = Session["FinYear"].ToString();
            ViewBag.SubCode    = vmodel.SubCode;
            ViewBag.ProjCode   = vmodel.projCode;
            ViewBag.BranchCode = vmodel.BranchCode;
            ViewBag.fDate      = InWord.GetAbbrMonthNameDate(vmodel.fDate);
            ViewBag.tDate      = InWord.GetAbbrMonthNameDate(vmodel.tDate);
            String BranchCode = vmodel.BranchCode;

            ViewBag.BranchName = "All";
            if (BranchCode != "")
            {
                ViewBag.BranchName = _BranchService.All().Where(s => s.BranchCode == BranchCode).Select(x => x.BranchName).FirstOrDefault();
            }



            //For us Culture Ex: 0.00
            const string culture = "en-US";

            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.GetCultureInfo(culture);
            System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
            System.Threading.Thread.CurrentThread.CurrentUICulture = ci;


            string sql_1 = string.Format("exec rpt_salescolcomparison_det  '" + vmodel.fDate.ToString("yyyy-MM-dd") + "','" + vmodel.tDate.ToString("yyyy-MM-dd") + "','" + vmodel.projCode + "','" + vmodel.BranchCode + "' ,'" + Session["UserName"] + "'  ");
            string sql_2 = string.Format("exec rpt_salescolcomparison_foot   '" + vmodel.fDate.ToString("yyyy-MM-dd") + "','" + vmodel.tDate.ToString("yyyy-MM-dd") + "','" + vmodel.projCode + "','" + vmodel.BranchCode + "','" + Session["UserName"] + "'  ");

            // string sql_1 = string.Format("exec rpt_salescolcomparison_det  '" + vmodel.fDate.ToString("yyyy-MM-dd") + "','" + vmodel.tDate.ToString("yyyy-MM-dd") + "','" + vmodel.projCode + "','" + vmodel.BranchCode + "' ");
            //string sql_2 = string.Format("exec rpt_salescolcomparison_foot   '" + vmodel.fDate.ToString("yyyy-MM-dd") + "','" + vmodel.tDate.ToString("yyyy-MM-dd") + "','" + vmodel.projCode + "','" + vmodel.BranchCode + "' ");
            IEnumerable <SalesCollectionComparisionVM> VchrLst;
            SalesCollectionComparisionVM yearlyData = new SalesCollectionComparisionVM();

            //IEnumerable<SalesCollectionComparisionVM > yearlyData;

            using (AcclineERPContext dbContext = new AcclineERPContext())
            {
                VchrLst = dbContext.Database.SqlQuery <SalesCollectionComparisionVM>(sql_1).ToList();
                //yearlyData = dbContext.Database.SqlQuery<SalesCollectionComparisionVM>(sql_2).FirstOrDefault();
                yearlyData = dbContext.Database.SqlQuery <SalesCollectionComparisionVM>(sql_2).FirstOrDefault();
            }
            ViewBag.yearlyDataV = yearlyData;
            return(new Rotativa.ViewAsPdf("rptSalesCollectionComparisonPdf", "", VchrLst)
            {
                PageOrientation = Rotativa.Options.Orientation.Portrait,
                PageSize = Rotativa.Options.Size.A4,
                CustomSwitches = "--footer-left \"Reporting Date: " + DateTime.Now.ToString("dd-MM-yyyy") + "\" " + "--footer-right \"Page: [page] of [toPage]\" --footer-line --footer-font-size \"9\" --footer-spacing 5 --footer-font-name \"calibri light\""
            });
        }
Example #10
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("StockLedgerRpt", "StockLedgerRpt", 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("StockLedgerRpt", "StockLedgerRpt", new { errMsg }));
            }
            vmodel.BranchCode      = (vmodel.BranchCode == null) ? "" : vmodel.BranchCode;
            Session["Branch"]      = vmodel.BranchCode;
            vmodel.AccountCode     = (vmodel.AccountCode == null) ? "" : vmodel.AccountCode;
            Session["AccountCode"] = vmodel.AccountCode;
            Session["fDate"]       = vmodel.fDate;
            Session["tDate"]       = vmodel.toDate;


            var ledger = _LedgerCapService.All().ToList().FirstOrDefault(x => x.SP_Name == "rptStoreLedger");


            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 != "" && vmodel.BranchCode != "0")
            {
                ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == vmodel.BranchCode.Trim()).BranchName.ToString();
            }
            else
            {
                ViewBag.Branch = "All";
            }
            if (vmodel.AccountCode != "")
            {
                ViewBag.Account = _ItemService.All().FirstOrDefault(x => x.ItemCode == vmodel.AccountCode.Trim()).ItemName.ToString();
            }
            else
            {
                ViewBag.Account = "All";
            }

            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));
        }
Example #11
0
        public ActionResult ReportLedgerPdf(RptSearchVModel vmodel, string finyear)
        {
            vmodel.BranchCode     = Session["Branch"].ToString();
            vmodel.LedgerTypeCode = Session["LedgerType"].ToString();
            vmodel.AccountCode    = Session["AccountCode"].ToString();
            //vmodel.fDate = Session["fDate"].;
            //vmodel.tDate = Session["tDate"].ToString();
            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;
            if (vmodel.BranchCode != null)
            {
                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();
            }

            ViewBag.PrintDate = DateTime.Now.ToShortDateString();

            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();
            //if (rptLedger.Count == 0)
            //{
            //    string errMsg = "There is no data in this combination. Please try again !!!";
            //    return RedirectToAction("Search", "Report", new { 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(new Rotativa.ViewAsPdf("ReportLedgerPdf", rptLedger)
            {
                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\""
            });
        }
Example #12
0
        public ActionResult GetSale_collection(RptSearchVModel vmodel, string finyear)
        {
            finyear            = Session["FinYear"].ToString();
            ViewBag.fDate      = InWord.GetAbbrMonthNameDate(vmodel.fDate);
            ViewBag.tDate      = InWord.GetAbbrMonthNameDate(vmodel.tDate);
            ViewBag.SubCode    = vmodel.SubCode;
            ViewBag.ProjCode   = vmodel.projCode;
            ViewBag.BranchCode = vmodel.BranchCode;
            ViewBag.LocCode    = vmodel.LocCode;
            String Location = vmodel.LocCode;

            ViewBag.Location = "All";
            if (Location != null)
            {
                ViewBag.Location = _ILocationAppService.All().ToList().Where(s => s.LocCode == Location).Select(x => x.LocName).FirstOrDefault();
            }


            // For checked current finyear
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(vmodel.fDate), Convert.ToString(vmodel.toDate), Session["FinYear"].ToString());

            if (ChkFYR != "")
            {
                // return RedirectToAction("Sales_CollectionSearch", "rptSales_Collection", new { errMsg = ChkFYR });
            }
            //For us Culture Ex: 0.00
            const string culture = "en-US";
            CultureInfo  ci      = CultureInfo.GetCultureInfo(culture);

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

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

            if (!rUser.HasPermission("AgeingReport(Marketing)_Preview"))
            {
                string errMsg = "No Preview Permission for this User !!";
                return(RedirectToAction("Sales_CollectionSearch", "rptSales_Collection", new { errMsg }));
            }


            string sql = string.Format("exec sp_fageCalcu_L_5Col_New  '" + vmodel.fDate.ToString("yyyy-MM-dd") + "','" + vmodel.tDate.ToString("yyyy-MM-dd") + "','" + vmodel.LocCode + "','" + Session["FinYear"].ToString() + "','" + Session["UserName"] + "'  ");



            //string sql = string.Format("exec sp_fageCalcu_L_5Col_New  '" + vmodel.fDate.ToString("yyyy-MM-dd") + "','" + vmodel.tDate.ToString("yyyy-MM-dd") + "','" + vmodel.LocCode + "','" + Session["FinYear"].ToString() + "'");

            IEnumerable <Sale_CollectionVM> VchrLst;

            using (AcclineERPContext dbContext = new AcclineERPContext())
            {
                VchrLst = dbContext.Database.SqlQuery <Sale_CollectionVM>(sql).ToList();
            }

            return(new Rotativa.ViewAsPdf("rptSales_CollectionPdf", "", VchrLst)
            {
                PageOrientation = Rotativa.Options.Orientation.Portrait,
                PageSize = Rotativa.Options.Size.A4,
                CustomSwitches = "--footer-left \"Reporting Date: " + DateTime.Now.ToString("dd-MM-yyyy") + "\" " + "--footer-right \"Page: [page] of [toPage]\" --footer-line --footer-font-size \"9\" --footer-spacing 5 --footer-font-name \"calibri light\""
            });
        }