diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index bd55103fd..7ca6d0e7a 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -24,10 +24,7 @@ #include #include -enum liste { - movimenti=1, - fatture=2, - }; +enum liste { movimenti=1, fatture=2, }; class TListaMov_application : public TPrintapp { @@ -72,7 +69,7 @@ class TListaMov_application : public TPrintapp liste _tipo_lista; word _flags; char _tipoc; - TString _dacodiva, _acodiva; + TString4 _dacodiva, _acodiva; TDecoder _simbval, _descdoc; protected: @@ -93,7 +90,6 @@ protected: bool rmoviva_filter(const TRectype& rmoviva) const; public: - bool user_create(); bool user_destroy(); bool segnala_errori_primariga(); @@ -124,19 +120,21 @@ HIDDEN inline TListaMov_application& app() bool TListaMov_application::annoes_handler(TMask_field& f, KEY k) { - if (k == K_TAB && f.focusdirty()) + if (k == K_TAB && f.focusdirty() && !f.empty()) { const int anno = atoi(f.get()); + TDate dataini, datafin; TEsercizi_contabili esc; - if (esc.exist(anno)) + if (esc.code2range(anno, dataini, datafin)) { - f.mask().set(F_DATAINI, esc[anno].inizio()); + f.mask().set(F_DATAINI, dataini); const int prossimo = esc.next(anno); - const TDate fine = esc[prossimo > 0 ? prossimo : anno].fine(); - f.mask().set(F_DATAFIN, fine); + if (prossimo > 0) + datafin = esc[prossimo].fine(); + f.mask().set(F_DATAFIN, datafin); } } - return TRUE; + return true; } bool TListaMov_application::data_inizio(TMask_field& f, KEY k) @@ -208,7 +206,7 @@ bool TListaMov_application::data_fine(TMask_field& f, KEY k) return TRUE; } -bool TListaMov_application::RicercaDoc(const char * tipo) +bool TListaMov_application::RicercaDoc(const char* tipo) { const TRectype& tab_tpd = cache().get(TAB_TPD, tipo); return !tab_tpd.empty(); @@ -221,17 +219,16 @@ void TListaMov_application::compila_clifo() key.add(_codcf); const TRectype& clifo = cache().get(LF_CLIFO, key); - char tipoa = clifo.get_char("TIPOAPER"); - _alleg = clifo.get_int(CLI_ALLEG); - _statocf = clifo.get(CLI_STATOCF); - _comcf = clifo.get(CLI_COMCF); - _ragsoc = clifo.get(CLI_RAGSOC); + char tipoa = clifo.get_char(CLI_TIPOAPER); + _alleg = clifo.get_int(CLI_ALLEG); + _statocf = clifo.get(CLI_STATOCF); + _comcf = clifo.get(CLI_COMCF); + _ragsoc = clifo.get(CLI_RAGSOC); if (tipoa == 'F') { TString80 cognome, nome; - cognome = _ragsoc.mid(0,30); - nome = _ragsoc.mid(30,20); - cognome.trim(); nome.trim(); + cognome = _ragsoc.mid(0, 30); cognome.trim(); + nome = _ragsoc.mid(30,20); nome.trim(); _ragsoc = cognome; _ragsoc << ' ' << nome; } @@ -2458,18 +2455,14 @@ TListaMov_application::TListaMov_application(char tipost) int cg3100(int argc, char* argv[]) { - const char tipo = argc > 2 ? *argv[2] : 'M'; + const char tipo = argc > 2 ? toupper(*argv[2]) : 'M'; TListaMov_application a(tipo); - const char* title; + const char* title = NULL; switch (tipo) { - case 'C': - title = TR("Lista fatture clienti/fornitori"); - break; - default: - title = TR("Lista movimenti"); - break; + case 'C': title = TR("Lista fatture clienti/fornitori"); break; + default : title = TR("Lista movimenti"); break; } a.run(argc, argv, title); return TRUE; diff --git a/cg/cg3100b.uml b/cg/cg3100b.uml index f6fcac53d..4dffe327e 100755 --- a/cg/cg3100b.uml +++ b/cg/cg3100b.uml @@ -2,20 +2,11 @@ TOOLBAR "topbar" 0 0 0 2 -BUTTON DLG_PRINT 10 2 -BEGIN - PROMPT -12 -11 "~Stampa" - MESSAGE EXIT,K_ENTER -END - -BUTTON DLG_QUIT 10 2 -BEGIN - PROMPT -22 -11 "" -END +#include ENDPAGE -PAGE "Lista Fatture" -1 -1 73 17 +PAGE "Lista Fatture" 0 2 0 0 NUMBER F_CODDITTA 5 BEGIN @@ -47,14 +38,14 @@ NUMBER F_ANNO 4 BEGIN PROMPT 2 4 "Codice esercizio " HELP "Codice esercizio per cui si vuole la stampa" - USE ESC KEY 1 + USE ESC CHECKTYPE NORMAL INPUT CODTAB F_ANNO DISPLAY "Codice" CODTAB DISPLAY "Data inizio esercizio" D0 DISPLAY "Data fine esercizio" D1 OUTPUT F_ANNO CODTAB - FLAGS "RZ" + FLAGS "Z" ADD RUN cg0 -5 esc END diff --git a/cg/cgp1100.cpp b/cg/cgp1100.cpp index b12d0e113..a1009f55e 100755 --- a/cg/cgp1100.cpp +++ b/cg/cgp1100.cpp @@ -169,14 +169,15 @@ int TMastrini_application::righe_rimaste_da_stampare() if (_nummast == 2) { + const int pfl = printer().formlen(); if (printer().rows_left() != 0) { if ( (_conta_mastrini % 2) != 0) { - if ( (printer().formlen() % 2) != 0) - righe_rimaste = printer().rows_left() - (printer().formlen() / 2) + 1; //- 33; + if ( pfl % 2 ) + righe_rimaste = printer().rows_left() - (pfl / 2) + 1; //- 33; else - righe_rimaste = printer().rows_left() - (printer().formlen() / 2); + righe_rimaste = printer().rows_left() - (pfl / 2); } else righe_rimaste = printer().rows_left(); @@ -184,13 +185,13 @@ int TMastrini_application::righe_rimaste_da_stampare() else { if ( (_conta_mastrini % 2) != 0) - righe_rimaste = printer().formlen() / 2; //32; + righe_rimaste = pfl / 2; //32; else { - if ( (printer().formlen() % 2) != 0) - righe_rimaste = (printer().formlen() / 2) + 1; //33; + if (pfl % 2) + righe_rimaste = (pfl / 2) + 1; //33; else - righe_rimaste = printer().formlen / 2; + righe_rimaste = pfl / 2; } } }