Exemplo n.º 1
0
 private void btlogin_Click(object sender, EventArgs e)
 {
     gen.ExcuteNonquery("delete from Center");
     // update by Khoa Pham 2/18/2020
     gen.ExcuteNonquery("insert into Center values(N'" + txtten.Text + "',N'" + textEdit1.Text + "',N'" + textEdit2.Text + "',N'" + textEdit3.Text + "',N'" + textEdit4.Text + "',N'" + textEdit5.Text + "',N'" + textEdit6.Text + "',N'" + textEdit7.Text + "',N'" + textEdit8.Text + "','" + textEdit9.Text + "',N'" + textEdit10.Text + "',N'" + textEdit11.Text + "','',0)");
     XtraMessageBox.Show("Hệ thống đã lưu thông tin thay đổi.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 2
0
 public void checkdistrist(string ac, TextBox a, TextBox b, string sql, Frm_distrist F)
 {
     if (a.Text == "")
     {
         MessageBox.Show("Mã quận/huyện không được bỏ trống.", "HAMACO");
     }
     else if (b.Text == "")
     {
         MessageBox.Show("Tên quận/huyện không được bỏ trống.", "HAMACO");
     }
     else
     {
         if (ac == "1")
         {
             gen.ExcuteNonquery(sql);
             F.myac();
             F.Close();
         }
         else
         {
             try
             {
                 string kq = gen.GetString("select * from Distrist where DistristCode='" + a.Text + "'");
                 MessageBox.Show("Mã quận/huyện này đã tồn tại.", "HAMACO");
             }
             catch
             {
                 gen.ExcuteNonquery(sql);
                 F.myac();
                 F.Close();
             }
         }
     }
 }
Exemplo n.º 3
0
        private void baadd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (semh.Text == "")
            {
                XtraMessageBox.Show("Bạn không được bỏ trống mặt hàng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (denad.Text == "")
            {
                XtraMessageBox.Show("Bạn không được bỏ trống ngày áp dụng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (degd.Text == "")
            {
                XtraMessageBox.Show("Bạn không được bỏ trống giá điều ngày.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (active == "0")
            {
                gen.ExcuteNonquery("insert into DDHCL(RefID,RefNo,RefDate,PostedDate,InStockID,AccountingObjectCode,AccountingObjectName,TotalAmount,TotalTransport,Contactname,IsExport) values(newid(),'" + txtsct.Text + "','" + denad.EditValue.ToString() + "','" + degd.EditValue.ToString() + "','" + gen.GetString("select StockID from Stock where StockCode='" + sedv.EditValue.ToString() + "'") + "','" + semh.EditValue.ToString() + "',N'" + txtth.Text + "'," + txttl.EditValue.ToString() + ",'" + txtdsd.EditValue.ToString() + "',N'" + lbduyet.Text + "','" + chenqv.Checked + "')");
                XtraMessageBox.Show("Dữ liệu đã được cập nhật.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                myac();
                this.Close();
            }
            else
            {
                gen.ExcuteNonquery("update DDHCL set RefDate='" + denad.EditValue.ToString() + "',PostedDate='" + degd.EditValue.ToString() + "',AccountingObjectCode='" + semh.EditValue.ToString() + "',AccountingObjectName=N'" + txtth.Text + "',TotalAmount=" + txttl.EditValue.ToString() + ",TotalTransport='" + txtdsd.EditValue.ToString() + "',Contactname=N'" + lbduyet.Text + "',IsExport='" + chenqv.Checked + "' where RefID='" + role + "'");
                XtraMessageBox.Show("Dữ liệu đã được cập nhật.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                myac();
                this.Close();
            }
        }
Exemplo n.º 4
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     if (txtTransactionCode.Text == "")
     {
         XtraMessageBox.Show("Please enter the transaction", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         tname = gen.GetString2("Transactions", "FormName", "TransactionCode", txtTransactionCode.Text, clientid);
         if (tname != "")
         {
             // add to Fav
             SQLString  = "INSERT INTO TransactionFav ([TransactionCode],[username]) VALUES (" + "'";
             SQLString += txtTransactionCode.Text + "','" + username + "')";
             try
             {
                 gen.ExcuteNonquery(SQLString);
                 XtraMessageBox.Show("This transaction is created to the favorite successfully!", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 // load lai menu Fav
                 load_menuFav();
             }
             catch
             {
                 SQLString = "This transaction is existed already in the favorite";
                 XtraMessageBox.Show(SQLString, "btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 //txtSQL.Text = SQLString;
             }
         }
         else
         {
             XtraMessageBox.Show("Tên transaction không đúng.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Exemplo n.º 5
0
        private void tsbtsave_Click(object sender, EventArgs e)
        {
            string pid = "NULL";
            int    gr  = 1;

            if (cbloai.Text != "")
            {
                pid = gen.GetString("select InventoryCategoryID from InventoryItemCategory where InventoryCategoryCode='" + cbloai.SelectedValue.ToString() + "'");
                string t = gen.GetString("select Grade from InventoryItemCategory where InventoryCategoryCode='" + cbloai.SelectedValue.ToString() + "'");
                gr = int.Parse(t) + 1;
            }
            if (active == "1")
            {
                string sql;
                if (pid == "NULL")
                {
                    sql = "update InventoryItemCategory set InventoryCategoryName=N'" + txtname.Text + "',Inactive='" + checkBox1.Checked.ToString() + "',Grade='" + gr + "' where InventoryCategoryID='" + role + "'";
                }
                else
                {
                    sql = "update InventoryItemCategory set InventoryCategoryName=N'" + txtname.Text + "',Inactive='" + checkBox1.Checked.ToString() + "',ParentID='" + pid + "',Grade='" + gr + "' where InventoryCategoryID='" + role + "'";
                    gen.ExcuteNonquery("update InventoryItemCategory set IsParent='True' where  InventoryCategoryID='" + pid + "'");
                }
                // iic.checkiic(active, txtcode, txtname, sql, this, pid, role);
            }
            else
            {
                string sql = "insert into InventoryItemCategory(InventoryCategoryID,InventoryCategoryCode,InventoryCategoryName,Inactive,ParentID,Grade) values(newid(),'" + txtcode.Text + "',N'" + txtname.Text + "','" + checkBox1.Checked.ToString() + "','" + pid + "','" + gr + "')";
                if (pid != "NULL")
                {
                    gen.ExcuteNonquery("update InventoryItemCategory set IsParent='True' where  InventoryCategoryID='" + pid + "'");
                }
                // iic.checkiic(active, txtcode, txtname, sql, this, pid, role);
            }
        }
Exemplo n.º 6
0
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            string sql = "Delete from TransactionFav Where username  ='******' and  TransactionCode ='" + contextMenuID + "';";

            gen.ExcuteNonquery(sql);

            LoadDataTableMenu();
            loadTreeMenu();
        }
Exemplo n.º 7
0
 private void tsbtcat_Click(object sender, EventArgs e)
 {
     ledt.Focus();
     if (pt == "pnk")
     {
         pnk.checkpnk(active, role, this, gridView1, ledt, ledv, cbldt, txtsct, txtname, txtdc, txtngh, txtctg, txtldn, denct, denht, tsbtboghi, tsbtghiso, tsbtxoa, tsbtcat, tsbtin, tsbtsua, tsbtnap, ngaychungtu, txtmst, txtptvc, userid, branchid, tsbttruoc, tsbtsau, chtc);
     }
     else if (pt == "pnkvtddh")
     {
         pnktddh.checkpnk(active, role, this, gridView1, ledt, ledv, cbldt, txtsct, txtname, txtdc, txtngh, txtctg, txtldn, denct, denht, tsbtboghi, tsbtghiso, tsbtxoa, tsbtcat, tsbtin, tsbtsua, tsbtnap, ngaychungtu, txtmst, txtptvc, userid, branchid, tsbttruoc, tsbtsau, chtc, txttaixe);
     }
     else
     {
         pxk.checkpxk(active, role, this, gridView1, ledt, ledv, cbldt, txtsct, txtname, txtdc, txtngh, txtctg, txtldn, denct, denht, tsbtboghi, tsbtghiso, tsbtxoa, tsbtcat, tsbtin, tsbtsua, tsbtnap, ngaychungtu, txtmst, txtptvc, userid, branchid, tsbttruoc, tsbtsau, chtc, txttaixe);
     }
     refreshrole();
     click = "true";
     change();
     click = "false";
     if (active == "1")
     {
         gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Sửa','" + txtsct.Text + "')");
     }
     else
     {
         gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Thêm','" + txtsct.Text + "')");
     }
 }
Exemplo n.º 8
0
 private void tsbtghiso_Click(object sender, EventArgs e)
 {
     tsbtboghi.Visible = true;
     tsbtghiso.Visible = false;
     tsbtsua.Enabled   = false;
     if (pt == "pck")
     {
         gen.ExcuteNonquery("update INInward set Posted='True' where RefID='" + role + "'");
     }
     else
     {
         gen.ExcuteNonquery("update INOutward set Posted='True' where RefID='" + role + "'");
     }
 }
Exemplo n.º 9
0
 private void btnLock_Click(object sender, EventArgs e)
 {
     SQLString = "UPDATE [MSC_User] SET InActive=1 WHERE CompanyCode='" + Globals.companycode + "' AND username='******'";
     try
     {
         gen.ExcuteNonquery(SQLString);
         XtraMessageBox.Show("This user is locked successfully!", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     catch
     {
         XtraMessageBox.Show(SQLString, "btnLock_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 10
0
        private void basave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            txtname.Focus();
            if (rbcpn.Checked == true)
            {
                check = "1";
            }
            else if (rbltu.Checked == true)
            {
                check = "2";
            }
            else if (rbtnn.Checked == true)
            {
                check = "3";
            }
            else if (rbgvn.Checked == true)
            {
                check = "4";
            }
            else
            {
                check = "0";
            }

            if (active == "1")
            {
                gen.ExcuteNonquery("delete Descasc where DescascCode=(select DescascCode from Descasc where DescascID='" + role + "')");
            }

            Double so = 0;

            try
            {
                so = Double.Parse(gen.GetString("select Max(DescascCode) from Descasc")) + 1;
            }
            catch { }
            for (int i = 0; i < gridView1.RowCount - 1; i++)
            {
                string makho = gridView1.GetRowCellValue(i, "Mã kho").ToString();
                makho = gen.GetString("select StockID from Stock where StockCode='" + makho + "'");
                string sotien   = gridView1.GetRowCellValue(i, "Số tiền").ToString().Replace(".", "");
                string diengiai = gridView1.GetRowCellValue(i, "Diễn giải").ToString();
                string manganh  = gridView1.GetRowCellValue(i, "Mã ngành").ToString();
                gen.ExcuteNonquery("insert into Descasc values(newid(),'" + so + "',N'" + txtname.EditValue + "','" + ledv.EditValue + "','" + makho + "','" + sotien + "',N'" + diengiai + "','" + check + "','" + txtdvsd.EditValue + "','" + manganh + "')");
            }

            XtraMessageBox.Show("Dữ liệu của bạn đã được lưu.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.None);
            this.myac();
            this.Close();
        }
Exemplo n.º 11
0
 private void luu_Click(object sender, EventArgs e)
 {
     SplashScreenManager.ShowForm(typeof(Frm_wait));
     gen.ExcuteNonquery("delete from MSC_RolePermissionMaping where RoleID='" + role + "'");
     for (int i = 0; i <= start; i++)
     {
         if (mscstr[i, 2] == "1")
         {
             gen.ExcuteNonquery("insert into MSC_RolePermissionMaping values(newid(),'" + mscstr[i, 0] + "','" + role + "','" + mscstr[i, 1] + "')");
         }
     }
     SplashScreenManager.CloseForm();
     this.Close();
     this.Dispose();
 }
Exemplo n.º 12
0
        private void Frm_login_Load(object sender, EventArgs e)
        {
            //load_txtDatabase(); // combo

            try
            {
                gen.ExcuteNonquery("select * from Center");
                try
                {
                    gen.GetString("select * from Center where Version='" + ver + "'");
                    this.Text = gen.GetString("select Top 1 CompanyName from Center");
                }
                catch
                {
                    XtraMessageBox.Show("Phiên bản bạn đang dùng chưa đúng, vui lòng cập nhật phiên bản mới.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                //XtraMessageBox.Show("Kết nối tới Server chưa được thiết lập, vui lòng kết nối và thử lại.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                XtraMessageBox.Show(ex.Message, "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.Close();
            }
        }
Exemplo n.º 13
0
 private void btlogin_Click(object sender, EventArgs e)
 {
     if (txtmk.Text != txtmk2.Text || txtmk.Text == "")
     {
         XtraMessageBox.Show("Mật khẩu mới chưa khớp hoặc bạn chưa nhập mật khẩu mới.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtmk2.Text = "";
         txtmk.Text  = "";
         txtmk.Focus();
     }
     else
     {
         SQLString = "update MSC_User set Password='******' where Username='******' AND CompanyCode='" + Globals.companycode + "'";
         try
         {
             gen.ExcuteNonquery(SQLString);
             XtraMessageBox.Show("Mật khẩu của bạn đã được thay đổi.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtmk2.Text = "";
             txtmk.Text  = "";
             txtmk.Text  = "";
             txtmk2.Focus();
         }
         catch
         {
             XtraMessageBox.Show(SQLString, "btlogin_Click", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             txtmk2.Text = "";
             txtmk2.Focus();
         }
     }
 }
Exemplo n.º 14
0
 private void btlogin_Click(object sender, EventArgs e)
 {
     if (txtmk.Text != textEdit2.Text || txtmk.Text == "")
     {
         XtraMessageBox.Show("Mật khẩu mới chưa khớp hoặc bạn chưa nhập mật khẩu mới.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         textEdit2.Text = "";
         txtmk.Text     = "";
         txtmk.Focus();
     }
     else
     {
         try
         {
             SplashScreenManager.ShowForm(typeof(Frm_wait));
             string userid = gen.GetString("select Userid from MSC_User where UserName='******' and Password='******'");
             gen.ExcuteNonquery("update MSC_User set Password='******' where UserID='" + userid + "'");
             XtraMessageBox.Show("Mật khẩu của bạn đã được thay đổi.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Information);
             textEdit1.Text = "";
             textEdit2.Text = "";
             txtmk.Text     = "";
             textEdit1.Focus();
             SplashScreenManager.CloseForm();
         }
         catch
         {
             XtraMessageBox.Show("Mật khẩu hiện tại không đúng.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             textEdit1.Text = "";
             textEdit1.Focus();
             SplashScreenManager.CloseForm();
         }
     }
 }
Exemplo n.º 15
0
 private void basave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         if (chkhcd.Checked == true)
         {
             string makho     = gen.GetString("select StockID from Stock where StockCode='" + ledv.EditValue + "'");
             string nguyengia = txtng.EditValue.ToString().Replace(".", "").Replace(",", ".");
             string khauhao   = txtkhbq.EditValue.ToString().Replace(".", "").Replace(",", ".");
             if (active == "1")
             {
                 gen.ExcuteNonquery("update Depreciation set DepreciationName=N'" + txtname.EditValue + "', OriginalPrice='" + nguyengia + "', Price='" + khauhao + "', StockID='" + makho + "',Fixed=1 where DepreciationID='" + role + "' ");
             }
             else
             {
                 Double so = Double.Parse(gen.GetString("select Max(DepreciationCode) from Depreciation")) + 1;
                 gen.ExcuteNonquery("insert into Depreciation(DepreciationID,DepreciationCode,DepreciationName,OriginalPrice,Price,StockID,PostDate,Fixed) values(newid(),'" + so + "',N'" + txtname.EditValue + "','" + nguyengia + "','" + khauhao + "','" + makho + "','" + ngay + "',1) ");
             }
         }
         else
         {
             string makho        = gen.GetString("select StockID from Stock where StockCode='" + ledv.EditValue + "'");
             string nguyengia    = txtng.EditValue.ToString().Replace(".", "").Replace(",", ".");
             string khauhao      = txtkhbq.EditValue.ToString().Replace(".", "").Replace(",", ".");
             string thuesuat     = txtts.EditValue.ToString().Replace(".", "").Replace(",", ".");
             string giatriconlai = txttontruoc.EditValue.ToString().Replace(".", "").Replace(",", ".");
             string laivay       = txtlv.EditValue.ToString().Replace(".", "").Replace(",", ".");
             if (active == "1")
             {
                 gen.ExcuteNonquery("update Depreciation set DepreciationName=N'" + txtname.EditValue + "',StartTime='" + txtdvsd.EditValue + "',DepreciationTime='" + txttgkh.EditValue + "',EndTime='" + txttghkh.EditValue + "', OriginalPrice='" + nguyengia + "', Price='" + khauhao + "',ExitsPrice='" + giatriconlai + "',ExitsTime='" + txttgcl.EditValue + "',Tax='" + thuesuat + "',TaxPrice='" + laivay + "', StockID='" + makho + "',PostDate='" + ngay + "',Fixed=0 where DepreciationID='" + role + "'");
             }
             else
             {
                 Double so = Double.Parse(gen.GetString("select Max(DepreciationCode) from Depreciation"));
                 so = so + 1;
                 gen.ExcuteNonquery("insert into Depreciation values(newid(),'" + so + "',N'" + txtname.EditValue + "','" + txtdvsd.EditValue + "','" + txttgkh.EditValue + "','" + txttghkh.EditValue + "','" + nguyengia + "','" + khauhao + "','" + giatriconlai + "','" + txttgcl.EditValue + "','" + thuesuat + "','" + laivay + "','" + makho + "','" + ngay + "',0,0) ");
             }
         }
         XtraMessageBox.Show("Dữ liệu của bạn đã được lưu.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.None);
         this.myac();
         this.Close();
     }
     catch { XtraMessageBox.Show("Vui lòng kiểm tra lại thông tin trước khi lưu.", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
 }
Exemplo n.º 16
0
        private void view2_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.S && e.Modifiers == Keys.Control)
            {
                if (XtraMessageBox.Show("Bạn có chắc muốn lưu thông tin đã thay đổi này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    string thang    = DateTime.Parse(ngaychungtu).Month.ToString();
                    string nam      = DateTime.Parse(ngaychungtu).Year.ToString();
                    string idkhach  = view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString();
                    string makhach  = view.GetRowCellValue(view.FocusedRowHandle, "Mã khách hàng").ToString();
                    string tenkhach = view.GetRowCellValue(view.FocusedRowHandle, "Tên khách hàng").ToString();
                    gen.ExcuteNonquery("delete SalarySS where StockID='" + kho + "' and MonthS='" + thang + "' and YearS='" + nam + "' and AccountingObjectID='" + idkhach + "' and EmployeeID='" + idnhanvien + "' ");
                    for (int i = 0; i < gridView2.RowCount; i++)
                    {
                        if (gridView2.GetRowCellValue(i, "Số lượng").ToString() != "" && gridView2.GetRowCellValue(i, "Số lượng quy đổi").ToString() != "")
                        {
                            string idhang    = gridView2.GetRowCellValue(i, "ID").ToString();
                            string hoadon    = gridView2.GetRowCellValue(i, "Số hóa đơn").ToString();
                            string RefID     = gridView2.GetRowCellValue(i, "RefID").ToString();
                            string mahang    = gridView2.GetRowCellValue(i, "Mã hàng hóa").ToString();
                            string soluong   = gridView2.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "").Replace(",", ".");
                            string soluongqd = gridView2.GetRowCellValue(i, "Số lượng quy đổi").ToString().Replace(".", "").Replace(",", ".");
                            if (Double.Parse(soluongqd) != 0)
                            {
                                gen.ExcuteNonquery("insert into SalarySS values(newid(),'" + kho + "','" + thang + "','" + nam + "','" + idkhach + "','" + makhach + "',N'" + tenkhach + "','" + idnhanvien + "','" + nhanvien + "',N'" + tennhanvien + "','" + userid + "','" + soluong + "','" + soluongqd + "',0,'" + RefID + "','" + idhang + "','" + mahang + "','" + hoadon + "')");
                            }
                        }
                    }

                    gridControl1.Enabled  = true;
                    panelControl2.Visible = false;
                }
            }
            else if (e.KeyCode == Keys.H && e.Modifiers == Keys.Control)
            {
                if (XtraMessageBox.Show("Bạn có chắc không muốn lưu thông tin này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    gridControl1.Enabled  = true;
                    panelControl2.Visible = false;
                }
            }
        }
Exemplo n.º 17
0
 private void tsbtcat_Click(object sender, EventArgs e)
 {
     ledt.Focus();
     if (active == "1" && thue != txttthue.Text)
     {
         DialogResult dr = XtraMessageBox.Show("Thuế được thay từ < " + thue + " đồng > sang < " + txttthue.Text + " đồng >, bạn có muốn tiếp tục?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
         if (dr == DialogResult.Cancel)
         {
             return;
         }
     }
     hdmh.checkhdmh(active, role, this, gridView1, gridView2, gridView3, ledt, cbldt, txtsct, txtname, txtdc, txtldn, denct, denht, tsbtboghi, tsbtghiso, tsbtxoa,
                    tsbtcat, tsbtin, tsbtsua, tsbtnap, ngaychungtu, cbthue, txtshd, txtkhhd, txtnhd, txthtt, txthttt, txtms, le1562, branchid, userid, txttthue, ledv.EditValue.ToString(), tsbttruoc, tsbtsau, txtmst);
     refreshrole();
     click = "true";
     change();
     click = "false";
     if (active == "1")
     {
         gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Sửa','" + txtsct.Text + "')");
         thue = txttthue.Text;
     }
     else
     {
         gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Thêm','" + txtsct.Text + "')");
     }
 }
Exemplo n.º 18
0
 private void btnAddTransaction_Click(object sender, EventArgs e)
 {
     // add table RolePermissionMapping
     SQLString  = "INSERT INTO RolePermissionMapping ([ClientId],[TransactionCode], [RoleID], [PermissionID]) VALUES (" + clientid;
     SQLString += ",'" + txtTransactionCode.Text + "'";
     SQLString += ",'" + roleid + "','" + txtPermission.Text + "')";
     try
     {
         gen.ExcuteNonquery(SQLString);
         XtraMessageBox.Show("This transaction is added successfully!", "HAMACO", MessageBoxButtons.OK, MessageBoxIcon.Information);
         //update lai datagrid
         Datagrid_update(roleid);
     }
     catch
     {
         //XtraMessageBox.Show(SQLString, "btnAddTransaction_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtSQL.Text = SQLString;
     }
 }
Exemplo n.º 19
0
 private void tsbtcat_Click(object sender, EventArgs e)
 {
     if (txtldn.Text == "")
     {
         DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập lý do lập ủy nhiệm chi.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtldn.Focus();
         return;
     }
     ledt.Focus();
     unc.checkunc(active, role, this, gridView1, ledt, ledv, letk, leth, txtsct, txtname, txtdc, txtnn, txtctg, txtldn, denct, denht, tsbtboghi, tsbtghiso, chvay, tsbtcat, tsbtin, tsbtsua, tsbtnap, ngaychungtu, cbthue, userid, txtthuhuong, tsbttruoc, tsbtsau, "0");
     refreshrole();
     change();
     if (active == "1")
     {
         gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Sửa','" + txtsct.Text + "')");
     }
     else
     {
         gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Thêm','" + txtsct.Text + "')");
     }
 }
Exemplo n.º 20
0
 private void tsbtcat_Click(object sender, EventArgs e)
 {
     ledt.Focus();
     hdmh.checkpck(active, role, this, gridView3, ledt, ledv, txtsct, txtname, txtdc, txtldn, denct, denht, ngaychungtu, cbthue, userid, branchid, txtms, txtkhhd, txtshd, txtnhd, txthtt, txthttt, txttthue, tsbttruoc, tsbtsau, txtquyen, ledvx);
     refreshrole();
     click = "true";
     change();
     click = "false";
     if (active == "1")
     {
         gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Sửa','" + txtsct.Text + "')");
     }
     else
     {
         gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Thêm','" + txtsct.Text + "')");
     }
 }
Exemplo n.º 21
0
 private void tsbtboghi_Click(object sender, EventArgs e)
 {
     tsbtghiso.Visible = true;
     tsbtboghi.Visible = false;
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         if (dt.Rows[i][3].ToString() == "EDIT")
         {
             tsbtsua.Enabled = true;
         }
     }
     if (pt == "pttmvt")
     {
         gen.ExcuteNonquery("update SUCAReceipt set Posted='False' where RefID='" + role + "'");
     }
     else if (pt == "ptnhvt")
     {
         gen.ExcuteNonquery("update SUBADeposit set Posted='False' where RefID='" + role + "'");
     }
     else if (pt == "pctmvt")
     {
         gen.ExcuteNonquery("update SUCAPayment set Posted='False' where RefID='" + role + "'");
     }
     else if (pt == "pcnhvt")
     {
         gen.ExcuteNonquery("update SUBATransfer set Posted='False' where RefID='" + role + "'");
     }
     gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Bỏ ghi','" + txtsct.Text + "')");
 }
Exemplo n.º 22
0
        private void sbok_Click(object sender, EventArgs e)
        {
            if (checkEdit2.EditValue.ToString() == "True")
            {
                if (tsbt == "tsbtthpnxtt" || tsbt == "tsbtthpnxdc")
                {
                    pnht.loadtong(ngaychungtu, userid, tsbt, "CÔNG TY CỔ PHẦN VẬT TƯ HẬU GIANG");
                }
                else if (tsbt == "tsbtthuedaura" || tsbt == "tsbtthuedauvao")
                {
                    bc.loadthuetong(ngaychungtu, tsbt, "intonghoptheokho", userid);
                }
                else if (tsbt == "tsbtthkqkd")
                {
                    thtk.loadketquakinhdoanh(view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), ngaychungtu, ngaycuoi, tsbt + "tct", userid);
                }
                else if (tsbt == "tsbtbkhhnd" || tsbt == "tsbtbkhhxd")
                {
                    thtk.loadbangkehanghoatong(ngaychungtu, ngaycuoi, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "IDS").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Kho nhập").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Kho xuất").ToString(), "2");
                }
                else if (tsbt == "tsbtpkt")
                {
                    pkt.loadchitiet(ngaychungtu, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), "2", view.GetRowCellValue(view.FocusedRowHandle, "Tên người dùng").ToString(), tsbt + "tong", "CÔNG TY CỔ PHẦN VẬT TƯ HẬU GIANG");
                }
            }

            else if (checkEdit1.EditValue.ToString() == "True")
            {
                if (tsbt == "tsbtbctcth")
                {
                    if (tsbt == "tsbtbctcth")
                    {
                        thtk.loadbaocaothuchingay(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Tên kho").ToString());
                    }
                }
                else if (tsbt == "tsbtbkhhnd" || tsbt == "tsbtbkhhxd")
                {
                    thtk.loadbangkehanghoatong(ngaychungtu, ngaycuoi, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "IDS").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Kho nhập").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Kho xuất").ToString(), "1");
                }
                else if (tsbt == "tsbtthpnxtt" || tsbt == "tsbtthpnxdc")
                {
                    pnht.loadchitiet(ngaychungtu, userid, tsbt, "1", "", "CÔNG TY CỔ PHẦN VẬT TƯ HẬU GIANG");
                }
                else if (tsbt == "tsbtpkt")
                {
                    pkt.loadchitiet(ngaychungtu, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), "0", view.GetRowCellValue(view.FocusedRowHandle, "Tên người dùng").ToString(), tsbt, "CÔNG TY CỔ PHẦN VẬT TƯ HẬU GIANG");
                }
                else if (tsbt == "tsbtthkqkd")
                {
                    thtk.loadketquakinhdoanh(view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), ngaychungtu, ngaycuoi, tsbt + "tdv", userid);
                }
                else if (tsbt == "tsbtghiso")
                {
                    string thang = DateTime.Parse(ngaychungtu).Month.ToString();
                    string nam   = DateTime.Parse(ngaychungtu).Year.ToString();
                    if (XtraMessageBox.Show("Bạn có chắc ghi sổ toàn bộ dữ liệu tháng " + thang + " năm " + nam + " ?", "HAMACO", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        SplashScreenManager.ShowForm(typeof(Frm_wait));
                        gen.ExcuteNonquery("tonghopghiso '" + thang + "','" + nam + "','',1");
                        SplashScreenManager.CloseForm();
                    }
                }
                else if (tsbt == "tsbtboghi")
                {
                    string thang = DateTime.Parse(ngaychungtu).Month.ToString();
                    string nam   = DateTime.Parse(ngaychungtu).Year.ToString();
                    if (XtraMessageBox.Show("Bạn có chắc bỏ ghi toàn bộ dữ liệu tháng " + thang + " năm " + nam + " ?", "HAMACO", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        SplashScreenManager.ShowForm(typeof(Frm_wait));
                        gen.ExcuteNonquery("tonghopghiso '" + thang + "','" + nam + "','',0");
                        SplashScreenManager.CloseForm();
                    }
                }

                else if (tsbt == "tsbtthuedaura" || tsbt == "tsbtthuedauvao")
                {
                    bc.loadthue(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "Mã khu vực").ToString(), "khuvuc", "CÔNG TY CỔ PHẦN VẬT TƯ HẬU GIANG", userid);
                }
                else if (tsbt == "sktth" || tsbt == "sktthtomtat")
                {
                    string name = gen.GetString("select AccountName from Account where AccountNumber='" + userid + "'");
                    thtk.loadchitietsktth(ngaychungtu, ngaycuoi, tsbt, userid, name, "");
                }
                else
                {
                    thtk.loadchitietskttong(ngaychungtu, tsbt, account, accountname, lkno, lkco, cuoino, cuoico);
                }
            }
            else if (checkEdit3.EditValue.ToString() == "True")
            {
                if (tsbt == "tsbtthuedaura" || tsbt == "tsbtthuedauvao")
                {
                    bc.loadthue(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), "intonghop", "", userid);
                }
            }
            else
            {
                if (tsbt == "tsbtbctcth")
                {
                    thtk.loadbaocaothuchi(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Tên kho").ToString());
                }
                else if (tsbt == "tsbtbkhhnd" || tsbt == "tsbtbkhhxd")
                {
                    thtk.loadbangkehanghoa(ngaychungtu, ngaycuoi, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "IDS").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Kho nhập").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Kho xuất").ToString(), "0");
                }
                else if (tsbt == "tsbtpkt")
                {
                    pkt.loadchitiet(ngaychungtu, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), "1", view.GetRowCellValue(view.FocusedRowHandle, "Tên người dùng").ToString(), tsbt, "CÔNG TY CỔ PHẦN VẬT TƯ HẬU GIANG");
                }
                else if (tsbt == "tsbtthpnxtt" || tsbt == "tsbtthpnxdc")
                {
                    pnht.loadchitiet(ngaychungtu, userid, tsbt, "0", view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), "CÔNG TY CỔ PHẦN VẬT TƯ HẬU GIANG");
                }
                else if (tsbt == "tsbtthkqkd")
                {
                    thtk.loadketquakinhdoanh(view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), ngaychungtu, ngaycuoi, tsbt, userid);
                }
                else if (tsbt == "tsbtghiso")
                {
                    string thang = DateTime.Parse(ngaychungtu).Month.ToString();
                    string nam   = DateTime.Parse(ngaychungtu).Year.ToString();
                    if (XtraMessageBox.Show("Bạn có chắc ghi sổ dữ liệu kho " + view.GetRowCellValue(view.FocusedRowHandle, "Mã kho").ToString() + " tháng " + thang + " năm " + nam + " ?", "HAMACO", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        SplashScreenManager.ShowForm(typeof(Frm_wait));
                        gen.ExcuteNonquery("tonghopghiso '" + thang + "','" + nam + "','" + view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString() + "',1");
                        SplashScreenManager.CloseForm();
                    }
                }
                else if (tsbt == "tsbtboghi")
                {
                    string thang = DateTime.Parse(ngaychungtu).Month.ToString();
                    string nam   = DateTime.Parse(ngaychungtu).Year.ToString();
                    if (XtraMessageBox.Show("Bạn có chắc bỏ ghi dữ liệu kho " + view.GetRowCellValue(view.FocusedRowHandle, "Mã kho").ToString() + " tháng " + thang + " năm " + nam + " ?", "HAMACO", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        SplashScreenManager.ShowForm(typeof(Frm_wait));
                        gen.ExcuteNonquery("tonghopghiso '" + thang + "','" + nam + "','" + view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString() + "',0");
                        SplashScreenManager.CloseForm();
                    }
                }
                else if (tsbt == "tsbtthuedaura" || tsbt == "tsbtthuedauvao")
                {
                    bc.loadthue(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), "kho", "CÔNG TY CỔ PHẦN VẬT TƯ HẬU GIANG", userid);
                }
                else if (tsbt == "sktth" || tsbt == "sktthtomtat")
                {
                    string name = gen.GetString("select AccountName from Account where AccountNumber='" + userid + "'");
                    thtk.loadchitietsktth(ngaychungtu, ngaycuoi, tsbt, userid, name, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString());
                }
                else if (tsbt == "tsbtctlv")
                {
                    thtk.loadchitietlaivay(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Tên kho").ToString());
                }

                else if (tsbt == "tsbtctlvtn")
                {
                    thtk.loadchitietlaivaytheonganh(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Tên kho").ToString());
                }

                else if (tsbt == "tsbtctkqkd" || tsbt == "tsbtctkqkdtt")
                {
                    thtk.loadchitietkinhdoanh(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString());
                }
                else if (tsbt == "bkthbhtnvkdlqh")
                {
                    Frm_rpcongno rp = new Frm_rpcongno();
                    rp.getngaychungtu(ngaycuoi);
                    rp.getkho(userid);
                    rp.getuserid(view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString());
                    rp.gettsbt(tsbt);
                    rp.Show();
                }
                else
                {
                    thtk.loadchitietskt(ngaychungtu, tsbt, view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString(), view.GetRowCellValue(view.FocusedRowHandle, "Mã kho").ToString() + " - " + view.GetRowCellValue(view.FocusedRowHandle, "Tên kho").ToString(), account, accountname);
                }
            }
        }
Exemplo n.º 23
0
        private void batai_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (tsbt == "")
            {
                if (XtraMessageBox.Show("Bạn có chắc muốn cập nhật vật tư hàng hóa theo kho ?", gen.GetString("select Top 1 CompanyName from Center"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    SplashScreenManager.ShowForm(typeof(Frm_wait));
                    string kho = gen.GetString("select StockID from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
                    for (int i = 0; i < view.RowCount; i++)
                    {
                        if (view.GetRowCellValue(i, "Chọn").ToString() == "True")
                        {
                            string ma        = view.GetRowCellValue(i, "ID").ToString();
                            string mahang    = view.GetRowCellValue(i, "Mã hàng hóa").ToString();
                            string ten       = view.GetRowCellValue(i, "Tên hàng hóa").ToString().Replace("'", "''");
                            string tyle      = view.GetRowCellValue(i, "Tỷ lệ").ToString().Replace(",", ".");
                            string dongia    = view.GetRowCellValue(i, "Đơn giá").ToString().Replace(",", ".");
                            string dongiaban = view.GetRowCellValue(i, "Đơn giá bán").ToString().Replace(",", ".");
                            string dvt       = view.GetRowCellValue(i, "Đơn vị tính").ToString();
                            string dvqd      = view.GetRowCellValue(i, "Đơn vị quy đổi").ToString().Replace("'", "''");
                            string sql;
                            try
                            {
                                string id = gen.GetString("select * from StockII where InventoryItemID='" + ma + "' and StockID='" + kho + "'");
                                sql = "update StockII set InventoryItemName=N'" + ten + "',Unit=N'" + dvt + "',ConvertUnit=N'" + dvqd + "',ConvertRate='" + tyle + "',UnitPrice='" + dongia + "',SalePrice='" + dongiaban + "'  where InventoryItemID='" + ma + "' and StockID='" + kho + "'";
                            }
                            catch
                            {
                                sql = "insert into StockII values(newid(),'" + ma + "',N'" + ten + "',N'" + dvt + "',N'" + dvqd + "','" + tyle + "','" + dongia + "','" + dongiaban + "','" + kho + "','" + mahang + "')";
                            }
                            gen.ExcuteNonquery(sql);
                        }

                        if (view.GetRowCellValue(i, "Kho").ToString() == "True" && view.GetRowCellValue(i, "Chọn").ToString() == "False")
                        {
                            string ma = view.GetRowCellValue(i, "ID").ToString();
                            gen.ExcuteNonquery("delete StockII where InventoryItemID='" + ma + "' and StockID='" + kho + "'");
                        }
                    }
                    loadii(lvpq, view, ledv.EditValue.ToString());
                    SplashScreenManager.CloseForm();
                }
            }
            else if (tsbt == "barbgdh")
            {
                if (XtraMessageBox.Show("Dữ liệu ngày " + String.Format("{0:dd/MM/yyyy}", DateTime.Parse(ngaychungtu)) + " sẽ bị xóa, bạn có chắc muốn cập nhật?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    SplashScreenManager.ShowForm(typeof(Frm_wait));
                    ngaychungtu = DateTime.Parse(ngaychungtu).ToShortDateString();
                    gen.ExcuteNonquery("delete StockIIGD where PostedDate='" + ngaychungtu + "'");
                    for (int i = 0; i < view.RowCount; i++)
                    {
                        if (view.GetRowCellValue(i, "Mã hàng").ToString() != "")
                        {
                            string mahang = view.GetRowCellValue(i, "Mã hàng").ToString();
                            string nhamaycantho, khotranoc, kho22lhp, khorachgia, nhamayhcm, thuduc, bienhoa, binhduong, nhabe, kcnphumy, ltsh, baivong = null;
                            if (DateTime.Parse(ngaychungtu) < DateTime.Parse("10/01/2019"))
                            {
                                nhamaycantho = view.GetRowCellValue(i, "Nhà máy Cần Thơ").ToString();
                                if (nhamaycantho == "")
                                {
                                    nhamaycantho = "0";
                                }
                                else
                                {
                                    nhamaycantho = nhamaycantho.Replace(".", "").Replace(",", ".");
                                }

                                khotranoc = view.GetRowCellValue(i, "Kho Trà Nóc").ToString();
                                if (khotranoc == "")
                                {
                                    khotranoc = "0";
                                }
                                else
                                {
                                    khotranoc = khotranoc.Replace(".", "").Replace(",", ".");
                                }

                                kho22lhp = view.GetRowCellValue(i, "Kho C22 LHP").ToString();
                                if (kho22lhp == "")
                                {
                                    kho22lhp = "0";
                                }
                                else
                                {
                                    kho22lhp = kho22lhp.Replace(".", "").Replace(",", ".");
                                }

                                khorachgia = view.GetRowCellValue(i, "Kho Rạch Giá").ToString();
                                if (khorachgia == "")
                                {
                                    khorachgia = "0";
                                }
                                else
                                {
                                    khorachgia = khorachgia.Replace(".", "").Replace(",", ".");
                                }

                                nhamayhcm = view.GetRowCellValue(i, "Nhà máy HCM").ToString();
                                if (nhamayhcm == "")
                                {
                                    nhamayhcm = "0";
                                }
                                else
                                {
                                    nhamayhcm = nhamayhcm.Replace(".", "").Replace(",", ".");
                                }

                                thuduc = view.GetRowCellValue(i, "Thủ Đức").ToString();
                                if (thuduc == "")
                                {
                                    thuduc = "0";
                                }
                                else
                                {
                                    thuduc = thuduc.Replace(".", "").Replace(",", ".");
                                }

                                bienhoa = view.GetRowCellValue(i, "Biên Hòa").ToString();
                                if (bienhoa == "")
                                {
                                    bienhoa = "0";
                                }
                                else
                                {
                                    bienhoa = bienhoa.Replace(".", "").Replace(",", ".");
                                }

                                binhduong = view.GetRowCellValue(i, "Bình Dương").ToString();
                                if (binhduong == "")
                                {
                                    binhduong = "0";
                                }
                                else
                                {
                                    binhduong = binhduong.Replace(".", "").Replace(",", ".");
                                }

                                nhabe = view.GetRowCellValue(i, "Nhà Bè").ToString();
                                if (nhabe == "")
                                {
                                    nhabe = "0";
                                }
                                else
                                {
                                    nhabe = nhabe.Replace(".", "").Replace(",", ".");
                                }

                                kcnphumy = view.GetRowCellValue(i, "KCN Phú Mỹ").ToString();
                                if (kcnphumy == "")
                                {
                                    kcnphumy = "0";
                                }
                                else
                                {
                                    kcnphumy = kcnphumy.Replace(".", "").Replace(",", ".");
                                }

                                ltsh = view.GetRowCellValue(i, "LTSH-Xe XMTD-PT Thủy 200 tấn").ToString();
                                if (ltsh == "")
                                {
                                    ltsh = "0";
                                }
                                else
                                {
                                    ltsh = ltsh.Replace(".", "").Replace(",", ".");
                                }

                                baivong = view.GetRowCellValue(i, "Kho Phú Quốc - Bãi Vòng").ToString();
                                if (baivong == "")
                                {
                                    baivong = "0";
                                }
                                else
                                {
                                    baivong = baivong.Replace(".", "").Replace(",", ".");
                                }
                            }
                            else
                            {
                                nhamaycantho = view.GetRowCellValue(i, "Nhà máy CT (TĐ, Pomina)").ToString();
                                if (nhamaycantho == "")
                                {
                                    nhamaycantho = "0";
                                }
                                else
                                {
                                    nhamaycantho = nhamaycantho.Replace(".", "").Replace(",", ".");
                                }

                                khotranoc = view.GetRowCellValue(i, "Kho Trà Nóc").ToString();
                                if (khotranoc == "")
                                {
                                    khotranoc = "0";
                                }
                                else
                                {
                                    khotranoc = khotranoc.Replace(".", "").Replace(",", ".");
                                }

                                kho22lhp = view.GetRowCellValue(i, "Kho C22 LHP").ToString();
                                if (kho22lhp == "")
                                {
                                    kho22lhp = "0";
                                }
                                else
                                {
                                    kho22lhp = kho22lhp.Replace(".", "").Replace(",", ".");
                                }

                                khorachgia = view.GetRowCellValue(i, "Kho Rạch Giá").ToString();
                                if (khorachgia == "")
                                {
                                    khorachgia = "0";
                                }
                                else
                                {
                                    khorachgia = khorachgia.Replace(".", "").Replace(",", ".");
                                }

                                nhamayhcm = view.GetRowCellValue(i, "Hòa Phát ( salan-PQ)").ToString();
                                if (nhamayhcm == "")
                                {
                                    nhamayhcm = "0";
                                }
                                else
                                {
                                    nhamayhcm = nhamayhcm.Replace(".", "").Replace(",", ".");
                                }

                                thuduc = view.GetRowCellValue(i, "TĐ, BH, NB (Đường thủy)").ToString();
                                if (thuduc == "")
                                {
                                    thuduc = "0";
                                }
                                else
                                {
                                    thuduc = thuduc.Replace(".", "").Replace(",", ".");
                                }

                                bienhoa = view.GetRowCellValue(i, "TĐ, BH (Đường bộ)").ToString();
                                if (bienhoa == "")
                                {
                                    bienhoa = "0";
                                }
                                else
                                {
                                    bienhoa = bienhoa.Replace(".", "").Replace(",", ".");
                                }

                                binhduong = view.GetRowCellValue(i, "Bình Dương (Đường bộ)").ToString();
                                if (binhduong == "")
                                {
                                    binhduong = "0";
                                }
                                else
                                {
                                    binhduong = binhduong.Replace(".", "").Replace(",", ".");
                                }

                                nhabe = view.GetRowCellValue(i, "Nhà Bè (Đường bộ)").ToString();
                                if (nhabe == "")
                                {
                                    nhabe = "0";
                                }
                                else
                                {
                                    nhabe = nhabe.Replace(".", "").Replace(",", ".");
                                }

                                kcnphumy = view.GetRowCellValue(i, "KCN Phú Mỹ (Đường Bộ +Thủy)").ToString();
                                if (kcnphumy == "")
                                {
                                    kcnphumy = "0";
                                }
                                else
                                {
                                    kcnphumy = kcnphumy.Replace(".", "").Replace(",", ".");
                                }

                                ltsh = view.GetRowCellValue(i, "LTSH-Xe XMTD-PT Thủy 200 tấn").ToString();
                                if (ltsh == "")
                                {
                                    ltsh = "0";
                                }
                                else
                                {
                                    ltsh = ltsh.Replace(".", "").Replace(",", ".");
                                }

                                baivong = view.GetRowCellValue(i, "Kho Phú Quốc - Bãi Vòng").ToString();
                                if (baivong == "")
                                {
                                    baivong = "0";
                                }
                                else
                                {
                                    baivong = baivong.Replace(".", "").Replace(",", ".");
                                }
                            }
                            gen.ExcuteNonquery("insert into StockIIGD(ID,PostedDate,InventoryItemCode,NhamayCT,KhoTN,KhoC22,KhoRG,NhamayHCM,KhoTD,KhoBH,KhoBD,KhoNB,KhoPM,KhoLTSH,KhoBV) values(newid(),'" + ngaychungtu + "','" + mahang + "','" + nhamaycantho + "','" + khotranoc + "','" + kho22lhp + "','" + khorachgia + "','" + nhamayhcm + "','" + thuduc + "','" + bienhoa + "','" + binhduong + "','" + nhabe + "','" + kcnphumy + "','" + ltsh + "','" + baivong + "')");
                        }
                    }
                    SplashScreenManager.CloseForm();
                    XtraMessageBox.Show("Dữ liệu đã được xử lý xong", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            else if (tsbt == "barbglpg")
            {
                if (XtraMessageBox.Show("Bạn có chắc muốn duyệt vật giá bán này?", gen.GetString("select Top 1 CompanyName from Center"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    SplashScreenManager.ShowForm(typeof(Frm_wait));
                    gen.ExcuteNonquery("delete InventoryItemAD where Month(PostedDate)='" + DateTime.Parse(ngaychungtu).Month + "' and Year(PostedDate)='" + DateTime.Parse(ngaychungtu).Year + "'");
                    for (int i = 0; i < view.RowCount; i++)
                    {
                        string mahang = view.GetRowCellValue(i, "ID").ToString();
                        string gia    = view.GetRowCellValue(i, "Tăng giảm giá").ToString();
                        if (gia == "")
                        {
                            gia = "0";
                        }
                        else
                        {
                            gia = gia.Replace(".", "").Replace(",", ".");
                        }
                        gen.ExcuteNonquery("insert InventoryItemAD values(newid(),'" + mahang + "'," + gia + ",'" + ngaychungtu + "','True')");
                    }
                    gen.ExcuteNonquery("duyetgiabanlpg '" + ngaychungtu + "'");
                    SplashScreenManager.CloseForm();
                    XtraMessageBox.Show("Dữ liệu đã được xử lý xong", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
        }
Exemplo n.º 24
0
        private void sbok_Click(object sender, EventArgs e)
        {
            DialogResult dr = XtraMessageBox.Show("Bạn có thực sự muốn thay đổi?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);

            if (dr == DialogResult.Yes)
            {
                if (tsbt == "tsbthdbhchange")
                {
                    try
                    {
                        DataTable makhach = gen.GetTable("select  AccountingObjectID,AccountingObjectName,Address,CompanyTaxCode from  AccountingObject where  AccountingObjectCode='" + searchLookUpEdit1.EditValue + "'");

                        /*
                         * Double phantram = Double.Parse(gen.GetString("select Website from MSC_User where UserID='" + userid + "'")) / 100;
                         * if (Double.Parse(txthm.EditValue.ToString()) + Double.Parse(txthm.EditValue.ToString()) * phantram < Double.Parse(txtcn.EditValue.ToString()) + congno)
                         * {
                         *  XtraMessageBox.Show("Vui lòng kiểm tra lại Tổng công nợ vượt hạn mức hợp đồng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         *  return;
                         * }
                         */

                        if (gen.GetString("select Top 1 CompanyTaxCode from Center") == "1801115004" || gen.GetString("select Top 1 CompanyTaxCode from Center") == "18001113092")
                        {
                            Double phantram = Double.Parse(gen.GetString("select Website from MSC_User where UserID='" + userid + "'")) / 100;

                            Double dinhmuc = 0;
                            if (phantram > 0 && phantram < 0.5)
                            {
                                dinhmuc = 50000000;
                            }
                            else if (phantram > 0.5 && phantram < 1)
                            {
                                dinhmuc = 150000000;
                            }
                            else if (phantram == 1)
                            {
                                dinhmuc = 300000000;
                            }

                            if (sehd.Text != "" && (Double.Parse(txthm.EditValue.ToString()) + Double.Parse(txthm.EditValue.ToString()) * phantram < Double.Parse(txtcn.EditValue.ToString()) + congno || Double.Parse(txthm.EditValue.ToString()) + dinhmuc < Double.Parse(txtcn.EditValue.ToString()) + congno))
                            {
                                XtraMessageBox.Show("Vui lòng kiểm tra lại Tổng công nợ vượt hạn mức hợp đồng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                            else if (gen.GetString("select Top 1 CompanyTaxCode from Center") == "18001113092")
                            {
                                if (Double.Parse(txthm.EditValue.ToString()) < Double.Parse(txtcn.EditValue.ToString()) - congno)
                                {
                                    XtraMessageBox.Show("Vui lòng thu tiền trước khi xuất lô hàng tiếp theo.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            Double phantram = Double.Parse(gen.GetString("select Website from MSC_User where UserID='" + userid + "'")) / 100;

                            Double dinhmuc = 0;
                            if (phantram > 0 && phantram < 0.5)
                            {
                                dinhmuc = 100000000;
                            }
                            else if (phantram >= 0.5)
                            {
                                dinhmuc = 300000000;
                            }

                            if ((Double.Parse(txthm.EditValue.ToString()) + Double.Parse(txthm.EditValue.ToString()) * phantram < Double.Parse(txtcn.EditValue.ToString()) + congno || Double.Parse(txthm.EditValue.ToString()) + dinhmuc < Double.Parse(txtcn.EditValue.ToString()) + congno))
                            {
                                XtraMessageBox.Show("Vui lòng kiểm tra lại Tổng công nợ vượt hạn mức hợp đồng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }

                        if (txtsct.Text != searchLookUpEdit1.Text && gen.GetString("select AccountingObjectType from SSInvoice where RefID='" + ID + "'") == "1")
                        {
                            Double hanmuc   = 20000000;
                            Double tongxuat = Double.Parse(gen.GetString("select COALESCE(Sum(TotalAmount+TotalCost-TotalDiscountAmount-TotalFreightAmount+TotalVATAmount),0) from SSInvoice where Convert(varchar, CABARefDate,111)=(select Convert(varchar, CABARefDate,111) from SSInvoice where RefID='" + ID + "') and AccountingObjectID='" + makhach.Rows[0][0] + "' and AccountingObjectType='1' "));
                            Double tong     = Double.Parse(gen.GetString("select COALESCE(TotalAmount+TotalCost-TotalDiscountAmount-TotalFreightAmount+TotalVATAmount,0) from SSInvoice where RefID='" + ID + "'"));
                            if (tongxuat + tong > hanmuc)
                            {
                                XtraMessageBox.Show("Tổng số tiền mặt trong ngày vượt quá 20 triệu, vui lòng kiểm tra lại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                        }

                        gen.ExcuteNonquery("update INOutwardLPG set AccountingObjectID='" + makhach.Rows[0][0] + "',AccountingObjectName=N'" + makhach.Rows[0][1] + "',AccountingObjectAddress=N'" + makhach.Rows[0][2] + "' where RefID in (select INOutwardRefID from (select Distinct INOutwardID from SSInvoiceINOutward where SSInvoiceID='" + ID + "') a, INOutward b where a.INOutwardID=b.RefID)");
                        gen.ExcuteNonquery("update DDH set AccountingObjectID='" + makhach.Rows[0][0] + "',AccountingObjectName=N'" + makhach.Rows[0][1] + "',AccountingObjectAddress=N'" + makhach.Rows[0][2] + "' where RefIDInOutward in (select RefNo from (select Distinct INOutwardID from SSInvoiceINOutward where SSInvoiceID='" + ID + "') a, INOutward b where a.INOutwardID=b.RefID)");
                        gen.ExcuteNonquery("update INOutward set AccountingObjectID='" + makhach.Rows[0][0] + "',AccountingObjectName=N'" + makhach.Rows[0][1] + "',AccountingObjectAddress=N'" + makhach.Rows[0][2] + "' where RefID in (select Distinct INOutwardID from SSInvoiceINOutward where SSInvoiceID='" + ID + "')");
                        gen.ExcuteNonquery("update SSInvoice set AccountingObjectID='" + makhach.Rows[0][0] + "',AccountingObjectName=N'" + makhach.Rows[0][1] + "',AccountingObjectAddress=N'" + makhach.Rows[0][2] + "',CustomField5='" + makhach.Rows[0][3] + "' where RefID='" + ID + "'");
                        gen.ExcuteNonquery("update HACHTOAN set AccountingObjectID='" + makhach.Rows[0][0] + "',AccountingObjectIDMain='" + makhach.Rows[0][0] + "' where RefID='" + ID + "'");
                        gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Đổi mã khách','" + chungtu + " " + txtsct.Text + "=" + searchLookUpEdit1.EditValue + "')");
                        XtraMessageBox.Show("Mã khách < " + txtsct.Text + " > đã được đổi thành < " + searchLookUpEdit1.EditValue + " > vui lòng kiểm tra lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    catch
                    {
                        XtraMessageBox.Show("Bạn phải chọn mã khách mới.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else if (tsbt == "tsbtddhlpgchange")
                {
                    DataTable makhach = gen.GetTable("select  AccountingObjectID,AccountingObjectName,Address,CompanyTaxCode from  hamaco.dbo.AccountingObject where  AccountingObjectCode='" + searchLookUpEdit1.EditValue + "'");
                    //DataTable makhach_ta = gen.GetTable("select  AccountingObjectID,AccountingObjectName,Address,CompanyTaxCode from  hamaco_ta.dbo.AccountingObject where  AccountingObjectCode='" + searchLookUpEdit1.EditValue + "'");
                    //DataTable makhach_tn = gen.GetTable("select  AccountingObjectID,AccountingObjectName,Address,CompanyTaxCode from  hamaco_tn.dbo.AccountingObject where  AccountingObjectCode='" + searchLookUpEdit1.EditValue + "'");
                    //gen.ExcuteNonquery("update hamaco.dbo.INOutward set AccountingObjectID='" + makhach.Rows[0][0] + "',AccountingObjectName=N'" + makhach.Rows[0][1] + "',AccountingObjectAddress=N'" + makhach.Rows[0][2] + "' where INOutwardRefID='" + ID + "'");
                    //gen.ExcuteNonquery("update hamaco_ta.dbo.INOutward set AccountingObjectID='" + makhach_ta.Rows[0][0] + "',AccountingObjectName=N'" + makhach_ta.Rows[0][1] + "',AccountingObjectAddress=N'" + makhach_ta.Rows[0][2] + "' where INOutwardRefID='" + ID + "'");
                    //gen.ExcuteNonquery("update hamaco_tn.dbo.INOutward set AccountingObjectID='" + makhach_tn.Rows[0][0] + "',AccountingObjectName=N'" + makhach_tn.Rows[0][1] + "',AccountingObjectAddress=N'" + makhach_tn.Rows[0][2] + "' where INOutwardRefID='" + ID + "'");
                    gen.ExcuteNonquery("update INOutwardLPG set AccountingObjectID='" + makhach.Rows[0][0] + "',AccountingObjectName=N'" + makhach.Rows[0][1] + "',AccountingObjectAddress=N'" + makhach.Rows[0][2] + "' where RefID='" + ID + "'");
                    XtraMessageBox.Show("Mã khách < " + txtsct.Text + " > đã được đổi thành < " + searchLookUpEdit1.EditValue + " > vui lòng kiểm tra lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    try
                    {
                        string ton = null;
                        if (tsbt == "tsbthdbh")
                        {
                            ton = gen.GetString("select * from SSInvoice where RefNo='" + textEdit1.Text + "'");
                        }
                        else if (tsbt == "tsbthdmh")
                        {
                            ton = gen.GetString("select * from PUInvoice where RefNo='" + textEdit1.Text + "'");
                        }
                        XtraMessageBox.Show("Số phiếu < " + textEdit1.Text + " > đã có trong hệ thống vui lòng xem lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch
                    {
                        if (tsbt == "tsbthdbh")
                        {
                            gen.ExcuteNonquery("update SSInvoice set RefNo='" + textEdit1.Text + "' where RefID='" + ID + "'");
                        }
                        else if (tsbt == "tsbthdmh")
                        {
                            gen.ExcuteNonquery("update PUInvoice set RefNo='" + textEdit1.Text + "' where RefID='" + ID + "'");
                        }
                        gen.ExcuteNonquery("update HACHTOAN set RefNo='" + textEdit1.Text + "' where RefID='" + ID + "'");
                        this.myac();
                        gen.ExcuteNonquery("insert into MSC_Auditting_Log(EventID,LoginName,ComputerName,Time,PermissionTypeAlias,Reference) values(newid(),'" + gen.GetString("select UserName from MSC_User where UserID='" + userid + "'").ToString() + "','" + System.Environment.MachineName + "',GETDATE(),N'Đổi phiếu','" + txtsct.Text + "=" + textEdit1.Text + "')");
                        XtraMessageBox.Show("Số phiếu < " + txtsct.Text + " > đã được đổi thành < " + textEdit1.Text + " > vui lòng kiểm tra lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                }
            }
        }
Exemplo n.º 25
0
        private void tsbtsave_Click(object sender, EventArgs e)
        {
            string loai = gen.GetString("select * from InventoryItemCategory where InventoryCategoryCode='" + leloai.EditValue.ToString().Trim() + "'");
            int    tc = Convert.ToInt32(letc.EditValue.ToString());
            string thue = "0";
            string tlcd, dgtk;

            if (txttlcd.Text == "")
            {
                tlcd = "NULL";
            }
            else
            {
                tlcd = txttlcd.Text.Replace(".", "").Replace(",", ".");
            }
            if (txtdgtk.Text == "")
            {
                dgtk = "NULL";
            }
            else
            {
                dgtk = txtdgtk.Text.Replace(".", "").Replace(",", ".");
            }
            if (txtcode.Text == "")
            {
                MessageBox.Show("Mã vật tư, hàng hóa không được bỏ trống.", "HAMACO");
            }
            else if (txtname.Text == "")
            {
                MessageBox.Show("Tên vật tư hàng hóa không được bỏ trống.", "HAMACO");
            }
            {
                if (active == "1")
                {
                    try
                    {
                        string mb = gen.GetString("select * from hamaco.dbo.InventoryItem where InventoryItemCode='" + lemb.Text + "'");
                        gen.ExcuteNonquery("update hamaco.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ", Parent='" + mb + "',SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                        gen.ExcuteNonquery("update hamaco_ta.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ", Parent='" + mb + "',SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                        gen.ExcuteNonquery("update hamaco_tn.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ", Parent='" + mb + "',SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                        gen.ExcuteNonquery("update hamaco_vithanh.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ", Parent='" + mb + "',SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                        gen.ExcuteNonquery("update hamaco_qlk.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ", Parent='" + mb + "',SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                    }
                    catch
                    {
                        gen.ExcuteNonquery("update hamaco.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ",SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                        gen.ExcuteNonquery("update hamaco_ta.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ",SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                        gen.ExcuteNonquery("update hamaco_tn.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ",SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                        gen.ExcuteNonquery("update hamaco_vithanh.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ",SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                        gen.ExcuteNonquery("update hamaco_qlk.dbo.InventoryItem set InventoryItemName=N'" + txtname.Text + "',Unit=N'" + txtdvt.Text + "',ConvertUnit=N'" + txtdvcd.Text + "',ConvertRate=" + tlcd + ",GuarantyPeriod=N'" + txtthbh.Text + "',Inactive='" + chbntdoi.Checked.ToString() + "',InventoryCategoryID='" + loai + "',TaxRate='" + thue + "',InventoryItemType='" + tc + "',SalePrice=" + dgtk + ",SaleDescription=N'" + txtnganhhang.Text + "',PurchaseDescription=N'" + txtnhomhang.Text + "', IsSystem='" + chhkm.Checked + "' where InventoryItemCode='" + txtcode.Text + "'");
                    }
                    this.myac();
                    this.Close();
                }
                else
                {
                    try
                    {
                        string mb = gen.GetString("select * from hamaco.dbo.InventoryItem where InventoryItemCode='" + lemb.Text + "'");
                        ii.checkii(active, txtcode, txtname, "insert into hamaco.dbo.InventoryItem(InventoryItemID,InventoryCategoryID,InventoryItemCode,InventoryItemName,GuarantyPeriod,Unit,ConvertUnit,ConvertRate,SalePrice,TaxRate,InventoryItemType,Inactive,Parent,SaleDescription,PurchaseDescription,IsSystem) values(newid(),'" + loai + "','" + txtcode.Text + "',N'" + txtname.Text + "',N'" + txtthbh.Text + "',N'" + txtdvt.Text + "',N'" + txtdvcd.Text + "'," + tlcd + "," + dgtk + ",'" + thue + "','" + tc + "','" + chbntdoi.Checked.ToString() + "','" + mb + "',N'" + txtnganhhang.Text + "',N'" + txtnhomhang.Text + "','" + chhkm.Checked + "')", this);
                    }
                    catch
                    {
                        ii.checkii(active, txtcode, txtname, "insert into hamaco.dbo.InventoryItem(InventoryItemID,InventoryCategoryID,InventoryItemCode,InventoryItemName,GuarantyPeriod,Unit,ConvertUnit,ConvertRate,SalePrice,TaxRate,InventoryItemType,Inactive,SaleDescription,PurchaseDescription,IsSystem) values(newid(),'" + loai + "','" + txtcode.Text + "',N'" + txtname.Text + "',N'" + txtthbh.Text + "',N'" + txtdvt.Text + "',N'" + txtdvcd.Text + "'," + tlcd + "," + dgtk + ",'" + thue + "','" + tc + "','" + chbntdoi.Checked.ToString() + "',N'" + txtnganhhang.Text + "',N'" + txtnhomhang.Text + "','" + chhkm.Checked + "')", this);
                    }
                }
            }
        }
Exemplo n.º 26
0
 private void btok_Click(object sender, EventArgs e)
 {
     gen.ExcuteNonquery("delete from MSC_UserJoinRole where UserID='" + role + "'");
     gen.ExcuteNonquery("insert into MSC_UserJoinRole values(newid(),'" + role + "','" + view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString() + "','4eb226e3-fb42-4ab4-b82e-7021d2322b40')");
     this.Close();
 }