Cambios para compras y pagos con importacion
This commit is contained in:
@@ -1006,6 +1006,7 @@ Partial Class Bancos_ProveedoresAbonar
|
|||||||
'inserto las compras que voy a pagar
|
'inserto las compras que voy a pagar
|
||||||
For Each gvr As GridViewRow In GvCxP.Rows
|
For Each gvr As GridViewRow In GvCxP.Rows
|
||||||
If gvr.FCCheckBox("Chk").Checked Then
|
If gvr.FCCheckBox("Chk").Checked Then
|
||||||
|
Dim EsImportacion As Boolean = False
|
||||||
|
|
||||||
'Tipos de cambio
|
'Tipos de cambio
|
||||||
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
||||||
@@ -1032,7 +1033,6 @@ Partial Class Bancos_ProveedoresAbonar
|
|||||||
|
|
||||||
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
|
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
|
||||||
For Each Row As DataRow In ObjMov.DtResultados.Rows
|
For Each Row As DataRow In ObjMov.DtResultados.Rows
|
||||||
|
|
||||||
ConceptoContable = Row("CveConcepto").ToString.ToEntero
|
ConceptoContable = Row("CveConcepto").ToString.ToEntero
|
||||||
TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False)
|
TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False)
|
||||||
ImporteMovimiento = 0
|
ImporteMovimiento = 0
|
||||||
@@ -1042,6 +1042,27 @@ Partial Class Bancos_ProveedoresAbonar
|
|||||||
Referencia = gvr.DataKey("SerieFolio").ToString
|
Referencia = gvr.DataKey("SerieFolio").ToString
|
||||||
Dim PorcentajeImpuesto As Decimal = 0
|
Dim PorcentajeImpuesto As Decimal = 0
|
||||||
|
|
||||||
|
If ConceptoContable.Contiene(14, 19) AndAlso gvr.DataKey("CveCompra").ToEntero > 0 Then
|
||||||
|
Dim objcompras As New ClsCompras
|
||||||
|
objcompras.GetCompras(gvr.DataKey("CveCompra").ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa)
|
||||||
|
If objcompras.DtResultados IsNot Nothing AndAlso objcompras.DtResultados.Rows.Count > 0 Then
|
||||||
|
Dim dr As DataRow = objcompras.DtResultados.Rows(0)
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||||
|
If dr("EsImportacion").ToString = "True" Then
|
||||||
|
EsImportacion = True
|
||||||
|
If ConceptoContable = 14 Then
|
||||||
|
ConceptoContable = 287
|
||||||
|
Else
|
||||||
|
ConceptoContable = 288
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
EsImportacion = False
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
Select Case ConceptoContable
|
Select Case ConceptoContable
|
||||||
Case 17 'Pago Proveedores
|
Case 17 'Pago Proveedores
|
||||||
|
|
||||||
@@ -1736,6 +1757,72 @@ Partial Class Bancos_ProveedoresAbonar
|
|||||||
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero
|
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
Case 287 'Iva X Acreditar Importacion
|
||||||
|
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||||
|
'funcionalidad que toma el 100% del pago para acreditamiento de iva
|
||||||
|
|
||||||
|
If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then
|
||||||
|
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento
|
||||||
|
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||||
|
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||||
|
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||||
|
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||||
|
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||||
|
End If
|
||||||
|
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
|
||||||
|
importeMX = Math.Round(importeMX, 2)
|
||||||
|
|
||||||
|
If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||||
|
Else
|
||||||
|
ImporteMovimiento = 0
|
||||||
|
importeMX = 0
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago
|
||||||
|
|
||||||
|
|
||||||
|
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||||
|
importeMX = ImporteMovimiento
|
||||||
|
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||||
|
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||||
|
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||||
|
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||||
|
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||||
|
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||||
|
End If
|
||||||
|
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
|
||||||
|
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
|
||||||
|
|
||||||
|
If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||||
|
End If
|
||||||
|
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||||
|
|
||||||
|
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
|
||||||
|
Dim IdCtaIVAXAcreditar As Integer = 0
|
||||||
|
Dim IdCtaIVAAcreditable As Integer = 0
|
||||||
|
|
||||||
|
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
|
||||||
|
IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||||
|
IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||||
|
End If
|
||||||
|
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
||||||
|
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||||
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
||||||
|
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
||||||
|
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Case 19 'Iva Acreditado
|
Case 19 'Iva Acreditado
|
||||||
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||||
@@ -1817,6 +1904,88 @@ Partial Class Bancos_ProveedoresAbonar
|
|||||||
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero
|
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Case 288 'Iva Acreditado
|
||||||
|
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||||
|
'funcionalidad que toma el 100% del pago para acreditamiento de iva
|
||||||
|
If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then
|
||||||
|
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento
|
||||||
|
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||||
|
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
|
||||||
|
importeMX = gvr.DataKey("IVADeducible").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||||
|
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||||
|
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||||
|
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||||
|
End If
|
||||||
|
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
|
||||||
|
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
|
||||||
|
|
||||||
|
If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||||
|
Else
|
||||||
|
ImporteMovimiento = 0
|
||||||
|
importeMX = 0
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
ImporteMovimiento = gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago
|
||||||
|
|
||||||
|
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||||
|
importeMX = ImporteMovimiento
|
||||||
|
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||||
|
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||||
|
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||||
|
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||||
|
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||||
|
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||||
|
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||||
|
|
||||||
|
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||||
|
End If
|
||||||
|
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
|
||||||
|
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
|
||||||
|
|
||||||
|
If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||||
|
End If
|
||||||
|
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
|
||||||
|
Dim IdCtaIVAXAcreditar As Integer = 0
|
||||||
|
Dim IdCtaIVAAcreditable As Integer = 0
|
||||||
|
Dim IdCtaContableNoIVA As Integer = 0
|
||||||
|
|
||||||
|
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
|
||||||
|
IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||||
|
IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||||
|
IdCtaContableNoIVA = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVANoAcreditable").ToString.ToEntero
|
||||||
|
End If
|
||||||
|
IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0)
|
||||||
|
|
||||||
|
'se registra el iva no acreditable
|
||||||
|
If gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal > 0 Then
|
||||||
|
|
||||||
|
Dim ImporteNOIVA As Decimal = gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal * PorcentajePago
|
||||||
|
|
||||||
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteNOIVA, Referencia, 280, ConceptoMovimiento, FechaMovimiento, IdCtaContableNoIVA, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=ImporteNOIVA, ImporteME:=If(TipoCambioPago = 1, 0, ImporteMovimiento), CveCuenta:=CveCuenta, TipoCambio:=TipoCambioGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
|
||||||
|
MsgError = "No se pudo insertar la póliza"
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||||
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
||||||
|
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
||||||
|
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Case 25 'IEPS X Acreditar
|
Case 25 'IEPS X Acreditar
|
||||||
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||||
ImporteMovimiento = gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago
|
ImporteMovimiento = gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago
|
||||||
@@ -2219,6 +2388,7 @@ Partial Class Bancos_ProveedoresAbonar
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Agrego el IVA
|
'Agrego el IVA
|
||||||
|
|
||||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, TxtObservaciones.Text, 14, TxtObservaciones.Text, Now, IdCtaIVAXAcreditar, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=gvr.DataKey("IVA").ToDecimal * PorcentajePago) Then
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, TxtObservaciones.Text, 14, TxtObservaciones.Text, Now, IdCtaIVAXAcreditar, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=gvr.DataKey("IVA").ToDecimal * PorcentajePago) Then
|
||||||
MsgError = "Detalle"
|
MsgError = "Detalle"
|
||||||
|
|
||||||
@@ -3392,6 +3562,7 @@ Partial Class Bancos_ProveedoresAbonar
|
|||||||
Private Sub RVTxtFechaDocumento_Init(sender As Object, e As EventArgs) Handles RVTxtFechaDocumento.Init
|
Private Sub RVTxtFechaDocumento_Init(sender As Object, e As EventArgs) Handles RVTxtFechaDocumento.Init
|
||||||
RVTxtFechaDocumento.MaximumValue = DateTime.Now.ToShortDateString
|
RVTxtFechaDocumento.MaximumValue = DateTime.Now.ToShortDateString
|
||||||
RVTxtFechaDocumentoMenor.MinimumValue = DateTime.Now.AddMonths(-4).ToShortDateString
|
RVTxtFechaDocumentoMenor.MinimumValue = DateTime.Now.AddMonths(-4).ToShortDateString
|
||||||
|
RVTxtFechaDocumentoMenor.MaximumValue = DateTime.Now.ToShortDateString
|
||||||
Calendario.EndDate = DateTime.Now
|
Calendario.EndDate = DateTime.Now
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@@ -3018,7 +3018,7 @@ Partial Class Compras_Compras
|
|||||||
|
|
||||||
'Tiene Importacion
|
'Tiene Importacion
|
||||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||||
If dr("EsImportacion").ToString.ToEntero > 0 Then
|
If dr("EsImportacion").ToString = "True" Then
|
||||||
chkImportacion.Checked = True
|
chkImportacion.Checked = True
|
||||||
Else
|
Else
|
||||||
chkImportacion.Checked = False
|
chkImportacion.Checked = False
|
||||||
|
|||||||
Reference in New Issue
Block a user