diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index 11130be57..d35e0453a 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -155,17 +155,17 @@ bool annoes(TMask_field& f, KEY k) bool data_inizio(TMask_field& f, KEY k) { - CG3100_application & app = (CG3100_application&)main_app(); + CG3100_application * app = (CG3100_application*)MainApp(); if (k == K_ENTER) { int decidi; int anno = f.mask().get_int (F_ANNO); TDate data = f.mask().get(F_DATAINI); - if (app._masc == "cg3100a") + if (app->_masc == "cg3100a") decidi = f.mask().get_int (F_DECIDI); - if ( anno != 0 && ( (app._masc == "cg3100b") || - ((app._masc == "cg3100a" ) && (decidi == 2)) ) ) + if ( anno != 0 && ( (app->_masc == "cg3100b") || + ((app->_masc == "cg3100a" ) && (decidi == 2)) ) ) { if (!data.ok()) //se la data e' vuota f.mask().field(F_DATAINI).set(InizioEsercizio(anno)); @@ -182,7 +182,7 @@ bool data_inizio(TMask_field& f, KEY k) bool data_fine(TMask_field& f, KEY k) { - CG3100_application & app = (CG3100_application&)main_app(); + CG3100_application * app = (CG3100_application*)MainApp(); if (k == K_ENTER) { @@ -190,18 +190,18 @@ bool data_fine(TMask_field& f, KEY k) int anno = f.mask().get_int (F_ANNO); TDate dataini = f.mask().get(F_DATAINI); TDate datafin = f.mask().get(F_DATAFIN); - if (app._masc == "cg3100a") + if (app->_masc == "cg3100a") decidi = f.mask().get_int (F_DECIDI); - if ( (app._masc == "cg3100b") || - ((app._masc == "cg3100a" ) && (decidi == 2)) ) + if ( (app->_masc == "cg3100b") || + ((app->_masc == "cg3100a" ) && (decidi == 2)) ) if ( dataini.ok() && datafin.ok() ) if (dataini > datafin) { f.error_box("La data iniziale non deve essere superiore alla data finale"); return FALSE; } - if ( anno != 0 && ( (app._masc == "cg3100b") || - ((app._masc == "cg3100a" ) && (decidi == 2)) ) ) + if ( anno != 0 && ( (app->_masc == "cg3100b") || + ((app->_masc == "cg3100a" ) && (decidi == 2)) ) ) { TDate fine = FineEsercizio(anno + 1); if (fine == botime) @@ -411,31 +411,35 @@ const int CodiceRegistro (const char* cod, int anno) bool filter_func_fatture (const TRelation * rel) { - CG3100_application & app = (CG3100_application&)main_app(); + CG3100_application * app = (CG3100_application*)MainApp(); int tipo_reg; int ann_reg; TString cod_reg; - TLocalisamfile& mov = rel->lfile(LF_MOV); - TRectype from (mov.curr()); - TRectype to (mov.curr()); - ann_reg = mov.get_int (MOV_ANNOIVA); - cod_reg = mov.get (MOV_REG); + TLocalisamfile* mov = &(rel->lfile(LF_MOV)); + TRectype from (mov->curr()); + TRectype to (mov->curr()); + ann_reg = mov->get_int (MOV_ANNOIVA); + cod_reg = mov->get (MOV_REG); tipo_reg = CodiceRegistro (cod_reg, ann_reg); from.zero(); to.zero(); - if (app._annoes != 0) //anno esercizio specificato nella maschera + if (app->_annoes != 0) //anno esercizio specificato nella maschera { - from.put(MOV_ANNOES, app._annoes); - to.put(MOV_ANNOES, app._annoes); + from.put(MOV_ANNOES, app->_annoes); + to.put(MOV_ANNOES, app->_annoes); } - from.put(MOV_TIPO, app._tipo_ini); - if (app._codice_ini != 0) - from.put(MOV_CODCF, app._codice_ini); - to.put(MOV_TIPO, app._tipo_fin); - if (app._codice_fin != 0) - to.put(MOV_CODCF, app._codice_fin); + if (app->_data_ini.ok()) + from.put(MOV_DATAREG, app->_data_ini); + from.put(MOV_TIPO, app->_tipo_ini); + if (app->_codice_ini != 0) + from.put(MOV_CODCF, app->_codice_ini); + if (app->_data_fin.ok()) + to.put(MOV_DATAREG, app->_data_fin); + to.put(MOV_TIPO, app->_tipo_fin); + if (app->_codice_fin != 0) + to.put(MOV_CODCF, app->_codice_fin); - if (((mov.curr() >= from) && (mov.curr() <= to)) && + if (((mov->curr() >= from) && (mov->curr() <= to)) && ((tipo_reg == 1) || (tipo_reg == 2))) return TRUE; @@ -444,47 +448,47 @@ bool filter_func_fatture (const TRelation * rel) bool filter_func (const TRelation * rel) { - CG3100_application & app = (CG3100_application&)main_app(); + CG3100_application * app = (CG3100_application*)MainApp(); int tipo_reg, ann_reg; TString cod_reg, causale; - TLocalisamfile& mov = rel->lfile(LF_MOV); - TRectype from (mov.curr()); - TRectype to (mov.curr()); - switch (app._scelta_stampa) + TLocalisamfile* mov = &(rel->lfile(LF_MOV)); + TRectype from (mov->curr()); + TRectype to (mov->curr()); + switch (app->_scelta_stampa) { case 0: - ann_reg = mov.get_int(MOV_ANNOIVA); - causale = mov.get (MOV_CODCAUS); + ann_reg = mov->get_int(MOV_ANNOIVA); + causale = mov->get (MOV_CODCAUS); from.zero(); to.zero(); - if ( (app._decidi == 2) && (app._annoes != 0) ) + if ( (app->_decidi == 2) && (app->_annoes != 0) ) { - from.put(MOV_ANNOES, app._annoes); - to.put(MOV_ANNOES, app._annoes); + from.put(MOV_ANNOES, app->_annoes); + to.put(MOV_ANNOES, app->_annoes); } - from.put(MOV_CODCAUS, app._causale_ini); - to.put(MOV_CODCAUS, app._causale_fin); - from.put(MOV_REG, app._registro_ini); - to.put(MOV_REG, app._registro_fin); - if ((mov.curr() >= from) && (mov.curr() <= to)) + from.put(MOV_CODCAUS, app->_causale_ini); + to.put(MOV_CODCAUS, app->_causale_fin); + from.put(MOV_REG, app->_registro_ini); + to.put(MOV_REG, app->_registro_fin); + if ((mov->curr() >= from) && (mov->curr() <= to)) return TRUE; break; case 1: - cod_reg = mov.get (MOV_REG); - ann_reg = mov.get_int (MOV_ANNOIVA); + cod_reg = mov->get (MOV_REG); + ann_reg = mov->get_int (MOV_ANNOIVA); tipo_reg = CodiceRegistro(cod_reg, ann_reg); - causale = mov.get (MOV_CODCAUS); + causale = mov->get (MOV_CODCAUS); from.zero(); to.zero(); - if ( (app._decidi == 2) && (app._annoes != 0) ) + if ( (app->_decidi == 2) && (app->_annoes != 0) ) { - from.put(MOV_ANNOES, app._annoes); - to.put(MOV_ANNOES, app._annoes); + from.put(MOV_ANNOES, app->_annoes); + to.put(MOV_ANNOES, app->_annoes); } - from.put(MOV_CODCAUS, app._causale_ini); - to.put(MOV_CODCAUS, app._causale_fin); + from.put(MOV_CODCAUS, app->_causale_ini); + to.put(MOV_CODCAUS, app->_causale_fin); - if (((mov.curr() >= from) && (mov.curr() <= to)) && + if (((mov->curr() >= from) && (mov->curr() <= to)) && ((tipo_reg != 1) && (tipo_reg != 2))) return TRUE; @@ -708,9 +712,9 @@ bool CG3100_application::preprocess_page(int file,int counter) //TDate data_corrente (current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG)); _tiporegistro = CodiceRegistro(_registro, _anno); - TLocalisamfile & fl = current_cursor()->file(LF_MOV); - TRectype da (fl.curr()); - TRectype a (fl.curr()); + TLocalisamfile* fl = &(current_cursor()->file(LF_MOV)); + TRectype da (fl->curr()); + TRectype a (fl->curr()); da.zero(); a.zero(); if (_annoes != 0) @@ -723,7 +727,7 @@ bool CG3100_application::preprocess_page(int file,int counter) a.put(MOV_CODCAUS, _causale_fin); a.put(MOV_REG, _registro_fin); - if ((fl.curr() >= da) && (fl.curr() <= a)) + if ((fl->curr() >= da) && (fl->curr() <= a)) //&&((_tiporegistro == 1)||(_tiporegistro == 2))) { _caus->setkey(1); @@ -814,9 +818,9 @@ bool CG3100_application::preprocess_page(int file,int counter) _anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES); _tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC); - TLocalisamfile & fl = current_cursor()->file(LF_MOV); - TRectype da (fl.curr()); - TRectype a (fl.curr()); + TLocalisamfile* fl = &(current_cursor()->file(LF_MOV)); + TRectype da (fl->curr()); + TRectype a (fl->curr()); da.zero(); a.zero(); if (_annoes != 0) @@ -827,7 +831,7 @@ bool CG3100_application::preprocess_page(int file,int counter) da.put(MOV_CODCAUS, _causale_ini); a.put(MOV_CODCAUS, _causale_fin); - if ((fl.curr() >= da) && (fl.curr() <= a)) + if ((fl->curr() >= da) && (fl->curr() <= a)) /* if ((_annoes == _anno) || (_annoes == 0)) if ((_causale >= _causale_ini) && (_causale <= _causale_fin)) @@ -1228,30 +1232,30 @@ int CG3100_application::my_next(TLocalisamfile & mov) int tipo_reg; int ann_reg; - esito = mov.next(); + esito = mov->next(); switch (_scelta_stampa) { case 0: return esito; case 1: - while (!mov.eof()) + while (!mov->eof()) { - cod_reg = mov.get (MOV_REG); - ann_reg = mov.get_int (MOV_ANNOIVA); - causale = mov.get (MOV_CODCAUS); + cod_reg = mov->get (MOV_REG); + ann_reg = mov->get_int (MOV_ANNOIVA); + causale = mov->get (MOV_CODCAUS); if ( ( _annoes != 0l) || ( (causale < (const char*)_causale_ini) || (causale > (const char*)_causale_fin)) ) { - esito=mov.next(); + esito=mov->next(); continue; } tipo_reg = CodiceRegistro (cod_reg, ann_reg); if ( (tipo_reg != 1) && (tipo_reg != 2) ) return esito; - esito=mov.next(); + esito=mov->next(); } break; @@ -1283,8 +1287,9 @@ print_action CG3100_application::postprocess_print(int file,int count) if ((_scelta_stampa == 0)&&(_controllo_mov_errati != 3)&&(_tot_dare != _tot_avere)) set_row(n++, "@11g%s", ERR_77); - TLocalisamfile & mov = current_cursor()->file(LF_MOV); - // nrec = mov.recno(); + TLocalisamfile* mov; + mov=current_cursor()->file(LF_MOV); + // nrec = mov->recno(); pos = current_cursor()->pos(); items = current_cursor()->items(); @@ -1307,10 +1312,10 @@ print_action CG3100_application::postprocess_print(int file,int count) // esito = my_next(mov); // if (esito == NOERR) // { - // long numrec = mov.get_long(MOV_NUMREG); - // datarec = mov.get_date(MOV_DATAREG); + // long numrec = mov->get_long(MOV_NUMREG); + // datarec = mov->get_date(MOV_DATAREG); // } - // mov.readat(nrec); + // mov->readat(nrec); _tot_avere_giornaliero += _tot_avere; _tot_dare_giornaliero += _tot_dare; @@ -1430,7 +1435,8 @@ bool CG3100_application::segnala_errori_ogniriga() if ((_tiporegistro == 1)||(_tiporegistro == 2)) //movimento iva { long record, numreg; - TLocalisamfile & rmoviva = current_cursor()->file(LF_RMOVIVA); + TLocalisamfile* rmoviva = &(current_cursor()->file(LF_RMOVIVA)) + ; _numreg = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG); if (current_cursor()->is_first_match(LF_RMOVIVA)) { @@ -1583,6 +1589,7 @@ bool CG3100_application::set_print(int m) if (msk.run() != K_ENTER) return FALSE; reset_files(); + TLocalisamfile* fl; //_curr1->set_filterfunction (0); _curr1->set_filterfunction (filter_func); _curr2->set_filterfunction (filter_func); @@ -1612,9 +1619,9 @@ bool CG3100_application::set_print(int m) if (!provvis) _curr1->setfilter("(PROVVIS=\"\")"); else _curr1->setfilter(""); - TLocalisamfile & fl = current_cursor()->file(LF_MOV); - TRectype da (fl.curr()); - TRectype a (fl.curr()); + fl = &(current_cursor()->file(LF_MOV)); + TRectype da (fl->curr()); + TRectype a (fl->curr()); da.zero(); a.zero(); da.put(MOV_NUMREG, _numreg_ini); @@ -1631,9 +1638,9 @@ bool CG3100_application::set_print(int m) _curr2->setfilter("(PROVVIS=\"\")"); else _curr2->setfilter(""); - TLocalisamfile & fl = current_cursor()->file(LF_MOV); - TRectype da (fl.curr()); - TRectype a (fl.curr()); + fl = &(current_cursor()->file(LF_MOV)); + TRectype da (fl->curr()); + TRectype a (fl->curr()); da.zero(); a.zero(); if (_data_ini.ok()) @@ -1650,9 +1657,12 @@ bool CG3100_application::set_print(int m) case fatture: { - TLocalisamfile & fl = current_cursor()->file(LF_MOV); + fl = &(current_cursor()->file(LF_MOV)); TString tipo = msk.get(F_TIPOELENCO); - bool movprov = msk.get_bool(F_STAMPAMOVP); + bool movprov = msk.get_bool(F_STAMPAMOVP); + _data_ini = msk.get(F_DATAINI); + _data_fin = msk.get(F_DATAFIN); + _annoes = msk.get_int(F_ANNO); if (tipo=="C" || tipo=="F") { _codice_ini = atol(msk.get(F_CODICEINI)); @@ -1679,8 +1689,8 @@ bool CG3100_application::set_print(int m) if (!movprov) _curr3->setfilter("(PROVVIS=\"\")"); else _curr3->setfilter(""); - TRectype da (fl.curr()); - TRectype a (fl.curr()); + TRectype da (fl->curr()); + TRectype a (fl->curr()); da.zero(); a.zero(); if (_codice_ini != 0) @@ -1688,10 +1698,12 @@ bool CG3100_application::set_print(int m) a.put(MOV_TIPO, _tipo_fin); if (_codice_fin != 0) a.put(MOV_CODCF, _codice_fin); + /* if (_data_ini.ok()) da.put(MOV_DATAREG, _data_ini); if (_data_fin.ok()) a.put(MOV_DATAREG, _data_fin); + */ da.put(MOV_TIPO, _tipo_ini); current_cursor()->setregion(da,a); add_file(LF_MOV); @@ -1701,7 +1713,6 @@ bool CG3100_application::set_print(int m) break; - case movimenti_sezionale: break; @@ -1727,8 +1738,8 @@ void CG3100_application::user_create() _relmov2->add(LF_RMOV, "NUMREG=NUMREG",1); _relmov2->add(LF_RMOVIVA, "NUMREG=NUMREG",1); - _relmov3->add(LF_RMOVIVA, "NUMREG=NUMREG",1); - _relmov3->add(LF_RMOV, "NUMREG=NUMREG",1); + _relmov3->add(LF_RMOVIVA, "NUMREG==NUMREG",1); + _relmov3->add(LF_RMOV, "NUMREG==NUMREG",1); _curr1 = new TCursor (_relmov1, "", 1); _curr2 = new TCursor (_relmov2, "", 2); diff --git a/cg/cg3100a.uml b/cg/cg3100a.uml index bbcd86f55..452ea7199 100755 --- a/cg/cg3100a.uml +++ b/cg/cg3100a.uml @@ -46,9 +46,9 @@ BEGIN PROMPT 30 3 "Scelta stampa " HELP "Indicare il tipo di stampa" ITEM "0|Lista movimenti" - MESSAGE SHOW,F_CONTROLLO|SHOW,F_REGISTROFIN|SHOW,F_REGISTROINI|HIDE,1@|RESET,1@|HIDE,F_STAMPA|RESET,F_STAMPA + MESSAGE SHOW,F_CONTROLLO|SHOW,F_REGISTROFIN|SHOW,F_REGISTROINI|HIDE,1@|RESET,1@ ITEM "1|Lista movimenti di sola prima nota" - MESSAGE HIDE,F_CONTROLLO|RESET,F_CONTROLLO|HIDE,1@|RESET,1@|HIDE,F_REGISTROFIN|RESET,F_REGISTROFIN|HIDE,F_REGISTROINI|RESET,F_REGISTROINI|HIDE,F_STAMPA|RESET,F_STAMPA + MESSAGE HIDE,F_CONTROLLO|RESET,F_CONTROLLO|HIDE,1@|RESET,1@|HIDE,F_REGISTROFIN|RESET,F_REGISTROFIN|HIDE,F_REGISTROINI|RESET,F_REGISTROINI END @@ -56,9 +56,9 @@ LIST F_CONTROLLO 21 BEGIN PROMPT 2 7 "Controllo movimenti errati " HELP "La scelta 1 stampa solo le registrazioni non errate; la scelta 2 permette di listare tutte le registrazioni inserite, segnalando quelle errate; la scelta 3 stampa solo le registrazioni errate" - ITEM "3|No" MESSAGE HIDE,1@|RESET,1@|HIDE,F_STAMPA|RESET,F_STAMPA - ITEM "2|Si" MESSAGE SHOW,1@|SHOW,F_STAMPA - ITEM "1|Stampa movimenti errati" MESSAGE SHOW,1@|SHOW,F_STAMPA + ITEM "3|No" MESSAGE HIDE,1@|RESET,1@ + ITEM "2|Si" MESSAGE SHOW,1@ + ITEM "1|Stampa movimenti errati" MESSAGE SHOW,1@ END TEXT DLG_NULL @@ -158,7 +158,6 @@ BEGIN PROMPT 2 15 "Stampa dal registro iva " USE REG SELECT I0<"3" //INPUT CODTAB[1,5] F_ANNO SELECT - //INPUT CODTAB[1,5] "" INPUT CODTAB[5,7] F_REGISTROINI DISPLAY "Anno" CODTAB[1,4] DISPLAY "Cod. registro iva" CODTAB[5,7] @@ -174,7 +173,6 @@ BEGIN PROMPT 40 15 "al reg. iva " COPY USE F_REGISTROINI //INPUT CODTAB[1,5] F_ANNO SELECT - //INPUT CODTAB[1,5] "" INPUT CODTAB[5,7] F_REGISTROFIN DISPLAY "Anno" CODTAB[1,4] DISPLAY "Cod. registro iva" CODTAB[5,7]