private void Load_rptWare_Banhang_Congno_Thu()
        {
            try
            {
                System.Collections.Hashtable hashtableControls = new System.Collections.Hashtable();
                hashtableControls.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
                hashtableControls.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);

                if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls))
                {
                    return;
                }

                if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
                {
                    return;
                }

                DataSet ds_Congnothu = objWareService.Get_RptWare_Banhang_Congno_Thu(dtNgay_Batdau.EditValue, dtNgay_Ketthuc.EditValue, lookUpEdit_TenKH.EditValue).ToDataSet();
                Ecm.Reports.XtraReports.rptWare_Banhang_Congno_Thu _rptWare_Banhang_Congno_Thu = new Ecm.Reports.XtraReports.rptWare_Banhang_Congno_Thu();

                // Thiết lập hệ số chương trình (Logo, thông tin công ty)
                setHesoChuongtrinh(_rptWare_Banhang_Congno_Thu.xrc_CompanyName, _rptWare_Banhang_Congno_Thu.xrc_CompanyAddress, _rptWare_Banhang_Congno_Thu.xrPic_Logo);
                _rptWare_Banhang_Congno_Thu.xrTable_tungay.Text  = dtNgay_Batdau.DateTime.ToString("dd/MM/yyyy");
                _rptWare_Banhang_Congno_Thu.xrTable_Denngay.Text = dtNgay_Ketthuc.DateTime.ToString("dd/MM/yyyy");

                _rptWare_Banhang_Congno_Thu.xrTable_Ngay.Text  = DateTime.Today.Day.ToString();
                _rptWare_Banhang_Congno_Thu.xrTable_Thang.Text = DateTime.Today.Month.ToString();
                _rptWare_Banhang_Congno_Thu.xrTable_Nam.Text   = DateTime.Today.Year.ToString();
                _rptWare_Banhang_Congno_Thu.DataSource         = ds_Congnothu;
                GoobizFrame.Windows.Forms.FrmPrintPreview _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
                _FrmPrintPreview.Report = _rptWare_Banhang_Congno_Thu;
                _rptWare_Banhang_Congno_Thu.CreateDocument();
                GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_rptWare_Banhang_Congno_Thu);
                if (Convert.ToBoolean(oReportOptions.PrintPreview))
                {
                    _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                    _FrmPrintPreview.printControl1.PrintingSystem = _rptWare_Banhang_Congno_Thu.PrintingSystem;
                    _FrmPrintPreview.MdiParent = this.MdiParent;
                    _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
                    _FrmPrintPreview.Show();
                    _FrmPrintPreview.Activate();
                }
                else
                {
                    var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_rptWare_Banhang_Congno_Thu);
                    ReportPrintTool.Print();
                }
                _FrmPrintPreview.Show();
                _FrmPrintPreview.Activate();
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.Message);
#endif
            }
        }
        private void Load_Rptware_Banhang_Congno_Tonghop()
        {
            System.Collections.Hashtable hashtableControls = new System.Collections.Hashtable();
            hashtableControls.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
            hashtableControls.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);
            //hashtableControls.Add(lookUpEditCuahang_Ban, lblCuahang_Ban.Text);

            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls))
            {
                return;
            }

            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
            {
                return;
            }

            XtraReports.rptWare_Banhang_Congno_Tonghop _rptWare_Banhang_Congno_Tonghop = new Ecm.Reports.XtraReports.rptWare_Banhang_Congno_Tonghop();
            GoobizFrame.Windows.Forms.FrmPrintPreview  _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            _FrmPrintPreview.Report = _rptWare_Banhang_Congno_Tonghop;
            // Thiết lập hệ số chương trình (Logo, thông tin công ty)
            setHesoChuongtrinh(_rptWare_Banhang_Congno_Tonghop.xrc_CompanyName, _rptWare_Banhang_Congno_Tonghop.xrc_CompanyAddress, null);
            DataSet dsReport = objReportService.Rptware_Banhang_Congno_Tonghop_Khuvuc_New(dtNgay_Batdau.EditValue, dtNgay_Ketthuc.EditValue, lookUpEdit_Khachhang.Text, lookUpEditCuahang_Ban.EditValue).ToDataSet();

            _rptWare_Banhang_Congno_Tonghop.DataSource = dsReport;
            _rptWare_Banhang_Congno_Tonghop.xrTableCell_DateFrom.Text = dtNgay_Batdau.Text;
            _rptWare_Banhang_Congno_Tonghop.xrTableCell_DateTo.Text   = dtNgay_Ketthuc.Text;


            _rptWare_Banhang_Congno_Tonghop.xrTable_Ngay.Text  = DateTime.Today.Day.ToString();
            _rptWare_Banhang_Congno_Tonghop.xrTable_Thang.Text = DateTime.Today.Month.ToString();
            _rptWare_Banhang_Congno_Tonghop.xrTable_Nam.Text   = DateTime.Today.Year.ToString();

            //setNgay_Thang_Nam(_rptWare_Banhang_Congno_Tonghop.xrTable_Ngay, _rptWare_Banhang_Congno_Tonghop.xrTable_Thang, _rptWare_Banhang_Congno_Tonghop.xrTable_Nam);

            _rptWare_Banhang_Congno_Tonghop.CreateDocument();
            GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_rptWare_Banhang_Congno_Tonghop);
            if (Convert.ToBoolean(oReportOptions.PrintPreview))
            {
                _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                _FrmPrintPreview.printControl1.PrintingSystem = _rptWare_Banhang_Congno_Tonghop.PrintingSystem;
                _FrmPrintPreview.MdiParent = this.MdiParent;
                _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
                _FrmPrintPreview.Show();
                _FrmPrintPreview.Activate();
            }
            else
            {
                var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_rptWare_Banhang_Congno_Tonghop);
                ReportPrintTool.Print();
            }
            _FrmPrintPreview.Show();
            _FrmPrintPreview.Activate();
        }
Пример #3
0
        private void Load_Rptware_Tonghop_Hoadon_Muahang_Thue()
        {
            try
            {
                System.Collections.Hashtable hashtableControls = new System.Collections.Hashtable();
                hashtableControls.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
                hashtableControls.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);

                if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls))
                {
                    return;
                }
                if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
                {
                    return;
                }
                DataSet dsReport = objReportService.Rptware_Tonghop_Hoadon_Muahang_Thue(dtNgay_Batdau.EditValue, dtNgay_Ketthuc.DateTime.AddHours(23).AddMinutes(59).AddSeconds(59)).ToDataSet();
                Ecm.Reports.XtraReports.rptWare_Tonghop_Hoadon_Muahang_Thue _rptWare_Tonghop_Hoadon_Muahang_Thue = new Ecm.Reports.XtraReports.rptWare_Tonghop_Hoadon_Muahang_Thue();

                setHesoChuongtrinh(_rptWare_Tonghop_Hoadon_Muahang_Thue.xrc_CompanyName, _rptWare_Tonghop_Hoadon_Muahang_Thue.xrc_CompanyAddress, _rptWare_Tonghop_Hoadon_Muahang_Thue.xrPic_Logo);

                // Thiết lập hệ số chương trình (Logo, thông tin công ty)
                _rptWare_Tonghop_Hoadon_Muahang_Thue.Parameters["Tungay"].Value  = dtNgay_Batdau.Text;
                _rptWare_Tonghop_Hoadon_Muahang_Thue.Parameters["Denngay"].Value = dtNgay_Ketthuc.Text;
                _rptWare_Tonghop_Hoadon_Muahang_Thue.DataSource = dsReport;
                GoobizFrame.Windows.Forms.FrmPrintPreview _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
                _FrmPrintPreview.Report = _rptWare_Tonghop_Hoadon_Muahang_Thue;
                _rptWare_Tonghop_Hoadon_Muahang_Thue.CreateDocument();
                GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_rptWare_Tonghop_Hoadon_Muahang_Thue);
                if (Convert.ToBoolean(oReportOptions.PrintPreview))
                {
                    _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                    _FrmPrintPreview.printControl1.PrintingSystem = _rptWare_Tonghop_Hoadon_Muahang_Thue.PrintingSystem;
                    _FrmPrintPreview.MdiParent = this.MdiParent;
                    _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
                    _FrmPrintPreview.Show();
                    _FrmPrintPreview.Activate();
                }
                else
                {
                    var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_rptWare_Tonghop_Hoadon_Muahang_Thue);
                    ReportPrintTool.Print();
                }
                _FrmPrintPreview.Show();
                _FrmPrintPreview.Activate();
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.Message);
#endif
            }
        }
Пример #4
0
        private void Load_Rptware_Muahang_Xuattra_Chitiet()
        {
            System.Collections.Hashtable hashtableControls = new System.Collections.Hashtable();
            hashtableControls.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
            hashtableControls.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);
            hashtableControls.Add(lookUpEditCuahang_Ban, lblCuahang_Ban.Text);

            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls))
            {
                return;
            }
            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
            {
                return;
            }

            XtraReports.rptWare_Muahang_Xuattra_Chitiet _rptWare_Muahang_Xuattra_Chitiet = new Ecm.Reports.XtraReports.rptWare_Muahang_Xuattra_Chitiet();
            // Thiết lập hệ số chương trình (Logo, thông tin công ty)
            setHesoChuongtrinh(_rptWare_Muahang_Xuattra_Chitiet.xrc_CompanyName, _rptWare_Muahang_Xuattra_Chitiet.xrc_CompanyAddress, _rptWare_Muahang_Xuattra_Chitiet.xrPic_Logo);

            _rptWare_Muahang_Xuattra_Chitiet.Parameters["Kho"].Value     = lookUpEditCuahang_Ban.Text;
            _rptWare_Muahang_Xuattra_Chitiet.Parameters["Tungay"].Value  = dtNgay_Batdau.Text;
            _rptWare_Muahang_Xuattra_Chitiet.Parameters["Denngay"].Value = dtNgay_Ketthuc.Text;
            DataSet dsReport = objReportService.Rptware_Muahang_Xuattra_Chitiet(dtNgay_Batdau.EditValue, dtNgay_Ketthuc.EditValue, lookUpEditCuahang_Ban.EditValue, lookUpEdit_Doituong.EditValue).ToDataSet();

            _rptWare_Muahang_Xuattra_Chitiet.DataSource = dsReport;
            GoobizFrame.Windows.Forms.FrmPrintPreview _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            _FrmPrintPreview.Report = _rptWare_Muahang_Xuattra_Chitiet;
            _rptWare_Muahang_Xuattra_Chitiet.CreateDocument();
            GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_rptWare_Muahang_Xuattra_Chitiet);
            if (Convert.ToBoolean(oReportOptions.PrintPreview))
            {
                _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                _FrmPrintPreview.printControl1.PrintingSystem = _rptWare_Muahang_Xuattra_Chitiet.PrintingSystem;
                _FrmPrintPreview.MdiParent = this.MdiParent;
                _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
            }
            else
            {
                var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_rptWare_Muahang_Xuattra_Chitiet);
                ReportPrintTool.Print();
            }
            _FrmPrintPreview.Show();
            _FrmPrintPreview.Activate();
        }
        public override bool PerformPrintPreview()
        {
            Current_Id_Checkin = cvBar_Rent_CheckIn.GetFocusedRowCellValue("Id_Checkin");
            if (Current_Id_Checkin == null)
            {
                GoobizFrame.Windows.Forms.UserMessage.Show("SYS_EMPTY_COLLECTION", new string[] { "danh sách đặt phòng" });
                return(false);
            }
            if ("" + lookUpEdit_RentLevel.EditValue == "")
            {
                GoobizFrame.Windows.Forms.UserMessage.Show("SYS_EMPTY_COLLECTION", new string[] { labelControl19.Text });
                return(false);
            }
            dsbar_Rent_Checkin = objBarService.GetBar_Rent_Checkin_ById4Print(Current_Id_Checkin, lookUpEdit_RentLevel.EditValue, DateTime.Now).ToDataSet();
            Ecm.Bar.DataSets.dsHdbanhang_Chitiet      dsrHdbanhang_Chitiet = new Ecm.Bar.DataSets.dsHdbanhang_Chitiet();
            Ecm.Bar.Reports.rptHdbanhang_Hotel        rptHdbanhang         = new Ecm.Bar.Reports.rptHdbanhang_Hotel();
            GoobizFrame.Windows.Forms.FrmPrintPreview frmPrintPreview      = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            frmPrintPreview.Report = rptHdbanhang;

            int i = 1;

            foreach (DataRow dr in dsbar_Rent_Checkin.Tables[0].Rows)
            {
                if (dr.RowState != DataRowState.Deleted)
                {
                    DataRow drnew = dsrHdbanhang_Chitiet.Tables[0].NewRow();
                    foreach (DataColumn dc in dsbar_Rent_Checkin.Tables[0].Columns)
                    {
                        try
                        {
                            if (drnew.Table.Columns.Contains(dc.ColumnName))
                            {
                                drnew[dc.ColumnName] = dr[dc.ColumnName];
                            }
                        }
                        catch (Exception ex)
                        {
                            GoobizFrame.Windows.TrayMessage.TrayMessage.Status = new GoobizFrame.Windows.TrayMessage.TrayMessageInfo(MessageBoxIcon.Asterisk, ex.Message, ex.ToString());
                            continue;
                        }
                    }
                    drnew["Ten_Hanghoa"] = dr["Ten_Hanghoa"]; // gridLookUp_Hanghoa_Ban_Chitiet.GetDisplayText(dr["Id_Hanghoa_Ban"]);
                    drnew["Dongia_Ban"]  = dr["Dongia"];
                    drnew["Thanhtien"]   = dr["Thanhtien"];
                    drnew["per_dongia"]  = dr["Per_Dongia"];
                    drnew["Stt"]         = i++;
                    dsrHdbanhang_Chitiet.Tables[0].Rows.Add(drnew);
                }
            }
            //add parameter values
            rptHdbanhang.tbc_Ngay.Text       = "" + dtNgay_Chungtu.Text;
            rptHdbanhang.tbcSochungtu.Text   = "" + txtSo_Chungtu.Text;
            rptHdbanhang.lblNhansu_Bill.Text = lookUpEdit_Nhansu_Ctu.Text;
            rptHdbanhang.lblKhachhang.Text   = lookUpEdit_Khachhang.Text;
            DataSet dsOrder_Chitiet;
            decimal thanhtien_order = 0;

            foreach (DataRow row in dsrHdbanhang_Chitiet.Tables["Hdbanhang_Chitiet"].Rows)
            {
                dsOrder_Chitiet = objBarService.Get_Bar_Rent_Checkin_table_Hanghoa_By_Checkin_Table_4Print(row["Id_Bar_Rent_Checkin_Table"]).ToDataSet();
                foreach (DataRow dtr in dsOrder_Chitiet.Tables[0].Rows)
                {
                    dsrHdbanhang_Chitiet.Tables["Order_Chitiet"].ImportRow(dtr);
                }
                thanhtien_order += Convert.ToDecimal("0" + dsOrder_Chitiet.Tables[0].Compute("Sum(Thanhtien)", ""));
            }
            decimal thanhtien = Convert.ToDecimal("0" + dsbar_Rent_Checkin.Tables[0].Compute("Sum(thanhtien)", ""));

            thanhtien += thanhtien_order;
            var da_thanhtoan = objBarService.Get_Bar_Rent_Checkin_Dathanhtoan_ById_Checkin(Current_Id_Checkin);

            thanhtien            -= Convert.ToDecimal("0" + da_thanhtoan);
            rptHdbanhang.PageSize = new Size(800, 1400 + 100 * Convert.ToInt32(dsrHdbanhang_Chitiet.Tables[0].Rows.Count));

            //Trừ tiền cọc
            if (Convert.ToDecimal("0" + da_thanhtoan) > 0)
            {
                decimal Thanhtien_TG = Convert.ToDecimal("0" +
                                                         dsrHdbanhang_Chitiet.Tables[0].Rows[dsrHdbanhang_Chitiet.Tables[0].Rows.Count - 1]["Thanhtien_TG"]);
                Thanhtien_TG -= Convert.ToDecimal(da_thanhtoan);
                dsrHdbanhang_Chitiet.Tables[0].Rows[dsrHdbanhang_Chitiet.Tables[0].Rows.Count - 1]["Thanhtien_TG"] = Thanhtien_TG;
                rptHdbanhang.xrTable_Tien_Booking.Visible = true;
                rptHdbanhang.lblTien_Booking.Text         = string.Format("{0:#,#}", da_thanhtoan);
            }
            else
            {
                rptHdbanhang.xrTable6.Location = new System.Drawing.Point(21, 42);
                rptHdbanhang.xrTable4.Location = new System.Drawing.Point(21, 135);
            }
            decimal thanhtien_order_per_room = 0;

            foreach (DataRow row in dsrHdbanhang_Chitiet.Tables["Hdbanhang_Chitiet"].Rows)
            {
                thanhtien_order_per_room = Convert.ToDecimal("0" + dsrHdbanhang_Chitiet.Tables["Order_Chitiet"].Compute("Sum(Thanhtien)", "Id_Bar_Rent_Checkin_Table = " + row["Id_Bar_Rent_Checkin_Table"]));
                row["Total_Per_Room"]    = Convert.ToDecimal("0" + row["Thanhtien"]) + thanhtien_order_per_room;
            }
            rptHdbanhang.DataSource = dsrHdbanhang_Chitiet;
            #region Set he so ctrinh - logo, ten cty

            using (DataSet dsHeso_Chuongtrinh = objMasterService.Get_Rex_Dm_Heso_Chuongtrinh_Collection3().ToDataSet())
            {
                DataSet dsCompany_Paras = new DataSet();
                dsCompany_Paras.Tables.Add("Company_Paras");
                dsCompany_Paras.Tables[0].Columns.Add("CompanyName", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyAddress", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyLogo", typeof(byte[]));
                byte[] imageData = Convert.FromBase64String("" + dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyLogo"))[0]["Heso"]);
                dsCompany_Paras.Tables[0].Rows.Add(new object[]  {
                    dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyName"))[0]["Heso"]
                    , dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyAddress"))[0]["Heso"]
                    , imageData
                });
                rptHdbanhang.xrc_CompanyName.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyName"));
                rptHdbanhang.xrc_CompanyAddress.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyAddress"));
                rptHdbanhang.xrPic_Logo.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Image", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyLogo"));
            }
            #endregion

            rptHdbanhang.lblTongcong.Text = String.Format("{0:n0}", Convert.ToDouble(thanhtien));
            string str = GoobizFrame.Windows.HelperClasses.ReadNumber.ChangeNum2VNStr((double)thanhtien, " đồng.");
            str = str.Substring(0, 1).ToUpper() + str.Substring(1).ToLower();
            rptHdbanhang.tbcThanhtien_Bangchu.Text = str;
            rptHdbanhang.tbc_Ngay_Batdau.Text      = dtNgay_Batdau.Text;
            rptHdbanhang.tbc_Ngay_Ketthuc.Text     = dtNgay_Ketthuc.Text;
            if (Convert.ToDecimal("" + dsbar_Rent_Checkin.Tables[0].Rows[0]["Per_Dongia"]) == 0)
            {
                rptHdbanhang.xrTableRow_Giamgia.Visible = false; //xrTable5
            }
            rptHdbanhang.CreateDocument();
            GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(rptHdbanhang);
            if (Convert.ToBoolean(oReportOptions.PrintPreview))
            {
                frmPrintPreview.Text = "" + oReportOptions.Caption;
                frmPrintPreview.printControl1.PrintingSystem = rptHdbanhang.PrintingSystem;
                frmPrintPreview.MdiParent = this.MdiParent;
                frmPrintPreview.Text      = this.Text + "(Xem trang in)";
                frmPrintPreview.Show();
                frmPrintPreview.Activate();
            }
            else
            {
                var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(rptHdbanhang);
                ReportPrintTool.Print();
            }
            return(base.PerformPrintPreview());
        }
Пример #6
0
        void LoadRptChitiet_Hangmua()
        {
            System.Collections.Hashtable hastTable = new System.Collections.Hashtable();
            hastTable.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
            hastTable.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);
            //hastTable.Add(lookUpEdit_Doituong, lblDoituong.Text);

            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hastTable))
            {
                return;
            }
            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
            {
                return;
            }

            Reports.XtraReports.rptWare_Muahang_Chitiet rptWare_Muahang = new Ecm.Reports.XtraReports.rptWare_Muahang_Chitiet();
            Datasets.DsRptWare_Hdmuahang dsHdmuahang = new Ecm.Reports.Datasets.DsRptWare_Hdmuahang();
            DataSet dstemp = objWareService.Get_All_Ware_Hdmuahang_ByNhacungcap_ByDate(lookUpEdit_Doituong.EditValue, dtNgay_Batdau.EditValue, dtNgay_Ketthuc.EditValue).ToDataSet();
            int     i      = 1;

            foreach (DataRow dtr in dstemp.Tables[0].Rows)
            {
                DataRow dtrNew = dsHdmuahang.Tables[0].NewRow();
                foreach (DataColumn dtc in dstemp.Tables[0].Columns)
                {
                    try
                    {
                        dtrNew[dtc.ColumnName] = dtr[dtc.ColumnName];
                    }
                    catch (Exception ex)
                    {
                    }
                }
                dtrNew["Stt"] = i;
                i++;
                dsHdmuahang.Tables[0].Rows.Add(dtrNew);
            }
            setHesoChuongtrinh(rptWare_Muahang.xrc_CompanyName, rptWare_Muahang.xrc_CompanyAddress, rptWare_Muahang.xrPic_Logo);
            rptWare_Muahang.xrDate_From.Text = dtNgay_Batdau.Text;
            rptWare_Muahang.xrDate_To.Text   = dtNgay_Ketthuc.Text;
            rptWare_Muahang.xrNgayKy.Text    = DateTime.Now.Day.ToString();
            rptWare_Muahang.xrThangKy.Text   = DateTime.Now.Month.ToString();
            rptWare_Muahang.xrNamKy.Text     = DateTime.Now.Year.ToString();
            rptWare_Muahang.DataSource       = dsHdmuahang;

            GoobizFrame.Windows.Forms.FrmPrintPreview _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            _FrmPrintPreview.Report = rptWare_Muahang;
            rptWare_Muahang.CreateDocument();
            GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(rptWare_Muahang);
            if (Convert.ToBoolean(oReportOptions.PrintPreview))
            {
                _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                _FrmPrintPreview.printControl1.PrintingSystem = rptWare_Muahang.PrintingSystem;
                _FrmPrintPreview.MdiParent = this.MdiParent;
                _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
            }
            else
            {
                var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(rptWare_Muahang);
                ReportPrintTool.Print();
            }
            _FrmPrintPreview.Show();
            _FrmPrintPreview.Activate();
        }
        private void Load_Rptware_Nhap_Chitiet()
        {
            System.Collections.Hashtable hashtableControls = new System.Collections.Hashtable();
            hashtableControls.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
            hashtableControls.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);
            hashtableControls.Add(lookUpEdit_Cuahang_Ban, lblCuahang_Ban.Text);

            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls))
            {
                return;
            }
            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
            {
                return;
            }
            DataSet ds_Xuat_Chittiet = objWareService.Get_All_Ware_Nhap_Chitiet(lookUpEdit_Cuahang_Ban.EditValue, dtNgay_Batdau.EditValue, dtNgay_Ketthuc.EditValue, lookUpEdit_Mahang.EditValue, null).ToDataSet();

            Reports.XtraReports.rptWare_Xuatnhap_Chitiet _Rptware_Xuatnhap_Chitiet = new Ecm.Reports.XtraReports.rptWare_Xuatnhap_Chitiet();

            #region Thiết lập hệ số chương trình (Logo, thông tin công ty)
            using (DataSet dsHeso_Chuongtrinh = objMasterService.Get_Rex_Dm_Heso_Chuongtrinh_Collection3().ToDataSet())
            {
                DataSet dsCompany_Paras = new DataSet();
                dsCompany_Paras.Tables.Add("Company_Paras");
                dsCompany_Paras.Tables[0].Columns.Add("CompanyName", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyAddress", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyLogo", typeof(byte[]));

                byte[] imageData = Convert.FromBase64String("" + dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyLogo"))[0]["Heso"]);

                dsCompany_Paras.Tables[0].Rows.Add(new object[]  {
                    dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyName"))[0]["Heso"]
                    , dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyAddress"))[0]["Heso"]
                    , imageData
                });

                _Rptware_Xuatnhap_Chitiet.xrc_CompanyName.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyName"));
                _Rptware_Xuatnhap_Chitiet.xrc_CompanyAddress.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyAddress"));
            }
            #endregion
            _Rptware_Xuatnhap_Chitiet.xrLabel_ReportName.Text = @"SỔ CHI TIẾT NHẬP HÀNG";
            _Rptware_Xuatnhap_Chitiet.xrTable_Loaiphieu.Text  = @"PHIẾU NHẬP";
            _Rptware_Xuatnhap_Chitiet.xrTable_Kho.Text        = lookUpEdit_Cuahang_Ban.Text;
            _Rptware_Xuatnhap_Chitiet.xrTable_Denngay.Text    = DateTime.Parse(dtNgay_Ketthuc.EditValue.ToString()).ToString("dd/MM/yyyy");
            _Rptware_Xuatnhap_Chitiet.xrTable_Tungay.Text     = DateTime.Parse(dtNgay_Batdau.EditValue.ToString()).ToString("dd/MM/yyyy");
            _Rptware_Xuatnhap_Chitiet.xrTable_ngay.Text       = DateTime.Today.Day.ToString();
            _Rptware_Xuatnhap_Chitiet.xrTable_Thang.Text      = DateTime.Today.Month.ToString();
            _Rptware_Xuatnhap_Chitiet.xrTable_Nam.Text        = DateTime.Today.Year.ToString();
            _Rptware_Xuatnhap_Chitiet.DataSource = ds_Xuat_Chittiet;
            _Rptware_Xuatnhap_Chitiet.CreateDocument();
            string path_file = @"Resources\repx\rptWare_Xuatnhap_Chitiet.repx";
            if (System.IO.File.Exists(path_file))
            {
                System.IO.File.Delete(path_file);
            }
            GoobizFrame.Windows.Forms.FrmPrintPreview _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            _FrmPrintPreview.Report = _Rptware_Xuatnhap_Chitiet;
            GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_Rptware_Xuatnhap_Chitiet);
            if (Convert.ToBoolean(oReportOptions.PrintPreview))
            {
                _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                _FrmPrintPreview.printControl1.PrintingSystem = _Rptware_Xuatnhap_Chitiet.PrintingSystem;
                _FrmPrintPreview.MdiParent = this.MdiParent;
                _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
            }
            else
            {
                var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_Rptware_Xuatnhap_Chitiet);
                ReportPrintTool.Print();
            }
            _FrmPrintPreview.Show();
            _FrmPrintPreview.Activate();
        }
        private void Load_rptWare_Congno_Chitiet()
        {
            try
            {
                System.Collections.Hashtable hashtableControls = new System.Collections.Hashtable();
                hashtableControls.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
                hashtableControls.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);
                hashtableControls.Add(lookUpEditMa_Ncc, lblDoituong.Text);

                if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls))
                {
                    return;
                }

                if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
                {
                    return;
                }

                DataSet ds_Congnothu = objReportService.RptCongno_NCC_Chitiet(dtNgay_Batdau.EditValue, dtNgay_Ketthuc.EditValue, lookUpEditTen_Ncc.EditValue).ToDataSet();
                Ecm.Reports.XtraReports.rptWare_Congno_Chitiet _rptWare_Congno_Chitiet = new Ecm.Reports.XtraReports.rptWare_Congno_Chitiet();
                _rptWare_Congno_Chitiet.DataSource = ds_Congnothu;
                GoobizFrame.Windows.Forms.FrmPrintPreview _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
                _FrmPrintPreview.Report = _rptWare_Congno_Chitiet;
                // Thiết lập hệ số chương trình (Logo, thông tin công ty)
                setHesoChuongtrinh(_rptWare_Congno_Chitiet.xrc_CompanyName, _rptWare_Congno_Chitiet.xrc_CompanyAddress, null);
                _rptWare_Congno_Chitiet.xrDate_From.Text           = dtNgay_Batdau.DateTime.ToString("dd/MM/yyyy");
                _rptWare_Congno_Chitiet.xrDate_To.Text             = dtNgay_Ketthuc.DateTime.ToString("dd/MM/yyyy");
                _rptWare_Congno_Chitiet.xrTableCell_TenKH.Text     = lookUpEditTen_Ncc.Text + " - " + lookUpEditMa_Ncc.Text;
                _rptWare_Congno_Chitiet.xrTableCell_Dienthoai.Text = lookUpEditMa_Ncc.GetColumnValue("Dienthoai").ToString();
                _rptWare_Congno_Chitiet.xrTableCell_Diachi.Text    = lookUpEditMa_Ncc.GetColumnValue("Diachi_Nhacungcap").ToString();
                _rptWare_Congno_Chitiet.xrTableCell_KH.Text        = "Tên NCC";
                _rptWare_Congno_Chitiet.xrTable_Ngay.Text          = DateTime.Today.Day.ToString();
                _rptWare_Congno_Chitiet.xrTable_Thang.Text         = DateTime.Today.Month.ToString();
                _rptWare_Congno_Chitiet.xrTable_Nam.Text           = DateTime.Today.Year.ToString();
                _rptWare_Congno_Chitiet.CreateDocument();
                GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_rptWare_Congno_Chitiet);
                if (Convert.ToBoolean(oReportOptions.PrintPreview))
                {
                    _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                    _FrmPrintPreview.printControl1.PrintingSystem = _rptWare_Congno_Chitiet.PrintingSystem;
                    _FrmPrintPreview.MdiParent = this.MdiParent;
                    _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
                    _FrmPrintPreview.Show();
                    _FrmPrintPreview.Activate();
                }
                else
                {
                    var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_rptWare_Congno_Chitiet);
                    ReportPrintTool.Print();
                }
                _FrmPrintPreview.Show();
                _FrmPrintPreview.Activate();
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.Message);
#endif
            }
        }
Пример #9
0
        public void Print(object Id_Winecard)
        {
            var drWinecard = objBarService.GetBar_Winecard_ById(Id_Winecard).ToDataSet().Tables[0].Rows[0];

            if (string.IsNullOrWhiteSpace("" + drWinecard["Id_Nhansu_Xnhan"]))
            {
                GoobizFrame.Windows.Forms.UserMessage.Show("ACCESS_DENIED", new string[] { });
                return;
            }

            Ecm.Bar.Reports.rptBar_Winecard           rptBar_Winecard = new Ecm.Bar.Reports.rptBar_Winecard();
            GoobizFrame.Windows.Forms.FrmPrintPreview frmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            frmPrintPreview.Report = rptBar_Winecard;

            #region Set he so ctrinh - logo, ten cty

            using (DataSet dsHeso_Chuongtrinh = objMasterService.Get_Rex_Dm_Heso_Chuongtrinh_Collection3().ToDataSet())
            {
                DataSet dsCompany_Paras = new DataSet();
                dsCompany_Paras.Tables.Add("Company_Paras");
                dsCompany_Paras.Tables[0].Columns.Add("CompanyName", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyAddress", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyLogo", typeof(byte[]));
                byte[] imageData = Convert.FromBase64String("" + dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyLogo"))[0]["Heso"]);
                dsCompany_Paras.Tables[0].Rows.Add(new object[]  {
                    dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyName"))[0]["Heso"]
                    , dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyAddress"))[0]["Heso"]
                    , imageData
                });
                rptBar_Winecard.xrc_CompanyName.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyName"));
                rptBar_Winecard.xrc_CompanyAddress.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyAddress"));
                rptBar_Winecard.xrPic_Logo.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Image", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyLogo"));
            }
            #endregion

            rptBar_Winecard.xrcSo_Chungtu.Text      = "" + drWinecard["So_Chungtu"];
            rptBar_Winecard.xrbcSo_Chungtu.Text     = "" + drWinecard["So_Chungtu"];//barcode
            rptBar_Winecard.xrcNgay_Batdau.Text     = "" + drWinecard["Ngay_Batdau"];
            rptBar_Winecard.xrcTen_Khachhang.Text   = "" + drWinecard["Ten_Khachhang"];
            rptBar_Winecard.xrcDienthoai.Text       = "" + drWinecard["Dienthoai"];
            rptBar_Winecard.xrcTen_Hanghoa_Ban.Text = "" + drWinecard["Ten_Hanghoa_Ban"];
            rptBar_Winecard.xrcGhichu.Text          = "" + drWinecard["Ghichu"];

            rptBar_Winecard.CreateDocument();

            GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(rptBar_Winecard);
            if (Convert.ToBoolean(oReportOptions.PrintPreview))
            {
                frmPrintPreview.Text = "" + oReportOptions.Caption;
                frmPrintPreview.printControl1.PrintingSystem = rptBar_Winecard.PrintingSystem;
                frmPrintPreview.MdiParent = this.MdiParent;
                frmPrintPreview.Text      = this.Text + "(Xem trang in)";
                frmPrintPreview.Show();
                frmPrintPreview.Activate();
            }
            else
            {
                var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(rptBar_Winecard);
                ReportPrintTool.Print();
            }
        }
Пример #10
0
        public override bool PerformPrintPreview()
        {
            try
            {
                DataSets.DsWare_Dm_Khachhang _DsWare_Dm_Khachhang         = new DataSets.DsWare_Dm_Khachhang();
                Reports.rptWare_Dm_Khachhang _rptWare_Dm_Khachhang        = new Reports.rptWare_Dm_Khachhang();
                GoobizFrame.Windows.Forms.FrmPrintPreview frmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
                frmPrintPreview.Report = _rptWare_Dm_Khachhang;
                //frmPrintPreview.Name = this.Name;
                //frmPrintPreview.EnablePrintPreview = this.EnablePrintPreview;
                _rptWare_Dm_Khachhang.DataSource = _DsWare_Dm_Khachhang;
                foreach (DataRow dr in ds_Collection.Tables[0].Select("Chon = True", ""))
                {
                    DataRow drnew = _DsWare_Dm_Khachhang.Tables[0].NewRow();
                    foreach (DataColumn dc in ds_Collection.Tables[0].Columns)
                    {
                        try
                        {
                            drnew[dc.ColumnName] = dr[dc.ColumnName];
                        }
                        catch
                        {
                            continue;
                        }
                    }
                    _DsWare_Dm_Khachhang.Tables[0].Rows.Add(drnew);
                }
                //add parameter values
                #region Set he so ctrinh - logo, ten cty
                using (DataSet dsCompany_Paras = new DataSet())
                {
                    dsCompany_Paras.Tables.Add("Company_Paras");
                    dsCompany_Paras.Tables[0].Columns.Add("CompanyName", typeof(string));
                    dsCompany_Paras.Tables[0].Columns.Add("CompanyAddress", typeof(string));
                    dsCompany_Paras.Tables[0].Columns.Add("CompanyLogo", typeof(byte[]));

                    DataSet dsHeso_Chuongtrinh = objMasterService.Get_Rex_Dm_Heso_Chuongtrinh_Collection3().ToDataSet();
                    byte[]  imageData          = Convert.FromBase64String("" + dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyLogo"))[0]["Heso"]);

                    dsCompany_Paras.Tables[0].Rows.Add(new object[]  {
                        dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyName"))[0]["Heso"]
                        , dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyAddress"))[0]["Heso"]
                        , imageData
                    });

                    _rptWare_Dm_Khachhang.xrc_CompanyName.DataBindings.Add(
                        new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyName"));
                    _rptWare_Dm_Khachhang.xrc_CompanyAddress.DataBindings.Add(
                        new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyAddress"));
                }
                #endregion

                _rptWare_Dm_Khachhang.CreateDocument();
                GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_rptWare_Dm_Khachhang);
                if (Convert.ToBoolean(oReportOptions.PrintPreview))
                {
                    frmPrintPreview.Text = "" + oReportOptions.Caption;
                    frmPrintPreview.printControl1.PrintingSystem = _rptWare_Dm_Khachhang.PrintingSystem;
                    frmPrintPreview.MdiParent = this.MdiParent;
                    frmPrintPreview.Text      = this.Text + "(Xem trang in)";
                    frmPrintPreview.Show();
                    frmPrintPreview.Activate();
                }
                else
                {
                    var reportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_rptWare_Dm_Khachhang);
                    reportPrintTool.Print();
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
                return(false);
            }
            return(base.PerformPrintPreview());
        }
Пример #11
0
        public override bool PerformPrintPreview()
        {
            Ecm.Bar.DataSets.dsHdbanhang_Chitiet dsrHdbanhang_Chitiet = new Ecm.Bar.DataSets.dsHdbanhang_Chitiet();
            Ecm.Bar.Reports.rptHdbanhang_noVAT   rptHdbanhang_noVAT   = new Ecm.Bar.Reports.rptHdbanhang_noVAT();
            //            GoobizFrame.Windows.Forms.FrmPrintPreview frmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            GoobizFrame.Windows.Forms.FrmPrintPreview frmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            frmPrintPreview.Report = rptHdbanhang_noVAT;
            //frmPrintPreview.Name = this.Name;
            //frmPrintPreview.EnablePrintPreview = this.EnablePrintPreview;
            rptHdbanhang_noVAT.DataSource = dsrHdbanhang_Chitiet;

            int i = 1;

            foreach (DataRow dr in dsTable_Order_Chitiet.Tables[0].Rows)
            {
                DataRow drnew = dsrHdbanhang_Chitiet.Tables[0].NewRow();
                foreach (DataColumn dc in dsTable_Order_Chitiet.Tables[0].Columns)
                {
                    try
                    {
                        drnew[dc.ColumnName] = dr[dc.ColumnName];
                    }
                    catch (Exception ex)
                    {
                        continue;
                    }
                }
                drnew["Ten_Hanghoa"] = dr["Ten_Hanghoa_Ban"];
                drnew["Dongia_Ban"]  = dr["Dongia"];
                drnew["Thanhtien"]   = dr["Thanhtien"];
                drnew["Stt"]         = i++;
                dsrHdbanhang_Chitiet.Tables[0].Rows.Add(drnew);
            }
            //add parameter values
            rptHdbanhang_noVAT.tbc_Ngay.Text       = "" + dtNgay_Cash.Text + "    * Bàn: " + txtTen_Table.Text;
            rptHdbanhang_noVAT.tbcSochungtu.Text   = "" + Sochungtu;
            rptHdbanhang_noVAT.lblNhansu_Bill.Text = lookUpEdit_Nhansu_Bill.Text;
            rptHdbanhang_noVAT.lblNhansu_Bill.Text = lookUpEdit_Nhansu_Bill.Text;
            rptHdbanhang_noVAT.lblKhachhang.Text   = lookUpEdit_Khachhang.Text;

            double thanhtien = Convert.ToDouble(dsTable_Order_Chitiet.Tables[0].Compute("sum(Thanhtien)", ""));

            if (txtTien_Booking.Text != "")
            {
                thanhtien -= Convert.ToDouble(txtTien_Booking.EditValue);
            }
            rptHdbanhang_noVAT.PageSize = new Size(800, 1400 + 100 * Convert.ToInt32(dsrHdbanhang_Chitiet.Tables[0].Rows.Count));
            //Trừ tiền cọc booking
            if ("" + Tien_Booking != "")
            {
                decimal Thanhtien_TG = Convert.ToDecimal("0" +
                                                         dsrHdbanhang_Chitiet.Tables[0].Rows[dsrHdbanhang_Chitiet.Tables[0].Rows.Count - 1]["Thanhtien_TG"]);
                Thanhtien_TG -= Convert.ToDecimal(Tien_Booking);
                dsrHdbanhang_Chitiet.Tables[0].Rows[dsrHdbanhang_Chitiet.Tables[0].Rows.Count - 1]["Thanhtien_TG"] = Thanhtien_TG;
                rptHdbanhang_noVAT.xrTable_Tien_Booking.Visible = true;
                rptHdbanhang_noVAT.lblTien_Booking.Text         = string.Format("{0:#,#}", Tien_Booking);
            }
            else
            {
                rptHdbanhang_noVAT.xrTable6.Location = new System.Drawing.Point(21, 42);
                rptHdbanhang_noVAT.xrTable4.Location = new System.Drawing.Point(21, 135);
                //thanhtien -= Convert.ToDouble("0" + dsTable_Order_Chitiet.Tables[0].Compute("Sum(Thanhtien_Km)", ""));
            }

            #region Set he so ctrinh - logo, ten cty

            using (DataSet dsHeso_Chuongtrinh = objMasterService.Get_Rex_Dm_Heso_Chuongtrinh_Collection3().ToDataSet())
            {
                DataSet dsCompany_Paras = new DataSet();
                dsCompany_Paras.Tables.Add("Company_Paras");
                dsCompany_Paras.Tables[0].Columns.Add("CompanyName", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyAddress", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyLogo", typeof(byte[]));

                byte[] imageData = Convert.FromBase64String("" + dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyLogo"))[0]["Heso"]);

                dsCompany_Paras.Tables[0].Rows.Add(new object[]  {
                    dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyName"))[0]["Heso"]
                    , dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyAddress"))[0]["Heso"]
                    , imageData
                });

                rptHdbanhang_noVAT.xrc_CompanyName.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyName"));
                rptHdbanhang_noVAT.xrc_CompanyAddress.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyAddress"));
                rptHdbanhang_noVAT.xrPic_Logo.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Image", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyLogo"));
            }
            #endregion

            rptHdbanhang_noVAT.lbl_Dathutien.Visible = true;
            if (lookUpEdit_Khachhang.EditValue != null) // check if khách hàng quota --> hiển thị thông tin giảm giá
            {
                //ds_Khachhang = objWareService.Get_All_Ware_Khachhang_Quota_Detail_By_Khachhang(lookUpEdit_Khachhang.EditValue).ToDataSet();
                //if (ds_Khachhang.Tables.Count > 0 && ds_Khachhang.Tables[0].Rows.Count > 0)
                //{
                //    if (ds_Khachhang.Tables[0].Rows[0]["Id_Vip_Member"].ToString() == "") // check if khach hang quota
                //    {
                //        rptHdbanhang_noVAT.lblSotien_Giam.Visible = true;
                //        rptHdbanhang_noVAT.xrSotien_Giam.Visible = true;
                //        thanhtien -= Convert.ToDouble("0" + dsTable_Order_Chitiet.Tables[0].Compute("Sum(Thanhtien_Km)", ""));
                //    }
                //}
            }
            rptHdbanhang_noVAT.lblTongcong.Text = thanhtien.ToString();
            string str = GoobizFrame.Windows.HelperClasses.ReadNumber.ChangeNum2VNStr(thanhtien, " đồng.");
            str = str.Substring(0, 1).ToUpper() + str.Substring(1).ToLower();
            rptHdbanhang_noVAT.tbcThanhtien_Bangchu.Text = str;
            rptHdbanhang_noVAT.CreateDocument();
            GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(rptHdbanhang_noVAT);
            if (Convert.ToBoolean(oReportOptions.PrintPreview))
            {
                frmPrintPreview.Text = "" + oReportOptions.Caption;
                frmPrintPreview.printControl1.PrintingSystem = rptHdbanhang_noVAT.PrintingSystem;
                frmPrintPreview.MdiParent = this.MdiParent;
                frmPrintPreview.Text      = this.Text + "(Xem trang in)";
                frmPrintPreview.Show();
                frmPrintPreview.Activate();
            }
            else
            {
                var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(rptHdbanhang_noVAT);
                ReportPrintTool.Print();
            }


            return(base.PerformPrintPreview());
        }