Está en la página 1de 106

Informe de Prácticas Profesionales

Dávila Napa, César Gustavo Pág.: 40


Informe de Prácticas Profesionales

Dávila Napa, César Gustavo Pág.: 41


Informe de Prácticas Profesionales

Dávila Napa, César Gustavo Pág.: 42


Informe de Prácticas Profesionales

Dávila Napa, César Gustavo Pág.: 43


Informe de Prácticas Profesionales

PROGRAMACION

Dávila Napa, César Gustavo Pág.: 44


Informe de Prácticas Profesionales
PROCEDIMIENTO ALMACENADO DEL PROVEEDOR - SET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.SETPROVEEDORES(


pcodproveedor PROVEEDORES.codproveedor%type, --
pnombreproveedor PROVEEDORES.nombreproveedor%type, --
pdireccion PROVEEDORES.direccion%type, --
pruc PROVEEDORES.ruc%type, --
ptelefono PROVEEDORES.telefono%type, --
pobservacion PROVEEDORES.observacion%type, --
pcodtipoproveedor PROVEEDORES.codtipoproveedor%type, --
pfoto PROVEEDORES.foto%type, --
pusuario varchar2,
pestacion varchar2 -
)
IS
vcodproveedor char(5) := substr(pcodproveedor,1,5);
vnombreproveedor varchar2(45) := substr(pnombreproveedor,1,45);
vdireccion varchar2(40) := substr(pdireccion,1,40);
vruc char(11) := substr(pruc,1,11);
vtelefono char(10) := substr(ptelefono,1,10);
vobservacion varchar2(30) := substr(pobservacion,1,30);
vcodtipoproveedor char(3) := substr(pcodtipoproveedor,1,3);
vfoto nvarchar2(300):= substr(pfoto,1,300);
vusuario varchar2(15) := substr(pusuario,1,15);
vestacion varchar2(15) := substr(pestacion,1,15);
begin
IF TRIM(vNOMBREPROVEEDOR) IS NULL THEN
raise_application_error(-20000,'Ingrese Nombre Proveedor');
END IF;
IF TRIM(vDIRECCION) IS NULL THEN
raise_application_error(-20000,'Ingrese Direccion');
END IF;
IF TRIM(vRUC) IS NULL THEN
raise_application_error(-20000,'Ingrese Ruc');
END IF;
IF TRIM(vcodtipoproveedor) IS NULL THEN
raise_application_error(-20000,'Ingrese Tipo Proveedor');
END IF;
IF TRIM(vCODPROVEEDOR)IS NULL THEN
SELECT SUBSTR ('00000'||(NVL (MAX(CODPROVEEDOR),0) + 1),-5)
INTO vCODPROVEEDOR
FROM PROVEEDORES;
END IF;
merge into PROVEEDORES destino
using ( select
vcodproveedor codproveedor,
vnombreproveedor nombreproveedor,
vdireccion direccion,
vruc ruc,
vtelefono telefono,
vobservacion observacion,
vcodtipoproveedor codtipoproveedor,
vfoto foto,
vusuario usuario,
vestacion estacion,
sysdate fecha,
'0' flgeli
from dual) origen
on (destino.codproveedor = origen.codproveedor
)
when matched then
update set

Dávila Napa, César Gustavo Pág.: 45


Informe de Prácticas Profesionales
nombreproveedor = origen.nombreproveedor,
direccion = origen.direccion,
ruc = origen.ruc,
telefono = origen.telefono,
observacion = origen.observacion,
usuario_modificacion = vusuario,
fecha_modificacion = sysdate,
codtipoproveedor = origen.codtipoproveedor,
foto = origen.foto
when not matched then
insert (codproveedor,
nombreproveedor,
direccion,
ruc,
telefono,
observacion,
ususario_creacion,
fecha_creacion,
usuario_modificacion,
fecha_modificacion,
codtipoproveedor,
foto )
values (origen.codproveedor,
origen.nombreproveedor,
origen.direccion,
origen.ruc,
origen.telefono,
origen.observacion,
vusuario,sysdate,
vusuario,sysdate,
origen.codtipoproveedor,
origen.foto );
exception
when no_data_found then
null;
when others then
raise;
end SETPROVEEDORES;
/

PROCEDIMIENTO ALMACENADO BUSCAR PROVEEDOR - GET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.GETPROVEEDORES(


pcodproveedor PROVEEDORES.codproveedor%type, --
pnombreproveedor PROVEEDORES.NOMBREPROVEEDOR%type,
pruc PROVEEDORES.ruc%type, --
pcursor out sys_refcursor)
IS
vcodproveedor char(5) := substr(pcodproveedor,1,5);
vnombreproveedor varchar(45) := substr(pnombreproveedor,1,45);
vruc char(11) := substr(pruc,1,11);
begin
open pcursor for
select
t1.codproveedor,
t1.nombreproveedor,
t1.direccion,
t1.ruc,
t1.telefono,
t1.observacion,
t2.NOMBRETIPOPROVEEDOR

Dávila Napa, César Gustavo Pág.: 46


Informe de Prácticas Profesionales
from PROVEEDORES t1
INNER JOIN TIPO_PROVEEDOR t2
on t1.CODTIPOPROVEEDOR = t2.CODTIPOPROVEEDOR
where t1.codproveedor = nvl(vcodproveedor ,t1.codproveedor)
AND NOMBREPROVEEDOR LIKE '%'|| vnombreproveedor ||'%'
AND ruc = nvl(vruc ,t1.ruc)
AND t1.ESTADO ='0';
exception
when no_data_found then
null;
when others then
raise;
end GETPROVEEDORES;

PROCEDIMIENTO ALMACENADO ELIMINAR PROVEEDOR

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.DELPROVEEDORES(


pcodproveedor PROVEEDORES.codproveedor%type,
pusuario varchar2 default null,
pestacion varchar2 default null
)
IS
vcodproveedor char(5) := substr(pcodproveedor,1,5);
vusuario varchar2(15) := substr(pusuario,1,15);
vestacion varchar2(15) := substr(pestacion,1,15);
begin
dbms_output.enable;

if trim(vcodproveedor) is null then


raise_application_error (-20000,’Codigo incorrecto');
else if trim(vusuario) is null then
raise_application_error (-20000,'Usuario incorrecto');
else if trim(vestacion) is null then
raise_application_error (-20000,'Estacion incorrecta');
end if;
begin
update PROVEEDORES set
proveedores.ESTADO = '1',
proveedores.USUARIO_MODIFICACION = vusuario,
proveedores.FECHA_MODIFICACION = sysdate

where codproveedor = vcodproveedor;


exception
when others then
raise_application_error(-20000,'No es posible eliminar el registro');
end;
exception
when no_data_found then
null;
when others then
raise;
end DELPROVEEDORES;

PROCEDIMIENTO ALMACENADO PRODUCTO - SET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.SETPRODUCTO(


pcodproducto PRODUCTO.codproducto%type, --
pnombreprooducto PRODUCTO.nombreprooducto%type, --
punidad PRODUCTO.unidad%type, --
pobservacion PRODUCTO.observacion%type, --

Dávila Napa, César Gustavo Pág.: 47


Informe de Prácticas Profesionales
pcodcategoria PRODUCTO.codcategoria%type, --
pusuario varchar2,
pestacion varchar2
)
IS
vcodproducto char(5) := substr(pcodproducto,1,5);
vnombreprooducto varchar2(45) := substr(pnombreprooducto,1,45);
vunidad varchar2(25) := substr(punidad,1,25);
vobservacion nvarchar2(100) := substr(pobservacion,1,100);
vcodcategoria char(3) := substr(pcodcategoria,1,3);
vusuario varchar2(15) := substr(pusuario,1,15);
vestacion varchar2(15) := substr(pestacion,1,15);
begin
IF TRIM(vnombreprooducto) IS NULL THEN
raise_application_error(-20000,'Ingrese Producto');
END IF;
IF TRIM(vunidad) IS NULL THEN
raise_application_error(-20000,'Ingrese Unidad');
END IF;
IF TRIM(vcodcategoria) IS NULL THEN
raise_application_error(-20000,'Ingrese Tipo Categoria');
END IF;
IF TRIM(vcodproducto)IS NULL THEN
SELECT SUBSTR ('00000'||(NVL (MAX(codproducto),0) + 1),-5)
INTO vcodproducto
FROM PRODUCTO;
END IF;
merge into PRODUCTO destino
using ( select
vcodproducto codproducto,
vnombreprooducto nombreprooducto,
vunidad unidad,
vobservacion observacion,
vcodcategoria codcategoria,
vusuario usuario,
vestacion estacion,
sysdate fecha,
'0' flgeli
from dual) origen
on (destino.codproducto = origen.codproducto
)
when matched then
update set
nombreprooducto = origen.nombreprooducto,
unidad = origen.unidad,
observacion = origen.observacion,
codcategoria = origen.codcategoria,
usuario_modificacion = vusuario,
fecha_modificacion = sysdate
when not matched then
insert (codproducto,
nombreprooducto,
unidad,
observacion,
codcategoria,
usuario_creacion,
fecha_creacion,
usuario_modificacion,
fecha_modificacion )
values (origen.codproducto,
origen.nombreprooducto,
origen.unidad,

Dávila Napa, César Gustavo Pág.: 48


Informe de Prácticas Profesionales
origen.observacion,
origen.codcategoria,
vusuario, sysdate,
vusuario, sysdate );
exception
when no_data_found then
null;
when others then
raise;
end SETPRODUCTO;

PROCEDIMIENTO ALMACENADO BUSCAR PRODUCTO - GET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.GETPRODUCTO(


pcodproducto PRODUCTO.codproducto%type, --
pnombreprooducto PRODUCTO.nombreprooducto%type, --
pcursor out sys_refcursor)
IS
vcodproducto char(5) := substr(pcodproducto,1,5);
vnombreprooducto varchar2(45) := substr(pnombreprooducto,1,45);
begin
open pcursor for
select
t1.codproducto,
t1.nombreprooducto,
t1.unidad,
t1.observacion,
c.NOMBRECATEGORIA
from PRODUCTO t1
inner join categoria c
on t1.CODCATEGORIA = c.CODCATEGORIA
where t1.codproducto = nvl(vcodproducto ,t1.codproducto)
AND nombreprooducto LIKE '%'|| vnombreprooducto ||'%'
AND t1.ESTADO ='0';
exception
when no_data_found then
null;
when others then
raise;
end GETPRODUCTO;

PROCEDIMIENTO ALMACENADO ELIMINAR PRODUCTO

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.DELPRODUCTO(


pcodproducto PRODUCTO.codproducto%type, --
pusuario varchar2 default null,
pestacion varchar2 default null
)
IS
vcodproducto char(5) := substr(pcodproducto,1,5);
vusuario varchar2(15) := substr(pusuario,1,15);
vestacion varchar2(15) := substr(pestacion,1,15);
begin
dbms_output.enable;
if trim(vcodproducto) is null then
raise_application_error (-20000,' incorrecto');
end if;
begin
update PRODUCTO set producto.ESTADO ='1'

where codproducto = vcodproducto;

Dávila Napa, César Gustavo Pág.: 49


Informe de Prácticas Profesionales
exception
when others then
raise_application_error(-20000,'No es posible eliminar el registro');
end;
exception
when no_data_found then
null;
when others then
raise;
end DELPRODUCTO;

PROCEDIMIENTO ALMACENADO DOCUMENTO - SET

CREATE OR REPLACE PROCEDURE


SYSTEMCOMPRASGENERAL.SETTIPODOCUMENTO(
pcoddocumento TIPODOCUMENTO.coddocumento%type, --
ptipodocumento TIPODOCUMENTO.tipodocumento%type --
)
IS
vcoddocumento char(3) := substr(pcoddocumento,1,3);
vtipodocumento varchar2(35):= substr(ptipodocumento,1,35);
begin
IF TRIM(ptipodocumento) IS NULL THEN
raise_application_error(-20000,'Ingrese Documento');
END IF;
IF TRIM(pcoddocumento)IS NULL THEN
SELECT SUBSTR ('000'||(NVL (MAX(coddocumento),0) + 1),-3)
INTO vcoddocumento
FROM TIPODOCUMENTO;
END IF;
merge into TIPODOCUMENTO destino
using ( select
vcoddocumento coddocumento,
vtipodocumento tipodocumento
from dual) origen
on (destino.coddocumento = origen.coddocumento
)
when matched then
update set
tipodocumento = origen.tipodocumento
when not matched then
insert (coddocumento, tipodocumento)
values (origen.coddocumento, origen.tipodocumento);
exception
when no_data_found then
null;
when others then
raise;
end SETTIPODOCUMENTO;
/

PROCEDIMIENTO ALMACENADO BUSCAR DOCUMENTO - GET

CREATE OR REPLACE PROCEDURE


SYSTEMCOMPRASGENERAL.GETTIPODOCUMENTO(
pcoddocumento TIPODOCUMENTO.coddocumento%type, --
ptipodocumento TIPODOCUMENTO.tipodocumento%type, --
pcursor out sys_refcursor)
IS
vcoddocumento char(3) := substr(pcoddocumento,1,3);

Dávila Napa, César Gustavo Pág.: 50


Informe de Prácticas Profesionales
vtipodocumento varchar2(35) := substr(ptipodocumento,1,35);
begin
open pcursor for
select
t1.coddocumento,
t1.tipodocumento
from TIPODOCUMENTO t1
where t1.coddocumento = nvl(vcoddocumento ,t1.coddocumento)
AND tipodocumento LIKE '%'|| vtipodocumento ||'%'
AND t1.ESTADO ='0';
exception
when no_data_found then
null;
when others then
raise;
end GETTIPODOCUMENTO;

PROCEDIMIENTO ALMACENADO ELIMINAR DOCUMENTO

CREATE OR REPLACE PROCEDURE


SYSTEMCOMPRASGENERAL.DELTIPODOCUMENTO(
pcoddocumento TIPODOCUMENTO.coddocumento%type)
IS
vcoddocumento char(3) := substr(pcoddocumento,1,3);
begin
dbms_output.enable;
if trim(vcoddocumento) is null then
raise_application_error (-20000,' incorrecto');
end if;
begin
update TIPODOCUMENTO set tipodocumento.ESTADO='1'
where coddocumento = vcoddocumento;
exception
when others then
raise_application_error(-20000,'No es posible eliminar el registro');
end;
exception
when no_data_found then
null;
when others then
raise;
end DELTIPODOCUMENTO;

PROCEDIMIENTO ALMACENADO CATEGORIA – SET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.SETCATEGORIA(


pcodcategoria CATEGORIA.codcategoria%type, --
pnombrecategoria CATEGORIA.nombrecategoria%type, --
pusuario varchar2,
pestacion varchar2
)
IS
vcodcategoria char(3) := substr(pcodcategoria,1,3);
vnombrecategoria varchar2(35) := substr(pnombrecategoria,1,35);
vusuario varchar2(15) := substr(pusuario,1,15);

Dávila Napa, César Gustavo Pág.: 51


Informe de Prácticas Profesionales
vestacion varchar2(15) := substr(pestacion,1,15);
begin
IF TRIM(pnombrecategoria) IS NULL THEN
raise_application_error(-20000,'Ingrese Categoria');
END IF;
IF TRIM(pcodcategoria)IS NULL THEN
SELECT SUBSTR ('000'||(NVL (MAX(codcategoria),0) + 1),-3)
INTO vcodcategoria
FROM CATEGORIA;
END IF;
merge into CATEGORIA destino
using ( select
vcodcategoria codcategoria,
vnombrecategoria nombrecategoria,
vusuario usuario,
vestacion estacion,
sysdate fecha,
'0' flgeli
from dual) origen
on (destino.codcategoria = origen.codcategoria)
when matched then
update set
nombrecategoria = origen.nombrecategoria,
usuario_modificacion= vusuario,
fecha_modificacion = sysdate
when not matched then
insert (codcategoria,
nombrecategoria,
usuario_creacion,
fecha_creacion,
usuario_modificacion,
fecha_modificacion )
values (origen.codcategoria,
origen.nombrecategoria,
vusuario, sysdate,
vusuario, sysdate);
exception
when no_data_found then
null;
when others then
raise;
end SETCATEGORIA;
/

PROCEDIMIENTO ALMACENADO BUSCAR CATEGORIA - GET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.GETCATEGORIA(


pcodcategoria CATEGORIA.codcategoria%type, --
pnombrecategoria CATEGORIA.nombrecategoria%type, --
pcursor out sys_refcursor)
IS
vcodcategoria char(3) := substr(pcodcategoria,1,3);
vnombrecategoria varchar2(35):= substr(pnombrecategoria,1,35);

Dávila Napa, César Gustavo Pág.: 52


Informe de Prácticas Profesionales
begin
open pcursor for
select
t1.codcategoria,
t1.nombrecategoria
from CATEGORIA t1
where t1.codcategoria = nvl(vcodcategoria ,t1.codcategoria)
AND nombrecategoria LIKE '%'|| vnombrecategoria ||'%'
AND t1.ESTADO ='0';
exception
when no_data_found then
null;
when others then
raise;
end GETCATEGORIA;

PROCEDIMIENTO ALMACENADO ELIMINAR CATEGORIA

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.DELCATEGORIA(


pcodcategoria CATEGORIA.codcategoria%type, --
pusuario varchar2 default null,
pestacion varchar2 default null
)
IS
vcodcategoria char(3) := substr(pcodcategoria,1,3);
vusuario varchar2(15) := substr(pusuario,1,15);
vestacion varchar2(15) := substr(pestacion,1,15);
begin
dbms_output.enable;
if trim(vcodcategoria) is null then
raise_application_error (-20000,' incorrecto');
end if;
begin
update CATEGORIA set categoria.ESTADO = '1',
categoria.USUARIO_MODIFICACION = vusuario,
categoria.FECHA_MODIFICACION = sysdate
where codcategoria = vcodcategoria;
exception
when others then
raise_application_error(-20000,'No es posible eliminar el registro');
end;
exception
when no_data_found then
null;
when others then
raise;
end DELCATEGORIA;
/

PROCEDIMIENTO ALMACENADO MONEDA - SET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.SETMONEDA(


pcodmoneda MONEDA.codmoneda%type, --
ptipomoneda MONEDA.tipomoneda%type)
IS
vcodmoneda char(3) := substr(pcodmoneda,1,3);
vtipomoneda varchar2(35) := substr(ptipomoneda,1,35);
begin

Dávila Napa, César Gustavo Pág.: 53


Informe de Prácticas Profesionales
IF TRIM(ptipomoneda) IS NULL THEN
raise_application_error(-20000,'Ingrese Moneda');
END IF;
IF TRIM(pcodmoneda)IS NULL THEN
SELECT SUBSTR ('000'||(NVL (MAX(codmoneda),0) + 1),-3)
INTO vcodmoneda
FROM MONEDA;
END IF;
merge into MONEDA destino
using ( select
vcodmoneda codmoneda,
vtipomoneda tipomoneda
from dual) origen
on (destino.codmoneda = origen.codmoneda)
when matched then
update set
tipomoneda = origen.tipomoneda
when not matched then
insert (codmoneda, tipomoneda)
values (origen.codmoneda, origen.tipomoneda);
exception
when no_data_found then
null;
when others then
raise;
end SETMONEDA;

PROCEDIMIENTO ALMACENADO BUSCAR MONEDA GET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.GETMONEDA(


pcodmoneda MONEDA.codmoneda%type,
ptipomoneda MONEDA.tipomoneda%type, -- --
pcursor out sys_refcursor)
IS
vcodmoneda char(3) := substr(pcodmoneda,1,3);
vtipomoneda varchar2(35):= substr(ptipomoneda,1,35);
begin
open pcursor for
select
t1.codmoneda,
t1.tipomoneda
from MONEDA t1
where t1.codmoneda = nvl(vcodmoneda ,t1.codmoneda)
AND tipomoneda LIKE '%'|| vtipomoneda ||'%'
AND t1.ESTADO ='0';
exception
when no_data_found then
null;
when others then
raise;
end GETMONEDA;
/
PROCEDIMIENTO ALMACENADO ELIMINAR MONEDA

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.DELMONEDA(


pcodmoneda MONEDA.codmoneda%type)
IS
vcodmoneda char(3) := substr(pcodmoneda,1,3);
begin
dbms_output.enable;
if trim(vcodmoneda) is null then
raise_application_error (-20000,' incorrecto');

Dávila Napa, César Gustavo Pág.: 54


Informe de Prácticas Profesionales
end if;
begin
update MONEDA set moneda.ESTADO = '1'
where codmoneda = vcodmoneda ;
exception
when others then
raise_application_error(-20000,'No es posible eliminar el registro');
end;
exception
when no_data_found then
null;
when others then
raise;
end DELMONEDA;
/

PROCEDIMIENTO ALMACENADO DE TRANSACCIÓN COMPRAS - SET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.SETREGISTRO_COMPRAS(


pcodcompra out REGISTRO_COMPRAS.codcompra%type, --
pserie REGISTRO_COMPRAS.serie%type, --
pnumerodocumento REGISTRO_COMPRAS.numerodocumento%type, --
pguiaremision REGISTRO_COMPRAS.guiaremision%type, --
pfecharecepcion REGISTRO_COMPRAS.fecharecepcion%type, --
pfechaemision REGISTRO_COMPRAS.fechaemision%type, --
pfechavencimiento REGISTRO_COMPRAS.fechavencimiento%type, --
pformapago REGISTRO_COMPRAS.formapago%type, --
psubtotal REGISTRO_COMPRAS.subtotal%type, --
pigv REGISTRO_COMPRAS.igv%type, --
ptotalgeneral REGISTRO_COMPRAS.totalgeneral%type, --
pobservacion REGISTRO_COMPRAS.observacion%type, --
pcondicion_estado REGISTRO_COMPRAS.condicion_estado%type, --
pdeudaactual REGISTRO_COMPRAS.deudaactual%type, --
ppago REGISTRO_COMPRAS.pago%type, --
pdeudapendiente REGISTRO_COMPRAS.deudapendiente%type, --
pcoddocumento REGISTRO_COMPRAS.coddocumento%type, --
pcodmoneda REGISTRO_COMPRAS.codmoneda%type, --
pcodproveedor REGISTRO_COMPRAS.codproveedor%type, --
pusuario varchar2
)
IS
vcodcompra char(8) := substr(pcodcompra,1,8);
vserie char(4) := substr(pserie,1,4);
vnumerodocumento char(11) :=
substr(pnumerodocumento,1,11);
vguiaremision varchar2(20) := substr(pguiaremision,1,20);
vfecharecepcion date := pfecharecepcion;
vfechaemision date := pfechaemision;
vfechavencimiento date := pfechavencimiento;
vformapago nvarchar2(50) := substr(pformapago,1,50);
vsubtotal number(18,2) := substr(psubtotal,1,18);
vigv number(18,2) := substr(pigv,1,18);
vtotalgeneral number(18,2) := substr(ptotalgeneral,1,18);
vobservacion nvarchar2(100):= substr(pobservacion,1,100);
vcondicion_estado char(20) :=
substr(pcondicion_estado,1,20);
vdeudaactual number(18,2) := substr(pdeudaactual,1,18);
vpago number(18,2) := substr(ppago,1,18);
vdeudapendiente number(18,2) := substr(pdeudapendiente,1,18);
vcoddocumento char(3) := substr(pcoddocumento,1,3);
vcodmoneda char(3) := substr(pcodmoneda,1,3);
vcodproveedor char(5) := substr(pcodproveedor,1,5);

Dávila Napa, César Gustavo Pág.: 55


Informe de Prácticas Profesionales
vusuario varchar2(15) := substr(pusuario,1,15);
begin
IF TRIM(vserie) IS NULL THEN
raise_application_error(-20000,'Ingrese Serie');
END IF;
IF TRIM(vNUMERODOCUMENTO) IS NULL THEN
raise_application_error(-20000,'Ingrese Numero Documento');
END IF;
IF TRIM(vcoddocumento) IS NULL THEN
raise_application_error(-20000,'Ingrese Documento');
END IF;
IF TRIM(vcodmoneda) IS NULL THEN
raise_application_error(-20000,'Ingrese Moneda');
END IF;
IF TRIM(vcodproveedor) IS NULL THEN
raise_application_error(-20000,'Ingrese Proveedor');
END IF;
if vsubtotal is null or vsubtotal = 0.00 then
raise_application_error(-20000,'Ingrese subtotal');
end if;
IF TRIM(vCODCOMPRA)IS NULL THEN
SELECT SUBSTR ('00000000'||(NVL (MAX(CODCOMPRA),0) + 1),-8)
INTO vCODCOMPRA
FROM REGISTRO_COMPRAS;
END IF;
merge into REGISTRO_COMPRAS destino
using ( select
vcodcompra codcompra,
vserie serie,
vnumerodocumento numerodocumento,
vguiaremision guiaremision,
vfecharecepcion fecharecepcion,
vfechaemision fechaemision,
vfechavencimiento fechavencimiento,
vformapago formapago,
vsubtotal subtotal,
vigv igv,
vtotalgeneral totalgeneral,
vobservacion observacion,
vcondicion_estado condicion_estado,
vdeudaactual deudaactual,
vpago pago,
vdeudapendiente deudapendiente,
vcoddocumento coddocumento,
vcodmoneda codmoneda,
vcodproveedor codproveedor,
vusuario usuario,
sysdate fecha,
'0' flgeli
from dual) origen
on (destino.codcompra = origen.codcompra)
when matched then
update set
serie = origen.serie,
numerodocumento = origen.numerodocumento,
guiaremision = origen.guiaremision,
fecharecepcion = origen.fecharecepcion,
fechaemision = origen.fechaemision,
fechavencimiento = origen.fechavencimiento,
formapago = origen.formapago,
subtotal = origen.subtotal,
igv = origen.igv,
totalgeneral = origen.totalgeneral,

Dávila Napa, César Gustavo Pág.: 56


Informe de Prácticas Profesionales
observacion = origen.observacion,
condicion_estado = origen.condicion_estado,
deudaactual = origen.deudaactual,
pago = origen.pago,
deudapendiente = origen.deudapendiente,
coddocumento = origen.coddocumento,
codmoneda = origen.codmoneda,
codproveedor = origen.codproveedor,
usuario_modificacion = vusuario,
fecha_modificacion = sysdate
when not matched then
insert (codcompra,
serie,
numerodocumento,
guiaremision,
fecharecepcion,
fechaemision,
fechavencimiento,
formapago,
subtotal,
igv,
totalgeneral,
observacion,
condicion_estado,
deudaactual,
pago,
deudapendiente,
coddocumento,
codmoneda,
codproveedor,
usuario_creacion,
usuario_modificacion,
fecha_creacion,
fecha_modificacion,ESTADO_COMPRA )
values (origen.codcompra,
origen.serie,
origen.numerodocumento,
origen.guiaremision,
origen.fecharecepcion,
origen.fechaemision,
origen.fechavencimiento,
origen.formapago,
origen.subtotal,
origen.igv,
origen.totalgeneral,
origen.observacion,
origen.condicion_estado,
origen.deudaactual,
origen.pago,
origen.deudapendiente,
origen.coddocumento,
origen.codmoneda,
origen.codproveedor,
vusuario,
vusuario,
sysdate,
sysdate ,'Activo');
pcodcompra := vcodcompra;
exception
when no_data_found then
null;
when others then
raise;

Dávila Napa, César Gustavo Pág.: 57


Informe de Prácticas Profesionales
end SETREGISTRO_COMPRAS;
/

PROCEDIMIENTO ALMACENADO DE CONSULTAR COMPRAS GET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.GETREGISTRO_COMPRAS(


pCODPROVEEDOR REGISTRO_COMPRAS.CODPROVEEDOR%type, --
pnombreproveedor proveedores.NOMBREPROVEEDOR%type,
pruc proveedores.RUC%type,
ptipodocumento tipodocumento.TIPODOCUMENTO%type,
ptipomoneda moneda.TIPOMONEDA%type,
pnumerodocumento registro_compras.NUMERODOCUMENTO%type,
pfecharecepcion registro_compras.FECHARECEPCION%type,
pcursor out sys_refcursor)
IS
vCODPROVEEDOR char(5) := substr(pCODPROVEEDOR,1,5);
vruc char(11) := substr(pruc,1,11);
vtipodocumento varchar(35):= substr(ptipodocumento,1,35);
vtipomoneda varchar(35):=substr(ptipomoneda,1,35);
vnumerodocumento char(11) :=substr(pnumerodocumento,1,11);
vfecharecepcion date :=pfecharecepcion;
begin
open pcursor for
select
t1.codcompra,
t1.serie,
t4.ruc,
t4.NOMBREPROVEEDOR,
t1.numerodocumento,
t1.guiaremision,
t1.fecharecepcion,
t1.fechaemision,
t1.fechavencimiento,
t1.formapago,
t1.subtotal,
t1.igv,
t1.totalgeneral,
t1.observacion,
t1.condicion_estado,
t1.deudaactual,
t1.pago,
t1.deudapendiente,
t2.TIPODOCUMENTO,
t3.TIPOMONEDA,
t4.NOMBREPROVEEDOR,
t1.CODPROVEEDOR
from REGISTRO_COMPRAS t1
INNER JOIN TIPODOCUMENTO t2
ON t1.CODDOCUMENTO = t2.CODDOCUMENTO
INNER JOIN MONEDA t3
on t3.CODMONEDA = t1.CODMONEDA
INNER JOIN PROVEEDORES t4
ON t4.CODPROVEEDOR = t1.CODPROVEEDOR
where t1.CODPROVEEDOR = nvl(vCODPROVEEDOR ,t1.CODPROVEEDOR)and
t1.ESTADO ='0'
AND t4.NOMBREPROVEEDOR like '%'|| pnombreproveedor ||'%'
and t4.RUC = nvl(vruc ,t4.RUC)
and t2.TIPODOCUMENTO = nvl(vtipodocumento,t2.TIPODOCUMENTO)
and t3.TIPOMONEDA = nvl(vtipomoneda,t3.TIPOMONEDA)
and t1.NUMERODOCUMENTO = nvl(vnumerodocumento,t1.NUMERODOCUMENTO)
and t1.FECHARECEPCION between pfecharecepcion and pfecharecepcion

Dávila Napa, César Gustavo Pág.: 58


Informe de Prácticas Profesionales
order by codcompra;
exception
when no_data_found then
null;
when others then
raise;
end GETREGISTRO_COMPRAS;

PROCEDIMIENTO ALMACENADO ELIMINAR COMPRAS

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.DELREGISTRO_COMPRAS(


pcodcompra REGISTRO_COMPRAS.codcompra%type, --
pusuario varchar2 default null)
IS
vcodcompra char(8) := substr(pcodcompra,1,8);
vusuario varchar2(15):= substr(pusuario,1,15);
begin
dbms_output.enable;
if trim(vcodcompra) is null then
raise_application_error (-20000,' incorrecto');
end if;
begin
update REGISTRO_COMPRAS set registro_compras.ESTADO = 1
,registro_compras.ESTADO_COMPRA = 'Anulado' ,
registro_compras.USUARIO_MODIFICACION = vusuario ,
registro_compras.FECHA_MODIFICACION = sysdate
where codcompra = vcodcompra;
exception
when others then
raise_application_error(-20000,'No es posible eliminar el
registro');
end;
exception
when no_data_found then
null;
when others then
raise;
end DELREGISTRO_COMPRAS;
/

PROCEDIMIENTO ALMACENADO DETALLE COMPRAS SET

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.SETDETALLE_COMPRA(


pcantidad DETALLE_COMPRA.cantidad%type, --
pprecio_sigv DETALLE_COMPRA.precio_sigv%type, --
pprecio_cigv DETALLE_COMPRA.precio_cigv%type, --
pvalor_venta DETALLE_COMPRA.valor_venta%type, --
pigv DETALLE_COMPRA.igv%type, --
pimporte DETALLE_COMPRA.importe%type, --
pcodcompra DETALLE_COMPRA.codcompra%type, --
pobservacion DETALLE_COMPRA.observacion%type, --
pcodproducto DETALLE_COMPRA.codproducto%type, --
pusuario varchar2

Dávila Napa, César Gustavo Pág.: 59


Informe de Prácticas Profesionales
)
IS
vcoddetallecompra char(7);
vcantidad number(18,2) := substr(pcantidad,1,18);
vprecio_sigv number(18,2) := substr(pprecio_sigv,1,18);
vprecio_cigv number(18,2) := substr(pprecio_cigv,1,18);
vvalor_venta number(18,2) := substr(pvalor_venta,1,18);
vigv number(18,2) := substr(pigv,1,18);
vimporte number(18,2) := substr(pimporte,1,18);
vcodcompra char(8) := substr(pcodcompra,1,8);
vobservacion nvarchar2(100):= substr(pobservacion,1,100);
vcodproducto char(5) := substr(pcodproducto,1,5);
vusuario varchar2(15) := substr(pusuario,1,15);
begin
IF TRIM(vCANTIDAD) IS NULL THEN
raise_application_error(-20000,'Ingrese Cantidad');
END IF;
IF TRIM(vPRECIO_SIGV) IS NULL THEN
raise_application_error(-20000,'Ingrese con IGV');
END IF;
if TRIM(vcoddetallecompra) is null then
SELECT SUBSTR ('0000000'||(NVL (MAX(CODDETALLECOMPRA),0) + 1),-7)
INTO vCODDETALLECOMPRA
FROM DETALLE_COMPRA;
END IF;
merge into DETALLE_COMPRA destino
using ( select
vcoddetallecompra coddetallecompra,
vcantidad cantidad,
vprecio_sigv precio_sigv,
vprecio_cigv precio_cigv,
vvalor_venta valor_venta,
vigv igv,
vimporte importe,
vcodcompra codcompra,
vobservacion observacion,
vcodproducto codproducto,
vusuario usuario,
sysdate fecha,
'0' flgeli
from dual) origen
on (destino.codcompra = origen.codcompra and
destino.coddetallecompra = origen.coddetallecompra)
when matched then
update set
cantidad = origen.cantidad,
precio_sigv = origen.precio_sigv,
precio_cigv = origen.precio_cigv,
valor_venta = origen.valor_venta,
igv = origen.igv,
importe = origen.importe,
observacion = origen.observacion,
codproducto = origen.codproducto,
usuario_modificacion = vusuario,
fecha_modificacion = sysdate
when not matched then
insert (coddetallecompra,
cantidad,
precio_sigv,
precio_cigv,
valor_venta,
igv,
importe,

Dávila Napa, César Gustavo Pág.: 60


Informe de Prácticas Profesionales
codcompra,
observacion,
codproducto,
usuario_creacion,
usuario_modificacion,
fecha_creacion,
fecha_modificacion )
values (origen.coddetallecompra,
origen.cantidad,
origen.precio_sigv,
origen.precio_cigv,
origen.valor_venta,
origen.igv,
origen.importe,
origen.codcompra,
origen.observacion,
origen.codproducto,
vusuario,
vusuario,
sysdate,
sysdate );
exception
when no_data_found then
null;
when others then
raise;
end SETDETALLE_COMPRA;

PROCEDIMIENTO ALMACENADO DE CONSULTAR DETALLE COMPRAS GET

CREATE OR REPLACE PROCEDURE


SYSTEMCOMPRASGENERAL.GETDETALLE_COMPRA_BUSCAR(
pcompra detalle_compra.codcompra%type,
pcursor out sys_refcursor)
is
vcompra char(8):=substr(pcompra,1,8);
begin
open pcursor for
select t1.codproducto Codigo,
t2.unidad Unidad,
t2.NOMBREPROODUCTO Descripcion,
t1.cantidad Cantidad,
t1.precio_sigv Precio_sigv,
t1.precio_cigv Precio_cigv,
t1.valor_venta Valor_venta,
t1.igv Igv,
t1.importe Importe,
t1.observacion Observacion
from detalle_compra t1
inner join producto t2
on t1.codproducto = t2.codproducto
where t1.CODCOMPRA = vcompra;
exception
when no_data_found then
null;
when others then
raise;
end;

Dávila Napa, César Gustavo Pág.: 61


Informe de Prácticas Profesionales
PROCEDIMIENTO ALMACENADO ELIMINAR DETALLE COMPRAS

CREATE OR REPLACE PROCEDURE SYSTEMCOMPRASGENERAL.DELDETALLE_COMPRA(


pcodcompra registro_compras.CODCOMPRA%type,
pusuario varchar2 default null)
IS
vcodcompra char(8) := substr(pcodcompra,1,8);
begin
dbms_output.enable;
begin
update DETALLE_COMPRA set detalle_compra.ESTADO = 1,
detalle_compra.USUARIO_MODIFICACION =pusuario,
detalle_compra.FECHA_MODIFICACION=sysdate
where codcompra = vcodcompra ;
exception
when others then
raise_application_error(-20000,'No es posible eliminar el
registro');
end;
exception
when no_data_found then
null;
when others then
raise;
end DELDETALLE_COMPRA;

Dávila Napa, César Gustavo Pág.: 62


Informe de Prácticas Profesionales

Programación en Microsoft Visual Studio 2010

FORMULARIO PRINCIPAL

ACCSESO

Dávila Napa, César Gustavo Pág.: 63


Informe de Prácticas Profesionales
using System;
using System. Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Linq;
using System.Xml.Linq;
using Pry_Libreria_SistemaCaf.Entidades;
using System.Runtime.InteropServices;
Namespace Pry_Win_SistemaCaf
{
public partial class Frm_Iniciar_Sistema : Form
{
private const int MF_BYPOSITION = 0x400;
[DllImport ("User32")]
private static extern int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags);
[DllImport ("User32")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport ("User32")]
private static extern int GetMenuItemCount(IntPtr hWnd);
public string Apellidos;
public string Nombres;
public string tituliusuario;
int cont;
public Frm_Iniciar_Sistema()
{
InitializeComponent ();
}

EBUsuario Usuario = new EBUsuario();


private void Frm_Iniciar_Sistema_Load(object sender, EventArgs e)
{
Lbl_Time.Text = Strings.FormatDateTime (DateAndTime.Now, DateFormat.LongTime);
IntPtr hMenu = GetSystemMenu (this.Handle, false);
int menuItemCount = GetMenuItemCount(hMenu);
RemoveMenu (hMenu, menuItemCount - 1, MF_BYPOSITION);
cmbusuario.DataSource = Usuario.ListarAll ();
cmbusuario.DisplayMember = "Login";
cmbusuario.ValueMember = "CodUsuario";
cmbusuario.SelectedValue = "";
cmbusuario.Focus();
}
private void BntAceptar_Click(object sender, EventArgs e)
{
try
{
string nlog = null;
string pass = null;
nlog = Convert.ToString(cmbusuario.Text);
EBUsuario ObjUsuario = new EBUsuario ();
EBUsuario Objclave = new EBUsuario ();
ObjUsuario = Usuario.ConsultarLogPass (nlog);
cont = cont + 1;
if (string.IsNullOrEmpty(cmbusuario.Text)) throw new Exception(" Ingrese su Login ");
if (string.IsNullOrEmpty(TxtContraseña.Text)) throw new Exception(" Ingrese su
Contraseña ");
if ((ObjUsuario != null))
{
pass = ObjUsuario.Contrasenna;
int status = 0;

Dávila Napa, César Gustavo Pág.: 64


Informe de Prácticas Profesionales
Apellidos = ObjUsuario.Apelidos;
Nombres = ObjUsuario.Nombres;
if (TxtContraseña.Text == pass)
{
status = 1;
}
else
{
status = 2;
}
if (status == 1)
{
MessageBox.Show ("Bienvenidos al Sistema” + Apellidos + " " + Nombres,
"Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
}
else
{
if ((cont == 3))
{
MessageBox.Show("Usted a ingresado Datos Incorrectos..!!! se cerrara el
Sistema..!!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
DialogResult = DialogResult.Cancel;
}
else
{
MessageBox.Show ("Error le quedan " + Conversion.Int (3 - cont) + "
intentos", "Aviso del Sistema.!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
TxtContraseña.Text = "";
TxtContraseña.Focus ();
}

}
}
}
catch (Exception ex)
{
MessageBox.Show (ex.Message);

}
}

private void BntSalir_Click(object sender, EventArgs e)


{
DialogResult = DialogResult.Cancel;
System.Environment.Exit (0);
}

private void Timer1_Tick_1(object sender, EventArgs e)


{
Lbl_Time.Text = Strings.FormatDateTime (DateAndTime.Now, DateFormat.LongTime);
}
}
}

MANTENIMIENTO DEL PROVEEDOR

Dávila Napa, César Gustavo Pág.: 65


Informe de Prácticas Profesionales

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_ListarProveedor : Form
{
public bool w_nuevo;
public bool w_editar;
EBProveedor Proveedor = new EBProveedor ();
Frm_Proveedor Form = new Frm_Proveedor ();
EBTipoProveedor Tipo_Proveedor = new EBTipoProveedor ();
public Frm_ListarProveedor ()
{
InitializeComponent ();
}
private void Frm_ListarProveedor_Load(object sender, EventArgs e)
{
txtIDProveedor.Focus ();
dgvListado.AlternatingRowsDefaultCellStyle.BackColor = Color.FloralWhite;
dgvListado.DefaultCellStyle.BackColor = Color.Beige;
}
private void btnNuevo_Click(object sender, EventArgs e)
{
if (Form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
dgvListado.AutoGenerateColumns = false;
Proveedor.Codigo = txtIDProveedor.Text;
CBProveedores Consultar = new CBProveedores (Proveedor);
dgvListado.DataSource = Consultar;
}
}

Dávila Napa, César Gustavo Pág.: 66


Informe de Prácticas Profesionales
private void btnBuscar_Click(object sender, EventArgs e)
{
try
{

dgvListado.AutoGenerateColumns = false;
Proveedor.Codigo = txtIDProveedor.Text;
Proveedor.Nombreproveedor = txtnameProveedor.Text;
Proveedor.Ruc = txtruc.Text;
CBProveedores Consultar = new CBProveedores (Proveedor);
dgvListado.DataSource = Consultar;
}
catch (Exception ex)
{
MessageBox.Show ("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
btnEditar.Enabled = true;
btnEliminar.Enabled = true;
btnImprimir.Enabled = true;
}

private void btnEditar_Click(object sender, EventArgs e)


{
w_editar = true;
try
{
Form.txtIDProveedor.Text = dgvListado.Rows [dgvListado.CurrentCell.RowIndex].Cells
[0].Value.ToString ();
}
catch (Exception ex)
{
MessageBox.Show ("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
if (Form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
dgvListado.AutoGenerateColumns = false;
Proveedor.Codigo = txtIDProveedor.Text;
CBProveedores Consultar = new CBProveedores (Proveedor);
dgvListado.DataSource = Consultar;
}
}

private void button1_Click(object sender, EventArgs e)


{
this.Close ();
}

private void txtIDProveedor_KeyPress(object sender, KeyPressEventArgs e)


{
char caracter = e.KeyChar;

TextBox txt = (TextBox) sender;

if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter == Convert.ToChar(".")) &
(txt.Text.Contains (".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}

Dávila Napa, César Gustavo Pág.: 67


Informe de Prácticas Profesionales
private void btnEliminar_Click(object sender, EventArgs e)
{
try
{

if (MessageBox.Show("Desea Eliminar este registro..?", "Aviso",


MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
Proveedor.Codigo = dgvListado.Rows CurrentCell.RowIndex].Cells[0].Value.ToString();
Proveedor.Codigo = txtIDProveedor.Text;
Proveedor.Estacion = Environment.MachineName.ToString ();
Proveedor.Usuario = Environment.UserName.ToUpper ();
Proveedor.Eliminar (Proveedor);
MessageBox.Show("Se Eliminados con éxito el registro...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
txtIDProveedor.Text = "";
CBProveedores Consultar = new CBProveedores(Proveedor);
dgvListado.DataSource = Consultar;
}
else
{
MessageBox.Show ("Proceso de Eliminacion Cancelado...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show ("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

private void txtnameProveedor_TextChanged(object sender, EventArgs e)


{
dgvListado.AutoGenerateColumns = false;
Proveedor.Codigo = txtIDProveedor.Text;
Proveedor.Nombreproveedor = txtnameProveedor.Text;
CBProveedores Consultar = new CBProveedores(Proveedor);
dgvListado.DataSource = Consultar;
}
private void txtruc_KeyPress(object sender, KeyPressEventArgs e)
{
char caracter = e.KeyChar;
TextBox txt = (TextBox) sender;
if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter == Convert.ToChar(".")) &
(txt.Text.Contains (".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}

private void GroupBox1_Enter(object sender, EventArgs e)


{
txtIDProveedor.Focus ();
}
private void dgvListado_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
Frm_Compra1 Compra = new Frm_Compra1();
Compra.txtIDProveedor.Text = dgvListado.Rows [dgvListado.CurrentCell.RowIndex].Cells
[0].Value.ToString ();

Dávila Napa, César Gustavo Pág.: 68


Informe de Prácticas Profesionales
DialogResult = DialogResult.OK;
}
private void btnImprimir_Click(object sender, EventArgs e)
{
Frm_ReporteCompra f = new Frm_ReporteCompra ();

f.EBProveedorBindingSource.DataSource = dgvListado.DataSource;
f.reportViewer1.SetDisplayMode (Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
f.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth;
f.reportViewer1.RefreshReport ();
f.MdiParent = this.MdiParent;
f.Show ();
}
}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
using System.IO;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_Proveedor : Form
{
string Ruta;
string foto = null;
public Frm_Proveedor()
{
InitializeComponent ();
}

private void habi_Caja(bool a)


{
txtnameProveedor.Enabled = a;
txtDireccion.Enabled = a;

Dávila Napa, César Gustavo Pág.: 69


Informe de Prácticas Profesionales
txtRUC.Enabled = a;
cmdTipoProveedor.Enabled = a;
txtObservaciones.Enabled = a;
txtTelefono.Enabled = a;
btnCargarFoto.Enabled = a;
}
private void limpiarcajas ()
{
txtIDProveedor.Text = "";
txtnameProveedor.Text = "";
txtDireccion.Text = "";
txtRUC.Text = "";
cmdTipoProveedor.SelectedValue = "";
txtTelefono.Text = "";
txtObservaciones.Text = "";
PCTB_Foto.Image = null;
}

EBProveedor Proveedor = new EBProveedor();

private void btnGrabar_Click(object sender, EventArgs e)


{

try
{
Proveedor.Codigo = txtIDProveedor.Text;
Proveedor.Nombreproveedor = txtnameProveedor.Text;
Proveedor.Direccion = txtDireccion.Text;
Proveedor.Ruc = txtRUC.Text;
Proveedor.Telefono = txtTelefono.Text;
Proveedor.Observacion = txtObservaciones.Text;
Proveedor.Codtipoproveedor = cmdTipoProveedor.SelectedValue.ToString ();
Proveedor.Foto = Ruta;
Proveedor.Estacion = Environment.MachineName.ToString ();
Proveedor.Usuario = Environment.UserName.ToUpper(); ;
if (txtObservaciones.Text == "")
{
Proveedor.Observacion = "Sin Observación";
if (Ruta == "")
{
Ruta = foto = "C:\\Users\\Alumno\\Desktop\\Proyecto Original Compras C# & Oracle
21-10-11\\FOTO SISTEMA\\noexiste.jpg";
Proveedor.Foto = Ruta;
}

Proveedor.Insertar (Proveedor);
DialogResult = DialogResult.OK;
}
else
{
Proveedor.Insertar (Proveedor);
DialogResult = DialogResult.OK;
}

if (txtIDProveedor.Text == "")
{
MessageBox.Show ("Se agregaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close ();
}
else
{
MessageBox.Show ("Se Actualizaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;

Dávila Napa, César Gustavo Pág.: 70


Informe de Prácticas Profesionales
this.Close ();
}
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

private void btnCargarFoto_Click(object sender, EventArgs e)


{
MemoryStream ms = new MemoryStream ();
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
PCTB_Foto.Image = new Bitmap(openFileDialog1.FileName);
PCTB_Foto.SizeMode = PictureBoxSizeMode.StretchImage;
PCTB_Foto.Image.Save (ms, PCTB_Foto.Image.RawFormat);
Ruta = openFileDialog1.FileName;
}
}

private void Frm_Proveedor_Load(object sender, EventArgs e)


{
Pry_Libreria_SistemaCaf.Entidades. EBTipoProveedor Tipo_Proveedor = new
Pry_Libreria_SistemaCaf.Entidades. EBTipoProveedor ();
cmdTipoProveedor.DataSource = Tipo_Proveedor.Listar ();
cmdTipoProveedor.DisplayMember = "nombretipoproveedor";
cmdTipoProveedor.ValueMember = "codtipoproveedor";
habi_Caja (true);
txtIDProveedor.Enabled = false;
Frm_ListarProveedor boton = new Frm_ListarProveedor ();
try
{
Proveedor = Proveedor.ConsultarAll (txtIDProveedor.Text);
if ((Proveedor != null))
{

txtIDProveedor.Text = txtIDProveedor.Text;
txtnameProveedor.Text = Proveedor.Nombreproveedor;
txtDireccion.Text = Proveedor.Direccion;
txtRUC.Text = Proveedor.Ruc;
cmdTipoProveedor.SelectedValue = Proveedor.Codtipoproveedor;
txtTelefono.Text = Proveedor.Telefono;
txtObservaciones.Text = Proveedor.Observacion;
Ruta = Proveedor.Foto;

foto = Ruta;
If (Ruta == "")
{
foto = "C:\\Users\\Alumno\\Desktop\\Proyecto Original Compras C# & Oracle 21-10-
11\\FOTO SISTEMA\\noexiste.jpg";
}
else
{
PCTB_Foto.Image = Image.FromFile (foto);
PCTB_Foto.SizeMode = PictureBoxSizeMode.StretchImage;
PCTB_Foto.Visible = true;
}
}
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}

Dávila Napa, César Gustavo Pág.: 71


Informe de Prácticas Profesionales
cmdTipoProveedor.Focus ();
}
private void PCTB_Foto_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "Archivo de Ingreso |*.*|jpg.|*.jpg|gif.|*.gil|Bitmap|*.bmp";
}
private void btnCancelar_Click(object sender, EventArgs e)
{
MessageBox.Show ("La Operacion se a Cancelado", "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Information);
this.Close ();
}
}
}

MANTENIMIENTO PRODUCTO

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;

namespace Pry_Win_SistemaCaf
{
public partial class Frm_Listar_Producto : Frm_Plantilla_2
{
public Frm_Listar_Producto()
{
InitializeComponent ();
}
Frm_Producto p = new Frm_Producto ();
EBProducto producto = new EBProducto ();
Frm_Producto Form = new Frm_Producto ();
private void btnNuevo_Click(object sender, EventArgs e)
{
if (p.ShowDialog () == System.Windows.Forms.DialogResult.OK)
{
dgvListado.AutoGenerateColumns = false;

Dávila Napa, César Gustavo Pág.: 72


Informe de Prácticas Profesionales
producto.Codigo = txtIDProveedor.Text;
CBProducto Consultar = new CBProducto (producto);
dgvListado.DataSource = Consultar;
} Form.txtDescripcion.Focus ();
}

private void btnBuscar_Click(object sender, EventArgs e)


{
try
{
dgvListado.AutoGenerateColumns = false;
producto.Codigo = txtIDProveedor.Text;
producto.Nombreprooducto = txtnameProveedor.Text;
CBProducto Consultar = new CBProducto (producto);
dgvListado.DataSource = Consultar;
}
catch (Exception ex)
{
MessageBox.Show ("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
btnEditar.Enabled = true;
btnEliminar.Enabled = true;
btnImprimir.Enabled = true;
}

private void txtnameProveedor_TextChanged(object sender, EventArgs e)


{
dgvListado.AutoGenerateColumns = false;
producto.Nombreprooducto = txtnameProveedor.Text;
CBProducto Consultar = new CBProducto(producto);
dgvListado.DataSource = Consultar;
}
private void btnEditar_Click(object sender, EventArgs e)
{
try
{
Form.txtCodProducto.Text = dgvListado.Rows [dgvListado.CurrentCell.RowIndex].Cells
[0].Value.ToString ();
}
catch (Exception ex)
{
MessageBox.Show ("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
if (Form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
dgvListado.AutoGenerateColumns = false;
producto.Codigo = txtIDProveedor.Text;
CBProducto Consultar = new CBProducto (producto);
dgvListado.DataSource = Consultar;
} Form.txtDescripcion.Focus ();
}

private void btnEliminar_Click(object sender, EventArgs e)


{
try
{

if (MessageBox.Show("Desea Eliminar este registro..?", "Aviso",


MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
producto.Codigo =
dgvListado.Rows[dgvListado.CurrentCell.RowIndex].Cells[0].Value.ToString(); ;
producto.Codigo = txtIDProveedor.Text;
producto.Estacion = Environment.MachineName.ToString ();

Dávila Napa, César Gustavo Pág.: 73


Informe de Prácticas Profesionales
producto.Usuario = Environment.UserName.ToUpper(); ;
producto.Eliminar (producto);
MessageBox.Show("Se Eliminados con éxito el registro...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
txtIDProveedor.Text = "";
CBProducto Consultar = new CBProducto (producto);
dgvListado.DataSource = Consultar;
}
else
{
MessageBox.Show ("Proceso de Eliminación Cancelado...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

private void txtIDProveedor_KeyPress(object sender, KeyPressEventArgs e)


{
char caracter = e.KeyChar;
TextBox txt = (TextBox) sender;
if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter == Convert.ToChar (".")) &
(txt.Text.Contains (".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
private void dgvListado_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
Frm_InsertarCompra Compra = new Frm_InsertarCompra ();
Compra.txtIDProducto.Text = dgvListado.Rows [dgvListado.CurrentCell.RowIndex].Cells
[0].Value.ToString ();
DialogResult = DialogResult.OK;
}
}
}

Dávila Napa, César Gustavo Pág.: 74


Informe de Prácticas Profesionales

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;

namespace Pry_Win_SistemaCaf
{
public partial class Frm_Producto : Frm_Plantilla_1
{
public Frm_Producto()
{
InitializeComponent ();
}

Frm_ListarCategoria c = new Frm_ListarCategoria();


EBProducto producto = new EBProducto ();
EBCategoria categoria = new EBCategoria ();
private void Frm_Producto_Load(object sender, EventArgs e)
{
EBCategoria categoria = new EBCategoria ();
CmbCategoria1.DataSource = categoria.Listar ();
CmbCategoria1.DisplayMember = "Nombre_Categoria";
CmbCategoria1.ValueMember = "Codigo";
producto = producto.ConsultarAll(txtCodProducto.Text);
if ((producto != null))
{
txtCodProducto.Text = txtCodProducto.Text;
txtDescripcion.Text = producto.Nombreprooducto;
txtUnidad.Text = producto.Unidad;
txtObservacion.Text = producto.Observacion;
CmbCategoria1.SelectedValue = producto.Codcategoria;
}
txtDescripcion.Focus ();
}

private void btnCategoria_Click(object sender, EventArgs e)

Dávila Napa, César Gustavo Pág.: 75


Informe de Prácticas Profesionales
{
if (c.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
CmbCategoria1.DataSource = categoria.Listar ();
}
}

private void btnGrabar_Click(object sender, EventArgs e)


{
try
{
producto.Codigo = txtCodProducto.Text;
producto.Nombreprooducto = txtDescripcion.Text;
producto.Unidad = txtUnidad.Text;
producto.Observacion = txtObservacion.Text;
producto.Codcategoria = CmbCategoria1.SelectedValue.ToString ();
producto.Estacion = Environment.MachineName.ToString ();
producto.Usuario = Environment.UserName.ToUpper ();

if (txtObservacion.Text == "")
{
producto.Observacion = "Sin Observación";
producto. Insertar (producto);
DialogResult = DialogResult.OK;
}
else
{
producto. Insertar (producto);
DialogResult = DialogResult.OK;
}

if (txtCodProducto.Text == "")
{
MessageBox.Show ("Se agregaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close ();
}
else
{
MessageBox.Show ("Se Actualizaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close ();
}
}
catch (Exception ex)
{
MessageBox.Show ("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

private void btnCancelar_Click(object sender, EventArgs e)


{
MessageBox.Show ("La Operacion se a Cancelado", "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Information);
this.Close();
}
}}

MANTENIMIENTO DOCUMENTO

Dávila Napa, César Gustavo Pág.: 76


Informe de Prácticas Profesionales

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;

namespace Pry_Win_SistemaCaf
{
public partial class Frm_ListarDocumento : Frm_Plantilla_2
{
public Frm_ListarDocumento()
{
InitializeComponent ();
}
Frm_Documento docum = new Frm_Documento ();
EBDocumento Documento = new EBDocumento ();

private void btnNuevo_Click(object sender, EventArgs e)


{
if (docum.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
dgvListado.AutoGenerateColumns = false;
Documento.Codigo = txtIDProveedor.Text;
CBDocumento Consultar = new CBDocumento (Documento);
dgvListado.DataSource = Consultar;
} docum.txtNomDocumento.Focus ();
}

private void btnBuscar_Click(object sender, EventArgs e)


{
try
{
dgvListado.AutoGenerateColumns = false;
Documento.Codigo = txtIDProveedor.Text;
Documento.Tipodocumento = txtnameProveedor.Text;

Dávila Napa, César Gustavo Pág.: 77


Informe de Prácticas Profesionales
CBDocumento Consultar = new CBDocumento (Documento);
dgvListado.DataSource = Consultar;
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
btnEditar.Enabled = true;
btnEliminar.Enabled = true;
btnImprimir.Enabled = true;
}

private void btnEditar_Click(object sender, EventArgs e)


{
docum.txtCodDocumento.Text = dgvListado.Rows
[dgvListado.CurrentCell.RowIndex].Cells [0].Value.ToString ();
docum.txtCodDocumento.Text = dgvListado.Rows
[dgvListado.CurrentCell.RowIndex].Cells [1].Value.ToString ();

if (docum.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
dgvListado.AutoGenerateColumns = false;
Documento.Codigo = txtIDProveedor.Text;
CBDocumento Consultar = new CBDocumento (Documento);
dgvListado.DataSource = Consultar;
} docum.txtNomDocumento.Focus ();
}

private void btnEliminar_Click(object sender, EventArgs e)


{
try
{
if (MessageBox.Show("Desea Eliminar este registro..?", "Aviso",
MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
Documento.Codigo = dgvListado.Rows [dgvListado.CurrentCell.RowIndex].Cells
[0].Value.ToString (); ;
Documento.Codigo = txtIDProveedor.Text;
Documento.Eliminar (Documento);
MessageBox.Show ("Se Eliminados con éxito el registro...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
CBDocumento Consultar = new CBDocumento (Documento);
dgvListado.DataSource = Consultar;
}
else
{
MessageBox.Show ("Proceso de Eliminacion Cancelado...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);

}
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

private void txtIDProveedor_KeyPress(object sender, KeyPressEventArgs e)


{
char caracter = e.KeyChar;

Dávila Napa, César Gustavo Pág.: 78


Informe de Prácticas Profesionales
TextBox txt = (TextBox) sender;

if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter ==
Convert.ToChar(".")) & (txt.Text.Contains (".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}

private void button1_Click(object sender, EventArgs e)


{
DialogResult = DialogResult.OK;
}
}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_Documento : Frm_Plantilla_1
{
public Frm_Documento()
{
InitializeComponent ();
}
EBDocumento Documento = new EBDocumento ();
private void btnGrabar_Click(object sender, EventArgs e)
{
try
{
Documento.Codigo = txtCodDocumento.Text;
Documento.Tipodocumento = txtNomDocumento.Text;

if (txtCodDocumento.Text == "")

Dávila Napa, César Gustavo Pág.: 79


Informe de Prácticas Profesionales
{
Documento.Insertar (Documento);
MessageBox.Show ("Se agregaron los registros exitosamente",
"Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close ();
}
else
{
Documento.Insertar (Documento);
MessageBox.Show ("Se Actualizaron los registros
exitosamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close ();
}
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void btnCancelar_Click(object sender, EventArgs e)


{
MessageBox.Show ("La Operacion se a Cancelado", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close ();
}
}
}

MANTENIMIENTO CATEGORIA

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

Dávila Napa, César Gustavo Pág.: 80


Informe de Prácticas Profesionales
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_ListarCategoria : Frm_Plantilla_2
{
public Frm_ListarCategoria()
{
InitializeComponent ();
}
EBCategoria categoria = new EBCategoria ();
Frm_Categoria c = new Frm_Categoria ();
private void btnNuevo_Click(object sender, EventArgs e)
{
if (c.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
c.txtCodCategoria.Text = null;
dgvListado.AutoGenerateColumns = false;
categoria.Codigo = txtIDProveedor.Text;
CBCategoria Consultar = new CBCategoria (categoria);
dgvListado.DataSource = Consultar;
}
}
private void btnBuscar_Click(object sender, EventArgs e)
{
try
{
dgvListado.AutoGenerateColumns = false;
categoria.Codigo = txtIDProveedor.Text;
categoria.Nombrecategoria = txtnameProveedor.Text;
CBCategoria Consultar = new CBCategoria (categoria);
dgvListado.DataSource = Consultar;
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
btnEditar.Enabled = true;
btnEliminar.Enabled = true;
btnImprimir.Enabled = true;
}

private void Frm_ListarCategoria_Load(object sender, EventArgs e)


{
dgvListado.AlternatingRowsDefaultCellStyle.BackColor = Color.FloralWhite;
dgvListado.DefaultCellStyle.BackColor = Color.Beige;
}
private void txtnameProveedor_TextChanged(object sender, EventArgs e)
{
dgvListado.AutoGenerateColumns = false;
categoria.Codigo = txtIDProveedor.Text;
categoria.Nombrecategoria = txtnameProveedor.Text;
CBCategoria Consultar = new CBCategoria (categoria);
dgvListado.DataSource = Consultar;
}

private void btnEditar_Click(object sender, EventArgs e)


{
c.txtCodCategoria.Text = dgvListado.Rows [dgvListado.CurrentCell.RowIndex].Cells
[0].Value.ToString ();
c.txtNomCategoria.Text = dgvListado.Rows [dgvListado.CurrentCell.RowIndex].Cells
[1].Value.ToString ();

Dávila Napa, César Gustavo Pág.: 81


Informe de Prácticas Profesionales
if (c.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
dgvListado.AutoGenerateColumns = false;
categoria.Codigo = txtIDProveedor.Text;
CBCategoria Consultar = new CBCategoria(categoria);
dgvListado.DataSource = Consultar;
} c.txtNomCategoria.Focus ();
}

private void btnEliminar_Click(object sender, EventArgs e)


{
try
{
if (MessageBox.Show("Desea Eliminar este registro..?", "Aviso",
MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
categoria.Codigo = dgvListado.Rows [dgvListado.CurrentCell.RowIndex].Cells
[0].Value.ToString ();
categoria.Codigo = txtIDProveedor.Text;
categoria.Estacion = Environment.MachineName.ToString ();
categoria.Usuario = Environment.UserName.ToUpper ();
categoria.Eliminar (categoria);
MessageBox.Show ("Se Eliminados con éxito el registro...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
CBCategoria Consultar = new CBCategoria (categoria);
dgvListado.DataSource = Consultar;
}
else
{
MessageBox.Show ("Proceso de Eliminacion Cancelado...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show ("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

private void button1_Click(object sender, EventArgs e)


{
DialogResult = DialogResult.OK;
}
private void txtIDProveedor_KeyPress(object sender, KeyPressEventArgs e)
{
char caracter = e.KeyChar;

TextBox txt = (TextBox) sender;

if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter == Convert.ToChar(".")) &
(txt.Text.Contains (".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
}
}

Dávila Napa, César Gustavo Pág.: 82


Informe de Prácticas Profesionales

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_Categoria : Frm_Plantilla_1
{
public Frm_Categoria()
{
InitializeComponent ();
}
EBCategoria Categoria = new EBCategoria ();
private void btnGrabar_Click(object sender, EventArgs e)
{
try
{
Categoria.Codigo = txtCodCategoria.Text;
Categoria.Nombrecategoria = txtNomCategoria.Text;
Categoria.Estacion = Environment.MachineName.ToString ();
Categoria.Usuario = Environment.UserName.ToUpper (); ;
if (txtCodCategoria.Text == "")
{
Categoria.Insertar (Categoria);
MessageBox.Show ("Se agregaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close ();
}
else
{
Categoria.Insertar (Categoria);
MessageBox.Show ("Se Actualizaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close();
}
}
catch (Exception ex)
{
MessageBox.Show ("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

Dávila Napa, César Gustavo Pág.: 83


Informe de Prácticas Profesionales
private void btnCancelar_Click(object sender, EventArgs e)
{
MessageBox.Show ("La Operacion se a Cancelado", "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Information);
this.Close ();
}
}
}

MANTENIMIENTO MONEDA

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_ListarMoneda : Frm_Plantilla_2
{
public Frm_ListarMoneda()
{
InitializeComponent ();
}
Frm_Moneda Form = new Frm_Moneda ();
EBMoneda Moneda = new EBMoneda ();
private void btnNuevo_Click(object sender, EventArgs e)
{
if (Form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{

Dávila Napa, César Gustavo Pág.: 84


Informe de Prácticas Profesionales
dgvListado.AutoGenerateColumns = false;
Moneda.Codigo = txtIDProveedor.Text;
CBMoneda Consultar = new CBMoneda (Moneda);
dgvListado.DataSource = Consultar;
} Form.txtNomMoneda.Focus ();
}
private void btnBuscar_Click(object sender, EventArgs e)
{
try
{
dgvListado.AutoGenerateColumns = false;
Moneda.Codigo = txtIDProveedor.Text;
Moneda.Tipomoneda = txtnameProveedor.Text;
CBMoneda Consultar = new CBMoneda (Moneda);
dgvListado.DataSource = Consultar;
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
btnEditar.Enabled = true;
btnEliminar.Enabled = true;
btnImprimir.Enabled = true;
}

private void btnEliminar_Click(object sender, EventArgs e)


{
try
{
if (MessageBox.Show("Desea Eliminar este registro..?", "Aviso",
MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{

Moneda.Codigo = dgvListado.Rows
[dgvListado.CurrentCell.RowIndex].Cells [0].Value.ToString ();
Moneda.Codigo = txtIDProveedor.Text;
Moneda.Eliminar (Moneda);
MessageBox.Show ("Se Eliminados con éxito el registro...!",
"Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
CBMoneda Consultar = new CBMoneda (Moneda);
dgvListado.DataSource = Consultar;
}
else
{
MessageBox.Show ("Proceso de Eliminación Cancelado...!",
"Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void btnEditar_Click(object sender, EventArgs e)


{
Form.txtCodMoneda.Text = dgvListado.Rows
[dgvListado.CurrentCell.RowIndex].Cells [0].Value.ToString ();
Form.txtNomMoneda.Text = dgvListado.Rows
[dgvListado.CurrentCell.RowIndex].Cells [1].Value.ToString ();
if (Form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{

Dávila Napa, César Gustavo Pág.: 85


Informe de Prácticas Profesionales
dgvListado.AutoGenerateColumns = false;
Moneda.Codigo = txtIDProveedor.Text;
CBMoneda Consultar = new CBMoneda (Moneda);
dgvListado.DataSource = Consultar;
} Form.txtNomMoneda.Focus ();
}

private void txtIDProveedor_KeyPress(object sender, KeyPressEventArgs e)


{
char caracter = e.KeyChar;
TextBox txt = (TextBox) sender;
if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter ==
Convert.ToChar(".")) & (txt.Text.Contains (".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
private void button1_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_Moneda : Frm_Plantilla_1
{
public Frm_Moneda()
{
InitializeComponent ();
}
EBMoneda Moneda = new EBMoneda ();
private void btnGrabar_Click(object sender, EventArgs e)
{
try

Dávila Napa, César Gustavo Pág.: 86


Informe de Prácticas Profesionales
{
Moneda.Codigo = txtCodMoneda.Text;
Moneda.Tipomoneda = txtNomMoneda.Text;
if (txtCodMoneda.Text == "")
{
Moneda.Insertar (Moneda);
MessageBox.Show ("Se agregaron los registros exitosamente",
"Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close ();
}
else
{
Moneda.Insertar (Moneda);
MessageBox.Show ("Se Actualizaron los registros
exitosamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
this.Close ();
}
}
catch (Exception ex)
{
MessageBox.Show ("Error: " + ex.Message, "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void btnCancelar_Click(object sender, EventArgs e)


{
MessageBox.Show ("La Operacion se a Cancelado", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close ();
}
}
}

TRANSACCIÓN COMPRAS

Dávila Napa, César Gustavo Pág.: 87


Informe de Prácticas Profesionales

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
using System.IO;

namespace Pry_Win_SistemaCaf
{
public partial class Frm_Compra1 : Form
{
private CBDetalleCompra DetalleCompra = new CBDetalleCompra();
EBCompra Compra = new EBCompra();
public bool w_nuevo;
public bool w_editar;
string Ruta;
string foto = null;
EBProveedor Proveedor = new EBProveedor();
public Frm_Compra1()
{
InitializeComponent ();
}
private void HabiBot(bool A)
{
btnSalir.Enabled = A;
}
private void HabiCtrl(bool B)
{
btnGrabar.Enabled = B;
btnCancelar.Enabled = B;
}
private void Caja(bool a)
{
txtserie.Enabled = a;
txtNumeroDocumento.Enabled = a;
txtGuiaRem.Enabled = a;

Dávila Napa, César Gustavo Pág.: 88


Informe de Prácticas Profesionales
txtFormaPago.Enabled = a;
txtobservacion.Enabled = a;
dtmFemision.Enabled = a;
dtmFrecepcion.Enabled = a;
dtmFvencimiento.Enabled = a;
btnIngresarDetalle.Enabled = a;
btnProveedor.Enabled = a;
btntipodocumento.Enabled = a;
btnmoneda.Enabled = a;
CmbDocumento.Enabled = a;
CmbMoneda.Enabled = a;
}
private void limpiarcajas()
{
txtIDProveedor.Text = "";
txtproveedor.Text = "";
txtserie.Text = "";
txtNumeroDocumento.Text = "";
CmbDocumento.Text = null;
CmbMoneda.Text = null;
txtRuc.Text = "";
txtGuiaRem.Text = "";
txtFormaPago.Text = "";
txtobservacion.Text = "";
txtSubTotal.Text = "0.00";
txtIgv.Text = "0.00";
txtTotalGeneral.Text = "0.00";
txtDeudaActual.Text = "0.00";
txtPago.Text = "0.00";
txtDeudaPendiente.Text = "0.00";
PCTB_Foto.Image = null;
txtestadocompra.Text = "Pendiente";
}
private double Sumar1(string total, DataGridView Dgv)
{
double total1 = 0;

try
{
for (int i = 0; i <= Dgv.RowCount - 1; i++)
{
total1 = Conversion.Val(total1) +
Conversion.Val(Conversion.Str(Dgv[total.ToLower(), i].Value));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return total1;
}
private double Sumar2(string subTotal, DataGridView Dgv)
{
double total2 = 0;

try
{
for (int i = 0; i <= Dgv.RowCount - 1; i++)
{
total2 = Conversion.Val(total2) +
Conversion.Val(Conversion.Str(Dgv[subTotal.ToLower(), i].Value));
}

Dávila Napa, César Gustavo Pág.: 89


Informe de Prácticas Profesionales
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return total2;
}
private double Sumar3(string igv, DataGridView Dgv)
{
double total3 = 0;
try
{
for (int i = 0; i <= Dgv.RowCount - 1; i++)
{
total3 = Conversion.Val(total3) + Conversion.Val(Conversion.Str(Dgv[igv.ToLower(),
i].Value));
}

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return total3;
}

private void Frm_Compra1_Load(object sender, EventArgs e)


{

txtproveedor.Focus ();
Caja (false);
HabiBot (true);
HabiCtrl (false);
btnNuevo.Focus ();
this.txtDeudaActual.Text = this.txtTotalGeneral.Text;
this.txtDeudaPendiente.Text = this.txtDeudaActual.Text;
this.btnNuevo.Focus ();
Pry_Libreria_SistemaCaf.Entidades. EBMoneda Moneda = new
Pry_Libreria_SistemaCaf.Entidades. EBMoneda ();
CmbMoneda.DataSource = Moneda.Listar ();
CmbMoneda.DisplayMember = "tipomoneda";
CmbMoneda.ValueMember = "codmoneda";
Pry_Libreria_SistemaCaf.Entidades. EBDocumento Documento = new
Pry_Libreria_SistemaCaf.Entidades. EBDocumento ();
CmbDocumento.DataSource = Documento.Listar ();
CmbDocumento.DisplayMember = "tipodocumento";
CmbDocumento.ValueMember = "coddocumento";
EBCompra Compra1 = new EBCompra ();
try
{
Compra1 = Compra1.ConsultarAll(txtCodigoCompras1.Text);
if ((Compra1 != null))
{
txtCodigoCompras1.Text = Compra1.codcompra;
txtIDProveedor.Text = Compra1.codproveedor;
txtserie.Text = Compra1.serie;
txtNumeroDocumento.Text = Compra1.numerodocumento;
CmbDocumento.SelectedValue = Compra1.TIPODOCUMENTO;
txtGuiaRem.Text = Compra1.guiaremision;
txtFormaPago.Text = Compra1.formapago;
CmbMoneda.SelectedValue = Compra1.TIPOMONEDA;
dtmFemision.Text = (Compra1.fechaemision).ToString();

Dávila Napa, César Gustavo Pág.: 90


Informe de Prácticas Profesionales
dtmFrecepcion.Text = (Compra1.fecharecepcion).ToString();
dtmFvencimiento.Text = (Compra1.fechavencimiento).ToString();
txtSubTotal.Text = Convert.ToDouble (Compra1.subtotal).ToString();
txtIgv.Text = Convert.ToDouble (Compra1.igv).ToString();
txtTotalGeneral.Text = Convert.ToDouble (Compra1.totalgeneral).ToString();
txtestadocompra.Text = Compra1.condicion_estado;
txtDeudaActual.Text = Convert.ToDouble (Compra1.deudaactual).ToString();
txtPago.Text = Convert.ToDouble (Compra1.pago).ToString();
txtDeudaPendiente.Text = Convert.ToDouble(Compra1.deudapendiente).ToString();
txtobservacion.Text = Compra1.observacion;
EBDetalleCompra detallecompra = new EBDetalleCompra ();
dgvlistado.DataSource = detallecompra.ListarFiltro (txtCodigoCompras1.Text);
}
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
try
{
Proveedor = Proveedor.ConsultarAll(txtIDProveedor.Text);
if ((Proveedor != null))
{
txtIDProveedor.Text = txtIDProveedor.Text;
txtproveedor.Text = Proveedor.Nombreproveedor;
txtRuc.Text = Proveedor.Ruc;
Ruta = Proveedor.Foto;
foto = Ruta;
if (Ruta == "")
{
foto = "C:\\Users\\Alumno\\Desktop\\Proyecto Original Compras C# & Oracle 21-
10-11\\FOTO SISTEMA\\noexiste.jpg";
}
else
{
PCTB_Foto.Image = Image.FromFile(foto);
PCTB_Foto.SizeMode = PictureBoxSizeMode.StretchImage;
PCTB_Foto.Visible = true;
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void btnNuevo_Click(object sender, EventArgs e)
{
btnNuevo.Enabled = false;
limpiarcajas();
Caja(true);
btnProveedor.Focus();
HabiCtrl(true);
HabiBot(false);
w_nuevo = true;
btnEliminar.Enabled = false;
btnEditar.Enabled = false;
BtnEliminarDetalle.Enabled = true;
}
private void btnGrabar_Click(object sender, EventArgs e)

Dávila Napa, César Gustavo Pág.: 91


Informe de Prácticas Profesionales
{
try
{
Compra.serie = txtserie.Text;
Compra.numerodocumento = txtNumeroDocumento.Text;
Compra.guiaremision = txtGuiaRem.Text;
Compra.fecharecepcion = Convert.ToDateTime(dtmFrecepcion.Text);
Compra.fechaemision = Convert.ToDateTime(dtmFemision.Text);
Compra.fechavencimiento = Convert.ToDateTime(dtmFvencimiento.Text);
Compra.formapago = txtFormaPago.Text;
Compra.subtotal = Convert.ToDouble(txtSubTotal.Text);
Compra.igv = Convert.ToDouble(txtIgv.Text);
Compra.totalgeneral = Convert.ToDouble(txtTotalGeneral.Text);
Compra.observacion = txtobservacion.Text;
Compra.condicion_estado = txtestadocompra.Text;
Compra.deudaactual = Convert.ToDouble(txtDeudaActual.Text);
Compra.pago = Convert.ToDouble(txtPago.Text);
Compra.deudapendiente = Convert.ToDouble(txtDeudaPendiente.Text);
Compra.TIPODOCUMENTO = CmbDocumento.SelectedValue. ToString();
Compra.TIPOMONEDA = CmbMoneda.SelectedValue.ToString();
Compra.codproveedor = txtIDProveedor.Text;
Compra.Usuario = Environment.UserName.ToUpper();
{
if (w_nuevo == true)
{

if (txtobservacion.Text == "") { Compra.observacion = "Sin Observación";


Compra.Insertar(Compra, DetalleCompra); }
else { Compra.Insertar(Compra, DetalleCompra); }
w_nuevo = false;
MessageBox.Show("Se agregaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
Caja(false);
limpiarcajas();
txtCodigoCompras1.Text = "";
HabiCtrl(false);
HabiBot(true);
btnNuevo.Enabled = true;
btnEliminar.Enabled = false;
BtnEliminarDetalle.Enabled = false;
dgvlistado.DataSource = "";
}
else if (w_editar == true)
{
Compra.Insertar(Compra, DetalleCompra);
w_editar = false;
MessageBox.Show("Se Actualizaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
Caja(false);
limpiarcajas();
txtCodigoCompras1.Text = "";
btnGrabar.Enabled = false;
btnEditar.Enabled = false;
btnEliminar.Enabled = false;
btnNuevo.Enabled = false;
btnCancelar.Enabled = false;
BtnEliminarDetalle.Enabled = false;
btnSalir.Enabled = true;
btnSalir.Focus();
dgvlistado.DataSource = "";

Dávila Napa, César Gustavo Pág.: 92


Informe de Prácticas Profesionales
}

}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void btnEditar_Click(object sender, EventArgs e)
{
w_editar = true;
Caja(true);
txtproveedor.Focus();
btnIngresarDetalle.Enabled = false;
btnCancelar.Enabled = true;
btnGrabar.Enabled = true;
btnEditar.Enabled = false;
btnNuevo.Enabled = false;
dgvlistado.Enabled = true;
btnEliminar.Enabled = false;
btnSalir.Enabled = false;
btnProveedor.Focus();

}
private void btnCancelar_Click(object sender, EventArgs e)
{
try
{
if (txtCodigoCompras1.Text == "") {

if (MessageBox.Show("Desea Cancelar La Opracion..?", "Aviso",


MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
MessageBox.Show("La Operacion se a Cancelado...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);

Caja(false);
limpiarcajas();
HabiBot(true);
btnGrabar.Enabled = false;
btnCancelar.Enabled = false;
btnNuevo.Enabled = true;
BtnEliminarDetalle.Enabled = false;
txtCodigoCompras1.Text = "";
btnNuevo.Focus();
}
else
{
MessageBox.Show("Operacion en Proceso...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
btnGrabar.Enabled = true;
btnCancelar.Enabled = true;
btnNuevo.Enabled = false;
btnProveedor.Focus();
}

} else {

Dávila Napa, César Gustavo Pág.: 93


Informe de Prácticas Profesionales
if (MessageBox.Show("Desea Cancelar La Opracion..?", "Aviso",
MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
MessageBox.Show("La Operacion se a Cancelado...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);

Caja(false);
btnEditar.Enabled = true;
btnEliminar.Enabled = true;
btnNuevo.Enabled = false;
btnGrabar.Enabled = false;
btnCancelar.Enabled = false;
btnSalir.Enabled = true;
dgvlistado.Enabled = false;
}
else
{
MessageBox.Show ("Operacion en Proceso...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
btnProveedor.Focus ();
}
}
}
catch (Exception ex)
{
MessageBox.Show (ex.Message);
}

w_nuevo = false;
w_editar = false;
}
private void btnSalir_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnIngresarDetalle_Click(object sender, EventArgs e)
{
Frm_InsertarCompra Form = new Frm_InsertarCompra();
Form.ShowDialog();
EBDetalleCompra Itemdetalle = new EBDetalleCompra();
dgvListado.AutoGenerateColumns = false;
Itemdetalle.Codigo = Form.txtIDProducto.Text;
Itemdetalle.Unidad = Form.txtUnidad.Text;
Itemdetalle.Descripcion = Form.txtDescripcion.Text;
Itemdetalle.Cantidad = Convert.ToDouble(Form.txtCantidad.Text);
Itemdetalle.Precio_sigv = Convert.ToDouble(Form.txtPUSIGV.Text);
Itemdetalle.Precio_cigv = Convert.ToDouble(Form.txtPUCIGV.Text);
Itemdetalle.Valor_venta = Convert.ToDouble(Form.txtvalorVenta.Text);
Itemdetalle.Igv = Convert.ToDouble(Form.txtIgv.Text);
Itemdetalle.Importe = Convert.ToDouble(Form.txtImporte.Text);
Itemdetalle.Observacion = Form.txtobservacion.Text;
dgvlistado.DataSource = null;
DetalleCompra.AgregarItem(Itemdetalle);
dgvlistado.DataSource = DetalleCompra;
dgvlistado.Refresh();
txtTotalGeneral.Text = (Sumar1("Importe", dgvlistado)).ToString();
txtSubTotal.Text = (Sumar2("Valor_Venta", dgvlistado)).ToString();
txtIgv.Text = (Sumar3("IGV", dgvlistado)).ToString();
txtPago.Text = "0.00";
txtDeudaPendiente.Text = "0.00";
this.txtDeudaActual.Text = this.txtTotalGeneral.Text;
Form.btnProducto.Focus();

Dávila Napa, César Gustavo Pág.: 94


Informe de Prácticas Profesionales
}
private void txtserie_KeyPress(object sender, KeyPressEventArgs e)
{
if (! Char.IsNumber(e.KeyChar) )
{
e.Handled = true;
}
if (((e.KeyChar)) == 13)
{
try
{
txtserie.Text = long.Parse(txtserie.Text).ToString("0000");
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
txtNumeroDocumento.Focus();
}
}
private void txtNumeroDocumento_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsNumber(e.KeyChar))
{
e.Handled = true;
}

if (((e.KeyChar)) == 13)
{
try
{
txtNumeroDocumento.Text =
long.Parse(txtNumeroDocumento.Text).ToString("0000000000");
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
CmbDocumento.Focus();
}
}
private void txtGuiaRem_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{
txtGuiaRem.Text = txtGuiaRem.Text.ToString();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
txtFormaPago.Focus();
}
}
private void txtFormaPago_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{

Dávila Napa, César Gustavo Pág.: 95


Informe de Prácticas Profesionales
txtFormaPago.Text = txtFormaPago.Text.ToString();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
CmbMoneda.Focus();
}
}
private void btnProveedor_Click(object sender, EventArgs e)
{
Frm_ListarProveedor ObjBuscar = new Frm_ListarProveedor();
try
{
if (ObjBuscar.ShowDialog() == DialogResult.OK)
{
txtIDProveedor.Text =
ObjBuscar.dgvListado.Rows[ObjBuscar.dgvListado.CurrentCell.RowIndex].Cells[0].Value.ToStri
ng();
Proveedor = Proveedor.ConsultarAll(txtIDProveedor.Text);
if ((Proveedor != null))
{
txtIDProveedor.Text = txtIDProveedor.Text;
txtproveedor.Text = Proveedor.Nombreproveedor;
txtRuc.Text = Proveedor.Ruc;
Ruta = Proveedor.Foto;
foto = Ruta;
if (Ruta == "")
{
foto = "C:\\Users\\Alumno\\Desktop\\Proyecto Original Compras C# &
Oracle\\FOTO SISTEMA\\noexiste.jpg";
}
else
{
PCTB_Foto.Image = Image.FromFile(foto);
PCTB_Foto.SizeMode = PictureBoxSizeMode.StretchImage;
PCTB_Foto.Visible = true;
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
txtserie.Focus();
}
private void btntipodocumento_Click(object sender, EventArgs e)
{
Frm_ListarDocumento documento = new Frm_ListarDocumento();
EBDocumento documento2 = new EBDocumento();
if (documento.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
CmbDocumento.DataSource = documento2.Listar();
}
txtGuiaRem.Focus();
}
private void btnmoneda_Click(object sender, EventArgs e)
{
Frm_ListarMoneda moneda = new Frm_ListarMoneda();
EBMoneda moneda2 = new EBMoneda();

Dávila Napa, César Gustavo Pág.: 96


Informe de Prácticas Profesionales
if (moneda.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
CmbMoneda.DataSource = moneda2.Listar();
}
dtmFemision.Focus();
}
private void btnEliminar_Click(object sender, EventArgs e)
{
try
{
if (MessageBox.Show("Desea Anular este registro..?", "Aviso",
MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{
EBCompra compra = new EBCompra();
compra.codcompra = txtCodigoCompras1.Text;
compra.Usuario = Environment.UserName.ToUpper();
compra.Eliminar(compra);
EBDetalleCompra detalle = new EBDetalleCompra();
detalle.Codigo = txtCodigoCompras1.Text;
detalle.Usuario = Environment.UserName.ToUpper();
detalle.Eliminar(detalle);
MessageBox.Show("Se Anular con éxito el registro...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
limpiarcajas(); txtCodigoCompras1.Text = ""; btnGrabar.Enabled = false;
btnEliminar.Enabled = false;
btnSalir.Enabled = true; btnEditar.Enabled = false; dgvlistado.DataSource = "";
}
else
{
MessageBox.Show("Proceso de Anulación Cancelado...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
private void dtmFemision_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{
dtmFemision .Text = dtmFemision .Text.ToString();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
dtmFrecepcion .Focus();
}
}
private void dtmFrecepcion_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{
dtmFrecepcion .Text = dtmFrecepcion .Text.ToString();
}

Dávila Napa, César Gustavo Pág.: 97


Informe de Prácticas Profesionales
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
dtmFvencimiento.Focus();
}
}
private void dtmFvencimiento_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{
dtmFvencimiento.Text = dtmFvencimiento .Text.ToString();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
btnIngresarDetalle.Focus();
}
}
private void CmbDocumento_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{
CmbDocumento.Text = CmbDocumento.Text.ToString();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
txtGuiaRem.Focus();
}

}
private void CmbMoneda_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{
CmbMoneda.Text = CmbMoneda.Text.ToString();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
dtmFemision.Focus();
}

}
private void BtnEliminarDetalle_Click(object sender, EventArgs e)
{
try
{

if (MessageBox.Show("Desea Eliminar Detalle Compra...?", "Aviso",


MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
{

Dávila Napa, César Gustavo Pág.: 98


Informe de Prácticas Profesionales
if (dgvlistado.Rows.Count > 0)
{
EBDetalleCompra ItemEliminar =
(EBDetalleCompra)dgvlistado.CurrentRow.DataBoundItem;
dgvlistado.DataSource = null;
DetalleCompra.EliminarItem(ItemEliminar);
dgvlistado.DataSource = DetalleCompra;
txtTotalGeneral.Text = (Sumar1("Importe", dgvlistado)).ToString();
txtSubTotal.Text = (Sumar2("Valor_Venta", dgvlistado)).ToString();
txtIgv.Text = (Sumar3("IGV", dgvlistado)).ToString();
txtPago.Text = "0.00";
txtDeudaPendiente.Text = "0.00";
this.txtDeudaActual.Text = this.txtTotalGeneral.Text;
}
MessageBox.Show("Se Elimino Detalle Compra..!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Proceso de Eliminacion Detalle Cancelado...!", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

private void btnAgregarAlmacen_Click(object sender, EventArgs e)


{
Frm_ReporteVendedor f = new Frm_ReporteVendedor();
f.EBDetalleCompraBindingSource.DataSource = dgvlistado.DataSource;

f.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
f.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth;
f.reportViewer1.RefreshReport();
f.MdiParent = this.MdiParent;
f.Show();
}
}
}

BUSCAR COMPRAS REGISTRADAS

Dávila Napa, César Gustavo Pág.: 99


Informe de Prácticas Profesionales

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_Lista_ComprasRegistradas : Form
{
EBCompra Compra1 = new EBCompra();

private double Sumar1(string total, DataGridView Dgv)


{
double total1 = 0;
try
{
for (int i = 0; i <= Dgv.RowCount - 1; i++)
{
total1 = Conversion.Val (total1) + Conversion.Val(
Conversion.Str(Dgv[total.ToLower(), i].Value));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return total1;
}
private double Sumar2(string subTotal, DataGridView Dgv)
{
double total2 = 0;

try
{
for (int i = 0; i <= Dgv.RowCount - 1; i++)
{

Dávila Napa, César Gustavo Pág.: 100


Informe de Prácticas Profesionales
total2 = Conversion.Val(total2) + Conversion.Val(
Conversion.Str(Dgv[subTotal.ToLower(), i].Value));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return total2;
}
private double Sumar3(string igv, DataGridView Dgv)
{
double total3 = 0;
try
{
for (int i = 0; i <= Dgv.RowCount - 1; i++)
{
total3 = Conversion.Val(total3) +
Conversion.Val(Conversion.Str(Dgv[igv.ToLower(), i].Value));
}

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return total3;
}
public Frm_Lista_ComprasRegistradas()
{
InitializeComponent();
}
private void Frm_Lista_ComprasRegistradas_Load(object sender, EventArgs
e)
{
EBCompra Compra = new EBCompra();
dgvlistado.DataSource = Compra.Listar();
Pry_Libreria_SistemaCaf.Entidades. EBMoneda Moneda = new
Pry_Libreria_SistemaCaf.Entidades. EBMoneda();
CmbMoneda.DataSource = Moneda.Listar();
CmbMoneda.DisplayMember = "tipomoneda";
CmbMoneda.ValueMember = "codmoneda";
Pry_Libreria_SistemaCaf.Entidades. EBDocumento Documento = new
Pry_Libreria_SistemaCaf.Entidades. EBDocumento();
CmbDocumento.DataSource = Documento.Listar();
CmbDocumento.DisplayMember = "tipodocumento";
CmbDocumento.ValueMember = "coddocumento";
this.dgvlistado.DefaultCellStyle.SelectionForeColor = Color.Yellow;
this.dgvlistado.DefaultCellStyle.SelectionBackColor = Color.Black;
this.dgvlistado.DefaultCellStyle.ForeColor = Color.Blue;
this.dgvlistado.DefaultCellStyle.BackColor = Color.Beige;
txtSubTotal.Text = (Sumar1("subtotal", dgvlistado)).ToString();
txtTotalIgv.Text = (Sumar2("igv", dgvlistado)).ToString();
txtTotal.Text = (Sumar3("totalgeneral", dgvlistado)).ToString();
dgvlistado.Columns[08].DefaultCellStyle.BackColor = Color.AliceBlue;
dgvlistado.Columns[09].DefaultCellStyle.BackColor = Color.MistyRose;
dgvlistado.Columns[10].DefaultCellStyle.BackColor = Color.Thistle;
CmbDocumento.SelectedValue = "";
CmbMoneda.SelectedValue = "";
}

private void dgvlistado_CellDoubleClick(object sender,


DataGridViewCellEventArgs e)
{

Dávila Napa, César Gustavo Pág.: 101


Informe de Prácticas Profesionales
this.Hide();
Frm_Compra1 Form = new Frm_Compra1();
Form.txtCodigoCompras1.Text =
dgvlistado.Rows[dgvlistado.CurrentCell.RowIndex].Cells[0].Value.ToString();
Form.txtIDProveedor.Text =
dgvlistado.Rows[dgvlistado.CurrentCell.RowIndex].Cells[1].Value.ToString();
if (Form.txtestadocompra.Text == "Cancelado")
{
Form.txtestadocompra.BackColor = Color.Green;
Form.dgvlistado.Enabled = false;
Form.btnNuevo.Enabled = false;
Form.btnEliminar.Enabled = false;
Form.btnEditar.Enabled = false;
Form.btnAgregarAlmacen.Enabled = true;
}
else
{
Form.dgvlistado.Enabled = false;
Form.btnNuevo.Enabled = false;
Form.btnEliminar.Enabled = true;
Form.btnEditar.Enabled = true;
Form.btnAgregarAlmacen.Enabled = true;
}

Form.MdiParent = this.MdiParent;
Form.Show ();
}

private void btnSalir_Click(object sender, EventArgs e)


{
Close();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
dgvlistado.AutoGenerateColumns = false;
Compra1.codproveedor = txtCodproveedor.Text;
Compra1.NOMBREPROVEEDOR = txtProveedor.Text;
Compra1.ruc = txtRuc.Text;
Compra1.TIPODOCUMENTO = CmbDocumento.Text;
Compra1.TIPOMONEDA = CmbMoneda.Text;
Compra1.numerodocumento = txtNumeroDocumento.Text;
Compra1.fecharecepcion = Convert.ToDateTime(FechaInicio.Text);
CBCompras Consultar = new CBCompras(Compra1);
dgvlistado.DataSource = Consultar;
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}

txtSubTotal.Text = (Sumar1("subtotal", dgvlistado)).ToString();


txtTotalIgv.Text = (Sumar2("igv", dgvlistado)).ToString();
txtTotal.Text = (Sumar3("totalgeneral", dgvlistado)).ToString();
}
private void txtProveedor_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{
txtProveedor.Text = txtProveedor.Text.ToString();

Dávila Napa, César Gustavo Pág.: 102


Informe de Prácticas Profesionales
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
txtNumeroDocumento .Focus();
}
}

private void txtNumeroDocumento_KeyPress(object sender, KeyPressEventArgs


e)
{
if (((e.KeyChar)) == 13)
{
try
{
txtNumeroDocumento.Text = txtNumeroDocumento.Text.
ToString();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
btnVer.Focus();
}
}

}
}
REGISTRÓ DETALLE COMPRA

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

Dávila Napa, César Gustavo Pág.: 103


Informe de Prácticas Profesionales
using Pry_Libreria_SistemaCaf.Colecciones;
using Pry_Libreria_SistemaCaf.Entidades;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_InsertarCompra : Form
{
private EBDetalleCompra vdetallec = new EBDetalleCompra();
public EBDetalleCompra detallec
{
get { return vdetallec; }
set { vdetallec = value; }
}
public Frm_InsertarCompra()
{
InitializeComponent();
}

private void btnLimpiar_Click(object sender, EventArgs e)


{
txtDescripcion.Focus();
limpiarcajas();
}
private void txtvalorVenta_KeyPress(object sender, KeyPressEventArgs e)
{
double x = 0;
double y = 0;
char caracter = e.KeyChar;
TextBox txt = (TextBox)sender;
if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter ==
Convert.ToChar(".")) & (txt.Text.Contains(".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
x = Conversion.Val(txtCantidad.Text);
y = Conversion.Val(txtvalorVenta.Text);

if ((Strings.Asc(e.KeyChar)) == 13)
{
txtPUSIGV.Text = Strings.Format(Conversion.Val(y / x), "0.00");

if (txtvalorVenta.Text == "")
{
txtImporte.Text = "";
txtIgv.Text = "0.00";
}
txtIgv.Text = Strings.Format(Conversion.Val(Conversion.Val(txtvalorVenta.Text) *
0.18), "0.00");
txtImporte.Text = Strings.Format(Conversion.Val(txtvalorVenta.Text) +
Conversion.Val(txtIgv.Text), "0.00");
txtPUCIGV.Text = Strings.Format(Conversion.Val(Conversion.Val(txtImporte.Text) / x),
"0.00");
if (txtCantidad.Text == "0.00") { txtPUSIGV.Text = "0.00"; txtPUCIGV.Text = "0.00";
txtCantidad.Text = "0.00"; txtvalorVenta.Text = "0.00"; }
txtImporte.Focus();
}
}

Dávila Napa, César Gustavo Pág.: 104


Informe de Prácticas Profesionales
private void txtImporte_KeyPress(object sender, KeyPressEventArgs e)
{
double x = 0;
double y = 0;
char caracter = e.KeyChar;
TextBox txt = (TextBox)sender;
if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter ==
Convert.ToChar(".")) & (txt.Text.Contains(".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
x = Conversion.Val(txtCantidad.Text);
y = Conversion.Val(txtImporte.Text);

if ((Strings.Asc(e.KeyChar)) == 13)
{
txtvalorVenta.Text = Strings.Format(Conversion.Val(Conversion.Val(txtImporte.Text) /
1.18), "0.00");
txtPUSIGV.Text = Strings.Format(Conversion.Val(Conversion.Val(txtvalorVenta.Text) /
x), "0.00");
txtPUCIGV.Text = Strings.Format(Conversion.Val(Conversion.Val(txtImporte.Text) / x),
"0.00");
txtIgv.Text = Strings.Format(Conversion.Val(Conversion.Val(txtvalorVenta.Text) *
0.18), "0.00");
if (txtCantidad.Text == "0.00") { txtPUSIGV.Text = "0.00"; txtPUCIGV.Text = "0.00";
txtCantidad.Text = "0.00"; }
btnAgregarRecibo.Focus();
}
}

private void txtCantidad_KeyPress(object sender, KeyPressEventArgs e)


{
char caracter = e.KeyChar;
TextBox txt = (TextBox)sender;

if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter ==
Convert.ToChar(".")) & (txt.Text.Contains(".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}

if ((Strings.Asc(e.KeyChar)) == 13)
{
txtvalorVenta.Focus();
}
}
private void limpiarcajas()
{
txtUnidad.Text = "";
txtDescripcion.Text = "";
txtobservacion.Text = "";
txtCantidad.Text = "0.00";

Dávila Napa, César Gustavo Pág.: 105


Informe de Prácticas Profesionales
txtPUSIGV.Text = "0.00";
txtPUCIGV.Text = "0.00";
txtvalorVenta.Text = "0.00";
txtIgv.Text = "0.00";
txtImporte.Text = "0.00";
}
private void btnAgregarRecibo_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(txtIDProducto.Text)) throw new Exception("Codigo Detalle
Compra No Ingresado");
if (string.IsNullOrEmpty(txtDescripcion.Text)) throw new Exception("Descripcion No
Ingresado");
if (string.IsNullOrEmpty(txtCantidad.Text)) throw new Exception("Cantidad No
Ingresado");
if (string.IsNullOrEmpty(txtvalorVenta.Text)) throw new Exception("Valor Venta No
Ingresado");
if (string.IsNullOrEmpty(txtImporte.Text)) throw new Exception("Importe No
Ingresado");
{
if (this.ActiveControl is TextBox)
{
this.detallec = (EBDetalleCompra)
((DataGridView)this.ActiveControl).CurrentRow.DataBoundItem;
}
MessageBox.Show("Se agregaron los registros exitosamente", "Aviso",
MessageBoxButtons.OK, MessageBoxIcon.Information);
btnLimpiar.Enabled = false;
}
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
this.Close();
}
private void btnSalir_Click(object sender, EventArgs e)
{
Close();
}
private void txtobservacion_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar)) == 13)
{
try
{
txtobservacion.Text = txtobservacion.Text. ToString();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
txtCantidad.Enabled = true;
txtvalorVenta.Enabled = true;
txtImporte.Enabled = true;
txtCantidad.Focus();
}
}
private void CbControlarIGV_CheckedChanged(object sender, EventArgs e)
{

Dávila Napa, César Gustavo Pág.: 106


Informe de Prácticas Profesionales
if (CbControlarIGV.Checked == true)
{
if (txtPUSIGV.Text == "0.00" && txtPUCIGV.Text == "0.00") { txtPUCIGV.Text = "0.00";
txtPUSIGV.Text = "0.00"; }
else
{
txtIgv.Text = ("0.00");
txtImporte.Text = Strings.Format(Conversion.Val(txtvalorVenta.Text) +
Conversion.Val(txtIgv.Text), "0.00");
txtPUCIGV.Text = Strings.Format(Conversion.Val(Conversion.Val(txtImporte.Text) /
Conversion.Val(txtCantidad.Text)), "0.00");
txtPUSIGV.Text =
Strings.Format(Conversion.Val(Conversion.Val(txtvalorVenta.Text) /
Conversion.Val(txtCantidad.Text)), "0.00");
}
}
else if (CbControlarIGV.Checked == false)
{
if (txtPUSIGV.Text == "0.00" && txtPUCIGV.Text == "0.00") { txtPUCIGV.Text = "0.00";
txtPUSIGV.Text = "0.00"; }
else
{
txtPUSIGV.Text =
Strings.Format(Conversion.Val(Conversion.Val(txtvalorVenta.Text) /
Conversion.Val(txtCantidad.Text)), "0.00");
txtIgv.Text = Strings.Format(Conversion.Val(Conversion.Val(txtvalorVenta.Text) *
0.18), "0.00");
txtImporte.Text = Strings.Format(Conversion.Val(txtvalorVenta.Text) +
Conversion.Val(txtIgv.Text), "0.00");
txtPUCIGV.Text = Strings.Format(Conversion.Val(Conversion.Val(txtImporte.Text) /
Conversion.Val(txtCantidad.Text)), "0.00");
}
}
}

private void txtTHonorarios_KeyPress(object sender, KeyPressEventArgs e)


{
double x = 0;
double y = 0;
char caracter = e.KeyChar;
TextBox txt = (TextBox)sender;
if ((char.IsNumber(caracter)) | (caracter ==
Convert.ToChar(Strings.ChrW(Convert.ToInt32(Keys.Back)))) | (caracter ==
Convert.ToChar(".")) & (txt.Text.Contains(".") == false))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}

private void btnProducto_Click(object sender, EventArgs e)


{
EBProducto Producto = new EBProducto();
Frm_Listar_Producto ObjBuscar = new Frm_Listar_Producto();
try
{
if (ObjBuscar.ShowDialog() == DialogResult.OK)
{

Dávila Napa, César Gustavo Pág.: 107


Informe de Prácticas Profesionales
txtIDProducto.Text =
ObjBuscar.dgvListado.Rows[ObjBuscar.dgvListado.CurrentCell.RowIndex].Cells[0].Value.ToStri
ng();
Producto = Producto.ConsultarAll(txtIDProducto.Text);
if ((Producto != null))
{
txtIDProducto.Text = txtIDProducto.Text;
txtDescripcion.Text = Producto.Nombreprooducto;
txtUnidad.Text = Producto.Unidad;
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message, "Aviso", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
txtobservacion.Focus();
}
private void GroupBox2_Enter(object sender, EventArgs e)
{
btnProducto.Focus();
}
}
}

BUSQUEDA Y CONSULTA DE COMPRAS REGISTRADAS

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf.Colecciones;
namespace Pry_Win_SistemaCaf
{
public partial class Frm_Compra_ReporteGeneral : Form

Dávila Napa, César Gustavo Pág.: 108


Informe de Prácticas Profesionales
{
private string FecInicial;
private string FecFinal;
private DataTable _datos = new DataTable();
public Frm_Compra_ReporteGeneral()
{
InitializeComponent();
}

private void Frm_Compra_ReporteGeneral_Load(object sender, EventArgs e)


{
EBDocumento Documento = new EBDocumento();
CmbDocumento.DataSource = Documento.Listar();
CmbDocumento.DisplayMember = "tipodocumento";
CmbDocumento.ValueMember = "coddocumento";
DGVLista.AlternatingRowsDefaultCellStyle.BackColor = Color.FloralWhite;
DGVLista.DefaultCellStyle.BackColor = Color.Beige;
CmbDocumento.Enabled = false;
CmbDocumento.SelectedValue = "";
}
private void RbtDocDoc_CheckedChanged(object sender, EventArgs e)
{
if (RbtDocDoc.Checked == true)
{
CmbDocumento.Enabled = true;
}
else { CmbDocumento.Enabled = false; CmbDocumento.SelectedValue = ""; }
}

private void btnVisualizaRecep_Click(object sender, EventArgs e)


{
FecInicial = DTPInicio1.Text;
FecFinal = DTPFinal1.Text;
EBCompra Compra = new EBCompra();
_datos = Compra.ListarFiltrosFecharecepcion(DateTime.Parse(FecInicial),
DateTime.Parse(FecFinal), CmbDocumento.Text,cmbEstado.Text,
txtproveedor.Text);
DGVLista.DataSource = _datos;
txtproveedor.Enabled = true;
}

private void visualizaremision_Click(object sender, EventArgs e)


{
FecInicial = DTPInicio.Text;
FecFinal = DTPFinal.Text;
EBCompra Compra = new EBCompra();
_datos = Compra.ListarFiltrosFechaCompra(DateTime.Parse(FecInicial),
DateTime.Parse(FecFinal), CmbDocumento.Text,cmbEstado.Text
,txtproveedor.Text);
DGVLista.DataSource = _datos;
txtproveedor.Enabled = true;
}
private void BtnSalir_Click(object sender, EventArgs e)
{
Close();
}
private void RbtEstado_CheckedChanged(object sender, EventArgs e)
{
if (RbtEstado.Checked == true)
{
cmbEstado.Enabled = true;
}
else { cmbEstado.Enabled = false; cmbEstado.Text = null; }
}

Dávila Napa, César Gustavo Pág.: 109


Informe de Prácticas Profesionales
}

ENTIDADES / COLECCIONES

ENTIDADES

PROVEEDORES

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;
using Pry_Libreria_SistemaCaf;

namespace Pry_Libreria_SistemaCaf.Entidades
{
public class EBProveedor
{

string Conexion = "Data Source=xe;Persist Security Info=True;User


ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";

string pcodproveedor = "";


string pnombreproveedor = "";
string pdireccion = "";
string pruc = "";
string ptelefono = "";
string pobservacion = "";
string pcodtipoproveedor = "";
string pfoto = "";
string vusuario = "";
string vEstacion = "";

#region Propiedades

public string Codigo


{
get { return string.IsNullOrEmpty(pcodproveedor) ? "" : pcodproveedor.Trim(); }
set { pcodproveedor = value; }
}

public string Nombreproveedor


{
get { return pnombreproveedor; }
set { pnombreproveedor = value; }
}

public string Direccion


{
get { return pdireccion; }
set { pdireccion = value; }
}

public string Ruc


{
get { return pruc; }
set { pruc = value; }
}

Dávila Napa, César Gustavo Pág.: 110


Informe de Prácticas Profesionales
public string Telefono
{
get { return ptelefono; }
set { ptelefono = value; }
}

public string Observacion


{
get { return pobservacion; }
set { pobservacion = value; }
}

public string Codtipoproveedor


{
get { return pcodtipoproveedor; }
set { pcodtipoproveedor = value; }
}

public string Foto


{
get { return pfoto; }
set { pfoto = value; }
}

public string Usuario


{
get { return vusuario; }
set { vusuario = value; }
}

public string Estacion


{
get { return vEstacion; }
set { vEstacion = value; }
}

#endregion

#region Metodos
public void Insertar(EBProveedor Proveedor)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);

Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.SETPROVEEDORES",
Proveedor.Codigo,
Proveedor.Nombreproveedor,
Proveedor.Direccion,
Proveedor.Ruc,
Proveedor.Telefono,
Proveedor.Observacion,
Proveedor.Codtipoproveedor,
Proveedor.Foto,
Proveedor.Usuario,
Proveedor.Estacion
);
}
#endregion

#region Metodos

public EBProveedor ConsultarAll(string codigo)


{
DBConexionOracle.DBConexionOracle db = new
DBConexionOracle.DBConexionOracle();
DataSet ds = new DataSet();

Dávila Napa, César Gustavo Pág.: 111


Informe de Prácticas Profesionales
OracleParameter p = new OracleParameter("pCursor", OracleType.Cursor); p.Direction =
ParameterDirection.Output;
db.AddParameter(p); db.AddParameter("pcodproveedor", codigo);
OracleDataReader dr =
(OracleDataReader)db.ExecuteReader("SYSTEMCOMPRASGENERAL.GETPROVEEDORES_1");
if (dr.HasRows)
{

EBProveedor ObjProveedores = new EBProveedor();


while (dr.Read())
{
ObjProveedores.Codigo = dr.GetString(dr.GetOrdinal("codproveedor"));
ObjProveedores.Nombreproveedor =
dr.GetString(dr.GetOrdinal("nombreproveedor"));
ObjProveedores.Direccion = dr.GetString(dr.GetOrdinal("direccion"));
ObjProveedores.Ruc = dr.GetString(dr.GetOrdinal("ruc"));
ObjProveedores.Telefono = dr.GetString(dr.GetOrdinal("telefono"));
ObjProveedores.Observacion = dr.GetString(dr.GetOrdinal("observacion"));
ObjProveedores.Codtipoproveedor =
dr.GetString(dr.GetOrdinal("CODTIPOPROVEEDOR"));
ObjProveedores.Foto = dr.GetString(dr.GetOrdinal("FOTO"));
}
dr.Close();
return ObjProveedores;

}
else
{
dr.Close();
return new EBProveedor();
}
}
#endregion

#region Metodos
public void Eliminar(EBProveedor Proveedor)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.DELPROVEEDORES",
Proveedor.Codigo,Proveedor.Usuario,Proveedor.Estacion);
}
#endregion

#region Metodos
public DataTable ListarGenerar()
{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETPROVEEDORES_GENERAL",
"");
return dstresultado.Tables[0];
}
#endregion

#region Metodos
public DataTable ListarGeneraR_TipoProveedor(string codTipoProveedor)
{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMGENERAL.GETPROVEEDORES_GENERALTIPOPRO",
codTipoProveedor, "");
return dstresultado.Tables[0];
}
#endregion

Dávila Napa, César Gustavo Pág.: 112


Informe de Prácticas Profesionales

}
}

PRODUCTO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;
using System.Data.OracleClient;
using Pry_Libreria_SistemaCaf;
using DBConexionOracle;
namespace Pry_Libreria_SistemaCaf.Entidades
{
public class EBProducto
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";

string pcodproducto ="";


string pnombreprooducto="";
string punidad = "";
string pobservacion ="";
string pcodcategoria ="";
string pusuario ="";
string pestacion ="";

#region Propiedades

public string Codigo


{
get { return string.IsNullOrEmpty(pcodproducto) ? "" : pcodproducto.Trim(); }
set { pcodproducto = value; }
}

public string Nombreprooducto


{
get { return pnombreprooducto; }
set { pnombreprooducto = value; }
}

public string Unidad


{
get { return punidad; }
set { punidad = value; }
}

public string Observacion


{
get { return pobservacion; }
set { pobservacion = value; }
}

public string Codcategoria


{
get { return pcodcategoria; }
set { pcodcategoria = value; }

Dávila Napa, César Gustavo Pág.: 113


Informe de Prácticas Profesionales
}

public string Usuario


{
get { return pusuario; }
set { pusuario = value; }
}

public string Estacion


{
get { return pestacion; }
set { pestacion = value; }
}

#endregion

#region Metodos
public void Insertar(EBProducto Producto)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.SETPRODUCTO", Producto.Codigo,
Producto.Nombreprooducto,
Producto.Unidad,
Producto.Observacion,
Producto.Codcategoria,
Producto.Usuario,
Producto.Estacion);
}
#endregion
#region Metodos
public EBProducto ConsultarAll(string codigo)
{
DBConexionOracle.DBConexionOracle db = new DBConexionOracle.DBConexionOracle();
DataSet ds = new DataSet();
OracleParameter p = new OracleParameter("pCursor", OracleType.Cursor); p.Direction =
ParameterDirection.Output;
db.AddParameter(p); db.AddParameter("pcodproducto", codigo);
OracleDataReader dr =
(OracleDataReader)db.ExecuteReader("SYSTEMCOMPRASGENERAL.GETPRODUCTO_1");
if (dr.HasRows)
{
EBProducto ObjProducto = new EBProducto();
while (dr.Read())
{
ObjProducto.Codigo = dr.GetString(dr.GetOrdinal("codproducto"));
ObjProducto.Nombreprooducto = dr.GetString(dr.GetOrdinal("nombreprooducto"));
ObjProducto.Unidad = dr.GetString(dr.GetOrdinal("unidad"));
ObjProducto.Observacion = dr.GetString(dr.GetOrdinal("observacion"));
ObjProducto.Codcategoria = dr.GetString(dr.GetOrdinal("CODCATEGORIA"));
}
dr.Close();
return ObjProducto;
}
else
{
dr.Close();
return new EBProducto();
}
}
#endregion
#region Metodos
public void Eliminar(EBProducto Producto)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);

Dávila Napa, César Gustavo Pág.: 114


Informe de Prácticas Profesionales
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.DELPRODUCTO", Producto.Codigo,
Producto.Usuario, Producto.Estacion);
}
#endregion

#region Metodos
public DataTable Listar()
{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETPRODUCTO_1", "");
return dstresultado.Tables[0];
}
#endregion

}
}

DOCUMENTO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;
using System.Data.OracleClient;
using Pry_Libreria_SistemaCaf;
using DBConexionOracle;
namespace Pry_Libreria_SistemaCaf.Entidades
{
public class EBDocumento
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
string pcoddocumento = "";
string ptipodocumento = "";
#region Propiedades

public string Codigo


{
get { return string.IsNullOrEmpty(pcoddocumento) ? "" : pcoddocumento.Trim(); }
set { pcoddocumento = value; }
}

public string Tipodocumento


{
get { return ptipodocumento; }
set { ptipodocumento = value; }
}
#endregion
#region Metodo
public void Insertar(EBDocumento Documento)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.SETTIPODOCUMENTO",
Documento.Codigo,
Documento.Tipodocumento);
}
#endregion

Dávila Napa, César Gustavo Pág.: 115


Informe de Prácticas Profesionales
#region Metodos
public void Eliminar(EBDocumento Documento)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.DELTIPODOCUMENTO",
Documento.Codigo);
}
#endregion
public DataTable Listar()
{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETTIPODOCUMENTO_1", "");
return dstresultado.Tables[0];
}
}
}

CATEGORIA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;
using System.Data.OracleClient;
using Pry_Libreria_SistemaCaf;
using DBConexionOracle;
namespace Pry_Libreria_SistemaCaf.Entidades
{
public class EBCategoria
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
string pcodcategoria = "";
string pnombrecategoria = "";
string vusuario = "";
string vEstacion = "";
#region Propiedades

public string Codigo


{
get { return string.IsNullOrEmpty(pcodcategoria) ? "" : pcodcategoria.Trim(); }
set { pcodcategoria = value; }
}

public string Nombrecategoria


{
get { return pnombrecategoria; }
set { pnombrecategoria = value; }
}

public string Usuario


{
get { return vusuario; }
set { vusuario = value; }
}

public string Estacion


{

Dávila Napa, César Gustavo Pág.: 116


Informe de Prácticas Profesionales
get { return vEstacion; }
set { vEstacion = value; }
}
#endregion
#region Metodo
public void Insertar(EBCategoria Categoria)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.SETCATEGORIA",
Categoria.Codigo,
Categoria.Nombrecategoria,
Categoria.Usuario,
Categoria.Estacion);
}
#endregion
#region Metodos
public void Eliminar(EBCategoria Categoria)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.DELCATEGORIA",
Categoria.Codigo, Categoria.Usuario, Categoria.Estacion);
}
#endregion

#region Metodos
public DataTable Listar()
{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETCATEGORIAACTIVO", "");
return dstresultado.Tables[0];
}
#endregion

}
}

MONEDA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;
using System.Data.OracleClient;
using Pry_Libreria_SistemaCaf;
using DBConexionOracle;
namespace Pry_Libreria_SistemaCaf.Entidades
{
public class EBMoneda
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
string pcodmoneda = "";
string ptipomoneda = "";
#region Propiedades

public string Codigo


{
get { return string.IsNullOrEmpty(pcodmoneda) ? "" : pcodmoneda.Trim(); }

Dávila Napa, César Gustavo Pág.: 117


Informe de Prácticas Profesionales
set { pcodmoneda = value; }
}

public string Tipomoneda


{
get { return ptipomoneda; }
set { ptipomoneda = value; }
}

#endregion
#region Metodo
public void Insertar(EBMoneda Moneda)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.SETMONEDA", Moneda.Codigo,
Moneda.Tipomoneda
);
}
#endregion
#region Metodos
public void Eliminar(EBMoneda Moneda)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
Execute.EjecutaStoreOut("SYSTEMCOMPRASGENERAL.DELMONEDA", Moneda.Codigo);
}
#endregion
public DataTable Listar()
{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETMONEDA_1", "");
return dstresultado.Tables[0];
}
}
}

TRANSACCIÓN COMPRAS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;
using System.Data.OracleClient;
using Pry_Libreria_SistemaCaf;
using DBConexionOracle;
namespace Pry_Libreria_SistemaCaf.Entidades
{
public class EBCompra
{

string Conexion = "Data Source=xe;Persist Security Info=True;User


ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
string pcodcompra = "";
string pserie = "";
string pRUC = "";
string pNOMBREPROVEEDOR = "";
string pnumerodocumento = "";
string pguiaremision = "";
Nullable<DateTime> pfecharecepcion ;

Dávila Napa, César Gustavo Pág.: 118


Informe de Prácticas Profesionales
Nullable<DateTime> pfechaemision ;
Nullable<DateTime> pfechavencimiento;
string pformapago = "";
double psubtotal = 0;
double pigv = 0;
double ptotalgeneral = 0;
string pobservacion = "";
string pcondicion_estado= "";
double pdeudaactual = 0;
double ppago = 0;
double pdeudapendiente = 0;
string pTIPODOCUMENTO = "";
string pTIPOMONEDA = "";
string pcodproveedor = "";
string pusuario = "";
string pestacion = "";
#region Propiedades
public string codcompra
{
get { return pcodcompra; }
set { pcodcompra = value; }
}
public string serie
{
get { return pserie; }
set { pserie = value; }
}

public string ruc


{
get { return pRUC; }
set { pRUC = value; }
}

public string NOMBREPROVEEDOR


{
get { return pNOMBREPROVEEDOR; }
set { pNOMBREPROVEEDOR = value; }
}

public string numerodocumento


{
get { return pnumerodocumento; }
set { pnumerodocumento = value; }
}
public string guiaremision
{
get { return pguiaremision; }
set { pguiaremision = value; }
}
public Nullable<DateTime> fecharecepcion
{
get { return pfecharecepcion; }
set { pfecharecepcion = value; }
}
public Nullable<DateTime> fechaemision
{
get { return pfechaemision; }
set { pfechaemision = value; }
}
public Nullable<DateTime> fechavencimiento
{
get { return pfechavencimiento; }
set { pfechavencimiento = value; }
}
public string formapago

Dávila Napa, César Gustavo Pág.: 119


Informe de Prácticas Profesionales
{
get { return pformapago; }
set { pformapago = value; }
}
public double subtotal
{
get { return psubtotal; }
set { psubtotal = value; }
}
public double igv
{
get { return pigv; }
set { pigv = value; }
}
public double totalgeneral
{
get { return ptotalgeneral; }
set { ptotalgeneral = value; }
}
public string observacion
{
get { return pobservacion; }
set { pobservacion = value; }
}
public string condicion_estado
{
get { return pcondicion_estado; }
set { pcondicion_estado = value; }
}
public double deudaactual
{
get { return pdeudaactual; }
set { pdeudaactual = value; }
}
public double pago
{
get { return ppago; }
set { ppago = value; }
}
public double deudapendiente
{
get { return pdeudapendiente; }
set { pdeudapendiente = value; }
}
public string TIPODOCUMENTO
{
get { return pTIPODOCUMENTO; }
set { pTIPODOCUMENTO = value; }
}
public string TIPOMONEDA
{
get { return pTIPOMONEDA; }
set { pTIPOMONEDA = value; }
}
public string codproveedor
{
get { return pcodproveedor; }
set { pcodproveedor = value; }
}
public string Usuario
{
get { return pusuario; }
set { pusuario = value; }
}
public string Estacion
{

Dávila Napa, César Gustavo Pág.: 120


Informe de Prácticas Profesionales
get { return pestacion; }
set { pestacion = value; }
}
#endregion
#region Metodos

public void Insertar(EBCompra Compra, CBDetalleCompra DetalleCompra)


{
CBDetalleCompra Detalle = new CBDetalleCompra();
Detalle.GrabarDetalleCompra( Compra, DetalleCompra);
}

public DataTable Listar()


{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETREGISTRO_COMPRAS_1", "");
return dstresultado.Tables[0];
}

public DataTable ListarFiltros( string codproducto)


{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SSYSTEMCOMPRASGENERAL.GETREGISTRO_COMPRAS",cod
producto, "");
return dstresultado.Tables[0];
}

public EBCompra ConsultarAll(string codigo)


{
DBConexionOracle. DBConexionOracle db = new DBConexionOracle. DBConexionOracle ();
DataSet ds = new DataSet ();
OracleParameter p = new OracleParameter ("pCursor", OracleType.Cursor); p.Direction =
ParameterDirection.Output;
db.AddParameter (p); db.AddParameter ("pcodcompra", codigo);
OracleDataReader dr = (OracleDataReader) db.ExecuteReader
("SYSTEMCOMPRASGENERAL.GETREGISTRO_BUSCAR");
if (dr.HasRows)
{

EBCompra ObjProveedores = new EBCompra ();


while (dr.Read())
{
ObjProveedores.codcompra = dr.GetString (dr.GetOrdinal ("CODCOMPRA"));
ObjProveedores.codproveedor = dr.GetString (dr.GetOrdinal ("CODPROVEEDOR"));
ObjProveedores. Serie = dr.GetString (dr.GetOrdinal ("SERIE"));
ObjProveedores.numerodocumento = dr.GetString (dr.GetOrdinal
("NUMERODOCUMENTO"));
ObjProveedores. TIPODOCUMENTO = dr.GetString (dr.GetOrdinal
l("CODDOCUMENTO"));
ObjProveedores.guiaremision = dr.GetString (dr.GetOrdinal ("GUIAREMISION"));
ObjProveedores.formapago = dr.GetString (dr.GetOrdinal ("FORMAPAGO"));
ObjProveedores. TIPOMONEDA = dr.GetString (dr.GetOrdinal ("CODMONEDA"));
ObjProveedores.fechaemision = dr.GetDateTime (dr.GetOrdinal ("FECHAEMISION"));
ObjProveedores.fecharecepcion = dr.GetDateTime (dr.GetOrdinal
("FECHARECEPCION"));
ObjProveedores.fechavencimiento = dr.GetDateTime (dr.GetOrdinal
("FECHAVENCIMIENTO"));
ObjProveedores.subtotal = dr.GetDouble (dr.GetOrdinal ("SUBTOTAL"));
ObjProveedores.igv = dr.GetDouble (dr.GetOrdinal ("igv"));
ObjProveedores.totalgeneral = dr.GetDouble (dr.GetOrdinal ("TOTALGENERAL"));
ObjProveedores.condicion_estado = dr.GetString (dr.GetOrdinal
("CONDICION_ESTADO"));

Dávila Napa, César Gustavo Pág.: 121


Informe de Prácticas Profesionales
ObjProveedores.deudaactual = dr.GetDouble (dr.GetOrdinal ("DEUDAACTUAL"));
ObjProveedores.pago = dr.GetDouble (dr.GetOrdinal ("PAGO"));
ObjProveedores.deudapendiente = dr.GetDouble (dr.GetOrdinal
("DEUDAPENDIENTE"));
ObjProveedores.observacion = dr.GetString (dr.GetOrdinal ("OBSERVACION"));
}
dr.Close ();
return ObjProveedores;

}
else
{
dr.Close ();
return new EBCompra();
}
}
public void Eliminar(EBCompra Compra)
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos (Conexion);
Execute.EjecutaStoreOut ("SYSTEMCOMPRASGENERAL.DELREGISTRO_COMPRAS",
Compra.codcompra, Compra.Usuario);
}

public DataTable ListarFiltrosFechaCompra(DateTime fechainicial,


DateTime fechafinal,
string tipodocumento,
string estadocompra,
string nomproveedor)
{
DataSet dstresultado = new DataSet ();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GetRegsitroCompras_Fecha",
fechainicial, fechafinal, tipodocumento, estadocompra, nomproveedor, "");
return dstresultado.Tables[0];
}

public DataTable ListarFiltrosFecharecepcion(DateTime fechainicial, DateTime fechafinal, string


tipodocumento, string estadocompra, string nomproveedor)
{
DataSet dstresultado = new DataSet ();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos (Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETREGISTROCOMPRAS_FECHA
RECEP", fechainicial, fechafinal, tipodocumento,estadocompra, nomproveedor, "");
return dstresultado.Tables[0];
}

public DataTable ListarFiltrosRecePagar (DateTime fechainicial, DateTime fechafinal, string


tipomoneda, string condicionestado, string nomproveedor)
{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
dstresultado =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETCUENTASPAGAR_FECHAREC
EP", fechainicial, fechafinal, tipomoneda, condicionestado, nomproveedor, "");
return dstresultado.Tables[0];
}

public DataTable ListarFiltrosEmisPagar(DateTime fechainicial, DateTime fechafinal, string


tipomoneda, string condicionestado, string nomproveedor)
{
DataSet dstresultado = new DataSet();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos (Conexion);

Dávila Napa, César Gustavo Pág.: 122


Informe de Prácticas Profesionales
Dstresultado = Execute.ExecuteStoreDataSet
("SYSTEMCOMPRASGENERAL.GETCUENTASPAGAR_FECHAEMIS", fechainicial, fechafinal,
tipomoneda, condicionestado, nomproveedor, "");
return dstresultado.Tables[0];
}

#endregion
}
}

TRANSACCIÓN DETALLE COMPRAS


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;
using System.Data.OracleClient;
using Pry_Libreria_SistemaCaf;
using DBConexionOracle;
namespace Pry_Libreria_SistemaCaf.Entidades
{
public class EBDetalleCompra
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
string vCodigo = "";
double vcantidad = 0;
double vprecio_sigv = 0;
double vprecio_cigv = 0;
double vvalor_venta = 0;
double vigv = 0;
double vimporte = 0;
string vobservacion = "";
string vDescripcion = "";
string vUnidad = "";
string pusuario = "";

#region Propiedades
public string Codigo
{
get { return string.IsNullOrEmpty(vCodigo) ? "" : vCodigo.Trim(); }
set { vCodigo = value; }
}
public Double Cantidad
{
get { return vcantidad; }
set { vcantidad = value; }
}
public Double Precio_sigv
{
get { return vprecio_sigv; }
set { vprecio_sigv = value; }
}
public Double Precio_cigv
{
get { return vprecio_cigv; }
set { vprecio_cigv = value; }
}
public Double Valor_venta
{

Dávila Napa, César Gustavo Pág.: 123


Informe de Prácticas Profesionales
get { return vvalor_venta;}
set { vvalor_venta = value; }
}
public Double Igv
{
get { return vigv; }
set { vigv = value; }
}
public Double Importe
{
get { return vimporte; }
set { vimporte = value; }
}
public string Observacion
{
get { return vobservacion; }
set { vobservacion = value; }
}
public string Descripcion
{
get { return vDescripcion; }
set { vDescripcion = value; }
}
public string Unidad
{
get { return vUnidad; }
set { vUnidad = value; }
}
public string Usuario
{
get { return pusuario; }
set { pusuario = value; }
}
#endregion

public DataTable ListarFiltro (string codcompra)


{
DataSet dstresultado = new Data Set ();
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos (Conexion);
Dstresultado = Execute.ExecuteStoreDataSet
("SYSTEMCOMPRASGENERAL.GETDETALLE_COMPRA_BUSCAR",codcompra, "");
return dstresultado.Tables[0];
}

public void Eliminar (EBDetalleCompra detalle)


{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos (Conexion);
Execute.EjecutaStoreOut ("SYSTEMCOMPRASGENERAL.DELDETALLE_COMPRA",
detalle.Codigo, detalle.Usuario);
}

}
}

COLECCIONES

PROVEEDORES
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;

Dávila Napa, César Gustavo Pág.: 124


Informe de Prácticas Profesionales
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;
namespace Pry_Libreria_SistemaCaf.Colecciones
{
public class CBProveedores : CollectionBase
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
private DataRowCollection Registros = null;
#region Constuctores
public CBProveedores(EBProveedor FiltrosProveedores)
{
this.Buscar(FiltrosProveedores);
}
#endregion
#region Métodos
public void Buscar(EBProveedor Filtros)
{
try
{
CapaDatos.Exe.Call_datos Execute = new CapaDatos.Exe.Call_datos(Conexion);
DataSet Ds =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETPROVEEDORES",
Filtros.Codigo,Filtros.Nombreproveedor,Filtros.Ruc,"");
List.Clear();
if (Ds.Tables[0].Rows.Count > 0)
{

Registros = Ds.Tables[0].Rows;
foreach (DataRow registro in Registros)
{
EBProveedor Proveedores = new EBProveedor();
Proveedores.Codigo = registro["codproveedor"].ToString();
Proveedores.Nombreproveedor = registro["nombreproveedor"].ToString();
Proveedores.Direccion = registro["direccion"].ToString();
Proveedores.Ruc = registro["ruc"].ToString();
Proveedores.Telefono = registro["telefono"].ToString();
Proveedores.Observacion = registro["observacion"].ToString();
Proveedores.Codtipoproveedor = registro["NOMBRETIPOPROVEEDOR"].ToString();
List.Add(Proveedores);
}
}
}
catch (Exception)
{
throw;
}
}

#endregion
}
}

PRODUCTO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;

Dávila Napa, César Gustavo Pág.: 125


Informe de Prácticas Profesionales
namespace Pry_Libreria_SistemaCaf.Colecciones
{
public class CBProducto : CollectionBase
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
private DataRowCollection Registros = null;
#region Constuctores
public CBProducto(EBProducto FiltrosProducto)
{
this.Buscar(FiltrosProducto);
}
#endregion
#region Métodos

public void Buscar(EBProducto Filtros)


{
try
{
CapaDatos.Exe.Call_datos Execute = new
CapaDatos.Exe.Call_datos(Conexion);
DataSet Ds =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETPRODUCTO", Filtros.Codigo,
Filtros.Nombreprooducto, "");
List.Clear();
if (Ds.Tables[0].Rows.Count > 0)
{

Registros = Ds.Tables[0].Rows;
foreach (DataRow registro in Registros)
{
EBProducto Producto = new EBProducto();
Producto.Codigo = registro["codproducto"].ToString();
Producto.Nombreprooducto =
registro["nombreprooducto"].ToString();
Producto.Unidad = registro["unidad"].ToString();
Producto.Observacion =
registro["observacion"].ToString();
Producto.Codcategoria =
registro["NOMBRECATEGORIA"].ToString();
List.Add(Producto);
}
}
}
catch (Exception)
{
throw;
}
}

#endregion

}
}

CATEGORIA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;

Dávila Napa, César Gustavo Pág.: 126


Informe de Prácticas Profesionales
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;

namespace Pry_Libreria_SistemaCaf.Colecciones
{
public class CBCategoria: CollectionBase
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
private DataRowCollection Registros = null;
#region Constuctores
public CBCategoria(EBCategoria FiltrosCategoria)
{
this.Buscar(FiltrosCategoria);
}
#endregion
#region Métodos
public void Buscar(EBCategoria Filtros)
{
try
{
CapaDatos.Exe.Call_datos Execute = new
CapaDatos.Exe.Call_datos(Conexion);
DataSet Ds =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETCATEGORIA", Filtros.Codigo,
Filtros.Nombrecategoria,"");
List.Clear();
if (Ds.Tables[0].Rows.Count > 0)
{

Registros = Ds.Tables[0].Rows;
foreach (DataRow registro in Registros)
{
EBCategoria Categoria = new EBCategoria();
Categoria.Codigo = registro["codcategoria"].ToString();
Categoria.Nombrecategoria =
registro["nombrecategoria"].ToString();
List.Add(Categoria);
}
}
}
catch (Exception)
{
throw;
}
}

#endregion
}
}

DOCUMENTO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;

Dávila Napa, César Gustavo Pág.: 127


Informe de Prácticas Profesionales

namespace Pry_Libreria_SistemaCaf.Colecciones
{
public class CBDocumento : CollectionBase
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
private DataRowCollection Registros = null;
#region Constuctores
public CBDocumento(EBDocumento FiltrosDocumento)
{
this.Buscar(FiltrosDocumento);
}
#endregion
#region Métodos
public void Buscar(EBDocumento Filtros)
{
try
{
CapaDatos.Exe.Call_datos Execute = new
CapaDatos.Exe.Call_datos(Conexion);
DataSet Ds =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETTIPODOCUMENTO",
Filtros.Codigo,Filtros.Tipodocumento, "");
List.Clear();
if (Ds.Tables[0].Rows.Count > 0)
{
Registros = Ds.Tables[0].Rows;
foreach (DataRow registro in Registros)
{
EBDocumento Documento = new EBDocumento();
Documento.Codigo = registro["coddocumento"].ToString();
Documento.Tipodocumento =
registro["tipodocumento"].ToString();
List.Add(Documento);
}
}
}
catch (Exception)
{
throw;
}
}

#endregion
}
}

MONEDA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;

namespace Pry_Libreria_SistemaCaf.Colecciones
{
public class CBMoneda : CollectionBase

Dávila Napa, César Gustavo Pág.: 128


Informe de Prácticas Profesionales
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
private DataRowCollection Registros = null;
#region Constuctores
public CBMoneda(EBMoneda FiltrosMoneda)
{
this.Buscar(FiltrosMoneda);
}
#endregion
#region Métodos
public void Buscar(EBMoneda Filtros)
{
try
{
CapaDatos.Exe.Call_datos Execute = new
CapaDatos.Exe.Call_datos(Conexion);
DataSet Ds =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETMONEDA",
Filtros.Codigo,Filtros.Tipomoneda ,"");
List.Clear();
if (Ds.Tables[0].Rows.Count > 0)
{

Registros = Ds.Tables[0].Rows;
foreach (DataRow registro in Registros)
{
EBMoneda Moneda = new EBMoneda();
Moneda.Codigo = registro["codmoneda"].ToString();
Moneda.Tipomoneda = registro["tipomoneda"].ToString();
List.Add(Moneda);
}
}
}
catch (Exception)
{
throw;
}
}

#endregion
}
}

TRANSACCIÓN COMPRAS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;

namespace Pry_Libreria_SistemaCaf.Colecciones
{
public class CBCompras : CollectionBase
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
private DataRowCollection Registros = null;
#region Constuctores

Dávila Napa, César Gustavo Pág.: 129


Informe de Prácticas Profesionales
public CBCompras(EBCompra FiltrosCompra)
{
this.Buscar(FiltrosCompra);
}
#endregion
#region Métodos
public void Buscar(EBCompra Filtros)
{
try
{
CapaDatos.Exe.Call_datos Execute = new
CapaDatos.Exe.Call_datos(Conexion);
DataSet Ds =
Execute.ExecuteStoreDataSet("SYSTEMCOMPRASGENERAL.GETREGISTRO_COMPRAS",
Filtros.codproveedor,Filtros.NOMBREPROVEEDOR,Filtros.ruc,Filtros.TIPODOCUMENTO,Fi
ltros.TIPOMONEDA,Filtros.numerodocumento,Filtros.fecharecepcion, "");
List.Clear();
if (Ds.Tables[0].Rows.Count > 0)
{

Registros = Ds.Tables[0].Rows;
foreach (DataRow registro in Registros)
{
EBCompra Compra = new EBCompra();

Compra.codcompra = registro ["codcompra"].ToString ();

Compra.serie = registro ["serie"].ToString ();


Compra.ruc = registro ["RUC"].ToString ();
Compra.NOMBREPROVEEDOR = registro
["NOMBREPROVEEDOR"].ToString ();

Compra.numerodocumento = registro
["numerodocumento"].ToString ();

Compra.guiaremision = registro ["guiaremision"].ToString ();

Compra.fecharecepcion =Convert.ToDateTime (registro


["fecharecepcion"].ToString ());
Compra.fechaemision = Convert.ToDateTime (registro
["fechaemision"].ToString ());
Compra.fechavencimiento = Convert.ToDateTime (registro
["fechavencimiento"].ToString ());

Compra.formapago = registro ["formapago"].ToString ();


Compra.subtotal = Convert.ToDouble (registro
["subtotal"].ToString ());
Compra.igv = Convert.ToDouble (registro ["igv"].ToString
());

Compra.totalgeneral = Convert.ToDouble (registro


["totalgeneral"].ToString ());
Compra.observacion = registro ["observacion"].ToString
();
Compra.condicion_estado = registro
["condicion_estado"].ToString ();

Compra.deudaactual =Convert.ToDouble (registro


["deudaactual"].ToString ());
Compra.pago = Convert.ToDouble (registro
["pago"].ToString ());

Dávila Napa, César Gustavo Pág.: 130


Informe de Prácticas Profesionales
Compra.deudapendiente =Convert.ToDouble ( registro
["deudapendiente"].ToString());
Compra.TIPODOCUMENTO = registro
["TIPODOCUMENTO"].ToString ();
Compra.TIPOMONEDA = registro ["TIPOMONEDA"].ToString ();

Compra.codproveedor = registro ["CODPROVEEDOR"].ToString


();

List.Add (Compra);
}
}
}
catch (Exception)
{
throw;
}
}

#endregion
}
}

DETALLE COMPRAS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data.OracleClient;
using CapaDatos.Exe;
using System.Data;
using System.ComponentModel;
using Pry_Libreria_SistemaCaf.Entidades;

namespace Pry_Libreria_SistemaCaf.Entidades
{
public class CBDetalleCompra : CollectionBase
{
string Conexion = "Data Source=xe;Persist Security Info=True;User
ID=SYSTEMCOMPRASGENERAL;Password=davila;Unicode=True";
public void AgregarItem (EBDetalleCompra Objeto)
{
try
{
List.Add (Objeto);
}
catch (Exception)
{
throw;
}
}
public void EliminarItem (EBDetalleCompra Objeto)
{
try
{
List.Remove (Objeto);
}
catch (Exception)
{
throw;
}

Dávila Napa, César Gustavo Pág.: 131


Informe de Prácticas Profesionales
}
public void GrabarDetalleCompra (EBCompra Compra, CBDetalleCompra Detalle)
{
try
{
OracleTransaction Transaccion;
OracleConnection Cone = new OracleConnection (Conexion);
Cone.Open ();
Transaccion = Cone.BeginTransaction ();
Call_datos Execute = new Call_datos (Conexion);
String CodigoGenerado = Execute.EjecutaStore_Tran (Cone, Transaccion,
"SYSTEMCOMPRASGENERAL.SETREGISTRO_COMPRAS",
Compra.codcompra,
Compra.serie,
Compra.numerodocumento,
Compra.guiaremision ,
Compra.fecharecepcion ,
Compra.fechaemision,
Compra.fechavencimiento,
Compra.formapago,
Compra.subtotal,
Compra.igv,
Compra.totalgeneral,
Compra.observacion,
Compra.condicion_estado,
Compra.deudaactual,
Compra.pago,
Compra.deudapendiente,
Compra. TIPODOCUMENTO,
Compra.TIPOMONEDA,
Compra.codproveedor,
Compra.Usuario
);
Compra.codcompra = CodigoGenerado;
foreach (EBDetalleCompra item in Detalle)
{
Execute.EjecutaStore_Tran (Cone, Transaccion,
"SYSTEMCOMPRASGENERAL.SETDETALLE_COMPRA",
item.Cantidad,
item.Precio_sigv,
item.Precio_cigv,
item.Valor_venta,
item.Igv,
item.Importe,
Compra.codcompra,
item.Observacion,
item.Codigo,
Compra.Usuario
);
}
Transaccion.Commit ();
Transaccion.Dispose ();
}
catch (Exception)
{
throw;
}
}
}
}

Dávila Napa, César Gustavo Pág.: 132


Informe de Prácticas Profesionales

PROCESOS DE INSTALACION DEL SISTEMA

 Inserte el disco del software y aparecerá la siguiente ventana

 Seleccione la carpeta o ubicación donde se instalará el sistema haciendo clic en el


botón “Siguiente”.

Dávila Napa, César Gustavo Pág.: 133


Informe de Prácticas Profesionales

 Confirmamos la instalación en donde hemos ubicado la el sistema y haciendo clic en el


botón “Siguiente”.

 Aparecerá una ventana de progreso de Instalación del Sistema.

Dávila Napa, César Gustavo Pág.: 134


Informe de Prácticas Profesionales

 Finalmente el sistema se habrá instalado haga clic en “Cerrar”

INGRESANDO AL SISTEMA

Dávila Napa, César Gustavo Pág.: 135


Informe de Prácticas Profesionales
 Clic en el Carpeta “Archivos Programas”

 Seleccione “AGRO – SERVICIOS SAN LUIS”

 Luego “Ejecutable”

 Haga clic en el Acceso “Sistema Compra Financiero”.

MANUAL DEL USUARIO

FORMULARIO PRINCIPAL DE CONTROL DE SISTEMA COMPRAS

Dávila Napa, César Gustavo Pág.: 136


Informe de Prácticas Profesionales

Barra de Título. – En esta parte del formulario se hace mención el nombre del sistema.

Barra de Menú. – Aquí se podrá tener acceso a todo el sistema mediante una secuencia de
proceso.

Barra de Menú Botón. – Aquí se podrá tener los procesos de transacciones y


mantenimientos de los proceso.

Dávila Napa, César Gustavo Pág.: 137


Informe de Prácticas Profesionales

FORMULARIO DE ACCCESO

Mediante este formulario se tendrá acceso al sistema, escogiendo un usuario


respectivo que este encargado de utilizar este sistema.

Dávila Napa, César Gustavo Pág.: 138


Informe de Prácticas Profesionales

FORMULARIO DE MANTENIMIENTO DEL PROVEEDOR

Permite Limpiar e y Agregar un Nuevo Dato del Proveedor.

Permite Guardar los Datos Ingresados.

Permite cancelar la Aplicación.

Dávila Napa, César Gustavo Pág.: 139


Informe de Prácticas Profesionales
Permite Editar y Modificar Datos del Proveedor.

Permite Consulta del Proveedor.

Permite Salir del Mantenimiento Proveedor.

Permite Eliminar un registro del Proveedor.

Permite Imprimir los datos de los Proveedores.

FORMULARIO DE TRANSACCIÓN COMPRA

Permite Limpiar e y Agregar una Nueva Compra

Permite Guardar los Datos Ingresados.

Permite cancelar la Aplicación u Operación.

Dávila Napa, César Gustavo Pág.: 140


Informe de Prácticas Profesionales

Permite Editar y Modificar los Registros de la Compra.

Permite Salir de la Transacción Compra.

Permite Anular la Transacción Compra registrada.

Permite ingresar los detalles de las compras.

Permite eliminar los detalles de las compras

Permite Imprimir un registro de compras con su detalle y cabecera.

MANTENIMIENTO CONSULTA COMPRAS REGSITRADAS

Permite visualizar la Consulta De las compras registradas.

Dávila Napa, César Gustavo Pág.: 141


Informe de Prácticas Profesionales

BÚSQUEDA DE REPORTES GENERAL

Permite Buscar y Visualizar las Compras Registradas

Permite Imprimir un Reporte General de las Compras.

Permite Imprimir un Reporte por campos divididos de proveedores.

Permite Salir del Reporte General de Compras.

MANTENIMIENTO DE DETALLE COMPRA

Dávila Napa, César Gustavo Pág.: 142


Informe de Prácticas Profesionales

Permite Limpiar los datos del detalle de compras.

Permite agregar los detalles a la transacción compra.

Permite Salir del formulario del detalle sin acciones.

Permite Buscar los productos registrados.

Dávila Napa, César Gustavo Pág.: 143


Informe de Prácticas Profesionales

2.4 PLAN DE MANTENIMIENTO


MESES ACCIÓN DETALLADA USUARIO TIEMPO

Mantenimiento de los Cada


1 Usuario/Programador
archivos Mes

2 Realizar copias de seguridad Programador Diario

Cada
3 Mantenimiento preventivo Programador
Mes

METODOLOGIA

MÉTODOS, TÉCNICAS E INSTRUMENTOS UTILIZADOS

ANÁLISIS:

Investigación preliminar y recopilación de información.

 Estudio de Prefactibilidad.
 Recopilación de información mediante entrevistas y taller
grupal.
 Metodología RUP, utilizando el lenguaje de modelado UML.
 Herramienta utilizada fue el Rational Rose Enterprise 2003.
 Tecnología orientada a objetos en base capas.

DISEÑO:

 Metodología UML.
 Herramienta erwin
 La técnica utilizada es modelado base de datos relacional

Dávila Napa, César Gustavo Pág.: 144


Informe de Prácticas Profesionales
PROGRAMACIÓN:

 Programación orientada a objetos en base capas.


 Lenguaje de programación a utilizar será Visual 2010, y la
base de datos Oracle 9.5.
 Métodos de programación como crear Triggers, constraints y
procedimientos básicos para el sistema.
 El sistema es adaptable para trabajarlo en red.

PROCEDIMIENTOS DE TRABAJO

 Se esta buscando mejorar en la implementación del software.


 En cuanto al hardware usado se realizara mantenimiento
preventivo cada mes.

Dávila Napa, César Gustavo Pág.: 145

También podría gustarte