ClsContPAQI Funcion AddMovmientosImpuestos
This commit is contained in:
@@ -526,6 +526,129 @@ Public Class ClsContPAQi
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddMovimientoImpuesto(IdPoliza As Integer, IdCuenta As Integer, IdProveedor As Integer, TasaOCuotaIVA As Double, TasaOCuota As Double, SubTotal As Double, ImpImpuesto As Double, FechaMovto As Date, Referencia As String, Serie As String, Folio As Integer, UUID As String,
|
||||
NoDeducible As Boolean, IVANoAcred As Double, GuidMov As String, GuidMovPadre As String, TipoMovimiento As Integer, Impuesto As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
Dim ConceptoIVA As Integer = 0
|
||||
Dim SubconceptoIVA As Integer = 0
|
||||
Dim ProporcionDIOT As Integer = 100
|
||||
Dim DeducibleDIOT As Integer = 1
|
||||
|
||||
If IdPoliza <= 0 Or IdCuenta <= 0 Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Select Case TasaOCuotaIVA
|
||||
Case 16
|
||||
ConceptoIVA = 1
|
||||
SubconceptoIVA = If(SubTotal > 0, 2, 3)
|
||||
Exit Select
|
||||
Case 8
|
||||
ConceptoIVA = 4
|
||||
SubconceptoIVA = If(SubTotal > 0, 5, 6)
|
||||
Exit Select
|
||||
Case 0
|
||||
ConceptoIVA = 14
|
||||
SubconceptoIVA = If(SubTotal > 0, 15, 16)
|
||||
Exit Select
|
||||
Case Else
|
||||
Return False
|
||||
End Select
|
||||
|
||||
|
||||
If NoDeducible Then
|
||||
ProporcionDIOT = 0
|
||||
DeducibleDIOT = 2
|
||||
End If
|
||||
|
||||
' GuidMov, ConceptoIVA SubconceptoIVA ProporcionDIOT DeducibleDIOT
|
||||
|
||||
StrSQL.Clear()
|
||||
StrSQL.Append(" BEGIN")
|
||||
|
||||
StrSQL.AppendLine(" DECLARE ")
|
||||
StrSQL.AppendLine(" @Error NVARCHAR(300),")
|
||||
StrSQL.AppendLine(" @IdMovDev INT;")
|
||||
StrSQL.AppendLine(" SET NOCOUNT ON;")
|
||||
|
||||
StrSQL.AppendLine(" BEGIN TRY")
|
||||
|
||||
StrSQL.AppendLine(" DECLARE @IdPersona INT = (SELECT TOP 1 PER.Id FROM Proveedores PRO
|
||||
INNER JOIN Personas PER ON PER.Codigo = PRO.CodigoPersona AND PER.EsProveedor = 1
|
||||
WHERE PRO.Id = @IdProveedor);
|
||||
|
||||
IF @IdPersona IS NULL OR @IdPersona <= 0
|
||||
BEGIN
|
||||
DECLARE @ErrorPersona NVARCHAR(300) = Concat('No se encontro el IdPersona del proveedor con id ',@IdProveedor )
|
||||
RAISERROR (@ErrorPersona, 16, 1);
|
||||
END
|
||||
")
|
||||
|
||||
StrSQL.AppendLine("
|
||||
SET @IdMovDev = dbo.FNC_GetCounter ('Id_MovimientoImpuesto');
|
||||
INSERT INTO MovimientosImpuestos
|
||||
(Id,RowVersion, IdPoliza, NumMovto, IdPersona, SistOrig, EjercicioAsignado,PeriodoAsignado, IdCuenta,Captado,AplicaImpuesto,Modificado,
|
||||
Serie, Folio, Referencia, UUID, Origen, OrigenMovto, Computable, TipoMovimiento, TipoFactor, Impuesto, ObjetoImpuesto, NombreImpLocal, TasaOCuota, ImpBase,
|
||||
ImpImpuesto, ImpTotal, Desglosado, IVANoAcred, AcumulaIETU, IdConceptoIETU, IETUDeducible, IETUModificado, IETUAcreditable, GuidMov, GuidMovPadre, Migrado,
|
||||
ConceptoIVA,SubconceptoIVA,ClasificadorIVA,ProporcionDIOT,DeducibleDIOT)
|
||||
|
||||
VALUES (@IdMovDev, @RowVersion, @IdPoliza, ISNULL ((SELECT MAX (NumMovto) FROM MovimientosImpuestos WHERE IdPoliza = @IdPoliza), 0) + 1, @IdPersona, 0,YEAR(@FechaMov), MONTH(@FechaMov), @IdCuenta, 0, 1, 0,
|
||||
@Serie, @Folio, @Referencia, @UUID, 2, 0, 1, @TipoMovimiento, 1, @Impuesto, 2,'', @TasaOCuota, @SubTotal,
|
||||
@ImpImpuesto, @ImpImpuesto,0, @IVANoAcred, 0, 0, 0, 0, 0, @GuidMov, @GuidMovPadre, 0,
|
||||
@ConceptoIVA, @SubconceptoIVA, 0, @ProporcionDIOT, @DeducibleDIOT);
|
||||
|
||||
EXEC PA_UpdateId 'Id_MovimientoImpuesto';
|
||||
")
|
||||
|
||||
|
||||
StrSQL.AppendLine(" END TRY")
|
||||
|
||||
StrSQL.AppendLine(" BEGIN CATCH")
|
||||
StrSQL.AppendLine(" SET @Error = CONCAT('Número: ', ERROR_NUMBER(), '; Procedimiento: ', ERROR_PROCEDURE(), '; Linea: ', ERROR_LINE(), '; Detalle: ', ERROR_MESSAGE());")
|
||||
StrSQL.AppendLine(" RAISERROR(@Error, 16, 1);")
|
||||
StrSQL.AppendLine(" END CATCH")
|
||||
|
||||
StrSQL.Append(" END; ")
|
||||
|
||||
SqlDataAdapter(StrSQL.ToString, CommandType.Text)
|
||||
'SqlDataAdapter("PA_AddDevolucionIVA")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@RowVersion", SqlDbType.Int).Value = GlobalRowVersion
|
||||
.Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza
|
||||
.Add("@IdCuenta", SqlDbType.Int).Value = IdCuenta
|
||||
.Add("@IdProveedor", SqlDbType.Int).Value = IdProveedor
|
||||
.Add("@TasaOCuota", SqlDbType.Float).Value = Math.Round(TasaOCuota, 2)
|
||||
.Add("@SubTotal", SqlDbType.Float).Value = Math.Round(SubTotal, 2)
|
||||
.Add("@ImpImpuesto", SqlDbType.Float).Value = Math.Round(ImpImpuesto, 2)
|
||||
.Add("@IVANoAcred", SqlDbType.Float).Value = Math.Round(IVANoAcred, 2)
|
||||
.Add("@FechaMov", SqlDbType.DateTime).Value = FechaMovto
|
||||
.Add("@Referencia", SqlDbType.VarChar).Value = If(Referencia.Length > 30, Referencia.Substring(1, 30), Referencia)
|
||||
.Add("@Serie", SqlDbType.VarChar).Value = If(Serie.Length > 15, Serie.Substring(1, 15), Serie)
|
||||
.Add("@Folio", SqlDbType.Int).Value = If(Len(Folio.ToString) <= 8, Folio, Right(Folio.ToString, 8).ToEntero) ' se limita a 8 digitos, sino le cortan y se toman los ultimos 8, para que guarde e contpaqi
|
||||
.Add("@UUID", SqlDbType.VarChar).Value = UUID
|
||||
.Add("@ConceptoIVA", SqlDbType.Int).Value = ConceptoIVA
|
||||
.Add("@SubconceptoIVA", SqlDbType.Int).Value = SubconceptoIVA
|
||||
.Add("@ProporcionDIOT", SqlDbType.Int).Value = ProporcionDIOT
|
||||
.Add("@DeducibleDIOT", SqlDbType.Int).Value = DeducibleDIOT
|
||||
.Add("@GuidMov", SqlDbType.VarChar).Value = GuidMov
|
||||
.Add("@GuidMovPadre", SqlDbType.VarChar).Value = GuidMovPadre
|
||||
.Add("@TipoMovimiento", SqlDbType.Int).Value = TipoMovimiento
|
||||
.Add("@Impuesto", SqlDbType.Int).Value = Impuesto
|
||||
End With
|
||||
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un Error al agregar el movimiento de impuesto de egresos en la póliza.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateDevolucionesIVA(Id As Integer, IdPoliza As Integer, IdCuenta As Integer, IdProveedor As Integer, PorIVA As Double,
|
||||
SubTotal As Double, IVA As Double, RetIVA As Double, RetISR As Double, FechaMovto As Date, Referencia As String, Serie As String, Folio As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
@@ -1779,7 +1779,7 @@ Partial Class Compras_Compras
|
||||
DdlTipoComprobante.SelectedValueExist("DEV")
|
||||
End If
|
||||
|
||||
If Not CveCompra > 0 Then
|
||||
If Not CveCompra > 0 Or (CveCompra > 0 And UsuarioActual.CveEmpresa = 141) Then
|
||||
LnkProrrateoGasolina.Visible = True
|
||||
InicializaDTProrrateoGasolina()
|
||||
End If
|
||||
|
||||
@@ -1168,7 +1168,7 @@ Partial Class Compras_eFacturas
|
||||
'End If
|
||||
|
||||
Dim Funcionalidad123 As Integer = UsuarioActual.Empresa.Funcionalidad(123).ToEntero
|
||||
If Funcionalidad123 > 0 AndAlso Not e.Row.DataKey("CveFactura").ToEntero.Contiene(1223188) Then
|
||||
If Funcionalidad123 > 0 And Not UsuarioActual.TienePermisoProceso(156) Then
|
||||
If NowADS().Day >= Funcionalidad123 Then
|
||||
Dim FechaLimite As Date = New Date(NowADS().Year, NowADS().Month, 1)
|
||||
If e.Row.DBCampo("FechaFactura").ToDate < FechaLimite Then
|
||||
|
||||
Reference in New Issue
Block a user