private void button1_Click(object sender, System.EventArgs e) { if (this.txtName.Text != "") { frmViewReport oViewReport = new frmViewReport(); Boolean nView = true; DataSet ds1; //ds1 = oMySql.get_rep_charges(this.CompanyID, txtRepID.Text); ds1 = Global.oMySql.GetDataset(String.Format("Select r.Name, ch.RepID, ChargeID, Date, Description, Description_1, Description_2, Charge from rep_charges ch left Join Reps r On r.ID=ch.Rep_ID Where ch.Rep_Id='{0}' ORDER BY Date DESC", oRep.RepID), "tmp"); detail_rep_charges oRpt1 = new detail_rep_charges(); oRpt1.SetDataSource(ds1); //ds1.WriteXml("..\\Reports\\dataset1.xml", XmlWriteMode.WriteSchema); if (nView) { this.Text = "Detail Rep Charges"; oViewReport.cReport.ReportSource = oRpt1; oViewReport.Show(); } // oRpt1.PrintToPrinter(1, true, 1, 100); } }
private void PrintFrm_Click(object sender, System.EventArgs e) { //"Select ch.RepID, r.Name, ChargeID, Date, Description, Description_1, Description_2, Charge from rep_charges ch LEFT JOIN Rep r On ch.RepID=r.RepID And ch.CompanyID=r.CompanyID Where ch.CompanyID ='" + sCompanyID + "' ORDER BY ch.CompanyID,ch.RepID,Date" frmViewReport oViewReport = new frmViewReport(); Boolean nView = true; DataSet ds1; //ds1 = oMySql.get_rep_charges(this.CompanyID, txtRepID.Text); ds1 = Global.oMySql.GetDataset(String.Format("Select ch.RepID, rs.Name, ChargeID, Date, Description, Description_1, Description_2, Charge from rep_charges ch left join Reps rs On rs.ID=ch.Rep_ID LEFT JOIN Rep r On ch.RepID=r.RepID And ch.CompanyID=r.CompanyID Where ch.CompanyID ='{0}' ORDER BY ch.CompanyID,ch.RepID,Date", this.CompanyID), "tmp"); detail_rep_charges_summary oRpt1 = new detail_rep_charges_summary(); oRpt1.SetDataSource(ds1); //ds1.WriteXml("..\\Reports\\dataset1.xml", XmlWriteMode.WriteSchema); if (nView) { this.Text = "Summary Rep Charges"; oViewReport.cReport.ReportSource = oRpt1; oViewReport.Show(); } // oRpt1.PrintToPrinter(1, true, 1, 100); }