Esempio n. 1
0
        private void btnBanHang_Click(object sender, EventArgs e)
        {
            ChiTietHDBanBUS        BUS = new ChiTietHDBanBUS();
            List <ChiTietHDBanDTO> DTO = BUS.LOADCTHDB(txtMaHDBan.Text);

            dgvDSCTHDB.DataSource = DTO;
        }
Esempio n. 2
0
        private void LocalReport_SubreportProcessingHDBX(object sender, SubreportProcessingEventArgs e)
        {
            string             mahdb = e.Parameters["pMaHDB"].Values[0];
            ChiTietHDBanBUS    bus   = new ChiTietHDBanBUS();
            List <SP_CTHDBDTO> hdb   = bus.LOADCTHDXUAT(mahdb);

            e.DataSources.Add(new ReportDataSource("dsCTHDBX", hdb));
        }
Esempio n. 3
0
        private void LocalReport_SubreportProcessingHDBHuy(object sender, SubreportProcessingEventArgs e)
        {
            string                 mahdb = e.Parameters["pMaHD"].Values[0];
            ChiTietHDBanBUS        bus   = new ChiTietHDBanBUS();
            List <ChiTietHDBanDTO> cthdb = bus.LOADCTHDB(mahdb);

            e.DataSources.Add(new ReportDataSource("dsDSCTHDB", cthdb));
        }
Esempio n. 4
0
        //
        // Phương thức event khi nhấn In hoá đơn ở tab hoá đơn
        //
        private void BtnIn4_Click(object sender, EventArgs e)
        {
            int   maNV = new TaiKhoanBUS().GetMaNV(_tenDN);
            Khach kh   = new Khach(-1, txtK4.Text, txtDC4.Text, txtSDT4.Text);

            new KhachBUS().Add(kh);

            int   maKH = new KhachBUS().GetMaKH(txtK4.Text);
            HDBan hdb  = new HDBan(-1, maKH, maNV, dtNgTT4.Value, Convert.ToInt32(txtThanhTien4.Text));

            new HDBanBUS().Add(hdb);
            int maHDB = new ChiTietHDBanBUS().GetMaHDB(maKH, maNV);

            try
            {
                for (int i = 0; i < gridData4.Rows.Count - 1; i++)
                {
                    int          maSP    = new SanPhamBUS().GetMaSP(gridData4.Rows[i].Cells[0].Value.ToString());
                    int          soLuong = Convert.ToInt32(gridData4.Rows[i].Cells[1].Value.ToString());
                    int          tong    = Convert.ToInt32(gridData4.Rows[i].Cells[3].Value.ToString());
                    ChiTietHDBan cthdb   = new ChiTietHDBan(maHDB, maSP, soLuong, tong);
                    new ChiTietHDBanBUS().Add(cthdb);
                }

                MessageBox.Show("Đã lưu hoá đơn vào ổ đĩa D");
                frmCryReport f = new frmCryReport
                {
                    _tenKH    = txtK4.Text,
                    _maHDB    = maHDB,
                    _tenNV    = new TaiKhoanBUS().GetTenNV(_tenDN),
                    _ngLap    = dtNgTT4.Value,
                    _tongTien = txtThanhTien4.Text
                };
                f.Show();
            }
            catch
            {
                MessageBox.Show("Kiểm tra lại thông tin");

                new HDBanBUS().Delete(maHDB.ToString());

                new KhachBUS().Delete(kh);
                int i = Convert.ToInt32(gridData2.Rows[gridData2.RowCount - 1].Cells[0].Value.ToString());
                new KhachBUS().Reset(i);

                gridData4.DataSource = new HDBanBUS().LoadHD();
                gridData4.Refresh();

                i = Convert.ToInt32(gridData3.Rows[gridData3.RowCount - 1].Cells[0].Value.ToString());

                new SanPhamBUS().Reset(i);
            }
        }
Esempio n. 5
0
        //
        // Phương thức event form load
        //
        private void FCryReport_Load(object sender, EventArgs e)
        {
            ReportDocument objrep = new CrystalReport1();

            provider.Connect();

            List <ChiTietHDBan> list = new ChiTietHDBanBUS().LoadHD();

            objrep.SetDataSource(list);
            rv.ReportSource = objrep;
            rv.Refresh();

            ParameterDiscreteValue pdv1 = new ParameterDiscreteValue();
            ParameterDiscreteValue pdv2 = new ParameterDiscreteValue();
            ParameterDiscreteValue pdv3 = new ParameterDiscreteValue();
            ParameterDiscreteValue pdv4 = new ParameterDiscreteValue();
            ParameterDiscreteValue pdv5 = new ParameterDiscreteValue();

            pdv1.Value = _maHDB;
            pdv2.Value = _tenKH;
            pdv3.Value = _tenNV;
            pdv4.Value = _ngLap;
            pdv5.Value = _tongTien;

            ParameterValues pv1 = new ParameterValues();
            ParameterValues pv2 = new ParameterValues();
            ParameterValues pv3 = new ParameterValues();
            ParameterValues pv4 = new ParameterValues();
            ParameterValues pv5 = new ParameterValues();

            pv1.Add(pdv1);
            pv2.Add(pdv2);
            pv3.Add(pdv3);
            pv4.Add(pdv4);
            pv5.Add(pdv5);

            objrep.DataDefinition.ParameterFields["MaHD"].ApplyCurrentValues(pv1);
            objrep.DataDefinition.ParameterFields["TenKH"].ApplyCurrentValues(pv2);
            objrep.DataDefinition.ParameterFields["TenNV"].ApplyCurrentValues(pv3);
            objrep.DataDefinition.ParameterFields["NgLap"].ApplyCurrentValues(pv4);
            objrep.DataDefinition.ParameterFields["TT"].ApplyCurrentValues(pv5);

            provider.Disconnect();

            try
            {
                objrep.ExportToDisk(ExportFormatType.PortableDocFormat, "D:\\Report.pdf");
            }
            catch
            {
                MessageBox.Show("In hoá đơn không thành công");
            }
        }