public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrpPartyLedger2 rpt = new CrpPartyLedger2(); rpt.Site = this.Site; return(rpt); }
public void ShowPartyLedger(string vPartyID, string vRange, DateTime vFromDate, DateTime vToDate, DataTable dt, bool LetterHead = false) { try { DataTable dt1, dt2; string vPartyName = string.Empty; string vPartyAddress = string.Empty; objDAL.connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["MyString"].ConnectionString; dt1 = objDAL.getCompanyInfo(); dt2 = objDAL.getPartiesList(" AND Parties.AccountID='" + vPartyID + "'"); if (dt2.Rows.Count > 0) { vPartyName = dt2.Rows[0]["PartyName"].ToString(); vPartyAddress = dt2.Rows[0]["Address"].ToString(); if (!string.IsNullOrEmpty(dt2.Rows[0]["ContactNo"].ToString())) { vPartyAddress += "(" + dt2.Rows[0]["ContactNo"].ToString() + ")"; } } else { dt2 = objDAL.getAccountsList(" AND AccountNo='" + vPartyID + "'"); vPartyName = dt2.Rows[0]["AccountTitle"].ToString(); vPartyAddress = dt2.Rows[0]["AccountType"].ToString(); } if (LetterHead) { CrpPartyLedger2LH Rpt = new CrpPartyLedger2LH(); Rpt.Database.Tables[0].SetDataSource(dt); Rpt.Database.Tables[1].SetDataSource(dt1); Rpt.SetParameterValue("PartyID", vPartyID); Rpt.SetParameterValue("PartyName", vPartyName); Rpt.SetParameterValue("PartyAddress", vPartyAddress); Rpt.SetParameterValue("DateRange", vRange); Rpt.SetParameterValue("FromDate", vFromDate); Rpt.SetParameterValue("ToDate", vToDate); this.CRViewer.ReportSource = Rpt; } else { CrpPartyLedger2 Rpt = new CrpPartyLedger2(); Rpt.Database.Tables[0].SetDataSource(dt); Rpt.Database.Tables[1].SetDataSource(dt1); Rpt.SetParameterValue("PartyID", vPartyID); Rpt.SetParameterValue("PartyName", vPartyName); Rpt.SetParameterValue("PartyAddress", vPartyAddress); Rpt.SetParameterValue("DateRange", vRange); Rpt.SetParameterValue("FromDate", vFromDate); Rpt.SetParameterValue("ToDate", vToDate); this.CRViewer.ReportSource = Rpt; } } catch (Exception exc) { MessageBox.Show(exc.Message, "Error"); } }