1997-02-10 11:22:42 +00:00
|
|
|
|
#include <applicat.h>
|
1999-10-22 10:00:18 +00:00
|
|
|
|
#include <currency.h>
|
1998-11-04 18:04:26 +00:00
|
|
|
|
#include <filetext.h>
|
1996-12-06 15:48:24 +00:00
|
|
|
|
#include <form.h>
|
1998-11-04 18:04:26 +00:00
|
|
|
|
#include <mask.h>
|
|
|
|
|
#include <os_dep.h>
|
1996-12-06 15:48:24 +00:00
|
|
|
|
#include <printer.h>
|
|
|
|
|
#include <progind.h>
|
1998-11-04 18:04:26 +00:00
|
|
|
|
|
|
|
|
|
#include "ef0.h"
|
1996-12-06 15:48:24 +00:00
|
|
|
|
#include "ef0301.h"
|
|
|
|
|
#include "ef0500.h"
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
#include <clifo.h>
|
|
|
|
|
#include <comuni.h>
|
1999-10-22 10:00:18 +00:00
|
|
|
|
#include <cfven.h>
|
|
|
|
|
#include <indsp.h>
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
class TRiba_form;
|
|
|
|
|
class TDistinta_form;
|
1997-02-10 11:22:42 +00:00
|
|
|
|
class TRiba_file;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
enum fo { kb360 = 1, kb720 = 2, kb1200 = 3, kb1440 = 4 };
|
1998-05-27 13:41:48 +00:00
|
|
|
|
|
|
|
|
|
#define RIBAFILENAME "ribael.dat"
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1997-02-18 15:10:08 +00:00
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// Classe per l'emissione di effetti e distinte su carta o su floppy //
|
1997-02-18 15:10:08 +00:00
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
class TEmissione: public TSkeleton_application
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
1997-02-10 11:22:42 +00:00
|
|
|
|
fo _foutput;
|
1996-12-06 15:48:24 +00:00
|
|
|
|
TMask* _msk;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TRelation* _firmrel;
|
|
|
|
|
TRelation* _rel;
|
1997-02-10 11:22:42 +00:00
|
|
|
|
TCursor* _cur;
|
|
|
|
|
TRiba_form* _formrb;
|
|
|
|
|
TDistinta_form* _formdse;
|
|
|
|
|
TRiba_file* _trasfile;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int _base_page_no;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
protected:
|
1998-11-04 18:04:26 +00:00
|
|
|
|
virtual bool create(void);
|
|
|
|
|
virtual void main_loop();
|
|
|
|
|
virtual bool destroy(void) ;
|
|
|
|
|
virtual void on_firm_change(void);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
void conferma(void);
|
|
|
|
|
void enable_dettaglio(TForm& form) const;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
virtual void print_rb(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis);
|
|
|
|
|
virtual void print_dse(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis);
|
|
|
|
|
virtual void print(void);
|
|
|
|
|
void floppy(void);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
void save_data_emis(void);
|
|
|
|
|
void header_rb(void);
|
|
|
|
|
void footer_ef(void);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void inizializza_cur(void);
|
|
|
|
|
void inizializza_file(void);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
void record(THash_object& lavoro);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
bool ok_write(void);
|
|
|
|
|
void aggiorna_rb(TCursor*);
|
|
|
|
|
void aggiorna_dist(TCursor*);
|
|
|
|
|
static bool annulla_handler(TMask_field& f, KEY k);
|
|
|
|
|
public:
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
int base_no() { return _base_page_no; }
|
|
|
|
|
const TMask& msk() const { return *_msk; }
|
|
|
|
|
const TRelation& firm_rel() const { return *_firmrel; }
|
|
|
|
|
|
|
|
|
|
TEmissione() {}
|
|
|
|
|
virtual ~TEmissione() {}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// restituisce un riferimento all' applicazione
|
|
|
|
|
inline TEmissione& app() { return (TEmissione&) main_app();}
|
|
|
|
|
|
1997-02-18 15:10:08 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// Classe TRiba_form customizzata dalla Form per le Ri.Ba. //
|
1997-02-18 15:10:08 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////
|
1996-12-06 15:48:24 +00:00
|
|
|
|
class TRiba_form: public TForm
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool validate(TForm_item &, TToken_string &);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
public:
|
|
|
|
|
TRiba_form(const char *);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
virtual ~TRiba_form() { }
|
1996-12-06 15:48:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
1997-02-18 15:10:08 +00:00
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
// Classe TDistinta_form customizzata dalla Form per le Distinte //
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
class TDistinta_form: public TForm
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
TRelation *_firmrel;
|
|
|
|
|
TSorted_cursor *_cursor;// cursore che permette l'ordinamento degli effetti
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1997-02-18 15:10:08 +00:00
|
|
|
|
protected: // nella distinta per data scadenza o per dati fattura
|
1999-04-06 15:34:39 +00:00
|
|
|
|
virtual bool validate(TForm_item &, TToken_string &);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
public:
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void set_order(const char tipo);
|
1997-02-12 09:15:50 +00:00
|
|
|
|
virtual TCursor* cursor() const { return (TCursor*)_cursor;}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
TDistinta_form(const char*, TRelation *);
|
|
|
|
|
virtual ~TDistinta_form();
|
|
|
|
|
};
|
1997-02-10 11:22:42 +00:00
|
|
|
|
|
1997-02-18 15:10:08 +00:00
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// Classe TRiba_file customizzata dalla TFile_text //
|
|
|
|
|
/////////////////////////////////////////////////////
|
1997-02-10 11:22:42 +00:00
|
|
|
|
class TRiba_file: public TFile_text
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1997-02-10 11:22:42 +00:00
|
|
|
|
real _tot_importi;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
char _codice_moneta;
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
protected:
|
1997-02-10 11:22:42 +00:00
|
|
|
|
virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1997-02-10 11:22:42 +00:00
|
|
|
|
public:
|
1999-10-22 10:00:18 +00:00
|
|
|
|
void set_tot_importi(const real& importo) { _tot_importi = importo; }
|
|
|
|
|
void add_tot_importi(const real& importo) { _tot_importi += importo; }
|
|
|
|
|
const real tot_importi() const { return _tot_importi; }
|
|
|
|
|
|
|
|
|
|
TRiba_file(const TString& file_name, const TString& config_name);
|
|
|
|
|
virtual ~TRiba_file() { }
|
1997-02-10 11:22:42 +00:00
|
|
|
|
};
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TRiba_file::TRiba_file(const TString& file_name, const TString& config_name)
|
|
|
|
|
: TFile_text(file_name, config_name)
|
|
|
|
|
{
|
|
|
|
|
_codice_moneta = TCurrency::get_firm_dec() == 0 ? ' ' : 'E';
|
|
|
|
|
}
|
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// creazione dell'applicazione
|
|
|
|
|
bool TEmissione::create()
|
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
_formrb = NULL;
|
|
|
|
|
_formdse = NULL;
|
|
|
|
|
_msk = new TMask("ef0500a");
|
1996-12-06 15:48:24 +00:00
|
|
|
|
_firmrel= new TRelation(LF_NDITTE);
|
|
|
|
|
_firmrel->add(LF_ANAG, "TIPOA=TIPOA|CODANAGR=CODANAGR");
|
1997-02-12 09:15:50 +00:00
|
|
|
|
_firmrel->add(LF_UNLOC,"CODDITTA=CODDITTA");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_rel = new TRelation(LF_EFFETTI);
|
|
|
|
|
_rel->add(LF_REFFETTI, "NPROGTR=NPROGTR");
|
1997-02-10 11:22:42 +00:00
|
|
|
|
_rel->add(LF_CESS, "NPROGTR=NPROGTR");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_rel->add(LF_CLIFO, "TIPOCF=TIPOCF|CODCF=CODCF");
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_rel->add(LF_CFVEN, "TIPOCF==TIPOCF|CODCF==CODCF", 1, LF_CLIFO);
|
|
|
|
|
_rel->add(LF_INDSP, "TIPOCF==TIPOCF|CODCF==CODCF|CODIND==CODINDEFF", 1, LF_CFVEN);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_rel->add("%BAN", "CODTAB[1,5]=CODABI", 1, 0, 401);
|
|
|
|
|
_rel->add("%BAN", "CODTAB=CODABI+CODCAB", 1, 0, 402);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
_rel->add(LF_COMUNI, "STATO=STATOCF|COM=COMCF",1,LF_CLIFO);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_rel->add(LF_COMUNI, "STATO=STATO|COM=COM", 1, LF_INDSP, 213);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
_cur = NULL;
|
1998-05-27 13:41:48 +00:00
|
|
|
|
_msk->set(F_NOMEFILE,RIBAFILENAME);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// _trasfile = new TRiba_file(RIBAFILENAME, "riba.ini");
|
|
|
|
|
// _trasfile->set_ditta(get_firm());
|
1998-11-04 18:04:26 +00:00
|
|
|
|
_msk->set_handler(DLG_CANCEL, annulla_handler);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_trasfile = NULL;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
return TSkeleton_application::create();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// distruzione dell'applicazione
|
|
|
|
|
bool TEmissione::destroy()
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1996-12-06 15:48:24 +00:00
|
|
|
|
if (_formrb) delete _formrb;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (_formdse) delete _formdse;
|
|
|
|
|
delete _msk;
|
|
|
|
|
delete _firmrel;
|
|
|
|
|
delete _rel;
|
|
|
|
|
delete _cur;
|
|
|
|
|
if (_trasfile)
|
|
|
|
|
delete _trasfile;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
return TSkeleton_application::destroy();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// carica la ditta corrente
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void TEmissione::on_firm_change()
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
1999-04-26 15:58:05 +00:00
|
|
|
|
TRectype& firm = _firmrel->curr();
|
|
|
|
|
firm.put("CODDITTA", get_firm());
|
1996-12-06 15:48:24 +00:00
|
|
|
|
_firmrel->read();
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
// carica la maschera per emissione effetti e distinte
|
|
|
|
|
void TEmissione::main_loop()
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
// Preimposta gli eventuali valori specificati sulla riga di comando
|
|
|
|
|
if (argc() >= 4)
|
|
|
|
|
{
|
|
|
|
|
TLocalisamfile eff(LF_EFFETTI);
|
|
|
|
|
eff.setkey(4);
|
|
|
|
|
eff.put(EFF_TIPODIST, argv(2));
|
|
|
|
|
eff.put(EFF_NDIST, argv(3));
|
|
|
|
|
eff.put(EFF_NRIGADIST, 1);
|
|
|
|
|
if (eff.read() == NOERR)
|
|
|
|
|
{
|
|
|
|
|
_msk->set(F_TIPODIST, eff.get(EFF_TIPODIST));
|
|
|
|
|
_msk->set(F_TIPOCF, eff.get(EFF_TIPOCF));
|
|
|
|
|
_msk->set(F_NUMBER, eff.get(EFF_NDIST));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KEY key = K_ENTER;
|
|
|
|
|
while (key != K_QUIT)
|
|
|
|
|
{
|
|
|
|
|
key = _msk->run();
|
|
|
|
|
if (key == K_ENTER)
|
1996-12-06 15:48:24 +00:00
|
|
|
|
conferma();
|
|
|
|
|
}
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
|
|
|
|
|
// gestisce la scelta fra le due possibili emissioni
|
|
|
|
|
void TEmissione::conferma()
|
|
|
|
|
{
|
1999-04-26 15:58:05 +00:00
|
|
|
|
const int tipoemis = _msk->get_int(F_TIPOEMIS);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (tipoemis == 1)
|
1999-04-26 15:58:05 +00:00
|
|
|
|
floppy();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
else
|
1999-04-26 15:58:05 +00:00
|
|
|
|
print();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// gestione emissione su floppy
|
1997-02-10 11:22:42 +00:00
|
|
|
|
void TEmissione::floppy()
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
inizializza_cur();
|
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
const long codabi = _cur->curr().get_long(EFF_CODABIP);
|
|
|
|
|
const char tipocf = _cur->curr().get_char(EFF_TIPOCF);
|
|
|
|
|
const char tipopag = _cur->curr().get_char(EFF_TIPOPAG);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
TFilename ribaini;
|
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
ribaini.format("r%c%c%05ld.ini",tipocf, tipopag, codabi);// compongo il nome del tracciato
|
|
|
|
|
if (!ribaini.exist()) // se non esiste
|
|
|
|
|
ribaini.overwrite("00000", 3); // Elimino codice banca
|
|
|
|
|
if (!ribaini.exist()) // se non esiste
|
|
|
|
|
ribaini = "riba.ini"; // utilizzo quello generico
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
_trasfile = new TRiba_file(RIBAFILENAME, ribaini);
|
|
|
|
|
inizializza_file();
|
|
|
|
|
|
|
|
|
|
long n_eff = _cur->items();
|
|
|
|
|
bool condition = ok_write();
|
|
|
|
|
|
|
|
|
|
if (!condition)
|
|
|
|
|
error_box("Impossibile continuare dischetto pieno");
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-04-26 15:58:05 +00:00
|
|
|
|
TProgind pi(n_eff,"Emissione Ri.Ba. su floppy...",FALSE,TRUE);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
TAssoc_array& tracciati = _trasfile->tracciati();
|
|
|
|
|
header_rb();//intestazione flusso effetti
|
|
|
|
|
//scandisco tutti gli effetti della distinta selezionata
|
|
|
|
|
for (*_cur = 0; _cur->pos() < n_eff; ++(*_cur))
|
|
|
|
|
{
|
|
|
|
|
pi.addstatus(1L);
|
|
|
|
|
save_data_emis();
|
|
|
|
|
THash_object* lavoro = tracciati.get_hashobj();
|
|
|
|
|
//scandisco tutti i record di un effetto
|
|
|
|
|
for (int i = 0; lavoro != NULL; i++)
|
|
|
|
|
{
|
|
|
|
|
record(*lavoro);//emetto il record
|
|
|
|
|
lavoro = tracciati.get_hashobj();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
footer_ef(); //chiusura flusso effetti
|
|
|
|
|
}
|
|
|
|
|
_trasfile->close();
|
|
|
|
|
delete _trasfile;
|
|
|
|
|
_trasfile = NULL;
|
|
|
|
|
}
|
1997-02-10 11:22:42 +00:00
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// registro la data ed il numero di emissione dell'effetto corrente
|
1997-02-10 11:22:42 +00:00
|
|
|
|
void TEmissione::save_data_emis()
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1997-02-10 11:22:42 +00:00
|
|
|
|
const TDate data_emis = _msk->get_date(F_DATAEMIS);
|
1997-02-12 09:15:50 +00:00
|
|
|
|
TLocalisamfile& effetti = _rel->lfile();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TEffetto effetto = effetti.curr();
|
1997-02-10 11:22:42 +00:00
|
|
|
|
long numero = effetto.numero();
|
1997-02-12 09:15:50 +00:00
|
|
|
|
effetto.put(EFF_NUMEMISS, numero);
|
|
|
|
|
effetto.put(EFF_DATAEMISS, data_emis);
|
|
|
|
|
effetto.put(EFF_DATARIBA, data_emis);
|
|
|
|
|
bool cond = TRUE;
|
|
|
|
|
effetto.put(EFF_DISRIBAEST, cond);
|
|
|
|
|
effetto.rewrite(effetti);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
//emetto il record d'intestazione del flusso di effetti
|
1997-02-10 11:22:42 +00:00
|
|
|
|
void TEmissione::header_rb()
|
|
|
|
|
{
|
|
|
|
|
TRecord_text rec;
|
|
|
|
|
*_cur = 0;
|
|
|
|
|
rec.set_type("RB");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_trasfile->autoload(rec, *_cur);
|
|
|
|
|
_trasfile->write(rec);
|
|
|
|
|
}
|
1997-02-10 11:22:42 +00:00
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
//emetto il record di chiusura del flusso di effetti
|
1997-02-10 11:22:42 +00:00
|
|
|
|
void TEmissione::footer_ef()
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TRecord_text rec;
|
|
|
|
|
*_cur = 0;
|
|
|
|
|
rec.set_type("EF");
|
|
|
|
|
_trasfile->autoload(rec, *_cur);
|
|
|
|
|
_trasfile->write(rec);
|
|
|
|
|
_trasfile->write_file()->seekp(0, ios::end);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
//inizializza il cursore per la gestione dei dati da caricare negli effetti
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void TEmissione::inizializza_cur()
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const int ndist = _msk->get_int(F_NUMBER);
|
|
|
|
|
const char tipodist = _msk->get(F_TIPODIST)[0];
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TRectype from(_rel->curr());
|
1999-04-06 15:34:39 +00:00
|
|
|
|
from.zero();
|
|
|
|
|
from.put(EFF_TIPODIST, tipodist);
|
|
|
|
|
from.put(EFF_NDIST, ndist);
|
|
|
|
|
_cur = new TCursor(_rel,"",4,&from,&from);
|
|
|
|
|
_cur->freeze();
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
//inizializza il file di testo su cui emettere gli effetti
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void TEmissione::inizializza_file()
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TFilename fileriba = _msk->get(F_UNITA);
|
1998-05-27 13:41:48 +00:00
|
|
|
|
fileriba << ":\\" << _msk->get(F_NOMEFILE);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_trasfile->open(fileriba,'w');
|
1999-06-18 15:35:05 +00:00
|
|
|
|
_trasfile->set_tot_importi(ZERO);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_trasfile->force_record_separator(_msk->get_bool(F_FORCESEP));
|
1997-02-10 11:22:42 +00:00
|
|
|
|
_foutput = (fo)_msk->get_int(F_FOR_OUT);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1997-02-10 11:22:42 +00:00
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
//emetto un record del flusso di effetti
|
1997-02-10 11:22:42 +00:00
|
|
|
|
void TEmissione::record(THash_object& lavoro)
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const TString& chiave = lavoro.key();
|
|
|
|
|
if (chiave != "EF" && chiave !="RB")
|
|
|
|
|
{
|
|
|
|
|
TTracciato_record& oggetto = (TTracciato_record&)lavoro.obj();
|
|
|
|
|
const TString& tipo = oggetto.type();
|
|
|
|
|
TRecord_text rec(tipo);
|
|
|
|
|
//carico il record da emettere
|
|
|
|
|
_trasfile->autoload(rec, *_cur, &tipo);
|
|
|
|
|
_trasfile->write(rec);//emetto i dati su file
|
|
|
|
|
}
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
//controllo che ci sia spazio a sufficenza per emettere il flusso
|
1997-02-18 15:10:08 +00:00
|
|
|
|
//sull'unit<69> scelta dall'utente,ritorna TRUE se <20> possibile farlo
|
1999-04-06 15:34:39 +00:00
|
|
|
|
bool TEmissione::ok_write()
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
long elem = _cur->items();
|
1997-02-10 11:22:42 +00:00
|
|
|
|
int dim = _trasfile->recordsize();
|
1998-11-04 18:04:26 +00:00
|
|
|
|
unsigned long nbyte = (elem*7+2)*dim;
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TString16 unita; unita << _msk->get(F_UNITA)[0] << ":/";
|
1998-11-04 18:04:26 +00:00
|
|
|
|
return os_test_disk_free_space(unita, nbyte);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// aggiorna numero e data di emissione ed il flag di stampa
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// su tutti gli effetti nel cursore
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void TEmissione::aggiorna_rb(TCursor* cur)
|
|
|
|
|
{
|
1996-12-06 15:48:24 +00:00
|
|
|
|
TLocalisamfile &eff = cur->file(LF_EFFETTI);
|
|
|
|
|
for (*cur = 0; cur->pos() < cur->items(); ++(*cur))
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
TEffetto effetto = eff.curr();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
long numero = effetto.numero();
|
1997-02-12 09:15:50 +00:00
|
|
|
|
effetto.put(EFF_NUMEMISS, numero);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
TDate data = _msk->get_date(F_DATAEMIS);
|
1997-02-12 09:15:50 +00:00
|
|
|
|
effetto.put(EFF_DATAEMISS, data);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
bool cond = TRUE;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
effetto.put(EFF_EFFSTAMP, cond);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
effetto.rewrite(eff);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// aggiorna il flag di stampa della distinta
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// su tutti gli effetti nel cursore
|
|
|
|
|
void TEmissione::aggiorna_dist(TCursor* cur)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1996-12-06 15:48:24 +00:00
|
|
|
|
TLocalisamfile &eff = cur->file(LF_EFFETTI);
|
|
|
|
|
for (*cur = 0; cur->pos() < cur->items(); ++(*cur))
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
TEffetto effetto = eff.curr();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
bool cond = TRUE;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
effetto.put(EFF_DISTSTAM, cond);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
effetto.rewrite(eff);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// gestione emissione su moduli cartacei delle riba
|
1996-12-06 15:48:24 +00:00
|
|
|
|
void TEmissione::print_rb(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis)
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TCursor* fcur = _formrb->cursor();
|
|
|
|
|
TLocalisamfile &eff = fcur->file(LF_EFFETTI);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
|
|
|
|
|
TString filter;
|
1998-08-25 17:57:12 +00:00
|
|
|
|
if (tipost == 'D' && !_msk->get_bool(F_RIST)) // se stampa definitiva effetti e se non deve ristampare le riba
|
1999-04-26 15:58:05 +00:00
|
|
|
|
filter = "EFFSTAMP=\" \"";// setta il filtro del cursore per stampare solo gli effetti non ancora stampati
|
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// setta la chiave 4 per il cursore per poter leggere tutti gli effetti della distinta
|
|
|
|
|
fcur->setkey(4);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (ndist > 0)
|
|
|
|
|
{
|
1999-04-26 15:58:05 +00:00
|
|
|
|
TRectype darec(eff.curr());// fissa i dati per la scelta degli ...
|
|
|
|
|
darec.zero();// ... effetti nel primo e nell'ultimo record del cursore
|
1999-04-06 15:34:39 +00:00
|
|
|
|
darec.put(EFF_TIPODIST, tipodist);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
darec.put(EFF_NDIST, ndist);
|
|
|
|
|
fcur->setregion(darec, darec);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
1999-04-26 15:58:05 +00:00
|
|
|
|
{
|
|
|
|
|
if (filter.not_empty()) filter << "&&";
|
|
|
|
|
filter << "(TIPODIST==\"\")&&(NDIST==\"\")";
|
|
|
|
|
}
|
|
|
|
|
fcur->setfilter(filter,TRUE);
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
long n = fcur->items();
|
|
|
|
|
fcur->freeze();
|
|
|
|
|
// se la stampa non si fa a video istanzia puntatore per la gestione
|
|
|
|
|
// della barra di attesa
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TProgind* pi = is_vis ? NULL : new TProgind(ncopie,"Stampa Effetti...",FALSE,TRUE);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
for (int j=0; j < ncopie; j++)
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (pi) pi->addstatus(1L); // aggiorna la barra d'attesa
|
1997-02-18 15:10:08 +00:00
|
|
|
|
// ciclo sugli elementi del cursore di stampa
|
1999-04-06 15:34:39 +00:00
|
|
|
|
//for (*fcur = 0; fcur->pos() < n; ++(*fcur))
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_formrb->print(); // stampa il form
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (tipost == 'D') // se emetto riba in definitiva devo aggiornare
|
1997-02-18 15:10:08 +00:00
|
|
|
|
aggiorna_rb(fcur);// data, numero emissione e flag di stampa effetto
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (pi) delete pi;
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// gestione emissione su moduli cartacei delle distinte
|
1996-12-06 15:48:24 +00:00
|
|
|
|
void TEmissione::print_dse(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis)
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TCursor* fcur = _formdse->cursor();
|
|
|
|
|
TLocalisamfile &eff = fcur->file(LF_EFFETTI);
|
1997-02-18 15:10:08 +00:00
|
|
|
|
// setta la chiave 4 per il cursore per poter leggere tutti gli effetti
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// della distinta
|
1996-12-06 15:48:24 +00:00
|
|
|
|
TString16 filter;
|
1998-08-25 17:57:12 +00:00
|
|
|
|
if (tipost == 'D' && !_msk->get_bool(F_RIST)) // se stampa definitiva effetti e se non deve ristampare le riba
|
|
|
|
|
filter = "DISTSTAM=\" \"";// setta il filtro del cursore per ...
|
|
|
|
|
fcur->setfilter(filter,TRUE);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
fcur->setkey(4);
|
1997-02-12 09:15:50 +00:00
|
|
|
|
TRectype darec(eff.curr()); // fissa i dati per la scelta degli ...
|
1997-02-18 15:10:08 +00:00
|
|
|
|
darec.zero(); // ... effetti nel primo e nell'ultimo record del cursore
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (ndist > 0)
|
|
|
|
|
{
|
|
|
|
|
darec.put(EFF_NDIST, ndist);
|
|
|
|
|
darec.put(EFF_TIPODIST, tipodist);
|
|
|
|
|
TRectype arec(darec);
|
|
|
|
|
fcur->setregion(darec, arec);
|
|
|
|
|
fcur->setfilter("");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fcur->setfilter("(TIPODIST==\"\")&&(NDIST==\"\")");
|
|
|
|
|
long n = fcur->items();
|
|
|
|
|
fcur->freeze();
|
1997-02-18 15:10:08 +00:00
|
|
|
|
// se la stampa non si fa a video istanzia puntatore per la gestione
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// della barra di attesa
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TProgind* pi = is_vis ? NULL : new TProgind(ncopie,"Stampa Distinta...",FALSE,TRUE);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
for (int j=0; j < ncopie; j++)
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_base_page_no = 0;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (pi) pi->addstatus(1L); // aggiorna la barra d'attesa
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_formdse->find_field('F',last_page,2).set(""); // Azzera nr documenti
|
|
|
|
|
_formdse->find_field('F',last_page,3).set(""); // Azzera tot documenti
|
|
|
|
|
_formdse->print(); // stampa il form
|
|
|
|
|
// stampa numero di pagina (solo nella distinta)
|
1997-02-18 15:10:08 +00:00
|
|
|
|
_base_page_no = printer().getcurrentpage() -1;
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
1997-02-18 15:10:08 +00:00
|
|
|
|
if (tipost == 'D') // se emetto distinta in definitiva ...
|
1999-04-06 15:34:39 +00:00
|
|
|
|
aggiorna_dist(fcur);// ... devo aggiornare flag di stampa distinta
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (pi) delete pi;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
void TEmissione::enable_dettaglio(TForm& form) const
|
|
|
|
|
{
|
|
|
|
|
TForm_subsection* fss = form.exist_field('B', odd_page, "RIGHE_EFFETTO");
|
|
|
|
|
const bool dett = _msk->get_bool(F_DETTAGLIO);
|
|
|
|
|
if (fss)
|
|
|
|
|
fss->show(dett);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (dett)
|
|
|
|
|
{
|
|
|
|
|
warning_box("Il modulo %s non prevede la stampa dei dettagli:\n"
|
|
|
|
|
"E' necessario aggiungere la sezione RIGHE_EFFETTO",
|
|
|
|
|
(const char*)form.name());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// gestione emissione effetti/distinte su moduli cartacei
|
1996-12-06 15:48:24 +00:00
|
|
|
|
void TEmissione::print()
|
|
|
|
|
{
|
|
|
|
|
int ncopie = _msk->get_int(F_NCOPIE);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (ncopie == 0) ncopie = 1;
|
1997-02-18 15:10:08 +00:00
|
|
|
|
printer().open();
|
|
|
|
|
// TRUE se si stampa a video
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const bool is_vis = printer().printtype() == screenvis;
|
1996-12-06 15:48:24 +00:00
|
|
|
|
int emis = _msk->get_int(F_EMIS);
|
|
|
|
|
int ndist = _msk->get_int(F_NUMBER);
|
|
|
|
|
char tipodist = _msk->get(F_TIPODIST)[0];
|
1997-02-12 09:15:50 +00:00
|
|
|
|
_rel->lfile().put(EFF_TIPODIST,tipodist);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
_rel->lfile().put(EFF_NDIST,ndist);
|
1997-02-12 09:15:50 +00:00
|
|
|
|
_rel->lfile().put(EFF_NRIGADIST,1);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
_rel->lfile().setkey(4);
|
|
|
|
|
_rel->read();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
long codabi = _rel->lfile().get_long(EFF_CODABIP);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
const char tipocf = _rel->lfile().get_char(EFF_TIPOCF);
|
|
|
|
|
const char tipopag = _rel->lfile().get_char(EFF_TIPOPAG);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
char tipost = _msk->get(F_TIPOST)[0];
|
|
|
|
|
char tipord = _msk->get(F_TIPORD)[0];
|
1998-11-04 18:04:26 +00:00
|
|
|
|
// se emetto riba istanzio il form per le riba
|
|
|
|
|
// se emetto distinta istanzio il form per le distinte
|
1999-04-26 15:58:05 +00:00
|
|
|
|
TFilename nomeform; // compongo il nome del form
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (emis == 1)
|
|
|
|
|
{
|
1999-04-26 15:58:05 +00:00
|
|
|
|
nomeform.format("r%c%c%05ld.frm",tipocf, tipopag, codabi);
|
|
|
|
|
if (!nomeform.exist()) // se non esiste
|
|
|
|
|
nomeform.overwrite("00000", 3); // elimino codice banca
|
|
|
|
|
if (!nomeform.exist()) // se non esiste
|
|
|
|
|
nomeform = "rb.frm"; // utilizzo quello generico
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_formrb = new TRiba_form(nomeform);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
enable_dettaglio(*_formrb);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
print_rb(tipost,ndist,tipodist,ncopie,is_vis);
|
|
|
|
|
}
|
1998-11-04 18:04:26 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1999-04-26 15:58:05 +00:00
|
|
|
|
nomeform.format("d%c%c%05ld.frm",tipocf, tipopag, codabi);// compongo il nome del form
|
|
|
|
|
if (!nomeform.exist()) // se non esiste
|
|
|
|
|
nomeform.overwrite("00000", 3); // elimino codice banca
|
|
|
|
|
if (!nomeform.exist()) // se non esiste
|
|
|
|
|
nomeform = "dse.frm"; // utilizzo quello generico
|
1996-12-06 15:48:24 +00:00
|
|
|
|
_formdse = new TDistinta_form(nomeform, _firmrel);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
enable_dettaglio(*_formdse);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
_formdse->set_order(tipord);
|
|
|
|
|
print_dse(tipost,ndist,tipodist,ncopie,is_vis);
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
printer().close();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-02-18 15:10:08 +00:00
|
|
|
|
// handler per gestire la conferma dell'annullamento dei dati inseriti
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// nella maschera
|
1996-12-06 15:48:24 +00:00
|
|
|
|
bool TEmissione::annulla_handler(TMask_field& f, KEY k)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
TMask &m = f.mask();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
if (k == K_SPACE)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
if (yesno_box("Vuoi veramente annullare i dati inseriti"))
|
|
|
|
|
m.reset();
|
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// costruttore classe TRiba_form
|
|
|
|
|
TRiba_form::TRiba_form(const char* name): TForm()
|
|
|
|
|
{
|
|
|
|
|
read(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// gestione dei messaggi estesi nei campi
|
|
|
|
|
bool TRiba_form::validate(TForm_item &cf, TToken_string &s)
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const TString16 code(s.get(0));
|
|
|
|
|
TString80 valore;
|
1998-01-09 16:33:25 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (code == "_IMPORTO")
|
|
|
|
|
{
|
1998-01-09 16:33:25 +00:00
|
|
|
|
// gestione dei campi relativi all'importo dell'effetto. Setta il valore da
|
|
|
|
|
// solo se e' in valuta (cambia anche la picture)
|
|
|
|
|
// sintassi: _IMPORTO
|
|
|
|
|
TEffetto effetto(cursor()->file().curr());
|
|
|
|
|
const bool in_valuta = effetto.in_valuta();
|
|
|
|
|
real importo = effetto.importo(in_valuta);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
cf.set(importo.string());
|
1998-05-27 13:41:48 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else if (code == "_BANCAP")
|
1998-05-27 13:41:48 +00:00
|
|
|
|
{
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// gestione dei campi relativi alla banca di presentazione dell'effetto
|
|
|
|
|
// sintassi: _BANCAP
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TCursor* cur = cursor();
|
|
|
|
|
if (cur->curr().get_int(EFF_NDIST) > 0)
|
|
|
|
|
{
|
|
|
|
|
TRectype & ban = cur->curr(-204);
|
|
|
|
|
valore.cut(0);
|
|
|
|
|
valore << ban.get("S0");
|
|
|
|
|
valore.trim();
|
|
|
|
|
ban = cur->curr(-202);
|
|
|
|
|
valore << " " << ban.get("S0");
|
|
|
|
|
valore.trim();
|
|
|
|
|
cf.set(valore);
|
|
|
|
|
cf.put_paragraph(valore);
|
|
|
|
|
}
|
1998-05-27 13:41:48 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else if (code == "_FATT")
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
|
|
|
|
// gestione dei campi relativi alle/a fatture/a a cui si riferisce un effetto
|
|
|
|
|
// sintassi: _FATT,<macro>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
|
|
|
|
// "!A" fattura o fatture
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// "!DATI" numero e data fattura
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// "!IMPFATT" importo fattura
|
1999-04-06 15:34:39 +00:00
|
|
|
|
//TCursor* fcur = cursor();
|
|
|
|
|
//TLocalisamfile &eff = fcur->file(LF_EFFETTI);
|
1998-01-09 16:33:25 +00:00
|
|
|
|
TEffetto effetto(cursor()->file().curr());// = eff.curr();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
long num = effetto.numero();
|
1998-01-09 16:33:25 +00:00
|
|
|
|
const bool in_valuta = effetto.in_valuta();
|
1997-02-10 11:22:42 +00:00
|
|
|
|
bool condition = (effetto.fatt(num));//TRUE se effetto non raggruppato
|
1998-01-09 16:33:25 +00:00
|
|
|
|
TToken_string* dati = effetto.dati_fatt(num, in_valuta);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
TString in(s.get());
|
|
|
|
|
if (in[0]=='!')
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
in.ltrim(1);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// "!A" se 1 sola fattura stampa 'a' altrimenti stampa 'e'
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in == "A")
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
|
|
|
|
if (condition)
|
|
|
|
|
cf.set("a");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else
|
1996-12-06 15:48:24 +00:00
|
|
|
|
cf.set("e");
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// "!DATIFATT" stampa numero e data fattura delle fatture a cui si riferisce l'effetto
|
|
|
|
|
if (in == "DATIFATT")
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
|
|
|
|
int elem = dati->items();
|
|
|
|
|
TString descfatt;
|
|
|
|
|
for (int i = 0; i < elem; i+=3)
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
descfatt << dati->get(i);
|
|
|
|
|
descfatt << " ";
|
|
|
|
|
descfatt << dati->get(i+1);
|
|
|
|
|
descfatt << " ";
|
|
|
|
|
cf.set(descfatt);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// "!IMPFATT" se 1 sola fattura ne stampa l' importo
|
|
|
|
|
if (in == "IMPFATT")
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
1997-02-10 11:22:42 +00:00
|
|
|
|
if (condition)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1997-02-10 11:22:42 +00:00
|
|
|
|
real importo(dati->get(2));
|
1999-10-22 10:00:18 +00:00
|
|
|
|
cf.set(importo.string());
|
1999-06-18 15:35:05 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
valore = cf.get();
|
|
|
|
|
cf.put_paragraph(valore);
|
|
|
|
|
return (TRUE);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (code == "_CLI")
|
|
|
|
|
{
|
|
|
|
|
// gestione dei campi relativi al cliente a cui si riferisce un effetto
|
|
|
|
|
// sintassi: _CLI,<macro>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
|
|
|
|
// "!IND" INDIRIZZO + NR. CIVICO
|
|
|
|
|
// "!PIAZZA" COMUNE + PROVINCIA
|
1999-10-22 10:00:18 +00:00
|
|
|
|
// "!CAP" CAP
|
|
|
|
|
// "!RAGSOC" Ragione sociale
|
|
|
|
|
// Queste macro sono state implementate per permettere di utilizzare
|
|
|
|
|
// L'indirizzo di spedizione effetti memorizzato in LF_CFVEN->CODINDEFF
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TString in(s.get());
|
|
|
|
|
if (in[0]=='!')
|
|
|
|
|
{
|
|
|
|
|
in.ltrim(1);
|
|
|
|
|
TRelation* rel = relation();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
const bool pick_normal = rel->lfile(LF_CFVEN).get_int(CFV_CODINDEFF) == 0;
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in=="IND")
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_INDCF : IND_INDIR);
|
|
|
|
|
in = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CIVCF : IND_CIV);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in.not_empty())
|
|
|
|
|
valore << ", " << in;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (in=="PIAZZA")
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore = rel->lfile(pick_normal ? LF_COMUNI : -213).get(COM_DENCOM);
|
|
|
|
|
in = rel->lfile(pick_normal ? LF_COMUNI : -213).get(COM_PROVCOM);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in.not_empty())
|
|
|
|
|
valore << " (" << in << ")";
|
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
else
|
|
|
|
|
if (in=="RAGSOC")
|
|
|
|
|
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_RAGSOC : IND_RAGSOC);
|
|
|
|
|
else
|
|
|
|
|
if (in=="CAPCF")
|
|
|
|
|
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CAPCF : IND_CAP);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
cf.put_paragraph(valore);
|
|
|
|
|
return (TRUE);
|
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
return TForm::validate(cf, s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// costruttore classe TDistinta_form
|
|
|
|
|
TDistinta_form::TDistinta_form(const char* name, TRelation *rel): TForm(), _firmrel(rel)
|
|
|
|
|
{
|
|
|
|
|
read(name);
|
|
|
|
|
_cursor = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// setta l'ordinamento del TSordet_cursor del form
|
1996-12-06 15:48:24 +00:00
|
|
|
|
void TDistinta_form::set_order(const char tipo)
|
|
|
|
|
{
|
|
|
|
|
TString ordine;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// ordinamento secondo la data di scadenza dell'effetto
|
|
|
|
|
if (tipo == 'S')
|
1997-02-12 09:15:50 +00:00
|
|
|
|
ordine = "DATASCAD|TIPODIST|NDIST|NRIGADIST";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// ordinamento seconda il numero e la data della fattura
|
|
|
|
|
if (tipo == 'F')
|
1997-02-12 09:15:50 +00:00
|
|
|
|
ordine = "14->NFATT|TIPODIST|NDIST|NRIGADIST";
|
1996-12-06 15:48:24 +00:00
|
|
|
|
_cursor = new TSorted_cursor(relation(),ordine);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// distruttore classe TDistinta_form
|
|
|
|
|
TDistinta_form::~TDistinta_form()
|
|
|
|
|
{
|
|
|
|
|
if (_cursor) delete _cursor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// gestione dei messaggi estesi nei campi
|
|
|
|
|
bool TDistinta_form::validate(TForm_item &cf, TToken_string &s)
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const TString code(s.get(0));
|
1996-12-06 15:48:24 +00:00
|
|
|
|
TString valore;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (code == "_IMPORTO")
|
|
|
|
|
{
|
1998-01-09 16:33:25 +00:00
|
|
|
|
// gestione dei campi relativi all'importo dell'effetto. Setta il valore da
|
|
|
|
|
// solo se e' in valuta (cambia anche la picture)
|
|
|
|
|
// sintassi: _IMPORTO
|
|
|
|
|
TEffetto effetto(cursor()->file().curr());
|
|
|
|
|
const bool in_valuta = effetto.in_valuta();
|
|
|
|
|
real importo = effetto.importo(in_valuta);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
cf.set(importo.string());
|
1999-04-06 15:34:39 +00:00
|
|
|
|
return (TRUE);
|
|
|
|
|
}
|
|
|
|
|
if (code == "_BANCAP")
|
|
|
|
|
{
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// gestione dei campi relativi alla banca di presentazione della distinta
|
|
|
|
|
// sintassi: _BANCAP
|
1997-02-10 11:22:42 +00:00
|
|
|
|
TCursor* cur = cursor();
|
|
|
|
|
TRectype & ban = cur->curr(-204);
|
|
|
|
|
valore.cut(0);
|
|
|
|
|
valore << ban.get("S0");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valore.trim();
|
|
|
|
|
ban = cur->curr(-202);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
valore << " " << ban.get("S0");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valore.trim();
|
1997-02-10 11:22:42 +00:00
|
|
|
|
cf.set(valore);
|
|
|
|
|
cf.put_paragraph(valore);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
return (TRUE);
|
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
if (code == "_DITTA")
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// gestione di campi della ditta corrente
|
|
|
|
|
// sintassi: _DITTA,<macro>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
|
|
|
|
// "!RAGSOC" ragione sociale
|
|
|
|
|
TString in(s.get());
|
|
|
|
|
if (in[0]=='!')
|
|
|
|
|
{
|
|
|
|
|
in.ltrim(1);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// "!RAGSOC" prende la ragione sociale della ditta corrente
|
|
|
|
|
if (in=="RAGSOC")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore = _firmrel->curr().get("RAGSOC");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valore.strip_d_spaces();
|
|
|
|
|
cf.set(valore);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
valore = cf.get();
|
|
|
|
|
cf.put_paragraph(valore);
|
|
|
|
|
cf.set("");
|
|
|
|
|
return (TRUE);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
if (code == "_CLI")
|
|
|
|
|
{
|
|
|
|
|
// gestione dei campi relativi al cliente a cui si riferisce un effetto
|
|
|
|
|
// sintassi: _CLI,<macro>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
|
|
|
|
// "!IND" INDIRIZZO + NR. CIVICO
|
|
|
|
|
// "!PIAZZA" COMUNE + PROVINCIA
|
1999-10-22 10:00:18 +00:00
|
|
|
|
// "!CAP" CAP
|
|
|
|
|
// "!RAGSOC" Ragione sociale
|
|
|
|
|
// Queste macro sono state implementate per permettere di utilizzare
|
|
|
|
|
// L'indirizzo di spedizione effetti memorizzato in LF_CFVEN->CODINDEFF
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TString in(s.get());
|
|
|
|
|
if (in[0]=='!')
|
|
|
|
|
{
|
|
|
|
|
in.ltrim(1);
|
|
|
|
|
TRelation* rel = relation();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
const bool pick_normal = rel->lfile(LF_CFVEN).get_int(CFV_CODINDEFF) == 0;
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in=="IND")
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_INDCF : IND_INDIR);
|
|
|
|
|
in = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CIVCF : IND_CIV);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in.not_empty())
|
|
|
|
|
valore << ", " << in;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (in=="PIAZZA")
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore = rel->lfile(pick_normal ? LF_COMUNI : -213).get(COM_DENCOM);
|
|
|
|
|
in = rel->lfile(pick_normal ? LF_COMUNI : -213).get(COM_PROVCOM);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in.not_empty())
|
|
|
|
|
valore << " (" << in << ")";
|
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (in=="RAGSOC")
|
|
|
|
|
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_RAGSOC : IND_RAGSOC);
|
|
|
|
|
else
|
|
|
|
|
if (in=="CAPCF")
|
|
|
|
|
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CAPCF : IND_CAP);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
cf.set(valore);
|
|
|
|
|
cf.put_paragraph(valore);
|
|
|
|
|
return (TRUE);
|
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
if (code == "_FATT")
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1996-12-06 15:48:24 +00:00
|
|
|
|
// gestione dei campi relativi alle fatture a cui si riferisce un effetto
|
|
|
|
|
// sintassi: _FATT,<macro>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// "!DATI" numero e data fattura
|
1998-01-09 16:33:25 +00:00
|
|
|
|
TEffetto effetto(cursor()->file().curr()); //= eff.curr();
|
1996-12-06 15:48:24 +00:00
|
|
|
|
long num = effetto.numero();
|
|
|
|
|
TToken_string* dati = effetto.dati_fatt(num);
|
|
|
|
|
int elem = dati->items();
|
|
|
|
|
TString descfatt;
|
|
|
|
|
TString in(s.get()); // prende il primo parametro, il codice del messaggio
|
|
|
|
|
if (in[0]=='!')
|
|
|
|
|
{
|
|
|
|
|
in.ltrim(1);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// "!DATIFATT" stampa numero e data fattura delle fatture a cui si riferisce l'effetto
|
|
|
|
|
if (in == "DATIFATT")
|
1996-12-06 15:48:24 +00:00
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < elem; i+=3)
|
|
|
|
|
{
|
|
|
|
|
descfatt << dati->get(i);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
descfatt << " ";
|
1996-12-06 15:48:24 +00:00
|
|
|
|
descfatt << dati->get(i+1);
|
|
|
|
|
descfatt << " ";
|
|
|
|
|
cf.set(descfatt);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
valore = cf.get();
|
|
|
|
|
cf.put_paragraph(valore);
|
|
|
|
|
return (TRUE);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
if (code == "_DATA")
|
|
|
|
|
{
|
|
|
|
|
// gestione della data di emissione delle riba
|
|
|
|
|
// sintassi: _DATA
|
|
|
|
|
const TDate data_emis = app().msk().get_date(F_DATAEMIS);
|
|
|
|
|
valore = data_emis.string();
|
|
|
|
|
cf.set(valore);
|
|
|
|
|
cf.put_paragraph(valore);
|
1996-12-06 15:48:24 +00:00
|
|
|
|
cf.set("");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
return TRUE;
|
1996-12-06 15:48:24 +00:00
|
|
|
|
}
|
|
|
|
|
return TForm::validate(cf, s);
|
|
|
|
|
}
|
|
|
|
|
|
1997-02-10 11:22:42 +00:00
|
|
|
|
// gestione dei messaggi estesi nei campi
|
1999-10-22 10:00:18 +00:00
|
|
|
|
void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TString& str)
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1998-05-27 13:41:48 +00:00
|
|
|
|
const TString code(s.get(0));
|
|
|
|
|
TString valore;
|
|
|
|
|
if (code == "_FISSO")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1998-05-27 13:41:48 +00:00
|
|
|
|
// gestione dei campi fissi per i record delle riba
|
|
|
|
|
// sintassi: _FISSO,!<valore>
|
|
|
|
|
// dove: <valore> <20> la stringa fissa da emettere
|
1997-02-10 11:22:42 +00:00
|
|
|
|
TString in(s.get());
|
1998-05-27 13:41:48 +00:00
|
|
|
|
CHECK(in[0]=='!',"Macro _FISSO senza carattere '!'");
|
|
|
|
|
in.ltrim(1);
|
|
|
|
|
in.trim();
|
|
|
|
|
valore = in;
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else if (code == "_DATA")
|
1997-02-12 09:15:50 +00:00
|
|
|
|
{
|
1998-05-27 13:41:48 +00:00
|
|
|
|
// gestione della data di emissione delle riba
|
|
|
|
|
// sintassi: _DATA
|
1997-02-12 09:15:50 +00:00
|
|
|
|
const TDate data_emis = app().msk().get_date(F_DATAEMIS);
|
|
|
|
|
valore = data_emis.string();
|
1997-02-18 15:10:08 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else if (code == "_NRIBA")
|
1997-02-12 09:15:50 +00:00
|
|
|
|
{
|
1998-05-27 13:41:48 +00:00
|
|
|
|
// gestione dei campi relativi al flusso di effetti (riba)
|
|
|
|
|
// sintassi: _NRIBA,<macro>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
|
|
|
|
// "!NUM" numero progressivo riba all'interno del flusso
|
|
|
|
|
// "!TOT" numero di effetti nel flusso
|
|
|
|
|
// "!NREC" numero di records nel flusso
|
|
|
|
|
int items = (int)cur.items();
|
1997-02-10 11:22:42 +00:00
|
|
|
|
TString in(s.get());
|
1998-05-27 13:41:48 +00:00
|
|
|
|
CHECK(in[0]=='!',"Macro _NRIBA senza carattere '!'");
|
|
|
|
|
in.ltrim(1);
|
|
|
|
|
if (in=="NUM")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1998-05-27 13:41:48 +00:00
|
|
|
|
valore.cut(0);
|
|
|
|
|
valore << cur.pos() + 1;
|
|
|
|
|
}
|
|
|
|
|
else if (in=="TOT")
|
|
|
|
|
{
|
|
|
|
|
valore.cut(0);
|
|
|
|
|
valore << items;
|
|
|
|
|
}
|
|
|
|
|
else if (in=="NREC")
|
|
|
|
|
{
|
|
|
|
|
valore.cut(0);
|
|
|
|
|
int rec = items * 7 + 2;
|
|
|
|
|
valore << rec;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
CHECKS (TRUE,"Sotto-Macro _NRIBA non definita",(const char *)in);
|
1997-02-18 15:10:08 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else if (code == "_DITTA")
|
1998-05-27 13:41:48 +00:00
|
|
|
|
{
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// gestione di campi della ditta corrente
|
1998-05-27 13:41:48 +00:00
|
|
|
|
// sintassi: _DITTA,<macro>,<opzione>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
|
|
|
|
// "!RAGSOC" ragione sociale
|
|
|
|
|
// dove: <opzione> <20> uno delle opzioni seguenti:
|
|
|
|
|
// "0" la ragione sociale andr<64> ad occupare un unico campo
|
|
|
|
|
// "1" la ragione sociale andr<64> ad occupare pi<70> campi, primo segmento
|
|
|
|
|
// "2" la ragione sociale andr<64> ad occupare pi<70> campi, secondo segmento
|
|
|
|
|
// "3" la ragione sociale andr<64> ad occupare pi<70> campi, terzo segmento
|
|
|
|
|
// "4" la ragione sociale andr<64> ad occupare pi<70> campi, quarto segmento
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1997-02-10 11:22:42 +00:00
|
|
|
|
TString in(s.get());
|
1998-05-27 13:41:48 +00:00
|
|
|
|
CHECK(in[0]=='!',"Macro _DITTA senza carattere '!'");
|
|
|
|
|
in.ltrim(1);
|
|
|
|
|
if (in=="RAGSOC")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const TRectype& ditte = app().firm_rel().curr();
|
1998-05-27 13:41:48 +00:00
|
|
|
|
const TString ragsoc = ditte.get("RAGSOC");
|
|
|
|
|
in = s.get();
|
|
|
|
|
if (in == "0")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1998-05-27 13:41:48 +00:00
|
|
|
|
valore.cut(0);
|
|
|
|
|
valore = ragsoc.left(30);
|
|
|
|
|
valore.trim();
|
|
|
|
|
TString str = ragsoc.right(20);
|
|
|
|
|
str.trim();
|
|
|
|
|
valore << " " << str;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TParagraph_string string(ragsoc,24);
|
|
|
|
|
const int indice = atoi(in);
|
|
|
|
|
valore = string.get(indice-1);
|
1998-05-27 13:41:48 +00:00
|
|
|
|
}
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
1998-05-27 13:41:48 +00:00
|
|
|
|
else
|
|
|
|
|
CHECKS (TRUE,"Sotto-Macro _DITTA non definita",(const char *)in);
|
1997-02-18 15:10:08 +00:00
|
|
|
|
}
|
1998-05-27 13:41:48 +00:00
|
|
|
|
else if (code == "_DEBITORE")
|
|
|
|
|
{
|
|
|
|
|
// gestione di campi della ditta corrente
|
|
|
|
|
// sintassi: _DEBITORE,<macro>,<opzione>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
|
|
|
|
// "!RAGSOC" ragione sociale
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// "!CFPI" Partita IVA o Codice fiscale
|
1998-05-27 13:41:48 +00:00
|
|
|
|
// "!INDIRIZZO" indirizzo
|
|
|
|
|
// "!PIAZZA" comune + sigla provincia
|
|
|
|
|
// dove: <opzione> <20> uno delle opzioni seguenti:
|
|
|
|
|
// "1" la ragione sociale andr<64> ad occupare pi<70> campi, primo segmento
|
|
|
|
|
// "2" la ragione sociale andr<64> ad occupare pi<70> campi, secondo segmento
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const bool pick_normal = cur.relation()->lfile(LF_CFVEN).get_int(CFV_CODINDEFF) == 0;
|
|
|
|
|
|
|
|
|
|
TRectype& clifo_1 = cur.curr(LF_CLIFO);
|
|
|
|
|
TRectype& clifo_2 = cur.curr(pick_normal ? LF_CLIFO : LF_INDSP);
|
|
|
|
|
TRectype& comuni = cur.curr(pick_normal ? LF_COMUNI: -213);
|
|
|
|
|
|
1997-02-10 11:22:42 +00:00
|
|
|
|
TString in(s.get());
|
1998-05-27 13:41:48 +00:00
|
|
|
|
CHECK(in[0]=='!',"Macro _DEBITORE senza carattere '!'");
|
|
|
|
|
in.ltrim(1);
|
|
|
|
|
if (in=="RAGSOC")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TString ragsoc = clifo_2.get(pick_normal ? CLI_RAGSOC : IND_RAGSOC);
|
1998-05-27 13:41:48 +00:00
|
|
|
|
in = s.get();
|
|
|
|
|
TParagraph_string string(ragsoc,30);
|
|
|
|
|
string.restart();
|
|
|
|
|
int indice = atoi(in);
|
|
|
|
|
if (in == "1") valore = string.get(indice-1);
|
|
|
|
|
if (in == "2") valore = string.get(indice-1);
|
|
|
|
|
}
|
|
|
|
|
else if (in=="INDIRIZZO")
|
|
|
|
|
{
|
|
|
|
|
valore.cut(0);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore << clifo_2.get(pick_normal ? CLI_INDCF : IND_INDIR);
|
1998-05-27 13:41:48 +00:00
|
|
|
|
valore.trim();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore << " " << clifo_2.get_int(pick_normal ? CLI_CIVCF : IND_CIV);
|
1998-05-27 13:41:48 +00:00
|
|
|
|
valore.trim();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore << " " << clifo_2.get(pick_normal ? CLI_LOCCF : IND_LOCALITA);
|
1998-05-27 13:41:48 +00:00
|
|
|
|
valore.trim();
|
|
|
|
|
}
|
|
|
|
|
else if (in=="COMUNE")
|
|
|
|
|
{
|
|
|
|
|
valore.cut(0);
|
|
|
|
|
valore << comuni.get("DENCOM");
|
|
|
|
|
valore.trim();
|
|
|
|
|
}
|
|
|
|
|
else if (in=="PROV")
|
|
|
|
|
{
|
|
|
|
|
valore = comuni.get("PROVCOM");
|
|
|
|
|
valore.trim();
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else if (in=="CFPI")
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore = clifo_1.get("PAIV");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valore.trim();
|
|
|
|
|
if (valore.empty())
|
1999-10-22 10:00:18 +00:00
|
|
|
|
valore = clifo_1.get("COFI");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valore.trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
1998-05-27 13:41:48 +00:00
|
|
|
|
CHECKS (TRUE,"Sotto-Macro _DEBITORE non definita",(const char *)in);
|
|
|
|
|
}
|
|
|
|
|
else if (code == "_BANCA")
|
|
|
|
|
{
|
1997-02-12 09:15:50 +00:00
|
|
|
|
// gestione dei campi relativi alla banca d'appoggio dell'effetto
|
|
|
|
|
// sintassi: _BANCA
|
1997-02-10 11:22:42 +00:00
|
|
|
|
TRectype & ban = cur.curr(-401);
|
|
|
|
|
valore.cut(0);
|
|
|
|
|
valore << ban.get("S0");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valore.trim();
|
|
|
|
|
ban = cur.curr(-402);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
valore << " " << ban.get("S0");
|
|
|
|
|
valore.trim();
|
1998-05-27 13:41:48 +00:00
|
|
|
|
}
|
|
|
|
|
else if (code == "_FATT")
|
|
|
|
|
{
|
|
|
|
|
// gestione dei campi relativi alle/a fatture/a a cui si riferisce un effetto
|
|
|
|
|
// sintassi: _FATT,<opzione>
|
|
|
|
|
// dove: <opzione> <20> uno delle opzioni seguenti:
|
|
|
|
|
// "1" i dati della fattura andranno ad occupare pi<70> campi, primo segmento
|
|
|
|
|
// "2" i dati della fattura andranno ad occupare pi<70> campi, secondo segmento
|
|
|
|
|
TLocalisamfile &eff = cur.file();
|
1997-02-10 11:22:42 +00:00
|
|
|
|
TEffetto effetto = eff.curr();
|
|
|
|
|
long num = effetto.numero();
|
|
|
|
|
TToken_string* dati = effetto.dati_fatt(num);
|
|
|
|
|
int elem = dati->items();
|
|
|
|
|
TString descfatt;
|
|
|
|
|
for (int i = 0; i < elem; i+=3)
|
|
|
|
|
{
|
1999-06-18 15:35:05 +00:00
|
|
|
|
descfatt << dati->get(i);
|
|
|
|
|
descfatt << " ";
|
|
|
|
|
descfatt << dati->get(i+1);
|
|
|
|
|
descfatt << " ";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1997-02-10 11:22:42 +00:00
|
|
|
|
int l = descfatt.len();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TString in(s.get());
|
1997-02-10 11:22:42 +00:00
|
|
|
|
if (in[0]=='!')
|
|
|
|
|
{
|
|
|
|
|
in.ltrim(1);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in == "1")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
|
|
|
|
valore = descfatt.left(40);
|
|
|
|
|
valore.trim();
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (in == "2")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
|
|
|
|
valore = descfatt.mid(40, l);
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1997-02-18 15:10:08 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else if (code == "_IMPORTO")
|
1997-02-12 09:15:50 +00:00
|
|
|
|
{
|
1998-05-27 13:41:48 +00:00
|
|
|
|
// gestione di campi degli importi degli effetti nel flusso
|
|
|
|
|
// sintassi: _IMPORTO,<macro>
|
|
|
|
|
// dove: <macro> <20> uno delle macro seguenti:
|
|
|
|
|
// "!ADD" aggiunge l'importo dell'effetto corrente al totale
|
|
|
|
|
// "!TOT" emette il totale
|
1999-06-18 15:35:05 +00:00
|
|
|
|
const TString in(s.get());
|
1998-05-27 13:41:48 +00:00
|
|
|
|
CHECK(in[0]=='!',"Macro _IMPORTO senza carattere '!'");
|
1999-06-18 15:35:05 +00:00
|
|
|
|
if (in=="!ADD")
|
1997-02-10 11:22:42 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
// real importo(str);
|
|
|
|
|
real importo = cur.curr(LF_REFFETTI).get(REFF_IMPORTO);
|
|
|
|
|
if (_codice_moneta == 'E')
|
|
|
|
|
importo *= 100.0;
|
|
|
|
|
importo.round(0);
|
1998-05-27 13:41:48 +00:00
|
|
|
|
add_tot_importi(importo);
|
1999-06-18 15:35:05 +00:00
|
|
|
|
valore = importo.string(13,0);
|
1997-02-10 11:22:42 +00:00
|
|
|
|
}
|
1999-06-18 15:35:05 +00:00
|
|
|
|
else if (in=="!TOT")
|
1998-05-27 13:41:48 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const real& importo = tot_importi();
|
1999-06-18 15:35:05 +00:00
|
|
|
|
valore = importo.string("##############@");
|
|
|
|
|
set_tot_importi(ZERO);
|
1998-05-27 13:41:48 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
CHECKS (TRUE,"Sotto-Macro _IMPORTO non definita",(const char *)in);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
else if (code == "_CODSIA")
|
|
|
|
|
{
|
|
|
|
|
TConfig cnf(CONFIG_DITTA, "ef");
|
|
|
|
|
valore = cnf.get("CODSIA");
|
|
|
|
|
}
|
|
|
|
|
else if (code == "_CODMON")
|
|
|
|
|
{
|
|
|
|
|
valore.format("%c", _codice_moneta);
|
|
|
|
|
}
|
|
|
|
|
else NFCHECK("Macro non definita: %s", (const char *)code);
|
|
|
|
|
|
1998-05-27 13:41:48 +00:00
|
|
|
|
str = valore;
|
|
|
|
|
}
|
1997-02-10 11:22:42 +00:00
|
|
|
|
|
1996-12-06 15:48:24 +00:00
|
|
|
|
int ef0500(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
TEmissione a ;
|
|
|
|
|
a.run(argc, argv, "Emissione Effetti e Distinte");
|
|
|
|
|
return 0;
|
1997-09-08 13:23:59 +00:00
|
|
|
|
}
|