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
217
ve/sconti.cpp
217
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
|
||||
@ -96,11 +118,11 @@ void TSconto::set( const TString& exp, bool signal )
|
||||
// Assegna la nuova espressione formattata bene
|
||||
_exp = goodexp;
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
// Azzera la sequenza di percentuali
|
||||
_part = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
real TSconto::sconto( )
|
||||
@ -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" ) );
|
||||
}
|
||||
}
|
||||
|
11
ve/tclifor.h
11
ve/tclifor.h
@ -37,17 +37,17 @@ public:
|
||||
|
||||
class TCliFor : public TData_picker
|
||||
{
|
||||
private:
|
||||
private:
|
||||
|
||||
bool _occas;
|
||||
TMask _occas_mask;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
char _tipocf;
|
||||
long _codcf;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
TCliFor( );
|
||||
void load( const char tipocf, const long codcf, const TString& ocfpi );
|
||||
@ -56,15 +56,18 @@ 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
|
||||
{
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
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 );
|
||||
|
||||
|
868
ve/ve0100.cpp
868
ve/ve0100.cpp
File diff suppressed because it is too large
Load Diff
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,39 +36,41 @@
|
||||
#include "..\cg\pagament.h"
|
||||
#endif
|
||||
|
||||
bool ora_hndl(TMask_field& field, KEY key)
|
||||
#ifndef __SCONTI_H
|
||||
#include "sconti.h"
|
||||
#endif
|
||||
|
||||
bool ora_hndl( TMask_field& field, KEY key )
|
||||
{
|
||||
if (key == K_TAB)
|
||||
{
|
||||
if (field.to_check(key))
|
||||
{
|
||||
TFixed_string ora(field.get(),6);
|
||||
ora.trim();
|
||||
if (ora.not_empty() || field.required())
|
||||
TFixed_string ora( field.get( ), 6 );
|
||||
ora.trim( );
|
||||
if (ora.not_empty( ) || field.required( ) )
|
||||
{
|
||||
// bool changed = FALSE;
|
||||
if (isdigit(ora[0]))
|
||||
if ( isdigit( ora[ 0 ] ) )
|
||||
{
|
||||
if (ora[2] != ':')
|
||||
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;
|
||||
ok = ((isdigit(ora[0]))&&(isdigit(ora[1]))&&(isdigit(ora[3]))&&(isdigit(ora[4])));
|
||||
ok &= ((atoi(&(ora[0]))<24)&&(atoi(&(ora[3]))<60));
|
||||
if (!ok)
|
||||
if ( !ok )
|
||||
{
|
||||
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)
|
||||
bool dummy_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);
|
||||
}
|
||||
}
|
||||
warning_box( "Al campo %d è arrivato un KEY %d", field.dlg( ), key );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool dummy_hndl(TMask_field& field, KEY key)
|
||||
// Handler per il calcolo delle date di pagamento
|
||||
bool condpag_hndl( TMask_field& field, KEY key )
|
||||
{
|
||||
warning_box("Al campo %d è arrivato un KEY %d",field.dlg(),key);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool condpag_hndl(TMask_field& field, KEY key)
|
||||
{
|
||||
|
||||
if (key == K_TAB)
|
||||
{
|
||||
if (field.to_check(key))
|
||||
if ( key == K_TAB )
|
||||
{
|
||||
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,15 +16,15 @@
|
||||
#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
|
||||
{
|
||||
private:
|
||||
private:
|
||||
|
||||
bool _changed;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
virtual bool preprocess_config (TMask& mask, TConfig& config);
|
||||
virtual bool postprocess_config_changed (const char* par, const char* var,
|
||||
|
806
ve/ve0300.cpp
806
ve/ve0300.cpp
File diff suppressed because it is too large
Load Diff
@ -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