046e2c06cb
Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 848 git-svn-id: svn://10.65.10.50/trunk@14993 c028cbd2-c16b-5b4b-a496-9718f37d4682
107 lines
2.5 KiB
C++
Executable File
107 lines
2.5 KiB
C++
Executable File
#include "gvlib.h"
|
|
|
|
#include <relation.h>
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TRigheF24_set
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// 0=tutte 1=libere 2=assegnate 3=tutte
|
|
TRigheF24_set::TRigheF24_set(int flags)
|
|
: TISAM_recordset("USE RIGHEF24 KEY 2")
|
|
{
|
|
switch ((flags & 0x3) % 3)
|
|
{
|
|
case 1: set("USE RIGHEF24 KEY 2\nTO PROGR=999999"); break;
|
|
case 2: set("USE RIGHEF24 KEY 2\nFROM F24=1"); break;
|
|
default: break;
|
|
}
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TF24_set
|
|
///////////////////////////////////////////////////////////
|
|
|
|
TF24_set::TF24_set(long codice)
|
|
: TISAM_recordset("USE RIGHEF24 KEY 2\nFROM F24=#DIST\nTO F24=#DIST")
|
|
{
|
|
CHECKD(codice > 0, "Distinta ma sospetta:", codice);
|
|
set_var("#DIST", TVariant(codice));
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TElencoF24_set
|
|
///////////////////////////////////////////////////////////
|
|
|
|
const TElencoF24_set* TElencoF24_set::_currentF24 = NULL;
|
|
|
|
bool TElencoF24_set::f24killer(const TRelation* rel)
|
|
{
|
|
// Il record e' buono se il bit corrispondente e' settato
|
|
return _currentF24->_good[rel->file().recno()];
|
|
}
|
|
|
|
TCursor* TElencoF24_set::cursor() const
|
|
{
|
|
_currentF24 = this;
|
|
|
|
TCursor* c = TISAM_recordset::cursor();
|
|
if (c != NULL && c->filterfunction() == NULL)
|
|
{
|
|
TBit_array& goodies = ((TElencoF24_set*)this)->_good;
|
|
goodies.reset();
|
|
|
|
long last = 0;
|
|
|
|
TRecnotype tot = c->items();
|
|
const TRectype& curr = c->curr();
|
|
for (*c = 0; c->pos() < tot; ++*c)
|
|
{
|
|
const long f24 = curr.get_long("F24");
|
|
bool good = f24 > last;
|
|
if (good)
|
|
{
|
|
last = f24;
|
|
if (_flags != 0) // Non voglio tutto?
|
|
{
|
|
const TDate inv = curr.get(F24_DATAVERS);
|
|
good = (_flags == 1) ^ inv.ok();
|
|
}
|
|
if (good)
|
|
goodies.set(c->file().recno());
|
|
}
|
|
}
|
|
c->freeze(false);
|
|
c->set_filterfunction(f24killer);
|
|
tot = c->items();
|
|
c->freeze(true);
|
|
}
|
|
return c;
|
|
}
|
|
|
|
// 0=tutte 1=da inviare 2=inviate 3=tutte
|
|
TElencoF24_set::TElencoF24_set(int flags)
|
|
: TRigheF24_set(0x2)
|
|
{
|
|
_flags = (flags & 0x3) % 3; // isolo i flag = 1 o flag = 2
|
|
}
|
|
|
|
long get_next_f24()
|
|
{
|
|
long f24 = 1;
|
|
TRigheF24_set deleghe(0x2);
|
|
if (deleghe.move_last())
|
|
f24 += deleghe.get(F24_F24).as_int();
|
|
return f24;
|
|
}
|
|
|
|
long get_next_progr_f24()
|
|
{
|
|
TLocalisamfile righef24(LF_RIGHEF24);
|
|
long next_progr = 1;
|
|
|
|
if (righef24.read(_islast) == NOERR)
|
|
next_progr += righef24.get_long(F24_PROGR);
|
|
return next_progr;
|
|
}
|