示例#1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            crpDsKhachHang MyReport = new crpDsKhachHang();

            BindingSource gdSource = new BindingSource();

            gdSource = (BindingSource)this.dataGridView1.DataSource;
            MyReport.SetDataSource(gdSource.DataSource);
            MyReport.SetParameterValue("Nguoi_Sdung", DatLoa.NameReturn("TEN_NHAN_VIEN", "TB_NHAN_VIEN", "MA_NHAN_VIEN = '" + UserInformation.MaNV + "'"));

            frmReportViewer f = new frmReportViewer();

            f.crystalReportViewer1.ReportSource = MyReport;
            f.ShowDialog();
        }
示例#2
0
        private void PRINT_XUAT()
        {
            crpHoaDonXuat MyReport = new crpHoaDonXuat();
            BindingSource gdSource = new BindingSource();

            gdSource = (BindingSource)this.dataGridView1.DataSource;
            MyReport.SetDataSource(gdSource.DataSource);
            MyReport.SetParameterValue("Nhan_Vien", lblTenNV.Text);
            MyReport.SetParameterValue("Ma_HD", lblMaHD.Text);
            MyReport.SetParameterValue("Chi_Nhanh", lblDv.Text);
            if (lblTenKH.Text != "")
            {
                MyReport.SetParameterValue("Khach_Hang", lblTenKH.Text);
            }
            else
            {
                MyReport.SetParameterValue("Khach_Hang", "Khách vãng lai");
            }
            MyReport.SetParameterValue("SDT", lblSDT.Text);
            //Tính tạm tính
            int tamtinh = 0;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                tamtinh = tamtinh + Convert.ToInt32(dataGridView1.Rows[i].Cells["TAM_TINH_O"].Value.ToString());
            }
            MyReport.SetParameterValue("Tam_Tinh", tamtinh);
            //__________________________________________________________________
            //Tính chiết khấu
            int chietkhau = 0;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                chietkhau = chietkhau + Convert.ToInt32(dataGridView1.Rows[i].Cells["CHIET_KHAU"].Value.ToString());
            }
            chietkhau = chietkhau + Convert.ToInt32(txtTienChieuKhauHD.Text);
            MyReport.SetParameterValue("Chiet_Khau", chietkhau);
            //__________________________________________________________________
            MyReport.SetParameterValue("Tong_Tien", Convert.ToInt32(txtTongtienHD.Text));
            MyReport.SetParameterValue("Khach_Tra", Convert.ToInt32(txtKhachtra.Text));
            MyReport.SetParameterValue("Con_Lai", Convert.ToInt32(txtConlai.Text));
            MyReport.SetParameterValue("Tien_Chu", lblTienThanhChu.Text);
            MyReport.SetParameterValue("So_Luong", txtTongSL.Text);
            frmReportViewer f = new frmReportViewer();

            f.crystalReportViewer1.ReportSource = MyReport;
            f.ShowDialog();
        }
示例#3
0
        private void btnIn_Click(object sender, EventArgs e)
        {
            crpBC_TonKho  MyReport = new crpBC_TonKho();
            BindingSource gdSource = new BindingSource();

            gdSource = (BindingSource)this.dataGridView1.DataSource;
            MyReport.SetDataSource(gdSource.DataSource);
            MyReport.SetParameterValue("Nguoi_Sdung", DatLoa.NameReturn("TEN_NHAN_VIEN", "TB_NHAN_VIEN", "MA_NHAN_VIEN = '" + UserInformation.MaNV + "'"));
            if (DatLoa.NameReturn("TEN_DVI", "TB_DVI", "MA_DVI = '" + txtDvi.Text + "'") == "")
            {
                MyReport.SetParameterValue("Chi_Nhanh", "Tất cả Chi Nhánh");
            }
            else
            {
                MyReport.SetParameterValue("Chi_Nhanh", DatLoa.NameReturn("TEN_DVI", "TB_DVI", "MA_DVI = '" + txtDvi.Text + "'"));
            }

            if (DatLoa.NameReturn("TEN_NHOM_HANG", "TB_NHOM_HANG", "MA_NHOM_HANG = '" + txtNhom.Text + "'") == "")
            {
                MyReport.SetParameterValue("Nhom_Hang", "Tất cả Nhóm Hàng");
            }
            else
            {
                MyReport.SetParameterValue("Nhom_Hang", DatLoa.NameReturn("TEN_NHOM_HANG", "TB_NHOM_HANG", "MA_NHOM_HANG = '" + txtNhom.Text + "'"));
            }

            if (DatLoa.NameReturn("TEN_HANG", "TB_MAT_HANG", "MA_HANG = '" + txtMaHang.Text + "'") == "")
            {
                MyReport.SetParameterValue("Mat_Hang", "Tất cả Mặt Hàng");
            }
            else
            {
                MyReport.SetParameterValue("Mat_Hang", DatLoa.NameReturn("TEN_HANG", "TB_MAT_HANG", "MA_HANG = '" + txtMaHang.Text + "'"));
            }

            MyReport.SetParameterValue("Ngay", String.Format("{0:dd/MM/yyyy}", Convert.ToDateTime(dDate.Text)));

            frmReportViewer f = new frmReportViewer();

            f.crystalReportViewer1.ReportSource = MyReport;
            f.ShowDialog();
        }