campo-sirio/ci/ci2300.cpp
luca83 e544810f45 Patch level :
Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/branches/R_10_00@21573 c028cbd2-c16b-5b4b-a496-9718f37d4682
2011-02-02 16:33:56 +00:00

702 lines
23 KiB
C++
Executable File

#include <applicat.h>
#include <automask.h>
#include <colors.h>
#include <defmask.h>
#include <recset.h>
#include <sheet.h>
#include <textset.h>
#include <utility.h>
#include <doc.h>
#include "ci2.h"
#include "cilib.h"
#include "ci2300a.h"
#include "rilore.h"
#include "../ca/calib01.h"
#include "../ve/velib.h"
#define T_N "N"
#define T_X "X"
class TImporta_recordset : public TAS400_recordset
{
public:
void add_field(const char* name, const char* tipo, int pos, int len);
TImporta_recordset(const int rec_length);
};
//ADD_FIELD: aggiunge i campi al recordset
void TImporta_recordset::add_field(const char* name, const char* tipo, int pos, int len)
{
//CHECK(name[1]=='.', "Campo orfano di tracciato");
const TFixed_string str_tipo(tipo);
TFieldtypes ft = _alfafld;
if (str_tipo.ends_with("N"))
ft = _intzerofld;
create_field(name, -1, len, ft);
}
//costruttore
TImporta_recordset::TImporta_recordset(const int rec_lenght)
: TAS400_recordset("AS400()")
{
TString16 query;
query << "AS400(" << rec_lenght << ")";
TFilename cazzone;
parse_query(query, cazzone);
}
//Classe TImporta_fat_rec
class TImporta_rilore_rec : public TImporta_recordset
{
protected:
virtual TRecnotype new_rec(const char* trc);
public:
TImporta_rilore_rec(const TFilename& filename);
};
/////////////////////////////////////////////////////////////
// Recordset specifici per i dati da trasferire INPUT
/////////////////////////////////////////////////////////////
TRecnotype TImporta_rilore_rec::new_rec(const char* trc)
{
if (trc && *trc > ' ')
{
TString rec; rec << trc << "\r\n";
return TText_recordset::new_rec(rec);
}
return -1;
}
//questo invece è il metodo magico che vale per il caricamento da file esterno
TImporta_rilore_rec::TImporta_rilore_rec(const TFilename& filename)
: TImporta_recordset(1707)
{
TFilename cazzone;
parse_query("AS400(1707)", cazzone);
add_field("CODAZI", T_N, -1, 4);
add_field("CODFIL", T_N, -1, 2);
add_field("MATR", T_N, -1, 9);
add_field("COGNOME", T_X, -1, 34);
add_field("NOME", T_X, -1, 34);
add_field("DADATA", T_X, -1, 6);
add_field("ADATA", T_X, -1, 6);
add_field("01_OREORD", T_N, -1, 4);
add_field("01_CODGIU1", T_N, -1, 4);
add_field("01_OREGIU1", T_N, -1, 4);
add_field("01_CODGIU2", T_N, -1, 4);
add_field("01_OREGIU2", T_N, -1, 4);
add_field("01_CODGIU3", T_N, -1, 4);
add_field("01_OREGIU3", T_N, -1, 4);
add_field("01_CODGIU4", T_N, -1, 4);
add_field("01_OREGIU4", T_N, -1, 4);
add_field("01_CODGIU5", T_N, -1, 4);
add_field("01_OREGIU5", T_N, -1, 4);
add_field("01_CODGIU6", T_N, -1, 4);
add_field("01_OREGIU6", T_N, -1, 4);
add_field("02_OREORD", T_N, -1, 4);
add_field("02_CODGIU1", T_N, -1, 4);
add_field("02_OREGIU1", T_N, -1, 4);
add_field("02_CODGIU2", T_N, -1, 4);
add_field("02_OREGIU2", T_N, -1, 4);
add_field("02_CODGIU3", T_N, -1, 4);
add_field("02_OREGIU3", T_N, -1, 4);
add_field("02_CODGIU4", T_N, -1, 4);
add_field("02_OREGIU4", T_N, -1, 4);
add_field("02_CODGIU5", T_N, -1, 4);
add_field("02_OREGIU5", T_N, -1, 4);
add_field("02_CODGIU6", T_N, -1, 4);
add_field("02_OREGIU6", T_N, -1, 4);
add_field("03_OREORD", T_N, -1, 4);
add_field("03_CODGIU1", T_N, -1, 4);
add_field("03_OREGIU1", T_N, -1, 4);
add_field("03_CODGIU2", T_N, -1, 4);
add_field("03_OREGIU2", T_N, -1, 4);
add_field("03_CODGIU3", T_N, -1, 4);
add_field("03_OREGIU3", T_N, -1, 4);
add_field("03_CODGIU4", T_N, -1, 4);
add_field("03_OREGIU4", T_N, -1, 4);
add_field("03_CODGIU5", T_N, -1, 4);
add_field("03_OREGIU5", T_N, -1, 4);
add_field("03_CODGIU6", T_N, -1, 4);
add_field("03_OREGIU6", T_N, -1, 4);
add_field("04_OREORD", T_N, -1, 4);
add_field("04_CODGIU1", T_N, -1, 4);
add_field("04_OREGIU1", T_N, -1, 4);
add_field("04_CODGIU2", T_N, -1, 4);
add_field("04_OREGIU2", T_N, -1, 4);
add_field("04_CODGIU3", T_N, -1, 4);
add_field("04_OREGIU3", T_N, -1, 4);
add_field("04_CODGIU4", T_N, -1, 4);
add_field("04_OREGIU4", T_N, -1, 4);
add_field("04_CODGIU5", T_N, -1, 4);
add_field("04_OREGIU5", T_N, -1, 4);
add_field("04_CODGIU6", T_N, -1, 4);
add_field("04_OREGIU6", T_N, -1, 4);
add_field("05_OREORD", T_N, -1, 4);
add_field("05_CODGIU1", T_N, -1, 4);
add_field("05_OREGIU1", T_N, -1, 4);
add_field("05_CODGIU2", T_N, -1, 4);
add_field("05_OREGIU2", T_N, -1, 4);
add_field("05_CODGIU3", T_N, -1, 4);
add_field("05_OREGIU3", T_N, -1, 4);
add_field("05_CODGIU4", T_N, -1, 4);
add_field("05_OREGIU4", T_N, -1, 4);
add_field("05_CODGIU5", T_N, -1, 4);
add_field("05_OREGIU5", T_N, -1, 4);
add_field("05_CODGIU6", T_N, -1, 4);
add_field("05_OREGIU6", T_N, -1, 4);
add_field("06_OREORD", T_N, -1, 4);
add_field("06_CODGIU1", T_N, -1, 4);
add_field("06_OREGIU1", T_N, -1, 4);
add_field("06_CODGIU2", T_N, -1, 4);
add_field("06_OREGIU2", T_N, -1, 4);
add_field("06_CODGIU3", T_N, -1, 4);
add_field("06_OREGIU3", T_N, -1, 4);
add_field("06_CODGIU4", T_N, -1, 4);
add_field("06_OREGIU4", T_N, -1, 4);
add_field("06_CODGIU5", T_N, -1, 4);
add_field("06_OREGIU5", T_N, -1, 4);
add_field("06_CODGIU6", T_N, -1, 4);
add_field("06_OREGIU6", T_N, -1, 4);
add_field("07_OREORD", T_N, -1, 4);
add_field("07_CODGIU1", T_N, -1, 4);
add_field("07_OREGIU1", T_N, -1, 4);
add_field("07_CODGIU2", T_N, -1, 4);
add_field("07_OREGIU2", T_N, -1, 4);
add_field("07_CODGIU3", T_N, -1, 4);
add_field("07_OREGIU3", T_N, -1, 4);
add_field("07_CODGIU4", T_N, -1, 4);
add_field("07_OREGIU4", T_N, -1, 4);
add_field("07_CODGIU5", T_N, -1, 4);
add_field("07_OREGIU5", T_N, -1, 4);
add_field("07_CODGIU6", T_N, -1, 4);
add_field("07_OREGIU6", T_N, -1, 4);
add_field("08_OREORD", T_N, -1, 4);
add_field("08_CODGIU1", T_N, -1, 4);
add_field("08_OREGIU1", T_N, -1, 4);
add_field("08_CODGIU2", T_N, -1, 4);
add_field("08_OREGIU2", T_N, -1, 4);
add_field("08_CODGIU3", T_N, -1, 4);
add_field("08_OREGIU3", T_N, -1, 4);
add_field("08_CODGIU4", T_N, -1, 4);
add_field("08_OREGIU4", T_N, -1, 4);
add_field("08_CODGIU5", T_N, -1, 4);
add_field("08_OREGIU5", T_N, -1, 4);
add_field("08_CODGIU6", T_N, -1, 4);
add_field("08_OREGIU6", T_N, -1, 4);
add_field("09_OREORD", T_N, -1, 4);
add_field("09_CODGIU1", T_N, -1, 4);
add_field("09_OREGIU1", T_N, -1, 4);
add_field("09_CODGIU2", T_N, -1, 4);
add_field("09_OREGIU2", T_N, -1, 4);
add_field("09_CODGIU3", T_N, -1, 4);
add_field("09_OREGIU3", T_N, -1, 4);
add_field("09_CODGIU4", T_N, -1, 4);
add_field("09_OREGIU4", T_N, -1, 4);
add_field("09_CODGIU5", T_N, -1, 4);
add_field("09_OREGIU5", T_N, -1, 4);
add_field("09_CODGIU6", T_N, -1, 4);
add_field("09_OREGIU6", T_N, -1, 4);
add_field("10_OREORD", T_N, -1, 4);
add_field("10_CODGIU1", T_N, -1, 4);
add_field("10_OREGIU1", T_N, -1, 4);
add_field("10_CODGIU2", T_N, -1, 4);
add_field("10_OREGIU2", T_N, -1, 4);
add_field("10_CODGIU3", T_N, -1, 4);
add_field("10_OREGIU3", T_N, -1, 4);
add_field("10_CODGIU4", T_N, -1, 4);
add_field("10_OREGIU4", T_N, -1, 4);
add_field("10_CODGIU5", T_N, -1, 4);
add_field("10_OREGIU5", T_N, -1, 4);
add_field("10_CODGIU6", T_N, -1, 4);
add_field("10_OREGIU6", T_N, -1, 4);
add_field("11_OREORD", T_N, -1, 4);
add_field("11_CODGIU1", T_N, -1, 4);
add_field("11_OREGIU1", T_N, -1, 4);
add_field("11_CODGIU2", T_N, -1, 4);
add_field("11_OREGIU2", T_N, -1, 4);
add_field("11_CODGIU3", T_N, -1, 4);
add_field("11_OREGIU3", T_N, -1, 4);
add_field("11_CODGIU4", T_N, -1, 4);
add_field("11_OREGIU4", T_N, -1, 4);
add_field("11_CODGIU5", T_N, -1, 4);
add_field("11_OREGIU5", T_N, -1, 4);
add_field("11_CODGIU6", T_N, -1, 4);
add_field("11_OREGIU6", T_N, -1, 4);
add_field("12_OREORD", T_N, -1, 4);
add_field("12_CODGIU1", T_N, -1, 4);
add_field("12_OREGIU1", T_N, -1, 4);
add_field("12_CODGIU2", T_N, -1, 4);
add_field("12_OREGIU2", T_N, -1, 4);
add_field("12_CODGIU3", T_N, -1, 4);
add_field("12_OREGIU3", T_N, -1, 4);
add_field("12_CODGIU4", T_N, -1, 4);
add_field("12_OREGIU4", T_N, -1, 4);
add_field("12_CODGIU5", T_N, -1, 4);
add_field("12_OREGIU5", T_N, -1, 4);
add_field("12_CODGIU6", T_N, -1, 4);
add_field("12_OREGIU6", T_N, -1, 4);
add_field("13_OREORD", T_N, -1, 4);
add_field("13_CODGIU1", T_N, -1, 4);
add_field("13_OREGIU1", T_N, -1, 4);
add_field("13_CODGIU2", T_N, -1, 4);
add_field("13_OREGIU2", T_N, -1, 4);
add_field("13_CODGIU3", T_N, -1, 4);
add_field("13_OREGIU3", T_N, -1, 4);
add_field("13_CODGIU4", T_N, -1, 4);
add_field("13_OREGIU4", T_N, -1, 4);
add_field("13_CODGIU5", T_N, -1, 4);
add_field("13_OREGIU5", T_N, -1, 4);
add_field("13_CODGIU6", T_N, -1, 4);
add_field("13_OREGIU6", T_N, -1, 4);
add_field("14_OREORD", T_N, -1, 4);
add_field("14_CODGIU1", T_N, -1, 4);
add_field("14_OREGIU1", T_N, -1, 4);
add_field("14_CODGIU2", T_N, -1, 4);
add_field("14_OREGIU2", T_N, -1, 4);
add_field("14_CODGIU3", T_N, -1, 4);
add_field("14_OREGIU3", T_N, -1, 4);
add_field("14_CODGIU4", T_N, -1, 4);
add_field("14_OREGIU4", T_N, -1, 4);
add_field("14_CODGIU5", T_N, -1, 4);
add_field("14_OREGIU5", T_N, -1, 4);
add_field("14_CODGIU6", T_N, -1, 4);
add_field("14_OREGIU6", T_N, -1, 4);
add_field("15_OREORD", T_N, -1, 4);
add_field("15_CODGIU1", T_N, -1, 4);
add_field("15_OREGIU1", T_N, -1, 4);
add_field("15_CODGIU2", T_N, -1, 4);
add_field("15_OREGIU2", T_N, -1, 4);
add_field("15_CODGIU3", T_N, -1, 4);
add_field("15_OREGIU3", T_N, -1, 4);
add_field("15_CODGIU4", T_N, -1, 4);
add_field("15_OREGIU4", T_N, -1, 4);
add_field("15_CODGIU5", T_N, -1, 4);
add_field("15_OREGIU5", T_N, -1, 4);
add_field("15_CODGIU6", T_N, -1, 4);
add_field("15_OREGIU6", T_N, -1, 4);
add_field("16_OREORD", T_N, -1, 4);
add_field("16_CODGIU1", T_N, -1, 4);
add_field("16_OREGIU1", T_N, -1, 4);
add_field("16_CODGIU2", T_N, -1, 4);
add_field("16_OREGIU2", T_N, -1, 4);
add_field("16_CODGIU3", T_N, -1, 4);
add_field("16_OREGIU3", T_N, -1, 4);
add_field("16_CODGIU4", T_N, -1, 4);
add_field("16_OREGIU4", T_N, -1, 4);
add_field("16_CODGIU5", T_N, -1, 4);
add_field("16_OREGIU5", T_N, -1, 4);
add_field("16_CODGIU6", T_N, -1, 4);
add_field("16_OREGIU6", T_N, -1, 4);
add_field("17_OREORD", T_N, -1, 4);
add_field("17_CODGIU1", T_N, -1, 4);
add_field("17_OREGIU1", T_N, -1, 4);
add_field("17_CODGIU2", T_N, -1, 4);
add_field("17_OREGIU2", T_N, -1, 4);
add_field("17_CODGIU3", T_N, -1, 4);
add_field("17_OREGIU3", T_N, -1, 4);
add_field("17_CODGIU4", T_N, -1, 4);
add_field("17_OREGIU4", T_N, -1, 4);
add_field("17_CODGIU5", T_N, -1, 4);
add_field("17_OREGIU5", T_N, -1, 4);
add_field("17_CODGIU6", T_N, -1, 4);
add_field("17_OREGIU6", T_N, -1, 4);
add_field("18_OREORD", T_N, -1, 4);
add_field("18_CODGIU1", T_N, -1, 4);
add_field("18_OREGIU1", T_N, -1, 4);
add_field("18_CODGIU2", T_N, -1, 4);
add_field("18_OREGIU2", T_N, -1, 4);
add_field("18_CODGIU3", T_N, -1, 4);
add_field("18_OREGIU3", T_N, -1, 4);
add_field("18_CODGIU4", T_N, -1, 4);
add_field("18_OREGIU4", T_N, -1, 4);
add_field("18_CODGIU5", T_N, -1, 4);
add_field("18_OREGIU5", T_N, -1, 4);
add_field("18_CODGIU6", T_N, -1, 4);
add_field("18_OREGIU6", T_N, -1, 4);
add_field("19_OREORD", T_N, -1, 4);
add_field("19_CODGIU1", T_N, -1, 4);
add_field("19_OREGIU1", T_N, -1, 4);
add_field("19_CODGIU2", T_N, -1, 4);
add_field("19_OREGIU2", T_N, -1, 4);
add_field("19_CODGIU3", T_N, -1, 4);
add_field("19_OREGIU3", T_N, -1, 4);
add_field("19_CODGIU4", T_N, -1, 4);
add_field("19_OREGIU4", T_N, -1, 4);
add_field("19_CODGIU5", T_N, -1, 4);
add_field("19_OREGIU5", T_N, -1, 4);
add_field("19_CODGIU6", T_N, -1, 4);
add_field("19_OREGIU6", T_N, -1, 4);
add_field("20_OREORD", T_N, -1, 4);
add_field("20_CODGIU1", T_N, -1, 4);
add_field("20_OREGIU1", T_N, -1, 4);
add_field("20_CODGIU2", T_N, -1, 4);
add_field("20_OREGIU2", T_N, -1, 4);
add_field("20_CODGIU3", T_N, -1, 4);
add_field("20_OREGIU3", T_N, -1, 4);
add_field("20_CODGIU4", T_N, -1, 4);
add_field("20_OREGIU4", T_N, -1, 4);
add_field("20_CODGIU5", T_N, -1, 4);
add_field("20_OREGIU5", T_N, -1, 4);
add_field("20_CODGIU6", T_N, -1, 4);
add_field("20_OREGIU6", T_N, -1, 4);
add_field("21_OREORD", T_N, -1, 4);
add_field("21_CODGIU1", T_N, -1, 4);
add_field("21_OREGIU1", T_N, -1, 4);
add_field("21_CODGIU2", T_N, -1, 4);
add_field("21_OREGIU2", T_N, -1, 4);
add_field("21_CODGIU3", T_N, -1, 4);
add_field("21_OREGIU3", T_N, -1, 4);
add_field("21_CODGIU4", T_N, -1, 4);
add_field("21_OREGIU4", T_N, -1, 4);
add_field("21_CODGIU5", T_N, -1, 4);
add_field("21_OREGIU5", T_N, -1, 4);
add_field("21_CODGIU6", T_N, -1, 4);
add_field("21_OREGIU6", T_N, -1, 4);
add_field("22_OREORD", T_N, -1, 4);
add_field("22_CODGIU1", T_N, -1, 4);
add_field("22_OREGIU1", T_N, -1, 4);
add_field("22_CODGIU2", T_N, -1, 4);
add_field("22_OREGIU2", T_N, -1, 4);
add_field("22_CODGIU3", T_N, -1, 4);
add_field("22_OREGIU3", T_N, -1, 4);
add_field("22_CODGIU4", T_N, -1, 4);
add_field("22_OREGIU4", T_N, -1, 4);
add_field("22_CODGIU5", T_N, -1, 4);
add_field("22_OREGIU5", T_N, -1, 4);
add_field("22_CODGIU6", T_N, -1, 4);
add_field("22_OREGIU6", T_N, -1, 4);
add_field("23_OREORD", T_N, -1, 4);
add_field("23_CODGIU1", T_N, -1, 4);
add_field("23_OREGIU1", T_N, -1, 4);
add_field("23_CODGIU2", T_N, -1, 4);
add_field("23_OREGIU2", T_N, -1, 4);
add_field("23_CODGIU3", T_N, -1, 4);
add_field("23_OREGIU3", T_N, -1, 4);
add_field("23_CODGIU4", T_N, -1, 4);
add_field("23_OREGIU4", T_N, -1, 4);
add_field("23_CODGIU5", T_N, -1, 4);
add_field("23_OREGIU5", T_N, -1, 4);
add_field("23_CODGIU6", T_N, -1, 4);
add_field("23_OREGIU6", T_N, -1, 4);
add_field("24_OREORD", T_N, -1, 4);
add_field("24_CODGIU1", T_N, -1, 4);
add_field("24_OREGIU1", T_N, -1, 4);
add_field("24_CODGIU2", T_N, -1, 4);
add_field("24_OREGIU2", T_N, -1, 4);
add_field("24_CODGIU3", T_N, -1, 4);
add_field("24_OREGIU3", T_N, -1, 4);
add_field("24_CODGIU4", T_N, -1, 4);
add_field("24_OREGIU4", T_N, -1, 4);
add_field("24_CODGIU5", T_N, -1, 4);
add_field("24_OREGIU5", T_N, -1, 4);
add_field("24_CODGIU6", T_N, -1, 4);
add_field("24_OREGIU6", T_N, -1, 4);
add_field("25_OREORD", T_N, -1, 4);
add_field("25_CODGIU1", T_N, -1, 4);
add_field("25_OREGIU1", T_N, -1, 4);
add_field("25_CODGIU2", T_N, -1, 4);
add_field("25_OREGIU2", T_N, -1, 4);
add_field("25_CODGIU3", T_N, -1, 4);
add_field("25_OREGIU3", T_N, -1, 4);
add_field("25_CODGIU4", T_N, -1, 4);
add_field("25_OREGIU4", T_N, -1, 4);
add_field("25_CODGIU5", T_N, -1, 4);
add_field("25_OREGIU5", T_N, -1, 4);
add_field("25_CODGIU6", T_N, -1, 4);
add_field("25_OREGIU6", T_N, -1, 4);
add_field("26_OREORD", T_N, -1, 4);
add_field("26_CODGIU1", T_N, -1, 4);
add_field("26_OREGIU1", T_N, -1, 4);
add_field("26_CODGIU2", T_N, -1, 4);
add_field("26_OREGIU2", T_N, -1, 4);
add_field("26_CODGIU3", T_N, -1, 4);
add_field("26_OREGIU3", T_N, -1, 4);
add_field("26_CODGIU4", T_N, -1, 4);
add_field("26_OREGIU4", T_N, -1, 4);
add_field("26_CODGIU5", T_N, -1, 4);
add_field("26_OREGIU5", T_N, -1, 4);
add_field("26_CODGIU6", T_N, -1, 4);
add_field("26_OREGIU6", T_N, -1, 4);
add_field("27_OREORD", T_N, -1, 4);
add_field("27_CODGIU1", T_N, -1, 4);
add_field("27_OREGIU1", T_N, -1, 4);
add_field("27_CODGIU2", T_N, -1, 4);
add_field("27_OREGIU2", T_N, -1, 4);
add_field("27_CODGIU3", T_N, -1, 4);
add_field("27_OREGIU3", T_N, -1, 4);
add_field("27_CODGIU4", T_N, -1, 4);
add_field("27_OREGIU4", T_N, -1, 4);
add_field("27_CODGIU5", T_N, -1, 4);
add_field("27_OREGIU5", T_N, -1, 4);
add_field("27_CODGIU6", T_N, -1, 4);
add_field("27_OREGIU6", T_N, -1, 4);
add_field("28_OREORD", T_N, -1, 4);
add_field("28_CODGIU1", T_N, -1, 4);
add_field("28_OREGIU1", T_N, -1, 4);
add_field("28_CODGIU2", T_N, -1, 4);
add_field("28_OREGIU2", T_N, -1, 4);
add_field("28_CODGIU3", T_N, -1, 4);
add_field("28_OREGIU3", T_N, -1, 4);
add_field("28_CODGIU4", T_N, -1, 4);
add_field("28_OREGIU4", T_N, -1, 4);
add_field("28_CODGIU5", T_N, -1, 4);
add_field("28_OREGIU5", T_N, -1, 4);
add_field("28_CODGIU6", T_N, -1, 4);
add_field("28_OREGIU6", T_N, -1, 4);
add_field("29_OREORD", T_N, -1, 4);
add_field("29_CODGIU1", T_N, -1, 4);
add_field("29_OREGIU1", T_N, -1, 4);
add_field("29_CODGIU2", T_N, -1, 4);
add_field("29_OREGIU2", T_N, -1, 4);
add_field("29_CODGIU3", T_N, -1, 4);
add_field("29_OREGIU3", T_N, -1, 4);
add_field("29_CODGIU4", T_N, -1, 4);
add_field("29_OREGIU4", T_N, -1, 4);
add_field("29_CODGIU5", T_N, -1, 4);
add_field("29_OREGIU5", T_N, -1, 4);
add_field("29_CODGIU6", T_N, -1, 4);
add_field("29_OREGIU6", T_N, -1, 4);
add_field("30_OREORD", T_N, -1, 4);
add_field("30_CODGIU1", T_N, -1, 4);
add_field("30_OREGIU1", T_N, -1, 4);
add_field("30_CODGIU2", T_N, -1, 4);
add_field("30_OREGIU2", T_N, -1, 4);
add_field("30_CODGIU3", T_N, -1, 4);
add_field("30_OREGIU3", T_N, -1, 4);
add_field("30_CODGIU4", T_N, -1, 4);
add_field("30_OREGIU4", T_N, -1, 4);
add_field("30_CODGIU5", T_N, -1, 4);
add_field("30_OREGIU5", T_N, -1, 4);
add_field("30_CODGIU6", T_N, -1, 4);
add_field("30_OREGIU6", T_N, -1, 4);
add_field("31_OREORD", T_N, -1, 4);
add_field("31_CODGIU1", T_N, -1, 4);
add_field("31_OREGIU1", T_N, -1, 4);
add_field("31_CODGIU2", T_N, -1, 4);
add_field("31_OREGIU2", T_N, -1, 4);
add_field("31_CODGIU3", T_N, -1, 4);
add_field("31_OREGIU3", T_N, -1, 4);
add_field("31_CODGIU4", T_N, -1, 4);
add_field("31_OREGIU4", T_N, -1, 4);
add_field("31_CODGIU5", T_N, -1, 4);
add_field("31_OREGIU5", T_N, -1, 4);
add_field("31_CODGIU6", T_N, -1, 4);
add_field("31_OREGIU6", T_N, -1, 4);
TText_recordset::load_file(filename);
}
////////////////////////////////////////////
//// CLASSE TImporta_rilore_msk ////
////////////////////////////////////////////
//Classe TRilevamento_imp_msk
class TImporta_rilore_msk : public TAutomask
{
protected:
const real proponi_costo(TToken_string& riga);
void importa();
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TImporta_rilore_msk();
};
const real TImporta_rilore_msk::proponi_costo(TToken_string& riga)
{
/*real costo = ZERO;
TSheet_field& sheet = sfield(F_SHEET);
const char tipo = riga.get_char(sheet.cid2index(S_RISOATT));
TString80 codice;
switch(tipo)
{
case 'R': codice = riga.get(sheet.cid2index(S_CODRIS)); break;
case 'A': codice = riga.get(sheet.cid2index(S_CODATT)); break;
default : break;
}
const int anno = get_int(F_ANNO);
const TString4 mese = get(F_MESE);
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
const TRisoatt_key chiave(tipo, codice, anno, mese, tpora);
const TRectype & roa = cache().get("&ROA", chiave);
if(!roa.empty())
costo = roa.get_real("R1");
else
{
TString8 tmp; tmp << anno << mese;
const long anme = atol(tmp);
TString query;
query << "USE &ROA\n"
<< "SELECT I0<" << anme << "\n"
<< "FROM CODTAB=" << tipo << codice.left_just(16) << "\n"
<< "TO CODTAB=" << tipo << codice.left_just(16) << "\n"
<< "BY I0\n";
TISAM_recordset rec(query);
if(rec.move_last())
costo = rec.cursor()->curr().get_real("R1");
}
return costo;*/
return ZERO;
}
void TImporta_rilore_msk::importa()
{
TFilename file = get(F_FILE);
TImporta_rilore_rec recordset(file);
TLocalisamfile rilore(LF_RILORE);
TString8 data = recordset.get("DADATA").as_string();
TString4 anno = "20"; anno << data.right(2);
const TDate dadata(atoi(data.left(2)), atoi(data.mid(2, 2)), atoi(anno));
data = recordset.get("ADATA").as_string();
anno = "20"; anno << data.right(2);
const TDate adata(atoi(data.left(2)), atoi(data.mid(2, 2)), atoi(anno));
for(int i = 1; i <= 31; i++)
{
int tmp = i - 1;
TDate dt = dadata + tmp;
if(dt <= adata)
{
rilore.put(RILORE_TIPO, 'C');
rilore.put(RILORE_TIPORA, 'A');
rilore.put(RILORE_CODICE, recordset.get("MATR").as_string());
rilore.put(RILORE_ANNO, dt.year());
rilore.put(RILORE_MESE, dt.month());
rilore.put(RILORE_GIORNO, dt.day());
TString4 giorno;
if(i < 10)
giorno << '0';
giorno << i;
TString16 campo = giorno; campo << "_OREORD";
const int oreord = recordset.get(campo).as_int();
rilore.put(RILORE_TPORA, 1); //ore ordinarie, da decodificare
rilore.put(RILORE_QTAORE, oreord);
rilore.rewrite_write();
for(int j = 1; j <= 6; j++)
{
rilore.put(RILORE_TIPO, 'C');
rilore.put(RILORE_TIPORA, 'A');
rilore.put(RILORE_CODICE, recordset.get("MATR").as_string());
rilore.put(RILORE_ANNO, dt.year());
rilore.put(RILORE_MESE, dt.month());
rilore.put(RILORE_GIORNO, dt.day());
campo.cut(0);
campo << giorno << "_CODGIU" << j;
const int codgiu = recordset.get(campo).as_int();
campo.cut(0);
campo << giorno << "_OREGIU" << j;
const int oregiu = recordset.get(campo).as_int();
if(oregiu > 0)
{
rilore.put(RILORE_TPORA, codgiu);
rilore.put(RILORE_QTAORE, oregiu);
rilore.rewrite_write();
}
}
}
}
}
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
bool TImporta_rilore_msk::on_field_event(TOperable_field& f, TField_event e, long jolly)
{
switch (f.dlg())
{
case DLG_OK:
{
if(e == fe_button)
{
importa();
return false;
break;
}
}
default: break;
}
return true;
}
TImporta_rilore_msk::TImporta_rilore_msk()
: TAutomask("ci2300a")
{
}
////////////////////////////////////////////
//// CLASSE TRilevamento_imp_app ////
////////////////////////////////////////////
//classe TRilevamento_imp_app
class TImporta_rilore__app : public TSkeleton_application
{
public:
virtual void main_loop();
};
void TImporta_rilore__app::main_loop()
{
TImporta_rilore_msk msk;
while (msk.run() != K_QUIT) ;
}
int ci2300(int argc, char *argv[])
{
TImporta_rilore__app a;
a.run (argc, argv, TR("Importazione Ore"));
return TRUE;
}