1998-09-01 14:39:37 +00:00
|
|
|
|
#include <applicat.h>
|
|
|
|
|
#include <form.h>
|
|
|
|
|
#include <automask.h>
|
|
|
|
|
#include <progind.h>
|
2006-12-13 16:22:33 +00:00
|
|
|
|
#include <recset.h>
|
1998-09-01 14:39:37 +00:00
|
|
|
|
#include <recarray.h>
|
|
|
|
|
#include <utility.h>
|
|
|
|
|
|
|
|
|
|
#include "777.h"
|
|
|
|
|
#include "777100a.h"
|
|
|
|
|
|
|
|
|
|
#include <anagr.h>
|
|
|
|
|
#include <anafis.h>
|
|
|
|
|
#include <anagiu.h>
|
2008-03-11 15:50:42 +00:00
|
|
|
|
#include <attiv.h>
|
1998-09-01 14:39:37 +00:00
|
|
|
|
#include <comuni.h>
|
|
|
|
|
#include <nditte.h>
|
|
|
|
|
#include "base.h"
|
|
|
|
|
#include "quadroc.h"
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
2002-09-13 14:06:05 +00:00
|
|
|
|
// Utility
|
1998-09-01 14:39:37 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
static int anno_dic()
|
|
|
|
|
{
|
2008-03-11 15:50:42 +00:00
|
|
|
|
static anno = 0;
|
|
|
|
|
if (anno <= 0)
|
2002-09-13 14:06:05 +00:00
|
|
|
|
{
|
|
|
|
|
TConfig ini(CONFIG_STUDIO);
|
|
|
|
|
anno = ini.get_int("AnnoDic");
|
|
|
|
|
}
|
|
|
|
|
return anno;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
#define CF_PRODUTTORE "00909290355"
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TForm770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TRecord770;
|
|
|
|
|
class TTrasferimento770;
|
|
|
|
|
|
|
|
|
|
class TForm770 : public TForm
|
|
|
|
|
{
|
|
|
|
|
TCursor* _sortedcur;
|
|
|
|
|
|
|
|
|
|
int _index;
|
|
|
|
|
TArray _records;
|
|
|
|
|
TPointer_array _positions;
|
2008-03-11 15:50:42 +00:00
|
|
|
|
TAssoc_array _riep_ss;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
bool compatible(const TRectype& r1, const TRectype& r2);
|
|
|
|
|
void add_rec(TRectype& r1, const TRectype& r2);
|
|
|
|
|
|
|
|
|
|
long raggruppa_c();
|
|
|
|
|
int first();
|
|
|
|
|
int next();
|
|
|
|
|
|
|
|
|
|
void transfer_section(TPrint_section& body, int rigo,
|
|
|
|
|
TRecord770& rec, TTrasferimento770& file);
|
|
|
|
|
char log2rec(int num, int& rpm) const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual TCursor* cursor() { return _sortedcur ? _sortedcur : TForm::cursor(); }
|
2002-09-13 14:06:05 +00:00
|
|
|
|
virtual bool validate(TForm_item &cf, TToken_string &s);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
long trasfer(long codditta, TTrasferimento770& file, char tipo, int rpm);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
TAssoc_array& riepilogo_ss() { return _riep_ss; }
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
TForm770(const char* name);
|
|
|
|
|
virtual ~TForm770();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TRecord770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
enum { CODE_SIZE = 8, FIELD_SIZE = 16, BLOCK_SIZE = 24, HEADER_SIZE = 89, USEABLE_SIZE = 1800, TOTAL_SIZE = 1900 };
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
struct TField770 : public TObject
|
|
|
|
|
{
|
|
|
|
|
TString _desc;
|
|
|
|
|
int _pos; // Base 1
|
|
|
|
|
int _len;
|
|
|
|
|
char _type; // A/N
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TTracciato770 : public TObject
|
|
|
|
|
{
|
|
|
|
|
char _tipo;
|
|
|
|
|
TArray _fields;
|
|
|
|
|
|
|
|
|
|
protected:
|
2006-12-13 16:22:33 +00:00
|
|
|
|
void add_field(const char* name, char type, int pos, int len, int filedno = 0);
|
|
|
|
|
void add_filler(int pos, int len, char tipo = 'A')
|
|
|
|
|
{ add_field("Filler", tipo, pos, len); }
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
const TField770& field(int pos) const;
|
|
|
|
|
void auto_fill(TString& buffer) const;
|
|
|
|
|
|
|
|
|
|
TTracciato770(char tipo);
|
|
|
|
|
virtual ~TTracciato770();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TTracciati770 : public TObject
|
|
|
|
|
{
|
|
|
|
|
TArray _trc;
|
|
|
|
|
TAssoc_array _form;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
const TTracciato770& tracciato(char tipo);
|
|
|
|
|
TForm770& form(const char* quadro, char& tipo, int& rpm);
|
|
|
|
|
|
|
|
|
|
void destroy();
|
|
|
|
|
|
|
|
|
|
TTracciati770();
|
|
|
|
|
virtual ~TTracciati770();
|
|
|
|
|
} _trc770;
|
|
|
|
|
|
|
|
|
|
class TCache770 : public TObject
|
|
|
|
|
{
|
|
|
|
|
TArray _files;
|
|
|
|
|
TAssoc_array _tables;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
const TRectype& get(int num, const char* key);
|
|
|
|
|
const TRectype& get(int num, long key);
|
|
|
|
|
void destroy();
|
|
|
|
|
|
|
|
|
|
TCache770() { }
|
|
|
|
|
virtual ~TCache770() { }
|
|
|
|
|
} _cache770;
|
|
|
|
|
|
|
|
|
|
class TRecord770 : public TObject
|
|
|
|
|
{
|
|
|
|
|
TString _buffer;
|
|
|
|
|
|
|
|
|
|
protected: // TObject
|
|
|
|
|
virtual TObject* dup() const { return new TRecord770(*this); }
|
|
|
|
|
virtual void print_on(ostream& outs) const;
|
|
|
|
|
virtual void read_from(istream& ins);
|
|
|
|
|
|
|
|
|
|
protected: // TObject
|
|
|
|
|
const TTracciato770& tracciato() const
|
|
|
|
|
{ return _trc770.tracciato(tipo_record()); }
|
|
|
|
|
|
|
|
|
|
const TField770& get_field(int pos) const
|
|
|
|
|
{ return tracciato().field(pos); }
|
|
|
|
|
|
|
|
|
|
void set(const TField770& fld, const char* val);
|
|
|
|
|
int calculate_blocks(const char* val) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void set(int pos, const char* val);
|
|
|
|
|
void set(int pos, int val);
|
|
|
|
|
void set(int pos, long val);
|
|
|
|
|
void set(int pos, const real& val);
|
|
|
|
|
void set(int pos, const TDate& val);
|
|
|
|
|
void set(int pos, char val);
|
|
|
|
|
void set(int pos, bool val);
|
|
|
|
|
bool add(const char* code, const char* val);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
bool add(const char* code, const real& val);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
const char* get(int pos, TString& str) const;
|
|
|
|
|
int get_int(int pos) const;
|
|
|
|
|
char get_char(int pos) const;
|
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
bool np_get(int pos, TString& key, TString& val) const;
|
|
|
|
|
bool np_get_real(int pos, TString& key, real& val) const;
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
const TRecord770& operator=(const TRecord770& rec)
|
|
|
|
|
{ _buffer = rec._buffer; return *this; }
|
|
|
|
|
|
|
|
|
|
char tipo_record() const { return _buffer[0]; }
|
|
|
|
|
void tipo_record(char tipo)
|
|
|
|
|
{ _buffer[0] = tipo; tracciato().auto_fill(_buffer); }
|
|
|
|
|
|
|
|
|
|
void azzera_campi_non_posizionali();
|
2008-03-11 15:50:42 +00:00
|
|
|
|
bool ha_campi_non_posizionali() const { return strchr("EHJ", tipo_record()) != NULL; }
|
2002-09-13 14:06:05 +00:00
|
|
|
|
bool ha_campi_non_posizionali_compilati() const
|
|
|
|
|
{ return _buffer[90] > ' '; }
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
bool valid() const;
|
|
|
|
|
|
|
|
|
|
TRecord770();
|
|
|
|
|
TRecord770(char tipo);
|
|
|
|
|
TRecord770(const TRecord770& rec);
|
|
|
|
|
TRecord770(const TRectype& rec);
|
|
|
|
|
virtual ~TRecord770();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TTrasferimento770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TTrasferimento770 : public TObject
|
|
|
|
|
{
|
|
|
|
|
TFilename _name;
|
|
|
|
|
ifstream* _in_stream;
|
|
|
|
|
ofstream* _out_stream;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
long _cod_ditta, _codan_dic;
|
|
|
|
|
TString8 _codatt_dic;
|
|
|
|
|
char _tipoa_dic;
|
|
|
|
|
TString16 _codfis_dic;
|
|
|
|
|
TString _ragsoc_dic;
|
|
|
|
|
bool _save_headers;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
protected:
|
|
|
|
|
void riepiloga_ss(const TRecord770& rec, TArray& riep_ss) const;
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
public:
|
2007-09-17 15:33:04 +00:00
|
|
|
|
bool open(const char* path = "", char mode = 'r', int volume = 0);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
bool close();
|
|
|
|
|
bool write(const TRecord770& rec);
|
|
|
|
|
bool read(TRecord770& rec);
|
|
|
|
|
bool eof() const { return _in_stream && _in_stream->eof(); }
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
const char* default_name() const;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
TTrasferimento770& operator<<(const TRecord770& rec)
|
|
|
|
|
{ write(rec); return *this; }
|
|
|
|
|
TTrasferimento770& operator>>(TRecord770& rec)
|
|
|
|
|
{ read(rec); return *this; }
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
const TString& read_codfis_dic(const TRectype& rec);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TString& cod_fis_dic() const { return _codfis_dic; }
|
|
|
|
|
|
|
|
|
|
int conta_certificazioni() const;
|
|
|
|
|
bool casella_prospetto_st() const;
|
|
|
|
|
bool casella_prospetto_sx() const;
|
|
|
|
|
bool append_record_b();
|
1998-09-01 14:39:37 +00:00
|
|
|
|
long append_quadro(const char* quadro, long codditta, TProgind& pi);
|
|
|
|
|
|
|
|
|
|
bool split(const char* dest_path);
|
|
|
|
|
void remove();
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
void save_headers(bool s) { _save_headers = s; }
|
|
|
|
|
bool save_headers() const { return _save_headers; }
|
|
|
|
|
|
2007-09-17 15:33:04 +00:00
|
|
|
|
TTrasferimento770(const char* name = "", char mode = 'r', int volume = 0);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
virtual ~TTrasferimento770();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Implementazioni
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TForm770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
bool TForm770::validate(TForm_item &cf, TToken_string &s)
|
|
|
|
|
{
|
|
|
|
|
const TString code(s.get(0)); // prende il primo parametro, il codice del messaggio
|
|
|
|
|
if (code == "_PERIODO_RIF")
|
|
|
|
|
{
|
|
|
|
|
const TRectype& curr = relation()->curr();
|
|
|
|
|
int anno = curr.get_int("QLAP");
|
|
|
|
|
int mese = curr.get_int("QLMP");
|
|
|
|
|
TString8 str;
|
|
|
|
|
str.format("%02d%04d", mese, anno);
|
|
|
|
|
cf.set(str);
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return true;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
}
|
|
|
|
|
return TForm::validate(cf, s);
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
void TForm770::transfer_section(TPrint_section& body, int rigo,
|
|
|
|
|
TRecord770& rec, TTrasferimento770& file)
|
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
TString8 basecode, code, type;
|
|
|
|
|
TString str;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
body.update();
|
|
|
|
|
for (word f = 0; f < body.fields(); f++)
|
|
|
|
|
{
|
|
|
|
|
TForm_item& fi = body.field(f);
|
|
|
|
|
str = fi.get(); str.trim();
|
|
|
|
|
if (fi.shown() && str.not_empty())
|
|
|
|
|
{
|
|
|
|
|
basecode = fi.get_special_value("TRASFER");
|
|
|
|
|
if (basecode.not_empty())
|
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
type = fi.get_special_desc("TRASFER");
|
|
|
|
|
if (!type.blank())
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (type == "BO")
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
str = str.blank() ? "" : "1";
|
1998-09-01 14:39:37 +00:00
|
|
|
|
str.right_just(16);
|
2005-10-17 10:15:01 +00:00
|
|
|
|
} else
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (type == "CU")
|
|
|
|
|
{
|
|
|
|
|
const int dot = str.find('.');
|
|
|
|
|
if (dot >= 0)
|
|
|
|
|
str.cut(dot);
|
|
|
|
|
if (real::is_null(str))
|
|
|
|
|
str.cut(0);
|
|
|
|
|
else
|
|
|
|
|
str.right_just(16);
|
2005-10-17 10:15:01 +00:00
|
|
|
|
} else
|
|
|
|
|
if (type == "DT")
|
|
|
|
|
{
|
|
|
|
|
str.strip("-");
|
|
|
|
|
str.right_just(16);
|
|
|
|
|
} else
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (type == "NU")
|
1998-09-01 14:39:37 +00:00
|
|
|
|
str.right_just(16);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (fi.fields() > 0)
|
|
|
|
|
{
|
|
|
|
|
const TFieldref& fr = ((TForm_string&)fi).field(0);
|
|
|
|
|
const int num = fr.file();
|
|
|
|
|
const char* fn = fr.name();
|
2005-10-17 10:15:01 +00:00
|
|
|
|
const TFieldtypes ft = cursor()->curr(num).type(fn);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
switch (ft)
|
|
|
|
|
{
|
|
|
|
|
case _boolfld:
|
|
|
|
|
if (!str.blank())
|
|
|
|
|
str = "1";
|
|
|
|
|
str.right_just(16);
|
|
|
|
|
break;
|
|
|
|
|
case _datefld:
|
|
|
|
|
if (str.len() == 10 && str[2] == '-' && str[5] == '-')
|
|
|
|
|
{
|
|
|
|
|
str.strip("-");
|
|
|
|
|
str.right_just(16);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case _realfld:
|
|
|
|
|
{
|
|
|
|
|
const int dot = str.find('.');
|
|
|
|
|
if (dot >= 0)
|
|
|
|
|
str.cut(dot);
|
|
|
|
|
if (real::is_null(str))
|
|
|
|
|
str.cut(0);
|
|
|
|
|
else
|
|
|
|
|
str.right_just(16);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
|
|
|
|
if (str.not_empty())
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
const int vero_rigo = atoi(basecode.mid(2, 3)) - 1 + rigo;
|
|
|
|
|
code.format("%c%c%03d%c%c%c",
|
|
|
|
|
basecode[0], basecode[1], vero_rigo,
|
|
|
|
|
basecode[5], basecode[6], basecode[7]);
|
|
|
|
|
if (!rec.add(code, str))
|
|
|
|
|
{
|
|
|
|
|
file << rec;
|
|
|
|
|
rec.azzera_campi_non_posizionali();
|
|
|
|
|
rec.add(code, str);
|
|
|
|
|
}
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TForm770::compatible(const TRectype& r1, const TRectype& r2)
|
|
|
|
|
{
|
|
|
|
|
if (r1.empty() || r2.empty())
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return true;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
if (r1.get_long(QUC_CODDITTA) != r2.get_long(QUC_CODDITTA))
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return false;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
if (r1.get_char(QUC_TIPOA) != r2.get_char(QUC_TIPOA))
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return false;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
if (r1.get_long(QUC_CODANAGR) != r2.get_long(QUC_CODANAGR))
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return false;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
if (r1.get_char(QUC_CAUSALE) != r2.get_char(QUC_CAUSALE))
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return false;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
if (r1.get_int(QUC_TASSAZIONE) != r2.get_int(QUC_TASSAZIONE))
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return false;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
const real p1 = r1.get_real(QUC_PERC);
|
|
|
|
|
const real p2 = r2.get_real(QUC_PERC);
|
|
|
|
|
bool yes = (p1 == ZERO && p2 != ZERO) || (p1 == p2);
|
|
|
|
|
return yes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TForm770::add_rec(TRectype& r1, const TRectype& r2)
|
|
|
|
|
{
|
|
|
|
|
if (r1.empty())
|
|
|
|
|
r1 = r2;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (int f = r1.items()-1; f >= 0; f--)
|
|
|
|
|
{
|
|
|
|
|
const char* name = r1.fieldname(f);
|
|
|
|
|
if (r1.type(name) == _realfld)
|
|
|
|
|
{
|
|
|
|
|
real val = r1.get_real(name);
|
|
|
|
|
val += r2.get_real(name);
|
|
|
|
|
r1.put(name, val);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
r1.put(QUC_PERC, r2.get(QUC_PERC));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long TForm770::raggruppa_c()
|
|
|
|
|
{
|
|
|
|
|
TCursor& cur = *cursor();
|
|
|
|
|
TRectype& rc = cur.curr();
|
|
|
|
|
_records.destroy();
|
|
|
|
|
for (cur = 0; cur.ok(); ++cur)
|
|
|
|
|
{
|
2004-07-28 08:34:44 +00:00
|
|
|
|
bool append = true;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
const int last = _records.items()-1;
|
|
|
|
|
if (last >= 0)
|
|
|
|
|
{
|
|
|
|
|
TRectype& sum = (TRectype&)_records[last];
|
|
|
|
|
if (compatible(sum, rc))
|
|
|
|
|
{
|
|
|
|
|
add_rec(sum, rc);
|
2004-07-28 08:34:44 +00:00
|
|
|
|
append = false;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (append)
|
|
|
|
|
{
|
|
|
|
|
_records.add(rc);
|
|
|
|
|
_positions.add_long(cur.pos()+1);
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-10-06 10:51:26 +00:00
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
return _records.items();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TForm770::first()
|
|
|
|
|
{
|
|
|
|
|
TCursor& cur = *cursor();
|
|
|
|
|
|
|
|
|
|
cur = 0;
|
|
|
|
|
bool ok = cur.ok();
|
|
|
|
|
|
|
|
|
|
if (cur.file().num() == LF_QUAC)
|
|
|
|
|
{
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
raggruppa_c();
|
|
|
|
|
_index = 0;
|
|
|
|
|
cur.curr() = (TRectype&)_records[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ok ? NOERR : _iseof;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TForm770::next()
|
|
|
|
|
{
|
|
|
|
|
TCursor& cur = *cursor();
|
|
|
|
|
|
|
|
|
|
bool ok;
|
|
|
|
|
if (cur.file().num() == LF_QUAC)
|
|
|
|
|
{
|
|
|
|
|
_index++;
|
|
|
|
|
ok = _index < _records.items();
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
cur = _positions.get_long(_index) - 1;
|
|
|
|
|
cur.curr() = (TRectype&)_records[_index];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
++cur;
|
|
|
|
|
ok = cur.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ok ? NOERR : _iseof;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long TForm770::trasfer(long codditta, TTrasferimento770& file,
|
|
|
|
|
char rectype, int rpm)
|
|
|
|
|
{
|
|
|
|
|
TCursor& cur = *cursor();
|
|
|
|
|
|
|
|
|
|
// Filtra il cursore sulla ditta corrente
|
|
|
|
|
TRectype filter(cur.curr());
|
|
|
|
|
filter.zero();
|
|
|
|
|
filter.put(BSE_CODDITTA, codditta);
|
|
|
|
|
cur.setregion(filter, filter);
|
|
|
|
|
|
|
|
|
|
const long items = cur.items();
|
|
|
|
|
if (items > 0) // Se c'e almeno un record ...
|
|
|
|
|
{
|
2004-07-28 08:34:44 +00:00
|
|
|
|
cur.freeze(true); // Per efficienza congela il cursore
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
// Inizializza record col primo modulo
|
|
|
|
|
TRecord770 rec(rectype);
|
|
|
|
|
int modulo = 1;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
int rigo = 1;
|
|
|
|
|
|
|
|
|
|
rec.set(2, file.cod_fis_dic());
|
|
|
|
|
rec.set(3, modulo);
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
switch (rectype)
|
|
|
|
|
{
|
|
|
|
|
case 'E': rec.set(8, CF_PRODUTTORE); break;
|
|
|
|
|
case 'H': rec.set(9, CF_PRODUTTORE); break;
|
|
|
|
|
default : break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
TPrint_section& body = section('B', odd_page);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
int err = first(); // Deve sempre tornare NOERR
|
|
|
|
|
for (; err == NOERR; err = next())
|
|
|
|
|
{
|
|
|
|
|
transfer_section(body, rigo, rec, file);
|
|
|
|
|
rigo++;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (rigo > rpm)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
// Scrivi record se non vuoto
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (rec.ha_campi_non_posizionali_compilati())
|
1998-09-01 14:39:37 +00:00
|
|
|
|
file << rec;
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
// Avanza al prossimo modulo ed azzera la riga
|
|
|
|
|
rigo = 1;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
modulo++;
|
|
|
|
|
|
|
|
|
|
rec.azzera_campi_non_posizionali();
|
2002-09-13 14:06:05 +00:00
|
|
|
|
rec.set(3, modulo);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Ultimo record parzialmente compilato
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (rec.ha_campi_non_posizionali_compilati())
|
1998-09-01 14:39:37 +00:00
|
|
|
|
file << rec;
|
|
|
|
|
|
2004-07-28 08:34:44 +00:00
|
|
|
|
cur.freeze(false);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return items;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TForm770::TForm770(const char* name)
|
2008-03-11 15:50:42 +00:00
|
|
|
|
: TForm(name), _sortedcur(NULL)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
const char* key = NULL;
|
|
|
|
|
|
|
|
|
|
switch (TForm::cursor()->file().num())
|
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
case LF_QUALA: key = "CODDITTA|216@->RAGSOC|TIPOA|CODANAGR"; break;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
default : break;
|
|
|
|
|
}
|
|
|
|
|
if (key)
|
|
|
|
|
_sortedcur = new TSorted_cursor(TForm::relation(), key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TForm770::~TForm770()
|
|
|
|
|
{
|
|
|
|
|
if (_sortedcur)
|
|
|
|
|
delete _sortedcur;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TTracciato770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
void TTracciato770::add_field(const char* name, char type, int pos, int len, int fldno)
|
|
|
|
|
{
|
2007-09-17 15:33:04 +00:00
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case 'B':
|
|
|
|
|
CHECKD(len == 1, "Booleano di lunghezza sospetta", len);
|
|
|
|
|
type = 'N';
|
|
|
|
|
break;
|
|
|
|
|
case 'C':
|
|
|
|
|
CHECKD(len == 16, "Codice fiscale di lunghezza sospetta", len);
|
|
|
|
|
type = 'A';
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
CHECKD(len == 6 || len == 8, "Data di lunghezza sospetta", len);
|
|
|
|
|
type = 'N';
|
|
|
|
|
break;
|
|
|
|
|
case 'P':
|
|
|
|
|
CHECKD(len == 2, "provincia di lunghezza sospetta", len);
|
|
|
|
|
type = 'A';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
TField770* info = new TField770;
|
|
|
|
|
info->_desc = name;
|
|
|
|
|
info->_type = type;
|
|
|
|
|
info->_pos = pos;
|
|
|
|
|
info->_len = len;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
if (fldno <= 0)
|
2007-09-17 15:33:04 +00:00
|
|
|
|
fldno = _fields.add(info)+1;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
else
|
|
|
|
|
_fields.add(info, fldno-1);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TField770& TTracciato770::field(int pos) const
|
|
|
|
|
{
|
|
|
|
|
TField770* info = (TField770*)_fields.objptr(pos-1);
|
|
|
|
|
CHECKD(info, "Campo non valido ", pos);
|
|
|
|
|
return *info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TTracciato770::auto_fill(TString& buffer) const
|
|
|
|
|
{
|
|
|
|
|
buffer.fill(' ', TOTAL_SIZE);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
for (int f = _fields.last(); f >= 0; f = _fields.pred(f))
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
const TField770& info = (const TField770&)_fields[f];
|
|
|
|
|
if (info._desc == "Filler")
|
|
|
|
|
{
|
|
|
|
|
const char fill = info._type == 'N' ? '0' : ' ';
|
|
|
|
|
char* index = buffer.get_buffer();
|
|
|
|
|
index += info._pos - 1;
|
|
|
|
|
memset(index, fill, info._len);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
buffer[0] = _tipo;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
buffer.overwrite("A\r\n", TOTAL_SIZE-3);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TTracciato770::TTracciato770(char tipo) : _tipo(tipo)
|
|
|
|
|
{
|
2008-03-11 15:50:42 +00:00
|
|
|
|
if (strchr("ABEHJZ", tipo) == NULL)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
NFCHECK("Tipo record non valido: %c", tipo);
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
add_field("Tipo record", 'A', 1, 1); // 1
|
|
|
|
|
|
|
|
|
|
if (tipo == 'A')
|
|
|
|
|
{
|
|
|
|
|
add_filler(2, 14); // 2
|
2006-12-13 16:22:33 +00:00
|
|
|
|
add_field("Codice fornitura", 'N', 16, 5); // 3
|
2002-09-13 14:06:05 +00:00
|
|
|
|
add_field("Tipo fornitore", 'N', 21, 2); // 4
|
2007-09-17 15:33:04 +00:00
|
|
|
|
add_field("Codice fiscale del fornitore", 'C', 23, 16);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
add_filler(39, 483);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
// Dichiarazione su pi<70> invii
|
2006-12-13 16:22:33 +00:00
|
|
|
|
add_field("Progressivo dell'invio", 'N', 522, 4); // 7
|
2002-09-13 14:06:05 +00:00
|
|
|
|
add_field("Numero totale degli invii", 'N', 526, 4);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
} else
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (tipo == 'B')
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2007-09-17 15:33:04 +00:00
|
|
|
|
add_field("Codice fiscale dichiarante", 'C', 2, 16); // 2
|
2002-09-13 14:06:05 +00:00
|
|
|
|
add_field("Progressivo modulo", 'N', 18, 8);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
add_filler( 26, 3);
|
2007-09-17 15:33:04 +00:00
|
|
|
|
add_filler( 29,25);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
add_field("Spazio a disposizione", 'A', 54, 20);
|
2007-09-17 15:33:04 +00:00
|
|
|
|
add_field("CF del produttore del software", 'C', 74, 16); // 7
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
add_field("Flag conferma", 'N', 90, 1);
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
|
|
|
|
// Tipo di dichiarazione
|
|
|
|
|
add_field("Dichiarazione correttiva nei termini", 'N', 91, 1); // 9
|
|
|
|
|
add_filler( 92, 1);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
add_field("Dichiarazione integrativa", 'N', 93, 1);
|
|
|
|
|
add_field("Eventi eccezzziunali veramente", 'N', 94, 1); // 12
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
2007-09-17 15:33:04 +00:00
|
|
|
|
// Dati del contribuente
|
|
|
|
|
add_field("Cognome", 'A', 95, 24); // 13
|
|
|
|
|
add_field("Nome", 'A',119, 20);
|
|
|
|
|
add_field("Denominazione (Alternativo a 25 e 26)",'A',139, 60);
|
|
|
|
|
add_filler(199,11);
|
|
|
|
|
add_filler(210, 1);
|
|
|
|
|
add_filler(211, 1);
|
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
add_field("Codice Attivit<69>", 'N', 212, 6); // 19
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
add_field("Natura giuridica", 'N', 487, 2, 33); // 33
|
|
|
|
|
add_field("Data variazione sede legale", 'D', 489, 6);
|
|
|
|
|
add_field("Comune della sede legale", 'A', 495,40);
|
|
|
|
|
add_field("Sigla della provincia sede legale", 'A', 535, 2);
|
|
|
|
|
add_field("CAP del comune della sede legale", 'A', 537, 5);
|
|
|
|
|
add_field("Codice comune", 'A', 542, 4);
|
|
|
|
|
add_field("Indirizzo della sede legale", 'A', 546,35);
|
|
|
|
|
add_field("Data variazione domicilio fiscale", 'N', 581, 6); // 40
|
|
|
|
|
add_field("Comune del domicilio fiscale", 'A', 587,40);
|
|
|
|
|
add_field("Provincia del domicilio fiscale", 'A', 627, 2);
|
|
|
|
|
add_field("CAP del domicilio fiscale", 'N', 629, 5);
|
|
|
|
|
add_field("Codice comune", 'A', 634, 5);
|
|
|
|
|
add_field("Indirizzo del domicilio fiscale", 'A', 638,35);
|
|
|
|
|
add_field("Stato", 'N', 673, 1);
|
|
|
|
|
add_field("Situazione", 'N', 674, 1);
|
|
|
|
|
|
2008-03-17 22:05:14 +00:00
|
|
|
|
add_field("Firma del dichiarante", 'B', 761, 1, 54); // 54
|
2008-03-11 15:50:42 +00:00
|
|
|
|
|
|
|
|
|
add_field("Redazione della dichiarazione", 'N', 796, 1, 74); // 74
|
2007-09-17 15:33:04 +00:00
|
|
|
|
add_field("Numero comunicaz. lavoro dipendente", 'N', 797, 8);
|
|
|
|
|
add_field("Numero comunicaz. lavoro autonomo", 'N', 805, 8);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
add_field("Casella prospetto SS", 'N', 813, 1);
|
|
|
|
|
add_field("Casella prospetto ST", 'N', 814, 1);
|
|
|
|
|
add_field("Casella prospetto SX", 'N', 815, 1);
|
|
|
|
|
|
2008-03-17 22:05:14 +00:00
|
|
|
|
add_field("Codice fiscale", 'C',1020,16, 90); // 90
|
2008-03-11 15:50:42 +00:00
|
|
|
|
add_field("Denominazione (Alternativo a 91 e 92)",'A',1036,60);
|
|
|
|
|
add_field("Cognome", 'A',1096,24);
|
|
|
|
|
add_field("Nome", 'A',1120,20);
|
|
|
|
|
add_field("Comune", 'A',1140,40);
|
|
|
|
|
add_field("Provincia", 'A',1180, 2);
|
|
|
|
|
add_field("Codice comune", 'A',1182, 4);
|
|
|
|
|
add_field("Cap comune", 'A',1186, 5);
|
|
|
|
|
add_field("Tipologia", 'A',1191,15);
|
|
|
|
|
add_field("Indirizzo", 'A',1206,35);
|
|
|
|
|
add_field("Numero Civico", 'A',1241,10); // 100
|
|
|
|
|
|
|
|
|
|
add_field("Codice fiscale del rappresentante", 'C',1396,16,107); // 107
|
|
|
|
|
add_field("Codice carica del rappresentante", 'N',1412, 2);
|
|
|
|
|
add_field("Data carica del rappresentante", 'D',1414, 8);
|
|
|
|
|
add_filler(1422, 11);
|
|
|
|
|
add_field("Denominazione (Alternativo a 112-117)",'A',1433,60,111); // 111
|
|
|
|
|
add_field("Cognome", 'A',1493,24);
|
|
|
|
|
add_field("Nome", 'A',1517,20);
|
|
|
|
|
add_field("Sesso", 'A',1537, 1);
|
|
|
|
|
add_field("Data di nascita", 'D',1538, 8);
|
|
|
|
|
add_field("Comune di nascita", 'A',1546,40); // 116
|
|
|
|
|
add_field("Provincia di nascita", 'A',1586, 2);
|
|
|
|
|
add_field("Comune residenza", 'A',1588,40);
|
|
|
|
|
add_field("Provincia residenza", 'A',1628, 2);
|
|
|
|
|
add_field("Cap residenza", 'N',1630, 5);
|
|
|
|
|
add_field("Indirizzo residenza", 'A',1635,35); // 121
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
} else
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (tipo == 'E')
|
|
|
|
|
{
|
2007-09-17 15:33:04 +00:00
|
|
|
|
add_field("Codice fiscale del dichiarante", 'C', 2, 16); // 2
|
2002-09-13 14:06:05 +00:00
|
|
|
|
add_field("Progressivo modulo", 'N', 18, 8);
|
|
|
|
|
add_field("Spazio a disposizione", 'A', 26, 3);
|
|
|
|
|
add_field("Tipo operazione", 'A', 29, 1);
|
|
|
|
|
add_filler(30, 24);
|
|
|
|
|
add_field("Spazio a disposizione", 'A', 54, 20);
|
|
|
|
|
add_field("Codice fiscale della software house", 'A', 74, 16); // 8
|
2006-12-13 16:22:33 +00:00
|
|
|
|
} else
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (tipo == 'H')
|
|
|
|
|
{
|
2007-09-17 15:33:04 +00:00
|
|
|
|
add_field("Codice fiscale del dichiarante", 'C', 2, 16); // 2
|
2002-09-13 14:06:05 +00:00
|
|
|
|
add_field("Progressivo comunicazione", 'N', 18, 8);
|
|
|
|
|
add_field("Spazio a disposizione", 'A', 26, 3);
|
|
|
|
|
add_field("Tipo operazione", 'A', 29, 1);
|
|
|
|
|
add_field("Codice fiscale del percipiente", 'A', 30, 16); // 6
|
|
|
|
|
add_filler(46, 8);
|
|
|
|
|
add_field("Spazio a disposizione", 'A', 54, 20);
|
|
|
|
|
add_field("Codice fiscale della software house", 'A', 74, 16); // 9
|
2006-12-13 16:22:33 +00:00
|
|
|
|
} else
|
2008-03-11 15:50:42 +00:00
|
|
|
|
if (tipo == 'J')
|
|
|
|
|
{
|
|
|
|
|
add_field("Codice fiscale del dichiarante", 'C', 2, 16); // 2
|
|
|
|
|
add_field("Progressivo modulo", 'N', 18, 8);
|
|
|
|
|
add_field("Spazio a disposizione", 'A', 26, 3);
|
|
|
|
|
add_field("Tipo operazione", 'A', 29, 1);
|
|
|
|
|
add_filler(30, 24);
|
|
|
|
|
add_field("Spazio a disposizione", 'A', 54, 20);
|
|
|
|
|
add_field("Codice fiscale della software house", 'A', 74, 16); // 8
|
|
|
|
|
} else
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (tipo == 'Z')
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
add_filler(2, 14); // 2
|
|
|
|
|
add_field("Numero record di tipo 'B'", 'N', 16, 9);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
add_field("Numero record di tipo 'E'", 'N', 25, 9);
|
|
|
|
|
add_field("Numero record di tipo 'F'", 'N', 34, 9);
|
|
|
|
|
add_field("Numero record di tipo 'G'", 'N', 43, 9); // 6
|
|
|
|
|
add_field("Numero record di tipo 'H'", 'N', 52, 9);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
add_field("Numero record di tipo 'J'", 'N', 61, 9);
|
2008-03-17 22:05:14 +00:00
|
|
|
|
add_filler(70, 1828);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TTracciato770::~TTracciato770()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TTracciati770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
const TTracciato770& TTracciati770::tracciato(char tipo)
|
|
|
|
|
{
|
|
|
|
|
const int pos = tipo-'A';
|
|
|
|
|
TTracciato770* trc = (TTracciato770*)_trc.objptr(pos);
|
|
|
|
|
if (trc == NULL)
|
|
|
|
|
{
|
|
|
|
|
trc = new TTracciato770(tipo);
|
|
|
|
|
_trc.add(trc, pos);
|
|
|
|
|
}
|
|
|
|
|
return *trc;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
TForm770& TTracciati770::form(const char* quadro, char& tiporec, int& rpm)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
CHECK(quadro && *quadro != '\0' && quadro[1] != '\0',
|
1998-09-01 14:39:37 +00:00
|
|
|
|
"Codice quadro non valido");
|
|
|
|
|
|
|
|
|
|
const char* name;
|
|
|
|
|
switch(quadro[1])
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
case 'A': name = "77qla"; tiporec = 'H'; rpm = 1; break;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
case 'T': name = "77qst"; tiporec = 'E'; rpm = 12; break;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
default : name = NULL; break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TForm770* frm = (TForm770*)_form.objptr(name);
|
|
|
|
|
if (frm == NULL)
|
|
|
|
|
{
|
|
|
|
|
frm = new TForm770(name);
|
|
|
|
|
_form.add(name, frm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return *frm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TTracciati770::destroy()
|
|
|
|
|
{
|
|
|
|
|
_trc.destroy();
|
|
|
|
|
_form.destroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TTracciati770::TTracciati770()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TTracciati770::~TTracciati770()
|
|
|
|
|
{
|
|
|
|
|
destroy(); // Non viene mai chiamato!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TCache770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
const TRectype& TCache770::get(int num, const char* key)
|
|
|
|
|
{
|
|
|
|
|
TRecord_cache* rc = (TRecord_cache*)_files.objptr(num);
|
|
|
|
|
if (rc == NULL)
|
|
|
|
|
{
|
|
|
|
|
rc = new TRecord_cache(num);
|
|
|
|
|
_files.add(rc, num);
|
|
|
|
|
}
|
|
|
|
|
return rc->get(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TRectype& TCache770::get(int num, long key)
|
|
|
|
|
{
|
|
|
|
|
TString16 str; str << key;
|
|
|
|
|
return get(num, str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TCache770::destroy()
|
|
|
|
|
{
|
|
|
|
|
_files.destroy();
|
|
|
|
|
_tables.destroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TRecord770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
void TRecord770::print_on(ostream& outs) const
|
|
|
|
|
{
|
|
|
|
|
outs.write(_buffer, TOTAL_SIZE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::read_from(istream& ins)
|
|
|
|
|
{
|
|
|
|
|
_buffer.fill(' ', TOTAL_SIZE);
|
|
|
|
|
ins.read(_buffer.get_buffer(), TOTAL_SIZE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::set(const TField770& fld, const char* val)
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TString80 str(val);
|
|
|
|
|
if (fld._type == 'A')
|
|
|
|
|
str.upper();
|
1998-09-01 14:39:37 +00:00
|
|
|
|
int lenstr = str.len();
|
|
|
|
|
if (lenstr > fld._len)
|
|
|
|
|
{
|
|
|
|
|
#ifdef DBG
|
|
|
|
|
NFCHECK("Campo troppo lungo: %s (max. %d)", val, fld._len);
|
|
|
|
|
#endif
|
|
|
|
|
str.cut(lenstr = fld._len);
|
|
|
|
|
}
|
|
|
|
|
if (lenstr != fld._len)
|
|
|
|
|
{
|
|
|
|
|
str.trim();
|
|
|
|
|
if (fld._type == 'N')
|
2006-12-13 16:22:33 +00:00
|
|
|
|
str.right_just(fld._len, '0');
|
1998-09-01 14:39:37 +00:00
|
|
|
|
else
|
2006-12-13 16:22:33 +00:00
|
|
|
|
str.left_just(fld._len);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
_buffer.overwrite(str, fld._pos-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::set(int pos, const char* val)
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = tracciato().field(pos);
|
|
|
|
|
set(fld, val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::set(int pos, int val)
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = tracciato().field(pos);
|
|
|
|
|
CHECKD(fld._type == 'N', "Invalid numeric field ", pos);
|
|
|
|
|
TString16 str; str.format("%d", val);
|
|
|
|
|
set(fld, str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::set(int pos, long val)
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = tracciato().field(pos);
|
|
|
|
|
CHECKD(fld._type == 'N', "Invalid numeric field ", pos);
|
|
|
|
|
TString16 str; str.format("%ld", val);
|
|
|
|
|
set(fld, str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::set(int pos, const real& val)
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = tracciato().field(pos);
|
|
|
|
|
CHECKD(fld._type == 'N', "Invalid numeric field ", pos);
|
|
|
|
|
const char* str = val.string(fld._len, 0);
|
|
|
|
|
set(fld, str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::set(int pos, const TDate& val)
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = tracciato().field(pos);
|
|
|
|
|
CHECKD(fld._type == 'N' && (fld._len == 6 || fld._len == 8),
|
|
|
|
|
"Invalid date field ", pos);
|
|
|
|
|
const char* str;
|
|
|
|
|
if (fld._len == 8)
|
|
|
|
|
str = val.string(full, '\0', full, full, gma_date);
|
|
|
|
|
else
|
|
|
|
|
str = val.string(brief, '\0', full, full, gma_date);
|
|
|
|
|
set(fld, str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::set(int pos, char val)
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = get_field(pos);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
CHECKD(fld._type == 'A' && fld._len == 1, "Invalid char field ", pos);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
const char str[2] = { val, '\0' };
|
|
|
|
|
set(fld, str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRecord770::set(int pos, bool val)
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = get_field(pos);
|
|
|
|
|
CHECKD(fld._type == 'N' && fld._len == 1,
|
|
|
|
|
"Invalid boolean field ", pos);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
set(fld, val ? "1" : "0");
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char* TRecord770::get(int pos, TString& str) const
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = get_field(pos);
|
|
|
|
|
str = _buffer.mid(fld._pos-1, fld._len);
|
|
|
|
|
return str.trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TRecord770::get_int(int pos) const
|
|
|
|
|
{
|
|
|
|
|
TString16 str; get(pos, str);
|
|
|
|
|
return atoi(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char TRecord770::get_char(int pos) const
|
|
|
|
|
{
|
|
|
|
|
const TField770& fld = get_field(pos);
|
|
|
|
|
CHECKD(fld._type == 'A', "Invalid char field ", pos);
|
|
|
|
|
return _buffer[fld._pos-1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Calcola i blocchi necessari per contenere la stringa val
|
|
|
|
|
int TRecord770::calculate_blocks(const char* val) const
|
2002-09-13 14:06:05 +00:00
|
|
|
|
{
|
2007-09-17 15:33:04 +00:00
|
|
|
|
// Il primo blocco contiene 16 caratteri, gli altri solo 15 perche' c'e' anche il +
|
1998-09-01 14:39:37 +00:00
|
|
|
|
int blocks = 1;
|
|
|
|
|
const int len = strlen(val);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (len > FIELD_SIZE)
|
|
|
|
|
blocks += (len-FIELD_SIZE-1) / (FIELD_SIZE-1) + 1;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
return blocks;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
// Azzera tutti i campi non posizionali dei record di tipo E
|
1998-09-01 14:39:37 +00:00
|
|
|
|
void TRecord770::azzera_campi_non_posizionali()
|
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
CHECK(ha_campi_non_posizionali(), "Impossibile azzerare un record senza campi non posizionali");
|
|
|
|
|
char* buf = _buffer.get_buffer() + HEADER_SIZE;
|
|
|
|
|
memset(buf, ' ', USEABLE_SIZE);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
// Aggiunge un campo non posizionale ai record di tipo E
|
1998-09-01 14:39:37 +00:00
|
|
|
|
bool TRecord770::add(const char* code, const char* val)
|
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
CHECK(ha_campi_non_posizionali(), "Impossibile aggiungere campi non posizionali");
|
|
|
|
|
CHECKS(code && strlen(code) == CODE_SIZE, "Invalid field code ", code);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
CHECKS(val && *val, "Can't add empty field ", code);
|
|
|
|
|
|
|
|
|
|
// Cerca il primo posto libero
|
2008-03-11 15:50:42 +00:00
|
|
|
|
for (int pos = HEADER_SIZE; pos < HEADER_SIZE+USEABLE_SIZE; pos += BLOCK_SIZE)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
if (_buffer[pos] == ' ')
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
const int free_blocks = (USEABLE_SIZE - pos) / BLOCK_SIZE;
|
|
|
|
|
const int needed_blocks = calculate_blocks(val);
|
|
|
|
|
const bool ok = free_blocks >= needed_blocks;
|
|
|
|
|
|
|
|
|
|
if (ok) // Se ci sono abbastanza blocchi liberi
|
|
|
|
|
{
|
|
|
|
|
TString80 str(val); str.upper();
|
|
|
|
|
const int lenstr = str.len();
|
|
|
|
|
for (int i = 0; i < lenstr; )
|
|
|
|
|
{
|
|
|
|
|
_buffer.overwrite(code, pos);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
pos += CODE_SIZE;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
int maxlen = FIELD_SIZE;
|
|
|
|
|
if (i > 0)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
_buffer.overwrite("+", pos);
|
|
|
|
|
pos++;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
maxlen--;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
const TString& substr = str.mid(i, maxlen);
|
|
|
|
|
_buffer.overwrite(substr, pos);
|
|
|
|
|
pos += maxlen;
|
|
|
|
|
i += maxlen;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
bool TRecord770::add(const char* code, const real& val)
|
|
|
|
|
{
|
|
|
|
|
return add(code, val.string(16, 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TRecord770::np_get(int pos, TString& key, TString& val) const
|
|
|
|
|
{
|
|
|
|
|
CHECK(ha_campi_non_posizionali(), "Impossibile leggere campi non posizionali");
|
|
|
|
|
const int n = HEADER_SIZE + pos * BLOCK_SIZE;
|
|
|
|
|
bool ok = false;
|
|
|
|
|
if (n < HEADER_SIZE + USEABLE_SIZE)
|
|
|
|
|
{
|
|
|
|
|
ok = _buffer[n] > ' ';
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
key = _buffer.mid(n, CODE_SIZE);
|
|
|
|
|
val = _buffer.mid(n+CODE_SIZE, FIELD_SIZE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TRecord770::np_get_real(int pos, TString& key, real& val) const
|
|
|
|
|
{
|
|
|
|
|
TString16 str;
|
|
|
|
|
const bool ok = np_get(pos, key, str);
|
|
|
|
|
if (ok)
|
|
|
|
|
val = real(str);
|
|
|
|
|
else
|
|
|
|
|
val = ZERO;
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
bool TRecord770::valid() const
|
|
|
|
|
{
|
|
|
|
|
char tipo = tipo_record();
|
2008-03-11 15:50:42 +00:00
|
|
|
|
bool ok = (tipo > ' ') && (strchr("ABEHJZ", tipo) != NULL);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TRecord770::TRecord770() : _buffer(TOTAL_SIZE, ' ')
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TRecord770::TRecord770(char tipo) : _buffer(TOTAL_SIZE, ' ')
|
|
|
|
|
{
|
|
|
|
|
tipo_record(tipo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TRecord770::TRecord770(const TRecord770& rec) : _buffer(rec._buffer)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
TRecord770::~TRecord770()
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TTrasferimento770
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
const char* TTrasferimento770::default_name() const
|
|
|
|
|
{
|
|
|
|
|
return format("MOD770%02d", (anno_dic()+1) % 100);
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-17 15:33:04 +00:00
|
|
|
|
bool TTrasferimento770::open(const char* path, char mode, int volume)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
CHECK(mode == 'r' || mode == 'w', "Invalid open mode");
|
|
|
|
|
close();
|
|
|
|
|
|
|
|
|
|
if (path && *path)
|
|
|
|
|
{
|
|
|
|
|
_name = path;
|
|
|
|
|
_name.add(default_name());
|
2007-09-17 15:33:04 +00:00
|
|
|
|
if (volume > 0)
|
|
|
|
|
_name << '_' << volume;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
if (_name.empty())
|
2007-09-17 15:33:04 +00:00
|
|
|
|
{
|
1998-09-01 14:39:37 +00:00
|
|
|
|
_name = default_name();
|
2007-09-17 15:33:04 +00:00
|
|
|
|
if (volume > 0)
|
|
|
|
|
_name << '_' << volume;
|
|
|
|
|
}
|
1998-09-01 14:39:37 +00:00
|
|
|
|
if (mode == 'r')
|
2008-03-11 15:50:42 +00:00
|
|
|
|
_in_stream = new ifstream(_name, ios::in | ios::nocreate | ios::binary);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
else
|
|
|
|
|
_out_stream = new ofstream(_name, ios::out | ios::binary);
|
|
|
|
|
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return true;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TTrasferimento770::close()
|
|
|
|
|
{
|
|
|
|
|
if (_in_stream)
|
|
|
|
|
{
|
|
|
|
|
delete _in_stream;
|
|
|
|
|
_in_stream = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (_out_stream)
|
|
|
|
|
{
|
|
|
|
|
delete _out_stream;
|
|
|
|
|
_out_stream = NULL;
|
|
|
|
|
}
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return true;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TTrasferimento770::write(const TRecord770& rec)
|
|
|
|
|
{
|
|
|
|
|
bool ok = _out_stream != NULL;
|
|
|
|
|
if (ok)
|
|
|
|
|
(*_out_stream) << rec;
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TTrasferimento770::read(TRecord770& rec)
|
|
|
|
|
{
|
|
|
|
|
bool ok = _in_stream != NULL && !_in_stream->eof();
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
(*_in_stream) >> rec;
|
|
|
|
|
ok = rec.valid();
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
const TString& TTrasferimento770::read_codfis_dic(const TRectype& rec)
|
|
|
|
|
{
|
2008-03-11 15:50:42 +00:00
|
|
|
|
TToken_string key; // Stringa multiuso
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
|
|
|
|
key = rec.get(BSE_CODDIC);
|
|
|
|
|
if (key.empty())
|
|
|
|
|
key = rec.get(BSE_CODDITTA);
|
|
|
|
|
|
|
|
|
|
const TRectype& rec_nditte = _cache770.get(LF_NDITTE, key);
|
2002-10-24 10:47:49 +00:00
|
|
|
|
if (rec_nditte.empty())
|
|
|
|
|
{
|
2008-03-11 15:50:42 +00:00
|
|
|
|
error_box(FR("Non esiste la ditta %s"), (const char*)key);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return EMPTY_STRING;
|
2002-10-24 10:47:49 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
_cod_ditta = atol(key);
|
|
|
|
|
_tipoa_dic = rec_nditte.get_char(NDT_TIPOA);
|
|
|
|
|
_codan_dic = rec_nditte.get_long(NDT_CODANAGR);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
_codatt_dic = rec_nditte.get(NDT_CODATTPREV); // Codice attivita' prevalente
|
|
|
|
|
key.add(_codatt_dic); // key = CODDITTA|CODATTPREV
|
|
|
|
|
const TRectype& attiv = _cache770.get(LF_ATTIV, key);
|
|
|
|
|
if (attiv.exist(ATT_CODATECO)) // Non e' detto che il campo esista sempre
|
|
|
|
|
{
|
|
|
|
|
const TString& codateco = attiv.get(ATT_CODATECO);
|
|
|
|
|
if (codateco.full())
|
|
|
|
|
_codatt_dic = codateco;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
key.cut(0) << _tipoa_dic;
|
|
|
|
|
key.add(rec_nditte.get(NDT_CODANAGR));
|
2002-09-13 14:06:05 +00:00
|
|
|
|
const TRectype& rec_anagr = _cache770.get(LF_ANAG, key);
|
2002-10-24 10:47:49 +00:00
|
|
|
|
if (rec_anagr.empty())
|
|
|
|
|
{
|
2008-03-11 15:50:42 +00:00
|
|
|
|
error_box(FR("Non esiste la persona %s"), (const char*)key);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return EMPTY_STRING;
|
2002-10-24 10:47:49 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
_codfis_dic = rec_anagr.get(ANA_COFI); // Codice fiscale del dichiarante
|
|
|
|
|
_ragsoc_dic = rec_anagr.get(ANA_RAGSOC); // Denominazione del dichiarante
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return _codfis_dic;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TTrasferimento770::conta_certificazioni() const
|
|
|
|
|
{
|
|
|
|
|
TString query;
|
|
|
|
|
query.format("USE %d\nFROM CODDITTA=%ld\nTO CODDITTA=%ld",
|
|
|
|
|
LF_QUALA, _cod_ditta, _cod_ditta);
|
|
|
|
|
TISAM_recordset recset(query);
|
|
|
|
|
return recset.items();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TTrasferimento770::casella_prospetto_st() const
|
|
|
|
|
{
|
|
|
|
|
// Il quadro ST e' il "vecchio" quadro L
|
|
|
|
|
TString query;
|
|
|
|
|
query.format("USE %d\nFROM CODDITTA=%ld\nTO CODDITTA=%ld",
|
|
|
|
|
LF_QUAL, _cod_ditta, _cod_ditta);
|
|
|
|
|
TISAM_recordset recset(query);
|
|
|
|
|
return recset.items() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TTrasferimento770::casella_prospetto_sx() const
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TTrasferimento770::append_record_b()
|
|
|
|
|
{
|
|
|
|
|
bool ok = false;
|
|
|
|
|
if (save_headers())
|
|
|
|
|
{
|
|
|
|
|
// Compila record di testata B
|
|
|
|
|
TRecord770 rec('B');
|
|
|
|
|
rec.set(2, cod_fis_dic());
|
|
|
|
|
rec.set(3, 1); // Modulo (deve essere sempre 1)
|
|
|
|
|
rec.set(7, CF_PRODUTTORE); // CF del produttore AGA
|
|
|
|
|
if (_tipoa_dic == 'F')
|
|
|
|
|
{
|
2007-09-17 15:33:04 +00:00
|
|
|
|
rec.set(13, _ragsoc_dic.left(24));
|
|
|
|
|
rec.set(14, _ragsoc_dic.mid(30,20));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2007-09-17 15:33:04 +00:00
|
|
|
|
rec.set(15, _ragsoc_dic);
|
|
|
|
|
rec.set(19, _codatt_dic);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
TToken_string key;
|
|
|
|
|
key << _tipoa_dic << '|' << _codan_dic;
|
|
|
|
|
const TRectype& rec_anagr = _cache770.get(LF_ANAG, key);
|
|
|
|
|
|
|
|
|
|
key = rec_anagr.get(ANA_STATORES);
|
|
|
|
|
key.add(rec_anagr.get(ANA_COMRES), 1);
|
|
|
|
|
const TRectype& rec_comres = _cache770.get(LF_COMUNI, key);
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (_tipoa_dic == 'G')
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec_anagiu = _cache770.get(LF_ANAGGIU, _codan_dic);
|
2007-09-17 15:33:04 +00:00
|
|
|
|
rec.set(33, rec_anagiu.get(ANG_NATGIU));
|
|
|
|
|
|
|
|
|
|
rec.set(35, rec_comres.get(COM_DENCOM));
|
|
|
|
|
rec.set(36, rec_comres.get(COM_PROVCOM));
|
|
|
|
|
TString indirizzo;
|
|
|
|
|
indirizzo << rec_anagr.get(ANA_INDRES) << ' ' << rec_anagr.get(ANA_CIVRES);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
indirizzo.strip_d_spaces(); indirizzo.cut(35);
|
|
|
|
|
rec.set(37, rec_anagr.get(ANA_CAPRES));
|
|
|
|
|
rec.set(38, rec_anagr.get(ANA_COMRES));
|
|
|
|
|
rec.set(39, indirizzo);
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
|
|
|
|
rec.set(46, rec_anagiu.get(ANG_STATOSOC));
|
|
|
|
|
rec.set(47, rec_anagiu.get(ANG_SITSOC));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
rec.set(74, 1);
|
|
|
|
|
rec.set(75, 0);
|
|
|
|
|
const int autonomi = conta_certificazioni();
|
|
|
|
|
rec.set(76, autonomi);
|
|
|
|
|
rec.set(77, autonomi > 0); // casella prospetto SS
|
2007-09-17 15:33:04 +00:00
|
|
|
|
rec.set(78, casella_prospetto_st());
|
|
|
|
|
rec.set(79, casella_prospetto_sx());
|
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
rec.set(90, cod_fis_dic());
|
|
|
|
|
rec.set(91, _ragsoc_dic);
|
|
|
|
|
rec.set(94, rec_comres.get(COM_DENCOM));
|
|
|
|
|
rec.set(95, rec_comres.get(COM_PROVCOM));
|
|
|
|
|
rec.set(96, rec_anagr.get(ANA_COMRES));
|
|
|
|
|
rec.set(97, rec_anagr.get(ANA_CAPRES));
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
|
|
|
|
TString80 indirizzo = rec_anagr.get(ANA_INDRES);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
indirizzo.strip_d_spaces(); indirizzo.trim();
|
2007-09-17 15:33:04 +00:00
|
|
|
|
TString8 tipologia;
|
|
|
|
|
const int spazio = indirizzo.find(' ');
|
2008-03-11 15:50:42 +00:00
|
|
|
|
if (spazio > 0 && spazio < 16) // Lunghezza accettabile per TString16 successiva
|
2007-09-17 15:33:04 +00:00
|
|
|
|
{
|
|
|
|
|
TString16 t = indirizzo.left(spazio);
|
|
|
|
|
t.trim(); t.upper();
|
2008-03-11 15:50:42 +00:00
|
|
|
|
if (t == "C.LE" || t == "CALLE") tipologia = "CALLE"; else
|
|
|
|
|
if (t == "C.SO" || t == "CORSO") tipologia = "CORSO"; else
|
2007-09-17 15:33:04 +00:00
|
|
|
|
if (t == "L.GO" || t == "LARGO") tipologia = "LARGO"; else
|
2008-03-11 15:50:42 +00:00
|
|
|
|
if (t == "P.CO" || t == "PARCO") tipologia = "PARCO"; else
|
2007-09-17 15:33:04 +00:00
|
|
|
|
if (t == "P.ZA" || t == "PIAZZA") tipologia = "PIAZZA"; else
|
2008-03-11 15:50:42 +00:00
|
|
|
|
if (t == "S.DA" || t == "STRADA") tipologia = "STRADA"; else
|
2007-09-17 15:33:04 +00:00
|
|
|
|
if (t == "V." || t == "VIA") tipologia = "VIA"; else
|
|
|
|
|
if (t == "V.LE" || t == "VIALE") tipologia = "VIALE"; else
|
|
|
|
|
if (t == "V.LO" || t == "VICOLO") tipologia = "VICOLO";
|
|
|
|
|
}
|
|
|
|
|
if (tipologia.full())
|
|
|
|
|
indirizzo = indirizzo.mid(spazio+1);
|
|
|
|
|
else
|
|
|
|
|
tipologia = "VIA";
|
|
|
|
|
indirizzo.cut(35);
|
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
rec.set(98, tipologia);
|
|
|
|
|
rec.set(99, indirizzo);
|
|
|
|
|
rec.set(100, rec_anagr.get(ANA_CIVRES));
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
|
|
|
|
const TRectype& rec_nditte = _cache770.get(LF_NDITTE, _cod_ditta);
|
|
|
|
|
|
|
|
|
|
key.cut(0) << "F|" << rec_nditte.get(NDT_RAPPR);
|
|
|
|
|
const TRectype& rec_rap = _cache770.get(LF_ANAG, key);
|
|
|
|
|
const TRectype& rec_rap_fis = _cache770.get(LF_ANAGFIS, key.get(1));
|
|
|
|
|
key.cut(0) << "|" << rec_rap_fis.get(ANF_COMNASC);
|
|
|
|
|
const TRectype& rec_com_nas = _cache770.get(LF_COMUNI, key);
|
|
|
|
|
key.cut(0) << "|" << rec_rap.get(ANA_COMRES);
|
|
|
|
|
const TRectype& rec_com_res = _cache770.get(LF_COMUNI, key);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
rec.set(107, rec_rap.get(ANA_COFI));
|
|
|
|
|
rec.set(108, rec_nditte.get(NDT_CARRAPP));
|
2007-09-17 15:33:04 +00:00
|
|
|
|
rec.set(111, rec_rap.get(ANA_RAGSOC).left(24));
|
|
|
|
|
rec.set(112, rec_rap.get(ANA_RAGSOC).mid(30, 20));
|
2008-03-11 15:50:42 +00:00
|
|
|
|
rec.set(114, rec_rap_fis.get(ANF_SESSO));
|
|
|
|
|
rec.set(115, rec_rap_fis.get_date(ANF_DATANASC));
|
|
|
|
|
rec.set(116, rec_com_nas.get(COM_DENCOM));
|
|
|
|
|
rec.set(117, rec_com_nas.get(COM_PROVCOM));
|
|
|
|
|
rec.set(118, rec_com_res.get(COM_DENCOM));
|
|
|
|
|
rec.set(119, rec_com_res.get(COM_PROVCOM));
|
|
|
|
|
rec.set(120, rec_rap.get(ANA_CAPRES));
|
2007-09-17 15:33:04 +00:00
|
|
|
|
indirizzo.cut(0);
|
|
|
|
|
indirizzo << rec_rap.get(ANA_INDRES) << ' ' << rec_rap.get(ANA_CIVRES);
|
2008-03-11 15:50:42 +00:00
|
|
|
|
indirizzo.strip_d_spaces(); indirizzo.cut(35); indirizzo.trim();
|
|
|
|
|
rec.set(121, indirizzo);
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
ok = write(rec);
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
long TTrasferimento770::append_quadro(const char* quadro, long codditta, TProgind& pi)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
TString str;
|
2008-03-11 15:50:42 +00:00
|
|
|
|
str << TR("Trasferimento quadro ") << quadro << TR(" ditta ") << codditta;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
pi.set_text(str);
|
|
|
|
|
|
|
|
|
|
char tipo;
|
|
|
|
|
int rpm;
|
|
|
|
|
TForm770& frm = _trc770.form(quadro, tipo, rpm);
|
|
|
|
|
long items = frm.trasfer(codditta, *this, tipo, rpm);
|
|
|
|
|
return items;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
void TTrasferimento770::riepiloga_ss(const TRecord770& rec, TArray& riep_ss) const
|
|
|
|
|
{
|
|
|
|
|
TString8 code;
|
|
|
|
|
real val;
|
|
|
|
|
for (int i = 0; rec.np_get_real(i, code, val); i++) if (code.starts_with("AU"))
|
|
|
|
|
{
|
|
|
|
|
const TString& key = code.right(3);
|
|
|
|
|
const int num = atoi(key);
|
|
|
|
|
if (num >= 25 && num <= 30)
|
|
|
|
|
{
|
|
|
|
|
const int idx = num-25;
|
|
|
|
|
real* r = (real*)riep_ss.objptr(idx);
|
|
|
|
|
if (r == NULL)
|
|
|
|
|
{
|
|
|
|
|
r = new real;
|
|
|
|
|
riep_ss.add(r, idx);
|
|
|
|
|
}
|
|
|
|
|
*r += val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
bool TTrasferimento770::split(const char* path)
|
|
|
|
|
{
|
|
|
|
|
close();
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
const long records = fsize(_name) / TOTAL_SIZE;
|
2008-03-11 15:50:42 +00:00
|
|
|
|
TRecnotype totale[26]; memset(totale, 0, sizeof(totale));
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
TRecord770 rec;
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
|
|
|
|
unsigned long disk_size = 15*1024*1024; // Max 15 Mb per fornitura
|
2003-04-04 08:48:51 +00:00
|
|
|
|
const bool magnetic = ::xvt_fsys_is_removable_drive(path) !=0;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
if (magnetic)
|
|
|
|
|
{
|
|
|
|
|
if (!yesno_box("Inserire il primo disco del trasferimento nell'unita' %s\n"
|
|
|
|
|
"Tutti i dischi devono essere vuoti ed avere la stesso formato.\n"
|
|
|
|
|
"Si desidera iniziare il trasferimento?", path))
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return false;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
2007-09-17 15:33:04 +00:00
|
|
|
|
disk_size = ::xvt_fsys_get_disk_size(path, 'b');
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
2007-09-17 15:33:04 +00:00
|
|
|
|
const long records_per_disk = long(disk_size / TOTAL_SIZE) - 3; // Tolgo A,B,Z
|
|
|
|
|
const int volumes = int((records-1)/records_per_disk)+1;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TProgind pi(records, "Generazione file trasferimento", false, true);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
// Read from start
|
|
|
|
|
open("", 'r');
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
for (int volume = 1; volume <= volumes; volume++)
|
|
|
|
|
{
|
|
|
|
|
if (magnetic && volume > 1)
|
|
|
|
|
{
|
|
|
|
|
if (!yesno_box("Inserire il disco %d di %d:\n"
|
|
|
|
|
"Si desidera proseguire il trasferimento?",
|
|
|
|
|
volume, volumes))
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-17 15:33:04 +00:00
|
|
|
|
|
|
|
|
|
// Specifica volume solo se necessario
|
|
|
|
|
const int v = (volumes > 1 && !magnetic) ? volume : 0;
|
|
|
|
|
TTrasferimento770 outfile(path, 'w', v);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (_save_headers)
|
|
|
|
|
{
|
|
|
|
|
// Compila record di testata A
|
|
|
|
|
rec.tipo_record('A');
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
rec.set(3, "77S08");
|
2006-12-13 16:22:33 +00:00
|
|
|
|
rec.set(4, 1); // 01 = Soggetto che invia la propria dichiarazione
|
|
|
|
|
rec.set(5, cod_fis_dic());
|
2007-09-17 15:33:04 +00:00
|
|
|
|
if (volumes > 1)
|
2006-12-13 16:22:33 +00:00
|
|
|
|
{
|
|
|
|
|
rec.set(7, volume);
|
|
|
|
|
rec.set(8, volumes);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rec.set(7, 0);
|
|
|
|
|
rec.set(8, 0);
|
|
|
|
|
}
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
outfile << rec; // Scrive record testata
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
long written = 0;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
TArray riep_ss;
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (records > 0)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
while (read(rec))
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2002-09-13 14:06:05 +00:00
|
|
|
|
pi.addstatus(1);
|
|
|
|
|
|
|
|
|
|
const char tipo_rec = rec.tipo_record();
|
2008-03-11 15:50:42 +00:00
|
|
|
|
if (tipo_rec <= 'A' || tipo_rec == 'J' || tipo_rec >= 'Z')
|
2002-09-13 14:06:05 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
outfile << rec;
|
|
|
|
|
written++;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
if (_save_headers)
|
|
|
|
|
{
|
|
|
|
|
totale[tipo_rec - 'A']++;
|
|
|
|
|
|
|
|
|
|
if (tipo_rec == 'H')
|
|
|
|
|
riepiloga_ss(rec, riep_ss);
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-17 15:33:04 +00:00
|
|
|
|
if (written >= records_per_disk)
|
2002-09-13 14:06:05 +00:00
|
|
|
|
break;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
2002-09-13 14:06:05 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
if (_save_headers)
|
|
|
|
|
{
|
2008-03-11 15:50:42 +00:00
|
|
|
|
// Compila record di riepilogo SS
|
|
|
|
|
if (riep_ss.items() > 0)
|
|
|
|
|
{
|
|
|
|
|
rec.tipo_record('J');
|
|
|
|
|
rec.set(2, cod_fis_dic());
|
|
|
|
|
rec.set(3, 1);
|
|
|
|
|
rec.set(8, CF_PRODUTTORE);
|
|
|
|
|
FOR_EACH_ARRAY_ITEM(riep_ss, i, obj)
|
|
|
|
|
{
|
|
|
|
|
const real* val = (const real*)obj;
|
|
|
|
|
if (val != NULL)
|
|
|
|
|
{
|
|
|
|
|
TString8 code;
|
|
|
|
|
code.format("SS003%03d", i+1); // i=0 -> SS0003001 -> AUXXX025
|
|
|
|
|
rec.add(code, *val);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
outfile << rec;
|
|
|
|
|
totale['J' - 'A']++; // Praticamente vale sempre 1
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
// Compila record di coda
|
|
|
|
|
rec.tipo_record('Z');
|
|
|
|
|
rec.set(3, totale['B'-'A']); // Totale B
|
|
|
|
|
rec.set(4, totale['E'-'A']); // Totale E
|
|
|
|
|
rec.set(5, totale['F'-'A']); // Totale F
|
|
|
|
|
rec.set(6, totale['G'-'A']); // Totale G
|
|
|
|
|
rec.set(7, totale['H'-'A']); // Totale H
|
2008-03-11 15:50:42 +00:00
|
|
|
|
rec.set(8, totale['J'-'A']); // Totale J
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
// Scrive record di coda
|
|
|
|
|
outfile << rec;
|
|
|
|
|
}
|
2002-09-13 14:06:05 +00:00
|
|
|
|
}
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return true;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cancella il file
|
|
|
|
|
void TTrasferimento770::remove()
|
|
|
|
|
{
|
|
|
|
|
close();
|
|
|
|
|
::remove(_name);
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-17 15:33:04 +00:00
|
|
|
|
TTrasferimento770::TTrasferimento770(const char* path, char mode, int volume)
|
2006-12-13 16:22:33 +00:00
|
|
|
|
: _in_stream(NULL), _out_stream(NULL), _save_headers(false)
|
1998-09-01 14:39:37 +00:00
|
|
|
|
{
|
2007-09-17 15:33:04 +00:00
|
|
|
|
open(path, mode, volume);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TTrasferimento770::~TTrasferimento770()
|
|
|
|
|
{
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// main
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TTransfer770_msk : public TAutomask
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& of, TField_event fe, long jolly);
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
public:
|
1998-09-16 10:07:53 +00:00
|
|
|
|
TTransfer770_msk();
|
1998-09-01 14:39:37 +00:00
|
|
|
|
virtual ~TTransfer770_msk() { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TTransfer770_msk::on_field_event(TOperable_field& of, TField_event fe, long jolly)
|
|
|
|
|
{
|
|
|
|
|
switch (of.dlg())
|
|
|
|
|
{
|
|
|
|
|
case F_PATH:
|
|
|
|
|
if (fe == fe_modify || fe == fe_close)
|
|
|
|
|
{
|
|
|
|
|
TFilename name = of.get();
|
|
|
|
|
if (!name.exist())
|
|
|
|
|
return error_box("Il percorso non e' valido");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2004-07-28 08:34:44 +00:00
|
|
|
|
return true;
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-09-16 10:07:53 +00:00
|
|
|
|
TTransfer770_msk::TTransfer770_msk() : TAutomask("777100a")
|
|
|
|
|
{
|
|
|
|
|
set(F_ANNO, anno_dic());
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
class TTransfer770_app : public TSkeleton_application
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual void main_loop();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void TTransfer770_app::main_loop()
|
|
|
|
|
{
|
|
|
|
|
TTransfer770_msk m;
|
|
|
|
|
|
|
|
|
|
while (m.run() == K_ENTER)
|
|
|
|
|
{
|
|
|
|
|
TFilename tmp; tmp.tempdir();
|
|
|
|
|
TTrasferimento770 t(tmp, 'w');
|
2006-12-13 16:22:33 +00:00
|
|
|
|
t.save_headers(m.get_bool(F_HEADERS));
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
|
|
|
|
TRelation rel_base(LF_BASE);
|
|
|
|
|
TRectype da_rec(LF_BASE), a_rec(LF_BASE);
|
|
|
|
|
da_rec.put(BSE_CODDITTA, m.get(F_DADITTA));
|
|
|
|
|
a_rec.put(BSE_CODDITTA, m.get(F_ADITTA));
|
1998-09-16 10:07:53 +00:00
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
TString16 filter;
|
|
|
|
|
filter << BSE_ANNODIC << '=' << m.get(F_ANNO);
|
1998-09-16 10:07:53 +00:00
|
|
|
|
TCursor cur_base(&rel_base, filter, 1, &da_rec, &a_rec);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
2008-03-11 15:50:42 +00:00
|
|
|
|
TProgind pi(cur_base.items(), TR("Generazione file di trasferimento"), false, true);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
cur_base.freeze();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
TRecord770 rec; // Record di lavoro
|
|
|
|
|
|
1998-09-01 14:39:37 +00:00
|
|
|
|
for (cur_base = 0; cur_base.ok(); ++cur_base)
|
|
|
|
|
{
|
|
|
|
|
const TRectype& base = cur_base.curr();
|
|
|
|
|
const long codditta = base.get_long(BSE_CODDITTA);
|
|
|
|
|
pi.addstatus(1);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
t.read_codfis_dic(base);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
t.append_record_b();
|
2002-09-13 14:06:05 +00:00
|
|
|
|
t.append_quadro("ST", codditta, pi);
|
|
|
|
|
t.append_quadro("LA", codditta, pi);
|
1998-09-01 14:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
pi.close_modal();
|
|
|
|
|
|
|
|
|
|
if (m.get(F_SUPPORTO) == "D")
|
|
|
|
|
tmp = m.get(F_DISK);
|
|
|
|
|
else
|
|
|
|
|
tmp = m.get(F_PATH);
|
|
|
|
|
|
|
|
|
|
t.split(tmp);
|
|
|
|
|
t.remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_trc770.destroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int m777100(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
TTransfer770_app app;
|
1998-09-03 13:28:56 +00:00
|
|
|
|
app.run(argc, argv, "Invio");
|
1998-09-01 14:39:37 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|