@@ -3281,7 +3281,19 @@
//VALIDA SOLO SI SE SELECCIONO UN USADO
var cveUsado = ToDouble($get("C_DdlRecepcionUsados").value);
if (cveUsado > 0) {
- args.IsValid = (ToDouble(args.Value) > 0);
+ var anio = ToDouble(args.Value);
+ if (anio > 0) {
+ var valido = true;
+ if (anio < 1900) {
+ valido = false;
+ }
+ if (anio.toString().length != 4) {
+ valido = false;
+ }
+ args.IsValid = valido;
+ } else {
+ args.IsValid = false;
+ }
} else {
args.IsValid = true;
}
diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb
index ed0629450..a818111b8 100644
--- a/Ventas/PV.aspx.vb
+++ b/Ventas/PV.aspx.vb
@@ -3430,27 +3430,27 @@ Partial Class PV
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
- If ObjFactura.TipoDocto = "Rem" Then
- If ObjAcum.GetPolizasVirtuales(Retorno.CveVenta) Then
- Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy()
+ 'If ObjFactura.TipoDocto = "Rem" Then
+ ' If ObjAcum.GetPolizasVirtuales(Retorno.CveVenta) Then
+ ' Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy()
- For Each Row As DataRow In ObjFactura.DtPolizasVirtuales.Rows
- Dim CvePolizaVirtual As Integer = DtPoliza.FiltroPrimeroValor("CvePolizaVirtual", $"CveVentaDetalle={Row("CveVentaDetalle")}").ToEntero()
+ ' For Each Row As DataRow In ObjFactura.DtPolizasVirtuales.Rows
+ ' Dim CvePolizaVirtual As Integer = DtPoliza.FiltroPrimeroValor("CvePolizaVirtual", $"CveVentaDetalle={Row("CveVentaDetalle")}").ToEntero()
- If Not ObjAcum.UpdatePolizaVirtual(CvePolizaVirtual, Row("CveMarcaUsado").ToString().ToEntero(), Row("FechaUsado").ToString().ToDateTime()) Then
- SbAlert.Append("Error al guardar la póliza virtual")
- TieneError = True
- Exit For
- End If
- Next
+ ' If Not ObjAcum.UpdatePolizaVirtual(CvePolizaVirtual, Row("CveMarcaUsado").ToString().ToEntero(), Row("FechaUsado").ToString().ToDateTime()) Then
+ ' SbAlert.Append("Error al guardar la póliza virtual")
+ ' TieneError = True
+ ' Exit For
+ ' End If
+ ' Next
- DtPoliza.Dispose()
- Else
- SbAlert.Append("Error al obtener la póliza virtual")
- TieneError = True
- End If
+ ' DtPoliza.Dispose()
+ ' Else
+ ' SbAlert.Append("Error al obtener la póliza virtual")
+ ' TieneError = True
+ ' End If
- End If
+ 'End If
If ObjAcum.GetGarantiasDetalle(Retorno.CveVenta) Then
Dim RowGarantia As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
@@ -4790,6 +4790,9 @@ Partial Class PV
DdlRecepcionUsados.SelectedValueExist("-1")
DivRecepcionUsados.Visible = False
+ DdlMarca.SelectedValueExist("-1")
+ TxtFechaVigencia.Text = Now.ToString("dd/MM/yyyy")
+
LimpiaAjuste()
UPPDescuento.Update()
@@ -5295,7 +5298,7 @@ Partial Class PV
divagregrarotrops.Visible = False
Ajuste()
- AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
+ 'AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
'BUSCA EN TMPDT LOS DATOS DE USADOS
If TmpDT.Rows.Count > 0 AndAlso TmpDTRecepcionUsados IsNot Nothing AndAlso TmpDTRecepcionUsados.Rows.Count > 0 Then
@@ -5334,11 +5337,29 @@ Partial Class PV
Exit Sub
End If
+ If String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
+ Alert("El campo año esta vacío.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
+ Alert("El campo año debe ser mayor a 1900.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ Else
+ If Not String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
+ If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
+ Alert("El año del vehiculo del vehículo no tiene el formato correcto.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
End If
+
+
If AgregarPS() Then
If ChkAjuste.Checked Then GuardaAjuste()
- AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
CalculaTotalesVenta()
If ChkAgregar.Checked = True And Modalidad = "A" Then
@@ -5404,17 +5425,19 @@ Partial Class PV
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo)
+ Dim ListaPSCargo As List(Of MConceptoUsado) = Nothing
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
- Dim ListaPSCargo = CalculaUsados(Consec)
- If ListaPSCargo.Count > 0 Then
- CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
- End If
+ ListaPSCargo = CalculaUsados(Consec)
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
EliminarUsados()
- Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
- If ListaPSCargo.Count > 0 Then
- CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
- End If
+ ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
+ End If
+
+ If ListaPSCargo IsNot Nothing AndAlso ListaPSCargo.Count > 0 Then
+ CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
+ For Each Usado As MConceptoUsado In ListaPSCargo
+ AddPolizaVirtual(DdlPS.SelectedValue.ToEntero(), Usado.Consecutivo)
+ Next
End If
Return True
@@ -7386,6 +7409,7 @@ Partial Class PV
#Region "P O L I Z A - V I R T U A L"
Private Sub CreaDTmpDTPolizaVirtual()
TmpDTPolizaVirtual = New DataTable
+ TmpDTPolizaVirtual.Columns.Add("Consec", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CvePS", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("Cantidad", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("PU", GetType(Decimal))
@@ -7402,14 +7426,14 @@ Partial Class PV
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CveMarcaUsado", GetType(Integer))
End Sub
- Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
+ Private Function AddPolizaVirtual(CvePS As Integer, Consec As Integer) As Boolean
Dim Retorno As Boolean = True
If Modalidad = "U" Then
If TmpDTPolizaVirtual.Rows.Count > 0 Then
Dim Elimino As Boolean = False
For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows
- If RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
+ If RowPoliza("Consec").ToString().ToEntero() = Consec AndAlso RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
RowPoliza.Delete()
Elimino = True
Exit For
@@ -7475,6 +7499,8 @@ Partial Class PV
End If
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
+
+ Row("Consec") = Consec
Row("CvePS") = CvePS
Row("Cantidad") = Cantidad
Row("PU") = PU
@@ -7524,7 +7550,7 @@ Partial Class PV
EmitirImprimirNew()
End Sub
- Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal, ConsecPSPadre As Integer)
+ Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of MConceptoUsado), CantidadUsado As Decimal, ConsecPSPadre As Integer)
If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then
@@ -7600,8 +7626,8 @@ Partial Class PV
End If
Dim StrCargos As New StringBuilder
- For Each CvePSCargo As Integer In ListaPSCargo
- StrCargos.AppendFormat(" {0},", CvePSCargo)
+ For Each Usado As MConceptoUsado In ListaPSCargo
+ StrCargos.AppendFormat(" {0},", Usado.CvePS)
Next
StrCargos.Remove(StrCargos.Length - 1, 1)
@@ -7718,12 +7744,16 @@ Partial Class PV
CalculaTotalesVenta()
End Sub
- Private Function CalculaUsados(Consec As Integer, Optional LimpiarUsados As Boolean = True) As List(Of Integer)
+ Public Class MConceptoUsado
+ Public Property Consecutivo As Integer
+ Public Property CvePS As Integer
+ End Class
+ Private Function CalculaUsados(Consec As Integer, Optional LimpiarUsados As Boolean = True) As List(Of MConceptoUsado)
If Modalidad = "U" AndAlso LimpiarUsados Then
EliminarUsados(Consec)
End If
- Dim ListaPScargo As New List(Of Integer)
+ Dim ListaPScargo As New List(Of MConceptoUsado)
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
Dim DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
@@ -7828,7 +7858,7 @@ Partial Class PV
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
drowPsTamaños("SubProyecto").ToString, EsCargo:=True, ConsecPSPadre:=drowPsTamaños("ConsecPSPadre").ToString.ToEntero, EliminarDB:=CBool(drowPsTamaños("EliminarDB").ToString()))
If Consec > 0 Then
- ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero)
+ ListaPScargo.Add(New MConceptoUsado() With {.Consecutivo = Consec, .CvePS = drowPsTamaños("CvePS").ToString.ToEntero})
End If
End If
Next
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 0059f9a58..909f471b5 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -4985,6 +4985,11 @@ Partial Class Ventas
End If
End If
+ 'NO DEBE IMPRIMIR PDF DE COTIZACION
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DbRowVenta("TipoDocto").ToString() = "Cot" Then
+ HplDownPDF.Visible = False
+ End If
+
If DbRowVenta("SeTimbro").ToString() = "Si" Then
TrEmitir.Visible = False
End If
@@ -7504,6 +7509,13 @@ Partial Class Ventas
e.Row.FCLinkButton("imgE").Visible = False
e.Row.FCLinkButton("imgD").Visible = False
End If
+
+ 'EN BDH NO DEBE PODER EDITAR LOS PS
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
+ e.Row.FCLinkButton("imgE").Visible = False
+ e.Row.FCLinkButton("imgD").Visible = False
+ End If
+
End If
'CANTIDAD FACTURADA
@@ -8164,6 +8176,12 @@ Partial Class Ventas
Exit Sub
End If
+ 'VENDEDOR OBLIGATORIO
+ If DdlVendedor.SelectedValue.ToEntero() <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
+ Alert("Debe seleccionar un vendedor.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
'SI TIENE ANTICIPOS Y ESTA AMORTIZADO AL 100% EL DOCUMENTO (SALDO = 0) | NO VALIDA PU DEL CONCEPTO
If Not (LblAmortizacion.Text.ToDouble > 0 And TxtTotal.Text.ToDouble <= 0) Then
If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "Ant", "DPe") Then
@@ -8543,6 +8561,11 @@ Partial Class Ventas
HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))
End If
+ 'NO DEBE IMPRIMIR PDF DE COTIZACION
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
+ HplDownPDF.Visible = False
+ End If
+
UpnTools.Update()
End Sub
@@ -9272,17 +9295,21 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue = "Cot" Then
If Not CveEmpresaCRM > 0 Then
- If CveVenta > 0 Then MensajeAlert = New StringBuilder
- Dim ArchivoCotizacion As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.rdlc", UsuarioActual.Empresa.Ruta))
- If Opcion = "Cot" And UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
- MensajeAlert.AppendFormat("
Facturar", CveVenta)
- End If
+ 'EN EMPRESA DE ACUMULADORES NO DESCARGAR EL PDF
+ If UsuarioActual.Empresa.Funcionalidad(531) <> "1" Then
+ If CveVenta > 0 Then MensajeAlert = New StringBuilder
+ Dim ArchivoCotizacion As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.rdlc", UsuarioActual.Empresa.Ruta))
- If ArchivoCotizacion.Exists Then
- MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0", CveVenta)))
- Else
- MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
+ If Opcion = "Cot" And UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
+ MensajeAlert.AppendFormat("
Facturar", CveVenta)
+ End If
+
+ If ArchivoCotizacion.Exists Then
+ MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0", CveVenta)))
+ Else
+ MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
+ End If
End If
GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO
@@ -17235,7 +17262,7 @@ Partial Class Ventas
DdlVendedorSucursal.SelectedValue = Nothing
If UsuarioActual.Empresa.Funcionalidad(302) = "1" AndAlso DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then
- DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("(CveSubProyecto IS NULL OR CveSubProyecto = {0})", DdlSubProyectoDatos.SelectedValue)).FiltraParametros("VendedorTipo = 1")
+ DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros(String.Format("VendedorTipo IN (1,4) AND (CveSubProyecto IS NULL OR CveSubProyecto = {0})", DdlSubProyectoDatos.SelectedValue))
Else
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros("VendedorTipo = 1")
End If
@@ -17281,11 +17308,11 @@ Partial Class Ventas
End If
If CveVendedorActual > 0 Then
- Dim VendedorActual As String = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Vendedor", $"CveVendedor = {CveVendedorActual}")
+ Dim VendedorActual As String = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltroPrimeroValor("Vendedor", $"CveVendedor = {CveVendedorActual}")
'SI NO ENCUENTRA BUSCA EN LOS VENDEDORES DEL PV
- If String.IsNullOrEmpty(VendedorActual) Then
- VendedorActual = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=4).FiltroPrimeroValor("Vendedor", String.Format("CveVendedor = {0}", CveVendedorActual))
- End If
+ 'If String.IsNullOrEmpty(VendedorActual) Then
+ ' VendedorActual = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=4).FiltroPrimeroValor("Vendedor", String.Format("CveVendedor = {0}", CveVendedorActual))
+ 'End If
If String.IsNullOrEmpty(VendedorActual) Then
DdlVendedor.SelectedValueExist(CveVendedorActual)
@@ -17294,17 +17321,10 @@ Partial Class Ventas
End If
End If
- If UsuarioActual.CveEmpresa = 140 Then
- If Not UsuarioActual.TienePermisoProceso(161) Then
- DdlVendedor.Enabled = False
- End If
- Else
- If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
- DdlVendedor.Enabled = False
- End If
+ If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
+ DdlVendedor.Enabled = False
End If
-
'multiples vendedores visible
If UsuarioActual.TienePermisoProceso(153) Then
DdlVendedor.Enabled = True
diff --git a/asmx/WSGPSApp.asmx b/asmx/WSGPSApp.asmx
index 3249864b7..1d97ac264 100644
--- a/asmx/WSGPSApp.asmx
+++ b/asmx/WSGPSApp.asmx
@@ -134,7 +134,12 @@ Public Class WSGPSApp
Clientes.Add(New WsClientePortalGPS With {.CveCliente = Row("CveCliente").ToString.ToEntero, .Cliente = Row("Cliente").ToString})
Next
If UsuarioActual.CveCliente <= 0 AndAlso Clientes.Any() Then
- UsuarioRetorno.CveCliente = Clientes.FirstOrDefault().CveCliente
+ UsuarioRetorno.CveCliente = Clientes.FirstOrDefault().CveCliente
+ If UsuarioRetorno.CveCliente > 0 Then
+ If UsuarioActual.Empresa.Funcionalidad(704).Contiene(UsuarioRetorno.CveCliente.ToString()) Then
+ UsuarioRetorno.RastreoSoloInicio = True
+ End If
+ End If
End If
End If
End If
@@ -196,7 +201,15 @@ Public Class WSGPSApp
Clientes.Add(New WsClientePortalGPS With {.CveCliente = Row("CveCliente").ToString.ToEntero, .Cliente = Row("Cliente").ToString})
Next
If UsuarioActual.CveCliente <= 0 AndAlso Clientes.Any() Then
- UsuarioRetorno.CveCliente = Clientes.FirstOrDefault().CveCliente
+ UsuarioRetorno.CveCliente = Clientes.FirstOrDefault().CveCliente
+ If UsuarioActual.CveCliente <= 0 AndAlso Clientes.Any() Then
+ UsuarioRetorno.CveCliente = Clientes.FirstOrDefault().CveCliente
+ If UsuarioRetorno.CveCliente > 0 Then
+ If UsuarioActual.Empresa.Funcionalidad(704).Contiene(UsuarioRetorno.CveCliente.ToString()) Then
+ UsuarioRetorno.RastreoSoloInicio = True
+ End If
+ End If
+ End If
End If
End If
End If
@@ -1126,7 +1139,8 @@ Namespace ADGPSModels
Public Property Contrasenia As String
Public Property TienePermisoOC As Boolean
- Public Property TienePermisoPS As Boolean
+ Public Property TienePermisoPS As Boolean
+ Public Property RastreoSoloInicio As Boolean = False
End Class