96f2023312
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@21556 c028cbd2-c16b-5b4b-a496-9718f37d4682
173 lines
4.0 KiB
C++
Executable File
173 lines
4.0 KiB
C++
Executable File
#include "halib.h"
|
|
#include "hacnvlib.h"
|
|
#include "hacnv300a.h"
|
|
|
|
#include <applicat.h>
|
|
#include <automask.h>
|
|
#include <defmask.h>
|
|
#include <progind.h>
|
|
#include <reprint.h>
|
|
#include <reputils.h>
|
|
#include <tabutil.h>
|
|
|
|
|
|
const char* const APPNAME = TR("Importazione scadenze");
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Trasferimenti veri e propri
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class THardy_scadenze : public THardy_transfer
|
|
{
|
|
public:
|
|
virtual bool trasferisci();
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// THardy_scadenze
|
|
///////////////////////////////////////////////////////////
|
|
|
|
bool THardy_scadenze::trasferisci()
|
|
{
|
|
/*
|
|
TString query =
|
|
"SELECT * "
|
|
"FROM dbo.Scadenze"
|
|
"ORDER BY dbo.Scadenze.Esercizio, dbo.Scadenze.Protocollo ";
|
|
|
|
TRecordset& recset = create_recordset(query);
|
|
THardy_iterator hi(this);
|
|
|
|
TPartita* game = NULL;
|
|
int curr_ese = 0;
|
|
int curr_pro = 0;
|
|
real importo = ZERO;
|
|
|
|
while (++hi)
|
|
{
|
|
const int esercizio = get("Esercizio").as_int();
|
|
const int protocollo = get("Protocollo").as_int();
|
|
if ((esercizio != curr_ese) || (protocollo != curr_pro))
|
|
{
|
|
// se la partita non è a zero, scrivo una scadenza
|
|
if (importo != ZERO)
|
|
//write_scadenza();
|
|
importo = ZERO;
|
|
curr_ese = esercizio;
|
|
curr_pro = protocollo;
|
|
}
|
|
real importo_dare = get_real("Dare");
|
|
real importo_avere = get_real("Avere");
|
|
importo+=(importo_dare-importo_avere);
|
|
}
|
|
*/
|
|
return write_enabled();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TImpScadHardy_mask
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TImpScadHardy_mask : public TAutomask
|
|
{
|
|
protected:
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
void serialize(bool bSave);
|
|
|
|
public:
|
|
void trasferisci();
|
|
|
|
TImpScadHardy_mask();
|
|
virtual ~TImpScadHardy_mask();
|
|
};
|
|
|
|
// Funzione di trasferimento dati da/verso file .ini con lo stesso nome della maschera
|
|
// Andrebbe messo in libreria
|
|
void TImpScadHardy_mask::serialize(bool bSave)
|
|
{
|
|
TFilename n = source_file(); n.ext("ini"); // Construisce il nome del .ini in base al .msk
|
|
TConfig cfg(n, "Main"); // Crea il file di configurazione
|
|
TString4 id;
|
|
for (int i = fields()-1; i >= 0; i--) // Scandisce tutti i campi della maschera ...
|
|
{
|
|
TMask_field& f = fld(i);
|
|
if (f.active() && f.is_loadable()) // ... selezionando solo quelli editabili
|
|
{
|
|
id.format("%d", f.dlg());
|
|
if (bSave) // A seconda del flag di scrittura ...
|
|
cfg.set(id, f.get()); // ... o scrive sul .ini
|
|
else
|
|
f.set(cfg.get(id)); // ... o legge dal .ini
|
|
}
|
|
}
|
|
}
|
|
|
|
void TImpScadHardy_mask::trasferisci()
|
|
{
|
|
TString query_header;
|
|
query_header << "ODBC(" << get(F_DSN) << ',' << get(F_USR) << ',' << get(F_PWD) << ")\n";
|
|
|
|
TReport_book book;
|
|
THardy_log log;
|
|
|
|
bool rep_to_print = false;
|
|
bool go_on = true;
|
|
|
|
if (go_on && get_bool(F_SCAD))
|
|
{
|
|
THardy_scadenze pc;
|
|
pc.init(TR("Scadenze aperte"), query_header, log);
|
|
go_on = pc.trasferisci();
|
|
book.add(log);
|
|
rep_to_print = true;
|
|
}
|
|
if (rep_to_print && book.pages() > 0)
|
|
book.preview();
|
|
}
|
|
|
|
bool TImpScadHardy_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
{
|
|
switch (o.dlg())
|
|
{
|
|
case DLG_OK:
|
|
if (e == fe_button)
|
|
serialize(true);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
TImpScadHardy_mask::TImpScadHardy_mask() : TAutomask("hacnv300a")
|
|
{
|
|
serialize(false);
|
|
}
|
|
|
|
TImpScadHardy_mask::~TImpScadHardy_mask()
|
|
{ }
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TImpScadHardy
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TImpScadHardy : public TSkeleton_application
|
|
{
|
|
protected:
|
|
virtual void main_loop();
|
|
};
|
|
|
|
void TImpScadHardy::main_loop()
|
|
{
|
|
TImpScadHardy_mask mask;
|
|
while (mask.run() == K_ENTER)
|
|
mask.trasferisci();
|
|
}
|
|
|
|
int hacnv300(int argc, char* argv[])
|
|
{
|
|
TImpScadHardy ih;
|
|
ih.run(argc, argv, APPNAME);
|
|
return 0;
|
|
}
|