--Método de actualización de contratos

This commit is contained in:
AbrahamCastilloV
2024-01-12 10:13:24 -07:00
parent a1ffb9f566
commit 25581590ea
4 changed files with 221 additions and 192 deletions

View File

@@ -85,7 +85,7 @@
<asp:TemplateField HeaderText="Importe">
<ItemTemplate>
<asp:Literal ID="LtlImporte" runat="server" Text='<%# Eval("Importe") %>'></asp:Literal>
<asp:Literal ID="LtlImporte" runat="server" Text='<%# Eval("Importe", "{0:n}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>

View File

@@ -104,8 +104,7 @@ Partial Class ListadoBoletos
New ReportParameter("TelefonoAgencia", "Telefono Agencia")
}
ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos/Boleto.mrt", dtResult, params, NombreArchivo:="Boleto")
ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Boleto.mrt", dtResult, params, NombreArchivo:="Boleto")
'Empresas/Grales/Formatos/EntradaSalida.mrt
'Empresas/188/Formatos/Boleto.mrt

View File

@@ -1,4 +1,5 @@
<%@ Page Language="VB" AutoEventWireup="false" Title="Transportes V&A - Contratos" MasterPageFile="~/Site.master"
<%@ Page Language="VB" AutoEventWireup="false" Title="Transportes V&A - Contratos"
MasterPageFile="~/Site.master"
CodeFile="RepContratos.aspx.vb"
Inherits="ListadoContratos" %>
@@ -46,7 +47,6 @@
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="RepViajes.aspx"
Target="_blank"><i class='fa fa-road'></i>Viajes</asp:HyperLink>
</li>--%>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
@@ -85,6 +85,12 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Cliente">
<ItemTemplate>
<asp:Literal ID="LtNombreComercial" runat="server" Text='<%# Eval("NombreComercial") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<HeaderTemplate>
Fecha<br />
@@ -119,6 +125,8 @@
</Columns>
</asp:GridView>
<asp:UpdatePanel runat="server" ID="UpModal">
<ContentTemplate>
<div id="ModalAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div id="UpAddChofer" class="modal-content rowpadding" tabindex="-1"
@@ -271,6 +279,11 @@
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</contenttemplate>
</asp:Content>

View File

@@ -5,13 +5,20 @@ Imports Extensiones.ModExtensiones
Partial Class ListadoContratos
Inherits ClsPaginas
Private Property CveContrato As Integer
Get
Return ViewState("CveContrato").ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveContrato") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
InicializaCombos()
CargaDatos()
End If
End Sub
Private Sub InicializaCombos()
DdlClientes.setEsWebService(True)
'Lista Activos Fijos'
@@ -25,7 +32,6 @@ Partial Class ListadoContratos
DdlTransporte.DataBind()
ObjAF.Dispose()
End Sub
Private Sub CargaDatos()
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then
@@ -34,7 +40,6 @@ Partial Class ListadoContratos
ObjContratos.Dispose()
GvContratos.DataBind()
End Sub
Protected Sub MostrarModal()
TxtDescripcion.Text = ""
TxtFechaSalida.Text = ""
@@ -43,6 +48,8 @@ Partial Class ListadoContratos
TxtUbicacion.Text = ""
DdlTransporte.SelectedValue = ""
BtnGuardar.Text = "Guardar"
myModalLabel.InnerHtml = "Agregar Contrato"
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
Private Sub LBAgregarContrato_Click(sender As Object, e As EventArgs) Handles LBAgregarContrato.Click
@@ -63,17 +70,31 @@ Partial Class ListadoContratos
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
'Agregar contrato
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, -1, -1, -1, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
End If
If CveContratoHijo > 0 Then
ObjContratos.Commit()
Alert("Agregado Correctamente.")
End If
'Actualizar contrato
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, -1, -1, -1, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1)
End If
If retorno Then
ObjContratos.Commit()
Alert("Actualizado Correctamente.")
End If
TxtDescripcion.Text = ""
TxtFechaSalida.Text = ""
TxtFechaRegreso.Text = ""
@@ -81,9 +102,7 @@ Partial Class ListadoContratos
TxtUbicacion.Text = ""
DdlClientes.SelectedValue = ""
DdlTransporte.SelectedValue = ""
End If
BtnGuardar.Text = "Guardar"
Catch ex As Exception
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
ObjContratos.RollBack()
@@ -94,7 +113,6 @@ Partial Class ListadoContratos
End Try
End Sub
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
@@ -102,6 +120,7 @@ Partial Class ListadoContratos
Dim fechaInicial As DateTime
Dim fechaFinal As DateTime
CveContrato = GvRow.DataKey("CveContrato").ToEntero
DdlClientes.SelectedValue = GvRow.DataKey("CveCliente")
TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato")
TxtObservaciones.Text = GvRow.DataKey("DescripcionContrato")
@@ -112,12 +131,10 @@ Partial Class ListadoContratos
TxtFechaRegreso.Text = fechaFinal.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
End If
BtnGuardar.Text = "Editar"
myModalLabel.InnerHtml = "Editar Contrato"
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
Protected Sub RemoveContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim ObjContratos As New ClsContratos