From 27938cf51583da47cf8fe9f30521a8f69197fcca Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 10 Jan 2025 16:47:11 -0700 Subject: [PATCH 01/10] --FIX ventas --- Ventas/Ventas.aspx.vb | 53 +++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 715278271..6ac79c8f5 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -37794,7 +37794,7 @@ Partial Class Ventas If CveVenta > 0 Then Dim ObjVta As New ClsVentas - If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtTotal.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ing", DiasVencidos:=25, CveVenta:=CveVenta) Then + If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtTotal.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, 1, TipoDocumento:=DdlTipoComprobante.SelectedValue, DiasVencidos:=25, CveVenta:=CveVenta) Then RegistraScript("$('#DivModalSolicitarCredito').modal('hide')") Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) 'signal @@ -37809,33 +37809,36 @@ Partial Class Ventas Exit Sub End If + Else + + Dim DiasVencidos As Integer = 0 + Dim CveEstatus As Integer = 0 + Dim TipoDocto As String = DdlSolCreditoTipoDocto.SelectedValue + Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero() + If UsuarioActual.Empresa.Funcionalidad(595) <> "3" AndAlso CveTipoAutorizacion <= 0 Then + Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If CveTipoAutorizacion = 2 Then + DiasVencidos = TxtDiasVencidos.Text.ToEntero() + End If + + Dim Motivo As String = TxtMotivoAutorizacion.Text + + Dim ObjPS As New ClsVentas + If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlSolCreditoTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos, Motivo:=Motivo) Then + RegistraScript("$('#DivModalSolicitarCredito').modal('hide')") + Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) + 'signal + Dim mensaje = "
La autorización se agregó correctamente." + ClsSisNotificaciones.EnviarAlerta("Autorización Crédito", mensaje, "100", Tipo:=TipoNotificacion.ToastInformacionB) + + End If + ObjPS.Dispose() 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 UsuarioActual.Empresa.Funcionalidad(595) <> "3" AndAlso CveTipoAutorizacion <= 0 Then - Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - If CveTipoAutorizacion = 2 Then - DiasVencidos = TxtDiasVencidos.Text.ToEntero() - End If - - Dim Motivo As String = TxtMotivoAutorizacion.Text - - Dim ObjPS As New ClsVentas - If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlSolCreditoTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos, Motivo:=Motivo) Then - RegistraScript("$('#DivModalSolicitarCredito').modal('hide')") - Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) - 'signal - Dim mensaje = "
La autorización se agregó correctamente." - ClsSisNotificaciones.EnviarAlerta("Autorización Crédito", mensaje, "100", Tipo:=TipoNotificacion.ToastInformacionB) - - End If - ObjPS.Dispose() UpModalSolicitud.Update() End Sub Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged From b48ca152d5b0961d29ac853266740934e39aab68 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 10 Jan 2025 16:47:52 -0700 Subject: [PATCH 02/10] =?UTF-8?q?--=200=20Dej=C3=B3=20de=20pedir=20autoriz?= =?UTF-8?q?acion=20de=20aplicacion=20de=20anticipos.=20-=20poner=20bit?= =?UTF-8?q?=C3=A1cora=20de=20autorizaci=C3=B3n.=20-=20una=20vez=20aplicado?= =?UTF-8?q?=20se=20pone=20estatus=20de=20bloqueado.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ventas/Clientes.aspx.vb | 48 +++++++++++++++++++++++++++++-- Ventas/PVCobranza.aspx.vb | 59 +++++++++++++++++++++++++++++++++++---- 2 files changed, 98 insertions(+), 9 deletions(-) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index e76f786b1..377e3e8d9 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -10764,17 +10764,34 @@ Partial Class Clientes Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero() If CveVenta > 0 OrElse CveIE > 0 Then + Dim Actualizo As Boolean = False + Using ObjVentas As New ClsVentas If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, True) Then Alert("El anticipo se autorizó correctamente") + Actualizo = True End If ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, True) Then Alert("El anticipo se autorizó correctamente") + Actualizo = True End If End If End Using + + If Actualizo Then + Dim ObjEventoBitacora As New ClsOIEventos + If ObjEventoBitacora.AddEventoBitacora($"El folio '{GvRow.DataKey("Folio")}' ha sido autorizado", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + GvEB.DataSource = ObjEventoBitacora.DtResultados + End If + ObjEventoBitacora.Dispose() + GvEB.DataBind() + + UPEventoBitacora.Update() + CargaEventoBitacora() + End If + End If CargaAnticipos() @@ -10783,13 +10800,38 @@ Partial Class Clientes Protected Sub LnkCancelarAnticipo_Click(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero() - If CveVenta > 0 Then + Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero() + + If CveVenta > 0 OrElse CveIE > 0 Then + Dim Actualizo As Boolean = False Using ObjVentas As New ClsVentas - If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then - Alert("El anticipo se desautorizó correctamente") + If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then + If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then + Alert("El anticipo se desautorizó correctamente") + Actualizo = True + End If + ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then + If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then + Alert("El anticipo se desautorizó correctamente") + Actualizo = True + End If End If End Using CargaAnticipos() + + If Actualizo Then + Dim ObjEventoBitacora As New ClsOIEventos + If ObjEventoBitacora.AddEventoBitacora($"El folio '{GvRow.DataKey("Folio")}' ha sido bloqueado", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + GvEB.DataSource = ObjEventoBitacora.DtResultados + End If + ObjEventoBitacora.Dispose() + GvEB.DataBind() + + UPEventoBitacora.Update() + CargaEventoBitacora() + End If + + End If End Sub End Class diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 6f7ec4a57..bb70f086f 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -589,11 +589,11 @@ Partial Class Ventas_PVCobranza Dim CveVentaRemision As Integer = -1 Dim DbRowVenta As DataRow = Nothing - Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") + Dim ObjVtaRemision As New ClsVentas + If ObjVtaRemision.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + DbRowVenta = ObjVtaRemision.DtResultados.Copy().FiltroPrimero("") End If - ObjVentas.Dispose() + ObjVtaRemision.Dispose() If DbRowVenta IsNot Nothing Then Dim VentaActual As New Venta(UsuarioActual) @@ -634,6 +634,7 @@ Partial Class Ventas_PVCobranza Dim ObjIE As New ClsBancos(ObjVentas2.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(ObjVentas2.IniciaTransacSQL()) Dim ObjClientes As New ClsClientes(ObjVentas2.IniciaTransacSQL()) + Dim ObjOIEventos As New ClsOIEventos(ObjVentas2.IniciaTransacSQL()) Dim respFactura As Modelos.Factura.MMensajeFactura = Nothing Dim respNC As Modelos.Factura.MMensajeFactura = Nothing @@ -660,6 +661,14 @@ Partial Class Ventas_PVCobranza If respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then PagoAplicado += respFactura.Factura.DtAnticiposAplicados.SUM("Importe") SaldoPendiente = SaldoPendiente - PagoAplicado + + For Each RowAnt As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows + If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then + MsgError = "Ocurrió un error al actualizar los anticipos" + Exit For + End If + Next + End If End If @@ -682,6 +691,14 @@ Partial Class Ventas_PVCobranza Else PagoAplicado += respNC.Factura.Total SaldoPendiente = SaldoPendiente - PagoAplicado + + For Each RowAnt As DataRow In respNC.Factura.DtAnticiposAplicados.Rows + If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then + MsgError = "Ocurrió un error al actualizar los anticipos" + Exit For + End If + Next + End If Else MsgError = "Ocurrió un error al generar la nota de crédito" @@ -884,6 +901,31 @@ Partial Class Ventas_PVCobranza End Sub + Private Function ActualizaAnticipos(CveIE As Integer, CveVenta As Integer, Tipo As String, Folio As String, ByRef ObjVentas As ClsVentas, ByRef ObjEventoBitacora As ClsOIEventos) As Boolean + Dim Retorno As Boolean = True + + If CveVenta > 0 OrElse CveIE > 0 Then + Dim Actualizo As Boolean = False + If Tipo.Contiene("NC", "Ant") Then + If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then + Alert("El anticipo se desautorizó correctamente") + Actualizo = True + End If + ElseIf Tipo.Contiene("IxC") Then + If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then + Alert("El anticipo se desautorizó correctamente") + Actualizo = True + End If + End If + + If Actualizo Then + Retorno = ObjEventoBitacora.AddEventoBitacora($"El folio '{Folio}' ha sido bloqueado", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta) + End If + End If + + Return Retorno + End Function + Private Sub LimpiarDatos() PnlContado.Visible = False TxtImporteEfectivo.Text = "" @@ -1017,6 +1059,7 @@ Partial Class Ventas_PVCobranza DtAnticipos.Columns.Add("Fecha", GetType(DateTime)) DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal)) DtAnticipos.Columns.Add("Folio", GetType(String)) + DtAnticipos.Columns.Add("Tipo", GetType(String)) For Each GvRow As GridViewRow In GVAnticipos.Rows If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then @@ -1033,8 +1076,9 @@ Partial Class Ventas_PVCobranza Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime() Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal() Dim Folio = GvRow.DataKey("Folio") + Dim Tipo = GvRow.DataKey("Tipo") - DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio) + DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo) End If Next @@ -1173,6 +1217,7 @@ Partial Class Ventas_PVCobranza DtAnticipos.Columns.Add("Fecha", GetType(DateTime)) DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal)) DtAnticipos.Columns.Add("Folio", GetType(String)) + DtAnticipos.Columns.Add("Tipo", GetType(String)) For Each GvRow As GridViewRow In GVAnticipos.Rows If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then @@ -1189,8 +1234,10 @@ Partial Class Ventas_PVCobranza Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime() Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal() Dim Folio = GvRow.DataKey("Folio") + Dim Tipo = GvRow.DataKey("Tipo") - DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio) + + DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo) End If Next From 2d71edb488e52ae6500e1bcebc70c5764b97ed4a Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 10 Jan 2025 17:17:26 -0700 Subject: [PATCH 03/10] 1 En Depositos de caja, omitir validacion de que esten todos los cobros aplicados en caja, solo en la opcion de transferencias --- Bancos/DepositosCaja.aspx.vb | 62 ++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index e060b3de8..ac7b0420a 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -512,40 +512,46 @@ Partial Class Bancos_DepositosCaja If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then - Dim ObjMovtos As New ClsMovimientos() - Dim FechaI, FechaF As Date - FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) - FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1) + If DdlTipoDeposito.SelectedValue <> "8" Then + Dim ObjMovtos As New ClsMovimientos() + Dim FechaI, FechaF As Date + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1) - Dim CveSubProyecto As Integer = -1 + Dim CveSubProyecto As Integer = -1 - If DdlSubProyectos.SelectedValue.ToEntero > 0 Then - CveSubProyecto = DdlSubProyectos.SelectedValue.ToEntero - End If - - Dim CveSubProyectoCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero() - - If CveSubProyectoCuenta > 0 Then - CveSubProyecto = CveSubProyectoCuenta - End If - - If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, CveSubProyecto, FechaI, FechaF, UsuarioActual.CveUsuario) Then - Dim dtt As DataTable = ObjMovtos.DtResultados.FiltraParametros($"CveVenta > 0 AND (CveUsuarioCobranza IS NULL OR CveUsuarioCobranza = {UsuarioActual.CveUsuario}) AND TipoDocto IN ('Ing','Rem') AND RemisionEspecial = 0") - 'Dim Dtta As DataTable = dtt.FiltraParametros($"CveUsuarioCobranza = {UsuarioActual.CveUsuario} ") - 'If Dtta IsNot Nothing AndAlso Dtta.Rows.Count > 0 Then dtt = Dtta - - If dtt.Rows.Count = 0 Then - Respuesta = True - Else - Respuesta = False - Alert("No se puede realizar el depósito, ya que hay cobros pendientes por aplicar.", TipoMensaje.MsgAdvertencia) + If DdlSubProyectos.SelectedValue.ToEntero > 0 Then + CveSubProyecto = DdlSubProyectos.SelectedValue.ToEntero End If + Dim CveSubProyectoCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero() + + If CveSubProyectoCuenta > 0 Then + CveSubProyecto = CveSubProyectoCuenta + End If + + If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, CveSubProyecto, FechaI, FechaF, UsuarioActual.CveUsuario) Then + Dim dtt As DataTable = ObjMovtos.DtResultados.FiltraParametros($"CveVenta > 0 AND (CveUsuarioCobranza IS NULL OR CveUsuarioCobranza = {UsuarioActual.CveUsuario}) AND TipoDocto IN ('Ing','Rem') AND RemisionEspecial = 0") + 'Dim Dtta As DataTable = dtt.FiltraParametros($"CveUsuarioCobranza = {UsuarioActual.CveUsuario} ") + 'If Dtta IsNot Nothing AndAlso Dtta.Rows.Count > 0 Then dtt = Dtta + + If dtt.Rows.Count = 0 Then + Respuesta = True + Else + Respuesta = False + Alert("No se puede realizar el depósito, ya que hay cobros pendientes por aplicar.", TipoMensaje.MsgAdvertencia) + End If + + Else + Alert("Error al consultarcobros pendientes.", TipoMensaje.MsgAdvertencia) + Respuesta = False + End If + ObjMovtos.Dispose() Else - Alert("Error al consultarcobros pendientes.", TipoMensaje.MsgAdvertencia) - Respuesta = False + 'SI ES TRANSFERENCIA PERMITIR CERRAR + Respuesta = True End If - ObjMovtos.Dispose() + Else Respuesta = True End If From 92e7d947e95d4d068689eb96b9b9221100e58a3a Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 10 Jan 2025 18:29:36 -0700 Subject: [PATCH 04/10] --2 Ver existencias en cotizacion, actual o existente --- Ventas/Ventas.aspx.vb | 79 ++++++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 42a2d0011..94b2ca4a3 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9006,13 +9006,16 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso Not UsuarioActual.Empresa.Funcionalidad(382) = "1" Then e.Row.FCLinkButton("LnkDescuentos").Visible = True - If e.Row.DBCampo("TipoDocto") = "Cot" AndAlso CveVenta > 0 AndAlso Not EsCreaApartirDe Then + If e.Row.DBCampo("TipoDocto").Contiene("Cot") AndAlso (CveVenta > 0 AndAlso Not EsCreaApartirDe) Then e.Row.FCLinkButton("imgClone").Visible = False End If End If If UsuarioActual.CveEmpresa = 189 Then e.Row.FCLinkButton("LnkExistencias").Visible = True + If e.Row.DBCampo("TipoDocto").Contiene("Cot", "Rem") AndAlso (CveVenta > 0 AndAlso Not EsCreaApartirDe) Then + e.Row.FCLinkButton("imgClone").Visible = False + End If End If If CveVenta <= 0 Then @@ -24007,22 +24010,33 @@ Partial Class Ventas GvPS.Columns(21).Visible = True thOrden.Visible = True - If GvPS.Columns(21).Visible Then - For Each GvRow As GridViewRow In GvPS.Rows - If GvRow.RowType = DataControlRowType.Header Then - GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True - End If + Dim HabilitarExistencias As Boolean = False - If GvRow.RowType = DataControlRowType.DataRow Then - GvRow.FCTextBox("TxtOrden").Visible = True - - If GvRow.FCTextBox("TxtOrden").ToEntero() <= 0 Then - GvRow.FCTextBox("TxtOrden").Text = GvRow.DataKey("Consec") - End If - End If - Next + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + HabilitarExistencias = True + GvPS.Columns(20).Visible = True End If + For Each GvRow As GridViewRow In GvPS.Rows + If GvRow.RowType = DataControlRowType.Header Then + GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True + End If + + If GvRow.RowType = DataControlRowType.DataRow Then + GvRow.FCTextBox("TxtOrden").Visible = True + + If GvRow.FCTextBox("TxtOrden").ToEntero() <= 0 Then + GvRow.FCTextBox("TxtOrden").Text = GvRow.DataKey("Consec") + End If + End If + + If HabilitarExistencias Then + GvRow.FCLinkButton("LnkExistencias").Visible = True + GvRow.FCLinkButton("imgClone").Visible = False + GvRow.FCLinkButton("LnkDescuentos").Visible = False + End If + Next + OrdenarPS(True) UpCliente.Update() @@ -33202,22 +33216,33 @@ Partial Class Ventas GvPS.Columns(21).Visible = True thOrden.Visible = True - If GvPS.Columns(21).Visible Then - For Each GvRow As GridViewRow In GvPS.Rows - If GvRow.RowType = DataControlRowType.Header Then - GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True - End If + Dim HabilitarExistencias As Boolean = False - If GvRow.RowType = DataControlRowType.DataRow Then - GvRow.FCTextBox("TxtOrden").Visible = True - - If GvRow.FCTextBox("TxtOrden").ToEntero() <= 0 Then - GvRow.FCTextBox("TxtOrden").Text = GvRow.DataKey("Consec") - End If - End If - Next + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + HabilitarExistencias = True + GvPS.Columns(20).Visible = True End If + For Each GvRow As GridViewRow In GvPS.Rows + If GvRow.RowType = DataControlRowType.Header Then + GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True + End If + + If GvRow.RowType = DataControlRowType.DataRow Then + GvRow.FCTextBox("TxtOrden").Visible = True + + If GvRow.FCTextBox("TxtOrden").ToEntero() <= 0 Then + GvRow.FCTextBox("TxtOrden").Text = GvRow.DataKey("Consec") + End If + End If + + If HabilitarExistencias Then + GvRow.FCLinkButton("LnkExistencias").Visible = True + GvRow.FCLinkButton("imgClone").Visible = False + GvRow.FCLinkButton("LnkDescuentos").Visible = False + End If + Next + OrdenarPS(True) UpPS.Update() From 7d8defb8131bec9a4d1dee4e875d80caddfac7b0 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 10 Jan 2025 19:31:55 -0700 Subject: [PATCH 05/10] --FIX mensaje de bloque/autorizacion --- Ventas/Clientes.aspx.vb | 4 ++-- Ventas/PVCobranza.aspx.vb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 377e3e8d9..71b0f99fd 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -10782,7 +10782,7 @@ Partial Class Clientes If Actualizo Then Dim ObjEventoBitacora As New ClsOIEventos - If ObjEventoBitacora.AddEventoBitacora($"El folio '{GvRow.DataKey("Folio")}' ha sido autorizado", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + If ObjEventoBitacora.AddEventoBitacora($"El anticipo se autorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then GvEB.DataSource = ObjEventoBitacora.DtResultados End If ObjEventoBitacora.Dispose() @@ -10821,7 +10821,7 @@ Partial Class Clientes If Actualizo Then Dim ObjEventoBitacora As New ClsOIEventos - If ObjEventoBitacora.AddEventoBitacora($"El folio '{GvRow.DataKey("Folio")}' ha sido bloqueado", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + If ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then GvEB.DataSource = ObjEventoBitacora.DtResultados End If ObjEventoBitacora.Dispose() diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index bb70f086f..6bf5ca557 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -919,7 +919,7 @@ Partial Class Ventas_PVCobranza End If If Actualizo Then - Retorno = ObjEventoBitacora.AddEventoBitacora($"El folio '{Folio}' ha sido bloqueado", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta) + Retorno = ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: {Folio}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta) End If End If From 52e672ac61c7ce50e5510d474cf5714b7a08afb2 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 10 Jan 2025 19:35:17 -0700 Subject: [PATCH 06/10] --FIX cancelacion con pagos en anticipos --- App_Code/Modelos.vb | 2 +- Ventas/Ventas.aspx.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index b9250d79c..7345e52fe 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3073,7 +3073,7 @@ Namespace Modelos Try Dim AplicaCancelacionConPagos As Boolean = (CancelacionPagos = OpcionesCancelacionPagos.ConPagos_CancelarIE OrElse CancelacionPagos = OpcionesCancelacionPagos.ConPagos_GenerarIxC) - If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso AplicaCancelacionConPagos AndAlso ValorMultiplicador = -1 Then + If ObjFactura.TipoDocto.Contiene("Ing", "Rem", "Ant") AndAlso AplicaCancelacionConPagos AndAlso ValorMultiplicador = -1 Then Dim DtPagosVenta As DataTable = Nothing If ObjClientes IsNot Nothing Then diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 94b2ca4a3..7d49af125 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -27101,7 +27101,7 @@ Partial Class Ventas Dim CancelacionPagos = OpcionesCancelacionPagos.SinPagos - If (UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(382) = "1") AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("Ing", "Rem") AndAlso Not EsRefacturacion AndAlso ObjFacturaCancelacion.Pagado > 0 Then + If (UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(382) = "1") AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("Ing", "Rem", "Ant") AndAlso Not EsRefacturacion AndAlso ObjFacturaCancelacion.Pagado > 0 Then CancelacionPagos = OpcionesCancelacionPagos.ConPagos_CancelarIE End If From c2bde9a97ccc863e840d01495f0aacb1f1c75216 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Sat, 11 Jan 2025 01:48:19 -0700 Subject: [PATCH 07/10] =?UTF-8?q?GDiaz=20Pendientes=20de=20implementaci?= =?UTF-8?q?=C3=B3n=202025-01-10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsOC.vb | 3 +- App_Code/ClsVentas.vb | 10 +- Bancos/ProveedoresAbonar.aspx | 10 +- Bancos/ProveedoresAbonar.aspx.vb | 8 +- Inventarios/Kardex.aspx.vb | 2 +- Inventarios/KardexAlmacenHorizontal.aspx.vb | 18 ++- OC/OC.aspx.vb | 4 +- OC/RepOCxSurtir.aspx | 36 +++++ OC/RepOCxSurtir.aspx.vb | 163 +++++++++++++++++++- Ventas/Ventas.aspx.vb | 10 +- 10 files changed, 244 insertions(+), 20 deletions(-) diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index 19a737a7f..622e12946 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -2241,7 +2241,7 @@ Public Class ClsOC #End Region #Region " OC X VINCULAR COMPRA " - Public Function GetPendietePorSurtirOC(FechaI As String, FechaF As String, CveProveedor As Integer, Folio As Integer, CveSubProyecto As Integer, CveCliente As Integer, CveEmpresa As Integer, Optional CveOC As Integer = -1) As Boolean + Public Function GetPendietePorSurtirOC(FechaI As String, FechaF As String, CveProveedor As Integer, Folio As Integer, CveSubProyecto As Integer, CveCliente As Integer, CveEmpresa As Integer, Optional CveOC As Integer = -1, Optional Gpo As Integer = 1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OC_ComprasPendientesPorSurtirGet") @@ -2255,6 +2255,7 @@ Public Class ClsOC .Add("@FechaF", SqlDbType.VarChar).Value = FechaF .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveOC", SqlDbType.Int).Value = CveOC + .Add("@Gpo", SqlDbType.Int).Value = Gpo End With Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 18be4490a..837f097a5 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -602,7 +602,7 @@ Public Class ClsVentas Optional CveCliente As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional OrdenCompra As String = "-1", Optional RetIVA As Decimal = -1, Optional RetISR As Decimal = -1, Optional Kilometraje As Decimal = 0, Optional CveUsoCFDi As Integer = -1, Optional ServicioDomicilio As Boolean = False, Optional CveVendedor As Integer = -1, Optional RequiereOS As Boolean = False, Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1, Optional FechaParaSurtir As DateTime = MinFecha, - Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional CveCondicionEntrega As Integer = -1, Optional FolioRemision As String = "-1") As Boolean + Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional CveCondicionEntrega As Integer = -1, Optional FolioRemision As String = "-1", Optional CveUsuarioModifico As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUpdate") @@ -643,6 +643,7 @@ Public Class ClsVentas .Add("@Episodio", SqlDbType.VarChar).Value = Episodio .Add("@CveCondicionEntrega", SqlDbType.Int).Value = CveCondicionEntrega .Add("@FolioRemision", SqlDbType.VarChar).Value = FolioRemision + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico End With Try @@ -657,7 +658,7 @@ Public Class ClsVentas Public Function UpdateObservacionesVenta(CveVenta As Integer, CveEmpresa As Integer, CveVendedor As Integer, Observaciones As String, FormaPaqueteria As Integer, CorreoNotificaciones As String, ObservacionesAlm As String, Pedido As String, OrdenCompra As String, FechaPago As String, CveUsoCFDI As Integer, Optional DescripcionVenta As String = "-1", Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1, - Optional FechaParaSurtir As DateTime = MinFecha, Optional Paciente As String = "-1", Optional Episodio As String = "-1") As Boolean + Optional FechaParaSurtir As DateTime = MinFecha, Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional CveUsuarioModifico As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasObservacionesUpdate") With SqlAdapter.SelectCommand.Parameters @@ -678,6 +679,8 @@ Public Class ClsVentas .Add("@FechaParaSurtir", SqlDbType.DateTime).Value = FechaParaSurtir .Add("@Paciente", SqlDbType.VarChar).Value = Paciente .Add("@Episodio", SqlDbType.VarChar).Value = Episodio + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + End With Try @@ -835,12 +838,13 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean + Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date, CveUsuarioModifico As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasFechaVencimientoUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CveVenta", SqlDbType.Int).Value = CveVenta .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico End With Try SqlAdapter.Fill(Data) diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index ebd03c200..5f2389ec7 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -342,7 +342,9 @@ - + + + @@ -453,7 +455,7 @@ % Desc. - + @@ -789,6 +791,10 @@ } + function DescuenoMasivo(txt) { + $(".selDescuento").val(txt.value); + $(".selDescuento").trigger("keyup"); + } diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index d27e7066e..411c95aaa 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -324,6 +324,7 @@ Partial Class Bancos_ProveedoresAbonar If UsuarioActual.TienePermisoProceso(361) Then 'GvCxP.Columns(11).Visible = True chkaplicaDescuento.Visible = True + chkaplicaDescuentoMasivo.Visible = True End If @@ -1673,10 +1674,15 @@ Partial Class Bancos_ProveedoresAbonar GvCxP.Columns(11).Visible = chkaplicaDescuento.Checked UPCompras.Update() - End Sub + Protected Sub chkaplicaDescuentoMasivo_CheckedChanged(sender As Object, e As EventArgs) + + GvCxP.Columns(11).Visible = chkaplicaDescuentoMasivo.Checked + TxtDescuenoMasivo.Visible = chkaplicaDescuentoMasivo.Checked + UPCompras.Update() + End Sub Private Sub tmpValida() diff --git a/Inventarios/Kardex.aspx.vb b/Inventarios/Kardex.aspx.vb index ba1ff75c1..2605aa006 100644 --- a/Inventarios/Kardex.aspx.vb +++ b/Inventarios/Kardex.aspx.vb @@ -315,7 +315,7 @@ Partial Class Inventarios_Kardex End If Dim ObjOC As New ClsOC If ObjOC.PendientesCompra(ddlProducto2.SelectedValue.ToEntero, tCveSubProyectos, UsuarioActual.CveEmpresa) Then - GvOC.DataSource = ObjOC.DtResultados.Copy + GvOC.DataSource = ObjOC.DtResultados.Copy.FiltraParametros("", "Fecha Desc") LnkIndicador_OC.Text = ObjOC.DtResultados.Copy.SUM("CantidadPendienteVincular").ToString() End If ObjOC.Dispose() diff --git a/Inventarios/KardexAlmacenHorizontal.aspx.vb b/Inventarios/KardexAlmacenHorizontal.aspx.vb index 90f797949..9800d6589 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx.vb +++ b/Inventarios/KardexAlmacenHorizontal.aspx.vb @@ -9,9 +9,23 @@ Imports Telerik.Web.UI Partial Class Inventarios_KardexAlmacenHorizontal Inherits ClsPaginas + Private Property TienePermisoKardex As Boolean + Get + If ViewState("TienePermisoKardex") Is Nothing Then + ViewState("TienePermisoKardex") = False + End If + + Return Boolean.Parse(ViewState("TienePermisoKardex").ToString) + End Get + Set(value As Boolean) + ViewState("TienePermisoKardex") = value + End Set + End Property + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then 'TxtFechaI.Text = NowADS().AddMonths(-1).ToShortDateString + TienePermisoKardex = If(UsuarioActual.TienePermisoPagina(224), True, False) TxtFechaF.Text = NowADS().ToShortDateString CargaCombos() ddlAlmacen.Items.Insert(0, New ListItem("Todos", "-1")) @@ -241,7 +255,7 @@ Partial Class Inventarios_KardexAlmacenHorizontal Dim Celda As String = Cells.Text If IsNumeric(Celda) Then Dim CveAlmacen2 As Integer = -1 - If Index >= 5 Then + If Index >= 4 Then Dim Array As String() = GvDatos.HeaderRow.Cells(Index).Text.Split("|"c) If Array.Length > 1 Then CveAlmacen2 = Array(1).ToEntero @@ -270,7 +284,7 @@ Partial Class Inventarios_KardexAlmacenHorizontal Cells.Text = String.Format("{0:#,###.##}", Cells.Text.ToDecimal) Else Cells.Text = String.Format("{0:#,###.##}", Cells.Text.ToDecimal) - If Not e.Row.RowIndex = 0 And Ddlgrupo.SelectedValue.ToEntero = 1 Then + If Not e.Row.RowIndex = 0 And Ddlgrupo.SelectedValue.ToEntero = 1 AndAlso TienePermisoKardex Then Dim Liga2 As String = String.Format($"/Inventarios/Kardex.aspx?CvePS={e.Row.DataKey("CvePS")}&CveAlmacen={CveAlmacen2}&CveUM={DdlUnidadMedida.SelectedValue.ToEntero}&FechaI={txtFechaI.Text}&FechaF={TxtFechaF.Text}") Cells.Text = String.Format("{0}", Celda.FormatoNumero(), Liga2) End If diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 4b1cda15a..58d7d5db7 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -734,6 +734,7 @@ Partial Class OC_OC DdlSubProyectoGral.DataBind() DdlSubProyectoGral.Items.Insert(0, New ListItem("-", "-1")) DdlSubProyectoGral.SelectedValueExist(UsuarioActual.CveSubProyecto) + DdlSubProyectoEntrega.SelectedValueExist(UsuarioActual.CveSubProyecto) ModalidadSubProyectoGeneral = True TdProyectoSubPrpyectoDdl.Visible = False TdProyectoSubPrpyecto.Visible = False @@ -4117,7 +4118,8 @@ Partial Class OC_OC If e.Row.RowType = DataControlRowType.DataRow Then - If TienePermisoKardex AndAlso e.Row.RowState = DataControlRowState.Normal Then + 'If TienePermisoKardex AndAlso e.Row.RowState = DataControlRowState.Normal Then + If TienePermisoKardex AndAlso (e.Row.RowState = DataControlRowState.Normal Or e.Row.RowState = DataControlRowState.Alternate) Then e.Row.FCLabel("LblPS").Visible = False e.Row.FCHyperLink("HlPS").Visible = True e.Row.FCHyperLink("HLPS").NavigateUrl = $"../Inventarios/Kardex.aspx?CvePS={e.Row.DBCampo("CvePS").ToString}" diff --git a/OC/RepOCxSurtir.aspx b/OC/RepOCxSurtir.aspx index 148aeb4e3..447d01ca5 100644 --- a/OC/RepOCxSurtir.aspx +++ b/OC/RepOCxSurtir.aspx @@ -10,6 +10,22 @@ + + + +
  • + Generar PDF +
  • +
  • + Exportar Excel +
  • + +
    + + + + +
    @@ -57,6 +73,13 @@
    +
    Grupo:
    +
    + + Detallado + Por Orden de Compra + +
    @@ -84,6 +107,7 @@
    + @@ -95,6 +119,18 @@ + + + + + + + + + + + +
    diff --git a/OC/RepOCxSurtir.aspx.vb b/OC/RepOCxSurtir.aspx.vb index 5e0c376cc..1b4eafdc7 100644 --- a/OC/RepOCxSurtir.aspx.vb +++ b/OC/RepOCxSurtir.aspx.vb @@ -1,10 +1,41 @@ Option Explicit On Option Strict On +Imports System.Activities.Expressions +Imports System.Data Imports Extensiones +Imports Microsoft.Reporting.WebForms + + Partial Class OC_RepOCxSurtir Inherits ClsPaginas + + Property DtDatos As DataTable + Get + If ViewState("DtDatos") Is Nothing Then + ViewState("DtDatos") = New DataTable + End If + Return DirectCast(ViewState("DtDatos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtDatos") = value + End Set + End Property + + Property DtDatosPorOC As DataTable + Get + If ViewState("DtDatosPorOC") Is Nothing Then + ViewState("DtDatosPorOC") = New DataTable + End If + Return DirectCast(ViewState("DtDatosPorOC"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtDatosPorOC") = value + End Set + End Property + + Protected Sub OC_RepOCxSurtir_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then InicializaValores() @@ -71,20 +102,44 @@ Partial Class OC_RepOCxSurtir End Sub Private Sub CargaDatos() Dim ObjOC As New ClsOC + GvDatos.DataSource = Nothing + GvDatosPorOC.DataSource = Nothing + GvDatos.Visible = False + GvDatosPorOC.Visible = False + DtDatos = New DataTable + DtDatosPorOC = New DataTable Dim FechaI, FechaF As String FechaI = If(IsDate(TxtFechaI.Text.Trim()), TxtFechaI.Text.Trim(), "-1") FechaF = If(IsDate(TxtFechaF.Text.Trim()), TxtFechaF.Text.Trim(), "-1") - If ObjOC.GetPendietePorSurtirOC(FechaI, FechaF, DdlProveedor.SelectedValue.ToEntero, If(TxtFolio.Text = "", -1, TxtFolio.Text.ToEntero), DdlSubProyecto.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - GvDatos.DataSource = ObjOC.DtResultados - Else - GvDatos.DataSource = Nothing + If ObjOC.GetPendietePorSurtirOC(FechaI, FechaF, DdlProveedor.SelectedValue.ToEntero, If(TxtFolio.Text = "", -1, TxtFolio.Text.ToEntero), DdlSubProyecto.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, + Gpo:=DdlGrupo.SelectedValue.ToEntero) Then + + If DdlGrupo.SelectedValue.ToEntero = 1 Then + GvDatos.DataSource = ObjOC.DtResultados + DtDatos = ObjOC.DtResultados + GvDatos.Visible = True + Else + GvDatosPorOC.DataSource = ObjOC.DtResultados + DtDatosPorOC = ObjOC.DtResultados + GvDatosPorOC.Visible = True + End If + + End If - GvDatos.DataBind() ObjOC.Dispose() + If DdlGrupo.SelectedValue.ToEntero = 1 Then + GvDatos.DataBind() + Else + GvDatosPorOC.DataBind() + End If + + + UpDatos.Update() + End Sub Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound @@ -103,7 +158,105 @@ Partial Class OC_RepOCxSurtir End If End Sub + Private Sub GvDatosPorOC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosPorOC.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveOrdenCompra") = "" Then + e.Row.CssClass = "Totales" + 'e.Row.Cells(3).Visible = False + 'e.Row.Cells(2).ColumnSpan = 2 + 'ElseIf e.Row.DBCampo("CodigoPS") = "" Then + ' e.Row.CssClass = "SubTotales2" + Else + 'e.Row.Cells(0).Text = "" + 'e.Row.Cells(1).Text = "" + 'e.Row.Cells(2).Text = "" + End If + End If + End Sub + #End Region + +#Region " IMPRIMIR " + + Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + 'GvDatos.ExportToExcel("ReporteComprasDetalles" & NowADS().ToShortDateString) + GenerarPDF("EXCEL") + End Sub + + Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) + GenerarPDF("PDF") + End Sub + Private Sub GenerarPDF(Opcion As String) + Dim FechaI = If(TxtFechaI.Text = "" Or TxtFechaI.Text = "__/__/____", "-1", TxtFechaI.Text) + Dim FechaF = If(TxtFechaF.Text = "" Or TxtFechaF.Text = "__/__/____", "-1", TxtFechaF.Text) + 'Dim Proveedor = If(DdlProveedores.SelectedValue = "-1", "", $" Proveedor: {DdlProveedores.SelectedText}") + 'Dim Capturo = If(DDlUsuarioCaptura.SelectedValue = "-1", "", $" Capturó: {DDlUsuarioCaptura.SelectedItem.Text}") + Dim Grupo = DdlGrupo.SelectedItem.Text + Dim FechaIn As String = $" Fecha Inicio: {TxtFechaI.Text}" + Dim FechaFn As String = $" Fecha Fin: {TxtFechaF.Text}" + If TxtFechaI.Text = "" Then FechaIn = "" + If TxtFechaF.Text = "" Then FechaFn = "" + + 'Dim Proyecto = If(DdlProyecto.SelectedValue = "-1", "", $" Proyecto: {DdlProyecto.SelectedItem.Text}") + 'Dim SubProyecto = If(DdlSubProyecto.GetSelectedText = "", "", $" SubProyecto: {DdlSubProyecto.GetSelectedText}") + 'Dim TipoGasto = If(DdlTipoGasto.GetSelectedText = "", "", $" Tipo Gasto: {DdlTipoGasto.GetSelectedText}") + 'Dim TipoProveedor = If(DdlTipoProveedor.SelectedValue = "-1", "", $" Tipo de Proveedor: {DdlTipoProveedor.SelectedItem.Text}") + 'Dim TipoDocto = If(DdlTipoDocto.SelectedValue = "-1", "", $" Tipo de Documento: {DdlTipoDocto.SelectedItem.Text}") + + Dim FechaIF, FechaFF As String + FechaIF = If(IsDate(TxtFechaI.Text.Trim()), TxtFechaI.Text.Trim(), "-1") + FechaFF = If(IsDate(TxtFechaF.Text.Trim()), TxtFechaF.Text.Trim(), "-1") + Dim FechaICapturaF, FechaFCapturaF As String + 'FechaICapturaF = If(IsDate(TxtFechaICaptura.Text.Trim()), TxtFechaICaptura.Text.Trim(), "-1") + 'FechaFCapturaF = If(IsDate(TxtFechaFCaptura.Text.Trim()), TxtFechaFCaptura.Text.Trim(), "-1") + + 'Dim FechaCIn As String = $" Fecha Inicio Captura: {TxtFechaICaptura.Text.Trim()}" + 'Dim FechaCFn As String = $" Fecha Fin Captura: {TxtFechaFCaptura.Text.Trim()}" + + 'If Not IsDate(TxtFechaICaptura.Text.Trim()) Then FechaCIn = "" + 'If Not IsDate(TxtFechaFCaptura.Text.Trim()) Then FechaCFn = "" + + If DdlGrupo.SelectedValue.ToEntero = 1 Then + + Else + + End If + + If (DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 AndAlso DdlGrupo.SelectedValue.ToEntero = 1) Or (DtDatosPorOC IsNot Nothing AndAlso DtDatosPorOC.Rows.Count > 0 AndAlso DdlGrupo.SelectedValue.ToEntero = 2) Then + + 'For Each Dr As DataRow In DtDatos.Rows + ' Dr("Fecha") = Dr("Fecha").ToString.ToDate.ToShortDateString + 'Next + + Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("FechaInicio", FechaI)) + params.Add(New ReportParameter("FechaFin", FechaF)) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", NowADS().ToString)) + params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {Grupo}{FechaIn}{FechaFn}")) + params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) + + Dim NombreArchivo As String = If(DdlGrupo.SelectedValue.ToEntero = 1, "RepOCxSurtir.rdlc", "RepOCxSurtirPorOC.rdlc") + + Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)) + If Archivo.Exists Then + ImprimirPDF(Archivo.FullName, If(DdlGrupo.SelectedValue.ToEntero = 1, DtDatos, DtDatosPorOC), params, "OrdenesdeCompraporvincular ", Opcion) + Else + ImprimirPDF($"Empresas/Grales/Formatos/{NombreArchivo}", If(DdlGrupo.SelectedValue.ToEntero = 1, DtDatos, DtDatosPorOC), params, "OrdenesdeCompraporvincular", Opcion) + End If + + Else + Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) + End If + + End Sub +#End Region + + End Class diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 7d49af125..2ce45e6cc 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -24153,7 +24153,8 @@ Partial Class Ventas CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(), TipoDocto:=DdlTipoComprobante.SelectedValue, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=TxtKilometraje.Text.ToDecimal, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), ServicioDomicilio:=TrServicioDomicilio.Visible, CveMedico:=DdlMedico.SelectedValue.ToEntero, CveProcedimiento:=DdlProcedimiento.SelectedValue.ToEntero, - FechaParaSurtir:=FechaParaSurtir, Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveCondicionEntrega:=DdlFormaEntrega.SelectedValue.ToEntero(), FolioRemision:=TxtFolioRemision.Text.Trim) Then + FechaParaSurtir:=FechaParaSurtir, Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveCondicionEntrega:=DdlFormaEntrega.SelectedValue.ToEntero(), FolioRemision:=TxtFolioRemision.Text.Trim, + CveUsuarioModifico:=UsuarioActual.CveUsuario) Then OcurrioError = True End If @@ -33367,7 +33368,8 @@ Partial Class Ventas Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1), PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim.ToUpper(), CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(), CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, - TipoDocto:=DdlTipoComprobante.SelectedValue, Kilometraje:=TxtKilometraje.Text.ToDecimal, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero()) Then + TipoDocto:=DdlTipoComprobante.SelectedValue, Kilometraje:=TxtKilometraje.Text.ToDecimal, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), + CveUsuarioModifico:=UsuarioActual.CveUsuario) Then MensajeError = "Ocurrió un error al actualizar la información de la cotización" OcurrioError = True End If @@ -35365,7 +35367,7 @@ Partial Class Ventas Exit Sub End If - If Not ObjVentas.UpdateFechaVencimientoVenta(CveVenta, TxtFechaPago.Text.ToDate) Then + If Not ObjVentas.UpdateFechaVencimientoVenta(CveVenta, TxtFechaPago.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorTrans = True End If @@ -36876,7 +36878,7 @@ Partial Class Ventas If Not ObjVentas.UpdateObservacionesVenta(Me.CveVenta, UsuarioActual.CveEmpresa, DdlVendedor.SelectedValue.ToEntero(), TxtObsFact.Text, RblPaqueteria.SelectedValue.ToEntero(), TxtCorreoNotificaciones.Text, TxtObsAlmacen.Text, TxtPedidoContrato.Text, TxtOrdenCompra.Text, TxtFechaPago.Text, DdlUsoCFDI.SelectedValue.ToEntero, DescripcionVenta:=TxtDescripcionVenta.Text.Trim, CveMedico:=DdlMedico.SelectedValue.ToEntero, CveProcedimiento:=DdlProcedimiento.SelectedValue.ToEntero, FechaParaSurtir:=FechaParaSurtir, Paciente:=TxtPaciente.Text, - Episodio:=TxtEpisodio.Text) Then + Episodio:=TxtEpisodio.Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then TieneError = True End If From 86f9e51e10f845c187a640f86d0557c7a64ce609 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 11 Jan 2025 10:31:48 -0700 Subject: [PATCH 08/10] --FIX modificacion de precios --- Ventas/Ventas.aspx.vb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 7d49af125..4931f8297 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9227,12 +9227,17 @@ Partial Class Ventas End If End If + If RecalcularPromociones Then ObjDescuento = CalcularDescuentos(CvePSNuevo, Cantidad, PU) - Dim RegenerarPU As Boolean = False If ObjDescuento.EsPUModificado Then - PU = ObjDescuento.PU + 'SI ES IMPORTE ASIGNADO ES MAYOR, RESPETAR EL ORIGINAL + If GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Enabled AndAlso (GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal() > ObjDescuento.PU) Then + PU = GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal() + Else + PU = ObjDescuento.PU + End If End If End If From 9cd88d4dd7b192540395b12303a1e03b29cdd72b Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 11 Jan 2025 12:20:40 -0700 Subject: [PATCH 09/10] --FIX validacion de monedas --- Ventas/Ventas.aspx.vb | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index b4309807a..bc0175850 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9252,7 +9252,7 @@ Partial Class Ventas Exit Sub End If - If Not ValidaAgregarPS(Cantidad, CvePSNuevo, DdlUM.SelectedValue.ToEntero(), PU, DrProducto("CveTipoPS").ToString().ToEntero(), DdlCla.SelectedValue.ToEntero(), DdlSubProyectoDatos.SelectedValue.ToEntero(), ObjDescuento, CantidadOriginal:=CantidadOriginal) Then + If Not ValidaAgregarPS(Cantidad, CvePSNuevo, DdlUM.SelectedValue.ToEntero(), PU, DrProducto("CveTipoPS").ToString().ToEntero(), DdlCla.SelectedValue.ToEntero(), DdlSubProyectoDatos.SelectedValue.ToEntero(), ObjDescuento, CantidadOriginal:=CantidadOriginal, EsEdicion:=True) Then Exit Sub End If @@ -19529,7 +19529,7 @@ Partial Class Ventas Protected Sub LbAgregar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LbAgregar.Click AgregarPS() End Sub - Private Function ValidaAgregarPS(Cantidad As Decimal, CvePS As Integer, CveUM As Integer, PU As Double, CveTipoPS As Integer, CveClasificacion As Integer, CveSubProyecto As Integer, ObjDescuento As Modelos.VentaDescuentos, Optional CantidadModal As Decimal = 0D, Optional PSValidarModal As String = "", Optional CantidadOriginal As Decimal = 0D) As Boolean 'NO TOCAR - IPP + Private Function ValidaAgregarPS(Cantidad As Decimal, CvePS As Integer, CveUM As Integer, PU As Double, CveTipoPS As Integer, CveClasificacion As Integer, CveSubProyecto As Integer, ObjDescuento As Modelos.VentaDescuentos, Optional CantidadModal As Decimal = 0D, Optional PSValidarModal As String = "", Optional CantidadOriginal As Decimal = 0D, Optional EsEdicion As Boolean = False) As Boolean 'NO TOCAR - IPP 'VALIDA PARAMETROS If CvePS <= 0 Or CveUM <= 0 Then @@ -19616,17 +19616,34 @@ Partial Class Ventas ' Return False 'End If + Dim ValidarMonedas As Boolean = False + 'SI NO TIENE LA FUNCIONALIDAD VALIDARA LAS MONEDAS If UsuarioActual.Empresa.Funcionalidad(524) <> "" Then - If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count >= 1 Then - Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0) - If DrPS IsNot Nothing Then - If DrPS("CveMoneda").ToString.ToEntero() <> DdlMoneda.SelectedValue.ToEntero() Then - Alert("No puede agregar un producto de diferente moneda a la ya seleccionada", TipoMensaje.MsgAdvertencia) - Return False + ValidarMonedas = True + + 'MODALIDAD EDICION + If EsEdicion Then + ValidarMonedas = False + End If + + 'REFACTURACION + If NuevaFactura = 1 Then + ValidarMonedas = False + End If + + If ValidarMonedas Then + If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count >= 1 Then + Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0) + If DrPS IsNot Nothing Then + If DrPS("CveMoneda").ToString.ToEntero() <> DdlMoneda.SelectedValue.ToEntero() Then + Alert("No puede agregar un producto de diferente moneda a la ya seleccionada", TipoMensaje.MsgAdvertencia) + Return False + End If End If End If End If + End If ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR From 04b18d79cc816dc96d2fcffef8307a054ca7b06d Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 11 Jan 2025 14:13:01 -0700 Subject: [PATCH 10/10] Mostrar las solicitudes de anticipo en autorizaciones --- App_Code/ClsMovimientos.vb | 21 ++++ Ventas/CatAutorizacionLimites.aspx | 155 +++++++++++++++++++------- Ventas/CatAutorizacionLimites.aspx.vb | 135 ++++++++++++++++++++++ 3 files changed, 269 insertions(+), 42 deletions(-) diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index c48d73aee..68de58744 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -521,6 +521,27 @@ Public Class ClsMovimientos OnError("Ocurrió un error al consultar los Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try + Return Retorno + End Function + + Public Function GetAnticiposNCIxCAutorizaciones(CveCliente As Integer, CveEmpresa As Integer, FechaI As DateTime, FechaF As DateTime) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ClienteAnticiposNCIxCAutorizaciones") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaI", SqlDbType.DateTime).Value = FechaI + .Add("@FechaF", SqlDbType.DateTime).Value = FechaF + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los autorizaciones de anticipos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno End Function Public Function GetRemisionesNCCliente(CveCliente As Integer, MostarDetalle As Boolean, Optional CveMoneda As Integer = -1, Optional CveClienteSucursal As Integer = -1) As Boolean diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx index f935dd655..43d8496b1 100644 --- a/Ventas/CatAutorizacionLimites.aspx +++ b/Ventas/CatAutorizacionLimites.aspx @@ -104,48 +104,119 @@ - - - - - - - - - - - - - - - <%-- 30--%> - - - - - - - - <%-- 45--%> - - - - - - - - - - - - - - - - - +
    +
    +
    + Solicitudes de autorizaciones +
    +
    +
    +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + <%-- 30--%> + + + + + + + + <%-- 45--%> + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + Anticipos, notas de crédito e ingresos por comprobar +
    +
    +
    +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +