T129 Auditoria SAT
This commit is contained in:
@@ -12,20 +12,59 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
#Region " PROPIEDADES"
|
||||
|
||||
Property CveOrdenTrabajo As Integer
|
||||
Property CveTipoServicio As Integer
|
||||
Get
|
||||
If ViewState("CveOrdenTrabajo") Is Nothing Then
|
||||
If ViewState("CveTipoServicio") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("CveOrdenTrabajo").ToString.ToEntero
|
||||
Return ViewState("CveTipoServicio").ToString.ToEntero
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveOrdenTrabajo") = value
|
||||
ViewState("CveTipoServicio") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property DTMateriales As DataTable
|
||||
Get
|
||||
If ViewState("DTMateriales") Is Nothing Then
|
||||
Return New DataTable
|
||||
Else
|
||||
Return DirectCast(ViewState("DTMateriales"), DataTable)
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTMateriales") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Property DTActividades As DataTable
|
||||
Get
|
||||
If ViewState("DTActividades") Is Nothing Then
|
||||
Return New DataTable
|
||||
Else
|
||||
Return DirectCast(ViewState("DTActividades"), DataTable)
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTActividades") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Property DTACheckList As DataTable
|
||||
Get
|
||||
If ViewState("DTACheckList") Is Nothing Then
|
||||
Return New DataTable
|
||||
Else
|
||||
Return DirectCast(ViewState("DTACheckList"), DataTable)
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTACheckList") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
#End Region
|
||||
@@ -34,8 +73,12 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
|
||||
If Request("CveOrdenTrabajo") IsNot Nothing Then
|
||||
CveOrdenTrabajo = Request("CveOrdenTrabajo").ToEntero
|
||||
If Request("CveTipoServicio") IsNot Nothing Then
|
||||
CveTipoServicio = Request("CveTipoServicio").ToEntero
|
||||
End If
|
||||
|
||||
If CveTipoServicio = -1 Then
|
||||
CrearTablas()
|
||||
End If
|
||||
|
||||
CargaCombos()
|
||||
@@ -43,11 +86,57 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Property IndexMaterial As Integer
|
||||
Get
|
||||
If ViewState("IndexMaterial") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("IndexMaterial").ToString.ToEntero
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("IndexMaterial") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
Property IndexActividades As Integer
|
||||
Get
|
||||
If ViewState("IndexActividades") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("IndexActividades").ToString.ToEntero
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("IndexActividades") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property IndexCheckList As Integer
|
||||
Get
|
||||
If ViewState("IndexCheckList") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("IndexCheckList").ToString.ToEntero
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("IndexCheckList") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
#Region " CARGA PARAMETROS "
|
||||
|
||||
#End Region
|
||||
|
||||
#Region " CARGA COMBOS "
|
||||
|
||||
Protected Sub CargaCombos()
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
@@ -65,6 +154,52 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
UpFiltro.Update()
|
||||
|
||||
DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
|
||||
|
||||
|
||||
If CveTipoServicio <= 0 Then
|
||||
CargaActividades()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CREAR TABLAS"
|
||||
|
||||
Private Sub CrearTablas()
|
||||
'CveTipoServicioMaterial CveTipoServicio Cantidad CveUM CvePS Tipo
|
||||
|
||||
Dim DtTempMaterial As New DataTable
|
||||
Dim DtTempActividades As New DataTable
|
||||
|
||||
DtTempMaterial.Columns.Add("CveTipoServicioMaterial", GetType(Integer))
|
||||
DtTempMaterial.Columns.Add("CveTipoServicio", GetType(Integer))
|
||||
DtTempMaterial.Columns.Add("Cantidad", GetType(Decimal))
|
||||
DtTempMaterial.Columns.Add("CveUM", GetType(Integer))
|
||||
DtTempMaterial.Columns.Add("CvePS", GetType(Integer))
|
||||
DtTempMaterial.Columns.Add("Tipo", GetType(Integer))
|
||||
DtTempMaterial.Columns.Add("PS", GetType(String))
|
||||
DtTempMaterial.Columns.Add("Abreviatura", GetType(String))
|
||||
DtTempMaterial.AcceptChanges()
|
||||
|
||||
DTMateriales = DtTempMaterial
|
||||
|
||||
|
||||
'CveTipoServicioActividad CveActividad Duracion Observaciones
|
||||
|
||||
DtTempActividades.Columns.Add("CveTipoServicioActividad", GetType(String))
|
||||
DtTempActividades.Columns.Add("CveActividad", GetType(String))
|
||||
DtTempActividades.Columns.Add("Duracion", GetType(Decimal))
|
||||
DtTempActividades.Columns.Add("Observaciones", GetType(String))
|
||||
DtTempActividades.AcceptChanges()
|
||||
|
||||
DTActividades = DtTempActividades
|
||||
|
||||
|
||||
End Sub
|
||||
@@ -72,6 +207,7 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " CARGA DATOS "
|
||||
'Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs)
|
||||
' CargaDatos()
|
||||
@@ -85,6 +221,61 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
CargaMateriales()
|
||||
CargaActividades()
|
||||
CargaCheckList()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaMateriales()
|
||||
|
||||
If CveTipoServicio > 0 Then
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
|
||||
If ObjAF.GetTiposServiciosMaterial(-1, CveTipoServicio) Then
|
||||
GvMaterial.DataSource = DTMateriales
|
||||
|
||||
Else
|
||||
GvMaterial = Nothing
|
||||
End If
|
||||
|
||||
ObjAF.Dispose()
|
||||
|
||||
GvMaterial.DataBind()
|
||||
Else
|
||||
GvMaterial.DataSource = DTMateriales
|
||||
GvMaterial.DataBind()
|
||||
End If
|
||||
|
||||
UpGvMaterial.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaActividades()
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
|
||||
If CveTipoServicio <= 0 Then
|
||||
|
||||
If ObjAF.GetActividades(-1, -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
GvActividades.DataSource = ObjAF.DtResultados
|
||||
Else
|
||||
GvActividades.DataSource = Nothing
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ObjAF.Dispose()
|
||||
|
||||
GvActividades.DataBind()
|
||||
|
||||
UpGvActividades.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCheckList()
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
|
||||
|
||||
@@ -94,7 +285,6 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs)
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
@@ -110,9 +300,6 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
|
||||
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
@@ -277,4 +464,154 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkAgregarMaterial_Click(sender As Object, e As EventArgs)
|
||||
|
||||
RegistraScript("$('#ModalMateriales').modal('show');")
|
||||
ResetModalMaterial()
|
||||
End Sub
|
||||
|
||||
Private Sub ResetModalMaterial()
|
||||
|
||||
DdlPS.txtValue.Value = ""
|
||||
DdlPS.txtText.Value = ""
|
||||
TxtCantidad.Text = ""
|
||||
|
||||
UpModalMaterialesBody.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub BtnGuardarMaterial_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If DdlPS.txtValue.Value.ToString.ToEntero <= 0 Then
|
||||
Alert("Debe seleccionar un producto o servicio", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim CveUnidadMedida As Integer = -1
|
||||
Dim CvePS As Integer = DdlPS.txtValue.Value.ToEntero
|
||||
Dim Tipo As Integer = -1
|
||||
Dim UMAbreviatura As String = ""
|
||||
|
||||
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
CveUnidadMedida = drPS("CveUM").ToString.ToEntero
|
||||
Tipo = drPS("CveTipoPS").ToString.ToEntero
|
||||
UMAbreviatura = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Abreviatura", $"CveUnidadMedida = {CveUnidadMedida}")
|
||||
|
||||
If CveTipoServicio > 0 Then
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
|
||||
If ObjAF.AddTiposServiciosMaterial(CveTipoServicio, TxtCantidad.Text.ToDecimal, CveUnidadMedida, CvePS, Tipo) Then
|
||||
Alert("Material agregado correctamente")
|
||||
End If
|
||||
|
||||
ObjAF.Dispose()
|
||||
|
||||
Else
|
||||
|
||||
Dim nRow As DataRow = DTMateriales.NewRow
|
||||
|
||||
nRow("CveTipoServicioMaterial") = -1
|
||||
nRow("CveTipoServicio") = -1
|
||||
nRow("Cantidad") = TxtCantidad.Text.ToEntero
|
||||
nRow("CveUM") = CveUnidadMedida
|
||||
nRow("CvePS") = DdlPS.txtValue.Value.ToEntero
|
||||
nRow("Tipo") = Tipo
|
||||
nRow("Abreviatura") = UMAbreviatura
|
||||
nRow("PS") = DdlPS.txtText.Value
|
||||
|
||||
DTMateriales.Rows.Add(nRow)
|
||||
Alert("Material agregado correctamente")
|
||||
|
||||
End If
|
||||
|
||||
CargaMateriales()
|
||||
|
||||
ResetModalMaterial()
|
||||
|
||||
RegistraScript("$('#ModalMateriales').modal('hide');")
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkEliminarMaterial_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow)
|
||||
If CveTipoServicio > 0 Then
|
||||
|
||||
|
||||
Dim CveTipoServicioMaterial As Integer = GvRow.DataKey("CveTipoServicioMaterial").ToEntero
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
If ObjAF.DeleteTiposServiciosMaterial(CveTipoServicioMaterial, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Material agregado correctamente")
|
||||
End If
|
||||
ObjAF.Dispose()
|
||||
Else
|
||||
|
||||
|
||||
Dim dr As DataRow = DTMateriales.Rows(GvRow.RowIndex)
|
||||
dr.Delete()
|
||||
DTMateriales.AcceptChanges()
|
||||
Alert("Material agregado correctamente")
|
||||
End If
|
||||
|
||||
CargaMateriales()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
Dim ErrorProceso As Boolean = False
|
||||
Dim SBError As New StringBuilder
|
||||
|
||||
ObjAF.IniciaTransacSQL()
|
||||
|
||||
'validacion?
|
||||
|
||||
|
||||
|
||||
If ObjAF.AddTiposServicios(TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
|
||||
CveTipoServicio = ObjAF.CveTipoServicio
|
||||
|
||||
For Each GvRow As GridViewRow In GvMaterial.Rows
|
||||
|
||||
If Not ObjAF.AddTiposServiciosMaterial(CveTipoServicio, GvRow.DataKey("Cantidad").ToDecimal, GvRow.DataKey("CveUM").ToEntero, GvRow.DataKey("CvePS").ToEntero, GvRow.DataKey("Tipo").ToEntero) Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
For Each GvRow As GridViewRow In GvActividades.Rows
|
||||
|
||||
Dim Chk As CheckBox = GvRow.FCCheckBox("Chk")
|
||||
Dim Horas As Decimal = GvRow.FCTextBox("").Text.ToDecimal
|
||||
|
||||
|
||||
If ObjAF.AddTiposServiciosActividades(GvRow.DataKey("").ToEntero) Then
|
||||
|
||||
Next
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If ErrorProceso Then
|
||||
ObjAF.RollBack()
|
||||
Else
|
||||
ObjAF.Commit()
|
||||
Alert("Tipo servicio guardado correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
|
||||
ObjAF.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user