E119. Fluctuacion cambiaria mensual
This commit is contained in:
@@ -6543,6 +6543,47 @@ Public Class ClsContabilidad
|
||||
Return Retorno
|
||||
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"
|
||||
' IDisposable
|
||||
|
||||
@@ -1734,7 +1734,7 @@ Public Class ClsGenerales
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
End Function
|
||||
Public Function GetTipoCambio(CveTipoCambio As Integer, Fecha As Date) As Boolean
|
||||
Dim Retorno = False
|
||||
|
||||
@@ -1754,6 +1754,26 @@ Public Class ClsGenerales
|
||||
|
||||
Return Retorno
|
||||
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
|
||||
Dim Retorno = False
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ Public Class ClsMovimientos
|
||||
Gpo As Integer, CveResponsable As Integer,
|
||||
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 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
|
||||
'Data = New DataTable
|
||||
@@ -274,7 +274,8 @@ Public Class ClsMovimientos
|
||||
.Add("@CveCobranzaEstatus", SqlDbType.Int).Value = CveCobranzaEstatus
|
||||
.Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion
|
||||
.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
|
||||
|
||||
Try
|
||||
|
||||
@@ -127,6 +127,47 @@ Public Class ClsPaginas
|
||||
End Set
|
||||
|
||||
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
|
||||
Get
|
||||
If GlobalTipoCambioEuro <= 0 Then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,18 @@
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Globalization
|
||||
Imports Extensiones
|
||||
Partial Class Bancos_FluctuacionCambiaria
|
||||
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"
|
||||
Private Property LblTotal() As String
|
||||
Get
|
||||
@@ -19,7 +27,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
CargaFechas()
|
||||
CargarCentrosDeCosto(Nothing, DdlSubproyectoBancos, Nothing, LblSubProyectoBancos, "")
|
||||
CargarCentrosDeCosto(Nothing, DdlsubProyectoVentas, Nothing, LblSubProyectoVentas, "")
|
||||
CargarCentrosDeCosto(Nothing, DdlSubProyectoCompras, Nothing, LblSubProyectoCompras, "")
|
||||
@@ -32,6 +40,27 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
End Sub
|
||||
|
||||
#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
|
||||
CargaTipoCambio()
|
||||
@@ -47,36 +76,52 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
|
||||
Private Sub CargaTipoCambio()
|
||||
Dim ObjGenerales As New ClsGenerales
|
||||
ObjGenerales.GetTipoCambio(-1, TxtFecha.Text.ToDate)
|
||||
ObjGenerales.GetTipoCambio(-1, FechaUltimoDiaMes)
|
||||
If ObjGenerales.DtResultados.Rows.Count > 0 Then
|
||||
LtTipoCambioActual.Text = ObjGenerales.DtResultados.Rows(0)("TipoCambio").ToString
|
||||
TxtConceptoFluctuacion.Text = "Fluctuación a " & TxtFecha.Text
|
||||
TxtConceptoFluctuacion.Text = "Fluctuación a " & FechaUltimoDiaMes.ToShortDateString()
|
||||
End If
|
||||
ObjGenerales.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaUltimaFluctuacion()
|
||||
Dim Obj As New ClsBancos
|
||||
If Obj.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||
Dim dt As DataTable = Obj.DtResultados.FiltraParametros("TipoFluctuacion = 1", "Fecha DESC")
|
||||
If dt.Rows.Count > 0 Then
|
||||
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
|
||||
If dt.Rows(0)("Fecha").ToString.ToDate >= Now.AddMonths(-1).LastDayOfMonth Then
|
||||
TxtFecha.Text = Now.ToShortDateString
|
||||
Else
|
||||
TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString()
|
||||
End If
|
||||
End If
|
||||
'Dim Obj As New ClsBancos
|
||||
'If Obj.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
|
||||
' Dim dt As DataTable = Obj.DtResultados.FiltraParametros("TipoFluctuacion = 1", "Fecha DESC")
|
||||
' If dt.Rows.Count > 0 Then
|
||||
' 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
|
||||
' If dt.Rows(0)("Fecha").ToString.ToDate >= Now.AddMonths(-1).LastDayOfMonth Then
|
||||
' TxtFecha.Text = Now.ToShortDateString
|
||||
' Else
|
||||
' TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString()
|
||||
' 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
|
||||
Obj.Dispose()
|
||||
|
||||
CargaTipoCambio()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatosCompra()
|
||||
Dim ObjBancos As New ClsBancos
|
||||
'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
|
||||
'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
||||
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ")
|
||||
@@ -110,7 +155,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Private Sub CargaDatosVentas()
|
||||
Dim ObjBancos As New ClsBancos
|
||||
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
|
||||
|
||||
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0")
|
||||
@@ -142,7 +187,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Private Sub CargaDatosCuentas()
|
||||
Dim ObjBancos As New ClsBancos
|
||||
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 TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
|
||||
Dim TotAcumulado As Decimal = 0
|
||||
@@ -151,7 +196,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim Total As Decimal = 0
|
||||
Dim CveCuentaExtranjera As Integer = Dr("CveCuentaExtranjera").ToString.ToEntero
|
||||
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
|
||||
Total = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
|
||||
End If
|
||||
@@ -162,7 +207,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim SaldoActualContabilidad As Decimal = 0
|
||||
Dim CveCuentaComplementaria As Integer = Dr("CveCuentaComplementaria").ToString.ToEntero
|
||||
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
|
||||
SaldoActualContabilidad = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
|
||||
End If
|
||||
@@ -189,7 +234,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Private Sub CargaDatosDeudores()
|
||||
Dim ObjBancos As New ClsBancos
|
||||
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
|
||||
LblTotalDeudores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
||||
Else
|
||||
@@ -203,7 +248,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Private Sub CargaDatosAcreedores()
|
||||
Dim ObjBancos As New ClsBancos
|
||||
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
|
||||
LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
||||
Else
|
||||
@@ -217,7 +262,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Private Sub CargaDatosFiliales()
|
||||
Dim ObjBancos As New ClsBancos
|
||||
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")
|
||||
LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
|
||||
Else
|
||||
@@ -237,15 +282,17 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
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 CveCuenta As Integer = 0
|
||||
|
||||
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
||||
Dim idCtaPerdida, IdCtaGanancia As Integer
|
||||
|
||||
Dim TipoMovto As Boolean = False
|
||||
Dim CveConceptoContable As Integer = 0
|
||||
Dim CveCuentaComplementaria As Integer = 55175
|
||||
Dim IdCtaComplementaria As Integer = 1248
|
||||
Dim IdCtaComplementaria As Integer = 0
|
||||
|
||||
Dim ErrorRegistrar As Boolean = False
|
||||
|
||||
CveCuentaPerdida = 0 '55379
|
||||
@@ -257,19 +304,17 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Total = LblTotal.ToDecimal
|
||||
If Total > 0 Then
|
||||
CveConceptoContable = 64
|
||||
CveCuenta = CveCuentaGanancia
|
||||
idCta = IdCtaGanancia
|
||||
TipoMovto = True
|
||||
Else
|
||||
CveConceptoContable = 65
|
||||
CveCuenta = CveCuentaPerdida
|
||||
idCta = idCtaPerdida
|
||||
TipoMovto = False
|
||||
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), CveCuenta:=CveCuenta, 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), CveSubProyecto:=DdlSubProyectoCompras.SelectedValue.ToEntero) Then
|
||||
ErrorRegistrar = True
|
||||
End If
|
||||
|
||||
@@ -279,12 +324,18 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Total = gvr.DataKey("Fluctuacion").ToDecimal
|
||||
'si es pérdida o ganancia
|
||||
|
||||
|
||||
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
|
||||
'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
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If Not Conta.UpdateCompraTCValuacion(gvr.DataKey("CveCompra").ToEntero, TCValuacion:=TCUltimaFluctuacion) Then
|
||||
ErrorRegistrar = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If Not ErrorRegistrar Then
|
||||
@@ -311,16 +362,18 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim idCtaPerdida, IdCtaGanancia As Integer
|
||||
Dim TipoMovto As Boolean = False
|
||||
Dim CveConceptoContable As Integer = 0
|
||||
Dim CveCuentaComplementaria As Integer = 54141
|
||||
Dim IdCtaComplementaria As Integer = 70
|
||||
Dim IdCtaComplementaria As Integer = 0
|
||||
Dim ErrorRegistrar As Boolean = False
|
||||
|
||||
CveCuentaPerdida = 0 '55379
|
||||
CveCuentaGanancia = 0 ' 55382
|
||||
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
|
||||
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
|
||||
If Total > 0 Then
|
||||
CveConceptoContable = 64
|
||||
@@ -341,7 +394,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
|
||||
Dim Conta As New ClsContabilidad
|
||||
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
|
||||
ErrorRegistrar = True
|
||||
@@ -353,14 +406,21 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
For Each gvr As GridViewRow In GvVentas.Rows
|
||||
Total = -gvr.DataKey("Fluctuacion").ToDecimal
|
||||
|
||||
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
|
||||
|
||||
If gvr.DataKey("CveIE").ToEntero > 0 AndAlso gvr.DataKey("CveVenta").ToEntero < 0 Then
|
||||
CveConconceptoCliente = 226
|
||||
Else
|
||||
CveConconceptoCliente = 203
|
||||
End If
|
||||
|
||||
If Not Conta.UpdateVentaTCValuacion(gvr.DataKey("CveVenta").ToEntero, TCValuacion:=TCUltimaFluctuacion) Then
|
||||
ErrorRegistrar = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'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
|
||||
Exit For
|
||||
End If
|
||||
@@ -395,9 +455,9 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim CveConceptoContable As Integer = 0
|
||||
Dim ErrorRegistrar As Boolean = False
|
||||
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
|
||||
@@ -477,7 +537,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
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 CveCuenta As Integer = 0
|
||||
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
||||
@@ -494,7 +554,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.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
|
||||
|
||||
@@ -553,7 +613,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
|
||||
Dim ObjContPaq As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
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 CveCuenta As Integer = 0
|
||||
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
||||
@@ -572,7 +632,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.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
|
||||
For Each gvr As GridViewRow In GvFiliales.Rows
|
||||
@@ -646,7 +706,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
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 CveCuenta As Integer = 0
|
||||
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
|
||||
|
||||
@@ -637,7 +637,7 @@ Partial Class Bancos_PopIECompras
|
||||
CveMonedaCompra = dr("CveMoneda").ToString.ToEntero
|
||||
CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero
|
||||
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))
|
||||
|
||||
CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero
|
||||
@@ -1474,6 +1474,14 @@ Partial Class Bancos_PopIECompras
|
||||
Dim CveCuentaContabilizacion As Long = 1
|
||||
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
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
||||
tipoCambioPago = 1
|
||||
@@ -1491,6 +1499,13 @@ Partial Class Bancos_PopIECompras
|
||||
tipoCambioPago = TxtTipoCambio.Text.ToDecimal
|
||||
tipoCambioCompra = 1
|
||||
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
|
||||
|
||||
Select Case RBLContado.SelectedValue
|
||||
@@ -1569,17 +1584,17 @@ Partial Class Bancos_PopIECompras
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
End If
|
||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||
ImporteMX = ImporteMX.RoundSQL
|
||||
TimpocambioGeneral = tipoCambioCompra
|
||||
TimpocambioGeneral = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
|
||||
CveIE = rw.DataKey("CveIE").ToString.ToEntero
|
||||
If CveMonedaCompra <> 1 Then
|
||||
@@ -1617,17 +1632,17 @@ Partial Class Bancos_PopIECompras
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
End If
|
||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||
ImporteMX = ImporteMX.RoundSQL
|
||||
TimpocambioGeneral = tipoCambioCompra
|
||||
TimpocambioGeneral = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
|
||||
CveIE = rw.DataKey("CveIE").ToString.ToEntero
|
||||
If CveMonedaCompra <> 1 Then
|
||||
@@ -1640,14 +1655,14 @@ Partial Class Bancos_PopIECompras
|
||||
IdCtaContable = CtaProveedor
|
||||
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"
|
||||
End If
|
||||
|
||||
If CveMonedaCompra <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
||||
IdCtaContable = IdCtaContComplementaria
|
||||
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"
|
||||
End If
|
||||
End If
|
||||
@@ -1664,13 +1679,13 @@ Partial Class Bancos_PopIECompras
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
End If
|
||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||
ImporteMX = ImporteMX.RoundSQL
|
||||
@@ -1686,14 +1701,14 @@ Partial Class Bancos_PopIECompras
|
||||
IdCtaContable = CtaProveedor
|
||||
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"
|
||||
End If
|
||||
|
||||
If CveMonedaCompra <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then
|
||||
IdCtaContable = IdCtaContComplementaria
|
||||
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"
|
||||
End If
|
||||
End If
|
||||
@@ -1710,13 +1725,13 @@ Partial Class Bancos_PopIECompras
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal / tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal * tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
End If
|
||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||
ImporteMX = ImporteMX.RoundSQL
|
||||
@@ -1731,14 +1746,14 @@ Partial Class Bancos_PopIECompras
|
||||
IdCtaContable = CtaProveedor
|
||||
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"
|
||||
End If
|
||||
|
||||
If CveMonedaCompra = 2 Then
|
||||
IdCtaContable = IdCtaContComplementaria
|
||||
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"
|
||||
End If
|
||||
End If
|
||||
@@ -1755,17 +1770,17 @@ Partial Class Bancos_PopIECompras
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = ImportePagado.ToString.ToDecimal / tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = ImportePagado.ToString.ToDecimal * tipoCambioPago
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = ImportePagado.ToString.ToDecimal
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ImporteMX = ImporteMovimiento * If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
End If
|
||||
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
||||
ImporteMX = ImporteMX.RoundSQL
|
||||
TimpocambioGeneral = tipoCambioCompra
|
||||
TimpocambioGeneral = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
End If
|
||||
|
||||
If CveMonedaCompra = 1 Then
|
||||
@@ -1773,7 +1788,7 @@ Partial Class Bancos_PopIECompras
|
||||
Else
|
||||
IdCtaContable = IdCtaContComplementaria
|
||||
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"
|
||||
End If
|
||||
ImporteMX = ImporteMovimiento
|
||||
@@ -2557,9 +2572,10 @@ Partial Class Bancos_PopIECompras
|
||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
||||
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
TimpocambioGeneral = TCImpuestos
|
||||
Dim tipoCambioCompraValuacion As Decimal = If(PagoMismoMes, tipoCambioCompra, TCUltimaFluctuacion)
|
||||
'' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra
|
||||
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.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
|
||||
@@ -2581,9 +2597,10 @@ Partial Class Bancos_PopIECompras
|
||||
If CveMoneda <> 1 OrElse CveMonedaCompra <> 1 Then
|
||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
||||
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
|
||||
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.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
|
||||
|
||||
@@ -1496,20 +1496,30 @@ Partial Class Bancos_PopIEVentas
|
||||
Dim CuentasContablesInvalidasSIG As New StringBuilder
|
||||
Dim TipoCambioFluctuacion As Decimal = 1
|
||||
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
|
||||
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
||||
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
||||
End If
|
||||
End If
|
||||
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
||||
|
||||
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||
|
||||
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
|
||||
|
||||
'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
|
||||
tipoCambioPago = 1
|
||||
|
||||
@@ -924,20 +924,31 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
|
||||
Dim TipoCambioFluctuacion As Decimal = 1
|
||||
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
|
||||
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
||||
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
||||
End If
|
||||
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
||||
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||
|
||||
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
|
||||
|
||||
'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
|
||||
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>
|
||||
</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>
|
||||
|
||||
@@ -180,7 +180,7 @@ Partial Class Compras_RepCxP
|
||||
If txtFechaVF.Text = "" Then FechaVF = "-1"
|
||||
Dim TipoAgrupacion As Integer = IIf(chkAgruparMes.Checked, 1, -1)
|
||||
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,
|
||||
TipoDocto:=TipoDocto, TipoAgrupacion:=TipoAgrupacion) Then
|
||||
GvCxP.DataSource = Mov.DtResultados
|
||||
|
||||
@@ -335,9 +335,20 @@
|
||||
<asp:ListItem Text="Venta Mostrador" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</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">
|
||||
<asp:CheckBox ID="ChkAnticipos" runat="server" Text="Incluye Anticipos" TextAlign="Left" Visible="false" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ Partial Class RepCxC
|
||||
"-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,
|
||||
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
|
||||
DtDatos = ObjMovtos.DtResultados
|
||||
|
||||
@@ -800,20 +800,31 @@ Partial Class Ventas_ClientesAbonar
|
||||
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
|
||||
Dim TipoCambioFluctuacion As Decimal = 1
|
||||
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
|
||||
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
||||
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
||||
End If
|
||||
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
||||
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||
|
||||
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
|
||||
|
||||
'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
|
||||
dtConceptos = ObjMov.DtResultados
|
||||
End If
|
||||
@@ -2554,24 +2565,35 @@ Partial Class Ventas_ClientesAbonar
|
||||
Dim CvePrePoliza As Integer = 0
|
||||
Dim MsgError As String = ""
|
||||
|
||||
Dim ObjIE As New ClsBancos
|
||||
'Dim ObjIE As New ClsBancos
|
||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||
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
|
||||
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
|
||||
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
|
||||
End If
|
||||
Dim tFecha As Date = TxtFechaIncobrable.Text.ToDate
|
||||
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -6285,7 +6285,7 @@ Partial Class Ventas
|
||||
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
|
||||
|
||||
'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.Items(0).Enabled = False
|
||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||
@@ -14611,20 +14611,31 @@ Partial Class Ventas
|
||||
|
||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||
Dim TipoCambioFluctuacion As Decimal = 1
|
||||
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")
|
||||
Dim tFecha As Date = Now
|
||||
|
||||
If drr IsNot Nothing Then
|
||||
FechaUltimaFluctuacion = drr("Fecha").ToString().ToDate
|
||||
TipoCambioFluctuacion = drr("TipoCambio").ToString().ToDecimal
|
||||
End If
|
||||
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||
|
||||
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
|
||||
|
||||
'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
|
||||
tipoCambioPago = 1
|
||||
tipoCambioVenta = 1
|
||||
@@ -23935,6 +23946,7 @@ Partial Class Ventas
|
||||
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)
|
||||
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
|
||||
End If
|
||||
|
||||
@@ -23947,6 +23959,7 @@ Partial Class Ventas
|
||||
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)
|
||||
If Existencia < Cantidad Then
|
||||
GuardaLogAD($"El producto no tiene existencia: CvePS:{CveProducto},CveUnidad:{CveUnidad},Cantidad: {Cantidad},Existencia: {Existencia},CveAlmacen:{CveAlmacenExistenciasContrato}")
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -24719,24 +24732,34 @@ Partial Class Ventas
|
||||
Dim CvePrePoliza As Integer = 0
|
||||
Dim MsgError As String = ""
|
||||
|
||||
Dim ObjIE As New ClsBancos
|
||||
'Dim ObjIE As New ClsBancos
|
||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||
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
|
||||
FechaUltimaFluctuacion = drr("Fecha").ToString().ToDate
|
||||
TipoCambioFluctuacion = drr("TipoCambio").ToString().ToDecimal
|
||||
End If
|
||||
Dim tFecha As Date = TxtFechaSaldarVenta.Text.ToDate
|
||||
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||
|
||||
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
|
||||
'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
|
||||
@@ -27719,20 +27742,29 @@ Partial Class Ventas
|
||||
TipoCambioFactura = TxtTipoCambio.Text.ToDecimal
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero() > 1 Then
|
||||
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
|
||||
Dim tFecha As Date = TxtFecha.Text.ToDate
|
||||
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||
If UltimaFluctuacion.FechaFluctuacion > tFecha Then
|
||||
TipoCambioFactura = UltimaFluctuacion.TCFluctuacion
|
||||
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
|
||||
TipoCambioFactura = 1
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user