diff --git a/App_Code/ClsGPS.vb b/App_Code/ClsGPS.vb
index 68a050d1a..9bffc2e1f 100644
--- a/App_Code/ClsGPS.vb
+++ b/App_Code/ClsGPS.vb
@@ -5033,7 +5033,7 @@ Public Class ClsGPS
#End Region
#Region "G A S T O S"
- Public Function AddGasto(Cantidad As Decimal, Precio As Decimal, Descripcion As String, Observaciones As String, Fecha As DateTime, TipoGasto As Integer, CveCliente As Integer, Optional CveDispositvo As Integer = -1, Optional CveTrayecto As Integer = -1) As Boolean
+ Public Function AddGasto(Cantidad As Decimal, Precio As Decimal, Descripcion As String, Observaciones As String, Fecha As DateTime, TipoGasto As Integer, CveUsuario As Integer, CveCliente As Integer, Optional CveDispositivo As Integer = -1, Optional CveTrayecto As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_GPS_GastosAdd")
With SqlAdapter.SelectCommand.Parameters
@@ -5045,6 +5045,7 @@ Public Class ClsGPS
.Add("@TipoGasto", SqlDbType.TinyInt).Value = TipoGasto
.Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo
.Add("@CveTrayecto", SqlDbType.Int).Value = CveTrayecto
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
End With
Try
@@ -5055,9 +5056,9 @@ Public Class ClsGPS
End Try
Return Retorno
End Function
- Public Function GetGastos(CveGPSGasto As Integer, CveCliente As Integer, Optional CveDispositvo As Integer = -1, Optional CveTrayecto As Integer = -1) As Boolean
+ Public Function GetGastos(CveGPSGasto As Integer, CveCliente As Integer, Optional CveDispositivo As Integer = -1, Optional CveTrayecto As Integer = -1) As Boolean
Dim Retorno As Boolean = False
- DataAdapter("PA_GPS_RutasGet")
+ DataAdapter("PA_GPS_GastosGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveGPSGasto", SqlDbType.Int).Value = CveGPSGasto
.Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo
@@ -5072,7 +5073,7 @@ Public Class ClsGPS
End Try
Return Retorno
End Function
- Public Function UpdateGasto(CveGPSGasto As Integer, Cantidad As Decimal, Precio As Decimal, Descripcion As String, Observaciones As String, Fecha As DateTime) As Boolean
+ Public Function UpdateGasto(CveGPSGasto As Integer, Cantidad As Decimal, Precio As Decimal, Descripcion As String, Observaciones As String, Fecha As DateTime, CveUsuarioModifico As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_GPS_GastosUpdate")
With SqlAdapter.SelectCommand.Parameters
@@ -5081,7 +5082,8 @@ Public Class ClsGPS
.Add("@Precio", SqlDbType.Money).Value = Precio
.Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion
.Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones
- .Add("@Fecha", SqlDbType.DateTime).Value = Fecha
+ .Add("@Fecha", SqlDbType.DateTime).Value = Fecha
+ .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico
End With
Try
SqlAdapter.Fill(Data)
diff --git a/GPS/RepGastos.aspx b/GPS/RepGastos.aspx
new file mode 100644
index 000000000..a2110ee4f
--- /dev/null
+++ b/GPS/RepGastos.aspx
@@ -0,0 +1,149 @@
+<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepGastos.aspx.vb" Inherits="GPS_RepGastos" %>
+
+
+
+
+
+
+ Reporte de Gastos de Trayectos
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GPS/RepGastos.aspx.vb b/GPS/RepGastos.aspx.vb
new file mode 100644
index 000000000..cff7b2e5b
--- /dev/null
+++ b/GPS/RepGastos.aspx.vb
@@ -0,0 +1,139 @@
+Option Explicit On
+Option Strict On
+Imports Extensiones
+
+Partial Class GPS_RepGastos
+ Inherits ClsPaginas
+#Region "PROPIEDADES"
+ Private Property CveGPSGasto() As Integer
Get
+ Return If(IsNothing(ViewState("CveGPSGasto")), -1, CInt(ViewState("CveGPSGasto")))
+ End Get
Set
+ ViewState("CveGPSGasto") = Value
End Set
End Property
+ Private Property Modalidad() As String
Get
+ Return If(IsNothing(ViewState("Modalidad")), "", (ViewState("Modalidad").ToString))
+ End Get
Set
+ ViewState("Modalidad") = Value
End Set
End Property
+#End Region
+
+ Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
+ If Not IsPostBack Then
+ CargaCombos()
+ CargaDatos()
+ End If
+ End Sub
+
+#Region "CARGAS"
+ Private Sub CargaCombos()
+
+ txtFechaI.Text = $"01/{DateTime.Now.ToString("MM")}/{DateTime.Now.Year} 00:00"
+ txtFechaF.Text = $"{DateTime.Now.ToString("dd/MM/yyyy")} 23:59"
+
+ Dim ObjGPS As New ClsGPS()
+ If ObjGPS.GetTrayectos(-1, -1, UsuarioActual.CveCliente) Then
+ DdlTrayecto.DataSource = ObjGPS.DtResultados
+ DdlTrayectoFiltro.DataSource = ObjGPS.DtResultados
+ End If
+ ObjGPS.Dispose()
+
+ DdlTrayecto.DataBind()
+ DdlTrayectoFiltro.DataBind()
+
+ UPFiltros.Update()
+ UpModal.Update()
+ End Sub
+ Private Sub CargaDatos()
+ Dim ObjGral As New ClsGPS
+ If ObjGral.GetGastos(-1, UsuarioActual.CveCliente, CveTrayecto:=DdlTrayectoFiltro.SelectedValue.ToEntero()) Then
+ GvDatos.DataSource = ObjGral.DtResultados
+ End If
+ ObjGral.Dispose()
+ GvDatos.DataBind()
+ UpDatos.Update()
+ End Sub
+
+ Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
+ CargaDatos()
+ End Sub
+
+#End Region
+
+#Region "BOTONES"
+
+ Protected Sub LnkEditar_Click(sender As Object, e As EventArgs)
+ LimpiaModal()
DivTrayecto.Visible = False
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
+
+ CveGPSGasto = gvRow.DataKey("CveGPSGasto").ToEntero()
TxtCantidad.Text = gvRow.DataKey("Cantidad")
+ TxtPrecio.Text = gvRow.DataKey("Precio")
+ TxtDescripcion.Text = gvRow.DataKey("Descripcion")
+ TxtObs.Text = gvRow.DataKey("Observaciones")
+ TxtFecha.Text = gvRow.DataKey("Fecha").ToDateTime().ToString("dd/MM/yyyy hh:mm:ss")
+
+ Modalidad = "U"
BtnGuardar.Text = "Actualizar"
+ ltlMotititulo.Text = "Actualizar Gasto"
RegistraScript("$('#DModal').modal('show')")
UpModal.Update()
+ End Sub
+ Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs)
+ Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
+ Dim ObjPS As New ClsGPS
+ Dim CveGasto = gvRow.DataKey("CveGPSGasto").ToEntero
+ If ObjPS.RemoveGasto(CveGasto) Then
+ Alert("El gasto se eliminó correctamente.", TipoMensaje.MsgInformacion)
+ End If
+ ObjPS.Dispose()
+ CargaDatos()
+ End Sub
+
+ Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs)
+ LimpiaModal()
+ DivTrayecto.Visible = True
+ Modalidad = "A"
+ BtnGuardar.Text = "Agregar"
+ ltlMotititulo.Text = "Agregar Gasto"
+
UpModal.Update()
+ RegistraScript("$('#DModal').modal()")
End Sub
+ Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
+ Dim ObjPS As New ClsGPS
+ If Modalidad = "A" Then
+ If ObjPS.AddGasto(TxtCantidad.Text.ToDecimal(), TxtPrecio.Text.Trim().ToDecimal(), TxtDescripcion.Text.Trim(), TxtObs.Text.Trim(), TxtFecha.Text.ToDateTime(),
+ 2, UsuarioActual.CveUsuario, UsuarioActual.CveCliente, CveTrayecto:=DdlTrayecto.SelectedValue.ToEntero()) Then
+ RegistraScript("$('#DModal').modal('hide')")
+ Alert("El Gasto se agregó correctamente.", TipoMensaje.MsgInformacion)
+ End If
+ ElseIf Modalidad = "U" Then
+ If ObjPS.UpdateGasto(CveGPSGasto, TxtCantidad.Text.ToDecimal(), TxtPrecio.Text.Trim().ToDecimal(), TxtDescripcion.Text.Trim(), TxtObs.Text.Trim(), TxtFecha.Text.ToDateTime(), UsuarioActual.CveUsuario) Then
+ RegistraScript("$('#DModal').modal('hide')")
+ Alert("El Gasto se agregó correctamente.", TipoMensaje.MsgInformacion)
+ End If
+ End If
+ ObjPS.Dispose()
+ CargaDatos()
+ End Sub
+
+#End Region
+
+#Region "LIMPIAR"
+ Protected Sub LimpiaModal()
TxtCantidad.Text = ""
+ TxtPrecio.Text = ""
+ TxtDescripcion.Text = ""
+ TxtObs.Text = ""
+ TxtFecha.Text = ""
DdlTrayecto.SelectedValueExist("-1")
End Sub
+
+#End Region
+
+#Region "GRIDVIEW"
+ Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ 'If e.Row.DBCampo("Estatus") = "True" Then
+ ' e.Row.Cells(1).ForeColor = Drawing.Color.Green
+ ' e.Row.Cells(1).Font.Bold = True
+ ' e.Row.Cells(1).Text = "Activo"
+ 'Else
+ ' e.Row.Cells(1).Text = "Inactivo"
+ ' e.Row.Cells(1).ForeColor = Drawing.Color.Red
+ ' e.Row.Cells(1).Font.Bold = True
+ 'End If
+ End If
+ End Sub
+
+#End Region
+
+End Class
diff --git a/GPS/TrayectoDetalle.aspx b/GPS/TrayectoDetalle.aspx
index 9ad04ede6..3c05926d2 100644
--- a/GPS/TrayectoDetalle.aspx
+++ b/GPS/TrayectoDetalle.aspx
@@ -425,7 +425,7 @@
-
+
@@ -446,6 +446,47 @@
+
+
+
+
+
+
+
+
+ Gastos
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GPS/TrayectoDetalle.aspx.vb b/GPS/TrayectoDetalle.aspx.vb
index 2b2344fa1..1498d5bb4 100644
--- a/GPS/TrayectoDetalle.aspx.vb
+++ b/GPS/TrayectoDetalle.aspx.vb
@@ -98,6 +98,10 @@ Partial Class GPS_TrayectoDetalle
GvCombustible.DataSource = ObjGPS.DtSetResultados.Tables(4)
GvCombustible.DataBind()
+
+ GvGastos.DataSource = ObjGPS.DtSetResultados.Tables(5)
+ GvGastos.DataBind()
+
End If
End If
Dim count = 0
@@ -210,5 +214,12 @@ Partial Class GPS_TrayectoDetalle
Alert("No se pudo obtener el estatus final", TipoMensaje.MsgError)
End If
ObjGPS.Dispose()
- End Sub
+ End Sub
+ Protected Sub GvGastos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ If String.IsNullOrEmpty(e.Row.DBCampo("CveGPSGasto")) Then
+ e.Row.CssClass = "Totales"
+ End If
+ End If
+ End Sub
End Class