-- cmabios en mejora de Saldosde mercancía en tránsito cuando es NC y sus impuestos

This commit is contained in:
2021-09-18 12:47:47 -07:00
parent 590248d42f
commit d287f481a8
2 changed files with 40 additions and 8 deletions

View File

@@ -4835,7 +4835,7 @@
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<asp:GridView ID="GVNCInvAlmacen" runat="server" EmptyDataText="Aun no hay registros." Width="100%" AutoGenerateColumns="False" ShowHeader="true" ShowHeaderWhenEmpty="True" DataKeyNames="CveCompraDetalle,CveCompra,TipoCambio,PU" CssClass="table table-striped table-hover Widthall ScrollAD" data-heighterror="450" data-freezerows="1" GridLines="None"> <asp:GridView ID="GVNCInvAlmacen" runat="server" EmptyDataText="Aun no hay registros." Width="100%" AutoGenerateColumns="False" ShowHeader="true" ShowHeaderWhenEmpty="True" DataKeyNames="CveCompraDetalle,CveCompra,TipoCambio,PU,IVA,IEPSPS" CssClass="table table-striped table-hover Widthall ScrollAD" data-heighterror="450" data-freezerows="1" GridLines="None">
<Columns> <Columns>
<asp:TemplateField HeaderText="Cantidad"> <asp:TemplateField HeaderText="Cantidad">
<ItemTemplate> <ItemTemplate>

View File

@@ -6071,12 +6071,36 @@ 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 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
End If End If
'si aplica NC sobre mov de almacen, el impuesto lo toma de la Factura.para la consideracion de mcia en tránsito
If ChkNCInvNC.Checked And CveMoneda <> 1 AndAlso importeMovimiento > 0 Then
Dim diferenciaTransito As Decimal = 0
For Each Gvr As GridViewRow In GVNCInvAlmacen.Rows
If Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDouble > 0 Then
'Dim DifTC As Decimal = tipoCambioActual - Gvr.DataKey("TipoCambio").ToDecimal
'diferenciaTransito = DifTC * (Gvr.DataKey("IVA").ToDecimal / Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDecimal)
'diferenciaTransito += DifTC * (Gvr.DataKey("IEPSPS").ToDecimal / Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDecimal)
importeMN = (Gvr.DataKey("IVA").ToDecimal.RoundSQL * Gvr.DataKey("TipoCambio").ToDecimal * Multiplicador).RoundSQL
'se registra por cada compra relacionada
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMN, Referencia, 14, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveCompraAmortizacion:=Gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=Gvr.DataKey("TipoCambio").ToDecimal, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
End If
End If
Next
importeMovimiento = 0
importeMN = 0
End If
Case 287 'IVA X Acreditar Case 287 'IVA X Acreditar
importeMovimiento = importeIVAxAcreditar importeMovimiento = importeIVAxAcreditar
@@ -6790,6 +6814,7 @@ Partial Class Compras_Compras
End If End If
Next Next
Dim diferenciaTransito As Decimal = 0
For Each Gvr As GridViewRow In GVNCInvAlmacen.Rows For Each Gvr As GridViewRow In GVNCInvAlmacen.Rows
If Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDouble > 0 Then If Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDouble > 0 Then
Dim importeMNTemp As Decimal = 0 Dim importeMNTemp As Decimal = 0
@@ -6797,6 +6822,9 @@ Partial Class Compras_Compras
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
End If End If
Dim DifTC As Decimal = tipoCambioActual - Gvr.DataKey("TipoCambio").ToDecimal
'diferenciaTransito = DifTC * (Gvr.DataKey("IVA").ToDecimal / Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDecimal)
'diferenciaTransito += DifTC * (Gvr.DataKey("IEPSPS").ToDecimal / Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDecimal)
importeMNTemp = (Gvr.DataKey("PU").ToDecimal * Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDecimal * Gvr.DataKey("TipoCambio").ToDecimal).RoundSQL importeMNTemp = (Gvr.DataKey("PU").ToDecimal * Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDecimal * Gvr.DataKey("TipoCambio").ToDecimal).RoundSQL
ImporteTransito += importeMNTemp ImporteTransito += importeMNTemp
'se registra por cada compra relacionada 'se registra por cada compra relacionada
@@ -6806,18 +6834,22 @@ Partial Class Compras_Compras
End If End If
Next Next
'si hay diferencia
Dim diferenciaTransito As Decimal = ImporteTransito - importeMN.RoundSQL
'la diferencia se va aplicar sobre los
'Dim diferenciaTransito As Decimal = ImporteTransito - importeMN.RoundSQL
If diferenciaTransito <> 0 Then If diferenciaTransito <> 0 Then
Dim tCveCon As Integer = 65 Dim tCveCon As Integer = 65
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
If diferenciaTransito < 0 Then If diferenciaTransito < 0 Then
tCveCon = 64 tCveCon = 64
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
End If End If
diferenciaTransito = diferenciaTransito.Abs diferenciaTransito = Math.Abs(diferenciaTransito)
IdCtaContable = 0
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, If(tCveCon = 64, True, False), diferenciaTransito, Referencia, tCveCon, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=diferenciaTransito, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=1, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, If(tCveCon = 64, True, False), diferenciaTransito, Referencia, tCveCon, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=diferenciaTransito, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=1, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza, CveSubProyecto:=CveSubProyecto) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
End If End If
@@ -6973,7 +7005,7 @@ Partial Class Compras_Compras
tidctacon = ViewState("CtaProveedorAnticiposExtranjera").ToString.ToEntero tidctacon = ViewState("CtaProveedorAnticiposExtranjera").ToString.ToEntero
End If End If
ElseIf DdlTipoComprobante.SelectedValue = "NC" AndAlso UsuarioActual.Empresa.Funcionalidad(405).ToEntero > 0 Then ElseIf DdlTipoComprobante.SelectedValue = "NC" Then
tcvecon = 259 tcvecon = 259
tidctacon = UsuarioActual.Empresa.Funcionalidad(405).ToEntero tidctacon = UsuarioActual.Empresa.Funcionalidad(405).ToEntero