diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index 83ca8fdb9..ae6256b6b 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -3542,16 +3542,16 @@ Public Class ClsCompras Public Function GetVinculacionRNC(UUID As String, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_Comp_ComprasMedicosRemove") + DataAdapter("PA_Comp_VinculacionRNCGet") With SqlAdapter.SelectCommand.Parameters .Add("@UUID", SqlDbType.VarChar).Value = UUID - .Add("@CveMedico", SqlDbType.Int).Value = CveEmpresa + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al eliminar gasto de médico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al obtener las remisiones de nota de crédito relacionadas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno End Function diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 3b125265b..4e0ef922e 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -2973,6 +2973,20 @@ Public Class ClsGenerales End Try Return Retorno End Function + + Public Function GetSATDIOTTipoOperacion() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_SAT_DIOT_TipoOperacionGet") + With SqlAdapter.SelectCommand.Parameters + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los tipos de operacion del SAT-DIOT", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function Public Function GetSATUnidadesAduana() As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_SAT_UnidadAduanaGet") diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index e0e8b665d..f014d0ed2 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -325,7 +325,7 @@ Public Class ClsInventarios End Function Public Function GetRepAlmacenes(FechaInicio As String, FechaFin As String, CveEmpresa As Integer, CveTipoAlmacen As String, Contabilizable As Integer, Inventariable As Integer, Optional SoloMovimientosContables As Boolean = False, Optional Almacenes As String = "-1", Optional CveSubProyecto As Integer = -1, - Optional CveUsuarioConsulta As Integer = -1) As Boolean + Optional CveUsuarioConsulta As Integer = -1, Optional Gpo As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_AlmacenesRepGet") @@ -340,6 +340,7 @@ Public Class ClsInventarios .Add("@Almacenes", SqlDbType.VarChar).Value = Almacenes .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@Gpo", SqlDbType.Int).Value = Gpo End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index afc719fed..4cad5571a 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -5,8 +5,8 @@ Option Strict On Imports System Imports System.Data Imports System.Data.SqlClient -Imports Extensiones - +Imports Extensiones + Public Class ClsMovimientos Implements IDisposable @@ -1580,51 +1580,91 @@ Public Class ClsMovimientos #End Region #Region "REP RECUPERACION" - Public Function GetRepRecuperacion(FechaI As Date, FechaF As Date, CveCliente As Integer, CveSubProyecto As Integer, - CveVendedor As Integer, CveUsuario As Integer, CveEstatus As Integer, IVA As String, - CveEmpresa As Integer, Gpo As Integer, CveResponsable As Integer, - Optional TipoDocto As String = "-1", Optional CveProyecto As Integer = -1, - Optional EstatusCliente As Integer = -1, Optional CveUsuarioConsulta As Integer = -1, - Optional CveBanco As Integer = -1, Optional CveCuenta As Integer = -1, - Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional CveClienteClasificacion As Integer = -1, - Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = MinFecha, Optional FechaAplicadoF As Date = MaxFecha, - Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, - Optional CveCondicionesPago As Integer = -1, Optional CveTipoTransaccion As Integer = -1, Optional CveMoneda As Integer = -1, Optional CveSubProyectoCobranza As Integer = -1) As Boolean + Public Function GetRepRecuperacion(FechaI As Date, FechaF As Date, FechaIEjec As Date, FechaFEjec As Date, CveCliente As Integer, CveSubProyectoEjecucion As Integer, + CveVendedor As String, CveUsuario As Integer, CveEstatus As String, IVA As String, CveEmpresa As Integer, Gpo As Integer, Optional TipoDocto As String = "-1", + Optional CveProyecto As Integer = -1, Optional CveSubProyecto As String = "-1", Optional TipoCambio As Integer = 1, Optional TCEspecifico As Decimal = -1, Optional CveUsuarioConsulta As Integer = -1, + Optional CveClienteClasificacion As Integer = -1, Optional CveCondicionesPago As Integer = -1, Optional TipoCliente As Integer = -1, Optional ModalidadContable As Boolean = False, + Optional EsDistribuidor As Integer = -1, Optional CveTipoRelacion As Integer = -1, Optional ServicioDomicilio As Integer = -1, Optional EsFacturaGlobal As Integer = -1, Optional EsFilial As Integer = -1, + Optional CveResponsable As Integer = -1, Optional CveBanco As Integer = -1, Optional EstatusCliente As Integer = -1, + Optional CveCuenta As Integer = -1, Optional CveTipoTransaccion As Integer = -1, + Optional FechaAplicadoI As Date = MinFecha, Optional FechaAplicadoF As Date = MaxFecha, + Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, Optional CveMoneda As Integer = -1, Optional CveSubProyectoCobranza As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_RepRecuperacion") SqlAdapter.SelectCommand.CommandTimeout = 0 - With SqlAdapter.SelectCommand.Parameters - .Add("@CveResponsable", SqlDbType.Int).Value = CveResponsable - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveVendedor", SqlDbType.VarChar).Value = CveVendedor - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@IVA", SqlDbType.VarChar).Value = IVA - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@GPO", SqlDbType.Int).Value = Gpo - .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto - .Add("@CveEstatusCliente", SqlDbType.Int).Value = EstatusCliente - .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta - .Add("@CveBanco", SqlDbType.Int).Value = CveBanco - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio - .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico - .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion - .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor - .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - - .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString - .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString - - .Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString - .Add("@FechaRegistroIEF", SqlDbType.Date).Value = FechaRegistroIEF.ToShortDateString + With SqlAdapter.SelectCommand.Parameters + 'PARAMETROS BASE + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@FechaIEjec", SqlDbType.Date).Value = FechaIEjec + .Add("@FechaFEjec", SqlDbType.Date).Value = FechaFEjec + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSubProyectoEjecucion", SqlDbType.Int).Value = CveSubProyectoEjecucion + .Add("@CveVendedor", SqlDbType.VarChar).Value = CveVendedor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEstatus", SqlDbType.VarChar).Value = CveEstatus + .Add("@IVA", SqlDbType.VarChar).Value = IVA + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@GPO", SqlDbType.Int).Value = Gpo + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@CveSubProyecto", SqlDbType.VarChar).Value = CveSubProyecto + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion + .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago + .Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente + .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@ModalidadContable", SqlDbType.Bit).Value = ModalidadContable + .Add("@CveTipoRelacion", SqlDbType.Int).Value = CveTipoRelacion + .Add("@ServicioDomicilio", SqlDbType.Int).Value = ServicioDomicilio + .Add("@EsFacturaGlobal", SqlDbType.Int).Value = EsFacturaGlobal + .Add("@EsFilial", SqlDbType.Int).Value = EsFilial + 'PARAMETROS EXTRA + .Add("@CveResponsable", SqlDbType.Int).Value = CveResponsable + .Add("@CveBanco", SqlDbType.Int).Value = CveBanco + .Add("@CveEstatusCliente", SqlDbType.Int).Value = EstatusCliente + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString + .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString + + .Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString + .Add("@FechaRegistroIEF", SqlDbType.Date).Value = FechaRegistroIEF.ToShortDateString .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@CveSubProyectoCobranza", SqlDbType.Int).Value = CveSubProyectoCobranza + .Add("@CveSubProyectoCobranza", SqlDbType.Int).Value = CveSubProyectoCobranza + + '.Add("@FechaI", SqlDbType.Date).Value = FechaI + '.Add("@FechaF", SqlDbType.Date).Value = FechaF + '.Add("@CveCliente", SqlDbType.Int).Value = CveCliente + '.Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + '.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + '.Add("@CveVendedor", SqlDbType.VarChar).Value = CveVendedor + '.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + '.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + '.Add("@IVA", SqlDbType.VarChar).Value = IVA + '.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + '.Add("@GPO", SqlDbType.Int).Value = Gpo + '.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + '.Add("@CveEstatusCliente", SqlDbType.Int).Value = EstatusCliente + '.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + + '.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + '.Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + '.Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + '.Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion + '.Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + '.Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago + '.Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + + '.Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString + '.Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString + + '.Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString + '.Add("@FechaRegistroIEF", SqlDbType.Date).Value = FechaRegistroIEF.ToShortDateString + '.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + '.Add("@CveSubProyectoCobranza", SqlDbType.Int).Value = CveSubProyectoCobranza End With Try SqlAdapter.Fill(Data) @@ -1671,55 +1711,98 @@ Public Class ClsMovimientos End Try Return Retorno End Function - Public Function GetRepRecuperacionDetalle(FechaI As Date, FechaF As Date, CveCliente As Integer, CveSubProyecto As Integer, - CveVendedor As Integer, CveUsuario As Integer, CveClienteSucursal As Integer, - CveEstatus As Integer, IVA As String, Agrupador As Integer, CveEmpresa As Integer, - CveResponsable As Integer, Optional TipoDocto As String = "-1", Optional CveProyecto As Integer = -1, - Optional CveUsuarioConsulta As Integer = -1, Optional CveBanco As Integer = -1, - Optional CveCuenta As Integer = -1, Optional Grupo As String = "-1", - Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, - Optional CveMoneda As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional Tipo As Integer = -1, - Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = Nothing, Optional FechaAplicadoF As Date = Nothing, - Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, - Optional CveCondicionesPago As Integer = -1, Optional CveTipoTransaccion As Integer = -1, Optional CveSubProyectoCobranza As Integer = -1) As Boolean + Public Function GetRepRecuperacionDetalle(FechaI As Date, FechaF As Date, FechaIEjec As Date, FechaFEjec As Date, CveCliente As Integer, CveSubProyectoEjecucion As Integer, + CveVendedor As String, CveUsuario As Integer, CveEstatus As String, IVA As String, CveEmpresa As Integer, Gpo As Integer, Optional TipoDocto As String = "-1", + Optional CveProyecto As Integer = -1, Optional CveSubProyecto As String = "-1", Optional TipoCambio As Integer = 1, Optional TCEspecifico As Decimal = -1, Optional CveUsuarioConsulta As Integer = -1, + Optional CveClienteClasificacion As Integer = -1, Optional CveCondicionesPago As Integer = -1, Optional TipoCliente As Integer = -1, Optional ModalidadContable As Boolean = False, + Optional EsDistribuidor As Integer = -1, Optional CveTipoRelacion As Integer = -1, Optional ServicioDomicilio As Integer = -1, Optional EsFacturaGlobal As Integer = -1, Optional EsFilial As Integer = -1, + Optional CveResponsable As Integer = -1, Optional CveBanco As Integer = -1, Optional EstatusCliente As Integer = -1, + Optional CveCuenta As Integer = -1, Optional CveTipoTransaccion As Integer = -1, + Optional FechaAplicadoI As Date = MinFecha, Optional FechaAplicadoF As Date = MaxFecha, + Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, Optional CveMoneda As Integer = -1, Optional CveSubProyectoCobranza As Integer = -1, + Optional CveClienteSucursal As Integer = -1, Optional Tipo As Integer = -1, Optional Grupo As String = "") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_RepRecuperacionDetalle") - With SqlAdapter.SelectCommand.Parameters - - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveVendedor", SqlDbType.VarChar).Value = CveVendedor - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@IVA", SqlDbType.VarChar).Value = IVA - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@GPO", SqlDbType.Int).Value = Agrupador - .Add("@CveResponsable", SqlDbType.Int).Value = CveResponsable - .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto - .Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal - .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta - .Add("@CveBanco", SqlDbType.Int).Value = CveBanco - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@Grupo", SqlDbType.VarChar).Value = Grupo - .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio - .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion - .Add("@Tipo", SqlDbType.Int).Value = Tipo - .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor - .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - - .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString - .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString - .Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString + With SqlAdapter.SelectCommand.Parameters + 'PARAMETROS BASE + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@FechaIEjec", SqlDbType.Date).Value = FechaIEjec + .Add("@FechaFEjec", SqlDbType.Date).Value = FechaFEjec + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSubProyectoEjecucion", SqlDbType.Int).Value = CveSubProyectoEjecucion + .Add("@CveVendedor", SqlDbType.VarChar).Value = CveVendedor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEstatus", SqlDbType.VarChar).Value = CveEstatus + .Add("@IVA", SqlDbType.VarChar).Value = IVA + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@GPO", SqlDbType.Int).Value = Gpo + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@CveSubProyecto", SqlDbType.VarChar).Value = CveSubProyecto + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion + .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago + .Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente + .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@ModalidadContable", SqlDbType.Bit).Value = ModalidadContable + .Add("@CveTipoRelacion", SqlDbType.Int).Value = CveTipoRelacion + .Add("@ServicioDomicilio", SqlDbType.Int).Value = ServicioDomicilio + .Add("@EsFacturaGlobal", SqlDbType.Int).Value = EsFacturaGlobal + .Add("@EsFilial", SqlDbType.Int).Value = EsFilial + 'PARAMETROS EXTRA + .Add("@CveResponsable", SqlDbType.Int).Value = CveResponsable + .Add("@CveBanco", SqlDbType.Int).Value = CveBanco + .Add("@CveEstatusCliente", SqlDbType.Int).Value = EstatusCliente + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString + .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString + + .Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString .Add("@FechaRegistroIEF", SqlDbType.Date).Value = FechaRegistroIEF.ToShortDateString - .Add("@CveSubProyectoCobranza", SqlDbType.Int).Value = CveSubProyectoCobranza + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@CveSubProyectoCobranza", SqlDbType.Int).Value = CveSubProyectoCobranza + .Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal + .Add("@Tipo", SqlDbType.Int).Value = Tipo + .Add("@Grupo", SqlDbType.VarChar).Value = Grupo + + '.Add("@FechaI", SqlDbType.Date).Value = FechaI + '.Add("@FechaF", SqlDbType.Date).Value = FechaF + '.Add("@CveCliente", SqlDbType.Int).Value = CveCliente + '.Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + '.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + '.Add("@CveVendedor", SqlDbType.VarChar).Value = CveVendedor + '.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + '.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + '.Add("@IVA", SqlDbType.VarChar).Value = IVA + '.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + '.Add("@GPO", SqlDbType.Int).Value = Agrupador + '.Add("@CveResponsable", SqlDbType.Int).Value = CveResponsable + '.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + '.Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal + '.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + '.Add("@CveBanco", SqlDbType.Int).Value = CveBanco + '.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + '.Add("@Grupo", SqlDbType.VarChar).Value = Grupo + '.Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + '.Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + '.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + '.Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion + '.Add("@Tipo", SqlDbType.Int).Value = Tipo + '.Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + '.Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago + '.Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + + '.Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString + '.Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString + '.Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString + '.Add("@FechaRegistroIEF", SqlDbType.Date).Value = FechaRegistroIEF.ToShortDateString + '.Add("@CveSubProyectoCobranza", SqlDbType.Int).Value = CveSubProyectoCobranza End With Try diff --git a/App_Code/ClsOP.vb b/App_Code/ClsOP.vb index 16b22fa7b..8688a3969 100644 --- a/App_Code/ClsOP.vb +++ b/App_Code/ClsOP.vb @@ -2,6 +2,7 @@ Imports System.Data Imports System.Data.SqlClient Imports Microsoft.VisualBasic +Imports Telerik.Web.UI.ImageEditor Public Class ClsOP Implements IDisposable @@ -112,7 +113,55 @@ Public Class ClsOP Public Function GetProductosOP(CveOP As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_OP_ProductosGET") + DataAdapter("PA_OP_ProductosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetProductosMO(CveOP As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_ProductosMOGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetProductosMP(CveOP As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_ProductosMPGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetProductosCI(CveOP As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_ProductosCIGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveOP", SqlDbType.Int).Value = CveOP .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa @@ -359,7 +408,7 @@ Public Class ClsOP #Region "O R D E N E S D E P R O D U C C I O N" - Public Function GetReportesOP(CveOP As Integer, CveCliente As Integer, CveSubProyecto As Integer, CvePS As Integer, CveEstatus As Integer, Asignado As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer) As Boolean + Public Function GetReportesOP(CveOP As Integer, CveCliente As Integer, CveSubProyecto As Integer, CvePS As Integer, CveEstatus As Integer, Asignado As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OP_OrdendeProduccionGet") With SqlAdapter.SelectCommand.Parameters @@ -369,8 +418,8 @@ Public Class ClsOP .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus .Add("@Asignado", SqlDbType.Int).Value = Asignado - .Add("@FechaI", SqlDbType.Date).Value = FechaInicio - .Add("@FechaF", SqlDbType.Date).Value = FechaFin + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try @@ -382,6 +431,75 @@ Public Class ClsOP Return Retorno End Function + Public Function GetOP(CveOP As Integer, CveCliente As Integer, CveSubProyecto As Integer, CvePS As Integer, CveEstatus As Integer, Asignado As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_OrdendeProduccionGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@Asignado", SqlDbType.Int).Value = Asignado + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetEstatusOP(CveEmpresa As Integer, Optional CveEstatusOP As Integer = -1, Optional TipoEstatus As Integer = -1, Optional Estatus As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OP_EstatusOPGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveEstatusOP", SqlDbType.Int).Value = CveEstatusOP + .Add("@TipoEstatus", SqlDbType.Int).Value = TipoEstatus + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los Estatus de Factura.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateOP(CveOP As Integer, Descripcion As String, CveCliente As Integer, CvePS As Integer, CveSubProyecto As Integer, Cantidad As Integer, Fecha As Date, CveEmpresa As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_OrdendeProduccionUp") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Cantidad", SqlDbType.Int).Value = Cantidad + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar la orden de producción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + + #End Region #Region "IDisposable Support" ' IDisposable diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index b9c0c104c..ddd289dc0 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -403,6 +403,33 @@ Public Class ClsPaginas Application("GlobalDTEstatus") = value End Set End Property + +#Region "ordenes de producción" + Property GlobalDTOPEstatus(CveEmpresa As Integer, Optional Estatus As Integer = -1) As DataTable + Get + Dim AppNombre As String = $"GlobalDTOPEstatus-{CveEmpresa}" + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Using ObjOP As New ClsOP + If ObjOP.GetEstatusOP(CveEmpresa) Then Application(AppNombre) = ObjOP.DtResultados + End Using + End If + Dim filtros As New List(Of String) + If Estatus <> -1 Then filtros.Add($"Estatus = {Estatus}") + + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) + GlobalDTOPEstatus = Dv.ToTable + Dv.Dispose() + Else + GlobalDTOPEstatus = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = $"GlobalDTOPEstatus-{CveEmpresa}" + Application(AppNombre) = value + End Set + End Property +#End Region Property DtFacturaDefault() As DataTable Get DtFacturaDefault = DirectCast(Application("DtFacturaDefault"), DataTable) @@ -561,6 +588,22 @@ Public Class ClsPaginas HttpContext.Current.Application(AppNombre) = value End Set End Property + + Property GlobalDTDIOTTipoOperacion() As DataTable + Get + Dim AppNombre As String = "GlobalDTDIOTTipoOperacion" + If Application(AppNombre) Is Nothing Then + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetSATDIOTTipoOperacion() Then Application(AppNombre) = ObjGrales.DtResultados + ObjGrales.Dispose() + End If + GlobalDTDIOTTipoOperacion = DirectCast(Application(AppNombre), DataTable) + End Get + Set(value As DataTable) + Dim AppNombre As String = "GlobalDTDIOTTipoOperacion" + Application(AppNombre) = value + End Set + End Property Property GlobalDTGralPaises() As DataTable Get Dim AppNombre As String = "GlobalDTGralPaises" @@ -9892,6 +9935,7 @@ Public Class ClsPaginas PaginaDict.Add("/OI/ConvocatoriaDetalle.aspx".ToUpper(), 908) PaginaDict.Add("/OI/RepReuniones.aspx".ToUpper(), 908) PaginaDict.Add("/AdSistemasTeam/ProcedimientosAlmacenados.aspx".ToUpper(), -1) + PaginaDict.Add("/OS/CatOrdenesServiciosCaracteristicas.aspx".ToUpper(), -1) PaginaDict.Add("/OS/CatOSCaracteristicasOpciones.aspx".ToUpper(), -1) PaginaDict.Add("/OS/CatSubTiposOrdenesServicios.aspx".ToUpper(), -1) @@ -11125,6 +11169,8 @@ Public Class ClsPaginas #Region "Ordenes de Produccion" PaginaDict.Add("/OP/CatConfiguracionProducto.aspx".ToUpper(), 790) PaginaDict.Add("/OP/RepOS.aspx".ToUpper(), 791) + PaginaDict.Add("/OP/OP.aspx".ToUpper(), -1) + PaginaDict.Add("/OP/RepOP.aspx".ToUpper(), -1) #End Region 'Antes de aquí. diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index 73bc2593f..86c935ff1 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -415,7 +415,7 @@ Public Class ClsProductosServicios Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1, Optional NombreComercial As String = "", Optional NotasAdicionales As String = "", Optional EcommerceEtiquetas As String = "", Optional ActivoEcommerce As Boolean = False, Optional EcommercePrecio As Decimal = 0, Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1", Optional ProductoExhibicion As Boolean = False, - Optional Imagen As String = "", Optional PorcentajeMinimoUtilidad As Decimal = 0, Optional CveSelectiva As Integer = -1) As Integer + Optional Imagen As String = "", Optional PorcentajeMinimoUtilidad As Decimal = 0, Optional CveSelectiva As Integer = -1, Optional UltimoCosto As Decimal = 0) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_ProductosServiciosAdd") @@ -527,6 +527,7 @@ Public Class ClsProductosServicios .Add("@Imagen", SqlDbType.VarChar).Value = Imagen .Add("@PorcentajeMinimoUtilidad", SqlDbType.Decimal).Value = PorcentajeMinimoUtilidad .Add("@CveSelectiva", SqlDbType.Int).Value = CveSelectiva + .Add("@UltimoCosto", SqlDbType.Money).Value = UltimoCosto End With Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 04f886a95..7fca6c177 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -7222,6 +7222,30 @@ Public Class ClsVentas End Try Return Retorno + End Function + + Public Function GetProcedimientoProductoListaPrecio(CveProcedimiento As Integer, CveEmpresa As Integer, CveCliente As Integer, CveSubProyecto As Integer, + CveClienteSucursal As Integer, CveTipoVenta As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProcedimientosProductosPLGet") + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal + .Add("@CveTipoVenta", SqlDbType.Int).Value = CveTipoVenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los Productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function Public Function RemoveProcedimientoProducto(CveProcedimientoProducto As Integer, CveEmpresa As Integer) As Boolean diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 4fd95269a..fe022d55c 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -1742,7 +1742,7 @@ Namespace Extensiones Dim TmpDr As DataRow = Nothing If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - If RowFilter <> "" Then + If RowFilter <> "" OrElse Orderby <> "" Then Dim Dv As New DataView(dt, RowFilter, Orderby, DataViewRowState.CurrentRows) If Dv.ToTable.Rows.Count > 0 Then TmpDr = Dv.ToTable.Rows(Dv.ToTable.Rows.Count - 1) diff --git a/Bancos/CuentasBancariasDetalle.aspx.vb b/Bancos/CuentasBancariasDetalle.aspx.vb index 5aee71c2e..ce0870a00 100644 --- a/Bancos/CuentasBancariasDetalle.aspx.vb +++ b/Bancos/CuentasBancariasDetalle.aspx.vb @@ -454,6 +454,7 @@ Partial Class Bancos_CuentasBancariasDetalle Row("CveCuenta") = DTUsuarios.Rows.Count + 1 Row("CveUsuario") = DdlUsuarios.SelectedValue.ToEntero Row("Nombre") = DdlUsuarios.SelectedItem.Text.ToString + Row("Usuario") = DdlUsuarios.SelectedItem.Text.ToString DTUsuarios.Rows.Add(Row) End If GVU.DataSource = DTUsuarios @@ -492,7 +493,8 @@ Partial Class Bancos_CuentasBancariasDetalle DTUsuarios = New DataTable DTUsuarios.Columns.Add("CveCuenta", GetType(Integer)) ' Consecutivo en este caso DTUsuarios.Columns.Add("CveUsuario", GetType(Integer)) - DTUsuarios.Columns.Add("Nombre", GetType(String)) + DTUsuarios.Columns.Add("Nombre", GetType(String)) + DTUsuarios.Columns.Add("Usuario", GetType(String)) End Sub Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVU.RowDeleting Dim ObjBancos As New ClsBancos diff --git a/Bancos/FluctuacionCambiaria.aspx.vb b/Bancos/FluctuacionCambiaria.aspx.vb index 2076a6b21..b5664eab5 100644 --- a/Bancos/FluctuacionCambiaria.aspx.vb +++ b/Bancos/FluctuacionCambiaria.aspx.vb @@ -668,6 +668,7 @@ Partial Class Bancos_FluctuacionCambiaria 'End If tTipoMovto = dr("TipoMovto").ToString.ToBool If TipoFluctuacion.Contiene(3) AndAlso tTipoMovto Then AjusteTotal = -AjusteTotal 'si es cleintes, abonado y el ajustes es positivo tiene que restar + If TipoFluctuacion.Contiene(1) AndAlso tTipoMovto = False Then AjusteTotal = -AjusteTotal 'si es prov, cargado y el ajustes es positivo tiene que restar AjusteTotal = AjusteTotal + dr("Importe").ToString.ToDecimal diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 2c5693387..a74d504d2 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -888,6 +888,8 @@ Partial Class Bancos_ProveedoresAbonar CompraActual.UsuarioActual = UsuarioActual CompraActual.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero + + 'Importe de pago Pago.ImportePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal 'Tipos de cambio @@ -941,15 +943,15 @@ Partial Class Bancos_ProveedoresAbonar If descuentoParts.Length = 0 Then Descuento = 0 Else - - For i As Integer = 0 To descuentoParts.Length - 1 - Dim descuentoPart As Decimal = descuentoParts(i).Trim().ToDecimal - If descuentoPart > 0 Then - Descuento = Descuento + ((TotalTemp - Descuento) * (descuentoPart / 100)) - Else - Continue For - End If - Next + Descuento = gvr.DataKey("Saldo").ToString.ToDecimal - gvr.FCTextBox("TxtAbonar").Text.ToDecimal + 'For i As Integer = 0 To descuentoParts.Length - 1 + ' Dim descuentoPart As Decimal = descuentoParts(i).Trim().ToDecimal + ' If descuentoPart > 0 Then + ' Descuento = Descuento + ((TotalTemp - Descuento) * (descuentoPart / 100)) + ' Else + ' Continue For + ' End If + 'Next End If @@ -970,7 +972,7 @@ Partial Class Bancos_ProveedoresAbonar FolioRNC = serieFolioArray(0) End If - Descuento = Descuento.RoundSQL(2) + 'Descuento = Descuento.RoundSQL(2) If PorcentajeIVA > 0 Then Descuento = ((Descuento) / (1 + PorcentajeIVA)) @@ -1169,6 +1171,7 @@ Partial Class Bancos_ProveedoresAbonar IDPoliza = 0 End If + If Not TieneError Then ObjIE.Commit() @@ -2022,12 +2025,12 @@ Partial Class Bancos_ProveedoresAbonar Dim IVARNC As Decimal = (ImporteRNC * PorcentajeIVA).RoundSQL(2) Dim TotalRNC As Decimal = (ImporteRNC + IVARNC).RoundSQL(2) - CompraRNC.ConfiguraRegistroRapido(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNC.RoundSQL(2), IVARNC, TotalRNC, PorcentajeIVA) + CompraRNC.ConfiguraRegistroRapido(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNC, IVARNC, TotalRNC, PorcentajeIVA) If CompraRNC.AddCompra(sqltransaccion) Then - Dim tImporteRNC = (ImporteRNC + IVARNC).RoundSQL(2) ' le agrego el importe del iva + 'Dim tImporteRNC = (ImporteRNC + IVARNC).RoundSQL(2) ' le agrego el importe del iva Dim Pago As New CompraPago - Pago.ImportePago = tImporteRNC + Pago.ImportePago = TotalRNC Pago.CveMonedaPago = CompraActual.CveMoneda Pago.CveCompraAmortizacion = CompraRNC.CveCompra Pago.Referencia = CompraRNC.SerieFolio @@ -2713,7 +2716,7 @@ Public Class ClsCompraManagerComprasCA Me.CveRetISRConcepto = -1 Me.CveTipoPoliza = 3 Me.NumeroReembolso = "" - Me.SubTotal = SubTotal + Me.SubTotal = SubTotal.RoundSQL Me.IVA = IVA Me.Total = Total Me.PorcentajeIVA = PorcentajeIVA @@ -3664,7 +3667,7 @@ Public Class ClsCompraManagerComprasCA 'HACEMOS CALCULOS LocalSubTotalIVA = TmpDT.SUMD("IVA") LocalSubTotalIEPSIVA = TmpDT.SUMD("IEPSPSIVA") - LocalSubTotal = (TmpDT.SUMD("Total") + TmpDT.SUMD("Descuento")).RoundSQL(8) + LocalSubTotal = (TmpDT.SUMD("Total") + TmpDT.SUMD("Descuento")).RoundSQL(2) LocalRetIVA = TmpDT.SUMD("RetIVA") LocalRetISR = TmpDT.SUMD("RetISR") LocalIEPSPS = TmpDT.SUMD("IEPSPS") diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 033be19eb..241e90e0d 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -8488,7 +8488,7 @@ Partial Class Compras_Compras Dim DiferenciaRetISR As Decimal = TxtRetISR.Text.ToDecimal - RetISRDetalles If Math.Abs(DiferenciaRetISR) > 0 Then - If Math.Abs(DiferenciaRetISR) <= 0.05 Then + If Math.Abs(DiferenciaRetISR) <= 0.09 Then Dim DTConsulta As New DataTable DTConsulta = TmpDT.FiltraParametros(" RetISR > 0 ") @@ -8512,12 +8512,17 @@ Partial Class Compras_Compras If Math.Abs(DiferenciaRetISR) > 0.0D Then - If (TmpDT.Rows(IndiceUltimo)("RetISR").ToString.ToDecimal + DiferenciaRetISR) < 0 Then + If (TmpDT.Rows(IndiceUltimo)("RetISR").ToString.ToDecimal + DiferenciaRetISR) < 0 Or (Math.Abs(DiferenciaRetISR) >= 0.06) Then Dim AjusteteDividido As Decimal = Math.Abs(DiferenciaRetISR) / CantidadRegistroConRetISR For Each dRow As DataRow In TmpDT.Rows - dRow("RetISR") = dRow("RetISR").ToString.ToDecimal - AjusteteDividido + If DiferenciaRetISR > 0 Then + dRow("RetISR") = dRow("RetISR").ToString.ToDecimal + AjusteteDividido + Else + dRow("RetISR") = dRow("RetISR").ToString.ToDecimal - AjusteteDividido + End If + Next Else @@ -22668,7 +22673,20 @@ Partial Class Compras_Compras nRow("SubTotal") = subtotalParcial.RoundSQL(4) nRow("Total") = totalParcialDeseado.RoundSQL(4) - nRow("PorcentajeIVA") = (ivaParcial / subtotalParcial).RoundSQL(2) + + + Dim tmpPorcentajeIVA As Decimal = 0 + If ivaParcial > 0 Then + tmpPorcentajeIVA = (ivaParcial / subtotalParcial).RoundSQL(2) + If tmpPorcentajeIVA = 0.17 Or tmpPorcentajeIVA = 0.15 Then + tmpPorcentajeIVA = 0.16D + End If + If tmpPorcentajeIVA = 0.07 Or tmpPorcentajeIVA = 0.09 Then + tmpPorcentajeIVA = 0.16D + End If + End If + + nRow("PorcentajeIVA") = tmpPorcentajeIVA nRow("Porcentaje") = ((totalParcialDeseado.RoundSQL(4) * 100) / TotalOriginal).RoundSQL(2) nRow("RetIVAPorcentaje") = (retIvaParcial / subtotalParcial).RoundSQL(4) diff --git a/Compras/Proveedores.aspx b/Compras/Proveedores.aspx index 1801c70c2..81079cc46 100644 --- a/Compras/Proveedores.aspx +++ b/Compras/Proveedores.aspx @@ -799,20 +799,19 @@
+ + +
Tipo Tercero:
- + - - - - - - + + @@ -833,11 +832,16 @@
Tipo Operación:
- + + + + + + @@ -864,7 +868,9 @@
-
+ + +
diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index e5548a436..51eeafbab 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -908,6 +908,7 @@ Partial Class Compras_Proveedores 'DIOT CargaDIOTPais() DDlDIOTTipoTercero.SelectedValueExist(ObjProveedor.DIOTCveTipoTercero) + CargaTipoTransaccion() DdlDIOTTipoOperacion.SelectedValueExist(ObjProveedor.DIOTCveTipoOperacion) TxtDIOTNumIDFiscal.Text = ObjProveedor.DIOTNumeroIDFiscal DdlDIOTPais.SelectedValueExist(ObjProveedor.DIOTCvePais) @@ -5876,6 +5877,27 @@ Partial Class Compras_Proveedores End If End Sub + + Protected Sub DDlDIOTTipoTercero_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaTipoTransaccion() + End Sub + + + Private Sub CargaTipoTransaccion() + Dim Filtro As String = "" + Select Case DDlDIOTTipoTercero.SelectedValue + Case "1" + Filtro = "AplicaProvNacional = 1" + Case "2" + Filtro = "AplicaProvExtranjero = 1" + Case "5" + Filtro = "AplicaProvGlobal = 1" + End Select + + DdlDIOTTipoOperacion.DataSource = GlobalDTDIOTTipoOperacion.FiltraParametros(Filtro) + DdlDIOTTipoOperacion.DataBind() + End Sub + End Class diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 11748af36..d57e53051 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -231,11 +231,7 @@ - - -   Prueba - - +
@@ -315,7 +311,7 @@
- + @@ -323,9 +319,18 @@
-
- -
+
+ +
+ + + + + <%-- + --%> +
+
@@ -452,15 +457,7 @@
- - - - - - - -
diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index a8be99ea4..55db2884b 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -839,6 +839,10 @@ Partial Class Compras_eFacturas InicializaDTProrrateoGasolina() + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + VinculacionAutomaticaRNC() + End If + End If removeasincevent() End Sub @@ -5797,7 +5801,7 @@ Partial Class Compras_eFacturas If CompraActual.ConfiguraRegistroCompra(DdlPS.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, CveCajachica, CvePersonal, DdlRetIVAConcepto.SelectedValue.ToEntero, DdlRetISRConcepto.SelectedValue.ToEntero, NumeroReembolso:=TxtNumeroReembolso.Text, - DTProrrateo:=DTProrrateo, DTPagosDeudores:=DTPagosDeudores) Then + DTProrrateo:=DTProrrateo, DTPagosDeudores:=DTPagosDeudores, Observaciones:=TxtObservaciones.Text) Then If CompraActual.AddCompra(Objcompras.IniciaTransacSQL()) Then Contador = Contador + 1 Else @@ -6075,9 +6079,7 @@ Partial Class Compras_eFacturas - Protected Sub LnkRegistroRNC_Click(sender As Object, e As EventArgs) - VinculacionAutomaticaRNC() - End Sub + Private Sub VinculacionAutomaticaRNC() @@ -6098,7 +6100,7 @@ Partial Class Compras_eFacturas Dim CFDIXmlPath As String = $"{UsuarioActual.Empresa.Ruta}Compras\{GvRow.DataKey("RFCDe")}\{GvRow.DataKey("XML")}" If Not File.Exists(CFDIXmlPath) Then - ErrorProceso = True + 'ErrorProceso = True Continue For End If @@ -6146,7 +6148,7 @@ Partial Class Compras_eFacturas DTProrrateo:=New DataTable, DTPagosDeudores:=New DataTable, TipoComprobante:="E") Then If CompraActual.AddCompra(Objcompras.IniciaTransacSQL()) Then - Contador = Contador + 1 + ' Else ErrorProceso = True ErrorProcesoStr = CompraActual.MensajeError @@ -6167,11 +6169,11 @@ Partial Class Compras_eFacturas Dim Concepto As String = GvRow.DataKey("SerieFolio") Dim TipoCambio As Decimal = GlobalTipoCambio(GvRow.DataKey("FechaFactura").ToDate).ToDecimal - For Each drRNC As GridViewRow In DT_RNC.Rows + For Each drRNC As DataRow In DT_RNC.Rows - Dim ImporteRNCSaldar As Decimal = drRNC.DataKey("Saldo").ToDecimal - Dim CveCompraRNC As Integer = drRNC.DataKey("CveCompra").ToEntero + Dim ImporteRNCSaldar As Decimal = drRNC("Saldo").ToString.ToDecimal + Dim CveCompraRNC As Integer = drRNC("CveCompra").ToString.ToEntero If ImporteRNCSaldar > TotalSaldo Then ImporteRNCSaldar = TotalSaldo If Not ErrorProceso Then @@ -6194,6 +6196,7 @@ Partial Class Compras_eFacturas If Not ErrorProceso Then TotalSaldo = TotalSaldo - ImporteRNCSaldar + Contador = Contador + 1 End If End If @@ -6204,52 +6207,6 @@ Partial Class Compras_eFacturas End If - - 'If RBLContado.SelectedValue.ToEntero = 4 Then 'Deudores - ' Dim CompraActualPagar = New Compra - ' If Objcompras.GetCompras(CompraActual.CveCompra, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then - ' If Objcompras.DtResultados IsNot Nothing AndAlso Objcompras.DtResultados.Rows.Count > 0 Then - ' Dim dr As DataRow = Objcompras.DtResultados.Rows(0) - - - ' CompraActualPagar.CveCompra = CompraActual.CveCompra - ' CompraActualPagar.CveTipoConceptoProveedor = dr("CveTipoConcepto").ToString.ToEntero - ' CompraActualPagar.CveProveedor = dr("CveProveedor").ToString.ToEntero - ' CompraActualPagar.CveMoneda = dr("CveMoneda").ToString.ToEntero - ' CompraActualPagar.Fecha = dr("Fecha").ToString.ToDate - ' CompraActualPagar.SerieFolio = dr("SerieFolio").ToString - ' 'CompraActualPagar.ProveedorNombre = TxtPagueseA.Text - ' CompraActualPagar.TC = dr("TipoCambio").ToString.ToDecimal - ' CompraActualPagar.Total = dr("Total").ToString.ToDecimal - ' CompraActualPagar.IVA = dr("IVA").ToString.ToDecimal - ' CompraActualPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal.RoundSQL - ' CompraActualPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal.RoundSQL - ' CompraActualPagar.IEPS = dr("IEPS").ToString.ToDecimal - ' CompraActualPagar.RetIVA = dr("RetIVA").ToString.ToDecimal - ' CompraActualPagar.RetISR = dr("RetISR").ToString.ToDecimal - ' CompraActualPagar.CveConceptoRetIVA = dr("CveRetIVAConcepto").ToString.ToEntero - ' CompraActualPagar.CveConceptoRetISR = dr("CveRetISRConcepto").ToString.ToEntero - ' CompraActualPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal - ' CompraActualPagar.UsuarioActual = UsuarioActual - ' CompraActualPagar.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero - ' CompraActualPagar.EsImportacion = CBool(dr("EsImportacion")) - ' CompraActualPagar.CompraNoDeducible = dr("NoDeducible").ToString.ToEntero - - - - ' Else - ' ErrorProceso = True - ' End If - ' Else - ' ErrorProceso = True - ' End If - - - - - - 'End If - End If If ErrorProceso Then Exit For @@ -6258,14 +6215,14 @@ Partial Class Compras_eFacturas If ErrorProceso Then Objcompras.RollBack() - Alert($"Se registraron {Contador} Compras. error {ErrorProcesoStr}", TipoMensaje.MsgAdvertencia) + Alert($"Se preento un error al reigistrar las notas de crédito", TipoMensaje.MsgAdvertencia) Else Objcompras.Commit() CargaDatos(NowADS()) CambieDeudor() CargaDatos(NowADS()) If Contador > 0 Then - Alert($"Se registraron {Contador} Compras") + GuardaLog($"Se registraron {Contador} notas de crédito") End If End If @@ -6917,7 +6874,7 @@ Public Class ClsCompraManager End Sub Public Function ConfiguraRegistroCompra(CvePS As Integer, CveSubProyecto As Integer, CveCajaChica As Integer, CvePersonal As Integer, CveRetIVAConcepto As Integer, CveRetISRConcepto As Integer, NumeroReembolso As String, DTProrrateo As DataTable, - DTPagosDeudores As DataTable, Optional TipoComprobante As String = "") As Boolean + DTPagosDeudores As DataTable, Optional TipoComprobante As String = "", Optional Observaciones As String = "") As Boolean Dim respuesta As Boolean = True Me.CveSubProyecto = CveSubProyecto @@ -6929,6 +6886,7 @@ Public Class ClsCompraManager Me.CveTipoPoliza = 3 Me.NumeroReembolso = NumeroReembolso Me.DTPagosDeudores = DTPagosDeudores + Me.Observaciones = Observaciones If TipoComprobante.Length > 0 Then Me.TipoComprobante = TipoComprobante @@ -8276,7 +8234,14 @@ Public Class ClsCompraManager If respuesta Then importeMovimiento = Me.Total importeMN = (importeMovimiento * Me.TipoCambio).RoundSQL - Dim ConPreP As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(1, Me.CveMoneda, False, Me.CveTipoConceptoProveedor) + + Dim TipoSaldo As Integer = 1 + + If TipoComprobante = "E" Then + TipoSaldo = 15 + End If + + Dim ConPreP As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(TipoSaldo, Me.CveMoneda, False, Me.CveTipoConceptoProveedor) Dim ImporteME As Decimal = importeMovimiento Dim UsaComplementaria As Boolean = True If Me.CveMoneda > 1 Then ImporteME = importeMovimiento diff --git a/Contabilidad/RepIVA.aspx b/Contabilidad/RepIVA.aspx index 9ba2ebace..3f452be28 100644 --- a/Contabilidad/RepIVA.aspx +++ b/Contabilidad/RepIVA.aspx @@ -241,7 +241,7 @@ <%-- --%> - SubTotal
0%
+ SubTotal
0%
diff --git a/Contabilidad/RepIVA.aspx.cs b/Contabilidad/RepIVA.aspx.cs index e562cfbc1..ac8f7ced2 100644 --- a/Contabilidad/RepIVA.aspx.cs +++ b/Contabilidad/RepIVA.aspx.cs @@ -84,66 +84,73 @@ public partial class Contabilidad_RepIVA : ClsPaginas if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; } int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); LblMsgAcreditable.Text = ""; // lbl de mensajes de negativos - - ClsContabilidad ObjCont = new ClsContabilidad(); - if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, DdlCuenta.SelectedValue.ToEntero(), Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) + + if (TT.ActiveTabIndex == 0) { - GvT.DataSource = ObjCont.DtResultados; - DtIVATrasladado = ObjCont.DtResultados; + ClsContabilidad ObjCont = new ClsContabilidad(); + if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, DdlCuenta.SelectedValue.ToEntero(), Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) + { + GvT.DataSource = ObjCont.DtResultados; + DtIVATrasladado = ObjCont.DtResultados; - if (UsuarioActual.Empresa.Funcionalidad(713) == "1") - { - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + if (UsuarioActual.Empresa.Funcionalidad(713) == "1") { - GvIEPSA.DataSource = ObjCont.DtResultados; - DtIEPSA = ObjCont.DtResultados; + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIEPSA.DataSource = ObjCont.DtResultados; + DtIEPSA = ObjCont.DtResultados; + } + } + + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIVAA.DataSource = ObjCont.DtResultados; + DtIVAA = ObjCont.DtResultados; + } + + } + ObjCont.Dispose(); + GvIEPSA.DataBind(); + GvIVAA.DataBind(); + GvT.DataBind(); + } + if (TT.ActiveTabIndex == 1) + { + ClsContabilidad ObjCont = new ClsContabilidad(); + if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, DdlCuenta.SelectedValue.ToEntero(), Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) + { + GvA.DataSource = ObjCont.DtResultados; + DtIVAAcreditable = ObjCont.DtResultados; + if (DtIVAAcreditable.FiltraParametros("IVA < 0 OR IEPS < 0 ").Rows.Count > 0) + { + LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT"; + } + //GvA.Columns[11].Visible = DtIVAAcreditable.SUM("valorActosImp1516") > 0; // sino tiene valor la columna de importación de oculta + + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIVA2.DataSource = ObjCont.DtResultados; + } + + if (UsuarioActual.CveEmpresa == 119) + { + divRetIVA.Visible = true; + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 4, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvRetIVA.DataSource = ObjCont.DtResultados; + } } } - - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvIVAA.DataSource = ObjCont.DtResultados; - DtIVAA = ObjCont.DtResultados; - } - - } - if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, DdlCuenta.SelectedValue.ToEntero(), Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) - { - GvA.DataSource = ObjCont.DtResultados; - DtIVAAcreditable = ObjCont.DtResultados; - if (DtIVAAcreditable.FiltraParametros("IVA < 0 OR IEPS < 0 ").Rows.Count > 0) - { - LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT"; - } - - //GvA.Columns[11].Visible = DtIVAAcreditable.SUM("valorActosImp1516") > 0; // sino tiene valor la columna de importación de oculta - - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvIVA2.DataSource = ObjCont.DtResultados; - } - - if (UsuarioActual.CveEmpresa == 119) - { - divRetIVA.Visible=true; - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 4, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvRetIVA.DataSource = ObjCont.DtResultados; - } - } - } - ObjCont.Dispose(); - GvT.DataBind(); - GvA.DataBind(); - GvIEPSA.DataBind(); - GvIVAA.DataBind(); - GvIVA2.DataBind(); - GvRetIVA.DataBind(); + ObjCont.Dispose(); + GvA.DataBind(); + GvIVA2.DataBind(); + GvRetIVA.DataBind(); + } + UpDatos.Update(); String Str = "Se Consultó el Reporte de IVA. - " + UsuarioActual.Usuario; Str.GuardaLog(); - } protected void BtnConsultar_Click(object sender, EventArgs e) @@ -336,7 +343,7 @@ public partial class Contabilidad_RepIVA : ClsPaginas if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, -1, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) { - if (txtFechaI.Text.ToDate().Year < 2025) // años anteriores al 2025 + if (txtFechaI.Text.ToDate() < "2024/12/31".ToDate()) // años anteriores al enero 2025 { foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0) { @@ -373,89 +380,68 @@ public partial class Contabilidad_RepIVA : ClsPaginas } else { - foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0) + foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 ").Rows) // and(IVA > 1 OR IEPS > 0) { SBDIOT.AppendLine( Drow["TipoTercero"].ToString() + "|" + Drow["TipoOperacion"].ToString() + "|" + - Drow["RFC"].ToString() + "|" + + Drow["RFC_DIOT"].ToString() + "|" + Drow["NumeroIDFiscal"].ToString() + "|" + Drow["NombreExtranjero"].ToString() + "|" + - Drow["PaisResidencia"].ToString() + "|" + - Drow["Nacionalidad"].ToString() + "|" + + Drow["PaisResidenciaFiscal"].ToString() + "|" + + Drow["Jurisdiccion"].ToString() + "|" + // 3.2 valor de los actos o actividades - LV(Drow["valorActosImp8"].ToString()) + "|" + // actos norte - LV(Drow["valorActosImp8"].ToString()) + "|" + // desc norte - LV(Drow["valorActosImp8"].ToString()) + "|" + // actos sur - LV(Drow["valorActosImp8"].ToString()) + "|" + // desc sur - LV(Drow["valorActosImp8"].ToString()) + "|" + // 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // desc 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // importacion 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // desc importacion 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // importacion intangibles 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // desc intangibles 16% + LV0(Drow["ActosFN"].ToString()) + "|" + // actos norte + LV0(Drow["ActosDevFN"].ToString()) + "|" + // desc norte + LV0(Drow["ActosFS"].ToString()) + "|" + // actos sur + LV0(Drow["ActosDevFS"].ToString()) + "|" + // desc sur + LV0(Drow["Actos16"].ToString()) + "|" + // 16% + LV0(Drow["ActosDev16"].ToString()) + "|" + // desc 16% + LV0(Drow["ActosImp16"].ToString()) + "|" + // importacion 16% + LV0(Drow["ActosImpDev16"].ToString()) + "|" + // desc importacion 16% + LV0(Drow["ActosImpNotan16"].ToString()) + "|" + // importacion intangibles 16% + LV0(Drow["ActosImpNotanDev16"].ToString()) + "|" + // desc intangibles 16% // 3.3 IVA Acreditable - LV(Drow["valorActosImp8"].ToString()) + "|" + // actos norte - LV(Drow["valorActosImp8"].ToString()) + "|" + // proporcion actos norte - LV(Drow["valorActosImp8"].ToString()) + "|" + // actos sur - LV(Drow["valorActosImp8"].ToString()) + "|" + // proporcion actos sur - LV(Drow["valorActosImp8"].ToString()) + "|" + // 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // proporcion 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // importacion 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // proporción importacion 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // intangibles 16% - LV(Drow["valorActosImp8"].ToString()) + "|" + // proporcion intangibles 16% + LV0(Drow["AcredFN"].ToString()) + "|" + // actos norte + LV0(Drow["AcreNoFN"].ToString()) + "|" + // proporcion actos norte + LV0(Drow["AcredFS"].ToString()) + "|" + // actos sur + LV0(Drow["AcredNoFS"].ToString()) + "|" + // proporcion actos sur + LV0(Drow["Acred16"].ToString()) + "|" + // 16% + LV0(Drow["AcredIva16"].ToString()) + "|" + // proporcion 16% + LV0(Drow["AcredImp16"].ToString()) + "|" + // importacion 16% + LV0(Drow["AcredNoImp16"].ToString()) + "|" + // proporción importacion 16% + LV0(Drow["AcredImpIntan16"].ToString()) + "|" + // intangibles 16% + LV0(Drow["AcredNoImpIntan16"].ToString()) + "|" + // proporcion intangibles 16% // 3.4 IVA NO Acreditable - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + + LV0(Drow["NoAcredFN"].ToString()) + "|" + + LV0(Drow["NoAcredNoFN"].ToString()) + "|" + + LV0(Drow["NoAcredExentaFN"].ToString()) + "|" + + LV0(Drow["NoAcredNoObjetoFN"].ToString()) + "|" + + LV0(Drow["NoAcredFS"].ToString()) + "|" + + LV0(Drow["NoAcredNoFS"].ToString()) + "|" + + LV0(Drow["NoAcredExentaFS"].ToString()) + "|" + + LV0(Drow["NoAcredNoObjetoFS"].ToString()) + "|" + + LV0(Drow["NoAcred16"].ToString()) + "|" + + LV0(Drow["NoAcredNo16"].ToString()) + "|" + + LV0(Drow["NoAcredExenta16"].ToString()) + "|" + + LV0(Drow["NoAcredNoObjeto16"].ToString()) + "|" + + LV0(Drow["NoAcredIntan16"].ToString()) + "|" + + LV0(Drow["NoAcredIntanNo16"].ToString()) + "|" + + LV0(Drow["NoAcredIntanExenta16"].ToString()) + "|" + + LV0(Drow["NoAcredIntanNoObjeto16"].ToString()) + "|" + + LV0(Drow["NoAcredImp16"].ToString()) + "|" + + LV0(Drow["NoAcredImpNo16"].ToString()) + "|" + + LV0(Drow["NoAcredImpExenta16"].ToString()) + "|" + + LV0(Drow["NoAcredImpNoObjeto16"].ToString()) + "|" + // 3.5 datos adicionales - LV(Drow["valorActosImp8"].ToString()) + "|" + // VA retenido por el contribuyente - LV(Drow["valorActosImp8"].ToString()) + "|" + //Actos o actividades pagados en la importación de bienes y servicios por los que no se pagara el IVA (Exentos) - LV(Drow["valorActosImp8"].ToString()) + "|" + // Actos o actividades pagados por los que no se pagará el IVA(Exentos) - LV(Drow["valorActosImp8"].ToString()) + "|" + // Demás actos o actividades pagados a la tasa del 0% - LV(Drow["valorActosImp8"].ToString()) + "|" + // Actos o actividades no objeto del IVA realizados en - LV(Drow["valorActosImp8"].ToString()) + "|" + // Actos o actividades no objeto del IVA por no contar on establecimiento en territorio nacion - LV(Drow["valorActosImp8"].ToString()) + "|"); // Manifiesto que se dio efectos fiscales a los comprobantes que amparan las operaciones realizadas con el proveedor - - //LV(Drow["valorActos1516"].ToString()) + "|" + - //LV(Drow["valorActos15"].ToString()) + "|" + - //LV(Drow["ValorIvaNo1516"].ToString()) + "|" + - - //LV(Drow["valorActos1011"].ToString()) + "|" + - //LV(Drow["valorActos10"].ToString()) + "|" + - //LV(Drow["valorActosImp8"].ToString()) + "|" + - //LV(Drow["ValorIvaNo10"].ToString()) + "|" + - //LV(Drow["ValorIvaNo08"].ToString()) + "|" + - - //LV(Drow["valorActosImp1516"].ToString()) + "|" + - //LV(Drow["ValorIvaNoImp16"].ToString()) + "|" + - - //LV(Drow["valorActosImp10"].ToString()) + "|" + - //LV(Drow["ValorIvaNoImp10"].ToString()) + "|" + - - //LV(Drow["IvaExentoImpo"].ToString()) + "|" + - //LV(Drow["IVACero"].ToString()) + "|" + - //LV(Drow["IvaExento"].ToString()) + "|" + - //LV(Drow["IvaRetenido"].ToString()) + "|" + - //LV(Drow["IvaDevoluciones"].ToString()) + "|"); + LV0(Drow["DAIvaRetenido"].ToString()) + "|" + // VA retenido por el contribuyente + LV0(Drow["DAIvaExentoImpo"].ToString()) + "|" + //Actos o actividades pagados en la importación de bienes y servicios por los que no se pagara el IVA (Exentos) + LV0(Drow["DAIvaExento"].ToString()) + "|" + // Actos o actividades pagados por los que no se pagará el IVA(Exentos) + LV0(Drow["DATasa0"].ToString()) + "|" + // Demás actos o actividades pagados a la tasa del 0% + LV0(Drow["DANoObjetoTN"].ToString()) + "|" + // Actos o actividades no objeto del IVA realizados en + LV0(Drow["DANoObjetoNoTN"].ToString()) + "|" + // Actos o actividades no objeto del IVA por no contar on establecimiento en territorio nacion + (Drow["DAManifiesto"].ToString())); // Manifiesto que se dio efectos fiscales a los comprobantes que amparan las operaciones realizadas con el proveedor + } } @@ -513,6 +499,10 @@ public partial class Contabilidad_RepIVA : ClsPaginas { return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : ""; } + protected string LV0(string Valor) + { + return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : "0"; + } protected void GvCompara_RowDataBound(object sender, GridViewRowEventArgs e) { diff --git a/Empresas/189/Formatos/Entradas.rdlc b/Empresas/189/Formatos/Entradas.rdlc index 2b765df5f..06dc666ac 100644 --- a/Empresas/189/Formatos/Entradas.rdlc +++ b/Empresas/189/Formatos/Entradas.rdlc @@ -2042,7 +2042,7 @@ - Capturo: + Capturó: + + + + Orden de Producción + + + + + + + + + + + +
+ +
+

Orden de producción #

+
+ + + +
+
+ +
+
+ + +
+
+ + +
+ +
+ + Proyecto: + +
+ +
+ + Subproyecto: + +
+ +
+
+ +
+ + +
+ + + +
+ + +
+
+ +
+
+
+ + + + +
+ + + + + + +
+
+ + +
+ +
+ +
+ + +
+ + + + +
+
+
Productos
+ + + + + + + +
+
+
+
+
Materia prima
+ + + + + + + + +
+
+ +
+
Mano de obra
+ + + + + + +
+ +
+
+
Costo indirecto
+ + + + + + +
+
+
+
+ + +
+ +
+
+
+
+
+ + + + + diff --git a/OP/OP.aspx.vb b/OP/OP.aspx.vb new file mode 100644 index 000000000..912e1f845 --- /dev/null +++ b/OP/OP.aspx.vb @@ -0,0 +1,407 @@ +Imports System.Data +Imports System.Drawing +Imports DocumentFormat.OpenXml.Drawing.Diagrams +Imports System.IO +Imports Extensiones +Imports Microsoft.Reporting.WebForms +Imports Org.BouncyCastle.Asn1.Utilities +Partial Class OP_OP + Inherits ClsPaginas + +#Region "Propiedades" + Private Property CveOP As Integer + Get + Return ViewState("CveOP").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveOP") = value + End Set + End Property + + Private Property DtPS As DataTable + Get + Return DirectCast(ViewState("DtPS"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtPS") = value + End Set + End Property + + Private Property DtMP As DataTable + Get + Return DirectCast(ViewState("DtMP"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMP") = value + End Set + End Property + + Private Property DtMO As DataTable + Get + Return DirectCast(ViewState("DtMO"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMO") = value + End Set + End Property + + Private Property DtCI As DataTable + Get + Return DirectCast(ViewState("DtCI"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtCI") = value + End Set + End Property + + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CveOP = If(Request("CveOP") <> "", Request("CveOP").ToString.ToEntero, "-1".ToEntero) + CreaPS() + SetValues() + End If + End Sub + + Private Sub CreaPS() + DtPS = New DataTable() + DtPS.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI + DtPS.Columns.Add("Clave", GetType(Integer)) + DtPS.Columns.Add("PSCodigo", GetType(String)) + DtPS.Columns.Add("UnidadMedida", GetType(String)) + DtPS.Columns.Add("Cantidad", GetType(Decimal)) + DtPS.Columns.Add("Surtido", GetType(Decimal)) + DtPS.Columns.Add("Costo", GetType(Decimal)) + + DtMP = New DataTable() + DtMP.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI + DtMP.Columns.Add("Clave", GetType(Integer)) + DtMP.Columns.Add("Producto", GetType(String)) + DtMP.Columns.Add("UnidadMedida", GetType(String)) + DtMP.Columns.Add("Cantidad", GetType(Decimal)) + DtMP.Columns.Add("Surtido", GetType(Decimal)) + + DtMO = New DataTable() + DtMO.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI + DtMO.Columns.Add("Clave", GetType(Integer)) + DtMO.Columns.Add("Puesto", GetType(String)) + DtMO.Columns.Add("Cantidad", GetType(Decimal)) + + DtCI = New DataTable() + DtCI.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI + DtCI.Columns.Add("Clave", GetType(Integer)) + DtCI.Columns.Add("Producto", GetType(String)) + DtCI.Columns.Add("Cantidad", GetType(Decimal)) + + + End Sub + + Private Sub SetValues() + + CargarClientes() + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) + CargarProductos() + + If CveOP = -1 Then + ' Modo registro: mostrar dropdowns y ocultar los TextBox + DdlClientes.Enabled = True + DdlProyecto.Enabled = True + DdlSubProyecto.Enabled = True + DdlPS.Enabled = True + + Else + DdlClientes.Enabled = False + DdlProyecto.Enabled = False + DdlSubProyecto.Enabled = False + DdlPS.Enabled = False + CargaDatos() + End If + End Sub + + Private Sub CargaDatos() + If CveOP > 0 Then + Dim ObjOP As New ClsOP() + If ObjOP.GetOP(CveOP, -1, -1, -1, -1, -1, MinFecha, MaxFecha, UsuarioActual.CveEmpresa) Then + Dim DTOP As DataTable = ObjOP.DtResultados + If DTOP.Rows.Count > 0 Then + Dim dr As DataRow = DTOP.Rows(0) + LblCveOP.Text = CveOP.ToString + DdlClientes.txtText.Value = dr("Cliente").ToString + DdlClientes.txtValue.Value = dr("CveCliente").ToString + TxtEstatus.Text = dr("Estatus").ToString + DdlSubProyecto.SelectedValue = dr("CveSubProyecto").ToString + DdlPS.txtText.Value = dr("Producto").ToString + DdlPS.txtValue.Value = dr("CvePS").ToString + Txtfecha.Text = dr("Fecha").ToString + TxtDescripcion.Text = dr("Descripcion").ToString + End If + End If + ObjOP.Dispose() + End If + End Sub + + Private Sub CargarClientes() + Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or + UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + If EsWS Then + DdlClientes.setEsWebService(True) + Else + DdlClientes.setEsWebService(False) + DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + DdlClientes.DataBind() + DdlClientes.ddl.Items.Insert(0, New ListItem("Seleccione Cliente", "-1")) + End If + End Sub + + Private Sub CargarProductos() + DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then + DdlPS.SelectedText = "" + DdlPS.SelectedValue = "-1" + Else + DdlPS.ddl.Items.Clear() + DdlPS.ddl.DataBind() + DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + End If + End Sub + + Protected Sub BtnAgregarProducto_Click(sender As Object, e As EventArgs) Handles BtnAgregarProducto.Click + If DdlPS.SelectedValue = "-1" Then Exit Sub + + Dim newRow As DataRow = DtPS.NewRow() + Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero + Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + + newRow("Tipo") = "Producto" + newRow("Clave") = CvePS + newRow("PSCodigo") = DrPS("PSCodigo") + newRow("UnidadMedida") = DrPS("UnidadMedida") + newRow("Cantidad") = 1 + newRow("Surtido") = 0 + newRow("Costo") = 0 + DtPS.Rows.Add(newRow) + 'consultas GetMPReceta, GetMOReceta, GetCIReceta + + + Dim CveUM As Integer = DrPS("CveUnidadMedida").ToString.ToEntero + + Dim ObjMP As New ClsOP() + If ObjMP.GetMPReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then + For Each drMP As DataRow In ObjMP.DtResultados.Rows + Dim rowMP As DataRow = DtMP.NewRow() + rowMP("Tipo") = "MP" + rowMP("Clave") = CvePS + rowMP("Producto") = drMP("productoMateriaPrima").ToString() + rowMP("UnidadMedida") = drMP("UnidadMedidaMateriaPrima").ToString() + rowMP("Cantidad") = drMP("Cantidad").ToString().ToDecimal() + rowMP("Surtido") = 0 + DtMP.Rows.Add(rowMP) + Next + End If + + + Dim ObjMO As New ClsOP() + If ObjMO.GetMOReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then + For Each drMO As DataRow In ObjMO.DtResultados.Rows + Dim rowMO As DataRow = DtMO.NewRow() + rowMO("Tipo") = "MO" + rowMO("Clave") = CvePS + rowMO("Puesto") = drMO("Puesto").ToString() + rowMO("Cantidad") = drMO("Cantidad").ToString().ToDecimal() + DtMO.Rows.Add(rowMO) + Next + End If + + + Dim ObjCI As New ClsOP() + If ObjCI.GetCIReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then + For Each drCI As DataRow In ObjCI.DtResultados.Rows + Dim rowCI As DataRow = DtCI.NewRow() + rowCI("Tipo") = "CI" + rowCI("Clave") = CvePS + rowCI("Producto") = drCI("productoMateriaPrima").ToString() + rowCI("Cantidad") = drCI("Cantidad").ToString().ToDecimal() + DtCI.Rows.Add(rowCI) + Next + End If + + ActualizarGrids() + End Sub + + Protected Sub BtnEliminarProducto_Click(sender As Object, e As EventArgs) + If DdlPS.SelectedValue = "-1" Then + Alert("Seleccione un producto del listado.", TipoMensaje.MsgAdvertencia) + Return + End If + + Dim CveProducto As Integer = DdlPS.SelectedValue.ToEntero() + + Dim filasProducto As DataRow() = DtPS.Select($"Clave = {CveProducto}") + If filasProducto.Length > 0 Then + DtPS.Rows.Remove(filasProducto(0)) + End If + + EliminarDatosRelacionados(CveProducto) + + ActualizarGrids() + End Sub + + Private Sub EliminarDatosRelacionados(CveProducto As Integer) + Dim filasMP As DataRow() = DtMP.Select($"Clave = {CveProducto}") + For Each fila As DataRow In filasMP + DtMP.Rows.Remove(fila) + Next + + Dim filasMO As DataRow() = DtMO.Select($"Clave = {CveProducto}") + For Each fila As DataRow In filasMO + DtMO.Rows.Remove(fila) + Next + + Dim filasCI As DataRow() = DtCI.Select($"Clave = {CveProducto}") + For Each fila As DataRow In filasCI + DtCI.Rows.Remove(fila) + Next + End Sub + + Protected Sub BtnGuardarOP_Click(sender As Object, e As EventArgs) + ' Validar campos obligatorios + If DdlClientes.SelectedValue = "-1" Then + Alert("Seleccione un cliente.", TipoMensaje.MsgAdvertencia) + Return + End If + + If DtPS.Rows.Count = 0 Then + Alert("Agregue al menos un producto.", TipoMensaje.MsgAdvertencia) + Return + End If + + ' Iniciar transacción + Dim clsOP As New ClsOP() + clsOP.IniciaTransacSQL() + + Try + ' Insertar/Actualizar cabecera de la OP usando UpdateOP + Dim CveOP As Integer = Me.CveOP ' Si es nuevo, CveOP = -1 + Dim Success As Boolean = clsOP.UpdateOP( + CveOP:=CveOP, + Descripcion:=TxtDescripcion.Text, + CveCliente:=DdlClientes.SelectedValue.ToEntero(), + CvePS:=DdlPS.SelectedValue.ToEntero(), + CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero(), + Cantidad:=1, ' Ajustar según lógica de negocio + Fecha:=Convert.ToDateTime(Txtfecha.Text), + CveEmpresa:=UsuarioActual.CveEmpresa, + CveUsuario:=UsuarioActual.CveUsuario + ) + + If Not Success Then + Throw New Exception("Error al guardar la cabecera de la OP.") + End If + + ' Obtener el CveOP generado (asumiendo que se actualiza en la propiedad) + If Me.CveOP = -1 Then + ' Si es nuevo, recuperar el CveOP de la base de datos + ' (Requiere que el SP PA_OP_OrdendeProduccionUp devuelva el ID) + ' Esto depende de la implementación del SP. + ' Ejemplo hipotético: + clsOP.GetOP(-1, DdlClientes.SelectedValue.ToEntero(), DdlSubProyecto.SelectedValue.ToEntero(), -1, -1, -1, MinFecha, MaxFecha, UsuarioActual.CveEmpresa) + If clsOP.DtResultados.Rows.Count > 0 Then + Me.CveOP = clsOP.DtResultados.Rows(0)("CveOP").ToString.ToEntero() + End If + End If + + ' Insertar detalles de Productos, MP, MO, CI + For Each drProducto As DataRow In DtPS.Rows + Dim CvePS As Integer = drProducto("Clave").ToString().ToEntero() + + ' Insertar Materia Prima relacionada + For Each drMP As DataRow In DtMP.Select($"Clave = {CvePS}") + clsOP.AddMP( + Cantidad:=drMP("Cantidad").ToString().ToDecimal(), + CvePS:=CvePS, + CvePSMateriaPrima:=drMP("CvePSMateriaPrima").ToString().ToEntero(), + CveUM:=drMP("CveUM").ToString().ToEntero(), + CveUMMateriaPrima:=drMP("CveUMMateriaPrima").ToString().ToEntero() + ) + Next + + ' Insertar Mano de Obra relacionada + For Each drMO As DataRow In DtMO.Select($"Clave = {CvePS}") + clsOP.AddMO( + Cantidad:=drMO("Cantidad").ToString().ToDecimal(), + CvePS:=CvePS, + CvePuesto:=drMO("CvePuesto").ToString().ToEntero(), + CveUM:=drMO("CveUM").ToString().ToEntero() + ) + Next + + ' Insertar Costos Indirectos relacionados + For Each drCI As DataRow In DtCI.Select($"Clave = {CvePS}") + clsOP.AddCI( + Cantidad:=drCI("Cantidad").ToString().ToDecimal(), + CvePS:=CvePS, + CvePSMateriaPrima:=drCI("CvePSMateriaPrima").ToString().ToEntero(), + CveUM:=drCI("CveUM").ToString().ToEntero(), + CveUMMateriaPrima:=drCI("CveUMMateriaPrima").ToString().ToEntero() + ) + Next + Next + + ' Commit si todo es exitoso + clsOP.Commit() + Alert("Orden de Producción guardada correctamente.", TipoMensaje.MsgInformacion) + Response.Redirect($"OP.aspx?CveOP={Me.CveOP}") ' Redirigir a la OP guardada + + Catch ex As Exception + ' Rollback en caso de error + clsOP.RollBack() + Alert($"Error al guardar: {ex.Message}", TipoMensaje.MsgError) + Finally + clsOP.Dispose() + End Try + End Sub + + Private Sub ActualizarGrids() + Dim dtProductosFiltrados As DataTable = DtPS.Clone() ' Clona la estructura + Dim rowsProductos As DataRow() = DtPS.Select("Tipo = 'Producto'") + If rowsProductos.Length > 0 Then + dtProductosFiltrados = rowsProductos.CopyToDataTable() + End If + GvProductos.DataSource = dtProductosFiltrados + GvProductos.DataBind() + + Dim dtMPFiltrados As DataTable = DtMP.Clone() + Dim rowsMP As DataRow() = DtMP.Select("Tipo = 'MP'") + If rowsMP.Length > 0 Then + dtMPFiltrados = rowsMP.CopyToDataTable() + End If + GvMateriaPrima.DataSource = dtMPFiltrados + GvMateriaPrima.DataBind() + + Dim dtMOFiltrados As DataTable = DtMO.Clone() + Dim rowsMO As DataRow() = DtMO.Select("Tipo = 'MO'") + If rowsMO.Length > 0 Then + dtMOFiltrados = rowsMO.CopyToDataTable() + End If + GvManoObra.DataSource = dtMOFiltrados + GvManoObra.DataBind() + + Dim dtCIFiltrados As DataTable = DtCI.Clone() + Dim rowsCI As DataRow() = DtCI.Select("Tipo = 'CI'") + If rowsCI.Length > 0 Then + dtCIFiltrados = rowsCI.CopyToDataTable() + End If + GvCostosIndirectos.DataSource = dtCIFiltrados + GvCostosIndirectos.DataBind() + + UpGvDatosOP.Update() + End Sub + + + +End Class + + diff --git a/OP/RepOP.aspx b/OP/RepOP.aspx new file mode 100644 index 000000000..43dfa4ed2 --- /dev/null +++ b/OP/RepOP.aspx @@ -0,0 +1,216 @@ +<%@ Page Title="Orden de Produccion" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepOP.aspx.vb" Inherits="OP_RepOP" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + +
+ <%-- --%> +
+
+
+
+ +
  • + Agregar Orden de Producción +
  • +
    + + Orden de Producción + + + + + + +
    +
    +
    + + +
    + +
    +
    + +
    + +
    + + + Proyecto: + +
    + +
    + + Subproyecto: + +
    + +
    + + +
    + + + +
    +
    +
    +
    + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + diff --git a/OP/RepOP.aspx.vb b/OP/RepOP.aspx.vb new file mode 100644 index 000000000..5522baed5 --- /dev/null +++ b/OP/RepOP.aspx.vb @@ -0,0 +1,161 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports Extensiones +Imports Ionic.Zlib +Imports Microsoft.Reporting.WebForms + +Partial Class OP_RepOP + Inherits ClsPaginas + +#Region "PROPIEDADES" + + Private Property DtOp As DataTable + Get + Return DirectCast(ViewState("DtOp"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtOp") = value + End Set + End Property + Private Property Agrupador As String + Get + Return ViewState("Agrupador").ToString + End Get + + Set(value As String) + ViewState("Agrupador") = value + End Set + End Property + Private Property TCEspecifico As Double + Get + Return ViewState("TCEspecifico").ToString.ToDouble + End Get + + Set(value As Double) + ViewState("TCEspecifico") = value + End Set + End Property + Private Property TipoCambio As Integer + Get + Return ViewState("TipoCambio").ToString.ToEntero + End Get + + Set(value As Integer) + ViewState("TipoCambio") = value + End Set + End Property + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx") + 'CargarMarcas() + SetValues() + End If + End Sub + + +#Region " CARGA DATOS INICIALES " + Private Sub SetValues() + 'Carga Productos + DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then + DdlPS.SelectedText = "" + DdlPS.SelectedValue = "-1" + Else + DdlPS.ddl.Items.Clear() + DdlPS.ddl.DataBind() + DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + End If + + 'CargaEstatus + DdlEstatusOP.DataSource = GlobalDTOPEstatus(UsuarioActual.CveEmpresa) + DdlEstatusOP.DataBind() + DdlEstatusOP.Items.Add(New ListItem("Canceladas", "4")) + DdlEstatusOP.SelectedValue = "-1" + + + 'Carga Clasificacion del cliente + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) + + Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + If EsWS Then + DdlClientes.setEsWebService(True) + Else + DdlClientes.setEsWebService(False) + DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + DdlClientes.DataBind() + DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + End If + + DdlEstatusOP.DataSource = GlobalDTOPEstatus(UsuarioActual.CveEmpresa) + DdlEstatusOP.DataBind() + + txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString + txtFechaF.Text = NowADS().ToShortDateString + + If UsuarioActual.TienePermisoProceso(339) Then + GvDatos.Columns(3).Visible = False + GvDatos.Columns(4).Visible = False + GvDatos.Columns(5).Visible = False + GvDatos.Columns(6).Visible = False + End If + + End Sub +#End Region + + +#Region " CARGA DATOS " + Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click + CargaDatos() + UPDatos.Update() + End Sub + + Private Sub CargaDatos() + Dim FechaI, FechaF As Date + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) + Dim CveCliente As Integer = If(DdlClientes.SelectedValue.ToEntero > 0, DdlClientes.SelectedValue.ToEntero, -1) + + Dim ObjOP As New ClsOP() + If ObjOP.GetReportesOP(-1, DdlClientes.SelectedValue.ToEntero, + DdlSubProyecto.SelectedValue.ToEntero, + DdlPS.SelectedValue.ToEntero, + DdlEstatusOP.SelectedValue.ToEntero, + -1, + FechaI, FechaF, + UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjOP.DtResultados + DtOp = ObjOP.DtResultados + + Else + GvDatos.DataSource = Nothing + End If + ObjOP.Dispose() + GvDatos.DataBind() + End Sub + +#End Region + +#Region "Gv Datos" + Protected Sub GvDatos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + 'Verificar si el DataKey existe + If e.Row.DataItem IsNot Nothing AndAlso GvDatos.DataKeys.Count > e.Row.RowIndex Then + Dim CveOP As Integer = GvDatos.DataKeys(e.Row.RowIndex).Value.ToString().ToEntero() + Dim Liga As String = $"/OP/OP.aspx?CveOP={CveOP}" + + 'Acceder al control solo si existe + Dim hl As HyperLink = TryCast(e.Row.FindControl("HlAgregarOrdenOP"), HyperLink) + If hl IsNot Nothing Then + hl.NavigateUrl = Liga + End If + End If + End If + End Sub +#End Region +End Class diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index efc45abbf..1b4ca41c4 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -8,6 +8,7 @@ Imports Microsoft.Reporting.WebForms Imports System.Globalization Imports System.Data.SqlTypes Imports DocumentFormat.OpenXml.Drawing.Diagrams +Imports Microsoft.AspNet.SignalR.Infrastructure Partial Class RH_Personal Inherits ClsPaginas @@ -1058,11 +1059,42 @@ Partial Class RH_Personal DVDdlTipoSangre.Visible = True End If + If Not CvePersonal > 0 Then + AsignaSiguienteCodigo() + End If + + End If AgregarEventosAsincronosGvVacaciones() End Sub + Private Sub AsignaSiguienteCodigo() + Dim ObjPersonal As New ClsRH() + If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then + Dim MaxCodigo As Integer = 1 + + If ObjPersonal.DtResultados.Rows.Count > 0 Then + MaxCodigo = ObjPersonal.DtResultados.AsEnumerable() _ + .Select(Function(row) + Dim codigoStr As String = row.Field(Of String)("Codigo") + If Not String.IsNullOrWhiteSpace(codigoStr) Then + Dim codigo As Integer + If Integer.TryParse(codigoStr, codigo) Then + Return codigo + End If + End If + Return 0 + End Function) _ + .DefaultIfEmpty(0) _ + .Max() + End If + + TxtCodigo.Text = (MaxCodigo + 1).ToString("000") + + End If + ObjPersonal.Dispose() + End Sub Private Sub LoadDefaultValues() DdlDepartamento.SelectedIndex = 1 diff --git a/SAT/SolicitudesIngresoSat.aspx b/SAT/SolicitudesIngresoSat.aspx index 7273d458d..19ef1498d 100644 --- a/SAT/SolicitudesIngresoSat.aspx +++ b/SAT/SolicitudesIngresoSat.aspx @@ -62,7 +62,7 @@ Solicitudes
  • - Caga XML Local + Cargar XML Local
  • @@ -481,9 +481,9 @@
    - + DataKeyNames="CveSolicitudDetalle,CveSolicitud,idSolicitud,idSolicitudCFDI,idSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa,ArchivoXML,Folio,CveTipoSolicitud,TipoDescargaStr"> @@ -534,10 +534,10 @@ - + - + @@ -567,7 +567,7 @@