public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrpPartyLedger rpt = new CrpPartyLedger(); rpt.Site = this.Site; return(rpt); }
public void ShowLedger(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.PartyID=" + vPartyID); if (dt2.Rows.Count > 0) { vPartyName = dt2.Rows[0]["PartyName"].ToString(); vPartyAddress = dt2.Rows[0]["Address"].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) { CrpPartyLedgerLH Rpt = new CrpPartyLedgerLH(); 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 { CrpPartyLedger Rpt = new CrpPartyLedger(); 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"); } }