public static string PrintVoucher(string VoucherType, string VoucherNo, string VoucherDate) { string SqlQuery = string.Format("Select (Select Description From VoucherType Where Code = dbo.vwLedger.VoucherTypeCode) as VoucherDesc, (Select CompName From Companies Where CompCode = LEFT(dbo.vwLedger.BranchCode,2)) AS CompanyName, [Date], [Year] + '-' + [MONTH] + '-' + VoucherTypeCode + '-' + CAST(ISNULL(VoucherCode,0) AS Varchar) as VoucherNo, VoucherCode, VoucherTypeCode as VoucherType,RTRIM(VoucherTypeCode) + '-' + CAST(ISNULL(VoucherCode,0) AS Varchar) as VocuherTyepeAndCode, Naration, BranchCode, BranchDesc, AccountsCode, AccountsDesc, BankAccountCode,Cheque,PreparedBy,CheckedBy,ApprovedBy,Debit,Credit from dbo.vwLedger WHERE VoucherTypeCode= '{0}' AND VoucherCode={1} AND [Date]='{2}'", VoucherType, VoucherNo, GlobalFunctions.GetSqlDate(VoucherDate)); HttpContext.Current.Session["SqlQuery"] = SqlQuery; HttpContext.Current.Session["ReportFileName"] = HttpContext.Current.Server.MapPath("/Reports/" + "rptPrintVoucher.rpt"); HttpContext.Current.Session["DatabaseName"] = "Accounts"; return("1"); }
public static string FillGrid(string DBName, string SqlQuery) { if (HttpContext.Current.Session["UserName"] == null) { return("Error: You are not logged-in."); } DBClass db = new DBClass(DBName); db.Con.Open(); db.Com.CommandText = SqlQuery; string Json = (new System.Web.Script.Serialization.JavaScriptSerializer()).Serialize(GlobalFunctions.GetRowsForJson(db.Com)); db.Con.Close(); db = null; return(Json); }