Local
This commit is contained in:
@@ -6543,6 +6543,47 @@ Public Class ClsContabilidad
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
#Region "F L U C T U A C I O N - C A M B I A R I A"
|
||||||
|
Public Function UpdateVentaTCValuacion(CveVenta As Integer, TCValuacion As Decimal) As Boolean
|
||||||
|
Dim Retorno = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Conta_VentasTCValuacionUpdate")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
.Add("@TCValuacion", SqlDbType.Decimal).Value = TCValuacion
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
Me.OnError("Ocurrió un error al actualizar el tipo de cambio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function UpdateCompraTCValuacion(CveCompra As Integer, TCValuacion As Decimal) As Boolean
|
||||||
|
Dim Retorno = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Conta_ComprasTCValuacionUpdate")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
|
||||||
|
.Add("@TCValuacion", SqlDbType.Decimal).Value = TCValuacion
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
Me.OnError("Ocurrió un error al actualizar el tipo de cambio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
#End Region
|
||||||
|
|
||||||
#Region "IDisposable Support"
|
#Region "IDisposable Support"
|
||||||
' IDisposable
|
' IDisposable
|
||||||
|
|||||||
@@ -1734,7 +1734,7 @@ Public Class ClsGenerales
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
Public Function GetTipoCambio(CveTipoCambio As Integer, Fecha As Date) As Boolean
|
Public Function GetTipoCambio(CveTipoCambio As Integer, Fecha As Date) As Boolean
|
||||||
Dim Retorno = False
|
Dim Retorno = False
|
||||||
|
|
||||||
@@ -1754,6 +1754,26 @@ Public Class ClsGenerales
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
Public Function GetTipoCambioUltimaFluctuacion(CveTipoCambio As Integer, Fecha As Date, Optional Top As Integer = 1000) As Boolean
|
||||||
|
Dim Retorno = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Gral_TipoCambioUltimaFluctuacionGet")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveTipoCambio", SqlDbType.Int).Value = CveTipoCambio
|
||||||
|
.Add("@Fecha", SqlDbType.Date).Value = Fecha
|
||||||
|
.Add("@Top", SqlDbType.Int).Value = Top
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener el Tipo de Cambio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
Public Function GetTiposCambio(FechaInicio As Date, FechaFin As Date) As Boolean
|
Public Function GetTiposCambio(FechaInicio As Date, FechaFin As Date) As Boolean
|
||||||
Dim Retorno = False
|
Dim Retorno = False
|
||||||
|
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ Public Class ClsMovimientos
|
|||||||
Gpo As Integer, CveResponsable As Integer,
|
Gpo As Integer, CveResponsable As Integer,
|
||||||
TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoDocto As String = "-1",
|
TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoDocto As String = "-1",
|
||||||
Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional FechaCorte As Date = Nothing, Optional EstatusCliente As Integer = -1, Optional CveUsuarioConsulta As Integer = -1,
|
Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional FechaCorte As Date = Nothing, Optional EstatusCliente As Integer = -1, Optional CveUsuarioConsulta As Integer = -1,
|
||||||
Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional TipoCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1) As Boolean
|
Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional TipoCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1, Optional CveMoneda As Integer = -1) As Boolean
|
||||||
|
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
'Data = New DataTable
|
'Data = New DataTable
|
||||||
@@ -274,7 +274,8 @@ Public Class ClsMovimientos
|
|||||||
.Add("@CveCobranzaEstatus", SqlDbType.Int).Value = CveCobranzaEstatus
|
.Add("@CveCobranzaEstatus", SqlDbType.Int).Value = CveCobranzaEstatus
|
||||||
.Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion
|
.Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion
|
||||||
.Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente
|
.Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente
|
||||||
.Add("@AplicaAnticiposPagados", SqlDbType.Int).Value = AplicaAnticiposPagados
|
.Add("@AplicaAnticiposPagados", SqlDbType.Int).Value = AplicaAnticiposPagados
|
||||||
|
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
|||||||
@@ -127,6 +127,47 @@ Public Class ClsPaginas
|
|||||||
End Set
|
End Set
|
||||||
|
|
||||||
End Property
|
End Property
|
||||||
|
Public ReadOnly Property GlobalTipoCambioUltimaFluctuacion(Optional Fecha As Date = MinFecha) As MTipoCambioFluctuacion
|
||||||
|
Get
|
||||||
|
|
||||||
|
If Application("GlobalTipoCambioUltimaFluctuacion") Is Nothing Then
|
||||||
|
Dim ObjGral As New ClsGenerales
|
||||||
|
If ObjGral.GetTipoCambioUltimaFluctuacion(-1, Now) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
|
||||||
|
Application("GlobalTipoCambioUltimaFluctuacion") = ObjGral.DtResultados.Copy()
|
||||||
|
Else
|
||||||
|
Application("GlobalTipoCambioUltimaFluctuacion") = Nothing
|
||||||
|
End If
|
||||||
|
ObjGral.Dispose()
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim fluctuacion = New MTipoCambioFluctuacion() With {
|
||||||
|
.TCFluctuacion = 0,
|
||||||
|
.FechaFluctuacion = MinFecha
|
||||||
|
}
|
||||||
|
|
||||||
|
'sino tiene dato lo recargo por si ya esta insertado
|
||||||
|
If Fecha = MinFecha Then Fecha = Now
|
||||||
|
|
||||||
|
If Application("GlobalTipoCambioUltimaFluctuacion") IsNot Nothing Then
|
||||||
|
|
||||||
|
Dim dr = DirectCast(Application("GlobalTipoCambioUltimaFluctuacion"), DataTable).FiltroPrimero(String.Format("Fecha = '{0}'", Fecha))
|
||||||
|
If dr IsNot Nothing Then
|
||||||
|
fluctuacion.TCFluctuacion = dr("TCFluctuacion").ToString().ToDecimal()
|
||||||
|
fluctuacion.FechaFluctuacion = dr("FechaFluctuacion").ToString().ToDateTime()
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return fluctuacion
|
||||||
|
Else
|
||||||
|
Return fluctuacion
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
<Serializable()>
|
||||||
|
Public Class MTipoCambioFluctuacion
|
||||||
|
Public Property TCFluctuacion As Decimal
|
||||||
|
Public Property FechaFluctuacion As DateTime
|
||||||
|
End Class
|
||||||
Public Property GlobalTipoCambioEuro(Optional Fecha As Date = MinFecha) As Double
|
Public Property GlobalTipoCambioEuro(Optional Fecha As Date = MinFecha) As Double
|
||||||
Get
|
Get
|
||||||
If GlobalTipoCambioEuro <= 0 Then
|
If GlobalTipoCambioEuro <= 0 Then
|
||||||
|
|||||||
@@ -5080,202 +5080,203 @@ Namespace Modelos
|
|||||||
|
|
||||||
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen Then
|
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen Then
|
||||||
'REALIZA DEVOLUCION A LAS SALIDAS PENDIENTES
|
'REALIZA DEVOLUCION A LAS SALIDAS PENDIENTES
|
||||||
For Each RowMovimiento As DataRow In DtSalidas.Rows
|
If ObjFactura.TipoDocto <> "Rem" Then
|
||||||
Dim CveConceptoMovimiento As Integer = -1
|
For Each RowMovimiento As DataRow In DtSalidas.Rows
|
||||||
Dim CveAlmacenMovimiento As Integer = -1
|
Dim CveConceptoMovimiento As Integer = -1
|
||||||
|
Dim CveAlmacenMovimiento As Integer = -1
|
||||||
|
|
||||||
Dim CveMovimientoDevolucion As Integer = 0
|
Dim CveMovimientoDevolucion As Integer = 0
|
||||||
Dim Folio As Integer = 0
|
Dim Folio As Integer = 0
|
||||||
|
|
||||||
Select Case RowMovimiento("CveConcepto").ToString().ToEntero()
|
Select Case RowMovimiento("CveConcepto").ToString().ToEntero()
|
||||||
Case 3
|
Case 3
|
||||||
CveConceptoMovimiento = 18 'DEVOLUCION DEL CLIENTE
|
CveConceptoMovimiento = 18 'DEVOLUCION DEL CLIENTE
|
||||||
CveAlmacenMovimiento = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
CveAlmacenMovimiento = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||||
Case 40
|
Case 40
|
||||||
CveConceptoMovimiento = 41 'DEVOLUCIÓN DEL CLIENTE DIRECTA
|
CveConceptoMovimiento = 41 'DEVOLUCIÓN DEL CLIENTE DIRECTA
|
||||||
CveAlmacenMovimiento = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
CveAlmacenMovimiento = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||||
Case 18
|
Case 18
|
||||||
CveConceptoMovimiento = 3 'DEVOLUCIÓN DEL CLIENTE DIRECTA
|
CveConceptoMovimiento = 3 'DEVOLUCIÓN DEL CLIENTE DIRECTA
|
||||||
CveAlmacenMovimiento = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
CveAlmacenMovimiento = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||||
''SI TIENE REMISIONES RELACIONADAS
|
''SI TIENE REMISIONES RELACIONADAS
|
||||||
'If DtRemisionesFacturadas.Rows.Count > 0 Then
|
'If DtRemisionesFacturadas.Rows.Count > 0 Then
|
||||||
' Dim RowRemision As DataRow = DtExistencias.FiltroPrimero($"CveMovimiento = {RowMovimiento("CveMovimiento").ToString()}")
|
' Dim RowRemision As DataRow = DtExistencias.FiltroPrimero($"CveMovimiento = {RowMovimiento("CveMovimiento").ToString()}")
|
||||||
|
|
||||||
' Dim CveRemision As Integer = RowRemision("CveRemision").ToString().ToEntero()
|
' Dim CveRemision As Integer = RowRemision("CveRemision").ToString().ToEntero()
|
||||||
|
|
||||||
' Dim CancelarRemision As Boolean = (ListaRemisionesCancelar IsNot Nothing) AndAlso (ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = CveRemision))
|
' Dim CancelarRemision As Boolean = (ListaRemisionesCancelar IsNot Nothing) AndAlso (ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = CveRemision))
|
||||||
|
|
||||||
' 'SI LA REMISION SE VA A CANCELAR DEBE REGRESAR AL ALMACEN GENERAL
|
' 'SI LA REMISION SE VA A CANCELAR DEBE REGRESAR AL ALMACEN GENERAL
|
||||||
' If CancelarRemision Then
|
' If CancelarRemision Then
|
||||||
' CveAlmacenDevolucion = RowRemision("CveAlmacenDevolucion").ToString().ToEntero()
|
' CveAlmacenDevolucion = RowRemision("CveAlmacenDevolucion").ToString().ToEntero()
|
||||||
' Else
|
' Else
|
||||||
' CveAlmacenDevolucion = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
' CveAlmacenDevolucion = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||||
' End If
|
' End If
|
||||||
|
|
||||||
'Else
|
'Else
|
||||||
' CveAlmacenDevolucion = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
' CveAlmacenDevolucion = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||||
'End If
|
'End If
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
'SI TIENE SALDO PENDIENTE POR DEVOLVER GENERA UN MOVIMIENTO DE DEVOLUCION
|
'SI TIENE SALDO PENDIENTE POR DEVOLVER GENERA UN MOVIMIENTO DE DEVOLUCION
|
||||||
If ObjFactura.SaldoAlmacen <> 0 Then
|
If ObjFactura.SaldoAlmacen <> 0 Then
|
||||||
'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN)
|
'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN)
|
||||||
CveMovimientoDevolucion = ObjInventario.AddMovimiento(CveAlmacenMovimiento, CveConceptoMovimiento, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveAlmacenDestino:=-1, Modulo:="Mod/CV1")
|
CveMovimientoDevolucion = ObjInventario.AddMovimiento(CveAlmacenMovimiento, CveConceptoMovimiento, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveAlmacenDestino:=-1, Modulo:="Mod/CV1")
|
||||||
Folio = ObjInventario.Folio
|
Folio = ObjInventario.Folio
|
||||||
|
|
||||||
If CveMovimientoDevolucion > 0 Then
|
If CveMovimientoDevolucion > 0 Then
|
||||||
For Each Dr As DataRow In DtExistencias.FiltraParametros($"CveMovimiento = {RowMovimiento("CveMovimiento").ToString()}").Rows
|
For Each Dr As DataRow In DtExistencias.FiltraParametros($"CveMovimiento = {RowMovimiento("CveMovimiento").ToString()}").Rows
|
||||||
|
|
||||||
Dim FechaCaducidad As Date = MinFecha
|
Dim FechaCaducidad As Date = MinFecha
|
||||||
If Not String.IsNullOrEmpty(Dr("FechaCaducidad").ToString()) Then
|
If Not String.IsNullOrEmpty(Dr("FechaCaducidad").ToString()) Then
|
||||||
If IsDate(Dr("FechaCaducidad")) Then
|
If IsDate(Dr("FechaCaducidad")) Then
|
||||||
FechaCaducidad = Dr("FechaCaducidad").ToString().ToDate()
|
FechaCaducidad = Dr("FechaCaducidad").ToString().ToDate()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim CveVentaDetalleRemision As Integer = -1
|
||||||
|
If CveConceptoMovimiento = 41 Then
|
||||||
|
CveVentaDetalleRemision = Dr("CveVentaDetalleRemision").ToString.ToEntero()
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoDevolucion, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, FechaCaducidad:=FechaCaducidad, CveVentaDetalleRemision:=CveVentaDetalleRemision) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
MensajeError = "Ocurrió un error al agregar el movimiento"
|
||||||
|
ErrorCancelar = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'GENERA PREPOLIZA DEL MOVIMIENTO DE DEVOLUCION
|
||||||
|
If Not ErrorCancelar Then
|
||||||
|
Dim DtCostos As DataTable = Nothing
|
||||||
|
Dim ValorInventario As Decimal = 0
|
||||||
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoDevolucion, UsuarioActual.CveEmpresa) Then
|
||||||
|
DtCostos = ObjInventario.DtResultados
|
||||||
|
|
||||||
|
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
|
||||||
|
Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {CveAlmacenMovimiento}").ToEntero
|
||||||
|
Dim IdCtaContable As Integer = 0
|
||||||
|
If tmpCostos.Rows.Count > 0 Then
|
||||||
|
|
||||||
|
Dim Multiplicador As Decimal = -1D
|
||||||
|
If ObjFactura.TipoDocto = "Dev" Then
|
||||||
|
Multiplicador = 1D
|
||||||
|
End If
|
||||||
|
|
||||||
|
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||||
|
Dim Fecha As Date = Now
|
||||||
|
Dim CveCliente As Integer = ObjVentas.DtResultados(0)("CveCliente").ToString.ToEntero
|
||||||
|
Dim ClienteNombre As String = ObjVentas.DtResultados(0)("ClienteNombre").ToString
|
||||||
|
Dim SerieFolio As String = ObjVentas.DtResultados(0)("SerieFolio").ToString
|
||||||
|
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundAD()
|
||||||
|
Dim TotalCostoAcumulado As Decimal = 0
|
||||||
|
Dim cont As Integer = 1
|
||||||
|
|
||||||
|
Dim CvePrePolizaDev As Integer = ObjConta.AddPrePolizas("Modelos/RecepcionEntrega", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
'SE AGREGA MOVIMIENTO SEPARADO POR LA CUENTA DE VENTAS (ER)
|
||||||
|
For Each RowInv As DataRow In tmpCostos.Rows
|
||||||
|
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundAD()
|
||||||
|
TotalCostoAcumulado += ValorInventario
|
||||||
|
|
||||||
|
'CUANDO ES EL ÚLTIMO MOVIMIENTO Y HAY DIFERENCIAS EN LOS IMPORTES
|
||||||
|
If cont = DtCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
|
||||||
|
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
|
||||||
|
End If
|
||||||
|
|
||||||
|
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
||||||
|
|
||||||
|
If Not ErrorCancelar Then
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, False, Multiplicador * ValorInventario, SerieFolio, 69, SerieFolio, Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimientoDevolucion, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=Multiplicador * ValorInventario, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
cont += 1
|
||||||
|
Next
|
||||||
|
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, True, Multiplicador * TotalCosto, SerieFolio, 68, SerieFolio, Fecha, IdCtaContableAlmacen, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimientoDevolucion, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=Multiplicador * TotalCosto) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'AUTOCONTA - EL MOVIMIENTO 1 ES EL DE VENTA
|
||||||
|
|
||||||
|
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 119 AndAlso ObjFactura.TipoDocto.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "Egs", "Dev") Then
|
||||||
|
AutoConta = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
If AutoConta And Not ErrorCancelar Then
|
||||||
|
|
||||||
|
If IdCtaContable > 0 Then
|
||||||
|
If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaDev, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al contabilizar la prepoliza."
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Alert(String.Format("No se puede contabilizar ya que falta asignación de las cuentas contables"), TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un Error al ingresar las prepolizas"
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
Dim CveVentaDetalleRemision As Integer = -1
|
'AGREGA BITACORA A VENTA
|
||||||
If CveConceptoMovimiento = 41 Then
|
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimientoDevolucion > 0 Then
|
||||||
CveVentaDetalleRemision = Dr("CveVentaDetalleRemision").ToString.ToEntero()
|
Dim MensajeBitacora = "Devuelta"
|
||||||
End If
|
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoDevolucion, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
||||||
|
MensajeError = "Ocurrió un error al agregar la bitacora."
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoDevolucion, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, FechaCaducidad:=FechaCaducidad, CveVentaDetalleRemision:=CveVentaDetalleRemision) Then
|
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
|
End If
|
||||||
Exit For
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
'SI EXISTE UNA DEVOLUCION PREVIAMENTE HECHA UTILIZAR COMO REFERENCIA
|
||||||
|
If DtDevPrevias IsNot Nothing AndAlso DtDevPrevias.Rows.Count > 0 Then
|
||||||
|
CveMovimientoDevolucion = DtDevPrevias.FiltroPrimeroValor("CveMovimiento", $"CveConcepto = {CveConceptoMovimiento}").ToEntero()
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
||||||
|
'SI ES DEVOLUCION DEL CLIENTE DEBE REGRESAR A ENTREGA POR ADELANTADO
|
||||||
|
If Not ErrorCancelar AndAlso CveConceptoMovimiento = 18 AndAlso RevivirRemisiones Then
|
||||||
|
If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimientoDevolucion, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al generar los movimientos de devolución a remisión"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If DtVirtuales IsNot Nothing Then
|
||||||
|
For Each RowVirtual As DataRow In DtVirtuales.Rows
|
||||||
|
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
|
||||||
|
If Not ErrorCancelar AndAlso Not GeneraMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Else
|
|
||||||
MensajeError = "Ocurrió un error al agregar el movimiento"
|
|
||||||
ErrorCancelar = True
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'GENERA PREPOLIZA DEL MOVIMIENTO DE DEVOLUCION
|
If ErrorCancelar Then
|
||||||
If Not ErrorCancelar Then
|
Exit For
|
||||||
Dim DtCostos As DataTable = Nothing
|
|
||||||
Dim ValorInventario As Decimal = 0
|
|
||||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoDevolucion, UsuarioActual.CveEmpresa) Then
|
|
||||||
DtCostos = ObjInventario.DtResultados
|
|
||||||
|
|
||||||
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
|
|
||||||
Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {CveAlmacenMovimiento}").ToEntero
|
|
||||||
Dim IdCtaContable As Integer = 0
|
|
||||||
If tmpCostos.Rows.Count > 0 Then
|
|
||||||
|
|
||||||
Dim Multiplicador As Decimal = -1D
|
|
||||||
If ObjFactura.TipoDocto = "Dev" Then
|
|
||||||
Multiplicador = 1D
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
|
||||||
Dim Fecha As Date = Now
|
|
||||||
Dim CveCliente As Integer = ObjVentas.DtResultados(0)("CveCliente").ToString.ToEntero
|
|
||||||
Dim ClienteNombre As String = ObjVentas.DtResultados(0)("ClienteNombre").ToString
|
|
||||||
Dim SerieFolio As String = ObjVentas.DtResultados(0)("SerieFolio").ToString
|
|
||||||
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundAD()
|
|
||||||
Dim TotalCostoAcumulado As Decimal = 0
|
|
||||||
Dim cont As Integer = 1
|
|
||||||
|
|
||||||
Dim CvePrePolizaDev As Integer = ObjConta.AddPrePolizas("Modelos/RecepcionEntrega", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
||||||
'SE AGREGA MOVIMIENTO SEPARADO POR LA CUENTA DE VENTAS (ER)
|
|
||||||
For Each RowInv As DataRow In tmpCostos.Rows
|
|
||||||
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundAD()
|
|
||||||
TotalCostoAcumulado += ValorInventario
|
|
||||||
|
|
||||||
'CUANDO ES EL ÚLTIMO MOVIMIENTO Y HAY DIFERENCIAS EN LOS IMPORTES
|
|
||||||
If cont = DtCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
|
|
||||||
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
|
|
||||||
End If
|
|
||||||
|
|
||||||
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, False, Multiplicador * ValorInventario, SerieFolio, 69, SerieFolio, Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimientoDevolucion, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=Multiplicador * ValorInventario, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
cont += 1
|
|
||||||
Next
|
|
||||||
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, True, Multiplicador * TotalCosto, SerieFolio, 68, SerieFolio, Fecha, IdCtaContableAlmacen, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimientoDevolucion, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=Multiplicador * TotalCosto) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
'AUTOCONTA - EL MOVIMIENTO 1 ES EL DE VENTA
|
|
||||||
|
|
||||||
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
|
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa = 119 AndAlso ObjFactura.TipoDocto.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "Egs", "Dev") Then
|
|
||||||
AutoConta = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
If AutoConta And Not ErrorCancelar Then
|
|
||||||
|
|
||||||
If IdCtaContable > 0 Then
|
|
||||||
If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaDev, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Ocurrió un error al contabilizar la prepoliza."
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
Alert(String.Format("No se puede contabilizar ya que falta asignación de las cuentas contables"), TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Ocurrió un Error al ingresar las prepolizas"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'AGREGA BITACORA A VENTA
|
Next
|
||||||
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimientoDevolucion > 0 Then
|
End If
|
||||||
Dim MensajeBitacora = "Devuelta"
|
|
||||||
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoDevolucion, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
|
||||||
MensajeError = "Ocurrió un error al agregar la bitacora."
|
|
||||||
ErrorCancelar = True
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
'SI EXISTE UNA DEVOLUCION PREVIAMENTE HECHA UTILIZAR COMO REFERENCIA
|
|
||||||
If DtDevPrevias IsNot Nothing AndAlso DtDevPrevias.Rows.Count > 0 Then
|
|
||||||
CveMovimientoDevolucion = DtDevPrevias.FiltroPrimeroValor("CveMovimiento", $"CveConcepto = {CveConceptoMovimiento}").ToEntero()
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
|
||||||
'SI ES DEVOLUCION DEL CLIENTE DEBE REGRESAR A ENTREGA POR ADELANTADO
|
|
||||||
If Not ErrorCancelar AndAlso CveConceptoMovimiento = 18 AndAlso RevivirRemisiones Then
|
|
||||||
If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimientoDevolucion, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Ocurrió un error al generar los movimientos de devolución a remisión"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
If DtVirtuales IsNot Nothing Then
|
|
||||||
For Each RowVirtual As DataRow In DtVirtuales.Rows
|
|
||||||
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
|
|
||||||
If Not ErrorCancelar AndAlso Not GeneraMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ErrorCancelar Then
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
Next
|
|
||||||
|
|
||||||
|
|
||||||
'SI EXISTEN HAY EXISTENCIA EN (ENTREGA POR ADELANTADO) SE TIENE QUE REGRESAR AL ALMACEN ORGINAL (GENERAL,SIN COSTO)
|
'SI EXISTEN HAY EXISTENCIA EN (ENTREGA POR ADELANTADO) SE TIENE QUE REGRESAR AL ALMACEN ORGINAL (GENERAL,SIN COSTO)
|
||||||
If Not ErrorCancelar AndAlso ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Then
|
If Not ErrorCancelar AndAlso ObjFactura.TipoDocto <> "Rem" AndAlso ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Then
|
||||||
|
|
||||||
'VERIFICA LOS MOVIMIENTOS DE DEVOLUCION YA GENERADOS QUE TENGAN EXISTENCIA EN (ENTREGA POR ADELANTADO)
|
'VERIFICA LOS MOVIMIENTOS DE DEVOLUCION YA GENERADOS QUE TENGAN EXISTENCIA EN (ENTREGA POR ADELANTADO)
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
@@ -5314,6 +5315,40 @@ Namespace Modelos
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'CANCELACION DE MOVIMIENTOS DE REMISION
|
||||||
|
If Not ErrorCancelar AndAlso ObjFactura.TipoDocto = "Rem" AndAlso RealizarDevolucionAlmacen Then
|
||||||
|
Dim CveAlmacenGeneral As Integer = 0
|
||||||
|
Dim DtMovRemision As DataTable = Nothing
|
||||||
|
'VERIFICA LOS MOVIMIENTOS DE DEVOLUCION YA GENERADOS QUE TENGAN EXISTENCIA EN (ENTREGA POR ADELANTADO)
|
||||||
|
If Not ErrorCancelar Then
|
||||||
|
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||||
|
DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10")
|
||||||
|
CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 1").ToString().ToEntero()
|
||||||
|
Else
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN ORGINAL (GENERAL,SIN COSTO)
|
||||||
|
If Not ErrorCancelar AndAlso DtMovRemision IsNot Nothing AndAlso DtMovRemision.Rows.Count > 0 Then
|
||||||
|
|
||||||
|
Dim DtDevMovs = DtMovRemision.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveAlmacen"})
|
||||||
|
|
||||||
|
For Each RowDevolucion As DataRow In DtDevMovs.Rows
|
||||||
|
CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero()
|
||||||
|
|
||||||
|
If Not CancelarMovimientosRemision(CveVenta, CveAlmacen, CveAlmacenGeneral, DtMovRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")} AND CvePS > 0"), ObjVentas, ObjInventario) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión."
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
'VERIFICAR MOVIMIENTOS DE APARTADOS
|
'VERIFICAR MOVIMIENTOS DE APARTADOS
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
If Not GeneraMovimientosApartados(ObjInventario) Then
|
If Not GeneraMovimientosApartados(ObjInventario) Then
|
||||||
|
|||||||
@@ -117,11 +117,13 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
|||||||
Case "sendMailLPM"
|
Case "sendMailLPM"
|
||||||
context.Response.Write(sendMailLPM(context))
|
context.Response.Write(sendMailLPM(context))
|
||||||
Case "getSATColomias"
|
Case "getSATColomias"
|
||||||
getSATColonias(context)
|
getSatColonias(context)
|
||||||
Case "GetFilesDirectory"
|
Case "GetFilesDirectory"
|
||||||
GetFilesDirectory(context)
|
GetFilesDirectory(context)
|
||||||
Case "Getetiquetas"
|
Case "Getetiquetas"
|
||||||
Getetiquetas(context)
|
Getetiquetas(context)
|
||||||
|
Case "cancelarRemision"
|
||||||
|
cancelarRemision(context)
|
||||||
End Select
|
End Select
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ex.GuardaLog(ex.Message)
|
ex.GuardaLog(ex.Message)
|
||||||
@@ -1599,4 +1601,47 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
|||||||
Return retorno
|
Return retorno
|
||||||
End Function
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
#Region "C A N C E L A R - R E M I S I O N"
|
||||||
|
Private Function cancelarRemision(ByVal context As HttpContext) As String
|
||||||
|
Dim retorno As String = ""
|
||||||
|
|
||||||
|
Dim CveVenta As Integer = IfNull(context.Request("CveVenta"), "-1").ToString().ToEntero()
|
||||||
|
|
||||||
|
If CveVenta > 0 Then
|
||||||
|
Dim usuario As Usuario = UsuarioActual(context)
|
||||||
|
If usuario IsNot Nothing AndAlso usuario.CveEmpresa > 0 Then
|
||||||
|
Dim CveAlmacenDevolucion As Integer = 0
|
||||||
|
|
||||||
|
Using ObjInv As New ClsInventarios
|
||||||
|
If ObjInv.GetInv_Mov(CveVenta, usuario.CveEmpresa) Then
|
||||||
|
If ObjInv.DtResultados.Rows.Count > 0 Then
|
||||||
|
CveAlmacenDevolucion = ObjInv.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveConcepto IN (3,40)").ToEntero()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Dim ObjFacturaCancelacion As New Modelos.Factura(usuario, CveVenta, usuario.CveEmpresa, EsCancelacion:=True)
|
||||||
|
ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion
|
||||||
|
|
||||||
|
If ObjFacturaCancelacion.TipoDocto = "Rem" Then
|
||||||
|
Dim respuesta = ObjFacturaCancelacion.CancelarFactura(True, New List(Of Integer))
|
||||||
|
If respuesta IsNot Nothing Then
|
||||||
|
retorno = JsonConvert.SerializeObject(respuesta)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(retorno) Then
|
||||||
|
context.Response.Write(retorno)
|
||||||
|
Else
|
||||||
|
context.Response.Write("[]")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return retorno
|
||||||
|
End Function
|
||||||
|
#End Region
|
||||||
End Class
|
End Class
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,18 @@
|
|||||||
Option Strict On
|
Option Strict On
|
||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
|
Imports System.Globalization
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
Partial Class Bancos_FluctuacionCambiaria
|
Partial Class Bancos_FluctuacionCambiaria
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
|
|
||||||
|
Public ReadOnly Property FechaUltimoDiaMes() As DateTime
|
||||||
|
Get
|
||||||
|
Return New DateTime(DdlAnio.SelectedValue.ToEntero(), DdlMes.SelectedValue.ToEntero(), 1).AddMonths(1).AddDays(-1)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
#Region "PROPIEDADES"
|
#Region "PROPIEDADES"
|
||||||
Private Property LblTotal() As String
|
Private Property LblTotal() As String
|
||||||
Get
|
Get
|
||||||
@@ -19,7 +27,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
If Not Page.IsPostBack Then
|
If Not Page.IsPostBack Then
|
||||||
|
CargaFechas()
|
||||||
CargarCentrosDeCosto(Nothing, DdlSubproyectoBancos, Nothing, LblSubProyectoBancos, "")
|
CargarCentrosDeCosto(Nothing, DdlSubproyectoBancos, Nothing, LblSubProyectoBancos, "")
|
||||||
CargarCentrosDeCosto(Nothing, DdlsubProyectoVentas, Nothing, LblSubProyectoVentas, "")
|
CargarCentrosDeCosto(Nothing, DdlsubProyectoVentas, Nothing, LblSubProyectoVentas, "")
|
||||||
CargarCentrosDeCosto(Nothing, DdlSubProyectoCompras, Nothing, LblSubProyectoCompras, "")
|
CargarCentrosDeCosto(Nothing, DdlSubProyectoCompras, Nothing, LblSubProyectoCompras, "")
|
||||||
@@ -32,6 +40,27 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#Region "CARGAS"
|
#Region "CARGAS"
|
||||||
|
Private Sub CargaFechas()
|
||||||
|
'Año actual
|
||||||
|
DdlAnio.Items.Add(New ListItem(Now.Year.ToString(), Now.Year.ToString()))
|
||||||
|
'Año Anterior
|
||||||
|
DdlAnio.Items.Add(New ListItem(Now.AddYears(-1).Year.ToString(), Now.AddYears(1).Year.ToString()))
|
||||||
|
|
||||||
|
For i = 1 To 12
|
||||||
|
Dim fecha = New DateTime(DdlAnio.SelectedValue.ToEntero(), i, 1)
|
||||||
|
Dim mes = fecha.ToString("MMMM", CultureInfo.GetCultureInfo("es-MX"))
|
||||||
|
Dim mesStr = Char.ToUpper(mes(0)) + mes.Substring(1)
|
||||||
|
|
||||||
|
DdlMes.Items.Add(New ListItem(mesStr, i.ToString()))
|
||||||
|
Next
|
||||||
|
|
||||||
|
Dim UltimaFluctuacion = GlobalTipoCambioUltimaFluctuacion(Now)
|
||||||
|
If UltimaFluctuacion IsNot Nothing Then
|
||||||
|
DdlMes.SelectedValueExist(UltimaFluctuacion.FechaFluctuacion.Month)
|
||||||
|
DdlMes.SelectedValueExist(UltimaFluctuacion.FechaFluctuacion.Year)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||||
CargaTipoCambio()
|
CargaTipoCambio()
|
||||||
@@ -47,36 +76,52 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
|
|
||||||
Private Sub CargaTipoCambio()
|
Private Sub CargaTipoCambio()
|
||||||
Dim ObjGenerales As New ClsGenerales
|
Dim ObjGenerales As New ClsGenerales
|
||||||
ObjGenerales.GetTipoCambio(-1, TxtFecha.Text.ToDate)
|
ObjGenerales.GetTipoCambio(-1, FechaUltimoDiaMes)
|
||||||
If ObjGenerales.DtResultados.Rows.Count > 0 Then
|
If ObjGenerales.DtResultados.Rows.Count > 0 Then
|
||||||
LtTipoCambioActual.Text = ObjGenerales.DtResultados.Rows(0)("TipoCambio").ToString
|
LtTipoCambioActual.Text = ObjGenerales.DtResultados.Rows(0)("TipoCambio").ToString
|
||||||
TxtConceptoFluctuacion.Text = "Fluctuación a " & TxtFecha.Text
|
TxtConceptoFluctuacion.Text = "Fluctuación a " & FechaUltimoDiaMes.ToShortDateString()
|
||||||
End If
|
End If
|
||||||
ObjGenerales.Dispose()
|
ObjGenerales.Dispose()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaUltimaFluctuacion()
|
Private Sub CargaUltimaFluctuacion()
|
||||||
Dim Obj As New ClsBancos
|
'Dim Obj As New ClsBancos
|
||||||
If Obj.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
'If Obj.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||||
Dim dt As DataTable = Obj.DtResultados.FiltraParametros("TipoFluctuacion = 1", "Fecha DESC")
|
' Dim dt As DataTable = Obj.DtResultados.FiltraParametros("TipoFluctuacion = 1", "Fecha DESC")
|
||||||
If dt.Rows.Count > 0 Then
|
' If dt.Rows.Count > 0 Then
|
||||||
LtlUltimaFluctuacion.Text = String.Format("Ultima Fluctuación : {0}", dt.Rows(0)("Fecha").ToString.ToDate.ToShortDateString)
|
' LtlUltimaFluctuacion.Text = String.Format("Ultima Fluctuación : {0}", dt.Rows(0)("Fecha").ToString.ToDate.ToShortDateString)
|
||||||
'si la ultima fluctuacion es mayor o igual al fin de mes anterior, entonces pon la fecha actual
|
' 'si la ultima fluctuacion es mayor o igual al fin de mes anterior, entonces pon la fecha actual
|
||||||
If dt.Rows(0)("Fecha").ToString.ToDate >= Now.AddMonths(-1).LastDayOfMonth Then
|
' If dt.Rows(0)("Fecha").ToString.ToDate >= Now.AddMonths(-1).LastDayOfMonth Then
|
||||||
TxtFecha.Text = Now.ToShortDateString
|
' TxtFecha.Text = Now.ToShortDateString
|
||||||
Else
|
' Else
|
||||||
TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString()
|
' TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString()
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
|
'End If
|
||||||
|
'Obj.Dispose()
|
||||||
|
|
||||||
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(Now)
|
||||||
|
|
||||||
|
If UltimaFluctuacion IsNot Nothing Then
|
||||||
|
LtlUltimaFluctuacion.Text = String.Format("Ultima Fluctuación : {0}", UltimaFluctuacion.FechaFluctuacion.ToShortDateString)
|
||||||
|
'si la ultima fluctuacion es mayor o igual al fin de mes anterior, entonces pon la fecha actual
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion >= Now.AddMonths(-1).LastDayOfMonth Then
|
||||||
|
DdlMes.SelectedValueExist(Now.Month)
|
||||||
|
DdlAnio.SelectedValueExist(Now.Year)
|
||||||
|
Else
|
||||||
|
DdlMes.SelectedValueExist(Now.AddMonths(-1).Month)
|
||||||
|
DdlAnio.SelectedValueExist(Now.AddMonths(-1).Year)
|
||||||
|
'TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString()
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
Obj.Dispose()
|
|
||||||
CargaTipoCambio()
|
CargaTipoCambio()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaDatosCompra()
|
Private Sub CargaDatosCompra()
|
||||||
Dim ObjBancos As New ClsBancos
|
Dim ObjBancos As New ClsBancos
|
||||||
'LblTotalCompras.Text = "0.00"
|
'LblTotalCompras.Text = "0.00"
|
||||||
If ObjBancos.GetFluctuaciones(TxtFecha.Text.ToDate, 1, UsuarioActual.CveEmpresa) Then
|
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 1, UsuarioActual.CveEmpresa) Then
|
||||||
GvCompras.DataSource = ObjBancos.DtResultados
|
GvCompras.DataSource = ObjBancos.DtResultados
|
||||||
'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
||||||
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ")
|
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ")
|
||||||
@@ -110,7 +155,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Private Sub CargaDatosVentas()
|
Private Sub CargaDatosVentas()
|
||||||
Dim ObjBancos As New ClsBancos
|
Dim ObjBancos As New ClsBancos
|
||||||
LblTotalVentas.Text = "0.00"
|
LblTotalVentas.Text = "0.00"
|
||||||
If ObjBancos.GetFluctuaciones(TxtFecha.Text.ToDate, 2, UsuarioActual.CveEmpresa) Then
|
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 2, UsuarioActual.CveEmpresa) Then
|
||||||
GvVentas.DataSource = ObjBancos.DtResultados
|
GvVentas.DataSource = ObjBancos.DtResultados
|
||||||
|
|
||||||
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0")
|
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0")
|
||||||
@@ -142,7 +187,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Private Sub CargaDatosCuentas()
|
Private Sub CargaDatosCuentas()
|
||||||
Dim ObjBancos As New ClsBancos
|
Dim ObjBancos As New ClsBancos
|
||||||
LblTotalBancos.Text = "0.00"
|
LblTotalBancos.Text = "0.00"
|
||||||
If ObjBancos.GetFluctuaciones(TxtFecha.Text.ToDate, 4, UsuarioActual.CveEmpresa) Then
|
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 4, UsuarioActual.CveEmpresa) Then
|
||||||
Dim DtTemp As DataTable = ObjBancos.DtResultados.Copy
|
Dim DtTemp As DataTable = ObjBancos.DtResultados.Copy
|
||||||
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
||||||
Dim TotAcumulado As Decimal = 0
|
Dim TotAcumulado As Decimal = 0
|
||||||
@@ -151,7 +196,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim Total As Decimal = 0
|
Dim Total As Decimal = 0
|
||||||
Dim CveCuentaExtranjera As Integer = Dr("CveCuentaExtranjera").ToString.ToEntero
|
Dim CveCuentaExtranjera As Integer = Dr("CveCuentaExtranjera").ToString.ToEntero
|
||||||
If CveCuentaExtranjera > 0 Then
|
If CveCuentaExtranjera > 0 Then
|
||||||
If Conta.GetMovimientosAuxiliaresCatalogo(CveCuentaExtranjera, MinFecha, TxtFecha.Text.ToDate, 2, "-1", UsuarioActual.CveEmpresa, "1") Then
|
If Conta.GetMovimientosAuxiliaresCatalogo(CveCuentaExtranjera, MinFecha, FechaUltimoDiaMes, 2, "-1", UsuarioActual.CveEmpresa, "1") Then
|
||||||
If Conta.DtResultados.Rows.Count > 1 Then
|
If Conta.DtResultados.Rows.Count > 1 Then
|
||||||
Total = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
|
Total = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
|
||||||
End If
|
End If
|
||||||
@@ -162,7 +207,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim SaldoActualContabilidad As Decimal = 0
|
Dim SaldoActualContabilidad As Decimal = 0
|
||||||
Dim CveCuentaComplementaria As Integer = Dr("CveCuentaComplementaria").ToString.ToEntero
|
Dim CveCuentaComplementaria As Integer = Dr("CveCuentaComplementaria").ToString.ToEntero
|
||||||
If CveCuentaComplementaria > 0 Then
|
If CveCuentaComplementaria > 0 Then
|
||||||
If Conta.GetMovimientosAuxiliaresCatalogo(CveCuentaComplementaria, MinFecha, TxtFecha.Text.ToDate, 2, "-1", UsuarioActual.CveEmpresa, "1") Then
|
If Conta.GetMovimientosAuxiliaresCatalogo(CveCuentaComplementaria, MinFecha, FechaUltimoDiaMes, 2, "-1", UsuarioActual.CveEmpresa, "1") Then
|
||||||
If Conta.DtResultados.Rows.Count > 1 Then
|
If Conta.DtResultados.Rows.Count > 1 Then
|
||||||
SaldoActualContabilidad = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
|
SaldoActualContabilidad = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
|
||||||
End If
|
End If
|
||||||
@@ -189,7 +234,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Private Sub CargaDatosDeudores()
|
Private Sub CargaDatosDeudores()
|
||||||
Dim ObjBancos As New ClsBancos
|
Dim ObjBancos As New ClsBancos
|
||||||
LblTotalDeudores.Text = "0.00"
|
LblTotalDeudores.Text = "0.00"
|
||||||
If ObjBancos.GetFluctuaciones(TxtFecha.Text.ToDate, 5, UsuarioActual.CveEmpresa) Then
|
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 5, UsuarioActual.CveEmpresa) Then
|
||||||
GvDeudores.DataSource = ObjBancos.DtResultados
|
GvDeudores.DataSource = ObjBancos.DtResultados
|
||||||
LblTotalDeudores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
LblTotalDeudores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
||||||
Else
|
Else
|
||||||
@@ -203,7 +248,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Private Sub CargaDatosAcreedores()
|
Private Sub CargaDatosAcreedores()
|
||||||
Dim ObjBancos As New ClsBancos
|
Dim ObjBancos As New ClsBancos
|
||||||
LblTotalAcreedores.Text = "0.00"
|
LblTotalAcreedores.Text = "0.00"
|
||||||
If ObjBancos.GetFluctuaciones(TxtFecha.Text.ToDate, 6, UsuarioActual.CveEmpresa) Then
|
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 6, UsuarioActual.CveEmpresa) Then
|
||||||
GvAcreedores.DataSource = ObjBancos.DtResultados
|
GvAcreedores.DataSource = ObjBancos.DtResultados
|
||||||
LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
||||||
Else
|
Else
|
||||||
@@ -217,7 +262,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Private Sub CargaDatosFiliales()
|
Private Sub CargaDatosFiliales()
|
||||||
Dim ObjBancos As New ClsBancos
|
Dim ObjBancos As New ClsBancos
|
||||||
LblTotalAcreedores.Text = "0.00"
|
LblTotalAcreedores.Text = "0.00"
|
||||||
If ObjBancos.GetFluctuaciones(TxtFecha.Text.ToDate, 7, UsuarioActual.CveEmpresa) Then
|
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 7, UsuarioActual.CveEmpresa) Then
|
||||||
GvFiliales.DataSource = ObjBancos.DtResultados.FiltraParametros("Saldo > 0")
|
GvFiliales.DataSource = ObjBancos.DtResultados.FiltraParametros("Saldo > 0")
|
||||||
LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
||||||
Else
|
Else
|
||||||
@@ -237,15 +282,17 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim Total As Decimal = 0
|
Dim Total As Decimal = 0
|
||||||
Dim Conta As New ClsContabilidad
|
Dim Conta As New ClsContabilidad
|
||||||
Conta.IniciaTransacSQL()
|
Conta.IniciaTransacSQL()
|
||||||
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaC", 1, 0, 0, 1, TxtFecha.Text.ToDate, TxtConceptoCompras.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaC", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoCompras.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
Dim idCta As Integer = 0
|
Dim idCta As Integer = 0
|
||||||
Dim CveCuenta As Integer = 0
|
|
||||||
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
||||||
Dim idCtaPerdida, IdCtaGanancia As Integer
|
Dim idCtaPerdida, IdCtaGanancia As Integer
|
||||||
|
|
||||||
Dim TipoMovto As Boolean = False
|
Dim TipoMovto As Boolean = False
|
||||||
Dim CveConceptoContable As Integer = 0
|
Dim CveConceptoContable As Integer = 0
|
||||||
Dim CveCuentaComplementaria As Integer = 55175
|
Dim IdCtaComplementaria As Integer = 0
|
||||||
Dim IdCtaComplementaria As Integer = 1248
|
|
||||||
Dim ErrorRegistrar As Boolean = False
|
Dim ErrorRegistrar As Boolean = False
|
||||||
|
|
||||||
CveCuentaPerdida = 0 '55379
|
CveCuentaPerdida = 0 '55379
|
||||||
@@ -257,19 +304,17 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Total = LblTotal.ToDecimal
|
Total = LblTotal.ToDecimal
|
||||||
If Total > 0 Then
|
If Total > 0 Then
|
||||||
CveConceptoContable = 64
|
CveConceptoContable = 64
|
||||||
CveCuenta = CveCuentaGanancia
|
|
||||||
idCta = IdCtaGanancia
|
idCta = IdCtaGanancia
|
||||||
TipoMovto = True
|
TipoMovto = True
|
||||||
Else
|
Else
|
||||||
CveConceptoContable = 65
|
CveConceptoContable = 65
|
||||||
CveCuenta = CveCuentaPerdida
|
|
||||||
idCta = idCtaPerdida
|
idCta = idCtaPerdida
|
||||||
TipoMovto = False
|
TipoMovto = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal()
|
||||||
|
|
||||||
|
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Compras", CveConceptoContable, "Fluctuación Compras", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoCompras.SelectedValue.ToEntero) Then
|
||||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Compras", CveConceptoContable, "Fluctuación Compras", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubProyectoCompras.SelectedValue.ToEntero) Then
|
|
||||||
ErrorRegistrar = True
|
ErrorRegistrar = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -279,12 +324,18 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Total = gvr.DataKey("Fluctuacion").ToDecimal
|
Total = gvr.DataKey("Fluctuacion").ToDecimal
|
||||||
'si es pérdida o ganancia
|
'si es pérdida o ganancia
|
||||||
|
|
||||||
|
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
|
||||||
'movimiento de complementaria
|
'movimiento de complementaria
|
||||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), 201, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total, CveCuenta:=CveCuentaComplementaria) Then
|
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), 201, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total) Then
|
||||||
ErrorRegistrar = True
|
ErrorRegistrar = True
|
||||||
Exit For
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not Conta.UpdateCompraTCValuacion(gvr.DataKey("CveCompra").ToEntero, TCValuacion:=TCUltimaFluctuacion) Then
|
||||||
|
ErrorRegistrar = True
|
||||||
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If Not ErrorRegistrar Then
|
If Not ErrorRegistrar Then
|
||||||
@@ -311,16 +362,18 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim idCtaPerdida, IdCtaGanancia As Integer
|
Dim idCtaPerdida, IdCtaGanancia As Integer
|
||||||
Dim TipoMovto As Boolean = False
|
Dim TipoMovto As Boolean = False
|
||||||
Dim CveConceptoContable As Integer = 0
|
Dim CveConceptoContable As Integer = 0
|
||||||
Dim CveCuentaComplementaria As Integer = 54141
|
Dim IdCtaComplementaria As Integer = 0
|
||||||
Dim IdCtaComplementaria As Integer = 70
|
|
||||||
Dim ErrorRegistrar As Boolean = False
|
Dim ErrorRegistrar As Boolean = False
|
||||||
|
|
||||||
CveCuentaPerdida = 0 '55379
|
CveCuentaPerdida = 0 '55379
|
||||||
CveCuentaGanancia = 0 ' 55382
|
CveCuentaGanancia = 0 ' 55382
|
||||||
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
|
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
|
||||||
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
|
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
|
||||||
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
|
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
|
||||||
|
|
||||||
|
Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal()
|
||||||
|
''
|
||||||
|
|
||||||
Total = LblTotalVentas.Text.ToDecimal
|
Total = LblTotalVentas.Text.ToDecimal
|
||||||
If Total > 0 Then
|
If Total > 0 Then
|
||||||
CveConceptoContable = 64
|
CveConceptoContable = 64
|
||||||
@@ -341,7 +394,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
|
|
||||||
Dim Conta As New ClsContabilidad
|
Dim Conta As New ClsContabilidad
|
||||||
Conta.IniciaTransacSQL()
|
Conta.IniciaTransacSQL()
|
||||||
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaV", 1, 0, 0, 1, TxtFecha.Text.ToDate, TxtConceptoVentas.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaV", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoVentas.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Ventas", CveConceptoContable, "Fluctuación Ventas", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlsubProyectoVentas.SelectedValue.ToEntero) Then
|
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Ventas", CveConceptoContable, "Fluctuación Ventas", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlsubProyectoVentas.SelectedValue.ToEntero) Then
|
||||||
ErrorRegistrar = True
|
ErrorRegistrar = True
|
||||||
@@ -353,14 +406,21 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
For Each gvr As GridViewRow In GvVentas.Rows
|
For Each gvr As GridViewRow In GvVentas.Rows
|
||||||
Total = -gvr.DataKey("Fluctuacion").ToDecimal
|
Total = -gvr.DataKey("Fluctuacion").ToDecimal
|
||||||
|
|
||||||
|
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
|
||||||
|
|
||||||
If gvr.DataKey("CveIE").ToEntero > 0 AndAlso gvr.DataKey("CveVenta").ToEntero < 0 Then
|
If gvr.DataKey("CveIE").ToEntero > 0 AndAlso gvr.DataKey("CveVenta").ToEntero < 0 Then
|
||||||
CveConconceptoCliente = 226
|
CveConconceptoCliente = 226
|
||||||
Else
|
Else
|
||||||
CveConconceptoCliente = 203
|
CveConconceptoCliente = 203
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If Not Conta.UpdateVentaTCValuacion(gvr.DataKey("CveVenta").ToEntero, TCValuacion:=TCUltimaFluctuacion) Then
|
||||||
|
ErrorRegistrar = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
'movimiento de complementaria
|
'movimiento de complementaria
|
||||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total, CveCuenta:=CveCuentaComplementaria, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
|
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
|
||||||
ErrorRegistrar = True
|
ErrorRegistrar = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
@@ -395,9 +455,9 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim CveConceptoContable As Integer = 0
|
Dim CveConceptoContable As Integer = 0
|
||||||
Dim ErrorRegistrar As Boolean = False
|
Dim ErrorRegistrar As Boolean = False
|
||||||
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
||||||
Dim MesTCtexto As String = String.Format("{0} TC:{1}", TxtFecha.Text.ToDate.ToString("MMMM-yyyy"), TCCierreFluctuacion)
|
Dim MesTCtexto As String = String.Format("{0} TC:{1}", FechaUltimoDiaMes.ToString("MMMM-yyyy"), TCCierreFluctuacion)
|
||||||
|
|
||||||
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaB", 1, 0, 0, 1, TxtFecha.Text.ToDate, TxtConceptoBancos.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaB", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoBancos.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
|
|
||||||
CveCuentaPerdida = 0 ' 55379
|
CveCuentaPerdida = 0 ' 55379
|
||||||
@@ -477,7 +537,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim Total As Decimal = 0
|
Dim Total As Decimal = 0
|
||||||
Dim Conta As New ClsContabilidad
|
Dim Conta As New ClsContabilidad
|
||||||
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
|
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
|
||||||
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaDD", 1, 0, 0, 1, TxtFecha.Text.ToDate, TxtConceptoDeudores.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaDD", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoDeudores.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
Dim idCta As Integer = 0
|
Dim idCta As Integer = 0
|
||||||
Dim CveCuenta As Integer = 0
|
Dim CveCuenta As Integer = 0
|
||||||
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
||||||
@@ -494,7 +554,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
||||||
|
|
||||||
Total = LblTotalAcreedores.Text.ToDecimal
|
Total = LblTotalAcreedores.Text.ToDecimal
|
||||||
Dim ConceptoFluctuacion As String = String.Format("Fluctuación Filiales {0} ", TxtFecha.Text)
|
Dim ConceptoFluctuacion As String = String.Format("Fluctuación Filiales {0} ", FechaUltimoDiaMes)
|
||||||
|
|
||||||
Dim CveConconceptoDeudores As Integer = 256
|
Dim CveConconceptoDeudores As Integer = 256
|
||||||
|
|
||||||
@@ -553,7 +613,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
|
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
|
||||||
Dim ObjContPaq As New ClsContPAQi(UsuarioActual.Empresa)
|
Dim ObjContPaq As New ClsContPAQi(UsuarioActual.Empresa)
|
||||||
ObjContPaq.IniciaTransacSQL()
|
ObjContPaq.IniciaTransacSQL()
|
||||||
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaFilial", 1, 0, 0, 1, TxtFecha.Text.ToDate, TxtConceptoFiliales.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaFilial", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoFiliales.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
Dim idCta As Integer = 0
|
Dim idCta As Integer = 0
|
||||||
Dim CveCuenta As Integer = 0
|
Dim CveCuenta As Integer = 0
|
||||||
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
||||||
@@ -572,7 +632,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
||||||
|
|
||||||
Total = LblTotalAcreedores.Text.ToDecimal
|
Total = LblTotalAcreedores.Text.ToDecimal
|
||||||
Dim ConceptoFluctuacion As String = String.Format("Fluctuación Filiales {0} ", TxtFecha.Text)
|
Dim ConceptoFluctuacion As String = String.Format("Fluctuación Filiales {0} ", FechaUltimoDiaMes)
|
||||||
|
|
||||||
'saco las cuentas de pérdida y ganancia
|
'saco las cuentas de pérdida y ganancia
|
||||||
For Each gvr As GridViewRow In GvFiliales.Rows
|
For Each gvr As GridViewRow In GvFiliales.Rows
|
||||||
@@ -646,7 +706,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
|||||||
Dim Total As Decimal = 0
|
Dim Total As Decimal = 0
|
||||||
Dim Conta As New ClsContabilidad
|
Dim Conta As New ClsContabilidad
|
||||||
Conta.IniciaTransacSQL()
|
Conta.IniciaTransacSQL()
|
||||||
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaA", 1, 0, 0, 1, TxtFecha.Text.ToDate, TxtConceptoAcreedores.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaA", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoAcreedores.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
Dim idCta As Integer = 0
|
Dim idCta As Integer = 0
|
||||||
Dim CveCuenta As Integer = 0
|
Dim CveCuenta As Integer = 0
|
||||||
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ Partial Class Bancos_PopIECompras
|
|||||||
CveMonedaCompra = dr("CveMoneda").ToString.ToEntero
|
CveMonedaCompra = dr("CveMoneda").ToString.ToEntero
|
||||||
CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero
|
CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero
|
||||||
SerieFolio = dr("SerieFolio").ToString
|
SerieFolio = dr("SerieFolio").ToString
|
||||||
TipoCambioOriginal = dr("TipoCambio").ToString.ToDecimal
|
TipoCambioOriginal = dr("TipoCambioOriginal").ToString.ToDecimal
|
||||||
NombreProveedor = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RazonSocial", String.Format("CveProveedor = {0}", CveProveedor))
|
NombreProveedor = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RazonSocial", String.Format("CveProveedor = {0}", CveProveedor))
|
||||||
|
|
||||||
CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero
|
CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero
|
||||||
@@ -1474,6 +1474,14 @@ Partial Class Bancos_PopIECompras
|
|||||||
Dim CveCuentaContabilizacion As Long = 1
|
Dim CveCuentaContabilizacion As Long = 1
|
||||||
Dim CuentasContablesInvalidasSIG As New StringBuilder
|
Dim CuentasContablesInvalidasSIG As New StringBuilder
|
||||||
|
|
||||||
|
Dim FechaPago As Date = TxtFechaDocumento.Text.ToDate()
|
||||||
|
'VERIFICA SI SE ESTA PAGANDO EN EL MISMO MES DE LA FACTURA
|
||||||
|
Dim PagoMismoMes As Boolean = True
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso (FechaDocumento < FechaPago) AndAlso ((FechaDocumento.Month < FechaPago.Month AndAlso FechaDocumento.Year = FechaPago.Year) OrElse (FechaDocumento.Year < FechaPago.Year)) Then
|
||||||
|
PagoMismoMes = False
|
||||||
|
End If
|
||||||
|
Dim TCUltimaFluctuacion As Decimal = 1
|
||||||
|
|
||||||
'Tipos de cambio segun metodo de pago
|
'Tipos de cambio segun metodo de pago
|
||||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
||||||
tipoCambioPago = 1
|
tipoCambioPago = 1
|
||||||
@@ -1491,6 +1499,13 @@ Partial Class Bancos_PopIECompras
|
|||||||
tipoCambioPago = TxtTipoCambio.Text.ToDecimal
|
tipoCambioPago = TxtTipoCambio.Text.ToDecimal
|
||||||
tipoCambioCompra = 1
|
tipoCambioCompra = 1
|
||||||
PorcentajePago = ImportePagado.ToString.ToDecimal / MovimientoPagar.Total
|
PorcentajePago = ImportePagado.ToString.ToDecimal / MovimientoPagar.Total
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim UltimaFluctuacion = GlobalTipoCambioUltimaFluctuacion(TxtFechaDocumento.Text.ToDate)
|
||||||
|
If UltimaFluctuacion IsNot Nothing Then
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion < TxtFechaDocumento.Text.ToDate Then
|
||||||
|
TCUltimaFluctuacion = UltimaFluctuacion.TCFluctuacion
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Select Case RBLContado.SelectedValue
|
Select Case RBLContado.SelectedValue
|
||||||
@@ -1569,17 +1584,17 @@ Partial Class Bancos_PopIECompras
|
|||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
End If
|
End If
|
||||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||||
ImporteMX = ImporteMX.RoundSQL
|
ImporteMX = ImporteMX.RoundSQL
|
||||||
TimpocambioGeneral = tipoCambioCompra
|
TimpocambioGeneral = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
|
|
||||||
CveIE = rw.DataKey("CveIE").ToString.ToEntero
|
CveIE = rw.DataKey("CveIE").ToString.ToEntero
|
||||||
If CveMonedaCompra <> 1 Then
|
If CveMonedaCompra <> 1 Then
|
||||||
@@ -1617,17 +1632,17 @@ Partial Class Bancos_PopIECompras
|
|||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
End If
|
End If
|
||||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||||
ImporteMX = ImporteMX.RoundSQL
|
ImporteMX = ImporteMX.RoundSQL
|
||||||
TimpocambioGeneral = tipoCambioCompra
|
TimpocambioGeneral = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
|
|
||||||
CveIE = rw.DataKey("CveIE").ToString.ToEntero
|
CveIE = rw.DataKey("CveIE").ToString.ToEntero
|
||||||
If CveMonedaCompra <> 1 Then
|
If CveMonedaCompra <> 1 Then
|
||||||
@@ -1640,14 +1655,14 @@ Partial Class Bancos_PopIECompras
|
|||||||
IdCtaContable = CtaProveedor
|
IdCtaContable = CtaProveedor
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, TxtObservaciones.Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra, -1, -1, CveProveedor:=CveProveedor2, ImporteMX:=ImporteMX, TipoCambio:=tipoCambioCompra) Then
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, TxtObservaciones.Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra, -1, -1, CveProveedor:=CveProveedor2, ImporteMX:=ImporteMX, TipoCambio:=If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)) Then
|
||||||
MsgError = "No se pudo insertar la póliza"
|
MsgError = "No se pudo insertar la póliza"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CveMonedaCompra <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
If CveMonedaCompra <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
||||||
IdCtaContable = IdCtaContComplementaria
|
IdCtaContable = IdCtaContComplementaria
|
||||||
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
||||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra) Then
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion) - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)) Then
|
||||||
MsgError = "No se pudo insertar la póliza"
|
MsgError = "No se pudo insertar la póliza"
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -1664,13 +1679,13 @@ Partial Class Bancos_PopIECompras
|
|||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
End If
|
End If
|
||||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||||
ImporteMX = ImporteMX.RoundSQL
|
ImporteMX = ImporteMX.RoundSQL
|
||||||
@@ -1686,14 +1701,14 @@ Partial Class Bancos_PopIECompras
|
|||||||
IdCtaContable = CtaProveedor
|
IdCtaContable = CtaProveedor
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, TxtObservaciones.Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra, -1, -1, CveProveedor:=CveProveedor2, ImporteMX:=ImporteMX, TipoCambio:=tipoCambioCompra) Then
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, TxtObservaciones.Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra, -1, -1, CveProveedor:=CveProveedor2, ImporteMX:=ImporteMX, TipoCambio:=If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)) Then
|
||||||
MsgError = "No se pudo insertar la póliza"
|
MsgError = "No se pudo insertar la póliza"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CveMonedaCompra <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
If CveMonedaCompra <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
||||||
IdCtaContable = IdCtaContComplementaria
|
IdCtaContable = IdCtaContComplementaria
|
||||||
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
||||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra) Then
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion) - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)) Then
|
||||||
MsgError = "No se pudo insertar la póliza"
|
MsgError = "No se pudo insertar la póliza"
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -1710,13 +1725,13 @@ Partial Class Bancos_PopIECompras
|
|||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
End If
|
End If
|
||||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||||
ImporteMX = ImporteMX.RoundSQL
|
ImporteMX = ImporteMX.RoundSQL
|
||||||
@@ -1731,14 +1746,14 @@ Partial Class Bancos_PopIECompras
|
|||||||
IdCtaContable = CtaProveedor
|
IdCtaContable = CtaProveedor
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, TxtObservaciones.Text, 275, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, rw.DataKey("CveVenta").ToEntero, CveCompra, -1, -1, CveProveedor:=CveProveedor2, ImporteMX:=ImporteMX, TipoCambio:=tipoCambioCompra) Then
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, TxtObservaciones.Text, 275, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, rw.DataKey("CveVenta").ToEntero, CveCompra, -1, -1, CveProveedor:=CveProveedor2, ImporteMX:=ImporteMX, TipoCambio:=If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)) Then
|
||||||
MsgError = "No se pudo insertar la póliza"
|
MsgError = "No se pudo insertar la póliza"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CveMonedaCompra = 2 Then
|
If CveMonedaCompra = 2 Then
|
||||||
IdCtaContable = IdCtaContComplementaria
|
IdCtaContable = IdCtaContComplementaria
|
||||||
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
||||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, rw.DataKey("CveVenta").ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra) Then
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, rw.DataKey("CveVenta").ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion) - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)) Then
|
||||||
MsgError = "No se pudo insertar la póliza"
|
MsgError = "No se pudo insertar la póliza"
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -1755,17 +1770,17 @@ Partial Class Bancos_PopIECompras
|
|||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = ImportePagado.ToString.ToDecimal / tipoCambioPago
|
ImporteMovimiento = ImportePagado.ToString.ToDecimal / tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||||
ImporteMovimiento = ImportePagado.ToString.ToDecimal * tipoCambioPago
|
ImporteMovimiento = ImportePagado.ToString.ToDecimal * tipoCambioPago
|
||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = ImportePagado.ToString.ToDecimal
|
ImporteMovimiento = ImportePagado.ToString.ToDecimal
|
||||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
End If
|
End If
|
||||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||||
ImporteMX = ImporteMX.RoundSQL
|
ImporteMX = ImporteMX.RoundSQL
|
||||||
TimpocambioGeneral = tipoCambioCompra
|
TimpocambioGeneral = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CveMonedaCompra = 1 Then
|
If CveMonedaCompra = 1 Then
|
||||||
@@ -1773,7 +1788,7 @@ Partial Class Bancos_PopIECompras
|
|||||||
Else
|
Else
|
||||||
IdCtaContable = IdCtaContComplementaria
|
IdCtaContable = IdCtaContComplementaria
|
||||||
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
||||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra) Then
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion) - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)) Then
|
||||||
MsgError = "No se pudo insertar la póliza"
|
MsgError = "No se pudo insertar la póliza"
|
||||||
End If
|
End If
|
||||||
ImporteMX = ImporteMovimiento
|
ImporteMX = ImporteMovimiento
|
||||||
@@ -2557,9 +2572,10 @@ Partial Class Bancos_PopIECompras
|
|||||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
||||||
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||||
TimpocambioGeneral = TCImpuestos
|
TimpocambioGeneral = TCImpuestos
|
||||||
|
Dim tipoCambioCompraValuacion As Decimal = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
'' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra
|
'' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra
|
||||||
If tipoCambioPago < tipoCambioCompra AndAlso CveMonedaCompra = 2 Then
|
If tipoCambioPago < tipoCambioCompra AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago) - ((MovimientoPagar.Total * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en la venta
|
ImporteMovimiento = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago) - ((MovimientoPagar.Total * PorcentajePago) * tipoCambioCompraValuacion) 'Añadimos la diferencia de ganancia en la venta
|
||||||
ImporteMovimiento -= ((MovimientoPagar.IVA * PorcentajePago) * TCImpuestos) - ((MovimientoPagar.IVA * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el IVA
|
ImporteMovimiento -= ((MovimientoPagar.IVA * PorcentajePago) * TCImpuestos) - ((MovimientoPagar.IVA * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el IVA
|
||||||
ImporteMovimiento += ((MovimientoPagar.RetIVA * PorcentajePago) * TCImpuestos) - ((MovimientoPagar.RetIVA * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el RetIVA
|
ImporteMovimiento += ((MovimientoPagar.RetIVA * PorcentajePago) * TCImpuestos) - ((MovimientoPagar.RetIVA * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el RetIVA
|
||||||
ImporteMovimiento += ((MovimientoPagar.RetISR * PorcentajePago) * TCImpuestos) - ((MovimientoPagar.RetISR * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el RetISR
|
ImporteMovimiento += ((MovimientoPagar.RetISR * PorcentajePago) * TCImpuestos) - ((MovimientoPagar.RetISR * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el RetISR
|
||||||
@@ -2581,9 +2597,10 @@ Partial Class Bancos_PopIECompras
|
|||||||
If CveMoneda <> 1 OrElse CveMonedaCompra <> 1 Then
|
If CveMoneda <> 1 OrElse CveMonedaCompra <> 1 Then
|
||||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
||||||
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||||
|
Dim tipoCambioCompraValuacion As Decimal = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||||
'' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra
|
'' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra
|
||||||
If tipoCambioPago > tipoCambioCompra AndAlso CveMonedaCompra = 2 Then
|
If tipoCambioPago > tipoCambioCompra AndAlso CveMonedaCompra = 2 Then
|
||||||
ImporteMovimiento = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioCompra) - ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta
|
ImporteMovimiento = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioCompraValuacion) - ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta
|
||||||
ImporteMovimiento -= ((MovimientoPagar.IVA * PorcentajePago) * tipoCambioCompra) - ((MovimientoPagar.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA
|
ImporteMovimiento -= ((MovimientoPagar.IVA * PorcentajePago) * tipoCambioCompra) - ((MovimientoPagar.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA
|
||||||
ImporteMovimiento += ((MovimientoPagar.RetIVA * PorcentajePago) * tipoCambioCompra) - ((MovimientoPagar.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA
|
ImporteMovimiento += ((MovimientoPagar.RetIVA * PorcentajePago) * tipoCambioCompra) - ((MovimientoPagar.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA
|
||||||
ImporteMovimiento += ((MovimientoPagar.RetISR * PorcentajePago) * tipoCambioCompra) - ((MovimientoPagar.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR
|
ImporteMovimiento += ((MovimientoPagar.RetISR * PorcentajePago) * tipoCambioCompra) - ((MovimientoPagar.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR
|
||||||
|
|||||||
@@ -1513,20 +1513,30 @@ Partial Class Bancos_PopIEVentas
|
|||||||
Dim CuentasContablesInvalidasSIG As New StringBuilder
|
Dim CuentasContablesInvalidasSIG As New StringBuilder
|
||||||
Dim TipoCambioFluctuacion As Decimal = 1
|
Dim TipoCambioFluctuacion As Decimal = 1
|
||||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||||
If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
|
||||||
If ObjIE.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
|
||||||
Dim strFecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
|
||||||
Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & strFecha & "#", "Fecha DESC")
|
|
||||||
|
|
||||||
If drr IsNot Nothing Then
|
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
||||||
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
|
||||||
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||||
End If
|
|
||||||
End If
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion < tFecha Then
|
||||||
|
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
|
||||||
|
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||||
|
' If ObjIE.DtResultados.Rows.Count > 0 Then
|
||||||
|
|
||||||
|
' Dim strFecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
||||||
|
' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & strFecha & "#", "Fecha DESC")
|
||||||
|
|
||||||
|
' If drr IsNot Nothing Then
|
||||||
|
' FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
||||||
|
' TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
If CveMoneda = 1 AndAlso CveMonedaVenta = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
If CveMoneda = 1 AndAlso CveMonedaVenta = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
||||||
tipoCambioPago = 1
|
tipoCambioPago = 1
|
||||||
|
|||||||
@@ -924,20 +924,31 @@ Partial Class Bancos_ProveedoresAbonar
|
|||||||
|
|
||||||
Dim TipoCambioFluctuacion As Decimal = 1
|
Dim TipoCambioFluctuacion As Decimal = 1
|
||||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||||
If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
|
||||||
If ObjIE.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
|
||||||
Dim FechaC As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
|
||||||
Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & FechaC & "#", "Fecha DESC")
|
|
||||||
|
|
||||||
If drr IsNot Nothing Then
|
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
||||||
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||||
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion < tFecha Then
|
||||||
|
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
|
||||||
|
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||||
|
' If ObjIE.DtResultados.Rows.Count > 0 Then
|
||||||
|
' Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
||||||
|
' Dim FechaC As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
||||||
|
' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & FechaC & "#", "Fecha DESC")
|
||||||
|
|
||||||
|
' If drr IsNot Nothing Then
|
||||||
|
' FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
||||||
|
' TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
|
|
||||||
Dim DttPlantilla As DataTable = Nothing
|
Dim DttPlantilla As DataTable = Nothing
|
||||||
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
|
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
|
||||||
|
|||||||
@@ -269,7 +269,17 @@
|
|||||||
<asp:ListBox ID="DdlEmpresas" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server" DataTextField="Empresa" DataValueField="CveEmpresa"></asp:ListBox>
|
<asp:ListBox ID="DdlEmpresas" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server" DataTextField="Empresa" DataValueField="CveEmpresa"></asp:ListBox>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-1 truncate" title="Tipo Cliente:" data-toggle="tooltip" data-placement="top">
|
||||||
|
Moneda:
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2">
|
||||||
|
<asp:DropDownList ID="DdlMoneda" runat="server" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||||
|
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
||||||
|
<asp:ListItem Text="Pesos" Value="1"></asp:ListItem>
|
||||||
|
<asp:ListItem Text="Dolares" Value="2"></asp:ListItem>
|
||||||
|
</asp:DropDownList>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ Partial Class Compras_RepCxP
|
|||||||
If txtFechaVF.Text = "" Then FechaVF = "-1"
|
If txtFechaVF.Text = "" Then FechaVF = "-1"
|
||||||
Dim TipoAgrupacion As Integer = IIf(chkAgruparMes.Checked, 1, -1)
|
Dim TipoAgrupacion As Integer = IIf(chkAgruparMes.Checked, 1, -1)
|
||||||
Dim TipoDocto As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM)
|
Dim TipoDocto As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM)
|
||||||
If Mov.GetCxP(FechaI, FechaF, DdlProveedor.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedoresClasificaciones.SelectedValue.ToEntero, -1, DdlUsuarioResponsable.SelectedValue.ToEntero, DdlUsuarioRegistro.SelectedValue.ToEntero, DdlEstatusCompra.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero,
|
If Mov.GetCxP(FechaI, FechaF, DdlProveedor.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedoresClasificaciones.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero(), DdlUsuarioResponsable.SelectedValue.ToEntero, DdlUsuarioRegistro.SelectedValue.ToEntero, DdlEstatusCompra.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero,
|
||||||
DdlSubProyecto.SelectedValue.ToEntero, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico, FechaVI, FechaVF, FechaCorte:=txtCorteA.Text.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveTipoProveedor:=IIf(DdlTipoProveedor.SelectedValue.ToEntero = 3, -1, DdlTipoProveedor.SelectedValue.ToEntero), Comprobaciones:=DdlComprobacion.SelectedValue.ToEntero,
|
DdlSubProyecto.SelectedValue.ToEntero, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico, FechaVI, FechaVF, FechaCorte:=txtCorteA.Text.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveTipoProveedor:=IIf(DdlTipoProveedor.SelectedValue.ToEntero = 3, -1, DdlTipoProveedor.SelectedValue.ToEntero), Comprobaciones:=DdlComprobacion.SelectedValue.ToEntero,
|
||||||
TipoDocto:=TipoDocto, TipoAgrupacion:=TipoAgrupacion) Then
|
TipoDocto:=TipoDocto, TipoAgrupacion:=TipoAgrupacion) Then
|
||||||
GvCxP.DataSource = Mov.DtResultados
|
GvCxP.DataSource = Mov.DtResultados
|
||||||
|
|||||||
@@ -130,7 +130,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LbImprimirPresupuesto" Visible="true" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Presupuesto PDF</asp:LinkButton>
|
<asp:LinkButton ID="LbImprimirPresupuesto" Visible="true" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Presupuesto PDF</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:LinkButton ID="LbImprimirPresupuestoExcel" Visible="true" runat="server"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Presupuesto Excel</asp:LinkButton>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LbImprmirAF" Visible="true" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Activos Fijos PDF</asp:LinkButton>
|
<asp:LinkButton ID="LbImprmirAF" Visible="true" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Activos Fijos PDF</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
@@ -170,6 +172,7 @@
|
|||||||
<asp:PostBackTrigger ControlID="LBImprimirInformacionG" />
|
<asp:PostBackTrigger ControlID="LBImprimirInformacionG" />
|
||||||
<asp:PostBackTrigger ControlID="lbImprimirAvance" />
|
<asp:PostBackTrigger ControlID="lbImprimirAvance" />
|
||||||
<asp:PostBackTrigger ControlID="LbImprimirPresupuesto" />
|
<asp:PostBackTrigger ControlID="LbImprimirPresupuesto" />
|
||||||
|
<asp:PostBackTrigger ControlID="LbImprimirPresupuestoExcel" />
|
||||||
<asp:PostBackTrigger ControlID="LbImprmirAF" />
|
<asp:PostBackTrigger ControlID="LbImprmirAF" />
|
||||||
<asp:PostBackTrigger ControlID="LbImprmirAFExcel" />
|
<asp:PostBackTrigger ControlID="LbImprmirAFExcel" />
|
||||||
<asp:PostBackTrigger ControlID="LbImprimirPedDev" />
|
<asp:PostBackTrigger ControlID="LbImprimirPedDev" />
|
||||||
|
|||||||
@@ -2754,7 +2754,7 @@ Partial Class Contratos_Default
|
|||||||
|
|
||||||
Private Sub CargaGVGastos()
|
Private Sub CargaGVGastos()
|
||||||
Dim objContrato As New ClsContratos
|
Dim objContrato As New ClsContratos
|
||||||
If objContrato.GetContratoGastos(CveContrato, UsuarioActual.cveempresa) Then
|
If objContrato.GetContratoGastos(CveContrato, UsuarioActual.CveEmpresa) Then
|
||||||
DtGastos = objContrato.DtResultados
|
DtGastos = objContrato.DtResultados
|
||||||
GvContratosGastos.DataSource = DtGastos
|
GvContratosGastos.DataSource = DtGastos
|
||||||
SumaGasto = objContrato.DtResultados.SUM("Importe", "CveContratoGasto IS NULL")
|
SumaGasto = objContrato.DtResultados.SUM("Importe", "CveContratoGasto IS NULL")
|
||||||
@@ -3835,6 +3835,9 @@ Partial Class Contratos_Default
|
|||||||
#Region "I M P R E S I O N D E P R E S U P U E S T O "
|
#Region "I M P R E S I O N D E P R E S U P U E S T O "
|
||||||
Private Sub lLbImprimirPresupuesto_Click(sender As Object, e As EventArgs) Handles LbImprimirPresupuesto.Click
|
Private Sub lLbImprimirPresupuesto_Click(sender As Object, e As EventArgs) Handles LbImprimirPresupuesto.Click
|
||||||
GenerarPDFPPresupuesto()
|
GenerarPDFPPresupuesto()
|
||||||
|
End Sub
|
||||||
|
Private Sub lLbImprimirPresupuestoEXCEL_Click(sender As Object, e As EventArgs) Handles LbImprimirPresupuestoExcel.Click
|
||||||
|
GenerarPDFPPresupuesto(Formato:="EXCEL")
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub GenerarPDFPPresupuesto(Optional Formato As String = "PDF")
|
Private Sub GenerarPDFPPresupuesto(Optional Formato As String = "PDF")
|
||||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||||
|
|||||||
@@ -335,9 +335,20 @@
|
|||||||
<asp:ListItem Text="Venta Mostrador" Value="2"></asp:ListItem>
|
<asp:ListItem Text="Venta Mostrador" Value="2"></asp:ListItem>
|
||||||
</asp:DropDownList>
|
</asp:DropDownList>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-1 truncate" title="Tipo Cliente:" data-toggle="tooltip" data-placement="top">
|
||||||
|
Moneda:
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2">
|
||||||
|
<asp:DropDownList ID="DdlMoneda" runat="server" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||||
|
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
||||||
|
<asp:ListItem Text="Pesos" Value="1"></asp:ListItem>
|
||||||
|
<asp:ListItem Text="Dolares" Value="2"></asp:ListItem>
|
||||||
|
</asp:DropDownList>
|
||||||
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<asp:CheckBox ID="ChkAnticipos" runat="server" Text="Incluye Anticipos" TextAlign="Left" Visible="false" />
|
<asp:CheckBox ID="ChkAnticipos" runat="server" Text="Incluye Anticipos" TextAlign="Left" Visible="false" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ Partial Class RepCxC
|
|||||||
"-1", UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico,
|
"-1", UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico,
|
||||||
If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM), FechaVI, FechaVF, FechaCorte:=txtCorteA.Text.ToDate, EstatusCliente:=DdlEstatusCliente.SelectedValue.ToEntero,
|
If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM), FechaVI, FechaVF, FechaCorte:=txtCorteA.Text.ToDate, EstatusCliente:=DdlEstatusCliente.SelectedValue.ToEntero,
|
||||||
CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveCobranzaEstatus:=CveCobranzaEstatus, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero,
|
CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveCobranzaEstatus:=CveCobranzaEstatus, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero,
|
||||||
TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, AplicaAnticiposPagados:=AplicaAnticipos) Then
|
TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, AplicaAnticiposPagados:=AplicaAnticipos, CveMoneda:=DdlMoneda.SelectedValue.ToEntero()) Then
|
||||||
|
|
||||||
GvDatos.DataSource = ObjMovtos.DtResultados
|
GvDatos.DataSource = ObjMovtos.DtResultados
|
||||||
DtDatos = ObjMovtos.DtResultados
|
DtDatos = ObjMovtos.DtResultados
|
||||||
|
|||||||
@@ -204,29 +204,25 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
divEmitir.Visible = False
|
divEmitir.Visible = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa.Contiene(1, 119, 140, 2) Then
|
If UsuarioActual.CveEmpresa.Contiene(1, 2, 119, 140) Then
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(161) = "1" Then
|
|
||||||
ChkEmitirTimbrado.Checked = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
ChkEmitirCartaPorte.Visible = True
|
ChkEmitirCartaPorte.Visible = True
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
CantidadTotal = 0
|
CantidadTotal = 0
|
||||||
CvePS = 0
|
CvePS = 0
|
||||||
TipoSeccionAlmacen = 0
|
TipoSeccionAlmacen = 0
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(281).ToEntero = 1 Then
|
If UsuarioActual.Empresa.Funcionalidad(281).ToEntero = 1 Then
|
||||||
|
|
||||||
TxtFecha.Enabled = False
|
TxtFecha.Enabled = False
|
||||||
ImgFecha.Visible = False
|
ImgFecha.Visible = False
|
||||||
|
|
||||||
TxtFechaRecepcion.Enabled = False
|
TxtFechaRecepcion.Enabled = False
|
||||||
ImgFechaRecepcion.Visible = False
|
ImgFechaRecepcion.Visible = False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
If ChkTransitorio.Checked Then
|
If ChkTransitorio.Checked Then
|
||||||
@@ -731,19 +727,19 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
#Region " GUARDAR "
|
#Region " GUARDAR "
|
||||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
||||||
|
|
||||||
If ChkEmitirTimbrado.Checked Then
|
'If ChkEmitirTimbrado.Checked Then
|
||||||
|
|
||||||
If DdlChofer.SelectedValue.ToEntero <= 0 Then
|
' If DdlChofer.SelectedValue.ToEntero <= 0 Then
|
||||||
Alert("Debe de seleccionar un chofer")
|
' Alert("Debe de seleccionar un chofer")
|
||||||
Exit Sub
|
' Exit Sub
|
||||||
End If
|
' End If
|
||||||
If DdlUnidadCamion.SelectedValue.ToEntero <= 0 Then
|
' If DdlUnidadCamion.SelectedValue.ToEntero <= 0 Then
|
||||||
Alert("Debe de seleccionar una unidad")
|
' Alert("Debe de seleccionar una unidad")
|
||||||
Exit Sub
|
' Exit Sub
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
'VALIDA ALMACEN ORIGEN Y DESTINO
|
'VALIDA ALMACEN ORIGEN Y DESTINO
|
||||||
If DdlAlmacenOrigen.SelectedValue = DdlAlmacenDestino.SelectedValue Then
|
If DdlAlmacenOrigen.SelectedValue = DdlAlmacenDestino.SelectedValue Then
|
||||||
@@ -1156,7 +1152,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
Dim CveSubProyectoTimbre As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {DdlAlmacenOrigen.SelectedValue}").Rows(0)("CveSubProyecto").ToString.ToEntero
|
Dim CveSubProyectoTimbre As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {DdlAlmacenOrigen.SelectedValue}").Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||||
Dim Fechallegada As DateTime = (TxtFechaLlegada.Text & " 23:59:59").ToDateTime
|
Dim Fechallegada As DateTime = (TxtFechaLlegada.Text & " 23:59:59").ToDateTime
|
||||||
|
|
||||||
Dim CveEntregaAlmacen As Integer = ObjGral.AddInvEntregaAlmacenRuta(CveSubProyectoTimbre, -1, -1, CveMovimientoSalida, DdlChofer.SelectedValue.ToEntero, DdlUnidadCamion.SelectedValue.ToEntero, TxtFechaEntrega.Text.ToDate, Fechallegada, "T", "-1", "-1", Now, 1, 1, 1)
|
Dim CveEntregaAlmacen As Integer = ObjGral.AddInvEntregaAlmacenRuta(CveSubProyectoTimbre, -1, -1, CveMovimientoSalida, DdlChofer.SelectedValue.ToEntero, DdlUnidadCamion.SelectedValue.ToEntero, TxtFechaEntrega.Text.ToDate, Fechallegada, "T", "", "", MinFecha, 1, 1, 1)
|
||||||
|
|
||||||
If CveEntregaAlmacen > 0 Then
|
If CveEntregaAlmacen > 0 Then
|
||||||
CveTimbre = ObjGral.AddGralTimbre("Tra", CveSubProyectoTimbre, TxtFechaEntrega.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=ChkEmitirCartaPorte.Checked)
|
CveTimbre = ObjGral.AddGralTimbre("Tra", CveSubProyectoTimbre, TxtFechaEntrega.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=ChkEmitirCartaPorte.Checked)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -800,20 +800,31 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
|
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
|
||||||
Dim TipoCambioFluctuacion As Decimal = 1
|
Dim TipoCambioFluctuacion As Decimal = 1
|
||||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||||
If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
|
||||||
If ObjIE.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
|
||||||
Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
|
||||||
Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
|
|
||||||
|
|
||||||
If drr IsNot Nothing Then
|
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
||||||
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||||
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion < tFecha Then
|
||||||
|
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
|
||||||
|
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||||
|
' If ObjIE.DtResultados.Rows.Count > 0 Then
|
||||||
|
' Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
||||||
|
' Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
||||||
|
' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
|
||||||
|
|
||||||
|
' If drr IsNot Nothing Then
|
||||||
|
' FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
||||||
|
' TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
|
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
|
||||||
dtConceptos = ObjMov.DtResultados
|
dtConceptos = ObjMov.DtResultados
|
||||||
End If
|
End If
|
||||||
@@ -2554,24 +2565,35 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
Dim CvePrePoliza As Integer = 0
|
Dim CvePrePoliza As Integer = 0
|
||||||
Dim MsgError As String = ""
|
Dim MsgError As String = ""
|
||||||
|
|
||||||
Dim ObjIE As New ClsBancos
|
'Dim ObjIE As New ClsBancos
|
||||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||||
Dim TipoCambioFluctuacion As Decimal = 1
|
Dim TipoCambioFluctuacion As Decimal = 1
|
||||||
If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
|
||||||
If ObjIE.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim tFecha As Date = TxtFechaIncobrable.Text.ToDate
|
|
||||||
Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
|
||||||
Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
|
|
||||||
|
|
||||||
If drr IsNot Nothing Then
|
Dim tFecha As Date = TxtFechaIncobrable.Text.ToDate
|
||||||
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||||
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion < tFecha Then
|
||||||
|
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
|
||||||
|
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjIE.Dispose()
|
'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||||
|
' If ObjIE.DtResultados.Rows.Count > 0 Then
|
||||||
|
' Dim tFecha As Date = TxtFechaIncobrable.Text.ToDate
|
||||||
|
' Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
||||||
|
' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
|
||||||
|
|
||||||
|
' If drr IsNot Nothing Then
|
||||||
|
' FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
||||||
|
' TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
|
'ObjIE.Dispose()
|
||||||
|
|
||||||
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/ClientesAbonar/SaldarI", 47, 0, 0, 1, TxtFechaIncobrable.Text.ToDate, TxtObsSaldarIncobrable.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/ClientesAbonar/SaldarI", 47, 0, 0, 1, TxtFechaIncobrable.Text.ToDate, TxtObsSaldarIncobrable.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
|
|||||||
@@ -4388,7 +4388,7 @@ Partial Class Ventas
|
|||||||
DdlTipoComprobante.Items.Insert(0, New ListItem("Devolucion", "Dev"))
|
DdlTipoComprobante.Items.Insert(0, New ListItem("Devolucion", "Dev"))
|
||||||
HplDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto"))))
|
HplDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto"))))
|
||||||
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString()
|
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString()
|
||||||
ViewState("CveDevolucion") = DbRowVenta("CveVentaPadre").ToString().ToEntero()
|
'ViewState("CveDevolucion") = DbRowVenta("CveVentaPadre").ToString().ToEntero()
|
||||||
Trsaldo.Visible = True
|
Trsaldo.Visible = True
|
||||||
HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
|
HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
|
||||||
HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
|
HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
|
||||||
@@ -6286,7 +6286,7 @@ Partial Class Ventas
|
|||||||
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
|
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
|
||||||
|
|
||||||
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
|
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
|
||||||
If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
|
If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
|
||||||
RBLPago.SelectedValue = "2"
|
RBLPago.SelectedValue = "2"
|
||||||
RBLPago.Items(0).Enabled = False
|
RBLPago.Items(0).Enabled = False
|
||||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
@@ -14615,20 +14615,31 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||||
Dim TipoCambioFluctuacion As Decimal = 1
|
Dim TipoCambioFluctuacion As Decimal = 1
|
||||||
If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
Dim tFecha As Date = Now
|
||||||
If ObjIE.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim tFecha As Date = Now 'gvr.DataKey("Fecha").ToDate
|
|
||||||
Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
|
||||||
Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
|
|
||||||
|
|
||||||
If drr IsNot Nothing Then
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||||
FechaUltimaFluctuacion = drr("Fecha").ToString().ToDate
|
|
||||||
TipoCambioFluctuacion = drr("TipoCambio").ToString().ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion < tFecha Then
|
||||||
|
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
|
||||||
|
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||||
|
' If ObjIE.DtResultados.Rows.Count > 0 Then
|
||||||
|
' Dim tFecha As Date = Now 'gvr.DataKey("Fecha").ToDate
|
||||||
|
' Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
||||||
|
' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
|
||||||
|
|
||||||
|
' If drr IsNot Nothing Then
|
||||||
|
' FechaUltimaFluctuacion = drr("Fecha").ToString().ToDate
|
||||||
|
' TipoCambioFluctuacion = drr("TipoCambio").ToString().ToDecimal
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN PESOS
|
If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN PESOS
|
||||||
tipoCambioPago = 1
|
tipoCambioPago = 1
|
||||||
tipoCambioVenta = 1
|
tipoCambioVenta = 1
|
||||||
@@ -23944,6 +23955,7 @@ Partial Class Ventas
|
|||||||
For Each Dr2 As DataRow In DtContratosSerieDetalle.FiltraParametros($"ConsecId = {Dr("CveContratoDetalle")}").Rows
|
For Each Dr2 As DataRow In DtContratosSerieDetalle.FiltraParametros($"ConsecId = {Dr("CveContratoDetalle")}").Rows
|
||||||
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, Serie:=Dr2("Serie").ToString(), FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
|
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, Serie:=Dr2("Serie").ToString(), FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
|
||||||
If Existencia < 1 Then
|
If Existencia < 1 Then
|
||||||
|
GuardaLogAD($"El producto no tiene existencia: CvePS:{CveProducto},CveUnidad:{CveUnidad},Cantidad: {Cantidad},Existencia: {Existencia},CveAlmacen:{CveAlmacenExistenciasContrato},Serie:{Dr2("Serie").ToString()}")
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -23956,6 +23968,7 @@ Partial Class Ventas
|
|||||||
Else
|
Else
|
||||||
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
|
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
|
||||||
If Existencia < Cantidad Then
|
If Existencia < Cantidad Then
|
||||||
|
GuardaLogAD($"El producto no tiene existencia: CvePS:{CveProducto},CveUnidad:{CveUnidad},Cantidad: {Cantidad},Existencia: {Existencia},CveAlmacen:{CveAlmacenExistenciasContrato}")
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -24728,24 +24741,34 @@ Partial Class Ventas
|
|||||||
Dim CvePrePoliza As Integer = 0
|
Dim CvePrePoliza As Integer = 0
|
||||||
Dim MsgError As String = ""
|
Dim MsgError As String = ""
|
||||||
|
|
||||||
Dim ObjIE As New ClsBancos
|
'Dim ObjIE As New ClsBancos
|
||||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||||
Dim TipoCambioFluctuacion As Decimal = 1
|
Dim TipoCambioFluctuacion As Decimal = 1
|
||||||
If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
|
||||||
If ObjIE.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim tFecha As Date = TxtFechaSaldarVenta.Text.ToDate
|
|
||||||
Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
|
||||||
Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
|
|
||||||
|
|
||||||
If drr IsNot Nothing Then
|
Dim tFecha As Date = TxtFechaSaldarVenta.Text.ToDate
|
||||||
FechaUltimaFluctuacion = drr("Fecha").ToString().ToDate
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||||
TipoCambioFluctuacion = drr("TipoCambio").ToString().ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion < tFecha Then
|
||||||
|
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
|
||||||
|
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||||
|
' If ObjIE.DtResultados.Rows.Count > 0 Then
|
||||||
|
' Dim tFecha As Date = TxtFechaSaldarVenta.Text.ToDate
|
||||||
|
' Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
||||||
|
' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
|
||||||
|
|
||||||
ObjIE.Dispose()
|
' If drr IsNot Nothing Then
|
||||||
|
' FechaUltimaFluctuacion = drr("Fecha").ToString().ToDate
|
||||||
|
' TipoCambioFluctuacion = drr("TipoCambio").ToString().ToDecimal
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
|
' ObjIE.Dispose()
|
||||||
|
|
||||||
|
|
||||||
Dim IdCtaContable As Integer = IdCtaContClientes
|
Dim IdCtaContable As Integer = IdCtaContClientes
|
||||||
@@ -27728,20 +27751,29 @@ Partial Class Ventas
|
|||||||
TipoCambioFactura = TxtTipoCambio.Text.ToDecimal
|
TipoCambioFactura = TxtTipoCambio.Text.ToDecimal
|
||||||
|
|
||||||
If DdlMoneda.SelectedValue.ToEntero() > 1 Then
|
If DdlMoneda.SelectedValue.ToEntero() > 1 Then
|
||||||
Dim ObjIE As New ClsBancos
|
Dim tFecha As Date = TxtFecha.Text.ToDate
|
||||||
If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||||
If ObjIE.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim tFecha As Date = TxtFecha.Text.ToDate
|
|
||||||
Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
|
||||||
Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha > #" & Fecha & "#", "Fecha DESC")
|
|
||||||
|
|
||||||
If drr IsNot Nothing Then
|
|
||||||
TipoCambioFactura = drr("TipoCambio").ToString().ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||||
|
If UltimaFluctuacion.FechaFluctuacion > tFecha Then
|
||||||
|
TipoCambioFactura = UltimaFluctuacion.TCFluctuacion
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
ObjIE.Dispose()
|
|
||||||
|
'Dim ObjIE As New ClsBancos
|
||||||
|
'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||||
|
' If ObjIE.DtResultados.Rows.Count > 0 Then
|
||||||
|
' Dim tFecha As Date = TxtFecha.Text.ToDate
|
||||||
|
' Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
|
||||||
|
' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha > #" & Fecha & "#", "Fecha DESC")
|
||||||
|
|
||||||
|
' If drr IsNot Nothing Then
|
||||||
|
' TipoCambioFactura = drr("TipoCambio").ToString().ToDecimal
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
'ObjIE.Dispose()
|
||||||
Else
|
Else
|
||||||
TipoCambioFactura = 1
|
TipoCambioFactura = 1
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user