diff --git a/AF/RepDepreciacion.aspx b/AF/RepDepreciacion.aspx index a6faf68bf..a988c3520 100644 --- a/AF/RepDepreciacion.aspx +++ b/AF/RepDepreciacion.aspx @@ -47,7 +47,7 @@ - + Depreciaciones diff --git a/Ashx/E48.ashx b/Ashx/E48.ashx index ad1fdc507..ae7947be3 100644 --- a/Ashx/E48.ashx +++ b/Ashx/E48.ashx @@ -39,12 +39,15 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState Dim RespuestaError As New FidelityAppsResponseError Dim TieneError As Boolean = False Dim JsonRequest As JObject = Nothing - Dim UsuarioActual As Usuario = ValidaUsuarioSistema(100, CveEmpresa) Dim ObjInventario As New ClsInventarios Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) Dim CveMovimiento As Integer = 0 Dim Mensaje As String = "" Dim SinExistencia As String = "No hay existencias suficientes del producto: " + Dim ObjUsuarios As New ClsSisUsuarios + Dim CveUsuario As Integer + Dim UsuarioActual As Usuario = ValidaUsuarioSistema(100, CveEmpresa) + Dim ErrorAC As Boolean = False Dim ErrorMovInv As Boolean = False @@ -68,238 +71,240 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState RespuestaError.Message = "Ocurrió un error al obtener el cuerpo de los parametros" End If - If Not TieneError AndAlso Not String.IsNullOrEmpty(JsonRequest("fecha")) AndAlso Not String.IsNullOrEmpty(JsonRequest("usuario")) AndAlso Not String.IsNullOrEmpty(JsonRequest("almacen")) AndAlso Not String.IsNullOrEmpty(JsonRequest("entrega")) AndAlso - Not String.IsNullOrEmpty(JsonRequest("observaciones")) AndAlso Not String.IsNullOrEmpty(JsonRequest("productos")) Then + If Not TieneError AndAlso Not String.IsNullOrEmpty(JsonRequest("fecha")) Then Dim Inv As New ClsInventarios Dim ObjProductosServicios As New ClsProductosServicios() Dim ObjContaAC As ClsContPAQi = Nothing Dim tFolio As Integer = Inv.GetFolioSiguiente(3, CveEmpresa) - Dim observaciones As String = JsonRequest("observaciones").ToString() + Dim observaciones As String = IIf(JsonRequest("observaciones").ToString() <> "", JsonRequest("observaciones").ToString(), "Salida Almacen") Dim CveAlmacen As Integer = 7 Dim IDPoliza As Integer = 0 - - Dim Fecha As Date = JsonRequest("fecha").ToString().ToDate Dim usuario As String = JsonRequest("usuario").ToString() + If ObjUsuarios.GetUsuariosEmpresas(-1) Then + CveUsuario = ObjUsuarios.DtResultados.FiltroPrimeroValor("CveUsuario", String.Format("Usuario = '{0}' ", usuario)).ToEntero + If CveUsuario > 0 Then + UsuarioActual = ValidaUsuarioSistema(CveUsuario, CveEmpresa) + Else + Mensaje = "No se encontro el usuario ingresado" + TieneError = True + End If + End If + Dim Fecha As Date = JsonRequest("fecha").ToString().ToDate Dim almacen As String = JsonRequest("almacen").ToString() Dim Recibe As String = JsonRequest("entrega").ToString() Dim GlobalDTInvConceptos As DataTable - Dim CveModalidad As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveModalidad").ToEntero() - - Dim EsContabilizable As Boolean = (CveModalidad = 1) + Dim EsContabilizable As Boolean = True If Inv.GetConceptos Then GlobalDTInvConceptos = Inv.DtResultados Else GlobalDTInvConceptos = Nothing - Try + If Not TieneError Then + Try + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ASHX/E48", 53, 0, 0, 1, Fecha, observaciones, UsuarioActual.CveUsuario, CveEmpresa, CveTipoPoliza:=3) + CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, tFolio, UsuarioActual.CveUsuario, CveEmpresa, -1, -1, -1, -1, Observaciones:=observaciones, Recibio:=Recibe, Modulo:="ASHX/E48") - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ASHX/E48", 53, 0, 0, 1, Fecha, observaciones, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) - CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=observaciones, Recibio:=Recibe, Modulo:="ASHX/E48") - - If CveMovimiento <= 0 OrElse CvePrePoliza <= 0 Then - RespuestaError.Message = "No se pudo almacenar el movimiento correctamente" - TieneError = True - ObjInventario.RollBack() 'deshace lo insertado - Else - - End If - - ''VALIDA EXISTENCIAS - Dim Cont As Integer = 0 - Dim ListaPS = JArray.Parse(JsonRequest("productos").ToString()) - - For Each JsonPS As JObject In ListaPS - - Dim Cantidad As Double = JsonPS("cantidad").ToString.ToDouble() - Dim CvePS As Integer = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString()).FiltroPrimeroValor("CvePS").ToEntero() - Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") - Dim CveUM As Integer - If ObjProductosServicios.GetPS(CvePS, -1, CveEmpresa) Then - If ObjProductosServicios.DtResultados.Rows.Count > 0 Then - CveUM = ObjProductosServicios.CveUnidadMedida.ToString.ToEntero - End If - End If - If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - Mensaje = "Error al guardar los movimientos" - RespuestaError.Message = Mensaje - - ErrorMovInv = True - Exit For - End If + If CveMovimiento <= 0 OrElse CvePrePoliza <= 0 Then + RespuestaError.Message = "No se pudo almacenar el movimiento correctamente" + TieneError = True + ObjInventario.RollBack() 'deshace lo insertado Else - If UsuarioActual.TienePermisoProceso(114) Then - If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then + + End If + + ''VALIDA EXISTENCIAS + Dim Cont As Integer = 0 + Dim ListaPS = JArray.Parse(JsonRequest("productos").ToString()) + + For Each JsonPS As JObject In ListaPS + + Dim Cantidad As Double = JsonPS("cantidad").ToString.ToDouble() + Dim CvePS As Integer = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString()).FiltroPrimeroValor("CvePS").ToEntero() + Dim DrPS As DataRow = GlobalDTPS(CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + Dim CveUM As Integer + If ObjProductosServicios.GetPS(CvePS, -1, CveEmpresa) Then + If ObjProductosServicios.DtResultados.Rows.Count > 0 Then + CveUM = ObjProductosServicios.CveUnidadMedida.ToString.ToEntero + End If + End If + If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then + + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then Mensaje = "Error al guardar los movimientos" - RespuestaError.Message = Mensaje + ErrorMovInv = True Exit For End If Else - SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString()) - RespuestaError.Message = SinExistencia - ErrorMovInv = True : Exit For + If UsuarioActual.TienePermisoProceso(114) Then + If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then + Mensaje = "Error al guardar los movimientos" + ErrorMovInv = True + Exit For + End If + Else + SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString()) + ErrorMovInv = True + End If + End If + Cont += 1 + Next + Mensaje = SinExistencia + 'Registro la prepóliza + If Not ErrorMovInv AndAlso ObjInventario.GetMovimientosDetalle(CveMovimiento, CveEmpresa) Then + Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL() + Dim tValorOtro As Decimal = tValorInventario + Dim idCtaContable As Integer = 0 + Dim IdCtaContableOtro As Integer = UsuarioActual.Empresa.IdCuentaOtrosIngresos + Dim TipoMovtoAlmacen As Boolean = False + Dim TipoMovtoOtro As Boolean = True + Dim tCveSubProyecto As Integer = -1 + + Dim drA2 As DataRow = GlobalDTAlmacen(CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen)) + If drA2 IsNot Nothing Then + idCtaContable = drA2("IdCtaContable").ToString.ToEntero + tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero End If - End If - Cont += 1 - Next - 'Registro la prepóliza - If Not ErrorMovInv AndAlso ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL() - Dim tValorOtro As Decimal = tValorInventario - Dim idCtaContable As Integer = 0 - Dim IdCtaContableOtro As Integer = UsuarioActual.Empresa.IdCuentaOtrosIngresos - Dim TipoMovtoAlmacen As Boolean = False - Dim TipoMovtoOtro As Boolean = True - Dim tCveSubProyecto As Integer = -1 - - Dim drA2 As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen)) - If drA2 IsNot Nothing Then - idCtaContable = drA2("IdCtaContable").ToString.ToEntero - tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero - End If + Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 3).ToEntero + If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True + TipoMovtoOtro = Not TipoMovtoAlmacen - Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 3).ToEntero - If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True - TipoMovtoOtro = Not TipoMovtoAlmacen - - Dim CveConceptoContable As Integer = 78 - Dim CveClasificacion As Integer = -1 + Dim CveConceptoContable As Integer = 78 + Dim CveClasificacion As Integer = -1 - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAlmacen, tValorInventario, observaciones, 68, observaciones, Fecha, idCtaContable, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=tValorInventario, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then - ErrorMovInv = True - Else - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoOtro, tValorOtro, observaciones, CveConceptoContable, observaciones, Fecha, IdCtaContableOtro, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=tValorOtro, CveSubProyecto:=tCveSubProyecto, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAlmacen, tValorInventario, observaciones, 68, observaciones, Fecha, idCtaContable, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=tValorInventario, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then ErrorMovInv = True - End If - 'End Select - End If - Else - ErrorMovInv = True - End If - - '------------------------------------------------ - If Not ErrorMovInv Then - 'DEVENGAR - Dim TotalPorDevengar As Double = 0 - - 'cuando tiene AC y es salida de almacen, se manda al gasto, solo aplica si el almacen es contable - If UsuarioActual.Empresa.UsaAC AndAlso EsContabilizable Then - Dim DtII As DataTable = Nothing - Dim TotalDetalle As Double = 0.0 - Dim Importe As Decimal = 0 - 'NOTA. CUANDO ES SALIDA, EN AUTOMATICO NO TENEMOS LOS VALORES DE LA SALIDA TODAVIA, Y POR ESO IMPORTE ES CERO, ES RECARGAR CON LOS DATOS YA INSERTADOS - - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - DtII = ObjInventario.DtResultados - End If - - TotalPorDevengar += Importe ' GvInv.Rows.Cast(Of GridViewRow)().Sum(Function(Gvr) Math.Round(Gvr.DataKey("PU").ToString.ToDouble, 4) * Math.Round(Gvr.DataKey("CantidadF").ToString.ToDouble, 4)) - TotalPorDevengar = Math.Round(TotalPorDevengar, 4) - ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) - ObjContaAC.IniciaTransacSQL() - - Dim AC As New ClsAC - Dim DtPresupuestos As DataTable = Nothing - If AC.GetPresupuestoEgresos(-1, True, UsuarioActual.Empresa.EjercicioActual, UsuarioActual.CveEmpresa) Then - DtPresupuestos = AC.DtResultados.Copy Else - Alert("Ocurrió un error al cargar los Presupuestos. Por favor vuelva a cargar la página", TipoMensaje.MsgError) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoOtro, tValorOtro, observaciones, CveConceptoContable, observaciones, Fecha, IdCtaContableOtro, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=tValorOtro, CveSubProyecto:=tCveSubProyecto, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then + ErrorMovInv = True + End If + 'End Select End If - AC.Dispose() + Else + ErrorMovInv = True + End If - IDPoliza = ObjContaAC.AddPoliza(3, "Salida de Almacen", TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, Fecha) + '------------------------------------------------ + If Not ErrorMovInv Then + 'DEVENGAR + Dim TotalPorDevengar As Double = 0 - If IDPoliza > 0 Then - Dim CuentaCargoCOG As Integer - Dim CuentaAbonoAlmacen As Integer = 0 - Dim drA As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen)) + 'cuando tiene AC y es salida de almacen, se manda al gasto, solo aplica si el almacen es contable + If UsuarioActual.Empresa.UsaAC AndAlso EsContabilizable Then + Dim DtII As DataTable = Nothing + Dim TotalDetalle As Double = 0.0 + Dim Importe As Decimal = 0 + 'NOTA. CUANDO ES SALIDA, EN AUTOMATICO NO TENEMOS LOS VALORES DE LA SALIDA TODAVIA, Y POR ESO IMPORTE ES CERO, ES RECARGAR CON LOS DATOS YA INSERTADOS - If drA IsNot Nothing Then CuentaAbonoAlmacen = drA("IdCtaContable").ToString.ToEntero - If UsuarioActual.CveEmpresa = 48 Then ' APH - CuentaCargoCOG = 1386 + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + DtII = ObjInventario.DtResultados End If - Dim ConceptoRenglon As String = "Salida de Almacen" + TotalPorDevengar += Importe ' GvInv.Rows.Cast(Of GridViewRow)().Sum(Function(Gvr) Math.Round(Gvr.DataKey("PU").ToString.ToDouble, 4) * Math.Round(Gvr.DataKey("CantidadF").ToString.ToDouble, 4)) + TotalPorDevengar = Math.Round(TotalPorDevengar, 4) + ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) + ObjContaAC.IniciaTransacSQL() + + Dim AC As New ClsAC + Dim DtPresupuestos As DataTable = Nothing + If AC.GetPresupuestoEgresos(-1, True, UsuarioActual.Empresa.EjercicioActual, UsuarioActual.CveEmpresa) Then + DtPresupuestos = AC.DtResultados.Copy + Else + Mensaje = "Ocurrió un error al cargar los Presupuestos. Por favor vuelva a cargar la página" + End If + AC.Dispose() + + IDPoliza = ObjContaAC.AddPoliza(3, "Salida de Almacen", TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, Fecha) If IDPoliza > 0 Then - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - Dim DtMovtos = ObjInventario.DtResultados - Importe = DtMovtos.SUMD("Total", "Estatus = ''") + Dim CuentaCargoCOG As Integer + Dim CuentaAbonoAlmacen As Integer = 0 + Dim drA As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen)) - If Importe > 0 Then - If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then - If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", ConceptoRenglon, 0, Fecha, "") Then - 'actualizo el idcuenta del presupuesto - If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", ConceptoRenglon, 0, Fecha, "") Then + If drA IsNot Nothing Then CuentaAbonoAlmacen = drA("IdCtaContable").ToString.ToEntero + If UsuarioActual.CveEmpresa = 48 Then ' APH + CuentaCargoCOG = 1386 + End If + + Dim ConceptoRenglon As String = "Salida de Almacen" + + If IDPoliza > 0 Then + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + Dim DtMovtos = ObjInventario.DtResultados + Importe = DtMovtos.SUMD("Total", "Estatus = ''") + + If Importe > 0 Then + If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then + If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", ConceptoRenglon, 0, Fecha, "") Then + 'actualizo el idcuenta del presupuesto + If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", ConceptoRenglon, 0, Fecha, "") Then + ErrorAC = True + Mensaje = "No se pudo insertar movimiento en la poliza 2." + End If + Else ErrorAC = True - Mensaje = "No se pudo insertar movimiento en la poliza 2." + Mensaje = "No se pudo insertar movimiento en la poliza 1." End If - Else - ErrorAC = True - Mensaje = "No se pudo insertar movimiento en la poliza 1." End If End If + + End If - - End If - End If - If IDPoliza > 0 Then - ObjInventario.UpdateMovimientoPoliza(IDPoliza, CveMovimiento, UsuarioActual.CveEmpresa) + If IDPoliza > 0 Then + ObjInventario.UpdateMovimientoPoliza(IDPoliza, CveMovimiento, UsuarioActual.CveEmpresa) + End If + + Else + ErrorAC = True + Mensaje = "No se pudo insertar la poliza" End If + End If + + + If Not ErrorAC And Not ErrorMovInv Then + Dim Msg As New StringBuilder + Msg.AppendFormat("
El Movimiento se registro con el Folio: {0}", ObjInventario.Folio) + Msg.AppendFormat("

Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) + + If ObjContaAC IsNot Nothing Then ObjContaAC.AjustaPoliza(IDPoliza) + If IDPoliza > 0 Then Msg = Msg.AppendFormat("

Ver Póliza", IDPoliza) + + ObjInventario.Commit() ' aplica los movimientos insertados + If ObjContaAC IsNot Nothing Then ObjContaAC.Commit() + + + 'Limpia Valores cuando inserta de campos especiales Else - ErrorAC = True - Mensaje = "No se pudo insertar la poliza" + ObjInventario.RollBack() + CveMovimiento = 0 + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() End If - End If - If Not ErrorAC And Not ErrorMovInv Then - Dim Msg As New StringBuilder - Msg.AppendFormat("
El Movimiento se registro con el Folio: {0}", ObjInventario.Folio) - Msg.AppendFormat("

Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) - - If ObjContaAC IsNot Nothing Then ObjContaAC.AjustaPoliza(IDPoliza) - If IDPoliza > 0 Then Msg = Msg.AppendFormat("

Ver Póliza", IDPoliza) - - ObjInventario.Commit() ' aplica los movimientos insertados - If ObjContaAC IsNot Nothing Then ObjContaAC.Commit() - - - 'Limpia Valores cuando inserta de campos especiales - Else - ObjInventario.RollBack() + ObjInventario.RollBack() 'deshace lo insertado CveMovimiento = 0 If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() End If - Else - ObjInventario.RollBack() 'deshace lo insertado + Catch ex As Exception + Try 'por si ya le habian dado rollback o commit + ObjInventario.RollBack() 'deshace lo insertad + Catch exx As Exception + + End Try CveMovimiento = 0 If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() - End If - - - Catch ex As Exception - Try 'por si ya le habian dado rollback o commit - ObjInventario.RollBack() 'deshace lo insertad - Catch exx As Exception + GuardaLog("Ocurrió un Error inesperado en el registro" & ex.ToString()) + Mensaje = "Ocurrió un Error inesperado en el registro" & ex.ToString() + TieneError = True End Try - CveMovimiento = 0 - If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() - GuardaLog("Ocurrió un Error inesperado en el registro" & ex.ToString()) - Mensaje = "Ocurrió un Error inesperado en el registro" & ex.ToString() - - TieneError = True - End Try + End If ObjInventario.Dispose() 'elimino la instancia If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose() diff --git a/Bancos/RegistroPagoIntermediario.aspx.vb b/Bancos/RegistroPagoIntermediario.aspx.vb index 86bf1f0bf..e5a3caf42 100644 --- a/Bancos/RegistroPagoIntermediario.aspx.vb +++ b/Bancos/RegistroPagoIntermediario.aspx.vb @@ -199,12 +199,7 @@ Partial Class Bancos_PagosIntermediarios If ImporteMovimiento <> 0 Then 'Conta ContPAQ If (IdCtaContable < 1 Or IdCuentaBancaria < 1) Then - CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - End If - - 'Conta SIG - If (CveCuenta < 1 Or CveCuentaBancaria < 1) Then - CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(ConceptoContable).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) End If If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ConceptoMovimiento, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToString.ToEntero, -1, -1, CveCliente, CveProveedor:=DdlProveedorPagoInt.SelectedValue.ToEntero, ImporteMX:=importeMX, CveCuenta:=CveCuenta) Then diff --git a/CRM/AsignarVendedorEnProspectos.aspx b/CRM/AsignarVendedorEnProspectos.aspx index bf082f0cd..b3d9085dd 100644 --- a/CRM/AsignarVendedorEnProspectos.aspx +++ b/CRM/AsignarVendedorEnProspectos.aspx @@ -82,7 +82,7 @@ " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> - diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index a41e7003c..d5d3a3671 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -9734,7 +9734,7 @@ Partial Class Compras_Compras Dim ObjInventario As New ClsInventarios(ObjCompra.IniciaTransacSQL) Dim ObjContabilidad As New ClsContabilidad(ObjCompra.IniciaTransacSQL) Dim ObjAF As New ClsAF(ObjCompra.IniciaTransacSQL) - Dim ObjContaAC As ClsContPAQi '= New ClsContPAQi(UsuarioActual.Empresa) + Dim ObjContaAC As ClsContPAQi = Nothing '= New ClsContPAQi(UsuarioActual.Empresa) Dim Retorno As Boolean = True Dim CveEstatusFactura As Integer = HdnCveEstatusFactura.Value.ToEntero diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx index f579a6d2d..1fc134068 100644 --- a/Contabilidad/RegPrePolizaS.aspx +++ b/Contabilidad/RegPrePolizaS.aspx @@ -98,10 +98,10 @@
- -
-
- + +
+
+ @@ -341,7 +341,7 @@
diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index 706b97522..47c048b72 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -869,9 +869,9 @@ Partial Class ContabilidadC_RegPrePolizaS End If For Each Gvr As GridViewRow In GvMov.Rows - If Gvr.DataKey("CveConceptoContable") = "30" AndAlso Gvr.FCTextBox("TxtCargo").Text.ToDecimal <> 0 Then 'si es movimietno de bancos, y tiene cantidad, deben de especificarse los datos del IE + If Gvr.DataKey("CveConceptoContable") = "30" AndAlso (Gvr.FCTextBox("TxtCargo").Text.ToDecimal <> 0 OrElse Gvr.FCTextBox("TxtAbono").Text.ToDecimal <> 0) Then 'si es movimietno de bancos, y tiene cantidad, deben de especificarse los datos del IE If Gvr.DataKey("ContadoCuenta").ToEntero = 0 OrElse Gvr.DataKey("ContadoTipoTransaccion").ToEntero = 0 Then - Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia) + Alert("No se han especificado las condiciones de pago ", TipoMensaje.MsgAdvertencia) Exit Sub End If End If @@ -914,7 +914,7 @@ Partial Class ContabilidadC_RegPrePolizaS 'End If 'Registra movimieno bancario - If gvr.DataKey("CveConcepto").ToEntero = 30 Then + If gvr.DataKey("CveConcepto").ToEntero = 30 AndAlso gvr.DataKey("ContadoImporte").ToString.ToDecimal <> 0 Then CveIE = ObjIE.AddBancos_IE(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero, TxtFecha.Text, gvr.DataKey("ContadoNumeroFolio").ToString, gvr.DataKey("ContadoBeneficiario").ToString, gvr.DataKey("ContadoImporte").ToString.ToDecimal, CveMoneda, 0, gvr.DataKey("ContadoObservaciones").ToString, "", diff --git a/Contabilidad/RepGastosCC.aspx b/Contabilidad/RepGastosCC.aspx index b5bd25078..b43b120a0 100644 --- a/Contabilidad/RepGastosCC.aspx +++ b/Contabilidad/RepGastosCC.aspx @@ -167,7 +167,7 @@ + data-sort="true" GridLines="None"> diff --git a/Contabilidad/RepGastosCC.aspx.vb b/Contabilidad/RepGastosCC.aspx.vb index 02fab7b7f..492a0beaf 100644 --- a/Contabilidad/RepGastosCC.aspx.vb +++ b/Contabilidad/RepGastosCC.aspx.vb @@ -145,7 +145,10 @@ Partial Class RepGastosCC End Sub Private Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click - GvDatos.ExportToExcelG("ReporteGastos" & Now.ToShortDateString & ".xlsx") + Dim StrFiltro As New StringBuilder + If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" Fecha Inicio: {0}", txtFechaI.Text) + If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin: {0}", txtFechaF.Text) + GvDatos.ExportToExcelG("ReporteGastos" & Now.ToShortDateString, "Gastos Acumulados", UsuarioActual, StrFiltro.ToString, 100, 200) End Sub ' Note, it is important to override the form verification in order to successfully call a GridView1.RenderControl method. Public Overrides Sub VerifyRenderingInServerForm(control As Control) diff --git a/Inventarios/AjustesSeccionAlmacen.aspx.vb b/Inventarios/AjustesSeccionAlmacen.aspx.vb index 6f34af016..9b4bbe96c 100644 --- a/Inventarios/AjustesSeccionAlmacen.aspx.vb +++ b/Inventarios/AjustesSeccionAlmacen.aspx.vb @@ -13,7 +13,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen End Sub Private Sub CargaCombos() - Dim DtAlmacenes As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros("CveTipoAlmacen in (1,2,12,14,16, 26)") + Dim DtAlmacenes As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros("CveTipoAlmacen in (1,2,12,14,16,19, 26)") DdlAlmacen.DataSource = DtAlmacenes DdlAlmacen.DataBind() diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index d6fa69575..7eea03d5b 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -4234,7 +4234,7 @@ Partial Class Inventarios_EntradasSalidas End If If ValorEntrada >= ValorSalida Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ValorEntrada + ValorSalida, "", 260, tConcepto, Fecha, IdCuentaOtrosIngresos, -1, CveMovimientoAlmacen:=CveMovimientoSalida, CveSubProyecto:=tCveSubProyectoSalida, ImporteMX:=ValorEntrada + ValorSalida, Contabilizable:=EsContabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ValorEntrada + ValorSalida, "", 260, tConcepto, Fecha, IdCuentaOtrosIngresos, -1, CveMovimientoAlmacen:=CveMovimientoSalida, CveSubProyecto:=tCveSubProyectoEntrada, ImporteMX:=ValorEntrada + ValorSalida, Contabilizable:=EsContabilizable) Then ErrorMovInv = True Mensaje = "Ocurrió un error al guardar los movimientos contables de ajuste de ingreso" End If diff --git a/Ventas/RepPS.aspx b/Ventas/RepPS.aspx index 48d0adee4..799e44502 100644 --- a/Ventas/RepPS.aspx +++ b/Ventas/RepPS.aspx @@ -68,7 +68,7 @@ Excel
  • - Reporte Diario + Reporte Diario
  • diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb index 01cb8f2ba..47208fa02 100644 --- a/Ventas/RepPS.aspx.vb +++ b/Ventas/RepPS.aspx.vb @@ -36,7 +36,7 @@ Partial Class Ventas_RepPS 'DdlMarca.Items.Insert(0, New ListItem("Todos", "-1")) End If - If UsuarioActual.TienePermisoProceso(320) OrElse UsuarioActual.CveRol = 1 Then + If UsuarioActual.TienePermisoProceso(320) Then HLReporteDiario.Visible = True End If