Patch level : 10.0 508

Files correlati     : ve0 ve6
Ricompilazione Demo : [ ]
Commento            :
Corretta eliminazione vecchia scheda percipienti in sede di ricontabilizzazione di un documento in cui fosse cambiato il percipiente.


git-svn-id: svn://10.65.10.50/trunk@19613 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-11-12 15:07:15 +00:00
parent 9f71dd7f30
commit 5e9a8a3cbe
3 changed files with 49 additions and 60 deletions

View File

@ -432,7 +432,7 @@ int TElaborazione::read(const char* cod)
{
int err = NOERR;
*this = cache().get("%ELD", cod);
TRectype::operator=(cache().get("%ELD", cod));
if (empty())
{
yesnofatal_box("Codice elaborazione non valido: %s", cod);

View File

@ -171,7 +171,6 @@ public:
bool doc_uguale(int u) const { return get("S1").mid(u, 1) == "X"; }
bool riga_uguale(int u) const { return get("S1").mid(40+u, 1) == "X"; }
bool raggruppa_righe() const { return get_bool("B0"); }
virtual bool gestione_riferimenti() const { return get_bool("B1"); }
virtual bool riferimenti_in_testa() const { return get_bool("B2"); }
@ -476,6 +475,7 @@ protected:
error_type write_intra(TDocumento&);
error_type write_anal(TDocumento& doc, const TMovimentoPN& mv);
error_type write_percip(TDocumento& doc, const TMovimentoPN& movimento);
TRecnotype kill_righe_percip(TIsam_handle logic, char tipopercip, long codpercip, long nprog) const;
// Aggiorna i saldi
void aggiorna_saldi(TSaldo_agg& saldo, TMovimentoPN& mv, bool save);

View File

@ -3677,6 +3677,28 @@ error_type TContabilizzazione::write_anal(TDocumento& doc, const TMovimentoPN& m
return _error;
}
TRecnotype TContabilizzazione::kill_righe_percip(TIsam_handle logic, char tipopercip, long codpercip, long nprog) const
{
CHECKD(logic == LF_RVER || logic == LF_RPAG, "Invalid file number ", logic);
CHECKD(nprog > 0, "Invalid NPROGR ", nprog);
TRelation rel(logic);
TRectype& riga = rel.curr();
riga.put(VER_CODDITTA, prefix().firm().codice());
riga.put(VER_TIPOA, tipopercip);
riga.put(VER_CODANAGR, codpercip);
riga.put(VER_NPROG, nprog);
TCursor cur(&rel, "", 1, &riga, &riga);
const TRecnotype tot = cur.items();
if (tot > 0)
{
cur.freeze();
for (cur = 0L; cur.pos() < tot; ++cur)
cur.file().remove();
}
return tot;
}
error_type TContabilizzazione::write_percip(TDocumento& doc, const TMovimentoPN& movimento)
{
const char tipopercip = doc.clifor().get_char(CLI_TIPOAPER);
@ -3687,10 +3709,8 @@ error_type TContabilizzazione::write_percip(TDocumento& doc, const TMovimentoPN&
TBit_array to_delete;
TArray schede;
TLocalisamfile schperc(LF_SCPERC);
TLocalisamfile rpag(LF_RPAG);
TLocalisamfile rver(LF_RVER);
TLocalisamfile perc(LF_PERC);
const long numreg = movimento.lfile().get_long(MOV_NUMREG);
const long numreg = movimento.curr().get_long(MOV_NUMREG);
int numsch = 0;
schperc.setkey(3);
@ -3800,7 +3820,7 @@ error_type TContabilizzazione::write_percip(TDocumento& doc, const TMovimentoPN&
err = NOERR;
for (i = 0; err == NOERR && i < numsch; i++)
{
TRectype & rec = (TRectype &) schede[i];
TRectype& rec = (TRectype&)schede[i];
const char tipo = rec.get_char(SCH_TIPOA);
const long codanagr = rec.get_long(SCH_CODANAGR);
@ -3809,66 +3829,35 @@ error_type TContabilizzazione::write_percip(TDocumento& doc, const TMovimentoPN&
TToken_string msg(256, '.');
const int nprog = rec.get_int(SCH_NPROG);
msg.format("Sono state eliminate le righe di pagamento e versamento relative alla scheda %c/%ld/%d."
"Dovranno quindi essere ripristinate dell'utente.", tipo, codanagr, nprog);
err = rec.remove(schperc);
rver.curr().zero();
rver.put(VER_CODDITTA, prefix().firm().codice());
rver.put(VER_TIPOA, tipopercip);
rver.put(VER_CODANAGR, codpercip);
rver.put(VER_NPROG, nprog);
const TRectype rvercmp(rver.curr());
bool removed = false;
for (int errver = rver.read(_isgteq); errver == NOERR && rver.curr() == rvercmp; errver = rver.next())
{
rver.remove();
}
if (removed)
if (kill_righe_percip(LF_RVER, tipo, codanagr, nprog))
msg.format("Sono state eliminate le righe di versamento relative alla scheda %c/%ld/%d."
"Dovranno quindi essere ripristinate dell'utente.", tipo, codanagr, nprog);
rpag.curr().zero();
rver.put(PAG_CODDITTA, prefix().firm().codice());
rver.put(PAG_TIPOA, tipopercip);
rver.put(PAG_CODANAGR, codpercip);
rver.put(PAG_NPROG, nprog);
const TRectype rpagcmp(rpag.curr());
removed = false;
for (int errpag = rpag.read(_isgteq); errpag == NOERR && rpag.curr() == rpagcmp; errpag = rpag.next())
if (kill_righe_percip(LF_RPAG, tipo, codanagr, nprog))
{
removed = true;
rpag.remove();
}
if (removed)
{
TString s;
s.format("Sono state eliminate le righe di pagamento relative alla scheda %c/%ld/%d."
TString m(128);
m.format("Sono state eliminate le righe di pagamento relative alla scheda %c/%ld/%d."
"Dovranno quindi essere ripristinate dell'utente.", tipo, codanagr, nprog);
msg << s;
msg.add(m);
}
if (_viswin && msg.full())
if (msg.full())
{
if (_viswin)
{
TString riga;
FOR_EACH_TOKEN(msg, line)
{
if (*line)
FOR_EACH_TOKEN(msg, line) if (*line)
{
riga = riga.empty() ? "*** " : " ";
riga << line << '.';
_viswin->add_line(riga);
}
}
}
else
message_box(msg);
warning_box(msg);
}
}
else
if (i < orig_numsch)