-
This commit is contained in:
@@ -66,40 +66,39 @@
|
||||
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax,CveChofer ">
|
||||
<Columns>
|
||||
|
||||
<asp:TemplateField HeaderText="No. Contrato">
|
||||
<asp:TemplateField HeaderText="Folio">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlCveContrato" runat="server" Text='<%# Eval("CveContrato") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="100px">
|
||||
<HeaderTemplate>
|
||||
Fecha<br />
|
||||
Salida
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlFechaI" runat="server" Text='<%# Eval("FechaInicial", "{0:d}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="Descripcion">
|
||||
<asp:TemplateField HeaderText="Viaje">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlDescripcionContrato" runat="server" Text='<%# Eval("DescripcionContrato") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Ubicación">
|
||||
<asp:TemplateField HeaderText="Cliente">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtNombreComercial" runat="server" Text='<%# Eval("NombreComercial") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Lugar Salida">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtUbicacion" runat="server" Text='<%# Eval("Ubicacion") %>'></asp:Literal>
|
||||
</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 />
|
||||
Salida
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlFechaIng" runat="server" Text='<%# Eval("FechaInicial", "{0:d}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
|
||||
|
||||
<asp:TemplateField HeaderText="Fecha Final" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
|
||||
<HeaderTemplate>
|
||||
Fecha<br />
|
||||
|
||||
@@ -33,7 +33,7 @@ Partial Class ListadoContratos
|
||||
'ObjAF.Dispose()
|
||||
DdlTipoAF.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa)
|
||||
DdlTipoAF.DataBind()
|
||||
|
||||
DdlTipoAF.Items.Insert(0, New ListItem("Seleccione", ""))
|
||||
|
||||
'Lista Chofer'
|
||||
DdlChofer.DataSource = GlobalDTRHPersonal(185)
|
||||
@@ -53,15 +53,16 @@ Partial Class ListadoContratos
|
||||
UpTitulos.Update()
|
||||
|
||||
End Sub
|
||||
Protected Sub MostrarModal(Optional Descripcion As String = "", Optional FechaSalida As String = "", Optional FechaRegreso As String = "", Optional Observaciones As String = "", Optional Ubicacion As String = "", Optional Transporte As String = "", Optional Cliente As String = "", Optional Dolares As String = "", Optional Pesos As String = "", Optional Anticipo As String = "", Optional Boton As String = "Guardar", Optional Chofer As String = "")
|
||||
Protected Sub MostrarModal(Optional Descripcion As String = "", Optional FechaSalida As String = "", Optional FechaRegreso As String = "", Optional Observaciones As String = "", Optional Ubicacion As String = "", Optional Transporte As String = "", Optional CveCliente As Integer = 0, Optional Dolares As String = "", Optional Pesos As String = "", Optional Anticipo As String = "", Optional Boton As String = "Guardar", Optional Chofer As String = "")
|
||||
|
||||
TxtDescripcion.Text = Descripcion
|
||||
TxtFechaSalida.Text = FechaSalida
|
||||
TxtFechaRegreso.Text = FechaRegreso
|
||||
TxtObservaciones.Text = Observaciones
|
||||
TxtUbicacion.Text = Ubicacion
|
||||
DdlAF.SelectedValue = Transporte
|
||||
DdlClientes.SelectedText = Cliente
|
||||
DdlTipoAF.SelectedValue = Transporte
|
||||
DdlClientes.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa, -1, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial")
|
||||
DdlClientes.SelectedValue = CveCliente.ToString
|
||||
DdlChofer.SelectedValue = Chofer
|
||||
TxtDolares.Text = Dolares
|
||||
TxtPesos.Text = Pesos
|
||||
@@ -83,62 +84,56 @@ Partial Class ListadoContratos
|
||||
|
||||
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
|
||||
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
|
||||
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, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero)
|
||||
If CveContratoHijo > 0 Then
|
||||
ObjContratos.Commit()
|
||||
Alert("Agregado Correctamente.")
|
||||
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, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero)
|
||||
If CveContratoHijo > 0 Then
|
||||
ObjContratos.Commit()
|
||||
Alert("Agregado Correctamente.")
|
||||
End If
|
||||
|
||||
Else
|
||||
'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, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
|
||||
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:=DdlTipoAF.SelectedValue.ToEntero)
|
||||
|
||||
If retorno Then
|
||||
ObjContratos.Commit()
|
||||
Alert("Actualizado Correctamente.")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
TxtDescripcion.Text = ""
|
||||
TxtDescripcion.Text = ""
|
||||
TxtFechaSalida.Text = ""
|
||||
TxtFechaRegreso.Text = ""
|
||||
TxtObservaciones.Text = ""
|
||||
TxtUbicacion.Text = ""
|
||||
DdlClientes.SelectedText = ""
|
||||
DdlTransporte.SelectedValue = ""
|
||||
DdlChofer.SelectedValue = ""
|
||||
TxtDolares.Text = ""
|
||||
TxtPesos.Text = ""
|
||||
TxtAnticipo.Text = ""
|
||||
BtnGuardar.Text = "Guardar"
|
||||
Catch ex As Exception
|
||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
ObjContratos.RollBack()
|
||||
Finally
|
||||
ObjContratos.Dispose()
|
||||
CargaDatos()
|
||||
End Try
|
||||
'DdlTipoAF.SelectedValue = "-1"
|
||||
'DdlChofer.SelectedValue = "-1"
|
||||
TxtDolares.Text = ""
|
||||
TxtPesos.Text = ""
|
||||
TxtAnticipo.Text = ""
|
||||
BtnGuardar.Text = "Guardar"
|
||||
|
||||
ObjContratos.Dispose()
|
||||
CargaDatos()
|
||||
|
||||
End Sub
|
||||
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
ViewState("CveContrato") = GvRow.DataKey("CveContrato")
|
||||
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"), CveCliente:=GvRow.DataKey("CveCliente").ToEntero, Dolares:=GvRow.DataKey("Importe"), Pesos:=GvRow.DataKey("ImporteMax"), Anticipo:=GvRow.DataKey("ImporteMin"), Boton:="Editar", Chofer:=GvRow.DataKey("CveChofer"))
|
||||
End Sub
|
||||
Protected Sub RemoveContrato(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
Reference in New Issue
Block a user