Patch level : 2.2 68
Files correlati : ba3.exe Ricompilazione Demo : [ ] Commento : Implemenati il supporto delle variabili stringa con subscript il supporto della use_mask per evitare l'uso automatico della maschera. Guido verifica !!!!!! git-svn-id: svn://10.65.10.50/trunk@12898 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e3eae99371
commit
6268384525
@ -11,6 +11,8 @@
|
||||
#include <nditte.h>
|
||||
#include <unloc.h>
|
||||
|
||||
#define MAX_STRING " "
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TReport_font
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -2204,18 +2206,21 @@ bool TReport::execute_prescript()
|
||||
bool bAsk = true;
|
||||
|
||||
// Script dei poveri: lancia la maschera associata al report
|
||||
TFilename msk = _path.name(); msk.ext("msk");
|
||||
if (msk.custom_path())
|
||||
{
|
||||
TFilename ini = msk; ini.ext("ini");
|
||||
// Attenzione: se esiste il .ini allora e' una maschera delle vendite!
|
||||
if (!ini.exist())
|
||||
{
|
||||
bAsk = false; // Non richiedere variabili
|
||||
const KEY key = run_form(msk.name());
|
||||
ok = key != K_ESC && key != K_QUIT;
|
||||
}
|
||||
}
|
||||
if (use_mask())
|
||||
{
|
||||
TFilename msk = _path.name(); msk.ext("msk");
|
||||
if (msk.custom_path())
|
||||
{
|
||||
TFilename ini = msk; ini.ext("ini");
|
||||
// Attenzione: se esiste il .ini allora e' una maschera delle vendite!
|
||||
if (!ini.exist())
|
||||
{
|
||||
bAsk = false; // Non richiedere variabili
|
||||
const KEY key = run_form(msk.name());
|
||||
ok = key != K_ESC && key != K_QUIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bAsk)
|
||||
{
|
||||
@ -2435,8 +2440,22 @@ void TReport::report2mask(TMask & m) const
|
||||
var.set_null();
|
||||
break;
|
||||
default:
|
||||
if (var.as_string() == "zzz")
|
||||
if (var.as_string() == MAX_STRING)
|
||||
var.set_null();
|
||||
else
|
||||
{
|
||||
const int from = ref->from();
|
||||
int to = ref->to();
|
||||
const TString & s = var.as_string();
|
||||
|
||||
if (from > 0 || to > 0)
|
||||
{
|
||||
if (to <= from)
|
||||
to = s.len();
|
||||
s.mid(from, to - from);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2447,6 +2466,26 @@ void TReport::report2mask(TMask & m) const
|
||||
}
|
||||
}
|
||||
|
||||
TVariant & string2var(TVariant & v, const TFieldref * r, const TString & val)
|
||||
{
|
||||
const int from = r->from();
|
||||
int to = r->to();
|
||||
|
||||
if (from > 0 || to > 0)
|
||||
{
|
||||
if (to <= from)
|
||||
to = val.len();
|
||||
TString s = v.as_string();
|
||||
s.overwrite(val, from, to - from);
|
||||
s.rtrim();
|
||||
v = s;
|
||||
}
|
||||
else
|
||||
v = val;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
void TReport::mask2report(const TMask & m)
|
||||
{
|
||||
TVariant var;
|
||||
@ -2458,9 +2497,14 @@ void TReport::mask2report(const TMask & m)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
const TFieldref* ref = f.field();
|
||||
|
||||
if (ref != NULL)
|
||||
{
|
||||
const bool is_final = f.in_group(2);
|
||||
TString name = ref->name();
|
||||
|
||||
if (name[0] != '#')
|
||||
name.insert("#");
|
||||
switch (f.class_id())
|
||||
{
|
||||
case CLASS_CURRENCY_FIELD:
|
||||
@ -2475,15 +2519,17 @@ void TReport::mask2report(const TMask & m)
|
||||
var.set(TDate(is_final ? 99991231L : 0L));
|
||||
break;
|
||||
default:
|
||||
var = f.get();
|
||||
if (var.is_empty())
|
||||
var.set(is_final ? "zzz" : "");
|
||||
{
|
||||
TString val(f.get());
|
||||
|
||||
get_usr_val(name, var);
|
||||
if (val.empty())
|
||||
val = is_final ? MAX_STRING : "";
|
||||
string2var(var, ref, val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
TString name = ref->name();
|
||||
if (name[0] != '#')
|
||||
name.insert("#");
|
||||
set_usr_val(name, var);
|
||||
if (rset != NULL)
|
||||
rset->set_var(name, var);
|
||||
|
@ -481,6 +481,7 @@ public:
|
||||
int find_max_level(char type) const;
|
||||
|
||||
virtual bool on_link(const TReport_link& link);
|
||||
virtual bool use_mask() { return true;}
|
||||
|
||||
const TReport_font& font() const { return _font; }
|
||||
const TReport_font& print_font() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user