Patch level : 10.1000

Files correlati     : db0.exe
Ricompilazione Demo : [ ]
Commento            :

Aggiunta descrizione di riga


git-svn-id: svn://10.65.10.50/branches/R_10_00@22124 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-05-16 13:22:58 +00:00
parent 023c36c757
commit b3a87f898d
7 changed files with 124 additions and 67 deletions

View File

@ -239,6 +239,8 @@ protected:
void load_memo(TMask& m, TToken_string& memo);
void remove_desc(const TMask& m);
public:
TRelation & relation() {return *_therel;}
};
@ -1238,7 +1240,6 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
switch(rec.num())
{
case LF_ANAMAG:
m.set(F_DESCOMP, rec.get(ANAMAG_DESCR));
if (m.get(F_UMEXPR).empty())
{
const TCodice_articolo art = o.get();
@ -1253,10 +1254,8 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
warning_box(FR("Attenzione l'articolo %s e' sospeso."), (const char *) rec.get(ANAMAG_CODART));
break;
case LF_DIST :
m.set(F_DESCOMP, rec.get("DESCR"));
break;
default :
m.set(F_DESCOMP, rec.get("S0"));
m.set(F_UMEXPR, rec.get("S6"));
break;
}
@ -1762,7 +1761,29 @@ int TDistinta_app::read(TMask& m)
FOR_EACH_SHEET_ROW(sheet, nrig, row)
{
sheet.check_row(nrig);
sheet.row(nrig).add(nrig+1, sheet.cid2index(F_SORT0));
row->add(nrig+1, sheet.cid2index(F_SORT0));
if (*row->get(sheet.cid2index(F_DESCOMP)) == '\0')
{
const char type = row->get(sheet.cid2index(F_TIPOCOMP))[0];
const TString cod = row->get(sheet.cid2index(F_CODART));
switch (type)
{
case 'A':
row->add(cache().get(LF_ANAMAG, cod, ANAMAG_DESCR), sheet.cid2index(F_DESCOMP));
break;
case 'L':
row->add(cache().get("LAV", cod, "S0"), sheet.cid2index(F_DESCOMP));
break;
case 'D':
row->add(cache().get(LF_DIST, cod, "DESCR"), sheet.cid2index(F_DESCOMP));
break;
case 'V':
row->add(cache().get("VAR", cod, "S0"), sheet.cid2index(F_DESCOMP));
default:
break;
}
}
}
TToken_string memo(1024, '\n');
@ -1817,10 +1838,42 @@ bool TDistinta_app::parms2rel(const TMask& m)
return TRUE;
}
void TDistinta_app::remove_desc(const TMask& m)
{
TSheet_field& sf = m.sfield(F_SHEET);
FOR_EACH_SHEET_ROW(sf, r, row)
{
const char type = row->get(sf.cid2index(F_TIPOCOMP))[0];
const TString cod = row->get(sf.cid2index(F_CODART));
TString descr;
switch (type)
{
case 'A':
descr = cache().get(LF_ANAMAG, cod, ANAMAG_DESCR);
break;
case 'L':
descr = cache().get("LAV", cod, "S0");
break;
case 'D':
descr = cache().get(LF_DIST, cod, "DESCR");
break;
case 'V':
descr = cache().get("VAR", cod, "S0");
default:
break;
}
if (descr == row->get(sf.cid2index(F_DESCOMP)))
row->add("",sf.cid2index(F_DESCOMP));
}
}
int TDistinta_app::write(const TMask& m)
{
parms2rel(m);
remove_desc(m);
int err = TRelation_application::write(m);
if (err == NOERR && get_relation()->lfile().get_bool("VIRTUALE"))
{
@ -1834,6 +1887,7 @@ int TDistinta_app::write(const TMask& m)
int TDistinta_app::rewrite(const TMask& m)
{
parms2rel(m);
remove_desc(m);
int err = TRelation_application::rewrite(m);
if (err == NOERR && get_relation()->lfile().get_bool("VIRTUALE"))
{

View File

@ -76,7 +76,6 @@
#define F_SORT4 117
#define F_SORT5 118
#define F_SORT0 119
#define F_DESROW 120
#define FU_UM 101
#define FU_FC 102

View File

@ -184,7 +184,6 @@ BEGIN
ITEM "Ord4"
ITEM "Ord5"
ITEM "Immiss."
ITEM "Descrizione Riga@50"
USE LF_RDIST KEY NRIG
INPUT CODDIST F_CODICE
FLAGS "A"
@ -248,13 +247,13 @@ LIST F_TIPOCOMP 1 12
BEGIN
PROMPT 2 1 "Tipo "
ITEM "A|Articolo"
MESSAGE SHOW,11@|HIDE,12@|HIDE,13@|HIDE,14@|ENABLE,F_UMEXPR
MESSAGE SHOW,11@|HIDE,12@|HIDE,13@|HIDE,14@|ENABLE,F_UMEXPR|ENABLE,11@|DISABLE,12@|DISABLE,13@|DISABLE,14@
ITEM "L|Lavorazione"
MESSAGE HIDE,11@|SHOW,12@|HIDE,13@|HIDE,14@|DISABLE,F_UMEXPR
MESSAGE HIDE,11@|SHOW,12@|HIDE,13@|HIDE,14@|DISABLE,F_UMEXPR|DISABLE,11@|ENABLE,12@|DISABLE,13@|DISABLE,14@
ITEM "D|Distinta"
MESSAGE HIDE,11@|HIDE,12@|SHOW,13@|HIDE,14@|ENABLE,F_UMEXPR
MESSAGE HIDE,11@|HIDE,12@|SHOW,13@|HIDE,14@|ENABLE,F_UMEXPR|DISABLE,11@|DISABLE,12@|ENABLE,13@|DISABLE,14@
ITEM "V|Variabile"
MESSAGE MESSAGE HIDE,11@|HIDE,12@|HIDE,13@|SHOW,14@|CLEAR,F_UMEXPR
MESSAGE HIDE,11@|HIDE,12@|HIDE,13@|SHOW,14@|CLEAR,F_UMEXPR|DISABLE,11@|DISABLE,12@|DISABLE,13@|ENABLE,14@
FIELD TIPO
END
@ -284,9 +283,8 @@ BEGIN
OUTPUT F_CODLAV CODTAB
OUTPUT F_DESLAV S0
CHECKTYPE REQUIRED
MESSAGE COPY,F_CODART
FLAGS "UH"
FIELD CODCOMP
FLAGS "UHD"
GROUP 12
END
@ -300,8 +298,8 @@ BEGIN
OUTPUT F_CODDIS CODDIST
OUTPUT F_DESDIS DESCR
CHECKTYPE REQUIRED
MESSAGE COPY,F_CODART
FLAGS "UH"
FIELD CODCOMP
FLAGS "UHD"
GROUP 13
END
@ -315,8 +313,8 @@ BEGIN
OUTPUT F_CODVAR CODTAB
OUTPUT F_DESVAR S0
CHECKTYPE REQUIRED
MESSAGE COPY,F_CODART
FLAGS "UH"
FIELD CODCOMP
FLAGS "UHD"
GROUP 14
END
@ -328,7 +326,7 @@ BEGIN
DISPLAY "Descrizione@50" DESCR
DISPLAY "Codice@20" CODART
COPY OUTPUT F_CODART
CHECKTYPE NORMAL
FIELD DESCR
GROUP 11
END
@ -340,8 +338,8 @@ BEGIN
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_CODLAV
CHECKTYPE NORMAL
FLAGS "UH"
FIELD DESCR
FLAGS "HD"
GROUP 12
END
@ -353,8 +351,8 @@ BEGIN
DISPLAY "Desrizione@50" DESCR
DISPLAY "Codice@20" CODDIST
COPY OUTPUT F_CODDIS
CHECKTYPE NORMAL
FLAGS "UH"
FIELD DESCR
FLAGS "HD"
GROUP 13
END
@ -362,12 +360,12 @@ STRING F_DESVAR 50
BEGIN
PROMPT 2 3 "Descrizione "
USE VAR KEY 2
INPUT S0 F_CODVAR
INPUT S0 F_DESVAR
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_CODVAR
CHECKTYPE NORMAL
FLAGS "UH"
FIELD DESCR
FLAGS "HD"
GROUP 14
END
@ -544,12 +542,6 @@ BEGIN
FLAGS "DU"
END
STRING F_DESROW 50
BEGIN
PROMPT 2 17 "Descr.riga "
FIELD DESCR
END
ENDPAGE
TOOLBAR "topbar" 0 0 0 2

View File

@ -12,6 +12,7 @@
#include "../mg/umart.h"
#include "../mg/rmovmag.h"
#include "../include/rdoc.h"
#include "rdist.h"
///////////////////////////////////////////////////////////
// Cache fattori di conversione
@ -758,6 +759,13 @@ const TString& TDistinta_tree::describe(const TCodice_articolo& codart) const
bool TDistinta_tree::describe(const TCodice_articolo& codart, TString& descr) const
{
static TRecord_cache __rdist_cache(LF_RDIST, 2);
TToken_string key = codart;
key.add(TToken_string(_root, '~').get(0));
descr = __rdist_cache.get(key, RDIST_DESCR);
if (descr.not_empty())
return TRUE;
descr = cache().get(LF_ANAMAG, codart, ANAMAG_DESCR);
if (descr.not_empty())
return TRUE;

14
db/dist.h Executable file
View File

@ -0,0 +1,14 @@
#define DIST_CODDIST "CODDIST"
#define DIST_VIRTUALE "VIRTUALE"
#define DIST_ARTPROD "ARTPROD"
#define DIST_ARTACQ "ARTACQ"
#define DIST_DESCR "DESCR"
#define DIST_NOTE "NOTE"
#define DIST_UMP "UMP"
#define DIST_PESO "PESO"
#define DIST_UM "UM"
#define DIST_PREZZO "PREZZO"
#define DIST_LEADTIME "LEADTIME"
#define DIST_LEADHOURS "LEADHOURS"
#define DIST_MASTER "MASTER"
#define DIST_PARAMETRI "PARAMETRI"

14
db/rdist.h Executable file
View File

@ -0,0 +1,14 @@
#define RDIST_CODDIST "CODDIST"
#define RDIST_NRIG "NRIG"
#define RDIST_TIPO "TIPO"
#define RDIST_CODCOMP "CODCOMP"
#define RDIST_LIVELLO "LIVELLO"
#define RDIST_TIPO_LIV "TIPO_LIV"
#define RDIST_DESCR "DESCR"
#define RDIST_UM "UM"
#define RDIST_EXPR "EXPR"
#define RDIST_SORT1 "SORT1"
#define RDIST_SORT2 "SORT2"
#define RDIST_SORT3 "SORT3"
#define RDIST_SORT4 "SORT4"
#define RDIST_SORT5 "SORT5"

View File

@ -3412,31 +3412,14 @@ bool TSheet_field::autoload_line(int i, const TRectype& rec)
{
TToken_string &row= this->row(i-1);
row = "";
// riempie le colonne dello sheet i cui campi hanno attributo "FIELD"
/*for (int f=FIRST_FIELD; f<=_last_column_id; f++) {
TFieldref const *dbfield=sheet_mask().field(f).field();
if (dbfield) {
row.add(dbfield->read(rec),cid2index(f));
}
// completa l'operazione con le funzioni definite dall'utente
} */
for (int j = 0; j < sheet_mask().fields(); j++)
row.cut(0);
for (short id = FIRST_FIELD; id <= _last_column_id; id++)
{
TMask_field& mf = sheet_mask().fld(j);
const short id = mf.dlg();
TMask_field& mf = sheet_mask().field(id);
const TFieldref* dbfield = mf.field();
if (dbfield)
{
if (id>=FIRST_FIELD && id<=_last_column_id)
{
row.add(dbfield->read(rec),cid2index(id));
}
else
{
mf.set(dbfield->read(rec));
}
}
if (dbfield)
row.add(dbfield->read(rec),id - FIRST_FIELD);
}
// completa l'operazione con le funzioni definite dall'utente
if (_userget)
@ -3448,18 +3431,13 @@ bool TSheet_field::autoload_line(int i, const TRectype& rec)
// Certified: ...under debug..
bool TSheet_field::autosave_line(int i,TRectype & rec)
{
for (int j = 0; j < sheet_mask().fields(); j++)
for (short id = FIRST_FIELD; id <= _last_column_id; id++)
{
TMask_field& mf = sheet_mask().fld(j);
const short id = mf.dlg();
const TFieldref* dbfield=mf.field();
if (dbfield)
{
if (id>=FIRST_FIELD && id<=_last_column_id)
dbfield->write(cell(i-1,cid2index(id)),rec);
else
dbfield->write(mf.get(), rec);
}
TMask_field& mf = sheet_mask().field(id);
const TFieldref* dbfield = mf.field();
if (dbfield)
dbfield->write(cell(i - 1, id - FIRST_FIELD), rec);
}
// completa l'operazione con le funzioni definite dall'utente
if (_userput)
@ -3478,9 +3456,7 @@ bool TSheet_field::autoload(const TRelation& rel)
destroy(); // cancella lo sheet
const int last_line = _linee_rec->last_row();
for (int i= 1; i <= last_line; i++)
{
autoload_line(i,_linee_rec->row(i, true));
}
return(0);
}