First commit 11/12/1999
BIN
-Elemento.bmp
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
-cerrar-8b.bmp
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
-cfg-8b.bmp
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
-min-8b.bmp
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
-pos-24b.bmp
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
0Elemento.bmp
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
0JDsoft.bmp
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
0cerrar-8b.bmp
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
0cfg-8b.bmp
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
0min-8b.bmp
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
0pos-24b.bmp
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
0pos-8b.bmp
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
1JDsoft.bmp
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
1cerrar-8b.bmp
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
1min-8b.bmp
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
1pos-24b.bmp
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
1pos-8b.bmp
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
3Elemento-8b.bmp
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
4Elemento-8b.bmp
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
5Elemento.bmp
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
App-8b.bmp
Normal file
After Width: | Height: | Size: 193 KiB |
58
ComprarBono.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "ComprarBono.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "CoolForm"
|
||||
#pragma link "FormularioREUSABLE"
|
||||
#pragma resource "*.dfm"
|
||||
TCBono *CBono;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TCBono::TCBono(TComponent* Owner)
|
||||
: TFormREUSABLE(Owner)
|
||||
{
|
||||
Label1->Caption = TDateTime::CurrentDate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCBono::BitBtn1Click(TObject *Sender)
|
||||
{
|
||||
try {
|
||||
if ( Horas->Text.ToInt() < 0 || Horas->Text.ToInt() >50 ) Horas->Text = "0";
|
||||
} catch(...) { Horas->Text = "0";
|
||||
Horas->SelStart= 0;
|
||||
Horas->SelLength= 1;
|
||||
}
|
||||
try {
|
||||
if ( Min->Text.ToInt() < 0 || Min->Text.ToInt() >59 ) Min->Text = "0";
|
||||
} catch(...) { Min->Text = "0";
|
||||
Min->SelStart= 0;
|
||||
Min->SelLength= 1;
|
||||
}
|
||||
if ( Horas->Text.ToInt() == 0 )
|
||||
{
|
||||
ShowMessage( "Debe indicar la DURACIÓN DEL BONO" );
|
||||
return;
|
||||
}
|
||||
try{
|
||||
if ( Currency(CosteBono->Text) == 0 )
|
||||
{
|
||||
ShowMessage( "Debe indicar la COSTE DEL BONO" );
|
||||
return;
|
||||
}
|
||||
} catch(...) {
|
||||
ShowMessage( "Debe indicar la COSTE DEL BONO" );
|
||||
return;
|
||||
}
|
||||
|
||||
ModalResult = mrOk;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCBono::Button1Click(TObject *Sender)
|
||||
{
|
||||
ModalResult = mrCancel;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
254
ComprarBono.dfm
Normal file
@ -0,0 +1,254 @@
|
||||
inherited CBono: TCBono
|
||||
Left = 328
|
||||
Top = 158
|
||||
Caption = 'CBono'
|
||||
OldCreateOrder = True
|
||||
Position = poOwnerFormCenter
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
inherited CoolForm1: TCoolForm
|
||||
Mask2 = {
|
||||
3002000020000000010000002100000010020000040000000200000064010000
|
||||
030100001A000000020000004E01000003000000170000000300000051010000
|
||||
0400000015000000040000005301000005000000130000000500000055010000
|
||||
0600000012000000060000005601000007000000100000000700000058010000
|
||||
080000000F0000000800000059010000090000000E000000090000005A010000
|
||||
0A0000000C0000000A0000005C0100000C0000000B0000000C0000005D010000
|
||||
0D0000000A0000000D0000005E0100000E000000090000000E0000005F010000
|
||||
1000000008000000100000006001000011000000070000001100000061010000
|
||||
1300000006000000130000006201000015000000050000001500000063010000
|
||||
18000000040000001800000064010000ED00000005000000ED00000063010000
|
||||
F000000006000000F000000062010000F200000007000000F200000061010000
|
||||
F400000008000000F400000060010000F500000009000000F50000005F010000
|
||||
F70000000A000000F70000005E010000F80000000B000000F80000005D010000
|
||||
F90000000C000000F90000005C010000FB0000000E000000FB0000005A010000
|
||||
FC0000000F000000FC00000059010000FD00000010000000FD00000058010000
|
||||
FE00000012000000FE00000056010000FF00000013000000FF00000055010000
|
||||
0001000015000000000100005301000001010000170000000101000051010000
|
||||
020100001A000000020100004E01000003010000}
|
||||
end
|
||||
object Terminal: TLabel [1]
|
||||
Left = 72
|
||||
Top = 5
|
||||
Width = 209
|
||||
Height = 20
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
Caption = 'Comprar Bonos'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clAqua
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label6: TLabel [2]
|
||||
Left = 34
|
||||
Top = 41
|
||||
Width = 145
|
||||
Height = 20
|
||||
Caption = 'Fecha de compra:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clYellow
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label1: TLabel [3]
|
||||
Left = 184
|
||||
Top = 41
|
||||
Width = 71
|
||||
Height = 20
|
||||
Caption = '12/02/00'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clLime
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label2: TLabel [4]
|
||||
Left = 34
|
||||
Top = 89
|
||||
Width = 156
|
||||
Height = 20
|
||||
Caption = 'Tiempo contratado:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWhite
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label3: TLabel [5]
|
||||
Left = 34
|
||||
Top = 137
|
||||
Width = 137
|
||||
Height = 20
|
||||
Caption = 'Coste del BONO:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWhite
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label4: TLabel [6]
|
||||
Left = 306
|
||||
Top = 137
|
||||
Width = 11
|
||||
Height = 20
|
||||
Caption = '€'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWhite
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Shape4: TShape [7]
|
||||
Left = 249
|
||||
Top = 105
|
||||
Width = 7
|
||||
Height = 7
|
||||
Shape = stCircle
|
||||
end
|
||||
object Shape3: TShape [8]
|
||||
Left = 249
|
||||
Top = 93
|
||||
Width = 7
|
||||
Height = 7
|
||||
Shape = stCircle
|
||||
end
|
||||
object Bevel1: TBevel [9]
|
||||
Left = 32
|
||||
Top = 72
|
||||
Width = 295
|
||||
Height = 9
|
||||
Shape = bsTopLine
|
||||
end
|
||||
object CosteBono: TEdit
|
||||
Left = 176
|
||||
Top = 134
|
||||
Width = 121
|
||||
Height = 28
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object Horas: TComboBox
|
||||
Left = 208
|
||||
Top = 88
|
||||
Width = 40
|
||||
Height = 28
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
ItemHeight = 20
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
Text = '00'
|
||||
Items.Strings = (
|
||||
'1'
|
||||
'2'
|
||||
'3'
|
||||
'4'
|
||||
'5'
|
||||
'6'
|
||||
'7'
|
||||
'8'
|
||||
'9'
|
||||
'10'
|
||||
'12'
|
||||
'15'
|
||||
'20'
|
||||
'24')
|
||||
end
|
||||
object Min: TComboBox
|
||||
Left = 258
|
||||
Top = 88
|
||||
Width = 40
|
||||
Height = 28
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
ItemHeight = 20
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
Text = '00'
|
||||
Items.Strings = (
|
||||
'0'
|
||||
'5'
|
||||
'10'
|
||||
'15'
|
||||
'20'
|
||||
'25'
|
||||
'30'
|
||||
'35'
|
||||
'40'
|
||||
'45'
|
||||
'50'
|
||||
'55')
|
||||
end
|
||||
object BitBtn1: TBitBtn
|
||||
Left = 120
|
||||
Top = 176
|
||||
Width = 121
|
||||
Height = 33
|
||||
Caption = 'Aceptar'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 4
|
||||
OnClick = BitBtn1Click
|
||||
Glyph.Data = {
|
||||
8E030000424D8E03000000000000760000002800000042000000160000000100
|
||||
04000000000018030000C40E0000C40E00001000000000000000000000000000
|
||||
80000080000000808000800000008000800080800000C0C0C000808080000000
|
||||
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00555555555555
|
||||
5555555555555555599999999555555555555555555555555555550000005555
|
||||
5555555555555555555555599999999999955555555555555555555555555500
|
||||
0000555555555555555555555555559999999999999955555555555555555555
|
||||
55555500000055555555555555555555555559999FFFFFFF999995552AAAAA2B
|
||||
C4B2ACACC225550000005555555555555555555555559999FFFFFFFFFF999955
|
||||
2AAAAA2C44C2ACAC22225500000022222222222222222255555999999FFFFFFF
|
||||
FFF999952AAAAA2B4CB2ACACC2A2250000002AAAAA2BC4B2ACACC22555599999
|
||||
99FF000000FF99952CACCA2C44B2AAAAA2A2220000002AAAAA2C44C2ACAC2222
|
||||
550000F999907777770FF9992CAC2A2BC4C2AAAAA2A2A20000002AAAAA2B4CB2
|
||||
ACACC2A2254C4C009999FFF00000F9992CACCA2B44B2AAAAA2A2A20000002CAC
|
||||
CA2C44B2AAAAA2A222C4C40779999FFF777709992222222BBBB2222222A2A200
|
||||
00002CAC2A2BC4C2AAAAA2A2A2CCCC0FFF9999F00000F9992222222BBBB22222
|
||||
2AA2A20000002CACCA2B44B2AAAAA2A2A2CCCC000FF9999F7770F9992AAAAA2B
|
||||
C4B2ACACC2AAA20000002222222BBBBB222222A2A200000FF0FF9999000FF999
|
||||
2AAAAA2C44C2ACAC22A2A2000000522AAAA2BBBBB2AAAA22A2999FFFFF0FF999
|
||||
9FFFF9992AAAAA2B4CB2ACACC2A2A2000000552222222BBBBB222222A2999FFF
|
||||
FFF00F9999FFF9992CACCA2C44B2AAAAA2A2A200000055522AAAA2BBBBB2AAAA
|
||||
225999FFFFFFF0F9999F99952CAC2A2BC4C2AAAAA2A2A200000055552222222B
|
||||
BBBB22222259999FFFFFFF00999999952CACCA2B44B2AAAAA2A2A20000005555
|
||||
555555555555555555559999FFFFFFFFF99999552222222BBBBB222222A2A200
|
||||
0000555555555555555555555555599999FFFFFF99999555522AAAA2BBBBB2AA
|
||||
AA22A20000005555555555555555555555555599999999999999555555222222
|
||||
2BBBBB222222A200000055555555555555555555555555599999999999955555
|
||||
55522AAAA2BBBBB2AAAA22000000555555555555555555555555555559999999
|
||||
955555555555555555555555555555000000}
|
||||
NumGlyphs = 3
|
||||
end
|
||||
end
|
41
ComprarBono.h
Normal file
@ -0,0 +1,41 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ComprarBonoH
|
||||
#define ComprarBonoH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include "CoolForm.hpp"
|
||||
#include "FormularioREUSABLE.h"
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Graphics.hpp>
|
||||
#include <Buttons.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TCBono : public TFormREUSABLE
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TLabel *Terminal;
|
||||
TLabel *Label6;
|
||||
TLabel *Label1;
|
||||
TLabel *Label2;
|
||||
TLabel *Label3;
|
||||
TLabel *Label4;
|
||||
TEdit *CosteBono;
|
||||
TComboBox *Horas;
|
||||
TShape *Shape4;
|
||||
TShape *Shape3;
|
||||
TComboBox *Min;
|
||||
TBevel *Bevel1;
|
||||
TBitBtn *BitBtn1;
|
||||
void __fastcall BitBtn1Click(TObject *Sender);
|
||||
void __fastcall Button1Click(TObject *Sender);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TCBono(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TCBono *CBono;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
146
CtrlCfg.cpp
Normal file
@ -0,0 +1,146 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <io.h>
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "CtrlCfg.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "CoolForm"
|
||||
#pragma link "FormularioREUSABLE"
|
||||
#pragma resource "*.dfm"
|
||||
TElementosCFG *ElementosCFG;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TElementosCFG::TElementosCFG(TComponent* Owner)
|
||||
: TFormREUSABLE(Owner)
|
||||
{
|
||||
PosiblesCambios = false;
|
||||
|
||||
TbAppl->Active = true;
|
||||
TbPrecios->Active = true;
|
||||
TbElementosCFG->Active = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElementosCFG::FormClose(TObject *Sender, TCloseAction &Action)
|
||||
{
|
||||
try {
|
||||
TbElementosCFG->Post();
|
||||
if ( PosiblesCambios )
|
||||
{
|
||||
// Cambios en la CFG.
|
||||
if ( Application->MessageBox("Ha efectuado cambios en las listas de control.\n\nPara actualizar los clientes, ahora, siga estos pasos:\n\t-Active todos los clientes\n\t-Asegurese de que existe conexion\n\t-Pulse el boton ACEPTAR\n\n\nY espere unos minutos antes de operar con ningún terminal\nhasta que se concluya el envio completo de las listas.\n\nNO DESCONECTE NINGUN TERMINAL HASTA CONCLUIR EL ENVIO\nTanto CLIENTE y SERVIDOR prodrian quedar ALTAMENTE INESTABLE", "¡¡¡ ACTUALIZACION DE LISTAS !!!", MB_OKCANCEL + MB_DEFBUTTON1) == ID_CANCEL )
|
||||
PosiblesCambios = false;
|
||||
}
|
||||
} catch(...) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TElementosCFG::TbPreciosBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
// Si la tabla no existe, la creamos
|
||||
if ( access( (TbPrecios -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendrá la tabla
|
||||
TbPrecios -> FieldDefs -> Clear();
|
||||
|
||||
TbPrecios -> FieldDefs -> Add("Tiempo", ftTime, 0, false );
|
||||
TbPrecios -> FieldDefs -> Add("Precio", ftCurrency, 0, false );
|
||||
|
||||
TbPrecios -> IndexDefs -> Clear();
|
||||
TbPrecios -> IndexDefs -> Add("Primary", "Tiempo", TIndexOptions() << ixPrimary << ixUnique );
|
||||
|
||||
// Creamos la base...
|
||||
TbPrecios -> CreateTable();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TElementosCFG::SpeedButton1Click(TObject *Sender)
|
||||
{
|
||||
Terminal->Caption = "Configuración de los Terminales";
|
||||
|
||||
DBGrid3->Enabled = false;
|
||||
DBGrid3->Visible = false;
|
||||
|
||||
DBGrid2->Enabled = false;
|
||||
DBGrid2->Visible = false;
|
||||
|
||||
DBGrid1->Enabled = true;
|
||||
DBGrid1->Visible = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TElementosCFG::SpeedButton2Click(TObject *Sender)
|
||||
{
|
||||
Terminal->Caption = "Configuración de Precios";
|
||||
|
||||
DBGrid3->Enabled = false;
|
||||
DBGrid3->Visible = false;
|
||||
|
||||
DBGrid1->Enabled = false;
|
||||
DBGrid1->Visible = false;
|
||||
|
||||
DBGrid2->Enabled = true;
|
||||
DBGrid2->Visible = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElementosCFG::SpeedButton3Click(TObject *Sender)
|
||||
{
|
||||
Terminal->Caption = "Aplicaciones Protegidas";
|
||||
|
||||
DBGrid2->Enabled = false;
|
||||
DBGrid2->Visible = false;
|
||||
|
||||
DBGrid1->Enabled = false;
|
||||
DBGrid1->Visible = false;
|
||||
|
||||
DBGrid3->Enabled = true;
|
||||
DBGrid3->Visible = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TElementosCFG::TbApplBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
// Si la tabla no existe, la creamos
|
||||
if ( access( (TbAppl -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendrá la tabla
|
||||
TbAppl -> FieldDefs -> Clear();
|
||||
|
||||
TbAppl -> FieldDefs -> Add("idTA", ftString, 14, false );
|
||||
TbAppl -> FieldDefs -> Add("NAppl", ftString, 14, false );
|
||||
|
||||
// Creamos la base...
|
||||
TbAppl -> CreateTable();
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TElementosCFG::TbApplBeforeInsert(TDataSet *DataSet)
|
||||
{
|
||||
if ( TbAppl->RecordCount > 100 )
|
||||
{
|
||||
ShowMessage( "Esta versión posee limitaciones,\nrespecto al nº de aplicaciones a bloquear\n¡Sobrepaso el nº máximo permitido!");
|
||||
TbAppl->Cancel();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TElementosCFG::TbApplAfterPost(TDataSet *DataSet)
|
||||
{
|
||||
PosiblesCambios = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TElementosCFG::Button1Click(TObject *Sender)
|
||||
{
|
||||
ModalResult = mrCancel;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
CtrlCfg.dfm
Normal file
53
CtrlCfg.h
Normal file
@ -0,0 +1,53 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef CtrlCfgH
|
||||
#define CtrlCfgH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include "CoolForm.hpp"
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Db.hpp>
|
||||
#include <DBGrids.hpp>
|
||||
#include <DBTables.hpp>
|
||||
#include <Grids.hpp>
|
||||
#include <Buttons.hpp>
|
||||
#include <Graphics.hpp>
|
||||
#include "FormularioREUSABLE.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TElementosCFG : public TFormREUSABLE
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TLabel *Terminal;
|
||||
TTable *TbElementosCFG;
|
||||
TDataSource *DsElementosCFG;
|
||||
TDBGrid *DBGrid1;
|
||||
TTable *TbPrecios;
|
||||
TDataSource *DsPrecios;
|
||||
TDBGrid *DBGrid2;
|
||||
TSpeedButton *SpeedButton1;
|
||||
TSpeedButton *SpeedButton2;
|
||||
TSpeedButton *SpeedButton3;
|
||||
TDBGrid *DBGrid3;
|
||||
TTable *TbAppl;
|
||||
TDataSource *DsAppl;
|
||||
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||
void __fastcall TbPreciosBeforeOpen(TDataSet *DataSet);
|
||||
void __fastcall SpeedButton1Click(TObject *Sender);
|
||||
void __fastcall SpeedButton2Click(TObject *Sender);
|
||||
void __fastcall SpeedButton3Click(TObject *Sender);
|
||||
void __fastcall TbApplBeforeOpen(TDataSet *DataSet);
|
||||
void __fastcall TbApplBeforeInsert(TDataSet *DataSet);
|
||||
void __fastcall TbApplAfterPost(TDataSet *DataSet);
|
||||
void __fastcall Button1Click(TObject *Sender);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
bool PosiblesCambios;
|
||||
__fastcall TElementosCFG(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TElementosCFG *ElementosCFG;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
14
CtrlD_PasswordDlg.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
//---------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "CtrlD_PasswordDlg.h"
|
||||
//---------------------------------------------------------------------
|
||||
#pragma resource "*.dfm"
|
||||
TPasswordDlg *PasswordDlg;
|
||||
//---------------------------------------------------------------------
|
||||
__fastcall TPasswordDlg::TPasswordDlg(TComponent* AOwner)
|
||||
: TForm(AOwner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------
|
BIN
CtrlD_PasswordDlg.dfm
Normal file
29
CtrlD_PasswordDlg.h
Normal file
@ -0,0 +1,29 @@
|
||||
//----------------------------------------------------------------------------
|
||||
#ifndef CtrlD_PasswordDlgH
|
||||
#define CtrlD_PasswordDlgH
|
||||
//----------------------------------------------------------------------------
|
||||
#include <Buttons.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include <Graphics.hpp>
|
||||
#include <Classes.hpp>
|
||||
#include <SysUtils.hpp>
|
||||
#include <Windows.hpp>
|
||||
#include <System.hpp>
|
||||
//----------------------------------------------------------------------------
|
||||
class TPasswordDlg : public TForm
|
||||
{
|
||||
__published:
|
||||
TLabel *Label1;
|
||||
TEdit *Password;
|
||||
TButton *OKBtn;
|
||||
TButton *CancelBtn;
|
||||
private:
|
||||
public:
|
||||
virtual __fastcall TPasswordDlg(TComponent* AOwner);
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
extern PACKAGE TPasswordDlg *PasswordDlg;
|
||||
//----------------------------------------------------------------------------
|
||||
#endif
|
857
CtrlDog.cpp
Normal file
@ -0,0 +1,857 @@
|
||||
|
||||
/****************************************\
|
||||
|* */
|
||||
#define ESTOY_PROBANDO
|
||||
// #define SIN_BLOQUEOS
|
||||
/* *|
|
||||
\****************************************/
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "CtrlDog.h"
|
||||
#include "CtrlD_PasswordDlg.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "Phantom"
|
||||
#pragma link "DigitNum"
|
||||
#pragma resource "*.dfm"
|
||||
|
||||
#include <winuser.h>
|
||||
#include <registry.hpp>
|
||||
|
||||
#define RECORDSYSTEM "C:\\WinRCD.log"
|
||||
|
||||
TDog *Dog;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TDog::TDog(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
try {
|
||||
Memo1->Lines->LoadFromFile( RECORDSYSTEM );
|
||||
if ( Memo1->Lines->Count > 400 )
|
||||
{
|
||||
for ( int i=0; i<100; i++ )
|
||||
Memo1->Lines->Delete( 3 );
|
||||
}
|
||||
} catch(...) {
|
||||
Memo1->Lines->Clear();
|
||||
}
|
||||
|
||||
siMinimizar = new TStringList();
|
||||
noMinimizar = new TStringList();
|
||||
snMinimizar = new TStringList();
|
||||
noAbrir = new TStringList();
|
||||
ObtenListaAplicaciones();
|
||||
|
||||
|
||||
AllowClose = false;
|
||||
CanBeDisconect = true;
|
||||
|
||||
Dig1->Value = 0; Dig2->Value = 0;
|
||||
|
||||
TrayMessage(NIM_ADD);
|
||||
TrayMessage(NIM_MODIFY);
|
||||
|
||||
Application->OnMinimize = AppRestore;
|
||||
|
||||
HookAutoStartProgram();
|
||||
|
||||
Top = ( Screen->Height / 2) - (Height / 2 );
|
||||
Left = ( Screen->Width / 2 )- (Width / 2 );
|
||||
iLockSystem( true );
|
||||
|
||||
|
||||
/*
|
||||
typedef struct tagACCEL { // accl
|
||||
BYTE fVirt;
|
||||
WORD key;
|
||||
WORD cmd;
|
||||
} ACCEL;
|
||||
*/
|
||||
/*
|
||||
ACCEL AltTAB;
|
||||
AltTAB.fVirt = FALT;
|
||||
AltTAB.key = VK_TAB;
|
||||
AltTAB.cmd = 0;
|
||||
HACCEL hAltTAB = CreateAcceleratorTable( &AltTAB, 1 );
|
||||
|
||||
*/
|
||||
Tiempo = EncodeTime( 0, 0, 0, 0 );
|
||||
TryClose = false;
|
||||
|
||||
/****/
|
||||
Tiempo = EncodeTime( 0, 0, 30, 0 );
|
||||
SetState(true);
|
||||
/****/
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::DrawItem(TMessage& Msg)
|
||||
{
|
||||
IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam);
|
||||
TForm::Dispatch(&Msg);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::MyNotify(TMessage& Msg)
|
||||
{
|
||||
POINT MousePos;
|
||||
|
||||
switch(Msg.LParam)
|
||||
{
|
||||
case WM_RBUTTONUP:
|
||||
if ( GetCursorPos(&MousePos) )
|
||||
{
|
||||
PopupMenu1->PopupComponent = Dog;
|
||||
SetForegroundWindow(Handle);
|
||||
PopupMenu1->Popup(MousePos.x, MousePos.y);
|
||||
PopupMenu1->PopupComponent = 0;
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONDBLCLK:
|
||||
Height = 126;
|
||||
Visible = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TForm::Dispatch(&Msg);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TDog::TrayMessage(DWORD dwMessage)
|
||||
{
|
||||
NOTIFYICONDATA tnd;
|
||||
PSTR pszTip;
|
||||
|
||||
pszTip = TipText();
|
||||
|
||||
tnd.cbSize = sizeof(NOTIFYICONDATA);
|
||||
tnd.hWnd = Handle;
|
||||
tnd.uID = IDC_MYICON;
|
||||
tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
||||
tnd.uCallbackMessage = MYWM_NOTIFY;
|
||||
|
||||
if (dwMessage == NIM_MODIFY)
|
||||
{
|
||||
tnd.hIcon = IconHandle();
|
||||
if (pszTip)
|
||||
lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip));
|
||||
else
|
||||
tnd.szTip[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
tnd.hIcon = NULL;
|
||||
tnd.szTip[0] = '\0';
|
||||
}
|
||||
|
||||
return (Shell_NotifyIcon(dwMessage, &tnd));
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
HANDLE __fastcall TDog::IconHandle(void)
|
||||
{
|
||||
return Image1 -> Picture->Icon->Handle;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
PSTR __fastcall TDog::TipText(void)
|
||||
{
|
||||
if (Timer1->Enabled)
|
||||
return ("Acceso al sistema premitido");
|
||||
else
|
||||
{
|
||||
Memo1->Lines->Insert( 0, DateTimeToStr(Now()) + " ATACANTE DESCONOCIDO (ACCESO NO AUTORIZADO)" );
|
||||
Memo1->Lines->Insert( 0, DateTimeToStr(Now()) + " -------- ALARMA SILENCIOSA ACTIVADA -------" );
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
return ("SISTEMA PROTEGIDO");
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi)
|
||||
{
|
||||
HICON hIcon;
|
||||
hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(lpdi->CtlID), IMAGE_ICON, 16, 16, 0);
|
||||
if (!hIcon)
|
||||
return(FALSE);
|
||||
|
||||
DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon, 16, 16, 0, NULL, DI_NORMAL);
|
||||
return(TRUE);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::SetState( bool OnOff )
|
||||
{
|
||||
/////////////
|
||||
Memo1->Lines->Insert( 0, "Terminal " + (OnOff ? AnsiString("ON") : AnsiString("OFF") ) );
|
||||
if ( OnOff )
|
||||
{
|
||||
TiempoInicio = TDateTime::CurrentTime();
|
||||
|
||||
Memo1->Lines->Insert( 0, " `------ Durante --> " + Tiempo.TimeString() );
|
||||
unsigned short hour, min, sec, msec;
|
||||
Tiempo.DecodeTime( &hour, &min, &sec, &msec );
|
||||
Timer1->Interval = msec + ( sec + ( (min+2) + hour*60 )*60 )*1000 ;
|
||||
Timer1->Enabled = true;
|
||||
|
||||
Reloj->Enabled = true;
|
||||
Dig1->Value = hour; Dig2->Value = min;
|
||||
SystemLock->Enabled = false;
|
||||
iLockSystem( false );
|
||||
} else {
|
||||
Tiempo = 0;
|
||||
SystemLock->Enabled = true;
|
||||
Timer1->Enabled = false;
|
||||
Reloj->Enabled = false;
|
||||
Dig1->Value = 0; Dig2->Value = 0;
|
||||
iLockSystem( true );
|
||||
}
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::ServerSocketAccept(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
StatusBar1->SimpleText = "Conexión aceptada de " + Socket->RemoteAddress;
|
||||
Memo1->Lines->Insert( 0, StatusBar1->SimpleText );
|
||||
|
||||
int CodOp; double pTiempo;
|
||||
CanBeDisconect = false;
|
||||
|
||||
Socket->ReceiveBuf( &CodOp, sizeof(int) );
|
||||
|
||||
switch( CodOp )
|
||||
{
|
||||
// On / Off
|
||||
case 6669:
|
||||
Socket->ReceiveBuf( &CodOp, sizeof(int) );
|
||||
Socket->ReceiveBuf( &pTiempo, sizeof(double) );
|
||||
Tiempo = pTiempo;
|
||||
SetState( CodOp ? true : false );
|
||||
CodOp = 54321;
|
||||
Socket->SendBuf( &CodOp, sizeof(int) );
|
||||
break;
|
||||
// CERRAR WINDOWS
|
||||
case 6660:
|
||||
Socket->ReceiveBuf( &CodOp, sizeof(int) );
|
||||
Socket->ReceiveBuf( &pTiempo, sizeof(double) );
|
||||
Tiempo = pTiempo;
|
||||
CodOp = 54321;
|
||||
Socket->SendBuf( &CodOp, sizeof(int) );
|
||||
CanBeDisconect = true;
|
||||
Memo1->Lines->Insert( 0, "Recibida petición de CERRAR WINDOWS ::" + Socket->RemoteAddress );
|
||||
CerrarWindows1Click(0);
|
||||
break;
|
||||
// Query TIME
|
||||
case 6661:
|
||||
Memo1->Lines->Insert( 0, "Recibida petición de Tiempo ::" + Socket->RemoteAddress );
|
||||
Socket->SendBuf( &Tiempo, sizeof(double) );
|
||||
// Socket->SendBuf( &TiempoInicio, sizeof(double) );
|
||||
Socket->SendBuf( &(Tiempo - ( TDateTime::CurrentTime() - TiempoInicio )), sizeof(double) );
|
||||
CodOp = 54321;
|
||||
Socket->SendBuf( &CodOp, sizeof(int) );
|
||||
Memo1->Lines->Insert( 0, " -----> Tiempo pedido " + Tiempo );
|
||||
Memo1->Lines->Insert( 0, " -----> Tiempo inicio " + TiempoInicio );
|
||||
Memo1->Lines->Insert( 0, " -----> Servidor " + Socket->RemoteAddress );
|
||||
break;
|
||||
// Actualizar listas
|
||||
case 6662:
|
||||
{
|
||||
int NumApli, i;
|
||||
TRegistry *Registro;
|
||||
char *Buffer;
|
||||
|
||||
Registro = new TRegistry;
|
||||
|
||||
Registro -> OpenKey( "\\Software\\JDsoft\\CtrlMstr", true );
|
||||
|
||||
Memo1->Lines->Insert( 0, "Actualizando Listas ::" + Socket->RemoteAddress );
|
||||
|
||||
Socket->ReceiveBuf( &NumApli, sizeof(int) );
|
||||
Buffer = new char[ 15*NumApli ];
|
||||
Registro -> WriteInteger( "NAppl-sC", NumApli );
|
||||
for ( i=0; i<NumApli; i++ )
|
||||
Socket->ReceiveBuf( (Buffer+15*i), sizeof(char)*15 );
|
||||
Registro -> WriteBinaryData( "LAppl-sC", Buffer, sizeof(char)*15*NumApli+1 );
|
||||
delete Buffer;
|
||||
|
||||
Socket->ReceiveBuf( &NumApli, sizeof(int) );
|
||||
Buffer = new char[ 15*NumApli ];
|
||||
Registro -> WriteInteger( "NAppl-nC", NumApli );
|
||||
for ( i=0; i<NumApli; i++ )
|
||||
Socket->ReceiveBuf( (Buffer+15*i), sizeof(char)*15 );
|
||||
Registro -> WriteBinaryData( "LAppl-nC", Buffer, sizeof(char)*15*NumApli+1 );
|
||||
delete Buffer;
|
||||
|
||||
Socket->ReceiveBuf( &NumApli, sizeof(int) );
|
||||
Buffer = new char[ 15*NumApli ];
|
||||
Registro -> WriteInteger( "NAppl-snC", NumApli );
|
||||
for ( i=0; i<NumApli; i++ )
|
||||
Socket->ReceiveBuf( (Buffer+15*i), sizeof(char)*15 );
|
||||
Registro -> WriteBinaryData( "LAppl-snC", Buffer, sizeof(char)*15*NumApli+1 );
|
||||
delete Buffer;
|
||||
|
||||
Socket->ReceiveBuf( &NumApli, sizeof(int) );
|
||||
Buffer = new char[ 15*NumApli ];
|
||||
Registro -> WriteInteger( "NAppl-nA", NumApli );
|
||||
for ( i=0; i<NumApli; i++ )
|
||||
Socket->ReceiveBuf( (Buffer+15*i), sizeof(char)*15 );
|
||||
Registro -> WriteBinaryData( "LAppl-nA", Buffer, sizeof(char)*15*NumApli+1 );
|
||||
delete Buffer;
|
||||
|
||||
|
||||
delete Registro;
|
||||
}
|
||||
CodOp = 54321;
|
||||
Socket->SendBuf( &CodOp, sizeof(int) );
|
||||
ObtenListaAplicaciones();
|
||||
break;
|
||||
default:
|
||||
Memo1->Lines->Insert( 0, "Mensaje desconocido ::" + Socket->RemoteAddress );
|
||||
CodOp = -1;
|
||||
Socket->SendBuf( &CodOp, sizeof(int) );
|
||||
}
|
||||
Memo1->Lines->Insert( 0, "Tramites Finalizados ::" + Socket->RemoteAddress );
|
||||
StatusBar1->SimpleText = "Escuchando nuevas ordenes...";
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
CanBeDisconect = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::ObtenListaAplicaciones(void)
|
||||
{
|
||||
int i, nListaS, nListaN, nListaSN, nListaA; char *Buffer;
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
|
||||
try {
|
||||
Registro -> OpenKey( "\\Software\\JDsoft\\CtrlMstr", false );
|
||||
|
||||
nListaS = Registro -> ReadInteger( "NAppl-sC" );
|
||||
Buffer = new char [ nListaS*15 + 1 ];
|
||||
Registro -> ReadBinaryData( "LAppl-sC", (void *)Buffer, (sizeof(char)*15*nListaS +1) );
|
||||
|
||||
siMinimizar->Clear();
|
||||
//ShowMessage( AnsiString(nListaS) );
|
||||
for ( i=0; i < nListaS; i++ )
|
||||
//{
|
||||
siMinimizar->Add( AnsiString( (char *)(Buffer+i*15) ) );
|
||||
//Memo1->Lines->Insert( 0, AnsiString( (char *)(Buffer+i*15) ) );
|
||||
//}
|
||||
delete Buffer;
|
||||
|
||||
nListaN = Registro -> ReadInteger( "NAppl-nC" );
|
||||
Buffer = new char [ nListaN*15 ];
|
||||
Registro -> ReadBinaryData( "LAppl-nC", (void *)Buffer, (sizeof(char)*15*nListaN +1) );
|
||||
|
||||
noMinimizar->Clear();
|
||||
for ( i=0; i < nListaN; i++ )
|
||||
//{
|
||||
noMinimizar->Add( AnsiString( (char *)(Buffer+i*15) ) );
|
||||
//Memo1->Lines->Insert( 0, (Buffer+i*15) );
|
||||
//}
|
||||
delete Buffer;
|
||||
|
||||
nListaSN = Registro -> ReadInteger( "NAppl-snC" );
|
||||
Buffer = new char [ nListaSN*15 ];
|
||||
Registro -> ReadBinaryData( "LAppl-snC", (void *)Buffer, (sizeof(char)*15*nListaSN +1) );
|
||||
noMinimizar->Clear();
|
||||
for ( i=0; i < nListaSN; i++ )
|
||||
snMinimizar->Add( AnsiString( (char *)(Buffer+i*15) ) );
|
||||
delete Buffer;
|
||||
|
||||
nListaA = Registro -> ReadInteger( "NAppl-nA" );
|
||||
Buffer = new char [ nListaA*15 ];
|
||||
Registro -> ReadBinaryData( "LAppl-nA", (void *)Buffer, (sizeof(char)*15*nListaA +1) );
|
||||
noAbrir->Clear();
|
||||
for ( i=0; i < nListaA; i++ )
|
||||
noAbrir->Add( AnsiString( (char *)(Buffer+i*15) ) );
|
||||
delete Buffer;
|
||||
|
||||
} catch(...) {
|
||||
// nothing
|
||||
}
|
||||
Memo1->Lines->Insert( 0, Format( "Listas Cargadas: %02dS::%02dN", ARRAYOFCONST( ( siMinimizar->Count, noMinimizar->Count ) ) ) );
|
||||
Memo1->Lines->Insert( 0, Format( "Listas Cargadas: %02dC::%02dA", ARRAYOFCONST( ( snMinimizar->Count, noAbrir->Count ) ) ) );
|
||||
|
||||
delete Registro;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::ServerSocketClientConnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
StatusBar1->SimpleText = "Cliente Conectado ";
|
||||
Memo1->Lines->Insert( 0, "Cliente Conectado " );
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::ServerSocketClientDisconnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
if ( ! CanBeDisconect )
|
||||
Memo1->Lines->Insert( 0, "DESCONEXION FORZADA ::" + Socket->LocalAddress );
|
||||
else
|
||||
Memo1->Lines->Insert( 0, "Desconexión en regla ::" );
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::ServerSocketClientError(TObject *Sender,
|
||||
TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode)
|
||||
{
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Cliente ¡ ERROR ! " + AnsiString( ErrorCode ) + "::" + Socket->LocalAddress );
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::ServerSocketGetSocket(TObject *Sender, int Socket,
|
||||
TServerClientWinSocket *&ClientSocket)
|
||||
{
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Obtuvimos un socket" );
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::ServerSocketListen(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " /----->" + Socket->RemoteAddress );
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Estoy escuchando ::" + Socket->LocalAddress );
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::FormClose(TObject *Sender, TCloseAction &Action)
|
||||
{
|
||||
ServerSocket->Active = false;
|
||||
if ( AllowClose )
|
||||
{
|
||||
delete siMinimizar;
|
||||
delete noMinimizar;
|
||||
delete snMinimizar;
|
||||
delete noAbrir;
|
||||
} else {
|
||||
#ifndef ESTOY_PROBANDO
|
||||
iLockSystem( true );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::Timer1Timer(TObject *Sender)
|
||||
{
|
||||
SetState( false );
|
||||
StatusBar1->SimpleText = "Sistema OFF --FORZADO--";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::FormCloseQuery(TObject *Sender, bool &CanClose)
|
||||
{
|
||||
Visible = false;
|
||||
#ifndef ESTOY_PROBANDO
|
||||
CanClose = AllowClose;
|
||||
#else
|
||||
iLockSystem( false );
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::FormShow(TObject *Sender)
|
||||
{
|
||||
if ( Timer1->Enabled )
|
||||
{
|
||||
Reloj->Enabled=true;
|
||||
RelojTimer(0);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TDog::RelojTimer(TObject *Sender)
|
||||
{
|
||||
// Actualizamos el tiempo que queda...
|
||||
unsigned short hour, min, sec, msec;
|
||||
|
||||
(Tiempo - ( TDateTime::CurrentTime() - TiempoInicio )).DecodeTime( &hour, &min, &sec, &msec );
|
||||
|
||||
Dig1->Value = hour;
|
||||
Dig2->Value = min;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::Label1DblClick(TObject *Sender)
|
||||
{
|
||||
if ( Height == 354 ) Height = 126; else Height = 354;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TDog::Tiemporestante1Click(TObject *Sender)
|
||||
{
|
||||
Visible = true;
|
||||
Height = 126;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::Status1Click(TObject *Sender)
|
||||
{
|
||||
Visible = true;
|
||||
Height = 354;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::CerrarWindows1Click(TObject *Sender)
|
||||
{
|
||||
// Shut down the system and force all applications to close.
|
||||
AllowClose = true;
|
||||
HookAutoStartProgram();
|
||||
#ifndef SIN_BLOQUEOS
|
||||
if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE | EWX_POWEROFF, 0))
|
||||
#endif
|
||||
{
|
||||
AllowClose = false;
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " Error durante el cierre" );
|
||||
Memo1->Lines->SaveToFile( RECORDSYSTEM );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::FormDestroy(TObject *Sender)
|
||||
{
|
||||
HookAutoStartProgram();
|
||||
TrayMessage(NIM_DELETE);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::HookAutoStartProgram(void)
|
||||
{
|
||||
#ifndef SIN_BLOQUEOS
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
|
||||
try {
|
||||
Registro -> OpenKey( "\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", true );
|
||||
Registro -> WriteString( "WinPowerManager", Application->ExeName );
|
||||
} catch(...) {
|
||||
// Do nothing...
|
||||
}
|
||||
|
||||
delete Registro;
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool MultimediaActive;
|
||||
bool GetStyle( HWND hdl )
|
||||
{
|
||||
long style;
|
||||
bool dev;
|
||||
|
||||
dev = false;
|
||||
|
||||
style = GetWindowLong(hdl,GWL_STYLE);
|
||||
if(( style & WS_POPUP) == WS_POPUP)
|
||||
{
|
||||
if(((style & WS_GROUP) == WS_GROUP) && !
|
||||
((style & WS_DISABLED) == WS_DISABLED) &&
|
||||
((style & WS_SYSMENU) == WS_SYSMENU))
|
||||
dev = true;
|
||||
} else {
|
||||
dev = true;
|
||||
}
|
||||
|
||||
return dev;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
BOOL __stdcall MinimizeAllAplications( HWND hwnd, LPARAM lParam )
|
||||
{
|
||||
bool dev; int i;
|
||||
char lpString[50];
|
||||
AnsiString Text;
|
||||
|
||||
dev = true;
|
||||
if ( hwnd != 0 )
|
||||
{
|
||||
GetWindowText( hwnd, lpString, 40 );
|
||||
Text = AnsiString( lpString );
|
||||
|
||||
|
||||
|
||||
// Aplicaciones especiales que he de minimizar constantemente...
|
||||
if ( Text.Pos("Episode I Racer" ) ||
|
||||
Text.Pos("Quake" )
|
||||
)
|
||||
{
|
||||
ShowWindow( hwnd, SW_MINIMIZE );
|
||||
return dev;
|
||||
}
|
||||
|
||||
// LISTA DINAMICA DE VENTANAS A MINIMIZAR
|
||||
for ( i=0; i < siMinimizar->Count; i++ )
|
||||
if ( Text.Pos( siMinimizar->Strings[i] ) )
|
||||
{
|
||||
ShowWindow( hwnd, SW_MINIMIZE );
|
||||
return dev;
|
||||
}
|
||||
|
||||
// Solo Ventanas visibles...
|
||||
if ( IsWindowVisible( hwnd ) )
|
||||
{
|
||||
// ...y ademas ventanas PADRES
|
||||
if ( GetWindow( hwnd, GW_OWNER) == 0 )
|
||||
{
|
||||
if ( ! GetStyle( hwnd ) )
|
||||
{
|
||||
if ( IsWindow( GetLastActivePopup( hwnd ) ) )
|
||||
{
|
||||
auto HWND hwPop;
|
||||
hwPop = GetLastActivePopup( hwnd );
|
||||
if ( !GetStyle(hwPop) ) return true;
|
||||
} else return true;
|
||||
}
|
||||
|
||||
// LA VENTANA ES TIPO -TASK-BAR- y ADEMAS ES VISIBLE
|
||||
|
||||
// Ventanas ante las cuales me oculto
|
||||
if ( Text.Pos("Reproductor mul") != 0 ||
|
||||
Text.Pos("Informática DJ")
|
||||
)
|
||||
{
|
||||
MultimediaActive = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// LISTA DINAMICA DE VENTANAS A RESPETAR
|
||||
for ( i=0; i < noMinimizar->Count; i++ )
|
||||
if ( Text.Pos( noMinimizar->Strings[i] ) )
|
||||
{
|
||||
MultimediaActive = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ventanas que no he de minimizar (PERO QUEDO DE PRIMER PLANO)
|
||||
if ( ! ( Text.Pos("Sistema de Control") ||
|
||||
Text.Pos("Creditos ocultos")
|
||||
)
|
||||
)
|
||||
{
|
||||
ShowWindow( hwnd, SW_MINIMIZE );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dev = false;
|
||||
}
|
||||
|
||||
return dev;
|
||||
};
|
||||
|
||||
/*
|
||||
procedure TForm1.TerminateProcess1Click(Sender: TObject);
|
||||
const
|
||||
PROCESS_TERMINATE = 1;
|
||||
var
|
||||
ProcHandle: THandle;
|
||||
begin
|
||||
if (ListBox1.Items.count < 1) OR (ListBox1.ItemIndex < 0) then exit;
|
||||
if (MessageDlg('Process: --> ' + ListBox1.Items[ListBox1.itemIndex]+ #10#13#10#13+
|
||||
'TerminateProcess may lead the system into an instable state! '+#10#13+
|
||||
'You should use this function only if you are sure about doing so.'+#10#13+
|
||||
'Are You sure?', mtConfirmation, [mbYes, mbNo], 0) = mrYes)
|
||||
then begin
|
||||
ProcHandle := OpenProcess(PROCESS_TERMINATE, FALSE, DWORD(WinList1.GetProcessID(ListBox1.ItemIndex)));
|
||||
try
|
||||
if ProcHandle <> 0 then begin
|
||||
if TerminateProcess(ProcHandle, $FFFFFFFF) then
|
||||
WaitForSingleObject(ProcHandle, INFINITE);
|
||||
end else
|
||||
MessageDlg('Can not find the handle of the selected prozess!', mtError, [mbOK], 0);
|
||||
finally
|
||||
CloseHandle(ProcHandle);
|
||||
end;
|
||||
Refresh1Click(Sender);
|
||||
end;
|
||||
end;
|
||||
*/
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/*
|
||||
BOOL __stdcall MyEnumDesktopProc( LPTSTR lpszDesktop, LPARAM lParam )
|
||||
{
|
||||
EnumDesktopWindows( lpszDesktop, ( WNDENUMPROC )MinimizeAllAplications, 0 );
|
||||
return true;
|
||||
};
|
||||
*/
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::SystemLockTimer(TObject *Sender)
|
||||
{
|
||||
#ifndef SIN_BLOQUEOS
|
||||
MultimediaActive = false;
|
||||
|
||||
EnumWindows( ( WNDENUMPROC )MinimizeAllAplications, 0 );
|
||||
|
||||
if ( MultimediaActive || TryClose )
|
||||
{
|
||||
Visible = false;
|
||||
} else {
|
||||
|
||||
|
||||
Top = ( Screen->Height / 2) - (Height / 2 );
|
||||
Left = ( Screen->Width / 2 )- (Width / 2 );
|
||||
|
||||
if ( !Visible )Show();
|
||||
// ShowWindow(this->Handle,SW_RESTORE);
|
||||
SetForegroundWindow(this->Handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
iLockSystem( true );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::AppRestore(TObject *Sender)
|
||||
{
|
||||
Application->Restore();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::Shape2MouseDown(TObject *Sender,
|
||||
TMouseButton Button, TShiftState Shift, int X, int Y)
|
||||
{
|
||||
if ( Shift.Contains(ssShift) && Shift.Contains(ssAlt) &&
|
||||
Shift.Contains(ssCtrl) && Shift.Contains(ssDouble) )
|
||||
{
|
||||
TryClose = true;
|
||||
|
||||
TPasswordDlg *PasswordDlg;
|
||||
PasswordDlg = new TPasswordDlg(this);
|
||||
PasswordDlg->Password->Clear();
|
||||
PasswordDlg -> ShowModal();
|
||||
if ( PasswordDlg->Password->Text == "44959229170877" )
|
||||
// if ( InputBox( "Creditos ocultos", "Donde estan:", "los creditos ocultos" ) == "44959229" )
|
||||
{
|
||||
TryClose = false;
|
||||
AllowClose=true;
|
||||
iLockSystem( false );
|
||||
Close();
|
||||
}
|
||||
delete PasswordDlg;
|
||||
TryClose = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::FormResize(TObject *Sender)
|
||||
{
|
||||
Top = ( Screen->Height / 2) - (Height / 2 );
|
||||
Left = ( Screen->Width / 2 )- (Width / 2 );
|
||||
#ifndef SIN_BLOQUEOS
|
||||
if ( SystemLock->Enabled )
|
||||
{
|
||||
iLockSystem( true );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::iLockSystem( bool status )
|
||||
{
|
||||
#ifdef SIN_BLOQUEOS
|
||||
status = false;
|
||||
#endif
|
||||
if ( ! status ) // LIBRE DE BLOQUEOS
|
||||
{
|
||||
ClipCursor( NULL );
|
||||
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, NULL,0);
|
||||
// BorderIcons = (TBorderIcons()<< biSystemMenu);
|
||||
} else { // INICIANDO BLOQUEOS
|
||||
RECT ClipRect = { Left+2, Top+25, Left+Width-2, Top+120-20 };
|
||||
ClipCursor( &ClipRect );
|
||||
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1,NULL, 0);
|
||||
// BorderIcons = BorderIcons - (TBorderIcons()<< biSystemMenu);
|
||||
}
|
||||
#define iTRAYBAR 0
|
||||
#define iTRAYNOTIFY 1
|
||||
#define iSTARTBUTTON 2
|
||||
#define iAPPSWITCHBAR 3
|
||||
#define iTRAYCLOCK 4
|
||||
#define iDESKTOPICONS 5
|
||||
|
||||
|
||||
HideOpt( iTRAYBAR, status );
|
||||
HideOpt( iTRAYNOTIFY, status );
|
||||
HideOpt( iSTARTBUTTON, status );
|
||||
HideOpt( iAPPSWITCHBAR, status );
|
||||
HideOpt( iTRAYCLOCK, status );
|
||||
HideOpt( iDESKTOPICONS, status );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDog::HideOpt( int Option, bool Hide )
|
||||
{
|
||||
HWND Wnd;
|
||||
|
||||
switch( Option )
|
||||
{
|
||||
case iTRAYBAR :
|
||||
Wnd = FindWindow("Shell_TrayWnd", NULL);
|
||||
break;
|
||||
case iTRAYNOTIFY :
|
||||
Wnd = FindWindow("Shell_TrayWnd", NULL);
|
||||
Wnd = FindWindowEx(Wnd, HWND(0), "TrayNotifyWnd", NULL);
|
||||
break;
|
||||
case iSTARTBUTTON :
|
||||
Wnd = FindWindow("Shell_TrayWnd", NULL);
|
||||
Wnd = FindWindowEx(Wnd, HWND(0), "Button", NULL);
|
||||
break;
|
||||
case iAPPSWITCHBAR :
|
||||
Wnd = FindWindow("Shell_TrayWnd", NULL);
|
||||
Wnd = FindWindowEx(Wnd, HWND(0), "ReBarWindow32", NULL);
|
||||
break;
|
||||
case iTRAYCLOCK :
|
||||
Wnd = FindWindow("Shell_TrayWnd", NULL);
|
||||
Wnd = FindWindowEx(Wnd, HWND(0), "TrayNotifyWnd", NULL);
|
||||
Wnd = FindWindowEx(Wnd, HWND(0), "TrayClockWClass", NULL);
|
||||
break;
|
||||
case iDESKTOPICONS :
|
||||
Wnd = FindWindow("Progman", NULL);
|
||||
Wnd = FindWindowEx(Wnd, HWND(0), "ShellDll_DefView", NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( Wnd != 0 )
|
||||
{
|
||||
if ( Hide )
|
||||
ShowWindow(Wnd, SW_HIDE);
|
||||
else
|
||||
ShowWindow(Wnd, SW_SHOW);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
void __fastcall TDog::Shape1MouseUp(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y)
|
||||
{
|
||||
#ifdef ESTOY_PROBANDO
|
||||
static bool Rotate = true;
|
||||
Tiempo = EncodeTime( 0, 1, 0, 0 );
|
||||
if ( Rotate )
|
||||
SetState( true );
|
||||
else
|
||||
SetState( false );
|
||||
Rotate = !Rotate;
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDog::FormClick(TObject *Sender)
|
||||
{
|
||||
if ( !SystemLock->Enabled )
|
||||
Visible = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TDog::Label2Click(TObject *Sender)
|
||||
{
|
||||
char zFileName[80], zParams[80], zDir[80];
|
||||
if ( !SystemLock->Enabled )
|
||||
ShellExecute(Application->MainForm->Handle, 0, StrPCopy(zFileName, "http:\\\\www.infdj.com"),
|
||||
StrPCopy(zParams, ""), StrPCopy(zDir, ""), SW_SHOWNOACTIVATE > 32);
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
BIN
CtrlDog.dfm
Normal file
124
CtrlDog.h
Normal file
@ -0,0 +1,124 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef CtrlDogH
|
||||
#define CtrlDogH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include <ComCtrls.hpp>
|
||||
#include <ScktComp.hpp>
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Menus.hpp>
|
||||
#include "Phantom.hpp"
|
||||
#include "DigitNum.h"
|
||||
#include <Graphics.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
#define MYWM_NOTIFY (WM_APP+100)
|
||||
#define IDC_MYICON 1006
|
||||
extern HINSTANCE g_hinst;
|
||||
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi);
|
||||
//---------------------------------------------------------------------------
|
||||
class TDog : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TMemo *Memo1;
|
||||
TStatusBar *StatusBar1;
|
||||
TServerSocket *ServerSocket;
|
||||
TTimer *Timer1;
|
||||
TTimer *Reloj;
|
||||
TDigitNum *Dig1;
|
||||
TShape *Shape2;
|
||||
TShape *Shape1;
|
||||
TDigitNum *Dig2;
|
||||
TImage *Image1;
|
||||
TBevel *Bevel1;
|
||||
TBevel *Bevel2;
|
||||
TBevel *Bevel3;
|
||||
TBevel *Bevel4;
|
||||
TLabel *Label1;
|
||||
TLabel *Label2;
|
||||
TPopupMenu *PopupMenu1;
|
||||
TMenuItem *Tiemporestante1;
|
||||
TMenuItem *Status1;
|
||||
TMenuItem *CerrarWindows1;
|
||||
TMenuItem *N1;
|
||||
TTimer *SystemLock;
|
||||
TPhantom *Phantom1;
|
||||
void __fastcall ServerSocketAccept(TObject *Sender,
|
||||
TCustomWinSocket *Socket);
|
||||
void __fastcall ServerSocketClientConnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket);
|
||||
|
||||
void __fastcall ServerSocketClientDisconnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket);
|
||||
void __fastcall ServerSocketClientError(TObject *Sender,
|
||||
TCustomWinSocket *Socket, TErrorEvent ErrorEvent,
|
||||
int &ErrorCode);
|
||||
void __fastcall ServerSocketGetSocket(TObject *Sender, int Socket,
|
||||
TServerClientWinSocket *&ClientSocket);
|
||||
void __fastcall ServerSocketListen(TObject *Sender,
|
||||
TCustomWinSocket *Socket);
|
||||
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||
void __fastcall Timer1Timer(TObject *Sender);
|
||||
void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
|
||||
void __fastcall FormShow(TObject *Sender);
|
||||
|
||||
void __fastcall RelojTimer(TObject *Sender);
|
||||
void __fastcall Label1DblClick(TObject *Sender);
|
||||
|
||||
void __fastcall Tiemporestante1Click(TObject *Sender);
|
||||
void __fastcall Status1Click(TObject *Sender);
|
||||
void __fastcall CerrarWindows1Click(TObject *Sender);
|
||||
void __fastcall FormDestroy(TObject *Sender);
|
||||
|
||||
void __fastcall SystemLockTimer(TObject *Sender);
|
||||
|
||||
void __fastcall Shape2MouseDown(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y);
|
||||
|
||||
|
||||
|
||||
void __fastcall FormResize(TObject *Sender);
|
||||
void __fastcall Shape1MouseUp(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y);
|
||||
void __fastcall FormClick(TObject *Sender);
|
||||
|
||||
void __fastcall Label2Click(TObject *Sender);
|
||||
private: // User declarations
|
||||
TDateTime Tiempo, TiempoInicio;
|
||||
bool AllowClose;
|
||||
void __fastcall SetState( bool OnOff );
|
||||
|
||||
void __fastcall DrawItem(TMessage& Msg);
|
||||
void __fastcall MyNotify(TMessage& Msg);
|
||||
bool __fastcall TrayMessage(DWORD dwMessage);
|
||||
void __fastcall ObtenListaAplicaciones(void);
|
||||
|
||||
HANDLE __fastcall IconHandle(void);
|
||||
PSTR __fastcall TipText(void);
|
||||
|
||||
void __fastcall HookAutoStartProgram(void);
|
||||
void __fastcall iLockSystem( bool status );
|
||||
|
||||
void __fastcall HideOpt( int Option, bool Hide );
|
||||
|
||||
public: // User declarations
|
||||
void __fastcall AppRestore(TObject *Sender);
|
||||
bool CanBeDisconect;
|
||||
__fastcall TDog(TComponent* Owner);
|
||||
bool TryClose;
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem)
|
||||
MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
TStringList *siMinimizar, *noMinimizar, *snMinimizar, *noAbrir;
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TDog *Dog;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
129
CtrlDogs.bpr
Normal file
@ -0,0 +1,129 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.05.03"/>
|
||||
<PROJECT value="CtrlDogs.exe"/>
|
||||
<OBJFILES value="CtrlDogs.obj CtrlDog.obj CtrlD_PasswordDlg.obj"/>
|
||||
<RESFILES value="CtrlDogs.res"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES) CtrlDog.dfm CtrlD_PasswordDlg.dfm"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value="PhantomPack.lib JDsoft.lib inet50.lib qrpt50.lib vcldbx50.lib vclbde50.lib
|
||||
vcldb50.lib vclx50.lib vcl50.lib"/>
|
||||
<SPARELIBS value="vcl50.lib vclx50.lib vcldb50.lib vclbde50.lib vcldbx50.lib qrpt50.lib
|
||||
inet50.lib JDsoft.lib PhantomPack.lib"/>
|
||||
<PACKAGES value="vclx50.bpi vcl50.bpi vcldb50.bpi vclbde50.bpi vcldbx50.bpi bcbsmp50.bpi
|
||||
dclocx50.bpi qrpt50.bpi teeui50.bpi teedb50.bpi tee50.bpi ibsmp50.bpi
|
||||
nmfast50.bpi inetdb50.bpi inet50.bpi JD_soft.bpi"/>
|
||||
<PATHCPP value=".;"/>
|
||||
<PATHPAS value=".;"/>
|
||||
<PATHRC value=".;"/>
|
||||
<PATHASM value=".;"/>
|
||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
||||
<LINKER value="ilink32"/>
|
||||
<USERDEFINES value=""/>
|
||||
<SYSDEFINES value="NO_STRICT"/>
|
||||
<MAINSOURCE value="CtrlDogs.cpp"/>
|
||||
<INCLUDEPATH value="$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include"/>
|
||||
<LIBPATH value="..\VCLs\lib;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib"/>
|
||||
<WARNINGS value="-w-par -w-8027 -w-8026"/>
|
||||
<WARNOPTSTR value=""/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-I$(BCB)\bin -I$(BCB)\objrepos -I$(BCB)\projects -I$(BCB)\include
|
||||
-I$(BCB)\include\vcl -I..\VCLs\include -src_suffix cpp -boa"/>
|
||||
<CFLAG1 value="-O2 -H=c:\PROGRAM\CBUILDER\CBUILD~1\lib\vcld.csm -Hc -Vx -Ve -X- -a8 -b-
|
||||
-k- -vi -c -tWM"/>
|
||||
<CFLAG2 value=""/>
|
||||
<CFLAG3 value=""/>
|
||||
<PFLAGS value="-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE
|
||||
-$YD -$L- -$D- -v -JPHNV -M -JPHNE"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zn"/>
|
||||
<LFLAGS value="-D"" -aa -Tpe -x"/>
|
||||
<IFLAGS value=""/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
|
||||
</LINKER>
|
||||
<IDEOPTIONS>
|
||||
[Version Info]
|
||||
IncludeVerInfo=1
|
||||
AutoIncBuild=1
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=70
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=JD soft.
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.70
|
||||
InternalName=
|
||||
LegalCopyright=Copyright (C) JD soft. 1990-1999
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=e-mail: Jose-David.Guillen@cs.us.es
|
||||
|
||||
[HistoryLists\hlIncludePath]
|
||||
Count=5
|
||||
Item0=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include
|
||||
Item1=..\jd soft\digitnum;..\componentes\cdopping\coolform;l:\programación (-cbuilder-)\jd soft;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;L:\Programación (-CBuilder-)\Componentes\CDopping;L:\Programación (-CBuilder-)\Componentes;D:\JDsoft\PrjTPVwin\VCLs\include
|
||||
Item2=..\jd soft\digitnum;..\componentes\cdopping\coolform;l:\programación (-cbuilder-)\jd soft;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;L:\Programación (-CBuilder-)\Componentes\CDopping;L:\Programación (-CBuilder-)\Componentes
|
||||
Item3=..\jd soft\digitnum;..\componentes\cdopping\coolform;l:\programación (-cbuilder-)\jd soft;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
|
||||
Item4=..\jd soft\jd;l:\programación (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
|
||||
|
||||
[HistoryLists\hlLibraryPath]
|
||||
Count=6
|
||||
Item0=..\VCLs\lib;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item1=..\VCLs\lib;..\jd soft\actimg;..\jd soft;..\jd soft\jd\actimg;..\componentes;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;D:\JDsoft\PrjTPVwin\VCLs\lib
|
||||
Item2=..\jd soft\actimg;..\jd soft;..\jd soft\jd\actimg;..\componentes;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;D:\JDsoft\PrjTPVwin\VCLs\lib
|
||||
Item3=..\jd soft\actimg;..\jd soft;..\jd soft\jd\actimg;..\componentes;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item4=..\componentes;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item5=..\jd soft\jd;l:\programación (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
|
||||
[HistoryLists\hlUnitAliases]
|
||||
Count=1
|
||||
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
RemoteDebug=0
|
||||
|
||||
[Compiler]
|
||||
ShowInfoMsgs=1
|
||||
LinkDebugVcl=0
|
||||
LinkCGLIB=0
|
||||
|
||||
[CORBA]
|
||||
AddServerUnit=1
|
||||
AddClientUnit=1
|
||||
PrecompiledHeaders=1
|
||||
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
</IDEOPTIONS>
|
||||
</PROJECT>
|
45
CtrlDogs.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#include <winuser.h>
|
||||
#include <winbase.h>
|
||||
|
||||
#pragma hdrstop
|
||||
USERES("CtrlDogs.res");
|
||||
USEFORM("CtrlDog.cpp", Dog);
|
||||
USEFORM("CtrlD_PasswordDlg.cpp", PasswordDlg);
|
||||
//---------------------------------------------------------------------------
|
||||
HINSTANCE g_hinst;
|
||||
//extern "C" __declspec(dllimport) int _stdcall RegisterServiceProcess( DWORD dwProcessID, int dwType);
|
||||
//function RegisterServiceProcess(dwProcessID, dwType: integer): integer; stdcall; external 'KERNEL32.DLL';
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
WINAPI WinMain(HINSTANCE, HINSTANCE hInstance, LPSTR, int)
|
||||
{
|
||||
AnsiString FsMutex = DateToStr(TDateTime::CurrentDate()) + AnsiString("-mutex-dog");
|
||||
|
||||
// RegisterServiceProcess(GetCurrentProcessID(), 1); // Hide Aplication
|
||||
// SetWindowLong(Application->Handle, GWL_EXSTYLE, XWndLong | WS_EX_TOOLWINDOW & ! WS_EX_APPWINDOW | WS_EX_TOPMOST);
|
||||
|
||||
HANDLE FhMutex = OpenMutex(MUTEX_ALL_ACCESS,False, FsMutex.c_str() );
|
||||
if ( FhMutex == 0 ) //it's a first instance
|
||||
{
|
||||
FhMutex = CreateMutex(NULL,false, FsMutex.c_str() );
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
g_hinst = hInstance;
|
||||
Application->Title = "Sistema de Control";
|
||||
Application->CreateForm(__classid(TDog), &Dog);
|
||||
Application->ShowMainForm = false;
|
||||
Application->Run();
|
||||
}
|
||||
catch (Exception &exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
} else {
|
||||
if ( CloseHandle(FhMutex) ) FhMutex = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
CtrlDogs.exe
Normal file
BIN
CtrlDogs.res
Normal file
445
CtrlElemento.cpp
Normal file
@ -0,0 +1,445 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
#include "CtrlPPal.h"
|
||||
#include "CtrlSocket.h"
|
||||
#include "CtrlElemento.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
#define Blinking 600
|
||||
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TElemento::TElemento(TComponent* Owner)
|
||||
: TImage(Owner)
|
||||
{
|
||||
NumElemento = 0;
|
||||
myIP="0.0.0.0";
|
||||
|
||||
SurfaceIs = sfNone;
|
||||
|
||||
BlinkCode = IP_OFF; // Intentando conectar con el TERMINAL
|
||||
StatusCode= ERROR; // ERROR, aun no hemos conseguido conectar...
|
||||
|
||||
Blink = new TTimer(this); // Establecemos el timer, que mostrará las advertencias
|
||||
Blink->OnTimer = OnBlink; // visuales de estado del componente.
|
||||
Blink->Interval = Blinking; // Inicialmente activo, con la advertencia IP_QUERY
|
||||
Blink->Enabled = true;
|
||||
|
||||
Revisor = new TTimer(this); // Este timer, se encargará de comunicar el estado OFF
|
||||
Revisor->OnTimer = OnRevisor; // al TERMINAL-DOG, cuando proceda. ( Finalizado su tiempo ).
|
||||
Revisor->Interval = 0;
|
||||
Revisor->Enabled = false;
|
||||
PideMasTiempo = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TElemento::~TElemento()
|
||||
{
|
||||
delete Blink;
|
||||
delete Revisor;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::SetElemento( int Elemento, AnsiString IP, AnsiString Name )
|
||||
{
|
||||
if ( ! IP.IsEmpty() && IP.Length() >= 7 )
|
||||
myIP = IP;
|
||||
NumElemento = Elemento;
|
||||
myName = Name;
|
||||
if ( !CtrlPPal->ServerHook )
|
||||
RefreshElement();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::RefreshElement(void)
|
||||
{
|
||||
BlinkCode = IP_QUERY;
|
||||
StatusCode = ERROR;
|
||||
// Blink->Enabled = true;
|
||||
Blink->Interval = Blinking;
|
||||
|
||||
//////// Vemos si el terminal esta activo ///////////////////////////////////
|
||||
ThreadSocket *MySocket;
|
||||
MySocket = (ThreadSocket *)CtrlPPal->GetThread();
|
||||
MySocket->SetSocket( myIP, 5432 );
|
||||
MySocket->OWNER_Element = this;
|
||||
MySocket->CtrlCOP = QueryTIME;
|
||||
MySocket->CtrlTiempo = TDateTime::CurrentTime();
|
||||
MySocket->Resume();
|
||||
//////// ///////////////////////////////////
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::HistoricoTermON( TDateTime CtrlTiempo )
|
||||
{
|
||||
bool UsaBono = (Precio == -1);
|
||||
if ( UsaBono ) Precio = 0;
|
||||
if ( PideMasTiempo )
|
||||
{
|
||||
ImporteAcumulado += Precio;
|
||||
if ( CtrlTiempo > TiempoPedido ) CtrlTiempo = TiempoPedido;
|
||||
} else {
|
||||
ImporteAcumulado = Precio;
|
||||
}
|
||||
|
||||
// Insertamos en el historial de usos, la activación del terminal...
|
||||
CtrlPPal->TbHistorial -> InsertRecord( ARRAYOFCONST(( NumElemento,
|
||||
(Variant)TiempoComienzo,
|
||||
(Variant)CtrlTiempo, idc, idtc, Precio )) );
|
||||
CtrlPPal->TbHistorial -> FlushBuffers();
|
||||
// Descontamos al cliente su tiempo del bono...
|
||||
if ( UsaBono )
|
||||
{
|
||||
TBookmark SavePlace;
|
||||
// get a bookmark so that we can return to the same record
|
||||
SavePlace = CtrlPPal->TbPersonas->GetBookmark();
|
||||
|
||||
if ( CtrlPPal->TbPersonas->Locate( "CodCliente1", idc, TLocateOptions() << loCaseInsensitive) )
|
||||
{
|
||||
unsigned short Hour, Min, Sec, MSec;
|
||||
CtrlTiempo.DecodeTime( &Hour, &Min, &Sec, &MSec );
|
||||
|
||||
NCliente = CtrlPPal->TbPersonas->FieldByName("Nombre")->AsString + " " + CtrlPPal->TbPersonas->FieldByName("Apellidos")->AsString;
|
||||
CtrlPPal->TbPersonas->Edit();
|
||||
if ( CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger < Min )
|
||||
{
|
||||
CtrlPPal->TbPersonas->FieldByName("TiempoH")->AsInteger = CtrlPPal->TbPersonas->FieldByName("TiempoH")->AsInteger - Hour -1;
|
||||
CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger = (CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger +60 - Min);
|
||||
} else {
|
||||
CtrlPPal->TbPersonas->FieldByName("TiempoH")->AsInteger = CtrlPPal->TbPersonas->FieldByName("TiempoH")->AsInteger - Hour;
|
||||
CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger = CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger - Min;
|
||||
}
|
||||
|
||||
CtrlPPal->TbPersonas->FieldByName("FModif")->AsDateTime = TDateTime::CurrentDateTime();
|
||||
CtrlPPal->TbPersonas->Post();
|
||||
CtrlPPal->TbPersonas->FlushBuffers();
|
||||
} else {
|
||||
NCliente = "## No ENCONTRADO ##";
|
||||
}
|
||||
// Move back to the bookmark
|
||||
CtrlPPal->TbPersonas->GotoBookmark(SavePlace);
|
||||
CtrlPPal->TbPersonas->FreeBookmark(SavePlace);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::SetActiveTime( TDateTime Tiempo, int L_idc, int L_idtc, Currency L_Precio )
|
||||
{
|
||||
idc = L_idc; idtc = L_idtc; Precio = L_Precio;
|
||||
TDateTime Queda = TiempoRestante();
|
||||
BlinkCode = IP_QUERY;
|
||||
StatusCode = ERROR;
|
||||
// Blink->Enabled = true;
|
||||
Blink->Interval = Blinking;
|
||||
|
||||
if ( Revisor->Enabled )
|
||||
{
|
||||
PideMasTiempo = true;
|
||||
Revisor->Enabled = false;
|
||||
TiempoComienzo = TDateTime::CurrentDateTime() + Queda;
|
||||
} else {
|
||||
PideMasTiempo = false;
|
||||
TiempoComienzo = TDateTime::CurrentDateTime();
|
||||
}
|
||||
TiempoPedido = Tiempo;
|
||||
|
||||
ThreadSocket *MySocket;
|
||||
MySocket = (ThreadSocket *)CtrlPPal->GetThread();
|
||||
MySocket->SetSocket( myIP, 5432 );
|
||||
MySocket->CtrlCOP = SettingSTATUS;
|
||||
MySocket->OWNER_Element = this;
|
||||
if ( PideMasTiempo )
|
||||
MySocket->CtrlTiempo = TiempoPedido + Queda;
|
||||
else
|
||||
MySocket->CtrlTiempo = TiempoPedido;
|
||||
MySocket->CtrlState = true;
|
||||
MySocket->Resume();
|
||||
|
||||
unsigned short hour, min, sec, msec;
|
||||
if ( PideMasTiempo ) Tiempo = Tiempo + Queda;
|
||||
Tiempo.DecodeTime( &hour, &min, &sec, &msec );
|
||||
Revisor->Interval = msec + ( sec + ( (min+0) + hour*60 )*60 )*1000 ;
|
||||
Revisor->Enabled = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::OnBlink(TObject *Sender)
|
||||
{
|
||||
|
||||
ultImagen = !ultImagen;
|
||||
// Mostrar parpadeo según corresponda...
|
||||
switch ( BlinkCode )
|
||||
{
|
||||
case IP_OFF:
|
||||
if ( SurfaceIs != sfRoja )
|
||||
{
|
||||
SurfaceIs = sfRoja;
|
||||
Picture = CtrlPPal->iElemento2->Picture;
|
||||
WriteMyName();
|
||||
}
|
||||
if ( ultImagen )
|
||||
Canvas->Draw( 17, 3, CtrlPPal->iElemento3->Picture->Graphic );
|
||||
else
|
||||
Canvas->FillRect(Rect(17,4,60,48));
|
||||
break;
|
||||
case IP_QUERY:
|
||||
if ( SurfaceIs != sfAzul )
|
||||
{
|
||||
SurfaceIs = sfAzul;
|
||||
Picture = CtrlPPal->iElementoV->Picture;
|
||||
WriteMyName();
|
||||
}
|
||||
if ( ultImagen )
|
||||
Canvas->Draw( 17, 3, CtrlPPal->iElemento4->Picture->Graphic );
|
||||
else
|
||||
Canvas->FillRect(Rect(17,4,60,48));
|
||||
break;
|
||||
case NONE:
|
||||
default:
|
||||
ShowElementInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::OnRevisor(TObject *Sender)
|
||||
{
|
||||
ForcedTimeOut();
|
||||
// ShowMessage(
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + Format( " Terminal %d. Fin de Tiempo. :_)", ARRAYOFCONST((NumElemento))));
|
||||
|
||||
Revisor->Enabled = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::ForcedTimeOut(void)
|
||||
{
|
||||
Revisor->Enabled = false;
|
||||
StatusCode = ERROR; // Estamos en proceso de COMPROBACION / ERROR
|
||||
BlinkCode = IP_QUERY; // --- INTENTANDO COMUNICAR --
|
||||
// Blink->Enabled = true; // Activamos el parpadeo
|
||||
Blink->Interval = Blinking;
|
||||
|
||||
/// ENVIAMOS EL MENSAJE...
|
||||
ThreadSocket *MySocket;
|
||||
MySocket = (ThreadSocket *)CtrlPPal->GetThread();
|
||||
MySocket->SetSocket( myIP, 5432 );
|
||||
MySocket->CtrlCOP = SettingSTATUS;
|
||||
MySocket->OWNER_Element = this;
|
||||
MySocket->CtrlState = false;
|
||||
MySocket->Resume();
|
||||
|
||||
//################################################################################################
|
||||
TBookmark SavePlace;
|
||||
SavePlace = CtrlPPal->TbElementosCFG->GetBookmark();
|
||||
if ( CtrlPPal->TbElementosCFG -> Locate( "NumElement", NumElemento, TLocateOptions() << loCaseInsensitive ) )
|
||||
{
|
||||
if ( CtrlPPal->TbElementosCFG->FieldByName( "Activo" )->AsBoolean )
|
||||
{
|
||||
CtrlPPal->TbElementosCFG->Edit();
|
||||
CtrlPPal->TbElementosCFG->FieldByName( "Tiempo" )->AsDateTime = EncodeTime( 0, 0, 0, 0 );
|
||||
CtrlPPal->TbElementosCFG->FieldByName( "Activo" )->AsBoolean = false;
|
||||
CtrlPPal->TbElementosCFG->Post();
|
||||
}
|
||||
}
|
||||
CtrlPPal->TbElementosCFG->GotoBookmark(SavePlace);
|
||||
CtrlPPal->TbElementosCFG->FreeBookmark(SavePlace);
|
||||
//################################################################################################
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::MouseDown(TMouseButton Button, Classes::TShiftState Shift, int X, int Y)
|
||||
{
|
||||
Picture = CtrlPPal->iElemento2->Picture;
|
||||
if ( CtrlPPal->ChangePositionEnabled )
|
||||
{
|
||||
if ( Button == mbLeft )
|
||||
ElementoAnclado = true;
|
||||
faElmX = X;
|
||||
faElmY = Y;
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::MouseMove(TShiftState Shift, int X, int Y)
|
||||
{
|
||||
if ( CtrlPPal->ChangePositionEnabled )
|
||||
{
|
||||
if ( ElementoAnclado )
|
||||
{
|
||||
POINT MousePos;
|
||||
GetCursorPos(&MousePos);
|
||||
Left = MousePos.x - CtrlPPal->Left - CtrlPPal->Pizarra->Left - faElmX;
|
||||
Top = MousePos.y - CtrlPPal->Top - CtrlPPal->Pizarra->Top - faElmY;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::MouseUp(TMouseButton Button, Classes::TShiftState Shift, int X, int Y)
|
||||
{
|
||||
// (Mover)
|
||||
if ( Button == mbLeft )
|
||||
{
|
||||
if ( CtrlPPal->ChangePositionEnabled )
|
||||
{
|
||||
ElementoAnclado = false;
|
||||
if ( Left <= 0 ) Left = 0;
|
||||
if ( Top <= 0 ) Top = 0;
|
||||
|
||||
// ##########################################################################################
|
||||
if ( CtrlPPal->TbElementosCFG -> Locate( "NumElement", NumElemento, TLocateOptions() << loCaseInsensitive ) )
|
||||
{
|
||||
CtrlPPal->TbElementosCFG -> Edit();
|
||||
CtrlPPal->TbElementosCFG -> FieldByName("PosX") -> AsInteger = Left;
|
||||
CtrlPPal->TbElementosCFG -> FieldByName("PosY") -> AsInteger = Top;
|
||||
CtrlPPal->TbElementosCFG -> Post();
|
||||
}
|
||||
// ##########################################################################################
|
||||
}
|
||||
}
|
||||
SurfaceIs = sfNone;
|
||||
ShowElementInfo();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
// TiempoInicio --> Tiempo que queda hasta la desconexión
|
||||
void __fastcall TElemento::ClientTimeIs( double Tiempo, double TiempoInicio )
|
||||
{
|
||||
BlinkCode = NONE;
|
||||
// Blink->Enabled = false;
|
||||
Blink->Interval = 60000;
|
||||
|
||||
if ( Tiempo <= 0 )
|
||||
{
|
||||
StatusCode = FREE;
|
||||
Revisor->Enabled = false;
|
||||
} else {
|
||||
if ( StatusCode !=WORKING || (double)TiempoPedido < Tiempo )
|
||||
{
|
||||
TiempoComienzo = ( TDateTime::CurrentTime() - (Tiempo - TiempoInicio) );
|
||||
// TiempoComienzo = TiempoInicio;
|
||||
TiempoPedido = Tiempo;
|
||||
|
||||
unsigned short hour, min, sec, msec;
|
||||
RTiempoRestante = TiempoInicio;
|
||||
RTiempoRestante.DecodeTime( &hour, &min, &sec, &msec );
|
||||
|
||||
Revisor->Enabled = false;
|
||||
Revisor->Interval = msec + ( sec + ( (min+0) + hour*60 )*60 )*1000 ;
|
||||
Revisor->Enabled = true;
|
||||
}
|
||||
StatusCode = WORKING;
|
||||
}
|
||||
|
||||
ShowElementInfo();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::ShowElementInfo( void )
|
||||
{
|
||||
if ( StatusCode != ERROR )
|
||||
{
|
||||
// Picture = StatusCode != FREE ? CtrlPPal->iElementoV->Picture : CtrlPPal->iElemento5->Picture;
|
||||
Picture = CtrlPPal->iElementoV->Picture;
|
||||
WriteMyName();
|
||||
|
||||
unsigned short h, m, s, ms; int w;
|
||||
AnsiString sOUT;
|
||||
|
||||
Canvas->Font->Size = 12;
|
||||
sOUT = "# " + AnsiString( NumElemento ) + " #"; w = ( 44 - Canvas->TextWidth( sOUT ) ) / 2;
|
||||
|
||||
// En caso de estar activo el terminal
|
||||
if ( StatusCode == WORKING )
|
||||
{
|
||||
Canvas->Font->Color = clRed; /*Nombre del Terminal*/ Canvas->TextOut( 17+w, 3, sOUT );
|
||||
|
||||
Canvas->Font->Color = clBlue; Canvas->Font->Size = 10;
|
||||
|
||||
// Hora en la que inicia la sesión.
|
||||
TiempoComienzo.DecodeTime( &h, &m, &s, &ms );
|
||||
sOUT = Format( "%02d:%02d", ARRAYOFCONST(( h, m )) );
|
||||
w = ( 44 - Canvas->TextWidth( sOUT ) ) / 2;
|
||||
Canvas->TextOut( 17+w, 22, sOUT );
|
||||
// Tiempo de juego que le queda
|
||||
TDateTime Queda;
|
||||
Queda = TiempoRestante();//TiempoPedido + TiempoComienzo - TDateTime::CurrentTime();
|
||||
Queda.DecodeTime( &h, &m, &s, &ms );
|
||||
Canvas->TextOut( 17, 35, Format( "R: %02d:%02d", ARRAYOFCONST(( h, (m+1) ))) );
|
||||
/*
|
||||
// Tiempo de juego que le fue asignado
|
||||
(TbElementosCFG->FieldByName( "Tiempo" )->AsDateTime).DecodeTime( &h, &m, &s, &ms );
|
||||
E->Canvas->TextOut( 17, 40, Format( "((( %02d:%02d )))", ARRAYOFCONST(( h, m ))) );
|
||||
*/
|
||||
} else {
|
||||
Canvas->Font->Color = clBlue;
|
||||
// Nombre/Número del terminal
|
||||
Canvas->TextOut( 17+w, 3, sOUT );
|
||||
|
||||
// El terminal esta libre
|
||||
Canvas->Font->Color = clGreen;
|
||||
Canvas->TextOut( 15, 25, "LIBRE" );
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::CerrarWindows( void )
|
||||
{
|
||||
StatusCode = ERROR; // Estamos en proceso de COMPROBACION / ERROR
|
||||
BlinkCode = IP_QUERY; // --- INTENTANDO COMUNICAR --
|
||||
// Blink->Enabled = true; // Activamos el parpadeo /// ENVIAMOS EL MENSAJE...
|
||||
Blink->Interval = Blinking;
|
||||
|
||||
ThreadSocket *MySocket;
|
||||
MySocket = (ThreadSocket *)CtrlPPal->GetThread();
|
||||
MySocket->SetSocket( myIP, 5432 );
|
||||
MySocket->CtrlCOP = CloseWINDOWS;
|
||||
MySocket->CtrlState = CloseWINDOWS;
|
||||
MySocket->Resume();
|
||||
|
||||
// Actualizamos el historial
|
||||
CtrlPPal->TbHistorial -> InsertRecord( ARRAYOFCONST(( NumElemento,
|
||||
(Variant)TDateTime::CurrentDateTime(),
|
||||
(Variant)TiempoRestante(), 0, 999, 0 )) );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::EnviarListasAppl( void )
|
||||
{
|
||||
/*
|
||||
StatusCode = ERROR; // Estamos en proceso de COMPROBACION / ERROR
|
||||
BlinkCode = IP_QUERY; // --- INTENTANDO COMUNICAR --
|
||||
Blink->Interval = Blinking;
|
||||
*/
|
||||
|
||||
ThreadSocket *MySocket;
|
||||
MySocket = (ThreadSocket *)CtrlPPal->GetThread();
|
||||
MySocket->SetSocket( myIP, 5432 );
|
||||
MySocket->CtrlCOP = sendLIST;
|
||||
MySocket->CtrlState = sendLIST;
|
||||
MySocket->Resume();
|
||||
|
||||
// Actualizamos el historial
|
||||
CtrlPPal->TbHistorial -> InsertRecord( ARRAYOFCONST(( NumElemento,
|
||||
(Variant)TDateTime::CurrentDateTime(),
|
||||
(Variant)TiempoRestante(), 0, 997, 0 )) );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TElemento::WriteMyName( void )
|
||||
{
|
||||
int W;
|
||||
|
||||
Canvas->Font->Color = clRed;
|
||||
Canvas->Font->Style = Canvas->Font->Style << fsBold;
|
||||
Canvas->Font->Size = 10;
|
||||
W = ( 77 - Canvas->TextWidth( myName ) ) / 2;
|
||||
Canvas->TextOut( W, 64, myName );
|
||||
Canvas->Font->Style = Canvas->Font->Style >> fsBold;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
TDateTime __fastcall TElemento::TiempoRestante(void)
|
||||
{
|
||||
return TiempoPedido + TiempoComienzo - TDateTime::CurrentTime();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
TDateTime __fastcall TElemento::TiempoInicio(void)
|
||||
{
|
||||
return TiempoComienzo;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
74
CtrlElemento.h
Normal file
@ -0,0 +1,74 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef CtrlElementoH
|
||||
#define CtrlElementoH
|
||||
//---------------------------------------------------------------------------
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
//---------------------------------------------------------------------------
|
||||
enum BlinkCodes { NONE=-1, IP_OFF=0, IP_QUERY=1 };
|
||||
enum SurfaceAre { sfNone=-1, sfRoja=1, sfAzul=2 };
|
||||
|
||||
class TElemento : public TImage
|
||||
{
|
||||
private:
|
||||
TTimer *Revisor; // Salta cuando se acaba el tiempo
|
||||
DYNAMIC void __fastcall MouseDown(TMouseButton Button, Classes::TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseUp (TMouseButton Button, Classes::TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseMove(TShiftState Shift, int X, int Y);
|
||||
|
||||
void __fastcall OnBlink(TObject *Sender);
|
||||
void __fastcall OnRevisor(TObject *Sender);
|
||||
bool ultImagen, PideMasTiempo;
|
||||
|
||||
int idc; int idtc; Currency Precio;
|
||||
protected:
|
||||
AnsiString myIP;
|
||||
AnsiString myName;
|
||||
|
||||
TDateTime TiempoPedido, TiempoComienzo;
|
||||
|
||||
bool ElementoAnclado; // ¿Elemento cogido con el ratón?
|
||||
int faElmX, faElmY; // Factores de ajuste al mover...
|
||||
|
||||
#define ERROR -1
|
||||
#define FREE 0
|
||||
#define WORKING 1
|
||||
|
||||
// enum StatusCodes { ERROR=-1, FREE=0, WORKING=1 } StatusCode;
|
||||
|
||||
public:
|
||||
AnsiString NCliente;
|
||||
TTimer *Blink; // Encargado de hacer parpadear la imagen (p.e: errores)
|
||||
BlinkCodes BlinkCode;
|
||||
SurfaceAre SurfaceIs;
|
||||
|
||||
int StatusCode;
|
||||
int NumElemento;
|
||||
|
||||
__fastcall TElemento(TComponent* Owner);
|
||||
__fastcall ~TElemento();
|
||||
|
||||
AnsiString __fastcall GiveMyIP(void){return myIP;};
|
||||
AnsiString __fastcall GiveMyName(void){return myName;};
|
||||
void __fastcall WriteMyName(void);
|
||||
void __fastcall ShowElementInfo(void);
|
||||
void __fastcall EnviarListasAppl(void);
|
||||
void __fastcall SetElemento( int Elemento, AnsiString IP, AnsiString Name );
|
||||
void __fastcall HistoricoTermON( TDateTime CtrlTiempo );
|
||||
void __fastcall RefreshElement(void);
|
||||
void __fastcall SetActiveTime( TDateTime Tiempo, int L_idc, int L_idtc, Currency L_Precio );
|
||||
void __fastcall ClientTimeIs( double Tiempo, double TiempoInicio );
|
||||
void __fastcall CerrarWindows(void);
|
||||
void __fastcall ForcedTimeOut(void);
|
||||
TDateTime __fastcall TiempoRestante(void);
|
||||
TDateTime __fastcall TiempoInicio(void);
|
||||
TDateTime __fastcall iTiempoPedido(void){return TiempoPedido;};
|
||||
TDateTime RTiempoRestante;
|
||||
Currency ImporteAcumulado;
|
||||
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif
|
BIN
CtrlMstr-Old_Imgs.rar
Normal file
158
CtrlMstr.bpr
Normal file
@ -0,0 +1,158 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.05.03"/>
|
||||
<PROJECT value="CtrlMstr.exe"/>
|
||||
<OBJFILES value="CtrlMstr.obj CtrlPPal.obj TStatus.obj CtrlSocket.obj CtrlCfg.obj
|
||||
CtrlElemento.obj FichasClientes.obj FormularioREUSABLE.obj ComprarBono.obj"/>
|
||||
<RESFILES value="CtrlMstr.res"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES) CtrlPPal.dfm TStatus.dfm CtrlCfg.dfm FichasClientes.dfm
|
||||
FormularioREUSABLE.dfm ComprarBono.dfm"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value="TeeUI50.lib TEEQR50.lib Tee50.lib TEEDB50.lib JDsoft.lib CoolPack.lib
|
||||
inet50.lib qrpt50.lib vcldbx50.lib vclbde50.lib vcldb50.lib vclx50.lib
|
||||
vcl50.lib"/>
|
||||
<SPARELIBS value="vcl50.lib vclx50.lib vcldb50.lib vclbde50.lib vcldbx50.lib qrpt50.lib
|
||||
inet50.lib CoolPack.lib JDsoft.lib TEEDB50.lib Tee50.lib TEEQR50.lib
|
||||
TeeUI50.lib"/>
|
||||
<PACKAGES value="vclx50.bpi vcl50.bpi vcldb50.bpi vclbde50.bpi vcldbx50.bpi bcbsmp50.bpi
|
||||
dclocx50.bpi qrpt50.bpi teeui50.bpi teedb50.bpi tee50.bpi ibsmp50.bpi
|
||||
nmfast50.bpi inetdb50.bpi inet50.bpi"/>
|
||||
<PATHCPP value=".;"/>
|
||||
<PATHPAS value=".;"/>
|
||||
<PATHRC value=".;"/>
|
||||
<PATHASM value=".;"/>
|
||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
||||
<LINKER value="ilink32"/>
|
||||
<USERDEFINES value=""/>
|
||||
<SYSDEFINES value="NO_STRICT"/>
|
||||
<MAINSOURCE value="CtrlMstr.cpp"/>
|
||||
<INCLUDEPATH value="$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include;"..\C++ Builder\VCLs\include""/>
|
||||
<LIBPATH value="$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib;"..\C++ Builder\VCLs\lib""/>
|
||||
<WARNINGS value="-w-par -w-8027 -w-8026"/>
|
||||
<WARNOPTSTR value=""/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-I$(BCB)\bin -I$(BCB)\objrepos -I$(BCB)\projects -I$(BCB)\include
|
||||
-I$(BCB)\include\vcl -I..\VCLs\include -I"..\C++ Builder\VCLs\include"
|
||||
-src_suffix cpp -boa"/>
|
||||
<CFLAG1 value="-Od -H=c:\PROGRAM\CBUILDER\CBUILD~1\lib\vcld.csm -Hc -Vx -Ve -X- -r- -a8
|
||||
-5 -b- -k -y -v -vi- -c -tWM"/>
|
||||
<CFLAG2 value=""/>
|
||||
<CFLAG3 value=""/>
|
||||
<PFLAGS value="-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE
|
||||
-$YD -$W -$O- -v -JPHNV -M -JPHNE"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zi"/>
|
||||
<LFLAGS value="-D"" -aa -Tpe -x -v"/>
|
||||
<IFLAGS value=""/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
|
||||
</LINKER>
|
||||
<IDEOPTIONS>
|
||||
[Version Info]
|
||||
IncludeVerInfo=1
|
||||
AutoIncBuild=1
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=103
|
||||
Debug=1
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=JD soft.
|
||||
FileDescription=Control Maestro de sistemas
|
||||
FileVersion=1.0.0.103
|
||||
InternalName=CtrlMstr
|
||||
LegalCopyright=Copyright (C) JD soft. 1990-2000
|
||||
LegalTrademarks=JD Soft.
|
||||
OriginalFilename=CtrlMstr
|
||||
ProductName=Lock It!
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=e-mail: Jose-David.Guillen@cs.us.es
|
||||
|
||||
[HistoryLists\hlIncludePath]
|
||||
Count=10
|
||||
Item0=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include;..\C++ Builder\VCLs\include
|
||||
Item1=..\AgendaLlamadas;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include
|
||||
Item2=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\include\
|
||||
Item3=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\include
|
||||
Item4=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include
|
||||
Item5=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\include
|
||||
Item6=..\jd soft\actimg;..\jd soft\jd\actimg;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;D:\JDsoft\PrjTPVwin\VCLs\include
|
||||
Item7=..\jd soft\actimg;..\jd soft\jd\actimg;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
|
||||
Item8=..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
|
||||
Item9=..\jd soft\jd;l:\programación (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
|
||||
|
||||
[HistoryLists\hlLibraryPath]
|
||||
Count=14
|
||||
Item0=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib;..\C++ Builder\VCLs\lib
|
||||
Item1=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib;..\C++ Builder\VCLs\include
|
||||
Item2=..\AgendaLlamadas;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib
|
||||
Item3=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\lib\
|
||||
Item4=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\lib
|
||||
Item5=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\include\
|
||||
Item6=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\include
|
||||
Item7=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib
|
||||
Item8=$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\lib
|
||||
Item9=..\VCLs\lib;..\jd soft\actimg;..\jd soft;..\jd soft\jd\actimg;..\componentes;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;D:\JDsoft\PrjTPVwin\VCLs\lib
|
||||
Item10=..\jd soft\actimg;..\jd soft;..\jd soft\jd\actimg;..\componentes;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;D:\JDsoft\PrjTPVwin\VCLs\lib
|
||||
Item11=..\jd soft\actimg;..\jd soft;..\jd soft\jd\actimg;..\componentes;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item12=..\componentes;..\componentes\cdopping\coolform;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item13=..\jd soft\jd;l:\programación (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
|
||||
[HistoryLists\hlUnitAliases]
|
||||
Count=1
|
||||
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE
|
||||
|
||||
[HistoryLists\hlIntOutputDir]
|
||||
Count=2
|
||||
Item0=d:\temp\
|
||||
Item1=d:\temp
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
RemoteDebug=0
|
||||
|
||||
[Compiler]
|
||||
ShowInfoMsgs=1
|
||||
LinkDebugVcl=1
|
||||
LinkCGLIB=0
|
||||
|
||||
[CORBA]
|
||||
AddServerUnit=1
|
||||
AddClientUnit=1
|
||||
PrecompiledHeaders=1
|
||||
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
</IDEOPTIONS>
|
||||
|
||||
<FILES>
|
||||
<FILE type="override" value="..\AgendaLlamadas\FormularioREUSABLE.cpp" translator="Auto">
|
||||
<WARNOPTSTR value=" -w-par -w-8027 -w-8026"/>
|
||||
</FILE>
|
||||
</FILES>
|
||||
</PROJECT>
|
40
CtrlMstr.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
|
||||
#pragma hdrstop
|
||||
USERES("CtrlMstr.res");
|
||||
USEFORM("CtrlPPal.cpp", CtrlPPal);
|
||||
USEFORM("TStatus.cpp", Status);
|
||||
USEUNIT("CtrlSocket.cpp");
|
||||
USEFORM("CtrlCfg.cpp", ElementosCFG);
|
||||
USEUNIT("CtrlElemento.cpp");
|
||||
USEFORM("FichasClientes.cpp", FClientes);
|
||||
USEFORM("FormularioREUSABLE.cpp", FormREUSABLE);
|
||||
USEFORM("ComprarBono.cpp", CBono);
|
||||
//---------------------------------------------------------------------------
|
||||
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
AnsiString FsMutex = DateToStr(TDateTime::CurrentDate()) + AnsiString("-mutex-ctrlmstr");
|
||||
HANDLE FhMutex = OpenMutex(MUTEX_ALL_ACCESS,False, FsMutex.c_str() );
|
||||
if ( FhMutex == 0 ) //it's a first instance
|
||||
{
|
||||
FhMutex = CreateMutex(NULL,false, FsMutex.c_str() );
|
||||
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
Application->Title = "Control Maestro";
|
||||
Application->CreateForm(__classid(TCtrlPPal), &CtrlPPal);
|
||||
Application->Run();
|
||||
}
|
||||
catch (Exception &exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( CloseHandle(FhMutex) ) FhMutex = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
CtrlMstr.exe
Normal file
BIN
CtrlMstr.res
Normal file
909
CtrlPPal.cpp
Normal file
@ -0,0 +1,909 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <io.h>
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include <registry.hpp>
|
||||
#include <ShellAPI.hpp>
|
||||
#include <SysUtils.hpp>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "CtrlPPal.h"
|
||||
#include "TStatus.h"
|
||||
#include "CtrlSocket.h"
|
||||
#include "CtrlCfg.h"
|
||||
#include "CtrlElemento.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "CoolForm"
|
||||
#pragma resource "*.dfm"
|
||||
TCtrlPPal *CtrlPPal;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define MsgDEMO "No olvide que esto es solo una demostración.\nPara adquirir la aplicación completa:\nPongase en contacto con JD soft.\n\te-mail: jd@infdj.com\n\tTlf: 95561-58-54 Fax: 95561-49-13"
|
||||
#define DEMOSTRACION
|
||||
#ifdef DEMOSTRACION
|
||||
#define CnElementosMAX 3
|
||||
#else
|
||||
#define CnElementosMAX 11 // Num. máximo de elementos permitidos
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define opLOG "Historic.log"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TCtrlPPal::TCtrlPPal(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
// Remote Control
|
||||
ClientHook = false;
|
||||
ServerHook = false;
|
||||
RemoteStart -> Visible = true;
|
||||
|
||||
|
||||
remoteBack->Visible = false;
|
||||
remoteLog->Visible = false;
|
||||
remoteClose->Visible = false;
|
||||
// Remote Control
|
||||
|
||||
siMinimizar = new TStringList(); // Listado de Aplicaciones Especiales
|
||||
noMinimizar = new TStringList(); // Listado de Aplicaciones Especiales
|
||||
snMinimizar = new TStringList(); // Listado de Aplicaciones Especiales
|
||||
noAbrir = new TStringList(); // Listado de Aplicaciones Especiales
|
||||
|
||||
LoadProtectedList(); // Carga los listados de Aplicaicones protegidas
|
||||
|
||||
nElementosMAX = CnElementosMAX; // Número maximos de elementos
|
||||
Elementos = new TList(); // Lista de Elementos en funcionamiento
|
||||
AnySocketActive = 0; // Nº de socket REALMENTE activos
|
||||
pCache = new TThreadList; // Lista de Hilos de comunicación
|
||||
|
||||
ChangePositionEnabled = false; // Permiso para mover la posición de los elementos
|
||||
|
||||
CheckAppIntegrity(); // El directorio de instalacion no puede moverse
|
||||
StartEventRecorder(); // Comenzamos la grabación de eventos
|
||||
TbElementosCFG->Active = true; // Abrimos la tabla de elementos para hacerlos visibles
|
||||
TbPersonas->Active = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::LoadProtectedList(void)
|
||||
{
|
||||
//LoadProtectedList();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::StartEventRecorder(void)
|
||||
{
|
||||
TbHistorial->Active = true; // Tabla de eventos del sistema
|
||||
try {
|
||||
// Cargamos todos los eventos anteriores
|
||||
Memo1->Lines->LoadFromFile( opLOG );
|
||||
// Si hay demasiados registros
|
||||
if ( Memo1->Lines->Count > 700 )
|
||||
{
|
||||
for ( int i=0; i<100; i++ ) // Eliminamos las 100 últimas entradas
|
||||
Memo1->Lines->Delete( 3 );
|
||||
}
|
||||
} catch(...) {
|
||||
Memo1->Lines->Clear(); // En caso de error, las eliminamos todas
|
||||
}
|
||||
//Fecha y hora del inicio de sesión
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Inicio de la sesión" );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::iCloseDblClick(TObject *Sender)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::iMinClick(TObject *Sender)
|
||||
{
|
||||
Application->Minimize();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::iPosVClick(TObject *Sender)
|
||||
{
|
||||
#ifdef DEMOSTRACION
|
||||
ShowMessage( MsgDEMO );
|
||||
#endif
|
||||
if ( ChangePositionEnabled || ( !ChangePositionEnabled && InputBox( "Programa BETA!!!", "Modificar:", "¿Que Modificar?") == "Esto es una beta" ) )
|
||||
{
|
||||
Graphics::TBitmap *Picture;
|
||||
|
||||
ChangePositionEnabled = !ChangePositionEnabled;
|
||||
|
||||
Picture = iPosV->GlyphNormal;
|
||||
iPosV->GlyphNormal = iPosV->GlyphPress;
|
||||
iPosV->GlyphPress = Picture;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
Comprueba que el directorio de la aplicación es siempre el mismo
|
||||
|
||||
(De este modo, la aplicación no correra en ningún directorio distinto, del
|
||||
que se eligió para instalar)
|
||||
**/
|
||||
void __fastcall TCtrlPPal::CheckAppIntegrity(void)
|
||||
{
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
Registro -> OpenKey( "\\Software\\JDsoft\\CtrlMstr", true );
|
||||
AnsiString AppPath;
|
||||
|
||||
if ( ! Registro->ValueExists( "AppPath" ) )
|
||||
{
|
||||
Registro -> WriteString( "AppPath", Application->ExeName );
|
||||
} else {
|
||||
AppPath = Registro -> ReadString( "AppPath" );
|
||||
if ( AppPath != Application->ExeName )
|
||||
{
|
||||
ShowMessage( "Copia corrupta o ilegal del programa.\nVuelva a reinstalar el producto." );
|
||||
nElementosMAX = 0;
|
||||
}
|
||||
}
|
||||
|
||||
AnsiString DiskSerial;
|
||||
char VolumeLabel[255], FileSystem[255];
|
||||
DWord SerialNumber, DW, SysFlags;
|
||||
|
||||
GetVolumeInformation( "C:\\", VolumeLabel, 250, &SerialNumber, &DW, &SysFlags, FileSystem, 250);
|
||||
DiskSerial = AnsiString( ltoa(SerialNumber, FileSystem,10) );
|
||||
|
||||
|
||||
if ( ! Registro->ValueExists( "SerialNum" ) )
|
||||
{
|
||||
AnsiString Serial;
|
||||
Serial = InputBox( "Registrando el Programa:", "Número de Serie:", DiskSerial );
|
||||
if ( ! Manipula2( DiskSerial, Serial ) )
|
||||
{
|
||||
Registro -> WriteString( "SerialNum", Serial );
|
||||
}
|
||||
}
|
||||
if ( Manipula( DiskSerial, Registro -> ReadString( "SerialNum" ) ) )
|
||||
{
|
||||
ShowMessage( "Copia corrupta o ilegal del programa.\nVuelva a reinstalar el producto." );
|
||||
nElementosMAX = 0;
|
||||
Registro -> DeleteValue( "SerialNum" );
|
||||
Registro -> DeleteKey( "\\Software\\JDsoft\\CtrlMstr\\SerialNum" );
|
||||
}
|
||||
}
|
||||
//-----------------
|
||||
bool __fastcall TCtrlPPal::Manipula2(AnsiString Serial, AnsiString Image)
|
||||
{
|
||||
char buffer[80];
|
||||
AnsiString Sol;
|
||||
double ser = Serial.ToDouble();
|
||||
if ( ser < 0 ) ser = -1*ser;
|
||||
Sol = ltoa(sqrtl(ser), buffer, 10);
|
||||
#ifndef DEMOSTRACION
|
||||
if ( Image == Sol )
|
||||
#endif
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
//-----------------
|
||||
bool __fastcall TCtrlPPal::Manipula(AnsiString Serial, AnsiString Image)
|
||||
{
|
||||
char buffer[80];
|
||||
AnsiString Sol;
|
||||
double ser = Serial.ToDouble();
|
||||
if ( ser < 0 ) ser = -1*ser;
|
||||
Sol = ltoa(sqrtl(ser), buffer, 10);
|
||||
#ifndef DEMOSTRACION
|
||||
if ( Image == Sol )
|
||||
#endif
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::FormDestroy(TObject *Sender)
|
||||
{
|
||||
delete siMinimizar;
|
||||
delete noMinimizar;
|
||||
delete snMinimizar;
|
||||
delete noAbrir;
|
||||
|
||||
for( int i=0; i < Elementos->Count; i++ )
|
||||
delete (TElemento *)Elementos->Items[i];
|
||||
delete Elementos;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::NewElementAt(int X, int Y, int NumEl, AnsiString IP, AnsiString Name )
|
||||
{
|
||||
TElemento *Elemento; // Elemento a ser insertado
|
||||
Elemento = new TElemento(this); // Pedimos memoria para él
|
||||
Elemento->Left = X; //
|
||||
Elemento->Top = Y; // FIJAMOS SUS PROPIEDADES
|
||||
Elemento->AutoSize = true; //
|
||||
Elemento->Transparent = true; //
|
||||
Elemento->PopupMenu = mElementoCFG; // Menú contextual
|
||||
Elemento->OnDblClick = ElementoDblClick; //
|
||||
|
||||
Elementos->Add( Elemento ); // Añadimos el elemento a la lista
|
||||
// Lo hacemos visible
|
||||
Pizarra->InsertControl( Elemento );
|
||||
|
||||
Elemento->SetElemento( NumEl, IP, Name ); // Y comenzamos la comunicación
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::PizarraDblClick(TObject *Sender)
|
||||
{
|
||||
POINT MousePos;
|
||||
int X, Y;
|
||||
|
||||
// Si lo que quiere es reubicar un nuevo elemento
|
||||
if ( ChangePositionEnabled )
|
||||
{
|
||||
#ifndef DEMOSTRACION
|
||||
// Anexamos un nuevo elemento a la lista (Si no hemos llegado al límite)
|
||||
if ( Elementos->Count < nElementosMAX )
|
||||
{
|
||||
GetCursorPos(&MousePos);
|
||||
X = MousePos.x - Left - Pizarra->Left - iElementoV->Picture->Width / 2;
|
||||
Y = MousePos.y - Top - Pizarra->Top - iElementoV->Picture->Height / 2 ;
|
||||
try {
|
||||
// Lo damos de Alta en la tabla
|
||||
/*
|
||||
TbElementosCFG -> InsertRecord( ARRAYOFCONST(
|
||||
( Null, // Numero de Elemento
|
||||
X, // Posición X
|
||||
Y, // Posición Y
|
||||
false, "0.0.0.0", "new"+AnsiString(Elementos->Count)
|
||||
) ) );
|
||||
*/
|
||||
|
||||
AnsiString NameOfElement = "new"+AnsiString(TbElementosCFG->FieldByName("NumElement")->AsInteger);
|
||||
|
||||
TbElementosCFG -> Insert();
|
||||
TbElementosCFG -> Edit();
|
||||
TbElementosCFG -> FieldByName( "PosX" )-> AsInteger = X;
|
||||
TbElementosCFG -> FieldByName( "PosY" )-> AsInteger = Y;
|
||||
TbElementosCFG -> FieldByName( "Activo" )-> AsBoolean = false;
|
||||
TbElementosCFG -> FieldByName( "IP" )-> AsString = "0.0.0.0";
|
||||
TbElementosCFG -> FieldByName( "Name" )-> AsString = NameOfElement;
|
||||
TbElementosCFG -> Post();
|
||||
|
||||
NewElementAt( X, Y, TbElementosCFG->FieldByName("NumElement")->AsInteger, "0.0.0.0", NameOfElement );
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Inserción de nuevos elementos" );
|
||||
} catch (...) {
|
||||
ShowMessage( "¿¿¿ SIN MEMORIA ???\nTu Güindows está petando" );
|
||||
}
|
||||
} else
|
||||
ShowMessage( "Ha superado el máximo número de elementos\n¡¡¡ IMPOSIBLE AÑADIR MAS !!!" );
|
||||
#else
|
||||
ShowMessage( MsgDEMO );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::EliminarElemento(TObject *Sender)
|
||||
{
|
||||
if ( ServerHook ) return;
|
||||
|
||||
int TraceMeHacker;
|
||||
TraceMeHacker = Elementos->Count;
|
||||
|
||||
#ifndef DEMOSTRACION
|
||||
if ( ChangePositionEnabled )
|
||||
{
|
||||
TElemento *Elemento = (TElemento *)(mElementoCFG->PopupComponent);
|
||||
|
||||
// Eliminamos el objeto de la tabla
|
||||
if ( TbElementosCFG -> Locate( "NumElement", Elemento->NumElemento, TLocateOptions() << loCaseInsensitive ) )
|
||||
{
|
||||
TbElementosCFG -> Delete(); // Eliminamos el elemento de la TABLA
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Elemento nº " + AnsiString( Elemento->NumElemento ) + ", eliminado." );
|
||||
|
||||
Pizarra->RemoveControl( Elemento ); // Eliminamos el elemento de la PIZARRA
|
||||
Elementos->Remove( Elemento ); // Eliminamos el elemento de la MEMORIA
|
||||
Elementos->Pack();
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
ShowMessage( MsgDEMO );
|
||||
|
||||
#endif
|
||||
|
||||
if ( TraceMeHacker == Elementos->Count )
|
||||
ShowMessage( "Lo siento pero carece de permisos para modificar los terminales.\n¡¡Su intento ha quedado registrado!!" );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::TbElementosCFGBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
// Si la tabla no existe, la creamos
|
||||
if ( access( (TbElementosCFG -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendrá la tabla
|
||||
TbElementosCFG -> FieldDefs -> Clear();
|
||||
|
||||
TbElementosCFG -> FieldDefs -> Add("NumElement", ftAutoInc, 0, false );
|
||||
TbElementosCFG -> FieldDefs -> Add("PosX", ftInteger, 0, false );
|
||||
TbElementosCFG -> FieldDefs -> Add("PosY", ftInteger, 0, false );
|
||||
TbElementosCFG -> FieldDefs -> Add("Activo", ftBoolean, 0, false );
|
||||
TbElementosCFG -> FieldDefs -> Add("IP", ftString, 15, false );
|
||||
TbElementosCFG -> FieldDefs -> Add("Name", ftString, 8, false );
|
||||
TbElementosCFG -> FieldDefs -> Add("Comienzo", ftDateTime, 0, false );
|
||||
TbElementosCFG -> FieldDefs -> Add("Tiempo", ftDateTime, 0, false );
|
||||
|
||||
TbElementosCFG -> IndexDefs-> Clear();
|
||||
TbElementosCFG->IndexDefs->Add("Primary", "NumElement", TIndexOptions() << ixPrimary << ixUnique );
|
||||
|
||||
// Creamos la base...
|
||||
TbElementosCFG -> CreateTable();
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Iniciando sistema por primera vez..." );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::TbElementosCFGAfterOpen(TDataSet *DataSet)
|
||||
{
|
||||
int i; HoraActual = TDateTime::CurrentTime();
|
||||
|
||||
// Cargamos todos los elementos
|
||||
TbElementosCFG -> First(); i = 0;
|
||||
while ( ! TbElementosCFG->Eof && i < nElementosMAX )
|
||||
{
|
||||
|
||||
/*
|
||||
if ( TbElementosCFG->FieldByName( "Activo" )->AsBoolean )
|
||||
{
|
||||
if ( MessageBox( NULL, AnsiString("El equipo arriba indicado se encuentra \"ocupado\"\n¿ Desea dejar libre este equipo ?").c_str(), AnsiString("Equipo " + TbElementosCFG->FieldByName( "NumElement" )->AsString + " ¿Activo?").c_str(), MB_YESNO ) != IDNO )
|
||||
{
|
||||
TbElementosCFG->Edit();
|
||||
TbElementosCFG->FieldByName( "Activo" )->AsBoolean = false;
|
||||
TbElementosCFG->Post();
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Elemento nº" + TbElementosCFG->FieldByName( "NumElement" )->AsString + ", estaba activo" );
|
||||
} else {
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Elemento nº" + TbElementosCFG->FieldByName( "NumElement" )->AsString + ", SIGUE activo" );
|
||||
}
|
||||
}
|
||||
*/
|
||||
NewElementAt( TbElementosCFG->FieldByName( "PosX" )->AsInteger,
|
||||
TbElementosCFG->FieldByName( "PosY" )->AsInteger,
|
||||
TbElementosCFG->FieldByName( "NumElement" )->AsInteger,
|
||||
TbElementosCFG->FieldByName( "IP" )->AsString,
|
||||
TbElementosCFG->FieldByName( "Name" )->AsString
|
||||
);
|
||||
TbElementosCFG -> Next(); i++;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::Estado1Click(TObject *Sender)
|
||||
{
|
||||
if ( !ServerHook )
|
||||
ElementoDblClick(mElementoCFG->PopupComponent);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::ElementoDblClick(TObject *Sender)
|
||||
{
|
||||
// Abrimos el cuadro de dialogo de Status...
|
||||
if ( ((TElemento *)Sender)->StatusCode != -1 )
|
||||
{
|
||||
TStatus *Status;
|
||||
Status = new TStatus(this);
|
||||
Status->SetElement( (TElemento *)Sender );
|
||||
Status -> ShowModal();
|
||||
delete Status;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::FormClose(TObject *Sender, TCloseAction &Action)
|
||||
{
|
||||
#ifdef DEMOSTRACION
|
||||
ShowMessage( MsgDEMO );
|
||||
#endif
|
||||
clientHook->Close();
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Fin de la sesión" );
|
||||
Memo1->Lines->SaveToFile( opLOG );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::FormDeactivate(TObject *Sender)
|
||||
{
|
||||
FreeThreads();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::Propiedades1Click(TObject *Sender)
|
||||
{
|
||||
if ( ServerHook ) return;
|
||||
|
||||
if ( ChangePositionEnabled )
|
||||
{
|
||||
TElementosCFG *ElementosCFG;
|
||||
ElementosCFG = new TElementosCFG(this);
|
||||
ElementosCFG -> ShowModal();
|
||||
delete ElementosCFG;
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Se han modificado las direcciones IP" );
|
||||
|
||||
LoadProtectedList();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::CerrarWindows1Click(TObject *Sender)
|
||||
{
|
||||
TElemento *Elemento = (TElemento *)(mElementoCFG->PopupComponent);
|
||||
|
||||
if ( MessageBox( NULL, "¿ Realmente quiere cerrar el equipo ?", AnsiString("Equipo n: -- " + AnsiString( Elemento->NumElemento ) + " --" +" Nombre: \""+Elemento->GiveMyName()+"\"" ).c_str(), MB_OKCANCEL ) == IDOK )
|
||||
{
|
||||
if ( ServerHook )
|
||||
{
|
||||
ServerHookCode = 5660; ServerHookElement = Elemento->NumElemento;
|
||||
serverHook->Active = true;
|
||||
} else
|
||||
Elemento->CerrarWindows();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
TThread * TCtrlPPal::GetThread(void)
|
||||
{
|
||||
TList *pList = pCache->LockList();
|
||||
TThread *NewThread;
|
||||
if (pList->Count) // cache is not empty
|
||||
{
|
||||
NewThread = (TThread *)pList->Items[0];
|
||||
pList->Delete(0); // remove from cache
|
||||
}
|
||||
else
|
||||
NewThread = (TThread *)new ThreadSocket(true); // create but don’t run
|
||||
pCache->UnlockList();
|
||||
return NewThread;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::FreeThreads(void)
|
||||
{
|
||||
TList *pList = pCache->LockList();
|
||||
for (int i = pList->Count - 1; i >= 0; i--)
|
||||
{
|
||||
|
||||
delete pList->Items[i];
|
||||
pList->Delete(i);
|
||||
}
|
||||
pCache->UnlockList();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
void __fastcall TCtrlPPal::FormCloseQuery(TObject *Sender, bool &CanClose)
|
||||
{
|
||||
// Esperamos a que se cierren los Sockets...
|
||||
if ( AnySocketActive > 0 )
|
||||
{
|
||||
if ( Application->MessageBox("La aplicación sigue intentando comunicarse\ncon algún terminal.\nPor favor, espere...\n(Cancelar el proceso dejará la aplicación\nen un estado Altamente INESTABLE)", AnsiString("¡¡¡ " + AnsiString( AnySocketActive ) + " Alerta(s) !!!").c_str(), MB_OKCANCEL + MB_DEFBUTTON1) != ID_CANCEL )
|
||||
{
|
||||
CanClose = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::ActualizarEstado1Click(TObject *Sender)
|
||||
{
|
||||
if ( ServerHook )
|
||||
{
|
||||
ServerHookCode = 5661; ServerHookElement = ( (TElemento *)(mElementoCFG->PopupComponent) )->NumElemento;
|
||||
serverHook -> Active = true;
|
||||
} else {
|
||||
( (TElemento *)(mElementoCFG->PopupComponent) ) -> RefreshElement();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCtrlPPal::SinTIEMPO1Click(TObject *Sender)
|
||||
{
|
||||
TElemento *Elemento = (TElemento *)(mElementoCFG->PopupComponent);
|
||||
|
||||
if ( MessageBox( NULL, "¿ Realmente quiere QUITAR EL TIEMPO al equipo ?", AnsiString("Equipo n: -- " + AnsiString( Elemento->NumElemento ) + " --"+" Nombre: \""+Elemento->GiveMyName()+"\"").c_str() , MB_OKCANCEL ) == IDOK )
|
||||
{
|
||||
// Actualizamos el historial
|
||||
TbHistorial -> InsertRecord( ARRAYOFCONST(( Elemento->NumElemento,
|
||||
(Variant)TDateTime::CurrentDateTime(),
|
||||
(Variant)Elemento->TiempoRestante(), 0, 998, 0 )) );
|
||||
TbHistorial -> FlushBuffers();
|
||||
if ( ServerHook )
|
||||
{
|
||||
ServerHookCode = 5668; ServerHookElement = Elemento->NumElemento;
|
||||
serverHook -> Active = true;
|
||||
} else
|
||||
Elemento -> ForcedTimeOut();
|
||||
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCtrlPPal::TbHistorialBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
// Si la tabla no existe, la creamos
|
||||
if ( access( (TbHistorial -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendrá la tabla
|
||||
TbHistorial -> FieldDefs -> Clear();
|
||||
|
||||
TbHistorial -> FieldDefs -> Add("NumElement", ftInteger, 0, false );
|
||||
TbHistorial -> FieldDefs -> Add("FComienzo", ftDateTime, 0, false );
|
||||
TbHistorial -> FieldDefs -> Add("Tiempo", ftTime, 0, false );
|
||||
TbHistorial -> FieldDefs -> Add("idc", ftInteger, 0, false );
|
||||
TbHistorial -> FieldDefs -> Add("idtc", ftInteger, 0, false );
|
||||
TbHistorial -> FieldDefs -> Add("precio", ftCurrency, 0, false );
|
||||
|
||||
TbHistorial -> IndexDefs -> Clear();
|
||||
TbHistorial -> IndexDefs -> Add("Primary", "NumElement;FComienzo", TIndexOptions() << ixPrimary << ixUnique );
|
||||
|
||||
// Creamos la base...
|
||||
TbHistorial -> CreateTable();
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCtrlPPal::AsignarHora1Click(TObject *Sender)
|
||||
{
|
||||
/*
|
||||
iAnclada = GetNumElement( Sender );
|
||||
if ( iAnclada != -1 )
|
||||
{
|
||||
Elementos[ iAnclada ]-> EnviarListasAppl();
|
||||
}
|
||||
*/
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TCtrlPPal::RemoteStartClick(TObject *Sender)
|
||||
{
|
||||
// Remote Start...
|
||||
if ( AnySocketActive > 0 )
|
||||
{
|
||||
ShowMessage( "Imposible enganche remoto,\nhasta que todos los terminales\nacaben su comunicación" );
|
||||
return;
|
||||
}
|
||||
if ( ClientHook )
|
||||
{
|
||||
ShowMessage( "Alguien nos tiene enganchados.\nImposible realizar enganche remoto.\n(Pruebe en otro orden)" );
|
||||
return;
|
||||
}
|
||||
|
||||
RemoteStart -> Visible = false;
|
||||
ServerHook = true;
|
||||
|
||||
remoteBack->Visible = true;
|
||||
remoteLog->Visible = true;
|
||||
remoteClose->Visible = true;
|
||||
|
||||
|
||||
remoteLog->Caption= "Inicializando sistema remoto...";
|
||||
|
||||
serverHook->Address = InputBox("Conexión Control Remoto", "IP Destino:", "0.0.0.0");
|
||||
|
||||
|
||||
remoteLog->Caption= "Eliminando terminales actuales" ;
|
||||
Elementos->Pack();
|
||||
for( int i=0; i < Elementos->Count; i++ )
|
||||
{
|
||||
Pizarra->RemoveControl( (TElemento *)Elementos->Items[i] );
|
||||
delete (TElemento *)Elementos->Items[i];
|
||||
}
|
||||
Elementos->Clear();
|
||||
|
||||
remoteLog->Caption= "Accediendo a los terminales remotos" ;
|
||||
ServerHookCode = 5650; ServerHookElement = 5650;
|
||||
serverHook->Active = true;
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCtrlPPal::remoteCloseDblClick(TObject *Sender)
|
||||
{
|
||||
if ( ClientHook )
|
||||
{
|
||||
ShowMessage( "Alguien nos tiene enganchados.\nImposible des-enganche remoto.\nRiesgo de incomunicación parcial" );
|
||||
return;
|
||||
}
|
||||
|
||||
remoteLog->Caption= "Eliminando terminales actuales" ;
|
||||
Elementos->Pack();
|
||||
for( int i=0; i < Elementos->Count; i++ )
|
||||
{
|
||||
Pizarra->RemoveControl( (TElemento *)Elementos->Items[i] );
|
||||
delete (TElemento *)Elementos->Items[i];
|
||||
}
|
||||
Elementos->Clear();
|
||||
|
||||
ServerHook = false;
|
||||
|
||||
remoteLog->Caption= "Cargando Terminales Locales" ;
|
||||
TbElementosCFGAfterOpen(0);
|
||||
|
||||
RemoteStart -> Visible = true;
|
||||
|
||||
remoteBack->Visible = false;
|
||||
remoteLog->Visible = false;
|
||||
remoteClose->Visible = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCtrlPPal::clientHookClientConnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Nos han enganchado :: " + Socket->LocalAddress );
|
||||
ClientHook = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCtrlPPal::clientHookClientDisconnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Desenganche " );
|
||||
ClientHook = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCtrlPPal::clientHookClientError(TObject *Sender,
|
||||
TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode)
|
||||
{
|
||||
Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Cliente ¡ ERROR ! " + AnsiString( ErrorCode ) + "::" + Socket->LocalAddress );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::SetActiveTimeElement( TElemento *Elemento, TDateTime Tiempo, int L_idc, int L_idtc, Currency L_Precio )
|
||||
{
|
||||
if ( ServerHook )
|
||||
{
|
||||
ServerHookCode = 5669; ServerHookElement = Elemento->NumElemento;
|
||||
ServerTiempo = Tiempo; ServerL_idc = L_idc; ServerL_idtc = L_idtc; ServerL_Precio = (double)L_Precio;
|
||||
serverHook -> Active = true;
|
||||
} else
|
||||
Elemento->SetActiveTime( Tiempo, L_idc, L_idtc, L_Precio );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
TElemento * __fastcall TCtrlPPal::SearchElement( int NumEl )
|
||||
{
|
||||
for (int i = Elementos->Count - 1; i >= 0; i--)
|
||||
{
|
||||
if ( ((TElemento *)(Elementos->Items[i]))->NumElemento == NumEl )
|
||||
return (TElemento *)(Elementos->Items[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::clientHookAccept(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
int CodOp, dev;
|
||||
double Tiempo;
|
||||
TElemento *Elemento;
|
||||
TWinSocketStream *pStream;
|
||||
|
||||
Memo1->Lines->Insert( 0, "Conexión aceptada de " + Socket->RemoteAddress );
|
||||
|
||||
try {
|
||||
pStream = new TWinSocketStream( Socket, 60000 );
|
||||
try{
|
||||
// Socket->ReceiveBuf( &CodOp, sizeof(int) );
|
||||
pStream->WaitForData(30000); pStream->Read( &CodOp, sizeof(int) );
|
||||
|
||||
if ( CodOp != 5650 )
|
||||
{
|
||||
dev = ( Elemento = SearchElement( CodOp ) ) == NULL ? 1 : 0;
|
||||
// Socket->SendBuf( &dev, sizeof(int) );
|
||||
pStream->Write( &dev, sizeof(int) );
|
||||
if ( dev ) return;
|
||||
}
|
||||
|
||||
ClientHook = true;
|
||||
|
||||
// Socket->ReceiveBuf( &CodOp, sizeof(int) );
|
||||
pStream->WaitForData(30000); pStream->Read( &CodOp, sizeof(int) );
|
||||
|
||||
switch( CodOp )
|
||||
{
|
||||
// On
|
||||
case 5669:
|
||||
int L_idc, L_idtc;
|
||||
float L_Precio;
|
||||
/*
|
||||
Socket->ReceiveBuf( &Tiempo, sizeof(double) );
|
||||
Socket->ReceiveBuf( &L_idc, sizeof(int) );
|
||||
Socket->ReceiveBuf( &L_idtc, sizeof(int) );
|
||||
Socket->ReceiveBuf( &L_Precio, sizeof(float) );
|
||||
*/
|
||||
pStream->WaitForData(30000); pStream->Read( &Tiempo, sizeof(double) );
|
||||
pStream->WaitForData(30000); pStream->Read( &L_idc, sizeof(int) );
|
||||
pStream->WaitForData(30000); pStream->Read( &L_idtc, sizeof(int) );
|
||||
pStream->WaitForData(30000); pStream->Read( &L_Precio, sizeof(float) );
|
||||
|
||||
SetActiveTimeElement( Elemento, Tiempo, L_idc, L_idtc, (Currency)L_Precio );
|
||||
break;
|
||||
// Off
|
||||
case 5668:
|
||||
Elemento -> ForcedTimeOut();
|
||||
break;
|
||||
// CERRAR WINDOWS
|
||||
case 5660:
|
||||
Elemento->CerrarWindows();
|
||||
break;
|
||||
// Query TIME (Refresh)
|
||||
case 5661:
|
||||
Elemento -> RefreshElement();
|
||||
Tiempo = Elemento->iTiempoPedido();
|
||||
// Socket->SendBuf( &Tiempo, sizeof(double) );
|
||||
pStream->WaitForData(30000); pStream->Read( &Tiempo, sizeof(double) );
|
||||
Tiempo = Elemento->RTiempoRestante;
|
||||
// Socket->SendBuf( &Tiempo, sizeof(double) );
|
||||
pStream->WaitForData(30000); pStream->Read( &Tiempo, sizeof(double) );
|
||||
break;
|
||||
// Lista de elementos...
|
||||
case 5650:
|
||||
dev = Elementos->Count;
|
||||
// Socket->SendBuf( &dev, sizeof(int) );
|
||||
pStream->Write( &dev, sizeof(int) );
|
||||
|
||||
for (int i = Elementos->Count - 1; i >= 0; i--)
|
||||
{
|
||||
Elemento = (TElemento *)(Elementos->Items[i]);
|
||||
//void __fastcall TCtrlPPal::NewElementAt(int X, int Y, int NumEl, AnsiString IP, AnsiString Name )
|
||||
/*
|
||||
Socket->SendBuf( &(Elemento->Left), sizeof(int) );
|
||||
Socket->SendBuf( &(Elemento->Top), sizeof(int) );
|
||||
Socket->SendBuf( &(Elemento->NumElemento), sizeof(int) );
|
||||
Socket->SendBuf( Elemento->GiveMyIP().c_str(), 70 );
|
||||
Socket->SendBuf( Elemento->GiveMyName().c_str(), 70 );
|
||||
|
||||
Tiempo = Elemento->iTiempoPedido(); Socket->SendBuf( &Tiempo, sizeof(double) );
|
||||
Tiempo = Elemento->RTiempoRestante; Socket->SendBuf( &Tiempo, sizeof(double) );
|
||||
|
||||
*/
|
||||
pStream->Write( &(Elemento->Left), sizeof(int) );
|
||||
pStream->Write( &(Elemento->Top), sizeof(int) );
|
||||
pStream->Write( &(Elemento->NumElemento), sizeof(int) );
|
||||
pStream->Write( Elemento->GiveMyIP().c_str(), 70 );
|
||||
pStream->Write( Elemento->GiveMyName().c_str(), 70 );
|
||||
|
||||
Tiempo = Elemento->iTiempoPedido(); pStream->Write( &Tiempo, sizeof(double) );
|
||||
Tiempo = Elemento->RTiempoRestante; pStream->Write( &Tiempo, sizeof(double) );
|
||||
|
||||
Elemento -> RefreshElement();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Memo1->Lines->Insert( 0, "Mensaje desconocido ::" + Socket->RemoteAddress );
|
||||
}
|
||||
}
|
||||
catch (Exception &E)
|
||||
{
|
||||
if (!E.ClassNameIs("EAbort"))
|
||||
{
|
||||
Memo1->Lines->Insert( 0, "ERROR en la comunicación ::" + Socket->RemoteAddress );
|
||||
}
|
||||
}
|
||||
}
|
||||
__finally
|
||||
{
|
||||
delete pStream;
|
||||
Socket->Close();
|
||||
}
|
||||
Memo1->Lines->Insert( 0, "Tramites Finalizados ::" + Socket->RemoteAddress );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::serverHookConnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
double TiempoPedido, TiempoRestante;
|
||||
TWinSocketStream *pStream;
|
||||
int Data;
|
||||
// create a TWinSocketStream for reading and writing
|
||||
try {
|
||||
pStream = new TWinSocketStream( Socket, 60000 );
|
||||
|
||||
try
|
||||
{
|
||||
pStream->Write( &ServerHookElement, sizeof(int) );
|
||||
|
||||
if ( ServerHookCode != 5650 )
|
||||
{
|
||||
pStream->WaitForData(30000);
|
||||
pStream->Read( &Data, sizeof(int) );
|
||||
if ( Data == 1 )
|
||||
{
|
||||
Socket->Close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pStream->Write( &ServerHookCode, sizeof(int) );
|
||||
|
||||
// Comunicamos según código en ServerHookCode
|
||||
switch ( ServerHookCode )
|
||||
{
|
||||
// On
|
||||
case 5669:
|
||||
pStream->Write( &ServerTiempo, sizeof(double) );
|
||||
pStream->Write( &ServerL_idc, sizeof(int) );
|
||||
pStream->Write( &ServerL_idtc, sizeof(int) );
|
||||
pStream->Write( &ServerL_Precio, sizeof(float) );
|
||||
break;
|
||||
// Off
|
||||
case 5668:
|
||||
// Nada mas
|
||||
break;
|
||||
// CERRAR WINDOWS
|
||||
case 5660:
|
||||
// Nada mas
|
||||
break;
|
||||
// Lista de elementos...
|
||||
case 5650:
|
||||
pStream->WaitForData(30000); // Inicio
|
||||
pStream->Read( &Data, sizeof(int) );
|
||||
int X,Y, NumEl; char IP[80], Name[80];
|
||||
for (int i = Data - 1; i >= 0; i--)
|
||||
{
|
||||
pStream->WaitForData(30000); pStream->Read( &X, sizeof(int) );
|
||||
pStream->WaitForData(30000); pStream->Read( &Y, sizeof(int) );
|
||||
pStream->WaitForData(30000); pStream->Read( &NumEl, sizeof(int) );
|
||||
pStream->WaitForData(30000); pStream->Read( &IP, 70 );
|
||||
pStream->WaitForData(30000); pStream->Read( &Name, 70 );
|
||||
|
||||
NewElementAt( X, Y, NumEl, IP, Name );
|
||||
|
||||
pStream->WaitForData(30000); pStream->Read( &TiempoPedido, sizeof(double) );
|
||||
pStream->WaitForData(30000); pStream->Read( &TiempoRestante, sizeof(double) );
|
||||
|
||||
SearchElement( NumEl ) -> ClientTimeIs( TiempoPedido, TiempoRestante );
|
||||
}
|
||||
break;
|
||||
// Query TIME (Refresh)
|
||||
case 5661:
|
||||
pStream->WaitForData(30000); // Inicio
|
||||
pStream->Read( &TiempoPedido, sizeof(double) );
|
||||
|
||||
pStream->WaitForData(30000); // Restante
|
||||
pStream->Read( &TiempoRestante, sizeof(double) );
|
||||
|
||||
SearchElement( ServerHookElement ) -> ClientTimeIs( TiempoPedido, TiempoRestante );
|
||||
break;
|
||||
default:
|
||||
Memo1->Lines->Insert( 0, "Mensaje desconocido ::" + Socket->RemoteAddress );
|
||||
}
|
||||
}
|
||||
catch (Exception &E)
|
||||
{
|
||||
if (!E.ClassNameIs("EAbort"))
|
||||
{
|
||||
Memo1->Lines->Insert( 0, "ERROR en la comunicación ::" + Socket->RemoteAddress );
|
||||
}
|
||||
}
|
||||
}
|
||||
__finally
|
||||
{
|
||||
delete pStream;
|
||||
Socket->Close();
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCtrlPPal::ActiveImage3Click(TObject *Sender)
|
||||
{
|
||||
clientHook -> Active = !clientHook -> Active;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TCtrlPPal::Image1Click(TObject *Sender)
|
||||
{
|
||||
char zFileName[80], zParams[80], zDir[80];
|
||||
ShellExecute(Application->MainForm->Handle, 0, StrPCopy(zFileName, "http:\\\\www.infdj.com"),
|
||||
StrPCopy(zParams, ""), StrPCopy(zDir, ""), SW_SHOWNOACTIVATE > 32);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCtrlPPal::TbPersonasNewRecord(TDataSet *DataSet)
|
||||
{
|
||||
TbPersonas->FieldByName( "FAlta" )->AsDateTime = TDateTime::CurrentDateTime();
|
||||
TbPersonas->FieldByName( "FModif" )->AsDateTime = TDateTime::CurrentDateTime();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
BIN
CtrlPPal.dfm
Normal file
157
CtrlPPal.h
Normal file
@ -0,0 +1,157 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef CtrlPPalH
|
||||
#define CtrlPPalH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include "CoolForm.hpp"
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Menus.hpp>
|
||||
#include <Db.hpp>
|
||||
#include <DBTables.hpp>
|
||||
#include <Buttons.hpp>
|
||||
#include "actimg.h"
|
||||
#include <ScktComp.hpp>
|
||||
#include "CtrlElemento.h"
|
||||
#include <Graphics.hpp>
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
class TCtrlPPal : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TCoolForm *CoolForm1;
|
||||
TScrollBox *Pizarra;
|
||||
TImage *iElementoV;
|
||||
TImage *iElemento2;
|
||||
TPopupMenu *mElementoCFG;
|
||||
TMenuItem *Propiedades1;
|
||||
TMenuItem *N1;
|
||||
TMenuItem *Eliminar1;
|
||||
TTable *TbElementosCFG;
|
||||
TMenuItem *N2;
|
||||
TMenuItem *AsignarHora1;
|
||||
TMenuItem *Estado1;
|
||||
TActiveImage *iPosV;
|
||||
TActiveImage *iClose;
|
||||
TActiveImage *ActiveImage3;
|
||||
TActiveImage *iMin;
|
||||
TMemo *Memo1;
|
||||
TMenuItem *CerrarWindows1;
|
||||
TImage *iElemento3;
|
||||
TImage *iElemento4;
|
||||
TMenuItem *ActualizarEstado1;
|
||||
TMenuItem *N3;
|
||||
TMenuItem *SinTIEMPO1;
|
||||
TTable *TbHistorial;
|
||||
TImage *remoteBack;
|
||||
TActiveImage *RemoteStart;
|
||||
TActiveImage *remoteClose;
|
||||
TServerSocket *clientHook;
|
||||
TClientSocket *serverHook;
|
||||
TLabel *remoteLog;
|
||||
TImage *Image1;
|
||||
TTable *TbPersonas;
|
||||
TAutoIncField *TbPersonasCodCliente1;
|
||||
TStringField *TbPersonasNombre;
|
||||
TStringField *TbPersonasApellidos;
|
||||
TStringField *TbPersonasTelefono1;
|
||||
TStringField *TbPersonasDocumentoDNP;
|
||||
TDateTimeField *TbPersonasFAlta;
|
||||
TDateTimeField *TbPersonasFModif;
|
||||
TIntegerField *TbPersonasTiempoH;
|
||||
TIntegerField *TbPersonasTiempoM;
|
||||
void __fastcall iCloseDblClick(TObject *Sender);
|
||||
void __fastcall iMinClick(TObject *Sender);
|
||||
|
||||
void __fastcall iPosVClick(TObject *Sender);
|
||||
|
||||
void __fastcall FormDestroy(TObject *Sender);
|
||||
void __fastcall PizarraDblClick(TObject *Sender);
|
||||
void __fastcall EliminarElemento(TObject *Sender);
|
||||
|
||||
void __fastcall TbElementosCFGBeforeOpen(TDataSet *DataSet);
|
||||
void __fastcall TbElementosCFGAfterOpen(TDataSet *DataSet);
|
||||
void __fastcall ElementoDblClick(TObject *Sender);
|
||||
void __fastcall Estado1Click(TObject *Sender);
|
||||
|
||||
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||
void __fastcall FormDeactivate(TObject *Sender);
|
||||
void __fastcall Propiedades1Click(TObject *Sender);
|
||||
void __fastcall CerrarWindows1Click(TObject *Sender);
|
||||
|
||||
void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
|
||||
|
||||
void __fastcall ActualizarEstado1Click(TObject *Sender);
|
||||
void __fastcall SinTIEMPO1Click(TObject *Sender);
|
||||
|
||||
void __fastcall TbHistorialBeforeOpen(TDataSet *DataSet);
|
||||
void __fastcall AsignarHora1Click(TObject *Sender);
|
||||
void __fastcall RemoteStartClick(TObject *Sender);
|
||||
void __fastcall remoteCloseDblClick(TObject *Sender);
|
||||
void __fastcall clientHookClientConnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket);
|
||||
void __fastcall clientHookClientDisconnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket);
|
||||
void __fastcall clientHookClientError(TObject *Sender,
|
||||
TCustomWinSocket *Socket, TErrorEvent ErrorEvent,
|
||||
int &ErrorCode);
|
||||
void __fastcall clientHookAccept(TObject *Sender,
|
||||
TCustomWinSocket *Socket);
|
||||
void __fastcall serverHookConnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket);
|
||||
void __fastcall ActiveImage3Click(TObject *Sender);
|
||||
|
||||
void __fastcall Image1Click(TObject *Sender);
|
||||
void __fastcall TbPersonasNewRecord(TDataSet *DataSet);
|
||||
private: // User declarations
|
||||
void __fastcall ElementoMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
void __fastcall ElementoMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
void __fastcall ElementoMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
|
||||
// Obtiene el indice del elemento sobre el que esta el puntero del ratón.
|
||||
void __fastcall NewElementAt( int X, int Y, int NumEl, AnsiString IP, AnsiString Name );
|
||||
|
||||
TDateTime HoraActual; // Hora "ACTUAL" (se actualiza por minutos)
|
||||
|
||||
/**********************/
|
||||
int nElementosMAX;
|
||||
TList *Elementos;
|
||||
void __fastcall CheckAppIntegrity(void);
|
||||
void __fastcall StartEventRecorder(void);
|
||||
|
||||
/**********************/
|
||||
int ServerHookCode; int ServerHookElement; int ServerHookTime;
|
||||
double ServerTiempo; int ServerL_idc, ServerL_idtc; float ServerL_Precio;
|
||||
bool ClientHook;
|
||||
|
||||
TElemento * __fastcall SearchElement( int NumElemento );
|
||||
|
||||
void __fastcall LoadProtectedList(void);
|
||||
|
||||
public: // User declarations
|
||||
|
||||
bool __fastcall Manipula2(AnsiString Serial, AnsiString Image);
|
||||
bool __fastcall Manipula(AnsiString Serial, AnsiString Image);
|
||||
|
||||
bool ServerHook;
|
||||
|
||||
|
||||
__fastcall TCtrlPPal(TComponent* Owner);
|
||||
|
||||
void __fastcall SetActiveTimeElement( TElemento *Elemento, TDateTime Tiempo, int L_idc, int L_idtc, Currency L_Precio );
|
||||
TStringList *siMinimizar, *noMinimizar;
|
||||
TStringList *snMinimizar, *noAbrir;
|
||||
bool ChangePositionEnabled;
|
||||
|
||||
//////////////////// MANTENIMIENTO DE LOS HILOS //////////////////////////
|
||||
TThread *GetThread(void);
|
||||
void __fastcall FreeThreads(void);
|
||||
int AnySocketActive;
|
||||
//////////////////// MANTENIMIENTO DE LOS HILOS //////////////////////////
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TCtrlPPal *CtrlPPal;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
226
CtrlSocket.cpp
Normal file
@ -0,0 +1,226 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "CtrlElemento.h"
|
||||
#include "CtrlSocket.h"
|
||||
#include "CtrlPPal.h"
|
||||
|
||||
#pragma package(smart_init)
|
||||
//---------------------------------------------------------------------------
|
||||
// Important: Methods and properties of objects in VCL can only be
|
||||
// used in a method called using Synchronize, for example:
|
||||
//
|
||||
// Synchronize(UpdateCaption);
|
||||
//
|
||||
// where UpdateCaption could look like:
|
||||
//
|
||||
// void __fastcall ThreadSocket::UpdateCaption()
|
||||
// {
|
||||
// Form1->Caption = "Updated in a thread";
|
||||
// }
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall ThreadSocket::ThreadSocket(bool CreateSuspended)
|
||||
: TThread(CreateSuspended)
|
||||
{
|
||||
CtrlCOP = 0;
|
||||
FreeOnTerminate = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall ThreadSocket::SetSocket( AnsiString IP_dst, int Socket )
|
||||
{
|
||||
ClientSocket = new TClientSocket( CtrlPPal->Owner );
|
||||
ClientSocket->OnConnect = SocketConnect;
|
||||
ClientSocket->OnDisconnect = SocketDisconnect;
|
||||
ClientSocket->OnError = SocketError;
|
||||
ClientSocket->ClientType = ctBlocking;
|
||||
ClientSocket->Address = IP_dst;
|
||||
ClientSocket->Port = Socket;
|
||||
|
||||
SocketCreated = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall ThreadSocket::SocketDisconnect(TObject *Sender, TCustomWinSocket *Socket)
|
||||
{
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Tramites Finalizados " + Socket->LocalAddress + " :: " + ClientSocket->Address );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall ThreadSocket::SocketError(TObject *Sender,
|
||||
TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode)
|
||||
{
|
||||
if ( OWNER_Element )
|
||||
{
|
||||
OWNER_Element->StatusCode = ERROR; // Estamos en proceso de COMPROBACION / ERROR
|
||||
OWNER_Element->BlinkCode = IP_OFF; // --- ERROR INTENTANDO COMUNICAR --
|
||||
// OWNER_Element->Blink->Enabled = true; // Activamos el parpadeo
|
||||
OWNER_Element->Blink->Interval = 500;
|
||||
}
|
||||
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Cliente ¡ ERROR ! " + AnsiString( ErrorCode ) + "::" + Socket->LocalAddress + " :: " + ClientSocket->Address );
|
||||
ErrorCode = 0;
|
||||
ClientSocket->Active = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall ThreadSocket::SocketConnect(TObject *Sender,
|
||||
TCustomWinSocket *Socket)
|
||||
{
|
||||
TWinSocketStream *pStream;
|
||||
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Cliente Conectado ::" + Socket->LocalAddress + " :: " + ClientSocket->Address );
|
||||
|
||||
// create a TWinSocketStream for reading and writing
|
||||
pStream = new TWinSocketStream( Socket, 60000 );
|
||||
try
|
||||
{
|
||||
// fetch and process commands until the connection or thread is terminated
|
||||
if ( !Terminated && ClientSocket->Active )
|
||||
{
|
||||
try
|
||||
{
|
||||
int CodOp; double doubleT = (double)CtrlTiempo;
|
||||
CodOp = (CtrlCOP == QueryTIME) ? 6661 : (CtrlCOP == CloseWINDOWS) ? 6660 : (CtrlCOP == SettingSTATUS ) ? 6669 : (CtrlCOP == sendLIST) ? 6662 : 0;
|
||||
pStream->Write( &CodOp, sizeof(int) );
|
||||
switch( CtrlCOP )
|
||||
{
|
||||
case QueryTIME:
|
||||
double dTiempoInicio;
|
||||
pStream->WaitForData(30000);
|
||||
pStream->Read( &doubleT, sizeof(double) );
|
||||
pStream->WaitForData(30000);
|
||||
pStream->Read( &dTiempoInicio, sizeof(double) );
|
||||
if ( OWNER_Element )
|
||||
OWNER_Element->ClientTimeIs( doubleT, dTiempoInicio ); // Comunicamos el tiempo que dice tener el Clt.
|
||||
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Peticion de Tiempo " + Socket->LocalAddress + " :: " + ClientSocket->Address );
|
||||
break;
|
||||
case CloseWINDOWS:
|
||||
CodOp = CtrlState;
|
||||
pStream->Write( &CodOp, sizeof(int) );
|
||||
pStream->Write( &doubleT, sizeof(double) );
|
||||
if ( OWNER_Element )
|
||||
{
|
||||
OWNER_Element->StatusCode = ERROR; // Estamos en proceso de COMPROBACION / ERROR
|
||||
OWNER_Element->BlinkCode = IP_OFF; // --- ERROR INTENTANDO COMUNICAR --
|
||||
OWNER_Element->Blink->Interval = 500;
|
||||
}
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Cierre de Windows " + Socket->LocalAddress + " :: " + ClientSocket->Address );
|
||||
break;
|
||||
case SettingSTATUS:
|
||||
CodOp = CtrlState;
|
||||
pStream->Write( &CodOp, sizeof(int) );
|
||||
pStream->Write( &doubleT, sizeof(double) );
|
||||
if ( OWNER_Element )
|
||||
{
|
||||
OWNER_Element->BlinkCode = NONE; // Desactivamos el parpadeo
|
||||
OWNER_Element->StatusCode = CtrlState ? WORKING : FREE;// Estamos en proceso de COLOCAR ESTADO
|
||||
OWNER_Element->Blink->Interval = 60000;
|
||||
OWNER_Element->ShowElementInfo();
|
||||
// Contabilizamos la conexión
|
||||
if ( CtrlState )
|
||||
OWNER_Element->HistoricoTermON( CtrlTiempo );
|
||||
}
|
||||
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Cambio de estado (" + (CtrlState ? "ON":"OFF") + ")" + Socket->LocalAddress + " :: " + ClientSocket->Address );
|
||||
break;
|
||||
case sendLIST:
|
||||
CodOp = CtrlPPal->siMinimizar->Count;
|
||||
// CtrlPPal->Memo1->Lines->Insert( 0, "Elementos A: " + AnsiString( CodOp ) );
|
||||
pStream->Write( &CodOp, sizeof(int) );
|
||||
for ( int i=0; i<CodOp; i++ )
|
||||
pStream->Write( (void *)((CtrlPPal->siMinimizar->Strings[i]).c_str()), sizeof(char)*15 );
|
||||
CodOp = CtrlPPal->noMinimizar->Count;
|
||||
pStream->Write( &CodOp, sizeof(int) );
|
||||
for ( int i=0; i<CodOp; i++ )
|
||||
pStream->Write( (void *)((CtrlPPal->noMinimizar->Strings[i]).c_str()), sizeof(char)*15 );
|
||||
|
||||
|
||||
CodOp = CtrlPPal->snMinimizar->Count;
|
||||
pStream->Write( &CodOp, sizeof(int) );
|
||||
for ( int i=0; i<CodOp; i++ )
|
||||
pStream->Write( (void *)((CtrlPPal->snMinimizar->Strings[i]).c_str()), sizeof(char)*15 );
|
||||
CodOp = CtrlPPal->noAbrir->Count;
|
||||
pStream->Write( &CodOp, sizeof(int) );
|
||||
for ( int i=0; i<CodOp; i++ )
|
||||
pStream->Write( (void *)((CtrlPPal->noAbrir->Strings[i]).c_str()), sizeof(char)*15 );
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pStream->WaitForData(30000);
|
||||
pStream->Read( &CodOp, sizeof(int) );
|
||||
if ( CodOp != 54321 )
|
||||
{
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Cliente RESPONDE ANORMALMENTE " + Socket->LocalAddress );
|
||||
}
|
||||
}
|
||||
catch (Exception &E)
|
||||
{
|
||||
if (!E.ClassNameIs("EAbort"))
|
||||
{
|
||||
if ( OWNER_Element )
|
||||
{
|
||||
OWNER_Element->StatusCode = ERROR; // Estamos en proceso de COMPROBACION / ERROR
|
||||
OWNER_Element->BlinkCode = IP_OFF; // --- ERROR INTENTANDO COMUNICAR --
|
||||
// OWNER_Element->Blink->Enabled = true; // Activamos el parpadeo
|
||||
OWNER_Element->Blink->Interval = 500;
|
||||
}
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Error en el HILO de " + Socket->LocalAddress );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
__finally
|
||||
{
|
||||
delete pStream;
|
||||
OWNER_Element = NULL;
|
||||
Socket->Close();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall ThreadSocket::Execute()
|
||||
{
|
||||
if ( SocketCreated )
|
||||
{
|
||||
CtrlPPal->AnySocketActive++;
|
||||
try {
|
||||
ClientSocket->Active = true;
|
||||
} catch (Exception &E) {
|
||||
if (!E.ClassNameIs("EAbort"))
|
||||
{
|
||||
if ( OWNER_Element )
|
||||
{
|
||||
OWNER_Element->StatusCode = ERROR; // Estamos en proceso de COMPROBACION / ERROR
|
||||
OWNER_Element->BlinkCode = IP_OFF; // --- ERROR INTENTANDO COMUNICAR --
|
||||
// OWNER_Element->Blink->Enabled = true; // Activamos el parpadeo
|
||||
OWNER_Element->Blink->Interval = 500;
|
||||
}
|
||||
CtrlPPal->Memo1->Lines->Insert( 0, (Now()).DateTimeString() + " :: Error en el HILO de " + ClientSocket->Address + " (" + E.Message+")" ); // you must write HandleThreadException
|
||||
}
|
||||
}
|
||||
|
||||
while ( !Terminated && ClientSocket->Active ); // Do nothing
|
||||
CtrlPPal->AnySocketActive--;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
////////////////// GESTION DE LOS HILOS DE COMUNICACIÓN /////////////////////
|
||||
void __fastcall ThreadSocket::Terminate(TObject *Sender) // this is the OnTerminate handler
|
||||
{
|
||||
if ( SocketCreated )
|
||||
{
|
||||
if ( ClientSocket->Active )
|
||||
ClientSocket->Active = false;
|
||||
delete ClientSocket;
|
||||
SocketCreated = false;
|
||||
}
|
||||
pCache->Add( this ); // add pointer to this thread to the cache
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
|
||||
|
37
CtrlSocket.h
Normal file
@ -0,0 +1,37 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef CtrlSocketH
|
||||
#define CtrlSocketH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <ScktComp.hpp>
|
||||
#include "CtrlElemento.h"
|
||||
//---------------------------------------------------------------------------
|
||||
TThreadList *pCache;
|
||||
enum CtrlCOPs { CloseWINDOWS = 6660, QueryTIME = 6661, SettingSTATUS = 6669, sendLIST = 6662 };
|
||||
|
||||
class ThreadSocket : public TThread
|
||||
{
|
||||
private:
|
||||
void __fastcall Terminate(TObject *Sender); // this is the OnTerminate handler
|
||||
protected:
|
||||
TClientSocket *ClientSocket;
|
||||
void __fastcall Execute();
|
||||
void __fastcall SocketDisconnect(TObject *Sender, TCustomWinSocket *Socket);
|
||||
void __fastcall SocketError(TObject *Sender, TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode);
|
||||
void __fastcall SocketConnect(TObject *Sender, TCustomWinSocket *Socket);
|
||||
public:
|
||||
bool CtrlState;
|
||||
CtrlCOPs CtrlCOP;
|
||||
TDateTime CtrlTiempo;
|
||||
|
||||
void __fastcall SetSocket( AnsiString IP_dst, int Socket );
|
||||
__fastcall ThreadSocket(bool CreateSuspended);
|
||||
TElemento *OWNER_Element;
|
||||
bool SocketCreated;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
//###########################################################################
|
||||
|
||||
#endif
|
33
CtrlSystem.bpg
Normal file
@ -0,0 +1,33 @@
|
||||
#------------------------------------------------------------------------------
|
||||
VERSION = BWS.01
|
||||
#------------------------------------------------------------------------------
|
||||
!ifndef ROOT
|
||||
ROOT = $(MAKEDIR)\..
|
||||
!endif
|
||||
#------------------------------------------------------------------------------
|
||||
MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
|
||||
DCC = $(ROOT)\bin\dcc32.exe $**
|
||||
BRCC = $(ROOT)\bin\brcc32.exe $**
|
||||
#------------------------------------------------------------------------------
|
||||
PROJECTS = CtrlMstr CtrlDogs DataViewer Install ReajustarDinero.exe
|
||||
#------------------------------------------------------------------------------
|
||||
default: $(PROJECTS)
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
CtrlMstr: CtrlMstr.bpr
|
||||
$(MAKE)
|
||||
|
||||
CtrlDogs: CtrlDogs.bpr
|
||||
$(MAKE)
|
||||
|
||||
DataViewer: DataViewer.bpr
|
||||
$(MAKE)
|
||||
|
||||
Install: Install.bpr
|
||||
$(MAKE)
|
||||
|
||||
ReajustarDinero.exe: ReajustarDinero.bpr
|
||||
$(ROOT)\bin\bpr2mak $**
|
||||
$(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
|
||||
|
||||
|
1
DBDWORK.INI
Normal file
@ -0,0 +1 @@
|
||||
|
589
DViewer.cpp
Normal file
@ -0,0 +1,589 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <io.h>
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include <winuser.h>
|
||||
|
||||
#include "DViewer.h"
|
||||
#include "DViewer_Print.h"
|
||||
#include "DViewer_PrintHistoric.h"
|
||||
#include "DViewer_PrintBonos.h"
|
||||
#include "DViewer_PrintClientes.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "ElastFrm"
|
||||
#pragma link "ElastFrm"
|
||||
#pragma resource "*.dfm"
|
||||
TDViewerF *DViewerF;
|
||||
//---------------------------------------------------------------------------
|
||||
#define TIPO_CONEXION 1
|
||||
#define CAMBIO_PERIODO 2
|
||||
|
||||
__fastcall TDViewerF::TDViewerF(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
MargenRuptura->ItemIndex = 1;
|
||||
SelIndex->ItemIndex = 1;
|
||||
MinFecha->Date = TDateTime::CurrentDate();
|
||||
MaxFecha->Date = TDateTime::CurrentDate();
|
||||
TerminalFiltered = false;
|
||||
RefiltraDatos();
|
||||
StatusBar1->Panels->Items[0]->Text = "Visualizador listo...";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDViewerF::TbHistoricoBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
// Si la tabla no existe, la creamos
|
||||
if ( access( (TbHistorico -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
ShowMessage( "Esta aplicación es un complemento de visualización a CtrlMstr\nY no puede se ejecutada por separado\n(Primero a de activar el control maestro)" );
|
||||
Abort();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDViewerF::TbHistoricoCalcFields(TDataSet *DataSet)
|
||||
{
|
||||
switch ( TbHistorico->FieldByName("idtc")->AsInteger )
|
||||
{
|
||||
// Internet
|
||||
case 0: TbHistorico->FieldByName("TipoConexion")->AsString="Internet"; break;
|
||||
// Juegos
|
||||
case 1: TbHistorico->FieldByName("TipoConexion")->AsString="Juegos"; break;
|
||||
// Otros
|
||||
case 2: TbHistorico->FieldByName("TipoConexion")->AsString="Otros..."; break;
|
||||
// Envio de Listas
|
||||
case 3: TbHistorico->FieldByName("TipoConexion")->AsString="Clases"; break;
|
||||
// Envio de Listas
|
||||
case 997: TbHistorico->FieldByName("TipoConexion")->AsString="ENVIO LISTAS"; break;
|
||||
// Tiempo Anulado
|
||||
case 998: TbHistorico->FieldByName("TipoConexion")->AsString="TIEMPO ANULADO"; break;
|
||||
// Cierre de Windows
|
||||
case 999: TbHistorico->FieldByName("TipoConexion")->AsString="Cerrar Windows"; break;
|
||||
default: TbHistorico->FieldByName("TipoConexion")->AsString="DESCONOCIDA"; break;
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TDViewerF::Obten_idtc(void)
|
||||
{
|
||||
int dev;
|
||||
switch( (idtConexion->ItemIndex-1) )
|
||||
{
|
||||
case 0:
|
||||
dev = 0;
|
||||
break;
|
||||
case 1:
|
||||
dev = 1;
|
||||
break;
|
||||
case 2:
|
||||
dev = 3;
|
||||
break;
|
||||
case 3:
|
||||
dev = 2;
|
||||
break;
|
||||
case 4:
|
||||
dev = 997;
|
||||
break;
|
||||
case 5:
|
||||
dev = 998;
|
||||
break;
|
||||
case 6:
|
||||
dev = 999;
|
||||
break;
|
||||
default:
|
||||
dev = 0;
|
||||
break;
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDViewerF::RefiltraDatos(void)
|
||||
{
|
||||
StatusBar1->Panels->Items[0]->Text = "Evaluando filtro...";
|
||||
|
||||
TDateTime FechaMin, FechaMax;
|
||||
TbHistorico->FilterOptions = TbHistorico->FilterOptions << foCaseInsensitive;
|
||||
|
||||
MaxFecha->Time = 36544.9999891088;//EncodeTime( 23, 59, 59, 59 );
|
||||
FechaMax = MaxFecha->Date;
|
||||
MinFecha->Time = 0;
|
||||
FechaMin = MinFecha->Date;
|
||||
|
||||
TbHistorico->Filter = "[FComienzo] >= '" + FechaMin + "' AND [FComienzo] <= '" + FechaMax +"'";
|
||||
TbHistorico->Filtered = true;
|
||||
|
||||
// Refiltramos los bonos
|
||||
TbBonos->FilterOptions = TbBonos->FilterOptions << foCaseInsensitive;
|
||||
TbBonos->Filter = "[FechaCompra] >= '" + FechaMin + "' AND [FechaCompra] <= '" + FechaMax +"'";
|
||||
TbBonos->Filtered = true;
|
||||
|
||||
StatusBar1->Panels->Items[0]->Text = "Rellenando gráficas...";
|
||||
CalculaGraficas();
|
||||
StatusBar1->Panels->Items[0]->Text = "";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDViewerF::CalculaGraficas(void)
|
||||
{
|
||||
unsigned short hh, mm, ss, mss;
|
||||
Currency TotalF, TotalR;
|
||||
int NConF, NConR, NumBonos;
|
||||
|
||||
TDateTime HoraFinAnterior; // Hora a la que debío acabar el elto. anterior
|
||||
int EltoAnterior; // Elemento anterior
|
||||
TDateTime Ruptura; // Tiempo Maximo para admitir que la conexion actual
|
||||
// es continuacion de la anterior (¿Reinicia la máquina?)
|
||||
|
||||
TbHistorico->DisableControls(); // Deshabilitamos los controles asociados
|
||||
|
||||
NumBonos = 0;
|
||||
NConF = 0; NConR = 0;
|
||||
TotalF = 0; TotalR = 0;
|
||||
ProgressBar1->Min = 0;
|
||||
ProgressBar1->Max = TbElementos->RecordCount;
|
||||
HoraFinAnterior = 0;
|
||||
EltoAnterior = 0;
|
||||
if ( MargenRuptura->ItemIndex == -1 )
|
||||
Ruptura = EncodeTime( 0, 0, 0, 0 );
|
||||
else
|
||||
Ruptura = EncodeTime( 0, (MargenRuptura->ItemIndex + 1)*5, 0, 0 );
|
||||
|
||||
// Vaciamos las conexiones / hora
|
||||
for ( int i = 0; i<48; i++ )
|
||||
{
|
||||
ConexionesHoraR[ i ] = 0;
|
||||
ConexionesHoraF[ i ] = 0;
|
||||
}
|
||||
// Vaciamos los tipos de conexiones
|
||||
for ( int i=0; i < 8; i++ )
|
||||
NConexionesTipo[i] = 0;
|
||||
// Vaciamos la parrilla de datos
|
||||
for ( int i=0; i < Equipos->Items->Count; i++ )
|
||||
{
|
||||
Parrilla[i].ConF = 0;
|
||||
Parrilla[i].TotalF = 0;
|
||||
Parrilla[i].ConR = 0;
|
||||
Parrilla[i].TotalR = 0;
|
||||
Parrilla[i].horasF = 0;
|
||||
Parrilla[i].horasR = 0;
|
||||
Parrilla[i].minF = 0;
|
||||
Parrilla[i].minR = 0;
|
||||
}
|
||||
|
||||
TbHistorico->First();
|
||||
while ( ! TbHistorico->Eof )
|
||||
{
|
||||
// Si se trata de una conexion
|
||||
if ( TbHistorico->FieldByName("idtc")->AsInteger < 50 )
|
||||
{
|
||||
NConF ++;
|
||||
TotalF += TbHistorico->FieldByName("Precio")->AsCurrency;
|
||||
TbHistorico->FieldByName("FComienzo")->AsDateTime. DecodeTime( &hh, &mm, &ss, &mss );
|
||||
ConexionesHoraF[hh*2+ ((mm<30)?0:1)] ++;
|
||||
|
||||
// Si el elemento que estamos estudiando:
|
||||
// -- Termina su tiempo "justo" ó ANTES que cuando debía hacerlo su ultima conexion
|
||||
if ( TbHistorico->FieldByName( "NumElement" )->AsInteger == EltoAnterior &&
|
||||
(TbHistorico->FieldByName("FComienzo")->AsDateTime +
|
||||
TbHistorico->FieldByName("Tiempo")->AsDateTime ) <= HoraFinAnterior
|
||||
)
|
||||
{
|
||||
// Estamos ante una conexión REAL
|
||||
InsertaEnParrilla( TbHistorico->FieldByName("NumElement")->AsInteger,
|
||||
TbHistorico->FieldByName("Precio" ) ->AsCurrency,
|
||||
TbHistorico->FieldByName("Tiempo" ) ->AsDateTime,
|
||||
false
|
||||
);
|
||||
} else {
|
||||
NConR++;
|
||||
TotalR += TbHistorico->FieldByName("Precio")->AsCurrency;
|
||||
ConexionesHoraR[hh*2+ ((mm<30)?0:1)] ++;
|
||||
|
||||
InsertaEnParrilla( TbHistorico->FieldByName("NumElement")->AsInteger,
|
||||
TbHistorico->FieldByName("Precio" ) ->AsCurrency,
|
||||
TbHistorico->FieldByName("Tiempo" ) ->AsDateTime,
|
||||
true
|
||||
);
|
||||
|
||||
switch ( TbHistorico->FieldByName("idtc")->AsInteger )
|
||||
{
|
||||
case 0: NConexionesTipo[0]++; break; // Internet
|
||||
case 1: NConexionesTipo[1]++; break; // Juegos
|
||||
case 2: NConexionesTipo[2]++; break; // Otros
|
||||
case 3: NConexionesTipo[3]++; break; // Clases
|
||||
default: NConexionesTipo[7]++; break; // -- DECONOCIDO --
|
||||
}
|
||||
}
|
||||
EltoAnterior = TbHistorico->FieldByName("NumElement")->AsInteger;
|
||||
HoraFinAnterior = TbHistorico->FieldByName("FComienzo")->AsDateTime +
|
||||
TbHistorico->FieldByName("Tiempo")->AsDateTime +
|
||||
Ruptura;
|
||||
} else {
|
||||
switch ( TbHistorico->FieldByName("idtc")->AsInteger )
|
||||
{
|
||||
case 997: NConexionesTipo[4]++; break; // Envio de Listas
|
||||
case 998: NConexionesTipo[5]++; break; // Tiempo Anulado
|
||||
case 999: NConexionesTipo[6]++; break; // Cierre de Windows
|
||||
default: NConexionesTipo[7]++; break; // -- DECONOCIDO --
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Cuando se usa bonos
|
||||
if ( TbHistorico->FieldByName("idc")->AsInteger > 0 &&
|
||||
TbHistorico->FieldByName("precio")->AsCurrency == 0
|
||||
)
|
||||
{
|
||||
NumBonos++;
|
||||
}
|
||||
|
||||
ProgressBar1->Position++;
|
||||
try { TbHistorico->Next(); } catch( ... ) { break; }
|
||||
}
|
||||
|
||||
TbHistorico->EnableControls(); // Habilitamos de nuevo los controles
|
||||
|
||||
|
||||
ConexionesHora -> Series[0] -> Clear();
|
||||
ConexionesHora -> Series[1] -> Clear();
|
||||
for ( int i = 0; i < 24; i++ )
|
||||
{
|
||||
ConexionesHora -> Series[0] -> AddXY(i*2, ConexionesHoraF[i*2], i, clTeeColor);
|
||||
ConexionesHora -> Series[0] -> AddXY(i*2+1, ConexionesHoraF[i*2+1], "½", clTeeColor);
|
||||
|
||||
ConexionesHora -> Series[1] -> AddXY(i*2, ConexionesHoraR[i*2], i, clTeeColor);
|
||||
ConexionesHora -> Series[1] -> AddXY(i*2+1, ConexionesHoraR[i*2+1], "½", clTeeColor);
|
||||
}
|
||||
|
||||
|
||||
// StatusBar1->Panels->Items[1]->Text = TotalF;
|
||||
ConexionesEquipos -> Series[0] -> Clear();
|
||||
ConexionesEquipos -> Series[1] -> Clear();
|
||||
for ( int i=0; i < Equipos->Items->Count; i++ )
|
||||
{
|
||||
StringGrid1->Cells[2][1+i] = Parrilla[i].ConF ;
|
||||
StringGrid1->Cells[4][1+i] = Parrilla[i].TotalF ;
|
||||
StringGrid1->Cells[3][1+i] = Parrilla[i].ConR ;
|
||||
StringGrid1->Cells[5][1+i] = Parrilla[i].TotalR ;
|
||||
StringGrid1->Cells[6][1+i] = AnsiString( Parrilla[i].horasF )+ " : " + AnsiString( Parrilla[i].minF );
|
||||
StringGrid1->Cells[7][1+i] = AnsiString( Parrilla[i].horasR )+ " : " + AnsiString( Parrilla[i].minR );
|
||||
ConexionesEquipos -> Series[0] -> Add( Parrilla[i].TotalF, Equipos->Items->Strings[i], clGreen );
|
||||
ConexionesEquipos -> Series[1] -> Add( Parrilla[i].TotalR, "", clRed );
|
||||
}
|
||||
|
||||
// Etiquetas globales
|
||||
Label4->Caption = NConR;
|
||||
Label6->Caption = NConF;
|
||||
Label8->Caption = TotalR;
|
||||
Label9->Caption = TotalF;
|
||||
NBonos->Caption = NumBonos;
|
||||
|
||||
|
||||
// Rellenamos la gráfica TIPO de Conexion
|
||||
TipoConexion->Series[0]->Clear();
|
||||
TipoConexion->Series[0]->Add( NConexionesTipo[0], "Internet", clTeeColor );
|
||||
TipoConexion->Series[0]->Add( NConexionesTipo[1], "Juegos", clTeeColor );
|
||||
TipoConexion->Series[0]->Add( NConexionesTipo[2], "Otros", clTeeColor );
|
||||
TipoConexion->Series[0]->Add( NConexionesTipo[3], "Clases", clTeeColor );
|
||||
TipoConexion->Series[0]->Add( NConexionesTipo[4], "Env.Listas", clTeeColor );
|
||||
TipoConexion->Series[0]->Add( NConexionesTipo[5], "Anulaciones", clTeeColor );
|
||||
TipoConexion->Series[0]->Add( NConexionesTipo[6], "Cierres", clTeeColor );
|
||||
TipoConexion->Series[0]->Add( NConexionesTipo[7], "## NID ##", clTeeColor );
|
||||
|
||||
TbBonos->DisableControls(); // Deshabilitamos los controles asociados
|
||||
NBonosVendidos = 0;
|
||||
TotalBonos = 0;
|
||||
TbBonos->First();
|
||||
while ( ! TbBonos->Eof )
|
||||
{
|
||||
NBonosVendidos++;
|
||||
TotalBonos += TbBonos->FieldByName("coste")->AsCurrency;
|
||||
TbBonos->Next();
|
||||
}
|
||||
TbBonos->EnableControls(); // Deshabilitamos los controles asociados
|
||||
BonosVendidos->Caption = AnsiString( NBonosVendidos ) + " ( " + TotalBonos + " )";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDViewerF::InsertaEnParrilla( int Elto, Currency CantidadF, TDateTime Tiempo, bool Repetido )
|
||||
{
|
||||
unsigned short Hour, Min, Sec, MSec;
|
||||
Tiempo.DecodeTime( &Hour, &Min, &Sec, &MSec );
|
||||
|
||||
// Localizamos la casilla del elemento
|
||||
for ( int i=0; i < Equipos->Items->Count; i++ )
|
||||
if ( Parrilla[i].Elto == Elto )
|
||||
{
|
||||
Parrilla[i].ConF ++;
|
||||
Parrilla[i].TotalF = Parrilla[i].TotalF + CantidadF;
|
||||
|
||||
Parrilla[i].horasF += Hour + ( ( Parrilla[i].minF + Min ) / 60 );
|
||||
Parrilla[i].minF = ( Parrilla[i].minF + Min ) % 60;
|
||||
|
||||
if ( Repetido )
|
||||
{
|
||||
Parrilla[i].ConR ++;
|
||||
Parrilla[i].TotalR = Parrilla[i].TotalR + CantidadF;
|
||||
|
||||
Parrilla[i].horasR += Hour + ( ( Parrilla[i].minR + Min ) / 60 );
|
||||
Parrilla[i].minR = ( Parrilla[i].minR + Min ) % 60;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDViewerF::MinFechaChange(TObject *Sender)
|
||||
{
|
||||
RefiltraDatos();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDViewerF::DBGrid1DrawColumnCell(TObject *Sender,
|
||||
const TRect &Rect, int DataCol, TColumn *Column,
|
||||
TGridDrawState State)
|
||||
{
|
||||
if ( TbHistorico->FieldByName("idtc")->AsInteger > 900 )
|
||||
{
|
||||
if ( TbHistorico->FieldByName("idtc")->AsInteger == 998 )
|
||||
DBGrid1->Canvas -> Font -> Color = clGreen;
|
||||
else
|
||||
DBGrid1->Canvas -> Font -> Color = clRed;
|
||||
DBGrid1->DefaultDrawColumnCell( Rect, DataCol, Column, State );
|
||||
}
|
||||
if ( TbHistorico->FieldByName("idc")->AsInteger > 0 &&
|
||||
TbHistorico->FieldByName("precio")->AsCurrency == 0
|
||||
)
|
||||
{
|
||||
DBGrid1->Canvas -> Font -> Color = clPurple;
|
||||
DBGrid1->DefaultDrawColumnCell( Rect, DataCol, Column, State );
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDViewerF::TbElementosAfterOpen(TDataSet *DataSet)
|
||||
{
|
||||
ProgressBar1->Min = 0;
|
||||
ProgressBar1->Max = TbElementos->RecordCount;
|
||||
StringGrid1->RowCount = TbElementos->RecordCount + 1;
|
||||
|
||||
Parrilla = new DatosEltos[(TbElementos->RecordCount)];
|
||||
TbElementos->First();
|
||||
for (int i = ProgressBar1->Min; i < ProgressBar1->Max; i++)
|
||||
{
|
||||
ProgressBar1->Position = i;
|
||||
Equipos->Items->Add(TbElementos->FieldByName("Name")->AsString);
|
||||
|
||||
Parrilla[i].Elto = TbElementos->FieldByName("NumElement")->AsInteger;
|
||||
StringGrid1->Cells[0][i+1] = TbElementos->FieldByName("NumElement")->AsInteger;
|
||||
StringGrid1->Cells[1][i+1] = TbElementos->FieldByName("Name")->AsString;
|
||||
|
||||
TbElementos->Next();
|
||||
// do something with record...
|
||||
}
|
||||
|
||||
StringGrid1->Cells[2][0] = "ConexF";
|
||||
StringGrid1->Cells[3][0] = "ConexR";
|
||||
StringGrid1->Cells[4][0] = "TotalF";
|
||||
StringGrid1->Cells[5][0] = "TotalR";
|
||||
StringGrid1->Cells[6][0] = "TiempoF";
|
||||
StringGrid1->Cells[7][0] = "TiempoR";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TDViewerF::FormDestroy(TObject *Sender)
|
||||
{
|
||||
delete[] Parrilla;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::idtConexionChange(TObject *Sender)
|
||||
{
|
||||
TDateTime FechaMin, FechaMax;
|
||||
TbHistorico->FilterOptions = TbHistorico->FilterOptions << foCaseInsensitive;
|
||||
|
||||
MaxFecha->Time = 36544.9999891088;//EncodeTime( 23, 59, 59, 59 );
|
||||
FechaMax = MaxFecha->Date;
|
||||
MinFecha->Time = 0;
|
||||
FechaMin = MinFecha->Date;
|
||||
|
||||
if ( idtConexion->ItemIndex > 0 )
|
||||
{
|
||||
AnsiString CadenaFiltro = "([FComienzo] >= '" + FechaMin + "' AND [FComienzo] <= '" + FechaMax +"' AND [idtc] = '" + AnsiString( Obten_idtc() ) + "' )";
|
||||
TbHistorico->Filter = CadenaFiltro;
|
||||
TbHistorico->Filtered = true;
|
||||
} else {
|
||||
TbHistorico->Filter = "[FComienzo] >= '" + FechaMin + "' AND [FComienzo] <= '" + FechaMax +"'";
|
||||
TbHistorico->Filtered = true;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::Button1Click(TObject *Sender)
|
||||
{
|
||||
TQuickReport1 *QR;
|
||||
|
||||
StatusBar1->Panels->Items[0]->Text = "Preparando documento para imprimir...";
|
||||
QR = new TQuickReport1(this);
|
||||
QR->Preview();
|
||||
StatusBar1->Panels->Items[0]->Text = "";
|
||||
delete QR;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::Button2Click(TObject *Sender)
|
||||
{
|
||||
TQRHistoric *QR;
|
||||
|
||||
QR = new TQRHistoric(this);
|
||||
StatusBar1->Panels->Items[0]->Text = "Preparando documento para imprimir...";
|
||||
QR->QuickRep1->Print();
|
||||
StatusBar1->Panels->Items[0]->Text = "";
|
||||
delete QR;
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::Edit1KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( !Edit1->Text.IsEmpty() )
|
||||
TbPersonas->Locate( SelIndex->Items->Strings[SelIndex->ItemIndex], Edit1->Text, TLocateOptions() << loCaseInsensitive << loPartialKey );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::DBEdit1KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
if(TbPersonas->State == dsInsert || TbPersonas->State == dsEdit)
|
||||
TbPersonas->Post();
|
||||
DBEdit2->SetFocus();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::DBEdit2KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
if(TbPersonas->State == dsInsert || TbPersonas->State == dsEdit)
|
||||
TbPersonas->Post();
|
||||
DBEdit3->SetFocus();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::DBEdit3KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
if(TbPersonas->State == dsInsert || TbPersonas->State == dsEdit)
|
||||
TbPersonas->Post();
|
||||
DBEdit4->SetFocus();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::DBEdit4KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
if(TbPersonas->State == dsInsert || TbPersonas->State == dsEdit)
|
||||
TbPersonas->Post();
|
||||
DBEdit5->SetFocus();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::DBEdit5KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
if(TbPersonas->State == dsInsert || TbPersonas->State == dsEdit)
|
||||
TbPersonas->Post();
|
||||
DBEdit6->SetFocus();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::DBEdit6KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
if(TbPersonas->State == dsInsert || TbPersonas->State == dsEdit)
|
||||
TbPersonas->Post();
|
||||
DBEdit1->SetFocus();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::TbPersonasBeforeDelete(TDataSet *DataSet)
|
||||
{
|
||||
switch( MessageDlg( "Atención, está apunto de eliminar\na un cliente...\n¡¡¡ Su historico TAMBIEN será ELIMINADO\n¿Realmente desea continuar?", mtWarning, TMsgDlgButtons() << mbNo << mbYes, 0 ) )
|
||||
{
|
||||
case mrNo:
|
||||
Abort();
|
||||
break;
|
||||
default:
|
||||
// Borramos todos los registros asociados...
|
||||
while( TbBonosCliente -> RecordCount != 0 )
|
||||
TbBonosCliente -> Delete();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::TbPersonasNewRecord(TDataSet *DataSet)
|
||||
{
|
||||
TbPersonas->FieldByName("FAlta")->AsDateTime = TDateTime::CurrentDateTime();
|
||||
TbPersonas->FieldByName("FModif")->AsDateTime = TDateTime::CurrentDateTime();
|
||||
TbPersonas->FieldByName("TiempoH")->AsInteger = 0;
|
||||
TbPersonas->FieldByName("TiempoM")->AsInteger = 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDViewerF::Button4Click(TObject *Sender)
|
||||
{
|
||||
TQRBonos *QR;
|
||||
|
||||
QR = new TQRBonos(this);
|
||||
StatusBar1->Panels->Items[0]->Text = "Preparando documento para imprimir...";
|
||||
QR->QuickRep1->Print();
|
||||
StatusBar1->Panels->Items[0]->Text = "";
|
||||
delete QR;
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TDViewerF::Button3Click(TObject *Sender)
|
||||
{
|
||||
TQRClt *QR;
|
||||
|
||||
QR = new TQRClt(this);
|
||||
StatusBar1->Panels->Items[0]->Text = "Preparando documento para imprimir...";
|
||||
QR->QuickRep1->Print();
|
||||
StatusBar1->Panels->Items[0]->Text = "";
|
||||
delete QR;
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TDViewerF::EquiposClick(TObject *Sender)
|
||||
{
|
||||
|
||||
if ( TbElementos->Locate( "Name", Equipos->Items->Strings[Equipos->ItemIndex], TLocateOptions() << loCaseInsensitive << loPartialKey ) )
|
||||
// Localizamos el primer registro del terminal seleccionado...
|
||||
TbHistorico->Locate( "NumElement", TbElementos->FieldByName("NumElement")->AsInteger, TLocateOptions() << loCaseInsensitive << loPartialKey );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
BIN
DViewer.dfm
Normal file
192
DViewer.h
Normal file
@ -0,0 +1,192 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef DViewerH
|
||||
#define DViewerH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include <Db.hpp>
|
||||
#include <DBTables.hpp>
|
||||
#include <DBGrids.hpp>
|
||||
#include <Grids.hpp>
|
||||
#include <Buttons.hpp>
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <ComCtrls.hpp>
|
||||
#include <CheckLst.hpp>
|
||||
#include <Chart.hpp>
|
||||
#include <Series.hpp>
|
||||
#include <TeEngine.hpp>
|
||||
#include <TeeProcs.hpp>
|
||||
#include <ImgList.hpp>
|
||||
#include <DBCtrls.hpp>
|
||||
#include <Mask.hpp>
|
||||
#include "elastfrm.hpp"
|
||||
#include "ElastFrm.hpp"
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
class TDViewerF : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TTable *TbHistorico;
|
||||
TDataSource *DsHistorico;
|
||||
TIntegerField *TbHistoricoNumElement;
|
||||
TDateTimeField *TbHistoricoFComienzo;
|
||||
TTimeField *TbHistoricoTiempo;
|
||||
TIntegerField *TbHistoricoidc;
|
||||
TIntegerField *TbHistoricoidtc;
|
||||
TCurrencyField *TbHistoricoprecio;
|
||||
TStringField *TbHistoricoTipoConexion;
|
||||
TTable *TbElementos;
|
||||
TStringField *TbHistoricoNombreTerminal;
|
||||
TDataSource *DsElementos;
|
||||
TStatusBar *StatusBar1;
|
||||
TPanel *Panel2;
|
||||
TPanel *Panel3;
|
||||
TDateTimePicker *MinFecha;
|
||||
TComboBox *idtConexion;
|
||||
TCheckListBox *Equipos;
|
||||
TDateTimePicker *MaxFecha;
|
||||
TLabel *Label1;
|
||||
TLabel *Label2;
|
||||
TSplitter *Splitter1;
|
||||
TProgressBar *ProgressBar1;
|
||||
TPageControl *PageControl1;
|
||||
TTabSheet *TabSheet1;
|
||||
TLabel *Label3;
|
||||
TLabel *Label4;
|
||||
TLabel *Label5;
|
||||
TLabel *Label6;
|
||||
TTabSheet *TabSheet2;
|
||||
TChart *ConexionesEquipos;
|
||||
TTabSheet *TabSheet3;
|
||||
TChart *TipoConexion;
|
||||
TPieSeries *Series3;
|
||||
TTabSheet *TabSheet4;
|
||||
TChart *ConexionesHora;
|
||||
TLabel *Label7;
|
||||
TLabel *Label8;
|
||||
TLabel *Label9;
|
||||
TLabel *Label10;
|
||||
TComboBox *MargenRuptura;
|
||||
TLabel *Label11;
|
||||
TPageControl *PageControl2;
|
||||
TTabSheet *TabSheet5;
|
||||
TDBGrid *DBGrid1;
|
||||
TTabSheet *TabSheet6;
|
||||
TBevel *Bevel1;
|
||||
TStringGrid *StringGrid1;
|
||||
TLabel *Label12;
|
||||
TLabel *Label13;
|
||||
TLabel *NBonos;
|
||||
TBarSeries *Series1;
|
||||
TBarSeries *Series2;
|
||||
TAreaSeries *Series4;
|
||||
TAreaSeries *Series5;
|
||||
TButton *Button1;
|
||||
TTabSheet *TabSheet7;
|
||||
TDBGrid *DBGrid2;
|
||||
TTable *TbPersonas;
|
||||
TTable *TbBonos;
|
||||
TDataSource *DsBonos;
|
||||
TIntegerField *TbBonosIDcliente;
|
||||
TDateTimeField *TbBonosFechaCompra;
|
||||
TIntegerField *TbBonosBhoras;
|
||||
TIntegerField *TbBonosBmin;
|
||||
TCurrencyField *TbBonoscoste;
|
||||
TStringField *TbBonosNombreClt;
|
||||
TStringField *TbBonosApellidos;
|
||||
TLabel *Label14;
|
||||
TLabel *BonosVendidos;
|
||||
TButton *Button2;
|
||||
TTabSheet *TabSheet8;
|
||||
TImageList *Historicos;
|
||||
TPanel *Panel1;
|
||||
TDBGrid *DBGrid3;
|
||||
TDataSource *DsPersonas;
|
||||
TTable *TbBonosCliente;
|
||||
TDataSource *DsBonosClientes;
|
||||
TComboBox *SelIndex;
|
||||
TEdit *Edit1;
|
||||
TDBNavigator *DBNavigator1;
|
||||
TBevel *Bevel2;
|
||||
TLabel *Label15;
|
||||
TLabel *Label16;
|
||||
TLabel *Label17;
|
||||
TDBEdit *DBEdit1;
|
||||
TLabel *Label18;
|
||||
TDBText *DBText1;
|
||||
TDBEdit *DBEdit2;
|
||||
TDBEdit *DBEdit3;
|
||||
TDBEdit *DBEdit4;
|
||||
TLabel *Label19;
|
||||
TDBEdit *DBEdit5;
|
||||
TDBEdit *DBEdit6;
|
||||
TShape *Shape1;
|
||||
TShape *Shape2;
|
||||
TLabel *Label20;
|
||||
TDBText *DBText2;
|
||||
TButton *Button3;
|
||||
TButton *Button4;
|
||||
TElasticForm *ElasticForm1;
|
||||
void __fastcall TbHistoricoBeforeOpen(TDataSet *DataSet);
|
||||
void __fastcall TbHistoricoCalcFields(TDataSet *DataSet);
|
||||
void __fastcall MinFechaChange(TObject *Sender);
|
||||
|
||||
void __fastcall DBGrid1DrawColumnCell(TObject *Sender,
|
||||
const TRect &Rect, int DataCol, TColumn *Column,
|
||||
TGridDrawState State);
|
||||
void __fastcall TbElementosAfterOpen(TDataSet *DataSet);
|
||||
void __fastcall FormDestroy(TObject *Sender);
|
||||
void __fastcall idtConexionChange(TObject *Sender);
|
||||
void __fastcall Button1Click(TObject *Sender);
|
||||
void __fastcall Button2Click(TObject *Sender);
|
||||
void __fastcall Edit1KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit1KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit2KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit3KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit4KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit5KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit6KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall TbPersonasBeforeDelete(TDataSet *DataSet);
|
||||
void __fastcall TbPersonasNewRecord(TDataSet *DataSet);
|
||||
void __fastcall Button4Click(TObject *Sender);
|
||||
void __fastcall Button3Click(TObject *Sender);
|
||||
void __fastcall EquiposClick(TObject *Sender);
|
||||
|
||||
private: // User declarations
|
||||
int __fastcall Obten_idtc(void);
|
||||
bool TerminalFiltered;
|
||||
void __fastcall RefiltraDatos(void);
|
||||
|
||||
public: // User declarations
|
||||
__fastcall TDViewerF(TComponent* Owner);
|
||||
void __fastcall CalculaGraficas(void);
|
||||
void __fastcall InsertaEnParrilla( int Elto, Currency CantidadF, TDateTime Tiempo, bool Repetido );
|
||||
|
||||
struct DatosEltos
|
||||
{
|
||||
int Elto;
|
||||
int ConF, ConR;
|
||||
Currency TotalF, TotalR;
|
||||
int horasF, minF;
|
||||
int horasR, minR;
|
||||
} *Parrilla;
|
||||
|
||||
int NConexionesTipo[8];
|
||||
int ConexionesHoraF[48], ConexionesHoraR[48];
|
||||
|
||||
int NBonosVendidos;
|
||||
Currency TotalBonos;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TDViewerF *DViewerF;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
51
DViewer_Print.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
//----------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "DViewer_Print.h"
|
||||
#include "DViewer.h"
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma resource "*.dfm"
|
||||
TQuickReport1 *QuickReport1;
|
||||
//----------------------------------------------------------------------------
|
||||
__fastcall TQuickReport1::TQuickReport1(TComponent* Owner)
|
||||
: TQuickRep(Owner)
|
||||
{
|
||||
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
void __fastcall TQuickReport1::QuickRepStartPage(TCustomQuickRep *Sender)
|
||||
{
|
||||
QRConexionesF->Caption = DViewerF->Label4->Caption + " ( " + DViewerF->Label8->Caption + " )";
|
||||
QRConexionesR->Caption = DViewerF->Label6->Caption + " ( " + DViewerF->Label9->Caption + " )";
|
||||
QRNBonos->Caption = DViewerF->NBonos->Caption;
|
||||
QRRuptura->Caption = DViewerF->MargenRuptura->SelText;
|
||||
QRBonosVendidos->Caption = DViewerF->BonosVendidos->Caption;
|
||||
|
||||
QRMemo1->Lines->Clear();
|
||||
QRMemo2->Lines->Clear();
|
||||
QRMemo3->Lines->Clear();
|
||||
QRMemo4->Lines->Clear();
|
||||
QRMemo5->Lines->Clear();
|
||||
QRMemo6->Lines->Clear();
|
||||
QRMemo7->Lines->Clear();
|
||||
QRMemo8->Lines->Clear();
|
||||
// Rellenamos la tabla de datos
|
||||
for (int i = 0; i < DViewerF->Equipos->Items->Count; i++)
|
||||
{
|
||||
QRMemo2->Lines->Add( DViewerF->StringGrid1->Cells[0][i+1] );
|
||||
QRMemo1->Lines->Add( DViewerF->StringGrid1->Cells[1][i+1] );
|
||||
|
||||
QRMemo3->Lines->Add( DViewerF->StringGrid1->Cells[2][i+1] );
|
||||
QRMemo4->Lines->Add( DViewerF->StringGrid1->Cells[3][i+1] );
|
||||
QRMemo5->Lines->Add( DViewerF->StringGrid1->Cells[4][i+1] );
|
||||
QRMemo6->Lines->Add( DViewerF->StringGrid1->Cells[5][i+1] );
|
||||
QRMemo7->Lines->Add( DViewerF->StringGrid1->Cells[6][i+1] );
|
||||
QRMemo8->Lines->Add( DViewerF->StringGrid1->Cells[7][i+1] );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
BIN
DViewer_Print.dfm
Normal file
64
DViewer_Print.h
Normal file
@ -0,0 +1,64 @@
|
||||
//----------------------------------------------------------------------------
|
||||
#ifndef DViewer_PrintH
|
||||
#define DViewer_PrintH
|
||||
//----------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\QuickRpt.hpp>
|
||||
#include <vcl\QRCtrls.hpp>
|
||||
#include <Chart.hpp>
|
||||
#include <DBChart.hpp>
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <QrTee.hpp>
|
||||
#include <TeEngine.hpp>
|
||||
#include <TeeProcs.hpp>
|
||||
#include <Qrctrls.hpp>
|
||||
#include <Series.hpp>
|
||||
//----------------------------------------------------------------------------
|
||||
class TQuickReport1 : public TQuickRep
|
||||
{
|
||||
__published:
|
||||
TQRBand *QRBand1;
|
||||
TQRBand *QRBand2;
|
||||
TQRChart *ConexionesHora;
|
||||
TQRDBChart *QRDBChart1;
|
||||
TAreaSeries *Series1;
|
||||
TAreaSeries *Series2;
|
||||
TQRChart *TipoConexion;
|
||||
TQRDBChart *QRDBChart2;
|
||||
TPieSeries *Series3;
|
||||
TQRChart *ConexionesEquipos;
|
||||
TQRDBChart *QRDBChart3;
|
||||
TBarSeries *Series4;
|
||||
TBarSeries *Series5;
|
||||
TQRLabel *QRLabel7;
|
||||
TQRLabel *QRNBonos;
|
||||
TQRLabel *QRConexionesR;
|
||||
TQRLabel *QRConexionesF;
|
||||
TQRLabel *QRLabel3;
|
||||
TQRLabel *QRLabel1;
|
||||
TQRLabel *QRLabel2;
|
||||
TQRMemo *QRMemo1;
|
||||
TQRLabel *QRLabel8;
|
||||
TQRLabel *QRRuptura;
|
||||
TQRMemo *QRMemo2;
|
||||
TQRLabel *QRLabel4;
|
||||
TQRMemo *QRMemo3;
|
||||
TQRMemo *QRMemo4;
|
||||
TQRMemo *QRMemo5;
|
||||
TQRMemo *QRMemo6;
|
||||
TQRMemo *QRMemo7;
|
||||
TQRMemo *QRMemo8;
|
||||
TQRLabel *QRLabel5;
|
||||
TQRLabel *QRBonosVendidos;
|
||||
void __fastcall QuickRepStartPage(TCustomQuickRep *Sender);
|
||||
private:
|
||||
public:
|
||||
__fastcall TQuickReport1::TQuickReport1(TComponent* Owner);
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
extern TQuickReport1 *QuickReport1;
|
||||
//----------------------------------------------------------------------------
|
||||
#endif
|
16
DViewer_PrintBonos.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "DViewer_PrintBonos.h"
|
||||
#include "DViewer.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TQRBonos *QRBonos;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TQRBonos::TQRBonos(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
DViewer_PrintBonos.dfm
Normal file
46
DViewer_PrintBonos.h
Normal file
@ -0,0 +1,46 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef DViewer_PrintBonosH
|
||||
#define DViewer_PrintBonosH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Graphics.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include <QuickRpt.hpp>
|
||||
#include <QRCtrls.hpp>
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Qrctrls.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TQRBonos : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TQuickRep *QuickRep1;
|
||||
TQRBand *PageFooterBand1;
|
||||
TQRExpr *QRExpr1;
|
||||
TQRBand *ColumnHeaderBand1;
|
||||
TQRBand *DetailBand1;
|
||||
TQRLabel *QRLabel1;
|
||||
TQRExpr *QRExpr2;
|
||||
TQRLabel *QRLabel2;
|
||||
TQRExpr *QRExpr3;
|
||||
TQRLabel *QRLabel3;
|
||||
TQRExpr *QRExpr4;
|
||||
TQRLabel *QRLabel5;
|
||||
TQRExpr *QRExpr6;
|
||||
TQRLabel *QRLabel6;
|
||||
TQRExpr *QRExpr7;
|
||||
TQRBand *QRBand1;
|
||||
TQRLabel *QRLabel4;
|
||||
TQRBand *QRBand2;
|
||||
TQRExpr *QRExpr5;
|
||||
TQRShape *QRShape1;
|
||||
TQRExpr *QRExpr8;
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TQRBonos(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TQRBonos *QRBonos;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
17
DViewer_PrintClientes.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "DViewer_PrintClientes.h"
|
||||
#include "DViewer.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TQRClt *QRClt;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TQRClt::TQRClt(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
BIN
DViewer_PrintClientes.dfm
Normal file
46
DViewer_PrintClientes.h
Normal file
@ -0,0 +1,46 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef DViewer_PrintClientesH
|
||||
#define DViewer_PrintClientesH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Graphics.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include <QuickRpt.hpp>
|
||||
#include <QRCtrls.hpp>
|
||||
#include <Db.hpp>
|
||||
#include <DBTables.hpp>
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Qrctrls.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TQRClt : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TQuickRep *QuickRep1;
|
||||
TQRBand *PageFooterBand1;
|
||||
TQRExpr *QRExpr1;
|
||||
TQRBand *ColumnHeaderBand1;
|
||||
TQRBand *DetailBand1;
|
||||
TQRLabel *QRLabel1;
|
||||
TQRExpr *QRExpr2;
|
||||
TQRLabel *QRLabel2;
|
||||
TQRExpr *QRExpr3;
|
||||
TQRLabel *QRLabel3;
|
||||
TQRExpr *QRExpr4;
|
||||
TQRLabel *QRLabel4;
|
||||
TQRExpr *QRExpr5;
|
||||
TQRLabel *QRLabel6;
|
||||
TQRExpr *QRExpr7;
|
||||
TQRLabel *QRLabel7;
|
||||
TQRExpr *QRExpr8;
|
||||
TQRBand *QRBand1;
|
||||
TQRLabel *QRLabel5;
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TQRClt(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TQRClt *QRClt;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
16
DViewer_PrintHistoric.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "DViewer_PrintHistoric.h"
|
||||
#include "DViewer.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TQRHistoric *QRHistoric;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TQRHistoric::TQRHistoric(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
DViewer_PrintHistoric.dfm
Normal file
42
DViewer_PrintHistoric.h
Normal file
@ -0,0 +1,42 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef DViewer_PrintHistoricH
|
||||
#define DViewer_PrintHistoricH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Graphics.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include <QuickRpt.hpp>
|
||||
#include <QRCtrls.hpp>
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Qrctrls.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TQRHistoric : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TQuickRep *QuickRep1;
|
||||
TQRBand *PageFooterBand1;
|
||||
TQRExpr *QRExpr1;
|
||||
TQRBand *ColumnHeaderBand1;
|
||||
TQRBand *DetailBand1;
|
||||
TQRLabel *QRLabel1;
|
||||
TQRExpr *QRExpr2;
|
||||
TQRLabel *QRLabel2;
|
||||
TQRExpr *QRExpr3;
|
||||
TQRLabel *QRLabel3;
|
||||
TQRExpr *QRExpr4;
|
||||
TQRLabel *QRLabel4;
|
||||
TQRExpr *QRExpr5;
|
||||
TQRLabel *QRLabel5;
|
||||
TQRExpr *QRExpr6;
|
||||
TQRLabel *QRLabel6;
|
||||
TQRExpr *QRExpr7;
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TQRHistoric(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TQRHistoric *QRHistoric;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
124
DataViewer.bpr
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.05.03"/>
|
||||
<PROJECT value="DataViewer.exe"/>
|
||||
<OBJFILES value="DataViewer.obj DViewer.obj DViewer_Print.obj DViewer_PrintHistoric.obj
|
||||
DViewer_PrintBonos.obj DViewer_PrintClientes.obj"/>
|
||||
<RESFILES value="DataViewer.res"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES) DViewer.dfm DViewer_Print.dfm DViewer_PrintHistoric.dfm
|
||||
DViewer_PrintBonos.dfm DViewer_PrintClientes.dfm"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value="TeeUI50.lib TEEQR50.lib TEEDB50.lib QRPT50.lib TEE50.lib VCLX50.lib
|
||||
inet50.lib vclbde50.lib vcldb50.lib vcl50.lib"/>
|
||||
<SPARELIBS value="vcl50.lib vcldb50.lib vclbde50.lib inet50.lib VCLX50.lib TEE50.lib
|
||||
QRPT50.lib TEEDB50.lib TEEQR50.lib TeeUI50.lib"/>
|
||||
<PACKAGES value="vclx50.bpi vcl50.bpi vcldb50.bpi vclbde50.bpi vcldbx50.bpi qrpt50.bpi
|
||||
teeui50.bpi vclsmp50.bpi teedb50.bpi tee50.bpi nmfast50.bpi inetdb50.bpi
|
||||
inet50.bpi"/>
|
||||
<PATHCPP value=".;"/>
|
||||
<PATHPAS value=".;"/>
|
||||
<PATHRC value=".;"/>
|
||||
<PATHASM value=".;"/>
|
||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
||||
<LINKER value="ilink32"/>
|
||||
<USERDEFINES value=""/>
|
||||
<SYSDEFINES value="NO_STRICT"/>
|
||||
<MAINSOURCE value="DataViewer.cpp"/>
|
||||
<INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;"..\C++ Builder\VCLs\include""/>
|
||||
<LIBPATH value=""..\C++ Builder\VCLs\include";$(BCB)\lib\obj;$(BCB)\lib;"..\C++ Builder\VCLs\lib""/>
|
||||
<WARNINGS value="-w-par -w-8027 -w-8026"/>
|
||||
<WARNOPTSTR value=""/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-I$(BCB)\include -I$(BCB)\include\vcl -I"..\C++ Builder\VCLs\include"
|
||||
-src_suffix cpp -boa"/>
|
||||
<CFLAG1 value="-O2 -H=c:\PROGRAM\CBUILDER\CBUILD~1\lib\vcl35.csm -Hc -Vx -Ve -Tkh30000
|
||||
-X- -a8 -b- -k- -y -v -vi -c -tW -tWM"/>
|
||||
<CFLAG2 value=""/>
|
||||
<CFLAG3 value=""/>
|
||||
<PFLAGS value="-$YD -$L- -$D- -v -M -JPHNE"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zn"/>
|
||||
<LFLAGS value="-D"" -aa -Tpe -x -Gn -v"/>
|
||||
<IFLAGS value=""/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
|
||||
</LINKER>
|
||||
<IDEOPTIONS>
|
||||
[Version Info]
|
||||
IncludeVerInfo=1
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=JD Soft.
|
||||
FileDescription=Visualizador de Datos
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=DViewer
|
||||
LegalCopyright=JD Soft.
|
||||
LegalTrademarks=JD Soft.
|
||||
OriginalFilename=DataViewer
|
||||
ProductName=CtrlMstr: Visualizador de Datos
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=Permite la visualizacion de los datos, generados por el Control Maestro.
|
||||
|
||||
[HistoryLists\hlIncludePath]
|
||||
Count=2
|
||||
Item0=$(BCB)\include;$(BCB)\include\vcl;..\C++ Builder\VCLs\include
|
||||
Item1=$(BCB)\include;$(BCB)\include\vcl
|
||||
|
||||
[HistoryLists\hlLibraryPath]
|
||||
Count=3
|
||||
Item0=..\C++ Builder\VCLs\include;$(BCB)\lib\obj;$(BCB)\lib;..\C++ Builder\VCLs\lib
|
||||
Item1=$(BCB)\lib\obj;$(BCB)\lib;..\C++ Builder\VCLs\lib
|
||||
Item2=$(BCB)\lib\obj;$(BCB)\lib
|
||||
|
||||
[HistoryLists\hlDebugSourcePath]
|
||||
Count=1
|
||||
Item0=$(BCB)\source\vcl
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=$(BCB)\source\vcl
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
RemoteDebug=0
|
||||
|
||||
[Compiler]
|
||||
ShowInfoMsgs=0
|
||||
LinkDebugVcl=1
|
||||
LinkCGLIB=0
|
||||
|
||||
[CORBA]
|
||||
AddServerUnit=1
|
||||
AddClientUnit=1
|
||||
PrecompiledHeaders=1
|
||||
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
</IDEOPTIONS>
|
||||
</PROJECT>
|
38
DataViewer.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#include <winuser.h>
|
||||
|
||||
#pragma hdrstop
|
||||
USERES("DataViewer.res");
|
||||
USEFORM("DViewer.cpp", DViewerF);
|
||||
USEFORM("DViewer_Print.cpp", QuickReport1); /* TQuickRep: File Type */
|
||||
USEFORM("DViewer_PrintHistoric.cpp", QRHistoric);
|
||||
USEFORM("DViewer_PrintBonos.cpp", QRBonos);
|
||||
USEFORM("DViewer_PrintClientes.cpp", QRClt);
|
||||
//---------------------------------------------------------------------------
|
||||
WINAPI WinMain(HINSTANCE, HINSTANCE hPrevInstance, LPSTR, int)
|
||||
{
|
||||
AnsiString FsMutex = DateToStr(TDateTime::CurrentDate()) + AnsiString("-mutex-dataviewer");
|
||||
HANDLE FhMutex = OpenMutex(MUTEX_ALL_ACCESS,False, FsMutex.c_str() );
|
||||
if ( FhMutex == 0 ) //it's a first instance
|
||||
{
|
||||
FhMutex = CreateMutex(NULL,false, FsMutex.c_str() );
|
||||
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
Application->Title = "Visualizador de Datos";
|
||||
Application->CreateForm(__classid(TDViewerF), &DViewerF);
|
||||
Application->Run();
|
||||
}
|
||||
catch (Exception &exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( CloseHandle(FhMutex) ) FhMutex = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
DataViewer.dfm
Normal file
BIN
DataViewer.exe
Normal file
BIN
DataViewer.exe-
Normal file
20
DataViewer.h
Normal file
@ -0,0 +1,20 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef DataViewerH
|
||||
#define DataViewerH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TForm1 : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TForm1(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TForm1 *Form1;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
BIN
DataViewer.res
Normal file
BIN
Documentacion/DataViewer.doc
Normal file
BIN
Documentacion/LockIt!.doc
Normal file
BIN
Documentacion/PCD.PUB
Normal file
212
FichasClientes.cpp
Normal file
@ -0,0 +1,212 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "FichasClientes.h"
|
||||
#include "CtrlPPal.h"
|
||||
#include "ComprarBono.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "CoolForm"
|
||||
#pragma link "DigitNum"
|
||||
#pragma link "FormularioREUSABLE"
|
||||
#pragma resource "*.dfm"
|
||||
TFClientes *FClientes;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TFClientes::TFClientes(TComponent* Owner)
|
||||
: TFormREUSABLE(Owner)
|
||||
{
|
||||
SpeedButton1Click(0);
|
||||
SelIndex->ItemIndex = 0;
|
||||
TbBonos->Active = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::Button1Click(TObject *Sender)
|
||||
{
|
||||
ModalResult = mrCancel;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TFClientes::DBGrid1DblClick(TObject *Sender)
|
||||
{
|
||||
Label1->Visible = false;
|
||||
SelIndex->Visible = false;
|
||||
Edit1->Visible = false;
|
||||
DBGrid1->Visible = false;
|
||||
|
||||
Label2->Visible = true;
|
||||
Label3->Visible = true;
|
||||
Label4->Visible = true;
|
||||
Label5->Visible = true;
|
||||
Label6->Visible = true;
|
||||
DBText1->Visible = true;
|
||||
DBEdit1->Visible = true;
|
||||
DBEdit2->Visible = true;
|
||||
DBEdit3->Visible = true;
|
||||
DBEdit4->Visible = true;
|
||||
Button2->Visible = true;
|
||||
Button3->Visible = true;
|
||||
Dig1->Visible = true;
|
||||
Dig2->Visible = true;
|
||||
Shape1->Visible = true;
|
||||
Shape2->Visible = true;}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::SpeedButton1Click(TObject *Sender)
|
||||
{
|
||||
Label2->Visible = false;
|
||||
Label3->Visible = false;
|
||||
Label4->Visible = false;
|
||||
Label5->Visible = false;
|
||||
Label6->Visible = false;
|
||||
DBText1->Visible = false;
|
||||
DBEdit1->Visible = false;
|
||||
DBEdit2->Visible = false;
|
||||
DBEdit3->Visible = false;
|
||||
DBEdit4->Visible = false;
|
||||
Button2->Visible = false;
|
||||
Button3->Visible = false;
|
||||
Dig1->Visible = false;
|
||||
Dig2->Visible = false;
|
||||
Shape1->Visible = false;
|
||||
Shape2->Visible = false;
|
||||
|
||||
Label1->Visible = true;
|
||||
SelIndex->Visible = true;
|
||||
Edit1->Visible = true;
|
||||
DBGrid1->Visible = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TFClientes::SpeedButton2Click(TObject *Sender)
|
||||
{
|
||||
DBGrid1DblClick(0);
|
||||
CtrlPPal->TbPersonas->Insert();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TFClientes::SelIndexChange(TObject *Sender)
|
||||
{
|
||||
CtrlPPal->TbPersonas->IndexFieldNames = SelIndex->Items->Strings[SelIndex->ItemIndex];
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::Edit1KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( !Edit1->Text.IsEmpty() )
|
||||
CtrlPPal->TbPersonas->Locate( SelIndex->Items->Strings[SelIndex->ItemIndex], Edit1->Text, TLocateOptions() << loCaseInsensitive << loPartialKey );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::Button3Click(TObject *Sender)
|
||||
{
|
||||
ModalResult = mrOk;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::DsPersonasDataChange(TObject *Sender,
|
||||
TField *Field)
|
||||
{
|
||||
Dig1->Value = CtrlPPal->TbPersonas->FieldByName("TiempoH")->AsInteger;
|
||||
Dig2->Value = CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger;
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::Button2Click(TObject *Sender)
|
||||
{
|
||||
// Aun no desarrollado...
|
||||
TCBono *CBono;
|
||||
CBono = new TCBono(this);
|
||||
if ( CBono->ShowModal() == mrOk )
|
||||
{
|
||||
int H, M;
|
||||
H = CBono->Horas->Text.ToInt();
|
||||
M = CBono->Min->Text.ToInt();
|
||||
CtrlPPal->TbPersonas->Edit();
|
||||
CtrlPPal->TbPersonas->FieldByName("TiempoH")->AsInteger = CtrlPPal->TbPersonas->FieldByName("TiempoH")->AsInteger + H + ( CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger + M)/60;
|
||||
CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger = ( CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger + M)%60;
|
||||
CtrlPPal->TbPersonas->Post();
|
||||
TbBonos->InsertRecord(ARRAYOFCONST((CtrlPPal->TbPersonas->FieldByName("CodCliente1")->AsInteger,(Variant)TDateTime::CurrentDateTime(),(Variant)TDateTime::CurrentDate(), H, M, Currency(CBono->CosteBono->Text) )));
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::TbBonosBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
if ( !FileExists( TbBonos->TableName ) )
|
||||
{
|
||||
TbBonos -> TableType = ttParadox;
|
||||
|
||||
TbBonos -> FieldDefs -> Clear();
|
||||
|
||||
/********************\
|
||||
|* Datos Básicos *|
|
||||
\********************/
|
||||
TbBonos -> FieldDefs -> Add("IDcliente", ftInteger, 0, false );
|
||||
TbBonos -> FieldDefs -> Add("FechaCompra", ftDateTime, 0, false );
|
||||
TbBonos -> FieldDefs -> Add("fecha", ftDate, 0, false );
|
||||
TbBonos -> FieldDefs -> Add("Bhoras", ftInteger, 0, false );
|
||||
TbBonos -> FieldDefs -> Add("Bmin", ftInteger, 0, false );
|
||||
TbBonos -> FieldDefs -> Add("coste", ftCurrency, 0, false );
|
||||
TbBonos -> IndexDefs-> Clear();
|
||||
|
||||
TbBonos->IndexDefs->Add("Primary", "IDcliente;FechaCompra", TIndexOptions() << ixPrimary );
|
||||
|
||||
// Creamos la base...
|
||||
TbBonos -> CreateTable();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::DBEdit1KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
CtrlPPal->TbPersonas->Post();
|
||||
DBEdit2->SetFocus();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::DBEdit2KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
CtrlPPal->TbPersonas->Post();
|
||||
DBEdit3->SetFocus();
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFClientes::DBEdit3KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
CtrlPPal->TbPersonas->Post();
|
||||
DBEdit4->SetFocus();
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TFClientes::DBEdit4KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
{
|
||||
CtrlPPal->TbPersonas->Post();
|
||||
DBEdit1->SetFocus();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
450
FichasClientes.dfm
Normal file
@ -0,0 +1,450 @@
|
||||
inherited FClientes: TFClientes
|
||||
Left = 378
|
||||
Top = 210
|
||||
ActiveControl = Edit1
|
||||
Caption = 'copia'
|
||||
OldCreateOrder = True
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
inherited CoolForm1: TCoolForm
|
||||
Mask2 = {
|
||||
3002000020000000010000002100000010020000040000000200000064010000
|
||||
030100001A000000020000004E01000003000000170000000300000051010000
|
||||
0400000015000000040000005301000005000000130000000500000055010000
|
||||
0600000012000000060000005601000007000000100000000700000058010000
|
||||
080000000F0000000800000059010000090000000E000000090000005A010000
|
||||
0A0000000C0000000A0000005C0100000C0000000B0000000C0000005D010000
|
||||
0D0000000A0000000D0000005E0100000E000000090000000E0000005F010000
|
||||
1000000008000000100000006001000011000000070000001100000061010000
|
||||
1300000006000000130000006201000015000000050000001500000063010000
|
||||
18000000040000001800000064010000ED00000005000000ED00000063010000
|
||||
F000000006000000F000000062010000F200000007000000F200000061010000
|
||||
F400000008000000F400000060010000F500000009000000F50000005F010000
|
||||
F70000000A000000F70000005E010000F80000000B000000F80000005D010000
|
||||
F90000000C000000F90000005C010000FB0000000E000000FB0000005A010000
|
||||
FC0000000F000000FC00000059010000FD00000010000000FD00000058010000
|
||||
FE00000012000000FE00000056010000FF00000013000000FF00000055010000
|
||||
0001000015000000000100005301000001010000170000000101000051010000
|
||||
020100001A000000020100004E01000003010000}
|
||||
end
|
||||
object Terminal: TLabel [1]
|
||||
Left = 72
|
||||
Top = 5
|
||||
Width = 209
|
||||
Height = 20
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
Caption = 'Fichas de Clientes'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clAqua
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label1: TLabel [2]
|
||||
Left = 34
|
||||
Top = 41
|
||||
Width = 62
|
||||
Height = 20
|
||||
Caption = '&Buscar:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWhite
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object SpeedButton1: TSpeedButton [3]
|
||||
Left = 329
|
||||
Top = 64
|
||||
Width = 23
|
||||
Height = 22
|
||||
Hint = 'Localizar cliente'
|
||||
Flat = True
|
||||
Glyph.Data = {
|
||||
8E030000424D8E03000000000000760000002800000042000000160000000100
|
||||
04000000000018030000C40E0000C40E00001000000010000000010102000000
|
||||
310039393900000063006F006F006C6C6C00000094000000B5000000E9006A00
|
||||
FF006F6FD900800080009400FF00AEAEAE008F8FCF00F3F3F300B2E75BBBBBBB
|
||||
BD2A83DBBBBBBBBBBBBBBBBBBBBBBBBBB2E75BBBBBBBBD2A83DBBB000000B170
|
||||
000000000036063DBBBBBBBBBBBBBBBBBBBBBBBBB170000000000036063DBB00
|
||||
0000B175FFFFFFFFFD365571FBBBBBBBBBBBBBBBBBBBBBBBB175FFFFFFFFFD36
|
||||
5571FB000000B0000000000FFD365B571FBBBB000000000000BBBBBBB0000000
|
||||
000FFD365B571F0000000FFFFFFFFFF0FD000DB280BBB0DDDDDDDDDDDD0BBBBB
|
||||
0FFFFFFFFFF0FD000DB2800000000FDFFFFFDFF0FD5BB5DB28BBB0D000000000
|
||||
0DD0BBBB0FDFFFFFDFF0FD5BB5DB280000000FFFFFFFFFF0FD5B50DBB0BBBB0D
|
||||
0FFFFFF0B0DD0BBB0FFFFFFFFFF0FD5B50DBB0000000B2FFFFFFFFFF2D5D550D
|
||||
BBBBB0000000000F0F0D0BBBB2FFFFFFFFFF2D5D550DBB000000B2FFD2DFD0FF
|
||||
00005BB2FBBBB0FFFFFFFFF0F00D0BBBB2FFD2DFD0FF00005BB2FB000000082F
|
||||
55FF2FFFF174BD50FBBBBB0F00F00FFF0F0D0BBB082F55FF2FFFF174BD50FB00
|
||||
0000800002200500174C60DBBBBBBB0FFFFFFFFF0F0D0BBB800002200500174C
|
||||
60DBBB00000082FD25FD2FDD1739B00DBBBBB000FFFFFFFFF0000BBB82FD25FD
|
||||
2FDD1739B00DBB00000008000220050001736DF2FBBBB0800F00000F00080BBB
|
||||
08000220050001736DF2FB000000BB2F55FF2FFFF0005500FBBBB080FFFFFFFF
|
||||
F0080BBBBB2F55FF2FFFF0005500FB000000BB2FD2DFD0FFF2D5FF50FBBBB000
|
||||
FFFFFFFFF0F00BBBBB2FD2DFD0FFF2D5FF50FB000000BB2FFFFFFFFFF2D5FFF2
|
||||
0FBBBBB0F000F00FF0F0BBBBBB2FFFFFFFFFF2D5FFF20F000000BB2FDDDDDFDF
|
||||
F2FD5FFF2FBBBBB0FFFFFFFFF000BBBBBB2FDDDDDFDFF2FD5FFF2F000000BB2F
|
||||
FFFFFFFFF2FD00000FBBBBB0FFF0000000BBBBBBBB2FFFFFFFFFF2FD00000F00
|
||||
0000BB2FDDDDFFFFF2FD0DBBBBBBBBBB000BBBBBBBBBBBBBBB2FDDDDFFFFF2FD
|
||||
0DBBBB000000BB2FDDDDDFFFF2FF5DBBBBBBBBBBBBBBBBBBBBBBBBBBBB2FDDDD
|
||||
DFFFF2FF5DBBBB000000BB2FFFFFFFFFF0000DBBBBBBBBBBBBBBBBBBBBBBBBBB
|
||||
BB2FFFFFFFFFF0000DBBBB000000BB000000000002BBBBBBBBBBBBBBBBBBBBBB
|
||||
BBBBBBBBBB000000000002BBBBBBBB000000}
|
||||
NumGlyphs = 3
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = SpeedButton1Click
|
||||
end
|
||||
object SpeedButton2: TSpeedButton [4]
|
||||
Left = 329
|
||||
Top = 96
|
||||
Width = 23
|
||||
Height = 22
|
||||
Hint = 'Alta de clientes'
|
||||
Flat = True
|
||||
Glyph.Data = {
|
||||
0E0A0000424D0E0A000000000000360400002800000042000000160000000100
|
||||
080000000000D8050000C40E0000C40E00000001000000010000000000000000
|
||||
5500000080000000AA000000D5000000FF00002B0000002B5500002B8000002B
|
||||
AA00002BD500002BFF000055000000555500005580000055AA000055D5000055
|
||||
FF000080000000805500008080000080AA000080D5000080FF0000AA000000AA
|
||||
550000AA800000AAAA0000AAD50000AAFF0000D5000000D5550000D5800000D5
|
||||
AA0000D5D50000D5FF0000FF000000FF550000FF800000FFAA0000FFD50000FF
|
||||
FF005500000055005500550080005500AA005500D5005500FF00552B0000552B
|
||||
5500552B8000552BAA00552BD500552BFF005555000055555500555580005555
|
||||
AA005555D5005555FF005580000055805500558080005580AA005580D5005580
|
||||
FF0055AA000055AA550055AA800055AAAA0055AAD50055AAFF0055D5000055D5
|
||||
550055D5800055D5AA0055D5D50055D5FF0055FF000055FF550055FF800055FF
|
||||
AA0055FFD50055FFFF008000000080005500800080008000AA008000D5008000
|
||||
FF00802B0000802B5500802B8000802BAA00802BD500802BFF00805500008055
|
||||
5500805580008055AA008055D5008055FF008080000080805500808080008080
|
||||
AA008080D5008080FF0080AA000080AA550080AA800080AAAA0080AAD50080AA
|
||||
FF0080D5000080D5550080D5800080D5AA0080D5D50080D5FF0080FF000080FF
|
||||
550080FF800080FFAA0080FFD50080FFFF00AA000000AA005500AA008000AA00
|
||||
AA00AA00D500AA00FF00AA2B0000AA2B5500AA2B8000AA2BAA00AA2BD500AA2B
|
||||
FF00AA550000AA555500AA558000AA55AA00AA55D500AA55FF00AA800000AA80
|
||||
5500AA808000AA80AA00AA80D500AA80FF00AAAA0000AAAA5500AAAA8000AAAA
|
||||
AA00AAAAD500AAAAFF00AAD50000AAD55500AAD58000AAD5AA00AAD5D500AAD5
|
||||
FF00AAFF0000AAFF5500AAFF8000AAFFAA00AAFFD500AAFFFF00D5000000D500
|
||||
5500D5008000D500AA00D500D500D500FF00D52B0000D52B5500D52B8000D52B
|
||||
AA00D52BD500D52BFF00D5550000D5555500D5558000D555AA00D555D500D555
|
||||
FF00D5800000D5805500D5808000D580AA00D580D500D580FF00D5AA0000D5AA
|
||||
5500D5AA8000D5AAAA00D5AAD500D5AAFF00D5D50000D5D55500D5D58000D5D5
|
||||
AA00D5D5D500D5D5FF00D5FF0000D5FF5500D5FF8000D5FFAA00D5FFD500D5FF
|
||||
FF00FF000000FF005500FF008000FF00AA00FF00D500FF00FF00FF2B0000FF2B
|
||||
5500FF2B8000FF2BAA00FF2BD500FF2BFF00FF550000FF555500FF558000FF55
|
||||
AA00FF55D500FF55FF00FF800000FF805500FF808000FF80AA00FF80D500FF80
|
||||
FF00FFAA0000FFAA5500FFAA8000FFAAAA00FFAAD500FFAAFF00FFD50000FFD5
|
||||
5500FFD58000FFD5AA00FFD5D500FFD5FF00FFFF0000FFFF5500FFFF8000FFFF
|
||||
AA00FFFFD5003F3F3F006B6B6B0095959500C0C0C000FFFFFF00F6F6F6F6F6F6
|
||||
F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F60505050505050505F6
|
||||
F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F60000F6F6
|
||||
F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F605050505050505
|
||||
0505050505F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6
|
||||
0000F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F605050505
|
||||
05050505050505050505F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6
|
||||
F6F6F6F6000000000000000000000000000000000000000000000000F6F6F605
|
||||
050505FAFAFAFAFAFAFA0505050505F6F6F60000000000000000000000000000
|
||||
0000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
|
||||
F6F605050505FAFAFAFAFAFAFAFAFAFA05050505F6F600FFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFF00000000FFFF1D1DFFFF1D1DFFFF1D1DFFFF1D1DFF
|
||||
FF1DFF00F6050505050505FAFAFAFAFAFAFAFAFAFA05050505F600FF1DFFFF1D
|
||||
1DFFFF1D1DFFFF1D1DFFFF1D1DFFFF00000000FF1DFFFF1D1DFFFF1D1DFFFF1D
|
||||
1DFFFF1D1DFFFF00F605050505050505FAFA000000000000FAFA050505F600FF
|
||||
FF1D1DFFFF1D1DFFFF1D1DFFFF1D1DFFFF1DFF00000000FFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFF0000000000FA0505050500FEFEFEFEFEFE00FAFA05
|
||||
050500FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0054D254D2000005050505FFFFFF000000
|
||||
0000FA05050500FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FF
|
||||
FFFFFFFFFF000000000000FFFF0000000000FF00D254D25400FEFE05050505FF
|
||||
FFFFFEFEFEFE0005050500FFFFFFFFFFFF000000000000FFFF0000000000FF00
|
||||
000000FF0505D205FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00D2D2D2D200FFFFFF
|
||||
05050505FF0000000000FA05050500FFD2D229D2FFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFF00000000FF292905FFFF000000FF000000000000FF0000FF00D2D2D2D2
|
||||
000000FFFF05050505FFFEFEFE00FA05050500FF0505D2FFFF000000FF000000
|
||||
000000FF0000FF00000000FF2905D229FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
|
||||
0000000000FAFA00FFFF05050505000000FAFA05050500FF05D22905FFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFF00000000FF0529D2FFFF0000000000FF0000FF0000
|
||||
0000FF00050505FAFAFAFAFA00FFFF05050505FAFAFAFA05050500FFD20529FF
|
||||
FF0000000000FF0000FF00000000FF00000000FFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFF00050505FAFAFAFAFAFA0000FF05050505FAFAFA05050500FF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000
|
||||
000000000000000000000000F6050505FAFAFAFAFAFAFA00FF05050505FA0505
|
||||
05F6000000000000000000000000000000000000000000000000F6F6F6F6F6F6
|
||||
F6F600FEFEFEFEFE00F6F6F6F6F6F6F6F605050505FAFAFAFAFAFAFA00000505
|
||||
0505050505F6F6F6F6F6F6F6F6F600FEFEFEFEFE00F6F6F6F6F6F6F60000F6F6
|
||||
F6F6F6F6F6F6F600FE00FE00F6F6F6F6F6F6F6F6F6F605050505FAFAFAFAFAFA
|
||||
FAFAFA0505050505F6F6F6F6F6F6F6F6F6F6F600FE00FE00F6F6F6F6F6F6F6F6
|
||||
0000F6F6F6F6F6F6F6F600FEFEFEFEFE00F6F6F6F6F6F6F6F6F6F60505050505
|
||||
FAFAFAFAFAFA0505050505F6F6F6F6F6F6F6F6F6F6F600FEFEFEFEFE00F6F6F6
|
||||
F6F6F6F60000F6F6F6F6F6F6F6F6F60000000000F6F6F6F6F6F6F6F6F6F6F6F6
|
||||
0505050505050505050505050505F6F6F6F6F6F6F6F6F6F6F6F6F60000000000
|
||||
F6F6F6F6F6F6F6F60000F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6
|
||||
F6F6F6F6F6050505050505050505050505F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6
|
||||
F6F6F6F6F6F6F6F6F6F6F6F60000F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6
|
||||
F6F6F6F6F6F6F6F6F6F6F60505050505050505F6F6F6F6F6F6F6F6F6F6F6F6F6
|
||||
F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F60000}
|
||||
NumGlyphs = 3
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = SpeedButton2Click
|
||||
end
|
||||
object Label2: TLabel [5]
|
||||
Left = 34
|
||||
Top = 65
|
||||
Width = 68
|
||||
Height = 20
|
||||
Caption = 'Nombre:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWhite
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label3: TLabel [6]
|
||||
Left = 34
|
||||
Top = 113
|
||||
Width = 28
|
||||
Height = 20
|
||||
Caption = 'Nif:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWhite
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label4: TLabel [7]
|
||||
Left = 178
|
||||
Top = 113
|
||||
Width = 31
|
||||
Height = 20
|
||||
Caption = 'Tlf.:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWhite
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Label5: TLabel [8]
|
||||
Left = 34
|
||||
Top = 137
|
||||
Width = 162
|
||||
Height = 20
|
||||
Caption = 'Tiempo RESTANTE:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clYellow
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object Dig1: TDigitNum [9]
|
||||
Left = 44
|
||||
Top = 168
|
||||
Width = 65
|
||||
Height = 55
|
||||
Brush.Style = bsClear
|
||||
LED_OFF = clBlack
|
||||
LED_BRDon = clWhite
|
||||
LED_BRDoff = clBlue
|
||||
Value = 12
|
||||
MaxLength = 2
|
||||
end
|
||||
object Shape2: TShape [10]
|
||||
Left = 109
|
||||
Top = 199
|
||||
Width = 10
|
||||
Height = 10
|
||||
Brush.Color = clRed
|
||||
Pen.Color = clWhite
|
||||
Shape = stCircle
|
||||
end
|
||||
object Shape1: TShape [11]
|
||||
Left = 109
|
||||
Top = 178
|
||||
Width = 10
|
||||
Height = 10
|
||||
Brush.Color = clRed
|
||||
Pen.Color = clWhite
|
||||
Shape = stCircle
|
||||
end
|
||||
object Dig2: TDigitNum [12]
|
||||
Left = 124
|
||||
Top = 168
|
||||
Width = 65
|
||||
Height = 55
|
||||
Brush.Style = bsClear
|
||||
LED_OFF = clBlack
|
||||
LED_BRDon = clWhite
|
||||
LED_BRDoff = clBlue
|
||||
Value = 12
|
||||
MaxLength = 2
|
||||
end
|
||||
object Label6: TLabel [13]
|
||||
Left = 34
|
||||
Top = 41
|
||||
Width = 148
|
||||
Height = 20
|
||||
Caption = 'Código de Cliente:'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clYellow
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object DBText1: TDBText [14]
|
||||
Left = 208
|
||||
Top = 40
|
||||
Width = 121
|
||||
Height = 25
|
||||
Alignment = taRightJustify
|
||||
DataField = 'CodCliente1'
|
||||
DataSource = DsPersonas
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clLime
|
||||
Font.Height = -16
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
inherited Button1: TButton
|
||||
TabOrder = 9
|
||||
end
|
||||
object Edit1: TEdit
|
||||
Left = 205
|
||||
Top = 40
|
||||
Width = 121
|
||||
Height = 21
|
||||
TabOrder = 1
|
||||
OnKeyUp = Edit1KeyUp
|
||||
end
|
||||
object DBGrid1: TDBGrid
|
||||
Left = 32
|
||||
Top = 64
|
||||
Width = 294
|
||||
Height = 168
|
||||
DataSource = DsPersonas
|
||||
ReadOnly = True
|
||||
TabOrder = 2
|
||||
TitleFont.Charset = DEFAULT_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -11
|
||||
TitleFont.Name = 'MS Sans Serif'
|
||||
TitleFont.Style = []
|
||||
OnDblClick = DBGrid1DblClick
|
||||
end
|
||||
object SelIndex: TComboBox
|
||||
Left = 98
|
||||
Top = 40
|
||||
Width = 105
|
||||
Height = 21
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
ItemHeight = 13
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
Text = 'Nombre'
|
||||
OnChange = SelIndexChange
|
||||
Items.Strings = (
|
||||
'CodCliente1'
|
||||
'Nombre'
|
||||
'Apellidos'
|
||||
'Telefono 1')
|
||||
end
|
||||
object DBEdit1: TDBEdit
|
||||
Left = 104
|
||||
Top = 64
|
||||
Width = 121
|
||||
Height = 21
|
||||
DataField = 'Nombre'
|
||||
DataSource = DsPersonas
|
||||
TabOrder = 3
|
||||
OnKeyUp = DBEdit1KeyUp
|
||||
end
|
||||
object DBEdit2: TDBEdit
|
||||
Left = 104
|
||||
Top = 88
|
||||
Width = 217
|
||||
Height = 21
|
||||
DataField = 'Apellidos'
|
||||
DataSource = DsPersonas
|
||||
TabOrder = 4
|
||||
OnKeyUp = DBEdit2KeyUp
|
||||
end
|
||||
object DBEdit3: TDBEdit
|
||||
Left = 72
|
||||
Top = 112
|
||||
Width = 97
|
||||
Height = 21
|
||||
DataField = 'DocumentoDNP'
|
||||
DataSource = DsPersonas
|
||||
TabOrder = 5
|
||||
OnKeyUp = DBEdit3KeyUp
|
||||
end
|
||||
object DBEdit4: TDBEdit
|
||||
Left = 208
|
||||
Top = 112
|
||||
Width = 113
|
||||
Height = 21
|
||||
DataField = 'Telefono 1'
|
||||
DataSource = DsPersonas
|
||||
TabOrder = 6
|
||||
OnKeyUp = DBEdit4KeyUp
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 208
|
||||
Top = 138
|
||||
Width = 113
|
||||
Height = 17
|
||||
Caption = '&Comprar Bono'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -13
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 7
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 208
|
||||
Top = 170
|
||||
Width = 113
|
||||
Height = 47
|
||||
Caption = '&USAR BONO'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -13
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 8
|
||||
OnClick = Button3Click
|
||||
end
|
||||
object DsPersonas: TDataSource
|
||||
DataSet = CtrlPPal.TbPersonas
|
||||
OnDataChange = DsPersonasDataChange
|
||||
end
|
||||
object TbBonos: TTable
|
||||
BeforeOpen = TbBonosBeforeOpen
|
||||
TableName = 'datos\bonos.db'
|
||||
Top = 232
|
||||
end
|
||||
end
|
78
FichasClientes.h
Normal file
@ -0,0 +1,78 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef FichasClientesH
|
||||
#define FichasClientesH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include "CoolForm.hpp"
|
||||
#include <Db.hpp>
|
||||
#include <DBGrids.hpp>
|
||||
#include <DBTables.hpp>
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Graphics.hpp>
|
||||
#include <Grids.hpp>
|
||||
#include <Buttons.hpp>
|
||||
#include <DBCtrls.hpp>
|
||||
#include <Mask.hpp>
|
||||
#include "DigitNum.h"
|
||||
#include "FormularioREUSABLE.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TFClientes : public TFormREUSABLE
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TLabel *Terminal;
|
||||
TLabel *Label1;
|
||||
TEdit *Edit1;
|
||||
TDataSource *DsPersonas;
|
||||
TDBGrid *DBGrid1;
|
||||
TSpeedButton *SpeedButton1;
|
||||
TSpeedButton *SpeedButton2;
|
||||
TComboBox *SelIndex;
|
||||
TDBEdit *DBEdit1;
|
||||
TDBEdit *DBEdit2;
|
||||
TLabel *Label2;
|
||||
TLabel *Label3;
|
||||
TDBEdit *DBEdit3;
|
||||
TLabel *Label4;
|
||||
TDBEdit *DBEdit4;
|
||||
TLabel *Label5;
|
||||
TDigitNum *Dig1;
|
||||
TShape *Shape2;
|
||||
TShape *Shape1;
|
||||
TDigitNum *Dig2;
|
||||
TButton *Button2;
|
||||
TButton *Button3;
|
||||
TLabel *Label6;
|
||||
TDBText *DBText1;
|
||||
TTable *TbBonos;
|
||||
void __fastcall Button1Click(TObject *Sender);
|
||||
void __fastcall DBGrid1DblClick(TObject *Sender);
|
||||
void __fastcall SpeedButton1Click(TObject *Sender);
|
||||
void __fastcall SpeedButton2Click(TObject *Sender);
|
||||
void __fastcall SelIndexChange(TObject *Sender);
|
||||
void __fastcall Edit1KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall Button3Click(TObject *Sender);
|
||||
void __fastcall DsPersonasDataChange(TObject *Sender,
|
||||
TField *Field);
|
||||
void __fastcall Button2Click(TObject *Sender);
|
||||
void __fastcall TbBonosBeforeOpen(TDataSet *DataSet);
|
||||
void __fastcall DBEdit1KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit2KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit3KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall DBEdit4KeyUp(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TFClientes(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TFClientes *FClientes;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
23
FormularioREUSABLE.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "FormularioREUSABLE.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "CoolForm"
|
||||
#pragma resource "*.dfm"
|
||||
TFormREUSABLE *FormREUSABLE;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TFormREUSABLE::TFormREUSABLE(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TFormREUSABLE::Button1Click(TObject *Sender)
|
||||
{
|
||||
ModalResult = mrCancel;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
1534
FormularioREUSABLE.dfm
Normal file
27
FormularioREUSABLE.h
Normal file
@ -0,0 +1,27 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef FormularioREUSABLEH
|
||||
#define FormularioREUSABLEH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include "CoolForm.hpp"
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Graphics.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TFormREUSABLE : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TCoolForm *CoolForm1;
|
||||
TButton *Button1;
|
||||
void __fastcall Button1Click(TObject *Sender);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TFormREUSABLE(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TFormREUSABLE *FormREUSABLE;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
324
InstalacionControl/ControlMaestro.iwz
Normal file
@ -0,0 +1,324 @@
|
||||
|
||||
[InstallShield Wizard]
|
||||
iDate=1
|
||||
iTime=1
|
||||
Flag=0
|
||||
ISX.EXE Size=679936
|
||||
ISX.EXE Date=11:21:52 8/4/1999
|
||||
ISX.EXE Ver=2.1.2.62
|
||||
SETUP.EXE Size=45312
|
||||
SETUP.EXE Date=9:12:24 23/3/1999
|
||||
SETUP.EXE Ver=3.0.111.0
|
||||
SETUP.INS Size=81342
|
||||
SETUP.INS Date=11:26:40 8/4/1999
|
||||
SETUP.INS Ver=Not available
|
||||
_INST16.EX_ Size=81342
|
||||
_INST16.EX_ Date=11:26:40 8/4/1999
|
||||
_INST16.EX_ Ver=Not available
|
||||
_INST32I.EX_ Size=294079
|
||||
_INST32I.EX_ Date=9:12:22 23/3/1999
|
||||
_INST32I.EX_ Ver=Not available
|
||||
ISDEPEND.INI Size=6857
|
||||
ISDEPEND.INI Date=13:24:36 27/12/1999
|
||||
ISDEPEND.INI Ver=Not available
|
||||
SWDEPEND.INI Size=9711
|
||||
SWDEPEND.INI Date=13:24:40 27/12/1999
|
||||
SWDEPEND.INI Ver=Not available
|
||||
ICOMP.EXE Size=119808
|
||||
ICOMP.EXE Date=9:12:24 23/3/1999
|
||||
ICOMP.EXE Ver=3.00.062
|
||||
SPLIT.EXE Size=90624
|
||||
SPLIT.EXE Date=9:12:24 23/3/1999
|
||||
SPLIT.EXE Ver=3.00.060
|
||||
PACKLIST.EXE Size=87552
|
||||
PACKLIST.EXE Date=9:12:24 23/3/1999
|
||||
PACKLIST.EXE Ver=3.00.060
|
||||
Version=2.12
|
||||
DevTool=Borland C++Builder 5
|
||||
Platform=Win32
|
||||
DisksBuilt=1
|
||||
DisksDir=CONTRO~2\650MB\
|
||||
TabsVisit=11111111100000011
|
||||
LangNum=0
|
||||
LangDir=
|
||||
|
||||
[VisualDesign]
|
||||
AppName=ControlMaestro
|
||||
AppExe=[Program Files]\ctrlmstr.exe
|
||||
AppExeFile=
|
||||
Version=1.0.0.101
|
||||
Company=JD soft.
|
||||
Title=ControlMaestro
|
||||
TitleType=1
|
||||
BackgrndBmp=
|
||||
BackgrndAlign=4
|
||||
Backgrnd=1
|
||||
BackgrndColor=10
|
||||
Uninstall=1
|
||||
UninstallChecked=1
|
||||
Silent=1
|
||||
SmsMode=0
|
||||
|
||||
[Types]
|
||||
Types=1
|
||||
Type1Components=1
|
||||
Type1Name=Complete
|
||||
Type1ComponentList=1
|
||||
|
||||
[Components]
|
||||
Components=1
|
||||
Component1Groups=6
|
||||
Component1Name=Application Files
|
||||
Component1Description=Application files needed to run the application
|
||||
Component1GroupList=1 2 3 4 5 6
|
||||
|
||||
[Groups]
|
||||
Groups=6
|
||||
Group1Size=1065435
|
||||
Group1Files=2
|
||||
Group1Name=Program Files
|
||||
Group1Dir=<INSTALLDIR>
|
||||
Group1Update=2
|
||||
Group1TargetOS=-1
|
||||
Group1File1=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\CtrlMstr.exe
|
||||
Group1File2=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\DataViewer.exe
|
||||
Group2Size=7808738
|
||||
Group2Files=28
|
||||
Group2Auto=101
|
||||
Group2ID=39001
|
||||
Group2Name=BDE/IDAPI Files
|
||||
Group2Dir=<ProgramFilesDir>\Common Files\Borland Shared\BDE
|
||||
Group2Update=-1
|
||||
Group2TargetOS=-1
|
||||
Group2File1=c:\program\cbuilder\Borland Shared\BDE\IDAPI32.DLL
|
||||
Group2File1Auto=101
|
||||
Group2File2=c:\program\cbuilder\Borland Shared\BDE\IDR20009.DLL
|
||||
Group2File2Auto=101
|
||||
Group2File3=c:\program\cbuilder\Borland Shared\BDE\BLW32.DLL
|
||||
Group2File3Auto=101
|
||||
Group2File4=c:\program\cbuilder\Borland Shared\BDE\BDEADMIN.EXE
|
||||
Group2File4Auto=101
|
||||
Group2File5=c:\program\cbuilder\Borland Shared\BDE\BDEADMIN.HLP
|
||||
Group2File5Auto=101
|
||||
Group2File6=c:\program\cbuilder\Borland Shared\BDE\BDEADMIN.CNT
|
||||
Group2File6Auto=101
|
||||
Group2File7=c:\program\cbuilder\Borland Shared\BDE\BDEADMIN.TOC
|
||||
Group2File7Auto=101
|
||||
Group2File8=c:\program\cbuilder\Borland Shared\BDE\DATAPUMP.HLP
|
||||
Group2File8Auto=101
|
||||
Group2File9=c:\program\cbuilder\Borland Shared\BDE\DATAPUMP.CNT
|
||||
Group2File9Auto=101
|
||||
Group2File10=c:\program\cbuilder\Borland Shared\BDE\IDDR32.DLL
|
||||
Group2File10Auto=101
|
||||
Group2File11=c:\program\cbuilder\Borland Shared\BDE\IDPDX32.DLL
|
||||
Group2File11Auto=101
|
||||
Group2File12=c:\program\cbuilder\Borland Shared\BDE\IDSQL32.DLL
|
||||
Group2File12Auto=101
|
||||
Group2File13=c:\program\cbuilder\Borland Shared\BDE\IDBAT32.DLL
|
||||
Group2File13Auto=101
|
||||
Group2File14=c:\program\cbuilder\Borland Shared\BDE\IDQBE32.DLL
|
||||
Group2File14Auto=101
|
||||
Group2File15=c:\program\cbuilder\Borland Shared\BDE\IDDBAS32.DLL
|
||||
Group2File15Auto=101
|
||||
Group2File16=c:\program\cbuilder\Borland Shared\BDE\IDASCI32.DLL
|
||||
Group2File16Auto=101
|
||||
Group2File17=c:\program\cbuilder\Borland Shared\BDE\IDODBC32.DLL
|
||||
Group2File17Auto=101
|
||||
Group2File18=c:\program\cbuilder\Borland Shared\BDE\IDDAO32.DLL
|
||||
Group2File18Auto=101
|
||||
Group2File19=c:\program\cbuilder\Borland Shared\BDE\IDDA3532.DLL
|
||||
Group2File19Auto=101
|
||||
Group2File20=C:\ARCHIVOS DE PROGRAMA\INSTALLSHIELD\INSTALLSHIELD EXPRESS FOR C++BUILDER 5\redist\IDAPINST.DLL
|
||||
Group2File20Auto=101
|
||||
Group2File21=c:\program\cbuilder\Borland Shared\BDE\BANTAM.DLL
|
||||
Group2File21Auto=101
|
||||
Group2File22=c:\program\cbuilder\Borland Shared\BDE\USA.BTL
|
||||
Group2File22Auto=101
|
||||
Group2File23=c:\program\cbuilder\Borland Shared\BDE\EUROPE.BTL
|
||||
Group2File23Auto=101
|
||||
Group2File24=c:\program\cbuilder\Borland Shared\BDE\CEEUROPE.BTL
|
||||
Group2File24Auto=101
|
||||
Group2File25=c:\program\cbuilder\Borland Shared\BDE\JAPAN.BTL
|
||||
Group2File25Auto=101
|
||||
Group2File26=c:\program\cbuilder\Borland Shared\BDE\OTHER.BTL
|
||||
Group2File26Auto=101
|
||||
Group2File27=c:\program\cbuilder\Borland Shared\BDE\FAREAST.BTL
|
||||
Group2File27Auto=101
|
||||
Group2File28=c:\program\cbuilder\Borland Shared\BDE\CHARSET.CVB
|
||||
Group2File28Auto=101
|
||||
Group3Size=6080
|
||||
Group3Files=1
|
||||
Group3Auto=98
|
||||
Group3ID=38998
|
||||
Group3Name=BDE/IDAPI CNF File
|
||||
Group3Dir=<ProgramFilesDir>\Common Files\Borland Shared\BDE
|
||||
Group3Update=-1
|
||||
Group3TargetOS=-1
|
||||
Group3File1=C:\ARCHIVOS DE PROGRAMA\INSTALLSHIELD\INSTALLSHIELD EXPRESS FOR C++BUILDER 5\redist\IDAPI.CNF
|
||||
Group3File1Auto=98
|
||||
Group4Size=183808
|
||||
Group4Files=1
|
||||
Group4Auto=58
|
||||
Group4ID=38958
|
||||
Group4Name=System Files - WinSysDir
|
||||
Group4Dir=<WINSYSDIR>
|
||||
Group4Update=-1
|
||||
Group4TargetOS=-1
|
||||
Group4File1=C:\WIN98\SYSTEM\BDEADMIN.CPL
|
||||
Group4File1Auto=58
|
||||
Group5Size=77824
|
||||
Group5Files=15
|
||||
Group5Name=datos
|
||||
Group5Dir=<INSTALLDIR>\DATOS
|
||||
Group5Update=3
|
||||
Group5TargetOS=-1
|
||||
Group5File1=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.YG5
|
||||
Group5File2=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.MB
|
||||
Group5File3=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.PX
|
||||
Group5File4=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.XG0
|
||||
Group5File5=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.XG1
|
||||
Group5File6=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.XG2
|
||||
Group5File7=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.XG3
|
||||
Group5File8=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.XG4
|
||||
Group5File9=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.XG5
|
||||
Group5File10=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.YG0
|
||||
Group5File11=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.YG1
|
||||
Group5File12=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.YG2
|
||||
Group5File13=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.YG3
|
||||
Group5File14=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.YG4
|
||||
Group5File15=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\datos\personas.DB
|
||||
Group6Size=8918528
|
||||
Group6Files=2
|
||||
Group6Name=Ayuda
|
||||
Group6Dir=<INSTALLDIR>\Ayuda
|
||||
Group6Update=0
|
||||
Group6TargetOS=-1
|
||||
Group6File1=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\Documentacion\LockIt!.doc
|
||||
Group6File2=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\Documentacion\DataViewer.doc
|
||||
|
||||
[Sequence]
|
||||
DestinationLocationDir=<ProgramFilesDir>\JD soft.\ControlMaestro
|
||||
DatabaseLocationDir=<INSTALLDIR>\data
|
||||
SelectProgramFolderName=ControlMaestro
|
||||
WelcomeMessage=1
|
||||
WelcomeMessageFile=
|
||||
DestinationLocation=1
|
||||
SelectProgramFolder=1
|
||||
ProgressBar=1
|
||||
SetupComplete=1
|
||||
SetupCompleteExec=[Program Files]\ctrlmstr.exe
|
||||
SetupCompleteExecParam=
|
||||
SetupCompleteExecReadme=
|
||||
|
||||
[RegEntries]
|
||||
Reg1Path=HKEY_CLASSES_ROOT
|
||||
Reg1Val1Type=0
|
||||
Reg1Val1Name=(Default)
|
||||
Reg1Val1Data=(value not set)
|
||||
Reg1Vals=1
|
||||
Reg2Path=HKEY_CURRENT_USER
|
||||
Reg2Val1Type=0
|
||||
Reg2Val1Name=(Default)
|
||||
Reg2Val1Data=(value not set)
|
||||
Reg2Vals=1
|
||||
Reg3Path=HKEY_LOCAL_MACHINE
|
||||
Reg3Val1Type=0
|
||||
Reg3Val1Name=(Default)
|
||||
Reg3Val1Data=(value not set)
|
||||
Reg3Vals=1
|
||||
Reg4Path=HKEY_USERS
|
||||
Reg4Val1Type=0
|
||||
Reg4Val1Name=(Default)
|
||||
Reg4Val1Data=(value not set)
|
||||
Reg4Vals=1
|
||||
Reg5Path=HKEY_CURRENT_CONFIG
|
||||
Reg5Val1Type=0
|
||||
Reg5Val1Name=(Default)
|
||||
Reg5Val1Data=(value not set)
|
||||
Reg5Vals=1
|
||||
Reg6Path=HKEY_DYN_DATA
|
||||
Reg6Val1Type=0
|
||||
Reg6Val1Name=(Default)
|
||||
Reg6Val1Data=(value not set)
|
||||
Reg6Vals=1
|
||||
Regs=6
|
||||
|
||||
[Registry]
|
||||
|
||||
[Icons]
|
||||
Icons=5
|
||||
Icon1Param=
|
||||
Icon1Cmd=[Program Files]\ctrlmstr.exe
|
||||
Icon1Description=Control Maestro
|
||||
Icon1WorkingDir=[Program Files]
|
||||
Icon1IconFile=[Program Files]\CtrlMstr.exe
|
||||
Icon1RealFile=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\CtrlMstr.exe
|
||||
Icon1WhichIcon=0
|
||||
Icon1KeyVirtual=0
|
||||
Icon1KeyFlags=0
|
||||
Icon1StartMenu=3
|
||||
Icon1Window=0
|
||||
Icon2Param=
|
||||
Icon2Cmd=[Program Files]\ctrlmstr.exe
|
||||
Icon2Description=Control Maestro
|
||||
Icon2WorkingDir=[Program Files]
|
||||
Icon2IconFile=[Program Files]\CtrlMstr.exe
|
||||
Icon2RealFile=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\CtrlMstr.exe
|
||||
Icon2WhichIcon=0
|
||||
Icon2KeyVirtual=0
|
||||
Icon2KeyFlags=0
|
||||
Icon2StartMenu=0
|
||||
Icon2Window=0
|
||||
Icon3Param=
|
||||
Icon3Cmd=[Program Files]\DataViewer.exe
|
||||
Icon3Description=DataViewer
|
||||
Icon3WorkingDir=[Program Files]
|
||||
Icon3IconFile=[Program Files]\DataViewer.exe
|
||||
Icon3RealFile=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\DataViewer.exe
|
||||
Icon3WhichIcon=0
|
||||
Icon3KeyVirtual=0
|
||||
Icon3KeyFlags=0
|
||||
Icon3StartMenu=0
|
||||
Icon3Window=0
|
||||
Icon4Param=
|
||||
Icon4Cmd=[Program Files]\LockIt!.doc
|
||||
Icon4Description=LockIt!
|
||||
Icon4WorkingDir=[Program Files]
|
||||
Icon4IconFile=[Ayuda]\LockIt!.doc
|
||||
Icon4RealFile=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\Documentacion\LockIt!.doc
|
||||
Icon4WhichIcon=0
|
||||
Icon4KeyVirtual=0
|
||||
Icon4KeyFlags=0
|
||||
Icon4StartMenu=0
|
||||
Icon4Window=0
|
||||
Icon5Param=
|
||||
Icon5Cmd=[Ayuda]\DataViewer.doc
|
||||
Icon5Description=DataViewer (Ayuda)
|
||||
Icon5WorkingDir=[Ayuda]
|
||||
Icon5IconFile=
|
||||
Icon5RealFile=C:\Mis documentos\Fuentes de Programacion\CtrlMstr\Documentacion\DataViewer.doc
|
||||
Icon5WhichIcon=0
|
||||
Icon5KeyVirtual=0
|
||||
Icon5KeyFlags=0
|
||||
Icon5StartMenu=0
|
||||
Icon5Window=0
|
||||
|
||||
[Autoexec]
|
||||
PathDir=
|
||||
ShareLocks=
|
||||
ShareFiles=
|
||||
Command=
|
||||
|
||||
[CopyToFloppy]
|
||||
DriveOption=
|
||||
DestinationPath=
|
||||
DestinationPathOneFile=
|
||||
Password=
|
||||
|
||||
[ISObjectIDs]
|
||||
nTotal=2
|
||||
ID1=101
|
||||
ID2=58
|
||||
|
||||
[Uninstall]
|
||||
UserUninstall=0
|
47
Instalador.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "Instalador.h"
|
||||
#include <ShellAPI.hpp>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TForm1 *Form1;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TForm1::TForm1(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TForm1::Image1Click(TObject *Sender)
|
||||
{
|
||||
char zFileName[80], zParams[80], zDir[80];
|
||||
ShellExecute(Application->MainForm->Handle, 0, StrPCopy(zFileName, "http:\\\\www.infdj.com"),
|
||||
StrPCopy(zParams, ""), StrPCopy(zDir, ""), SW_SHOWNOACTIVATE > 32);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TForm1::Button2Click(TObject *Sender)
|
||||
{
|
||||
char zFileName[80], zParams[80], zDir[80];
|
||||
ShellExecute(Application->MainForm->Handle, 0, StrPCopy(zFileName, "Guardian.exe"),
|
||||
StrPCopy(zParams, ""), StrPCopy(zDir, ""), SW_SHOWNOACTIVATE > 32);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TForm1::Button1Click(TObject *Sender)
|
||||
{
|
||||
char zFileName[80], zParams[80], zDir[80];
|
||||
ShellExecute(Application->MainForm->Handle, 0, StrPCopy(zFileName, "Control.exe"),
|
||||
StrPCopy(zParams, ""), StrPCopy(zDir, ""), SW_SHOWNOACTIVATE > 32);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TForm1::Image2Click(TObject *Sender)
|
||||
{
|
||||
ShowMessage( "Si necesita crear una distribución\ndel Guardian en discos, copie el\nfichero GUARDIAN.EXE manualmente." );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
BIN
Instalador.dfm
Normal file
39
Instalador.h
Normal file
@ -0,0 +1,39 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef InstaladorH
|
||||
#define InstaladorH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include <ExtCtrls.hpp>
|
||||
#include <Graphics.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TForm1 : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TImage *Image1;
|
||||
TBevel *Bevel1;
|
||||
TLabel *Label1;
|
||||
TLabel *Label2;
|
||||
TBevel *Bevel2;
|
||||
TButton *Button1;
|
||||
TLabel *Label3;
|
||||
TLabel *Label4;
|
||||
TBevel *Bevel3;
|
||||
TButton *Button2;
|
||||
TLabel *Label5;
|
||||
TLabel *Label6;
|
||||
TImage *Image2;
|
||||
void __fastcall Image1Click(TObject *Sender);
|
||||
void __fastcall Button2Click(TObject *Sender);
|
||||
void __fastcall Button1Click(TObject *Sender);
|
||||
void __fastcall Image2Click(TObject *Sender);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TForm1(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TForm1 *Form1;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
129
Install.bpr
Normal file
@ -0,0 +1,129 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.05.03"/>
|
||||
<PROJECT value="Install.exe"/>
|
||||
<OBJFILES value="Install.obj Instalador.obj"/>
|
||||
<RESFILES value="Install.res"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES) Instalador.dfm"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value="JD_soft.lib CDopping.lib inet50.lib vclbde50.lib vcldb50.lib vcl50.lib
|
||||
vclx50.lib"/>
|
||||
<SPARELIBS value="vclx50.lib vcl50.lib vcldb50.lib vclbde50.lib inet50.lib CDopping.lib
|
||||
JD_soft.lib"/>
|
||||
<PACKAGES value="vclx50.bpi vcl50.bpi vcldb50.bpi vclbde50.bpi vcldbx50.bpi bcbsmp50.bpi
|
||||
dclocx50.bpi qrpt50.bpi teeui50.bpi vclsmp50.bpi teedb50.bpi tee50.bpi
|
||||
ibsmp50.bpi nmfast50.bpi inetdb50.bpi inet50.bpi"/>
|
||||
<PATHCPP value=".;"/>
|
||||
<PATHPAS value=".;"/>
|
||||
<PATHRC value=".;"/>
|
||||
<PATHASM value=".;"/>
|
||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
||||
<LINKER value="ilink32"/>
|
||||
<USERDEFINES value=""/>
|
||||
<SYSDEFINES value="NO_STRICT"/>
|
||||
<MAINSOURCE value="Install.cpp"/>
|
||||
<INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;D:\JDsoft\PrjTPVwin\VCLs\include"/>
|
||||
<LIBPATH value="..\prjtpvwin\vcls\lib;$(BCB)\lib\obj;$(BCB)\lib;D:\JDsoft\PrjTPVwin\VCLs\lib"/>
|
||||
<WARNINGS value="-w-par -w-8027 -w-8026"/>
|
||||
<WARNOPTSTR value=""/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-src_suffix cpp -I$(BCB)\include -I$(BCB)\include\vcl
|
||||
-ID:\JDsoft\PrjTPVwin\VCLs\include -boa"/>
|
||||
<CFLAG1 value="-Od -H=c:\PROGRAM\CBUILDER\CBUILD~1\lib\vcl35.csm -Hc -Vx -Ve -X- -r- -a8
|
||||
-b- -k -y -v -vi- -c -tW -Tkh30000 -tWM"/>
|
||||
<CFLAG2 value=""/>
|
||||
<CFLAG3 value=""/>
|
||||
<PFLAGS value="-$YD -$W -$O- -v -M -JPHNE"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zd"/>
|
||||
<LFLAGS value="-D"" -aa -Tpe -x -Gn -v"/>
|
||||
<IFLAGS value=""/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
|
||||
</LINKER>
|
||||
<IDEOPTIONS>
|
||||
[Version Info]
|
||||
IncludeVerInfo=1
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=JD Soft
|
||||
FileDescription=Visualizador de ficheros
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=recolector
|
||||
LegalCopyright=JD Soft. 199x-2000
|
||||
LegalTrademarks=JD Soft.
|
||||
OriginalFilename=Recolector.EXE
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
url=http://www.jd.infdj.com
|
||||
e-mail=jd@infdj.com
|
||||
|
||||
[HistoryLists\hlIncludePath]
|
||||
Count=2
|
||||
Item0=$(BCB)\include;$(BCB)\include\vcl;D:\JDsoft\PrjTPVwin\VCLs\include
|
||||
Item1=$(BCB)\include;$(BCB)\include\vcl
|
||||
|
||||
[HistoryLists\hlLibraryPath]
|
||||
Count=3
|
||||
Item0=..\prjtpvwin\vcls\lib;$(BCB)\lib\obj;$(BCB)\lib;D:\JDsoft\PrjTPVwin\VCLs\lib
|
||||
Item1=$(BCB)\lib\obj;$(BCB)\lib;D:\JDsoft\PrjTPVwin\VCLs\lib
|
||||
Item2=$(BCB)\lib\obj;$(BCB)\lib
|
||||
|
||||
[HistoryLists\hlDebugSourcePath]
|
||||
Count=1
|
||||
Item0=$(BCB)\source\vcl
|
||||
|
||||
[HistoryLists\hlConditionals]
|
||||
Count=2
|
||||
Item0=_RTLDLL
|
||||
Item1=_RTLDLL;USEPACKAGES
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=$(BCB)\source\vcl
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
RemoteDebug=0
|
||||
|
||||
[Compiler]
|
||||
ShowInfoMsgs=0
|
||||
LinkDebugVcl=0
|
||||
LinkCGLIB=0
|
||||
|
||||
[CORBA]
|
||||
AddServerUnit=1
|
||||
AddClientUnit=1
|
||||
PrecompiledHeaders=1
|
||||
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
</IDEOPTIONS>
|
||||
</PROJECT>
|
21
Install.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
USERES("Install.res");
|
||||
USEFORM("Instalador.cpp", Form1);
|
||||
//---------------------------------------------------------------------------
|
||||
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
Application->CreateForm(__classid(TForm1), &Form1);
|
||||
Application->Run();
|
||||
}
|
||||
catch (Exception &exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Install.exe
Normal file
BIN
Install.res
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
#CtrlMstr
|
||||
|
||||
|
||||
*11/12/1999*
|
||||
|
||||
ToDo: wwtcf?
|
||||
|
||||
|
||||

|
127
ReajustarDinero.bpr
Normal file
@ -0,0 +1,127 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.05.03"/>
|
||||
<PROJECT value="ReajustarDinero.exe"/>
|
||||
<OBJFILES value="ReajustarDinero.obj Unit2.obj"/>
|
||||
<RESFILES value="ReajustarDinero.res"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES) Unit2.dfm"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value="JDsoft.lib vclx50.lib QRPT50.lib VCLBDE50.lib VCLDB50.lib VCL50.lib"/>
|
||||
<SPARELIBS value="VCL50.lib VCLDB50.lib VCLBDE50.lib QRPT50.lib vclx50.lib JDsoft.lib"/>
|
||||
<PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi VCLDB50.bpi VCLADO50.bpi ibsmp50.bpi
|
||||
VCLBDE50.bpi VCLDBX50.bpi QRPT50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi
|
||||
DSS50.bpi TEEQR50.bpi VCLIB50.bpi VCLMID50.bpi VCLIE50.bpi INETDB50.bpi
|
||||
INET50.bpi NMFAST50.bpi WEBMID50.bpi bcbie50.bpi dclocx50.bpi
|
||||
bcb2kaxserver50.bpi CoolPack.bpi JDsoft.bpi"/>
|
||||
<PATHCPP value=".;"/>
|
||||
<PATHPAS value=".;"/>
|
||||
<PATHRC value=".;"/>
|
||||
<PATHASM value=".;"/>
|
||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
||||
<LINKER value="tlink32"/>
|
||||
<USERDEFINES value="_DEBUG"/>
|
||||
<SYSDEFINES value="NO_STRICT"/>
|
||||
<MAINSOURCE value="ReajustarDinero.cpp"/>
|
||||
<INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include"/>
|
||||
<LIBPATH value="C:\VCLs\lib\;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib"/>
|
||||
<WARNINGS value="-w-par"/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-src_suffix cpp -D_DEBUG -I$(BCB)\include -I$(BCB)\include\vcl
|
||||
-I..\VCLs\include -boa"/>
|
||||
<CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
|
||||
-tW -tWM"/>
|
||||
<PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zd"/>
|
||||
<LFLAGS value="-D"" -aa -Tpe -x -Gn -v"/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
|
||||
</LINKER>
|
||||
<IDEOPTIONS>
|
||||
[Version Info]
|
||||
IncludeVerInfo=1
|
||||
AutoIncBuild=1
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=2
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=JD Soft.
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.2
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=JD soft.
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
url=www.infdj.com
|
||||
e-mail=jd@infdj.com
|
||||
|
||||
[Excluded Packages]
|
||||
$(BCB)\Projects\Bpl\Dialup.bpl=RAS Tools
|
||||
|
||||
[HistoryLists\hlIncludePath]
|
||||
Count=2
|
||||
Item0=$(BCB)\include;$(BCB)\include\vcl;..\VCLs\include
|
||||
Item1=$(BCB)\include;$(BCB)\include\vcl
|
||||
|
||||
[HistoryLists\hlLibraryPath]
|
||||
Count=3
|
||||
Item0=C:\VCLs\lib\;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib
|
||||
Item1=..\..\..\..\VCLs\lib;$(BCB)\lib\obj;$(BCB)\lib;..\VCLs\lib
|
||||
Item2=..\..\..\..\VCLs\lib;$(BCB)\lib\obj;$(BCB)\lib
|
||||
|
||||
[HistoryLists\hlDebugSourcePath]
|
||||
Count=1
|
||||
Item0=$(BCB)\source\vcl
|
||||
|
||||
[HistoryLists\hlConditionals]
|
||||
Count=1
|
||||
Item0=_DEBUG
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=$(BCB)\source\vcl
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
RemoteDebug=0
|
||||
|
||||
[Compiler]
|
||||
ShowInfoMsgs=0
|
||||
LinkDebugVcl=0
|
||||
LinkCGLIB=0
|
||||
|
||||
[CORBA]
|
||||
AddServerUnit=1
|
||||
AddClientUnit=1
|
||||
PrecompiledHeaders=1
|
||||
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
</IDEOPTIONS>
|
||||
</PROJECT>
|
22
ReajustarDinero.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
USERES("ReajustarDinero.res");
|
||||
USEFORM("Unit2.cpp", Form2);
|
||||
//---------------------------------------------------------------------------
|
||||
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
Application->CreateForm(__classid(TForm2), &Form2);
|
||||
Application->Run();
|
||||
}
|
||||
catch (Exception &exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
ReajustarDinero.exe
Normal file
BIN
ReajustarDinero.res
Normal file
BIN
Status.bmp
Normal file
After Width: | Height: | Size: 46 KiB |
328
TStatus.cpp
Normal file
@ -0,0 +1,328 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <io.h>
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "TStatus.h"
|
||||
#include "CtrlPPal.h"
|
||||
|
||||
#include "CtrlElemento.h"
|
||||
#include "FichasClientes.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "CoolForm"
|
||||
#pragma link "DigitNum"
|
||||
#pragma link "FormularioREUSABLE"
|
||||
#pragma resource "*.dfm"
|
||||
TStatus *Status;
|
||||
|
||||
#define Comienzo TbElementosCFG->FieldByName("Comienzo")->AsDateTime
|
||||
|
||||
#define pTiempo TbElementosCFG->FieldByName("Tiempo")->AsDateTime
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TStatus::TStatus(TComponent* Owner)
|
||||
: TFormREUSABLE(Owner)
|
||||
{
|
||||
// CtrlPPal->TbElementosCFG->FieldByName("NumElement")->AsString + " --";
|
||||
|
||||
TbPrecios->Active = true;
|
||||
TbHistorial ->Active = true;
|
||||
TbElementosCFG->Active = true;
|
||||
|
||||
// TiempoPedido->DateTime = 0;
|
||||
// TiempoPedido->Time = 0;
|
||||
|
||||
ltime2Click( 0 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::SetElement( TElemento *Elto )
|
||||
{
|
||||
Elemento = Elto;
|
||||
|
||||
Terminal->Caption = "Terminal número: -- " + AnsiString( Elemento->NumElemento ) + " --";
|
||||
|
||||
if ( CtrlPPal->ServerHook ) return;
|
||||
|
||||
if ( ! TbElementosCFG->Locate( "NumElement", Elemento->NumElemento, TLocateOptions() << loCaseInsensitive ) )
|
||||
ShowMessage( "ERROR, EL TERMINAL NO SE ENCONTRO!!\nAPPLICATION MALFUNTIONNNN Granted" );
|
||||
|
||||
// if ( ! TbElementosCFG->FieldByName( "Activo" )->AsBoolean )
|
||||
if ( Elemento->StatusCode == FREE )
|
||||
{
|
||||
MasTiempo->Visible = false;
|
||||
|
||||
Label2->Caption = "&Tiempo que pide:";
|
||||
Label4->Caption = "&Tipo de Conexión:";
|
||||
PrecioAcumulado = 0;
|
||||
ActivarTerminal->Visible = true;
|
||||
ActivarTerminal->Enabled = true;
|
||||
TipoConexion->Enabled = true;
|
||||
|
||||
// TiempoPedido->Enabled = true;
|
||||
Edit1->Enabled = true;
|
||||
Edit2->Enabled = true;
|
||||
SetCliente->Enabled = true;
|
||||
TbElementosCFG->Edit();
|
||||
Comienzo = TDateTime::CurrentTime();
|
||||
TbElementosCFG->Post();
|
||||
} else {
|
||||
// El terminal está ocupado
|
||||
unsigned short Hour, Min, Sec, MSec;
|
||||
Label4->Caption = AnsiString(PrecioAcumulado) + " acumuladas.";
|
||||
pTiempo.DecodeTime( &Hour, &Min, &Sec, &MSec );
|
||||
Edit1->Text = AnsiString( Hour );
|
||||
Edit2->Text = AnsiString( Min );
|
||||
Label3->Caption = Elemento->NCliente;
|
||||
// TiempoPedido->Time = pTiempo;
|
||||
// TiempoPedidoChange( 0 );
|
||||
MasTiempo->Visible = true;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::Time1MouseUp(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y)
|
||||
{
|
||||
ltime1Click( Sender );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::Time2MouseUp(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y)
|
||||
{
|
||||
ltime2Click( Sender );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::Time3MouseUp(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y)
|
||||
{
|
||||
ltime3Click( Sender );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::ltime1Click(TObject *Sender)
|
||||
{
|
||||
unsigned short nullValue, h, m;
|
||||
Time1 -> Brush -> Color = clRed;
|
||||
Time2 -> Brush -> Color = clBlack;
|
||||
Time3 -> Brush -> Color = clBlack;
|
||||
|
||||
Comienzo.DecodeTime( &h, &m, &nullValue, &nullValue );
|
||||
Dig1->Value = h;
|
||||
Dig2->Value = m;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::ltime2Click(TObject *Sender)
|
||||
{
|
||||
TDateTime lleva; unsigned short nullValue, h, m;
|
||||
|
||||
Time1 -> Brush -> Color = clBlack;
|
||||
Time2 -> Brush -> Color = clRed;
|
||||
Time3 -> Brush -> Color = clBlack;
|
||||
|
||||
lleva = TDateTime::CurrentTime() - Comienzo;
|
||||
|
||||
lleva.DecodeTime( &h, &m, &nullValue, &nullValue );
|
||||
Dig1->Value = h;
|
||||
Dig2->Value = m;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::ltime3Click(TObject *Sender)
|
||||
{
|
||||
TDateTime Queda; unsigned short nullValue, h, m;
|
||||
|
||||
Time1 -> Brush -> Color = clBlack;
|
||||
Time2 -> Brush -> Color = clBlack;
|
||||
Time3 -> Brush -> Color = clRed;
|
||||
|
||||
Queda = ( pTiempo + Comienzo ) - TDateTime::CurrentTime();
|
||||
Queda.DecodeTime( &h, &m, &nullValue, &nullValue );
|
||||
Dig1->Value = h;
|
||||
Dig2->Value = m + 1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::ActivarTerminalClick(TObject *Sender)
|
||||
{
|
||||
int HorasP = Edit1->Text.ToInt();
|
||||
int MinutP = Edit2->Text.ToInt();
|
||||
// Una vez asignado el terminal a una persona, ya no le puede ser reasignado
|
||||
// tiempo, ni puede cambiarse el usuario propietario de él.
|
||||
|
||||
// Abrimos la tabla de ventas de mi otro programa
|
||||
// Insertamos esto como venta: (Cliente | [TipoConexion+Tiempo] | 1und | PrecioConexionTotal)
|
||||
// Cerramos la tabla
|
||||
|
||||
if ( HorasP == 0 && MinutP == 0 )
|
||||
return;
|
||||
|
||||
// Comprobamos que no se le asigne mas tiempo del que dispone en el bono
|
||||
if ( idCliente > 0 && ClienteUsaBono &&
|
||||
( HorasP > TBonoH ||
|
||||
(HorasP ==TBonoH && MinutP > TBonoM)
|
||||
)
|
||||
)
|
||||
{
|
||||
ShowMessage ( "Atención, al cliente: \n" + Label3->Caption + "\nsolo le quedan " + TBonoH +":"+TBonoM + " disponible.\nNo puedo asignar mas tiempo." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Desactivamos los controles...
|
||||
TipoConexion->Enabled = false;
|
||||
// TiempoPedido->Enabled = false;
|
||||
Edit1->Enabled = false;
|
||||
Edit2->Enabled = false;
|
||||
|
||||
ActivarTerminal->Enabled = false;
|
||||
ActivarTerminal->Visible = false;
|
||||
|
||||
if ( ! CtrlPPal->ServerHook )
|
||||
{
|
||||
// Activamos el terminal
|
||||
TbElementosCFG ->Edit();
|
||||
TbElementosCFG ->FieldByName( "Activo" )->AsBoolean = true;
|
||||
Comienzo = TDateTime::CurrentTime();
|
||||
pTiempo = EncodeTime( HorasP, MinutP, 0, 0 );
|
||||
TbElementosCFG ->Post();
|
||||
}
|
||||
ltime2Click( 0 );
|
||||
|
||||
int idtc;
|
||||
switch ( TipoConexion->ItemIndex )
|
||||
{
|
||||
// Internet
|
||||
case 0: idtc = 0; break;
|
||||
// Juegos
|
||||
case 1: idtc = 1; break;
|
||||
// Otros
|
||||
case 2: idtc = 3; break;
|
||||
// Otros
|
||||
case 3: idtc = 2; break;
|
||||
default: idtc = 2; break;
|
||||
}
|
||||
|
||||
//////// ACTIVAMOS REALMENTE EL TERMINAL ///////////////////////////////////
|
||||
Currency PrecioConexion;
|
||||
if ( idCliente > 0 && ClienteUsaBono )
|
||||
PrecioConexion = -1;
|
||||
else
|
||||
PrecioConexion = TbPrecios->FieldByName("Precio")->AsCurrency;
|
||||
CtrlPPal->SetActiveTimeElement( Elemento, pTiempo, idCliente, idtc, PrecioConexion );
|
||||
PrecioAcumulado += PrecioConexion;
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::TiempoPedidoChange(TObject *Sender)
|
||||
{
|
||||
TDateTime TiempoPedido;
|
||||
/*
|
||||
if ( TiempoPedido->Time > EncodeTime( 5, 0, 0, 0 ) )
|
||||
TiempoPedido->Time = EncodeTime( 5, 0, 0, 0 );
|
||||
*/
|
||||
try {
|
||||
if ( Edit1->Text.ToInt() < 0 || Edit1->Text.ToInt() > 5 ) Edit1->Text = "0";
|
||||
} catch(...) { Edit1->Text = "0";
|
||||
Edit1->SelStart= 0;
|
||||
Edit1->SelLength= 1;
|
||||
}
|
||||
try {
|
||||
if ( Edit2->Text.ToInt() < 0 || Edit2->Text.ToInt() >59 ) Edit2->Text = "0";
|
||||
} catch(...) { Edit2->Text = "0";
|
||||
Edit2->SelStart= 0;
|
||||
Edit2->SelLength= 1;
|
||||
}
|
||||
TiempoPedido = EncodeTime( Edit1->Text.ToInt(), Edit2->Text.ToInt(), 0, 0 );
|
||||
|
||||
// Buscamos en la tabla de precios, al 1º que tenga un tiempo superior o igual
|
||||
// al que nos pide el cliente...
|
||||
TbPrecios->First();
|
||||
while( !TbPrecios->Eof && TbPrecios->FieldByName("Tiempo")->AsDateTime < TiempoPedido )//->Time )
|
||||
TbPrecios->Next();
|
||||
|
||||
// Actualizamos el precio
|
||||
int Number = (TbPrecios->FieldByName("Precio")->AsCurrency)*100;
|
||||
Precio->Value = Number / 100;
|
||||
PrecioDec->Value = Number % 100;
|
||||
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TStatus::TbPreciosBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
// Si la tabla no existe, la creamos
|
||||
if ( access( (TbPrecios -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendrá la tabla
|
||||
TbPrecios -> FieldDefs -> Clear();
|
||||
|
||||
TbPrecios -> FieldDefs -> Add("Tiempo", ftTime, 0, false );
|
||||
TbPrecios -> FieldDefs -> Add("Precio", ftCurrency, 0, false );
|
||||
|
||||
TbPrecios -> IndexDefs -> Clear();
|
||||
TbPrecios -> IndexDefs -> Add("Primary", "Tiempo", TIndexOptions() << ixPrimary << ixUnique );
|
||||
|
||||
// Creamos la base...
|
||||
TbPrecios -> CreateTable();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TStatus::SetClienteClick(TObject *Sender)
|
||||
{
|
||||
TFClientes *Ficha;
|
||||
ClienteUsaBono = false;
|
||||
|
||||
Ficha = new TFClientes(this);
|
||||
if ( Ficha -> ShowModal() == mrOk )
|
||||
{
|
||||
idCliente = CtrlPPal->TbPersonas->FieldByName("CodCliente1")->AsInteger;
|
||||
TBonoH = CtrlPPal->TbPersonas->FieldByName("TiempoH")->AsInteger;
|
||||
TBonoM = CtrlPPal->TbPersonas->FieldByName("TiempoM")->AsInteger;
|
||||
Label3->Caption = CtrlPPal->TbPersonas->FieldByName("Nombre")->AsString + " " + CtrlPPal->TbPersonas->FieldByName("Apellidos")->AsString;
|
||||
ClienteUsaBono =((TBonoH > 0) || (TBonoM > 0));
|
||||
} else {
|
||||
idCliente = 0;
|
||||
Label3->Caption = "Anonimo";
|
||||
}
|
||||
delete Ficha;
|
||||
|
||||
if ( ClienteUsaBono )
|
||||
{
|
||||
Precio->Visible = false;
|
||||
PrecioDec->Visible = false;
|
||||
|
||||
UBono1->Visible = true;
|
||||
UBono2->Caption = AnsiString(TBonoH) + " : " + AnsiString(TBonoM);
|
||||
UBono2->Visible = true;
|
||||
} else {
|
||||
Precio->Visible = true;
|
||||
PrecioDec->Visible = true;
|
||||
|
||||
UBono1->Visible = false;
|
||||
UBono2->Visible = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TStatus::Button1Click(TObject *Sender)
|
||||
{
|
||||
ModalResult = mrCancel;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TStatus::MasTiempoClick(TObject *Sender)
|
||||
{
|
||||
MasTiempo->Visible = false;
|
||||
|
||||
ActivarTerminal->Visible = true;
|
||||
ActivarTerminal->Enabled = true;
|
||||
TipoConexion->Enabled = true;
|
||||
Label2->Caption = "&Tiempo que añade:";
|
||||
Edit1->Enabled = true;
|
||||
Edit2->Enabled = true;
|
||||
SetCliente->Enabled = true;
|
||||
TbElementosCFG->Edit();
|
||||
Comienzo = TDateTime::CurrentTime();
|
||||
TbElementosCFG->Post(); //
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|