Esempio n. 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            cryRepItemTrans rpt = new cryRepItemTrans();

            rpt.Site = this.Site;
            return(rpt);
        }
Esempio n. 2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (lstWarehouses.SelectedIndex == -1)
            {
                glb_function.MsgBox("الرجاء اختيار المخزن");
                lstWarehouses.Focus();
                return;
            }

            if (lstItems.SelectedIndex == -1)
            {
                glb_function.MsgBox("الرجاء اختيار الصنف");
                lstItems.Focus();
                return;
            }


            cryRepItemTrans    report   = new cryRepItemTrans();
            frmReportContainer frm      = new frmReportContainer();
            DataTable          dtReport = new DataTable();
            ConnectionToMySQL  cnn      = new ConnectionToMySQL();



            dtReport.Clear();

            dtReport = cnn.GetDataTable("SELECT pkid,date_format(trans_date,'%d/%m/%Y') created_date, " +
                                        " trans_name, trans_no, qty, 0 Balance " +
                                        " FROM item_trans " +
                                        " where warehouse_id = " + lstWarehouses.SelectedValue.ToString() + " and item_id =" + lstItems.SelectedValue.ToString() +
                                        " order by trans_date");


            double dBalance = 0;

            for (int i = 0; i < dtReport.Rows.Count; i++)
            {
                dtReport.Rows[i]["Balance"] = Convert.ToDouble(dtReport.Rows[i]["qty"].ToString()) + dBalance;
                dBalance = Convert.ToDouble(dtReport.Rows[i]["Balance"].ToString());
            }



            report.SetDataSource(dtReport);
            report.SetParameterValue("From", lstWarehouses.Text);
            report.SetParameterValue("To", lstItems.Text);


            frm.CrystalReportsViewer1.ReportSource = report;
            frm.ShowDialog();
        }