From ca20b8299aff6eb70cc7d85886152a3e2e915b25 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 30 Dec 2024 10:20:55 -0700 Subject: [PATCH 1/8] Rep OCxSuertir reacocumo controles, PopUpBsucar Folio, Prmociones --- Compras/PopUpVerFactura.aspx.vb | 2 +- OC/RepOCxSurtir.aspx | 17 +++++++------ OC/RepOCxSurtir.aspx.vb | 43 ++++++++++++++++++++++++++++----- Site.master | 2 +- Ventas/PopUpBuscarFolio.aspx.vb | 2 +- Ventas/Promociones.aspx | 5 +++- Ventas/Promociones.aspx.vb | 13 +++++++--- 7 files changed, 63 insertions(+), 21 deletions(-) diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index ea00e848c..5ad5f3e85 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -3080,7 +3080,7 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("Observaciones", Observaciones)) - If UsuarioActual.CveEmpresa.Contiene(186, 189, 193) Then + If UsuarioActual.CveEmpresa.Contiene(186, 189, 193, 189) Then params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) params.Add(New ReportParameter("NombreProveedor", If(CveCompra > 0, dr("RazonSocial").ToString, ""))) End If diff --git a/OC/RepOCxSurtir.aspx b/OC/RepOCxSurtir.aspx index 0365b13b2..148aeb4e3 100644 --- a/OC/RepOCxSurtir.aspx +++ b/OC/RepOCxSurtir.aspx @@ -18,7 +18,7 @@ <%--FILTROS--%> -
+
@@ -53,6 +53,10 @@
+
Centro de Costo
+
+ +
@@ -60,16 +64,15 @@
- + <%----%> +
Cliente:
- -
-
Centro de Costo
-
- + <%----%> +
+
diff --git a/OC/RepOCxSurtir.aspx.vb b/OC/RepOCxSurtir.aspx.vb index 0a9726d3a..5e0c376cc 100644 --- a/OC/RepOCxSurtir.aspx.vb +++ b/OC/RepOCxSurtir.aspx.vb @@ -15,20 +15,51 @@ Partial Class OC_RepOCxSurtir #Region " INICIALIZA VALORES " Private Sub InicializaValores() + + Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + TxtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString TxtFechaF.Text = NowADS().ToShortDateString - DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DdlProveedor.DataBind() - DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1")) + 'DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + 'DdlProveedor.DataBind() + 'DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1")) + + 'CargaProveedores + DdlSubProyecto.DataSource = GlobalDTSubProyectos(UsuarioActual.CveEmpresa) DdlSubProyecto.DataBind() DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) - DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) - DdlCliente.DataBind() - DdlCliente.Items.Insert(0, New ListItem("Todos", "-1")) + + + + If EsWS Then + DdlCliente.setEsWebService(True) + DdlCliente.SelectedText = "Todos" + DdlCliente.SelectedValue = "-1" + + DdlProveedor.setEsWebService(True) + DdlProveedor.Attributes.Add("data-metodo", "getproveedores") + DdlProveedor.SelectedText = "Todos" + DdlProveedor.SelectedValue = "-1" + + Else + DdlCliente.setEsWebService(False) + DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + DdlCliente.DataBind() + DdlCliente.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlProveedor.setEsWebService(False) + DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + DdlProveedor.DataBind() + DdlProveedor.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + + + + End If + UPFiltros.Update() End Sub diff --git a/Site.master b/Site.master index d925ca666..89641e5d6 100644 --- a/Site.master +++ b/Site.master @@ -168,7 +168,7 @@
  • - Buscar Venta diff --git a/Ventas/PopUpBuscarFolio.aspx.vb b/Ventas/PopUpBuscarFolio.aspx.vb index 99717874d..8f3996771 100644 --- a/Ventas/PopUpBuscarFolio.aspx.vb +++ b/Ventas/PopUpBuscarFolio.aspx.vb @@ -175,7 +175,7 @@ Partial Class PopUpBuscarFolio Liga = String.Format("", e.Row.DBCampo("CveVenta")) End If - e.Row.FCLiteral("LtlTipo").Text = String.Format("", Liga, e.Row.DBCampo("TipoDocto")) + e.Row.FCLiteral("LtlTipo").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("TipoDocto")) e.Row.FCLiteral("LtlFolio").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Folio")) e.Row.FCLiteral("LtlFecha").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Fecha").ToDate.ToShortDateString) e.Row.FCLiteral("LtlNombre").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("NombreComercial")) diff --git a/Ventas/Promociones.aspx b/Ventas/Promociones.aspx index 1aa380ef7..0b342eb9b 100644 --- a/Ventas/Promociones.aspx +++ b/Ventas/Promociones.aspx @@ -142,6 +142,9 @@ Descuento PU + + @@ -193,7 +196,7 @@
    - +
    diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index de8564cf0..82f584ad0 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -243,7 +243,7 @@ Partial Class Ventas_Promociones 'CLASIFICACIONES DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros(" Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion") DdlClasificacion.DataBind() - If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + If EmpresaGrupoDiaz Then DdlClasificacion.Items.Insert(0, New ListItem("Todos", "-1")) Else DdlClasificacion.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -536,11 +536,16 @@ Partial Class Ventas_Promociones End If ' validación de %minimo considerado 02580104V - If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + If EmpresaGrupoDiaz Then Dim tuc As Decimal = LblUltimoCosto.Text.ToDecimal Dim tpu As Decimal = TxtPromocionConcepto.Text.ToDecimal If tuc <= 0 OrElse (tpu - tuc) / tuc < UsuarioActual.Empresa.Funcionalidad(129).ToDecimal / 100 Then - Alert("El producto está debajo de la utilidad permitida, la promoción requerirá autorización.", TipoMensaje.MsgAdvertencia.ToastAdventencia) + If PermisoAutorizPromocionPorcentaje Then + Alert("El producto está debajo de la utilidad permitida.", TipoMensaje.MsgAdvertencia.ToastAdventencia) + Else + Alert("El producto está debajo de la utilidad permitida, la promoción requerirá autorización.", TipoMensaje.MsgAdvertencia.ToastAdventencia) + End If + End If End If @@ -714,7 +719,7 @@ Partial Class Ventas_Promociones Next End If - If BloqueadoPromocionPorcentaje AndAlso Bloquear Then + If (Not PermisoAutorizPromocionPorcentaje) AndAlso BloqueadoPromocionPorcentaje AndAlso Bloquear Then ChkEstatus.Checked = False ChkEstatus.Enabled = False End If From a5b763aa3848ae119b4b712f9750cb7d6f2e75b4 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 30 Dec 2024 10:40:16 -0700 Subject: [PATCH 2/8] PVCobranza Mensaje solicitud e credio no ha sido autiorizada --- Ventas/PVCobranza.aspx.vb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index b2cb33b4f..e60d157e1 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -102,7 +102,8 @@ Partial Class Ventas_PVCobranza #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then + If Not Page.IsPostBack Then + Dim Arr As New ArrayList 'Arr.Add("autorizada") 'If EnviarNotificacionWhatsApp("526621430964", "solicitud_autorizacion_anticipo_respuesta", Arr) Then @@ -389,7 +390,23 @@ Partial Class Ventas_PVCobranza Else e.Row.FCLinkButton("BtnPagar").CssClass = "btn btn-xs btn-danger" ' e.Row.FCLinkButton("BtnPagar").Enabled = False - e.Row.FCLinkButton("BtnPagar").OnClientClick = "alert('La solicitud de crédito no ha sido autorizada');return false;" + 'e.Row.FCLinkButton("BtnPagar").OnClientClick = "alert('La solicitud de crédito no ha sido autorizada');return false;" + 'e.Row.FCLinkButton("BtnPagar").OnClientClick = "bootbox.dialog({message: 'La solicitud de crédito no ha sido autorizada ', className: ' header-yellow ', onEscape: function() { },title: ' Advertencia',buttons: { success: { label: '', className: ' hide',callback: function() { } }, danger: { label: '', className: ' hide',callback: function() { } },main: { label: 'Aceptar', className: ' yellow', callback: function() { } } } });return false;" + 'e.Row.FCLinkButton("BtnPagar") = + e.Row.FCLinkButton("BtnPagar").OnClientClick = + "bootbox.dialog({" & + "message: 'La solicitud de crédito no ha sido autorizada ', " & + "className: 'header-yellow', " & + "onEscape: function() {}, " & + "title: ' Advertencia', " & + "buttons: { " & + "success: { label: '', className: 'hide', callback: function() {} }, " & + "danger: { label: '', className: 'hide', callback: function() {} }, " & + "main: { label: 'Aceptar', className: 'yellow', callback: function() {} } " & + "} " & + "});" & + "return false;" + End If End If From 1466ea31944cf5fc9e06f19b0b4360479448ca23 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 30 Dec 2024 10:43:37 -0700 Subject: [PATCH 3/8] PVCobranza Mensaje solicitud e credio no ha sido autiorizada --- Ventas/PVCobranza.aspx.vb | 1 + 1 file changed, 1 insertion(+) diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index e60d157e1..735335254 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -393,6 +393,7 @@ Partial Class Ventas_PVCobranza 'e.Row.FCLinkButton("BtnPagar").OnClientClick = "alert('La solicitud de crédito no ha sido autorizada');return false;" 'e.Row.FCLinkButton("BtnPagar").OnClientClick = "bootbox.dialog({message: 'La solicitud de crédito no ha sido autorizada ', className: ' header-yellow ', onEscape: function() { },title: ' Advertencia',buttons: { success: { label: '', className: ' hide',callback: function() { } }, danger: { label: '', className: ' hide',callback: function() { } },main: { label: 'Aceptar', className: ' yellow', callback: function() { } } } });return false;" 'e.Row.FCLinkButton("BtnPagar") = + e.Row.FCLinkButton("BtnPagar").Enabled = False e.Row.FCLinkButton("BtnPagar").OnClientClick = "bootbox.dialog({" & "message: 'La solicitud de crédito no ha sido autorizada ', " & From ecb88c7dc7e12285bb61df97aacf1524b1e35d49 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 30 Dec 2024 11:47:55 -0700 Subject: [PATCH 4/8] --FIX buscador RFC/Nombre --- Ventas/Ventas.aspx | 2 +- Ventas/Ventas.aspx.vb | 42 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index cdad14650..fc26e3cb5 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -8228,7 +8228,7 @@
    - +
    diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 39adff7c8..cf5bb2b82 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9112,7 +9112,7 @@ Partial Class Ventas End If 'SI ESTA HABILITADO LA OPCION DE DESCUENTO, SE AGREGO UN DESCUENTO MANUAL Y NO TIENE PROMOCION - If GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Enabled AndAlso (ObjDescuento.CvePromocionDetalle <= 0 AndAlso ObjDescuento.ImporteDescuento <= 0) AndAlso DescuentoManual > 0 Then + If GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Enabled Then ObjDescuento.ImporteDescuento = DescuentoManual End If @@ -25083,6 +25083,21 @@ Partial Class Ventas CargaEstados() + TxtNombreCliente.Text = "" + TxtRFCCliente.Text = "" + TxtRegimenSociedad.Text = "" + DdlEstadoSAT.SelectedValueExist("-1") + TxtCiudadCliente.Text = "" + TxtLocalidadCliente.Text = "" + TxtColoniaCliente.Text = "" + TxtCPCliente.Text = "" + TxtDireccionCliente.Text = "" + TxtNumExtCliente.Text = "" + TxtNumIntCliente.Text = "" + TxtCorreoCliente.Text = "" + TxtTelefonoCliente.Text = "" + + If UsuarioActual.CveEmpresa = 189 Then TxtRFCNombre.Text = "" @@ -25135,7 +25150,16 @@ Partial Class Ventas DivValidaRFC.Visible = True DivValidaPorNombre.Visible = False DivBusquedaCliente.Visible = False - TxtRFCCliente.Text = TxtRFCNombre.Text + + 'VERIFICAR SI EL TEXTO DE ENTRADA ES UN NOMBRE O UN RFC + If TxtRFCNombre.Text.Length > 13 Then + TxtNombreCliente.Text = TxtRFCNombre.Text.Trim().ToUpper() + ElseIf EsRFC(TxtRFCNombre.Text.Trim()) Then + TxtRFCCliente.Text = TxtRFCNombre.Text.Trim().ToUpper() + Else + TxtNombreCliente.Text = TxtRFCNombre.Text.Trim().ToUpper() + End If + BtnValidarRFC_Click(Nothing, EventArgs.Empty) End If End If @@ -40034,9 +40058,21 @@ Partial Class Ventas DivValidaRFC.Visible = True DivValidaPorNombre.Visible = False DivBusquedaCliente.Visible = False - TxtRFCCliente.Text = TxtRFCNombre.Text + + 'VERIFICAR SI EL TEXTO DE ENTRADA ES UN NOMBRE O UN RFC + If TxtRFCNombre.Text.Length > 13 Then + TxtNombreCliente.Text = TxtRFCNombre.Text.Trim().ToUpper() + ElseIf EsRFC(TxtRFCNombre.Text.Trim()) Then + TxtRFCCliente.Text = TxtRFCNombre.Text.Trim().ToUpper() + Else + TxtNombreCliente.Text = TxtRFCNombre.Text.Trim().ToUpper() + End If BtnValidarRFC_Click(Nothing, EventArgs.Empty) End Sub + + Private Function EsRFC(texto As String) As Boolean + Return Regex.IsMatch(texto, "^[a-zñA-ZÑ.)(/\\&-]{3,4}(\d{6})((\D|\d){2})((\D|\d){1})$") + End Function End Class From 25f6044e623d54077293d16e9ded3d0dc9704119 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 30 Dec 2024 12:11:45 -0700 Subject: [PATCH 5/8] --FIX merge --- Ventas/Ventas.aspx.vb | 131 ++++++++++++++++++++++++++---------------- 1 file changed, 81 insertions(+), 50 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index cf5bb2b82..2b624ec92 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -1665,7 +1665,6 @@ Partial Class Ventas ViewState("CveOC") = value End Set End Property - Private Property RegistroxOC As Boolean Get Return CBool(IfNull(ViewState("RegistroxOC"), False)) @@ -1674,8 +1673,6 @@ Partial Class Ventas ViewState("RegistroxOC") = value End Set End Property - - Private Property EnviarCorreoCliente As Boolean Get Return CBool(IfNull(ViewState("EnviarCorreoCliente"), False)) @@ -2598,10 +2595,6 @@ Partial Class Ventas CargaGestionCobranza() End If - If UsuarioActual.Empresa.Funcionalidad(595) = "2" Then - LnkSolicitarCredito.Visible = True - End If - DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat") DivPSSAT.Visible = True @@ -7709,6 +7702,8 @@ Partial Class Ventas Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1) Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595) + 'solo para bdh, que se generen NC + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlSolCreditoTipoDocto.Items.Add(New ListItem("Nota de crédito", "Egs")) 'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO If Not EsFilial AndAlso (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then @@ -7750,7 +7745,7 @@ Partial Class Ventas If Me.PermiteCredito Then If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then - Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) + Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) If CreditoDispo > 0 Then TrCreditoDisponible.Visible = True LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo) @@ -7778,7 +7773,7 @@ Partial Class Ventas UPCondicionesPago.Update() End If - Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) + Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) If CreditoDispo > 0 Then TrCreditoDisponible.Visible = True @@ -7801,7 +7796,7 @@ Partial Class Ventas If Not EsCreaApartirDe AndAlso (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValueExist("Cot") Else - If UsuarioActual.Empresa.Funcionalidad(595) = "1" Then + If ValorAutorizacion = "1" Then DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") DdlTipoComprobante.SelectedValue = "PA" @@ -7814,7 +7809,7 @@ Partial Class Ventas If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValue = "Cot" 'quito remisión y factura - If UsuarioActual.Empresa.Funcionalidad(595) <> "2" Then + If ValorAutorizacion = "1" Then DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) If Not UsuarioActual.TienePermisoProceso(325) Then DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) @@ -7839,7 +7834,6 @@ Partial Class Ventas If Bloqueo AndAlso ValorAutorizacion = "2" Then Dim Autorizacion As Integer = 0 - Dim ObjVentas As New ClsVentas If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then Dim RowAutorizacion As DataRow = Nothing @@ -7862,6 +7856,16 @@ Partial Class Ventas TieneBloqueoPorCreditoVencimiento = 0 Alert("El cliente tiene una autorización aprobada", TipoMensaje.ToastInformacion) End If + LnkSolicitarCredito.Visible = True + DdlTipoAutorizacion.SelectedValueExist("1") + End If + + If Bloqueo AndAlso ValorAutorizacion = "3" Then ' autorización con vinculación a una venta registrada + TrCredito1.Visible = True + ChkSolicitudAutorizacionCredito.Checked = True + LnkSolicitarCredito.Visible = True + divModalidad2.Visible = False + divModalidad3.Visible = True End If 'SI ES AUTORIZACION DEBE PERMITIR GENERARLA @@ -7999,16 +8003,7 @@ Partial Class Ventas End If End If Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones - 'RMF. validacion temporal - 'verifica si tiene autorizaciones de Nota de crédito autorizadas - 'Dim ObjVentas As New ClsVentas - 'If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, "Ing", CveEstatus:=1) Then - ' Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion") - ' If RowAutorizacion IsNot Nothing Then - ' DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos") - ' End If - 'End If - 'ObjVentas.Dispose() + 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) @@ -8128,7 +8123,7 @@ Partial Class Ventas 'CREDITO NO SUFICIENTE If Opcion = 3 Then - 'Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) + 'Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) 'If CreditoDispo < 0 AndAlso RBLPago.SelectedValue = "1" Then ' BloquearCliente = True 'End If @@ -8295,7 +8290,7 @@ Partial Class Ventas Alert("La Sucursal/Departamento del cliente se encuentra inactivo", TipoMensaje.MsgAdvertencia) Else RBLPago.Items(0).Enabled = True - Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero(), ObjVentas) + Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero(), ObjVentas) TrCreditoDisponible.Visible = True LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo) @@ -8435,7 +8430,7 @@ Partial Class Ventas UpCliente.Update() UpEmitirTransitorio.Update() End Sub - Private Function CargaCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal + Private Function GetSaldoCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal Dim Retorno As Decimal = 0 Dim ObjVentasAplciar As ClsVentas = Nothing If ObjVentas IsNot Nothing Then @@ -9083,9 +9078,9 @@ Partial Class Ventas GvPS.DataBind() End Sub Protected Sub GvPS_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvPS.RowUpdating - 'Dim TipoDescuento As Integer - Dim CvePSNuevo As Integer = GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero() + Dim CvePSNuevo As Integer = GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero() + Dim CvePSAnterior As Integer = GvPS.Rows(e.RowIndex).DataKey("CvePS").ToEntero Dim Cantidad, PU As Decimal Dim ObjDescuento As New Modelos.VentaDescuentos Dim CuentaPredial As String @@ -9112,7 +9107,7 @@ Partial Class Ventas End If 'SI ESTA HABILITADO LA OPCION DE DESCUENTO, SE AGREGO UN DESCUENTO MANUAL Y NO TIENE PROMOCION - If GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Enabled Then + If GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Enabled AndAlso CvePSAnterior = CvePSNuevo Then 'AndAlso (ObjDescuento.CvePromocionDetalle <= 0 AndAlso ObjDescuento.ImporteDescuento <= 0) Then ObjDescuento.ImporteDescuento = DescuentoManual End If @@ -10904,6 +10899,35 @@ Partial Class Ventas End If End If End If + If ErrorList.Count = 0 AndAlso ObjFactura.CveVenta > 0 AndAlso ChkSolicitudAutorizacionCredito.Checked Then + ' crea la solicitud de autorización de crédito + Dim tCveTipoAutorizacion As Integer = 1 + If ObjVentas.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtTotal.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, tCveTipoAutorizacion, TipoDocumento:=DdlTipoComprobante.SelectedValue, DiasVencidos:=25, CveVenta:=ObjFactura.CveVenta) Then + Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) + Dim Arr As New ArrayList + + Arr.Add(NombreCliente) + Arr.Add($" $ {TxtTotal.Text.ToDecimal}") + Arr.Add(DdlSubProyectoDatos.SelectedItem.Text) + Dim dtt As DataTable = Nothing + Dim ObjProceso As New ClsSisProcesos + If ObjProceso.GetUsuariosconProceso(379, UsuarioActual.CveEmpresa) Then 'proceso para autorizar + dtt = ObjProceso.DtResultados.FiltraParametros("", DistinctColumns:={"CveUsuario", "Celular"}) + End If + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + For Each dr As DataRow In dtt.Rows + Dim NumeroTelefono = "526621143532" + If EsProduccion Then + NumeroTelefono = String.Format("52{0}", dr("Celular").ToString()) + End If + EnviarNotificacionWhatsAppPlantilla(NumeroTelefono, "solicitud_autorizacion_credito2", Arr) + 'ClsSisNotificaciones.EnviarAlerta("Solicitud de Autorización de crédito", $"Solicitud de autorización de crédito Folio: {Folio}
    Ir Activar", dr("CveUsuario").ToString, Tipo:=TipoNotificacion.ToastInformacionB) + Next + End If + ObjProceso.Dispose() + + End If + End If 'Paso CRM actualizar importe de acercamiento y guardar en bitacora If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then @@ -25097,7 +25121,6 @@ Partial Class Ventas TxtCorreoCliente.Text = "" TxtTelefonoCliente.Text = "" - If UsuarioActual.CveEmpresa = 189 Then TxtRFCNombre.Text = "" @@ -26073,16 +26096,16 @@ Partial Class Ventas Dim RestringirAlmacenes As Integer = -1 - Dim BuscarEnTabla As Boolean = True - - Dim ObjInventarios As New ClsInventarios() - If ObjInventarios.GetExistenciasProducto(GvRow.DataKey("CvePS").ToEntero(), -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), - ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=-1, - ExcluyeTransitorios:=1, RestringirAlmacenes:=RestringirAlmacenes, TopSelect:=100, BuscarEnTabla:=BuscarEnTabla) Then - GvVerExistencias.DataSource = ObjInventarios.DtResultados.Copy() - End If - ObjInventarios.Dispose() - + Dim BuscarEnTabla As Boolean = True + + Dim ObjInventarios As New ClsInventarios() + If ObjInventarios.GetExistenciasProducto(GvRow.DataKey("CvePS").ToEntero(), -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), + ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=-1, + ExcluyeTransitorios:=1, RestringirAlmacenes:=RestringirAlmacenes, TopSelect:=100, BuscarEnTabla:=BuscarEnTabla) Then + GvVerExistencias.DataSource = ObjInventarios.DtResultados.Copy() + End If + ObjInventarios.Dispose() + GvVerExistencias.DataBind() UpVerExistencias.Update() @@ -37336,11 +37359,16 @@ Partial Class Ventas UpModalSolicitud.Update() End Sub Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click + If UsuarioActual.Empresa.Funcionalidad(595) = "3" Then + RegistraScript("$('#DivModalSolicitarCredito').modal('hide')") + Exit Sub + End If + Dim DiasVencidos As Integer = 0 Dim CveEstatus As Integer = 0 Dim TipoDocto As String = DdlSolCreditoTipoDocto.SelectedValue Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero() - If CveTipoAutorizacion <= 0 Then + If UsuarioActual.Empresa.Funcionalidad(595) <> "3" AndAlso CveTipoAutorizacion <= 0 Then Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -37364,8 +37392,11 @@ Partial Class Ventas UpModalSolicitud.Update() End Sub Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged - DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 - DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2 + DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue = "1" + DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue = "2" + If Not UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + TxtDiasVencidos.Text = "25" + End If UpModalSolicitud.Update() End Sub @@ -39863,18 +39894,18 @@ Partial Class Ventas End Function Protected Sub GvVerExistencias_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CveAlmacen") = "" Then - e.Row.CssClass = "Totales" + If e.Row.DBCampo("CveAlmacen") = "" Then + e.Row.CssClass = "Totales" End If End If End Sub - Private Sub CargaGiro() - Dim Dt As DataTable = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa) - DdlGiro.DataSource = Dt - DdlGiro.DataBind() - DdlGiro.Items.Insert(0, New ListItem("Seleccione", "-1")) - UpAgregarCliente.Update() + Private Sub CargaGiro() + Dim Dt As DataTable = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa) + DdlGiro.DataSource = Dt + DdlGiro.DataBind() + DdlGiro.Items.Insert(0, New ListItem("Seleccione", "-1")) + UpAgregarCliente.Update() End Sub From 48a7c08fb27349954fd2323a74ea6bc44bdaa941 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 30 Dec 2024 14:07:12 -0700 Subject: [PATCH 6/8] --TEMPORAL - NO VERIFICAR EXISTENCIA CUANDO SON MUCHOS DATOS --- Inventarios/EntregaAlmacen.aspx.vb | 77 +++++++++++++++++++----------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 98d85a892..427aae109 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -2300,28 +2300,38 @@ Partial Class Inventarios_EntregaAlmacen StrXML.Append("") Dim TieneErrorExistencia As Boolean = False - If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero(), TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - If ObjInventario.DtResultados.Rows.Count > 0 Then - TieneErrorExistencia = True - For Each Dr As DataRow In ObjInventario.DtResultados.Rows + Dim VerificaExistencia As Boolean = True - Dim SerieLoteCaducidad As String = "," - If Dr("Serie").ToString.Trim.Length > 0 AndAlso Dr("Serie").ToString.Trim <> "-1" Then - SerieLoteCaducidad = $" Serie: { Dr("Serie").ToString.Trim}" - End If - If Dr("Lote").ToString.Trim.Length > 0 AndAlso Dr("Lote").ToString.Trim <> "-1" Then - SerieLoteCaducidad = $"{SerieLoteCaducidad} Lote: {Dr("Lote").ToString.Trim}" - End If - If Dr("FechaCaducidad").ToString.Trim.Length > 0 AndAlso Dr("FechaCaducidad").ToString.Trim <> "-1" Then - SerieLoteCaducidad = $"{SerieLoteCaducidad} Caducidad: { Dr("FechaCaducidad").ToString.Trim.ToDate.ToString("dd/MM/yyyy")}" - End If - TextoError.AppendFormat(" - {0} Existencia: {1:#,##0.##} {2}
    ", Dr("CodigoPS"), Dr("Existencia"), If(SerieLoteCaducidad <> ",", SerieLoteCaducidad, "")) - Next - End If - Else - TieneErrorExistencia = True + 'TEMPORAL - NO VERIFICAR EXISTENCIA CUANDO SON MUCHOS DATOS + If UsuarioActual.CveEmpresa = 140 AndAlso DtDatos.Rows.Count > 10 Then + VerificaExistencia = False End If + If VerificaExistencia Then + If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero(), TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + If ObjInventario.DtResultados.Rows.Count > 0 Then + TieneErrorExistencia = True + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + + Dim SerieLoteCaducidad As String = "," + If Dr("Serie").ToString.Trim.Length > 0 AndAlso Dr("Serie").ToString.Trim <> "-1" Then + SerieLoteCaducidad = $" Serie: { Dr("Serie").ToString.Trim}" + End If + If Dr("Lote").ToString.Trim.Length > 0 AndAlso Dr("Lote").ToString.Trim <> "-1" Then + SerieLoteCaducidad = $"{SerieLoteCaducidad} Lote: {Dr("Lote").ToString.Trim}" + End If + If Dr("FechaCaducidad").ToString.Trim.Length > 0 AndAlso Dr("FechaCaducidad").ToString.Trim <> "-1" Then + SerieLoteCaducidad = $"{SerieLoteCaducidad} Caducidad: { Dr("FechaCaducidad").ToString.Trim.ToDate.ToString("dd/MM/yyyy")}" + End If + TextoError.AppendFormat(" - {0} Existencia: {1:#,##0.##} {2}
    ", Dr("CodigoPS"), Dr("Existencia"), If(SerieLoteCaducidad <> ",", SerieLoteCaducidad, "")) + Next + End If + Else + TieneErrorExistencia = True + End If + End If + + If TieneErrorExistencia Then ObjInventario.RollBack() ObjInventario.Dispose() @@ -3681,17 +3691,28 @@ Partial Class Inventarios_EntregaAlmacen StrXML.Append("") Dim TieneErrorExistencia As Boolean = False - If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero(), TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - If ObjInventario.DtResultados.Rows.Count > 0 Then - TieneErrorExistencia = True - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - TextoError += $" - {Dr("CodigoPS")} Existencia: {Dr("Existencia").ToString().ToDecimal.ToString("#,##0.##")}
    " - Next - End If - Else - TieneErrorExistencia = True + + Dim VerificaExistencia As Boolean = True + + 'TEMPORAL - NO VERIFICAR EXISTENCIA CUANDO SON MUCHOS DATOS + If UsuarioActual.CveEmpresa = 140 AndAlso DtDatos.Rows.Count > 10 Then + VerificaExistencia = False End If + If VerificaExistencia Then + If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero(), TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + If ObjInventario.DtResultados.Rows.Count > 0 Then + TieneErrorExistencia = True + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + TextoError += $" - {Dr("CodigoPS")} Existencia: {Dr("Existencia").ToString().ToDecimal.ToString("#,##0.##")}
    " + Next + End If + Else + TieneErrorExistencia = True + End If + End If + + If TieneErrorExistencia Then ObjInventario.RollBack() ObjInventario.Dispose() From 5bef565679af0866ede4d1afd04c846776efcf31 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 30 Dec 2024 16:54:20 -0700 Subject: [PATCH 7/8] -- FIX cambios en alta de cliente --- Ventas/Ventas.aspx | 5 ++--- Ventas/Ventas.aspx.vb | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index cc159a59b..b556ddb94 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -8383,10 +8383,9 @@
    - - + - +
    diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 2b624ec92..1330474b2 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -25093,7 +25093,7 @@ Partial Class Ventas DivNombreCliente.Visible = False DivTipoPersona.Visible = False DivDireccionCliente.Visible = False - + DVRegimenSociedad.Visible = False DivNumeroCPCliente.Visible = False 'DivColoniaTelefonoCliente.Visible = False DivCiudadLocalidadCliente.Visible = False @@ -25215,7 +25215,8 @@ Partial Class Ventas RdTipoPersona.SelectedValue = "0" - DdlMetodoCliente.SelectedValueExist(1) + DdlMetodoCliente.SelectedValueExist("1") + DdlMetodoCliente_SelectedIndexChanged(Nothing, EventArgs.Empty) 'DdlFormaCliente.SelectedValueExist(1) @@ -25265,7 +25266,7 @@ Partial Class Ventas End If - If UsuarioActual.CveEmpresa = 189 Then + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then divGiro.Visible = True Dim DrSP As DataRow = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, DdlSubProyectoDatos.SelectedValue.ToEntero()).FiltroPrimero("") @@ -25282,6 +25283,32 @@ Partial Class Ventas End If + DdlMetodoCliente.SelectedValueExist(1) + DdlMetodoCliente_SelectedIndexChanged(Nothing, EventArgs.Empty) + + 'PERSONA MORAL + If TxtRFCCliente.Text.Trim().Length = 12 Then + RdTipoPersona.SelectedValue = "1" + RdTipoPersona_SelectedIndexChanged(Nothing, EventArgs.Empty) + + DdlRegimenFiscalCliente.SelectedValueExist("1") + DdlRegimenFiscalCliente_SelectedIndexChanged(Nothing, EventArgs.Empty) + 'PERSONA FISICA + Else + RdTipoPersona.SelectedValue = "0" + RdTipoPersona_SelectedIndexChanged(Nothing, EventArgs.Empty) + + If TxtRFCCliente.Text.Trim() = "XAXX010101000" Then + DdlRegimenFiscalCliente.SelectedValueExist("11") + Else + DdlRegimenFiscalCliente.SelectedValueExist("9") + End If + + DdlRegimenFiscalCliente_SelectedIndexChanged(Nothing, EventArgs.Empty) + + End If + + DdlUsoCFDICliente.SelectedValueExist("3") End If End Sub @@ -38769,7 +38796,7 @@ Partial Class Ventas End Sub Private Sub DdlMetodoCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMetodoCliente.SelectedIndexChanged - DdlFormaCliente.Items.Clear() + If DdlMetodoCliente.SelectedValue = "3" Then DdlFormaCliente.DataSource = GlobalDTVtaFormaPago.FiltraParametros("CveFormaPago = 20") Else @@ -38777,6 +38804,10 @@ Partial Class Ventas End If DdlFormaCliente.DataBind() + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + DdlFormaCliente.SelectedValueExist("1") + End If + End Sub Private Sub AsignaMedicoProcedimientoFacturaRemisionesModal() From 40d7ef9dce6ac01df35c8469c1e2cc695e4cec9f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 30 Dec 2024 17:20:00 -0700 Subject: [PATCH 8/8] --Ventas.aspx. cuadre con productivo --- Ventas/Ventas.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 1330474b2..bfdd0e839 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6881,7 +6881,7 @@ Partial Class Ventas LnkAgregarCliente.Visible = False 'SI EL CLIENTE ES DIFERENTE DEL PREDETERMINADO Y PERMITE CREDITO, REGRESAR EL METODO DE PAGO A CREDITO - If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(714).ToEntero() > 0 AndAlso CveCliente <> UsuarioActual.Empresa.Funcionalidad(714).ToEntero() AndAlso RBLPago.SelectedValue = "2" AndAlso Me.PermiteCredito Then + If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(714).ToEntero() > 0 AndAlso CveCliente <> UsuarioActual.Empresa.Funcionalidad(714).ToEntero() AndAlso RBLPago.SelectedValue = "2" AndAlso Me.PermiteCredito AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then RBLPago.SelectedValue = "1" End If