Patch level :

Files correlati     : ve0.exe
Ricompilazione Demo : [ ]
Commento            :
Migliorato aggiornamento formule di testa


git-svn-id: svn://10.65.10.50/branches/R_10_00@22442 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-10-04 14:55:35 +00:00
parent 92294679ce
commit c4c0fe6efb
6 changed files with 29 additions and 30 deletions

View File

@ -156,8 +156,8 @@ public:
class TExpr_documento : public TExpression // velib01 class TExpr_documento : public TExpression // velib01
{ {
TDocumento * _doc; const TDocumento* _doc;
TRiga_documento * _row; const TRiga_documento* _row;
protected: protected:
virtual void evaluate_user_func(int index, int nparms, TEval_stack & stack, TTypeexp type) const; virtual void evaluate_user_func(int index, int nparms, TEval_stack & stack, TTypeexp type) const;
@ -167,15 +167,15 @@ public:
// @cmember Duplica l'espressione // @cmember Duplica l'espressione
virtual TObject* dup() const; virtual TObject* dup() const;
// @cmember Assegna il documento corrente // @cmember Assegna il documento corrente
void set_doc(TDocumento* doc) { _doc = doc; } void set_doc(const TDocumento* doc) { _doc = doc; }
// @cmember Assegna il documento corrente // @cmember Assegna il documento corrente
void set_row(TRiga_documento* row) { _row = row; } void set_row(const TRiga_documento* row) { _row = row; }
// @cmember Costruttore (assegna l'estressione e il suo tipo) // @cmember Costruttore (assegna l'estressione e il suo tipo)
TExpr_documento(const char* expression, TTypeexp type = _numexpr, TExpr_documento(const char* expression, TTypeexp type = _numexpr,
TDocumento* doc = NULL, TRiga_documento * row = NULL); const TDocumento* doc = NULL, const TRiga_documento * row = NULL);
// @cmember Costruttore (assegna il tipo dell'istruzione) // @cmember Costruttore (assegna il tipo dell'istruzione)
TExpr_documento(TTypeexp type = _numexpr, TExpr_documento(TTypeexp type = _numexpr,
TDocumento* doc = NULL, TRiga_documento* row = NULL) const TDocumento* doc = NULL, const TRiga_documento* row = NULL)
: TExpression(type, true), _doc(doc), _row(row) {} : TExpression(type, true), _doc(doc), _row(row) {}
// @cmember Costruttore di copia // @cmember Costruttore di copia
TExpr_documento(const TExpr_documento & expr) TExpr_documento(const TExpr_documento & expr)

View File

@ -2977,7 +2977,7 @@ void TDocumento::update_conai()
riga.put(RDOC_CODART, s); riga.put(RDOC_CODART, s);
riga.generata(); riga.generata();
riga.put("GENTIPO", "C"); riga.put(RDOC_GENTIPO, 'C');
riga.put(RDOC_DESCR, sp.descrizione()); riga.put(RDOC_DESCR, sp.descrizione());
riga.put(RDOC_QTA, qta); riga.put(RDOC_QTA, qta);

View File

@ -488,8 +488,8 @@ bool TTipo_documento::scarica_residuo() const
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TExpr_documento::TExpr_documento(const char* expression, TTypeexp type, TExpr_documento::TExpr_documento(const char* expression, TTypeexp type,
TDocumento* doc, TRiga_documento * row) const TDocumento* doc, const TRiga_documento* row)
: TExpression(type), _doc(doc), _row(row) : TExpression(type), _doc(doc), _row(row)
{ {
if (!set(expression, type)) if (!set(expression, type))
error_box("Wrong expression : '%s'", expression); error_box("Wrong expression : '%s'", expression);
@ -556,9 +556,9 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
{ {
case _somma: case _somma:
{ {
const TString cond(nparms == 2 ? stack.pop_string() : "STR(1)"); const TString cond = nparms == 2 ? stack.pop_string() : "STR(1)";
const TString & field = stack.pop_string(); const TString& field = stack.pop_string();
real somma; real sum;
if (_doc != NULL) if (_doc != NULL)
{ {
@ -566,34 +566,32 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
const int cond_nvars = cond_expr.numvar(); const int cond_nvars = cond_expr.numvar();
TExpr_documento expr(field, _numexpr, _doc); TExpr_documento expr(field, _numexpr, _doc);
const int nvars = expr.numvar(); const int nvars = expr.numvar();
const int nrows = _doc->rows();
for (int i = nrows; i > 0; i--) for (int i = _doc->rows(); i > 0; i--)
{ {
TRiga_documento & riga = (TRiga_documento &) (*_doc)[i]; const TRiga_documento& riga = (const TRiga_documento&)(*_doc)[i];
int j;
for (j = cond_nvars - 1; j >= 0; j--) for (int j = cond_nvars - 1; j >= 0; j--)
{ {
const char* s = cond_expr.varname(j); const char* s = cond_expr.varname(j);
TFieldref f(s,0); const TFieldref f(s,0);
cond_expr.setvar(j, f.read(riga)); cond_expr.setvar(j, f.read(riga));
} }
cond_expr.set_row(&riga); cond_expr.set_row(&riga);
if ((bool)cond_expr) if (cond_expr.as_bool())
{ {
for (j = nvars - 1; j >= 0; j--) for (int j = nvars - 1; j >= 0; j--)
{ {
const char* s = expr.varname(j); const char* s = expr.varname(j);
TFieldref f(s,0); const TFieldref f(s,0);
expr.setvar(j, f.read(riga)); expr.setvar(j, f.read(riga));
} }
expr.set_row(&riga); expr.set_row(&riga);
somma += expr.as_real(); sum += expr.as_real();
} }
} }
} }
stack.push(somma); stack.push(sum);
} }
break; break;
case _spinc: case _spinc:
@ -987,7 +985,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
break; break;
case _nrate: case _nrate:
{ {
const TPagamento & p = _doc->pagamento(); const TPagamento& p = ((TDocumento*)_doc)->pagamento();
const real r = p.n_rate(); const real r = p.n_rate();
stack.push(r); stack.push(r);
} }

View File

@ -279,7 +279,7 @@ void TDocumentoEsteso::set_riga_conai()
{ {
_conai = new TRiga_documento(this, "05"); _conai = new TRiga_documento(this, "05");
TString conai = ini_get_string(CONFIG_DITTA, "ve", "DESCCONAIASS", TR("Contributo CONAI assolto")); TString conai = ini_get_string(CONFIG_DITTA, "ve", "DESCCONAIASS");
if (conai.blank()) // se la variabile e' vuota ma scritta sull ini non stampa nulla if (conai.blank()) // se la variabile e' vuota ma scritta sull ini non stampa nulla
conai = TR("Contributo CONAI assolto"); conai = TR("Contributo CONAI assolto");
_conai->put(RDOC_DESCR, conai); _conai->put(RDOC_DESCR, conai);

View File

@ -5,7 +5,8 @@
#include "velib.h" #include "velib.h"
#endif #endif
struct dec_parm { struct dec_parm
{
int qta_lit; int qta_lit;
int qta_val; int qta_val;
// add other groups here // add other groups here

View File

@ -897,9 +897,9 @@ static void search_price(TEdit_field& f, KEY key )
TPrice_sheet sheet(f); TPrice_sheet sheet(f);
TString_array & el = sheet.rows_array(); TString_array & el = sheet.rows_array();
TRelation * rel = new TRelation(LF_DOC); TRelation rel(LF_DOC);
TRectype from(rel->curr()); TRectype from(rel.curr());
TRectype to(rel->curr()); TRectype to(rel.curr());
TDate datadoc = mask.get_date(F_DATADOC); TDate datadoc = mask.get_date(F_DATADOC);
const long codcf = mask.get_long(F_CODCF); const long codcf = mask.get_long(F_CODCF);
const long numdoc = mask.get_long(F_NDOC); const long numdoc = mask.get_long(F_NDOC);
@ -937,7 +937,7 @@ static void search_price(TEdit_field& f, KEY key )
} }
filter << ")"; filter << ")";
TCursor cur(rel, filter, 2, &from, &to); TCursor cur(&rel, filter, 2, &from, &to);
const int items = cur.items(); const int items = cur.items();
cur.freeze(); cur.freeze();
TRecord_array r(LF_RIGHEDOC, RDOC_NRIGA); TRecord_array r(LF_RIGHEDOC, RDOC_NRIGA);