diff --git a/Inventarios/Kardex.aspx.vb b/Inventarios/Kardex.aspx.vb
index 55ae9d92f..6e4303c84 100644
--- a/Inventarios/Kardex.aspx.vb
+++ b/Inventarios/Kardex.aspx.vb
@@ -32,6 +32,20 @@ Partial Class Inventarios_Kardex
End Property
+
+ Private Property TipoCancelacion As Integer
+ Get
+ If ViewState("TipoCancelacion") Is Nothing Then
+ ViewState("TipoCancelacion") = -1
+ End If
+ Return ViewState("TipoCancelacion").ToString.ToEntero
+ End Get
+ Set
+ ViewState("TipoCancelacion") = Value
+ End Set
+ End Property
+
+
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -335,7 +349,7 @@ Partial Class Inventarios_Kardex
End Sub
- Private Sub CargarOCPendientesCompra(Opcion As Integer) ' Opcion1 OC, 2 REQ
+ Private Sub CargarOCPendientesCompra(Opcion As Integer, Optional CargaGrid As Boolean = False) ' Opcion1 OC, 2 REQ
Dim tCveSubProyectos As String = "-1"
@@ -347,12 +361,18 @@ Partial Class Inventarios_Kardex
Dim ObjOC As New ClsOC
If ObjOC.PendientesCompra(ddlProducto2.SelectedValue.ToEntero, tCveSubProyectos, UsuarioActual.CveEmpresa, Opcion:=Opcion) Then
- GvOC.DataSource = ObjOC.DtResultados.Copy.FiltraParametros("", "Fecha Desc")
+ If CargaGrid Then
+ GvOC.DataSource = ObjOC.DtResultados.Copy.FiltraParametros("", "Fecha Desc")
+ End If
+
If Opcion = 1 Then
LnkIndicador_OC.Text = ObjOC.DtResultados.Copy.SUM("CantidadPendienteVincular").ToString()
LnkIndicador_OC2.Text = ObjOC.DtResultados.Copy.SUM("CantidadPendienteVincular").ToString()
ElseIf Opcion = 2 Then
- LnkIndicador_REQ.Text = ObjOC.DtResultados.Copy.SUM("CantidadPendienteVincular").ToString().ToDecimal.RoundSQL(2).ToString
+ LnkIndicador_REQ.Text = ObjOC.DtResultados.Copy.SUM("CantidadPendienteVincular").ToString().ToDecimal.RoundSQL(2).ToString("###,###.##")
+ If LnkIndicador_REQ.Text = "" Then
+ LnkIndicador_REQ.Text = "0"
+ End If
End If
End If
@@ -846,13 +866,19 @@ Partial Class Inventarios_Kardex
End Function
Protected Sub LnkIndicador_OC_Click(sender As Object, e As EventArgs)
- UpModalOC.Update()
+ TipoCancelacion = 1
+ LtlModalOC.Text = "OC Pendientes por Recibir"
+ CargarOCPendientesCompra(1, True)
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalOC"))
+ UpModalOC.Update()
End Sub
Protected Sub LnkIndicador_REQ_Click(sender As Object, e As EventArgs)
- UpModalOC.Update()
+ TipoCancelacion = 2
+ LtlModalOC.Text = "Requisiciones"
+ CargarOCPendientesCompra(2, True)
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalOC"))
+ UpModalOC.Update()
End Sub
Protected Sub LnkCancelarOCDetalle_Click(sender As Object, e As EventArgs)
@@ -866,9 +892,14 @@ Partial Class Inventarios_Kardex
End If
Dim ObjOC As New ClsOC
- If ObjOC.CancelarPartidaPendiente(CveOrdenCompraDetalle, NuevaCantidad, UsuarioActual.CveEmpresa, GlobalDTAFCaracteristicasOpciones:=1) Then
- CargarOCPendientesCompra(1)
- CargarOCPendientesCompra(2)
+ If ObjOC.CancelarPartidaPendiente(CveOrdenCompraDetalle, NuevaCantidad, UsuarioActual.CveEmpresa, Opcion:=TipoCancelacion) Then
+ If TipoCancelacion = 1 Then
+ CargarOCPendientesCompra(1, True)
+ Else
+ CargarOCPendientesCompra(2, True)
+ End If
+
+
Alert("La partida se cancelo correctamente.")
End If
@@ -929,7 +960,9 @@ Partial Class Inventarios_Kardex
Protected Sub LnkAgrgarWishList_Click(sender As Object, e As EventArgs)
- AgregarAWishList()
+ If AgregarAWishList() Then
+ CargarOCPendientesCompra(2)
+ End If
End Sub
Private Function AgregarAWishList() As Boolean
@@ -941,6 +974,7 @@ Partial Class Inventarios_Kardex
Dim CveSubProyecto As Integer = -1
Dim FolioOrdenCompra As String = ""
Dim CveOrdenCompra As Integer = -1
+ Dim CveOrdenCompraDetalle As Integer = -1
Dim UltimoCosto As Decimal = 0D
Dim CveProveedorCompra As Integer = -1
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal
@@ -1020,15 +1054,32 @@ Partial Class Inventarios_Kardex
If respuesta AndAlso CveOrdenCompra > 0 Then
+ If ObjOC.GetOrdenesDetalle(CveOrdenCompra, UsuarioActual.CveEmpresa) Then
+ Dim drOcDetalle As DataRow = ObjOC.DtResultados.FiltroPrimero($"CvePs={CvePS}")
+ If drOcDetalle IsNot Nothing Then
+ CveOrdenCompraDetalle = drOcDetalle("CveOrdenCompraDetalle").ToString.ToEntero
+ Cantidad = drOcDetalle("Cantidad").ToString.ToDecimal + Cantidad
+ End If
+ End If
+
Dim Total As Decimal = (Cantidad * UltimoCosto).RoundSQL
Dim IVA As Decimal = (Total * PorcentajeIVA).RoundSQL
RetIVA = IVA * PorcentajeRetIVA
RetISR = Total * PorcentajeRetISR
- If Not ObjOC.AddOrdenCompraDetalle(CveOrdenCompra, Cantidad, CveUnidadMedida, CvePS, UltimoCosto, CveSubProyecto, -1, "Obs", UsuarioActual.CveUsuario,
- IVA:=IVA, RetIVA:=RetIVA, RetISR:=RetISR, Total:=Total, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=PorcentajeRetIVA, RetISRPorcentaje:=PorcentajeRetISR) Then
- respuesta = False
+ If CveOrdenCompraDetalle > 0 Then
+ If Not ObjOC.UpdateOrdenCompraDetalle(Cantidad, CveUnidadMedida, CvePS, UltimoCosto, CveSubProyecto, -1, "Obs", UsuarioActual.CveUsuario, CveOrdenCompraDetalle, -1, 0, IVA:=IVA, RetIVA:=RetIVA, RetISR:=RetISR,
+ Total:=Total, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=PorcentajeRetIVA, RetISRPorcentaje:=PorcentajeRetISR) >= 0 Then
+ respuesta = False
+
+ End If
+ Else
+ If Not ObjOC.AddOrdenCompraDetalle(CveOrdenCompra, Cantidad, CveUnidadMedida, CvePS, UltimoCosto, CveSubProyecto, -1, "Obs", UsuarioActual.CveUsuario,
+ IVA:=IVA, RetIVA:=RetIVA, RetISR:=RetISR, Total:=Total, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=PorcentajeRetIVA, RetISRPorcentaje:=PorcentajeRetISR) Then
+ respuesta = False
+ End If
End If
+
End If
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 76f083680..290c4e66d 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -40310,34 +40310,6 @@ Partial Class Ventas
DVGvPSProced.Visible = True
GvPSProced.Columns(4).Visible = RBLTipoVenta.SelectedValue = "2" ' comisión Ed. Médica, solo cuando es pago directo
- For Each GvRow As GridViewRow In GvPSProced.Rows
- If RBLTipoVenta.SelectedValue = "2" Then
-
- Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal
- Dim CveUnidadMedida As Integer = GvRow.DataKey("CveUnidadMedida").ToEntero
- Dim Abreviatura As String = GvRow.DataKey("Abreviatura").ToString
- Dim PU As Decimal = GvRow.DataKey("Precio").ToDecimal
- Dim CveClasificacion As Integer = GvRow.DataKey("CveClasificacion").ToEntero
- Dim Clasificacion As String = GvRow.DataKey("Clasificacion").ToString
- Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
-
- 'SUGIERE PRECIO
- Dim PrecioSugerido As Decimal = 0
- Dim tPrecioSugerido As Decimal = 0
- tPrecioSugerido = PU
- Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
-
- PrecioSugerido = ObjPrecioSugerido.PrecioSugerido
- If ObjPrecioSugerido.CvePrecioLista > 0 AndAlso DivPrecioLista.Visible Then
- DdlPrecioLista.SelectedValueExist(ObjPrecioSugerido.CvePrecioLista)
- End If
-
- If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
- GvRow.FCTextBox("TxtPrecio").Text = PrecioSugerido.ToString("#,##0.####")
-
- End If
- Next
-
UpDvModalTipoVenta.Update()
End Sub