Patch level : 10.0
Files correlati : report.alx Ricompilazione Demo : [ ] Commento : Corretto messaggio di incremento importi git-svn-id: svn://10.65.10.50/trunk@20344 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
af646cfa73
commit
d08c97ed08
@ -32,7 +32,7 @@ enum AVM_opcode
|
||||
avm_negate, avm_null,
|
||||
avm_or, avm_over,
|
||||
avm_perform, avm_pick, avm_plus_loop, avm_plus_store, avm_push,
|
||||
avm_repeat, avm_rdrop, avm_rpeek, avm_rpush, avm_roll, avm_rot, avm_round,
|
||||
avm_repeat, avm_rpop, avm_rpeek, avm_rpush, avm_roll, avm_rot, avm_round,
|
||||
avm_strfind, avm_strlen, avm_strmid, avm_strtok_fetch, avm_strtok_add,
|
||||
avm_store, avm_sp, avm_sub, avm_swap,
|
||||
avm_then, avm_trunc,
|
||||
@ -193,8 +193,7 @@ void TAVM_list_window::update()
|
||||
if (op.has_break())
|
||||
printat(4, y, "<");
|
||||
|
||||
if (co == avm_else || co == avm_then ||
|
||||
co == avm_loop || co == avm_plus_loop ||
|
||||
if (co == avm_else || co == avm_then || co == avm_loop || co == avm_plus_loop ||
|
||||
co == avm_repeat || co == avm_until || co == avm_while)
|
||||
tab -= 2;
|
||||
if (co == avm_push)
|
||||
@ -225,8 +224,7 @@ void TAVM_list_window::update()
|
||||
str << " (" << var.as_string() << ')';
|
||||
}
|
||||
printat(tab, y, str);
|
||||
if (co == avm_if || co == avm_else ||
|
||||
co == avm_do || co == avm_begin || co == avm_while)
|
||||
if (co == avm_if || co == avm_else || co == avm_do || co == avm_begin || co == avm_while)
|
||||
tab += 2;
|
||||
}
|
||||
}
|
||||
@ -325,7 +323,6 @@ class TAVM_monitor : public TAutomask
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
virtual bool on_key(KEY k);
|
||||
|
||||
public:
|
||||
void set_ignore_mon(bool im) { _ignore_mon = im; }
|
||||
@ -339,32 +336,25 @@ public:
|
||||
|
||||
bool TAVM_monitor::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TAVM_monitor::on_key(KEY k)
|
||||
{
|
||||
switch (k)
|
||||
switch (o.dlg())
|
||||
{
|
||||
case K_F9:
|
||||
set_ignore_mon(true);
|
||||
case K_F10:
|
||||
case K_F11:
|
||||
stop_run(k);
|
||||
return true;
|
||||
case DLG_CANCEL:
|
||||
if (e == fe_button)
|
||||
set_ignore_mon(true);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return TAutomask::on_key(k);
|
||||
return true;
|
||||
}
|
||||
|
||||
TAVM_monitor::TAVM_monitor() : TAutomask("Monitor", 1, 64, -1, -1, 1), _ignore_mon(false)
|
||||
{
|
||||
//toolbar modernissima
|
||||
add_button_tool(DLG_NEXTREC, "Step F11", TOOL_NEXTREC).set_exit_key(K_F11);
|
||||
add_button_tool(DLG_LASTREC, "Skip F10", TOOL_NEXTREC).set_exit_key(K_F10);
|
||||
add_button_tool(DLG_ELABORA, "Run F5", TOOL_LASTREC).set_exit_key(K_F5);
|
||||
add_button_tool(DLG_CANCEL, "NoMon F9", TOOL_CANCEL).set_exit_key(K_F9);
|
||||
add_button_tool(DLG_QUIT, "End", TOOL_QUIT).set_exit_key(K_QUIT);
|
||||
add_button_tool(DLG_NEXTREC, "Step", TOOL_NEXTREC).set_exit_key(K_F11);
|
||||
add_button_tool(DLG_LASTREC, "Skip", TOOL_NEXTREC).set_exit_key(K_F10);
|
||||
add_button_tool(DLG_ELABORA, "Run", TOOL_LASTREC).set_exit_key(K_F5);
|
||||
add_button_tool(DLG_CANCEL, "No MON", TOOL_CANCEL).set_exit_key(K_F5);
|
||||
add_button_tool(DLG_QUIT, "Quit", TOOL_QUIT).set_exit_key(K_QUIT);
|
||||
|
||||
//campi vari
|
||||
//finestra con codice
|
||||
@ -948,7 +938,7 @@ void TAVM::execute(const TAVM_op& op)
|
||||
break;
|
||||
case avm_push: _stack.push(op.var()); break;
|
||||
case avm_repeat: _ip = op.var().as_int(); break;
|
||||
case avm_rdrop: _stack.push(_rstack.pop()); break;
|
||||
case avm_rpop: _stack.push(_rstack.pop()); break;
|
||||
case avm_rpeek: _stack.push(_rstack.peek()); break;
|
||||
case avm_rpush: _rstack.push(_stack.pop()); break;
|
||||
case avm_roll: _stack.roll(_stack.pop().as_int()); break;
|
||||
|
@ -78,10 +78,10 @@ public:
|
||||
virtual long count( CONDITION_FUNCTION = NULL );
|
||||
// @cmember Ritorna l'oggetto successivo a quello corrente
|
||||
TObject* operator++ ()
|
||||
{ return succ_item( ); };
|
||||
{ return succ_item( ); }
|
||||
// @cmember Ritorna l'oggetto che precede quello corrente
|
||||
TObject* operator-- ()
|
||||
{ return pred_item( ); };
|
||||
{ return pred_item( ); }
|
||||
|
||||
virtual ~TContainer() { }
|
||||
};
|
||||
@ -199,27 +199,23 @@ public:
|
||||
};
|
||||
|
||||
inline TObject* TArray::objptr(int index) const
|
||||
{
|
||||
return (index < _size && index >= 0) ? _data[index] : NULL;
|
||||
}
|
||||
{ return (index < _size && index >= 0) ? _data[index] : NULL; }
|
||||
|
||||
#ifndef DBG
|
||||
inline TObject& TArray::operator[] (int index) const
|
||||
{
|
||||
return *objptr(index);
|
||||
}
|
||||
{ return *objptr(index); }
|
||||
#endif
|
||||
|
||||
#define FOR_EACH_ARRAY_ITEM(__arr, __r, __obj) \
|
||||
TObject* __obj; \
|
||||
for (int __r = __arr.first(); \
|
||||
(__obj = __arr.objptr(__r)); \
|
||||
(__obj = __arr.objptr(__r)); \
|
||||
__r = __arr.succ(__r))
|
||||
|
||||
#define FOR_EACH_ARRAY_ITEM_BACK(__arr, __r, __obj) \
|
||||
TObject* __obj; \
|
||||
for (int __r = __arr.last(); \
|
||||
(__obj = __arr.objptr(__r)); \
|
||||
(__obj = __arr.objptr(__r)); \
|
||||
__r = __arr.pred(__r))
|
||||
|
||||
|
||||
@ -239,7 +235,7 @@ public:
|
||||
long get_long(int index) const { return (long)objptr(index); }
|
||||
int get_int(int index) const { return (int)get_long(index); }
|
||||
int add_long(long value, int index = -1) { return add((TObject*)value, index); }
|
||||
int insert_long(long value, int index = -1) { return TArray::insert((TObject*)value, index, TRUE); }
|
||||
int insert_long(long value, int index = -1) { return TArray::insert((TObject*)value, index, true); }
|
||||
int find_long(long value) const;
|
||||
|
||||
TPointer_array() { }
|
||||
|
@ -80,65 +80,41 @@
|
||||
SP
|
||||
;
|
||||
|
||||
: REP_ADD_IMPORTO ( dst_sezione_fld dst_valore_fld src_sezione src_valore -- )
|
||||
DUP \ dup src_valore
|
||||
EMPTY= IF \ se l'importo sorgente è nullo butta tutto e finisce qui
|
||||
DROP
|
||||
DROP
|
||||
DROP
|
||||
DROP
|
||||
: REP_ADD_IMPORTO ( f1 -- )
|
||||
#THIS @ \ leggo l'importo da sommare
|
||||
EMPTY= IF \ se è nullo
|
||||
DROP \ butta tutto e finisce qui
|
||||
ELSE
|
||||
3 PICK >R \ prende dst_sezione_fld
|
||||
2 PICK >R \ prende dst_valore_fld
|
||||
>R \ store di src_valore
|
||||
>R \ store di src_sezione
|
||||
SWAP \ porta in cima allo stack la dst_sezione_fld
|
||||
DUP \ la duplica perchè la perde la riga dopo
|
||||
@ \ prende il valore di dst_sezione_fld
|
||||
|
||||
EMPTY= IF \ se la dst_sezione_fld è vuota
|
||||
R> \ recupera la src_sezione
|
||||
SWAP \ gira i due termini
|
||||
! \ assegna il contenuto della src_sezione al campo dst_sezione_fld
|
||||
R> \ prende src_valore
|
||||
SWAP \ gira i campi src_valore e dst_valore_fld
|
||||
! \ assegna src_valore al campo dst_valore_fld
|
||||
DUP \ duplica l'identificatore della destinazione
|
||||
>R \ memorizza l'identificare della destinazione nel return stack
|
||||
@ \ valore della destinazione
|
||||
EMPTY= IF \ se è nullo
|
||||
#THIS GET_ID_NEXT @ \ recupera la sezione sorgente
|
||||
R@ GET_ID_NEXT ! \ imposta la sezione destinazione
|
||||
#THIS @ \ recupera il valore sorgente
|
||||
R@ ! \ imposta il valore destinazione
|
||||
ELSE
|
||||
@
|
||||
R> \ legge src_sezione
|
||||
= IF
|
||||
R> \ prende src_valore
|
||||
ELSE
|
||||
R> \ prende src_valore
|
||||
-1 * \ inverte il segno di src_valore
|
||||
#THIS @ \ leggo l'importo da sommare
|
||||
#THIS GET_ID_NEXT @ \ leggo la sezione sorgente
|
||||
R@ GET_ID_NEXT @ \ leggo la sezione destinazione
|
||||
<> IF \ se sono diverse
|
||||
-1 * \ inverte valore
|
||||
THEN
|
||||
SWAP \ gira i campi sullo stack src_valore dst_valore_fld
|
||||
+! \ somma src_valore con segno rovesciato al campo dst_valore_fld
|
||||
R@ +! \ incrementa la destinazione
|
||||
THEN
|
||||
\ normalizzazione della destinazione
|
||||
MON
|
||||
R@ \ recupera dst_valore_fld
|
||||
@ \ legge il valore di dst_valore_fld
|
||||
DUP \ lo duplica per possibile cambio di segno
|
||||
0 < IF \ se il valore è negativo
|
||||
-1 * \ gli cambia segno
|
||||
R> \ recupera ancora dst_valore_fld
|
||||
! \ salva il valore positivo nel campo dst_valore_fld
|
||||
R@ \ recupera dst_sezione_fld
|
||||
@ \ legge il valore di dst_sezione_fld
|
||||
"A" = IF \ lo inverte
|
||||
R@ @ \ recupera valore destinazione da normalizzare
|
||||
0 < IF \ se il valore è negativo
|
||||
R@ @ -1 * \ gli cambia segno
|
||||
R@ ! \ lo risalva positivo
|
||||
R@ GET_ID_NEXT @ \ recupera sezione di destinazione
|
||||
"A" = IF \ la inverte
|
||||
"D"
|
||||
ELSE
|
||||
"A"
|
||||
THEN
|
||||
R> \ recupera ancora dst_sezione_fld
|
||||
! \ salva il valore cambiato della sezione in dst_sezione_fld
|
||||
ELSE
|
||||
DROP \ se non deve invertire nulla svuota gli stack
|
||||
R>
|
||||
R>
|
||||
R@ GET_ID_NEXT ! \ salva nuova sezione
|
||||
THEN
|
||||
|
||||
R> \ ripristina il return stack
|
||||
THEN
|
||||
;
|
||||
|
||||
@ -274,7 +250,11 @@ THEN
|
||||
#SYSTEM.DATE @ \ Leggo la data
|
||||
#THIS ! \ Setto il campo corrente con la data
|
||||
;
|
||||
|
||||
: MESSAGE_DITTA ( s1 -- )
|
||||
GET_FIRM_DATA \ Campi della ditta corrente
|
||||
;
|
||||
|
||||
: MESSAGE_ADD_IMPORTO ( f1 -- )
|
||||
REP_ADD_IMPORTO \ Incrementa un importo presumendo sia seguito dalla sua sezione
|
||||
;
|
||||
|
@ -1119,6 +1119,24 @@ TObject* TReport_array_item::dup() const
|
||||
// TReport_field
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TReport_field* TReport_field::next() const
|
||||
{
|
||||
const TArray& sec = section();
|
||||
for (int i = sec.last()-1; i >= 0; i--)
|
||||
if (sec.objptr(i) == this)
|
||||
return (TReport_field*)sec.objptr(i+1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TReport_field* TReport_field::prev() const
|
||||
{
|
||||
const TArray& sec = section();
|
||||
for (int i = sec.last(); i > 0; i--)
|
||||
if (sec.objptr(i) == this)
|
||||
return (TReport_field*)sec.objptr(i-1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TReport_field::set_pos(long x, long y)
|
||||
{
|
||||
_rct.x = x;
|
||||
@ -1820,7 +1838,7 @@ bool TReport_field::load(const TXmlItem& fld)
|
||||
activate(!fld.GetBoolAttr("deactivated"));
|
||||
hide_zeroes(fld.GetBoolAttr("hide_zero"));
|
||||
set_border(fld.GetIntAttr("border"));
|
||||
set_pattern((PAT_STYLE)fld.GetIntAttr("pattern", PAT_SOLID));
|
||||
set_pattern((PAT_STYLE)fld.GetIntAttr("pattern", PAT_HOLLOW));
|
||||
set_radius(fld.GetIntAttr("radius"));
|
||||
set_shadow_offset(fld.GetIntAttr("shade_offset"));
|
||||
set_back_color(get_col_attr(fld, "bg_color", COLOR_WHITE));
|
||||
@ -2108,16 +2126,15 @@ int TReport::parse_field(const char* code, char& type, int& level, int& id) cons
|
||||
if (strchr(code, '.') != NULL)
|
||||
return 0; // Mi sono confuso con un campo su file, es: 34.CODART
|
||||
|
||||
id = atoi(code);
|
||||
TReport_field* rf = curr_field();
|
||||
if (rf != NULL)
|
||||
{
|
||||
type = rf->section().type();
|
||||
level = rf->section().level();
|
||||
if (code[0] == 'T')
|
||||
id = rf->id();
|
||||
}
|
||||
if (code[0] == 'T')
|
||||
id = rf->id();
|
||||
else
|
||||
id = atoi(code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2159,6 +2176,7 @@ TReport_field* TReport::field(const char* code)
|
||||
else
|
||||
rf = curr_field();
|
||||
}
|
||||
|
||||
return rf;
|
||||
}
|
||||
|
||||
@ -2614,8 +2632,10 @@ size_t TReport::get_usr_words(TString_array& words) const
|
||||
{
|
||||
const char* const name[] =
|
||||
{
|
||||
"***", "DISABLE", "ENABLE", "GET_POS",
|
||||
"GET_SIZE", "HIDE", "ISAM_READ", "RUN_FORM", "SET_BACK_COLOR", "SET_FORE_COLOR",
|
||||
"***", "DISABLE", "ENABLE",
|
||||
"GET_ID", "GET_ID_NEXT", "GET_ID_PREV",
|
||||
"GET_POS", "GET_SIZE", "HIDE", "ISAM_READ",
|
||||
"RUN_FORM", "SET_BACK_COLOR", "SET_FORE_COLOR",
|
||||
"SET_POS", "SET_SIZE", "SHOW", "TABLE_READ", "GET_FIRM_DATA", NULL
|
||||
};
|
||||
size_t i;
|
||||
@ -3119,6 +3139,28 @@ void TReport::msg_firm(TVariant_stack& stack)
|
||||
}
|
||||
}
|
||||
|
||||
// Scrive in var il codice del campo, con o senza sezione nel prefisso
|
||||
// a seconda che sia un fratello del campo corrente o no
|
||||
HIDDEN bool fld2id(TReport_field* fld, TVariant& var)
|
||||
{
|
||||
var.set_null();
|
||||
if (fld != NULL)
|
||||
{
|
||||
TReport_section& sec = fld->section();
|
||||
TReport& rep = sec.report();
|
||||
TReport_field* curr = rep.curr_field();
|
||||
if (curr == NULL || &sec != &curr->section())
|
||||
{
|
||||
TString16 str;
|
||||
str << sec.type() << sec.level() << '.' << fld->id();
|
||||
var.set(str);
|
||||
}
|
||||
else
|
||||
var.set(fld->id());
|
||||
}
|
||||
return var.is_null();
|
||||
}
|
||||
|
||||
bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
{
|
||||
switch (opcode)
|
||||
@ -3131,7 +3173,30 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
case 3: // ENABLE
|
||||
do_message(stack.pop(), do_enable, (void*)1);
|
||||
break;
|
||||
case 4: // GET_POS
|
||||
case 4: // GET_ID
|
||||
{
|
||||
TVariant& var = stack.peek();
|
||||
TReport_field* f = field(var.as_string());
|
||||
fld2id(f, var);
|
||||
}
|
||||
break;
|
||||
case 5: // GET_ID_NEXT
|
||||
{
|
||||
TVariant& var = stack.peek();
|
||||
TReport_field* f = field(var.as_string());
|
||||
if (f != NULL) f = f->next();
|
||||
fld2id(f, var);
|
||||
}
|
||||
break;
|
||||
case 6: // GET_ID_PREV
|
||||
{
|
||||
TVariant& var = stack.peek();
|
||||
TReport_field* f = field(var.as_string());
|
||||
if (f != NULL) f = f->prev();
|
||||
fld2id(f, var);
|
||||
}
|
||||
break;
|
||||
case 7: // GET_POS
|
||||
{
|
||||
real x, y;
|
||||
int level, id;
|
||||
@ -3153,7 +3218,7 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
stack.push(x); stack.push(y);
|
||||
}
|
||||
break;
|
||||
case 5: // GET_SIZE
|
||||
case 8: // GET_SIZE
|
||||
{
|
||||
real w, h;
|
||||
int level, id;
|
||||
@ -3180,34 +3245,34 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
stack.push(w); stack.push(h);
|
||||
}
|
||||
break;
|
||||
case 6: // HIDE
|
||||
case 9: // HIDE
|
||||
do_message(stack.pop(), do_show, NULL);
|
||||
break;
|
||||
case 7: // ISAM_READ
|
||||
case 10: // ISAM_READ
|
||||
msg_isam_read(stack);
|
||||
break;
|
||||
case 8: // RUN_FORM
|
||||
case 11: // RUN_FORM
|
||||
{
|
||||
const TString& msk = stack.pop().as_string();
|
||||
const KEY key = run_form(msk);
|
||||
stack.push(key);
|
||||
}
|
||||
break;
|
||||
case 9: // SET_BACK_COLOR
|
||||
case 12: // SET_BACK_COLOR
|
||||
{
|
||||
const TVariant& fld = stack.pop();
|
||||
const COLOR rgb = stack.pop().as_color();
|
||||
do_message(fld, do_set_back_color, (void*)rgb);
|
||||
}
|
||||
break;
|
||||
case 10: // SET_FORE_COLOR
|
||||
case 13: // SET_FORE_COLOR
|
||||
{
|
||||
const TVariant& fld = stack.pop();
|
||||
const COLOR rgb = stack.pop().as_color();
|
||||
do_message(fld, do_set_fore_color, (void*)rgb);
|
||||
}
|
||||
break;
|
||||
case 11: // SET_POS
|
||||
case 14: // SET_POS
|
||||
{
|
||||
const TVariant& fld = stack.pop();
|
||||
const real y = stack.pop().as_real() * CENTO;
|
||||
@ -3216,7 +3281,7 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
do_message(fld, do_set_pos, (void*)&pt);
|
||||
}
|
||||
break;
|
||||
case 12: // SET_SIZE
|
||||
case 15: // SET_SIZE
|
||||
{
|
||||
const TVariant& fld = stack.pop();
|
||||
const real h = stack.pop().as_real() * CENTO;
|
||||
@ -3225,13 +3290,13 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
do_message(fld, do_set_size, (void*)&sz);
|
||||
}
|
||||
break;
|
||||
case 13: // SHOW
|
||||
case 16: // SHOW
|
||||
do_message(stack.pop(), do_show, (void*)1);
|
||||
break;
|
||||
case 14: // TABLE_READ
|
||||
case 17: // TABLE_READ
|
||||
msg_table_read(stack);
|
||||
break;
|
||||
case 15: // GET_FIRM_DATA
|
||||
case 18: // GET_FIRM_DATA
|
||||
msg_firm(stack);
|
||||
break;
|
||||
default:
|
||||
|
@ -493,6 +493,9 @@ public:
|
||||
void save(TXmlItem& root) const;
|
||||
bool load(const TXmlItem& root);
|
||||
|
||||
TReport_field* next() const;
|
||||
TReport_field* prev() const;
|
||||
|
||||
TReport_field(TReport_section* sec);
|
||||
TReport_field(const TReport_field& rf);
|
||||
virtual ~TReport_field();
|
||||
|
Loading…
x
Reference in New Issue
Block a user