From 59bf419e6e9503ccf5f02f8bb3a60e4ea06c73b4 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 29 Jul 2010 14:15:32 +0000 Subject: [PATCH] Patch level : 10.0 nopatch Files correlati : ri0.exe Ricompilazione Demo : [ ] Commento : Rilevazione Ore su commessa cdc fase git-svn-id: svn://10.65.10.50/branches/R_10_00@20724 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ci/ci0200.cpp | 90 +++++++++++++++++++++++++++++--------------------- ci/ci0200a.h | 2 +- ci/ci0200a.uml | 10 +++--- ci/ci0600.cpp | 2 +- ci/cilib.cpp | 84 +++++++++++++++++++++++----------------------- ci/cirilore.h | 18 ---------- ci/f125.dir | 3 +- ci/f125.trr | 6 ++-- ci/rilore.h | 18 ++++++++++ 9 files changed, 126 insertions(+), 107 deletions(-) delete mode 100755 ci/cirilore.h create mode 100755 ci/rilore.h diff --git a/ci/ci0200.cpp b/ci/ci0200.cpp index 3f5ed6c77..6ef75f645 100755 --- a/ci/ci0200.cpp +++ b/ci/ci0200.cpp @@ -24,6 +24,7 @@ class TRisoatt_msk : public TAutomask virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); const TString & add_field_to_tab_filter(TString & filtro, short id, int len = 0, const char * empty_value = ""); + const TString & add_field_to_tab_key(TString & filtro, TToken_string & row, short id, bool number, int len = 0, const char * empty_value = ""); void riempi_sheet(); void nuova_riga(); void azzera_riga(TSheet_field& sheet); @@ -41,30 +42,46 @@ const TString & TRisoatt_msk::add_field_to_tab_filter(TString & filtro, short id { if (len <= 0) len = field(id).size(); - TString val = get(id); + TString & val = get_tmp_string(80); + val = get(id); if (val == empty_value) val.fill('?', len); else val.left_just(len); filtro << val; - return filtro; + return val; +} + +const TString & TRisoatt_msk::add_field_to_tab_key(TString & filtro, TToken_string & row, short id, bool number, int len, const char * empty_value) +{ + TSheet_field & sh = sfield(F_SHEET); + + if (len <= 0) + len = sh.sheet_mask().field(id).size(); + + TString & val = get_tmp_string(80); + + val = row.get(sh.cid2index(id)); + if (val == empty_value) + val.fill(number ? '0' : ' ', len); + else + val.left_just(len); + filtro << val; + + return val; } //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); + TString filtro; + char risoatt = get(F_RISOATT)[0]; //guardo il tipo risorsa / attrezzatura che sto ricercando (se Tutti setto a '?') - TString filtro; - add_field_to_tab_filter(filtro, F_RISOATT, 1, "T"); - - char risoatt = get(F_RISOATT)[0]; //leggo il codice corretto a seconda del tipo selezionato (se vuoto setto a 16 caratteri '?') switch(risoatt) { @@ -80,6 +97,7 @@ void TRisoatt_msk::riempi_sheet() default: break; } + add_field_to_tab_filter(filtro, F_ANNO); //leggo il mese (se vuoto setto a '??') add_field_to_tab_filter(filtro, F_MESE, 2); @@ -126,11 +144,12 @@ void TRisoatt_msk::riempi_sheet() riga.add(roakey.mese(), sheet.cid2index(S_MESE)); riga.add(roakey.tpora(), sheet.cid2index(S_TPORA)); riga.add(roa.valuni().string(), sheet.cid2index(S_VALUNI)); + riga.add(roakey.anno(), sheet.cid2index(S_ANNO)); sheet.check_row(sheet.items() - 1); } - sheet.set_column_justify(sheet.cid2index(S_VALUNI), true); + sheet.set_column_justify(sheet.cid2index(S_VALUNI), true); sheet.force_update(); } @@ -143,6 +162,7 @@ void TRisoatt_msk::nuova_riga() sheet.select(sheet.items() - 1); TMask& msk = sheet.sheet_mask(); + msk.set(S_ANNO, get(F_ANNO)); //guardo il tipo risorsa / attrezzatura che sto ricercando const char risoatt = get(F_RISOATT)[0] == 'T' ? 'R' : get(F_RISOATT)[0]; TString4 tmp; tmp << risoatt; @@ -182,8 +202,6 @@ void TRisoatt_msk::nuova_riga() { 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); TToken_string& riga = sheet.row(sheet.items() - 1); riga.add(tipo, sheet.cid2index(S_RISOATT)); @@ -193,9 +211,13 @@ void TRisoatt_msk::nuova_riga() case 'A': riga.add(codice, sheet.cid2index(S_CODATT)); break; default : break; } + const TString& mese = msk.get(S_MESE); riga.add(mese, sheet.cid2index(S_MESE)); + const TString& tpora = msk.get(S_TPORA); riga.add(tpora, sheet.cid2index(S_TPORA)); riga.add(valuni.string(), sheet.cid2index(S_VALUNI)); + const TString& anno = msk.get(S_ANNO); + riga.add(anno, sheet.cid2index(S_ANNO)); sheet.set_column_justify(sheet.cid2index(S_VALUNI), true); } else @@ -244,27 +266,22 @@ void TRisoatt_msk::registra() TModule_table tab("&ROA"); const int anno = get_int(F_ANNO); TSheet_field& sheet = sfield(F_SHEET); + TString80 chiave; FOR_EACH_SHEET_ROW(sheet, r, row) { + chiave.cut(0); 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 TString80 descr = tipo == 'R' ? riga.get(sheet.cid2index(S_DESRIS)) : riga.get(sheet.cid2index(S_DESATT)); - + const TString4 tipo = add_field_to_tab_key(chiave, riga, S_RISOATT, false, 1, "T"); + const bool risorsa = tipo[0] == 'R'; + const TString16 codice = add_field_to_tab_key(chiave, riga, risorsa ? S_CODRIS : S_CODATT, false); + const TString4 stranno = add_field_to_tab_key(chiave, riga, S_ANNO, true); + const TString4 mese = add_field_to_tab_key(chiave, riga, S_MESE, true, 2); + const TString4 tpora = add_field_to_tab_key(chiave, riga, S_TPORA, true); + const TString80 descr = risorsa ? riga.get(sheet.cid2index(S_DESRIS)) : riga.get(sheet.cid2index(S_DESATT)); const real valuni(riga.get(sheet.cid2index(S_VALUNI))); - TString16 cod = codice; - cod.left_just(16); - - TString80 chiave; - chiave << tipo << cod << anno << mese << tpora; - - TString8 tmp; tmp << anno << mese; - const long anme = atol(tmp); + TString8 anme; anme << anno << mese; tab.put("CODTAB", chiave); int err = tab.read(); @@ -289,7 +306,6 @@ void TRisoatt_msk::registra() tab.write(); } } - tab.rewrite_write(); riempi_sheet(); } @@ -382,14 +398,15 @@ void TRisoatt_msk::copia_tutto() continue; } - const char tipo = row.get_char(sheet.cid2index(S_RISOATT)); - TString16 codice = row.get(sheet.cid2index(S_CODRIS)); - const TString4 mese = row.get(sheet.cid2index(S_MESE)); - const TString4 tpora = row.get(sheet.cid2index(S_TPORA)); + TString80 chiave; + const TString4 tipo = add_field_to_tab_key(chiave, row, S_RISOATT, false, 1, "T"); + const bool risorsa = tipo[0] == 'R'; + const TString16 codice = add_field_to_tab_key(chiave, row, risorsa ? S_CODRIS : S_CODATT, false); + const TString4 stranno = add_field_to_tab_key(chiave, row, S_ANNO, true); + const TString4 mese = add_field_to_tab_key(chiave, row, S_MESE, true, 2); + const TString4 tpora = add_field_to_tab_key(chiave, row, S_TPORA, true); const real valuni(row.get(sheet.cid2index(S_VALUNI))); - TString80 chiave; chiave << tipo << codice.left_just(16) << anno << mese << tpora; - TString80 chiavedest; if(get(F_RISOATT)[0] == 'T') chiavedest << tipo; @@ -399,7 +416,7 @@ void TRisoatt_msk::copia_tutto() if(codicedest.full()) chiavedest << codicedest; else - chiavedest << codice.left_just(16); + chiavedest << codice; chiavedest << annodest; @@ -436,7 +453,6 @@ void TRisoatt_msk::copia_tutto() tab.write(); } } - tab.rewrite_write(); } } riempi_sheet(); @@ -521,7 +537,7 @@ bool TRisoatt_msk::on_field_event(TOperable_field& f, TField_event e, long jolly case F_CODRIS: case F_CODATT: case F_TPORA: - if (e == fe_init || e == fe_modify) + if (e == fe_modify) riempi_sheet(); break; case F_SHEET: @@ -568,4 +584,4 @@ int ci0200(int argc, char *argv[]) TRisoatt_app a; a.run (argc, argv, TR("Gestione Listini")); return TRUE; -} \ No newline at end of file +} diff --git a/ci/ci0200a.h b/ci/ci0200a.h index 2578e9ee0..432b5531d 100755 --- a/ci/ci0200a.h +++ b/ci/ci0200a.h @@ -19,7 +19,7 @@ #define S_DESRIS 106 #define S_CODATT 202 #define S_DESATT 206 -#define S_ANNO 999 +#define S_ANNO 107 #define S_MESE 103 #define S_TPORA 104 #define S_VALUNI 105 \ No newline at end of file diff --git a/ci/ci0200a.uml b/ci/ci0200a.uml index b49a704f2..dcc6370dc 100755 --- a/ci/ci0200a.uml +++ b/ci/ci0200a.uml @@ -144,12 +144,13 @@ BEGIN ITEM "Tipo\nOra@5" ITEM "Valore\nUnitario@10" ITEM "Descrizione@50" + ITEM "Anno" END ENDPAGE ENDMASK -PAGE "Dettaglio Risorsa - Attrezzatura" -1 -1 78 13 +PAGE "Risorsa - Attrezzatura" -1 -1 78 13 GROUPBOX DLG_NULL 76 9 BEGIN @@ -216,13 +217,13 @@ END NUMBER S_ANNO 4 BEGIN PROMPT 2 7 "Anno " + CHECKTYPE REQUIRED FLAGS "AD" END LISTBOX S_MESE 10 BEGIN PROMPT 22 7 "Mese" - ITEM "|" FILED CODTAB[21,2] FLAGS "MD" END @@ -235,12 +236,13 @@ BEGIN DISPLAY "Codice@16" CODTAB DISPLAY "Descrizione@50" S0 OUTPUT S_TPORA CODTAB + CHECKTYPE REQUIRED FLAGS "D" END -NUMBER S_VALUNI 6 2 +NUMBER S_VALUNI 10 2 BEGIN - PROMPT 2 8 "Valore Unitario: " + PROMPT 2 8 "Valore Unitario " END ENDPAGE diff --git a/ci/ci0600.cpp b/ci/ci0600.cpp index 22bc2bbb9..fe349c4e5 100755 --- a/ci/ci0600.cpp +++ b/ci/ci0600.cpp @@ -237,7 +237,7 @@ void TDef_risoatt_msk::azzera_tutto(TSheet_field& sheet) //vaoler pari a zero, e poi ricarica lo sheet void TDef_risoatt_msk::registra() { - TLocalisamfile file(LF_CIRILORE); + TLocalisamfile file(LF_RILORE); TSheet_field& sheet = sfield(F_SHEET); FOR_EACH_SHEET_ROW(sheet, r, row) diff --git a/ci/cilib.cpp b/ci/cilib.cpp index 3a37b4e5e..145448e62 100755 --- a/ci/cilib.cpp +++ b/ci/cilib.cpp @@ -3,7 +3,7 @@ #include #include "cilib.h" -#include "cirilore.h" +#include "RILORE.h" #include "cimsk.h" /////////////////////////////////////////////////////////// @@ -646,14 +646,14 @@ bool TRilevamento_ore::read(const char tipo, const char tipora, const char *codi { int err = _iskeynotfound; - TLocalisamfile rilore(LF_CIRILORE); + TLocalisamfile rilore(LF_RILORE); - put(CIRILORE_TIPO, tipo); - put(CIRILORE_TIPORA, tipora); - put(CIRILORE_CODICE, codice); - put(CIRILORE_ANNO, anno); - put(CIRILORE_MESE, mese); - put(CIRILORE_TPORA, tpora); + put(RILORE_TIPO, tipo); + put(RILORE_TIPORA, tipora); + put(RILORE_CODICE, codice); + put(RILORE_ANNO, anno); + put(RILORE_MESE, mese); + put(RILORE_TPORA, tpora); err = TRectype::read(rilore); @@ -668,12 +668,12 @@ bool TRilevamento_ore::read(const char tipo, const char* codcosto, const char* c { int err = _iskeynotfound; - TLocalisamfile rilore(LF_CIRILORE); + TLocalisamfile rilore(LF_RILORE); - put(CIRILORE_TIPO, tipo); - put(CIRILORE_CODCOSTO, codcosto); - put(CIRILORE_CODCMS, codcms); - put(CIRILORE_CODFASE, codfase); + put(RILORE_TIPO, tipo); + put(RILORE_CODCOSTO, codcosto); + put(RILORE_CODCMS, codcms); + put(RILORE_CODFASE, codfase); err = TRectype::read(rilore); @@ -686,157 +686,157 @@ bool TRilevamento_ore::read(const char tipo, const char* codcosto, const char* c //TIPO: indica se si tratta di una riga di efault,

reventivo o onsuntivo const char TRilevamento_ore::tipo() const { - return get(CIRILORE_TIPO)[0]; + return get(RILORE_TIPO)[0]; } //TIPORA: indica se si tratta din una isorsa o di una ttrezzatura const char TRilevamento_ore::tipora() const { - return get(CIRILORE_TIPORA)[0]; + return get(RILORE_TIPORA)[0]; } //CODICE: restiruisce il codice della risorsa o dell'attrezzatura const TString& TRilevamento_ore::codice() const { - return get(CIRILORE_CODICE); + return get(RILORE_CODICE); } //ANNO: restituisce l'anno a cui fa riferimento la riga const int TRilevamento_ore::anno() const { - return get_int(CIRILORE_ANNO); + return get_int(RILORE_ANNO); } //MESE: restituisce il mese a cui fa riferimento la riga const TString& TRilevamento_ore::mese() const { - return get(CIRILORE_MESE); + return get(RILORE_MESE); } //TPORA: restituisce il tipo ora const TString& TRilevamento_ore::tpora() const { - return get(CIRILORE_TPORA); + return get(RILORE_TPORA); } //CODCOSTO: restituisce il codice del centro di costo const TString& TRilevamento_ore::codcosto() const { - return get(CIRILORE_CODCOSTO); + return get(RILORE_CODCOSTO); } //CODCMS: restituisce il codice commessa const TString& TRilevamento_ore::codcms() const { - return get(CIRILORE_CODCMS); + return get(RILORE_CODCMS); } //CODFASE: restituisce il codice della fase const TString& TRilevamento_ore::codfase() const { - return get(CIRILORE_CODFASE); + return get(RILORE_CODFASE); } //DADATA: restituisce la data di inizio validità della riga const TDate TRilevamento_ore::dadata() const { - return get_date(CIRILORE_DADATA); + return get_date(RILORE_DADATA); } //ADATA: restituisce la fata di fine validità della riga const TDate TRilevamento_ore::adata()const { - return get_date(CIRILORE_ADATA); + return get_date(RILORE_ADATA); } //QTAORE: restituisce il numero di ore const int TRilevamento_ore::qtaore() const { - return get_int(CIRILORE_QTAORE); + return get_int(RILORE_QTAORE); } //COSTO: restitusce il costo unitario const real TRilevamento_ore::costo() const { - return get_real(CIRILORE_COSTO); + return get_real(RILORE_COSTO); } //SET_TIPO: setta efault,

reventivo o onsuntivo void TRilevamento_ore::set_tipo(const char tipo) { - put(CIRILORE_TIPO, tipo); + put(RILORE_TIPO, tipo); } //SET_TIPORA: setta isorsa o ttrezzatura void TRilevamento_ore::set_tipora(const char tipora) { - put(CIRILORE_TIPORA, tipora); + put(RILORE_TIPORA, tipora); } //SET_CODICE: setta il codice void TRilevamento_ore::set_codice(const char* codice) { - put(CIRILORE_CODICE, codice); + put(RILORE_CODICE, codice); } //SET_ANNO: setta l'anno di riferimento void TRilevamento_ore::set_anno(const int anno) { - put(CIRILORE_ANNO, anno); + put(RILORE_ANNO, anno); } //SET_MESE: setta il mese di riferimento void TRilevamento_ore::set_mese(const char* mese) { - put(CIRILORE_MESE, mese); + put(RILORE_MESE, mese); } //SET_TPORA: setta il tipo ora void TRilevamento_ore::set_tpora(const char* tpora) { - put(CIRILORE_TPORA, tpora); + put(RILORE_TPORA, tpora); } //SET_CODCOSTO: setta il codice del centro di costo void TRilevamento_ore::set_codcosto(const char* codcosto) { - put(CIRILORE_CODCOSTO, codcosto); + put(RILORE_CODCOSTO, codcosto); } //SET_CODCMS: setta il codice commessa void TRilevamento_ore::set_codcms(const char* codcms) { - put(CIRILORE_CODCMS, codcms); + put(RILORE_CODCMS, codcms); } //SET_CODFASE: setta il codice della fase void TRilevamento_ore::set_codfase(const char* codfase) { - put(CIRILORE_CODFASE, codfase); + put(RILORE_CODFASE, codfase); } //SET_DADATA: setta la data di inizio validità della riga void TRilevamento_ore::set_dadata(const TDate& dadata) { - put(CIRILORE_DADATA, dadata); + put(RILORE_DADATA, dadata); } //SET_ADATA: setta la data di fine validità della riga void TRilevamento_ore::set_adata(const TDate& adata) { - put(CIRILORE_ADATA, adata); + put(RILORE_ADATA, adata); } //SET_QTAORE: setta il numero di ore rilevato void TRilevamento_ore::set_qtaore(const int qtaore) { - put(CIRILORE_QTAORE, qtaore); + put(RILORE_QTAORE, qtaore); } //SET_COSTO: metodo che setta il costo unitario (da listino) void TRilevamento_ore::set_costo(const real& costo) { - put(CIRILORE_COSTO, costo); + put(RILORE_COSTO, costo); } //Metodi costruttori @@ -851,19 +851,19 @@ TRilevamento_ore::TRilevamento_ore(const TRilevamento_ore& rilore) } TRilevamento_ore::TRilevamento_ore(const char tipo, const char tipora, const char* codice, const int anno, const char* mese, const char* tpora) - : TRectype(LF_CIRILORE) + : TRectype(LF_RILORE) { read(tipo, tipora, codice, anno, mese, tpora); } TRilevamento_ore::TRilevamento_ore(const char tipo, const char* codcosto, const char* codcms, const char* codfase) - : TRectype(LF_CIRILORE) + : TRectype(LF_RILORE) { read(tipo, codcosto, codcms, codfase); } TRilevamento_ore::TRilevamento_ore() - : TRectype(LF_CIRILORE) + : TRectype(LF_RILORE) { zero(); } diff --git a/ci/cirilore.h b/ci/cirilore.h deleted file mode 100755 index 21b5102de..000000000 --- a/ci/cirilore.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __CIRILORE_H -#define __CIRILORE_H - -#define CIRILORE_TIPO "TIPO" -#define CIRILORE_TIPORA "TIPORA" -#define CIRILORE_CODICE "CODICE" -#define CIRILORE_ANNO "ANNO" -#define CIRILORE_MESE "MESE" -#define CIRILORE_TPORA "TPORA" -#define CIRILORE_CODCOSTO "CODCOSTO" -#define CIRILORE_CODCMS "CODCMS" -#define CIRILORE_CODFASE "CODFASE" -#define CIRILORE_DADATA "DADATA" -#define CIRILORE_ADATA "ADATA" -#define CIRILORE_QTAORE "QTAORE" -#define CIRILORE_COSTO "COSTO" - -#endif \ No newline at end of file diff --git a/ci/f125.dir b/ci/f125.dir index 00ec8675e..f6c8d82f4 100755 --- a/ci/f125.dir +++ b/ci/f125.dir @@ -1,3 +1,4 @@ 125 0 -$cirilore|0|0|102|0|Rilevamento Ore||| +$rilore|0|0|107|0|Rilevamento Ore||| + diff --git a/ci/f125.trr b/ci/f125.trr index 3fcc31cc1..62bda99bc 100755 --- a/ci/f125.trr +++ b/ci/f125.trr @@ -12,7 +12,7 @@ CODFASE|1|10|0|Codice Fase DADATA|5|8|0|Data Inizio ADATA|5|8|0|Data Fine QTAORE|2|4|0|Quantita' ora -COSTO|4|6|2|Costo Unitario +COSTO|4|10|2|Costo Unitario 2 -TIPO+TIPORA+CODICE+ANNO+MESE+TPORA -TIPO+CODCOSTO+CODCMS+CODFASE +TIPO+TIPORA+CODICE+ANNO+MESE+TPORA| +TIPO+CODCOSTO+CODCMS+CODFASE| diff --git a/ci/rilore.h b/ci/rilore.h new file mode 100755 index 000000000..b9daf5bb1 --- /dev/null +++ b/ci/rilore.h @@ -0,0 +1,18 @@ +#ifndef __RILORE_H +#define __RILORE_H + +#define RILORE_TIPO "TIPO" +#define RILORE_TIPORA "TIPORA" +#define RILORE_CODICE "CODICE" +#define RILORE_ANNO "ANNO" +#define RILORE_MESE "MESE" +#define RILORE_TPORA "TPORA" +#define RILORE_CODCOSTO "CODCOSTO" +#define RILORE_CODCMS "CODCMS" +#define RILORE_CODFASE "CODFASE" +#define RILORE_DADATA "DADATA" +#define RILORE_ADATA "ADATA" +#define RILORE_QTAORE "QTAORE" +#define RILORE_COSTO "COSTO" + +#endif \ No newline at end of file