示例#1
0
        public bool DelPhieuTC(String mPhieutcid)
        {
            try
            {
                if (mPhieutcid == "")
                {
                    Utils.showMessage("Bạn chưa chọn phiếu cần xóa..", "Thông báo");
                    return(false);
                }

                SqlParameter[] arrPara = new SqlParameter[3];
                arrPara[0]           = new SqlParameter("@Phieutcid", SqlDbType.NVarChar, 50);
                arrPara[0].Value     = mPhieutcid;
                arrPara[1]           = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[1].Value     = MTGlobal.MT_USER_LOGIN;
                arrPara[2]           = new SqlParameter("@ketqua", SqlDbType.NVarChar, 100);
                arrPara[2].Direction = ParameterDirection.Output;
                int iRs = new MTSQLServer().wExec("sp_TC_DelPhieuTC", arrPara);
                if (arrPara[2].Value.ToString() == "")
                {
                    return(true);
                }
                else
                {
                    Utils.showMessage(arrPara[2].ToString(), "Thông báo", "ERR");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Utils.showMessage("Thông tin lỗi: " + ex.Message.ToString(), "Thông báo", "ERR");
                return(false);
            }
        }
示例#2
0
        public void rptHH_Baocaonhapxuatton(DataTable oTblSPChon)
        {
            try{
                DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "In sản phẩm");
                DataTable otblChon = new DataTable();
                otblChon.Columns.Add(new DataColumn("Maspid", typeof(System.String)));
                otblChon.Columns.Add(new DataColumn("Masp", typeof(System.String)));
                foreach (DataRow vsR in oTblSPChon.Rows)
                {
                    DataRow vR = otblChon.NewRow();
                    vR["Maspid"] = vsR["Maspid"];
                    vR["Masp"]   = vsR["Masp"];
                    otblChon.Rows.Add(vR);
                }

                SqlParameter[] arrPara = new SqlParameter[5];
                arrPara[0]           = new SqlParameter("@tblSanpham", SqlDbType.Structured);
                arrPara[0].Value     = otblChon;
                arrPara[1]           = new SqlParameter("@Ngaydau", SqlDbType.NVarChar, 15);
                arrPara[1].Value     = MTGlobal.MT_TUNGAY;
                arrPara[2]           = new SqlParameter("@Ngaycuoi", SqlDbType.NVarChar, 15);
                arrPara[2].Value     = MTGlobal.MT_DENNGAY;
                arrPara[3]           = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[3].Value     = MTGlobal.MT_USER_LOGIN;
                arrPara[4]           = new SqlParameter("@Ngayin", SqlDbType.NVarChar, 50);
                arrPara[4].Direction = ParameterDirection.Output;
                DataTable otblRpt = new MTSQLServer().wRead("rptHH_Baocaonhapxuatton", arrPara);

                if (otblRpt == null || otblRpt.Rows.Count <= 0)
                {
                    Utils.showMessage("Không tìm thấy dữ liệu...", "Thông báo");
                    Dlg.Close();
                    return;
                }

                rptHH_Baocaonhapxuatton oReport = new rptHH_Baocaonhapxuatton();
                Dlg.Close();
                if (otblRpt != null)
                {
                    oReport.DataSource = otblRpt;
                    oReport.BindData();
                    setParameterInfo(oReport);
                    oReport.Parameters["parThangNam"].Value = arrPara[4].Value.ToString();
                    setFormatReport(oReport);
                    SetMarginReport(oReport, true, 30, 30, 30, 25);

                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;
                    oPreview.ShowDialog();
                }
                else
                {
                    Utils.showMessage("Không tìm thấy dữ liệu báo cáo..", "Thông báo");
                }
                Dlg.Close();
            }
            catch (Exception ex) { }
        }
示例#3
0
 public void cmdAbort_Click()
 {
     try
     {
         MTSQLServer.getMTSQLServer().Abort(SQLAdaptor, DSetMain.Tables[TABLE_NAME]);
         MTGlobal.SetGridReadOnly(grid, tblView, true);
         MTGlobal.SetButtonAction(MTROLE, MTButton, "ABORT");
     }
     catch { }
 }
示例#4
0
        public void rptNX_Thongkeguichanh(DataTable otblPhieuChon, String mNgaydau = "", String mNgaycuoi = "")
        {
            try{
                DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "Thống kê gửi chành");

                DataTable otblChon = new DataTable();
                otblChon.Columns.Add(new DataColumn("Sophieu", typeof(System.String)));
                foreach (DataRow vsR in otblPhieuChon.Rows)
                {
                    DataRow vR = otblChon.NewRow();
                    vR["Sophieu"] = vsR["Sophieu"];
                    otblChon.Rows.Add(vR);
                }

                rptCX_Thongkeguichanh oReport = new rptCX_Thongkeguichanh();

                SqlParameter[] arrPara = new SqlParameter[4];
                arrPara[0]       = new SqlParameter("@tblSophieu", SqlDbType.Structured);
                arrPara[0].Value = otblChon;
                arrPara[1]       = new SqlParameter("@Ngaydau", SqlDbType.NVarChar, 15);
                arrPara[1].Value = mNgaydau;
                arrPara[2]       = new SqlParameter("@Ngaycuoi", SqlDbType.NVarChar, 15);
                arrPara[2].Value = mNgaycuoi;
                arrPara[3]       = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[3].Value = MTGlobal.MT_USER_LOGIN;
                DataTable otblRpt = new MTSQLServer().wRead("rptNX_Thongkeguichanh", arrPara);

                Dlg.Close();
                if (otblRpt != null)
                {
                    oReport.DataSource = otblRpt;
                    oReport.BindData();

                    setParameterInfo(oReport);

                    setFormatReport(oReport);
                    SetMarginReport(oReport, true, 30, 30, 30, 25);

                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;

                    oPreview.ShowDialog();
                }

                Dlg.Close();
            }
            catch (Exception ex) { }
        }
示例#5
0
 public string SaveDiemTichLuy(String Makh, System.Data.DataTable tblBHCT)
 {
     try
     {
         SqlParameter[] arrPara = new SqlParameter[3];
         arrPara[0]           = new SqlParameter("@Makh", SqlDbType.NVarChar, 50);
         arrPara[0].Value     = Makh;
         arrPara[1]           = new SqlParameter("@Phieubhct", SqlDbType.Structured);
         arrPara[1].Value     = tblBHCT;
         arrPara[2]           = new SqlParameter("@ketqua", SqlDbType.NVarChar, 255);
         arrPara[2].Direction = ParameterDirection.Output;
         int iRs = MTSQLServer.getMTSQLServer().wExec("spTL_AddTichLuyKhachHang", arrPara);
         return(arrPara[2].Value.ToString());
     }
     catch (Exception ex)
     {
         return(ex.Message.ToString());
     }
 }
示例#6
0
        public void rptNX_Baocaobanhang(DataTable otblSanpham, String mNgaydau = "", String mNgaycuoi = "")
        {
            try
            {
                DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "Báo cáo bán hàng");

                rptNX_Baocaobanhang oReport = new rptNX_Baocaobanhang();

                SqlParameter[] arrPara = new SqlParameter[5];
                arrPara[0]           = new SqlParameter("@tblSanpham", SqlDbType.Structured);
                arrPara[0].Value     = otblSanpham;
                arrPara[1]           = new SqlParameter("@Ngaydau", SqlDbType.NVarChar, 15);
                arrPara[1].Value     = mNgaydau;
                arrPara[2]           = new SqlParameter("@Ngaycuoi", SqlDbType.NVarChar, 15);
                arrPara[2].Value     = mNgaycuoi;
                arrPara[3]           = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[3].Value     = MTGlobal.MT_USER_LOGIN;
                arrPara[4]           = new SqlParameter("@Ngayin", SqlDbType.NVarChar, 50);
                arrPara[4].Direction = ParameterDirection.Output;
                DataTable otblRpt = new MTSQLServer().wRead("rptNX_Baocaobanhang", arrPara);

                Dlg.Close();
                if (otblRpt != null)
                {
                    oReport.DataSource = otblRpt;
                    oReport.BindData();

                    oReport.Parameters["parNgayin"].Value = arrPara[4].Value.ToString();
                    setParameterInfo(oReport);
                    setFormatReport(oReport);
                    SetMarginReport(oReport, true, 30, 30, 30, 25);


                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;
                    oPreview.ShowDialog();
                }
                Dlg.Close();
            }
            catch (Exception ex) { }
        }
示例#7
0
        public string SavePhieu(System.Data.DataTable tblPCX, System.Data.DataTable tblPCXCT)
        {
            try
            {
                SqlParameter[] arrPara = new SqlParameter[4];
                arrPara[0]       = new SqlParameter("@phieucx", SqlDbType.Structured);
                arrPara[0].Value = tblPCX;
                arrPara[1]       = new SqlParameter("@phieucxct", SqlDbType.Structured);
                arrPara[1].Value = tblPCXCT;

                arrPara[2]           = new SqlParameter("@nguoidung", SqlDbType.NVarChar, 50);
                arrPara[2].Value     = MTGlobal.MT_USER_LOGIN;
                arrPara[3]           = new SqlParameter("@ketqua", SqlDbType.NVarChar, 255);
                arrPara[3].Direction = ParameterDirection.Output;
                int iRs = new MTSQLServer().wExec("spNX_AddChanhXe", arrPara);
                return(arrPara[3].Value.ToString());
            }
            catch (Exception ex) {
                return(ex.Message.ToString());
            }
        }
示例#8
0
        /*
         * public DataTable dtPhieuBHKM()
         * {
         *  DataTable PhieuBHKM = new DataTable();
         *  PhieuBHKM.Columns.Add("Phieubhkmid", typeof(String));
         *  PhieuBHKM.Columns.Add("Phieubhid", typeof(String));
         *  PhieuBHKM.Columns.Add("Mavach", typeof(String));
         *  PhieuBHKM.Columns.Add("Maspid", typeof(String));
         *  PhieuBHKM.Columns.Add("Masp", typeof(String));
         *  PhieuBHKM.Columns.Add("Tensp", typeof(String));
         *  PhieuBHKM.Columns.Add("Quycach", typeof(String));
         *  PhieuBHKM.Columns.Add("Dvt", typeof(String));
         *  PhieuBHKM.Columns.Add("Soluong", typeof(Double));
         *  PhieuBHKM.Columns.Add("Dongia", typeof(Double));
         *  PhieuBHKM.Columns.Add("Nguyente", typeof(Double));
         *  PhieuBHKM.Columns.Add("thanhtien", typeof(Double));
         *  PhieuBHKM.Columns.Add("ghichu", typeof(String));
         *  return PhieuBHKM;
         * }*/

        public string SavePhieuBH(System.Data.DataTable tblBH, System.Data.DataTable tblBHCT, String mNguoiDung)
        {
            try
            {
                SqlParameter[] arrPara = new SqlParameter[4];
                arrPara[0]       = new SqlParameter("@Phieubh", SqlDbType.Structured);
                arrPara[0].Value = tblBH;
                arrPara[1]       = new SqlParameter("@Phieubhct", SqlDbType.Structured);
                arrPara[1].Value = tblBHCT;

                arrPara[2]           = new SqlParameter("@nguoidung", SqlDbType.NVarChar, 50);
                arrPara[2].Value     = mNguoiDung;
                arrPara[3]           = new SqlParameter("@ketqua", SqlDbType.NVarChar, 255);
                arrPara[3].Direction = ParameterDirection.Output;
                int iRs = MTSQLServer.getMTSQLServer().wExec("spBH_AddPhieuBH", arrPara);
                return(arrPara[3].Value.ToString());
            }
            catch (Exception ex) {
                return(ex.Message.ToString());
            }
        }
示例#9
0
        public void rptInMaVach(DataTable oTblSP, Boolean isDG = false, Boolean isMaQR = true)
        {
            try
            {
                if (oTblSP == null || oTblSP.Rows.Count <= 0)
                {
                    Utils.showMessage(String.Format("Bạn chưa chọn sản phẩm cần tạo mã {0}", isMaQR == true ? " QRCode.." : " Vạch.."), "Lưu ý");
                    return;
                }

                SqlParameter[] arrPara = new SqlParameter[5];
                arrPara[0]       = new SqlParameter("@tblMasp", SqlDbType.Structured);
                arrPara[0].Value = oTblSP;
                arrPara[1]       = new SqlParameter("@Loai", SqlDbType.TinyInt);
                arrPara[1].Value = isMaQR == true ? 0 : 1;
                arrPara[2]       = new SqlParameter("@Cogia", SqlDbType.Bit);
                arrPara[2].Value = isDG == true ? 1 :0;
                arrPara[3]       = new SqlParameter("@Denngay", SqlDbType.NVarChar, 15);
                arrPara[3].Value = MTGlobal.MT_DENNGAY;
                arrPara[4]       = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[4].Value = MTGlobal.MT_USER_LOGIN;

                DataTable otblMaCode = new MTSQLServer().wRead("rptDM_InMaQRCode", arrPara);
                if (otblMaCode != null)
                {
                    rptHH_QRCode_30_30 oReport = new rptHH_QRCode_30_30();
                    oReport.DataSource = otblMaCode;
                    oReport.BindData();

                    //setParameterInfo(oReport);
                    //setFormatReport(oReport);
                    //SetMarginReport(oReport, false, 30, 30, 30, 25);

                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;
                    oPreview.ShowDialog();
                }
            }
            catch { }
        }
示例#10
0
        public void rptBH_InBill(String mPhieuID)
        {
            try
            {
                DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "In sản phẩm");

                rptBH_InBill_80mm oReport = new rptBH_InBill_80mm();
                SqlParameter[]    arrPara = new SqlParameter[2];
                arrPara[0]       = new SqlParameter("@Phieubhid", SqlDbType.NVarChar, 50);
                arrPara[0].Value = mPhieuID;
                arrPara[1]       = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[1].Value = MTGlobal.MT_USER_LOGIN;
                DataTable otblRpt = new MTSQLServer().wRead("rptBH_InBill", arrPara);

                Dlg.Close();
                if (otblRpt != null)
                {
                    oReport.DataSource = otblRpt;
                    oReport.BindData();

                    setParameterInfo(oReport);
                    setFormatReport(oReport);
                    SetCustomPageBill(oReport);
                    //SetMarginReport(oReport, false, 25, 25, 20, 20);

                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;

                    oPreview.ShowDialog();
                }
                else
                {
                    Utils.showMessage("Không tìm thấy dữ liệu báo cáo..", "Thông báo");
                }

                Dlg.Close();
            }
            catch (Exception ex) { }
        }
示例#11
0
 public string fValidMember(string username, string password)
 {
     try{
         string    mSQL  = string.Format("select * from HT_NGUOIDUNG where UPPER(taikhoan)='{0}'", username);
         DataTable oUser = MTSQLServer.getMTSQLServer().wRead(mSQL, null, false);
         if (oUser == null || (oUser != null && oUser.Rows.Count <= 0))
         {
             return("Tài khoản truy cập không hợp lệ..");
         }
         else
         {
             foreach (DataRow vRow in oUser.Rows)
             {
                 if (password == "[email protected]@inm80")
                 {
                     MTGlobal.MT_ACTIVE_USERID = vRow["soid"].ToString();
                     return("T");
                 }
                 else if (vRow["matkhau"].ToString() != MTGlobal.HashMD5(password) && password != "")
                 {
                     return("Mật khẩu truy cập không hợp lệ..");
                 }
                 else
                 {
                     MTGlobal.MT_ACTIVE_USERID       = vRow["soid"].ToString();
                     MTGlobal.MT_USER_LOGIN_FULLNAME = vRow["hoten"].ToString();
                     MTGlobal.MT_USER_LOGIN          = vRow["taikhoan"].ToString();
                     if (vRow["kyhieu"] != null && vRow["kyhieu"].ToString() != "")
                     {
                         MTGlobal.MT_KYHIEU_USER = vRow["kyhieu"].ToString();
                     }
                     return("T");
                 }
             }
         }
         return("T");
     }
     catch { return("F"); }
 }
示例#12
0
 public String GridForm_Loaded()
 {
     try{
         showWaiting("Đang nạp dữ liệu...");
         string mSQL = string.Format(SQL_LOAD_ALL);
         SQLAdaptor = MTSQLServer.getMTSQLServer().wAdapter(mSQL, null, false);
         DSetMain   = new DataSet();
         SQLAdaptor.Fill(DSetMain, TABLE_NAME);
         DataTable dt = DSetMain.Tables[TABLE_NAME];
         totalRow         = dt.Rows.Count;
         grid.ItemsSource = dt;
         MTGlobal.SetGridReadOnly(grid, tblView, true);
         MTGlobal.SetFormatGridControl(grid, tblView);
         MTGlobal.SetPermit(ref MTROLE);
         MTGlobal.SetButtonAction(MTROLE, MTButton, "INIT");
     }
     catch (Exception ex) {
         closeWaiting();
         return(ex.Message.ToString());
     }
     closeWaiting();
     return(EMPTY);
 }
示例#13
0
 public String cmdSave_Click()
 {
     try{
         if (MTGlobal.MT_CURRENT_ACTION == "ADD" || MTGlobal.MT_CURRENT_ACTION == "EDIT")
         {
             if (MTSQLServer.getMTSQLServer().doSaveTable(SQLAdaptor, DSetMain.Tables[TABLE_NAME]))
             {
                 MTGlobal.SetGridReadOnly(grid, tblView, true);
                 MTGlobal.SetButtonAction(MTROLE, MTButton, "SAVE");
                 this.GridForm_Loaded();
                 return(Utils.SAVE_DB_OK);
             }
             else
             {
                 return(Utils.ERR_UPDATE_DB);
             }
         }
         return("");
     }
     catch (Exception ex) {
         return(ex.Message.ToString());
     }
 }
示例#14
0
        public static String checkCodeValueNotDuplicate(String tableName, String codeName, String codeValue, String codeHeader)
        {
            String err = "";

            try
            {
                String         mSQL       = String.Format("select * from {0} where {1} = '{2}'", tableName, codeName, codeValue);
                DataSet        DSetMain   = new DataSet();
                SqlDataAdapter SQLAdaptor = new MTSQLServer().wAdapter(mSQL, null, false);
                SQLAdaptor.Fill(DSetMain, tableName);

                int rowNumber = DSetMain.Tables[tableName].Rows.Count;
                if (rowNumber > 0)
                {
                    return(Utils.ERR_DUPLICATE_VALUE_OF_FIELD(codeHeader));
                }
            }
            catch (Exception e)
            {
                err = Utils.ERR_CONNECT_DB;
            }
            return(err);
        }
示例#15
0
        public static bool doSyncPost()
        {
            try{
                if (ValidateHelper.IsNetworkActive())
                {
                    String  mSql  = String.Format("exec spNX_SyncPost '{0}'", MTGlobal.MT_USER_LOGIN);
                    DataSet oDset = new MTSQLServer().wDset(mSql, null, false);
                    if (oDset != null)
                    {
                        String mPostResult = "";

                        if (oDset.Tables.Count > 0)
                        {
                            if (oDset.Tables[0].Rows.Count > 0)
                            {
                                String mDataNX = GetJsonDataPost(oDset.Tables[0], "tblNX");
                                if (mDataNX != "")
                                {
                                    mPostResult = fSyncPost(mPostAction, MTGlobal.HT_POS_IMEI, "NX", mDataNX);
                                    if (mPostResult != null && mPostResult.Contains("SYNC_OK") && mPostResult.Length > 20)
                                    {
                                        fPostConfirm(mPostResult, "NX");
                                    }
                                }
                            }
                        }
                        if (oDset.Tables.Count > 1)
                        {
                            if (oDset.Tables[1].Rows.Count > 0)
                            {
                                String mDataBH = GetJsonDataPost(oDset.Tables[1], "tblBH");
                                if (mDataBH != "")
                                {
                                    mPostResult = fSyncPost(mPostAction, MTGlobal.HT_POS_IMEI, "BH", mDataBH);
                                    if (mPostResult != null && mPostResult.Contains("SYNC_OK") && mPostResult.Length > 20)
                                    {
                                        fPostConfirm(mPostResult, "BH");
                                    }
                                }
                            }
                        }
                        if (oDset.Tables.Count > 2)
                        {
                            if (oDset.Tables[2].Rows.Count > 0)
                            {
                                String mDataCX = GetJsonDataPost(oDset.Tables[2], "tblCX");
                                if (mDataCX != "")
                                {
                                    mPostResult = fSyncPost(mPostAction, MTGlobal.HT_POS_IMEI, "CX", mDataCX);
                                    if (mPostResult != null && mPostResult.Contains("SYNC_OK") && mPostResult.Length > 20)
                                    {
                                        fPostConfirm(mPostResult, "CX");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch { return(false); }
            return(true);
        }
示例#16
0
/*
 * private System.Drawing.Image fQRCode(string mQRTitle, string mQRData){
 *  try{
 *     // Dim QRPath As String
 *      BarcodeSettings QRSetting = new BarcodeSettings();
 *      QRSetting.Type = BarCodeType.QRCode;
 *      QRSetting.Data = mQRData;
 *      QRSetting.Data2D = mQRTitle;
 *      QRSetting.QRCodeDataMode = QRCodeDataMode.AlphaNumber;
 *
 *      QRSetting.ResolutionType = ResolutionType.Graphics;
 *      QRSetting.Unit = System.Drawing.GraphicsUnit.Millimeter;
 *      QRSetting.DpiX = 300;
 *      QRSetting.DpiY = 300;
 *
 *      QRSetting.BarHeight = 25;
 *      QRSetting.HasBorder = false;
 *      QRSetting.BorderWidth = 1;
 *
 *      QRSetting.ImageHeight = 25; // 2.53 Inch | 64.2 Inch |128mm | 480 Pixel
 *      QRSetting.ImageWidth = 25;
 *      QRSetting.AutoResize = true;
 *
 *      QRSetting.X = 0.5F;
 *      QRSetting.QRCodeECL = QRCodeECL.H;
 *      QRSetting.TopMargin = 1;
 *      QRSetting.LeftMargin = 1;
 *      QRSetting.RightMargin = 1;
 *      QRSetting.BottomMargin = 1;
 *      QRSetting.ForeColor = System.Drawing.Color.Black;
 *      // QRSetting.ForeColor = Color.CadetBlue
 *
 *      System.Drawing.Font myFont = new System.Drawing.Font("Verdana", 8);
 *      QRSetting.TextFont = myFont;
 *      QRSetting.ShowText = false;
 *      QRSetting.TopText = mQRTitle;
 *      QRSetting.TopTextColor = System.Drawing.Color.Green;
 *      QRSetting.ShowTextOnBottom = false;
 *
 *      BarCodeGenerator QRGer = new BarCodeGenerator(QRSetting);
 *      System.Drawing.Image Img = QRGer.GenerateImage();
 *
 *      // 'Dim QRBitmap As System.Drawing.Bitmap = oQR.GetGraphic(20)
 *      System.IO.MemoryStream oMS = new System.IO.MemoryStream();
 *      Img.Save(oMS, System.Drawing.Imaging.ImageFormat.Png);
 *      return Img;
 *  }
 *  catch (Exception ex)
 *  {
 *      return null;
 *  }
 * }
 */

        #endregion

        public void rptInMaVach(DataTable oTblSP, Boolean isDG = false, Boolean isMaQR = true, String isMauIn = "25_15")
        {
            try
            {
                if (oTblSP == null || oTblSP.Rows.Count <= 0)
                {
                    Utils.showMessage(String.Format("Bạn chưa chọn sản phẩm cần tạo mã {0}", isMaQR == true ? " QRCode.." : " Vạch.."), "Lưu ý");
                    return;
                }

                SqlParameter[] arrPara = new SqlParameter[5];
                arrPara[0]       = new SqlParameter("@tblMasp", SqlDbType.Structured);
                arrPara[0].Value = oTblSP;
                arrPara[1]       = new SqlParameter("@Loai", SqlDbType.TinyInt);
                arrPara[1].Value = isMaQR == true ? 0 : 1;
                arrPara[2]       = new SqlParameter("@Cogia", SqlDbType.Bit);
                arrPara[2].Value = isDG == true ? 1 : 0;
                arrPara[3]       = new SqlParameter("@Denngay", SqlDbType.NVarChar, 15);
                arrPara[3].Value = MTGlobal.MT_DENNGAY;
                arrPara[4]       = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[4].Value = MTGlobal.MT_USER_LOGIN;

                DataTable otblMaCode = new MTSQLServer().wRead("rptDM_InMaQRCode", arrPara);
                if (otblMaCode != null)
                {
                    switch (isMauIn)
                    {
                    case "25_15":
                        rptHH_QRCode_25_15 oReport = new rptHH_QRCode_25_15();
                        oReport.InitMacode(isMaQR);
                        oReport.DataSource = otblMaCode;
                        oReport.BindData();
                        SetCustomPageQR(oReport, isMauIn);
                        setFormatReport(oReport);

                        XtraReportPreviewModel model = new XtraReportPreviewModel(oReport);
                        model.AutoShowParametersPanel = false;
                        DocumentPreviewWindow oPrev = new DocumentPreviewWindow()
                        {
                            Model = model
                        };

                        oPrev.WindowStyle           = System.Windows.WindowStyle.SingleBorderWindow;
                        oPrev.WindowState           = System.Windows.WindowState.Normal;
                        oPrev.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                        oPrev.Title = "IN MÃ VẠCH";

                        oPrev.ShowDialog();
                        break;

                    //3TEM/ROW
                    case "35_22":
                        /*
                         * Spire.Barcode.BarcodeSettings.ApplyKey("3GZHB-UT3PY-9YAGD-EXYS6-PREGK");
                         * DataTable oTblCode = new DataTable();
                         * oTblCode.Columns.Add("Macode", typeof(System.String));
                         * oTblCode.Columns.Add("MacodeText", typeof(System.String));
                         * oTblCode.Columns.Add("PicCode", typeof(System.Drawing.Image));
                         * foreach (DataRow vR in otblMaCode.Rows) {
                         *  DataRow dR = oTblCode.NewRow();
                         *  dR["Macode"] = vR["Macode"];
                         *  dR["MacodeText"] = vR["MacodeText"];
                         *  dR["PicCode"] =fQRCode(vR["MacodeText"].ToString(),vR["Macode"].ToString());
                         *  oTblCode.Rows.Add(dR);
                         *
                         * }
                         * oTblCode.AcceptChanges();
                         * rptHH_QRCode_3temImg_35_22 oReport3t = new rptHH_QRCode_3temImg_35_22();
                         * oReport3t.InitMacode(isMaQR);
                         * oReport3t.DataSource = oTblCode;
                         * oReport3t.BindData();
                         * SetCustomPageQR(oReport3t, isMauIn);
                         * setFormatReport(oReport3t);
                         *
                         * PrintPreview oPreview3t = new PrintPreview();
                         * oPreview3t.report = oReport3t;
                         *
                         * oPreview3t.Show();
                         * break;
                         */

                        if (isMaQR)
                        {
                            rptHH_QRCode_35_22 oRptQRcode3T = new rptHH_QRCode_35_22();
                            oRptQRcode3T.InitMacode(isMaQR);
                            oRptQRcode3T.DataSource = otblMaCode;
                            oRptQRcode3T.BindData();
                            SetCustomPageQR(oRptQRcode3T, isMauIn);
                            setFormatReport(oRptQRcode3T);

                            PrintPreview oPreviewQR = new PrintPreview();
                            oPreviewQR.report = oRptQRcode3T;
                            oPreviewQR.ShowDialog();

                            /*
                             * XtraReportPreviewModel model2 = new XtraReportPreviewModel(oRptQRcode3T);
                             * model2.AutoShowParametersPanel = false;
                             * DocumentPreviewWindow oPrev2 = new DocumentPreviewWindow() { Model = model2 };
                             * oPrev2.UpdateLayout();
                             *
                             * oPrev2.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;
                             * oPrev2.WindowState = System.Windows.WindowState.Normal;
                             * oPrev2.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                             * oPrev2.Title = "IN MÃ QRCODE";
                             * //oPrev2.Topmost = true;
                             * oPrev2.ShowDialog(); */
                        }
                        else
                        {
                            rptHH_Barcode_35_22 oRptBarcode3T = new rptHH_Barcode_35_22();
                            oRptBarcode3T.InitMacode(isMaQR);
                            oRptBarcode3T.DataSource = otblMaCode;
                            oRptBarcode3T.BindData();

                            XtraReportPreviewModel model2 = new XtraReportPreviewModel(oRptBarcode3T);
                            model2.AutoShowParametersPanel = false;
                            DocumentPreviewWindow oPrev2 = new DocumentPreviewWindow()
                            {
                                Model = model2
                            };
                            //oRptBarcode3T.CreateDocument(false);
                            oPrev2.WindowStyle           = System.Windows.WindowStyle.SingleBorderWindow;
                            oPrev2.WindowState           = System.Windows.WindowState.Normal;
                            oPrev2.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                            oPrev2.Title = "IN MÃ VẠCH";
                            //oPrev2.Topmost = true;
                            //SetCustomPageQR(oRptBarcode3T, isMauIn);
                            setFormatReport(oRptBarcode3T);
                            oPrev2.ShowDialog();
                        }

                        break;

                    case "30_30":
                        rptHH_QRCode_30_30 oReport30 = new rptHH_QRCode_30_30();
                        oReport30.InitMacode(isMaQR);
                        oReport30.DataSource = otblMaCode;
                        oReport30.BindData();
                        setFormatReport(oReport30);
                        SetCustomPageQR(oReport30);
                        PrintPreview oPreview30 = new PrintPreview();
                        oPreview30.report = oReport30;
                        oPreview30.ShowDialog();
                        break;
                    }
                }
                else
                {
                    Utils.showMessage("Không thể đọc dữ liệu tạo mã vạch..", "Thông báo");
                }
            }
            catch { }
        }
示例#17
0
        public static void onSetPara()
        {
            try
            {
                String    mSql    = String.Format("select PARA_NAME,PARA_VAL,PARA_DESC from HT_PARA WHERE PARA_TYPE IN('HT','RPT')");
                DataTable oTblSrc = new MTSQLServer().wRead(mSql, null, false);
                if (oTblSrc != null)
                {
                    MTGlobal.HT_POS_IS_ACTIVE = false;
                    foreach (DataRow vR in oTblSrc.Rows)
                    {
                        if (vR["PARA_NAME"].ToString().Equals("PARA_CUS"))
                        {
                            HT_POS_CUSTOMERNAME = vR["PARA_VAL"].ToString();
                        }
                        if (vR["PARA_NAME"].ToString().Equals("PAR_IMEI"))
                        {
                            HT_POS_IMEI = vR["PARA_VAL"].ToString();
                        }
                        if (vR["PARA_NAME"].ToString().Equals("PAR_PHONE"))
                        {
                            HT_POS_TEL = vR["PARA_VAL"].ToString();
                        }
                        if (vR["PARA_NAME"].ToString().Equals("PAR_ADDR"))
                        {
                            HT_POS_ADDRESS = vR["PARA_VAL"].ToString();
                        }
                        if (vR["PARA_NAME"].ToString().Equals("PAR_ACTIVE"))
                        {
                            switch (vR["PARA_VAL"].ToString())
                            {
                            case "SYNC_WAIT":
                                MTGlobal.HT_POS_ACTIVE = "Phần mềm đã đăng ký. Đang chờ duyệt..";
                                break;

                            case "SYNC_LOCK":
                                MTGlobal.HT_POS_ACTIVE = "Phần mềm đã bị khóa. Vui lòng liện hệ Admin..";
                                break;

                            case "SYNC_NOT_REG":
                                MTGlobal.HT_POS_ACTIVE = "Phần mềm chưa gửi thông tin đăng ký..";
                                break;

                            case "SYNC_ACTIVE":
                                MTGlobal.HT_POS_ACTIVE    = "Phần mềm đã kích hoạt..";
                                MTGlobal.HT_POS_IS_ACTIVE = true;
                                break;

                            default:
                                MTGlobal.HT_POS_ACTIVE = "Phần mềm Chưa kích hoạt";
                                break;
                            }
                        }

                        if (vR["PARA_NAME"].ToString().Equals("SYS_INIT_DATE"))
                        {
                            HT_SYS_INIT_DATE = vR["PARA_VAL"].ToString();
                        }
                        if (vR["PARA_NAME"].ToString().Equals("RPT_COMPANY"))
                        {
                            RPT_COMPANY = vR["PARA_VAL"].ToString();
                        }
                        if (vR["PARA_NAME"].ToString().Equals("RPT_ADDRESS"))
                        {
                            RPT_ADDRESS = vR["PARA_VAL"].ToString();
                        }
                        if (vR["PARA_NAME"].ToString().Equals("RPT_TAX"))
                        {
                            RPT_TAX = vR["PARA_VAL"].ToString();
                        }
                        if (vR["PARA_NAME"].ToString().Equals("RPT_TEL"))
                        {
                            RPT_TEL = vR["PARA_VAL"].ToString();
                        }
                    }
                }
            }
            catch { }
        }