Correzione errori marginali

git-svn-id: svn://10.65.10.50/trunk@792 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-12-27 14:57:42 +00:00
parent 471dfd167d
commit af3b1f3113
13 changed files with 7071 additions and 7033 deletions

View File

@ -1,343 +1,343 @@
#include <relapp.h> #include <relapp.h>
#include <pconti.h> #include <pconti.h>
#include "cg0.h" #include "cg0.h"
#include "cg0100.h" #include "cg0100.h"
#define ATTIVITA 1 #define ATTIVITA 1
#define PASSIVITA 2 #define PASSIVITA 2
#define COSTI 3 #define COSTI 3
#define RICAVI 4 #define RICAVI 4
#define ORDINE 5 #define ORDINE 5
class CG0100_application : public TRelation_application class CG0100_application : public TRelation_application
{ {
TMask* _msk; TMask* _msk;
TRelation *_rel; TRelation *_rel;
TLocalisamfile* _saldi; TLocalisamfile* _saldi;
TLocalisamfile* _tabcom; TLocalisamfile* _tabcom;
bool user_create(); bool user_create();
bool user_destroy(); bool user_destroy();
virtual TMask* get_mask(int mode) {return _msk;} virtual TMask* get_mask(int mode) {return _msk;}
virtual bool changing_mask(int mode) {return FALSE;} virtual bool changing_mask(int mode) {return FALSE;}
virtual bool protected_record(TRectype &rec); virtual bool protected_record(TRectype &rec);
virtual void init_query_mode(TMask& m); virtual void init_query_mode(TMask& m);
virtual void init_insert_mode(TMask& m); virtual void init_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m) {init_insert_mode(m);} virtual void init_modify_mode(TMask& m) {init_insert_mode(m);}
virtual int write(const TMask& m); virtual int write(const TMask& m);
virtual int rewrite(const TMask & m); virtual int rewrite(const TMask & m);
virtual int read(TMask& m); virtual int read(TMask& m);
public: public:
virtual TRelation* get_relation() const {return _rel;} virtual TRelation* get_relation() const {return _rel;}
CG0100_application() {} CG0100_application() {}
}; };
HIDDEN inline CG0100_application & app() { return (CG0100_application &) main_app();} HIDDEN inline CG0100_application & app() { return (CG0100_application &) main_app();}
int CG0100_application::read(TMask& m) int CG0100_application::read(TMask& m)
{ {
const TRelation *r = get_relation(); const TRelation *r = get_relation();
m.autoload(r); m.autoload(r);
if (m.get(FLD_CM1_LETTIVD).empty()) if (m.get(FLD_CM1_LETTIVD).empty())
{ {
int sezivd = m.get_int(FLD_CM1_SEZIVD); int sezivd = m.get_int(FLD_CM1_SEZIVD);
if (sezivd == 1 || sezivd == 2) if (sezivd == 1 || sezivd == 2)
m.set(FLD_CM1_SEZIVD, sezivd + 5); m.set(FLD_CM1_SEZIVD, sezivd + 5);
} }
if (m.get(FLD_CM1_LETTIVDOPP).empty()) if (m.get(FLD_CM1_LETTIVDOPP).empty())
{ {
int sezivd = m.get_int(FLD_CM1_SEZIVDOPP); int sezivd = m.get_int(FLD_CM1_SEZIVDOPP);
if (sezivd == 1 || sezivd == 2) if (sezivd == 1 || sezivd == 2)
m.set(FLD_CM1_SEZIVDOPP, sezivd + 5); m.set(FLD_CM1_SEZIVDOPP, sezivd + 5);
} }
return NOERR; return NOERR;
} }
int CG0100_application::rewrite(const TMask& m) int CG0100_application::rewrite(const TMask& m)
{ {
TRelation *r = get_relation(); TRelation *r = get_relation();
m.autosave(r); m.autosave(r);
int sezivd = m.get_int(FLD_CM1_SEZIVD); int sezivd = m.get_int(FLD_CM1_SEZIVD);
TString16 sez; TString16 sez;
if (sezivd == 6 || sezivd == 7) if (sezivd == 6 || sezivd == 7)
{ {
sez.format("%d", sezivd - 5); sez.format("%d", sezivd - 5);
r->lfile().put(PCN_SEZIVD, sez); r->lfile().put(PCN_SEZIVD, sez);
} }
sezivd = m.get_int(FLD_CM1_SEZIVDOPP); sezivd = m.get_int(FLD_CM1_SEZIVDOPP);
if (sezivd == 6 || sezivd == 7) if (sezivd == 6 || sezivd == 7)
{ {
sez.format("%d", sezivd - 5); sez.format("%d", sezivd - 5);
r->lfile().put(PCN_SEZIVDOPP, sez); r->lfile().put(PCN_SEZIVDOPP, sez);
} }
return r->rewrite(); return r->rewrite();
} }
int CG0100_application::write(const TMask& m) int CG0100_application::write(const TMask& m)
{ {
TRelation *r = get_relation(); TRelation *r = get_relation();
TString16 sez; TString16 sez;
m.autosave(r); m.autosave(r);
int sezivd = m.get_int(FLD_CM1_SEZIVD); int sezivd = m.get_int(FLD_CM1_SEZIVD);
if (sezivd == 6 || sezivd == 7) if (sezivd == 6 || sezivd == 7)
{ {
sez.format("%d", sezivd - 5); sez.format("%d", sezivd - 5);
r->lfile().put(PCN_SEZIVD, sez); r->lfile().put(PCN_SEZIVD, sez);
} }
sezivd = m.get_int(FLD_CM1_SEZIVDOPP); sezivd = m.get_int(FLD_CM1_SEZIVDOPP);
if (sezivd == 6 || sezivd == 7) if (sezivd == 6 || sezivd == 7)
{ {
sez.format("%d", sezivd - 5); sez.format("%d", sezivd - 5);
r->lfile().put(PCN_SEZIVDOPP, sez); r->lfile().put(PCN_SEZIVDOPP, sez);
} }
return r->write(); return r->write();
} }
// Controlla se puo' essere effettuata la cancellazione di un conto // Controlla se puo' essere effettuata la cancellazione di un conto
bool CG0100_application::protected_record(TRectype &rec) bool CG0100_application::protected_record(TRectype &rec)
{ {
TMask* m = get_mask(MODE_MOD); TMask* m = get_mask(MODE_MOD);
TLocalisamfile& pconti = _rel->lfile(); TLocalisamfile& pconti = _rel->lfile();
const int gruppo = atoi(m->get(FLD_CM1_GRUPPO)); const int gruppo = atoi(m->get(FLD_CM1_GRUPPO));
const int conto = atoi(m->get(FLD_CM1_CONTO)); const int conto = atoi(m->get(FLD_CM1_CONTO));
const long sottoc = atol(m->get(FLD_CM1_SOTTOCONTO)); const long sottoc = atol(m->get(FLD_CM1_SOTTOCONTO));
// Se e' un sottoconto posso cancellarlo se non esistono saldi // Se e' un sottoconto posso cancellarlo se non esistono saldi
if ((gruppo != 0) && (conto != 0) && (sottoc != 0)) if ((gruppo != 0) && (conto != 0) && (sottoc != 0))
{ {
_saldi->zero(); _saldi->zero();
_saldi->put(PCN_GRUPPO, gruppo); _saldi->put(PCN_GRUPPO, gruppo);
_saldi->put(PCN_CONTO, conto); _saldi->put(PCN_CONTO, conto);
_saldi->put(PCN_SOTTOCONTO, sottoc); _saldi->put(PCN_SOTTOCONTO, sottoc);
_saldi->read(_isgteq); _saldi->read(_isgteq);
return _saldi->good() && gruppo ==_saldi->get_int(PCN_GRUPPO) && return _saldi->good() && gruppo ==_saldi->get_int(PCN_GRUPPO) &&
conto ==_saldi->get_int(PCN_CONTO) && conto ==_saldi->get_int(PCN_CONTO) &&
sottoc ==_saldi->get_long(PCN_SOTTOCONTO); sottoc ==_saldi->get_long(PCN_SOTTOCONTO);
} }
get_relation()->save_status(); get_relation()->save_status();
pconti.zero() ; pconti.zero() ;
pconti.put(PCN_GRUPPO, gruppo); pconti.put(PCN_GRUPPO, gruppo);
// Se e' un conto controllo se ha dei sottoconti // Se e' un conto controllo se ha dei sottoconti
if (conto != 0) if (conto != 0)
pconti.put(PCN_CONTO, conto); pconti.put(PCN_CONTO, conto);
TRectype rec1(pconti.curr()); TRectype rec1(pconti.curr());
pconti.setkey(1) ; pconti.setkey(1) ;
pconti.read(); pconti.read();
pconti.next(); pconti.next();
const bool prot = (pconti.good() && (pconti.curr() == rec1)); const bool prot = (pconti.good() && (pconti.curr() == rec1));
get_relation()->restore_status(); get_relation()->restore_status();
return prot; return prot;
} }
void CG0100_application::init_query_mode(TMask& m) void CG0100_application::init_query_mode(TMask& m)
{ {
m.send_key(K_SHIFT + K_CTRL + 's', -1); m.show(-1); //m.send_key(K_SHIFT + K_CTRL + 's', -1);
m.send_key(K_SHIFT + K_CTRL + 's', -2); m.show(-2); //m.send_key(K_SHIFT + K_CTRL + 's', -2);
m.send_key(K_SHIFT + K_CTRL + 's', -3); m.show(-3); //m.send_key(K_SHIFT + K_CTRL + 's', -3);
} }
HIDDEN bool tmcf_handler(TMask_field& f, KEY key) HIDDEN bool tmcf_handler(TMask_field& f, KEY key)
{ {
if (f.active() && key == K_SPACE) if (f.active() && key == K_SPACE)
{ {
TMask& m = f.mask(); TMask& m = f.mask();
const int conto = atoi(m.get(FLD_CM1_CONTO)); const int conto = atoi(m.get(FLD_CM1_CONTO));
const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO)); const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO));
const bool enable_sezsaldi = (sottoc != 0) || (sottoc == 0 && conto != 0 && m.get(FLD_CM1_TMCF).not_empty()); const bool enable_sezsaldi = (sottoc != 0) || (sottoc == 0 && conto != 0 && m.get(FLD_CM1_TMCF).not_empty());
m.show(FLD_CM2_SEZSALDI, enable_sezsaldi); m.show(FLD_CM2_SEZSALDI, enable_sezsaldi);
} }
return TRUE; return TRUE;
} }
void CG0100_application::init_insert_mode(TMask& m) void CG0100_application::init_insert_mode(TMask& m)
{ {
const int gruppo = atoi(m.get(FLD_CM1_GRUPPO)); const int gruppo = atoi(m.get(FLD_CM1_GRUPPO));
const int conto = atoi(m.get(FLD_CM1_CONTO)); const int conto = atoi(m.get(FLD_CM1_CONTO));
const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO)); const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO));
bool ivd_enable = TRUE; bool ivd_enable = TRUE;
if (conto == 0 && sottoc == 0) if (conto == 0 && sottoc == 0)
m.send_key(K_SHIFT + K_CTRL + 'h', -1); m.show(-1, FALSE); // send_key(K_SHIFT + K_CTRL + 'h', -1);
else else
if (sottoc == 0) if (sottoc == 0)
m.send_key(K_SHIFT + K_CTRL + 'h', -2); m.show(-2, FALSE); //m.send_key(K_SHIFT + K_CTRL + 'h', -2);
else else
m.send_key(K_SHIFT + K_CTRL + 'h', -3); m.show(-3, FALSE); //m.send_key(K_SHIFT + K_CTRL + 'h', -3);
TLocalisamfile& pconti = _rel->lfile(); TLocalisamfile& pconti = _rel->lfile();
TString s(15), s2(1), s3(8), s4(2); TString s(15), s2(1), s3(8), s4(2);
int s1 = 0; int s1 = 0;
pconti.setkey(1) ; pconti.setkey(1) ;
int indbil = 0; int indbil = 0;
if (sottoc != 0) if (sottoc != 0)
{ {
pconti.zero(); pconti.zero();
pconti.put(PCN_GRUPPO, gruppo); pconti.put(PCN_GRUPPO, gruppo);
pconti.put(PCN_CONTO, conto); pconti.put(PCN_CONTO, conto);
pconti.read(); pconti.read();
if (pconti.good()) if (pconti.good())
{ {
s = pconti.get(PCN_CODCBL); s = pconti.get(PCN_CODCBL);
s1 = atoi(pconti.get(PCN_SEZIVD)); s1 = atoi(pconti.get(PCN_SEZIVD));
s2 = pconti.get(PCN_LETTIVD); s2 = pconti.get(PCN_LETTIVD);
s3 = pconti.get(PCN_NUMRIVD); s3 = pconti.get(PCN_NUMRIVD);
s4 = pconti.get(PCN_NUMIVD); s4 = pconti.get(PCN_NUMIVD);
indbil = pconti.get_int(PCN_INDBIL); indbil = pconti.get_int(PCN_INDBIL);
} }
ivd_enable = (s1 == 0) && s2.empty() && s3.empty() && s4.empty(); ivd_enable = (s1 == 0) && s2.empty() && s3.empty() && s4.empty();
} }
m.show(FLD_CM1_RICSER, indbil == PASSIVITA || indbil == RICAVI); m.show(FLD_CM1_RICSER, indbil == PASSIVITA || indbil == RICAVI);
if (conto != 0) if (conto != 0)
{ {
m.enable(FLD_CM1_SEZIVD, ivd_enable); m.enable(FLD_CM1_SEZIVD, ivd_enable);
m.show(FLD_CM1_LETTIVD, ivd_enable); m.show(FLD_CM1_LETTIVD, ivd_enable);
m.show(FLD_CM1_NUMRIVD, ivd_enable); m.show(FLD_CM1_NUMRIVD, ivd_enable);
m.show(FLD_CM1_NUMIVD, ivd_enable); m.show(FLD_CM1_NUMIVD, ivd_enable);
m.show(FLD_CM1_LETTIVDH, !ivd_enable); m.show(FLD_CM1_LETTIVDH, !ivd_enable);
m.show(FLD_CM1_NUMRIVDH, !ivd_enable); m.show(FLD_CM1_NUMRIVDH, !ivd_enable);
m.show(FLD_CM1_NUMIVDH, !ivd_enable); m.show(FLD_CM1_NUMIVDH, !ivd_enable);
if (!ivd_enable) if (!ivd_enable)
{ {
m.set(FLD_CM1_SEZIVD, s1); m.set(FLD_CM1_SEZIVD, s1);
m.set(FLD_CM1_LETTIVDH, s2); m.set(FLD_CM1_LETTIVDH, s2);
m.set(FLD_CM1_NUMRIVDH, s3); m.set(FLD_CM1_NUMRIVDH, s3);
m.set(FLD_CM1_NUMIVDH, s4); m.set(FLD_CM1_NUMIVDH, s4);
m.enable(FLD_CM1_SEZIVDOPP); m.enable(FLD_CM1_SEZIVDOPP);
} }
pconti.zero(); pconti.zero();
pconti.put(PCN_GRUPPO, gruppo); pconti.put(PCN_GRUPPO, gruppo);
pconti.read(); pconti.read();
if (pconti.good()) if (pconti.good())
if (s.empty()) s = pconti.get(PCN_CODCBL); if (s.empty()) s = pconti.get(PCN_CODCBL);
} }
if (s.not_empty()) if (s.not_empty())
{ {
m.set(FLD_CM1_CODANALISIH, s); m.set(FLD_CM1_CODANALISIH, s);
m.show(FLD_CM1_CODANALISIH); m.show(FLD_CM1_CODANALISIH);
m.hide(FLD_CM1_CODTABANALISI); m.hide(FLD_CM1_CODTABANALISI);
} }
else else
{ {
m.show(FLD_CM1_CODTABANALISI); m.show(FLD_CM1_CODTABANALISI);
m.hide(FLD_CM1_CODANALISIH); m.hide(FLD_CM1_CODANALISIH);
} }
const bool enable_sezsaldi = (sottoc != 0) || (sottoc == 0 && conto != 0 && m.get(FLD_CM1_TMCF).not_empty()); const bool enable_sezsaldi = (sottoc != 0) || (sottoc == 0 && conto != 0 && m.get(FLD_CM1_TMCF).not_empty());
m.show(FLD_CM2_SEZSALDI, enable_sezsaldi); m.show(FLD_CM2_SEZSALDI, enable_sezsaldi);
} }
HIDDEN bool gruppo_handler(TMask_field& f, KEY key) HIDDEN bool gruppo_handler(TMask_field& f, KEY key)
{ {
if (key == K_ENTER) if (key == K_ENTER)
{ {
const TMask& m = f.mask(); const TMask& m = f.mask();
const int gruppo = atoi(m.get(FLD_CM1_GRUPPO)); const int gruppo = atoi(m.get(FLD_CM1_GRUPPO));
const int conto = atoi(m.get(FLD_CM1_CONTO)); const int conto = atoi(m.get(FLD_CM1_CONTO));
TLocalisamfile& pconti = app().get_relation()->lfile(); TLocalisamfile& pconti = app().get_relation()->lfile();
if (gruppo != 0 && conto != 0) if (gruppo != 0 && conto != 0)
{ {
pconti.zero() ; pconti.zero() ;
pconti.put(PCN_GRUPPO, gruppo) ; pconti.put(PCN_GRUPPO, gruppo) ;
pconti.setkey(1) ; pconti.setkey(1) ;
pconti.read(); pconti.read();
if (pconti.bad()) if (pconti.bad())
return f.warning_box ("Il gruppo non esiste"); return f.warning_box ("Il gruppo non esiste");
} }
} }
return TRUE; return TRUE;
} }
HIDDEN bool conto_handler(TMask_field& f, KEY key) HIDDEN bool conto_handler(TMask_field& f, KEY key)
{ {
if (key == K_ENTER) if (key == K_ENTER)
{ {
const TMask& m = f.mask(); const TMask& m = f.mask();
const int gruppo = atoi(m.get(FLD_CM1_GRUPPO)); const int gruppo = atoi(m.get(FLD_CM1_GRUPPO));
const int conto = atoi(m.get(FLD_CM1_CONTO)); const int conto = atoi(m.get(FLD_CM1_CONTO));
const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO)); const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO));
TLocalisamfile& pconti = app().get_relation()->lfile(); TLocalisamfile& pconti = app().get_relation()->lfile();
if (gruppo != 0 && conto != 0 && sottoc != 0) if (gruppo != 0 && conto != 0 && sottoc != 0)
{ {
pconti.zero() ; pconti.zero() ;
pconti.put(PCN_GRUPPO, gruppo) ; pconti.put(PCN_GRUPPO, gruppo) ;
pconti.put(PCN_CONTO, conto) ; pconti.put(PCN_CONTO, conto) ;
pconti.setkey(1) ; pconti.setkey(1) ;
pconti.read(); pconti.read();
if (pconti.bad()) if (pconti.bad())
return m.field(FLD_CM1_CONTO).warning_box ("Il conto non esiste"); return m.field(FLD_CM1_CONTO).warning_box ("Il conto non esiste");
else else
{ {
if (pconti.get(PCN_TMCF).not_empty()) if (pconti.get(PCN_TMCF).not_empty())
return m.field(FLD_CM1_SOTTOCONTO).warning_box ("Non e' possibile inserire un sottoconto di un conto relativo ad un cliente/fornitore"); return m.field(FLD_CM1_SOTTOCONTO).warning_box ("Non e' possibile inserire un sottoconto di un conto relativo ad un cliente/fornitore");
} }
} }
} }
return TRUE; return TRUE;
} }
HIDDEN bool sottoc_handler(TMask_field& f, KEY key) HIDDEN bool sottoc_handler(TMask_field& f, KEY key)
{ {
if (key == K_TAB) if (key == K_TAB)
{ {
const int gruppo = f.mask().get_int(FLD_CM1_GRUPPO); const int gruppo = f.mask().get_int(FLD_CM1_GRUPPO);
if (gruppo == 0) return TRUE; if (gruppo == 0) return TRUE;
const int conto = f.mask().get_int(FLD_CM1_CONTO); const int conto = f.mask().get_int(FLD_CM1_CONTO);
const long sottoconto = f.mask().get_long(FLD_CM1_SOTTOCONTO); const long sottoconto = f.mask().get_long(FLD_CM1_SOTTOCONTO);
if (sottoconto != 0 && conto == 0) if (sottoconto != 0 && conto == 0)
return f.mask().field(FLD_CM1_CONTO).error_box("Manca il conto"); return f.mask().field(FLD_CM1_CONTO).error_box("Manca il conto");
return f.mask().stop_run(K_AUTO_ENTER); return f.mask().stop_run(K_AUTO_ENTER);
} }
return TRUE; return TRUE;
} }
bool CG0100_application::user_create() bool CG0100_application::user_create()
{ {
_msk = new TMask("cg0100a") ; _msk = new TMask("cg0100a") ;
_msk->set_handler(FLD_CM1_GRUPPO, gruppo_handler); _msk->set_handler(FLD_CM1_GRUPPO, gruppo_handler);
_msk->set_handler(FLD_CM1_CONTO, conto_handler); _msk->set_handler(FLD_CM1_CONTO, conto_handler);
_msk->set_handler(FLD_CM1_SOTTOCONTO, sottoc_handler); _msk->set_handler(FLD_CM1_SOTTOCONTO, sottoc_handler);
_msk->set_handler(FLD_CM1_TMCF, tmcf_handler); _msk->set_handler(FLD_CM1_TMCF, tmcf_handler);
_rel = new TRelation(LF_PCON); _rel = new TRelation(LF_PCON);
_saldi = new TLocalisamfile(LF_SALDI); _saldi = new TLocalisamfile(LF_SALDI);
_saldi->setkey(2); _saldi->setkey(2);
set_search_field(FLD_CM1_GRUPPO); set_search_field(FLD_CM1_GRUPPO);
return TRUE; return TRUE;
} }
bool CG0100_application::user_destroy() bool CG0100_application::user_destroy()
{ {
delete _msk; delete _msk;
delete _rel; delete _rel;
delete _saldi; delete _saldi;
return TRUE; return TRUE;
} }
int cg0100(int argc, char* argv[]) int cg0100(int argc, char* argv[])
{ {
CG0100_application a ; CG0100_application a ;
a.run(argc, argv, "Piano dei conti"); a.run(argc, argv, "Piano dei conti");
return 0; return 0;
} }

View File

@ -1,354 +1,354 @@
#include "cg0100.h" #include "cg0100.h"
TOOLBAR "" 0 20 0 2 TOOLBAR "" 0 20 0 2
#include <toolbar.h> #include <toolbar.h>
ENDPAGE ENDPAGE
PAGE "Piano dei conti " 0 -1 0 19 PAGE "Piano dei conti " 0 -1 0 19
GROUPBOX DLG_NULL 76 5 GROUPBOX DLG_NULL 76 5
BEGIN BEGIN
PROMPT 1 0 "" PROMPT 1 0 ""
FLAGS "R" FLAGS "R"
END END
NUMBER FLD_CM1_GRUPPO 3 NUMBER FLD_CM1_GRUPPO 3
BEGIN BEGIN
PROMPT 2 1 "Gruppo " PROMPT 2 1 "Gruppo "
HELP "Codice del gruppo" HELP "Codice del gruppo"
FIELD LF_PCON->GRUPPO FIELD LF_PCON->GRUPPO
FLAGS "R" FLAGS "R"
KEY 1 KEY 1
USE LF_PCON KEY 1 SELECT CONTO="" USE LF_PCON KEY 1 SELECT CONTO=""
INPUT GRUPPO FLD_CM1_GRUPPO INPUT GRUPPO FLD_CM1_GRUPPO
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
OUTPUT FLD_CM1_GRUPPO GRUPPO OUTPUT FLD_CM1_GRUPPO GRUPPO
OUTPUT FLD_CM1_DESCG DESCR OUTPUT FLD_CM1_DESCG DESCR
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
STRING FLD_CM1_DESCG 50 STRING FLD_CM1_DESCG 50
BEGIN BEGIN
PROMPT 23 1 "" PROMPT 23 1 ""
FLAGS "D" FLAGS "D"
END END
NUMBER FLD_CM1_CONTO 3 NUMBER FLD_CM1_CONTO 3
BEGIN BEGIN
PROMPT 2 2 "Conto " PROMPT 2 2 "Conto "
HELP "Codice dell'eventuale conto" HELP "Codice dell'eventuale conto"
FIELD LF_PCON->CONTO FIELD LF_PCON->CONTO
FLAGS "R" FLAGS "R"
KEY 1 KEY 1
USE LF_PCON KEY 1 SELECT ((CONTO!="") && (SOTTOCONTO="")) USE LF_PCON KEY 1 SELECT ((CONTO!="") && (SOTTOCONTO=""))
COPY INPUT FLD_CM1_GRUPPO COPY INPUT FLD_CM1_GRUPPO
INPUT CONTO FLD_CM1_CONTO INPUT CONTO FLD_CM1_CONTO
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
OUTPUT FLD_CM1_GRUPPO GRUPPO OUTPUT FLD_CM1_GRUPPO GRUPPO
OUTPUT FLD_CM1_CONTO CONTO OUTPUT FLD_CM1_CONTO CONTO
OUTPUT FLD_CM1_DESCC DESCR OUTPUT FLD_CM1_DESCC DESCR
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
STRING FLD_CM1_DESCC 50 STRING FLD_CM1_DESCC 50
BEGIN BEGIN
PROMPT 23 2 "" PROMPT 23 2 ""
FLAGS "D" FLAGS "D"
END END
NUMBER FLD_CM1_SOTTOCONTO 6 NUMBER FLD_CM1_SOTTOCONTO 6
BEGIN BEGIN
PROMPT 2 3 "Sottoconto " PROMPT 2 3 "Sottoconto "
HELP "Codice dell'eventuale sottoconto" HELP "Codice dell'eventuale sottoconto"
FIELD LF_PCON->SOTTOCONTO FIELD LF_PCON->SOTTOCONTO
FLAGS "R" FLAGS "R"
KEY 1 KEY 1
USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" USE LF_PCON KEY 1 SELECT SOTTOCONTO!=""
COPY INPUT FLD_CM1_CONTO COPY INPUT FLD_CM1_CONTO
INPUT SOTTOCONTO FLD_CM1_SOTTOCONTO INPUT SOTTOCONTO FLD_CM1_SOTTOCONTO
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Sospeso" SOSPESO DISPLAY "Sospeso" SOSPESO
DISPLAY "Descrizione@70" DESCR DISPLAY "Descrizione@70" DESCR
OUTPUT FLD_CM1_SOTTOCONTO SOTTOCONTO OUTPUT FLD_CM1_SOTTOCONTO SOTTOCONTO
OUTPUT FLD_CM1_GRUPPO GRUPPO OUTPUT FLD_CM1_GRUPPO GRUPPO
OUTPUT FLD_CM1_CONTO CONTO OUTPUT FLD_CM1_CONTO CONTO
OUTPUT FLD_CM1_DESC DESCR OUTPUT FLD_CM1_DESC DESCR
END END
STRING FLD_CM1_DESC 50 STRING FLD_CM1_DESC 50
BEGIN BEGIN
PROMPT 23 3 "" PROMPT 23 3 ""
FIELD LF_PCON->DESCR FIELD LF_PCON->DESCR
KEY 2 KEY 2
USE LF_PCON KEY 2 USE LF_PCON KEY 2
INPUT DESCR FLD_CM1_DESC INPUT DESCR FLD_CM1_DESC
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
DISPLAY "Sospeso" SOSPESO DISPLAY "Sospeso" SOSPESO
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Sottoconto " SOTTOCONTO DISPLAY "Sottoconto " SOTTOCONTO
COPY OUTPUT FLD_CM1_SOTTOCONTO COPY OUTPUT FLD_CM1_SOTTOCONTO
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
HELP "Descrizione del gruppo o del conto o del sottoconto" HELP "Descrizione del gruppo o del conto o del sottoconto"
WARNING "Manca la descrizione" WARNING "Manca la descrizione"
END END
NUMBER FLD_CM1_CODTABANALISI 10 NUMBER FLD_CM1_CODTABANALISI 10
BEGIN BEGIN
PROMPT 1 5 "Codice Tabella Analisi " PROMPT 1 5 "Codice Tabella Analisi "
HELP "Codice di raggruppamento per l'analisi di bilancio" HELP "Codice di raggruppamento per l'analisi di bilancio"
FIELD LF_PCON->CODCBL FIELD LF_PCON->CODCBL
FLAGS "R" FLAGS "R"
END END
NUMBER FLD_CM1_CODANALISIH 10 NUMBER FLD_CM1_CODANALISIH 10
BEGIN BEGIN
PROMPT 1 5 "Codice Tabella Analisi " PROMPT 1 5 "Codice Tabella Analisi "
FLAGS "RHD" FLAGS "RHD"
END END
LIST FLD_CM1_INDBIL 1 22 LIST FLD_CM1_INDBIL 1 22
BEGIN BEGIN
PROMPT 1 6 "Sezione di bilancio " PROMPT 1 6 "Sezione di bilancio "
FIELD LF_PCON->INDBIL FIELD LF_PCON->INDBIL
GROUP 1 3 GROUP 1 3
HELP "Sezione di appartenenza del conto" HELP "Sezione di appartenenza del conto"
ITEM "1|1. Attivita'" ITEM "1|1. Attivita'"
ITEM "2|2. Passivita'" ITEM "2|2. Passivita'"
ITEM "3|3. Costi" ITEM "3|3. Costi"
ITEM "4|4. Ricavi" ITEM "4|4. Ricavi"
ITEM "5|5. Conti d'ordine" ITEM "5|5. Conti d'ordine"
END END
LIST FLD_CM1_SEZIVD 1 22 LIST FLD_CM1_SEZIVD 1 22
BEGIN BEGIN
PROMPT 1 7 "Sez. e classe IV dir. " PROMPT 1 7 "Sez. e classe IV dir. "
FIELD LF_PCON->SEZIVD FIELD LF_PCON->SEZIVD
GROUP 1 4 ITEM "0|0. Nessuna" MESSAGE CLEAR,5@|CLEAR,6@
ITEM "0|0. Nessuna" MESSAGE CLEAR,5@|CLEAR,6@ ITEM "1|1. Attivita'" MESSAGE ENABLE,5@|ENABLE,6@
ITEM "1|1. Attivita'" MESSAGE ENABLE,5@|ENABLE,6@ ITEM "2|2. Passivita'" MESSAGE ENABLE,5@|ENABLE,6@
ITEM "2|2. Passivita'" MESSAGE ENABLE,5@|ENABLE,6@ ITEM "5|5. Conto d'ordine" MESSAGE CLEAR,5@|ENABLE,6@
ITEM "5|5. Conto d'ordine" MESSAGE CLEAR,5@|ENABLE,6@ ITEM "6|6. C.ordine attivo" MESSAGE CLEAR,5@|ENABLE,6@
ITEM "6|6. C.ordine attivo" MESSAGE CLEAR,5@|ENABLE,6@ ITEM "7|7. C.ordine passivo" MESSAGE CLEAR,5@|ENABLE,6@
ITEM "7|7. C.ordine passivo" MESSAGE CLEAR,5@|ENABLE,6@ ITEM "9|9. Conto economico" MESSAGE ENABLE,5@|ENABLE,6@
ITEM "9|9. Conto economico" MESSAGE ENABLE,5@|ENABLE,6@ HELP "Codice del conto secondo la IV direttiva CEE"
HELP "Codice del conto secondo la IV direttiva CEE" GROUP 1 4
END END
STRING FLD_CM1_LETTIVD 1 1 STRING FLD_CM1_LETTIVD 1 1
BEGIN BEGIN
PROMPT 56 7 "" PROMPT 56 7 ""
HELP "Codice del conto secondo la IV direttiva CEE" HELP "Codice del conto secondo la IV direttiva CEE"
FIELD LF_PCON->LETTIVD FIELD LF_PCON->LETTIVD
GROUP 1 5 GROUP 1 5
FLAGS "U" FLAGS "U"
END END
STRING FLD_CM1_LETTIVDH 1 STRING FLD_CM1_LETTIVDH 1
BEGIN BEGIN
PROMPT 56 7 "" PROMPT 56 7 ""
FLAGS "HDU" FLAGS "HDU"
GROUP 5 GROUP 1 5
END END
NUMBER FLD_CM1_NUMRIVD 8 4 NUMBER FLD_CM1_NUMRIVD 8 4
BEGIN BEGIN
PROMPT 60 7 "" PROMPT 60 7 ""
HELP "Codice del conto secondo la IV direttiva CEE" HELP "Codice del conto secondo la IV direttiva CEE"
FIELD LF_PCON->NUMRIVD FIELD LF_PCON->NUMRIVD
GROUP 1 5 GROUP 1 5
FLAGS "MZ" FLAGS "MZ"
END END
NUMBER FLD_CM1_NUMRIVDH 8 4 NUMBER FLD_CM1_NUMRIVDH 8 4
BEGIN BEGIN
PROMPT 60 7 "" PROMPT 60 7 ""
FLAGS "HDMZ" FLAGS "HDMZ"
GROUP 5 GROUP 1 5
END END
NUMBER FLD_CM1_NUMIVD 2 NUMBER FLD_CM1_NUMIVD 2
BEGIN BEGIN
PROMPT 71 7 "" PROMPT 71 7 ""
HELP "Codice del conto secondo la IV direttiva CEE" HELP "Codice del conto secondo la IV direttiva CEE"
FIELD LF_PCON->NUMIVD FIELD LF_PCON->NUMIVD
FLAGS "RZ" FLAGS "RZ"
GROUP 1 5 GROUP 1 5
USE %IVD USE %IVD
INPUT CODTAB[1,1] FLD_CM1_SEZIVD INPUT CODTAB[1,1] FLD_CM1_SEZIVD
INPUT CODTAB[2,2] FLD_CM1_LETTIVD INPUT CODTAB[2,2] FLD_CM1_LETTIVD
INPUT CODTAB[3,6] FLD_CM1_NUMRIVD INPUT CODTAB[3,6] FLD_CM1_NUMRIVD
INPUT CODTAB[7,8] FLD_CM1_NUMIVD INPUT CODTAB[7,8] FLD_CM1_NUMIVD
DISPLAY "Sezione" CODTAB[1,1] DISPLAY "Sezione" CODTAB[1,1]
DISPLAY "Lettera" CODTAB[2,2] DISPLAY "Lettera" CODTAB[2,2]
DISPLAY "Classe @M" CODTAB[3,6] DISPLAY "Classe @M" CODTAB[3,6]
DISPLAY "Numero" CODTAB[7,8] DISPLAY "Numero" CODTAB[7,8]
DISPLAY "Descrizione@70" S0 DISPLAY "Descrizione@70" S0
OUTPUT FLD_CM1_SEZIVD CODTAB[1,1] OUTPUT FLD_CM1_SEZIVD CODTAB[1,1]
OUTPUT FLD_CM1_LETTIVD CODTAB[2,2] OUTPUT FLD_CM1_LETTIVD CODTAB[2,2]
OUTPUT FLD_CM1_NUMRIVD CODTAB[3,6] OUTPUT FLD_CM1_NUMRIVD CODTAB[3,6]
OUTPUT FLD_CM1_NUMIVD CODTAB[7,8] OUTPUT FLD_CM1_NUMIVD CODTAB[7,8]
CHECKTYPE NORMAL CHECKTYPE NORMAL
WARNING "Codice non presente" WARNING "Codice non presente"
END END
NUMBER FLD_CM1_NUMIVDH 2 NUMBER FLD_CM1_NUMIVDH 2
BEGIN BEGIN
PROMPT 71 7 "" PROMPT 71 7 ""
FLAGS "HDRZ" FLAGS "HDRZ"
GROUP 1 5 GROUP 1 5
END END
LIST FLD_CM1_SEZIVDOPP 1 22 LIST FLD_CM1_SEZIVDOPP 1 22
BEGIN BEGIN
PROMPT 1 8 "Classe segno opposto " PROMPT 1 8 "Classe segno opposto "
FIELD LF_PCON->SEZIVDOPP FIELD LF_PCON->SEZIVDOPP
GROUP 1 2 4 6 GROUP 1 2 4 6
ITEM "0|0. Nessuna" MESSAGE CLEAR,7@ ITEM "0|0. Nessuna" MESSAGE CLEAR,7@
ITEM "1|1. Attivita'" MESSAGE ENABLE,7@ ITEM "1|1. Attivita'" MESSAGE ENABLE,7@
ITEM "2|2. Passivita'" MESSAGE ENABLE,7@ ITEM "2|2. Passivita'" MESSAGE ENABLE,7@
ITEM "5|5. Conto d'ordine" MESSAGE CLEAR,7@ ITEM "5|5. Conto d'ordine" MESSAGE CLEAR,7@
ITEM "6|6. C.ordine attivo" MESSAGE CLEAR,7@ ITEM "6|6. C.ordine attivo" MESSAGE CLEAR,7@
ITEM "7|7. C.ordine passivo" MESSAGE CLEAR,7@ ITEM "7|7. C.ordine passivo" MESSAGE CLEAR,7@
ITEM "9|9. Conto economico" MESSAGE ENABLE,7@ ITEM "9|9. Conto economico" MESSAGE ENABLE,7@
HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE" HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE"
END END
STRING FLD_CM1_LETTIVDOPP 1 STRING FLD_CM1_LETTIVDOPP 1
BEGIN BEGIN
PROMPT 56 8 "" PROMPT 56 8 ""
HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE" HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE"
FIELD LF_PCON->LETTIVDOPP FIELD LF_PCON->LETTIVDOPP
FLAGS "U" FLAGS "U"
GROUP 1 2 4 7 GROUP 1 2 4 7
END END
NUMBER FLD_CM1_NUMRIVDOPP 8 4 NUMBER FLD_CM1_NUMRIVDOPP 8 4
BEGIN BEGIN
PROMPT 60 8 "" PROMPT 60 8 ""
HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE" HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE"
FIELD LF_PCON->NUMRIVDOPP FIELD LF_PCON->NUMRIVDOPP
FLAGS "MZ" FLAGS "MZ"
GROUP 1 2 4 7 GROUP 1 2 4 7
END END
NUMBER FLD_CM1_NUMIVDOPP 2 NUMBER FLD_CM1_NUMIVDOPP 2
BEGIN BEGIN
PROMPT 71 8 "" PROMPT 71 8 ""
HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE" HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE"
FIELD LF_PCON->NUMIVDOPP FIELD LF_PCON->NUMIVDOPP
FLAGS "RZ" FLAGS "RZ"
GROUP 1 2 4 7 GROUP 1 2 4 7
COPY USE FLD_CM1_NUMIVD COPY USE FLD_CM1_NUMIVD
INPUT CODTAB[1,1] FLD_CM1_SEZIVDOPP INPUT CODTAB[1,1] FLD_CM1_SEZIVDOPP
INPUT CODTAB[2,2] FLD_CM1_LETTIVDOPP INPUT CODTAB[2,2] FLD_CM1_LETTIVDOPP
INPUT CODTAB[3,6] FLD_CM1_NUMRIVDOPP INPUT CODTAB[3,6] FLD_CM1_NUMRIVDOPP
INPUT CODTAB[7,8] FLD_CM1_NUMIVDOPP INPUT CODTAB[7,8] FLD_CM1_NUMIVDOPP
COPY DISPLAY FLD_CM1_NUMIVD COPY DISPLAY FLD_CM1_NUMIVD
OUTPUT FLD_CM1_SEZIVDOPP CODTAB[1,1] OUTPUT FLD_CM1_SEZIVDOPP CODTAB[1,1]
OUTPUT FLD_CM1_LETTIVDOPP CODTAB[2,2] OUTPUT FLD_CM1_LETTIVDOPP CODTAB[2,2]
OUTPUT FLD_CM1_NUMRIVDOPP CODTAB[3,6] OUTPUT FLD_CM1_NUMRIVDOPP CODTAB[3,6]
OUTPUT FLD_CM1_NUMIVDOPP CODTAB[7,8] OUTPUT FLD_CM1_NUMIVDOPP CODTAB[7,8]
CHECKTYPE NORMAL CHECKTYPE NORMAL
WARNING "Codice non presente" WARNING "Codice non presente"
END END
LIST FLD_CM1_TIPOSPRIC 1 50 LIST FLD_CM1_TIPOSPRIC 1 50
BEGIN BEGIN
PROMPT 1 9 "Tipo Spesa/Ricavo " PROMPT 1 9 "Tipo Spesa/Ricavo "
FIELD LF_PCON->TIPOSPRIC FIELD LF_PCON->TIPOSPRIC
GROUP 1 2 GROUP 1 2
HELP "Specificare il tipo do conto" HELP "Specificare il tipo do conto"
ITEM "0|0. Acquisti o vendite in genere" ITEM "0|0. Acquisti o vendite in genere"
ITEM "1|1. Acquisti beni per rivendita" ITEM "1|1. Acquisti beni per rivendita"
ITEM "2|2. Acquisti beni ammortizzabili" ITEM "2|2. Acquisti beni ammortizzabili"
ITEM "3|3. Acquisti beni ammortizzabili con detr. 6%" ITEM "3|3. Acquisti beni ammortizzabili con detr. 6%"
ITEM "4|4. Vendita beni strumentali art. 17" ITEM "4|4. Vendita beni strumentali art. 17"
ITEM "5|5. Beni per rivendita da non ventilare" ITEM "5|5. Beni per rivendita da non ventilare"
ITEM "8|8. Altri beni strumentali acquistati in leasing" ITEM "8|8. Altri beni strumentali acquistati in leasing"
ITEM "9|9. Spese Generali" ITEM "9|9. Spese Generali"
END END
LIST FLD_CM1_RICSER 1 18 LIST FLD_CM1_RICSER 1 18
BEGIN BEGIN
PROMPT 1 10 "Ricavi per servizi " PROMPT 1 10 "Ricavi per servizi "
FIELD RICSER FIELD RICSER
FLAGS "H" FLAGS "H"
ITEM "0|Altre attivita'" ITEM "0|Altre attivita'"
ITEM "1|Servizi" ITEM "1|Servizi"
END END
LIST FLD_CM1_TMCF 1 13 LIST FLD_CM1_TMCF 1 13
BEGIN BEGIN
PROMPT 1 11 "Tipo sottoconti " PROMPT 1 11 "Tipo sottoconti "
FIELD LF_PCON->TMCF FIELD LF_PCON->TMCF
GROUP 1 3 GROUP 1 3
HELP "Tipo dei sottoconti (Normale o clienti/fornitori)" HELP "Tipo dei sottoconti (Normale o clienti/fornitori)"
ITEM " |Normali" ITEM " |Normali"
ITEM "C|Clienti" ITEM "C|Clienti"
ITEM "F|Fornitori" ITEM "F|Fornitori"
END END
LIST FLD_CM2_SEZSALDI 1 10 LIST FLD_CM2_SEZSALDI 1 10
BEGIN BEGIN
PROMPT 1 12 "Controllo saldo primanota " PROMPT 1 12 "Controllo saldo primanota "
HELP "Tipo di controllo del saldo in prima nota" HELP "Tipo di controllo del saldo in prima nota"
FIELD LF_PCON->SEZSALDI FIELD LF_PCON->SEZSALDI
GROUP 1 GROUP 1
ITEM " |Nessuno" ITEM " |Nessuno"
ITEM "A|Avere" ITEM "A|Avere"
ITEM "D|Dare" ITEM "D|Dare"
END END
BOOLEAN FLD_CM2_STSOTTBIL BOOLEAN FLD_CM2_STSOTTBIL
BEGIN BEGIN
PROMPT 1 14 "Stampa dettaglio sottoconti su bilanci " PROMPT 1 14 "Stampa dettaglio sottoconti su bilanci "
HELP "Indicare se stampare il dettaglio dei sottoconti nei bilanci di verifica" HELP "Indicare se stampare il dettaglio dei sottoconti nei bilanci di verifica"
FIELD LF_PCON->STSOTTBIL FIELD LF_PCON->STSOTTBIL
GROUP 1 3 GROUP 1 3
END END
BOOLEAN FLD_CM2_COMPENS BOOLEAN FLD_CM2_COMPENS
BEGIN BEGIN
PROMPT 50 14 "Compensazione saldi " PROMPT 50 14 "Compensazione saldi "
HELP "Indicare se e' ammessa la compensazione dei saldi" HELP "Indicare se e' ammessa la compensazione dei saldi"
FIELD LF_PCON->COMPENS FIELD LF_PCON->COMPENS
GROUP 1 3 GROUP 1 3
END END
BOOLEAN FLD_CM2_STSOTTAB BOOLEAN FLD_CM2_STSOTTAB
BEGIN BEGIN
PROMPT 1 15 "Stampa dettaglio sottoconti su analisi " PROMPT 1 15 "Stampa dettaglio sottoconti su analisi "
HELP "Indicare se stampare il dettaglio dei sottoconti nell'analisi di bilancio" HELP "Indicare se stampare il dettaglio dei sottoconti nell'analisi di bilancio"
FIELD LF_PCON->STSOTTAB FIELD LF_PCON->STSOTTAB
GROUP 1 3 GROUP 1 3
MESSAGE COPY,FLD_CM2_STSOTTABS MESSAGE COPY,FLD_CM2_STSOTTABS
END END
BOOLEAN FLD_CM2_STSOTTABS BOOLEAN FLD_CM2_STSOTTABS
BEGIN BEGIN
PROMPT 1 15 "Stampa dettaglio movimenti su analisi " PROMPT 1 15 "Stampa dettaglio movimenti su analisi "
FIELD LF_PCON->STSOTTAB FIELD LF_PCON->STSOTTAB
FLAGS "H" FLAGS "H"
GROUP 1 2 GROUP 1 2
MESSAGE COPY,FLD_CM2_STSOTTAB MESSAGE COPY,FLD_CM2_STSOTTAB
END END
BOOLEAN FLD_CM2_SOSPESO BOOLEAN FLD_CM2_SOSPESO
BEGIN BEGIN
PROMPT 50 15 "Conto sospeso" PROMPT 50 15 "Conto sospeso"
HELP "Indicare se sospendere il conto in prima nota" HELP "Indicare se sospendere il conto in prima nota"
FIELD LF_PCON->SOSPESO FIELD LF_PCON->SOSPESO
GROUP 1 2 GROUP 1 2
END END
ENDPAGE ENDPAGE
ENDMASK ENDMASK

View File

@ -1,43 +1,33 @@
#include <default.url> #include <default.url>
MENU TASK_MENUBAR MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File" SUBMENU MENU_FILE "~File"
MENUBAR MENU_BAR(1) MENUBAR MENU_BAR(1)
MENU MENU_BAR(1) MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File" SUBMENU MENU_FILE "~File"
MENUBAR MENU_BAR(2) MENUBAR MENU_BAR(3)
MENU MENU_BAR(2) MENU MENU_BAR(3)
SUBMENU MENU_FILE "~File" SUBMENU MENU_FILE "~File"
MENU BAR_ITEM(1) MENUBAR MENU_BAR(4)
ITEM MENU_ITEM(1) "~Header"
ITEM MENU_ITEM(2) "~Body" MENU MENU_BAR(4)
ITEM MENU_ITEM(3) "~Footer" SUBMENU MENU_FILE "~File"
MENUBAR MENU_BAR(3) MENUBAR MENU_BAR(5)
MENU MENU_BAR(3) MENU MENU_BAR(5)
SUBMENU MENU_FILE "~File" SUBMENU MENU_FILE "~File"
MENUBAR MENU_BAR(4) MENUBAR MENU_BAR(6)
MENU MENU_BAR(4) MENU MENU_BAR(6)
SUBMENU MENU_FILE "~File" SUBMENU MENU_FILE "~File"
MENUBAR MENU_BAR(5)
MENU MENU_BAR(5)
SUBMENU MENU_FILE "~File"
MENUBAR MENU_BAR(6)
MENU MENU_BAR(6)
SUBMENU MENU_FILE "~File"

File diff suppressed because it is too large Load Diff

View File

@ -1,102 +1,7 @@
#include <applicat.h> #include <checks.h>
#include <mask.h>
#include <form.h> int cg1300(int argc, char* argv[])
#include <utility.h> {
#include <urldefid.h> error_box("Applicazione ancora da sviluppare");
return 1;
}
class TEdit_form : public TApplication
{
const char* _name;
TForm* _form;
protected:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG);
public:
TEdit_form(const char* name);
const char* name() const { return _name; }
};
TEdit_form::TEdit_form(const char* name)
: _name(name), _form(NULL)
{}
bool TEdit_form::create()
{
_form = new TForm(name());
dispatch_e_menu(MENU_ITEM(2));
return TRUE;
}
bool TEdit_form::destroy()
{
delete _form;
return TRUE;
}
bool TEdit_form::menu(MENU_TAG tag)
{
char sec = 'B';
switch(tag)
{
case MENU_ITEM(1):
sec = 'H'; break;
case MENU_ITEM(3):
sec = 'F'; break;
default:
break;
}
_form->edit(sec, odd_page);
return TRUE;
}
int cg1300(int argc, char* argv[])
{
TApplication::check_parameters(argc, argv);
if (argc < 3)
{
error_box("Specificare il nome del profilo di stampa");
return 1;
}
TFilename form(argv[2]); form.ext("frm");
const char mode = argc > 3 ? toupper(argv[3][1]) : 'M';
const bool crea = (mode == 'C') || !fexist(form);
if (crea)
{
TFilename base(form.left(3)); base.ext("frm");
if (!fexist(base))
{
error_box("Non esiste il file %s", (const char*)base);
return 1;
}
if (!fcopy(base, form))
{
error_box("Impossibile copiare %s in %s", (const char*)base, (const char*)form);
return 1;
}
}
if (!fexist(form))
{
error_box("Non esiste il file %s", (const char*)form);
return 1;
}
TEdit_form a(form);
TString80 title;
title << (crea ? "Creazione" : "Modifica") << ": " << a.name();
a.run(argc, argv, title);
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,323 +1,330 @@
#include <stdlib.h> #include <stdlib.h>
#include <xvtmacro.h> #include <xvtmacro.h>
#include <applicat.h> #include <applicat.h>
#include <tabutil.h> #include <tabutil.h>
#include "cg2101.h" #include "cg2101.h"
#include "cg2103.h" #include "cg2103.h"
#include <mov.h> #include <mov.h>
#include <rmov.h> #include <rmov.h>
#include <rmoviva.h> #include <rmoviva.h>
// Calcola l'anno di esercizio di una data // Calcola l'anno di esercizio di una data
// Certified 99% // Certified 99%
int date2esc(const TDate& d, int* prevesc) int date2esc(const TDate& d, int* prevesc)
{ {
if (prevesc) *prevesc = 0; if (prevesc) *prevesc = 0;
TTable esc("ESC"); TTable esc("ESC");
for (int err = esc.first(); err == NOERR; err = esc.next()) for (int err = esc.first(); err == NOERR; err = esc.next())
{ {
const TDate ia(esc.get("D0")); // Data inizio esercizio const TDate ia(esc.get("D0")); // Data inizio esercizio
const TDate fa(esc.get("D1")); // Data fine esercizio const TDate fa(esc.get("D1")); // Data fine esercizio
TString16 sanno(esc.get("CODTAB")); sanno.cut(4); TString16 sanno(esc.get("CODTAB")); sanno.cut(4);
const int anno = atoi(sanno); const int anno = atoi(sanno);
if (d >= ia && d <= fa) if (d >= ia && d <= fa)
return anno; return anno;
if (prevesc) *prevesc = anno; if (prevesc) *prevesc = anno;
} }
return 0; return 0;
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Movimento di prima nota // Movimento di prima nota
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TMovimentoPN::TMovimentoPN() TMovimentoPN::TMovimentoPN()
: TRelation(LF_MOV), _oldcg(0), _oldiva(0) : TRelation(LF_MOV), _oldcg(0), _oldiva(0)
{ {
add(LF_RMOV, "NUMREG=NUMREG"); add(LF_RMOV, "NUMREG=NUMREG");
add(LF_RMOVIVA, "NUMREG=NUMREG"); add(LF_RMOVIVA, "NUMREG=NUMREG");
} }
void TMovimentoPN::destroy_rows() void TMovimentoPN::destroy_rows()
{ {
_cg.destroy(); _cg.destroy();
_iva.destroy(); _iva.destroy();
} }
TRectype& TMovimentoPN::cg(int i) TRectype& TMovimentoPN::cg(int i)
{ {
TRectype* r = (TRectype*)_cg.objptr(i); TRectype* r = (TRectype*)_cg.objptr(i);
if (r == NULL) if (r == NULL)
{ {
r = new TRectype(LF_RMOV); r = new TRectype(LF_RMOV);
_cg.add(r, i); _cg.add(r, i);
} }
return *r; return *r;
} }
TRectype& TMovimentoPN::iva(int i) TRectype& TMovimentoPN::iva(int i)
{ {
TRectype* r = (TRectype*)_iva.objptr(i); TRectype* r = (TRectype*)_iva.objptr(i);
if (r == NULL) if (r == NULL)
{ {
r = new TRectype(LF_RMOVIVA); r = new TRectype(LF_RMOVIVA);
_iva.add(r, i); _iva.add(r, i);
} }
return *r; return *r;
} }
int TMovimentoPN::read_mov_rows() int TMovimentoPN::read_mov_rows()
{ {
const TLocalisamfile& rm = lfile(LF_RMOV); const TLocalisamfile& rm = lfile(LF_RMOV);
const TLocalisamfile& ri = lfile(LF_RMOVIVA); const TLocalisamfile& ri = lfile(LF_RMOVIVA);
position_rels(); position_rels();
destroy_rows(); destroy_rows();
for(bool ok = is_first_match(LF_RMOV); ok; ok = next_match(LF_RMOV)) for(bool ok = is_first_match(LF_RMOV); ok; ok = next_match(LF_RMOV))
{ {
const int row = rm.get_int(RMV_NUMRIG) - 1; const int row = rm.get_int(RMV_NUMRIG) - 1;
cg(row) = rm.curr(); cg(row) = rm.curr();
} }
_oldcg = cg_items(); _oldcg = cg_items();
for(ok = is_first_match(LF_RMOVIVA); ok; ok = next_match(LF_RMOVIVA)) for(ok = is_first_match(LF_RMOVIVA); ok; ok = next_match(LF_RMOVIVA))
{ {
const int row = ri.get_int(RMI_NUMRIG) - 1; const int row = ri.get_int(RMI_NUMRIG) - 1;
iva(row) = ri.curr(); iva(row) = ri.curr();
} }
_oldiva = iva_items(); _oldiva = iva_items();
return NOERR; return NOERR;
} }
int TMovimentoPN::read(TIsamop op, TReclock lockop, TDate& atdate) int TMovimentoPN::read(TIsamop op, TReclock lockop, TDate& atdate)
{ {
int err = file().read(op, lockop, atdate); int err = file().read(op, lockop, atdate);
if (err == NOERR) if (err == NOERR)
{ {
_olddate = file().get("DATAREG"); _olddate = file().get("DATAREG");
err = read_mov_rows(); err = read_mov_rows();
} }
return err; return err;
} }
int TMovimentoPN::write_rec(bool re, const TRectype& rec, TLocalisamfile& f) int TMovimentoPN::write_rec(bool re, const TRectype& rec, TLocalisamfile& f)
{ {
const bool scrivi = re ? (f.rewrite(rec) != NOERR) : TRUE; const bool scrivi = re ? (f.rewrite(rec) != NOERR) : TRUE;
if (scrivi) if (scrivi)
f.write(rec); f.write(rec);
return f.status(); #ifdef TRC
} const long numreg = rec.get_long("NUMREG");
const int numrig = f.num() == LF_MOV ? 0 : rec.get_int("NUMRIG");
TRACE("write file=%d record=%ld nummov=%ld numrig=%d status=%d",
int TMovimentoPN::cancella(TLocalisamfile& f, int da, int a) f.num(), f.recno(), numreg, numrig, f.status());
{ #endif
const long numreg = lfile().get_long(MOV_NUMREG);
for (int i = da; i <= a; i++) return f.status();
{ }
f.put(MOV_NUMREG, numreg);
f.put(RMV_NUMRIG, i);
if (f.read(_isequal, _lock) == NOERR) int TMovimentoPN::cancella(TLocalisamfile& f, int da, int a)
f.remove(); {
} const long numreg = lfile().get_long(MOV_NUMREG);
return f.status(); for (int i = da; i <= a; i++)
} {
f.put(MOV_NUMREG, numreg);
char TMovimentoPN::frequenza_versamenti(int year) const f.put(RMV_NUMRIG, i);
{ if (f.read(_isequal, _lock) == NOERR)
static int last_year = 0; f.remove();
static char last_freq = ' '; }
return f.status();
if (year != last_year) }
{
TString16 key; char TMovimentoPN::frequenza_versamenti(int year) const
key << year; {
TTable lia("LIA"); static int last_year = 0;
lia.setkey(1); static char last_freq = ' ';
lia.put("CODTAB", key);
if (lia.read() != NOERR) if (year != last_year)
{ {
TLocalisamfile nditte(LF_NDITTE); TString16 key;
nditte.setkey(1); key << year;
nditte.put("CODDITTA", main_app().get_firm()); TTable lia("LIA");
nditte.read(); lia.setkey(1);
last_freq = nditte.get_char("FREQVIVA"); lia.put("CODTAB", key);
} if (lia.read() != NOERR)
else {
last_freq = lia.get_char("S7"); TLocalisamfile nditte(LF_NDITTE);
CHECK(last_freq == 'M' || last_freq == 'T', "Frequenza versamenti IVA assurda"); nditte.setkey(1);
} nditte.put("CODDITTA", main_app().get_firm());
nditte.read();
return last_freq; last_freq = nditte.get_char("FREQVIVA");
} }
else
int TMovimentoPN::date2liq(const TDate& data) const last_freq = lia.get_char("S7");
{ CHECK(last_freq == 'M' || last_freq == 'T', "Frequenza versamenti IVA assurda");
const int anno = data.year(); }
int mese = data.month();
if (frequenza_versamenti(anno) == 'T') return last_freq;
mese += 2 - ((mese-1) % 3); }
return mese;
} int TMovimentoPN::date2liq(const TDate& data) const
{
const int anno = data.year();
bool TMovimentoPN::controlla_liquidazione(const TDate& data, bool reset) const int mese = data.month();
{ if (frequenza_versamenti(anno) == 'T')
bool calcolata = FALSE; mese += 2 - ((mese-1) % 3);
return mese;
const int anno = data.year(); }
const int mese = date2liq(data);
// Chiave di LIM: Anno (1-4), Mese (5-6) bool TMovimentoPN::controlla_liquidazione(const TDate& data, bool reset) const
TString16 key; {
key << anno << mese; bool calcolata = FALSE;
TTable lim("LIM");
lim.setkey(1); const int anno = data.year();
lim.put("CODTAB", key); const int mese = date2liq(data);
if (lim.read() == NOERR)
calcolata = lim.get_bool("B1"); // Controlla se calcolata in definitivo // Chiave di LIM: Anno (1-4), Mese (5-6)
TString16 key;
if (reset && lim.get_bool("B0")) key << anno << mese;
{ TTable lim("LIM");
// Resetta i flag di calcolato sulla liquidazione IVA del mese di registrazione lim.setkey(1);
lim.put("B0", FALSE); // calcolato lim.put("CODTAB", key);
lim.put("B1", FALSE); // definitivo if (lim.read() == NOERR)
lim.rewrite(); calcolata = lim.get_bool("B1"); // Controlla se calcolata in definitivo
}
if (reset && lim.get_bool("B0"))
return calcolata; {
} // Resetta i flag di calcolato sulla liquidazione IVA del mese di registrazione
lim.put("B0", FALSE); // calcolato
lim.put("B1", FALSE); // definitivo
int TMovimentoPN::registra(bool re, bool force) lim.rewrite();
{ }
TLocalisamfile& m = lfile();
return calcolata;
const int err = write_rec(re, m.curr(), m); }
if (err != NOERR) return err;
TLocalisamfile& rm = lfile(LF_RMOV); int TMovimentoPN::registra(bool re, bool force)
TLocalisamfile& ri = lfile(LF_RMOVIVA); {
TLocalisamfile& m = lfile();
const long numreg = m.get_long("NUMREG");
const int err = write_rec(re, m.curr(), m);
for (int i = 0 ; i < cg_items(); i++) if (err != NOERR) return err;
{
if (!re) cg(i).put("NUMREG", numreg); TLocalisamfile& rm = lfile(LF_RMOV);
const int err = write_rec(re, cg(i), rm); TLocalisamfile& ri = lfile(LF_RMOVIVA);
if (!force && err != NOERR) return err;
} const long numreg = m.get_long("NUMREG");
if (i < _oldcg)
cancella(rm, i+1, _oldcg); for (int i = 0 ; i < cg_items(); i++)
_oldcg = cg_items(); {
if (!re) cg(i).put("NUMREG", numreg);
const int err = write_rec(re, cg(i), rm);
const int annoiva = m.get_int("ANNOIVA"); if (!force && err != NOERR) return err;
const TString16 reg(m.get("REG")); }
TRegistro registro(reg, annoiva); if (i < _oldcg)
const bool att_mista = reg.empty() ? FALSE : registro.attivita_mista(); cancella(rm, i+1, _oldcg);
_oldcg = cg_items();
for (i = 0 ; i < iva_items(); i++)
{
TRectype& r = iva(i); const int annoiva = m.get_int("ANNOIVA");
const TString16 reg(m.get("REG"));
if (!re) r.put("NUMREG", numreg); // Force correct number TRegistro registro(reg, annoiva);
const bool att_mista = reg.empty() ? FALSE : registro.attivita_mista();
int tipoatt = 1;
if (att_mista) for (i = 0 ; i < iva_items(); i++)
{ {
const char tipo = r.get_char("TIPOC"); TRectype& r = iva(i);
if (tipo <= ' ')
{ if (!re) r.put("NUMREG", numreg); // Force correct number
TBill c(r.get_int("GRUPPO"), r.get_int("CONTO"), r.get_long("SOTTOCONTO"));
tipoatt = c.tipo_att(); int tipoatt = 1;
} if (att_mista)
} {
r.put("TIPOATT", tipoatt); const char tipo = r.get_char("TIPOC");
if (tipo <= ' ')
const int err = write_rec(re, r, ri); {
if (!force && err != NOERR) return err; TBill c(r.get_int("GRUPPO"), r.get_int("CONTO"), r.get_long("SOTTOCONTO"));
} tipoatt = c.tipo_att();
}
if (i < _oldiva) }
cancella(ri, i+1, _oldiva); r.put("TIPOATT", tipoatt);
_oldiva = iva_items();
const int err = write_rec(re, r, ri);
// Aggiorna data registrazione e protocollo IVA sul registro if (!force && err != NOERR) return err;
const TDate datareg(m.get("DATAREG")); }
if (reg.not_empty())
{ if (i < _oldiva)
const long protiva = m.get_long("PROTIVA"); cancella(ri, i+1, _oldiva);
const long uprotiva = m.get_long("UPROTIVA"); _oldiva = iva_items();
registro.update(max(protiva, uprotiva), datareg);
} // Aggiorna data registrazione e protocollo IVA sul registro
const TDate datareg(m.get("DATAREG"));
// Aggiorna flags di ricalcolo liquidazione if (reg.not_empty())
{
controlla_liquidazione(datareg, TRUE); const long protiva = m.get_long("PROTIVA");
if (re && datareg != _olddate) const long uprotiva = m.get_long("UPROTIVA");
controlla_liquidazione(_olddate, TRUE); registro.update(max(protiva, uprotiva), datareg);
}
const int att = att_mista ? 2 : 1;
// Chiave di PLM: Anno (1-4), Cod. Att. (5-9), Tipo att. (10-10), Mese (11-12) // Aggiorna flags di ricalcolo liquidazione
TTable plm("PLM");
plm.setkey(1); controlla_liquidazione(datareg, TRUE);
for (int a = 1; a <= att; a++) if (re && datareg != _olddate)
{ controlla_liquidazione(_olddate, TRUE);
TString16 chiave;
chiave << annoiva << registro.attivita() << a << date2liq(datareg); const int att = att_mista ? 2 : 1;
plm.put("CODTAB", chiave); // Chiave di PLM: Anno (1-4), Cod. Att. (5-9), Tipo att. (10-10), Mese (11-12)
if (plm.read() == NOERR) TTable plm("PLM");
{ plm.setkey(1);
const bool calcolato = plm.get_bool("B0"); for (int a = 1; a <= att; a++)
if (calcolato) {
{ TString16 chiave;
plm.put("B0", FALSE); chiave << annoiva << registro.attivita() << a << date2liq(datareg);
plm.rewrite(); plm.put("CODTAB", chiave);
} if (plm.read() == NOERR)
} {
} const bool calcolato = plm.get_bool("B0");
if (calcolato)
return err; {
} plm.put("B0", FALSE);
plm.rewrite();
}
int TMovimentoPN::write(bool force, TDate&) }
{ }
const TRectype& r = lfile().curr();
return err;
_oldcg = _oldiva = 0; }
int err = registra(FALSE, force);
return err; int TMovimentoPN::write(bool force, TDate&)
} {
const TRectype& r = lfile().curr();
int TMovimentoPN::rewrite(bool force, TDate&) _oldcg = _oldiva = 0;
{ int err = registra(FALSE, force);
return registra(TRUE, force);
} return err;
}
int TMovimentoPN::remove(TDate&)
{ int TMovimentoPN::rewrite(bool force, TDate&)
TLocalisamfile& m = lfile(); {
TLocalisamfile& rm = lfile(LF_RMOV); return registra(TRUE, force);
TLocalisamfile& ri = lfile(LF_RMOVIVA); }
cancella(rm, 1, _oldcg);
cancella(ri, 1, _oldiva); int TMovimentoPN::remove(TDate&)
m.remove(); {
_oldcg = _oldiva = 0; TLocalisamfile& m = lfile();
return m.status(); TLocalisamfile& rm = lfile(LF_RMOV);
} TLocalisamfile& ri = lfile(LF_RMOVIVA);
cancella(rm, 1, _oldcg);
cancella(ri, 1, _oldiva);
m.remove();
_oldcg = _oldiva = 0;
return m.status();
}

View File

@ -1,266 +1,267 @@
PAGE "RIGA IVA" -1 -1 78 13 PAGE "RIGA IVA" -1 -1 78 13
GROUPBOX DLG_NULL 76 5 GROUPBOX DLG_NULL 76 5
BEGIN BEGIN
PROMPT 1 1 "@BImposta" PROMPT 1 1 "@BImposta"
END END
STRING 102 4 STRING 102 4
BEGIN BEGIN
PROMPT 2 2 "IVA " PROMPT 2 2 "IVA "
HELP "Codice IVA della riga" HELP "Codice IVA della riga"
FLAGS "U" FLAGS "U"
USE %IVA USE %IVA
INPUT CODTAB 102 INPUT CODTAB 102
DISPLAY "Codice" CODTAB DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0 DISPLAY "Descrizione@50" S0
DISPLAY "%@6" R0 DISPLAY "%@6" R0
DISPLAY "Tipo" S1 DISPLAY "Tipo" S1
OUTPUT 102 CODTAB OUTPUT 102 CODTAB
OUTPUT 211 S0 OUTPUT 211 S0
CHECKTYPE NORMAL CHECKTYPE NORMAL
WARNING "Codice IVA assente" WARNING "Codice IVA assente"
VALIDATE ZEROFILL_FUNC 2 VALIDATE ZEROFILL_FUNC 2
END END
STRING 211 58 STRING 211 58
BEGIN BEGIN
PROMPT 16 2 "" PROMPT 16 2 ""
FLAGS "D" FLAGS "D"
END END
NUMBER 103 1 NUMBER 103 1
BEGIN BEGIN
PROMPT 2 3 "Detraibilita' " PROMPT 2 3 "Detraibilita' "
HELP "Indicare il tipo di detraibilita' della riga" HELP "Indicare il tipo di detraibilita' della riga"
SHEET "Codice|Tipo detraibilita'@75" SHEET "Codice|Tipo detraibilita'@75"
INPUT 103 INPUT 103
ITEM " |Regime normale" ITEM " |Regime normale"
ITEM "1|IVA indetraibile su acquisti riferiti a ricavi esenti" ITEM "1|IVA indetraibile su acquisti riferiti a ricavi esenti"
ITEM "3|IVA indicata per passaggi interni al solo fine del calcolo di ventilazione" ITEM "3|IVA indicata per passaggi interni al solo fine del calcolo di ventilazione"
ITEM "9|IVA non detraibile per l'articolo 19" ITEM "9|IVA non detraibile per l'articolo 19"
OUTPUT 103 OUTPUT 103
OUTPUT 130 OUTPUT 130
END END
STRING 130 75 52 STRING 130 75 52
BEGIN BEGIN
PROMPT 22 3 "" PROMPT 22 3 ""
FLAGS "D" FLAGS "D"
END END
NUMBER 101 15 NUMBER 101 15
BEGIN BEGIN
PROMPT 2 4 "Imponibile " PROMPT 2 4 "Imponibile "
HELP "Importo imponibile" HELP "Importo imponibile"
FLAGS "RV" FLAGS "RV"
PICTURE "." PICTURE "."
END END
NUMBER 104 15 NUMBER 104 15
BEGIN BEGIN
PROMPT 48 4 "Imposta " PROMPT 48 4 "Imposta "
HELP "Importo dell'IVA. Se e' nullo, col tasto F8 si puo' effettuare lo scorporo" HELP "Importo dell'IVA. Se e' nullo, col tasto F8 si puo' effettuare lo scorporo"
FLAGS "RV" FLAGS "RV"
PICTURE "." PICTURE "."
END END
GROUPBOX DLG_NULL 76 5 GROUPBOX DLG_NULL 76 5
BEGIN BEGIN
PROMPT 1 6 "@BConto" PROMPT 1 6 "@BConto"
END END
LIST 106 1 12 LIST 106 1 12
BEGIN BEGIN
PROMPT 2 7 "Tipo " PROMPT 2 7 "Tipo "
HELP "Tipo del conto" HELP "Tipo del conto"
FIELD TMCF FIELD TMCF
ITEM " |Conto" ITEM " |Conto"
MESSAGE SHOW,109|HIDE,209|HIDE,309|SHOW,110|HIDE,210|HIDE,310 MESSAGE SHOW,109|HIDE,209|HIDE,309|SHOW,110|HIDE,210|HIDE,310
ITEM "C|Cliente" ITEM "C|Cliente"
MESSAGE SHOW,209|HIDE,109|HIDE,309|SHOW,210|HIDE,110|HIDE,310 MESSAGE SHOW,209|HIDE,109|HIDE,309|SHOW,210|HIDE,110|HIDE,310
ITEM "F|Fornitore" ITEM "F|Fornitore"
MESSAGE SHOW,309|HIDE,109|HIDE,209|SHOW,310|HIDE,110|HIDE,210 MESSAGE SHOW,309|HIDE,109|HIDE,209|SHOW,310|HIDE,110|HIDE,210
FLAGS "U" FLAGS "U"
END END
NUMBER 107 3 NUMBER 107 3
BEGIN BEGIN
PROMPT 22 7 "Gruppo " PROMPT 22 7 "Gruppo "
HELP "Codice del gruppo" HELP "Codice del gruppo"
FIELD GRUPPO FIELD GRUPPO
END END
NUMBER 108 3 NUMBER 108 3
BEGIN BEGIN
PROMPT 38 7 "Conto " PROMPT 38 7 "Conto "
HELP "Codice del conto" HELP "Codice del conto"
FIELD CONTO FIELD CONTO
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="")
INPUT GRUPPO 107 INPUT GRUPPO 107
INPUT CONTO 108 INPUT CONTO 108
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
DISPLAY "Tipo" TMCF DISPLAY "Tipo" TMCF
OUTPUT 106 TMCF OUTPUT 106 TMCF
OUTPUT 107 GRUPPO OUTPUT 107 GRUPPO
OUTPUT 108 CONTO OUTPUT 108 CONTO
OUTPUT 110 DESCR OUTPUT 110 DESCR
ADD RUN cg0 -0 ADD RUN cg0 -0
MESSAGE DIRTY,109|DIRTY,209|DIRTY,309 MESSAGE DIRTY,109|DIRTY,209|DIRTY,309
CHECKTYPE NORMAL CHECKTYPE NORMAL
WARNING "Conto assente" WARNING "Conto assente"
END END
NUMBER 109 6 NUMBER 109 6
BEGIN BEGIN
PROMPT 55 7 "Sottoconto " PROMPT 55 7 "Sottoconto "
HELP "Codice del sottoconto" HELP "Codice del sottoconto"
FIELD SOTTOCONTO FIELD SOTTOCONTO
USE LF_PCON SELECT SOTTOCONTO!="" USE LF_PCON SELECT SOTTOCONTO!=""
INPUT GRUPPO 107 INPUT GRUPPO 107
INPUT CONTO 108 INPUT CONTO 108
INPUT SOTTOCONTO 109 INPUT SOTTOCONTO 109
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
DISPLAY "C/R" TIPOSPRIC DISPLAY "C/R" TIPOSPRIC
OUTPUT 109 SOTTOCONTO OUTPUT 109 SOTTOCONTO
OUTPUT 107 GRUPPO OUTPUT 107 GRUPPO
OUTPUT 108 CONTO OUTPUT 108 CONTO
OUTPUT 110 DESCR OUTPUT 110 DESCR
ADD RUN cg0 -0 ADD RUN cg0 -0
CHECKTYPE NORMAL CHECKTYPE NORMAL
VALIDATE REQIF_FUNC 1 101 VALIDATE REQIF_FUNC 1 101
WARNING "Sottoconto assente" WARNING "Sottoconto assente"
END END
NUMBER 209 6 NUMBER 209 6
BEGIN BEGIN
PROMPT 55 7 "Cliente " PROMPT 55 7 "Cliente "
HELP "Codice del cliente" HELP "Codice del cliente"
USE LF_CLIFO USE LF_CLIFO
INPUT TIPOCF "C" INPUT TIPOCF "C"
INPUT CODCF 209 INPUT CODCF 209
DISPLAY "Codice" CODCF DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale Cliente@50" RAGSOC DISPLAY "Ragione Sociale Cliente@50" RAGSOC
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
OUTPUT 209 CODCF OUTPUT 209 CODCF
OUTPUT 210 RAGSOC OUTPUT 210 RAGSOC
CHECKTYPE NORMAL CHECKTYPE NORMAL
ADD RUN cg0 -1 ADD RUN cg0 -1
MESSAGE COPY,109 MESSAGE COPY,109
VALIDATE REQIF_FUNC 1 101 VALIDATE REQIF_FUNC 1 101
WARNING "Cliente assente" WARNING "Cliente assente"
END END
NUMBER 309 6 NUMBER 309 6
BEGIN BEGIN
PROMPT 55 7 "Fornitore " PROMPT 55 7 "Fornitore "
HELP "Codice del fornitore" HELP "Codice del fornitore"
USE LF_CLIFO USE LF_CLIFO
INPUT TIPOCF "F" INPUT TIPOCF "F"
INPUT CODCF 309 INPUT CODCF 309
DISPLAY "Codice" CODCF DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale Fornitore@50" RAGSOC DISPLAY "Ragione Sociale Fornitore@50" RAGSOC
OUTPUT 107 GRUPPO OUTPUT 107 GRUPPO
OUTPUT 108 CONTO OUTPUT 108 CONTO
OUTPUT 309 CODCF OUTPUT 309 CODCF
OUTPUT 310 RAGSOC OUTPUT 310 RAGSOC
CHECKTYPE NORMAL CHECKTYPE NORMAL
ADD RUN cg0 -1 ADD RUN cg0 -1
MESSAGE COPY,109 MESSAGE COPY,109
VALIDATE REQIF_FUNC 1 101 VALIDATE REQIF_FUNC 1 101
WARNING "Fornitore assente" WARNING "Fornitore assente"
END END
STRING 110 50 STRING 110 50
BEGIN BEGIN
PROMPT 2 8 "Descrizione " PROMPT 2 8 "Descrizione "
HELP "Descrizione del conto" HELP "Descrizione del conto"
FIELD LF_PCON->DESCR FIELD LF_PCON->DESCR
USE LF_PCON KEY 2 USE LF_PCON KEY 2
INPUT DESCR 110 INPUT DESCR 110
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT 109 COPY OUTPUT 109
CHECKTYPE NORMAL CHECKTYPE NORMAL
ADD RUN cg0 -0 ADD RUN cg0 -0
END END
STRING 210 50 STRING 210 50
BEGIN BEGIN
PROMPT 2 8 "Cliente " PROMPT 2 8 "Cliente "
HELP "Ragione sociale del cliente" HELP "Ragione sociale del cliente"
FIELD LF_CLIFO->RAGSOC FIELD LF_CLIFO->RAGSOC
USE LF_CLIFO KEY 2 USE LF_CLIFO KEY 2
INPUT TIPOCF "C" INPUT TIPOCF "C"
INPUT RAGSOC 210 INPUT RAGSOC 210
DISPLAY "Ragione Sociale Cliente@50" RAGSOC DISPLAY "Ragione Sociale Cliente@50" RAGSOC
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Codice" CODCF DISPLAY "Codice" CODCF
COPY OUTPUT 209 COPY OUTPUT 209
MESSAGE COPY,110 MESSAGE COPY,110
ADD RUN cg0 -1 ADD RUN cg0 -1
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
STRING 310 50 STRING 310 50
BEGIN BEGIN
PROMPT 2 8 "Fornitore " PROMPT 2 8 "Fornitore "
HELP "Ragione sociale del forntore" HELP "Ragione sociale del forntore"
FIELD LF_PCON->SOTTOCONTO FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO KEY 2 USE LF_CLIFO KEY 2
INPUT TIPOCF "F" INPUT TIPOCF "F"
INPUT RAGSOC 310 INPUT RAGSOC 310
DISPLAY "Ragione Sociale Fornitore@50" RAGSOC DISPLAY "Ragione Sociale Fornitore@50" RAGSOC
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Codice" CODCF DISPLAY "Codice" CODCF
COPY OUTPUT 309 COPY OUTPUT 309
MESSAGE COPY,110 MESSAGE COPY,110
ADD RUN cg0 -1 ADD RUN cg0 -1
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
LIST 105 1 53 LIST 105 1 53
BEGIN BEGIN
PROMPT 2 9 "Tipo Costo/Ricavo " PROMPT 2 9 "Tipo Costo/Ricavo "
ITEM " |0. Acquisti o vendite in genere" ITEM " |0. Acquisti o vendite in genere"
ITEM "1|1. Acquisti beni per rivendita" ITEM "1|1. Acquisti beni per rivendita"
ITEM "2|2. Acquisti beni ammortizzabili" ITEM "2|2. Acquisti beni ammortizzabili"
ITEM "3|3. Acquisti beni ammortizzabili con detr. 6%" ITEM "3|3. Acquisti beni ammortizzabili con detr. 6%"
ITEM "4|4. Vendita beni strumentali art. 17" ITEM "4|4. Vendita beni strumentali art. 17"
ITEM "5|5. Beni per rivendita da non ventilare" ITEM "5|5. Beni per rivendita da non ventilare"
ITEM "8|8. Altri beni strumentali acquistati in leasing" ITEM "8|8. Altri beni strumentali acquistati in leasing"
FLAGS "D" ITEM "9|9. Spese generali"
HELP "Tipo Costo/Ricavo del conto" FLAGS "D"
END HELP "Tipo Costo/Ricavo del conto"
END
BUTTON DLG_OK 9 2
BEGIN BUTTON DLG_OK 9 2
PROMPT -13 -1 "" BEGIN
END PROMPT -13 -1 ""
END
BUTTON DLG_CANCEL 9 2
BEGIN BUTTON DLG_CANCEL 9 2
PROMPT -23 -1 "" BEGIN
END PROMPT -23 -1 ""
END
BUTTON DLG_DELREC 9 2
BEGIN BUTTON DLG_DELREC 9 2
PROMPT -33 -1 "Elimina" BEGIN
MESSAGE EXIT,K_DEL PROMPT -33 -1 "Elimina"
END MESSAGE EXIT,K_DEL
END
ENDPAGE
ENDPAGE
ENDMASK
ENDMASK

View File

@ -1,423 +1,423 @@
// Rinumerazione movimenti e saldi // Rinumerazione movimenti e saldi
// fv 12/12/93 // fv 12/12/93
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// *TBI* Partenza dall'ultimo movimento stampato // *TBI* Partenza dall'ultimo movimento stampato
// *TBI* Aggiornamento scadenziario // *TBI* Aggiornamento scadenziario
// *TBI* Aggiornamento cespiti // *TBI* Aggiornamento cespiti
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
#include <stdlib.h> #include <signal.h>
//#if XVT_OS == XVT_OS_SCOUNIX #include <stdlib.h>
#include <signal.h>
//#endif #include <applicat.h>
#include <isam.h>
#include <applicat.h> #include <mask.h>
#include <isam.h> #include <progind.h>
#include <mask.h> #include <sort.h>
#include <progind.h> #include <urldefid.h>
#include <sort.h> #include <utility.h>
#include <urldefid.h>
#include <utility.h> #define FLD_CG41_YEAR 100
#define MAX_CNT 300
#define FLD_CG41_YEAR 100
#define MAX_CNT 300 #include <mov.h>
#include <rmov.h>
#include <mov.h> #include <rmoviva.h>
#include <rmov.h> #include <saldi.h>
#include <rmoviva.h> #include <causali.h>
#include <saldi.h>
#include <causali.h> #include "cglib.h"
#include "cglib.h" struct therec {
char DATAREG[9];
struct therec { char REG[4];
char DATAREG[9]; char DATADOC[9];
char REG[4]; char NUMPROT[9];
char DATADOC[9]; char ANNOES[5];
char NUMPROT[9]; char NUMREG[8];
char ANNOES[5]; };
char NUMREG[8];
}; class CG4100_App : public TApplication
{
class CG4100_App : public TApplication TString _year;
{ char _optype;
TString _year; TMask* _msk;
char _optype;
public:
public:
virtual bool create();
virtual bool create(); virtual bool destroy();
virtual bool destroy();
bool set_parms();
bool set_parms(); virtual bool menu(MENU_TAG m);
virtual bool menu(MENU_TAG m);
void restore_mov(TSystemisamfile& a, TSystemisamfile& b, TSystemisamfile& c);
void restore_mov(TSystemisamfile& a, TSystemisamfile& b, TSystemisamfile& c); void sort_all();
void sort_all(); bool sort_mov();
bool sort_mov(); bool sort_sal();
bool sort_sal();
CG4100_App() : TApplication(), _year(4), _optype('S') {}
CG4100_App() : TApplication(), _year(4), _optype('S') {} virtual ~CG4100_App() {}
virtual ~CG4100_App() {} };
};
bool CG4100_App::create()
bool CG4100_App::create() {
{ TApplication::create();
TApplication::create();
// UNIX: signal() per intercettare errori
// UNIX: signal() per intercettare errori #if XVT_OS == XVT_OS_SCOUNIX
#if XVT_OS == XVT_OS_SCOUNIX signal(SIGINT,SIG_IGN);
signal(SIGINT,SIG_IGN); #endif
#endif
if (fexist("__sal__.sav"))
if (fexist("__sal__.sav")) warning_box("Un'operazione di riordino saldi si e' conclusa"
warning_box("Un'operazione di riordino saldi si e' conclusa" " impropriamente. Si raccomanda di rieseguirla");
" impropriamente. Si raccomanda di rieseguirla");
if (fexist("__mov__.sav"))
if (fexist("__mov__.sav")) warning_box("Un'operazione di riordino movimenti si e' conclusa"
warning_box("Un'operazione di riordino movimenti si e' conclusa" " impropriamente. Si raccomanda di rieseguirla");
" impropriamente. Si raccomanda di rieseguirla");
if (argc() > 2) if (argc() > 2)
_optype = toupper(argv(2)[0]); _optype = toupper(argv(2)[0]);
dispatch_e_menu(MENU_ITEM(1));
return TRUE; _msk = new TMask(_optype == 'S' ? "cg4100b" : "cg4100a");
}
dispatch_e_menu(MENU_ITEM(1));
bool CG4100_App::destroy() return TRUE;
{ }
// UNIX: resettare i segnali
#if XVT_OS == XVT_OS_SCOUNIX bool CG4100_App::destroy()
signal(SIGINT,SIG_DFL); {
#endif // UNIX: resettare i segnali
#if XVT_OS == XVT_OS_SCOUNIX
return TApplication::destroy(); signal(SIGINT,SIG_DFL);
} #endif
delete _msk;
bool CG4100_App::set_parms() return TApplication::destroy();
{ }
const bool saldi = _optype == 'S';
TMask m(saldi ? "cg4100b" : "cg4100a"); bool CG4100_App::set_parms()
{
m.run(); _msk->run();
if (saldi) if (_optype == 'S')
_year = m.get(FLD_CG41_YEAR); _year = _msk->get(FLD_CG41_YEAR);
else else
_year = 0; _year = 0;
return m.last_key() == K_ENTER; return _msk->last_key() == K_ENTER;
} }
bool CG4100_App::menu(MENU_TAG m) bool CG4100_App::menu(MENU_TAG)
{ {
if (_optype == 'S') if (_optype == 'S')
sort_sal(); sort_sal();
else else
if (_optype == 'M') sort_mov();
sort_mov();
return FALSE; return FALSE;
} }
void CG4100_App::restore_mov(TSystemisamfile& mov, TSystemisamfile& rmov, void CG4100_App::restore_mov(TSystemisamfile& mov, TSystemisamfile& rmov,
TSystemisamfile& rmoviva) TSystemisamfile& rmoviva)
{ {
long rn, rec; long rn, rec;
if (fexist("__mov__.ind")) if (fexist("__mov__.ind"))
{ {
// rebuild all indexes // rebuild all indexes
mov.close(); rmov.close(); rmoviva.close(); mov.close(); rmov.close(); rmoviva.close();
mov.packfile(); rmov.packfile(); rmoviva.packfile(); mov.packfile(); rmov.packfile(); rmoviva.packfile();
mov.packindex(); rmov.packindex(); rmoviva.packindex(); mov.packindex(); rmov.packindex(); rmoviva.packindex();
remove("__mov__.ind"); remove("__mov__.ind");
return; return;
} }
FILE* fp = fopen("__mov__.sav","r"); FILE* fp = fopen("__mov__.sav","r");
if (feof(fp)) if (feof(fp))
{ {
warning_box("File di ripristino vuoto; il ripristino non e' necessario"); warning_box("File di ripristino vuoto; il ripristino non e' necessario");
remove("__mov__.sav"); remove("__mov__.sav");
return; return;
}; };
for (;;) for (;;)
{ {
if (feof(fp)) break; if (feof(fp)) break;
fscanf(fp,"%ld %ld", &rn, &rec); fscanf(fp,"%ld %ld", &rn, &rec);
mov.readat(rec); mov.readat(rec);
mov.put(MOV_NUMREG,rn); mov.put(MOV_NUMREG,rn);
mov.rewrite(); mov.rewrite();
for (;;) for (;;)
{ {
if (feof(fp)) break; if (feof(fp)) break;
fscanf(fp,"%ld",&rec); fscanf(fp,"%ld",&rec);
if (rec == -1l) break; if (rec == -1l) break;
rmov.readat(rec); rmov.readat(rec);
rmov.put(RMV_NUMREG,rn); rmov.put(RMV_NUMREG,rn);
rmov.rewrite(); rmov.rewrite();
} }
for (;;) for (;;)
{ {
if (feof(fp)) break; if (feof(fp)) break;
fscanf(fp,"%ld",&rec); fscanf(fp,"%ld",&rec);
if (rec == -1l) break; if (rec == -1l) break;
rmoviva.readat(rec); rmoviva.readat(rec);
rmoviva.put(RMI_NUMREG,rn); rmoviva.put(RMI_NUMREG,rn);
rmoviva.rewrite(); rmoviva.rewrite();
} }
} }
fclose(fp); fclose(fp);
remove("__mov__.sav"); remove("__mov__.sav");
} }
bool CG4100_App::sort_mov() bool CG4100_App::sort_mov()
{ {
if (!set_parms()) if (!set_parms())
return FALSE; return FALSE;
TSystemisamfile mov(LF_MOV); TSystemisamfile mov(LF_MOV);
TSystemisamfile rmov(LF_RMOV); TSystemisamfile rmov(LF_RMOV);
TSystemisamfile rmoviva(LF_RMOVIVA); TSystemisamfile rmoviva(LF_RMOVIVA);
if (mov.open(_excllock) || rmov.open(_excllock) || if (mov.open(_excllock) || rmov.open(_excllock) ||
rmoviva.open(_excllock)) rmoviva.open(_excllock))
{ {
warning_box("Gli archivi sono in uso. Operazione interrotta"); warning_box("Gli archivi sono in uso. Operazione interrotta");
return FALSE; return FALSE;
} }
mov.indexoff(); rmov.indexoff(); rmoviva.indexoff(); mov.indexoff(); rmov.indexoff(); rmoviva.indexoff();
mov.first(); mov.first();
TSort sort(sizeof(struct therec)); TSort sort(sizeof(struct therec));
if (fexist("__mov__.sav") || fexist("__mov__.ind")) if (fexist("__mov__.sav") || fexist("__mov__.ind"))
{ {
// previous operation failed // previous operation failed
if (yesno_box("Un riordinamento precedente e' fallito.\n" if (yesno_box("Un riordinamento precedente e' fallito.\n"
" Ripristino la situazione iniziale ora?" )) " Ripristino la situazione iniziale ora?" ))
restore_mov(mov, rmov, rmoviva); restore_mov(mov, rmov, rmoviva);
else return FALSE; else return FALSE;
} }
therec rbuf; therec rbuf;
sort.addsortkey(rbuf.DATAREG - (char*)&rbuf, 8); sort.addsortkey(rbuf.DATAREG - (char*)&rbuf, 8);
sort.addsortkey(rbuf.REG - (char*)&rbuf, 3); sort.addsortkey(rbuf.REG - (char*)&rbuf, 3);
sort.addsortkey(rbuf.NUMPROT - (char*)&rbuf, 8); sort.addsortkey(rbuf.NUMPROT - (char*)&rbuf, 8);
sort.addsortkey(rbuf.DATADOC - (char*)&rbuf, 8); sort.addsortkey(rbuf.DATADOC - (char*)&rbuf, 8);
sort.addsortkey(rbuf.NUMREG - (char*)&rbuf, 7); sort.addsortkey(rbuf.NUMREG - (char*)&rbuf, 7);
sort.init(); sort.init();
TProgind prnd(mov.items(), TProgind prnd(mov.items(),
"Riordino archivio movimenti in corso\nOrdinamento file movimenti...", "Riordino archivio movimenti in corso\nOrdinamento file movimenti...",
FALSE,TRUE,30); FALSE,TRUE,30);
TString16 s; TString16 s;
while (!mov.eof()) while (!mov.eof())
{ {
do_events(); do_events();
TDate d(mov.get(MOV_DATAREG)); TDate d(mov.get(MOV_DATAREG));
strcpy(rbuf.DATAREG, d.string(ANSI)); strcpy(rbuf.DATAREG, d.string(ANSI));
strcpy(rbuf.REG, mov.get(MOV_REG)); strcpy(rbuf.REG, mov.get(MOV_REG));
d = mov.get(MOV_DATADOC); d = mov.get(MOV_DATADOC);
s = mov.get(MOV_PROTIVA); s = mov.get(MOV_PROTIVA);
if (s.len() > 0 && isdigit(s[s.len() - 1])) s << " "; if (s.len() > 0 && isdigit(s[s.len() - 1])) s << " ";
s.right_just(8); s.right_just(8);
strcpy(rbuf.NUMPROT, (const char *) s); strcpy(rbuf.NUMPROT, (const char *) s);
strcpy(rbuf.DATADOC, d.string(ANSI)); strcpy(rbuf.DATADOC, d.string(ANSI));
strcpy(rbuf.ANNOES, mov.get(MOV_ANNOES)); strcpy(rbuf.ANNOES, mov.get(MOV_ANNOES));
strcpy(rbuf.NUMREG, mov.get(MOV_NUMREG)); strcpy(rbuf.NUMREG, mov.get(MOV_NUMREG));
sort.sort((char*)&rbuf); sort.sort((char*)&rbuf);
mov.next(); mov.next();
prnd.addstatus(1); prnd.addstatus(1);
} }
sort.endsort(); sort.endsort();
prnd.setstatus(0); prnd.setstatus(0);
prnd.set_text("Riordino archivio movimenti in corso\nRiscrittura file movimenti..."); prnd.set_text("Riordino archivio movimenti in corso\nRiscrittura file movimenti...");
therec* rr; therec* rr;
long num = 1; long num = 1;
TRecnotype recno; TRecnotype recno;
while ((rr = (therec*)sort.retrieve()) != NULL) while ((rr = (therec*)sort.retrieve()) != NULL)
{ {
do_events(); do_events();
if (atol(rr->NUMREG) != num) if (atol(rr->NUMREG) != num)
{ {
// find record // find record
mov.curr().zero(); mov.curr().zero();
mov.put(MOV_NUMREG, rr->NUMREG); mov.put(MOV_NUMREG, rr->NUMREG);
mov.read(); mov.read();
// should never happen // should never happen
CHECK(mov.good(), "Archivio movimenti inconsistente. Questo si' che e' un casino."); CHECK(mov.good(), "Archivio movimenti inconsistente. Questo si' che e' un casino.");
// retrieve and change NUMREG // retrieve and change NUMREG
recno = mov.recno(); recno = mov.recno();
TString rgn = rr->NUMREG; TString rgn = rr->NUMREG;
FILE* fsav = fopen("__mov__.sav","a"); FILE* fsav = fopen("__mov__.sav","a");
fprintf(fsav,"%s %d ", (const char*)rgn, recno); fprintf(fsav,"%s %d ", (const char*)rgn, recno);
fclose(fsav); fclose(fsav);
mov.put(MOV_NUMREG,num); mov.put(MOV_NUMREG,num);
mov.rewriteat(recno); mov.rewriteat(recno);
// update linked records // update linked records
rmov.curr().zero(); rmov.curr().zero();
rmov.put(RMV_NUMREG,rgn); rmov.put(RMV_NUMREG,rgn);
rmov.read(_isgteq); rmov.read(_isgteq);
int row = 0; int row = 0;
while (!rmov.eof() && rgn == rmov.get(RMV_NUMREG) && while (!rmov.eof() && rgn == rmov.get(RMV_NUMREG) &&
row++ < rmov.get_int(RMV_NUMRIG)) row++ < rmov.get_int(RMV_NUMRIG))
{ {
recno = rmov.recno(); recno = rmov.recno();
fsav = fopen("__mov__.sav","a"); fsav = fopen("__mov__.sav","a");
fprintf(fsav,"%ld ", recno); fprintf(fsav,"%ld ", recno);
fclose(fsav); fclose(fsav);
rmov.put(RMV_NUMREG,num); rmov.put(RMV_NUMREG,num);
rmov.rewriteat(recno); rmov.rewriteat(recno);
rmov.next(); rmov.next();
} }
fsav = fopen("__mov__.sav","a"); fsav = fopen("__mov__.sav","a");
fprintf(fsav,"-1"); fclose(fsav); fprintf(fsav,"-1"); fclose(fsav);
rmoviva.zero(); rmoviva.zero();
rmoviva.put(RMI_NUMREG,rgn); rmoviva.put(RMI_NUMREG,rgn);
rmoviva.read(_isgteq); rmoviva.read(_isgteq);
row = 0; row = 0;
while (!rmoviva.eof() && rgn == rmoviva.get(RMV_NUMREG) && while (!rmoviva.eof() && rgn == rmoviva.get(RMV_NUMREG) &&
row++ < rmoviva.get_int(RMV_NUMRIG)) row++ < rmoviva.get_int(RMV_NUMRIG))
{ {
recno = rmoviva.recno(); recno = rmoviva.recno();
fsav = fopen("__mov__.sav","a"); fsav = fopen("__mov__.sav","a");
fprintf(fsav,"%ld ", recno); fprintf(fsav,"%ld ", recno);
fclose(fsav); fclose(fsav);
rmoviva.put(RMI_NUMREG,num); rmoviva.put(RMI_NUMREG,num);
rmoviva.rewriteat(recno); rmoviva.rewriteat(recno);
rmoviva.next(); rmoviva.next();
} }
fsav = fopen("__mov__.sav","a"); fsav = fopen("__mov__.sav","a");
fprintf(fsav,"-1"); fclose(fsav); fprintf(fsav,"-1"); fclose(fsav);
} }
num++; num++;
prnd.addstatus(1); prnd.addstatus(1);
} }
remove("__mov__.sav"); remove("__mov__.sav");
FILE* fsav = fopen("__mov__.ind","w"); fclose(fsav); FILE* fsav = fopen("__mov__.ind","w"); fclose(fsav);
prnd.set_text("Riordino archivio movimenti in corso\nRicostruzione files indice..."); prnd.set_text("Riordino archivio movimenti in corso\nRicostruzione files indice...");
// rebuild indexes // rebuild indexes
mov.close(); rmov.close(); rmoviva.close(); mov.close(); rmov.close(); rmoviva.close();
mov.indexon(); rmov.indexon(); rmoviva.indexon(); mov.indexon(); rmov.indexon(); rmoviva.indexon();
mov.packfile(); rmov.packfile(); rmoviva.packfile(); mov.packfile(); rmov.packfile(); rmoviva.packfile();
mov.packindex(); rmov.packindex(); rmoviva.packindex(); mov.packindex(); rmov.packindex(); rmoviva.packindex();
remove("__mov__.ind"); remove("__mov__.ind");
return TRUE; return TRUE;
} }
bool CG4100_App::sort_sal() bool CG4100_App::sort_sal()
{ {
if (!set_parms()) if (!set_parms())
return FALSE; return FALSE;
FILE* fp = fopen ("__sal__.sav","w"); FILE* fp = fopen ("__sal__.sav","w");
fclose(fp); fclose(fp);
TLocalisamfile rmov(LF_RMOV); TLocalisamfile rmov(LF_RMOV);
TLocalisamfile mov(LF_MOV); TLocalisamfile mov(LF_MOV);
TLocalisamfile causali(LF_CAUSALI); TLocalisamfile causali(LF_CAUSALI);
TSaldo_agg sal; TSaldo_agg sal;
int gruppo, conto; int gruppo, conto;
const int year = atoi(_year); const int year = atoi(_year);
long oldnumreg = 0L, sottoconto; long oldnumreg = 0L, sottoconto;
TProgind prnd(rmov.items(), TProgind prnd(rmov.items(),
"Riordino archivio saldi in corso\nLettura archivio movimenti...", "Riordino archivio saldi in corso\nLettura archivio movimenti...",
FALSE,TRUE,30); FALSE,TRUE,30);
causali.zero(); causali.zero();
mov.setkey(1); mov.setkey(1);
rmov.first(); rmov.first();
sal.reset(); sal.reset();
sal.set_anno_es(year); sal.set_anno_es(year);
sal.clear_saldi(year); sal.clear_saldi(year);
while (!rmov.eof()) while (!rmov.eof())
{ {
if (_year == rmov.get(RMV_ANNOES)) if (_year == rmov.get(RMV_ANNOES))
{ {
const long numreg = rmov.get_long(RMV_NUMREG); const long numreg = rmov.get_long(RMV_NUMREG);
gruppo = rmov.get_int(RMV_GRUPPO); gruppo = rmov.get_int(RMV_GRUPPO);
conto = rmov.get_int(RMV_CONTO); conto = rmov.get_int(RMV_CONTO);
sottoconto = rmov.get_long(RMV_SOTTOCONTO); sottoconto = rmov.get_long(RMV_SOTTOCONTO);
if (numreg != oldnumreg) if (numreg != oldnumreg)
{ {
oldnumreg = numreg; oldnumreg = numreg;
mov.zero(); mov.zero();
mov.put(MOV_NUMREG, numreg); mov.put(MOV_NUMREG, numreg);
mov.read(); mov.read();
CHECK(mov.good(),"Archivi movimenti e righe inconsistenti"); CHECK(mov.good(),"Archivi movimenti e righe inconsistenti");
const char* codcaus = mov.get(MOV_CODCAUS); const char* codcaus = mov.get(MOV_CODCAUS);
// cerca causale // cerca causale
causali.zero(); causali.zero();
if (*codcaus) if (*codcaus)
{ {
causali.put(CAU_CODCAUS, codcaus); causali.put(CAU_CODCAUS, codcaus);
causali.read(); causali.read();
CHECK(causali.good(),"Archivi causali e movimenti inconsistenti"); CHECK(causali.good(),"Archivi causali e movimenti inconsistenti");
} }
} }
const char sezione = rmov.get(RMV_SEZIONE)[0]; const char sezione = rmov.get(RMV_SEZIONE)[0];
real importo(rmov.get(RMV_IMPORTO)); real importo(rmov.get(RMV_IMPORTO));
sal.set_movap(causali.get(CAU_MOVAP) == "A"); sal.set_movap(causali.get(CAU_MOVAP) == "A");
sal.set_movprovv(mov.get(MOV_PROVVIS).not_empty()); sal.set_movprovv(mov.get(MOV_PROVVIS).not_empty());
sal.aggiorna(gruppo, conto, sottoconto, importo, sezione); sal.aggiorna(gruppo, conto, sottoconto, importo, sezione);
if (sal.items() > MAX_CNT) if (sal.items() > MAX_CNT)
{ {
sal.registra(); sal.registra();
sal.reset(); sal.reset();
sal.set_anno_es(atoi(_year)); sal.set_anno_es(atoi(_year));
} }
} }
rmov.next(); rmov.next();
prnd.addstatus(1); prnd.addstatus(1);
do_events(); do_events();
} }
if (sal.items() > 0) if (sal.items() > 0)
sal.registra(); sal.registra();
remove("__sal__.sav"); remove("__sal__.sav");
return TRUE; return TRUE;
} }
int cg4100(int argc, char* argv[]) int cg4100(int argc, char* argv[])
{ {
CG4100_App main_app; CG4100_App main_app;
main_app.run(argc, argv, "Riordinamento movimenti/Ricalcolo Saldi"); main_app.run(argc, argv, "Ricalcolo Saldi");
return TRUE; return TRUE;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,141 +1,141 @@
#ifndef __CGLIB_H #ifndef __CGLIB_H
#define __CGLIB_H #define __CGLIB_H
#ifndef __ISAM_H #ifndef __ISAM_H
#include <isam.h> #include <isam.h>
#endif #endif
#ifndef __REAL_H #ifndef __REAL_H
#include <real.h> #include <real.h>
#endif #endif
#ifndef __DATE_H #ifndef __DATE_H
#include <date.h> #include <date.h>
#endif #endif
#include <assoc.h> #include <assoc.h>
#include "conto.h" #include "conto.h"
//TLocalisamfile * get_descr_cf(TLocalisamfile * pconti,TLocalisamfile * clifo , int g, int c, long s); //TLocalisamfile * get_descr_cf(TLocalisamfile * pconti,TLocalisamfile * clifo , int g, int c, long s);
class TSaldi_list : public TAssoc_array class TSaldi_list : public TAssoc_array
{ {
public: public:
TSaldi_list (int g, int c, int aec, int aep=0); TSaldi_list (int g, int c, int aec, int aep=0);
TRectype* saldi() const; TRectype* saldi() const;
}; };
#define Saldo TSaldo #define Saldo TSaldo
enum tipobil { DataLimite=1, UltimaImmissione }; enum tipobil { DataLimite=1, UltimaImmissione };
class TSaldo class TSaldo
{ {
real _saldo, _saldo_iniziale; real _saldo, _saldo_iniziale;
real _prg_dare, _prg_avere, _prg_daresca, _prg_averesca; real _prg_dare, _prg_avere, _prg_daresca, _prg_averesca;
int _indbil; int _indbil;
TRectype _saldo_ep; TRectype _saldo_ep;
int _annoes; int _annoes;
TDate _inizioEs, _fineEs; TDate _inizioEs, _fineEs;
TString16 _codcaus; TString16 _codcaus;
TDate _datareg; TDate _datareg;
TDate _datacomp; TDate _datacomp;
TString _provv; TString _provv;
bool _movimentato; bool _movimentato;
bool _significativo; bool _significativo;
bool _rec_presente_ec; bool _rec_presente_ec;
bool _rec_presente_ep; bool _rec_presente_ep;
protected: protected:
void InFinEs(int); void InFinEs(int);
void leggi_mov(long numreg); // Leggi testata void leggi_mov(long numreg); // Leggi testata
real calcola_saldo_iniziale(int g, int c, long s, int indbil); real calcola_saldo_iniziale(int g, int c, long s, int indbil);
public: public:
bool movimentato() const { return _movimentato; } bool movimentato() const { return _movimentato; }
bool significativo() const { return _significativo; } bool significativo() const { return _significativo; }
bool esiste_saldo() const { return _rec_presente_ec || _rec_presente_ep;} bool esiste_saldo() const { return _rec_presente_ec || _rec_presente_ep;}
const int EsePre (const int annocorr); // Determina esercizio precedente const int EsePre (const int annocorr); // Determina esercizio precedente
int annoes () const { return _annoes; } int annoes () const { return _annoes; }
void set_annoes (int anno) { _annoes = anno; } void set_annoes (int anno) { _annoes = anno; }
bool causale_mov(long, const TDate&, const TDate&, TString&); bool causale_mov(long, const TDate&, const TDate&, TString&);
const char* causale_chiusura_es(); const char* causale_chiusura_es();
const char* causale_apertura_es(); const char* causale_apertura_es();
bool ultima_immissione_bilancio(int anno,int g,int c,long s,int indbil); bool ultima_immissione_bilancio(int anno,int g,int c,long s,int indbil);
bool ultima_immissione_verifica(int anno,int g,int c,long s,int indbil); bool ultima_immissione_verifica(int anno,int g,int c,long s,int indbil);
bool data_limite_bilancio(int,int,int,long,const TDate&,const TDate&,int,bool); bool data_limite_bilancio(int,int,int,long,const TDate&,const TDate&,int,bool);
TRectype& ricerca_progr_prec(int, int, int, long); TRectype& ricerca_progr_prec(int, int, int, long);
real saldofin_esprec(int,int,int,long); real saldofin_esprec(int,int,int,long);
bool prg_attuali(int,TConto&,real&,real&); bool prg_attuali(int,TConto&,real&,real&);
bool prg_mov_eliminati(int,TConto&,real&,real&); bool prg_mov_eliminati(int,TConto&,real&,real&);
real saldo() const {return _saldo;} const real& saldo() const { return _saldo;}
real saldoini() const {return _saldo_iniziale;} const real& saldoini() const { return _saldo_iniziale;}
real prgdare() const {return _prg_dare;} const real& prgdare() const { return _prg_dare;}
real prgavere() const {return _prg_avere;} const real& prgavere() const { return _prg_avere;}
bool prg_attuali(int,TConto&,int,real&,real&); bool prg_attuali(int,TConto&,int,real&,real&);
bool prg_mov_eliminati(int,TConto&,int,real&,real&); bool prg_mov_eliminati(int,TConto&,int,real&,real&);
Saldo(); Saldo();
~Saldo(); ~Saldo();
}; };
class TTab_conti : public TAssoc_array class TTab_conti : public TAssoc_array
{ {
void do_agg(TConto* tc, int anno_es, const real& importo, char sezione, void do_agg(TConto* tc, int anno_es, const real& importo, char sezione,
bool movap, bool provv, bool somma, const char* key); bool movap, bool provv, bool somma, const char* key);
public: public:
void aggiorna_conto(const TConto& tc, int anno_es, const real& importo, void aggiorna_conto(const TConto& tc, int anno_es, const real& importo,
char sezione, bool movap, bool provv, bool somma); char sezione, bool movap, bool provv, bool somma);
void aggiorna_conto (int gruppo, int conto, long sottoconto, int anno_es, void aggiorna_conto (int gruppo, int conto, long sottoconto, int anno_es,
const real& importo, char sezione, bool movap, const real& importo, char sezione, bool movap,
bool provv, bool somma); bool provv, bool somma);
}; };
class TSaldo_agg : public TObject class TSaldo_agg : public TObject
{ {
TTab_conti _tab_conti; TTab_conti _tab_conti;
bool _movap; // se e' mov. d'apertura (aggiorno SALDO e FLAGSALINI in bool _movap; // se e' mov. d'apertura (aggiorno SALDO e FLAGSALINI in
// saldi) // saldi)
bool _provv; bool _provv;
int _anno_es; // anno esercizio int _anno_es; // anno esercizio
TDate _data_ulmov; // data ultimo movimento TDate _data_ulmov; // data ultimo movimento
long _num_ulmov; // numero ultimo movimento long _num_ulmov; // numero ultimo movimento
TRectype * _rec; // record corrente sui saldi TRectype * _rec; // record corrente sui saldi
THash_object * tconti() { return _tab_conti.get_hashobj(); } THash_object * tconti() { return _tab_conti.get_hashobj(); }
public: public:
void clear_saldi(int year); void clear_saldi(int year);
void registra(); void registra();
void aggiorna (const TConto& tc, const real& importo, char sezione, void aggiorna (const TConto& tc, const real& importo, char sezione,
bool somma=TRUE); bool somma=TRUE);
void aggiorna (int gruppo, int conto, long sottoconto, const real& importo, void aggiorna (int gruppo, int conto, long sottoconto, const real& importo,
char sezione, bool somma=TRUE); char sezione, bool somma=TRUE);
void set_anno_es(int anno) { _anno_es = anno; } void set_anno_es(int anno) { _anno_es = anno; }
int anno_es() const { return _anno_es; } int anno_es() const { return _anno_es; }
void set_movap (bool movap) { _movap = movap; } void set_movap (bool movap) { _movap = movap; }
bool movap() const { return _movap; } bool movap() const { return _movap; }
void set_movprovv (bool p) { _provv = p; } void set_movprovv (bool p) { _provv = p; }
bool movprovv() { return _provv; } bool movprovv() const { return _provv; }
void set_data_ulmov (const TDate& data) { _data_ulmov = data; } void set_data_ulmov (const TDate& data) { _data_ulmov = data; }
const TDate& data_ulmov() const { return _data_ulmov; } const TDate& data_ulmov() const { return _data_ulmov; }
void set_num_ulmov (long num) { _num_ulmov = num; } void set_num_ulmov (long num) { _num_ulmov = num; }
long num_ulmov() const { return _num_ulmov; } long num_ulmov() const { return _num_ulmov; }
void reset(); // pulisce l'array dei conti void reset(); // pulisce l'array dei conti
TSaldo_agg(); TSaldo_agg();
int items() const { return _tab_conti.items();} int items() const { return _tab_conti.items();}
}; };
#endif #endif

View File

@ -1,251 +1,256 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// cglib02.cpp // cglib02.cpp
// //
// Aggiornamento saldi // Aggiornamento saldi
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include <stdlib.h> #include <stdlib.h>
#include <isam.h> #include <isam.h>
#include <saldi.h> #include <utility.h>
#include <utility.h>
#include <saldi.h>
#include "conto.h"
#include "cglib.h" #include "conto.h"
#include "cglib.h"
void TTab_conti::do_agg(TConto* tc, int anno_es, const real& importo,
char sezione, bool movap, bool provv, bool somma, const char* key) void TTab_conti::do_agg(TConto* tc, int anno_es, const real& importo,
{ char sezione, bool movap, bool provv, bool somma, const char* key)
real i = somma ? importo : -importo; {
real i = somma ? importo : -importo;
if (movap)
{ if (movap)
if (sezione == 'D') tc->saldo() += i; {
else tc->saldo() -= i; if (sezione == 'D') tc->saldo() += i;
} else tc->saldo() -= i;
else }
if (provv) else
{ if (provv)
if (sezione == 'D') tc->darepro() += i; {
else tc->averepro() += i; if (sezione == 'D') tc->darepro() += i;
} else tc->averepro() += i;
else }
{ else
if (sezione == 'D') tc->dare() += i; {
else tc->avere() += i; if (sezione == 'D') tc->dare() += i;
} else tc->avere() += i;
}
// rimuovo dalla tabella il conto se dare e avere vanno a zero
if (tc->dare().is_zero() && tc->avere().is_zero() && // rimuovo dalla tabella il conto se dare e avere vanno a zero
tc->darepro().is_zero() && tc->averepro().is_zero() && if (tc->dare().is_zero() && tc->avere().is_zero() &&
tc->saldo().is_zero()) remove(key); tc->darepro().is_zero() && tc->averepro().is_zero() &&
} tc->saldo().is_zero()) remove(key);
}
void TTab_conti::aggiorna_conto(const TConto& tcon, int anno_es, const real& importo, char sezione, bool movap, bool provv, bool somma)
{ void TTab_conti::aggiorna_conto(const TConto& tcon, int anno_es, const real& importo, char sezione, bool movap, bool provv, bool somma)
TString80 key; {
key << format("%4d", anno_es); TString80 key;
key << format("%3d", tcon.gruppo()); key << format("%4d", anno_es);
key << format("%3d", tcon.conto()); key << format("%3d", tcon.gruppo());
key << format("%6ld", tcon.sottoconto()); key << format("%3d", tcon.conto());
key << format("%6ld", tcon.sottoconto());
TConto* tc = (TConto*) objptr(key);
if (tc == NULL) TConto* tc = (TConto*) objptr(key);
{ if (tc == NULL)
tc = new TConto(tcon.gruppo(), tcon.conto(), tcon.sottoconto(), {
tcon.tipo()); tc = new TConto(tcon.gruppo(), tcon.conto(), tcon.sottoconto(),
add(key, tc); tcon.tipo());
tc->dare() = ZERO; add(key, tc);
tc->avere() = ZERO; tc->dare() = ZERO;
tc->darepro() = ZERO; tc->avere() = ZERO;
tc->averepro() = ZERO; tc->darepro() = ZERO;
tc->saldo() = ZERO; tc->averepro() = ZERO;
} tc->saldo() = ZERO;
do_agg(tc, anno_es, importo, sezione, movap, provv, somma, key); }
} do_agg(tc, anno_es, importo, sezione, movap, provv, somma, key);
}
void TTab_conti::aggiorna_conto(int gruppo, int conto, long sottoconto,
int anno_es, const real& importo, char sezione, void TTab_conti::aggiorna_conto(int gruppo, int conto, long sottoconto,
bool movap, bool provv, bool somma) int anno_es, const real& importo, char sezione,
{ bool movap, bool provv, bool somma)
TString80 key; {
key << format("%4d", anno_es); TString80 key;
key << format("%3d", gruppo); key << format("%4d", anno_es);
key << format("%3d", conto); key << format("%3d", gruppo);
key << format("%6ld", sottoconto); key << format("%3d", conto);
key << format("%6ld", sottoconto);
TConto* tc = (TConto*) objptr(key);
if (tc == NULL) TConto* tc = (TConto*) objptr(key);
{ if (tc == NULL)
tc = new TConto(gruppo, conto, sottoconto); {
add(key, tc); tc = new TConto(gruppo, conto, sottoconto);
} add(key, tc);
do_agg(tc, anno_es, importo, sezione, movap, provv, somma, key); }
} do_agg(tc, anno_es, importo, sezione, movap, provv, somma, key);
}
TSaldo_agg::TSaldo_agg()
{ TSaldo_agg::TSaldo_agg()
_anno_es = 0; {
_data_ulmov = ""; _anno_es = 0;
_num_ulmov = 0l; _data_ulmov = "";
_movap = FALSE; _num_ulmov = 0l;
_provv = FALSE; _movap = FALSE;
reset(); // pulizia dell'array dei conti _provv = FALSE;
} reset(); // pulizia dell'array dei conti
}
void TSaldo_agg::aggiorna(const TConto& tc, const real& importo, char sezione,
bool somma) void TSaldo_agg::aggiorna(const TConto& tc, const real& importo, char sezione,
{ bool somma)
_tab_conti.aggiorna_conto(tc, _anno_es, importo, sezione, _movap, _provv, {
somma); _tab_conti.aggiorna_conto(tc, _anno_es, importo, sezione, _movap, _provv,
} somma);
}
void TSaldo_agg::aggiorna(int gruppo, int conto, long sottoconto, const real& importo, char sezione, bool somma)
{ void TSaldo_agg::aggiorna(int gruppo, int conto, long sottoconto, const real& importo, char sezione, bool somma)
_tab_conti.aggiorna_conto(gruppo, conto, sottoconto, _anno_es, importo, {
sezione, _movap, _provv, somma); _tab_conti.aggiorna_conto(gruppo, conto, sottoconto, _anno_es, importo,
} sezione, _movap, _provv, somma);
}
void TSaldo_agg::reset()
{ void TSaldo_agg::reset()
_tab_conti.destroy(); {
} _tab_conti.destroy();
}
///////////////////////////////////////////////////////////////////////////////
// pulizia file saldi ///////////////////////////////////////////////////////////////////////////////
// // pulizia file saldi
// Scorro il file saldi per l' anno year o per tutti gli anni se year = 0 //
// e azzero i progressivi. // Scorro il file saldi per l' anno year o per tutti gli anni se year = 0
// // e azzero i progressivi.
/////////////////////////////////////////////////////////////////////////////// //
void TSaldo_agg::clear_saldi(int year) ///////////////////////////////////////////////////////////////////////////////
{ void TSaldo_agg::clear_saldi(int year)
TLocalisamfile saldi(LF_SALDI); {
TLocalisamfile saldi(LF_SALDI);
set_anno_es(year);
saldi.zero(); set_anno_es(year);
if (anno_es() != 0) saldi.zero();
saldi.put(SLD_ANNOES, anno_es()); if (anno_es() != 0)
saldi.put(SLD_ANNOES, anno_es());
TRectype last(saldi.curr());
TRectype last(saldi.curr());
for (saldi.read(_isgteq, _lock);
!saldi.eof() && saldi.curr() <= last; for (saldi.read(_isgteq, _lock);
saldi.next(_lock)) !saldi.eof() && saldi.curr() <= last;
{ saldi.next(_lock))
saldi.put(SLD_FLAGSALINI, "D"); {
saldi.zero(SLD_SALDO); saldi.put(SLD_FLAGSALINI, "D");
saldi.zero(SLD_PDAREPRO); saldi.zero(SLD_SALDO);
saldi.zero(SLD_PAVEREPRO); saldi.zero(SLD_PDAREPRO);
saldi.zero(SLD_PDARE); saldi.zero(SLD_PAVEREPRO);
saldi.zero(SLD_PAVERE); saldi.zero(SLD_PDARE);
saldi.zero(SLD_NUMULTMOV); saldi.zero(SLD_PAVERE);
saldi.zero(SLD_DATAULMOV); saldi.zero(SLD_NUMULTMOV);
saldi.rewrite(); saldi.zero(SLD_DATAULMOV);
} saldi.rewrite();
saldi.reread(_unlock); }
} saldi.reread(_unlock);
}
///////////////////////////////////////////////////////////////////////////////
// Aggiornamento file saldi ///////////////////////////////////////////////////////////////////////////////
// // Aggiornamento file saldi
// Scorro la tabella dei conti interna _tab_conti. //
// Per ogni conto cerco il record su saldi, se non c'e' lo creo. // Scorro la tabella dei conti interna _tab_conti.
// Se c'e' gia' lo aggiorno nel seguente modo: // Per ogni conto cerco il record su saldi, se non c'e' lo creo.
// // Se c'e' gia' lo aggiorno nel seguente modo:
/////////////////////////////////////////////////////////////////////////////// //
void TSaldo_agg::registra() ///////////////////////////////////////////////////////////////////////////////
{ void TSaldo_agg::registra()
real s, r; {
TString Flagsalini; real s, r;
TDate data_ulmov; TString Flagsalini;
long num_ulmov; TDate data_ulmov;
TLocalisamfile saldi(LF_SALDI); long num_ulmov;
int conti = _tab_conti.items(); TLocalisamfile saldi(LF_SALDI);
int conti = _tab_conti.items();
_tab_conti.restart();
for (int i=0; i < conti; i++) _tab_conti.restart();
{ for (int i = 0; i < conti; i++)
THash_object * hobj = tconti(); {
TConto & tcon = (TConto &)hobj->obj(); THash_object * hobj = tconti();
const TConto& tcon = (TConto &)hobj->obj();
if (!tcon.ok()) continue; CHECK(tcon.ok(), "Tentativo di saldare un conto incompleto");
saldi.zero();
saldi.put(SLD_ANNOES, atoi(hobj->key().left(4)) ); saldi.zero();
saldi.put(SLD_GRUPPO, tcon.gruppo()); saldi.put(SLD_ANNOES, atoi(hobj->key().left(4)) );
saldi.put(SLD_CONTO, tcon.conto()); saldi.put(SLD_GRUPPO, tcon.gruppo());
saldi.put(SLD_SOTTOCONTO, tcon.sottoconto()); saldi.put(SLD_CONTO, tcon.conto());
if (saldi.read(_isequal, _lock) == NOERR) saldi.put(SLD_SOTTOCONTO, tcon.sottoconto());
{
num_ulmov = saldi.get_long(SLD_NUMULTMOV); bool update = TRUE;
data_ulmov = saldi.get_date(SLD_DATAULMOV);
if (saldi.read(_isequal, _lock) != NOERR)
if (((_num_ulmov != 0L) && (_num_ulmov > num_ulmov)) || {
((_data_ulmov.ok()) && (_data_ulmov > data_ulmov))) saldi.zero();
{ saldi.put(SLD_ANNOES, anno_es());
saldi.put(SLD_DATAULMOV, _data_ulmov); saldi.put(SLD_GRUPPO, tcon.gruppo());
saldi.put(SLD_NUMULTMOV, _num_ulmov); saldi.put(SLD_CONTO, tcon.conto());
} saldi.put(SLD_SOTTOCONTO, tcon.sottoconto());
r = tcon.saldo(); s = tcon.saldo();
if (r != ZERO) if (s < ZERO)
{ { Flagsalini = "A"; s = -s; }
s = saldi.get_real(SLD_SALDO); else
Flagsalini = saldi.get(SLD_FLAGSALINI); Flagsalini = "D";
if (Flagsalini == "A") s = r - s;
else s = r + s; saldi.put(SLD_FLAGSALINI, (const char *) Flagsalini);
if (s < ZERO) saldi.put(SLD_SALDO, s);
{ saldi.put(SLD_PDAREPRO, tcon.darepro());
Flagsalini = "A"; s = -s; saldi.put(SLD_PAVEREPRO, tcon.averepro());
} saldi.put(SLD_PDARE, tcon.dare());
else
Flagsalini = "D"; saldi.put(SLD_PAVERE, tcon.avere());
saldi.put(SLD_FLAGSALINI, (const char *) Flagsalini); if (_num_ulmov != 0L) saldi.put(SLD_NUMULTMOV, _num_ulmov);
saldi.put(SLD_SALDO, s); if (_data_ulmov.ok()) saldi.put(SLD_DATAULMOV, _data_ulmov);
} update = saldi.write() == _isreinsert;
r = saldi.get_real(SLD_PDAREPRO); if (update)
r += tcon.darepro(); saldi.read(_isequal, _lock);
saldi.put(SLD_PDAREPRO, r); }
r = saldi.get_real(SLD_PAVEREPRO);
r += tcon.averepro(); if (update)
saldi.put(SLD_PAVEREPRO, r); {
r = saldi.get_real(SLD_PDARE); num_ulmov = saldi.get_long(SLD_NUMULTMOV);
r += tcon.dare(); data_ulmov = saldi.get_date(SLD_DATAULMOV);
saldi.put(SLD_PDARE, r);
r = saldi.get_real(SLD_PAVERE); if (((_num_ulmov != 0L) && (_num_ulmov > num_ulmov)) ||
r += tcon.avere(); ((_data_ulmov.ok()) && (_data_ulmov > data_ulmov)))
saldi.put(SLD_PAVERE, r); {
saldi.rewrite(); saldi.put(SLD_DATAULMOV, _data_ulmov);
} saldi.put(SLD_NUMULTMOV, _num_ulmov);
else }
{ r = tcon.saldo();
saldi.zero(); if (r != ZERO)
saldi.put(SLD_ANNOES, anno_es()); {
saldi.put(SLD_GRUPPO, tcon.gruppo()); s = saldi.get_real(SLD_SALDO);
saldi.put(SLD_CONTO, tcon.conto()); Flagsalini = saldi.get(SLD_FLAGSALINI);
saldi.put(SLD_SOTTOCONTO, tcon.sottoconto()); if (Flagsalini == "A") s = r - s;
s = tcon.saldo(); else s = r + s;
if (s < ZERO) if (s < ZERO)
{ {
Flagsalini = "A"; s = -s; Flagsalini = "A"; s = -s;
} }
else else
Flagsalini = "D"; Flagsalini = "D";
saldi.put(SLD_FLAGSALINI, Flagsalini);
saldi.put(SLD_FLAGSALINI, (const char *) Flagsalini); saldi.put(SLD_SALDO, s);
saldi.put(SLD_SALDO, s); }
saldi.put(SLD_PDAREPRO, tcon.darepro()); r = saldi.get_real(SLD_PDAREPRO);
saldi.put(SLD_PAVEREPRO, tcon.averepro()); r += tcon.darepro();
saldi.put(SLD_PDARE, tcon.dare()); saldi.put(SLD_PDAREPRO, r);
r = saldi.get_real(SLD_PAVEREPRO);
saldi.put(SLD_PAVERE, tcon.avere()); r += tcon.averepro();
if (_num_ulmov != 0L) saldi.put(SLD_NUMULTMOV, _num_ulmov); saldi.put(SLD_PAVEREPRO, r);
if (_data_ulmov.ok()) saldi.put(SLD_DATAULMOV, _data_ulmov); r = saldi.get_real(SLD_PDARE);
saldi.write(); r += tcon.dare();
} saldi.put(SLD_PDARE, r);
} r = saldi.get_real(SLD_PAVERE);
} r += tcon.avere();
saldi.put(SLD_PAVERE, r);
saldi.rewrite();
}
}
}

View File

@ -1,84 +1,93 @@
#ifndef __CONTO_H #ifndef __CONTO_H
#define __CONTO_H #define __CONTO_H
#ifndef __STRINGS_H #ifndef __STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
#ifndef __REAL_H #ifndef __REAL_H
#include <real.h> #include <real.h>
#endif #endif
class TBill : public TSortable class TBill : public TSortable
{ {
char _tipo; // ' ' = Conto, 'C' = Cliente, 'F' = 'Fornitore' char _tipo; // ' ' = Conto, 'C' = Cliente, 'F' = 'Fornitore'
int _gruppo, _conto; int _gruppo, _conto;
long _sottoconto; // Sottoconto, codice cliente o fornitore long _sottoconto; // Sottoconto, codice cliente o fornitore
TString80 _descrizione; // Vuota fino alla chiamata di describe TString80 _descrizione; // Vuota fino alla chiamata di describe
int _tipo_cr; // Tipo costo/ricavo int _tipo_cr; // Tipo costo/ricavo
bool _sospeso; bool _sospeso;
protected: protected:
virtual int compare(const TSortable& s) const; virtual int compare(const TSortable& s) const;
virtual const char* class_name() const { return "Conto"; } virtual const char* class_name() const { return "Conto"; }
void describe(); void describe();
const TBill& copy(const TBill& b); const TBill& copy(const TBill& b);
public: public:
TBill(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL, int r = -1) TBill(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL, int r = -1)
: _tipo(t), _gruppo(g), _conto(c), _sottoconto(s), _descrizione(d), _tipo_cr(r) { set(g,c,s,t,d,r);} : _tipo(t), _gruppo(g), _conto(c), _sottoconto(s), _descrizione(d), _tipo_cr(r) { set(g,c,s,t,d,r);}
TBill(TToken_string& tgcsd, int from, int mode = 0); TBill(TToken_string& tgcsd, int from, int mode = 0);
TBill(const TBill& b) { copy(b); } TBill(const TBill& b) { copy(b); }
virtual ~TBill() {} virtual ~TBill() {}
const TBill& set(int g = 0, int c = 0, long s = 0L, char t = ' ', const TBill& set(int g = 0, int c = 0, long s = 0L, char t = ' ',
const char* d = NULL, int r = -1); const char* d = NULL, int r = -1);
const TBill& add_to(TToken_string& ts, int from, int mode = 0); const TBill& add_to(TToken_string& ts, int from, int mode = 0);
const TBill& operator=(const TBill& b) { return copy(b); } const TBill& operator=(const TBill& b) { return copy(b); }
virtual bool ok() const; // Gruppo, Conto e Sottoconto non nulli virtual bool ok() const; // Gruppo, Conto e Sottoconto non nulli
bool empty() const { return _gruppo==0 && _conto==0 && _sottoconto == 0; } bool empty() const { return _gruppo==0 && _conto==0 && _sottoconto == 0; }
char tipo() const { return _tipo; } char tipo() const { return _tipo; }
int gruppo() const { return _gruppo; } int gruppo() const { return _gruppo; }
int conto() const { return _conto; } int conto() const { return _conto; }
long sottoconto() const { return _sottoconto; } long sottoconto() const { return _sottoconto; }
const TString& descrizione(); const TString& descrizione();
int tipo_cr(); int tipo_cr();
void tipo_cr(int tcr) { _tipo_cr = tcr; } void tipo_cr(int tcr) { _tipo_cr = tcr; }
int tipo_att(); int tipo_att();
bool read(TRectype& r); bool read(TRectype& r);
bool sospeso() const { return _sospeso;} // _sospeso e' letto nella read() bool sospeso() const { return _sospeso;} // _sospeso e' letto nella read()
const char* string(int mode = 0); const char* string(int mode = 0);
}; };
enum TIndbil { ib_null, ib_attivita, ib_passivita, ib_costi, ib_ricavi, ib_conti_ordine }; enum TIndbil { ib_null, ib_attivita, ib_passivita, ib_costi, ib_ricavi, ib_conti_ordine };
class TConto : public TBill class TConto : public TBill
{ {
real _dare, _avere, _darepro, _averepro, _saldo; real _dare, _avere, _darepro, _averepro, _saldo;
public: public:
TConto(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL) TConto(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL)
: TBill(g, c, s, t, d) {} : TBill(g, c, s, t, d) {}
TConto (TToken_string& tgcsd, int from, int mode = 0) TConto (TToken_string& tgcsd, int from, int mode = 0)
: TBill(tgcsd, from, mode) {}; : TBill(tgcsd, from, mode) {};
real& dare() { return _dare; } real& dare() { return _dare; }
real& avere() { return _avere; } const real& dare() const { return _dare; }
real& darepro() { return _darepro; }
real& averepro() { return _averepro; } real& avere() { return _avere; }
real& saldo() { return _saldo; } const real& avere() const { return _avere; }
};
real& darepro() { return _darepro; }
#endif const real& darepro() const { return _darepro; }
real& averepro() { return _averepro; }
const real& averepro() const { return _averepro; }
real& saldo() { return _saldo; }
const real& saldo() const { return _saldo; }
};
#endif