Esplosione tab
git-svn-id: svn://10.65.10.50/trunk@4775 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e419884ee0
commit
12939ce431
474
ve/ve2400.cpp
474
ve/ve2400.cpp
@ -18,14 +18,14 @@ class TMask_anamag: public TMask {
|
||||
|
||||
TMag_livelli * livelli_giac;// oggetto handler per i livelli di giacenza
|
||||
TMag_livelli * livelli_art;// oggetto handler per i livelli di anagraficca
|
||||
TMetachar * metac;
|
||||
int last_annogiac;
|
||||
int last_annosto;
|
||||
TMetachar * metac;
|
||||
int last_annogiac;
|
||||
int last_annosto;
|
||||
|
||||
static bool handle_codice(TMask_field &, KEY); // handler del campo codice articolo
|
||||
static bool handle_livart(TMask_field &, KEY); // handler dei campi codice articolo (livelli)
|
||||
static bool handle_anno(TMask_field &, KEY); // handler del campo anno delle giacenze
|
||||
static bool handle_stoanno(TMask_field &, KEY); // handler del campo anno delle giacenze
|
||||
static bool handle_codice(TMask_field &, KEY); // handler del campo codice articolo
|
||||
static bool handle_livart(TMask_field &, KEY); // handler dei campi codice articolo (livelli)
|
||||
static bool handle_anno(TMask_field &, KEY); // handler del campo anno delle giacenze
|
||||
static bool handle_stoanno(TMask_field &, KEY); // handler del campo anno delle giacenze
|
||||
static bool handle_sheet_um(TMask_field &, KEY); // handler dello sheet delle unità di misura
|
||||
static bool notify_sheet_um(TSheet_field & s, int r, KEY k); // handler dello sheet delle unità di misura
|
||||
static bool handle_sheet_deslin(TMask_field &, KEY); // handler dello sheet delle descrizioni in lingua
|
||||
@ -35,16 +35,16 @@ class TMask_anamag: public TMask {
|
||||
static bool handle_sheet_um_um(TMask_field &, KEY); // handler del campo UM dello sheet delle unità di misura
|
||||
static bool handle_sheet_um_price(TMask_field &, KEY); // handler del campo PREZZO e PREZZO_LORDO dello sheet delle unità di misura
|
||||
|
||||
static void sheetgiac_get(TSheet_field &fld_righe, int item);
|
||||
static void sheetgiac_put(TSheet_field &fld_righe, int item);
|
||||
static void sheetsto_get(TSheet_field &fld_righe, int item);
|
||||
static void sheetsto_put(TSheet_field &fld_righe, int item);
|
||||
static void sheetgiac_get(TSheet_field &fld_righe, int item);
|
||||
static void sheetgiac_put(TSheet_field &fld_righe, int item);
|
||||
static void sheetsto_get(TSheet_field &fld_righe, int item);
|
||||
static void sheetsto_put(TSheet_field &fld_righe, int item);
|
||||
|
||||
void clear_info_sto();
|
||||
bool info_sto_dirty();
|
||||
void clear_info_sto();
|
||||
bool info_sto_dirty();
|
||||
public:
|
||||
TMask_anamag(TRelation * rel, bool enable_mag, bool enable_artliv);
|
||||
virtual ~TMask_anamag();
|
||||
TMask_anamag(TRelation * rel, bool enable_mag, bool enable_artliv);
|
||||
virtual ~TMask_anamag();
|
||||
|
||||
};
|
||||
|
||||
@ -53,19 +53,19 @@ public:
|
||||
TMask_anamag::TMask_anamag(TRelation * rel, bool enable_mag, bool enable_artliv) : TMask("ve2400")
|
||||
{
|
||||
_rel=rel;
|
||||
// imposta il riconoscimento dei caratteri del formato dell'ultima parte dell'articolo
|
||||
TString80 format("");
|
||||
TTable _tabfca("FCA");
|
||||
if (_tabfca.last()==NOERR) {
|
||||
format = _tabfca.get("S1");
|
||||
}
|
||||
metac = new TMetachar(format);
|
||||
// imposta il puntatore al gestore livelli giacenze
|
||||
// imposta il riconoscimento dei caratteri del formato dell'ultima parte dell'articolo
|
||||
TString80 format("");
|
||||
TTable _tabfca("FCA");
|
||||
if (_tabfca.last()==NOERR) {
|
||||
format = _tabfca.get("S1");
|
||||
}
|
||||
metac = new TMetachar(format);
|
||||
// imposta il puntatore al gestore livelli giacenze
|
||||
livelli_giac= new TMag_livelli("FCG");
|
||||
livelli_art= new TMag_livelli("FCA");
|
||||
// imposta il valore dell'anno per le giacenze
|
||||
last_annogiac=-1;
|
||||
last_annosto=-1;
|
||||
// imposta il valore dell'anno per le giacenze
|
||||
last_annogiac=-1;
|
||||
last_annosto=-1;
|
||||
|
||||
set_handler(F_ANNO, handle_anno);
|
||||
set_handler(F_STOANNO, handle_stoanno);
|
||||
@ -87,125 +87,125 @@ TMask_anamag::TMask_anamag(TRelation * rel, bool enable_mag, bool enable_artliv)
|
||||
fm.set_handler(FS_PREZZO, handle_sheet_um_price);
|
||||
fm.set_handler(FS_PREZZO_LORDO, handle_sheet_um_price);
|
||||
|
||||
// Abilita la pagina delle giacenze
|
||||
if (enable_mag)
|
||||
{
|
||||
enable_page(4,TRUE);
|
||||
// setta i campi della maschera
|
||||
// per la pagina giacenze
|
||||
TSheet_field &fld_giac= (TSheet_field &)field(F_SHEETGIAC);
|
||||
// disabilita le colonne quando non sono utilizzati i livelli di giacenza
|
||||
for (int i=0; i<4; i++)
|
||||
{
|
||||
if (livelli_giac->enabled(1+i)) {
|
||||
fld_giac.sheet_mask().field(F_LIV1+i).show();
|
||||
fld_giac.set_column_header(fld_giac.cid2index(F_LIV1+i),livelli_giac->name(1+i));
|
||||
fld_giac.sheet_mask().field(F_LIV1+i).set_prompt(livelli_giac->name(1+i));
|
||||
} else {
|
||||
fld_giac.sheet_mask().field(F_LIV1+i).hide();
|
||||
fld_giac.delete_column(fld_giac.cid2index(F_LIV1+i));
|
||||
}
|
||||
}
|
||||
// disabilita la colonna numero distinte
|
||||
if (0) {
|
||||
fld_giac.delete_column(fld_giac.cid2index(F_NDIST));
|
||||
fld_giac.sheet_mask().field(F_NDIST).enable(FALSE);
|
||||
}
|
||||
// abilita la gestione delle ubicazioni (manuale/su tabella)
|
||||
if (1) {
|
||||
fld_giac.sheet_mask().field(F_UBICAZ).show(FALSE);
|
||||
fld_giac.sheet_mask().field(F_UBICAZD).show(FALSE);
|
||||
fld_giac.sheet_mask().field(F_UBICAZ2).show(TRUE);
|
||||
} else {
|
||||
fld_giac.sheet_mask().field(F_UBICAZ).show(TRUE);
|
||||
fld_giac.sheet_mask().field(F_UBICAZD).show(TRUE);
|
||||
fld_giac.sheet_mask().field(F_UBICAZ2).show(FALSE);
|
||||
}
|
||||
} else {
|
||||
enable_page(4,FALSE);
|
||||
}
|
||||
// abilita la visualizzazione dei campi distinti per i livelli articolo
|
||||
if (enable_artliv)
|
||||
{
|
||||
field(F_CODART).hide();
|
||||
field(F_GCA).hide();
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
// versione con campi predefiniti sulla maschera
|
||||
if (livelli_art->enabled(1+i)) {
|
||||
field(F_LIVART1+i).show();
|
||||
field(F_LIVART1+livelli_giac->last_level()-1).check_type(1+i==livelli_art->last_level() ? CHECK_NONE : CHECK_REQUIRED);
|
||||
((TEdit_field&)field(F_LIVART1+livelli_giac->last_level()-1)).set_width(livelli_art->code_lenght(1+i));
|
||||
set_handler(F_LIVART1+i, handle_livart);
|
||||
} else {
|
||||
field(F_LIVART1+i).hide();
|
||||
field(F_LIVART1+livelli_giac->last_level()-1).check_type(CHECK_NONE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (livelli_art->enabled())
|
||||
{
|
||||
set_handler(F_CODART, handle_codice);
|
||||
for (int i=0; i<9; i++)
|
||||
field(F_LIVART1+i).hide();
|
||||
} else
|
||||
if (!livelli_art->enabled(2))
|
||||
// .. nasconde il pulsante dei livelli
|
||||
field(F_GCA).hide();
|
||||
}
|
||||
// Abilita la pagina delle giacenze
|
||||
if (enable_mag)
|
||||
{
|
||||
enable_page(4,TRUE);
|
||||
// setta i campi della maschera
|
||||
// per la pagina giacenze
|
||||
TSheet_field &fld_giac= (TSheet_field &)field(F_SHEETGIAC);
|
||||
// disabilita le colonne quando non sono utilizzati i livelli di giacenza
|
||||
for (int i=0; i<4; i++)
|
||||
{
|
||||
if (livelli_giac->enabled(1+i)) {
|
||||
fld_giac.sheet_mask().field(F_LIV1+i).show();
|
||||
fld_giac.set_column_header(fld_giac.cid2index(F_LIV1+i),livelli_giac->name(1+i));
|
||||
fld_giac.sheet_mask().field(F_LIV1+i).set_prompt(livelli_giac->name(1+i));
|
||||
} else {
|
||||
fld_giac.sheet_mask().field(F_LIV1+i).hide();
|
||||
fld_giac.delete_column(fld_giac.cid2index(F_LIV1+i));
|
||||
}
|
||||
}
|
||||
// disabilita la colonna numero distinte
|
||||
if (0) {
|
||||
fld_giac.delete_column(fld_giac.cid2index(F_NDIST));
|
||||
fld_giac.sheet_mask().field(F_NDIST).enable(FALSE);
|
||||
}
|
||||
// abilita la gestione delle ubicazioni (manuale/su tabella)
|
||||
if (1) {
|
||||
fld_giac.sheet_mask().field(F_UBICAZ).show(FALSE);
|
||||
fld_giac.sheet_mask().field(F_UBICAZD).show(FALSE);
|
||||
fld_giac.sheet_mask().field(F_UBICAZ2).show(TRUE);
|
||||
} else {
|
||||
fld_giac.sheet_mask().field(F_UBICAZ).show(TRUE);
|
||||
fld_giac.sheet_mask().field(F_UBICAZD).show(TRUE);
|
||||
fld_giac.sheet_mask().field(F_UBICAZ2).show(FALSE);
|
||||
}
|
||||
} else {
|
||||
enable_page(4,FALSE);
|
||||
}
|
||||
// abilita la visualizzazione dei campi distinti per i livelli articolo
|
||||
if (enable_artliv)
|
||||
{
|
||||
field(F_CODART).hide();
|
||||
field(F_GCA).hide();
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
// versione con campi predefiniti sulla maschera
|
||||
if (livelli_art->enabled(1+i)) {
|
||||
field(F_LIVART1+i).show();
|
||||
field(F_LIVART1+livelli_giac->last_level()-1).check_type(1+i==livelli_art->last_level() ? CHECK_NONE : CHECK_REQUIRED);
|
||||
((TEdit_field&)field(F_LIVART1+livelli_giac->last_level()-1)).set_width(livelli_art->code_lenght(1+i));
|
||||
set_handler(F_LIVART1+i, handle_livart);
|
||||
} else {
|
||||
field(F_LIVART1+i).hide();
|
||||
field(F_LIVART1+livelli_giac->last_level()-1).check_type(CHECK_NONE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (livelli_art->enabled())
|
||||
{
|
||||
set_handler(F_CODART, handle_codice);
|
||||
for (int i=0; i<9; i++)
|
||||
field(F_LIVART1+i).hide();
|
||||
} else
|
||||
if (!livelli_art->enabled(2))
|
||||
// .. nasconde il pulsante dei livelli
|
||||
field(F_GCA).hide();
|
||||
}
|
||||
}
|
||||
|
||||
void TMask_anamag::sheetsto_put(TSheet_field &sheet_sto, int item)
|
||||
{
|
||||
if (item>1) return;
|
||||
TMask_anamag & m=(TMask_anamag & )sheet_sto.mask();
|
||||
TRectype & first_rec=sheet_sto.record()->row(1,TRUE);
|
||||
first_rec.put(STOMAG_ULTCOS1,m.get_real(F_STOULTCOS1 ));
|
||||
first_rec.put(STOMAG_ULTCOS2,m.get_real(F_STOULTCOS2 ));
|
||||
first_rec.put(STOMAG_COSTSTD,m.get_real(F_STOCOSTOSTD ));
|
||||
first_rec.put(STOMAG_COSTOMEDIO,m.get_real(F_STOCOSTOMEDIO ));
|
||||
first_rec.put(STOMAG_CATVEN,m.get(F_STOCATVEN ));
|
||||
first_rec.put(STOMAG_CODLISTINO,m.get(F_STOCODLIST));
|
||||
first_rec.put(STOMAG_PRZLIST,m.get(F_STOPREZZOLIST ));
|
||||
if (item>1) return;
|
||||
TMask_anamag & m=(TMask_anamag & )sheet_sto.mask();
|
||||
TRectype & first_rec=sheet_sto.record()->row(1,TRUE);
|
||||
first_rec.put(STOMAG_ULTCOS1,m.get_real(F_STOULTCOS1 ));
|
||||
first_rec.put(STOMAG_ULTCOS2,m.get_real(F_STOULTCOS2 ));
|
||||
first_rec.put(STOMAG_COSTSTD,m.get_real(F_STOCOSTOSTD ));
|
||||
first_rec.put(STOMAG_COSTOMEDIO,m.get_real(F_STOCOSTOMEDIO ));
|
||||
first_rec.put(STOMAG_CATVEN,m.get(F_STOCATVEN ));
|
||||
first_rec.put(STOMAG_CODLISTINO,m.get(F_STOCODLIST));
|
||||
first_rec.put(STOMAG_PRZLIST,m.get(F_STOPREZZOLIST ));
|
||||
}
|
||||
|
||||
void TMask_anamag::sheetsto_get(TSheet_field &sheet_sto, int item)
|
||||
{
|
||||
if (item>1) return;
|
||||
TMask_anamag & m=(TMask_anamag &) sheet_sto.mask();
|
||||
TRectype & first_rec=sheet_sto.record()->row(1,TRUE);
|
||||
m.set(F_STOULTCOS1, first_rec.get_real(STOMAG_ULTCOS1));
|
||||
m.set(F_STOULTCOS2, first_rec.get_real(STOMAG_ULTCOS2 ));
|
||||
m.set(F_STOCOSTOSTD, first_rec.get_real( STOMAG_COSTSTD ));
|
||||
m.set(F_STOCOSTOMEDIO, first_rec.get_real(STOMAG_COSTOMEDIO));
|
||||
m.set(F_STOCATVEN , first_rec.get(STOMAG_CATVEN));
|
||||
m.set(F_STOCODLIST , first_rec.get(STOMAG_CODLISTINO));
|
||||
m.set(F_STOPREZZOLIST ,first_rec.get(STOMAG_PRZLIST));
|
||||
if (item>1) return;
|
||||
TMask_anamag & m=(TMask_anamag &) sheet_sto.mask();
|
||||
TRectype & first_rec=sheet_sto.record()->row(1,TRUE);
|
||||
m.set(F_STOULTCOS1, first_rec.get_real(STOMAG_ULTCOS1));
|
||||
m.set(F_STOULTCOS2, first_rec.get_real(STOMAG_ULTCOS2 ));
|
||||
m.set(F_STOCOSTOSTD, first_rec.get_real( STOMAG_COSTSTD ));
|
||||
m.set(F_STOCOSTOMEDIO, first_rec.get_real(STOMAG_COSTOMEDIO));
|
||||
m.set(F_STOCATVEN , first_rec.get(STOMAG_CATVEN));
|
||||
m.set(F_STOCODLIST , first_rec.get(STOMAG_CODLISTINO));
|
||||
m.set(F_STOPREZZOLIST ,first_rec.get(STOMAG_PRZLIST));
|
||||
}
|
||||
|
||||
bool TMask_anamag::info_sto_dirty()
|
||||
{
|
||||
return
|
||||
field(F_STOULTCOS1).dirty() ||
|
||||
field(F_STOULTCOS2).dirty() ||
|
||||
field(F_STOCOSTOSTD).dirty() ||
|
||||
field(F_STOCOSTOMEDIO).dirty()||
|
||||
field(F_STOCATVEN ).dirty()||
|
||||
field(F_STOCODLIST).dirty()||
|
||||
field(F_STOPREZZOLIST).dirty();
|
||||
return
|
||||
field(F_STOULTCOS1).dirty() ||
|
||||
field(F_STOULTCOS2).dirty() ||
|
||||
field(F_STOCOSTOSTD).dirty() ||
|
||||
field(F_STOCOSTOMEDIO).dirty()||
|
||||
field(F_STOCATVEN ).dirty()||
|
||||
field(F_STOCODLIST).dirty()||
|
||||
field(F_STOPREZZOLIST).dirty();
|
||||
}
|
||||
|
||||
|
||||
void TMask_anamag::clear_info_sto()
|
||||
{
|
||||
reset(F_STOULTCOS1);
|
||||
reset(F_STOULTCOS2);
|
||||
reset(F_STOCOSTOSTD);
|
||||
reset(F_STOCOSTOMEDIO);
|
||||
reset(F_STOCATVEN );
|
||||
reset(F_STOCODLIST);
|
||||
reset(F_STOPREZZOLIST);
|
||||
reset(F_STOULTCOS1);
|
||||
reset(F_STOULTCOS2);
|
||||
reset(F_STOCOSTOSTD);
|
||||
reset(F_STOCOSTOMEDIO);
|
||||
reset(F_STOCATVEN );
|
||||
reset(F_STOCODLIST);
|
||||
reset(F_STOPREZZOLIST);
|
||||
}
|
||||
|
||||
|
||||
@ -222,29 +222,29 @@ bool TMask_anamag::handle_codice(TMask_field &fld, KEY k)
|
||||
TMask_anamag &mask=(TMask_anamag &)fld.mask();
|
||||
|
||||
|
||||
TString codepart;
|
||||
if (k == K_TAB && !fld.get().blank()) {
|
||||
int l;
|
||||
TTable _tabgrp("GCA");
|
||||
for (l=1; l<mask.livelli_art->last_level(); l++) {
|
||||
codepart="";
|
||||
codepart << l << mask.livelli_art->unpack_grpcode(fld.get(),l);
|
||||
_tabgrp.zero();
|
||||
_tabgrp.put("CODTAB", codepart);
|
||||
if (_tabgrp.read()!=NOERR) {
|
||||
fld.error_box("'%s' non appartiene a '%s'",(const char *)codepart.mid(1),(const char *)mask.livelli_art->name(l));
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
codepart=mask.livelli_art->unpack_grpcode(fld.get(),mask.livelli_art->last_level());
|
||||
if (codepart.blank()) {
|
||||
fld.error_box("Il codice articolo non può essere vuoto");
|
||||
return(FALSE);
|
||||
}
|
||||
if (!mask.metac->recognized(codepart)) {
|
||||
fld.error_box("Il codice articolo non corrisponde al formato previsto \n('%s' ?? '%s')",(const char *)codepart,(const char *)mask.metac->language());
|
||||
return(FALSE);
|
||||
}
|
||||
TString codepart;
|
||||
if (k == K_TAB && !fld.get().blank()) {
|
||||
int l;
|
||||
TTable _tabgrp("GCA");
|
||||
for (l=1; l<mask.livelli_art->last_level(); l++) {
|
||||
codepart="";
|
||||
codepart << l << mask.livelli_art->unpack_grpcode(fld.get(),l);
|
||||
_tabgrp.zero();
|
||||
_tabgrp.put("CODTAB", codepart);
|
||||
if (_tabgrp.read()!=NOERR) {
|
||||
fld.error_box("'%s' non appartiene a '%s'",(const char *)codepart.mid(1),(const char *)mask.livelli_art->name(l));
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
codepart=mask.livelli_art->unpack_grpcode(fld.get(),mask.livelli_art->last_level());
|
||||
if (codepart.blank()) {
|
||||
fld.error_box("Il codice articolo non può essere vuoto");
|
||||
return(FALSE);
|
||||
}
|
||||
if (!mask.metac->recognized(codepart)) {
|
||||
fld.error_box("Il codice articolo non corrisponde al formato previsto \n('%s' ?? '%s')",(const char *)codepart,(const char *)mask.metac->language());
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
@ -252,19 +252,19 @@ bool TMask_anamag::handle_codice(TMask_field &fld, KEY k)
|
||||
// HANDLER DEL CODICE: controlla la corrispondenza al formato previsto
|
||||
bool TMask_anamag::handle_livart(TMask_field &fld, KEY k)
|
||||
{
|
||||
if (k == K_TAB && fld.focusdirty())
|
||||
{
|
||||
TMask_anamag & m=(TMask_anamag & )fld.mask();
|
||||
TString s(m.field(F_CODART).get());
|
||||
m.livelli_art->pack_grpcode(s,fld.get(),fld.dlg()-F_LIVART1+1);
|
||||
m.field(F_CODART).set(s);
|
||||
if (fld.dlg()-F_LIVART1+1==m.livelli_art->last_level() && fld.get().blank()) {
|
||||
|
||||
fld.error_box("Il codice articolo non può essere lasciato in bianco");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
if (k == K_TAB && fld.focusdirty())
|
||||
{
|
||||
TMask_anamag & m=(TMask_anamag & )fld.mask();
|
||||
TString s(m.field(F_CODART).get());
|
||||
m.livelli_art->pack_grpcode(s,fld.get(),fld.dlg()-F_LIVART1+1);
|
||||
m.field(F_CODART).set(s);
|
||||
if (fld.dlg()-F_LIVART1+1==m.livelli_art->last_level() && fld.get().blank()) {
|
||||
|
||||
fld.error_box("Il codice articolo non può essere lasciato in bianco");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TMask_anamag::handle_anno(TMask_field &fld, KEY k)
|
||||
@ -272,24 +272,24 @@ bool TMask_anamag::handle_anno(TMask_field &fld, KEY k)
|
||||
TMask_anamag &mask=(TMask_anamag &)fld.mask();
|
||||
|
||||
|
||||
if (k == K_TAB)
|
||||
if (k == K_TAB)
|
||||
{
|
||||
TSheet_field &fld_giac= (TSheet_field &)mask.field(F_SHEETGIAC);
|
||||
TSheet_field &fld_giac= (TSheet_field &)mask.field(F_SHEETGIAC);
|
||||
|
||||
if (mask.last_annogiac>0 && mask.last_annogiac!=fld.mask().get_int(F_ANNO)) {
|
||||
if (fld_giac.dirty() && handle_sheetgiac(fld_giac,K_ENTER)) {
|
||||
if (fld.yesno_box("Vuoi salvare le righe di giacenza per l'anno %d",mask.last_annogiac )) {
|
||||
fld_giac.autosave(*mask._rel);
|
||||
fld_giac.record()->rewrite();
|
||||
}
|
||||
}
|
||||
mask.field(F_ANNORIF).set(fld.get());
|
||||
// rilegge le giacenze relative a quell'anno ed aggiorna il layout
|
||||
fld_giac.record()->read(*fld_giac.putkey(*mask._rel));
|
||||
fld_giac.autoload(*mask._rel);
|
||||
fld_giac.force_update();
|
||||
}
|
||||
mask.last_annogiac=mask.get_int(F_ANNO);
|
||||
if (mask.last_annogiac>0 && mask.last_annogiac!=fld.mask().get_int(F_ANNO)) {
|
||||
if (fld_giac.dirty() && handle_sheetgiac(fld_giac,K_ENTER)) {
|
||||
if (fld.yesno_box("Vuoi salvare le righe di giacenza per l'anno %d",mask.last_annogiac )) {
|
||||
fld_giac.autosave(*mask._rel);
|
||||
fld_giac.record()->rewrite();
|
||||
}
|
||||
}
|
||||
mask.field(F_ANNORIF).set(fld.get());
|
||||
// rilegge le giacenze relative a quell'anno ed aggiorna il layout
|
||||
fld_giac.record()->read(*fld_giac.putkey(*mask._rel));
|
||||
fld_giac.autoload(*mask._rel);
|
||||
fld_giac.force_update();
|
||||
}
|
||||
mask.last_annogiac=mask.get_int(F_ANNO);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
@ -299,29 +299,29 @@ bool TMask_anamag::handle_stoanno(TMask_field &fld, KEY k)
|
||||
{
|
||||
TMask_anamag &mask=(TMask_anamag &)fld.mask();
|
||||
|
||||
if (k == K_TAB)
|
||||
if (k == K_TAB)
|
||||
{
|
||||
TSheet_field &fld_stomag= (TSheet_field &)fld.mask().field(F_SHEETSTOMAG);
|
||||
TSheet_field &fld_stomag= (TSheet_field &)fld.mask().field(F_SHEETSTOMAG);
|
||||
|
||||
if (mask.last_annosto>0 && mask.last_annosto!=fld.mask().get_int(F_STOANNO))
|
||||
{
|
||||
if ((mask.field(F_SHEETSTOMAG).dirty() || mask.info_sto_dirty()) &&
|
||||
handle_sheetstomag(fld_stomag,K_ENTER) &&
|
||||
fld_stomag.items()>0 )
|
||||
{
|
||||
if (fld.yesno_box("Vuoi salvare le righe di storico per l'anno %d",mask.last_annosto)) {
|
||||
fld_stomag.autosave(*mask._rel);
|
||||
fld_stomag.record()->write(TRUE);
|
||||
}
|
||||
}
|
||||
mask.field(F_STOANNORIF).set(fld.get());
|
||||
// rilegge lo storico relativo a quell'anno ed aggiorna il layout
|
||||
mask.clear_info_sto();
|
||||
fld_stomag.record()->read(*fld_stomag.putkey(*mask._rel));
|
||||
fld_stomag.autoload(*mask._rel);
|
||||
fld_stomag.force_update();
|
||||
}
|
||||
mask.last_annosto=mask.get_int(F_STOANNO);
|
||||
if (mask.last_annosto>0 && mask.last_annosto!=fld.mask().get_int(F_STOANNO))
|
||||
{
|
||||
if ((mask.field(F_SHEETSTOMAG).dirty() || mask.info_sto_dirty()) &&
|
||||
handle_sheetstomag(fld_stomag,K_ENTER) &&
|
||||
fld_stomag.items()>0 )
|
||||
{
|
||||
if (fld.yesno_box("Vuoi salvare le righe di storico per l'anno %d",mask.last_annosto)) {
|
||||
fld_stomag.autosave(*mask._rel);
|
||||
fld_stomag.record()->write(TRUE);
|
||||
}
|
||||
}
|
||||
mask.field(F_STOANNORIF).set(fld.get());
|
||||
// rilegge lo storico relativo a quell'anno ed aggiorna il layout
|
||||
mask.clear_info_sto();
|
||||
fld_stomag.record()->read(*fld_stomag.putkey(*mask._rel));
|
||||
fld_stomag.autoload(*mask._rel);
|
||||
fld_stomag.force_update();
|
||||
}
|
||||
mask.last_annosto=mask.get_int(F_STOANNO);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
@ -434,10 +434,10 @@ bool TMask_anamag::handle_sheetgiac(TMask_field &fld, KEY k)
|
||||
|
||||
if (codgiac.empty())
|
||||
return error_box("I codici delle giacenze non possono essere vuoti");
|
||||
// aggiunge all'hash table l'elemento 0 (primo) della riga corrente e controlla che non esista già
|
||||
// aggiunge all'hash table l'elemento 0 (primo) della riga corrente e controlla che non esista già
|
||||
if (v.add(codgiac))
|
||||
return error_box("Esistono due righe con lo stesso codice di giacenza");
|
||||
// ordina le righe per livello+codmag
|
||||
// ordina le righe per livello+codmag
|
||||
}
|
||||
// ordina le righe per livello+codmag
|
||||
// f.rows_array().sort();
|
||||
@ -450,23 +450,23 @@ bool TMask_anamag::handle_sheetstomag(TMask_field &fld, KEY k)
|
||||
{
|
||||
if (k==K_ENTER)
|
||||
{
|
||||
TSheet_field & f=(TSheet_field &)fld;
|
||||
const int items = f.items();
|
||||
TSheet_field & f=(TSheet_field &)fld;
|
||||
const int items = f.items();
|
||||
|
||||
if (items > 0)
|
||||
{
|
||||
TMask &m= f.mask(); // prende la maschere d'origine del campo
|
||||
TAssoc_array v; // istanzia l'hash table per il controllo di univocità
|
||||
for (int i= 0; i< items; i++)
|
||||
{
|
||||
TString codeser(f.cell(i,F_STOANNOES-FIRST_FIELD));
|
||||
if (codeser.empty())
|
||||
return error_box("I codici degli esercizi non possono essere vuoti");
|
||||
// aggiunge all'hash table l'elemento 0 (primo) della riga corrente e controlla che non esista già
|
||||
if (v.add(codeser))
|
||||
return error_box("La composizione delle rimananenze deve far riferimento a esercizi tutti diversi tra loro");
|
||||
}
|
||||
}
|
||||
if (items > 0)
|
||||
{
|
||||
TMask &m= f.mask(); // prende la maschere d'origine del campo
|
||||
TAssoc_array v; // istanzia l'hash table per il controllo di univocità
|
||||
for (int i= 0; i< items; i++)
|
||||
{
|
||||
TString codeser(f.cell(i,F_STOANNOES-FIRST_FIELD));
|
||||
if (codeser.empty())
|
||||
return error_box("I codici degli esercizi non possono essere vuoti");
|
||||
// aggiunge all'hash table l'elemento 0 (primo) della riga corrente e controlla che non esista già
|
||||
if (v.add(codeser))
|
||||
return error_box("La composizione delle rimananenze deve far riferimento a esercizi tutti diversi tra loro");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
@ -572,13 +572,13 @@ void TMask_anamag::sheetgiac_get(TSheet_field &fld_righe, int item)
|
||||
{
|
||||
TMask_anamag &m=(TMask_anamag &)fld_righe.mask();
|
||||
// prende il record della riga corrente dal record array
|
||||
TRectype &rec= fld_righe.record()->row(item, TRUE);
|
||||
TRectype &rec= fld_righe.record()->row(item, TRUE);
|
||||
TToken_string &row= fld_righe.row(item-1);
|
||||
// codici di livello
|
||||
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,1),fld_righe.cid2index(F_LIV1) );
|
||||
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,2),fld_righe.cid2index(F_LIV2) );
|
||||
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,2),fld_righe.cid2index(F_LIV2) );
|
||||
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,3),fld_righe.cid2index(F_LIV3) );
|
||||
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,4),fld_righe.cid2index(F_LIV4) );
|
||||
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVELLO") ,4),fld_righe.cid2index(F_LIV4) );
|
||||
}
|
||||
|
||||
|
||||
@ -588,23 +588,23 @@ void TMask_anamag::sheetgiac_put(TSheet_field &fld_righe, int item)
|
||||
TMask_anamag &m=(TMask_anamag &)fld_righe.mask();
|
||||
TToken_string &row= fld_righe.row(item-1);
|
||||
|
||||
TRectype &recrighe= fld_righe.record()->row(item, TRUE);
|
||||
// codici livello
|
||||
if (m.livelli_giac->enabled()) {
|
||||
TString16 packedcode;
|
||||
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV1)),1);
|
||||
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV2)),2);
|
||||
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV3)),3);
|
||||
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV4)),4);
|
||||
recrighe.put("LIVELLO", packedcode);
|
||||
}
|
||||
TRectype &recrighe= fld_righe.record()->row(item, TRUE);
|
||||
// codici livello
|
||||
if (m.livelli_giac->enabled()) {
|
||||
TString16 packedcode;
|
||||
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV1)),1);
|
||||
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV2)),2);
|
||||
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV3)),3);
|
||||
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV4)),4);
|
||||
recrighe.put("LIVELLO", packedcode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ******************************
|
||||
// applicazione
|
||||
class TAnagrafica_magazzino : public TRelation_application {
|
||||
TMask_anamag *_msk; // maschera principale
|
||||
TMask_anamag *_msk; // maschera principale
|
||||
TRelation *_rel; // relazione principale di un solo file (anagrafiche di magazzino)
|
||||
TRecord_array *_linee_rec_um; // record array di accoppiamento delle unità di misura
|
||||
TRecord_array *_linee_rec_deslin; // record array di accoppiamento delle descrizioni in lingua con il primo sheet
|
||||
@ -677,8 +677,8 @@ int TAnagrafica_magazzino::read(TMask& m)
|
||||
((TToken_string &)fld_um.row(0)).add("1",1); // forza la prima unita' di misura a 1
|
||||
fld_um.disable_cell(0, 1); // mette in sola lettura il secondo campo della prima riga (il fattore di conversione della prima U.M. è fisso a 1)
|
||||
fld_um.force_update(0); // aggiorna lo stato della riga 0
|
||||
|
||||
// preleva le info di storico (prezzi, ultcosti, ecc)
|
||||
|
||||
// preleva le info di storico (prezzi, ultcosti, ecc)
|
||||
} // no errors in TRelation_application::read(m);
|
||||
return err;
|
||||
}
|
||||
@ -691,12 +691,12 @@ bool TAnagrafica_magazzino::remove()
|
||||
|
||||
int TAnagrafica_magazzino::write(const TMask& m)
|
||||
{
|
||||
return TRelation_application::write(m);
|
||||
return TRelation_application::write(m);
|
||||
}
|
||||
|
||||
int TAnagrafica_magazzino::rewrite(const TMask& m)
|
||||
{
|
||||
return TRelation_application::rewrite(m);
|
||||
return TRelation_application::rewrite(m);
|
||||
}
|
||||
|
||||
void TAnagrafica_magazzino::init_insert_mode(TMask &m)
|
||||
|
Loading…
x
Reference in New Issue
Block a user