Merge branch 'master' of http://jperez@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -148,7 +148,14 @@ Partial Class Bancos_IE
|
||||
End Property
|
||||
Private Property SerieFolioDeCDin As String
|
||||
Get
|
||||
Return ViewState("SerieFolioDeCDin").ToString
|
||||
|
||||
If ViewState("SerieFolioDeCDin") Is Nothing Then
|
||||
Return ""
|
||||
Else
|
||||
Return ViewState("SerieFolioDeCDin").ToString
|
||||
End If
|
||||
|
||||
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("SerieFolioDeCDin") = value
|
||||
@@ -438,7 +445,12 @@ Partial Class Bancos_IE
|
||||
End Property
|
||||
Private Property CveCorte As Integer
|
||||
Get
|
||||
Return IfNull(ViewState("CveCorte"), -1, ViewState("CveCorte").ToString().ToString()).ToString().ToEntero()
|
||||
If ViewState("CveCorte") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("CveCorte").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveCorte") = value
|
||||
@@ -446,6 +458,21 @@ Partial Class Bancos_IE
|
||||
End Property
|
||||
|
||||
|
||||
Private Property Masivonotas As Boolean
|
||||
Get
|
||||
|
||||
If ViewState("Masivonotas") Is Nothing Then
|
||||
Return False
|
||||
Else
|
||||
Return Boolean.Parse(ViewState("Masivonotas").ToString)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("Masivonotas") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CANCELACIÓN COMPLEMENTO MODAL V2"
|
||||
|
||||
Property CveComplementoPagoCancelar As Integer
|
||||
@@ -572,6 +599,8 @@ Partial Class Bancos_IE
|
||||
'Guarda el modo actual de la pagina
|
||||
Opcion = If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "-1")
|
||||
|
||||
Masivonotas = If(Request("Masivo") IsNot Nothing, True, False)
|
||||
|
||||
Session("FileUpload") = ""
|
||||
TRCveIE.Visible = False
|
||||
|
||||
@@ -604,6 +633,18 @@ Partial Class Bancos_IE
|
||||
CargaProveedor(CveProveedor, "-1")
|
||||
End If
|
||||
|
||||
|
||||
If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinC" AndAlso Request("CveProveedor") IsNot Nothing AndAlso IsNumeric(Request("CveProveedor")) AndAlso Request("CveProveedor").ToEntero > 0 Then
|
||||
If Masivonotas Then
|
||||
'CargaNotas()
|
||||
DVDevolucion.Visible = True
|
||||
HdnCveProveedor.Value = Request("CveProveedor")
|
||||
DivOtrosIngresosEgresos.Visible = False
|
||||
End If
|
||||
TxtImporte.Attributes.Add("onkeypress", "javascript: return false;")
|
||||
End If
|
||||
|
||||
|
||||
If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then
|
||||
LblPagueseA.Text = ""
|
||||
LblPagueseA.Visible = False
|
||||
@@ -1225,6 +1266,7 @@ Partial Class Bancos_IE
|
||||
Dim EsDevolucion As Boolean = False
|
||||
|
||||
If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinC" Then
|
||||
CveIE = -1
|
||||
EsDevolucion = True
|
||||
RBL.SelectedValue = "P"
|
||||
RBL.Enabled = False
|
||||
@@ -1237,6 +1279,8 @@ Partial Class Bancos_IE
|
||||
DdlProveedores.SelectedValue = ObjProveedor.CveProveedor.ToString
|
||||
DivOtrosIngresosEgresos.Visible = True
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Select Case RBL.SelectedValue
|
||||
@@ -1289,6 +1333,78 @@ Partial Class Bancos_IE
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Private Sub CargaNotas(CvemonedaInterna As Integer)
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
|
||||
If CvemonedaInterna > 0 Then
|
||||
If ObjMovtos.GetAnticiposProveedor(CveProveedor, -1, CvemonedaInterna, -1) AndAlso ObjMovtos.DtResultados.FiltraParametros("TipoDocto = 'NC'").Rows.Count > 0 Then
|
||||
GvA.DataSource = ObjMovtos.DtResultados.FiltraParametros("TipoDocto = 'NC' and Saldo > 0 and CveCompra > 0")
|
||||
|
||||
Else
|
||||
GvA.DataSource = Nothing
|
||||
End If
|
||||
Else
|
||||
GvA.DataSource = Nothing
|
||||
End If
|
||||
|
||||
|
||||
ObjMovtos.Dispose()
|
||||
|
||||
|
||||
GvA.DataBind()
|
||||
UpGvNotas.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvAH_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvA.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.RowIndex = 0 Then 'e.Row.BackColor = Drawing.Color.LightGray
|
||||
|
||||
e.Row.Cells(1).Width = Unit.Pixel(120)
|
||||
e.Row.Cells(2).Width = Unit.Pixel(100)
|
||||
e.Row.Cells(3).Width = Unit.Pixel(100)
|
||||
e.Row.Cells(4).Width = Unit.Pixel(100)
|
||||
End If
|
||||
|
||||
'If e.Row.DBCampo("TipoDocto") = "Egsc" AndAlso e.Row.DBCampo("SerieFolio") = "" Then
|
||||
' e.Row.CssClass = "Totales TextCenter"
|
||||
' e.Row.Cells(1).Text = "Egreso Por Comprobar"
|
||||
'End If
|
||||
|
||||
'If e.Row.DBCampo("TipoDocto") = "Ant" AndAlso e.Row.DBCampo("SerieFolio") = "" Then
|
||||
' e.Row.CssClass = "Totales TextCenter"
|
||||
' e.Row.Cells(1).Text = "Anticipos"
|
||||
'End If
|
||||
|
||||
If e.Row.DBCampo("TipoDocto") = "NC" AndAlso e.Row.DataKey("CveCompra").ToString.ToEntero > 0 Then
|
||||
e.Row.FCCheckBox("Chk").InputAttributes.Add("data-saldo", e.Row.DataKey("Saldo"))
|
||||
End If
|
||||
|
||||
'If e.Row.DBCampo("TipoDocto") = "DEV" AndAlso e.Row.DBCampo("SerieFolio") = "" Then
|
||||
' e.Row.CssClass = "Totales TextCenter"
|
||||
' e.Row.Cells(0).Text = "Devolución"
|
||||
'End If
|
||||
|
||||
'If e.Row.DBCampo("CveProveedor") = "" Then
|
||||
' e.Row.BackColor = Drawing.Color.LightGray
|
||||
'End If
|
||||
|
||||
'If UsuarioActual.TienePermisoProceso(273) Then
|
||||
' If CType(sender, GridView).ID = "GvA" And e.Row.DBCampo("CveCompra").ToEntero > 0 And e.Row.DBCampo("TipoDocto") = "NC" Then
|
||||
' Dim Parametros = Encripta($"CveCompra={e.Row.DBCampo("CveCompra").ToEntero}&SerieFolio={e.Row.DBCampo("SerieFolio")}&CveMoneda={e.Row.DBCampo("CveMoneda")}&CveProveedor={CveProveedor}&Saldo={e.Row.DBCampo("Saldo")}&Original={e.Row.DBCampo("Original")}&CvePrePoliza={e.Row.DBCampo("CvePrePoliza")}&FechaCompra={e.Row.DBCampo("Fecha")}")
|
||||
' e.Row.FCHyperLink("HLDevolverDinero").Visible = True
|
||||
' e.Row.FCHyperLink("HLDevolverDinero").NavigateUrl = $"/Bancos/IE.aspx?Opcion=DevDinC&P={Parametros}"
|
||||
' End If
|
||||
'End If
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#Region " CARGA CLIENTE "
|
||||
Protected Sub DdlCliente_selectedindexchange(sender As Object, e As EventArgs)
|
||||
HdnCveCliente.Value = DdlCliente.SelectedValue
|
||||
@@ -1445,6 +1561,15 @@ Partial Class Bancos_IE
|
||||
Banco.Dispose()
|
||||
TxtFolio.Text = Folio.ToString
|
||||
|
||||
Dim drI As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuenta.SelectedValue))
|
||||
|
||||
If drI IsNot Nothing Then
|
||||
CargaNotas(drI("CveMoneda").ToString.ToEntero)
|
||||
Else
|
||||
CargaNotas(-1)
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
TxtFolio.Text = ""
|
||||
End If
|
||||
@@ -1676,7 +1801,7 @@ Partial Class Bancos_IE
|
||||
|
||||
|
||||
|
||||
If Opcion = "DevDinC" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Then
|
||||
If Opcion = "DevDinC" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Or Opcion = "DevDinC" AndAlso Masivonotas Then
|
||||
DdlTipoTransaccion.DataSource = dt.FiltraParametros("Tipo = 'Ing' ")
|
||||
Else
|
||||
DdlTipoTransaccion.DataSource = dt
|
||||
@@ -2862,235 +2987,513 @@ Partial Class Bancos_IE
|
||||
End If
|
||||
|
||||
Dim TCCompra As Decimal = 1
|
||||
Dim TCDocumento As Decimal = 1
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
TCCompra = GlobalTipoCambio(FechaCompra).ToDecimal
|
||||
TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'BANCOS
|
||||
Dim TCDocumento As Decimal = 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'BANCOS
|
||||
IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0)
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
|
||||
'BANCOS COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL()
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrara el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
End If
|
||||
|
||||
'OTROS INGRESOS/EGRESOS
|
||||
If TxtOtrosIngresosEgresos.Text.ToDecimal <> 0 Then
|
||||
Dim Impo As Decimal = TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
Dim TipoMovtoIE As Boolean = False
|
||||
Dim CveConcIE As Integer = 78
|
||||
If Impo > 0 Then
|
||||
TipoMovtoIE = True
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 78
|
||||
IdCtaContableAplicar = UsuarioActual.Empresa.IdCuentaOtrosIngresos
|
||||
Else
|
||||
TipoMovtoIE = False
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 211
|
||||
IdCtaContableAplicar = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
|
||||
|
||||
If Masivonotas Then
|
||||
|
||||
For Each GvRow As GridViewRow In GvA.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCCheckBox("Chk").Checked Then
|
||||
|
||||
|
||||
Dim FechaCompraNota As Date = GvRow.DataKey("Fecha").ToDate
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
TCCompra = GlobalTipoCambio(FechaCompraNota).ToDecimal
|
||||
TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If TCDocumento <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
ImporteAplicar = GvRow.DataKey("Saldo").ToDecimal
|
||||
ImporteAplicarME = ImporteAplicar
|
||||
|
||||
|
||||
'CONSIDERA COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
ImporteAplicarMN = ImporteAplicar
|
||||
Else
|
||||
ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL()
|
||||
End If
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
TCCompra = GlobalTipoCambio(GvRow.DataKey("Fecha").ToDate).ToDecimal
|
||||
TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If TCDocumento <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ConceptoAplicar = $"Devolución de Proveedor {PagueseA} {ImporteAplicar} NC:{GvRow.DataKey("SerieFolio")}"
|
||||
|
||||
CveCompraDeCDin = GvRow.DataKey("CveCompra").ToEntero
|
||||
|
||||
''
|
||||
|
||||
'BANCOS COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL()
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrara el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
End If
|
||||
|
||||
''OTROS INGRESOS/EGRESOS
|
||||
'If TxtOtrosIngresosEgresos.Text.ToDecimal <> 0 Then
|
||||
' Dim Impo As Decimal = TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
' Dim TipoMovtoIE As Boolean = False
|
||||
' Dim CveConcIE As Integer = 78
|
||||
' If Impo > 0 Then
|
||||
' TipoMovtoIE = True
|
||||
' Impo = Math.Abs(Impo)
|
||||
' CveConcIE = 78
|
||||
' IdCtaContableAplicar = UsuarioActual.Empresa.IdCuentaOtrosIngresos
|
||||
' Else
|
||||
' TipoMovtoIE = False
|
||||
' Impo = Math.Abs(Impo)
|
||||
' CveConcIE = 211
|
||||
' IdCtaContableAplicar = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
|
||||
' End If
|
||||
|
||||
|
||||
' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, Impo, ReferenciaAplicar, CveConcIE, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=Impo, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
' MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
' Exit Select
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'CANCELA NC
|
||||
IdCtaContableAplicar = IDCtaBeneficiario
|
||||
ImporteAplicar = ImporteAplicar '- TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
ImporteAplicarMN = ImporteAplicar ' (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 18, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=(ImporteAplicarMN), ImporteME:=ImporteAplicarME, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'NC COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCCompra)) - ImporteAplicar).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -(ImporteAplicar), ReferenciaAplicar, 201, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-(ImporteAplicarMN), ImporteME:=-(ImporteAplicarME), CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If TCCompra <> TCDocumento Then
|
||||
|
||||
Dim DiferenciaTC As Decimal = TCCompra - TCDocumento
|
||||
|
||||
Dim DiferenciaImportes As Decimal = Math.Abs((ImporteAplicar * TCCompra) - (ImporteAplicar * TCDocumento))
|
||||
|
||||
If DiferenciaTC < 0 Then
|
||||
'64
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaImportes, ReferenciaAplicar, 64, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de ganancia cambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
Else
|
||||
'65
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, DiferenciaImportes, ReferenciaAplicar, 65, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de perdidada cfambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'IMPUESTOS
|
||||
|
||||
Dim PorcentajePagoDevDin = (ImporteAplicar / ImporteAplicar).RoundSQL(6)
|
||||
Dim CveConceptoContableAplciar = -1
|
||||
'Dim TipoMovtoAplicar = False
|
||||
|
||||
|
||||
Dim ObjCompras As New ClsCompras()
|
||||
If ObjCompras.GetCompras(CveCompraDeCDin, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Dim dr As DataRow = ObjCompras.DtResultados.Rows(0)
|
||||
If dr IsNot Nothing Then
|
||||
|
||||
Dim CveMonedaDev As Integer = dr("CveMoneda").ToString.ToEntero
|
||||
Dim TotalCompraDev As Decimal = dr("Total").ToString.ToDecimal
|
||||
|
||||
Dim IVADev As Decimal = dr("IVA").ToString.ToDecimal
|
||||
Dim IEPSDev As Decimal = dr("IEPS").ToString.ToDecimal
|
||||
PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal
|
||||
|
||||
Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC)
|
||||
Dim CveCuentaIVAxAcreditarDevDinC = 0
|
||||
Dim CveCuentaIVAAcreditableDevDinC = 0
|
||||
Dim IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
Dim IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
|
||||
|
||||
Dim IVADevMN As Decimal = 0
|
||||
Dim IEPSDevMN As Decimal = 0
|
||||
|
||||
|
||||
Dim PorcentajeDevolucion As Decimal = ((ImporteAplicar * 100D / TotalCompraDev) / 100).RoundSQL(2)
|
||||
|
||||
IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2)
|
||||
IEPSDev = Math.Round(IEPSDev * PorcentajeDevolucion, 2)
|
||||
|
||||
Dim CveCuentaDevolucionIMPUESTOS As Integer = -1
|
||||
Dim IdCtaIVADevolucionIMPUESTOS As Integer = -1
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
IVADevMN = IVADev
|
||||
IEPSDevMN = IEPSDev
|
||||
Else
|
||||
IVADevMN = (IVADev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
IEPSDevMN = (IEPSDev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
End If
|
||||
|
||||
|
||||
Dim ErrorDevolucionImpuestos As Boolean = False
|
||||
|
||||
If IVADev > 0 Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAxAcreditarDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAAcreditableDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If IEPSDev > 0 Then
|
||||
'Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjMov.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IEPSDev, ReferenciaAplicar, 25, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
If ObjMov.GetRetCuenta(26, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IEPSDev, ReferenciaAplicar, 26, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorDevolucionImpuestos Then
|
||||
MsgError = MsgError & " Error en devolución compra."
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
''
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
Else
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
TCCompra = GlobalTipoCambio(FechaCompra).ToDecimal
|
||||
TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal
|
||||
|
||||
If TCCompra <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If TCDocumento <= 0 Then
|
||||
Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, Impo, ReferenciaAplicar, CveConcIE, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=Impo, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
'BANCOS COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL()
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrara el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
End If
|
||||
|
||||
'OTROS INGRESOS/EGRESOS
|
||||
If TxtOtrosIngresosEgresos.Text.ToDecimal <> 0 Then
|
||||
Dim Impo As Decimal = TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
Dim TipoMovtoIE As Boolean = False
|
||||
Dim CveConcIE As Integer = 78
|
||||
If Impo > 0 Then
|
||||
TipoMovtoIE = True
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 78
|
||||
IdCtaContableAplicar = UsuarioActual.Empresa.IdCuentaOtrosIngresos
|
||||
Else
|
||||
TipoMovtoIE = False
|
||||
Impo = Math.Abs(Impo)
|
||||
CveConcIE = 211
|
||||
IdCtaContableAplicar = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
|
||||
End If
|
||||
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, Impo, ReferenciaAplicar, CveConcIE, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=Impo, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
End If
|
||||
|
||||
'CANCELA NC
|
||||
IdCtaContableAplicar = IDCtaBeneficiario
|
||||
ImporteAplicar = ImporteAplicar - TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
ImporteAplicarMN = ImporteAplicar ' (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 18, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=(ImporteAplicarMN), ImporteME:=ImporteAplicarME, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
End If
|
||||
|
||||
'CANCELA NC
|
||||
IdCtaContableAplicar = IDCtaBeneficiario
|
||||
ImporteAplicar = ImporteAplicar - TxtOtrosIngresosEgresos.Text.ToDecimal
|
||||
ImporteAplicarMN = ImporteAplicar ' (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 18, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=(ImporteAplicarMN), ImporteME:=ImporteAplicarME, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
|
||||
'NC COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCCompra)) - ImporteAplicar).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -(ImporteAplicar), ReferenciaAplicar, 201, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-(ImporteAplicarMN), ImporteME:=-(ImporteAplicarME), CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If TCCompra <> TCDocumento Then
|
||||
|
||||
Dim DiferenciaTC As Decimal = TCCompra - TCDocumento
|
||||
|
||||
Dim DiferenciaImportes As Decimal = Math.Abs((ImporteAplicar * TCCompra) - (ImporteAplicar * TCDocumento))
|
||||
|
||||
If DiferenciaTC < 0 Then
|
||||
'64
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaImportes, ReferenciaAplicar, 64, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de ganancia cambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
Else
|
||||
'65
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, DiferenciaImportes, ReferenciaAplicar, 65, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de perdidada cfambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'IMPUESTOS
|
||||
|
||||
Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6)
|
||||
Dim CveConceptoContableAplciar = -1
|
||||
Dim TipoMovtoAplicar = False
|
||||
|
||||
|
||||
Dim ObjCompras As New ClsCompras()
|
||||
If ObjCompras.GetCompras(CveCompraDeCDin, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Dim dr As DataRow = ObjCompras.DtResultados.Rows(0)
|
||||
If dr IsNot Nothing Then
|
||||
|
||||
Dim CveMonedaDev As Integer = dr("CveMoneda").ToString.ToEntero
|
||||
Dim TotalCompraDev As Decimal = dr("Total").ToString.ToDecimal
|
||||
|
||||
Dim IVADev As Decimal = dr("IVA").ToString.ToDecimal
|
||||
Dim IEPSDev As Decimal = dr("IEPS").ToString.ToDecimal
|
||||
PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal
|
||||
|
||||
Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC)
|
||||
Dim CveCuentaIVAxAcreditarDevDinC = 0
|
||||
Dim CveCuentaIVAAcreditableDevDinC = 0
|
||||
Dim IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
Dim IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
|
||||
|
||||
Dim IVADevMN As Decimal = 0
|
||||
Dim IEPSDevMN As Decimal = 0
|
||||
|
||||
|
||||
Dim PorcentajeDevolucion As Decimal = ((TxtImporte.Text.ToDecimal * 100D / TotalCompraDev) / 100).RoundSQL(2)
|
||||
|
||||
IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2)
|
||||
IEPSDev = Math.Round(IEPSDev * PorcentajeDevolucion, 2)
|
||||
|
||||
Dim CveCuentaDevolucionIMPUESTOS As Integer = -1
|
||||
Dim IdCtaIVADevolucionIMPUESTOS As Integer = -1
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
IVADevMN = IVADev
|
||||
IEPSDevMN = IEPSDev
|
||||
Else
|
||||
IVADevMN = (IVADev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
IEPSDevMN = (IEPSDev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
End If
|
||||
|
||||
|
||||
Dim ErrorDevolucionImpuestos As Boolean = False
|
||||
|
||||
If IVADev > 0 Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAxAcreditarDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoAplicar, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAAcreditableDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If IEPSDev > 0 Then
|
||||
'Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjMov.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IEPSDev, ReferenciaAplicar, 25, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
If ObjMov.GetRetCuenta(26, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IEPSDev, ReferenciaAplicar, 26, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorDevolucionImpuestos Then
|
||||
MsgError = MsgError & " Error en devolución compra."
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'NC COMPLEMENTARIA
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
|
||||
ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCCompra)) - ImporteAplicar).RoundSQL()
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -(ImporteAplicar), ReferenciaAplicar, 201, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-(ImporteAplicarMN), ImporteME:=-(ImporteAplicarME), CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución"
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If TCCompra <> TCDocumento Then
|
||||
|
||||
Dim DiferenciaTC As Decimal = TCCompra - TCDocumento
|
||||
|
||||
Dim DiferenciaImportes As Decimal = Math.Abs((ImporteAplicar * TCCompra) - (ImporteAplicar * TCDocumento))
|
||||
|
||||
If DiferenciaTC < 0 Then
|
||||
'64
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaImportes, ReferenciaAplicar, 64, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de ganancia cambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
Else
|
||||
'65
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, DiferenciaImportes, ReferenciaAplicar, 65, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de perdidada cfambiaria"
|
||||
Exit Select
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'IMPUESTOS
|
||||
|
||||
Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6)
|
||||
Dim CveConceptoContableAplciar = -1
|
||||
'Dim TipoMovtoAplicar = False
|
||||
|
||||
|
||||
Dim ObjCompras As New ClsCompras()
|
||||
If ObjCompras.GetCompras(CveCompraDeCDin, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Dim dr As DataRow = ObjCompras.DtResultados.Rows(0)
|
||||
If dr IsNot Nothing Then
|
||||
|
||||
Dim CveMonedaDev As Integer = dr("CveMoneda").ToString.ToEntero
|
||||
Dim TotalCompraDev As Decimal = dr("Total").ToString.ToDecimal
|
||||
|
||||
Dim IVADev As Decimal = dr("IVA").ToString.ToDecimal
|
||||
Dim IEPSDev As Decimal = dr("IEPS").ToString.ToDecimal
|
||||
PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal
|
||||
|
||||
Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC)
|
||||
Dim CveCuentaIVAxAcreditarDevDinC = 0
|
||||
Dim CveCuentaIVAAcreditableDevDinC = 0
|
||||
Dim IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
Dim IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
|
||||
|
||||
Dim IVADevMN As Decimal = 0
|
||||
Dim IEPSDevMN As Decimal = 0
|
||||
|
||||
|
||||
Dim PorcentajeDevolucion As Decimal = ((TxtImporte.Text.ToDecimal * 100D / TotalCompraDev) / 100).RoundSQL(2)
|
||||
|
||||
IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2)
|
||||
IEPSDev = Math.Round(IEPSDev * PorcentajeDevolucion, 2)
|
||||
|
||||
Dim CveCuentaDevolucionIMPUESTOS As Integer = -1
|
||||
Dim IdCtaIVADevolucionIMPUESTOS As Integer = -1
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then
|
||||
IVADevMN = IVADev
|
||||
IEPSDevMN = IEPSDev
|
||||
Else
|
||||
IVADevMN = (IVADev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
IEPSDevMN = (IEPSDev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2)
|
||||
End If
|
||||
|
||||
|
||||
Dim ErrorDevolucionImpuestos As Boolean = False
|
||||
|
||||
If IVADev > 0 Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAxAcreditarDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
CveCuentaDevolucionIMPUESTOS = CveCuentaIVAAcreditableDevDinC
|
||||
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If IEPSDev > 0 Then
|
||||
'Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjMov.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
|
||||
|
||||
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IEPSDev, ReferenciaAplicar, 25, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
|
||||
If ObjMov.GetRetCuenta(26, UsuarioActual.CveEmpresa) Then
|
||||
Try
|
||||
CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero
|
||||
IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IEPSDev, ReferenciaAplicar, 26, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución "
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
|
||||
ErrorDevolucionImpuestos = True
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al obtener las cuentas de IEPS acreditable.")
|
||||
ErrorDevolucionImpuestos = True
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorDevolucionImpuestos Then
|
||||
MsgError = MsgError & " Error en devolución compra."
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
Case "EGSCREDITO"
|
||||
|
||||
Dim ConceptoContable As Integer
|
||||
@@ -3276,7 +3679,7 @@ Partial Class Bancos_IE
|
||||
End If
|
||||
|
||||
'Notificación de Pago
|
||||
If TxtNotificarA.Text.Trim <> "" Then
|
||||
If TxtNotificarA.Text.Trim <> "" And MsgError = "" Then
|
||||
NotificacionPago(CveIE, TxtNotificarA.Text.Trim)
|
||||
End If
|
||||
|
||||
@@ -5335,6 +5738,11 @@ Partial Class Bancos_IE
|
||||
TxtImporteLetra.Text = UrlParametros("SALDO").ToString.ToDouble.Texto2Letras(UrlParametros("CVEMONEDA").ToString.ToEntero)
|
||||
|
||||
CargaProveedor(CveProveedor, "-1")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'BuscarCliente()
|
||||
|
||||
DdlMoneda.SelectedValue = UrlParametros("CVEMONEDA").ToString
|
||||
|
||||
Reference in New Issue
Block a user