Documente Academic
Documente Profesional
Documente Cultură
Trabajo Academico
CURSO:
DOCENTE:
DUED: IQUITOS
Taller de Procesamiento de Datos
ÍNDICE
1.2.1 Proposito
1.2.2 Alcance
5. Bibliografia
FlujoNormal:
1.2.1 Propósito
1.2.2 Alcance
USE [BD_Ferreteria]
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [BD_Ferreteria].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [BD_Ferreteria] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [BD_Ferreteria] SET ANSI_NULLS OFF
GO
ALTER DATABASE [BD_Ferreteria] SET ANSI_PADDING OFF
GO
ALTER DATABASE [BD_Ferreteria] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [BD_Ferreteria] SET ARITHABORT OFF
GO
ALTER DATABASE [BD_Ferreteria] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [BD_Ferreteria] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [BD_Ferreteria] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [BD_Ferreteria] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [BD_Ferreteria] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [BD_Ferreteria] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [BD_Ferreteria] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [BD_Ferreteria] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [BD_Ferreteria] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [BD_Ferreteria] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [BD_Ferreteria] SET DISABLE_BROKER
GO
ALTER DATABASE [BD_Ferreteria] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [BD_Ferreteria] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [BD_Ferreteria] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [BD_Ferreteria] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [BD_Ferreteria] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [BD_Ferreteria] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [BD_Ferreteria] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [BD_Ferreteria] SET READ_WRITE
GO
ALTER DATABASE [BD_Ferreteria] SET RECOVERY FULL
GO
ALTER DATABASE [BD_Ferreteria] SET MULTI_USER
GO
ALTER DATABASE [BD_Ferreteria] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [BD_Ferreteria] SET DB_CHAINING OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'BD_Ferreteria', N'ON'
GO
USE [BD_Ferreteria]
GO
/****** Object: Table [dbo].[ventas] Script Date: 06/30/2012 16:41:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ventas](
[ventas_id] [int] IDENTITY(1,1) NOT NULL,
[agenda_id] [int] NOT NULL,
[documento_id] [int] NOT NULL,
[documento_serie] [int] NOT NULL,
[documento_numero] [int] NOT NULL,
[alma_id] [int] NOT NULL,
[fecha] [datetime] NOT NULL,
[moneda] [char](3) NOT NULL,
[tc] [decimal](18, 3) NOT NULL,
[flag_igv] [bit] NOT NULL,
[importe_igv] [decimal](18, 2) NOT NULL,
[importe_descuento] [decimal](18, 2) NOT NULL,
[importe_total] [decimal](18, 2) NOT NULL,
[condicion_pago] [char](8) NOT NULL,
[usuario_id] [int] NOT NULL,
CONSTRAINT [PK_ventas_] PRIMARY KEY CLUSTERED
(
[ventas_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: StoredProcedure [dbo].[sp_Ventas_Upd] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Ventas_Upd]
@ventas_id As Int,
@agenda_id int,
@documento_id int,
@documento_serie int,
@documento_numero int,
@alma_id int,
@fecha date,
@moneda char(3),
@tc decimal(18,3),
@flag_igv bit,
@importe_igv decimal(18,2),
@importe_descuento decimal(18,2),
@importe_total decimal(18,2),
@condicion_pago char(8),
@usuario_id int
As
UPDATE ventas SET
agenda_id=@agenda_id,documento_id=@documento_id,documento_serie=@documento_serie,
documento_numero=@documento_numero,alma_id=@alma_id,fecha=@fecha,moneda=@moneda,tc=@tc,
flag_igv=@flag_igv,importe_igv=@importe_igv,importe_descuento=@importe_descuento,
importe_total=@importe_total,condicion_pago=@condicion_pago,usuario_id=@usuario_id
Where ventas_id = @ventas_id
GO
/****** Object: StoredProcedure [dbo].[sp_ventas_Ins] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_ventas_Ins]
@agenda_id int,
@documento_id int,
@documento_serie int,
@documento_numero int,
@alma_id int,
@fecha date,
@moneda char(3),
@tc decimal(18,3),
@flag_igv bit,
@importe_igv decimal(18,2),
@importe_descuento decimal(18,2),
@importe_total decimal(18,2),
@condicion_pago char(8),
@usuario_id int
As
INSERT INTO ventas VALUES
(@agenda_id,@documento_id,@documento_serie,@documento_numero,@alma_id,@fecha,@moneda,@tc,
@flag_igv,@importe_igv,@importe_descuento,@importe_total,@condicion_pago,@usuario_id)
GO
/****** Object: StoredProcedure [dbo].[sp_ventas_Del] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_ventas_Del]
@ventas_id As Int
As
DELETE FROM ventas Where ventas_id = @ventas_id
GO
/****** Object: Table [dbo].[unidad] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[unidad](
[unidad_id] [int] IDENTITY(1,1) NOT NULL,
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[productos] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[productos](
[producto_id] [int] IDENTITY(1,1) NOT NULL,
[producto_nombre] [varchar](100) NOT NULL,
[precio_costo] [decimal](18, 2) NOT NULL,
[precio_venta] [decimal](18, 2) NOT NULL,
[unidad_id] [int] NOT NULL,
[stock] [decimal](18, 2) NOT NULL,
[ubicacion] [char](10) NOT NULL,
[moneda] [char](3) NOT NULL,
[categoria_id] [int] NOT NULL,
[producto_nota] [text] NOT NULL,
CONSTRAINT [PK_productos_] PRIMARY KEY CLUSTERED
(
[producto_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: StoredProcedure [dbo].[sp_VentasDetalle_Ins] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_VentasDetalle_Ins]
@ventas_id int,
@producto_id int,
@cantidad decimal(18,2),
@precio_unitario decimal(18,2),
@descuento decimal(18, 2),
@igv decimal(18, 2),
@total decimal(18, 2),
@unidad_id int
As
INSERT INTO ventas_detalle VALUES
(@ventas_id,@producto_id,@cantidad,@precio_unitario,@descuento,@igv,@total,@unidad_id)
UPDATE productos SET stock = stock - @cantidad WHERE producto_id=@producto_id
GO
/****** Object: StoredProcedure [dbo].[sp_rpt_productos] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_rpt_productos]
As
Select t1.producto_id,t1.producto_nombre,t2.unidad_nombre,t1.moneda,t1.precio_venta,t1.stock
From productos t1
Inner Join unidad t2 on t1.unidad_id = t2.unidad_id
GO
/****** Object: StoredProcedure [dbo].[sp_Productos_Upd] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Productos_Upd]
@producto_id As Int,
@producto_nombre varchar(100),
@precio_costo decimal(18, 2),
@precio_venta decimal(18, 2),
@unidad_id int ,
@ubicacion char(10),
@moneda char(3) ,
@categoria_id int ,
@producto_nota text
As
UPDATE Productos SET
producto_nombre=@producto_nombre,precio_costo=@precio_costo,precio_venta=@precio_venta,
unidad_id=@unidad_id,ubicacion=@ubicacion,moneda=@moneda,categoria_id=@categoria_id,
producto_nota=@producto_nota
Where producto_id = @producto_id
GO
/****** Object: StoredProcedure [dbo].[sp_Productos_Ins] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Productos_Ins]
@producto_nombre varchar(100),
@precio_costo decimal(18, 2),
@precio_venta decimal(18, 2),
@unidad_id int ,
@stock decimal(18, 2),
@ubicacion char(10),
@moneda char(3) ,
@categoria_id int ,
@producto_nota text
As
INSERT INTO Productos VALUES (@producto_nombre,@precio_costo,@precio_venta,@unidad_id,@stock,
@ubicacion,@moneda,@categoria_id,@producto_nota)
GO
/****** Object: StoredProcedure [dbo].[sp_Productos_Del] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- @stock decimal(18, 2),
agenda_telefono=@agenda_telefono,tipo_cliente=@tipo_cliente,tipo_proveedor=@tipo_proveedor,
agenda_nota=@agenda_nota
Where agenda_id = @agenda_id
GO
/****** Object: StoredProcedure [dbo].[sp_Agenda_Ins] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Agenda_Ins]
@agenda_nombre as varchar(100),
@agenda_ruc as char(11),
@agenda_direccion as varchar(100),
@agenda_telefono as varchar(50),
@tipo_cliente as bit,
@tipo_proveedor as bit,
@agenda_nota text
As
INSERT INTO Agenda VALUES (@agenda_nombre,@agenda_ruc,@agenda_direccion,@agenda_telefono,
@tipo_cliente,@tipo_proveedor,@agenda_nota)
GO
/****** Object: StoredProcedure [dbo].[sp_Agenda_Del] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Agenda_Del]
@agenda_id As Int
As
DELETE FROM Agenda Where agenda_id = @agenda_id
GO
/****** Object: Table [dbo].[guia_detalle] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[guia_detalle](
[guia_id] [int] NOT NULL,
[producto_id] [int] NOT NULL,
[cantidad] [decimal](18, 2) NOT NULL,
[precio_unitario] [decimal](18, 2) NOT NULL,
[descuento] [decimal](18, 2) NOT NULL,
[igv] [decimal](18, 2) NOT NULL,
[total] [decimal](18, 2) NOT NULL,
[unidad_id] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[documento] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[documento](
[documento_id] [int] IDENTITY(1,1) NOT NULL,
[documento_nombre] [varchar](50) NOT NULL,
[documento_nota] [text] NOT NULL,
CONSTRAINT [XPKdocumento] PRIMARY KEY CLUSTERED
(
[documento_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: StoredProcedure [dbo].[sp_rpt_facturacion] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_rpt_facturacion]
@ventas_id int
as
Select t1.ventas_id,t2.agenda_ruc,t2.agenda_nombre,t2.agenda_direccion,
t3.documento_nombre,t1.documento_serie,t1.documento_numero,t1.fecha,
t4.producto_id,t5.producto_nombre,t6.unidad_nombre,t4.cantidad,
t4.precio_unitario,t4.total
From ventas t1
Inner Join agenda t2 on t1.agenda_id = t2.agenda_id
Inner Join documento t3 on t1.documento_id = t3.documento_id
Inner Join ventas_detalle t4 on t1.ventas_id = t4.ventas_id
Inner Join productos t5 on t4.producto_id = t5.producto_id
Inner Join unidad t6 on t4.unidad_id = t6.unidad_id
Where t1.ventas_id = @ventas_id
GO
/****** Object: StoredProcedure [dbo].[sp_Documento_Upd] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Documento_Upd]
@documento_id As Int,
@documento_nombre as varchar(50),
@documento_nota as Text
As
UPDATE Documento SET documento_nombre = @documento_nombre, documento_nota =
@documento_nota
Where documento_id = @documento_id
GO
/****** Object: StoredProcedure [dbo].[sp_Documento_Ins] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Documento_Ins]
@documento_nombre as varchar(50),
@documento_nota as text
As
INSERT INTO Documento VALUES (@documento_nombre,@documento_nota)
GO
/****** Object: StoredProcedure [dbo].[sp_Documento_Del] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Documento_Del]
@documento_id As Int
As
DELETE FROM Documento Where documento_id = @documento_id
GO
/****** Object: Table [dbo].[compras_detalle] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[compras_detalle](
[compras_id] [int] NOT NULL,
[producto_id] [int] NOT NULL,
[cantidad] [decimal](18, 2) NOT NULL,
[precio_unitario] [decimal](18, 2) NOT NULL,
[descuento] [decimal](18, 2) NOT NULL,
[igv] [decimal](18, 2) NOT NULL,
[total] [decimal](18, 2) NOT NULL,
[unidad_id] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object: StoredProcedure [dbo].[sp_ComprasDetalle_Ins] Script Date: 06/30/2012 16:41:16
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_ComprasDetalle_Ins]
@compras_id int,
@producto_id int,
@cantidad decimal(18,2),
@precio_unitario decimal(18,2),
@descuento decimal(18, 2),
@igv decimal(18, 2),
@total decimal(18, 2),
@unidad_id int
As
INSERT INTO Compras_detalle VALUES
(@compras_id,@producto_id,@cantidad,@precio_unitario,@descuento,@igv,@total,@unidad_id)
UPDATE productos SET stock = stock + @cantidad WHERE producto_id=@producto_id
GO
/****** Object: Table [dbo].[compras] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[compras](
[compras_id] [int] IDENTITY(1,1) NOT NULL,
[agenda_id] [int] NOT NULL,
[documento_id] [int] NOT NULL,
[documento_serie] [int] NOT NULL,
[documento_numero] [int] NOT NULL,
[alma_id] [int] NOT NULL,
[fecha] [datetime] NOT NULL,
[moneda] [char](3) NOT NULL,
[tc] [decimal](18, 3) NOT NULL,
[flag_igv] [bit] NOT NULL,
[importe_igv] [decimal](18, 2) NOT NULL,
[importe_descuento] [decimal](18, 2) NOT NULL,
[importe_total] [decimal](18, 2) NOT NULL,
[condicion_pago] [char](8) NOT NULL,
[usuario_id] [int] NOT NULL,
CONSTRAINT [PK_compras] PRIMARY KEY CLUSTERED
(
[compras_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: StoredProcedure [dbo].[sp_Compras_Upd] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Compras_Upd]
@compras_id As Int,
@agenda_id int,
@documento_id int,
@documento_serie int,
@documento_numero int,
@alma_id int,
@fecha date,
@moneda char(3),
@tc decimal(18,3),
@flag_igv bit,
@importe_igv decimal(18,2),
@importe_descuento decimal(18,2),
@importe_total decimal(18,2),
@condicion_pago char(8),
@usuario_id int
As
UPDATE Compras SET
agenda_id=@agenda_id,documento_id=@documento_id,documento_serie=@documento_serie,
documento_numero=@documento_numero,alma_id=@alma_id,fecha=@fecha,moneda=@moneda,tc=@tc,
flag_igv=@flag_igv,importe_igv=@importe_igv,importe_descuento=@importe_descuento,
importe_total=@importe_total,condicion_pago=@condicion_pago,usuario_id=@usuario_id
Where compras_id = @compras_id
GO
/****** Object: StoredProcedure [dbo].[sp_Compras_Ins] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Compras_Ins]
@agenda_id int,
@documento_id int,
@documento_serie int,
@documento_numero int,
@alma_id int,
@fecha date,
@moneda char(3),
@tc decimal(18,3),
@flag_igv bit,
@importe_igv decimal(18,2),
@importe_descuento decimal(18,2),
@importe_total decimal(18,2),
@condicion_pago char(8),
@usuario_id int
As
INSERT INTO Compras VALUES
(@agenda_id,@documento_id,@documento_serie,@documento_numero,@alma_id,@fecha,@moneda,@tc,
@flag_igv,@importe_igv,@importe_descuento,@importe_total,@condicion_pago,@usuario_id)
GO
/****** Object: StoredProcedure [dbo].[sp_Compras_Del] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Compras_Del]
@compras_id As Int
As
DELETE FROM Compras Where compras_id = @compras_id
GO
/****** Object: Table [dbo].[categoria] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[categoria](
[categoria_id] [int] IDENTITY(1,1) NOT NULL,
[categoria_nombre] [varchar](100) NOT NULL,
[categoria_nota] [text] NOT NULL,
CONSTRAINT [XPKcategoria] PRIMARY KEY CLUSTERED
(
[categoria_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: StoredProcedure [dbo].[sp_Categoria_Upd] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Categoria_Upd]
@categoria_id As Int,
@categoria_nombre as varchar(100),
@categoria_nota as text
As
UPDATE categoria SET categoria_nombre = @categoria_nombre, categoria_nota = @categoria_nota
Where categoria_id = @categoria_id
GO
/****** Object: StoredProcedure [dbo].[sp_Categoria_Ins] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Categoria_Ins]
@categoria_nombre as varchar(100),
@categoria_nota as text
As
INSERT INTO categoria VALUES (@categoria_nombre,@categoria_nota)
GO
/****** Object: StoredProcedure [dbo].[sp_Categoria_Del] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Categoria_Del]
@categoria_id As Int
As
DELETE FROM categoria Where categoria_id = @categoria_id
GO
/****** Object: Table [dbo].[caja_operaciones] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[caja_operaciones](
[caja_operacion_id] [int] IDENTITY(1,1) NOT NULL,
[caja_operacion_nombre] [varchar](50) NOT NULL,
[caja_operacion_nota] [text] NOT NULL,
CONSTRAINT [PK_caja_tipo_operaciones] PRIMARY KEY CLUSTERED
(
[caja_operacion_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[almacen] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[almacen](
[alma_id] [int] IDENTITY(1,1) NOT NULL,
[alma_nombre] [varchar](50) NOT NULL,
[alma_nota] [text] NOT NULL,
CONSTRAINT [PK_almacen] PRIMARY KEY CLUSTERED
(
[alma_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
@alma_id As Int,
@alma_nombre as varchar(50),
@alma_nota as Text
As
UPDATE Almacen SET alma_nombre = @alma_nombre, alma_nota = @alma_nota
Where alma_id = @alma_id
GO
/****** Object: StoredProcedure [dbo].[sp_Almacen_Ins] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Almacen_Ins]
@alma_nombre as varchar(50),
@alma_nota as text
As
INSERT INTO Almacen (alma_nombre,alma_nota) VALUES (@alma_nombre,@alma_nota)
GO
/****** Object: StoredProcedure [dbo].[sp_Almacen_Del] Script Date: 06/30/2012 16:41:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_Almacen_Del]
@alma_id As Int
As
DELETE FROM Almacen Where alma_id = @alma_id
GO
/****** Object: StoredProcedure [dbo].[sp_operacionescaja_Upd] Script Date: 06/30/2012 16:41:16
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_operacionescaja_Upd]
@caja_operacion_id As Int,
@caja_operacion_nombre as varchar(50),
@caja_operacion_nota as Text
As
UPDATE caja_operaciones SET caja_operacion_nombre = @caja_operacion_nombre, caja_operacion_nota =
@caja_operacion_nota
Where caja_operacion_id = @caja_operacion_id
GO
/****** Object: StoredProcedure [dbo].[sp_operacionescaja_Ins] Script Date: 06/30/2012 16:41:16
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
----------
GO
/****** Object: Default [DF_ventas__tc] Script Date: 06/30/2012 16:41:13 ******/
ALTER TABLE [dbo].[ventas] ADD CONSTRAINT [DF_ventas__tc] DEFAULT ((0)) FOR [tc]
GO
/****** Object: Default [DF_ventas__importe_igv] Script Date: 06/30/2012 16:41:13 ******/
ALTER TABLE [dbo].[ventas] ADD CONSTRAINT [DF_ventas__importe_igv] DEFAULT ((0)) FOR [importe_igv]
GO
/****** Object: Default [DF_ventas__importe_descuento] Script Date: 06/30/2012 16:41:13 ******/
ALTER TABLE [dbo].[ventas] ADD CONSTRAINT [DF_ventas__importe_descuento] DEFAULT ((0)) FOR
[importe_descuento]
GO
/****** Object: Default [DF_ventas__importe_total] Script Date: 06/30/2012 16:41:13 ******/
ALTER TABLE [dbo].[ventas] ADD CONSTRAINT [DF_ventas__importe_total] DEFAULT ((0)) FOR
[importe_total]
GO
/****** Object: Default [DF_ventas__condicion_pago] Script Date: 06/30/2012 16:41:13 ******/
ALTER TABLE [dbo].[ventas] ADD CONSTRAINT [DF_ventas__condicion_pago] DEFAULT ('') FOR
[condicion_pago]
GO
/****** Object: Default [DF_ventas_usuario_id] Script Date: 06/30/2012 16:41:13 ******/
ALTER TABLE [dbo].[ventas] ADD CONSTRAINT [DF_ventas_usuario_id] DEFAULT ((0)) FOR [usuario_id]
GO
/****** Object: Default [DF_unidad_codigo_sunat] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[unidad] ADD CONSTRAINT [DF_unidad_codigo_sunat] DEFAULT ('') FOR [codigo_sunat]
GO
/****** Object: Default [DF_unidad_unidad_nombre] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[unidad] ADD CONSTRAINT [DF_unidad_unidad_nombre] DEFAULT ('') FOR
[unidad_nombre]
GO
/****** Object: Default [DF_unidad_unidad_nombre1] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[unidad] ADD CONSTRAINT [DF_unidad_unidad_nombre1] DEFAULT ('') FOR
[unidad_nota]
GO
/****** Object: Default [DF_ventas_detalle__producto_id] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[ventas_detalle] ADD CONSTRAINT [DF_ventas_detalle__producto_id] DEFAULT ((0)) FOR
[producto_id]
GO
/****** Object: Default [DF_ventas_detalle__cantidad] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[ventas_detalle] ADD CONSTRAINT [DF_ventas_detalle__cantidad] DEFAULT ((0)) FOR
[cantidad]
GO
/****** Object: Default [DF_ventas_detalle__precio_unitario] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[ventas_detalle] ADD CONSTRAINT [DF_ventas_detalle__precio_unitario] DEFAULT ((0))
FOR [precio_unitario]
GO
/****** Object: Default [DF_ventas_detalle__descuento] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[ventas_detalle] ADD CONSTRAINT [DF_ventas_detalle__descuento] DEFAULT ((0)) FOR
[descuento]
GO
/****** Object: Default [DF_ventas_detalle__igv] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[ventas_detalle] ADD CONSTRAINT [DF_ventas_detalle__igv] DEFAULT ((0)) FOR [igv]
GO
/****** Object: Default [DF_ventas_detalle__total] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[ventas_detalle] ADD CONSTRAINT [DF_ventas_detalle__total] DEFAULT ((0)) FOR [total]
GO
/****** Object: Default [DF_ventas_detalle__unidad_id] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[ventas_detalle] ADD CONSTRAINT [DF_ventas_detalle__unidad_id] DEFAULT ((0)) FOR
[unidad_id]
GO
/****** Object: Default [DF_productos__producto_nombre] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[productos] ADD CONSTRAINT [DF_productos__producto_nombre] DEFAULT ('') FOR
[producto_nombre]
GO
ALTER TABLE [dbo].[caja] WITH CHECK ADD CONSTRAINT [FK_caja_usuarios] FOREIGN KEY([usuario_id])
REFERENCES [dbo].[usuarios] ([usuario_id])
GO
ALTER TABLE [dbo].[caja] CHECK CONSTRAINT [FK_caja_usuarios]
GO
/****** Object: ForeignKey [FK_caja_ventas] Script Date: 06/30/2012 16:41:16 ******/
ALTER TABLE [dbo].[caja] WITH CHECK ADD CONSTRAINT [FK_caja_ventas] FOREIGN KEY([ventas_id])
REFERENCES [dbo].[ventas] ([ventas_id])
GO
ALTER TABLE [dbo].[caja] CHECK CONSTRAINT [FK_caja_ventas]
GO
Usuario: sa
Clave: 123
Imports System.Data.SqlClient
Imports System.Collections
Public Class conexionSQL
Public cadenaConexion As String = "Data Source=laptop\sqlexpress;Initial
Catalog=BD_Ferreteria;User Id=sa;password=123"
CONTRASEÑA: 123
En caso se ingrese el usuario y/o la clave incorrecta, el usuario no podra ingresar al sistema.
Como consecuencia de ello se mostrarà la siguiente ventana.
Al ingresar, tenemos la siguiente pantalla grafica, opcion Salir (sale del sistema).
Catalogo de productos
Podemos realizar nuevos ingresos, seleccionar el item deseado editarlo y/o eliminarlo.
Registramos los
articulos y
almacenamos en la
tabla productos.
Categoria de productos.-
Unidades de medida.-
Proveedores y Clientes.-
Tipo de Documentos.-
Operaciones de Caja.-
Almacenes.-
Menu Procesos
Menu Procesos, sub menu Compras (nos permite realizar el proceso de ingreso de productos
al almacen), Procesos, sub menu Ventas (nos permite realizar el proceso de salida de
productos), salida de materiales.
Menu Reportes (nos permite realizar reportes de compras, ventas, stock de almacen, y
arqueos de caja (aún no implementado). Solo se encuentra disponible la opcion
Almacen\Listado de Productos.
5 Bibliografía
2. http://www3.uji.es/~mmarques/f47/apun/node1.html
3. http://msdn.microsoft.com/es-pe/vbasic/ms789075.aspx.