diff --git a/Ventas/ClientesAbonar.aspx b/Ventas/ClientesAbonar.aspx index 4bb0bc047..84e10111e 100644 --- a/Ventas/ClientesAbonar.aspx +++ b/Ventas/ClientesAbonar.aspx @@ -461,21 +461,28 @@ - <%--24--%> + <%--25--%> - <%--25--%> + <%--26--%> + <%--27--%> + + + + + + - <%--26--%> + <%--28--%> Auxiliar @@ -483,7 +490,7 @@ - <%--27--%> + <%--29--%> Comp
Pago
diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index d833010bd..6bc627306 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -551,7 +551,9 @@ Partial Class Ventas_ClientesAbonar e.Row.FCTextBox("TxtLiqCol8").Visible = False e.Row.FCTextBox("TxtLiqColT").Visible = False e.Row.FCTextBox("TxtAmort").Visible = False + e.Row.FCTextBox("TxtAmort2").Visible = False e.Row.FCDropDownList("DdlAnti").Visible = False + e.Row.FCDropDownList("DdlAnti2").Visible = False End If If e.Row.RowIndex = 1 Then @@ -638,6 +640,7 @@ Partial Class Ventas_ClientesAbonar e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") e.Row.FCTextBox("TxtLiqColT").Attributes.Add("class", $"ClsSelLiqVentaTotal{e.Row.DBCampo("CveVenta")}") e.Row.FCTextBox("TxtAmort").Attributes.Add("class", $"ClsSelLiqAnt") + e.Row.FCTextBox("TxtAmort2").Attributes.Add("class", $"ClsSelLiqAnt") e.Row.FCTextBox("TxtLiqCol1").Attributes.Add("onkeyup", $"SumaLiq (this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") e.Row.FCTextBox("TxtLiqCol2").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") @@ -648,11 +651,16 @@ Partial Class Ventas_ClientesAbonar e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") e.Row.FCTextBox("TxtAmort").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtAmort2").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") e.Row.FCDropDownList("DdlAnti").DataSource = DtIngresos e.Row.FCDropDownList("DdlAnti").DataBind() e.Row.FCDropDownList("DdlAnti").Items.Insert(0, New ListItem("-", "-1")) + e.Row.FCDropDownList("DdlAnti2").DataSource = DtIngresos + e.Row.FCDropDownList("DdlAnti2").DataBind() + e.Row.FCDropDownList("DdlAnti2").Items.Insert(0, New ListItem("-", "-1")) + End If Else @@ -1064,12 +1072,38 @@ Partial Class Ventas_ClientesAbonar Dim TCP As Decimal = 0 If DtIngresos IsNot Nothing Then TCP = DtIngresos.FiltroPrimeroValor("TipoCambio", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti").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 + If tTCPFecha <= UltimaFluctuacion.FechaFluctuacion Then + tTCPFecha = UltimaFluctuacion.FechaFluctuacion + TCP = UltimaFluctuacion.TCFluctuacion + End If + End If 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 - tipoCambioVenta) * gvr.FCTextBox("TxtAmort").Text.ToDecimal).RoundSQL - MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVenta, gvr.DataKey("SerieFolio").ToString) + 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) End If + If gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero > 0 Then + Dim TCP As Decimal = 0 + If DtIngresos IsNot Nothing Then + TCP = DtIngresos.FiltroPrimeroValor("TipoCambio", 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 + If tTCPFecha <= UltimaFluctuacion.FechaFluctuacion Then + tTCPFecha = UltimaFluctuacion.FechaFluctuacion + TCP = UltimaFluctuacion.TCFluctuacion + End If + End If + + 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) + End If End If @@ -1282,21 +1316,26 @@ Partial Class Ventas_ClientesAbonar Dim tImporteVenta, tImportePago As Decimal Dim Diferencia As Decimal = 0 ImporteMovimiento = 0 + Dim ImportePago As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal.RoundSQL + + If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then + ImportePago = ImportePago - gvr.FCTextBox("TxtAmort").Text.ToDecimal - gvr.FCTextBox("TxtAmort2").Text.ToDecimal + End If tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) If CveMonedaVenta = 1 And CveMoneda <> 1 Then 'factura pesos, pago en dolares - tImporteVenta = gvr.FCTextBox("TxtAbonar").Text.ToDecimal.RoundSQL - tImportePago = (((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioVenta / tipoCambioPago).RoundSQL * tipoCambioPago).RoundSQL + tImporteVenta = ImportePago + tImportePago = ((ImportePago * tipoCambioVenta / tipoCambioPago).RoundSQL * tipoCambioPago).RoundSQL ElseIf CveMonedaVenta <> 1 And CveMoneda <> 1 Then 'factura dolares, pago en dolares - tImporteVenta = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioVentaValuacion).RoundSQL - tImportePago = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioPago).RoundSQL + tImporteVenta = (ImportePago * tipoCambioVentaValuacion).RoundSQL + tImportePago = (ImportePago * tipoCambioPago).RoundSQL ElseIf CveMonedaVenta <> 1 And CveMoneda = 1 Then 'factura dolares, pago en pesos - tImporteVenta = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioVentaValuacion).RoundSQL - tImportePago = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioPago).RoundSQL + tImporteVenta = (ImportePago * tipoCambioVentaValuacion).RoundSQL + tImportePago = (ImportePago * tipoCambioPago).RoundSQL End If 'If FluctuacionAnticipo <> 0 Then @@ -1323,10 +1362,10 @@ Partial Class Ventas_ClientesAbonar If FuncionalidadFluctuacionImpuestos Then Dim TCImpuestos As Decimal = tipoCambioPago - Diferencia -= (((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IVA - Diferencia -= (((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetIVA - Diferencia -= (((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetISR - Diferencia -= (((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IEPS + Diferencia -= (((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IVA + Diferencia -= (((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetIVA + Diferencia -= (((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetISR + Diferencia -= (((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IEPS Diferencia = Diferencia.RoundSQL End If @@ -1398,12 +1437,10 @@ Partial Class Ventas_ClientesAbonar MsgError = "No se pudo insertar la póliza" Exit For End If - End If Next - If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal() ListaFacturasGenerarNC.Add(ObjFactura) @@ -1465,44 +1502,6 @@ Partial Class Ventas_ClientesAbonar MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, CveIE, TxtImporte.Text.ToDecimal, tipoCambioPago, tipoCambioVenta, TxtObservaciones.Text) - 'If CveMonedaPago = 2 Then - ' 'rmf faltan las cuentas - ' If IdCtaContMonedaComplementariaAnticipo > 0 Then - ' 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, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=TxtImporte.Text.Trim.ToDecimal, 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, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, TxtImporte.Text.ToDecimal), TxtObservaciones.Text, 227, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaComplementariaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (TxtImporte.Text.Trim.ToDecimal * tipoCambioPago) - TxtImporte.Text.Trim.ToDecimal, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal, 0), 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, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - ' MsgError = "No se pudo insertar la póliza" - ' End If - ' 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, TxtImporte.Text.ToDecimal, 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, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - ' MsgError = "No se pudo insertar la póliza" - ' End If - 'End If End If If MsgError = "" AndAlso UsuarioActual.Empresa.Funcionalidad(220) <> "" Then @@ -1701,27 +1700,27 @@ Partial Class Ventas_ClientesAbonar Dim MsgError As String = "" If CveMonedaPago = 2 Then 'rmf faltan las cuentas - 'If IdCtaContMonedaComplementariaAnticipo > 0 Then - 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 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 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:{tipoCambioVenta}", "")), 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), 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 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 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 MsgError = "No se pudo insertar la póliza" @@ -2885,7 +2884,7 @@ Partial Class Ventas_ClientesAbonar #Region "LIQUIDACION" Protected Sub TimTiempo_Tick(sender As Object, e As EventArgs) - Dim a As String = "se recarga para que no pierda sesíón el registro puede tardar más de una hora en llenar todos los datos" 'solo para que se ejecute sin que afecte a lo demás + Dim a As String = "se recarga para que no pierda sesión el registro puede tardar más de una hora en llenar todos los datos" 'solo para que se ejecute sin que afecte a lo demás End Sub Protected Sub ChkLiquidacion_CheckedChanged(sender As Object, e As EventArgs) @@ -2910,9 +2909,10 @@ Partial Class Ventas_ClientesAbonar GvCxC.Columns(24).Visible = True GvCxC.Columns(25).Visible = True GvCxC.Columns(26).Visible = True 'anticipos + GvCxC.Columns(27).Visible = True 'anticipos2 - GvCxC.Columns(27).Visible = False GvCxC.Columns(28).Visible = False + GvCxC.Columns(29).Visible = False Else @@ -2932,10 +2932,11 @@ Partial Class Ventas_ClientesAbonar GvCxC.Columns(23).Visible = False GvCxC.Columns(24).Visible = False GvCxC.Columns(25).Visible = False - GvCxC.Columns(26).Visible = False + GvCxC.Columns(26).Visible = False 'anticipos + GvCxC.Columns(27).Visible = False 'anticipos2 - GvCxC.Columns(27).Visible = True GvCxC.Columns(28).Visible = True + GvCxC.Columns(29).Visible = True End If