-
+ FrecuenteVenta Mostrador
@@ -6428,7 +6428,10 @@
}
-
+ function SetTabVisibility(index) {
+ $find('<%=Tab.ClientID%>').get_tabs()[index].set_enabled(true);
+ return false;
+ }
function pageLoad(sender, e) {
diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb
index f61818a4b..9120662f8 100644
--- a/Ventas/Clientes.aspx.vb
+++ b/Ventas/Clientes.aspx.vb
@@ -1737,7 +1737,7 @@ Partial Class Clientes
TabOtros.Visible = False
TabRH.Visible = False
TabCuentasEquipos.Visible = False
- TabSistema.Visible = False
+ TabSistema.Enabled = False
DivPortletSucursales.Visible = False
DivPortletDireccionEnvio.Visible = False
@@ -10274,6 +10274,11 @@ Partial Class Clientes
ObjVentas.Dispose()
CargarClientePersonalEntrega()
UpClentesPersonalEntrega.Update()
- End Sub
+ End Sub
+ Protected Sub DdlTipoCliente_SelectedIndexChanged(sender As Object, e As EventArgs)
+ TabSistema.Enabled = DdlTipoCliente.SelectedValue = "1"
+
+ UpDatos.Update()
+ End Sub
End Class
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 94e2c239f..28c6dd784 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -2089,7 +2089,7 @@ Partial Class Ventas
TrSinExistencia.Visible = UsuarioActual.TienePermisoProceso(276)
- If UsuarioActual.CveEmpresa.Contiene(119, 1) Then
+ If UsuarioActual.Empresa.Funcionalidad(595) = "1" Then
ImgDescPU.Visible = False
ImgDescConcepto.Visible = False
DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("Autorización", "PA"))
@@ -4387,7 +4387,7 @@ Partial Class Ventas
HdnIVAOriginal.Value = TxtIVA.Text
TxtPedidoContrato.Text = DbRowVenta("PedidoContrato").ToString()
TxtPedidoContrato.Enabled = False
- TxtKilometraje.Text = DbRowVenta("Kilometraje").ToString()
+ TxtKilometraje.Text = DbRowVenta("Kilometraje").ToString().PadLeft(6, "0"c)
HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString()
HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2)
@@ -5241,16 +5241,26 @@ Partial Class Ventas
Else
Dim DTAlmacen As DataTable
ddlAlmacen.Items.Clear()
+
DTAlmacen = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}")
ddlAlmacen.DataSource = DTAlmacen
- If DTAlmacen Is Nothing Or DTAlmacen.Rows.Count = 0 Then
- ddlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1"))
- ddlAlmacen.SelectedValue = "-1"
- End If
+
+ ddlAlmacen.Items.Insert(0, New ListItem("Seleccione ", "-1"))
+ ddlAlmacen.SelectedValueExist("-1")
+
ddlAlmacen.DataBind()
+
If GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}").Rows.Count > 0 Then
- ddlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
+ 'SI ES DEL MISMO SUB PROYECTO SUGIERE EL ALMACEN ASIGNADO AL USUARIO
+ If UsuarioActual.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero() Then
+ ddlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
+ Else
+ Dim CveAlmacen As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}").ToEntero()
+ ddlAlmacen.SelectedValueExist(CveAlmacen)
+ End If
+
End If
+
End If
'SI TIENE CONTRATO NO SE MUEVE
@@ -5351,8 +5361,11 @@ Partial Class Ventas
If EstatusCliente = False And Not DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") And (CveVenta <= 0 Or EsCreaApartirDe) Then
Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)
+ BtnEmitirImprimir.Visible = EstatusCliente
+ TrVistaPrevia.Visible = EstatusCliente
End If
+
'CUANDO SEA COTIZACION Y SEA COMPUPROVEEDORES (EMPRESA 72) NO DEBE ENVIAR CORREO AL CLIENTE
If UsuarioActual.CveEmpresa = 72 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
ChkEnviarFactura.Checked = False
@@ -5935,7 +5948,8 @@ Partial Class Ventas
RBLPago.SelectedValue = "2"
RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing)
- If UsuarioActual.CveEmpresa.Contiene(119) AndAlso Not UsuarioActual.TienePermisoProceso(268) Then
+ 'GENERAR UNA AUTORIZACIÓN SI EL CLIENTE NO PERMITE CREDITO
+ If UsuarioActual.Empresa.Funcionalidad(595) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) Then
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
DdlTipoComprobante.SelectedValue = "PA"
TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
@@ -5948,7 +5962,8 @@ Partial Class Ventas
LnkCotizaciones.Visible = False
End If
UPCondicionesPago.Update()
- ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 146, 158, 140) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
+ 'CARGAR CREDITO DISPONIBLE AL GENERAR UNA FACTURA
+ ElseIf UsuarioActual.Empresa.Funcionalidad(596) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
RBLPago.SelectedValue = "1"
RBLPago_SelectedIndexChanged(Nothing, Nothing)
UPCondicionesPago.Update()
@@ -5958,7 +5973,7 @@ Partial Class Ventas
TrCreditoDisponible.Visible = True
LblCreditoDisponible.Text = CreditoDispo.FormatoNumero
If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%"
- If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then
+ If UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then
'If LblRFC.Text.Trim <> "XAXX010101000" Then
@@ -6010,19 +6025,23 @@ Partial Class Ventas
End If
Else
+ 'GENERAR AUTORIZACION SI TIENE EXCEDIO EL LIMITE DE CREDITO
+ If UsuarioActual.Empresa.Funcionalidad(595) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then
- If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then
- Dim Vta As New ClsVentas
- Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
- Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
- Vta.Dispose()
- If Opcion > 0 Then
- If Opcion = 1 Then
- BtnEmitirImprimir.Visible = False
+ 'VERIFICAR CANDADOS DE VENTA, REMISIONES SIN FACTURAR, FACTURAS QUE NO TENGAN VENCIDAS
+ If UsuarioActual.Empresa.Funcionalidad(597) = "1" Then
+ Dim Vta As New ClsVentas
+ Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
+ Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
+ Vta.Dispose()
+ If Opcion > 0 Then
+ If Opcion = 1 Then
+ BtnEmitirImprimir.Visible = False
+ End If
+ If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
+ Else
+ If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
End If
- If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
- Else
- If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
End If
'RBLPago.SelectedValue = "2"
@@ -6049,7 +6068,7 @@ Partial Class Ventas
End If
End If
UPPCreditoDisponible.Update()
- ElseIf UsuarioActual.CveEmpresa.Contiene(119, 1) AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then
+ ElseIf UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
If CreditoDispo > 0 Then
Dim Vta As New ClsVentas
@@ -8440,7 +8459,7 @@ Partial Class Ventas
ObjFacturaDevolucion.TipoDocto = "Egs"
- If UsuarioActual.CveEmpresa = 140 Then
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim ObjFolios As New ClsGralFolios()
Dim TipoDoctoConsulta As String = If(ObjFacturaDevolucion.TipoDocto = "Ant", "Ing", If(ObjFacturaDevolucion.TipoDocto = "PA", "Rem", ObjFacturaDevolucion.TipoDocto))
@@ -8718,7 +8737,7 @@ Partial Class Ventas
ObjFacturaBonificacion.TipoDocto = "Egs"
- If UsuarioActual.CveEmpresa = 140 Then
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim ObjFolios As New ClsGralFolios()
Dim TipoDoctoConsulta As String = If(ObjFacturaBonificacion.TipoDocto = "Ant", "Ing", If(ObjFacturaBonificacion.TipoDocto = "PA", "Rem", ObjFacturaBonificacion.TipoDocto))
@@ -9147,7 +9166,7 @@ Partial Class Ventas
ObjFactura.Serie = If(VistaPrevia, "VistaPrevia", LblSerie.Text)
- If UsuarioActual.CveEmpresa = 140 Then
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim ObjFolios As New ClsGralFolios()
Dim TipoDoctoConsulta As String = If(ObjFactura.TipoDocto = "Ant", "Ing", If(ObjFactura.TipoDocto = "PA", "Rem", ObjFactura.TipoDocto))
@@ -9808,7 +9827,7 @@ Partial Class Ventas
'ObjFacturaDevolucion.SerieFolio = String.Format("{0}-{1}", LblSerie.Text, TxtFolio.Text)
ObjFacturaDevolucion.TipoDocto = "Egs"
- If UsuarioActual.CveEmpresa = 140 Then
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim ObjFolios As New ClsGralFolios()
Dim TipoDoctoConsulta As String = If(ObjFacturaDevolucion.TipoDocto = "Ant", "Ing", If(ObjFacturaDevolucion.TipoDocto = "PA", "Rem", ObjFacturaDevolucion.TipoDocto))
@@ -11073,17 +11092,26 @@ Partial Class Ventas
End If
- If DTRemisiones IsNot Nothing AndAlso DTRemisiones.Rows.Count > 0 AndAlso ErrorList.Count = 0 AndAlso factura.TipoDocto.Contiene("Ing", "Ant") Then
+ 'If DTRemisiones IsNot Nothing AndAlso DTRemisiones.Rows.Count > 0 AndAlso ErrorList.Count = 0 AndAlso factura.TipoDocto.Contiene("Ing", "Ant") Then
- Dim dt As DataTable = DTRemisiones.FiltraParametros("Aplicado = True")
- If dt.Rows.Count > 0 Then
- For Each row As DataRow In dt.Rows
- If Not ObjVentas.UpdateVentaRemision(row("CveVenta").ToString().ToEntero(), ObjFactura.CveVenta) Then
- ErrorList.Add("Ocurrió un error al actualizar la remisión")
- End If
- Next
- End If
+ ' Dim dt As DataTable = DTRemisiones.FiltraParametros("Aplicado = True")
+ ' If dt.Rows.Count > 0 Then
+ ' For Each row As DataRow In dt.Rows
+ ' If Not ObjVentas.UpdateVentaRemision(row("CveVenta").ToString().ToEntero(), ObjFactura.CveVenta) Then
+ ' ErrorList.Add("Ocurrió un error al actualizar la remisión")
+ ' End If
+ ' Next
+ ' End If
+ 'End If
+
+ If RemisionesLista IsNot Nothing AndAlso RemisionesLista.Count > 0 AndAlso ErrorList.Count = 0 AndAlso factura.TipoDocto.Contiene("Ing", "Ant") Then
+ For Each CveRemision As Integer In RemisionesLista
+ If Not ObjVentas.UpdateVentaRemision(CveRemision, ObjFactura.CveVenta) Then
+ ErrorList.Add("Ocurrió un error al actualizar la remisión")
+ End If
+ Next
End If
+
End If
If ErrorList.Count = 0 Then
@@ -12840,6 +12868,12 @@ Partial Class Ventas
End If
Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEntero()
+
+ If CveAlmacen <= 0 Then
+ OcurrioError = True
+ ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario. No ha seleccionado ningun almacen o no tiene permiso para el almacen de esta sucursal.")
+ End If
+
Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, CveConceptoAlmacen, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Vta/E1")
If CveMovimientoInventario <= 0 Then
@@ -15899,7 +15933,7 @@ Partial Class Ventas
GvPS.DataBind()
UpPS.Update()
End Sub
- Private Sub CargaFolios()
+ Private Sub CargaFolios(Optional FacturarDocumentoNuevo As Boolean = False)
If ExFolioFactura Then
Exit Sub
End If
@@ -15921,15 +15955,19 @@ Partial Class Ventas
'ViewState("NumAprobacion") = CLng(DT.Rows(0)("Aprobacion").ToString())
'ViewState("FechaAprobacion") = DT.Rows(0)("FechaAprobacion").ToString().ToDate
ViewState("FolioActual") = DT.Rows(0)("FActual").ToString()
- If UsuarioActual.CveEmpresa = 140 AndAlso CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then
LblSerie.Text = SerieVenta
Else
LblSerie.Text = DT.Rows(0)("Serie").ToString()
End If
TxtFolio.Text = DT.Rows(0)("FActual").ToString()
- BtnCrearApartirDe.Enabled = True
- BtnEmitirImprimir.Visible = True
- TrVistaPrevia.Visible = True
+
+ If Not FacturarDocumentoNuevo Then
+ BtnCrearApartirDe.Enabled = EstatusCliente
+ BtnEmitirImprimir.Visible = EstatusCliente
+ TrVistaPrevia.Visible = EstatusCliente
+ End If
+
UpFacturar.Update()
Else
@@ -24310,7 +24348,7 @@ Partial Class Ventas
Private Sub CargaCxC()
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString().ToEntero(), "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero()) Then
- Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("TipoDocto <> 'RNC' AND Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
+ Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("TipoDocto NOT IN ('RNC','Rem') AND Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
GvCxC.DataSource = DtTemporal
End If
ObjMovtos.Dispose()
@@ -28214,7 +28252,7 @@ Partial Class Ventas
End If
End If
- If FolioFijo = 0 Then CargaFolios() 'RECARGA FOLIOS CON EL NUEVO TIPO DOCTO
+ If FolioFijo = 0 Then CargaFolios(FacturarDocumentoNuevo:=True) 'RECARGA FOLIOS CON EL NUEVO TIPO DOCTO
EmitirImprimir(TipoDoctoViejo) 'MANDA A EMITIR - PROCESO VIEJO
End If
@@ -28275,7 +28313,7 @@ Partial Class Ventas
Private Sub CalculaUsados(Optional DtUsadosDevolucion As DataTable = Nothing)
- If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
+ If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev", "PA") Then
If ViewState("CargoUsado").ToString() = "False" Then
Exit Sub
End If