This commit is contained in:
2025-01-13 06:59:57 -07:00
17 changed files with 759 additions and 163 deletions

View File

@@ -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
@@ -9224,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
@@ -9244,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
@@ -19503,7 +19511,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
@@ -19590,17 +19598,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
@@ -23989,22 +24014,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()
@@ -24121,7 +24157,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
@@ -27069,7 +27106,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
@@ -33184,22 +33221,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()
@@ -33324,7 +33372,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
@@ -35322,7 +35371,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
@@ -36833,7 +36882,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
@@ -37750,7 +37799,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
@@ -37765,33 +37814,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 = "<br/> <a target='_blank' href='https://www.w3schools.com'>La autorización se agregó correctamente.</a>"
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 = "<br/> <a target='_blank' href='https://www.w3schools.com'>La autorización se agregó correctamente.</a>"
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