1995-12-04 17:41:06 +00:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
|
|
|
|
|
|
"Compilatore di profili" per la gestione vendite.
|
|
|
|
|
Considerando:
|
|
|
|
|
- Profilo documento
|
|
|
|
|
- Configurazione vendite per la ditta
|
|
|
|
|
- Condizioni atmosferiche
|
|
|
|
|
genera le maschere appropriate.
|
1996-06-18 15:55:39 +00:00
|
|
|
|
Accetta sulla riga di comando il nome del profilo documento per cui deve generare
|
1995-12-04 17:41:06 +00:00
|
|
|
|
la maschera. Il nome del file .MSK viene dedotto dal profilo documento stesso.
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
#include <applicat.h>
|
|
|
|
|
#include <progind.h>
|
1999-04-26 15:58:05 +00:00
|
|
|
|
#include <urldefid.h>
|
|
|
|
|
#include <utility.h>
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
#include "veuml.h"
|
|
|
|
|
#include "veuml1.h"
|
|
|
|
|
|
|
|
|
|
#include "veini.h"
|
|
|
|
|
#include "ve0100.h"
|
|
|
|
|
|
|
|
|
|
// Significato delle colonne nella tabella _tab0300b
|
|
|
|
|
#define B_NOME 0
|
|
|
|
|
#define B_MSKTYPE 1
|
|
|
|
|
#define B_MSKSIZE 2
|
|
|
|
|
#define B_DESCR 3
|
|
|
|
|
#define B_WIDTH 4
|
|
|
|
|
|
|
|
|
|
// Significato dei campi nel profilo del documento
|
|
|
|
|
#define P_STATO 0
|
|
|
|
|
#define P_PROMPT 1
|
|
|
|
|
#define P_HELP 2
|
|
|
|
|
#define P_WARNING 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Numero massimo di linee per pagina
|
1999-04-06 15:34:39 +00:00
|
|
|
|
#define MAX_LINES_PER_PAGE 18
|
1996-06-18 15:55:39 +00:00
|
|
|
|
#define MASK_FIRST_LINE 6
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
#define GROUPKEY(x) format( "%5d", x )
|
|
|
|
|
|
1998-01-20 15:45:20 +00:00
|
|
|
|
#define Usage "Sintassi: VE0 -3 <Nome file di profilo> [-f<stdfile>]"
|
|
|
|
|
|
|
|
|
|
#define B0_POSITION 47
|
2000-05-05 15:25:49 +00:00
|
|
|
|
#define B1_POSITION 48
|
1998-01-20 15:45:20 +00:00
|
|
|
|
#define S0_POSITION 2
|
2000-05-05 15:25:49 +00:00
|
|
|
|
#define I0_POSITION 14
|
1998-01-20 15:45:20 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
class TMaschera : public TObject
|
|
|
|
|
{
|
|
|
|
|
private:
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Linea corrente
|
|
|
|
|
int _curline;
|
|
|
|
|
|
|
|
|
|
// Pagina corrente
|
|
|
|
|
int _curpage;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
void advance_line( ){ _curline ++; };
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Genera una serie di righe uguali per funzione ( DISPLAY, ecc. )
|
|
|
|
|
void outline( const TString& s = "", const TString& prefix = "", const char sep = '~' );
|
|
|
|
|
|
|
|
|
|
// Crea un controllo del tipo specificato
|
|
|
|
|
void control( const int type, const int id = DLG_NULL, const int size = -1 );
|
|
|
|
|
|
|
|
|
|
// CHECKTYPE
|
|
|
|
|
void check( const int i );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// PAGE
|
2008-12-12 12:08:21 +00:00
|
|
|
|
void pagina( const int page, const TString& title = EMPTY_STRING );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// PROMPT
|
|
|
|
|
void prompt( const int x, const int y, const TString& s = "" ){ _out << "PR " << x << " " << y << " \"" << s << "\"\n"; };
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// BEGIN
|
|
|
|
|
void begin( void ) { outline ( "BE" ); };
|
|
|
|
|
|
|
|
|
|
// END
|
|
|
|
|
void end( void ) { outline ( "EN" ); };
|
|
|
|
|
|
|
|
|
|
// ENDMASK
|
|
|
|
|
void endmask( void ) { outline ( "ENDMASK" ); };
|
|
|
|
|
|
2003-11-10 15:18:25 +00:00
|
|
|
|
// FLAGS
|
|
|
|
|
void flag( const char* s ) { _out << "FL \"" << s << "\"\n"; };
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
// HELP
|
|
|
|
|
void help( const TString& s ) { _out << "HE \"" << s << "\"\n"; };
|
|
|
|
|
|
|
|
|
|
// WARNING
|
|
|
|
|
void warning( const TString& s ) { _out << "WA \"" << s << "\"\n"; };
|
|
|
|
|
|
|
|
|
|
// GROUP
|
|
|
|
|
void group( const int g ) { _out << "GR " << g << "\n"; };
|
|
|
|
|
|
1996-07-29 16:55:30 +00:00
|
|
|
|
// PICTURE
|
1996-08-14 16:51:18 +00:00
|
|
|
|
void picture( const int p) { _out << "PI " << p << "\n"; };
|
1999-04-26 15:58:05 +00:00
|
|
|
|
// void picture( const TString & s) { _out << "PI " << '\"' << s << "\"\n"; };
|
|
|
|
|
void picture( const char* s) { _out << "PI " << '\"' << s << "\"\n"; }
|
1996-07-29 16:55:30 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// FIELD
|
|
|
|
|
void field( const TString& s ) { outline( s, "FI "); };
|
|
|
|
|
|
|
|
|
|
// ITEM
|
|
|
|
|
void item( const TString& s );
|
|
|
|
|
|
|
|
|
|
// MESSAGE
|
|
|
|
|
void message( const TString& s ) { outline( s, "ME "); };
|
|
|
|
|
|
|
|
|
|
// USE
|
1997-12-05 11:56:14 +00:00
|
|
|
|
// void use( const TString& s ){ outline( s, "US " ); };
|
|
|
|
|
void use( const TString& s );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
void use( const int file, const int key ){ _out << "US " << file << " KEY " << key << "\n"; };
|
1996-06-18 15:55:39 +00:00
|
|
|
|
void use( const TString& tab, const int key ){ _out << "US " << tab << " KEY " << key << "\n"; };
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
// DISPLAY
|
|
|
|
|
void display( const TString& s ){ outline( s, "DI " ); };
|
|
|
|
|
|
|
|
|
|
// INPUT
|
|
|
|
|
void input( const TString& s ){ outline( s, "IN " ); };
|
|
|
|
|
|
|
|
|
|
// OUTPUT
|
|
|
|
|
void output( const TString& s ){ outline( s, "OU " ); };
|
|
|
|
|
|
1997-06-27 09:21:13 +00:00
|
|
|
|
// copy
|
|
|
|
|
void copy( const TString& s ){ outline( s, "CO " ); };
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Funzioni per la lettura/scrittura di CURPAGE
|
|
|
|
|
int page( ) { return _curpage; };
|
|
|
|
|
void page( const int i ){ _curpage = i; };
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void output_row( const TString& row){ _out << row << "\n"; };
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Funzioni per la lettura/scrittura di CURLINE
|
|
|
|
|
int line( ) { return _curline; };
|
|
|
|
|
void line( const int i ){ _curline = i; };
|
|
|
|
|
|
|
|
|
|
// Costruttore, vuole il nome del file .INI
|
|
|
|
|
TMaschera( const TFilename outfile );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
2008-12-12 12:08:21 +00:00
|
|
|
|
// Vero se ho gia' generato lo sheet
|
|
|
|
|
bool _sheet_generated;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// File .MSK di output
|
|
|
|
|
ofstream _out;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-12-12 12:08:21 +00:00
|
|
|
|
void TMaschera::pagina(const int page, const TString& title)
|
|
|
|
|
{
|
|
|
|
|
_out << "PA \"" << (title.blank() ? TString("Pag.") << " " << page : title) << "\" 11 60 14\n";
|
|
|
|
|
}
|
|
|
|
|
|
1998-01-20 15:45:20 +00:00
|
|
|
|
// Classe per memorizzare gli elementi di FRD
|
|
|
|
|
class _TableItem : public TObject
|
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
bool _b0, _b1;
|
|
|
|
|
TString _s0;
|
|
|
|
|
int _i0;
|
2008-06-13 08:45:21 +00:00
|
|
|
|
|
1998-01-20 15:45:20 +00:00
|
|
|
|
public:
|
|
|
|
|
virtual TObject* dup() const { return new _TableItem(*this); }
|
|
|
|
|
const bool b0() { return _b0;}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
const bool b1() { return _b1;}
|
1998-01-20 15:45:20 +00:00
|
|
|
|
const TString& s0() { return _s0;}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
int i0() { return _i0;}
|
1998-01-20 15:45:20 +00:00
|
|
|
|
void set_b0(const bool b) { _b0 = b;}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
void set_b1(const bool b) { _b1 = b;}
|
1998-01-20 15:45:20 +00:00
|
|
|
|
void set_s0(const TString& s) { _s0 = s;}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
void set_i0(int i) { _i0 = i;}
|
1998-01-20 15:45:20 +00:00
|
|
|
|
_TableItem() {_b0 = FALSE;}
|
|
|
|
|
virtual ~_TableItem() {}
|
|
|
|
|
};
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
class TMask_generator
|
|
|
|
|
{
|
|
|
|
|
// Identificatore corrente per lo sheet
|
|
|
|
|
int _curid;
|
|
|
|
|
|
1996-06-18 15:55:39 +00:00
|
|
|
|
// vero se il gruppo h aperto
|
1995-12-04 17:41:06 +00:00
|
|
|
|
bool _groupopen;
|
|
|
|
|
|
|
|
|
|
// nome del file di .INI di input
|
|
|
|
|
TFilename _proname;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// File .INI di riferimento per i campi
|
1996-06-18 15:55:39 +00:00
|
|
|
|
TConfig _fieldsini;
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// File .INI di riferimento per i gruppi
|
1996-06-18 15:55:39 +00:00
|
|
|
|
TConfig _groupsini;
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// File .INI di input
|
|
|
|
|
TConfig* _pro;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1998-01-20 15:45:20 +00:00
|
|
|
|
//TConfig _ditta;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
// Tabelle per la generazione
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Campi dei documenti
|
|
|
|
|
TString_array _fields;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Campi dello sheet
|
|
|
|
|
TString_array _tab0300b;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TAssoc_array _gruppi;
|
1998-01-20 15:45:20 +00:00
|
|
|
|
|
|
|
|
|
// Tabella caricata dal file testo
|
|
|
|
|
TAssoc_array _frdtable;
|
|
|
|
|
TString _tablefile;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TMaschera *_m;
|
|
|
|
|
|
|
|
|
|
protected:
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Carica un file di tabella in un TString array
|
|
|
|
|
void carica_tabella( const TFilename& fn, TString_array& tabella );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Scrive sul file di output una serie di righe uguali per funzione ( DISPLAY, ecc. )
|
|
|
|
|
void outline( const TString& s = "", const TString& prefix = "", const char sep = '~' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Crea un controllo del tipo specificato
|
|
|
|
|
void control( const int type, const int id = DLG_NULL, const int size = -1 );
|
|
|
|
|
|
1996-06-18 15:55:39 +00:00
|
|
|
|
// Ritorna vero se una componente della maschera h presente
|
1995-12-04 17:41:06 +00:00
|
|
|
|
int present( const int i, TToken_string line ){ const TString s = line.get( i ); return !(s.blank( )); };
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Carica dati dei campi
|
|
|
|
|
void carica_dati_campi( const TFilename& fn, TAssoc_array& a );
|
|
|
|
|
|
|
|
|
|
// Funzioni di accesso alle variabili private
|
|
|
|
|
// ------------------------------------------
|
|
|
|
|
|
|
|
|
|
// Funzioni per la lettura/scrittura di ID. Si incrementa da solo.
|
|
|
|
|
int id ( ) { return( _curid++ ); };
|
|
|
|
|
void id( const int i ){ _curid = i; };
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Funzioni di generazione ad alto livello
|
|
|
|
|
// ---------------------------------------
|
|
|
|
|
|
|
|
|
|
// Genera un campo a partire da una linea del file VE0300A.DAT
|
|
|
|
|
void genera_campo( TToken_string _line );
|
|
|
|
|
|
|
|
|
|
// Genera la colonna dello sheet a partire da una linea del file VE0300B.DAT
|
|
|
|
|
void genera_item_sheet( TToken_string _line );
|
|
|
|
|
|
|
|
|
|
public:
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TMaschera& maschera( ){ return *_m; }
|
|
|
|
|
|
2008-12-12 12:08:21 +00:00
|
|
|
|
void genera_sheet(int line = 5, bool show_list = true, bool genera_disp = true);
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Attiva la generazione della maschera
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void genera( const TString& profilo);
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Genera l'intestazione di una pagina ( non la prima )
|
|
|
|
|
void intestazione_pagina( );
|
1998-01-20 15:45:20 +00:00
|
|
|
|
|
|
|
|
|
// Carica la tabella FRD da file testo
|
|
|
|
|
void load_table();
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TConfig& profilo( ){ return *_pro; }
|
|
|
|
|
TConfig& groupsini( ){ return _groupsini; }
|
|
|
|
|
TConfig& fieldsini( ){ return _fieldsini; }
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// Costruttore, vuole il nome del file .INI
|
|
|
|
|
TMask_generator(const TString& tablefile);
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Distruttore
|
1999-04-06 15:34:39 +00:00
|
|
|
|
virtual ~TMask_generator( ) {}
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TMaschera::TMaschera( const TFilename outfile ) : _out( outfile )
|
|
|
|
|
{
|
|
|
|
|
_curline = 1;
|
|
|
|
|
_curpage = 1;
|
2008-12-12 12:08:21 +00:00
|
|
|
|
_sheet_generated = false;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
}
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
void TMaschera::outline( const TString& s, const TString& prefix, const char sep )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
if ( s.left( 1 ) == "@" )
|
|
|
|
|
_out << "CO " << prefix << s.mid( 1 ) << "\n";
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TToken_string u( s, sep );
|
|
|
|
|
for ( int i = 0; i < u.items( ); i ++ )
|
|
|
|
|
_out << prefix << u.get( i ) << "\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TMaschera::check( const int i )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
|
|
|
|
switch( i )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
{
|
|
|
|
|
case S_OBBLIGATORIO:
|
|
|
|
|
outline ( "CH REQUIRED" );
|
|
|
|
|
break;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case S_NORMALE:
|
1995-12-04 17:41:06 +00:00
|
|
|
|
outline ( "CH NORMAL" );
|
|
|
|
|
break;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TMaschera::control( const int type, const int id, const int size )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
switch ( type )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
|
|
|
|
case T_DATA:
|
|
|
|
|
_out << "DA";
|
1995-12-04 17:41:06 +00:00
|
|
|
|
break;
|
|
|
|
|
case T_STRINGA:
|
|
|
|
|
_out << "ST";
|
|
|
|
|
break;
|
|
|
|
|
case T_CHECKBOX:
|
|
|
|
|
_out << "BO";
|
1996-06-18 15:55:39 +00:00
|
|
|
|
break;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
case T_NUMERO:
|
|
|
|
|
_out << "NU";
|
|
|
|
|
break;
|
|
|
|
|
case T_LISTA:
|
|
|
|
|
_out << "LI";
|
|
|
|
|
break;
|
|
|
|
|
case T_MEMO:
|
|
|
|
|
_out << "ME";
|
|
|
|
|
break;
|
1997-07-28 14:16:44 +00:00
|
|
|
|
case T_ZOOM:
|
|
|
|
|
_out << "ZO";
|
|
|
|
|
break;
|
1997-10-24 10:47:19 +00:00
|
|
|
|
case T_GOLEM:
|
|
|
|
|
_out << "GO";
|
|
|
|
|
break;
|
2000-05-05 15:25:49 +00:00
|
|
|
|
case T_CURRENCY:
|
|
|
|
|
_out << "CU";
|
|
|
|
|
break;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
case T_CORNICE:
|
|
|
|
|
_out << "GR";
|
|
|
|
|
break;
|
|
|
|
|
case T_BOTTONE:
|
|
|
|
|
_out << "BU";
|
1996-06-18 15:55:39 +00:00
|
|
|
|
break;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
_out << " " << id;
|
|
|
|
|
if ( size > 0 )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
if ( size > 100 )
|
|
|
|
|
_out << " " << ( int )( size / 100 ) << " " << ( size % 100 );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_out << " " << size;
|
|
|
|
|
}
|
|
|
|
|
_out << "\n";
|
|
|
|
|
}
|
|
|
|
|
|
1996-06-18 15:55:39 +00:00
|
|
|
|
void TMaschera::item( const TString& str )
|
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
int i, j;
|
|
|
|
|
TToken_string u( str, '@' );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
TToken_string s("", '~');
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
for( i = 0; i < u.items( ); i ++ )
|
1997-05-27 16:56:21 +00:00
|
|
|
|
{
|
1996-06-18 15:55:39 +00:00
|
|
|
|
s = u.get();
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_out << "IT \"" << s.get(0) << "\"\n";
|
1995-12-04 17:41:06 +00:00
|
|
|
|
for( j = 1; j < s.items( ); j ++ )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_out << "ME " << s.get() << "\n";
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-05 11:56:14 +00:00
|
|
|
|
void TMaschera::use(const TString& s)
|
|
|
|
|
{
|
|
|
|
|
if ( s.left( 1 ) == "@" )
|
|
|
|
|
_out << "CO US " << s.mid( 1 ) << "\n";
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TToken_string u( s, '~');
|
|
|
|
|
_out << "US " << u.get(0) << "\n";
|
|
|
|
|
for ( int i = 1; i < u.items( ); i ++ )
|
|
|
|
|
_out << u.get( i ) << "\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
class TField;
|
|
|
|
|
|
|
|
|
|
class TGruppo : public TObject
|
|
|
|
|
{
|
|
|
|
|
protected:
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
int _id;
|
|
|
|
|
int _height;
|
|
|
|
|
bool _present;
|
|
|
|
|
TArray _fields;
|
|
|
|
|
TMask_generator * _mg;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
TMaschera& maschera( ){ return generatore( ).maschera( ); }
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TMask_generator& generatore( ) const { CHECK( _mg, "Generatore nullo!" ); return *_mg; }
|
|
|
|
|
void generatore( TMask_generator& mg ) { _mg = &mg; }
|
|
|
|
|
void id( int id ) { _id = id; }
|
|
|
|
|
int id( ) const { return _id; }
|
|
|
|
|
void height( int h ) { _height = h; }
|
|
|
|
|
int height( ) const { return _height; }
|
|
|
|
|
void present( bool p ) { _present = p; }
|
|
|
|
|
bool present( ) const { return _present; }
|
|
|
|
|
TArray& campi( ) { return _fields; }
|
|
|
|
|
virtual TObject* dup() const;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TGruppo ( int i );
|
|
|
|
|
TGruppo ( int i, int height );
|
|
|
|
|
void genera( );
|
|
|
|
|
void add( TField * field );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TField : public TObject
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TString _nome;
|
|
|
|
|
// Gruppo di appartenenza
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TGruppo * _grp;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
|
|
|
|
int _gruppo;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
int _id;
|
|
|
|
|
int _type;
|
|
|
|
|
int _size;
|
|
|
|
|
int _stato;
|
|
|
|
|
int _x, _y;
|
|
|
|
|
TString _prompt, _flag, _help, _warning, _fieldname;
|
|
|
|
|
TToken_string _use, _input, _display, _output, _special, _items, _configs;
|
1997-06-27 09:21:13 +00:00
|
|
|
|
TToken_string _copy;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
public:
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TField( TString& campo, TConfig& pro );
|
|
|
|
|
TField( );
|
1996-07-25 13:05:29 +00:00
|
|
|
|
virtual TObject* dup() const;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
void genera( );
|
|
|
|
|
void configura( TConfig& pro );
|
|
|
|
|
|
|
|
|
|
void x( int x ){ _x = x; }
|
|
|
|
|
void y( int y ){ _y = y; }
|
1996-07-25 13:05:29 +00:00
|
|
|
|
void gruppo(int gruppo) { _gruppo = gruppo; }
|
|
|
|
|
void grp(TGruppo * grp) { _grp = grp; }
|
1995-12-04 17:41:06 +00:00
|
|
|
|
void id( int id ){ _id = id; }
|
1996-07-25 13:05:29 +00:00
|
|
|
|
void type( int type ) { _type = type; }
|
|
|
|
|
void size( int size ) { _size = size; }
|
|
|
|
|
void stato( int stato ) { _stato = stato; }
|
|
|
|
|
int x( ) const { return _x; }
|
|
|
|
|
int y( ) const { return _y; }
|
|
|
|
|
int gruppo( ) const{ return _gruppo; }
|
|
|
|
|
TGruppo& grp( ) const { CHECK(_grp, "NULL group in field"); return *_grp; }
|
|
|
|
|
int id( ) const { return _id; }
|
1995-12-04 17:41:06 +00:00
|
|
|
|
int type( ){ return _type; }
|
|
|
|
|
int size( ){ return _size; }
|
|
|
|
|
int stato( ){ return _stato; }
|
|
|
|
|
int stato_reale( );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
void nome( const TString& nome ){ _nome = nome; }
|
|
|
|
|
void prompt( const TString& prompt ){ _prompt = prompt; }
|
|
|
|
|
void flag( const TString& flag ){ _flag = flag; }
|
|
|
|
|
void help( const TString& help ){ _help = help; }
|
|
|
|
|
void warning( const TString& warning ){ _warning = warning; }
|
|
|
|
|
void fieldname( const TString& fieldname ){ _fieldname = fieldname; }
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TString& nome( ){ return _nome; }
|
|
|
|
|
TString& prompt( ){ return _prompt; }
|
|
|
|
|
TString& flag( ){ return _flag; }
|
|
|
|
|
TString& help( ){ return _help; }
|
|
|
|
|
TString& warning( ){ return _warning; }
|
|
|
|
|
TString& fieldname( ){ return _fieldname; }
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
void use( TToken_string& use ){ _use = use; }
|
|
|
|
|
void input( TToken_string& input ){ _input = input; }
|
|
|
|
|
void display( TToken_string& display ){ _display = display; }
|
|
|
|
|
void output( TToken_string& output ){ _output = output; }
|
1997-06-27 09:21:13 +00:00
|
|
|
|
void copy( TToken_string& copy ){ _copy = copy; }
|
1995-12-04 17:41:06 +00:00
|
|
|
|
void special( TToken_string& special ){ _special = special; }
|
|
|
|
|
void items( TToken_string& items ){ _items = items; }
|
|
|
|
|
void configs( TToken_string& configs ){ _configs = configs; }
|
|
|
|
|
TToken_string& use( ){ return _use; }
|
|
|
|
|
TToken_string& input( ){ return _input; }
|
|
|
|
|
TToken_string& display( ){ return _display; }
|
|
|
|
|
TToken_string& output( ){ return _output; }
|
1997-06-27 09:21:13 +00:00
|
|
|
|
TToken_string& copy( ){ return _copy; }
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TToken_string& special( ){ return _special; }
|
|
|
|
|
TToken_string& items( ){ return _items; }
|
1996-06-18 15:55:39 +00:00
|
|
|
|
TToken_string& configs( ){ return _configs; }
|
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TConfig& profilo( ) { CHECK(_grp, "NULL group in field"); return grp().generatore().profilo(); }
|
1998-01-20 15:45:20 +00:00
|
|
|
|
//TConfig& ditta( ) { CHECK(_grp, "NULL group in field"); return grp().generatore().ditta(); }
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TConfig& groupsini( ) { CHECK(_grp, "NULL group in field"); return grp().generatore().groupsini(); }
|
|
|
|
|
TConfig& fieldsini( ) { CHECK(_grp, "NULL group in field"); return grp().generatore().fieldsini(); }
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void TGruppo::add( TField * field )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1996-07-25 13:05:29 +00:00
|
|
|
|
_fields.add(field);
|
|
|
|
|
field->grp(this);
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TGruppo::TGruppo( int i )
|
|
|
|
|
{
|
|
|
|
|
_id = i;
|
1996-09-26 15:37:19 +00:00
|
|
|
|
_height = 0;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TGruppo::TGruppo( int i, int height )
|
|
|
|
|
{
|
|
|
|
|
_id = i;
|
|
|
|
|
_height = height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void genera_campo( const TObject& campo )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Per evitare 3000 casts ...
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TField& cmp = (TField&) campo;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
cmp.configura(cmp.grp().generatore().profilo());
|
|
|
|
|
cmp.genera();
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void verifica_campo( const TObject& campo )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Per evitare 3000 casts ...
|
1997-05-27 16:56:21 +00:00
|
|
|
|
TField & cmp = (TField&) campo;
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TGruppo & gruppo = cmp.grp();
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
cmp.stato(cmp.stato_reale());
|
2008-12-12 12:08:21 +00:00
|
|
|
|
if (cmp.stato() != S_NASCOSTO && cmp.stato() != S_NON_VISIBILE)
|
1996-09-26 15:37:19 +00:00
|
|
|
|
{
|
1997-05-27 16:56:21 +00:00
|
|
|
|
int h = cmp.y() + 1;
|
1997-10-24 10:47:19 +00:00
|
|
|
|
if (cmp.type() == T_CORNICE || cmp.type() == T_MEMO || cmp.type() == T_GOLEM )
|
1996-09-26 15:37:19 +00:00
|
|
|
|
h += cmp.size()%100 - 1;
|
|
|
|
|
if (gruppo.height() < h)
|
|
|
|
|
gruppo.height(h);
|
|
|
|
|
if (!gruppo.present())
|
|
|
|
|
gruppo.present(TRUE);
|
|
|
|
|
}
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
HIDDEN TProgind * _bar;
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
static void genera_gruppo( const TObject& gruppo )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// Per evitare 3000 casts
|
|
|
|
|
static TMask_generator * _mask_generator = NULL;
|
|
|
|
|
if (gruppo.class_id() == CLASS_STRING)
|
2008-12-12 12:08:21 +00:00
|
|
|
|
{
|
|
|
|
|
TFilename fname((TString &) gruppo);
|
|
|
|
|
TMask_generator & g = *_mask_generator;
|
|
|
|
|
TMaschera & m = g.maschera();
|
|
|
|
|
int row = m.line( ) - 1;
|
|
|
|
|
|
|
|
|
|
if (fname.starts_with("SHEET"))
|
|
|
|
|
{
|
|
|
|
|
g.genera_sheet(row, fname.find("LIST") > 0, fname.find("GIAC") > 0);
|
|
|
|
|
g.intestazione_pagina();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (fname.ext()[0] == '\0')
|
|
|
|
|
fname.ext("msk");
|
|
|
|
|
if (fexist(fname))
|
|
|
|
|
{
|
|
|
|
|
TScanner scanner(fname);
|
|
|
|
|
TString line(128);
|
|
|
|
|
|
|
|
|
|
line = scanner.line();
|
|
|
|
|
|
|
|
|
|
while (scanner.ok())
|
|
|
|
|
{
|
|
|
|
|
int row_pos = line.find("%R");
|
|
|
|
|
const bool new_line = (row_pos > 0);
|
|
|
|
|
if (!new_line)
|
|
|
|
|
row_pos = line.find("%S");
|
|
|
|
|
const bool field = line.left(2) == "%F";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (field && row > MAX_LINES_PER_PAGE)
|
|
|
|
|
{
|
|
|
|
|
// Passa alla pagina successiva
|
|
|
|
|
m.end( );
|
|
|
|
|
g.intestazione_pagina();
|
|
|
|
|
}
|
|
|
|
|
if (row_pos > 0)
|
|
|
|
|
{
|
|
|
|
|
if (new_line)
|
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
TString4 wrk; wrk.format("%02d", row);
|
|
|
|
|
line[row_pos++] = wrk[0];
|
|
|
|
|
line[row_pos] = wrk[1];
|
|
|
|
|
}
|
|
|
|
|
if (field)
|
|
|
|
|
m.output_row("");
|
|
|
|
|
else
|
|
|
|
|
m.output_row(line);
|
|
|
|
|
line = scanner.line();
|
|
|
|
|
}
|
|
|
|
|
m.line(row + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TGruppo & grp = (TGruppo &) gruppo;
|
|
|
|
|
|
|
|
|
|
grp.present(FALSE);
|
|
|
|
|
if (_mask_generator == NULL)
|
|
|
|
|
_mask_generator = &(grp.generatore());
|
|
|
|
|
grp.campi().for_each(verifica_campo);
|
|
|
|
|
do_events();
|
2008-06-13 08:45:21 +00:00
|
|
|
|
if (grp.present())
|
1999-04-06 15:34:39 +00:00
|
|
|
|
grp.genera();
|
|
|
|
|
if (_bar)
|
|
|
|
|
_bar->addstatus(1);
|
|
|
|
|
}
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
}
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TObject* TGruppo::dup() const
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
TGruppo* g = new TGruppo(id(), height());
|
|
|
|
|
|
|
|
|
|
g->generatore(generatore());
|
|
|
|
|
g->present(present());
|
1997-05-27 16:56:21 +00:00
|
|
|
|
g->_fields = _fields;
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TArray & fields = g->campi();
|
|
|
|
|
const int items = fields.items();
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
for (int i = 0; i < items; i++)
|
|
|
|
|
((TField &)fields[i]).grp(g);
|
|
|
|
|
return g;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TGruppo::genera( )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// Se il gruppo non sta sulla pagina ...
|
|
|
|
|
int oldlinea = maschera( ).line( );
|
|
|
|
|
if ( oldlinea + _height > MAX_LINES_PER_PAGE )
|
|
|
|
|
{
|
|
|
|
|
// Passa alla pagina successiva
|
|
|
|
|
maschera( ).end( );
|
|
|
|
|
generatore( ).intestazione_pagina( );
|
|
|
|
|
maschera( ).line( MASK_FIRST_LINE );
|
|
|
|
|
oldlinea = MASK_FIRST_LINE;
|
|
|
|
|
}
|
|
|
|
|
_fields.for_each( genera_campo );
|
|
|
|
|
maschera( ).line( oldlinea + _height );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TField::TField( TString& campo, TConfig& pro ) : _nome( campo )
|
|
|
|
|
{
|
|
|
|
|
_nome.trim( );
|
|
|
|
|
_fieldname = pro.get( "FIELDNAME", campo );
|
|
|
|
|
_x = _gruppo = pro.get_int( "X", campo );
|
|
|
|
|
_y = _gruppo = pro.get_int( "Y", campo );
|
|
|
|
|
_gruppo = pro.get_int( "GROUP", campo );
|
|
|
|
|
CHECK( _gruppo != 0, "Gruppo uguale a 0" );
|
|
|
|
|
_id = pro.get_int( "MSKID", campo );
|
|
|
|
|
CHECK( _id != 0, "Campo con MSKID uguale a 0" );
|
|
|
|
|
_type = pro.get_int( "TYPE", campo );
|
|
|
|
|
_size = pro.get_int( "SIZE", campo );
|
|
|
|
|
_prompt = pro.get( "PROMPT", campo );
|
|
|
|
|
if( _prompt[ 0 ] == '\"' )
|
|
|
|
|
{
|
|
|
|
|
_prompt.ltrim( 1 );
|
|
|
|
|
_prompt.rtrim( 1 );
|
|
|
|
|
};
|
|
|
|
|
_flag = pro.get( "FLAG", campo );
|
|
|
|
|
_help = pro.get( "FLAG", campo );
|
|
|
|
|
_warning = pro.get( "FLAG", campo );
|
|
|
|
|
_use = pro.get( "USE", campo );
|
|
|
|
|
_use.separator( '~' );
|
|
|
|
|
_input = pro.get( "INPUT", campo );
|
|
|
|
|
_input.separator( '~' );
|
|
|
|
|
_display = pro.get( "DISPLAY", campo );
|
|
|
|
|
_display.separator( '~' );
|
|
|
|
|
_output = pro.get( "OUTPUT", campo );
|
|
|
|
|
_output.separator( '~' );
|
1997-06-27 09:21:13 +00:00
|
|
|
|
_copy = pro.get( "COPY", campo );
|
|
|
|
|
_copy.separator( '~' );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_special = pro.get( "SPECIAL", campo );
|
|
|
|
|
_special.separator( '~' );
|
|
|
|
|
_configs = pro.get( "CONFIGS", campo );
|
|
|
|
|
_configs.separator( '~' );
|
|
|
|
|
_items = "";
|
|
|
|
|
int last = pro.get_int( "NITEMS", campo );
|
|
|
|
|
for( int i = 1; i <= last; i ++ )
|
|
|
|
|
_items.add( pro.get( "ITEM", campo, i ) );
|
|
|
|
|
};
|
|
|
|
|
|
1996-06-18 15:55:39 +00:00
|
|
|
|
TField::TField( )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
{
|
|
|
|
|
_nome = "";
|
|
|
|
|
_fieldname = "";
|
|
|
|
|
_x = 0;
|
|
|
|
|
_y = 0;
|
|
|
|
|
_gruppo = 0;
|
1996-07-25 13:05:29 +00:00
|
|
|
|
_stato = 0;
|
|
|
|
|
_grp = NULL;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_id = 0;
|
|
|
|
|
_type = 0;
|
|
|
|
|
_size = 0;
|
|
|
|
|
_prompt = "";
|
|
|
|
|
_flag = "";
|
|
|
|
|
_help = "";
|
|
|
|
|
_warning = "";
|
|
|
|
|
_use = "";
|
|
|
|
|
_use.separator( '~' );
|
|
|
|
|
_input = "";
|
|
|
|
|
_input.separator( '~' );
|
|
|
|
|
_display = "";
|
|
|
|
|
_display.separator( '~' );
|
|
|
|
|
_output = "";
|
|
|
|
|
_output.separator( '~' );
|
1997-06-27 09:21:13 +00:00
|
|
|
|
_copy = "";
|
|
|
|
|
_copy.separator( '~' );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_special = "";
|
|
|
|
|
_special.separator( '~' );
|
|
|
|
|
_configs = "";
|
|
|
|
|
_configs.separator( '~' );
|
|
|
|
|
_items = "";
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_items.separator( '@' );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TObject* TField::dup() const
|
1997-05-27 16:56:21 +00:00
|
|
|
|
{
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TField * f = new TField;
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
f->_nome = _nome;
|
|
|
|
|
f->_fieldname = _fieldname;
|
|
|
|
|
f->_x = _x;
|
|
|
|
|
f->_y = _y;
|
|
|
|
|
f->_gruppo = _gruppo;
|
|
|
|
|
f->_stato = _stato;
|
|
|
|
|
f->_type = _type;
|
|
|
|
|
f->_size = _size;
|
|
|
|
|
f->_prompt = _prompt;
|
|
|
|
|
f->_flag = _flag;
|
|
|
|
|
f->_help = _help;
|
|
|
|
|
f->_warning = _warning;
|
|
|
|
|
f->_use = _use;
|
|
|
|
|
f->_id = _id;
|
|
|
|
|
f->_input = _input;
|
|
|
|
|
f->_display = _display;
|
|
|
|
|
f->_output = _output;
|
1997-06-27 09:21:13 +00:00
|
|
|
|
f->_copy = _copy;
|
1996-07-25 13:05:29 +00:00
|
|
|
|
f->_special = _special;
|
|
|
|
|
f->_items = _items;
|
1997-05-27 16:56:21 +00:00
|
|
|
|
f->_configs = _configs;
|
1996-07-25 13:05:29 +00:00
|
|
|
|
return f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TField::stato_reale()
|
1995-12-04 17:41:06 +00:00
|
|
|
|
{
|
|
|
|
|
// Strategia al 28/08/95
|
1996-06-18 15:55:39 +00:00
|
|
|
|
// Se il campo, nel file .INI di definizione dei campi, h legato a qualche voce in
|
1995-12-04 17:41:06 +00:00
|
|
|
|
// configurazione, legge il suo stato, altrimenti assume il massimo.
|
|
|
|
|
// Va poi a verificare nel .INI da compilare, e verifica li' la impostazione.
|
|
|
|
|
// Controlla poi la impostazione per il gruppo, come impostato nel file .INI
|
|
|
|
|
// e nella sezione CONFIGS nel .INI di definizione dei gruppi.
|
|
|
|
|
// Utilizza poi la minore delle due.
|
|
|
|
|
int stato = S_OBBLIGATORIO;
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TToken_string riga_profilo(grp().generatore().profilo().get(_nome, "PROFILO"));
|
|
|
|
|
const int stato_profilo = riga_profilo.get_int(P_STATO);
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
if (stato > stato_profilo )
|
|
|
|
|
stato = stato_profilo;
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
2008-12-12 12:08:21 +00:00
|
|
|
|
if (stato > S_NON_VISIBILE)
|
1996-07-25 13:05:29 +00:00
|
|
|
|
{
|
|
|
|
|
const TString80 gruppo(fieldsini().get("GROUP", _nome));
|
|
|
|
|
int stato_gruppo = S_OBBLIGATORIO;
|
|
|
|
|
if (stato > stato_gruppo)
|
|
|
|
|
stato = stato_gruppo;
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
const int stato_gruppo_profilo = grp().generatore().profilo().get_int(gruppo, "PROFILOGRUPPO");
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1996-07-25 13:05:29 +00:00
|
|
|
|
if (stato > stato_gruppo_profilo)
|
|
|
|
|
stato = stato_gruppo_profilo;
|
|
|
|
|
}
|
1996-06-18 15:55:39 +00:00
|
|
|
|
return stato;
|
1998-01-20 15:45:20 +00:00
|
|
|
|
}
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
void TField::configura( TConfig& pro )
|
|
|
|
|
{
|
|
|
|
|
TToken_string riga_profilo( pro.get( _nome, "PROFILO" ) );
|
|
|
|
|
TString newprompt( riga_profilo.get( P_PROMPT ) ) ;
|
|
|
|
|
TString newhelp( riga_profilo.get( P_HELP ) ) ;
|
|
|
|
|
TString newwarning( riga_profilo.get( P_WARNING ) ) ;
|
|
|
|
|
if ( ! newprompt.blank( ) )
|
|
|
|
|
_prompt = newprompt;
|
|
|
|
|
if ( ! newhelp.blank( ) )
|
|
|
|
|
_help = newhelp;
|
|
|
|
|
if ( ! newwarning.blank( ) )
|
|
|
|
|
_warning = newwarning;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TField::genera( )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1996-07-25 13:05:29 +00:00
|
|
|
|
TMaschera& m = grp().maschera();
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TString s;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
if ( _stato == S_NASCOSTO )
|
|
|
|
|
return;
|
|
|
|
|
if ( _size != 0 )
|
|
|
|
|
m.control( _type, _id, _size );
|
|
|
|
|
else
|
|
|
|
|
m.control( _type, _id );
|
|
|
|
|
m.begin( );
|
|
|
|
|
switch( _stato )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
2008-12-12 12:08:21 +00:00
|
|
|
|
case S_NON_VISIBILE :
|
|
|
|
|
m.prompt( 50, 50, _prompt );
|
|
|
|
|
s = "D";
|
|
|
|
|
s << _flag;
|
|
|
|
|
m.flag( s ) ;
|
|
|
|
|
break;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
case S_DISABILITATO :
|
|
|
|
|
m.prompt( _x, _y + m.line( ), _prompt );
|
|
|
|
|
s = "D";
|
|
|
|
|
s << _flag;
|
|
|
|
|
m.flag( s ) ;
|
|
|
|
|
break;
|
|
|
|
|
case S_NORMALE :
|
|
|
|
|
case S_OBBLIGATORIO :
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case S_NOCHECK :
|
1995-12-04 17:41:06 +00:00
|
|
|
|
m.prompt( _x, _y + m.line( ), _prompt );
|
|
|
|
|
m.flag( _flag );
|
|
|
|
|
break;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
1997-05-27 16:56:21 +00:00
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if ((_type == T_DATA || _type == T_STRINGA ||
|
1997-10-24 10:47:19 +00:00
|
|
|
|
_type == T_NUMERO || _type == T_MEMO || _type == T_ZOOM ||
|
2000-05-05 15:25:49 +00:00
|
|
|
|
_type == T_GOLEM || _type == T_CURRENCY) &&
|
1999-04-06 15:34:39 +00:00
|
|
|
|
(_stato == S_OBBLIGATORIO || (!_use.blank())))
|
1996-06-18 15:55:39 +00:00
|
|
|
|
m.check( _stato );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
if ( !_fieldname.blank( ) ) m.field( _fieldname );
|
|
|
|
|
if ( !_items.blank( ) ) m.item( _items );
|
|
|
|
|
if ( !_use.blank( ) ) m.use( _use );
|
|
|
|
|
if ( !_input.blank( ) ) m.input( _input );
|
|
|
|
|
if ( !_display.blank( ) ) m.display( _display );
|
|
|
|
|
if ( !_output.blank( ) ) m.output( _output );
|
1997-06-27 09:21:13 +00:00
|
|
|
|
if ( !_copy.blank( ) ) m.copy( _copy );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
if ( !_help.blank( ) ) m.help( _help );
|
|
|
|
|
if ( !_warning.blank( ) ) m.warning( _warning );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
if ( !_special.blank( ) ) m.outline( _special );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
m.end( );
|
2008-12-12 12:08:21 +00:00
|
|
|
|
if ( ( m.line( ) > MAX_LINES_PER_PAGE ))
|
1995-12-04 17:41:06 +00:00
|
|
|
|
m.end( );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
}
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
// Definizione dei metodi di_generator
|
|
|
|
|
// -----------------------------------------
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TMask_generator::TMask_generator(const TString& tablefile ) : _fieldsini( "ve0300a.ini" ), _groupsini( "ve0300c.ini" )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
CHECK( fexist( "ve0300a.ini" ), "Il file ve0300a.ini non esiste!" );
|
|
|
|
|
_fieldsini.list_paragraphs( _fields );
|
|
|
|
|
CHECK( fexist( "ve0300b.dat" ), "Il file ve0300b.dat non esiste!" );
|
|
|
|
|
carica_tabella( "ve0300b.dat", _tab0300b );
|
|
|
|
|
carica_dati_campi( "ve0300a.ini", _gruppi );
|
1998-01-20 15:45:20 +00:00
|
|
|
|
_tablefile = tablefile;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TMask_generator::carica_dati_campi( const TFilename& fn, TAssoc_array& a )
|
|
|
|
|
{
|
|
|
|
|
TScanner infile( fn );
|
|
|
|
|
TString line;
|
|
|
|
|
TField *campo = NULL;
|
|
|
|
|
TGruppo *gruppo = NULL;
|
|
|
|
|
TString16 curgruppo( "" );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
while ( infile.ok( ) )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
line = infile.line( );
|
|
|
|
|
line.trim( );
|
|
|
|
|
while ( ( line.empty( ) || line[ 0 ] == '#' || line.left( 2 ) == "//" ) && infile.ok( ) )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
line = infile.line( );
|
|
|
|
|
line.trim( );
|
|
|
|
|
}
|
|
|
|
|
if( infile.ok( ) )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
if ( line[ 0 ] == '[' ) // Carica un un campo
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
line.strip( "[]" );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
if ( campo )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
{
|
|
|
|
|
TString16 fieldkey = GROUPKEY( campo->gruppo( ) );
|
|
|
|
|
if ( fieldkey != curgruppo )
|
|
|
|
|
{
|
|
|
|
|
if ( gruppo )
|
|
|
|
|
{
|
|
|
|
|
a.add( curgruppo, gruppo );
|
|
|
|
|
}
|
|
|
|
|
TString16 taggruppo;
|
|
|
|
|
taggruppo.format( "%d", campo->gruppo( ) );
|
1996-09-26 15:37:19 +00:00
|
|
|
|
gruppo = new TGruppo( campo->gruppo( ));
|
1995-12-04 17:41:06 +00:00
|
|
|
|
gruppo->generatore( *this );
|
|
|
|
|
}
|
|
|
|
|
gruppo->add( campo );
|
|
|
|
|
curgruppo = GROUPKEY( campo->gruppo( ) );
|
|
|
|
|
}
|
|
|
|
|
campo = new TField( );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
campo->nome( line );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
int pos;
|
|
|
|
|
if( ( pos = line.find( '=' ) ) == 0 )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
yesnofatal_box( "Linea errata nel file.INI: %s", (const char *) line );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TString key = line.sub( 0, pos );
|
|
|
|
|
key.trim( );
|
|
|
|
|
TString value = line.mid( pos + 1 );
|
|
|
|
|
value.trim( );
|
|
|
|
|
if( key == "X" )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
campo->x( atoi( value ) );
|
|
|
|
|
else if( key == "Y" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->y( atoi( value ) );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "GROUP" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->gruppo( atoi( value ) );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "FIELDNAME" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->fieldname( value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "MSKID" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->id( atoi( value ) );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "TYPE" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->type( atoi( value ) );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "SIZE" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->size( atoi( value ) );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "PROMPT" )
|
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
if( value[ 0 ] == '"' )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
value.rtrim( 1 );
|
|
|
|
|
value.ltrim( 1 );
|
|
|
|
|
};
|
|
|
|
|
campo->prompt( value );
|
|
|
|
|
}
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "FLAG" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->flag( value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "USE" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->use( (TToken_string & ) value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "INPUT" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->input( (TToken_string & )value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "DISPLAY" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->display( (TToken_string & )value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "OUTPUT" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->output( (TToken_string & )value );
|
1997-06-27 09:21:13 +00:00
|
|
|
|
else if( key == "COPY" )
|
|
|
|
|
campo->copy( (TToken_string & )value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "WARNING" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->warning( value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "HELP" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->help( value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "SPECIAL" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->special( (TToken_string & )value );
|
|
|
|
|
else if( key == "ITEMS" )
|
|
|
|
|
campo->items( (TToken_string & )value );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
else if( key == "CONFIGS" )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
campo->configs( (TToken_string & )value );
|
|
|
|
|
else yesnofatal_box( "Chiave non trovata(%s)", (const char *) key );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1996-06-18 15:55:39 +00:00
|
|
|
|
if ( campo )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
{
|
|
|
|
|
if( format( "%5d", campo->gruppo( ) ) != curgruppo )
|
|
|
|
|
{
|
|
|
|
|
if( gruppo )
|
|
|
|
|
{
|
|
|
|
|
a.add( curgruppo, gruppo );
|
|
|
|
|
}
|
|
|
|
|
TString16 taggruppo;
|
1996-09-26 15:37:19 +00:00
|
|
|
|
taggruppo.format("%d", campo->gruppo());
|
|
|
|
|
gruppo = new TGruppo(campo->gruppo());
|
1995-12-04 17:41:06 +00:00
|
|
|
|
gruppo->generatore( *this );
|
|
|
|
|
}
|
|
|
|
|
gruppo->add( campo );
|
|
|
|
|
curgruppo = GROUPKEY( campo->gruppo( ) );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
a.add( curgruppo, gruppo );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TMask_generator::carica_tabella( const TFilename& fn, TString_array& tabella )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
1995-12-04 17:41:06 +00:00
|
|
|
|
TScanner in( fn );
|
2004-04-28 21:14:03 +00:00
|
|
|
|
TToken_string line(in.line());
|
1996-06-18 15:55:39 +00:00
|
|
|
|
while( line.not_empty( ) )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
{ // Attacca tutte le righe che finiscono con <20>
|
|
|
|
|
while ( line.right( 1 ) == "<EFBFBD>" )
|
|
|
|
|
{ line.rtrim( 1 );
|
|
|
|
|
line << in.line( );
|
|
|
|
|
};
|
|
|
|
|
tabella.add( line );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
line = in.line( );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TMask_generator::genera_item_sheet( TToken_string _line )
|
|
|
|
|
{
|
|
|
|
|
_m->_out << "IT \"" << _line.get( B_DESCR );
|
|
|
|
|
_m->_out << "@" << _line.get_int( B_WIDTH ) << "\"\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TMask_generator::intestazione_pagina( )
|
2008-12-12 12:08:21 +00:00
|
|
|
|
{
|
|
|
|
|
_m->line( MASK_FIRST_LINE );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->page( _m->page( ) + 1 );
|
2008-12-12 12:08:21 +00:00
|
|
|
|
|
|
|
|
|
const TString80 title(profilo().get("Title", "MAIN", _m->page()));
|
|
|
|
|
|
|
|
|
|
_m->pagina( _m->page(), title);
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
|
|
|
|
_m->control( T_CORNICE, DLG_NULL, 7806 );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 1, 0, "" );
|
|
|
|
|
_m->end( );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, DLG_NULL, 4 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 2, 1, "Cod. num. " );
|
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->group( 2 );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->control( T_STRINGA, DLG_NULL, 50 );
|
|
|
|
|
_m->begin( );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_m->prompt( 24, 1 );
|
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->group( 3 );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, DLG_NULL, 4 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 2, 2, "Tipo doc. " );
|
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->group( 4 );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, DLG_NULL, 50 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 24, 2 );
|
|
|
|
|
_m->flag( "D" );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->group( 5 );
|
|
|
|
|
_m->end( );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1997-06-03 10:29:42 +00:00
|
|
|
|
_m->control( T_STRINGA, DLG_NULL, 4 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 2, 3, "Esercizio " );
|
|
|
|
|
_m->group( 9 );
|
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_m->control( T_NUMERO, DLG_NULL, 6 );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->begin( );
|
1997-06-03 10:29:42 +00:00
|
|
|
|
_m->prompt( 24, 3, "Numero doc. " );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->group( 6 );
|
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->end( );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
|
|
|
|
_m->control( T_DATA, DLG_NULL );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->begin( );
|
1997-06-03 10:29:42 +00:00
|
|
|
|
_m->prompt( 46, 3, "Data " );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->group( 7 );
|
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->end( );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
2008-02-01 06:35:27 +00:00
|
|
|
|
_m->control( T_STRINGA, DLG_NULL, 1 );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_m->begin( );
|
1997-06-03 10:29:42 +00:00
|
|
|
|
_m->prompt( 67, 3, "Stato " );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_m->group( 8 );
|
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, DLG_NULL, 6 );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->begin( );
|
|
|
|
|
if ( _pro->get( "TIPOCF", "MAIN" ) == "C" )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_m->prompt( 2, 4, "Cliente " );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
else
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_m->prompt( 2, 4, "Fornitore " );
|
|
|
|
|
_m->group( 10 );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->flag( "D" );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, DLG_NULL, 50 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 24, 4, "" );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->group( 11 );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
_m->flag( "D" );
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->end( );
|
1997-05-27 16:56:21 +00:00
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-01-20 15:45:20 +00:00
|
|
|
|
void TMask_generator::load_table()
|
|
|
|
|
{
|
|
|
|
|
_frdtable.destroy();
|
|
|
|
|
if (!fexist(_tablefile))
|
|
|
|
|
fatal_box("Il file %s per il caricamento formule documento non esiste.", (const char*) _tablefile);
|
|
|
|
|
|
|
|
|
|
TScanner f(_tablefile);
|
|
|
|
|
TToken_string s(1024);
|
|
|
|
|
TString token;
|
2000-05-05 15:25:49 +00:00
|
|
|
|
int b0pos = B0_POSITION, s0pos = S0_POSITION, i0pos = I0_POSITION, b1pos = B1_POSITION;
|
1998-01-20 15:45:20 +00:00
|
|
|
|
if (f.paragraph("Header"))
|
|
|
|
|
{
|
|
|
|
|
s = f.line();
|
|
|
|
|
if (s.find("Version") > -1)
|
|
|
|
|
s = f.line();
|
|
|
|
|
int totitem = 0;
|
|
|
|
|
while (s.find("Fields") > -1)
|
|
|
|
|
{
|
|
|
|
|
const int items = s.items();
|
|
|
|
|
for (int i = 0; i < items; i++)
|
|
|
|
|
{
|
|
|
|
|
int pos = totitem + i;
|
|
|
|
|
if (strstr(s.get(i),"S0") != NULL)
|
|
|
|
|
s0pos = pos;
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (strstr(s.get(i),"I0") != NULL)
|
|
|
|
|
i0pos = pos;
|
1998-01-20 15:45:20 +00:00
|
|
|
|
if (strstr(s.get(i),"B0") != NULL)
|
|
|
|
|
b0pos = pos;
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (strstr(s.get(i),"B1") != NULL)
|
|
|
|
|
b1pos = pos;
|
1998-01-20 15:45:20 +00:00
|
|
|
|
}
|
|
|
|
|
totitem += items;
|
|
|
|
|
s = f.line();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!f.paragraph("Data"))
|
|
|
|
|
fatal_box("Manca il paragrafo [Data] nel file %s.", (const char*) _tablefile);
|
|
|
|
|
s = f.line();
|
|
|
|
|
while (s.not_empty())
|
|
|
|
|
{
|
|
|
|
|
s.restart();
|
|
|
|
|
token = s.get(0);
|
|
|
|
|
if (token == "FRD")
|
|
|
|
|
{
|
|
|
|
|
token = s.get(1);
|
|
|
|
|
if (_frdtable.objptr(token) == NULL)
|
|
|
|
|
{
|
|
|
|
|
_TableItem* t = new _TableItem;
|
2005-03-29 09:23:32 +00:00
|
|
|
|
t->set_b0(s.get_char(b0pos) == 'X');
|
|
|
|
|
t->set_b1(s.get_char(b1pos) == 'X');
|
1998-01-20 15:45:20 +00:00
|
|
|
|
t->set_s0(s.get(s0pos));
|
2000-05-05 15:25:49 +00:00
|
|
|
|
t->set_i0(s.get_int(i0pos));
|
1998-01-20 15:45:20 +00:00
|
|
|
|
_frdtable.add(token, t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
s = f.line();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-12 12:08:21 +00:00
|
|
|
|
void TMask_generator::genera_sheet(int line, bool show_list, bool genera_disp)
|
|
|
|
|
{
|
|
|
|
|
line++;
|
|
|
|
|
if (genera_disp)
|
|
|
|
|
{
|
|
|
|
|
// Generazione del campo con la giacenza della riga corrente
|
|
|
|
|
_m->control ( T_NUMERO, F_CURGIAC, 15 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 2, line, "Riga corrente: Giacenza ");
|
|
|
|
|
_m->flag("D");
|
|
|
|
|
_m->picture(".5");
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
// Generazione del campo con la disponibilita' della riga corrente
|
|
|
|
|
_m->control ( T_NUMERO, F_CURDISP, 15 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 44, line++, "Disponibilita' ");
|
|
|
|
|
_m->flag("D");
|
|
|
|
|
_m->picture(".5");
|
|
|
|
|
_m->end( );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Generazione del listbox per i tipi di riga da aggiungere nello sheet
|
|
|
|
|
_m->control ( T_LISTA, F_LBTIPORIGA, 30 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 2, show_list ? line : -1, "Tipo riga da aggiungere " );
|
|
|
|
|
if (show_list)
|
|
|
|
|
line++;
|
|
|
|
|
else
|
|
|
|
|
_m->flag("H");
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
// Generazione dello sheet : vedi il profilo
|
|
|
|
|
TScanner sheet_in( "ve0300b.dat" );
|
|
|
|
|
_m->_out << "SPREADSHEET " << F_SHEET << "\n";
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 2, line );
|
|
|
|
|
do_events();
|
|
|
|
|
for(int i = 0; i < _tab0300b.items( ); i ++ )
|
|
|
|
|
genera_item_sheet( _tab0300b.row( i ) );
|
|
|
|
|
_m->end( );
|
|
|
|
|
_m->end( );
|
|
|
|
|
_m->_sheet_generated = true;
|
|
|
|
|
}
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
void TMask_generator::genera( const TString& profilo )
|
1996-06-18 15:55:39 +00:00
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if( profilo == "-all" || profilo[0] == '*')
|
1996-07-25 13:05:29 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TString_array profiles;
|
1997-06-03 10:29:42 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
TAssoc_array profiles_array;
|
|
|
|
|
TRelation rel("%TIP");
|
|
|
|
|
TCursor t( &rel );
|
|
|
|
|
long count = t.items();
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
for( t = 0; t.pos( ) < count; ++t )
|
|
|
|
|
{
|
|
|
|
|
const TString profile_name(t.curr().get("S4"));
|
|
|
|
|
TFilename profile(profile_name);
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
profile.ext("ini");
|
|
|
|
|
if (fexist(profile) && !profiles_array.is_key(profile_name))
|
|
|
|
|
profiles_array.add(profile_name);
|
|
|
|
|
}
|
|
|
|
|
profiles_array.get_keys(profiles);
|
|
|
|
|
}
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TProgind bar( profiles.items(), "Generazione automatica profili", FALSE, TRUE);
|
|
|
|
|
const int items = profiles.items();
|
1997-06-18 09:44:56 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
for (int i = 0; i < items; i++)
|
|
|
|
|
{
|
|
|
|
|
const TString &profile = profiles.row(i);
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
genera(profile);
|
|
|
|
|
bar.addstatus(1);
|
|
|
|
|
}
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int i, last;
|
|
|
|
|
TString temp_s;
|
|
|
|
|
TFilename proname( profilo );
|
|
|
|
|
|
|
|
|
|
// All'inizio il gruppo h 'chiuso'
|
|
|
|
|
_groupopen = FALSE;
|
|
|
|
|
|
|
|
|
|
// Forza l'estensione al profilo
|
|
|
|
|
proname.ext( "ini" );
|
|
|
|
|
|
|
|
|
|
// Se il file di profilo non esiste, esci con un errore fatale
|
|
|
|
|
if (!fexist( proname))
|
|
|
|
|
{
|
|
|
|
|
error_box( "Il profilo %s non esiste!", ( const char * )profilo);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_pro = new TConfig( proname );
|
|
|
|
|
|
2009-02-06 12:30:16 +00:00
|
|
|
|
const char tipo_cf = _pro->get_char("TIPOCF", "MAIN");
|
2009-02-02 10:10:18 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TFilename _mskname(profilo);
|
|
|
|
|
_mskname.ext( "msk" );
|
|
|
|
|
|
1997-05-27 16:56:21 +00:00
|
|
|
|
do_events();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// Mi serve per ordinare i gruppi a seconda del documento
|
|
|
|
|
TAssoc_array grouporder;
|
|
|
|
|
|
|
|
|
|
_m = new TMaschera( _mskname );
|
|
|
|
|
|
|
|
|
|
// Definizione della toolbar
|
2008-06-13 08:45:21 +00:00
|
|
|
|
// _m->outline( "TOOLBAR \"\" 0 -2 0 2" );
|
|
|
|
|
_m->outline( "TOOLBAR \"\" 0 0 0 2" );
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
_m->control( T_BOTTONE, DLG_SAVEREC, 1002 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( -15, -1, "~Registra" );
|
|
|
|
|
_m->message( "EXIT,20082" );
|
|
|
|
|
_m->picture(BMP_SAVEREC);
|
|
|
|
|
_m->picture(BMP_SAVERECDN);
|
1995-12-04 17:41:06 +00:00
|
|
|
|
_m->end( );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
|
|
|
|
_m->control( T_BOTTONE, DLG_DELREC, 1002 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( -25, -1, "~Elimina" );
|
|
|
|
|
_m->message( "EXIT,127" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_BOTTONE, DLG_ELABORA, 1002 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( -35, -1, "E~labora" );
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_m->picture(BMP_ELABORA);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
// _m->message( "EXIT,345" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_BOTTONE, DLG_PRINT, 1002 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( -45, -1 );
|
|
|
|
|
_m->message( "EXIT,20082" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
2008-06-11 11:31:27 +00:00
|
|
|
|
_m->control( T_BOTTONE, DLG_CONFERMA, 1002 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( -45, -1, "~Conferma");
|
|
|
|
|
_m->picture(BMP_OK);
|
2009-01-26 12:46:07 +00:00
|
|
|
|
_m->flag("D");
|
2008-06-11 11:31:27 +00:00
|
|
|
|
_m->end( );
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->control( T_BOTTONE, DLG_CANCEL, 1002 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( -55, -1 );
|
|
|
|
|
_m->message( "EXIT,27" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
// End della toolbar
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do_events();
|
|
|
|
|
// Header della prima pagina
|
|
|
|
|
|
2008-12-12 12:08:21 +00:00
|
|
|
|
const TString80 title(_pro->get("Title", "MAIN", _m->page()));
|
|
|
|
|
|
|
|
|
|
_m->pagina( _m->page( ), title);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
2009-02-06 12:30:16 +00:00
|
|
|
|
_m->control( T_CORNICE, DLG_NULL, 7807);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 1, 0, "" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, F_CODNUM, 4 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 2, 1, "Cod. num. " );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field(DOC_CODNUM);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->use("%NUM", 1);
|
|
|
|
|
temp_s.format("CODTAB %d", F_CODNUM);
|
|
|
|
|
_m->input(temp_s);
|
|
|
|
|
_m->display("\"Codice\" CODTAB~\"Descrizione@50\" S0");
|
|
|
|
|
temp_s.format("%d S0", F_DESNUM);
|
|
|
|
|
_m->output(temp_s);
|
|
|
|
|
_m->check(S_NORMALE);
|
|
|
|
|
_m->flag( "GDU" );
|
|
|
|
|
_m->message( "CO,2@" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, F_DESNUM, 50 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 24, 1 );
|
|
|
|
|
_m->flag( "GD" );
|
|
|
|
|
_m->message( "CO,3@" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, F_TIPODOC, 4 );
|
|
|
|
|
_m->begin( );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field( DOC_TIPODOC );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->prompt( 2, 2, "Tipo doc. " );
|
|
|
|
|
_m->use("%TIP" , 1);
|
|
|
|
|
temp_s.format("CODTAB %d", F_TIPODOC);
|
|
|
|
|
_m->input(temp_s);
|
|
|
|
|
_m->display("\"Codice\" CODTAB~\"Descrizione@50\" S0");
|
|
|
|
|
temp_s.format("%d S0", F_DESTIPODOC);
|
|
|
|
|
_m->output(temp_s);
|
|
|
|
|
_m->check(S_NORMALE);
|
|
|
|
|
_m->flag( "GDU" );
|
|
|
|
|
_m->message( "CO,4@" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_LISTA, F_TIPOCF, 9 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 100, 100, "" );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field( DOC_TIPOCF );
|
|
|
|
|
_m->item(tipo_cf == 'C' ? "C|Cliente" : "F|Fornitore");
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, F_PROVV, 1 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 100, 100, "<D><P> " );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field( DOC_PROVV );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->flag( "D" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, F_DESTIPODOC, 50 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 24, 2 );
|
|
|
|
|
_m->flag( "GD" );
|
|
|
|
|
_m->message( "CO,5@" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, F_ANNO, 4 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 2, 3, "Esercizio " );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field( DOC_ANNO );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->flag( "GD" );
|
|
|
|
|
_m->message( "CO,9@" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_NUMERO, F_NDOC, 6 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 24, 3, "Numero doc. " );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field( DOC_NDOC );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->message( "CO,6@" );
|
|
|
|
|
_m->flag( "GDR" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
_m->control( T_DATA, F_DATADOC );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 46, 3, "Data " );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field( DOC_DATADOC );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
TString m("CO,7@");
|
|
|
|
|
_m->message(m);
|
|
|
|
|
// _m->flag( "A" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_m->control( T_STRINGA, F_STATO, 1 );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 67, 3, "Stato " );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field( DOC_STATO );
|
2008-02-01 06:35:27 +00:00
|
|
|
|
_m->use("%STD", 1);
|
|
|
|
|
_m->input("CODTAB 105");
|
|
|
|
|
_m->display("\"Codice\" CODTAB");
|
|
|
|
|
_m->display("\"Descrizione@50\" S0");
|
|
|
|
|
_m->output("105 CODTAB");
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->message( "CO,8@" );
|
2008-02-01 06:35:27 +00:00
|
|
|
|
_m->check(S_NORMALE);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->flag( "DG" );
|
2009-02-06 12:30:16 +00:00
|
|
|
|
_m->end( );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->control( T_STRINGA, F_CODCF, 6 );
|
|
|
|
|
_m->begin( );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
if ( tipo_cf == 'C' )
|
1998-08-25 18:07:30 +00:00
|
|
|
|
{
|
2009-02-06 12:30:16 +00:00
|
|
|
|
_m->prompt( 2, 4, "Cliente " );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->warning( "Cliente assente" );
|
|
|
|
|
_m->help( "Codice del cliente del documento" );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-02-06 12:30:16 +00:00
|
|
|
|
_m->prompt( 2, 4, "Fornitore " );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->warning( "Fornitore assente" );
|
|
|
|
|
_m->help( "Codice del fornitore del documento" );
|
|
|
|
|
}
|
|
|
|
|
_m->flag( "R" );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
_m->field( DOC_CODCF );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->group( 1 );
|
|
|
|
|
_m->use( LF_CLIFO, 1 );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
temp_s.format( "TIPOCF \"%c\"~CODCF %d", tipo_cf, F_CODCF);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->input( temp_s );
|
|
|
|
|
_m->display( "\"Codice\" CODCF~\"Ragione Sociale@50\" RAGSOC~\"Partita IVA@12\" PAIV~\"Sospeso\" SOSPESO" );
|
|
|
|
|
temp_s.format( "%d CODCF~%d RAGSOC", F_CODCF, F_RAGSOC );
|
|
|
|
|
_m->output( temp_s );
|
|
|
|
|
_m->check( S_OBBLIGATORIO );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
temp_s.format( "ADD RU cg0 -1 %c", tipo_cf);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->outline( temp_s );
|
|
|
|
|
_m->message( "CO,10@" );
|
|
|
|
|
_m->end( );
|
2009-02-06 12:30:16 +00:00
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, F_RICALT, 30 );
|
|
|
|
|
_m->begin( );
|
|
|
|
|
_m->prompt( 22, 4, "" );
|
|
|
|
|
_m->warning( "Cliente assente" );
|
|
|
|
|
_m->help( "Codice mnemonico del cliente del documento" );
|
|
|
|
|
_m->group( 1 );
|
|
|
|
|
_m->use( LF_CLIFO, 6 );
|
|
|
|
|
temp_s.format( "TIPOCF \"%c\"~RICALT %d", tipo_cf, F_RICALT);
|
|
|
|
|
_m->input( temp_s );
|
|
|
|
|
_m->display( "\"Mnemonico@30\" RICALT~\"Codice\" CODCF~\"Ragione Sociale@50\" RAGSOC~\"Partita IVA@12\" PAIV~\"Sospeso\" SOSPESO" );
|
|
|
|
|
temp_s.format( "%d RICALT~%d CODCF~%d RAGSOC", F_RICALT, F_CODCF, F_RAGSOC );
|
|
|
|
|
_m->output( temp_s );
|
|
|
|
|
_m->check( S_NORMALE );
|
|
|
|
|
temp_s.format( "ADD RU cg0 -1 %c", tipo_cf);
|
|
|
|
|
_m->outline( temp_s );
|
|
|
|
|
_m->end( );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
|
|
|
|
_m->control( T_STRINGA, F_RAGSOC, 50 );
|
|
|
|
|
_m->begin( );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
if ( tipo_cf == 'C' )
|
1998-08-25 18:07:30 +00:00
|
|
|
|
{
|
|
|
|
|
_m->warning( "Cliente assente" );
|
|
|
|
|
_m->help( "Ragione sociale del cliente del documento" );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_m->warning( "Fornitore assente" );
|
|
|
|
|
_m->help( "Ragione sociale del fornitore del documento" );
|
|
|
|
|
}
|
2009-02-06 12:30:16 +00:00
|
|
|
|
_m->prompt( 2, 5, "Ragione Sociale " );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->group( 1 );
|
|
|
|
|
_m->use( LF_CLIFO, 2 );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
temp_s.format( "TIPOCF \"%c\"~RAGSOC %d", tipo_cf, F_RAGSOC );
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->input( temp_s );
|
|
|
|
|
_m->display( "\"Ragione Sociale@50\" RAGSOC~\"Partita IVA@12\" PAIV~\"Codice\" CODCF" );
|
|
|
|
|
temp_s.format( "%d CODCF~%d RAGSOC", F_CODCF, F_RAGSOC );
|
|
|
|
|
_m->output( temp_s );
|
|
|
|
|
_m->check( S_OBBLIGATORIO );
|
2009-02-02 10:10:18 +00:00
|
|
|
|
temp_s.format( "ADD RU cg0 -1 %c", tipo_cf);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_m->outline( temp_s );
|
|
|
|
|
_m->message( "CO,11@" );
|
|
|
|
|
_m->end( );
|
|
|
|
|
_m->line( MASK_FIRST_LINE );
|
|
|
|
|
|
|
|
|
|
// Generazione
|
|
|
|
|
|
|
|
|
|
// Scorro l'array dei gruppi, e ne creo una copia ordinata
|
|
|
|
|
// con solo i gruppi visibili
|
|
|
|
|
|
|
|
|
|
TArray sortedgroups;
|
|
|
|
|
TString16 chiave, chiavegruppo;
|
|
|
|
|
last = _pro->get_int( "NGROUPS", "ORDINEGRUPPI" );
|
|
|
|
|
for( i = 1; i <= last; i ++ )
|
|
|
|
|
{
|
|
|
|
|
do_events();
|
|
|
|
|
chiave.format( "%d", i );
|
|
|
|
|
const TString key(_pro->get( chiave, "ORDINEGRUPPI" ));
|
|
|
|
|
|
|
|
|
|
if (key.not_empty())
|
|
|
|
|
{
|
2009-02-06 12:30:16 +00:00
|
|
|
|
if (isdigit(key[0]))
|
|
|
|
|
{
|
|
|
|
|
chiavegruppo.GROUPKEY(atoi(key));
|
|
|
|
|
if( _gruppi.is_key( chiavegruppo ) )
|
|
|
|
|
sortedgroups.add( _gruppi[ (chiavegruppo) ] );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sortedgroups.add(key);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TString80 message;
|
|
|
|
|
|
2008-12-12 12:08:21 +00:00
|
|
|
|
_m->_sheet_generated = false;
|
2008-06-13 08:45:21 +00:00
|
|
|
|
message.format("Generazione profilo : %s", (const char *)profilo);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_bar = new TProgind(sortedgroups.items(), message, FALSE, TRUE);
|
|
|
|
|
sortedgroups.for_each( genera_gruppo );
|
2008-06-13 08:45:21 +00:00
|
|
|
|
delete _bar; _bar = NULL;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_m->end( );
|
2008-12-12 12:08:21 +00:00
|
|
|
|
if (!_m->_sheet_generated)
|
|
|
|
|
{
|
|
|
|
|
intestazione_pagina( );
|
|
|
|
|
genera_sheet();
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
// Generazione pagina dei piedi
|
|
|
|
|
{
|
|
|
|
|
TToken_string s(_pro->get("CAMPICALC", "MAIN"));
|
|
|
|
|
const bool usefiles = _tablefile.empty();
|
|
|
|
|
|
|
|
|
|
if (s.not_empty())
|
1997-05-27 16:56:21 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
intestazione_pagina( );
|
|
|
|
|
TTable* frd = NULL;
|
|
|
|
|
|
1998-01-20 15:45:20 +00:00
|
|
|
|
if (usefiles)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
frd = new TTable( "%FRD" );
|
|
|
|
|
else
|
|
|
|
|
load_table();
|
|
|
|
|
|
|
|
|
|
int nr = 1;
|
|
|
|
|
int id = 0;
|
|
|
|
|
for (const char * cp = s.get(0); cp && *cp; cp = s.get())
|
1998-01-20 15:45:20 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const TString16 codpiede(cp);
|
|
|
|
|
do_events();
|
|
|
|
|
if (usefiles)
|
1996-07-25 13:05:29 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
frd->zero( );
|
|
|
|
|
frd->put( "CODTAB", codpiede );
|
|
|
|
|
}
|
|
|
|
|
_TableItem* t = (_TableItem*) _frdtable.objptr(codpiede);
|
|
|
|
|
if ( (usefiles && frd->read( ) == NOERR) || t != NULL )
|
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
int len = usefiles ? frd->get_int( "I0") : t->i0();
|
|
|
|
|
|
|
|
|
|
if (len <= 0 || len > 18)
|
|
|
|
|
len = 18;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
id++;
|
|
|
|
|
|
|
|
|
|
if( nr + MASK_FIRST_LINE > MAX_LINES_PER_PAGE )
|
|
|
|
|
{
|
|
|
|
|
_m->end( );
|
|
|
|
|
intestazione_pagina( );
|
|
|
|
|
nr = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
const bool currency = usefiles ? frd->get_bool("B0") : t->b0();
|
|
|
|
|
_m->control( currency ? T_CURRENCY : T_STRINGA, BASE_PIEDE + id, len);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_m->begin( );
|
|
|
|
|
|
|
|
|
|
TString80 header(usefiles ? frd->get("S0") : t->s0());
|
|
|
|
|
header.left_just(58 - len);
|
|
|
|
|
|
|
|
|
|
_m->prompt( 2, 7 + nr, header );
|
|
|
|
|
_m->field(codpiede);
|
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
const bool importo = usefiles ? frd->get_bool("B1") : t->b1();
|
|
|
|
|
|
|
|
|
|
TString16 flags("D");
|
|
|
|
|
if (!importo)
|
|
|
|
|
flags << "U";
|
|
|
|
|
_m->flag( flags );
|
|
|
|
|
TString16 driven; driven.format("DRIVENBY %d", F_CODVAL);
|
|
|
|
|
|
|
|
|
|
_m->outline(driven);
|
1996-07-25 13:05:29 +00:00
|
|
|
|
_m->end( );
|
1999-04-06 15:34:39 +00:00
|
|
|
|
nr++;
|
1996-07-25 13:05:29 +00:00
|
|
|
|
}
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_m->end( );
|
|
|
|
|
|
|
|
|
|
if (frd != NULL)
|
|
|
|
|
delete frd;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_m->endmask( );
|
|
|
|
|
|
|
|
|
|
// Stategia al 30/06/95
|
|
|
|
|
// Creo una maschera con tutte le colonne, poi, a RUNTIME,
|
|
|
|
|
// dal motore, nascondo e adatto le colonne.
|
|
|
|
|
|
|
|
|
|
// Generazione maschera dello sheet
|
|
|
|
|
delete _m;
|
|
|
|
|
fcopy("verig00.msk", _mskname, TRUE);
|
|
|
|
|
delete _pro;
|
1996-07-25 13:05:29 +00:00
|
|
|
|
}
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Applicazione guscio
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
class TGenMask_application : public TSkeleton_application
|
1997-05-27 16:56:21 +00:00
|
|
|
|
{
|
1998-01-20 15:45:20 +00:00
|
|
|
|
bool _use_files;
|
|
|
|
|
TString _tablefile;
|
|
|
|
|
|
1995-12-04 17:41:06 +00:00
|
|
|
|
protected:
|
1999-04-06 15:34:39 +00:00
|
|
|
|
virtual bool use_files() const { return _use_files; }
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
1998-01-20 15:45:20 +00:00
|
|
|
|
public:
|
1999-04-06 15:34:39 +00:00
|
|
|
|
virtual void main_loop();
|
1998-01-23 09:57:34 +00:00
|
|
|
|
// @cmember Disabilita la verifica del modulo : essendo una anagrafica, va sempre abilitata
|
1999-04-06 15:34:39 +00:00
|
|
|
|
virtual bool check_autorization() const {return FALSE;}
|
|
|
|
|
void set_files(const bool b = TRUE) {_use_files = b;}
|
|
|
|
|
void set_tablefile(const TString& t) {_tablefile = t;}
|
1996-06-18 15:55:39 +00:00
|
|
|
|
};
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void TGenMask_application::main_loop( )
|
1995-12-04 17:41:06 +00:00
|
|
|
|
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TMask_generator gen(_tablefile);
|
|
|
|
|
gen.genera(argv(2));
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int ve0300( int argc, char* argv[])
|
1995-12-04 17:41:06 +00:00
|
|
|
|
{
|
1998-01-20 15:45:20 +00:00
|
|
|
|
TGenMask_application a;
|
|
|
|
|
|
|
|
|
|
a.set_files(TRUE);
|
|
|
|
|
TString tablefile;
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (argc < 3)
|
1998-01-20 15:45:20 +00:00
|
|
|
|
fatal_box( Usage );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if ( argc > 3)
|
1998-01-20 15:45:20 +00:00
|
|
|
|
{
|
|
|
|
|
if (strncmp(argv[3],"-f",2) == 0)
|
|
|
|
|
{
|
|
|
|
|
a.set_files(FALSE);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (argv[3][2] > ' ')
|
1998-01-20 15:45:20 +00:00
|
|
|
|
{
|
|
|
|
|
tablefile = argv[3];
|
|
|
|
|
tablefile.ltrim(2);
|
|
|
|
|
}
|
|
|
|
|
else
|
2000-05-05 15:25:49 +00:00
|
|
|
|
tablefile = "vetabcom.txt";
|
1998-01-20 15:45:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
a.set_tablefile(tablefile);
|
1995-12-04 17:41:06 +00:00
|
|
|
|
a.run ( argc, argv, "Generazione in corso ..." );
|
1996-06-18 15:55:39 +00:00
|
|
|
|
return 0;
|
1995-12-04 17:41:06 +00:00
|
|
|
|
}
|