Patch level :

Files correlati     : mg3
Ricompilazione Demo : [ ]
Commento            :
Migliorata efficienza form per stampe magazzino (Hardy)


git-svn-id: svn://10.65.10.50/branches/R_10_00@22456 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-10-18 08:31:16 +00:00
parent 03e0d81fd3
commit 50b54d23ea
4 changed files with 65 additions and 59 deletions

View File

@ -479,9 +479,12 @@ void TForm_item::send_message(
if (form().message_add_enabled())
{
const real n((cmd[0] == 'I') ? "1.0" : get());
real r(des.get());
r += n;
des.set(r.string());
if (!n.is_zero())
{
real r(des.get());
r += n;
des.set(r.string());
}
}
} else if (cmd == "COPY") {
des.set(get());
@ -565,7 +568,7 @@ bool TForm_item::do_message(int num)
const TString80 cmd(msg.get()); // Get command
const TString80 id = msg.get(); // Get destination
if (id.right(1) == "@")
if (id.ends_with("@"))
{
const byte group = atoi(id);
// Send the message to all fields in local and upper sections with the given group
@ -608,7 +611,7 @@ void TForm_item::send_message_to_group(const char * cmd,byte id,const TPrint_sec
bool TForm_item::update()
{
if (_prompt.right(1) == "#")
if (_prompt.ends_with("#"))
{
TString prompt(_prompt);
int i;
@ -618,9 +621,9 @@ bool TForm_item::update()
prompt.cut(i+1);
string_at(x(), _y, prompt);
}
else string_at(x(), _y, _prompt);
return TRUE;
else
string_at(x(), _y, _prompt);
return true;
}
void TForm_item::print_on(TToken_string& row) const
@ -1058,7 +1061,7 @@ bool TForm_string::read()
{
const char* s = "";
// !?!?!?!!
const TRelation* r = (TRelation* )form().relation();
const TRelation* r = (TRelation*)form().relation();
CHECK(r, "Can't read from null relation");
for (int i = 0; i < _field.items() && *s == '\0'; i++)
s = field(i).read(*r);
@ -1528,7 +1531,7 @@ bool TForm_currency::update()
{
const bool dotted = pic.empty() || pic.find('.') > 0;
v = curr.string(dotted);
if (pic.right(3) == "^^^") // 770 only: to be improved
if (pic.ends_with("^^^")) // 770 only: to be improved
{
const int dec = curr.decimals();
if (dec == 0)
@ -1545,7 +1548,7 @@ bool TForm_currency::update()
else
{
const TString& pic = picture();
if (pic.right(1)[0] == '@')
if (pic.ends_with("@"))
{
TString80 v;
const int w = width() - (_section->columnwise() ? _prompt.len() : 0);
@ -3231,10 +3234,10 @@ bool TPrint_section::update_and_print(const sec_print_mode show_fields, bool new
}
else
{
last_hpos=min(word(fi.y()-1), height());
// found a subsection
TForm_subsection & ss=(TForm_subsection & )fi;
TForm_subsection& ss=(TForm_subsection & )fi;
last_hpos=min(word(fi.y()-1), height());
last_printed_row=print_rows(show_fields,last_printed_row,last_hpos);
// process subsection
@ -3256,29 +3259,29 @@ bool TPrint_section::update_and_print(const sec_print_mode show_fields, bool new
word TPrint_section::print_rows(const sec_print_mode show_fields, word from, word to)
{
TPrinter& pr = printer();
if (show_fields!=printmode_noprint && to>from)
if (show_fields!=printmode_noprint && to>from)
{
// print preceeding rows:are all those rows which have Y coord <= than subsection's Y
if (subsection_above()!=NULL && !subsection_above()->is_title())
{
// print preceeding rows:are all those rows which have Y coord <= than subsection's Y
if (subsection_above()!=NULL && !subsection_above()->is_title())
{
// find some to print: print titles.....
if (show_fields == printmode_normal)
subsection_above()->print_titles();
}
if (pr.current_row() > pr.headersize()+1)
if ((to-from+1) > pr.rows_left() && show_fields==printmode_normal )
pr.formfeed();
for (word j = from; j < to ;j++)
switch (show_fields)
{
case printmode_normal:
pr.print(row(j)); break; // print to printer
default:
_titlerows.add(row(j),j); break; // print to buffer
}
return to;
// find some to print: print titles.....
if (show_fields == printmode_normal)
subsection_above()->print_titles();
}
return from;
if (pr.current_row() > pr.headersize()+1)
if ((to-from+1) > pr.rows_left() && show_fields==printmode_normal )
pr.formfeed();
for (word j = from; j < to ;j++)
switch (show_fields)
{
case printmode_normal:
pr.print(row(j)); break; // print to printer
default:
_titlerows.add(row(j),j); break; // print to buffer
}
return to;
}
return from;
}
// @doc EXTERNAL
@ -3721,24 +3724,20 @@ bool TForm::print(
{
for (pagetype t = odd_page; t <= last_page; t = pagetype(t+1))
{
if (height(t)> (word)pr.formlen())
if (height(t) > (word)pr.formlen())
{
TString s(TR("La lunghezza totale della sezione "));
TString s;
s << TR("La lunghezza totale della sezione ");
switch ( t )
{
case odd_page:
s << TR("standard"); break;
case even_page:
s << TR("pagine pari"); break;
case first_page:
s << TR("prima pagina"); break;
case last_page:
s << TR("ultima pagina"); break;
default:
break;
case odd_page: s << TR("standard"); break;
case even_page: s << TR("pagine pari"); break;
case first_page: s << TR("prima pagina"); break;
case last_page: s << TR("ultima pagina"); break;
default: break;
}
s << TR(" eccede la lunghezza reale del foglio.");
message_box(s);
warning_box(s);
}
}
}
@ -4087,7 +4086,7 @@ bool TForm::validate(TForm_item &cf, TToken_string &s)
TString fld(curr.left(poseq)); // preleva il nome del campo del form alla sinistra dell'uguale
const TString &dat= file->get(curr.mid(posrv)); // preleva il nome del campo del file alla destra dell'uguale e lo legge dal record
if (fld[0]=='#') fld.ltrim(1);
if (fld.right(1)== "@")
if (fld.ends_with("@"))
{ // se c'è la a-commerciale è un gruppo
if (fld.find("->") != -1)
{ // se nel gruppo c'è la freccia si riferisce ad un'altra sezione

View File

@ -47,8 +47,11 @@
#define MOV_DNDOC "DNDOC"
#define MOV_DATAINC "DATAINC"
#define MOV_LIQDIFF "LIQDIFF"
#define MOV_CONTRATTO "CONTRATTO"
#define MOV_MODPAG "MODPAG"
#define MOV_CONTRATTO "CONTRATTO"
#define MOV_DATAFATT "DATAFATT"
#define MOV_NUMFATT "NUMFATT"
#define MOV_ANNOFE "ANNOFE"
#define MOV_CONTSEP "CONTSEP"
#define NUMREG_PROVVISORIO 999999L

View File

@ -96,7 +96,7 @@ public:
bool write_enable() const { return _write_enable; }
void write_enable(bool we) { _write_enable = we; }
TRectype& load_rec(TRectype& r, const TRectype& from) const;
const char* evaluate_expr(int j, const TLocalisamfile& to);
const char* evaluate_expr(int j, const TLocalisamfile& to) const;
void print_on(TToken_string& out) const;
@ -240,7 +240,7 @@ void TRelationdef::print_on(TToken_string& out) const
}
const char* TRelationdef::evaluate_expr(int j, const TLocalisamfile& to)
const char* TRelationdef::evaluate_expr(int j, const TLocalisamfile& to) const
{
const TRectype& rec = to.curr();
TExpression& expr = (TExpression&)_exprs[j];
@ -645,7 +645,7 @@ int TRelation::position_rels(
// workhorse: position files for each active relation
for (int i = primo; i < ultimo; i++)
{
TRelationdef& rd = reldef(i);
TRelationdef& rd = reldef(i);
if (primo > 0 && rd.link() < primo)
continue; // Inutile spostare file collegati a record precedenti
@ -663,7 +663,7 @@ int TRelation::position_rels(
for (int j = 0; j < rd._fields.items(); j++) // for each field
{
expr = rd.evaluate_expr(j, to);
TFieldref& s = (TFieldref&) rd._fields[j];
const TFieldref& s = (const TFieldref&) rd._fields[j];
s.write(expr, furr);
} // for each field
@ -2061,8 +2061,13 @@ const char* TSorted_cursor::fill_sort_key(TString& k)
// Converte in ANSI i campi data ed i sottocampi con una data!
if (fld_type == _datefld || (f.is_subfield() && TDate::isdate(sf)))
{
const TDate d(sf);
sf.format("%08ld", d.date2ansi());
if (sf.not_empty()) // Aggiunta del 17-10-2011 per efficienza stampe mg (ma potrebbe non andar bene!)
{
const TDate d(sf);
sf.format("%08ld", d.date2ansi());
}
else
sf.spaces(8);
fld_type = _datefld;
fld_len = 8;
}
@ -2092,7 +2097,7 @@ bool TSorted_cursor::changed()
{
rt = TCursor::changed();
if (!rt) rt=_is_changed_expr;
_is_changed_expr = FALSE;
_is_changed_expr = false;
}
else
NFCHECK("Can't perform changed() while sorted cursor expression is not valid!");
@ -2964,12 +2969,12 @@ int TSortedfile::reread(TRectype& rec, word lockop)
return 0;
}
// @mfunc Legge il record (vedi <t TReclock> e <t TIsamop>)
int TSortedfile::read(word op , word lockop )
{
return read(curr(),op,lockop);
}
// @mfunc Legge il record e lo copia in <p rec> (vedi <t TReclock> e <t TIsamop>)
int TSortedfile::read(TRectype& rec, word op , word lockop )
{

View File

@ -752,8 +752,7 @@ public:
// @cmember Indietreggia al record precedente
virtual int operator --();
// @cmember Ritorna TRUE se tabella
virtual bool tab() const
{ return FALSE;}
virtual bool tab() const { return false;}
// @cmember Ritorna il record corrente del del file
virtual TRectype& curr() const;