campo-sirio/lv/lvlib2.cpp
luca83 20c57478ad Patch level : 10.0 patch ???
Files correlati     : lvlib2
Ricompilazione Demo : [ ]
Commento            :
Classi per la gestione di lvanamag (&LV047) e lvclifo (&LV020)


git-svn-id: svn://10.65.10.50/branches/R_10_00@22172 c028cbd2-c16b-5b4b-a496-9718f37d4682
2011-05-27 06:28:37 +00:00

304 lines
4.6 KiB
C++
Executable File

#include "lvlib2.h"
/////////////////////////
//// TLVanamag ////
/////////////////////////
bool TLVanamag::read(const char* chiave)
{
TModule_table tabmod("&LV047");
tabmod.put("CODTAB", chiave);
int err = tabmod.read();
if (err != NOERR)
zero();
else
*this = tabmod.curr();
return err == NOERR;
}
bool TLVanamag::rewrite_write()
{
TLocalisamfile tabmod(LF_TABMOD);
TRectype& rec = tabmod.curr();
rec = *this;
int err = rec.rewrite_write(tabmod);
return err == NOERR;
}
const TString& TLVanamag::chiave() const
{
return get("CODTAB");
}
const int TLVanamag::riempi_c_xs() const
{
return get_int("I0");
}
const int TLVanamag::riempi_c_m() const
{
return get_int("I1");
}
const int TLVanamag::riempi_c_xl() const
{
return get_int("I2");
}
const int TLVanamag::normale_xs() const
{
return get_int("I3");
}
const int TLVanamag::normale_m() const
{
return get_int("I4");
}
const int TLVanamag::normale_xl() const
{
return get_int("I5");
}
const int TLVanamag::riempi_s_xs() const
{
return get_int("I6");
}
const int TLVanamag::riempi_s_m() const
{
return get_int("I7");
}
const int TLVanamag::riempi_s_xl() const
{
return get_int("I8");
}
const int TLVanamag::precedenza() const
{
return get_int("I9");
}
const int TLVanamag::tipo_articolo() const
{
return get_int("I10");
}
const TString& TLVanamag::descr_etichette() const
{
return get("S0");
}
void TLVanamag::set_chiave(const char* chiave)
{
put("CODTAB", chiave);
}
void TLVanamag::set_riempi_c_xs(const int qta)
{
put("I0", qta);
}
void TLVanamag::set_riempi_c_m(const int qta)
{
put("I1", qta);
}
void TLVanamag::set_riempi_c_xl(const int qta)
{
put("I2", qta);
}
void TLVanamag::set_normale_xs(const int qta)
{
put("I3", qta);
}
void TLVanamag::set_normale_m(const int qta)
{
put("I4", qta);
}
void TLVanamag::set_normale_xl(const int qta)
{
put("I5", qta);
}
void TLVanamag::set_riempi_s_xs(const int qta)
{
put("I6", qta);
}
void TLVanamag::set_riempi_s_m(const int qta)
{
put("I7", qta);
}
void TLVanamag::set_riempi_s_xl(const int qta)
{
put("I8", qta);
}
void TLVanamag::set_precedenza(const int prec)
{
put("I9", prec);
}
void TLVanamag::set_tipo_articolo(const int tpart)
{
put("I10", tpart);
}
void TLVanamag::set_descr_etichette(const char* descr)
{
put("S0", descr);
}
//costruttore
TLVanamag::TLVanamag(const TRectype& r)
: TRectype(r)
{
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
}
TLVanamag::TLVanamag(const char* chiave)
: TRectype(LF_TABMOD)
{
read(chiave);
}
TLVanamag::TLVanamag(const TLVanamag& r)
: TRectype(r)
{
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
}
TLVanamag::TLVanamag()
: TRectype(LF_TABMOD)
{
zero();
}
////////////////////////
//// TLVclifo ////
////////////////////////
bool TLVclifo::read(const char* chiave)
{
TModule_table tabmod("&LV020");
tabmod.put("CODTAB", chiave);
int err = tabmod.read();
if (err != NOERR)
zero();
else
*this = tabmod.curr();
return err == NOERR;
}
bool TLVclifo::rewrite_write()
{
TLocalisamfile tabmod(LF_TABMOD);
TRectype& rec = tabmod.curr();
rec = *this;
int err = rec.rewrite_write(tabmod);
return err == NOERR;
}
const TString& TLVclifo::chiave() const
{
return get("CODTAB");
}
const char TLVclifo::tipocf() const
{
return get("CODTAB")[0];
}
const long TLVclifo::codcf() const
{
return atol(get("CODTAB").mid(1));
}
const char TLVclifo::tipo_imballo() const
{
return get("S0")[0];
}
const char TLVclifo::riempimento() const
{
return get("S1")[0];
}
const char TLVclifo::art_sep() const
{
return get_bool("B0");
}
void TLVclifo::set_chiave(const char tipocf, const long codcf)
{
TString8 codtab;
codtab << tipocf << codcf;
put("CODTAB", codtab);
}
void TLVclifo::set_tipo_imballo(const char c)
{
put("S0", c);
}
void TLVclifo::set_riempimento(const char c)
{
put("S1", c);
}
void TLVclifo::set_art_sep(const bool b)
{
put("B0", b);
}
//costruttore
TLVclifo::TLVclifo(const TRectype& r)
: TRectype(r)
{
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
}
TLVclifo::TLVclifo(const char* chiave)
: TRectype(LF_TABMOD)
{
read(chiave);
}
TLVclifo::TLVclifo(const TLVclifo& r)
: TRectype(r)
{
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
}
TLVclifo::TLVclifo(const char tipocf, const long codcf)
: TRectype(LF_TABMOD)
{
TString8 codtab;
codtab << tipocf, codcf;
read(codtab);
}
TLVclifo::TLVclifo()
: TRectype(LF_TABMOD)
{
zero();
}