This commit is contained in:
Antonio Gonzalez
2021-01-09 13:07:21 -07:00
4 changed files with 5514 additions and 5252 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -8295,6 +8295,16 @@ Partial Class Compras_Compras
End If End If
End If End If
Next 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 End If
@@ -18816,6 +18826,7 @@ Partial Class Compras_Compras
HLAplicaNCFact.Visible = True HLAplicaNCFact.Visible = True
LblTotalNC.Text = TxtTotal.Text.FormatoNumero LblTotalNC.Text = TxtTotal.Text.FormatoNumero
CargaCuentasXPagar() CargaCuentasXPagar()
TabModoNC_ActiveTabChanged(TabModoNC, EventArgs.Empty)
End Sub End Sub
Private Sub CargaCuentasXPagar() Private Sub CargaCuentasXPagar()
@@ -18949,6 +18960,9 @@ Partial Class Compras_Compras
ChkNCInv.Visible = True ChkNCInv.Visible = True
GVNCInv.DataSource = DtPendientesAlmacen GVNCInv.DataSource = DtPendientesAlmacen
GVNCInv.DataBind() GVNCInv.DataBind()
GVNCInvAlmacen.DataSource = DtPendientesAlmacen
GVNCInvAlmacen.DataBind()
End If End If
End If End If
@@ -18978,20 +18992,22 @@ Partial Class Compras_Compras
SaldoAnticipo += gvr.FCTextBox("TxtAnticipo").Text.ToDouble SaldoAnticipo += gvr.FCTextBox("TxtAnticipo").Text.ToDouble
End If End If
Next Next
If SaldoAnticipo <= 0 Then
Alert("No hay movimientos seleccionados para aplicar", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
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() LbNCInvSaldo.Text = SaldoAnticipo.FormatoNumero()
LbNCInvSaldoAlmacen.Text = SaldoAnticipo.FormatoNumero()
If ChkNCInvNC.Checked Then If ChkNCInvNC.Checked Then
Dim ObjInventarios As New ClsInventarios 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 If ObjInventarios.RecepcionAlmacenGet(-1, -1, UsuarioActual.CveEmpresa, CveProveedor) AndAlso ObjInventarios.DtResultados.FiltraParametros($"CantidadF > 0").Rows.Count > 0 Then
DtPendientesAlmacen = ObjInventarios.DtResultados.FiltraParametros($"CveCompra IN ({CveCompras}) AND CantidadF > 0").Copy DtPendientesAlmacen = ObjInventarios.DtResultados.FiltraParametros($"CantidadF > 0").Copy
End If End If
ObjInventarios.Dispose() ObjInventarios.Dispose()
End If End If
@@ -19000,10 +19016,12 @@ Partial Class Compras_Compras
If ChkNCInvNC.Checked Then If ChkNCInvNC.Checked Then
GVNCInv.DataSource = DtPendientesAlmacen GVNCInv.DataSource = DtPendientesAlmacen
GVNCInv.DataBind() GVNCInv.DataBind()
UpNCInv.Update()
RegistraScript("$('#FacturaNC').modal('hide');", "FacturaNC") GVNCInvAlmacen.DataSource = DtPendientesAlmacen
GVNCInvAlmacen.DataBind()
End If End If
RegistraScript("$('#ModalNCInv').modal('show');", "ModalNCInv")
Else Else
If ChkNCInvNC.Checked Then If ChkNCInvNC.Checked Then
Alert("Niguna de las facturas seleccionadas cuenta con productos pendientes de darles entrada.", TipoMensaje.MsgAdvertencia) 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 End If
UpNCInv.Update() UpNCInv.Update()
UpFacturaNC.Update()
End Sub End Sub
Protected Sub GVNCInv_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVNCInv.RowDataBound Protected Sub GVNCInv_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVNCInv.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
'e.Row.FCCheckBox("cbInv").Attributes.Add("onclick", "FnCambiaInvNC(this);") 'e.Row.FCCheckBox("cbInv").Attributes.Add("onclick", "FnCambiaInvNC(this);")
e.Row.FCTextBox("TxtCantidadNCInv").Attributes.Add("onkeyup", $"ValidarCantidad(this,{e.Row.DBCampo("CantidadF")});FnCambiaInvNC(this);") e.Row.FCTextBox("TxtCantidadNCInv").Attributes.Add("onkeyup", $"ValidarCantidad(this,{e.Row.DBCampo("CantidadF")});FnCambiaInvNC(this);")
End If End If
End Sub 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) Protected Sub BtnNCInv_Click(sender As Object, e As EventArgs)
If ChkNCInvNC.Checked Then If ChkNCInvNC.Checked Then
@@ -19081,6 +19107,34 @@ Partial Class Compras_Compras
Protected Sub BtnNCConfirmacion_Click(sender As Object, e As EventArgs) Protected Sub BtnNCConfirmacion_Click(sender As Object, e As EventArgs)
GuardaAnticipos(Nothing, Nothing) GuardaAnticipos(Nothing, Nothing)
End Sub 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 #End Region
#Region " INVENTARIO: MOVIMIENTOS DE LA COMPRA " #Region " INVENTARIO: MOVIMIENTOS DE LA COMPRA "
@@ -20228,6 +20282,10 @@ Partial Class Compras_Compras
Protected Sub BtnFacturaNC_Click(sender As Object, e As EventArgs) Protected Sub BtnFacturaNC_Click(sender As Object, e As EventArgs)
If ChkNCInvNC.Checked Then If ChkNCInvNC.Checked Then
CargaNCINV() CargaNCINV()
TabModoNC.ActiveTabIndex = 1
TabModoNC_ActiveTabChanged(TabModoNC, EventArgs.Empty)
UpFacturaNC.Update()
Else Else
RegistraScript("$('#FacturaNC').modal('hide');", "FacturaNC") RegistraScript("$('#FacturaNC').modal('hide');", "FacturaNC")
End If End If
@@ -20721,6 +20779,20 @@ Partial Class Compras_Compras
End Sub 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 End Class
Public Class MMensajeDevolucion Public Class MMensajeDevolucion

View File

@@ -1152,6 +1152,29 @@ Partial Class PopUpVerFactura
Vta.DtDocumentosRelacionados = ObjVentas.DtResultados.FiltraParametros("FolioFiscal IS NOT NULL") Vta.DtDocumentosRelacionados = ObjVentas.DtResultados.FiltraParametros("FolioFiscal IS NOT NULL")
End If 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
End If End If

View File

@@ -3981,7 +3981,7 @@ Partial Class Ventas
Dim TipoEstatus As Integer = GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {CveEstatus}").ToEntero() 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 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"))) Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto")))
If TienePermiso <> "" Then If TienePermiso <> "" Then
@@ -4087,7 +4087,7 @@ Partial Class Ventas
End If End If
'SI LA AUTORIZACION ES POR SUPERVISOR, BUSCA EL SUPERVISOR QUE TIENE EL VENDEDOR
If UsuarioActual.Empresa.Funcionalidad(135) = "1" Then If UsuarioActual.Empresa.Funcionalidad(135) = "1" Then
'Reviso cuales son los supervisores 'Reviso cuales son los supervisores
Dim Objeto As New ClsVtaVendedores Dim Objeto As New ClsVtaVendedores
@@ -4104,7 +4104,7 @@ Partial Class Ventas
If TipoEstatus = 2 Then If TipoEstatus = 2 Then
LkCotizacionAutorizar.Visible = False LkCotizacionAutorizar.Visible = False
ElseIf TipoEstatus = 2 Then ElseIf TipoEstatus = 5 Then
LkCotizacionAutorizar.Visible = False LkCotizacionAutorizar.Visible = False
End If End If
End If End If
@@ -4113,8 +4113,18 @@ Partial Class Ventas
Objeto.Dispose() Objeto.Dispose()
End If 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" Case "Ant"
Trsaldo.Visible = True Trsaldo.Visible = True
@@ -4872,30 +4882,47 @@ Partial Class Ventas
'Verifico si tiene la funcionalidad (135) 'Verifico si tiene la funcionalidad (135)
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135) = "1" Then If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") Then
'Reviso cuales son los supervisores
Dim ObjVendedores As New ClsVtaVendedores
If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then Select Case UsuarioActual.Empresa.Funcionalidad(135)
Dim DTVendedores As New DataTable Case "1" ' POR SUPERVISOR
If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then Dim ObjVendedores As New ClsVtaVendedores
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 ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then
If DTVendedores.Rows.Count > 0 Then Dim DTVendedores As New DataTable
If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then
BtnsFacturar.Visible = True DTVendedores = ObjVendedores.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor))
BtnGenerarRemision.Visible = True End If
Else
BtnsFacturar.Visible = False 'Verifico si es su supervisor asignado
BtnGenerarRemision.Visible = False 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
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 End If
If DdlTipoComprobante.SelectedValue = "Cot" Then If DdlTipoComprobante.SelectedValue = "Cot" Then
@@ -10131,6 +10158,8 @@ Partial Class Ventas
End If End If
End If End If
tPS = tPS.Replace("|", " ")
If tPS.Length >= 1000 Then If tPS.Length >= 1000 Then
Dim tPSRecortado = tPS.Remove(999, tPS.Length - 999) Dim tPSRecortado = tPS.Remove(999, tPS.Length - 999)
tPS = tPSRecortado tPS = tPSRecortado
@@ -15478,7 +15507,7 @@ Partial Class Ventas
TrAlmacenAsignado.Visible = False TrAlmacenAsignado.Visible = False
TrAlmacenOrigen.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) Alert("Se ocupa una autorización.", TipoMensaje.MsgAdvertencia)
TrDireccion.Visible = False TrDireccion.Visible = False
TrCiudad.Visible = False TrCiudad.Visible = False
@@ -21210,8 +21239,14 @@ Partial Class Ventas
ObjVentas.Dispose() ObjVentas.Dispose()
If ActualizoEstatus Then 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 Else
Alert("No se pudo autorizar la cotización", TipoMensaje.MsgError) Alert("No se pudo autorizar la cotización", TipoMensaje.MsgError)
End If End If