From 20c57478ad61eff18f53017ee20bd4a2b45cb317 Mon Sep 17 00:00:00 2001 From: luca83 Date: Fri, 27 May 2011 06:28:37 +0000 Subject: [PATCH] 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 --- lv/lvlib2.cpp | 304 ++++++++++++++++++++++++++++++++++++++++++++++++++ lv/lvlib2.h | 107 ++++++++++++++++++ 2 files changed, 411 insertions(+) create mode 100755 lv/lvlib2.cpp create mode 100755 lv/lvlib2.h diff --git a/lv/lvlib2.cpp b/lv/lvlib2.cpp new file mode 100755 index 000000000..ea02f5ef4 --- /dev/null +++ b/lv/lvlib2.cpp @@ -0,0 +1,304 @@ +#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(); +} \ No newline at end of file diff --git a/lv/lvlib2.h b/lv/lvlib2.h new file mode 100755 index 000000000..c66c3985b --- /dev/null +++ b/lv/lvlib2.h @@ -0,0 +1,107 @@ +#ifndef __LVLIB2_H +#define __LVLIB2_H + +#ifndef __ISAM_H +#include +#endif + +#ifndef __RECSET_H +#include +#endif + +#ifndef __TABMOD_H +#include +#endif + + ///////////////////////// + //// TLVANAMAG //// + ///////////////////////// + +//Classe TLVanamag +class TLVanamag : public TRectype +{ +private: + bool read(const char* chiave); + +public: + TLVanamag & operator =(const TLVanamag& ris) { TRectype::operator =(ris); return *this; } + TLVanamag & operator =(const TRectype& ris) { TRectype::operator =(ris); return *this; } + + //metodi get + const TString& chiave() const; + const int riempi_c_xs() const; + const int riempi_c_m() const; + const int riempi_c_xl() const; + const int normale_xs() const; + const int normale_m() const; + const int normale_xl() const; + const int riempi_s_xs() const; + const int riempi_s_m() const; + const int riempi_s_xl() const; + const int precedenza() const; + const int tipo_articolo() const; + const TString& descr_etichette() const; + + //metodi set + void set_chiave(const char* chiave); + void set_riempi_c_xs(const int qta); + void set_riempi_c_m(const int qta); + void set_riempi_c_xl(const int qta); + void set_normale_xs(const int qta); + void set_normale_m(const int qta); + void set_normale_xl(const int qta); + void set_riempi_s_xs(const int qta); + void set_riempi_s_m(const int qta); + void set_riempi_s_xl(const int qta); + void set_precedenza(const int qta); + void set_tipo_articolo(const int qta); + void set_descr_etichette(const char* descr); + + bool rewrite_write(); + + //costruttore + TLVanamag(const TRectype& r); + TLVanamag(const char* chiave); + TLVanamag(const TLVanamag& r); + TLVanamag(); + + virtual ~TLVanamag() {} +}; + +//Classe TLVclifo +class TLVclifo : public TRectype +{ +private: + bool read(const char* chiave); + +public: + TLVclifo & operator =(const TLVclifo& ris) { TRectype::operator =(ris); return *this; } + TLVclifo & operator =(const TRectype& ris) { TRectype::operator =(ris); return *this; } + + //metodi get + const TString& chiave() const; + const char tipocf() const; + const long codcf() const; + const char tipo_imballo() const; + const char riempimento() const; + const char art_sep() const; + + //metodi set + void set_chiave(const char tipocf, const long codcf); + void set_tipo_imballo(const char c); + void set_riempimento(const char c); + void set_art_sep(const bool b); + + bool rewrite_write(); + + //costruttore + TLVclifo(const TRectype& r); + TLVclifo(const char* chiave); + TLVclifo(const TLVclifo& r); + TLVclifo(const char tipocf, const long codcf); + TLVclifo(); + + virtual ~TLVclifo() {} +}; + +#endif