private void butshow_Click(object sender, EventArgs e) { temp(); string str = " 1 = 1"; if (combpro4.SelectedIndex == 0) { str = "where cusID='" + combcust4.SelectedValue + "' "; } else { str = " where cusID='" + combcust4.SelectedValue + "'and proID='" + combpro4.SelectedValue + "' "; } // get fist comm report form ReportForm frm = new ReportForm(); ledgerReportCR rpt = new ledgerReportCR(); // get data from sql //str ="select Customer,Product,cusID,proID,CONVERT(VARCHAR, Submit_date,103) AS Submit_date,Amount,Total,balance_left from cash_book"; DataTable dt = new DataTable(); SqlDataAdapter Da2 = new SqlDataAdapter("select cash_book.Customer,cash_book.Product,cusID,proID,CONVERT(VARCHAR, Submit_date,103) AS Submit_date,Amount,Total,AdvanceCost from cash_book inner join purchase on purchase.Purchase_id=cash_book.Pur_ID " + str, Class1.Cnn); Da2.Fill(dt); // set data for report object rpt.SetDataSource(dt); // set report for showing object (crystal report viwer) frm.crystalReportViewer1.ReportSource = rpt; // show report form frm.ShowDialog(); }
private void butprint_Click(object sender, EventArgs e) { // get fist comm report form ReportForm frm = new ReportForm(); // create report object Bill rpt = new Bill(); // get data from sql DataTable dt = new DataTable(); SqlDataAdapter Da2 = new SqlDataAdapter("select Refno,After_Discount,billing.Company_name,Product_Type,Service_Tax,purchase.Product,BillAmt,Tax_Amount,CONVERT(VARCHAR, Bill_date,103) AS Bill_date,Client_name,Client_add,Client_mob from billing inner join purchase on billing.Purchase_ID = purchase.Purchase_id inner Join customer on customer.Client_id = purchase.Customer_ID where billing.BillId='" + billingID.Text.ToString() + "' ", Class1.Cnn); Da2.Fill(dt); // set data for report object rpt.SetDataSource(dt); // set report for showing object (crystal report viwer) frm.crystalReportViewer1.ReportSource = rpt; // show report form frm.ShowDialog(); }