git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@13 c93665c3-c93d-084d-9b98-7d5f4a9c3376
This commit is contained in:
parent
f668a5b946
commit
acad391c0a
Binary file not shown.
1985
Build/buildlog.html
1985
Build/buildlog.html
File diff suppressed because it is too large
Load Diff
@ -2007,3 +2007,150 @@ on ((AGENTES_COMISIONES.ID_AGENTE = V_AGENTES.ID) and (AGENTES_COMISIONES.ID_PRO
|
||||
where FACTURAS_CLIENTE_DETALLES.ID_ARTICULO is not null
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* HISTORICO MOVIMIENTOS ************************************************/
|
||||
/************************************************************************/
|
||||
/*Las siguientes vista nos presentará el historico de movimientos de todos los artículos*/
|
||||
|
||||
DROP VIEW V_HISTORICO_MOVIMIENTOS;
|
||||
DROP VIEW V_HIS_MOV_AUX;
|
||||
DROP VIEW V_HIS_MOV_ALB_CLI;
|
||||
DROP VIEW V_HIS_MOV_ALB_PROV;
|
||||
DROP VIEW V_HIS_MOV_REGULARIZACIONES;
|
||||
|
||||
|
||||
CREATE VIEW V_HIS_MOV_REGULARIZACIONES(
|
||||
FECHA,
|
||||
ID_ALMACEN,
|
||||
ID_ARTICULO,
|
||||
TIPO_MOVIMIENTO,
|
||||
CANTIDAD,
|
||||
CAUSA)
|
||||
AS
|
||||
SELECT FECHA_MOVIMIENTO, ID_ALMACEN, ID_ARTICULO,
|
||||
CASE WHEN TIPO = 'E' THEN 'Entrada'
|
||||
ELSE 'Salida' END,
|
||||
CASE WHEN TIPO = 'S' THEN (-1)* CANTIDAD
|
||||
ELSE CANTIDAD END,
|
||||
'Regularización por - ' || CAUSA
|
||||
FROM MOVIMIENTOS;
|
||||
|
||||
|
||||
CREATE VIEW V_HIS_MOV_ALB_PROV(
|
||||
FECHA,
|
||||
ID_ALMACEN,
|
||||
ID_ARTICULO,
|
||||
TIPO_MOVIMIENTO,
|
||||
CANTIDAD,
|
||||
CAUSA)
|
||||
AS
|
||||
SELECT
|
||||
ALBARANES_PROVEEDOR.FECHA_ALBARAN,
|
||||
V_ALB_PROV_DETALLES.ID_ALMACEN,
|
||||
V_ALB_PROV_DETALLES.ID_ARTICULO,
|
||||
CASE WHEN V_ALB_PROV_DETALLES.CANTIDAD < 0 THEN 'Salida'
|
||||
ELSE 'Entrada' END,
|
||||
V_ALB_PROV_DETALLES.CANTIDAD,
|
||||
CASE WHEN ALBARANES_PROVEEDOR.IMPORTE_TOTAL < 0 THEN 'Orden de devolución ' || ALBARANES_PROVEEDOR.REFERENCIA
|
||||
ELSE 'Albarán de proveedor ' || ALBARANES_PROVEEDOR.REFERENCIA END
|
||||
|
||||
|
||||
FROM V_ALB_PROV_DETALLES
|
||||
LEFT JOIN ALBARANES_PROVEEDOR
|
||||
ON (V_ALB_PROV_DETALLES.ID_ALBARAN = ALBARANES_PROVEEDOR.ID)
|
||||
WHERE (V_ALB_PROV_DETALLES.ID_ALMACEN IS NOT NULL);
|
||||
|
||||
|
||||
CREATE VIEW V_HIS_MOV_ALB_CLI(
|
||||
FECHA,
|
||||
ID_ALMACEN,
|
||||
ID_ARTICULO,
|
||||
TIPO_MOVIMIENTO,
|
||||
CANTIDAD,
|
||||
CAUSA)
|
||||
AS
|
||||
SELECT
|
||||
ALBARANES_CLIENTE.FECHA_ALBARAN,
|
||||
V_ALB_CLI_DETALLES.ID_ALMACEN,
|
||||
V_ALB_CLI_DETALLES.ID_ARTICULO,
|
||||
CASE WHEN V_ALB_CLI_DETALLES.CANTIDAD < 0 THEN 'Entrada'
|
||||
ELSE 'Salida' END,
|
||||
(-1)*V_ALB_CLI_DETALLES.CANTIDAD,
|
||||
CASE WHEN ALBARANES_CLIENTE.IMPORTE_TOTAL < 0 THEN 'Orden de devolución de cliente ' || ALBARANES_CLIENTE.REFERENCIA
|
||||
ELSE 'Albarán de cliente ' || ALBARANES_CLIENTE.REFERENCIA END
|
||||
|
||||
FROM V_ALB_CLI_DETALLES
|
||||
LEFT JOIN ALBARANES_CLIENTE
|
||||
ON (V_ALB_CLI_DETALLES.ID_ALBARAN = ALBARANES_CLIENTE.ID)
|
||||
|
||||
WHERE (V_ALB_CLI_DETALLES.ID_ALMACEN IS NOT NULL)
|
||||
AND (V_ALB_CLI_DETALLES.SITUACION in ('ENVIADO', 'SERVIDO'));
|
||||
|
||||
|
||||
CREATE VIEW V_HIS_MOV_AUX(
|
||||
FECHA,
|
||||
ID_ALMACEN,
|
||||
ID_ARTICULO,
|
||||
TIPO_MOVIMIENTO,
|
||||
CANTIDAD,
|
||||
CAUSA)
|
||||
AS
|
||||
SELECT
|
||||
FECHA,
|
||||
ID_ALMACEN,
|
||||
ID_ARTICULO,
|
||||
TIPO_MOVIMIENTO,
|
||||
CANTIDAD,
|
||||
CAUSA
|
||||
FROM V_HIS_MOV_ALB_PROV
|
||||
UNION
|
||||
SELECT
|
||||
FECHA,
|
||||
ID_ALMACEN,
|
||||
ID_ARTICULO,
|
||||
TIPO_MOVIMIENTO,
|
||||
CANTIDAD,
|
||||
CAUSA
|
||||
FROM V_HIS_MOV_ALB_CLI
|
||||
UNION
|
||||
SELECT
|
||||
FECHA,
|
||||
ID_ALMACEN,
|
||||
ID_ARTICULO,
|
||||
TIPO_MOVIMIENTO,
|
||||
CANTIDAD,
|
||||
CAUSA
|
||||
FROM V_HIS_MOV_REGULARIZACIONES;
|
||||
|
||||
|
||||
CREATE VIEW V_HISTORICO_MOVIMIENTOS(
|
||||
FECHA,
|
||||
ID_ALMACEN,
|
||||
ID_EMPRESA,
|
||||
NOMBRE_ALMACEN,
|
||||
ID_ARTICULO,
|
||||
FAMILIA,
|
||||
DESCRIPCION,
|
||||
TIPO_MOVIMIENTO,
|
||||
CANTIDAD,
|
||||
CAUSA)
|
||||
AS
|
||||
SELECT
|
||||
V_HIS_MOV_AUX.FECHA,
|
||||
V_HIS_MOV_AUX.ID_ALMACEN,
|
||||
ALMACENES.ID_EMPRESA,
|
||||
ALMACENES.NOMBRE,
|
||||
V_HIS_MOV_AUX.ID_ARTICULO,
|
||||
ARTICULOS.FAMILIA,
|
||||
ARTICULOS.DESCRIPCION,
|
||||
V_HIS_MOV_AUX.TIPO_MOVIMIENTO,
|
||||
V_HIS_MOV_AUX.CANTIDAD,
|
||||
V_HIS_MOV_AUX.CAUSA
|
||||
|
||||
FROM V_HIS_MOV_AUX
|
||||
LEFT JOIN ALMACENES ON (ALMACENES.ID = V_HIS_MOV_AUX.ID_ARTICULO)
|
||||
LEFT JOIN ARTICULOS ON (ARTICULOS.ID = V_HIS_MOV_AUX.ID_ARTICULO)
|
||||
|
||||
WHERE (V_HIS_MOV_AUX.ID_ARTICULO <> 0)
|
||||
AND (ARTICULOS.INVENTARIABLE = 1);
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user