Patch level : 10.0 190

Files correlati     : ve0.exe tutti i profili
Ricompilazione Demo : [ ]
Commento            :

Rivista la genrazione dei documenti di vendita per gestire lo  sheet in pagine diverse dall'ultima e impostare il titolo di una pagina valorizzando la variabile Title(numero pagina) nel praragrafo MAIN del profilo.


git-svn-id: svn://10.65.10.50/trunk@17880 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2008-12-12 12:08:21 +00:00
parent ccf30a02e1
commit a62302f623
2 changed files with 138 additions and 106 deletions

View File

@ -73,7 +73,7 @@ public:
void check( const int i );
// PAGE
void pagina( const int i, const TString& title = "Pag." ){ _out << "PA \"" << title << " " << i << "\" 11 60 14\n"; };
void pagina( const int page, const TString& title = EMPTY_STRING );
// PROMPT
void prompt( const int x, const int y, const TString& s = "" ){ _out << "PR " << x << " " << y << " \"" << s << "\"\n"; };
@ -144,14 +144,19 @@ public:
// Costruttore, vuole il nome del file .INI
TMaschera( const TFilename outfile );
// Vero se la pagina h aperta
bool _pageopen;
// Vero se ho gia' generato lo sheet
bool _sheet_generated;
// File .MSK di output
ofstream _out;
};
void TMaschera::pagina(const int page, const TString& title)
{
_out << "PA \"" << (title.blank() ? TString("Pag.") << " " << page : title) << "\" 11 60 14\n";
}
// Classe per memorizzare gli elementi di FRD
class _TableItem : public TObject
{
@ -251,6 +256,7 @@ public:
TMaschera& maschera( ){ return *_m; }
void genera_sheet(int line = 5, bool show_list = true, bool genera_disp = true);
// Attiva la generazione della maschera
void genera( const TString& profilo);
@ -276,7 +282,7 @@ TMaschera::TMaschera( const TFilename outfile ) : _out( outfile )
{
_curline = 1;
_curpage = 1;
_pageopen = FALSE;
_sheet_generated = false;
}
void TMaschera::outline( const TString& s, const TString& prefix, const char sep )
@ -531,7 +537,7 @@ static void verifica_campo( const TObject& campo )
TGruppo & gruppo = cmp.grp();
cmp.stato(cmp.stato_reale());
if (cmp.stato() != S_NASCOSTO)
if (cmp.stato() != S_NASCOSTO && cmp.stato() != S_NON_VISIBILE)
{
int h = cmp.y() + 1;
if (cmp.type() == T_CORNICE || cmp.type() == T_MEMO || cmp.type() == T_GOLEM )
@ -550,54 +556,61 @@ static void genera_gruppo( const TObject& gruppo )
// Per evitare 3000 casts
static TMask_generator * _mask_generator = NULL;
if (gruppo.class_id() == CLASS_STRING)
{
TFilename fname((TString &) gruppo);
if (fname.ext()[0] == '\0')
fname.ext("msk");
if (fexist(fname))
{
TScanner scanner(fname);
TString line(128);
TMask_generator & g = *_mask_generator;
TMaschera & m = g.maschera();
int row = m.line( ) - 1;
{
TFilename fname((TString &) gruppo);
TMask_generator & g = *_mask_generator;
TMaschera & m = g.maschera();
int row = m.line( ) - 1;
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();
row = MASK_FIRST_LINE;
}
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);
}
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);
}
}
}
else
{
@ -768,7 +781,7 @@ int TField::stato_reale()
if (stato > stato_profilo )
stato = stato_profilo;
if (stato > S_NASCOSTO)
if (stato > S_NON_VISIBILE)
{
const TString80 gruppo(fieldsini().get("GROUP", _nome));
int stato_gruppo = S_OBBLIGATORIO;
@ -811,6 +824,12 @@ void TField::genera( )
m.begin( );
switch( _stato )
{
case S_NON_VISIBILE :
m.prompt( 50, 50, _prompt );
s = "D";
s << _flag;
m.flag( s ) ;
break;
case S_DISABILITATO :
m.prompt( _x, _y + m.line( ), _prompt );
s = "D";
@ -842,12 +861,8 @@ void TField::genera( )
if ( !_warning.blank( ) ) m.warning( _warning );
if ( !_special.blank( ) ) m.outline( _special );
m.end( );
if ( ( m.line( ) > MAX_LINES_PER_PAGE ) && ( m._pageopen == TRUE))
{
if ( ( m.line( ) > MAX_LINES_PER_PAGE ))
m.end( );
m._pageopen = FALSE;
m.line( MASK_FIRST_LINE );
}
}
// Definizione dei metodi di_generator
@ -1007,9 +1022,13 @@ void TMask_generator::genera_item_sheet( TToken_string _line )
}
void TMask_generator::intestazione_pagina( )
{
{
_m->line( MASK_FIRST_LINE );
_m->page( _m->page( ) + 1 );
_m->pagina( _m->page( ));
const TString80 title(profilo().get("Title", "MAIN", _m->page()));
_m->pagina( _m->page(), title);
_m->control( T_CORNICE, DLG_NULL, 7806 );
_m->begin( );
@ -1151,6 +1170,51 @@ void TMask_generator::load_table()
}
}
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;
}
void TMask_generator::genera( const TString& profilo )
{
if( profilo == "-all" || profilo[0] == '*')
@ -1268,7 +1332,9 @@ void TMask_generator::genera( const TString& profilo )
do_events();
// Header della prima pagina
_m->pagina( _m->page( ));
const TString80 title(_pro->get("Title", "MAIN", _m->page()));
_m->pagina( _m->page( ), title);
_m->control( T_CORNICE, DLG_NULL, 7806 );
_m->begin( );
@ -1432,8 +1498,6 @@ void TMask_generator::genera( const TString& profilo )
_m->end( );
_m->line( MASK_FIRST_LINE );
_m->_pageopen = TRUE;
// Generazione
// Scorro l'array dei gruppi, e ne creo una copia ordinata
@ -1463,49 +1527,17 @@ void TMask_generator::genera( const TString& profilo )
TString80 message;
_m->_sheet_generated = false;
message.format("Generazione profilo : %s", (const char *)profilo);
_bar = new TProgind(sortedgroups.items(), message, FALSE, TRUE);
sortedgroups.for_each( genera_gruppo );
delete _bar; _bar = NULL;
if ( _m->_pageopen == TRUE )
{
_m->end( );
_m->end( );
if (!_m->_sheet_generated)
{
intestazione_pagina( );
}
// Generazione del campo con la giacenza della riga corrente
_m->control ( T_NUMERO, F_CURGIAC, 15 );
_m->begin( );
_m->prompt( 2, 6, "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, 6, "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, 7, "Tipo riga da aggiungere " );
_m->end( );
// Generazione dello sheet : vedi il profilo
TScanner sheet_in( "ve0300b.dat" );
_m->_out << "SPREADSHEET " << F_SHEET << "\n";
_m->begin( );
_m->prompt( 2, 8 );
do_events();
for( i = 0; i < _tab0300b.items( ); i ++ )
genera_item_sheet( _tab0300b.row( i ) );
_m->end( );
_m->end( );
genera_sheet();
}
// Generazione pagina dei piedi
{
@ -1546,7 +1578,6 @@ void TMask_generator::genera( const TString& profilo )
{
_m->end( );
intestazione_pagina( );
_m->line( MASK_FIRST_LINE );
nr = 1;
}

View File

@ -11,10 +11,11 @@
#define T_CURRENCY 11
#define S_NASCOSTO 0
#define S_DISABILITATO 1
#define S_NOCHECK 2
#define S_NORMALE 3
#define S_OBBLIGATORIO 4
#define S_NON_VISIBILE 1
#define S_DISABILITATO 2
#define S_NOCHECK 3
#define S_NORMALE 4
#define S_OBBLIGATORIO 5
// #define F_LBTIPORIGA 175
// #define NPIEDI 40