Compare commits
2 Commits
5033fbbc06
...
c6cb8d5cce
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6cb8d5cce | ||
|
|
e5cfa0f10c |
@@ -45,6 +45,8 @@ Database
|
||||
## Language rules
|
||||
|
||||
- All new code must be **C#**.
|
||||
- All new project-owned identifiers must use Spanish domain terminology, including C# members and local variables, JavaScript functions and variables, CSS hooks, HTML `data-*` attributes, and `ViewState` keys. Keep framework, library, protocol, and established external API names unchanged.
|
||||
- Do not introduce English aliases for Spanish database or business concepts. For example, use `CveUnidadMedida`, `unidadMedida`, or `data-cve-unidad-medida`, not `MeasurementUnit`, `measurementUnit`, or `data-measurement-unit-id`.
|
||||
- Do not add VB.NET files.
|
||||
- Do not add `.vb` files to the active project.
|
||||
- Old VB files may exist only as migration reference files using `.vb.txt`.
|
||||
@@ -316,6 +318,8 @@ Do not mix placeholder naming systems in the same project.
|
||||
- Hidden-field values are client-controlled and must never be trusted for authorization or sensitive decisions; validate them again on the server when their use is unavoidable.
|
||||
- Keep ViewState values small and serializable. Do not store database connections, commands, readers, services, repositories, or unnecessarily large result sets in ViewState.
|
||||
- ViewState property and key names must identify the entity and purpose, for example `CveFraccionamientoActual` and `CveFraccionamientoEtapaActual`.
|
||||
- When a postback needs to recover related values from an already loaded catalog, store the typed serializable object list in a typed `ViewState` property and locate the selected object by its key.
|
||||
- Do not copy server-owned catalog or model values into HTML `data-*` attributes, CSS classes, hidden fields, or other client-controlled markup merely to recover them during a postback. Read them from the typed object list stored in `ViewState`.
|
||||
|
||||
---
|
||||
## Login and session rules
|
||||
@@ -487,6 +491,8 @@ Rules:
|
||||
- Do not create `SqlCommand` directly in `.aspx.cs`.
|
||||
- Use repositories or SQL executor classes behind contracts.
|
||||
- All application database reads and writes must use stored procedures; inline SQL in C# is prohibited.
|
||||
- Access to modules and catalogs is controlled by the menu and page-access layer. Reusable catalog stored procedures must not query `Sis_Usuarios`, restrict execution by `CveRol`, or return access-denied messages for module authorization.
|
||||
- Keep `@CveUsuarioEjecuta` in catalog procedures for the required signature and auditing when applicable, not to authorize access to the module.
|
||||
- Mandatory: read and follow `AGENTS_STORED_PROCEDURES.md` for naming, output parameters, TRY/CATCH, logging, transactions, and physical deletion.
|
||||
- Mandatory: read and follow `AGENTS_DATA_READER_MAPPING.md` for object, list, `DataTable`, and `JArray` result mapping.
|
||||
- Mandatory: read and follow `AGENTS_DATABASE_ERROR_LOGGING.md` for safe parameter logging and reproducible stored-procedure calls.
|
||||
@@ -873,4 +879,4 @@ After the starter works, the safest growth path is:
|
||||
6. Add catalog search and UI helpers.
|
||||
7. Add PDF viewer only after the base shell is stable.
|
||||
|
||||
Keep every new feature behind contracts so the WebForms UI remains thin and easier to migrate later if needed.
|
||||
Keep every new feature behind contracts so the WebForms UI remains thin and easier to migrate later if needed.
|
||||
|
||||
573
Catalogo_ProductosServicios.sql
Normal file
573
Catalogo_ProductosServicios.sql
Normal file
@@ -0,0 +1,573 @@
|
||||
SET NOCOUNT ON;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ProductoServicioList
|
||||
@Texto varchar(200) = NULL,
|
||||
@IncluirInactivos bit = 0,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SET @Texto = NULLIF(LTRIM(RTRIM(@Texto)), '');
|
||||
|
||||
SELECT
|
||||
PS.CvePS,
|
||||
PS.Codigo,
|
||||
PS.PS,
|
||||
PS.CveTipoPS,
|
||||
CASE PS.CveTipoPS
|
||||
WHEN 2 THEN 'Producto'
|
||||
ELSE 'Servicio'
|
||||
END AS TipoPS,
|
||||
PS.CveClasificacion,
|
||||
C.Clasificacion,
|
||||
PS.CveUnidadMedida,
|
||||
UM.UnidadMedida,
|
||||
CONVERT(decimal(18, 2), PS.Precio) AS Precio,
|
||||
PS.Estado AS EsActivo
|
||||
FROM dbo.ProductosServicios AS PS
|
||||
INNER JOIN dbo.Clasificaciones AS C
|
||||
ON C.CveClasificacion = PS.CveClasificacion
|
||||
INNER JOIN dbo.UnidadesMedida AS UM
|
||||
ON UM.CveUnidadMedida = PS.CveUnidadMedida
|
||||
WHERE (@IncluirInactivos = 1 OR PS.Estado = 1)
|
||||
AND
|
||||
(
|
||||
@Texto IS NULL
|
||||
OR PS.Codigo LIKE '%' + @Texto + '%'
|
||||
OR PS.PS LIKE '%' + @Texto + '%'
|
||||
OR C.Clasificacion LIKE '%' + @Texto + '%'
|
||||
OR UM.UnidadMedida LIKE '%' + @Texto + '%'
|
||||
)
|
||||
ORDER BY PS.PS, PS.CvePS;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar los productos y servicios; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ProductoServicioList'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ProductoServicioGet
|
||||
@CvePS int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
PS.CvePS,
|
||||
PS.Codigo,
|
||||
PS.PS,
|
||||
PS.CveTipoPS,
|
||||
CASE PS.CveTipoPS
|
||||
WHEN 2 THEN 'Producto'
|
||||
ELSE 'Servicio'
|
||||
END AS TipoPS,
|
||||
PS.CveClasificacion,
|
||||
C.Clasificacion,
|
||||
PS.CveUnidadMedida,
|
||||
UM.UnidadMedida,
|
||||
CONVERT(decimal(18, 2), PS.Precio) AS Precio,
|
||||
PS.Estado AS EsActivo
|
||||
FROM dbo.ProductosServicios AS PS
|
||||
INNER JOIN dbo.Clasificaciones AS C
|
||||
ON C.CveClasificacion = PS.CveClasificacion
|
||||
INNER JOIN dbo.UnidadesMedida AS UM
|
||||
ON UM.CveUnidadMedida = PS.CveUnidadMedida
|
||||
WHERE PS.CvePS = @CvePS;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar el producto o servicio; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ProductoServicioGet'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ProductoServicioOpcionesList
|
||||
@CveClasificacionActual int = NULL,
|
||||
@CveUnidadMedidaActual int = NULL,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
CveClasificacion,
|
||||
CASE
|
||||
WHEN NULLIF(LTRIM(RTRIM(Codigo)), '') IS NULL
|
||||
THEN Clasificacion COLLATE Modern_Spanish_CS_AS
|
||||
ELSE
|
||||
Codigo COLLATE Modern_Spanish_CS_AS
|
||||
+ ' - '
|
||||
+ Clasificacion COLLATE Modern_Spanish_CS_AS
|
||||
END AS Clasificacion
|
||||
FROM dbo.Clasificaciones
|
||||
WHERE
|
||||
(
|
||||
Estado = 1
|
||||
AND Afectable = 1
|
||||
)
|
||||
OR CveClasificacion = @CveClasificacionActual
|
||||
ORDER BY Clasificacion, Codigo, CveClasificacion;
|
||||
|
||||
SELECT
|
||||
CveUnidadMedida,
|
||||
CASE
|
||||
WHEN NULLIF(LTRIM(RTRIM(Abreviatura)), '') IS NULL
|
||||
THEN UnidadMedida COLLATE Modern_Spanish_CS_AS
|
||||
ELSE
|
||||
UnidadMedida COLLATE Modern_Spanish_CS_AS
|
||||
+ ' ('
|
||||
+ Abreviatura COLLATE Modern_Spanish_CS_AS
|
||||
+ ')'
|
||||
END AS UnidadMedida
|
||||
FROM dbo.UnidadesMedida
|
||||
WHERE Estado = 1
|
||||
OR CveUnidadMedida = @CveUnidadMedidaActual
|
||||
ORDER BY UnidadMedida, CveUnidadMedida;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar las opciones del catálogo; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ProductoServicioOpcionesList'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ProductoServicioSave
|
||||
@CvePS int = NULL,
|
||||
@Codigo varchar(50) = NULL,
|
||||
@PS varchar(846),
|
||||
@CveTipoPS int,
|
||||
@CveClasificacion int,
|
||||
@CveUnidadMedida int,
|
||||
@Precio decimal(18, 2),
|
||||
@EsActivo bit,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
@CvePS = NULLIF(@CvePS, 0),
|
||||
@Codigo = NULLIF(LTRIM(RTRIM(@Codigo)), ''),
|
||||
@PS = LTRIM(RTRIM(@PS));
|
||||
|
||||
IF NULLIF(@PS, '') IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture la descripción del producto o servicio.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @CveTipoPS NOT IN (1, 2)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione si el registro es producto o servicio.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @Precio < 0
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El precio no puede ser negativo.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Clasificaciones
|
||||
WHERE CveClasificacion = @CveClasificacion
|
||||
AND
|
||||
(
|
||||
Estado = 1
|
||||
OR CveClasificacion =
|
||||
(
|
||||
SELECT CveClasificacion
|
||||
FROM dbo.ProductosServicios
|
||||
WHERE CvePS = @CvePS
|
||||
)
|
||||
)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione una clasificación vigente.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.UnidadesMedida
|
||||
WHERE CveUnidadMedida = @CveUnidadMedida
|
||||
AND
|
||||
(
|
||||
Estado = 1
|
||||
OR CveUnidadMedida =
|
||||
(
|
||||
SELECT CveUnidadMedida
|
||||
FROM dbo.ProductosServicios
|
||||
WHERE CvePS = @CvePS
|
||||
)
|
||||
)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione una unidad de medida vigente.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @Codigo IS NOT NULL
|
||||
AND EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.ProductosServicios
|
||||
WHERE Codigo = @Codigo
|
||||
AND CvePS <> ISNULL(@CvePS, 0)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El código ya está asignado a otro producto o servicio.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @CvePS IS NULL
|
||||
BEGIN
|
||||
INSERT dbo.ProductosServicios
|
||||
(
|
||||
CveClasificacion,
|
||||
CveUnidadMedida,
|
||||
Codigo,
|
||||
PS,
|
||||
Precio,
|
||||
Estado,
|
||||
Fecha,
|
||||
CveTipoPS,
|
||||
CveUsuario,
|
||||
CveUsuarioModifico,
|
||||
FechaUltimaModificacion
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@CveClasificacion,
|
||||
@CveUnidadMedida,
|
||||
@Codigo,
|
||||
@PS,
|
||||
CONVERT(float, @Precio),
|
||||
@EsActivo,
|
||||
GETDATE(),
|
||||
@CveTipoPS,
|
||||
@CveUsuarioEjecuta,
|
||||
@CveUsuarioEjecuta,
|
||||
GETDATE()
|
||||
);
|
||||
|
||||
SET @CvePS = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.ProductosServicios
|
||||
WHERE CvePS = @CvePS
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El producto o servicio seleccionado no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
UPDATE dbo.ProductosServicios
|
||||
SET CveClasificacion = @CveClasificacion,
|
||||
CveUnidadMedida = @CveUnidadMedida,
|
||||
Codigo = @Codigo,
|
||||
PS = @PS,
|
||||
Precio = CONVERT(float, @Precio),
|
||||
Estado = @EsActivo,
|
||||
CveTipoPS = @CveTipoPS,
|
||||
CveUsuarioModifico = @CveUsuarioEjecuta,
|
||||
FechaUltimaModificacion = GETDATE()
|
||||
WHERE CvePS = @CvePS;
|
||||
END;
|
||||
|
||||
SELECT @CvePS AS CvePS;
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al guardar el producto o servicio; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ProductoServicioSave'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ProductoServicioDelete
|
||||
@CvePS int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.ProductosServicios
|
||||
WHERE CvePS = @CvePS
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El producto o servicio seleccionado no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Tra_CostosTramite
|
||||
WHERE CvePS = @CvePS
|
||||
)
|
||||
OR EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Tra_PagosDetalle
|
||||
WHERE CvePS = @CvePS
|
||||
)
|
||||
OR EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.VentasDetalle
|
||||
WHERE CvePS = @CvePS
|
||||
)
|
||||
OR EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.ProductosServicios
|
||||
WHERE CvePS <> @CvePS
|
||||
AND
|
||||
(
|
||||
CvePSAdicional = @CvePS
|
||||
OR CveCompuesto = @CvePS
|
||||
)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El producto o servicio tiene trámites, pagos, ventas o productos relacionados y no puede eliminarse.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
DELETE dbo.ProductosServicios
|
||||
WHERE CvePS = @CvePS;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
IF ERROR_NUMBER() = 547
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El producto o servicio tiene información relacionada y no puede eliminarse.',
|
||||
@ErrorTipo = 2,
|
||||
@Return = 0;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al eliminar el producto o servicio; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ProductoServicioDelete'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
DECLARE @CveTabla int;
|
||||
|
||||
SELECT @CveTabla = CveTabla
|
||||
FROM dbo.Bit_Tablas
|
||||
WHERE NombreTablaSQL = 'ProductosServicios' COLLATE Modern_Spanish_CS_AS;
|
||||
|
||||
IF @CveTabla IS NULL
|
||||
BEGIN
|
||||
INSERT dbo.Bit_Tablas
|
||||
(
|
||||
NombreTablaSQL,
|
||||
NombreMostrar,
|
||||
Descripcion,
|
||||
NombreCampoLlaveSQL,
|
||||
Activo
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
'ProductosServicios',
|
||||
'Productos y servicios',
|
||||
'Catálogo de productos y servicios.',
|
||||
'CvePS',
|
||||
1
|
||||
);
|
||||
|
||||
SET @CveTabla = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
UPDATE dbo.Bit_Tablas
|
||||
SET NombreMostrar = 'Productos y servicios',
|
||||
Descripcion = 'Catálogo de productos y servicios.',
|
||||
NombreCampoLlaveSQL = 'CvePS',
|
||||
Activo = 1,
|
||||
FechaMod = GETDATE()
|
||||
WHERE CveTabla = @CveTabla;
|
||||
END;
|
||||
|
||||
DECLARE @Campos TABLE
|
||||
(
|
||||
NombreCampoSQL varchar(128) COLLATE Modern_Spanish_CS_AS NOT NULL,
|
||||
NombreMostrar varchar(150) COLLATE Modern_Spanish_CS_AS NOT NULL,
|
||||
MostrarEnBitacora bit NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO @Campos
|
||||
(NombreCampoSQL, NombreMostrar, MostrarEnBitacora)
|
||||
VALUES
|
||||
('CvePS', 'Clave', 0),
|
||||
('Codigo', 'Código', 1),
|
||||
('PS', 'Descripción', 1),
|
||||
('CveTipoPS', 'Tipo', 1),
|
||||
('CveClasificacion', 'Clasificación', 1),
|
||||
('CveUnidadMedida', 'Unidad de medida', 1),
|
||||
('Precio', 'Precio', 1),
|
||||
('Estado', 'Activo', 1);
|
||||
|
||||
UPDATE BC
|
||||
SET NombreMostrar = C.NombreMostrar,
|
||||
MostrarEnBitacora = C.MostrarEnBitacora,
|
||||
TipoDatoSQL = TY.name COLLATE Modern_Spanish_CS_AS,
|
||||
Activo = 1,
|
||||
FechaMod = GETDATE()
|
||||
FROM dbo.Bit_Campos AS BC
|
||||
INNER JOIN @Campos AS C
|
||||
ON C.NombreCampoSQL = BC.NombreCampoSQL
|
||||
INNER JOIN sys.columns AS SC
|
||||
ON SC.object_id = OBJECT_ID(N'dbo.ProductosServicios')
|
||||
AND SC.name COLLATE Modern_Spanish_CS_AS = C.NombreCampoSQL
|
||||
INNER JOIN sys.types AS TY
|
||||
ON TY.user_type_id = SC.user_type_id
|
||||
WHERE BC.CveTabla = @CveTabla;
|
||||
|
||||
INSERT dbo.Bit_Campos
|
||||
(
|
||||
CveTabla,
|
||||
NombreCampoSQL,
|
||||
NombreMostrar,
|
||||
MostrarEnBitacora,
|
||||
TipoDatoSQL,
|
||||
Activo
|
||||
)
|
||||
SELECT
|
||||
@CveTabla,
|
||||
C.NombreCampoSQL,
|
||||
C.NombreMostrar,
|
||||
C.MostrarEnBitacora,
|
||||
TY.name COLLATE Modern_Spanish_CS_AS,
|
||||
1
|
||||
FROM @Campos AS C
|
||||
INNER JOIN sys.columns AS SC
|
||||
ON SC.object_id = OBJECT_ID(N'dbo.ProductosServicios')
|
||||
AND SC.name COLLATE Modern_Spanish_CS_AS = C.NombreCampoSQL
|
||||
INNER JOIN sys.types AS TY
|
||||
ON TY.user_type_id = SC.user_type_id
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Bit_Campos AS BC
|
||||
WHERE BC.CveTabla = @CveTabla
|
||||
AND BC.NombreCampoSQL = C.NombreCampoSQL
|
||||
);
|
||||
GO
|
||||
674
Catalogos_Clasificaciones_UnidadesMedida.sql
Normal file
674
Catalogos_Clasificaciones_UnidadesMedida.sql
Normal file
@@ -0,0 +1,674 @@
|
||||
SET NOCOUNT ON;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ClasificacionList
|
||||
@Texto varchar(200) = NULL,
|
||||
@IncluirInactivos bit = 0,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SET @Texto = NULLIF(LTRIM(RTRIM(@Texto)), '');
|
||||
|
||||
SELECT
|
||||
CveClasificacion,
|
||||
Codigo,
|
||||
Clasificacion,
|
||||
Afectable,
|
||||
Estado AS EsActivo
|
||||
FROM dbo.Clasificaciones
|
||||
WHERE (@IncluirInactivos = 1 OR Estado = 1)
|
||||
AND
|
||||
(
|
||||
@Texto IS NULL
|
||||
OR Codigo LIKE '%' + @Texto + '%'
|
||||
OR Clasificacion LIKE '%' + @Texto + '%'
|
||||
)
|
||||
ORDER BY Clasificacion, Codigo, CveClasificacion;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar las clasificaciones; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ClasificacionList'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ClasificacionGet
|
||||
@CveClasificacion int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
CveClasificacion,
|
||||
Codigo,
|
||||
Clasificacion,
|
||||
Afectable,
|
||||
Estado AS EsActivo
|
||||
FROM dbo.Clasificaciones
|
||||
WHERE CveClasificacion = @CveClasificacion;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar la clasificación; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ClasificacionGet'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ClasificacionSave
|
||||
@CveClasificacion int = NULL,
|
||||
@Codigo varchar(20) = NULL,
|
||||
@Clasificacion varchar(200),
|
||||
@Afectable bit,
|
||||
@EsActivo bit,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
@CveClasificacion = NULLIF(@CveClasificacion, 0),
|
||||
@Codigo = NULLIF(LTRIM(RTRIM(@Codigo)), ''),
|
||||
@Clasificacion = LTRIM(RTRIM(@Clasificacion));
|
||||
|
||||
IF NULLIF(@Clasificacion, '') IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture la clasificación.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Clasificaciones
|
||||
WHERE Clasificacion = @Clasificacion
|
||||
AND CveClasificacion <> ISNULL(@CveClasificacion, 0)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ya existe una clasificación con ese nombre.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @Codigo IS NOT NULL
|
||||
AND EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Clasificaciones
|
||||
WHERE Codigo = @Codigo
|
||||
AND CveClasificacion <> ISNULL(@CveClasificacion, 0)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El código ya está asignado a otra clasificación.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @CveClasificacion IS NULL
|
||||
BEGIN
|
||||
INSERT dbo.Clasificaciones
|
||||
(
|
||||
Codigo,
|
||||
Clasificacion,
|
||||
Estado,
|
||||
Afectable,
|
||||
Fecha,
|
||||
CveUsuario
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@Codigo,
|
||||
@Clasificacion,
|
||||
@EsActivo,
|
||||
@Afectable,
|
||||
CONVERT(date, GETDATE()),
|
||||
@CveUsuarioEjecuta
|
||||
);
|
||||
|
||||
SET @CveClasificacion = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Clasificaciones
|
||||
WHERE CveClasificacion = @CveClasificacion
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La clasificación seleccionada no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
UPDATE dbo.Clasificaciones
|
||||
SET Codigo = @Codigo,
|
||||
Clasificacion = @Clasificacion,
|
||||
Estado = @EsActivo,
|
||||
Afectable = @Afectable
|
||||
WHERE CveClasificacion = @CveClasificacion;
|
||||
END;
|
||||
|
||||
SELECT @CveClasificacion AS CveClasificacion;
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al guardar la clasificación; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ClasificacionSave'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_ClasificacionDelete
|
||||
@CveClasificacion int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Clasificaciones
|
||||
WHERE CveClasificacion = @CveClasificacion
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La clasificación seleccionada no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.ProductosServicios
|
||||
WHERE CveClasificacion = @CveClasificacion
|
||||
OR CveClasificacion2 = @CveClasificacion
|
||||
)
|
||||
OR EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Conta_PrePolizasDetalle
|
||||
WHERE CveClasificacion = @CveClasificacion
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La clasificación tiene productos, servicios o pólizas relacionados y no puede eliminarse.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
DELETE dbo.Clasificaciones
|
||||
WHERE CveClasificacion = @CveClasificacion;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
IF ERROR_NUMBER() = 547
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La clasificación tiene información relacionada y no puede eliminarse.',
|
||||
@ErrorTipo = 2,
|
||||
@Return = 0;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al eliminar la clasificación; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_ClasificacionDelete'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_UnidadMedidaList
|
||||
@Texto varchar(100) = NULL,
|
||||
@IncluirInactivos bit = 0,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SET @Texto = NULLIF(LTRIM(RTRIM(@Texto)), '');
|
||||
|
||||
SELECT
|
||||
CveUnidadMedida,
|
||||
UnidadMedida,
|
||||
Abreviatura,
|
||||
Estado AS EsActivo
|
||||
FROM dbo.UnidadesMedida
|
||||
WHERE (@IncluirInactivos = 1 OR Estado = 1)
|
||||
AND
|
||||
(
|
||||
@Texto IS NULL
|
||||
OR UnidadMedida LIKE '%' + @Texto + '%'
|
||||
OR Abreviatura LIKE '%' + @Texto + '%'
|
||||
)
|
||||
ORDER BY UnidadMedida, CveUnidadMedida;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar las unidades de medida; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_UnidadMedidaList'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_UnidadMedidaGet
|
||||
@CveUnidadMedida int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
CveUnidadMedida,
|
||||
UnidadMedida,
|
||||
Abreviatura,
|
||||
Estado AS EsActivo
|
||||
FROM dbo.UnidadesMedida
|
||||
WHERE CveUnidadMedida = @CveUnidadMedida;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar la unidad de medida; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_UnidadMedidaGet'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_UnidadMedidaSave
|
||||
@CveUnidadMedida int = NULL,
|
||||
@UnidadMedida varchar(50),
|
||||
@Abreviatura varchar(15),
|
||||
@EsActivo bit,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
@CveUnidadMedida = NULLIF(@CveUnidadMedida, 0),
|
||||
@UnidadMedida = LTRIM(RTRIM(@UnidadMedida)),
|
||||
@Abreviatura = LTRIM(RTRIM(@Abreviatura));
|
||||
|
||||
IF NULLIF(@UnidadMedida, '') IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture la unidad de medida.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NULLIF(@Abreviatura, '') IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture la abreviatura.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.UnidadesMedida
|
||||
WHERE UnidadMedida = @UnidadMedida
|
||||
AND CveUnidadMedida <> ISNULL(@CveUnidadMedida, 0)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ya existe una unidad de medida con ese nombre.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.UnidadesMedida
|
||||
WHERE Abreviatura = @Abreviatura
|
||||
AND CveUnidadMedida <> ISNULL(@CveUnidadMedida, 0)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La abreviatura ya está asignada a otra unidad de medida.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @CveUnidadMedida IS NULL
|
||||
BEGIN
|
||||
INSERT dbo.UnidadesMedida
|
||||
(
|
||||
UnidadMedida,
|
||||
Abreviatura,
|
||||
Estado,
|
||||
Fecha,
|
||||
CveUsuario
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@UnidadMedida,
|
||||
@Abreviatura,
|
||||
@EsActivo,
|
||||
CONVERT(date, GETDATE()),
|
||||
@CveUsuarioEjecuta
|
||||
);
|
||||
|
||||
SET @CveUnidadMedida = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.UnidadesMedida
|
||||
WHERE CveUnidadMedida = @CveUnidadMedida
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La unidad de medida seleccionada no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
UPDATE dbo.UnidadesMedida
|
||||
SET UnidadMedida = @UnidadMedida,
|
||||
Abreviatura = @Abreviatura,
|
||||
Estado = @EsActivo
|
||||
WHERE CveUnidadMedida = @CveUnidadMedida;
|
||||
END;
|
||||
|
||||
SELECT @CveUnidadMedida AS CveUnidadMedida;
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al guardar la unidad de medida; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_UnidadMedidaSave'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Gral_UnidadMedidaDelete
|
||||
@CveUnidadMedida int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.UnidadesMedida
|
||||
WHERE CveUnidadMedida = @CveUnidadMedida
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La unidad de medida seleccionada no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.ProductosServicios
|
||||
WHERE CveUnidadMedida = @CveUnidadMedida
|
||||
)
|
||||
OR EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Tra_PagosDetalle
|
||||
WHERE CveUM = @CveUnidadMedida
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La unidad de medida tiene productos, servicios o pagos relacionados y no puede eliminarse.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
DELETE dbo.UnidadesMedida
|
||||
WHERE CveUnidadMedida = @CveUnidadMedida;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
IF ERROR_NUMBER() = 547
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La unidad de medida tiene información relacionada y no puede eliminarse.',
|
||||
@ErrorTipo = 2,
|
||||
@Return = 0;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al eliminar la unidad de medida; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Gral_UnidadMedidaDelete'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
DECLARE @Tablas TABLE
|
||||
(
|
||||
NombreTablaSQL varchar(128) COLLATE Modern_Spanish_CS_AS NOT NULL,
|
||||
NombreMostrar varchar(150) COLLATE Modern_Spanish_CS_AS NOT NULL,
|
||||
CampoLlave varchar(128) COLLATE Modern_Spanish_CS_AS NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO @Tablas
|
||||
(NombreTablaSQL, NombreMostrar, CampoLlave)
|
||||
VALUES
|
||||
('Clasificaciones', 'Clasificaciones', 'CveClasificacion'),
|
||||
('UnidadesMedida', 'Unidades de medida', 'CveUnidadMedida');
|
||||
|
||||
UPDATE BT
|
||||
SET NombreMostrar = S.NombreMostrar,
|
||||
NombreCampoLlaveSQL = S.CampoLlave,
|
||||
Activo = 1,
|
||||
FechaMod = GETDATE()
|
||||
FROM dbo.Bit_Tablas AS BT
|
||||
INNER JOIN @Tablas AS S
|
||||
ON S.NombreTablaSQL = BT.NombreTablaSQL;
|
||||
|
||||
INSERT dbo.Bit_Tablas
|
||||
(NombreTablaSQL, NombreMostrar, Descripcion, NombreCampoLlaveSQL, Activo)
|
||||
SELECT
|
||||
S.NombreTablaSQL,
|
||||
S.NombreMostrar,
|
||||
'Catálogo general de productos y servicios.',
|
||||
S.CampoLlave,
|
||||
1
|
||||
FROM @Tablas AS S
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Bit_Tablas AS BT
|
||||
WHERE BT.NombreTablaSQL = S.NombreTablaSQL
|
||||
);
|
||||
|
||||
INSERT dbo.Bit_Campos
|
||||
(CveTabla, NombreCampoSQL, NombreMostrar, MostrarEnBitacora, TipoDatoSQL, Activo)
|
||||
SELECT
|
||||
BT.CveTabla,
|
||||
C.name,
|
||||
C.name,
|
||||
CASE WHEN C.name = S.CampoLlave THEN 0 ELSE 1 END,
|
||||
TY.name,
|
||||
1
|
||||
FROM @Tablas AS S
|
||||
INNER JOIN sys.tables AS T
|
||||
ON T.name COLLATE Modern_Spanish_CS_AS = S.NombreTablaSQL
|
||||
INNER JOIN sys.schemas AS SC
|
||||
ON SC.schema_id = T.schema_id
|
||||
AND SC.name = 'dbo'
|
||||
INNER JOIN sys.columns AS C
|
||||
ON C.object_id = T.object_id
|
||||
INNER JOIN sys.types AS TY
|
||||
ON TY.user_type_id = C.user_type_id
|
||||
INNER JOIN dbo.Bit_Tablas AS BT
|
||||
ON BT.NombreTablaSQL = S.NombreTablaSQL
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Bit_Campos AS BC
|
||||
WHERE BC.CveTabla = BT.CveTabla
|
||||
AND BC.NombreCampoSQL = C.name COLLATE Modern_Spanish_CS_AS
|
||||
);
|
||||
GO
|
||||
@@ -290,20 +290,6 @@ BEGIN
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Sis_Usuarios
|
||||
WHERE CveUsuario = @CveUsuarioEjecuta
|
||||
AND Activo = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'No cuenta con una sesión válida para consultar el emisor fiscal.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
@@ -387,21 +373,6 @@ BEGIN
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Sis_Usuarios
|
||||
WHERE CveUsuario = @CveUsuarioEjecuta
|
||||
AND CveRol IN (1, 2)
|
||||
AND Activo = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'No cuenta con permiso para configurar emisores fiscales.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
@Rfc = UPPER(REPLACE(LTRIM(RTRIM(@Rfc)), ' ', '')),
|
||||
@NombreFiscal = LTRIM(RTRIM(@NombreFiscal)),
|
||||
|
||||
590
Facturacion_Timbrado_Venta_20260828.sql
Normal file
590
Facturacion_Timbrado_Venta_20260828.sql
Normal file
@@ -0,0 +1,590 @@
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Fac_EmisorFiscalGet
|
||||
@CveEmpresa int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Fac_EmisoresFiscales
|
||||
WHERE CveEmpresa = @CveEmpresa
|
||||
AND EsActivo = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La empresa no tiene configurado un emisor fiscal activo.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
CveEmisorFiscal,
|
||||
CveEmpresa,
|
||||
Rfc,
|
||||
NombreFiscal,
|
||||
RegimenFiscal,
|
||||
CodigoPostal,
|
||||
ProveedorPac,
|
||||
AmbienteProduccion,
|
||||
ReferenciaCredencialPac,
|
||||
ReferenciaContratoPac,
|
||||
ReferenciaCertificadoCsd,
|
||||
ReferenciaLlavePrivadaCsd,
|
||||
NumeroCertificado,
|
||||
VigenciaCertificadoDesde,
|
||||
VigenciaCertificadoHasta,
|
||||
HuellaCertificado,
|
||||
EsActivo
|
||||
FROM dbo.Fac_EmisoresFiscales
|
||||
WHERE CveEmpresa = @CveEmpresa
|
||||
AND EsActivo = 1;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar el emisor fiscal; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Fac_EmisorFiscalGet'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramiteVentaDatosCfdiGet
|
||||
@CveSolicitud int,
|
||||
@CveTramitePago int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
DECLARE @CveVenta int;
|
||||
|
||||
SELECT @CveVenta = V.CveVenta
|
||||
FROM dbo.Tra_SolicitudesPagos AS SP
|
||||
INNER JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
WHERE SP.CveSolicitud = @CveSolicitud
|
||||
AND SP.CveTramitePago = @CveTramitePago;
|
||||
|
||||
IF @CveVenta IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Primero debe generar la venta del trámite.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Ventas AS V
|
||||
WHERE V.CveVenta = @CveVenta
|
||||
AND
|
||||
(
|
||||
V.SeTimbro = 1
|
||||
OR EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Fac_CfdiDocumentos AS D
|
||||
WHERE D.TipoOrigen = 'VENTA'
|
||||
AND D.CveOrigen = V.CveVenta
|
||||
AND D.Estado = 'TIMBRADO'
|
||||
AND D.CveCfdiTimbradoVigente IS NOT NULL
|
||||
)
|
||||
)
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La venta ya se encuentra timbrada.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Fac_CfdiDocumentos
|
||||
WHERE TipoOrigen = 'VENTA'
|
||||
AND CveOrigen = @CveVenta
|
||||
AND Estado = 'REVISAR'
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Existe un intento de timbrado con resultado indeterminado; debe revisarse antes de volver a timbrar.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
V.CveVenta,
|
||||
Borrador.CveCfdiDocumento,
|
||||
V.CveCliente,
|
||||
V.Serie,
|
||||
V.Folio,
|
||||
V.Fecha,
|
||||
FP.ClaveFormaPagoSAT AS FormaPago,
|
||||
MP.ClaveMetodoPagoSAT AS MetodoPago,
|
||||
M.AbreviaturaSAT AS Moneda,
|
||||
CONVERT(decimal(19, 6), V.TipoCambio) AS TipoCambio
|
||||
FROM dbo.Ventas AS V
|
||||
LEFT JOIN dbo.Vta_FormaPago AS FP
|
||||
ON FP.CveFormaPago = V.FormaPago
|
||||
LEFT JOIN dbo.Vta_MetodoPago AS MP
|
||||
ON MP.CveMetodoPago = V.CveMetodoPago
|
||||
INNER JOIN dbo.Gral_Monedas AS M
|
||||
ON M.CveMoneda = V.CveMoneda
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1) D.CveCfdiDocumento
|
||||
FROM dbo.Fac_CfdiDocumentos AS D
|
||||
WHERE D.TipoOrigen = 'VENTA'
|
||||
AND D.CveOrigen = V.CveVenta
|
||||
AND D.CveCfdiTimbradoVigente IS NULL
|
||||
AND D.Estado IN ('BORRADOR', 'LISTO', 'ERROR')
|
||||
ORDER BY D.CveCfdiDocumento DESC
|
||||
) AS Borrador
|
||||
WHERE V.CveVenta = @CveVenta;
|
||||
|
||||
SELECT
|
||||
SATPS.SATClavePS AS ClaveProductoServicio,
|
||||
PS.Codigo AS NumeroIdentificacion,
|
||||
VD.Cantidad,
|
||||
SATUM.SATClaveUnidadMedida AS ClaveUnidad,
|
||||
UM.UnidadMedida AS Unidad,
|
||||
PS.PS AS Descripcion,
|
||||
VD.PrecioUnitario AS ValorUnitario,
|
||||
VD.Descuento,
|
||||
OI.CodigoObjetoImpuesto AS ObjetoImpuesto,
|
||||
CONVERT(
|
||||
decimal(19, 6),
|
||||
ROUND(VD.Cantidad * VD.PrecioUnitario, 6) - VD.Descuento
|
||||
) AS BaseIVA,
|
||||
CONVERT(
|
||||
decimal(19, 6),
|
||||
ISNULL(PS.IVA, 0) / 100.0
|
||||
) AS TasaIVA,
|
||||
CONVERT(decimal(19, 6), VD.IVA) AS ImporteIVA
|
||||
FROM dbo.VentasDetalle AS VD
|
||||
INNER JOIN dbo.ProductosServicios AS PS
|
||||
ON PS.CvePS = VD.CvePS
|
||||
INNER JOIN dbo.UnidadesMedida AS UM
|
||||
ON UM.CveUnidadMedida = PS.CveUnidadMedida
|
||||
LEFT JOIN dbo.Gral_SAT_ProductosServicios AS SATPS
|
||||
ON SATPS.CveSATPS = PS.CveSATPS
|
||||
LEFT JOIN dbo.Gral_SAT_UnidadesMedida AS SATUM
|
||||
ON SATUM.CveSATUnidadMedida = UM.CveSATUnidadMedida
|
||||
LEFT JOIN dbo.Gral_SAT_ObjetoImpuesto AS OI
|
||||
ON OI.CveObjetoImpuesto = PS.CveObjetoImpuesto
|
||||
WHERE VD.CveVenta = @CveVenta
|
||||
ORDER BY VD.CveVentaDetalle;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al preparar los datos fiscales de la venta; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Vta_TramiteVentaDatosCfdiGet'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Fac_EmisorFiscalSave
|
||||
@CveEmisorFiscal int = NULL,
|
||||
@CveEmpresa int,
|
||||
@Rfc varchar(13),
|
||||
@NombreFiscal varchar(300),
|
||||
@RegimenFiscal varchar(3),
|
||||
@CodigoPostal varchar(5),
|
||||
@ProveedorPac varchar(50),
|
||||
@AmbienteProduccion bit,
|
||||
@ReferenciaCredencialPac varchar(100),
|
||||
@ReferenciaContratoPac varchar(100) = NULL,
|
||||
@ReferenciaCertificadoCsd varchar(500) = NULL,
|
||||
@ReferenciaLlavePrivadaCsd varchar(500) = NULL,
|
||||
@NumeroCertificado varchar(20) = NULL,
|
||||
@VigenciaCertificadoDesde datetime2(0) = NULL,
|
||||
@VigenciaCertificadoHasta datetime2(0) = NULL,
|
||||
@HuellaCertificado varchar(128) = NULL,
|
||||
@EsActivo bit,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
@Rfc = UPPER(REPLACE(LTRIM(RTRIM(@Rfc)), ' ', '')),
|
||||
@NombreFiscal = LTRIM(RTRIM(@NombreFiscal)),
|
||||
@RegimenFiscal = LTRIM(RTRIM(@RegimenFiscal)),
|
||||
@CodigoPostal = LTRIM(RTRIM(@CodigoPostal)),
|
||||
@ProveedorPac = UPPER(LTRIM(RTRIM(@ProveedorPac))),
|
||||
@ReferenciaCredencialPac = LTRIM(RTRIM(@ReferenciaCredencialPac)),
|
||||
@ReferenciaContratoPac = NULLIF(LTRIM(RTRIM(@ReferenciaContratoPac)), ''),
|
||||
@ReferenciaCertificadoCsd = NULLIF(LTRIM(RTRIM(@ReferenciaCertificadoCsd)), ''),
|
||||
@ReferenciaLlavePrivadaCsd = NULLIF(LTRIM(RTRIM(@ReferenciaLlavePrivadaCsd)), ''),
|
||||
@NumeroCertificado = NULLIF(LTRIM(RTRIM(@NumeroCertificado)), ''),
|
||||
@HuellaCertificado = NULLIF(LTRIM(RTRIM(@HuellaCertificado)), '');
|
||||
|
||||
IF LEN(@Rfc) NOT IN (12, 13)
|
||||
OR NULLIF(@NombreFiscal, '') IS NULL
|
||||
OR LEN(@RegimenFiscal) <> 3
|
||||
OR LEN(@CodigoPostal) <> 5
|
||||
OR NULLIF(@ProveedorPac, '') IS NULL
|
||||
OR NULLIF(@ReferenciaCredencialPac, '') IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture RFC, nombre fiscal, régimen, código postal, PAC y referencia de credencial válidos.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @CveEmisorFiscal IS NULL
|
||||
BEGIN
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Fac_EmisoresFiscales
|
||||
WHERE CveEmpresa = @CveEmpresa
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La empresa ya cuenta con una configuración fiscal.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
INSERT dbo.Fac_EmisoresFiscales
|
||||
(
|
||||
CveEmpresa,
|
||||
Rfc,
|
||||
NombreFiscal,
|
||||
RegimenFiscal,
|
||||
CodigoPostal,
|
||||
ProveedorPac,
|
||||
AmbienteProduccion,
|
||||
ReferenciaCredencialPac,
|
||||
ReferenciaContratoPac,
|
||||
ReferenciaCertificadoCsd,
|
||||
ReferenciaLlavePrivadaCsd,
|
||||
NumeroCertificado,
|
||||
VigenciaCertificadoDesde,
|
||||
VigenciaCertificadoHasta,
|
||||
HuellaCertificado,
|
||||
EsActivo,
|
||||
CveUsuario
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@CveEmpresa,
|
||||
@Rfc,
|
||||
@NombreFiscal,
|
||||
@RegimenFiscal,
|
||||
@CodigoPostal,
|
||||
@ProveedorPac,
|
||||
@AmbienteProduccion,
|
||||
@ReferenciaCredencialPac,
|
||||
@ReferenciaContratoPac,
|
||||
@ReferenciaCertificadoCsd,
|
||||
@ReferenciaLlavePrivadaCsd,
|
||||
@NumeroCertificado,
|
||||
@VigenciaCertificadoDesde,
|
||||
@VigenciaCertificadoHasta,
|
||||
@HuellaCertificado,
|
||||
@EsActivo,
|
||||
@CveUsuarioEjecuta
|
||||
);
|
||||
|
||||
SET @CveEmisorFiscal = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Fac_EmisoresFiscales
|
||||
WHERE CveEmisorFiscal = @CveEmisorFiscal
|
||||
AND CveEmpresa = @CveEmpresa
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'No se encontró la configuración fiscal seleccionada.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
UPDATE dbo.Fac_EmisoresFiscales
|
||||
SET Rfc = @Rfc,
|
||||
NombreFiscal = @NombreFiscal,
|
||||
RegimenFiscal = @RegimenFiscal,
|
||||
CodigoPostal = @CodigoPostal,
|
||||
ProveedorPac = @ProveedorPac,
|
||||
AmbienteProduccion = @AmbienteProduccion,
|
||||
ReferenciaCredencialPac = @ReferenciaCredencialPac,
|
||||
ReferenciaContratoPac = @ReferenciaContratoPac,
|
||||
ReferenciaCertificadoCsd = @ReferenciaCertificadoCsd,
|
||||
ReferenciaLlavePrivadaCsd = @ReferenciaLlavePrivadaCsd,
|
||||
NumeroCertificado = @NumeroCertificado,
|
||||
VigenciaCertificadoDesde = @VigenciaCertificadoDesde,
|
||||
VigenciaCertificadoHasta = @VigenciaCertificadoHasta,
|
||||
HuellaCertificado = @HuellaCertificado,
|
||||
EsActivo = @EsActivo,
|
||||
FechaModificacion = SYSDATETIME(),
|
||||
CveUsuario = @CveUsuarioEjecuta
|
||||
WHERE CveEmisorFiscal = @CveEmisorFiscal;
|
||||
END;
|
||||
|
||||
SELECT @CveEmisorFiscal AS CveEmisorFiscal;
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al guardar el emisor fiscal; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Fac_EmisorFiscalSave'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramiteContextoGet
|
||||
@CveSolicitud int,
|
||||
@CveTramitePago int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
DECLARE @CveSubProyecto int =
|
||||
(
|
||||
SELECT TOP (1) CveSubProyecto
|
||||
FROM dbo.SubProyectos
|
||||
WHERE Estatus = 1
|
||||
ORDER BY
|
||||
CASE WHEN Serie = 'TRA' THEN 0 ELSE 1 END,
|
||||
CveSubProyecto
|
||||
);
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Tra_Solicitudes AS S
|
||||
INNER JOIN dbo.Tra_Pagos AS P
|
||||
ON P.CveTramitePago = @CveTramitePago
|
||||
AND P.CveTipoTramite = S.CveTipoTramite
|
||||
AND P.EsActivo = 1
|
||||
INNER JOIN dbo.Tra_PagosDetalle AS D
|
||||
ON D.CveTramitePago = P.CveTramitePago
|
||||
WHERE S.CveSolicitud = @CveSolicitud
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El pago seleccionado no corresponde al trámite o no tiene conceptos activos.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
S.CveSolicitud,
|
||||
P.CveTramitePago,
|
||||
SP.CveVenta,
|
||||
VP.CvePago,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE
|
||||
WHEN SP.CveSolicitudPago IS NOT NULL
|
||||
AND V.CveVenta IS NOT NULL
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS VentaGenerada,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE WHEN VP.Autorizado = 1 THEN 1 ELSE 0 END
|
||||
) AS VentaPagada,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE
|
||||
WHEN VP.CvePago IS NOT NULL
|
||||
AND VP.Autorizado = 0
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS PagoPendienteAutorizacion,
|
||||
VP.Referencia AS ReferenciaPago,
|
||||
Documento.CveCfdiDocumento,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE
|
||||
WHEN V.SeTimbro = 1
|
||||
OR Documento.Estado = 'TIMBRADO'
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS VentaTimbrada,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE WHEN Documento.Estado = 'CANCELADO' THEN 1 ELSE 0 END
|
||||
) AS TimbreCancelado,
|
||||
Documento.Uuid AS UuidTimbre,
|
||||
S.CveFraccionamiento,
|
||||
F.Fraccionamiento,
|
||||
F.CveCliente,
|
||||
C.Nombre AS Cliente,
|
||||
C.RFC,
|
||||
CONCAT(
|
||||
C.Direccion,
|
||||
CASE
|
||||
WHEN NULLIF(LTRIM(RTRIM(C.NoExt)), '') IS NULL
|
||||
THEN ''
|
||||
ELSE CONCAT(' ', C.NoExt)
|
||||
END,
|
||||
CASE
|
||||
WHEN NULLIF(LTRIM(RTRIM(C.NoInt)), '') IS NULL
|
||||
THEN ''
|
||||
ELSE CONCAT(' Int. ', C.NoInt)
|
||||
END
|
||||
) AS Direccion,
|
||||
C.Colonia,
|
||||
CONCAT(C.Ciudad, ', ', C.Estado) AS CiudadEstado,
|
||||
C.CP,
|
||||
C.Telefono,
|
||||
C.Mail,
|
||||
S.Folio AS FolioSolicitud,
|
||||
E.Etapa,
|
||||
TT.TipoTramite,
|
||||
P.Nombre AS NombrePago,
|
||||
N'Remisión' AS TipoDocumento,
|
||||
ISNULL(V.Serie, 'TRA') AS Serie,
|
||||
ISNULL(
|
||||
V.Folio,
|
||||
ISNULL(
|
||||
(
|
||||
SELECT MAX(Venta.Folio) + 1
|
||||
FROM dbo.Ventas AS Venta
|
||||
WHERE Venta.TipoDocto = 'Rem'
|
||||
AND Venta.Serie = 'TRA'
|
||||
AND Venta.CveSubProyecto = @CveSubProyecto
|
||||
),
|
||||
1
|
||||
)
|
||||
) AS Folio,
|
||||
ISNULL(V.Fecha, GETDATE()) AS Fecha,
|
||||
ISNULL(V.CveMetodoPago33, ISNULL(V.CveMetodoPago, 2))
|
||||
AS CveMetodoPago,
|
||||
ISNULL(V.CveFormaPago33, ISNULL(V.FormaPago, 99))
|
||||
AS CveFormaPago,
|
||||
V.FechaVencimiento2 AS FechaVencimiento
|
||||
FROM dbo.Tra_Solicitudes AS S
|
||||
INNER JOIN dbo.Fraccionamientos AS F
|
||||
ON F.CveFraccionamiento = S.CveFraccionamiento
|
||||
INNER JOIN dbo.FraccionamientosEtapas AS E
|
||||
ON E.CveFraccionamientoEtapa = S.CveFraccionamientoEtapa
|
||||
INNER JOIN dbo.Tra_TiposTramite AS TT
|
||||
ON TT.CveTipoTramite = S.CveTipoTramite
|
||||
INNER JOIN dbo.Tra_Pagos AS P
|
||||
ON P.CveTramitePago = @CveTramitePago
|
||||
AND P.CveTipoTramite = S.CveTipoTramite
|
||||
INNER JOIN dbo.Clientes AS C
|
||||
ON C.CveCliente = F.CveCliente
|
||||
LEFT JOIN dbo.Tra_SolicitudesPagos AS SP
|
||||
ON SP.CveSolicitud = S.CveSolicitud
|
||||
AND SP.CveTramitePago = P.CveTramitePago
|
||||
LEFT JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1)
|
||||
Pago.CvePago,
|
||||
Pago.Autorizado,
|
||||
Pago.Referencia
|
||||
FROM dbo.Vta_Pagos AS Pago
|
||||
WHERE Pago.CveVenta = V.CveVenta
|
||||
AND Pago.CveSolicitud = S.CveSolicitud
|
||||
AND Pago.CveTramitePago = P.CveTramitePago
|
||||
AND Pago.EsActivo = 1
|
||||
ORDER BY Pago.CvePago DESC
|
||||
) AS VP
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1)
|
||||
D.CveCfdiDocumento,
|
||||
D.Estado,
|
||||
T.Uuid
|
||||
FROM dbo.Fac_CfdiDocumentos AS D
|
||||
LEFT JOIN dbo.Fac_CfdiTimbrados AS T
|
||||
ON T.CveCfdiTimbrado = D.CveCfdiTimbradoVigente
|
||||
WHERE D.TipoOrigen = 'VENTA'
|
||||
AND D.CveOrigen = V.CveVenta
|
||||
AND D.Estado IN ('TIMBRADO', 'CANCELADO')
|
||||
ORDER BY D.CveCfdiDocumento DESC
|
||||
) AS Documento
|
||||
WHERE S.CveSolicitud = @CveSolicitud;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar la venta del trámite; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Vta_TramiteContextoGet'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
1117
Fraccionamientos_Ventas_Conceptos_Timbrado_20260827.sql
Normal file
1117
Fraccionamientos_Ventas_Conceptos_Timbrado_20260827.sql
Normal file
File diff suppressed because it is too large
Load Diff
718
Fraccionamientos_Ventas_Flujo_Generar_Pagar_20260827.sql
Normal file
718
Fraccionamientos_Ventas_Flujo_Generar_Pagar_20260827.sql
Normal file
@@ -0,0 +1,718 @@
|
||||
SET ANSI_NULLS ON;
|
||||
SET QUOTED_IDENTIFIER ON;
|
||||
SET NOCOUNT ON;
|
||||
GO
|
||||
|
||||
UPDATE dbo.Vta_TipoDocumentos
|
||||
SET TipoDocumento = N'Remisión'
|
||||
WHERE CveTipoDocumento = 'Rem'
|
||||
AND TipoDocumento <> N'Remisión';
|
||||
GO
|
||||
|
||||
DECLARE @CveUsuarioSistema int =
|
||||
(
|
||||
SELECT TOP (1)
|
||||
CveUsuario
|
||||
FROM dbo.Sis_Usuarios
|
||||
WHERE Activo = 1
|
||||
ORDER BY CveUsuario
|
||||
);
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_FormaPago
|
||||
WHERE CveFormaPago = 99
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO dbo.Vta_FormaPago
|
||||
(
|
||||
CveFormaPago,
|
||||
FormaPago,
|
||||
ClaveFormaPagoSAT,
|
||||
CveUsuario,
|
||||
FechaIng
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
99,
|
||||
'Por definir',
|
||||
'99',
|
||||
@CveUsuarioSistema,
|
||||
CONVERT(date, GETDATE())
|
||||
);
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_MetodoPago
|
||||
WHERE CveMetodoPago = 2
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO dbo.Vta_MetodoPago
|
||||
(
|
||||
CveMetodoPago,
|
||||
MetodoPago,
|
||||
ClaveMetodoPagoSAT,
|
||||
CveUsuario,
|
||||
FechaIng
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
2,
|
||||
'Pago en parcialidades o diferido',
|
||||
'PPD',
|
||||
@CveUsuarioSistema,
|
||||
CONVERT(date, GETDATE())
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM sys.indexes
|
||||
WHERE object_id = OBJECT_ID('dbo.Vta_Pagos')
|
||||
AND name = 'UX_Vta_Pagos_SolicitudTramitePagoActivo'
|
||||
)
|
||||
BEGIN
|
||||
CREATE UNIQUE NONCLUSTERED INDEX UX_Vta_Pagos_SolicitudTramitePagoActivo
|
||||
ON dbo.Vta_Pagos
|
||||
(
|
||||
CveSolicitud,
|
||||
CveTramitePago
|
||||
)
|
||||
WHERE EsActivo = 1
|
||||
AND CveSolicitud IS NOT NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_FraccionamientoPagoPendienteList
|
||||
@CveFraccionamiento int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Fraccionamientos
|
||||
WHERE CveFraccionamiento = @CveFraccionamiento
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El fraccionamiento solicitado no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
;WITH Conceptos AS
|
||||
(
|
||||
SELECT
|
||||
S.CveSolicitud,
|
||||
P.CveTramitePago,
|
||||
COUNT_BIG(*) AS NumeroConceptos,
|
||||
SUM(
|
||||
ROUND(
|
||||
CONVERT(decimal(18, 4), D.Cantidad) *
|
||||
CONVERT(decimal(18, 4), PS.Precio),
|
||||
2
|
||||
)
|
||||
) AS SubTotal,
|
||||
SUM(
|
||||
ROUND(
|
||||
CONVERT(decimal(18, 4), D.Cantidad) *
|
||||
CONVERT(decimal(18, 4), PS.Precio) *
|
||||
CONVERT(decimal(18, 6), ISNULL(PS.IVA, 0)) / 100,
|
||||
2
|
||||
)
|
||||
) AS IVA
|
||||
FROM dbo.Tra_Solicitudes AS S
|
||||
INNER JOIN dbo.Tra_Pagos AS P
|
||||
ON P.CveTipoTramite = S.CveTipoTramite
|
||||
AND P.EsActivo = 1
|
||||
INNER JOIN dbo.Tra_PagosDetalle AS D
|
||||
ON D.CveTramitePago = P.CveTramitePago
|
||||
INNER JOIN dbo.ProductosServicios AS PS
|
||||
ON PS.CvePS = D.CvePS
|
||||
WHERE S.CveFraccionamiento = @CveFraccionamiento
|
||||
GROUP BY
|
||||
S.CveSolicitud,
|
||||
P.CveTramitePago
|
||||
)
|
||||
SELECT
|
||||
S.CveSolicitud,
|
||||
P.CveTramitePago,
|
||||
SP.CveVenta,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE
|
||||
WHEN SP.CveSolicitudPago IS NOT NULL
|
||||
AND V.CveVenta IS NOT NULL THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS VentaGenerada,
|
||||
S.Folio AS FolioSolicitud,
|
||||
E.Etapa,
|
||||
TT.TipoTramite,
|
||||
P.Nombre AS NombrePago,
|
||||
CONVERT(int, C.NumeroConceptos) AS NumeroConceptos,
|
||||
CONVERT(
|
||||
decimal(18, 2),
|
||||
CASE
|
||||
WHEN V.CveVenta IS NULL THEN C.SubTotal
|
||||
ELSE V.SubTotal
|
||||
END
|
||||
) AS SubTotal,
|
||||
CONVERT(
|
||||
decimal(18, 2),
|
||||
CASE
|
||||
WHEN V.CveVenta IS NULL THEN C.IVA
|
||||
ELSE V.IVA
|
||||
END
|
||||
) AS IVA,
|
||||
CONVERT(
|
||||
decimal(18, 2),
|
||||
CASE
|
||||
WHEN V.CveVenta IS NULL THEN C.SubTotal + C.IVA
|
||||
ELSE V.Total
|
||||
END
|
||||
) AS Total
|
||||
FROM Conceptos AS C
|
||||
INNER JOIN dbo.Tra_Solicitudes AS S
|
||||
ON S.CveSolicitud = C.CveSolicitud
|
||||
INNER JOIN dbo.FraccionamientosEtapas AS E
|
||||
ON E.CveFraccionamientoEtapa = S.CveFraccionamientoEtapa
|
||||
INNER JOIN dbo.Tra_TiposTramite AS TT
|
||||
ON TT.CveTipoTramite = S.CveTipoTramite
|
||||
INNER JOIN dbo.Tra_Pagos AS P
|
||||
ON P.CveTramitePago = C.CveTramitePago
|
||||
LEFT JOIN dbo.Tra_SolicitudesPagos AS SP
|
||||
ON SP.CveSolicitud = S.CveSolicitud
|
||||
AND SP.CveTramitePago = P.CveTramitePago
|
||||
LEFT JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_Pagos AS VP
|
||||
WHERE VP.CveSolicitud = S.CveSolicitud
|
||||
AND VP.CveTramitePago = P.CveTramitePago
|
||||
AND VP.CveVenta = SP.CveVenta
|
||||
AND VP.EsActivo = 1
|
||||
)
|
||||
ORDER BY
|
||||
E.Orden,
|
||||
S.CveSolicitud,
|
||||
P.Orden,
|
||||
P.CveTramitePago;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar los pagos pendientes; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_FraccionamientoPagoPendienteList'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_FraccionamientoPagoRealizadoList
|
||||
@CveFraccionamiento int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Fraccionamientos
|
||||
WHERE CveFraccionamiento = @CveFraccionamiento
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El fraccionamiento solicitado no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
SP.CveSolicitudPago,
|
||||
SP.CveSolicitud,
|
||||
SP.CveTramitePago,
|
||||
V.CveVenta,
|
||||
VP.CvePago,
|
||||
V.SerieFolio,
|
||||
V.Fecha,
|
||||
VP.FechaPago,
|
||||
VP.Referencia,
|
||||
S.Folio AS FolioSolicitud,
|
||||
E.Etapa,
|
||||
TT.TipoTramite,
|
||||
P.Nombre AS NombrePago,
|
||||
CONVERT(decimal(18, 2), V.SubTotal) AS SubTotal,
|
||||
CONVERT(decimal(18, 2), V.IVA) AS IVA,
|
||||
CONVERT(decimal(18, 2), VP.Importe) AS Total
|
||||
FROM dbo.Tra_SolicitudesPagos AS SP
|
||||
INNER JOIN dbo.Tra_Solicitudes AS S
|
||||
ON S.CveSolicitud = SP.CveSolicitud
|
||||
INNER JOIN dbo.FraccionamientosEtapas AS E
|
||||
ON E.CveFraccionamientoEtapa = S.CveFraccionamientoEtapa
|
||||
INNER JOIN dbo.Tra_TiposTramite AS TT
|
||||
ON TT.CveTipoTramite = S.CveTipoTramite
|
||||
INNER JOIN dbo.Tra_Pagos AS P
|
||||
ON P.CveTramitePago = SP.CveTramitePago
|
||||
INNER JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
INNER JOIN dbo.Vta_Pagos AS VP
|
||||
ON VP.CveVenta = V.CveVenta
|
||||
AND VP.CveSolicitud = SP.CveSolicitud
|
||||
AND VP.CveTramitePago = SP.CveTramitePago
|
||||
AND VP.EsActivo = 1
|
||||
WHERE S.CveFraccionamiento = @CveFraccionamiento
|
||||
ORDER BY
|
||||
VP.FechaPago DESC,
|
||||
VP.CvePago DESC;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar los pagos realizados; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_FraccionamientoPagoRealizadoList'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramiteContextoGet
|
||||
@CveSolicitud int,
|
||||
@CveTramitePago int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
DECLARE @CveSubProyecto int =
|
||||
(
|
||||
SELECT TOP (1)
|
||||
CveSubProyecto
|
||||
FROM dbo.SubProyectos
|
||||
WHERE Estatus = 1
|
||||
ORDER BY
|
||||
CASE WHEN Serie = 'TRA' THEN 0 ELSE 1 END,
|
||||
CveSubProyecto
|
||||
);
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Tra_Solicitudes AS S
|
||||
INNER JOIN dbo.Tra_Pagos AS P
|
||||
ON P.CveTramitePago = @CveTramitePago
|
||||
AND P.CveTipoTramite = S.CveTipoTramite
|
||||
AND P.EsActivo = 1
|
||||
INNER JOIN dbo.Tra_PagosDetalle AS D
|
||||
ON D.CveTramitePago = P.CveTramitePago
|
||||
WHERE S.CveSolicitud = @CveSolicitud
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El pago seleccionado no corresponde al trámite o no tiene conceptos activos.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
S.CveSolicitud,
|
||||
P.CveTramitePago,
|
||||
SP.CveVenta,
|
||||
VP.CvePago,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE
|
||||
WHEN SP.CveSolicitudPago IS NOT NULL
|
||||
AND V.CveVenta IS NOT NULL THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS VentaGenerada,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE
|
||||
WHEN VP.Autorizado = 1 THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS VentaPagada,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE
|
||||
WHEN VP.CvePago IS NOT NULL
|
||||
AND VP.Autorizado = 0
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS PagoPendienteAutorizacion,
|
||||
VP.Referencia AS ReferenciaPago,
|
||||
S.CveFraccionamiento,
|
||||
F.Fraccionamiento,
|
||||
F.CveCliente,
|
||||
C.Nombre AS Cliente,
|
||||
C.RFC,
|
||||
CONCAT(
|
||||
C.Direccion,
|
||||
CASE
|
||||
WHEN NULLIF(LTRIM(RTRIM(C.NoExt)), '') IS NULL THEN ''
|
||||
ELSE CONCAT(' ', C.NoExt)
|
||||
END,
|
||||
CASE
|
||||
WHEN NULLIF(LTRIM(RTRIM(C.NoInt)), '') IS NULL THEN ''
|
||||
ELSE CONCAT(' Int. ', C.NoInt)
|
||||
END
|
||||
) AS Direccion,
|
||||
C.Colonia,
|
||||
CONCAT(C.Ciudad, ', ', C.Estado) AS CiudadEstado,
|
||||
C.CP,
|
||||
C.Telefono,
|
||||
C.Mail,
|
||||
S.Folio AS FolioSolicitud,
|
||||
E.Etapa,
|
||||
TT.TipoTramite,
|
||||
P.Nombre AS NombrePago,
|
||||
N'Remisión' AS TipoDocumento,
|
||||
ISNULL(V.Serie, 'TRA') AS Serie,
|
||||
ISNULL(
|
||||
V.Folio,
|
||||
ISNULL(
|
||||
(
|
||||
SELECT MAX(Venta.Folio) + 1
|
||||
FROM dbo.Ventas AS Venta
|
||||
WHERE Venta.TipoDocto = 'Rem'
|
||||
AND Venta.Serie = 'TRA'
|
||||
AND Venta.CveSubProyecto = @CveSubProyecto
|
||||
),
|
||||
1
|
||||
)
|
||||
) AS Folio,
|
||||
ISNULL(V.Fecha, GETDATE()) AS Fecha,
|
||||
ISNULL(V.CveMetodoPago33, ISNULL(V.CveMetodoPago, 2))
|
||||
AS CveMetodoPago,
|
||||
ISNULL(V.CveFormaPago33, ISNULL(V.FormaPago, 99))
|
||||
AS CveFormaPago,
|
||||
V.FechaVencimiento2 AS FechaVencimiento
|
||||
FROM dbo.Tra_Solicitudes AS S
|
||||
INNER JOIN dbo.Fraccionamientos AS F
|
||||
ON F.CveFraccionamiento = S.CveFraccionamiento
|
||||
INNER JOIN dbo.FraccionamientosEtapas AS E
|
||||
ON E.CveFraccionamientoEtapa = S.CveFraccionamientoEtapa
|
||||
INNER JOIN dbo.Tra_TiposTramite AS TT
|
||||
ON TT.CveTipoTramite = S.CveTipoTramite
|
||||
INNER JOIN dbo.Tra_Pagos AS P
|
||||
ON P.CveTramitePago = @CveTramitePago
|
||||
AND P.CveTipoTramite = S.CveTipoTramite
|
||||
INNER JOIN dbo.Clientes AS C
|
||||
ON C.CveCliente = F.CveCliente
|
||||
LEFT JOIN dbo.Tra_SolicitudesPagos AS SP
|
||||
ON SP.CveSolicitud = S.CveSolicitud
|
||||
AND SP.CveTramitePago = P.CveTramitePago
|
||||
LEFT JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1)
|
||||
Pago.CvePago,
|
||||
Pago.Autorizado,
|
||||
Pago.Referencia
|
||||
FROM dbo.Vta_Pagos AS Pago
|
||||
WHERE Pago.CveVenta = V.CveVenta
|
||||
AND Pago.CveSolicitud = S.CveSolicitud
|
||||
AND Pago.CveTramitePago = P.CveTramitePago
|
||||
AND Pago.EsActivo = 1
|
||||
ORDER BY Pago.CvePago DESC
|
||||
) AS VP
|
||||
WHERE S.CveSolicitud = @CveSolicitud;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar la venta del trámite; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_TramiteContextoGet'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramitePagoSave
|
||||
@CveSolicitud int,
|
||||
@CveTramitePago int,
|
||||
@Referencia varchar(200) = NULL,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
DECLARE
|
||||
@CveVenta int,
|
||||
@CveCliente int,
|
||||
@Importe decimal(18, 2),
|
||||
@CvePago int,
|
||||
@FechaPago datetime = GETDATE();
|
||||
|
||||
SELECT
|
||||
@CveVenta = V.CveVenta,
|
||||
@CveCliente = V.CveCliente,
|
||||
@Importe = CONVERT(decimal(18, 2), V.Total)
|
||||
FROM dbo.Tra_SolicitudesPagos AS SP
|
||||
INNER JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
WHERE SP.CveSolicitud = @CveSolicitud
|
||||
AND SP.CveTramitePago = @CveTramitePago;
|
||||
|
||||
IF @CveVenta IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Primero debe generar la venta del trámite.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_Pagos WITH (UPDLOCK, HOLDLOCK)
|
||||
WHERE CveSolicitud = @CveSolicitud
|
||||
AND CveTramitePago = @CveTramitePago
|
||||
AND CveVenta = @CveVenta
|
||||
AND EsActivo = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La venta del trámite ya se encuentra pagada.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_FormaPago
|
||||
WHERE CveFormaPago = 99
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La forma de pago por definir no está configurada; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
INSERT INTO dbo.Vta_Pagos
|
||||
(
|
||||
CveCliente,
|
||||
CveVenta,
|
||||
CveSolicitud,
|
||||
CveFormaPago,
|
||||
CveMoneda,
|
||||
CvePrePoliza,
|
||||
FechaPago,
|
||||
Importe,
|
||||
Referencia,
|
||||
EsSaldoFavor,
|
||||
EsActivo,
|
||||
FechaAlta,
|
||||
CveUsuario,
|
||||
CveTramitePago
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@CveCliente,
|
||||
@CveVenta,
|
||||
@CveSolicitud,
|
||||
99,
|
||||
1,
|
||||
NULL,
|
||||
@FechaPago,
|
||||
@Importe,
|
||||
NULLIF(LTRIM(RTRIM(@Referencia)), ''),
|
||||
0,
|
||||
1,
|
||||
@FechaPago,
|
||||
@CveUsuarioEjecuta,
|
||||
@CveTramitePago
|
||||
);
|
||||
|
||||
SET @CvePago = CONVERT(int, SCOPE_IDENTITY());
|
||||
|
||||
UPDATE dbo.Ventas
|
||||
SET
|
||||
CveMetodoPago = 2,
|
||||
FormaPago = 99,
|
||||
CveFormaPago33 = 99,
|
||||
CveMetodoPago33 = 2,
|
||||
FechaCobranza = @FechaPago,
|
||||
CveUsuarioCobranza = @CveUsuarioEjecuta
|
||||
WHERE CveVenta = @CveVenta;
|
||||
|
||||
SELECT @CvePago AS CvePago;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al registrar el pago de la venta; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_TramitePagoSave'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramiteVentaGenerar
|
||||
@CveSolicitud int,
|
||||
@CveTramitePago int,
|
||||
@Observaciones varchar(2000) = NULL,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Tra_SolicitudesPagos AS SP
|
||||
INNER JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
WHERE SP.CveSolicitud = @CveSolicitud
|
||||
AND SP.CveTramitePago = @CveTramitePago
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'La venta del trámite ya fue generada.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
EXEC dbo.PA_Vta_TramiteVentaSave
|
||||
@CveSolicitud = @CveSolicitud,
|
||||
@CveTramitePago = @CveTramitePago,
|
||||
@Observaciones = @Observaciones,
|
||||
@CveUsuarioEjecuta = @CveUsuarioEjecuta,
|
||||
@ErrorMostrar = @ErrorMostrar OUTPUT,
|
||||
@ErrorTipo = @ErrorTipo OUTPUT,
|
||||
@Return = @Return OUTPUT;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al generar la venta del trámite; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_TramiteVentaGenerar'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
826
Fraccionamientos_Ventas_Pago_Captura_20260828.sql
Normal file
826
Fraccionamientos_Ventas_Pago_Captura_20260828.sql
Normal file
@@ -0,0 +1,826 @@
|
||||
SET NOCOUNT ON;
|
||||
GO
|
||||
|
||||
DECLARE @CveUsuarioCatalogoPago int =
|
||||
(
|
||||
SELECT TOP (1) CveUsuario
|
||||
FROM dbo.Sis_Usuarios
|
||||
WHERE Activo = 1
|
||||
ORDER BY CveUsuario
|
||||
);
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_FormaPago
|
||||
WHERE ClaveFormaPagoSAT = '01'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO dbo.Vta_FormaPago
|
||||
(
|
||||
CveFormaPago,
|
||||
FormaPago,
|
||||
ClaveFormaPagoSAT,
|
||||
CveUsuario,
|
||||
FechaIng
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
1,
|
||||
'Efectivo',
|
||||
'01',
|
||||
@CveUsuarioCatalogoPago,
|
||||
CONVERT(date, GETDATE())
|
||||
);
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_FormaPago
|
||||
WHERE ClaveFormaPagoSAT = '03'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO dbo.Vta_FormaPago
|
||||
(
|
||||
CveFormaPago,
|
||||
FormaPago,
|
||||
ClaveFormaPagoSAT,
|
||||
CveUsuario,
|
||||
FechaIng
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
3,
|
||||
'Transferencia electrónica de fondos',
|
||||
'03',
|
||||
@CveUsuarioCatalogoPago,
|
||||
CONVERT(date, GETDATE())
|
||||
);
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_FormaPago
|
||||
WHERE ClaveFormaPagoSAT = '04'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO dbo.Vta_FormaPago
|
||||
(
|
||||
CveFormaPago,
|
||||
FormaPago,
|
||||
ClaveFormaPagoSAT,
|
||||
CveUsuario,
|
||||
FechaIng
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
4,
|
||||
'Tarjeta de crédito',
|
||||
'04',
|
||||
@CveUsuarioCatalogoPago,
|
||||
CONVERT(date, GETDATE())
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
UPDATE V
|
||||
SET
|
||||
CveMetodoPago = ISNULL(V.CveMetodoPago, 2),
|
||||
CveMetodoPago33 = ISNULL(V.CveMetodoPago33, 2),
|
||||
FormaPago = ISNULL(V.FormaPago, 99),
|
||||
CveFormaPago33 = ISNULL(V.CveFormaPago33, 99),
|
||||
FechaVencimiento2 = ISNULL(
|
||||
V.FechaVencimiento2,
|
||||
CONVERT(date, V.Fecha)
|
||||
)
|
||||
FROM dbo.Ventas AS V
|
||||
INNER JOIN dbo.Tra_SolicitudesPagos AS SP
|
||||
ON SP.CveVenta = V.CveVenta
|
||||
WHERE V.CveMetodoPago IS NULL
|
||||
OR V.CveMetodoPago33 IS NULL
|
||||
OR V.FormaPago IS NULL
|
||||
OR V.CveFormaPago33 IS NULL
|
||||
OR V.FechaVencimiento2 IS NULL;
|
||||
GO
|
||||
|
||||
IF COL_LENGTH('dbo.Vta_Pagos', 'CveBancoCuenta') IS NULL
|
||||
BEGIN
|
||||
ALTER TABLE dbo.Vta_Pagos
|
||||
ADD CveBancoCuenta int NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF COL_LENGTH('dbo.Vta_Pagos', 'Observaciones') IS NULL
|
||||
BEGIN
|
||||
ALTER TABLE dbo.Vta_Pagos
|
||||
ADD Observaciones varchar(300) COLLATE Modern_Spanish_CS_AS NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF COL_LENGTH('dbo.Vta_Pagos', 'Autorizado') IS NULL
|
||||
BEGIN
|
||||
ALTER TABLE dbo.Vta_Pagos
|
||||
ADD Autorizado bit NOT NULL
|
||||
CONSTRAINT DF_Vta_Pagos_Autorizado DEFAULT (0) WITH VALUES;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF COL_LENGTH('dbo.Vta_Pagos', 'FechaAutorizacion') IS NULL
|
||||
BEGIN
|
||||
ALTER TABLE dbo.Vta_Pagos
|
||||
ADD FechaAutorizacion datetime NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF COL_LENGTH('dbo.Vta_Pagos', 'CveUsuarioAutoriza') IS NULL
|
||||
BEGIN
|
||||
ALTER TABLE dbo.Vta_Pagos
|
||||
ADD CveUsuarioAutoriza int NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM sys.foreign_keys
|
||||
WHERE parent_object_id = OBJECT_ID('dbo.Vta_Pagos')
|
||||
AND name = 'FK_Vta_Pagos_Banc_BancosCuentas'
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE dbo.Vta_Pagos WITH CHECK
|
||||
ADD CONSTRAINT FK_Vta_Pagos_Banc_BancosCuentas
|
||||
FOREIGN KEY (CveBancoCuenta)
|
||||
REFERENCES dbo.Banc_BancosCuentas (CveBancoCuenta);
|
||||
|
||||
ALTER TABLE dbo.Vta_Pagos
|
||||
CHECK CONSTRAINT FK_Vta_Pagos_Banc_BancosCuentas;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM sys.foreign_keys
|
||||
WHERE parent_object_id = OBJECT_ID('dbo.Vta_Pagos')
|
||||
AND name = 'FK_Vta_Pagos_Sis_Usuarios_Autoriza'
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE dbo.Vta_Pagos WITH CHECK
|
||||
ADD CONSTRAINT FK_Vta_Pagos_Sis_Usuarios_Autoriza
|
||||
FOREIGN KEY (CveUsuarioAutoriza)
|
||||
REFERENCES dbo.Sis_Usuarios (CveUsuario);
|
||||
|
||||
ALTER TABLE dbo.Vta_Pagos
|
||||
CHECK CONSTRAINT FK_Vta_Pagos_Sis_Usuarios_Autoriza;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM sys.check_constraints
|
||||
WHERE parent_object_id = OBJECT_ID('dbo.Vta_Pagos')
|
||||
AND name = 'CK_Vta_Pagos_Autorizacion'
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE dbo.Vta_Pagos WITH CHECK
|
||||
ADD CONSTRAINT CK_Vta_Pagos_Autorizacion
|
||||
CHECK
|
||||
(
|
||||
(
|
||||
Autorizado = 0
|
||||
AND FechaAutorizacion IS NULL
|
||||
AND CveUsuarioAutoriza IS NULL
|
||||
)
|
||||
OR
|
||||
(
|
||||
Autorizado = 1
|
||||
AND FechaAutorizacion IS NOT NULL
|
||||
AND CveUsuarioAutoriza IS NOT NULL
|
||||
)
|
||||
);
|
||||
|
||||
ALTER TABLE dbo.Vta_Pagos
|
||||
CHECK CONSTRAINT CK_Vta_Pagos_Autorizacion;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramitePagoOpcionesList
|
||||
@CveSolicitud int,
|
||||
@CveTramitePago int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
DECLARE @CveVenta int;
|
||||
|
||||
SELECT @CveVenta = V.CveVenta
|
||||
FROM dbo.Tra_SolicitudesPagos AS SP
|
||||
INNER JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
WHERE SP.CveSolicitud = @CveSolicitud
|
||||
AND SP.CveTramitePago = @CveTramitePago;
|
||||
|
||||
IF @CveVenta IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Primero debe generar la venta del trámite.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
@CveVenta AS CveVenta,
|
||||
CONCAT(
|
||||
'TRA-',
|
||||
RIGHT(
|
||||
REPLICATE('0', 10) +
|
||||
CONVERT(varchar(10), @CveVenta),
|
||||
10
|
||||
)
|
||||
) AS ReferenciaPago;
|
||||
|
||||
SELECT
|
||||
FP.CveFormaPago,
|
||||
FP.ClaveFormaPagoSAT,
|
||||
CASE
|
||||
WHEN NULLIF(LTRIM(RTRIM(FP.ClaveFormaPagoSAT)), '') IS NULL
|
||||
THEN FP.FormaPago
|
||||
ELSE
|
||||
FP.ClaveFormaPagoSAT COLLATE Modern_Spanish_CS_AS
|
||||
+ ' - '
|
||||
+ FP.FormaPago COLLATE Modern_Spanish_CS_AS
|
||||
END AS FormaPago,
|
||||
CONVERT(
|
||||
bit,
|
||||
CASE
|
||||
WHEN FP.ClaveFormaPagoSAT = '04' THEN 0
|
||||
ELSE 1
|
||||
END
|
||||
) AS Disponible
|
||||
FROM dbo.Vta_FormaPago AS FP
|
||||
WHERE FP.ClaveFormaPagoSAT IN ('01', '03', '04')
|
||||
ORDER BY
|
||||
FP.ClaveFormaPagoSAT COLLATE Modern_Spanish_CS_AS,
|
||||
FP.FormaPago COLLATE Modern_Spanish_CS_AS,
|
||||
FP.CveFormaPago;
|
||||
|
||||
SELECT
|
||||
BC.CveBancoCuenta,
|
||||
B.Banco,
|
||||
BC.NumCuenta AS NumeroCuenta,
|
||||
BC.CLABE,
|
||||
B.Banco COLLATE Modern_Spanish_CS_AS
|
||||
+ ' - '
|
||||
+ BC.NumCuenta COLLATE Modern_Spanish_CS_AS
|
||||
+ CASE
|
||||
WHEN NULLIF(LTRIM(RTRIM(BC.CLABE)), '') IS NULL
|
||||
THEN ''
|
||||
ELSE
|
||||
' (CLABE '
|
||||
+ BC.CLABE COLLATE Modern_Spanish_CS_AS
|
||||
+ ')'
|
||||
END AS CuentaBancaria
|
||||
FROM dbo.Banc_BancosCuentas AS BC
|
||||
INNER JOIN dbo.Banc_Bancos AS B
|
||||
ON B.CveBanco = BC.CveBanco
|
||||
WHERE BC.Estatus = 1
|
||||
AND B.Estatus = 1
|
||||
AND NULLIF(LTRIM(RTRIM(BC.CLABE)), '') IS NOT NULL
|
||||
ORDER BY
|
||||
B.Banco COLLATE Modern_Spanish_CS_AS,
|
||||
BC.NumCuenta COLLATE Modern_Spanish_CS_AS,
|
||||
BC.CveBancoCuenta;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar las opciones de pago; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_TramitePagoOpcionesList'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramitePagoSave
|
||||
@CveSolicitud int,
|
||||
@CveTramitePago int,
|
||||
@Importe decimal(18, 2),
|
||||
@FechaPago datetime,
|
||||
@CveFormaPago tinyint,
|
||||
@CveBancoCuenta int = NULL,
|
||||
@Observaciones varchar(300) = NULL,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
DECLARE
|
||||
@CveVenta int,
|
||||
@CveCliente int,
|
||||
@TotalVenta decimal(18, 2),
|
||||
@CvePago int,
|
||||
@ClaveFormaPagoSAT varchar(2),
|
||||
@Referencia varchar(200);
|
||||
|
||||
SELECT
|
||||
@CveVenta = V.CveVenta,
|
||||
@CveCliente = V.CveCliente,
|
||||
@TotalVenta = CONVERT(decimal(18, 2), V.Total)
|
||||
FROM dbo.Tra_SolicitudesPagos AS SP
|
||||
INNER JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
WHERE SP.CveSolicitud = @CveSolicitud
|
||||
AND SP.CveTramitePago = @CveTramitePago;
|
||||
|
||||
IF @CveVenta IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Primero debe generar la venta del trámite.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_Pagos WITH (UPDLOCK, HOLDLOCK)
|
||||
WHERE CveSolicitud = @CveSolicitud
|
||||
AND CveTramitePago = @CveTramitePago
|
||||
AND CveVenta = @CveVenta
|
||||
AND EsActivo = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ya existe una solicitud de pago activa para esta venta.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @Importe IS NULL OR @Importe <= 0
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture un monto de pago mayor que cero.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @Importe <> @TotalVenta
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = CONCAT(
|
||||
'El pago debe cubrir el saldo completo de ',
|
||||
FORMAT(@TotalVenta, 'C', 'es-MX'),
|
||||
'.'
|
||||
),
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @FechaPago IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture la fecha del pago.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT @ClaveFormaPagoSAT = ClaveFormaPagoSAT
|
||||
FROM dbo.Vta_FormaPago
|
||||
WHERE CveFormaPago = @CveFormaPago;
|
||||
|
||||
IF @ClaveFormaPagoSAT IS NULL
|
||||
OR @ClaveFormaPagoSAT NOT IN ('01', '03', '04')
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione una forma de pago válida.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @ClaveFormaPagoSAT = '04'
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El pago con tarjeta todavía no está disponible.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @ClaveFormaPagoSAT = '03'
|
||||
AND @CveBancoCuenta IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione la cuenta SPEI donde se recibirá la transferencia.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @ClaveFormaPagoSAT = '01'
|
||||
BEGIN
|
||||
SET @CveBancoCuenta = NULL;
|
||||
END;
|
||||
|
||||
IF @CveBancoCuenta IS NOT NULL
|
||||
AND NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Banc_BancosCuentas AS BC
|
||||
INNER JOIN dbo.Banc_Bancos AS B
|
||||
ON B.CveBanco = BC.CveBanco
|
||||
WHERE BC.CveBancoCuenta = @CveBancoCuenta
|
||||
AND BC.Estatus = 1
|
||||
AND B.Estatus = 1
|
||||
AND NULLIF(LTRIM(RTRIM(BC.CLABE)), '') IS NOT NULL
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione una cuenta bancaria activa.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SET @Referencia = CONCAT(
|
||||
'TRA-',
|
||||
RIGHT(
|
||||
REPLICATE('0', 10) +
|
||||
CONVERT(varchar(10), @CveVenta),
|
||||
10
|
||||
)
|
||||
);
|
||||
|
||||
INSERT INTO dbo.Vta_Pagos
|
||||
(
|
||||
CveCliente,
|
||||
CveVenta,
|
||||
CveSolicitud,
|
||||
CveFormaPago,
|
||||
CveMoneda,
|
||||
CvePrePoliza,
|
||||
FechaPago,
|
||||
Importe,
|
||||
Referencia,
|
||||
EsSaldoFavor,
|
||||
EsActivo,
|
||||
FechaAlta,
|
||||
CveUsuario,
|
||||
CveTramitePago,
|
||||
CveBancoCuenta,
|
||||
Observaciones,
|
||||
Autorizado,
|
||||
FechaAutorizacion,
|
||||
CveUsuarioAutoriza
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@CveCliente,
|
||||
@CveVenta,
|
||||
@CveSolicitud,
|
||||
@CveFormaPago,
|
||||
1,
|
||||
NULL,
|
||||
@FechaPago,
|
||||
@Importe,
|
||||
@Referencia,
|
||||
0,
|
||||
1,
|
||||
GETDATE(),
|
||||
@CveUsuarioEjecuta,
|
||||
@CveTramitePago,
|
||||
@CveBancoCuenta,
|
||||
NULLIF(LTRIM(RTRIM(@Observaciones)), ''),
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
SET @CvePago = CONVERT(int, SCOPE_IDENTITY());
|
||||
|
||||
SELECT
|
||||
@CvePago AS CvePago,
|
||||
@Referencia AS Referencia,
|
||||
CONVERT(bit, 0) AS Autorizado;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al registrar el pago de la venta; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_TramitePagoSave'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramiteCondicionesPagoOpcionesList
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
MP.CveMetodoPago,
|
||||
MP.MetodoPago,
|
||||
MP.ClaveMetodoPagoSAT,
|
||||
MP.ClaveMetodoPagoSAT COLLATE Modern_Spanish_CS_AS
|
||||
+ ' - '
|
||||
+ MP.MetodoPago COLLATE Modern_Spanish_CS_AS AS Descripcion
|
||||
FROM dbo.Vta_MetodoPago AS MP
|
||||
ORDER BY MP.ClaveMetodoPagoSAT, MP.CveMetodoPago;
|
||||
|
||||
SELECT
|
||||
FP.CveFormaPago,
|
||||
FP.ClaveFormaPagoSAT,
|
||||
FP.ClaveFormaPagoSAT COLLATE Modern_Spanish_CS_AS
|
||||
+ ' - '
|
||||
+ FP.FormaPago COLLATE Modern_Spanish_CS_AS AS FormaPago,
|
||||
CONVERT(bit, 1) AS Disponible
|
||||
FROM dbo.Vta_FormaPago AS FP
|
||||
ORDER BY FP.ClaveFormaPagoSAT, FP.CveFormaPago;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar las condiciones de pago; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_TramiteCondicionesPagoOpcionesList'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_TramiteCondicionesPagoSave
|
||||
@CveSolicitud int,
|
||||
@CveTramitePago int,
|
||||
@CveMetodoPago int,
|
||||
@CveFormaPago tinyint,
|
||||
@FechaVencimiento date,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
DECLARE @CveVenta int;
|
||||
|
||||
SELECT @CveVenta = V.CveVenta
|
||||
FROM dbo.Tra_SolicitudesPagos AS SP
|
||||
INNER JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
WHERE SP.CveSolicitud = @CveSolicitud
|
||||
AND SP.CveTramitePago = @CveTramitePago;
|
||||
|
||||
IF @CveVenta IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Primero debe generar la venta del trámite.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Ventas
|
||||
WHERE CveVenta = @CveVenta
|
||||
AND SeTimbro = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Las condiciones de una venta timbrada no se pueden modificar.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_MetodoPago
|
||||
WHERE CveMetodoPago = @CveMetodoPago
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione un método de pago válido.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Vta_FormaPago
|
||||
WHERE CveFormaPago = @CveFormaPago
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione una forma de pago válida.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF @FechaVencimiento IS NULL
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture una fecha de vencimiento válida.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
UPDATE dbo.Ventas
|
||||
SET
|
||||
CveMetodoPago = @CveMetodoPago,
|
||||
CveMetodoPago33 = @CveMetodoPago,
|
||||
FormaPago = @CveFormaPago,
|
||||
CveFormaPago33 = @CveFormaPago,
|
||||
FechaVencimiento2 = @FechaVencimiento,
|
||||
CveUsuarioModifico = @CveUsuarioEjecuta
|
||||
WHERE CveVenta = @CveVenta;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al actualizar las condiciones de pago; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_TramiteCondicionesPagoSave'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Vta_FraccionamientoPagoRealizadoList
|
||||
@CveFraccionamiento int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Fraccionamientos
|
||||
WHERE CveFraccionamiento = @CveFraccionamiento
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El fraccionamiento solicitado no existe.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
SP.CveSolicitudPago,
|
||||
SP.CveSolicitud,
|
||||
SP.CveTramitePago,
|
||||
V.CveVenta,
|
||||
VP.CvePago,
|
||||
V.SerieFolio,
|
||||
V.Fecha,
|
||||
VP.FechaPago,
|
||||
VP.Referencia,
|
||||
VP.Autorizado,
|
||||
VP.FechaAutorizacion,
|
||||
S.Folio AS FolioSolicitud,
|
||||
E.Etapa,
|
||||
TT.TipoTramite,
|
||||
P.Nombre AS NombrePago,
|
||||
CONVERT(decimal(18, 2), V.SubTotal) AS SubTotal,
|
||||
CONVERT(decimal(18, 2), V.IVA) AS IVA,
|
||||
CONVERT(decimal(18, 2), VP.Importe) AS Total
|
||||
FROM dbo.Tra_SolicitudesPagos AS SP
|
||||
INNER JOIN dbo.Tra_Solicitudes AS S
|
||||
ON S.CveSolicitud = SP.CveSolicitud
|
||||
INNER JOIN dbo.FraccionamientosEtapas AS E
|
||||
ON E.CveFraccionamientoEtapa = S.CveFraccionamientoEtapa
|
||||
INNER JOIN dbo.Tra_TiposTramite AS TT
|
||||
ON TT.CveTipoTramite = S.CveTipoTramite
|
||||
INNER JOIN dbo.Tra_Pagos AS P
|
||||
ON P.CveTramitePago = SP.CveTramitePago
|
||||
INNER JOIN dbo.Ventas AS V
|
||||
ON V.CveVenta = SP.CveVenta
|
||||
INNER JOIN dbo.Vta_Pagos AS VP
|
||||
ON VP.CveVenta = V.CveVenta
|
||||
AND VP.CveSolicitud = SP.CveSolicitud
|
||||
AND VP.CveTramitePago = SP.CveTramitePago
|
||||
AND VP.EsActivo = 1
|
||||
WHERE S.CveFraccionamiento = @CveFraccionamiento
|
||||
ORDER BY
|
||||
VP.FechaPago DESC,
|
||||
VP.CvePago DESC;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar los pagos realizados; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Vta_FraccionamientoPagoRealizadoList'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
1013
Fraccionamientos_Ventas_Tramites_20260827.sql
Normal file
1013
Fraccionamientos_Ventas_Tramites_20260827.sql
Normal file
File diff suppressed because it is too large
Load Diff
310
Menu_Catalogos_Productos.sql
Normal file
310
Menu_Catalogos_Productos.sql
Normal file
@@ -0,0 +1,310 @@
|
||||
SET NOCOUNT ON;
|
||||
SET XACT_ABORT ON;
|
||||
|
||||
BEGIN TRY
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
DECLARE @CvePlataforma int;
|
||||
DECLARE @CveCatalogos int;
|
||||
DECLARE @CveProductosGrupo int;
|
||||
DECLARE @CveProductos int;
|
||||
DECLARE @CveUnidadesMedida int;
|
||||
DECLARE @CveClasificacion int;
|
||||
|
||||
SELECT TOP (1)
|
||||
@CvePlataforma = CvePlataforma
|
||||
FROM dbo.Sis_Plataformas
|
||||
WHERE NombrePlataforma = 'Plataforma de Desarrolladores'
|
||||
ORDER BY CvePlataforma;
|
||||
|
||||
SELECT TOP (1)
|
||||
@CveCatalogos = CveModulo
|
||||
FROM dbo.Sis_Modulos
|
||||
WHERE CvePlataforma = @CvePlataforma
|
||||
AND CveModuloPadre IS NULL
|
||||
AND NombreModulo = 'Catálogos'
|
||||
AND Activo = 1
|
||||
ORDER BY CveModulo;
|
||||
|
||||
IF @CveCatalogos IS NULL
|
||||
BEGIN
|
||||
THROW 50001, 'No se encontró el módulo Catálogos.', 1;
|
||||
END;
|
||||
|
||||
SELECT TOP (1)
|
||||
@CveProductos = CveModulo
|
||||
FROM dbo.Sis_Modulos
|
||||
WHERE CvePlataforma = @CvePlataforma
|
||||
AND LOWER(ISNULL(Url, '')) =
|
||||
LOWER('~/Pages/Catalogos/ProductosServicios.aspx')
|
||||
COLLATE Modern_Spanish_CS_AS
|
||||
ORDER BY CveModulo;
|
||||
|
||||
SELECT TOP (1)
|
||||
@CveProductosGrupo = CveModulo
|
||||
FROM dbo.Sis_Modulos
|
||||
WHERE CvePlataforma = @CvePlataforma
|
||||
AND CveModuloPadre = @CveCatalogos
|
||||
AND Url IS NULL
|
||||
AND NombreModulo = 'Productos'
|
||||
ORDER BY CveModulo;
|
||||
|
||||
IF @CveProductosGrupo IS NULL
|
||||
BEGIN
|
||||
INSERT dbo.Sis_Modulos
|
||||
(
|
||||
CveModuloPadre,
|
||||
CvePlataforma,
|
||||
NombreModulo,
|
||||
Descripcion,
|
||||
Url,
|
||||
ClaseCssIcono,
|
||||
ClaseCssEstilo,
|
||||
OrdenVisualizacion,
|
||||
Visible,
|
||||
Activo,
|
||||
FechaCreacion
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@CveCatalogos,
|
||||
@CvePlataforma,
|
||||
'Productos',
|
||||
'Catálogos de productos',
|
||||
NULL,
|
||||
'fa fa-cubes',
|
||||
NULL,
|
||||
50,
|
||||
1,
|
||||
1,
|
||||
GETDATE()
|
||||
);
|
||||
|
||||
SET @CveProductosGrupo = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
UPDATE dbo.Sis_Modulos
|
||||
SET Descripcion = 'Catálogos de productos',
|
||||
ClaseCssIcono = 'fa fa-cubes',
|
||||
OrdenVisualizacion = 50,
|
||||
Visible = 1,
|
||||
Activo = 1,
|
||||
FechaActualizacion = GETDATE()
|
||||
WHERE CveModulo = @CveProductosGrupo;
|
||||
END;
|
||||
|
||||
IF @CveProductos IS NULL
|
||||
BEGIN
|
||||
INSERT dbo.Sis_Modulos
|
||||
(
|
||||
CveModuloPadre,
|
||||
CvePlataforma,
|
||||
NombreModulo,
|
||||
Descripcion,
|
||||
Url,
|
||||
ClaseCssIcono,
|
||||
ClaseCssEstilo,
|
||||
OrdenVisualizacion,
|
||||
Visible,
|
||||
Activo,
|
||||
FechaCreacion
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@CveProductosGrupo,
|
||||
@CvePlataforma,
|
||||
'Productos',
|
||||
'Productos y servicios',
|
||||
'~/Pages/Catalogos/ProductosServicios.aspx',
|
||||
'fa fa-cube',
|
||||
NULL,
|
||||
10,
|
||||
1,
|
||||
1,
|
||||
GETDATE()
|
||||
);
|
||||
|
||||
SET @CveProductos = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
UPDATE dbo.Sis_Modulos
|
||||
SET CveModuloPadre = @CveProductosGrupo,
|
||||
NombreModulo = 'Productos',
|
||||
Descripcion = 'Productos y servicios',
|
||||
ClaseCssIcono = 'fa fa-cube',
|
||||
OrdenVisualizacion = 10,
|
||||
Visible = 1,
|
||||
Activo = 1,
|
||||
FechaActualizacion = GETDATE()
|
||||
WHERE CveModulo = @CveProductos;
|
||||
END;
|
||||
|
||||
SELECT TOP (1)
|
||||
@CveUnidadesMedida = CveModulo
|
||||
FROM dbo.Sis_Modulos
|
||||
WHERE CvePlataforma = @CvePlataforma
|
||||
AND LOWER(ISNULL(Url, '')) =
|
||||
LOWER('~/Pages/Catalogos/UnidadesMedida.aspx')
|
||||
COLLATE Modern_Spanish_CS_AS
|
||||
ORDER BY CveModulo;
|
||||
|
||||
IF @CveUnidadesMedida IS NULL
|
||||
BEGIN
|
||||
INSERT dbo.Sis_Modulos
|
||||
(
|
||||
CveModuloPadre,
|
||||
CvePlataforma,
|
||||
NombreModulo,
|
||||
Descripcion,
|
||||
Url,
|
||||
ClaseCssIcono,
|
||||
ClaseCssEstilo,
|
||||
OrdenVisualizacion,
|
||||
Visible,
|
||||
Activo,
|
||||
FechaCreacion
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@CveProductosGrupo,
|
||||
@CvePlataforma,
|
||||
'Unidades de medida',
|
||||
'Catálogo de unidades de medida',
|
||||
'~/Pages/Catalogos/UnidadesMedida.aspx',
|
||||
'fa fa-balance-scale',
|
||||
NULL,
|
||||
20,
|
||||
1,
|
||||
1,
|
||||
GETDATE()
|
||||
);
|
||||
|
||||
SET @CveUnidadesMedida = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
UPDATE dbo.Sis_Modulos
|
||||
SET CveModuloPadre = @CveProductosGrupo,
|
||||
NombreModulo = 'Unidades de medida',
|
||||
Descripcion = 'Catálogo de unidades de medida',
|
||||
ClaseCssIcono = 'fa fa-balance-scale',
|
||||
OrdenVisualizacion = 20,
|
||||
Visible = 1,
|
||||
Activo = 1,
|
||||
FechaActualizacion = GETDATE()
|
||||
WHERE CveModulo = @CveUnidadesMedida;
|
||||
END;
|
||||
|
||||
SELECT TOP (1)
|
||||
@CveClasificacion = CveModulo
|
||||
FROM dbo.Sis_Modulos
|
||||
WHERE CvePlataforma = @CvePlataforma
|
||||
AND LOWER(ISNULL(Url, '')) =
|
||||
LOWER('~/Pages/Catalogos/Clasificaciones.aspx')
|
||||
COLLATE Modern_Spanish_CS_AS
|
||||
ORDER BY CveModulo;
|
||||
|
||||
IF @CveClasificacion IS NULL
|
||||
BEGIN
|
||||
INSERT dbo.Sis_Modulos
|
||||
(
|
||||
CveModuloPadre,
|
||||
CvePlataforma,
|
||||
NombreModulo,
|
||||
Descripcion,
|
||||
Url,
|
||||
ClaseCssIcono,
|
||||
ClaseCssEstilo,
|
||||
OrdenVisualizacion,
|
||||
Visible,
|
||||
Activo,
|
||||
FechaCreacion
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@CveProductosGrupo,
|
||||
@CvePlataforma,
|
||||
'Clasificación',
|
||||
'Catálogo de clasificaciones',
|
||||
'~/Pages/Catalogos/Clasificaciones.aspx',
|
||||
'fa fa-tags',
|
||||
NULL,
|
||||
30,
|
||||
1,
|
||||
1,
|
||||
GETDATE()
|
||||
);
|
||||
|
||||
SET @CveClasificacion = CONVERT(int, SCOPE_IDENTITY());
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
UPDATE dbo.Sis_Modulos
|
||||
SET CveModuloPadre = @CveProductosGrupo,
|
||||
NombreModulo = 'Clasificación',
|
||||
Descripcion = 'Catálogo de clasificaciones',
|
||||
ClaseCssIcono = 'fa fa-tags',
|
||||
OrdenVisualizacion = 30,
|
||||
Visible = 1,
|
||||
Activo = 1,
|
||||
FechaActualizacion = GETDATE()
|
||||
WHERE CveModulo = @CveClasificacion;
|
||||
END;
|
||||
|
||||
DECLARE @ModulosNuevos TABLE
|
||||
(
|
||||
CveModulo int NOT NULL PRIMARY KEY
|
||||
);
|
||||
|
||||
INSERT INTO @ModulosNuevos (CveModulo)
|
||||
VALUES
|
||||
(@CveProductosGrupo),
|
||||
(@CveUnidadesMedida),
|
||||
(@CveClasificacion);
|
||||
|
||||
INSERT dbo.Sis_RolesModulos
|
||||
(
|
||||
CveRol,
|
||||
CveModulo,
|
||||
PuedeVer,
|
||||
PuedeCrear,
|
||||
PuedeModificar,
|
||||
PuedeEliminar,
|
||||
PuedeImprimir,
|
||||
PuedeExportar,
|
||||
FechaCreacion
|
||||
)
|
||||
SELECT
|
||||
RM.CveRol,
|
||||
M.CveModulo,
|
||||
RM.PuedeVer,
|
||||
RM.PuedeCrear,
|
||||
RM.PuedeModificar,
|
||||
RM.PuedeEliminar,
|
||||
RM.PuedeImprimir,
|
||||
RM.PuedeExportar,
|
||||
GETDATE()
|
||||
FROM dbo.Sis_RolesModulos AS RM
|
||||
CROSS JOIN @ModulosNuevos AS M
|
||||
WHERE RM.CveModulo = @CveProductos
|
||||
AND NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Sis_RolesModulos AS ExistingPermission
|
||||
WHERE ExistingPermission.CveRol = RM.CveRol
|
||||
AND ExistingPermission.CveModulo = M.CveModulo
|
||||
);
|
||||
|
||||
COMMIT TRANSACTION;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
IF XACT_STATE() <> 0
|
||||
BEGIN
|
||||
ROLLBACK TRANSACTION;
|
||||
END;
|
||||
|
||||
THROW;
|
||||
END CATCH;
|
||||
GO
|
||||
@@ -25,18 +25,23 @@ BEGIN TRY
|
||||
Url varchar(500) NULL,
|
||||
Icono varchar(150) NULL,
|
||||
Orden int NOT NULL,
|
||||
Visible bit NOT NULL
|
||||
Visible bit NOT NULL,
|
||||
Nivel int NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO @Menu
|
||||
(Clave, ClavePadre, NombreModulo, Url, Icono, Orden, Visible)
|
||||
(Clave, ClavePadre, NombreModulo, Url, Icono, Orden, Visible, Nivel)
|
||||
VALUES
|
||||
('Catalogos', NULL, 'Catálogos', NULL, 'fa fa-list-alt', 30, 1),
|
||||
('EstatusSolicitud', 'Catalogos', 'Estatus de solicitud', '~/Pages/Catalogos/EstatusSolicitud.aspx', 'fa fa-check-circle', 10, 1),
|
||||
('TiposTramite', 'Catalogos', 'Tipos de trámite', '~/Pages/Catalogos/TiposTramite.aspx', 'fa fa-file-text-o', 20, 1),
|
||||
('TipoTramiteDetalle', 'TiposTramite', 'Detalle de tipo de trámite', '~/Pages/Catalogos/TipoTramiteDetalle.aspx', 'fa fa-question-circle', 10, 0),
|
||||
('TiposDocumento', 'Catalogos', 'Tipos de documento', '~/Pages/Catalogos/TiposDocumento.aspx', 'fa fa-file-o', 30, 1),
|
||||
('DocumentosRequeridos', 'Catalogos', 'Documentos requeridos', '~/Pages/Catalogos/DocumentosRequeridos.aspx', 'fa fa-paperclip', 40, 1);
|
||||
('Catalogos', NULL, 'Catálogos', NULL, 'fa fa-list-alt', 30, 1, 0),
|
||||
('EstatusSolicitud', 'Catalogos', 'Estatus de solicitud', '~/Pages/Catalogos/EstatusSolicitud.aspx', 'fa fa-check-circle', 10, 1, 1),
|
||||
('TiposTramite', 'Catalogos', 'Tipos de trámite', '~/Pages/Catalogos/TiposTramite.aspx', 'fa fa-file-text-o', 20, 1, 1),
|
||||
('TipoTramiteDetalle', 'TiposTramite', 'Detalle de tipo de trámite', '~/Pages/Catalogos/TipoTramiteDetalle.aspx', 'fa fa-question-circle', 10, 0, 2),
|
||||
('TiposDocumento', 'Catalogos', 'Tipos de documento', '~/Pages/Catalogos/TiposDocumento.aspx', 'fa fa-file-o', 30, 1, 1),
|
||||
('DocumentosRequeridos', 'Catalogos', 'Documentos requeridos', '~/Pages/Catalogos/DocumentosRequeridos.aspx', 'fa fa-paperclip', 40, 1, 1),
|
||||
('ProductosGrupo', 'Catalogos', 'Productos', NULL, 'fa fa-cubes', 50, 1, 1),
|
||||
('ProductosServicios', 'ProductosGrupo', 'Productos', '~/Pages/Catalogos/ProductosServicios.aspx', 'fa fa-cube', 10, 1, 2),
|
||||
('UnidadesMedida', 'ProductosGrupo', 'Unidades de medida', '~/Pages/Catalogos/UnidadesMedida.aspx', 'fa fa-balance-scale', 20, 1, 2),
|
||||
('Clasificaciones', 'ProductosGrupo', 'Clasificación', '~/Pages/Catalogos/Clasificaciones.aspx', 'fa fa-tags', 30, 1, 2);
|
||||
|
||||
DECLARE @Ids TABLE
|
||||
(
|
||||
@@ -52,20 +57,27 @@ BEGIN TRY
|
||||
@Icono varchar(150),
|
||||
@Orden int,
|
||||
@Visible bit,
|
||||
@Nivel int,
|
||||
@CveModuloPadre int,
|
||||
@CveModulo int;
|
||||
|
||||
DECLARE CatalogoCursor CURSOR LOCAL FAST_FORWARD FOR
|
||||
SELECT Clave, ClavePadre, NombreModulo, Url, Icono, Orden, Visible
|
||||
FROM @Menu
|
||||
ORDER BY
|
||||
CASE WHEN ClavePadre IS NULL THEN 0 ELSE 1 END,
|
||||
SELECT
|
||||
Clave,
|
||||
ClavePadre,
|
||||
NombreModulo,
|
||||
Url,
|
||||
Icono,
|
||||
Orden,
|
||||
Clave;
|
||||
Visible,
|
||||
Nivel
|
||||
FROM @Menu
|
||||
ORDER BY Nivel, Orden, Clave;
|
||||
|
||||
OPEN CatalogoCursor;
|
||||
FETCH NEXT FROM CatalogoCursor
|
||||
INTO @Clave, @ClavePadre, @NombreModulo, @Url, @Icono, @Orden, @Visible;
|
||||
INTO @Clave, @ClavePadre, @NombreModulo, @Url, @Icono, @Orden,
|
||||
@Visible, @Nivel;
|
||||
|
||||
WHILE @@FETCH_STATUS = 0
|
||||
BEGIN
|
||||
@@ -121,7 +133,8 @@ BEGIN TRY
|
||||
VALUES (@Clave, @CveModulo);
|
||||
|
||||
FETCH NEXT FROM CatalogoCursor
|
||||
INTO @Clave, @ClavePadre, @NombreModulo, @Url, @Icono, @Orden, @Visible;
|
||||
INTO @Clave, @ClavePadre, @NombreModulo, @Url, @Icono, @Orden,
|
||||
@Visible, @Nivel;
|
||||
END;
|
||||
|
||||
CLOSE CatalogoCursor;
|
||||
|
||||
365
Optimiza_Bitacora_Listado_Detalle_20260827.sql
Normal file
365
Optimiza_Bitacora_Listado_Detalle_20260827.sql
Normal file
@@ -0,0 +1,365 @@
|
||||
SET NOCOUNT ON;
|
||||
GO
|
||||
|
||||
/*
|
||||
El resumen se genera a partir de la definición instalada para conservar
|
||||
ajustes locales del procedimiento original. Solamente se elimina el bloque
|
||||
que consulta campos y relaciones internas de cada movimiento.
|
||||
*/
|
||||
DECLARE @DefinicionResumen nvarchar(max) =
|
||||
OBJECT_DEFINITION(
|
||||
OBJECT_ID(N'dbo.PA_Bit_BitacoraListByRelations'));
|
||||
|
||||
IF @DefinicionResumen IS NULL
|
||||
BEGIN
|
||||
THROW 50000,
|
||||
'No existe dbo.PA_Bit_BitacoraListByRelations.',
|
||||
1;
|
||||
END;
|
||||
|
||||
DECLARE @InicioProcedimiento int = CHARINDEX(
|
||||
N'PROCEDURE',
|
||||
UPPER(@DefinicionResumen));
|
||||
DECLARE @InicioDetalle int = CHARINDEX(
|
||||
N'CREATE TABLE #CamposPagina',
|
||||
@DefinicionResumen);
|
||||
DECLARE @FinDetalle int = CHARINDEX(
|
||||
N'CREATE TABLE #RelacionesVisuales',
|
||||
@DefinicionResumen);
|
||||
|
||||
IF @InicioProcedimiento = 0
|
||||
OR @InicioDetalle = 0
|
||||
OR @FinDetalle <= @InicioDetalle
|
||||
BEGIN
|
||||
THROW 50001,
|
||||
'La definición instalada de la consulta de bitácora no tiene la estructura esperada.',
|
||||
1;
|
||||
END;
|
||||
|
||||
SET @DefinicionResumen = STUFF(
|
||||
@DefinicionResumen,
|
||||
@InicioDetalle,
|
||||
@FinDetalle - @InicioDetalle,
|
||||
N'');
|
||||
|
||||
SET @DefinicionResumen = STUFF(
|
||||
@DefinicionResumen,
|
||||
1,
|
||||
@InicioProcedimiento - 1,
|
||||
N'CREATE OR ALTER ');
|
||||
|
||||
SET @DefinicionResumen = REPLACE(
|
||||
@DefinicionResumen,
|
||||
N'dbo.PA_Bit_BitacoraListByRelations',
|
||||
N'dbo.PA_Bit_BitacoraResumenListByRelations');
|
||||
|
||||
EXEC sys.sp_executesql @DefinicionResumen;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Bit_BitacoraDetalleGet
|
||||
@CveBitacora bigint,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
@ErrorMostrar = NULL,
|
||||
@ErrorTipo = 0,
|
||||
@Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF @CveBitacora <= 0
|
||||
BEGIN
|
||||
SET @ErrorMostrar =
|
||||
'La clave del movimiento de bitácora no es válida.';
|
||||
SET @ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
DECLARE @EsAdministrador bit = 0;
|
||||
DECLARE @EsDesarrollador bit = 0;
|
||||
|
||||
SELECT
|
||||
@EsAdministrador = CASE
|
||||
WHEN R.NombreRol IN
|
||||
(
|
||||
'SuperUsuario',
|
||||
'Administrador'
|
||||
) THEN 1
|
||||
ELSE 0
|
||||
END,
|
||||
@EsDesarrollador = CASE
|
||||
WHEN R.NombreRol = 'Empresa' THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
FROM dbo.Sis_Usuarios AS U
|
||||
INNER JOIN dbo.Sis_Roles AS R
|
||||
ON R.CveRol = U.CveRol
|
||||
WHERE U.CveUsuario = @CveUsuarioEjecuta
|
||||
AND U.Activo = 1
|
||||
AND R.Activo = 1;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Bit_Bitacora AS B
|
||||
WHERE B.CveBitacora = @CveBitacora
|
||||
AND
|
||||
(
|
||||
@EsAdministrador = 1
|
||||
OR
|
||||
(
|
||||
@EsDesarrollador = 1
|
||||
AND EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Bit_BitacoraRelaciones AS BRCliente
|
||||
INNER JOIN dbo.Bit_Tablas AS TCliente
|
||||
ON TCliente.CveTabla =
|
||||
BRCliente.CveTablaRelacionada
|
||||
INNER JOIN dbo.Bit_Campos AS CCliente
|
||||
ON CCliente.CveCampo =
|
||||
BRCliente.CveCampoRelacion
|
||||
AND CCliente.CveTabla = TCliente.CveTabla
|
||||
INNER JOIN dbo.Sis_UsuariosClientes AS UC
|
||||
ON UC.CveCliente =
|
||||
BRCliente.ValorRelacionNumero
|
||||
AND UC.CveUsuario = @CveUsuarioEjecuta
|
||||
AND UC.Activo = 1
|
||||
WHERE BRCliente.CveBitacora = B.CveBitacora
|
||||
AND BRCliente.VisibleDesarrollador = 1
|
||||
AND TCliente.NombreTablaSQL = 'Clientes'
|
||||
AND CCliente.NombreCampoSQL = 'CveCliente'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
BEGIN
|
||||
SET @ErrorMostrar =
|
||||
'No se encontró el movimiento de bitácora solicitado.';
|
||||
SET @ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
B.CveBitacora,
|
||||
B.CveTabla,
|
||||
T.NombreTablaSQL,
|
||||
T.NombreMostrar AS NombreTabla,
|
||||
B.CveTipoMovimiento,
|
||||
M.Nombre AS TipoMovimiento,
|
||||
B.CveDefinicionAccion,
|
||||
A.NombreAccion,
|
||||
A.DescripcionAccion,
|
||||
B.CveUsuarioEjecuta,
|
||||
COALESCE(
|
||||
NULLIF(U.NombreUsuario, ''),
|
||||
CONCAT('(', B.CveUsuarioEjecuta, ') Eliminado')
|
||||
) AS NombreUsuarioEjecuta,
|
||||
B.CveUsuarioAutoriza,
|
||||
B.FechaAutorizacion,
|
||||
B.LlaveRegistro,
|
||||
B.DescripcionMovimiento,
|
||||
B.FechaMovimiento,
|
||||
B.DireccionIP,
|
||||
B.NombreEquipo,
|
||||
B.Modulo
|
||||
FROM dbo.Bit_Bitacora AS B
|
||||
INNER JOIN dbo.Bit_Tablas AS T
|
||||
ON T.CveTabla = B.CveTabla
|
||||
INNER JOIN dbo.Bit_TiposMovimiento AS M
|
||||
ON M.CveTipoMovimiento = B.CveTipoMovimiento
|
||||
LEFT JOIN dbo.Bit_DefinicionesAccion AS A
|
||||
ON A.CveDefinicionAccion = B.CveDefinicionAccion
|
||||
LEFT JOIN dbo.Sis_Usuarios AS U
|
||||
ON U.CveUsuario = B.CveUsuarioEjecuta
|
||||
WHERE B.CveBitacora = @CveBitacora;
|
||||
|
||||
CREATE TABLE #CamposDetalle
|
||||
(
|
||||
CveBitacoraCampo bigint NOT NULL PRIMARY KEY,
|
||||
CveBitacora bigint NOT NULL,
|
||||
CveCampo int NOT NULL,
|
||||
NombreCampoSQL varchar(128)
|
||||
COLLATE Modern_Spanish_CS_AS NOT NULL,
|
||||
NombreMostrar varchar(150)
|
||||
COLLATE Modern_Spanish_CS_AS NOT NULL,
|
||||
ValorAnterior nvarchar(max)
|
||||
COLLATE Modern_Spanish_CS_AS NULL,
|
||||
ValorNuevo nvarchar(max)
|
||||
COLLATE Modern_Spanish_CS_AS NULL,
|
||||
ValorAnteriorMostrar nvarchar(max)
|
||||
COLLATE Modern_Spanish_CS_AS NULL,
|
||||
ValorNuevoMostrar nvarchar(max)
|
||||
COLLATE Modern_Spanish_CS_AS NULL
|
||||
);
|
||||
|
||||
INSERT INTO #CamposDetalle
|
||||
(
|
||||
CveBitacoraCampo,
|
||||
CveBitacora,
|
||||
CveCampo,
|
||||
NombreCampoSQL,
|
||||
NombreMostrar,
|
||||
ValorAnterior,
|
||||
ValorNuevo,
|
||||
ValorAnteriorMostrar,
|
||||
ValorNuevoMostrar
|
||||
)
|
||||
SELECT
|
||||
BC.CveBitacoraCampo,
|
||||
BC.CveBitacora,
|
||||
BC.CveCampo,
|
||||
C.NombreCampoSQL,
|
||||
C.NombreMostrar,
|
||||
BC.ValorAnterior,
|
||||
BC.ValorNuevo,
|
||||
BC.ValorAnterior,
|
||||
BC.ValorNuevo
|
||||
FROM dbo.Bit_BitacoraCampos AS BC
|
||||
INNER JOIN dbo.Bit_Campos AS C
|
||||
ON C.CveCampo = BC.CveCampo
|
||||
WHERE BC.CveBitacora = @CveBitacora
|
||||
AND
|
||||
(
|
||||
@EsAdministrador = 1
|
||||
OR C.MostrarEnBitacora = 1
|
||||
);
|
||||
|
||||
DECLARE @CveCampoOrigenReferencia int;
|
||||
DECLARE @NombreTablaReferencia varchar(128);
|
||||
DECLARE @NombreCampoLlaveReferencia varchar(128);
|
||||
DECLARE @NombreCampoMostrarReferencia varchar(128);
|
||||
DECLARE @SqlCampoReferencia nvarchar(max);
|
||||
|
||||
DECLARE CursorCamposReferencia CURSOR LOCAL FAST_FORWARD FOR
|
||||
SELECT DISTINCT
|
||||
CO.CveCampo,
|
||||
TR.NombreTablaSQL,
|
||||
CL.NombreCampoSQL,
|
||||
CM.NombreCampoSQL
|
||||
FROM #CamposDetalle AS CD
|
||||
INNER JOIN dbo.Bit_Campos AS CO
|
||||
ON CO.CveCampo = CD.CveCampo
|
||||
AND CO.Activo = 1
|
||||
INNER JOIN dbo.Bit_Tablas AS TR
|
||||
ON TR.CveTabla = CO.CveTablaReferencia
|
||||
AND TR.Activo = 1
|
||||
AND TR.NombreCampoLlaveSQL IS NOT NULL
|
||||
INNER JOIN dbo.Bit_Campos AS CL
|
||||
ON CL.CveTabla = TR.CveTabla
|
||||
AND CL.NombreCampoSQL = TR.NombreCampoLlaveSQL
|
||||
AND CL.Activo = 1
|
||||
INNER JOIN dbo.Bit_Campos AS CM
|
||||
ON CM.CveCampo = CO.CveCampoMostrarReferencia
|
||||
AND CM.CveTabla = TR.CveTabla
|
||||
AND CM.MostrarEnBitacora = 1
|
||||
AND CM.Activo = 1
|
||||
INNER JOIN sys.schemas AS SC
|
||||
ON SC.name = 'dbo'
|
||||
INNER JOIN sys.tables AS ST
|
||||
ON ST.schema_id = SC.schema_id
|
||||
AND ST.name COLLATE Modern_Spanish_CS_AS = TR.NombreTablaSQL
|
||||
INNER JOIN sys.columns AS SCL
|
||||
ON SCL.object_id = ST.object_id
|
||||
AND SCL.name COLLATE Modern_Spanish_CS_AS =
|
||||
CL.NombreCampoSQL
|
||||
INNER JOIN sys.columns AS SCM
|
||||
ON SCM.object_id = ST.object_id
|
||||
AND SCM.name COLLATE Modern_Spanish_CS_AS =
|
||||
CM.NombreCampoSQL;
|
||||
|
||||
OPEN CursorCamposReferencia;
|
||||
|
||||
FETCH NEXT FROM CursorCamposReferencia INTO
|
||||
@CveCampoOrigenReferencia,
|
||||
@NombreTablaReferencia,
|
||||
@NombreCampoLlaveReferencia,
|
||||
@NombreCampoMostrarReferencia;
|
||||
|
||||
WHILE @@FETCH_STATUS = 0
|
||||
BEGIN
|
||||
SET @SqlCampoReferencia = N'
|
||||
UPDATE CD
|
||||
SET
|
||||
CD.ValorAnteriorMostrar = CASE
|
||||
WHEN CD.ValorAnterior IS NULL THEN NULL
|
||||
WHEN VA.' + QUOTENAME(@NombreCampoLlaveReferencia) + N' IS NULL
|
||||
THEN CONCAT(N''('', CD.ValorAnterior, N'') Eliminada'')
|
||||
WHEN NULLIF(CONVERT(nvarchar(max), VA.' + QUOTENAME(@NombreCampoMostrarReferencia) + N'), N'''') IS NULL
|
||||
THEN CONCAT(N''('', CD.ValorAnterior, N'')'')
|
||||
ELSE CONVERT(nvarchar(max), VA.' + QUOTENAME(@NombreCampoMostrarReferencia) + N')
|
||||
END,
|
||||
CD.ValorNuevoMostrar = CASE
|
||||
WHEN CD.ValorNuevo IS NULL THEN NULL
|
||||
WHEN VN.' + QUOTENAME(@NombreCampoLlaveReferencia) + N' IS NULL
|
||||
THEN CONCAT(N''('', CD.ValorNuevo, N'') Eliminada'')
|
||||
WHEN NULLIF(CONVERT(nvarchar(max), VN.' + QUOTENAME(@NombreCampoMostrarReferencia) + N'), N'''') IS NULL
|
||||
THEN CONCAT(N''('', CD.ValorNuevo, N'')'')
|
||||
ELSE CONVERT(nvarchar(max), VN.' + QUOTENAME(@NombreCampoMostrarReferencia) + N')
|
||||
END
|
||||
FROM #CamposDetalle AS CD
|
||||
LEFT JOIN dbo.' + QUOTENAME(@NombreTablaReferencia) + N' AS VA
|
||||
ON CONVERT(nvarchar(250), VA.' + QUOTENAME(@NombreCampoLlaveReferencia) + N')
|
||||
COLLATE Modern_Spanish_CS_AS =
|
||||
CD.ValorAnterior COLLATE Modern_Spanish_CS_AS
|
||||
LEFT JOIN dbo.' + QUOTENAME(@NombreTablaReferencia) + N' AS VN
|
||||
ON CONVERT(nvarchar(250), VN.' + QUOTENAME(@NombreCampoLlaveReferencia) + N')
|
||||
COLLATE Modern_Spanish_CS_AS =
|
||||
CD.ValorNuevo COLLATE Modern_Spanish_CS_AS
|
||||
WHERE CD.CveCampo = @CveCampoOrigen;';
|
||||
|
||||
EXEC sys.sp_executesql
|
||||
@SqlCampoReferencia,
|
||||
N'@CveCampoOrigen int',
|
||||
@CveCampoOrigen = @CveCampoOrigenReferencia;
|
||||
|
||||
FETCH NEXT FROM CursorCamposReferencia INTO
|
||||
@CveCampoOrigenReferencia,
|
||||
@NombreTablaReferencia,
|
||||
@NombreCampoLlaveReferencia,
|
||||
@NombreCampoMostrarReferencia;
|
||||
END;
|
||||
|
||||
CLOSE CursorCamposReferencia;
|
||||
DEALLOCATE CursorCamposReferencia;
|
||||
|
||||
SELECT
|
||||
CveBitacoraCampo,
|
||||
CveBitacora,
|
||||
CveCampo,
|
||||
NombreCampoSQL,
|
||||
NombreMostrar,
|
||||
ValorAnterior,
|
||||
ValorNuevo,
|
||||
ValorAnteriorMostrar,
|
||||
ValorNuevoMostrar
|
||||
FROM #CamposDetalle
|
||||
ORDER BY CveBitacoraCampo;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SET @ErrorMostrar =
|
||||
'Ocurrió un error al consultar el detalle de la bitácora; favor de contactar a Sistemas.';
|
||||
SET @ErrorTipo = 1;
|
||||
SET @Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) = CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(
|
||||
ERROR_PROCEDURE(),
|
||||
'PA_Bit_BitacoraDetalleGet'
|
||||
),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE()
|
||||
);
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
594
Perfil_Usuario_Cambio_Contexto_20260828.sql
Normal file
594
Perfil_Usuario_Cambio_Contexto_20260828.sql
Normal file
@@ -0,0 +1,594 @@
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Sis_UsuarioGetByName
|
||||
@NombreUsuario varchar(100),
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT TOP (1)
|
||||
U.CveUsuario,
|
||||
U.NombreUsuario,
|
||||
U.HashContrasena,
|
||||
U.CorreoElectronico,
|
||||
U.CveRol,
|
||||
R.NombreRol,
|
||||
U.Activo,
|
||||
U.DebeCambiarContrasena,
|
||||
U.IntentosFallidosInicioSesion,
|
||||
U.BloqueadoHasta,
|
||||
U.FechaUltimoInicioSesion,
|
||||
U.FechaUltimaConexion,
|
||||
U.CorreoVerificado,
|
||||
ISNULL(ClientePrincipal.CveCliente, 0) AS CveCliente
|
||||
FROM dbo.Sis_Usuarios AS U
|
||||
INNER JOIN dbo.Sis_Roles AS R
|
||||
ON R.CveRol = U.CveRol
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1) UC.CveCliente
|
||||
FROM dbo.Sis_UsuariosClientes AS UC
|
||||
INNER JOIN dbo.Clientes AS C
|
||||
ON C.CveCliente = UC.CveCliente
|
||||
AND C.Estatus = 1
|
||||
WHERE UC.CveUsuario = U.CveUsuario
|
||||
AND UC.Activo = 1
|
||||
ORDER BY
|
||||
UC.EsPrincipal DESC,
|
||||
UC.Orden,
|
||||
UC.CveUsuarioCliente
|
||||
) AS ClientePrincipal
|
||||
WHERE U.NombreUsuario = @NombreUsuario;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar el usuario; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Sis_UsuarioGetByName'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Sis_PerfilGet
|
||||
@CveUsuario int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Sis_Usuarios
|
||||
WHERE CveUsuario = @CveUsuario
|
||||
AND Activo = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'No se encontró el usuario activo de la sesión.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
U.CveUsuario,
|
||||
U.NombreUsuario,
|
||||
U.CorreoElectronico,
|
||||
U.CveRol,
|
||||
R.NombreRol,
|
||||
ISNULL(ClientePrincipal.CveCliente, 0) AS CveCliente,
|
||||
CONVERT(bit, CASE WHEN U.CveRol = 3 THEN 1 ELSE 0 END) AS EsDesarrollador
|
||||
FROM dbo.Sis_Usuarios AS U
|
||||
INNER JOIN dbo.Sis_Roles AS R
|
||||
ON R.CveRol = U.CveRol
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1) UC.CveCliente
|
||||
FROM dbo.Sis_UsuariosClientes AS UC
|
||||
INNER JOIN dbo.Clientes AS C
|
||||
ON C.CveCliente = UC.CveCliente
|
||||
AND C.Estatus = 1
|
||||
WHERE UC.CveUsuario = U.CveUsuario
|
||||
AND UC.Activo = 1
|
||||
ORDER BY
|
||||
UC.EsPrincipal DESC,
|
||||
UC.Orden,
|
||||
UC.CveUsuarioCliente
|
||||
) AS ClientePrincipal
|
||||
WHERE U.CveUsuario = @CveUsuario;
|
||||
|
||||
SELECT
|
||||
C.CveCliente,
|
||||
C.Nombre,
|
||||
C.NombreComercial,
|
||||
C.Direccion,
|
||||
C.NoExt,
|
||||
C.NoInt,
|
||||
C.Colonia,
|
||||
C.Ciudad,
|
||||
C.Estado,
|
||||
C.Pais,
|
||||
C.RFC,
|
||||
C.CP,
|
||||
C.Telefono,
|
||||
C.Mail,
|
||||
C.CveRegimenFiscal,
|
||||
RF.CodigoRegimenFiscal,
|
||||
RF.RegimenFiscal,
|
||||
C.CveUsoCFDI,
|
||||
UCFDI.UsoCFDI,
|
||||
UCFDI.Descripcion AS DescripcionUsoCFDI
|
||||
FROM dbo.Sis_Usuarios AS U
|
||||
CROSS APPLY
|
||||
(
|
||||
SELECT TOP (1) UC.CveCliente
|
||||
FROM dbo.Sis_UsuariosClientes AS UC
|
||||
INNER JOIN dbo.Clientes AS ClienteActivo
|
||||
ON ClienteActivo.CveCliente = UC.CveCliente
|
||||
AND ClienteActivo.Estatus = 1
|
||||
WHERE UC.CveUsuario = U.CveUsuario
|
||||
AND UC.Activo = 1
|
||||
ORDER BY
|
||||
UC.EsPrincipal DESC,
|
||||
UC.Orden,
|
||||
UC.CveUsuarioCliente
|
||||
) AS ClientePrincipal
|
||||
INNER JOIN dbo.Clientes AS C
|
||||
ON C.CveCliente = ClientePrincipal.CveCliente
|
||||
LEFT JOIN dbo.Gral_RegimenesFiscales AS RF
|
||||
ON RF.CveRegimenFiscal = C.CveRegimenFiscal
|
||||
LEFT JOIN dbo.Gral_SAT_UsosCFDI AS UCFDI
|
||||
ON UCFDI.CveUsoCFDI = C.CveUsoCFDI
|
||||
WHERE U.CveUsuario = @CveUsuario
|
||||
AND U.CveRol = 3;
|
||||
|
||||
SELECT
|
||||
CveRegimenFiscal,
|
||||
CodigoRegimenFiscal,
|
||||
RegimenFiscal
|
||||
FROM dbo.Gral_RegimenesFiscales
|
||||
ORDER BY CodigoRegimenFiscal;
|
||||
|
||||
SELECT
|
||||
CveUsoCFDI,
|
||||
UsoCFDI,
|
||||
Descripcion
|
||||
FROM dbo.Gral_SAT_UsosCFDI
|
||||
ORDER BY UsoCFDI;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar el perfil; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Sis_PerfilGet'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Sis_PerfilSesionUpdate
|
||||
@CveUsuario int,
|
||||
@NombreUsuario varchar(100),
|
||||
@HashContrasena varchar(500) = NULL,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SET @NombreUsuario = LTRIM(RTRIM(@NombreUsuario));
|
||||
SET @HashContrasena = NULLIF(LTRIM(RTRIM(@HashContrasena)), '');
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Sis_Usuarios
|
||||
WHERE CveUsuario = @CveUsuario
|
||||
AND Activo = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'No se encontró el usuario activo de la sesión.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NULLIF(@NombreUsuario, '') IS NULL
|
||||
OR LEN(@NombreUsuario) < 3
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El nombre de usuario debe contener al menos tres caracteres.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Sis_Usuarios
|
||||
WHERE NombreUsuario = @NombreUsuario
|
||||
AND CveUsuario <> @CveUsuario
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El nombre de usuario ya está registrado.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
UPDATE dbo.Sis_Usuarios
|
||||
SET NombreUsuario = @NombreUsuario,
|
||||
HashContrasena = COALESCE(@HashContrasena, HashContrasena),
|
||||
DebeCambiarContrasena =
|
||||
CASE
|
||||
WHEN @HashContrasena IS NULL
|
||||
THEN DebeCambiarContrasena
|
||||
ELSE 0
|
||||
END,
|
||||
FechaActualizacion = GETDATE()
|
||||
WHERE CveUsuario = @CveUsuario;
|
||||
|
||||
SELECT
|
||||
U.CveUsuario,
|
||||
U.NombreUsuario,
|
||||
U.CorreoElectronico,
|
||||
U.CveRol,
|
||||
R.NombreRol,
|
||||
ISNULL(ClientePrincipal.CveCliente, 0) AS CveCliente,
|
||||
CONVERT(bit, CASE WHEN U.CveRol = 3 THEN 1 ELSE 0 END) AS EsDesarrollador
|
||||
FROM dbo.Sis_Usuarios AS U
|
||||
INNER JOIN dbo.Sis_Roles AS R
|
||||
ON R.CveRol = U.CveRol
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1) UC.CveCliente
|
||||
FROM dbo.Sis_UsuariosClientes AS UC
|
||||
INNER JOIN dbo.Clientes AS C
|
||||
ON C.CveCliente = UC.CveCliente
|
||||
AND C.Estatus = 1
|
||||
WHERE UC.CveUsuario = U.CveUsuario
|
||||
AND UC.Activo = 1
|
||||
ORDER BY
|
||||
UC.EsPrincipal DESC,
|
||||
UC.Orden,
|
||||
UC.CveUsuarioCliente
|
||||
) AS ClientePrincipal
|
||||
WHERE U.CveUsuario = @CveUsuario;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al actualizar los datos de sesión; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Sis_PerfilSesionUpdate'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Clientes_PerfilUpdate
|
||||
@CveCliente int,
|
||||
@Nombre varchar(200),
|
||||
@NombreComercial varchar(200) = NULL,
|
||||
@Direccion varchar(90),
|
||||
@NoExt varchar(20) = NULL,
|
||||
@NoInt varchar(50) = NULL,
|
||||
@Colonia varchar(50),
|
||||
@Ciudad varchar(50),
|
||||
@Estado varchar(35),
|
||||
@Pais varchar(50),
|
||||
@RFC varchar(15),
|
||||
@CP varchar(10),
|
||||
@Telefono varchar(25) = NULL,
|
||||
@Mail varchar(500) = NULL,
|
||||
@CveRegimenFiscal tinyint,
|
||||
@CveUsoCFDI tinyint,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT
|
||||
@Nombre = LTRIM(RTRIM(@Nombre)),
|
||||
@NombreComercial = NULLIF(LTRIM(RTRIM(@NombreComercial)), ''),
|
||||
@Direccion = LTRIM(RTRIM(@Direccion)),
|
||||
@NoExt = NULLIF(LTRIM(RTRIM(@NoExt)), ''),
|
||||
@NoInt = NULLIF(LTRIM(RTRIM(@NoInt)), ''),
|
||||
@Colonia = LTRIM(RTRIM(@Colonia)),
|
||||
@Ciudad = LTRIM(RTRIM(@Ciudad)),
|
||||
@Estado = LTRIM(RTRIM(@Estado)),
|
||||
@Pais = LTRIM(RTRIM(@Pais)),
|
||||
@RFC = UPPER(REPLACE(LTRIM(RTRIM(@RFC)), ' ', '')),
|
||||
@CP = LTRIM(RTRIM(@CP)),
|
||||
@Telefono = NULLIF(LTRIM(RTRIM(@Telefono)), ''),
|
||||
@Mail = NULLIF(LTRIM(RTRIM(@Mail)), '');
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Clientes
|
||||
WHERE CveCliente = @CveCliente
|
||||
AND Estatus = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'No se encontró el cliente activo del perfil.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NULLIF(@Nombre, '') IS NULL
|
||||
OR NULLIF(@Direccion, '') IS NULL
|
||||
OR NULLIF(@Colonia, '') IS NULL
|
||||
OR NULLIF(@Ciudad, '') IS NULL
|
||||
OR NULLIF(@Estado, '') IS NULL
|
||||
OR NULLIF(@Pais, '') IS NULL
|
||||
OR LEN(@RFC) NOT IN (12, 13)
|
||||
OR LEN(@CP) <> 5
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Capture nombre fiscal, domicilio, RFC y código postal válidos.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Gral_RegimenesFiscales
|
||||
WHERE CveRegimenFiscal = @CveRegimenFiscal
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione un régimen fiscal válido.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Gral_SAT_UsosCFDI
|
||||
WHERE CveUsoCFDI = @CveUsoCFDI
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'Seleccione un uso de CFDI válido.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
UPDATE dbo.Clientes
|
||||
SET Nombre = @Nombre,
|
||||
NombreComercial = @NombreComercial,
|
||||
Direccion = @Direccion,
|
||||
NoExt = @NoExt,
|
||||
NoInt = @NoInt,
|
||||
Colonia = @Colonia,
|
||||
Ciudad = @Ciudad,
|
||||
Estado = @Estado,
|
||||
Pais = @Pais,
|
||||
RFC = @RFC,
|
||||
CP = @CP,
|
||||
Telefono = @Telefono,
|
||||
Mail = @Mail,
|
||||
CveRegimenFiscal = @CveRegimenFiscal,
|
||||
CveUsoCFDI = @CveUsoCFDI,
|
||||
CveUsuarioModifico = @CveUsuarioEjecuta
|
||||
WHERE CveCliente = @CveCliente;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al actualizar los datos del cliente; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Clientes_PerfilUpdate'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Sis_UsuarioContextoList
|
||||
@Texto varchar(150) = NULL,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
SET @Texto = NULLIF(LTRIM(RTRIM(@Texto)), '');
|
||||
|
||||
SELECT
|
||||
U.CveUsuario,
|
||||
U.NombreUsuario,
|
||||
U.CorreoElectronico,
|
||||
U.CveRol,
|
||||
R.NombreRol,
|
||||
U.DebeCambiarContrasena,
|
||||
ISNULL(ClientePrincipal.CveCliente, 0) AS CveCliente,
|
||||
ClientePrincipal.Cliente
|
||||
FROM dbo.Sis_Usuarios AS U
|
||||
INNER JOIN dbo.Sis_Roles AS R
|
||||
ON R.CveRol = U.CveRol
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1)
|
||||
UC.CveCliente,
|
||||
C.Nombre AS Cliente
|
||||
FROM dbo.Sis_UsuariosClientes AS UC
|
||||
INNER JOIN dbo.Clientes AS C
|
||||
ON C.CveCliente = UC.CveCliente
|
||||
AND C.Estatus = 1
|
||||
WHERE UC.CveUsuario = U.CveUsuario
|
||||
AND UC.Activo = 1
|
||||
ORDER BY
|
||||
UC.EsPrincipal DESC,
|
||||
UC.Orden,
|
||||
UC.CveUsuarioCliente
|
||||
) AS ClientePrincipal
|
||||
WHERE U.Activo = 1
|
||||
AND
|
||||
(
|
||||
@Texto IS NULL
|
||||
OR U.NombreUsuario LIKE '%' + @Texto + '%'
|
||||
OR U.CorreoElectronico LIKE '%' + @Texto + '%'
|
||||
OR ClientePrincipal.Cliente LIKE '%' + @Texto + '%'
|
||||
)
|
||||
ORDER BY U.NombreUsuario;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al consultar los usuarios disponibles; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Sis_UsuarioContextoList'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE dbo.PA_Sis_UsuarioContextoGet
|
||||
@CveUsuario int,
|
||||
@CveUsuarioEjecuta int,
|
||||
@ErrorMostrar varchar(max) OUTPUT,
|
||||
@ErrorTipo int OUTPUT,
|
||||
@Return bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SELECT @ErrorMostrar = NULL, @ErrorTipo = 0, @Return = 0;
|
||||
|
||||
BEGIN TRY
|
||||
IF NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM dbo.Sis_Usuarios
|
||||
WHERE CveUsuario = @CveUsuario
|
||||
AND Activo = 1
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
@ErrorMostrar = 'El usuario seleccionado ya no está disponible.',
|
||||
@ErrorTipo = 2;
|
||||
RETURN;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
U.CveUsuario,
|
||||
U.NombreUsuario,
|
||||
U.CorreoElectronico,
|
||||
U.CveRol,
|
||||
R.NombreRol,
|
||||
U.DebeCambiarContrasena,
|
||||
ISNULL(ClientePrincipal.CveCliente, 0) AS CveCliente,
|
||||
ClientePrincipal.Cliente
|
||||
FROM dbo.Sis_Usuarios AS U
|
||||
INNER JOIN dbo.Sis_Roles AS R
|
||||
ON R.CveRol = U.CveRol
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT TOP (1)
|
||||
UC.CveCliente,
|
||||
C.Nombre AS Cliente
|
||||
FROM dbo.Sis_UsuariosClientes AS UC
|
||||
INNER JOIN dbo.Clientes AS C
|
||||
ON C.CveCliente = UC.CveCliente
|
||||
AND C.Estatus = 1
|
||||
WHERE UC.CveUsuario = U.CveUsuario
|
||||
AND UC.Activo = 1
|
||||
ORDER BY
|
||||
UC.EsPrincipal DESC,
|
||||
UC.Orden,
|
||||
UC.CveUsuarioCliente
|
||||
) AS ClientePrincipal
|
||||
WHERE U.CveUsuario = @CveUsuario;
|
||||
|
||||
SET @Return = 1;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT
|
||||
@ErrorMostrar = 'Ocurrió un error al obtener el usuario seleccionado; favor de contactar a Sistemas.',
|
||||
@ErrorTipo = 1,
|
||||
@Return = 0;
|
||||
|
||||
DECLARE @ErrorTecnico nvarchar(2048) =
|
||||
CONCAT(
|
||||
'Número: ', ERROR_NUMBER(),
|
||||
'; Procedimiento: ', COALESCE(ERROR_PROCEDURE(), 'PA_Sis_UsuarioContextoGet'),
|
||||
'; Línea: ', ERROR_LINE(),
|
||||
'; Detalle: ', ERROR_MESSAGE());
|
||||
|
||||
RAISERROR(N'%s', 10, 1, @ErrorTecnico);
|
||||
END CATCH;
|
||||
END;
|
||||
GO
|
||||
21
SIG.Web/AccessDenied.aspx
Normal file
21
SIG.Web/AccessDenied.aspx
Normal file
@@ -0,0 +1,21 @@
|
||||
<%@ Page Title="Acceso denegado"
|
||||
Language="C#"
|
||||
MasterPageFile="~/Site.master"
|
||||
AutoEventWireup="true"
|
||||
CodeFile="AccessDenied.aspx.cs"
|
||||
Inherits="SIG.Web.AccessDenied" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<div class="note note-warning">
|
||||
<h4 class="block">Acceso denegado</h4>
|
||||
<p>
|
||||
No cuenta con acceso a esta página desde el menú asignado a su usuario.
|
||||
</p>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
</asp:Content>
|
||||
@@ -10,6 +10,7 @@ using SIG.Web.AppCode.Contracts.Menu;
|
||||
using SIG.Web.AppCode.Contracts.Search;
|
||||
using SIG.Web.AppCode.Contracts.Security;
|
||||
using SIG.Web.AppCode.Contracts.Tramites;
|
||||
using SIG.Web.AppCode.Contracts.Ventas;
|
||||
using SIG.Web.AppCode.Notifications.Contracts;
|
||||
using SIG.Web.AppCode.Notifications.Services;
|
||||
using SIG.Web.AppCode.Repositories.Bitacora;
|
||||
@@ -21,14 +22,17 @@ using SIG.Web.AppCode.Repositories.Menu;
|
||||
using SIG.Web.AppCode.Repositories.Fraccionamientos;
|
||||
using SIG.Web.AppCode.Repositories.Security;
|
||||
using SIG.Web.AppCode.Repositories.Tramites;
|
||||
using SIG.Web.AppCode.Repositories.Ventas;
|
||||
using SIG.Web.AppCode.Services.Bitacora;
|
||||
using SIG.Web.AppCode.Services.Documentos;
|
||||
using SIG.Web.AppCode.Services.Facturacion;
|
||||
using SIG.Web.AppCode.Services.Fraccionamientos;
|
||||
using SIG.Web.AppCode.Services.General;
|
||||
using SIG.Web.AppCode.Services.Menu;
|
||||
using SIG.Web.AppCode.Services.Search;
|
||||
using SIG.Web.AppCode.Services.Security;
|
||||
using SIG.Web.AppCode.Services.Tramites;
|
||||
using SIG.Web.AppCode.Services.Ventas;
|
||||
using SIG.Web.AppCode.Session;
|
||||
|
||||
namespace SIG.Web.AppCode.Configuration
|
||||
@@ -43,13 +47,17 @@ namespace SIG.Web.AppCode.Configuration
|
||||
public static IUserRepository UserRepository { get; private set; }
|
||||
private static IUserAdministrationRepository UserAdministrationRepository { get; set; }
|
||||
public static IUserAdministrationService UserAdministrationService { get; private set; }
|
||||
public static IPerfilUsuarioService PerfilUsuarioService { get; private set; }
|
||||
public static IGeneralCatalogRepository GeneralCatalogRepository { get; private set; }
|
||||
public static IProductoServicioService ProductoServicioService { get; private set; }
|
||||
public static IProductoCatalogService ProductoCatalogService { get; private set; }
|
||||
public static IClienteDocumentoService ClienteDocumentoService { get; private set; }
|
||||
public static ITramiteDocumentoService TramiteDocumentoService { get; private set; }
|
||||
public static IFraccionamientoService FraccionamientoService { get; private set; }
|
||||
public static IFraccionamientoGisService FraccionamientoGisService { get; private set; }
|
||||
public static ITramiteCatalogService TramiteCatalogService { get; private set; }
|
||||
public static ITramiteSolicitudService TramiteSolicitudService { get; private set; }
|
||||
public static IServicioVentaTramite ServicioVentaTramite { get; private set; }
|
||||
public static ICfdiTimbradoService CfdiTimbradoService { get; private set; }
|
||||
public static IPublicRegistrationService PublicRegistrationService { get; private set; }
|
||||
public static ILoginAttemptRepository LoginAttemptRepository { get; private set; }
|
||||
@@ -89,7 +97,16 @@ namespace SIG.Web.AppCode.Configuration
|
||||
UserAdministrationRepository,
|
||||
PasswordHasher,
|
||||
BitacoraService);
|
||||
PerfilUsuarioService = new PerfilUsuarioService(
|
||||
new PerfilUsuarioRepository(DbExecutor),
|
||||
PasswordHasher);
|
||||
GeneralCatalogRepository = new GeneralCatalogRepository(DbExecutor);
|
||||
ProductoServicioService = new ProductoServicioService(
|
||||
new ProductoServicioRepository(DbExecutor),
|
||||
BitacoraService);
|
||||
ProductoCatalogService = new ProductoCatalogService(
|
||||
new ProductoCatalogRepository(DbExecutor),
|
||||
BitacoraService);
|
||||
ClienteDocumentoService = new ClienteDocumentoService(
|
||||
new ClienteDocumentoRepository(DbExecutor));
|
||||
|
||||
@@ -125,15 +142,23 @@ namespace SIG.Web.AppCode.Configuration
|
||||
TramiteSolicitudService = new TramiteSolicitudService(
|
||||
tramiteSolicitudRepository,
|
||||
BitacoraService);
|
||||
var clienteProfact = new ProfactPacTimbradoClient(
|
||||
new ConfigurationPacCredentialProvider());
|
||||
CfdiTimbradoService = new CfdiTimbradoService(
|
||||
new CfdiRepository(DbExecutor),
|
||||
new ProfactCfdi40XmlBuilder(),
|
||||
new IPacTimbradoClient[]
|
||||
{
|
||||
new ProfactPacTimbradoClient(
|
||||
new ConfigurationPacCredentialProvider())
|
||||
clienteProfact
|
||||
},
|
||||
new ICfdiTimbradoFinalizadoHandler[0]);
|
||||
new IPacCancelacionClient[]
|
||||
{
|
||||
clienteProfact
|
||||
},
|
||||
new AlmacenArchivosCfdi());
|
||||
ServicioVentaTramite = new ServicioVentaTramite(
|
||||
new RepositorioVentaTramite(DbExecutor),
|
||||
CfdiTimbradoService);
|
||||
LoginAttemptRepository = new LoginAttemptRepository(DbExecutor);
|
||||
UserSessionRepository = new UserSessionRepository(DbExecutor);
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace SIG.Web.AppCode.Contracts.Bitacora
|
||||
BitacoraConsultaModel consulta,
|
||||
int cveUsuarioEjecuta);
|
||||
|
||||
DbResult<ResultadoPaginado<BitacoraModel>> Consultar(
|
||||
BitacoraConsultaModel consulta,
|
||||
DbResult<BitacoraModel> ConsultarDetalle(
|
||||
long cveBitacora,
|
||||
int cveUsuarioEjecuta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace SIG.Web.AppCode.Contracts.Bitacora
|
||||
DbResult<ResultadoPaginado<BitacoraModel>> ConsultarResumen(
|
||||
BitacoraConsultaModel consulta);
|
||||
|
||||
DbResult<ResultadoPaginado<BitacoraModel>> Consultar(
|
||||
BitacoraConsultaModel consulta);
|
||||
DbResult<BitacoraModel> ConsultarDetalle(long cveBitacora);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,20 @@ namespace SIG.Web.AppCode.Contracts.Facturacion
|
||||
bool timbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiCancelacionInicioModel> IniciarCancelacion(
|
||||
CfdiCancelacionSolicitudModel solicitud,
|
||||
Guid idSolicitud,
|
||||
string proveedorPac,
|
||||
string ambiente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiCancelacionResultadoModel> FinalizarCancelacion(
|
||||
long cveCfdiCancelacion,
|
||||
CfdiPacCancelacionResultadoModel resultadoPac,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
}
|
||||
|
||||
public interface ICfdiXmlBuilder
|
||||
@@ -70,15 +84,24 @@ namespace SIG.Web.AppCode.Contracts.Facturacion
|
||||
CfdiPacSolicitudModel solicitud);
|
||||
}
|
||||
|
||||
public interface IPacCancelacionClient
|
||||
{
|
||||
string Proveedor { get; }
|
||||
|
||||
CfdiPacCancelacionResultadoModel Cancelar(
|
||||
CfdiPacCancelacionSolicitudModel solicitud);
|
||||
}
|
||||
|
||||
public interface IPacCredentialProvider
|
||||
{
|
||||
string ObtenerCredencial(string referencia);
|
||||
}
|
||||
|
||||
public interface ICfdiTimbradoFinalizadoHandler
|
||||
public interface IAlmacenArchivosCfdi
|
||||
{
|
||||
DbResult<bool> AlFinalizar(
|
||||
CfdiTimbradoFinalizadoContext contexto);
|
||||
DbResult<string> GuardarXmlTimbrado(
|
||||
CfdiDocumentoModel documento,
|
||||
CfdiTimbradoIntentoModel intento);
|
||||
}
|
||||
|
||||
public interface ICfdiTimbradoService
|
||||
@@ -109,5 +132,11 @@ namespace SIG.Web.AppCode.Contracts.Facturacion
|
||||
bool timbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiCancelacionResultadoModel> Cancelar(
|
||||
CfdiCancelacionSolicitudModel solicitud,
|
||||
Guid? idSolicitud,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.General
|
||||
{
|
||||
public interface IProductoCatalogRepository
|
||||
{
|
||||
DbResult<List<ClasificacionModel>> ListClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ClasificacionModel> GetClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> SaveClasificacion(
|
||||
ClasificacionModel clasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> DeleteClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<List<UnidadMedidaModel>> ListUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<UnidadMedidaModel> GetUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> SaveUnidadMedida(
|
||||
UnidadMedidaModel unidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> DeleteUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.General
|
||||
{
|
||||
public interface IProductoCatalogService
|
||||
{
|
||||
DbResult<List<ClasificacionModel>> ListClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ClasificacionModel> GetClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> SaveClasificacion(
|
||||
ClasificacionModel clasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> DeleteClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<List<UnidadMedidaModel>> ListUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<UnidadMedidaModel> GetUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> SaveUnidadMedida(
|
||||
UnidadMedidaModel unidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> DeleteUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.General
|
||||
{
|
||||
public interface IProductoServicioRepository
|
||||
{
|
||||
DbResult<List<ProductoServicioModel>> List(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ProductoServicioModel> Get(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ProductoServicioOpcionesModel> ListOptions(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> Save(
|
||||
ProductoServicioModel productoServicio,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> Delete(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.General
|
||||
{
|
||||
public interface IProductoServicioService
|
||||
{
|
||||
DbResult<List<ProductoServicioModel>> List(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ProductoServicioModel> Get(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ProductoServicioOpcionesModel> ListOptions(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> Save(
|
||||
ProductoServicioModel productoServicio,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> Delete(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Security;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.Security
|
||||
{
|
||||
public interface IPerfilUsuarioRepository
|
||||
{
|
||||
DbResult<PerfilUsuarioConsultaModel> ObtenerPerfil(
|
||||
int cveUsuario,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<PerfilSesionModel> ActualizarSesion(
|
||||
int cveUsuario,
|
||||
string nombreUsuario,
|
||||
string hashContrasena,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<bool> ActualizarCliente(
|
||||
PerfilClienteModel cliente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<List<UsuarioCambioContextoModel>>
|
||||
ListarUsuariosCambio(
|
||||
string texto,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<UsuarioCambioContextoModel> ObtenerUsuarioContexto(
|
||||
int cveUsuario,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
}
|
||||
}
|
||||
31
SIG.Web/App_Code/Contracts/Security/IPerfilUsuarioService.cs
Normal file
31
SIG.Web/App_Code/Contracts/Security/IPerfilUsuarioService.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Security;
|
||||
using SIG.Web.AppCode.Session;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.Security
|
||||
{
|
||||
public interface IPerfilUsuarioService
|
||||
{
|
||||
DbResult<PerfilUsuarioConsultaModel> ObtenerPerfil(
|
||||
UserSessionModel usuarioSesion);
|
||||
|
||||
DbResult<PerfilSesionModel> ActualizarSesion(
|
||||
UserSessionModel usuarioSesion,
|
||||
string nombreUsuario,
|
||||
string contrasena);
|
||||
|
||||
DbResult<bool> ActualizarCliente(
|
||||
UserSessionModel usuarioSesion,
|
||||
PerfilClienteModel cliente);
|
||||
|
||||
DbResult<List<UsuarioCambioContextoModel>>
|
||||
ListarUsuariosCambio(
|
||||
UserSessionModel usuarioSesion,
|
||||
string texto);
|
||||
|
||||
DbResult<UserSessionModel> CambiarUsuario(
|
||||
UserSessionModel usuarioSesion,
|
||||
int cveUsuarioSeleccionado);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ namespace SIG.Web.AppCode.Contracts.Security
|
||||
{
|
||||
public interface IUserContextProvider
|
||||
{
|
||||
bool IsAuthenticated(); UserSessionModel GetCurrentUser(); void SetCurrentUser(UserSessionModel user); void Clear();
|
||||
bool IsAuthenticated();
|
||||
UserSessionModel GetCurrentUser();
|
||||
void SetCurrentUser(UserSessionModel user);
|
||||
void Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,19 @@ namespace SIG.Web.AppCode.Contracts.Tramites
|
||||
int executingUser,
|
||||
string domainName);
|
||||
|
||||
DbResult<List<TramiteSolicitudTipoOptionModel>> ListAvailableTypesForStage(
|
||||
int developmentId,
|
||||
int stageId,
|
||||
int executingUser,
|
||||
string domainName);
|
||||
|
||||
DbResult<TramiteSolicitudCreateResultModel> AddStageRequest(
|
||||
int developmentId,
|
||||
int stageId,
|
||||
int procedureTypeId,
|
||||
int executingUser,
|
||||
string domainName);
|
||||
|
||||
DbResult<List<TramiteSolicitudModel>> ListForDevelopment(
|
||||
int developmentId,
|
||||
int? stageId,
|
||||
|
||||
@@ -6,6 +6,19 @@ namespace SIG.Web.AppCode.Contracts.Tramites
|
||||
{
|
||||
public interface ITramiteSolicitudService
|
||||
{
|
||||
DbResult<List<TramiteSolicitudTipoOptionModel>> ListAvailableTypesForStage(
|
||||
int developmentId,
|
||||
int stageId,
|
||||
int executingUser,
|
||||
string domainName);
|
||||
|
||||
DbResult<TramiteSolicitudCreateResultModel> AddStageRequest(
|
||||
int developmentId,
|
||||
int stageId,
|
||||
int procedureTypeId,
|
||||
int executingUser,
|
||||
string domainName);
|
||||
|
||||
DbResult<List<TramiteSolicitudModel>> ListForDevelopment(
|
||||
int developmentId,
|
||||
int? stageId,
|
||||
|
||||
17
SIG.Web/App_Code/Contracts/Ventas/IProveedorPagoTarjeta.cs
Normal file
17
SIG.Web/App_Code/Contracts/Ventas/IProveedorPagoTarjeta.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Ventas;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.Ventas
|
||||
{
|
||||
public interface IProveedorPagoTarjeta
|
||||
{
|
||||
string CodigoProveedor { get; }
|
||||
bool Disponible { get; }
|
||||
|
||||
DbResult<ModeloSolicitudPortalPagoTarjeta> CrearSolicitud(
|
||||
ModeloInicioPortalPagoTarjeta solicitud);
|
||||
|
||||
DbResult<ModeloResultadoPortalPagoTarjeta> ConsultarResultado(
|
||||
string referenciaProveedor);
|
||||
}
|
||||
}
|
||||
90
SIG.Web/App_Code/Contracts/Ventas/IVentaTramiteRepository.cs
Normal file
90
SIG.Web/App_Code/Contracts/Ventas/IVentaTramiteRepository.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Ventas;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.Ventas
|
||||
{
|
||||
public interface IRepositorioVentaTramite
|
||||
{
|
||||
DbResult<List<ModeloPagoPendienteFraccionamiento>> ListarPagosPendientes(
|
||||
int cveFraccionamiento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<List<ModeloPagoRealizadoFraccionamiento>> ListarPagosRealizados(
|
||||
int cveFraccionamiento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloContextoVentaTramite> ObtenerContexto(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<List<ModeloConceptoVentaTramite>> ListarConceptos(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<int> Generar(
|
||||
ModeloCapturaVentaTramite venta,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloPagoRegistradoVentaTramite> Pagar(
|
||||
ModeloPagoVentaTramite pago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloOpcionesPagoVentaTramite> ObtenerOpcionesPago(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloOpcionesCondicionesPagoVentaTramite>
|
||||
ObtenerOpcionesCondicionesPago(
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<bool> GuardarCondicionesPago(
|
||||
ModeloCondicionesPagoVentaTramite condiciones,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<int> GuardarConcepto(
|
||||
ModeloCapturaConceptoVentaTramite concepto,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<bool> EliminarConcepto(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveVentaDetalle,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloDatosCfdiVentaTramite> ObtenerDatosCfdi(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<bool> MarcarTimbrada(
|
||||
int cveVenta,
|
||||
long cveCfdiDocumento,
|
||||
string uuid,
|
||||
System.DateTime? fechaTimbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<bool> MarcarTimbreCancelado(
|
||||
int cveVenta,
|
||||
long cveCfdiDocumento,
|
||||
string motivo,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
}
|
||||
}
|
||||
73
SIG.Web/App_Code/Contracts/Ventas/IVentaTramiteService.cs
Normal file
73
SIG.Web/App_Code/Contracts/Ventas/IVentaTramiteService.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Ventas;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.Ventas
|
||||
{
|
||||
public interface IServicioVentaTramite
|
||||
{
|
||||
DbResult<List<ModeloPagoPendienteFraccionamiento>> ListarPagosPendientes(
|
||||
int cveFraccionamiento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<List<ModeloPagoRealizadoFraccionamiento>> ListarPagosRealizados(
|
||||
int cveFraccionamiento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloContextoVentaTramite> ObtenerVenta(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<int> GenerarVenta(
|
||||
ModeloCapturaVentaTramite venta,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloPagoRegistradoVentaTramite> PagarVenta(
|
||||
ModeloPagoVentaTramite pago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloOpcionesPagoVentaTramite> ObtenerOpcionesPago(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<ModeloOpcionesCondicionesPagoVentaTramite>
|
||||
ObtenerOpcionesCondicionesPago(
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<bool> GuardarCondicionesPago(
|
||||
ModeloCondicionesPagoVentaTramite condiciones,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<int> GuardarConcepto(
|
||||
ModeloCapturaConceptoVentaTramite concepto,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<bool> EliminarConcepto(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveVentaDetalle,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<string> TimbrarVenta(
|
||||
ModeloTimbradoVentaTramite timbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<string> CancelarTimbre(
|
||||
ModeloCancelacionTimbreVentaTramite cancelacion,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public const string Timbrado = "TIMBRADO";
|
||||
public const string Error = "ERROR";
|
||||
public const string Revisar = "REVISAR";
|
||||
public const string Cancelado = "CANCELADO";
|
||||
}
|
||||
|
||||
public static class CfdiIntentoEstados
|
||||
@@ -239,6 +240,55 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public byte[] CodigoBidimensional { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiCancelacionSolicitudModel
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public string Motivo { get; set; }
|
||||
public string UuidSustitucion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiCancelacionInicioModel
|
||||
{
|
||||
public long CveCfdiCancelacion { get; set; }
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public long CveCfdiTimbrado { get; set; }
|
||||
public System.Guid IdSolicitud { get; set; }
|
||||
public string RfcEmisor { get; set; }
|
||||
public string Uuid { get; set; }
|
||||
public string Motivo { get; set; }
|
||||
public string UuidSustitucion { get; set; }
|
||||
public bool PuedeEnviar { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiPacCancelacionSolicitudModel
|
||||
{
|
||||
public string RfcEmisor { get; set; }
|
||||
public string Uuid { get; set; }
|
||||
public string Motivo { get; set; }
|
||||
public string UuidSustitucion { get; set; }
|
||||
public bool AmbienteProduccion { get; set; }
|
||||
public string ReferenciaCredencialPac { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiPacCancelacionResultadoModel
|
||||
{
|
||||
public bool Exitoso { get; set; }
|
||||
public bool ResultadoIndeterminado { get; set; }
|
||||
public string CodigoRespuesta { get; set; }
|
||||
public string MensajeRespuesta { get; set; }
|
||||
public string TipoExcepcion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiCancelacionResultadoModel
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public long CveCfdiCancelacion { get; set; }
|
||||
public bool CancelacionExitosa { get; set; }
|
||||
public string Estado { get; set; }
|
||||
public string CodigoRespuesta { get; set; }
|
||||
public string Mensaje { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiTimbradoResultadoModel
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
@@ -263,11 +313,4 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public byte[] HashSha256 { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiTimbradoFinalizadoContext
|
||||
{
|
||||
public CfdiDocumentoModel Documento { get; set; }
|
||||
public CfdiTimbradoIntentoModel Intento { get; set; }
|
||||
public int CveUsuarioEjecuta { get; set; }
|
||||
public string NombreDominio { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
19
SIG.Web/App_Code/Models/General/ProductoCatalogModels.cs
Normal file
19
SIG.Web/App_Code/Models/General/ProductoCatalogModels.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace SIG.Web.AppCode.Models.General
|
||||
{
|
||||
public sealed class ClasificacionModel
|
||||
{
|
||||
public int CveClasificacion { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
public string Clasificacion { get; set; }
|
||||
public bool Afectable { get; set; }
|
||||
public bool EsActivo { get; set; }
|
||||
}
|
||||
|
||||
public sealed class UnidadMedidaModel
|
||||
{
|
||||
public int CveUnidadMedida { get; set; }
|
||||
public string UnidadMedida { get; set; }
|
||||
public string Abreviatura { get; set; }
|
||||
public bool EsActivo { get; set; }
|
||||
}
|
||||
}
|
||||
53
SIG.Web/App_Code/Models/General/ProductoServicioModels.cs
Normal file
53
SIG.Web/App_Code/Models/General/ProductoServicioModels.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SIG.Web.AppCode.Models.General
|
||||
{
|
||||
[System.Serializable]
|
||||
public sealed class ProductoServicioModel
|
||||
{
|
||||
public int CvePS { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
public string PS { get; set; }
|
||||
public int CveTipoPS { get; set; }
|
||||
public string TipoPS { get; set; }
|
||||
public int CveClasificacion { get; set; }
|
||||
public string Clasificacion { get; set; }
|
||||
public int CveUnidadMedida { get; set; }
|
||||
public string UnidadMedida { get; set; }
|
||||
public decimal Precio { get; set; }
|
||||
public bool EsActivo { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ProductoServicioOpcionesModel
|
||||
{
|
||||
public ProductoServicioOpcionesModel()
|
||||
{
|
||||
Clasificaciones = new List<ClasificacionProductoOpcionModel>();
|
||||
UnidadesMedida = new List<UnidadMedidaOpcionModel>();
|
||||
}
|
||||
|
||||
public List<ClasificacionProductoOpcionModel> Clasificaciones
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public List<UnidadMedidaOpcionModel> UnidadesMedida
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ClasificacionProductoOpcionModel
|
||||
{
|
||||
public int CveClasificacion { get; set; }
|
||||
public string Clasificacion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class UnidadMedidaOpcionModel
|
||||
{
|
||||
public int CveUnidadMedida { get; set; }
|
||||
public string UnidadMedida { get; set; }
|
||||
}
|
||||
}
|
||||
101
SIG.Web/App_Code/Models/Security/PerfilUsuarioModels.cs
Normal file
101
SIG.Web/App_Code/Models/Security/PerfilUsuarioModels.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SIG.Web.AppCode.Models.Security
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class PerfilSesionModel
|
||||
{
|
||||
public int CveUsuario { get; set; }
|
||||
public string NombreUsuario { get; set; }
|
||||
public string CorreoElectronico { get; set; }
|
||||
public int CveRol { get; set; }
|
||||
public string NombreRol { get; set; }
|
||||
public int CveCliente { get; set; }
|
||||
public bool EsDesarrollador { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PerfilClienteModel
|
||||
{
|
||||
public int CveCliente { get; set; }
|
||||
public string Nombre { get; set; }
|
||||
public string NombreComercial { get; set; }
|
||||
public string Direccion { get; set; }
|
||||
public string NoExt { get; set; }
|
||||
public string NoInt { get; set; }
|
||||
public string Colonia { get; set; }
|
||||
public string Ciudad { get; set; }
|
||||
public string Estado { get; set; }
|
||||
public string Pais { get; set; }
|
||||
public string RFC { get; set; }
|
||||
public string CP { get; set; }
|
||||
public string Telefono { get; set; }
|
||||
public string Mail { get; set; }
|
||||
public int CveRegimenFiscal { get; set; }
|
||||
public string CodigoRegimenFiscal { get; set; }
|
||||
public string RegimenFiscal { get; set; }
|
||||
public int CveUsoCFDI { get; set; }
|
||||
public string UsoCFDI { get; set; }
|
||||
public string DescripcionUsoCFDI { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class RegimenFiscalPerfilOpcionModel
|
||||
{
|
||||
public int CveRegimenFiscal { get; set; }
|
||||
public string CodigoRegimenFiscal { get; set; }
|
||||
public string RegimenFiscal { get; set; }
|
||||
|
||||
public string Descripcion
|
||||
{
|
||||
get
|
||||
{
|
||||
return CodigoRegimenFiscal + " - " + RegimenFiscal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class UsoCfdiPerfilOpcionModel
|
||||
{
|
||||
public int CveUsoCFDI { get; set; }
|
||||
public string UsoCFDI { get; set; }
|
||||
public string Descripcion { get; set; }
|
||||
|
||||
public string DescripcionCompleta
|
||||
{
|
||||
get { return UsoCFDI + " - " + Descripcion; }
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PerfilUsuarioConsultaModel
|
||||
{
|
||||
public PerfilUsuarioConsultaModel()
|
||||
{
|
||||
RegimenesFiscales =
|
||||
new List<RegimenFiscalPerfilOpcionModel>();
|
||||
UsosCfdi = new List<UsoCfdiPerfilOpcionModel>();
|
||||
}
|
||||
|
||||
public PerfilSesionModel Sesion { get; set; }
|
||||
public PerfilClienteModel Cliente { get; set; }
|
||||
public List<RegimenFiscalPerfilOpcionModel>
|
||||
RegimenesFiscales { get; set; }
|
||||
public List<UsoCfdiPerfilOpcionModel> UsosCfdi { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class UsuarioCambioContextoModel
|
||||
{
|
||||
public int CveUsuario { get; set; }
|
||||
public string NombreUsuario { get; set; }
|
||||
public string CorreoElectronico { get; set; }
|
||||
public int CveRol { get; set; }
|
||||
public string NombreRol { get; set; }
|
||||
public bool DebeCambiarContrasena { get; set; }
|
||||
public int CveCliente { get; set; }
|
||||
public string Cliente { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,12 @@ namespace SIG.Web.AppCode.Models.Security
|
||||
public string HashContrasena { get; set; }
|
||||
public string CorreoElectronico { get; set; }
|
||||
public int CveRol { get; set; }
|
||||
public int CveCliente { get; set; }
|
||||
public string NombreRol { get; set; }
|
||||
public bool Activo { get; set; }
|
||||
public bool CorreoVerificado { get; set; }
|
||||
public bool DebeCambiarContrasena { get; set; } public int IntentosFallidosInicioSesion { get; set; }
|
||||
public bool DebeCambiarContrasena { get; set; }
|
||||
public int IntentosFallidosInicioSesion { get; set; }
|
||||
public DateTime? BloqueadoHasta { get; set; }
|
||||
public DateTime? FechaUltimoInicioSesion { get; set; }
|
||||
public DateTime? FechaUltimaConexion { get; set; }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace SIG.Web.AppCode.Models.Tramites
|
||||
{
|
||||
public enum TramiteCatalogOrderEntity
|
||||
@@ -124,16 +126,33 @@ namespace SIG.Web.AppCode.Models.Tramites
|
||||
public int CvePS { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
public string PS { get; set; }
|
||||
public int CveUM { get; set; }
|
||||
public string UnidadMedida { get; set; }
|
||||
public string Abreviatura { get; set; }
|
||||
public decimal Cantidad { get; set; }
|
||||
public decimal Precio { get; set; }
|
||||
public decimal Total { get; set; }
|
||||
|
||||
public string UnidadMedidaTexto
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(Abreviatura)
|
||||
? UnidadMedida
|
||||
: UnidadMedida + " (" + Abreviatura.Trim() + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ProductoServicioTramiteModel
|
||||
{
|
||||
public int CvePS { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
public string PS { get; set; }
|
||||
public int CveUnidadMedida { get; set; }
|
||||
public string UnidadMedida { get; set; }
|
||||
public string Abreviatura { get; set; }
|
||||
public decimal Precio { get; set; }
|
||||
public bool EsActivo { get; set; }
|
||||
|
||||
@@ -151,4 +170,5 @@ namespace SIG.Web.AppCode.Models.Tramites
|
||||
return codigo + PS + estado;
|
||||
}
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,29 @@ namespace SIG.Web.AppCode.Models.Tramites
|
||||
public DateTime? FechaAutorizacion { get; set; }
|
||||
public bool HuboCambio { get; set; }
|
||||
}
|
||||
public sealed class TramiteSolicitudTipoOptionModel
|
||||
{
|
||||
public int CveTipoTramite { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
public string TipoTramite { get; set; }
|
||||
public int Orden { get; set; }
|
||||
}
|
||||
|
||||
public sealed class TramiteSolicitudCreateResultModel
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public bool EsNuevo { get; set; }
|
||||
public string Folio { get; set; }
|
||||
public int CveCliente { get; set; }
|
||||
public int CveFraccionamiento { get; set; }
|
||||
public int CveFraccionamientoEtapa { get; set; }
|
||||
public string Etapa { get; set; }
|
||||
public int CveTipoTramite { get; set; }
|
||||
public string TipoTramite { get; set; }
|
||||
public int CveEstatusSolicitud { get; set; }
|
||||
public string EstatusSolicitud { get; set; }
|
||||
public int? CveUsuarioSolicita { get; set; }
|
||||
public DateTime? FechaInicio { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
28
SIG.Web/App_Code/Models/Ventas/PagoTarjetaModels.cs
Normal file
28
SIG.Web/App_Code/Models/Ventas/PagoTarjetaModels.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace SIG.Web.AppCode.Models.Ventas
|
||||
{
|
||||
public sealed class ModeloInicioPortalPagoTarjeta
|
||||
{
|
||||
public int CveVenta { get; set; }
|
||||
public int CvePago { get; set; }
|
||||
public decimal Importe { get; set; }
|
||||
public string Referencia { get; set; }
|
||||
public string UrlRetorno { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloSolicitudPortalPagoTarjeta
|
||||
{
|
||||
public string ReferenciaProveedor { get; set; }
|
||||
public string UrlRedireccion { get; set; }
|
||||
public DateTime? FechaExpiracion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloResultadoPortalPagoTarjeta
|
||||
{
|
||||
public string ReferenciaProveedor { get; set; }
|
||||
public bool Autorizado { get; set; }
|
||||
public string CodigoAutorizacion { get; set; }
|
||||
public string Mensaje { get; set; }
|
||||
}
|
||||
}
|
||||
248
SIG.Web/App_Code/Models/Ventas/VentaTramiteModels.cs
Normal file
248
SIG.Web/App_Code/Models/Ventas/VentaTramiteModels.cs
Normal file
@@ -0,0 +1,248 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SIG.Web.AppCode.Models.Ventas
|
||||
{
|
||||
public sealed class ModeloPagoPendienteFraccionamiento
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public int? CveVenta { get; set; }
|
||||
public bool VentaGenerada { get; set; }
|
||||
public string FolioSolicitud { get; set; }
|
||||
public string Etapa { get; set; }
|
||||
public string TipoTramite { get; set; }
|
||||
public string NombrePago { get; set; }
|
||||
public int NumeroConceptos { get; set; }
|
||||
public decimal SubTotal { get; set; }
|
||||
public decimal IVA { get; set; }
|
||||
public decimal Total { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloPagoRealizadoFraccionamiento
|
||||
{
|
||||
public int CveSolicitudPago { get; set; }
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public int CveVenta { get; set; }
|
||||
public int CvePago { get; set; }
|
||||
public string SerieFolio { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
public DateTime FechaPago { get; set; }
|
||||
public string Referencia { get; set; }
|
||||
public bool Autorizado { get; set; }
|
||||
public DateTime? FechaAutorizacion { get; set; }
|
||||
public string FolioSolicitud { get; set; }
|
||||
public string Etapa { get; set; }
|
||||
public string TipoTramite { get; set; }
|
||||
public string NombrePago { get; set; }
|
||||
public decimal SubTotal { get; set; }
|
||||
public decimal IVA { get; set; }
|
||||
public decimal Total { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloContextoVentaTramite
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public int? CveVenta { get; set; }
|
||||
public int? CvePago { get; set; }
|
||||
public bool VentaGenerada { get; set; }
|
||||
public bool VentaPagada { get; set; }
|
||||
public bool PagoPendienteAutorizacion { get; set; }
|
||||
public string ReferenciaPago { get; set; }
|
||||
public long? CveCfdiDocumento { get; set; }
|
||||
public bool VentaTimbrada { get; set; }
|
||||
public bool TimbreCancelado { get; set; }
|
||||
public string UuidTimbre { get; set; }
|
||||
public int CveFraccionamiento { get; set; }
|
||||
public string Fraccionamiento { get; set; }
|
||||
public int CveCliente { get; set; }
|
||||
public string Cliente { get; set; }
|
||||
public string RFC { get; set; }
|
||||
public string Direccion { get; set; }
|
||||
public string Colonia { get; set; }
|
||||
public string CiudadEstado { get; set; }
|
||||
public string CP { get; set; }
|
||||
public string Telefono { get; set; }
|
||||
public string Mail { get; set; }
|
||||
public string FolioSolicitud { get; set; }
|
||||
public string Etapa { get; set; }
|
||||
public string TipoTramite { get; set; }
|
||||
public string NombrePago { get; set; }
|
||||
public string TipoDocumento { get; set; }
|
||||
public string Serie { get; set; }
|
||||
public int Folio { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
public int CveMetodoPago { get; set; }
|
||||
public byte CveFormaPago { get; set; }
|
||||
public DateTime? FechaVencimiento { get; set; }
|
||||
public List<ModeloConceptoVentaTramite> Conceptos { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloConceptoVentaTramite
|
||||
{
|
||||
public int CveVentaDetalle { get; set; }
|
||||
public int CveTramitePagoDetalle { get; set; }
|
||||
public int CvePS { get; set; }
|
||||
public int CveUM { get; set; }
|
||||
public string UnidadMedida { get; set; }
|
||||
public int CveClasificacion { get; set; }
|
||||
public string Clasificacion { get; set; }
|
||||
public string ProductoServicio { get; set; }
|
||||
public decimal Cantidad { get; set; }
|
||||
public decimal PrecioUnitario { get; set; }
|
||||
public decimal Descuento { get; set; }
|
||||
public decimal IVA { get; set; }
|
||||
public decimal Importe { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloCapturaConceptoVentaTramite
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public int CveVentaDetalle { get; set; }
|
||||
public int CvePS { get; set; }
|
||||
public decimal Cantidad { get; set; }
|
||||
public decimal PrecioUnitario { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloDatosCfdiVentaTramite
|
||||
{
|
||||
public ModeloDatosCfdiVentaTramite()
|
||||
{
|
||||
Conceptos = new List<ModeloConceptoCfdiVentaTramite>();
|
||||
}
|
||||
|
||||
public int CveVenta { get; set; }
|
||||
public long? CveCfdiDocumento { get; set; }
|
||||
public int CveCliente { get; set; }
|
||||
public string Serie { get; set; }
|
||||
public int Folio { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
public string FormaPago { get; set; }
|
||||
public string MetodoPago { get; set; }
|
||||
public string Moneda { get; set; }
|
||||
public decimal TipoCambio { get; set; }
|
||||
public List<ModeloConceptoCfdiVentaTramite> Conceptos { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloConceptoCfdiVentaTramite
|
||||
{
|
||||
public string ClaveProductoServicio { get; set; }
|
||||
public string NumeroIdentificacion { get; set; }
|
||||
public decimal Cantidad { get; set; }
|
||||
public string ClaveUnidad { get; set; }
|
||||
public string Unidad { get; set; }
|
||||
public string Descripcion { get; set; }
|
||||
public decimal ValorUnitario { get; set; }
|
||||
public decimal Descuento { get; set; }
|
||||
public string ObjetoImpuesto { get; set; }
|
||||
public decimal BaseIVA { get; set; }
|
||||
public decimal TasaIVA { get; set; }
|
||||
public decimal ImporteIVA { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloTimbradoVentaTramite
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public int CveEmpresa { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloCancelacionTimbreVentaTramite
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public string Motivo { get; set; }
|
||||
public string UuidSustitucion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloCapturaVentaTramite
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public string Observaciones { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloPagoVentaTramite
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public decimal Importe { get; set; }
|
||||
public DateTime FechaPago { get; set; }
|
||||
public byte CveFormaPago { get; set; }
|
||||
public int? CveBancoCuenta { get; set; }
|
||||
public string Observaciones { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloPagoRegistradoVentaTramite
|
||||
{
|
||||
public int CvePago { get; set; }
|
||||
public string Referencia { get; set; }
|
||||
public bool Autorizado { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ModeloFormaPagoOpcion
|
||||
{
|
||||
public byte CveFormaPago { get; set; }
|
||||
public string FormaPago { get; set; }
|
||||
public string ClaveFormaPagoSAT { get; set; }
|
||||
public bool Disponible { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ModeloCuentaBancariaOpcion
|
||||
{
|
||||
public int CveBancoCuenta { get; set; }
|
||||
public string Banco { get; set; }
|
||||
public string NumeroCuenta { get; set; }
|
||||
public string CLABE { get; set; }
|
||||
public string CuentaBancaria { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ModeloOpcionesPagoVentaTramite
|
||||
{
|
||||
public ModeloOpcionesPagoVentaTramite()
|
||||
{
|
||||
FormasPago = new List<ModeloFormaPagoOpcion>();
|
||||
CuentasBancarias = new List<ModeloCuentaBancariaOpcion>();
|
||||
}
|
||||
|
||||
public int CveVenta { get; set; }
|
||||
public string ReferenciaPago { get; set; }
|
||||
public List<ModeloFormaPagoOpcion> FormasPago { get; set; }
|
||||
public List<ModeloCuentaBancariaOpcion> CuentasBancarias { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloCondicionesPagoVentaTramite
|
||||
{
|
||||
public int CveSolicitud { get; set; }
|
||||
public int CveTramitePago { get; set; }
|
||||
public int CveMetodoPago { get; set; }
|
||||
public byte CveFormaPago { get; set; }
|
||||
public DateTime FechaVencimiento { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloMetodoPagoOpcion
|
||||
{
|
||||
public int CveMetodoPago { get; set; }
|
||||
public string MetodoPago { get; set; }
|
||||
public string ClaveMetodoPagoSAT { get; set; }
|
||||
public string Descripcion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModeloOpcionesCondicionesPagoVentaTramite
|
||||
{
|
||||
public ModeloOpcionesCondicionesPagoVentaTramite()
|
||||
{
|
||||
MetodosPago = new List<ModeloMetodoPagoOpcion>();
|
||||
FormasPago = new List<ModeloFormaPagoOpcion>();
|
||||
}
|
||||
|
||||
public List<ModeloMetodoPagoOpcion> MetodosPago { get; set; }
|
||||
public List<ModeloFormaPagoOpcion> FormasPago { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ namespace SIG.Web.AppCode.Repositories.Bitacora
|
||||
{
|
||||
StoredProcedureCommand.Configure(
|
||||
command,
|
||||
"dbo.PA_Bit_BitacoraListByRelations",
|
||||
"dbo.PA_Bit_BitacoraResumenListByRelations",
|
||||
cveUsuarioEjecuta);
|
||||
|
||||
StoredProcedureCommand.AddInput(
|
||||
@@ -228,19 +228,6 @@ namespace SIG.Web.AppCode.Repositories.Bitacora
|
||||
bitacoras = reader.ToList<BitacoraModel>();
|
||||
}
|
||||
|
||||
// El procedimiento actual devuelve Campos y Relaciones
|
||||
// antes de RelacionesMostrar. En el resumen se omiten
|
||||
// ambos result sets para no materializar el detalle.
|
||||
if (reader.NextResult())
|
||||
{
|
||||
// Campos: se descartan en el listado.
|
||||
}
|
||||
|
||||
if (reader.NextResult())
|
||||
{
|
||||
// Relaciones internas: se descartan en el listado.
|
||||
}
|
||||
|
||||
if (reader.NextResult())
|
||||
{
|
||||
relacionesMostrar =
|
||||
@@ -267,97 +254,46 @@ namespace SIG.Web.AppCode.Repositories.Bitacora
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ResultadoPaginado<BitacoraModel>> Consultar(
|
||||
BitacoraConsultaModel consulta,
|
||||
public DbResult<BitacoraModel> ConsultarDetalle(
|
||||
long cveBitacora,
|
||||
int cveUsuarioEjecuta)
|
||||
{
|
||||
int registrosOmitidos = checked(
|
||||
(consulta.Pagina - 1) * consulta.RegistrosPorPagina);
|
||||
|
||||
return ExecuteCustom(BitacoraDomain, connection =>
|
||||
{
|
||||
using (IDbCommand command = connection.CreateCommand())
|
||||
{
|
||||
StoredProcedureCommand.Configure(
|
||||
command,
|
||||
"dbo.PA_Bit_BitacoraListByRelations",
|
||||
"dbo.PA_Bit_BitacoraDetalleGet",
|
||||
cveUsuarioEjecuta);
|
||||
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@RelacionesXml",
|
||||
SerializeFilters(consulta.Filtros),
|
||||
DbType.Xml);
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@RelacionesMostrarXml",
|
||||
SerializeRelationsToShow(
|
||||
consulta.RelacionesMostrar),
|
||||
DbType.Xml);
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@RegistrosOmitidos",
|
||||
registrosOmitidos,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@RegistrosPorPagina",
|
||||
consulta.RegistrosPorPagina,
|
||||
DbType.Int32);
|
||||
"@CveBitacora",
|
||||
cveBitacora,
|
||||
DbType.Int64);
|
||||
|
||||
int totalRegistros = 0;
|
||||
var bitacoras = new List<BitacoraModel>();
|
||||
BitacoraModel bitacora = null;
|
||||
var campos = new List<BitacoraCampoModel>();
|
||||
var relaciones = new List<BitacoraRelacionModel>();
|
||||
var relacionesMostrar =
|
||||
new List<BitacoraRelacionValorModel>();
|
||||
|
||||
using (IDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read() && !reader.IsDBNull(0))
|
||||
{
|
||||
totalRegistros = reader.GetInt32(0);
|
||||
}
|
||||
|
||||
if (reader.NextResult())
|
||||
{
|
||||
bitacoras = reader.ToList<BitacoraModel>();
|
||||
}
|
||||
bitacora = reader.ToObject<BitacoraModel>();
|
||||
|
||||
if (reader.NextResult())
|
||||
{
|
||||
campos = reader.ToList<BitacoraCampoModel>();
|
||||
}
|
||||
|
||||
if (reader.NextResult())
|
||||
{
|
||||
relaciones = reader.ToList<BitacoraRelacionModel>();
|
||||
}
|
||||
|
||||
if (reader.NextResult())
|
||||
{
|
||||
relacionesMostrar =
|
||||
reader.ToList<BitacoraRelacionValorModel>();
|
||||
}
|
||||
}
|
||||
|
||||
StoredProcedureCommand.EnsureSuccess(command);
|
||||
AsociarResultados(
|
||||
bitacoras,
|
||||
campos,
|
||||
relaciones,
|
||||
relacionesMostrar);
|
||||
|
||||
return new ResultadoPaginado<BitacoraModel>
|
||||
if (bitacora != null)
|
||||
{
|
||||
Registros = bitacoras,
|
||||
Pagina = consulta.Pagina,
|
||||
RegistrosPorPagina = consulta.RegistrosPorPagina,
|
||||
TotalRegistros = totalRegistros,
|
||||
TotalPaginas = (int)Math.Ceiling(
|
||||
totalRegistros /
|
||||
(decimal)consulta.RegistrosPorPagina)
|
||||
};
|
||||
bitacora.Campos = campos;
|
||||
}
|
||||
|
||||
return bitacora;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,8 +60,9 @@ namespace SIG.Web.AppCode.Repositories.Database
|
||||
return DbResult<T>.Ok(data);
|
||||
}
|
||||
catch (StoredProcedureException ex)
|
||||
{
|
||||
ExceptionLogger.Log(CreateDiagnosticException(ex), "DbExecutor.StoredProcedure", ex.UserMessage);
|
||||
{
|
||||
string diagnostic = StoredProcedureDiagnostics.BuildDiagnostic();
|
||||
ExceptionLogger.Log(CreateDiagnosticException(ex), "DbExecutor.StoredProcedure", ex.UserMessage + diagnostic);
|
||||
return DbResult<T>.Fail(ex.UserMessage, BuildTechnicalMessage(ex), ex);
|
||||
}
|
||||
catch (SqlException ex)
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace SIG.Web.AppCode.Repositories.Database
|
||||
if (value is byte[])
|
||||
{
|
||||
byte[] bytes = (byte[])value;
|
||||
int length = Math.Min(bytes.Length, 64);
|
||||
int length = Math.Min(bytes.Length, 64000);
|
||||
return "0x" + BitConverter.ToString(bytes, 0, length).Replace("-", string.Empty)
|
||||
+ (bytes.Length > length ? "/*TRUNCADO*/" : string.Empty);
|
||||
}
|
||||
@@ -200,11 +200,7 @@ namespace SIG.Web.AppCode.Repositories.Database
|
||||
if (value is string || value is char)
|
||||
{
|
||||
string text = Convert.ToString(value, CultureInfo.InvariantCulture) ?? string.Empty;
|
||||
|
||||
if (text.Length > 1000)
|
||||
{
|
||||
text = text.Substring(0, 1000) + " [TRUNCADO]";
|
||||
}
|
||||
|
||||
|
||||
return "N'" + text.Replace("'", "''") + "'";
|
||||
}
|
||||
|
||||
@@ -441,6 +441,98 @@ namespace SIG.Web.AppCode.Repositories.Facturacion
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<CfdiCancelacionInicioModel> IniciarCancelacion(
|
||||
CfdiCancelacionSolicitudModel solicitud,
|
||||
System.Guid idSolicitud,
|
||||
string proveedorPac,
|
||||
string ambiente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiCancelacionInicioModel>(
|
||||
"dbo.PA_Fac_CfdiCancelacionAttemptStart",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveCfdiDocumento",
|
||||
solicitud.CveCfdiDocumento,
|
||||
DbType.Int64);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@IdSolicitud",
|
||||
idSolicitud,
|
||||
DbType.Guid);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@ProveedorPac",
|
||||
proveedorPac,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Ambiente",
|
||||
ambiente,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Motivo",
|
||||
solicitud.Motivo,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@UuidSustitucion",
|
||||
solicitud.UuidSustitucion,
|
||||
DbType.String);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<CfdiCancelacionResultadoModel> FinalizarCancelacion(
|
||||
long cveCfdiCancelacion,
|
||||
CfdiPacCancelacionResultadoModel resultadoPac,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiCancelacionResultadoModel>(
|
||||
"dbo.PA_Fac_CfdiCancelacionAttemptComplete",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveCfdiCancelacion",
|
||||
cveCfdiCancelacion,
|
||||
DbType.Int64);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Exitoso",
|
||||
resultadoPac.Exitoso,
|
||||
DbType.Boolean);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@ResultadoIndeterminado",
|
||||
resultadoPac.ResultadoIndeterminado,
|
||||
DbType.Boolean);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CodigoRespuesta",
|
||||
resultadoPac.CodigoRespuesta,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@MensajeRespuesta",
|
||||
resultadoPac.MensajeRespuesta,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@TipoExcepcion",
|
||||
resultadoPac.TipoExcepcion,
|
||||
DbType.String);
|
||||
});
|
||||
}
|
||||
|
||||
private static void Add(
|
||||
IDbCommand command,
|
||||
string name,
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using SIG.Web.AppCode.Contracts.Database;
|
||||
using SIG.Web.AppCode.Contracts.General;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
using SIG.Web.AppCode.Repositories.Database;
|
||||
|
||||
namespace SIG.Web.AppCode.Repositories.General
|
||||
{
|
||||
public sealed class ProductoCatalogRepository
|
||||
: RepositoryBase, IProductoCatalogRepository
|
||||
{
|
||||
public ProductoCatalogRepository(IDbExecutor dbExecutor)
|
||||
: base(dbExecutor)
|
||||
{
|
||||
}
|
||||
|
||||
public DbResult<List<ClasificacionModel>> ListClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryList<ClasificacionModel>(
|
||||
"dbo.PA_Gral_ClasificacionList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
{
|
||||
Add(command, "@Texto", texto, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
"@IncluirInactivos",
|
||||
incluirInactivos,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ClasificacionModel> GetClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryOne<ClasificacionModel>(
|
||||
"dbo.PA_Gral_ClasificacionGet",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
"@CveClasificacion",
|
||||
cveClasificacion,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<int> SaveClasificacion(
|
||||
ClasificacionModel clasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryScalarId(
|
||||
"dbo.PA_Gral_ClasificacionSave",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
"@CveClasificacion",
|
||||
clasificacion.CveClasificacion > 0
|
||||
? (object)clasificacion.CveClasificacion
|
||||
: null,
|
||||
DbType.Int32);
|
||||
Add(command, "@Codigo", clasificacion.Codigo, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
"@Clasificacion",
|
||||
clasificacion.Clasificacion,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
"@Afectable",
|
||||
clasificacion.Afectable,
|
||||
DbType.Boolean);
|
||||
Add(
|
||||
command,
|
||||
"@EsActivo",
|
||||
clasificacion.EsActivo,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> DeleteClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return Execute(
|
||||
"dbo.PA_Gral_ClasificacionDelete",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
"@CveClasificacion",
|
||||
cveClasificacion,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<List<UnidadMedidaModel>> ListUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryList<UnidadMedidaModel>(
|
||||
"dbo.PA_Gral_UnidadMedidaList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
{
|
||||
Add(command, "@Texto", texto, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
"@IncluirInactivos",
|
||||
incluirInactivos,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<UnidadMedidaModel> GetUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryOne<UnidadMedidaModel>(
|
||||
"dbo.PA_Gral_UnidadMedidaGet",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
"@CveUnidadMedida",
|
||||
cveUnidadMedida,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<int> SaveUnidadMedida(
|
||||
UnidadMedidaModel unidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryScalarId(
|
||||
"dbo.PA_Gral_UnidadMedidaSave",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
"@CveUnidadMedida",
|
||||
unidadMedida.CveUnidadMedida > 0
|
||||
? (object)unidadMedida.CveUnidadMedida
|
||||
: null,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
"@UnidadMedida",
|
||||
unidadMedida.UnidadMedida,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
"@Abreviatura",
|
||||
unidadMedida.Abreviatura,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
"@EsActivo",
|
||||
unidadMedida.EsActivo,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> DeleteUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return Execute(
|
||||
"dbo.PA_Gral_UnidadMedidaDelete",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
"@CveUnidadMedida",
|
||||
cveUnidadMedida,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
private static void Add(
|
||||
IDbCommand command,
|
||||
string name,
|
||||
object value,
|
||||
DbType type)
|
||||
{
|
||||
StoredProcedureCommand.AddInput(command, name, value, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using SIG.Web.AppCode.Contracts.Database;
|
||||
using SIG.Web.AppCode.Contracts.General;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
using SIG.Web.AppCode.Repositories.Database;
|
||||
using SIG.Web.AppCode.Utilities;
|
||||
|
||||
namespace SIG.Web.AppCode.Repositories.General
|
||||
{
|
||||
public sealed class ProductoServicioRepository
|
||||
: RepositoryBase, IProductoServicioRepository
|
||||
{
|
||||
public ProductoServicioRepository(IDbExecutor dbExecutor)
|
||||
: base(dbExecutor)
|
||||
{
|
||||
}
|
||||
|
||||
public DbResult<List<ProductoServicioModel>> List(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryList<ProductoServicioModel>(
|
||||
"dbo.PA_Gral_ProductoServicioList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
{
|
||||
Add(command, "@Texto", texto, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
"@IncluirInactivos",
|
||||
incluirInactivos,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioModel> Get(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryOne<ProductoServicioModel>(
|
||||
"dbo.PA_Gral_ProductoServicioGet",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(command, "@CvePS", cvePS, DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioOpcionesModel> ListOptions(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryReader(
|
||||
"dbo.PA_Gral_ProductoServicioOpcionesList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
"@CveClasificacionActual",
|
||||
cveClasificacionActual,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
"@CveUnidadMedidaActual",
|
||||
cveUnidadMedidaActual,
|
||||
DbType.Int32);
|
||||
},
|
||||
reader =>
|
||||
{
|
||||
var options = new ProductoServicioOpcionesModel
|
||||
{
|
||||
Clasificaciones =
|
||||
reader.ToList<ClasificacionProductoOpcionModel>()
|
||||
};
|
||||
|
||||
if (reader.NextResult())
|
||||
{
|
||||
options.UnidadesMedida =
|
||||
reader.ToList<UnidadMedidaOpcionModel>();
|
||||
}
|
||||
|
||||
return options;
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<int> Save(
|
||||
ProductoServicioModel productoServicio,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryScalarId(
|
||||
"dbo.PA_Gral_ProductoServicioSave",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
"@CvePS",
|
||||
productoServicio.CvePS > 0
|
||||
? (object)productoServicio.CvePS
|
||||
: null,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
"@Codigo",
|
||||
productoServicio.Codigo,
|
||||
DbType.String);
|
||||
Add(command, "@PS", productoServicio.PS, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
"@CveTipoPS",
|
||||
productoServicio.CveTipoPS,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
"@CveClasificacion",
|
||||
productoServicio.CveClasificacion,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
"@CveUnidadMedida",
|
||||
productoServicio.CveUnidadMedida,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
"@Precio",
|
||||
productoServicio.Precio,
|
||||
DbType.Decimal);
|
||||
Add(
|
||||
command,
|
||||
"@EsActivo",
|
||||
productoServicio.EsActivo,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> Delete(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return Execute(
|
||||
"dbo.PA_Gral_ProductoServicioDelete",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
"@CvePS",
|
||||
cvePS,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
private static void Add(
|
||||
IDbCommand command,
|
||||
string name,
|
||||
object value,
|
||||
DbType type)
|
||||
{
|
||||
StoredProcedureCommand.AddInput(command, name, value, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using SIG.Web.AppCode.Contracts.Database;
|
||||
using SIG.Web.AppCode.Contracts.Security;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Security;
|
||||
using SIG.Web.AppCode.Repositories.Database;
|
||||
using SIG.Web.AppCode.Utilities;
|
||||
|
||||
namespace SIG.Web.AppCode.Repositories.Security
|
||||
{
|
||||
public sealed class PerfilUsuarioRepository
|
||||
: RepositoryBase, IPerfilUsuarioRepository
|
||||
{
|
||||
public PerfilUsuarioRepository(IDbExecutor ejecutorBaseDatos)
|
||||
: base(ejecutorBaseDatos)
|
||||
{
|
||||
}
|
||||
|
||||
public DbResult<PerfilUsuarioConsultaModel> ObtenerPerfil(
|
||||
int cveUsuario,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryReader(
|
||||
"dbo.PA_Sis_PerfilGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando => StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveUsuario",
|
||||
cveUsuario,
|
||||
DbType.Int32),
|
||||
lector =>
|
||||
{
|
||||
var perfil = new PerfilUsuarioConsultaModel
|
||||
{
|
||||
Sesion = lector.ToObject<PerfilSesionModel>()
|
||||
};
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
perfil.Cliente =
|
||||
lector.ToObject<PerfilClienteModel>();
|
||||
}
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
perfil.RegimenesFiscales = lector.ToList<
|
||||
RegimenFiscalPerfilOpcionModel>();
|
||||
}
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
perfil.UsosCfdi =
|
||||
lector.ToList<UsoCfdiPerfilOpcionModel>();
|
||||
}
|
||||
|
||||
return perfil;
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<PerfilSesionModel> ActualizarSesion(
|
||||
int cveUsuario,
|
||||
string nombreUsuario,
|
||||
string hashContrasena,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<PerfilSesionModel>(
|
||||
"dbo.PA_Sis_PerfilSesionUpdate",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveUsuario",
|
||||
cveUsuario,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@NombreUsuario",
|
||||
nombreUsuario,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@HashContrasena",
|
||||
hashContrasena,
|
||||
DbType.String);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> ActualizarCliente(
|
||||
PerfilClienteModel cliente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return Execute(
|
||||
"dbo.PA_Clientes_PerfilUpdate",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
AgregarDatosCliente(comando, cliente);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<List<UsuarioCambioContextoModel>>
|
||||
ListarUsuariosCambio(
|
||||
string texto,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryList<UsuarioCambioContextoModel>(
|
||||
"dbo.PA_Sis_UsuarioContextoList",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando => StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Texto",
|
||||
texto,
|
||||
DbType.String));
|
||||
}
|
||||
|
||||
public DbResult<UsuarioCambioContextoModel> ObtenerUsuarioContexto(
|
||||
int cveUsuario,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<UsuarioCambioContextoModel>(
|
||||
"dbo.PA_Sis_UsuarioContextoGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando => StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveUsuario",
|
||||
cveUsuario,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
private static void AgregarDatosCliente(
|
||||
IDbCommand comando,
|
||||
PerfilClienteModel cliente)
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveCliente",
|
||||
cliente.CveCliente,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Nombre",
|
||||
cliente.Nombre,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@NombreComercial",
|
||||
cliente.NombreComercial,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Direccion",
|
||||
cliente.Direccion,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@NoExt",
|
||||
cliente.NoExt,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@NoInt",
|
||||
cliente.NoInt,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Colonia",
|
||||
cliente.Colonia,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Ciudad",
|
||||
cliente.Ciudad,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Estado",
|
||||
cliente.Estado,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Pais",
|
||||
cliente.Pais,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@RFC",
|
||||
cliente.RFC,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CP",
|
||||
cliente.CP,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Telefono",
|
||||
cliente.Telefono,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Mail",
|
||||
cliente.Mail,
|
||||
DbType.String);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveRegimenFiscal",
|
||||
cliente.CveRegimenFiscal,
|
||||
DbType.Byte);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveUsoCFDI",
|
||||
cliente.CveUsoCFDI,
|
||||
DbType.Byte);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using SIG.Web.AppCode.Contracts.Database;
|
||||
using SIG.Web.AppCode.Contracts.Tramites;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
@@ -124,10 +125,41 @@ namespace SIG.Web.AppCode.Repositories.Tramites
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<DocumentoRequeridoModel> GetDocumentoRequerido(int id, int usuario, string dominio)
|
||||
public DbResult<DocumentoRequeridoModel> GetDocumentoRequerido(
|
||||
int id,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryOne<DocumentoRequeridoModel>("dbo.PA_Tra_DocumentoRequeridoGet", usuario, dominio, command =>
|
||||
Add(command, "@CveDocumentoRequerido", id, DbType.Int32));
|
||||
/*
|
||||
* El registro se obtiene desde el listado existente.
|
||||
* No se utiliza un PA específico Get para documento requerido.
|
||||
* El control de acceso al módulo permanece en el mecanismo
|
||||
* existente del proyecto.
|
||||
*/
|
||||
return QueryReader(
|
||||
"dbo.PA_Tra_DocumentoRequeridoList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
"@CveTipoTramite",
|
||||
null,
|
||||
DbType.Int32);
|
||||
|
||||
Add(
|
||||
command,
|
||||
"@IncluirInactivos",
|
||||
true,
|
||||
DbType.Boolean);
|
||||
},
|
||||
reader =>
|
||||
reader
|
||||
.ToList<DocumentoRequeridoModel>()
|
||||
.FirstOrDefault(
|
||||
item =>
|
||||
item.CveDocumentoRequerido == id));
|
||||
}
|
||||
|
||||
public DbResult<int> SaveDocumentoRequerido(DocumentoRequeridoModel model, int usuario, string dominio)
|
||||
@@ -272,6 +304,7 @@ namespace SIG.Web.AppCode.Repositories.Tramites
|
||||
Add(command, "@CveTramitePagoDetalle", NullableId(model.CveTramitePagoDetalle), DbType.Int32);
|
||||
Add(command, "@CveTramitePago", model.CveTramitePago, DbType.Int32);
|
||||
Add(command, "@CvePS", model.CvePS, DbType.Int32);
|
||||
Add(command, "@CveUM", model.CveUM, DbType.Int32);
|
||||
Add(command, "@Cantidad", model.Cantidad, DbType.Decimal);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,6 +42,62 @@ namespace SIG.Web.AppCode.Repositories.Tramites
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<List<TramiteSolicitudTipoOptionModel>> ListAvailableTypesForStage(
|
||||
int developmentId,
|
||||
int stageId,
|
||||
int executingUser,
|
||||
string domainName)
|
||||
{
|
||||
return QueryList<TramiteSolicitudTipoOptionModel>(
|
||||
"dbo.PA_Tramites_TipoTramiteDisponibleEtapaList",
|
||||
executingUser,
|
||||
domainName,
|
||||
command =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@CveFraccionamiento",
|
||||
developmentId,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@CveFraccionamientoEtapa",
|
||||
stageId,
|
||||
DbType.Int32);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<TramiteSolicitudCreateResultModel> AddStageRequest(
|
||||
int developmentId,
|
||||
int stageId,
|
||||
int procedureTypeId,
|
||||
int executingUser,
|
||||
string domainName)
|
||||
{
|
||||
return QueryOne<TramiteSolicitudCreateResultModel>(
|
||||
"dbo.PA_Tramites_SolicitudEtapaSave",
|
||||
executingUser,
|
||||
domainName,
|
||||
command =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@CveFraccionamientoEtapa",
|
||||
stageId,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@CveTipoTramite",
|
||||
procedureTypeId,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
"@CveFraccionamiento",
|
||||
developmentId,
|
||||
DbType.Int32);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<List<TramiteSolicitudModel>> ListForDevelopment(
|
||||
int developmentId,
|
||||
int? stageId,
|
||||
|
||||
417
SIG.Web/App_Code/Repositories/Ventas/VentaTramiteRepository.cs
Normal file
417
SIG.Web/App_Code/Repositories/Ventas/VentaTramiteRepository.cs
Normal file
@@ -0,0 +1,417 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using SIG.Web.AppCode.Contracts.Database;
|
||||
using SIG.Web.AppCode.Contracts.Ventas;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Ventas;
|
||||
using SIG.Web.AppCode.Repositories.Database;
|
||||
using SIG.Web.AppCode.Utilities;
|
||||
|
||||
namespace SIG.Web.AppCode.Repositories.Ventas
|
||||
{
|
||||
public sealed class RepositorioVentaTramite
|
||||
: RepositoryBase, IRepositorioVentaTramite
|
||||
{
|
||||
public RepositorioVentaTramite(IDbExecutor ejecutorBaseDatos)
|
||||
: base(ejecutorBaseDatos)
|
||||
{
|
||||
}
|
||||
|
||||
public DbResult<List<ModeloPagoPendienteFraccionamiento>> ListarPagosPendientes(
|
||||
int cveFraccionamiento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryList<ModeloPagoPendienteFraccionamiento>(
|
||||
"dbo.PA_Vta_FraccionamientoPagoPendienteList",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando => StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveFraccionamiento",
|
||||
cveFraccionamiento,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<List<ModeloPagoRealizadoFraccionamiento>> ListarPagosRealizados(
|
||||
int cveFraccionamiento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryList<ModeloPagoRealizadoFraccionamiento>(
|
||||
"dbo.PA_Vta_FraccionamientoPagoRealizadoList",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando => StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveFraccionamiento",
|
||||
cveFraccionamiento,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<ModeloContextoVentaTramite> ObtenerContexto(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<ModeloContextoVentaTramite>(
|
||||
"dbo.PA_Vta_TramiteContextoGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveSolicitud",
|
||||
cveSolicitud,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveTramitePago",
|
||||
cveTramitePago,
|
||||
DbType.Int32);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<List<ModeloConceptoVentaTramite>> ListarConceptos(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryList<ModeloConceptoVentaTramite>(
|
||||
"dbo.PA_Vta_TramiteConceptoList",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveSolicitud",
|
||||
cveSolicitud,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveTramitePago",
|
||||
cveTramitePago,
|
||||
DbType.Int32);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<int> Generar(
|
||||
ModeloCapturaVentaTramite venta,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryScalarId(
|
||||
"dbo.PA_Vta_TramiteVentaGenerar",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveSolicitud",
|
||||
venta.CveSolicitud,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveTramitePago",
|
||||
venta.CveTramitePago,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Observaciones",
|
||||
venta.Observaciones,
|
||||
DbType.String);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ModeloPagoRegistradoVentaTramite> Pagar(
|
||||
ModeloPagoVentaTramite pago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<ModeloPagoRegistradoVentaTramite>(
|
||||
"dbo.PA_Vta_TramitePagoSave",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveSolicitud",
|
||||
pago.CveSolicitud,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveTramitePago",
|
||||
pago.CveTramitePago,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Importe",
|
||||
pago.Importe,
|
||||
DbType.Decimal);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@FechaPago",
|
||||
pago.FechaPago,
|
||||
DbType.DateTime);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveFormaPago",
|
||||
pago.CveFormaPago,
|
||||
DbType.Byte);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveBancoCuenta",
|
||||
pago.CveBancoCuenta,
|
||||
DbType.Int32);
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@Observaciones",
|
||||
pago.Observaciones,
|
||||
DbType.String);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ModeloOpcionesPagoVentaTramite> ObtenerOpcionesPago(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryReader(
|
||||
"dbo.PA_Vta_TramitePagoOpcionesList",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveSolicitud",
|
||||
cveSolicitud,
|
||||
DbType.Int32);
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveTramitePago",
|
||||
cveTramitePago,
|
||||
DbType.Int32);
|
||||
},
|
||||
lector =>
|
||||
{
|
||||
ModeloOpcionesPagoVentaTramite opciones =
|
||||
lector.ToObject<ModeloOpcionesPagoVentaTramite>() ??
|
||||
new ModeloOpcionesPagoVentaTramite();
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
opciones.FormasPago =
|
||||
lector.ToList<ModeloFormaPagoOpcion>();
|
||||
}
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
opciones.CuentasBancarias =
|
||||
lector.ToList<ModeloCuentaBancariaOpcion>();
|
||||
}
|
||||
|
||||
return opciones;
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ModeloOpcionesCondicionesPagoVentaTramite>
|
||||
ObtenerOpcionesCondicionesPago(
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryReader(
|
||||
"dbo.PA_Vta_TramiteCondicionesPagoOpcionesList",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
null,
|
||||
lector =>
|
||||
{
|
||||
var opciones =
|
||||
new ModeloOpcionesCondicionesPagoVentaTramite
|
||||
{
|
||||
MetodosPago = lector.ToList<
|
||||
ModeloMetodoPagoOpcion>()
|
||||
};
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
opciones.FormasPago =
|
||||
lector.ToList<ModeloFormaPagoOpcion>();
|
||||
}
|
||||
|
||||
return opciones;
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> GuardarCondicionesPago(
|
||||
ModeloCondicionesPagoVentaTramite condiciones,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return Execute(
|
||||
"dbo.PA_Vta_TramiteCondicionesPagoSave",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveSolicitud",
|
||||
condiciones.CveSolicitud,
|
||||
DbType.Int32);
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveTramitePago",
|
||||
condiciones.CveTramitePago,
|
||||
DbType.Int32);
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveMetodoPago",
|
||||
condiciones.CveMetodoPago,
|
||||
DbType.Int32);
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveFormaPago",
|
||||
condiciones.CveFormaPago,
|
||||
DbType.Byte);
|
||||
Agregar(
|
||||
comando,
|
||||
"@FechaVencimiento",
|
||||
condiciones.FechaVencimiento,
|
||||
DbType.Date);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<int> GuardarConcepto(
|
||||
ModeloCapturaConceptoVentaTramite concepto,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryScalarId(
|
||||
"dbo.PA_Vta_TramiteConceptoSave",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
Agregar(comando, "@CveSolicitud", concepto.CveSolicitud, DbType.Int32);
|
||||
Agregar(comando, "@CveTramitePago", concepto.CveTramitePago, DbType.Int32);
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveVentaDetalle",
|
||||
concepto.CveVentaDetalle > 0
|
||||
? (object)concepto.CveVentaDetalle
|
||||
: null,
|
||||
DbType.Int32);
|
||||
Agregar(comando, "@CvePS", concepto.CvePS, DbType.Int32);
|
||||
Agregar(comando, "@Cantidad", concepto.Cantidad, DbType.Decimal);
|
||||
Agregar(comando, "@PrecioUnitario", concepto.PrecioUnitario, DbType.Decimal);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> EliminarConcepto(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveVentaDetalle,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return Execute(
|
||||
"dbo.PA_Vta_TramiteConceptoDelete",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
Agregar(comando, "@CveSolicitud", cveSolicitud, DbType.Int32);
|
||||
Agregar(comando, "@CveTramitePago", cveTramitePago, DbType.Int32);
|
||||
Agregar(comando, "@CveVentaDetalle", cveVentaDetalle, DbType.Int32);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ModeloDatosCfdiVentaTramite> ObtenerDatosCfdi(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryReader(
|
||||
"dbo.PA_Vta_TramiteVentaDatosCfdiGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
Agregar(comando, "@CveSolicitud", cveSolicitud, DbType.Int32);
|
||||
Agregar(comando, "@CveTramitePago", cveTramitePago, DbType.Int32);
|
||||
},
|
||||
lector =>
|
||||
{
|
||||
ModeloDatosCfdiVentaTramite datos =
|
||||
lector.ToObject<ModeloDatosCfdiVentaTramite>();
|
||||
|
||||
if (datos != null && lector.NextResult())
|
||||
{
|
||||
datos.Conceptos =
|
||||
lector.ToList<ModeloConceptoCfdiVentaTramite>();
|
||||
}
|
||||
|
||||
return datos;
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> MarcarTimbrada(
|
||||
int cveVenta,
|
||||
long cveCfdiDocumento,
|
||||
string uuid,
|
||||
System.DateTime? fechaTimbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return Execute(
|
||||
"dbo.PA_Vta_TramiteVentaTimbradaUpdate",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
Agregar(comando, "@CveVenta", cveVenta, DbType.Int32);
|
||||
Agregar(comando, "@CveCfdiDocumento", cveCfdiDocumento, DbType.Int64);
|
||||
Agregar(comando, "@Uuid", uuid, DbType.String);
|
||||
Agregar(comando, "@FechaTimbrado", fechaTimbrado, DbType.DateTime);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> MarcarTimbreCancelado(
|
||||
int cveVenta,
|
||||
long cveCfdiDocumento,
|
||||
string motivo,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return Execute(
|
||||
"dbo.PA_Vta_TramiteVentaTimbreCanceladoUpdate",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
comando =>
|
||||
{
|
||||
Agregar(comando, "@CveVenta", cveVenta, DbType.Int32);
|
||||
Agregar(comando, "@CveCfdiDocumento", cveCfdiDocumento, DbType.Int64);
|
||||
Agregar(comando, "@Motivo", motivo, DbType.String);
|
||||
});
|
||||
}
|
||||
|
||||
private static void Agregar(
|
||||
IDbCommand comando,
|
||||
string nombre,
|
||||
object valor,
|
||||
DbType tipo)
|
||||
{
|
||||
StoredProcedureCommand.AddInput(comando, nombre, valor, tipo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,7 @@ namespace SIG.Web.AppCode.Security
|
||||
}
|
||||
|
||||
if (!IsHomePage(currentPath) &&
|
||||
!IsAuthenticatedUtilityPage(currentPath) &&
|
||||
!AppServices.PermissionService.CanAccessPage(CurrentUser.CveUsuario, currentPath))
|
||||
{
|
||||
Response.Redirect("~/AccessDenied.aspx", true);
|
||||
@@ -128,6 +129,15 @@ namespace SIG.Web.AppCode.Security
|
||||
appRelativePath.Equals("~/Inicio.aspx", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static bool IsAuthenticatedUtilityPage(
|
||||
string appRelativePath)
|
||||
{
|
||||
return appRelativePath != null &&
|
||||
appRelativePath.Equals(
|
||||
"~/Pages/Security/Perfil.aspx",
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static bool IsPublicPage(string appRelativePath)
|
||||
{
|
||||
return appRelativePath != null &&
|
||||
@@ -165,4 +175,4 @@ namespace SIG.Web.AppCode.Security
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,34 +109,28 @@ namespace SIG.Web.AppCode.Services.Bitacora
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<ResultadoPaginado<BitacoraModel>> Consultar(
|
||||
BitacoraConsultaModel consulta)
|
||||
public DbResult<BitacoraModel> ConsultarDetalle(long cveBitacora)
|
||||
{
|
||||
string validationMessage = ValidarConsulta(consulta);
|
||||
|
||||
if (validationMessage != null)
|
||||
if (cveBitacora <= 0)
|
||||
{
|
||||
return Fail<ResultadoPaginado<BitacoraModel>>(
|
||||
validationMessage);
|
||||
return Fail<BitacoraModel>(
|
||||
"La clave del movimiento de bitácora no es válida.");
|
||||
}
|
||||
|
||||
BitacoraContextoModel contexto = _contextoProvider.Obtener();
|
||||
|
||||
if (contexto.CveUsuarioEjecuta <= 0)
|
||||
{
|
||||
return Fail<ResultadoPaginado<BitacoraModel>>(
|
||||
return Fail<BitacoraModel>(
|
||||
"No existe un usuario autenticado para consultar la bitácora.");
|
||||
}
|
||||
|
||||
BitacoraConsultaModel consultaNormalizada =
|
||||
NormalizarConsulta(consulta);
|
||||
|
||||
using (var scope = new TransactionLogic(
|
||||
TransactionScopeOption.Suppress))
|
||||
{
|
||||
DbResult<ResultadoPaginado<BitacoraModel>> result =
|
||||
_repository.Consultar(
|
||||
consultaNormalizada,
|
||||
DbResult<BitacoraModel> result =
|
||||
_repository.ConsultarDetalle(
|
||||
cveBitacora,
|
||||
contexto.CveUsuarioEjecuta);
|
||||
|
||||
if (result.Success)
|
||||
|
||||
124
SIG.Web/App_Code/Services/Facturacion/AlmacenArchivosCfdi.cs
Normal file
124
SIG.Web/App_Code/Services/Facturacion/AlmacenArchivosCfdi.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Web.Hosting;
|
||||
using SIG.Web.AppCode.Contracts.Facturacion;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Facturacion;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.Facturacion
|
||||
{
|
||||
public sealed class AlmacenArchivosCfdi : IAlmacenArchivosCfdi
|
||||
{
|
||||
public DbResult<string> GuardarXmlTimbrado(
|
||||
CfdiDocumentoModel documento,
|
||||
CfdiTimbradoIntentoModel intento)
|
||||
{
|
||||
if (documento == null || intento == null)
|
||||
{
|
||||
return Error(
|
||||
"No se recibieron los datos del XML timbrado.",
|
||||
null);
|
||||
}
|
||||
|
||||
if (documento.CveCliente <= 0 ||
|
||||
!documento.CveOrigen.HasValue ||
|
||||
documento.CveOrigen.Value <= 0 ||
|
||||
documento.CveCfdiDocumento <= 0 ||
|
||||
intento.XmlTimbrado == null ||
|
||||
intento.XmlTimbrado.Length == 0)
|
||||
{
|
||||
return Error(
|
||||
"El XML timbrado no contiene los datos necesarios para crear el archivo.",
|
||||
null);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string rutaRelativaDirectorio = string.Format(
|
||||
"~/Documentos/Clientes/{0}/CFDI/Ventas/",
|
||||
documento.CveCliente);
|
||||
string rutaDirectorio = HostingEnvironment.MapPath(
|
||||
rutaRelativaDirectorio);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(rutaDirectorio))
|
||||
{
|
||||
return Error(
|
||||
"No fue posible resolver el directorio de archivos CFDI.",
|
||||
null);
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(rutaDirectorio);
|
||||
|
||||
string nombreArchivo = string.Format(
|
||||
"cfdi-venta-{0}-documento-{1}.xml",
|
||||
documento.CveOrigen.Value,
|
||||
documento.CveCfdiDocumento);
|
||||
string rutaArchivo = Path.Combine(
|
||||
rutaDirectorio,
|
||||
nombreArchivo);
|
||||
string rutaTemporal = Path.Combine(
|
||||
rutaDirectorio,
|
||||
"." + nombreArchivo + "." +
|
||||
Guid.NewGuid().ToString("N") + ".tmp");
|
||||
|
||||
try
|
||||
{
|
||||
using (FileStream archivo = new FileStream(
|
||||
rutaTemporal,
|
||||
FileMode.CreateNew,
|
||||
FileAccess.Write,
|
||||
FileShare.None))
|
||||
{
|
||||
archivo.Write(
|
||||
intento.XmlTimbrado,
|
||||
0,
|
||||
intento.XmlTimbrado.Length);
|
||||
archivo.Flush();
|
||||
}
|
||||
|
||||
if (File.Exists(rutaArchivo))
|
||||
{
|
||||
File.Replace(
|
||||
rutaTemporal,
|
||||
rutaArchivo,
|
||||
null);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Move(
|
||||
rutaTemporal,
|
||||
rutaArchivo);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(rutaTemporal))
|
||||
{
|
||||
File.Delete(rutaTemporal);
|
||||
}
|
||||
}
|
||||
|
||||
return DbResult<string>.Ok(
|
||||
rutaRelativaDirectorio + nombreArchivo);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
return Error(
|
||||
"No fue posible crear el archivo XML timbrado.",
|
||||
exception);
|
||||
}
|
||||
}
|
||||
|
||||
private static DbResult<string> Error(
|
||||
string mensaje,
|
||||
Exception exception)
|
||||
{
|
||||
return DbResult<string>.Fail(
|
||||
mensaje,
|
||||
exception == null
|
||||
? mensaje
|
||||
: exception.ToString(),
|
||||
exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,15 +15,16 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
private readonly ICfdiXmlBuilder _xmlBuilder;
|
||||
private readonly IDictionary<string, IPacTimbradoClient>
|
||||
_pacClients;
|
||||
private readonly IList<ICfdiTimbradoFinalizadoHandler>
|
||||
_finalizationHandlers;
|
||||
private readonly IDictionary<string, IPacCancelacionClient>
|
||||
_clientesCancelacionPac;
|
||||
private readonly IAlmacenArchivosCfdi _almacenArchivosCfdi;
|
||||
|
||||
public CfdiTimbradoService(
|
||||
ICfdiRepository repository,
|
||||
ICfdiXmlBuilder xmlBuilder,
|
||||
IEnumerable<IPacTimbradoClient> pacClients,
|
||||
IEnumerable<ICfdiTimbradoFinalizadoHandler>
|
||||
finalizationHandlers)
|
||||
IEnumerable<IPacCancelacionClient> clientesCancelacionPac,
|
||||
IAlmacenArchivosCfdi almacenArchivosCfdi)
|
||||
{
|
||||
_repository = repository;
|
||||
_xmlBuilder = xmlBuilder;
|
||||
@@ -32,10 +33,14 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
.ToDictionary(
|
||||
client => client.Proveedor,
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
_finalizationHandlers = (finalizationHandlers
|
||||
?? Enumerable.Empty<
|
||||
ICfdiTimbradoFinalizadoHandler>())
|
||||
.ToList();
|
||||
_clientesCancelacionPac = (clientesCancelacionPac
|
||||
?? Enumerable.Empty<IPacCancelacionClient>())
|
||||
.ToDictionary(
|
||||
cliente => cliente.Proveedor,
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
_almacenArchivosCfdi = almacenArchivosCfdi
|
||||
?? throw new ArgumentNullException(
|
||||
"almacenArchivosCfdi");
|
||||
}
|
||||
|
||||
public DbResult<long> GuardarBorrador(
|
||||
@@ -278,19 +283,24 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
|
||||
CfdiTimbradoIntentoModel intento =
|
||||
completeResult.Data;
|
||||
string handlerWarning = EjecutarFinalizadores(
|
||||
documento,
|
||||
intento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
string message = intento.MensajeRespuesta;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(handlerWarning))
|
||||
if (intento.Exitoso)
|
||||
{
|
||||
message = string.IsNullOrWhiteSpace(message)
|
||||
? handlerWarning
|
||||
: message + " " + handlerWarning;
|
||||
DbResult<string> resultadoArchivo =
|
||||
_almacenArchivosCfdi.GuardarXmlTimbrado(
|
||||
documento,
|
||||
intento);
|
||||
|
||||
if (!resultadoArchivo.Success)
|
||||
{
|
||||
const string advertenciaArchivo =
|
||||
"El timbre quedó guardado, pero el archivo XML requiere revisión.";
|
||||
|
||||
message = string.IsNullOrWhiteSpace(message)
|
||||
? advertenciaArchivo
|
||||
: message + " " + advertenciaArchivo;
|
||||
}
|
||||
}
|
||||
|
||||
return DbResult<CfdiTimbradoResultadoModel>.Ok(
|
||||
@@ -353,6 +363,136 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
nombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<CfdiCancelacionResultadoModel> Cancelar(
|
||||
CfdiCancelacionSolicitudModel solicitud,
|
||||
Guid? idSolicitud,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (solicitud == null || solicitud.CveCfdiDocumento <= 0)
|
||||
{
|
||||
return Fail<CfdiCancelacionResultadoModel>(
|
||||
"Seleccione un timbre válido para cancelar.");
|
||||
}
|
||||
|
||||
DbResult<CfdiDocumentoModel> documentoResultado =
|
||||
_repository.ObtenerDocumento(
|
||||
solicitud.CveCfdiDocumento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!documentoResultado.Success || documentoResultado.Data == null)
|
||||
{
|
||||
return documentoResultado.Success
|
||||
? Fail<CfdiCancelacionResultadoModel>(
|
||||
"No se encontró el CFDI solicitado.")
|
||||
: CopyFailure<CfdiDocumentoModel, CfdiCancelacionResultadoModel>(
|
||||
documentoResultado);
|
||||
}
|
||||
|
||||
CfdiDocumentoModel documento = documentoResultado.Data;
|
||||
|
||||
if (!documento.CveCfdiTimbradoVigente.HasValue ||
|
||||
string.IsNullOrWhiteSpace(documento.UuidVigente))
|
||||
{
|
||||
return Fail<CfdiCancelacionResultadoModel>(
|
||||
"La venta no tiene un timbre vigente para cancelar.");
|
||||
}
|
||||
|
||||
DbResult<CfdiEmisorFiscalModel> emisorResultado =
|
||||
_repository.ObtenerEmisor(
|
||||
documento.CveEmpresa,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!emisorResultado.Success || emisorResultado.Data == null)
|
||||
{
|
||||
return emisorResultado.Success
|
||||
? Fail<CfdiCancelacionResultadoModel>(
|
||||
"La empresa no tiene un emisor fiscal activo.")
|
||||
: CopyFailure<CfdiEmisorFiscalModel, CfdiCancelacionResultadoModel>(
|
||||
emisorResultado);
|
||||
}
|
||||
|
||||
CfdiEmisorFiscalModel emisor = emisorResultado.Data;
|
||||
IPacCancelacionClient clienteCancelacion;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(emisor.ProveedorPac) ||
|
||||
!_clientesCancelacionPac.TryGetValue(
|
||||
emisor.ProveedorPac.Trim(),
|
||||
out clienteCancelacion))
|
||||
{
|
||||
return Fail<CfdiCancelacionResultadoModel>(
|
||||
"El proveedor PAC configurado no permite cancelar el timbre desde la aplicación.");
|
||||
}
|
||||
|
||||
DbResult<CfdiCancelacionInicioModel> inicioResultado;
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
inicioResultado = _repository.IniciarCancelacion(
|
||||
solicitud,
|
||||
idSolicitud ?? Guid.NewGuid(),
|
||||
emisor.ProveedorPac,
|
||||
emisor.AmbienteProduccion ? "PRODUCCION" : "PRUEBAS",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (inicioResultado.Success)
|
||||
{
|
||||
transaccion.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
if (!inicioResultado.Success || inicioResultado.Data == null)
|
||||
{
|
||||
return inicioResultado.Success
|
||||
? Fail<CfdiCancelacionResultadoModel>(
|
||||
"No fue posible registrar la solicitud de cancelación.")
|
||||
: CopyFailure<CfdiCancelacionInicioModel, CfdiCancelacionResultadoModel>(
|
||||
inicioResultado);
|
||||
}
|
||||
|
||||
CfdiCancelacionInicioModel inicio = inicioResultado.Data;
|
||||
|
||||
if (!inicio.PuedeEnviar)
|
||||
{
|
||||
return Fail<CfdiCancelacionResultadoModel>(
|
||||
"La solicitud de cancelación ya fue procesada.");
|
||||
}
|
||||
|
||||
CfdiPacCancelacionResultadoModel resultadoPac =
|
||||
clienteCancelacion.Cancelar(
|
||||
new CfdiPacCancelacionSolicitudModel
|
||||
{
|
||||
RfcEmisor = inicio.RfcEmisor,
|
||||
Uuid = inicio.Uuid,
|
||||
Motivo = inicio.Motivo,
|
||||
UuidSustitucion = inicio.UuidSustitucion,
|
||||
AmbienteProduccion = emisor.AmbienteProduccion,
|
||||
ReferenciaCredencialPac =
|
||||
emisor.ReferenciaCredencialPac
|
||||
});
|
||||
|
||||
DbResult<CfdiCancelacionResultadoModel> finResultado;
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
finResultado = _repository.FinalizarCancelacion(
|
||||
inicio.CveCfdiCancelacion,
|
||||
resultadoPac,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (finResultado.Success)
|
||||
{
|
||||
transaccion.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
return finResultado;
|
||||
}
|
||||
|
||||
private CfdiPacResultadoModel EnviarAlPac(
|
||||
CfdiDocumentoModel documento,
|
||||
CfdiEmisorFiscalModel emisor,
|
||||
@@ -398,40 +538,6 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
});
|
||||
}
|
||||
|
||||
private string EjecutarFinalizadores(
|
||||
CfdiDocumentoModel documento,
|
||||
CfdiTimbradoIntentoModel intento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (_finalizationHandlers.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var context = new CfdiTimbradoFinalizadoContext
|
||||
{
|
||||
Documento = documento,
|
||||
Intento = intento,
|
||||
CveUsuarioEjecuta = cveUsuarioEjecuta,
|
||||
NombreDominio = nombreDominio
|
||||
};
|
||||
|
||||
foreach (ICfdiTimbradoFinalizadoHandler handler
|
||||
in _finalizationHandlers)
|
||||
{
|
||||
DbResult<bool> result =
|
||||
handler.AlFinalizar(context);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return "El timbre quedó guardado, pero una acción posterior requiere revisión.";
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static DbResult<T> Fail<T>(string message)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
|
||||
public sealed class ProfactPacTimbradoClient
|
||||
: IPacTimbradoClient
|
||||
: IPacTimbradoClient, IPacCancelacionClient
|
||||
{
|
||||
private readonly IPacCredentialProvider _credentialProvider;
|
||||
|
||||
@@ -125,6 +125,108 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
}
|
||||
|
||||
public CfdiPacCancelacionResultadoModel Cancelar(
|
||||
CfdiPacCancelacionSolicitudModel solicitud)
|
||||
{
|
||||
if (solicitud == null ||
|
||||
string.IsNullOrWhiteSpace(solicitud.RfcEmisor) ||
|
||||
string.IsNullOrWhiteSpace(solicitud.Uuid) ||
|
||||
string.IsNullOrWhiteSpace(solicitud.Motivo))
|
||||
{
|
||||
return FalloCancelacion(
|
||||
"CFDI_CANCELACION_INCOMPLETA",
|
||||
"La solicitud de cancelación está incompleta.");
|
||||
}
|
||||
|
||||
string credencial =
|
||||
_credentialProvider.ObtenerCredencial(
|
||||
solicitud.ReferenciaCredencialPac);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(credencial))
|
||||
{
|
||||
return FalloCancelacion(
|
||||
"PAC_NO_CONFIGURADO",
|
||||
"No se configuró la credencial del PAC para el emisor.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var conector = new ProfactConnector40(
|
||||
solicitud.AmbienteProduccion);
|
||||
conector.EstableceCredenciales(credencial);
|
||||
|
||||
ResultadoCancelacion resultado =
|
||||
conector.CancelaCFDI40(
|
||||
solicitud.RfcEmisor.Trim(),
|
||||
solicitud.Uuid.Trim(),
|
||||
solicitud.Motivo.Trim(),
|
||||
Texto(solicitud.UuidSustitucion));
|
||||
|
||||
return resultado == null
|
||||
? FalloCancelacion(
|
||||
"PAC_SIN_RESPUESTA",
|
||||
"El PAC no devolvió una respuesta de cancelación.")
|
||||
: new CfdiPacCancelacionResultadoModel
|
||||
{
|
||||
Exitoso = resultado.Exitoso,
|
||||
CodigoRespuesta = Texto(resultado.NumeroError),
|
||||
MensajeRespuesta =
|
||||
Texto(resultado.Descripcion) ??
|
||||
(resultado.Exitoso
|
||||
? "Timbre cancelado correctamente."
|
||||
: "El PAC no pudo cancelar el timbre."),
|
||||
TipoExcepcion = Texto(resultado.TipoExcepcion)
|
||||
};
|
||||
}
|
||||
catch (TimeoutException exception)
|
||||
{
|
||||
return CancelacionIndeterminada(exception);
|
||||
}
|
||||
catch (CommunicationException exception)
|
||||
{
|
||||
return CancelacionIndeterminada(exception);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
return new CfdiPacCancelacionResultadoModel
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = false,
|
||||
CodigoRespuesta = "PAC_EXCEPCION",
|
||||
MensajeRespuesta =
|
||||
"El PAC rechazó la cancelación o no pudo procesarla.",
|
||||
TipoExcepcion = exception.GetType().FullName
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static CfdiPacCancelacionResultadoModel FalloCancelacion(
|
||||
string codigo,
|
||||
string mensaje)
|
||||
{
|
||||
return new CfdiPacCancelacionResultadoModel
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = false,
|
||||
CodigoRespuesta = codigo,
|
||||
MensajeRespuesta = mensaje
|
||||
};
|
||||
}
|
||||
|
||||
private static CfdiPacCancelacionResultadoModel CancelacionIndeterminada(
|
||||
Exception exception)
|
||||
{
|
||||
return new CfdiPacCancelacionResultadoModel
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = true,
|
||||
CodigoRespuesta = "PAC_RESULTADO_INDETERMINADO",
|
||||
MensajeRespuesta =
|
||||
"El PAC no confirmó la cancelación. Debe consultarse antes de reenviar.",
|
||||
TipoExcepcion = exception.GetType().FullName
|
||||
};
|
||||
}
|
||||
|
||||
private static CfdiPacResultadoModel ConvertirResultado(
|
||||
ResultadoTimbre resultado)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
internal static class ProductoCatalogBitacoraFactory
|
||||
{
|
||||
public static BitacoraEventoModel CreateClasificacion(
|
||||
ClasificacionModel previous,
|
||||
ClasificacionModel current,
|
||||
int cveClasificacion,
|
||||
BitacoraTipoMovimiento movement)
|
||||
{
|
||||
ClasificacionModel value = current ?? previous;
|
||||
var auditEvent = CreateEvent(
|
||||
"Clasificaciones",
|
||||
"CveClasificacion",
|
||||
cveClasificacion,
|
||||
movement,
|
||||
Description(
|
||||
movement,
|
||||
"la clasificación",
|
||||
value.Clasificacion),
|
||||
movement == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
Field(
|
||||
"Codigo",
|
||||
previous == null ? null : previous.Codigo,
|
||||
current.Codigo),
|
||||
Field(
|
||||
"Clasificacion",
|
||||
previous == null
|
||||
? null
|
||||
: previous.Clasificacion,
|
||||
current.Clasificacion),
|
||||
Field(
|
||||
"Afectable",
|
||||
previous == null
|
||||
? (object)null
|
||||
: previous.Afectable,
|
||||
current.Afectable),
|
||||
Field(
|
||||
"Estado",
|
||||
previous == null
|
||||
? (object)null
|
||||
: previous.EsActivo,
|
||||
current.EsActivo)
|
||||
});
|
||||
|
||||
return auditEvent;
|
||||
}
|
||||
|
||||
public static BitacoraEventoModel CreateUnidadMedida(
|
||||
UnidadMedidaModel previous,
|
||||
UnidadMedidaModel current,
|
||||
int cveUnidadMedida,
|
||||
BitacoraTipoMovimiento movement)
|
||||
{
|
||||
UnidadMedidaModel value = current ?? previous;
|
||||
return CreateEvent(
|
||||
"UnidadesMedida",
|
||||
"CveUnidadMedida",
|
||||
cveUnidadMedida,
|
||||
movement,
|
||||
Description(
|
||||
movement,
|
||||
"la unidad de medida",
|
||||
value.UnidadMedida),
|
||||
movement == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
Field(
|
||||
"UnidadMedida",
|
||||
previous == null
|
||||
? null
|
||||
: previous.UnidadMedida,
|
||||
current.UnidadMedida),
|
||||
Field(
|
||||
"Abreviatura",
|
||||
previous == null
|
||||
? null
|
||||
: previous.Abreviatura,
|
||||
current.Abreviatura),
|
||||
Field(
|
||||
"Estado",
|
||||
previous == null
|
||||
? (object)null
|
||||
: previous.EsActivo,
|
||||
current.EsActivo)
|
||||
});
|
||||
}
|
||||
|
||||
private static BitacoraEventoModel CreateEvent(
|
||||
string table,
|
||||
string keyField,
|
||||
int key,
|
||||
BitacoraTipoMovimiento movement,
|
||||
string description,
|
||||
IList<BitacoraCampoEventoModel> fields)
|
||||
{
|
||||
var auditEvent = new BitacoraEventoModel
|
||||
{
|
||||
NombreTablaSQL = table,
|
||||
TipoMovimiento = movement,
|
||||
LlaveRegistro = key.ToString(),
|
||||
DescripcionMovimiento = description,
|
||||
DiscriminarCamposSinCambios = movement !=
|
||||
BitacoraTipoMovimiento.Agregado,
|
||||
Campos = fields
|
||||
};
|
||||
|
||||
auditEvent.Relaciones.Add(
|
||||
new BitacoraRelacionEventoModel
|
||||
{
|
||||
TipoRelacion = BitacoraTipoRelacion.Directa,
|
||||
NombreTablaSQL = table,
|
||||
NombreCampoSQL = keyField,
|
||||
Valor = key,
|
||||
VisibleDesarrollador = false,
|
||||
DescripcionRelacion = "Registro de catálogo afectado."
|
||||
});
|
||||
|
||||
return auditEvent;
|
||||
}
|
||||
|
||||
private static BitacoraCampoEventoModel Field(
|
||||
string name,
|
||||
object previous,
|
||||
object current)
|
||||
{
|
||||
return new BitacoraCampoEventoModel
|
||||
{
|
||||
NombreCampoSQL = name,
|
||||
ValorAnterior = previous,
|
||||
ValorNuevo = current
|
||||
};
|
||||
}
|
||||
|
||||
private static string Description(
|
||||
BitacoraTipoMovimiento movement,
|
||||
string entity,
|
||||
string name)
|
||||
{
|
||||
if (movement == BitacoraTipoMovimiento.Agregado)
|
||||
{
|
||||
return "Se agregó " + entity + " " + name + ".";
|
||||
}
|
||||
|
||||
if (movement == BitacoraTipoMovimiento.Editado)
|
||||
{
|
||||
return "Se modificó " + entity + " " + name + ".";
|
||||
}
|
||||
|
||||
return "Se eliminó " + entity + " " + name + ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
438
SIG.Web/App_Code/Services/General/ProductoCatalogService.cs
Normal file
438
SIG.Web/App_Code/Services/General/ProductoCatalogService.cs
Normal file
@@ -0,0 +1,438 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Contracts.Bitacora;
|
||||
using SIG.Web.AppCode.Contracts.General;
|
||||
using SIG.Web.AppCode.Infrastructure.Transactions;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
public sealed class ProductoCatalogService : IProductoCatalogService
|
||||
{
|
||||
private readonly IProductoCatalogRepository _repository;
|
||||
private readonly IBitacoraService _bitacora;
|
||||
|
||||
public ProductoCatalogService(
|
||||
IProductoCatalogRepository repository,
|
||||
IBitacoraService bitacora)
|
||||
{
|
||||
_repository = repository ??
|
||||
throw new ArgumentNullException("repository");
|
||||
_bitacora = bitacora ??
|
||||
throw new ArgumentNullException("bitacora");
|
||||
}
|
||||
|
||||
public DbResult<List<ClasificacionModel>> ListClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repository.ListClasificaciones(
|
||||
TrimOrNull(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<ClasificacionModel> GetClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cveClasificacion > 0
|
||||
? _repository.GetClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio)
|
||||
: Fail<ClasificacionModel>(
|
||||
"Seleccione una clasificación válida.");
|
||||
}
|
||||
|
||||
public DbResult<int> SaveClasificacion(
|
||||
ClasificacionModel clasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validation = Validate(clasificacion);
|
||||
|
||||
if (!validation.Success)
|
||||
{
|
||||
return validation;
|
||||
}
|
||||
|
||||
clasificacion.Codigo = TrimOrNull(clasificacion.Codigo);
|
||||
clasificacion.Clasificacion = clasificacion.Clasificacion.Trim();
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
ClasificacionModel previous = null;
|
||||
|
||||
if (clasificacion.CveClasificacion > 0)
|
||||
{
|
||||
DbResult<ClasificacionModel> previousResult =
|
||||
_repository.GetClasificacion(
|
||||
clasificacion.CveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<ClasificacionModel, int>(
|
||||
previousResult,
|
||||
"La clasificación seleccionada no existe.");
|
||||
}
|
||||
|
||||
previous = previousResult.Data;
|
||||
}
|
||||
|
||||
DbResult<int> result = _repository.SaveClasificacion(
|
||||
clasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<ClasificacionModel> currentResult =
|
||||
_repository.GetClasificacion(
|
||||
result.Data,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!currentResult.Success || currentResult.Data == null)
|
||||
{
|
||||
return FailFrom<ClasificacionModel, int>(
|
||||
currentResult,
|
||||
"No fue posible recuperar la clasificación guardada.");
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoCatalogBitacoraFactory.CreateClasificacion(
|
||||
previous,
|
||||
currentResult.Data,
|
||||
result.Data,
|
||||
previous == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return FailFrom<long, int>(
|
||||
auditResult,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> DeleteClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cveClasificacion <= 0)
|
||||
{
|
||||
return Fail<bool>("Seleccione una clasificación válida.");
|
||||
}
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
DbResult<ClasificacionModel> previousResult =
|
||||
_repository.GetClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<ClasificacionModel, bool>(
|
||||
previousResult,
|
||||
"La clasificación seleccionada no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> result = _repository.DeleteClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoCatalogBitacoraFactory.CreateClasificacion(
|
||||
previousResult.Data,
|
||||
null,
|
||||
cveClasificacion,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return FailFrom<long, bool>(
|
||||
auditResult,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<List<UnidadMedidaModel>> ListUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repository.ListUnidadesMedida(
|
||||
TrimOrNull(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<UnidadMedidaModel> GetUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cveUnidadMedida > 0
|
||||
? _repository.GetUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio)
|
||||
: Fail<UnidadMedidaModel>(
|
||||
"Seleccione una unidad de medida válida.");
|
||||
}
|
||||
|
||||
public DbResult<int> SaveUnidadMedida(
|
||||
UnidadMedidaModel unidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validation = Validate(unidadMedida);
|
||||
|
||||
if (!validation.Success)
|
||||
{
|
||||
return validation;
|
||||
}
|
||||
|
||||
unidadMedida.UnidadMedida = unidadMedida.UnidadMedida.Trim();
|
||||
unidadMedida.Abreviatura = unidadMedida.Abreviatura.Trim();
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
UnidadMedidaModel previous = null;
|
||||
|
||||
if (unidadMedida.CveUnidadMedida > 0)
|
||||
{
|
||||
DbResult<UnidadMedidaModel> previousResult =
|
||||
_repository.GetUnidadMedida(
|
||||
unidadMedida.CveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<UnidadMedidaModel, int>(
|
||||
previousResult,
|
||||
"La unidad de medida seleccionada no existe.");
|
||||
}
|
||||
|
||||
previous = previousResult.Data;
|
||||
}
|
||||
|
||||
DbResult<int> result = _repository.SaveUnidadMedida(
|
||||
unidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<UnidadMedidaModel> currentResult =
|
||||
_repository.GetUnidadMedida(
|
||||
result.Data,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!currentResult.Success || currentResult.Data == null)
|
||||
{
|
||||
return FailFrom<UnidadMedidaModel, int>(
|
||||
currentResult,
|
||||
"No fue posible recuperar la unidad de medida guardada.");
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoCatalogBitacoraFactory.CreateUnidadMedida(
|
||||
previous,
|
||||
currentResult.Data,
|
||||
result.Data,
|
||||
previous == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return FailFrom<long, int>(
|
||||
auditResult,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> DeleteUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cveUnidadMedida <= 0)
|
||||
{
|
||||
return Fail<bool>(
|
||||
"Seleccione una unidad de medida válida.");
|
||||
}
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
DbResult<UnidadMedidaModel> previousResult =
|
||||
_repository.GetUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<UnidadMedidaModel, bool>(
|
||||
previousResult,
|
||||
"La unidad de medida seleccionada no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> result = _repository.DeleteUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoCatalogBitacoraFactory.CreateUnidadMedida(
|
||||
previousResult.Data,
|
||||
null,
|
||||
cveUnidadMedida,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return FailFrom<long, bool>(
|
||||
auditResult,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static DbResult<int> Validate(
|
||||
ClasificacionModel clasificacion)
|
||||
{
|
||||
if (clasificacion == null ||
|
||||
string.IsNullOrWhiteSpace(clasificacion.Clasificacion))
|
||||
{
|
||||
return Fail<int>("Capture la clasificación.");
|
||||
}
|
||||
|
||||
if (clasificacion.Clasificacion.Trim().Length > 200)
|
||||
{
|
||||
return Fail<int>(
|
||||
"La clasificación no puede exceder 200 caracteres.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(clasificacion.Codigo) &&
|
||||
clasificacion.Codigo.Trim().Length > 20)
|
||||
{
|
||||
return Fail<int>(
|
||||
"El código no puede exceder 20 caracteres.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(clasificacion.CveClasificacion);
|
||||
}
|
||||
|
||||
private static DbResult<int> Validate(
|
||||
UnidadMedidaModel unidadMedida)
|
||||
{
|
||||
if (unidadMedida == null ||
|
||||
string.IsNullOrWhiteSpace(unidadMedida.UnidadMedida))
|
||||
{
|
||||
return Fail<int>("Capture la unidad de medida.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(unidadMedida.Abreviatura))
|
||||
{
|
||||
return Fail<int>("Capture la abreviatura.");
|
||||
}
|
||||
|
||||
if (unidadMedida.UnidadMedida.Trim().Length > 50)
|
||||
{
|
||||
return Fail<int>(
|
||||
"La unidad de medida no puede exceder 50 caracteres.");
|
||||
}
|
||||
|
||||
if (unidadMedida.Abreviatura.Trim().Length > 15)
|
||||
{
|
||||
return Fail<int>(
|
||||
"La abreviatura no puede exceder 15 caracteres.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(unidadMedida.CveUnidadMedida);
|
||||
}
|
||||
|
||||
private static string TrimOrNull(string value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value)
|
||||
? null
|
||||
: value.Trim();
|
||||
}
|
||||
|
||||
private static DbResult<T> Fail<T>(string message)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
message,
|
||||
message,
|
||||
new ArgumentException(message));
|
||||
}
|
||||
|
||||
private static DbResult<TResult> FailFrom<TSource, TResult>(
|
||||
DbResult<TSource> source,
|
||||
string fallbackMessage)
|
||||
{
|
||||
string message = source == null ||
|
||||
string.IsNullOrWhiteSpace(source.UserMessage)
|
||||
? fallbackMessage
|
||||
: source.UserMessage;
|
||||
|
||||
return DbResult<TResult>.Fail(
|
||||
message,
|
||||
source == null
|
||||
? fallbackMessage
|
||||
: source.TechnicalMessage,
|
||||
source == null ? null : source.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
internal static class ProductoServicioBitacoraFactory
|
||||
{
|
||||
public static BitacoraEventoModel Create(
|
||||
ProductoServicioModel previous,
|
||||
ProductoServicioModel current,
|
||||
int cvePS,
|
||||
BitacoraTipoMovimiento movement)
|
||||
{
|
||||
ProductoServicioModel value = current ?? previous;
|
||||
var auditEvent = new BitacoraEventoModel
|
||||
{
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
TipoMovimiento = movement,
|
||||
LlaveRegistro = cvePS.ToString(),
|
||||
DescripcionMovimiento = Description(movement, value.PS),
|
||||
DiscriminarCamposSinCambios = movement !=
|
||||
BitacoraTipoMovimiento.Agregado,
|
||||
Campos = movement == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: CreateFields(previous, current)
|
||||
};
|
||||
|
||||
auditEvent.Relaciones.Add(
|
||||
new BitacoraRelacionEventoModel
|
||||
{
|
||||
TipoRelacion = BitacoraTipoRelacion.Directa,
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
NombreCampoSQL = "CvePS",
|
||||
Valor = cvePS,
|
||||
VisibleDesarrollador = false,
|
||||
DescripcionRelacion =
|
||||
"Producto o servicio afectado."
|
||||
});
|
||||
|
||||
return auditEvent;
|
||||
}
|
||||
|
||||
private static string Description(
|
||||
BitacoraTipoMovimiento movement,
|
||||
string productName)
|
||||
{
|
||||
if (movement == BitacoraTipoMovimiento.Agregado)
|
||||
{
|
||||
return "Se agregó el producto o servicio " +
|
||||
productName + ".";
|
||||
}
|
||||
|
||||
if (movement == BitacoraTipoMovimiento.Editado)
|
||||
{
|
||||
return "Se modificó el producto o servicio " +
|
||||
productName + ".";
|
||||
}
|
||||
|
||||
return "Se eliminó el producto o servicio " +
|
||||
productName + ".";
|
||||
}
|
||||
|
||||
private static IList<BitacoraCampoEventoModel> CreateFields(
|
||||
ProductoServicioModel previous,
|
||||
ProductoServicioModel current)
|
||||
{
|
||||
return new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
Field(
|
||||
"Codigo",
|
||||
Value(previous, item => item.Codigo),
|
||||
current.Codigo),
|
||||
Field(
|
||||
"PS",
|
||||
Value(previous, item => item.PS),
|
||||
current.PS),
|
||||
Field(
|
||||
"CveTipoPS",
|
||||
Value(previous, item => item.CveTipoPS),
|
||||
current.CveTipoPS),
|
||||
Field(
|
||||
"CveClasificacion",
|
||||
Value(previous, item => item.CveClasificacion),
|
||||
current.CveClasificacion),
|
||||
Field(
|
||||
"CveUnidadMedida",
|
||||
Value(previous, item => item.CveUnidadMedida),
|
||||
current.CveUnidadMedida),
|
||||
Field(
|
||||
"Precio",
|
||||
Value(previous, item => item.Precio),
|
||||
current.Precio),
|
||||
Field(
|
||||
"Estado",
|
||||
Value(previous, item => item.EsActivo),
|
||||
current.EsActivo)
|
||||
};
|
||||
}
|
||||
|
||||
private static BitacoraCampoEventoModel Field(
|
||||
string name,
|
||||
object previous,
|
||||
object current)
|
||||
{
|
||||
return new BitacoraCampoEventoModel
|
||||
{
|
||||
NombreCampoSQL = name,
|
||||
ValorAnterior = previous,
|
||||
ValorNuevo = current
|
||||
};
|
||||
}
|
||||
|
||||
private static object Value<TValue>(
|
||||
ProductoServicioModel model,
|
||||
Func<ProductoServicioModel, TValue> selector)
|
||||
{
|
||||
return model == null
|
||||
? null
|
||||
: (object)selector(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
276
SIG.Web/App_Code/Services/General/ProductoServicioService.cs
Normal file
276
SIG.Web/App_Code/Services/General/ProductoServicioService.cs
Normal file
@@ -0,0 +1,276 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Contracts.Bitacora;
|
||||
using SIG.Web.AppCode.Contracts.General;
|
||||
using SIG.Web.AppCode.Infrastructure.Transactions;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
public sealed class ProductoServicioService : IProductoServicioService
|
||||
{
|
||||
private readonly IProductoServicioRepository _repository;
|
||||
private readonly IBitacoraService _bitacora;
|
||||
|
||||
public ProductoServicioService(
|
||||
IProductoServicioRepository repository,
|
||||
IBitacoraService bitacora)
|
||||
{
|
||||
_repository = repository ??
|
||||
throw new ArgumentNullException("repository");
|
||||
_bitacora = bitacora ??
|
||||
throw new ArgumentNullException("bitacora");
|
||||
}
|
||||
|
||||
public DbResult<List<ProductoServicioModel>> List(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repository.List(
|
||||
TrimOrNull(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioModel> Get(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cvePS > 0
|
||||
? _repository.Get(cvePS, usuario, dominio)
|
||||
: Fail<ProductoServicioModel>(
|
||||
"Seleccione un producto o servicio válido.");
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioOpcionesModel> ListOptions(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repository.ListOptions(
|
||||
cveClasificacionActual,
|
||||
cveUnidadMedidaActual,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<int> Save(
|
||||
ProductoServicioModel productoServicio,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validation = Validate(productoServicio);
|
||||
|
||||
if (!validation.Success)
|
||||
{
|
||||
return validation;
|
||||
}
|
||||
|
||||
productoServicio.Codigo = TrimOrNull(
|
||||
productoServicio.Codigo);
|
||||
productoServicio.PS = productoServicio.PS.Trim();
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
ProductoServicioModel previous = null;
|
||||
|
||||
if (productoServicio.CvePS > 0)
|
||||
{
|
||||
DbResult<ProductoServicioModel> previousResult =
|
||||
_repository.Get(
|
||||
productoServicio.CvePS,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success ||
|
||||
previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<ProductoServicioModel, int>(
|
||||
previousResult,
|
||||
"El producto o servicio seleccionado no existe.");
|
||||
}
|
||||
|
||||
previous = previousResult.Data;
|
||||
}
|
||||
|
||||
DbResult<int> result = _repository.Save(
|
||||
productoServicio,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<ProductoServicioModel> currentResult =
|
||||
_repository.Get(result.Data, usuario, dominio);
|
||||
|
||||
if (!currentResult.Success || currentResult.Data == null)
|
||||
{
|
||||
return FailFrom<ProductoServicioModel, int>(
|
||||
currentResult,
|
||||
"No fue posible recuperar el producto o servicio guardado.");
|
||||
}
|
||||
|
||||
BitacoraTipoMovimiento movement = previous == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado;
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoServicioBitacoraFactory.Create(
|
||||
previous,
|
||||
currentResult.Data,
|
||||
result.Data,
|
||||
movement));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return DbResult<int>.Fail(
|
||||
auditResult.UserMessage,
|
||||
auditResult.TechnicalMessage,
|
||||
auditResult.Exception);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> Delete(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cvePS <= 0)
|
||||
{
|
||||
return Fail<bool>(
|
||||
"Seleccione un producto o servicio válido.");
|
||||
}
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
DbResult<ProductoServicioModel> previousResult =
|
||||
_repository.Get(cvePS, usuario, dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<ProductoServicioModel, bool>(
|
||||
previousResult,
|
||||
"El producto o servicio seleccionado no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> result = _repository.Delete(
|
||||
cvePS,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoServicioBitacoraFactory.Create(
|
||||
previousResult.Data,
|
||||
null,
|
||||
cvePS,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return DbResult<bool>.Fail(
|
||||
auditResult.UserMessage,
|
||||
auditResult.TechnicalMessage,
|
||||
auditResult.Exception);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static DbResult<int> Validate(
|
||||
ProductoServicioModel productoServicio)
|
||||
{
|
||||
if (productoServicio == null ||
|
||||
string.IsNullOrWhiteSpace(productoServicio.PS))
|
||||
{
|
||||
return Fail<int>(
|
||||
"Capture la descripción del producto o servicio.");
|
||||
}
|
||||
|
||||
if (productoServicio.PS.Trim().Length > 846)
|
||||
{
|
||||
return Fail<int>(
|
||||
"La descripción no puede exceder 846 caracteres.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(productoServicio.Codigo) &&
|
||||
productoServicio.Codigo.Trim().Length > 50)
|
||||
{
|
||||
return Fail<int>(
|
||||
"El código no puede exceder 50 caracteres.");
|
||||
}
|
||||
|
||||
if (productoServicio.CveTipoPS != 1 &&
|
||||
productoServicio.CveTipoPS != 2)
|
||||
{
|
||||
return Fail<int>(
|
||||
"Seleccione si el registro es producto o servicio.");
|
||||
}
|
||||
|
||||
if (productoServicio.CveClasificacion <= 0 ||
|
||||
productoServicio.CveUnidadMedida <= 0)
|
||||
{
|
||||
return Fail<int>(
|
||||
"Seleccione la clasificación y la unidad de medida.");
|
||||
}
|
||||
|
||||
if (productoServicio.Precio < 0)
|
||||
{
|
||||
return Fail<int>("El precio no puede ser negativo.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(productoServicio.CvePS);
|
||||
}
|
||||
|
||||
private static string TrimOrNull(string value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value)
|
||||
? null
|
||||
: value.Trim();
|
||||
}
|
||||
|
||||
private static DbResult<T> Fail<T>(string message)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
message,
|
||||
message,
|
||||
new ArgumentException(message));
|
||||
}
|
||||
|
||||
private static DbResult<TResult> FailFrom<TSource, TResult>(
|
||||
DbResult<TSource> source,
|
||||
string fallbackMessage)
|
||||
{
|
||||
string message = source == null ||
|
||||
string.IsNullOrWhiteSpace(source.UserMessage)
|
||||
? fallbackMessage
|
||||
: source.UserMessage;
|
||||
|
||||
return DbResult<TResult>.Fail(
|
||||
message,
|
||||
source == null
|
||||
? fallbackMessage
|
||||
: source.TechnicalMessage,
|
||||
source == null ? null : source.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace SIG.Web.AppCode.Services.Logging
|
||||
content.AppendLine("Date: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
content.AppendLine("Source: " + Compact(source));
|
||||
content.AppendLine("Procedure: " + Compact(StoredProcedureDiagnostics.CurrentProcedureName));
|
||||
content.AppendLine("UserMessage: " + Compact(
|
||||
content.AppendLine("UserMessage: " + (
|
||||
string.IsNullOrWhiteSpace(userMessage)
|
||||
? ControlledExceptionClassifier.GetUserMessage(exception)
|
||||
: userMessage));
|
||||
@@ -142,7 +142,7 @@ namespace SIG.Web.AppCode.Services.Logging
|
||||
}
|
||||
|
||||
content.AppendLine("ExceptionType: " + exception.GetType().FullName);
|
||||
content.AppendLine("Message: " + Compact(exception.Message));
|
||||
content.AppendLine("Message: " + (exception.Message));
|
||||
content.AppendLine();
|
||||
|
||||
return content.ToString();
|
||||
|
||||
@@ -16,16 +16,21 @@ namespace SIG.Web.AppCode.Services.Login
|
||||
return LoginResult.Ok(new UserSessionModel
|
||||
{
|
||||
CveUsuario = 15,
|
||||
CveUsuarioOriginal = 15,
|
||||
CveRol = 1,
|
||||
CveRolOriginal = 1,
|
||||
CveEmpresa = 1,
|
||||
CveCliente = 0,
|
||||
NombreUsuario = nombreUsuario.Trim(),
|
||||
Nombre = "Usuario Demo",
|
||||
CorreoElectronico = "usuario.demo@example.invalid",
|
||||
NombreRol = "Administrador",
|
||||
NombreDominio = nombreDominio,
|
||||
TokenSesion = Guid.NewGuid().ToString("N"),
|
||||
DebeCambiarContrasena = false
|
||||
DebeCambiarContrasena = false,
|
||||
EsAdmin = true,
|
||||
PuedeCambiarUsuario = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,14 +158,20 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
var sessionUser = new UserSessionModel
|
||||
{
|
||||
CveUsuario = user.CveUsuario,
|
||||
CveUsuarioOriginal = user.CveUsuario,
|
||||
CveRol = user.CveRol,
|
||||
CveRolOriginal = user.CveRol,
|
||||
CveCliente = user.CveCliente,
|
||||
NombreUsuario = user.NombreUsuario,
|
||||
Nombre = user.NombreUsuario,
|
||||
CorreoElectronico = user.CorreoElectronico,
|
||||
NombreRol = user.NombreRol,
|
||||
NombreDominio = request.NombreDominio,
|
||||
TokenSesion = sessionToken,
|
||||
DebeCambiarContrasena = user.DebeCambiarContrasena
|
||||
DebeCambiarContrasena = user.DebeCambiarContrasena,
|
||||
EsAdmin = user.CveRol == 1,
|
||||
PuedeCambiarUsuario =
|
||||
user.CveRol == 1 || user.CveRol == 2
|
||||
};
|
||||
|
||||
return LoginResult.Ok(sessionUser);
|
||||
|
||||
233
SIG.Web/App_Code/Services/Security/PerfilUsuarioService.cs
Normal file
233
SIG.Web/App_Code/Services/Security/PerfilUsuarioService.cs
Normal file
@@ -0,0 +1,233 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Contracts.Security;
|
||||
using SIG.Web.AppCode.Infrastructure.Transactions;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Security;
|
||||
using SIG.Web.AppCode.Session;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.Security
|
||||
{
|
||||
public sealed class PerfilUsuarioService : IPerfilUsuarioService
|
||||
{
|
||||
private readonly IPerfilUsuarioRepository _repositorio;
|
||||
private readonly IPasswordHasher _generadorHashContrasena;
|
||||
|
||||
public PerfilUsuarioService(
|
||||
IPerfilUsuarioRepository repositorio,
|
||||
IPasswordHasher generadorHashContrasena)
|
||||
{
|
||||
_repositorio = repositorio ??
|
||||
throw new ArgumentNullException("repositorio");
|
||||
_generadorHashContrasena = generadorHashContrasena ??
|
||||
throw new ArgumentNullException(
|
||||
"generadorHashContrasena");
|
||||
}
|
||||
|
||||
public DbResult<PerfilUsuarioConsultaModel> ObtenerPerfil(
|
||||
UserSessionModel usuarioSesion)
|
||||
{
|
||||
if (usuarioSesion == null || usuarioSesion.CveUsuario <= 0)
|
||||
{
|
||||
return Error<PerfilUsuarioConsultaModel>(
|
||||
"No se encontró la sesión del usuario.");
|
||||
}
|
||||
|
||||
return _repositorio.ObtenerPerfil(
|
||||
usuarioSesion.CveUsuario,
|
||||
usuarioSesion.CveUsuario,
|
||||
usuarioSesion.NombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<PerfilSesionModel> ActualizarSesion(
|
||||
UserSessionModel usuarioSesion,
|
||||
string nombreUsuario,
|
||||
string contrasena)
|
||||
{
|
||||
if (usuarioSesion == null || usuarioSesion.CveUsuario <= 0)
|
||||
{
|
||||
return Error<PerfilSesionModel>(
|
||||
"No se encontró la sesión del usuario.");
|
||||
}
|
||||
|
||||
nombreUsuario = string.IsNullOrWhiteSpace(nombreUsuario)
|
||||
? string.Empty
|
||||
: nombreUsuario.Trim();
|
||||
|
||||
if (nombreUsuario.Length < 3)
|
||||
{
|
||||
return Error<PerfilSesionModel>(
|
||||
"El nombre de usuario debe contener al menos tres caracteres.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(contrasena) &&
|
||||
contrasena.Length < 8)
|
||||
{
|
||||
return Error<PerfilSesionModel>(
|
||||
"La contraseña debe contener al menos ocho caracteres.");
|
||||
}
|
||||
|
||||
string hashContrasena = string.IsNullOrEmpty(contrasena)
|
||||
? null
|
||||
: _generadorHashContrasena.HashPassword(contrasena);
|
||||
DbResult<PerfilSesionModel> resultado;
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
resultado = _repositorio.ActualizarSesion(
|
||||
usuarioSesion.CveUsuario,
|
||||
nombreUsuario,
|
||||
hashContrasena,
|
||||
usuarioSesion.CveUsuario,
|
||||
usuarioSesion.NombreDominio);
|
||||
|
||||
if (resultado.Success)
|
||||
{
|
||||
transaccion.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public DbResult<bool> ActualizarCliente(
|
||||
UserSessionModel usuarioSesion,
|
||||
PerfilClienteModel cliente)
|
||||
{
|
||||
if (usuarioSesion == null ||
|
||||
!usuarioSesion.EsDesarrollador ||
|
||||
usuarioSesion.CveCliente <= 0)
|
||||
{
|
||||
return Error<bool>(
|
||||
"La sesión no tiene un cliente desarrollador asignado.");
|
||||
}
|
||||
|
||||
if (cliente == null ||
|
||||
cliente.CveCliente != usuarioSesion.CveCliente)
|
||||
{
|
||||
return Error<bool>(
|
||||
"Los datos del cliente no corresponden a la sesión.");
|
||||
}
|
||||
|
||||
DbResult<bool> resultado;
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
resultado = _repositorio.ActualizarCliente(
|
||||
cliente,
|
||||
usuarioSesion.CveUsuario,
|
||||
usuarioSesion.NombreDominio);
|
||||
|
||||
if (resultado.Success)
|
||||
{
|
||||
transaccion.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public DbResult<List<UsuarioCambioContextoModel>>
|
||||
ListarUsuariosCambio(
|
||||
UserSessionModel usuarioSesion,
|
||||
string texto)
|
||||
{
|
||||
if (!PuedeCambiarUsuario(usuarioSesion))
|
||||
{
|
||||
return Error<List<UsuarioCambioContextoModel>>(
|
||||
"La sesión no permite cambiar de usuario.");
|
||||
}
|
||||
|
||||
return _repositorio.ListarUsuariosCambio(
|
||||
texto,
|
||||
UsuarioAdministrador(usuarioSesion),
|
||||
usuarioSesion.NombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<UserSessionModel> CambiarUsuario(
|
||||
UserSessionModel usuarioSesion,
|
||||
int cveUsuarioSeleccionado)
|
||||
{
|
||||
if (!PuedeCambiarUsuario(usuarioSesion))
|
||||
{
|
||||
return Error<UserSessionModel>(
|
||||
"La sesión no permite cambiar de usuario.");
|
||||
}
|
||||
|
||||
if (cveUsuarioSeleccionado <= 0)
|
||||
{
|
||||
return Error<UserSessionModel>(
|
||||
"Seleccione un usuario válido.");
|
||||
}
|
||||
|
||||
DbResult<UsuarioCambioContextoModel> resultadoUsuario =
|
||||
_repositorio.ObtenerUsuarioContexto(
|
||||
cveUsuarioSeleccionado,
|
||||
UsuarioAdministrador(usuarioSesion),
|
||||
usuarioSesion.NombreDominio);
|
||||
|
||||
if (!resultadoUsuario.Success ||
|
||||
resultadoUsuario.Data == null)
|
||||
{
|
||||
return resultadoUsuario.Success
|
||||
? Error<UserSessionModel>(
|
||||
"El usuario seleccionado ya no está disponible.")
|
||||
: DbResult<UserSessionModel>.Fail(
|
||||
resultadoUsuario.UserMessage,
|
||||
resultadoUsuario.TechnicalMessage,
|
||||
resultadoUsuario.Exception);
|
||||
}
|
||||
|
||||
UsuarioCambioContextoModel usuario = resultadoUsuario.Data;
|
||||
|
||||
return DbResult<UserSessionModel>.Ok(
|
||||
new UserSessionModel
|
||||
{
|
||||
CveUsuario = usuario.CveUsuario,
|
||||
CveUsuarioOriginal =
|
||||
UsuarioAdministrador(usuarioSesion),
|
||||
CveRol = usuario.CveRol,
|
||||
CveRolOriginal = usuarioSesion.CveRolOriginal > 0
|
||||
? usuarioSesion.CveRolOriginal
|
||||
: usuarioSesion.CveRol,
|
||||
CveEmpresa = usuarioSesion.CveEmpresa,
|
||||
CveCliente = usuario.CveCliente,
|
||||
NombreUsuario = usuario.NombreUsuario,
|
||||
Nombre = usuario.NombreUsuario,
|
||||
CorreoElectronico = usuario.CorreoElectronico,
|
||||
NombreRol = usuario.NombreRol,
|
||||
NombreDominio = usuarioSesion.NombreDominio,
|
||||
TokenSesion = usuarioSesion.TokenSesion,
|
||||
DebeCambiarContrasena =
|
||||
usuario.DebeCambiarContrasena,
|
||||
EsAdmin = usuarioSesion.EsAdmin,
|
||||
PuedeCambiarUsuario =
|
||||
usuarioSesion.PuedeCambiarUsuario
|
||||
});
|
||||
}
|
||||
|
||||
private static bool PuedeCambiarUsuario(
|
||||
UserSessionModel usuarioSesion)
|
||||
{
|
||||
return usuarioSesion != null &&
|
||||
usuarioSesion.PuedeCambiarUsuario &&
|
||||
UsuarioAdministrador(usuarioSesion) > 0;
|
||||
}
|
||||
|
||||
private static int UsuarioAdministrador(
|
||||
UserSessionModel usuarioSesion)
|
||||
{
|
||||
return usuarioSesion.CveUsuarioOriginal > 0
|
||||
? usuarioSesion.CveUsuarioOriginal
|
||||
: usuarioSesion.CveUsuario;
|
||||
}
|
||||
|
||||
private static DbResult<T> Error<T>(string mensaje)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
mensaje,
|
||||
mensaje,
|
||||
null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using SIG.Web.AppCode.Contracts.Security;
|
||||
using SIG.Web.AppCode.Session;
|
||||
namespace SIG.Web.AppCode.Services.Security
|
||||
{
|
||||
public sealed class WebFormsUserContextProvider : Contracts.Security.IUserContextProvider
|
||||
public sealed class WebFormsUserContextProvider : IUserContextProvider
|
||||
{
|
||||
public bool IsAuthenticated()
|
||||
{
|
||||
@@ -20,16 +20,29 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
return HttpContext.Current.Session[SessionKeys.CurrentUser]
|
||||
as UserSessionModel;
|
||||
}
|
||||
|
||||
public void SetCurrentUser(UserSessionModel user)
|
||||
{
|
||||
if (HttpContext.Current == null || HttpContext.Current.Session == null)
|
||||
return; HttpContext.Current.Session[SessionKeys.CurrentUser] = user;
|
||||
HttpContext.Current.Session[SessionKeys.TokenSesion] = user != null ? user.TokenSesion : null;
|
||||
if (HttpContext.Current == null ||
|
||||
HttpContext.Current.Session == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HttpContext.Current.Session[SessionKeys.CurrentUser] = user;
|
||||
HttpContext.Current.Session[SessionKeys.TokenSesion] =
|
||||
user != null ? user.TokenSesion : null;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
if (HttpContext.Current == null || HttpContext.Current.Session == null)
|
||||
return; HttpContext.Current.Session.Remove(SessionKeys.CurrentUser);
|
||||
if (HttpContext.Current == null ||
|
||||
HttpContext.Current.Session == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HttpContext.Current.Session.Remove(SessionKeys.CurrentUser);
|
||||
HttpContext.Current.Session.Remove(SessionKeys.TokenSesion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,6 +182,7 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
: Fields(
|
||||
Field("CveTramitePago", Value(anterior, item => item.CveTramitePago), actual.CveTramitePago),
|
||||
Field("CvePS", Value(anterior, item => item.CvePS), actual.CvePS),
|
||||
Field("CveUM", Value(anterior, item => item.CveUM), actual.CveUM),
|
||||
Field("Cantidad", Value(anterior, item => item.Cantidad), actual.Cantidad)));
|
||||
|
||||
evento.Relaciones.Add(Relation(
|
||||
@@ -192,6 +193,10 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
"ProductosServicios",
|
||||
"CvePS",
|
||||
valor.CvePS));
|
||||
evento.Relaciones.Add(Relation(
|
||||
"UnidadesMedida",
|
||||
"CveUnidadMedida",
|
||||
valor.CveUM));
|
||||
return evento;
|
||||
}
|
||||
|
||||
|
||||
@@ -328,9 +328,11 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
if (model == null ||
|
||||
model.CveTramitePago <= 0 ||
|
||||
model.CvePS <= 0 ||
|
||||
model.CveUM <= 0 ||
|
||||
model.Cantidad <= 0)
|
||||
{
|
||||
return Fail<int>("Seleccione el producto o servicio y capture una cantidad mayor que cero.");
|
||||
return Fail<int>(
|
||||
"Seleccione el producto o servicio, la unidad de medida y capture una cantidad mayor que cero.");
|
||||
}
|
||||
|
||||
return Save(
|
||||
|
||||
@@ -7,6 +7,67 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
{
|
||||
internal static class TramiteSolicitudBitacoraFactory
|
||||
{
|
||||
public static BitacoraEventoModel Create(
|
||||
TramiteSolicitudCreateResultModel request)
|
||||
{
|
||||
var auditEvent = new BitacoraEventoModel
|
||||
{
|
||||
NombreTablaSQL = "Tra_Solicitudes",
|
||||
TipoMovimiento = BitacoraTipoMovimiento.Agregado,
|
||||
LlaveRegistro = Convert.ToString(request.CveSolicitud),
|
||||
DescripcionMovimiento =
|
||||
"Se agregó el trámite " + request.TipoTramite +
|
||||
" a la etapa " + request.Etapa +
|
||||
" con folio " + request.Folio + ".",
|
||||
DiscriminarCamposSinCambios = false,
|
||||
Campos = new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
Field("CveCliente", null, request.CveCliente),
|
||||
Field("CveFraccionamiento", null, request.CveFraccionamiento),
|
||||
Field("CveFraccionamientoEtapa", null, request.CveFraccionamientoEtapa),
|
||||
Field("CveTipoTramite", null, request.CveTipoTramite),
|
||||
Field("CveEstatusSolicitud", null, request.CveEstatusSolicitud),
|
||||
Field("CveUsuarioSolicita", null, request.CveUsuarioSolicita),
|
||||
Field("FechaInicio", null, request.FechaInicio)
|
||||
}
|
||||
};
|
||||
|
||||
auditEvent.Relaciones.Add(
|
||||
Relation(
|
||||
BitacoraTipoRelacion.Directa,
|
||||
"Tra_Solicitudes",
|
||||
"CveSolicitud",
|
||||
request.CveSolicitud,
|
||||
true,
|
||||
"Solicitud creada."));
|
||||
auditEvent.Relaciones.Add(
|
||||
Relation(
|
||||
BitacoraTipoRelacion.Relacionada,
|
||||
"Clientes",
|
||||
"CveCliente",
|
||||
request.CveCliente,
|
||||
true,
|
||||
"Cliente propietario de la solicitud."));
|
||||
auditEvent.Relaciones.Add(
|
||||
Relation(
|
||||
BitacoraTipoRelacion.Relacionada,
|
||||
"Fraccionamientos",
|
||||
"CveFraccionamiento",
|
||||
request.CveFraccionamiento,
|
||||
true,
|
||||
"Fraccionamiento de la solicitud."));
|
||||
auditEvent.Relaciones.Add(
|
||||
Relation(
|
||||
BitacoraTipoRelacion.Relacionada,
|
||||
"FraccionamientosEtapas",
|
||||
"CveFraccionamientoEtapa",
|
||||
request.CveFraccionamientoEtapa,
|
||||
true,
|
||||
"Etapa de la solicitud."));
|
||||
|
||||
return auditEvent;
|
||||
}
|
||||
|
||||
public static BitacoraEventoModel StatusChange(
|
||||
TramiteSolicitudStatusChangeModel change)
|
||||
{
|
||||
@@ -75,6 +136,19 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
return auditEvent;
|
||||
}
|
||||
|
||||
private static BitacoraCampoEventoModel Field(
|
||||
string name,
|
||||
object previous,
|
||||
object current)
|
||||
{
|
||||
return new BitacoraCampoEventoModel
|
||||
{
|
||||
NombreCampoSQL = name,
|
||||
ValorAnterior = previous,
|
||||
ValorNuevo = current
|
||||
};
|
||||
}
|
||||
|
||||
private static BitacoraRelacionEventoModel Relation(
|
||||
BitacoraTipoRelacion relationType,
|
||||
string tableName,
|
||||
|
||||
@@ -22,6 +22,98 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
_bitacoraService = bitacoraService;
|
||||
}
|
||||
|
||||
public DbResult<List<TramiteSolicitudTipoOptionModel>> ListAvailableTypesForStage(
|
||||
int developmentId,
|
||||
int stageId,
|
||||
int executingUser,
|
||||
string domainName)
|
||||
{
|
||||
if (developmentId <= 0)
|
||||
{
|
||||
return Fail<List<TramiteSolicitudTipoOptionModel>>(
|
||||
"Seleccione un fraccionamiento válido.");
|
||||
}
|
||||
|
||||
if (stageId <= 0)
|
||||
{
|
||||
return Fail<List<TramiteSolicitudTipoOptionModel>>(
|
||||
"Seleccione una etapa válida.");
|
||||
}
|
||||
|
||||
return _repository.ListAvailableTypesForStage(
|
||||
developmentId,
|
||||
stageId,
|
||||
executingUser,
|
||||
domainName);
|
||||
}
|
||||
|
||||
public DbResult<TramiteSolicitudCreateResultModel> AddStageRequest(
|
||||
int developmentId,
|
||||
int stageId,
|
||||
int procedureTypeId,
|
||||
int executingUser,
|
||||
string domainName)
|
||||
{
|
||||
if (developmentId <= 0)
|
||||
{
|
||||
return Fail<TramiteSolicitudCreateResultModel>(
|
||||
"Seleccione un fraccionamiento válido.");
|
||||
}
|
||||
|
||||
if (stageId <= 0)
|
||||
{
|
||||
return Fail<TramiteSolicitudCreateResultModel>(
|
||||
"Seleccione una etapa válida.");
|
||||
}
|
||||
|
||||
if (procedureTypeId <= 0)
|
||||
{
|
||||
return Fail<TramiteSolicitudCreateResultModel>(
|
||||
"Seleccione un tipo de trámite válido.");
|
||||
}
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
DbResult<TramiteSolicitudCreateResultModel> result =
|
||||
_repository.AddStageRequest(
|
||||
developmentId,
|
||||
stageId,
|
||||
procedureTypeId,
|
||||
executingUser,
|
||||
domainName);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
if (result.Data.EsNuevo)
|
||||
{
|
||||
if (_bitacoraService == null)
|
||||
{
|
||||
return Fail<TramiteSolicitudCreateResultModel>(
|
||||
"El servicio de bitácora no está configurado.");
|
||||
}
|
||||
|
||||
DbResult<long> auditResult =
|
||||
_bitacoraService.Registrar(
|
||||
TramiteSolicitudBitacoraFactory.Create(
|
||||
result.Data));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return DbResult<TramiteSolicitudCreateResultModel>.Fail(
|
||||
auditResult.UserMessage,
|
||||
auditResult.TechnicalMessage,
|
||||
auditResult.Exception);
|
||||
}
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<List<TramiteSolicitudModel>> ListForDevelopment(
|
||||
int developmentId,
|
||||
int? stageId,
|
||||
|
||||
621
SIG.Web/App_Code/Services/Ventas/VentaTramiteService.cs
Normal file
621
SIG.Web/App_Code/Services/Ventas/VentaTramiteService.cs
Normal file
@@ -0,0 +1,621 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Contracts.Ventas;
|
||||
using SIG.Web.AppCode.Contracts.Facturacion;
|
||||
using SIG.Web.AppCode.Infrastructure.Transactions;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Ventas;
|
||||
using SIG.Web.AppCode.Models.Facturacion;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.Ventas
|
||||
{
|
||||
public sealed class ServicioVentaTramite : IServicioVentaTramite
|
||||
{
|
||||
private readonly IRepositorioVentaTramite _repositorio;
|
||||
private readonly ICfdiTimbradoService _servicioTimbrado;
|
||||
|
||||
public ServicioVentaTramite(
|
||||
IRepositorioVentaTramite repositorio,
|
||||
ICfdiTimbradoService servicioTimbrado)
|
||||
{
|
||||
if (repositorio == null)
|
||||
{
|
||||
throw new ArgumentNullException("repositorio");
|
||||
}
|
||||
|
||||
_repositorio = repositorio;
|
||||
_servicioTimbrado = servicioTimbrado ??
|
||||
throw new ArgumentNullException("servicioTimbrado");
|
||||
}
|
||||
|
||||
public DbResult<List<ModeloPagoPendienteFraccionamiento>> ListarPagosPendientes(
|
||||
int cveFraccionamiento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (cveFraccionamiento <= 0)
|
||||
{
|
||||
return Fallar<List<ModeloPagoPendienteFraccionamiento>>(
|
||||
"Seleccione un fraccionamiento válido.");
|
||||
}
|
||||
|
||||
return _repositorio.ListarPagosPendientes(
|
||||
cveFraccionamiento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<List<ModeloPagoRealizadoFraccionamiento>> ListarPagosRealizados(
|
||||
int cveFraccionamiento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (cveFraccionamiento <= 0)
|
||||
{
|
||||
return Fallar<List<ModeloPagoRealizadoFraccionamiento>>(
|
||||
"Seleccione un fraccionamiento válido.");
|
||||
}
|
||||
|
||||
return _repositorio.ListarPagosRealizados(
|
||||
cveFraccionamiento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<ModeloContextoVentaTramite> ObtenerVenta(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (cveSolicitud <= 0 || cveTramitePago <= 0)
|
||||
{
|
||||
return Fallar<ModeloContextoVentaTramite>(
|
||||
"Seleccione un pago pendiente válido.");
|
||||
}
|
||||
|
||||
DbResult<ModeloContextoVentaTramite> contextoResultado =
|
||||
_repositorio.ObtenerContexto(
|
||||
cveSolicitud,
|
||||
cveTramitePago,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!contextoResultado.Success || contextoResultado.Data == null)
|
||||
{
|
||||
return contextoResultado.Success
|
||||
? Fallar<ModeloContextoVentaTramite>(
|
||||
"No fue posible obtener los datos del pago pendiente.")
|
||||
: contextoResultado;
|
||||
}
|
||||
|
||||
DbResult<List<ModeloConceptoVentaTramite>> conceptosResultado =
|
||||
_repositorio.ListarConceptos(
|
||||
cveSolicitud,
|
||||
cveTramitePago,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!conceptosResultado.Success)
|
||||
{
|
||||
return DbResult<ModeloContextoVentaTramite>.Fail(
|
||||
conceptosResultado.UserMessage,
|
||||
conceptosResultado.TechnicalMessage,
|
||||
conceptosResultado.Exception);
|
||||
}
|
||||
|
||||
List<ModeloConceptoVentaTramite> conceptos =
|
||||
conceptosResultado.Data ??
|
||||
new List<ModeloConceptoVentaTramite>();
|
||||
|
||||
if (conceptos.Count == 0)
|
||||
{
|
||||
return Fallar<ModeloContextoVentaTramite>(
|
||||
"El pago pendiente no tiene conceptos configurados.");
|
||||
}
|
||||
|
||||
contextoResultado.Data.Conceptos = conceptos;
|
||||
return contextoResultado;
|
||||
}
|
||||
|
||||
public DbResult<int> GenerarVenta(
|
||||
ModeloCapturaVentaTramite venta,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (venta == null ||
|
||||
venta.CveSolicitud <= 0 ||
|
||||
venta.CveTramitePago <= 0)
|
||||
{
|
||||
return Fallar<int>("Seleccione un pago pendiente válido.");
|
||||
}
|
||||
|
||||
venta.Observaciones = NormalizarObservaciones(
|
||||
venta.Observaciones);
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<int> resultado = _repositorio.Generar(
|
||||
venta,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<ModeloPagoRegistradoVentaTramite> PagarVenta(
|
||||
ModeloPagoVentaTramite pago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (pago == null ||
|
||||
pago.CveSolicitud <= 0 ||
|
||||
pago.CveTramitePago <= 0 ||
|
||||
pago.Importe <= 0m ||
|
||||
pago.FechaPago == DateTime.MinValue ||
|
||||
pago.CveFormaPago <= 0)
|
||||
{
|
||||
return Fallar<ModeloPagoRegistradoVentaTramite>(
|
||||
"Capture el monto, la fecha y la forma de pago.");
|
||||
}
|
||||
|
||||
pago.Observaciones = NormalizarTexto(
|
||||
pago.Observaciones,
|
||||
300);
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<ModeloPagoRegistradoVentaTramite> resultado =
|
||||
_repositorio.Pagar(
|
||||
pago,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<ModeloOpcionesPagoVentaTramite> ObtenerOpcionesPago(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (cveSolicitud <= 0 || cveTramitePago <= 0)
|
||||
{
|
||||
return Fallar<ModeloOpcionesPagoVentaTramite>(
|
||||
"Seleccione una venta generada válida.");
|
||||
}
|
||||
|
||||
return _repositorio.ObtenerOpcionesPago(
|
||||
cveSolicitud,
|
||||
cveTramitePago,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<ModeloOpcionesCondicionesPagoVentaTramite>
|
||||
ObtenerOpcionesCondicionesPago(
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return _repositorio.ObtenerOpcionesCondicionesPago(
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<bool> GuardarCondicionesPago(
|
||||
ModeloCondicionesPagoVentaTramite condiciones,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (condiciones == null ||
|
||||
condiciones.CveSolicitud <= 0 ||
|
||||
condiciones.CveTramitePago <= 0 ||
|
||||
condiciones.CveMetodoPago <= 0 ||
|
||||
condiciones.CveFormaPago <= 0 ||
|
||||
condiciones.FechaVencimiento == DateTime.MinValue)
|
||||
{
|
||||
return Fallar<bool>(
|
||||
"Capture condiciones de pago válidas.");
|
||||
}
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<bool> resultado =
|
||||
_repositorio.GuardarCondicionesPago(
|
||||
condiciones,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (resultado.Success)
|
||||
{
|
||||
transaccion.Commit();
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<int> GuardarConcepto(
|
||||
ModeloCapturaConceptoVentaTramite concepto,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (concepto == null ||
|
||||
concepto.CveSolicitud <= 0 ||
|
||||
concepto.CveTramitePago <= 0 ||
|
||||
concepto.CvePS <= 0 ||
|
||||
concepto.Cantidad <= 0m ||
|
||||
concepto.PrecioUnitario < 0m)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"Capture un producto, cantidad y precio unitario válidos.");
|
||||
}
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<int> resultado = _repositorio.GuardarConcepto(
|
||||
concepto,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> EliminarConcepto(
|
||||
int cveSolicitud,
|
||||
int cveTramitePago,
|
||||
int cveVentaDetalle,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (cveSolicitud <= 0 ||
|
||||
cveTramitePago <= 0 ||
|
||||
cveVentaDetalle <= 0)
|
||||
{
|
||||
return Fallar<bool>(
|
||||
"Seleccione un concepto válido para eliminar.");
|
||||
}
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<bool> resultado = _repositorio.EliminarConcepto(
|
||||
cveSolicitud,
|
||||
cveTramitePago,
|
||||
cveVentaDetalle,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<string> TimbrarVenta(
|
||||
ModeloTimbradoVentaTramite timbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (timbrado == null ||
|
||||
timbrado.CveSolicitud <= 0 ||
|
||||
timbrado.CveTramitePago <= 0 ||
|
||||
timbrado.CveEmpresa <= 0)
|
||||
{
|
||||
return Fallar<string>(
|
||||
"Seleccione una venta generada válida para timbrar.");
|
||||
}
|
||||
|
||||
DbResult<ModeloDatosCfdiVentaTramite> datosResultado =
|
||||
_repositorio.ObtenerDatosCfdi(
|
||||
timbrado.CveSolicitud,
|
||||
timbrado.CveTramitePago,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!datosResultado.Success || datosResultado.Data == null)
|
||||
{
|
||||
return datosResultado.Success
|
||||
? Fallar<string>(
|
||||
"No fue posible preparar los datos fiscales de la venta.")
|
||||
: CopiarFallo<ModeloDatosCfdiVentaTramite, string>(
|
||||
datosResultado);
|
||||
}
|
||||
|
||||
ModeloDatosCfdiVentaTramite datos = datosResultado.Data;
|
||||
CfdiSolicitudModel solicitud = CrearSolicitudCfdi(
|
||||
datos,
|
||||
timbrado.CveEmpresa);
|
||||
DbResult<long> borradorResultado =
|
||||
_servicioTimbrado.GuardarBorrador(
|
||||
solicitud,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!borradorResultado.Success)
|
||||
{
|
||||
return CopiarFallo<long, string>(borradorResultado);
|
||||
}
|
||||
|
||||
DbResult<CfdiTimbradoResultadoModel> timbradoResultado =
|
||||
_servicioTimbrado.Timbrar(
|
||||
borradorResultado.Data,
|
||||
null,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!timbradoResultado.Success ||
|
||||
timbradoResultado.Data == null ||
|
||||
!timbradoResultado.Data.TimbradoExitoso)
|
||||
{
|
||||
return timbradoResultado.Success
|
||||
? Fallar<string>(
|
||||
timbradoResultado.Data == null ||
|
||||
string.IsNullOrWhiteSpace(timbradoResultado.Data.Mensaje)
|
||||
? "El PAC no confirmó el timbrado."
|
||||
: timbradoResultado.Data.Mensaje)
|
||||
: CopiarFallo<CfdiTimbradoResultadoModel, string>(
|
||||
timbradoResultado);
|
||||
}
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<bool> actualizarResultado =
|
||||
_repositorio.MarcarTimbrada(
|
||||
datos.CveVenta,
|
||||
borradorResultado.Data,
|
||||
timbradoResultado.Data.Uuid,
|
||||
DateTime.Now,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!actualizarResultado.Success)
|
||||
{
|
||||
return CopiarFallo<bool, string>(actualizarResultado);
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
}
|
||||
|
||||
return DbResult<string>.Ok(
|
||||
timbradoResultado.Data.Uuid);
|
||||
}
|
||||
|
||||
public DbResult<string> CancelarTimbre(
|
||||
ModeloCancelacionTimbreVentaTramite cancelacion,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (cancelacion == null ||
|
||||
cancelacion.CveSolicitud <= 0 ||
|
||||
cancelacion.CveTramitePago <= 0 ||
|
||||
!MotivoCancelacionValido(cancelacion.Motivo))
|
||||
{
|
||||
return Fallar<string>(
|
||||
"Seleccione un motivo de cancelación válido.");
|
||||
}
|
||||
|
||||
cancelacion.UuidSustitucion = NormalizarUuid(
|
||||
cancelacion.UuidSustitucion);
|
||||
|
||||
if (cancelacion.Motivo == "01" &&
|
||||
string.IsNullOrWhiteSpace(cancelacion.UuidSustitucion))
|
||||
{
|
||||
return Fallar<string>(
|
||||
"Capture el UUID que sustituirá al timbre cancelado.");
|
||||
}
|
||||
|
||||
DbResult<ModeloContextoVentaTramite> contextoResultado =
|
||||
ObtenerVenta(
|
||||
cancelacion.CveSolicitud,
|
||||
cancelacion.CveTramitePago,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!contextoResultado.Success ||
|
||||
contextoResultado.Data == null ||
|
||||
!contextoResultado.Data.CveVenta.HasValue ||
|
||||
!contextoResultado.Data.CveCfdiDocumento.HasValue)
|
||||
{
|
||||
return contextoResultado.Success
|
||||
? Fallar<string>(
|
||||
"La venta no tiene un timbre vigente para cancelar.")
|
||||
: CopiarFallo<ModeloContextoVentaTramite, string>(
|
||||
contextoResultado);
|
||||
}
|
||||
|
||||
ModeloContextoVentaTramite contexto = contextoResultado.Data;
|
||||
DbResult<CfdiCancelacionResultadoModel> resultado =
|
||||
_servicioTimbrado.Cancelar(
|
||||
new CfdiCancelacionSolicitudModel
|
||||
{
|
||||
CveCfdiDocumento =
|
||||
contexto.CveCfdiDocumento.Value,
|
||||
Motivo = cancelacion.Motivo,
|
||||
UuidSustitucion = cancelacion.UuidSustitucion
|
||||
},
|
||||
null,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!resultado.Success ||
|
||||
resultado.Data == null ||
|
||||
!resultado.Data.CancelacionExitosa)
|
||||
{
|
||||
return resultado.Success
|
||||
? Fallar<string>(
|
||||
resultado.Data == null ||
|
||||
string.IsNullOrWhiteSpace(resultado.Data.Mensaje)
|
||||
? "El PAC no confirmó la cancelación."
|
||||
: resultado.Data.Mensaje)
|
||||
: CopiarFallo<CfdiCancelacionResultadoModel, string>(
|
||||
resultado);
|
||||
}
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<bool> actualizarResultado =
|
||||
_repositorio.MarcarTimbreCancelado(
|
||||
contexto.CveVenta.Value,
|
||||
contexto.CveCfdiDocumento.Value,
|
||||
cancelacion.Motivo,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!actualizarResultado.Success)
|
||||
{
|
||||
return CopiarFallo<bool, string>(actualizarResultado);
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
}
|
||||
|
||||
return DbResult<string>.Ok(resultado.Data.Mensaje);
|
||||
}
|
||||
|
||||
private static CfdiSolicitudModel CrearSolicitudCfdi(
|
||||
ModeloDatosCfdiVentaTramite datos,
|
||||
int cveEmpresa)
|
||||
{
|
||||
var solicitud = new CfdiSolicitudModel
|
||||
{
|
||||
CveCfdiDocumento = datos.CveCfdiDocumento ?? 0,
|
||||
CveEmpresa = cveEmpresa,
|
||||
CveCliente = datos.CveCliente,
|
||||
TipoOrigen = "VENTA",
|
||||
CveOrigen = datos.CveVenta,
|
||||
ReferenciaOrigen = "Venta de trámite " + datos.CveVenta,
|
||||
Serie = datos.Serie,
|
||||
Folio = datos.Folio.ToString(),
|
||||
FechaEmision = datos.Fecha,
|
||||
TipoComprobante = "I",
|
||||
FormaPago = datos.FormaPago,
|
||||
MetodoPago = datos.MetodoPago,
|
||||
Moneda = datos.Moneda,
|
||||
TipoCambio = datos.TipoCambio,
|
||||
Exportacion = "01"
|
||||
};
|
||||
|
||||
foreach (ModeloConceptoCfdiVentaTramite origen in datos.Conceptos)
|
||||
{
|
||||
var concepto = new CfdiConceptoModel
|
||||
{
|
||||
ClaveProductoServicio = origen.ClaveProductoServicio,
|
||||
NumeroIdentificacion = origen.NumeroIdentificacion,
|
||||
Cantidad = origen.Cantidad,
|
||||
ClaveUnidad = origen.ClaveUnidad,
|
||||
Unidad = origen.Unidad,
|
||||
Descripcion = origen.Descripcion,
|
||||
ValorUnitario = origen.ValorUnitario,
|
||||
Descuento = origen.Descuento,
|
||||
ObjetoImpuesto = origen.ObjetoImpuesto
|
||||
};
|
||||
|
||||
if (origen.ObjetoImpuesto != "01")
|
||||
{
|
||||
concepto.Impuestos.Add(
|
||||
new CfdiImpuestoConceptoModel
|
||||
{
|
||||
EsRetencion = false,
|
||||
Base = origen.BaseIVA,
|
||||
Impuesto = "002",
|
||||
TipoFactor = "Tasa",
|
||||
TasaOCuota = origen.TasaIVA,
|
||||
Importe = origen.ImporteIVA
|
||||
});
|
||||
}
|
||||
|
||||
solicitud.Conceptos.Add(concepto);
|
||||
}
|
||||
|
||||
return solicitud;
|
||||
}
|
||||
|
||||
private static bool MotivoCancelacionValido(string motivo)
|
||||
{
|
||||
return motivo == "01" ||
|
||||
motivo == "02" ||
|
||||
motivo == "03" ||
|
||||
motivo == "04";
|
||||
}
|
||||
|
||||
private static string NormalizarUuid(string uuid)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(uuid)
|
||||
? null
|
||||
: uuid.Trim().ToUpperInvariant();
|
||||
}
|
||||
|
||||
private static DbResult<TDestino> CopiarFallo<TOrigen, TDestino>(
|
||||
DbResult<TOrigen> origen)
|
||||
{
|
||||
return DbResult<TDestino>.Fail(
|
||||
origen.UserMessage,
|
||||
origen.TechnicalMessage,
|
||||
origen.Exception);
|
||||
}
|
||||
|
||||
private static string NormalizarObservaciones(string observaciones)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(observaciones))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string valor = observaciones.Trim();
|
||||
|
||||
return valor.Length <= 2000
|
||||
? valor
|
||||
: valor.Substring(0, 2000);
|
||||
}
|
||||
|
||||
private static string NormalizarTexto(
|
||||
string texto,
|
||||
int longitudMaxima)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(texto))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string valor = texto.Trim();
|
||||
|
||||
return valor.Length <= longitudMaxima
|
||||
? valor
|
||||
: valor.Substring(0, longitudMaxima);
|
||||
}
|
||||
|
||||
private static DbResult<T> Fallar<T>(string mensaje)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
mensaje,
|
||||
mensaje,
|
||||
new ArgumentException(mensaje));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace SIG.Web.AppCode.Session
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class UserSessionModel
|
||||
{
|
||||
public int CveUsuario { get; set; }
|
||||
public int CveUsuarioOriginal { get; set; }
|
||||
public int CveRol { get; set; }
|
||||
public int CveRolOriginal { get; set; }
|
||||
public int CveEmpresa { get; set; }
|
||||
public int CveCliente { get; set; }
|
||||
public string NombreUsuario { get; set; }
|
||||
public string Nombre { get; set; }
|
||||
public string CorreoElectronico { get; set; }
|
||||
@@ -12,5 +18,12 @@ namespace SIG.Web.AppCode.Session
|
||||
public string NombreDominio { get; set; }
|
||||
public string TokenSesion { get; set; }
|
||||
public bool DebeCambiarContrasena { get; set; }
|
||||
public bool EsAdmin { get; set; }
|
||||
public bool PuedeCambiarUsuario { get; set; }
|
||||
|
||||
public bool EsDesarrollador
|
||||
{
|
||||
get { return CveRol == 3; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.WebControls;
|
||||
using Newtonsoft.Json;
|
||||
using SIG.Web.AppCode.Configuration;
|
||||
@@ -35,9 +36,18 @@ namespace SIG.Web.AppCode.SigControls
|
||||
private Panel _scrollPanel;
|
||||
private GridView _grid;
|
||||
private Panel _pagerPanel;
|
||||
private Panel _pagerActionsPanel;
|
||||
private LinkButton _previousButton;
|
||||
private Label _pagerSummaryLabel;
|
||||
private LinkButton _nextButton;
|
||||
private Panel _paginationSliderPanel;
|
||||
private Label _paginationSliderMinimumLabel;
|
||||
private Panel _paginationSliderTrack;
|
||||
private Label _paginationSliderLabel;
|
||||
private HtmlInputGenericControl _paginationSlider;
|
||||
private Label _paginationSliderMaximumLabel;
|
||||
private HiddenField _requestedPageField;
|
||||
private LinkButton _goToPageButton;
|
||||
private Panel _detailModal;
|
||||
private Label _detailTitleLabel;
|
||||
private Label _detailDescriptionLabel;
|
||||
@@ -501,7 +511,7 @@ namespace SIG.Web.AppCode.SigControls
|
||||
ShowHeaderWhenEmpty = true,
|
||||
UseAccessibleHeader = true
|
||||
};
|
||||
_grid.DataKeyNames = new[] { "CveBitacora", "IndiceAbsoluto" };
|
||||
_grid.DataKeyNames = new[] { "CveBitacora" };
|
||||
_grid.RowDataBound += Grid_RowDataBound;
|
||||
_grid.RowCommand += Grid_RowCommand;
|
||||
|
||||
@@ -558,6 +568,11 @@ namespace SIG.Web.AppCode.SigControls
|
||||
Visible = false
|
||||
};
|
||||
|
||||
_pagerActionsPanel = new Panel
|
||||
{
|
||||
CssClass = "sig-bitacora-grid-pager-actions"
|
||||
};
|
||||
|
||||
_previousButton = new LinkButton
|
||||
{
|
||||
ID = "BtnAnterior",
|
||||
@@ -582,9 +597,73 @@ namespace SIG.Web.AppCode.SigControls
|
||||
};
|
||||
_nextButton.Click += NextButton_Click;
|
||||
|
||||
_pagerPanel.Controls.Add(_previousButton);
|
||||
_pagerPanel.Controls.Add(_pagerSummaryLabel);
|
||||
_pagerPanel.Controls.Add(_nextButton);
|
||||
_paginationSliderPanel = new Panel
|
||||
{
|
||||
CssClass = "sig-bitacora-grid-pagination-slider"
|
||||
};
|
||||
|
||||
_paginationSliderMinimumLabel = new Label
|
||||
{
|
||||
CssClass = "sig-bitacora-grid-pagination-slider-endpoint",
|
||||
Text = "1"
|
||||
};
|
||||
|
||||
_paginationSliderTrack = new Panel
|
||||
{
|
||||
CssClass = "sig-bitacora-grid-pagination-slider-track"
|
||||
};
|
||||
|
||||
_paginationSliderLabel = new Label
|
||||
{
|
||||
CssClass = "sig-bitacora-grid-pagination-slider-label"
|
||||
};
|
||||
_paginationSliderLabel.Attributes["aria-live"] = "polite";
|
||||
|
||||
_paginationSlider = new HtmlInputGenericControl("range")
|
||||
{
|
||||
ID = "RngPagina"
|
||||
};
|
||||
_paginationSlider.Attributes["class"] =
|
||||
"sig-bitacora-grid-pagination-slider-input " +
|
||||
"js-sig-bitacora-grid-pagination-slider";
|
||||
|
||||
_paginationSliderMaximumLabel = new Label
|
||||
{
|
||||
CssClass = "sig-bitacora-grid-pagination-slider-endpoint"
|
||||
};
|
||||
|
||||
_requestedPageField = new HiddenField
|
||||
{
|
||||
ID = "HfPaginaSolicitada"
|
||||
};
|
||||
|
||||
_goToPageButton = new LinkButton
|
||||
{
|
||||
ID = "BtnIrPagina",
|
||||
CssClass =
|
||||
"sig-bitacora-grid-page-request " +
|
||||
"js-sig-bitacora-grid-page-request",
|
||||
CausesValidation = false,
|
||||
Text = "Ir a página"
|
||||
};
|
||||
_goToPageButton.Click += GoToPageButton_Click;
|
||||
|
||||
_pagerActionsPanel.Controls.Add(_previousButton);
|
||||
_pagerActionsPanel.Controls.Add(_pagerSummaryLabel);
|
||||
_pagerActionsPanel.Controls.Add(_nextButton);
|
||||
|
||||
_paginationSliderTrack.Controls.Add(_paginationSliderLabel);
|
||||
_paginationSliderTrack.Controls.Add(_paginationSlider);
|
||||
_paginationSliderPanel.Controls.Add(
|
||||
_paginationSliderMinimumLabel);
|
||||
_paginationSliderPanel.Controls.Add(_paginationSliderTrack);
|
||||
_paginationSliderPanel.Controls.Add(
|
||||
_paginationSliderMaximumLabel);
|
||||
|
||||
_pagerPanel.Controls.Add(_paginationSliderPanel);
|
||||
_pagerPanel.Controls.Add(_pagerActionsPanel);
|
||||
_pagerPanel.Controls.Add(_requestedPageField);
|
||||
_pagerPanel.Controls.Add(_goToPageButton);
|
||||
_rootPanel.Controls.Add(_pagerPanel);
|
||||
}
|
||||
|
||||
@@ -747,6 +826,56 @@ namespace SIG.Web.AppCode.SigControls
|
||||
? "1"
|
||||
: "0";
|
||||
_rootPanel.Attributes["data-sig-scroll-anchor"] = ScrollAnchor;
|
||||
|
||||
int renderedTotalPages = Math.Max(TotalPaginas, 1);
|
||||
int renderedCurrentPage = Math.Min(
|
||||
Math.Max(PaginaActual, 1),
|
||||
renderedTotalPages);
|
||||
decimal sliderPosition = renderedTotalPages <= 1
|
||||
? 0
|
||||
: (renderedCurrentPage - 1) * 100m /
|
||||
(renderedTotalPages - 1);
|
||||
string sliderText = string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
"Página {0} de {1}",
|
||||
renderedCurrentPage,
|
||||
renderedTotalPages);
|
||||
|
||||
_paginationSlider.Attributes["min"] = "1";
|
||||
_paginationSlider.Attributes["max"] =
|
||||
renderedTotalPages.ToString(CultureInfo.InvariantCulture);
|
||||
_paginationSlider.Attributes["step"] = "1";
|
||||
_paginationSlider.Attributes["value"] =
|
||||
renderedCurrentPage.ToString(CultureInfo.InvariantCulture);
|
||||
_paginationSlider.Attributes["aria-label"] =
|
||||
"Seleccionar página de la bitácora";
|
||||
_paginationSlider.Attributes["aria-valuemin"] = "1";
|
||||
_paginationSlider.Attributes["aria-valuemax"] =
|
||||
renderedTotalPages.ToString(CultureInfo.InvariantCulture);
|
||||
_paginationSlider.Attributes["aria-valuenow"] =
|
||||
renderedCurrentPage.ToString(CultureInfo.InvariantCulture);
|
||||
_paginationSlider.Attributes["aria-valuetext"] = sliderText;
|
||||
_paginationSlider.Attributes["data-sig-current-page"] =
|
||||
renderedCurrentPage.ToString(CultureInfo.InvariantCulture);
|
||||
_paginationSlider.Attributes["data-sig-page-field-id"] =
|
||||
_requestedPageField.ClientID;
|
||||
_paginationSlider.Disabled = TotalPaginas <= 1;
|
||||
_requestedPageField.Value = string.Empty;
|
||||
|
||||
_paginationSliderLabel.Text = sliderText;
|
||||
_paginationSliderMaximumLabel.Text =
|
||||
renderedTotalPages.ToString(CultureInfo.CurrentCulture);
|
||||
_paginationSliderTrack.Style[
|
||||
"--sig-bitacora-page-position"] =
|
||||
sliderPosition.ToString(
|
||||
"0.####",
|
||||
CultureInfo.InvariantCulture) + "%";
|
||||
_paginationSliderTrack.Attributes["data-sig-slider-edge"] =
|
||||
renderedCurrentPage <= 1
|
||||
? "start"
|
||||
: renderedCurrentPage >= renderedTotalPages
|
||||
? "end"
|
||||
: "middle";
|
||||
}
|
||||
|
||||
private void RegisterAsyncControls()
|
||||
@@ -764,6 +893,7 @@ namespace SIG.Web.AppCode.SigControls
|
||||
_secondaryActionButton);
|
||||
scriptManager.RegisterAsyncPostBackControl(_previousButton);
|
||||
scriptManager.RegisterAsyncPostBackControl(_nextButton);
|
||||
scriptManager.RegisterAsyncPostBackControl(_goToPageButton);
|
||||
|
||||
foreach (GridViewRow row in _grid.Rows)
|
||||
{
|
||||
@@ -814,15 +944,9 @@ namespace SIG.Web.AppCode.SigControls
|
||||
TotalPaginas = pagina.TotalPaginas;
|
||||
TotalRegistros = pagina.TotalRegistros;
|
||||
|
||||
int firstIndex = checked(
|
||||
(PaginaActual - 1) * RegistrosPorPagina);
|
||||
|
||||
List<BitacoraGridRowModel> rows =
|
||||
(pagina.Registros ?? new List<BitacoraModel>())
|
||||
.Select(
|
||||
(item, index) => CreateGridRow(
|
||||
item,
|
||||
firstIndex + index))
|
||||
.Select(CreateGridRow)
|
||||
.ToList();
|
||||
|
||||
_grid.DataSource = rows;
|
||||
@@ -833,16 +957,25 @@ namespace SIG.Web.AppCode.SigControls
|
||||
_emptyPanel.Visible = pagina.TotalRegistros == 0;
|
||||
_scrollPanel.Visible = pagina.TotalRegistros > 0;
|
||||
_pagerPanel.Visible = pagina.TotalRegistros > 0;
|
||||
_previousButton.Visible = PaginaActual > 1;
|
||||
_nextButton.Visible =
|
||||
_previousButton.Visible = true;
|
||||
_previousButton.Enabled = PaginaActual > 1;
|
||||
_nextButton.Visible = true;
|
||||
_nextButton.Enabled =
|
||||
TotalPaginas > 0 && PaginaActual < TotalPaginas;
|
||||
int firstVisibleRecord = (int)Math.Min(
|
||||
((long)(PaginaActual - 1) * RegistrosPorPagina) + 1L,
|
||||
TotalRegistros);
|
||||
int lastVisibleRecord = (int)Math.Min(
|
||||
(long)PaginaActual * RegistrosPorPagina,
|
||||
TotalRegistros);
|
||||
_pagerSummaryLabel.Text = string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
"Página {0} de {1} · {2} movimientos · {3} por página",
|
||||
PaginaActual,
|
||||
Math.Max(TotalPaginas, 1),
|
||||
"Mostrando {0}–{1} de {2} movimientos · Página {3} de {4}",
|
||||
firstVisibleRecord,
|
||||
lastVisibleRecord,
|
||||
TotalRegistros,
|
||||
RegistrosPorPagina);
|
||||
PaginaActual,
|
||||
Math.Max(TotalPaginas, 1));
|
||||
}
|
||||
|
||||
private void BindError(string message)
|
||||
@@ -860,14 +993,10 @@ namespace SIG.Web.AppCode.SigControls
|
||||
TotalRegistros = 0;
|
||||
}
|
||||
|
||||
private void BindDetail(long cveBitacora, int absoluteIndex)
|
||||
private void BindDetail(long cveBitacora)
|
||||
{
|
||||
BitacoraConsultaModel detailQuery = BuildConsulta(
|
||||
absoluteIndex + 1,
|
||||
1);
|
||||
|
||||
DbResult<ResultadoPaginado<BitacoraModel>> result =
|
||||
AppServices.BitacoraService.Consultar(detailQuery);
|
||||
DbResult<BitacoraModel> result =
|
||||
AppServices.BitacoraService.ConsultarDetalle(cveBitacora);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
@@ -875,16 +1004,12 @@ namespace SIG.Web.AppCode.SigControls
|
||||
return;
|
||||
}
|
||||
|
||||
BitacoraModel movement = result.Data == null ||
|
||||
result.Data.Registros == null
|
||||
? null
|
||||
: result.Data.Registros.FirstOrDefault();
|
||||
BitacoraModel movement = result.Data;
|
||||
|
||||
if (movement == null || movement.CveBitacora != cveBitacora)
|
||||
if (movement == null)
|
||||
{
|
||||
ShowDetailError(
|
||||
"El movimiento cambió de posición mientras se consultaba. " +
|
||||
"Actualice la bitácora e intente nuevamente.");
|
||||
"No se encontró el movimiento de bitácora solicitado.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -970,13 +1095,11 @@ namespace SIG.Web.AppCode.SigControls
|
||||
}
|
||||
|
||||
private static BitacoraGridRowModel CreateGridRow(
|
||||
BitacoraModel item,
|
||||
int absoluteIndex)
|
||||
BitacoraModel item)
|
||||
{
|
||||
return new BitacoraGridRowModel
|
||||
{
|
||||
CveBitacora = item.CveBitacora,
|
||||
IndiceAbsoluto = absoluteIndex,
|
||||
Entidad = item.NombreTabla,
|
||||
Movimiento = string.IsNullOrWhiteSpace(item.NombreAccion)
|
||||
? item.TipoMovimiento
|
||||
@@ -1124,11 +1247,8 @@ namespace SIG.Web.AppCode.SigControls
|
||||
}
|
||||
|
||||
button.CommandName = "VerDetalle";
|
||||
button.CommandArgument = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0}|{1}",
|
||||
rowModel.CveBitacora,
|
||||
rowModel.IndiceAbsoluto);
|
||||
button.CommandArgument = rowModel.CveBitacora.ToString(
|
||||
CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
private void Grid_RowCommand(
|
||||
@@ -1143,31 +1263,21 @@ namespace SIG.Web.AppCode.SigControls
|
||||
return;
|
||||
}
|
||||
|
||||
string[] parts = Convert.ToString(e.CommandArgument)
|
||||
.Split('|');
|
||||
long cveBitacora;
|
||||
int absoluteIndex;
|
||||
|
||||
if (parts.Length != 2 ||
|
||||
!long.TryParse(
|
||||
parts[0],
|
||||
if (!long.TryParse(
|
||||
Convert.ToString(e.CommandArgument),
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out cveBitacora) ||
|
||||
!int.TryParse(
|
||||
parts[1],
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out absoluteIndex) ||
|
||||
cveBitacora <= 0 ||
|
||||
absoluteIndex < 0)
|
||||
cveBitacora <= 0)
|
||||
{
|
||||
ShowDetailError(
|
||||
"No fue posible identificar el movimiento seleccionado.");
|
||||
return;
|
||||
}
|
||||
|
||||
BindDetail(cveBitacora, absoluteIndex);
|
||||
BindDetail(cveBitacora);
|
||||
}
|
||||
|
||||
private void PreviousButton_Click(object sender, EventArgs e)
|
||||
@@ -1196,6 +1306,30 @@ namespace SIG.Web.AppCode.SigControls
|
||||
UpdateListPanelIfNeeded();
|
||||
}
|
||||
|
||||
private void GoToPageButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
int requestedPage;
|
||||
|
||||
if (!int.TryParse(
|
||||
_requestedPageField.Value,
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out requestedPage) ||
|
||||
TotalPaginas <= 1 ||
|
||||
requestedPage < 1 ||
|
||||
requestedPage > TotalPaginas ||
|
||||
requestedPage == PaginaActual)
|
||||
{
|
||||
_requestedPageField.Value = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
PaginaActual = requestedPage;
|
||||
_requestedPageField.Value = string.Empty;
|
||||
BindResumen();
|
||||
UpdateListPanelIfNeeded();
|
||||
}
|
||||
|
||||
private void RecordsPerPageSelector_SelectedIndexChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
@@ -1287,7 +1421,6 @@ namespace SIG.Web.AppCode.SigControls
|
||||
private sealed class BitacoraGridRowModel
|
||||
{
|
||||
public long CveBitacora { get; set; }
|
||||
public int IndiceAbsoluto { get; set; }
|
||||
public string Entidad { get; set; }
|
||||
public string Movimiento { get; set; }
|
||||
public string Descripcion { get; set; }
|
||||
|
||||
BIN
SIG.Web/Imagenes/favicon.ico
Normal file
BIN
SIG.Web/Imagenes/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
241
SIG.Web/Pages/Catalogos/Clasificaciones.aspx
Normal file
241
SIG.Web/Pages/Catalogos/Clasificaciones.aspx
Normal file
@@ -0,0 +1,241 @@
|
||||
<%@ Page Title="Clasificación"
|
||||
Language="C#"
|
||||
MasterPageFile="~/Site.master"
|
||||
AutoEventWireup="true"
|
||||
CodeFile="Clasificaciones.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Catalogos.Clasificaciones" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
<link href='<%= ResolveUrl("~/Styles/CatalogosTramites.css") %>'
|
||||
rel="stylesheet"
|
||||
type="text/css" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentActions" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpActions"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnNew"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnNew_Click">
|
||||
<i class="fa fa-plus"></i>
|
||||
Nueva clasificación
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNew" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalog"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<sig:Filtros ID="UcFiltros"
|
||||
runat="server"
|
||||
OnMostrarFiltros="UcFiltros_MostrarFiltros"
|
||||
OnFiltrosChanged="UcFiltros_FiltrosChanged"
|
||||
OnConsultar="UcFiltros_Consultar" />
|
||||
|
||||
<div class="tra-catalog-card">
|
||||
<asp:GridView ID="GvClasificaciones"
|
||||
runat="server"
|
||||
AutoGenerateColumns="false"
|
||||
DataKeyNames="CveClasificacion"
|
||||
GridLines="None"
|
||||
CssClass="table table-striped table-hover Widthall"
|
||||
EmptyDataText="No se encontraron clasificaciones para los filtros actuales."
|
||||
OnRowCommand="GvClasificaciones_RowCommand"
|
||||
OnRowDataBound="GvClasificaciones_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Codigo" HeaderText="Código" />
|
||||
<asp:BoundField DataField="Clasificacion" HeaderText="Clasificación" />
|
||||
<asp:CheckBoxField DataField="Afectable" HeaderText="Afectable" />
|
||||
<asp:CheckBoxField DataField="EsActivo" HeaderText="Activo" />
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnViewAudit"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm default"
|
||||
CommandName="VerBitacora"
|
||||
CommandArgument='<%# Eval("CveClasificacion") %>'
|
||||
CausesValidation="false"
|
||||
ToolTip="Ver bitácora"
|
||||
aria-label="Ver bitácora">
|
||||
<i class="fa fa-history" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnEdit"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm blue"
|
||||
CommandName="Editar"
|
||||
CommandArgument='<%# Eval("CveClasificacion") %>'
|
||||
CausesValidation="false"
|
||||
ToolTip="Editar"
|
||||
aria-label="Editar clasificación">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnDelete"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm red"
|
||||
CommandName="Eliminar"
|
||||
CommandArgument='<%# Eval("CveClasificacion") %>'
|
||||
CausesValidation="false"
|
||||
OnClientClick="return window.SIGAlerts.confirmPostBack(this, '¿Desea eliminar físicamente la clasificación?');"
|
||||
ToolTip="Eliminar"
|
||||
aria-label="Eliminar clasificación">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="Consultar" />
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="FiltrosChanged" />
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="MostrarFiltros" />
|
||||
<asp:AsyncPostBackTrigger ControlID="GvClasificaciones" EventName="RowCommand" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<div id="ModalFilters" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpFilters"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">Filtros</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtSearch.ClientID %>">
|
||||
Código o clasificación
|
||||
</label>
|
||||
<asp:TextBox ID="TxtSearch"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="200" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkInactive"
|
||||
runat="server"
|
||||
Text=" Incluir inactivas" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnApplyFilters"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
Text="Aplicar filtros"
|
||||
OnClick="BtnApplyFilters_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnApplyFilters"
|
||||
EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ModalEdit" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpEdit"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LitModalTitle" runat="server" />
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtCode.ClientID %>">Código</label>
|
||||
<asp:TextBox ID="TxtCode"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="20" />
|
||||
</div>
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtClassification.ClientID %>">
|
||||
Clasificación *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtClassification"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="200" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkAffectable"
|
||||
runat="server"
|
||||
Text=" Afectable" />
|
||||
<br />
|
||||
<asp:CheckBox ID="ChkActive"
|
||||
runat="server"
|
||||
Text=" Activa" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnSave"
|
||||
runat="server"
|
||||
CssClass="btn green"
|
||||
Text="Guardar"
|
||||
OnClick="BtnSave_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnSave" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<sig:BitacoraGrid ID="UcBitacoraCatalogo"
|
||||
runat="server"
|
||||
Titulo="Bitácora"
|
||||
Descripcion="Historial de clasificaciones"
|
||||
TextoVacio="No hay movimientos registrados para clasificaciones."
|
||||
RegistrosPorPagina="10"
|
||||
AccionTexto="Ver toda"
|
||||
OnAccionClick="UcBitacoraCatalogo_AccionClick" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<script src='<%= ResolveUrl("~/Scripts/CatalogosTramites.js") %>'
|
||||
type="text/javascript"></script>
|
||||
</asp:Content>
|
||||
402
SIG.Web/Pages/Catalogos/Clasificaciones.aspx.cs
Normal file
402
SIG.Web/Pages/Catalogos/Clasificaciones.aspx.cs
Normal file
@@ -0,0 +1,402 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using SIG.Web.AppCode.Configuration;
|
||||
using SIG.Web.AppCode.Infrastructure.WebForms;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
using SIG.Web.AppCode.Security;
|
||||
using SIG.Web.AppCode.SigControls;
|
||||
|
||||
namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class Clasificaciones : ClsPaginaCatalogoInterno
|
||||
{
|
||||
private int CveClasificacionActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveClasificacionActual"] == null
|
||||
? 0
|
||||
: (int)ViewState["CveClasificacionActual"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CveClasificacionActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int CveClasificacionBitacoraActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveClasificacionBitacoraActual"] == null
|
||||
? 0
|
||||
: (int)ViewState["CveClasificacionBitacoraActual"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CveClasificacionBitacoraActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string NombreClasificacionBitacoraActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToString(
|
||||
ViewState["NombreClasificacionBitacoraActual"]);
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["NombreClasificacionBitacoraActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (IsPostBack)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
BindBitacora();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void UcFiltros_MostrarFiltros(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
ShowModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void UcFiltros_Consultar(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void UcFiltros_FiltrosChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
List<string> names = UcFiltros.GetFiltros()
|
||||
.Select(item => item.Nombre)
|
||||
.ToList();
|
||||
|
||||
if (!names.Contains("Texto"))
|
||||
{
|
||||
TxtSearch.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (!names.Contains("Inactivos"))
|
||||
{
|
||||
ChkInactive.Checked = false;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void BtnApplyFilters_Click(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void BtnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
CveClasificacionActual = 0;
|
||||
LitModalTitle.Text = "Nueva clasificación";
|
||||
TxtCode.Text = string.Empty;
|
||||
TxtClassification.Text = string.Empty;
|
||||
ChkAffectable.Checked = true;
|
||||
ChkActive.Checked = true;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
}
|
||||
|
||||
protected void GvClasificaciones_RowDataBound(
|
||||
object sender,
|
||||
GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType != DataControlRowType.DataRow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
|
||||
|
||||
if (scriptManager == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnViewAudit");
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnEdit");
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnDelete");
|
||||
}
|
||||
|
||||
protected void GvClasificaciones_RowCommand(
|
||||
object sender,
|
||||
GridViewCommandEventArgs e)
|
||||
{
|
||||
int cveClasificacion;
|
||||
|
||||
if (!int.TryParse(
|
||||
Convert.ToString(e.CommandArgument),
|
||||
out cveClasificacion))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.CommandName == "Editar")
|
||||
{
|
||||
LoadEdit(cveClasificacion);
|
||||
}
|
||||
else if (e.CommandName == "VerBitacora")
|
||||
{
|
||||
SelectBitacora(cveClasificacion);
|
||||
}
|
||||
else if (e.CommandName == "Eliminar")
|
||||
{
|
||||
Delete(cveClasificacion);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var clasificacion = new ClasificacionModel
|
||||
{
|
||||
CveClasificacion = CveClasificacionActual,
|
||||
Codigo = TxtCode.Text,
|
||||
Clasificacion = TxtClassification.Text,
|
||||
Afectable = ChkAffectable.Checked,
|
||||
EsActivo = ChkActive.Checked
|
||||
};
|
||||
|
||||
DbResult<int> result =
|
||||
AppServices.ProductoCatalogService.SaveClasificacion(
|
||||
clasificacion,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
ShowModal("ModalEdit");
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalEdit");
|
||||
Alert(
|
||||
"Clasificación guardada correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
protected void UcBitacoraCatalogo_AccionClick(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
CveClasificacionBitacoraActual = 0;
|
||||
NombreClasificacionBitacoraActual = string.Empty;
|
||||
BindBitacora();
|
||||
}
|
||||
|
||||
private void LoadEdit(int cveClasificacion)
|
||||
{
|
||||
DbResult<ClasificacionModel> result =
|
||||
AppServices.ProductoCatalogService.GetClasificacion(
|
||||
cveClasificacion,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveClasificacionActual = result.Data.CveClasificacion;
|
||||
LitModalTitle.Text = "Editar clasificación";
|
||||
TxtCode.Text = result.Data.Codigo;
|
||||
TxtClassification.Text = result.Data.Clasificacion;
|
||||
ChkAffectable.Checked = result.Data.Afectable;
|
||||
ChkActive.Checked = result.Data.EsActivo;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
}
|
||||
|
||||
private void SelectBitacora(int cveClasificacion)
|
||||
{
|
||||
DbResult<ClasificacionModel> result =
|
||||
AppServices.ProductoCatalogService.GetClasificacion(
|
||||
cveClasificacion,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveClasificacionBitacoraActual = cveClasificacion;
|
||||
NombreClasificacionBitacoraActual = result.Data.Clasificacion;
|
||||
BindBitacora();
|
||||
}
|
||||
|
||||
private void Delete(int cveClasificacion)
|
||||
{
|
||||
DbResult<bool> result =
|
||||
AppServices.ProductoCatalogService.DeleteClasificacion(
|
||||
cveClasificacion,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CveClasificacionBitacoraActual == cveClasificacion)
|
||||
{
|
||||
CveClasificacionBitacoraActual = 0;
|
||||
NombreClasificacionBitacoraActual = string.Empty;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
Alert(
|
||||
"Clasificación eliminada correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
DbResult<List<ClasificacionModel>> result =
|
||||
AppServices.ProductoCatalogService.ListClasificaciones(
|
||||
TxtSearch.Text,
|
||||
ChkInactive.Checked,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
return;
|
||||
}
|
||||
|
||||
GvClasificaciones.DataSource =
|
||||
result.Data ?? new List<ClasificacionModel>();
|
||||
GvClasificaciones.DataBind();
|
||||
}
|
||||
|
||||
private void BindBitacora()
|
||||
{
|
||||
bool hasClassification = CveClasificacionBitacoraActual > 0;
|
||||
|
||||
UcBitacoraCatalogo.Descripcion = hasClassification
|
||||
? "Historial de " + NombreClasificacionBitacoraActual
|
||||
: "Historial de clasificaciones";
|
||||
UcBitacoraCatalogo.AccionVisible = hasClassification;
|
||||
UcBitacoraCatalogo.ConfigurarConsulta(
|
||||
new List<BitacoraCampoFiltroModel>
|
||||
{
|
||||
new BitacoraCampoFiltroModel
|
||||
{
|
||||
NombreTablaSQL = "Clasificaciones",
|
||||
NombreCampoSQL = "CveClasificacion",
|
||||
Valor = hasClassification
|
||||
? CveClasificacionBitacoraActual.ToString(
|
||||
CultureInfo.InvariantCulture)
|
||||
: string.Empty,
|
||||
SoloExistencia = !hasClassification
|
||||
}
|
||||
},
|
||||
new List<BitacoraRelacionMostrarModel>
|
||||
{
|
||||
new BitacoraRelacionMostrarModel
|
||||
{
|
||||
Orden = 1,
|
||||
NombreTablaSQL = "Clasificaciones",
|
||||
NombreCampoMostrarSQL = "Clasificacion"
|
||||
}
|
||||
});
|
||||
UcBitacoraCatalogo.Consultar(true);
|
||||
}
|
||||
|
||||
private void SyncFilters()
|
||||
{
|
||||
var filters = new List<FiltroActivo>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(TxtSearch.Text))
|
||||
{
|
||||
filters.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Texto",
|
||||
Titulo = "Búsqueda",
|
||||
Descripcion = TxtSearch.Text.Trim(),
|
||||
Orden = 1
|
||||
});
|
||||
}
|
||||
|
||||
if (ChkInactive.Checked)
|
||||
{
|
||||
filters.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Inactivos",
|
||||
Titulo = "Estado",
|
||||
Descripcion = "Incluye inactivas",
|
||||
Orden = 2
|
||||
});
|
||||
}
|
||||
|
||||
UcFiltros.SetFiltros(filters);
|
||||
}
|
||||
|
||||
private static void RegisterAsyncControl(
|
||||
ScriptManager scriptManager,
|
||||
GridViewRow row,
|
||||
string controlId)
|
||||
{
|
||||
Control control = row.FindControl(controlId);
|
||||
|
||||
if (control != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(control);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowModal(string id)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.show('" + id + "');",
|
||||
"Show_" + id);
|
||||
}
|
||||
|
||||
private void HideModal(string id)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.hide('" + id + "');",
|
||||
"Hide_" + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class EstatusSolicitud
|
||||
public partial class Clasificaciones
|
||||
{
|
||||
protected global::System.Web.UI.UpdatePanel UpActions;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNew;
|
||||
protected global::System.Web.UI.UpdatePanel UpCatalog;
|
||||
protected global::SIG.Web.AppCode.SigControls.Filtros UcFiltros;
|
||||
protected global::System.Web.UI.WebControls.GridView GvEstatus;
|
||||
protected global::System.Web.UI.WebControls.HiddenField HfOrderMove;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnOrderMove;
|
||||
protected global::System.Web.UI.WebControls.GridView GvClasificaciones;
|
||||
protected global::System.Web.UI.UpdatePanel UpFilters;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtSearch;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkInactive;
|
||||
@@ -16,9 +14,11 @@ namespace SIG.Web.Pages.Catalogos
|
||||
protected global::System.Web.UI.UpdatePanel UpEdit;
|
||||
protected global::System.Web.UI.WebControls.Literal LitModalTitle;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtCode;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtStatus;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkFinal;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtClassification;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkAffectable;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSave;
|
||||
protected global::SIG.Web.AppCode.SigControls.BitacoraGrid
|
||||
UcBitacoraCatalogo;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class DocumentosRequeridos
|
||||
{
|
||||
protected global::System.Web.UI.UpdatePanel UpActions;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNew;
|
||||
protected global::System.Web.UI.UpdatePanel UpCatalog;
|
||||
protected global::SIG.Web.AppCode.SigControls.Filtros UcFiltros;
|
||||
protected global::System.Web.UI.WebControls.GridView GvItems;
|
||||
protected global::System.Web.UI.WebControls.HiddenField HfOrderMove;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnOrderMove;
|
||||
protected global::System.Web.UI.UpdatePanel UpFilters;
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlFilterProcedure;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkInactive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnApplyFilters;
|
||||
protected global::System.Web.UI.UpdatePanel UpEdit;
|
||||
protected global::System.Web.UI.WebControls.Literal LitModalTitle;
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlProcedure;
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlDocument;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkRequired;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSave;
|
||||
}
|
||||
}
|
||||
314
SIG.Web/Pages/Catalogos/ProductosServicios.aspx
Normal file
314
SIG.Web/Pages/Catalogos/ProductosServicios.aspx
Normal file
@@ -0,0 +1,314 @@
|
||||
<%@ Page Title="Productos"
|
||||
Language="C#"
|
||||
MasterPageFile="~/Site.master"
|
||||
AutoEventWireup="true"
|
||||
CodeFile="ProductosServicios.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Catalogos.ProductosServicios" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
<link href='<%= ResolveUrl("~/Styles/CatalogosTramites.css") %>'
|
||||
rel="stylesheet"
|
||||
type="text/css" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentActions" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpActions"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnNew"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnNew_Click">
|
||||
<i class="fa fa-plus"></i>
|
||||
Nuevo producto o servicio
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNew" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalog"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<sig:Filtros ID="UcFiltros"
|
||||
runat="server"
|
||||
OnMostrarFiltros="UcFiltros_MostrarFiltros"
|
||||
OnFiltrosChanged="UcFiltros_FiltrosChanged"
|
||||
OnConsultar="UcFiltros_Consultar" />
|
||||
|
||||
<div class="tra-catalog-card">
|
||||
<asp:GridView ID="GvProductosServicios"
|
||||
runat="server"
|
||||
AutoGenerateColumns="false"
|
||||
DataKeyNames="CvePS"
|
||||
GridLines="None"
|
||||
CssClass="table table-striped table-hover Widthall"
|
||||
EmptyDataText="No se encontraron productos o servicios para los filtros actuales."
|
||||
OnRowCommand="GvProductosServicios_RowCommand"
|
||||
OnRowDataBound="GvProductosServicios_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Codigo" HeaderText="Código" />
|
||||
<asp:BoundField DataField="PS" HeaderText="Descripción" />
|
||||
<asp:BoundField DataField="TipoPS" HeaderText="Tipo" />
|
||||
<asp:BoundField DataField="Clasificacion" HeaderText="Clasificación" />
|
||||
<asp:BoundField DataField="UnidadMedida" HeaderText="Unidad" />
|
||||
<asp:BoundField DataField="Precio"
|
||||
HeaderText="Precio"
|
||||
DataFormatString="{0:N2}"
|
||||
ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:CheckBoxField DataField="EsActivo" HeaderText="Activo" />
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnViewAudit"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm default"
|
||||
CommandName="VerBitacora"
|
||||
CommandArgument='<%# Eval("CvePS") %>'
|
||||
CausesValidation="false"
|
||||
ToolTip="Ver bitácora"
|
||||
aria-label="Ver bitácora">
|
||||
<i class="fa fa-history" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnEdit"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm blue"
|
||||
CommandName="Editar"
|
||||
CommandArgument='<%# Eval("CvePS") %>'
|
||||
CausesValidation="false"
|
||||
ToolTip="Editar"
|
||||
aria-label="Editar producto o servicio">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnDelete"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm red"
|
||||
CommandName="Eliminar"
|
||||
CommandArgument='<%# Eval("CvePS") %>'
|
||||
CausesValidation="false"
|
||||
OnClientClick="return window.SIGAlerts.confirmPostBack(this, '¿Desea eliminar físicamente el producto o servicio?');"
|
||||
ToolTip="Eliminar"
|
||||
aria-label="Eliminar producto o servicio">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="Consultar" />
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="FiltrosChanged" />
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="MostrarFiltros" />
|
||||
<asp:AsyncPostBackTrigger ControlID="GvProductosServicios" EventName="RowCommand" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<div id="ModalFilters" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpFilters"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">Filtros</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtSearch.ClientID %>">
|
||||
Código o descripción
|
||||
</label>
|
||||
<asp:TextBox ID="TxtSearch"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="200" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkInactive"
|
||||
runat="server"
|
||||
Text=" Incluir inactivos" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnApplyFilters"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
Text="Aplicar filtros"
|
||||
OnClick="BtnApplyFilters_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnApplyFilters"
|
||||
EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ModalEdit" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpEdit"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LitModalTitle" runat="server" />
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtCode.ClientID %>">
|
||||
Código
|
||||
</label>
|
||||
<asp:TextBox ID="TxtCode"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="50" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= DdlType.ClientID %>">
|
||||
Tipo *
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlType"
|
||||
runat="server"
|
||||
CssClass="form-control input-sm select2me">
|
||||
<asp:ListItem Text="Seleccione" Value="" />
|
||||
<asp:ListItem Text="Producto" Value="2" />
|
||||
<asp:ListItem Text="Servicio" Value="1" />
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtDescription.ClientID %>">
|
||||
Descripción *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtDescription"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="846"
|
||||
TextMode="MultiLine"
|
||||
Rows="3" />
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= DdlClassification.ClientID %>">
|
||||
Clasificación *
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlClassification"
|
||||
runat="server"
|
||||
CssClass="form-control input-sm select2me"
|
||||
DataTextField="Clasificacion"
|
||||
DataValueField="CveClasificacion" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= DdlMeasurementUnit.ClientID %>">
|
||||
Unidad de medida *
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlMeasurementUnit"
|
||||
runat="server"
|
||||
CssClass="form-control input-sm select2me"
|
||||
DataTextField="UnidadMedida"
|
||||
DataValueField="CveUnidadMedida" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtPrice.ClientID %>">
|
||||
Precio *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtPrice"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="20" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="tra-modal-field">
|
||||
<label>Estado</label>
|
||||
<div>
|
||||
<asp:CheckBox ID="ChkActive"
|
||||
runat="server"
|
||||
Text=" Activo" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnSave"
|
||||
runat="server"
|
||||
CssClass="btn green"
|
||||
Text="Guardar"
|
||||
OnClick="BtnSave_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnSave" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<sig:BitacoraGrid ID="UcBitacoraCatalogo"
|
||||
runat="server"
|
||||
Titulo="Bitácora"
|
||||
Descripcion="Historial de productos y servicios"
|
||||
TextoVacio="No hay movimientos registrados para productos y servicios."
|
||||
RegistrosPorPagina="10"
|
||||
AccionTexto="Ver toda"
|
||||
OnAccionClick="UcBitacoraCatalogo_AccionClick" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<script src='<%= ResolveUrl("~/Scripts/CatalogosTramites.js") %>'
|
||||
type="text/javascript"></script>
|
||||
</asp:Content>
|
||||
541
SIG.Web/Pages/Catalogos/ProductosServicios.aspx.cs
Normal file
541
SIG.Web/Pages/Catalogos/ProductosServicios.aspx.cs
Normal file
@@ -0,0 +1,541 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using SIG.Web.AppCode.Configuration;
|
||||
using SIG.Web.AppCode.Infrastructure.WebForms;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
using SIG.Web.AppCode.Security;
|
||||
using SIG.Web.AppCode.SigControls;
|
||||
|
||||
namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class ProductosServicios : ClsPaginaCatalogoInterno
|
||||
{
|
||||
private int CveProductoServicioActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveProductoServicioActual"] == null
|
||||
? 0
|
||||
: (int)ViewState["CveProductoServicioActual"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CveProductoServicioActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int CveProductoServicioBitacoraActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveProductoServicioBitacoraActual"] == null
|
||||
? 0
|
||||
: (int)ViewState["CveProductoServicioBitacoraActual"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CveProductoServicioBitacoraActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string NombreProductoServicioBitacoraActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToString(
|
||||
ViewState["NombreProductoServicioBitacoraActual"]);
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["NombreProductoServicioBitacoraActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (IsPostBack)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
BindBitacora();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void UcFiltros_MostrarFiltros(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
ShowModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void UcFiltros_Consultar(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void UcFiltros_FiltrosChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
List<string> names = UcFiltros.GetFiltros()
|
||||
.Select(item => item.Nombre)
|
||||
.ToList();
|
||||
|
||||
if (!names.Contains("Texto"))
|
||||
{
|
||||
TxtSearch.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (!names.Contains("Inactivos"))
|
||||
{
|
||||
ChkInactive.Checked = false;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void BtnApplyFilters_Click(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void BtnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
CveProductoServicioActual = 0;
|
||||
|
||||
if (!BindOptions(null, null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LitModalTitle.Text = "Nuevo producto o servicio";
|
||||
TxtCode.Text = string.Empty;
|
||||
TxtDescription.Text = string.Empty;
|
||||
DdlType.SelectedValue = string.Empty;
|
||||
TxtPrice.Text = "0.00";
|
||||
ChkActive.Checked = true;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
}
|
||||
|
||||
protected void GvProductosServicios_RowDataBound(
|
||||
object sender,
|
||||
GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType != DataControlRowType.DataRow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
|
||||
|
||||
if (scriptManager == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LinkButton auditButton = e.Row.FindControl("BtnViewAudit")
|
||||
as LinkButton;
|
||||
LinkButton editButton = e.Row.FindControl("BtnEdit")
|
||||
as LinkButton;
|
||||
LinkButton deleteButton = e.Row.FindControl("BtnDelete")
|
||||
as LinkButton;
|
||||
|
||||
if (auditButton != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(auditButton);
|
||||
}
|
||||
|
||||
if (editButton != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(editButton);
|
||||
}
|
||||
|
||||
if (deleteButton != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(deleteButton);
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvProductosServicios_RowCommand(
|
||||
object sender,
|
||||
GridViewCommandEventArgs e)
|
||||
{
|
||||
int cvePS;
|
||||
|
||||
if (!int.TryParse(Convert.ToString(e.CommandArgument), out cvePS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.Equals(
|
||||
e.CommandName,
|
||||
"Editar",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
LoadEdit(cvePS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.Equals(
|
||||
e.CommandName,
|
||||
"VerBitacora",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
SelectBitacora(cvePS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.Equals(
|
||||
e.CommandName,
|
||||
"Eliminar",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
Delete(cvePS);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
decimal price;
|
||||
|
||||
if (!TryParsePrice(TxtPrice.Text, out price))
|
||||
{
|
||||
Alert(
|
||||
"Capture un precio válido.",
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
ShowModal("ModalEdit");
|
||||
return;
|
||||
}
|
||||
|
||||
int type;
|
||||
int classification;
|
||||
int measurementUnit;
|
||||
|
||||
int.TryParse(DdlType.SelectedValue, out type);
|
||||
int.TryParse(DdlClassification.SelectedValue, out classification);
|
||||
int.TryParse(
|
||||
DdlMeasurementUnit.SelectedValue,
|
||||
out measurementUnit);
|
||||
|
||||
var productoServicio = new ProductoServicioModel
|
||||
{
|
||||
CvePS = CveProductoServicioActual,
|
||||
Codigo = TxtCode.Text,
|
||||
PS = TxtDescription.Text,
|
||||
CveTipoPS = type,
|
||||
CveClasificacion = classification,
|
||||
CveUnidadMedida = measurementUnit,
|
||||
Precio = price,
|
||||
EsActivo = ChkActive.Checked
|
||||
};
|
||||
|
||||
DbResult<int> result = AppServices.ProductoServicioService.Save(
|
||||
productoServicio,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
ShowModal("ModalEdit");
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalEdit");
|
||||
Alert(
|
||||
"Producto o servicio guardado correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
protected void UcBitacoraCatalogo_AccionClick(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
CveProductoServicioBitacoraActual = 0;
|
||||
NombreProductoServicioBitacoraActual = string.Empty;
|
||||
BindBitacora();
|
||||
}
|
||||
|
||||
private void LoadEdit(int cvePS)
|
||||
{
|
||||
DbResult<ProductoServicioModel> result =
|
||||
AppServices.ProductoServicioService.Get(
|
||||
cvePS,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
{
|
||||
Alert(
|
||||
string.IsNullOrWhiteSpace(result.UserMessage)
|
||||
? "No fue posible consultar el producto o servicio."
|
||||
: result.UserMessage,
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
ProductoServicioModel productoServicio = result.Data;
|
||||
|
||||
if (!BindOptions(
|
||||
productoServicio.CveClasificacion,
|
||||
productoServicio.CveUnidadMedida))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CveProductoServicioActual = productoServicio.CvePS;
|
||||
LitModalTitle.Text = "Editar producto o servicio";
|
||||
TxtCode.Text = productoServicio.Codigo;
|
||||
TxtDescription.Text = productoServicio.PS;
|
||||
SelectValue(
|
||||
DdlType,
|
||||
productoServicio.CveTipoPS.ToString(
|
||||
CultureInfo.InvariantCulture));
|
||||
SelectValue(
|
||||
DdlClassification,
|
||||
productoServicio.CveClasificacion.ToString(
|
||||
CultureInfo.InvariantCulture));
|
||||
SelectValue(
|
||||
DdlMeasurementUnit,
|
||||
productoServicio.CveUnidadMedida.ToString(
|
||||
CultureInfo.InvariantCulture));
|
||||
TxtPrice.Text = productoServicio.Precio.ToString(
|
||||
"0.00",
|
||||
CultureInfo.CurrentCulture);
|
||||
ChkActive.Checked = productoServicio.EsActivo;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
}
|
||||
|
||||
private bool BindOptions(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual)
|
||||
{
|
||||
DbResult<ProductoServicioOpcionesModel> result =
|
||||
AppServices.ProductoServicioService.ListOptions(
|
||||
cveClasificacionActual,
|
||||
cveUnidadMedidaActual,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
return false;
|
||||
}
|
||||
|
||||
ProductoServicioOpcionesModel options = result.Data ??
|
||||
new ProductoServicioOpcionesModel();
|
||||
|
||||
DdlClassification.DataSource = options.Clasificaciones;
|
||||
DdlClassification.DataBind();
|
||||
DdlClassification.Items.Insert(
|
||||
0,
|
||||
new ListItem("Seleccione", string.Empty));
|
||||
|
||||
DdlMeasurementUnit.DataSource = options.UnidadesMedida;
|
||||
DdlMeasurementUnit.DataBind();
|
||||
DdlMeasurementUnit.Items.Insert(
|
||||
0,
|
||||
new ListItem("Seleccione", string.Empty));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SelectBitacora(int cvePS)
|
||||
{
|
||||
DbResult<ProductoServicioModel> result =
|
||||
AppServices.ProductoServicioService.Get(
|
||||
cvePS,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveProductoServicioBitacoraActual = cvePS;
|
||||
NombreProductoServicioBitacoraActual = result.Data.PS;
|
||||
BindBitacora();
|
||||
}
|
||||
|
||||
private void Delete(int cvePS)
|
||||
{
|
||||
DbResult<bool> result = AppServices.ProductoServicioService.Delete(
|
||||
cvePS,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CveProductoServicioBitacoraActual == cvePS)
|
||||
{
|
||||
CveProductoServicioBitacoraActual = 0;
|
||||
NombreProductoServicioBitacoraActual = string.Empty;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
Alert(
|
||||
"Producto o servicio eliminado correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
DbResult<List<ProductoServicioModel>> result =
|
||||
AppServices.ProductoServicioService.List(
|
||||
TxtSearch.Text,
|
||||
ChkInactive.Checked,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
return;
|
||||
}
|
||||
|
||||
GvProductosServicios.DataSource =
|
||||
result.Data ?? new List<ProductoServicioModel>();
|
||||
GvProductosServicios.DataBind();
|
||||
}
|
||||
|
||||
private void BindBitacora()
|
||||
{
|
||||
bool hasProduct = CveProductoServicioBitacoraActual > 0;
|
||||
|
||||
UcBitacoraCatalogo.Descripcion = hasProduct &&
|
||||
!string.IsNullOrWhiteSpace(
|
||||
NombreProductoServicioBitacoraActual)
|
||||
? "Historial de " +
|
||||
NombreProductoServicioBitacoraActual
|
||||
: "Historial de productos y servicios";
|
||||
UcBitacoraCatalogo.AccionVisible = hasProduct;
|
||||
|
||||
UcBitacoraCatalogo.ConfigurarConsulta(
|
||||
new List<BitacoraCampoFiltroModel>
|
||||
{
|
||||
new BitacoraCampoFiltroModel
|
||||
{
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
NombreCampoSQL = "CvePS",
|
||||
Valor = hasProduct
|
||||
? CveProductoServicioBitacoraActual.ToString(
|
||||
CultureInfo.InvariantCulture)
|
||||
: string.Empty,
|
||||
SoloExistencia = !hasProduct
|
||||
}
|
||||
},
|
||||
new List<BitacoraRelacionMostrarModel>
|
||||
{
|
||||
new BitacoraRelacionMostrarModel
|
||||
{
|
||||
Orden = 1,
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
NombreCampoMostrarSQL = "PS"
|
||||
}
|
||||
});
|
||||
|
||||
UcBitacoraCatalogo.Consultar(true);
|
||||
}
|
||||
|
||||
private void SyncFilters()
|
||||
{
|
||||
var filters = new List<FiltroActivo>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(TxtSearch.Text))
|
||||
{
|
||||
filters.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Texto",
|
||||
Titulo = "Búsqueda",
|
||||
Descripcion = TxtSearch.Text.Trim(),
|
||||
Orden = 1
|
||||
});
|
||||
}
|
||||
|
||||
if (ChkInactive.Checked)
|
||||
{
|
||||
filters.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Inactivos",
|
||||
Titulo = "Estado",
|
||||
Descripcion = "Incluye inactivos",
|
||||
Orden = 2
|
||||
});
|
||||
}
|
||||
|
||||
UcFiltros.SetFiltros(filters);
|
||||
}
|
||||
|
||||
private static bool TryParsePrice(string value, out decimal price)
|
||||
{
|
||||
return decimal.TryParse(
|
||||
value,
|
||||
NumberStyles.Number,
|
||||
CultureInfo.CurrentCulture,
|
||||
out price) ||
|
||||
decimal.TryParse(
|
||||
value,
|
||||
NumberStyles.Number,
|
||||
CultureInfo.InvariantCulture,
|
||||
out price);
|
||||
}
|
||||
|
||||
private static void SelectValue(
|
||||
ListControl control,
|
||||
string value)
|
||||
{
|
||||
ListItem item = control.Items.FindByValue(value);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
control.ClearSelection();
|
||||
item.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowModal(string id)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.show('" + id + "');",
|
||||
"Show_" + id);
|
||||
}
|
||||
|
||||
private void HideModal(string id)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.hide('" + id + "');",
|
||||
"Hide_" + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,6 +466,9 @@
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Codigo" HeaderText="Código" NullDisplayText="—" />
|
||||
<asp:BoundField DataField="PS" HeaderText="Producto / servicio" />
|
||||
<asp:BoundField DataField="UnidadMedidaTexto"
|
||||
HeaderText="Unidad de medida"
|
||||
NullDisplayText="—" />
|
||||
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad"
|
||||
DataFormatString="{0:N4}" />
|
||||
<asp:BoundField DataField="Precio" HeaderText="Precio"
|
||||
@@ -780,6 +783,15 @@
|
||||
<div class="tra-modal-field">
|
||||
<label>Producto o servicio *</label>
|
||||
<asp:DropDownList ID="DdlProductService"
|
||||
runat="server"
|
||||
AutoPostBack="true"
|
||||
CssClass="form-control select2me"
|
||||
OnSelectedIndexChanged="DdlProductoServicio_SelectedIndexChanged"
|
||||
Width="100%" />
|
||||
</div>
|
||||
<div class="tra-modal-field">
|
||||
<label>Unidad de medida *</label>
|
||||
<asp:DropDownList ID="DdlUnidadMedidaDetallePago"
|
||||
runat="server"
|
||||
CssClass="form-control select2me"
|
||||
Width="100%" />
|
||||
@@ -806,6 +818,9 @@
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger
|
||||
ControlID="DdlProductService"
|
||||
EventName="SelectedIndexChanged" />
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnSavePaymentDetail" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
@@ -869,5 +884,6 @@
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<script src='<%= ResolveUrl("~/Scripts/CatalogosTramites.js") %>' type="text/javascript"></script>
|
||||
<script src='<%= ResolveUrl("~/Scripts/CatalogosTramites.js") %>?v=20260827-02'
|
||||
type="text/javascript"></script>
|
||||
</asp:Content>
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Web.UI.WebControls;
|
||||
using SIG.Web.AppCode.Configuration;
|
||||
using SIG.Web.AppCode.Infrastructure.WebForms;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
using SIG.Web.AppCode.Models.Tramites;
|
||||
using SIG.Web.AppCode.Security;
|
||||
|
||||
@@ -70,6 +71,21 @@ namespace SIG.Web.Pages.Catalogos
|
||||
set { ViewState["CveProductoPrecioActual"] = value; }
|
||||
}
|
||||
|
||||
private List<ProductoServicioTramiteModel>
|
||||
ProductosServiciosDisponibles
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["ProductosServiciosDisponibles"]
|
||||
as List<ProductoServicioTramiteModel>
|
||||
?? new List<ProductoServicioTramiteModel>();
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProductosServiciosDisponibles"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int ActiveTabIndexActual
|
||||
{
|
||||
get { return ViewState["ActiveTabIndexActual"] as int? ?? 0; }
|
||||
@@ -110,6 +126,7 @@ namespace SIG.Web.Pages.Catalogos
|
||||
BindQuestionTypes();
|
||||
BindDocumentTypes();
|
||||
BindProducts();
|
||||
CargarUnidadesMedida();
|
||||
LoadProcedure();
|
||||
BindQuestions();
|
||||
BindDocuments();
|
||||
@@ -681,6 +698,7 @@ namespace SIG.Web.Pages.Catalogos
|
||||
LitPaymentDetailModalTitle.Text =
|
||||
"Agregar producto o servicio";
|
||||
DdlProductService.SelectedIndex = 0;
|
||||
DdlUnidadMedidaDetallePago.SelectedIndex = 0;
|
||||
TxtPaymentDetailQuantity.Text = "1";
|
||||
UpPaymentDetailModal.Update();
|
||||
Show("ModalPaymentDetail");
|
||||
@@ -714,31 +732,41 @@ namespace SIG.Web.Pages.Catalogos
|
||||
protected void BtnSavePaymentDetail_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetActiveTab(2);
|
||||
int productId;
|
||||
decimal quantity;
|
||||
if (!int.TryParse(DdlProductService.SelectedValue, out productId) ||
|
||||
productId <= 0 ||
|
||||
!TryParseDecimal(TxtPaymentDetailQuantity.Text, out quantity) ||
|
||||
quantity <= 0)
|
||||
int cveProductoServicio;
|
||||
int cveUnidadMedida;
|
||||
decimal cantidad;
|
||||
if (!int.TryParse(
|
||||
DdlProductService.SelectedValue,
|
||||
out cveProductoServicio) ||
|
||||
cveProductoServicio <= 0 ||
|
||||
!int.TryParse(
|
||||
DdlUnidadMedidaDetallePago.SelectedValue,
|
||||
out cveUnidadMedida) ||
|
||||
cveUnidadMedida <= 0 ||
|
||||
!TryParseDecimal(
|
||||
TxtPaymentDetailQuantity.Text,
|
||||
out cantidad) ||
|
||||
cantidad <= 0)
|
||||
{
|
||||
Alert(
|
||||
"Seleccione un producto o servicio y capture una cantidad mayor que cero.",
|
||||
"Seleccione el producto o servicio, la unidad de medida y capture una cantidad mayor que cero.",
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
Show("ModalPaymentDetail");
|
||||
return;
|
||||
}
|
||||
|
||||
var model = new TramitePagoDetalleModel
|
||||
var detallePago = new TramitePagoDetalleModel
|
||||
{
|
||||
CveTramitePagoDetalle = CveTramitePagoDetalleActual,
|
||||
CveTramitePago = CveTramitePagoSeleccionado,
|
||||
CvePS = productId,
|
||||
Cantidad = decimal.Round(quantity, 4)
|
||||
CvePS = cveProductoServicio,
|
||||
CveUM = cveUnidadMedida,
|
||||
Cantidad = decimal.Round(cantidad, 4)
|
||||
};
|
||||
|
||||
DbResult<int> result =
|
||||
AppServices.TramiteCatalogService.SavePagoDetalle(
|
||||
model,
|
||||
detallePago,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
@@ -758,6 +786,46 @@ namespace SIG.Web.Pages.Catalogos
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
protected void DdlProductoServicio_SelectedIndexChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
SetActiveTab(2);
|
||||
int cveProductoServicio;
|
||||
|
||||
if (!int.TryParse(
|
||||
DdlProductService.SelectedValue,
|
||||
out cveProductoServicio) ||
|
||||
cveProductoServicio <= 0)
|
||||
{
|
||||
DdlUnidadMedidaDetallePago.SelectedIndex = 0;
|
||||
UpPaymentDetailModal.Update();
|
||||
Show("ModalPaymentDetail");
|
||||
return;
|
||||
}
|
||||
|
||||
ProductoServicioTramiteModel productoServicio =
|
||||
ProductosServiciosDisponibles.FirstOrDefault(
|
||||
producto =>
|
||||
producto.CvePS == cveProductoServicio);
|
||||
|
||||
if (productoServicio == null ||
|
||||
productoServicio.CveUnidadMedida <= 0)
|
||||
{
|
||||
DdlUnidadMedidaDetallePago.SelectedIndex = 0;
|
||||
UpPaymentDetailModal.Update();
|
||||
Show("ModalPaymentDetail");
|
||||
return;
|
||||
}
|
||||
|
||||
SelectDropDownValue(
|
||||
DdlUnidadMedidaDetallePago,
|
||||
productoServicio.CveUnidadMedida);
|
||||
|
||||
UpPaymentDetailModal.Update();
|
||||
Show("ModalPaymentDetail");
|
||||
}
|
||||
|
||||
protected void BtnSaveGlobalPrice_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetActiveTab(2);
|
||||
@@ -896,14 +964,59 @@ namespace SIG.Web.Pages.Catalogos
|
||||
return;
|
||||
}
|
||||
|
||||
List<ProductoServicioTramiteModel> productos =
|
||||
result.Data ?? new List<ProductoServicioTramiteModel>();
|
||||
ProductosServiciosDisponibles = productos;
|
||||
|
||||
BindDropDown(
|
||||
DdlProductService,
|
||||
result.Data,
|
||||
productos,
|
||||
"ProductoDisplay",
|
||||
"CvePS",
|
||||
"Seleccione un producto o servicio");
|
||||
}
|
||||
|
||||
private void CargarUnidadesMedida()
|
||||
{
|
||||
DbResult<List<UnidadMedidaModel>> result =
|
||||
AppServices.ProductoCatalogService.ListUnidadesMedida(
|
||||
null,
|
||||
true,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
return;
|
||||
}
|
||||
|
||||
DdlUnidadMedidaDetallePago.Items.Clear();
|
||||
DdlUnidadMedidaDetallePago.Items.Add(
|
||||
new ListItem("Seleccione una unidad de medida", string.Empty));
|
||||
|
||||
foreach (UnidadMedidaModel unidadMedida in
|
||||
result.Data ?? new List<UnidadMedidaModel>())
|
||||
{
|
||||
string textoUnidadMedida =
|
||||
string.IsNullOrWhiteSpace(unidadMedida.Abreviatura)
|
||||
? unidadMedida.UnidadMedida
|
||||
: unidadMedida.UnidadMedida +
|
||||
" (" + unidadMedida.Abreviatura.Trim() + ")";
|
||||
|
||||
if (!unidadMedida.EsActivo)
|
||||
{
|
||||
textoUnidadMedida += " - Inactiva";
|
||||
}
|
||||
|
||||
DdlUnidadMedidaDetallePago.Items.Add(
|
||||
new ListItem(
|
||||
textoUnidadMedida,
|
||||
unidadMedida.CveUnidadMedida.ToString(
|
||||
CultureInfo.InvariantCulture)));
|
||||
}
|
||||
}
|
||||
|
||||
private void BindQuestions()
|
||||
{
|
||||
DbResult<List<PreguntaTramiteModel>> result =
|
||||
@@ -1306,6 +1419,9 @@ namespace SIG.Web.Pages.Catalogos
|
||||
CveTramitePagoDetalleActual = id;
|
||||
LitPaymentDetailModalTitle.Text = "Editar concepto de pago";
|
||||
SelectDropDownValue(DdlProductService, result.Data.CvePS);
|
||||
SelectDropDownValue(
|
||||
DdlUnidadMedidaDetallePago,
|
||||
result.Data.CveUM);
|
||||
TxtPaymentDetailQuantity.Text =
|
||||
result.Data.Cantidad.ToString(
|
||||
"0.####",
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class TipoTramiteDetalle
|
||||
{
|
||||
protected global::System.Web.UI.WebControls.HyperLink LnkBack;
|
||||
protected global::System.Web.UI.UpdatePanel UpSummary;
|
||||
protected global::System.Web.UI.WebControls.Literal LitProcedureName;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnEditProcedure;
|
||||
protected global::System.Web.UI.WebControls.Literal LitProcedureCode;
|
||||
protected global::System.Web.UI.WebControls.Literal LitProcedureType;
|
||||
protected global::System.Web.UI.WebControls.Literal LitProcedureStatus;
|
||||
protected global::System.Web.UI.WebControls.Literal LitProcedureDescription;
|
||||
protected global::System.Web.UI.UpdatePanel UpTabs;
|
||||
protected global::AjaxControlToolkit.TabContainer TabsProcedureDetail;
|
||||
protected global::AjaxControlToolkit.TabPanel TabQuestions;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNewQuestion;
|
||||
protected global::System.Web.UI.WebControls.GridView GvQuestions;
|
||||
protected global::System.Web.UI.WebControls.HiddenField HfQuestionOrderMove;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnQuestionOrderMove;
|
||||
protected global::System.Web.UI.WebControls.Panel PnlOptions;
|
||||
protected global::System.Web.UI.WebControls.Literal LitOptionsQuestionTitle;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnCloseOptions;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNewOption;
|
||||
protected global::System.Web.UI.WebControls.GridView GvOptions;
|
||||
protected global::System.Web.UI.WebControls.HiddenField HfOptionOrderMove;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnOptionOrderMove;
|
||||
protected global::AjaxControlToolkit.TabPanel TabDocuments;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNewDocument;
|
||||
protected global::System.Web.UI.WebControls.GridView GvDocuments;
|
||||
protected global::System.Web.UI.WebControls.HiddenField HfDocumentOrderMove;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnDocumentOrderMove;
|
||||
protected global::AjaxControlToolkit.TabPanel TabPayments;
|
||||
protected global::System.Web.UI.WebControls.Literal LitProcedurePaymentTotal;
|
||||
protected global::System.Web.UI.WebControls.Literal LitPaymentCount;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNewPayment;
|
||||
protected global::System.Web.UI.WebControls.GridView GvPayments;
|
||||
protected global::System.Web.UI.WebControls.Panel PnlPaymentDetail;
|
||||
protected global::System.Web.UI.WebControls.Literal LitPaymentDetailTitle;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnClosePaymentDetail;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNewPaymentDetail;
|
||||
protected global::System.Web.UI.WebControls.GridView GvPaymentDetails;
|
||||
protected global::System.Web.UI.WebControls.Literal LitSelectedPaymentTotal;
|
||||
protected global::System.Web.UI.UpdatePanel UpProcedureModal;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtProcedureCode;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtProcedureName;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtProcedureDescription;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkProcedureActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveProcedure;
|
||||
protected global::System.Web.UI.UpdatePanel UpQuestionModal;
|
||||
protected global::System.Web.UI.WebControls.Literal LitQuestionTitle;
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlQuestionType;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtQuestionCode;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtQuestion;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtQuestionDescription;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkQuestionRequired;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkQuestionActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveQuestion;
|
||||
protected global::System.Web.UI.UpdatePanel UpOptionModal;
|
||||
protected global::System.Web.UI.WebControls.Literal LitOptionTitle;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtOptionText;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtOptionValue;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkOptionActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveOption;
|
||||
protected global::System.Web.UI.UpdatePanel UpDocumentModal;
|
||||
protected global::System.Web.UI.WebControls.Literal LitDocumentTitle;
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlDocumentType;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkDocumentRequired;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkDocumentActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveDocument;
|
||||
protected global::System.Web.UI.UpdatePanel UpPaymentModal;
|
||||
protected global::System.Web.UI.WebControls.Literal LitPaymentTitle;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtPaymentName;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtPaymentNotes;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkPaymentRequired;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkPaymentActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSavePayment;
|
||||
protected global::System.Web.UI.UpdatePanel UpPaymentDetailModal;
|
||||
protected global::System.Web.UI.WebControls.Literal LitPaymentDetailModalTitle;
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlProductService;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtPaymentDetailQuantity;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSavePaymentDetail;
|
||||
protected global::System.Web.UI.UpdatePanel UpGlobalPriceModal;
|
||||
protected global::System.Web.UI.WebControls.Literal LitGlobalPriceProduct;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtGlobalPrice;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkConfirmGlobalPrice;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveGlobalPrice;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class TiposTramite
|
||||
{
|
||||
protected global::System.Web.UI.UpdatePanel UpActions;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNew;
|
||||
protected global::System.Web.UI.UpdatePanel UpCatalog;
|
||||
protected global::SIG.Web.AppCode.SigControls.Filtros UcFiltros;
|
||||
protected global::System.Web.UI.WebControls.GridView GvItems;
|
||||
protected global::System.Web.UI.WebControls.HiddenField HfOrderMove;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnOrderMove;
|
||||
protected global::System.Web.UI.UpdatePanel UpFilters;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtSearch;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkInactive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnApplyFilters;
|
||||
protected global::System.Web.UI.UpdatePanel UpEdit;
|
||||
protected global::System.Web.UI.WebControls.Literal LitModalTitle;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtCode;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtName;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtDescription;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSave;
|
||||
}
|
||||
}
|
||||
238
SIG.Web/Pages/Catalogos/UnidadesMedida.aspx
Normal file
238
SIG.Web/Pages/Catalogos/UnidadesMedida.aspx
Normal file
@@ -0,0 +1,238 @@
|
||||
<%@ Page Title="Unidades de medida"
|
||||
Language="C#"
|
||||
MasterPageFile="~/Site.master"
|
||||
AutoEventWireup="true"
|
||||
CodeFile="UnidadesMedida.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Catalogos.UnidadesMedida" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
<link href='<%= ResolveUrl("~/Styles/CatalogosTramites.css") %>'
|
||||
rel="stylesheet"
|
||||
type="text/css" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentActions" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpActions"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnNew"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnNew_Click">
|
||||
<i class="fa fa-plus"></i>
|
||||
Nueva unidad de medida
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNew" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalog"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<sig:Filtros ID="UcFiltros"
|
||||
runat="server"
|
||||
OnMostrarFiltros="UcFiltros_MostrarFiltros"
|
||||
OnFiltrosChanged="UcFiltros_FiltrosChanged"
|
||||
OnConsultar="UcFiltros_Consultar" />
|
||||
|
||||
<div class="tra-catalog-card">
|
||||
<asp:GridView ID="GvUnidadesMedida"
|
||||
runat="server"
|
||||
AutoGenerateColumns="false"
|
||||
DataKeyNames="CveUnidadMedida"
|
||||
GridLines="None"
|
||||
CssClass="table table-striped table-hover Widthall"
|
||||
EmptyDataText="No se encontraron unidades de medida para los filtros actuales."
|
||||
OnRowCommand="GvUnidadesMedida_RowCommand"
|
||||
OnRowDataBound="GvUnidadesMedida_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="UnidadMedida" HeaderText="Unidad de medida" />
|
||||
<asp:BoundField DataField="Abreviatura" HeaderText="Abreviatura" />
|
||||
<asp:CheckBoxField DataField="EsActivo" HeaderText="Activo" />
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnViewAudit"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm default"
|
||||
CommandName="VerBitacora"
|
||||
CommandArgument='<%# Eval("CveUnidadMedida") %>'
|
||||
CausesValidation="false"
|
||||
ToolTip="Ver bitácora"
|
||||
aria-label="Ver bitácora">
|
||||
<i class="fa fa-history" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnEdit"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm blue"
|
||||
CommandName="Editar"
|
||||
CommandArgument='<%# Eval("CveUnidadMedida") %>'
|
||||
CausesValidation="false"
|
||||
ToolTip="Editar"
|
||||
aria-label="Editar unidad de medida">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnDelete"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm red"
|
||||
CommandName="Eliminar"
|
||||
CommandArgument='<%# Eval("CveUnidadMedida") %>'
|
||||
CausesValidation="false"
|
||||
OnClientClick="return window.SIGAlerts.confirmPostBack(this, '¿Desea eliminar físicamente la unidad de medida?');"
|
||||
ToolTip="Eliminar"
|
||||
aria-label="Eliminar unidad de medida">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="Consultar" />
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="FiltrosChanged" />
|
||||
<asp:AsyncPostBackTrigger ControlID="UcFiltros" EventName="MostrarFiltros" />
|
||||
<asp:AsyncPostBackTrigger ControlID="GvUnidadesMedida" EventName="RowCommand" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<div id="ModalFilters" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpFilters"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">Filtros</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtSearch.ClientID %>">
|
||||
Unidad o abreviatura
|
||||
</label>
|
||||
<asp:TextBox ID="TxtSearch"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="100" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkInactive"
|
||||
runat="server"
|
||||
Text=" Incluir inactivas" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnApplyFilters"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
Text="Aplicar filtros"
|
||||
OnClick="BtnApplyFilters_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnApplyFilters"
|
||||
EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ModalEdit" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpEdit"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LitModalTitle" runat="server" />
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtMeasurementUnit.ClientID %>">
|
||||
Unidad de medida *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtMeasurementUnit"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="50" />
|
||||
</div>
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtAbbreviation.ClientID %>">
|
||||
Abreviatura *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtAbbreviation"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="15" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkActive"
|
||||
runat="server"
|
||||
Text=" Activa" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnSave"
|
||||
runat="server"
|
||||
CssClass="btn green"
|
||||
Text="Guardar"
|
||||
OnClick="BtnSave_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnSave" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<sig:BitacoraGrid ID="UcBitacoraCatalogo"
|
||||
runat="server"
|
||||
Titulo="Bitácora"
|
||||
Descripcion="Historial de unidades de medida"
|
||||
TextoVacio="No hay movimientos registrados para unidades de medida."
|
||||
RegistrosPorPagina="10"
|
||||
AccionTexto="Ver toda"
|
||||
OnAccionClick="UcBitacoraCatalogo_AccionClick" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<script src='<%= ResolveUrl("~/Scripts/CatalogosTramites.js") %>'
|
||||
type="text/javascript"></script>
|
||||
</asp:Content>
|
||||
399
SIG.Web/Pages/Catalogos/UnidadesMedida.aspx.cs
Normal file
399
SIG.Web/Pages/Catalogos/UnidadesMedida.aspx.cs
Normal file
@@ -0,0 +1,399 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using SIG.Web.AppCode.Configuration;
|
||||
using SIG.Web.AppCode.Infrastructure.WebForms;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
using SIG.Web.AppCode.Security;
|
||||
using SIG.Web.AppCode.SigControls;
|
||||
|
||||
namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class UnidadesMedida : ClsPaginaCatalogoInterno
|
||||
{
|
||||
private int CveUnidadMedidaActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveUnidadMedidaActual"] == null
|
||||
? 0
|
||||
: (int)ViewState["CveUnidadMedidaActual"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CveUnidadMedidaActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int CveUnidadMedidaBitacoraActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveUnidadMedidaBitacoraActual"] == null
|
||||
? 0
|
||||
: (int)ViewState["CveUnidadMedidaBitacoraActual"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CveUnidadMedidaBitacoraActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string NombreUnidadMedidaBitacoraActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToString(
|
||||
ViewState["NombreUnidadMedidaBitacoraActual"]);
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["NombreUnidadMedidaBitacoraActual"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (IsPostBack)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
BindBitacora();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void UcFiltros_MostrarFiltros(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
ShowModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void UcFiltros_Consultar(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void UcFiltros_FiltrosChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
List<string> names = UcFiltros.GetFiltros()
|
||||
.Select(item => item.Nombre)
|
||||
.ToList();
|
||||
|
||||
if (!names.Contains("Texto"))
|
||||
{
|
||||
TxtSearch.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (!names.Contains("Inactivos"))
|
||||
{
|
||||
ChkInactive.Checked = false;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
}
|
||||
|
||||
protected void BtnApplyFilters_Click(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void BtnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
CveUnidadMedidaActual = 0;
|
||||
LitModalTitle.Text = "Nueva unidad de medida";
|
||||
TxtMeasurementUnit.Text = string.Empty;
|
||||
TxtAbbreviation.Text = string.Empty;
|
||||
ChkActive.Checked = true;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
}
|
||||
|
||||
protected void GvUnidadesMedida_RowDataBound(
|
||||
object sender,
|
||||
GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType != DataControlRowType.DataRow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
|
||||
|
||||
if (scriptManager == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnViewAudit");
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnEdit");
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnDelete");
|
||||
}
|
||||
|
||||
protected void GvUnidadesMedida_RowCommand(
|
||||
object sender,
|
||||
GridViewCommandEventArgs e)
|
||||
{
|
||||
int cveUnidadMedida;
|
||||
|
||||
if (!int.TryParse(
|
||||
Convert.ToString(e.CommandArgument),
|
||||
out cveUnidadMedida))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.CommandName == "Editar")
|
||||
{
|
||||
LoadEdit(cveUnidadMedida);
|
||||
}
|
||||
else if (e.CommandName == "VerBitacora")
|
||||
{
|
||||
SelectBitacora(cveUnidadMedida);
|
||||
}
|
||||
else if (e.CommandName == "Eliminar")
|
||||
{
|
||||
Delete(cveUnidadMedida);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var unidadMedida = new UnidadMedidaModel
|
||||
{
|
||||
CveUnidadMedida = CveUnidadMedidaActual,
|
||||
UnidadMedida = TxtMeasurementUnit.Text,
|
||||
Abreviatura = TxtAbbreviation.Text,
|
||||
EsActivo = ChkActive.Checked
|
||||
};
|
||||
|
||||
DbResult<int> result =
|
||||
AppServices.ProductoCatalogService.SaveUnidadMedida(
|
||||
unidadMedida,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
ShowModal("ModalEdit");
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalEdit");
|
||||
Alert(
|
||||
"Unidad de medida guardada correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
protected void UcBitacoraCatalogo_AccionClick(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
CveUnidadMedidaBitacoraActual = 0;
|
||||
NombreUnidadMedidaBitacoraActual = string.Empty;
|
||||
BindBitacora();
|
||||
}
|
||||
|
||||
private void LoadEdit(int cveUnidadMedida)
|
||||
{
|
||||
DbResult<UnidadMedidaModel> result =
|
||||
AppServices.ProductoCatalogService.GetUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveUnidadMedidaActual = result.Data.CveUnidadMedida;
|
||||
LitModalTitle.Text = "Editar unidad de medida";
|
||||
TxtMeasurementUnit.Text = result.Data.UnidadMedida;
|
||||
TxtAbbreviation.Text = result.Data.Abreviatura;
|
||||
ChkActive.Checked = result.Data.EsActivo;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
}
|
||||
|
||||
private void SelectBitacora(int cveUnidadMedida)
|
||||
{
|
||||
DbResult<UnidadMedidaModel> result =
|
||||
AppServices.ProductoCatalogService.GetUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveUnidadMedidaBitacoraActual = cveUnidadMedida;
|
||||
NombreUnidadMedidaBitacoraActual = result.Data.UnidadMedida;
|
||||
BindBitacora();
|
||||
}
|
||||
|
||||
private void Delete(int cveUnidadMedida)
|
||||
{
|
||||
DbResult<bool> result =
|
||||
AppServices.ProductoCatalogService.DeleteUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CveUnidadMedidaBitacoraActual == cveUnidadMedida)
|
||||
{
|
||||
CveUnidadMedidaBitacoraActual = 0;
|
||||
NombreUnidadMedidaBitacoraActual = string.Empty;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
Alert(
|
||||
"Unidad de medida eliminada correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
DbResult<List<UnidadMedidaModel>> result =
|
||||
AppServices.ProductoCatalogService.ListUnidadesMedida(
|
||||
TxtSearch.Text,
|
||||
ChkInactive.Checked,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
return;
|
||||
}
|
||||
|
||||
GvUnidadesMedida.DataSource =
|
||||
result.Data ?? new List<UnidadMedidaModel>();
|
||||
GvUnidadesMedida.DataBind();
|
||||
}
|
||||
|
||||
private void BindBitacora()
|
||||
{
|
||||
bool hasMeasurementUnit = CveUnidadMedidaBitacoraActual > 0;
|
||||
|
||||
UcBitacoraCatalogo.Descripcion = hasMeasurementUnit
|
||||
? "Historial de " + NombreUnidadMedidaBitacoraActual
|
||||
: "Historial de unidades de medida";
|
||||
UcBitacoraCatalogo.AccionVisible = hasMeasurementUnit;
|
||||
UcBitacoraCatalogo.ConfigurarConsulta(
|
||||
new List<BitacoraCampoFiltroModel>
|
||||
{
|
||||
new BitacoraCampoFiltroModel
|
||||
{
|
||||
NombreTablaSQL = "UnidadesMedida",
|
||||
NombreCampoSQL = "CveUnidadMedida",
|
||||
Valor = hasMeasurementUnit
|
||||
? CveUnidadMedidaBitacoraActual.ToString(
|
||||
CultureInfo.InvariantCulture)
|
||||
: string.Empty,
|
||||
SoloExistencia = !hasMeasurementUnit
|
||||
}
|
||||
},
|
||||
new List<BitacoraRelacionMostrarModel>
|
||||
{
|
||||
new BitacoraRelacionMostrarModel
|
||||
{
|
||||
Orden = 1,
|
||||
NombreTablaSQL = "UnidadesMedida",
|
||||
NombreCampoMostrarSQL = "UnidadMedida"
|
||||
}
|
||||
});
|
||||
UcBitacoraCatalogo.Consultar(true);
|
||||
}
|
||||
|
||||
private void SyncFilters()
|
||||
{
|
||||
var filters = new List<FiltroActivo>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(TxtSearch.Text))
|
||||
{
|
||||
filters.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Texto",
|
||||
Titulo = "Búsqueda",
|
||||
Descripcion = TxtSearch.Text.Trim(),
|
||||
Orden = 1
|
||||
});
|
||||
}
|
||||
|
||||
if (ChkInactive.Checked)
|
||||
{
|
||||
filters.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Inactivos",
|
||||
Titulo = "Estado",
|
||||
Descripcion = "Incluye inactivas",
|
||||
Orden = 2
|
||||
});
|
||||
}
|
||||
|
||||
UcFiltros.SetFiltros(filters);
|
||||
}
|
||||
|
||||
private static void RegisterAsyncControl(
|
||||
ScriptManager scriptManager,
|
||||
GridViewRow row,
|
||||
string controlId)
|
||||
{
|
||||
Control control = row.FindControl(controlId);
|
||||
|
||||
if (control != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(control);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowModal(string id)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.show('" + id + "');",
|
||||
"Show_" + id);
|
||||
}
|
||||
|
||||
private void HideModal(string id)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.hide('" + id + "');",
|
||||
"Hide_" + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class TiposDocumento
|
||||
public partial class UnidadesMedida
|
||||
{
|
||||
protected global::System.Web.UI.UpdatePanel UpActions;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNew;
|
||||
protected global::System.Web.UI.UpdatePanel UpCatalog;
|
||||
protected global::SIG.Web.AppCode.SigControls.Filtros UcFiltros;
|
||||
protected global::System.Web.UI.WebControls.GridView GvItems;
|
||||
protected global::System.Web.UI.WebControls.GridView GvUnidadesMedida;
|
||||
protected global::System.Web.UI.UpdatePanel UpFilters;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtSearch;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkInactive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnApplyFilters;
|
||||
protected global::System.Web.UI.UpdatePanel UpEdit;
|
||||
protected global::System.Web.UI.WebControls.Literal LitModalTitle;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtName;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtDescription;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtExtensions;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtMaxMb;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtMeasurementUnit;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtAbbreviation;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSave;
|
||||
protected global::SIG.Web.AppCode.SigControls.BitacoraGrid
|
||||
UcBitacoraCatalogo;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,15 @@
|
||||
Volver al catálogo
|
||||
</asp:HyperLink>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnAddProcedure"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnAddProcedure_Click">
|
||||
<i class="fa fa-plus-circle"></i>
|
||||
Agregar trámite
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnEditStageProgress"
|
||||
runat="server"
|
||||
@@ -639,12 +648,158 @@
|
||||
<HeaderTemplate>
|
||||
<i class="fa fa-credit-card"></i>
|
||||
Pagos
|
||||
<span class="badge">
|
||||
<asp:Literal ID="LitCantidadPagos" runat="server" />
|
||||
</span>
|
||||
</HeaderTemplate>
|
||||
<ContentTemplate>
|
||||
<div class="fraction-empty-panel">
|
||||
<i class="fa fa-credit-card"></i>
|
||||
<p>No hay pagos registrados.</p>
|
||||
</div>
|
||||
<section class="fraction-content-card">
|
||||
<div class="fraction-card-heading">
|
||||
<div>
|
||||
<h3>Pagos pendientes</h3>
|
||||
<p>Pagos configurados para los trámites del fraccionamiento que todavía no tienen una venta relacionada.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fraction-table-scroll">
|
||||
<asp:GridView ID="GvPagosPendientes"
|
||||
runat="server"
|
||||
AutoGenerateColumns="false"
|
||||
GridLines="None"
|
||||
CssClass="table table-striped table-hover Widthall">
|
||||
<Columns>
|
||||
<asp:BoundField
|
||||
DataField="FolioSolicitud"
|
||||
HeaderText="Solicitud" />
|
||||
<asp:BoundField
|
||||
DataField="Etapa"
|
||||
HeaderText="Etapa" />
|
||||
<asp:BoundField
|
||||
DataField="TipoTramite"
|
||||
HeaderText="Trámite" />
|
||||
<asp:BoundField
|
||||
DataField="NombrePago"
|
||||
HeaderText="Pago" />
|
||||
<asp:BoundField
|
||||
DataField="NumeroConceptos"
|
||||
HeaderText="Conceptos" />
|
||||
<asp:BoundField
|
||||
DataField="SubTotal"
|
||||
HeaderText="Subtotal"
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:BoundField
|
||||
DataField="IVA"
|
||||
HeaderText="IVA"
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:BoundField
|
||||
DataField="Total"
|
||||
HeaderText="Total"
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink ID="LnkGenerar"
|
||||
runat="server"
|
||||
CssClass="btn btn-xs blue"
|
||||
Visible='<%# !ConvertToBoolean(Eval("VentaGenerada")) %>'
|
||||
NavigateUrl='<%# GetVentaTramiteUrl(Eval("CveSolicitud"), Eval("CveTramitePago")) %>'>
|
||||
<i class="fa fa-file-text-o"></i>
|
||||
Generar
|
||||
</asp:HyperLink>
|
||||
|
||||
<asp:HyperLink ID="LnkPagar"
|
||||
runat="server"
|
||||
CssClass="btn btn-xs green"
|
||||
Visible='<%# ConvertToBoolean(Eval("VentaGenerada")) %>'
|
||||
NavigateUrl='<%# GetVentaTramiteUrl(Eval("CveSolicitud"), Eval("CveTramitePago")) %>'>
|
||||
<i class="fa fa-credit-card"></i>
|
||||
Pagar
|
||||
</asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
<EmptyDataTemplate>
|
||||
<div class="fraction-empty-state">
|
||||
<span class="fraction-empty-icon">
|
||||
<i class="fa fa-check-circle"></i>
|
||||
</span>
|
||||
<span>No hay pagos pendientes.</span>
|
||||
</div>
|
||||
</EmptyDataTemplate>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="fraction-content-card">
|
||||
<div class="fraction-card-heading">
|
||||
<div>
|
||||
<h3>Pagos realizados</h3>
|
||||
<p>Ventas relacionadas de forma explícita con una solicitud y su grupo de pago.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fraction-table-scroll">
|
||||
<asp:GridView ID="GvPagosRealizados"
|
||||
runat="server"
|
||||
AutoGenerateColumns="false"
|
||||
GridLines="None"
|
||||
CssClass="table table-striped table-hover Widthall">
|
||||
<Columns>
|
||||
<asp:BoundField
|
||||
DataField="SerieFolio"
|
||||
HeaderText="Venta" />
|
||||
<asp:BoundField
|
||||
DataField="FechaPago"
|
||||
HeaderText="Fecha"
|
||||
DataFormatString="{0:dd/MM/yyyy HH:mm}" />
|
||||
<asp:BoundField
|
||||
DataField="FolioSolicitud"
|
||||
HeaderText="Solicitud" />
|
||||
<asp:BoundField
|
||||
DataField="Etapa"
|
||||
HeaderText="Etapa" />
|
||||
<asp:BoundField
|
||||
DataField="TipoTramite"
|
||||
HeaderText="Trámite" />
|
||||
<asp:BoundField
|
||||
DataField="NombrePago"
|
||||
HeaderText="Pago" />
|
||||
<asp:BoundField
|
||||
DataField="SubTotal"
|
||||
HeaderText="Subtotal"
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:BoundField
|
||||
DataField="IVA"
|
||||
HeaderText="IVA"
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:BoundField
|
||||
DataField="Total"
|
||||
HeaderText="Total"
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:TemplateField HeaderText="Autorización">
|
||||
<ItemTemplate>
|
||||
<asp:Label runat="server"
|
||||
CssClass='<%# Convert.ToBoolean(Eval("Autorizado")) ? "label label-success" : "label label-warning" %>'
|
||||
Text='<%# Convert.ToBoolean(Eval("Autorizado")) ? "Autorizado" : "Pendiente" %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
<EmptyDataTemplate>
|
||||
<div class="fraction-empty-state">
|
||||
<span class="fraction-empty-icon">
|
||||
<i class="fa fa-credit-card"></i>
|
||||
</span>
|
||||
<span>No hay ventas relacionadas con pagos de trámites.</span>
|
||||
</div>
|
||||
</EmptyDataTemplate>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</section>
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
|
||||
@@ -809,6 +964,86 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div id="ModalAddProcedure"
|
||||
class="modal fade fraction-modal"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpAddProcedureModal"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">
|
||||
<i class="fa fa-plus-circle"></i>
|
||||
Agregar trámite
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<asp:Label ID="LblAddProcedureMessage"
|
||||
runat="server"
|
||||
CssClass="alert alert-danger"
|
||||
Visible="false" />
|
||||
|
||||
<div class="form-group">
|
||||
<label>Etapa</label>
|
||||
<asp:DropDownList ID="DdlAddProcedureStage"
|
||||
runat="server"
|
||||
CssClass="form-control select2me Widthall"
|
||||
Style="width:100%;"
|
||||
AutoPostBack="true"
|
||||
OnSelectedIndexChanged="DdlAddProcedureStage_SelectedIndexChanged" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tipo de trámite</label>
|
||||
<asp:DropDownList ID="DdlAddProcedureType"
|
||||
runat="server"
|
||||
CssClass="form-control select2me Widthall"
|
||||
Style="width:100%;" />
|
||||
<span class="help-block">
|
||||
Sólo se muestran los trámites que todavía no tienen una solicitud en la etapa seleccionada.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnSaveAddProcedure"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
Text="Agregar trámite"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnSaveAddProcedure_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger
|
||||
ControlID="DdlAddProcedureStage"
|
||||
EventName="SelectedIndexChanged" />
|
||||
<asp:AsyncPostBackTrigger
|
||||
ControlID="BtnSaveAddProcedure"
|
||||
EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ModalProcedureFilters"
|
||||
class="modal fade fraction-modal"
|
||||
tabindex="-1"
|
||||
@@ -1056,7 +1291,7 @@
|
||||
Titulo="Bitácora"
|
||||
Descripcion="Historial del fraccionamiento, sus etapas, lotes, trámites y documentos"
|
||||
TextoVacio="No hay movimientos registrados para este fraccionamiento."
|
||||
RegistrosPorPagina="20"
|
||||
RegistrosPorPagina="10"
|
||||
ScrollsParaCambiarPagina="3" />
|
||||
|
||||
<div id="ModalEditDevelopment"
|
||||
|
||||
@@ -11,6 +11,7 @@ using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Documentos;
|
||||
using SIG.Web.AppCode.Models.Fraccionamientos;
|
||||
using SIG.Web.AppCode.Models.Tramites;
|
||||
using SIG.Web.AppCode.Models.Ventas;
|
||||
using SIG.Web.AppCode.Security;
|
||||
using SIG.Web.AppCode.Session;
|
||||
using SIG.Web.AppCode.SigControls;
|
||||
@@ -247,6 +248,8 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(
|
||||
BtnEditStageProgress);
|
||||
scriptManager.RegisterAsyncPostBackControl(
|
||||
BtnAddProcedure);
|
||||
}
|
||||
|
||||
if (IsPostBack)
|
||||
@@ -373,6 +376,83 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
ShowStageModal();
|
||||
}
|
||||
|
||||
protected void BtnAddProcedure_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
BindAddProcedureStageOptions();
|
||||
BindAddProcedureTypeOptions();
|
||||
HideAddProcedureMessage();
|
||||
UpAddProcedureModal.Update();
|
||||
ShowAddProcedureModal();
|
||||
}
|
||||
|
||||
protected void DdlAddProcedureStage_SelectedIndexChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
BindAddProcedureTypeOptions();
|
||||
HideAddProcedureMessage();
|
||||
UpAddProcedureModal.Update();
|
||||
ShowAddProcedureModal();
|
||||
}
|
||||
|
||||
protected void BtnSaveAddProcedure_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
int stageId;
|
||||
int procedureTypeId;
|
||||
|
||||
if (!int.TryParse(
|
||||
DdlAddProcedureStage.SelectedValue,
|
||||
out stageId) ||
|
||||
stageId <= 0)
|
||||
{
|
||||
ShowAddProcedureValidation(
|
||||
"Seleccione una etapa válida.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(
|
||||
DdlAddProcedureType.SelectedValue,
|
||||
out procedureTypeId) ||
|
||||
procedureTypeId <= 0)
|
||||
{
|
||||
ShowAddProcedureValidation(
|
||||
"Seleccione un tipo de trámite válido.");
|
||||
return;
|
||||
}
|
||||
|
||||
DbResult<TramiteSolicitudCreateResultModel> result =
|
||||
AppServices.TramiteSolicitudService.AddStageRequest(
|
||||
CveFraccionamientoActual,
|
||||
stageId,
|
||||
procedureTypeId,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
{
|
||||
ShowAddProcedureValidation(result.UserMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
BindProcedures();
|
||||
BindDocuments();
|
||||
RefreshBitacoraDetalle();
|
||||
UpDetailTabs.Update();
|
||||
HideAddProcedureModal();
|
||||
|
||||
Alert(
|
||||
result.Data.EsNuevo
|
||||
? "Trámite agregado correctamente."
|
||||
: "El trámite ya se encontraba registrado para la etapa.",
|
||||
result.Data.EsNuevo
|
||||
? TipoMensaje.ToastExito
|
||||
: TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
|
||||
protected void UcProcedureFilters_MostrarFiltrosClick(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
@@ -1782,14 +1862,7 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
Orden = 2,
|
||||
NombreTablaSQL = "FraccionamientosEtapas",
|
||||
NombreCampoMostrarSQL = "Etapa"
|
||||
},
|
||||
new BitacoraRelacionMostrarModel
|
||||
{
|
||||
Orden = 3,
|
||||
NombreTablaSQL = "Tra_Solicitudes",
|
||||
NombreCampoMostrarSQL = "Folio"
|
||||
}
|
||||
});
|
||||
} });
|
||||
|
||||
UcBitacoraDetalle.Consultar(true);
|
||||
}
|
||||
@@ -2026,6 +2099,7 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
BindProcedureStatusOptions();
|
||||
BindDocumentProcedureTypeOptions();
|
||||
BindProcedures();
|
||||
BindPagos();
|
||||
BindDocuments();
|
||||
}
|
||||
|
||||
@@ -2110,6 +2184,47 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
private void BindPagos()
|
||||
{
|
||||
DbResult<List<ModeloPagoPendienteFraccionamiento>> resultadoPendientes =
|
||||
AppServices.ServicioVentaTramite.ListarPagosPendientes(
|
||||
CveFraccionamientoActual,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
DbResult<List<ModeloPagoRealizadoFraccionamiento>> resultadoRealizados =
|
||||
AppServices.ServicioVentaTramite.ListarPagosRealizados(
|
||||
CveFraccionamientoActual,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!resultadoPendientes.Success || !resultadoRealizados.Success)
|
||||
{
|
||||
Alert(
|
||||
!resultadoPendientes.Success
|
||||
? resultadoPendientes.UserMessage
|
||||
: resultadoRealizados.UserMessage,
|
||||
TipoMensaje.MsgError);
|
||||
return;
|
||||
}
|
||||
|
||||
List<ModeloPagoPendienteFraccionamiento> pagosPendientes =
|
||||
resultadoPendientes.Data ??
|
||||
new List<ModeloPagoPendienteFraccionamiento>();
|
||||
List<ModeloPagoRealizadoFraccionamiento> pagosRealizados =
|
||||
resultadoRealizados.Data ??
|
||||
new List<ModeloPagoRealizadoFraccionamiento>();
|
||||
|
||||
GvPagosPendientes.DataSource = pagosPendientes;
|
||||
GvPagosPendientes.DataBind();
|
||||
GvPagosRealizados.DataSource = pagosRealizados;
|
||||
GvPagosRealizados.DataBind();
|
||||
|
||||
LitCantidadPagos.Text =
|
||||
(pagosPendientes.Count + pagosRealizados.Count).ToString(
|
||||
CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
private void SetDocumentFilter(
|
||||
string name,
|
||||
string title,
|
||||
@@ -2249,6 +2364,96 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
return control.SelectedItem.Text;
|
||||
}
|
||||
|
||||
private void BindAddProcedureStageOptions()
|
||||
{
|
||||
DbResult<List<FraccionamientoEtapaModel>> result =
|
||||
AppServices.FraccionamientoService.ListStages(
|
||||
CveFraccionamientoActual,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
ShowAddProcedureValidation(result.UserMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
string selectedValue =
|
||||
DdlAddProcedureStage.SelectedValue;
|
||||
|
||||
DdlAddProcedureStage.DataSource =
|
||||
(result.Data ?? new List<FraccionamientoEtapaModel>())
|
||||
.Where(item => item.EsActivo)
|
||||
.ToList();
|
||||
DdlAddProcedureStage.DataTextField = "Etapa";
|
||||
DdlAddProcedureStage.DataValueField =
|
||||
"CveFraccionamientoEtapa";
|
||||
DdlAddProcedureStage.DataBind();
|
||||
DdlAddProcedureStage.Items.Insert(
|
||||
0,
|
||||
new ListItem(
|
||||
"Seleccione una etapa",
|
||||
string.Empty));
|
||||
|
||||
RestoreSelectedValue(
|
||||
DdlAddProcedureStage,
|
||||
selectedValue);
|
||||
}
|
||||
|
||||
private void BindAddProcedureTypeOptions()
|
||||
{
|
||||
DdlAddProcedureType.Items.Clear();
|
||||
DdlAddProcedureType.Items.Add(
|
||||
new ListItem(
|
||||
"Seleccione un tipo de trámite",
|
||||
string.Empty));
|
||||
|
||||
int stageId;
|
||||
|
||||
if (!int.TryParse(
|
||||
DdlAddProcedureStage.SelectedValue,
|
||||
out stageId) ||
|
||||
stageId <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DbResult<List<TramiteSolicitudTipoOptionModel>> result =
|
||||
AppServices.TramiteSolicitudService
|
||||
.ListAvailableTypesForStage(
|
||||
CveFraccionamientoActual,
|
||||
stageId,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
ShowAddProcedureValidation(result.UserMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
List<TramiteSolicitudTipoOptionModel> types =
|
||||
result.Data ??
|
||||
new List<TramiteSolicitudTipoOptionModel>();
|
||||
|
||||
foreach (TramiteSolicitudTipoOptionModel item in types)
|
||||
{
|
||||
DdlAddProcedureType.Items.Add(
|
||||
new ListItem(
|
||||
item.TipoTramite,
|
||||
item.CveTipoTramite.ToString(
|
||||
CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
BtnSaveAddProcedure.Enabled = types.Count > 0;
|
||||
|
||||
if (types.Count == 0)
|
||||
{
|
||||
ShowAddProcedureValidation(
|
||||
"La etapa seleccionada ya tiene solicitud para todos los trámites activos.");
|
||||
}
|
||||
}
|
||||
|
||||
private void BindProcedureStageOptions(
|
||||
IList<FraccionamientoEtapaModel> stages)
|
||||
{
|
||||
@@ -2991,6 +3196,36 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
LblDocumentRejectMessage.Text = string.Empty;
|
||||
}
|
||||
|
||||
private void ShowAddProcedureValidation(
|
||||
string message)
|
||||
{
|
||||
LblAddProcedureMessage.Text = Server.HtmlEncode(
|
||||
message ?? string.Empty);
|
||||
LblAddProcedureMessage.Visible = true;
|
||||
UpAddProcedureModal.Update();
|
||||
ShowAddProcedureModal();
|
||||
}
|
||||
|
||||
private void HideAddProcedureMessage()
|
||||
{
|
||||
LblAddProcedureMessage.Visible = false;
|
||||
LblAddProcedureMessage.Text = string.Empty;
|
||||
}
|
||||
|
||||
private void ShowAddProcedureModal()
|
||||
{
|
||||
RegistraScript(
|
||||
"$('#ModalAddProcedure').modal('show');",
|
||||
"AddProcedureModal");
|
||||
}
|
||||
|
||||
private void HideAddProcedureModal()
|
||||
{
|
||||
RegistraScript(
|
||||
"$('#ModalAddProcedure').modal('hide');",
|
||||
"AddProcedureModalHide");
|
||||
}
|
||||
|
||||
private void ShowProcedureFiltersModal()
|
||||
{
|
||||
RegistraScript(
|
||||
@@ -3055,6 +3290,33 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
return Server.HtmlEncode(GetDisplayValue(value));
|
||||
}
|
||||
|
||||
protected string GetVentaTramiteUrl(
|
||||
object cveSolicitudValue,
|
||||
object cveTramitePagoValue)
|
||||
{
|
||||
int cveSolicitud;
|
||||
int cveTramitePago;
|
||||
|
||||
if (!int.TryParse(
|
||||
Convert.ToString(cveSolicitudValue),
|
||||
out cveSolicitud) ||
|
||||
!int.TryParse(
|
||||
Convert.ToString(cveTramitePagoValue),
|
||||
out cveTramitePago) ||
|
||||
cveSolicitud <= 0 ||
|
||||
cveTramitePago <= 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return ResolveUrl(
|
||||
"~/Pages/Ventas/VentaTramite.aspx" +
|
||||
"?cveSolicitud=" +
|
||||
cveSolicitud.ToString(CultureInfo.InvariantCulture) +
|
||||
"&cveTramitePago=" +
|
||||
cveTramitePago.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
private static string GetDisplayValue(string value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value)
|
||||
|
||||
@@ -1,923 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SIG.Web.Pages.Fraccionamientos
|
||||
{
|
||||
|
||||
|
||||
public partial class FraccionamientoDetalle
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// LnkBack control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HyperLink LnkBack;
|
||||
|
||||
/// <summary>
|
||||
/// BtnEditStageProgress control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnEditStageProgress;
|
||||
|
||||
/// <summary>
|
||||
/// UpSummary control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel UpSummary;
|
||||
|
||||
/// <summary>
|
||||
/// LitDevelopmentName control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitDevelopmentName;
|
||||
|
||||
/// <summary>
|
||||
/// LblDevelopmentActive control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LblDevelopmentActive;
|
||||
|
||||
/// <summary>
|
||||
/// BtnDelete control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// LitSummaryClient control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitSummaryClient;
|
||||
|
||||
/// <summary>
|
||||
/// LitSummaryHectares control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitSummaryHectares;
|
||||
|
||||
/// <summary>
|
||||
/// LitSummaryLocation control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitSummaryLocation;
|
||||
|
||||
/// <summary>
|
||||
/// LitSummaryOpeningDate control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitSummaryOpeningDate;
|
||||
|
||||
/// <summary>
|
||||
/// LitSummaryGlobalProgress control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitSummaryGlobalProgress;
|
||||
|
||||
/// <summary>
|
||||
/// PnlSummaryGlobalProgressBar control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Panel PnlSummaryGlobalProgressBar;
|
||||
|
||||
/// <summary>
|
||||
/// LblSummaryStatus control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LblSummaryStatus;
|
||||
|
||||
/// <summary>
|
||||
/// UpDetailTabs control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel UpDetailTabs;
|
||||
|
||||
/// <summary>
|
||||
/// TabsFractionDetail control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.TabContainer TabsFractionDetail;
|
||||
|
||||
/// <summary>
|
||||
/// TabStages control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.TabPanel TabStages;
|
||||
|
||||
/// <summary>
|
||||
/// LitStageCount control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitStageCount;
|
||||
|
||||
/// <summary>
|
||||
/// BtnNewStage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNewStage;
|
||||
|
||||
/// <summary>
|
||||
/// GvStages control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView GvStages;
|
||||
|
||||
/// <summary>
|
||||
/// HfStageOrderMove control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField HfStageOrderMove;
|
||||
|
||||
/// <summary>
|
||||
/// BtnStageOrderMove control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnStageOrderMove;
|
||||
|
||||
/// <summary>
|
||||
/// GvProcedures control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView GvProcedures;
|
||||
|
||||
/// <summary>
|
||||
/// TabLots control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.TabPanel TabLots;
|
||||
|
||||
/// <summary>
|
||||
/// LitLotCount control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitLotCount;
|
||||
|
||||
/// <summary>
|
||||
/// DdlLotsStage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlLotsStage;
|
||||
|
||||
/// <summary>
|
||||
/// BtnClearStageLots control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnClearStageLots;
|
||||
|
||||
/// <summary>
|
||||
/// PnlLotsStageRequired control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Panel PnlLotsStageRequired;
|
||||
|
||||
/// <summary>
|
||||
/// PnlLotsStageContext control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Panel PnlLotsStageContext;
|
||||
|
||||
/// <summary>
|
||||
/// LitLotsSelectedStage control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitLotsSelectedStage;
|
||||
|
||||
/// <summary>
|
||||
/// LitLotsSelectedStageProgress control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitLotsSelectedStageProgress;
|
||||
|
||||
/// <summary>
|
||||
/// PnlLotsSelectedStageProgressBar control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Panel PnlLotsSelectedStageProgressBar;
|
||||
|
||||
/// <summary>
|
||||
/// PhStageGisMissing control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.PlaceHolder PhStageGisMissing;
|
||||
|
||||
/// <summary>
|
||||
/// BtnAddStageGis control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnAddStageGis;
|
||||
|
||||
/// <summary>
|
||||
/// PhStageGisExistingActions control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.PlaceHolder PhStageGisExistingActions;
|
||||
|
||||
/// <summary>
|
||||
/// BtnManageStageGis control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnManageStageGis;
|
||||
|
||||
/// <summary>
|
||||
/// PnlStageGisExisting control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Panel PnlStageGisExisting;
|
||||
|
||||
/// <summary>
|
||||
/// LitStageGisName control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitStageGisName;
|
||||
|
||||
/// <summary>
|
||||
/// LitStageGisUpdatedAt control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitStageGisUpdatedAt;
|
||||
|
||||
/// <summary>
|
||||
/// LnkStageGisOpen control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.HyperLink LnkStageGisOpen;
|
||||
|
||||
/// <summary>
|
||||
/// GvLots control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView GvLots;
|
||||
|
||||
/// <summary>
|
||||
/// TabProcedures control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.TabPanel TabProcedures;
|
||||
|
||||
/// <summary>
|
||||
/// LitProcedureCount control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitProcedureCount;
|
||||
|
||||
/// <summary>
|
||||
/// UcProcedureFilters control.
|
||||
/// </summary>
|
||||
protected global::SIG.Web.AppCode.SigControls.Filtros UcProcedureFilters;
|
||||
|
||||
/// <summary>
|
||||
/// UpProcedureFiltersModal control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.UpdatePanel UpProcedureFiltersModal;
|
||||
|
||||
/// <summary>
|
||||
/// DdlProcedureStatus control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlProcedureStatus;
|
||||
|
||||
/// <summary>
|
||||
/// DdlProcedureType control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlProcedureType;
|
||||
|
||||
/// <summary>
|
||||
/// DdlProcedureStage control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlProcedureStage;
|
||||
|
||||
/// <summary>
|
||||
/// BtnApplyProcedureFilters control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnApplyProcedureFilters;
|
||||
|
||||
/// <summary>
|
||||
/// TabPayments control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.TabPanel TabPayments;
|
||||
|
||||
/// <summary>
|
||||
/// TabDocuments control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.TabPanel TabDocuments;
|
||||
|
||||
/// <summary>
|
||||
/// LitDocumentCount control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitDocumentCount;
|
||||
|
||||
/// <summary>
|
||||
/// UcDocumentFilters control.
|
||||
/// </summary>
|
||||
protected global::SIG.Web.AppCode.SigControls.Filtros UcDocumentFilters;
|
||||
|
||||
/// <summary>
|
||||
/// GvDocuments control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.GridView GvDocuments;
|
||||
|
||||
/// <summary>
|
||||
/// UpDocumentFiltersModal control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.UpdatePanel UpDocumentFiltersModal;
|
||||
|
||||
/// <summary>
|
||||
/// DdlDocumentProcedureType control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlDocumentProcedureType;
|
||||
|
||||
/// <summary>
|
||||
/// DdlDocumentStage control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlDocumentStage;
|
||||
|
||||
/// <summary>
|
||||
/// BtnApplyDocumentFilters control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnApplyDocumentFilters;
|
||||
|
||||
/// <summary>
|
||||
/// UpDocumentUploadModal control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.UpdatePanel UpDocumentUploadModal;
|
||||
|
||||
/// <summary>
|
||||
/// LitDocumentUploadTitle control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitDocumentUploadTitle;
|
||||
|
||||
/// <summary>
|
||||
/// LblDocumentUploadMessage control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Label LblDocumentUploadMessage;
|
||||
|
||||
/// <summary>
|
||||
/// LitDocumentUploadType control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitDocumentUploadType;
|
||||
|
||||
/// <summary>
|
||||
/// LitDocumentUploadContext control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitDocumentUploadContext;
|
||||
|
||||
/// <summary>
|
||||
/// FuDocument control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.FileUpload FuDocument;
|
||||
|
||||
/// <summary>
|
||||
/// LitDocumentUploadRules control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitDocumentUploadRules;
|
||||
|
||||
/// <summary>
|
||||
/// TxtDocumentClientComment control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtDocumentClientComment;
|
||||
|
||||
/// <summary>
|
||||
/// BtnSaveDocumentUpload control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveDocumentUpload;
|
||||
|
||||
/// <summary>
|
||||
/// UpDocumentRejectModal control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.UpdatePanel UpDocumentRejectModal;
|
||||
|
||||
/// <summary>
|
||||
/// LblDocumentRejectMessage control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Label LblDocumentRejectMessage;
|
||||
|
||||
/// <summary>
|
||||
/// TxtDocumentRejectNote control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtDocumentRejectNote;
|
||||
|
||||
/// <summary>
|
||||
/// BtnConfirmDocumentReject control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnConfirmDocumentReject;
|
||||
|
||||
/// <summary>
|
||||
/// TabNotes control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.TabPanel TabNotes;
|
||||
|
||||
/// <summary>
|
||||
/// UpDevelopmentModal control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel UpDevelopmentModal;
|
||||
|
||||
/// <summary>
|
||||
/// LblEditMessage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LblEditMessage;
|
||||
|
||||
/// <summary>
|
||||
/// DdlClient control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlClient;
|
||||
|
||||
/// <summary>
|
||||
/// TxtDevelopment control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtDevelopment;
|
||||
|
||||
/// <summary>
|
||||
/// TxtHectares control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtHectares;
|
||||
|
||||
/// <summary>
|
||||
/// DdlStatus control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlStatus;
|
||||
|
||||
/// <summary>
|
||||
/// TxtLocation control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtLocation;
|
||||
|
||||
/// <summary>
|
||||
/// ChkActive control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActive;
|
||||
|
||||
/// <summary>
|
||||
/// BtnSave control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button BtnSave;
|
||||
|
||||
/// <summary>
|
||||
/// UpStageModal control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel UpStageModal;
|
||||
|
||||
/// <summary>
|
||||
/// LitStageTitle control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitStageTitle;
|
||||
|
||||
/// <summary>
|
||||
/// LblStageMessage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LblStageMessage;
|
||||
|
||||
/// <summary>
|
||||
/// TxtStage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtStage;
|
||||
|
||||
/// <summary>
|
||||
/// TxtStageHectares control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtStageHectares;
|
||||
|
||||
/// <summary>
|
||||
/// ChkStageActive control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkStageActive;
|
||||
|
||||
/// <summary>
|
||||
/// BtnSaveStage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveStage;
|
||||
|
||||
/// <summary>
|
||||
/// UpStageProgressModal control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.UpdatePanel UpStageProgressModal;
|
||||
|
||||
/// <summary>
|
||||
/// LblStageProgressMessage control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Label LblStageProgressMessage;
|
||||
|
||||
/// <summary>
|
||||
/// DdlStageProgress control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlStageProgress;
|
||||
|
||||
/// <summary>
|
||||
/// PnlStageProgressCapture control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Panel PnlStageProgressCapture;
|
||||
|
||||
/// <summary>
|
||||
/// TxtStageProgress control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtStageProgress;
|
||||
|
||||
/// <summary>
|
||||
/// BtnSaveStageProgress control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveStageProgress;
|
||||
|
||||
/// <summary>
|
||||
/// UpProcedureStatusModal control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.UpdatePanel UpProcedureStatusModal;
|
||||
|
||||
/// <summary>
|
||||
/// LblProcedureStatusMessage control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Label LblProcedureStatusMessage;
|
||||
|
||||
/// <summary>
|
||||
/// LitProcedureStatusFolio control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitProcedureStatusFolio;
|
||||
|
||||
/// <summary>
|
||||
/// DdlProcedureNewStatus control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlProcedureNewStatus;
|
||||
|
||||
/// <summary>
|
||||
/// BtnSaveProcedureStatus control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveProcedureStatus;
|
||||
|
||||
/// <summary>
|
||||
/// UpStageGisModal control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.UpdatePanel UpStageGisModal;
|
||||
|
||||
/// <summary>
|
||||
/// LitStageGisModalTitle control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitStageGisModalTitle;
|
||||
|
||||
/// <summary>
|
||||
/// LblStageGisMessage control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Label LblStageGisMessage;
|
||||
|
||||
/// <summary>
|
||||
/// LitStageGisStageName control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Literal LitStageGisStageName;
|
||||
|
||||
/// <summary>
|
||||
/// HdStageGisId control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.HiddenField HdStageGisId;
|
||||
|
||||
/// <summary>
|
||||
/// BtnRefreshStageGis control.
|
||||
/// </summary>
|
||||
protected global::System.Web.UI.WebControls.Button BtnRefreshStageGis;
|
||||
|
||||
/// <summary>
|
||||
/// UpLotsModal control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel UpLotsModal;
|
||||
|
||||
/// <summary>
|
||||
/// LblLotMessage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LblLotMessage;
|
||||
|
||||
/// <summary>
|
||||
/// LitLotStageName control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitLotStageName;
|
||||
|
||||
/// <summary>
|
||||
/// TxtLotQuantity control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtLotQuantity;
|
||||
|
||||
/// <summary>
|
||||
/// TxtLotBaseName control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtLotBaseName;
|
||||
|
||||
/// <summary>
|
||||
/// ChkLotAddIdentifier control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkLotAddIdentifier;
|
||||
|
||||
/// <summary>
|
||||
/// TxtLotStartNumber control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtLotStartNumber;
|
||||
|
||||
/// <summary>
|
||||
/// LnkDownloadLotTemplate control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HyperLink LnkDownloadLotTemplate;
|
||||
|
||||
/// <summary>
|
||||
/// FileLots control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.FileUpload FileLots;
|
||||
|
||||
/// <summary>
|
||||
/// BtnImportLots control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button BtnImportLots;
|
||||
|
||||
/// <summary>
|
||||
/// BtnSaveLots control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveLots;
|
||||
|
||||
/// <summary>
|
||||
/// UpEditLotModal control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel UpEditLotModal;
|
||||
|
||||
/// <summary>
|
||||
/// LblEditLotMessage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LblEditLotMessage;
|
||||
|
||||
/// <summary>
|
||||
/// LitEditLotStage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal LitEditLotStage;
|
||||
|
||||
/// <summary>
|
||||
/// TxtEditLotName control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtEditLotName;
|
||||
|
||||
/// <summary>
|
||||
/// TxtEditLotType control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtEditLotType;
|
||||
|
||||
/// <summary>
|
||||
/// TxtEditLotStreet control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtEditLotStreet;
|
||||
|
||||
/// <summary>
|
||||
/// TxtEditLotCadastre control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtEditLotCadastre;
|
||||
|
||||
/// <summary>
|
||||
/// TxtEditLotSquareMeters control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtEditLotSquareMeters;
|
||||
|
||||
/// <summary>
|
||||
/// TxtEditLotDuplicate control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtEditLotDuplicate;
|
||||
|
||||
/// <summary>
|
||||
/// ChkEditLotActive control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkEditLotActive;
|
||||
|
||||
/// <summary>
|
||||
/// BtnSaveLot control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button BtnSaveLot;
|
||||
/// <summary>
|
||||
/// UcBitacoraDetalle control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::SIG.Web.AppCode.SigControls.BitacoraGrid UcBitacoraDetalle;
|
||||
}
|
||||
}
|
||||
272
SIG.Web/Pages/Security/Perfil.aspx
Normal file
272
SIG.Web/Pages/Security/Perfil.aspx
Normal file
@@ -0,0 +1,272 @@
|
||||
<%@ Page Title="Mi perfil" Language="C#" MasterPageFile="~/Site.master"
|
||||
AutoEventWireup="true" CodeFile="Perfil.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Security.Perfil" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
<style>
|
||||
.perfil-contenedor {
|
||||
background: #fff;
|
||||
border: 1px solid #e1e5ec;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.perfil-seccion {
|
||||
padding: 22px 10px 10px;
|
||||
}
|
||||
|
||||
.perfil-campo {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.perfil-campo label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.perfil-ayuda {
|
||||
color: #7f8c8d;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.perfil-fiscal {
|
||||
border-top: 1px solid #e7ecf1;
|
||||
margin-top: 12px;
|
||||
padding-top: 18px;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<div class="perfil-contenedor">
|
||||
<ajax:TabContainer ID="TabsPerfil"
|
||||
runat="server"
|
||||
ActiveTabIndex="0">
|
||||
<ajax:TabPanel ID="TabDatosSesion"
|
||||
runat="server"
|
||||
HeaderText="Datos de sesión">
|
||||
<ContentTemplate>
|
||||
<div class="perfil-seccion">
|
||||
<div class="row">
|
||||
<div class="col-md-6 perfil-campo">
|
||||
<label for="<%= TxtNombreUsuario.ClientID %>">
|
||||
Nombre de usuario
|
||||
</label>
|
||||
<asp:TextBox ID="TxtNombreUsuario"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="100" />
|
||||
</div>
|
||||
<div class="col-md-6 perfil-campo">
|
||||
<label>Correo electrónico</label>
|
||||
<asp:TextBox ID="TxtCorreoElectronico"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
ReadOnly="true" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 perfil-campo">
|
||||
<label>Rol de la sesión</label>
|
||||
<p class="form-control-static">
|
||||
<asp:Literal ID="LitNombreRol" runat="server" />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 perfil-campo">
|
||||
<label for="<%= TxtContrasenaNueva.ClientID %>">
|
||||
Nueva contraseña
|
||||
</label>
|
||||
<asp:TextBox ID="TxtContrasenaNueva"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
TextMode="Password"
|
||||
MaxLength="128" />
|
||||
<div class="perfil-ayuda">
|
||||
Déjela vacía para conservar la contraseña actual.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 perfil-campo">
|
||||
<label for="<%= TxtConfirmarContrasena.ClientID %>">
|
||||
Confirmar nueva contraseña
|
||||
</label>
|
||||
<asp:TextBox ID="TxtConfirmarContrasena"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
TextMode="Password"
|
||||
MaxLength="128" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<asp:Button ID="BtnGuardarSesion"
|
||||
runat="server"
|
||||
CssClass="btn green"
|
||||
Text="Guardar datos de sesión"
|
||||
OnClick="BtnGuardarSesion_Click" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
|
||||
<ajax:TabPanel ID="TabDatosCliente"
|
||||
runat="server"
|
||||
HeaderText="Datos del cliente">
|
||||
<ContentTemplate>
|
||||
<div class="perfil-seccion">
|
||||
<div class="row">
|
||||
<div class="col-md-6 perfil-campo">
|
||||
<label for="<%= TxtNombreFiscal.ClientID %>">
|
||||
Nombre o razón social
|
||||
</label>
|
||||
<asp:TextBox ID="TxtNombreFiscal"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="200" />
|
||||
</div>
|
||||
<div class="col-md-6 perfil-campo">
|
||||
<label for="<%= TxtNombreComercial.ClientID %>">
|
||||
Nombre comercial
|
||||
</label>
|
||||
<asp:TextBox ID="TxtNombreComercial"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="200" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 perfil-campo">
|
||||
<label for="<%= TxtDireccion.ClientID %>">Dirección</label>
|
||||
<asp:TextBox ID="TxtDireccion"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="90" />
|
||||
</div>
|
||||
<div class="col-md-3 perfil-campo">
|
||||
<label for="<%= TxtNumeroExterior.ClientID %>">
|
||||
Número exterior
|
||||
</label>
|
||||
<asp:TextBox ID="TxtNumeroExterior"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="20" />
|
||||
</div>
|
||||
<div class="col-md-3 perfil-campo">
|
||||
<label for="<%= TxtNumeroInterior.ClientID %>">
|
||||
Número interior
|
||||
</label>
|
||||
<asp:TextBox ID="TxtNumeroInterior"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="50" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= TxtColonia.ClientID %>">Colonia</label>
|
||||
<asp:TextBox ID="TxtColonia"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="50" />
|
||||
</div>
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= TxtCiudad.ClientID %>">Ciudad</label>
|
||||
<asp:TextBox ID="TxtCiudad"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="50" />
|
||||
</div>
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= TxtEstado.ClientID %>">Estado</label>
|
||||
<asp:TextBox ID="TxtEstado"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="35" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= TxtPais.ClientID %>">País</label>
|
||||
<asp:TextBox ID="TxtPais"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="50" />
|
||||
</div>
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= TxtTelefono.ClientID %>">Teléfono</label>
|
||||
<asp:TextBox ID="TxtTelefono"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="25" />
|
||||
</div>
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= TxtCorreoCliente.ClientID %>">Correo</label>
|
||||
<asp:TextBox ID="TxtCorreoCliente"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="500" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="perfil-fiscal">
|
||||
<h4>Datos fiscales para timbrado</h4>
|
||||
<asp:Label ID="LblCatalogosFiscales"
|
||||
runat="server"
|
||||
CssClass="alert alert-warning"
|
||||
Visible="false" />
|
||||
<div class="row">
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= TxtRFC.ClientID %>">RFC</label>
|
||||
<asp:TextBox ID="TxtRFC"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="13" />
|
||||
</div>
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= TxtCodigoPostal.ClientID %>">
|
||||
Código postal fiscal
|
||||
</label>
|
||||
<asp:TextBox ID="TxtCodigoPostal"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="5" />
|
||||
</div>
|
||||
<div class="col-md-4 perfil-campo">
|
||||
<label for="<%= DdlRegimenFiscal.ClientID %>">
|
||||
Régimen fiscal
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlRegimenFiscal"
|
||||
runat="server"
|
||||
CssClass="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 perfil-campo">
|
||||
<label for="<%= DdlUsoCfdi.ClientID %>">
|
||||
Uso de CFDI
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlUsoCfdi"
|
||||
runat="server"
|
||||
CssClass="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<asp:Button ID="BtnGuardarCliente"
|
||||
runat="server"
|
||||
CssClass="btn green"
|
||||
Text="Guardar datos del cliente"
|
||||
OnClick="BtnGuardarCliente_Click" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
</ajax:TabContainer>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
</asp:Content>
|
||||
289
SIG.Web/Pages/Security/Perfil.aspx.cs
Normal file
289
SIG.Web/Pages/Security/Perfil.aspx.cs
Normal file
@@ -0,0 +1,289 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Web.UI.WebControls;
|
||||
using SIG.Web.AppCode.Configuration;
|
||||
using SIG.Web.AppCode.Infrastructure.WebForms;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Security;
|
||||
using SIG.Web.AppCode.Security;
|
||||
using SIG.Web.AppCode.Session;
|
||||
|
||||
namespace SIG.Web.Pages.Security
|
||||
{
|
||||
public partial class Perfil : ClsPaginaBase
|
||||
{
|
||||
private int CveClienteActual
|
||||
{
|
||||
get { return ViewState["CveClienteActual"] as int? ?? 0; }
|
||||
set { ViewState["CveClienteActual"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (CurrentUser == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigurarNavegacion();
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
CargarPerfil();
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnGuardarSesion_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
if (!string.Equals(
|
||||
TxtContrasenaNueva.Text,
|
||||
TxtConfirmarContrasena.Text,
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
Alert(
|
||||
"La confirmación de la contraseña no coincide.",
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
DbResult<PerfilSesionModel> resultado =
|
||||
AppServices.PerfilUsuarioService.ActualizarSesion(
|
||||
CurrentUser,
|
||||
TxtNombreUsuario.Text,
|
||||
TxtContrasenaNueva.Text);
|
||||
|
||||
if (!resultado.Success || resultado.Data == null)
|
||||
{
|
||||
Alert(
|
||||
resultado.Success
|
||||
? "No fue posible actualizar los datos de sesión."
|
||||
: resultado.UserMessage,
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentUser.NombreUsuario = resultado.Data.NombreUsuario;
|
||||
CurrentUser.Nombre = resultado.Data.NombreUsuario;
|
||||
CurrentUser.CorreoElectronico =
|
||||
resultado.Data.CorreoElectronico;
|
||||
CurrentUser.CveCliente = resultado.Data.CveCliente;
|
||||
|
||||
if (!string.IsNullOrEmpty(TxtContrasenaNueva.Text))
|
||||
{
|
||||
CurrentUser.DebeCambiarContrasena = false;
|
||||
}
|
||||
|
||||
AppServices.UserContext.SetCurrentUser(CurrentUser);
|
||||
AlertNextRequest(
|
||||
"Los datos de sesión se actualizaron correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
Response.Redirect(
|
||||
ResolveUrl("~/Pages/Security/Perfil.aspx"),
|
||||
false);
|
||||
Context.ApplicationInstance.CompleteRequest();
|
||||
}
|
||||
|
||||
protected void BtnGuardarCliente_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
int cveRegimenFiscal;
|
||||
int cveUsoCfdi;
|
||||
|
||||
if (!int.TryParse(
|
||||
DdlRegimenFiscal.SelectedValue,
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out cveRegimenFiscal) ||
|
||||
!int.TryParse(
|
||||
DdlUsoCfdi.SelectedValue,
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out cveUsoCfdi))
|
||||
{
|
||||
Alert(
|
||||
"Seleccione el régimen fiscal y el uso de CFDI.",
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
var cliente = new PerfilClienteModel
|
||||
{
|
||||
CveCliente = CveClienteActual,
|
||||
Nombre = TxtNombreFiscal.Text,
|
||||
NombreComercial = TxtNombreComercial.Text,
|
||||
Direccion = TxtDireccion.Text,
|
||||
NoExt = TxtNumeroExterior.Text,
|
||||
NoInt = TxtNumeroInterior.Text,
|
||||
Colonia = TxtColonia.Text,
|
||||
Ciudad = TxtCiudad.Text,
|
||||
Estado = TxtEstado.Text,
|
||||
Pais = TxtPais.Text,
|
||||
RFC = TxtRFC.Text,
|
||||
CP = TxtCodigoPostal.Text,
|
||||
Telefono = TxtTelefono.Text,
|
||||
Mail = TxtCorreoCliente.Text,
|
||||
CveRegimenFiscal = cveRegimenFiscal,
|
||||
CveUsoCFDI = cveUsoCfdi
|
||||
};
|
||||
|
||||
DbResult<bool> resultado =
|
||||
AppServices.PerfilUsuarioService.ActualizarCliente(
|
||||
CurrentUser,
|
||||
cliente);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(
|
||||
resultado.UserMessage,
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
Alert(
|
||||
"Los datos del cliente se actualizaron correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
CargarPerfil();
|
||||
TabsPerfil.ActiveTabIndex = 1;
|
||||
}
|
||||
|
||||
private void CargarPerfil()
|
||||
{
|
||||
DbResult<PerfilUsuarioConsultaModel> resultado =
|
||||
AppServices.PerfilUsuarioService.ObtenerPerfil(
|
||||
CurrentUser);
|
||||
|
||||
if (!resultado.Success ||
|
||||
resultado.Data == null ||
|
||||
resultado.Data.Sesion == null)
|
||||
{
|
||||
Alert(
|
||||
resultado.Success
|
||||
? "No fue posible consultar el perfil."
|
||||
: resultado.UserMessage,
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
PerfilUsuarioConsultaModel perfil = resultado.Data;
|
||||
TxtNombreUsuario.Text = perfil.Sesion.NombreUsuario;
|
||||
TxtCorreoElectronico.Text =
|
||||
perfil.Sesion.CorreoElectronico;
|
||||
LitNombreRol.Text = Server.HtmlEncode(
|
||||
perfil.Sesion.NombreRol);
|
||||
|
||||
CargarCatalogos(perfil);
|
||||
|
||||
bool mostrarCliente =
|
||||
perfil.Sesion.EsDesarrollador &&
|
||||
perfil.Sesion.CveCliente > 0 &&
|
||||
perfil.Cliente != null;
|
||||
|
||||
TabDatosCliente.Visible = mostrarCliente;
|
||||
CveClienteActual = mostrarCliente
|
||||
? perfil.Cliente.CveCliente
|
||||
: 0;
|
||||
|
||||
if (mostrarCliente)
|
||||
{
|
||||
CargarCliente(perfil.Cliente);
|
||||
}
|
||||
}
|
||||
|
||||
private void CargarCatalogos(
|
||||
PerfilUsuarioConsultaModel perfil)
|
||||
{
|
||||
bool faltanRegimenes =
|
||||
perfil.RegimenesFiscales.Count == 0;
|
||||
bool faltanUsosCfdi =
|
||||
perfil.UsosCfdi.Count == 0;
|
||||
|
||||
LblCatalogosFiscales.Visible =
|
||||
faltanRegimenes || faltanUsosCfdi;
|
||||
LblCatalogosFiscales.Text =
|
||||
"No hay regímenes fiscales o usos de CFDI configurados. " +
|
||||
"Registre esos catálogos antes de guardar los datos fiscales.";
|
||||
|
||||
DdlRegimenFiscal.DataSource =
|
||||
perfil.RegimenesFiscales;
|
||||
DdlRegimenFiscal.DataTextField = "Descripcion";
|
||||
DdlRegimenFiscal.DataValueField = "CveRegimenFiscal";
|
||||
DdlRegimenFiscal.DataBind();
|
||||
DdlRegimenFiscal.Items.Insert(
|
||||
0,
|
||||
new ListItem("Seleccione", string.Empty));
|
||||
|
||||
DdlUsoCfdi.DataSource = perfil.UsosCfdi;
|
||||
DdlUsoCfdi.DataTextField = "DescripcionCompleta";
|
||||
DdlUsoCfdi.DataValueField = "CveUsoCFDI";
|
||||
DdlUsoCfdi.DataBind();
|
||||
DdlUsoCfdi.Items.Insert(
|
||||
0,
|
||||
new ListItem("Seleccione", string.Empty));
|
||||
}
|
||||
|
||||
private void CargarCliente(PerfilClienteModel cliente)
|
||||
{
|
||||
TxtNombreFiscal.Text = cliente.Nombre;
|
||||
TxtNombreComercial.Text = cliente.NombreComercial;
|
||||
TxtDireccion.Text = cliente.Direccion;
|
||||
TxtNumeroExterior.Text = cliente.NoExt;
|
||||
TxtNumeroInterior.Text = cliente.NoInt;
|
||||
TxtColonia.Text = cliente.Colonia;
|
||||
TxtCiudad.Text = cliente.Ciudad;
|
||||
TxtEstado.Text = cliente.Estado;
|
||||
TxtPais.Text = cliente.Pais;
|
||||
TxtRFC.Text = cliente.RFC;
|
||||
TxtCodigoPostal.Text = cliente.CP;
|
||||
TxtTelefono.Text = cliente.Telefono;
|
||||
TxtCorreoCliente.Text = cliente.Mail;
|
||||
|
||||
SeleccionarValor(
|
||||
DdlRegimenFiscal,
|
||||
cliente.CveRegimenFiscal);
|
||||
SeleccionarValor(
|
||||
DdlUsoCfdi,
|
||||
cliente.CveUsoCFDI);
|
||||
}
|
||||
|
||||
private static void SeleccionarValor(
|
||||
ListControl control,
|
||||
int valor)
|
||||
{
|
||||
string valorTexto = valor.ToString(
|
||||
CultureInfo.InvariantCulture);
|
||||
|
||||
if (control.Items.FindByValue(valorTexto) != null)
|
||||
{
|
||||
control.SelectedValue = valorTexto;
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigurarNavegacion()
|
||||
{
|
||||
Site sitio = Master as Site;
|
||||
|
||||
if (sitio == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sitio.SetPageNavigation(
|
||||
"Mi perfil",
|
||||
new[]
|
||||
{
|
||||
new BreadcrumbItemModel
|
||||
{
|
||||
Texto = "Inicio",
|
||||
Url = "~/Inicio.aspx"
|
||||
},
|
||||
new BreadcrumbItemModel
|
||||
{
|
||||
Texto = "Mi perfil"
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
32
SIG.Web/Pages/Security/Perfil.aspx.designer.cs
generated
Normal file
32
SIG.Web/Pages/Security/Perfil.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace SIG.Web.Pages.Security
|
||||
{
|
||||
public partial class Perfil
|
||||
{
|
||||
protected global::AjaxControlToolkit.TabContainer TabsPerfil;
|
||||
protected global::AjaxControlToolkit.TabPanel TabDatosSesion;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtNombreUsuario;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtCorreoElectronico;
|
||||
protected global::System.Web.UI.WebControls.Literal LitNombreRol;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtContrasenaNueva;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtConfirmarContrasena;
|
||||
protected global::System.Web.UI.WebControls.Button BtnGuardarSesion;
|
||||
protected global::AjaxControlToolkit.TabPanel TabDatosCliente;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtNombreFiscal;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtNombreComercial;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtDireccion;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtNumeroExterior;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtNumeroInterior;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtColonia;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtCiudad;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtEstado;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtPais;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtTelefono;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtCorreoCliente;
|
||||
protected global::System.Web.UI.WebControls.Label LblCatalogosFiscales;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtRFC;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtCodigoPostal;
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlRegimenFiscal;
|
||||
protected global::System.Web.UI.WebControls.DropDownList DdlUsoCfdi;
|
||||
protected global::System.Web.UI.WebControls.Button BtnGuardarCliente;
|
||||
}
|
||||
}
|
||||
627
SIG.Web/Pages/Ventas/VentaTramite.aspx
Normal file
627
SIG.Web/Pages/Ventas/VentaTramite.aspx
Normal file
@@ -0,0 +1,627 @@
|
||||
<%@ Page Title="Venta de trámite"
|
||||
Language="C#"
|
||||
MasterPageFile="~/Site.master"
|
||||
AutoEventWireup="true"
|
||||
CodeFile="VentaTramite.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Ventas.VentaTramite" %>
|
||||
|
||||
<asp:Content ID="ContenidoEncabezado" ContentPlaceHolderID="H" runat="server">
|
||||
<link href='<%= ResolveUrl("~/Styles/VentaTramite.css?v=20260828-2") %>'
|
||||
rel="stylesheet"
|
||||
type="text/css" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContenidoAcciones" ContentPlaceHolderID="A" runat="server">
|
||||
<li>
|
||||
<asp:HyperLink ID="LnkVolver"
|
||||
runat="server">
|
||||
<i class="fa fa-arrow-left"></i>
|
||||
Volver al fraccionamiento
|
||||
</asp:HyperLink>
|
||||
</li>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContenidoPrincipal" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:Panel ID="PnlVenta" runat="server" Visible="false">
|
||||
<section class="venta-tarjeta-encabezado">
|
||||
<div>
|
||||
<span class="venta-sobretitulo">Pago de trámite</span>
|
||||
<h2>
|
||||
<asp:Literal ID="LitNombrePago" runat="server" />
|
||||
</h2>
|
||||
<p>
|
||||
<asp:Literal ID="LitReferenciaTramite" runat="server" />
|
||||
</p>
|
||||
<asp:Label ID="LblEstadoVenta"
|
||||
runat="server"
|
||||
CssClass="venta-estado" />
|
||||
<asp:Label ID="LblEstadoPago"
|
||||
runat="server"
|
||||
CssClass="venta-estado"
|
||||
Visible="false" />
|
||||
</div>
|
||||
|
||||
<div class="venta-total-encabezado">
|
||||
<span>Total</span>
|
||||
<strong>
|
||||
<asp:Literal ID="LitTotalEncabezado" runat="server" />
|
||||
</strong>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="venta-cuadricula-superior">
|
||||
<section class="venta-tarjeta">
|
||||
<div class="venta-titulo-tarjeta">
|
||||
<i class="fa fa-thumb-tack"></i>
|
||||
<h3>Cliente</h3>
|
||||
</div>
|
||||
|
||||
<dl class="venta-cuadricula-datos">
|
||||
<div class="venta-dato-amplio">
|
||||
<dt>Nombre</dt>
|
||||
<dd><asp:Literal ID="LitCliente" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>RFC</dt>
|
||||
<dd><asp:Literal ID="LitRFC" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Teléfono</dt>
|
||||
<dd><asp:Literal ID="LitTelefono" runat="server" /></dd>
|
||||
</div>
|
||||
<div class="venta-dato-amplio">
|
||||
<dt>Dirección</dt>
|
||||
<dd><asp:Literal ID="LitDireccion" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Colonia</dt>
|
||||
<dd><asp:Literal ID="LitColonia" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Ciudad, estado</dt>
|
||||
<dd><asp:Literal ID="LitCiudadEstado" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>C.P.</dt>
|
||||
<dd><asp:Literal ID="LitCodigoPostal" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Correo</dt>
|
||||
<dd><asp:Literal ID="LitCorreo" runat="server" /></dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="venta-tarjeta">
|
||||
<div class="venta-titulo-tarjeta">
|
||||
<i class="fa fa-thumb-tack"></i>
|
||||
<h3>Datos de emisión</h3>
|
||||
</div>
|
||||
|
||||
<dl class="venta-cuadricula-datos venta-datos-emision">
|
||||
<div>
|
||||
<dt>Tipo</dt>
|
||||
<dd><asp:Literal ID="LitTipoDocumento" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Serie - folio</dt>
|
||||
<dd><asp:Literal ID="LitSerieFolio" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Fecha</dt>
|
||||
<dd><asp:Literal ID="LitFecha" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Moneda</dt>
|
||||
<dd>Pesos (MXN)</dd>
|
||||
</div>
|
||||
<div class="venta-dato-amplio">
|
||||
<dt>Fraccionamiento</dt>
|
||||
<dd><asp:Literal ID="LitFraccionamiento" runat="server" /></dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="venta-tarjeta venta-tarjeta-detalle">
|
||||
<div class="venta-titulo-tarjeta">
|
||||
<i class="fa fa-list"></i>
|
||||
<h3>Detalle</h3>
|
||||
</div>
|
||||
|
||||
<div class="venta-tabla-desplazable">
|
||||
<asp:GridView ID="GvConceptos"
|
||||
runat="server"
|
||||
AutoGenerateColumns="false"
|
||||
DataKeyNames="CveVentaDetalle,CvePS"
|
||||
OnRowCommand="GvConceptos_RowCommand"
|
||||
GridLines="None"
|
||||
CssClass="table table-striped table-hover Widthall">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Cant.">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblCantidadConcepto"
|
||||
runat="server"
|
||||
Visible="<%# !PuedeModificarConceptosActual %>"
|
||||
Text='<%# Eval("Cantidad", "{0:0.####}") %>' />
|
||||
<asp:TextBox ID="TxtCantidadConcepto"
|
||||
runat="server"
|
||||
Visible="<%# PuedeModificarConceptosActual %>"
|
||||
CssClass="form-control venta-captura-numero"
|
||||
Text='<%# Eval("Cantidad", "{0:0.####}") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField
|
||||
DataField="UnidadMedida"
|
||||
HeaderText="Unidad" />
|
||||
<asp:BoundField
|
||||
DataField="Clasificacion"
|
||||
HeaderText="Clasificación" />
|
||||
<asp:BoundField
|
||||
DataField="ProductoServicio"
|
||||
HeaderText="Producto o servicio" />
|
||||
<asp:TemplateField HeaderText="P.U.">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblPrecioUnitarioConcepto"
|
||||
runat="server"
|
||||
Visible="<%# !PuedeModificarConceptosActual %>"
|
||||
Text='<%# Eval("PrecioUnitario", "{0:C2}") %>' />
|
||||
<asp:TextBox ID="TxtPrecioUnitarioConcepto"
|
||||
runat="server"
|
||||
Visible="<%# PuedeModificarConceptosActual %>"
|
||||
CssClass="form-control venta-captura-numero"
|
||||
Text='<%# Eval("PrecioUnitario", "{0:0.00}") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField
|
||||
DataField="Descuento"
|
||||
HeaderText="Desc."
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:BoundField
|
||||
DataField="IVA"
|
||||
HeaderText="IVA"
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:BoundField
|
||||
DataField="Importe"
|
||||
HeaderText="Total"
|
||||
DataFormatString="{0:C2}"
|
||||
HtmlEncode="false" />
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnGuardarConcepto"
|
||||
runat="server"
|
||||
Visible="<%# PuedeModificarConceptosActual %>"
|
||||
CssClass="btn btn-xs blue"
|
||||
CommandName="GuardarConcepto"
|
||||
CommandArgument='<%# Eval("CveVentaDetalle") %>'
|
||||
CausesValidation="false"
|
||||
ToolTip="Guardar cantidad y precio">
|
||||
<i class="fa fa-save"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnEliminarConcepto"
|
||||
runat="server"
|
||||
Visible="<%# PuedeEliminarConceptosActual %>"
|
||||
CssClass="btn btn-xs red"
|
||||
CommandName="EliminarConcepto"
|
||||
CommandArgument='<%# Eval("CveVentaDetalle") %>'
|
||||
CausesValidation="false"
|
||||
OnClientClick="return window.SIGAlerts.confirmPostBack(this, '¿Desea quitar este producto o servicio de la venta?');"
|
||||
ToolTip="Quitar concepto">
|
||||
<i class="fa fa-trash"></i>
|
||||
</asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
|
||||
<asp:Panel ID="PnlAgregarConcepto"
|
||||
runat="server"
|
||||
CssClass="venta-agregar-concepto">
|
||||
<div class="form-group venta-producto-nuevo">
|
||||
<label for="<%= DdlProductoServicio.ClientID %>">
|
||||
Producto o servicio
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlProductoServicio"
|
||||
runat="server"
|
||||
CssClass="form-control select2me"
|
||||
AutoPostBack="true"
|
||||
OnSelectedIndexChanged="DdlProductoServicio_SelectedIndexChanged" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<%= TxtCantidadNuevo.ClientID %>">Cantidad</label>
|
||||
<asp:TextBox ID="TxtCantidadNuevo"
|
||||
runat="server"
|
||||
CssClass="form-control venta-captura-numero"
|
||||
Text="1" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<%= TxtPrecioUnitarioNuevo.ClientID %>">
|
||||
Precio unitario
|
||||
</label>
|
||||
<asp:TextBox ID="TxtPrecioUnitarioNuevo"
|
||||
runat="server"
|
||||
CssClass="form-control venta-captura-numero"
|
||||
Text="0.00" />
|
||||
</div>
|
||||
<div class="form-group venta-accion-agregar">
|
||||
<asp:LinkButton ID="BtnAgregarConcepto"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnAgregarConcepto_Click">
|
||||
<i class="fa fa-plus"></i>
|
||||
Agregar
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
</asp:Panel>
|
||||
|
||||
<dl class="venta-totales">
|
||||
<div>
|
||||
<dt>Subtotal</dt>
|
||||
<dd><asp:Literal ID="LitSubtotal" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Descuentos</dt>
|
||||
<dd><asp:Literal ID="LitDescuento" runat="server" /></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>IVA</dt>
|
||||
<dd><asp:Literal ID="LitIVA" runat="server" /></dd>
|
||||
</div>
|
||||
<div class="venta-fila-total">
|
||||
<dt>Total</dt>
|
||||
<dd><asp:Literal ID="LitTotal" runat="server" /></dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<div class="venta-cuadricula-inferior">
|
||||
<section class="venta-tarjeta">
|
||||
<div class="venta-titulo-tarjeta">
|
||||
<i class="fa fa-thumb-tack"></i>
|
||||
<h3>Condiciones de pago</h3>
|
||||
</div>
|
||||
|
||||
<asp:Panel ID="PnlCondicionesPago"
|
||||
runat="server"
|
||||
Visible="false">
|
||||
<div class="form-group">
|
||||
<label for="<%= DdlMetodoPagoVenta.ClientID %>">
|
||||
Método de pago
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlMetodoPagoVenta"
|
||||
runat="server"
|
||||
CssClass="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<%= DdlFormaPagoVenta.ClientID %>">
|
||||
Forma de pago
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlFormaPagoVenta"
|
||||
runat="server"
|
||||
CssClass="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<%= TxtFechaVencimiento.ClientID %>">
|
||||
Fecha de vencimiento
|
||||
</label>
|
||||
<asp:TextBox ID="TxtFechaVencimiento"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
TextMode="Date" />
|
||||
</div>
|
||||
<asp:LinkButton ID="BtnGuardarCondicionesPago"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnGuardarCondicionesPago_Click">
|
||||
<i class="fa fa-save"></i>
|
||||
Guardar condiciones
|
||||
</asp:LinkButton>
|
||||
</asp:Panel>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="venta-tarjeta">
|
||||
<div class="venta-titulo-tarjeta">
|
||||
<i class="fa fa-thumb-tack"></i>
|
||||
<h3>Observaciones</h3>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="<%= TxtObservaciones.ClientID %>">
|
||||
Observaciones generales
|
||||
</label>
|
||||
<asp:TextBox ID="TxtObservaciones"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
TextMode="MultiLine"
|
||||
Rows="5"
|
||||
MaxLength="2000" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="venta-tarjeta venta-tarjeta-acciones">
|
||||
<div class="venta-titulo-tarjeta">
|
||||
<i class="fa fa-thumb-tack"></i>
|
||||
<h3>Acciones</h3>
|
||||
</div>
|
||||
|
||||
<asp:LinkButton ID="BtnGenerar"
|
||||
runat="server"
|
||||
CssClass="btn blue venta-boton-pagar"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnGenerar_Click"
|
||||
OnClientClick="return window.SIGAlerts.confirmPostBack(this, '¿Desea generar la venta del trámite?');">
|
||||
<i class="fa fa-file-text-o"></i>
|
||||
Generar
|
||||
</asp:LinkButton>
|
||||
|
||||
<asp:LinkButton ID="BtnPagar"
|
||||
runat="server"
|
||||
CssClass="btn green venta-boton-pagar"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnPagar_Click">
|
||||
<i class="fa fa-money"></i>
|
||||
Pagar
|
||||
</asp:LinkButton>
|
||||
|
||||
<asp:LinkButton ID="BtnTimbrar"
|
||||
runat="server"
|
||||
CssClass="btn purple venta-boton-pagar"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnTimbrar_Click"
|
||||
OnClientClick="return window.SIGAlerts.confirmPostBack(this, '¿Desea timbrar esta venta?');">
|
||||
<i class="fa fa-certificate"></i>
|
||||
Timbrar
|
||||
</asp:LinkButton>
|
||||
|
||||
<asp:Panel ID="PnlCancelarTimbre"
|
||||
runat="server"
|
||||
CssClass="venta-cancelacion-timbre">
|
||||
<div class="form-group">
|
||||
<label for="<%= DdlMotivoCancelacion.ClientID %>">
|
||||
Motivo de cancelación SAT
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlMotivoCancelacion"
|
||||
runat="server"
|
||||
CssClass="form-control">
|
||||
<asp:ListItem Value="">Seleccione</asp:ListItem>
|
||||
<asp:ListItem Value="01">01 - Comprobante emitido con errores con relación</asp:ListItem>
|
||||
<asp:ListItem Value="02">02 - Comprobante emitido con errores sin relación</asp:ListItem>
|
||||
<asp:ListItem Value="03">03 - No se llevó a cabo la operación</asp:ListItem>
|
||||
<asp:ListItem Value="04">04 - Operación nominativa relacionada en factura global</asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<%= TxtUuidSustitucion.ClientID %>">
|
||||
UUID de sustitución (requerido para motivo 01)
|
||||
</label>
|
||||
<asp:TextBox ID="TxtUuidSustitucion"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="36" />
|
||||
</div>
|
||||
<asp:LinkButton ID="BtnCancelarTimbre"
|
||||
runat="server"
|
||||
CssClass="btn red venta-boton-pagar"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnCancelarTimbre_Click"
|
||||
OnClientClick="return window.SIGAlerts.confirmPostBack(this, '¿Desea solicitar al PAC la cancelación de este timbre?');">
|
||||
<i class="fa fa-ban"></i>
|
||||
Cancelar timbre
|
||||
</asp:LinkButton>
|
||||
</asp:Panel>
|
||||
</section>
|
||||
</div>
|
||||
</asp:Panel>
|
||||
|
||||
<div id="ModalPagoVenta"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="TituloModalPagoVenta"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog venta-modal-pago"
|
||||
role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h3 id="TituloModalPagoVenta"
|
||||
class="modal-title">
|
||||
Registrar pago de venta
|
||||
</h3>
|
||||
<p class="venta-modal-subtitulo">
|
||||
Genere la solicitud con la forma en que realizará el pago.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="venta-resumen-pago">
|
||||
<div>
|
||||
<span>Folio</span>
|
||||
<strong>
|
||||
<asp:Literal ID="LitPagoFolio" runat="server" />
|
||||
</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span>Cliente</span>
|
||||
<strong>
|
||||
<asp:Literal ID="LitPagoCliente" runat="server" />
|
||||
</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span>Total venta</span>
|
||||
<strong>
|
||||
<asp:Literal ID="LitPagoTotal" runat="server" />
|
||||
</strong>
|
||||
</div>
|
||||
<div class="venta-resumen-saldo">
|
||||
<span>Saldo pendiente</span>
|
||||
<strong>
|
||||
<asp:Literal ID="LitPagoSaldo" runat="server" />
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="venta-formulario-pago">
|
||||
<div class="form-group">
|
||||
<label for="<%= TxtImportePago.ClientID %>">
|
||||
Monto a pagar *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtImportePago"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="20" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="<%= TxtFechaCapturaPago.ClientID %>">
|
||||
Fecha de pago *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtFechaCapturaPago"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
TextMode="Date" />
|
||||
</div>
|
||||
|
||||
<div class="form-group venta-campo-amplio">
|
||||
<label>Forma de pago *</label>
|
||||
<div class="venta-formas-pago">
|
||||
<asp:LinkButton ID="BtnFormaEfectivo"
|
||||
runat="server"
|
||||
CssClass="btn default venta-forma-pago"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnFormaEfectivo_Click">
|
||||
<i class="fa fa-money"></i>
|
||||
Efectivo / establecimiento
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnFormaTransferencia"
|
||||
runat="server"
|
||||
CssClass="btn default venta-forma-pago"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnFormaTransferencia_Click">
|
||||
<i class="fa fa-bank"></i>
|
||||
Transferencia SPEI
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnFormaTarjeta"
|
||||
runat="server"
|
||||
CssClass="btn default venta-forma-pago"
|
||||
CausesValidation="false"
|
||||
Enabled="false">
|
||||
<i class="fa fa-credit-card"></i>
|
||||
Tarjeta · No disponible
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<asp:Panel ID="PnlPagoEfectivo"
|
||||
runat="server"
|
||||
CssClass="venta-instruccion-pago venta-campo-amplio">
|
||||
<strong>Referencia para pago en efectivo</strong>
|
||||
<span>
|
||||
<asp:Literal ID="LitReferenciaPagoGenerada"
|
||||
runat="server" />
|
||||
</span>
|
||||
<p>
|
||||
Presente esta referencia al pagar en caja,
|
||||
OXXO u otro establecimiento habilitado.
|
||||
</p>
|
||||
</asp:Panel>
|
||||
|
||||
<asp:Panel ID="PnlPagoTransferencia"
|
||||
runat="server"
|
||||
CssClass="venta-transferencia-pago venta-campo-amplio"
|
||||
Visible="false">
|
||||
<div class="form-group">
|
||||
<label for="<%= DdlCuentaBancaria.ClientID %>">
|
||||
Cuenta receptora SPEI *
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlCuentaBancaria"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
AutoPostBack="true"
|
||||
OnSelectedIndexChanged="DdlCuentaBancaria_SelectedIndexChanged" />
|
||||
</div>
|
||||
<asp:Label ID="LblSinCuentasSpei"
|
||||
runat="server"
|
||||
CssClass="alert alert-warning venta-aviso-spei"
|
||||
Text="No hay una cuenta bancaria activa con CLABE configurada."
|
||||
Visible="false" />
|
||||
<div class="venta-dato-spei">
|
||||
<strong>CLABE SPEI</strong>
|
||||
<span>
|
||||
<asp:Literal ID="LitClabeSpei"
|
||||
runat="server" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="venta-dato-spei">
|
||||
<strong>Referencia de pago</strong>
|
||||
<span>
|
||||
<asp:Literal ID="LitReferenciaTransferencia"
|
||||
runat="server" />
|
||||
</span>
|
||||
</div>
|
||||
</asp:Panel>
|
||||
|
||||
<div class="form-group venta-campo-amplio">
|
||||
<label for="<%= TxtObservacionesPago.ClientID %>">
|
||||
Observaciones
|
||||
</label>
|
||||
<asp:TextBox ID="TxtObservacionesPago"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
TextMode="MultiLine"
|
||||
Rows="3"
|
||||
MaxLength="300" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info venta-aviso-autorizacion">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
La solicitud se registrará pendiente de autorización.
|
||||
La autorización se administrará por separado.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:LinkButton ID="BtnRegistrarPago"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnRegistrarPago_Click">
|
||||
<i class="fa fa-save"></i>
|
||||
Generar solicitud de pago
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContenidoScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<script type="text/javascript">
|
||||
(function (window, $) {
|
||||
"use strict";
|
||||
|
||||
window.SIGVentaTramite = window.SIGVentaTramite || {};
|
||||
|
||||
window.SIGVentaTramite.mostrarPago = function () {
|
||||
$("#ModalPagoVenta").modal("show");
|
||||
};
|
||||
}(window, window.jQuery));
|
||||
</script>
|
||||
</asp:Content>
|
||||
1110
SIG.Web/Pages/Ventas/VentaTramite.aspx.cs
Normal file
1110
SIG.Web/Pages/Ventas/VentaTramite.aspx.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -115,7 +115,11 @@
|
||||
<Content Include="Pages\Catalogos\TiposDocumento.aspx" />
|
||||
<Content Include="Pages\Catalogos\DocumentosRequeridos.aspx" />
|
||||
<Content Include="Pages\Catalogos\TipoTramiteDetalle.aspx" />
|
||||
<Content Include="Pages\Catalogos\ProductosServicios.aspx" />
|
||||
<Content Include="Pages\Catalogos\UnidadesMedida.aspx" />
|
||||
<Content Include="Pages\Catalogos\Clasificaciones.aspx" />
|
||||
<Content Include="Pages\Security\Usuarios.aspx" />
|
||||
<Content Include="Pages\Security\Perfil.aspx" />
|
||||
<Content Include="Pages\Security\RegistroCliente.aspx" />
|
||||
<Content Include="Pages\Security\RegistroPendiente.aspx" />
|
||||
<Content Include="Pages\Security\VerificarCorreo.aspx" />
|
||||
|
||||
@@ -110,8 +110,206 @@
|
||||
root.setAttribute('data-sig-bitacora-grid-initialized', '1');
|
||||
}
|
||||
|
||||
function clearPaginationTimer(slider) {
|
||||
if (!slider || !slider.sigBitacoraPaginationTimer) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.clearTimeout(slider.sigBitacoraPaginationTimer);
|
||||
slider.sigBitacoraPaginationTimer = null;
|
||||
}
|
||||
|
||||
function setPaginationSliderDisplay(slider, track, label) {
|
||||
var currentValue = parseInt(slider.value, 10);
|
||||
var totalPages = parseInt(slider.max, 10);
|
||||
var position = totalPages <= 1
|
||||
? 0
|
||||
: ((currentValue - 1) * 100) / (totalPages - 1);
|
||||
var pageText = 'Página ' + currentValue + ' de ' + totalPages;
|
||||
|
||||
track.style.setProperty(
|
||||
'--sig-bitacora-page-position',
|
||||
position + '%'
|
||||
);
|
||||
track.setAttribute(
|
||||
'data-sig-slider-edge',
|
||||
currentValue <= 1
|
||||
? 'start'
|
||||
: currentValue >= totalPages
|
||||
? 'end'
|
||||
: 'middle'
|
||||
);
|
||||
label.textContent = pageText;
|
||||
slider.setAttribute('aria-valuenow', currentValue.toString());
|
||||
slider.setAttribute('aria-valuetext', pageText);
|
||||
}
|
||||
|
||||
function initializePaginationSlider(root) {
|
||||
var slider = root.querySelector(
|
||||
'.js-sig-bitacora-grid-pagination-slider'
|
||||
);
|
||||
|
||||
if (!slider ||
|
||||
slider.getAttribute(
|
||||
'data-sig-bitacora-pagination-slider-initialized'
|
||||
) === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
var track = slider.parentNode;
|
||||
var label = track.querySelector(
|
||||
'.sig-bitacora-grid-pagination-slider-label'
|
||||
);
|
||||
var requestedPageField = document.getElementById(
|
||||
slider.getAttribute('data-sig-page-field-id')
|
||||
);
|
||||
var pageRequest = root.querySelector(
|
||||
'.js-sig-bitacora-grid-page-request'
|
||||
);
|
||||
var pointerInteraction = false;
|
||||
var thumbRadius = 12;
|
||||
|
||||
if (!track || !label || !requestedPageField || !pageRequest) {
|
||||
return;
|
||||
}
|
||||
|
||||
function setLabelVisible(visible) {
|
||||
if (visible) {
|
||||
track.classList.add('is-label-visible');
|
||||
return;
|
||||
}
|
||||
|
||||
track.classList.remove('is-label-visible');
|
||||
}
|
||||
|
||||
function updateLabelHover(event) {
|
||||
if (pointerInteraction) {
|
||||
setLabelVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
var rectangle = slider.getBoundingClientRect();
|
||||
var minimum = parseInt(slider.min, 10) || 1;
|
||||
var maximum = parseInt(slider.max, 10) || minimum;
|
||||
var current = parseInt(slider.value, 10) || minimum;
|
||||
var range = Math.max(maximum - minimum, 1);
|
||||
var usableWidth = Math.max(
|
||||
rectangle.width - (thumbRadius * 2),
|
||||
0
|
||||
);
|
||||
var thumbCenter = rectangle.left + thumbRadius +
|
||||
(((current - minimum) / range) * usableWidth);
|
||||
var isOverThumb =
|
||||
Math.abs(event.clientX - thumbCenter) <= thumbRadius &&
|
||||
event.clientY >= rectangle.top - 4 &&
|
||||
event.clientY <= rectangle.bottom + 4;
|
||||
|
||||
setLabelVisible(isOverThumb);
|
||||
}
|
||||
|
||||
function scheduleNavigation() {
|
||||
var selectedPage = parseInt(slider.value, 10);
|
||||
var currentPage = parseInt(
|
||||
slider.getAttribute('data-sig-current-page'),
|
||||
10
|
||||
);
|
||||
var totalPages = parseInt(slider.max, 10);
|
||||
|
||||
clearPaginationTimer(slider);
|
||||
|
||||
if (slider.disabled ||
|
||||
totalPages <= 1 ||
|
||||
selectedPage === currentPage) {
|
||||
requestedPageField.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
requestedPageField.value = selectedPage.toString();
|
||||
slider.sigBitacoraPaginationTimer = window.setTimeout(
|
||||
function () {
|
||||
var finalPage = parseInt(slider.value, 10);
|
||||
|
||||
slider.sigBitacoraPaginationTimer = null;
|
||||
|
||||
if (slider.disabled ||
|
||||
finalPage === currentPage ||
|
||||
finalPage !== selectedPage ||
|
||||
!document.documentElement.contains(slider)) {
|
||||
requestedPageField.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
requestedPageField.value = finalPage.toString();
|
||||
slider.disabled = true;
|
||||
pageRequest.click();
|
||||
},
|
||||
3000
|
||||
);
|
||||
}
|
||||
|
||||
function handleInput() {
|
||||
setPaginationSliderDisplay(slider, track, label);
|
||||
setLabelVisible(true);
|
||||
clearPaginationTimer(slider);
|
||||
|
||||
if (!pointerInteraction) {
|
||||
scheduleNavigation();
|
||||
}
|
||||
}
|
||||
|
||||
function beginPointerInteraction() {
|
||||
pointerInteraction = true;
|
||||
setLabelVisible(true);
|
||||
clearPaginationTimer(slider);
|
||||
}
|
||||
|
||||
function endPointerInteraction(event) {
|
||||
pointerInteraction = false;
|
||||
|
||||
if (event && event.type === 'touchend') {
|
||||
setLabelVisible(false);
|
||||
} else if (event && typeof event.clientX === 'number') {
|
||||
updateLabelHover(event);
|
||||
}
|
||||
|
||||
scheduleNavigation();
|
||||
}
|
||||
|
||||
slider.addEventListener('input', handleInput, false);
|
||||
slider.addEventListener('change', endPointerInteraction, false);
|
||||
slider.addEventListener('mousedown', beginPointerInteraction, false);
|
||||
slider.addEventListener('mouseup', endPointerInteraction, false);
|
||||
slider.addEventListener('touchstart', beginPointerInteraction, false);
|
||||
slider.addEventListener('touchend', endPointerInteraction, false);
|
||||
slider.addEventListener('mousemove', updateLabelHover, false);
|
||||
slider.addEventListener('mouseleave', function () {
|
||||
if (!pointerInteraction) {
|
||||
setLabelVisible(false);
|
||||
}
|
||||
}, false);
|
||||
|
||||
setPaginationSliderDisplay(slider, track, label);
|
||||
slider.setAttribute(
|
||||
'data-sig-bitacora-pagination-slider-initialized',
|
||||
'1'
|
||||
);
|
||||
}
|
||||
|
||||
api.initialize = function (root) {
|
||||
getRoots(root).forEach(initializeRoot);
|
||||
getRoots(root).forEach(function (bitacoraRoot) {
|
||||
initializeRoot(bitacoraRoot);
|
||||
initializePaginationSlider(bitacoraRoot);
|
||||
});
|
||||
};
|
||||
|
||||
api.cancelPendingNavigation = function (root) {
|
||||
getRoots(root).forEach(function (bitacoraRoot) {
|
||||
var slider = bitacoraRoot.querySelector(
|
||||
'.js-sig-bitacora-grid-pagination-slider'
|
||||
);
|
||||
|
||||
clearPaginationTimer(slider);
|
||||
});
|
||||
};
|
||||
|
||||
api.showModal = function (id) {
|
||||
@@ -145,9 +343,15 @@
|
||||
|
||||
window.SIG_BITACORA_GRID_PARTIAL_INITIALIZED = true;
|
||||
|
||||
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(
|
||||
var requestManager =
|
||||
Sys.WebForms.PageRequestManager.getInstance();
|
||||
|
||||
requestManager.add_beginRequest(function () {
|
||||
api.cancelPendingNavigation(document);
|
||||
});
|
||||
|
||||
requestManager.add_endRequest(
|
||||
function (sender, args) {
|
||||
debugger
|
||||
var panels = null;
|
||||
if (args?.get_panelsUpdated) {
|
||||
panels = args.get_panelsUpdated();
|
||||
|
||||
@@ -130,4 +130,4 @@
|
||||
initializeOrderGrids(document);
|
||||
});
|
||||
}
|
||||
}(window, window.jQuery));
|
||||
}(window, window.jQuery));
|
||||
|
||||
@@ -1994,8 +1994,7 @@ function setwebservice(idDdlWS, idhdValue, idhdText, btn) {
|
||||
url: "/Ashx/SIGWeb.ashx",
|
||||
dataType: 'json',
|
||||
delay: 500,
|
||||
data: function (params) {
|
||||
debugger;
|
||||
data: function (params) {
|
||||
return {
|
||||
Name: params.term, // search term
|
||||
CveSubFamilia: (!(DdlWS.attr('data-idSubFamilia')) || DdlWS.attr('data-idSubFamilia') == '') ? ((!(DdlWS.data('subFamilia'))) ? DdlWS.data('subfamilia') : -2) : $('#' + DdlWS.attr('data-idSubFamilia') + ' option:selected').val(),
|
||||
|
||||
@@ -723,8 +723,7 @@ function CerrarVentana() {
|
||||
window.parent.$("#ajax").modal('hide');
|
||||
}
|
||||
showPopup = function (div_id, width, height) {
|
||||
//Generar URL para thickbox
|
||||
debugger;
|
||||
//Generar URL para thickbox
|
||||
var thickboxURL = "#TB_inline?height=" + height + "&width=" + width + "&inlineId=" + div_id + ""; //&modal=true
|
||||
//Llamar a método de thickbox que muestra un popup con la URL generada
|
||||
tb_show(null, thickboxURL, null);
|
||||
|
||||
@@ -901,8 +901,7 @@ NOTAS ADSISTEMAS:
|
||||
}
|
||||
|
||||
function scrollVertical(y, isWheel, isClick, isCustom) {
|
||||
var delta = y;
|
||||
//debugger;
|
||||
var delta = y;
|
||||
var maxTop = panelitemcontent.outerHeight() - verticalbar.outerHeight() - opt.arrowsize;
|
||||
|
||||
if (isWheel || isClick) {
|
||||
|
||||
@@ -91,7 +91,31 @@
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-default">
|
||||
<li><asp:LinkButton ID="BtnLogout" runat="server" OnClick="BtnLogout_Click"><i class="icon-key"></i> Log out</asp:LinkButton></li>
|
||||
<li>
|
||||
<a href="<%= ResolveUrl("~/Pages/Security/Perfil.aspx") %>">
|
||||
<i class="icon-user"></i>
|
||||
Mi perfil
|
||||
</a>
|
||||
</li>
|
||||
<li id="LiCambiarUsuario" runat="server">
|
||||
<asp:LinkButton ID="BtnAbrirCambioUsuario"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnAbrirCambioUsuario_Click">
|
||||
<i class="icon-refresh"></i>
|
||||
Cambiar usuario
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnLogout"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnLogout_Click">
|
||||
<i class="icon-key"></i>
|
||||
Cerrar sesión
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -100,6 +124,91 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ModalCambiarUsuario"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="TituloModalCambiarUsuario"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Cerrar">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 id="TituloModalCambiarUsuario" class="modal-title">
|
||||
Cambiar usuario de la sesión
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<asp:Label ID="LblCambioUsuario"
|
||||
runat="server"
|
||||
Visible="false" />
|
||||
|
||||
<div class="form-inline" style="margin-bottom: 15px;">
|
||||
<asp:TextBox ID="TxtBuscarUsuarioCambio"
|
||||
runat="server"
|
||||
CssClass="form-control input-medium"
|
||||
MaxLength="150"
|
||||
placeholder="Usuario, correo o cliente" />
|
||||
<asp:Button ID="BtnBuscarUsuarioCambio"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
CausesValidation="false"
|
||||
Text="Buscar"
|
||||
OnClick="BtnBuscarUsuarioCambio_Click" />
|
||||
</div>
|
||||
|
||||
<asp:GridView ID="GvUsuariosCambio"
|
||||
runat="server"
|
||||
AutoGenerateColumns="false"
|
||||
GridLines="None"
|
||||
CssClass="table table-striped table-hover Widthall"
|
||||
DataKeyNames="CveUsuario"
|
||||
EmptyDataText="No se encontraron usuarios."
|
||||
OnRowCommand="GvUsuariosCambio_RowCommand">
|
||||
<Columns>
|
||||
<asp:BoundField
|
||||
DataField="NombreUsuario"
|
||||
HeaderText="Usuario" />
|
||||
<asp:BoundField
|
||||
DataField="CorreoElectronico"
|
||||
HeaderText="Correo" />
|
||||
<asp:BoundField
|
||||
DataField="NombreRol"
|
||||
HeaderText="Rol" />
|
||||
<asp:BoundField
|
||||
DataField="Cliente"
|
||||
HeaderText="Cliente" />
|
||||
<asp:TemplateField HeaderText="Acción">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnSeleccionarUsuario"
|
||||
runat="server"
|
||||
CssClass="btn btn-xs green"
|
||||
CausesValidation="false"
|
||||
CommandName="SeleccionarUsuario"
|
||||
CommandArgument='<%# Eval("CveUsuario") %>'>
|
||||
Usar usuario
|
||||
</asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn default"
|
||||
data-dismiss="modal">
|
||||
Cerrar
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="page-container">
|
||||
|
||||
@@ -1,18 +1,33 @@
|
||||
using SIG.Web.AppCode.Configuration;
|
||||
using SIG.Web.AppCode.Infrastructure.WebForms;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.Security;
|
||||
using SIG.Web.AppCode.Services.Logging;
|
||||
using SIG.Web.AppCode.Session;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace SIG.Web
|
||||
{
|
||||
public partial class Site : MasterPage, IGlobalErrorPresenter
|
||||
{
|
||||
private List<UsuarioCambioContextoModel> UsuariosCambioActuales
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["UsuariosCambioActuales"]
|
||||
as List<UsuarioCambioContextoModel>
|
||||
?? new List<UsuarioCambioContextoModel>();
|
||||
}
|
||||
set { ViewState["UsuariosCambioActuales"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
@@ -32,11 +47,14 @@ namespace SIG.Web
|
||||
return;
|
||||
}
|
||||
|
||||
user = NormalizarSesionActual(user);
|
||||
|
||||
HdnCveE.Value = user.CveEmpresa.ToString();
|
||||
HdnCveU.Value = user.CveUsuario.ToString();
|
||||
|
||||
LitTit.Text = HtmlText(System.Configuration.ConfigurationManager.AppSettings["AppTitle"] ?? "SIG");
|
||||
LtlUserName.Text = HtmlText(user.Nombre ?? user.NombreUsuario ?? "Usuario");
|
||||
LiCambiarUsuario.Visible = user.PuedeCambiarUsuario;
|
||||
|
||||
IReadOnlyList<MenuItemModel> menuItems = AppServices.MenuProvider.GetMenu(user);
|
||||
LtlMenu.Text = BuildMenu(menuItems);
|
||||
@@ -44,6 +62,38 @@ namespace SIG.Web
|
||||
BindNotifications(user);
|
||||
}
|
||||
|
||||
private UserSessionModel NormalizarSesionActual(
|
||||
UserSessionModel usuarioSesion)
|
||||
{
|
||||
if (usuarioSesion.CveUsuarioOriginal > 0)
|
||||
{
|
||||
return usuarioSesion;
|
||||
}
|
||||
|
||||
usuarioSesion.CveUsuarioOriginal =
|
||||
usuarioSesion.CveUsuario;
|
||||
usuarioSesion.CveRolOriginal = usuarioSesion.CveRol;
|
||||
usuarioSesion.EsAdmin = usuarioSesion.CveRol == 1;
|
||||
usuarioSesion.PuedeCambiarUsuario =
|
||||
usuarioSesion.CveRol == 1 ||
|
||||
usuarioSesion.CveRol == 2;
|
||||
|
||||
DbResult<PerfilUsuarioConsultaModel> resultadoPerfil =
|
||||
AppServices.PerfilUsuarioService.ObtenerPerfil(
|
||||
usuarioSesion);
|
||||
|
||||
if (resultadoPerfil.Success &&
|
||||
resultadoPerfil.Data != null &&
|
||||
resultadoPerfil.Data.Sesion != null)
|
||||
{
|
||||
usuarioSesion.CveCliente =
|
||||
resultadoPerfil.Data.Sesion.CveCliente;
|
||||
}
|
||||
|
||||
AppServices.UserContext.SetCurrentUser(usuarioSesion);
|
||||
return usuarioSesion;
|
||||
}
|
||||
|
||||
public void SetPageNavigation(string title, IEnumerable<BreadcrumbItemModel> items)
|
||||
{
|
||||
string safeTitle = string.IsNullOrWhiteSpace(title) ? Page.Title : title.Trim();
|
||||
@@ -271,6 +321,129 @@ namespace SIG.Web
|
||||
Context.ApplicationInstance.CompleteRequest();
|
||||
}
|
||||
|
||||
protected void BtnAbrirCambioUsuario_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
TxtBuscarUsuarioCambio.Text = string.Empty;
|
||||
CargarUsuariosCambio();
|
||||
}
|
||||
|
||||
protected void BtnBuscarUsuarioCambio_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
CargarUsuariosCambio();
|
||||
}
|
||||
|
||||
protected void GvUsuariosCambio_RowCommand(
|
||||
object sender,
|
||||
GridViewCommandEventArgs e)
|
||||
{
|
||||
if (!string.Equals(
|
||||
e.CommandName,
|
||||
"SeleccionarUsuario",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UserSessionModel usuarioSesion =
|
||||
AppServices.UserContext.GetCurrentUser();
|
||||
int cveUsuarioSeleccionado;
|
||||
|
||||
if (usuarioSesion == null ||
|
||||
!usuarioSesion.PuedeCambiarUsuario ||
|
||||
!int.TryParse(
|
||||
Convert.ToString(
|
||||
e.CommandArgument,
|
||||
CultureInfo.InvariantCulture),
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out cveUsuarioSeleccionado) ||
|
||||
!UsuariosCambioActuales.Any(
|
||||
usuario =>
|
||||
usuario.CveUsuario == cveUsuarioSeleccionado))
|
||||
{
|
||||
MostrarErrorCambioUsuario(
|
||||
"Seleccione un usuario válido.");
|
||||
MostrarModalCambioUsuario();
|
||||
return;
|
||||
}
|
||||
|
||||
DbResult<UserSessionModel> resultado =
|
||||
AppServices.PerfilUsuarioService.CambiarUsuario(
|
||||
usuarioSesion,
|
||||
cveUsuarioSeleccionado);
|
||||
|
||||
if (!resultado.Success || resultado.Data == null)
|
||||
{
|
||||
MostrarErrorCambioUsuario(
|
||||
resultado.Success
|
||||
? "No fue posible cambiar el usuario de la sesión."
|
||||
: resultado.UserMessage);
|
||||
MostrarModalCambioUsuario();
|
||||
return;
|
||||
}
|
||||
|
||||
AppServices.UserContext.SetCurrentUser(resultado.Data);
|
||||
Response.Redirect("~/Inicio.aspx", false);
|
||||
Context.ApplicationInstance.CompleteRequest();
|
||||
}
|
||||
|
||||
private void CargarUsuariosCambio()
|
||||
{
|
||||
UserSessionModel usuarioSesion =
|
||||
AppServices.UserContext.GetCurrentUser();
|
||||
|
||||
if (usuarioSesion == null ||
|
||||
!usuarioSesion.PuedeCambiarUsuario)
|
||||
{
|
||||
Response.Redirect("~/AccessDenied.aspx", false);
|
||||
Context.ApplicationInstance.CompleteRequest();
|
||||
return;
|
||||
}
|
||||
|
||||
DbResult<List<UsuarioCambioContextoModel>> resultado =
|
||||
AppServices.PerfilUsuarioService.ListarUsuariosCambio(
|
||||
usuarioSesion,
|
||||
TxtBuscarUsuarioCambio.Text);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
UsuariosCambioActuales =
|
||||
new List<UsuarioCambioContextoModel>();
|
||||
MostrarErrorCambioUsuario(resultado.UserMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
UsuariosCambioActuales = resultado.Data ??
|
||||
new List<UsuarioCambioContextoModel>();
|
||||
LblCambioUsuario.Visible = false;
|
||||
}
|
||||
|
||||
GvUsuariosCambio.DataSource = UsuariosCambioActuales;
|
||||
GvUsuariosCambio.DataBind();
|
||||
MostrarModalCambioUsuario();
|
||||
}
|
||||
|
||||
private void MostrarErrorCambioUsuario(string mensaje)
|
||||
{
|
||||
LblCambioUsuario.Text = HtmlText(mensaje);
|
||||
LblCambioUsuario.CssClass = "alert alert-warning";
|
||||
LblCambioUsuario.Visible = true;
|
||||
}
|
||||
|
||||
private void MostrarModalCambioUsuario()
|
||||
{
|
||||
ScriptManager.RegisterStartupScript(
|
||||
Page,
|
||||
GetType(),
|
||||
"MostrarModalCambiarUsuario",
|
||||
"$('#ModalCambiarUsuario').modal('show');",
|
||||
true);
|
||||
}
|
||||
|
||||
protected void smMain_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
|
||||
{
|
||||
ExceptionLogger.Log(e.Exception, "SiteMaster.AsyncPostBackError");
|
||||
@@ -291,4 +464,4 @@ namespace SIG.Web
|
||||
TipoMensaje.MsgError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user