I have a crystal report viewer and crystal.rpt page.
I want to group all item in one page that have similar company name in particular date
i write following code:
private void Frm_Sale_Invoice_Load(object sender, EventArgs e)
{
int companyID =Convert.ToInt32(Global.CompanyID);
string date = Global.SaleDate;
ReportDocument rpt = new ReportDocument();
DS_SaleInvoice ds = new DS_SaleInvoice();
SqlConnection con = new SqlConnection("server=SHASHA-PC; Initial Catalog=globalprint; uid=sa; pwd=shasha22pal;");
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("Select s.SaleId,Convert(varchar, s.Date, 103) as Date,cm.company_name,s.income_source,s.colour,s.quantity,s.rate,s.total, s.vat_tax, s.Grand_Total from table_Sales s,tbl_companymaster cm where s.companyId=cm.companyId and s.CompanyId="+companyID+" and s.Date=CONVERT(datetime, '"+date+"', 103) order by s.SaleId", con);
da.Fill(dt);
ds.Tables[0].Merge(dt);
rpt.Load("E:\\raj pen\\Live Recent\\PrintAndBack\\PrintAndBack\\Sale_Invoice.rpt");
rpt.SetDataSource(ds);
CRV_Sale.ReportSource = rpt;
}
in datatable has 2 rows:
saleid date companyname incomesource color quantity rate total vat_tax grand_Total
102 29/02/2012 abc xyz front b/w 10 10 100 10 110
103 29/02/2012 abc hkf color back 11 10 110 10 120
and i want to print that item in crystal report like as follows:
Buyer Name: Companyname Date: date
incomesource color quantity rate total vat_tax grand_total
xyz front B/w 10 10 100 10 110
hkf color back 11 10 110 10 120
Total 230
two hundred thirty rupees.
please help me!!
Thanking you!