public ActionResult GetVoucherPreview(string VchrNo, string FinYear) { RBACUser rUser = new RBACUser(Session["UserName"].ToString()); if (!rUser.HasPermission("RptVoucherPreview_Preview")) { string errMsg = "No Preview Permission for this User !!"; return(RedirectToAction("SearchVoucher", "VchrPreview", new { errMsg })); } if (VchrNo != null) { 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; string BranchCode = Session["BranchCode"].ToString(); ViewBag.Branch = _BranchService.All().Where(x => x.BranchCode == BranchCode.Trim()).Select(s => s.BranchName).ToString(); FinYear = Session["FinYear"].ToString(); 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; return(View(rptVchr)); //} } else { string errMsg = "Voucher no is required!"; return(RedirectToAction("SearchVoucher", "VchrPreview", new { errMsg })); } }
public ActionResult GetMoneyReceiptPdf(string ReceiptNo) { RBACUser rUser = new RBACUser(Session["UserName"].ToString()); if (!rUser.HasPermission("MoneyReceiptCash_Print")) { string errMsg = "P"; return(RedirectToAction("CashMoneyReceipt", "CashMoneyReceipt", new { errMsg })); } MoneyReceiptVM MRVM = new MoneyReceiptVM(); var cashRPfd = _moneyReceiptService.All().FirstOrDefault(x => x.MRNo == ReceiptNo && x.PayMode == "Ca"); if (cashRPfd != null) { MRVM.MRNo = cashRPfd.MRNo; MRVM.CustCode = cashRPfd.CustCode.Trim(); MRVM.CustName = (from s in _subsidiaryInfoService.All().ToList() where s.SubCode == cashRPfd.CustCode.Trim() select s.SubName).FirstOrDefault(); MRVM.Address = (from se in _SubsidiaryExtService.All().ToList() where se.SubCode.Trim() == cashRPfd.CustCode.Trim() select se.SubAddress).FirstOrDefault(); MRVM.InWord = InWord.ConvertToWords(Convert.ToString(cashRPfd.MRAmount)); MRVM.AcType = _newChartService.All().FirstOrDefault(s => s.Accode == cashRPfd.Accode).AcName; MRVM.MRDate = cashRPfd.MRDate; #region //For us Culture Ex: 0.00 const string culture = "en-US"; CultureInfo ci = CultureInfo.GetCultureInfo(culture); Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci; #endregion MRVM.Amount = Convert.ToDecimal(cashRPfd.MRAmount); MRVM.PayMode = "Ca"; return(new Rotativa.ViewAsPdf("~/Views/CashReceipt/MoneyReceiptPdf.cshtml", MRVM) { PageSize = Rotativa.Options.Size.A4 }); } else { //string errMsg = "E"; //return RedirectToAction("CashOperation", "CashOperation", new { errMsg }); MRVM.PayMode = "Ca"; return(new Rotativa.ViewAsPdf("~/Views/CashReceipt/MoneyReceiptPdf.cshtml", MRVM) { PageSize = Rotativa.Options.Size.A4 }); } }
public ActionResult GetVoucherPreview(string VchrNo, string FinYear) { 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; string BranchCode = Session["BranchCode"].ToString(); ViewBag.Branch = _BranchService.All().FirstOrDefault(x => x.BranchCode == BranchCode.Trim()).BranchName.ToString(); FinYear = Session["FinYear"].ToString(); 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; return(View("~/Views/VchrPreview/GetVoucherPreview.cshtml", rptVchr)); //} }
public ActionResult GetMoneyReceiptPdf(string ReceiptNo) { MoneyReceiptVM MRVM = new MoneyReceiptVM(); var crPfd = _chequeReceiptService.All().FirstOrDefault(x => x.ChqReceiptNo == ReceiptNo); if (crPfd != null) { var todayDate = DateTime.Now; var TingCount = _chequeReceiptService.All().FirstOrDefault(x => x.ChqReceiptNo == ReceiptNo); TingCount.MRTing = TingCount.MRTing + 1; TingCount.MRTingTime = todayDate.AddHours(todayDate.Hour).AddMinutes(todayDate.Minute).AddSeconds(todayDate.Second).AddMilliseconds(todayDate.Millisecond); MRVM.MRNo = crPfd.ChqReceiptNo; MRVM.CustCode = crPfd.SubCode.Trim(); MRVM.ChequeDate = (DateTime)crPfd.ChqDate; MRVM.CustName = (from s in _subsidiaryService.All().ToList() where s.SubCode == crPfd.SubCode.Trim() select s.SubName).FirstOrDefault(); MRVM.Address = (from se in _SubsidiaryExtService.All().ToList() where se.SubCode.Trim() == crPfd.SubCode.Trim() select se.SubAddress).FirstOrDefault(); MRVM.InWord = InWord.ConvertToWords(crPfd.Amount.ToString()); MRVM.AcType = LoadDropDown.GetMrAgainst(crPfd.MRAgainst); MRVM.MRDate = crPfd.ChqReceiptDate; MRVM.Amount = crPfd.Amount; MRVM.PayMode = "ChequeReceipt"; MRVM.ChequeNo = crPfd.ChqNo; MRVM.BankName = _bankInfoService.All().FirstOrDefault(s => s.BankCode == crPfd.BankCode).BankName;; MRVM.Branch = crPfd.BranchName; _chequeReceiptService.Update(TingCount); _chequeReceiptService.Save(); return(new Rotativa.ViewAsPdf("~/Views/CashReceipt/MoneyReceiptPdf.cshtml", MRVM) { PageSize = Rotativa.Options.Size.A4 }); } else { string errMsg = "NF"; return(RedirectToAction("ChequeReceipts", "ChequeReceipts", new { errMsg })); } }
//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 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 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 }); } //} }