89 lines
2.1 KiB
C++
89 lines
2.1 KiB
C++
|
#include "ve5.h"
|
||
|
#include "applicat.h"
|
||
|
#include "mask.h"
|
||
|
|
||
|
#include "progind.h"
|
||
|
#include "lffiles.h"
|
||
|
#include "isam.h"
|
||
|
#include "doc.h"
|
||
|
#include "velib.h"
|
||
|
#include "ve5700.h"
|
||
|
|
||
|
class TDoctype_mask : public TMask
|
||
|
{
|
||
|
public:
|
||
|
TDoctype_mask() : TMask("ve5700") { }
|
||
|
};
|
||
|
|
||
|
class TFPDoctype_change : public TSkeleton_application
|
||
|
{
|
||
|
protected:
|
||
|
void main_loop() override;
|
||
|
bool create() override;
|
||
|
|
||
|
};
|
||
|
|
||
|
void TFPDoctype_change::main_loop()
|
||
|
{
|
||
|
TDoctype_mask m;
|
||
|
while (m.run() == K_ENTER)
|
||
|
{
|
||
|
TRelation rel(LF_DOC);
|
||
|
m.autosave(rel);
|
||
|
|
||
|
TRectype recini(rel.curr());
|
||
|
TRectype recfin(rel.curr());
|
||
|
|
||
|
recini.put(DOC_NDOC, m.get(F_DANUMERO));
|
||
|
recfin.put(DOC_NDOC, m.get(F_ANUMERO));
|
||
|
|
||
|
TString filter;
|
||
|
filter << DOC_TIPODOCSDI << "==\"" << m.get(F_INIZIALE) << "\"";
|
||
|
|
||
|
TCursor cur(&rel, filter, 1, &recini, &recfin);
|
||
|
const long total = cur.items();
|
||
|
if (total > 0)
|
||
|
{
|
||
|
TString msg = TR("Confermare l'aggiornamento di ");
|
||
|
msg.add_plural(total, TR("documento"));
|
||
|
if (yesno_box(msg))
|
||
|
{
|
||
|
TProgress_monitor pi(total, title());
|
||
|
const TString& finale = m.get(F_FINALE);
|
||
|
TDocumento* doc = new TDocumento;
|
||
|
rel.lfile().set_curr(doc);
|
||
|
cur.freeze();
|
||
|
for (cur = 0; cur.pos() < total; ++cur)
|
||
|
{
|
||
|
if (!pi.add_status())
|
||
|
break;
|
||
|
doc->put(DOC_TIPODOCSDI, finale);
|
||
|
int err = doc->rewrite();
|
||
|
}
|
||
|
|
||
|
// Forza l'aggiornamento dell'indice del cursore
|
||
|
TEdit_field& ef = m.efield(F_DANUMERO);
|
||
|
TCursor* cur = ef.browse()->cursor();
|
||
|
filter = cur->filter();
|
||
|
cur->setfilter("");
|
||
|
cur->setfilter(filter);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool TFPDoctype_change::create()
|
||
|
{
|
||
|
open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN, LF_DOC, LF_RIGHEDOC,
|
||
|
LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_CONDV, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_CESS,
|
||
|
LF_CAUSALI, LF_RCAUSALI, 0);
|
||
|
return TSkeleton_application::create();
|
||
|
}
|
||
|
|
||
|
int ve5700(int argc, char* argv[])
|
||
|
{
|
||
|
TFPDoctype_change a;
|
||
|
a.run(argc, argv, "Aggiornamento tipo documento SDI (TD--)");
|
||
|
return 0;
|
||
|
}
|