This commit was manufactured by cvs2svn to create branch 'R_10_00'.
git-svn-id: svn://10.65.10.50/branches/R_10_00@20818 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1857dd25ac
commit
8a955d8180
20
ba/bainst46.cpp
Executable file
20
ba/bainst46.cpp
Executable file
@ -0,0 +1,20 @@
|
||||
#include <modaut.h>
|
||||
|
||||
#include "bainstlib.h"
|
||||
|
||||
class TInstall_HA : public TInstallmodule_app
|
||||
{
|
||||
|
||||
protected:
|
||||
virtual int module_number() const { return HAAUT; }
|
||||
|
||||
public:
|
||||
virtual ~TInstall_HA () {}
|
||||
};
|
||||
|
||||
int bainst46(int argc, char** argv)
|
||||
{
|
||||
TInstall_HA app;
|
||||
app.run(argc, argv);
|
||||
return 0;
|
||||
}
|
30
ha/ha0.cpp
Executable file
30
ha/ha0.cpp
Executable file
@ -0,0 +1,30 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#include "ha0.h"
|
||||
|
||||
#define usage "Error - usage : %s -{1|2|3|4}"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
|
||||
{
|
||||
int rt = -1 ;
|
||||
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 1:
|
||||
rt = ha0200(argc, argv) ; break; //configurazione modulo Hardy
|
||||
break;
|
||||
case 2:
|
||||
rt = ha0300(argc, argv) ; break; //gestione documenti premio (contratti premio)
|
||||
break;
|
||||
//case 3:
|
||||
//rt = ha0400(argc,argv) ; break; //contabilizzazione contratti premio Hardy
|
||||
case 4:
|
||||
rt = ha0500(argc,argv) ; break; //elaborazione documenti Hardy
|
||||
default:
|
||||
error_box(usage, argv[0]) ; break;
|
||||
}
|
||||
return rt;
|
||||
}
|
4
ha/ha0.h
Executable file
4
ha/ha0.h
Executable file
@ -0,0 +1,4 @@
|
||||
int ha0200(int argc, char* argv[]);
|
||||
int ha0300(int argc, char* argv[]);
|
||||
//int ha0400(int argc, char* argv[]);
|
||||
int ha0500(int argc, char* argv[]);
|
BIN
ha/ha01.gif
Executable file
BIN
ha/ha01.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
98
ha/ha0200.cpp
Executable file
98
ha/ha0200.cpp
Executable file
@ -0,0 +1,98 @@
|
||||
#include <automask.h>
|
||||
#include <confapp.h>
|
||||
|
||||
#include "ha0200a.h"
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// Maschera
|
||||
///////////////////////////////////////////////////
|
||||
class TConf_Hardy_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
void config_loader(TSheet_field& sf, const char* paragrafo);
|
||||
void config_setter(TSheet_field& sf, const char* paragrafo);
|
||||
TConf_Hardy_mask(const TFilename& f);
|
||||
|
||||
virtual ~TConf_Hardy_mask(){};
|
||||
};
|
||||
|
||||
bool TConf_Hardy_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TConf_Hardy_mask::TConf_Hardy_mask(const TFilename& f) : TAutomask (f)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// Applicazione
|
||||
///////////////////////////////////////////////////
|
||||
class TConf_Hardy : public TConfig_application
|
||||
{
|
||||
TMask* _ch;
|
||||
|
||||
protected:
|
||||
virtual TMask* create_mask(const TFilename& f);
|
||||
virtual TMask* get_mask();
|
||||
|
||||
public:
|
||||
virtual bool preprocess_config (TMask& mask, TConfig& config);
|
||||
virtual bool postprocess_config (TMask& mask, TConfig& config);
|
||||
virtual bool user_create( );
|
||||
virtual bool user_destroy( );
|
||||
|
||||
TConf_Hardy() : TConfig_application(CONFIG_DITTA), _ch(NULL) { }
|
||||
virtual ~TConf_Hardy() { }
|
||||
};
|
||||
|
||||
TMask* TConf_Hardy::get_mask()
|
||||
{
|
||||
return _ch;
|
||||
}
|
||||
|
||||
TMask* TConf_Hardy::create_mask(const TFilename& f)
|
||||
{
|
||||
if (_ch == NULL)
|
||||
_ch = new TConf_Hardy_mask(f);
|
||||
return _ch;
|
||||
}
|
||||
|
||||
bool TConf_Hardy::preprocess_config (TMask& mask, TConfig& config)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TConf_Hardy::postprocess_config (TMask& mask, TConfig& config)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TConf_Hardy::user_create( )
|
||||
{
|
||||
TConfig cfg(CONFIG_DITTA, "ha");
|
||||
cfg.set("EdMask", "ha0200a");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TConf_Hardy::user_destroy( )
|
||||
{
|
||||
if (_ch != NULL)
|
||||
delete _ch;
|
||||
return true;
|
||||
}
|
||||
|
||||
int ha0200(int argc, char* argv[])
|
||||
{
|
||||
TConf_Hardy app;
|
||||
app.run(argc, argv, TR("Configurazione Hardy"));
|
||||
return 0;
|
||||
}
|
25
ha/ha0200a.h
Executable file
25
ha/ha0200a.h
Executable file
@ -0,0 +1,25 @@
|
||||
#define F_CODTIPO_FAT 201
|
||||
#define F_DESCRTIPO_FAT 202
|
||||
#define F_STATO_INI_FAT 203
|
||||
#define F_STATO_FIN_FAT 204
|
||||
//------------------------------
|
||||
#define F_CO_ANT_NUM 205
|
||||
#define F_CO_ANT_TIP 207
|
||||
|
||||
#define F_NA_ANT_NUM 210
|
||||
#define F_NA_ANT_TIP 212
|
||||
#define F_NA_ANT_SPE 213
|
||||
//------------------------------
|
||||
#define F_CO_POST_NUM 215
|
||||
#define F_CO_POST_TIP 217
|
||||
|
||||
#define F_NA_POST_NUM 220
|
||||
#define F_NA_POST_TIP 222
|
||||
#define F_NA_POST_SPE 223
|
||||
//------------------------------
|
||||
#define F_CO_RIFA_NUM 225
|
||||
#define F_CO_RIFA_TIP 227
|
||||
|
||||
#define F_NA_RIFA_NUM 230
|
||||
#define F_NA_RIFA_TIP 232
|
||||
#define F_NA_RIFA_SPE 233
|
299
ha/ha0200a.uml
Executable file
299
ha/ha0200a.uml
Executable file
@ -0,0 +1,299 @@
|
||||
#include "ha0200a.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <stdbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Configurazione Hardy" -1 -1 78 23
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bTipo documento per fatture"
|
||||
END
|
||||
|
||||
STRING F_CODTIPO_FAT 4
|
||||
BEGIN
|
||||
PROMPT 2 2 "Tipo "
|
||||
USE %TIP
|
||||
INPUT CODTAB F_CODTIPO_FAT
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODTIPO_FAT CODTAB
|
||||
OUTPUT F_DESCRTIPO_FAT S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAG "UP"
|
||||
FIELD TipoFatt
|
||||
END
|
||||
|
||||
STRING F_DESCRTIPO_FAT 50
|
||||
BEGIN
|
||||
PROMPT 15 2 ""
|
||||
USE %TIP KEY 2
|
||||
INPUT S0 F_DESCRTIPO_FAT
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT F_CODTIPO_FAT
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_STATO_INI_FAT 1
|
||||
BEGIN
|
||||
PROMPT 2 3 "Stato iniziale "
|
||||
USE %STD
|
||||
INPUT CODTAB F_STATO_INI_FAT
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_STATO_INI_FAT CODTAB
|
||||
FLAGS "U"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD StatoIniFatt
|
||||
END
|
||||
|
||||
STRING F_STATO_FIN_FAT 1
|
||||
BEGIN
|
||||
PROMPT 25 3 "Stato finale "
|
||||
USE %STD
|
||||
INPUT CODTAB F_STATO_FIN_FAT
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_STATO_FIN_FAT CODTAB
|
||||
FLAGS "U"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD StatoFinFatt
|
||||
END
|
||||
|
||||
//--Anticipi-------------
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 1 5 "@bAnticipi"
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 6 "@bContratti premi"
|
||||
END
|
||||
|
||||
STRING F_CO_ANT_NUM 4
|
||||
BEGIN
|
||||
PROMPT 20 6 "Numerazione "
|
||||
/*USE %NUM
|
||||
INPUT CODTAB F_CO_ANT_NUM
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CO_ANT_NUM CODTAB
|
||||
CHECKTYPE REQUIRED*/
|
||||
FIELD CoAntNum
|
||||
END
|
||||
|
||||
STRING F_CO_ANT_TIP 4
|
||||
BEGIN
|
||||
PROMPT 42 6 "Tipo "
|
||||
/*USE %TIP
|
||||
INPUT CODTAB F_CO_ANT_TIP
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CO_ANT_TIP CODTAB
|
||||
CHECKTYPE REQUIRED*/
|
||||
FIELD CoAntTip
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 7 "@bNote di Accredito"
|
||||
END
|
||||
|
||||
STRING F_NA_ANT_NUM 4
|
||||
BEGIN
|
||||
PROMPT 20 7 "Numerazione "
|
||||
USE %NUM
|
||||
INPUT CODTAB F_NA_ANT_NUM
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_ANT_NUM CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaAntNum
|
||||
END
|
||||
|
||||
STRING F_NA_ANT_TIP 4
|
||||
BEGIN
|
||||
PROMPT 42 7 "Tipo "
|
||||
USE %TIP
|
||||
INPUT CODTAB F_NA_ANT_TIP
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_ANT_TIP CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaAntTip
|
||||
END
|
||||
|
||||
STRING F_NA_ANT_SPE 8
|
||||
BEGIN
|
||||
PROMPT 58 7 "Riga "
|
||||
USE SPP
|
||||
INPUT CODTAB F_NA_ANT_SPE
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_ANT_SPE CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaAntSpe
|
||||
END
|
||||
|
||||
|
||||
//--Posticipi-------------
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 1 9 "@bPosticipi"
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 10 "@bContratti premi"
|
||||
END
|
||||
|
||||
STRING F_CO_POST_NUM 4
|
||||
BEGIN
|
||||
PROMPT 20 10 "Numerazione "
|
||||
/*USE %NUM
|
||||
INPUT CODTAB F_CO_POST_NUM
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CO_POST_NUM CODTAB
|
||||
CHECKTYPE REQUIRED*/
|
||||
FIELD CoPostNum
|
||||
END
|
||||
|
||||
STRING F_CO_POST_TIP 4
|
||||
BEGIN
|
||||
PROMPT 42 10 "Tipo "
|
||||
/*USE %TIP
|
||||
INPUT CODTAB F_CO_POST_TIP
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CO_POST_TIP CODTAB
|
||||
CHECKTYPE REQUIRED*/
|
||||
FIELD CoPostTip
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 11 "@bNote di Accredito"
|
||||
END
|
||||
|
||||
STRING F_NA_POST_NUM 4
|
||||
BEGIN
|
||||
PROMPT 20 11 "Numerazione "
|
||||
USE %NUM
|
||||
INPUT CODTAB F_NA_POST_NUM
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_POST_NUM CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaPostNum
|
||||
END
|
||||
|
||||
STRING F_NA_POST_TIP 4
|
||||
BEGIN
|
||||
PROMPT 42 11 "Tipo "
|
||||
USE %TIP
|
||||
INPUT CODTAB F_NA_POST_TIP
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_POST_TIP CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaPostTip
|
||||
END
|
||||
|
||||
STRING F_NA_POST_SPE 8
|
||||
BEGIN
|
||||
PROMPT 58 11 "Riga "
|
||||
USE SPP
|
||||
INPUT CODTAB F_NA_POST_SPE
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_POST_SPE CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaPostSpe
|
||||
END
|
||||
|
||||
//--Rifatturazione-------------
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 1 13 "@bRifatturazione"
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 14 "@bContratti premi"
|
||||
END
|
||||
|
||||
STRING F_CO_RIFA_NUM 4
|
||||
BEGIN
|
||||
PROMPT 20 14 "Numerazione "
|
||||
/*USE %NUM
|
||||
INPUT CODTAB F_CO_RIFA_NUM
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CO_RIFA_NUM CODTAB
|
||||
CHECKTYPE REQUIRED*/
|
||||
FIELD CoRifaNum
|
||||
END
|
||||
|
||||
STRING F_CO_RIFA_TIP 4
|
||||
BEGIN
|
||||
PROMPT 42 14 "Tipo "
|
||||
/*USE %TIP
|
||||
INPUT CODTAB F_CO_RIFA_TIP
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CO_RIFA_TIP CODTAB
|
||||
CHECKTYPE REQUIRED*/
|
||||
FIELD CoRifaTip
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 15 "@bNote di Accredito"
|
||||
END
|
||||
|
||||
STRING F_NA_RIFA_NUM 4
|
||||
BEGIN
|
||||
PROMPT 20 15 "Numerazione "
|
||||
USE %NUM
|
||||
INPUT CODTAB F_NA_RIFA_NUM
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_RIFA_NUM CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaRifaNum
|
||||
END
|
||||
|
||||
STRING F_NA_RIFA_TIP 4
|
||||
BEGIN
|
||||
PROMPT 42 15 "Tipo "
|
||||
USE %TIP
|
||||
INPUT CODTAB F_NA_RIFA_TIP
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_RIFA_TIP CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaRifaTip
|
||||
END
|
||||
|
||||
STRING F_NA_RIFA_SPE 8
|
||||
BEGIN
|
||||
PROMPT 58 15 "Riga "
|
||||
USE SPP
|
||||
INPUT CODTAB F_NA_RIFA_SPE
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NA_RIFA_SPE CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NaRifaSpe
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
393
ha/ha0300.cpp
Executable file
393
ha/ha0300.cpp
Executable file
@ -0,0 +1,393 @@
|
||||
#include <automask.h>
|
||||
#include <recarray.h>
|
||||
#include <relapp.h>
|
||||
|
||||
#include <cfven.h>
|
||||
#include <doc.h>
|
||||
#include <rdoc.h>
|
||||
|
||||
#include "../mg/umart.h"
|
||||
#include "../ve/condv.h"
|
||||
#include "../ve/rcondv.h"
|
||||
|
||||
#include "halib.h"
|
||||
#include "ha0.h"
|
||||
#include "ha0300a.h"
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// Maschera
|
||||
//////////////////////////////////////////////
|
||||
class TDocumenti_premio_msk : public TAutomask
|
||||
{
|
||||
protected:
|
||||
bool find_prezzo_articolo(const TString& codart, real& prezzo, TString& um) const;
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TDocumenti_premio_msk();
|
||||
};
|
||||
|
||||
|
||||
TDocumenti_premio_msk::TDocumenti_premio_msk() : TAutomask("ha0300a")
|
||||
{
|
||||
}
|
||||
|
||||
bool TDocumenti_premio_msk::find_prezzo_articolo(const TString& codart, real& prezzo, TString& um) const
|
||||
{
|
||||
//1) contratto
|
||||
const long codcf = get_long(F_CODCF);
|
||||
const TString& codcontr = get(F_CODCONTR);
|
||||
|
||||
TToken_string key_umart;
|
||||
key_umart.add(codart);
|
||||
key_umart.add(1);
|
||||
const TRectype& rec_umart = cache().get(LF_UMART, key_umart);
|
||||
um = rec_umart.get(UMART_UM);
|
||||
const real umart_prezzo = rec_umart.get_real(UMART_PREZZO);
|
||||
|
||||
prezzo = umart_prezzo; //mal che vada sarà il prezzo di umart
|
||||
TToken_string key;
|
||||
|
||||
//CONTRATTI: tipo=C|catven=|tipocf=C|codcf=codcf|cod=codcontr|tiporiga=A|codriga=codart|um=um
|
||||
key.add("C");
|
||||
key.add("");
|
||||
key.add("C");
|
||||
key.add(codcf);
|
||||
key.add(codcontr);
|
||||
|
||||
//per um è necessario se il contratto scelto ha la gestione delle um accesa (tanto per complicarsi la vita)
|
||||
const bool gestum_contr = cache().get(LF_CONDV, key, CONDV_GESTUM) == "X";
|
||||
|
||||
key.add("A");
|
||||
key.add(codart);
|
||||
if (gestum_contr)
|
||||
key.add(um);
|
||||
|
||||
const TRectype& rec_contratto = cache().get(LF_RCONDV, key);
|
||||
const real contratto_prezzo = rec_contratto.get(RCONDV_PREZZO);
|
||||
|
||||
//2) non c'è un prezzo sul contratto, prova con il listino standard
|
||||
if (!contratto_prezzo.is_zero())
|
||||
prezzo = contratto_prezzo;
|
||||
else
|
||||
{
|
||||
key.cut(0);
|
||||
//LISTINI: tipo=L|catven=catven|tipocf=|codcf=|cod=codlis|tiporiga=A|codriga=codart|um=um
|
||||
key.add("L");
|
||||
//la catven se c'è è del cliente
|
||||
TToken_string key_cfven;
|
||||
key_cfven.add("C");
|
||||
key_cfven.add(codcf);
|
||||
const TString& catven = cache().get(LF_CFVEN, key_cfven, CFV_CATVEN);
|
||||
key.add(catven);
|
||||
key.add("");
|
||||
key.add("");
|
||||
const TString& codlis = get(F_CODLIS);
|
||||
key.add(codlis);
|
||||
|
||||
//per um è necessario se il listino scelto ha la gestione delle um accesa (tanto per complicarsi la vita)
|
||||
const bool gestum_list = cache().get(LF_CONDV, key, CONDV_GESTUM) == "X";
|
||||
|
||||
key.add("A");
|
||||
key.add(codart);
|
||||
if (gestum_list)
|
||||
key.add(um);
|
||||
|
||||
const TRectype& rec_listino = cache().get(LF_RCONDV, key);
|
||||
const real listino_prezzo = rec_listino.get(RCONDV_PREZZO);
|
||||
if (!listino_prezzo.is_zero())
|
||||
prezzo = listino_prezzo;
|
||||
}
|
||||
|
||||
return !prezzo.is_zero();
|
||||
}
|
||||
|
||||
bool TDocumenti_premio_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_TIPOCONTR:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
{
|
||||
//all'inizio deve proporre una lista dei possibili numerazioni e tipi che stanno in configurazione
|
||||
TConfig config(CONFIG_DITTA, "ha");
|
||||
TString4 codnum, tipodoc;
|
||||
|
||||
switch (o.get()[0])
|
||||
{
|
||||
case 'A':
|
||||
codnum = config.get("CoAntNum");
|
||||
tipodoc = config.get("CoAntTip");
|
||||
break;
|
||||
case 'R':
|
||||
codnum = config.get("CoRifaNum");
|
||||
tipodoc = config.get("CoRifaTip");
|
||||
break;
|
||||
default:
|
||||
codnum = config.get("CoPostNum");
|
||||
tipodoc = config.get("CoPostTip");
|
||||
break;
|
||||
}
|
||||
|
||||
set(F_CODNUM, codnum);
|
||||
set(F_TIPODOC, tipodoc);
|
||||
}
|
||||
break;
|
||||
case S_CODART:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
//caricamento del prezzo in fase modifica codart: sequenza contratto->listino->umart
|
||||
//non è possibile mettere un prezzo a mano alla cazzo!
|
||||
real prezzo;
|
||||
TString4 um;
|
||||
//se il prezzo l'ha trovato lo mette nel relativo campo
|
||||
if (find_prezzo_articolo(o.get(), prezzo, um))
|
||||
{
|
||||
TMask& row_mask = o.mask();
|
||||
row_mask.set(S_PREZZO, prezzo);
|
||||
row_mask.set(S_UMQTA, um);
|
||||
}
|
||||
else
|
||||
{
|
||||
TString msg;
|
||||
msg.format("Non esiste il prezzo per l'articolo %s nei listini selezionati!", (const char*)o.get());
|
||||
return error_box(msg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// Applicazione
|
||||
//////////////////////////////////////////////
|
||||
class TDocumenti_premio : public TRelation_application
|
||||
{
|
||||
TRelation* _rel;
|
||||
TDocumenti_premio_msk* _msk;
|
||||
|
||||
protected:
|
||||
virtual bool user_create();
|
||||
virtual bool user_destroy();
|
||||
virtual TMask* get_mask(int) {return _msk;}
|
||||
virtual TRelation* get_relation() const {return _rel;}
|
||||
|
||||
void write_rows(const TMask& m);
|
||||
void read_rows(TMask& m);
|
||||
|
||||
virtual bool get_next_key(TToken_string& key);
|
||||
virtual int write(const TMask& m);
|
||||
virtual int rewrite(const TMask& m);
|
||||
virtual int read(TMask& m);
|
||||
|
||||
virtual void init_query_mode(TMask& m);
|
||||
virtual void init_insert_mode(TMask& m);
|
||||
virtual void init_modify_mode(TMask& m);
|
||||
};
|
||||
|
||||
|
||||
//cerca il primo numero valido per NDOC
|
||||
bool TDocumenti_premio::get_next_key(TToken_string& key)
|
||||
{
|
||||
long n = 0;
|
||||
|
||||
TLocalisamfile doc(LF_DOC);
|
||||
TRectype& curr = doc.curr();
|
||||
const char provv = _msk->get(F_PROVV)[0];
|
||||
const int anno = _msk->get_int(F_ANNO);
|
||||
const TString4 codnum = _msk->get(F_CODNUM);
|
||||
|
||||
curr.put(DOC_PROVV, provv);
|
||||
curr.put(DOC_ANNO, anno);
|
||||
curr.put(DOC_CODNUM, codnum);
|
||||
curr.put(DOC_NDOC, 9999999L);
|
||||
|
||||
const int err = doc.read(_isgreat);
|
||||
|
||||
if (err != _isemptyfile)
|
||||
{
|
||||
if (err == NOERR)
|
||||
doc.prev();
|
||||
if (curr.get_char(DOC_PROVV) == provv &&
|
||||
curr.get_int(DOC_ANNO) == anno &&
|
||||
curr.get(DOC_CODNUM) == codnum)
|
||||
n = curr.get_long(DOC_NDOC);
|
||||
}
|
||||
|
||||
n++;
|
||||
|
||||
key.cut(0);
|
||||
key.add(F_PROVV); key.add(provv);
|
||||
key.add(F_ANNO); key.add(anno);
|
||||
key.add(F_CODNUM); key.add(codnum);
|
||||
key.add(F_NDOC); key.add(n);
|
||||
|
||||
return n > 0;
|
||||
}
|
||||
|
||||
void TDocumenti_premio::read_rows(TMask& m)
|
||||
{
|
||||
//chiave delle righe (escluso nriga) basata sulla testata
|
||||
TToken_string rdoc_key;
|
||||
|
||||
const char provv = m.get(F_PROVV)[0];
|
||||
const int anno = m.get_int(F_ANNO);
|
||||
const TString& codnum = m.get(F_CODNUM);
|
||||
const long ndoc = m.get_long(F_NDOC);
|
||||
|
||||
rdoc_key.add(codnum);
|
||||
rdoc_key.add(anno);
|
||||
rdoc_key.add(provv);
|
||||
rdoc_key.add(ndoc);
|
||||
|
||||
//array con le righe che rispondono alla chiave di testata
|
||||
TRecord_array righedoc(rdoc_key, LF_RIGHEDOC);
|
||||
|
||||
//sheet e maschera di riga dello sheet
|
||||
TSheet_field& sheet = m.sfield(F_RIGHE);
|
||||
TMask& sm = sheet.sheet_mask();
|
||||
sheet.destroy();
|
||||
|
||||
//giro sulle righe documento
|
||||
for (int i = 1; i <= righedoc.rows(); i++)
|
||||
{
|
||||
const TRectype& rec = righedoc.row(i); //record con l'elemento riga dell'array
|
||||
const TString& tipo = rec.get(RDOC_TIPORIGA); //in base al tiporiga si devono fare operazioni diverse
|
||||
//se è un tipo riga merce -> va aggiunta allo sheet
|
||||
if (tipo == HARDY_TIPORIGA_MERCE || tipo.blank())
|
||||
{
|
||||
TToken_string& row = sheet.row(-1); //aggiunge una riga vuota
|
||||
for (int i = sm.fields()-1; i >= 0; i--) //giro su tutti i campi della maschera di riga...
|
||||
{
|
||||
TMask_field& mf = sm.fld(i); //aggiunge solo quelli che hanno un field
|
||||
if ((mf.field() != NULL) && (mf.dlg() > 100)) //> 100 per evitare errori sui campi dlg_null
|
||||
{
|
||||
const int idx = sheet.cid2index(mf.dlg());
|
||||
row.add(mf.field()->read(rec), idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tipo == HARDY_TIPORIGA_SOMMA)//se invece è la riga con le somme anticipate/maturate (solo 1 per contratto!) -> va messa in testata
|
||||
{
|
||||
const real anticipato = rec.get(RCA_2_ANTICIPATO);
|
||||
const real maturato = rec.get(RCA_2_RESTITUITO);
|
||||
m.set(F_ANTICIPATO, anticipato);
|
||||
m.set(F_RESTITUITO, maturato);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TDocumenti_premio::write_rows(const TMask& m)
|
||||
{
|
||||
//chiave delle righe basata sui campi di testata
|
||||
const char provv = m.get(F_PROVV)[0];
|
||||
const int anno = m.get_int(F_ANNO);
|
||||
const TString& codnum = m.get(F_CODNUM);
|
||||
const long ndoc = m.get_long(F_NDOC);
|
||||
|
||||
TRectype* key_rec = new TRectype(LF_RIGHEDOC);
|
||||
|
||||
key_rec->put(RDOC_PROVV, provv);
|
||||
key_rec->put(RDOC_ANNO, anno);
|
||||
key_rec->put(RDOC_CODNUM, codnum);
|
||||
key_rec->put(RDOC_NDOC, ndoc);
|
||||
|
||||
//recordarray con le righe che rispondono alla chiave di testata key_rec
|
||||
TRecord_array righedoc(LF_RIGHEDOC, RDOC_NRIGA);
|
||||
righedoc.set_key(key_rec);
|
||||
|
||||
//sheet e maschera di riga dello sheet
|
||||
TSheet_field& sheet = m.sfield(F_RIGHE);
|
||||
TMask& sm = sheet.sheet_mask();
|
||||
|
||||
//giro sulle righe dello sheet (righe di tipo merce)
|
||||
FOR_EACH_SHEET_ROW(sheet, i, row)
|
||||
{
|
||||
TRectype& rec = righedoc.row(i+1, true); //record con l'elemento riga dell'array
|
||||
for (int i = sm.fields()-1; i >= 0; i--) //giro su tutti i campi della maschera di riga...
|
||||
{
|
||||
TMask_field& mf = sm.fld(i); //aggiunge solo quelli che hanno un field
|
||||
if ((mf.field() != NULL) && (mf.dlg() > 100)) //> 100 per evitare errori sui campi dlg_null
|
||||
{
|
||||
const int idx = sheet.cid2index(mf.dlg());
|
||||
mf.field()->write(row->get(idx), rec);
|
||||
}
|
||||
}
|
||||
rec.put(RDOC_TIPORIGA, HARDY_TIPORIGA_MERCE);
|
||||
}
|
||||
//salva la riga di tipo somme anticipate/rimborsate (H02) che in realtà è in testata
|
||||
const int righedoc_items = righedoc.rows();
|
||||
TRectype& last_rec = righedoc.row(righedoc_items + 1, true);
|
||||
const real anticipato = m.get_real(F_ANTICIPATO);
|
||||
const real maturato = m.get_real(F_RESTITUITO);
|
||||
last_rec.put(RDOC_QTAGG4, anticipato);
|
||||
last_rec.put(RDOC_QTAGG5, maturato);
|
||||
last_rec.put(RDOC_TIPORIGA, HARDY_TIPORIGA_SOMMA);
|
||||
|
||||
//e alla fine della fiera scrive tutto ufficialmente
|
||||
righedoc.rewrite();
|
||||
}
|
||||
|
||||
|
||||
void TDocumenti_premio::init_query_mode(TMask& m)
|
||||
{
|
||||
}
|
||||
|
||||
void TDocumenti_premio::init_insert_mode(TMask& m)
|
||||
{
|
||||
}
|
||||
|
||||
void TDocumenti_premio::init_modify_mode(TMask& m)
|
||||
{
|
||||
m.disable(F_TIPOCONTR); //non si può cambiare il tipo contratto una volta stabilito sennò non funziona + un cazzo
|
||||
}
|
||||
|
||||
int TDocumenti_premio::write(const TMask& m)
|
||||
{
|
||||
const int err = TRelation_application::write(m);
|
||||
if (err == NOERR)
|
||||
write_rows(m);
|
||||
return err;
|
||||
}
|
||||
|
||||
int TDocumenti_premio::rewrite(const TMask& m)
|
||||
{
|
||||
const int err = TRelation_application::rewrite(m);
|
||||
if (err == NOERR)
|
||||
write_rows(m);
|
||||
return err;
|
||||
}
|
||||
|
||||
int TDocumenti_premio::read(TMask& m)
|
||||
{
|
||||
const int err = TRelation_application::read(m);
|
||||
if (err == NOERR)
|
||||
read_rows(m);
|
||||
return err;
|
||||
}
|
||||
|
||||
bool TDocumenti_premio::user_create()
|
||||
{
|
||||
_rel = new TRelation(LF_DOC);
|
||||
_msk = new TDocumenti_premio_msk;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDocumenti_premio::user_destroy()
|
||||
{
|
||||
delete _rel;
|
||||
delete _msk;
|
||||
return true;
|
||||
}
|
||||
|
||||
int ha0300(int argc, char* argv[])
|
||||
{
|
||||
TDocumenti_premio a;
|
||||
a.run(argc, argv, TR("Documenti premio Hardy"));
|
||||
return 0;
|
||||
}
|
54
ha/ha0300a.h
Executable file
54
ha/ha0300a.h
Executable file
@ -0,0 +1,54 @@
|
||||
//campi maschera ha0300a.uml
|
||||
|
||||
#define F_CODNUM 201
|
||||
#define F_TIPODOC 202
|
||||
#define F_PROVV 203
|
||||
#define F_ANNO 204
|
||||
|
||||
#define F_TIPOCF 205
|
||||
#define F_CODCF 206
|
||||
#define F_DESCF 207
|
||||
|
||||
#define F_CODCONTR 210
|
||||
#define F_DESCONTR 211
|
||||
#define F_CODLIS 212
|
||||
#define F_DESLIS 213
|
||||
|
||||
#define F_NDOC 215
|
||||
#define F_DATADOC 216
|
||||
#define F_STATO 217
|
||||
|
||||
#define F_CODAG 220
|
||||
#define F_DESCRAG 221
|
||||
#define F_CODPAG 222
|
||||
#define F_DESCRPAG 223
|
||||
#define F_TIPOCONTR 224
|
||||
#define F_DATACOMP 225
|
||||
#define F_DATAFCOMP 226
|
||||
#define F_ANTICIPATO 227
|
||||
#define F_RESTITUITO 228
|
||||
|
||||
#define F_RIGHE 500 //questo va messo 500 sennò ve0 si incazza e non funziona più
|
||||
|
||||
//campi della maschera riga sheet
|
||||
#define S_CODART 101
|
||||
#define S_DESCR 102
|
||||
#define S_UMQTA 103
|
||||
#define S_PREZZO 104
|
||||
#define S_PREMIO 105
|
||||
#define S_RICARICO 106
|
||||
#define S_MATURATO 107
|
||||
|
||||
//vadetecum per il sagace programmatore sui campi dei CONTRATTI PREMI HARDY
|
||||
|
||||
//campo msk/sheet campo file tipo riga
|
||||
//S_PREMIO QTAGG1 H01
|
||||
//S_RICARICO QTAGG2 H01
|
||||
//S_MATURATO QTAGG5 H01
|
||||
|
||||
// QTAGG3 H01 - H02 -> usato come campo di appoggio per gli importi in elaborazione ha0500
|
||||
//F_ANTICIPATO QTAGG4 H02
|
||||
//F_RESTITUITO QTAGG5 H02
|
||||
|
||||
//ATTENZIONE! QTA H01 - H02 -> usato come campo di appoggio per umqta in elaborazione ha0500
|
||||
//ATTANZIONE! UMQTA H01 - H02 -> usato come campo di appoggio per qta in elaborazione ha0500
|
405
ha/ha0300a.uml
Executable file
405
ha/ha0300a.uml
Executable file
@ -0,0 +1,405 @@
|
||||
#include "ha0300a.h"
|
||||
|
||||
TOOLBAR "" 0 0 0 2
|
||||
|
||||
#include <relapbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Contratto premi Hardy" -1 -1 78 23
|
||||
|
||||
GROUPBOX DLG_NULL 78 13
|
||||
BEGIN
|
||||
PROMPT 1 0 ""
|
||||
END
|
||||
|
||||
RADIOBUTTON F_TIPOCONTR 1 76
|
||||
BEGIN
|
||||
PROMPT 2 0 "@bTipo contratto"
|
||||
ITEM "A|Anticipo" MESSAGE CLEAR,F_DATAFCOMP|ENABLE,1@
|
||||
ITEM "P|Posticipo" MESSAGE ENABLE,F_DATAFCOMP|CLEAR,1@
|
||||
ITEM "R|Rifatturazione" MESSAGE CLEAR,F_DATAFCOMP|ENABLE,1@
|
||||
FIELD TIPOCFFATT
|
||||
FLAGS "GZ"
|
||||
KEY 1
|
||||
END
|
||||
|
||||
STRING F_CODNUM 4
|
||||
BEGIN
|
||||
PROMPT 102 101 "Cod. num. "
|
||||
FIELD CODNUM
|
||||
USE %NUM KEY 1
|
||||
INPUT CODTAB F_CODNUM
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "GDU"
|
||||
KEY 1
|
||||
END
|
||||
|
||||
STRING F_TIPODOC 4
|
||||
BEGIN
|
||||
FIELD TIPODOC
|
||||
PROMPT 120 101 "Tipo doc. "
|
||||
USE %TIP KEY 1
|
||||
INPUT CODTAB F_TIPODOC
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "GDU"
|
||||
END
|
||||
|
||||
LIST F_TIPOCF 9
|
||||
BEGIN
|
||||
PROMPT 130 101 ""
|
||||
FIELD TIPOCF
|
||||
IT "C|Cliente"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING F_CODCF 6
|
||||
BEGIN
|
||||
PROMPT 2 3 "Cliente "
|
||||
WARNING "Cliente assente"
|
||||
HELP "Codice del cliente del documento"
|
||||
FLAGS "R"
|
||||
FIELD CODCF
|
||||
USE LF_CLIFO KEY 1
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCF
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@12" PAIV
|
||||
DISPLAY "Sospeso" SOSPESO
|
||||
OUTPUT F_CODCF CODCF
|
||||
OUTPUT F_DESCF RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
ADD RUN cg0 -1 C
|
||||
END
|
||||
|
||||
STRING F_DESCF 50
|
||||
BEGIN
|
||||
WARNING "Cliente assente"
|
||||
HELP "Ragione sociale del cliente del documento"
|
||||
PROMPT 24 3 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_DESCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@12" PAIV
|
||||
DISPLAY "Codice" CODCF
|
||||
COPY OUTPUT F_CODCF
|
||||
CHECKTYPE REQUIRED
|
||||
ADD RUN cg0 -1 C
|
||||
END
|
||||
|
||||
LIST F_PROVV 1
|
||||
BEGIN
|
||||
PROMPT 140 101 ""
|
||||
ITEM "D|D"
|
||||
FIELD PROVV
|
||||
FLAGS "D"
|
||||
KEY 1
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 2 4 "Esercizio "
|
||||
USE ESC
|
||||
INPUT CODTAB F_ANNO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_ANNO CODTAB
|
||||
FIELD ANNO
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "A"
|
||||
KEY 1
|
||||
END
|
||||
|
||||
NUMBER F_NDOC 6
|
||||
BEGIN
|
||||
PROMPT 24 4 "N. contr. premi "
|
||||
USE LF_DOC SELECT BETWEEN(CODCF,#F_CODCF,#F_CODCF)
|
||||
INPUT CODNUM F_CODNUM SELECT
|
||||
INPUT PROVV F_PROVV SELECT
|
||||
INPUT ANNO F_ANNO SELECT
|
||||
INPUT NDOC F_NDOC
|
||||
DISPLAY "Numero" NDOC
|
||||
DISPLAY "Data doc." DATADOC
|
||||
DISPLAY "Inizio validita" DATACOMP
|
||||
DISPLAY "Fine validita" DATAFCOMP
|
||||
DISPLAY "Tipo" TIPOCFFATT
|
||||
DISPLAY "Agente" CODAG
|
||||
OUPUT F_NDOC NDOC
|
||||
FIELD NDOC
|
||||
KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE F_DATADOC
|
||||
BEGIN
|
||||
PROMPT 50 4 "Data "
|
||||
FIELD DATADOC
|
||||
END
|
||||
|
||||
STRING F_STATO 1
|
||||
BEGIN
|
||||
PROMPT 69 4 "Stato "
|
||||
FIELD STATO
|
||||
USE %STD KEY 1
|
||||
INPUT CODTAB F_STATO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_STATO CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "DG"
|
||||
END
|
||||
|
||||
STRING F_CODCONTR 3
|
||||
BEGIN
|
||||
PROMPT 2 5 "Listino cliente "
|
||||
USE CONDV
|
||||
INPUT TIPO "C"
|
||||
INPUT TIPOCF F_TIPOCF SELECT
|
||||
INPUT CODCF F_CODCF SELECT
|
||||
INPUT COD F_CODCONTR
|
||||
DISPLAY "Codice" COD
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Inizio validita'" VALIN
|
||||
DISPLAY "Fine validità" VALFIN
|
||||
OUTPUT F_CODCONTR COD
|
||||
OUTPUT F_DESCONTR DESCR
|
||||
FIELD CODCONT
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESCONTR 50
|
||||
BEGIN
|
||||
PROMPT 26 5 ""
|
||||
FLAGS "DG"
|
||||
END
|
||||
|
||||
STRING F_CODLIS 3
|
||||
BEGIN
|
||||
PROMPT 2 6 "Listino standard "
|
||||
USE CONDV
|
||||
INPUT TIPO "L"
|
||||
INPUT COD F_CODLIS
|
||||
DISPLAY "Codice" COD
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Inizio validita'" VALIN
|
||||
DISPLAY "Fine validità" VALFIN
|
||||
OUTPUT F_CODLIS COD
|
||||
OUTPUT F_DESLIS DESCR
|
||||
FIELD CODLIST
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESLIS 50
|
||||
BEGIN
|
||||
PROMPT 26 6 ""
|
||||
FLAGS "DG"
|
||||
END
|
||||
|
||||
STRING F_CODAG 5
|
||||
BEGIN
|
||||
PROMPT 2 7 "Agente "
|
||||
FIELD CODAG
|
||||
USE LF_AGENTI
|
||||
INPUT CODAGE F_CODAG
|
||||
DISPLAY "Codice@8R" CODAGE
|
||||
DISPLAY "Descrizione@50" RAGSOC
|
||||
OUTPUT F_CODAG CODAGE
|
||||
OUTPUT F_DESCRAG RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "UZ"
|
||||
END
|
||||
|
||||
STRING F_DESCRAG 50
|
||||
BEGIN
|
||||
PROMPT 24 7 ""
|
||||
USE LF_AGENTI KEY 2
|
||||
INPUT RAGSOC F_DESCRAG
|
||||
DISPLAY "Descrizione@50" RAGSOC
|
||||
DISPLAY "Codice@8R" CODAGE
|
||||
COPY OUTPUT F_CODAG
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_CODPAG 4
|
||||
BEGIN
|
||||
PROMPT 2 8 "Cond. pag. "
|
||||
FIELD CODPAG
|
||||
USE %CPG
|
||||
INPUT CODTAB F_CODPAG
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODPAG CODTAB
|
||||
OUTPUT F_DESCRPAG S0
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "U"
|
||||
HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RUN ba3 -6
|
||||
END
|
||||
|
||||
STRING F_DESCRPAG 50
|
||||
BEGIN
|
||||
PROMPT 24 8 ""
|
||||
USE %CPG KEY 2
|
||||
INPUT S0 F_DESCRPAG
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT F_CODPAG
|
||||
CHECKTYPE NORMAL
|
||||
HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RUN ba3 -6
|
||||
END
|
||||
|
||||
DATE F_DATACOMP
|
||||
BEGIN
|
||||
PROMPT 2 9 "Inizio validita' "
|
||||
FIELD DATACOMP
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE F_DATAFCOMP
|
||||
BEGIN
|
||||
PROMPT 35 9 "Fine validita' "
|
||||
FIELD DATAFCOMP
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 3
|
||||
BEGIN
|
||||
PROMPT 2 10 "@bSomme anticipate/restituite"
|
||||
END
|
||||
|
||||
CURRENCY F_ANTICIPATO
|
||||
BEGIN
|
||||
PROMPT 3 11 "Anticipato "
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
CURRENCY F_RESTITUITO
|
||||
BEGIN
|
||||
PROMPT 38 11 "Restituito "
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
SPREADSHEET F_RIGHE
|
||||
BEGIN
|
||||
PROMPT 2 13 ""
|
||||
ITEM "Codice Articolo@20"
|
||||
ITEM "Descrizione@40"
|
||||
ITEM "UM@2"
|
||||
ITEM "Prezzo listino"
|
||||
ITEM "Premio@10"
|
||||
ITEM "Ns. carico"
|
||||
ITEM "Bonus@10"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
/////////////////////////////////////////
|
||||
//maschera di riga
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
BUTTON DLG_OK 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 2 2
|
||||
BEGIN
|
||||
PROMPT 2 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 2 2
|
||||
BEGIN
|
||||
PROMPT 3 1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Riga contratto premi Hardy" -1 -1 76 12
|
||||
|
||||
STRING S_CODART 20
|
||||
BEGIN
|
||||
PROMPT 1 1 "Articolo "
|
||||
USE LF_ANAMAG KEY 1
|
||||
INPUT CODART S_CODART
|
||||
DISPLAY "Codice@20" CODART
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT S_CODART CODART
|
||||
OUTPUT S_DESCR DESCR
|
||||
WARNING "Articolo assente"
|
||||
FLAGS "U"
|
||||
FIELD CODART
|
||||
ADD RUN ve2 -3
|
||||
END
|
||||
|
||||
STRING S_DESCR 50
|
||||
BEGIN
|
||||
PROMPT 1 2 "Descrizione "
|
||||
USE 47 KEY 2
|
||||
INPUT DESCR S_DESCR
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Codice@20" CODART
|
||||
COPY OUTPUT S_CODART
|
||||
FIELD DESCR
|
||||
END
|
||||
|
||||
STRING S_UMQTA 2
|
||||
BEGIN
|
||||
PROMPT 1 3 "U.M. "
|
||||
USE LF_UMART KEY 2
|
||||
JOIN %UMS INTO CODTAB=UM
|
||||
INPUT CODART S_CODART SELECT
|
||||
INPUT UM S_UMQTA
|
||||
DISPLAY "Codice@20" UM
|
||||
DISPLAY "Descrizione@50" %UMS->S0
|
||||
OUTPUT S_UMQTA UM
|
||||
FIELD UMQTA
|
||||
FLAGS "U"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 74 6
|
||||
BEGIN
|
||||
PROMPT 1 4 "@bValori"
|
||||
END
|
||||
|
||||
CURRENCY S_PREZZO
|
||||
BEGIN
|
||||
PROMPT 2 5 "Prezzo listino "
|
||||
FLAGS "UDG"
|
||||
FIELD PREZZO
|
||||
END
|
||||
|
||||
CURRENCY S_PREMIO
|
||||
BEGIN
|
||||
PROMPT 2 6 "Premio "
|
||||
FLAGS "U"
|
||||
FIELD QTAGG1
|
||||
END
|
||||
|
||||
CURRENCY S_RICARICO
|
||||
BEGIN
|
||||
PROMPT 2 7 "A Ns. carico "
|
||||
FLAGS "U"
|
||||
FIELD QTAGG2
|
||||
END
|
||||
|
||||
CURRENCY S_MATURATO
|
||||
BEGIN
|
||||
PROMPT 2 8 "Bonus maturato "
|
||||
FLAGS "DU"
|
||||
FIELD QTAGG5
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
780
ha/ha0500.cpp
Executable file
780
ha/ha0500.cpp
Executable file
@ -0,0 +1,780 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <dongle.h>
|
||||
#include <progind.h>
|
||||
#include <recarray.h>
|
||||
#include <recset.h>
|
||||
#include <reputils.h>
|
||||
|
||||
#include <doc.h>
|
||||
#include <rdoc.h>
|
||||
#include "../cg/cglib01.h"
|
||||
#include "../ve/velib.h"
|
||||
|
||||
#include "halib.h"
|
||||
#include "ha0.h"
|
||||
#include "ha0500a.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAutomask
|
||||
///////////////////////////////////////////////////////////
|
||||
class THardy_elab_docs_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
THardy_elab_docs_mask();
|
||||
~THardy_elab_docs_mask();
|
||||
};
|
||||
|
||||
|
||||
THardy_elab_docs_mask::THardy_elab_docs_mask() : TAutomask ("ha0500a")
|
||||
{
|
||||
}
|
||||
|
||||
THardy_elab_docs_mask::~THardy_elab_docs_mask()
|
||||
{
|
||||
}
|
||||
|
||||
bool THardy_elab_docs_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_ADATA:
|
||||
if (e == fe_close || e == fe_modify)
|
||||
{
|
||||
//se la data iniziale è piena -> l'anno deve essere lo stesso nelle 2 date;
|
||||
//se invece è vuota -> la data iniziale viene presa come la data iniziale dell'esercizio della data finale...
|
||||
//..ma questo qui non serve e viene rinviato alla query principale del recordset
|
||||
const TDate adata = get_date(F_ADATA);
|
||||
TEsercizi_contabili esc;
|
||||
const int adata_esc = esc.date2esc(adata);
|
||||
|
||||
TDate dadata = o.get();
|
||||
if (dadata.ok())
|
||||
{
|
||||
const int dadata_esc = esc.date2esc(dadata);
|
||||
if (adata_esc != dadata_esc)
|
||||
return error_box("Le date devono appartenere allo stesso esercizio!");
|
||||
}
|
||||
}
|
||||
break;
|
||||
/*case F_TIPOCONTR:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
//in base alla tipologia di contratti da elaborare decide numerazione e tipo delle NAC da generare
|
||||
TConfig config(CONFIG_DITTA, "ha");
|
||||
TString4 codnum, tipodoc;
|
||||
|
||||
switch (o.get()[0])
|
||||
{
|
||||
case 'A':
|
||||
codnum = config.get("NaAntNum");
|
||||
tipodoc = config.get("NaAntTip");
|
||||
break;
|
||||
case 'R':
|
||||
codnum = config.get("NaRifaNum");
|
||||
tipodoc = config.get("NaRifaTip");
|
||||
break;
|
||||
default:
|
||||
codnum = config.get("NaPostNum");
|
||||
tipodoc = config.get("NaPostTip");
|
||||
break;
|
||||
}
|
||||
|
||||
set(F_CODNUM_NAC, codnum);
|
||||
set(F_CODTIPO_NAC, tipodoc);
|
||||
}
|
||||
break;*/
|
||||
//in caso di elaborazione definitiva è obbligatorio..
|
||||
//..eliminare tutte le NAC provvisorie generate in precedenza
|
||||
case F_DEFINITIVO:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
if (o.get() == "X")
|
||||
{
|
||||
set(F_KILLPROVV, "X");
|
||||
disable(F_KILLPROVV);
|
||||
}
|
||||
else
|
||||
{
|
||||
enable(F_KILLPROVV);
|
||||
set(F_KILLPROVV, " ");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// TSkeleton_application
|
||||
///////////////////////////////////////
|
||||
class THardy_elab_docs : public TSkeleton_application
|
||||
{
|
||||
|
||||
protected:
|
||||
//metodi alto livello
|
||||
void elabora(const TMask& mask);
|
||||
int kill_provv_nac(const TMask& mask);
|
||||
long genera_recordset(const TMask& mask, TISAM_recordset& recset);
|
||||
void elabora_documenti(const TMask& mask, TISAM_recordset& recset, TLog_report& log);
|
||||
|
||||
//metodi medio livello
|
||||
bool aggiorna_contratti_anticipo(const TString& rdoc_codart, const real& rdoc_qta, TDocumento& contratto);
|
||||
bool aggiorna_contratti_posticipo(const TString& rdoc_codart, const real& rdoc_qta, TDocumento& contratto);
|
||||
bool aggiorna_contratti(TDocumento& curr_doc, TArray& contratti_cliente);
|
||||
bool genera_nac(const TMask& mask, TArray& contratti_cliente, TArray& documenti_cliente, TLog_report& log);
|
||||
|
||||
//metodi basso livello
|
||||
int find_contratti_cliente(const long codcf, const TMask& mask, TArray& contratti_cliente);
|
||||
void check_date(const TDate& datafine, TDate& dataini);
|
||||
int find_numerazioni(const TString& tipo_to_elab, TString_array& num_doc);
|
||||
|
||||
public:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
};
|
||||
|
||||
//metodo per ricavare la data iniziale di elaborazione qualora l'utonto non la metta e l'esercizio da usare
|
||||
void THardy_elab_docs::check_date(const TDate& datafine, TDate& dataini)
|
||||
{
|
||||
TEsercizi_contabili esc;
|
||||
TDate datafine_tmp = datafine;
|
||||
const int esercizio = esc.date2esc(datafine);
|
||||
esc.code2range(esercizio, dataini, datafine_tmp);
|
||||
}
|
||||
|
||||
int THardy_elab_docs::find_numerazioni(const TString& tipo_to_elab, TString_array& num_doc)
|
||||
{
|
||||
TISAM_recordset num_recset("USE %NUM");
|
||||
for (bool ok = num_recset.move_first(); ok; ok = num_recset.move_next()) //giro sui vari tipi numerazione
|
||||
{
|
||||
const TString4 codtab = num_recset.get("CODTAB").as_string();
|
||||
|
||||
const TCodice_numerazione numerazione(codtab);
|
||||
for (int t = numerazione.ntipi_doc() - 1; t >= 0; t--)
|
||||
{
|
||||
const TString& tipo_doc = numerazione.tipo_doc(t);
|
||||
if (tipo_doc == tipo_to_elab)
|
||||
{
|
||||
if (num_doc.find(codtab) < 0) // Evito aggiunta di doppioni
|
||||
num_doc.add(codtab);
|
||||
break;
|
||||
}
|
||||
} //for (int t = codnum..
|
||||
} //for (bool ok = num_recset...
|
||||
|
||||
return num_doc.items();
|
||||
}
|
||||
|
||||
|
||||
//metodo per accoppare tutte le NAC provvisorie generate in precedenza
|
||||
int THardy_elab_docs::kill_provv_nac(const TMask& mask)
|
||||
{
|
||||
int nac_killed = 0;
|
||||
const TDate& adata = mask.get_date(F_ADATA);
|
||||
int anno = adata.year();
|
||||
|
||||
TConfig config(CONFIG_DITTA, "ha");
|
||||
|
||||
TToken_string numerazioni;
|
||||
numerazioni.add(config.get("NaAntNum"));
|
||||
numerazioni.add(config.get("NaRifaNum"));
|
||||
numerazioni.add(config.get("NaPostNum"));
|
||||
|
||||
FOR_EACH_TOKEN(numerazioni, codnum)
|
||||
{
|
||||
TRelation rel_doc(LF_DOC);
|
||||
|
||||
TRectype& rec = rel_doc.curr();
|
||||
rec.put(DOC_PROVV, "P");
|
||||
rec.put(DOC_ANNO, anno);
|
||||
rec.put(DOC_CODNUM, codnum);
|
||||
|
||||
TCursor cur_doc (&rel_doc, "", 1, &rec, &rec);
|
||||
const long items = cur_doc.items();
|
||||
cur_doc.freeze();
|
||||
TProgind progind(items, "Eliminazione NAC provvisorie in corso...", false, true);
|
||||
|
||||
for (cur_doc = 0; cur_doc.pos() < items; ++cur_doc)
|
||||
{
|
||||
progind.addstatus(1);
|
||||
TDocumento doc(rec);
|
||||
int err = doc.remove();
|
||||
if (err == NOERR)
|
||||
nac_killed++;
|
||||
}
|
||||
}
|
||||
return nac_killed;
|
||||
}
|
||||
|
||||
//metodo che filtra tutti i documenti in base ai parametri della maschera
|
||||
long THardy_elab_docs::genera_recordset(const TMask& mask, TISAM_recordset& recset)
|
||||
{
|
||||
//parametri di elaborazione
|
||||
//per prima cosa controlla se il cliente è stato specificato; questo influisce sulla scelta della chiave di ricerca sul file
|
||||
int key = 3;
|
||||
const long codcf = mask.get_long(F_CODCF);
|
||||
if (codcf > 0)
|
||||
key = 2;
|
||||
|
||||
//e costruiamola 'sta query!
|
||||
//usa i documenti con chiave variabile (vedi sopra)
|
||||
TString query;
|
||||
query << "USE DOC KEY " << key;
|
||||
//lo stato dipende da quanto sta scritto sulla elaborazione differita (stato iniziale dei docs da considerare)
|
||||
//viene messo CODNUM nella SELECT perchè, essendoci un range di date nelle chiavi, la numerazione verrebbe ignorata! (provato!)
|
||||
query << "\nSELECT (STATO=#STATOINI)";
|
||||
|
||||
//in base al tipo documento che si deve elaborare (settato in configurazione), ci possono essere più numerazioni da considerare!
|
||||
TConfig config(CONFIG_DITTA, "ha");
|
||||
const TString& tipo_to_elab = config.get("TipoFatt");
|
||||
//e adesso cerca le numerazioni che contengono il tipo preso dalla configurazione
|
||||
TString_array num_doc;
|
||||
const int numerazioni_valide = find_numerazioni(tipo_to_elab, num_doc);
|
||||
if (numerazioni_valide > 0)
|
||||
{
|
||||
query << "&&(";
|
||||
|
||||
for (int i = 0; i < numerazioni_valide; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
query << "||";
|
||||
|
||||
query << "(CODNUM='" << num_doc[i] << "')";
|
||||
}
|
||||
|
||||
query << ")";
|
||||
}
|
||||
//se c'è l'agente specificato...
|
||||
const TString& agente = mask.get(F_CODAGE);
|
||||
const bool has_007 = agente.full();
|
||||
if (has_007)
|
||||
query << "&&(CODAG=#CODAG)";
|
||||
//ordinamento agente-codcf-numdoc
|
||||
query << "\nBY ";
|
||||
if (has_007)
|
||||
query << DOC_CODAG << " ";
|
||||
|
||||
query << DOC_CODCF << " " << DOC_NDOC;
|
||||
|
||||
//from-to dipendente da chiave
|
||||
switch (key)
|
||||
{
|
||||
case 2: //chiave per tipocf-codcf-provv-anno-datadoc-codnum
|
||||
{
|
||||
query << "\nFROM TIPOCF=C CODCF=#CODCF PROVV=D ANNO=#ANNO DATADOC=#DADATA";
|
||||
query << "\nTO TIPOCF=C CODCF=#CODCF PROVV=D ANNO=#ANNO DATADOC=#ADATA";
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: //chiave per datadoc-provv-anno-codnum
|
||||
{
|
||||
query << "\nFROM DATADOC=#DADATA PROVV=D ANNO=#ANNO";
|
||||
query << "\nTO DATADOC=#ADATA PROVV=D ANNO=#ANNO";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//setta la nuova query al recordset (inizialmente nato dequeryzzato)
|
||||
recset.set(query);
|
||||
|
||||
//settaggio delle variabili
|
||||
const TDate adata = mask.get_date(F_ADATA);
|
||||
TDate dadata = mask.get_date(F_DADATA);
|
||||
//se la data iniziale è vuota deve coincidere con l'inizio dell'esercizio della data finale (obbligatoria!)
|
||||
int esc = adata.year();
|
||||
if (!dadata.ok())
|
||||
check_date(adata, dadata);
|
||||
|
||||
//lo stato dei documenti da considerare va a raccatarlo nel config
|
||||
const TString& stato_ini = config.get("StatoIniFatt");
|
||||
recset.set_var("#STATOINI", stato_ini);
|
||||
|
||||
if (agente.full())
|
||||
recset.set_var("#CODAG", agente);
|
||||
if (codcf > 0)
|
||||
recset.set_var("#CODCF", codcf);
|
||||
recset.set_var("#ANNO", long(esc));
|
||||
recset.set_var("#DADATA", dadata);
|
||||
recset.set_var("#ADATA", adata);
|
||||
|
||||
return recset.items();
|
||||
}
|
||||
|
||||
//metodo che riempie un array con tutti i contratti del cliente passatogli (in base alla tipologia di contratti da elaborare)
|
||||
int THardy_elab_docs::find_contratti_cliente(const long codcf, const TMask& mask, TArray& contratti_cliente)
|
||||
{
|
||||
contratti_cliente.destroy();
|
||||
//deve cercare tutti i contratti del cliente e metterli nell'array
|
||||
TString query;
|
||||
query << "USE DOC KEY 4";
|
||||
query << "\nSELECT ((CODNUM=#A_CODNUM)||(CODNUM=#R_CODNUM)||(CODNUM=#P_CODNUM))";
|
||||
query << "\nFROM TIPOCF=C CODCF=#CODCF";
|
||||
query << "\nTO TIPOCF=C CODCF=#CODCF";
|
||||
|
||||
TISAM_recordset recset(query);
|
||||
|
||||
//settaggio delle variabili
|
||||
//il codice numerazione lo trova nella configurazione Hardy, e lo deve scegliere in base alla tipologia di contratti che sta esaminando!
|
||||
TConfig config(CONFIG_DITTA, "ha");
|
||||
|
||||
const TString& num_ant = config.get("CoAntNum");
|
||||
const TString& num_rifa = config.get("CoRifaNum");
|
||||
const TString& num_post = config.get("CoPostNum");
|
||||
|
||||
recset.set_var("#A_CODNUM", num_ant);
|
||||
recset.set_var("#R_CODNUM", num_rifa);
|
||||
recset.set_var("#P_CODNUM", num_post);
|
||||
|
||||
recset.set_var("#CODCF", codcf);
|
||||
|
||||
const long n_contratti = recset.items(); //questo serve solo al sagace programmatore
|
||||
|
||||
//aggiunge i contratti all'array: solo quelli in auge nel periodo di calcolo selezionato sulla maschera!
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
//controlla il tipo di contratto
|
||||
const char tipo_contr = recset.get(DOC_TIPOCFFATT).as_string()[0];
|
||||
|
||||
//contratti anticipo 'A': datainizio esiste sempre, datafine non esiste (va ad esaurimento)
|
||||
//contratti posticipo 'P': datainizio esiste sempre, datafine può non esistere
|
||||
//contratti rifatturazione 'R': come contratti anticipo
|
||||
|
||||
//controlla validità del contratto con le date scelte per l'elaborazione dei documenti
|
||||
const TDate data_ini_contratto = recset.get(DOC_DATACOMP).as_date();
|
||||
|
||||
TDate data_ini_elab = mask.get_date(F_DADATA);
|
||||
const TDate data_fine_elab = mask.get_date(F_ADATA);
|
||||
if (!data_ini_elab.ok())
|
||||
check_date(data_fine_elab, data_ini_elab);
|
||||
|
||||
//quindi la datainizio vale per tutti allo stesso modo (è obbligatoria nei contratti)
|
||||
//se l'elaborazione finisce prima che cominci il contratto -> il contratto non serve a nulla
|
||||
if (data_ini_contratto > data_fine_elab)
|
||||
continue;
|
||||
//la data fine vale invece solo per i contratti 'P' e potrebbe non esserci (contratti senza scadenza)
|
||||
TDate data_fine_contratto;
|
||||
if (tipo_contr == 'P')
|
||||
{
|
||||
data_fine_contratto = recset.get(DOC_DATAFCOMP).as_date();
|
||||
if (data_fine_contratto.ok())
|
||||
{
|
||||
if (data_fine_contratto < data_ini_elab)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
TDocumento* curr_contratto = new TDocumento(recset.get(DOC_PROVV).as_string()[0], recset.get(DOC_ANNO).as_int(),
|
||||
recset.get(DOC_CODNUM).as_string(), recset.get(DOC_NDOC).as_int());
|
||||
contratti_cliente.add(curr_contratto);
|
||||
}
|
||||
|
||||
return contratti_cliente.items();
|
||||
}
|
||||
|
||||
|
||||
bool THardy_elab_docs::aggiorna_contratti_anticipo(const TString& rdoc_codart, const real& rdoc_qta, TDocumento& contratto)
|
||||
{
|
||||
bool elaborato = false;
|
||||
|
||||
FOR_EACH_PHYSICAL_RDOC(contratto, rm, rigamerce)
|
||||
{
|
||||
const TString& rigamerce_codart = rigamerce->get(RDOC_CODART);
|
||||
//se trova il codart in una delle righe di contratto...
|
||||
if (rdoc_codart == rigamerce_codart)
|
||||
{
|
||||
const real rigamerce_premio = rigamerce->get_real(RC_1_PREMIO);
|
||||
//se il premio non è nullo procede all'aggiornamento del restituito
|
||||
if (rigamerce_premio != ZERO)
|
||||
{
|
||||
//aggiornamento delle righe di tipo spesa (verigH02) per aggiornare le somme restituite
|
||||
FOR_EACH_PHYSICAL_RDOC(contratto, ra, rigacontratto)
|
||||
{
|
||||
//cerca una riga anticipo da evadere sul contratto per aggiornare la somma restituita sull'anticipo
|
||||
if (rigacontratto->is_spese())
|
||||
{
|
||||
//usa qtagg3 come campo di appoggio per il calcolo della somma restituita dovuta al contratto (parte da zero per ogni elaborazione di NAC)
|
||||
real somma_restituita = rigacontratto->get_real(RCA_2_RESTITUITO);
|
||||
//la somma restituita deve essere incrementata per la qta di merce (caffè) che c'è sulla riga della fattura in esame...
|
||||
//..moltiplicata per il premio che c'è nella riga di tipo merce del contratto in esame
|
||||
somma_restituita += rdoc_qta * rigamerce_premio;
|
||||
rigacontratto->put(RCA_2_RESTITUITO, somma_restituita);
|
||||
elaborato = true;
|
||||
}
|
||||
} //FOR_EACH_PHYSICAL.. fine casino sulla riga di tipo spese
|
||||
|
||||
if (rigamerce->is_merce())
|
||||
{
|
||||
real somma_bonus = rigamerce->get_real(RC_1_BONUS);
|
||||
somma_bonus += rdoc_qta * rigamerce_premio;
|
||||
rigamerce->put(RC_1_BONUS, somma_bonus);
|
||||
elaborato = true;
|
||||
}
|
||||
}
|
||||
|
||||
//aggiornamento delle quantità per le righe di tipo merce (verigH01)
|
||||
if (rigamerce->is_merce())
|
||||
{
|
||||
real qta_tot = rigamerce->get_real(RDOC_QTA); //prende la qta tot dal contratto (è usato un campo di appoggio RDOC_QTA)
|
||||
qta_tot += rdoc_qta; //aggiunge la qta della riga documento
|
||||
rigamerce->put(RDOC_QTA, qta_tot); //riscrive sul campo di appoggio del contratto
|
||||
}
|
||||
|
||||
} //if(rdoc_codart...
|
||||
} //FOR_EACH_PHYSICAL..
|
||||
return elaborato;
|
||||
}
|
||||
|
||||
|
||||
bool THardy_elab_docs::aggiorna_contratti_posticipo(const TString& rdoc_codart, const real& rdoc_qta, TDocumento& contratto)
|
||||
{
|
||||
bool elaborato = false;
|
||||
|
||||
FOR_EACH_PHYSICAL_RDOC(contratto, rm, rigamerce)
|
||||
{
|
||||
const TString& rigamerce_codart = rigamerce->get(RDOC_CODART);
|
||||
//se trova il codart in una delle righe di contratto...
|
||||
if (rdoc_codart == rigamerce_codart)
|
||||
{
|
||||
const real rigamerce_premio = rigamerce->get_real(RC_1_PREMIO);
|
||||
//..aggiorna direttamente il bonus totale per l'articolo presente sulla riga
|
||||
if (rigamerce_premio != ZERO)
|
||||
{
|
||||
//usa QTAGG3 come campo di appoggio per il calcolo della somma restituita dovuta al contratto (parte da zero per ogni elaborazione di NAC)
|
||||
real somma_bonus = rigamerce->get_real(RC_1_BONUS);
|
||||
somma_bonus += rdoc_qta * rigamerce_premio;
|
||||
rigamerce->put(RC_1_BONUS, somma_bonus);
|
||||
elaborato = true;
|
||||
} //if(rigamerce...
|
||||
|
||||
//aggiornamento delle righe di tipo merce (verigH01)
|
||||
if (rigamerce->is_merce())
|
||||
{
|
||||
real qta_tot = rigamerce->get_real(RDOC_QTA);
|
||||
qta_tot += rdoc_qta;
|
||||
rigamerce->put(RDOC_QTA, qta_tot);
|
||||
}
|
||||
|
||||
} //if(rdoc_codart...
|
||||
} //FOR_EACH_PHYSICAL..
|
||||
return elaborato;
|
||||
}
|
||||
|
||||
//aggiorna, in base al documento in esame curr_doc, le somme restituite nelle righe di tipo verigh02 nei contratti validi..
|
||||
//..del cliente
|
||||
bool THardy_elab_docs::aggiorna_contratti(TDocumento& curr_doc, TArray& contratti_cliente)
|
||||
{
|
||||
bool elaborato = false;
|
||||
|
||||
FOR_EACH_PHYSICAL_RDOC(curr_doc, r, rdoc) if (rdoc->is_merce()) //giro su tutte le righe merce delle fatture
|
||||
{
|
||||
TString80 rdoc_codart = rdoc->get(RDOC_CODART); //non si riesce ad usare un TString& perchè lo perde dopo un pò
|
||||
rdoc_codart.trim();
|
||||
const real rdoc_qta = rdoc->quantita();
|
||||
|
||||
//controlla se il codart della riga esiste in uno dei contratti validi
|
||||
for (int i = 0; i < contratti_cliente.items(); i++)
|
||||
{
|
||||
TDocumento& contratto = (TDocumento&)contratti_cliente[i];
|
||||
const TString& tipo_contratto = contratto.get(DOC_TIPOCFFATT);
|
||||
|
||||
//in base al tipo di contratto (Anticipo/Posticipo/Rifatturazione) decide cosa fare
|
||||
if (tipo_contratto == "A" || tipo_contratto == "R")
|
||||
{
|
||||
elaborato |= aggiorna_contratti_anticipo(rdoc_codart, rdoc_qta, contratto);
|
||||
} //if(tipo_contratto...
|
||||
else if (tipo_contratto == "P")
|
||||
{
|
||||
elaborato |= aggiorna_contratti_posticipo(rdoc_codart, rdoc_qta, contratto);
|
||||
}
|
||||
} //for(int i..
|
||||
} //FOR_EACH...
|
||||
|
||||
return elaborato;
|
||||
}
|
||||
|
||||
|
||||
bool THardy_elab_docs::genera_nac(const TMask& mask, TArray& contratti_cliente, TArray& documenti_cliente, TLog_report& log)
|
||||
{
|
||||
//si informa se l'elaborazione è definitiva o meno
|
||||
const bool definitivo = mask.get_bool(F_DEFINITIVO);
|
||||
|
||||
//giro su tutti i contratti del cliente che stanno nell'array (ogni contratto genera una NAC)
|
||||
FOR_EACH_ARRAY_ITEM(contratti_cliente, r, riga)
|
||||
{
|
||||
TDocumento& contratto = *(TDocumento*)riga;
|
||||
const long ndoc = contratto.numero(); //il numdoc del contratto serve nelle segnalazioni
|
||||
const long codcf = contratto.codcf(); //il codice cliente ci serve nella generazione della NAC..
|
||||
const char tipo_contratto = contratto.get(DOC_TIPOCFFATT)[0]; //..e pure il tipo di contratto in esame!
|
||||
|
||||
//segnaliamo l'elaborazione del contratto sul log
|
||||
TString msg;
|
||||
msg << "Elaborato contratto premi n." << ndoc << " del cliente " << codcf;
|
||||
log.log(0, msg);
|
||||
|
||||
|
||||
// generazione del documento NAC dal contratto
|
||||
// -------------------------------------------
|
||||
|
||||
// TESTATA
|
||||
|
||||
//alcuni parametri delle righe vanno presi dalla configurazione
|
||||
TConfig config(CONFIG_DITTA, "ha");
|
||||
TString4 nac_codnum, nac_tipo;
|
||||
TString8 cod_riga;
|
||||
switch (tipo_contratto)
|
||||
{
|
||||
case 'A':
|
||||
nac_codnum = config.get("NaAntNum");
|
||||
nac_tipo = config.get("NaAntTip");
|
||||
cod_riga = config.get("NaAntSpe");
|
||||
break;
|
||||
case 'R':
|
||||
nac_codnum = config.get("NaRifaNum");
|
||||
nac_tipo = config.get("NaRifaTip");
|
||||
cod_riga = config.get("NaRifaSpe");
|
||||
break;
|
||||
default:
|
||||
nac_codnum = config.get("NaPostNum");
|
||||
nac_tipo = config.get("NaPostTip");
|
||||
cod_riga = config.get("NaPostSpe");
|
||||
break;
|
||||
}
|
||||
|
||||
const int anno = mask.get_date(F_ADATA).year();
|
||||
//solo in caso di elaborazione definitiva si scrivono NAC di tipo D; sennò di tipo P, che sono uccidibili..
|
||||
//..all'inizio di ogni nuova elaborazione
|
||||
char provv = 'P';
|
||||
if (definitivo)
|
||||
provv = 'D';
|
||||
|
||||
TDocumento nac(provv, anno, nac_codnum, 0); //num_doc = 0 perchè viene aggiornato in fase di registrazione
|
||||
nac.set_tipo(nac_tipo);
|
||||
nac.put(DOC_STATO, 1);
|
||||
nac.put(DOC_DATADOC, mask.get(F_DATAELAB));
|
||||
nac.put(DOC_TIPOCF, 'C');
|
||||
nac.put(DOC_CODCF, codcf);
|
||||
|
||||
|
||||
// RIGHE
|
||||
|
||||
//ogni riga di tipo merce (verigh01) del contratto origina una riga della NAC
|
||||
//noto il codice di riga spesa (che farà le veci del codart), troviamo il tipo riga dalla tabella SPP e tutte le features che servono
|
||||
const TRectype& rec_spp = cache().get("SPP", cod_riga);
|
||||
const TString4 tipo_riga = rec_spp.get("S8");
|
||||
const TString80 descr_riga_spp = rec_spp.get("S0");
|
||||
const TString4 codiva = rec_spp.get("S3");
|
||||
|
||||
//giro sulle righe del contratto, che originano le righe NAC
|
||||
for (int i = 1; i <= contratto.rows(); i++)
|
||||
{
|
||||
const TRiga_documento& riga_contratto = contratto[i]; //le righe di un documento partono da 1! (standard del mercoledì)
|
||||
const TString& tiporiga = riga_contratto.get(RDOC_TIPORIGA);
|
||||
const TString& tipo_riga_contratto = cache().get("%TRI", tiporiga, "S7");
|
||||
|
||||
//solo le righe di tipo merce (verigh01) dei contratti devono comparire nelle NAC
|
||||
if (tipo_riga_contratto == "M")
|
||||
{
|
||||
TString80 riga_contratto_codart = riga_contratto.get(RDOC_CODART);
|
||||
riga_contratto_codart.trim();
|
||||
const real riga_contratto_bonus = riga_contratto.get_real(RDOC_QTAGG3);
|
||||
if (riga_contratto_bonus != ZERO)
|
||||
int cazzone = 1;
|
||||
const real riga_contratto_qta = riga_contratto.get_real(RDOC_QTA);
|
||||
const TString4 riga_contratto_um = riga_contratto.get(RDOC_UMQTA);
|
||||
const real riga_contratto_premio = riga_contratto.get_real(RC_1_PREMIO);
|
||||
|
||||
// riga (dovrebbe essere un'unica riga per NAC, il cui valore sta in QTAGG3 ed è stato calcolato nella aggiorna_contratti())
|
||||
TRiga_documento& nac_row = nac.new_row(tipo_riga);
|
||||
nac_row.put(RDOC_NRIGA, i);
|
||||
nac_row.put(RDOC_CODART, cod_riga);
|
||||
|
||||
//panegirico della descrizione
|
||||
nac_row.put(RDOC_DESCR, descr_riga_spp);
|
||||
|
||||
msg.cut(0); //risparmiamo sulle stringhe, mica sono gratis
|
||||
const TDate adata = mask.get_date(F_ADATA);
|
||||
TDate dadata = mask.get_date(F_DADATA);
|
||||
if (!dadata.ok())
|
||||
check_date(adata, dadata);
|
||||
|
||||
msg << " " << dadata << " -- " << adata << " --(Art." << riga_contratto_codart << ")";
|
||||
nac_row.put(RDOC_DESCEST, msg);
|
||||
nac_row.put(RDOC_DESCLUNGA, "X");
|
||||
|
||||
//importi, qta, umqta
|
||||
nac_row.put(RDOC_UMQTA, riga_contratto_um);
|
||||
nac_row.put(RDOC_QTA, riga_contratto_qta);
|
||||
nac_row.put(RDOC_PREZZO, riga_contratto_premio);
|
||||
|
||||
//iva
|
||||
nac_row.put(RDOC_CODIVA, codiva);
|
||||
}
|
||||
}
|
||||
|
||||
// salvataggi vari
|
||||
// ---------------
|
||||
//la NAC viene scritta comunque, con provv='D' se elaborazione definitiva
|
||||
int err = nac.write();
|
||||
|
||||
msg.cut(0); //la fase di risparmio stringhe continua
|
||||
if (err == NOERR)
|
||||
msg << "Generata NAC ";
|
||||
else
|
||||
msg << "Impossibile generare NAC ";
|
||||
msg << " - provv:" << provv << " - num:" << nac_codnum << " - tipo:" << nac_tipo << " - anno:" << anno << " |" << r;
|
||||
log.log(0, msg);
|
||||
|
||||
// se non ci sono errori -> in caso di elaborazione definitiva procede alla registrazione..
|
||||
//.. del contratto (ricordiamo che in memoria il contratto ha già le righe aggiornate
|
||||
if (definitivo && err == NOERR)
|
||||
{
|
||||
//prima di registrare il contratto vanno svuotati i campi appoggio sulle righe che sono stati usati..
|
||||
//..per qta e premi vari e riempiti nella aggiorna_contratti()
|
||||
for (int i = 1; i <= contratto.rows(); i++)
|
||||
{
|
||||
TRiga_documento& riga_contratto = contratto[i];
|
||||
riga_contratto.put(RDOC_QTAGG3, ZERO);
|
||||
riga_contratto.put(RDOC_QTA, ZERO);
|
||||
}
|
||||
|
||||
//alla fine della fiera aggiorna il contratto
|
||||
err = contratto.rewrite();
|
||||
msg.cut(0);
|
||||
if (err == NOERR)
|
||||
msg << "Aggiornato contratto premi n. ";
|
||||
else
|
||||
msg << "Impossibile aggiornare il contratto premi n. ";
|
||||
|
||||
msg << ndoc << " del cliente " << codcf;
|
||||
log.log(0, msg);
|
||||
}
|
||||
|
||||
log.log(0, "");
|
||||
|
||||
} //FOR_EACH_ARRAY_ITEM(... giro sui contratti cliente
|
||||
|
||||
|
||||
//il metodo ritornerà il successo o meno della registrazione
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void THardy_elab_docs::elabora_documenti(const TMask& mask, TISAM_recordset& recset, TLog_report& log)
|
||||
{
|
||||
TProgind pi(recset.items(), TR("Elaborazione documenti in corso..."), true, true);
|
||||
|
||||
//inizializza variabili da usare nella scansione del recordset
|
||||
long old_codcf = 0L;
|
||||
//array con l'insieme dei contratti e dei documenti elaborati per un singolo cliente!
|
||||
TArray contratti_cliente, documenti_cliente;
|
||||
|
||||
//giro sulle fatture (è il giro di più alto livello che viene esteso all'interno delle aggiorna_contratti)
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
|
||||
const long codcf = recset.get(DOC_CODCF).as_int();
|
||||
//al cambio cliente deve controllare i contratti di quel cliente nel periodo di elaborazione!!
|
||||
if (codcf != old_codcf)
|
||||
{
|
||||
//aggiorna old_codcf in modo da poter controllare i contratti solo al cambio codcf
|
||||
old_codcf = codcf;
|
||||
|
||||
const int n_contratti = find_contratti_cliente(codcf, mask, contratti_cliente);
|
||||
if (n_contratti == 0)
|
||||
{
|
||||
TString msg;
|
||||
msg << "Il cliente " << codcf << " non ha un contratto premi valido nel periodo di elaborazione selezionato ma ha fatture.";
|
||||
log.log_error(msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (contratti_cliente.items() > 0)
|
||||
{
|
||||
//se ha trovato uno o più contratti validi nel periodo passa alla elaborazione dei documenti del cliente
|
||||
TDocumento* curr_doc = new TDocumento(recset.cursor()->curr());
|
||||
//elabora il documento corrente aggiornando le somme restituite sui contratti validi
|
||||
if (aggiorna_contratti(*curr_doc, contratti_cliente))
|
||||
documenti_cliente.add(curr_doc);
|
||||
else
|
||||
delete(curr_doc);
|
||||
}
|
||||
} //for (bool ok = recset.move_first()...
|
||||
|
||||
//generazione NAC (una per contratto cliente)
|
||||
genera_nac(mask, contratti_cliente, documenti_cliente, log);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//metodo di alto livello con i punti principali del programma (come da analisi...)
|
||||
void THardy_elab_docs::elabora(const TMask& mask)
|
||||
{
|
||||
//1) eventuale accoppamento di tutti i documenti provvisori creati con precedenti elaborazioni precedenti
|
||||
int nac_killed = 0;
|
||||
if (mask.get_bool(F_KILLPROVV))
|
||||
nac_killed = kill_provv_nac(mask);
|
||||
|
||||
//log report con segnalazioni sui clienti trattati (bene o male)
|
||||
TLog_report log("Sintesi elaborazione");
|
||||
log.kill_duplicates();
|
||||
log.log(0, "");
|
||||
|
||||
//2) recordset ordinato codag-codcf-numdoc con tutti i docs che soddisfano i parametri dell'utente
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
TISAM_recordset recset("");
|
||||
const long items = genera_recordset(mask, recset);
|
||||
if (items == 0)
|
||||
{
|
||||
log.log(1, "Non esistono documenti di vendita che soddisfino i parametri selezionati! Ritenta sarai più fortunato!");
|
||||
}
|
||||
|
||||
//3) elaborazione documenti e contratti, generazione NAC, salvataggi
|
||||
// ---------------------------------------------------------------
|
||||
elabora_documenti(mask, recset, log);
|
||||
|
||||
//3) scrittura log
|
||||
// -------------
|
||||
log.print_or_preview();
|
||||
}
|
||||
|
||||
void THardy_elab_docs::main_loop()
|
||||
{
|
||||
THardy_elab_docs_mask mask;
|
||||
while (mask.run() == K_ENTER)
|
||||
{
|
||||
elabora(mask);
|
||||
}
|
||||
}
|
||||
|
||||
bool THardy_elab_docs::create()
|
||||
{
|
||||
//controlla se la chiave ha l'autorizzazione a questo programma (solo per hardy!)
|
||||
Tdninst dninst;
|
||||
if (!dninst.can_I_run(true))
|
||||
return error_box(TR("Programma non autorizzato!"));
|
||||
|
||||
open_files(LF_DOC, LF_RIGHEDOC, 0);
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
int ha0500 (int argc, char* argv[])
|
||||
{
|
||||
THardy_elab_docs main_app;
|
||||
main_app.run(argc, argv, TR("Elaborazione documenti Hardy"));
|
||||
return true;
|
||||
}
|
15
ha/ha0500a.h
Executable file
15
ha/ha0500a.h
Executable file
@ -0,0 +1,15 @@
|
||||
#define F_CODAGE 201
|
||||
#define F_DESCRAGE 202
|
||||
#define F_TIPOCF 203
|
||||
#define F_CODCF 204
|
||||
#define F_RAGSOC 205
|
||||
#define F_DADATA 206
|
||||
#define F_ADATA 207
|
||||
//#define F_TIPOCONTR 208
|
||||
//#define F_CODNUM_NAC 210
|
||||
//#define F_DESCRNUM_NAC 211
|
||||
//#define F_CODTIPO_NAC 212
|
||||
//#define F_DESCRTIPO_NAC 213
|
||||
#define F_DATAELAB 214
|
||||
#define F_DEFINITIVO 215
|
||||
#define F_KILLPROVV 216
|
167
ha/ha0500a.uml
Executable file
167
ha/ha0500a.uml
Executable file
@ -0,0 +1,167 @@
|
||||
#include "ha0500a.h"
|
||||
|
||||
PAGE "Elaborazione documenti Hardy" -1 -1 78 11
|
||||
|
||||
GROUPBOX DLG_NULL 76 5
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bParametri documenti"
|
||||
END
|
||||
|
||||
STRING F_CODAGE 6
|
||||
BEGIN
|
||||
PROMPT 2 2 "Agente "
|
||||
FLAGS "U"
|
||||
USE LF_AGENTI
|
||||
INPUT CODAGE F_CODAGE
|
||||
DISPLAY "Codice" CODAGE
|
||||
DISPLAY "Descrizione@50" RAGSOC
|
||||
OUTPUT F_CODAGE CODAGE
|
||||
OUTPUT F_DESCRAGE RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESCRAGE 50
|
||||
BEGIN
|
||||
PROMPT 22 2 ""
|
||||
USE LF_AGENTI KEY 2
|
||||
INPUT RAGSOC F_DESCRAGE
|
||||
DISPLAY "Descrizione@50" RAGSOC
|
||||
DISPLAY "Codice" CODAGE
|
||||
COPY OUTPUT F_CODAGE
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_CODCF 6
|
||||
BEGIN
|
||||
PROMPT 2 3 "Cliente "
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCF
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
OUTPUT F_CODCF CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 22 3 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
DISPLAY "Codice" CODCF
|
||||
COPY OUTPUT F_CODCF
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
DATE F_DADATA
|
||||
BEGIN
|
||||
PROMPT 2 4 "Da data "
|
||||
END
|
||||
|
||||
DATE F_ADATA
|
||||
BEGIN
|
||||
PROMPT 22 4 "A data "
|
||||
CHECKTYPE REQUIRED
|
||||
VALIDATE DATE_CMP_FUNC >= F_DADATA
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 3
|
||||
BEGIN
|
||||
PROMPT 1 6 "@bParametri elaborazione"
|
||||
END
|
||||
|
||||
DATE F_DATAELAB
|
||||
BEGIN
|
||||
PROMPT 2 7 "Data elaborazione "
|
||||
FLAGS "A"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
BOOLEAN F_DEFINITIVO
|
||||
BEGIN
|
||||
PROMPT 40 7 "Definitivo"
|
||||
END
|
||||
|
||||
/*RADIOBUTTON F_TIPOCONTR 1 72
|
||||
BEGIN
|
||||
PROMPT 2 8 "@bTipi contratto da elaborare"
|
||||
ITEM "A|Anticipo"
|
||||
ITEM "P|Posticipo"
|
||||
ITEM "R|Rifatturazione"
|
||||
FLAGS "Z"
|
||||
END
|
||||
|
||||
STRING F_CODNUM_NAC 4
|
||||
BEGIN
|
||||
PROMPT 2 11 "Num. doc. NAC "
|
||||
USE %NUM
|
||||
INPUT CODTAB F_CODNUM_NAC
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODNUM_NAC CODTAB
|
||||
OUTPUT F_DESCRNUM_NAC S0
|
||||
FLAGS "DG"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DESCRNUM_NAC 50 43
|
||||
BEGIN
|
||||
PROMPT 29 11 ""
|
||||
USE %NUM KEY 2
|
||||
INPUT S0 F_DESCRNUM_NAC
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice@8" CODTAB
|
||||
COPY OUTPUT F_CODNUM_NAC
|
||||
FLAGS "DG"
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_CODTIPO_NAC 4
|
||||
BEGIN
|
||||
PROMPT 2 12 "Tipo doc. NAC "
|
||||
USE %TIP
|
||||
INPUT CODTAB F_CODTIPO_NAC
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODTIPO_NAC CODTAB
|
||||
OUTPUT F_DESCRTIPO_NAC S0
|
||||
FLAGS "DG"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DESCRTIPO_NAC 50 43
|
||||
BEGIN
|
||||
PROMPT 29 12 ""
|
||||
USE %TIP KEY 2
|
||||
INPUT S0 F_DESCRTIPO_NAC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT F_CODTIPO_NAC
|
||||
FLAGS "DG"
|
||||
CHECKTYPE NORMAL
|
||||
END*/
|
||||
|
||||
BOOLEAN F_KILLPROVV
|
||||
BEGIN
|
||||
PROMPT 1 9 "Eliminare tutte le note di accredito provvisorie"
|
||||
END
|
||||
|
||||
STRING DLG_PROFILE 50
|
||||
BEGIN
|
||||
PROMPT 1 -1 "Profilo "
|
||||
PSELECT
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "" 0 0 0 2
|
||||
|
||||
#include <elabar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
20
ha/halib.h
Executable file
20
ha/halib.h
Executable file
@ -0,0 +1,20 @@
|
||||
//definizioni delle righe dei contratti premio Hardy (da includere nei .cpp)
|
||||
#define HARDY_TIPORIGA_MERCE "H01"
|
||||
#define HARDY_TIPORIGA_SOMMA "H02"
|
||||
|
||||
//ridefinizione dei campi per rendere chiare le elaborazioni
|
||||
//legenda per il sagace programmatore:
|
||||
//RC = riga contratto standard, tipo 1, merce
|
||||
//RCA = riga contratto anticipo, tipo 2, spese (1 per ogni contratto anticipo)
|
||||
// 1 = riga tipo 1, merce
|
||||
// 2 = riga tipo 2, spese
|
||||
// segue il vero significato del campo (vero... verosimile, che è meglio!)
|
||||
#define RC_1_PREMIO RDOC_QTAGG1
|
||||
#define RC_1_NSCARICO RDOC_QTAGG2
|
||||
#define RC_1_BONUS RDOC_QTAGG5
|
||||
|
||||
#define RCA_2_ANTICIPATO RDOC_QTAGG4
|
||||
#define RCA_2_RESTITUITO RDOC_QTAGG5
|
||||
|
||||
//#define RC_1_BONUS_NAC RDOC_QTAGG3
|
||||
//#define RC_2_RESO_NAC RDOC_QTAGG3
|
10
ha/hamenu.men
Executable file
10
ha/hamenu.men
Executable file
@ -0,0 +1,10 @@
|
||||
[HAMENU_001]
|
||||
Caption = "Hardy caffe'"
|
||||
Picture = <ha01>
|
||||
Module = 46
|
||||
Flags = "F"
|
||||
Item_01 = "Configurazione Hardy", "ha0 -1", ""
|
||||
Item_02 = "Gestione contratti premio", "ha0 -2", ""
|
||||
Item_03 = "Contabilizzazione contratti premio", "ha0 -3", ""
|
||||
Item_04 = "Generazione NAC", "ha0 -4", ""
|
||||
Item_05 = "Gestione listini", "ve2 -4", ""
|
18
ha/hatabcom.txt
Executable file
18
ha/hatabcom.txt
Executable file
@ -0,0 +1,18 @@
|
||||
[Header]
|
||||
Version=199519
|
||||
File=4
|
||||
Fields=COD,3|CODTAB,25|S0,70|S1,70|S2,70|S3,70|S4,25|S5,25|S6,5|S7,5
|
||||
Fields=S8,5|S9,5|S10,5|S11,5|I0,7|I1,7|I2,7|I3,7|I4,7|I5,7
|
||||
Fields=I6,7|I7,7|I8,7|I9,7|I10,7|I11,7|I12,7|I13,7|I14,7|R0,18
|
||||
Fields=R1,18|R2,18|R3,18|R4,18|R5,18|R6,18|R7,18|R8,18|R9,18|R10,18
|
||||
Fields=R11,18|R12,18|R13,18|R14,18|R15,18|R16,18|R17,18|R18,18|R19,18|R20,18
|
||||
Fields=R21,18|R22,18|R23,18|R24,18|R25,18|R26,18|R27,18|R28,18|R29,18|D0,10
|
||||
Fields=D1,10|D2,10|D3,10|D4,10|B0,1|B1,1|B2,1|B3,1|B4,1|B5,1
|
||||
Fields=B6,1|B7,1|B8,1|B9,1|B10,1|B11,1|B12,1|B13,1|B14,1|B15,1
|
||||
Fields=FPC,1
|
||||
|
||||
[Data]
|
||||
NUM|HCO|Contratto||HCA HCP||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||X|||||||||||||||
|
||||
TIP|HCO|Contratto Hardy||1259||hacontr|hacontr||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
TRI|H01|Merce|||||||M||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
TRI|H02|Somma anticipata|||||||S||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
20
projects/ha.sln
Executable file
20
projects/ha.sln
Executable file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ha0", "ha0.vcxproj", "{2DB7F8EF-BABB-4A27-BC7D-8821B0D285C6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2DB7F8EF-BABB-4A27-BC7D-8821B0D285C6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2DB7F8EF-BABB-4A27-BC7D-8821B0D285C6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2DB7F8EF-BABB-4A27-BC7D-8821B0D285C6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2DB7F8EF-BABB-4A27-BC7D-8821B0D285C6}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
res/moka.ico
Executable file
BIN
res/moka.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 364 KiB |
5077
xvaga/treelistctrl.cpp
Executable file
5077
xvaga/treelistctrl.cpp
Executable file
File diff suppressed because it is too large
Load Diff
552
xvaga/treelistctrl.h
Executable file
552
xvaga/treelistctrl.h
Executable file
@ -0,0 +1,552 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: treelistctrl.h
|
||||
// Purpose: wxTreeListCtrl class
|
||||
// Author: Robert Roebling
|
||||
// Maintainer: Otto Wyss
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id: treelistctrl.h,v 1.1 2010-08-11 12:53:55 guy Exp $
|
||||
// Copyright: (c) 2004 Robert Roebling, Julian Smart, Alberto Griggio,
|
||||
// Vadim Zeitlin, Otto Wyss
|
||||
// Licence: wxWindows
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef TREELISTCTRL_H
|
||||
#define TREELISTCTRL_H
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "treelistctrl.h"
|
||||
#endif
|
||||
#include <wx/treectrl.h>
|
||||
#include <wx/listctrl.h> // for wxListEvent
|
||||
|
||||
class WXDLLEXPORT wxTreeListItem;
|
||||
class WXDLLEXPORT wxTreeListHeaderWindow;
|
||||
class WXDLLEXPORT wxTreeListMainWindow;
|
||||
|
||||
#define wxTR_COLUMN_LINES 0x1000 // put border around items
|
||||
#define wxTR_VIRTUAL 0x4000 // The application provides items text on demand.
|
||||
|
||||
// Using this typedef removes an ambiguity when calling Remove()
|
||||
#ifdef __WXMSW__
|
||||
#if !wxCHECK_VERSION(2, 5, 0)
|
||||
typedef long wxTreeItemIdValue;
|
||||
#else
|
||||
typedef void *wxTreeItemIdValue;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTreeListColumnAttrs
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
DEFAULT_COL_WIDTH = 100
|
||||
};
|
||||
|
||||
class /*WXDLLEXPORT*/ wxTreeListColumnInfo: public wxObject {
|
||||
|
||||
public:
|
||||
wxTreeListColumnInfo (const wxString &text = wxEmptyString,
|
||||
int width = DEFAULT_COL_WIDTH,
|
||||
int flag = wxALIGN_LEFT,
|
||||
int image = -1,
|
||||
bool shown = true,
|
||||
bool edit = false) {
|
||||
m_text = text;
|
||||
m_width = width;
|
||||
m_flag = flag;
|
||||
m_image = image;
|
||||
m_selected_image = -1;
|
||||
m_shown = shown;
|
||||
m_edit = edit;
|
||||
}
|
||||
|
||||
wxTreeListColumnInfo (const wxTreeListColumnInfo& other) {
|
||||
m_text = other.m_text;
|
||||
m_width = other.m_width;
|
||||
m_flag = other.m_flag;
|
||||
m_image = other.m_image;
|
||||
m_selected_image = other.m_selected_image;
|
||||
m_shown = other.m_shown;
|
||||
m_edit = other.m_edit;
|
||||
}
|
||||
|
||||
~wxTreeListColumnInfo() {}
|
||||
|
||||
// get/set
|
||||
wxString GetText() const { return m_text; }
|
||||
wxTreeListColumnInfo& SetText (const wxString& text) { m_text = text; return *this; }
|
||||
|
||||
int GetWidth() const { return m_width; }
|
||||
wxTreeListColumnInfo& SetWidth (int width) { m_width = width; return *this; }
|
||||
|
||||
int GetAlignment() const { return m_flag; }
|
||||
wxTreeListColumnInfo& SetAlignment (int flag) { m_flag = flag; return *this; }
|
||||
|
||||
int GetImage() const { return m_image; }
|
||||
wxTreeListColumnInfo& SetImage (int image) { m_image = image; return *this; }
|
||||
|
||||
int GetSelectedImage() const { return m_selected_image; }
|
||||
wxTreeListColumnInfo& SetSelectedImage (int image) { m_selected_image = image; return *this; }
|
||||
|
||||
bool IsEditable() const { return m_edit; }
|
||||
wxTreeListColumnInfo& SetEditable (bool edit)
|
||||
{ m_edit = edit; return *this; }
|
||||
|
||||
bool IsShown() const { return m_shown; }
|
||||
wxTreeListColumnInfo& SetShown(bool shown) { m_shown = shown; return *this; }
|
||||
|
||||
private:
|
||||
wxString m_text;
|
||||
int m_width;
|
||||
int m_flag;
|
||||
int m_image;
|
||||
int m_selected_image;
|
||||
bool m_shown;
|
||||
bool m_edit;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxTreeListCtrl - the multicolumn tree control
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// modes for navigation
|
||||
const int wxTL_MODE_NAV_FULLTREE = 0x0000; // default
|
||||
const int wxTL_MODE_NAV_EXPANDED = 0x0001;
|
||||
const int wxTL_MODE_NAV_VISIBLE = 0x0002;
|
||||
const int wxTL_MODE_NAV_LEVEL = 0x0004;
|
||||
|
||||
// modes for FindItem
|
||||
const int wxTL_MODE_FIND_EXACT = 0x0000; // default
|
||||
const int wxTL_MODE_FIND_PARTIAL = 0x0010;
|
||||
const int wxTL_MODE_FIND_NOCASE = 0x0020;
|
||||
|
||||
// additional flag for HitTest
|
||||
const int wxTREE_HITTEST_ONITEMCOLUMN = 0x2000;
|
||||
extern /*WXDLLEXPORT*/ const wxChar* wxTreeListCtrlNameStr;
|
||||
|
||||
|
||||
class /*WXDLLEXPORT*/ wxTreeListCtrl : public wxControl
|
||||
{
|
||||
friend class wxTreeListHeaderWindow;
|
||||
friend class wxTreeListMainWindow;
|
||||
friend class wxTreeListItem;
|
||||
public:
|
||||
// creation
|
||||
// --------
|
||||
wxTreeListCtrl()
|
||||
: m_header_win(0), m_main_win(0), m_headerHeight(0)
|
||||
{}
|
||||
|
||||
wxTreeListCtrl(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTR_DEFAULT_STYLE,
|
||||
const wxValidator &validator = wxDefaultValidator,
|
||||
const wxString& name = wxTreeListCtrlNameStr )
|
||||
: m_header_win(0), m_main_win(0), m_headerHeight(0)
|
||||
{
|
||||
Create(parent, id, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
virtual ~wxTreeListCtrl() {}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTR_DEFAULT_STYLE,
|
||||
const wxValidator &validator = wxDefaultValidator,
|
||||
const wxString& name = wxTreeListCtrlNameStr );
|
||||
|
||||
void Refresh(bool erase=TRUE, const wxRect* rect=NULL);
|
||||
void SetFocus();
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// get the total number of items in the control
|
||||
size_t GetCount() const;
|
||||
|
||||
// indent is the number of pixels the children are indented relative to
|
||||
// the parents position. SetIndent() also redraws the control
|
||||
// immediately.
|
||||
unsigned int GetIndent() const;
|
||||
void SetIndent(unsigned int indent);
|
||||
|
||||
// line spacing is the space above and below the text on each line
|
||||
unsigned int GetLineSpacing() const;
|
||||
void SetLineSpacing(unsigned int spacing);
|
||||
|
||||
// image list: these functions allow to associate an image list with
|
||||
// the control and retrieve it. Note that when assigned with
|
||||
// SetImageList, the control does _not_ delete
|
||||
// the associated image list when it's deleted in order to allow image
|
||||
// lists to be shared between different controls. If you use
|
||||
// AssignImageList, the control _does_ delete the image list.
|
||||
//
|
||||
// The normal image list is for the icons which correspond to the
|
||||
// normal tree item state (whether it is selected or not).
|
||||
// Additionally, the application might choose to show a state icon
|
||||
// which corresponds to an app-defined item state (for example,
|
||||
// checked/unchecked) which are taken from the state image list.
|
||||
wxImageList *GetImageList() const;
|
||||
wxImageList *GetStateImageList() const;
|
||||
wxImageList *GetButtonsImageList() const;
|
||||
|
||||
void SetImageList(wxImageList *imageList);
|
||||
void SetStateImageList(wxImageList *imageList);
|
||||
void SetButtonsImageList(wxImageList *imageList);
|
||||
void AssignImageList(wxImageList *imageList);
|
||||
void AssignStateImageList(wxImageList *imageList);
|
||||
void AssignButtonsImageList(wxImageList *imageList);
|
||||
|
||||
void SetToolTip(const wxString& tip);
|
||||
void SetToolTip (wxToolTip *tip);
|
||||
void SetItemToolTip(const wxTreeItemId& item, const wxString &tip);
|
||||
|
||||
// Functions to work with columns
|
||||
|
||||
// adds a column
|
||||
void AddColumn (const wxString& text,
|
||||
int width = DEFAULT_COL_WIDTH,
|
||||
int flag = wxALIGN_LEFT,
|
||||
int image = -1,
|
||||
bool shown = true,
|
||||
bool edit = false) {
|
||||
AddColumn (wxTreeListColumnInfo (text, width, flag, image, shown, edit));
|
||||
}
|
||||
void AddColumn (const wxTreeListColumnInfo& colInfo);
|
||||
|
||||
// inserts a column before the given one
|
||||
void InsertColumn (int before,
|
||||
const wxString& text,
|
||||
int width = DEFAULT_COL_WIDTH,
|
||||
int flag = wxALIGN_LEFT,
|
||||
int image = -1,
|
||||
bool shown = true,
|
||||
bool edit = false) {
|
||||
InsertColumn (before,
|
||||
wxTreeListColumnInfo (text, width, flag, image, shown, edit));
|
||||
}
|
||||
void InsertColumn (int before, const wxTreeListColumnInfo& colInfo);
|
||||
|
||||
// deletes the given column - does not delete the corresponding column
|
||||
void RemoveColumn (int column);
|
||||
|
||||
// returns the number of columns in the ctrl
|
||||
int GetColumnCount() const;
|
||||
|
||||
// tells which column is the "main" one, i.e. the "threaded" one
|
||||
void SetMainColumn (int column);
|
||||
int GetMainColumn() const;
|
||||
|
||||
void SetColumn (int column, const wxTreeListColumnInfo& colInfo);
|
||||
wxTreeListColumnInfo& GetColumn (int column);
|
||||
const wxTreeListColumnInfo& GetColumn (int column) const;
|
||||
|
||||
void SetColumnText (int column, const wxString& text);
|
||||
wxString GetColumnText (int column) const;
|
||||
|
||||
void SetColumnWidth (int column, int width);
|
||||
int GetColumnWidth (int column) const;
|
||||
|
||||
void SetColumnAlignment (int column, int flag);
|
||||
int GetColumnAlignment (int column) const;
|
||||
|
||||
void SetColumnImage (int column, int image);
|
||||
int GetColumnImage (int column) const;
|
||||
|
||||
void SetColumnShown (int column, bool shown = true);
|
||||
bool IsColumnShown (int column) const;
|
||||
|
||||
void SetColumnEditable (int column, bool edit = true);
|
||||
bool IsColumnEditable (int column) const;
|
||||
|
||||
// Functions to work with items.
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// retrieve item's label (of the main column)
|
||||
wxString GetItemText (const wxTreeItemId& item) const
|
||||
{ return GetItemText (item, GetMainColumn()); }
|
||||
// retrieves item's label of the given column
|
||||
wxString GetItemText (const wxTreeItemId& item, int column) const;
|
||||
|
||||
// get one of the images associated with the item (normal by default)
|
||||
int GetItemImage (const wxTreeItemId& item,
|
||||
wxTreeItemIcon which = wxTreeItemIcon_Normal) const
|
||||
{ return GetItemImage (item, GetMainColumn(), which); }
|
||||
int GetItemImage (const wxTreeItemId& item, int column,
|
||||
wxTreeItemIcon which = wxTreeItemIcon_Normal) const;
|
||||
|
||||
// get the data associated with the item
|
||||
wxTreeItemData *GetItemData (const wxTreeItemId& item) const;
|
||||
|
||||
bool GetItemBold (const wxTreeItemId& item) const;
|
||||
wxColour GetItemTextColour (const wxTreeItemId& item) const;
|
||||
wxColour GetItemBackgroundColour (const wxTreeItemId& item) const;
|
||||
wxFont GetItemFont (const wxTreeItemId& item) const;
|
||||
|
||||
// modifiers
|
||||
|
||||
// set item's label
|
||||
void SetItemText (const wxTreeItemId& item, const wxString& text)
|
||||
{ SetItemText (item, GetMainColumn(), text); }
|
||||
void SetItemText (const wxTreeItemId& item, int column, const wxString& text);
|
||||
|
||||
// get one of the images associated with the item (normal by default)
|
||||
void SetItemImage (const wxTreeItemId& item, int image,
|
||||
wxTreeItemIcon which = wxTreeItemIcon_Normal)
|
||||
{ SetItemImage (item, GetMainColumn(), image, which); }
|
||||
// the which parameter is ignored for all columns but the main one
|
||||
void SetItemImage (const wxTreeItemId& item, int column, int image,
|
||||
wxTreeItemIcon which = wxTreeItemIcon_Normal);
|
||||
|
||||
// associate some data with the item
|
||||
void SetItemData (const wxTreeItemId& item, wxTreeItemData *data);
|
||||
|
||||
// force appearance of [+] button near the item. This is useful to
|
||||
// allow the user to expand the items which don't have any children now
|
||||
// - but instead add them only when needed, thus minimizing memory
|
||||
// usage and loading time.
|
||||
void SetItemHasChildren(const wxTreeItemId& item, bool has = true);
|
||||
|
||||
// the item will be shown in bold
|
||||
void SetItemBold (const wxTreeItemId& item, bool bold = true);
|
||||
|
||||
// set the item's text colour
|
||||
void SetItemTextColour (const wxTreeItemId& item, const wxColour& colour);
|
||||
|
||||
// set the item's background colour
|
||||
void SetItemBackgroundColour (const wxTreeItemId& item, const wxColour& colour);
|
||||
|
||||
// set the item's font (should be of the same height for all items)
|
||||
void SetItemFont (const wxTreeItemId& item, const wxFont& font);
|
||||
|
||||
// set the window font
|
||||
virtual bool SetFont ( const wxFont &font );
|
||||
|
||||
// set the styles.
|
||||
void SetWindowStyle (const long styles);
|
||||
long GetWindowStyle() const;
|
||||
long GetWindowStyleFlag () const { return GetWindowStyle(); }
|
||||
|
||||
// item status inquiries
|
||||
// ---------------------
|
||||
|
||||
// is the item visible (it might be outside the view or not expanded)?
|
||||
bool IsVisible (const wxTreeItemId& item, bool fullRow = false, bool within = true) const;
|
||||
// does the item has any children?
|
||||
bool HasChildren (const wxTreeItemId& item) const;
|
||||
// is the item expanded (only makes sense if HasChildren())?
|
||||
bool IsExpanded (const wxTreeItemId& item) const;
|
||||
// is this item currently selected (the same as has focus)?
|
||||
bool IsSelected (const wxTreeItemId& item) const;
|
||||
// is item text in bold font?
|
||||
bool IsBold (const wxTreeItemId& item) const;
|
||||
// does the layout include space for a button?
|
||||
|
||||
// number of children
|
||||
// ------------------
|
||||
|
||||
// if 'recursively' is FALSE, only immediate children count, otherwise
|
||||
// the returned number is the number of all items in this branch
|
||||
size_t GetChildrenCount (const wxTreeItemId& item, bool recursively = true);
|
||||
|
||||
// navigation
|
||||
// ----------
|
||||
|
||||
// wxTreeItemId.IsOk() will return FALSE if there is no such item
|
||||
|
||||
// get the root tree item
|
||||
wxTreeItemId GetRootItem() const;
|
||||
|
||||
// get the item currently selected (may return NULL if no selection)
|
||||
wxTreeItemId GetSelection() const;
|
||||
|
||||
// get the items currently selected, return the number of such item
|
||||
size_t GetSelections (wxArrayTreeItemIds&) const;
|
||||
|
||||
// get the parent of this item (may return NULL if root)
|
||||
wxTreeItemId GetItemParent (const wxTreeItemId& item) const;
|
||||
|
||||
// for this enumeration function you must pass in a "cookie" parameter
|
||||
// which is opaque for the application but is necessary for the library
|
||||
// to make these functions reentrant (i.e. allow more than one
|
||||
// enumeration on one and the same object simultaneously). Of course,
|
||||
// the "cookie" passed to GetFirstChild() and GetNextChild() should be
|
||||
// the same!
|
||||
|
||||
// get child of this item
|
||||
#if !wxCHECK_VERSION(2, 5, 0)
|
||||
wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const;
|
||||
wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const;
|
||||
wxTreeItemId GetPrevChild(const wxTreeItemId& item, long& cookie) const;
|
||||
wxTreeItemId GetLastChild(const wxTreeItemId& item, long& cookie) const;
|
||||
#else
|
||||
wxTreeItemId GetFirstChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
|
||||
wxTreeItemId GetNextChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
|
||||
wxTreeItemId GetPrevChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
|
||||
wxTreeItemId GetLastChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
|
||||
#endif
|
||||
|
||||
// get sibling of this item
|
||||
wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
|
||||
wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
|
||||
|
||||
// get item in the full tree (currently only for internal use)
|
||||
wxTreeItemId GetNext(const wxTreeItemId& item) const;
|
||||
wxTreeItemId GetPrev(const wxTreeItemId& item) const;
|
||||
|
||||
// get expanded item, see IsExpanded()
|
||||
wxTreeItemId GetFirstExpandedItem() const;
|
||||
wxTreeItemId GetNextExpanded(const wxTreeItemId& item) const;
|
||||
wxTreeItemId GetPrevExpanded(const wxTreeItemId& item) const;
|
||||
|
||||
// get visible item, see IsVisible()
|
||||
wxTreeItemId GetFirstVisibleItem( bool fullRow = false) const;
|
||||
wxTreeItemId GetFirstVisible( bool fullRow = false, bool within = true) const;
|
||||
wxTreeItemId GetNextVisible (const wxTreeItemId& item, bool fullRow = false, bool within = true) const;
|
||||
wxTreeItemId GetPrevVisible (const wxTreeItemId& item, bool fullRow = false, bool within = true) const;
|
||||
wxTreeItemId GetLastVisible ( bool fullRow = false, bool within = true) const;
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// add the root node to the tree
|
||||
wxTreeItemId AddRoot (const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item in as the first child of the parent
|
||||
wxTreeItemId PrependItem (const wxTreeItemId& parent,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item after a given one
|
||||
wxTreeItemId InsertItem (const wxTreeItemId& parent,
|
||||
const wxTreeItemId& idPrevious,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item before the one with the given index
|
||||
wxTreeItemId InsertItem (const wxTreeItemId& parent,
|
||||
size_t index,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item in as the last child of the parent
|
||||
wxTreeItemId AppendItem (const wxTreeItemId& parent,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// delete this item (except root) + children and associated data if any
|
||||
void Delete (const wxTreeItemId& item);
|
||||
// delete all children (but don't delete the item itself)
|
||||
void DeleteChildren (const wxTreeItemId& item);
|
||||
// delete the root and all its children from the tree
|
||||
void DeleteRoot();
|
||||
|
||||
// expand this item
|
||||
void Expand (const wxTreeItemId& item);
|
||||
// expand this item and all subitems recursively
|
||||
void ExpandAll (const wxTreeItemId& item);
|
||||
// collapse the item without removing its children
|
||||
void Collapse (const wxTreeItemId& item);
|
||||
// collapse the item and remove all children
|
||||
void CollapseAndReset(const wxTreeItemId& item); //? TODO ???
|
||||
// toggles the current state
|
||||
void Toggle (const wxTreeItemId& item);
|
||||
|
||||
// remove the selection from currently selected item (if any)
|
||||
void Unselect();
|
||||
void UnselectAll();
|
||||
// select this item - return true if selection was allowed (no veto)
|
||||
bool SelectItem (const wxTreeItemId& item,
|
||||
const wxTreeItemId& last = (wxTreeItemId*)NULL,
|
||||
bool unselect_others = true);
|
||||
// select all items in the expanded tree
|
||||
void SelectAll();
|
||||
// make sure this item is visible (expanding the parent item and/or
|
||||
// scrolling to this item if necessary)
|
||||
void EnsureVisible (const wxTreeItemId& item);
|
||||
// scroll to this item (but don't expand its parent)
|
||||
void ScrollTo (const wxTreeItemId& item);
|
||||
|
||||
// The first function is more portable (because easier to implement
|
||||
// on other platforms), but the second one returns some extra info.
|
||||
wxTreeItemId HitTest (const wxPoint& point)
|
||||
{ int flags; int column; return HitTest (point, flags, column); }
|
||||
wxTreeItemId HitTest (const wxPoint& point, int& flags)
|
||||
{ int column; return HitTest (point, flags, column); }
|
||||
wxTreeItemId HitTest (const wxPoint& point, int& flags, int& column);
|
||||
|
||||
// get the bounding rectangle of the item (or of its label only)
|
||||
bool GetBoundingRect (const wxTreeItemId& item, wxRect& rect,
|
||||
bool textOnly = false) const;
|
||||
|
||||
// Start editing the item label: this (temporarily) replaces the item
|
||||
// with a one line edit control. The item will be selected if it hadn't
|
||||
// been before.
|
||||
void EditLabel (const wxTreeItemId& item)
|
||||
{ EditLabel (item, GetMainColumn()); }
|
||||
// edit item's label of the given column
|
||||
void EditLabel (const wxTreeItemId& item, int column);
|
||||
|
||||
// virtual mode
|
||||
virtual wxString OnGetItemText( wxTreeItemData* item, long column ) const;
|
||||
|
||||
// sorting
|
||||
// this function is called to compare 2 items and should return -1, 0
|
||||
// or +1 if the first item is less than, equal to or greater than the
|
||||
// second one. The base class version performs alphabetic comparaison
|
||||
// of item labels (GetText)
|
||||
virtual int OnCompareItems (const wxTreeItemId& item1, const wxTreeItemId& item2);
|
||||
// sort the children of this item using OnCompareItems
|
||||
// NB: this function is not reentrant and not MT-safe (FIXME)!
|
||||
void SortChildren(const wxTreeItemId& item);
|
||||
|
||||
// searching
|
||||
wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int mode = 0);
|
||||
|
||||
// overridden base class virtuals
|
||||
virtual bool SetBackgroundColour (const wxColour& colour);
|
||||
virtual bool SetForegroundColour (const wxColour& colour);
|
||||
|
||||
// drop over item
|
||||
void SetDragItem (const wxTreeItemId& item = (wxTreeItemId*)NULL);
|
||||
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
protected:
|
||||
// header window, responsible for column visualization and manipulation
|
||||
wxTreeListHeaderWindow* GetHeaderWindow() const
|
||||
{ return m_header_win; }
|
||||
wxTreeListHeaderWindow* m_header_win; // future cleanup: make private or remove GetHeaderWindow()
|
||||
|
||||
// main window, the "true" tree ctrl
|
||||
wxTreeListMainWindow* GetMainWindow() const
|
||||
{ return m_main_win; }
|
||||
wxTreeListMainWindow* m_main_win; // future cleanup: make private or remove GetMainWindow()
|
||||
|
||||
int GetHeaderHeight() const { return m_headerHeight; }
|
||||
|
||||
void CalculateAndSetHeaderHeight();
|
||||
void DoHeaderLayout();
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
private:
|
||||
int m_headerHeight;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxTreeListCtrl)
|
||||
};
|
||||
|
||||
#endif // TREELISTCTRL_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user