diff --git a/cg/cg0200.cpp b/cg/cg0200.cpp index 56c6f434a..15ca1c976 100755 --- a/cg/cg0200.cpp +++ b/cg/cg0200.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "cg0.h" @@ -29,7 +30,7 @@ class CG0200_application : public TRelation_application { TMask* _msk; TClifoVI *_rel; - TLocalisamfile* _saldi; + TLocalisamfile* _mov; TLocalisamfile* _anag; TLocalisamfile* _fis; TLocalisamfile* _comuni; @@ -61,9 +62,8 @@ protected: void reset_sheet(); void indsp_pack(); void common_f(const TMask& m); - /////////// - - static bool tipo_handler(TMask_field& f, KEY key); + + static bool tipo_handler(TMask_field& f, KEY key); static bool percip_handler(TMask_field& f, KEY key); public: @@ -77,20 +77,16 @@ bool CG0200_application::protected_record(TRectype &rec) { TMask* m = get_mask(MODE_MOD); - const int gruppo = atoi(m->get(F_GRUPPO)); - const int conto = atoi(m->get(F_CONTO)); - const long sottoc = atol(m->get(F_CODCF)); + const TString16 tipocf(m->get(F_TIPOCF)); + const long codice = atol(m->get(F_CODCF)); - _saldi->zero(); - _saldi->put(PCN_GRUPPO, gruppo); - _saldi->put(PCN_CONTO, conto); - _saldi->put(PCN_SOTTOCONTO, sottoc); - _saldi->read(); - - return _saldi->good() && - gruppo ==_saldi->get_int(PCN_GRUPPO) && - conto ==_saldi->get_int(PCN_CONTO) && - sottoc ==_saldi->get_long(PCN_SOTTOCONTO); + _mov->curr().zero(); + _mov->curr().put(MOV_TIPO, tipocf); + _mov->curr().put(MOV_CODCF, codice); + _mov->read(); + return tipocf == _mov->get(MOV_TIPO) && + codice == atol(_mov->get(MOV_CODCF)); + return FALSE; } const char* CG0200_application::get_next_key() @@ -565,7 +561,7 @@ bool CG0200_application::user_create() // initvar e arrmask _rel = new TClifoVI; - _saldi = new TLocalisamfile(LF_SALDI); + _mov = new TLocalisamfile(LF_MOV); _anag = new TLocalisamfile(LF_ANAG); _fis = new TLocalisamfile(LF_ANAGFIS); _pcon = new TLocalisamfile(LF_PCON); @@ -585,7 +581,7 @@ bool CG0200_application::user_create() // initvar e arrmask ind.set_notify(indsp_notify); - _saldi->setkey(2); + _mov->setkey(3); return TRUE; } @@ -593,7 +589,7 @@ bool CG0200_application::user_destroy() // releasev e arrmask { delete _msk; delete _rel; - delete _saldi; + delete _mov; delete _anag; delete _fis; delete _pcon; diff --git a/cg/cg0200.h b/cg/cg0200.h index 36ef2d8d0..5995a6c4a 100755 --- a/cg/cg0200.h +++ b/cg/cg0200.h @@ -129,6 +129,7 @@ #define DLG_RIC 300 #define DLG_CST 301 +#define F_RAGSOCA 302 ////////////////////////////////////// diff --git a/cg/cg3301.cpp b/cg/cg3301.cpp index 3caff08f2..baddb3887 100755 --- a/cg/cg3301.cpp +++ b/cg/cg3301.cpp @@ -167,11 +167,8 @@ const char * SortRecord::fill_dati_dettaglio (const char * tipocf, long codcf) if (tipop == "F") { - int pos = rag.find (" "); - if (pos < 0) pos = rag.find (" "); - if (pos < 0) pos = 30; // se non ci sono spazi prendo i primi 30 - cog = rag.left(pos); - nom = rag.mid (pos+1); + cog = rag.left(30); + nom = rag.mid (31); strcpy (_all->cognome_dett , cog.trim()); strcpy (_all->nome_dett , nom.trim()); //