campo-sirio/cg/cg1300.cpp

144 lines
3.2 KiB
C++
Executable File
Raw Blame History

//********************************
//* Aggiornamento Tipo Attivita' *
//********************************
#include <applicat.h>
#include <isam.h>
#include <mask.h>
#include <progind.h>
#include "cg1.h"
#include "cg1301.h"
#include "cg1302.h"
#include "cg1303.h"
#include "cg1304.h"
#include "cg1305.h"
#include "cg1306.h"
#include "cglib01.h"
#include <mov.h>
class TAgg_attiv : public TSkeleton_application
{
protected:
virtual void main_loop();
public:
void elabora_mov();
};
// HIDDEN TAgg_attiv& app() { return (TAgg_attiv&)main_app(); }
void TAgg_attiv::main_loop()
{
TMask msk("cg1300a");
while (msk.run() == K_ENTER)
{
elabora_mov();
message_box(TR("Aggiornamento completato"));
}
}
void TAgg_attiv::elabora_mov()
{
TRelation rel (LF_MOV);
rel.add(LF_RMOVIVA, "NUMREG=NUMREG",1);
TCursor cursor(&rel,"",1);
TLocalisamfile& mov = rel.lfile();
TLocalisamfile& rmoviva = rel.lfile(LF_RMOVIVA);
//- long ditta = get_firm();
cursor = 0L;
const long nitems = cursor.items();
TProgind p(nitems ? nitems : 1, TR("Aggiornamento in corso...") , TRUE, TRUE, 70);
for (; cursor.pos() < cursor.items(); ++cursor)
{
p.addstatus(1);
const TString16 reg(mov.get(MOV_REG));
if (reg.empty()) continue;
const int annoiva = mov.get_int(MOV_ANNOIVA);
TRegistro registro(reg, annoiva);
const bool att_mista = registro.attivita_mista();
if (att_mista)
{
bool ok = rel.is_first_match(LF_RMOVIVA);
while (ok)
{
const char tipo = rmoviva.get_char("TIPOC");
if (tipo <= ' ')
{
TBill c(rmoviva.get_int("GRUPPO"), rmoviva.get_int("CONTO"), rmoviva.get_long("SOTTOCONTO"));
int tipoatt = c.tipo_att();
rmoviva.put("TIPOATT", tipoatt);
rmoviva.rewrite();
}
ok = rel.next_match(LF_RMOVIVA);
}
}
}
}
int cg1300(int argc, char* argv[])
{
switch (toupper(*argv[2]))
{
case 'A':
{
TAgg_attiv a;
a.run(argc, argv, TR("Aggiornamento tipo attivit<69> su movimenti IVA"));
}
break;
case 'B': agg_iban(argc, argv); break; // cg1310
case 'C':
{
TAgg_codatt a;
a.run(argc, argv,TR("Aggiornamento codice attivit<69>"));
}
break;
case 'D':
{
TAgg_datacomp a;
a.run(argc, argv,TR("Aggiornamento data competenza"));
}
break;
case 'E':
{
TAgg_codes a;
a.run(argc, argv,TR("Aggiornamento codice esercizio"));
}
break;
case 'I': agg_opintra(argc, argv); break;
case 'L': controlla_PIVA(argc, argv); break; // cg1309
case 'P':
{
TAgg_nprot a;
a.run(argc, argv,TR("Rinumerazione numero di protocollo"));
}
break;
case 'T':
{
TAgg_tconto a;
a.run(argc, argv, TR("Aggiornamento tipo conto")); // cg1302
}
break;
case 'M':
setta_meseliq(argc, argv);
break;
case 'X':
xref_check(argc, argv);
break;
case 'Z':
elimina_zoppi(argc, argv);
break;
default:
break;
}
return 0;
}