Modifiche generali alle vendite.
git-svn-id: svn://10.65.10.50/trunk@2237 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ce0a332775
commit
407c8a6a87
209
ve/sconti.cpp
209
ve/sconti.cpp
@ -2,6 +2,28 @@
|
||||
#include "sconti.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VEUML_H
|
||||
#include "veuml.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VEUML2_H
|
||||
#include "veuml2.h"
|
||||
#endif
|
||||
|
||||
#ifndef __TCLIFOR_H
|
||||
#include "tclifor.h"
|
||||
#endif
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VECONF_H
|
||||
#include "veconf.h"
|
||||
#endif
|
||||
|
||||
#define A_ANAMAG 0
|
||||
|
||||
const real TSconto::cento( "100" );
|
||||
|
||||
void TSconto::set( const TString& exp, bool signal )
|
||||
@ -67,7 +89,7 @@ void TSconto::set( const TString& exp, bool signal )
|
||||
_errorpos = i;
|
||||
break;
|
||||
}
|
||||
// Se occorrenva un numero ci metto lo 0
|
||||
// Se occorreva un numero ci metto lo 0
|
||||
if( startnum )
|
||||
num << '0';
|
||||
// Interpreto la virgola come punto
|
||||
@ -109,8 +131,189 @@ real TSconto::sconto( )
|
||||
return ( ( _part * cento ) - cento );
|
||||
}
|
||||
|
||||
void calcola_sconto_riga( TRectype riga )
|
||||
|
||||
TSconto_riga::TSconto_riga( TCliFor& clifo, TMask * testa, TMask * riga ) : _condv( LF_CONDV ), _rcondv( LF_RCONDV ), _anamag( LF_ANAGR ), _sconti( LF_SCONTI ), _ditta( CONFIG_DITTA )
|
||||
{
|
||||
_clifo = &clifo;
|
||||
_testa = testa;
|
||||
_riga = riga;
|
||||
}
|
||||
|
||||
bool TSconto_riga::cerca_condv( int tiporicerca )
|
||||
{
|
||||
TString s1 = _anamag.get( "CODART" );
|
||||
TString s2 = riga( ).get( FS_CODART );
|
||||
if( s1 != s2 )
|
||||
{
|
||||
_anamag.setkey( 1 );
|
||||
_anamag.zero( );
|
||||
_anamag.put( "CODART", riga( ).get( FS_CODART ) );
|
||||
int ret = _anamag.read( );
|
||||
CHECK( ret == NOERR, "Articolo non trovato in anagrafica di magazzino!" );
|
||||
}
|
||||
if( tiporicerca == A_ANAMAG )
|
||||
// Se ricercavo per anagrafica, ho già finito
|
||||
return TRUE;
|
||||
if( _ditta.get_bool( "GES", "ve", tiporicerca ) )
|
||||
{
|
||||
// Se è attiva la gestione contratti ...
|
||||
_condv.setkey( 1 );
|
||||
_condv.zero( );
|
||||
switch( tiporicerca )
|
||||
{
|
||||
case A_CONTRATTI:
|
||||
_condv.put( "TIPO", "C" );
|
||||
_condv.blank( "CATVEN" );
|
||||
if( _ditta.get_bool( "GESSCONCC", "ve" ) )
|
||||
{
|
||||
// Se in ditta è abilitata la gestione del cliente in chiave
|
||||
// al contratto, lo carico con gioia
|
||||
_condv.put( "TIPOCF", clifo( ).tipocf( ) );
|
||||
_condv.put( "CODCF", clifo( ).codcf( ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
_condv.blank( "TIPOCF" );
|
||||
_condv.blank( "CODCF" );
|
||||
}
|
||||
_condv.put( "COD", testa( ).get( F_CODCONT ) );
|
||||
break;
|
||||
case A_LISTINI:
|
||||
_condv.put( "TIPO", "L" );
|
||||
if( _ditta.get_bool( "GESLISCV", "ve" ) )
|
||||
{
|
||||
// Se in ditta è abilitata la gestione del cliente in chiave
|
||||
// al contratto, lo carico con gioia
|
||||
_condv.put( "TIPOCF", clifo( ).tipocf( ) );
|
||||
_condv.put( "CODCF", clifo( ).codcf( ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
_condv.blank( "TIPOCF" );
|
||||
_condv.blank( "CODCF" );
|
||||
}
|
||||
_condv.blank( "CATVEN" );
|
||||
_condv.put( "COD", testa( ).get( F_CODLIST ) );
|
||||
break;
|
||||
case A_OFFERTE:
|
||||
_condv.put( "TIPO", "O" );
|
||||
_condv.blank( "CATVEN" );
|
||||
_condv.blank( "TIPOCF" );
|
||||
_condv.blank( "CODCF" );
|
||||
_condv.put( "COD", testa( ).get( F_CODCAMP ) );
|
||||
break;
|
||||
}
|
||||
if( _condv.read( ) == NOERR )
|
||||
{
|
||||
_rcondv.setkey( 2 );
|
||||
_rcondv.zero( );
|
||||
_rcondv.put( "TIPO", _condv.get( "TIPO" ) );
|
||||
_rcondv.put( "CATVEN", _condv.get( "CATVEN" ) );
|
||||
_rcondv.put( "TIPOCF", _condv.get( "TIPOCF" ) );
|
||||
_rcondv.put( "CODCF", _condv.get( "CODCF" ) );
|
||||
if( _condv.get_bool( "GESTUM" ) )
|
||||
{
|
||||
_rcondv.put( "UM", riga( ).get( FS_UMQTA ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
_rcondv.blank( "UM" );
|
||||
}
|
||||
if( _condv.get_bool( "GESTSCA" ) )
|
||||
{
|
||||
_rcondv.put( "QLIM", riga( ).get( FS_QTA ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
_rcondv.blank( "QLIM" );
|
||||
}
|
||||
const TString16 seqricrighe( _condv.get( "SEQRIC" ) );
|
||||
for( int i = 0; i < seqricrighe.len( ); i ++ )
|
||||
{
|
||||
|
||||
|
||||
char ricerca = seqricrighe[ i ];
|
||||
_rcondv.put( "TIPORIGA", ricerca );
|
||||
switch( ricerca )
|
||||
{
|
||||
case 'A':
|
||||
_rcondv.put( "CODRIGA", _anamag.get( "CODART" ) );
|
||||
if( _rcondv.read( ) == NOERR ) return TRUE;
|
||||
break;
|
||||
case 'R':
|
||||
_rcondv.put( "CODRIGA", _anamag.get( "RAGGFIS" ) );
|
||||
if( _rcondv.read( ) == NOERR ) return TRUE;
|
||||
break;
|
||||
case 'G':
|
||||
_rcondv.put( "CODRIGA", _anamag.get( "GRMERC1" ) );
|
||||
if( _rcondv.read( ) == NOERR ) return TRUE;
|
||||
_rcondv.put( "CODRIGA", _anamag.get( "GRMERC2" ) );
|
||||
if( _rcondv.read( ) == NOERR ) return TRUE;
|
||||
_rcondv.put( "CODRIGA", _anamag.get( "GRMERC3" ) );
|
||||
if( _rcondv.read( ) == NOERR ) return TRUE;
|
||||
break;
|
||||
default:
|
||||
CHECK( FALSE, "Tipo di ricerca righe non valido!" );
|
||||
}
|
||||
}
|
||||
// Ricerca fallita
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
// Ricerca fallita
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
// La ricerca non è gestita, impossibile trovarlo ...
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Probabilmente dovrebbe lavorare sulla maschera, ma per ora la lasciamo così
|
||||
void TSconto_riga::calcola( )
|
||||
{
|
||||
char gestione = _ditta.get_char( "GESSCORIGA", "ve" );
|
||||
bool trovato = TRUE;
|
||||
switch( gestione )
|
||||
{
|
||||
case 'N':
|
||||
// Sconti di riga non gestiti
|
||||
set( "" );
|
||||
break;
|
||||
case 'L':
|
||||
// Percentuale su contratti/offerte/listini/anagrafica
|
||||
trovato = cerca_condv( A_CONTRATTI );
|
||||
if( !trovato ) trovato = cerca_condv( A_OFFERTE );
|
||||
if( !trovato ) trovato = cerca_condv( A_LISTINI );
|
||||
if( !trovato )
|
||||
set( _rcondv.get( "SCONTO" ) );
|
||||
else
|
||||
{
|
||||
if( cerca_condv( A_ANAMAG ) )
|
||||
set( _anamag.get( "SCONTO" ) );
|
||||
else
|
||||
CHECK( FALSE, "Sconto non trovato!( 1 )" );
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
// Posiziono l'anagrafica
|
||||
cerca_condv( A_ANAMAG );
|
||||
_sconti.setkey( 1 );
|
||||
_sconti.put( "TIPO", "R" );
|
||||
_sconti.put( "CODART", _anamag.get( "CODART" ) );
|
||||
if( _ditta.get_bool( "GESSCORIGACV", "ve" ) )
|
||||
{
|
||||
_sconti.put( "CODCAT", clifo( ).get( LF_CFVEN, "SCONTO" ) );
|
||||
}
|
||||
if( _ditta.get_bool( "GESSCORIGAUM", "ve" ) )
|
||||
{
|
||||
_sconti.put( "UM", riga( ).get( FS_UMQTA ) );
|
||||
}
|
||||
if( _sconti.read( ) == NOERR )
|
||||
// Bravo, hai vinto una bambolina
|
||||
set( _sconti.get( "SCONTO" ) );
|
||||
else
|
||||
CHECK( FALSE, "Sconto non trovato!( 2 )" );
|
||||
break;
|
||||
case 'C':
|
||||
set( clifo( ).get( LF_CFVEN, "SCONTO" ) );
|
||||
}
|
||||
}
|
||||
|
44
ve/sconti.h
44
ve/sconti.h
@ -5,6 +5,19 @@
|
||||
#include <real.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TCLIFOR_H
|
||||
#include "tclifor.h"
|
||||
#endif
|
||||
|
||||
#ifndef __MASK_H
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define CHKVALID CHECK( _valid, "Tentativo di usare uno sconto non valido!" )
|
||||
|
||||
class TSconto : public TObject
|
||||
@ -28,4 +41,35 @@ public:
|
||||
};
|
||||
|
||||
#undef CHKVALID
|
||||
|
||||
class TSconto_riga : public TSconto
|
||||
{
|
||||
private:
|
||||
TCliFor* _clifo;
|
||||
// TRelation _condv;
|
||||
// Invece che la relazione uso i due files, poichè mi interessa sempre
|
||||
// solo una delle righe
|
||||
TLocalisamfile _condv;
|
||||
TLocalisamfile _rcondv;
|
||||
TLocalisamfile _anamag;
|
||||
TLocalisamfile _sconti;
|
||||
TConfig _ditta;
|
||||
TMask* _testa;
|
||||
TMask* _riga;
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
|
||||
TSconto_riga( TCliFor& clifo, TMask * testa = NULL, TMask * riga = NULL );
|
||||
|
||||
TCliFor& clifo( ){ return *_clifo; }
|
||||
void set_testa( TMask& testa ){ _testa = &testa; }
|
||||
TMask& testa( ){ return *_testa; }
|
||||
void set_riga( TMask& riga ){ _riga = &riga; }
|
||||
TMask& riga( ){ return *_riga; }
|
||||
bool cerca_condv( int tiporicerca );
|
||||
void calcola( );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -151,18 +151,25 @@ void TCliForVendite::update_mask( TMask_vendite& m, bool onload )
|
||||
}
|
||||
if ( !stato.blank( ) )
|
||||
m.set( F_DESSTATOCF, get( "%STA", stato, "S0" ) );
|
||||
TString16 tmpstr( m.get( F_CODPAG ) );
|
||||
if( !tmpstr.blank( ) )
|
||||
{
|
||||
m.field( F_CODPAG ).on_hit( );
|
||||
m.field( F_CODPAG ).check( );
|
||||
}
|
||||
tmpstr = m.get( F_CODLIN );
|
||||
if( !tmpstr.blank( ) )
|
||||
m.field( F_CODLIN ).check( );
|
||||
m.check_field( F_CODPAG );
|
||||
m.check_field( F_CODLIN );
|
||||
// m.check_field( F_CODABIA );
|
||||
m.check_field( F_CODCABA );
|
||||
// m.check_field( F_CODABIP );
|
||||
m.check_field( F_CODCABP );
|
||||
m.check_field( F_CODINDSP );
|
||||
m.check_field( F_CODAG );
|
||||
m.check_field( F_CODSPMEZZO );
|
||||
m.check_field( F_CODPORTO );
|
||||
m.check_field( F_CODNOTESP1 );
|
||||
m.check_field( F_CODNOTESP2 );
|
||||
m.check_field( F_CODVETT1 );
|
||||
m.check_field( F_CODVETT2 );
|
||||
m.check_field( F_CODVETT3 );
|
||||
imposta_dati_comune( m );
|
||||
imposta_indirizzo_spedizione( m );
|
||||
imposta_sconto_testa( m );
|
||||
imposta_valuta( m );
|
||||
}
|
||||
|
||||
void TCliFor::edita_occasionale( )
|
||||
@ -289,15 +296,27 @@ void TCliForVendite::imposta_sconto_testa( TMask_vendite& m )
|
||||
codsconto = get( LF_CFVEN, "CODSCC" );
|
||||
if( !codsconto.blank( ) )
|
||||
{
|
||||
TLocalisamfile sconti( LF_SCONTI );
|
||||
// ARCHIVIO SVCONTI PER SCONTO CLIENTE
|
||||
// TLocalisamfile sconti( LF_SCONTI );
|
||||
// sconti.setkey( 1 );
|
||||
// sconti.zero( );
|
||||
// sconti.put( "TIPO", "D" );
|
||||
// sconti.put( "CODCAT", codsconto );
|
||||
// if( sconti.read( ) == NOERR )
|
||||
// m.set( F_SCONTOPERC, sconti.get( "SCONTO" ) );
|
||||
// else
|
||||
// message_box( "Sconto non trovato nella tabella sconti!" );
|
||||
TTable sconti( "%SCC" );
|
||||
sconti.setkey( 1 );
|
||||
sconti.zero( );
|
||||
sconti.put( "TIPO", "D" );
|
||||
sconti.put( "CODCAT", codsconto );
|
||||
// sconti.put( "TIPO", "D" );
|
||||
sconti.put( "CODTAB", codsconto );
|
||||
if( sconti.read( ) == NOERR )
|
||||
m.set( F_SCONTOPERC, sconti.get( "SCONTO" ) );
|
||||
m.set( F_SCONTOPERC, sconti.get( "S1" ) );
|
||||
#ifdef DBG
|
||||
else
|
||||
message_box( "Sconto non trovato nella tabella sconti!" );
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
break;
|
||||
@ -307,29 +326,59 @@ void TCliForVendite::imposta_sconto_testa( TMask_vendite& m )
|
||||
sconti.zero( );
|
||||
sconti.put( "TIPO", "I" );
|
||||
if( ditta.get_bool( "SCOKEY", "ve", 1 ) )
|
||||
{
|
||||
sconti.put( "CODCAT", get( LF_CFVEN, "CATVEN" ) );
|
||||
if( ditta.get_bool( "SCOKEY", "ve", 2 ) )
|
||||
{
|
||||
codart= get( LF_CFVEN, "CODSCC" );
|
||||
codart << get( LF_CFVEN, "CODSCC" );
|
||||
else
|
||||
codart << " ";
|
||||
if( ditta.get_bool( "SCOKEY", "ve", 3 ) )
|
||||
{
|
||||
codart << get( LF_CFVEN, "CODZONA" );
|
||||
else
|
||||
codart << " ";
|
||||
if( ditta.get_bool( "SCOKEY", "ve", 4 ) )
|
||||
codart << get( LF_CLIFO, "CODPAG" );
|
||||
}
|
||||
}
|
||||
}
|
||||
sconti.put( "CODART", codart );
|
||||
if( sconti.read( ) == NOERR )
|
||||
{
|
||||
m.set( F_SCONTOPERC, sconti.get( "SCONTO" ) );
|
||||
}
|
||||
#ifdef DBG
|
||||
else
|
||||
{
|
||||
message_box( "Sconto non trovato nell'archivio sconti!" );
|
||||
}
|
||||
message_box( FALSE, "Sconto non trovato nell'archivio sconti!" );
|
||||
#endif
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TCliForVendite::imposta_valuta( TMask_vendite& m )
|
||||
{
|
||||
|
||||
TConfig ditta( CONFIG_DITTA );
|
||||
|
||||
if( ditta.get_bool( "GESVALAC", "ve" ) )
|
||||
{
|
||||
TTable cambi( "%CAM" );
|
||||
cambi.zero( );
|
||||
TString16 val( m.get( F_CODVAL ) );
|
||||
TString16 codtab( ( const char * ) val );
|
||||
codtab << m.get( F_DATADOC );
|
||||
cambi.put( "CODTAB", codtab );
|
||||
const int result = cambi.read( _isgteq );
|
||||
if( result == _iseof )
|
||||
cambi.prev( );
|
||||
codtab = cambi.get( "CODTAB" );
|
||||
if ( codtab.sub( 0, 2 ) == val )
|
||||
{
|
||||
m.set( F_CAMBIO, cambi.get( "R10" ) );
|
||||
m.set( F_DATACAMBIO, cambi.get( "D0" ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
TTable valuta( "VAL" );
|
||||
valuta.zero( );
|
||||
valuta.put( "CODTAB", m.get( F_CODVAL ) );
|
||||
if( valuta.read( ) == NOERR )
|
||||
{
|
||||
m.set( F_CAMBIO, valuta.get( "R10" ) );
|
||||
m.set( F_DATACAMBIO, valuta.get( "D0" ) );
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ class TCliFor : public TData_picker
|
||||
static bool occas_code_handler(TMask_field& f, KEY key);
|
||||
int write_occas( );
|
||||
void edita_occasionale( );
|
||||
char tipocf( ){ return _tipocf; }
|
||||
long codcf( ){ return _codcf; }
|
||||
};
|
||||
|
||||
class TCliForVendite : public TCliFor
|
||||
@ -65,6 +67,7 @@ class TCliForVendite : public TCliFor
|
||||
|
||||
void update_mask( TMask_vendite& m, bool onload = FALSE );
|
||||
void imposta_dati_comune( TMask_vendite& m );
|
||||
void imposta_valuta( TMask_vendite& m );
|
||||
void imposta_indirizzo_spedizione( TMask_vendite& m );
|
||||
void imposta_sconto_testa( TMask_vendite& m );
|
||||
|
||||
|
648
ve/ve0100.cpp
648
ve/ve0100.cpp
@ -1,242 +1,28 @@
|
||||
#include <xvt_defs.h>
|
||||
|
||||
#ifndef __CHECKS_H
|
||||
#include <checks.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TABUTIL_H
|
||||
#include <tabutil.h>
|
||||
#endif
|
||||
|
||||
#ifndef __BRWAPP_H
|
||||
#include <brwapp.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RELAPP_H
|
||||
#include <relapp.h>
|
||||
#endif
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef __LFFILES_H
|
||||
#include <lffiles.h>
|
||||
#endif
|
||||
|
||||
#ifndef __DEFMASK_H
|
||||
#include "defmask.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VEUML_H
|
||||
#include "veuml.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VEUML1_H
|
||||
#include "veuml1.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SHEET_H
|
||||
#include <sheet.h>
|
||||
#endif
|
||||
|
||||
#ifndef __REAL_H
|
||||
#include <real.h>
|
||||
#endif
|
||||
|
||||
#ifndef __MSKSHEET_H
|
||||
#include <msksheet.h>
|
||||
#endif
|
||||
|
||||
#ifndef __VE0100_H
|
||||
#include "ve0100.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VE0100C_H
|
||||
#include "ve0100c.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VE0100D_H
|
||||
#include "ve0100d.h"
|
||||
#endif
|
||||
|
||||
#ifndef __TCLIFOR_H
|
||||
#include "tclifor.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VE1000O_H
|
||||
#include "ve1000o.h"
|
||||
#endif
|
||||
|
||||
#ifndef __TMASKVEN_H
|
||||
#include "tmaskven.h"
|
||||
#endif
|
||||
|
||||
#ifndef __EXECP_H
|
||||
#include "execp.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SCONTI_H
|
||||
#include "sconti.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define CHANGE_MESSAGE "Sono state effettuate modifiche alla configurazione.\nPrima di eseguire la gestione documenti occorrerà rigenerare le maschere.\nDesideri farlo ora ?"
|
||||
|
||||
|
||||
|
||||
// Numero di colonne presenti sullo sheet totale
|
||||
#define MAX_COLUMNS 22
|
||||
|
||||
#define F_LBTIPORIGA 175
|
||||
#define NPIEDI 40
|
||||
|
||||
typedef real array_piede[ NPIEDI ];
|
||||
|
||||
// Definizione della classe dell'applicazione motore
|
||||
class TMotore_application : public TRelation_application
|
||||
{
|
||||
// Array di totalizzatori
|
||||
array_piede _piedi;
|
||||
array_piede _piedi_temp;
|
||||
|
||||
// Record array per la gestione delle righe
|
||||
TRecord_array* _righe_rec;
|
||||
|
||||
// Puntatore al profilo del documento caricato
|
||||
TConfig* _pro;
|
||||
|
||||
// Puntatore al nome, per evitare di ricrearlo se è uguale
|
||||
TFilename* _proname;
|
||||
|
||||
// Puntatore alla maschera di ricerca
|
||||
TMask* _msk;
|
||||
|
||||
// Puntatore alla maschera di modifica/inserimento ( dipende dal profilo )
|
||||
TMask_vendite* _msk1;
|
||||
|
||||
// puntatore alla relazione
|
||||
TRelation* _rel;
|
||||
|
||||
// Puntatore allo sheet delle righe documento
|
||||
TSheet_field* _sheet;
|
||||
|
||||
// Oggetto cliente per il motore
|
||||
TCliForVendite* _clifor;
|
||||
|
||||
// Indica se il documento ha come soggetto un <C>liente o un <F>ornitore
|
||||
char _tipocf;
|
||||
|
||||
// Ridefinizione dei metodi virtuali
|
||||
virtual bool user_create( );
|
||||
virtual bool user_destroy( );
|
||||
virtual TMask* get_mask(int mode);
|
||||
virtual bool changing_mask(int mode);
|
||||
virtual TRelation* get_relation( ) const { return _rel;}
|
||||
virtual void init_insert_mode( TMask& m );
|
||||
virtual int read( TMask& m );
|
||||
virtual bool remove( void );
|
||||
virtual int write(const TMask& m);
|
||||
virtual int rewrite(const TMask& m);
|
||||
|
||||
// Punti di ingresso per le funzioni utente
|
||||
|
||||
// Funzioni da associare ad ogni procedura
|
||||
int user_function( int index );
|
||||
|
||||
// Funzioni per il calcolo delle righe
|
||||
real user_row_calculate( TRectype& row, int index );
|
||||
|
||||
void user_set_handler( int fieldid, int index, TMask* m = NULL );
|
||||
|
||||
long prossimo_numero( bool provv );
|
||||
int avanza_numero( bool provv );
|
||||
void get_edit_mask( void );
|
||||
void azzera_piedi( bool temp = FALSE );
|
||||
void carica_piedi( );
|
||||
void somma_piedi( );
|
||||
void sottrai_piedi( );
|
||||
|
||||
// Esegue, se c'è, la procedura utente relativa ad una certa operazione
|
||||
int esegui_procedura( int operazione );
|
||||
|
||||
protected:
|
||||
|
||||
// Procedure e funzioni per la gestione della maschera e dei files
|
||||
void read_rdoc(TMask& m);
|
||||
|
||||
// formato dipendente dallo sheet (sono le varie colonne)
|
||||
void load_riga( TSheet_field& f, int numrig, TRectype& r );
|
||||
void store_riga( TSheet_field& f, int numrig, TRectype& r );
|
||||
|
||||
void save(TRelation* r) const;
|
||||
void set_descr (int numrig, const char* descr);
|
||||
void carica_righe_libere(int from = -1);
|
||||
bool check_key( TLocalisamfile& rdoc, TString16 codnum, bool provv, TString16 _anno, TString16 _ndoc );
|
||||
|
||||
// Procedure e funzioni per la gestione degli stati
|
||||
void setta_stato_corrente( int nuovostato );
|
||||
const char* nome_sezione( int op );
|
||||
int stato_corrente( );
|
||||
int stato_finale( int operazione );
|
||||
bool stato_valido( int stato, int operazione );
|
||||
void segnala_stato_non_valido( int operazione );
|
||||
TString& stati_validi( int operazione ){ return ( pro( ).get( "STATIVALIDI", nome_sezione( operazione ) ) );};
|
||||
|
||||
void calcola_riga( TRectype& rdoc, bool temp = FALSE );
|
||||
|
||||
// Handle che ritorna la maschera per le righe
|
||||
static TMask * ss_getmask( int numriga, TMask& fullmask, bool destroy );
|
||||
|
||||
// Handler che gestisce la richiesta del tipo riga in inserimento
|
||||
static bool ss_handler( TSheet_field& ss, int r, KEY key );
|
||||
|
||||
// Handler per la maschera di ricerca
|
||||
static bool ndoc_handler(TMask_field& f, KEY key);
|
||||
static bool num_handler(TMask_field& f, KEY key);
|
||||
static bool tip_handler(TMask_field& f, KEY key);
|
||||
|
||||
// Handler per la maschera di modifica
|
||||
static bool clifo_handler(TMask_field& f, KEY key);
|
||||
static bool occas_handler(TMask_field& f, KEY key);
|
||||
|
||||
// Configurazione dello sheet dato il profilo
|
||||
void configura_sheet( TSheet_field& sheet, TConfig& config );
|
||||
|
||||
public:
|
||||
|
||||
// Funzioni di accesso alle variabili privste
|
||||
|
||||
TRecord_array& righe_rec( ) { CHECK( _righe_rec, "Record array delle righe nullo!" ); return * _righe_rec; };
|
||||
TConfig& pro( ) { CHECK( _pro, "Profilo del documento nullo!" ); return *_pro; };
|
||||
TFilename& proname( ) { CHECK( _proname, "Nome del profilo nullo!" ); return *_proname; };
|
||||
TMask& query_mask( ) { CHECK( _msk, "Maschera di ricerca nulla!" ); return *_msk; };
|
||||
TMask& edit_mask( ) { CHECK( _msk1, "Maschera di modifica nulla!" ); return *_msk1; };
|
||||
TRelation& rel( ) { CHECK( _rel, "Relazione nulla!" ); return *_rel; };
|
||||
TSheet_field& sheet( ) { CHECK( _sheet, "Sheet nullo!" ); return *_sheet; };
|
||||
TCliForVendite& clifo( ) { CHECK( _clifor, "Oggetto cliente nullo!" ); return *_clifor; };
|
||||
|
||||
// Operazione
|
||||
|
||||
const char tipocf( ){ return _tipocf; }
|
||||
void tipocf( const char tcf ){ _tipocf = tcf; }
|
||||
bool valida_operazione( int operazione );
|
||||
|
||||
TSheet_field& ss( ) const { return *_sheet; }
|
||||
TMotore_application( ) { _pro = NULL; }
|
||||
virtual ~TMotore_application( ) { if ( _pro ) delete _pro; }
|
||||
virtual const char* get_next_key( );
|
||||
|
||||
};
|
||||
|
||||
HIDDEN TMotore_application& app( ) { return (TMotore_application&) main_app( ); }
|
||||
TMotore_application& app( ) { return ( TMotore_application& ) main_app( ); }
|
||||
|
||||
void TMotore_application::init_insert_mode( TMask& m )
|
||||
{
|
||||
TString tipocf( "A" );
|
||||
tipocf[ 0 ] = app( ).tipocf( );
|
||||
// m.reset( );
|
||||
m.set( F_DATAINSC, m.get( F_DATADOC ) );
|
||||
m.reset( );
|
||||
m.set( F_TIPOCF, tipocf );
|
||||
clifo( ).occas_mask( ).reset( );
|
||||
};
|
||||
int ndefaults = pro( ).get_int( "NDEFAULTS", "DEFAULT" );
|
||||
for( int i = 1; i <= ndefaults; i++ )
|
||||
{
|
||||
TString16 chiave;
|
||||
chiave.format( "%d", i );
|
||||
TToken_string valore( pro( ).get( chiave, "DEFAULT" ) );
|
||||
int campo( valore.get_int( 0 ) );
|
||||
TString default_val( valore.get( 1 ) );
|
||||
edit_mask( ).set( campo, default_val, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
int TMotore_application::user_function( int index )
|
||||
{
|
||||
@ -248,68 +34,46 @@ int TMotore_application::user_function( int index )
|
||||
yesnofatal_box( "Chiamata ad una procedura utente non definita: %d", index );
|
||||
return NOERR;
|
||||
break;
|
||||
};
|
||||
}
|
||||
return NOERR;
|
||||
};
|
||||
}
|
||||
|
||||
// Funzione che dato il profilo di riga ottiene la maschera
|
||||
// Serve per ottenere una maschera diversa per ogni riga
|
||||
// Da migliorare, mettendo una cache
|
||||
|
||||
TMask *TMotore_application::ss_getmask( int numriga, TMask& fullmask, bool destroy )
|
||||
{
|
||||
static TMask* m;
|
||||
static TRiga* r = NULL;
|
||||
static TMask* m = NULL;
|
||||
|
||||
if ( destroy )
|
||||
{
|
||||
delete m;
|
||||
delete r;
|
||||
r = NULL;
|
||||
return( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
TFilename nome_proriga( fullmask.get( 103 ) );
|
||||
nome_proriga.ext( "ini" );
|
||||
TConfig proriga( nome_proriga );
|
||||
m = new TMask( proriga.get( "MSK", "MAIN" ) );
|
||||
int numhandler = proriga.get_int( "NHANDLER", "HANDLERS" );
|
||||
for( int i = 1; i <= numhandler; i ++ )
|
||||
TSheet_field* ss = fullmask.get_sheet( );
|
||||
TToken_string& riga = ss->row( numriga );
|
||||
TString16 profilo( riga.get( FS_PROFRIGA - 101 ) );
|
||||
if ( profilo.blank( ) ) return &fullmask;
|
||||
if( r && ( r->profilo( ) == profilo ) )
|
||||
{
|
||||
TString chiave;
|
||||
chiave.format( "%d", i );
|
||||
TToken_string riga = proriga.get( chiave, "HANDLERS" );
|
||||
app().user_set_handler( riga.get_int( 0 ), riga.get_int( 1 ), m );
|
||||
};
|
||||
return( m );
|
||||
}
|
||||
if ( !r )
|
||||
r = new TRiga;
|
||||
r->load( riga );
|
||||
m = &(r->getmask( ));
|
||||
m->set_sheet( ss );
|
||||
return( m );
|
||||
}
|
||||
}
|
||||
|
||||
real TMotore_application::user_row_calculate( TRectype& r, int index )
|
||||
void TMotore_application::azzera_piedi( )
|
||||
{
|
||||
switch( index )
|
||||
{
|
||||
case 100:
|
||||
return( f100( r ) );
|
||||
break;
|
||||
case 200:
|
||||
return( f200( r ) );
|
||||
break;
|
||||
case 300:
|
||||
return( f300( r ) );
|
||||
break;
|
||||
case 400:
|
||||
return( f400( r ) );
|
||||
break;
|
||||
case 500:
|
||||
return( f500( r ) );
|
||||
break;
|
||||
case 600:
|
||||
return( f600( r ) );
|
||||
break;
|
||||
default:
|
||||
CHECK( FALSE, "Tentativo di chiamare una funzione di calcolo riga inesistente!" );
|
||||
return 0.0;
|
||||
_piede.destroy( );
|
||||
}
|
||||
};
|
||||
|
||||
void TMotore_application::user_set_handler( int fieldid, int index, TMask* m )
|
||||
{
|
||||
@ -320,9 +84,6 @@ void TMotore_application::user_set_handler( int fieldid, int index, TMask* m )
|
||||
case 1:
|
||||
m->set_handler( fieldid, ora_hndl );
|
||||
break;
|
||||
case 2:
|
||||
m->set_handler( fieldid, codcli_hndl );
|
||||
break;
|
||||
case 3:
|
||||
m->set_handler( fieldid, dummy_hndl );
|
||||
break;
|
||||
@ -330,102 +91,78 @@ void TMotore_application::user_set_handler( int fieldid, int index, TMask* m )
|
||||
CHECK( FALSE, "Tentativo di installare un handler non definito" );
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
|
||||
{
|
||||
static TRiga* riga;
|
||||
|
||||
if ( key == K_SPACE ) // Inizio modifica
|
||||
{
|
||||
app().azzera_piedi( TRUE );
|
||||
TRelation rdoc( LF_RIGHEDOC );
|
||||
ss.sheet_mask( ).autosave( &rdoc );
|
||||
// Mi calcolo nei piedi temporanei la riga
|
||||
app().calcola_riga( rdoc.curr( ), TRUE );
|
||||
TPiede_documento& piede = app( ).piede( );
|
||||
riga->edit_keys( key, piede );
|
||||
}
|
||||
if ( key == K_TAB ) // Mi posiziono su di una riga nello sheet
|
||||
{
|
||||
TRelation rdoc( LF_RIGHEDOC );
|
||||
TToken_string riga( ss.row( r ) );
|
||||
rdoc.curr( ).zero( );
|
||||
rdoc.curr( ).put( "CODNUM", app( ).edit_mask( ).get( F_CODNUM ) );
|
||||
rdoc.curr( ).put( "ANNO", app( ).edit_mask( ).get( F_ANNO ) );
|
||||
rdoc.curr( ).put( "PROVV", app( ).edit_mask( ).get( F_PROVV ) );
|
||||
rdoc.curr( ).put( "NDOC", app( ).edit_mask( ).get( F_NDOC ) );
|
||||
rdoc.curr( ).put( "NRIGA", riga.get( 1 ) );
|
||||
rdoc.read( );
|
||||
app( ).edit_mask( ).field( F_MEMORIGA ).autoload( &rdoc );
|
||||
if ( riga )
|
||||
delete riga;
|
||||
riga = new TRiga;
|
||||
riga->load( ss.row( r ) );
|
||||
}
|
||||
if ( key == K_TAB ) // Lascio una riga nello sheet
|
||||
if ( key == K_CTRL + K_TAB ) // Lascio una riga nello sheet
|
||||
{
|
||||
TRelation rdoc( LF_RIGHEDOC );
|
||||
TToken_string riga( ss.row( r ) );
|
||||
rdoc.curr( ).zero( );
|
||||
rdoc.curr( ).put( "CODNUM", app( ).edit_mask( ).get( F_CODNUM ) );
|
||||
rdoc.curr( ).put( "ANNO", app( ).edit_mask( ).get( F_ANNO ) );
|
||||
rdoc.curr( ).put( "PROVV", app( ).edit_mask( ).get( F_PROVV ) );
|
||||
rdoc.curr( ).put( "NDOC", app( ).edit_mask( ).get( F_NDOC ) );
|
||||
rdoc.curr( ).put( "NRIGA", riga.get( 1 ) );
|
||||
rdoc.read( );
|
||||
app( ).edit_mask( ).field( F_MEMORIGA ).autosave( &rdoc );
|
||||
rdoc.write( );
|
||||
// TRelation rdoc( LF_RIGHEDOC );
|
||||
// TToken_string riga( ss.row( r ) );
|
||||
// rdoc.curr( ).zero( );
|
||||
// rdoc.curr( ).put( "CODNUM", app( ).edit_mask( ).get( F_CODNUM ) );
|
||||
// rdoc.curr( ).put( "ANNO", app( ).edit_mask( ).get( F_ANNO ) );
|
||||
// rdoc.curr( ).put( "PROVV", app( ).edit_mask( ).get( F_PROVV ) );
|
||||
// rdoc.curr( ).put( "NDOC", app( ).edit_mask( ).get( F_NDOC ) );
|
||||
// rdoc.curr( ).put( "NRIGA", riga.get( 1 ) );
|
||||
// rdoc.read( );
|
||||
// app( ).edit_mask( ).field( F_MEMORIGA ).autosave( &rdoc );
|
||||
// rdoc.write( );
|
||||
}
|
||||
if ( key == K_INS ) // Inserimento
|
||||
{
|
||||
TMask& m = *app( )._msk1;
|
||||
TTable tabtr( "%TRI" );
|
||||
tabtr.zero( );
|
||||
tabtr.put( "CODTAB", m.get( F_LBTIPORIGA ) );
|
||||
tabtr.put( "CODTAB", app( ).edit_mask( ).get( F_LBTIPORIGA ) );
|
||||
tabtr.read( );
|
||||
TToken_string& riga = ss.row( r );
|
||||
riga.add( 1, 0 );
|
||||
riga.add( m.get( F_LBTIPORIGA ), 1 );
|
||||
riga.add( tabtr.get( "S4" ), 2 );
|
||||
TToken_string& tsr = ss.row( r );
|
||||
tsr.add( app( ).edit_mask( ).get( F_ANNO ), FS_ANNO - 101 );
|
||||
tsr.add( app( ).edit_mask( ).get( F_PROVV ), FS_PROVV - 101 );
|
||||
tsr.add( app( ).edit_mask( ).get( F_NDOC ), FS_NDOC - 101 );
|
||||
tsr.add( app( ).edit_mask( ).get( F_CODNUM ), FS_CODNUM - 101 );
|
||||
tsr.add( app( ).edit_mask( ).get( F_LBTIPORIGA ), FS_TIPORIGA - 101 );
|
||||
// tsr.add( app( ).edit_mask( ).get( F_PROFILO ), FS_PROFRIGA - 101 );
|
||||
tsr.add( tabtr.get( "S4" ), FS_PROFRIGA - 101 );
|
||||
if ( riga )
|
||||
delete riga;
|
||||
riga = new TRiga;
|
||||
riga->load( tsr );
|
||||
return TRUE;
|
||||
}
|
||||
if ( key == K_CTRL + K_INS ) // Dopo inserimento
|
||||
{
|
||||
TMask& m = *app( )._msk1;
|
||||
TTable tabtr( "%TRI" );
|
||||
tabtr.zero( );
|
||||
tabtr.put( "CODTAB", m.get( F_LBTIPORIGA ) );
|
||||
tabtr.read( );
|
||||
TToken_string& riga = ss.row( r );
|
||||
TFilename nome_proriga( tabtr.get( "S4" ) );
|
||||
nome_proriga.ext( "ini" );
|
||||
TConfig pro( nome_proriga );
|
||||
int ncols = pro.get_int( "NCOLS", "COLUMNS" );
|
||||
// Disabilita tutte le colonne
|
||||
for( int i = 1; i <= MAX_COLUMNS; i ++ )
|
||||
ss.disable_cell ( ss.items( ) - 1, i );
|
||||
// Abilita le colonne indicate nel profilo della riga
|
||||
for( i = 1; i <= ncols; i ++ )
|
||||
{
|
||||
TString16 chiave;
|
||||
chiave.format( "%d", i );
|
||||
int coltoenable = pro.get_int( chiave, "COLUMNS" );
|
||||
ss.enable_cell ( ss.items( ) - 1, coltoenable - 1 );
|
||||
};
|
||||
ss.force_update( );
|
||||
riga->configura_sheet( ss, r );
|
||||
app( ).curr_mask( ).send_key( K_ROWEDIT, F_SHEET );
|
||||
return TRUE;
|
||||
}
|
||||
if ( key == K_DEL ) // Cancellazione
|
||||
{
|
||||
// Sottraggo la riga appena cancellata ai totalizzatori
|
||||
app().sottrai_piedi( );
|
||||
app().carica_piedi( );
|
||||
TPiede_documento& piede = app( ).piede( );
|
||||
riga->edit_keys( key, piede );
|
||||
return TRUE;
|
||||
}
|
||||
if ( key == K_ENTER ) // Modifica
|
||||
{
|
||||
app().sottrai_piedi( );
|
||||
TRelation rdoc( LF_RIGHEDOC );
|
||||
ss.sheet_mask( ).autosave( &rdoc );
|
||||
// Sommo la riga ai totalizzatori
|
||||
app().calcola_riga( rdoc.curr( ) );
|
||||
app().sottrai_piedi( );
|
||||
TPiede_documento& piede = app( ).piede( );
|
||||
riga->edit_keys( key, piede );
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
};
|
||||
}
|
||||
|
||||
bool TMotore_application::num_handler( TMask_field& f, KEY key )
|
||||
{
|
||||
@ -479,7 +216,7 @@ bool TMotore_application::num_handler( TMask_field& f, KEY key )
|
||||
m.set( F_PROVV, "D" );
|
||||
// Disabilita il campo per la selezione della numerazione
|
||||
m.disable( F_PROVV );
|
||||
};
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
message_box( "Numerazione non valida!" );
|
||||
@ -498,6 +235,18 @@ bool TMotore_application::num_handler( TMask_field& f, KEY key )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TMotore_application::val_handler( TMask_field& f, KEY key )
|
||||
{
|
||||
// Ottengo la maschera
|
||||
TMask& m = f.mask( );
|
||||
|
||||
// m.set( F_CAMBIO, "" );
|
||||
// m.set( F_DATACAMBIO, "" );
|
||||
app( ).clifo( ).imposta_valuta( ( TMask_vendite& ) m );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TMotore_application::occas_handler( TMask_field& f, KEY key )
|
||||
{
|
||||
if ( key == K_SPACE && f.mask( ).is_running( ) )
|
||||
@ -552,12 +301,14 @@ bool TMotore_application::tip_handler(TMask_field& f, KEY key)
|
||||
if ( key == K_ENTER && m.is_running( ) )
|
||||
{ TString tipo( f.get( ) );
|
||||
if ( ! tipo.blank( ) )
|
||||
{ TTable tabtip( "%TIP" );
|
||||
{
|
||||
TTable tabtip( "%TIP" );
|
||||
tabtip.read( );
|
||||
m.set( F_PROFILO, tabtip.get( "S4" ) );
|
||||
}
|
||||
else
|
||||
{ message_box( "Occorre un tipo documento per inserire un documento!" );
|
||||
{
|
||||
message_box( "Occorre un tipo documento per inserire un documento!" );
|
||||
m.first_focus( F_TIPODOC );
|
||||
return FALSE;
|
||||
}
|
||||
@ -569,14 +320,16 @@ bool TMotore_application::ndoc_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask& m = f.mask( );
|
||||
if ( key == K_TAB && m.is_running( ) )
|
||||
{ TLocalisamfile& doc = app( ).rel( ).lfile( );
|
||||
{
|
||||
TLocalisamfile& doc = app( ).rel( ).lfile( );
|
||||
doc.zero( );
|
||||
doc.put( "CODNUM", m.get( F_CODNUM ) );
|
||||
doc.put( "PROVV", m.get( F_PROVV ) );
|
||||
doc.put( "ANNO", m.get( F_ANNO ) );
|
||||
doc.put( "NDOC", f.get( ) );
|
||||
if ( doc.read( ) == NOERR )
|
||||
{ m.set(F_TIPODOC, doc.get( "TIPODOC" ) );
|
||||
{
|
||||
m.set( F_TIPODOC, doc.get( "TIPODOC" ) );
|
||||
m.set( F_STATO, doc.get( "STATO" ) );
|
||||
TTable tabtip( "%TIP" );
|
||||
tabtip.put( "CODTAB", doc.get( "TIPODOC" ) );
|
||||
@ -630,45 +383,48 @@ bool TMotore_application::clifo_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
app( ).clifo( ).load( cf, atol( f.get( ) ), "" );
|
||||
app( ).clifo( ).update_mask( ( TMask_vendite& ) m );
|
||||
if( f.mask( ).id2pos( F_OCCASEDIT ) > 0 )
|
||||
{
|
||||
if ( app( ).clifo( ).occasionale( ) && app( ).clifo( ).occas_mask( ).get( O_CODICE ).empty( ) )
|
||||
m.send_key( K_SPACE, F_OCCASEDIT ); // Lancia maschera occasionali
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TMotore_application::azzera_piedi( bool temp )
|
||||
{
|
||||
for ( int i = 0; i < NPIEDI; i++ )
|
||||
if ( temp )
|
||||
_piedi_temp[ i ] = 0.0;
|
||||
else
|
||||
_piedi[ i ] = 0.0;
|
||||
}
|
||||
|
||||
void TMotore_application::carica_piedi( )
|
||||
{
|
||||
TToken_string s( pro( ).get( "PROGPIEDE", "MAIN" ) );
|
||||
int i = s.get_int( );
|
||||
int j = 0;
|
||||
while( i != 0 )
|
||||
TString s1 = s.get( );
|
||||
TTable ppd( "PPD" );
|
||||
while( !s1.blank( ) )
|
||||
{
|
||||
real strpiede( _piedi[ i ] );
|
||||
edit_mask( ).set( BASE_PIEDE + ( ++j ), strpiede.stringa( 15 ) );
|
||||
i = s.get_int( );
|
||||
ppd.zero( );
|
||||
ppd.put( "CODTAB", s1 );
|
||||
if( ppd.read( ) == NOERR )
|
||||
{
|
||||
real valpiede( "0.0" );
|
||||
if ( _piede.is_key( s1 ) )
|
||||
valpiede = ( real & )( _piede[ s1 ] );
|
||||
edit_mask( ).set( BASE_PIEDE + ppd.get_int( "I0" ), valpiede.stringa( 15 ) );
|
||||
}
|
||||
else
|
||||
message_box( "Piede non trovato( %s )", ( const char * )s1 );
|
||||
s1 = s.get( );
|
||||
}
|
||||
}
|
||||
|
||||
void TMotore_application::somma_piedi( )
|
||||
{
|
||||
for ( int i = 0; i < NPIEDI; i++ )
|
||||
_piedi[ i ] += _piedi_temp[ i ];
|
||||
/*for ( int i = 0; i < NPIEDI; i++ )
|
||||
_piedi[ i ] += _piedi_temp[ i ];*/
|
||||
}
|
||||
|
||||
void TMotore_application::sottrai_piedi( )
|
||||
{
|
||||
for ( int i = 0; i < NPIEDI; i++ )
|
||||
_piedi[ i ] -= _piedi_temp[ i ];
|
||||
/*for ( int i = 0; i < NPIEDI; i++ )
|
||||
_piedi[ i ] -= _piedi_temp[ i ];*/
|
||||
}
|
||||
|
||||
bool TMotore_application::changing_mask( int mode )
|
||||
@ -678,7 +434,6 @@ bool TMotore_application::changing_mask(int mode)
|
||||
const bool change = ( mode != lastmode );
|
||||
lastmode = mode;
|
||||
return change;
|
||||
|
||||
}
|
||||
|
||||
void TMotore_application::configura_sheet( TSheet_field& sheet, TConfig& config )
|
||||
@ -697,16 +452,15 @@ void TMotore_application::configura_sheet( TSheet_field& sheet, TConfig& config
|
||||
sheet.set_column_width( i, sheet_col.get_int( 2 ) );
|
||||
int coltomove = sheet_col.get_int( 0 ) - 1;
|
||||
sheet.move_column( coltomove, i );
|
||||
};
|
||||
}
|
||||
for ( int j = MAX_COLUMNS; j >= i - 1; j -- )
|
||||
sheet.delete_column( j );
|
||||
};
|
||||
}
|
||||
|
||||
void TMotore_application::get_edit_mask( void )
|
||||
void TMotore_application::get_edit_mask( const char * profilo )
|
||||
{
|
||||
TFilename fn;
|
||||
TFilename fn( profilo );
|
||||
|
||||
fn = query_mask( ).get( F_PROFILO );
|
||||
// query_mask( ).enable( DLG_NEWREC );
|
||||
fn.ext( "ini" );
|
||||
fn.upper( );
|
||||
@ -715,14 +469,14 @@ void TMotore_application::get_edit_mask( void )
|
||||
if ( ( *_proname ) == fn )
|
||||
return;
|
||||
delete _pro;
|
||||
};
|
||||
}
|
||||
_pro = new TConfig( fn );
|
||||
_proname = new TFilename( fn );
|
||||
_proname->upper( );
|
||||
if ( _msk1 ) delete _msk1;
|
||||
_msk1 = new TMask_vendite( pro( ).get( "MSKFILE", "MAIN" ) );
|
||||
// edit_mask( ).set( F_PROFILO, query_mask( ).get( F_PROFILO ) );
|
||||
edit_mask( ).set( F_DESNUM, query_mask( ).get( F_DESNUM ) );
|
||||
// edit_mask( ).set( F_DESNUM, query_mask( ).get( F_DESNUM ) );
|
||||
_sheet = &( TSheet_field& )edit_mask( ).field( F_SHEET );
|
||||
sheet( ).set_notify( ss_handler );
|
||||
TString tipocf( app( ).pro( ).get( "TIPOCF", "MAIN" ) );
|
||||
@ -759,28 +513,41 @@ void TMotore_application::get_edit_mask( void )
|
||||
chiave.format( "%d", i );
|
||||
TToken_string riga = pro( ).get( chiave, "HANDLERS" );
|
||||
user_set_handler( riga.get_int( 0 ), riga.get_int( 1 ) );
|
||||
};
|
||||
_msk1->set( F_MEMORIGA, "Riga1" );
|
||||
}
|
||||
// _msk1->set( F_MEMORIGA, "Riga1" );
|
||||
}
|
||||
|
||||
TMask* TMotore_application::get_mask( int mode )
|
||||
{
|
||||
TString profilo( query_mask( ).get( F_PROFILO ) );
|
||||
switch ( mode )
|
||||
{
|
||||
case MODE_INS:
|
||||
case MODE_MOD:
|
||||
get_edit_mask( );
|
||||
edit_mask( ).enable( DLG_PRINT, ( mode == MODE_MOD ) );
|
||||
if( !_msk )
|
||||
delete _msk;
|
||||
get_edit_mask( profilo );
|
||||
if ( edit_mask( ).id2pos( F_OCCASEDIT ) > 0 )
|
||||
edit_mask( ).set_handler( F_OCCASEDIT, occas_handler );
|
||||
if ( edit_mask( ).id2pos( F_CODVAL ) > 0 )
|
||||
edit_mask( ).set_handler( F_CODVAL, val_handler );
|
||||
edit_mask( ).set_handler( F_CODCF, clifo_handler );
|
||||
edit_mask( ).set_handler( F_CODPAG, condpag_hndl );
|
||||
edit_mask( ).set_handler( F_DATAINSC, condpag_hndl );
|
||||
return( _msk1 );
|
||||
break;
|
||||
default:
|
||||
if( !_msk )
|
||||
{
|
||||
_msk = new TMask( "ve1000a" );
|
||||
}
|
||||
if( !_msk1 )
|
||||
{
|
||||
delete _msk1;
|
||||
}
|
||||
return _msk;
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void TMotore_application::set_descr( int i, const char * dfi )
|
||||
@ -826,7 +593,7 @@ const char* TMotore_application::get_next_key( )
|
||||
else // Altrimenti ...
|
||||
{
|
||||
doc.put( "PROVV", "D" );
|
||||
};
|
||||
}
|
||||
if ( doc.read( _isgteq ) == NOERR )
|
||||
{
|
||||
doc.prev( );
|
||||
@ -835,7 +602,7 @@ const char* TMotore_application::get_next_key( )
|
||||
key.format( "%d|%d", F_NDOC, num + 1 );
|
||||
return key;
|
||||
}
|
||||
};
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -845,26 +612,33 @@ int TMotore_application::read(TMask& m)
|
||||
int err = TRelation_application::read( m );
|
||||
if ( err == NOERR )
|
||||
{
|
||||
TString16 tipocf( m.get( F_TIPOCF ) );
|
||||
clifo( ).load( tipocf[ 0 ], m.get_int( F_CODCF ), rel( ).curr( ).get( "OCFPI" ) );
|
||||
edit_mask( ).set( F_DESNUM, query_mask( ).get( F_DESNUM ) );
|
||||
edit_mask( ).set( F_DESTIPODOC, query_mask( ).get( F_DESTIPODOC ) );
|
||||
const char tipocf = m.get( F_TIPOCF )[ 0 ];
|
||||
clifo( ).load( tipocf, m.get_int( F_CODCF ), rel( ).curr( ).get( "OCFPI" ) );
|
||||
clifo( ).update_mask( ( TMask_vendite& ) m, TRUE );
|
||||
TLocalisamfile& rdoc = rel( ).lfile( LF_RIGHEDOC );
|
||||
TRectype r = rdoc.curr( );
|
||||
TRectype& trec = get_relation( )->curr( );
|
||||
r.zero( );
|
||||
r.put( "CODNUM", m.get( F_CODNUM ) );
|
||||
r.put( "PROVV", m.get( F_PROVV ) );
|
||||
r.put( "ANNO", m.get( F_ANNO ) );
|
||||
r.put( "NDOC", m.get_long( F_NDOC ) );
|
||||
r.put( "CODNUM", trec.get( "CODNUM" ) );
|
||||
r.put( "PROVV", trec.get( "PROVV" ) );
|
||||
r.put( "ANNO", trec.get( "ANNO" ) );
|
||||
r.put( "NDOC", trec.get_long( "NDOC" ) );
|
||||
_righe_rec->read( r );
|
||||
TSheet_field& f = ( TSheet_field& ) m.field( F_SHEET );
|
||||
f.destroy( );
|
||||
int last = _righe_rec->last_row( );
|
||||
TRiga currentrow;
|
||||
for ( int i = 1; i <= last; i ++ )
|
||||
{
|
||||
TRectype &rec = _righe_rec->row( i, TRUE );
|
||||
load_riga( f, i - 1, rec );
|
||||
calcola_riga( rec );
|
||||
};
|
||||
TToken_string& srow = f.row( i - 1 );
|
||||
TRectype& rec = _righe_rec->row( i, FALSE );
|
||||
currentrow.load( rec );
|
||||
currentrow.save( srow );
|
||||
currentrow.configura_sheet( f, i - 1 );
|
||||
currentrow.somma( _piede );
|
||||
}
|
||||
carica_piedi( );
|
||||
}
|
||||
return err;
|
||||
@ -883,9 +657,11 @@ int TMotore_application::write(const TMask& m)
|
||||
int err;
|
||||
if ( esegui_procedura( OP_NUOVO ) != NOERR )
|
||||
return FALSE;
|
||||
m.field( F_STATO ).set( _pro->get( "STATOFINALE", "INSERIMENTO" ) );
|
||||
err = NOERR; // avanza_numero( m.get_bool( F_PROVV ) );
|
||||
if ( err == NOERR )
|
||||
{
|
||||
if ( m.id2pos( F_OCCASEDIT) > 0 )
|
||||
err = app( ).clifo( ).write_occas( );
|
||||
}
|
||||
if ( err == NOERR )
|
||||
@ -907,13 +683,20 @@ int TMotore_application::write(const TMask& m)
|
||||
}
|
||||
}
|
||||
return err;
|
||||
};
|
||||
}
|
||||
|
||||
int TMotore_application::rewrite( const TMask& m )
|
||||
{
|
||||
int err = NOERR;
|
||||
if ( ! valida_operazione( OP_MODIFICA ) )
|
||||
return FALSE;
|
||||
int err = TRelation_application::rewrite( m );
|
||||
if ( err == NOERR )
|
||||
{
|
||||
err = app( ).clifo( ).write_occas( );
|
||||
}
|
||||
if ( err == NOERR )
|
||||
{
|
||||
err = TRelation_application::rewrite( m );
|
||||
if ( err == NOERR )
|
||||
{
|
||||
TSheet_field& f = ss( );
|
||||
@ -928,8 +711,9 @@ int TMotore_application::rewrite(const TMask& m)
|
||||
}
|
||||
err = _righe_rec->rewrite( );
|
||||
}
|
||||
}
|
||||
return err;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// La funzione si trova in ve0100b
|
||||
@ -945,7 +729,7 @@ long TMotore_application::prossimo_numero( bool provv )
|
||||
else
|
||||
ret = tabnum.get_long( "I1" ) + 1;
|
||||
return ( ret );
|
||||
};
|
||||
}
|
||||
|
||||
int TMotore_application::avanza_numero( bool provv )
|
||||
{
|
||||
@ -961,7 +745,7 @@ int TMotore_application::avanza_numero( bool provv )
|
||||
err = tabnum.rewrite( );
|
||||
}
|
||||
return err;
|
||||
};
|
||||
}
|
||||
|
||||
bool TMotore_application::remove( void )
|
||||
{
|
||||
@ -1015,59 +799,15 @@ void TMotore_application::load_riga( TSheet_field& f, int numrig, TRectype& r )
|
||||
|
||||
void TMotore_application::store_riga( TSheet_field& f, int numrig, TRectype& r )
|
||||
{
|
||||
TToken_string& riga = f.row(numrig);
|
||||
|
||||
r.put( "CODNUM", edit_mask( ).get( F_CODNUM ) );
|
||||
r.put( "ANNO", edit_mask( ).get( F_ANNO ) );
|
||||
r.put( "PROVV", edit_mask( ).get( F_PROVV ) );
|
||||
r.put( "NDOC", edit_mask( ).get_long( F_NDOC ) );
|
||||
r.put( "STATORIGA", riga.get( 0 ) );
|
||||
r.put( "TIPORIGA", riga.get( 1 ) );
|
||||
r.put( "PROFRIGA", riga.get( 2 ) );
|
||||
r.put( "CODMAG", riga.get( 3 ) );
|
||||
r.put( "CODART", riga.get( 4 ) );
|
||||
r.put( "DESCR", riga.get( 5 ) );
|
||||
r.put( "DESCLUNGA", riga.get( 6 ) );
|
||||
r.put( "PREZZO", riga.get( 7 ) );
|
||||
r.put( "UMQTA", riga.get( 8 ) );
|
||||
r.put( "QTA", riga.get( 9 ) );
|
||||
r.put( "QTAEVASA", riga.get( 10 ) );
|
||||
r.put( "RIGAEVASA", riga.get( 11 ) );
|
||||
r.put( "TARA", riga.get( 12 ) );
|
||||
TToken_string& rigastr = f.row( numrig );
|
||||
TRiga riga;
|
||||
riga.load( rigastr );
|
||||
riga.set_numero( numrig + 1 );
|
||||
riga.save( r );
|
||||
}
|
||||
|
||||
|
||||
void TMotore_application::calcola_riga( TRectype& r, bool temp )
|
||||
{
|
||||
TFilename proriganame( r.get("PROFRIGA") );
|
||||
proriganame.ext( "INI" );
|
||||
TConfig proriga( proriganame );
|
||||
TToken_string s(proriga.get("PROGPIEDE", "MAIN"));
|
||||
int func = s.get_int( );
|
||||
while( func )
|
||||
{
|
||||
if ( temp )
|
||||
_piedi_temp[ s.get_int( ) ] += user_row_calculate( r, func );
|
||||
else
|
||||
_piedi[ s.get_int( ) ] += user_row_calculate( r, func );
|
||||
func = s.get_int( );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TMotore_application::user_create( )
|
||||
{
|
||||
TSconto s;
|
||||
s.set( "12 - 23 + 12.2 +.5 ", TRUE );
|
||||
if( s.is_valid( ) )
|
||||
warning_box( "Sconto: %s( %s )", (const char *)s.get( ), (const char *)s.scontostr( ) );
|
||||
s.set( ".5-.5", TRUE );
|
||||
if( s.is_valid( ) )
|
||||
warning_box( "Sconto: %s( %s )", (const char *)s.get( ), (const char *)s.scontostr( ) );
|
||||
s.set( "12 - 2.3 + 12.2.1 +.5 ", TRUE );
|
||||
if( s.is_valid( ) )
|
||||
warning_box( "Sconto: %s( %s )", (const char *)s.get( ), (const char *)s.scontostr( ) );
|
||||
|
||||
TConfig ditta( CONFIG_DITTA );
|
||||
|
||||
// Controllo se sono cambiate le impostazioni delle vendite.
|
||||
@ -1144,7 +884,6 @@ int TMotore_application::esegui_procedura( int operazione )
|
||||
return ( NOERR );
|
||||
}
|
||||
|
||||
|
||||
bool TMotore_application::valida_operazione( int operazione )
|
||||
{
|
||||
if ( operazione != OP_NUOVO )
|
||||
@ -1154,8 +893,8 @@ bool TMotore_application::valida_operazione( int operazione )
|
||||
segnala_stato_non_valido( operazione );
|
||||
return FALSE;
|
||||
}
|
||||
};
|
||||
if ( esegui_procedura( operazione ) == NOERR )
|
||||
}
|
||||
if ( esegui_procedura( operazione ) != NOERR )
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
@ -1195,7 +934,7 @@ int TMotore_application::stato_finale( int operazione )
|
||||
TString s( pro( ).get( "STATOFINALE", nome_sezione( operazione ) ) );
|
||||
if ( strcmp( s, "N" ) == 0 ) return NO_CHANGE_STATUS;
|
||||
return ( atoi( s ) );
|
||||
};
|
||||
}
|
||||
|
||||
bool TMotore_application::stato_valido( int stato, int operazione )
|
||||
{
|
||||
@ -1206,9 +945,9 @@ bool TMotore_application::stato_valido( int stato, int operazione )
|
||||
TToken_string ret ( stati_validi( operazione ), ',' );
|
||||
p[0] += ( char )stato;
|
||||
return ( ret.get_pos( p ) != -1 );
|
||||
};
|
||||
}
|
||||
|
||||
void TMotore_application::setta_stato_corrente( int nuovostato )
|
||||
/*void TMotore_application::setta_stato_corrente( int nuovostato )
|
||||
{
|
||||
// warning_box( "Settaggio stati validi!\nStato corrente %s.\nStati validi %s.\nStato finale %s.", stato_corrente( ), stati_validi( operazione ), stato_finale( operazione ) );
|
||||
TString p;
|
||||
@ -1221,17 +960,18 @@ void TMotore_application::setta_stato_corrente( int nuovostato )
|
||||
doc.rewrite( );
|
||||
query_mask( ).set( F_STATO, p );
|
||||
// warning_box( "Settaggio stati validi!\nStato corrente %s.\nStati validi %s.\nStato finale %s.", stato_corrente( ), stati_validi( operazione ), stato_finale( operazione ) );
|
||||
}
|
||||
} */
|
||||
|
||||
int TMotore_application::stato_corrente( )
|
||||
{
|
||||
int i = query_mask( ).get_int( F_STATO );
|
||||
return ( i == 0 ? NO_DOC_STATUS : i );
|
||||
};
|
||||
}
|
||||
|
||||
void TMotore_application::segnala_stato_non_valido( int operazione )
|
||||
{
|
||||
TString messaggio;
|
||||
|
||||
switch( operazione )
|
||||
{
|
||||
case OP_NUOVO:
|
||||
@ -1255,10 +995,10 @@ void TMotore_application::segnala_stato_non_valido( int operazione )
|
||||
default:
|
||||
CHECK( FALSE, "Tentativo di segnalare stato non valido di una operazione non esistente!" );
|
||||
break;
|
||||
};
|
||||
}
|
||||
messaggio << "\nStato corrente :%d.\nStati validi :%s.";
|
||||
warning_box( messaggio, stato_corrente( ), ( const char * )stati_validi( operazione ) );
|
||||
};
|
||||
}
|
||||
|
||||
int ve0100( int argc, char** argv )
|
||||
{
|
||||
|
252
ve/ve0100.h
252
ve/ve0100.h
@ -1,4 +1,5 @@
|
||||
#define _VE0100_H
|
||||
#ifndef __VE0100_H
|
||||
#define __VE0100_H
|
||||
// Operazioni che può fare il motore su un documento
|
||||
|
||||
#define OP_NUOVO 1
|
||||
@ -16,3 +17,252 @@
|
||||
#define F_SHEET 500
|
||||
#define F_MEMORIGA 501
|
||||
#define BASE_PIEDE 600
|
||||
|
||||
#define CHANGE_MESSAGE "Sono state effettuate modifiche alla configurazione.\nPrima di eseguire la gestione documenti occorrerà rigenerare le maschere.\nDesideri farlo ora ?"
|
||||
|
||||
// Modifiche pianificate per il dopo/cattolica:
|
||||
// Rorganizzazione del codice come:
|
||||
// Oggetto documento
|
||||
// che contiene:
|
||||
// Array di oggetti riga
|
||||
// Oggetto Cliente
|
||||
// Oggetto Cambio
|
||||
// Oggetto Sconto testa
|
||||
|
||||
|
||||
#define F_LBTIPORIGA 175
|
||||
#define NPIEDI 40
|
||||
|
||||
|
||||
#include <xvt_defs.h>
|
||||
|
||||
#ifndef __CHECKS_H
|
||||
#include <checks.h>
|
||||
#endif
|
||||
|
||||
#ifndef __EXPR_H
|
||||
#include <expr.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TABUTIL_H
|
||||
#include <tabutil.h>
|
||||
#endif
|
||||
|
||||
#ifndef __BRWAPP_H
|
||||
#include <brwapp.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RELAPP_H
|
||||
#include <relapp.h>
|
||||
#endif
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef __LFFILES_H
|
||||
#include <lffiles.h>
|
||||
#endif
|
||||
|
||||
#ifndef __DEFMASK_H
|
||||
#include "defmask.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VEUML_H
|
||||
#include "veuml.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VEUML1_H
|
||||
#include "veuml1.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VEUML2_H
|
||||
#include "veuml2.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SHEET_H
|
||||
#include <sheet.h>
|
||||
#endif
|
||||
|
||||
#ifndef __REAL_H
|
||||
#include <real.h>
|
||||
#endif
|
||||
|
||||
#ifndef __MSKSHEET_H
|
||||
#include <msksheet.h>
|
||||
#endif
|
||||
|
||||
#ifndef __VE0100C_H
|
||||
#include "ve0100c.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VE0100D_H
|
||||
#include "ve0100d.h"
|
||||
#endif
|
||||
|
||||
#ifndef __TCLIFOR_H
|
||||
#include "tclifor.h"
|
||||
#endif
|
||||
|
||||
#ifndef __RIGHEDOC_H
|
||||
#include "righedoc.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VE1000O_H
|
||||
#include "ve1000o.h"
|
||||
#endif
|
||||
|
||||
#ifndef __TMASKVEN_H
|
||||
#include "tmaskven.h"
|
||||
#endif
|
||||
|
||||
#ifndef __EXECP_H
|
||||
#include "execp.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SCONTI_H
|
||||
#include "sconti.h"
|
||||
#endif
|
||||
|
||||
// Definizione della classe dell'applicazione motore
|
||||
class TMotore_application : public TRelation_application
|
||||
{
|
||||
// Array di totalizzatori
|
||||
TPiede_documento _piede;
|
||||
|
||||
// Record array per la gestione delle righe
|
||||
TRecord_array* _righe_rec;
|
||||
|
||||
// Puntatore al profilo del documento caricato
|
||||
TConfig* _pro;
|
||||
|
||||
// Puntatore al nome, per evitare di ricrearlo se è uguale
|
||||
TFilename* _proname;
|
||||
|
||||
// Puntatore alla maschera di ricerca
|
||||
TMask* _msk;
|
||||
|
||||
// Puntatore alla maschera di modifica/inserimento ( dipende dal profilo )
|
||||
TMask_vendite* _msk1;
|
||||
|
||||
// puntatore alla relazione
|
||||
TRelation* _rel;
|
||||
|
||||
// Puntatore allo sheet delle righe documento
|
||||
TSheet_field* _sheet;
|
||||
|
||||
// Oggetto cliente per il motore
|
||||
TCliForVendite* _clifor;
|
||||
|
||||
// Indica se il documento ha come soggetto un <C>liente o un <F>ornitore
|
||||
char _tipocf;
|
||||
|
||||
// Ridefinizione dei metodi virtuali
|
||||
virtual bool user_create( );
|
||||
virtual bool user_destroy( );
|
||||
virtual TMask* get_mask( int mode );
|
||||
virtual bool changing_mask( int mode );
|
||||
virtual TRelation* get_relation( ) const { return _rel;}
|
||||
virtual void init_insert_mode( TMask& m );
|
||||
virtual int read( TMask& m );
|
||||
virtual bool remove( void );
|
||||
virtual int write( const TMask& m );
|
||||
virtual int rewrite( const TMask& m );
|
||||
|
||||
// Punti di ingresso per le funzioni utente
|
||||
|
||||
// Funzioni da associare ad ogni procedura
|
||||
int user_function( int index );
|
||||
|
||||
// Funzioni per il calcolo delle righe
|
||||
real user_row_calculate( TRectype& row, int index );
|
||||
|
||||
void user_set_handler( int fieldid, int index, TMask* m = NULL );
|
||||
|
||||
long prossimo_numero( bool provv );
|
||||
int avanza_numero( bool provv );
|
||||
void get_edit_mask( const char * profilo );
|
||||
void azzera_piedi( );
|
||||
void carica_piedi( );
|
||||
void somma_piedi( );
|
||||
void sottrai_piedi( );
|
||||
|
||||
// Esegue, se c'è, la procedura utente relativa ad una certa operazione
|
||||
int esegui_procedura( int operazione );
|
||||
|
||||
protected:
|
||||
|
||||
// Procedure e funzioni per la gestione della maschera e dei files
|
||||
void read_rdoc( TMask& m );
|
||||
|
||||
// formato dipendente dallo sheet ( sono le varie colonne )
|
||||
void load_riga( TSheet_field& f, int numrig, TRectype& r );
|
||||
void store_riga( TSheet_field& f, int numrig, TRectype& r );
|
||||
|
||||
void save( TRelation* r ) const;
|
||||
void set_descr ( int numrig, const char* descr );
|
||||
void carica_righe_libere( int from = -1 );
|
||||
bool check_key( TLocalisamfile& rdoc, TString16 codnum, bool provv, TString16 _anno, TString16 _ndoc );
|
||||
|
||||
// Procedure e funzioni per la gestione degli stati
|
||||
// void setta_stato_corrente( int nuovostato );
|
||||
const char* nome_sezione( int op );
|
||||
int stato_corrente( );
|
||||
int stato_finale( int operazione );
|
||||
bool stato_valido( int stato, int operazione );
|
||||
void segnala_stato_non_valido( int operazione );
|
||||
TString& stati_validi( int operazione ){ return ( pro( ).get( "STATIVALIDI", nome_sezione( operazione ) ) );}
|
||||
|
||||
// Handle che ritorna la maschera per le righe
|
||||
static TMask * ss_getmask( int numriga, TMask& fullmask, bool destroy );
|
||||
|
||||
// Handler che gestisce la richiesta del tipo riga in inserimento
|
||||
static bool ss_handler( TSheet_field& ss, int r, KEY key );
|
||||
|
||||
// Handler per la maschera di ricerca
|
||||
static bool ndoc_handler( TMask_field& f, KEY key );
|
||||
static bool num_handler( TMask_field& f, KEY key );
|
||||
static bool tip_handler( TMask_field& f, KEY key );
|
||||
|
||||
// Handler per la maschera di modifica
|
||||
static bool clifo_handler( TMask_field& f, KEY key );
|
||||
static bool occas_handler( TMask_field& f, KEY key );
|
||||
static bool val_handler( TMask_field& f, KEY key );
|
||||
|
||||
// Configurazione dello sheet dato il profilo
|
||||
void configura_sheet( TSheet_field& sheet, TConfig& config );
|
||||
|
||||
// Funzione per la sostituzione delle variabili nella decodifica
|
||||
// delle espressioni di una riga
|
||||
void carica_variabile( TExpression& e, const char * varname, TRectype r );
|
||||
|
||||
public:
|
||||
|
||||
// Funzioni di accesso alle variabili private
|
||||
|
||||
TRecord_array& righe_rec( ) { CHECK( _righe_rec, "Record array delle righe nullo!" ); return * _righe_rec; }
|
||||
TConfig& pro( ) { CHECK( _pro, "Profilo del documento nullo!" ); return *_pro; }
|
||||
TFilename& proname( ) { CHECK( _proname, "Nome del profilo nullo!" ); return *_proname; }
|
||||
TMask& query_mask( ) { CHECK( _msk, "Maschera di ricerca nulla!" ); return *_msk; }
|
||||
TMask& edit_mask( ) { CHECK( _msk1, "Maschera di modifica nulla!" ); return *_msk1; }
|
||||
TRelation& rel( ) { CHECK( _rel, "Relazione nulla!" ); return *_rel; }
|
||||
TSheet_field& sheet( ) { CHECK( _sheet, "Sheet nullo!" ); return *_sheet; }
|
||||
TCliForVendite& clifo( ) { CHECK( _clifor, "Oggetto cliente nullo!" ); return *_clifor; }
|
||||
TPiede_documento& piede( ){ return _piede; }
|
||||
|
||||
// Operazione
|
||||
|
||||
const char tipocf( ){ return _tipocf; }
|
||||
void tipocf( const char tcf ){ _tipocf = tcf; }
|
||||
bool valida_operazione( int operazione );
|
||||
|
||||
TSheet_field& ss( ) const { return *_sheet; }
|
||||
TMotore_application( ) { _pro = NULL; }
|
||||
virtual ~TMotore_application( ) { if ( _pro ) delete _pro; }
|
||||
virtual const char* get_next_key( );
|
||||
|
||||
};
|
||||
|
||||
TMotore_application& app( );
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Handler di marco sui campi delle maschere
|
||||
// Handler di MarcoclaD sui campi delle maschere
|
||||
|
||||
#ifndef __CHECKS_H
|
||||
#include <checks.h>
|
||||
#endif
|
||||
@ -35,6 +36,10 @@
|
||||
#include "..\cg\pagament.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SCONTI_H
|
||||
#include "sconti.h"
|
||||
#endif
|
||||
|
||||
bool ora_hndl( TMask_field& field, KEY key )
|
||||
{
|
||||
if (key == K_TAB)
|
||||
@ -45,14 +50,14 @@ bool ora_hndl(TMask_field& field, KEY key)
|
||||
ora.trim( );
|
||||
if (ora.not_empty( ) || field.required( ) )
|
||||
{
|
||||
// bool changed = FALSE;
|
||||
if ( isdigit( ora[ 0 ] ) )
|
||||
{
|
||||
if ( ora[ 2 ] != ':')
|
||||
{
|
||||
if (ora.len()>4) ora.overwrite(":",2);
|
||||
else ora.insert(":", 2);
|
||||
// changed = TRUE;
|
||||
if ( ora.len( ) > 4 )
|
||||
ora.overwrite( ":", 2 );
|
||||
else
|
||||
ora.insert( ":", 2 );
|
||||
}
|
||||
}
|
||||
bool ok;
|
||||
@ -63,11 +68,9 @@ bool ora_hndl(TMask_field& field, KEY key)
|
||||
error_box("Ora errata o formato non valido");
|
||||
return FALSE;
|
||||
}
|
||||
else /* if (changed) */
|
||||
else
|
||||
{
|
||||
field.set((ora));
|
||||
// field.picture_data((ora),TRUE);
|
||||
// field.picture_data((ora.strip(":")),FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -75,35 +78,16 @@ bool ora_hndl(TMask_field& field, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool codcli_hndl(TMask_field& field, KEY key)
|
||||
{
|
||||
if (key == K_TAB)
|
||||
{
|
||||
if (field.to_check(key))
|
||||
{
|
||||
field.send_key(K_TAB,F_CODVAL);
|
||||
field.send_key(K_TAB,F_CODLIN);
|
||||
field.send_key(K_TAB,F_CODPAG);
|
||||
field.send_key(K_TAB,F_CODABIA);
|
||||
field.send_key(K_TAB,F_CODCABA);
|
||||
field.send_key(K_TAB,F_INDSP);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool dummy_hndl( TMask_field& field, KEY key )
|
||||
{
|
||||
warning_box( "Al campo %d è arrivato un KEY %d", field.dlg( ), key );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Handler per il calcolo delle date di pagamento
|
||||
bool condpag_hndl( TMask_field& field, KEY key )
|
||||
{
|
||||
|
||||
if ( key == K_TAB )
|
||||
{
|
||||
if (field.to_check(key))
|
||||
{
|
||||
TMask& m = field.mask( );
|
||||
TString16 condpag( m.get( F_CODPAG ) );
|
||||
@ -119,7 +103,26 @@ bool condpag_hndl(TMask_field& field, KEY key)
|
||||
for( ; i < 5; i ++ )
|
||||
m.hide( F_DATASCAD1 + i );
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// handler per la validazione di una stringa/sconto
|
||||
bool sconto_hndl( TMask_field& field, KEY key )
|
||||
{
|
||||
if ( field.to_check( key, TRUE ) )
|
||||
{
|
||||
if (key == K_TAB)
|
||||
{
|
||||
TSconto s;
|
||||
s.set( field.get( ), TRUE );
|
||||
if( s.is_valid( ) )
|
||||
{
|
||||
field.set( s.get( ) );
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <tabutil.h>
|
||||
#endif
|
||||
|
||||
#define SINTASSI "Sintassi: VE0 -2 [a|b|c|d|e]"
|
||||
#define SINTASSI "Sintassi: VE0 -2 -[1|2|3|4|5]"
|
||||
|
||||
class TConf_vendite : public TConfig_application
|
||||
{
|
||||
|
670
ve/ve0300.cpp
670
ve/ve0300.cpp
@ -15,6 +15,10 @@
|
||||
#include <checks.h>
|
||||
#endif
|
||||
|
||||
#ifndef __URLDEFID_H
|
||||
#include <urldefid.h>
|
||||
#endif
|
||||
|
||||
#ifndef __FSTREAM_H
|
||||
#include <fstream.h>
|
||||
#endif
|
||||
@ -51,10 +55,6 @@
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
#ifndef __VE0100_H
|
||||
#include "ve0100.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VEUML_H
|
||||
#include "veuml.h"
|
||||
#endif
|
||||
@ -71,6 +71,11 @@
|
||||
#include "veini.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VE0100_H
|
||||
#include "ve0100.h"
|
||||
#endif
|
||||
|
||||
|
||||
// Significato delle colonne nella tabella _tab0300b
|
||||
#define B_NOME 0
|
||||
#define B_MSKTYPE 1
|
||||
@ -86,13 +91,13 @@
|
||||
|
||||
|
||||
// Numero massimo di linee per pagina
|
||||
#define MAX_LINES_PER_PAGE 18
|
||||
#define MASK_FIRST_LINE 5
|
||||
|
||||
#define MAX_LINES_PER_PAGE 16
|
||||
#define MASK_FIRST_LINE 6
|
||||
#define GROUPKEY(x) format( "%5d", x )
|
||||
|
||||
class TMaschera : public TObject
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Linea corrente
|
||||
@ -115,7 +120,7 @@ public:
|
||||
void check( const int i );
|
||||
|
||||
// PAGE
|
||||
void pagina( const int i ){ _out << "PA \"Pagina " << i << "\" 11 60 14\n"; };
|
||||
void pagina( const int i, const TString& title = "Pagina " ){ _out << "PA \"" << title << " " << i << "\" 11 60 14\n"; };
|
||||
|
||||
// PROMPT
|
||||
void prompt( const int x, const int y, const TString& s = "" ){ _out << "PR " << x << " " << y << " \"" << s << "\"\n"; };
|
||||
@ -180,6 +185,107 @@ public:
|
||||
// File .MSK di output
|
||||
ofstream _out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TMask_generator
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Identificatore corrente per lo sheet
|
||||
int _curid;
|
||||
|
||||
// vero se il gruppo è aperto
|
||||
bool _groupopen;
|
||||
|
||||
// nome del file di .INI di input
|
||||
TFilename _proname;
|
||||
|
||||
// File .INI di riferimento per i campi
|
||||
TConfig _fieldsini;
|
||||
|
||||
// File .INI di riferimento per i gruppi
|
||||
TConfig _groupsini;
|
||||
|
||||
// File .INI di input
|
||||
TConfig* _pro;
|
||||
|
||||
TConfig _ditta;
|
||||
|
||||
// Tabelle per la generazione
|
||||
|
||||
// Campi dei documenti
|
||||
TString_array _fields;
|
||||
|
||||
// Campi dello sheet
|
||||
TString_array _tab0300b;
|
||||
|
||||
TAssoc_array _gruppi;
|
||||
|
||||
TMaschera *_m;
|
||||
|
||||
protected:
|
||||
|
||||
// Carica un file di tabella in un TString array
|
||||
void carica_tabella( const TFilename& fn, TString_array& tabella );
|
||||
|
||||
// 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 );
|
||||
|
||||
// Ritorna vero se una componente della maschera è presente
|
||||
int present( const int i, TToken_string line ){ const TString s = line.get( i ); return !(s.blank( )); };
|
||||
|
||||
// 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; };
|
||||
|
||||
|
||||
// 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 un campo dello sheet a partire da una linea del file VE0300B.DAT
|
||||
void genera_campo_sheet( 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:
|
||||
|
||||
|
||||
TMaschera& maschera( ){ return *_m; }
|
||||
|
||||
// Costruttore, vuole il nome del file .INI
|
||||
TMask_generator( const TString& profilo );
|
||||
|
||||
// Attiva la generazione della maschera
|
||||
void genera( const TString& );
|
||||
|
||||
// Genera l'intestazione di una pagina ( non la prima )
|
||||
void intestazione_pagina( );
|
||||
|
||||
TConfig& profilo( ){ return *_pro; }
|
||||
TConfig& ditta( ){ return _ditta; }
|
||||
TConfig& groupsini( ){ return _groupsini; }
|
||||
TConfig& fieldsini( ){ return _fieldsini; }
|
||||
|
||||
// Distruttore
|
||||
virtual ~TMask_generator( );
|
||||
|
||||
};
|
||||
|
||||
@ -197,7 +303,8 @@ void TMaschera::outline( const TString& s, const TString& prefix, const char sep
|
||||
if ( s.left( 1 ) == "@" )
|
||||
_out << "CO " << prefix << s.mid( 1 ) << "\n";
|
||||
else
|
||||
{ TToken_string u( s, sep );
|
||||
{
|
||||
TToken_string u( s, sep );
|
||||
for ( int i = 0; i < u.items( ); i ++ )
|
||||
_out << prefix << u.get( i ) << "\n";
|
||||
}
|
||||
@ -270,6 +377,8 @@ void TMaschera::item( const TString& str )
|
||||
}
|
||||
}
|
||||
|
||||
class TField;
|
||||
|
||||
class TGruppo : public TObject
|
||||
{
|
||||
protected:
|
||||
@ -277,31 +386,27 @@ protected:
|
||||
int _id;
|
||||
int _height;
|
||||
bool _present;
|
||||
TArray _fields;
|
||||
TMask_generator * _mg;
|
||||
|
||||
public:
|
||||
|
||||
TMaschera& maschera( ){ return generatore( ).maschera( ); }
|
||||
TMask_generator& generatore( ){ CHECK( _mg, "Generatore nullo!" ); return *_mg; }
|
||||
void generatore( TMask_generator& mg ){ _mg = &mg; }
|
||||
void id( int id ){ _id = id; }
|
||||
int id( ){ return _id; }
|
||||
void height( int h ){ _height = h; }
|
||||
int height( ){ return _height; }
|
||||
void present( bool p ){ _present = p; }
|
||||
bool present( ){ return _present; }
|
||||
TArray& campi( ){ return _fields; }
|
||||
|
||||
TGruppo ( int i );
|
||||
TGruppo ( int i, TConfig& pro );
|
||||
};
|
||||
TGruppo ( int i, int height );
|
||||
void genera( );
|
||||
void add( TField * field );
|
||||
|
||||
TGruppo::TGruppo( int i )
|
||||
{
|
||||
TConfig pro( "ve0300c.ini" );
|
||||
_id = i;
|
||||
_height = pro.get_int( "HEIGHT", format( "%d", i ) );
|
||||
};
|
||||
|
||||
TGruppo::TGruppo( int i, TConfig& pro )
|
||||
{
|
||||
_id = i;
|
||||
_height = pro.get_int( "HEIGHT", format( "%d", i ) );
|
||||
};
|
||||
|
||||
class TField : public TObject
|
||||
@ -309,6 +414,9 @@ class TField : public TObject
|
||||
protected:
|
||||
|
||||
TString _nome;
|
||||
// Gruppo di appartenenza
|
||||
TGruppo *_grp;
|
||||
|
||||
int _gruppo;
|
||||
int _id;
|
||||
int _type;
|
||||
@ -323,12 +431,13 @@ public:
|
||||
TField( TString& campo, TConfig& pro );
|
||||
TField( );
|
||||
|
||||
void genera( TMaschera& _m );
|
||||
void genera( );
|
||||
void configura( TConfig& pro );
|
||||
|
||||
void x( int x ){ _x = x; }
|
||||
void y( int y ){ _y = y; }
|
||||
void gruppo( int gruppo ){ _gruppo = gruppo; }
|
||||
void grp( TGruppo& grp ){ _grp = &grp; }
|
||||
void id( int id ){ _id = id; }
|
||||
void type( int type ){ _type = type; }
|
||||
void size( int size ){ _size = size; }
|
||||
@ -336,10 +445,12 @@ public:
|
||||
int x( ){ return _x; }
|
||||
int y( ){ return _y; }
|
||||
int gruppo( ){ return _gruppo; }
|
||||
TGruppo& grp( ) const { return *_grp; }
|
||||
int id( ){ return _id; }
|
||||
int type( ){ return _type; }
|
||||
int size( ){ return _size; }
|
||||
int stato( ){ return _stato; }
|
||||
int stato_reale( );
|
||||
|
||||
|
||||
void nome( TString& nome ){ _nome = nome; }
|
||||
@ -370,17 +481,78 @@ public:
|
||||
TToken_string& items( ){ return _items; }
|
||||
TToken_string& configs( ){ return _configs; }
|
||||
|
||||
TConfig& profilo( ) { return grp( ).generatore( ).profilo( ); }
|
||||
TConfig& ditta( ) { return grp( ).generatore( ).ditta( ); }
|
||||
TConfig& groupsini( ) { return grp( ).generatore( ).groupsini( ); }
|
||||
TConfig& fieldsini( ) { return grp( ).generatore( ).fieldsini( ); }
|
||||
|
||||
friend int sort_by_group(const TObject** o1, const TObject** o2 );
|
||||
// friend int TMask_generator::group( const TField& f1 );
|
||||
};
|
||||
|
||||
int sort_by_group(const TObject** o1, const TObject** o2 )
|
||||
void TGruppo::add( TField * field )
|
||||
{
|
||||
int g1 = ((TField * )( *o1 ))->_gruppo;
|
||||
int g2 = ((TField * )( *o2 ))->_gruppo;
|
||||
return ( g1 < g2 ) ? -1 : ( ( g1 = g2 ) ? 0 : 1 );
|
||||
};
|
||||
_fields.add( field );
|
||||
field->grp( *this );
|
||||
}
|
||||
|
||||
TGruppo::TGruppo( int i )
|
||||
{
|
||||
TConfig pro( "ve0300c.ini" );
|
||||
_id = i;
|
||||
_height = pro.get_int( "HEIGHT", format( "%d", i ) );
|
||||
}
|
||||
|
||||
TGruppo::TGruppo( int i, int height )
|
||||
{
|
||||
_id = i;
|
||||
_height = height;
|
||||
}
|
||||
|
||||
static void genera_campo( const TObject& campo )
|
||||
{
|
||||
// Per evitare 3000 casts ...
|
||||
TField& cmp = ( TField& )campo;
|
||||
|
||||
cmp.configura( cmp.grp( ).generatore( ).profilo( ) );
|
||||
cmp.genera( );
|
||||
}
|
||||
|
||||
static void verifica_campo( const TObject& campo )
|
||||
{
|
||||
// Per evitare 3000 casts ...
|
||||
TField& cmp = ( TField& )campo;
|
||||
|
||||
int stato = cmp.stato_reale( );
|
||||
cmp.stato( stato );
|
||||
if( cmp.stato( ) != S_NASCOSTO )
|
||||
cmp.grp( ).present( TRUE );
|
||||
}
|
||||
|
||||
static void genera_gruppo( const TObject& gruppo )
|
||||
{
|
||||
// Per evitare 3000 casts ...
|
||||
TGruppo& grp = ( TGruppo& )gruppo;
|
||||
|
||||
grp.present( FALSE );
|
||||
grp.campi( ).for_each( verifica_campo );
|
||||
if( grp.present( ) )
|
||||
grp.genera( );
|
||||
}
|
||||
|
||||
void TGruppo::genera( )
|
||||
{
|
||||
// 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 )
|
||||
{
|
||||
@ -451,6 +623,56 @@ TField::TField( )
|
||||
_items.separator( '@' );
|
||||
}
|
||||
|
||||
int TField::stato_reale( )
|
||||
{
|
||||
// Strategia al 28/08/95
|
||||
// Se il campo, nel file .INI di definizione dei campi, è legato a qualche voce in
|
||||
// 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.
|
||||
TToken_string config( fieldsini( ).get( "CONFIGS", _nome ) );
|
||||
TString reale;
|
||||
int items = config.items( );
|
||||
int stato = S_OBBLIGATORIO;
|
||||
for ( int i = 0; i < items; i += 3 )
|
||||
{ TString chiave = config.get( i );
|
||||
TString valore = config.get( i + 1 );
|
||||
TString reale = ditta( ).get( chiave, "ve" );
|
||||
int pos = chiave.find( '[' );
|
||||
if ( pos >= 0 )
|
||||
{
|
||||
TString index = chiave.sub( pos + 1, chiave.find( ']' ) );
|
||||
chiave = chiave.sub( 0, pos );
|
||||
reale = ditta( ).get( chiave, "ve", atoi( index ) );
|
||||
}
|
||||
else
|
||||
reale = ditta( ).get( chiave, "ve" );
|
||||
if ( reale == valore )
|
||||
stato = atoi( ( char * ) config.get( i + 2 ) );
|
||||
};
|
||||
TToken_string riga_profilo( grp( ).generatore( ).profilo( ).get( _nome, "PROFILO" ) );
|
||||
int stato_profilo = riga_profilo.get_int( P_STATO );
|
||||
stato = ( stato < stato_profilo )? stato : stato_profilo;
|
||||
TString gruppo ( fieldsini( ).get( "GROUP", _nome ) );
|
||||
gruppo.trim( );
|
||||
config = ( groupsini( ).get( "CONFIGS", gruppo ) );
|
||||
items = config.items( );
|
||||
int stato_gruppo = S_OBBLIGATORIO;
|
||||
for ( i = 0; i < items; i += 3 )
|
||||
{ TString chiave = config.get( i );
|
||||
TString valore = config.get( i + 1 );
|
||||
reale = ditta( ).get( chiave, "ve" );
|
||||
if ( reale == valore )
|
||||
stato_gruppo = atoi( ( char * ) config.get( i + 2 ) );
|
||||
};
|
||||
stato = ( stato < stato_gruppo )? stato : stato_gruppo;
|
||||
int stato_gruppo_profilo = grp( ).generatore( ).profilo( ).get_int( gruppo, "PROFILOGRUPPO" );
|
||||
stato = ( stato < stato_gruppo_profilo )? stato : stato_gruppo_profilo;
|
||||
return stato;
|
||||
}
|
||||
|
||||
void TField::configura( TConfig& pro )
|
||||
{
|
||||
TToken_string riga_profilo( pro.get( _nome, "PROFILO" ) );
|
||||
@ -465,8 +687,9 @@ void TField::configura( TConfig& pro )
|
||||
_warning = newwarning;
|
||||
}
|
||||
|
||||
void TField::genera( TMaschera& m )
|
||||
void TField::genera( )
|
||||
{
|
||||
TMaschera& m = grp( ).maschera( );
|
||||
TString s;
|
||||
|
||||
if ( _stato == S_NASCOSTO )
|
||||
@ -509,103 +732,7 @@ void TField::genera( TMaschera& m )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TMask_generator
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Identificatore corrente per lo sheet
|
||||
int _curid;
|
||||
|
||||
// vero se il gruppo è aperto
|
||||
bool _groupopen;
|
||||
|
||||
// nome del file di .INI di input
|
||||
TFilename _proname;
|
||||
|
||||
// File .INI di riferimento per i campi
|
||||
TConfig _fieldsini;
|
||||
|
||||
// File .INI di riferimento per i gruppi
|
||||
TConfig _groupsini;
|
||||
|
||||
// File .INI di input
|
||||
TConfig* _pro;
|
||||
|
||||
TConfig _ditta;
|
||||
|
||||
// Tabelle per la generazione
|
||||
|
||||
// Campi dei documenti
|
||||
TString_array _fields;
|
||||
|
||||
// Campi dello sheet
|
||||
TString_array _tab0300b;
|
||||
|
||||
TArray _campi;
|
||||
|
||||
protected:
|
||||
|
||||
// Carica un file di tabella in un TString array
|
||||
void carica_tabella( const TFilename& fn, TString_array& tabella );
|
||||
|
||||
// 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 );
|
||||
|
||||
// Ritorna vero se una componente della maschera è presente
|
||||
int present( const int i, TToken_string line ){ const TString s = line.get( i ); return !(s.blank( )); };
|
||||
|
||||
// Carica dati dei campi
|
||||
void carica_dati_campi( const TFilename& fn, TArray& 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; };
|
||||
|
||||
|
||||
// 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 un campo dello sheet a partire da una linea del file VE0300B.DAT
|
||||
void genera_campo_sheet( TToken_string _line );
|
||||
|
||||
|
||||
// Genera la colonna dello sheet a partire da una linea del file VE0300B.DAT
|
||||
void genera_item_sheet( TToken_string _line );
|
||||
|
||||
// Genera l'intestazione di una pagina ( non la prima )
|
||||
void intestazione_pagina( );
|
||||
|
||||
// Ritorna lo stato che dovrà avere il campo sulla maschera da generare
|
||||
int stato_del_campo( TString campo );
|
||||
|
||||
public:
|
||||
|
||||
TMaschera * _m;
|
||||
|
||||
// Costruttore, vuole il nome del file .INI
|
||||
TMask_generator( const TString& profilo );
|
||||
|
||||
// Attiva la generazione della maschera
|
||||
void genera( const TString& );
|
||||
|
||||
// Distruttore
|
||||
virtual ~TMask_generator( );
|
||||
|
||||
};
|
||||
|
||||
// Definizione dei metodi di TMask_generator
|
||||
// Definizione dei metodi di_generator
|
||||
// -----------------------------------------
|
||||
|
||||
TMask_generator::TMask_generator( const TString& profilo ) : _fieldsini( "ve0300a.ini" ), _groupsini( "ve0300c.ini" ), _ditta( CONFIG_DITTA )
|
||||
@ -614,20 +741,18 @@ TMask_generator::TMask_generator( const TString& profilo ) : _fieldsini( "ve0300
|
||||
_fieldsini.list_paragraphs( _fields );
|
||||
CHECK( fexist( "ve0300b.dat" ), "Il file ve0300b.dat non esiste!" );
|
||||
carica_tabella( "ve0300b.dat", _tab0300b );
|
||||
carica_dati_campi( "ve0300a.ini", _campi );
|
||||
carica_dati_campi( "ve0300a.ini", _gruppi );
|
||||
TString16 param( profilo );
|
||||
param.lower( );
|
||||
if( param == "-all" )
|
||||
{
|
||||
TRelation rel("TIP");
|
||||
TRelation rel("%TIP");
|
||||
TCursor t( &rel );
|
||||
long count = t.items( );
|
||||
TProgind bar( count, "Generazione delle maschere", FALSE, TRUE);
|
||||
t = 0;
|
||||
while( t.ok() )
|
||||
for( t = 0; t.pos( ) < count; ++t )
|
||||
{
|
||||
genera( t.curr( ).get( "S4" ) );
|
||||
++t;
|
||||
bar.addstatus(1);
|
||||
}
|
||||
}
|
||||
@ -639,12 +764,39 @@ TMask_generator::~TMask_generator( )
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
void TMask_generator::carica_dati_campi( const TFilename& fn, TArray& a )
|
||||
void TMask_generator::carica_ordine_gruppi( )
|
||||
{
|
||||
int last, i;
|
||||
last = _gruppi.items( );
|
||||
for( i = 1; i <= last; i ++ )
|
||||
{
|
||||
TString16 chiavepro, chiavegruppi;
|
||||
chiavepro.format( "%d", i );
|
||||
const int gruppo( _pro->get_int( chiavepro, "ORDINEGRUPPI" ) );
|
||||
chiavegruppo.format( "%5d", gruppo );
|
||||
( ( TGruppo& )_gruppi[ chiavegruppo ] ).ordine( i );
|
||||
}
|
||||
last = _pro->get( "NGRUPPI", "ORDINEGRUPPI" );
|
||||
for( i = 1; i <= last; i ++ )
|
||||
{
|
||||
TString16 chiavepro, chiavegruppi;
|
||||
chiavepro.format( "%d", i );
|
||||
const int gruppo( _pro->get_int( chiavepro, "ORDINEGRUPPI" ) );
|
||||
chiavegruppo.format( "%5d", gruppo );
|
||||
( ( TGruppo& )_gruppi[ chiavegruppo ] ).ordine( i );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
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( "" );
|
||||
|
||||
while ( infile.ok( ) )
|
||||
{
|
||||
@ -661,7 +813,23 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TArray& a )
|
||||
{
|
||||
line.strip( "[]" );
|
||||
if ( campo )
|
||||
a.add( campo );
|
||||
{
|
||||
TString16 fieldkey = GROUPKEY( campo->gruppo( ) );
|
||||
if ( fieldkey != curgruppo )
|
||||
{
|
||||
if ( gruppo )
|
||||
{
|
||||
a.add( curgruppo, gruppo );
|
||||
}
|
||||
TString16 taggruppo;
|
||||
taggruppo.format( "%d", campo->gruppo( ) );
|
||||
int hgruppo = _groupsini.get_int( "HEIGHT", taggruppo );
|
||||
gruppo = new TGruppo( campo->gruppo( ), hgruppo );
|
||||
gruppo->generatore( *this );
|
||||
}
|
||||
gruppo->add( campo );
|
||||
curgruppo = GROUPKEY( campo->gruppo( ) );
|
||||
}
|
||||
campo = new TField( );
|
||||
campo->nome( line );
|
||||
}
|
||||
@ -725,11 +893,28 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TArray& a )
|
||||
}
|
||||
}
|
||||
if ( campo )
|
||||
a.add( campo );
|
||||
{
|
||||
if( format( "%5d", campo->gruppo( ) ) != curgruppo )
|
||||
{
|
||||
if( gruppo )
|
||||
{
|
||||
a.add( curgruppo, gruppo );
|
||||
}
|
||||
TString16 taggruppo;
|
||||
taggruppo.format( "%d", campo->gruppo( ) );
|
||||
int hgruppo = _groupsini.get_int( "HEIGHT", taggruppo );
|
||||
gruppo = new TGruppo( campo->gruppo( ), hgruppo );
|
||||
gruppo->generatore( *this );
|
||||
}
|
||||
gruppo->add( campo );
|
||||
curgruppo = GROUPKEY( campo->gruppo( ) );
|
||||
a.add( curgruppo, gruppo );
|
||||
}
|
||||
}
|
||||
|
||||
void TMask_generator::carica_tabella( const TFilename& fn, TString_array& tabella )
|
||||
{ TScanner in( fn );
|
||||
{
|
||||
TScanner in( fn );
|
||||
TToken_string line = in.line( );
|
||||
while( line.not_empty( ) )
|
||||
{ // Attacca tutte le righe che finiscono con §
|
||||
@ -740,46 +925,6 @@ void TMask_generator::carica_tabella( const TFilename& fn, TString_array& tabell
|
||||
tabella.add( line );
|
||||
line = in.line( );
|
||||
}
|
||||
};
|
||||
|
||||
int TMask_generator::stato_del_campo( TString campo )
|
||||
{
|
||||
// Strategia al 28/08/95
|
||||
// Se il campo, nel file .INI di definizione dei campi, è legato a qualche voce in
|
||||
// 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 defiunizione dei gruppi.
|
||||
// Utilizza poi la minore delle due.
|
||||
TToken_string config( _fieldsini.get( "CONFIGS", campo ) );
|
||||
int items = config.items( );
|
||||
int stato = S_OBBLIGATORIO;
|
||||
for ( int i = 0; i < items; i += 3 )
|
||||
{ TString chiave = config[ i ];
|
||||
TString valore = config[ i + 1 ];
|
||||
TString reale = _ditta.get( chiave, "VE" );
|
||||
if ( reale == valore )
|
||||
stato = atoi( ( char * ) config[ i + 2 ] );
|
||||
};
|
||||
TToken_string riga_profilo( _pro->get( campo, "PROFILO" ) );
|
||||
int stato_profilo = riga_profilo.get_int( P_STATO );
|
||||
stato = ( stato < stato_profilo )? stato : stato_profilo;
|
||||
TString gruppo ( _fieldsini.get( "GROUP", campo ) );
|
||||
gruppo.trim( );
|
||||
config = ( _groupsini.get( "CONFIGS", gruppo ) );
|
||||
int stato_gruppo = S_OBBLIGATORIO;
|
||||
for ( i = 0; i < items; i += 3 )
|
||||
{ TString chiave = config[ i ];
|
||||
TString valore = config[ i + 1 ];
|
||||
TString reale = _ditta.get( chiave, "VE" );
|
||||
if ( reale == valore )
|
||||
stato_gruppo = atoi( ( char * ) config[ i + 2 ] );
|
||||
};
|
||||
stato = ( stato < stato_gruppo )? stato : stato_gruppo;
|
||||
int stato_gruppo_profilo = _pro->get_int( gruppo, "PROFILOGRUPPO" );
|
||||
stato = ( stato < stato_gruppo_profilo )? stato : stato_gruppo_profilo;
|
||||
return stato;
|
||||
|
||||
}
|
||||
|
||||
void TMask_generator::genera_campo_sheet( TToken_string _line )
|
||||
@ -801,82 +946,40 @@ void TMask_generator::genera_item_sheet( TToken_string _line )
|
||||
void TMask_generator::intestazione_pagina( )
|
||||
{
|
||||
_m->page( _m->page( ) + 1 );
|
||||
_m->pagina( _m->page( ) );
|
||||
_m->pagina( _m->page( ), _pro->get( "TYPE", "MAIN" ) );
|
||||
|
||||
_m->control( T_CORNICE, DLG_NULL, 7806 );
|
||||
_m->control( T_CORNICE, DLG_NULL, 7805 );
|
||||
_m->begin( );
|
||||
_m->prompt( 1, 0, "" );
|
||||
_m->end( );
|
||||
|
||||
_m->control( T_STRINGA, DLG_NULL, 4 );
|
||||
_m->begin();
|
||||
_m->prompt( 2, 1, "Cod. num. " );
|
||||
_m->group( 2 );
|
||||
_m->flag( "DUZ" );
|
||||
_m->end();
|
||||
|
||||
_m->control( T_STRINGA, DLG_NULL, 50 );
|
||||
_m->begin( );
|
||||
_m->prompt( 24, 1 );
|
||||
_m->flag( "DU" );
|
||||
_m->group( 3 );
|
||||
_m->end();
|
||||
|
||||
_m->control( T_STRINGA, DLG_NULL, 4 );
|
||||
_m->begin();
|
||||
_m->prompt( 2, 2, "Tipo doc. " );
|
||||
_m->flag( "DU" );
|
||||
_m->group( 4 );
|
||||
_m->end();
|
||||
|
||||
_m->control( T_STRINGA, DLG_NULL, 50 );
|
||||
_m->begin();
|
||||
_m->prompt( 24, 2 );
|
||||
_m->prompt( 2, 1, "Tipo doc. " );
|
||||
_m->flag( "DU" );
|
||||
_m->group( 5 );
|
||||
_m->end( );
|
||||
|
||||
_m->control( T_NUMERO, DLG_NULL, 6 );
|
||||
_m->begin( );
|
||||
_m->prompt( 2, 3, "Doc.: nr. " );
|
||||
_m->prompt( 2, 2, "Doc.: nr. " );
|
||||
_m->group( 6 );
|
||||
_m->flag( "D" );
|
||||
_m->end( );
|
||||
|
||||
_m->control( T_DATA );
|
||||
_m->begin( );
|
||||
_m->prompt( 24, 3, "Data " );
|
||||
_m->prompt( 24, 2 );
|
||||
_m->group( 7 );
|
||||
_m->flag( "D" );
|
||||
_m->end( );
|
||||
|
||||
_m->control( T_NUMERO, DLG_NULL, 1 );
|
||||
_m->begin();
|
||||
_m->prompt( 50, 3, "Stato " );
|
||||
_m->group( 8 );
|
||||
_m->flag( "D" );
|
||||
_m->end();
|
||||
|
||||
_m->control( T_STRINGA, DLG_NULL, 4 );
|
||||
_m->begin();
|
||||
_m->prompt( 66, 3, "Es. " );
|
||||
_m->flag( "D" );
|
||||
_m->group( 9 );
|
||||
_m->end();
|
||||
|
||||
_m->control( T_STRINGA, DLG_NULL, 6 );
|
||||
_m->begin();
|
||||
if ( _pro->get( "TIPOCF", "MAIN" ) == "C" )
|
||||
_m->prompt( 2, 4, "Cliente " );
|
||||
else
|
||||
_m->prompt( 2, 4, "Fornitore " );
|
||||
_m->flag( "D" );
|
||||
_m->group( 10 );
|
||||
_m->end();
|
||||
|
||||
_m->control( T_STRINGA, DLG_NULL, 50 );
|
||||
_m->begin( );
|
||||
_m->prompt( 24, 4, "" );
|
||||
if ( _pro->get( "TIPOCF", "MAIN" ) == "C" )
|
||||
_m->prompt( 2, 3, "Cliente " );
|
||||
else
|
||||
_m->prompt( 2, 3, "Fornitore " );
|
||||
_m->flag( "D" );
|
||||
_m->group( 11 );
|
||||
_m->end( );
|
||||
@ -885,7 +988,7 @@ void TMask_generator::intestazione_pagina( )
|
||||
|
||||
void TMask_generator::genera( const TString& profilo )
|
||||
{
|
||||
int i;
|
||||
int i, last;
|
||||
TString temp_s;
|
||||
TFilename proname( profilo ),
|
||||
// All'inizio il gruppo è 'chiuso'
|
||||
@ -903,6 +1006,8 @@ void TMask_generator::genera( const TString& profilo )
|
||||
TFilename _mskname( _pro->get( "MSKFILE", "MAIN") );
|
||||
_mskname.ext( "msk" );
|
||||
|
||||
// Mi serve per ordinare i gruppi a seconda del documento
|
||||
TAssoc_array grouporder;
|
||||
|
||||
_m = new TMaschera( _mskname );
|
||||
|
||||
@ -945,7 +1050,7 @@ void TMask_generator::genera( const TString& profilo )
|
||||
|
||||
// Header della prima pagina
|
||||
|
||||
_m->outline( "PA \"Pagina \" 11 60 14" );
|
||||
_m->pagina( _m->page( ), _pro->get( "TYPE", "MAIN" ) );
|
||||
|
||||
_m->control( T_CORNICE, DLG_NULL, 7806 );
|
||||
_m->begin( );
|
||||
@ -969,6 +1074,7 @@ void TMask_generator::genera( const TString& profilo )
|
||||
|
||||
_m->control( T_STRINGA, F_TIPODOC, 4 );
|
||||
_m->begin( );
|
||||
_m->field( "TIPODOC" );
|
||||
_m->prompt( 2, 2, "Tipo doc. " );
|
||||
_m->flag( "GDU" );
|
||||
_m->message( "CO,4@" );
|
||||
@ -988,7 +1094,6 @@ void TMask_generator::genera( const TString& profilo )
|
||||
_m->flag( "H" );
|
||||
_m->end( );
|
||||
|
||||
|
||||
_m->control( T_STRINGA, F_DESTIPODOC, 50 );
|
||||
_m->begin( );
|
||||
_m->prompt( 24, 2 );
|
||||
@ -1035,7 +1140,6 @@ void TMask_generator::genera( const TString& profilo )
|
||||
_m->prompt( 2, 4, "Cliente " );
|
||||
_m->warning( "Cliente assente" );
|
||||
_m->help( "Codice del cliente del documento" );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1063,7 +1167,6 @@ void TMask_generator::genera( const TString& profilo )
|
||||
{
|
||||
_m->warning( "Cliente assente" );
|
||||
_m->help( "Ragione sociale del cliente del documento" );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1082,15 +1185,36 @@ void TMask_generator::genera( const TString& profilo )
|
||||
_m->outline( "ADD RU cg0 -1 C" );
|
||||
_m->message( "CO,11@" );
|
||||
_m->end( );
|
||||
_m->line( MASK_FIRST_LINE );
|
||||
_m->line( MASK_FIRST_LINE + 1 );
|
||||
|
||||
_m->_pageopen = TRUE;
|
||||
|
||||
// Generazione
|
||||
|
||||
// Scorro l'array dei campi, per vedere gli stati ed i gruppi
|
||||
// carica_ordine_gruppi( );
|
||||
// Scorro l'array dei gruppi, e ne creo una copia ordinata
|
||||
// con solo i gruppi visibili
|
||||
|
||||
TAssoc_array gruppi;
|
||||
TArray sortedgroups;
|
||||
TString16 chiave, chiavegruppo;
|
||||
last = _pro->get_int( "NGROUPS", "ORDINEGRUPPI" );
|
||||
for( i = 1; i <= last; i ++ )
|
||||
{
|
||||
chiave.format( "%d", i );
|
||||
chiavegruppo.GROUPKEY( _pro->get_int( chiave, "ORDINEGRUPPI" ) );
|
||||
if( _gruppi.is_key( chiavegruppo ) )
|
||||
sortedgroups.add( &_gruppi[ (chiavegruppo) ] );
|
||||
}
|
||||
sortedgroups.for_each( genera_gruppo );
|
||||
if ( _m->_pageopen == TRUE )
|
||||
{
|
||||
_m->end( );
|
||||
intestazione_pagina( );
|
||||
}
|
||||
|
||||
int last = _campi.items( );
|
||||
/*
|
||||
|
||||
last = _campi.items( );
|
||||
for( i = 0; i < last; i ++ )
|
||||
{
|
||||
TString nome = (( TField & )_campi[ i ]).nome( );
|
||||
@ -1098,16 +1222,25 @@ void TMask_generator::genera( const TString& profilo )
|
||||
if( stato != S_NASCOSTO )
|
||||
{
|
||||
const int addgruppo = (( TField & )_campi[ i ]).gruppo( );
|
||||
const int ordine = 0; //ordine_del_gruppo( addgruppo );
|
||||
if( ordine )
|
||||
{
|
||||
TString16 chiave;
|
||||
chiave.format( "%5d", addgruppo );
|
||||
if ( !gruppi.is_key( chiave ) )
|
||||
gruppi.add( chiave, new TGruppo( addgruppo, _groupsini ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Se il gruppo non compare nell'elenco dei gruppi,
|
||||
stato = S_NASCOSTO;
|
||||
}
|
||||
}
|
||||
(( TField & )_campi[ i ]).stato( stato );
|
||||
// (( TField & )_campi[ i ]).ordine( ordine );
|
||||
};
|
||||
// Si ordinano a mano nel .INI per velocizzare il processo di generazione
|
||||
// campi.sort( sort_by_group );
|
||||
|
||||
_campi.sort( );
|
||||
// Generazione vera e propria
|
||||
_m->_pageopen = TRUE;
|
||||
last = _campi.items( );
|
||||
@ -1151,48 +1284,68 @@ void TMask_generator::genera( const TString& profilo )
|
||||
if ( _m->_pageopen == TRUE ) _m->end( );
|
||||
intestazione_pagina( );
|
||||
|
||||
*/
|
||||
|
||||
// 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->prompt( 2, 6, "Tipo riga da aggiungere " );
|
||||
_m->end( );
|
||||
|
||||
// Generazione dello sheet : vedi il profilo
|
||||
TScanner sheet_in( "ve0300b.dat" );
|
||||
_m->_out << "SPREADSHEET " << F_SHEET << " 76 6 \n";
|
||||
// _m->_out << "SPREADSHEET " << F_SHEET << " 76 10 \n";
|
||||
_m->begin( );
|
||||
_m->prompt( 2, 8 );
|
||||
_m->prompt( 2, 7 );
|
||||
for( i = 0; i < _tab0300b.items( ); i ++ )
|
||||
genera_item_sheet( _tab0300b.row( i ) );
|
||||
_m->end( );
|
||||
|
||||
// Campo memo per mostrare le righe
|
||||
_m->control( T_MEMO, F_MEMORIGA, 7604 );
|
||||
_m->begin( );
|
||||
_m->prompt( 2, 15, " " );
|
||||
_m->prompt( 2, 14, " " );
|
||||
_m->field( "34->DESCEST" );
|
||||
_m->flag( "D" );
|
||||
_m->end( );
|
||||
|
||||
|
||||
_m->end( );
|
||||
|
||||
// Generazione pagina dei piedi
|
||||
TToken_string s(_pro->get( "PROGPIEDE", "MAIN" ) );
|
||||
TTable tab( "PPD" );
|
||||
if ( s.not_empty( ) )
|
||||
{
|
||||
intestazione_pagina( );
|
||||
TString16 codpiede( s.get( ) );
|
||||
int cp = 1;
|
||||
int piede = s.get_int();;
|
||||
while ( piede != 0 )
|
||||
while ( !codpiede.empty( ) )
|
||||
{
|
||||
_m->control( T_NUMERO, BASE_PIEDE + cp, 1805 );
|
||||
tab.zero( );
|
||||
tab.put( "CODTAB", codpiede );
|
||||
if ( tab.read( ) == NOERR )
|
||||
{
|
||||
TString picture( tab.get( "S3" ) );
|
||||
_m->control( T_NUMERO, BASE_PIEDE + tab.get_int( "I0" ), 1805 );
|
||||
_m->begin( );
|
||||
TString header = _ditta.get( "PIEDE", "ve", piede );
|
||||
while( header.len() < 40 ) header << " ";
|
||||
TString header = tab.get( "S1" );
|
||||
header.trim( );
|
||||
while( header.len( ) < 40 - picture.len( ) )
|
||||
header << " ";
|
||||
_m->prompt( 2, 7 + cp, header );
|
||||
_m->flag( "D" );
|
||||
_m->end( );
|
||||
cp ++;
|
||||
piede = s.get_int();
|
||||
if( cp + MASK_FIRST_LINE > MAX_LINES_PER_PAGE )
|
||||
{
|
||||
_m->end( );
|
||||
intestazione_pagina( );
|
||||
_m->line( MASK_FIRST_LINE );
|
||||
cp = 1;
|
||||
}
|
||||
}
|
||||
codpiede = s.get( );
|
||||
}
|
||||
_m->end( );
|
||||
};
|
||||
@ -1224,23 +1377,24 @@ class TGenMask_application : public TApplication
|
||||
protected:
|
||||
|
||||
virtual bool create ( );
|
||||
virtual bool menu( MENU_TAG _m );
|
||||
virtual bool destroy( );
|
||||
// virtual bool menu( MENU_TAG ); // Controlla il menu
|
||||
|
||||
};
|
||||
|
||||
|
||||
bool TGenMask_application::menu(MENU_TAG _m)
|
||||
{
|
||||
TMask_generator a( argv( 2 ) );
|
||||
return( TRUE );
|
||||
};
|
||||
|
||||
bool TGenMask_application::create( )
|
||||
|
||||
{
|
||||
TApplication::create( );
|
||||
menu( 0 );
|
||||
TMask_generator a( argv( 2 ) );
|
||||
return FALSE;
|
||||
};
|
||||
}
|
||||
|
||||
bool TGenMask_application::destroy( )
|
||||
{
|
||||
return TApplication::destroy() ;
|
||||
}
|
||||
|
||||
int ve0300( int argc, char** argv )
|
||||
{
|
||||
|
@ -2,4 +2,3 @@
|
||||
#define F_D_CODCAT 112
|
||||
#define F_D_SCONTO 113
|
||||
#define F_D_DESCR 114
|
||||
|
@ -6,4 +6,3 @@
|
||||
#define F_R_DESART 126
|
||||
#define F_R_SCONTO 127
|
||||
#define F_R_DESCAT 128
|
||||
|
@ -100,8 +100,8 @@ bool TCondizioni_vendita::user_create() {
|
||||
DESTROY(F_L_DESSUCC);
|
||||
_codcon_codcf= prassid.get_bool("GESCONCC"); // setta il booleano di abilitazione di TIPOCF e CODCF
|
||||
if (!_codcon_codcf) { // disabilita i campi di gestione clienti/fornitori in base al flag. di config.
|
||||
KILL(F_R_C_TIPOCF);
|
||||
KILL(F_R_C_CODCF);
|
||||
KILL(F_C_TIPOCF);
|
||||
KILL(F_C_CODCF);
|
||||
}
|
||||
set_search_field(F_C_COD); // impostazione del campo di ricerca
|
||||
_gest_um= prassid.get_bool("GESUM", NULL, A_CONTRATTI); // setta il booleano di abilitazione delle unità di misura
|
||||
|
BIN
ve/vefields.wri
BIN
ve/vefields.wri
Binary file not shown.
@ -14,7 +14,7 @@
|
||||
#define F_RAGSOC 301
|
||||
#define F_INDCF 302
|
||||
#define F_CIVCF 303
|
||||
#define F_NOME_VAL 304
|
||||
#define F_RAGSOCSP 304
|
||||
#define F_DESCODPAG 305
|
||||
// I prossimi 5 campi devono essere consecutivi come numerazione
|
||||
// perchè faccio un ciclo per settarli
|
||||
@ -61,5 +61,4 @@
|
||||
#define F_STATOSP 346
|
||||
#define F_DESSTATOSP 347
|
||||
#define F_DESLIST 348
|
||||
#define F_RAGSOCSP 349
|
||||
#endif // __VEUML1_H
|
||||
|
52
ve/veuml2.h
52
ve/veuml2.h
@ -1,28 +1,34 @@
|
||||
#ifndef __SHEET_FIELDS
|
||||
#define __SHEET_FIELDS
|
||||
|
||||
#define FS_STATORIGA 101
|
||||
#define FS_TIPORIGA 102
|
||||
#define FS_PROFRIGA 103
|
||||
#define FS_CODMAG 104
|
||||
#define FS_CODART 105
|
||||
#define FS_DESCR 106
|
||||
#define FS_DESCLUNGA 107
|
||||
#define FS_PREZZO 108
|
||||
#define FS_UMQTA 109
|
||||
#define FS_QTA 110
|
||||
#define FS_QTAEVASA 111
|
||||
#define FS_RIGAEVASA 112
|
||||
#define FS_TARA 113
|
||||
#define FS_PNETTO 114
|
||||
#define FS_NCOLLI 115
|
||||
#define FS_DAEVADERE 116
|
||||
#define FS_SCONTO 117
|
||||
#define FS_PERCPROV 118
|
||||
#define FS_IMPFISSO 119
|
||||
#define FS_IMPFISUN 120
|
||||
#define FS_CODIVA 121
|
||||
#define FS_ADDIVA 122
|
||||
#define FS_ASPBENI 123
|
||||
#define FS_CODNUM 101
|
||||
#define FS_ANNO 102
|
||||
#define FS_PROVV 103
|
||||
#define FS_NDOC 104
|
||||
#define FS_STATORIGA 105
|
||||
#define FS_TIPORIGA 106
|
||||
#define FS_PROFRIGA 107
|
||||
#define FS_CODMAG 108
|
||||
#define FS_CODDEP 109
|
||||
#define FS_CODART 110
|
||||
#define FS_DESCR 111
|
||||
#define FS_DESCLUNGA 112
|
||||
#define FS_PREZZO 113
|
||||
#define FS_UMQTA 114
|
||||
#define FS_QTA 115
|
||||
#define FS_QTAEVASA 116
|
||||
#define FS_RIGAEVASA 117
|
||||
#define FS_TARA 118
|
||||
#define FS_PNETTO 119
|
||||
#define FS_NCOLLI 120
|
||||
#define FS_DAEVADERE 121
|
||||
#define FS_SCONTO 122
|
||||
#define FS_PERCPROV 123
|
||||
#define FS_IMPFISSO 124
|
||||
#define FS_IMPFISUN 125
|
||||
#define FS_CODIVA 126
|
||||
#define FS_ADDIVA 127
|
||||
#define FS_ASPBENI 128
|
||||
#define FS_G1 129
|
||||
|
||||
#endif // __SHEET_FIELDS
|
||||
|
Loading…
x
Reference in New Issue
Block a user