2c5a56cf7e
Files correlati : ci0.exe ci2.exe Ricompilazione Demo : [ ] Commento : Corretta rilevazione ore git-svn-id: svn://10.65.10.50/branches/R_10_00@22268 c028cbd2-c16b-5b4b-a496-9718f37d4682
720 lines
19 KiB
C++
Executable File
720 lines
19 KiB
C++
Executable File
#include <applicat.h>
|
||
#include <automask.h>
|
||
#include <defmask.h>
|
||
#include <lffiles.h>
|
||
#include <recset.h>
|
||
#include <sheet.h>
|
||
#include <utility.h>
|
||
|
||
#include <doc.h>
|
||
|
||
#include "ci0.h"
|
||
#include "cilib.h"
|
||
#include "ci0600a.h"
|
||
#include "rilore.h"
|
||
#include "../ca/calib01.h"
|
||
#include "../ve/velib.h"
|
||
|
||
////////////////////////////////////////
|
||
//// CLASSE TDef_risoatt_msk ////
|
||
////////////////////////////////////////
|
||
|
||
//Classe TDef_risoatt_msk
|
||
class TDef_risoatt_msk : public TAutomask
|
||
{
|
||
short _cdc_sid, _cdc_lid;
|
||
short _cms_sid, _cms_lid;
|
||
short _fase_sid, _fase_lid;
|
||
short _scdc_sid, _scdc_lid;
|
||
short _scms_sid, _scms_lid;
|
||
short _sfase_sid, _sfase_lid;
|
||
TString _dett;
|
||
|
||
protected:
|
||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||
|
||
void get_anal_fields(TString& cdc, TString& cms, TString& fase);
|
||
void get_row_anal_fields(TToken_string& row, TString& cdc, TString& cms, TString& fase);
|
||
void put_row_anal_fields(TToken_string& row, const TString& cdc, const TString& cms, const TString& fase);
|
||
void riempi_sheet();
|
||
void nuova_riga();
|
||
void azzera_riga(TSheet_field& sheet);
|
||
void azzera_tutto(TSheet_field& sheet);
|
||
void registra();
|
||
|
||
public:
|
||
void esegui() const;
|
||
TDef_risoatt_msk();
|
||
};
|
||
|
||
void TDef_risoatt_msk::get_anal_fields(TString& cdc, TString& cms, TString& fase)
|
||
{
|
||
TString val;
|
||
|
||
cdc.cut(0);
|
||
if (_cdc_sid >= 0)
|
||
for ( short id = _cdc_sid; id <= _cdc_lid; id++)
|
||
{
|
||
val = get(id);
|
||
val.rpad(field(id).size());
|
||
cdc << val;
|
||
}
|
||
cdc.trim();
|
||
cms.cut(0);
|
||
if (_cms_sid >= 0)
|
||
for ( short id = _cms_sid; id <= _cms_lid; id++)
|
||
{
|
||
val = get(id);
|
||
val.rpad(field(id).size());
|
||
cms << val;
|
||
}
|
||
cms.trim();
|
||
fase.cut(0);
|
||
if (_fase_sid >= 0)
|
||
for ( short id = _fase_sid; id <= _fase_lid; id++)
|
||
{
|
||
val = get(id);
|
||
val.rpad(field(id).size());
|
||
fase << val;
|
||
}
|
||
fase.trim();
|
||
}
|
||
|
||
void TDef_risoatt_msk::get_row_anal_fields(TToken_string & row, TString & cdc, TString & cms, TString & fase)
|
||
{
|
||
TSheet_field & s = sfield(F_SHEET);
|
||
TMask & m = s.sheet_mask();
|
||
TString val;
|
||
|
||
cdc.cut(0);
|
||
if (_scdc_sid >= 0)
|
||
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
|
||
{
|
||
val = row.get(s.cid2index(id));
|
||
val.rpad(m.field(id).size());
|
||
cdc << val;
|
||
}
|
||
cdc.trim();
|
||
cms.cut(0);
|
||
if (_scms_sid >= 0)
|
||
for ( short id = _scms_sid; id <= _scms_lid; id++)
|
||
{
|
||
val = row.get(s.cid2index(id));
|
||
val.rpad(m.field(id).size());
|
||
cms << val;
|
||
}
|
||
cms.trim();
|
||
fase.cut(0);
|
||
if (_sfase_sid >= 0)
|
||
for ( short id = _sfase_sid; id <= _sfase_lid; id++)
|
||
{
|
||
val = row.get(s.cid2index(id));
|
||
val.rpad(m.field(id).size());
|
||
fase << val;
|
||
}
|
||
fase.trim();
|
||
}
|
||
|
||
void TDef_risoatt_msk::put_row_anal_fields(TToken_string & row, const TString & cdc, const TString & cms, const TString & fase)
|
||
{
|
||
TSheet_field & s = sfield(F_SHEET);
|
||
TMask & m = s.sheet_mask();
|
||
int pos = 0;
|
||
|
||
if (_scdc_sid >= 0)
|
||
for (short id = _scdc_sid; id <= _scdc_lid; id++)
|
||
{
|
||
const int len = m.field(id).size();
|
||
row.add(cdc.mid(pos, len), s.cid2index(id));
|
||
pos += len;
|
||
}
|
||
pos = 0;
|
||
if (_scms_sid >= 0)
|
||
for (short id = _scms_sid; id <= _scms_lid; id++)
|
||
{
|
||
const int len = m.field(id).size();
|
||
row.add(cms.mid(pos, len), s.cid2index(id));
|
||
pos += len;
|
||
}
|
||
pos = 0;
|
||
if (_sfase_sid >= 0)
|
||
for (short id = _sfase_sid; id <= _sfase_lid; id++)
|
||
{
|
||
const int len = m.field(id).size();
|
||
row.add(fase.mid(pos, len), s.cid2index(id));
|
||
pos += len;
|
||
}
|
||
}
|
||
|
||
//RIEMPI_SHEET: metodo che riempie lo sheet in base ai campi chiave
|
||
//compilati sulla maschera
|
||
void TDef_risoatt_msk::riempi_sheet()
|
||
{
|
||
TSheet_field& sheet = sfield(F_SHEET);
|
||
|
||
if (sheet.items() > 0 && sheet.dirty() && yesno_box("Vuoi salvare le modifiche"))
|
||
registra();
|
||
sheet.destroy();
|
||
|
||
//leggo dalla maschera i campi chiave di ricerca
|
||
const int anno = get_int(F_ANNO);
|
||
const TString4 risoatt = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
|
||
const int mese = get_int(F_MESE);
|
||
const TString4 tpora = get(F_TPORA);
|
||
TString80 codcosto;
|
||
TString80 codcms;
|
||
TString16 codfase;
|
||
TString16 codice;
|
||
|
||
switch(get(F_RISOATT)[0])
|
||
{
|
||
case 'R': codice = get(F_CODRIS); break;
|
||
case 'A': codice = get(F_CODATT); break;
|
||
default: break;
|
||
}
|
||
get_anal_fields(codcosto, codcms, codfase);
|
||
|
||
TString query;
|
||
|
||
query << "USE " << LF_RILORE << " KEY 2\n" ;
|
||
|
||
TString select;
|
||
if (risoatt.full())
|
||
select << "(" << RILORE_TIPORA << "==\"" << risoatt << "\")";
|
||
if (codice.full())
|
||
{
|
||
if (select.full()) select << "&&";
|
||
select << "(" << RILORE_CODICE << "==\"" << codice << "\")";
|
||
}
|
||
if (tpora.full())
|
||
{
|
||
if (select.full()) select << "&&";
|
||
select << "(" << RILORE_TPORA << "==\"" << tpora << "\")";
|
||
}
|
||
if (codcosto.full())
|
||
{
|
||
if (select.full()) select << "&&";
|
||
select << "(" << RILORE_CODCOSTO << "==\"" << codcosto << "\")";
|
||
}
|
||
if (codcms.full())
|
||
{
|
||
if (select.full()) select << "&&";
|
||
select << "(" << RILORE_CODCMS << "==\"" << codcms << "\")";
|
||
}
|
||
if (codfase.full())
|
||
{
|
||
if (select.full()) select << "&&";
|
||
select << "(" << RILORE_CODFASE << "==\"" << codfase << "\")";
|
||
}
|
||
if (select.full())
|
||
query << "SELECT " << select << "\n";
|
||
|
||
TString from = RILORE_TIPO "=\"D\"";
|
||
TString to = from;
|
||
TDate da(botime);
|
||
TDate a(eotime);
|
||
|
||
if (anno > 0)
|
||
{
|
||
da.set_day(1);
|
||
da.set_month(1);
|
||
da.set_year(anno);
|
||
a.set_year(anno);
|
||
if (mese > 0)
|
||
{
|
||
da.set_month(mese);
|
||
a.set_month(mese);
|
||
}
|
||
a.set_end_month();
|
||
}
|
||
from << " " << RILORE_DADATA << "=" << da.string() << " ";
|
||
to << " " << RILORE_DADATA << "=" << a.string() << " ";
|
||
|
||
query << "FROM " << from << "\n"
|
||
<< "TO " << to;
|
||
|
||
TISAM_recordset def(query);
|
||
|
||
|
||
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
|
||
for(bool ok = def.move_first(); ok; ok = def.move_next())
|
||
{
|
||
TRilevamento_ore rilore(def.cursor()->curr());
|
||
TToken_string& riga = sheet.row(-1);
|
||
const char tipo = rilore.get(RILORE_TIPORA)[0];
|
||
TString16 cod = rilore.get(RILORE_CODICE);
|
||
|
||
riga.add(tipo, sheet.cid2index(S_RISOATT));
|
||
switch(tipo)
|
||
{
|
||
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
|
||
case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
|
||
default : break;
|
||
}
|
||
TDate d(rilore.get_date(RILORE_DADATA));
|
||
|
||
riga.add(d.string(), sheet.cid2index(S_DATA));
|
||
riga.add(rilore.get(RILORE_TPORA), sheet.cid2index(S_TPORA));
|
||
put_row_anal_fields(riga, rilore.get(RILORE_CODCOSTO), rilore.get(RILORE_CODCMS), rilore.get(RILORE_CODFASE));
|
||
riga.add(rilore.get(RILORE_QTAORE), sheet.cid2index(S_QTAORE));
|
||
riga.add(rilore.get(RILORE_COSTO), sheet.cid2index(S_COSTO));
|
||
riga.add(rilore.get(RILORE_ID), sheet.cid2index(S_ID));
|
||
sheet.check_row(sheet.items() - 1);
|
||
}
|
||
sheet.force_update();
|
||
}
|
||
|
||
//NUOVA_RIGA: metodo che aggiunge una riga allo sheet
|
||
//tenendo conto dei campi chiave compilati in testata
|
||
void TDef_risoatt_msk::nuova_riga()
|
||
{
|
||
TSheet_field& sheet = sfield(F_SHEET);
|
||
TToken_string & riga = sheet.row(-1);
|
||
const int r = sheet.items() - 1;
|
||
sheet.select(r);
|
||
TMask& msk = sheet.sheet_mask();
|
||
|
||
//guardo il tipo risorsa / attrezzatura che sto ricercando
|
||
const bool tutti = get(F_RISOATT)[0] == 'T';
|
||
const TString4 tipo = tutti ? "R" : get(F_RISOATT);
|
||
TString codice;
|
||
int mese = get_int(F_MESE);
|
||
int anno = get_int(F_ANNO);
|
||
TString tpora = get(F_TPORA);
|
||
TString codcosto;
|
||
TString codcms;
|
||
TString codfase;
|
||
|
||
riga.add(tipo, sheet.cid2index(S_RISOATT));
|
||
if (!tutti)
|
||
{
|
||
if (tipo == "R")
|
||
riga.add(get(F_CODRIS), sheet.cid2index(S_CODRIS));
|
||
else
|
||
riga.add(get(F_CODATT), sheet.cid2index(S_CODATT));
|
||
}
|
||
|
||
TDate data;
|
||
|
||
if (anno == 0)
|
||
data = TDate(TODAY);
|
||
else
|
||
{
|
||
data.set_day(1);
|
||
data.set_month(mese == 0 ? 1 : mese);
|
||
data.set_year(anno);
|
||
}
|
||
riga.add(data.string(), sheet.cid2index(S_DATA));
|
||
riga.add(tpora, sheet.cid2index(S_TPORA));
|
||
get_anal_fields(codcosto, codcms, codfase);
|
||
put_row_anal_fields(riga, codcosto, codcms, codfase);
|
||
sheet.update_mask(r);
|
||
msk.enable(S_RISOATT, tutti);
|
||
if (tutti || tipo == "R")
|
||
msk.enable(S_CODRIS);
|
||
if (tutti || tipo == "A")
|
||
msk.enable(S_CODATT);
|
||
msk.enable(S_TPORA, tpora.empty());
|
||
if (_scdc_sid >= 0)
|
||
for ( short id = _scdc_sid; id <= _scdc_lid; id++)
|
||
msk.enable(id, codcosto.blank());
|
||
if (_scms_sid >= 0)
|
||
for ( short id = _scms_sid; id <= _scms_lid; id++)
|
||
msk.enable(id, codcms.blank());
|
||
if (_sfase_sid >= 0)
|
||
for ( short id = _sfase_sid; id <= _sfase_lid; id++)
|
||
msk.enable(id, codfase.blank());
|
||
|
||
//lancio la maschera di riga da compilare
|
||
if (msk.run() == K_ENTER)
|
||
sheet.update_row(r);
|
||
else
|
||
sheet.destroy(r);
|
||
msk.enable_default();
|
||
sheet.force_update();
|
||
}
|
||
|
||
//AZZERA_RIGA: metodo che azzera il valore unitario della riga selezionata
|
||
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
|
||
void TDef_risoatt_msk::azzera_riga(TSheet_field& sheet)
|
||
{
|
||
const int nriga = sheet.selected();
|
||
TToken_string& row = sheet.row(nriga);
|
||
|
||
TMask& msk = sheet.sheet_mask();
|
||
msk.set(S_DEL, "X");
|
||
}
|
||
|
||
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
|
||
//(N.B.: le righe con valore unitario nullo verranno eliminate in fase di registrazione)
|
||
void TDef_risoatt_msk::azzera_tutto(TSheet_field& sheet)
|
||
{
|
||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||
{
|
||
TToken_string& row = sheet.row(r);
|
||
row.add("X", sheet.cid2index(S_DEL));
|
||
}
|
||
}
|
||
|
||
//REGISTRA: metodo che salva nella tabella di modulo le
|
||
//righe dello sheet che hanno valore > 0, ed elimina quelle che hanno
|
||
//vaoler pari a zero, e poi ricarica lo sheet
|
||
void TDef_risoatt_msk::registra()
|
||
{
|
||
TRilevamento_ore rilroa;
|
||
TSheet_field& sheet = sfield(F_SHEET);
|
||
int err = NOERR;
|
||
|
||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||
{
|
||
TToken_string& riga = *(TToken_string*)row;
|
||
const TString4 del = riga.get(sheet.cid2index(S_DEL));
|
||
const char tipora = riga.get_char(sheet.cid2index(S_RISOATT));
|
||
const TString16 codice = tipora == 'R' ? riga.get(sheet.cid2index(S_CODRIS)) : riga.get(sheet.cid2index(S_CODATT));
|
||
TDate d(riga.get(sheet.cid2index(S_DATA)));
|
||
const int anno = d.year();
|
||
const int mese = d.month();
|
||
const int giorno = d.day();
|
||
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
|
||
const long id = riga.get_long(sheet.cid2index(S_ID));
|
||
TString80 codcosto;
|
||
TString80 codcms;
|
||
TString80 codfase;
|
||
const real qtaore(riga.get(sheet.cid2index(S_QTAORE)));
|
||
const real costo(riga.get(sheet.cid2index(S_COSTO)));
|
||
|
||
get_row_anal_fields(riga, codcosto, codcms, codfase);
|
||
|
||
rilroa.read('D', id);
|
||
if (del == "X")
|
||
err = rilroa.remove();
|
||
else
|
||
{
|
||
rilroa.put(RILORE_TIPO, "D");
|
||
rilroa.put(RILORE_ID, id);
|
||
TDate d(giorno, mese, anno);
|
||
rilroa.put(RILORE_DADATA, d);
|
||
rilroa.put(RILORE_TIPORA, tipora);
|
||
rilroa.put(RILORE_CODICE, codice);
|
||
rilroa.put(RILORE_TPORA, tpora);
|
||
rilroa.put(RILORE_CODCOSTO, codcosto);
|
||
rilroa.put(RILORE_CODCMS, codcms);
|
||
rilroa.put(RILORE_CODFASE, codfase);
|
||
rilroa.put(RILORE_QTAORE, qtaore);
|
||
rilroa.put(RILORE_COSTO, costo);
|
||
err = rilroa.rewrite_write();
|
||
}
|
||
if (err != NOERR)
|
||
break;
|
||
}
|
||
if (err == NOERR)
|
||
{
|
||
sheet.destroy();
|
||
riempi_sheet();
|
||
}
|
||
else
|
||
error_box(FR("Errore %d in scrittura"), err);
|
||
}
|
||
|
||
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
|
||
bool TDef_risoatt_msk::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||
{
|
||
if (e == fe_modify && f.dlg() >= F_ANAL && f.dlg() < F_ANAL+12)
|
||
riempi_sheet();
|
||
switch (f.dlg())
|
||
{
|
||
case DLG_CERCA:
|
||
if (e == fe_button)
|
||
{
|
||
riempi_sheet();
|
||
return false;
|
||
}
|
||
case DLG_NEWREC:
|
||
if (e == fe_button)
|
||
{
|
||
nuova_riga();
|
||
return false;
|
||
}
|
||
case DLG_SAVEREC:
|
||
if (e == fe_button)
|
||
{
|
||
registra();
|
||
return false;
|
||
}
|
||
break;
|
||
case DLG_RESET:
|
||
if(e == fe_button)
|
||
{
|
||
TSheet_field& sheet = sfield(F_SHEET);
|
||
switch(jolly)
|
||
{
|
||
case 0: azzera_tutto(sheet); break;
|
||
case 1: azzera_riga(sheet); break;
|
||
default: break;
|
||
}
|
||
sheet.force_update();
|
||
return false;
|
||
}
|
||
break;
|
||
case DLG_CANCEL:
|
||
if(e == fe_button && jolly == 1)
|
||
{
|
||
TSheet_field& sheet = sfield(F_SHEET);
|
||
TMask& msk = sheet.sheet_mask();
|
||
|
||
if (sheet.selected() == sheet.items() - 1)
|
||
{
|
||
sheet.destroy(sheet.items() - 1);
|
||
sheet.force_update();
|
||
}
|
||
}
|
||
break;
|
||
case F_ANNO:
|
||
case F_MESE:
|
||
case F_RISOATT:
|
||
case F_CODRIS:
|
||
case F_CODATT:
|
||
case F_TPORA:
|
||
if (e == fe_modify)
|
||
riempi_sheet();
|
||
break;
|
||
case F_SHEET:
|
||
if (e == se_query_add)
|
||
{
|
||
send_key(K_SPACE, DLG_NEWREC);
|
||
return false;
|
||
}
|
||
case S_DATA:
|
||
if (e == fe_modify)
|
||
{
|
||
TDate d(f.get());
|
||
TSheet_field& sheet = sfield(F_SHEET);
|
||
|
||
if (_dett == "A")
|
||
d.set_month(1);
|
||
d.set_day(1);
|
||
f.set(d.string());
|
||
}
|
||
else
|
||
if (e == se_leave)
|
||
{
|
||
TSheet_field& sheet = sfield(F_SHEET);
|
||
TToken_string & curr_row = sheet.row(jolly);
|
||
TDate d(curr_row.get(sheet.cid2index(S_DATA)));
|
||
TString80 codcosto;
|
||
TString80 codcms;
|
||
TString80 codfase;
|
||
const TString4 tipo = curr_row.get(sheet.cid2index(S_RISOATT));
|
||
const bool risorsa = tipo == "R";
|
||
const short idcod = risorsa ? S_CODRIS : S_CODATT;
|
||
|
||
get_row_anal_fields(curr_row, codcosto, codcms, codfase);
|
||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||
{
|
||
if (r != jolly && tipo == row->get(sheet.cid2index(S_RISOATT)))
|
||
{
|
||
const TString cod = curr_row.get(sheet.cid2index(idcod));
|
||
if ( cod == row->get(sheet.cid2index(idcod)))
|
||
{
|
||
TString tpora = curr_row.get(sheet.cid2index(S_TPORA));
|
||
|
||
if ( tpora == row->get(sheet.cid2index(S_TPORA)))
|
||
{
|
||
TString80 codcostor;
|
||
TString80 codcmsr;
|
||
TString80 codfaser;
|
||
|
||
get_row_anal_fields(*row, codcostor, codcmsr, codfaser);
|
||
if (codcostor == codcosto && codcmsr == codcms && codfaser == codfase)
|
||
{
|
||
TDate dr(row->get(sheet.cid2index(S_DATA)));
|
||
if (dr == d)
|
||
return error_box(FR("La risorsa %s alla data %s esiste gi<67> alla riga %d"), (const char *)cod,(const char *) d.string(), r + 1);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
default: break;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
void TDef_risoatt_msk::esegui() const
|
||
{
|
||
}
|
||
|
||
TDef_risoatt_msk::TDef_risoatt_msk()
|
||
: TAutomask("ci0600a")
|
||
{
|
||
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
|
||
TConfig& ini = ca_config();
|
||
TSheet_field & s = sfield(F_SHEET);
|
||
TMask & sm = s.sheet_mask();
|
||
int y = 3;
|
||
int sy = 8;
|
||
short dlg = F_ANAL; // id del primo campo da generare
|
||
short sdlg = S_CDC1 + 100; // id del primo campo da generare
|
||
|
||
_cdc_sid = _cdc_lid = _cms_sid = _cms_lid = _fase_sid = _fase_lid = -1;
|
||
_scdc_sid = _scdc_lid = _scms_sid = _scms_lid = _sfase_sid = _sfase_lid = -1;
|
||
|
||
for (int i = 0; i < 2; i++)
|
||
{
|
||
const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2
|
||
|
||
if (level == "CDC") // Crea centro di costo
|
||
{
|
||
if (fasinfo.parent() == LF_CDC)
|
||
{
|
||
int h = ca_multilevel_code_info(LF_CDC).levels();
|
||
const int h1 = ca_create_fields_compact(*this, 0, LF_FASI, 2, y, dlg, dlg + 100);
|
||
y += 2;
|
||
_cdc_sid = dlg;
|
||
_cdc_lid = dlg + h - 1;
|
||
_fase_sid = _cdc_lid + 1;
|
||
_fase_lid = dlg + h1 - 1;
|
||
dlg += h1;
|
||
const int sh = ca_create_fields_compact(sm, 0, LF_FASI, 2, sy, sdlg, sdlg + 50);
|
||
sy += 2;
|
||
_scdc_sid = sdlg;
|
||
_scdc_lid = sdlg + h - 1;
|
||
_sfase_sid = _scdc_lid + 1;
|
||
_sfase_lid = sdlg + sh - 1;
|
||
sdlg += sh;
|
||
}
|
||
else
|
||
{
|
||
const int h = ca_create_fields_compact(*this, 0, LF_CDC, 2, y++, dlg, dlg + 100);
|
||
_cdc_sid = dlg;
|
||
_cdc_lid = dlg + h - 1;
|
||
dlg += h;
|
||
const int sh = ca_create_fields_compact(sm, 0, LF_CDC, 2, sy++, sdlg, sdlg + 50);
|
||
_scdc_sid = sdlg;
|
||
_scdc_lid = sdlg + sh - 1;
|
||
sdlg += h;
|
||
}
|
||
}
|
||
else
|
||
if (level == "CMS") // Crea commessa
|
||
{
|
||
if (fasinfo.parent() == LF_COMMESSE)
|
||
{
|
||
int h = ca_multilevel_code_info(LF_COMMESSE).levels();
|
||
const int h1 = ca_create_fields_compact(*this, 0, LF_FASI, 2, y, dlg, dlg + 100);
|
||
y += 2;
|
||
_cms_sid = dlg;
|
||
_cms_lid = dlg + h - 1;
|
||
_fase_sid = _cms_lid + 1;
|
||
_fase_lid = dlg + h1 - 1;
|
||
dlg += h1;
|
||
const int sh = ca_create_fields_compact(sm, 0, LF_FASI, 2, sy, sdlg, sdlg + 50);
|
||
sy += 2;
|
||
_scms_sid = sdlg;
|
||
_scms_lid = sdlg + h - 1;
|
||
_sfase_sid = _scms_lid + 1;
|
||
_sfase_lid = sdlg + sh - 1;
|
||
sdlg += sh;
|
||
}
|
||
else
|
||
{
|
||
const int h = ca_create_fields_compact(*this, 0, LF_COMMESSE, 2, y++, dlg, dlg + 100);
|
||
_cms_sid = dlg;
|
||
_cms_lid = dlg + h - 1;
|
||
dlg += h;
|
||
const int sh = ca_create_fields_compact(sm, 0, LF_COMMESSE, 2, sy++, sdlg, sdlg + 50);
|
||
_scms_sid = sdlg;
|
||
_scms_lid = sdlg + sh - 1;
|
||
sdlg += sh;
|
||
}
|
||
}
|
||
}
|
||
if (fasinfo.levels() > 0 && fasinfo.parent() <= 0)
|
||
{
|
||
const int h = ca_create_fields_compact(*this, 0, LF_FASI, 2, y++, dlg, dlg + 100);
|
||
_fase_sid = dlg;
|
||
_fase_lid = dlg + h - 1;
|
||
dlg += h;
|
||
const int sh = ca_create_fields_compact(sm, 0, LF_FASI, 2, sy++, sdlg, sdlg + 50);
|
||
_sfase_sid = sdlg;
|
||
_sfase_lid = sdlg + sh - 1;
|
||
sdlg += h;
|
||
}
|
||
|
||
for (int i = 0; i < 12; i++)
|
||
{
|
||
const short id = F_ANAL + i;
|
||
|
||
const int pos = id2pos(id);
|
||
if (pos >= 0)
|
||
{
|
||
set_universal_handler(id);
|
||
set_universal_handler(id + 100);
|
||
}
|
||
}
|
||
for (short id = S_CDC12 + 100; id >= S_CDC1 + 100; id--)
|
||
{
|
||
const int pos = sm.id2pos(id);
|
||
if (pos >= 0)
|
||
{
|
||
TMask_field& f = sm.fld(pos);
|
||
const int size = f.size();
|
||
const TString prompt = ((TEditable_field &)f).get_warning();
|
||
s.set_column_header(id, prompt);
|
||
s.set_column_justify(id, f.is_kind_of(CLASS_REAL_FIELD));
|
||
s.set_column_width(id, (max(3+size, prompt.len()+1)) * CHARX);
|
||
s.enable_column(id);
|
||
set_insheet_universal_handler(F_SHEET, id);
|
||
set_insheet_universal_handler(F_SHEET, id + 50);
|
||
}
|
||
else
|
||
s.delete_column(id);
|
||
}
|
||
_dett = ini_get_string(CONFIG_DITTA, "ci", "DETTCONS", "G");
|
||
|
||
if (_dett == "A")
|
||
{
|
||
reset(F_ANNO);
|
||
disable(F_ANNO);
|
||
reset(F_MESE);
|
||
disable(F_MESE);
|
||
}
|
||
else
|
||
{
|
||
if (_dett == "M")
|
||
{
|
||
field(F_ANNO).update_flags("A", true);
|
||
reset(F_MESE);
|
||
disable(F_MESE);
|
||
}
|
||
set(F_ANNO, TDate(TODAY).year());
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////
|
||
//// CLASSE TDef_risoatt_app ////
|
||
////////////////////////////////////////
|
||
|
||
//classe TDef_risoatt_app
|
||
class TDef_risoatt_app : public TSkeleton_application
|
||
{
|
||
public:
|
||
virtual void main_loop();
|
||
};
|
||
|
||
void TDef_risoatt_app::main_loop()
|
||
{
|
||
TDef_risoatt_msk msk;
|
||
while (msk.run() != K_QUIT)
|
||
msk.esegui();
|
||
}
|
||
|
||
int ci0600(int argc, char *argv[])
|
||
{
|
||
TDef_risoatt_app a;
|
||
a.run (argc, argv, TR("Gestione dati predefiniti"));
|
||
return TRUE;
|
||
}
|