- activación de últimocosto al seleccionar el producto

This commit is contained in:
2024-12-20 10:53:48 -07:00
parent 2124df6e2d
commit 9ff3f63164

View File

@@ -2398,37 +2398,21 @@ Partial Class OC_OC
End If
End Sub
Protected Sub HFProducto_ValueChanged(sender As Object, e As EventArgs) Handles DdlP2.selectedindexchange
Dim tempdt As DataTable = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero)
If tempdt.Rows.Count > 0 Then
Dim drps As DataRow = tempdt.Rows(0)
If isWithFamily() Then
DdlClasificacion.SelectedValueExist(tempdt.Rows(0)("CveSubFamilia").ToString)
DdlClasificacion.SelectedValueExist(drps("CveSubFamilia").ToString)
Else
DdlClasificacion.SelectedValueExist(tempdt.Rows(0)("CveClasificacion").ToString)
DdlClasificacion.SelectedValueExist(drps("CveClasificacion").ToString)
End If
txtPrecioUnitario.Text = drps("UltimoCosto").ToString.ToDecimal.FormatoNumero
CboUnidadMedida.Items.Clear()
CboUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(DdlP2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa)
CboUnidadMedida.DataBind()
If CveEmpresaActual = 119 Then
txtPrecioUnitario.Text = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero).FiltroPrimeroValor("Precio")
ElseIf CveEmpresaActual.Contiene(72, 80) Then
Dim ObjOC As New ClsOC
If ObjOC.GetUltimoCostoPS(DdlP2.SelectedValue.ToEntero) Then
If ObjOC.DtResultados.Rows.Count.ToEntero > 0 Then
LblUltimoCosto.Visible = True
LblUltimoCosto.Text = $"UC: {ObjOC.DtResultados(0)("UltimoCosto").ToString.FormatoNumero}"
Else
LblUltimoCosto.Visible = False
LblUltimoCosto.Text = ""
End If
End If
ObjOC.Dispose()
End If
End If
If EsGrupoDiaz Then
@@ -4342,21 +4326,20 @@ Partial Class OC_OC
End Sub
Protected Sub GvD_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvD.RowDeleting
If GvD.Rows(e.RowIndex).DataKey("TipoDato").Contiene("1", "2") Then 'cuando viene de la bd o es editado, solo lo borraré
DrEliminados.Add(GvD.Rows(e.RowIndex).DataKey("CveOrdenCompraDetalle").ToString.ToEntero)
If e.RowIndex >= 0 AndAlso e.RowIndex < GvD.Rows.Count Then
If GvD.Rows(e.RowIndex).DataKey("TipoDato").Contiene("1", "2") Then 'cuando viene de la bd o es editado, solo lo borraré
DrEliminados.Add(GvD.Rows(e.RowIndex).DataKey("CveOrdenCompraDetalle").ToString.ToEntero)
End If
Dim dr As DataRow() = DtDetalle.Select("CveOrdenCompraDetalle = " & GvD.Rows(e.RowIndex).DataKey("CveOrdenCompraDetalle").ToString.ToEntero)
' If UsuarioActual.Empresa.UsaAC Then UpdateAC(dr(0).Item("CvePresupuestoEgreso").ToString.ToEntero, dr(0).Item("Total").ToString.ToEntero, True)
dr(0).Delete()
DtDetalle.AcceptChanges()
CargaDatosDetalles()
ModoEdicionMasiva()
End If
Dim dr As DataRow() = DtDetalle.Select("CveOrdenCompraDetalle = " & GvD.Rows(e.RowIndex).DataKey("CveOrdenCompraDetalle").ToString.ToEntero)
' If UsuarioActual.Empresa.UsaAC Then UpdateAC(dr(0).Item("CvePresupuestoEgreso").ToString.ToEntero, dr(0).Item("Total").ToString.ToEntero, True)
dr(0).Delete()
DtDetalle.AcceptChanges()
CargaDatosDetalles()
ModoEdicionMasiva()
End Sub
Protected Sub GvD_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvD.RowEditing
GvD.EditIndex = e.NewEditIndex