-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
+
+
+
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 868a61171..28caab902 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -8295,6 +8295,16 @@ Partial Class Compras_Compras
End If
End If
Next
+
+ For Each Gvr As GridViewRow In GVNCInvAlmacen.Rows
+ If Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDouble > 0 Then
+ If Not ObjCompras.ComprasDetalleDevolucionesAdd(Gvr.DataKey("CveCompraDetalle").ToEntero, CveCompra, Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDouble, UsuarioActual.CveEmpresa) Then
+ ErrorMovInv = True
+ Exit For
+ End If
+ End If
+ Next
+
End If
@@ -18816,6 +18826,7 @@ Partial Class Compras_Compras
HLAplicaNCFact.Visible = True
LblTotalNC.Text = TxtTotal.Text.FormatoNumero
CargaCuentasXPagar()
+ TabModoNC_ActiveTabChanged(TabModoNC, EventArgs.Empty)
End Sub
Private Sub CargaCuentasXPagar()
@@ -18949,6 +18960,9 @@ Partial Class Compras_Compras
ChkNCInv.Visible = True
GVNCInv.DataSource = DtPendientesAlmacen
GVNCInv.DataBind()
+
+ GVNCInvAlmacen.DataSource = DtPendientesAlmacen
+ GVNCInvAlmacen.DataBind()
End If
End If
@@ -18978,20 +18992,22 @@ Partial Class Compras_Compras
SaldoAnticipo += gvr.FCTextBox("TxtAnticipo").Text.ToDouble
End If
Next
+
+ If SaldoAnticipo <= 0 Then
+ Alert("No hay movimientos seleccionados para aplicar", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
End If
- If SaldoAnticipo <= 0 Then
- Alert("No hay movimientos seleccionados para aplicar", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
-
LbNCInvSaldo.Text = SaldoAnticipo.FormatoNumero()
+ LbNCInvSaldoAlmacen.Text = SaldoAnticipo.FormatoNumero()
If ChkNCInvNC.Checked Then
Dim ObjInventarios As New ClsInventarios
- If ObjInventarios.RecepcionAlmacenGet(-1, -1, UsuarioActual.CveEmpresa, CveProveedor) AndAlso ObjInventarios.DtResultados.FiltraParametros($"CveCompra IN ({CveCompras}) AND CantidadF > 0").Rows.Count > 0 Then
- DtPendientesAlmacen = ObjInventarios.DtResultados.FiltraParametros($"CveCompra IN ({CveCompras}) AND CantidadF > 0").Copy
+ If ObjInventarios.RecepcionAlmacenGet(-1, -1, UsuarioActual.CveEmpresa, CveProveedor) AndAlso ObjInventarios.DtResultados.FiltraParametros($"CantidadF > 0").Rows.Count > 0 Then
+ DtPendientesAlmacen = ObjInventarios.DtResultados.FiltraParametros($"CantidadF > 0").Copy
End If
ObjInventarios.Dispose()
End If
@@ -19000,10 +19016,12 @@ Partial Class Compras_Compras
If ChkNCInvNC.Checked Then
GVNCInv.DataSource = DtPendientesAlmacen
GVNCInv.DataBind()
- UpNCInv.Update()
- RegistraScript("$('#FacturaNC').modal('hide');", "FacturaNC")
+
+ GVNCInvAlmacen.DataSource = DtPendientesAlmacen
+ GVNCInvAlmacen.DataBind()
+
End If
- RegistraScript("$('#ModalNCInv').modal('show');", "ModalNCInv")
+
Else
If ChkNCInvNC.Checked Then
Alert("Niguna de las facturas seleccionadas cuenta con productos pendientes de darles entrada.", TipoMensaje.MsgAdvertencia)
@@ -19016,14 +19034,22 @@ Partial Class Compras_Compras
End If
UpNCInv.Update()
+ UpFacturaNC.Update()
End Sub
+
Protected Sub GVNCInv_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVNCInv.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'e.Row.FCCheckBox("cbInv").Attributes.Add("onclick", "FnCambiaInvNC(this);")
e.Row.FCTextBox("TxtCantidadNCInv").Attributes.Add("onkeyup", $"ValidarCantidad(this,{e.Row.DBCampo("CantidadF")});FnCambiaInvNC(this);")
End If
End Sub
+ Protected Sub GVNCInvAlmacen_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVNCInvAlmacen.RowDataBound
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ 'e.Row.FCCheckBox("cbInv").Attributes.Add("onclick", "FnCambiaInvNC(this);")
+ e.Row.FCTextBox("TxtCantidadNCInv").Attributes.Add("onkeyup", $"ValidarCantidad(this,{e.Row.DBCampo("CantidadF")});FnCambiaInvNC(this);")
+ End If
+ End Sub
Protected Sub BtnNCInv_Click(sender As Object, e As EventArgs)
If ChkNCInvNC.Checked Then
@@ -19081,6 +19107,34 @@ Partial Class Compras_Compras
Protected Sub BtnNCConfirmacion_Click(sender As Object, e As EventArgs)
GuardaAnticipos(Nothing, Nothing)
End Sub
+
+ Protected Sub BtnNCInvAlmacen_Click(sender As Object, e As EventArgs)
+
+ 'Dim ObjCompras As New ClsCompras
+ 'Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL)
+ 'Dim TieneError = False
+
+ 'For Each Gvr As GridViewRow In GVNCInvAlmacen.Rows
+ ' If Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDouble > 0 Then
+ ' If Not ObjCompras.ComprasDetalleDevolucionesAdd(Gvr.DataKey("CveCompraDetalle").ToEntero, Gvr.DataKey("CveCompra").ToEntero, Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDouble, UsuarioActual.CveEmpresa) Then
+ ' TieneError = True
+ ' Exit For
+ ' End If
+ ' End If
+ 'Next
+
+ 'If Not TieneError Then
+ ' Alert("Se guardo la devolución correctamente", TipoMensaje.MsgInformacion)
+ ' ObjCompras.Commit()
+ 'Else
+ ' Alert("Ocurrió un error al guardar la devolución", TipoMensaje.MsgError)
+ ' ObjCompras.RollBack()
+ 'End If
+
+ 'ObjCompras.Dispose()
+ RegistraScript("$('#FacturaNC').modal('hide');", "ModalNCInv")
+
+ End Sub
#End Region
#Region " INVENTARIO: MOVIMIENTOS DE LA COMPRA "
@@ -20228,6 +20282,10 @@ Partial Class Compras_Compras
Protected Sub BtnFacturaNC_Click(sender As Object, e As EventArgs)
If ChkNCInvNC.Checked Then
CargaNCINV()
+
+ TabModoNC.ActiveTabIndex = 1
+ TabModoNC_ActiveTabChanged(TabModoNC, EventArgs.Empty)
+ UpFacturaNC.Update()
Else
RegistraScript("$('#FacturaNC').modal('hide');", "FacturaNC")
End If
@@ -20721,6 +20779,20 @@ Partial Class Compras_Compras
End Sub
+ Protected Sub TabModoNC_ActiveTabChanged(sender As Object, e As EventArgs)
+ Select Case TabModoNC.ActiveTabIndex
+ Case 0
+ BtnFacturaNC.Visible = True
+ BtnNCInvAlmacen.Visible = False
+ TabNCAlmacen.Enabled = False
+ Case 1
+ BtnFacturaNC.Visible = False
+ BtnNCInvAlmacen.Visible = True
+ TabNCAlmacen.Enabled = True
+ End Select
+
+ UpFooterFacturaNC.Update()
+ End Sub
End Class
Public Class MMensajeDevolucion
diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb
index b39460360..99cd97ad1 100644
--- a/Compras/PopUpVerFactura.aspx.vb
+++ b/Compras/PopUpVerFactura.aspx.vb
@@ -1152,6 +1152,29 @@ Partial Class PopUpVerFactura
Vta.DtDocumentosRelacionados = ObjVentas.DtResultados.FiltraParametros("FolioFiscal IS NOT NULL")
End If
+ End If
+
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso (Vta.DtDocumentosRelacionados Is Nothing OrElse Vta.DtDocumentosRelacionados.Rows.Count = 0) Then
+ If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa) Then
+ Vta.DtNCVinculadas = ObjVentas.DtResultados
+ Vta.DtDocumentosRelacionados = ObjVentas.DtResultados '.FiltraParametros("FolioFiscal IS NOT NULL")
+ If Vta.DtDocumentosRelacionados.Rows.Count > 0 Then
+ If Vta.TipoDocto.Contiene("Ing") Then
+ Vta.Timbre.CFDIRelacionados.TipoRelacion = "01"
+ Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso"
+ End If
+
+ If Vta.TipoDocto.Contiene("Egs") Then
+ Vta.Timbre.CFDIRelacionados.TipoRelacion = "01"
+ Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso"
+ End If
+
+ If Vta.TipoDocto.Contiene("Dev") Then
+ Vta.Timbre.CFDIRelacionados.TipoRelacion = "03"
+ Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso"
+ End If
+ End If
+ End If
End If
End If
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 1af853887..795ac6f44 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -3981,7 +3981,7 @@ Partial Class Ventas
Dim TipoEstatus As Integer = GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {CveEstatus}").ToEntero()
- If UsuarioActual.Empresa.Funcionalidad(135) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso TipoEstatus = 5 Then
+ If UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso TipoEstatus = 5 Then
If UsuarioActual.TienePermisoProceso(159) Then
Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto")))
If TienePermiso <> "" Then
@@ -4087,7 +4087,7 @@ Partial Class Ventas
End If
-
+ 'SI LA AUTORIZACION ES POR SUPERVISOR, BUSCA EL SUPERVISOR QUE TIENE EL VENDEDOR
If UsuarioActual.Empresa.Funcionalidad(135) = "1" Then
'Reviso cuales son los supervisores
Dim Objeto As New ClsVtaVendedores
@@ -4104,7 +4104,7 @@ Partial Class Ventas
If TipoEstatus = 2 Then
LkCotizacionAutorizar.Visible = False
- ElseIf TipoEstatus = 2 Then
+ ElseIf TipoEstatus = 5 Then
LkCotizacionAutorizar.Visible = False
End If
End If
@@ -4113,8 +4113,18 @@ Partial Class Ventas
Objeto.Dispose()
End If
- String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())
-
+ 'SI LA AUTORIZACION ES POR PERMISO, BUSCA QUE EL USUARIO TENGA EL PERMISO PARA AUTORIZAR
+ If UsuarioActual.Empresa.Funcionalidad(135) = "2" Then
+ 'Reviso cuales son los supervisores
+ If UsuarioActual.TienePermisoProceso(116) Then
+ LkCotizacionAutorizar.Visible = True
+ If TipoEstatus = 2 Then
+ LkCotizacionAutorizar.Visible = False
+ ElseIf TipoEstatus = 5 Then
+ LkCotizacionAutorizar.Visible = False
+ End If
+ End If
+ End If
Case "Ant"
Trsaldo.Visible = True
@@ -4872,30 +4882,47 @@ Partial Class Ventas
'Verifico si tiene la funcionalidad (135)
- If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135) = "1" Then
- 'Reviso cuales son los supervisores
- Dim ObjVendedores As New ClsVtaVendedores
+ If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") Then
- If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then
- Dim DTVendedores As New DataTable
- If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then
- DTVendedores = ObjVendedores.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor))
- End If
+ Select Case UsuarioActual.Empresa.Funcionalidad(135)
+ Case "1" ' POR SUPERVISOR
+ Dim ObjVendedores As New ClsVtaVendedores
- 'Verifico si es su supervisor asignado
- If DTVendedores.Rows.Count > 0 Then
- If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then
- BtnsFacturar.Visible = True
- BtnGenerarRemision.Visible = True
- Else
- BtnsFacturar.Visible = False
- BtnGenerarRemision.Visible = False
+ If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then
+ Dim DTVendedores As New DataTable
+ If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then
+ DTVendedores = ObjVendedores.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor))
+ End If
+
+ 'Verifico si es su supervisor asignado
+ If DTVendedores.Rows.Count > 0 Then
+ If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then
+ BtnsFacturar.Visible = True
+ BtnGenerarRemision.Visible = True
+ Else
+ BtnsFacturar.Visible = False
+ BtnGenerarRemision.Visible = False
+ End If
+ End If
+
+ DTVendedores.Dispose()
End If
- End If
+ ObjVendedores.Dispose()
+
+ Case "2" ' POR PERMISO
+ If UsuarioActual.TienePermisoProceso(116) Then
+ If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then
+ BtnsFacturar.Visible = True
+ BtnGenerarRemision.Visible = True
+ Else
+ BtnsFacturar.Visible = False
+ BtnGenerarRemision.Visible = False
+ End If
+ End If
+
+ End Select
+
- DTVendedores.Dispose()
- End If
- ObjVendedores.Dispose()
End If
If DdlTipoComprobante.SelectedValue = "Cot" Then
@@ -10131,6 +10158,8 @@ Partial Class Ventas
End If
End If
+ tPS = tPS.Replace("|", " ")
+
If tPS.Length >= 1000 Then
Dim tPSRecortado = tPS.Remove(999, tPS.Length - 999)
tPS = tPSRecortado
@@ -15478,7 +15507,7 @@ Partial Class Ventas
TrAlmacenAsignado.Visible = False
TrAlmacenOrigen.Visible = False
- If DdlTipoComprobante.SelectedValue = "Cot" And UsuarioActual.Empresa.Funcionalidad(135) = "1" Then
+ If DdlTipoComprobante.SelectedValue = "Cot" And UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") Then
Alert("Se ocupa una autorización.", TipoMensaje.MsgAdvertencia)
TrDireccion.Visible = False
TrCiudad.Visible = False
@@ -21210,8 +21239,14 @@ Partial Class Ventas
ObjVentas.Dispose()
If ActualizoEstatus Then
- 'GeneraPDFCotizacion(True)
- Alert("La cotización ha sido enviada al correo de nuestro cliente:" & Mail)
+
+ If UsuarioActual.Empresa.Funcionalidad(135) = "1" Then
+ GeneraPDFCotizacion(True)
+ Alert("La cotización ha sido enviada al correo de nuestro cliente:" & Mail)
+ ElseIf UsuarioActual.Empresa.Funcionalidad(135) = "2" Then
+ Alert("La cotización ha sido autorizada.")
+ End If
+
Else
Alert("No se pudo autorizar la cotización", TipoMensaje.MsgError)
End If