Merge branch 'master' of http://oirigoyen@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
</li>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
|
||||
<asp:Label ID="LblTitulo" runat="server" Text="Catálogo de Ingreso / Egreso"></asp:Label>
|
||||
Depreciaciones
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
353
Ashx/E48.ashx
353
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("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio)
|
||||
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
||||
|
||||
If ObjContaAC IsNot Nothing Then ObjContaAC.AjustaPoliza(IDPoliza)
|
||||
If IDPoliza > 0 Then Msg = Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", 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("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio)
|
||||
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
||||
|
||||
If ObjContaAC IsNot Nothing Then ObjContaAC.AjustaPoliza(IDPoliza)
|
||||
If IDPoliza > 0 Then Msg = Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", 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()
|
||||
|
||||
@@ -199,12 +199,7 @@ Partial Class Bancos_PagosIntermediarios
|
||||
If ImporteMovimiento <> 0 Then
|
||||
'Conta ContPAQ
|
||||
If (IdCtaContable < 1 Or IdCuentaBancaria < 1) Then
|
||||
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
|
||||
End If
|
||||
|
||||
'Conta SIG
|
||||
If (CveCuenta < 1 Or CveCuentaBancaria < 1) Then
|
||||
CuentasContablesInvalidasSIG.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
|
||||
CuentasContablesInvalidas.Append("<br>" & 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
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvProspectos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvProspectos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
<asp:GridView ID="GvProspectos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveEmpresaCRM,Empresa,CveSubProyecto,SubProyecto,CveGiro,Giro" EmptyDataText="No se encontraron registros"
|
||||
<asp:GridView ID="GvProspectos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveEmpresaCRM,Empresa,CveSubProyecto,SubProyecto,CveGiro,Giro" EmptyDataText="Sin prospectos por asignar."
|
||||
ToolTip="Listado de Temas" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-freezerows="1" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Asignar" ItemStyle-HorizontalAlign="Center">
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -98,10 +98,10 @@
|
||||
<div id="DivConceptoPrePoliza" runat="server" class="chequesie22">
|
||||
<div class="chequesie12" runat="server" id="divDatosPrincipales">
|
||||
<div class="row">
|
||||
<label class="col-md-2 control-label text-left">Fecha: </label>
|
||||
<div class="col-md-4" style="width: 42%;">
|
||||
<div class="input-group input-small date date-picker" data-date-format="dd/mm/yyyy">
|
||||
<asp:TextBox ID="TxtFecha" runat="server" CssClass="form-control"></asp:TextBox>
|
||||
<label class="col-md-2 control-label text-left">Fecha: </label>
|
||||
<div class="col-md-4">
|
||||
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy">
|
||||
<asp:TextBox ID="TxtFecha" runat="server" CssClass="form-control" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton runat="server" ID="ImgCalendario" class="btn default"><i class="fa fa-calendar"></i></asp:LinkButton>
|
||||
</span>
|
||||
@@ -341,7 +341,7 @@
|
||||
</div>
|
||||
<div class="portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom ">
|
||||
<asp:GridView ID="GvMov" runat="server" AutoGenerateColumns="False" ShowHeader="False"
|
||||
DataKeyNames="IdMov,Cargo,Abono,TipoMovto,CveConcepto,CveProveedor,CvePersonal, CveCompra,CveClasificacion,CveCliente,CveVenta,CveCuenta, ContadoTipoTransaccion, ContadoCuenta, ContadoNumeroFolio, ContadoImporte, ContadoBeneficiario, ContadoObservaciones"
|
||||
DataKeyNames="IdMov,Cargo,Abono,TipoMovto,CveConcepto,CveConceptoContable,CveProveedor,CvePersonal, CveCompra,CveClasificacion,CveCliente,CveVenta,CveCuenta, ContadoTipoTransaccion, ContadoCuenta, ContadoNumeroFolio, ContadoImporte, ContadoBeneficiario, ContadoObservaciones"
|
||||
Width="100%" CssClass=" GvMov GvSize table table-striped table-advance table-hover mysmallbtn" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
|
||||
@@ -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, "",
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="True" EmptyDataText=""
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
|
||||
data-sort="true" Style="text-align: center;" GridLines="None">
|
||||
data-sort="true" GridLines="None">
|
||||
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
<RowStyle CssClass="Texto" />
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<asp:LinkButton ID="ImgExcel" runat="server"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Excel</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink NavigateUrl="#" data-toggle="modal" data-target="#DivReporteDiario" ID="HLReporteDiario" runat="server"> <i class="fa fa-file-o"></i> Reporte Diario</asp:HyperLink>
|
||||
<asp:HyperLink NavigateUrl="#" data-toggle="modal" data-target="#DivReporteDiario" ID="HLReporteDiario" Visible="false" runat="server"> <i class="fa fa-file-o"></i> Reporte Diario</asp:HyperLink>
|
||||
</li>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user