diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 6aa55776f..2662b079d 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9490,7 +9490,7 @@ Partial Class Ventas End If 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE - If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional <= ObjFactura.Total Then + 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) @@ -9504,7 +9504,7 @@ Partial Class Ventas Exit Sub End If - If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional <= ObjFactura.Total Then + 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) @@ -17727,6 +17727,7 @@ Partial Class Ventas Private Sub CambiaTipoComprobante() CambiaTipoDocto() LimpiaEscondeContado() + End Sub Private Sub CambiaTipoDocto() CargaNC(IfNull(Request("CveDevolucion"), "-1").ToString().ToEntero()) @@ -17884,6 +17885,8 @@ Partial Class Ventas TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + TabAlmacen.Enabled = DdlTipoComprobante.SelectedValue <> "Ant" 'VALIDA ESTATUS CLIENTE - SOLO SE PUEDE USAR EL CLIENTE PARA COTIZAR EN CASO DE ESTAR INACTIVO @@ -18688,7 +18691,9 @@ Partial Class Ventas 'SI TIENE PRONTO PAGO CALCULA EL IMPORTE If DdlTipoComprobante.SelectedValue = "Ing" AndAlso RowPorcentaje("ProntoPago").ToString().ToDecimal() > 0 Then - Dim TotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento + Dim SubTotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento + Dim TotalProntoPago As Decimal = SubTotalProntoPago * (1 + PorcentajeIVA) + Dim PorcentajeProntoPago = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D ObjDescuento.ImporteProntoPago = (TotalProntoPago * PorcentajeProntoPago).RoundSQL(2) @@ -22649,6 +22654,8 @@ Partial Class Ventas imgCalendario.Visible = False End If + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + UpContado.Update() UPCondicionesPago.Update() End Sub @@ -32063,6 +32070,8 @@ Partial Class Ventas TxtFechaPago.Text = If(EsDiasCreditoFijo, Now.AddDays(DiasCredito).ToShortDateString, TxtFechaPago.Text) + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + UpRemisionesFacturas.Update() UpFacturar.Update() UpPS.Update() @@ -32734,9 +32743,12 @@ Partial Class Ventas ObjCliente.Dispose() DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty) + TrVistaPrevia.Visible = True TxtFechaVencimientoCotizacion.Text = Now.ToShortDateString + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + 'HABILITA EDITAR Y ELIMINAR DEL GV GvPS.Columns(17).Visible = True GvPS.Columns(18).Visible = True @@ -32968,6 +32980,8 @@ Partial Class Ventas TxtFechaPago.Text = If(TipoDoctoViejo = "Rem" AndAlso EsDiasCreditoFijo, Now.AddDays(DiasCredito), If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza))).ToShortDateString TxtFechaEjecucion.Text = Now.ToString() + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + 'VALIDAR QUE NO SE HAYA REMISIONADO If TipoDoctoViejo = "PA" Then Dim RowVenta As DataRow = Nothing @@ -36318,47 +36332,58 @@ Partial Class Ventas Protected Sub DdlLineaAdicional_SelectedIndexChanged(sender As Object, e As EventArgs) - TxtFechaPago.Enabled = True - imgCalendario.Visible = True - If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then - RBLPago.SelectedValue = "1" - RBLPago.Enabled = False + If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then + TxtFechaPago.Enabled = True + imgCalendario.Visible = True - Using ObjVentas As New ClsVentas - If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then - Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0) - If RowLinea IsNot Nothing Then - If CveVenta <= 0 Then - TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then + RBLPago.SelectedValue = "1" + RBLPago.Enabled = False + + Using ObjVentas As New ClsVentas + If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0) + If RowLinea IsNot Nothing Then + If CveVenta <= 0 Then + TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + + 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL + If RowLinea("TipoLinea").ToString() = "2" Then + TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") + Else + TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + End If - 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL - If RowLinea("TipoLinea").ToString() = "2" Then - TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") TxtFechaPago.Enabled = False imgCalendario.Visible = False + + TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString() End If - TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString() - End If + Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() + Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero() + Me.SaldoLineaAdicional = RowLinea("Saldo").ToString().ToDecimal() + Me.SaldoIngresosLineaAdicional = RowLinea("SaldoIngresos").ToString().ToDecimal() - Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() - Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero() - Me.SaldoLineaAdicional = RowLinea("Saldo").ToString().ToDecimal() - Me.SaldoIngresosLineaAdicional = RowLinea("SaldoIngresos").ToString().ToDecimal() - - If CveVenta <= 0 Then - If DdlTipoComprobante.SelectedValue.Contiene("PA") Then - 'SI NO TIENE LA OPCION DE FACTURAR LA PERMITE - If DdlTipoComprobante.Items.FindByValue("Rem") Is Nothing Then - DdlTipoComprobante.Items.Insert(0, New ListItem("Remisión", "Rem")) - HabilitoFacturacionIngresoLineaAdicional = True + If CveVenta <= 0 Then + If DdlTipoComprobante.SelectedValue.Contiene("PA") Then + 'SI NO TIENE LA OPCION DE FACTURAR LA PERMITE + If DdlTipoComprobante.Items.FindByValue("Rem") Is Nothing Then + DdlTipoComprobante.Items.Insert(0, New ListItem("Remisión", "Rem")) + HabilitoFacturacionIngresoLineaAdicional = True + End If + DdlTipoComprobante.SelectedValueExist("Rem") End If - DdlTipoComprobante.SelectedValueExist("Rem") End If - End If + End If + Else + Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia) + Me.SaldoLineaAdicional = 0 + Me.SaldoIngresosLineaAdicional = 0 + Me.CveCategoriaLineaAdicional = 0 End If Else Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia) @@ -36366,36 +36391,32 @@ Partial Class Ventas Me.SaldoIngresosLineaAdicional = 0 Me.CveCategoriaLineaAdicional = 0 End If - Else - Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia) - Me.SaldoLineaAdicional = 0 - Me.SaldoIngresosLineaAdicional = 0 - Me.CveCategoriaLineaAdicional = 0 + End Using + Else + Me.SaldoLineaAdicional = 0 + Me.SaldoIngresosLineaAdicional = 0 + Me.CveCategoriaLineaAdicional = 0 + + If CveVenta <= 0 Then + TxtFechaPago.Text = Now.ToString("dd/MM/yyyy") + TxtOrdenCompra.Text = "" + + 'SI SE HABILITO LA FACTURACION DESDE LA LINEA ADICIONAL DEBE QUITARLO + If HabilitoFacturacionIngresoLineaAdicional Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + DdlTipoComprobante.SelectedValueExist("PA") + + UpParametros.Update() + End If End If - End Using - Else - Me.SaldoLineaAdicional = 0 - Me.SaldoIngresosLineaAdicional = 0 - Me.CveCategoriaLineaAdicional = 0 - If CveVenta <= 0 Then - TxtFechaPago.Text = Now.ToString("dd/MM/yyyy") - TxtOrdenCompra.Text = "" - - 'SI SE HABILITO LA FACTURACION DESDE LA LINEA ADICIONAL DEBE QUITARLO - If HabilitoFacturacionIngresoLineaAdicional Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) - DdlTipoComprobante.SelectedValueExist("PA") - - UpParametros.Update() - End If End If + UpParametros.Update() + UPCondicionesPago.Update() + UPObservaciones.Update() End If - UpParametros.Update() - UPCondicionesPago.Update() - UPObservaciones.Update() End Sub Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs) 'VALIDAR LINEAS ADICIONALES @@ -36432,7 +36453,7 @@ Partial Class Ventas End If 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE - If Me.SaldoLineaAdicional <= TxtTotal.Text.ToDecimal() Then + 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