Esplosione tab
git-svn-id: svn://10.65.10.50/trunk@4821 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4a3996b65d
commit
b328065d69
352
mg/mglib03.cpp
352
mg/mglib03.cpp
@ -4,13 +4,13 @@
|
||||
|
||||
void TForm_stampemg::add_giaclev(TString &levname)
|
||||
{
|
||||
int lv=1;
|
||||
do {
|
||||
const TString & piece = _giaclev->unpack_grpcode(relation()->lfile(LF_MAG).get("LIVELLO"),lv);
|
||||
if (piece.not_empty()) {
|
||||
levname << '/' << piece ;
|
||||
}
|
||||
} while (++lv< (_tolivgiac ? _tolivgiac: _giaclev->last_level()) );
|
||||
int lv=1;
|
||||
do {
|
||||
const TString & piece = _giaclev->unpack_grpcode(relation()->lfile(LF_MAG).get("LIVELLO"),lv);
|
||||
if (piece.not_empty()) {
|
||||
levname << '/' << piece ;
|
||||
}
|
||||
} while (++lv< (_tolivgiac ? _tolivgiac: _giaclev->last_level()) );
|
||||
}
|
||||
|
||||
|
||||
@ -19,30 +19,30 @@ void TForm_stampemg::gruppogiac(TForm_item &cf, TToken_string &s)
|
||||
TString valore,levname;
|
||||
int livello=atoi(s.get());
|
||||
|
||||
if (_fromlivgiac) {
|
||||
levname=relation()->lfile(LF_MAG).get("CODART");
|
||||
if (_fromlivgiac>1) {
|
||||
add_giaclev(levname);
|
||||
}
|
||||
}
|
||||
levname << ' ' << _giaclev->name(livello) ;
|
||||
valore=_giacgrp->decode(_giaclev->build_tabcode(relation()->lfile(LF_MAG).get("LIVELLO"),livello));
|
||||
if (valore.empty())
|
||||
valore=UNKNOWN_NAME;
|
||||
cf.set(levname << ' ' << valore);
|
||||
if (_fromlivgiac) {
|
||||
levname=relation()->lfile(LF_MAG).get("CODART");
|
||||
if (_fromlivgiac>1) {
|
||||
add_giaclev(levname);
|
||||
}
|
||||
}
|
||||
levname << ' ' << _giaclev->name(livello) ;
|
||||
valore=_giaclev->group_descr(relation()->lfile(LF_MAG).get("LIVELLO"),livello);
|
||||
if (valore.empty())
|
||||
valore=UNKNOWN_NAME;
|
||||
cf.set(levname << ' ' << valore);
|
||||
}
|
||||
|
||||
|
||||
void TForm_stampemg::gruppoart(TForm_item &cf, TToken_string &s)
|
||||
{
|
||||
int lv=atoi(s.get());
|
||||
int lv=atoi(s.get());
|
||||
TString valore;
|
||||
|
||||
valore=_artgrp->decode(_artlev->build_tabcode(relation()->lfile(LF_ANAMAG).get("CODART"),lv));
|
||||
if (valore.not_empty())
|
||||
cf.set(valore);
|
||||
else
|
||||
cf.set(UNKNOWN_NAME);
|
||||
valore=_artlev->group_descr(relation()->lfile(LF_ANAMAG).get("CODART"),lv);
|
||||
if (valore.not_empty())
|
||||
cf.set(valore);
|
||||
else
|
||||
cf.set(UNKNOWN_NAME);
|
||||
}
|
||||
|
||||
bool TForm_stampemg::validate(TForm_item &cf, TToken_string &s)
|
||||
@ -52,187 +52,183 @@ bool TForm_stampemg::validate(TForm_item &cf, TToken_string &s)
|
||||
TString valore,levname;
|
||||
|
||||
if (code=="_USER") {
|
||||
subcode=s.get();
|
||||
subcode=s.get();
|
||||
|
||||
if (subcode=="GRUPPOGIAC") {
|
||||
/*
|
||||
int lv=atoi(s.get());
|
||||
do {
|
||||
valore=_giaclev->build_tabcode(relation()->lfile(LF_MAG).get("LIVELLO"),lv);
|
||||
} while (--lv>0 && valore=="");
|
||||
if (valore!="")
|
||||
levname=_giaclev->name(lv+1) ;
|
||||
else
|
||||
levname="giacenza";
|
||||
cf.set(levname << ' ' << _giacgrp->decode(valore));
|
||||
*/
|
||||
gruppogiac(cf,s);
|
||||
}
|
||||
if (subcode=="GRUPPOART") {
|
||||
/*
|
||||
int lv=atoi(s.get());
|
||||
do {
|
||||
valore=_artlev->build_tabcode(relation()->lfile(LF_ANAMAG).get("CODART"),lv);
|
||||
} while (--lv>0 && valore=="");
|
||||
cf.set(_artgrp->decode(valore));
|
||||
*/
|
||||
gruppoart(cf,s);
|
||||
}
|
||||
if (subcode=="CODGRUPPOART") {
|
||||
int lv=atoi(s.get());
|
||||
do {
|
||||
valore=relation()->lfile(LF_ANAMAG).get("CODART");
|
||||
valore.cut(_artlev->packed_lenght(lv));
|
||||
} while (--lv>0 && valore=="");
|
||||
cf.set(valore);
|
||||
if (subcode=="GRUPPOGIAC") {
|
||||
/*
|
||||
int lv=atoi(s.get());
|
||||
do {
|
||||
valore=_giaclev->build_tabcode(relation()->lfile(LF_MAG).get("LIVELLO"),lv);
|
||||
} while (--lv>0 && valore=="");
|
||||
if (valore!="")
|
||||
levname=_giaclev->name(lv+1) ;
|
||||
else
|
||||
levname="giacenza";
|
||||
cf.set(levname << ' ' << _giacgrp->decode(valore));
|
||||
*/
|
||||
gruppogiac(cf,s);
|
||||
}
|
||||
if (subcode=="GRUPPOART") {
|
||||
/*
|
||||
int lv=atoi(s.get());
|
||||
do {
|
||||
valore=_artlev->build_tabcode(relation()->lfile(LF_ANAMAG).get("CODART"),lv);
|
||||
} while (--lv>0 && valore=="");
|
||||
cf.set(_artgrp->decode(valore));
|
||||
*/
|
||||
gruppoart(cf,s);
|
||||
}
|
||||
if (subcode=="CODGRUPPOART") {
|
||||
int lv=atoi(s.get());
|
||||
do {
|
||||
valore=relation()->lfile(LF_ANAMAG).get("CODART");
|
||||
valore.cut(_artlev->packed_lenght(lv));
|
||||
} while (--lv>0 && valore=="");
|
||||
cf.set(valore);
|
||||
|
||||
}
|
||||
if (subcode=="CATMER") {
|
||||
valore=relation()->lfile(_sottocatmer ? -401 : -400).get("S0");
|
||||
cf.set(valore);
|
||||
}
|
||||
if (subcode=="CODCATMER") {
|
||||
valore=relation()->lfile(LF_ANAMAG).get("GRMERC");
|
||||
valore.cut(_sottocatmer ? 5:3);
|
||||
cf.set(valore);
|
||||
}
|
||||
if (subcode=="LIVELLIGIAC") {
|
||||
int lv=_tolivgiac;
|
||||
valore="";
|
||||
do {
|
||||
const TString & piece = _giaclev->unpack_grpcode(relation()->lfile(LF_MAG).get("LIVELLO"),lv+1);
|
||||
if (piece.not_empty()) {
|
||||
if (valore.not_empty())
|
||||
valore << '/';
|
||||
valore << piece ;
|
||||
}
|
||||
} while (lv++<_giaclev->last_level());
|
||||
if (valore!="")
|
||||
levname=_giaclev->name(_tolivgiac+1);
|
||||
else
|
||||
levname="Giacenza";
|
||||
cf.set(levname << ' ' << valore);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
if (subcode=="CATMER") {
|
||||
valore=relation()->lfile(_sottocatmer ? -401 : -400).get("S0");
|
||||
cf.set(valore);
|
||||
}
|
||||
if (subcode=="CODCATMER") {
|
||||
valore=relation()->lfile(LF_ANAMAG).get("GRMERC");
|
||||
valore.cut(_sottocatmer ? 5:3);
|
||||
cf.set(valore);
|
||||
}
|
||||
if (subcode=="LIVELLIGIAC") {
|
||||
int lv=_tolivgiac;
|
||||
valore="";
|
||||
do {
|
||||
const TString & piece = _giaclev->unpack_grpcode(relation()->lfile(LF_MAG).get("LIVELLO"),lv+1);
|
||||
if (piece.not_empty()) {
|
||||
if (valore.not_empty())
|
||||
valore << '/';
|
||||
valore << piece ;
|
||||
}
|
||||
} while (lv++<_giaclev->last_level());
|
||||
if (valore!="")
|
||||
levname=_giaclev->name(_tolivgiac+1);
|
||||
else
|
||||
levname="Giacenza";
|
||||
cf.set(levname << ' ' << valore);
|
||||
}
|
||||
return TRUE;
|
||||
} else
|
||||
return TForm::validate(cf, s);
|
||||
return TForm::validate(cf, s);
|
||||
}
|
||||
|
||||
void TForm_stampemg::setcatmer(bool catmer,bool sottoc)
|
||||
{
|
||||
TForm_subsection &s=((TForm_subsection &)find_field('B',odd_page,"GRUPPI_CATMER"));
|
||||
TString cond("GRMERC");
|
||||
if (catmer)
|
||||
cond << "[1," << (sottoc ? 5 : 3) <<']';
|
||||
else
|
||||
cond ="CODART[1,1]";
|
||||
s.setcondition(cond,_strexpr);
|
||||
_sottocatmer=sottoc;
|
||||
TForm_subsection &s=((TForm_subsection &)find_field('B',odd_page,"GRUPPI_CATMER"));
|
||||
TString cond("GRMERC");
|
||||
if (catmer)
|
||||
cond << "[1," << (sottoc ? 5 : 3) <<']';
|
||||
else
|
||||
cond ="CODART[1,1]";
|
||||
s.setcondition(cond,_strexpr);
|
||||
_sottocatmer=sottoc;
|
||||
}
|
||||
|
||||
bool TForm_stampemg::setdett_perart(int fromlivart,int livart,int fromlivgiac,int livgiac,bool showmag, bool showdep)
|
||||
{
|
||||
find_field('B',odd_page,"H_MAGAZZINO").show(showmag && showdep);
|
||||
find_field('B',odd_page,"TOT_MAGAZZINO").show(showmag);
|
||||
find_field('B',odd_page,"H_DEPOSITO").show(FALSE);
|
||||
find_field('B',odd_page,"TOT_DEPOSITO").show(showdep);
|
||||
return setdettaglio(TRUE,fromlivart,livart,fromlivgiac,livgiac,showmag||showdep);
|
||||
find_field('B',odd_page,"H_MAGAZZINO").show(showmag && showdep);
|
||||
find_field('B',odd_page,"TOT_MAGAZZINO").show(showmag);
|
||||
find_field('B',odd_page,"H_DEPOSITO").show(FALSE);
|
||||
find_field('B',odd_page,"TOT_DEPOSITO").show(showdep);
|
||||
return setdettaglio(TRUE,fromlivart,livart,fromlivgiac,livgiac,showmag||showdep);
|
||||
}
|
||||
|
||||
bool TForm_stampemg::setdett_permag(int fromlivart,int livart,int fromlivgiac,int livgiac,bool showmag, bool showdep,bool showdett)
|
||||
{
|
||||
find_field('B',odd_page,"H_MAGAZZINO").show(showmag && (showdep) );
|
||||
find_field('B',odd_page,"TOT_MAGAZZINO").show(showmag);
|
||||
find_field('B',odd_page,"H_DEPOSITO").show(showdep && showdett);
|
||||
find_field('B',odd_page,"TOT_DEPOSITO").show(showdep);
|
||||
return setdettaglio(showdett,fromlivart,livart,fromlivgiac,livgiac,FALSE);
|
||||
find_field('B',odd_page,"H_MAGAZZINO").show(showmag && (showdep) );
|
||||
find_field('B',odd_page,"TOT_MAGAZZINO").show(showmag);
|
||||
find_field('B',odd_page,"H_DEPOSITO").show(showdep && showdett);
|
||||
find_field('B',odd_page,"TOT_DEPOSITO").show(showdep);
|
||||
return setdettaglio(showdett,fromlivart,livart,fromlivgiac,livgiac,FALSE);
|
||||
}
|
||||
|
||||
bool TForm_stampemg::setdettaglio(bool show, int fromlivart,int livart,int fromlivgiac,int livgiac,bool dettgiac)
|
||||
{
|
||||
_fromlivart=fromlivart;
|
||||
_fromlivgiac=fromlivgiac;
|
||||
_tolivart=livart;
|
||||
_tolivgiac=livgiac;
|
||||
// ***********
|
||||
int i, tolivart,tolivgiac;
|
||||
// abilita le sezioni dei livelli di codice
|
||||
TForm_subsection &s1=(TForm_subsection &)find_field('B',odd_page,"H_ARTICOLO");
|
||||
TForm_subsection &s2=(TForm_subsection &)find_field('B',odd_page,"TOT_ARTICOLO");
|
||||
if (fromlivgiac==0 && (livart==0 ||livart==_artlev->last_level())) {
|
||||
s1.show(show && livart<_artlev->last_level() || dettgiac);
|
||||
s2.show(show);
|
||||
} else {
|
||||
s1.hide();
|
||||
s2.hide();
|
||||
}
|
||||
tolivart =min(( livart ? livart :_artlev->last_level()),_artlev->last_level()-1) ;
|
||||
tolivgiac=livgiac ? livgiac :_giaclev->last_level();
|
||||
for (i=1; i<=FORM_MAXARTLEV; i++)
|
||||
{
|
||||
TString sname("TOT_GART");
|
||||
sname << i;
|
||||
TForm_subsection &s1=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
s1.show(show && i>=fromlivart && i<=tolivart && fromlivgiac==0);
|
||||
sname="H_GCODART";
|
||||
sname << i;
|
||||
TForm_subsection &s2=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
s2.show(show && i>=fromlivart &&
|
||||
(i<tolivart || (i==tolivart && (livart>tolivart || livgiac || dettgiac))) && fromlivgiac==0);
|
||||
}
|
||||
// abilita le sezioni del codice livelli giacenza
|
||||
for (i=1; i<=FORM_MAXGIACLEV; i++)
|
||||
{
|
||||
TString sname("TOT_GLIVGIAC");
|
||||
sname << i;
|
||||
TForm_subsection &s1=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
s1.show(show && i>=fromlivgiac && (i<=tolivgiac) && livart==0);
|
||||
sname="H_GLIVGIAC";
|
||||
sname << i;
|
||||
TForm_subsection &s2=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
s2.show(show && i>=fromlivgiac && (i<tolivgiac ||(i==tolivgiac && dettgiac)) && livart==0);
|
||||
}
|
||||
_fromlivart=fromlivart;
|
||||
_fromlivgiac=fromlivgiac;
|
||||
_tolivart=livart;
|
||||
_tolivgiac=livgiac;
|
||||
// ***********
|
||||
int i, tolivart,tolivgiac;
|
||||
// abilita le sezioni dei livelli di codice
|
||||
TForm_subsection &s1=(TForm_subsection &)find_field('B',odd_page,"H_ARTICOLO");
|
||||
TForm_subsection &s2=(TForm_subsection &)find_field('B',odd_page,"TOT_ARTICOLO");
|
||||
if (fromlivgiac==0 && (livart==0 ||livart==_artlev->last_level())) {
|
||||
s1.show(show && livart<_artlev->last_level() || dettgiac);
|
||||
s2.show(show);
|
||||
} else {
|
||||
s1.hide();
|
||||
s2.hide();
|
||||
}
|
||||
tolivart =min(( livart ? livart :_artlev->last_level()),_artlev->last_level()-1) ;
|
||||
tolivgiac=livgiac ? livgiac :_giaclev->last_level();
|
||||
for (i=1; i<=FORM_MAXARTLEV; i++)
|
||||
{
|
||||
TString sname("TOT_GART");
|
||||
sname << i;
|
||||
TForm_subsection &s1=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
s1.show(show && i>=fromlivart && i<=tolivart && fromlivgiac==0);
|
||||
sname="H_GCODART";
|
||||
sname << i;
|
||||
TForm_subsection &s2=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
s2.show(show && i>=fromlivart &&
|
||||
(i<tolivart || (i==tolivart && (livart>tolivart || livgiac || dettgiac))) && fromlivgiac==0);
|
||||
}
|
||||
// abilita le sezioni del codice livelli giacenza
|
||||
for (i=1; i<=FORM_MAXGIACLEV; i++)
|
||||
{
|
||||
TString sname("TOT_GLIVGIAC");
|
||||
sname << i;
|
||||
TForm_subsection &s1=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
s1.show(show && i>=fromlivgiac && (i<=tolivgiac) && livart==0);
|
||||
sname="H_GLIVGIAC";
|
||||
sname << i;
|
||||
TForm_subsection &s2=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
s2.show(show && i>=fromlivgiac && (i<tolivgiac ||(i==tolivgiac && dettgiac)) && livart==0);
|
||||
}
|
||||
|
||||
// ***********
|
||||
fromlivart = fromlivart ? fromlivart :1;
|
||||
fromlivgiac=fromlivgiac ? fromlivgiac :1;
|
||||
// codice livello giacenza
|
||||
for (i=fromlivgiac;i<=tolivgiac ; i++) {
|
||||
TString sname=("GRUPPI_LIVGIAC");
|
||||
sname << i;
|
||||
TForm_subsection &s=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
TString cond(s.condition());
|
||||
cond << "[1," << _giaclev->packed_lenght(i) <<']';
|
||||
s.setcondition(cond,_strexpr);
|
||||
}
|
||||
// sezioni livello codice
|
||||
for (i=fromlivart;i<=tolivart ; i++) {
|
||||
TString sname("GRUPPI_CODART");
|
||||
sname << i;
|
||||
TForm_subsection &s=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
TString cond(s.condition());
|
||||
cond << '[' << (i==1 ? 1:_artlev->packed_lenght(i-1))<<',' << _artlev->packed_lenght(i) <<']';
|
||||
s.setcondition(cond,_strexpr);
|
||||
}
|
||||
// ***********
|
||||
fromlivart = fromlivart ? fromlivart :1;
|
||||
fromlivgiac=fromlivgiac ? fromlivgiac :1;
|
||||
// codice livello giacenza
|
||||
for (i=fromlivgiac;i<=tolivgiac ; i++) {
|
||||
TString sname=("GRUPPI_LIVGIAC");
|
||||
sname << i;
|
||||
TForm_subsection &s=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
TString cond(s.condition());
|
||||
cond << "[1," << _giaclev->packed_lenght(i) <<']';
|
||||
s.setcondition(cond,_strexpr);
|
||||
}
|
||||
// sezioni livello codice
|
||||
for (i=fromlivart;i<=tolivart ; i++) {
|
||||
TString sname("GRUPPI_CODART");
|
||||
sname << i;
|
||||
TForm_subsection &s=(TForm_subsection &)find_field('B',odd_page,sname);
|
||||
TString cond(s.condition());
|
||||
cond << '[' << (i==1 ? 1:_artlev->packed_lenght(i-1))<<',' << _artlev->packed_lenght(i) <<']';
|
||||
s.setcondition(cond,_strexpr);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
TForm_stampemg::TForm_stampemg(const char *name,const char *code)
|
||||
: TForm(name,code)
|
||||
: TForm(name,code)
|
||||
{
|
||||
_giaclev= new TMag_livelli("FCG");
|
||||
_artlev= new TMag_livelli("FCA");
|
||||
_giacgrp= new TDecoder("GCG");
|
||||
_artgrp= new TDecoder("GCA");
|
||||
_fromlivgiac=_tolivgiac=0;
|
||||
_fromlivart=_tolivart=0;
|
||||
_giaclev= new TCodgiac_livelli();
|
||||
_artlev= new TCodart_livelli();
|
||||
_fromlivgiac=_tolivgiac=0;
|
||||
_fromlivart=_tolivart=0;
|
||||
}
|
||||
TForm_stampemg::~TForm_stampemg()
|
||||
{
|
||||
delete _giaclev;
|
||||
delete _artlev;
|
||||
delete _giacgrp;
|
||||
delete _artgrp;
|
||||
delete _giaclev;
|
||||
delete _artlev;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ int THead_lines_record::read(TBaseisamfile& f, word op, word lockop)
|
||||
}
|
||||
else
|
||||
{
|
||||
// nuovo oggetto: resetta tutto
|
||||
// nuovo oggetto: resetta tutto
|
||||
_nuovo = TRUE;
|
||||
destroy_rows();
|
||||
_rows->set_key((TRectype *)(line_key.dup())); // ok
|
||||
@ -492,7 +492,7 @@ int THead_lines_record::remove(TBaseisamfile& f) const
|
||||
TRegistro_std::TRegistro_std(const char* cod, int year) : TRectype(LF_TAB)
|
||||
{
|
||||
if (!read(cod, year))
|
||||
fatal_box("Il codice richiesto non è stato trovato nei registri");
|
||||
fatal_box("Il codice richiesto non è stato trovato nei registri");
|
||||
TTable itl("%ITL");
|
||||
itl.put("CODTAB",cod_intest());
|
||||
itl.read();
|
||||
@ -528,10 +528,10 @@ bool TRegistro_std::write(bool rewrite) const
|
||||
TTable reg("REG");
|
||||
|
||||
reg.set_curr((TRectype *)this);
|
||||
if (rewrite)
|
||||
err = reg.rewrite();
|
||||
else
|
||||
err = reg.write();
|
||||
if (rewrite)
|
||||
err = reg.rewrite();
|
||||
else
|
||||
err = reg.write();
|
||||
return err == NOERR;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user