diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 75aaea0c6..6d374654f 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -4653,7 +4653,11 @@ Public Class ClsContabilidad Retorno = SqlAdapter.SelectCommand.Parameters("@CveCuenta").Value.ToString.ToEntero 'Retorno = If(Data IsNot Nothing AndAlso Data.Rows.Count > 0, Data.Rows(0)("CveCuenta").ToString.ToEntero, 0) Catch Ex1 As SqlException - Me.OnError("Ocurrió un error al Guardar la cuenta.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + If Ex1.Message.Contains("IND_Conta_Cuentas_Codigo_CveEmpresa") Then + Me.OnError("No se puede registrar una cuenta ya existente", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Else + Me.OnError("Ocurrió un error al Guardar la cuenta.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If Catch ex As Exception Me.OnError("Ocurrió un error al Guardar la cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try diff --git a/App_Code/ClsGPS.vb b/App_Code/ClsGPS.vb index 9bffc2e1f..6e1ee8d05 100644 --- a/App_Code/ClsGPS.vb +++ b/App_Code/ClsGPS.vb @@ -8,9 +8,9 @@ Imports System.IO Imports Newtonsoft.Json Public Class ClsGPS - Implements IDisposable + Implements IDisposable #Region "Campos" - 'SQL + 'SQL Private Econ As OleDb.OleDbConnection Private SqlConexion As SqlConnection Private SqlAdapter As SqlDataAdapter @@ -45,9 +45,9 @@ Public Class ClsGPS Public Property EstaDentro As Boolean Public Property CvePuntoDeInteresGrupo As Integer Public Property CveGeoReferencia As Integer - Public Property MensajeError As String + Public Property MensajeError As String #End Region - + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) If TransaccionCompartida Is Nothing Then @@ -74,9 +74,9 @@ Public Class ClsGPS End With If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc Data = New DataTable - End Sub + End Sub #Region "Conexiones" - + Private Sub ConexionAdd() If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try @@ -109,7 +109,7 @@ Public Class ClsGPS CveConexion = 0 End If - End Sub + End Sub #End Region Public Function IniciaTransacSQL() As SqlTransaction If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() @@ -120,8 +120,40 @@ Public Class ClsGPS End Sub Public Sub Commit() SqlTransacc.Commit() - End Sub - + End Sub +#Region "Arrastre" + + Public Function GPS_ArrastreGET(CveDispositivo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_GPS_ArrastreGET") + With SqlAdapter.SelectCommand.Parameters + addParameters("@CveDispositivo", SqlDbType.Int, CveDispositivo) + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los datos de Arrastre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function GPS_ArrastreActivarDesactivar(CveDispositivo As Integer, ArrastreActivo As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_GPS_ArrastreActivarDesactivar") + With SqlAdapter.SelectCommand.Parameters + addParameters("@CveDispositivo", SqlDbType.Int, CveDispositivo) + addParameters("@ArrastreActivo", SqlDbType.Bit, ArrastreActivo) + End With + Try + Dataset = New DataSet() + SqlAdapter.Fill(Dataset) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al activar o desactivar la alerta de Arrastre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function +#End Region Public Function GetTemperatura(CveDispositivo As Integer, CveSensor As Integer, strFechaInicio As String, strFechaFin As String, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_GPS_TramaData") @@ -170,8 +202,8 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener las zonas horarias", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - + End Function + #Region "FacturasSims" Public Function GetFacturasSims(CveUsuario As Integer, CveEmpresa As Integer, Periodo As Integer) As Boolean Dim retorno As Boolean = False @@ -258,9 +290,9 @@ Public Class ClsGPS addParameters("@cveGpsFacturaSim", SqlDbType.Int, cveGpsFacturaSim) retorno = RunQuery("Ocurrió un error al eliminar el FacturasSims.") Return retorno - End Function + End Function #End Region - + #Region "M O D E L O S" Public Function AddMarca(Marca As String, Estatus As Boolean, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False @@ -456,13 +488,13 @@ Public Class ClsGPS End Try Return Retorno - End Function - - + End Function + + #End Region - + #Region "Rastreo" - + Public Function CoordenadasGet(id As Integer, Nombre As String) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Coords_Get") @@ -1565,11 +1597,11 @@ Public Class ClsGPS End Try Return Retorno - End Function - - + End Function + + #End Region - + #Region "Puntos de interes" Public Function PuntoDeInteresAdd(PuntoDeInteres As String, CveCliente As Integer, GEOM As String, Estatus As Boolean, Descripcion As String, CvePuntoDeInteresGrupo As Integer) As Boolean Dim Retorno As Boolean = False @@ -1736,12 +1768,12 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener el reporte de los Puntos de Interés.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - - - + End Function + + + #End Region - + #Region "CONDUCTORES" Public Function ConductorAdd(Conductor As String, Estatus As Boolean, CveUsuario As Integer, SerieLicencia As String, FechaNacimiento As Date, VencimientoLicencia As Date, Optional CveCliente As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1887,9 +1919,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "CONTROLADORES GRAFICOS" Public Function ControladorGraficoAdd(ControladorGrafico As String, UM As String) As Boolean Dim Retorno As Boolean = False @@ -1957,10 +1989,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "V E H I C U L O S" Public Function VehiculoAdd(Modelo As String, Color As String, Serie As String, Nombre As String, NoEconomico As String, CveUsuario As Integer, CveCliente As Integer) As Boolean Dim Retorno As Boolean = False @@ -2038,9 +2070,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "TIPO COMUNICACION" Public Function TipoComunicacionAdd(TipoComunicacion As String, Estatus As Boolean, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False @@ -2113,10 +2145,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "R U T A S" Public Function AddRuta(Ruta As String, CveCliente As Integer) As Boolean Dim Retorno As Boolean = False @@ -2179,9 +2211,9 @@ Public Class ClsGPS OnError("Ocurrió un error al eliminar la ruta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #End Region - + Public Function GetResGuardantesSim(CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_GPS_ResGuardantesSimnGet") @@ -2195,9 +2227,9 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener el proveedor de comunicacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #Region "Proveedor Comunicacion" - + Public Function ProveedorComunicacion_Add(ProveedorComunicacion As String, Estatus As Byte, CveUsuario As Integer, CveTipoComunicacion As Integer, APNIP As String, APNUSER As String, APNPASS As String, correo As String) As Boolean Dim Retorno As Boolean = False @@ -2279,12 +2311,12 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "Proveedor Comunicacion Cuentas" - + Public Function ProveedoresComunicacionCuentasAdd(CveProveedorComunicacion As Integer, CvePlanDato As Integer, CveUsuario As Integer, IP As String, SSID As String, NumeroTelefono As String, Estatus As Integer, CveEmpresa As Integer, Imei As String, CveUsuarioResguardante As Integer, Optional Activacion As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_GPS_ProveedoresComunicacionCuentasAdd") @@ -2423,10 +2455,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "E V E N T O S" Public Function EventoTipoAdd(EventoTipo As String, Estatus As Boolean, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False @@ -2901,15 +2933,15 @@ Public Class ClsGPS End Try Return Retorno - End Function - - - + End Function + + + #End Region - + #Region "Plan de Datos" - - + + Public Function PlanesDatosAdd(CveProveedorComunicacion As Integer, CveUsuario As Integer, PlanDato As String, Importe As Decimal, Estatus As Integer, Capacidad As Integer, TipoPlan As String, CostoAdicional As String, TechoFacturacion As String, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -2998,10 +3030,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "Dispositivos" Public Function DispositivoAdd(TipoDispositivo As Integer, NumTelefono As String, CveModelo As Integer, CveProveedorComunicacionCuenta As Integer, CveCliente As Integer, IMEI As String, Serie As String, CveEstatus As Integer, SerieVehiculo As String, ColorVehiculo As String, NombreVehiculo As String, NoEconomico As String, devID As String, devPort As Integer, ModeloVehiculo As String, AñoVehiculo As String, ClaseVehiculo As String, PlacasVehiculo As String, LimiteVelocidad As Boolean, VelocidadMaxima As Double, @@ -3328,10 +3360,10 @@ Public Class ClsGPS OnError("Ocurrió un error al actualizar los dispositivos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - + End Function + #End Region - + #Region "REPORTES" Public Function GetReportes() As Boolean Dim Retorno As Boolean = False @@ -3645,9 +3677,9 @@ Public Class ClsGPS OnError("Ocurrió un obtener el reporte de eventos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #End Region - + #Region "I N D I C A D O R E S" Public Function IndicadoresGet(CveCliente As Integer, FechaInicio As DateTime, FechaFin As DateTime) As Boolean Dim Retorno As Boolean = False @@ -3664,9 +3696,9 @@ Public Class ClsGPS OnError("Ocurrió un obtener el reporte de indicadores.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #End Region - + #Region "DashBoard" Public Function GetDashboard(CveCliente As Integer, FechaI As DateTime, FechaF As DateTime, Optional Top As Integer = 5) As String Dim Retorno As String = "[]" @@ -3917,10 +3949,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "Controles" Public Function GetCombustible(CveDispositivo As Integer, CveControl As Integer) As Boolean Dim Retorno As Boolean = False @@ -4275,9 +4307,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "A P L I C A C I O N M O V I L " Public Function AddTrama(DevID As String, Trama As String, Lat As Double, Lng As Double, FechaTrama As DateTime, Optional Speed As Double = 0, Optional Modelo As String = "App") As Boolean Dim Retorno As Boolean = False @@ -4411,9 +4443,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "G R U P O S" Public Function GruposAdd(Nombre As String, CveCliente As Integer) As Integer @@ -4483,10 +4515,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "G R U P O S - D E T A L L E" Public Function GruposDetallesAdd(CveDispositivoGrupo As Integer, CveDispositivo As Integer) As Boolean Dim Retorno As Boolean = False @@ -4535,9 +4567,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "A L T A S - B A J A S" Public Function AddAltaBajas(CveDispositivo As Integer, Fecha As DateTime, CveUsuario As Integer, Tipo As Integer, CveCliente As Integer) As Boolean Dim Retorno As Boolean = False @@ -4578,9 +4610,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "P A S A J E R O S" Public Function GetCortesChofer(CveCorteChofer As Integer, CveDispositivo As Integer, CveUsuarioIngreso As Integer) As Boolean Dim retorno As Boolean = False @@ -4714,9 +4746,9 @@ Public Class ClsGPS OnError("Ocurrió un error al eliminar los costos del kilometro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno - End Function + End Function #End Region - + #Region "T R A Y E C T O S" Public Function AddTrayecto(Trayecto As String, Fecha As DateTime, Folio As String, CveDispositivo As Integer, CveCliente As Integer) As Integer Dim retorno As Integer = 0 @@ -5266,10 +5298,10 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener la configuracion de FreightVerify.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno - End Function - + End Function + #End Region - + #Region "F U N C I O N E S" Public Function ReaderToJson(ByVal rdr As SqlDataReader) As String Dim sb As StringBuilder = New StringBuilder() @@ -5323,10 +5355,10 @@ Public Class ClsGPS jsonWriter.WriteEndArray() End Using Return sw.ToString() - End Function - + End Function + #End Region - + Protected Sub addParameters(name As String, tipo As SqlDbType, valor As Object) If SqlConexion.State = ConnectionState.Open Then SqlAdapter.SelectCommand.Parameters.Add(name, tipo).Value = valor @@ -5372,9 +5404,9 @@ Public Class ClsGPS addParameters("@FechaFin", SqlDbType.DateTime, fechaFin) retorno = RunQuery("Ocurrió un error al obtener el CombustibleResumen.") Return retorno - End Function + End Function #Region " IDisposable Support " - ' IDisposable + ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) If Not disposedValue Then If disposing Then @@ -5405,6 +5437,6 @@ Public Class ClsGPS ConexionClose() Dispose(True) GC.SuppressFinalize(Me) - End Sub + End Sub #End Region End Class diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 761bcfd3e..4ec17f940 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3482,6 +3482,8 @@ Public Class ClsPaginas PaginaDict = New System.Collections.Hashtable PaginaDict.Add("/Inicio.aspx".ToUpper(), -1) + PaginaDict.Add("/reporteador.aspx".ToUpper(), -1) + PaginaDict.Add("/GPS/RepArrastre.aspx".ToUpper(), -1) PaginaDict.Add("/Ventas/RepConciliacionEmitidosSat.aspx".ToUpper(), -1) PaginaDict.Add("/Ventas/RepConciliacionSat.aspx".ToUpper(), 716) PaginaDict.Add("/Ventas/SolicitudesSAT.aspx".ToUpper(), 717) diff --git a/GPS/RepArrastre.aspx b/GPS/RepArrastre.aspx new file mode 100644 index 000000000..dc674de2a --- /dev/null +++ b/GPS/RepArrastre.aspx @@ -0,0 +1,217 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepArrastre.aspx.cs" Inherits="GPS_RepArrastre" %> + + + + + + + + Reporte de Arrastre + + + + +
  • + Apagar vehiculo +
  • +
    + + + + + +
    +
    +
    + + +
    +
    +
    +
    + Vehiculo: +
    +
    + + + +
    + +
    +
    +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + + datos vehiculo +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + diff --git a/GPS/RepArrastre.aspx.cs b/GPS/RepArrastre.aspx.cs new file mode 100644 index 000000000..722d89e64 --- /dev/null +++ b/GPS/RepArrastre.aspx.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; + +public partial class GPS_RepArrastre : ClsPaginas +{ + + public int CveDispositivo + { + get + { + if (ViewState["CveDispositivo"] != null) + { + return ViewState["CveDispositivo"].ToString().ToEntero(); + + } + else + { + return 0; + } + } + set { ViewState["CveDispositivo"] = value; } + } + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + // fijo borrar + DdlDispositivo.DataSource = get_GlobalDTDispositivosUsuarios(263965, 1928) ; + //DdlDispositivo.DataSource = get_GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario) ; + DdlDispositivo.DataBind(); + getArrastre(); + } + + } + private void getArrastre() + { + CveDispositivo = DdlDispositivo.SelectedValue.ToEntero(); + using (ClsGPS objgps = new ClsGPS()) + { + if (objgps.GPS_ArrastreGET(CveDispositivo) && objgps.DtResultados.Rows.Count > 0) + { + DataRow dtrow = objgps.DtResultados.Rows[0]; + upInfo(dtrow); + } + + } + } + public void upInfo(DataRow dtrow) + { + if ( dtrow != null) + { + LblVelocidad.Text = $"{dtrow["Speed"]:N0}"; + LblEncApa.Text = $"{dtrow["EncendidoText"]}"; + LblFechaInfo.Text = $"{dtrow["FechaTrama"]:dd/MM/yyyy}"; + //LblVelocidad.Text = $"{dtrow[""]}"; + //LblVelocidad.Text = $"{dtrow[""]}";addmarkerActual({ lat: -25.363, lng: 131.044 }) + string pVehiculo = string.Format("{{ lat: {0}, lng: {1}}}", dtrow["Lat"], dtrow["Lng"]); + string parrastre = string.Format("{{ lat: {0}, lng: {1}}}", dtrow["LatArrastre"], dtrow["LngArrastre"]); + TxtFunciones.Text = string.Format("addmarkerActual({0},{3}){1};setCenter({2})", pVehiculo, (dtrow["ArrastreActivo"].ToString() == "1" ? $" ;addmarkerarrastre({parrastre})" : ";addmarkerarrastre()"), (dtrow["ArrastreActivo"].ToString() == "1" ? parrastre : pVehiculo), dtrow["Encendido"].ToString().ToEntero()); + UpInfo.Update(); + } + } + + protected void BtnConsultar_Click(object sender, EventArgs e) + { + getArrastre(); + } + + protected void chkActivarArrastre_CheckedChanged(object sender, EventArgs e) + { + using (ClsGPS objgps = new ClsGPS()) + { + if (objgps.GPS_ArrastreActivarDesactivar(CveDispositivo, chkActivarArrastre.Checked)){ + + if (objgps.GPS_ArrastreGET(CveDispositivo) && objgps.DtResultados.Rows.Count > 0) + { + DataRow dtrow = objgps.DtResultados.Rows[0]; + upInfo(dtrow); + } + if (chkActivarArrastre.Checked) + { + Alert("se ha activado la funcion de arrastre"); + } + else + { + Alert("se ha desactivado la funcion de arrastre"); + } + } + } + + } +} \ No newline at end of file diff --git a/Imagenes/rsz_11rsz_cargreen.png b/Imagenes/rsz_11rsz_cargreen.png index 374265dcd..2d560ffea 100644 Binary files a/Imagenes/rsz_11rsz_cargreen.png and b/Imagenes/rsz_11rsz_cargreen.png differ diff --git a/Inicio.aspx.vb b/Inicio.aspx.vb index 687113a45..ceb88aa8a 100644 --- a/Inicio.aspx.vb +++ b/Inicio.aspx.vb @@ -54,8 +54,9 @@ Partial Class Inicio End Function Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - If UsuarioActual.CveUsuario = 100 Then + If Not IsPostBack Then + 'Reporte de ventas sin registrar sig + If UsuarioActual.TienePermisoProceso(287) Then Using objgral As New ClsGenerales objgral.RepConciliacionSatDetalleGET(UsuarioActual.CveEmpresa, "I", "", "", 10) @@ -66,8 +67,9 @@ Partial Class Inicio End Using GvFoliosSAT.DataBind() - End If - If UsuarioActual.CveUsuario = 100 Then + End If + 'Reporte de ventas pendientes de cancelar + If UsuarioActual.TienePermisoProceso(288) Then Using objventas As New ClsVentas If (GetFacturasCanceladasPendientesWS(objventas, UsuarioActual.Empresa.RFC, UsuarioActual.CveEmpresa, False)) AndAlso objventas.DtResultados.Rows.Count > 0 Then RegistraScript("$('#ModalMitotereCancelaPendiente').modal();", "mitoterosatCanceladasPendientesWS") diff --git a/Ventas/RepConciliacionSat.aspx.cs b/Ventas/RepConciliacionSat.aspx.cs index fc917b6fe..9bf833b30 100644 --- a/Ventas/RepConciliacionSat.aspx.cs +++ b/Ventas/RepConciliacionSat.aspx.cs @@ -30,28 +30,6 @@ public partial class Ventas_RepConciliacionSat : ClsPaginas { if (!IsPostBack) { - - //CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); - //cryRpt.Load(String.Format("C:\\Proyectos\\wwwSIG\\Empresas\\Grales\\Formatos\\CatPS.rpt", UsuarioActual.Empresa.Ruta)); - //System.Data.DataTable DtDatos = new System.Data.DataTable(); - //using (ClsProductosServicios ObjPS = new ClsProductosServicios()) - //{ - // if (ObjPS.GetPSLite(-1, 119, "-1", "-1", "02541", -1, -1, -1, -1)) - // { - // DtDatos = ObjPS.DtResultados; - - // } - //} - //cryRpt.SetDataSource(DtDatos); - //CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo coninfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo(); - //cryRpt. - ////cryRpt.SetDatabaseLogon("JCaudillo", "JCau127*953");// 293357 - //reports.ReportSource = cryRpt; - //reports.RefreshReport(); - //// reports.Refresh(); - - - DateTime fecha; DateTime fechaInicio = DateTime.Now; DateTime fechaFin = DateTime.Now; diff --git a/reporteador.aspx b/reporteador.aspx new file mode 100644 index 000000000..7839d5639 --- /dev/null +++ b/reporteador.aspx @@ -0,0 +1,51 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="reporteador.aspx.cs" Inherits="reporteador" %> + + + + + + + + + + + + + + +
    +
    +
    + Imprime reporte +
    +
    + + + + + + + + + + + + + + + + + + + + + + + <%----%> + + +
    + + + diff --git a/reporteador.aspx.cs b/reporteador.aspx.cs new file mode 100644 index 000000000..5b0a79f08 --- /dev/null +++ b/reporteador.aspx.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; + + +public partial class reporteador : ClsPaginas +{ + public string rutaArchivo + { + get + { + return ViewState["rutaArchivo"].ToString(); + } + set { ViewState["rutaArchivo"] = value; } + } + protected void Page_PreInit(object sender, EventArgs e) + { + + } + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + rutaArchivo = Server.MapPath("~/Empresas/Grales/Formatos/CatPS.rpt"); + CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); + cryRpt.Load(rutaArchivo); + GVParametros.DataSource = cryRpt.DataDefinition.ParameterFields; + GVParametros.DataBind(); + } + } + + protected void GVParametros_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + CrystalDecisions.Shared.ParameterValues defaultValues = ((CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition)e.Row.DataItem).DefaultValues; + if (defaultValues.Count > 0) + { + e.Row.FCTextBox("TxtValor").Text = defaultValues[0].Description; + } + //CrystalDecisions.Shared.ParameterValues. DefaultValues + } + } + + protected void LnkImprime_Click(object sender, EventArgs e) + { + + string Formato = "PDF"; + List lista = new List(); + CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); + cryRpt.Load(rutaArchivo); + foreach (GridViewRow gvRow in GVParametros.Rows) + { + if (gvRow.RowType == DataControlRowType.DataRow) + { + lista.Add(new CrystalParametro(gvRow.DataKey("Name"), gvRow.FCTextBox("TxtValor").Text)); + + } + + } + ImprimirbytesPDF(ImprimirPDFCrystal(rutaArchivo, (new System.Data.DataTable()), lista, "Productos y Servicios", Formato), "Productos y Servicios", Formato); + + } + + +} \ No newline at end of file