diff --git a/ve/ve1100.cpp b/ve/ve1100.cpp index 21f1f42b9..2f1aff897 100755 --- a/ve/ve1100.cpp +++ b/ve/ve1100.cpp @@ -138,7 +138,10 @@ public: const TString &get_module_code() const { return _module; } // ritorna il codice del modulo di carta TString_array& exclude_list_t() { return _exclude_array_t; } TString_array& exclude_list_a() { return _exclude_array_a; } + TDocumentoEsteso& doc() { return *_doc; } + void set_doc_ext(TRectype* doc); + TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, bool interattivo, bool aggiuntivo); TDocumento_form(const char* form, TRelation& rel); virtual ~TDocumento_form(); @@ -146,8 +149,27 @@ public: TDocumento_form* TDocumento_form::_form = NULL; +void TDocumento_form::set_doc_ext(TRectype* doc) +{ + CHECK(_doc == NULL, "Doppio documeto esteso"); + + if (doc != NULL) + _doc = new TDocumentoEsteso(*doc); + else + _doc = new TDocumentoEsteso; + + _docfile = new TDocisamfile(_doc); + _rdocfile = new TRDocisamfile(_doc); + _rdocfile->set_normal_next(); + relation()->replace(_docfile,0); + relation()->replace(_rdocfile,1); + + if (_doc->physical_rows() > 0) + relation()->update(); +} + TDocumento_form::TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, bool interattivo, bool aggiuntivo) - : _firmrel(rel), _valid(FALSE), _sorted_cur(NULL) + : _firmrel(rel), _valid(FALSE), _sorted_cur(NULL), _doc(NULL), _docfile(NULL), _rdocfile(NULL) { _form = this; @@ -177,13 +199,9 @@ TDocumento_form::TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, read(nomeform); _cli_loaded= FALSE; - _doc = new TDocumentoEsteso(doc); // istanzia TDocumentoEsteso - _docfile = new TDocisamfile(_doc); - _rdocfile = new TRDocisamfile(_doc); - relation()->replace(_docfile,0); - relation()->replace(_rdocfile,1); - if (_doc->physical_rows() > 0) - relation()->update(); + + set_doc_ext(&doc); // istanzia TDocumentoEsteso + modify_pictures(); dec_parm p; const int items = _group_decimals.items(); @@ -217,15 +235,10 @@ TDocumento_form::TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, } // costruttore per stampa lista documenti (uso convenzionale dei forms) -TDocumento_form::TDocumento_form(const char* form, TRelation& rel): TForm(form), _firmrel(rel), _valid(FALSE) +TDocumento_form::TDocumento_form(const char* form, TRelation& rel) + : TForm(form), _firmrel(rel), _valid(FALSE), _doc(NULL), _docfile(NULL), _rdocfile(NULL) { _cli_loaded= FALSE; - _doc = new TDocumentoEsteso; - _docfile = new TDocisamfile(_doc); - _rdocfile = new TRDocisamfile(_doc); - _rdocfile->set_normal_next(); - relation()->replace(_docfile,0); - relation()->replace(_rdocfile,1); _sorted_cur = new TSorted_cursor(relation(), "PROVV|ANNO|CODNUM|STATO|DATADOC|NDOC"); } @@ -1365,28 +1378,28 @@ void TStampaDoc_application::print_selected() else // Lista documenti { TDocumento_form* mainform = new TDocumento_form(LISTADOC,*_firmrel); - const int hh = 6; - const int fl = printer().formlen(); - int rows[4]; - rows[0] = hh-2; - rows[1] = hh; - rows[2] = fl; - rows[3] = 0; - mainform->cursor()->setkey(_key); + TCursor& cur = *mainform->cursor(); + + cur.setkey(_key); darec.put(DOC_DATADOC, _dadata); darec.put(DOC_PROVV, _provv); darec.put(DOC_ANNO, _anno); arec = darec; arec.put(DOC_DATADOC, _adata); - mainform->cursor()->setregion(darec,arec); + cur.setregion(darec,arec); const bool dettaglio = _selection_mask->get_bool(F_DETTAGLIO); mainform->find_field('B', odd_page, "H_RIGHE").enable(dettaglio); // Visualizza i dettagli righe se richiesto mainform->find_field('B', odd_page, "RIGHE").enable(dettaglio); set_filter(*mainform); - if (mainform->cursor()->items()) + const TRecnotype items = cur.items(); + if (items > 0) + { + cur.freeze(); + mainform->set_doc_ext(NULL); // Setta il documento esteso DOPO aver fatto il filtro mainform->print(); + } delete mainform; } @@ -1950,7 +1963,7 @@ void TStampaDoc_application::main_loop() int ve1100(int argc, char* argv[]) { TStampaDoc_application a; - const bool cond = argc == 4 && argv[2][0] == 'L'; // Lista documenti - a.run(argc, argv, cond ? TR("Lista documenti") : TR("Stampa documenti di vendita")); - return (0); + const bool riep = argc == 4 && argv[2][0] == 'L'; // Lista documenti + a.run(argc, argv, riep ? TR("Lista documenti") : TR("Stampa documenti")); + return 0; } diff --git a/ve/ve1100b.uml b/ve/ve1100b.uml index c6fcae855..d71146ae9 100755 --- a/ve/ve1100b.uml +++ b/ve/ve1100b.uml @@ -4,14 +4,14 @@ PAGE "Lista documenti" -1 -1 60 21 NUMBER F_ANNO 4 0 BEGIN - PROMPT 2 1 "Anno " - FLAG "P" + PROMPT 2 1 "Anno " + FLAG "AP" CHECKTYPE REQUIRED END LIST F_PROVV 12 BEGIN - PROMPT 28 1 "Tipo numerazione " + PROMPT 24 1 "Tipo numerazione " ITEM "D|Definitiva" ITEM "P|Provvisoria" FLAG "P" diff --git a/ve/velib04c.cpp b/ve/velib04c.cpp index c8b373b63..b22fbe303 100755 --- a/ve/velib04c.cpp +++ b/ve/velib04c.cpp @@ -277,11 +277,12 @@ long TGenerazione_effetti::group_bills(TAssoc_array& group_array) if (p.iscancelled()) break; #endif TToken_string t(group_element->get(j),'$'); - char provv = t.get_char(0); - int anno = t.get_int(1); - TString codnum(t.get(2)); - long numdoc = t.get_long(3); - if (doc.read(provv,anno,codnum,numdoc) != NOERR) continue; // Legge il documento (giusto saltare e proseguire se non lo trova?) + const char provv = t.get_char(0); + const int anno = t.get_int(1); + const TString4 codnum(t.get(2)); + const long numdoc = t.get_long(3); + if (doc.read(provv,anno,codnum,numdoc) != NOERR) + continue; // Legge il documento (giusto saltare e proseguire se non lo trova?) msg2 = "Documento: "; msg2 << codnum << "/" << numdoc;