Пример #1
0
        private void SalesBillPrivew_Load(object sender, EventArgs e)
        {
            string         s  = "Select i.Item_Name as [Item],s.Quantity as [Qty],i.ITEM_RETAIL_PRICE as [Price],s.Quantity*i.ITEM_RETAIL_PRICE as [Amount] from tbl_Item i Join tbl_Sales s on i.Item_id=s.Itemno where s.BillNo=" + SchoolManagement.salesbillno;
            SqlDataAdapter da = new SqlDataAdapter(s, d.con);
            DataSet        ds = new DataSet();

            da.Fill(ds);


            SalesBill sb = new SalesBill();

            sb.SetDataSource(ds.Tables[0]);
            sb.SetParameterValue("BillNo", SchoolManagement.salesbillno);
            sb.SetParameterValue("Admno", SchoolManagement.sladmno);
            sb.SetParameterValue("Name", SchoolManagement.slname);
            sb.SetParameterValue("Discount", SchoolManagement.sldiscount);
            sb.SetParameterValue("TotalAmount", SchoolManagement.sltotal);
            //sb.SetParameterValue("SchoolName", SchoolManagement.SchoolName);
            sb.SetParameterValue("SchoolName", "Nizamia Public School");
            sb.SetParameterValue("DT", DateTime.Now.ToString());
            sb.SetParameterValue("std", SchoolManagement.rptstd);
            sb.SetParameterValue("div", SchoolManagement.rptdiv);
            sb.SetParameterValue("Addr", "Pothencode, Trivandrum");
            sb.SetParameterValue("Phone", "0471-6444002");
            crystalReportViewer1.ReportSource = sb;
        }
Пример #2
0
        private void Load_Report(string BillNo)
        {
            string         s   = "Select i.Item_Name as [Item],s.Quantity as [Qty],i.ITEM_RETAIL_PRICE as [Price],s.Quantity*i.ITEM_RETAIL_PRICE as [Amount] from tbl_Item i Join tbl_Sales s on i.Item_id=s.Itemno where s.BillNo=" + BillNo;
            SqlDataAdapter da1 = new SqlDataAdapter(s, d.con);
            DataSet        ds1 = new DataSet();

            da1.Fill(ds1);


            SalesBill sb = new SalesBill();

            sb.SetDataSource(ds1.Tables[0]);

            string         SQL = "Select sm.admno,s.sname,sm.Discount,sm.Amount,Convert(varchar(20),sm.CurrDate,101),s.cstandard,std.division from tbl_SalesMaster sm inner join tbl_student s on s.adno=sm.admno inner join tbl_stddivision std on std.adno=s.adno where sm.BillNo=" + BillNo;
            SqlDataAdapter da  = new SqlDataAdapter(SQL, d.con);
            DataSet        ds  = new DataSet();

            da.Fill(ds);
            DataRow dr;

            if (ds.Tables[0].Rows.Count >= 1)
            {
                dr = ds.Tables[0].Rows[0];
                sb.SetParameterValue("BillNo", BillNo);
                sb.SetParameterValue("Admno", dr[0].ToString());
                sb.SetParameterValue("Name", dr[1].ToString());
                sb.SetParameterValue("Discount", dr[2].ToString());
                sb.SetParameterValue("TotalAmount", dr[3].ToString());
                sb.SetParameterValue("SchoolName", "Nizamia Public School");
                sb.SetParameterValue("DT", dr[4].ToString());
                sb.SetParameterValue("std", dr[5].ToString());
                sb.SetParameterValue("div", dr[6].ToString());
                sb.SetParameterValue("Addr", "Pothencode, Trivandrum");
                sb.SetParameterValue("Phone", "0471-6444002");
                crystalReportViewer1.ReportSource = sb;
            }


            /*sb.SetParameterValue("BillNo", SchoolManagement.salesbillno);
             * sb.SetParameterValue("Admno", SchoolManagement.sladmno);
             * sb.SetParameterValue("Name", SchoolManagement.slname);
             * sb.SetParameterValue("Discount", SchoolManagement.sldiscount);
             * sb.SetParameterValue("TotalAmount", SchoolManagement.sltotal);
             * //sb.SetParameterValue("SchoolName", SchoolManagement.SchoolName);
             * sb.SetParameterValue("SchoolName", "Nizamia Public School");
             * sb.SetParameterValue("DT", DateTime.Now.ToString());
             * sb.SetParameterValue("std", SchoolManagement.rptstd);
             * sb.SetParameterValue("div", SchoolManagement.rptdiv);
             * sb.SetParameterValue("Addr", "Pothencode, Trivandrum");
             * sb.SetParameterValue("Phone", "0471-6444002");
             * crystalReportViewer1.ReportSource = sb;*/
        }