Patch level : 12.0 1086

Files correlati     : nopatch
Commento        :

Aggiunte funzioni ai report

Immagini da oggetti esterni
sintassi da mettere nel prescript del campo immagine :
<Id oggetto>
<nome del campo oggetti esterni>
<chiave>
<file>
GOLEM
#THIS !

Logo della ditta
sintassi da mettere nel prescript del campo immagine :
LOGO
#THIS !

L'Id dell'immagine deve essere LOGO
This commit is contained in:
Alessandro Bonazzi 2021-10-08 22:29:57 +02:00
parent 43cf382429
commit 3e8927c381
2 changed files with 77 additions and 2 deletions

View File

@ -1,3 +1,4 @@
#include <applicat.h>
#include <colors.h>
#include <config.h>
#include <defmask.h>
@ -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),

View File

@ -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();