public ActionResult SalesCollectionStatementRptPdf(DateTime fDate, DateTime tDate, string ProjCode, string BranchCode, string FinYear)
        {
            ViewBag.BranchName = "All";
            if (BranchCode != "")
            {
                String BranchName = _BranchService.All().Where(s => s.BranchCode == BranchCode).Select(x => x.BranchName).FirstOrDefault();
                ViewBag.BranchName = BranchName;
            }

            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(fDate), Convert.ToString(tDate), Session["FinYear"].ToString());

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

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

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



            string customerGroup = "";
            //rpt_SP_SalesCollectionStat_1  @fdate smalldatetime, @tdate smalldatetime, @ProjCode varchar(3), @BranchCode varchar(3),@FinYear varchar(7), @customerGroup varchar(7)

            string sql = string.Format("EXEC rpt_SP_SalesCollectionStat_1 '" + fDate.ToString("yyyy/MM/dd") + "','" + tDate.ToString("yyyy/MM/dd") + "','" + ProjCode + "', '" + BranchCode + "', '" + FinYear + "','" + customerGroup + "' "); //,'" + Session["UserName"] + "'


            //string sql = string.Format("EXEC rpt_SP_SalesCollectionStat_1 '" + fDate.ToString("yyyy/MM/dd") + "','" + tDate.ToString("yyyy/MM/dd") + "','" + ProjCode + "', '" + BranchCode + "', '" + FinYear + "','"+ customerGroup +"'");
            IEnumerable <SalesCollectionStat> VchrLst;

            using (AcclineERPContext dbContext = new AcclineERPContext())
            {
                VchrLst = dbContext.Database.SqlQuery <SalesCollectionStat>(sql).ToList();
            }
            ViewBag.BranchCode = _BranchService.All().Where(s => s.BranchCode == BranchCode).Select(x => x.BranchName).FirstOrDefault();
            //ViewBag.fDate = fDate.ToString("dd-MMM-yyyy");
            //ViewBag.tDate = tDate.ToString("dd-MMM-yyyy");
            ViewBag.fDate = InWord.GetAbbrMonthNameDate(fDate);
            ViewBag.tDate = InWord.GetAbbrMonthNameDate(tDate);

            //For us Culture Ex: 0.00
            const string culture = "en-US";
            CultureInfo  ci      = CultureInfo.GetCultureInfo(culture);

            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;
            //Response.AppendHeader("Content-Disposition", "inline; filename=" + RptName + "_" + DateTime.Now.ToShortDateString() + ".pdf");
            return(new Rotativa.ViewAsPdf("rptSalesCollectionStatePdf", "", 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\""
            });
        }
Esempio n. 2
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));
            }
        }
        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\""
            });
        }
        public ActionResult Sample_GiftRptPdf(string LocCode, DateTime fDate, DateTime tDate)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(fDate), Convert.ToString(tDate), Session["FinYear"].ToString());

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

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

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



            ViewBag.fDate = InWord.GetAbbrMonthNameDate(fDate);
            ViewBag.tDate = InWord.GetAbbrMonthNameDate(tDate);


            ViewBag.Location = "All";


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


            List <Sample_giftRptVM> finalList = new List <Sample_giftRptVM>(); List <String> IssueIdList = new List <String>();

            if (LocCode == "")
            {
                IssueIdList = _IIssueMainService.All().Where(x => x.IssueDate > fDate && x.IssueDate < tDate).Select(s => s.IssueNo).ToList();
            }
            else
            {
                IssueIdList = _IIssueMainService.All().Where(x => x.IssueDate > fDate && x.IssueDate < tDate && x.FromLocCode == LocCode).Select(s => s.IssueNo).ToList();
            }
            foreach (var IssueId in IssueIdList)
            {
                Sample_giftRptVM item = new Sample_giftRptVM();
                var DetailList        = _IssueDetailsAppService.All().FirstOrDefault(x => x.IssueNo == IssueId);
                var Mainlist          = _IIssueMainService.All().FirstOrDefault(x => x.IssueNo == IssueId);
                item.No       = IssueId;
                item.date     = Mainlist.IssueDate.ToShortDateString();
                item.Type     = _INewChartAppService.All().Where(x => x.Accode == Mainlist.DesLocCode).Select(x => x.AcName).FirstOrDefault();
                item.Lot      = DetailList.LotNo;
                item.Quantity = DetailList.Qty;
                item.U_Price  = DetailList.Price;
                item.Amount   = Mainlist.Amount;
                item.Given_To = _ISubsidiaryInfoService.All().Where(x => x.SubCode == Mainlist.ToLocCode).Select(x => x.SubName).FirstOrDefault();
                finalList.Add(item);
            }

            //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("~/Views/Sample_Gift/Sample_GiftRptPdf.cshtml", finalList)
            {
                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\""
            });

            //return View(finalList);
        }
Esempio n. 5
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 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));
            //}
        }
        public ActionResult contStatementReportPdf(string ProjName, string BrName, string RptName)
        {
            RBACUser rUser = new RBACUser(Session["UserName"].ToString());

            if (!rUser.HasPermission("Montly_Amount_Quantity_Rpt_Preview"))
            {
                string errMsg = "No View Permission for this User !!";
                //return RedirectToAction("ContStatementRpt", "ContStatementRpt", new { errMsg, RptCaption = CaptionName });
                return(RedirectToAction("ContStatementRpt", "ContStatementRpt", new { errMsg }));
            }


            string   spName      = "";
            string   CaptionName = "";
            string   FinYear     = Session["FinYear"].ToString();
            DateTime fSMonth     = _FYDDService.All().FirstOrDefault(s => s.FinYear == FinYear).FYDF;
            var      sMonth      = fSMonth.Month;

            if (RptName == "rptContStatement")
            {
                CaptionName = "rptContStatement";


                spName = "Exec rptContStatement '" + ProjName + "','" + BrName + "','" + FinYear + "','" + sMonth + "'";
            }
            else
            if (RptName == "rptCumlBal")
            {
                CaptionName = "rptCumlBal";
                spName      = "Exec rptCumlBalPrepare '" + ProjName + "','" + BrName + "','" + FinYear + "','" + sMonth + "'"; //"rptCumlBal";
            }
            else
            {
                CaptionName = "rptProfitDistribution";
                spName      = "Exec rptProfitDistribution '" + ProjName + "','" + BrName + "','" + FinYear + "','" + sMonth + "'";
            }

            ViewBag.PrintDate = DateTime.Now.ToShortDateString();
            AcclineERPContext     dbContext     = new AcclineERPContext();
            string                sql           = string.Format(spName);
            List <MontlyQuantity> contStatement = dbContext.Database.SqlQuery <MontlyQuantity>(sql).ToList(); //_rptContStatementService.SqlQueary(sql).ToList();

            if (contStatement.Count == 0)
            {
                string errMsg = "There is no data in this combination. Please try again !!!";
                return(RedirectToAction("ContStatementRpt", "ContStatementRpt", new { errMsg, RptCaption = CaptionName }));
            }
            else
            {
                var FY   = FinYear;
                var fydd = _FYDDService.All().ToList().FirstOrDefault(x => x.FinYear == FinYear);
                ViewBag.Fdate     = fydd.FYDF;
                ViewBag.Tdate     = fydd.FYDT;
                ViewBag.EndedYear = _FYDDService.All().ToList().FirstOrDefault(x => x.FinYear == FinYear).FYDT;
                ViewBag.SCriteria = GetCompanyInfo.GetReportCriteria(ProjName, BrName, null, null, FinYear);
                ViewBag.rptName   = RptName;
                Response.AppendHeader("Content-Disposition", "inline; filename=" + RptName + "_" + DateTime.Now.ToShortDateString() + ".pdf");
                return(new Rotativa.ViewAsPdf("contStatementReportPdf", contStatement)
                {
                    PageOrientation = Rotativa.Options.Orientation.Landscape,
                    PageSize = Rotativa.Options.Size.A4,
                    //FileName = RptName + "-" + DateTime.Now.ToShortDateString() + ".pdf" , contStatementReportPdf
                    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\""
                });
            }
        }
Esempio n. 8
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\""
            });
        }
Esempio n. 9
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));
        }
Esempio n. 10
0
        public ActionResult PendingRptPdf(DateTime fDate, DateTime tDate)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(Convert.ToString(fDate), Convert.ToString(tDate), Session["FinYear"].ToString());

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

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

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

            ViewBag.fDate = InWord.GetAbbrMonthNameDate(fDate);
            ViewBag.tDate = InWord.GetAbbrMonthNameDate(tDate);

            List <PendingNotEncashRptVM> finalList = new List <PendingNotEncashRptVM>();
            List <MoneyReceipt>          MRList    = new List <MoneyReceipt>();
            List <ChequeReceipt>         CRList    = new List <ChequeReceipt>();



            //ChequeReceipt itemob2 = new ChequeReceipt();

            //MoneyReceipt MoneyReceipt = new MoneyReceipt();
            //List<String> MRIdList = new List<String>();


            MRList = _IMoneyReceiptAppService.All().Where(x => x.EncashDate == null).ToList();
            CRList = _IChequeReceiptAppService.All().Where(x => x.ChqStatus == null).ToList();


            foreach (var item in MRList)
            {
                PendingNotEncashRptVM itemob = new PendingNotEncashRptVM();

                itemob.MRSL     = item.MRSL;
                itemob.MRNo     = item.MRNo;
                itemob.MRDate   = item.MRDate;
                itemob.CustCode = item.CustCode;
                //itemob.ChkAmount = "";
                itemob.MRAmount = item.MRAmount;
                itemob.Remarks  = item.Remarks;

                finalList.Add(itemob);
            }


            foreach (var item in CRList)
            {
                PendingNotEncashRptVM itemob = new PendingNotEncashRptVM();
                itemob.MRSL      = item.MRSL;
                itemob.MRNo      = item.ChqReceiptNo;
                itemob.MRDate    = item.ChqReceiptDate;
                itemob.CustCode  = item.SubCode;
                itemob.ChkAmount = item.Amount;
                // itemob.MRAmount = item.MRAmount;
                itemob.Remarks = item.Remarks;

                finalList.Add(itemob);
            }



            //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("~/Views/Pending/PendingRptPdf.cshtml", finalList)
            {
                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\""
            });

            //return View(finalList);
        }
        public ActionResult ScheduleRptPdf(string AccountCode, string BranchCode, string UnitCode, string DeptCode, string fDate, string toDate)
        {
            var ChkFYR = GetCompanyInfo.ValidateFinYearDateRange(fDate, toDate, Session["FinYear"].ToString());

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

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

            if (!rUser.HasPermission("RptSchedule_Preview"))
            {
                string errMsg = "No View Permission for this User !!";
                return(RedirectToAction("ScheduleRpt", "ScheduleRpt", new { errMsg }));
            }
            string      ProjCode = "01";
            VMDynSysSet DsSet    = new VMDynSysSet();

            DsSet.DynaCap = _dynaCapService.All().ToList().FirstOrDefault();
            if (AccountCode != "")
            {
                ViewBag.Account = _NewChartService.All().FirstOrDefault(x => x.Accode == AccountCode.Trim()).AcName.ToString();
            }
            else
            {
                ViewBag.Account = "All";
            }

            ViewBag.RptCap  = "Schedule Report of " + ViewBag.Account;
            ViewBag.Col1Cap = "Code";
            ViewBag.Col2Cap = "Name";
            ViewBag.Col3Cap = "Opening";
            ViewBag.Col4Cap = "Dr. Amount";
            ViewBag.Col5Cap = "Cr. Amount";
            ViewBag.Col6Cap = "Balance";
            ViewBag.fDate   = fDate;
            ViewBag.tDate   = toDate;

            var    sysSet = _sysSetService.All().FirstOrDefault();
            string CriteriaBranch = ""; string CriteriaUnit = "";

            if (sysSet.HasBranch == true)
            {
                if (BranchCode != "")
                {
                    ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == BranchCode.Trim()).BranchName.ToString();
                }
                else
                {
                    ViewBag.Branch = "All";
                }
                CriteriaBranch = DsSet.DynaCap.Branch + ": " + ViewBag.Branch + ", ";
            }
            if (sysSet.HasUnit == true)
            {
                CriteriaUnit = DsSet.DynaCap.Unit + ": " + LoadDropDown.LoadUnitInfo(UnitCode) + ", ";
            }
            ViewBag.Criteria = CriteriaBranch + CriteriaUnit + DsSet.DynaCap.Dept + ": " + LoadDropDown.LoadDeptInfo(DeptCode);

            string sql                       = string.Format("EXEC rptSchedule '" + Session["FinYear"] + "','" + ProjCode + "','" + BranchCode + "','" + UnitCode + "','" + DeptCode + "','" + Convert.ToDateTime(fDate).ToString("yyyy-MM-dd") + "','" + Convert.ToDateTime(toDate).ToString("yyyy-MM-dd") + "','" + AccountCode + "'");
            List <SummaryReport> rptSchedule = _summaryReportService.SqlQueary(sql).ToList();

            if (rptSchedule.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("rptSchedulePdf", rptSchedule)
            {
                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\""
            });
        }
Esempio n. 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\""
            });
        }