Se implementa checkbox para generar viajes masivos. Se completa el descriptivo de la unidad y de chofer en la lista de viajes. Se hace la función para generar viajes en el lado de cliente.
This commit is contained in:
@@ -8,230 +8,248 @@
|
|||||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||||
<style>
|
<style>
|
||||||
.my-1 {
|
.my-1 {
|
||||||
margin-block: 1rem;
|
margin-block: .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fecha {
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
|
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
|
||||||
<ContentTemplate>
|
<contenttemplate>
|
||||||
<li>
|
<li>
|
||||||
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
|
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
|
||||||
Target="_blank"><i class='fa fa-list'></i>Contratos</asp:HyperLink>
|
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
|
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
|
||||||
Target="_blank"><i class='fa fa-road'></i>Viajes</asp:HyperLink>
|
Target="_blank"><i class='fa fa-road'></i>Viajes</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
</ContentTemplate>
|
</contenttemplate>
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||||
|
|
||||||
|
|
||||||
<div class="row" style="margin-block: 10px; margin-right: 10px;" align="right">
|
<div class="row" style="margin-block: 10px; margin-right: 10px;" align="right">
|
||||||
<asp:LinkButton OnClick="MostrarModal" runat="server" AlternateText="Agregar"
|
<asp:LinkButton OnClick="MostrarModal" runat="server" AlternateText="Agregar"
|
||||||
CssClass="btn btn-sm blue" align="right" Text="Agregar<i class='fa fa-plus'></i>" />
|
CssClass="btn btn-sm blue" align="right" Text="Agregar<i class='fa fa-plus'></i>" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<asp:GridView ID="GvViajes" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontró ningún viaje registrado"
|
<asp:GridView ID="GvViajes" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontró ningún viaje registrado"
|
||||||
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
||||||
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino">
|
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Ruta">
|
<asp:TemplateField HeaderText="Ruta">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("CveRuta") %>'></asp:Literal>
|
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("CveRuta") %>'></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Partida">
|
<asp:TemplateField HeaderText="Partida">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal ID="LtlPartida" runat="server" Text='<%# Eval("Partida") %>'></asp:Literal>
|
<asp:Literal ID="LtlPartida" runat="server" Text='<%# Eval("Partida") %>'></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Destino">
|
<asp:TemplateField HeaderText="Destino">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal ID="LtlDestino" runat="server" Text='<%# Eval("Destino") %>'></asp:Literal>
|
<asp:Literal ID="LtlDestino" runat="server" Text='<%# Eval("Destino") %>'></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Fecha">
|
<asp:TemplateField HeaderText="Fecha">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha") %>'></asp:Literal>
|
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha") %>'></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Unidad">
|
<asp:TemplateField HeaderText="Unidad">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha") %>'></asp:Literal>
|
<asp:Literal ID="LltAF" runat="server" Text='<%# Eval("Unidad") %>'></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Chofer">
|
<asp:TemplateField HeaderText="Chofer">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal ID="LtlChofer" runat="server" Text='<%# Eval("NombreCompleto") %>'></asp:Literal>
|
<asp:Literal ID="LtlChofer" runat="server" Text='<%# Eval("NombreCompleto") %>'></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
|
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
|
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
|
||||||
CssClass="btn btn-circle btn-sm green" OnClick="UpdateViaje" Text="<i class='fa fa-pencil'></i>" />
|
CssClass="btn btn-circle btn-sm green" OnClick="UpdateViaje" Text="<i class='fa fa-pencil'></i>" />
|
||||||
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
|
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
|
||||||
CssClass="btn btn-circle btn-sm red" OnClick="RemoveViaje" Text="<i class='fa fa-trash'></i>"
|
CssClass="btn btn-circle btn-sm red" OnClick="RemoveViaje" Text="<i class='fa fa-trash'></i>"
|
||||||
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar"
|
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar"
|
||||||
data-btn-ok-label="si" />
|
data-btn-ok-label="si" />
|
||||||
|
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
</Columns>
|
</Columns>
|
||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
|
|
||||||
<div id="ModalAgregar" class="modal ADS fade" role="dialog">
|
<div id="ModalAgregar" class="modal ADS fade" role="dialog">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div id="UpAddChofer" class="modal-content rowpadding" tabindex="-1"
|
<div id="UpAddChofer" class="modal-content rowpadding" tabindex="-1"
|
||||||
runat="server">
|
runat="server">
|
||||||
<contenttemplate>
|
<contenttemplate>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
<h4 class="modal-title" id="ModalLabel" runat="server">Agregar Viaje</h4>
|
<h4 class="modal-title" id="ModalLabel" runat="server">Agregar Viaje</h4>
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
|
|
||||||
<div class="portlet-body">
|
|
||||||
<div class="row margin-bottom-5" id="TrAF" runat="server">
|
|
||||||
<label class="col-md-4 bold">
|
|
||||||
<asp:Label runat="server" Text="Transporte:"></asp:Label></label><div
|
|
||||||
class="col-md-8">
|
|
||||||
|
|
||||||
<asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion"
|
|
||||||
DataValueField="CveActivoFijo" Class="table-group-action-input form-control input-inline text-center"
|
|
||||||
Width="200px" runat="server">
|
|
||||||
</asp:DropDownList>
|
|
||||||
<asp:RequiredFieldValidator ID="RFVTransporte" runat="server" ControlToValidate="DdlTransporte"
|
|
||||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Transporte''</b> es necesario, por favor ingréselo."
|
|
||||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
||||||
<ajax:ValidatorCalloutExtender ID="VCETransporte" runat="server" HighlightCssClass="vco"
|
|
||||||
TargetControlID="RFVTransporte" Width="400px" BehaviorID="_content_VCETransporte">
|
|
||||||
</ajax:ValidatorCalloutExtender>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row margin-bottom-5" id="TrRutas" runat="server">
|
|
||||||
<label class="col-md-4 bold">
|
|
||||||
<asp:Label runat="server" Text="Seleccione Ruta:"></asp:Label></label><div
|
|
||||||
class="col-md-8">
|
|
||||||
|
|
||||||
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
|
|
||||||
DataValueField="CveRuta" Class="table-group-action-input form-control input-inline text-center"
|
|
||||||
Width="200px" runat="server">
|
|
||||||
</asp:DropDownList>
|
|
||||||
<asp:RequiredFieldValidator ID="RFVRutas" runat="server" ControlToValidate="DdlRutas"
|
|
||||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Rutas''</b> es necesario, por favor ingréselo."
|
|
||||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
||||||
<ajax:ValidatorCalloutExtender ID="VCERutas" runat="server" HighlightCssClass="vco"
|
|
||||||
TargetControlID="RFVRutas" Width="400px" BehaviorID="_content_VCERutas">
|
|
||||||
</ajax:ValidatorCalloutExtender>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row margin-bottom-5" id="TrDestino" runat="server">
|
|
||||||
<label class="col-md-4 bold">
|
|
||||||
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
|
|
||||||
class="col-md-8">
|
|
||||||
|
|
||||||
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
|
|
||||||
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
|
|
||||||
Width="200px" runat="server">
|
|
||||||
</asp:DropDownList>
|
|
||||||
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
|
|
||||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Destino''</b> es necesario, por favor ingréselo."
|
|
||||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
||||||
<ajax:ValidatorCalloutExtender ID="VCEDestino" runat="server" HighlightCssClass="vco"
|
|
||||||
TargetControlID="RFVDestino" Width="400px" BehaviorID="_content_VCEDestino">
|
|
||||||
</ajax:ValidatorCalloutExtender>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row margin-bottom-5" id="TrPartida" runat="server">
|
|
||||||
<label class="col-md-4 bold">
|
|
||||||
<asp:Label runat="server" Text="Partida:"></asp:Label></label><div
|
|
||||||
class="col-md-8">
|
|
||||||
|
|
||||||
<asp:DropDownList ID="DdlPartida" AppendDataBoundItems="true" DataTextField="Destino"
|
|
||||||
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
|
|
||||||
Width="200px" runat="server">
|
|
||||||
</asp:DropDownList>
|
|
||||||
<asp:RequiredFieldValidator ID="RFVPartida" runat="server" ControlToValidate="DdlPartida"
|
|
||||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Partida''</b> es necesario, por favor ingréselo."
|
|
||||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
||||||
<ajax:ValidatorCalloutExtender ID="VCEPartida" runat="server" HighlightCssClass="vco"
|
|
||||||
TargetControlID="RFVPartida" Width="400px" BehaviorID="_content_VCEPartida">
|
|
||||||
</ajax:ValidatorCalloutExtender>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row margin-bottom-5" id="TrChofer" runat="server">
|
|
||||||
<label class="col-md-4 bold">
|
|
||||||
<asp:Label runat="server" Text="Chofer:"></asp:Label></label><div
|
|
||||||
class="col-md-8">
|
|
||||||
|
|
||||||
<asp:DropDownList ID="DdlChofer" AppendDataBoundItems="true" DataValueField="CvePersonal"
|
|
||||||
DataTextField="NombreCompleto" Class="table-group-action-input form-control input-inline text-center"
|
|
||||||
Width="200px" runat="server">
|
|
||||||
</asp:DropDownList>
|
|
||||||
<asp:RequiredFieldValidator ID="RFVChofer" runat="server" ControlToValidate="DdlChofer"
|
|
||||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Chofer''</b> es necesario, por favor ingréselo."
|
|
||||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
||||||
<ajax:ValidatorCalloutExtender ID="VCEChofer" runat="server" HighlightCssClass="vco"
|
|
||||||
TargetControlID="RFVChofer" Width="400px" BehaviorID="_content_VCEChofer">
|
|
||||||
</ajax:ValidatorCalloutExtender>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row my-1">
|
|
||||||
<label class="col-md-4 bold">Fecha Viaje:</label>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="input-group input-sm input-small date date-picker">
|
|
||||||
<asp:TextBox ID="TxtFechaViaje" runat="server" CssClass="form-control text-center"
|
|
||||||
Width="200px"
|
|
||||||
CausesValidation="True"
|
|
||||||
type="date"></asp:TextBox>
|
|
||||||
|
|
||||||
<asp:RequiredFieldValidator ID="RFVTxtFechaViaje" runat="server" ControlToValidate="TxtFechaViaje"
|
|
||||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Viaje''</b> es necesario, por favor ingréselo."
|
|
||||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
||||||
<ajax:ValidatorCalloutExtender ID="VCETxtFechaViaje" runat="server" HighlightCssClass="vco"
|
|
||||||
TargetControlID="RFVTxtFechaViaje" Width="400px" BehaviorID="_content_VCETxtFechaViaje">
|
|
||||||
</ajax:ValidatorCalloutExtender>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group form-md-line-input input-iconright" id="divEstatus" runat="server">
|
|
||||||
<asp:CheckBox ID="ChkEstatus" runat="server" CssClass="form-control bold" />
|
|
||||||
<label>Generar Viaje Masivo</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<asp:Button ID="BtnGuardar" OnClick="AddViaje" runat="server" CssClass="btn btn-primary"
|
|
||||||
Text="Guardar"
|
|
||||||
ValidationGroup="GrpGuardar"></asp:Button>
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</contenttemplate>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<div class="portlet-body">
|
||||||
|
<div class="row margin-bottom-5" id="TrAF" runat="server">
|
||||||
|
<label class="col-md-4 bold">
|
||||||
|
<asp:Label runat="server" Text="Transporte:"></asp:Label></label><div
|
||||||
|
class="col-md-8">
|
||||||
|
|
||||||
|
<asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion"
|
||||||
|
DataValueField="CveActivoFijo" Class="table-group-action-input form-control input-inline text-center"
|
||||||
|
Width="200px" runat="server">
|
||||||
|
</asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVTransporte" runat="server" ControlToValidate="DdlTransporte"
|
||||||
|
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Transporte''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="VCETransporte" runat="server" HighlightCssClass="vco"
|
||||||
|
TargetControlID="RFVTransporte" Width="400px" BehaviorID="_content_VCETransporte">
|
||||||
|
</ajax:ValidatorCalloutExtender>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row margin-bottom-5" id="TrRutas" runat="server">
|
||||||
|
<label class="col-md-4 bold">
|
||||||
|
<asp:Label runat="server" Text="Seleccione Ruta:"></asp:Label></label><div
|
||||||
|
class="col-md-8">
|
||||||
|
|
||||||
|
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
|
||||||
|
DataValueField="CveRuta" Class="table-group-action-input form-control input-inline text-center"
|
||||||
|
Width="200px" runat="server">
|
||||||
|
</asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVRutas" runat="server" ControlToValidate="DdlRutas"
|
||||||
|
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Rutas''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="VCERutas" runat="server" HighlightCssClass="vco"
|
||||||
|
TargetControlID="RFVRutas" Width="400px" BehaviorID="_content_VCERutas">
|
||||||
|
</ajax:ValidatorCalloutExtender>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row margin-bottom-5" id="TrDestino" runat="server">
|
||||||
|
<label class="col-md-4 bold">
|
||||||
|
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
|
||||||
|
class="col-md-8">
|
||||||
|
|
||||||
|
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
|
||||||
|
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
|
||||||
|
Width="200px" runat="server">
|
||||||
|
</asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
|
||||||
|
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Destino''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="VCEDestino" runat="server" HighlightCssClass="vco"
|
||||||
|
TargetControlID="RFVDestino" Width="400px" BehaviorID="_content_VCEDestino">
|
||||||
|
</ajax:ValidatorCalloutExtender>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row margin-bottom-5" id="TrPartida" runat="server">
|
||||||
|
<label class="col-md-4 bold">
|
||||||
|
<asp:Label runat="server" Text="Partida:"></asp:Label></label><div
|
||||||
|
class="col-md-8">
|
||||||
|
|
||||||
|
<asp:DropDownList ID="DdlPartida" AppendDataBoundItems="true" DataTextField="Destino"
|
||||||
|
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
|
||||||
|
Width="200px" runat="server">
|
||||||
|
</asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVPartida" runat="server" ControlToValidate="DdlPartida"
|
||||||
|
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Partida''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="VCEPartida" runat="server" HighlightCssClass="vco"
|
||||||
|
TargetControlID="RFVPartida" Width="400px" BehaviorID="_content_VCEPartida">
|
||||||
|
</ajax:ValidatorCalloutExtender>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row margin-bottom-5" id="TrChofer" runat="server">
|
||||||
|
<label class="col-md-4 bold">
|
||||||
|
<asp:Label runat="server" Text="Chofer:"></asp:Label></label><div
|
||||||
|
class="col-md-8">
|
||||||
|
|
||||||
|
<asp:DropDownList ID="DdlChofer" AppendDataBoundItems="true" DataValueField="CvePersonal"
|
||||||
|
DataTextField="NombreCompleto" Class="table-group-action-input form-control input-inline text-center"
|
||||||
|
Width="200px" runat="server">
|
||||||
|
</asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVChofer" runat="server" ControlToValidate="DdlChofer"
|
||||||
|
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Chofer''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="VCEChofer" runat="server" HighlightCssClass="vco"
|
||||||
|
TargetControlID="RFVChofer" Width="400px" BehaviorID="_content_VCEChofer">
|
||||||
|
</ajax:ValidatorCalloutExtender>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row my-1 truncate">
|
||||||
|
<label class="col-md-4 boldinput-group date date-picker bold" data-date-format="dd/mm/yyyy">
|
||||||
|
Fecha Viaje:</label>
|
||||||
|
<div class="col-md-8 fecha">
|
||||||
|
<div class="input-group input-sm input-small date date-picker">
|
||||||
|
<asp:TextBox ID="TxtFechaViaje" runat="server" CssClass="form-control" CausesValidation="True"
|
||||||
|
type="date"
|
||||||
|
MaxLength="10"> <i class="fa fa-calendar"></i>
|
||||||
|
</asp:TextBox>
|
||||||
|
|
||||||
|
<asp:RequiredFieldValidator ID="RFVTxtFechaViaje" runat="server" ControlToValidate="TxtFechaViaje"
|
||||||
|
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Viaje''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="VCETxtFechaViaje" runat="server" HighlightCssClass="vco"
|
||||||
|
TargetControlID="RFVTxtFechaViaje" Width="400px" BehaviorID="_content_VCETxtFechaViaje">
|
||||||
|
</ajax:ValidatorCalloutExtender>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<asp:CheckBox CssClass="col-md-4" ID="IsMasivo" runat="server" Text="Generar Viajes Masivo"
|
||||||
|
OnCheckedChanged="ToggleMasivo" AutoPostBack="true" />
|
||||||
|
<asp:Panel ID="DivFechaMasivo" runat="server" Visible="false" CssClass="col-md-8">
|
||||||
|
<div class="row col-md-8">
|
||||||
|
<label class="col-md-4 bold">Fecha Inicial:</label>
|
||||||
|
<asp:TextBox CssClass="col-md-8" ID="TxtFechaInicial" runat="server" type="date"></asp:TextBox>
|
||||||
|
</div>
|
||||||
|
<div class="row col-md-8 ">
|
||||||
|
<label class="col-md-4 bold">Lapso</label>
|
||||||
|
<asp:TextBox CssClass="col-md-8" ID="TxtFrecuencia" runat="server" type="number"></asp:TextBox>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</asp:Panel>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<asp:Button ID="BtnGuardar" OnClick="AddViaje" runat="server" CssClass="btn btn-primary"
|
||||||
|
ValidationGroup="GrpGuardar"
|
||||||
|
Text="Guardar"></asp:Button>
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</contenttemplate>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ Partial Class ListadoViajes
|
|||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaDatos()
|
Private Sub CargaDatos()
|
||||||
@@ -84,45 +83,86 @@ Partial Class ListadoViajes
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub AddViaje(sender As Object, e As EventArgs)
|
Protected Sub AddViaje(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
Dim ObjViajes As New ClsViajes
|
Dim ObjViajes As New ClsViajes
|
||||||
|
|
||||||
ObjViajes.IniciaTransacSQL()
|
ObjViajes.IniciaTransacSQL()
|
||||||
|
Page.Response.Write("<script>console.log('El resultado de tu variable" + IsMasivo.Checked.ToString + "')</script>")
|
||||||
|
|
||||||
Try
|
If IsMasivo.Checked = True Then
|
||||||
|
If TxtFechaInicial.Text = "" Or TxtFrecuencia.Text = "" Then
|
||||||
If BtnGuardar.Text = "Guardar" Then
|
Alert("Es necesario agregar la fecha inicial y la frecuencia", TipoMensaje.MsgAdvertencia)
|
||||||
Dim CveContratoHijo As Integer = -1
|
Exit Sub
|
||||||
CveContratoHijo = ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
|
|
||||||
|
|
||||||
If CveContratoHijo > 0 Then
|
|
||||||
ObjViajes.Commit()
|
|
||||||
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
|
|
||||||
DdlRutas.Text = ""
|
|
||||||
DdlTransporte.Text = ""
|
|
||||||
DdlChofer.Text = ""
|
|
||||||
TxtFechaViaje.Text = ""
|
|
||||||
DdlPartida.Text = ""
|
|
||||||
DdlDestino.SelectedValue = ""
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
|
|
||||||
|
|
||||||
If ObjViajes.UpdateViajes(id, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
|
|
||||||
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
|
|
||||||
ObjViajes.Commit()
|
|
||||||
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Dim fechaInicial As DateTime = DateTime.Parse(TxtFechaInicial.Text)
|
||||||
ObjViajes.RollBack()
|
Dim frecuencia As Integer = Integer.Parse(TxtFrecuencia.Text)
|
||||||
Finally
|
Dim fechasGeneradas As New List(Of DateTime)()
|
||||||
|
While fechaInicial.Year = DateTime.Now.Year
|
||||||
|
fechasGeneradas.Add(fechaInicial)
|
||||||
|
fechaInicial = fechaInicial.AddDays(frecuencia)
|
||||||
|
End While
|
||||||
|
|
||||||
|
For Each fecha As DateTime In fechasGeneradas
|
||||||
|
Try
|
||||||
|
Dim CveContratoHijo As Integer = -1
|
||||||
|
CveContratoHijo = ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, fecha, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
|
||||||
|
|
||||||
|
If CveContratoHijo > 0 Then
|
||||||
|
ObjViajes.Commit()
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||||
|
End Try
|
||||||
|
Next
|
||||||
|
|
||||||
|
DdlRutas.Text = ""
|
||||||
|
DdlTransporte.Text = ""
|
||||||
|
DdlChofer.Text = ""
|
||||||
|
TxtFechaViaje.Text = ""
|
||||||
|
DdlPartida.Text = ""
|
||||||
|
DdlDestino.SelectedValue = ""
|
||||||
ObjViajes.Dispose()
|
ObjViajes.Dispose()
|
||||||
Response.Redirect("ListadoViajes.aspx")
|
Response.Redirect("ListadoViajes.aspx")
|
||||||
|
Alert("El viaje masivo se registró correctamente.", TipoMensaje.MsgInformacion)
|
||||||
|
|
||||||
|
Else
|
||||||
|
Try
|
||||||
|
If BtnGuardar.Text = "Guardar" Then
|
||||||
|
Dim CveContratoHijo As Integer = -1
|
||||||
|
CveContratoHijo = ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
|
||||||
|
|
||||||
|
If CveContratoHijo > 0 Then
|
||||||
|
ObjViajes.Commit()
|
||||||
|
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
|
||||||
|
DdlRutas.Text = ""
|
||||||
|
DdlTransporte.Text = ""
|
||||||
|
DdlChofer.Text = ""
|
||||||
|
TxtFechaViaje.Text = ""
|
||||||
|
DdlPartida.Text = ""
|
||||||
|
DdlDestino.SelectedValue = ""
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
|
||||||
|
|
||||||
|
If ObjViajes.UpdateViajes(id, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
|
||||||
|
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
|
||||||
|
ObjViajes.Commit()
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
ObjViajes.RollBack()
|
||||||
|
Finally
|
||||||
|
ObjViajes.Dispose()
|
||||||
|
Response.Redirect("ListadoViajes.aspx")
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
End Try
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub UpdateViaje(sender As Object, e As EventArgs)
|
Protected Sub UpdateViaje(sender As Object, e As EventArgs)
|
||||||
@@ -160,4 +200,10 @@ Partial Class ListadoViajes
|
|||||||
ObjViajes.Dispose()
|
ObjViajes.Dispose()
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub ToggleMasivo(sender As Object, e As EventArgs)
|
||||||
|
DivFechaMasivo.Visible = IsMasivo.Checked
|
||||||
|
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
|
||||||
|
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user