Exel anexos horizontales, AF
This commit is contained in:
@@ -67,6 +67,9 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
@@ -77,57 +80,23 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
CveTipoServicio = Request("CveTipoServicio").ToEntero
|
||||
End If
|
||||
|
||||
CargaCombos()
|
||||
|
||||
|
||||
If CveTipoServicio = -1 Then
|
||||
CrearTablas()
|
||||
CargaActividades()
|
||||
CargaCheckList()
|
||||
Else
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
CargaCombos()
|
||||
|
||||
End If
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -157,10 +126,6 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
|
||||
|
||||
|
||||
If CveTipoServicio <= 0 Then
|
||||
CargaActividades()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -221,6 +186,25 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim ErrorProceso As Boolean = False
|
||||
|
||||
Dim ObjAf As New ClsAF
|
||||
|
||||
If ObjAf.GetTiposServicios(CveTipoServicio, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
|
||||
If ObjAf.DtResultados.Rows.Count > 0 Then
|
||||
TxtTipoServicio.Text = ObjAf.DtResultados(0)("Nombre").ToString
|
||||
DdlTipoMantenimiento.SelectedValueExist(ObjAf.DtResultados(0)("CveTipoMantenimiento").ToString)
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
ErrorProceso = True
|
||||
End If
|
||||
|
||||
ObjAf.Dispose()
|
||||
|
||||
CargaMateriales()
|
||||
CargaActividades()
|
||||
CargaCheckList()
|
||||
@@ -233,7 +217,9 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
|
||||
If ObjAF.GetTiposServiciosMaterial(-1, CveTipoServicio) Then
|
||||
If ObjAF.GetTiposServiciosMaterial(-1, CveTipoServicio, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
DTMateriales = ObjAF.DtResultados
|
||||
GvMaterial.DataSource = DTMateriales
|
||||
|
||||
Else
|
||||
@@ -256,20 +242,26 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
|
||||
If CveTipoServicio <= 0 Then
|
||||
If CveTipoServicio > 0 Then
|
||||
|
||||
If ObjAF.GetActividades(-1, -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjAF.GetTiposServiciosActividades(-1, CveTipoServicio, -1) Then
|
||||
GvActividades.DataSource = ObjAF.DtResultados
|
||||
Else
|
||||
GvActividades.DataSource = Nothing
|
||||
End If
|
||||
|
||||
Else
|
||||
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
|
||||
@@ -278,17 +270,51 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
Dim ObjAF As New ClsAF
|
||||
|
||||
If CveTipoServicio > 0 Then
|
||||
|
||||
If ObjAF.GetCheckList(-1, CveTipoServicio, -1, UsuarioActual.CveEmpresa) Then
|
||||
GvCheckList.DataSource = ObjAF.DtResultados
|
||||
Else
|
||||
GvCheckList.DataSource = Nothing
|
||||
End If
|
||||
|
||||
Else
|
||||
If ObjAF.GetCheckListActividad(-1, -1, UsuarioActual.CveEmpresa) Then
|
||||
GvCheckList.DataSource = ObjAF.DtResultados
|
||||
Else
|
||||
GvCheckList.DataSource = Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
ObjAF.Dispose()
|
||||
|
||||
|
||||
GvCheckList.DataBind()
|
||||
UpGvCheckList.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs)
|
||||
|
||||
|
||||
|
||||
Protected Sub GvCheckList_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim Chk As CheckBox = e.Row.FCCheckBox("Chk")
|
||||
|
||||
If e.Row.DataKey("CveCheckListActividad").ToEntero = 0 Then
|
||||
|
||||
e.Row.FCLiteral("LtlNROW").Text = e.Row.DataKey("CheckListActividadGrupo").ToString
|
||||
Chk.Visible = False
|
||||
e.Row.Attributes.Add("style", "background-color:#DDD")
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If e.Row.DataKey("CveTipoServicio").ToEntero > 0 Then
|
||||
Chk.Checked = True
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
@@ -572,36 +598,146 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
'validacion?
|
||||
|
||||
If CveTipoServicio = -1 Then
|
||||
|
||||
If ObjAF.AddTiposServicios(TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
|
||||
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("TxtHoras").Text.ToDecimal
|
||||
|
||||
If Chk.Checked Then
|
||||
If Not ObjAF.AddTiposServiciosActividades(GvRow.DataKey("CveActividad").ToEntero, CveTipoServicio, Horas, "") Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
CveTipoServicio = ObjAF.CveTipoServicio
|
||||
For Each GvRow As GridViewRow In GvCheckList.Rows
|
||||
|
||||
For Each GvRow As GridViewRow In GvMaterial.Rows
|
||||
Dim Chk As CheckBox = GvRow.FCCheckBox("Chk")
|
||||
Dim CveCheckListActividad As Integer = GvRow.DataKey("CveCheckListActividad").ToEntero
|
||||
|
||||
If Chk.Checked Then
|
||||
If Not ObjAF.AddCheckList(CveTipoServicio, CveCheckListActividad) Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
If Not ObjAF.UpdateTiposServicios(CveTipoServicio, TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
ErrorProceso = True
|
||||
End If
|
||||
|
||||
|
||||
If Not ErrorProceso Then
|
||||
|
||||
For Each GvRow As GridViewRow In GvActividades.Rows
|
||||
|
||||
|
||||
Dim Chk As CheckBox = GvRow.FCCheckBox("Chk")
|
||||
Dim CveTipoServicioActividad As Integer = GvRow.DataKey("CveTipoServicioActividad").ToEntero
|
||||
Dim CveActividad As Integer = GvRow.DataKey("CveActividad").ToEntero
|
||||
|
||||
Dim Horas As Decimal = GvRow.FCTextBox("TxtHoras").Text.ToDecimal
|
||||
|
||||
If Chk.Checked Then
|
||||
|
||||
If CveTipoServicioActividad > 0 Then
|
||||
If Not ObjAF.UpdateTiposServiciosActividades(CveTipoServicioActividad, CveActividad, Horas, "") Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
If Not ObjAF.AddTiposServiciosActividades(CveActividad, CveTipoServicio, Horas, "") Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
If CveTipoServicioActividad > 0 Then
|
||||
If Not ObjAF.DeleteTiposServiciosActividades(CveTipoServicioActividad, UsuarioActual.CveEmpresa) Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not ErrorProceso Then
|
||||
|
||||
For Each GvRow As GridViewRow In GvCheckList.Rows
|
||||
Dim Chk As CheckBox = GvRow.FCCheckBox("Chk")
|
||||
|
||||
|
||||
If Chk.Visible Then
|
||||
|
||||
Dim CveTipoServicioTmp As Integer = GvRow.DataKey("CveTipoServicio").ToEntero
|
||||
Dim CveCheckList As Integer = GvRow.DataKey("CveCheckList").ToEntero
|
||||
Dim CveCheckListActividad As Integer = GvRow.DataKey("CveCheckListActividad").ToEntero
|
||||
|
||||
If CveTipoServicioTmp > 0 Then
|
||||
|
||||
If Not Chk.Checked Then
|
||||
|
||||
If Not ObjAF.DeleteCheckList(CveCheckList) Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
If Chk.Checked Then
|
||||
If Not ObjAF.AddCheckList(CveTipoServicio, CveCheckListActividad) Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
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
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
If ErrorProceso Then
|
||||
ObjAF.RollBack()
|
||||
Else
|
||||
@@ -612,6 +748,77 @@ Partial Class AF_TipoOrdenTrabajo
|
||||
|
||||
ObjAF.Dispose()
|
||||
|
||||
CargaDatos()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub Chk_CheckedChanged(sender As Object, e As EventArgs)
|
||||
|
||||
'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, CheckBox).BindingContainer, GridViewRow)
|
||||
'Dim Chk As CheckBox = GvRow.FCCheckBox("Chk")
|
||||
|
||||
'Dim CveTipoServicioActividad As Integer = GvRow.DataKey("CveTipoServicioActividad").ToEntero
|
||||
'Dim CveActividad As Integer = GvRow.DataKey("CveActividad").ToEntero
|
||||
|
||||
'Dim Horas As Decimal = GvRow.FCTextBox("TxtHoras").Text.ToDecimal
|
||||
|
||||
'Dim ObjAF As New ClsAF
|
||||
|
||||
|
||||
'If Chk.Checked Then
|
||||
|
||||
' If CveTipoServicioActividad > 0 Then
|
||||
' If ObjAF.UpdateTiposServiciosActividades(CveTipoServicioActividad, CveActividad, Horas, "") Then
|
||||
|
||||
' End If
|
||||
' Else
|
||||
' If ObjAF.AddTiposServiciosActividades(CveActividad, CveTipoServicio, Horas, "") Then
|
||||
|
||||
' End If
|
||||
' End If
|
||||
|
||||
'Else
|
||||
|
||||
|
||||
' If CveTipoServicioActividad > 0 Then
|
||||
|
||||
' If ObjAF.DeleteTiposServiciosActividades(CveTipoServicioActividad, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
'End If
|
||||
|
||||
|
||||
'ObjAF.Dispose()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Protected Sub GvActividades_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
Dim CveTipoServicioActividad As Integer = e.Row.DataKey("CveTipoServicioActividad").ToEntero
|
||||
Dim TxtHoras As TextBox = e.Row.FCTextBox("TxtHoras")
|
||||
Dim Chk As CheckBox = e.Row.FCCheckBox("Chk")
|
||||
|
||||
If CveTipoServicioActividad > 0 Then
|
||||
|
||||
Chk.Checked = True
|
||||
TxtHoras.Text = e.Row.DataKey("Duracion")
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user