diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 8029d23f9..0946384b7 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -15714,10 +15714,8 @@ Partial Class Ventas End Sub Private Sub AplicaAnticipos() - If CveVenta > 0 And CveCliente > 0 And Not EsCreaApartirDe And CveDevolucion <= 0 Then - Dim EsAnticipo2017Jam As Boolean = False For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked Then @@ -15739,20 +15737,7 @@ Partial Class Ventas Dim ErrorConta As Boolean Dim CveIEAnticipo As Integer Dim CvePlantillaPoliza As Integer = 10 - 'Dim PorcentajeAmortizacion As Decimal - 'Dim sumaAmorticaciones As Decimal = 0 - 'Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" - 'Dim CveCuentaContabilizacion As Integer = 1 - Dim CuentasContablesInvalidas As New StringBuilder - Dim ContaIdPoliza As Integer = 0 - 'Dim ConceptoAmortizacion As Integer = 0 - 'Dim UsaComplementariaClientes As Boolean = True - ''[IPP] PARCHE TEMPORAL PARA ANTICIPOS DE JAM - 'If FechaMaxima < "01/01/2018".ToDate And UsuarioActual.CveEmpresa = 119 Then - ' FechaMaxima = "01/01/2018".ToDate - 'End If - 'Dim NowADS() As DateTime = New DateTime(2020, 2, 19) Try CvePrePoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero(), TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) @@ -15777,7 +15762,6 @@ Partial Class Ventas Dim tFecha As Date = NowADS() 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 @@ -15898,39 +15882,19 @@ Partial Class Ventas ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta) - 'Dim Pago As New VentaPago - 'Pago.ImportePagoVenta = importeMovimiento - 'Pago.ImportePago = importeMovimiento - 'Pago.CveIE = CveIEAnticipo - 'Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero() - 'Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal - 'Pago.TipoPago = "I" - 'Pago.FechaDocumentoRelacionado = gvr.DataKey("Fecha").ToDate - 'Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero() - 'Pago.Referencia = gvr.DataKey("Folio") - - 'importeMovimiento = ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / TxtTotal.Text.ToDecimal) * TxtIVA.Text.ToDecimal) - 'importeMN = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero) - - ''Agregamos el 92 - 'importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal 'gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo" & gvr.RowIndex).ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal) - 'importeMN = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero) - End If End If End Select - End If Next Else ErrorConta = True End If - - If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, 3) Then + ''OPCION:99 - NO SIMPLIFICAR + If Not ErrorConta AndAlso ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=99, AutoConta:=False) Then If ObjConta.ValorPolizaDescuadre > 0 Then GuardaLogAD($"Ventas/Ventas-Anticipos | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") ErrorConta = True - End If End If @@ -15947,8 +15911,8 @@ Partial Class Ventas Msg.Append("Se ha amortizado correctamente") 'AJUSTA POLIZA - If ContaIdPoliza > 0 Then - Msg.AppendFormat("

Ver Póliza", ContaIdPoliza) + If ObjConta.ContaFolio > 0 Then + Msg.AppendFormat("

Ver Póliza", CvePrePoliza) End If ObjConta.Commit() @@ -16105,14 +16069,12 @@ Partial Class Ventas End If End If - LblAmortizacion.Text = Amortizacion.FormatoNumero(2) - + LblAmortizacion.Text = Amortizacion.FormatoNumero HdnTipoDescuento.Value = "-1" HdnDescuento.Value = "0" RegistraScript("BorraDescuentos();") HdnTieneAnticiposVinculados.Value = "1" - End If CalculaTotalesVenta(ValidarDescuentos:=True) End If