-- actualización e reteciones
This commit is contained in:
@@ -3302,30 +3302,31 @@ Public Class ClsCompras
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Public Function GetComprasPrepolizasRetIvaRetISRActualiza(CveCompra As Integer, CveRetIVAConcepto As Integer, CveRetISRConcepto As Integer) As Boolean
|
'Public Function GetComprasPrepolizasRetIvaRetISRActualiza(CveCompra As Integer, CveRetIVAConcepto As Integer, CveRetISRConcepto As Integer) As Boolean
|
||||||
|
' Dim Retorno As Boolean = False
|
||||||
|
' DataAdapter("PA_Comp_ComprasPrepolizasRetIvaRetISRActualizaGet")
|
||||||
|
' With SqlAdapter.SelectCommand.Parameters
|
||||||
|
' .Add("@CveCompra", SqlDbType.Int).Value = CveCompra
|
||||||
|
' .Add("@CveRetIVAConcepto", SqlDbType.Int).Value = CveRetIVAConcepto
|
||||||
|
' .Add("@CveRetISRConcepto", SqlDbType.Int).Value = CveRetISRConcepto
|
||||||
|
' End With
|
||||||
|
' Try
|
||||||
|
' SqlAdapter.Fill(Data)
|
||||||
|
' Retorno = True
|
||||||
|
' Catch ex As Exception
|
||||||
|
' OnError("Ocurrió un error al Obtener los datos de retención de IVA y retención ISR.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
' End Try
|
||||||
|
' Return Retorno
|
||||||
|
'End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Function UpdateComprasRetencionesUpdate(CveConceptoRetIVA As Integer, CveConceptoRetISR As Integer, CveCompra As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Comp_ComprasPrepolizasRetIvaRetISRActualizaGet")
|
DataAdapter("PA_Comp_ComprasRetencionesUpdate")
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveConceptoRetIVA", SqlDbType.Int).Value = CveConceptoRetIVA
|
||||||
|
.Add("@CveConceptoRetISR", SqlDbType.Int).Value = CveConceptoRetISR
|
||||||
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
|
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
|
||||||
.Add("@CveRetIVAConcepto", SqlDbType.Int).Value = CveRetIVAConcepto
|
|
||||||
.Add("@CveRetISRConcepto", SqlDbType.Int).Value = CveRetISRConcepto
|
|
||||||
End With
|
|
||||||
Try
|
|
||||||
SqlAdapter.Fill(Data)
|
|
||||||
Retorno = True
|
|
||||||
Catch ex As Exception
|
|
||||||
OnError("Ocurrió un error al Obtener los datos de retención de IVA y retención ISR.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
|
||||||
End Try
|
|
||||||
Return Retorno
|
|
||||||
End Function
|
|
||||||
|
|
||||||
|
|
||||||
Public Function UpdateComprasPrepolizasRetIvaRetISRActualiza(CvePrePolizaDetalle As Integer, CveConceptoContable As Integer) As Boolean
|
|
||||||
Dim Retorno As Boolean = False
|
|
||||||
DataAdapter("PA_Comp_ComprasPrepolizasRetIvaRetISRActualizaUpdate")
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
|
||||||
.Add("@CvePrePolizaDetalle", SqlDbType.Int).Value = CvePrePolizaDetalle
|
|
||||||
.Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable
|
|
||||||
End With
|
End With
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
|
|||||||
@@ -2616,8 +2616,6 @@ Partial Class Compras_Compras
|
|||||||
|
|
||||||
HFDiferenciaCompra.Value = TxtTotal.Text
|
HFDiferenciaCompra.Value = TxtTotal.Text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TotalGeneral = dr("Total").ToString.ToDouble
|
TotalGeneral = dr("Total").ToString.ToDouble
|
||||||
CveMoneda = dr("CveMoneda").ToString.ToEntero
|
CveMoneda = dr("CveMoneda").ToString.ToEntero
|
||||||
DdlValidadaSAT.SelectedValue = "Si"
|
DdlValidadaSAT.SelectedValue = "Si"
|
||||||
@@ -5998,7 +5996,7 @@ Partial Class Compras_Compras
|
|||||||
importeMovimiento = TxtTotal.Text.ToDecimal 'TmpDT.SUM("Total", String.Format("ISNULL(TipoAF, 0) <> 2 And ISNULL(CveAlmacen, 0) = 0 And ISNULL(AplicaCostoIndirecto, 0) <> 1 And CveClasificacion = {0} And CveSubProyecto = {1} And ISNULL(CveTipoGasto, 0) = {2} Then", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("CveTipoGasto").ToString.ToEntero)).ToString.ToDecimal
|
importeMovimiento = TxtTotal.Text.ToDecimal 'TmpDT.SUM("Total", String.Format("ISNULL(TipoAF, 0) <> 2 And ISNULL(CveAlmacen, 0) = 0 And ISNULL(AplicaCostoIndirecto, 0) <> 1 And CveClasificacion = {0} And CveSubProyecto = {1} And ISNULL(CveTipoGasto, 0) = {2} Then", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("CveTipoGasto").ToString.ToEntero)).ToString.ToDecimal
|
||||||
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
|
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
|
||||||
'CLASIFICACION
|
'CLASIFICACION
|
||||||
If Row2("CveClasificacion").ToString.ToEntero > 0 Then
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso Row2("CveClasificacion").ToString.ToEntero > 0 Then
|
||||||
If ObjConta.GetRetCuenta(6, Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero) Then
|
If ObjConta.GetRetCuenta(6, Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero) Then
|
||||||
If ObjConta.DtResultados.Rows.Count > 0 AndAlso ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero > 0 Then
|
If ObjConta.DtResultados.Rows.Count > 0 AndAlso ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero > 0 Then
|
||||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero
|
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero
|
||||||
@@ -6133,7 +6131,7 @@ Partial Class Compras_Compras
|
|||||||
ConceptoContable = 288
|
ConceptoContable = 288
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
|
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
@@ -6145,7 +6143,7 @@ Partial Class Compras_Compras
|
|||||||
IdCtaIva = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
IdCtaIva = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
||||||
Dim ttConceptoContable As Integer = 14
|
Dim ttConceptoContable As Integer = 14
|
||||||
|
|
||||||
If ObjConta.GetRetCuenta(ttConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaIva > 0 Then
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(ttConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaIva > 0 Then
|
||||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||||
IdCtaIva = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
|
IdCtaIva = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
@@ -6171,7 +6169,7 @@ Partial Class Compras_Compras
|
|||||||
If chkImportacion.Checked Then
|
If chkImportacion.Checked Then
|
||||||
ConceptoContable = 287
|
ConceptoContable = 287
|
||||||
End If
|
End If
|
||||||
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
|
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
@@ -6208,7 +6206,7 @@ Partial Class Compras_Compras
|
|||||||
If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
|
If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
|
||||||
PorcentajeImpuesto = PorcentajeIVA
|
PorcentajeImpuesto = PorcentajeIVA
|
||||||
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
||||||
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
|
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
@@ -6221,7 +6219,7 @@ Partial Class Compras_Compras
|
|||||||
importeMovimiento = ImporteIEPSxAcreditar
|
importeMovimiento = ImporteIEPSxAcreditar
|
||||||
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
|
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
|
||||||
If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
|
If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
|
||||||
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
||||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
|
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
@@ -10376,162 +10374,21 @@ Partial Class Compras_Compras
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If Retorno AndAlso (CveRetIVAConceptoOriginal <> DdlRetIVAConcepto.SelectedValue.ToEntero OrElse CveRetISRConceptoOriginal <> DdlRetISRConcepto.SelectedValue.ToEntero) Then
|
||||||
|
Dim tCveConceptoIVA, tCveConceptoISR As Integer
|
||||||
|
|
||||||
If Retorno AndAlso (CveRetIVAConceptoOriginal <> DdlRetIVAConcepto.SelectedValue.ToEntero Or CveRetISRConceptoOriginal <> DdlRetISRConcepto.SelectedValue.ToEntero) Then
|
If CveRetIVAConceptoOriginal <> DdlRetIVAConcepto.SelectedValue.ToEntero Then tCveConceptoIVA = DdlRetIVAConcepto.SelectedValue.ToEntero
|
||||||
If ObjCompra.GetComprasPrepolizasRetIvaRetISRActualiza(CveCompra, CveRetIVAConceptoOriginal, CveRetISRConceptoOriginal) Then
|
If CveRetISRConceptoOriginal <> DdlRetISRConcepto.SelectedValue.ToEntero Then tCveConceptoISR = DdlRetISRConcepto.SelectedValue.ToEntero
|
||||||
|
|
||||||
Dim DTPRePolizaDesbloquedo As DataTable = ObjCompra.DtResultados.FiltraParametros("", "", {"CvePrePoliza", "Bloqueado"})
|
|
||||||
Dim DTPRePolizaDes As DataTable = ObjCompra.DtResultados
|
|
||||||
|
|
||||||
If DTPRePolizaDesbloquedo IsNot Nothing Then
|
|
||||||
|
|
||||||
For Each dr1 As DataRow In DTPRePolizaDesbloquedo.Rows
|
|
||||||
|
|
||||||
If Boolean.Parse(dr1("Bloqueado").ToString) Then
|
|
||||||
|
|
||||||
If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
|
|
||||||
Retorno = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Next
|
|
||||||
|
|
||||||
If Retorno Then
|
|
||||||
|
|
||||||
For Each dr2 As DataRow In DTPRePolizaDes.Rows
|
|
||||||
|
|
||||||
Dim CveConceptoContableOriginal As Integer = dr2("CveConceptoContable").ToString.ToEntero
|
|
||||||
Dim CveConceptoContableNuvo As Integer = -1
|
|
||||||
|
|
||||||
If dr2("Tipo").ToString = "IVA" Then
|
|
||||||
|
|
||||||
Select Case DdlRetIVAConcepto.SelectedValue.ToEntero
|
|
||||||
Case 1
|
|
||||||
|
|
||||||
If CveConceptoContableOriginal.Contiene(184, 186, 249, 286) Then
|
|
||||||
CveConceptoContableNuvo = 15
|
|
||||||
ElseIf CveConceptoContableOriginal.Contiene(183, 185, 248, 285) Then
|
|
||||||
CveConceptoContableNuvo = 22
|
|
||||||
End If
|
|
||||||
|
|
||||||
Exit Select
|
|
||||||
Case 2
|
|
||||||
|
|
||||||
If CveConceptoContableOriginal.Contiene(22, 186, 249, 286) Then
|
|
||||||
CveConceptoContableNuvo = 184
|
|
||||||
ElseIf CveConceptoContableOriginal.Contiene(15, 185, 248, 285) Then
|
|
||||||
CveConceptoContableNuvo = 183
|
|
||||||
End If
|
|
||||||
|
|
||||||
Exit Select
|
|
||||||
Case 3
|
|
||||||
|
|
||||||
If CveConceptoContableOriginal.Contiene(22, 184, 249, 286) Then
|
|
||||||
CveConceptoContableNuvo = 186
|
|
||||||
ElseIf CveConceptoContableOriginal.Contiene(15, 183, 248, 285) Then
|
|
||||||
CveConceptoContableNuvo = 187
|
|
||||||
End If
|
|
||||||
|
|
||||||
Exit Select
|
|
||||||
Case 4
|
|
||||||
|
|
||||||
If CveConceptoContableOriginal.Contiene(22, 184, 186, 286) Then
|
|
||||||
CveConceptoContableNuvo = 249
|
|
||||||
ElseIf CveConceptoContableOriginal.Contiene(15, 183, 185, 285) Then
|
|
||||||
CveConceptoContableNuvo = 248
|
|
||||||
End If
|
|
||||||
|
|
||||||
Exit Select
|
|
||||||
Case 5
|
|
||||||
|
|
||||||
If CveConceptoContableOriginal.Contiene(22, 184, 186, 249) Then
|
|
||||||
CveConceptoContableNuvo = 286
|
|
||||||
ElseIf CveConceptoContableOriginal.Contiene(15, 183, 185, 248) Then
|
|
||||||
CveConceptoContableNuvo = 285
|
|
||||||
End If
|
|
||||||
|
|
||||||
Exit Select
|
|
||||||
End Select
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
If dr2("Tipo").ToString = "ISR" Then
|
|
||||||
Select Case DdlRetISRConcepto.SelectedValue.ToEntero
|
|
||||||
Case 1
|
|
||||||
|
|
||||||
If CveConceptoContableOriginal.Contiene(244, 328) Then
|
|
||||||
CveConceptoContableNuvo = 23
|
|
||||||
ElseIf CveConceptoContableOriginal.Contiene(243, 327) Then
|
|
||||||
CveConceptoContableNuvo = 16
|
|
||||||
End If
|
|
||||||
|
|
||||||
Exit Select
|
|
||||||
Case 2
|
|
||||||
|
|
||||||
If CveConceptoContableOriginal.Contiene(23, 328) Then
|
|
||||||
CveConceptoContableNuvo = 244
|
|
||||||
ElseIf CveConceptoContableOriginal.Contiene(16, 327) Then
|
|
||||||
CveConceptoContableNuvo = 243
|
|
||||||
End If
|
|
||||||
|
|
||||||
Exit Select
|
|
||||||
Case 3
|
|
||||||
|
|
||||||
If CveConceptoContableOriginal.Contiene(23, 244) Then
|
|
||||||
CveConceptoContableNuvo = 328
|
|
||||||
ElseIf CveConceptoContableOriginal.Contiene(16, 243) Then
|
|
||||||
CveConceptoContableNuvo = 327
|
|
||||||
End If
|
|
||||||
|
|
||||||
Exit Select
|
|
||||||
End Select
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
If Not (CveConceptoContableNuvo > 0 AndAlso ObjCompra.UpdateComprasPrepolizasRetIvaRetISRActualiza(dr2("CvePrePolizaDetalle").ToString.ToEntero, CveConceptoContableNuvo)) Then
|
|
||||||
Retorno = False
|
|
||||||
If CveConceptoContableNuvo <= 0 Then
|
|
||||||
Alert("Se presento un error al asiganar el nuevo concepto de retención", TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Next
|
|
||||||
|
|
||||||
For Each dr1 As DataRow In DTPRePolizaDesbloquedo.Rows
|
|
||||||
|
|
||||||
If Boolean.Parse(dr1("Bloqueado").ToString) Then
|
|
||||||
If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, True) Then
|
|
||||||
Retorno = False
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
Next
|
|
||||||
|
|
||||||
If Retorno Then
|
|
||||||
|
|
||||||
If CveRetIVAConceptoOriginal > 0 Then
|
|
||||||
CveRetIVAConceptoOriginal = DdlRetIVAConcepto.SelectedValue.ToEntero
|
|
||||||
End If
|
|
||||||
|
|
||||||
If CveRetISRConceptoOriginal > 0 Then
|
|
||||||
CveRetISRConceptoOriginal = DdlRetISRConcepto.SelectedValue.ToEntero
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
Retorno = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
If ObjCompra.UpdateComprasRetencionesUpdate(tCveConceptoIVA, tCveConceptoISR, CveCompra) Then
|
||||||
|
If tCveConceptoIVA > 0 Then CveRetIVAConceptoOriginal = tCveConceptoIVA
|
||||||
|
If tCveConceptoISR > 0 Then CveRetISRConceptoOriginal = tCveConceptoISR
|
||||||
|
Else
|
||||||
|
|
||||||
|
Retorno = False
|
||||||
|
Alert("Se presento un error al asignar el nuevo concepto de retención", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user