--Se agregan propiedades para los campos de pesos, dólares y anticipo de contratos en CalendarEvent.vb. Se modifica UpdateContratos para agregarle CveChofer y CveTipoAF junto a la tabla Con_Contratos y los PA relacionado. Se agregan a CargaEventos las variables relacionadas a contratos. Se vuelve GetActivosFijos a 13 para que despliegue una lista como prueba, se mueven las condiciones para hacer el commit tanto en agregar como actualizar y se agrega el ViewState("CveContrato") como referencia para actualizar el contrato.

This commit is contained in:
AbrahamCastilloV
2024-01-31 01:06:45 -07:00
parent e2a70ea368
commit a2e512deac
7 changed files with 203 additions and 103 deletions

View File

@@ -54,6 +54,10 @@ Public Class CalendarEvent
Public Property MovimientoFolio As String Public Property MovimientoFolio As String
Public Property CveIE As Integer Public Property CveIE As Integer
Public Property FolioIE As String Public Property FolioIE As String
Public Property Pesos As Double
Public Property Dolares As Double
Public Property Anticipo As Double
End Class End Class

View File

@@ -404,7 +404,7 @@ Public Class ClsContratos
Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1,
Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1,
Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False,
Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "") As Boolean Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Con_ContratosUpdate") DataAdapter("PA_Con_ContratosUpdate")
@@ -426,17 +426,16 @@ Public Class ClsContratos
.Add("@PorAnticipo", SqlDbType.Float).Value = PorAnticipo .Add("@PorAnticipo", SqlDbType.Float).Value = PorAnticipo
.Add("@PorAmortizacionAnticipo", SqlDbType.Float).Value = PorAmortizacionAnticipo .Add("@PorAmortizacionAnticipo", SqlDbType.Float).Value = PorAmortizacionAnticipo
.Add("@PorGarantia", SqlDbType.Float).Value = PorGarantia .Add("@PorGarantia", SqlDbType.Float).Value = PorGarantia
'.Add("@EstatusContrato", SqlDbType.Bit).Value = EstatusContrato
.Add("@Archivo", SqlDbType.VarChar).Value = Archivo .Add("@Archivo", SqlDbType.VarChar).Value = Archivo
.Add("@Geom", SqlDbType.VarChar).Value = Geom .Add("@Geom", SqlDbType.VarChar).Value = Geom
.Add("@CveContratoPadre", SqlDbType.Int).Value = CveContratoPadre .Add("@CveContratoPadre", SqlDbType.Int).Value = CveContratoPadre
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@EsPresupuestal", SqlDbType.Int).Value = EsPresupuestal .Add("@EsPresupuestal", SqlDbType.Int).Value = EsPresupuestal
.Add("@CveContratoTipo", SqlDbType.SmallInt).Value = CveContratoTipo
.Add("@ImporteMin", SqlDbType.Money).Value = Minimo .Add("@ImporteMin", SqlDbType.Money).Value = Minimo
.Add("@ImporteMax", SqlDbType.Money).Value = Maximo .Add("@ImporteMax", SqlDbType.Money).Value = Maximo
.Add("@Importe", SqlDbType.Money).Value = Importe .Add("@Importe", SqlDbType.Money).Value = Importe
.Add("@CveContratoTipo", SqlDbType.SmallInt).Value = CveContratoTipo
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
.Add("@TipoCambio", SqlDbType.Money).Value = TipoCambio .Add("@TipoCambio", SqlDbType.Money).Value = TipoCambio
.Add("@ModalidadDetalle", SqlDbType.TinyInt).Value = ModalidadDetalle .Add("@ModalidadDetalle", SqlDbType.TinyInt).Value = ModalidadDetalle
@@ -460,7 +459,8 @@ Public Class ClsContratos
.Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
.Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales .Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales
.Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF
.Add("@CveChofer", SqlDbType.Int).Value = CveChofer
End With End With
Try Try

View File

@@ -464,7 +464,13 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime)
cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) 'Agregar una hora, fecha final como default cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) 'Agregar una hora, fecha final como default
cevent.allDay = False cevent.allDay = False
cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero cevent.NombreAcercamiento = dr("Ubicacion").ToString
cevent.CveCliente = dr("CveCliente").ToString.ToEntero
cevent.CveActivoFijo = dr("CveTipoAF").ToString.ToEntero
cevent.CvePersonal = dr("CveChofer").ToString.ToEntero
cevent.Dolares = dr("Importe").ToString.ToDecimal
cevent.Pesos = dr("ImporteMax").ToString.ToDecimal
cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal
If Not cevent.recurrenciatipo > 0 Then If Not cevent.recurrenciatipo > 0 Then
@@ -520,7 +526,11 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime)
cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime))
cevent.allDay = False cevent.allDay = False
cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero cevent.CveCliente = dr("CveCliente").ToString.ToEntero
cevent.NombreAcercamiento = dr("Ubicacion").ToString
cevent.CveActivoFijo = dr("CveTipoAF").ToString.ToEntero
cevent.CvePersonal = dr("CveChofer").ToString.ToEntero
'11/05/2018 - Evento Gasto Recurrente '11/05/2018 - Evento Gasto Recurrente
cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero
@@ -543,6 +553,8 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
cevent.description = dr("DescripcionContrato").ToString cevent.description = dr("DescripcionContrato").ToString
cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime)
cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime))
cevent.NombreAcercamiento = dr("Ubicacion").ToString
cevent.allDay = False cevent.allDay = False
'cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero 'cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero
'cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero 'cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero

View File

@@ -63,7 +63,7 @@
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado" <asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado"
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None"
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax "> data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax,CveChofer ">
<Columns> <Columns>
<asp:TemplateField HeaderText="No. Contrato"> <asp:TemplateField HeaderText="No. Contrato">
@@ -145,7 +145,7 @@
<label>Cliente</label> <label>Cliente</label>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost> <ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;" UsaWebService="true"></ADS:Dropdownlost>
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@@ -16,6 +16,7 @@ Partial Class ListadoContratos
End Property End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
ViewState("CveContrato") = 0
InicializaCombos() InicializaCombos()
CargaDatos() CargaDatos()
End If End If
@@ -23,7 +24,7 @@ Partial Class ListadoContratos
Private Sub InicializaCombos() Private Sub InicializaCombos()
'Lista Activos Fijos' 'Lista Activos Fijos'
Dim ObjAF As New ClsAF() Dim ObjAF As New ClsAF()
If ObjAF.GetActivosFijos(-1, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
If ObjAF.DtResultados.Rows.Count > 0 Then If ObjAF.DtResultados.Rows.Count > 0 Then
DdlTransporte.DataSource = ObjAF.DtResultados DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.Items.Insert(0, New ListItem("Seleccione", "")) DdlTransporte.Items.Insert(0, New ListItem("Seleccione", ""))
@@ -93,21 +94,20 @@ Partial Class ListadoContratos
'Agregar contrato 'Agregar contrato
If BtnGuardar.Text = "Guardar" Then If BtnGuardar.Text = "Guardar" Then
CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero) CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero)
End If If CveContratoHijo > 0 Then
ObjContratos.Commit()
If CveContratoHijo > 0 Then Alert("Agregado Correctamente.")
ObjContratos.Commit() End If
Alert("Agregado Correctamente.")
End If End If
'Actualizar contrato 'Actualizar contrato
If BtnGuardar.Text = "Editar" Then If BtnGuardar.Text = "Editar" Then
retorno = ObjContratos.UpdateContratos(CveContrato, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1) retorno = ObjContratos.UpdateContratos(CveContrato, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
End If
If retorno Then If retorno Then
ObjContratos.Commit() ObjContratos.Commit()
Alert("Actualizado Correctamente.") Alert("Actualizado Correctamente.")
End If
End If End If
TxtDescripcion.Text = "" TxtDescripcion.Text = ""
@@ -117,6 +117,7 @@ Partial Class ListadoContratos
TxtUbicacion.Text = "" TxtUbicacion.Text = ""
DdlClientes.SelectedText = "" DdlClientes.SelectedText = ""
DdlTransporte.SelectedValue = "" DdlTransporte.SelectedValue = ""
DdlChofer.SelectedValue = ""
TxtDolares.Text = "" TxtDolares.Text = ""
TxtPesos.Text = "" TxtPesos.Text = ""
TxtAnticipo.Text = "" TxtAnticipo.Text = ""
@@ -127,13 +128,13 @@ Partial Class ListadoContratos
Finally Finally
ObjContratos.Dispose() ObjContratos.Dispose()
CargaDatos() CargaDatos()
End Try End Try
End Sub End Sub
Protected Sub UpdateContrato(sender As Object, e As EventArgs) Protected Sub UpdateContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
ViewState("CveContrato") = GvRow.DataKey("CveContrato")
MostrarModal( MostrarModal(
Descripcion:=GvRow.DataKey("DescripcionContrato"), FechaSalida:=GvRow.DataKey("FechaInicial").ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T"), FechaRegreso:=GvRow.DataKey("FechaFinal").ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T"), Observaciones:=GvRow.DataKey("DescripcionContrato"), Ubicacion:=GvRow.DataKey("Ubicacion"), Transporte:=GvRow.DataKey("CveTipoAF"), Cliente:=GvRow.DataKey("CveCliente"), Dolares:=GvRow.DataKey("Importe"), Pesos:=GvRow.DataKey("ImporteMax"), Anticipo:=GvRow.DataKey("ImporteMin"), Boton:="Editar", Chofer:=GvRow.DataKey("CveChofer")) Descripcion:=GvRow.DataKey("DescripcionContrato"), FechaSalida:=GvRow.DataKey("FechaInicial").ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T"), FechaRegreso:=GvRow.DataKey("FechaFinal").ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T"), Observaciones:=GvRow.DataKey("DescripcionContrato"), Ubicacion:=GvRow.DataKey("Ubicacion"), Transporte:=GvRow.DataKey("CveTipoAF"), Cliente:=GvRow.DataKey("CveCliente"), Dolares:=GvRow.DataKey("Importe"), Pesos:=GvRow.DataKey("ImporteMax"), Anticipo:=GvRow.DataKey("ImporteMin"), Boton:="Editar", Chofer:=GvRow.DataKey("CveChofer"))
End Sub End Sub

View File

@@ -20,99 +20,99 @@
<asp:Content ID="Content4" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="C" runat="Server">
<asp:Panel ID="PnlGeneral" runat="server"> <asp:Panel ID="PnlGeneral" runat="server">
<ContentTemplate> <contenttemplate>
<%--Calendario Tab--%> <%--Calendario Tab--%>
<ajax:TabContainer ID="Tab" runat="server" Width="100%" ActiveTabIndex="0"> <ajax:TabContainer ID="Tab" runat="server" Width="100%" ActiveTabIndex="0">
<ajax:TabPanel ID="TabAlta" runat="server" HeaderText="Calendario"> <ajax:TabPanel ID="TabAlta" runat="server" HeaderText="Calendario">
<ContentTemplate> <ContentTemplate>
<div class="row"> <div class="row">
<div class="col-md-12 col-sm-12"> <div class="col-md-12 col-sm-12">
<div class="portlet light calendar "> <div class="portlet light calendar ">
<div class="tipo_vista"> <div class="tipo_vista">
<div> <div>
<h4 class="bold ribbon-color-success">Tipo de Vista</h4> <h4 class="bold ribbon-color-success">Tipo de Vista</h4>
</div>
<asp:RadioButtonList ID="RBTipoVista" runat="server" AutoPostBack="True">
<asp:ListItem Text="Duración" Value="duracion" Selected="True" />
<asp:ListItem Text="Fecha de Inicio" Value="fecha" />
</asp:RadioButtonList>
</div> </div>
<asp:RadioButtonList ID="RBTipoVista" runat="server" AutoPostBack="True">
<asp:ListItem Text="Duración" Value="duracion" Selected="True" />
<asp:ListItem Text="Fecha de Inicio" Value="fecha" />
</asp:RadioButtonList>
</div>
<div class="portlet-body"> <div class="portlet-body">
<div id="calendar"> <div id="calendar">
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</ContentTemplate> </ContentTemplate>
</ajax:TabPanel> </ajax:TabPanel>
<%--Contratos Tab--%> <%--Contratos Tab--%>
<ajax:TabPanel ID="TabPanel1" runat="server" HeaderText="Contratos"> <ajax:TabPanel ID="TabPanel1" runat="server" HeaderText="Contratos">
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado" <asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado"
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None"
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax "> data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax ">
<Columns> <Columns>
<asp:TemplateField HeaderText="No. Contrato"> <asp:TemplateField HeaderText="No. Contrato">
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtlCveContrato" runat="server" Text='<%# Eval("CveContrato") %>'></asp:Literal> <asp:Literal ID="LtlCveContrato" runat="server" Text='<%# Eval("CveContrato") %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Descripcion"> <asp:TemplateField HeaderText="Descripcion">
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtlDescripcionContrato" runat="server" Text='<%# Eval("DescripcionContrato") %>'></asp:Literal> <asp:Literal ID="LtlDescripcionContrato" runat="server" Text='<%# Eval("DescripcionContrato") %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Ubicación"> <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Ubicación">
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtUbicacion" runat="server" Text='<%# Eval("Ubicacion") %>'></asp:Literal> <asp:Literal ID="LtUbicacion" runat="server" Text='<%# Eval("Ubicacion") %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Cliente"> <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Cliente">
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtNombreComercial" runat="server" Text='<%# Eval("NombreComercial") %>'></asp:Literal> <asp:Literal ID="LtNombreComercial" runat="server" Text='<%# Eval("NombreComercial") %>'></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" ItemStyle-Width="100px"> <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<HeaderTemplate> <HeaderTemplate>
Fecha<br /> Fecha<br />
Salida Salida
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtlFechaIng" runat="server" Text='<%# Eval("FechaInicial", "{0:d}") %>'></asp:Literal> <asp:Literal ID="LtlFechaIng" runat="server" Text='<%# Eval("FechaInicial", "{0:d}") %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Final" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px"> <asp:TemplateField HeaderText="Fecha Final" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<HeaderTemplate> <HeaderTemplate>
Fecha<br /> Fecha<br />
Regreso Regreso
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtlFechaFinal" runat="server" Text='<%# Eval("FechaFinal", "{0:d}") %>'></asp:Literal> <asp:Literal ID="LtlFechaFinal" runat="server" Text='<%# Eval("FechaFinal", "{0:d}") %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</ContentTemplate> </ContentTemplate>
</ajax:TabPanel> </ajax:TabPanel>
</ajax:TabContainer> </ajax:TabContainer>
</ContentTemplate> </contenttemplate>
</asp:Panel> </asp:Panel>
@@ -271,6 +271,13 @@
<asp:TextBox ID="TxtAnticipo" runat="server" type="decimal"></asp:TextBox> <asp:TextBox ID="TxtAnticipo" runat="server" type="decimal"></asp:TextBox>
</div> </div>
</div> </div>
<div class="modal-footer">
<asp:Button ID="BtnActualizar" OnClick="UpdateContrato" 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> </div>
</div> </div>
@@ -283,7 +290,7 @@
<asp:UpdatePanel ID="UpCommando" runat="server"> <asp:UpdatePanel ID="UpCommando" runat="server">
<ContentTemplate> <ContentTemplate>
<asp:Button runat="server" ID="BtnActualizar" OnClick="ActualizarContrato"></asp:Button> <asp:Button runat="server" ID="BtnModal" OnClick="MostrarModal"></asp:Button>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
@@ -309,8 +316,19 @@
} }
function updateEvent(event, element) { function updateEvent(event, element) {
console.log(event) $('#<%=TxtObservaciones.ClientID%>').val(event.title);
$('#<%=BtnActualizar.ClientID%>').click(); $('#<%=TxtDescripcion.ClientID%>').val(event.title);
$('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento);
$('#<%=TxtFechaSalida.ClientID.ToString%>').val(event.start._i);
$('#<%=TxtFechaRegreso.ClientID.ToString%>').val(event.end._i);
$('#<%=DdlClientes.ClientID%>').val(event.CveCliente);
$('#<%=DdlTransporte.ClientID%>').val(event.CveActivoFijo);
$('#<%=DdlChofer.ClientID%>').val(event.CvePersonal);
$('#<%=TxtDolares.ClientID%>').val(event.Dolares);
$('#<%=TxtPesos.ClientID%>').val(event.Pesos);
$('#<%=TxtAnticipo.ClientID%>').val(event.Anticipo);
$('#<%=BtnModal.ClientID%>').click();
} }
function RadionButtonSelectedValueSet(name, SelectdValue) { function RadionButtonSelectedValueSet(name, SelectdValue) {

View File

@@ -1,11 +1,20 @@
Option Explicit On Option Explicit On
Option Strict On Option Strict On
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones.ModExtensiones
Partial Class RepContratosCalendario Partial Class RepContratosCalendario
Inherits ClsPaginas Inherits ClsPaginas
#Region "PROPIEDADES" #Region "PROPIEDADES"
Private Property CveContrato As Integer
Get
Return ViewState("CveContrato").ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveContrato") = value
End Set
End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -27,15 +36,71 @@ Partial Class RepContratosCalendario
End Sub End Sub
Private Sub InicializaCalendar() Private Sub InicializaCalendar()
'Lista Activos Fijos'
Dim ObjAF As New ClsAF()
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
If ObjAF.DtResultados.Rows.Count > 0 Then
DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.Items.Insert(0, New ListItem("Seleccione", ""))
End If
End If
DdlTransporte.DataBind()
ObjAF.Dispose()
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(185)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("Seleccione", ""))
RegistraScript("InitCalendar();") RegistraScript("InitCalendar();")
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
End Sub End Sub
Protected Sub ActualizarContrato(sender As Object, e As System.EventArgs) Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
RegistraScript("$('#ModalActualizar').modal('show');") RegistraScript("$('#ModalActualizar').modal('show');")
End Sub End Sub
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
If DdlClientes.SelectedValue = "" Then
Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
Try
Dim CveEstatusInicial As Integer = 10
Dim CveContratoHijo As Integer = -1
Dim CveContratoTipo As Integer = 2
Dim retorno As Boolean = False
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
End If
'Actualizar contrato
If BtnActualizar.Text = "Editar" Then
retorno = ObjContratos.UpdateContratos(CveContrato, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1)
End If
If retorno Then
ObjContratos.Commit()
Alert("Actualizado Correctamente.")
End If
Catch ex As Exception
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
ObjContratos.RollBack()
Finally
ObjContratos.Dispose()
CargaDatos()
End Try
End Sub
End Class End Class