Error null referenceexception
This commit is contained in:
@@ -1295,80 +1295,83 @@ Partial Class Compras_Compras
|
|||||||
ViewState("CveFactura") = Request("CveFactura").ToEntero
|
ViewState("CveFactura") = Request("CveFactura").ToEntero
|
||||||
|
|
||||||
Dim RFC As String = CargaFactura(CveFactura)
|
Dim RFC As String = CargaFactura(CveFactura)
|
||||||
DdlProveedor.Visible = False
|
If RFC.Trim <> String.Empty Then
|
||||||
HplProveedor.Visible = True
|
DdlProveedor.Visible = False
|
||||||
GvInv.Visible = True
|
HplProveedor.Visible = True
|
||||||
CargaProveedor(-1, RFC)
|
GvInv.Visible = True
|
||||||
|
CargaProveedor(-1, RFC)
|
||||||
|
|
||||||
If Not DdlTipoComprobante.SelectedValue = "NC" Then
|
If Not DdlTipoComprobante.SelectedValue = "NC" Then
|
||||||
If UsuarioActual.Empresa.Funcionalidad(128) = "1" And Not UsuarioActual.TienePermisoProceso(213) Then
|
If UsuarioActual.Empresa.Funcionalidad(128) = "1" And Not UsuarioActual.TienePermisoProceso(213) Then
|
||||||
If TmpDT.MAX("CvePS").ToEntero > 0 Then
|
If TmpDT.MAX("CvePS").ToEntero > 0 Then
|
||||||
BtnGuardar.Enabled = False
|
BtnGuardar.Enabled = False
|
||||||
RegistraScript("$('#ImgBtnBuscarOC').click()")
|
RegistraScript("$('#ImgBtnBuscarOC').click()")
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
If DdlTipoComprobante.SelectedValue = "NC" Then
|
|
||||||
paneldevolucion.Visible = True
|
|
||||||
Pnlalmaceninventarios.Visible = False
|
|
||||||
cargaddldevoluciones(CveProveedor, TxtSubTotal.Text.ToDouble)
|
|
||||||
InicializaAplicaNCFact()
|
|
||||||
DivReembolso.Visible = False
|
|
||||||
RBLPago.Items(2).Enabled = False
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If UsuarioActual.Empresa.UsaAC Then
|
|
||||||
CambiaEjercicioAC()
|
|
||||||
End If
|
|
||||||
|
|
||||||
' ''Fecha limite para ingreso de facturas
|
|
||||||
''Dim DtEmpresa As DataTable = GlobalDTEmpresas(UsuarioActual.CveEmpresa)
|
|
||||||
''If DtEmpresa.Rows.Count > 0 Then
|
|
||||||
'' Dim FechaLimite = DateSerial(DtEmpresa.Rows(0)("EjercicioActual").ToString.ToEntero, DtEmpresa.Rows(0)("PeriodoActual").ToString.ToEntero, DtEmpresa.Rows(0)("DiasPermitidos").ToString.ToEntero)
|
|
||||||
'' If Month(TxtFecha.Text.ToDate) < (Month(FechaLimite) - 1) Or (Month(TxtFecha.Text.ToDate) = (Month(FechaLimite) - 1) And Day(Date.Now) > Day(FechaLimite)) Then
|
|
||||||
'' Alert("La factura actual ya no aplica para ingresarse al sístema.", TipoMensaje.MsgAdvertencia)
|
|
||||||
'' BtnGuardar.Enabled = False
|
|
||||||
'' Else
|
|
||||||
'' Alert("En tiempo")
|
|
||||||
'' End If
|
|
||||||
''Else
|
|
||||||
'' Alert("No se pudieron cargar los datos de la empresa", TipoMensaje.MsgAdvertencia)
|
|
||||||
''End If
|
|
||||||
'Carga Compra
|
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(123).ToEntero > 0 And Not UsuarioActual.TienePermisoProceso(156) Then
|
|
||||||
If Not ValidaCierrePeriodo() Then
|
|
||||||
Alert("El periodo de la compra actual ya se encuentra cerrado. No podra registrar la compra.", TipoMensaje.MsgAdvertencia)
|
|
||||||
BtnGuardar.Visible = False
|
|
||||||
TxtOC.Enabled = False
|
|
||||||
ImgBtnBuscarOC.Enabled = False
|
|
||||||
CierrePeriodo = True
|
|
||||||
DivRestriccionAdvertencia.Visible = True
|
|
||||||
LtRestriccionAdvertencia.Text = "El periodo de la compra actual ya se encuentra cerrado."
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim HayDifIEPS As Boolean = False
|
|
||||||
For Each Gvr As GridViewRow In GvPS.Rows
|
|
||||||
If Gvr.DataKey("CvePS").ToEntero > 0 AndAlso Gvr.DataKey("IEPSPSPorcentaje").ToDouble > 0 Then
|
|
||||||
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=Gvr.DataKey("CvePS").ToEntero).Rows.Count > 0 Then
|
|
||||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=Gvr.DataKey("CvePS").ToEntero).Rows(0)
|
|
||||||
If DrPS IsNot Nothing Then
|
|
||||||
If DrPS("IEPSPorcentaje").ToString.ToDouble <> Gvr.DataKey("IEPSPSPorcentaje").ToDouble Then
|
|
||||||
HayDifIEPS = True
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
|
||||||
|
|
||||||
If HayDifIEPS Then Alert("El porcentaje de IEPS del producto no coincide con el especificado.", TipoMensaje.MsgAdvertencia)
|
If DdlTipoComprobante.SelectedValue = "NC" Then
|
||||||
|
paneldevolucion.Visible = True
|
||||||
|
Pnlalmaceninventarios.Visible = False
|
||||||
|
cargaddldevoluciones(CveProveedor, TxtSubTotal.Text.ToDouble)
|
||||||
|
InicializaAplicaNCFact()
|
||||||
|
DivReembolso.Visible = False
|
||||||
|
RBLPago.Items(2).Enabled = False
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.UsaAC Then
|
||||||
|
CambiaEjercicioAC()
|
||||||
|
End If
|
||||||
|
|
||||||
|
' ''Fecha limite para ingreso de facturas
|
||||||
|
''Dim DtEmpresa As DataTable = GlobalDTEmpresas(UsuarioActual.CveEmpresa)
|
||||||
|
''If DtEmpresa.Rows.Count > 0 Then
|
||||||
|
'' Dim FechaLimite = DateSerial(DtEmpresa.Rows(0)("EjercicioActual").ToString.ToEntero, DtEmpresa.Rows(0)("PeriodoActual").ToString.ToEntero, DtEmpresa.Rows(0)("DiasPermitidos").ToString.ToEntero)
|
||||||
|
'' If Month(TxtFecha.Text.ToDate) < (Month(FechaLimite) - 1) Or (Month(TxtFecha.Text.ToDate) = (Month(FechaLimite) - 1) And Day(Date.Now) > Day(FechaLimite)) Then
|
||||||
|
'' Alert("La factura actual ya no aplica para ingresarse al sístema.", TipoMensaje.MsgAdvertencia)
|
||||||
|
'' BtnGuardar.Enabled = False
|
||||||
|
'' Else
|
||||||
|
'' Alert("En tiempo")
|
||||||
|
'' End If
|
||||||
|
''Else
|
||||||
|
'' Alert("No se pudieron cargar los datos de la empresa", TipoMensaje.MsgAdvertencia)
|
||||||
|
''End If
|
||||||
|
'Carga Compra
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(123).ToEntero > 0 And Not UsuarioActual.TienePermisoProceso(156) Then
|
||||||
|
If Not ValidaCierrePeriodo() Then
|
||||||
|
Alert("El periodo de la compra actual ya se encuentra cerrado. No podra registrar la compra.", TipoMensaje.MsgAdvertencia)
|
||||||
|
BtnGuardar.Visible = False
|
||||||
|
TxtOC.Enabled = False
|
||||||
|
ImgBtnBuscarOC.Enabled = False
|
||||||
|
CierrePeriodo = True
|
||||||
|
DivRestriccionAdvertencia.Visible = True
|
||||||
|
LtRestriccionAdvertencia.Text = "El periodo de la compra actual ya se encuentra cerrado."
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim HayDifIEPS As Boolean = False
|
||||||
|
For Each Gvr As GridViewRow In GvPS.Rows
|
||||||
|
If Gvr.DataKey("CvePS").ToEntero > 0 AndAlso Gvr.DataKey("IEPSPSPorcentaje").ToDouble > 0 Then
|
||||||
|
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=Gvr.DataKey("CvePS").ToEntero).Rows.Count > 0 Then
|
||||||
|
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=Gvr.DataKey("CvePS").ToEntero).Rows(0)
|
||||||
|
If DrPS IsNot Nothing Then
|
||||||
|
If DrPS("IEPSPorcentaje").ToString.ToDouble <> Gvr.DataKey("IEPSPSPorcentaje").ToDouble Then
|
||||||
|
HayDifIEPS = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
If HayDifIEPS Then Alert("El porcentaje de IEPS del producto no coincide con el especificado.", TipoMensaje.MsgAdvertencia)
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
ElseIf Request("CveCompra") IsNot Nothing AndAlso IsNumeric(Request("CveCompra")) AndAlso Request("CveCompra").ToEntero > 0 Then
|
ElseIf Request("CveCompra") IsNot Nothing AndAlso IsNumeric(Request("CveCompra")) AndAlso Request("CveCompra").ToEntero > 0 Then
|
||||||
|
|
||||||
@@ -1741,10 +1744,14 @@ Partial Class Compras_Compras
|
|||||||
|
|
||||||
XMLDoc.Load(Archivo)
|
XMLDoc.Load(Archivo)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
Try
|
||||||
|
Dim oReader = New StreamReader(Archivo, Encoding.GetEncoding("ISO-8859-1"))
|
||||||
|
XMLDoc.Load(oReader)
|
||||||
|
oReader.Dispose()
|
||||||
|
Catch ex As Exception
|
||||||
|
GuardaLog("Error al intentar leer el XML del SAT. Error:" & ex.ToString())
|
||||||
|
End Try
|
||||||
|
|
||||||
Dim oReader = New StreamReader(Archivo, Encoding.GetEncoding("ISO-8859-1"))
|
|
||||||
XMLDoc.Load(oReader)
|
|
||||||
oReader.Dispose()
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
@@ -2083,19 +2090,22 @@ Partial Class Compras_Compras
|
|||||||
|
|
||||||
ObjeFacturas.Dispose()
|
ObjeFacturas.Dispose()
|
||||||
|
|
||||||
Dim ObjSAT As New ClsSAT
|
If RFC <> "" Then
|
||||||
Dim RFCRequest As String = Request("RFC").ToString
|
Dim ObjSAT As New ClsSAT
|
||||||
If ObjSAT.GetListado69B(2, UsuarioActual.CveEmpresa, RFCRequest) Then
|
|
||||||
If ObjSAT.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim Estatus As String = ObjSAT.DtResultados.Rows(0)("Situacion").ToString
|
|
||||||
BtnGuardar.Enabled = False
|
|
||||||
UpParametros.Update()
|
|
||||||
|
|
||||||
Alert($"El RFC del proveedor se encuentra en estado <b>{Estatus}</b> en el Listado EFOS (69B) del SAT", TipoMensaje.MsgAdvertencia)
|
If ObjSAT.GetListado69B(2, UsuarioActual.CveEmpresa, RFC) Then
|
||||||
System.Threading.Thread.Sleep(5)
|
If ObjSAT.DtResultados.Rows.Count > 0 Then
|
||||||
|
Dim Estatus As String = ObjSAT.DtResultados.Rows(0)("Situacion").ToString
|
||||||
|
BtnGuardar.Enabled = False
|
||||||
|
UpParametros.Update()
|
||||||
|
|
||||||
|
Alert($"El RFC del proveedor se encuentra en estado <b>{Estatus}</b> en el Listado EFOS (69B) del SAT", TipoMensaje.MsgAdvertencia)
|
||||||
|
System.Threading.Thread.Sleep(5)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
ObjSAT.Dispose()
|
||||||
End If
|
End If
|
||||||
ObjSAT.Dispose()
|
|
||||||
|
|
||||||
|
|
||||||
Return RFC
|
Return RFC
|
||||||
|
|||||||
Reference in New Issue
Block a user