text: ﻿USE [QL_DH_GH_ONLINE]
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_CN]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  CREATE PROCEDURE [dbo].[SP_INSERT_CN] @DC nvarchar(40), @SDT varchar(12), @MADT char(5)
  AS
  INSERT INTO CHINHANH(DIACHI, SDT, MADT) VALUES (@DC, @SDT, @MADT)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_CTDH]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_CTDH] @MASP CHAR(5), @MADH CHAR(5), @SLSP INT
  AS
  INSERT INTO CTDONHANG(MASP, MADH,SLSANPHAM) VALUES (@MASP, @MADH, @SLSP)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_DGH]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_DGH] @MATX CHAR(5), @MADH CHAR(5), @TTGH NVARCHAR(40)
  AS
  INSERT INTO DONGIAOHANG VALUES (@MATX, @MADH, @TTGH)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_DH]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_DH] @MAKH CHAR(5), @TTDH NVARCHAR(15), @DIACHIGH NVARCHAR(40),
  							  @PHIVC MONEY, @TONGTIEN MONEY
  AS
  INSERT INTO DONHANG(MAKH,TTDONHANG,DIACHIGH,PHIVC,TONGTIEN) 
  VALUES (@MAKH, @TTDH, @DIACHIGH, @PHIVC, @TONGTIEN)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_DT]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_DT] @TENDT NVARCHAR(40), @TP NVARCHAR(15), @QUAN NVARCHAR(50),
  						@DC NVARCHAR(40), @SDT CHAR(15), @EMAIL CHAR(40),
  						@MST CHAR(15), @MALH CHAR(5), @MANDD CHAR(5)
  AS
  INSERT INTO DOITAC(TENDOITAC,THANHPHO,QUAN,DIACHI,SDT,EMAIL,MST,MALH,MANDD)
  VALUES (@TENDT, @TP, @QUAN, @DC, @SDT, @EMAIL, @MST, @MALH, @MANDD)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_HD]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_HD] @MADT CHAR(5), @MACN CHAR(5), @NGAYKY DATE, @NGAYKT DATE, @PTHOAHONG FLOAT, @TTHD NVARCHAR(40)
  AS
  INSERT INTO HOPDONG(MADT,MACN,NGAYKY,NGAYKT,PHANTRAMHOAHONG,TINHTRANGHD)
  VALUES (@MADT,@MACN,@NGAYKY,@NGAYKT,@PTHOAHONG,@TTHD)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_KH]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_KH] @HOTEN NVARCHAR(40), @SDT CHAR(15), @EMAIL CHAR(40), @DC NVARCHAR(40)
  AS
  INSERT INTO KHACHHANG(HOTEN,SĐT,EMAIL,DIACHI) VALUES (@HOTEN,@SDT,@EMAIL,@DC)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_KVHD]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_KVHD] @DIACHI NVARCHAR(40)
  AS
  INSERT INTO KHUVUCHOATDONG(DIACHIKV) VALUES (@DIACHI)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_LHVC]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_LHVC] @TENLH NVARCHAR(40), @MT NVARCHAR(40)
  AS
  INSERT INTO LHVANCHUYEN(TENLOAIHANG,MOTA) VALUES (@TENLH,@MT)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_LOGIN]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_LOGIN] @USERID CHAR(5), @USERNAME CHAR(20), @PW CHAR(10), @ROLE NVARCHAR(40)
  AS
  INSERT INTO LOGIN(USERID,USERNAME,PASSWORD,ROLE_USER) VALUES (@USERID,@USERNAME,@PW,@ROLE)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_NDD]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_NDD] @HOTEN NVARCHAR(40)
  AS
  INSERT INTO NGUOIDAIDIEN(TENNGUOIDAIDIEN) VALUES (@HOTEN)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_NV]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  CREATE PROCEDURE [dbo].[SP_INSERT_NV] @TEN NVARCHAR(40), @SDT CHAR(15), @DC NVARCHAR(50)
  AS
  INSERT INTO NHANVIEN(TENNV,SDT,DIACHI) VALUES (@TEN, @SDT, @DC)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_SP]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[SP_INSERT_SP] @MADT CHAR(5), @TENSP NVARCHAR(40), @SLTON INT, @DONGIA MONEY
  AS
  INSERT INTO SANPHAM(MADT,TENSP, SLTON, DONGIA) VALUES (@MADT, @TENSP, @SLTON, @DONGIA)
  GO
  /****** Object:  StoredProcedure [dbo].[SP_INSERT_TX]    Script Date: 04/12/2021 3:25:34 CH ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  CREATE PROCEDURE [dbo].[SP_INSERT_TX] @MAKV CHAR(5), @HOTEN NVARCHAR(40), @CMND CHAR(10), 
  							  @SDT CHAR(10), @DC NVARCHAR(40), @BSX NVARCHAR(10),
  							  @TKNH NVARCHAR(10), @EMAIL CHAR(40), @TTDP NVARCHAR(30), @THUNHAP MONEY
  AS
  INSERT INTO TAIXE(MAKV,HOTEN,CMND,SĐT,DIACHI,BIENSOXE,TKNGANHANG,EMAIL,TTDONGPHITHECHAN,THUNHAP)
  VALUES (@MAKV,@HOTEN,@CMND,@SDT,@DC, @BSX, @TKNH, @EMAIL,@TTDP,@THUNHAP)
  GO
  
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  CREATE PROCEDURE CAPNHAT_TTHD @MAHD CHAR(5), @TTHD NVARCHAR(40)
  AS
  UPDATE HOPDONG
  SET TINHTRANGHD = @TTHD
  WHERE MAHD = @MAHD
  