using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace DabirKhane
{
    public partial class chap : Form
    {
       
        public chap()
        {
            InitializeComponent();
        }

        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(Variables.masir);
            con.Open();
            SqlDataAdapter Dr = new SqlDataAdapter(Variables.GozareshComand , con);
            DataSet ds = new DataSet();
            Dr.Fill(ds,Variables.TableName );
            if (Variables.REPbool == true)
            {
                ReportErsali cr = new ReportErsali();
                crystalReportViewer1.ReportSource = cr;
                cr.SetDataSource(ds.Tables["ersali"]);
            }
            else
            {
                ReportDaryafti cr = new ReportDaryafti();
                crystalReportViewer1.ReportSource = cr;
                cr.SetDataSource(ds.Tables["daryafti"]);
            }

            con.Close();
        }
    }
}