Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Modulo Riclassificazioni git-svn-id: svn://10.65.10.50/trunk@20668 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cd1d56ccfe
commit
1933da1055
26
ri/ri0.cpp
Executable file
26
ri/ri0.cpp
Executable file
@ -0,0 +1,26 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#include "ab0.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3}"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
int n = (argc > 1) ? atoi(argv[1]+1) : -1;
|
||||
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
ab0100(argc,argv); break;
|
||||
case 1:
|
||||
ab0200(argc,argv); break;
|
||||
case 2:
|
||||
ab0300(argc,argv); break;
|
||||
case 3:
|
||||
ab0400(argc,argv); break;
|
||||
default:
|
||||
error_box(usage, argv[0]) ;
|
||||
}
|
||||
exit(0);
|
||||
}
|
6
ri/ri0.h
Executable file
6
ri/ri0.h
Executable file
@ -0,0 +1,6 @@
|
||||
|
||||
extern int ab0100 (int argc, char* argv[]); //Tabella periodi di bilancio
|
||||
extern int ab0200 (int argc, char* argv[]); //Piano dei conti analisi di bilancio
|
||||
extern int ab0300 (int argc, char* argv[]); //Compatta il Piano dei Conti
|
||||
extern int ab0400 (int argc, char* argv[]); //Riclassifica ed esporta i saldi
|
||||
|
126
ri/ri0100.cpp
Executable file
126
ri/ri0100.cpp
Executable file
@ -0,0 +1,126 @@
|
||||
#include <modaut.h>
|
||||
#include <tabapp.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "abtbpdb.h"
|
||||
#include "abtbarb.h"
|
||||
|
||||
class Tabanabil_application : public Tab_application
|
||||
{
|
||||
private:
|
||||
TMask* _msk;
|
||||
TString _tabname;
|
||||
|
||||
public:
|
||||
bool user_create();
|
||||
const char * extra_modules() const { return format("%d",CGAUT); }
|
||||
|
||||
static bool giorno_handler(TMask_field& f, KEY k);
|
||||
static bool mese_handler (TMask_field& f, KEY k);
|
||||
static bool anni_handler (TMask_field& f, KEY k);
|
||||
|
||||
Tabanabil_application() {}
|
||||
virtual ~Tabanabil_application() {}
|
||||
};
|
||||
|
||||
HIDDEN inline Tabanabil_application& app() {return (Tabanabil_application&) main_app();}
|
||||
|
||||
bool Tabanabil_application::giorno_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.mask().is_running())
|
||||
{
|
||||
const int giorno = atoi(f.get());
|
||||
|
||||
if (giorno > 31)
|
||||
return f.warning_box(TR("Valore non valido per il giorno"));
|
||||
|
||||
const int mese = (f.dlg() == F_GIORNO_INI ? f.mask().get_int(F_MESE_INI) : f.mask().get_int(F_MESE_FINE));
|
||||
|
||||
if (mese == 2)
|
||||
if (giorno > 29)
|
||||
return f.warning_box(TR("Valore non valido per il giorno"));
|
||||
|
||||
if (mese == 11 || mese == 4 || mese == 6 || mese == 9)
|
||||
if (giorno > 30)
|
||||
return f.warning_box(TR("Valore non valido per il giorno"));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool Tabanabil_application::mese_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.mask().is_running())
|
||||
{
|
||||
const int mese = atoi(f.get());
|
||||
|
||||
if (mese < 1 || mese > 12)
|
||||
return f.warning_box(TR("Valore non valido per il mese"));
|
||||
|
||||
const int giorno = (f.dlg() == F_MESE_INI ? f.mask().get_int(F_GIORNO_INI) : f.mask().get_int(F_GIORNO_FINE));
|
||||
|
||||
if (mese == 2)
|
||||
if (giorno > 28)
|
||||
return f.warning_box(TR("Valore non valido per il giorno"));
|
||||
|
||||
if (mese == 11 || mese == 4 || mese == 6 || mese == 9)
|
||||
if (giorno > 30)
|
||||
return f.warning_box(TR("Valore non valido per il giorno"));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool Tabanabil_application::anni_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
TMask & m=f.mask();
|
||||
const TDate inizio(m.get_int(F_GIORNO_INI),m.get_int(F_MESE_INI),1993);
|
||||
if (inizio.empty())
|
||||
return TRUE;
|
||||
const TDate fine(m.get_int(F_GIORNO_FINE),m.get_int(F_MESE_FINE),1993+m.get_int(F_NUM_ANNI));
|
||||
if (fine.empty())
|
||||
return TRUE;
|
||||
if (fine==inizio)
|
||||
return f.error_box(TR("Date uguali: specificare il numero di anni"));
|
||||
if (fine<inizio)
|
||||
return f.error_box(TR("Data finale inferiore alla iniziale: specificare il numero di anni"));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Tabanabil_application::user_create()
|
||||
{
|
||||
Tab_application::user_create();
|
||||
|
||||
_msk = get_mask();
|
||||
_tabname = get_tabname();
|
||||
|
||||
if (_tabname == "%PDB")
|
||||
{
|
||||
_msk->set_handler(F_GIORNO_INI, giorno_handler);
|
||||
_msk->set_handler(F_MESE_INI, mese_handler);
|
||||
_msk->set_handler(F_GIORNO_FINE, giorno_handler);
|
||||
_msk->set_handler(F_MESE_FINE, mese_handler);
|
||||
|
||||
_msk->set_handler(F_NUM_ANNI, anni_handler);
|
||||
}
|
||||
if (_tabname == "%ARB")
|
||||
set_search_field(F_CODTAB_ESE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int ab0100(int argc, char* argv[])
|
||||
{
|
||||
Tabanabil_application a;
|
||||
|
||||
a.run(argc,argv, TR("Tabelle"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
101
ri/ri0200a.uml
Executable file
101
ri/ri0200a.uml
Executable file
@ -0,0 +1,101 @@
|
||||
#include "ab0200.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <relapbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Piano dei Conti" 0 -1 0 19
|
||||
|
||||
GROUPBOX DLG_NULL 76 6
|
||||
BEGIN
|
||||
PROMPT 1 0 ""
|
||||
FLAGS "R"
|
||||
END
|
||||
|
||||
NUMBER F_CODICE 12
|
||||
BEGIN
|
||||
PROMPT 2 2 "Codice conto "
|
||||
HELP "Codice della tabella Piano dei Conti"
|
||||
FIELD LF_ABPCON->CODCBL
|
||||
KEY 1
|
||||
USE LF_ABPCON KEY 1
|
||||
INPUT CODCBL F_CODICE
|
||||
DISPLAY "Codice@12" CODCBL
|
||||
DISPLAY "Descrizione@40" DESCRIZ
|
||||
DISPLAY "I.B." INDBIL
|
||||
DISPLAY "Codice opp.@12" CODCONTR
|
||||
DISPLAY "Sospeso@2" SOSPESO
|
||||
OUTPUT F_CODICE CODCBL
|
||||
OUTPUT F_DESCRIZ DESCRIZ
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "ZRU"
|
||||
END
|
||||
|
||||
STRING F_DESCRIZ 80 40
|
||||
BEGIN
|
||||
PROMPT 2 4 "Descrizione "
|
||||
FIELD LF_ABPCON->DESCRIZ
|
||||
KEY 2
|
||||
USE LF_ABPCON KEY 2
|
||||
INPUT DESCRIZ F_DESCRIZ
|
||||
DISPLAY "Descrizione@40" DESCRIZ
|
||||
DISPLAY "Codice@12" CODCBL
|
||||
DISPLAY "I.B." INDBIL
|
||||
DISPLAY "Codice opp.@12" CODCONTR
|
||||
DISPLAY "Sospeso@2" SOSPESO
|
||||
COPY OUTPUT F_CODICE
|
||||
HELP "Prima parte della descrizione"
|
||||
WARNING "Manca la descrizione"
|
||||
CHECKTYPE REQUIRED // Guy: perche' non cosi'?
|
||||
END
|
||||
|
||||
|
||||
LIST F_INDBIL 15
|
||||
BEGIN
|
||||
PROMPT 2 8 "Indicatore di bilancio "
|
||||
FIELD LF_ABPCON->INDBIL
|
||||
ITEM "1|Attivita'"
|
||||
ITEM "2|Passivita'"
|
||||
ITEM "3|Costi"
|
||||
ITEM "4|Ricavi"
|
||||
ITEM "5|Conti d'ordine"
|
||||
ITEM "9|Varie"
|
||||
END
|
||||
|
||||
NUMBER F_CODCONTR 12
|
||||
BEGIN
|
||||
PROMPT 2 10 "Conto di sez.bil.opposta "
|
||||
HELP "Inserire il conto di sezione di bilancio opposta"
|
||||
FIELD LF_ABPCON->CODCONTR
|
||||
USE LF_ABPCON
|
||||
INPUT CODCBL F_CODCONTR
|
||||
DISPLAY "Codice@12" CODCBL
|
||||
DISPLAY "Descrizione@40" DESCRIZ
|
||||
DISPLAY "I.B." INDBIL
|
||||
DISPLAY "Codice@12" CODCONTR
|
||||
DISPLAY "Sospeso@2" SOSPESO
|
||||
OUTPUT F_CODCONTR CODCBL
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN AB0 -1 #F_CODICE #F_INDBIL
|
||||
FLAGS "ZRU"
|
||||
END
|
||||
|
||||
//Questo campo è stato tolto
|
||||
//LIST F_DETTAGLIO 15
|
||||
//BEGIN
|
||||
// PROMPT 2 14 "Dettaglio/Movimenti "
|
||||
// FIELD LF_ABPCON->DETT
|
||||
// ITEM " |Nessuno"
|
||||
// ITEM "D|Dettaglio"
|
||||
// ITEM "M|Movimenti"
|
||||
//END
|
||||
|
||||
BOOLEAN SOSPENDI
|
||||
BEGIN
|
||||
PROMTP 2 16 " Conto sospeso"
|
||||
FIELD LF_ABPCON->SOSPESO
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
951
ri/ri0400.cpp
Executable file
951
ri/ri0400.cpp
Executable file
@ -0,0 +1,951 @@
|
||||
#include <automask.h>
|
||||
#include <applicat.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <clifo.h>
|
||||
#include <pconti.h>
|
||||
#include "../cg/cglib02.h"
|
||||
|
||||
#include "saldi.h"
|
||||
#include "abpcon.h"
|
||||
|
||||
#include "ab0.h"
|
||||
#include "ab0400.h"
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRicl_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TRicl_mask : public TAutomask
|
||||
{
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TRicl_mask() : TAutomask("ab0400a") { }
|
||||
virtual ~TRicl_mask() { }
|
||||
};
|
||||
|
||||
bool TRicl_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const short id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_ESER:
|
||||
case F_PDB:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TMask & m = o.mask();
|
||||
const TString16 codpdb = m.get(F_PDB);
|
||||
const int eser = m.get_int(F_ESER);
|
||||
|
||||
if (eser == 0 || codpdb.empty())
|
||||
{
|
||||
m.set(F_DAL, "");
|
||||
m.set(F_AL, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
TEsercizi_contabili es;
|
||||
es.update();
|
||||
const int anno = es.esercizio(eser).inizio().year();
|
||||
const TRectype & pdb = cache().get("%PDB", codpdb);
|
||||
TDate dal(pdb.get_int("I0"), pdb.get_int("I1"), anno);
|
||||
TDate al(pdb.get_int("I2"), pdb.get_int("I3"), anno);
|
||||
|
||||
if (al < dal)
|
||||
al.addyear(1);
|
||||
m.set(F_DAL, dal);
|
||||
m.set(F_AL, al);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_DAL:
|
||||
if (e == fe_close)
|
||||
{
|
||||
TMask & m = o.mask();
|
||||
|
||||
if (m.get(F_ESER).empty() && (m.get(F_DAL).empty() || m.get(F_AL).empty()))
|
||||
return o.error_box(TR("E' necessario specificare o il codice esercizio oppure\nle date limite"));
|
||||
}
|
||||
break;
|
||||
case F_OUTPUT:
|
||||
if (e == fe_close)
|
||||
{
|
||||
if (o.get().empty())
|
||||
return o.error_box(TR("E' necessario specificare il file di output"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
enum TCalc_type {_saldi = 0, _ivdircee, _analisi } ;
|
||||
|
||||
class TRiga_calcolo : public TObject
|
||||
{
|
||||
int _gruppo;
|
||||
int _conto;
|
||||
long _sottoconto;
|
||||
int _indbil;
|
||||
real _saldo_iniziale;
|
||||
real _prog_dare;
|
||||
real _prog_avere;
|
||||
real _prog_dare_mese[12];
|
||||
real _prog_avere_mese[12];
|
||||
|
||||
virtual TObject* dup() const { return new TRiga_calcolo(*this);}
|
||||
|
||||
public:
|
||||
void set_conto(int g, int c, long s, int i) { _gruppo = g; _conto = c; _sottoconto = s; _indbil = i;}
|
||||
void set_saldi(const TSaldo & sal);
|
||||
const int gruppo() const { return _gruppo;}
|
||||
const int conto() const { return _conto;}
|
||||
const long sottoconto() const { return _sottoconto;}
|
||||
const int indicatore_bilancio() const { return _indbil;}
|
||||
real saldo_iniziale() const { return _saldo_iniziale;}
|
||||
real prog_dare() const { return _prog_dare;}
|
||||
real prog_avere() const { return _prog_avere;}
|
||||
real prog_dare(int month) const { return _prog_dare_mese[month - 1];}
|
||||
real prog_avere(int month) const { return _prog_avere_mese[month - 1];}
|
||||
real saldo() const { return _saldo_iniziale + _prog_dare - _prog_avere;}
|
||||
bool sezione_opposta() const;
|
||||
const bool is_zero() const { return _saldo_iniziale == ZERO && _prog_dare == ZERO && _prog_avere == ZERO;}
|
||||
TRiga_calcolo& copy(const TRiga_calcolo& c);
|
||||
|
||||
TRiga_calcolo(const TRiga_calcolo& c);
|
||||
TRiga_calcolo() {}
|
||||
virtual ~TRiga_calcolo() {}
|
||||
};
|
||||
|
||||
void TRiga_calcolo::set_saldi(const TSaldo & sal)
|
||||
|
||||
{
|
||||
_saldo_iniziale = sal.saldoini();
|
||||
_prog_dare = sal.prgdare();
|
||||
_prog_avere = sal.prgavere();
|
||||
for (int i = 0 ; i < 12; i++)
|
||||
{
|
||||
_prog_dare_mese[i] = sal.prgdare(i + 1);
|
||||
_prog_avere_mese[i] = sal.prgavere(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
bool TRiga_calcolo::sezione_opposta() const
|
||||
{
|
||||
bool reverse = FALSE;
|
||||
const real s = saldo();
|
||||
|
||||
if (s != ZERO)
|
||||
{
|
||||
char sezione = s > ZERO ? 'D' : 'A';
|
||||
|
||||
if (_indbil == 1 || _indbil == 3)
|
||||
reverse = sezione == 'A';
|
||||
else
|
||||
if (_indbil == 2 || _indbil == 4)
|
||||
reverse = sezione == 'D';
|
||||
}
|
||||
return reverse;
|
||||
}
|
||||
|
||||
TRiga_calcolo & TRiga_calcolo::copy(const TRiga_calcolo & c)
|
||||
{
|
||||
_gruppo = c._gruppo;
|
||||
_conto = c._conto;
|
||||
_sottoconto = c._sottoconto;
|
||||
_indbil = c._indbil;
|
||||
_saldo_iniziale = c._saldo_iniziale;
|
||||
_prog_dare = c._prog_dare;
|
||||
_prog_avere = c._prog_avere;
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
_prog_dare_mese[i] += c._prog_dare_mese[i];
|
||||
_prog_avere_mese[i] += c._prog_avere_mese[i];
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
TRiga_calcolo::TRiga_calcolo(const TRiga_calcolo & c)
|
||||
{
|
||||
copy(c);
|
||||
}
|
||||
|
||||
|
||||
class TRiga_output : public TObject
|
||||
{
|
||||
TString _code;
|
||||
real _saldo_iniziale;
|
||||
real _prog_dare;
|
||||
real _prog_avere;
|
||||
real _prog_dare_mese[12];
|
||||
real _prog_avere_mese[12];
|
||||
|
||||
virtual TObject* dup() const { return new TRiga_output(*this);}
|
||||
|
||||
public:
|
||||
TRiga_output & operator +=(const TRiga_calcolo & c);
|
||||
const TString & code() const { return _code;}
|
||||
real saldo_iniziale() const { return _saldo_iniziale;}
|
||||
real prog_dare() const { return _prog_dare;}
|
||||
real prog_avere() const { return _prog_avere;}
|
||||
real prog_dare(int month) const { return _prog_dare_mese[month - 1];}
|
||||
real prog_avere(int month) const { return _prog_avere_mese[month - 1];}
|
||||
real saldo() const { return _saldo_iniziale + _prog_dare - _prog_avere;}
|
||||
char sezione_saldo() const { return saldo() > 0 ? 'D' : 'A';}
|
||||
TRiga_output& copy(const TRiga_output& o);
|
||||
|
||||
TRiga_output(const TRiga_output& o);
|
||||
TRiga_output(const char * code) : _code(code) {}
|
||||
virtual ~TRiga_output() {}
|
||||
};
|
||||
|
||||
TRiga_output & TRiga_output::operator += (const TRiga_calcolo & c)
|
||||
{
|
||||
_saldo_iniziale += c.saldo_iniziale();
|
||||
_prog_dare += c.prog_dare();
|
||||
_prog_avere += c.prog_avere();
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
_prog_dare_mese[i] = c.prog_dare(i + 1);
|
||||
_prog_avere_mese[i] = c.prog_avere(i + 1);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
TRiga_output & TRiga_output::copy(const TRiga_output & o)
|
||||
{
|
||||
_code = o._code;
|
||||
_saldo_iniziale = o._saldo_iniziale;
|
||||
_prog_dare = o._prog_dare;
|
||||
_prog_avere = o._prog_avere;
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
_prog_dare_mese[i] = o._prog_dare_mese[i];
|
||||
_prog_avere_mese[i] = o._prog_avere_mese[i];
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
TRiga_output::TRiga_output(const TRiga_output& o)
|
||||
{
|
||||
copy(o);
|
||||
}
|
||||
|
||||
enum TFile_type { _textfile, _csvfile, _dbffile } ;
|
||||
|
||||
class TRicl_saldi : public TSkeleton_application
|
||||
{
|
||||
TRicl_mask *_mask;
|
||||
TFilename _output_file;
|
||||
TCalc_type _calc_type;
|
||||
int _codes;
|
||||
TDate _dal;
|
||||
TDate _al;
|
||||
bool _all_recs;
|
||||
bool _months;
|
||||
bool _provv;
|
||||
TString _codpdb;
|
||||
TString _codcms;
|
||||
TArray _risultati;
|
||||
TAssoc_array _output;
|
||||
TString_array _output_keys;
|
||||
ofstream * _file;
|
||||
TExternisamfile * _dbf;
|
||||
|
||||
#ifdef DBG
|
||||
protected:
|
||||
FILE * _log;
|
||||
void open_log();
|
||||
void write_log(const char * line);
|
||||
void close_log();
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
void mask2parms(const TMask & m);
|
||||
void ini2parms(const char * filename);
|
||||
void calculate_clifo(const char tipo, const int gruppo, const int conto, const int indbil, const bool saldi_attuali, const TString & codcom);
|
||||
void calculate();
|
||||
void transform();
|
||||
void get_code(const TRectype & rec, bool cee, bool reverse, TString & code);
|
||||
void map(int gruppo, int conto, long sottoconto, bool reverse, TString & code);
|
||||
void output();
|
||||
virtual void main_loop();
|
||||
TFile_type open_output();
|
||||
void output_header(const bool is_commessa);
|
||||
void output_line(TFile_type t, const char * key, TRiga_output & r, const bool is_commessa, TString & codcms);
|
||||
void close_output(TFile_type t);
|
||||
|
||||
TRicl_saldi() {}
|
||||
virtual ~TRicl_saldi() {}
|
||||
};
|
||||
|
||||
#ifdef DBG
|
||||
void TRicl_saldi::open_log()
|
||||
{
|
||||
TFilename log("ab0400.log");
|
||||
|
||||
_log = fopen(log,"a");
|
||||
if (_log == NULL)
|
||||
fatal_box(FR("Non posso aprire il file di log della conversione(%s)"), (const char *) log);
|
||||
}
|
||||
|
||||
void TRicl_saldi::write_log(const char * line)
|
||||
{
|
||||
fprintf(_log,"%s\n", line);
|
||||
}
|
||||
|
||||
void TRicl_saldi::close_log()
|
||||
{
|
||||
fclose(_log);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool TRicl_saldi::create()
|
||||
{
|
||||
|
||||
open_files(LF_TAB, LF_TABCOM, LF_ABPCON, LF_ABSALDI, LF_SALDI, LF_RMOV, LF_MOV,
|
||||
LF_PCON, 0);
|
||||
_mask = new TRicl_mask();
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TRicl_saldi::destroy()
|
||||
{
|
||||
delete _mask;
|
||||
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
||||
void TRicl_saldi::mask2parms(const TMask & m)
|
||||
{
|
||||
TEsercizi_contabili es;
|
||||
|
||||
_calc_type = (TCalc_type) m.get_int(F_TIPO);
|
||||
_codes = m.get_int(F_ESER);
|
||||
_dal = m.get(F_DAL);
|
||||
_al = m.get(F_AL);
|
||||
if (_codes != 0 && !_dal.ok())
|
||||
_dal = es.esercizio(_codes).inizio();
|
||||
if (_codes != 0 && !_al.ok())
|
||||
_al = es.esercizio(_codes).fine();
|
||||
|
||||
if (_codes == 0)
|
||||
{
|
||||
_codes = es.date2esc(_dal);
|
||||
if (_codes == 0)
|
||||
_codes = es.date2esc(_al);
|
||||
}
|
||||
_all_recs = m.get_bool(F_STRUCT);
|
||||
_months = m.get_bool(F_MONTH);
|
||||
_provv = m.get_bool(F_PROVV);
|
||||
_codcms = m.get(F_COMM);
|
||||
_output_file = m.get(F_OUTPUT);
|
||||
_codpdb = m.get(F_PDB);
|
||||
#ifdef DBG
|
||||
TString line ;
|
||||
write_log("---------------------------------------------------");
|
||||
line = TR("Tipo di calcolo : ");
|
||||
switch (_calc_type)
|
||||
{
|
||||
case _saldi :
|
||||
line << TR("Saldi Contabili");
|
||||
break;
|
||||
case _ivdircee :
|
||||
line << TR("IV Direttiva CEE");
|
||||
break;
|
||||
case _analisi :
|
||||
line << TR("Analisi");
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
write_log(line);
|
||||
line = TR("Esercizio : "); line << _codes;
|
||||
write_log(line);
|
||||
line = TR("Codice periodo : "); line << _codpdb;
|
||||
write_log(line);
|
||||
line = TR("Dal : "); line << _dal.string();
|
||||
write_log(line);
|
||||
line = TR("Al : "); line << _al.string();
|
||||
write_log(line);
|
||||
line = TR("Movimenti provv.: "); line << (_provv ? "Si" : "No");
|
||||
write_log(line);
|
||||
line = TR("Intera struttura: "); line << (_all_recs ? "Si" : "No");
|
||||
write_log(line);
|
||||
line = TR("Suddiviso in mesi:"); line << (_months ? "Si" : "No");
|
||||
write_log(line);
|
||||
line = TR("Commessa : "); line << _codcms;
|
||||
write_log(line);
|
||||
line = TR("Output : "); line << ((const char *) _output_file);
|
||||
write_log(line);
|
||||
write_log("");
|
||||
#endif
|
||||
}
|
||||
|
||||
void TRicl_saldi::ini2parms(const char * filename)
|
||||
{
|
||||
TConfig c(filename, "Main");
|
||||
TEsercizi_contabili es;
|
||||
|
||||
_calc_type = (TCalc_type) c.get_int("Tipo");
|
||||
_codes = c.get_int("Esercizio");
|
||||
_dal = c.get("Dal");
|
||||
_al = c.get("Al");
|
||||
if (_codes != 0 && !_dal.ok())
|
||||
_dal = es.esercizio(_codes).inizio();
|
||||
if (_codes != 0 && !_al.ok())
|
||||
_al = es.esercizio(_codes).fine();
|
||||
|
||||
if (_codes == 0)
|
||||
{
|
||||
_codes = es.date2esc(_dal);
|
||||
if (_codes == 0)
|
||||
_codes = es.date2esc(_al);
|
||||
}
|
||||
_all_recs = c.get_bool("Struttura");
|
||||
_months = c.get_bool("Mesi");
|
||||
_provv = c.get_bool("Provvisori");
|
||||
_codcms = c.get("Commessa");
|
||||
_output_file = c.get("Output");
|
||||
_codpdb = c.get("Periodo");
|
||||
#ifdef DBG
|
||||
TString line ;
|
||||
write_log("---------------------------------------------------");
|
||||
line = TR("Tipo di calcolo : ");
|
||||
switch (_calc_type)
|
||||
{
|
||||
case _saldi :
|
||||
line << TR("Saldi Contabili");
|
||||
break;
|
||||
case _ivdircee :
|
||||
line << TR("IV Direttiva CEE");
|
||||
break;
|
||||
case _analisi :
|
||||
line << TR("Analisi");
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
write_log(line);
|
||||
line = TR("Esercizio : "); line << _codes;
|
||||
write_log(line);
|
||||
line = TR("Codice periodo : "); line << _codpdb;
|
||||
write_log(line);
|
||||
line = TR("Dal : "); line << _dal.string();
|
||||
write_log(line);
|
||||
line = TR("Al : "); line << _al.string();
|
||||
write_log(line);
|
||||
line = TR("Movimenti provv.: "); line << (_provv ? "Si" : "No");
|
||||
write_log(line);
|
||||
line = TR("Intera struttura: "); line << (_all_recs ? "Si" : "No");
|
||||
write_log(line);
|
||||
line = TR("Suddiviso in mesi:"); line << (_months ? "Si" : "No");
|
||||
write_log(line);
|
||||
line = TR("Commessa : "); line << _codcms;
|
||||
write_log(line);
|
||||
line = TR("Output : "); line << ((const char *) _output_file);
|
||||
write_log(line);
|
||||
write_log("");
|
||||
#endif
|
||||
}
|
||||
|
||||
void TRicl_saldi::calculate_clifo(const char tipo, const int gruppo, const int conto, const int indbil, const bool saldi_attuali, const TString & codcom)
|
||||
{
|
||||
TRelation relcf(LF_CLIFO);
|
||||
TRectype & clifo = relcf.curr();
|
||||
clifo.put(CLI_TIPOCF, tipo);
|
||||
TCursor cur(&relcf, "", 1, &clifo, &clifo);
|
||||
long sottoconto;
|
||||
TSaldo sal;
|
||||
TRiga_calcolo r;
|
||||
const TRecnotype items = cur.items();
|
||||
|
||||
cur.freeze();
|
||||
|
||||
TString prompt = tipo == 'C' ? TR("Ricalcolo saldi Clienti") : TR("Ricalcolo saldi Fornitori");
|
||||
prompt << ' ' << gruppo << ' ' << conto;
|
||||
|
||||
TProgind p(items, prompt, FALSE);
|
||||
for (cur = 0L; !p.iscancelled() && cur.pos() < items; ++cur)
|
||||
{
|
||||
sottoconto = clifo.get_long(CLI_CODCF);
|
||||
if (saldi_attuali)
|
||||
sal.ultima_immissione_bilancio(_codes, gruppo, conto, sottoconto, indbil, _provv ? 2 :1, FALSE);
|
||||
else
|
||||
sal.saldo_periodo(gruppo, conto, sottoconto, _dal, _al, indbil, _provv);
|
||||
r.set_conto(gruppo, conto, sottoconto, indbil);
|
||||
r.set_saldi(sal);
|
||||
#ifdef DBG
|
||||
TString line ;
|
||||
line.format(FR("Conto %03d.%03d.%06ld - "), gruppo, conto, sottoconto);
|
||||
line << TR("Saldo iniziale ") << sal.saldoini().stringa(18, 3);
|
||||
line << TR(" Prog.Dare ") << sal.prgdare().stringa(18, 3);
|
||||
line << TR(" Prog.Avere ") << sal.prgavere().stringa(18, 3);
|
||||
line << TR(" Saldo ") << sal.saldo().stringa(18, 3);
|
||||
write_log(line);
|
||||
#endif
|
||||
if (_all_recs || !r.is_zero())
|
||||
_risultati.add(r);
|
||||
p.addstatus(1L);
|
||||
}
|
||||
}
|
||||
|
||||
void TRicl_saldi::calculate()
|
||||
{
|
||||
TRelation relpcon(LF_PCON);
|
||||
const TRectype & pcon = relpcon.curr();
|
||||
TCursor cur(&relpcon, "CONTO!=0"); // Escludi i gruppi
|
||||
int indbil = 0;
|
||||
TSaldo sal;
|
||||
TRiga_calcolo r;
|
||||
TEsercizi_contabili es;
|
||||
const TEsercizio & e = es.esercizio(_codes);
|
||||
const bool is_commessa = _codcms.not_empty();
|
||||
const bool saldi_attuali = (!is_commessa) && (!_months) && ((!_dal.ok() && !_al.ok()) || (_dal == e.inizio() && _al == e.fine()));
|
||||
const TRecnotype items = cur.items();
|
||||
|
||||
cur.freeze();
|
||||
|
||||
_risultati.destroy();
|
||||
|
||||
TProgind p(items, TR("Ricalcolo saldi"), FALSE);
|
||||
for (cur = 0L; !p.iscancelled() && cur.pos() < items; ++cur)
|
||||
{
|
||||
const int gruppo = pcon.get_int(PCN_GRUPPO);
|
||||
const int conto = pcon.get_int(PCN_CONTO);
|
||||
const long sottoconto = pcon.get_long(PCN_SOTTOCONTO);
|
||||
if (sottoconto == 0L) // E' un conto
|
||||
{
|
||||
indbil = pcon.get_int(PCN_INDBIL);
|
||||
const char tmcf = pcon.get_char(PCN_TMCF);
|
||||
if (tmcf > ' ')
|
||||
calculate_clifo(tmcf, gruppo, conto, indbil, saldi_attuali, _codcms);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (saldi_attuali)
|
||||
sal.ultima_immissione_bilancio(_codes, gruppo, conto, sottoconto, indbil, _provv ? 2 :1, FALSE);
|
||||
else
|
||||
sal.saldo_periodo(gruppo, conto, sottoconto, _dal, _al, indbil, _provv);
|
||||
r.set_conto(gruppo, conto, sottoconto, indbil);
|
||||
r.set_saldi(sal);
|
||||
#ifdef DBG
|
||||
TString line ;
|
||||
line.format(FR("Conto %03d.%03d.%06ld - "), gruppo, conto, sottoconto);
|
||||
line << TR("Saldo iniziale ") << sal.saldoini().stringa(18, 3);
|
||||
line << TR(" Prog.Dare ") << sal.prgdare().stringa(18, 3);
|
||||
line << TR(" Prog.Avere ") << sal.prgavere().stringa(18, 3);
|
||||
line << TR(" Saldo ") << sal.saldo().stringa(18, 3);
|
||||
write_log(line);
|
||||
#endif
|
||||
if (_all_recs || !r.is_zero())
|
||||
_risultati.add(r);
|
||||
p.addstatus(1L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TRicl_saldi::get_code(const TRectype &rec, bool cee, bool reverse, TString & code)
|
||||
{
|
||||
if (cee)
|
||||
{
|
||||
bool opp = reverse && rec.get_int(PCN_SEZIVDOPP) != 0;
|
||||
code = rec.get(opp ? PCN_SEZIVDOPP : PCN_SEZIVD);
|
||||
if (code == "0")
|
||||
code.cut(0);
|
||||
else
|
||||
{
|
||||
code << rec.get(opp ? PCN_LETTIVDOPP : PCN_LETTIVD);
|
||||
code << format("%4s", (const char *) rec.get(opp ? PCN_NUMRIVDOPP : PCN_NUMRIVD));
|
||||
const int numrivd = rec.get_int(opp ? PCN_NUMIVDOPP : PCN_NUMIVD);
|
||||
if (numrivd != 0)
|
||||
code << format("%02d", numrivd);
|
||||
code.trim();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
code = rec.get(PCN_CODCBL);
|
||||
if (code.empty())
|
||||
{
|
||||
TToken_string key(rec.get(PCN_GRUPPO));
|
||||
key.add(rec.get(PCN_CONTO));
|
||||
key.add("");
|
||||
|
||||
const TRectype & conto = cache().get(LF_PCON, key);
|
||||
code = conto.get(PCN_CODCBL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TRicl_saldi::map(int gruppo, int conto, long sottoconto, bool reverse, TString & code)
|
||||
{
|
||||
const bool no_map =_calc_type == _saldi;
|
||||
|
||||
if(no_map)
|
||||
code.format("%03d|%03d|%06ld", gruppo, conto, sottoconto);
|
||||
else
|
||||
{
|
||||
const bool cee =_calc_type == _ivdircee;
|
||||
|
||||
code.format("%d|%d|%ld", gruppo, conto, sottoconto);
|
||||
const TRectype & recs = cache().get(LF_PCON, code);
|
||||
|
||||
get_code(recs, cee, reverse, code);
|
||||
if (code.empty())
|
||||
{
|
||||
code.format("%d|%d", gruppo, conto);
|
||||
const TRectype & recc = cache().get(LF_PCON, code);
|
||||
|
||||
get_code(recc, cee, reverse, code);
|
||||
if (code.empty())
|
||||
{
|
||||
code.format("%d", gruppo);
|
||||
const TRectype & recg = cache().get(LF_PCON, code);
|
||||
|
||||
get_code(recg, cee, reverse, code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TRicl_saldi::transform()
|
||||
{
|
||||
const int items = _risultati.items();
|
||||
TString80 key;
|
||||
|
||||
_output.destroy();
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
const TRiga_calcolo & c = (const TRiga_calcolo &) _risultati[i];
|
||||
const int gruppo = c.gruppo();
|
||||
const int conto = c.conto();
|
||||
const long sottoconto = c.sottoconto();
|
||||
const bool reverse = c.sezione_opposta();
|
||||
|
||||
map(gruppo, conto, sottoconto, reverse, key);
|
||||
|
||||
if (key.not_empty())
|
||||
{
|
||||
TRiga_output * r = (TRiga_output *)_output.objptr(key);
|
||||
|
||||
if (r == NULL)
|
||||
{
|
||||
r = new TRiga_output(key);
|
||||
_output.add(key, r);
|
||||
}
|
||||
*r += c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TFile_type TRicl_saldi::open_output()
|
||||
{
|
||||
TString16 ext = _output_file.ext(); ext.lower();
|
||||
TFile_type t;
|
||||
|
||||
if (ext == "dbf")
|
||||
t = _dbffile;
|
||||
else
|
||||
if (ext == "csv")
|
||||
t = _csvfile;
|
||||
else
|
||||
t = _textfile;
|
||||
if (t == _dbffile)
|
||||
_dbf = new TExternisamfile(_output_file, "ab0400.trr");
|
||||
else
|
||||
{
|
||||
if (_output_file.exist())
|
||||
remove(_output_file);
|
||||
_file = new ofstream(_output_file);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
void TRicl_saldi::output_line(TFile_type t, const char * key, TRiga_output & r, const bool is_commessa, TString & codcms)
|
||||
{
|
||||
TString descr;
|
||||
const bool analisi = _calc_type == _analisi;
|
||||
const bool saldi = _calc_type == _saldi;
|
||||
|
||||
if (analisi)
|
||||
descr = cache().get(LF_ABPCON, key, ABPC_DESCRIZ);
|
||||
else
|
||||
if (saldi)
|
||||
descr = cache().get(LF_PCON, key, PCN_DESCR);
|
||||
else
|
||||
descr = cache().get("%IVD", key, "S0");
|
||||
|
||||
real si = r.saldo_iniziale();
|
||||
char fsi = si >= ZERO ? 'D' : 'A';
|
||||
real s = r.saldo();
|
||||
char fs = s >= ZERO ? 'D' : 'A';
|
||||
real pd = r.prog_dare();
|
||||
real pa = r.prog_avere();
|
||||
|
||||
#ifdef DBG
|
||||
TString line ;
|
||||
line.format(FR("Chiave %s"), key);
|
||||
line << TR("Saldo iniziale ") << si.stringa(18, 3) << " " << fsi;
|
||||
line << TR(" Prog.Dare ") << pd.stringa(18, 3);
|
||||
line << TR(" Prog.Avere ") << pa.stringa(18, 3);
|
||||
line << TR(" Saldo ") << s.stringa(18, 3) << " " << fs;
|
||||
write_log(line);
|
||||
#endif
|
||||
|
||||
TFixed_string k(key, 40);
|
||||
if (t == _dbffile)
|
||||
{
|
||||
TRectype & rec = _dbf->curr();
|
||||
|
||||
rec.put("ANNOES", _codes);
|
||||
k.strip("|");
|
||||
rec.put("KEY", k);
|
||||
rec.put("DESCR", descr);
|
||||
if (is_commessa)
|
||||
rec.put("CODCMS", codcms);
|
||||
rec.put("SALDOI", abs(si));
|
||||
rec.put("FLAGSI", fsi);
|
||||
rec.put("PDARE", pd);
|
||||
rec.put("PAVERE", pa);
|
||||
rec.put("SALDO", abs(s));
|
||||
rec.put("FLAGS", fs);
|
||||
rec.put("DATAI", _dal);
|
||||
rec.put("DATAF", _al);
|
||||
rec.put("CODPDB", _codpdb);
|
||||
|
||||
if (_dbf->write(rec) != NOERR)
|
||||
_dbf->rewrite(rec);
|
||||
}
|
||||
else
|
||||
{
|
||||
real tmp;
|
||||
if (t == _csvfile)
|
||||
{
|
||||
*_file << _codes << ";";
|
||||
k.replace('|', ';');
|
||||
*_file << k << ";";
|
||||
if (is_commessa)
|
||||
*_file << codcms << ";";
|
||||
*_file << "\"" << descr << "\";";
|
||||
tmp = abs(si);
|
||||
*_file << tmp.stringa() << ";";
|
||||
*_file << fsi << ";";
|
||||
if (_months)
|
||||
{
|
||||
for (int i = 1; i <= 12; i++)
|
||||
{
|
||||
*_file << r.prog_dare(i).stringa() << ";";
|
||||
*_file << r.prog_avere(i).stringa() << ";";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*_file << pd.stringa() << ";";
|
||||
*_file << pa.stringa() << ";";
|
||||
}
|
||||
tmp = abs(s);
|
||||
*_file << tmp.stringa() << ";";
|
||||
*_file << fs << ";";
|
||||
*_file << _dal << ";";
|
||||
*_file << _al << ";";
|
||||
*_file << _codpdb << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
*_file << _codes << "\t";
|
||||
k.replace('|', '\t');
|
||||
*_file << k << "\t";
|
||||
if (is_commessa)
|
||||
*_file << codcms << "\t";
|
||||
*_file << descr << "\t";
|
||||
tmp = abs(si);
|
||||
*_file << tmp.stringa() << "\t";
|
||||
*_file << fsi << "\t";
|
||||
if (_months)
|
||||
{
|
||||
for (int i = 1; i <= 12; i++)
|
||||
{
|
||||
*_file << r.prog_dare(i).stringa() << "\t";
|
||||
*_file << r.prog_avere(i).stringa() << "\t";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*_file << pd.stringa() << "\t";
|
||||
*_file << pa.stringa() << "\t";
|
||||
}
|
||||
tmp = abs(s);
|
||||
*_file << tmp.stringa() << "\t";
|
||||
*_file << fs << "\t";
|
||||
*_file << _dal << "\t";
|
||||
*_file << _al << "\t";
|
||||
*_file << _codpdb << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TRicl_saldi::output_header(const bool is_commessa)
|
||||
{
|
||||
*_file << "Esercizio;";
|
||||
if (_calc_type == _saldi)
|
||||
*_file << "Gruppo;Conto;Sottoconto;";
|
||||
else
|
||||
*_file << "Esercizio;Codice;";
|
||||
if (is_commessa)
|
||||
*_file << "Commessa;";
|
||||
*_file << "Descrizione;Saldo Iniziale;Sezione;";
|
||||
if (_months)
|
||||
{
|
||||
for (int i = 1; i <= 12; i++)
|
||||
{
|
||||
*_file << itom(i) << " Dare;";
|
||||
*_file << itom(i) << " Avere;";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*_file << "Progressivo Dare;";
|
||||
*_file << "Progressivo Avere;";
|
||||
}
|
||||
*_file << "Saldo Finale;Sezione;";
|
||||
*_file << "Dal ;";
|
||||
*_file << "Al ;";
|
||||
*_file << "Periodo di Bilancio\n";
|
||||
}
|
||||
|
||||
void TRicl_saldi::close_output(TFile_type t)
|
||||
{
|
||||
if (t == _dbffile)
|
||||
{
|
||||
delete _dbf;
|
||||
_dbf = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete _file;
|
||||
_file = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void TRicl_saldi::output()
|
||||
{
|
||||
_output_keys.destroy();
|
||||
_output.get_keys(_output_keys);
|
||||
_output_keys.sort();
|
||||
const int items = _output_keys.items();
|
||||
TFile_type t = open_output();
|
||||
const bool analisi = _calc_type == _analisi;
|
||||
const bool is_commessa = _codcms.not_empty();
|
||||
|
||||
if (t == _csvfile)
|
||||
output_header(is_commessa);
|
||||
if (analisi && !is_commessa)
|
||||
{
|
||||
TRelation relana(LF_ABSALDI);
|
||||
TRectype & saldo = relana.curr();
|
||||
saldo.put(ABS_CODDITTA, get_firm());
|
||||
saldo.put(ABS_ANNO, _codes);
|
||||
saldo.put(ABS_CODPDB, _codpdb);
|
||||
|
||||
TCursor cur(&relana, "", 1, &saldo, &saldo);
|
||||
const TRecnotype curs_items = cur.items();
|
||||
|
||||
cur.freeze();
|
||||
for (cur = 0L; cur.pos() < curs_items; ++cur)
|
||||
relana.remove();
|
||||
TProgind p(items, "Aggiornamenti Saldi analisi", FALSE);
|
||||
int err = NOERR;
|
||||
for (int i = 0; err == NOERR && i < items && !p.iscancelled(); i++)
|
||||
{
|
||||
TString & key = _output_keys.row(i);
|
||||
TRiga_output & r = (TRiga_output &) _output[key];
|
||||
|
||||
saldo.zero();
|
||||
saldo.put(ABS_CODDITTA, get_firm());
|
||||
saldo.put(ABS_ANNO, _codes);
|
||||
saldo.put(ABS_CODPDB, _codpdb);
|
||||
saldo.put(ABS_CODCBL, key);
|
||||
|
||||
const real si = r.saldo_iniziale();
|
||||
const char fsi = si >= ZERO ? 'D' : 'A';
|
||||
|
||||
saldo.put(ABS_FLDA, fsi);
|
||||
saldo.put(ABS_SALDO, abs(si));
|
||||
saldo.put(ABS_PDARE, r.prog_dare());
|
||||
saldo.put(ABS_PAVERE, r.prog_avere());
|
||||
err = relana.write();
|
||||
if (err == _isreinsert)
|
||||
err = relana.write();
|
||||
p.addstatus(1L);
|
||||
}
|
||||
if (err != NOERR)
|
||||
error_box("Impossibile aggiornare l'archivio saldi analisi errore n. %d", err);
|
||||
}
|
||||
TProgind p1(items, "Generazione output", FALSE);
|
||||
for (int i = 0; i < items && !p1.iscancelled() ; i++)
|
||||
{
|
||||
TString & key = _output_keys.row(i);
|
||||
TRiga_output & r = (TRiga_output &) _output[key];
|
||||
output_line(t, key, r, is_commessa, _codcms);
|
||||
p1.addstatus(1L);
|
||||
}
|
||||
close_output(t);
|
||||
}
|
||||
|
||||
void TRicl_saldi::main_loop()
|
||||
{
|
||||
if (argc() == 2)
|
||||
{
|
||||
while (_mask->run() != K_QUIT)
|
||||
{
|
||||
#ifdef DBG
|
||||
open_log();
|
||||
#endif
|
||||
mask2parms(*_mask);
|
||||
calculate();
|
||||
transform();
|
||||
output();
|
||||
#ifdef DBG
|
||||
close_log();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DBG
|
||||
open_log();
|
||||
#endif
|
||||
ini2parms(argv(2));
|
||||
calculate();
|
||||
transform();
|
||||
output();
|
||||
#ifdef DBG
|
||||
close_log();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int ab0400 (int argc, char* argv[])
|
||||
{
|
||||
TRicl_saldi main_app;
|
||||
main_app.run(argc, argv, TR("Riclassificazione saldi"));
|
||||
return TRUE;
|
||||
}
|
14
ri/ri0400.h
Executable file
14
ri/ri0400.h
Executable file
@ -0,0 +1,14 @@
|
||||
// campi maschera ab0400a.uml
|
||||
|
||||
#define F_TIPO 101
|
||||
#define F_ESER 102
|
||||
#define F_PDB 103
|
||||
#define F_DAL 104
|
||||
#define F_AL 105
|
||||
#define F_STRUCT 106
|
||||
#define F_PROVV 107
|
||||
#define F_OUTPUT 108
|
||||
#define F_COMM 109
|
||||
#define F_DCOMM 110
|
||||
#define F_MONTH 111
|
||||
|
18
ri/ri0400.trr
Executable file
18
ri/ri0400.trr
Executable file
@ -0,0 +1,18 @@
|
||||
-1
|
||||
14
|
||||
ANNOES|9|4|0|Codice esercizio
|
||||
KEY|1|20|0|Chiave
|
||||
DESCR|1|70|0|Descrizione
|
||||
CODCMS|1|20|0|Codice Commessa
|
||||
FASCMS|1|10|0|Fase Commessa
|
||||
FLAGSI|1|1|0|Saldo iniziale in <D>are, <A>vere
|
||||
SALDOI|4|18|2|Saldo iniziale
|
||||
PDARE|4|18|2|Progressivo dare
|
||||
PAVERE|4|18|2|Progressivo avere
|
||||
FLAGS|1|1|0|Saldo in <D>are, <A>vere
|
||||
SALDO|4|18|2|Saldo
|
||||
DATAI|5|8|0|Data inizio
|
||||
DATAF|5|8|0|Data fine
|
||||
CODPDB|1|3|0|Codice
|
||||
1
|
||||
ANNOES+KEY+CODPDB+DATAI+DATAF|
|
110
ri/ri0400a.uml
Executable file
110
ri/ri0400a.uml
Executable file
@ -0,0 +1,110 @@
|
||||
#include "ab0400.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <stdbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Riclassificazione" 0 2 0 0
|
||||
|
||||
LIST F_TIPO 20
|
||||
BEGIN
|
||||
PROMPT 2 1 "Tipo di calcolo "
|
||||
ITEM "0|Saldi Contabili"
|
||||
ITEM "1|IV Direttiva CEE"
|
||||
ITEM "2|Analisi"
|
||||
END
|
||||
|
||||
NUMBER F_ESER 4
|
||||
BEGIN
|
||||
PROMPT 2 3 "Esercizio "
|
||||
HELP "Codice d'esercizio da assegnare"
|
||||
FLAGS "ZR"
|
||||
USE ESC
|
||||
INPUT CODTAB F_ESER
|
||||
DISPLAY "Codice esercizio" CODTAB
|
||||
DISPLAY "Data inizio esercizio" D0
|
||||
DISPLAY "Data fine esercizio" D1
|
||||
DISPLAY "Data di scarico" D2
|
||||
DISPLAY "Data chiusura esercizio" D3
|
||||
OUTPUT F_ESER CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_PDB 2
|
||||
BEGIN
|
||||
PROMPT 2 5 "Codice periodo "
|
||||
HELP "Codice della tabella periodi di bilancio"
|
||||
FLAGS "U_"
|
||||
USE %PDB
|
||||
INPUT CODTAB F_PDB
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@40" S0
|
||||
DISPLAY "gg.inizio" I0
|
||||
DISPLAY "mm.inizio" I1
|
||||
DISPLAY "gg.fine" I2
|
||||
DISPLAY "mm.fine" I3
|
||||
OUTPUT F_PDB CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
DATE F_DAL
|
||||
BEGIN
|
||||
PROMPT 2 7 "Dal "
|
||||
END
|
||||
|
||||
DATE F_AL
|
||||
BEGIN
|
||||
PROMPT 2 9 "Al "
|
||||
VALIDATE DATE_CMP_FUNC > F_DAL
|
||||
WARNING "La data finale deve essere maggiore alla data iniziale"
|
||||
END
|
||||
|
||||
BOOLEAN F_STRUCT
|
||||
BEGIN
|
||||
PROMPT 2 11 "Intera struttura"
|
||||
END
|
||||
|
||||
BOOLEAN F_MONTH
|
||||
BEGIN
|
||||
PROMPT 42 11 "Suddiviso per mesi"
|
||||
END
|
||||
|
||||
BOOLEAN F_PROVV
|
||||
BEGIN
|
||||
PROMPT 2 13 "Anche i movimenti provvisori"
|
||||
END
|
||||
|
||||
STRING F_OUTPUT 50 30
|
||||
BEGIN
|
||||
PROMPT 2 15 "File di output "
|
||||
FSELECT ""
|
||||
END
|
||||
|
||||
STRING F_COMM 20
|
||||
BEGIN
|
||||
PROMPT 2 17 "Codice commessa "
|
||||
USE CMS
|
||||
FIELD CODTAB
|
||||
FLAGS "UZ"
|
||||
INPUT CODTAB F_COMM
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_COMM CODTAB
|
||||
OUTPUT F_DCOMM S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DCOMM 70 50
|
||||
BEGIN
|
||||
PROMPT 2 18 "Descrizione "
|
||||
USE CMS KEY 2
|
||||
INPUT S0 F_DCOMM
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
COPY OUTPUT F_COMM
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
10
ri/ribtbpdb.h
Executable file
10
ri/ribtbpdb.h
Executable file
@ -0,0 +1,10 @@
|
||||
// campi maschera batbpdb.uml
|
||||
|
||||
#define F_CODTAB 101
|
||||
#define F_DESCR 102
|
||||
#define F_GIORNO_INI 103
|
||||
#define F_MESE_INI 104
|
||||
#define F_GIORNO_FINE 105
|
||||
#define F_MESE_FINE 106
|
||||
#define F_DESCRAGG 107
|
||||
#define F_NUM_ANNI 108
|
70
ri/ristpdb.rep
Executable file
70
ri/ristpdb.rep
Executable file
@ -0,0 +1,70 @@
|
||||
|
||||
<report name="abstpdb" lpi="6">
|
||||
<font face="Courier New" size="10" />
|
||||
<section keep_with_next="1" type="Head">
|
||||
<field type="Testo" valign="center" align="center" width="96" height="2" text="Tabella Perodi di Bilancio">
|
||||
<font face="Courier New" bold="1" size="14" />
|
||||
</field>
|
||||
<field border="2" x="1" y="2.5" type="Linea" width="93" height="0" />
|
||||
<field x="2" y="3" type="Testo" width="4" text="Cod.">
|
||||
<font face="Courier New" bold="1" size="10" />
|
||||
</field>
|
||||
<field x="8" y="3" type="Testo" width="11" text="Descrizione">
|
||||
<font face="Courier New" bold="1" size="10" />
|
||||
</field>
|
||||
<field x="58" y="3" type="Testo" width="12" text="gg/mm inizio">
|
||||
<font face="Courier New" bold="1" size="10" />
|
||||
</field>
|
||||
<field x="73" y="3" type="Testo" width="10" text="gg/mm fine">
|
||||
<font face="Courier New" bold="1" size="10" />
|
||||
</field>
|
||||
<field x="85" y="3" type="Testo" width="9" text="Num. Anni">
|
||||
<font face="Courier New" bold="1" size="10" />
|
||||
</field>
|
||||
<field x="8" y="4" type="Testo" width="40" text="Descrizione alternativa stampa raffronto ">
|
||||
<font face="Courier New" bold="1" size="10" />
|
||||
</field>
|
||||
<field border="2" x="1" y="5.5" type="Linea" width="93" height="0" />
|
||||
</section>
|
||||
<section keep_with_next="1" type="Head" level="1" />
|
||||
<section keep_with_next="1" type="Body" />
|
||||
<section keep_with_next="1" type="Body" level="1">
|
||||
<field x="2" type="Stringa" link="%PDB.CODTAB[1,3]" width="3">
|
||||
<source>CODTAB[1,3]</source>
|
||||
</field>
|
||||
<field x="8" type="Stringa" width="50">
|
||||
<source>S0</source>
|
||||
</field>
|
||||
<field x="61" type="Numero" align="right" width="2">
|
||||
<source>I0[1,2]</source>
|
||||
</field>
|
||||
<field x="65" type="Numero" align="right" width="2">
|
||||
<source>I1[1,2]</source>
|
||||
</field>
|
||||
<field x="77" type="Numero" align="right" width="2">
|
||||
<source>I2[1,2]</source>
|
||||
</field>
|
||||
<field x="81" type="Numero" align="right" width="2">
|
||||
<source>I3[1,2]</source>
|
||||
</field>
|
||||
<field x="90" type="Numero" align="right" width="4">
|
||||
<source>I4[1,4]</source>
|
||||
</field>
|
||||
<field x="8" y="1" type="Stringa" width="50">
|
||||
<source>S1</source>
|
||||
</field>
|
||||
<field border="1" x="1" y="2.5" type="Linea" width="93" height="0" />
|
||||
</section>
|
||||
<section keep_with_next="1" type="Foot" height="3">
|
||||
<field border="2" x="1" y="0.5" type="Linea" width="93" height="0" />
|
||||
<field x="2" y="1" type="Data" width="10">
|
||||
<source>#SYSTEM.DATE</source>
|
||||
</field>
|
||||
<field x="90" y="1" type="Numero" align="right" width="3">
|
||||
<source>#PAGE</source>
|
||||
</field>
|
||||
<field border="2" x="1" y="2.5" type="Linea" width="93" height="0" />
|
||||
</section>
|
||||
<section keep_with_next="1" type="Foot" level="1" />
|
||||
<sql>USE %PDB</sql>
|
||||
</report>
|
37
ri/ristpdb.uml
Executable file
37
ri/ristpdb.uml
Executable file
@ -0,0 +1,37 @@
|
||||
#include "ab1200.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <printbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Stampa tabella tipi di bilancio" 0 2 0 0
|
||||
|
||||
STRING F_INIZIO1 2
|
||||
BEGIN
|
||||
PROMPT 3 1 "Da codice "
|
||||
HELP "Codice da cui iniziare a stampare. Vuoto = inizio archivio"
|
||||
USE %PDB
|
||||
INPUT CODTAB F_INIZIO1
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@40" S0
|
||||
OUTPUT F_INIZIO1 CODTAB
|
||||
GROUP 1
|
||||
FIELD CODTAB
|
||||
FLAGS "UZ"
|
||||
END
|
||||
|
||||
STRING F_FINE1 2
|
||||
BEGIN
|
||||
PROMPT 4 3 "A codice "
|
||||
HELP "Codice a cui terminare la stampa. Vuoto = fine archivio"
|
||||
COPY USE F_INIZIO1
|
||||
INPUT CODTAB F_FINE1
|
||||
COPY DISPLAY F_INIZIO1
|
||||
OUTPUT F_FINE1 CODTAB
|
||||
GROUP 2
|
||||
FIELD CODTAB
|
||||
FLAGS "UZ"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
13
ri/risttb.h
Executable file
13
ri/risttb.h
Executable file
@ -0,0 +1,13 @@
|
||||
#ifndef __AB1200_H
|
||||
#define __AB1200_H
|
||||
|
||||
#define F_INIZIO 100
|
||||
#define F_FINE 101
|
||||
#define F_INIZIO1 102
|
||||
#define F_FINE1 103
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
110
ri/ritbpdb.uml
Executable file
110
ri/ritbpdb.uml
Executable file
@ -0,0 +1,110 @@
|
||||
#include "abtbpdb.h"
|
||||
|
||||
TOOLBAR "" 0 0 0 2
|
||||
#include <relapbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Tabella periodi di bilancio" 0 2 0 0
|
||||
|
||||
GROUPBOX DLG_NULL 76 6
|
||||
BEGIN
|
||||
PROMPT 1 0 ""
|
||||
FLAGS "R"
|
||||
END
|
||||
|
||||
STRING F_CODTAB 2
|
||||
BEGIN
|
||||
PROMPT 2 2 "Codice periodo "
|
||||
HELP "Inserire il codice identificativo del periodo prescelto"
|
||||
FLAS "UZ"
|
||||
FIELD CODTAB
|
||||
KEY 1
|
||||
USE %PDB KEY 1
|
||||
INPUT CODTAB F_CODTAB
|
||||
DISPLAY "Codice@3" CODTAB
|
||||
DISPLAY "Descrizione@40" S0
|
||||
DISPLAY "gg.inizio@3" I0
|
||||
DISPLAY "mm.inizio@3" I1
|
||||
DISPLAY "gg.fine@3" I2
|
||||
DISPLAY "mm.fine@3" I3
|
||||
DISPLAY "Numero anni@3" I4
|
||||
OUTPUT F_CODTAB CODTAB
|
||||
OUTPUT F_DESCR S0
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DESCR 70 40
|
||||
BEGIN
|
||||
PROMPT 2 4 "Descrizione "
|
||||
HELP "Descrizione del codice tabella periodi di bilancio"
|
||||
FIELD S0
|
||||
KEY 2
|
||||
USE %PDB KEY 2
|
||||
INPUT S0 F_DESCR
|
||||
DISPLAY "Descrizione@40" S0
|
||||
DISPLAY "Codice@3" CODTAB
|
||||
DISPLAY "gg.inizio@3" I0
|
||||
DISPLAY "mm.inizio@3" I1
|
||||
DISPLAY "gg.fine@3" I2
|
||||
DISPLAY "mm.fine@3" I3
|
||||
DISPLAY "Numero anni@3" I4
|
||||
COPY OUTPUT F_CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_GIORNO_INI 2
|
||||
BEGIN
|
||||
PROMPT 2 8 "Inizio periodo: giorno "
|
||||
HELP "Inserire il giorno relativo al periodo di inizio"
|
||||
FIELD I0
|
||||
FLAGS "RU"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_MESE_INI 2
|
||||
BEGIN
|
||||
PROMPT 32 8 "mese "
|
||||
HELP "Inserire il mese relativo al periodo di inizio"
|
||||
FIELD I1
|
||||
FLAGS "RU"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
|
||||
NUMBER F_GIORNO_FINE 2
|
||||
BEGIN
|
||||
PROMPT 2 10 "Fine periodo: giorno "
|
||||
HELP "Inserire il giorno relativo alla fine del periodo"
|
||||
FIELD I2
|
||||
FLAGS "RU"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_MESE_FINE 2
|
||||
BEGIN
|
||||
PROMPT 32 10 "mese "
|
||||
HELP "Inserire il mese relativo alla fine del periodo"
|
||||
FIELD I3
|
||||
FLAGS "RU"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_NUM_ANNI 1
|
||||
BEGIN
|
||||
PROMPT 2 12 "Numero di anni "
|
||||
HELP "Inserire il numero di anni"
|
||||
FIELD I4
|
||||
FLAGS "RU"
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
|
||||
STRING F_DESCRAGG 70 30
|
||||
BEGIN
|
||||
PROMPT 2 15 "Descrizione alternativa per stampa raffronti "
|
||||
FIELD S1
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user