diff --git a/cg/cg1200.cpp b/cg/cg1200.cpp index 3d3fe9042..252a3bbb9 100755 --- a/cg/cg1200.cpp +++ b/cg/cg1200.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ class CG1200_App : public TPrintapp int _sort; int _interline; bool _mov_only; - TLocalisamfile* _saldi; + TLocalisamfile* _mov; TLocalisamfile* _comuni; // etichette @@ -112,18 +112,18 @@ bool CG1200_App::preprocess_page(int file, int counter) switch (file) { case LF_CLIFO: + { if (_mov_only) { - // se non movimentato - _saldi->curr().zero(); - _saldi->curr().put(SLD_GRUPPO,get_field(LF_CLIFO,CLI_GRUPPO)); - _saldi->curr().put(SLD_CONTO,get_field(LF_CLIFO, CLI_CONTO)); - _saldi->curr().put(SLD_SOTTOCONTO,get_field(LF_CLIFO,CLI_CODCF)); - _saldi->read(); - if (_saldi->curr().get(SLD_GRUPPO) == get_field(LF_CLIFO, CLI_GRUPPO) && - _saldi->curr().get(SLD_CONTO) == get_field(LF_CLIFO,CLI_CONTO) && - _saldi->curr().get(SLD_SOTTOCONTO) == get_field(LF_CLIFO,CLI_CODCF)) - // OSTIA! e' MOVIMENTATO! + const TString16 tipocf(get_field(LF_CLIFO,CLI_TIPOCF)); + const TString16 codice(get_field(LF_CLIFO,CLI_CODCF)); + + _mov->curr().zero(); + _mov->curr().put(MOV_TIPO, tipocf); + _mov->curr().put(MOV_CODCF, codice); + _mov->read(); + if (_mov->get(MOV_TIPO) != tipocf || + _mov->get(MOV_CODCF) != codice) return FALSE; } @@ -157,40 +157,42 @@ bool CG1200_App::preprocess_page(int file, int counter) _name = get_field(LF_CLIFO, CLI_RAGSOC); s = get_field(LF_CLIFO, CLI_CODANAGPER); _cpercip = ""; - if (s.not_empty()) _cpercip << get_field(LF_CLIFO, CLI_TIPOAPER) << " " << s; + const TString16 tipoaper(get_field(LF_CLIFO, CLI_TIPOAPER)); - // che mminghia sarrebbbe chisto aahnn??! - // if (strcmp(get_field(LF_CLIFO, CLI_TIPOAPER),"F") == 0) - // { - // TString surname = _name.mid(30,50); surname.trim(); - // _name = _name.mid(0,30); _name.trim(); - // _name << " " << surname; - // } - break; - case LF_INDSP: - current_cursor()->items(); - if (atoi(get_field(LF_INDSP,IND_CODIND)) == 0) - return FALSE; - _telefono = get_field(LF_INDSP, IND_PTEL); - if (!_telefono.empty()) _telefono << "/"; - _telefono << get_field(LF_INDSP, IND_TEL); - _fax = get_field(LF_INDSP, IND_PFAX); - if (!_fax.empty()) _fax << "/"; - _fax << get_field(LF_INDSP, IND_FAX); - _localita = get_field(LF_INDSP,IND_LOCALITA); - if (!_localita.empty()) - _localita << " - "; - _comuni->curr().zero(); - _comuni->curr().put(COM_STATO,get_field(LF_INDSP,IND_STATO)); - _comuni->curr().put(COM_COM,get_field(LF_INDSP,IND_COM)); - _comuni->read(); - _localita << _comuni->curr().get(COM_DENCOM); - _localita << " "; - _localita << _comuni->curr().get(COM_PROVCOM); - break; - default: - break; + if (s.not_empty()) _cpercip << tipoaper << " " << s; + + if (tipoaper == "F") + { + TString surname = _name.mid(30,50); surname.trim(); + _name = _name.mid(0,30); _name.trim(); + _name << " " << surname; + } } + break; + case LF_INDSP: + current_cursor()->items(); + if (atoi(get_field(LF_INDSP,IND_CODIND)) == 0) + return FALSE; + _telefono = get_field(LF_INDSP, IND_PTEL); + if (!_telefono.empty()) _telefono << "/"; + _telefono << get_field(LF_INDSP, IND_TEL); + _fax = get_field(LF_INDSP, IND_PFAX); + if (!_fax.empty()) _fax << "/"; + _fax << get_field(LF_INDSP, IND_FAX); + _localita = get_field(LF_INDSP,IND_LOCALITA); + if (!_localita.empty()) + _localita << " - "; + _comuni->curr().zero(); + _comuni->curr().put(COM_STATO,get_field(LF_INDSP,IND_STATO)); + _comuni->curr().put(COM_COM,get_field(LF_INDSP,IND_COM)); + _comuni->read(); + _localita << _comuni->curr().get(COM_DENCOM); + _localita << " "; + _localita << _comuni->curr().get(COM_PROVCOM); + break; +default: + break; +} return TRUE; } @@ -630,7 +632,7 @@ void CG1200_App::user_create() _rel->add(LF_INDSP,"TIPOCF=TIPOCF|CODCF=CODCF"); } - _saldi = new TLocalisamfile(LF_SALDI); _saldi->setkey(2); + _mov = new TLocalisamfile(LF_MOV); _mov->setkey(3); _comuni = new TLocalisamfile(LF_COMUNI); _cur_1 = add_cursor(new TCursor(_rel,"",1)); _cur_2 = add_cursor(new TCursor(_rel,"",2)); @@ -647,7 +649,7 @@ bool CG1200_App::destroy() { if (_rel) delete _rel; - delete _saldi; + delete _mov; delete _comuni; return TRUE; } diff --git a/cg/cg1200a.uml b/cg/cg1200a.uml index 75dd773cf..5e185ea07 100755 --- a/cg/cg1200a.uml +++ b/cg/cg1200a.uml @@ -6,22 +6,17 @@ RADIOBUTTON RDB_CG12_TYPE 22 BEGIN PROMPT 4 1 "Oggetto" HELP "Selezionare l'archivio che si desidera stampare" - ITEM "1|Clienti" - MESSAGE CLEAR,2@|SHOW,1@ - ITEM "2|Fornitori" - MESSAGE CLEAR,1@|SHOW,2@ - ITEM "3|Entrambi" - MESSAGE CLEAR,1@|CLEAR,2@ + ITEM "1|Clienti" MESSAGE RESET,2@|SHOW,1@|HIDE,2@ + ITEM "2|Fornitori" MESSAGE RESET,1@|SHOW,2@|HIDE,1@ + ITEM "3|Entrambi" MESSAGE HIDE,1@|HIDE,2@|RESET,1@|RESET,2@ END RADIOBUTTON RDB_CG12_SORT 22 BEGIN PROMPT 4 6 "Ordinamento" HELP "Selezionare il tipo di ordinamento dei record stampati" - ITEM "1|per Codice" - MESSAGE DISABLE,4@|ENABLE,3@|RESET,4@ - ITEM "2|per Ragione Sociale" - MESSAGE DISABLE,3@|ENABLE,4@|RESET,3@ + ITEM "1|per Codice" MESSAGE CLEAR,4@|ENABLE,3@ + ITEM "2|per Ragione Sociale" MESSAGE CLEAR,3@|ENABLE,4@ END GROUPBOX DLG_NULL 35 10