Patch level : 2.2 198

Files correlati     : ci0.exe
Ricompilazione Demo : [ ]
Commento            :

Bug   	 0000461

Aggiungere eliminazione documenti per le commesse chiuse. I piu' bisogna provare  la cancellazione di un documento in stato normale e bloccato. nel secondo caso non deve cancellare il magazzino, agenti statistice etc...


git-svn-id: svn://10.65.10.50/trunk@13422 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2005-10-13 16:58:40 +00:00
parent be76193ce8
commit 19b5789a5b

View File

@ -246,7 +246,11 @@ void TImmissioneDocumenti_mask::update_current_calendar(int year)
const int doc_items = cursor.items();
for (cursor = 0; cursor.pos() < doc_items; ++cursor)
dayfl.set(relation.lfile().get_date(DOC_DATADOC) - caput_anni, 1);
{
const TDate datadoc = relation.lfile().get_date(DOC_DATADOC);
if (datadoc.year() == year)
dayfl.set(datadoc - caput_anni, 1);
}
if (ordered()[currpage])
{
caput_anni += dayfl.last_one();
@ -417,19 +421,35 @@ bool delete_closed(const TRelation& rel, void* pJolly)
TDocumento & doc = (TDocumento &) rel.lfile().curr();
const int rows = doc.physical_rows();
bool closed = true;
TBit_array rows2delete;
for (int i = 1; closed && i <= rows; i++)
for (int i = 1; i <= rows; i++)
{
const char t = doc[i].tipo().tipo();
if (t == RIGA_SCONTI || t == RIGA_OMAGGI || t == RIGA_DESCRIZIONI)
continue;
const TString & codcms = doc[i].codice_commessa();
const TRectype & cms = cache().get(LF_COMMESSE, codcms);
const bool closed_row = cms.get_bool("CHIUSA");
closed &= cms.get_bool("CHIUSA");
rows2delete.set(i, closed_row);
closed &= closed_row;
}
if (closed)
{
doc.stato('9');
doc.remove();
}
else
if (rows2delete.first_one() >= 0)
{
for (int i = rows; i >= 1 ; i--)
{
if (rows2delete[i])
doc.destroy_row(i, true);
}
doc.rewrite();
}
return true;
}