diff --git a/src/include/report.cpp b/src/include/report.cpp index c0a4460d8..06e484a28 100755 --- a/src/include/report.cpp +++ b/src/include/report.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -2702,7 +2703,7 @@ size_t TReport::get_usr_words(TString_array& words) const "GET_POS", "GET_SIZE", "HIDE", "ISAM_READ", "RUN_FORM", "SET_BACK_COLOR", "SET_FORE_COLOR", "SET_POS", "SET_SIZE", "SET_TEXT_COLOR", "SHOW", "TABLE_READ", "GET_FIRM_DATA", - "EVALUATE", NULL + "EVALUATE", "GOLEM", "LOGO", NULL }; size_t i; for (i = 0; name[i] != NULL; i++) @@ -3389,6 +3390,70 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack) evaluate(var.as_string(), var, _nullfld); } break; + case 21: // GOLEM + { + const int logic = stack.pop().as_int(); + const TString key = stack.pop().as_string(); + const TString fname = stack.pop().as_string(); + const TString id = stack.pop().as_string(); + TToken_string golem(cache().get(logic, key, fname), '\n'); + + if (golem.full()) + { + FOR_EACH_TOKEN(golem, r) + { + TToken_string row(r); + const TString found_id = row.get(3); + + if (found_id == id) + { + stack.push(row.get(0)); + return true; + } + } + } + return false; + } + break; + case 22: // LOGO + { + TString img_id("LOGO"); + + img_id << stack.pop().as_string(); + stack.push(img_id); + stack.push(NDT_OGGETTI); + stack.push(main_app().get_firm()); + stack.push(LF_NDITTE); + if (!execute_usr_word(21, stack)) + { + TToken_string pl = standard_path_list(); + TFilename name; + + FOR_EACH_STR_TOKEN(pl, path) + { + TFilename name(path); + TString filemask(img_id); + TString_array files; + + filemask << "*"; + if (list_files(filemask, files) > 0) + { + FOR_EACH_ARRAY_ROW(files, n, f) + { + TImage i(*f); + + if (i.ok()) + { + stack.push(*f); + return true; + } + } + } + } + return false; + } + } + break; default: return false; } @@ -3483,7 +3548,16 @@ bool TReport::archive(bool signature) return book.archive(NULL, signature); } -TReport::TReport() +bool TReport::export_text(const char * filename,bool signature, int size) +{ + TReport_book book; + TFilename name(filename); + + book.add(*this); + return book.export_text(name, signature, size); +} + +TReport::TReport() : _cpi(0), _lpi(6), _include(15, ','), _recordset(nullptr), _curr_field(nullptr), _use_printer_font(false), _save_last_printer(false), _orientation(0), _page_split(false), _page_merge(false), _rep_copy(1), _rep_copies(1), diff --git a/src/include/report.h b/src/include/report.h index ea2847449..fe0c5f66d 100755 --- a/src/include/report.h +++ b/src/include/report.h @@ -677,6 +677,7 @@ public: bool print(); bool preview(); bool archive(bool signature); + bool export_text(const char * filename, bool signature, int size = 0); TReport(); virtual ~TReport();