Compras Actualizar Conceptos Retencion IVA, Retencion ISR
This commit is contained in:
@@ -1126,6 +1126,37 @@ Partial Class Compras_Compras
|
||||
|
||||
|
||||
|
||||
|
||||
Private Property CveRetISRConceptoOriginal As Integer
|
||||
Get
|
||||
|
||||
If ViewState("CveRetISRConceptoOriginal") Is Nothing Then
|
||||
ViewState("CveRetISRConceptoOriginal") = -1
|
||||
End If
|
||||
|
||||
Return ViewState("CveRetISRConceptoOriginal").ToString.ToEntero
|
||||
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveRetISRConceptoOriginal") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveRetIVAConceptoOriginal As Integer
|
||||
Get
|
||||
If ViewState("CveRetIVAConceptoOriginal") Is Nothing Then
|
||||
ViewState("CveRetIVAConceptoOriginal") = -1
|
||||
End If
|
||||
Return ViewState("CveRetIVAConceptoOriginal").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveRetIVAConceptoOriginal") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip")
|
||||
@@ -2576,6 +2607,11 @@ Partial Class Compras_Compras
|
||||
|
||||
DdlRetIVAConcepto.SelectedValueExist(dr("CveRetIVAConcepto").ToString)
|
||||
DdlRetISRConcepto.SelectedValueExist(dr("CveRetISRConcepto").ToString)
|
||||
|
||||
CveRetIVAConceptoOriginal = If(dr("CveRetIVAConcepto").ToString.ToEntero > 0, dr("CveRetIVAConcepto").ToString.ToEntero, -1)
|
||||
CveRetISRConceptoOriginal = If(dr("CveRetISRConcepto").ToString.ToEntero > 0, dr("CveRetISRConcepto").ToString.ToEntero, -1)
|
||||
|
||||
|
||||
If dr("CveTipoConcepto").ToString.ToEntero = 1 Then LblProveedor.Text = "Proveedor:" Else LblProveedor.Text = "Acreedor:"
|
||||
|
||||
HdnCveEstatusFactura.Value = dr("CveEstatusFactura").ToString
|
||||
@@ -2844,6 +2880,16 @@ Partial Class Compras_Compras
|
||||
TxtObsPS.Enabled = True
|
||||
LbAgregar.Enabled = True
|
||||
LnkUpdateFechaPago.Visible = True
|
||||
|
||||
If DdlRetIVAConcepto.SelectedValue.ToEntero > 0 Then
|
||||
DdlRetIVAConcepto.Enabled = True
|
||||
End If
|
||||
|
||||
If DdlRetISRConcepto.SelectedValue.ToEntero > 0 Then
|
||||
DdlRetISRConcepto.Enabled = True
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
BtnGuardar.Visible = False
|
||||
@@ -9840,10 +9886,14 @@ Partial Class Compras_Compras
|
||||
'PORCENTAJE IVA
|
||||
Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
|
||||
|
||||
|
||||
Dim TmpCveRetIVAConcepto As Integer = If(CveRetIVAConceptoOriginal <> DdlRetIVAConcepto.SelectedValue.ToEntero, DdlRetIVAConcepto.SelectedValue.ToEntero, -1)
|
||||
Dim TmpCveRetISRConcepto As Integer = If(CveRetISRConceptoOriginal <> DdlRetISRConcepto.SelectedValue.ToEntero, DdlRetISRConcepto.SelectedValue.ToEntero, -1)
|
||||
|
||||
If ObjCompra.UpdateCompra(TxtDescripcion.Text.Trim, TxtFolioSecundario.Text.Trim, TxtFechaPago.Text.ToDate, ChkAplicaNotaCredito.Checked, TxtObsFact.Text.Trim, CveEstatusFactura,
|
||||
TxtDescuento.Text.ToDouble, TxtSubTotal.Text.ToDouble, TxtIVA.Text.ToDouble, TxtTotal.Text.ToDouble,
|
||||
UsuarioActual.CveUsuario, CveCompra, CveCajaChica:=DdlRembolsoCajaChica.SelectedValue.ToEntero, CvePersonal:=DdlRembolsoPersonal.SelectedValue.ToEntero, CveProveedorSucursal:=If(DdlProveedorSucursal.SelectedValue.ToEntero > 0, DdlProveedorSucursal.SelectedValue.ToEntero, -1), PorcentajeIVA:=PorcentajeIVA, NumeroReembolso:=TxtRembolsoNumero.Text,
|
||||
CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, NoDeducible:=EsNoDeducible) Then
|
||||
CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, NoDeducible:=EsNoDeducible, CveRetIVAConcepto:=TmpCveRetIVAConcepto, CveRetISRConcepto:=TmpCveRetISRConcepto) Then
|
||||
|
||||
If Not ComparaDatatables() Then
|
||||
|
||||
@@ -10336,6 +10386,155 @@ Partial Class Compras_Compras
|
||||
Alert("La compra no se puede actualizar debido a que los totales no son iguales, verifique sus cambios", TipoMensaje.MsgError)
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If Retorno AndAlso (CveRetIVAConceptoOriginal <> DdlRetIVAConcepto.SelectedValue.ToEntero Or CveRetISRConceptoOriginal <> DdlRetISRConcepto.SelectedValue.ToEntero) Then
|
||||
If ObjCompra.GetComprasPrepolizasRetIvaRetISRActualiza(CveCompra, CveRetIVAConceptoOriginal, CveRetISRConceptoOriginal) Then
|
||||
|
||||
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
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
Retorno = False
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Ocurrió un error al actualizar la compra", TipoMensaje.MsgError)
|
||||
ObjCompra.RollBack()
|
||||
|
||||
Reference in New Issue
Block a user