Utilizamos cookies propias y de terceros. [Más información sobre las cookies].
Política de cookies
Proyecto AjpdSoft

· Inicio
· Buscar
· Contactar
· Cookies
· Descargas
· Foros
· Historia
· Nosotros
· Temas
· Top 10
· Trucos
· Tutoriales
· Wiki
Proyecto AjpdSoft: Foros

AjpdSoft :: Ver tema - Aplicación no se ejecuta en la PC Cliente
Foros de discusión Buscar Perfil FAQ Iniciar sesión
Information Aplicación no se ejecuta en la PC Cliente

Publicar nuevo tema Responder al tema
Foros de discusión » Borland Delphi, Codegear Delphi .Net   
Ver tema anterior :: Ver tema siguiente
AutorMensaje
aneudyp
Usuario


Registrado: Mar 02, 2015
Mensajes: 2

Asunto: Aplicación no se ejecuta en la PC Cliente Responder citando

Hola buenas, tengo el siguiente error:
* He creado una pequeña aplicación que se conecta a varias tablas de una aplicación principal (FireBird el manejador) e imprime un formulario. La primera etapa de dicha aplicación se compiló y ejecuto en las PC Clientes perfectamente pero con algunas mejoras (Busqueda, Controles, etc) la aplicación no se ejecuta en las PC Cliente. Utilizo Delphi 6 y ningún componente externo, además uso Win 7 Pro 32Bits.

Las PC Cliente tienen Windows 7 Pro 32bits también.

He monitoreado la ejecución en el Task Manager y se ejecuta por unos segundos y se cierra automaticamente.

Les coloco todo el código, es una sola ventana y un QReport. Espero puedan ayudarme.

Código:
unit dbBUSCAR;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, Grids, DBGrids, ADODB, dbnavE, DBCtrls, Buttons,
  ExtCtrls, ComCtrls, Menus;

type
  TfBuscar = class(TForm)
    ADOConnection1: TADOConnection;
    ADOTable1: TADOTable;
    ADOTable1EXPEDIENTE: TStringField;
    ADOTable1NOMBRES: TStringField;
    ADOTable1PRIMER_APELLIDO: TStringField;
    ADOTable1SEGUNDO_APELLIDO: TStringField;
    ADOTable1CEDULA: TStringField;
    ADOTable1NSS: TStringField;
    ADOTable1FECHA_NACIMIENTO: TDateTimeField;
    ADOTable1NACIONALIDAD: TIntegerField;
    ADOTable1SEXO: TStringField;
    ADOTable1CALLE: TStringField;
    ADOTable1CASA: TStringField;
    ADOTable1EDIFICIO: TStringField;
    ADOTable1PISO: TStringField;
    ADOTable1APARTAMENTO: TStringField;
    ADOTable1REFERENCIA: TStringField;
    ADOTable1TELEFONO1: TStringField;
    ADOTable1TELEFONO2: TStringField;
    ADOTable1PROVINCIA: TStringField;
    ADOTable1MUNICIPIO: TStringField;
    ADOTable1CIUDAD: TStringField;
    ADOTable1SECTOR: TStringField;
    ADOTable1NOTAS: TStringField;
    ADOTable1ARS: TIntegerField;
    ADOTable1PLAN_COBERTURA: TIntegerField;
    ADOTable1ESTADO_CIVIL: TStringField;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    Label1: TLabel;
    Label2: TLabel;
    ADOTable1USUARIO_MODIFICO: TStringField;
    ADOTable2: TADOTable;
    ADOTable2USUARIO: TStringField;
    ADOTable2NOMBRE_COMPLETO: TStringField;
    DataSource2: TDataSource;
    DBLookupComboBox1: TDBLookupComboBox;
    Label3: TLabel;
    Label4: TLabel;
    BtnImprimir: TBitBtn;
    BtnActualizar: TBitBtn;
    Image1: TImage;
    ADOTNac: TADOTable;
    ADOTCiu: TADOTable;
    ADOConnection2: TADOConnection;
    ADOTCiucod_ciudad: TStringField;
    ADOTCiudescripcio: TStringField;
    ADOTNacNACIONALIDAD: TIntegerField;
    ADOTNacDETALLE: TStringField;
    ADOTMun: TADOTable;
    ADOTMuncod_munici: TStringField;
    ADOTMundescripcio: TStringField;
    ADOTARS: TADOTable;
    ADOTPlanARS: TADOTable;
    ADOTARSARS: TIntegerField;
    ADOTARSDETALLE: TStringField;
    ADOTPlanARSPLAN_COBERTURA: TIntegerField;
    ADOTPlanARSDETALLE: TStringField;
    ADOTProv: TADOTable;
    ADOTProvcod_pro: TStringField;
    ADOTProvdescripcio: TStringField;
    BtnSalir: TSpeedButton;
    Timer1: TTimer;
    ADOCFAE: TADOConnection;
    ADOTFAE: TADOTable;
    ADOTFAEID: TAutoIncField;
    ADOTFAEEXPEDIENTE: TWideStringField;
    ADOTFAEARS: TWideStringField;
    ADOTFAEPLAN: TWideStringField;
    ADOTFAEUSUARIO: TWideStringField;
    ADOTFAEFECHA: TWideStringField;
    DBNFAE: TDBNavigator;
    DataSFAE: TDataSource;
    Edit1: TEdit;
    ComboBox1: TComboBox;
    BtnBuscar: TBitBtn;
    Label6: TLabel;
    Label7: TLabel;
    StatusBar1: TStatusBar;
    Timer2: TTimer;
    PopupMenu1: TPopupMenu;
    IMPRIMIR1: TMenuItem;
    Label5: TLabel;
    procedure BtnImprimirClick(Sender: TObject);
    procedure BtnActualizarClick(Sender: TObject);
    procedure BtnSalirClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BtnBuscarClick(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
    procedure Timer2Timer(Sender: TObject);
    procedure IMPRIMIR1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fBuscar: TfBuscar;
  expediente : string;
implementation

uses Reporte, INIFiles;

{$R *.dfm}
//Lee la version de la aplicación
function GetAppVersion : string;
   var Size, Size2: DWord;
       Pt, Pt2: Pointer;
   begin
        Size := GetFileVersionInfoSize(PChar (ParamStr (0)), Size2);
        if Size > 0 then
         begin
              GetMem (Pt, Size);
              try
                 GetFileVersionInfo (PChar (ParamStr (0)), 0, Size, Pt);
                 VerQueryValue (Pt, '\', Pt2, Size2);
                 with TVSFixedFileInfo (Pt2^) do
                  begin
                       Result:= ' Versión '+
                                IntToStr (HiWord (dwFileVersionMS)) + '.' +
                                IntToStr (LoWord (dwFileVersionMS)) + ' Build ' +
                                IntToStr (HiWord (dwFileVersionLS)) + '.' +
                                IntToStr (LoWord (dwFileVersionLS));
                  end;
              finally
                     FreeMem (Pt);
              end;
         end;
   end;
//Calcula la edad
function Edad(AFechaNacimiento: TDateTime) : Integer;
begin
  Result := Trunc((Date - AFechaNacimiento) / 365.25);
end;

procedure TfBuscar.BtnImprimirClick(Sender: TObject);
begin
        if  DBLookupComboBox1.Text = '' then  //Evitando que no se imprima sin Quien atendió el Usuario
                Begin
                        Showmessage('Debe seleccionar su USUARIO?');
                        DBLookupComboBox1.SetFocus;
                end else
                        //Evitando que la ARS y PLAN esten en Blanco
                        If (ADOTable1ARS.AsString = '') or (ADOTable1PLAN_COBERTURA.AsString= '') then
                                Begin
                                        Showmessage('ARS o PLAN de Cobertura del Paciente están en Blanco.');
                                        Showmessage('ACTUALICE los Datos del Paciente en SIGHO.');
                                       
                                end else
                                Begin
                                        expediente:= ADOTable1Expediente.Value;
                                        //Label2.Caption:= 'IMPRESO EXP: '+expediente;

                                        //BUSCANDO POR CODIGO LOS DETALLES
                                        ADOTNac.Locate('NACIONALIDAD',ADOTable1NACIONALIDAD.AsString ,[]); //Nacionalidad
                                        ADOTCiu.Locate('cod_ciudad',ADOTable1CIUDAD.AsString,[]); //Ciudad
                                        ADOTMun.Locate('cod_munici',ADOTable1MUNICIPIO.AsString, []); //Municipio
                                        ADOTProv.Locate('cod_pro',ADOTable1PROVINCIA.AsString,[]); //Provincia
                                        ADOTARS.Locate('ARS',ADOTable1ARS.AsString,[]); //ARS
                                        ADOTPlanARS.Locate('PLAN_COBERTURA',ADOTable1PLAN_COBERTURA.AsString,[]);//PlanxARS

                                        //Envio de datos al Reporte
                                        //Reporte.QuickReport1.QRLabel3.Caption:= ADOTMundescripcio.Value;
                                        Reporte.QuickReport1.QRLabel4.Caption:= ADOTable2USUARIO.Value; //Usuario en firma
                                        Reporte.QuickReport1.QRLabel6.Caption:='ATENDIDO POR: '+ADOTable2USUARIO.Value; //Usuario
                                        Reporte.QuickReport1.QRLabel5.Caption:= ADOTARSDETALLE.Value; //ARS
                                        Reporte.QuickReport1.QRLabel13.Caption:= ADOTPlanARSDETALLE.Value; //PlanxARS
                                        Reporte.QuickReport1.QRLabel14.Caption:= ADOTable1NSS.Value; //NSS
                                        Reporte.QuickReport1.QRLabel15.Caption:= ADOTable1CEDULA.Value; //Cedula
                                        Reporte.QuickReport1.QRLabel17.Caption:= ADOTable1Expediente.Value; //#Expediente
                                        Reporte.QuickReport1.QRLabel19.Caption:= trim(ADOTable1NOMBRES.Value)+' '+trim(ADOTable1PRIMER_APELLIDO.Value)+' '+ADOTable1SEGUNDO_APELLIDO.Value; //Nombres+Apellidos
                                        Reporte.QuickReport1.QRLabel21.Caption:= ADOTNacDETALLE.Value; //Nacionalidad
                                        Reporte.QuickReport1.QRLabel23.Caption:= ADOTable1SEXO.Value; //Sexo M/F
                                        Reporte.QuickReport1.QRLabel25.Caption:= ADOTable1ESTADO_CIVIL.Value; //Estado Civil
                                        Reporte.QuickReport1.QRLabel27.Caption:= FormatDateTime('dd/mm/yyyy', ADOTable1FECHA_NACIMIENTO.Value)+'  ('+InttoStr(Edad(ADOTable1FECHA_NACIMIENTO.Value))+' año(s))'; //Fecha Nac. + Edad
                                        Reporte.QuickReport1.QRLabel29.Caption:= 'CALLE '+trim(ADOTable1CALLE.Value)+', '+'CASA #'+trim(ADOTable1CASA.Value)+', '+'EDIF.: '+trim(ADOTable1EDIFICIO.Value)+', '+'PISO '+trim(ADOTable1PISO.Value)+', '+'APTO.: '+trim(ADOTable1APARTAMENTO.Value)+', '+trim(ADOTMundescripcio.Value)+', '+trim(ADOTProvdescripcio.Value); //Direccion
                                        Reporte.QuickReport1.QRLabel31.Caption:= ADOTable1TELEFONO1.Value+' / '+ADOTable1TELEFONO2.Value; //Telefonos
                                        Reporte.QuickReport1.QRLabel33.Caption:= trim(ADOTable1REFERENCIA.Value); //Referencia
                                        Reporte.QuickReport1.Preview;
                                end;


        //Guardar Datos para Reporte Estadístico
        DBNFae.BtnClick(nbInsert); //Clic boton Insert
        ADOTFAEEXPEDIENTE.Value:= ADOTable1Expediente.Value; //Expediente
        ADOTFAEARS.Value:= ADOTARSDETALLE.Value; //ARS
        ADOTFAEPLAN.Value:= ADOTPlanARSDETALLE.Value; //PlanxARS
        ADOTFAEUSUARIO.Value:= ADOTable2USUARIO.Value; //Usuario
        ADOTFAEFECHA.Value:= DateTimeToStr(Now()); //Fecha
        DBNFae.BtnClick(nbPost); //Clic boton Salvar del Navigator
end;

procedure TfBuscar.BtnActualizarClick(Sender: TObject);
begin
        Adotable1.Active:=False; //Desconecta Tabla
        ADOTable2.Active :=False;
        DBLookupComboBox1.Enabled:=False; //Inhabilito todo
        BtnBuscar.Enabled:= False;
        BtnImprimir.Enabled:=False;
        BtnActualizar.Enabled:=False;
        Adotable1.Active:=True;  //Conecta Tabla
        ADOTable2.Active :=True;
        Showmessage('DATOS ACTUALIZADOS!');
        DBLookupComboBox1.Enabled:=True; //Habilito todo
        BtnBuscar.Enabled:= True;
        BtnImprimir.Enabled:=True;
        BtnActualizar.Enabled:=True;
end;

procedure TfBuscar.BtnSalirClick(Sender: TObject);
begin
Application.Terminate
end;

procedure TfBuscar.FormCreate(Sender: TObject);
        var
                MiConfIni:TIniFile;
                Ruta: string;
                DB:String;
                Conexion:String;
begin

        //Cargar datos del txt
        Ruta := ExtractFileDir(ParamStr(0)) + '\conf.ini';   // Ruta desde donde se ejecuta el archivo Principal de la aplicación
        MiConfIni:=TIniFile.Create(Ruta);  //Creo la ruta completa al archivo ini
        DB:= MiConfIni.ReadString('PATH','DB','');  //Leo el archivo ini
        //Label5.Caption:= Ruta;
        //Label6.Caption:= DB;
        Conexion:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+DB+';Persist Security Info=False;';
        //Desactivo las conexiones
        ADOConnection1.Connected:=False;
        ADOCFAE.Connected:=False;
        ADOConnection2.Connected:=False;
        ADOCFAE.ConnectionString:=Conexion; //Coloco el string de conexion
         //Desconectar tablas
        ADOTFAE.Active:= False;
        ADOTable1.Active:= False;
        ADOTable2.Active := False;
        ADOTARS.Active := False;
        ADOTPlanARS.Active := False;
        ADOTProv.Active := False;
        ADOTMun.Active := False;
        ADOTCiu.Active := False;
        ADOTNac.Active := False;

        //Activo las conexiones
       // Try
                ADOConnection1.Connected:=True;
                ADOCFAE.Connected:=True;
                ADOConnection2.Connected:=True;
                ADOTFAE.Active:= True;
                ADOTable1.Active:= True;
                ADOTable2.Active := True;
                ADOTARS.Active := True;
                ADOTPlanARS.Active := True;
                ADOTProv.Active := True;
                ADOTMun.Active := True;
                ADOTCiu.Active := True;
                ADOTNac.Active := True;
                ADOTFAE.Active:= True;  //Conecto las Tabla
        //except
        //ShowMessage('ERROR AL CONECTAR LA BASE DE DATOS');
        //end;
        //Label5.Caption:= Conexion;
end;

procedure TfBuscar.BtnBuscarClick(Sender: TObject);
begin
   If ComboBox1.ItemIndex = 0 then
        Begin
               if ADOTable1.Locate('EXPEDIENTE',Edit1.Text,[])= false then
                Showmessage('Expediente no encontrado!');
                Edit1.SetFocus
        end
   else If ComboBox1.ItemIndex = 1 then
        begin
                if ADOTable1.Locate('CEDULA',Edit1.Text,[])= false then
                Showmessage('Cédula no encontrada!');
                Edit1.SetFocus
        end
    else
    if ADOTable1.Locate('NSS',Edit1.Text,[])= false then
                Showmessage('NSS no encontrado!');
                Edit1.SetFocus
end;

procedure TfBuscar.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
        BtnBuscar.Click
end;

procedure TfBuscar.DBGrid1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin //Si ARS or PlaxARS estan vacios colorear Rojo
If (ADOTable1ARS.AsString = '') or (ADOTable1PLAN_COBERTURA.AsString= '') then
        Begin
        DBGrid1.Canvas.Brush.Color:= ClRed;
        DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
        end
        else
        Begin
                IF (ADOTable1NSS.AsString <> '') and
                   (ADOTable1ARS.AsString <> '') and (ADOTable1PLAN_COBERTURA.AsString <> '') then
                   Begin
                        DBGrid1.Canvas.Brush.Color:= ClGreen;
                        DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
                   end
                   else
                   DBGrid1.Canvas.Brush.Color:= ClYellow;
                   DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
        end
end;
procedure TfBuscar.Timer2Timer(Sender: TObject);
begin
//Colocando datos en el statusBar
StatusBar1.Panels[0].Text:= GetAppVersion;
StatusBar1.Panels[1].Text:= 'FECHA: '+(DatetoStr(Now))+'  '+'HORA: '+(TimetoStr(now));
end;

procedure TfBuscar.IMPRIMIR1Click(Sender: TObject);
begin
  //CLIC AL BOTON IMPRIMIR
  BtnImprimir.Click
end;

end.
MensajePublicado:
Mie Abr 08, 2015 7:09 pm
Top of PageVer perfil de usuario
Mostrar mensajes de anteriores:   
Todas las horas son GMT - 1 Horas
Publicar nuevo tema Responder al tema
Foros de discusión » Borland Delphi, Codegear Delphi .Net  

Cambiar a:  
Key
  Puede publicar nuevos temas en este foro
No puede responder a temas en este foro
No puede editar sus mensajes en este foro
No puede borrar sus mensajes en este foro
No puede votar en encuestas en este foro
Visita nuestro nuevo sitio web con programas y contenidos actualizados: Proyecto A