Patch level : 12.0 1096
Files correlati : xvaga.dll ba0100m.msk Commento : Aggiornata maschera di configurazione impostazioni email e aggiunta la possibilità di mettere il mittente in Ccn
This commit is contained in:
parent
4fe321d849
commit
3195480088
4
cd/test/sy1096.txt
Normal file
4
cd/test/sy1096.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Aggiornata maschera di configurazione impostazioni email e aggiunta la possibilità di mettere il mittente in Ccn
|
||||
|
||||
xvaga.dll
|
||||
ba0100m.msk
|
25
cd/test/sy1096a.ini
Normal file
25
cd/test/sy1096a.ini
Normal file
@ -0,0 +1,25 @@
|
||||
[Main]
|
||||
Demo=0
|
||||
|
||||
[sy1]
|
||||
File(55) = xvaga.dll|X
|
||||
File(57) = ba0100m.msk|X
|
||||
Patch = 1096
|
||||
Versione = 21511200
|
||||
|
||||
[sy99]
|
||||
Kill(0) = setup\teamviewerqs_it.exe|x
|
||||
|
||||
[sy]
|
||||
Data = 26-10-2021
|
||||
Descrizione = Sistema
|
||||
Dischi = 1
|
||||
Moduli =
|
||||
OEM =
|
||||
Patch = 1096
|
||||
PostProcess =
|
||||
PreProcess =
|
||||
Prezzo(1) =
|
||||
Prezzo(2) =
|
||||
Versione = 21511200
|
||||
|
BIN
cd/test/sy1096a1.zip
Normal file
BIN
cd/test/sy1096a1.zip
Normal file
Binary file not shown.
246
src/include/repapp.cpp
Normal file
246
src/include/repapp.cpp
Normal file
@ -0,0 +1,246 @@
|
||||
#include <repapp.h>
|
||||
#include <utility.h>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TReport_application
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
bool TReport_application::create()
|
||||
{
|
||||
bool ok = user_create();
|
||||
if (ok)
|
||||
return TSkeleton_application::create();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool TReport_application::destroy()
|
||||
{
|
||||
user_destroy();
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
||||
void TReport_application::ini2mask(TConfig& ini, TMask& m, bool query)
|
||||
{
|
||||
const TString16 defpar = ini.get_paragraph();
|
||||
TString tmp;
|
||||
|
||||
for (int f = m.fields()-1; f >= 0; f--)
|
||||
{
|
||||
TMask_field& campo = m.fld(f);
|
||||
const TFieldref* fref = campo.field();
|
||||
if (fref)
|
||||
{
|
||||
if (!query || campo.in_key(0))
|
||||
{
|
||||
const TString& str = fref->read(ini, defpar);
|
||||
if (str.not_empty())
|
||||
{
|
||||
campo.set(str);
|
||||
if (query)
|
||||
{
|
||||
tmp.format("%d=%s", campo.dlg(), (const char *) str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ini.set_paragraph(defpar);
|
||||
}
|
||||
void TReport_application::mask2ini(const TMask& m, TConfig& ini)
|
||||
{
|
||||
ini.set("Firm", get_firm(), "Transaction");
|
||||
ini.set("User", user());
|
||||
ini.set("HostName", get_hostname());
|
||||
|
||||
int year, release, tag, patch;
|
||||
if (get_version_info(year, release, tag, patch))
|
||||
{
|
||||
TString80 ver;
|
||||
ver.format("%d %d.%d-%d", year, release, tag, patch);
|
||||
ini.set("Version", ver);
|
||||
}
|
||||
|
||||
for (int f = 0; f < m.fields(); f++)
|
||||
{
|
||||
TMask_field& campo = m.fld(f);
|
||||
if (campo.shown())
|
||||
{
|
||||
const TFieldref* fr = campo.field();
|
||||
if (fr)
|
||||
{
|
||||
if (campo.empty())
|
||||
fr->write(ini, "Main", " ");
|
||||
else
|
||||
{
|
||||
if (campo.class_id() == CLASS_DATE_FIELD && campo.right_justified())
|
||||
{
|
||||
const TDate d(campo.get());
|
||||
fr->write(ini, "Main", d.string(ANSI));
|
||||
}
|
||||
else
|
||||
fr->write(ini, "Main", campo.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ini.set_paragraph("Main"); // Reimposta paragrafo standard
|
||||
}
|
||||
|
||||
// @cmember Esegue la stampa
|
||||
void TReport_application::execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type type)
|
||||
{
|
||||
book.add(rep, type);
|
||||
}
|
||||
|
||||
TTrec * TReport_application::get_dbase_recdesc(TReport & rep)
|
||||
{
|
||||
TTrec * desc = new TTrec;
|
||||
TReport_section * head = rep.find_section('H', 0);
|
||||
int header_row = -1;
|
||||
TToken_string key;
|
||||
int nfields = 0;
|
||||
int hrow = 0;
|
||||
|
||||
if (head != nullptr)
|
||||
{
|
||||
int secfields = head->items();
|
||||
|
||||
for (int i = secfields - 1; hrow == 0 && i >= 0; i--)
|
||||
{
|
||||
const TReport_field & fld = head->field(i);
|
||||
const TReport_rct& r = fld.get_rect();
|
||||
|
||||
if ((r.x < 1500) && (fld.type() == 'T'))
|
||||
hrow = r.y;
|
||||
}
|
||||
|
||||
TString fieldname;
|
||||
|
||||
for (int i = 0; i < secfields; i++)
|
||||
{
|
||||
const TReport_field & fld = head->field(i);
|
||||
const TReport_rct& r = fld.get_rect();
|
||||
|
||||
if ((r.y >= hrow - 50) && (r.y <= hrow + 50) && (fld.type() == 'T'))
|
||||
{
|
||||
fieldname = fld.formatted_text();
|
||||
fieldname.cut(9);
|
||||
fieldname.strip_spaces();
|
||||
fieldname.upper();
|
||||
|
||||
if (nfields == 0)
|
||||
key = fieldname;
|
||||
|
||||
const int nf = desc->fields();
|
||||
TString f;
|
||||
TToken_string def;
|
||||
bool found = false;
|
||||
|
||||
for (int n = nf - 1; !found && n >= 0; n--)
|
||||
{
|
||||
|
||||
def = desc->fielddef(n);
|
||||
f = def.get(0);
|
||||
if (f.starts_with(fieldname))
|
||||
{
|
||||
fieldname << atoi(f.mid(fieldname.len())) + 1;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
def = fieldname;
|
||||
def.add(_alfafld);
|
||||
def.add(80);
|
||||
desc->set_fields(nfields);
|
||||
desc->update_fielddef(nfields++, def);
|
||||
}
|
||||
}
|
||||
desc->set_keys(1);
|
||||
desc->update_keydef(0, key);
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
// @cmember Ciclo principale
|
||||
void TReport_application::main_loop()
|
||||
{
|
||||
TAutomask & m = get_mask();
|
||||
KEY k;
|
||||
|
||||
while ((k = m.run()) != K_QUIT)
|
||||
{
|
||||
TReport & rep = get_report(m);
|
||||
TReport_book b(title());
|
||||
TFilename name = get_filename(rep);
|
||||
bool ask_filename = name.blank();
|
||||
export_type type = _export_printer;
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case K_EXCEL:
|
||||
type = _export_excel;
|
||||
break;
|
||||
case K_PDF:
|
||||
type = _export_pdf;
|
||||
break;
|
||||
case K_TEXT:
|
||||
type = _export_text;
|
||||
break;
|
||||
case K_DBF:
|
||||
type = _export_dbase;
|
||||
break;
|
||||
case K_VISUALIZE:
|
||||
type = _export_visualize;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
execute_print(b, m, rep, type);
|
||||
switch (k)
|
||||
{
|
||||
case K_ENTER:
|
||||
case K_PRINT:
|
||||
b.print_or_preview();
|
||||
break;
|
||||
case K_EXPORT:
|
||||
b.esporta();
|
||||
break;
|
||||
case K_EXCEL:
|
||||
b.export_excel(name, false, true, ask_filename);
|
||||
break;
|
||||
case K_PDF:
|
||||
b.export_pdf(name, false, true, ask_filename);
|
||||
break;
|
||||
case K_TEXT:
|
||||
b.export_text(name, false, true, ask_filename);
|
||||
break;
|
||||
case K_DBF :
|
||||
b.export_dbase(name, false, get_dbase_recdesc(rep), true, ask_filename);
|
||||
break;
|
||||
case K_VISUALIZE:
|
||||
b.preview();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char * TReport_application::get_filename(const TReport & rep)
|
||||
{
|
||||
short id = output_id();
|
||||
TFilename output;
|
||||
|
||||
if (id > 0)
|
||||
output = get_mask().get(id);
|
||||
else
|
||||
output.tempdir();
|
||||
output.add(output_name(rep));
|
||||
|
||||
TString & str = get_tmp_string(output.len());
|
||||
|
||||
str = output;
|
||||
return str;
|
||||
}
|
72
src/include/repapp.h
Normal file
72
src/include/repapp.h
Normal file
@ -0,0 +1,72 @@
|
||||
#ifndef __REPAPP_H
|
||||
#define __REPAPP_H
|
||||
|
||||
#ifndef __APPLICAT_H
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef __REPRINT_H
|
||||
#include <reprint.h>
|
||||
#endif
|
||||
|
||||
#ifndef __AUTOMASK_H
|
||||
#include <automask.h>
|
||||
#endif
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TReport_application | Classe per la gestione di una applicazione di stampa con report
|
||||
//
|
||||
// @base public | TApplication
|
||||
class TReport_application : public TSkeleton_application
|
||||
|
||||
// @author:(INTERNAL) Guido
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
{
|
||||
|
||||
|
||||
private:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
|
||||
// @access Protected Member
|
||||
protected: // TApplication
|
||||
virtual bool firm_change_enabled() const { return true; }
|
||||
// @cmember Aggiorna i limiti di ricerca sul cambio ditta
|
||||
virtual void on_firm_change() { return TApplication::on_firm_change(); }
|
||||
// @cmember Ritorna il report
|
||||
virtual TReport & get_report(const TAutomask & m) pure;
|
||||
// @cmember Alloca e ritorna il report una volta usato va distrutto;
|
||||
virtual TTrec * get_dbase_recdesc(TReport & rep);
|
||||
// @cmember Ciclo principale
|
||||
virtual void main_loop();
|
||||
// @cmember Inizializzazione dei dati dell'utente
|
||||
virtual bool user_create() { return true; }
|
||||
// @cmember Distruzione dei dati dell'utente
|
||||
virtual bool user_destroy() { return true; }
|
||||
// @cmember ritorna la maschera
|
||||
virtual TAutomask & get_mask() pure;
|
||||
|
||||
void ini2mask(TConfig& ini, TMask& m, bool query);
|
||||
void mask2ini(const TMask& m, TConfig& ini);
|
||||
virtual void execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type type = _export_printer);
|
||||
|
||||
public:
|
||||
virtual const char * title() const { return "Report application"; }
|
||||
virtual short output_id() const { return 0; }
|
||||
virtual const char * output_name(const TReport & rep) const { return rep.filename().name_only(); }
|
||||
const char * get_filename(const TReport & rep);
|
||||
// @cmember Costruttore
|
||||
TReport_application() { }
|
||||
// @cmember Distruttore
|
||||
virtual ~TReport_application() { }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user