This commit is contained in:
2024-03-02 09:14:25 -07:00
8 changed files with 374 additions and 207 deletions

View File

@@ -3436,7 +3436,7 @@ Partial Class Ventas
HlAgregarExcel.Visible = True
End If
If DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
If DdlTipoComprobante.SelectedValue.Contiene("Rem") AndAlso UsuarioActual.Empresa.Funcionalidad(109) <> "1" Then
' IPP 15 Julio 2017 - ERA FALSE
ImgAntiPend.Visible = False
UpPS.Update()
@@ -3584,7 +3584,7 @@ Partial Class Ventas
DivBloqueoAcceso.Visible = False
End If
Else
DivBloqueoacceso.Visible = False
DivBloqueoAcceso.Visible = False
End If
End Sub
@@ -3656,7 +3656,7 @@ Partial Class Ventas
End If
UsuarioActual.Empresa = ObjEmpresa.Empresa
Usuario.Empresa = ObjEmpresa.Empresa
ADSSession.ADSSessionConfig.sessionUser.CveEmpresa = ObjEmpresa.Empresa.CveEmpresa
ADSSession.ADSSessionConfig.SessionManager(ADSSession.OpcionSession.CambiarEmpresa, Nothing, ObjEmpresa.Empresa.CveEmpresa)
@@ -5061,6 +5061,10 @@ Partial Class Ventas
Select Case DbRowVenta("TipoDocto").ToString()
Case "Ing"
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
TxtAtencionA.Text = DbRowVenta("AtencionA").ToString()
End If
Trsaldo.Visible = True
HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
@@ -7164,6 +7168,12 @@ Partial Class Ventas
CalculaLineasAdicionales()
HabilitaRemisionPublicoGeneral = 0
HabilitarRemisionesPublicoGeneral()
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
If Not String.IsNullOrEmpty(UsuarioActual.CveTipoDocumento) Then
DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento)
End If
End If
End If
@@ -7172,6 +7182,8 @@ Partial Class Ventas
End If
'If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
' Using ObjVentas As New ClsVentas
' If ObjVentas.GetLineasAdicionales(-1, CveCliente, -1, -1, DdlMoneda.SelectedValue.ToEntero(), MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa) Then
@@ -17330,6 +17342,15 @@ Partial Class Ventas
Alert("No hay una lista de precios predeterminada", TipoMensaje.MsgAdvertencia)
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
If RBLPago.SelectedValue = "1" Then
Dim CvePrecioListaCredito = GlobalDTPrecioListas(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "ISNULL(Credito,False) = True").ToEntero()
If CvePrecioListaCredito > 0 Then
CvePrecioListaPS = CvePrecioListaCredito
End If
End If
End If
If CvePrecioListaPS > 0 Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
@@ -17584,6 +17605,10 @@ Partial Class Ventas
ImgAntiPend.Visible = False
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
ImgAntiPend.Visible = True
End If
TxtFechaPago.Text = NowADS().AddDays(PlazoCobranza).ToShortDateString
@@ -17615,6 +17640,10 @@ Partial Class Ventas
ImgAntiPend.Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
ImgAntiPend.Visible = True
End If
MostrarOpcionesPaqueteria()
TrAtencionA.Visible = True
@@ -18099,15 +18128,30 @@ Partial Class Ventas
End If
' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR
If Not UsuarioActual.TienePermisoProceso(169) Then
If Not UsuarioActual.TienePermisoProceso(169) AndAlso RBLTipoVenta.SelectedValue.ToEntero <> 5 Then
'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS
If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") OrElse ((DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119)) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ped") And UsuarioActual.CveEmpresa.Contiene(186)))) Then
Dim ObjInventarios As New ClsInventarios
Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False)
Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
Dim Existencia As Decimal = 0D
''CveAlamcenFiltroDdl
If RBLTipoVenta.SelectedValue.ToEntero = 6 Then
Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlamcenFiltroDdl, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=-1,
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=0, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
Else
Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
End If
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
@@ -23237,6 +23281,9 @@ Partial Class Ventas
End Sub
Private Sub RBLPago_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBLPago.SelectedIndexChanged
LimpiaEscondeContado()
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
RecalculaPrecios()
End If
End Sub
Private Function ValidaPagosContado(Optional MostrarAlertas As Boolean = True, Optional TipoDoctoViejo As String = "") As Boolean
Dim Retorno As Boolean = False
@@ -30638,7 +30685,7 @@ Partial Class Ventas
divAnticipoMsg.Visible = False
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
If DdlTipoComprobante.SelectedValue = "Ing" AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
Dim DtMovtos As DataTable = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"Saldo > 0 And SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'NC' ", "")}")
divAmortizacionTipoRelacion.Visible = False
GVAnticipos.DataSource = DtMovtos
@@ -37374,11 +37421,64 @@ Partial Class Ventas
DdlTipoAmortizacionAnticipo_SelectedIndexChanged(DdlTipoAmortizacionAnticipo, EventArgs.Empty)
divAmortizacionTipoRelacion.Visible = False
If DdlTipoComprobante.SelectedValue = "Rem" Then
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") IsNot Nothing Then
DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("1"))
End If
If DdlTipoAmortizacionAnticipo.Items.FindByValue("2") IsNot Nothing Then
DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("2"))
End If
Else
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") Is Nothing Then
DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo en descuento", "1"))
End If
If DdlTipoAmortizacionAnticipo.Items.FindByValue("2") Is Nothing Then
DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo con nota de crédito", "2"))
End If
End If
End If
UpAnticipos.Update()
RegistraScript("MuestraAnticipos();", "AE")
End Sub
Private Sub RecalculaPrecios()
If TmpDT IsNot Nothing Then
For Each Row As DataRow In TmpDT.Rows
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim CveClasificacion As Integer = Row("CveClasificacion").ToString().ToEntero
Dim CvePS As Integer = Row("CvePS").ToString().ToEntero
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
If ObjPrecioSugerido.PrecioSugerido > 0 Then
Dim PU As Decimal = ObjPrecioSugerido.PrecioSugerido.RoundSQL(6)
Dim ObjDescuento As Modelos.VentaDescuentos = CalcularDescuentos(CvePS, Cantidad, PU)
If ObjDescuento.EsPUModificado Then
PU = ObjDescuento.PU
End If
Row("PU") = PU
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento))
Dim TotalCalculableImpuestosIVA As Decimal = 0
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal)
Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
Row("Descuento") = (ObjDescuento.ImporteDescuento).RoundSQL(NumeroDecimales)
Row("Total") = (Cantidad * PU)
Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
End If
Next
Me.CalculaTotalesVenta()
End If
End Sub
End Class