-- cambios de SeccionesAlmacen, Serie,Lote,Caducidad

This commit is contained in:
rrene
2020-05-13 12:38:46 -07:00
parent f60e230d98
commit 055db33c9c
9 changed files with 144 additions and 119 deletions

View File

@@ -945,7 +945,7 @@
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Lote" HeaderText="Lote" />
<asp:BoundField DataField="Batch" HeaderText="Batch" />
<asp:BoundField DataField="FechaCaducidad" HeaderText="FechaCaducidad" />
</Columns>
</asp:GridView>
</div>

View File

@@ -2849,13 +2849,13 @@ Partial Class PV
DtTemporal.Columns.Add("Lote", Type.GetType("System.String"))
End If
If Not DtTemporal.Columns.Contains("Batch") Then
DtTemporal.Columns.Add("Batch", Type.GetType("System.String"))
If Not DtTemporal.Columns.Contains("FechaCaducidad") Then
DtTemporal.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime"))
End If
GvInv.Columns(4).Visible = DtTemporal.MAX("SerieLote", "SerieLote <> ''") <> "" Or CveVenta <= 0
GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
GvInv.Columns(6).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
GvInv.Columns(6).Visible = DtTemporal.MAX("FechaCaducidad", "FechaCaducidad <> ''") <> ""
GvInv.DataSource = DtTemporal
GvInv.DataBind()

View File

@@ -1614,7 +1614,7 @@
Almacén:
<asp:DropDownList ID="ddlAlmacen" AppendDataBoundItems="true" runat="server" DataTextField="Almacen" DataValueField="CveAlmacen" CssClass="select2me" Width="200px"></asp:DropDownList>
</div>
<div class=" col-sm-8">
<div class=" col-sm-10">
<div class="Widthall" style="overflow-x: auto;">
<asp:GridView ID="GvInv" runat="server" AutoGenerateColumns="false" DataKeyNames="Origen" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%" HeaderStyle-CssClass="Titulos" CssClass="table table-striped table-hover" Style="text-align: center;" GridLines="None">
<Columns>
@@ -1655,7 +1655,7 @@
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Lote" HeaderText="Lote" />
<asp:BoundField DataField="Batch" HeaderText="Batch" />
<asp:BoundField DataField="FechaCaducidad" HeaderText="FechaCaducidad" />
</Columns>
</asp:GridView>
</div>

View File

@@ -9503,8 +9503,11 @@ Partial Class Ventas
TmpDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle
Try
Dim InvDr As DataRow = DtInv.Select($"Consec = {Row("Consec").ToString}")(0)
InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle
If DtInv IsNot Nothing Then
Dim InvDr As DataRow = DtInv.Select($"Consec = {Row("Consec").ToString}")(0)
InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle
End If
Catch ex As Exception
End Try
@@ -11175,7 +11178,7 @@ Partial Class Ventas
CveConceptoAlmacen = 18
End If
Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEnteroca
Dim CveAlmacen As Integer = ddlAlmacen.SelectedValue.ToEntero
Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, CveConceptoAlmacen, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Vta/E1")
If CveMovimientoInventario <= 0 Then
@@ -11239,7 +11242,7 @@ Partial Class Ventas
End If
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, Serie:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />")
Exit For
@@ -13246,7 +13249,7 @@ Partial Class Ventas
Protected Function CancelarMovimientoInventario(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, CveVentaNueva As Integer, CveVentaVieja As Integer) As Boolean
'SI YA ESTA QUEMADA DE ALMACEN LA VENTA, NO SE CANCELAN LOS MOVIMIENTOS DE INVENTARIO
If ObjInventario.GetEstatusVentaPorSurir(CveVentaVieja) Then
If ObjInventario.GetEstatusVentaPorSurtir(CveVentaVieja) Then
If ObjInventario.EsDevolucionVenta = 2 Then
Return True
End If
@@ -13285,12 +13288,12 @@ Partial Class Ventas
Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero
Dim PU As Decimal = MovDet("PU").ToString.ToDecimal
Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero
Dim SerieLote As String = MovDet("SerieLote").ToString
Dim Serie As String = MovDet("Serie").ToString
Dim CveVentaDetalle = MovDet("CveVentaDetalle").ToString.ToEntero
'Entrada
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then
OcurrioError = True
Exit For
End If
@@ -13298,7 +13301,7 @@ Partial Class Ventas
'Salida
CveVentaDetalle = ObjInventario.VentaDetallePadreGet(CveVentaDetalle).ToString.ToEntero
If CveVentaDetalle > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then
OcurrioError = True
Exit For
End If
@@ -16223,7 +16226,7 @@ Partial Class Ventas
Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero
Dim PU As Decimal = MovDet("PU").ToString.ToDecimal
Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero
Dim SerieLote As String = MovDet("SerieLote").ToString
Dim Serie As String = MovDet("Serie").ToString
Dim Consec As Integer = DtRemisionesTmpDT.FiltroPrimeroValor("Consec", $"CveVentaDetalle = {MovDet("CveVentaDetalle").ToString}").ToEntero
'COMIENZA: VENTADETALLE
@@ -16249,7 +16252,7 @@ Partial Class Ventas
CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString.ToEntero
End If
If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then
If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then
ContadorMovtosDetalles += 1
Else
OcurrioError = True
@@ -17364,7 +17367,7 @@ Partial Class Ventas
Dim DrProducto As DataRow = Nothing
If TxtCantidad.Text.Trim.ToDouble <= 0 Then TxtCantidad.Text = "1"
Dim SerieLote As String = ""
Dim Serie As String = ""
Dim CodigoBarras As String = ""
Dim CvePS As Integer
@@ -17373,10 +17376,10 @@ Partial Class Ventas
'BUSCA POR SERIE E IGNORA CODIGO DE BARRAS (LIMPIA)
If TxtCodigoSerie.Text.Trim <> "" Then
SerieLote = TxtCodigoSerie.Text.Trim().ToUpper()
Serie = TxtCodigoSerie.Text.Trim().ToUpper()
Dim Objinventarios As New ClsInventarios
Dim Existencia = Objinventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, -1, SerieLote:=SerieLote, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero)
Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", SerieLote))
Dim Existencia = Objinventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, -1, Serie:=Serie, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero)
Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Serie))
CvePS = Objinventarios.CvePS
Objinventarios.Dispose()
@@ -17387,11 +17390,11 @@ Partial Class Ventas
HdnCvePS.Value = CvePS.ToString
TxtCantidad.Text = "1"
Else
Alert($"No se encontró un producto con la serie: <b>{SerieLote}</b>. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia)
Alert($"No se encontró un producto con la serie: <b>{Serie}</b>. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia)
End If
End If
Else
Alert(String.Format("No hay existencia suficiente del producto con la Serie: <b>{0}</b>. Por favor rectifique y vuelva a intentar", SerieLote), TipoMensaje.MsgAdvertencia)
Alert(String.Format("No hay existencia suficiente del producto con la Serie: <b>{0}</b>. Por favor rectifique y vuelva a intentar", Serie), TipoMensaje.MsgAdvertencia)
TxtCodigoSerie.Focus()
RegistraScript($"$('#{TxtCodigoSerie.ClientID}').select();")
Exit Sub
@@ -17404,7 +17407,7 @@ Partial Class Ventas
CodigoBarras = TxtCodigoBarras.Text.Trim()
DrProducto = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"CodigoBarras = '{CodigoBarras}'")
If DrProducto IsNot Nothing Then
If DrProducto("Inv_CveMetodoInventario").ToString = "5" Then 'si es serielote
If DrProducto("Inv_CveMetodoInventario").ToString = "5" Then 'si es serie
TxtCodigoSerie.Focus()
Exit Sub
Else
@@ -17414,7 +17417,7 @@ Partial Class Ventas
Else
TxtCodigoBarras.Focus()
RegistraScript($"$('#{TxtCodigoBarras.ClientID}').select();")
Alert($"No se encontró un producto con el código de barras: <b>{SerieLote}</b>. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia)
Alert($"No se encontró un producto con el código de barras: <b>{Serie}</b>. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
@@ -18031,8 +18034,8 @@ Partial Class Ventas
'SIN EXISTENCIA
If Gvr.FCTextBox("TxtSerie").Visible = True And Gvr.FCTextBox("TxtSerie").Text.Trim <> "" Then
Existencia = ObjInventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, ddlAlmacen.SelectedValue.ToEntero, SerieLote:=Gvr.FCTextBox("TxtSerie").Text.ToString, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim))
Existencia = ObjInventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, ddlAlmacen.SelectedValue.ToEntero, Serie:=Gvr.FCTextBox("TxtSerie").Text.ToString, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim))
'Valida Existencia
If Existencia - ExistenciaActual < 0 Then
@@ -18230,13 +18233,13 @@ Partial Class Ventas
DtTemporal.Columns.Add("Lote", Type.GetType("System.String"))
End If
If Not DtTemporal.Columns.Contains("Batch") Then
DtTemporal.Columns.Add("Batch", Type.GetType("System.String"))
If Not DtTemporal.Columns.Contains("FechaCaducidad") Then
DtTemporal.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime"))
End If
GvInv.Columns(4).Visible = DtTemporal.MAX("SerieLote", "SerieLote <> ''") <> "" Or CveVenta <= 0
GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
GvInv.Columns(6).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
GvInv.Columns(6).Visible = DtTemporal.MAX("FechaCaducidad", "FechaCaducidad <> ''") <> ""
GvInv.DataSource = DtTemporal
GvInv.DataBind()
@@ -19926,7 +19929,7 @@ Partial Class Ventas
End If
For Each dr As DataRow In ObjInventarios.DtResultados.FiltraParametros($"ExistenciaPedido > 0 {Filtro}").Rows
AgregarProductoServicio(dr("Cantidad").ToString.ToDecimal, dr("CveUM").ToString.ToEntero, dr("UnidadMedida").ToString, dr("CveClasificacion").ToString.ToEntero, dr("Clasificacion").ToString,
dr("CvePS").ToString.ToEntero, dr("PS").ToString, dr("SerieLote").ToString, dr("PU").ToString.ToDecimal, 0.0D,
dr("CvePS").ToString.ToEntero, dr("PS").ToString, dr("Serie").ToString, dr("PU").ToString.ToDecimal, 0.0D,
dr("CveProyecto").ToString.ToEntero, dr("Proyecto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("SubProyecto").ToString,
CveMovimientoDetallePedido:=dr("CveMovimientoDetalle").ToString.ToEntero)
Next
@@ -20432,12 +20435,12 @@ Partial Class Ventas
If Dr("CveTipoInvPS").ToString.ToEntero = 5 Then
For Each Dr2 As DataRow In DtContratosSerieDetalle.FiltraParametros($"ConsecId = {Dr("CveContratoDetalle")}").Rows
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, SerieLote:=Dr2("Serie").ToString, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, Serie:=Dr2("Serie").ToString, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1)
If Existencia < 1 Then
Return False
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, SerieLote:=Dr2("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, Serie:=Dr2("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
Return False
End If
Next
@@ -20462,7 +20465,7 @@ Partial Class Ventas
If CveMovimientoEntradaGeneral > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
Return False
End If
Next
@@ -20476,7 +20479,7 @@ Partial Class Ventas
If CveMovimientoEntradaGeneral > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
Return False
End If
Next
@@ -20612,7 +20615,7 @@ Partial Class Ventas
End If
'VERIFICA EXISTENCIAS
Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=SerieRow)
Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=SerieRow)
If Existencia < 1 Then
MensajeSinExistencias.Append($"Serie: <b>{SerieRow}</b>. <br/>")
Continue For
@@ -20952,6 +20955,7 @@ Partial Class Ventas
Count = +1
Next
End If
DtDocumentacionCliente(IndexDocumentoCliente)("RutaArchivo") = fileItem.FileUrl
DtDocumentacionCliente(IndexDocumentoCliente)("UpArchivo") = "1"
@@ -21989,6 +21993,7 @@ Partial Class Ventas
End If
End If
Dim ImpuestoTolerancia As Decimal = 0.01D ' SI EXCEDE ESA DIFERENCIA, AJUSTA EL IMPUESTO
Dim query = From dr In DtImpuestos
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal,
@@ -21999,14 +22004,29 @@ Partial Class Ventas
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString.ToDecimal),
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString.ToDecimal),
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString.ToDecimal)).RoundSQL(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,
ImporteIVACalculado = (x.Sum(Function(s) (s("ImportePU").ToString.ToDecimal) * PorcentajeIVA)).RoundSQL(2),
ImporteRetIVA = x.Sum(Function(s) s("ImporteRetIVA").ToString.ToDecimal).RoundSQL(2),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA,
ImporteRetISR = x.Sum(Function(s) s("ImporteRetISR").ToString.ToDecimal).RoundSQL(2),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR,
ImporteIEPS = x.Sum(Function(s) s("ImporteIEPS").ToString.ToDecimal).RoundSQL(2), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS,
ImporteIEPSCalculado = (x.Sum(Function(s) s("ImportePU").ToString.ToDecimal) * PorcentajeIEPS).RoundSQL(2), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS,
PorcentajeIVA = PorcentajeIVA,
PorcentajeRetIVA = PorcentajeRetIVA,
PorcentajeRetISR = PorcentajeRetISR,
PorcentajeIEPS = PorcentajeIEPS
'(1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
'codigo para ajustar tolerancia.
Dim Impuesto = From dd In query
Select PorcentajeIEPS = dd.PorcentajeIEPS,
PorcentajeIVA = dd.PorcentajeIVA,
PorcentajeRetISR = dd.PorcentajeRetISR,
PorcentajeRetIVA = dd.PorcentajeRetIVA,
ImportePU = dd.ImportePU,
ImporteTotal = dd.ImporteTotal,
ImporteIVA = If((dd.ImporteIVA - dd.ImporteIVACalculado).Abs >= ImpuestoTolerancia, dd.ImporteIVACalculado, dd.ImporteIVA),
ImporteRetIVA = dd.ImporteRetIVA,
ImporteRetISR = dd.ImporteRetISR,
ImporteIEPS = If((dd.ImporteIEPS - dd.ImporteIEPSCalculado).Abs >= ImpuestoTolerancia, dd.ImporteIEPSCalculado, dd.ImporteIEPS)
Order By PorcentajeIVA, PorcentajeIEPS
'hay una condicion de verificacion arriba, en la que checa si la diferencia en ieps, es menor a 3 centavos, toma el valor recalculado
Dim DrSubProyecto = GlobalDTSubProyectos(-1, TmpDT.FiltroPrimeroValor("CveSubProyecto", "", "ImporteTotal DESC").ToEntero, UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
If DrSubProyecto Is Nothing Then
@@ -22014,7 +22034,7 @@ Partial Class Ventas
Exit Sub
End If
DtImpuestos = query.QueryToDataTable(False)
DtImpuestos = Impuesto.QueryToDataTable(False)
If Not NCDescuento Then
LimpiaDocumentoNC()
@@ -22035,7 +22055,7 @@ Partial Class Ventas
AgregaTempDT(TmpDTDescNC, 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,
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,
Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImportePU").ToString.ToDecimal, "", "", -1, -1,
DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1)
Next
@@ -22149,8 +22169,8 @@ Partial Class Ventas
End If
For Each Dr As DataRow In DtImpuestosLocal.Rows
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"))
importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr).ToDecimal() - TmpDT.SUM("Descuento", FiltroStr).ToDecimal()))
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"), Dr("PorcentajeRetIVA"), Dr("PorcentajeRetISR"), Dr("PorcentajeIEPS"), Dr("CveSubProyecto"))
importePuTemp = (Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr)))
If Not AplicaImpuestosLocales Then
importePuTemp = importePuTemp - TotalImpuestosLocales