This commit is contained in:
rakcsle
2021-12-21 20:44:24 -07:00
21 changed files with 2042 additions and 1678 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
@@ -275,6 +275,7 @@ Public Class ClsMovimientos
.Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion
.Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente
.Add("@AplicaAnticiposPagados", SqlDbType.Int).Value = AplicaAnticiposPagados
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
End With
Try

View File

@@ -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

View File

@@ -5080,6 +5080,7 @@ Namespace Modelos
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen Then
'REALIZA DEVOLUCION A LAS SALIDAS PENDIENTES
If ObjFactura.TipoDocto <> "Rem" Then
For Each RowMovimiento As DataRow In DtSalidas.Rows
Dim CveConceptoMovimiento As Integer = -1
Dim CveAlmacenMovimiento As Integer = -1
@@ -5272,10 +5273,10 @@ Namespace Modelos
End If
Next
End If
'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)
If Not ErrorCancelar Then
@@ -5314,6 +5315,40 @@ Namespace Modelos
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
If Not ErrorCancelar Then
If Not GeneraMovimientosApartados(ObjInventario) Then

View File

@@ -117,11 +117,13 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Case "sendMailLPM"
context.Response.Write(sendMailLPM(context))
Case "getSATColomias"
getSATColonias(context)
getSatColonias(context)
Case "GetFilesDirectory"
GetFilesDirectory(context)
Case "Getetiquetas"
Getetiquetas(context)
Case "cancelarRemision"
cancelarRemision(context)
End Select
Catch ex As Exception
ex.GuardaLog(ex.Message)
@@ -1599,4 +1601,47 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Return retorno
End Function
#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

View File

@@ -127,25 +127,20 @@
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<label class="col-md-1 ">Fecha:</label>
<label class="col-md-1 ">Mes:</label>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 110px !important; padding: 0px; margin-bottom: -10px;">
<asp:TextBox ID="TxtFecha" runat="server" CssClass="form-control" CausesValidation="true" Width="98%" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFecha" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<asp:DropDownList ID="DdlMes" runat="server" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
</asp:DropDownList>
</div>
<ajax:MaskedEditExtender ID="MEEFecha" runat="server" TargetControlID="TxtFecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFecha" TargetControlID="TxtFecha" PopupButtonID="LnkFecha" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFecha" runat="server" ControlToValidate="TxtFecha" Display="None" ErrorMessage="El campo <b>''Fecha''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCEFecha" runat="server" HighlightCssClass="vco" TargetControlID="CVFecha" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:RequiredFieldValidator ID="RFVFecha" runat="server" ControlToValidate="TxtFecha" Display="None" ErrorMessage="El campo <b>''Fecha''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEFecha2" runat="server" HighlightCssClass="vco" TargetControlID="RFVFecha" Width="350px"></ajax:ValidatorCalloutExtender>
<label class="col-md-1 ">Año:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlAnio" runat="server" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
</asp:DropDownList>
</div>
<div class="col-md-1">
<h5>TC:<asp:Literal runat="server" ID="LtTipoCambioActual"></asp:Literal></h5>
</div>
<div class="col-md-2">
<div class="col-md-5">
<asp:TextBox ID="TxtConceptoFluctuacion" runat="server"></asp:TextBox>
</div>
@@ -203,7 +198,8 @@
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="widget-thumb text-uppercase bordered">
<h4 class="widget-thumb-heading"><asp:Label ID="LblComprasPerdidaGanancia" runat="server" Text=""></asp:Label></h4>
<h4 class="widget-thumb-heading">
<asp:Label ID="LblComprasPerdidaGanancia" runat="server" Text=""></asp:Label></h4>
<div class="widget-thumb-wrap">
<i id="IImagenResultado" runat="server" class=""></i>
<div class="widget-thumb-body">
@@ -237,9 +233,10 @@
</div>
<div class="col-md-1 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoCompras" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%" >
<asp:DropDownList ID="DdlSubProyectoCompras" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoCompras.ClientID.ToString()%>"><asp:Label runat="server" ID="LblSubProyectoCompras"></asp:Label></label>
<label for="<%= DdlSubProyectoCompras.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoCompras"></asp:Label></label>
<asp:RequiredFieldValidator ID="RFVDdlSubProyectoCompras" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoCompras" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarCompras"></asp:RequiredFieldValidator>
<i></i>
</div>
@@ -255,7 +252,7 @@
<br />
<asp:GridView ID="GvCompras" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveCompra,CveProveedor,Fluctuacion,SerieFolio,FluctuacionTotal,PerdidaGanancia"
DataKeyNames="CveCompra,CveProveedor,Fluctuacion,SerieFolio,FluctuacionTotal,PerdidaGanancia,IdCtaContComplementaria"
EmptyDataText="No se Encontraron compras pendientes de pagar." ToolTip="Listado de Compras"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
@@ -309,7 +306,8 @@
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="widget-thumb text-uppercase bordered">
<h4 class="widget-thumb-heading"> <asp:Label ID="LblVentasPerdidaGanancia" runat="server" Text=""></asp:Label></h4>
<h4 class="widget-thumb-heading">
<asp:Label ID="LblVentasPerdidaGanancia" runat="server" Text=""></asp:Label></h4>
<div class="widget-thumb-wrap">
<i id="IImagenFinalVentas" runat="server" class=""></i>
<div class="widget-thumb-body">
@@ -342,9 +340,11 @@
</div>
<div class="col-md-1 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlsubProyectoVentas" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%" >
<asp:DropDownList ID="DdlsubProyectoVentas" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlsubProyectoVentas.ClientID.ToString()%>"> <asp:Label runat="server" ID="LblSubProyectoVentas"></asp:Label> </label>
<label for="<%= DdlsubProyectoVentas.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoVentas"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVDdlsubProyectoVentas" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlsubProyectoVentas" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarVentas"></asp:RequiredFieldValidator>
<i></i>
</div>
@@ -362,7 +362,7 @@
<asp:GridView ID="GvVentas" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="TipoCambio,Fluctuacion,CveVenta,SerieFolio,CveIE" EmptyDataText="No se Encontraron Cuentas Bancarias."
DataKeyNames="TipoCambio,Fluctuacion,CveVenta,SerieFolio,CveIE,IdCtaContComplementaria" EmptyDataText="No se Encontraron Cuentas Bancarias."
ToolTip="Listado de Cuentas Bancarias" CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField DataTextField="Nombre" HeaderText="Cliente" Target="_blank" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" DataNavigateUrlFields="CveCliente" />
@@ -394,9 +394,11 @@
</div>
<div class="col-md-1 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubproyectoBancos" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%" >
<asp:DropDownList ID="DdlSubproyectoBancos" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubproyectoBancos.ClientID.ToString()%>"> <asp:Label runat="server" ID="LblSubProyectoBancos"></asp:Label> </label>
<label for="<%= DdlSubproyectoBancos.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoBancos"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVDdlSubproyectoBancos" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubproyectoBancos" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarBancos"></asp:RequiredFieldValidator>
<i></i>
</div>
@@ -452,9 +454,11 @@
</div>
<div class="col-md-1 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoDeudores" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%" >
<asp:DropDownList ID="DdlSubProyectoDeudores" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoDeudores.ClientID.ToString()%>"> <asp:Label runat="server" ID="LblSubProyectoDeudores"></asp:Label> </label>
<label for="<%= DdlSubProyectoDeudores.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoDeudores"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVRFVDdlSubProyectoDeudores" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoDeudores" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarDeudores"></asp:RequiredFieldValidator>
<i></i>
</div>
@@ -501,9 +505,11 @@
</div>
<div class="col-md-1 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoAcreedores" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%" >
<asp:DropDownList ID="DdlSubProyectoAcreedores" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoAcreedores.ClientID.ToString()%>"> <asp:Label runat="server" ID="LblSubProyectoAcreedores"></asp:Label> </label>
<label for="<%= DdlSubProyectoAcreedores.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoAcreedores"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVDdlSubProyectoAcreedores" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoAcreedores" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarAcreedores"></asp:RequiredFieldValidator>
<i></i>
</div>
@@ -548,9 +554,11 @@
</div>
<div class="col-md-1 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoFiliales" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%" >
<asp:DropDownList ID="DdlSubProyectoFiliales" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoFiliales.ClientID.ToString()%>"> <asp:Label runat="server" ID="LblSubProyectoFiliales"></asp:Label> </label>
<label for="<%= DdlSubProyectoFiliales.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoFiliales"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVDdlSubProyectoFiliales" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoFiliales" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarFiliales"></asp:RequiredFieldValidator>
<i></i>
</div>
@@ -565,7 +573,6 @@
<div style="float: right; margin-right: 50px;">
</div>

View File

@@ -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)
'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 dt.Rows(0)("Fecha").ToString.ToDate >= Now.AddMonths(-1).LastDayOfMonth Then
TxtFecha.Text = Now.ToShortDateString
If UltimaFluctuacion.FechaFluctuacion >= Now.AddMonths(-1).LastDayOfMonth Then
DdlMes.SelectedValueExist(Now.Month)
DdlAnio.SelectedValueExist(Now.Year)
Else
TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString()
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()
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,8 +362,7 @@ 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
@@ -321,6 +371,9 @@ Partial Class Bancos_FluctuacionCambiaria
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
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

View File

@@ -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
@@ -1493,6 +1501,13 @@ Partial Class Bancos_PopIECompras
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
Case "1" ' Banco
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, Fecha, TxtFolio.Text.Trim, TxtPagueseA.Text.Trim, ImportePagado, CveMoneda, tipoCambioPago, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), CveCuentaDeposito:=CveCuentaDeposito, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), ConceptoCIE:=If(TxtConceptoCIE.Text.Trim.Length > 0, TxtConceptoCIE.Text, "-1"))
@@ -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

View File

@@ -1513,20 +1513,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
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

View File

@@ -924,19 +924,30 @@ 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")
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
If drr IsNot Nothing Then
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
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

View File

@@ -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>

View File

@@ -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

View File

@@ -130,7 +130,9 @@
<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>
</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>
<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>
@@ -170,6 +172,7 @@
<asp:PostBackTrigger ControlID="LBImprimirInformacionG" />
<asp:PostBackTrigger ControlID="lbImprimirAvance" />
<asp:PostBackTrigger ControlID="LbImprimirPresupuesto" />
<asp:PostBackTrigger ControlID="LbImprimirPresupuestoExcel" />
<asp:PostBackTrigger ControlID="LbImprmirAF" />
<asp:PostBackTrigger ControlID="LbImprmirAFExcel" />
<asp:PostBackTrigger ControlID="LbImprimirPedDev" />

View File

@@ -2754,7 +2754,7 @@ Partial Class Contratos_Default
Private Sub CargaGVGastos()
Dim objContrato As New ClsContratos
If objContrato.GetContratoGastos(CveContrato, UsuarioActual.cveempresa) Then
If objContrato.GetContratoGastos(CveContrato, UsuarioActual.CveEmpresa) Then
DtGastos = objContrato.DtResultados
GvContratosGastos.DataSource = DtGastos
SumaGasto = objContrato.DtResultados.SUM("Importe", "CveContratoGasto IS NULL")
@@ -3836,6 +3836,9 @@ Partial Class Contratos_Default
Private Sub lLbImprimirPresupuesto_Click(sender As Object, e As EventArgs) Handles LbImprimirPresupuesto.Click
GenerarPDFPPresupuesto()
End Sub
Private Sub lLbImprimirPresupuestoEXCEL_Click(sender As Object, e As EventArgs) Handles LbImprimirPresupuestoExcel.Click
GenerarPDFPPresupuesto(Formato:="EXCEL")
End Sub
Private Sub GenerarPDFPPresupuesto(Optional Formato As String = "PDF")
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)

View File

@@ -335,6 +335,17 @@
<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>

View File

@@ -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

View File

@@ -204,11 +204,7 @@ Partial Class Inventarios_TraspasoAlmacen
divEmitir.Visible = False
End If
If UsuarioActual.CveEmpresa.Contiene(1, 119, 140, 2) Then
If UsuarioActual.Empresa.Funcionalidad(161) = "1" Then
ChkEmitirTimbrado.Checked = True
End If
If UsuarioActual.CveEmpresa.Contiene(1, 2, 119, 140) Then
ChkEmitirCartaPorte.Visible = True
@@ -731,19 +727,19 @@ Partial Class Inventarios_TraspasoAlmacen
#Region " GUARDAR "
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
Alert("Debe de seleccionar un chofer")
Exit Sub
End If
If DdlUnidadCamion.SelectedValue.ToEntero <= 0 Then
Alert("Debe de seleccionar una unidad")
Exit Sub
End If
' If DdlChofer.SelectedValue.ToEntero <= 0 Then
' Alert("Debe de seleccionar un chofer")
' Exit Sub
' End If
' If DdlUnidadCamion.SelectedValue.ToEntero <= 0 Then
' Alert("Debe de seleccionar una unidad")
' Exit Sub
' End If
End If
'End If
'VALIDA ALMACEN ORIGEN Y DESTINO
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 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
CveTimbre = ObjGral.AddGralTimbre("Tra", CveSubProyectoTimbre, TxtFechaEntrega.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=ChkEmitirCartaPorte.Checked)

View File

@@ -867,14 +867,13 @@ Partial Class Sistemas_UsuarioDetalle
End If
End If
Else
If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkPermitir").Checked OrElse Row.DataKey("Permitir") = "1" AndAlso Row.FCCheckBox("ChkPermitir").Checked = False Then
If Row.DataKey("Permitir").Contiene("", "0") AndAlso Row.FCCheckBox("ChkPermitir").Checked OrElse Row.DataKey("Permitir") = "1" AndAlso Row.FCCheckBox("ChkPermitir").Checked = False Then
If Not ObjUsuarios.UpdateUsuariosModulos(CveUsuario, Row.DataKey("CveModulo").ToEntero, Row.FCCheckBox("ChkPermitir").Checked, UsuarioActual.CveUsuario) Then
TieneError = True
Exit For
End If
End If
End If
Next
End If

View File

@@ -800,19 +800,30 @@ 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")
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
If drr IsNot Nothing Then
FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate
TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal
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
dtConceptos = ObjMov.DtResultados
@@ -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 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)

View File

@@ -4388,7 +4388,7 @@ Partial Class Ventas
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"))))
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString()
ViewState("CveDevolucion") = DbRowVenta("CveVentaPadre").ToString().ToEntero()
'ViewState("CveDevolucion") = DbRowVenta("CveVentaPadre").ToString().ToEntero()
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"))
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)
'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)
@@ -14615,19 +14615,30 @@ 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
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
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
@@ -23944,6 +23955,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
@@ -23956,6 +23968,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
@@ -24728,24 +24741,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 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
@@ -27728,20 +27751,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")
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
If drr IsNot Nothing Then
TipoCambioFactura = drr("TipoCambio").ToString().ToDecimal
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
TipoCambioFactura = 1
End If