--E119. Facturación de Remisión de PO, con diferente Moneda
This commit is contained in:
@@ -5599,7 +5599,7 @@ Public Class ClsVentas
|
||||
|
||||
End Function
|
||||
|
||||
Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean
|
||||
Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, TipoCambioConsulta As Decimal, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Vta_LineasAdicionalesSaldoGet")
|
||||
@@ -5611,6 +5611,7 @@ Public Class ClsVentas
|
||||
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo
|
||||
.Add("@TipoCambioConsulta", SqlDbType.Decimal).Value = TipoCambioConsulta
|
||||
.Add("@FechaVencimientoConsulta", SqlDbType.Date).Value = FechaVencimientoConsulta
|
||||
End With
|
||||
Try
|
||||
|
||||
@@ -699,7 +699,7 @@
|
||||
<td>
|
||||
<asp:UpdatePanel ID="UPPVentas" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:DropDownList ID="DdlVendedor" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Width="200px">
|
||||
<asp:DropDownList ID="DdlVendedor" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Width="100%">
|
||||
<asp:ListItem Selected="true" Text="Sin asignar" Value="0"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</ContentTemplate>
|
||||
@@ -729,7 +729,7 @@
|
||||
<tr id="TrLineaAdicional" runat="server" visible="false">
|
||||
<td align="left"><b>Linea Adicional:</b></td>
|
||||
<td align="left">
|
||||
<asp:DropDownList ID="DdlLineaAdicional" DataTextField="InfoGeneral" DataValueField="CveLineaAdicional" AutoPostBack="true" CssClass=" form-control input-sm select2me" runat="server" Width="80%" OnSelectedIndexChanged="DdlLineaAdicional_SelectedIndexChanged">
|
||||
<asp:DropDownList ID="DdlLineaAdicional" DataTextField="InfoGeneral" DataValueField="CveLineaAdicional" AutoPostBack="true" CssClass=" form-control input-sm select2me" runat="server" Width="100%" OnSelectedIndexChanged="DdlLineaAdicional_SelectedIndexChanged">
|
||||
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<asp:LinkButton runat="server" Visible="false" ID="LnkUpdateLineaAdicional" OnClick="LnkUpdateLineaAdicional_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea actualizar la linea adicional de crédito de la factura?" data-btn-ok-label="si" Text="<i class='fa fa-check' style='color:green'></i>" CssClass="btn btn-default btn-circle btn-xs" ToolTip="Actualizar Linea adicional" />
|
||||
|
||||
@@ -9461,22 +9461,106 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
|
||||
'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA
|
||||
If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
|
||||
If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional < ObjFactura.Total Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
If ObjFactura.TipoDocto = "Ing" Then
|
||||
If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then
|
||||
|
||||
'SI LA LINEA ESTA EN PESOS Y LA FACTURA ESTA EN DOLARES
|
||||
If Me.CveMonedaLineaAdicional = 1 AndAlso ObjFactura.CveMoneda = 2 Then
|
||||
Dim SaldoUSD As Decimal = SaldoIngresosLineaAdicional / TxtTipoCambio.Text.ToDecimal()
|
||||
|
||||
If SaldoUSD < ObjFactura.Total Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
'SI LA LINEA ESTA EN DOLARES Y LA FACTURA ESTA EN PESOS
|
||||
If Me.CveMonedaLineaAdicional = 2 AndAlso ObjFactura.CveMoneda = 1 Then
|
||||
Dim SaldoMXN As Decimal = SaldoIngresosLineaAdicional * TxtTipoCambio.Text.ToDecimal()
|
||||
|
||||
If SaldoMXN < ObjFactura.Total Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
'SI LA LINEA Y LA FACTURA TIENEN LA MISMA MONEDA
|
||||
If Me.SaldoIngresosLineaAdicional < ObjFactura.Total Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If ObjFactura.TipoDocto = "Rem" Then
|
||||
If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then
|
||||
|
||||
'SI LA LINEA ESTA EN PESOS Y LA FACTURA ESTA EN DOLARES
|
||||
If Me.CveMonedaLineaAdicional = 1 AndAlso ObjFactura.CveMoneda = 2 Then
|
||||
Dim SaldoUSD As Decimal = SaldoLineaAdicional / TxtTipoCambio.Text.ToDecimal()
|
||||
|
||||
If SaldoUSD < ObjFactura.Total Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
'SI LA LINEA ESTA EN DOLARES Y LA FACTURA ESTA EN PESOS
|
||||
If Me.CveMonedaLineaAdicional = 2 AndAlso ObjFactura.CveMoneda = 1 Then
|
||||
Dim SaldoMXN As Decimal = SaldoLineaAdicional * TxtTipoCambio.Text.ToDecimal()
|
||||
|
||||
If SaldoMXN < ObjFactura.Total Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
'SI LA LINEA Y LA FACTURA TIENEN LA MISMA MONEDA
|
||||
If Me.SaldoLineaAdicional < ObjFactura.Total Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA
|
||||
'If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then
|
||||
' TmpDT = TmpDTError.Copy()
|
||||
' CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
' Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
'Else
|
||||
' If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional < ObjFactura.Total Then
|
||||
' TmpDT = TmpDTError.Copy()
|
||||
' CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
' Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
|
||||
'If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional < ObjFactura.Total Then
|
||||
' TmpDT = TmpDTError.Copy()
|
||||
' CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
' Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
If ObjFactura.TipoDocto = "Ing" AndAlso (DtRemisionesPS Is Nothing OrElse DtRemisionesPS.Rows.Count = 0) Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
@@ -9484,12 +9568,6 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional < ObjFactura.Total Then
|
||||
TmpDT = TmpDTError.Copy()
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
'If Not CveEmpresaCRM > 0 Then
|
||||
@@ -18834,10 +18912,12 @@ Partial Class Ventas
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "PA") AndAlso UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
|
||||
DdlLineaAdicional.DataSource = Nothing
|
||||
|
||||
Dim TCConsulta As Decimal = TxtTipoCambio.Text.ToDecimal()
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
'SI ES VENTA EXISTENTE , SI SE VA EDITAR SOLO MOSTRAR LAS CON SALDO, FECHA DE VENCIMIENTO VIGENTE O LA LINEA ACTUAL
|
||||
If CveVenta > 0 Then
|
||||
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
|
||||
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, TipoCambioConsulta:=TCConsulta, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
TrLineaAdicional.Visible = True
|
||||
DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"(Saldo > 0 AND FechaVencimiento <= '{Now.ToString("dd/MM/yyyy")}') OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}")
|
||||
@@ -18846,14 +18926,14 @@ Partial Class Ventas
|
||||
Else
|
||||
'SI SE ESTA FACTURANDO UNA REMISION DEBE SELECCIONAR LA LINEA ADICIONAL DE ESTA
|
||||
If Me.CveLineaAdicionalVenta > 0 Then
|
||||
If ObjVentas.GetLineasAdicionalesSaldo(Me.CveLineaAdicionalVenta, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
|
||||
If ObjVentas.GetLineasAdicionalesSaldo(Me.CveLineaAdicionalVenta, CveCliente, -1, -1, UsuarioActual.CveEmpresa, TipoCambioConsulta:=TCConsulta, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
TrLineaAdicional.Visible = True
|
||||
DdlLineaAdicional.DataSource = ObjVentas.DtResultados
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=1, FechaVencimientoConsulta:=Now) Then
|
||||
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, TipoCambioConsulta:=TCConsulta, ConSaldo:=1, FechaVencimientoConsulta:=Now) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
TrLineaAdicional.Visible = True
|
||||
DdlLineaAdicional.DataSource = ObjVentas.DtResultados
|
||||
@@ -36484,8 +36564,10 @@ Partial Class Ventas
|
||||
RBLPago.SelectedValue = "1"
|
||||
RBLPago.Enabled = False
|
||||
|
||||
Dim TCConsulta As Decimal = TxtTipoCambio.Text.ToDecimal()
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then
|
||||
If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, TipoCambioConsulta:=TCConsulta, FechaVencimientoConsulta:=MinFecha) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
If RowLinea IsNot Nothing Then
|
||||
@@ -36595,16 +36677,36 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
|
||||
If Me.SaldoLineaAdicional < TxtTotal.Text.ToDecimal() Then
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Dim TotalDocumento As Decimal = TxtTotal.Text.ToDecimal()
|
||||
|
||||
'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA
|
||||
'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
|
||||
If Me.CveMonedaLineaAdicional <> DdlMoneda.SelectedValue.ToEntero() Then
|
||||
Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
|
||||
'SI LA LINEA ESTA EN PESOS Y LA FACTURA ESTA EN DOLARES
|
||||
If Me.CveMonedaLineaAdicional = 1 AndAlso DdlMoneda.SelectedValue.ToEntero() = 2 Then
|
||||
Dim SaldoUSD As Decimal = SaldoLineaAdicional / TxtTipoCambio.Text.ToDecimal()
|
||||
|
||||
If SaldoUSD < TotalDocumento Then
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
'SI LA LINEA ESTA EN DOLARES Y LA FACTURA ESTA EN PESOS
|
||||
If Me.CveMonedaLineaAdicional = 2 AndAlso DdlMoneda.SelectedValue.ToEntero() = 1 Then
|
||||
Dim SaldoMXN As Decimal = SaldoLineaAdicional * TxtTipoCambio.Text.ToDecimal()
|
||||
|
||||
If SaldoMXN < TotalDocumento Then
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
'SI LA LINEA Y LA FACTURA TIENEN LA MISMA MONEDA
|
||||
If Me.SaldoLineaAdicional < TotalDocumento Then
|
||||
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Reference in New Issue
Block a user