Corretti errori seganlati da Piergiorgio
git-svn-id: svn://10.65.10.50/trunk@487 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
333c1e8089
commit
9c17a9fc56
@ -6,6 +6,7 @@
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <msksheet.h>
|
||||
#include <config.h>
|
||||
#include <attiv.h>
|
||||
#include <nditte.h>
|
||||
#include "cg5.h"
|
||||
@ -20,6 +21,7 @@ class CG5300_App : public TRelation_application
|
||||
TMask * _msk;
|
||||
TLocalisamfile * _attiv;
|
||||
TLocalisamfile * _ditte;
|
||||
int _yearliq;
|
||||
TTable * _pla;
|
||||
TArray _atts; // array di stringhe con i codici attivita'
|
||||
TArray _tips; // array di stringhe con i tipi attivita'
|
||||
@ -85,43 +87,20 @@ void CG5300_App::init_ditta(TMask& m)
|
||||
else
|
||||
_freqiva = "";
|
||||
}
|
||||
|
||||
// se non c'e' LIA per la ditta, la crea
|
||||
TTable & lia = (TTable &) _rel->lfile();
|
||||
|
||||
const TString16 year(m.get(F_YEAR));
|
||||
|
||||
lia.zero();
|
||||
lia.put("CODTAB", year);
|
||||
lia.put("S7", _freqiva);
|
||||
lia.write();
|
||||
for (int i = 0; i < _atts.items(); i++)
|
||||
{
|
||||
// se non ci sono i record di PLA per le attivita', li crea vuoti
|
||||
const TString& att = (TString&) _atts[i];
|
||||
const TString& tips = (TString&) _tips[i];
|
||||
|
||||
_pla->zero();
|
||||
_pla->put("CODTAB", format("%s%s1", (const char *) year, (const char *) att));
|
||||
_pla->put("S7", tips);
|
||||
_pla->write();
|
||||
_pla->zero();
|
||||
_pla->put("CODTAB", format("%s%s2", (const char *) year, (const char *) att));
|
||||
_pla->put("S7", tips);
|
||||
_pla->write();
|
||||
}
|
||||
}
|
||||
|
||||
bool CG5300_App::user_create()
|
||||
|
||||
{
|
||||
TConfig d(CONFIG_DITTA);
|
||||
|
||||
_yearliq = (int)d.get_long("AnLiIv");
|
||||
_rel = new TRelation(TAB_LIA);
|
||||
_pla = new TTable(TAB_PLA);
|
||||
_attiv = new TLocalisamfile(LF_ATTIV);
|
||||
_ditte = new TLocalisamfile(LF_NDITTE);
|
||||
_msk = new TMask("cg5300a");
|
||||
((TSheet_field&)_msk->field(F_SHEET_PLA)).set_notify(sheet_action);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -206,31 +185,25 @@ int CG5300_App::rewrite(const TMask& m)
|
||||
_pla->put("R6", tt.get()); // plafond art. 8bis
|
||||
_pla->put("R7", tt.get()); // plafond art. 9
|
||||
err = (was ? _pla->rewrite() : _pla->write());
|
||||
if (err == NOERR)
|
||||
{
|
||||
_pla->zero();
|
||||
_pla->put("CODTAB", format("%s%s2", (const char *) year, (const char *) att));
|
||||
was =_pla->read() == NOERR;
|
||||
if (!was) _pla->zero();
|
||||
_pla->put("CODTAB", format("%s%s2", (const char *) year, (const char *) att));
|
||||
// scrive i campi (vedi a read() per i nomi)
|
||||
// in base alla riga sheet
|
||||
_pla->put("S7", tips); // tipo attivita'
|
||||
_pla->put("R8", tt.get(2)); // prorata
|
||||
_pla->put("R5", tt.get()); // plafond art. 8
|
||||
_pla->put("R6", tt.get()); // plafond art. 8bis
|
||||
_pla->put("R7", tt.get()); // plafond art. 9
|
||||
err = (was ? _pla->rewrite() : _pla->write());
|
||||
}
|
||||
}
|
||||
TTable & lia = (TTable &) _rel->lfile();
|
||||
|
||||
lia.zero();
|
||||
lia.put("CODTAB", year);
|
||||
was = lia.read() == NOERR;
|
||||
if (!was) lia.zero();
|
||||
if (!was) lia.zero();
|
||||
m.autosave();
|
||||
if (err == NOERR) err = (was ? lia.rewrite() : lia.write());
|
||||
if (err == NOERR && year == _yearliq)
|
||||
{
|
||||
_ditte->zero();
|
||||
_ditte->put(NDT_CODDITTA, _lastditta);
|
||||
if (_ditte->read() == NOERR)
|
||||
{
|
||||
_ditte->put(NDT_FREQVIVA, m.get(F_FREQ_VERS));
|
||||
_ditte->rewrite();
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user