diff --git a/db/db0.cpp b/db/db0.cpp new file mode 100755 index 000000000..9775f263e --- /dev/null +++ b/db/db0.cpp @@ -0,0 +1,14 @@ +#include + +#include "db0.h" + +int main(int argc, char** argv) +{ + int n = argc > 1 ? atoi(argv[1]+1) : 0; + switch(n) + { + default: db0100(argc, argv); break; + } + exit(0); + return 0; +} \ No newline at end of file diff --git a/db/db0.h b/db/db0.h new file mode 100755 index 000000000..381aa76d9 --- /dev/null +++ b/db/db0.h @@ -0,0 +1,6 @@ +#ifndef __DB0_H +#define __DB0_H + +int db0100(int argc, char* argv[]); + +#endif diff --git a/db/db0.url b/db/db0.url new file mode 100755 index 000000000..a8c25c557 --- /dev/null +++ b/db/db0.url @@ -0,0 +1,2 @@ +#include + diff --git a/db/db0100.cpp b/db/db0100.cpp new file mode 100755 index 000000000..c19c08305 --- /dev/null +++ b/db/db0100.cpp @@ -0,0 +1,742 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "../mg/anamag.h" +#include "../mg/umart.h" + +#include "db0100a.h" + +/////////////////////////////////////////////////////////// +// Funzione di richiesta stringa che andra' in libreria +/////////////////////////////////////////////////////////// + +bool query_string(const char* prompt, TString& str, int width = 50, const char* flags= "") +{ + int maskwidth = width+2; + if (maskwidth < 26) maskwidth = 26; + TMask m(prompt, 1, maskwidth, 5); + m.add_string(DLG_USER, 0, "", 1, 1, width, flags); + m.add_button(DLG_CANCEL, 0, "", -12, -1, 10, 2); + m.add_button(DLG_OK, 0, "", -22, -1, 10, 2); + m.set(DLG_USER, str); + bool ok = m.run() == K_ENTER; + if (ok) + str = m.get(DLG_USER); + return ok; +} + +/////////////////////////////////////////////////////////// +// TDistinta_expr +/////////////////////////////////////////////////////////// + +class TDistinta_expr : public TExpression +{ +protected: + virtual bool print_error(const char* msg) const; + +public: + TDistinta_expr(); + virtual ~TDistinta_expr() { } +}; + +bool TDistinta_expr::print_error(const char* msg) const +{ + return error_box(msg); +} + +TDistinta_expr::TDistinta_expr() + : TExpression(_numexpr, FALSE) +{ +} + +/////////////////////////////////////////////////////////// +// TDistinta_tree +/////////////////////////////////////////////////////////// + +class TDistinta_tree : public TBidirectional_tree +{ + TLocalisamfile* _rdist; + TString _root; + TToken_string _path; + +protected: + + TLocalisamfile& file() const; + void add_child(); + void kill_child(); + bool is_cyclic() const; + + virtual void node2id(const TObject* node, TString& id) const; + +public: + virtual bool goto_root(); + virtual bool goto_firstson(); + virtual bool goto_rbrother(); + virtual bool goto_node(const TString &id); + virtual bool has_son() const; + virtual bool has_rbrother() const; + virtual bool has_root() const; + virtual bool has_father() const; + virtual bool has_lbrother() const; + virtual bool goto_father(); + virtual bool goto_lbrother(); + virtual bool get_description(TString& desc) const; + virtual TImage* image(bool selected) const; + virtual TObject* curr_node() const; + + bool set_root(const char* str); + long find_node(const char* str, word flags = SCAN_PRE_ORDER); + + TDistinta_tree(); + virtual ~TDistinta_tree(); +}; + +TLocalisamfile& TDistinta_tree::file() const +{ + if (_rdist == NULL) + ((TDistinta_tree*)this)->_rdist = new TLocalisamfile(LF_RDIST); + return *_rdist; +} + +bool TDistinta_tree::goto_node(const TString &id) +{ + _path = id; + return TRUE; +} + +struct TFind_node_data +{ + TString _id; + long _count; +}; + +HIDDEN bool find_node_callback(TTree& tree, void* jolly, word flags) +{ + if (flags == SCAN_PRE_ORDER) + { + TFind_node_data& data = *(TFind_node_data*)jolly; + data._count++; + TToken_string id; tree.curr_id(id); + if (data._id == id.get(-2)) + return TRUE; + } + return FALSE; +} + +long TDistinta_tree::find_node(const char* str, word flags) +{ + if (goto_root()) + { + TFind_node_data fnd; + fnd._id = str; + fnd._count = 0; + if (scan_breadth_first(find_node_callback, &fnd, flags)) + return fnd._count; + } + return 0L; +} + +void TDistinta_tree::node2id(const TObject* node, TString& id) const +{ + id = *(TToken_string*)node; +} + +TObject* TDistinta_tree::curr_node() const +{ + return &((TDistinta_tree*)this)->_path; +} + +bool TDistinta_tree::get_description(TString& desc) const +{ + _path.get(-2, desc); + return TRUE; +} + +TImage* TDistinta_tree::image(bool selected) const +{ + TImage* img; + if (is_cyclic()) + img = get_res_image(BMP_STOP); + else + img = TBidirectional_tree::image(selected); + return img; +} + +bool TDistinta_tree::set_root(const char* str) +{ + TLocalisamfile dist(LF_DIST); + dist.put("CODDIST", str); + const bool ok = dist.read() == NOERR; + if (ok) + { + _root = str; + shrink_all(); + goto_root(); + } + return ok; +} + +bool TDistinta_tree::has_root() const +{ + return _root.not_empty(); +} + +bool TDistinta_tree::goto_root() +{ + const bool ok = has_root(); + if (ok) + _path = _root; + return ok; +} + +bool TDistinta_tree::is_cyclic() const +{ + bool cyclic = FALSE; + const int last = _path.items()-1; + if (last >= 2) + { + TString80 mycod; _path.get(last, mycod); + TString80 cod; + for (int i = last-2; i >= 0; i -= 2) + { + _path.get(i, cod); + if (cod == mycod) + { + cyclic = TRUE; + break; + } + } + } + return cyclic; +} + +bool TDistinta_tree::has_son() const +{ + if (is_cyclic()) + return FALSE; + TString80 cod; _path.get(-2, cod); + file().put("CODDIST", cod); + file().put("NRIG", 1); + return file().read() == NOERR; +} + + +void TDistinta_tree::add_child() +{ + _path.add(file().get("NRIG")); + _path.add(file().get("CODCOMP")); +} + +void TDistinta_tree::kill_child() +{ + for (int n = 0; n < 2; n++) + { + const int pipe = _path.rfind('|'); + _path.cut(pipe); + } +} + +bool TDistinta_tree::goto_firstson() +{ + const bool ok = has_son(); + if (ok) + add_child(); + return ok; +} + +bool TDistinta_tree::has_rbrother() const +{ + const int items = _path.items(); + if (items < 3) + return FALSE; + + TString80 str; + _path.get(items-2, str); + const int brother = atoi(str)+1; + _path.get(items-3, str); + file().put("CODDIST", str); + file().put("NRIG", brother); + return file().read() == NOERR; +} + +bool TDistinta_tree::goto_rbrother() +{ + const bool ok = has_rbrother(); + if (ok) + { + kill_child(); + add_child(); + } + return ok; +} + +bool TDistinta_tree::has_lbrother() const +{ + const int items = _path.items(); + if (items < 3) + return FALSE; + TString80 str; + _path.get(items-2, str); + const int brother = atoi(str)-1; + if (brother <= 0) + return FALSE; + + _path.get(items-3, str); + file().put("CODDIST", str); + file().put("NRIG", brother); + return file().read() == NOERR; +} + +bool TDistinta_tree::goto_lbrother() +{ + const bool ok = has_lbrother(); + if (ok) + { + kill_child(); + add_child(); + } + return ok; +} + +bool TDistinta_tree::has_father() const +{ + const int items = _path.items(); + return items >= 3; +} + +bool TDistinta_tree::goto_father() +{ + const bool ok = has_father(); + if (ok) + { + kill_child(); + } + return ok; +} + +TDistinta_tree::TDistinta_tree() : _rdist(NULL) +{ +} + +TDistinta_tree::~TDistinta_tree() +{ + if (_rdist) + delete _rdist; +} + +/////////////////////////////////////////////////////////// +// TQuery_mask +/////////////////////////////////////////////////////////// + +class TQuery_mask : public TAutomask +{ + TDistinta_tree& _tree; + TToken_string _curr; + +protected: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + +public: + const TToken_string& curr() const { return _curr; } + + TQuery_mask(TDistinta_tree& tree); + virtual ~TQuery_mask() { } +}; + +bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + switch (o.dlg()) + { + case F_CODICE: + if (e == fe_modify) + { + TTree_field& tf = (TTree_field&)field(F_TREE); + const TString& val = o.get(); + if (val.not_empty() && _tree.has_root()) + { + long pos = _tree.find_node(val); + if (pos <= 0) + { + if (_tree.set_root(val)) + pos = 1; + } + if (pos > 0) + { + tf.select_current(); + do { _tree.expand(); } while (_tree.goto_father()); + pos = _tree.find_node(val, SCAN_PRE_ORDER | SCAN_IGNORING_UNEXPANDED); + + TField_window& win = tf.win(); + const TPoint& range = win.range(); + if (pos > range.y) + win.set_scroll_max(win.columns(), pos+win.rows()); + + win.update_thumb(-1, pos-1); + win.force_update(); + tf.set_focus(); + } + } + else + { + _tree.set_root(val); + } + tf.win().force_update(); + } + case F_TREE: + if (e == fe_modify) + { + _tree.curr_id(_curr); + set(F_CODICE, _curr.get(-2)); + } + break; + case DLG_SELECT: + if (e == fe_button) + { + const TString& str = get(F_CODICE); + if (str.not_empty()) + set(F_CODICEQ, str); + else + return FALSE; + } + break; + case F_COPY: + if (e == fe_button) + { + const TString oldcode = get(F_CODICE); + TLocalisamfile dist(LF_DIST); + dist.put("CODDIST", oldcode); + if (dist.read() == NOERR) + { + TString newcode; + if (query_string("Nuovo codice", newcode, 20, "U")) + { + if (newcode.not_empty() && newcode != oldcode) + { + dist.put("CODDIST", newcode); + const int err = dist.write(); + if (err == NOERR) + { + TRecord_array rdist(LF_RDIST, "NRIG"); + rdist.renum_key("CODDIST", oldcode); + if (rdist.read(rdist.key()) == NOERR) + { + rdist.renum_key("CODDIST", newcode); + rdist.write(); + } + } + else + { + if (err == _isreinsert) + error_box("La distinta '%s' e' gia' stata inserita", (const char*)newcode); + else + error_box("Errore %d durante la registrazione della distinta '%s'", err, (const char*)newcode); + } + } + } + } + else + error_box("Il codice '%s' non corrisponde ad una distinta valida", (const char*)oldcode); + } + break; + default: + break; + } + return TRUE; +} + +TQuery_mask::TQuery_mask(TDistinta_tree& dt) + : TAutomask("db0100a"), _tree(dt) +{ + TTree_field& tree = (TTree_field&)field(F_TREE); + tree.set_tree(&_tree); +} + +/////////////////////////////////////////////////////////// +// TDistinta_mask +/////////////////////////////////////////////////////////// + +class TDistinta_mask : public TAutomask +{ + TDistinta_tree& _tree; + TRecord_cache _mag, _lav; + +protected: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + bool test_row(const TToken_string& row); + +public: + bool is_lav(const TString& str); + bool is_mag(const TString& str); + + TDistinta_mask(TDistinta_tree& dt); + virtual ~TDistinta_mask() { } +}; + +bool TDistinta_mask::is_lav(const TString& str) +{ + if (_lav.items() > 1000) + _lav.destroy(); + const TString& val = _lav.get(str, "S0"); + return val.not_empty(); +} + +bool TDistinta_mask::is_mag(const TString& str) +{ + if (_mag.items() > 1000) + _mag.destroy(); + const TString& val = _mag.get(str, "DESCR"); + return val.not_empty(); +} + +bool TDistinta_mask::test_row(const TToken_string& row) +{ + const TString& father = get(F_CODICE); + + TString code; row.get(1, code); + bool ok = code != father; + if (ok && _tree.find_node(father) > 0) + { + TToken_string path; _tree.curr_id(path); + for (const char* c = path.get(0); c != NULL && ok; c = path.get()) + { + ok = code != c; + c = path.get(); + } + } + if (!ok) + error_box("Il codice '%s' non puo' essere utilizzato\n" + "in quanto la distinta risulterebbe ciclica.", (const char*)code); + + // Se e' una lavorazione + if (get(F_TIPO)[0] == 'L') + { + ok = row[0] == 'L' && is_lav(code); + if (!ok) + error_box("Il codice '%s' non e' una lavorazione", (const char*)code); + } + + return ok; +} + +bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + switch (o.dlg()) + { + case F_CODICE: + if (e == fe_init) + { + bool virtuale = TRUE; + const TString& code = o.get(); + if (virtuale && is_mag(code)) // E' un articolo di magazzino? + { + set(F_TIPO, "A", TRUE); + const TRectype& rec = _mag.get(code); + set(F_DESCR, rec.get("DESCR")); + + TLocalisamfile umart(LF_UMART); + umart.put(UMART_CODART, code); + umart.put(UMART_NRIGA, "1"); + if (umart.read() == NOERR) + set(F_UM, umart.get(UMART_UM)); + + virtuale = FALSE; + } + if (virtuale && is_lav(code)) // E' una lavorazione? + { + set(F_TIPO, "L", TRUE); + const TRectype& rec = _lav.get(code); + set(F_DESCR, rec.get("S0")); + set(F_UM, rec.get("S6")); + set(F_PREZZO, rec.get("R0")); + virtuale = FALSE; + } + if (virtuale) + set(F_TIPO, "V", TRUE); + } + break; + case F_SHEET: + if (e == se_notify_add || e == se_notify_modify || e == fe_close) + { + TSheet_field& sheet = (TSheet_field&)o; + const int nrig = int(jolly); + TToken_string& row = sheet.row(nrig); + switch(e) + { + case se_notify_add: + row = "A| | |1"; // Forza il listbox ad articolo + break; + case se_notify_modify: + return test_row(row); + case fe_close: + { + TString code; + for (int n = sheet.items()-1; n >= 0; n--) + { + const TToken_string& row = sheet.row(n); + row.get(1, code); + if (!code.blank()) + { + if (!test_row(row)) + return FALSE; + } + else + sheet.destroy(n); + } + } + break; + default: + break; + } + } + break; + case F_CODART: + case F_CODLAV: + case F_CODDIS: + if (e == fe_modify || e == fe_init) + { + TMask& m = o.mask(); + TEdit_field& ef = (TEdit_field&)o; + const TRectype& rec = ef.browse()->cursor()->curr(); + switch(rec.num()) + { + case LF_ANAMAG: + m.set(F_DESCOMP, rec.get(ANAMAG_DESCR)); + m.enable(F_UMEXPR); + if (m.get(F_UMEXPR).empty()) + { + TLocalisamfile umart(LF_UMART); + umart.put(UMART_CODART, o.get()); + umart.put(UMART_NRIGA, "1"); + if (umart.read() == NOERR) + m.set(F_UMEXPR, umart.get(UMART_UM)); + } + break; + case LF_DIST : + m.set(F_DESCOMP, rec.get("DESCR")); + m.set(F_UMEXPR, rec.get("UM")); + m.disable(F_UMEXPR); + break; + default : + m.set(F_DESCOMP, rec.get("S0")); + m.set(F_UMEXPR, rec.get("S7")); + m.disable(F_UMEXPR); + break; + } + } + break; + case F_EXPR: + if (e == fe_modify) + { + const TString& str = o.get(); + if (str.not_empty()) + { + TDistinta_expr expr; + if (expr.set(str)) + { + if (expr.numvar() > 0) + { + TTable var("VAR"); + for (int v = expr.numvar()-1; v >= 0; v--) + { + const char* name = expr.varname(v); + var.put("CODTAB", name); + if (var.read() != NOERR) + return error_box("La variabile %s non e' definita in tabella", name); + } + } + else + o.set(expr.as_string()); + } + else + return FALSE; + } + else + return error_box("L'espressione deve essere specificata"); + } + break; + default: + break; + } + return TRUE; +} + +TDistinta_mask::TDistinta_mask(TDistinta_tree& dt) + : TAutomask("db0100b"), _tree(dt), + _mag(LF_ANAMAG), _lav("LAV") +{ } + + +/////////////////////////////////////////////////////////// +// TDistinta_app +/////////////////////////////////////////////////////////// + +class TDistinta_app : public TRelation_application +{ + TDistinta_tree _tree; + TRelation* _therel; + TQuery_mask* _querymask; + TDistinta_mask* _themask; + int _mode; + +protected: + virtual bool user_create(); + virtual bool user_destroy(); + virtual TRelation* get_relation() const { return _therel; } + virtual bool changing_mask(int mode); + virtual void init_modify_mode(TMask& m); + virtual TMask* get_mask(int mode); + +public: +}; + +bool TDistinta_app::user_create() +{ + _therel = new TRelation(LF_DIST); + _querymask = new TQuery_mask(_tree); + _themask = new TDistinta_mask(_tree); + return TRUE; +} + +bool TDistinta_app::user_destroy() +{ + delete _themask; + delete _therel; + return TRUE; +} + +bool TDistinta_app::changing_mask(int mode) +{ + bool was_query = _mode == MODE_QUERY || _mode == MODE_QUERYINS; + bool is_query = mode == MODE_QUERY || mode == MODE_QUERYINS; + return was_query != is_query; +} + +TMask* TDistinta_app::get_mask(int mode) +{ + _mode = mode; + bool is_query = mode == MODE_QUERY || mode == MODE_QUERYINS; + return is_query ? (TMask*)_querymask : (TMask*)_themask; +} + +void TDistinta_app::init_modify_mode(TMask& m) +{ + TSheet_field& sheet = m.sfield(F_SHEET); + FOR_EACH_SHEET_ROW(sheet, nrig, row) + sheet.check_row(nrig); +} + +/////////////////////////////////////////////////////////// +// db0100 gestione distinte +/////////////////////////////////////////////////////////// + +int db0100(int argc, char* argv[]) +{ + TDistinta_app a; + a.run(argc, argv, "Distinta base"); + return 0; +} diff --git a/db/db0100a.h b/db/db0100a.h new file mode 100755 index 000000000..7c36aee21 --- /dev/null +++ b/db/db0100a.h @@ -0,0 +1,33 @@ +#ifndef __DB0100_H +#define __DB0100_H + +#define F_TREE 500 +#define F_CODICE 501 +#define F_CODICEQ 502 +#define F_TIPO 503 +#define F_VIRTUALE 504 +#define F_COPY 505 + +#define F_DESCR 510 +#define F_PREZZO 511 +#define F_UM 512 +#define F_PESO 513 +#define F_UMP 514 + +#define F_SHEET 520 + +#define F_TIPOCOMP 101 +#define F_CODART 102 +#define F_CODLAV 202 +#define F_CODDIS 302 +#define F_CODVAR 402 +#define F_UMEXPR 103 +#define F_EXPR 104 +#define F_DESCOMP 105 +#define F_SORT1 106 +#define F_SORT2 107 +#define F_SORT3 108 +#define F_SORT4 109 +#define F_SORT5 110 + +#endif diff --git a/db/db0100a.uml b/db/db0100a.uml new file mode 100755 index 000000000..d3c9027d5 --- /dev/null +++ b/db/db0100a.uml @@ -0,0 +1,97 @@ +#include "db0100a.h" + +TOOLBAR "" 0 20 0 0 + +BUTTON DLG_SELECT 10 2 +BEGIN + PROMPT -16 -1 "~Selezione" + MESSAGE EXIT,K_ENTER + PICTURE BMP_SELECT +END + +BUTTON DLG_NEWREC 10 2 +BEGIN + PROMPT -26 -1 "~Nuovo" + MESSAGE EXIT,K_INS + PICTURE BMP_NEWREC + PICTURE BMP_NEWRECDN +END + +BUTTON DLG_DELREC 10 2 +BEGIN + PROMPT -36 -1 "~Elimina" + MESSAGE EXIT,K_DEL + PICTURE BMP_DELREC + PICTURE BMP_DELRECDN +END + +BUTTON F_COPY 10 2 +BEGIN + PROMPT -46 -1 "~Copia" +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -56 -1 "~Annulla" + MESSAGE EXIT,K_ESC + PICTURE 102 +END + +BUTTON DLG_QUIT 10 2 +BEGIN + PROMPT -66 -1 "~Fine" + MESSAGE EXIT,K_QUIT + PICTURE BMP_QUIT + PICTURE BMP_QUITDN +END + +ENDPAGE + +PAGE "Distinta base" -1 -1 80 20 + +GROUPBOX DLG_NULL 78 3 +BEGIN + PROMPT 1 1 "Distinta" +END + +STRING F_CODICE 20 +BEGIN + PROMPT 2 2 "Cerca " + FLAGS "GU" + USE LF_DIST + JOIN LF_ANAMAG INTO CODART==CODDIST + INPUT CODDIST F_CODICE + DISPLAY "Codice@20" CODDIST + DISPLAY "Descrizione@50" LF_ANAMAG->DESCR + OUTPUT F_CODICE CODDIST + ADD RUN ve2 -3 + CHECKTYPE REQUIRED + FIELD CODDIST +END + +STRING F_CODICEQ 20 +BEGIN + PROMPT 42 2 "Codice " + FIELD CODDIST + KEY 1 + USE LF_ANAMAG + JOIN LF_UMART INTO CODART=CODART NRIGA=1 + INPUT CODART F_CODICEQ + DISPLAY "Codice@20" CODART + DISPLAY "Descrizione@50" DESCR + OUTPUT F_CODICEQ CODART + CHECKTYPE REQUIRED + MESSAGE COPY,F_CODICE + FLAGS "U" +END + +TREE F_TREE -3 -1 +BEGIN + PROMPT 0 4 "" +END + + + +ENDPAGE + +ENDMASK diff --git a/db/db0100b.uml b/db/db0100b.uml new file mode 100755 index 000000000..13dd0bdbf --- /dev/null +++ b/db/db0100b.uml @@ -0,0 +1,280 @@ +#include "db0100a.h" + +TOOLBAR "" 0 20 0 0 +#include +ENDPAGE + +PAGE "Distinta base" -1 -1 80 20 + +GROUPBOX DLG_NULL 78 3 +BEGIN + PROMPT 1 1 "Distinta" +END + +STRING F_CODICE 20 +BEGIN + PROMPT 2 2 "Codice " + FLAGS "GUD" + KEY 1 + FIELD CODDIST +END + +LIST F_TIPO 1 12 +BEGIN + PROMPT 42 2 "Tipo " + ITEM "A|Articolo" + MESSAGE "",F_VIRTUALE + ITEM "L|Lavorazione" + MESSAGE "",F_VIRTUALE + ITEM "V|Virtuale" + MESSAGE "X",F_VIRTUALE + FLAGS "DG" +END + +BOOLEAN F_VIRTUALE +BEGIN + PROMPT 42 42 "Virtuale" + MESSAGE FALSE DISABLE,1@ + MESSAGE TRUE ENABLE,1@ + FLAGS "DG" + FIELD VIRTUALE +END + +GROUPBOX DLG_NULL 78 5 +BEGIN + PROMPT 1 4 "Informazioni" +END + +STRING F_DESCR 50 +BEGIN + PROMPT 2 5 "Descrizione " + FIELD DESCR + GROUP 1 + FLAGS "D" +END + +NUMBER F_PREZZO 15 +BEGIN + PROMPT 2 6 "Costo " + PICTURE "." + FIELD PREZZO + GROUP 1 + FLAGS "D" +END + +STRING F_UM 3 +BEGIN + PROMPT 42 6 "Unita' di misura " + USE %UMS + INPUT CODTAB F_UM + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@60" S0 + OUTPUT F_UM CODTAB + FIELD UM + GROUP 1 + FLAGS "D" +END + +NUMBER F_PESO 15 5 +BEGIN + PROMPT 2 7 "Peso " + FIELD PESO + GROUP 1 + FLAGS "D" +END + +STRING F_UMP 3 +BEGIN + PROMPT 42 7 "Unita' di misura del peso " + COPY USE F_UM + INPUT CODTAB F_UMP + COPY DISPLAY F_UM + OUTPUT F_UMP CODTAB + FIELD UMP + GROUP 1 + FLAGS "D" +END + +SPREADSHEET F_SHEET +BEGIN + PROMPT 0 9 "" + ITEM "Tipo@4" + ITEM "Codice@20" + ITEM "UM@3" + ITEM "Espressione@20" + ITEM "Descrizione@50" + ITEM "Ord1" + ITEM "Ord2" + ITEM "Ord3" + ITEM "Ord4" + ITEM "Ord5" + USE LF_RDIST KEY NRIG + INPUT CODDIST F_CODICE + FLAGS "A" +END + +ENDPAGE + +ENDMASK + +PAGE "Riga 1" -1 -1 68 12 + +GROUPBOX DLG_NULL 66 4 +BEGIN + PROMPT 1 0 "Componente" +END + +LIST F_TIPOCOMP 1 12 +BEGIN + PROMPT 2 1 "Tipo " + ITEM "A|Articolo" + MESSAGE SHOW,F_CODART|HIDE,F_CODLAV|HIDE,F_CODDIS|HIDE,F_CODVAR + ITEM "L|Lavorazione" + MESSAGE HIDE,F_CODART|SHOW,F_CODLAV|HIDE,F_CODDIS|HIDE,F_CODVAR + ITEM "D|Distinta" + MESSAGE HIDE,F_CODART|HIDE,F_CODLAV|SHOW,F_CODDIS|HIDE,F_CODVAR + ITEM "V|Variabile" + MESSAGE HIDE,F_CODART|HIDE,F_CODLAV|HIDE,F_CODDIS|SHOW,F_CODVAR + FIELD TIPO +END + +STRING F_CODART 20 +BEGIN + PROMPT 37 1 "Codice " + USE LF_ANAMAG + INPUT CODART F_CODART + DISPLAY "Codice@20" CODART + DISPLAY "Descrizione@50" DESCR + OUTPUT F_CODART CODART + CHECKTYPE REQUIRED + ADD RUN ve2 -3 + FIELD CODCOMP + FLAGS "U" +END + +STRING F_CODLAV 20 +BEGIN + PROMPT 37 1 "Codice " + USE LAV + INPUT CODTAB F_CODLAV + DISPLAY "Codice@8" CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT F_CODLAV CODTAB + CHECKTYPE REQUIRED + MESSAGE COPY,F_CODART + FLAGS "U" +END + +STRING F_CODDIS 20 +BEGIN + PROMPT 37 1 "Codice " + USE LF_DIST SELECT VIRTUALE=="X" + INPUT CODDIST F_CODDIS + DISPLAY "Codice@20" CODDIST + DISPLAY "Desrizione@50" DESCR + OUTPUT F_CODDIS CODDIST + CHECKTYPE REQUIRED + MESSAGE COPY,F_CODART + FLAGS "U" +END + +STRING F_CODVAR 20 +BEGIN + PROMPT 37 1 "Codice " + USE VAR + INPUT CODTAB F_CODDIS + DISPLAY "Codice@20" CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT F_CODVAR CODTAB + CHECKTYPE REQUIRED + MESSAGE COPY,F_CODART + FLAGS "U" +END + +STRING F_DESCOMP 50 +BEGIN + PROMPT 2 2 "Descrizione " + FLAGS "D" +END + +GROUPBOX DLG_NULL 66 4 +BEGIN + PROMPT 1 4 "Formula" +END + +STRING F_UMEXPR 3 +BEGIN + PROMPT 2 5 "Unita' di misura " + USE LF_UMART KEY 2 + JOIN LF_ANAMAG INTO CODART==CODART + INPUT CODART F_CODART SELECT + INPUT UM F_UMEXPR + DISPLAY "Unita'" UM + DISPLAY "Articolo@20" CODART + DISPLAY "Descrizione@50" LF_ANAMAG->DESCR + OUTPUT F_UMEXPR UM + CHECKTYPE NORMAL + FIELD UM + FLAGS "U" +END + +STRING F_EXPR 50 62 +BEGIN + PROMPT 2 6 "" + FIELD EXPR + FLAGS "U" +END + +GROUPBOX DLG_NULL 66 3 +BEGIN + PROMPT 1 8 "Criteri d'ordinamento" +END + +NUMBER F_SORT1 4 +BEGIN + PROMPT 2 9 "1 " + FIELD SORT1 +END + +NUMBER F_SORT2 4 +BEGIN + PROMPT 16 9 "2 " + FIELD SORT2 +END + +NUMBER F_SORT3 4 +BEGIN + PROMPT 30 9 "3 " + FIELD SORT3 +END + +NUMBER F_SORT4 4 +BEGIN + PROMPT 44 9 "4 " + FIELD SORT4 +END + +NUMBER F_SORT5 4 +BEGIN + PROMPT 58 9 "5 " + FIELD SORT5 +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -13 -1 "" +END + +BUTTON DLG_DELREC 10 2 +BEGIN + PROMPT -23 -1 "" +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -33 -1 "" +END + +ENDMASK + + diff --git a/db/f112.dir b/db/f112.dir index 154e0423c..967ce5900 100755 --- a/db/f112.dir +++ b/db/f112.dir @@ -1,3 +1,3 @@ 112 0 -$dist|0|0|22|35|Distinte||| +$dist|0|0|121|0|Distinte||| diff --git a/db/f112.trr b/db/f112.trr index 2f9e8a822..c86474528 100755 --- a/db/f112.trr +++ b/db/f112.trr @@ -1,6 +1,12 @@ 112 -2 +8 CODDIST|1|20|0|Codice distinta -VARIABILE|8|1|0|Distinta variabile +VIRTUALE|8|1|0|Distinta virtuale (non e' un articolo) +DESCR|1|50|0|Descrizione +UMP|1|3|0|Unita' di misura del peso +PESO|4|15|5|Peso +UM|1|3|0|Unita' di misura +PREZZO|4|18|2|Costo +PARAMETRI|11|10|0|Parametri (var1 = valore1, var2= valore2, ecc.) 1 CODDIST| diff --git a/db/f113.dir b/db/f113.dir index fb34fcfe8..1647b6f83 100755 --- a/db/f113.dir +++ b/db/f113.dir @@ -1,3 +1,3 @@ 113 0 -$rdist|0|0|117|35|Righe distinta||| +$rdist|0|0|119|0|Righe distinta||| diff --git a/db/f113.trr b/db/f113.trr index e8ed55c47..be61604b9 100755 --- a/db/f113.trr +++ b/db/f113.trr @@ -1,13 +1,16 @@ 113 -8 +11 CODDIST|1|20|0|Codice distinta NRIG|2|4|0|Numero di riga -TIPO|1|1|0|Tipo componente rticolo, avorazione +TIPO|1|1|0|Tipo componente rticolo, avorazione, istinta CODCOMP|1|20|0|Codice componente -UM|1|2|0|Unita' di misura -QUANT|4|15|5|Quantita' -EXPR|1|50|0|Espressione aggiuntiva -RIF|2|4|0|Riferimento +UM|1|3|0|Unita' di misura +EXPR|1|50|0|Espressione quantita' +SORT1|2|4|0|Ordinamento 1 +SORT2|2|4|0|Ordinamento 2 +SORT3|2|4|0|Ordinamento 3 +SORT4|2|4|0|Ordinamento 4 +SORT5|2|4|0|Ordinamento 5 2 CODDIST+NRIG| -+CODCOMP+CODDIST|X +CODCOMP+CODDIST|X