Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CryReportInHDKhu rpt = new CryReportInHDKhu();

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        private void btIn_Click(object sender, EventArgs e)
        {
            if (rdInAll.Checked == true)
            {
                string          select = "select * from tbl_HoaDon";
                CryReportHoaDon inhd   = new CryReportHoaDon();
                inhd.SetDataSource(ketnoi.laydlbang(select));
                CrtInHoaDon.ReportSource = inhd;
                CrtInHoaDon.Refresh();
            }
            else
            {
                if (rdmahd.Checked == true)
                {
                    string          select = "select * from tbl_HoaDon where Mahdon='" + cbchon.Text + "'";
                    CryReportHoaDon inhd   = new CryReportHoaDon();
                    inhd.SetDataSource(ketnoi.laydlbang(select));
                    CrtInHoaDon.ReportSource = inhd;
                    CrtInHoaDon.Refresh();
                }
                else
                {
                    if (rdPhong.Checked == true)
                    {
                        string          select = "select * from tbl_HoaDon where Mapsv='" + cbchon.Text + "'";
                        CryReportHoaDon inhd   = new CryReportHoaDon();
                        inhd.SetDataSource(ketnoi.laydlbang(select));
                        CrtInHoaDon.ReportSource = inhd;
                        CrtInHoaDon.Refresh();
                    }

                    else
                    {
                        if (rdngay.Checked == true)
                        {
                            if (dtgtu.Value <= dtgden.Value)
                            {
                                string          select = "select * from tbl_HoaDon where Ngaylap BETWEEN '" + dtgtu.Text + "' AND '" + dtgden.Text + "'";
                                CryReportHoaDon inhd   = new CryReportHoaDon();
                                inhd.SetDataSource(ketnoi.laydlbang(select));
                                CrtInHoaDon.ReportSource = inhd;
                                CrtInHoaDon.Refresh();
                            }
                            else
                            {
                                MessageBox.Show("Kiểm tra lại ngày . từ ngày < ngày đến!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        else
                        {
                            if (rdkhu.Checked == true)
                            {
                                if (dtgtu.Value <= dtgden.Value)
                                {
                                    string           select = "SELECT * FROM View_hoadonkhu Where Makhu='" + cbchon.Text + "' and Ngaylap BETWEEN '" + dtgtu.Text + "' AND '" + dtgden.Text + "' ";
                                    CryReportInHDKhu inhd   = new CryReportInHDKhu();
                                    inhd.SetDataSource(ketnoi.laydlbang(select));
                                    CrtInHoaDon.ReportSource = inhd;
                                    CrtInHoaDon.Refresh();
                                }
                                else
                                {
                                    MessageBox.Show("Kiểm tra lại ngày . từ ngày <= ngày đến!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                            else
                            {
                                MessageBox.Show("Bạn hãy chọn mục để in!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
            }
        }