First commit 11/07/1998
This commit is contained in:
730
TAlarcon.cpp
Normal file
730
TAlarcon.cpp
Normal file
@ -0,0 +1,730 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <io.h>
|
||||
#include <vcl\vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "TAlarcon.h"
|
||||
#include "AcercaDe.h"
|
||||
#include "TAlarconBusc1.h"
|
||||
#include "TAlarconFichas.h"
|
||||
#include "TAlarconProductos.h"
|
||||
#include "TAlarconRegLlamadas.h"
|
||||
#include "TAlarconProductos2.h"
|
||||
#include "TAlarconRegLlamadasSIMPLE.h"
|
||||
#include "LSPrecios1.h"
|
||||
#include "LSPrecios2.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma link "Grids"
|
||||
#pragma link "ElastFrm"
|
||||
#pragma resource "*.dfm"
|
||||
TAplicacion *Aplicacion;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TAplicacion::TAplicacion(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
/*
|
||||
TbRegVehiculos -> Active = true;
|
||||
TbVehiculos -> Active = true;
|
||||
|
||||
TbCltProv -> Active = true;
|
||||
TbClientes -> Active = true;
|
||||
TbBuscarCltProv -> Active = true;
|
||||
|
||||
TbProductos1 -> Active = true;
|
||||
TbProductos2 -> Active = true;
|
||||
*/
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::ComboBox2Change(TObject *Sender)
|
||||
{
|
||||
FechaCombosL = TDateTime( ComboBox1 -> ItemIndex == -1 ? 98 : ComboBox1 -> ItemIndex + 98,
|
||||
ComboBox2 -> ItemIndex == -1 ? 1 : ComboBox2 -> ItemIndex + 1, 1 );
|
||||
// Ajusta Filtros
|
||||
ReajustaFiltros();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::ComboBox3Change(TObject *Sender)
|
||||
{
|
||||
FechaCombosH = TDateTime( ComboBox1 -> ItemIndex == -1 ? 98 : ComboBox1 -> ItemIndex + 98,
|
||||
ComboBox3 -> ItemIndex == -1 ? 12 : ComboBox3 -> ItemIndex + 1,
|
||||
UltimoDiaPara(ComboBox1 -> ItemIndex == -1 ? 98 : ComboBox1 -> ItemIndex + 1,
|
||||
ComboBox3 -> ItemIndex == -1 ? 12 : ComboBox3 -> ItemIndex + 1) );
|
||||
// Ajusta Filtros
|
||||
ReajustaFiltros();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::ComboBox1Change(TObject *Sender)
|
||||
{
|
||||
FechaCombosL = TDateTime( ComboBox1 -> ItemIndex == -1 ? 98 : ComboBox1 -> ItemIndex + 98,
|
||||
ComboBox2 -> ItemIndex == -1 ? 1 : ComboBox2 -> ItemIndex + 1, 1 );
|
||||
FechaCombosH = TDateTime( ComboBox1 -> ItemIndex == -1 ? 98 : ComboBox1 -> ItemIndex + 98,
|
||||
ComboBox3 -> ItemIndex == -1 ? 12 : ComboBox3 -> ItemIndex + 1,
|
||||
UltimoDiaPara(ComboBox1 -> ItemIndex == -1 ? 98 : ComboBox1 -> ItemIndex + 98,
|
||||
ComboBox3 -> ItemIndex == -1 ? 12 : ComboBox3 -> ItemIndex + 1) );
|
||||
// Ajusta Filtros
|
||||
ReajustaFiltros();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::ReajustaFiltros(void)
|
||||
{
|
||||
// MessageBox( 0, AnsiString( DateToStr(FechaCombosL ) + " y " + DateToStr( FechaCombosH ) ).c_str(), "Aplicando Filtros", MB_OK );
|
||||
TbRegVehiculos->FilterOptions = TbRegVehiculos->FilterOptions << foCaseInsensitive;
|
||||
TbRegVehiculos->Filter = "([Fecha] >= '" + DateToStr(FechaCombosL) + "') AND [Fecha] < '" + DateToStr(FechaCombosH) + "'";
|
||||
if ( TbRegVehiculos -> RecordCount != 0 )
|
||||
{
|
||||
TbRegVehiculos->Filtered = true;
|
||||
/*
|
||||
} else {
|
||||
MessageBox( 0, "No existen registros\nen ese rango:\nANULANDO FILTRO", "Alerta de filtro", MB_OK );
|
||||
TbRegVehiculos->Filtered = false;
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::DBGrid4Enter(TObject *Sender)
|
||||
{
|
||||
if ( TbProductos1 -> RecordCount == 0 )
|
||||
TbProductos1 -> Insert();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbProductos1NewRecord(TDataSet *DataSet)
|
||||
{
|
||||
TbProductos1 -> FieldByName( "Fecha" ) -> AsDateTime = TDateTime::CurrentDate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbProductos2NewRecord(TDataSet *DataSet)
|
||||
{
|
||||
TbProductos2 -> FieldByName( "Fecha" ) -> AsDateTime = TDateTime::CurrentDate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::SpeedButton1Click(TObject *Sender)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::Salir1Click(TObject *Sender)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::Acercade1Click(TObject *Sender)
|
||||
{
|
||||
TAboutBox * fmAboutBox;
|
||||
|
||||
fmAboutBox = new TAboutBox(this);
|
||||
fmAboutBox->ShowModal();
|
||||
delete fmAboutBox;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbRegVehiculosNewRecord(TDataSet *DataSet)
|
||||
{
|
||||
// El registro actual, tendr<64> como fecha y hora, las actuales
|
||||
TbRegVehiculos -> FieldByName( "Fecha" ) -> AsDateTime = TDateTime::CurrentDate();
|
||||
TbRegVehiculos -> FieldByName( "Hora" ) -> AsDateTime = TDateTime::CurrentTime();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::FormCreate(TObject *Sender)
|
||||
{
|
||||
unsigned short AActual, M, D;
|
||||
TDateTime FActual;
|
||||
|
||||
FActual = FActual . CurrentDate();
|
||||
FActual . DecodeDate( &AActual, &M, &D );
|
||||
|
||||
FechaCombosL = TDateTime( ComboBox1 -> ItemIndex == -1 ? AActual : ComboBox1 -> ItemIndex + 98,
|
||||
ComboBox2 -> ItemIndex == -1 ? 1 : ComboBox2 -> ItemIndex + 1, 1 );
|
||||
FechaCombosH = TDateTime( ComboBox1 -> ItemIndex == -1 ? AActual : ComboBox1 -> ItemIndex + 98,
|
||||
ComboBox3 -> ItemIndex == -1 ? 12 : ComboBox3 -> ItemIndex + 1,
|
||||
UltimoDiaPara(ComboBox1 -> ItemIndex == -1 ? AActual : ComboBox1 -> ItemIndex + 98,
|
||||
ComboBox3 -> ItemIndex == -1 ? 12 : ComboBox3 -> ItemIndex + 1) );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
/**************************************************************************\
|
||||
|* *|
|
||||
|* CalculaAjusteDia *|
|
||||
|* *|
|
||||
|* Descripci<63>n: *|
|
||||
|* Calcula el ajuste necesario para el comienzo de los dias *|
|
||||
|* y el n<>mero de dias que tiene el mes en curso. *|
|
||||
|* *|
|
||||
|* Entradas: Retorno del Ajuste, y Dias del Mes *|
|
||||
|* Mes para iniciar c<>lculos *|
|
||||
|* *|
|
||||
|* Salidas: OK Todo ha ido bien *|
|
||||
|* ERROR *|
|
||||
|* *|
|
||||
\**************************************************************************/
|
||||
//int CalculaAjusteDias( char *Ajuste, char *DiasMes, char Mes, int Anyo )
|
||||
short int __fastcall TAplicacion::UltimoDiaPara( int Anyo, int Mes )
|
||||
{
|
||||
short int Ajuste, DiasMes;
|
||||
|
||||
int dev, n, b, dsem, dia;
|
||||
|
||||
|
||||
// Dias de los meses, si el a<>o no es bisiesto
|
||||
char DiasMeses[12] = { 31, 00, 31, 30, 31, 30,
|
||||
31, 31, 30, 31, 30, 31 };
|
||||
|
||||
// Ajusta febrero si es bisiesto el a<>o
|
||||
DiasMeses[1] = (Anyo%4 == 0) ? 29 : 28;
|
||||
|
||||
|
||||
// dev = ERROR;
|
||||
// Solo si la entrada es correcta
|
||||
if ( Mes >= 1 && Mes <=12 )
|
||||
{
|
||||
// dev = OK;
|
||||
// Obtenemos que dia, ( 0 - 365 ), es el 1<> del mes
|
||||
dia = 0;
|
||||
for ( n = 0; n < 12 && n < (Mes-1); n++ )
|
||||
dia += DiasMeses[n];
|
||||
|
||||
n = Anyo-1988; // a<>os para bisiesto
|
||||
b = (n+3)/4; // a<>os bisies. pasados
|
||||
dsem = 4; // 1o. Ene 1988: Viernes
|
||||
dsem += (n*365+b); // 1o. Ene actual
|
||||
dsem = (dsem+dia)%7; // d<>a seleccionado
|
||||
|
||||
/***/Ajuste = dsem;
|
||||
/***/DiasMes = DiasMeses[ Mes - 1 ];
|
||||
}
|
||||
|
||||
// return dev;
|
||||
return DiasMes;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::BusqAntClick(TObject *Sender)
|
||||
{
|
||||
TbCltProv->Filtered = false;
|
||||
|
||||
if ( TbBuscarCltProv -> FindPrior() == true )
|
||||
{
|
||||
TbCltProv -> GotoCurrent(TbBuscarCltProv);
|
||||
BusqSig -> Enabled = true;
|
||||
} else {
|
||||
BusqAnt -> Enabled = false;
|
||||
MessageBox( 0, "Coincidencia no hayada", "<EFBFBD> Buscar Anterior !", MB_OK );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::BusqSigClick(TObject *Sender)
|
||||
{
|
||||
TbCltProv->Filtered = false;
|
||||
|
||||
if ( TbBuscarCltProv -> FindNext() == true )
|
||||
{
|
||||
TbCltProv -> GotoCurrent(TbBuscarCltProv);
|
||||
BusqAnt -> Enabled = true;
|
||||
} else {
|
||||
BusqSig -> Enabled = false;
|
||||
MessageBox( 0, "Coincidencia no hayada", "<EFBFBD> Buscar Anterior !", MB_OK );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::BuscarFichaClick(TObject *Sender)
|
||||
{
|
||||
TDlgBuscProd *DlgBuscProd;
|
||||
|
||||
TbCltProv->Filtered = false;
|
||||
|
||||
DlgBuscProd = new TDlgBuscProd(this);
|
||||
|
||||
DlgBuscProd -> ShowModal();
|
||||
|
||||
if ( DlgBuscProd -> ModalResult == mrOk )
|
||||
{
|
||||
BusqSig -> Enabled = true;
|
||||
BusqAnt -> Enabled = true;
|
||||
TbCltProv -> GotoCurrent(TbBuscarCltProv);
|
||||
}
|
||||
|
||||
delete DlgBuscProd;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbCltProvBeforeDelete(TDataSet *DataSet)
|
||||
{
|
||||
switch( MessageDlg( "Atenci<EFBFBD>n, est<73> apunto de eliminar\na un cliente...\n<EFBFBD>Realmente desea continuar?", mtWarning, TMsgDlgButtons() << mbNo << mbYes, 0 ) )
|
||||
{
|
||||
case mrNo:
|
||||
Abort();
|
||||
break;
|
||||
default:
|
||||
// Borramos todos los registros asociados...
|
||||
if ( TbCltProv -> FieldByName( "CltProv" ) -> AsInteger == 1 )
|
||||
{
|
||||
TbClientes -> GotoCurrent(TbCltProv);
|
||||
while( TbProductos1 -> RecordCount != 0 )
|
||||
TbProductos1 -> Delete();
|
||||
while( TbProductos2 -> RecordCount != 0 )
|
||||
TbProductos2 -> Delete();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TabSheet1Enter(TObject *Sender)
|
||||
{
|
||||
TbClientes -> Refresh();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::BitBtn2Click(TObject *Sender)
|
||||
{
|
||||
TbVehiculos -> Delete();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbVehiculosBeforeDelete(TDataSet *DataSet)
|
||||
{
|
||||
switch( MessageDlg( "Atenci<EFBFBD>n, est<73> apunto de eliminar\nel registro completo para: " + TbVehiculos->FieldByName("MatriculaVehiculo")->AsString + "\n<EFBFBD>Realmente desea continuar?", mtWarning, TMsgDlgButtons() << mbNo << mbYes, 0 ) )
|
||||
{
|
||||
case mrNo:
|
||||
Abort();
|
||||
break;
|
||||
default:
|
||||
// Borramos todos los registros asociados...
|
||||
while( TbRegVehiculos -> RecordCount != 0 )
|
||||
TbRegVehiculos -> Delete();
|
||||
break;
|
||||
};
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::FichadeClientes1Click(TObject *Sender)
|
||||
{
|
||||
TLAgendaCltProv *QRListForm;
|
||||
|
||||
// Creamos una ficha del tipo TProductos
|
||||
// Guardando la referencia en la variable TProductos
|
||||
QRListForm = new TLAgendaCltProv(this);
|
||||
|
||||
// Mostrarla como modal y seg<65>n el valor devuelto
|
||||
//InformeProductosS->ShowModal();
|
||||
QRListForm -> QuickReport -> Print();//Preview();//;//-> Print();
|
||||
|
||||
// Destruimos la ficha
|
||||
delete QRListForm;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::BitBtn3Click(TObject *Sender)
|
||||
{
|
||||
PageControl1 -> ActivePage = TabSheet1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::BitBtn5Click(TObject *Sender)
|
||||
{
|
||||
PageControl1 -> ActivePage = TabSheet2;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::BitBtn6Click(TObject *Sender)
|
||||
{
|
||||
PageControl1 -> ActivePage = TabSheet3;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::BitBtn4Click(TObject *Sender)
|
||||
{
|
||||
PageControl1 -> ActivePage = TabSheet4;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::ListadodePrecios11Click(TObject *Sender)
|
||||
{
|
||||
PageControl1 -> ActivePage = TabSheet1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::ListadodePrecios21Click(TObject *Sender)
|
||||
{
|
||||
PageControl1 -> ActivePage = TabSheet4;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::AgendadeTelfono1Click(TObject *Sender)
|
||||
{
|
||||
PageControl1 -> ActivePage = TabSheet2;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::Controldellamadas1Click(TObject *Sender)
|
||||
{
|
||||
PageControl1 -> ActivePage = TabSheet3;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::Button2Click(TObject *Sender)
|
||||
{
|
||||
TDateTime FechaL, FechaH;
|
||||
|
||||
try {
|
||||
FechaL = DpFechaL2 -> Date;
|
||||
FechaH = DpFechaH2 -> Date;
|
||||
/*
|
||||
FechaL = TDateTime( Edit1 -> Text . ToInt(), 1, 1 );
|
||||
FechaH = TDateTime( Edit2 -> Text . ToInt(), 12, 31 );
|
||||
*/
|
||||
TbProductos2->FilterOptions = TbProductos2->FilterOptions << foCaseInsensitive;
|
||||
TbProductos2->Filter = "([Fecha] >= '" + DateToStr(FechaL) + "') AND [Fecha] <= '" + DateToStr(FechaH) + "'";
|
||||
if ( TbProductos2 -> RecordCount != 0 )
|
||||
TbProductos2->Filtered = true;
|
||||
} catch(...)
|
||||
{
|
||||
// Nothing...
|
||||
MessageBox( 0, "Imposible aplicar filtro en ese rango.", "<EFBFBD> Alerta !", MB_OK );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::Button1Click(TObject *Sender)
|
||||
{
|
||||
TDateTime FechaL, FechaH;
|
||||
|
||||
try {
|
||||
FechaL = DpFechaL1 -> Date;
|
||||
FechaH = DpFechaH1 -> Date;
|
||||
/*
|
||||
FechaL = TDateTime( Edit3 -> Text . ToInt(), 1, 1 );
|
||||
FechaH = TDateTime( Edit4 -> Text . ToInt(), 12, 31 );
|
||||
*/
|
||||
TbProductos1->FilterOptions = TbProductos1->FilterOptions << foCaseInsensitive;
|
||||
TbProductos1->Filter = "([Fecha] >= '" + FechaL + "') AND [Fecha] <= '" + FechaH + "'";
|
||||
if ( TbProductos1 -> RecordCount != 0 )
|
||||
TbProductos1->Filtered = true;
|
||||
} catch(...)
|
||||
{
|
||||
// Nothing...
|
||||
MessageBox( 0, "Imposible aplicar filtro en ese rango.", "<EFBFBD> Alerta !", MB_OK );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::FormShow(TObject *Sender)
|
||||
{
|
||||
unsigned short AActual, M, D;
|
||||
|
||||
DpFechaL1 -> Date = TDateTime::CurrentDate();
|
||||
DpFechaL2 -> Date = TDateTime::CurrentDate();
|
||||
DpFechaH1 -> Date = TDateTime::CurrentDate();
|
||||
DpFechaH2 -> Date = TDateTime::CurrentDate();
|
||||
// TDateTime FActual;
|
||||
|
||||
// FActual = FActual . CurrentDate();
|
||||
// FActual . DecodeDate( &AActual, &M, &D );
|
||||
|
||||
PageControl1 -> ActivePage = TabSheet1;
|
||||
// Edit1 -> Text = AnsiString( AActual );
|
||||
// Edit2 -> Text = AnsiString( AActual );
|
||||
|
||||
PageControl1 -> ActivePage = TabSheet2;
|
||||
PageControl1 -> ActivePage = TabSheet3;
|
||||
PageControl1 -> ActivePage = TabSheet4;
|
||||
// Edit3 -> Text = AnsiString( AActual );
|
||||
// Edit4 -> Text = AnsiString( AActual );
|
||||
|
||||
PageControl1 -> ActivePage = TabSheet2;
|
||||
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::BitBtn1Click(TObject *Sender)
|
||||
{
|
||||
TbVehiculos -> Insert();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbVehiculosNewRecord(TDataSet *DataSet)
|
||||
{
|
||||
// Pedimos el n<> de matricula, el cual no puede ser modificado mas tarde...
|
||||
try {
|
||||
TbVehiculos -> FieldByName( "MatriculaVehiculo" ) -> AsString = InputBox( "Generando nuevo vehiculo", "Introduzca la nueva matricula:", "" );
|
||||
} catch(...) {
|
||||
Abort();
|
||||
}
|
||||
if ( TbVehiculos -> FieldByName( "MatriculaVehiculo" ) -> AsString . IsEmpty() )
|
||||
Abort();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbCltProvNewRecord(TDataSet *DataSet)
|
||||
{
|
||||
/*
|
||||
try {
|
||||
TbCltProv -> FieldByName( "EnlacePrecios" ) -> AsDateTime = TDateTime::CurrentDateTime();
|
||||
} catch(...)
|
||||
{
|
||||
Abort();
|
||||
}
|
||||
*/
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::Button3Click(TObject *Sender)
|
||||
{
|
||||
if ( Edit5 -> Text . IsEmpty() )
|
||||
{
|
||||
TbCltProv->Filtered = false;
|
||||
} else {
|
||||
TbCltProv->FilterOptions = TbCltProv->FilterOptions << foCaseInsensitive;
|
||||
TbCltProv->Filter = "([Empresa] >= '" + Edit5 -> Text + "') AND [Empresa] <= '" + Edit6 -> Text + "'";
|
||||
if ( TbCltProv -> RecordCount != 0 )
|
||||
TbCltProv->Filtered = true;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::MatriculaSeleccionada1Click(TObject *Sender)
|
||||
{
|
||||
TQRListForm1 *QRListForm;
|
||||
|
||||
// Creamos una ficha del tipo TProductos
|
||||
// Guardando la referencia en la variable TProductos
|
||||
QRListForm = new TQRListForm1(this);
|
||||
|
||||
// Mostrarla como modal y seg<65>n el valor devuelto
|
||||
//InformeProductosS->ShowModal();
|
||||
QRListForm -> QuickReport1 -> Print();//Preview();//;//-> Print();
|
||||
|
||||
// Destruimos la ficha
|
||||
delete QRListForm;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::Completo1Click(TObject *Sender)
|
||||
{
|
||||
TQRMDForm *QRListForm;
|
||||
|
||||
// Creamos una ficha del tipo TProductos
|
||||
// Guardando la referencia en la variable TProductos
|
||||
QRListForm = new TQRMDForm(this);
|
||||
|
||||
// Mostrarla como modal y seg<65>n el valor devuelto
|
||||
//InformeProductosS->ShowModal();
|
||||
QRListForm -> QuickRep1 -> Print();//Preview();//;//-> Print();
|
||||
|
||||
// Destruimos la ficha
|
||||
delete QRListForm;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::ListadoCompleto1Click(TObject *Sender)
|
||||
{
|
||||
TQRMDForm2 *QRListForm;
|
||||
|
||||
// Creamos una ficha del tipo TProductos
|
||||
// Guardando la referencia en la variable TProductos
|
||||
QRListForm = new TQRMDForm2(this);
|
||||
|
||||
// Mostrarla como modal y seg<65>n el valor devuelto
|
||||
//InformeProductosS->ShowModal();
|
||||
QRListForm -> QuickRep1 -> Print();//Preview();//;//-> Print();
|
||||
|
||||
// Destruimos la ficha
|
||||
delete QRListForm;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TODASlasllamadas1Click(TObject *Sender)
|
||||
{
|
||||
TQRMDForm1 *QRListForm;
|
||||
|
||||
// Creamos una ficha del tipo TProductos
|
||||
// Guardando la referencia en la variable TProductos
|
||||
QRListForm = new TQRMDForm1(this);
|
||||
|
||||
// Mostrarla como modal y seg<65>n el valor devuelto
|
||||
//InformeProductosS->ShowModal();
|
||||
QRListForm -> QuickReport -> Print();//Preview();//;//-> Print();
|
||||
|
||||
// Destruimos la ficha
|
||||
delete QRListForm;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::FichaActual1Click(TObject *Sender)
|
||||
{
|
||||
TQRListForm2 *QRListForm;
|
||||
|
||||
// Creamos una ficha del tipo TProductos
|
||||
// Guardando la referencia en la variable TProductos
|
||||
QRListForm = new TQRListForm2(this);
|
||||
|
||||
// Mostrarla como modal y seg<65>n el valor devuelto
|
||||
//InformeProductosS->ShowModal();
|
||||
QRListForm -> QuickReport -> Print();//Preview();//;//-> Print();
|
||||
|
||||
// Destruimos la ficha
|
||||
delete QRListForm;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::ClienteSeleccionado1Click(TObject *Sender)
|
||||
{
|
||||
TQRListForm3 *QRListForm;
|
||||
|
||||
// Creamos una ficha del tipo TProductos
|
||||
// Guardando la referencia en la variable TProductos
|
||||
QRListForm = new TQRListForm3(this);
|
||||
|
||||
// Mostrarla como modal y seg<65>n el valor devuelto
|
||||
//InformeProductosS->ShowModal();
|
||||
QRListForm -> QuickReport -> Print();//Preview();//;//-> Print();
|
||||
|
||||
// Destruimos la ficha
|
||||
delete QRListForm;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbProductos1BeforeInsert(TDataSet *DataSet)
|
||||
{
|
||||
if ( !( TbClientes -> RecNo > 0 && TbClientes -> RecordCount > 0 ) )
|
||||
{
|
||||
MessageBox( 0, "<EFBFBD> No cree que deber<65>a crear,\no seleccionar un cliente,\nantes de agregar datos a NADIE?.", "<EFBFBD> Atenci<63>n !", MB_OK );
|
||||
Abort();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAplicacion::TbProductos2BeforeInsert(TDataSet *DataSet)
|
||||
{
|
||||
if ( !( TbClientes -> RecNo > 0 && TbClientes -> RecordCount > 0 ) )
|
||||
{
|
||||
MessageBox( 0, "<EFBFBD> No cree que deber<65>a crear,\no seleccionar un cliente,\nantes de agregar datos a NADIE?.", "<EFBFBD> Atenci<63>n !", MB_OK );
|
||||
Abort();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TAplicacion::TbVehiculosBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
if ( access(TbVehiculos->TableName.c_str(),0) != 0 )
|
||||
TbVehiculos -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::TbRegVehiculosBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
if ( access(TbRegVehiculos->TableName.c_str(),0) != 0 )
|
||||
TbRegVehiculos -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::TbBuscarCltProvBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
if ( access(TbCltProv->TableName.c_str(),0) != 0 )
|
||||
{
|
||||
TbCltProv -> Active = false;
|
||||
TbCltProv -> CreateTable();
|
||||
TbCltProv -> Active = true;
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::TbClientesBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
if ( access(TbClientes->TableName.c_str(),0) != 0 )
|
||||
{
|
||||
TbCltProv -> Active = false;
|
||||
TbCltProv -> CreateTable();
|
||||
TbCltProv -> Active = true;
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::TbCltProvBeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
if ( access(TbCltProv->TableName.c_str(),0) != 0 )
|
||||
TbCltProv -> CreateTable();
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::TbProductos1BeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
if ( access(TbProductos1->TableName.c_str(),0) != 0 )
|
||||
TbProductos1 -> CreateTable();
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::TbProductos2BeforeOpen(TDataSet *DataSet)
|
||||
{
|
||||
if ( access(TbProductos2->TableName.c_str(),0) != 0 )
|
||||
TbProductos2 -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TAplicacion::DBGrid3TitleClick(TColumn *Column)
|
||||
{
|
||||
switch( Column->ID )
|
||||
{
|
||||
case 1:
|
||||
TbCltProv -> IndexFieldNames = "CodCliente";
|
||||
break;
|
||||
case 3:
|
||||
TbCltProv -> IndexFieldNames = "Localidad;Empresa;PersonaContacto";
|
||||
break;
|
||||
case 4:
|
||||
TbCltProv -> IndexFieldNames = "PersonaContacto;Localidad;Empresa";
|
||||
break;
|
||||
default:
|
||||
TbCltProv -> IndexFieldNames = "Empresa;PersonaContacto";
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::DBGrid6TitleClick(TColumn *Column)
|
||||
{
|
||||
switch( Column->ID )
|
||||
{
|
||||
case 0:
|
||||
TbClientes -> IndexFieldNames = "CodCliente";
|
||||
break;
|
||||
/*
|
||||
case 2:
|
||||
TbClientes -> IndexFieldNames = "Localidad;Empresa;PersonaContacto";
|
||||
break;
|
||||
*/
|
||||
case 2:
|
||||
TbClientes -> IndexFieldNames = "PersonaContacto;Localidad;Empresa";
|
||||
break;
|
||||
default:
|
||||
TbClientes -> IndexFieldNames = "Empresa;PersonaContacto";
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::DBGrid5TitleClick(TColumn *Column)
|
||||
{
|
||||
switch( Column->ID )
|
||||
{
|
||||
case 0:
|
||||
TbClientes -> IndexFieldNames = "CodCliente";
|
||||
break;
|
||||
/*
|
||||
case 1:
|
||||
TbClientes -> IndexFieldNames = "Localidad;Empresa;PersonaContacto";
|
||||
break;
|
||||
*/
|
||||
case 2:
|
||||
TbClientes -> IndexFieldNames = "PersonaContacto;Localidad;Empresa";
|
||||
break;
|
||||
default:
|
||||
TbClientes -> IndexFieldNames = "Empresa;PersonaContacto";
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAplicacion::FormClose(TObject *Sender,
|
||||
TCloseAction &Action)
|
||||
{
|
||||
if ( TbVehiculos -> State == dsEdit ||
|
||||
TbVehiculos -> State == dsInsert )
|
||||
TbVehiculos -> Post();
|
||||
if ( TbRegVehiculos -> State == dsEdit ||
|
||||
TbRegVehiculos -> State == dsInsert )
|
||||
TbRegVehiculos -> Post();
|
||||
if ( TbClientes -> State == dsEdit ||
|
||||
TbClientes -> State == dsInsert )
|
||||
TbClientes -> Post();
|
||||
if ( TbCltProv -> State == dsEdit ||
|
||||
TbCltProv -> State == dsInsert )
|
||||
TbCltProv -> Post();
|
||||
if ( TbProductos1 -> State == dsEdit ||
|
||||
TbProductos1 -> State == dsInsert )
|
||||
TbProductos1 -> Post();
|
||||
if ( TbProductos2 -> State == dsEdit ||
|
||||
TbProductos2 -> State == dsInsert )
|
||||
TbProductos2 -> Post();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user