Beispiel #1
0
        private void Print_Bill(string strDonHangID)
        {
            PhieuBanHang_58 rp = new PhieuBanHang_58();  // new PhieuBanHang();

            rp.SetDataSource(reportsController.prtDonHang(strDonHangID));
            rp.Refresh();
            ThongTinShop shop = ThongTinShopController.GetItem();

            rp.SetParameterValue("TenShop", shop.TenShop);
            rp.SetParameterValue("DiaChi", shop.DiaChi);
            rp.SetParameterValue("SoDienThoai", shop.SoDienThoai);
            rp.SetParameterValue("WebSite", shop.website);
            frmViewReports fReport = null;

            foreach (Form item in MdiChildren)
            {
                if (item.GetType() == typeof(frmViewReports))
                {
                    fReport = (item as frmViewReports);
                    fReport.crystalReportViewer1.ReportSource = rp;
                    fReport.Activate();
                    return;
                }
            }
            fReport = new frmViewReports();
            fReport.crystalReportViewer1.ReportSource = rp;
            //fReport.MdiParent = this.MdiParent;
            fReport.ShowDialog(this);
        }
Beispiel #2
0
        private void gr_btn_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            int intRow = gridView1.FocusedRowHandle;

            if ((intRow >= 0) && (gridView1.GetRowCellValue(intRow, "DonHangID") != null))
            {
                string strDonHangID = gridView1.GetRowCellValue(intRow, "DonHangID").ToString();
                switch (e.Button.Caption.ToUpper())
                {
                case "PRINT":
                    PhieuBanHang_58 rp = new PhieuBanHang_58();      // new PhieuBanHang();
                    rp.SetDataSource(reportsController.prtDonHang(strDonHangID));
                    rp.Refresh();
                    ThongTinShop shop = ThongTinShopController.GetItem();
                    rp.SetParameterValue("TenShop", shop.TenShop);
                    rp.SetParameterValue("DiaChi", shop.DiaChi);
                    rp.SetParameterValue("SoDienThoai", shop.SoDienThoai);
                    rp.SetParameterValue("WebSite", shop.website);
                    frmViewReports fReport = null;
                    foreach (Form item in MdiChildren)
                    {
                        if (item.GetType() == typeof(frmViewReports))
                        {
                            fReport = (item as frmViewReports);
                            fReport.crystalReportViewer1.ReportSource = rp;
                            fReport.Activate();
                            return;
                        }
                    }
                    fReport = new frmViewReports();
                    fReport.crystalReportViewer1.ReportSource = rp;
                    fReport.MdiParent = this.MdiParent;
                    fReport.Show();
                    break;

                case "DEL":
                    if (MessageBox.Show("Bạn muốn xóa đơn hàng này", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        DonHangController.Del(strDonHangID);
                        gridControl1.DataSource = DonHangController.GetAllList();
                    }
                    break;

                case "VIEW":
                    DonHang viewItem = DonHangController.GetItem(strDonHangID);
                    if (viewItem != null)
                    {
                        frmAddDonHang f = new frmAddDonHang();
                        f.ViewItem  = viewItem;
                        f.forMode   = "view";
                        f.MdiParent = this.MdiParent;
                        f.Show();
                        this.Dispose();
                    }
                    break;

                default:
                    break;
                }
            }
        }
Beispiel #3
0
        private void btnPrinterTest_Click(object sender, EventArgs e)
        {
            //tao source de in thu don hang

            DataTable TblPrinter = new DataTable();

            TblPrinter.Columns.Add(new DataColumn("DonHangID", typeof(string)));
            TblPrinter.Columns.Add(new DataColumn("TenKhachHang", typeof(string)));
            TblPrinter.Columns.Add(new DataColumn("NgayBan", typeof(DateTime)));
            TblPrinter.Columns.Add(new DataColumn("NhanVienID", typeof(string)));
            TblPrinter.Columns.Add(new DataColumn("GhiChu", typeof(string)));
            TblPrinter.Columns.Add(new DataColumn("TienHang", typeof(decimal)));
            TblPrinter.Columns.Add(new DataColumn("GiamGia", typeof(decimal)));
            TblPrinter.Columns.Add(new DataColumn("TongCong", typeof(decimal)));
            TblPrinter.Columns.Add(new DataColumn("ThanhToan", typeof(decimal)));
            TblPrinter.Columns.Add(new DataColumn("ConNo", typeof(decimal)));
            TblPrinter.Columns.Add(new DataColumn("KhachDua", typeof(decimal)));
            TblPrinter.Columns.Add(new DataColumn("TienThua", typeof(decimal)));
            TblPrinter.Columns.Add(new DataColumn("TenSanPham", typeof(string)));
            TblPrinter.Columns.Add(new DataColumn("Size", typeof(string)));
            TblPrinter.Columns.Add(new DataColumn("SoLuong", typeof(int)));
            TblPrinter.Columns.Add(new DataColumn("DonGia", typeof(decimal)));

            foreach (DataRow item in tblDonHangChiTiet.Rows)
            {
                TblPrinter.Rows.Add(
                    "000",
                    lookUpEditKhachHang.Text,
                    dateEditNgayBan.DateTime,
                    txtNhanVien.EditValue,
                    txtGhiChu.Text,
                    txtTienHang.EditValue == null ? 0 : txtTienHang.EditValue,
                    txtGiamGia.EditValue == null ? 0 : txtGiamGia.EditValue,
                    txtTong.EditValue == null ? 0 : txtTong.EditValue,
                    txtThanhToan.EditValue == null ? 0 : txtThanhToan.EditValue,
                    txtConNo.EditValue == null ? 0 : txtConNo.EditValue,
                    txtKhachDua.EditValue == null ? 0 : txtKhachDua.EditValue,
                    txtTienThua.EditValue == null ? 0 : txtTienThua.EditValue,
                    item["TenSanPham"].ToString(),
                    item["Size"] is null?"": item["Size"].ToString(),
                    Convert.ToDecimal(item["SoLuong"].ToString()),
                    Convert.ToDecimal(item["DonGia"].ToString())
                    );
            }
            ////-------------------------------------------------------
            //PhieuTam rp = new PhieuTam();
            PhieuBanHang_58 rp = new PhieuBanHang_58();

            rp.SetDataSource(TblPrinter);
            rp.Refresh();
            ThongTinShop shop = ThongTinShopController.GetItem();

            rp.SetParameterValue("TenShop", shop.TenShop);
            rp.SetParameterValue("DiaChi", shop.DiaChi);
            rp.SetParameterValue("SoDienThoai", shop.SoDienThoai);
            rp.SetParameterValue("WebSite", shop.website);
            frmViewReports fReport = null;

            foreach (Form item in MdiChildren)
            {
                if (item.GetType() == typeof(frmViewReports))
                {
                    fReport = (item as frmViewReports);
                    fReport.crystalReportViewer1.ReportSource = rp;
                    fReport.Activate();
                    return;
                }
            }
            fReport = new frmViewReports();
            fReport.crystalReportViewer1.ReportSource = rp;
            fReport.MdiParent = this.MdiParent;
            fReport.Show();
        }