Crear apartir de

This commit is contained in:
HECTOR RODRIGUEZ
2021-07-20 18:43:09 -07:00
parent fd6fc8b953
commit fef9d029a0
2 changed files with 216 additions and 17 deletions

View File

@@ -167,15 +167,19 @@ Partial Class Inventarios_RepAnomalias
GvF.UseAccessibleHeader = True
GvF.HeaderRow.TableSection = TableRowSection.TableHeader
Script = "OrdenarGVF();"
divRegistradosFaltan.Visible = True
LtlTotalRegistrosFaltan.Text = GvF.Rows.Count.ToString
End If
If (GvS.Rows.Count > 0) Then
GvS.UseAccessibleHeader = True
GvS.HeaderRow.TableSection = TableRowSection.TableHeader
Script += "OrdenarGVS();"
divRegistradosSobran.Visible = True
LtlTotalRegistrosSobran.Text = GvS.Rows.Count.ToString
End If
PSIguales()
RegistraScript(Script)
UPAnomalias.Update()
@@ -207,17 +211,13 @@ Partial Class Inventarios_RepAnomalias
Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvF.RowDataBound, GvS.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Costo") = "-1" Then
e.Row.Cells(8).Text = "0"
End If
If e.Row.Cells(7).Text = MinFecha.ToString Then
e.Row.Cells(7).Text = ""
End If
e.Row.FCLabel("Lblc").Text = e.Row.RowIndex + 1
End If
End Sub
@@ -301,4 +301,135 @@ Partial Class Inventarios_RepAnomalias
Gv.Columns(7).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha
End Sub
Private Sub LnkCrear_Click(sender As Object, e As EventArgs) Handles LnkCrear.Click
If GvF.Rows.Count > 0 Then
GvF.Columns(0).Visible = True
LnkGuardar.Visible = True
LnkCrear.Visible = False
GvF.HeaderRow.FCCheckBox("ChkAllFaltante").Attributes.Add("onclick", "SeleccionarTodosFaltante(this);")
End If
If GvS.Rows.Count > 0 Then
GvS.Columns(0).Visible = True
LnkGuardar.Visible = True
LnkCrear.Visible = False
GvS.HeaderRow.FCCheckBox("ChkAllSobrante").Attributes.Add("onclick", "SeleccionarTodosSobrante(this);")
End If
UPAnomalias.Update()
UpdateGvS.Update()
UPAcciones.Update()
End Sub
Private Sub LnkGuardar_Click(sender As Object, e As EventArgs) Handles LnkGuardar.Click
RegistraScript("$('#ModalGuardar').modal('show')")
End Sub
Private Sub BtnCrear_Click(sender As Object, e As EventArgs) Handles BtnCrear.Click
Dim ErrorClasif As Boolean = False
Dim ObjInventario As New ClsInventarios
Dim CveInventarioFisicoNew As Integer
Dim DtAlmacen, DtClasificacion, DtClasificacionExcluida, DtProveedor As DataTable
DtAlmacen = Nothing
DtClasificacion = Nothing
DtClasificacionExcluida = Nothing
DtProveedor = Nothing
ObjInventario.IniciaTransacSQL()
If ObjInventario.AddInventarioFisico(UsuarioActual.CveEmpresa, TxtTitulo.Text, lbObservaciones.Text, 0, CveSubProyecto) Then
CveInventarioFisicoNew = ObjInventario.CveInventarioFisico
If ObjInventario.GetInventarioFisicoDetallesAlmacen(CveInventarioFisico, UsuarioActual.CveEmpresa) Then
DtAlmacen = ObjInventario.DtResultados
End If
If ObjInventario.GetInventarioFisicoDetallesClasificacion(CveInventarioFisico, UsuarioActual.CveEmpresa) Then
DtClasificacion = ObjInventario.DtResultados.FiltraParametros("Incluye = 1")
DtClasificacionExcluida = ObjInventario.DtResultados.FiltraParametros("Incluye = 0")
End If
If ObjInventario.GetInventarioFisicoDetallesProveedores(CveInventarioFisico, UsuarioActual.CveEmpresa) Then
DtProveedor = ObjInventario.DtResultados.FiltraParametros("Incluye = 1")
End If
For Each Gvr As DataRow In DtAlmacen.Rows
If Not ObjInventario.AddInventarioFisicoAlmacenes(CveInventarioFisicoNew, Gvr("CveAlmacen").ToString.ToEntero) Then
ErrorClasif = True
Exit For
End If
Next
If ErrorClasif = False Then
For Each Gvr As DataRow In DtClasificacion.Rows
If Not ObjInventario.AddInventarioFisicoClasificaciones(CveInventarioFisicoNew, Gvr("CveClasificacion").ToString.ToEntero, UsuarioActual.CveUsuario, True) Then
ErrorClasif = True
Exit For
End If
Next
For Each Gvr As DataRow In DtClasificacionExcluida.Rows
If Not ObjInventario.AddInventarioFisicoClasificaciones(CveInventarioFisicoNew, Gvr("CveClasificacion").ToString.ToEntero, UsuarioActual.CveUsuario, False) Then
ErrorClasif = True
Exit For
End If
Next
End If
If ErrorClasif = False Then
For Each Gvr As GridViewRow In GvF.Rows
If Gvr.FCCheckBox("ChkPSFaltante").Checked Then
If Not ObjInventario.AddInventarioFisicoProductosServicios(CveInventarioFisicoNew, Gvr.DataKey("CvePS").ToString.ToEntero, True) Then
ErrorClasif = True
Exit For
End If
End If
Next
For Each Gvr As GridViewRow In GvS.Rows
If Gvr.FCCheckBox("ChkPSSobrante").Checked Then
If Not ObjInventario.AddInventarioFisicoProductosServicios(CveInventarioFisicoNew, Gvr.DataKey("CvePS").ToString.ToEntero, True) Then
ErrorClasif = True
Exit For
End If
End If
Next
End If
If ErrorClasif = False Then
For Each Gvr As DataRow In DtProveedor.Rows
If Not ObjInventario.AddInventarioFisicoProveedores(CveInventarioFisicoNew, Gvr("CveProveedor").ToString.ToEntero, True) Then
ErrorClasif = True
Exit For
End If
Next
End If
End If
If ErrorClasif = False And CveInventarioFisicoNew > 0 Then
ObjInventario.Commit()
Alert("Agregado Correctamente.", TipoMensaje.MsgInformacion)
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalGuardar"))
GvF.Columns(0).Visible = False
GvS.Columns(0).Visible = False
LnkGuardar.Visible = False
LnkCrear.Visible = True
CargaDatos(CveInventarioFisico)
Else
ObjInventario.RollBack()
End If
ObjInventario.Dispose()
End Sub
Private Sub PSIguales()
Dim contadorF As Integer = 0
Dim contadorS As Integer = 0
For Each dtF As GridViewRow In GvF.Rows
contadorS = 0
For Each dtS As GridViewRow In GvS.Rows
If dtS.DataKey("CvePS") = dtF.DataKey("CvePS") Then
GvS.Rows(contadorS).BackColor = Drawing.Color.FromArgb(202, 52, 52)
GvF.Rows(contadorF).BackColor = Drawing.Color.FromArgb(202, 52, 52)
End If
contadorS += 1
Next
contadorF += 1
Next
End Sub
End Class