92 lines
1.8 KiB
C++
92 lines
1.8 KiB
C++
|
#include "fplib.h"
|
||
|
#include <fpcust.h>
|
||
|
#include <fpccaus.h>
|
||
|
#include <fpcart.h>
|
||
|
#include <fpcadg.h>
|
||
|
|
||
|
|
||
|
void TFP_custom::init()
|
||
|
{
|
||
|
add_file(LF_FPCCAUS, FPCCAUS_NRIGA);
|
||
|
add_file(LF_FPCART, FPCART_NRIGA);
|
||
|
add_file(LF_FPCADG, FPCADG_NRIGA);
|
||
|
}
|
||
|
|
||
|
int TFP_custom::write_rewrite(TBaseisamfile& f, bool re) const
|
||
|
{
|
||
|
return TMultiple_rectype::write_rewrite(f, re);
|
||
|
}
|
||
|
|
||
|
bool TFP_custom::load(const char* codcust)
|
||
|
{
|
||
|
// Metto il codice nel rectype principale ed effettuo una read
|
||
|
put(FPCUST_CODICE, codcust);
|
||
|
|
||
|
return _loaded = TMultiple_rectype::read() == NOERR;
|
||
|
}
|
||
|
|
||
|
void TFP_custom::autoload(const TSheet_field& sf, const int file) const
|
||
|
{
|
||
|
switch(file)
|
||
|
{
|
||
|
case LF_FPCCAUS:
|
||
|
{
|
||
|
TRecord_array& rcaus = body(file);
|
||
|
rcaus.destroy_rows();
|
||
|
FOR_EACH_SHEET_ROW(sf, r, row)
|
||
|
{
|
||
|
TRectype& rec_row = rcaus.row(-1, true);
|
||
|
rec_row.put(FPCCAUS_VALORE, row->get(0));
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
|
case LF_FPCART:
|
||
|
{
|
||
|
TRecord_array& rart = body(file);
|
||
|
rart.destroy_rows();
|
||
|
FOR_EACH_SHEET_ROW(sf, r, row)
|
||
|
{
|
||
|
TRectype& rec_row = rart.row(-1, true);
|
||
|
rec_row.put(FPCART_TIPO, row->get(0));
|
||
|
rec_row.put(FPCART_VALORE, row->get());
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
|
case LF_FPCADG:
|
||
|
{
|
||
|
TRecord_array& radg = body(file);
|
||
|
radg.destroy_rows();
|
||
|
FOR_EACH_SHEET_ROW(sf, r, row)
|
||
|
{
|
||
|
TRectype& rec_row = radg.row(-1, true);
|
||
|
rec_row.put(FPCADG_TIPODATO, row->get(0));
|
||
|
rec_row.put(FPCADG_RTESTO, row->get());
|
||
|
rec_row.put(FPCADG_RNUMERO, row->get());
|
||
|
rec_row.put(FPCADG_RDATA, row->get());
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
|
default:
|
||
|
fatal_box("File non riconosciuto %d", file);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
TFP_custom::TFP_custom() : TMultiple_rectype(LF_FPCUST), _codcust(""), _loaded(false)
|
||
|
{
|
||
|
init();
|
||
|
}
|
||
|
|
||
|
TFP_custom::TFP_custom(const TRectype& rec) : TMultiple_rectype(rec)
|
||
|
{
|
||
|
_codcust = get(FPCUST_CODICE);
|
||
|
_loaded = _codcust.full();
|
||
|
init();
|
||
|
}
|
||
|
|
||
|
TFP_custom::TFP_custom(const char* codcust) : TFP_custom()
|
||
|
{
|
||
|
init();
|
||
|
load(codcust);
|
||
|
}
|