Ejemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CustDetailsPrint rpt = new CustDetailsPrint();

            rpt.Site = this.Site;
            return(rpt);
        }
Ejemplo n.º 2
0
        private void PrintDetails_Load(object sender, EventArgs e)
        {
            Payroll  pr = new Payroll();
            Customer cr = new Customer();

            string          MyConnectionString;
            MySqlConnection con;

            //MySqlDataReader rdr;

            MyConnectionString = "Server=localhost;Database=csms;Uid=corpinfo;Pwd=kvvk;";
            con = new MySqlConnection(MyConnectionString);
            con.Open();


            if (Test_GUI_for_Inventory_App.Validations.flagReport == "Emp")
            {
                string       stm = "SELECT * from employee_details where emp_id='" + payroll_emp_id + "'";
                MySqlCommand cmd = new MySqlCommand(stm, con);


                //csmsDataSet ds = new csmsDataSet();

                DataSet ds = new DataSet();

                MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();

                myDataAdapter.SelectCommand = cmd;

                myDataAdapter.Fill(ds, "employee_details");


                //ds.Fill(ds, "Product");
                //MessageBox.Show(ds.Tables[1].Rows.Count.ToString());
                //con.Close();



                EmpDetailsPrint objRpt = new EmpDetailsPrint();
                objRpt.SetDataSource(ds);
                crystalReportViewer1.ReportSource = objRpt;
                crystalReportViewer1.Refresh();
            }

            else if (Test_GUI_for_Inventory_App.Validations.flagReport == "Cust")
            {
                string       stm = "SELECT * from cust_details where cust_id='" + customer_cust_id + "'";
                MySqlCommand cmd = new MySqlCommand(stm, con);


                //csmsDataSet ds = new csmsDataSet();

                DataSet ds = new DataSet();

                MySqlDataAdapter myDataAdapterCust = new MySqlDataAdapter();

                myDataAdapterCust.SelectCommand = cmd;

                myDataAdapterCust.Fill(ds, "cust_details");


                //ds.Fill(ds, "Product");
                //MessageBox.Show(ds.Tables[1].Rows.Count.ToString());
                //con.Close();



                CustDetailsPrint objRpt = new CustDetailsPrint();
                objRpt.SetDataSource(ds);
                crystalReportViewer1.ReportSource = objRpt;
                crystalReportViewer1.Refresh();
            }

            else if (Test_GUI_for_Inventory_App.Validations.flagReport == "Supp")
            {
                string       stm = "SELECT * from dealer_details where dealer_id='" + supplier_supp_id + "'";
                MySqlCommand cmd = new MySqlCommand(stm, con);


                //csmsDataSet ds = new csmsDataSet();

                DataSet ds = new DataSet();

                MySqlDataAdapter myDataAdapterCust = new MySqlDataAdapter();

                myDataAdapterCust.SelectCommand = cmd;

                myDataAdapterCust.Fill(ds, "dealer_details");


                //ds.Fill(ds, "Product");
                //MessageBox.Show(ds.Tables[1].Rows.Count.ToString());
                //con.Close();



                SuppDetailsPrint objRpt = new SuppDetailsPrint();
                objRpt.SetDataSource(ds);
                crystalReportViewer1.ReportSource = objRpt;
                crystalReportViewer1.Refresh();
            }

            else if (Test_GUI_for_Inventory_App.Validations.flagReport == "Bill")
            {
                //string stm = "SELECT a.model_id, a.amount, a.quantity, b.total_amount from sale_item a, cust_bill b where a.sale_order_id=b.sale_order_id and a.sale_order_id='" + bill_order_id + "'";
                string       stm = "SELECT model_id, amount, quantity, sale_order_id from sale_item where sale_order_id='" + bill_order_id + "'";
                MySqlCommand cmd = new MySqlCommand(stm, con);


                //csmsDataSet ds = new csmsDataSet();

                DataSet ds = new DataSet();
                //DataSet ds1 = new DataSet();

                MySqlDataAdapter myDataAdapterCust = new MySqlDataAdapter();

                myDataAdapterCust.SelectCommand = cmd;

                myDataAdapterCust.Fill(ds, "sale_item");
                //myDataAdapterCust.Fill(ds1, "cust_bill");

                //ds.Fill(ds, "Product");
                //MessageBox.Show(ds.Tables[1].Rows.Count.ToString());
                //con.Close();



                Invoice objRpt = new Invoice();
                objRpt.SetDataSource(ds);
                //objRpt.SetDataSource(ds1);
                crystalReportViewer1.ReportSource = objRpt;
                crystalReportViewer1.Refresh();
            }
        }