Patch level : 12.0 1024

Files correlati     : ve5.exe
Commento            :

Modificati i ve5800.cpp velib04.cpp ed .h aggiunti un filtro per selezionare solo i documenti da raggruppare.
This commit is contained in:
francescofucarino 2020-12-23 17:33:41 +01:00
parent f2e4d57192
commit 47de958f1a
3 changed files with 63 additions and 6 deletions

View File

@ -27,11 +27,30 @@ class TRaggruppamento_documenti_mask : public TAutomask
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TRaggruppamento_documenti_mask() : TAutomask("ve5800a") {}
public:
TRaggruppamento_documenti_mask();
virtual ~TRaggruppamento_documenti_mask() {}
};
bool selectfunc(const TRelation* r);
TRaggruppamento_documenti_mask::TRaggruppamento_documenti_mask() : TAutomask("ve5800a")
{
TEdit_field & da = efield(F_FRNDOC);
TCursor * cur_da = da.browse()->cursor();
cur_da->set_filterfunction(selectfunc); //nome funzione
TEdit_field & a = efield(F_FRNDOC);
TCursor * cur_a = a.browse()->cursor();
cur_a->set_filterfunction(selectfunc); //nome funzione
};
bool TRaggruppamento_documenti_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
@ -52,11 +71,16 @@ bool TRaggruppamento_documenti_mask::on_field_event(TOperable_field& o, TField_e
class TRaggruppamento_documenti : public TSkeleton_application
{
TMask *_mask;
public:
void raggruppa_doc(const TMask & m);
virtual void main_loop();
void set_mask(TMask * m) { _mask = m; }
const TMask * get_mask() const { return _mask; }
void raggruppa_doc(const TMask & m);
virtual void main_loop();
};
TRaggruppamento_documenti & app() { return (TRaggruppamento_documenti &)main_app(); }
void TRaggruppamento_documenti::raggruppa_doc(const TMask & m)
{
TRaggruppamento_documento ragg(m.get(F_CODICE_ELAB));
@ -88,6 +112,14 @@ void TRaggruppamento_documenti::raggruppa_doc(const TMask & m)
}
}
bool selectfunc(const TRelation* r)
{
const TMask * m = app().get_mask();
TRaggruppamento_documento ragg(m->get(F_CODICE_ELAB));
const TRectype & curr = r->lfile().curr();
return ragg.doc_ok(curr);
};
void TRaggruppamento_documenti::main_loop()
{
open_files(LF_TAB, LF_TABCOM, LF_DOC, LF_RIGHEDOC, LF_MOVMAG, NULL);
@ -96,6 +128,7 @@ void TRaggruppamento_documenti::main_loop()
TRaggruppamento_documenti_mask m;
m.set(F_CODDITTA, prefix().get_codditta(), true);
set_mask(&m);
while (m.run()==K_ENTER)
raggruppa_doc(m);
}

View File

@ -627,7 +627,7 @@ void TElaborazione::tipi_stati_iniziali(TToken_string& tipi, TToken_string& stat
{
TString4 t;
tipi.cut(0);
tipi.cut(0);
stati.cut(0);
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
{
@ -647,6 +647,28 @@ void TElaborazione::tipi_stati_iniziali(TToken_string& tipi, TToken_string& stat
CHECK(!stati.empty_items(), "Nessuno stato documento valido");
}
bool TElaborazione::doc_ok(const TRectype & rec) const
{
TString4 t;
const TString4 tipo = rec.get(DOC_TIPODOC);
const char stato = rec.get_char(DOC_STATO);
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
{
t = tipo_iniziale(i);
const char s = stato_iniziale(i);
if (t.blank() && s == '\0')
break;
else
if (t.full() || s > ' ')
{
if ((t == tipo) && (s == stato))
return true;
}
}
return false;
}
///////////////////////////////////////////////////////////
// TElaborazione_esterna
///////////////////////////////////////////////////////////

View File

@ -45,7 +45,6 @@ public:
int items() const { return _documenti.items(); }
int sort(const char* fields = ""); // token string of field names
TLista_documenti() { }
virtual ~TLista_documenti() {};
};
@ -218,6 +217,9 @@ public:
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
const TDate& data_elab, bool interattivo = false);
bool doc_ok(const TDocumento & doc) const { return doc_ok((const TRectype &)doc); }
bool doc_ok(const TRectype & rec) const;
TElaborazione(const char* cod);
TElaborazione(const TRectype& rec) : TRectype(rec) { }
virtual ~TElaborazione() { }