Continua il fantastico sviluppo della modifica magazzino e la correzione della fatturazione bolle.
git-svn-id: svn://10.65.10.50/trunk@3470 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c987c32b22
commit
f281fcdb73
@ -122,23 +122,6 @@ BEGIN
|
|||||||
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_STATO_I_DOC_I_1 1
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 9 "Stato iniziale "
|
|
||||||
FLAGS "U"
|
|
||||||
FIELD S7[1,1]
|
|
||||||
WARNING "E' necessario specificare un valore"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_STATO_F_DOC_I 1
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 10 "Stato finale "
|
|
||||||
FLAGS "U"
|
|
||||||
FIELD S4
|
|
||||||
CHECKTYPE REQUIRED
|
|
||||||
WARNING "E' necessario specificare uno stato finale"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_TIPODOC_I_2 4
|
STRING F_TIPODOC_I_2 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 30 8 ""
|
PROMPT 30 8 ""
|
||||||
@ -153,14 +136,6 @@ BEGIN
|
|||||||
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_STATO_I_DOC_I_2 1
|
|
||||||
BEGIN
|
|
||||||
PROMPT 30 9 ""
|
|
||||||
FLAGS "U"
|
|
||||||
FIELD S7[2,2]
|
|
||||||
WARNING "E' necessario specificare un valore"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_TIPODOC_I_3 4
|
STRING F_TIPODOC_I_3 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 39 8 ""
|
PROMPT 39 8 ""
|
||||||
@ -175,14 +150,6 @@ BEGIN
|
|||||||
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_STATO_I_DOC_I_3 1
|
|
||||||
BEGIN
|
|
||||||
PROMPT 39 9 ""
|
|
||||||
FLAGS "U"
|
|
||||||
FIELD S7[3,3]
|
|
||||||
WARNING "E' necessario specificare un valore"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_TIPODOC_I_4 4
|
STRING F_TIPODOC_I_4 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 48 8 ""
|
PROMPT 48 8 ""
|
||||||
@ -197,14 +164,6 @@ BEGIN
|
|||||||
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_STATO_I_DOC_I_4 1
|
|
||||||
BEGIN
|
|
||||||
PROMPT 48 9 ""
|
|
||||||
FLAGS "U"
|
|
||||||
FIELD S7[4,4]
|
|
||||||
WARNING "E' necessario specificare un valore"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_TIPODOC_I_5 4
|
STRING F_TIPODOC_I_5 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 57 8 ""
|
PROMPT 57 8 ""
|
||||||
@ -219,12 +178,50 @@ BEGIN
|
|||||||
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
WARNING "E' necessario specificare un valore valido e previsto dalla numerazione"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
STRING F_STATO_I_DOC_I_1 1
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 9 "Stato iniziale "
|
||||||
|
FLAGS "U"
|
||||||
|
FIELD S7[1,1]
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
WARNING "E' necessario specificare uno stato iniziale"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_STATO_I_DOC_I_2 1
|
||||||
|
BEGIN
|
||||||
|
PROMPT 30 9 ""
|
||||||
|
FLAGS "U"
|
||||||
|
FIELD S7[2,2]
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_STATO_I_DOC_I_3 1
|
||||||
|
BEGIN
|
||||||
|
PROMPT 39 9 ""
|
||||||
|
FLAGS "U"
|
||||||
|
FIELD S7[3,3]
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_STATO_I_DOC_I_4 1
|
||||||
|
BEGIN
|
||||||
|
PROMPT 48 9 ""
|
||||||
|
FLAGS "U"
|
||||||
|
FIELD S7[4,4]
|
||||||
|
END
|
||||||
|
|
||||||
STRING F_STATO_I_DOC_I_5 1
|
STRING F_STATO_I_DOC_I_5 1
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 57 9 ""
|
PROMPT 57 9 ""
|
||||||
FLAGS "U"
|
FLAGS "U"
|
||||||
FIELD S7[5,5]
|
FIELD S7[5,5]
|
||||||
WARNING "E' necessario specificare un valore"
|
END
|
||||||
|
|
||||||
|
STRING F_STATO_F_DOC_I 1
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 10 "Stato finale "
|
||||||
|
FLAGS "U"
|
||||||
|
FIELD S4
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
WARNING "E' necessario specificare uno stato finale"
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 6
|
GROUPBOX DLG_NULL 78 6
|
||||||
|
655
ve/ve4100.cpp
655
ve/ve4100.cpp
@ -3,6 +3,7 @@
|
|||||||
#include <msksheet.h>
|
#include <msksheet.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
|
#include <sheet.h>
|
||||||
#include <stack.h>
|
#include <stack.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -17,32 +18,49 @@
|
|||||||
|
|
||||||
class TTable_expression : public TExpression
|
class TTable_expression : public TExpression
|
||||||
{
|
{
|
||||||
static TAssoc_array _expr;
|
static TArray _expr;
|
||||||
static const TRelation* _rel;
|
static const TRelation* _rel;
|
||||||
|
static TViswin* _win;
|
||||||
|
static bool _errors;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void evaluate_user_func(const char* name, int nparms,
|
virtual bool print_error(const char* msg) const;
|
||||||
TStack& stack, TTypeexp curtype) const;
|
virtual int parse_user_func(const char* name, int nparms) const;
|
||||||
|
virtual void evaluate_user_func(int index, int nparms,
|
||||||
|
TEval_stack& stack, TTypeexp curtype) const;
|
||||||
|
virtual bool user_func_dirty() const;
|
||||||
|
|
||||||
int str2file(const TString& s) const;
|
bool error_box(const char* fmt, ...) const;
|
||||||
void load_expr();
|
|
||||||
const TRelation& get_relation() const { CHECK(_rel, "NULL relation"); return *_rel; }
|
const TRelation& get_relation() const { CHECK(_rel, "NULL relation"); return *_rel; }
|
||||||
const char* get_var(const char* v) const;
|
|
||||||
|
// Cerca il record dato il file->campo. Usata da get_field e put_field.
|
||||||
|
TRectype* field2rec(TString& var) const;
|
||||||
|
// Converte un nome di funzione in indice
|
||||||
|
int name2index(const char* name) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_relation(const TRelation& rel) { _rel = &rel; }
|
static void load_table(bool force = FALSE);
|
||||||
|
static void set_relation(const TRelation* rel) { _rel = rel; load_table(); }
|
||||||
|
static void set_window(TViswin* win) { _win = win; }
|
||||||
|
static void reset_errors() { _errors = FALSE; }
|
||||||
|
static bool errors_found() { return _errors; }
|
||||||
|
|
||||||
TTable_expression(TTypeexp t) : TExpression(t) { }
|
int str2file(const TString& s) const;
|
||||||
TTable_expression(const char* expr, TTypeexp t) : TExpression(expr, t) { }
|
const char* get_field(const char* f) const;
|
||||||
|
void set_field(const char* field, const char* val) const;
|
||||||
|
|
||||||
|
TTable_expression() { }
|
||||||
virtual ~TTable_expression() { }
|
virtual ~TTable_expression() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
TAssoc_array TTable_expression::_expr;
|
TArray TTable_expression::_expr;
|
||||||
const TRelation* TTable_expression::_rel = NULL;
|
const TRelation* TTable_expression::_rel = NULL;
|
||||||
|
TViswin* TTable_expression::_win = NULL;
|
||||||
|
bool TTable_expression::_errors = FALSE;
|
||||||
|
|
||||||
void TTable_expression::load_expr()
|
void TTable_expression::load_table(bool force)
|
||||||
{
|
{
|
||||||
if (_expr.items() == 0)
|
if (_expr.items() == 0 || force)
|
||||||
{
|
{
|
||||||
TString n(15), e(127);
|
TString n(15), e(127);
|
||||||
TTable expr("%FRM");
|
TTable expr("%FRM");
|
||||||
@ -52,73 +70,188 @@ void TTable_expression::load_expr()
|
|||||||
e = expr.get("S1");
|
e = expr.get("S1");
|
||||||
e << expr.get("S2");
|
e << expr.get("S2");
|
||||||
const TTypeexp t = expr.get_bool("B0") ? _numexpr : _strexpr;
|
const TTypeexp t = expr.get_bool("B0") ? _numexpr : _strexpr;
|
||||||
_expr.add(n, new TTable_expression(e, t));
|
|
||||||
|
TTable_expression* te = new TTable_expression;
|
||||||
|
if (te->set(e, t))
|
||||||
|
{
|
||||||
|
THash_object* o = new THash_object(n, te);
|
||||||
|
_expr.add(o);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
te->error_box("La funzione %s contiene un simbolo errato: %s",
|
||||||
|
(const char*)n, te->last_token());
|
||||||
|
delete te;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TTable_expression::user_func_dirty() const
|
||||||
|
{
|
||||||
|
return _errors || TExpression::user_func_dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TTable_expression::print_error(const char* msg) const
|
||||||
|
{
|
||||||
|
if (_win)
|
||||||
|
{
|
||||||
|
TString s(256);
|
||||||
|
s << "@b$[r,w]" << msg;
|
||||||
|
_win->add_line(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
::error_box("%s", msg);
|
||||||
|
return _errors = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TTable_expression::error_box(const char* fmt, ...) const
|
||||||
|
{
|
||||||
|
char msg[256];
|
||||||
|
va_list argptr;
|
||||||
|
va_start(argptr,fmt);
|
||||||
|
vsprintf(msg, fmt, argptr);
|
||||||
|
va_end(argptr);
|
||||||
|
return print_error(msg);
|
||||||
|
}
|
||||||
|
|
||||||
int TTable_expression::str2file(const TString& str) const
|
int TTable_expression::str2file(const TString& str) const
|
||||||
{
|
{
|
||||||
HIDDEN const char* const s = "AUDCR";
|
HIDDEN const char* const s = "AUDCR";
|
||||||
HIDDEN const int logicnum[] = { LF_ANAMAG, LF_UMART, LF_DESLIN, LF_CONDV, LF_RCONDV };
|
HIDDEN const int logicnum[] = { LF_ANAMAG, LF_UMART, LF_DESLIN, LF_CONDV, LF_RCONDV };
|
||||||
const char* p = strchr(s, str[0]);
|
const char* p = strchr(s, toupper(str[0]));
|
||||||
CHECKS(p, "Identificatore di file errato: ", (const char*)str);
|
const int ln = p != NULL ? logicnum[p-s] : -1;
|
||||||
const int ln = logicnum[p-s];
|
|
||||||
return ln;
|
return ln;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TTable_expression::get_var(const char* v) const
|
TRectype* TTable_expression::field2rec(TString& var) const
|
||||||
{
|
{
|
||||||
TString var(v);
|
|
||||||
int logicnum = 0;
|
int logicnum = 0;
|
||||||
|
var.upper();
|
||||||
const int arrow = var.find("->");
|
const int arrow = var.find("->");
|
||||||
if (arrow > 0)
|
if (arrow > 0)
|
||||||
{
|
{
|
||||||
logicnum = str2file(var);
|
logicnum = str2file(var);
|
||||||
var = var.mid(arrow+2);
|
var = var.mid(arrow+2);
|
||||||
}
|
}
|
||||||
const char* val = "";
|
|
||||||
if (get_relation().exist(logicnum))
|
TRectype* rec = NULL;
|
||||||
{
|
if (logicnum >= 0 && get_relation().exist(logicnum))
|
||||||
const TFieldref fr(var, logicnum);
|
rec = &get_relation().curr(logicnum);
|
||||||
val = fr.read(get_relation());
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
NFCHECK("Il campo %s non appartiene alla relazione.", v);
|
error_box("Il campo '%s' non appartiene alla relazione.", (const char*)var);
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* TTable_expression::get_field(const char* f) const
|
||||||
|
{
|
||||||
|
TString var(f);
|
||||||
|
const TRectype* rec = field2rec(var);
|
||||||
|
const char* val = "";
|
||||||
|
if (rec != NULL)
|
||||||
|
{
|
||||||
|
if (rec->exist(var))
|
||||||
|
val = rec->get(var);
|
||||||
|
else
|
||||||
|
error_box("Il campo '%s' non appartiene al file %d.", (const char*)var, rec->num());
|
||||||
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTable_expression::evaluate_user_func(const char* name, int nparms,
|
void TTable_expression::set_field(const char* f, const char* v) const
|
||||||
TStack& stack, TTypeexp curtype) const
|
|
||||||
{
|
{
|
||||||
TTable_expression* expr = (TTable_expression*)_expr.objptr(name);
|
TString var(f);
|
||||||
if (expr == NULL)
|
TRectype* rec = field2rec(var);
|
||||||
{
|
if (rec != NULL)
|
||||||
TExpression::evaluate_user_func(name, nparms, stack, curtype);
|
rec->put(var, v);
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
int TTable_expression::name2index(const char* name) const
|
||||||
|
{
|
||||||
|
if (_expr.items() == 0)
|
||||||
|
load_table();
|
||||||
|
|
||||||
|
for (int index = _expr.items()-1; index >= 0; index--)
|
||||||
|
{
|
||||||
|
const THash_object& h = (const THash_object&)_expr[index];
|
||||||
|
if (h.key() == name)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
TTable expr("%FRM");
|
||||||
|
expr.put("CODTAB", name);
|
||||||
|
if (expr.read() == NOERR)
|
||||||
|
{
|
||||||
|
TString e(127);
|
||||||
|
e = expr.get("S1"); e << expr.get("S2");
|
||||||
|
const TTypeexp t = expr.get_bool("B0") ? _numexpr : _strexpr;
|
||||||
|
TTable_expression* te = new TTable_expression;
|
||||||
|
if (te->set(e, t))
|
||||||
|
{
|
||||||
|
THash_object* o = new THash_object(name, te);
|
||||||
|
index = _expr.add(o);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete te;
|
||||||
|
index = -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TTable_expression::parse_user_func(const char* name, int nparms) const
|
||||||
|
{
|
||||||
|
const int index = name2index(name);
|
||||||
|
switch(index)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
error_box("Funzione non riconosciuta: %s.", name);
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
error_box("La funzione %s contiene un simbolo errato: %s.",
|
||||||
|
name, last_token());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTable_expression::evaluate_user_func(int index, int nparms,
|
||||||
|
TEval_stack& stack, TTypeexp curtype) const
|
||||||
|
{
|
||||||
|
THash_object* ho = (THash_object*)_expr.objptr(index);
|
||||||
|
TTable_expression& expr = (TTable_expression&)ho->obj();
|
||||||
|
|
||||||
// Assegna i valori a tutte le variabili dell'espressione
|
// Assegna i valori a tutte le variabili dell'espressione
|
||||||
TString var;
|
for (int v = expr.numvar()-1; v >= 0; v--)
|
||||||
for (int v = expr->numvar()-1; v >= 0; v--)
|
|
||||||
{
|
{
|
||||||
var = expr->varname(v); var.upper();
|
const char* var = expr.varname(v);
|
||||||
if (var[0] == '_') // Parametro della funzione
|
if (var[0] == '#') // Parametro della funzione
|
||||||
{
|
{
|
||||||
const int n = atoi(var.mid(2,0));
|
const int n = atoi(var+1);
|
||||||
CHECKS(n > 0 && n <= nparms, "Parametro errato ", (const char*)var);
|
if (n > 0 && n <= nparms)
|
||||||
if (curtype == _numexpr)
|
{
|
||||||
expr->setvar(var, (real&)stack.peek(nparms-n));
|
const TObject& o = stack.peek(nparms-n);
|
||||||
|
if (o.class_id() == CLASS_STRING)
|
||||||
|
expr.setvar(var, (const TString&)o);
|
||||||
|
else
|
||||||
|
expr.setvar(var, (const real&)o);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
expr->setvar(var, (TString&)stack.peek(nparms-n));
|
error_box("Parametro non valido: %s", (const char*)var);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char* val = get_var(var);
|
const char* val = get_field(var);
|
||||||
if (curtype == _numexpr)
|
if (curtype == _numexpr)
|
||||||
expr->setvar(var, real(val));
|
expr.setvar(var, real(val));
|
||||||
else
|
else
|
||||||
expr->setvar(var, TString(val));
|
expr.setvar(var, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,13 +280,17 @@ class TRicalcolo_mask : public TMask
|
|||||||
TCursor* _cursor;
|
TCursor* _cursor;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool file_handler (TMask_field& f, KEY k);
|
bool test_formula(TMask_field& f) const;
|
||||||
static bool key_handler (TMask_field& f, KEY k);
|
|
||||||
static bool filter_handler(TMask_field& f, KEY k);
|
static bool file_handler (TMask_field& f, KEY k);
|
||||||
static bool field_handler (TMask_field& f, KEY k);
|
static bool key_handler (TMask_field& f, KEY k);
|
||||||
static bool fromto_handler(TMask_field& f, KEY k);
|
static bool filter_handler (TMask_field& f, KEY k);
|
||||||
|
static bool field_handler (TMask_field& f, KEY k);
|
||||||
|
static bool fromto_handler (TMask_field& f, KEY k);
|
||||||
|
static bool formula_handler(TMask_field& f, KEY k);
|
||||||
|
|
||||||
bool gestione_um(char tipo) const;
|
bool gestione_um(char tipo) const;
|
||||||
|
TRelation_description& get_des() const;
|
||||||
TRelation& get_rel() const;
|
TRelation& get_rel() const;
|
||||||
const TRectype& get_rec() const;
|
const TRectype& get_rec() const;
|
||||||
const RecDes* get_rec_des() const;
|
const RecDes* get_rec_des() const;
|
||||||
@ -193,10 +330,16 @@ TRicalcolo_mask::TRicalcolo_mask()
|
|||||||
TSheet_field& outputs = (TSheet_field&)field(F_OUTPUTS);
|
TSheet_field& outputs = (TSheet_field&)field(F_OUTPUTS);
|
||||||
TMask& osm = outputs.sheet_mask();
|
TMask& osm = outputs.sheet_mask();
|
||||||
osm.set_handler(F_FIELD, field_handler);
|
osm.set_handler(F_FIELD, field_handler);
|
||||||
|
osm.set_handler(F_FORMULA, formula_handler);
|
||||||
outputs.row(-1); // Aggiunge comunque una riga vuota;
|
outputs.row(-1); // Aggiunge comunque una riga vuota;
|
||||||
osm.force_update();
|
osm.force_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRelation_description& TRicalcolo_mask::get_des() const
|
||||||
|
{
|
||||||
|
return (TRelation_description&)_des[_cur_file];
|
||||||
|
}
|
||||||
|
|
||||||
TRelation& TRicalcolo_mask::get_rel() const
|
TRelation& TRicalcolo_mask::get_rel() const
|
||||||
{
|
{
|
||||||
return (TRelation&)_rel[_cur_file];
|
return (TRelation&)_rel[_cur_file];
|
||||||
@ -233,6 +376,7 @@ bool TRicalcolo_mask::gestione_um(char tipo) const
|
|||||||
{
|
{
|
||||||
const char* const lco = "LCO";
|
const char* const lco = "LCO";
|
||||||
for (int i = 0; i < 3 && toupper(tipo) != lco[i]; i++);
|
for (int i = 0; i < 3 && toupper(tipo) != lco[i]; i++);
|
||||||
|
CHECK(i < 3, "Gestione unita' di misura errata");
|
||||||
TConfig ve(CONFIG_DITTA, "ve");
|
TConfig ve(CONFIG_DITTA, "ve");
|
||||||
return ve.get_bool("GESUM", NULL, i+1);
|
return ve.get_bool("GESUM", NULL, i+1);
|
||||||
}
|
}
|
||||||
@ -240,7 +384,6 @@ bool TRicalcolo_mask::gestione_um(char tipo) const
|
|||||||
TRelation& TRicalcolo_mask::create_relation()
|
TRelation& TRicalcolo_mask::create_relation()
|
||||||
{
|
{
|
||||||
const int logicnum = get_rec().num(); // Numero logico del file principale
|
const int logicnum = get_rec().num(); // Numero logico del file principale
|
||||||
|
|
||||||
if (_relation)
|
if (_relation)
|
||||||
delete _relation;
|
delete _relation;
|
||||||
_relation = new TRelation(logicnum);
|
_relation = new TRelation(logicnum);
|
||||||
@ -352,19 +495,19 @@ TRelation& TRicalcolo_mask::create_relation()
|
|||||||
break;
|
break;
|
||||||
case LF_RCONDV:
|
case LF_RCONDV:
|
||||||
{
|
{
|
||||||
_relation->add(LF_ANAMAG, "CODRIGA=CODART", 1);
|
_relation->add(LF_ANAMAG, "CODART=CODRIGA", 1);
|
||||||
|
|
||||||
if (gestione_um(tipo_lco[0]))
|
if (gestione_um(tipo_lco[0]))
|
||||||
_relation->add(LF_UMART, "CODRIGA=CODART|UM=UM", 2);
|
_relation->add(LF_UMART, "CODART=CODRIGA|UM=UM", 2);
|
||||||
|
|
||||||
if (lingua.not_empty())
|
if (lingua.not_empty())
|
||||||
{
|
{
|
||||||
expr = "CODRIGA=CODART";
|
expr = "CODART=CODRIGA";
|
||||||
expr << "|CODLIN=\"" << lingua << '"';
|
expr << "|CODLIN=\"" << lingua << '"';
|
||||||
_relation->add(LF_DESLIN, expr, 2);
|
_relation->add(LF_DESLIN, expr, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
_relation->add(LF_RCONDV, "TIPO=TIPO|CATVEN=CATVEN|TIPOCF=TIPOCF|CODCF=CODCF|COD=COD", 1);
|
_relation->add(LF_RCONDV, "TIPO=TIPO|CATVEN=CATVEN|TIPOCF=TIPOCF|CODCF=CODCF|COD=COD", 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -385,39 +528,51 @@ TCursor& TRicalcolo_mask::create_cursor()
|
|||||||
TToken_string& key_des = get_key_expr(key);
|
TToken_string& key_des = get_key_expr(key);
|
||||||
|
|
||||||
TSheet_field& fs = (TSheet_field&)field(F_FIELDS);
|
TSheet_field& fs = (TSheet_field&)field(F_FIELDS);
|
||||||
TString field, val;
|
TString16 field;
|
||||||
bool key_seq = key > 0; // I primi campi corrispondono alla chiave selezionata?
|
TString val;
|
||||||
|
|
||||||
|
// I primi campi corrispondono alla chiave selezionata?
|
||||||
|
bool key_seq_from = key > 0;
|
||||||
|
bool key_seq_to = key > 0;
|
||||||
|
|
||||||
for (int r = 0; r < fs.items(); r++)
|
for (int r = 0; r < fs.items(); r++)
|
||||||
{
|
{
|
||||||
TToken_string& row = fs.row(r);
|
TToken_string& row = fs.row(r);
|
||||||
field = row.get(0);
|
field = row.get(0);
|
||||||
if (field.not_empty())
|
if (field.not_empty())
|
||||||
{
|
{
|
||||||
if (key_seq && key_des.get_pos(field) == r)
|
val = row.get(); // Limite inferiore
|
||||||
|
if (!val.blank())
|
||||||
{
|
{
|
||||||
val = row.get();
|
if (key_seq_from && key_des.get_pos(field) == r)
|
||||||
if (val.not_empty()) start.put(field, val);
|
start.put(field, val);
|
||||||
val = row.get();
|
else
|
||||||
if (val.not_empty()) stop.put(field, val);
|
{
|
||||||
|
key_seq_from = FALSE;
|
||||||
|
if (filter.not_empty()) filter << "&&";
|
||||||
|
filter << '(' << field << ">=\"" << val << "\")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
key_seq_from = FALSE;
|
||||||
|
|
||||||
|
val = row.get(); // Limite superiore
|
||||||
|
if (!val.blank())
|
||||||
{
|
{
|
||||||
key_seq = FALSE;
|
if (key_seq_to && key_des.get_pos(field) == r)
|
||||||
val = row.get();
|
stop.put(field, val);
|
||||||
if (val.not_empty())
|
else
|
||||||
{
|
{
|
||||||
|
key_seq_to = FALSE;
|
||||||
if (filter.not_empty()) filter << "&&";
|
if (filter.not_empty()) filter << "&&";
|
||||||
filter << '(' << field << ">=" << val << ')';
|
filter << '(' << field << "<=\"" << val << "\")";
|
||||||
}
|
|
||||||
val = row.get();
|
|
||||||
if (val.not_empty())
|
|
||||||
{
|
|
||||||
if (filter.not_empty()) filter << "&&";
|
|
||||||
filter << '(' << field << "<=" << val << ')';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
key_seq_to = FALSE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
key_seq_from = key_seq_to = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key <= 0)
|
if (key <= 0)
|
||||||
@ -481,14 +636,20 @@ bool TRicalcolo_mask::key_handler(TMask_field& f, KEY k)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRelation_description& des = (TRelation_description&)m._des[m._cur_file];
|
TRelation_description& des = m.get_des();
|
||||||
for (TString field = key_expr.get(0); field.not_empty(); field = key_expr.get())
|
for (TString field = key_expr.get(0); field.not_empty(); field = key_expr.get())
|
||||||
{
|
{
|
||||||
const int r = sa.add(field);
|
const int r = sa.add(field);
|
||||||
sa.row(r).add(des.get_field_description(field), F_DESCR-F_FIELD);
|
sa.row(r).add(des.get_field_description(field), F_DESCR-F_FIELD);
|
||||||
}
|
}
|
||||||
if (des.file_num() == LF_CONDV || des.file_num() == LF_RCONDV)
|
if (des.file_num() == LF_CONDV || des.file_num() == LF_RCONDV)
|
||||||
|
{
|
||||||
first_enabled = 4;
|
first_enabled = 4;
|
||||||
|
TToken_string& row = sa.row(0);
|
||||||
|
const TString& lco = m.get(F_TIPO_LCO);
|
||||||
|
row.add(lco, 1);
|
||||||
|
row.add(lco, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int r = sa.items()-1; r >= 0; r--)
|
for (int r = sa.items()-1; r >= 0; r--)
|
||||||
@ -499,33 +660,56 @@ bool TRicalcolo_mask::key_handler(TMask_field& f, KEY k)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TRicalcolo_mask::test_formula(TMask_field& f) const
|
||||||
|
{
|
||||||
|
TString filter(f.get()); filter.strip("\n");
|
||||||
|
TTable_expression expr;
|
||||||
|
bool ok = expr.set(filter, _strexpr);
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
TString var;
|
||||||
|
for (int v = expr.numvar()-1; v >= 0; v--)
|
||||||
|
{
|
||||||
|
int logicnum = 0;
|
||||||
|
var = expr.varname(v); var.upper();
|
||||||
|
const int arrow = var.find("->");
|
||||||
|
if (arrow >= 0)
|
||||||
|
{
|
||||||
|
logicnum = expr.str2file(var);
|
||||||
|
var = var.mid(arrow+2);
|
||||||
|
}
|
||||||
|
if (logicnum >= 0)
|
||||||
|
{
|
||||||
|
if (logicnum == 0)
|
||||||
|
ok = get_rec().exist(var);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TLocalisamfile lf(logicnum);
|
||||||
|
ok = lf.curr().exist(var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ok = FALSE;
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
f.error_box("Il campo '%s' non esiste!", (const char*)expr.varname(v));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
f.error_box("Simbolo non riconosciuto: '%s'", expr.last_token());
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
bool TRicalcolo_mask::filter_handler(TMask_field& f, KEY k)
|
bool TRicalcolo_mask::filter_handler(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
if (f.to_check(k))
|
if (f.to_check(k))
|
||||||
{
|
{
|
||||||
TString filter(f.get()); filter.strip("\n");
|
TRicalcolo_mask& m = (TRicalcolo_mask&)f.mask();
|
||||||
TExpression expr(_strexpr);
|
ok = m.test_formula(f);
|
||||||
ok = expr.set(filter, _strexpr);
|
}
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
TRicalcolo_mask& m = (TRicalcolo_mask&)f.mask();
|
|
||||||
const TRectype& rec = m.get_rec();
|
|
||||||
TString var;
|
|
||||||
for (int v = expr.numvar()-1; v >= 0; v--)
|
|
||||||
{
|
|
||||||
var = expr.varname(v); var.upper();
|
|
||||||
ok = rec.exist(var);
|
|
||||||
if (!ok)
|
|
||||||
{
|
|
||||||
f.error_box("Il campo '%s' non esiste!", (const char*)var);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
f.error_box("Simbolo non riconosciuto: '%s'", expr.last_compiled_token());
|
|
||||||
}
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,19 +721,26 @@ bool TRicalcolo_mask::field_handler(TMask_field& f, KEY k)
|
|||||||
case K_TAB:
|
case K_TAB:
|
||||||
case K_ENTER:
|
case K_ENTER:
|
||||||
if (!f.empty() && f.to_check(k))
|
if (!f.empty() && f.to_check(k))
|
||||||
{
|
{
|
||||||
TRicalcolo_mask& m = (TRicalcolo_mask&)f.mask().get_sheet()->mask();
|
const TSheet_field& s = *f.mask().get_sheet();
|
||||||
const TRectype& rec = m.get_rec();
|
TRicalcolo_mask& rm = (TRicalcolo_mask&)s.mask();
|
||||||
const char* field = f.get();
|
const TRectype& rec = rm.get_rec();
|
||||||
|
const TString16 field = f.get();
|
||||||
if (!rec.exist(field))
|
if (!rec.exist(field))
|
||||||
ok = f.error_box("Il campo %s non esiste!", field);
|
ok = f.error_box("Il campo '%s' non esiste.", (const char*)field);
|
||||||
|
if (ok && s.dlg() == F_OUTPUTS)
|
||||||
|
{
|
||||||
|
TToken_string& ke = rm.get_key_expr(1);
|
||||||
|
if (ke.get_pos(field) >= 0)
|
||||||
|
ok = f.error_box("Non e' possibile modificare un campo chiave.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_F9:
|
case K_F9:
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
TRicalcolo_mask& rm = (TRicalcolo_mask&)m.get_sheet()->mask();
|
TRicalcolo_mask& rm = (TRicalcolo_mask&)m.get_sheet()->mask();
|
||||||
TRelation_description& rd = (TRelation_description&)rm._des[rm._cur_file];
|
TRelation_description& rd = rm.get_des();
|
||||||
if (rd.choose_field(f.get()))
|
if (rd.choose_field(f.get()))
|
||||||
{
|
{
|
||||||
f.set(rd.field_name());
|
f.set(rd.field_name());
|
||||||
@ -563,6 +754,14 @@ bool TRicalcolo_mask::field_handler(TMask_field& f, KEY k)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HIDDEN void swap_tokens(TToken_string& str, int p1, int p2)
|
||||||
|
{
|
||||||
|
const TString16 s1 = str.get(p1);
|
||||||
|
const TString16 s2 = str.get(p2);
|
||||||
|
str.add(s1, p2);
|
||||||
|
str.add(s2, p1);
|
||||||
|
}
|
||||||
|
|
||||||
bool TRicalcolo_mask::fromto_handler(TMask_field& f, KEY k)
|
bool TRicalcolo_mask::fromto_handler(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
@ -584,28 +783,270 @@ bool TRicalcolo_mask::fromto_handler(TMask_field& f, KEY k)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (k == K_F9)
|
||||||
|
{
|
||||||
|
const TMask& m = f.mask();
|
||||||
|
TSheet_field& s = *m.get_sheet();
|
||||||
|
TRicalcolo_mask& rm = (TRicalcolo_mask&)s.mask();
|
||||||
|
TRelation& rel = rm.get_rel();
|
||||||
|
TRectype& rec = rel.curr();
|
||||||
|
TRelation_description& des = rm.get_des();
|
||||||
|
|
||||||
|
const TString title = des.file_desc();
|
||||||
|
|
||||||
|
TToken_string fields(256), head(256);
|
||||||
|
TString tmp;
|
||||||
|
for (int i = 0; i < rec.items(); i++)
|
||||||
|
{
|
||||||
|
tmp = rec.fieldname(i);
|
||||||
|
fields.add(tmp);
|
||||||
|
|
||||||
|
int lun = rec.length(tmp);
|
||||||
|
bool right = FALSE;
|
||||||
|
switch(rec.type(tmp))
|
||||||
|
{
|
||||||
|
case _alfafld:
|
||||||
|
case _memofld:
|
||||||
|
if (lun > 50) lun = 50;
|
||||||
|
break;
|
||||||
|
case _charfld:
|
||||||
|
case _boolfld:
|
||||||
|
break;
|
||||||
|
case _datefld:
|
||||||
|
lun = 10;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
right = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tmp.lower(); tmp[0] = toupper(tmp[0]);
|
||||||
|
if (lun > tmp.len())
|
||||||
|
{
|
||||||
|
tmp << '@' << lun;
|
||||||
|
if (right) tmp << 'R';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (right)
|
||||||
|
tmp << "@R";
|
||||||
|
}
|
||||||
|
head.add(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
const int key = rm.get_int(F_KEY);
|
||||||
|
if (key > 0)
|
||||||
|
{
|
||||||
|
TToken_string& key_des = rm.get_key_expr(key);
|
||||||
|
int pos = 0;
|
||||||
|
for (TString c = key_des.get(0); c.not_empty(); c = key_des.get(), pos++)
|
||||||
|
{
|
||||||
|
const int p = fields.get_pos(c);
|
||||||
|
if (p != pos)
|
||||||
|
{
|
||||||
|
swap_tokens(fields, p, pos);
|
||||||
|
swap_tokens(head, p, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEdit_field& e = (TEdit_field&)f;
|
||||||
|
|
||||||
|
TToken_string siblings;
|
||||||
|
siblings.add(e.dlg());
|
||||||
|
tmp = fields.get(0);
|
||||||
|
tmp = des.get_field_description(tmp);
|
||||||
|
if (tmp.len() > 30)
|
||||||
|
{
|
||||||
|
tmp.cut(27);
|
||||||
|
tmp << "...";
|
||||||
|
}
|
||||||
|
siblings.add(tmp);
|
||||||
|
|
||||||
|
TCursor cur(&rel, "", key > 0 ? key : 1);
|
||||||
|
TBrowse_sheet sheet(&cur, fields, title, head, 0, &e, siblings);
|
||||||
|
if (sheet.run() == K_ENTER)
|
||||||
|
{
|
||||||
|
const TString16 field = s.row(s.selected()).get(0);
|
||||||
|
if (field.not_empty())
|
||||||
|
{
|
||||||
|
const TRectype& rec = cur.curr();
|
||||||
|
if (rec.exist(field))
|
||||||
|
{
|
||||||
|
cur = sheet.selected();
|
||||||
|
f.set(rec.get(field));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TRicalcolo_mask::formula_handler(TMask_field& f, KEY k)
|
||||||
|
{
|
||||||
|
bool ok = TRUE;
|
||||||
|
if (f.to_check(k))
|
||||||
|
{
|
||||||
|
TRicalcolo_mask& m = (TRicalcolo_mask&)f.mask().get_sheet()->mask();
|
||||||
|
ok = m.test_formula(f);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Ciclo principale di elaborazione
|
// Ciclo principale di elaborazione
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HIDDEN bool rewrite_cursor(TCursor& cur)
|
||||||
|
{
|
||||||
|
bool ok = cur.lock(_lock) == NOERR;
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
ok = cur.relation()->rewrite() == NOERR;
|
||||||
|
cur.lock(_unlock);
|
||||||
|
}
|
||||||
|
if (!ok)
|
||||||
|
error_box("Impossibile aggiornare il record %ld.", cur.pos());
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
bool TRicalcolo_mask::elabora()
|
bool TRicalcolo_mask::elabora()
|
||||||
{
|
{
|
||||||
|
TString16 var; // Nome di campo
|
||||||
|
TString val(80); // Valore di campo
|
||||||
|
TString line(128); // Linea di testo
|
||||||
|
|
||||||
TIndwin iw(48, "Inizializzazione ...", TRUE, FALSE, 48);
|
TIndwin iw(48, "Inizializzazione ...", TRUE, FALSE, 48);
|
||||||
begin_wait();
|
begin_wait();
|
||||||
|
|
||||||
TCursor& cur = create_cursor();
|
TCursor& cur = create_cursor(); // Crea e filtra il cursore principale
|
||||||
|
|
||||||
TViswin vw("ve4100.txt", "Ricalcolo valori",
|
|
||||||
FALSE, TRUE, FALSE, 3, 3, -3, -3, FALSE);
|
|
||||||
|
|
||||||
|
TSheet_field& osf = (TSheet_field&)field(F_OUTPUTS);
|
||||||
|
TArray expr;
|
||||||
|
for (int r = 0; r < osf.items(); r++)
|
||||||
|
{
|
||||||
|
TToken_string& riga = osf.row(r);
|
||||||
|
var = riga.get(0);
|
||||||
|
if (var.not_empty())
|
||||||
|
{
|
||||||
|
TTypeexp tipo = _strexpr;
|
||||||
|
switch(cur.curr().type(var))
|
||||||
|
{
|
||||||
|
case _alfafld:
|
||||||
|
case _datefld:
|
||||||
|
case _memofld:
|
||||||
|
tipo = _strexpr;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tipo = _numexpr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
line = riga.get(2);
|
||||||
|
TTable_expression* e = new TTable_expression;
|
||||||
|
e->set(line, tipo);
|
||||||
|
expr.add(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TToken_string& key_expr = get_key_expr(cur.key());
|
||||||
|
|
||||||
|
TViswin vw(NULL, "Ricalcolo valori", FALSE, TRUE, FALSE, 0, 0, 0, 0, FALSE);
|
||||||
|
|
||||||
|
iw.close_modal();
|
||||||
|
end_wait();
|
||||||
|
|
||||||
|
if (iw.iscancelled())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
TTable_expression::set_relation(cur.relation());
|
||||||
|
TTable_expression::set_window(&vw);
|
||||||
|
TTable_expression::reset_errors();
|
||||||
|
|
||||||
|
vw.maximize();
|
||||||
|
vw.open_modal();
|
||||||
|
|
||||||
|
bool ok = TRUE;
|
||||||
for (cur = 0; cur.ok(); ++cur)
|
for (cur = 0; cur.ok(); ++cur)
|
||||||
{
|
{
|
||||||
|
line.format("#@b%7ld@r - ", cur.pos()+1);
|
||||||
|
const TRectype& curr = cur.curr();
|
||||||
|
for (const char* f = key_expr.get(0); f; f = key_expr.get())
|
||||||
|
line << curr.get(f) << ' ';
|
||||||
|
vw.add_line(line);
|
||||||
|
|
||||||
|
for (int r = 0; r < osf.items(); r++)
|
||||||
|
{
|
||||||
|
var = osf.row(r).get(0);
|
||||||
|
if (var.not_empty())
|
||||||
|
{
|
||||||
|
TTable_expression& e = (TTable_expression&)expr[r];
|
||||||
|
for (int v = e.numvar()-1; v >= 0; v--)
|
||||||
|
{
|
||||||
|
var = e.varname(v);
|
||||||
|
val = e.get_field(var);
|
||||||
|
if (e.type() == _numexpr)
|
||||||
|
e.setvar(var, real(val));
|
||||||
|
else
|
||||||
|
e.setvar(var, val);
|
||||||
|
}
|
||||||
|
var = osf.row(r).get(0);
|
||||||
|
val = e;
|
||||||
|
|
||||||
|
if (e.errors_found())
|
||||||
|
ok = FALSE;
|
||||||
|
else
|
||||||
|
cur.curr().put(var, val);
|
||||||
|
|
||||||
|
line.format("- %-10s = %s", (const char*)var, (const char*)val);
|
||||||
|
vw.add_line(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end_wait();
|
TTable_expression::set_relation(NULL);
|
||||||
|
TTable_expression::set_window(NULL);
|
||||||
|
|
||||||
|
vw.close_print();
|
||||||
|
vw.run();
|
||||||
|
vw.close_modal();
|
||||||
|
|
||||||
|
if (get_bool(F_SAVE))
|
||||||
|
{
|
||||||
|
TString msg(80);
|
||||||
|
if (!ok)
|
||||||
|
msg = "Sono stati riscontrati degli errori di calcolo:\n";
|
||||||
|
msg << "Si desidera aggiornare effettivamente l'archivio?";
|
||||||
|
ok = yesno_box(msg);
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
TTextfile& txt = vw.text();
|
||||||
|
|
||||||
|
TProgind piw(txt.lines(), "Aggiornamento archivio", FALSE, TRUE, 48);
|
||||||
|
|
||||||
|
long pos = 0;
|
||||||
|
cur = pos;
|
||||||
|
for (long r = 0; r < txt.lines(); r++)
|
||||||
|
{
|
||||||
|
piw.addstatus(1);
|
||||||
|
line = txt.line(r);
|
||||||
|
if (sscanf(line, "#%ld", &pos) == 1)
|
||||||
|
{
|
||||||
|
pos--;
|
||||||
|
if (pos > 0)
|
||||||
|
rewrite_cursor(cur);
|
||||||
|
cur = pos; // Avanza il cursore
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (sscanf(line, "- %s = %s", (char*)(const char*)var, (char*)(const char*)val) == 2)
|
||||||
|
cur.curr().put(var, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pos > 0)
|
||||||
|
rewrite_cursor(cur);
|
||||||
|
}
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ SPREADSHEET F_OUTPUTS 74 4
|
|||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 14 ""
|
PROMPT 2 14 ""
|
||||||
ITEM "Campo@10"
|
ITEM "Campo@10"
|
||||||
ITEM "Codice"
|
ITEM "Codice@10"
|
||||||
ITEM "Formula@60"
|
ITEM "Formula@60"
|
||||||
ITEM "Descrizione campo@50"
|
ITEM "Descrizione campo@50"
|
||||||
END
|
END
|
||||||
@ -132,7 +132,7 @@ BEGIN
|
|||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 10
|
GROUPBOX DLG_NULL 78 8
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 5 "Condizioni di vendita"
|
PROMPT 1 5 "Condizioni di vendita"
|
||||||
END
|
END
|
||||||
@ -246,11 +246,13 @@ END
|
|||||||
STRING F_FROM 50
|
STRING F_FROM 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 3 "Da "
|
PROMPT 1 3 "Da "
|
||||||
|
FLAGS "B"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_TO 50
|
STRING F_TO 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 "A "
|
PROMPT 1 4 "A "
|
||||||
|
FLAGS "B"
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_OK 10 2
|
||||||
@ -281,9 +283,10 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_CODFORM 6
|
STRING F_CODFORM 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 3 ""
|
PROMPT 1 3 ""
|
||||||
|
FLAGS "U"
|
||||||
USE %FRM
|
USE %FRM
|
||||||
INPUT CODTAB F_CODFORM
|
INPUT CODTAB F_CODFORM
|
||||||
DISPLAY "Codice" CODTAB
|
DISPLAY "Codice" CODTAB
|
||||||
@ -293,7 +296,7 @@ BEGIN
|
|||||||
CHECKTYPE SEARCH
|
CHECKTYPE SEARCH
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_FORMULA 120 50
|
STRING F_FORMULA 100 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 ""
|
PROMPT 1 4 ""
|
||||||
END
|
END
|
||||||
|
@ -46,7 +46,7 @@ bool TFatturazione_bolle_app::menu(MENU_TAG)
|
|||||||
TMask m("ve6200a");
|
TMask m("ve6200a");
|
||||||
while (m.run() == K_ENTER)
|
while (m.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
TIndwin iw(48, "Inizializzazione ...", TRUE, FALSE, 48);
|
TIndwin iw(48, "Inizializzazione ...\n", TRUE, FALSE, 48);
|
||||||
|
|
||||||
begin_wait();
|
begin_wait();
|
||||||
|
|
||||||
@ -67,7 +67,10 @@ bool TFatturazione_bolle_app::menu(MENU_TAG)
|
|||||||
const long an = m.get_long(F_NUMERO_DOCUMENTO_A);
|
const long an = m.get_long(F_NUMERO_DOCUMENTO_A);
|
||||||
|
|
||||||
TFatturazione_bolle eld(m.get(F_CODICE_ELAB));
|
TFatturazione_bolle eld(m.get(F_CODICE_ELAB));
|
||||||
|
TToken_string tipidoc(24), statidoc(10);
|
||||||
|
eld.tipi_validi(tipidoc);
|
||||||
|
eld.stati_validi(statidoc);
|
||||||
|
|
||||||
TLista_clienti clienti;
|
TLista_clienti clienti;
|
||||||
const int tot_cli = clienti.leggi(dc, ac, da, aa, dz, az);
|
const int tot_cli = clienti.leggi(dc, ac, da, aa, dz, az);
|
||||||
|
|
||||||
@ -81,12 +84,18 @@ bool TFatturazione_bolle_app::menu(MENU_TAG)
|
|||||||
do_events(); // Attende visualizzazione
|
do_events(); // Attende visualizzazione
|
||||||
|
|
||||||
TLista_documenti din, dout; // Legge tutti i documenti di input
|
TLista_documenti din, dout; // Legge tutti i documenti di input
|
||||||
din.read('C', codcli, anno, dd, ad, codnum, dn, an);
|
din.read('D', 'C', codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
||||||
|
if (din.items() == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Crea documenti di output
|
// Crea documenti di output
|
||||||
bool ok = eld.elabora(din, dout, data_elab);
|
bool ok = eld.elabora(din, dout, data_elab);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
msg << '\n' << din.items() << " documenti raggruppati in " << dout.items();
|
||||||
|
iw.set_text(msg); // Messaggio sul cliente
|
||||||
|
do_events(); // Attende visualizzazione
|
||||||
|
|
||||||
int err = dout.write(); // Scrive documenti di output
|
int err = dout.write(); // Scrive documenti di output
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
{
|
{
|
||||||
|
176
ve/velib01.cpp
176
ve/velib01.cpp
@ -223,27 +223,21 @@ TRiga_documento& TRiga_documento::operator +=(const TRiga_documento& r)
|
|||||||
TAssoc_array TDocumento::_tipi;
|
TAssoc_array TDocumento::_tipi;
|
||||||
|
|
||||||
TDocumento::TDocumento()
|
TDocumento::TDocumento()
|
||||||
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc)
|
TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc)
|
||||||
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE)
|
||||||
{
|
{
|
||||||
if (numdoc <= 0)
|
if (numdoc <= 0)
|
||||||
{
|
{
|
||||||
numdoc = get_next_key(provv, anno, codnum);
|
numdoc = 0;
|
||||||
set_key(*this, provv, anno, codnum, numdoc);
|
set_key(*this, provv, anno, codnum, numdoc);
|
||||||
|
|
||||||
TRiga_documento* key = new TRiga_documento(this);
|
TRiga_documento* key = new TRiga_documento(this);
|
||||||
set_key(*key, provv, anno, codnum, numdoc);
|
set_key(*key, provv, anno, codnum, numdoc);
|
||||||
_rows.set_key(key);
|
_rows.set_key(key);
|
||||||
#ifdef DBG
|
|
||||||
TLocalisamfile doc(LF_DOC);
|
|
||||||
set_key(doc.curr(), provv, anno, codnum, numdoc);
|
|
||||||
if (doc.read() == NOERR)
|
|
||||||
yesnofatal_box("Documento gia' esistente: %c %d %s %ld", provv, anno, codnum, numdoc);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
read(provv, anno, codnum, numdoc);
|
read(provv, anno, codnum, numdoc);
|
||||||
@ -254,8 +248,8 @@ void TDocumento::set_key(TRectype& rec, char provv, int anno, const char* codnum
|
|||||||
{
|
{
|
||||||
CHECK(provv == 'D' || provv == 'P', "Provvisorio o Definitivo?");
|
CHECK(provv == 'D' || provv == 'P', "Provvisorio o Definitivo?");
|
||||||
CHECKD(anno > 1900, "Anno non valido: ", anno);
|
CHECKD(anno > 1900, "Anno non valido: ", anno);
|
||||||
CHECK(*codnum, "Codice numerazione nullo");
|
CHECK(codnum && *codnum, "Codice numerazione nullo");
|
||||||
CHECK(numdoc > 0, "Numero documento nullo");
|
CHECKD(numdoc >= 0, "Numero documento non valido ", numdoc);
|
||||||
|
|
||||||
rec.put("PROVV", provv);
|
rec.put("PROVV", provv);
|
||||||
rec.put("ANNO", anno);
|
rec.put("ANNO", anno);
|
||||||
@ -282,7 +276,7 @@ void TDocumento::copy_data(TRectype& dst, const TRectype& src)
|
|||||||
|
|
||||||
|
|
||||||
TDocumento::TDocumento(const TRectype& rec)
|
TDocumento::TDocumento(const TRectype& rec)
|
||||||
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(FALSE)
|
||||||
{
|
{
|
||||||
read(rec);
|
read(rec);
|
||||||
}
|
}
|
||||||
@ -295,14 +289,19 @@ int TDocumento::read(const TRectype& rec)
|
|||||||
const int an = anno();
|
const int an = anno();
|
||||||
const TString16 cn = numerazione();
|
const TString16 cn = numerazione();
|
||||||
const long nu = numero();
|
const long nu = numero();
|
||||||
|
CHECK(nu > 0, "Numero documento nullo.");
|
||||||
set_key(*key, pr, an, cn, nu);
|
set_key(*key, pr, an, cn, nu);
|
||||||
|
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
int err = TRectype::read(doc);
|
int err = TRectype::read(doc);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
_nuovo = FALSE;
|
||||||
_rows.read(key);
|
_rows.read(key);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_nuovo = TRUE;
|
||||||
*this = rec;
|
*this = rec;
|
||||||
destroy_rows();
|
destroy_rows();
|
||||||
_rows.set_key(key);
|
_rows.set_key(key);
|
||||||
@ -313,12 +312,32 @@ int TDocumento::read(const TRectype& rec)
|
|||||||
int TDocumento::read(char provv, int anno, const char* codnum, long numdoc)
|
int TDocumento::read(char provv, int anno, const char* codnum, long numdoc)
|
||||||
{
|
{
|
||||||
TRectype rec(LF_DOC);
|
TRectype rec(LF_DOC);
|
||||||
|
CHECK(numdoc > 0, "Numero documento nullo.");
|
||||||
set_key(rec, provv, anno, codnum, numdoc);
|
set_key(rec, provv, anno, codnum, numdoc);
|
||||||
return read(rec);
|
return read(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TDocumento::write(bool re) const
|
long TDocumento::renum(long numdoc)
|
||||||
{
|
{
|
||||||
|
if (numdoc <= 0)
|
||||||
|
{
|
||||||
|
const char tn = tipo_numerazione();
|
||||||
|
const int an = anno();
|
||||||
|
const TString16 nu = numerazione();
|
||||||
|
numdoc = get_next_key(tn, an, nu);
|
||||||
|
}
|
||||||
|
char num[16]; sprintf(num, "%ld", numdoc);
|
||||||
|
renum_key("NDOC", num); // Aggiorna testata
|
||||||
|
_rows.renum_key("NDOC", num); // Aggiorna righe
|
||||||
|
return numdoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TDocumento::write(bool re) const
|
||||||
|
{
|
||||||
|
const bool nuovo = _nuovo || numero() <= 0; // E' nuovo di zecca!
|
||||||
|
if (nuovo && re) // quindi ...
|
||||||
|
re = FALSE; // ... non fare la rewrite
|
||||||
|
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
int err = NOERR;
|
int err = NOERR;
|
||||||
if (re)
|
if (re)
|
||||||
@ -332,10 +351,27 @@ int TDocumento::write(bool re) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err = TRectype::write(doc);
|
if (nuovo)
|
||||||
if (err != NOERR)
|
{
|
||||||
err = TRectype::rewrite(doc);
|
TDocumento& myself = *(TDocumento*)this;
|
||||||
|
if (numero() <= 0)
|
||||||
|
myself.renum();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
err = TRectype::write(doc);
|
||||||
|
if (err == _isreinsert)
|
||||||
|
myself.renum();
|
||||||
|
} while (err == _isreinsert);
|
||||||
|
myself._nuovo = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = TRectype::write(doc);
|
||||||
|
if (err != NOERR)
|
||||||
|
err = TRectype::rewrite(doc);
|
||||||
|
}
|
||||||
|
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
err = _rows.write(re);
|
err = _rows.write(re);
|
||||||
}
|
}
|
||||||
@ -358,23 +394,29 @@ const bool TDocumento::in_valuta()
|
|||||||
}
|
}
|
||||||
|
|
||||||
long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
|
long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
|
||||||
{
|
{
|
||||||
TLocalisamfile doc(LF_DOC);
|
static long n = 0;
|
||||||
TRectype& curr = doc.curr();
|
|
||||||
set_key(curr, provv, anno, codnum, 9999999L);
|
if (n == 0)
|
||||||
|
|
||||||
const int err = doc.read(_isgreat);
|
|
||||||
|
|
||||||
long n = 1;
|
|
||||||
if (err != _isemptyfile)
|
|
||||||
{
|
{
|
||||||
if (err == NOERR)
|
TLocalisamfile doc(LF_DOC);
|
||||||
doc.prev();
|
TRectype& curr = doc.curr();
|
||||||
if (curr.get_char("PROVV") == provv &&
|
set_key(curr, provv, anno, codnum, 9999999L);
|
||||||
curr.get_int("ANNO") == anno &&
|
|
||||||
curr.get("CODNUM") == codnum)
|
const int err = doc.read(_isgreat);
|
||||||
n = curr.get_long("NDOC") + 1;
|
|
||||||
}
|
if (err != _isemptyfile)
|
||||||
|
{
|
||||||
|
if (err == NOERR)
|
||||||
|
doc.prev();
|
||||||
|
if (curr.get_char("PROVV") == provv &&
|
||||||
|
curr.get_int("ANNO") == anno &&
|
||||||
|
curr.get("CODNUM") == codnum)
|
||||||
|
n = curr.get_long("NDOC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
n++;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,6 +455,7 @@ bool TDocumento::raggruppabile(const TDocumento& doc, TToken_string& campi) cons
|
|||||||
TDate TLista_documenti::num2date(char provv, int anno, const char* codnum, long num) const
|
TDate TLista_documenti::num2date(char provv, int anno, const char* codnum, long num) const
|
||||||
{
|
{
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
|
CHECK(num > 0, "Numero documento nullo.");
|
||||||
TDocumento::set_key(doc.curr(), provv, anno, codnum, num);
|
TDocumento::set_key(doc.curr(), provv, anno, codnum, num);
|
||||||
|
|
||||||
if (doc.read(_isgteq) != NOERR) // In caso d'errore ...
|
if (doc.read(_isgteq) != NOERR) // In caso d'errore ...
|
||||||
@ -421,21 +464,23 @@ TDate TLista_documenti::num2date(char provv, int anno, const char* codnum, long
|
|||||||
return doc.get("DATADOC");
|
return doc.get("DATADOC");
|
||||||
}
|
}
|
||||||
|
|
||||||
int TLista_documenti::read(char tipo, long clifo, int anno,
|
int TLista_documenti::read(char provv, char tipocf, long clifo, int anno,
|
||||||
|
TToken_string& tipidoc, TToken_string& statidoc,
|
||||||
const TDate& dd, const TDate& ad,
|
const TDate& dd, const TDate& ad,
|
||||||
const char* codnum, long dn, long an,
|
const char* codnum, long dn, long an)
|
||||||
char provv)
|
|
||||||
{
|
{
|
||||||
CHECK(tipo == 'C' || tipo == 'F', "Il tipo deve essere Cliente o Fornitore");
|
|
||||||
CHECK(clifo > 0L, "Codice cliente non valido");
|
|
||||||
CHECK(provv == 'D' || provv == 'P', "Provvisorio o Definitivo?");
|
CHECK(provv == 'D' || provv == 'P', "Provvisorio o Definitivo?");
|
||||||
|
CHECK(tipocf == 'C' || tipocf == 'F', "Il tipo deve essere Cliente o Fornitore");
|
||||||
|
CHECKD(clifo > 0L, "Codice cliente non valido", clifo);
|
||||||
CHECKD(anno > 1900, "Anno non valido: ", anno);
|
CHECKD(anno > 1900, "Anno non valido: ", anno);
|
||||||
|
CHECK(!tipidoc.empty_items(), "Lista dei tipi documento vuota");
|
||||||
|
CHECK(!statidoc.empty_items(), "Lista degli stati documento vuota");
|
||||||
|
|
||||||
TRelation doc(LF_DOC);
|
TRelation doc(LF_DOC);
|
||||||
TRectype start(LF_DOC), stop(LF_DOC);
|
TRectype start(LF_DOC), stop(LF_DOC);
|
||||||
|
|
||||||
start.put("TIPOCF", tipo);
|
start.put("TIPOCF", tipocf);
|
||||||
stop.put("TIPOCF", tipo);
|
stop.put("TIPOCF", tipocf);
|
||||||
|
|
||||||
start.put("CODCF", clifo);
|
start.put("CODCF", clifo);
|
||||||
stop.put("CODCF", clifo);
|
stop.put("CODCF", clifo);
|
||||||
@ -484,16 +529,22 @@ int TLista_documenti::read(char tipo, long clifo, int anno,
|
|||||||
stop.put("CODNUM", codnum);
|
stop.put("CODNUM", codnum);
|
||||||
|
|
||||||
if (numfilter)
|
if (numfilter)
|
||||||
filter << "CODNUM=" << codnum;
|
filter << "CODNUM=\"" << codnum << '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
TCursor cur(&doc, filter, 2, &start, &stop);
|
TCursor cur(&doc, filter, 2, &start, &stop);
|
||||||
|
const TRectype& head = cur.curr();
|
||||||
|
|
||||||
_documenti.destroy();
|
_documenti.destroy();
|
||||||
for (cur = 0; cur.ok(); ++cur)
|
for (cur = 0; cur.ok(); ++cur)
|
||||||
{
|
{
|
||||||
TDocumento* d = new TDocumento(cur.curr());
|
const TString16 tipodoc = head.get("TIPODOC");
|
||||||
_documenti.add(d);
|
const TString16 statodoc = head.get("STATO");
|
||||||
|
if (tipidoc.get_pos(tipodoc) >= 0 && statidoc.get_pos(statodoc) >= 0)
|
||||||
|
{
|
||||||
|
TDocumento* d = new TDocumento(head);
|
||||||
|
_documenti.add(d);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _documenti.items();
|
return _documenti.items();
|
||||||
@ -690,6 +741,37 @@ TFatturazione_bolle::TFatturazione_bolle(const char* cod)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TFatturazione_bolle::tipi_validi(TToken_string& tipi) const
|
||||||
|
{
|
||||||
|
const TString& s2 = get("S2");
|
||||||
|
tipi.cut(0);
|
||||||
|
TString16 t;
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
t = s2.mid(i*4, 4);
|
||||||
|
t.trim();
|
||||||
|
if (t.not_empty())
|
||||||
|
tipi.add(t);
|
||||||
|
}
|
||||||
|
CHECK(!tipi.empty_items(), "Nessun tipo documento valido");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TFatturazione_bolle::stati_validi(TToken_string& stati) const
|
||||||
|
{
|
||||||
|
const TString& s7 = get("S7");
|
||||||
|
stati.cut(0);
|
||||||
|
TString16 s;
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
s = s7.mid(i*4, 1);
|
||||||
|
s.trim();
|
||||||
|
if (s.not_empty())
|
||||||
|
stati.add(s);
|
||||||
|
}
|
||||||
|
CHECK(!stati.empty_items(), "Nessuno stato documento valido");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
||||||
{
|
{
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
@ -702,7 +784,7 @@ bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
|||||||
}
|
}
|
||||||
if (i >= 5)
|
if (i >= 5)
|
||||||
{
|
{
|
||||||
NFCHECK("Tipo documento non valido: ", (const char*)tipodoc);
|
NFCHECK("Tipo documento non valido: '%s'", (const char*)tipodoc);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
14
ve/velib01.h
14
ve/velib01.h
@ -89,9 +89,12 @@ class TDocumento : public TRectype
|
|||||||
static TAssoc_array _tipi;
|
static TAssoc_array _tipi;
|
||||||
|
|
||||||
TRecord_array _rows; // Array di TRectype per le righe documenti di vendita.
|
TRecord_array _rows; // Array di TRectype per le righe documenti di vendita.
|
||||||
|
bool _nuovo;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TRectype & row(int index) { return _rows.row(index, FALSE); }
|
TRectype & row(int index) { return _rows.row(index, FALSE); }
|
||||||
long get_next_key(char provv, int anno, const char* codnum) const;
|
long get_next_key(char provv, int anno, const char* codnum) const;
|
||||||
|
long renum(long numdoc = 0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const TRectype& head() const { return *this; } // Ritorna la testata del documento
|
const TRectype& head() const { return *this; } // Ritorna la testata del documento
|
||||||
@ -111,7 +114,7 @@ public:
|
|||||||
int write(bool re = FALSE) const;
|
int write(bool re = FALSE) const;
|
||||||
int rewrite() const { return write(TRUE); }
|
int rewrite() const { return write(TRUE); }
|
||||||
int remove() const;
|
int remove() const;
|
||||||
|
|
||||||
char tipo_numerazione() const { return get_char("PROVV"); }
|
char tipo_numerazione() const { return get_char("PROVV"); }
|
||||||
int anno() const { return get_int("ANNO"); }
|
int anno() const { return get_int("ANNO"); }
|
||||||
const TString& numerazione() { return get("CODNUM"); }
|
const TString& numerazione() { return get("CODNUM"); }
|
||||||
@ -146,8 +149,10 @@ protected:
|
|||||||
TDate num2date(char provv, int anno, const char* codnum, long num) const;
|
TDate num2date(char provv, int anno, const char* codnum, long num) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int read(char tipo, long clifo, int anno, const TDate& dd, const TDate& ad,
|
int read(char provv, char tipo, long clifo, int anno,
|
||||||
const char* codnum = "", long dn = 0L, long an = 0L, char provv = 'D');
|
TToken_string& tipidoc, TToken_string& statidoc,
|
||||||
|
const TDate& dd, const TDate& ad,
|
||||||
|
const char* codnum = "", long dn = 0L, long an = 0L);
|
||||||
int write(bool re = FALSE) const;
|
int write(bool re = FALSE) const;
|
||||||
int rewrite() const { return write(TRUE); }
|
int rewrite() const { return write(TRUE); }
|
||||||
|
|
||||||
@ -261,6 +266,9 @@ public:
|
|||||||
virtual bool raggruppa(TDocumento& din, TDocumento& dout);
|
virtual bool raggruppa(TDocumento& din, TDocumento& dout);
|
||||||
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
||||||
const TDate& data_elab);
|
const TDate& data_elab);
|
||||||
|
|
||||||
|
void tipi_validi(TToken_string& tipi) const;
|
||||||
|
void stati_validi(TToken_string& stati) const;
|
||||||
|
|
||||||
TFatturazione_bolle(const char* cod);
|
TFatturazione_bolle(const char* cod);
|
||||||
virtual ~TFatturazione_bolle() { }
|
virtual ~TFatturazione_bolle() { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user