Patch level : 10.0 patch???
Files correlati : ci0 cilib ci0200a.msk Ricompilazione Demo : [ ] Commento : Aggiunto il programma di registrazione delle risorse / attrezzature sulle tabelle di modulo git-svn-id: svn://10.65.10.50/trunk@20575 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e3f416d6a9
commit
9f69d146a7
17
ci/ci0.cpp
17
ci/ci0.cpp
@ -6,18 +6,11 @@ int main(int argc, char** argv)
|
||||
const int op = (argc > 1) ? argv[1][1] - '0' : 0;
|
||||
switch (op)
|
||||
{
|
||||
case 1:
|
||||
// ci0200(argc,argv); // stampa tabelle
|
||||
break;
|
||||
case 2:
|
||||
ci0300(argc,argv); // parametri configurazione Contabilita' Industriale
|
||||
break;
|
||||
case 3:
|
||||
ci0400(argc,argv); // Immssione documenti
|
||||
break;
|
||||
default:
|
||||
ci0100(argc,argv); // gestione tabelle cont. ind.
|
||||
break;
|
||||
case 0 : ci0100(argc,argv); break; // gestione tabelle cont. ind.
|
||||
case 1 : ci0200(argc,argv); break; // gestione risorse / attrezzature
|
||||
case 2 : ci0300(argc,argv); break; // parametri configurazione Contabilita' Industriale
|
||||
case 3 : ci0400(argc,argv); break; // immssione documenti
|
||||
default: ci0100(argc,argv); break; // gestione tabelle cont. ind.
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
1
ci/ci0.h
1
ci/ci0.h
@ -2,6 +2,7 @@
|
||||
#define __CI0_H
|
||||
|
||||
int ci0100(int argc, char* argv[]); // gestione tabelle cont. industriale
|
||||
int ci0200(int argc, char* argv[]); // gestione risorse / attrezzature
|
||||
int ci0300(int argc, char* argv[]); // parametri configurazione Contabilita' Industriale
|
||||
int ci0400(int argc, char* argv[]); // immssione documenti
|
||||
|
||||
|
429
ci/ci0200.cpp
Executable file
429
ci/ci0200.cpp
Executable file
@ -0,0 +1,429 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <defmask.h>
|
||||
#include <recset.h>
|
||||
#include <sheet.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <doc.h>
|
||||
|
||||
#include "ci0.h"
|
||||
#include "cilib.h"
|
||||
#include "ci0200a.h"
|
||||
#include "../ve/velib.h"
|
||||
|
||||
///////////////////////////////////
|
||||
//// CLASSE TRISOATT_MSK ////
|
||||
///////////////////////////////////
|
||||
|
||||
//Classe TRisoatt_msk
|
||||
class TRisoatt_msk : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
void riempi_sheet();
|
||||
void nuova_riga();
|
||||
void azzera_riga(TSheet_field& sheet);
|
||||
void azzera_tutto(TSheet_field& sheet);
|
||||
void registra();
|
||||
|
||||
public:
|
||||
|
||||
void esporta() const;
|
||||
TRisoatt_msk();
|
||||
};
|
||||
|
||||
//RIEMPI_SHEET: metodo che riempie lo sheet in base ai campi chiave
|
||||
//compilati sulla maschera
|
||||
void TRisoatt_msk::riempi_sheet()
|
||||
{
|
||||
//l'anno è l'unico campo obbligatorio
|
||||
const TString4 anno = get(F_ANNO);
|
||||
|
||||
//guardo il tipo risorsa / attrezzatura che sto ricercando (se Tutti setto a '?')
|
||||
char risoatt;
|
||||
if(get(F_RISOATT)[0] == 'T')
|
||||
risoatt = '?';
|
||||
else
|
||||
risoatt = get(F_RISOATT)[0];
|
||||
|
||||
//leggo il codice corretto a seconda del tipo selezionato (se vuoto setto a 16 caratteri '?')
|
||||
TString16 codice;
|
||||
switch(get(F_RISOATT)[0])
|
||||
{
|
||||
case 'T':
|
||||
if (get(F_CODICE).empty())
|
||||
codice.fill('?', 16);
|
||||
else
|
||||
{
|
||||
codice = get(F_CODICE);
|
||||
codice.left_just(16);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
if (get(F_CODRIS).empty())
|
||||
codice.fill('?', 16);
|
||||
else
|
||||
{
|
||||
codice = get(F_CODRIS);
|
||||
codice.left_just(16);
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
if (get(F_CODATT).empty())
|
||||
codice.fill('?', 16);
|
||||
else
|
||||
{
|
||||
codice = get(F_CODATT);
|
||||
codice.left_just(16);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
//leggo il mese (se vuoto setto a '??')
|
||||
TString4 mese;
|
||||
if (get(F_MESE).empty())
|
||||
mese.fill('?', 2);
|
||||
else
|
||||
mese = get(F_MESE);
|
||||
|
||||
//leggo il tipo ora (se vuoto setto a '??')
|
||||
TString4 tpora;
|
||||
if (get(F_TPORA).empty())
|
||||
tpora.fill('?', 2);
|
||||
else
|
||||
tpora = get(F_TPORA);
|
||||
|
||||
//preparo il filtro della query
|
||||
TString filtro;
|
||||
filtro << risoatt << codice << anno << mese << tpora;
|
||||
|
||||
TString query;
|
||||
query << "USE &ROA\n"
|
||||
<< "SELECT CODTAB?=\"" << filtro << "\"";
|
||||
if(risoatt != '?')
|
||||
{
|
||||
query << "\n"
|
||||
<< "FROM CODTAB=" << risoatt << "\n"
|
||||
<< "TO CODTAB=" << risoatt << "\n";
|
||||
}
|
||||
|
||||
TISAM_recordset roa(query);
|
||||
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
sheet.destroy();
|
||||
|
||||
//riempio lo sheet con i dati che soddisfano il filtro preparato prima
|
||||
for(bool ok = roa.move_first(); ok; ok = roa.move_next())
|
||||
{
|
||||
TRisorsa ris(roa.cursor()->curr());
|
||||
TToken_string& riga = sheet.row(-1);
|
||||
riga.add(ris.tipo(), sheet.cid2index(S_RISOATT));
|
||||
TString16 cod = ris.cod();
|
||||
cod.trim();
|
||||
switch(ris.tipo())
|
||||
{
|
||||
case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
|
||||
case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
|
||||
default : break;
|
||||
}
|
||||
riga.add(ris.mese(), sheet.cid2index(S_MESE));
|
||||
riga.add(ris.tpora(), sheet.cid2index(S_TPORA));
|
||||
riga.add(ris.valuni().string(), sheet.cid2index(S_VALUNI));
|
||||
|
||||
sheet.check_row(sheet.items() - 1);
|
||||
}
|
||||
sheet.set_column_justify(sheet.cid2index(S_VALUNI), true);
|
||||
|
||||
sheet.force_update();
|
||||
}
|
||||
|
||||
//NUOVA_RIGA: metodo che aggiunge una riga allo sheet
|
||||
//tenendo conto dei campi chiave compilati in testata
|
||||
void TRisoatt_msk::nuova_riga()
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
sheet.row(-1);
|
||||
sheet.select(sheet.items() - 1);
|
||||
TMask& msk = sheet.sheet_mask();
|
||||
|
||||
//guardo il tipo risorsa / attrezzatura che sto ricercando
|
||||
const char risoatt = get(F_RISOATT)[0] == 'T' ? 'R' : get(F_RISOATT)[0];
|
||||
|
||||
//leggo il codice corretto a seconda del tipo selezionato
|
||||
TString16 codice;
|
||||
switch(get(F_RISOATT)[0])
|
||||
{
|
||||
case 'T': codice = ""; break;
|
||||
case 'R': codice = get(F_CODRIS); break;
|
||||
case 'A': codice = get(F_CODATT); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
//leggo il mese
|
||||
const TString4 mese = get(F_MESE).empty() ? "" : get(F_MESE);
|
||||
|
||||
//leggo il tipo ora
|
||||
const TString4 tpora = get(F_TPORA).empty() ? "" : get(F_TPORA);
|
||||
|
||||
//setta e abilita i campi necessari sulla maschera di riga
|
||||
TString4 tmp; tmp << risoatt;
|
||||
msk.set(S_RISOATT, tmp);
|
||||
if(get(F_RISOATT)[0] == 'T')
|
||||
{
|
||||
msk.enable(S_RISOATT);
|
||||
msk.enable(S_CODRIS);
|
||||
msk.enable(S_CODATT);
|
||||
}
|
||||
|
||||
switch(risoatt)
|
||||
{
|
||||
case 'R':
|
||||
if(codice.empty())
|
||||
{
|
||||
msk.show(S_CODRIS);
|
||||
msk.enable(S_CODRIS);
|
||||
msk.hide(S_CODATT);
|
||||
}
|
||||
else
|
||||
msk.set(S_CODRIS, codice);
|
||||
break;
|
||||
case 'A':
|
||||
if(codice.empty())
|
||||
{
|
||||
msk.show(S_CODATT);
|
||||
msk.enable(S_CODATT);
|
||||
msk.hide(S_CODRIS);
|
||||
}
|
||||
else
|
||||
msk.set(S_CODATT, codice);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if(mese.empty())
|
||||
msk.enable(S_MESE);
|
||||
else
|
||||
msk.set(S_MESE, mese);
|
||||
|
||||
if(tpora.empty())
|
||||
msk.enable(S_TPORA);
|
||||
else
|
||||
msk.set(S_TPORA, tpora);
|
||||
|
||||
|
||||
//lancio la maschera di riga da compilare
|
||||
msk.run();
|
||||
msk.enable_default();
|
||||
}
|
||||
|
||||
//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 TRisoatt_msk::azzera_riga(TSheet_field& sheet)
|
||||
{
|
||||
const int nriga = sheet.selected();
|
||||
TToken_string& row = sheet.row(nriga);
|
||||
|
||||
row.add(0, sheet.cid2index(S_VALUNI));
|
||||
|
||||
TMask& msk = sheet.sheet_mask();
|
||||
msk.set(S_VALUNI, ZERO);
|
||||
}
|
||||
|
||||
//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 TRisoatt_msk::azzera_tutto(TSheet_field& sheet)
|
||||
{
|
||||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||
{
|
||||
TToken_string& row = sheet.row(r);
|
||||
row.add(0, sheet.cid2index(S_VALUNI));
|
||||
}
|
||||
}
|
||||
|
||||
//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 TRisoatt_msk::registra()
|
||||
{
|
||||
TLocalisamfile tabmod(LF_TABMOD);
|
||||
TModule_table tab("&ROA");
|
||||
const int anno = get_int(F_ANNO);
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
|
||||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||
{
|
||||
TToken_string& riga = *(TToken_string*)row;
|
||||
const char tipo = riga.get_char(sheet.cid2index(S_RISOATT));
|
||||
const TString16 codice = tipo == 'R' ? riga.get(sheet.cid2index(S_CODRIS)) : riga.get(sheet.cid2index(S_CODATT));
|
||||
const TString4 mese = riga.get(sheet.cid2index(S_MESE));
|
||||
const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
|
||||
|
||||
const real valuni(riga.get(sheet.cid2index(S_VALUNI)));
|
||||
|
||||
|
||||
TString16 cod = codice;
|
||||
cod.left_just(16);
|
||||
|
||||
TString80 chiave;
|
||||
chiave << tipo << cod << anno << mese << tpora;
|
||||
|
||||
tab.put("CODTAB", chiave);
|
||||
int err = tab.read();
|
||||
|
||||
if(err == NOERR)
|
||||
{
|
||||
if(valuni == ZERO)
|
||||
tab.remove();
|
||||
else
|
||||
{
|
||||
tab.put("R1", valuni);
|
||||
tab.rewrite();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tab.put("CODTAB", chiave);
|
||||
tab.put("R1", valuni);
|
||||
tab.write();
|
||||
}
|
||||
}
|
||||
tab.rewrite_write();
|
||||
riempi_sheet();
|
||||
}
|
||||
|
||||
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
|
||||
bool TRisoatt_msk::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
{
|
||||
switch (f.dlg())
|
||||
{
|
||||
case DLG_NEWREC:
|
||||
if (e == fe_button)
|
||||
{
|
||||
nuova_riga();
|
||||
return false;
|
||||
}
|
||||
case DLG_SAVEREC:
|
||||
if (e == fe_button)
|
||||
{
|
||||
registra();
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case DLG_DELREC:
|
||||
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_OK:
|
||||
if(e == fe_button && jolly == 1)
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
TToken_string& riga = sheet.row(sheet.items() - 1);
|
||||
|
||||
TMask& msk = sheet.sheet_mask();
|
||||
const real& valuni = msk.get_real(S_VALUNI);
|
||||
|
||||
if(valuni > ZERO)
|
||||
{
|
||||
const char tipo = msk.get(S_RISOATT)[0];
|
||||
const TString& codice = tipo == 'R' ? msk.get(S_CODRIS) : msk.get(S_CODATT);
|
||||
const TString& mese = msk.get(S_MESE);
|
||||
const TString& tpora = msk.get(S_TPORA);
|
||||
|
||||
riga.add(tipo, sheet.cid2index(S_RISOATT));
|
||||
switch(tipo)
|
||||
{
|
||||
case 'R': riga.add(codice, sheet.cid2index(S_CODRIS)); break;
|
||||
case 'A': riga.add(codice, sheet.cid2index(S_CODATT)); break;
|
||||
default : break;
|
||||
}
|
||||
riga.add(mese, sheet.cid2index(S_MESE));
|
||||
riga.add(tpora, sheet.cid2index(S_TPORA));
|
||||
riga.add(valuni.string(), sheet.cid2index(S_VALUNI));
|
||||
sheet.set_column_justify(sheet.cid2index(S_VALUNI), true);
|
||||
sheet.check_row(sheet.items() - 1);
|
||||
sheet.force_update();
|
||||
}
|
||||
else
|
||||
{
|
||||
sheet.destroy(sheet.items() - 1);
|
||||
sheet.force_update();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DLG_CANCEL:
|
||||
{
|
||||
if(e == fe_button && jolly == 1)
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
sheet.destroy(sheet.items() - 1);
|
||||
sheet.force_update();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_ANNO:
|
||||
case F_MESE:
|
||||
case F_RISOATT:
|
||||
case F_CODICE:
|
||||
case F_CODRIS:
|
||||
case F_CODATT:
|
||||
case F_TPORA:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
riempi_sheet();
|
||||
break;
|
||||
case F_SHEET:
|
||||
if (e == se_query_add)
|
||||
{
|
||||
send_key(K_SPACE, DLG_NEWREC);
|
||||
return false;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TRisoatt_msk::esporta() const
|
||||
{
|
||||
}
|
||||
|
||||
TRisoatt_msk::TRisoatt_msk()
|
||||
: TAutomask("ci0200a")
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
//// CLASSE TRISOATT_APP ////
|
||||
///////////////////////////////////
|
||||
|
||||
//classe TRisoatt_app
|
||||
class TRisoatt_app : public TSkeleton_application
|
||||
{
|
||||
public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
void TRisoatt_app::main_loop()
|
||||
{
|
||||
TRisoatt_msk msk;
|
||||
while (msk.run() != K_QUIT)
|
||||
msk.esporta();
|
||||
}
|
||||
|
||||
int ci0200(int argc, char *argv[])
|
||||
{
|
||||
TRisoatt_app a;
|
||||
a.run (argc, argv, TR("Gestione Risorse / Attrezzature"));
|
||||
return TRUE;
|
||||
}
|
21
ci/ci0200a.h
Executable file
21
ci/ci0200a.h
Executable file
@ -0,0 +1,21 @@
|
||||
//Campi maschera ci0200a
|
||||
#define F_ANNO 301
|
||||
#define F_MESE 302
|
||||
#define F_TPORA 303
|
||||
#define F_RISOATT 304
|
||||
#define F_CODICE 305
|
||||
#define F_CODRIS 306
|
||||
#define F_DESRIS 307
|
||||
#define F_CODATT 308
|
||||
#define F_DESATT 309
|
||||
#define F_SHEET 310
|
||||
|
||||
#define S_RISOATT 101
|
||||
#define S_CODRIS 102
|
||||
#define S_DESRIS 106
|
||||
#define S_CODATT 202
|
||||
#define S_DESATT 206
|
||||
#define S_ANNO 999
|
||||
#define S_MESE 103
|
||||
#define S_TPORA 104
|
||||
#define S_VALUNI 105
|
256
ci/ci0200a.uml
Executable file
256
ci/ci0200a.uml
Executable file
@ -0,0 +1,256 @@
|
||||
#include "ci0200a.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
BUTTON DLG_NEWREC 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Nuovo"
|
||||
PICTURE TOOL_NEWREC
|
||||
END
|
||||
|
||||
BUTTON DLG_SAVEREC 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Salva"
|
||||
PICTURE TOOL_SAVEREC
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Canc"
|
||||
PICTURE TOOL_DELREC
|
||||
END
|
||||
|
||||
#include <helpbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Risorse e Attrezzature" 0 2 0 0
|
||||
|
||||
GROUPBOX DLG_NULL 78 8
|
||||
BEGIN
|
||||
PROMPT 1 0 "@bDati Risorsa - Attrezzatura"
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 2 1 "Anno "
|
||||
CHECTYPE REQUIRED
|
||||
FLAGS "A"
|
||||
END
|
||||
|
||||
LISTBOX F_MESE 10
|
||||
BEGIN
|
||||
PROMPT 22 1 "Mese"
|
||||
ITEM "|"
|
||||
FLAGS "M"
|
||||
END
|
||||
|
||||
STRING F_TPORA 2
|
||||
BEGIN
|
||||
PROMPT 40 1 "Tipo ora "
|
||||
USE &ORE
|
||||
INPUT CODTAB F_TPORA
|
||||
DISPLAY "Codice@16" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_TPORA CODTAB
|
||||
END
|
||||
|
||||
RADIOBUTTON F_RISOATT 1 76
|
||||
BEGIN
|
||||
PROMPT 2 2 "@bTipo: "
|
||||
ITEM "T|Tutti"
|
||||
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@
|
||||
ITEM "R|Risorsa"
|
||||
MESSAGE HIDE,1@|SHOW,2@|HIDE,3@
|
||||
ITEM "A|Attrezzatura"
|
||||
MESSAGE HIDE,1@|HIDE,2@|SHOW,3@
|
||||
FLAGS "Z"
|
||||
END
|
||||
|
||||
STRING F_CODICE 16
|
||||
BEGIN
|
||||
PROMPT 2 5 "Codice: "
|
||||
USE &ROA
|
||||
DISPLAY "Tipo@5" CODTAB[1,1]
|
||||
DISPALY "Codice@16" CODTAB[2,17]
|
||||
DISPLAY "Anno@5" CODTAB[18,21]
|
||||
DISPLAY "Mese@5" CODTAB[22,23]
|
||||
DISPLAY "Tipo\nora@5" CODTAB[24,25]
|
||||
OUTPUT F_CODICE CODTAB[2,17]
|
||||
GROUP 1
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_CODRIS 16
|
||||
BEGIN
|
||||
PROMPT 2 5 "Codice: "
|
||||
USE RSS
|
||||
INPUT CODTAB F_CODRIS
|
||||
DISPLAY "Codice@16" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODRIS CODTAB
|
||||
OUTPUT F_DESRIS S0
|
||||
GROUP 2
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESRIS 50
|
||||
BEGIN
|
||||
PROMPT 10 6 ""
|
||||
FLAGS "D"
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING F_CODATT 16
|
||||
BEGIN
|
||||
PROMPT 2 5 "Codice: "
|
||||
FIELD CODTAB[1,16]
|
||||
USE ATR
|
||||
INPUT CODTAB F_CODATT
|
||||
DISPLAY "Codice@16" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODATT CODTAB
|
||||
OUTPUT F_DESATT S0
|
||||
GROUP 3
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESATT 50
|
||||
BEGIN
|
||||
PROMPT 10 6 ""
|
||||
FLAGS "D"
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEET -15 0
|
||||
BEGIN
|
||||
PROMPT 1 8 ""
|
||||
ITEM "Tipo"
|
||||
ITEM "Codice@16"
|
||||
ITEM "Mese"
|
||||
ITEM "Tipo\nOra@5"
|
||||
ITEM "Valore\nUnitario@10"
|
||||
ITEM "Descrizione@50"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
||||
|
||||
PAGE "Dettaglio Risorsa - Attrezzatura" -1 -1 78 13
|
||||
|
||||
GROUPBOX DLG_NULL 76 9
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bDati Risorsa - Attrezzatura"
|
||||
END
|
||||
|
||||
RADIOBUTTON S_RISOATT 1 74
|
||||
BEGIN
|
||||
PROMPT 2 2 "@bTipo: "
|
||||
FIELD CODTAB[0,1]
|
||||
ITEM "R|Risorsa"
|
||||
MESSAGE SHOW,1@|HIDE,2@|RESET,2@
|
||||
ITEM "A|Attrezzatura"
|
||||
MESSAGE HIDE,1@|SHOW,2@|RESET,1@
|
||||
FLAGS "GDZ"
|
||||
END
|
||||
|
||||
STRING S_CODRIS 16
|
||||
BEGIN
|
||||
PROMPT 2 5 "Codice Risorsa "
|
||||
FIELD CODTAB[1,16]
|
||||
USE RSS
|
||||
INPUT CODTAB S_CODRIS
|
||||
DISPLAY "Codice@16" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT S_CODRIS CODTAB
|
||||
OUTPUT S_DESRIS S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "GD"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING S_DESRIS 50
|
||||
BEGIN
|
||||
PROMPT 2 6 "Descrizione "
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "D"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING S_CODATT 16
|
||||
BEGIN
|
||||
PROMPT 2 5 "Codice Attrezzatura "
|
||||
FIELD CODTAB[1,16]
|
||||
USE ATR
|
||||
INPUT CODTAB S_CODATT
|
||||
DISPLAY "Codice@16" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT S_CODATT CODTAB
|
||||
OUTPUT S_DESATT S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "GD"
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING S_DESATT 50
|
||||
BEGIN
|
||||
PROMPT 2 6 "Descrizione "
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "D"
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
NUMBER S_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 2 7 "Anno "
|
||||
FLAGS "AD"
|
||||
END
|
||||
|
||||
LISTBOX S_MESE 10
|
||||
BEGIN
|
||||
PROMPT 22 7 "Mese"
|
||||
FLAGS "M"
|
||||
FILED CODTAB[21,2]
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING S_TPORA 2
|
||||
BEGIN
|
||||
PROMPT 59 7 "Tipo ora "
|
||||
USE &ORE
|
||||
INPUT CODTAB S_TPORA
|
||||
DISPLAY "Codice@16" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT S_TPORA CODTAB
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER S_VALUNI 6 3
|
||||
BEGIN
|
||||
PROMPT 2 8 "Valore Unitario: "
|
||||
CHEKTYPE NORMAL
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "" 0 0 0 2
|
||||
|
||||
BUTTON DLG_OK 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 2 2
|
||||
BEGIN
|
||||
PROMPT 2 1 "Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
PICTURE BMP_DELREC
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 2 2
|
||||
BEGIN
|
||||
PROMPT 4 1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
117
ci/cilib.cpp
117
ci/cilib.cpp
@ -1,11 +1,6 @@
|
||||
#include <colors.h>
|
||||
#include <config.h>
|
||||
#include <automask.h>
|
||||
#include <diction.h>
|
||||
#include <image.h>
|
||||
#include <tabutil.h>
|
||||
#include <defmask.h>
|
||||
#include <utility.h> // file functions
|
||||
|
||||
#include "cilib.h"
|
||||
#include "cimsk.h"
|
||||
@ -508,3 +503,115 @@ TAlmanac_mask::TAlmanac_mask(const char* name)
|
||||
read_mask(name, 0, -1); // Deve funzionare la virtual parse_field
|
||||
set_handlers();
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
//// TRISORSA ////
|
||||
////////////////////////
|
||||
|
||||
//CHIAVE: metodo che restituisce la chiave della tabella di modulo
|
||||
const TString& TRisorsa::chiave() const
|
||||
{
|
||||
return get("CODTAB");
|
||||
}
|
||||
|
||||
//TIPO: metodo che restituisce il tipo (<R>isorsa o <A>ttrezzatura)
|
||||
const char TRisorsa::tipo() const
|
||||
{
|
||||
return chiave().left(1)[0];
|
||||
}
|
||||
|
||||
//COD: metodo che restituisce il codice della risorsa op dell'attrezzatura
|
||||
const TString& TRisorsa::cod() const
|
||||
{
|
||||
return chiave().mid(1, 16);
|
||||
}
|
||||
|
||||
//ANNO: metodo che restituisce l'anno a cui fa riferimento la risorsa o l'attrezzatura
|
||||
const int TRisorsa::anno() const
|
||||
{
|
||||
return atoi(chiave().mid(17, 4));
|
||||
}
|
||||
|
||||
//MESE: metodo che restituisce il mese a cui fa riferimento la risorsa o l'attrezzatura
|
||||
const TString& TRisorsa::mese() const
|
||||
{
|
||||
return chiave().mid(21, 2);
|
||||
}
|
||||
|
||||
//TPORA: metodo che restituisce il tipo dell'ora a cui fa riferimento la risorsa o l'attrezzatura
|
||||
const TString& TRisorsa::tpora() const
|
||||
{
|
||||
return chiave().right(2);
|
||||
}
|
||||
|
||||
//DESCR: metodo che restituisce la descrizione contenuta nella tabella di modulo
|
||||
const TString& TRisorsa::descr() const
|
||||
{
|
||||
return get("S0");
|
||||
}
|
||||
|
||||
//VALUNI: metodo che restituisce il valore unitario contenuto nella tabella di modulo
|
||||
const real TRisorsa::valuni() const
|
||||
{
|
||||
return get_real("R1");
|
||||
}
|
||||
|
||||
void TRisorsa::set_chiave(const char* chiave)
|
||||
{
|
||||
put("CODTAB", chiave);
|
||||
}
|
||||
|
||||
void TRisorsa::set_chiave(const char tipo, const char* codice, const int anno, const char* mese, const char* tpora)
|
||||
{
|
||||
TString16 cod = codice;
|
||||
cod.left_just(16);
|
||||
|
||||
TString80 chiave;
|
||||
chiave << tipo << cod << anno << mese << tpora;
|
||||
set_chiave(chiave);
|
||||
}
|
||||
|
||||
void TRisorsa::set_valuni(const real& valuni)
|
||||
{
|
||||
put("R1", valuni);
|
||||
}
|
||||
|
||||
//costruttore
|
||||
TRisorsa::TRisorsa(const char* chiave)
|
||||
: TRectype(LF_TABMOD)
|
||||
{
|
||||
TModule_table tab("&ROA");
|
||||
set_chiave(chiave);
|
||||
if (read(tab) != NOERR)
|
||||
{
|
||||
tab.zero();
|
||||
//set_chiave(chiave);
|
||||
}
|
||||
*this = tab.curr();
|
||||
}
|
||||
|
||||
TRisorsa::TRisorsa(const char tipo, const char* codice, const int anno, const char* mese, const char* tpora)
|
||||
: TRectype(LF_TABMOD)
|
||||
{
|
||||
TModule_table tab("&ROA");
|
||||
set_chiave(tipo, codice, anno, mese, tpora);
|
||||
if (read(tab) != NOERR)
|
||||
{
|
||||
tab.zero();
|
||||
//set_chiave(tipo, codice, anno, mese, tpora);
|
||||
}
|
||||
*this = tab.curr();
|
||||
}
|
||||
|
||||
TRisorsa::TRisorsa(const TRectype& r)
|
||||
: TRectype(r)
|
||||
{
|
||||
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
|
||||
}
|
||||
|
||||
TRisorsa::TRisorsa()
|
||||
: TRectype(LF_TABMOD)
|
||||
{
|
||||
TModule_table tab("&ROA");
|
||||
*this = tab.curr();
|
||||
}
|
43
ci/cilib.h
43
ci/cilib.h
@ -5,6 +5,14 @@
|
||||
#include <automask.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RECARRAY_H
|
||||
#include <recarray.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TABMOD_H
|
||||
#include <tabmod.h>
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAlmanac_field
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -134,6 +142,39 @@ public:
|
||||
TAlmanac_mask(const char * name);
|
||||
// @cmember Distruttore
|
||||
virtual ~TAlmanac_mask() { }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
////////////////////////
|
||||
//// TRISORSA ////
|
||||
////////////////////////
|
||||
|
||||
//Classe TRisorsa
|
||||
class TRisorsa : public TRectype
|
||||
{
|
||||
public:
|
||||
TRisorsa & operator =(const TRisorsa& ris) { return *this; }
|
||||
|
||||
const TString& chiave() const;
|
||||
const char tipo() const;
|
||||
const TString& cod() const;
|
||||
const int anno() const;
|
||||
const TString& mese() const;
|
||||
const TString& tpora() const;
|
||||
const TString& descr() const;
|
||||
const real valuni() const;
|
||||
|
||||
void set_chiave(const char* chiave);
|
||||
void set_chiave(const char tipo, const char* codice, const int anno, const char* mese, const char* tpora);
|
||||
void set_valuni(const real& valuni);
|
||||
|
||||
//costruttore
|
||||
TRisorsa(const char* chiave);
|
||||
TRisorsa(const char tipo, const char* codice, const int anno, const char* mese, const char* tpora);
|
||||
TRisorsa(const TRectype& r);
|
||||
TRisorsa();
|
||||
|
||||
virtual ~TRisorsa() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user