Continua il clamoroso lavoro di sviluppo della librerie delle vendite
git-svn-id: svn://10.65.10.50/trunk@3347 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a33589e81b
commit
5ca00d943d
@ -22,3 +22,5 @@
|
|||||||
#define F_DOC3 153
|
#define F_DOC3 153
|
||||||
#define F_DOC4 154
|
#define F_DOC4 154
|
||||||
#define F_DOC5 155
|
#define F_DOC5 155
|
||||||
|
#define F_ATTIVA_PROVVISORIO 160
|
||||||
|
#define F_PROVVISORIO 161
|
||||||
|
@ -231,7 +231,7 @@ BEGIN
|
|||||||
VALIDATE REQIF_FUNC 1 F_TIPODOC_I_5
|
VALIDATE REQIF_FUNC 1 F_TIPODOC_I_5
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 5
|
GROUPBOX DLG_NULL 78 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 12 "@bDocumento finale"
|
PROMPT 1 12 "@bDocumento finale"
|
||||||
END
|
END
|
||||||
@ -239,6 +239,7 @@ END
|
|||||||
STRING F_TIPODOC_F 4
|
STRING F_TIPODOC_F 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 13 "Tipo documento "
|
PROMPT 2 13 "Tipo documento "
|
||||||
|
FLAGS "U"
|
||||||
FIELD S8
|
FIELD S8
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
WARNING "E' necessario specificare un valore"
|
WARNING "E' necessario specificare un valore"
|
||||||
@ -260,16 +261,33 @@ END
|
|||||||
STRING F_CODNUM_F 4
|
STRING F_CODNUM_F 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 15 "Codice numerazione "
|
PROMPT 2 15 "Codice numerazione "
|
||||||
|
FLAGS "U"
|
||||||
FIELD S5
|
FIELD S5
|
||||||
USE NUM
|
USE NUM
|
||||||
INPUT CODTAB F_CODNUM_F
|
INPUT CODTAB F_CODNUM_F
|
||||||
DISPLAY "Codice" CODTAB
|
DISPLAY "Codice" CODTAB
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT F_CODNUM_F CODTAB
|
OUTPUT F_CODNUM_F CODTAB
|
||||||
|
OUTPUT F_ATTIVA_PROVVISORIO B0
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
WARNING "E' necessario specificare un codice di numerazione"
|
WARNING "E' necessario specificare un codice di numerazione"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_ATTIVA_PROVVISORIO
|
||||||
|
BEGIN
|
||||||
|
FLAGS "HG"
|
||||||
|
MESSAGE FALSE CLEAR,F_PROVVISORIO
|
||||||
|
MESSAGE TRUE ENABLE,F_PROVVISORIO
|
||||||
|
END
|
||||||
|
|
||||||
|
RADIOBUTTON F_PROVVISORIO 20
|
||||||
|
BEGIN
|
||||||
|
PROMPT 42 13 "Tipo numerazione"
|
||||||
|
ITEM "D|Definitiva"
|
||||||
|
ITEM "P|Provvisioria"
|
||||||
|
FIELD S6
|
||||||
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
12
ve/batbtip.h
12
ve/batbtip.h
@ -2,3 +2,15 @@
|
|||||||
#define F_DESNUM 102
|
#define F_DESNUM 102
|
||||||
#define F_PROFILO 103
|
#define F_PROFILO 103
|
||||||
#define F_PSTAMPA 104
|
#define F_PSTAMPA 104
|
||||||
|
#define F_CAMBIO 105
|
||||||
|
#define F_SCONTO 106
|
||||||
|
#define F_TIPODOC 107
|
||||||
|
#define F_CODNUM 108
|
||||||
|
#define F_CONDPAG 109
|
||||||
|
#define F_BANCA 110
|
||||||
|
#define F_LISTINO 111
|
||||||
|
#define F_AGENTE 112
|
||||||
|
#define F_SPEDIZIONE 113
|
||||||
|
#define F_PORTO 114
|
||||||
|
#define F_TRASPORTO 115
|
||||||
|
#define F_VETTORI 116
|
108
ve/batbtip.uml
108
ve/batbtip.uml
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
TOOLBAR "" 0 20 60 2
|
TOOLBAR "" 0 20 60 2
|
||||||
|
|
||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
@ -14,8 +14,8 @@ BEGIN
|
|||||||
FLAG "R"
|
FLAG "R"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_CODTAB 4
|
STRING F_CODTAB 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 2 "Cod. tipo docum. "
|
PROMPT 2 2 "Cod. tipo docum. "
|
||||||
FIELD CODTAB
|
FIELD CODTAB
|
||||||
HELP "Codice tipo documento"
|
HELP "Codice tipo documento"
|
||||||
@ -28,10 +28,10 @@ END
|
|||||||
OUTPUT F_DESNUM S0
|
OUTPUT F_DESNUM S0
|
||||||
KEY 1
|
KEY 1
|
||||||
FLAG "UZ"
|
FLAG "UZ"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_DESNUM 50
|
STRING F_DESNUM 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 4 "Descrizione "
|
PROMPT 2 4 "Descrizione "
|
||||||
FIELD S0
|
FIELD S0
|
||||||
HELP "Descrizione tipo documento"
|
HELP "Descrizione tipo documento"
|
||||||
@ -42,21 +42,99 @@ END
|
|||||||
DISPLAY "Codice" CODTAB
|
DISPLAY "Codice" CODTAB
|
||||||
COPY OUTPUT F_CODTAB
|
COPY OUTPUT F_CODTAB
|
||||||
KEY 2
|
KEY 2
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PROFILO 8
|
STRING F_PROFILO 8
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 8 "Profilo documento "
|
PROMPT 2 7 "Profilo documento "
|
||||||
FIELD S4
|
FIELD S4
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PSTAMPA 8
|
STRING F_PSTAMPA 8
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 10 "Profilo stampa documento "
|
PROMPT 2 9 "Profilo stampa documento "
|
||||||
FIELD S5
|
FIELD S5
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 75 8
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 11 "Condizioni per raggruppamento"
|
||||||
|
FLAG "R"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CAMBIO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 12 "Cambio"
|
||||||
|
FIELD S2[1,1]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_SCONTO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 13 "Sconto"
|
||||||
|
FIELD S2[2,2]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_TIPODOC
|
||||||
|
BEGIN
|
||||||
|
PROMP 2 14 "Tipo documento"
|
||||||
|
FIELD S2[3,3]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CODNUM
|
||||||
|
BEGIN
|
||||||
|
PROMP 2 15 "Codice numerazione"
|
||||||
|
FIELD S2[4,4]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_SPEDIZIONE
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 16 "Modalita' di spedizione"
|
||||||
|
FIELD S2[9,9]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PORTO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 17 "Porto"
|
||||||
|
FIELD S2[10,10]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CONDPAG
|
||||||
|
BEGIN
|
||||||
|
PROMP 40 12 "Condizione di pagamento"
|
||||||
|
FIELD S2[5,5]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_BANCA
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 13 "Banca di appoggio"
|
||||||
|
FIELD S2[6,6]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_LISTINO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 14 "Listino"
|
||||||
|
FIELD S2[7,7]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_AGENTE
|
||||||
|
BEGIN
|
||||||
|
PROMP 40 15 "Agente"
|
||||||
|
FIELD S2[8,8]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_TRASPORTO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 16 "Causale di trasporto"
|
||||||
|
FIELD S2[11,11]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_VETTORI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 17 "Vettore"
|
||||||
|
FIELD S2[12,12]
|
||||||
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
|
@ -1,19 +1,10 @@
|
|||||||
#ifndef __TCLIFOR_H
|
#ifndef __TCLIFOR_H
|
||||||
#define __TCLIFOR_H
|
#define __TCLIFOR_H
|
||||||
|
|
||||||
#ifndef __CHECKS_H
|
|
||||||
#include <checks.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __RELATION_H
|
#ifndef __RELATION_H
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __TABUTIL_H
|
|
||||||
#include <tabutil.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __VARMASK_H
|
#ifndef __VARMASK_H
|
||||||
#include <varmask.h>
|
#include <varmask.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,33 +2,6 @@
|
|||||||
#include "ve0100.h"
|
#include "ve0100.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TTipo_documento::TTipo_documento(const char * tipodoc)
|
|
||||||
: _tipodoc(tipodoc), _mask(NULL)
|
|
||||||
{
|
|
||||||
TTable t("%TIP");
|
|
||||||
|
|
||||||
t.zero();
|
|
||||||
t.put("CODTAB", _tipodoc);
|
|
||||||
if (t.bad())
|
|
||||||
fatal_box("Non esiste il tipo documento %s", _tipodoc);
|
|
||||||
_profile = t.get("S4");
|
|
||||||
_profile_file = _profile;
|
|
||||||
_profile_file.ext("ini");
|
|
||||||
|
|
||||||
TConfig * p = create_profile();
|
|
||||||
|
|
||||||
_mask = new TVariable_mask( p->get( "MSKFILE", "MAIN" ) );
|
|
||||||
|
|
||||||
delete p;
|
|
||||||
}
|
|
||||||
|
|
||||||
TTipo_documento::~TTipo_documento()
|
|
||||||
|
|
||||||
{
|
|
||||||
if (_mask != NULL)
|
|
||||||
delete _mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
TMotore_application& app( ) { return ( TMotore_application& ) main_app( ); }
|
TMotore_application& app( ) { return ( TMotore_application& ) main_app( ); }
|
||||||
|
|
||||||
void TMotore_application::init_query_mode( TMask& m )
|
void TMotore_application::init_query_mode( TMask& m )
|
||||||
|
26
ve/ve0100.h
26
ve/ve0100.h
@ -18,7 +18,7 @@
|
|||||||
#define F_MEMORIGA 501
|
#define F_MEMORIGA 501
|
||||||
#define BASE_PIEDE 600
|
#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 ?"
|
#define CHANGE_MESSAGE "Sono state effettuate modifiche alla configurazione.\nPrima di eseguire la gestione documenti occorre rigenerare le maschere.\nDesideri farlo ora ?"
|
||||||
|
|
||||||
// Modifiche pianificate per il dopo/cattolica:
|
// Modifiche pianificate per il dopo/cattolica:
|
||||||
// Rorganizzazione del codice come:
|
// Rorganizzazione del codice come:
|
||||||
@ -34,7 +34,7 @@
|
|||||||
#define NPIEDI 40
|
#define NPIEDI 40
|
||||||
|
|
||||||
|
|
||||||
#include <xvt_defs.h>
|
// #include <xvt_defs.h>
|
||||||
|
|
||||||
#ifndef __CHECKS_H
|
#ifndef __CHECKS_H
|
||||||
#include <checks.h>
|
#include <checks.h>
|
||||||
@ -124,25 +124,9 @@
|
|||||||
#include "sconti.h"
|
#include "sconti.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class TTipo_documento : public TObject
|
#ifndef __VELIB01_H
|
||||||
|
#include "velib01.h"
|
||||||
{
|
#endif
|
||||||
TString16 _tipodoc;
|
|
||||||
TString16 _profile;
|
|
||||||
TFilename _profile_file;
|
|
||||||
TMask * _mask;
|
|
||||||
protected:
|
|
||||||
const char * profile_name() {return _profile; }
|
|
||||||
const char * profile_file() {return _profile_file; }
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
const char * tipodoc() { return _tipodoc;}
|
|
||||||
TConfig * create_profile() { return new TConfig(_profile_file);}
|
|
||||||
TMask & mask() { return *_mask;}
|
|
||||||
TTipo_documento(const char * tipodoc);
|
|
||||||
virtual ~TTipo_documento();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Definizione della classe dell'applicazione motore
|
// Definizione della classe dell'applicazione motore
|
||||||
class TMotore_application : public TRelation_application
|
class TMotore_application : public TRelation_application
|
||||||
|
156
ve/velib01.cpp
156
ve/velib01.cpp
@ -1,23 +1,71 @@
|
|||||||
#include <clifo.h>
|
#include <clifo.h>
|
||||||
|
|
||||||
|
// Togliere quando si toglie il metodo mask()
|
||||||
|
#include <varmask.h>
|
||||||
|
|
||||||
|
#include <tabutil.h>
|
||||||
|
|
||||||
#include "velib01.h"
|
#include "velib01.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Tipo documento
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TTipo_documento::TTipo_documento(const char* tipodoc)
|
||||||
|
: _rec(LF_TABCOM), _mask(NULL)
|
||||||
|
{
|
||||||
|
if (tipodoc && *tipodoc)
|
||||||
|
read(tipodoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
TTipo_documento::TTipo_documento(const TRectype& rec)
|
||||||
|
: _rec(rec), _mask(NULL)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
TTipo_documento::~TTipo_documento()
|
||||||
|
{
|
||||||
|
if (_mask != NULL)
|
||||||
|
delete _mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TTipo_documento::read(const char* tipodoc)
|
||||||
|
{
|
||||||
|
TTable t("%TIP");
|
||||||
|
t.put("CODTAB", tipodoc);
|
||||||
|
int err = t.read();
|
||||||
|
if (err == NOERR)
|
||||||
|
_rec = t.curr();
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
TMask& TTipo_documento::mask()
|
||||||
|
{
|
||||||
|
if (_mask == NULL)
|
||||||
|
{
|
||||||
|
TFilename profile_file = _rec.get("S4");
|
||||||
|
profile_file.ext("ini");
|
||||||
|
TConfig p(profile_file);
|
||||||
|
_mask = new TVariable_mask(p.get("MSKFILE", "MAIN"));
|
||||||
|
}
|
||||||
|
return *_mask;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Documento per vendite
|
// Documento per vendite
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TDocumento_vendita::TDocumento_vendita()
|
TDocumento::TDocumento()
|
||||||
: _head(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
: _head(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TDocumento_vendita::TDocumento_vendita(const char* codnum, int anno, char provv, long numdoc)
|
TDocumento::TDocumento(const char* codnum, int anno, char provv, long numdoc)
|
||||||
: _head(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
: _head(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
||||||
{
|
{
|
||||||
read(codnum, anno, provv, numdoc);
|
read(codnum, anno, provv, numdoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TDocumento_vendita::read(const TRectype& rec)
|
int TDocumento::read(const TRectype& rec)
|
||||||
{
|
{
|
||||||
_head = rec; // Inizializza i campi chiave in ogni caso
|
_head = rec; // Inizializza i campi chiave in ogni caso
|
||||||
|
|
||||||
@ -36,7 +84,7 @@ int TDocumento_vendita::read(const TRectype& rec)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TDocumento_vendita::read(const char* codnum, int anno, char provv, long numdoc)
|
int TDocumento::read(const char* codnum, int anno, char provv, long numdoc)
|
||||||
{
|
{
|
||||||
CHECK(codnum && *codnum && anno > 0 && (provv == 'D' || provv == 'P') && numdoc > 0,
|
CHECK(codnum && *codnum && anno > 0 && (provv == 'D' || provv == 'P') && numdoc > 0,
|
||||||
"Codice documento non valido");
|
"Codice documento non valido");
|
||||||
@ -50,7 +98,7 @@ int TDocumento_vendita::read(const char* codnum, int anno, char provv, long numd
|
|||||||
return read(_head);
|
return read(_head);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TDocumento_vendita::write(bool re) const
|
int TDocumento::write(bool re) const
|
||||||
{
|
{
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
int err = re ? _head.rewrite(doc) : _head.write(doc);
|
int err = re ? _head.rewrite(doc) : _head.write(doc);
|
||||||
@ -61,7 +109,7 @@ int TDocumento_vendita::write(bool re) const
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TDocumento_vendita::remove() const
|
int TDocumento::remove() const
|
||||||
{
|
{
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
int err = _head.remove(doc);
|
int err = _head.remove(doc);
|
||||||
@ -70,11 +118,25 @@ int TDocumento_vendita::remove() const
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TTipo_documento& TDocumento::tipo() const
|
||||||
|
{
|
||||||
|
const char* tipodoc = _head.get("TIPODOC");
|
||||||
|
CHECK(*tipodoc, "Tipo documento nullo");
|
||||||
|
TTipo_documento* o = (TTipo_documento*)_tipi.objptr(tipodoc);
|
||||||
|
if (o == NULL)
|
||||||
|
{
|
||||||
|
o = new TTipo_documento(tipodoc);
|
||||||
|
_tipi.add(tipodoc, o);
|
||||||
|
}
|
||||||
|
return *o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Cliente per vendite
|
// Cliente/Fornitore per vendite
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void TLista_clienti::TCliente::init(const TRectype& rec)
|
void TLista_clifo::TClifo::init(const TRectype& rec)
|
||||||
{
|
{
|
||||||
CHECK(rec.num() == LF_CFVEN, "E' necessario un cliente per vendite");
|
CHECK(rec.num() == LF_CFVEN, "E' necessario un cliente per vendite");
|
||||||
_codice = rec.get_long(CLI_CODCF);
|
_codice = rec.get_long(CLI_CODCF);
|
||||||
@ -82,12 +144,12 @@ void TLista_clienti::TCliente::init(const TRectype& rec)
|
|||||||
_zona = rec.get_long(CLI_CODZONA);
|
_zona = rec.get_long(CLI_CODZONA);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TLista_clienti::TCliente::read(long cod)
|
bool TLista_clifo::TClifo::read(char tipo, long cod)
|
||||||
{
|
{
|
||||||
TRelation clifo(LF_CLIFO);
|
TRelation clifo(LF_CLIFO);
|
||||||
clifo.add(LF_CFVEN, "TIPOCF=TIPOCF|CODCF=CODCF");
|
clifo.add(LF_CFVEN, "TIPOCF=TIPOCF|CODCF=CODCF");
|
||||||
|
|
||||||
clifo.curr().put(CLI_TIPOCF, "C");
|
clifo.curr().put(CLI_TIPOCF, tipo);
|
||||||
clifo.curr().put(CLI_CODCF, cod);
|
clifo.curr().put(CLI_CODCF, cod);
|
||||||
if (clifo.read() == NOERR)
|
if (clifo.read() == NOERR)
|
||||||
init(clifo.curr(LF_CFVEN));
|
init(clifo.curr(LF_CFVEN));
|
||||||
@ -97,30 +159,30 @@ bool TLista_clienti::TCliente::read(long cod)
|
|||||||
return ok();
|
return ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
TLista_clienti::TCliente::TCliente(const TRectype& rec)
|
TLista_clifo::TClifo::TClifo(const TRectype& rec)
|
||||||
{
|
{
|
||||||
if (rec.num() == LF_CFVEN)
|
if (rec.num() == LF_CFVEN)
|
||||||
init(rec);
|
init(rec);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_codice = rec.get_long(CLI_CODCF);
|
const char tipo = rec.get_char(CLI_TIPOCF);
|
||||||
read(_codice);
|
const long codice = rec.get_long(CLI_CODCF);
|
||||||
|
read(tipo, codice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TLista_clienti::leggi(long dc, long ac, long da, long aa, long dz, long az)
|
int TLista_clifo::leggi(long dc, long ac, long da, long aa, long dz, long az)
|
||||||
{
|
{
|
||||||
TRelation clifo(LF_CLIFO);
|
TRelation clifo(LF_CLIFO);
|
||||||
clifo.add(LF_CFVEN, "TIPOCF=TIPOCF|CODCF=CODCF");
|
clifo.add(LF_CFVEN, "TIPOCF=TIPOCF|CODCF=CODCF");
|
||||||
|
|
||||||
TRectype start(LF_CLIFO), stop(LF_CLIFO);
|
TRectype start(LF_CLIFO), stop(LF_CLIFO);
|
||||||
|
|
||||||
start.put(CLI_TIPOCF, 'C');
|
start.put(CLI_TIPOCF, tipo());
|
||||||
stop.put(CLI_TIPOCF, 'C');
|
|
||||||
|
|
||||||
if (dc > 0)
|
if (dc > 0)
|
||||||
start.put(CLI_CODCF, dc);
|
start.put(CLI_CODCF, dc);
|
||||||
|
|
||||||
|
stop.put(CLI_TIPOCF, tipo());
|
||||||
if (ac > 0)
|
if (ac > 0)
|
||||||
stop.put(CLI_CODCF, ac);
|
stop.put(CLI_CODCF, ac);
|
||||||
|
|
||||||
@ -146,56 +208,74 @@ int TLista_clienti::leggi(long dc, long ac, long da, long aa, long dz, long az)
|
|||||||
TCursor cur(&clifo, filter, 1, &start, &stop);
|
TCursor cur(&clifo, filter, 1, &start, &stop);
|
||||||
for (cur = 0; cur.ok(); ++cur)
|
for (cur = 0; cur.ok(); ++cur)
|
||||||
{
|
{
|
||||||
TCliente* c = new TCliente(cur.curr(LF_CFVEN));
|
TClifo* c = new TClifo(cur.curr(LF_CFVEN));
|
||||||
_clienti.add(c);
|
_clifo.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dc > 0 || ac > 0) ordina_per_codice(); else
|
if (dc > 0 || ac > 0) ordina_per_codice(); else
|
||||||
if (da > 0 || aa > 0) ordina_per_agente(); else
|
if (da > 0 || aa > 0) ordina_per_agente(); else
|
||||||
if (dz > 0 || az > 0) ordina_per_zona();
|
if (dz > 0 || az > 0) ordina_per_zona();
|
||||||
|
|
||||||
return _clienti.items();
|
return _clifo.items();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TLista_clienti::sort_by_code(const TObject** o1, const TObject** o2)
|
int TLista_clifo::sort_by_code(const TObject** o1, const TObject** o2)
|
||||||
{
|
{
|
||||||
TLista_clienti::TCliente* c1 = (TLista_clienti::TCliente*)*o1;
|
TLista_clifo::TClifo* c1 = (TLista_clifo::TClifo*)*o1;
|
||||||
TLista_clienti::TCliente* c2 = (TLista_clienti::TCliente*)*o2;
|
TLista_clifo::TClifo* c2 = (TLista_clifo::TClifo*)*o2;
|
||||||
const long d = c1->codice() - c2->codice();
|
const long d = c1->codice() - c2->codice();
|
||||||
return d == 0L ? 0 : (d > 0 ? +1 : -1);
|
return d == 0L ? 0 : (d > 0 ? +1 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TLista_clienti::sort_by_agent(const TObject** o1, const TObject** o2)
|
int TLista_clifo::sort_by_agent(const TObject** o1, const TObject** o2)
|
||||||
{
|
{
|
||||||
TLista_clienti::TCliente* c1 = (TLista_clienti::TCliente*)*o1;
|
TLista_clifo::TClifo* c1 = (TLista_clifo::TClifo*)*o1;
|
||||||
TLista_clienti::TCliente* c2 = (TLista_clienti::TCliente*)*o2;
|
TLista_clifo::TClifo* c2 = (TLista_clifo::TClifo*)*o2;
|
||||||
const long d = c1->agente() - c2->agente();
|
const long d = c1->agente() - c2->agente();
|
||||||
return d == 0L ? 0 : (d > 0 ? +1 : -1);
|
return d == 0L ? 0 : (d > 0 ? +1 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TLista_clienti::sort_by_zone(const TObject** o1, const TObject** o2)
|
int TLista_clifo::sort_by_zone(const TObject** o1, const TObject** o2)
|
||||||
{
|
{
|
||||||
TLista_clienti::TCliente* c1 = (TLista_clienti::TCliente*)*o1;
|
TLista_clifo::TClifo* c1 = (TLista_clifo::TClifo*)*o1;
|
||||||
TLista_clienti::TCliente* c2 = (TLista_clienti::TCliente*)*o2;
|
TLista_clifo::TClifo* c2 = (TLista_clifo::TClifo*)*o2;
|
||||||
const long d = c1->zona() - c2->zona();
|
const long d = c1->zona() - c2->zona();
|
||||||
return d == 0L ? 0 : (d > 0 ? +1 : -1);
|
return d == 0L ? 0 : (d > 0 ? +1 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TLista_clienti::ordina_per_codice()
|
int TLista_clifo::ordina_per_codice()
|
||||||
{
|
{
|
||||||
_clienti.sort(sort_by_code);
|
_clifo.sort(sort_by_code);
|
||||||
return _clienti.items();
|
return _clifo.items();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TLista_clienti::ordina_per_agente()
|
int TLista_clifo::ordina_per_agente()
|
||||||
{
|
{
|
||||||
_clienti.sort(sort_by_agent);
|
_clifo.sort(sort_by_agent);
|
||||||
return _clienti.items();
|
return _clifo.items();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TLista_clienti::ordina_per_zona()
|
int TLista_clifo::ordina_per_zona()
|
||||||
{
|
{
|
||||||
_clienti.sort(sort_by_zone);
|
_clifo.sort(sort_by_zone);
|
||||||
return _clienti.items();
|
return _clifo.items();
|
||||||
|
}
|
||||||
|
|
||||||
|
int TLista_clifo::find(long cod) const
|
||||||
|
{
|
||||||
|
for (int i = items()-1; i >= 0; i--)
|
||||||
|
if (clifo(i).codice() == cod) break;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TLista_clifo::add(long cod)
|
||||||
|
{
|
||||||
|
int pos = find(cod);
|
||||||
|
if (pos < 0)
|
||||||
|
{
|
||||||
|
TClifo* c = new TClifo(tipo(), cod);
|
||||||
|
pos = _clifo.add(c);
|
||||||
|
}
|
||||||
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
83
ve/velib01.h
83
ve/velib01.h
@ -5,8 +5,39 @@
|
|||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class TDocumento_vendita : public TObject
|
class TMask;
|
||||||
|
|
||||||
|
class TTipo_documento : public TObject
|
||||||
{
|
{
|
||||||
|
TRectype _rec;
|
||||||
|
TMask* _mask;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int read(const char* tipodoc);
|
||||||
|
|
||||||
|
public:
|
||||||
|
TObject* dup() const { return new TTipo_documento(tipodoc()); }
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum TCondizione_uguaglianza
|
||||||
|
{ cambio, sconto, tipo_documento, numerazione,
|
||||||
|
pagamento, banca_appoggio, listino, agente,
|
||||||
|
spedizione, porto, causale_trasporto, vettori };
|
||||||
|
|
||||||
|
const TString& tipodoc() const { return _rec.get("CODTAB");}
|
||||||
|
TMask& mask();
|
||||||
|
|
||||||
|
bool uguale(TCondizione_uguaglianza u) const { return _rec.get("S2")[(int)u]; }
|
||||||
|
|
||||||
|
TTipo_documento(const char* tipodoc = NULL);
|
||||||
|
TTipo_documento(const TRectype& rec);
|
||||||
|
virtual ~TTipo_documento();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TDocumento : public TObject
|
||||||
|
{
|
||||||
|
static TAssoc_array _tipi;
|
||||||
|
|
||||||
TRectype _head; // Record di testata
|
TRectype _head; // Record di testata
|
||||||
TRecord_array _rows; // Array di TRectype per le righe documenti di vendita.
|
TRecord_array _rows; // Array di TRectype per le righe documenti di vendita.
|
||||||
|
|
||||||
@ -25,14 +56,18 @@ public:
|
|||||||
int rewrite() const { return write(TRUE); }
|
int rewrite() const { return write(TRUE); }
|
||||||
int remove() const;
|
int remove() const;
|
||||||
|
|
||||||
TDocumento_vendita ();
|
const TTipo_documento& tipo() const;
|
||||||
TDocumento_vendita(const char* codnum, int anno, char provv, long numdoc);
|
const TDate& data() const { return _head.get_date("DATADOC"); }
|
||||||
virtual ~TDocumento_vendita() { }
|
long numero() const { return _head.get_long("NDOC"); }
|
||||||
|
|
||||||
|
TDocumento ();
|
||||||
|
TDocumento(const char* codnum, int anno, char provv, long numdoc);
|
||||||
|
virtual ~TDocumento() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TLista_clienti : public TObject
|
class TLista_clifo : public TObject
|
||||||
{
|
{
|
||||||
class TCliente : public TObject
|
class TClifo : public TObject
|
||||||
{
|
{
|
||||||
long _codice;
|
long _codice;
|
||||||
long _agente;
|
long _agente;
|
||||||
@ -41,7 +76,7 @@ class TLista_clienti : public TObject
|
|||||||
protected:
|
protected:
|
||||||
void zero() { _codice = _agente = _zona = 0L; }
|
void zero() { _codice = _agente = _zona = 0L; }
|
||||||
void init(const TRectype& rec);
|
void init(const TRectype& rec);
|
||||||
bool read(long cod);
|
bool read(char tipo, long cod);
|
||||||
|
|
||||||
public: // TObject
|
public: // TObject
|
||||||
virtual bool ok() const { return _codice > 0; }
|
virtual bool ok() const { return _codice > 0; }
|
||||||
@ -51,16 +86,17 @@ class TLista_clienti : public TObject
|
|||||||
long agente() const { return _agente; }
|
long agente() const { return _agente; }
|
||||||
long zona() const { return _zona; }
|
long zona() const { return _zona; }
|
||||||
|
|
||||||
TCliente() { zero(); }
|
TClifo() { zero(); }
|
||||||
TCliente(long cod) { read(cod); }
|
TClifo(char tipo, long cod) { read(tipo, cod); }
|
||||||
TCliente(const TRectype& rec);
|
TClifo(const TRectype& rec);
|
||||||
virtual ~TCliente() { }
|
virtual ~TClifo() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
TArray _clienti;
|
TArray _clifo;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const TCliente& cliente(int n) const { return (TCliente&)_clienti[n]; }
|
virtual char tipo() const pure;
|
||||||
|
const TClifo& clifo(int n) const { return (TClifo&)_clifo[n]; }
|
||||||
|
|
||||||
static int sort_by_code(const TObject** o1, const TObject** o2);
|
static int sort_by_code(const TObject** o1, const TObject** o2);
|
||||||
static int sort_by_agent(const TObject** o1, const TObject** o2);
|
static int sort_by_agent(const TObject** o1, const TObject** o2);
|
||||||
@ -73,10 +109,25 @@ public:
|
|||||||
|
|
||||||
int leggi(long dc, long ac, long da = 0, long aa = 0, long dz = 0, long az = 0);
|
int leggi(long dc, long ac, long da = 0, long aa = 0, long dz = 0, long az = 0);
|
||||||
|
|
||||||
long operator[] (int n) const { return cliente(n).codice(); }
|
long operator[] (int n) const { return clifo(n).codice(); }
|
||||||
|
int items() const { return _clifo.items(); }
|
||||||
|
int find(long cod) const;
|
||||||
|
int add(long cod);
|
||||||
|
|
||||||
TLista_clienti() { }
|
TLista_clifo() { }
|
||||||
virtual ~TLista_clienti() { }
|
virtual ~TLista_clifo() { }
|
||||||
|
};
|
||||||
|
|
||||||
|
class TLista_clienti : public TLista_clifo
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
virtual char tipo() const { return 'C'; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class TLista_fornitori : public TLista_clifo
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
virtual char tipo() const { return 'F'; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user