diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 6bc627306..9c38fd83e 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -1070,8 +1070,10 @@ Partial Class Ventas_ClientesAbonar If gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then Dim TCP As Decimal = 0 + Dim FolioPago As String = " " If DtIngresos IsNot Nothing Then TCP = DtIngresos.FiltroPrimeroValor("TipoCambio", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti").SelectedValue)) + FolioPago = DtIngresos.FiltroPrimeroValor("Folio", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti2").SelectedValue)) Dim tTCPFecha As Date = DtIngresos.FiltroPrimeroValor("FechaDocumento", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti").SelectedValue)).ToDate 'considera fluctuación If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then @@ -1083,13 +1085,15 @@ Partial Class Ventas_ClientesAbonar End If 'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo FluctuacionAnticipo = ((TCP - tipoCambioVentaValuacion) * gvr.FCTextBox("TxtAmort").Text.ToDecimal).RoundSQL - MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("SerieFolio").ToString) + MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("CveVenta").ToEntero, gvr.DataKey("SerieFolio").ToString, FolioPago) End If If gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero > 0 Then Dim TCP As Decimal = 0 + Dim FolioPago As String = " " If DtIngresos IsNot Nothing Then TCP = DtIngresos.FiltroPrimeroValor("TipoCambio", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti2").SelectedValue)) + FolioPago = DtIngresos.FiltroPrimeroValor("Folio", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti2").SelectedValue)) Dim tTCPFecha As Date = DtIngresos.FiltroPrimeroValor("FechaDocumento", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti2").SelectedValue)).ToDate 'considera fluctuación If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then @@ -1102,7 +1106,7 @@ Partial Class Ventas_ClientesAbonar End If 'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo FluctuacionAnticipo += ((TCP - tipoCambioVentaValuacion) * gvr.FCTextBox("TxtAmort2").Text.ToDecimal).RoundSQL - MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort2").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("SerieFolio").ToString) + MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort2").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("CveVenta").ToEntero, gvr.DataKey("SerieFolio").ToString, FolioPago) End If End If @@ -1500,7 +1504,7 @@ Partial Class Ventas_ClientesAbonar If RblTipoPago.SelectedValue = "3" AndAlso MsgError = "" Then - MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, CveIE, TxtImporte.Text.ToDecimal, tipoCambioPago, tipoCambioVenta, TxtObservaciones.Text) + MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, CveIE, TxtImporte.Text.ToDecimal, tipoCambioPago, tipoCambioVenta, -1, TxtObservaciones.Text, DdlIngreso.SelectedItem.Text) End If @@ -1696,33 +1700,21 @@ Partial Class Ventas_ClientesAbonar End Sub - Private Function RegistraAmortizacionAnticipo(ByRef ObjMov As ClsContabilidad, CvePrePoliza As Integer, CveIE As Integer, Importe As Decimal, tipoCambioPago As Decimal, tipoCambioVenta As Decimal, Referencia As String) As String + Private Function RegistraAmortizacionAnticipo(ByRef ObjMov As ClsContabilidad, CvePrePoliza As Integer, CveIE As Integer, Importe As Decimal, tipoCambioPago As Decimal, tipoCambioVenta As Decimal, CveVenta As Integer, ReferenciaVenta As String, ReferenciaPago As String) As String Dim MsgError As String = "" If CveMonedaPago = 2 Then - 'rmf faltan las cuentas - 'If CveMonedaPago = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - ' tipoCambioPago = TxtTCDolares.Text.ToDecimal - 'ElseIf CveMonedaPago = 2 AndAlso CveMonedaFiltro = 2 Then - ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - 'End If - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe, TxtObservaciones.Text, 92, Referencia, TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, CveCliente, ImporteMX:=Importe, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe, ReferenciaVenta, 92, ReferenciaVenta, TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, CveCliente:=CveCliente, ImporteMX:=Importe, CveVenta:=CveVenta, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, Importe / TxtTC.Text.ToDecimal, Importe), Referencia, 227, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioPago}", "")), TxtFechaDocumento.Text, IdCtaContMonedaComplementariaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (Importe * tipoCambioPago) - Importe, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, Importe / TxtTC.Text.ToDecimal, Importe), ReferenciaVenta, 227, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioPago}", "")), TxtFechaDocumento.Text, IdCtaContMonedaComplementariaAnticipo, -1, CveIE, CveCliente:=ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (Importe * tipoCambioPago) - Importe, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), CveVenta:=CveVenta, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If Else - 'If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - ' tipoCambioPago = TxtTCDolares.Text.ToDecimal - 'ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then - ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - 'End If - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, Importe * tipoCambioPago, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe, ReferenciaVenta, 92, ReferenciaVenta, TxtFechaDocumento.Text, IdCtaAnticipo, -1, CveIE, CveCliente:=ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, Importe * tipoCambioPago, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), CveVenta:=CveVenta, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If End If