@@ -151,7 +151,7 @@
-
+
diff --git a/Acumuladores/CatFoliosGarantia.aspx.vb b/Acumuladores/CatFoliosGarantia.aspx.vb
index 795b00dfc..1d4de3735 100644
--- a/Acumuladores/CatFoliosGarantia.aspx.vb
+++ b/Acumuladores/CatFoliosGarantia.aspx.vb
@@ -57,7 +57,7 @@ Partial Class Acumuladores_CatFoliosGarantia
Dim objAcum As New ClsAcumuladores
- If objAcum.FoliosGarantiaGet(-1, UsuarioActual.Empresa.CveEmpresa, Estatus:=EstatusValor, TipoFolio:=tipoFolioValor) Then
+ If objAcum.FoliosGarantiaGet(-1, UsuarioActual.Empresa.CveEmpresa, Estatus:=EstatusValor, TipoFolio:=tipoFolioValor, Area:=-1) Then
GvFolioGarantia.DataSource = objAcum.DtResultados
Else
GvFolioGarantia.DataSource = Nothing
@@ -116,7 +116,7 @@ Partial Class Acumuladores_CatFoliosGarantia
If Not Actualizar Then
- If ObjAcum.FoliosGarantiaAdd(TxtFolioGarantia.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero, DdlTipoFolioModal.SelectedValue, TxtLimite.Text.ToEntero) Then
+ If ObjAcum.FoliosGarantiaAdd(TxtFolioGarantia.Text, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero, DdlTipoFolioModal.SelectedValue, TxtLimite.Text.ToEntero, 2) Then
TxtFolioGarantia.Text = ""
ChkEstatus.Checked = True
diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb
index 75fc8ce98..2d74b5f69 100644
--- a/App_Code/ClsAcumuladores.vb
+++ b/App_Code/ClsAcumuladores.vb
@@ -483,7 +483,7 @@ Public Class ClsAcumuladores
#Region " FOLIOS GARANTÍA "
- Public Function FoliosGarantiaGet(CveFolioGarantia As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional TipoFolio As String = "-1") As Boolean
+ Public Function FoliosGarantiaGet(CveFolioGarantia As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional TipoFolio As String = "-1", Optional Area As Integer = 1) As Boolean
Dim Retorno As Boolean = False
'Data = New DataTable
@@ -493,7 +493,8 @@ Public Class ClsAcumuladores
.Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia
.Add("@Estatus", SqlDbType.Int).Value = Estatus
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
- .Add("@tipoFolio", SqlDbType.VarChar).Value = TipoFolio
+ .Add("@tipoFolio", SqlDbType.VarChar).Value = TipoFolio
+ .Add("@Area", SqlDbType.Int).Value = Area
End With
Try
@@ -508,7 +509,7 @@ Public Class ClsAcumuladores
Return Retorno
End Function
- Public Function FoliosGarantiaAdd(FolioGarantia As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoFolio As String, Limite As Integer) As Boolean
+ Public Function FoliosGarantiaAdd(FolioGarantia As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoFolio As String, Limite As Integer, Area As Integer) As Boolean
Dim Retorno As Boolean = False
'Data = New DataTable
@@ -522,7 +523,8 @@ Public Class ClsAcumuladores
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@TipoFolio", SqlDbType.VarChar).Value = TipoFolio
- .Add("@Limite", SqlDbType.Int).Value = Limite
+ .Add("@Limite", SqlDbType.Int).Value = Limite
+ .Add("@Area", SqlDbType.Int).Value = Area
End With
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 8e27bde3e..03e004735 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -931,11 +931,11 @@ Public Class ClsPaginas
End Set
End Property
Property GlobalDTSubProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEstatus As Integer = -1) As DataTable
- Get
-
- If Application("GlobalDTSubProyectosUsuarios") Is Nothing Then
+ Get
+ Dim AppNombre As String = String.Format("GlobalDTSubProyectosUsuarios{0}", CveEmpresa)
+ If Application(AppNombre) Is Nothing Then
Dim ObjSubProyectos As New ClsSubProyectos()
- If ObjSubProyectos.GetSubProyectosUsuarios Then Application("GlobalDTSubProyectosUsuarios") = ObjSubProyectos.DtResultados Else Alert("Ocurrió un error al cargar los SubProyectos. Por favor comuniquese con sistemas.", TipoMensaje.MsgError)
+ If ObjSubProyectos.GetSubProyectosUsuarios(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = ObjSubProyectos.DtResultados Else Alert("Ocurrió un error al cargar los SubProyectos. Por favor comuniquese con sistemas.", TipoMensaje.MsgError)
ObjSubProyectos.Dispose()
End If
@@ -947,33 +947,26 @@ Public Class ClsPaginas
If CveUsuario <> -1 Then StrSQL.AppendFormat(" AND CveUsuario = {0}", CveUsuario)
If CveEstatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", CveEstatus)
- Dim Dv As New DataView(DirectCast(Application("GlobalDTSubProyectosUsuarios"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows)
+ Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows)
GlobalDTSubProyectosUsuarios = Dv.ToTable
Dv.Dispose()
- Dim ObjSubProyectos As New ClsSubProyectos()
- If ObjSubProyectos.GetSubProyectosUsuarios(CveUsuario:=CveUsuario, CveProyecto:=CveProyecto, CveSubProyecto:=CveSubProyecto, CveEstatus:=CveEstatus, CveEmpresa:=CveEmpresa) Then
- GlobalDTSubProyectosUsuarios = ObjSubProyectos.DtResultados
- Else
- GlobalDTSubProyectosUsuarios = Nothing
- End If
- ObjSubProyectos.Dispose()
+ 'Dim ObjSubProyectos As New ClsSubProyectos()
+ 'If ObjSubProyectos.GetSubProyectosUsuarios(CveUsuario:=CveUsuario, CveProyecto:=CveProyecto, CveSubProyecto:=CveSubProyecto, CveEstatus:=CveEstatus, CveEmpresa:=CveEmpresa) Then
+ ' GlobalDTSubProyectosUsuarios = ObjSubProyectos.DtResultados
+ 'Else
+ ' GlobalDTSubProyectosUsuarios = Nothing
+ 'End If
+ 'ObjSubProyectos.Dispose()
Else
- GlobalDTSubProyectosUsuarios = DirectCast(Application("GlobalDTSubProyectosUsuarios"), DataTable)
+ GlobalDTSubProyectosUsuarios = DirectCast(Application(AppNombre), DataTable)
End If
End Get
Set(ByVal value As DataTable)
- If value Is Nothing OrElse value.Rows.Count = 0 Then
- Dim msg As String = "aqui no se carga subproyectos"
- If Request IsNot Nothing Then
- msg = msg & Request.ServerVariables("URL")
- End If
- msg.GuardaLog()
-
- End If
- Application("GlobalDTSubProyectosUsuarios") = value
+ Dim AppNombre As String = String.Format("GlobalDTSubProyectosUsuarios{0}", CveEmpresa)
+ Application(AppNombre) = value
End Set
End Property
Property GlobalDTProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, CveEstatus As Integer) As DataTable
diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb
index 833d6b4c2..045b59ec5 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -8828,6 +8828,7 @@ Namespace Modelos
Estado = ""
Pais = ""
CP = ""
+ Telefono = ""
AplicaFord = False
Ford_GSDB = ""
AplicaFEMSA = False
diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx
index 9af99331f..986094a69 100644
--- a/Ashx/SIGWeb.ashx
+++ b/Ashx/SIGWeb.ashx
@@ -210,6 +210,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
DtRetorno = dt.FiltraParametros($"NombreComercial like '%{Name}%' OR Nombre like '%{Name}%' ")
End If
+ dt.Dispose()
End If
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
@@ -220,6 +221,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Else
context.Response.Write("[]")
End If
+ DtRetorno.Dispose()
Return retorno
End Function
@@ -256,6 +258,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
DtRetorno = dt.FiltraParametros($"NombreCortoProveedor like '%{Name}%'")
End If
+ dt.Dispose()
End If
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
@@ -266,7 +269,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Else
context.Response.Write("[]")
End If
-
+ DtRetorno.Dispose()
Return retorno
End Function
#End Region
@@ -464,6 +467,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
End Try
End If
+ DTPS = Nothing
End If
If DtPSRetorno IsNot Nothing AndAlso DtPSRetorno.Rows.Count > 0 Then
DtPSRetorno.Columns("CvePS").ColumnName = "id"
@@ -478,6 +482,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Else
context.Response.Write("[]")
End If
+ DtPSRetorno.Dispose()
End If
Return retorno
diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb
index 7a3e359f8..1395d747c 100644
--- a/Bancos/PopIEVentas.aspx.vb
+++ b/Bancos/PopIEVentas.aspx.vb
@@ -322,6 +322,15 @@ Partial Class Bancos_PopIEVentas
End Set
End Property
+ Private Property CveCorte As Integer
+ Get
+ Return ViewState("CveCorte").ToString.ToEntero
+ End Get
+ Set(value As Integer)
+ ViewState("CveCorte") = value
+ End Set
+ End Property
+
Private Property TipoCambioOriginal As Decimal
Get
Return ViewState("TipoCambioOriginal").ToString.ToDecimal
@@ -527,7 +536,7 @@ Partial Class Bancos_PopIEVentas
ViewState("IdCtaAnticipo") = 0
ViewState("IdCtaContMonedaExtranjeraAnticipo") = 0
ViewState("IdCtaContMonedaComplementariaAnticipo") = 0
-
+ CveCorte = -1
IdCuentaBancariaComplementaria = 0
@@ -672,48 +681,46 @@ Partial Class Bancos_PopIEVentas
If ObjVenta.DtResultados IsNot Nothing AndAlso ObjVenta.DtResultados.Rows.Count > 0 Then
-
- 'CargaProveedor
Dim dr As DataRow = ObjVenta.DtResultados.Rows(0)
Dim Validada As Boolean = True
'JJMQ:20190606 Se cancela código de validacion ante el SAT por lentitud en el servicio.
'Sustituir la línea anterior por todo lo siguiente hasta donde termina el end if para que valide de nueva cuenta
'Dim Validada As Boolean = False
- 'If Not UsuarioActual.Empresa.Funcionalidad(529) = "1" Then
+ If Not UsuarioActual.Empresa.Funcionalidad(529) = "1" Then
- ' Dim Valida As New ClsValidaCFDi(dr("FolioFiscal").ToString(), dr("ClienteRFC").ToString, UsuarioActual.Empresa.RFC)
+ Dim Valida As New ClsValidaCFDi(dr("FolioFiscal").ToString(), dr("ClienteRFC").ToString, UsuarioActual.Empresa.RFC)
- ' If Valida.EsValida > 0 Then
- ' If Valida.EsValida = 2 Then
- ' Validada = False
- ' 'Dim ObjDatos As New ClsCompras
+ If Valida.EsValida > 0 Then
+ If Valida.EsValida = 2 Then
+ Validada = False
+ 'Dim ObjDatos As New ClsCompras
- ' 'If ObjDatos.UpdateEstatus(Valida.EsValida, gvr.DataKey("CveFactura").ToEntero) Then
+ 'If ObjDatos.UpdateEstatus(Valida.EsValida, gvr.DataKey("CveFactura").ToEntero) Then
- ' 'End If
- ' 'ObjDatos.Dispose()
+ 'End If
+ 'ObjDatos.Dispose()
- ' BtnGuardar.Enabled = False
+ BtnGuardar.Enabled = False
- ' If UsuarioActual.Empresa.UsaAC Then
- ' RegistraScript("if (confirm('La factura está cancelada ante el SAT., ¿Desea eliminar la compra?')) { $get('BtnEliminarCompra').click();}")
- ' Else
- ' Alert("La factura está cancelada ante el SAT.")
- ' End If
+ If UsuarioActual.Empresa.UsaAC Then
+ RegistraScript("if (confirm('La factura está cancelada ante el SAT., ¿Desea eliminar la compra?')) { $get('BtnEliminarCompra').click();}")
+ Else
+ Alert("La factura está cancelada ante el SAT.")
+ End If
- ' Else
- ' Validada = True
- ' End If
- ' Else
- ' 'no se pudo validar, pero ya tuvo la primera vuelta de validacion
- ' Validada = True
- ' End If
- ' Valida.Dispose()
- 'Else
- ' Validada = True
- 'End If
+ Else
+ Validada = True
+ End If
+ Else
+ 'no se pudo validar, pero ya tuvo la primera vuelta de validacion
+ Validada = True
+ End If
+ Valida.Dispose()
+ Else
+ Validada = True
+ End If
If Validada Then
@@ -725,7 +732,7 @@ Partial Class Bancos_PopIEVentas
CveMoneda = dr("CveMoneda").ToString.ToEntero
CveMonedaVenta = dr("CveMoneda").ToString.ToEntero
CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero
- NombreCliente = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Nombre", String.Format("CveCliente = {0}", CveCliente))
+ NombreCliente = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("Nombre", String.Format("CveCliente = {0}", CveCliente))
SerieFolio = dr("SerieFolio").ToString
TipoCambioOriginal = dr("TipoCambio").ToString.ToDecimal
CveSubProyectoVenta = dr("CveSubProyecto").ToString.ToEntero
@@ -777,6 +784,12 @@ Partial Class Bancos_PopIEVentas
FechaVenta = dr("Fecha").ToString.ToDate
SaldoVenta = dr("Saldo").ToString.ToDouble
+
+
+ 'Cortes de Caja
+ If UsuarioActual.TienePermisoProceso(160) Then
+ CargaCorteCaja()
+ End If
End If
@@ -786,6 +799,19 @@ Partial Class Bancos_PopIEVentas
ObjVenta.Dispose()
End Sub
+ Private Sub CargaCorteCaja()
+ 'Checar si hay un Turno Abierto
+ Dim ObjPVenta As New ClsPuntoVenta
+
+ If ObjPVenta.GetVta_Cortes("-1", "-1", UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, 0) Then
+
+ If ObjPVenta.DtResultados.Rows.Count > 0 Then
+ CveCorte = ObjPVenta.CveCorte
+ End If
+ End If
+ ObjPVenta.Dispose()
+ End Sub
+
Private Sub CargaCliente(ByVal CveCliente As Integer, RFC As String)
Dim ObjCliente As New ClsClientes
@@ -1497,7 +1523,7 @@ Partial Class Bancos_PopIEVentas
Select Case RBLContado.SelectedValue
Case "1" ' Banco
- CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, Fecha, TxtFolio.Text.Trim, TxtPagueseA.Text.Trim, ImportePagado, CveMoneda, tipoCambioPago, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), CveCuentaDeposito:=CveCuentaDeposito, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"))
+ CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, Fecha, TxtFolio.Text.Trim, TxtPagueseA.Text.Trim, ImportePagado, CveMoneda, tipoCambioPago, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), CveCuentaDeposito:=CveCuentaDeposito, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), CveCorte:=CveCorte)
If CveIE > 0 Then
If CveVenta > 0 Then
CveConcepto = 2
diff --git a/Compras/PopUpVerFactura.aspx b/Compras/PopUpVerFactura.aspx
index 4270e8dce..5f063d646 100644
--- a/Compras/PopUpVerFactura.aspx
+++ b/Compras/PopUpVerFactura.aspx
@@ -12,7 +12,7 @@
-
+
diff --git a/Inventarios/RecepcionAlmacen.aspx b/Inventarios/RecepcionAlmacen.aspx
index 0adad806e..0c9fa6b71 100644
--- a/Inventarios/RecepcionAlmacen.aspx
+++ b/Inventarios/RecepcionAlmacen.aspx
@@ -256,7 +256,7 @@
-
+
diff --git a/Inventarios/RecepcionEntrega.aspx b/Inventarios/RecepcionEntrega.aspx
index e6bf45a69..a426c9852 100644
--- a/Inventarios/RecepcionEntrega.aspx
+++ b/Inventarios/RecepcionEntrega.aspx
@@ -283,7 +283,7 @@
-
+
diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb
index cef5c28f6..9ac0d338f 100644
--- a/Inventarios/RecepcionUsados.aspx.vb
+++ b/Inventarios/RecepcionUsados.aspx.vb
@@ -2621,7 +2621,7 @@ Partial Class Inventarios_RecepcionUsados
Private Sub CargaFolioAjuste()
DdlFolioGarantia.Items.Clear()
Dim ObjAcum As New ClsAcumuladores
- If ObjAcum.FoliosGarantiaGet(-1, UsuarioActual.CveEmpresa) Then
+ If ObjAcum.FoliosGarantiaGet(-1, UsuarioActual.CveEmpresa, Area:=2) Then
DdlFolioGarantia.DataSource = ObjAcum.DtResultados
DdlFolioGarantia.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
diff --git a/Sistemas/UsuarioDetalle.aspx.vb b/Sistemas/UsuarioDetalle.aspx.vb
index 6daf7065a..1794f951d 100644
--- a/Sistemas/UsuarioDetalle.aspx.vb
+++ b/Sistemas/UsuarioDetalle.aspx.vb
@@ -1288,12 +1288,14 @@ Partial Class Sistemas_UsuarioDetalle
Private Sub RecargaGlobales(TieneError As Boolean, ObjSubProyectos As ClsSubProyectos, ObjBancos As ClsBancos, ObjOC As ClsOC, ObjUsuarios As ClsSisUsuarios)
'RECARGA GLOBAL SUBPROYECTOS
If Not TieneError Then
- If ObjSubProyectos.GetSubProyectosUsuarios Then
- Application("GlobalDTSubProyectosUsuarios") = ObjSubProyectos.DtResultados
- Else
- Application("GlobalDTSubProyectosUsuarios") = Nothing
- TieneError = True
- End If
+ GlobalDTSubProyectosUsuarios(-1, -1, UsuarioActual.CveEmpresa) = Nothing
+
+ 'If ObjSubProyectos.GetSubProyectosUsuarios Then
+ ' Application("GlobalDTSubProyectosUsuarios") = ObjSubProyectos.DtResultados
+ 'Else
+ ' Application("GlobalDTSubProyectosUsuarios") = Nothing
+ ' TieneError = True
+ 'End If
End If
If Not TieneError Then
diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index 840c535f4..d05f330be 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -3355,7 +3355,7 @@
-
+
@@ -3364,8 +3364,7 @@
-
-
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 66f3ce64e..531622ce0 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -2418,18 +2418,21 @@ Partial Class Ventas
LblSubProyecto.Text = ""
divProyectoPyME.Visible = False
LblSubProyectoPyME.InnerText = "Sucursal"
+ Dim dttSub As New DataTable
+ dttSub = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.Items.Clear()
- DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
+ DdlSubProyecto.DataSource = dttSub
'DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"})
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlSubProyectoPyME.Items.Clear()
- DdlSubProyectoPyME.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
+ DdlSubProyectoPyME.DataSource = dttSub
'DdlSubProyectoPyME.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"})
DdlSubProyectoPyME.DataBind()
DdlSubProyectoPyME.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ dttSub.Dispose()
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then
DdlProyecto.Visible = False
@@ -2439,18 +2442,21 @@ Partial Class Ventas
LblSubProyecto.Text = ""
divProyectoPyME.Visible = False
LblSubProyectoPyME.InnerText = "Proyecto"
+ Dim dttSub As New DataTable
+ dttSub = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.Items.Clear()
- DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
+ DdlSubProyecto.DataSource = dttSub
'DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"})
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlSubProyectoPyME.Items.Clear()
- DdlSubProyectoPyME.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
+ DdlSubProyectoPyME.DataSource = dttSub
'DdlSubProyectoPyME.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"})
DdlSubProyectoPyME.DataBind()
DdlSubProyectoPyME.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ dttSub.Dispose()
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then
LblProyectoHeader.Text = "Sucursal"
@@ -2603,8 +2609,6 @@ Partial Class Ventas
End If
TxtFecha.Enabled = True
- CargaPorcentajeMarcas()
-
BloqueaCondiconesPago()
BloqueaClasificaciones()
@@ -3538,13 +3542,17 @@ Partial Class Ventas
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString.ToEntero
HdnCveVenta.Value = CveVenta.ToString
-
- Dim ObjUsados As New ClsVentas
Dim DtUsados As DataTable = Nothing
- If ObjUsados.GetVentasUsados(CveVenta, DdlSubProyectoDatos.SelectedValue.ToEntero(), DbRowVenta("Fecha").ToString.ToDateTime, UsuarioActual.CveEmpresa) Then
- DtUsados = ObjUsados.DtResultados
+
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
+ Dim ObjUsados As New ClsVentas
+
+ If ObjUsados.GetVentasUsados(CveVenta, DdlSubProyectoDatos.SelectedValue.ToEntero(), DbRowVenta("Fecha").ToString.ToDateTime, UsuarioActual.CveEmpresa) Then
+ DtUsados = ObjUsados.DtResultados
+ End If
+ ObjUsados.Dispose()
End If
- ObjUsados.Dispose()
+
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString.ToEntero
'CargaEncabezado
@@ -3605,6 +3613,19 @@ Partial Class Ventas
End If
End If
+ 'CargaDetalle
+ If ObjVentas.GetVentaDetalle(CveVenta) Then
+ TmpDT = ObjVentas.DtResultados
+ TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
+ TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
+ GvPS.DataSource = ObjVentas.DtResultados
+ GvPS.DataBind()
+
+ 'IEPS A NIVEL DETALLE
+ 'TxtIEPS.Text = If(TmpDT.SUM("IEPS") > 0, TmpDT.SUM("IEPS").FormatoNumero, TxtIEPS.Text)
+ End If
+
+
If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ing", "Ant", "Dev") AndAlso LblFolioFiscal.Text.Trim = "" Then HplFolioFiscalModal.Visible = True
Select Case DbRowVenta("TipoDocto").ToString
@@ -3622,7 +3643,7 @@ Partial Class Ventas
If TienePermiso <> "" Then ' si tiene acceso en el subproyecto
'LkNotaCredito.Visible = UsuarioActual.TienePermisoProceso(175)
If UsuarioActual.TienePermisoProceso(264) Then
- InicializaAplicaDevolucion()
+ InicializaAplicaDevolucion(TmpDT)
End If
End If
@@ -3754,11 +3775,11 @@ Partial Class Ventas
End If
'contado 0, credito 1, terminal 2
- If ObjVentas.DtResultados(0)("CondicionesPago").ToString.ToEntero = 1 Then
+ If DbRowVenta("CondicionesPago").ToString.ToEntero = 1 Then
RBLPago.SelectedValue = "1"
RBLPago_SelectedIndexChanged(Nothing, Nothing)
UPCondicionesPago.Update()
- ElseIf ObjVentas.DtResultados(0)("CondicionesPago").ToString.ToEntero = 0 Then
+ ElseIf DbRowVenta("CondicionesPago").ToString.ToEntero = 0 Then
RBLPago.SelectedValue = "2"
RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing)
@@ -3771,17 +3792,6 @@ Partial Class Ventas
UPCondicionesPago.Update()
End If
- 'CargaDetalle
- If ObjVentas.GetVentaDetalle(CveVenta) Then
- TmpDT = ObjVentas.DtResultados
- TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
- TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
- GvPS.DataSource = ObjVentas.DtResultados
- GvPS.DataBind()
-
- 'IEPS A NIVEL DETALLE
- 'TxtIEPS.Text = If(TmpDT.SUM("IEPS") > 0, TmpDT.SUM("IEPS").FormatoNumero, TxtIEPS.Text)
- End If
'ESCONDE ACCIONES
LnkRemisiones.Visible = False
@@ -5151,6 +5161,10 @@ Partial Class Ventas
CargaRestriccionesCreditoCliente(True, Me.CveVenta)
End If
+ ' si es empresa acumuladores
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
+ CargaPorcentajeMarcas()
+ End If
UpFacturar.Update()
UpEstatus.Update()
@@ -5205,124 +5219,122 @@ Partial Class Ventas
End Sub
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
- Dim ObjCliente As New ClsClientes()
- If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
- If ObjCliente.DtResultados.Rows.Count > 0 Then
- If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso ObjCliente.DtResultados.Rows(0)("PermiteCredito").ToString = "False" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1 Then
- RBLPago.SelectedValue = "2"
- RBLPago.Items(0).Enabled = False
- RBLPago_SelectedIndexChanged(Nothing, Nothing)
- If UsuarioActual.CveEmpresa.Contiene(119) AndAlso Not UsuarioActual.TienePermisoProceso(268) Then
+
+ If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1 Then
+ RBLPago.SelectedValue = "2"
+ RBLPago.Items(0).Enabled = False
+ RBLPago_SelectedIndexChanged(Nothing, Nothing)
+ If UsuarioActual.CveEmpresa.Contiene(119) AndAlso Not UsuarioActual.TienePermisoProceso(268) Then
+ DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
+ DdlTipoComprobante.SelectedValue = "PA"
+ TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
+ 'si llegó por la opción de cotización no debe de restringuir
+ If IfNull(Request("Op"), "").ToString = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
+ LnkPedido2SinFacturar.Visible = False
+ LnkCotizaciones.Visible = False
+ End If
+ UPCondicionesPago.Update()
+ ElseIf UsuarioActual.CveEmpresa.Contiene(72, 119) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
+ RBLPago.SelectedValue = "1"
+ RBLPago_SelectedIndexChanged(Nothing, Nothing)
+ UPCondicionesPago.Update()
+ Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero)
+
+ If CreditoDispo > 0 Then
+ TrCreditoDisponible.Visible = True
+ LblCreditoDisponible.Text = CreditoDispo.FormatoNumero
+ If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%"
+ If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then
+
+ 'If LblRFC.Text.Trim <> "XAXX010101000" Then
+
+ Dim Vta As New ClsVentas
+ Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
+ Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
+ Vta.Dispose()
+ If Opcion > 0 Then
+ 'si la cotización no debe de existir este canddado
+ If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
+ 'RBLPago.SelectedValue = "2"
+ 'RBLPago.Items(0).Enabled = False
+ RBLPago_SelectedIndexChanged(Nothing, Nothing)
+ UPCondicionesPago.Update()
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
DdlTipoComprobante.SelectedValue = "PA"
TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
'si llegó por la opción de cotización no debe de restringuir
If IfNull(Request("Op"), "").ToString = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
+ 'quito remisión y factura
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
- LnkPedido2SinFacturar.Visible = False
- LnkCotizaciones.Visible = False
- End If
- UPCondicionesPago.Update()
- ElseIf UsuarioActual.CveEmpresa.Contiene(72, 119) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
- RBLPago.SelectedValue = "1"
- RBLPago_SelectedIndexChanged(Nothing, Nothing)
- UPCondicionesPago.Update()
- Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero)
-
- If CreditoDispo > 0 Then
- TrCreditoDisponible.Visible = True
- LblCreditoDisponible.Text = CreditoDispo.FormatoNumero
- If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%"
- If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then
-
- 'If LblRFC.Text.Trim <> "XAXX010101000" Then
-
- Dim Vta As New ClsVentas
- Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
- Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
- Vta.Dispose()
- If Opcion > 0 Then
- 'si la cotización no debe de existir este canddado
- If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
- 'RBLPago.SelectedValue = "2"
- 'RBLPago.Items(0).Enabled = False
- RBLPago_SelectedIndexChanged(Nothing, Nothing)
- UPCondicionesPago.Update()
- DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
- DdlTipoComprobante.SelectedValue = "PA"
- TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
- 'si llegó por la opción de cotización no debe de restringuir
- If IfNull(Request("Op"), "").ToString = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
- 'quito remisión y factura
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
- If Opcion = 1 Then
- BtnEmitirImprimir.Visible = False
- BtnsFacturar.Visible = False
- BtnGenerarRemision.Visible = False
- LnkPedido2SinFacturar.Visible = False
- LnkCotizaciones.Visible = False
- LnkOCs.Visible = False
- End If
- Else
- ' el cliente tiene crédito disponible, no tiene bloqueo
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA"))
-
- If UsuarioActual.TienePermisoProceso(60) Then DdlTipoComprobante.SelectedValueExistInsert("Ing", "Ingresos") 'puede facturar
- If UsuarioActual.TienePermisoProceso(199) Then DdlTipoComprobante.SelectedValueExistInsert("Rem", "Remisión") ' puede remisionar
- DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento)
-
- TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString
- End If
-
- 'Else
- ' 'que no de crédito, solo contado
- ' RBLPago.SelectedValue = "2"
- ' RBLPago.Items(0).Enabled = False
- 'End If
-
- End If
- Else
-
- If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then
- Dim Vta As New ClsVentas
- Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
- Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
- Vta.Dispose()
- If Opcion > 0 Then
- If Opcion = 1 Then
- BtnEmitirImprimir.Visible = False
- End If
- If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
- Else
- If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
- End If
-
- 'RBLPago.SelectedValue = "2"
- 'RBLPago.Items(0).Enabled = False
- RBLPago_SelectedIndexChanged(Nothing, Nothing)
- UPCondicionesPago.Update()
- DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
- DdlTipoComprobante.SelectedValue = "PA"
- TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
- 'si llegó por la opción de cotización no debe de restringuir
- If IfNull(Request("Op"), "").ToString = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
+ If Opcion = 1 Then
+ BtnEmitirImprimir.Visible = False
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
LnkPedido2SinFacturar.Visible = False
LnkCotizaciones.Visible = False
LnkOCs.Visible = False
End If
+ Else
+ ' el cliente tiene crédito disponible, no tiene bloqueo
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA"))
+
+ If UsuarioActual.TienePermisoProceso(60) Then DdlTipoComprobante.SelectedValueExistInsert("Ing", "Ingresos") 'puede facturar
+ If UsuarioActual.TienePermisoProceso(199) Then DdlTipoComprobante.SelectedValueExistInsert("Rem", "Remisión") ' puede remisionar
+ DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento)
+
+ TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString
End If
- UPPCreditoDisponible.Update()
- ElseIf UsuarioActual.CveEmpresa.Contiene(119, 1) AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString.ToEntero > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then
- Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero)
+
+ 'Else
+ ' 'que no de crédito, solo contado
+ ' RBLPago.SelectedValue = "2"
+ ' RBLPago.Items(0).Enabled = False
+ 'End If
+
+ End If
+ Else
+
+ If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then
+ Dim Vta As New ClsVentas
+ Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
+ Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
+ Vta.Dispose()
+ If Opcion > 0 Then
+ If Opcion = 1 Then
+ BtnEmitirImprimir.Visible = False
+ End If
+ If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
+ Else
+ If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
+ End If
+
+ 'RBLPago.SelectedValue = "2"
+ 'RBLPago.Items(0).Enabled = False
+ RBLPago_SelectedIndexChanged(Nothing, Nothing)
+ UPCondicionesPago.Update()
+ DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
+ DdlTipoComprobante.SelectedValue = "PA"
+ TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
+ 'si llegó por la opción de cotización no debe de restringuir
+ If IfNull(Request("Op"), "").ToString = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
+ BtnsFacturar.Visible = False
+ BtnGenerarRemision.Visible = False
+ LnkPedido2SinFacturar.Visible = False
+ LnkCotizaciones.Visible = False
+ LnkOCs.Visible = False
+ End If
+ End If
+ UPPCreditoDisponible.Update()
+ ElseIf UsuarioActual.CveEmpresa.Contiene(119, 1) AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString.ToEntero > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then
+ Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero)
If CreditoDispo > 0 Then
Dim Vta As New ClsVentas
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
@@ -5331,8 +5343,8 @@ Partial Class Ventas
If Opcion > 0 Then
If ModalidadEdicion AndAlso ViewState("CveCliente").ToString.ToEntero <> ViewState("CveClienteAnterior").ToString.ToEntero And DdlTipoComprobante.SelectedValue = "Rem" And ViewState("CveClienteAnterior").ToString.ToEntero > 0 And LblRFC.Text.Trim <> "XAXX010101000" Then
ViewState("CveCliente") = ViewState("CveClienteAnterior").ToString.ToEntero
- ObjCliente.Dispose()
- CargaCliente(ViewState("CveCliente").ToString.ToEntero)
+
+ CargaCliente(ViewState("CveCliente").ToString.ToEntero)
If Opcion > 0 Then
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
Else
@@ -5382,9 +5394,7 @@ Partial Class Ventas
End If
End If
End If
- End If
- End If
- ObjCliente.Dispose()
+
End Sub
@@ -5516,14 +5526,17 @@ Partial Class Ventas
Return Retorno
End Function
Private Sub CargaDdlSubProyectos()
- DdlSubProyectoDatos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1).FiltraParametros("EsSucursal = True ")
+ Dim dtt As New DataTable
+ dtt = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
+ DdlSubProyectoDatos.DataSource = dtt.FiltraParametros("EsSucursal = True ")
DdlSubProyectoDatos.DataBind()
- DdlSubProyectoCobranza.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1).FiltraParametros("EsSucursal = True ")
+ DdlSubProyectoCobranza.DataSource = dtt.FiltraParametros("EsSucursal = True ")
DdlSubProyectoCobranza.DataBind()
- DdlSubProyectoEjecucion.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1).FiltraParametros("EsSucursal = True ")
+ DdlSubProyectoEjecucion.DataSource = dtt.FiltraParametros("EsSucursal = True ")
DdlSubProyectoEjecucion.DataBind()
- DdlSubProyectoPyME.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
+ DdlSubProyectoPyME.DataSource = dtt
DdlSubProyectoPyME.DataBind()
+ dtt.Dispose()
End Sub
Private Sub CargaClasificaciones()
If UsuarioActual.Empresa.UsaAC Then
@@ -5618,13 +5631,16 @@ Partial Class Ventas
Public Sub CargaDdlNCPS()
Dim CveSATNC = "84111506"
- DdlNCPS.DataSource = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC
+ Dim dtt As New DataTable
+ dtt = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC
+ DdlNCPS.DataSource = dtt
DdlNCPS.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlNCPS.DataBind()
- DdlNCPSAnt.DataSource = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC
+ DdlNCPSAnt.DataSource = dtt
DdlNCPSAnt.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlNCPSAnt.DataBind()
+ dtt.Dispose()
End Sub
#End Region
@@ -15780,7 +15796,7 @@ Partial Class Ventas
If ConSalida AndAlso Not OcurrioError Then
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
- OcurrioError = Not GenerarMovimientoAlmacenVirtual(CveRemision, ObjInventario, ObjFactura)
+ OcurrioError = Not GenerarMovimientoAlmacenVirtual(CveRemision, ObjInventario, ObjFactura, ObjConta:=ObjConta)
End If
If Not OcurrioError Then
@@ -16136,7 +16152,7 @@ Partial Class Ventas
Return Not OcurrioError
End Function
- Private Function GenerarMovimientoAlmacenVirtual(CveRemision As Integer, ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura) As Boolean
+ Private Function GenerarMovimientoAlmacenVirtual(CveRemision As Integer, ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura, Optional ByRef ObjConta As ClsContabilidad = Nothing) As Boolean
Dim OcurrioError As Boolean = False
Try
@@ -16190,6 +16206,57 @@ Partial Class Ventas
OcurrioError = True
End If
+ 'Agregamos las PrePolizas
+ If Not OcurrioError Then
+ If CveMovimientoVirtual > 0 Then
+ 'OcurrioError = Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoInventario, CveAlmacen)
+ If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtual, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
+ Dim DtCostos = ObjInventario.DtResultados.Copy
+ Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
+ Dim IdCtaContable As Integer = 0
+ Dim CveCuenta As Integer = 0
+ Dim ValorInventario As Decimal
+ Dim TotalCostoAcumulado As Decimal = 0D
+ Dim Cont As Integer = 1
+ Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL
+
+ For Each RowInv As DataRow In DtCostosDistinct.Rows
+ ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
+ IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
+ CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
+ TotalCostoAcumulado += ValorInventario
+
+ 'cuando es el último movimiento y hay diferencias en los importes
+ If Cont = DtCostosDistinct.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
+ ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
+ End If
+
+ Try
+ 'If ValorInventario <> 0 Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
+ OcurrioError = True
+ Exit For
+ End If
+ 'End If
+ Catch ex As Exception
+ OcurrioError = True
+ Alert("Error inesperado (15148). Por favor comuniquese con atención SIG.", TipoMensaje.ToastError)
+ End Try
+ Cont += 1
+ Next
+
+ If Not OcurrioError Then
+ IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacenVirtual)).ToEntero
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
+ OcurrioError = True
+ End If
+ End If
+ Else
+ OcurrioError = True
+ End If
+ End If
+ End If
+
End If
Catch ex As Exception
@@ -22034,7 +22101,7 @@ Partial Class Ventas
#End Region
#Region " APLICA DEVOLUCION "
- Private Sub InicializaAplicaDevolucion()
+ Private Sub InicializaAplicaDevolucion(DtDetalle As DataTable)
'If Not UsuarioActual.CveUsuario = 100 Then
' If Not UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 140, 141, 146) Then
' Exit Sub
@@ -22048,13 +22115,13 @@ Partial Class Ventas
LBAplicaDevolucion.Visible = True
Dim SeEsconde As Boolean = False
- Dim ObjVenta As New ClsVentas
- If ObjVenta.GetVentaDetalle(CveVenta) Then
- If Not ObjVenta.DtResultados.SUM("CantSur").ToString.ToDecimal > 0 Then SeEsconde = True
+
+ If DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0 Then
+ If Not DtDetalle.SUM("CantSur").ToString.ToDecimal > 0 Then SeEsconde = True
'NO MOSTRAR LOS PRODUCTOS CON LA CLASIFICACION DE USADOS
- GvAplicaDevolucion.DataSource = ObjVenta.DtResultados.FiltraParametros("CantRes > 0 AND CveClasificacion <> 20519")
+ GvAplicaDevolucion.DataSource = DtDetalle.FiltraParametros("CantRes > 0 AND CveClasificacion <> 20519")
End If
- ObjVenta.Dispose()
+
'activo el permiso para registrar el importe diferente a la devolución
GvAplicaDevolucion.Columns(9).Visible = UsuarioActual.TienePermisoProceso(253)
@@ -24984,4 +25051,25 @@ Partial Class Ventas
Protected Sub LnkGenerarOC_Click(sender As Object, e As EventArgs)
Response.Redirect($"~/OC/OC.aspx?CveCotizacion={Me.CveVenta}&Tipo=OC")
End Sub
+
+ 'Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
+ ' Dim ObjVentas As New ClsVentas
+ ' ObjVentas.IniciaTransacSQL()
+
+ ' Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
+ ' Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
+ ' Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL())
+ ' Dim ObjAC As ClsContPAQi = Nothing
+
+ ' If Not RegeneracionPolizas(ObjVentas, ObjAC, ObjConta, ObjBancos) Then
+ ' ObjVentas.Commit()
+ ' If ObjAC IsNot Nothing Then ObjAC.Commit()
+ ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();")
+ ' End If
+
+ ' ObjVentas.Dispose()
+ ' ObjConta.Dispose()
+ ' ObjBancos.Dispose()
+ ' If ObjAC IsNot Nothing Then ObjAC.Dispose()
+ 'End Sub
End Class
\ No newline at end of file