Ejemplo n.º 1
0
        public bool UpdateThanhToanNgay(Entities.HoaDonNhap hdn)
        {
            bool Trave = false;

            try
            {
                dh  = new Constants.HoaDonNhap();
                Sql = new Constants.Sql();
                string sql = Sql.UpdateThanhToanNgayHoaDonNhap;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(dh.MaHoaDonNhap, SqlDbType.VarChar, 20).Value      = hdn.MaHoaDonNhap;
                cmd.Parameters.Add("@ThanhToanSauKhiLapPhieu", SqlDbType.Float).Value = hdn.ThanhToanSauKhiLapPhieu;
                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                {
                    Trave = true;
                }
                else
                {
                    Trave = false;
                }
                return(Trave);
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); return(Trave); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// vuong hung =================================
        /// </summary>
        /// <param name="HanhDong"></param>
        /// <param name="PhieuThuID"></param>
        public int sp_Xoa_HoaDonNhap(Entities.HoaDonNhap hdn)
        {
            int Trave = 0;

            try
            {
                dh  = new Constants.HoaDonNhap();
                Sql = new Constants.Sql();
                string sql = Sql.sp_Xoa_HoaDonNhap;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(dh.HanhDong, SqlDbType.NVarChar, 20).Value    = hdn.Hanhdong;
                cmd.Parameters.Add(dh.MaHoaDonNhap, SqlDbType.VarChar, 20).Value = hdn.MaHoaDonNhap;
                Trave = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(Trave);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Thanh toán sau lập phiếu
        /// </summary>
        /// <returns></returns>

        public bool InsertUpdateSauKhiLapPhieu(Entities.HoaDonNhap hdn)
        {
            try
            {
                bool kt = false;
                hoadonnhap = new Constants.HoaDonNhap();
                Sql        = new Constants.Sql();
                string        sql  = Sql.UpdateThanhToanNgayHoaDonNhap;
                Connection    conn = new Connection();
                SqlConnection cn   = conn.openConnection();
                SqlCommand    cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(hoadonnhap.MaHoaDonNhap, SqlDbType.VarChar, 20).Value = hdn.MaHoaDonNhap;
                cmd.Parameters.Add(hoadonnhap.ThanhToanNgay, SqlDbType.Float).Value      = hdn.ThanhToanSauKhiLapPhieu;

                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                {
                    kt = true;
                }
                else
                {
                    kt = false;
                }
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn   = null;
                conn = null;
                return(kt);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
 public frmXuLyNhapKho(string hanhdong, Entities.HoaDonNhap hoa)
 {
     InitializeComponent();
     this.hanhdong = hanhdong;
     this.hoadon = hoa;
     dsQuyDoiDonViTinh = this.Bangquydoidonvitinh();
 }
Ejemplo n.º 5
0
 public Entities.HoaDonNhap[] Select()
 {
     Entities.HoaDonNhap[] arrC = null;
     try
     {
         dh  = new Constants.HoaDonNhap();
         Sql = new Constants.Sql();
         string sql = "Select * from HoaDonNhap ";
         conn = new Connection();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         arr  = new ArrayList();
         while (dr.Read())
         {
             cla = new Entities.HoaDonNhap();
             cla.HoaDonNhapID            = System.Convert.ToInt32(dr[dh.HoaDonNhapID].ToString());
             cla.MaHoaDonNhap            = dr[dh.MaHoaDonNhap].ToString();
             cla.NgayNhap                = Convert.ToDateTime(dr[dh.NgayNhap].ToString());
             cla.MaHoaDonNhap            = dr[dh.MaHoaDonNhap].ToString();
             cla.NgayNhap                = Convert.ToDateTime(dr[dh.NgayNhap].ToString());
             cla.MaNhaCungCap            = "" + dr[dh.MaNhaCungCap].ToString();
             cla.NoHienThoi              = dr[dh.NoHienThoi].ToString();
             cla.NguoiGiaoHang           = dr[dh.NguoiGiaoHang].ToString();
             cla.HinhThucThanhToan       = dr[dh.HinhThucThanhToan].ToString();
             cla.MaKho                   = dr[dh.MaKho].ToString();
             cla.HanThanhToan            = Convert.ToDateTime(dr[dh.HanThanhToan].ToString());
             cla.MaDonDatHang            = dr[dh.MaDonDatHang].ToString();
             cla.MaTienTe                = dr[dh.MaTienTe].ToString();
             cla.ChietKhau               = Double.Parse(0 + dr[dh.ChietKhau].ToString()).ToString();
             cla.ThanhToanNgay           = Double.Parse(0 + dr[dh.ThanhToanNgay].ToString()).ToString();
             cla.ThueGTGT                = Double.Parse(0 + dr[dh.ThueGTGT].ToString()).ToString();
             cla.TongTien                = Double.Parse(0 + dr[dh.TongTien].ToString()).ToString();
             cla.GhiChu                  = dr[dh.GhiChu].ToString();
             cla.Deleted                 = Convert.ToBoolean(dr[dh.Deleted].ToString());
             cla.ThanhToanSauKhiLapPhieu = dr["ThanhToanSauKhiLapPhieu"].ToString();
             arr.Add(cla);
         }
         int n = arr.Count;
         if (n == 0)
         {
             arrC = null;
         }
         arrC = new Entities.HoaDonNhap[n];
         for (int i = 0; i < n; i++)
         {
             arrC[i] = (Entities.HoaDonNhap)arr[i];
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); arrC = null; }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(arrC);
 }
Ejemplo n.º 6
0
 public QuyDoi()
 {
     dh = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     cla = null;
     cn = null;
 }
Ejemplo n.º 7
0
 public QuyDoi()
 {
     dh   = null;
     Sql  = null;
     conn = null;
     cmd  = null;
     arr  = null;
     dr   = null;
     cla  = null;
     cn   = null;
 }
Ejemplo n.º 8
0
 public HangHoaGoiHang()
 {
     dh = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     cla = null;
     cn = null;
 }
Ejemplo n.º 9
0
 public HangHoaGoiHang()
 {
     dh   = null;
     Sql  = null;
     conn = null;
     cmd  = null;
     arr  = null;
     dr   = null;
     cla  = null;
     cn   = null;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public HoaDonNhap()
 {
     dh   = null;
     Sql  = null;
     conn = null;
     cmd  = null;
     arr  = null;
     dr   = null;
     cla  = null;
     cn   = null;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public HoaDonNhap()
 {
     dh = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     cla = null;
     cn = null;
 }
Ejemplo n.º 12
0
 public frmXuLyNhapKho(string hanhdong, HoaDonNhap hoa)
 {
     InitializeComponent();
     this.hanhdong = hanhdong;
     hoadon = hoa;
     //_dsQuyDoiDonViTinh = Bangquydoidonvitinh();
     try
     {
         _dsQuyDoiDonViTinh = "Select".GetDataFromServer<QuyDoiDonViTinh[]>(new CheckRefer("QD")).ToList();
     }
     catch
     {
         _dsQuyDoiDonViTinh = new List<QuyDoiDonViTinh>();
     }
 }
Ejemplo n.º 13
0
 public void LayHDNhap()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("HDN", "");
         clientstrem = cl.SerializeObj(this.client1, "Select", ctxh);
         Entities.HoaDonNhap[] HDN = new Entities.HoaDonNhap[0];
         HDN = (Entities.HoaDonNhap[])cl.DeserializeHepper1(clientstrem, HDN);
         if (HDN == null)
         {
             HoaDonNhap = new Entities.HoaDonNhap[0];
             return;
         }
         int count = 0;
         for (int i = 0; i < HDN.Length; i++)
         {
             DateTime ngaylap = HDN[i].NgayNhap;
             if (ngaylap >= BatDau && ngaylap <= KetThuc)
             {
                 count++;
             }
         }
         Entities.HoaDonNhap[] HoaDonNhap1 = new Entities.HoaDonNhap[count];
         count = 0;
         for (int i = 0; i < HDN.Length; i++)
         {
             DateTime ngaylap = HDN[i].NgayNhap;
             if (ngaylap >= BatDau && ngaylap <= KetThuc)
             {
                 HoaDonNhap1[count] = HDN[i];
                 count++;
             }
         }
         if (HoaDonNhap1.Length == 0)
         {
             HoaDonNhap = new Entities.HoaDonNhap[0];
             return;
         }
         else
         {
             HoaDonNhap = HoaDonNhap1;
         }
     }
     catch { }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// lay ban ghi cuoi cung
 /// </summary>
 public Entities.HoaDonNhap LayHoaDonNhap(Entities.TruyenGiaTri truyen)
 {
     Entities.HoaDonNhap giatri = null;
     try
     {
         string sql = "exec sp_LayBang_TheoTenBang @table,@values";
         conn = new Connection();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         cmd.Parameters.Add("table", SqlDbType.NVarChar, 100).Value = truyen.Giatritruyen;
         cmd.Parameters.Add("values", SqlDbType.NVarChar, 50).Value = truyen.Giatrithuhai;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             giatri                      = new Entities.HoaDonNhap();
             giatri.Hanhdong             = "";
             giatri.HoaDonNhapID         = int.Parse(dr[0].ToString());
             giatri.MaHoaDonNhap         = dr[1].ToString();
             giatri.NgayNhap             = Convert.ToDateTime(dr[2].ToString());
             giatri.MaNhaCungCap         = dr[3].ToString();
             giatri.NoHienThoi           = dr[4].ToString();
             giatri.NguoiGiaoHang        = dr[5].ToString();
             giatri.HinhThucThanhToan    = dr[6].ToString();
             giatri.MaKho                = dr[7].ToString();
             giatri.HanThanhToan         = Convert.ToDateTime(dr[8].ToString());
             giatri.MaDonDatHang         = dr[9].ToString();
             giatri.MaTienTe             = dr[10].ToString();
             giatri.ChietKhau            = dr[11].ToString();
             giatri.ThanhToanNgay        = dr[12].ToString();
             giatri.ThueGTGT             = dr[13].ToString();
             giatri.TongTien             = dr[14].ToString();
             giatri.GhiChu               = dr[15].ToString();
             giatri.Deleted              = Convert.ToBoolean(dr[16].ToString());
             cla.ThanhToanSauKhiLapPhieu = dr[17].ToString();
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); return(null); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(giatri);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// lay ban ghi cuoi cung
 /// </summary>
 public Entities.HoaDonNhap LayHoaDonNhap(Entities.TruyenGiaTri truyen)
 {
     Entities.HoaDonNhap giatri = null;
     try
     {
         string sql = "exec sp_LayBang_TheoTenBang @table,@values";
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add("table", SqlDbType.NVarChar, 100).Value = truyen.Giatritruyen;
         cmd.Parameters.Add("values", SqlDbType.NVarChar, 50).Value = truyen.Giatrithuhai;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             giatri = new Entities.HoaDonNhap();
             giatri.Hanhdong = "";
             giatri.HoaDonNhapID = int.Parse(dr[0].ToString());
             giatri.MaHoaDonNhap = dr[1].ToString();
             giatri.NgayNhap = Convert.ToDateTime(dr[2].ToString());
             giatri.MaNhaCungCap = dr[3].ToString();
             giatri.NoHienThoi = dr[4].ToString();
             giatri.NguoiGiaoHang = dr[5].ToString();
             giatri.HinhThucThanhToan = dr[6].ToString();
             giatri.MaKho = dr[7].ToString();
             giatri.HanThanhToan = Convert.ToDateTime(dr[8].ToString());
             giatri.MaDonDatHang = dr[9].ToString();
             giatri.MaTienTe = dr[10].ToString();
             giatri.ChietKhau = dr[11].ToString();
             giatri.ThanhToanNgay = dr[12].ToString();
             giatri.ThueGTGT = dr[13].ToString();
             giatri.TongTien = dr[14].ToString();
             giatri.GhiChu = dr[15].ToString();
             giatri.Deleted = Convert.ToBoolean(dr[16].ToString());
             cla.ThanhToanSauKhiLapPhieu = dr[17].ToString();
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); return null; }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return giatri;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// vuong hung ===================== them sua HoaDonNhap=====================
        /// </summary>
        public int sp_XuLy_HoaDonNhap(Entities.HoaDonNhap hdn)
        {
            int Trave = 0;

            try
            {
                dh  = new Constants.HoaDonNhap();
                Sql = new Constants.Sql();
                string sql = Sql.sp_XuLy_HoaDonNhap;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(dh.HanhDong, SqlDbType.NVarChar, 20).Value      = hdn.Hanhdong;
                cmd.Parameters.Add(dh.HoaDonNhapID, SqlDbType.Int).Value           = hdn.HoaDonNhapID;
                cmd.Parameters.Add(dh.MaHoaDonNhap, SqlDbType.VarChar, 20).Value   = hdn.MaHoaDonNhap;
                cmd.Parameters.Add(dh.NgayNhap, SqlDbType.DateTime).Value          = hdn.NgayNhap;
                cmd.Parameters.Add(dh.MaNhaCungCap, SqlDbType.NVarChar, 20).Value  = hdn.MaNhaCungCap;
                cmd.Parameters.Add(dh.NoHienThoi, SqlDbType.Float).Value           = hdn.NoHienThoi;
                cmd.Parameters.Add(dh.NguoiGiaoHang, SqlDbType.NVarChar, 20).Value = hdn.NguoiGiaoHang;
                cmd.Parameters.Add(dh.HinhThucThanhToan, SqlDbType.NVarChar).Value = hdn.HinhThucThanhToan;
                cmd.Parameters.Add(dh.MaKho, SqlDbType.VarChar, 20).Value          = hdn.MaKho;
                cmd.Parameters.Add(dh.HanThanhToan, SqlDbType.DateTime).Value      = hdn.HanThanhToan;
                cmd.Parameters.Add(dh.MaDonDatHang, SqlDbType.VarChar, 20).Value   = hdn.MaDonDatHang;
                cmd.Parameters.Add(dh.MaTienTe, SqlDbType.VarChar, 20).Value       = hdn.MaTienTe;
                cmd.Parameters.Add(dh.ChietKhau, SqlDbType.Float).Value            = hdn.ChietKhau;
                cmd.Parameters.Add(dh.ThanhToanNgay, SqlDbType.Float).Value        = hdn.ThanhToanNgay;
                cmd.Parameters.Add(dh.ThueGTGT, SqlDbType.Float).Value             = hdn.ThueGTGT;
                cmd.Parameters.Add(dh.TongTien, SqlDbType.Float).Value             = hdn.TongTien;
                cmd.Parameters.Add(dh.GhiChu, SqlDbType.NVarChar).Value            = hdn.GhiChu;
                cmd.Parameters.Add(dh.Deleted, SqlDbType.Bit).Value = hdn.Deleted;
                cmd.Parameters.Add("ThanhToanSauKhiLapPhieu", SqlDbType.Float).Value = hdn.ThanhToanSauKhiLapPhieu;
                Trave = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); Trave = 0; }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(Trave);
        }
Ejemplo n.º 17
0
 public void LayHDNhap()
 {
     try
     {
         cl = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("HDN", "");
         clientstrem = cl.SerializeObj(this.client1, "Select", ctxh);
         Entities.HoaDonNhap[] HDN = new Entities.HoaDonNhap[0];
         HDN = (Entities.HoaDonNhap[])cl.DeserializeHepper1(clientstrem, HDN);
         if (HDN == null)
         {
             HoaDonNhap = new Entities.HoaDonNhap[0];
             return;
         }
         int count = 0;
         for (int i = 0; i < HDN.Length; i++)
         {
             DateTime ngaylap = HDN[i].NgayNhap;
             if (ngaylap >= BatDau && ngaylap <= KetThuc)
             {
                 count++;
             }
         }
         Entities.HoaDonNhap[] HoaDonNhap1 = new Entities.HoaDonNhap[count];
         count = 0;
         for (int i = 0; i < HDN.Length; i++)
         {
             DateTime ngaylap = HDN[i].NgayNhap;
             if (ngaylap >= BatDau && ngaylap <= KetThuc)
             {
                 HoaDonNhap1[count] = HDN[i];
                 count++;
             }
         }
         if (HoaDonNhap1.Length == 0)
         {
             HoaDonNhap = new Entities.HoaDonNhap[0];
             return;
         }
         else
             HoaDonNhap = HoaDonNhap1;
     }
     catch { }
 }
Ejemplo n.º 18
0
        private void XuLy_HoaDonNhap(string hanhdong)
        {
            try
            {
                if (!KiemTraNgayHetHan()) return;

                thanhtoan = new Entities.HoaDonNhap[1];
                Entities.HoaDonNhap don = new Entities.HoaDonNhap();
                Common.Utilities ck = new Common.Utilities();
                string thoigian_1 = makNgaydonhang.Text;
                string thoigian_2 = makHanthanhtoan.Text;
                string thoigian_sosanh = Date.ToString("dd/MM/yyyy");
                if (string.IsNullOrEmpty(thoigian_1) || string.IsNullOrEmpty(thoigian_2))
                {
                    MessageBox.Show("Kiểm tra ngày"); return;
                }
                if (!(ck.SoSanhNgay('/', ">=", thoigian_1, thoigian_sosanh) && ck.SoSanhNgay('/', ">=", thoigian_2, thoigian_sosanh)))
                {
                    MessageBox.Show("Kiểm tra ngày"); return;
                }
                else
                {
                    bool _kq0 = true; bool _kq1 = true;
                    don.NgayNhap = Utils.StringToDateTime(thoigian_1, out _kq0);
                    don.HanThanhToan = Utils.StringToDateTime(thoigian_2, out _kq1);
                    //don.NgayNhap = DateTime.Parse(new Common.Utilities().KiemTraDinhDangNgayThangNam("ThangNgayNam", thoigian_1, '/'));
                    //don.HanThanhToan = DateTime.Parse(new Common.Utilities().KiemTraDinhDangNgayThangNam("ThangNgayNam", thoigian_2, '/'));
                    don.Hanhdong = hanhdong;
                    don.HoaDonNhapID = ID;
                    don.MaHoaDonNhap = txtSodonhang.Text;
                    don.MaNhaCungCap = txtManhacungcap.Text;
                    don.NoHienThoi = txtNohienthoi.Text;
                    don.NguoiGiaoHang = "" + txtnguoigiaohang.Text;
                    don.HinhThucThanhToan = cbxHinhthucthanhtoan.SelectedItem.ToString();
                    string kh = "";
                    try { kh = cbxKhoHang.SelectedValue.ToString(); }
                    catch (Exception ex) { MessageBox.Show("Kiểm tra mã kho"); kh = ""; return; }
                    don.MaKho = kh;
                    string MaDonDatHang = txtMadondathang.Text;
                    if (MaDonDatHang == "<F4 - Tra cứu>" || MaDonDatHang.Length <= 0)
                    {
                        MaDonDatHang = "NULL";
                    }
                    don.MaDonDatHang = MaDonDatHang;
                    string tt = "";
                    try { tt = cbxTienTe_TyGia.SelectedValue.ToString(); }
                    catch (Exception ex) { MessageBox.Show("Kiểm tra mã tiền tệ"); tt = ""; return; }
                    don.MaTienTe = tt;
                    don.ChietKhau = Double.Parse(0 + txtTienCKTM0.Text).ToString();
                    don.ThanhToanNgay = Double.Parse(0 + txtThanhtoanngay.Text.Replace(",", "")).ToString();
                    don.ThueGTGT = Double.Parse(0 + txtGiatrigiatang.Text).ToString();
                    don.TongTien = Double.Parse(0 + txtTongThanhToan.Text).ToString();
                    don.GhiChu = "" + txtDiengiai.Text;
                    don.Deleted = false;
                    don.Manhanvien = Common.Utilities.User.NhanVienID;
                    don.Tendangnhap = Common.Utilities.User.TenDangNhap;
                    don.ThanhToanSauKhiLapPhieu = "0";
                    if (dgvInsertOrder.RowCount > 0)
                    {
                        if (CheckData(don) == true)
                        {
                            cl = new Server_Client.Client();
                            this.client = cl.Connect(Luu.IP, Luu.Ports);
                            clientstrem = cl.SerializeObj(this.client, "HoaDonNhap", don);
                            Entities.HoaDonNhap[] tralai = new Entities.HoaDonNhap[1];
                            int trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, tralai));
                            if (trave == 1)
                            {
                                thanhtoan[0] = don;
                                try
                                {
                                    LuuChiTietDonHang();
                                }
                                catch { }
                                CapNhatTrangThaiDonDatHang("Update", MaDonDatHang, "Đã thành công");
                                frmQuanLyNhapKho.BaoDong = "";
                                DialogResult giatri = MessageBox.Show("Bạn có muốn thêm phiếu nhập tiếp không?", "Thông Báo", System.Windows.Forms.MessageBoxButtons.YesNo);
                                {
                                    if (giatri == DialogResult.No)
                                        frmQuanLyNhapKho.BaoDong = "A";
                                } this.Close();
                            }
                            else
                            {
                                MessageBox.Show("Thất bại");
                            }
                        }
                    }
                    else
                    { MessageBox.Show("Không có hàng hóa trong đơn đặt hàng"); }
                }
            }
            catch (Exception ex)
            {
                string s = ex.Message.ToString();
                MessageBox.Show("Thông tin nhập không đúng");
            }
        }
Ejemplo n.º 19
0
 private void XuLy_Xoa_HoaDonNhap(string hanhdong, string mahoadonnhap)
 {
     try
     {
         Entities.HoaDonNhap them = new Entities.HoaDonNhap();
         them = new Entities.HoaDonNhap(hanhdong, mahoadonnhap);
         clientstrem = cl.SerializeObj(this.client, "HoaDonNhap", them);
         //hứng giá trị trả về
         int trave;
         Entities.HoaDonNhap[] tralai = new Entities.HoaDonNhap[1];
         trave = (int)cl.DeserializeHepper(clientstrem, tralai);
         //thong bao
         if (trave == 1) { MessageBox.Show("Thành công !"); }
         else { MessageBox.Show("Thất bại !"); }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
Ejemplo n.º 20
0
 private Entities.HoaDonNhap ConfilickData(string table, string values)
 {
     Entities.HoaDonNhap ddh = new Entities.HoaDonNhap();
     try
     {
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         Entities.TruyenGiaTri gitri = new Entities.TruyenGiaTri("Select", table, values);
         clientstrem = cl.SerializeObj(this.client, "CheckHoaDonNhap", gitri);
         ddh = (Entities.HoaDonNhap)cl.DeserializeHepper(clientstrem, ddh);
         client.Close();
         clientstrem.Close();
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         ddh = null;
     }
     return ddh;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// vuong hung ========================hien thi hoa don nhap===================
        /// </summary>
        /// <returns></returns>
        public Entities.HoaDonNhap[] sp_LayBang_HoaDonNhap(Entities.HoaDonNhap hoadon)
        {
            Entities.HoaDonNhap[] arrC = null;
            try
            {
                dh = new Constants.HoaDonNhap();
                Sql = new Constants.Sql();
                string sql = Sql.sp_LayBang_HoaDonNhap;
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(dh.MaHoaDonNhap, SqlDbType.VarChar, 20).Value = hoadon.MaHoaDonNhap;
                cmd.Parameters.Add(dh.MaKho, SqlDbType.VarChar, 20).Value = hoadon.MaKho;
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    cla = new Entities.HoaDonNhap();
                    cla.HoaDonNhapID = System.Convert.ToInt32(dr[dh.HoaDonNhapID].ToString());
                    cla.MaHoaDonNhap = dr[dh.MaHoaDonNhap].ToString();
                    cla.NgayNhap = Convert.ToDateTime(dr[dh.NgayNhap].ToString());
                    cla.MaHoaDonNhap = dr[dh.MaHoaDonNhap].ToString();
                    cla.NgayNhap = Convert.ToDateTime(dr[dh.NgayNhap].ToString());
                    cla.MaNhaCungCap = dr[dh.MaNhaCungCap].ToString();
                    cla.NoHienThoi = dr[dh.NoHienThoi].ToString();
                    cla.NguoiGiaoHang = dr[dh.NguoiGiaoHang].ToString();
                    cla.HinhThucThanhToan = dr[dh.HinhThucThanhToan].ToString();
                    cla.MaKho = dr[dh.MaKho].ToString();
                    cla.HanThanhToan = Convert.ToDateTime(dr[dh.HanThanhToan].ToString());
                    cla.MaDonDatHang = dr[dh.MaDonDatHang].ToString();
                    cla.MaTienTe = dr[dh.MaTienTe].ToString();
                    cla.ChietKhau = Double.Parse(0 + dr[dh.ChietKhau].ToString()).ToString();
                    cla.ThanhToanNgay = Double.Parse(0 + dr[dh.ThanhToanNgay].ToString()).ToString();
                    cla.ThueGTGT = Double.Parse(0 + dr[dh.ThueGTGT].ToString()).ToString();
                    cla.TongTien = Double.Parse(0 + dr[dh.TongTien].ToString()).ToString();
                    cla.GhiChu = dr[dh.GhiChu].ToString();
                    cla.Deleted = Convert.ToBoolean(dr[dh.Deleted].ToString());
                    cla.ThanhToanSauKhiLapPhieu = dr["ThanhToanSauKhiLapPhieu"].ToString();
                    arr.Add(cla);
                }
                int n = arr.Count;
                if (n == 0) { arrC = null; }
                arrC = new Entities.HoaDonNhap[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.HoaDonNhap)arr[i];
                }

            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); arrC = null; }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return arrC;
        }
Ejemplo n.º 22
0
 private void DeleteData(string ID)
 {
     try
     {
         Entities.HoaDonNhap dh = new Entities.HoaDonNhap();
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         dh = new Entities.HoaDonNhap("Delete", ID);
         clientstrem = cl.SerializeObj(this.client, "HoaDonNhap", dh);
         int trave = 0;
         trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, trave));
         client.Close();
         clientstrem.Close();
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }