diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index bab61a147..e9f4b52c4 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -6094,7 +6094,7 @@ diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index f5547b65b..1070d5714 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -21359,7 +21359,7 @@ Partial Class Ventas PorcentajeRetISR As Double, ImporteRetISR As Double, PorcentajeIEPS As Double, ImporteIEPS As Double, TipoDescuento As Integer, Descuento As Double, Total As Double, SerieLote As String, TiempoEntrega As String, CvePresupuestoIngreso As Integer, EntregaDirecta As Integer, SATClaveProdServ As String, SATClaveUM As String, CveContratoDetalle As Integer, CveVentaDetalle As Integer, CveMovimientoDetallePedido As Integer, CveOrdenCompraDetalle As Integer, - CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer) + CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1) Dim Row As DataRow = Nothing Row = TmpDT.NewRow() @@ -21418,6 +21418,8 @@ Partial Class Ventas Row("CveVentaDetalleRemision") = CveVentaDetalleRemision Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion + Row("CveTamaño") = CveTamaño + TmpDT.Rows.Add(Row) End Sub @@ -21572,7 +21574,8 @@ Partial Class Ventas Dim ObjVenta As New ClsVentas If ObjVenta.GetVentaDetalle(CveVenta) Then If Not ObjVenta.DtResultados.SUM("CantSur").ToString.ToDecimal > 0 Then SeEsconde = True - GvAplicaDevolucion.DataSource = ObjVenta.DtResultados.FiltraParametros("CantRes > 0") + 'NO MOSTRAR LOS PRODUCTOS CON LA CLASIFICACION DE USADOS + GvAplicaDevolucion.DataSource = ObjVenta.DtResultados.FiltraParametros("CantRes > 0 AND CveClasificacion <> 20519") End If ObjVenta.Dispose() @@ -21621,6 +21624,8 @@ Partial Class Ventas Dim AplicaPUEditado As Boolean = UsuarioActual.TienePermisoProceso(253) + Dim DtUsados As DataTable = TmpDT.FiltraParametros("CveClasificacion = 20519") + TmpDT.Clear() For Each Gv As GridViewRow In GvAplicaDevolucion.Rows If Gv.FCCheckBox("Chk").Checked And Gv.FCTextBox("TxtCantidadAplicaDevolucion").Text.ToDecimal > 0 Then @@ -21643,9 +21648,48 @@ Partial Class Ventas Gv.DataKey("PorcentajeRetIVA").ToString.ToDecimal, ImporteRetIVA, Gv.DataKey("PorcentajeRetISR").ToString.ToDecimal, ImporteRetISR, Gv.DataKey("PorcentajeIEPS").ToString.ToDecimal, ImporteIEPS, -1, Descuento, Total, "", "", -1, -1, - Gv.DataKey("SATClaveProdServ").ToString, Gv.DataKey("SATClaveUM").ToString, -1, Gv.DataKey("CveVentaDetalle").ToString.ToEntero, -1, -1, -1, -1) + Gv.DataKey("SATClaveProdServ").ToString, Gv.DataKey("SATClaveUM").ToString, -1, Gv.DataKey("CveVentaDetalle").ToString.ToEntero, -1, -1, -1, -1, Gv.DataKey("CveTamaño").ToEntero()) End If Next + + 'AGREGAR LOS USADOS EN LA DEVOLUCION + CalculaUsados(DtUsados) + 'If DtUsados IsNot Nothing AndAlso DtUsados.Rows.Count > 0 Then + ' Dim DtPSVenta As DataTable = TmpDT.Copy() + ' For Each Row As DataRow In DtPSVenta.Rows + ' Dim RowCargo As DataRow = DTTamanios.FiltroPrimero($"CveTamaño = { Row("CveTamaño").ToString.ToEntero } ") + ' If RowCargo IsNot Nothing Then + ' Dim CvePSCargo As Integer = RowCargo("CvePSCargo").ToString.ToEntero + + ' For Each RowUsado As DataRow In DtUsados.FiltraParametros($"CvePS = {CvePSCargo}").Rows + ' 'If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then + ' 'End If + ' Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() + ' Dim Descuento As Decimal = Cantidad * RowUsado("Descuento").ToString.ToDecimal / RowUsado("Cantidad").ToString.ToDecimal + ' Dim PU As Decimal = RowUsado("PU").ToString().ToDecimal() + ' Dim Total As Decimal = (Cantidad * PU) + ' Dim TotalImpuestos As Decimal = (Cantidad * PU) - Descuento + ' Dim ImporteIVA As Decimal = TotalImpuestos * RowUsado("PorcentajeIVA").ToString.ToDecimal + ' Dim ImporteRetIVA As Decimal = TotalImpuestos * RowUsado("PorcentajeRetIVA").ToString.ToDecimal + ' Dim ImporteRetISR As Decimal = TotalImpuestos * RowUsado("PorcentajeRetISR").ToString.ToDecimal + ' Dim ImporteIEPS As Decimal = TotalImpuestos * RowUsado("PorcentajeIEPS").ToString.ToDecimal + + ' AgregaTempDT(TmpDT, RowUsado("CvePS").ToString.ToEntero, RowUsado("PS").ToString, RowUsado("Codigo").ToString, RowUsado("CodigoPS").ToString, + ' RowUsado("CveTipoPS").ToString.ToEntero, RowUsado("CveTipoInvPS").ToString.ToEntero, + ' RowUsado("CveUM").ToString.ToEntero, RowUsado("UM").ToString, RowUsado("CveClasificacion").ToString.ToEntero, + ' RowUsado("Clasificacion").ToString, RowUsado("CveProyecto").ToString.ToEntero, RowUsado("Proyecto").ToString, + ' RowUsado("CveSubProyecto").ToString.ToEntero, RowUsado("SubProyecto").ToString, + ' RowUsado("Obs").ToString, Cantidad, PU, RowUsado("PorcentajeIVA").ToString.ToDecimal, ImporteIVA, + ' RowUsado("PorcentajeRetIVA").ToString.ToDecimal, ImporteRetIVA, + ' RowUsado("PorcentajeRetISR").ToString.ToDecimal, ImporteRetISR, RowUsado("PorcentajeIEPS").ToString.ToDecimal, + ' ImporteIEPS, -1, Descuento, Total, "", "", -1, -1, + ' RowUsado("SATClaveProdServ").ToString, RowUsado("SATClaveUM").ToString, -1, RowUsado("CveVentaDetalle").ToString.ToEntero, -1, -1, -1, -1) + ' Next + ' End If + + ' Next + 'End If + TrTipoRelacion.Visible = True DdlTiposRelacion.SelectedValueExist("3") @@ -23713,8 +23757,8 @@ Partial Class Ventas #Region "U S A D O S" - Private Sub CalculaUsados() - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot") Then + Private Sub CalculaUsados(Optional DtUsadosDevolucion As DataTable = Nothing) + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then Dim DTTamanios As DataTable = GlobalDTAcumTamaños() Dim DTCvePSCostos As DataTable @@ -23832,16 +23876,23 @@ Partial Class Ventas End If Next - For Each drowPsTamaños As DataRow In DTPSTemp.Rows Modalidad = "A" If drowPsTamaños("PU").ToString.ToDecimal > 0 Then + + Dim CveVentaDetalleDevolucion As Integer = -1 + + If DtUsadosDevolucion IsNot Nothing AndAlso DtUsadosDevolucion.Rows.Count > 0 Then + CveVentaDetalleDevolucion = DtUsadosDevolucion.FiltroPrimeroValor("CveVentaDetalle", $"CvePS = {drowPsTamaños("CvePS").ToString.ToEntero}").ToEntero() + End If + AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString, drowPsTamaños("CveClasificacion").ToString.ToEntero, drowPsTamaños("Clasificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero, drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero, - drowPsTamaños("SubProyecto").ToString) + drowPsTamaños("SubProyecto").ToString, CveVentaDetalle:=CveVentaDetalleDevolucion) End If Next + End If End Sub