This commit is contained in:
Antonio Gonzalez
2020-08-22 12:16:27 -07:00
19 changed files with 1127 additions and 464 deletions

View File

@@ -39,15 +39,21 @@
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
Registro Revisión
Tipo Servicio
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel runat="server" ID="UpAgregar" UpdateMode="Conditional">
<ContentTemplate>
<li style="text-align: left!important">
<asp:LinkButton runat="server" ID="LnkAgregarMaterial" CssClass=" " data-html="true" data-toggle="tooltip" data-placement="left" title="Agregar Material" Text="<i class='fa fa-plus'></i> Agregar Material" OnClick="LnkAgregarMaterial_Click"></asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
@@ -90,9 +96,7 @@
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoMantenimiento" CssClass="form-control input-sm select2me" Width="100%" runat="server" DataTextField="TipoMantenimiento" DataValueField="CveTipoMantenimiento"></asp:DropDownList>
<label for="<%= DdlTipoMantenimiento.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblTipo" Text="Tipo Mantenimiento:"></asp:Label>
</label>
@@ -100,13 +104,13 @@
<asp:RequiredFieldValidator ID="RFVDdlTipoServicio" runat="server" InitialValue="-1" ControlToValidate="DdlTipoMantenimiento" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Mantenimientp''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox CssClass="form-control" ID="TxtDuracion" runat="server" MaxLength="30"></asp:TextBox>
<%-- <div class="form-group form-md-line-input input-iconright">
<asp:TextBox CssClass="form-control" ID="TxtDuracion" runat="server" MaxLength="5"></asp:TextBox>
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtDuracion" FilterType="Numbers,Custom" InvalidChars="-*+" ValidChars="1234567890." />
<asp:Label AssociatedControlID="TxtDuracion" runat="server" Text="Duración:"></asp:Label>
<asp:RequiredFieldValidator ID="RFVTxtDuracion" runat="server" ControlToValidate="TxtDuracion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Duración''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<i></i>
</div>
</div>--%>
</div>
@@ -125,28 +129,43 @@
<ajax:TabContainer ID="Tab" runat="server" ActiveTabIndex="0" Width="100%" >
<ajax:TabPanel ID="TabMaterial" runat="server" HeaderText="Materia">
<ajax:TabPanel ID="TabMaterial" runat="server" HeaderText="Material">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvMaterial" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron datos" ToolTip="" CssClass="table table-smallpadding Widthall"
DataKeyNames=""
GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Unidad">
<ItemStyle Width="350px" />
<ItemTemplate>
<asp:Literal ID="LtlDescripcion" runat="server" Text='<%# Eval("Unidad")%>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:UpdatePanel runat="server" ID="UpGvMaterial" UpdateMode="Conditional" >
<ContentTemplate>
<asp:GridView ID="GvMaterial" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron datos" ToolTip="" CssClass="table table-smallpadding Widthall"
DataKeyNames="CveTipoServicioMaterial,CveTipoServicio,Cantidad,CveUM,CvePS,Tipo"
GridLines="None">
<Columns>
<asp:BoundField DataField="Cantidad" ItemStyle-Width="15%" HeaderText="Cantidad" />
<asp:BoundField DataField="Abreviatura" ItemStyle-Width="15%" HeaderText="U.M." />
<asp:TemplateField ItemStyle-Width="45%" HeaderText="Producto" >
<ItemTemplate>
<asp:Label ID="LblPS" runat="server" Text='<%# Eval("PS") %>' Width="220px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="25%">
<ItemTemplate>
<asp:LinkButton ID="LnkEliminarMaterial" runat="server" AlternateText="Eliminar" OnClick="LnkEliminarMaterial_Click" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
@@ -156,49 +175,73 @@
<ajax:TabPanel ID="TabActividades" runat="server" HeaderText="Actividades">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<asp:GridView ID="GvActividades" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron datos" ToolTip="" CssClass="table table-smallpadding Widthall"
DataKeyNames=""
GridLines="None">
<Columns>
<asp:UpdatePanel runat="server" ID="UpGvActividades" UpdateMode="Conditional" >
<ContentTemplate>
<asp:TemplateField HeaderText="Unidad">
<ItemStyle Width="350px" />
<ItemTemplate>
<asp:Literal ID="LtlDescripcion" runat="server" Text='<%# Eval("Unidad")%>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:GridView ID="GvActividades" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron datos" ToolTip="" CssClass="table table-smallpadding Widthall"
DataKeyNames="CveActividad" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="">
<ItemStyle Width="20px" />
<ItemTemplate>
<asp:CheckBox runat="server" ID="Chk" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:TemplateField HeaderText="Horas" >
<ItemStyle Width="100px" />
<ItemTemplate>
<asp:TextBox runat="server" ID="TxtHoras" Width="100px"></asp:TextBox>
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtHoras" FilterType="Custom" ValidChars="1234567890." />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Nombre" ItemStyle-Width="30%" HeaderText="Actividad" />
<asp:BoundField DataField="Puesto" ItemStyle-Width="30%" HeaderText="Puesto" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabCheckList" runat="server" HeaderText="check List">
<ajax:TabPanel ID="TabCheckList" runat="server" HeaderText="Check List">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvCheckList" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron datos" ToolTip="" CssClass="table table-smallpadding Widthall"
DataKeyNames=""
GridLines="None">
<Columns>
<asp:UpdatePanel runat="server" ID="UpGvCheckList" UpdateMode="Conditional" >
<ContentTemplate>
<asp:GridView ID="GvCheckList" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron datos" ToolTip="" CssClass="table table-smallpadding Widthall"
DataKeyNames=""
GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Unidad">
<ItemStyle Width="350px" />
<ItemTemplate>
<asp:Literal ID="LtlDescripcion" runat="server" Text='<%# Eval("Unidad")%>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unidad">
<ItemStyle Width="350px" />
<ItemTemplate>
<asp:Literal ID="LtlDescripcion" runat="server" Text='<%# Eval("Unidad")%>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
@@ -209,13 +252,60 @@
</ajax:TabContainer>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
<div id="ModalMateriales" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Literal ID="Literal1" runat="server">Material </asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpModalMaterialesBody" UpdateMode="Conditional">
<ContentTemplate>
<div class="form-group form-md-line-input input-iconright">
<ADS:Dropdownlost runat="server" ID="DdlPS" DataTextField="PSCodigo" DataValueField="CvePS" Width="100%" CssClassDdl="select2me" CssStyle="width: 220px;"/>
<label for="<%= DdlPS.ClientID.ToString()%>">
Producto:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCantidad" runat="server" CssClass="form-control" MaxLength="100"></asp:TextBox>
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtCantidad" FilterType="Custom" ValidChars="1234567890." />
<asp:RequiredFieldValidator ID="RFVTxtCantidad" runat="server" ControlToValidate="TxtCantidad" CssClass="help-block errorimput" ErrorMessage="&lt;b&gt;&lt;span style='text-decoration: underline'&gt;ERROR:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;El campo &lt;b&gt;''Telefono ''&lt;/b&gt; es necesario, por favor ingréselo." ValidationGroup="GrpMaterial"></asp:RequiredFieldValidator>
<label for="<%= TxtCantidad.ClientID.ToString()%>">
Cantidad:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:CheckBox runat="server" Text="Continuar agregando" ID="ChkContinuarMaterial" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button runat="server" ID="BtnGuardarMaterial" Text="Guardar" CssClass="btn btn-primary" ValidationGroup="GrpMaterial" OnClick="BtnGuardarMaterial_Click" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
@@ -262,13 +352,14 @@
</div>
</div>
<br />
<div class="row">
<div class="col-md-12" style="text-align:center">
<asp:UpdatePanel ID="UpGuardar" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="BtnGuardar" runat="server" Text="Guardar" ValidationGroup="GrpGuardar" CssClass="btn btn-primary" OnClick="BtnGuardar_Click" Visible="false" />
<asp:Button ID="BtnGuardar" runat="server" Text="Guardar" ValidationGroup="GrpGuardar" CssClass="btn btn-primary" OnClick="BtnGuardar_Click" Visible="true" />
</ContentTemplate>
</asp:UpdatePanel>

View File

@@ -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