Patch level :AGA 2.0 362
Files correlati : Ricompilazione Demo : [ ] Commento :corretti errori compilazione AGA 32 bit git-svn-id: svn://10.65.10.50/trunk@10684 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cf2be74687
commit
3ddb3ecab5
312
ve/velib03.cpp
312
ve/velib03.cpp
@ -83,318 +83,6 @@ const char* TMov_mag_doc::codmag_rauto(int r) const
|
||||
return j >=0 ? _codmagc.row(j) : NULL;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Tipo documento
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TAssoc_array TTipo_documento::_formule_documento;
|
||||
|
||||
TTipo_documento::TTipo_documento(const char* tipodoc)
|
||||
: TRectype(LF_TABCOM), _tipocf('\0')
|
||||
{
|
||||
settab("TIP");
|
||||
if (tipodoc && *tipodoc)
|
||||
read(tipodoc);
|
||||
}
|
||||
|
||||
TTipo_documento::TTipo_documento(const TRectype& rec)
|
||||
: TRectype(rec), _tipocf('\0')
|
||||
{
|
||||
read_formule();
|
||||
}
|
||||
|
||||
TTipo_documento::~TTipo_documento()
|
||||
{
|
||||
}
|
||||
|
||||
int TTipo_documento::read(const char* tipodoc)
|
||||
{
|
||||
*this = cache().get("%TIP", tipodoc);
|
||||
int err = empty() ? _iskeynotfound : NOERR;
|
||||
|
||||
_formule.cut(0);
|
||||
|
||||
if (err == NOERR)
|
||||
read_formule();
|
||||
else
|
||||
yesnofatal_box("Tipo documento errato: %s", tipodoc);
|
||||
return err;
|
||||
}
|
||||
|
||||
const char TTipo_documento::tipocf()
|
||||
{
|
||||
if (_tipocf == '\0')
|
||||
{
|
||||
TFilename pn = profile_name();
|
||||
pn.ext("ini");
|
||||
TConfig prof(pn);
|
||||
_tipocf = prof.get_char("TIPOCF", "MAIN");
|
||||
}
|
||||
return _tipocf;
|
||||
}
|
||||
|
||||
const TString_array& TTipo_documento::keys_descrs()
|
||||
{
|
||||
if (_keys_descrs.items() == 0)
|
||||
{
|
||||
TString16 var, tiporiga;
|
||||
TFilename pn(profile_name());
|
||||
pn.ext("ini");
|
||||
TConfig prof(pn);
|
||||
const int numtr = prof.get_int( "NTIPIRIGA", "RIGHE" );
|
||||
TTipo_riga_documento tr;
|
||||
_keys_descrs.add("");
|
||||
_keys_descrs.add("");
|
||||
TToken_string& k = (TToken_string&)_keys_descrs[0];
|
||||
TToken_string& d = (TToken_string&)_keys_descrs[1];
|
||||
|
||||
if (numtr > 0)
|
||||
{
|
||||
for ( int i = 1; i <= numtr; i ++ )
|
||||
{
|
||||
var.format("%d", i);
|
||||
tiporiga = prof.get(var, "RIGHE");
|
||||
tr.read(tiporiga);
|
||||
k.add(tr.codice());
|
||||
d.add(tr.descrizione());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TTable tri("%TRI");
|
||||
|
||||
for (int err = tri.first(); err == NOERR; err = tri.next())
|
||||
{
|
||||
k.add(tri.get("CODTAB"));
|
||||
d.add(tri.get("S0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _keys_descrs;
|
||||
}
|
||||
|
||||
const TString_array& TTipo_documento::sheet_columns()
|
||||
{
|
||||
if (_sheet_columns.items() == 0)
|
||||
{
|
||||
TString16 col;
|
||||
TFilename pn(profile_name());
|
||||
pn.ext("ini");
|
||||
TConfig prof(pn, "SHEET");
|
||||
int ncols = prof.get_int( "NCOLS", "SHEET" );
|
||||
for (int i = 1; i <= ncols; i++)
|
||||
{
|
||||
col.format( "%d", i );
|
||||
_sheet_columns.add(prof.get(col, "SHEET"));
|
||||
}
|
||||
}
|
||||
return _sheet_columns;
|
||||
}
|
||||
|
||||
const TString_array& TTipo_documento::handlers()
|
||||
{
|
||||
if (_handlers.items() == 0)
|
||||
{
|
||||
TString16 chiave;
|
||||
TFilename pn = profile_name();
|
||||
pn.ext("ini");
|
||||
TConfig prof(pn);
|
||||
|
||||
int numhandler = prof.get_int( "NHANDLER", "HANDLERS" ); // prof
|
||||
|
||||
for (int i = 1; i <= numhandler; i ++ )
|
||||
{
|
||||
chiave.format("%d", i);
|
||||
_handlers.add(prof.get(chiave, "HANDLERS"));
|
||||
}
|
||||
}
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
void TTipo_documento::set_defaults(TMask& m)
|
||||
{
|
||||
const int items = _defaults.items();
|
||||
|
||||
if (items == 0) // Carica lo string_array con i defaults
|
||||
{
|
||||
TString16 chiave;
|
||||
TFilename pn(profile_name());
|
||||
pn.ext("ini");
|
||||
TConfig prof(pn, "DEFAULT");
|
||||
const int ndefaults = prof.get_int("NDEFAULTS");
|
||||
for(int i = 1; i <= ndefaults; i++)
|
||||
{
|
||||
chiave.format("%d", i);
|
||||
_defaults.add(prof.get(chiave));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < items; i++) // Setta i campi della maschera
|
||||
{
|
||||
TToken_string& tt = (TToken_string&)_defaults[i];
|
||||
const int ncampo = tt.get_int(0);
|
||||
m.set(ncampo, tt.get(1), TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
void TTipo_documento::read_formule()
|
||||
{
|
||||
TFilename profile(profile_name());
|
||||
profile.ext("ini");
|
||||
TConfig prof(profile, "MAIN");
|
||||
prof.write_protect(); // Altrimenti non si distrugge!!!
|
||||
|
||||
_formule = prof.get("CAMPICALC", "MAIN");
|
||||
const TString & calcoli = prof.get("CALCOLI", "MAIN");
|
||||
|
||||
if (calcoli == "*")
|
||||
{
|
||||
TTable frd("%FRD");
|
||||
|
||||
for (int err = frd.first(); err == NOERR; err = frd.next())
|
||||
{
|
||||
const TString & formula = frd.get("CODTAB");
|
||||
if (_formule.find(formula) < 0)
|
||||
_formule.add(formula);
|
||||
}
|
||||
}
|
||||
else
|
||||
_formule.add(calcoli);
|
||||
_totale = prof.get("TOTALE", "MAIN");
|
||||
if (_totale.empty())
|
||||
_totale = "TOTDOC";
|
||||
const TRectype& for_tot = cache().get("%FRD", _totale);
|
||||
if (for_tot.empty())
|
||||
_formule_documento.add(_totale, new TFormula_documento(_documento, _totale, "IMPONIBILI()+IMPOSTE()"), TRUE);
|
||||
|
||||
if (_formule.find(_totale) < 0)
|
||||
_formule.add(_totale);
|
||||
_totale_netto = "_";
|
||||
_totale_netto << _totale;
|
||||
|
||||
_basesconto = prof.get("BASESCONTO");
|
||||
if (_basesconto.empty())
|
||||
_basesconto = "BASESCONTO";
|
||||
|
||||
const TRectype& for_bas = cache().get("%FRD", _basesconto);
|
||||
if (for_bas.empty())
|
||||
_formule_documento.add(_basesconto, new TFormula_documento(_documento, _basesconto, "SOMMA(\"IMPONIBILE()\", \"(TIPO() != 'S') && (TIPO() != 'C')\")"), TRUE);
|
||||
|
||||
if (_formule.find(_basesconto) < 0)
|
||||
_formule.add(_basesconto);
|
||||
|
||||
_spese = prof.get("SPESE");
|
||||
if (_spese.empty())
|
||||
_spese = "SPESE";
|
||||
|
||||
const TRectype& for_spe = cache().get("%FRD", _spese);
|
||||
if (for_spe.empty())
|
||||
_formule_documento.add(_spese, new TFormula_documento(_documento, _spese, "SOMMA(\"IMPONIBILE()\", \"TIPO() == 'S'\")"), TRUE);
|
||||
|
||||
if (_formule.find(_spese) < 0)
|
||||
_formule.add(_spese);
|
||||
|
||||
_totvalres = prof.get("TOTVALRES");
|
||||
if (_totvalres.empty())
|
||||
_totvalres = "TOTVALRES";
|
||||
|
||||
_totvalore = prof.get("TOTVALORE");
|
||||
if (_totvalore.empty())
|
||||
_totvalore = "TOTVALORE";
|
||||
|
||||
const TRectype& for_tvr = cache().get("%FRD", _totvalres);
|
||||
if (for_tvr.empty())
|
||||
_formule_documento.add(_totvalres, new TFormula_documento(_documento, _totvalres, "VALDOC(0)"), TRUE);
|
||||
|
||||
if (_formule.find(_totvalres) < 0)
|
||||
_formule.add(_totvalres);
|
||||
|
||||
const TRectype& for_tva = cache().get("%FRD", _totvalore);
|
||||
if (for_tva.empty())
|
||||
_formule_documento.add(_totvalore, new TFormula_documento(_documento, _totvalore, "VALDOC(1)"), TRUE);
|
||||
|
||||
if (_formule.find(_totvalore) < 0)
|
||||
_formule.add(_totvalore);
|
||||
|
||||
if (provvigioni())
|
||||
{
|
||||
TString80 campo(prof.get("TOTPROVV"));
|
||||
if (campo.empty())
|
||||
campo = "TOTPROVV";
|
||||
const TRectype& frd = cache().get("%FRD", campo);
|
||||
|
||||
_totprovv = "_";
|
||||
_totprovv << campo;
|
||||
|
||||
TString80 expr(frd.get("S1"));
|
||||
if (expr.empty())
|
||||
expr = "SOMMA(\"PROVV()\")";
|
||||
_formule_documento.add(_totprovv, new TFormula_documento(_documento, _totprovv, expr, TRUE));
|
||||
if (_formule.find(campo) < 0)
|
||||
_formule.add(campo);
|
||||
_formule.add(_totprovv);
|
||||
_formule_documento.add(campo, new TFormula_documento(_documento, campo, "TOTPROVV()"), TRUE);
|
||||
}
|
||||
_totale_cont = prof.get("TOTALECONT", "MAIN");
|
||||
_cnt_prezzi = prof.get_bool("CONTROLLO_PREZZI", "MAIN");
|
||||
_field_prezzo = prof.get("PREZZO", "MAIN");
|
||||
}
|
||||
|
||||
bool TTipo_documento::stato_with_mov_mag(const char stato) const
|
||||
{
|
||||
if (!mov_mag())
|
||||
return FALSE;
|
||||
const char stato_finale(stato_mov_finale());
|
||||
if (stato_finale > ' ' && stato > stato_finale)
|
||||
return FALSE;
|
||||
const char stato_iniziale(stato_mov_iniziale());
|
||||
return stato >= stato_iniziale;
|
||||
}
|
||||
|
||||
TFormula_documento * TTipo_documento::succ_formula(bool restart)
|
||||
{
|
||||
if (restart)
|
||||
_formule.restart();
|
||||
|
||||
TString formula = _formule.get();
|
||||
while (formula.not_empty())
|
||||
{
|
||||
if (formula.blank())
|
||||
formula = _formule.get();
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (formula.not_empty())
|
||||
{
|
||||
char *expr = NULL;
|
||||
const int p = formula.find('=');
|
||||
if (p > 0)
|
||||
{
|
||||
expr = (char *) (const char *) formula + p;
|
||||
*expr = '\0'; expr++;
|
||||
}
|
||||
TFormula_documento * o = (TFormula_documento*)_formule_documento.objptr(formula);
|
||||
if (o == NULL)
|
||||
{
|
||||
o = new TFormula_documento(_documento, formula, expr);
|
||||
_formule_documento.add(formula, o);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool TTipo_documento::scarica_residuo() const
|
||||
{
|
||||
if (is_ordine() && (!riporta_ordinato()))
|
||||
return TRUE;
|
||||
return get_bool("B4");
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// TRiepilogo IVA
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
@ -27,3 +27,4 @@ bool pricerange_handler(TMask_field& f, KEY key );
|
||||
bool link_handler( TMask_field& f, KEY key );
|
||||
|
||||
bool numdocrif_hndl(TMask_field& field, KEY key);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user