Corretto aggiornamento statistiche dei documenti
git-svn-id: svn://10.65.10.50/branches/R_10_00@22856 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1985494e93
commit
7dbfb5ffc9
@ -311,9 +311,10 @@ void TDocumento::check_modules()
|
||||
{
|
||||
if (_has_mag == 3)
|
||||
{
|
||||
_has_mag = dongle().active(MGAUT);
|
||||
_has_stat_ven = dongle().active(SVAUT);
|
||||
_has_provv = dongle().active(PRAUT);
|
||||
const TDongle& din = dongle();
|
||||
_has_mag = din.active(MGAUT);
|
||||
_has_stat_ven = din.active(SVAUT);
|
||||
_has_provv = din.active(PRAUT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -789,9 +790,9 @@ int TDocumento::read(TBaseisamfile& f, word op, word lockop)
|
||||
set_riga_esenzione();
|
||||
_stato_originale = stato();
|
||||
|
||||
if (err == NOERR && tipo_valido() && tipo().statistiche() && _has_stat_ven)
|
||||
if (err == NOERR && _has_stat_ven && tipo_valido() && tipo().statistiche() )
|
||||
{
|
||||
TString80 key(get(DOC_PROVV)); key << get(DOC_ANNO); key << get(DOC_CODNUM); key << get(DOC_NDOC);
|
||||
const TDoc_key key(head());
|
||||
TObject* o = _docs_to_agg.objptr(key);
|
||||
|
||||
const bool is_nota_credito = tipo().nota_credito();
|
||||
@ -800,16 +801,20 @@ int TDocumento::read(TBaseisamfile& f, word op, word lockop)
|
||||
{
|
||||
TStats_agg* st_agg = new TStats_agg;
|
||||
for (int i = physical_rows(); i > 0; i--)
|
||||
{
|
||||
if (is_nota_credito)
|
||||
st_agg->add(row(i));
|
||||
else
|
||||
st_agg->sub(row(i));
|
||||
}
|
||||
_docs_to_agg.add(key, st_agg, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lockop == _unlock && o != NULL)
|
||||
_docs_to_agg.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
_old_agente.cut(0);
|
||||
_old_agente1.cut(0);
|
||||
@ -1169,7 +1174,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
myself.update_raee();
|
||||
myself.set_row_ids();
|
||||
|
||||
const bool check_movmag = dongle().active(MGAUT) && tipo().mov_mag();
|
||||
const bool check_movmag = _has_mag && tipo().mov_mag();
|
||||
if (check_movmag)
|
||||
{
|
||||
const bool do_movmag = tipo().stato_with_mov_mag(stato_doc) && get(DOC_CAUSMAG).not_empty();
|
||||
@ -1503,9 +1508,9 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
}
|
||||
if (_has_provv && tipo().provvigioni() && tipo().stato_provvigioni() <= stato())
|
||||
myself.update_provvigioni(false);
|
||||
if (tipo().statistiche() && _has_stat_ven)
|
||||
if (_has_stat_ven && tipo().statistiche())
|
||||
{
|
||||
TString80 key(get(DOC_PROVV)); key << get(DOC_ANNO); key << get(DOC_CODNUM); key << get(DOC_NDOC);
|
||||
const TDoc_key key(myself.head());
|
||||
TStats_agg* st_agg = (TStats_agg*)_docs_to_agg.objptr(key);
|
||||
const bool is_nota_credito = tipo().nota_credito();
|
||||
|
||||
@ -1514,21 +1519,24 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
st_agg = new TStats_agg;
|
||||
_docs_to_agg.add(key, st_agg, true);
|
||||
}
|
||||
int i;
|
||||
|
||||
for (i = physical_rows(); i > 0; i--)
|
||||
for (int i = physical_rows(); i > 0; i--)
|
||||
{
|
||||
if (is_nota_credito)
|
||||
st_agg->sub(myself.row(i));
|
||||
else
|
||||
st_agg->add(myself.row(i));
|
||||
}
|
||||
st_agg->update();
|
||||
for (i = physical_rows(); i > 0; i--)
|
||||
for (int i = physical_rows(); i > 0; i--)
|
||||
{
|
||||
if (is_nota_credito)
|
||||
st_agg->add(myself.row(i));
|
||||
else
|
||||
st_agg->sub(myself.row(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
// eliminare anche il mov di mag. ??????
|
||||
@ -1536,7 +1544,7 @@ int TDocumento::remove(TBaseisamfile& f) const
|
||||
{
|
||||
if (!cancellabile() && !yesno_box("Documento non cancellabile,\nContinuare ugualmente"))
|
||||
return NOERR;
|
||||
const bool check_movmag = dongle().active(MGAUT) && tipo().mov_mag();
|
||||
const bool check_movmag = _has_mag && tipo().mov_mag();
|
||||
const bool doc_bloccato = bloccato();
|
||||
|
||||
if (check_movmag)
|
||||
@ -1564,11 +1572,10 @@ int TDocumento::remove(TBaseisamfile& f) const
|
||||
}
|
||||
if (!doc_bloccato)
|
||||
{
|
||||
if (tipo().statistiche() && _has_stat_ven)
|
||||
if (_has_stat_ven && tipo().statistiche())
|
||||
{
|
||||
TString80 key(get(DOC_PROVV)); key << get(DOC_ANNO); key << get(DOC_CODNUM); key << get(DOC_NDOC);
|
||||
const TDoc_key key(head());
|
||||
TStats_agg* st_agg = (TStats_agg*)_docs_to_agg.objptr(key);
|
||||
|
||||
if (st_agg != NULL)
|
||||
{
|
||||
st_agg->update();
|
||||
@ -1578,7 +1585,6 @@ int TDocumento::remove(TBaseisamfile& f) const
|
||||
if (_has_provv && tipo().provvigioni())
|
||||
{
|
||||
TDocumento& myself = *((TDocumento *)this);
|
||||
|
||||
myself.update_provvigioni(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user