-cambios en globalsDT2

This commit is contained in:
janeth arvizu
2020-01-02 12:55:04 -07:00
parent 7dcdf8bc22
commit b9f942cb72
30 changed files with 878 additions and 649 deletions

View File

@@ -30,7 +30,7 @@ Partial Class CatUnidadesMedida
Dim ObjUnidadesMedida As New ClsUnidadesMedida
If ObjUnidadesMedida.GetUnidadesMedida() Then
If ObjUnidadesMedida.GetUnidadesMedida(UsuarioActual.CveEmpresa) Then
GlobalDTUnidadesMedida = ObjUnidadesMedida.DtResultados
ViewState("DTUnidadesMedida") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GvDatos.DataSource = ViewState("DTUnidadesMedida")
@@ -81,7 +81,7 @@ Partial Class CatUnidadesMedida
Dim ObjUnidadesMedida As New ClsUnidadesMedida
If ObjUnidadesMedida.GetUnidadesMedidaAlias(cve) Then
If ObjUnidadesMedida.GetUnidadesMedidaAlias(UsuarioActual.CveEmpresa, cve) Then
ViewState("DTUnidadesMedidaAlias") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Else
ViewState("DTUnidadesMedidaAlias") = Nothing

View File

@@ -2597,19 +2597,21 @@ Partial Class Clientes
#Region "G L O B L A L"
Private Sub RecargaGlobal()
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
Hilo.Start()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
'Hilo.Start()
GeneraGlobalDT()
End Sub
Private Sub GeneraGlobalDT()
Dim Objclientes As New ClsClientes
If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then
Application("GlobalDTCliente") = Objclientes.DtResultados
End If
Objclientes.Dispose()
End Sub
GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
'Dim Objclientes As New ClsClientes
'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then
' Application("GlobalDTCliente") = Objclientes.DtResultados
'End If
'Objclientes.Dispose()
End Sub
#End Region
#Region "G R I D V I E W S"
Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then

View File

@@ -2866,6 +2866,10 @@ Partial Class PV
End If
End If
If ChkAjuste.Checked Then
CalculaMesesUso()
UpAjuste.Update()
End If
End If
@@ -4662,9 +4666,19 @@ Partial Class PV
RFVLocalidadC.Visible = False
RFVEstadoC.Visible = False
RFVPaisC.Visible = False
TxtNombreCliente.Focus()
DdlMetodoCliente.SelectedValueExist(1)
DdlFormaCliente.SelectedValueExist(1)
'carga datos particulares de la sucursal
Dim dr As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero).FiltroPrimero("")
If dr IsNot Nothing Then
TxtCPCliente.Text = dr("CP").ToString
TxtEstadoCliente.Text = dr("Estado").ToString
TxtCiudadCliente.Text = dr("Municipio").ToString
TxtLocalidadCliente.Text = dr("Localidad").ToString
End If
Else
Dim ObjCliente As New ClsClientes
If ObjCliente.ValidaClienteRFC(TxtRFCCliente.Text, UsuarioActual.CveEmpresa) Then
@@ -4914,15 +4928,17 @@ Partial Class PV
End Sub
Private Sub RecargaGlobalCliente()
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
Hilo.Start()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
'Hilo.Start()
GeneraGlobalDTCliente()
End Sub
Private Sub GeneraGlobalDTCliente()
Dim Objclientes As New ClsClientes
If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then
Application("GlobalDTCliente") = Objclientes.DtResultados
End If
Objclientes.Dispose()
Private Sub GeneraGlobalDTCliente()
GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
'Dim Objclientes As New ClsClientes
'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then
' Application("GlobalDTCliente") = Objclientes.DtResultados
'End If
'Objclientes.Dispose()
End Sub
#End Region
@@ -5198,13 +5214,19 @@ Partial Class PV
Dim CvePSParametro As Integer = DdlPSAjuste.SelectedValue.ToEntero
Dim PrecioSugerido As Decimal = 0
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
Dim CveMarca As Integer
If drPS IsNot Nothing Then
PrecioSugerido = drPS("Precio").ToString.ToDecimal
CveMarca = drPS("CveMarca").ToString.ToEntero
End If
TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2)
DdlTipoUso.Items.Clear()
DdlTipoUso.DataSource = GlobalDTAcumGarantiasMesesTipoUso(UsuarioActual.CveEmpresa, CveMarca)
DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlTipoUso.DataBind()
End If
If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then

View File

@@ -1326,11 +1326,12 @@ Partial Class ProductosyServicios
#Region "G L O B L A L"
Private Sub RecargaGlobal()
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
Hilo.Start()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
'Hilo.Start()
GeneraGlobalDT()
End Sub
Private Sub GeneraGlobalDT()
GlobalDTPSAdicionales(-1, UsuarioActual.CveEmpresa) = Nothing
GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing
GlobalDTProductosServiciosAlias(UsuarioActual.CveEmpresa) = Nothing
GlobalDTImpuestosLocales(-1, UsuarioActual.CveEmpresa) = Nothing
@@ -1339,23 +1340,23 @@ Partial Class ProductosyServicios
'Dim ObjPS As New ClsProductosServicios
'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable()
'If ObjPS.GetPSSimplificado(UsuarioActual.CveEmpresa) Then Application(String.Format("GlobalDTPSSimplificado{0}", UsuarioActual.CveEmpresa)) = ObjPS.DtResultados.AsEnumerable()
'If ObjPS.GetPSAlias(-1, -1) Then
' GlobalDTProductosServiciosAlias(-1) = ObjPS.DtResultados
''If ObjPS.GetPSAlias(-1, UsuarioActual.CveEmpresa) Then
' GlobalDTProductosServiciosAlias(UsuarioActual.CveEmpresa) = ObjPS.DtResultados
'End If
'If ObjPS.GetPSImpuestosLocales(-1, -1) Then
' GlobalDTImpuestosLocales(-1, -1) = ObjPS.DtResultados
'If ObjPS.GetPSImpuestosLocales(-1, UsuarioActual.CveEmpresa) Then
' GlobalDTImpuestosLocales(-1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados
'End If
'If ObjPS.GetPSEquivalencias(-1, -1) Then
'If ObjPS.GetPSEquivalencias(-1, UsuarioActual.CveEmpresa) Then
' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados
'End If
''If ObjPS.GetPSAdicionales(-1, -1) Then
'' GlobalDTPSAdicionales(-1, -1) = ObjPS.DtResultados
''End If
'If ObjPS.GetPSAdicionales(-1, UsuarioActual.CveEmpresa) Then
' GlobalDTPSAdicionales(-1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados
'End If
'ObjPS.Dispose()
End Sub
@@ -1401,8 +1402,9 @@ Partial Class ProductosyServicios
End Sub
Private Sub RecargaGlobalEquivalencias()
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalEquivalencias)
Hilo.Start()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalEquivalencias)
'Hilo.Start()
GeneraGlobalEquivalencias()
End Sub
Private Sub GeneraGlobalEquivalencias()
GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing

View File

@@ -5834,18 +5834,7 @@
<asp:RangeValidator ID="RVTxtNCImporte" runat="server" Type="currency" MinimumValue="0.01" MaximumValue="100" ErrorMessage="El campo <b>''Importe''</b> debe estar entre 1 y el importe máximo de la factura(Saldo)." ControlToValidate="TxtNCImporte" Display="None" ValidationGroup="GrpModalAplicarNC"></asp:RangeValidator>
<ajax:ValidatorCalloutExtender ID="VCETxtNCImporte" runat="server" HighlightCssClass="vco" TargetControlID="RVTxtNCImporte" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-4">
</div>
<div class="col-md-2">
ó
</div>
<div class="col-md-4">
</div>
</div>
</div>
<div class="row form-group">
<div class="col-md-2">
<asp:Literal ID="LtlTitleImportesRem" runat="server" Visible="false" Text="Importe Remisiones:"></asp:Literal>

View File

@@ -9847,7 +9847,7 @@ Partial Class Ventas
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
'ErrorPrepoliza = True
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
@@ -15269,14 +15269,19 @@ Partial Class Ventas
DtMovimientos = ObjInventario.DtResultados.FiltraParametros("", DistinctColumns:={"CveMovimiento"})
'Si estamos facturando remisiones ajustamos por ventadetalle
If RemisionesLista.Count > 0 Then
If RemisionesLista.Count > 0 AndAlso DtRemisionesTmpDT IsNot Nothing AndAlso DtRemisionesTmpDT.Rows.Count > 0 AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
Dim resultados = From DtRemisiones In DtRemisionesTmpDT
Join DtMovDet In ObjInventario.DtResultados.FiltraParametros("CvePS > 0") On DtRemisiones("CveVentaDetalleRemision").ToString.ToEntero Equals DtMovDet("CveVentaDetalle").ToString.ToEntero
Select DtMovDet
Try
DtMovimientosDetalles = resultados.CopyToDataTable
If resultados.Count > 0 Then
DtMovimientosDetalles = resultados.CopyToDataTable
Else
DtMovimientosDetalles = New DataTable
End If
Catch ex As Exception
GuardaLog($"LOG IPP: Ventas LN: 10033. - DtRemisionesTmpDT.Rows.Count: {DtRemisionesTmpDT.Rows.Count} - ObjInventario.DtResultados.FiltraParametros('CvePS > 0').Rows.Count: {ObjInventario.DtResultados.FiltraParametros("CvePS > 0").Rows.Count}")
GuardaLog($"LOG IPP: Ventas LN: 10033. - DtRemisionesTmpDT.Rows.Count: {DtRemisionesTmpDT.Rows.Count} - ObjInventario.DtResultados.FiltraParametros('CvePS > 0').Rows.Count: {ObjInventario.DtResultados.FiltraParametros("CvePS > 0").Rows.Count} Ex:{ex.Message}")
DtMovimientosDetalles = New DataTable
End Try
Else
@@ -17253,15 +17258,17 @@ Partial Class Ventas
End Sub
Private Sub RecargaGlobalCliente()
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
Hilo.Start()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
'Hilo.Start()
GeneraGlobalDTCliente()
End Sub
Private Sub GeneraGlobalDTCliente()
Dim Objclientes As New ClsClientes
If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then
Application("GlobalDTCliente") = Objclientes.DtResultados
End If
Objclientes.Dispose()
GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
'Dim Objclientes As New ClsClientes
'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, Estatus:=-1, TipoCliente:=-1) Then
' Application("GlobalDTCliente" & UsuarioActual.CveEmpresa) = Objclientes.DtResultados
'End If
'Objclientes.Dispose()
End Sub
#End Region
@@ -19164,19 +19171,19 @@ Partial Class Ventas
RecargaGlobal()
End Sub
Private Sub RecargaGlobal()
Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
Hilo.Start()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
'Hilo.Start()
GeneraGlobalDT()
End Sub
Private Sub GeneraGlobalDT()
'Dim dtt As DataTable
GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing
GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing
'Dim ObjPS As New ClsProductosServicios
'If (ObjPS.GetPSSimplificado(-1)) Then
' Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable 'Cargamos el GlobalDTPSSimplificado
'End If
'If ObjPS.GetPSSimplificado(UsuarioActual.CveEmpresa) Then Application(String.Format("GlobalDTPSSimplificado{0}", UsuarioActual.CveEmpresa)) = ObjPS.DtResultados.AsEnumerable()
'If ObjPS.GetPSEquivalencias(-1, -1) Then
'If ObjPS.GetPSEquivalencias(-1, UsuarioActual.CveEmpresa) Then
' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados
'End If
@@ -20922,6 +20929,7 @@ Partial Class Ventas
DtImpuestos.Columns.Add("ImporteIEPS", GetType(Decimal))
DtImpuestos.Columns.Add("CveSubProyecto", GetType(Integer))
DtImpuestos.AcceptChanges()
Dim AcumuladoNC As Decimal = 0
If AplicaNCMasiva Then
If NCDescuento Then
@@ -20929,10 +20937,12 @@ Partial Class Ventas
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True), True, MissingSchemaAction.Ignore)
Next
Else
For Each Gvr As GridViewRow In GvCxC.Rows
If Gvr.FCCheckBox("ChkCxC").Checked Then
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore)
'CARGA FACTURA A LA CUAL SE APLICA LA NC
AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal
CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal)
End If
Next
@@ -20949,10 +20959,10 @@ Partial Class Ventas
Into x = Group
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString.ToDecimal),
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString.ToDecimal),
ImporteIVA = x.Sum(Function(s) Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA,
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR,
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS,
ImporteIVA = x.Sum(Function(s) Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)), ' Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA,
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR,
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString.ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS,
PorcentajeIVA = PorcentajeIVA,
PorcentajeRetIVA = PorcentajeRetIVA,
PorcentajeRetISR = PorcentajeRetISR,
@@ -21001,11 +21011,23 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
DdlTipoComprobante.SelectedValueExist("Egs")
'verifica el total de multiples facturas
Dim Acumulado12 As Decimal = 0
Dim UltimoRenglon As Integer = 1
Dim Ajuste As Decimal = 0
For Each Dr As DataRow In DtImpuestos.Rows
Acumulado12 += Dr("ImportePU").ToString.ToDecimal.RoundSQL + Dr("ImporteIVA").ToString.ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString.ToDecimal
If UltimoRenglon = DtImpuestos.Rows.Count Then
'ajusta 5 centavos de diferencia
If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
Ajuste = Acumulado12 - AcumuladoNC
End If
End If
UltimoRenglon += 1
AgregaTempDT(TmpDT, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero,
DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal,
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal,
Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString.ToDecimal, "", "", -1, -1,
DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1)
Next
@@ -21017,6 +21039,7 @@ Partial Class Ventas
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1")
DdlSubProyectoDatos.Enabled = False
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
If Not AplicaNCMasiva Then
@@ -21077,22 +21100,24 @@ Partial Class Ventas
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
Dr("ImporteTotal") = Math.Round(Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr) - TmpDT.SUM("Descuento", FiltroStr)), 2)
Dr("ImporteIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * (1 + Dr("PorcentajeIEPS").ToString().ToDecimal()) * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetISR") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteIEPS") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteRetIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteRetISR") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteIEPS") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", $"ISNULL(PorcentajeIVA,0) = {Dr("PorcentajeIVA").ToString.ToDecimal} AND ISNULL(PorcentajeRetIVA,0) = '{Dr("PorcentajeRetIVA").ToString.ToDecimal}' AND ISNULL(PorcentajeRetISR,0) = '{Dr("PorcentajeRetISR").ToString.ToDecimal}' AND ISNULL(PorcentajeIEPS,0) = '{Dr("PorcentajeIEPS").ToString.ToDecimal}' AND ISNULL(CveSubProyecto,0) = '{Dr("CveSubProyecto").ToString.ToEntero}' "), 2)
'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", $"ISNULL(PorcentajeIVA,0) = {Dr("PorcentajeIVA").ToString.ToDecimal} AND ISNULL(PorcentajeRetIVA,0) = '{Dr("PorcentajeRetIVA").ToString.ToDecimal}' AND ISNULL(PorcentajeRetISR,0) = '{Dr("PorcentajeRetISR").ToString.ToDecimal}' AND ISNULL(PorcentajeIEPS,0) = '{Dr("PorcentajeIEPS").ToString.ToDecimal}' AND ISNULL(CveSubProyecto,0) = '{Dr("CveSubProyecto").ToString.ToEntero}' "), 2)
'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", $"ISNULL(PorcentajeIVA,0) = {Dr("PorcentajeIVA").ToString.ToDecimal} AND ISNULL(PorcentajeRetIVA,0) = '{Dr("PorcentajeRetIVA").ToString.ToDecimal}' AND ISNULL(PorcentajeRetISR,0) = '{Dr("PorcentajeRetISR").ToString.ToDecimal}' AND ISNULL(PorcentajeIEPS,0) = '{Dr("PorcentajeIEPS").ToString.ToDecimal}' AND ISNULL(CveSubProyecto,0) = '{Dr("CveSubProyecto").ToString.ToEntero}'"), 2)
'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", $"ISNULL(PorcentajeIVA,0) = {Dr("PorcentajeIVA").ToString.ToDecimal} AND ISNULL(PorcentajeRetIVA,0) = '{Dr("PorcentajeRetIVA").ToString.ToDecimal}' AND ISNULL(PorcentajeRetISR,0) = '{Dr("PorcentajeRetISR").ToString.ToDecimal}' AND ISNULL(PorcentajeIEPS,0) = '{Dr("PorcentajeIEPS").ToString.ToDecimal}' AND ISNULL(CveSubProyecto,0) = '{Dr("CveSubProyecto").ToString.ToEntero}'"), 2)
Dr("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", FiltroStr), 2)
Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2)
Dr("ImportePU") = Dr("ImporteTotal").ToString.ToDecimal '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
Next
'codigo para ajuste de centavo, si el importe total no cuadra con los totales
Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR"))
If Math.Abs(difTmp) >= 0.01 Then
'asusto la diferencia en el último concepto
DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp
Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp
DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = ImporteAjustado
DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImportePU") = ImporteAjustado
End If
If Not NCDescuento Then