From 11285fc803ba8d5fd2ea3407ac4644443c2e7def Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 16 Mar 1998 13:55:41 +0000 Subject: [PATCH] cglib02.h Aggiunta classe base e distruttore all'oggetto TSaldo cglib04.cpp Corretto trasferimento righe iva da PC cgprassi.men Aggiunta eliminazione zoppi MI3692 cgsaldac.cpp Implementato metodo TPartita::elimina_pagamento cgsaldac.h Aggiunto metodo TPartita::elimina_pagamento git-svn-id: svn://10.65.10.50/trunk@6365 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cglib02.h | 3 +- cg/cglib04.cpp | 203 ++++++++++++++++++++++++++---------------------- cg/cgprassi.men | 5 +- cg/cgsaldac.cpp | 25 +++++- cg/cgsaldac.h | 1 + 5 files changed, 141 insertions(+), 96 deletions(-) diff --git a/cg/cglib02.h b/cg/cglib02.h index 156531e87..9723fa6d6 100755 --- a/cg/cglib02.h +++ b/cg/cglib02.h @@ -62,7 +62,7 @@ public: enum tipobil { DataLimite=1, UltimaImmissione }; enum tiposal { normale, apertura, chiusura }; -class TSaldo +class TSaldo : public TObject { TLocalisamfile _saldi; @@ -127,6 +127,7 @@ public: // bool prg_mov_eliminati(int i,TConto& c,int d, real& p1, real& p2); TSaldo(); + virtual ~TSaldo() { } }; diff --git a/cg/cglib04.cpp b/cg/cglib04.cpp index cd632deaf..d7a12073e 100755 --- a/cg/cglib04.cpp +++ b/cg/cglib04.cpp @@ -495,23 +495,22 @@ void TTransfer_file::remove_all(bool file_ditta) bool TTransfer_file::read_control_rec() { - TString16 tmp; + TString16 tmp; if (!exist()) return FALSE; _control_rec->spaces(); // va all'inizio del file - fseek (_trasfer, 0L, SEEK_SET); + fseek(_trasfer, 0L, SEEK_SET); // const word letti = fread((char*)(const char*)_control_rec,sizeof(char),sizeH,_trasfer); const word letti = fread(__dep, sizeof(char), sizeH, _trasfer); _control_rec->cut(sizeH); -#ifdef DBG - if (_control_rec->len() > sizeH) error_box("Non e' possibile allocare una stringa di %d in una stringa fissa di %d caratteri", _control_rec->len(),sizeH); -#endif + if (_control_rec->len() > sizeH) + NFCHECK("Non e' possibile allocare una stringa di %d in una stringa fissa di %d caratteri", _control_rec->len(),sizeH); _tiporec = _control_rec->sub(0,2); @@ -1305,7 +1304,7 @@ void TTransfer_file::write_tmp_tabelle(TString& record, bool create) //Quando ricevo la IV direttiva del piano dei conti per evitare che nell'archivio, //in caso di numero romano vuoto, venga memorizzato la stringa letta sul trasfer ("000"), //vuoto la stringa prima di fare la put. - if (sigla == "P2" || sigla == "P3" || sigla == "P1") + if (sigla == "P1" || sigla == "P2" || sigla == "P3") { if (fname == "GRUPPO") { @@ -1344,6 +1343,11 @@ void TTransfer_file::write_tmp_tabelle(TString& record, bool create) if (field == " ") field = "0"; } + if (fname == "IVACOMP") // MI3695 + { + if (field == "00") + field = ""; + } } dep->put(fname, (const char*)field); @@ -3373,6 +3377,7 @@ void TTransfer_file::scrivi_clifo(long nrec) delete _prog; } +// Scrive piano dei conti da SISTEMA void TTransfer_file::scrivi_pcon(long nrec) { const word size = 256; @@ -4457,107 +4462,121 @@ void TTransfer_file::write_righe_contabili(TString& record) _prog->addstatus(1); } +// Scrive righe iva per ricezione PC void TTransfer_file::write_righe_IVA(TString& record) { TString sigla,key; int numfield = 1; - TMappa_trc& trc = mappa(); + TMappa_trc& trc = mappa(); int gruppo; + long nreg = 0; + int nriga = 1; + + _depriva->zero(); + sigla = record.mid(0,2); key.format("%2s%d", (const char*)sigla,numfield); - _depriva->zero(); - - if (trc.is_key((const char *) key)) - { - do - { - int from = trc.from(key); - int to = trc.to(key); - TString fname = trc.field_name(key); - TString field = record.sub(from-1,to); - int flag = trc.flag(key); - int dec = trc.flag_bis(key); - - TRecfield campo (*_depriva,fname); - if (campo.type() == _realfld) - { - TString sign,importo; + while (trc.is_key(key)) + { + int from = trc.from(key); + int to = trc.to(key); + int logic = trc.logicnum(key); + TString fname = trc.field_name(key); + TString field = record.sub(from-1,to); + int flag = trc.flag(key); + int dec = trc.flag_bis(key); + + if (logic == LF_RMOVIVA && _depriva->type(fname) == _realfld) + { + TString sign,importo; - importo = field; - strip_zero(importo); - if (importo.not_empty()) + importo = field; + strip_zero(importo); + if (importo.not_empty()) + { + if (fname == RMI_IMPONIBILE) { - if (fname == RMI_IMPONIBILE) - { - sign = record.sub(64,65); - if (sign == "-") - field = sign << importo; - else - field = importo; - } - if (fname == RMI_IMPOSTA) - { - sign = record.sub(79,80); - if (sign == "-") - field = sign << importo; - else - field = importo; - } + sign = record.sub(64,65); + if (sign == "-") + field = sign << importo; + else + field = importo; + } + if (fname == RMI_IMPOSTA) + { + sign = record.sub(79,80); + if (sign == "-") + field = sign << importo; + else + field = importo; } - else - field = importo; - } - - if (flag == 3) - { - if (dec > 0) - decimali(field,dec); - - real appoggio (field); - field = appoggio.string(); - } - if (fname == RMI_NUMRIG) - { - int nriga = atoi(field); - field.format("%3d", nriga); - } - if (fname == RMI_GRUPPO) - { - gruppo = atoi(field); - field.format("%3d", gruppo); - } - if (fname == RMI_CONTO) - { - int conto = atoi(field); - field.format("%3d", conto); - char tipo = TipoConto(gruppo,conto); - _depriva->put(RMI_TIPOC, tipo); - } - if (fname == RMI_SOTTOCONTO) - { - long sottoc = atol(field); - field.format("%6ld", sottoc); - } - if (fname == RMI_TIPODET || fname == RMI_TIPOCR || fname == RMI_TIPOATT) - if (field == "0") - field = ""; - - if (fname == RMI_NUMREG) - { - long nreg = atol(field); - field.format("%7ld", nreg); - _depriva->put(RMI_ANNOES, _annoes); - _depriva->put(RMI_NUMREG, field); } else - _depriva->put(fname, field); - - numfield++; - key.format("%2s%d", (const char*) sigla,numfield); + field = importo; + } + + if (flag == 3) + { + if (dec > 0) + decimali(field,dec); + + real appoggio (field); + field = appoggio.string(); + } + if (fname == RMI_NUMRIG) + { + nriga = atoi(field); + field.format("%3d", nriga); + } + if (fname == RMI_GRUPPO) + { + gruppo = atoi(field); + field.format("%3d", gruppo); + } + if (fname == RMI_CONTO) + { + int conto = atoi(field); + field.format("%3d", conto); + char tipo = TipoConto(gruppo,conto); + _depriva->put(RMI_TIPOC, tipo); } - while (trc.is_key((const char*) key)); + if (fname == RMI_SOTTOCONTO) + { + long sottoc = atol(field); + field.format("%6ld", sottoc); + } + if (fname == RMI_TIPODET || fname == RMI_TIPOCR || fname == RMI_TIPOATT) + if (field == "0") + field = ""; + + if (fname == RMI_NUMREG) + { + nreg = atol(field); + field.format("%7ld", nreg); + _depriva->put(RMI_ANNOES, _annoes); + _depriva->put(RMI_NUMREG, field); + } + else + { + if (logic == LF_RMOVIVA) + _depriva->put(fname, field); + + // Devo trasferire un campo che in realta' e in testata + if (logic == LF_RMOV && nriga == 1 && field.not_empty()) + { + _tmov->put(MOV_NUMREG, nreg); + if (_tmov->read() == NOERR) + { + _tmov->put(fname, field); + _tmov->rewrite(); + } + } + } + + numfield++; + key.format("%2s%d", (const char*) sigla,numfield); } _triva->zero(); diff --git a/cg/cgprassi.men b/cg/cgprassi.men index 2f9b9c441..33bc8bea7 100755 --- a/cg/cgprassi.men +++ b/cg/cgprassi.men @@ -169,10 +169,11 @@ Item_02 = "Ripristino stampa registri", "cg5 -4", "F" Item_03 = "Aggiornamento Tipo Conto", "cg1 -2 T", "FP" Item_04 = "Aggiornamento Tipo Att. su mov.IVA", "cg1 -2 A", "FP" Item_05 = "Aggiornamento flag op.Intrac.", "cg1 -2 I", "FP" -Item_06 = "Rinumerazione n° Protocollo", "cg1 -2 P", "FP" +Item_06 = "Rinumerazione n. Protocollo", "cg1 -2 P", "FP" Item_07 = "Aggiornamento Codice Attivita'", "cg1 -2 C", "FP" Item_08 = "Riorganizzazione codici esercizio", "cg1 -2 E", "FP" -Item_09 = "Collegamento bilanci", [PRASSICG_025] +Item_09 = "Ricerca righe prima nota errate", "cg1 -2 Z", "FP" +Item_10 = "Collegamento bilanci", [PRASSICG_025] [PRASSICG_019] Caption = "Invio" diff --git a/cg/cgsaldac.cpp b/cg/cgsaldac.cpp index b0d937bff..8e619c220 100755 --- a/cg/cgsaldac.cpp +++ b/cg/cgsaldac.cpp @@ -1245,6 +1245,30 @@ bool TPartita::esiste(int nriga, int nrata, int nrigp) const return scad.exist(nrigp); // Cerca pagamento vero e proprio } +bool TPartita::elimina_pagamento(int nriga, int nrata, int nrigp) +{ + const bool ok = esiste(nriga, nrata, nrigp); + if (ok) + { + if (nriga == UNASSIGNED) + { + TRectype old_pag(_unassigned.row(nrigp)); + old_pag.put(PAGSCA_ACCSAL, "A"); + old_pag.zero(PAGSCA_IMPORTO); + old_pag.zero(PAGSCA_IMPORTOVAL); + old_pag.zero(PAGSCA_RITENUTE); + const TValuta val; + modifica_pagamento(old_pag, val, TRUE); + } + else + { + TRiga_scadenze& scad = rata(nriga, nrata); + scad.elimina_pagamento(nrigp); + } + } + return TRUE; +} + // Ritorna l'importo in lire speso su di una riga contabile TImporto TPartita::importo_speso(long nreg, int numrig, bool valuta, int mode) const { @@ -1769,7 +1793,6 @@ void TPartita::sposta_riga(int from_row, TPartita& part, int to_row) void TPartita::scollega_pagamenti(int r, int s) { CHECKD(s > 0, "Impossibile scollegare la rata ", s); - const TRiga_partite& row = riga(r); for (int i = row.rate(); i >= s; i--) { diff --git a/cg/cgsaldac.h b/cg/cgsaldac.h index 908bf7c17..6b33861b9 100755 --- a/cg/cgsaldac.h +++ b/cg/cgsaldac.h @@ -287,6 +287,7 @@ public: char& new_ap, TImporto& new_abb, TImporto& new_diffcam, bool update); bool modifica_pagamento(const TRectype& new_pag, const TValuta& valuta, bool update); + bool elimina_pagamento(int nriga, int nrata, int nrigp); static void carica_allineamento(); static char allineamento_richiesto(char tipocf);