From 2ef3a41051c06fbc845f2855451696e6230871fd Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 18 Oct 1994 17:51:25 +0000 Subject: [PATCH] Riepilogo gruppi e conti : corretto errore di compilazione Chiusura e apertura conti : corretto errore di compilazione Stampa bilancio IV direttiva CEE : Aggiunto sbilancio conti d' ordine attivi e passivi se diverso da zero Lista movimenti : aggiunti campi sulle ricerche Visualizzazione saldi : finito git-svn-id: svn://10.65.10.50/trunk@393 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg1600.cpp | 97 +++-- cg/cg3100.cpp | 539 +++++++++++++++---------- cg/cg3100a.uml | 213 +++++----- cg/cg3100b.uml | 18 +- cg/cg3100c.uml | 15 +- cg/cg3500.cpp | 243 +++++++----- cg/cg4600.cpp | 12 +- cg/cg4600a.uml | 4 +- cg/cg5200.cpp | 1032 ++++++++++++++++++++++++++---------------------- cg/cg5200.h | 22 +- cg/cg5200a.uml | 717 +++++++++++++++++---------------- 11 files changed, 1625 insertions(+), 1287 deletions(-) diff --git a/cg/cg1600.cpp b/cg/cg1600.cpp index 076aa466b..ac1e282f5 100755 --- a/cg/cg1600.cpp +++ b/cg/cg1600.cpp @@ -311,6 +311,7 @@ class CG1600_application : public TPrintapp real _tot_parz_prg_a,_tot_parz_mov_d,_tot_parz_mov_a; int _i; bool _reset_righe_stampa,_totale_attivita_gia_stampato,_totale_passivita_gia_stampato,_statopatr_no_stamp; + bool _sbilancio_ordine; TString _causale_ap, _causale_chi; public: @@ -466,7 +467,7 @@ bool data_limite (TMask_field& f, KEY key) tipobil = atoi(m.get(F_TIPOBIL)); tipostampa = atoi(m.get(F_TIPOSTAMPA)); - int annoese = m.get_int(F_ANNOESE); + long annoese = m.get_long(F_ANNOESE); if ((tipobil == 1) && (tipostampa == 1)) { @@ -2012,6 +2013,7 @@ if (tasto == K_ENTER) _statopatr_no_stamp = TRUE; _diffprod_fatto = TRUE; _risimp_fatto = TRUE; + _sbilancio_ordine = FALSE; _sez_stamp = ' '; _let_stamp = ' '; @@ -2407,10 +2409,12 @@ void CG1600_application::stampa_totali() _i++; real totale = _totale_ordine_attivo - _totale_ordine_passivo; if (totale != ZERO) - { + { + set_row (_i++,"@0g%c", app); set_row (_i++,"@0gSALDO CONTI D' ORDINE"); set_row (_i,"@0gSBILANCIO"); - set_row (_i++,"@86g%r", &totale); + set_row (_i++,"@86g%r", &totale); + _sbilancio_ordine = TRUE; } _totale_ordine_passivo = ZERO; _totale_ordine_attivo = ZERO; @@ -2420,12 +2424,24 @@ void CG1600_application::stampa_totali() if (_sez_stamp == '2') { char app = ' '; - set_row (_i++,"@0g%c", app); - set_row (_i++,"@0gSALDO STATO PATRIMONIALE"); - set_row (_i,"@0gSBILANCIO (ATTIVO - PASSIVO)"); - _totale_patrimoniale = _totale_attivita - _totale_passivita; - set_row (_i++,"@86g%r", &_totale_patrimoniale); - _totale_patrimoniale = ZERO; + _totale_patrimoniale = _totale_attivita - _totale_passivita; + real totale = _totale_ordine_attivo - _totale_ordine_passivo; + if (totale != ZERO && !_sbilancio_ordine) + { + set_row (_i++,"@0g%c", app); + set_row (_i++,"@0gSALDO CONTI D' ORDINE"); + set_row (_i,"@0gSBILANCIO"); + set_row (_i++,"@86g%r", &totale); + } + if (_totale_patrimoniale != ZERO) + { + set_row (_i++,"@0g%c", app); + set_row (_i++,"@0gSALDO STATO PATRIMONIALE"); + set_row (_i,"@0gSBILANCIO (ATTIVO - PASSIVO)"); + //_totale_patrimoniale = _totale_attivita - _totale_passivita; + set_row (_i++,"@86g%r", &_totale_patrimoniale); + _totale_patrimoniale = ZERO; + } } if (_sez_stamp == '5') { @@ -2452,10 +2468,13 @@ void CG1600_application::stampa_totali() } char app = ' '; - set_row (_i++,"@0g%c", app); - set_row (_i,"@0gRISULTATO CONTO ECONOMICO"); - set_row (_i++,"@86g%r", &_totale_economico); - _totale_economico = ZERO; + set_row (_i++,"@0g%c", app); + if (_totale_economico != ZERO) + { + set_row (_i,"@0gRISULTATO CONTO ECONOMICO"); + set_row (_i++,"@86g%r", &_totale_economico); + _totale_economico = ZERO; + } } _cont_gcs = 0; _cont_num = 0; @@ -2850,11 +2869,13 @@ void CG1600_application::stampa_totali_con_raffronto() real totale = _totale_ordine_attivo - _totale_ordine_passivo; real tot_raf = _totale_ordine_attivo_raf - _totale_ordine_passivo_raf; if (totale != ZERO || tot_raf != ZERO) - { + { + set_row (_i++,"@0g%c", app); set_row (_i++,"@0gSALDO CONTI D' ORDINE"); set_row (_i,"@0gSBILANCIO"); set_row (_i,"@86g%r", &totale); - set_row (_i++,"@112g%r", &tot_raf); + set_row (_i++,"@112g%r", &tot_raf); + _sbilancio_ordine = TRUE; } _totale_ordine_attivo = ZERO; _totale_ordine_attivo_raf = ZERO; @@ -2865,16 +2886,31 @@ void CG1600_application::stampa_totali_con_raffronto() if (_sez_stamp == '2') { - char app = ' '; - set_row (_i++,"@0g%c", app); - set_row (_i++,"@0gSALDO STATO PATRIMONIALE"); - set_row (_i,"@0gSBILANCIO (ATTIVO - PASSIVO)"); + char app = ' '; _totale_patrimoniale = _totale_attivita - _totale_passivita; _totale_patrim_raf = _totale_attiv_raf - _totale_passiv_raf; - set_row (_i,"@86g%r", &_totale_patrimoniale); - set_row (_i++,"@112g%r", &_totale_patrim_raf); - _totale_patrimoniale = 0; - _totale_patrim_raf = 0; + real totale = _totale_ordine_attivo - _totale_ordine_passivo; + real tot_raf = _totale_ordine_attivo_raf - _totale_ordine_passivo_raf; + if ((totale != ZERO || tot_raf != ZERO) && !_sbilancio_ordine) + { + set_row (_i++,"@0g%c", app); + set_row (_i++,"@0gSALDO CONTI D' ORDINE"); + set_row (_i,"@0gSBILANCIO"); + set_row (_i,"@86g%r", &totale); + set_row (_i++,"@112g%r", &tot_raf); + } + if (_totale_patrimoniale != ZERO || _totale_patrim_raf != ZERO) + { + set_row (_i++,"@0g%c", app); + set_row (_i++,"@0gSALDO STATO PATRIMONIALE"); + set_row (_i,"@0gSBILANCIO (ATTIVO - PASSIVO)"); + //_totale_patrimoniale = _totale_attivita - _totale_passivita; + //_totale_patrim_raf = _totale_attiv_raf - _totale_passiv_raf; + set_row (_i,"@86g%r", &_totale_patrimoniale); + set_row (_i++,"@112g%r", &_totale_patrim_raf); + _totale_patrimoniale = 0; + _totale_patrim_raf = 0; + } } if (_sez_stamp == '5') { @@ -2903,12 +2939,15 @@ void CG1600_application::stampa_totali_con_raffronto() } } char app = ' '; - set_row (_i++,"@0g%c", app); - set_row (_i,"@0gRISULTATO CONTO ECONOMICO"); - set_row (_i,"@86g%r", &_totale_economico); - set_row (_i++,"@112g%r", &_totale_economico_raf); - _totale_economico = 0; - _totale_economico_raf = 0; + set_row (_i++,"@0g%c", app); + if (_totale_economico != ZERO || _totale_economico_raf != ZERO) + { + set_row (_i,"@0gRISULTATO CONTO ECONOMICO"); + set_row (_i,"@86g%r", &_totale_economico); + set_row (_i++,"@112g%r", &_totale_economico_raf); + _totale_economico = 0; + _totale_economico_raf = 0; + } } _cont_gcs = 0; _cont_num = 0; diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index 25e35d51a..41c0a0b61 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -8,6 +8,8 @@ #include #include +#include + #include #include #include @@ -23,16 +25,12 @@ #include "cg3100.h" #include "cglib03.h" -//const MAXSTR = 128; -//static char __tmp [MAXSTR]; -//static TFixed_string tmp (__tmp, MAXSTR); - static TString256 TMP; enum liste { movimenti=1, fatture=2, - movimenti_sezionale=3 + movimenti_sezionale=3 }; bool filter_func (const TRelation *); @@ -59,10 +57,10 @@ class CG3100_application : public TPrintapp TString _totalegen_dare, _totalegen_avere, _tipo_ini, _masc, _causale; TString _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin; TString _tipoatt, _tipo_elenco,_tipo_clifo_prec,_cod,_tipoelsucc; - TString _tipo_clifo_precedente; - TString _appoggio, _tipodoc, _tipodocumento, _err1, _msg, _err, _err2; + TString _appoggio, _tipodoc, _tipodocumento, _err1, _msg, _err, _err2, _err3; TString _ragsoc, _indcf, _civcf, _paiv, _codcaus, _dencom, _provcom, _cofi; TString _capcf, _codval, _simbolo, _statocf, _comcf, _tipo_fin; + TString _reg_causale; long _documenti, _codice_ini, _codice_fin, _numero_reg,_codcf; long _numreg, _numreg_fin, _numreg_ini, _codalleg, _numeroregp,_codclifosucc; long _codcf_prec, _numr; @@ -100,7 +98,7 @@ public: void incrementa_totali(); void compila_clifo(); void compila_comuni(); - int my_next (TLocalisamfile&); + int my_next (TLocalisamfile*); CG3100_application() {} }; @@ -140,7 +138,6 @@ TDate FineEsercizio(int anno) bool annoes(TMask_field& f, KEY k) { -// if ( (k == K_SPACE) || (k == K_TAB) ) if (k == K_TAB) { int anno = f.mask().get_int (F_ANNO); @@ -150,7 +147,7 @@ bool annoes(TMask_field& f, KEY k) TDate fine = FineEsercizio(anno + 1); if (fine == botime) fine = FineEsercizio(anno); - f.mask().field(F_DATAFIN).set(fine); + f.mask().field(F_DATAFIN).set(fine); } } return TRUE; @@ -158,7 +155,7 @@ 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&)main_app(); if (k == K_ENTER) { @@ -171,7 +168,7 @@ bool data_inizio(TMask_field& f, KEY k) ((app._masc == "cg3100a" ) && (decidi == 2)) ) ) { if (!data.ok()) //se la data e' vuota - f.mask().field(F_DATAINI).set(InizioEsercizio(anno)); + f.mask().field(F_DATAINI).set(InizioEsercizio(anno)); else if (data < InizioEsercizio(anno)) { @@ -210,7 +207,7 @@ bool data_fine(TMask_field& f, KEY k) if (fine == botime) fine = FineEsercizio(anno); if (!datafin.ok()) //se la data e' vuota - f.mask().field(F_DATAFIN).set(fine); + f.mask().field(F_DATAFIN).set(fine); else if (datafin > fine) { @@ -231,16 +228,16 @@ void CG3100_application::compila_clifo() _clifo->read(); if (_clifo->bad()) _clifo->zero(); - _alleg = _clifo->get_int(CLI_ALLEG); - _statocf = _clifo->get(CLI_STATOCF); - _comcf = _clifo->get(CLI_COMCF); - _ragsoc = _clifo->get(CLI_RAGSOC); - _indcf = _clifo->get(CLI_INDCF); - _civcf = _clifo->get(CLI_CIVCF); - _paiv = _clifo->get(CLI_PAIV); - _capcf = _clifo->get(CLI_CAPCF); - _cofi = _clifo->get(CLI_COFI); - _codalleg = _clifo->get_long(CLI_CODALLEG); + _alleg = _clifo->curr().get_int(CLI_ALLEG); + _statocf = _clifo->curr().get(CLI_STATOCF); + _comcf = _clifo->curr().get(CLI_COMCF); + _ragsoc = _clifo->curr().get(CLI_RAGSOC); + _indcf = _clifo->curr().get(CLI_INDCF); + _civcf = _clifo->curr().get(CLI_CIVCF); + _paiv = _clifo->curr().get(CLI_PAIV); + _capcf = _clifo->curr().get(CLI_CAPCF); + _cofi = _clifo->curr().get(CLI_COFI); + _codalleg = _clifo->curr().get_long(CLI_CODALLEG); } void CG3100_application::compila_comuni() @@ -397,7 +394,7 @@ const int CodiceRegistro (const char* cod, int anno) codtab.format("%4d%-3s", anno, cod); //sprintf (__tmp, "%04d%-3s", anno, cod); //TString codtab (__tmp); - int tipo_reg; + int tipo_reg; tab_reg.zero(); @@ -418,7 +415,7 @@ bool filter_func_fatture (const TRelation * rel) int tipo_reg; int ann_reg; TString cod_reg; - TLocalisamfile & mov = rel->lfile(LF_MOV); + TLocalisamfile& mov = rel->lfile(LF_MOV); TRectype from (mov.curr()); TRectype to (mov.curr()); ann_reg = mov.get_int (MOV_ANNOIVA); @@ -454,7 +451,7 @@ bool filter_func (const TRelation * rel) CG3100_application & app = (CG3100_application&)main_app(); int tipo_reg, ann_reg; TString cod_reg, causale; - TLocalisamfile & mov = rel->lfile(LF_MOV); + TLocalisamfile& mov = rel->lfile(LF_MOV); TRectype from (mov.curr()); TRectype to (mov.curr()); switch (app._scelta_stampa) @@ -505,78 +502,98 @@ bool filter_func (const TRelation * rel) void CG3100_application::stampa_errori_rmov() { - if (_scelta_stampa == 0) //lista movimenti - { if (_controllo_mov_errati != 3) { _nr = 2; - if (_descr == "") + if ( _tiporegistro != 1 && _tiporegistro != 2 ) { + if (_err == ERR_64) + { + reset_row(_nr); + set_row(_nr++, "@11g%s", ERR_64); + } + if (_err1 == ERR_66) + { reset_row(_nr); set_row(_nr++, "@11g%s", ERR_66); + } + if (_err2 == ERR_75) + { + reset_row(_nr); + set_row(_nr++, "@11g%s", ERR_75); + } } - if (_stampa_mess_alleg_iva) - { - if (!_alleg_causale) - { - reset_row(_nr); - set_row(_nr++, "@11g%61s", MSG_20); - } + if ((_tiporegistro == 1)||(_tiporegistro == 2)) + { if ((_alleg == 1)||(_alleg == 2)) { reset_row(_nr); set_row(_nr++, "@11g%s", MSG_31); } - } - if (_err2 == ERR_1) - { - reset_row(_nr); - set_row(_nr++, "@11g%s",ERR_1); - } - if (_err == ERR_2) - { - reset_row(_nr); - set_row(_nr++, "@11g%s",ERR_2); - } - if (_msg == MSG_54) - { - reset_row(_nr); - set_row(_nr++, "@11g%s",MSG_54); - } - if (_err1 == ERR_09) - { - reset_row(_nr); - set_row(_nr, "@11g%s",ERR_09); - } + if (_err2 == ERR_1) + { + reset_row(_nr); + set_row(_nr++, "@11g%s",ERR_1); + } + if (_err == ERR_2) + { + reset_row(_nr); + set_row(_nr++, "@11g%s",ERR_2); + } + if (_err3 == ERR_4) + { + reset_row(_nr); + set_row(_nr++, "@11g%s",ERR_4); + } + if (_msg == MSG_54) + { + reset_row(_nr); + set_row(_nr++, "@11g%s",MSG_54); + } + if (_err1 == ERR_09) + { + reset_row(_nr); + set_row(_nr, "@11g%s",ERR_09); + } + } } - } - } void CG3100_application::stampa_errori_mov() { - if (_scelta_stampa == 0) - { if (_controllo_mov_errati != 3) { //aggiungere il controllo anno di competenza - - if ( (_tiporegistro == 1)||(_tiporegistro == 2) ) //controlli su mov. iva + + if ( _tiporegistro == 1 || _tiporegistro == 2 ) //controlli su mov. iva { - if (_caus->bad()) - set_row(++_n, "@11g%s", ERR_16); + if (_caus->empty()) + set_row(++_n, "@11g%s", ERR_16); if (_tipodocumento != _tipodoc) set_row(++_n, "@11g%s", MSG_19); if ((_stampa_mess_alleg_iva)&&(!_alleg_causale)) set_row(++_n, "@11g%s", MSG_20); - + if (_registro == "") set_row(++_n, "@11g%s", ERR_21); - } + } + if ( _tiporegistro != 1 && _tiporegistro != 2 ) //controlli su mov. di prima nota + { + if (_registro.not_empty()) + if (CodiceRegistro(_registro,_anno) == 0) + set_row(++_n, "@11g%s", ERR_62); + if (_causale.not_empty()) + { + if (_caus->empty()) + set_row(++_n, "@11g%s", ERR_16); + else + if ( _reg_causale != _registro && _registro.not_empty() ) + set_row(++_n, "@11g%s", ERR_59); + } + } } - } } void CG3100_application::set_page(int file, int count) @@ -590,13 +607,13 @@ void CG3100_application::set_page(int file, int count) { _nr = 1; set_row(_nr,"@3n",FLD(LF_RMOV,RMV_NUMRIG)); - // set_row(_nr,"@5g@3s",FLD(LF_MOV,MOV_CODCAUS)); - // set_row(_nr,"@9g#.20t", &_descr_causale); - set_row(_nr,"@30g@24s",FLD(LF_RMOV,RMV_DESCR)); + // set_row(_nr,"@5g@3s",FLD(LF_MOV,MOV_CODCAUS)); + // set_row(_nr,"@9g#.20t", &_descr_causale); + set_row(_nr,"@30g@24s@r",FLD(LF_RMOV,RMV_DESCR)); set_row(_nr,"@56g@4n",FLD(LF_RMOV,RMV_GRUPPO)); set_row(_nr,"@61g@3n",FLD(LF_RMOV,RMV_CONTO)); set_row(_nr,"@65g@6n",FLD(LF_RMOV,RMV_SOTTOCONTO)); - set_row(_nr,"@72g#.20t",&_descr); + set_row(_nr,"@72g#.20t@r",&_descr); _appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE); if ((_appoggio=="D")||(_appoggio=="d")) set_row(_nr,"@93g@pN",FLD(LF_RMOV,RMV_IMPORTO,"###.###.###.###")); @@ -606,11 +623,14 @@ void CG3100_application::set_page(int file, int count) } else if (file == LF_MOV) { + TString dep(132); + dep = ""; _n = 1; + set_row (_n++,(const char*)dep); set_row (_n, "Operazione n. @18g@7n", FLD(LF_MOV,MOV_NUMREG)); //set_row (_n, "@23g@3s",FLD(LF_MOV,MOV_CODCAUS)); set_row (_n, "@26gdel@30g@d",FLD(LF_MOV,MOV_DATAREG)); - set_row (_n, "@41g@40s",FLD(LF_MOV,MOV_DESCR)); + set_row (_n, "@41g@40s@r",FLD(LF_MOV,MOV_DESCR)); set_row (_n, "@82gdoc. @87g@7s",FLD(LF_MOV,MOV_NUMDOC)); set_row (_n, "@95gdel@99g@d", FLD(LF_MOV,MOV_DATADOC)); TString16 reg = current_cursor()->curr(LF_MOV).get(MOV_REG); @@ -637,7 +657,6 @@ void CG3100_application::set_page(int file, int count) default: break; } - } void CG3100_application::stampa_intestazione() @@ -646,23 +665,23 @@ void CG3100_application::stampa_intestazione() sep = ""; set_row (1,(const char*)sep); if (_tipo_elenco == "C") - set_row (2, "Cliente@9g@6n", FLD(LF_MOV,MOV_CODCF)); + set_row (2, "@bCliente@9g@6n", FLD(LF_MOV,MOV_CODCF)); else - set_row (2, "Fornitore@12g@6n", FLD(LF_MOV,MOV_CODCF)); - set_row (2, "@18g#35t", &_ragsoc); - set_row (2, "@54gInd #29t", &_indcf); - set_row (2, "@87g#10t", &_civcf); - set_row (2, "@98gP.I. #11t", &_paiv); + set_row (2, "@bFornitore@12g@6n", FLD(LF_MOV,MOV_CODCF)); + set_row (2, "@b@18g#35t", &_ragsoc); + set_row (2, "@b@54gInd #29t", &_indcf); + set_row (2, "@b@87g#10t", &_civcf); + set_row (2, "@b@98gP.I. #11t", &_paiv); if (_alleg == 0) - set_row (2, "@121gAllegato NO"); + set_row (2, "@b@121gAllegato NO"); else - set_row (2, "@121gAllegato SI"); - set_row (3, "@54gCap #5t", &_capcf); - set_row (3,"@64gLoc #20t", &_dencom); - set_row (3,"@89gPr #5t", &_provcom); - set_row (3, "@98gC.F. #16t", &_cofi); + set_row (2, "@b@121gAllegato SI"); + set_row (3, "@b@54gCap #5t", &_capcf); + set_row (3,"@b@64gLoc #20t", &_dencom); + set_row (3,"@b@89gPr #5t", &_provcom); + set_row (3, "@b@98gC.F. #16t", &_cofi); if (_alleg == 0) - set_row (3, "@120gRifer@126g#6d", &_codalleg); + set_row (3, "@b@120gRifer@126g#6d", &_codalleg); } bool CG3100_application::preprocess_page(int file,int counter) @@ -693,7 +712,7 @@ 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); + TLocalisamfile & fl = current_cursor()->file(LF_MOV); TRectype da (fl.curr()); TRectype a (fl.curr()); da.zero(); @@ -716,17 +735,20 @@ bool CG3100_application::preprocess_page(int file,int counter) _caus->read(); if (_caus->bad()) _caus->curr().zero(); + _reg_causale = _caus->curr().get(CAU_REG); _descr_causale = _caus->curr().get(CAU_DESCR); _alleg_causale = _caus->curr().get_bool(CAU_ALLEG); _tipodocumento = _caus->curr().get(CAU_TIPODOC); - if ( ((_controllo_mov_errati == 1)&&(segnala_errori_primariga())) - || (_controllo_mov_errati == 2)) + bool controlla = segnala_errori_primariga(); + + if ( (_controllo_mov_errati == 1 && controlla) + || _controllo_mov_errati == 2 ) { stampa_errori_mov(); return TRUE; } - else if ((_controllo_mov_errati == 1)&&(!segnala_errori_primariga())) + else if ((_controllo_mov_errati == 1)&&(!controlla)) return FALSE; else if (_controllo_mov_errati == 3) return TRUE; @@ -737,11 +759,13 @@ bool CG3100_application::preprocess_page(int file,int counter) if (!_causale_gia_stampata) { set_row(_nr,"@4g%3s", (const char*) _causale); - set_row(_nr,"@8g%.20s", (const char*) _descr_causale); + set_row(_nr,"@8g%.20s@r", (const char*) _descr_causale); _causale_gia_stampata = TRUE; } - - if (((_controllo_mov_errati == 1)&&(segnala_errori_ogniriga()))||(_controllo_mov_errati == 2)||(_controllo_mov_errati == 3)) + + bool verifica = segnala_errori_ogniriga(); + + if (((_controllo_mov_errati == 1)&&(verifica))||(_controllo_mov_errati == 2)||(_controllo_mov_errati == 3)) { int gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO); int conto = current_cursor()->curr(LF_RMOV).get_int(RMV_CONTO); @@ -770,7 +794,7 @@ bool CG3100_application::preprocess_page(int file,int counter) } else if ((_stampa_parte_iva)&&(file == LF_RMOVIVA)) { - const TRectype iva(current_cursor()->file(LF_RMOVIVA).curr()); + TRectype iva(current_cursor()->file(LF_RMOVIVA).curr()); _impo = iva.get_real(RMI_IMPONIBILE); _impos = iva.get_real(RMI_IMPOSTA); _tipocr = iva.get_int(RMI_TIPOCR); @@ -794,7 +818,7 @@ 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); + TLocalisamfile & fl = current_cursor()->file(LF_MOV); TRectype da (fl.curr()); TRectype a (fl.curr()); da.zero(); @@ -811,7 +835,7 @@ bool CG3100_application::preprocess_page(int file,int counter) /* if ((_annoes == _anno) || (_annoes == 0)) if ((_causale >= _causale_ini) && (_causale <= _causale_fin)) - */ + */ { _caus->setkey(1); _caus->curr().put(CAU_CODCAUS,_causale); @@ -874,18 +898,14 @@ bool CG3100_application::preprocess_page(int file,int counter) _tipodoc = cur->curr(LF_MOV).get(MOV_TIPODOC); _codval = cur->curr(LF_MOV).get(MOV_CODVAL); _totdoc = cur->curr(LF_MOV).get_real(MOV_TOTDOC); - /* - if ((_tipo_elenco != _tipo_clifo_precedente) && - (_tipo_clifo_precedente != "") && _salto_pagina) - printer().formfeed(); - */ + if ((_tipo_elenco != _tipo_clifo_prec) && (_tipo_clifo_prec != "") && _salto_pagina) printer().formfeed(); - TLocalisamfile& file = cur->file(LF_MOV); - TRectype da (file.curr()); - TRectype a (file.curr()); + TLocalisamfile & file = cur->file(LF_MOV); + TRectype da (file->curr()); + TRectype a (file->curr()); da.zero(); a.zero(); @@ -905,7 +925,7 @@ bool CG3100_application::preprocess_page(int file,int counter) if (_codice_fin != 0) a.put(MOV_CODCF, _codice_fin); - if ((file.curr() >= da) && (file.curr() <= a)) + if ((file->curr() >= da) && (file->curr() <= a)) { compila_clifo(); compila_comuni(); @@ -981,7 +1001,7 @@ bool CG3100_application::preprocess_page(int file,int counter) set_row(1,"@42g@6,rs",FLD(LF_MOV,MOV_NUMDOC)); set_row(1,"@49g@3s",FLD(LF_MOV,MOV_CODCAUS)); set_row(1,"@53g@2s",FLD(LF_MOV,MOV_TIPODOC)); - set_row(1,"@56g%.11s", (const char *)_descr_doc); + set_row(1,"@56g%.12s@r", (const char *)_descr_doc); set_row(1,"@68g@pN",FLD(LF_MOV,MOV_TOTDOC,"###.###.###.###")); set_row(1,"@84g@pN",FLD(LF_RMOVIVA,RMI_IMPONIBILE,"###.###.###.###")); set_row(1,"@101g@4s",FLD(LF_RMOVIVA,RMI_CODIVA)); @@ -1037,11 +1057,11 @@ print_action CG3100_application::postprocess_page(int file,int count) force_setpage(); break; } - if (_scelta_stampa == 0) - { - if (file == LF_MOV) - { - if (_stampa_parte_iva) + if (file == LF_MOV) + { + reset_print(); + int n = 1; + if ( _scelta_stampa == 0 && _stampa_parte_iva ) { int r = 0; for (int j = 0; j < _c.items(); j++) @@ -1053,23 +1073,92 @@ print_action CG3100_application::postprocess_page(int file,int count) set_row(r, "@58gCodice Iva@68g%3s", (const char*)riga._codiva); switch (riga._tipodet) { - case 0 : set_row(r, "@73gDetraibile"); - break; - case 1 : set_row(r, "@73gIndetraibile su op.es."); - break; - case 3 : set_row(r, "@73gPassaggi interni"); - break; - case 9 : set_row(r, "@73gIndetraibile art.19"); - break; - default: break; - } + case 0 : set_row(r, "@73gDetraibile"); + break; + case 1 : set_row(r, "@73gIndetraibile su op.es."); + break; + case 3 : set_row(r, "@73gPassaggi interni"); + break; + case 9 : set_row(r, "@73gIndetraibile art.19"); + break; + default: break; + } } _c.destroy(); if (r > 0) - return REPEAT_PAGE; - else - return NEXT_PAGE; + { + n = ++r; + //return REPEAT_PAGE; + } + //else + // return NEXT_PAGE; } + //} + TRecnotype pos, items; + bool FINITO = FALSE; + //reset_print(); + //int n = 1; + 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); + pos = current_cursor()->pos(); + items = current_cursor()->items(); + + FINITO = (pos == items-1); + + _datareg = current_cursor()->file(LF_MOV).get_date(MOV_DATAREG); + _numreg = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG); + + TDate datarec (_datareg); + if (!FINITO) + { + TCursor * cur = current_cursor(); + cur->save_status(); + ++(*cur); + datarec = cur->file(LF_MOV).get_date(MOV_DATAREG); + --(*cur); + cur->restore_status(); + } + + _tot_avere_giornaliero += _tot_avere; + _tot_dare_giornaliero += _tot_dare; + + //stampa i totali giornalieri + if ( FINITO || + (_datareg != datarec)||(_numreg == _numreg_fin)) + { + if (( (_scelta_stampa == 0) && (_controllo_mov_errati != 1) && (_decidi == 2)) || ((_scelta_stampa == 1)&&(_decidi == 2))) + { + TString data = _datareg.string(); + set_row(n, "@b@50gTotali del"); + set_row(n, "@b@61ggiorno %s", (const char *)data); + set_row(n, "@b@93g%r", &_tot_dare_giornaliero); + set_row(n++, "@b@111g%r", &_tot_avere_giornaliero); + _tot_avere_giornaliero = 0; + _tot_dare_giornaliero = 0; + } + else if (((_scelta_stampa == 0)&&(_controllo_mov_errati != 1)&&(_decidi == 1)&&(FINITO)) || ((_scelta_stampa == 1)&&(_decidi == 1)&&(FINITO))) + { + TString sep; + sep = ""; + set_row (n,(const char*)sep); + set_row(++n, "@b@60gTotale generale"); + set_row(n, "@b@93g%r", &_tot_dare_generale); + set_row(n++, "@b@111g%r", &_tot_avere_generale); + } + } + + if (n == 1) + { + force_setpage(); + return NEXT_PAGE; + } + else + { + _no_preprocess_page = TRUE; + force_setpage(FALSE); + return REPEAT_PAGE; } } break; @@ -1077,11 +1166,12 @@ print_action CG3100_application::postprocess_page(int file,int count) case fatture: if (file == LF_MOV) { + long numreg; _totdocumenti += _totdoc; TRecnotype pos, items; bool FINITO = FALSE; - TLocalisamfile& mov = current_cursor()->file(LF_MOV); - TCursor * cur = current_cursor(); + TCursor* cur = current_cursor(); + TLocalisamfile & mov = cur->file(LF_MOV); pos = current_cursor()->pos(); items = current_cursor()->items(); @@ -1105,47 +1195,24 @@ print_action CG3100_application::postprocess_page(int file,int count) TString blank = ""; set_row(1,(const char*)blank); if ((_tipo_elenco == "C")||(_tipo_elenco == "c")) - set_row(2, "Totali Cliente@18gDocumenti Totale documenti@45gAllegati:@56gImponibile@75gImposta@94gop. esenti@112gop. non imp."); + set_row(2, "@bTotali Cliente@18gDocumenti Totale documenti@45gAllegati:@56gImponibile@75gImposta@94gop. esenti@112gop. non imp."); else - set_row(2, "Totali Fornitore@18gDocumenti Totale documenti@47gAllegati:@56gImponibile@75gImposta@94gop. esenti@112gop. non imp."); - set_row(3, "@18g%9d", _documenti); - set_row(3, "@28g%r", &_totdocumenti); - set_row(3, "@56g%r", &_totimponibile); - set_row(3, "@75g%r", &_totimposta); - set_row(3, "@94g%r", &_op_esenti); - set_row(3, "@112g%r", &_op_non_imp); - //_tipo_clifo_precedente = _tipo_elenco; + set_row(2, "@bTotali Fornitore@18gDocumenti Totale documenti@47gAllegati:@56gImponibile@75gImposta@94gop. esenti@112gop. non imp."); + set_row(3, "@b@18g%9d", _documenti); + set_row(3, "@b@28g%r", &_totdocumenti); + set_row(3, "@b@56g%r", &_totimponibile); + set_row(3, "@b@75g%r", &_totimposta); + set_row(3, "@b@94g%r", &_op_esenti); + set_row(3, "@b@112g%r", &_op_non_imp); _totimposta = 0; _totimponibile = 0; _op_esenti = 0; _op_non_imp = 0; _documenti = 0; _totdocumenti = 0; - //_tipo_clifo_prec = ""; - //_codcf_prec = 0l; return REPEAT_PAGE; } } - /* - else if (file == LF_RMOVIVA) - { - long numrec; - TLocalisamfile* rmoviva = current_cursor()->file(LF_RMOVIVA); - - _numreg = current_cursor()->file(LF_RMOVIVA)->get_long(MOV_NUMREG); - - TRecnotype recno = rmoviva.recno(); - rmoviva.next(); - numrec = rmoviva.get_long(RMI_NUMREG); - rmoviva.readat(recno); - - if ( (_numreg != numrec) && ( - _settata_prima_riga = FALSE; - else - _settata_prima_riga = TRUE; - - } - */ break; case movimenti_sezionale: @@ -1153,13 +1220,13 @@ print_action CG3100_application::postprocess_page(int file,int count) default: break; - } - return NEXT_PAGE; + + return NEXT_PAGE; } -int CG3100_application::my_next(TLocalisamfile & mov) +int CG3100_application::my_next(TLocalisamfile * mov) { int esito; TString cod_reg, causale; @@ -1179,8 +1246,6 @@ int CG3100_application::my_next(TLocalisamfile & mov) ann_reg = mov.get_int (MOV_ANNOIVA); causale = mov.get (MOV_CODCAUS); - //if ( ( ( _annoes != 0l) && (ann_reg != _annoes) ) - // || ( (causale < (const char*)_causale_ini) || (causale > (const char*)_causale_fin)) ) if ( ( _annoes != 0l) || ( (causale < (const char*)_causale_ini) || (causale > (const char*)_causale_fin)) ) { @@ -1212,6 +1277,7 @@ print_action CG3100_application::postprocess_print(int file,int count) switch (_tipo_lista) { case movimenti: + /* if (file == LF_RMOV) { TRecnotype pos, items; @@ -1222,7 +1288,7 @@ 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); + TLocalisamfile & mov = current_cursor()->file(LF_MOV); // nrec = mov.recno(); pos = current_cursor()->pos(); @@ -1230,8 +1296,8 @@ print_action CG3100_application::postprocess_print(int file,int count) FINITO = (pos == items-1); - _datareg = current_cursor()->file(LF_MOV).get_date(MOV_DATAREG); - _numreg = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG); + _datareg = current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG); + _numreg = current_cursor()->file(LF_MOV)->get_long(MOV_NUMREG); TDate datarec (_datareg); if (!FINITO) @@ -1239,20 +1305,18 @@ print_action CG3100_application::postprocess_print(int file,int count) TCursor * cur = current_cursor(); cur->save_status(); ++(*cur); - datarec = cur->file(LF_MOV).get_date(MOV_DATAREG); + datarec = cur->file(LF_MOV)->get_date(MOV_DATAREG); --(*cur); cur->restore_status(); } - /* - esito = my_next(mov); - if (esito == NOERR) - { - long numrec = mov.get_long(MOV_NUMREG); - datarec = mov.get_date(MOV_DATAREG); - } - */ + // esito = my_next(mov); + // if (esito == NOERR) + // { + // long numrec = mov.get_long(MOV_NUMREG); + // datarec = mov.get_date(MOV_DATAREG); + // } // mov.readat(nrec); - + _tot_avere_giornaliero += _tot_avere; _tot_dare_giornaliero += _tot_dare; @@ -1263,10 +1327,10 @@ print_action CG3100_application::postprocess_print(int file,int count) if (( (_scelta_stampa == 0) && (_controllo_mov_errati != 1) && (_decidi == 2)) || ((_scelta_stampa == 1)&&(_decidi == 2))) { TString data = _datareg.string(); - set_row(n, "@50gTotali del"); - set_row(n, "@61ggiorno %s", (const char *)data); - set_row(n, "@93g%r", &_tot_dare_giornaliero); - set_row(n++, "@111g%r", &_tot_avere_giornaliero); + set_row(n, "@b@50gTotali del"); + set_row(n, "@b@61ggiorno %s", (const char *)data); + set_row(n, "@b@93g%r", &_tot_dare_giornaliero); + set_row(n++, "@b@111g%r", &_tot_avere_giornaliero); _tot_avere_giornaliero = 0; _tot_dare_giornaliero = 0; @@ -1276,9 +1340,9 @@ print_action CG3100_application::postprocess_print(int file,int count) TString sep; sep = ""; set_row (n,(const char*)sep); - set_row(++n, "@60gTotale generale"); - set_row(n, "@93g%r", &_tot_dare_generale); - set_row(n++, "@111g%r", &_tot_avere_generale); + set_row(++n, "@b@60gTotale generale"); + set_row(n, "@b@93g%r", &_tot_dare_generale); + set_row(n++, "@b@111g%r", &_tot_avere_generale); } } @@ -1293,9 +1357,8 @@ print_action CG3100_application::postprocess_print(int file,int count) force_setpage(FALSE); return REPEAT_PAGE; } - } - + */ break; case fatture: @@ -1313,17 +1376,25 @@ print_action CG3100_application::postprocess_print(int file,int count) bool CG3100_application::segnala_errori_primariga() { int tiporeg; - + tiporeg = CodiceRegistro (_registro, _anno); + if ((_tiporegistro == 1)||(_tiporegistro == 2)) //movimento iva { - tiporeg = CodiceRegistro (_registro, _anno); - - if ( (tiporeg == 0) || - (_caus->bad()) || - (_tipodocumento != _tipodoc) || - ((_stampa_mess_alleg_iva) && (!_alleg_causale))) + if ( tiporeg == 0 || + _caus->empty() || + _tipodocumento != _tipodoc || + (_stampa_mess_alleg_iva && !_alleg_causale) ) return TRUE; } + if ((_tiporegistro != 1)&&(_tiporegistro != 2)) //mov. di prima nota + { + if (_registro.not_empty()) + if (tiporeg == 0) return TRUE; + if (_causale.not_empty()) + if ( _caus->empty() || + (_reg_causale != _registro && _registro.not_empty()) ) + return TRUE; + } return FALSE; } @@ -1332,25 +1403,53 @@ bool CG3100_application::segnala_errori_ogniriga() { bool trovato = FALSE; TString dep1; - + _err = _err1 = _err2 = _err3 = ""; + + if ((_tiporegistro != 1)&&(_tiporegistro != 2)) + { + int gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO); + int conto = current_cursor()->curr(LF_RMOV).get_int(RMV_CONTO); + long sottoconto = current_cursor()->curr(LF_RMOV).get_long(RMV_SOTTOCONTO); + if (gruppo == 0 || conto == 0 || sottoconto == 0L) + { + _err = ERR_64; + trovato = TRUE; + } + TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC); + _descr = DescrConto(gruppo, conto, sottoconto, tipoc); + if (_descr.empty()) + { + _err1 = ERR_66; + trovato = TRUE; + } + _alleg = AllegClifo(gruppo, conto, sottoconto); + _importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO); + _appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE); + if (_appoggio != "D" && _appoggio != "A") + { + _err2 = ERR_75; + trovato = TRUE; + } + } + 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)) { - record = rmoviva.recno(); - rmoviva.zero(); - rmoviva.put(RMI_NUMREG, _numreg); - for (rmoviva.read(); !rmoviva.eof() ;rmoviva.next()) + record = rmoviva->recno(); + rmoviva->zero(); + rmoviva->put(RMI_NUMREG, _numreg); + for (rmoviva->read(); !rmoviva->eof() ;rmoviva->next()) { - _cod = rmoviva.get(RMI_CODIVA); - _tipod = rmoviva.get_int(RMI_TIPODET); - _impo = rmoviva.get_real(RMI_IMPONIBILE); - _impos = rmoviva.get_real(RMI_IMPOSTA); - _tipocr = rmoviva.get_int(RMI_TIPOCR); - numreg = rmoviva.get_long(RMI_NUMREG); + _cod = rmoviva->get(RMI_CODIVA); + _tipod = rmoviva->get_int(RMI_TIPODET); + _impo = rmoviva->get_real(RMI_IMPONIBILE); + _impos = rmoviva->get_real(RMI_IMPOSTA); + _tipocr = rmoviva->get_int(RMI_TIPOCR); + numreg = rmoviva->get_long(RMI_NUMREG); if (numreg != _numreg) break; else @@ -1365,6 +1464,7 @@ bool CG3100_application::segnala_errori_ogniriga() } else if (_tiporegistro == 2) + { switch (_tipocr) { case 4: case 9: _err1 = ERR_09; @@ -1372,6 +1472,12 @@ bool CG3100_application::segnala_errori_ogniriga() break; default: break; } + if ( _tipod!=0 && _tipod!=1 && _tipod!=3 && _tipod!=9 ) + { + _err3 = ERR_4; + trovato = TRUE; + } + } if (_tipodoc != "AN") { _tabiva->setkey(1); @@ -1390,7 +1496,7 @@ bool CG3100_application::segnala_errori_ogniriga() trovato = TRUE; } else if ((_stampa_mess_alleg_iva)&&((colonnac==" ") - ||(colonnaf==" "))) + ||(colonnaf==" "))) { _msg = MSG_54; trovato = TRUE; @@ -1405,7 +1511,7 @@ bool CG3100_application::segnala_errori_ogniriga() } } } //for - rmoviva.readat (record); + rmoviva->readat (record); } } return trovato; @@ -1511,7 +1617,7 @@ bool CG3100_application::set_print(int m) if (!provvis) _curr1->setfilter("(PROVVIS=\"\")"); else _curr1->setfilter(""); - TLocalisamfile& fl = current_cursor()->file(LF_MOV); + TLocalisamfile & fl = current_cursor()->file(LF_MOV); TRectype da (fl.curr()); TRectype a (fl.curr()); da.zero(); @@ -1530,7 +1636,7 @@ bool CG3100_application::set_print(int m) _curr2->setfilter("(PROVVIS=\"\")"); else _curr2->setfilter(""); - TLocalisamfile& fl = current_cursor()->file(LF_MOV); + TLocalisamfile & fl = current_cursor()->file(LF_MOV); TRectype da (fl.curr()); TRectype a (fl.curr()); da.zero(); @@ -1549,7 +1655,7 @@ bool CG3100_application::set_print(int m) case fatture: { - TLocalisamfile& fl = current_cursor()->file(LF_MOV); + TLocalisamfile & fl = current_cursor()->file(LF_MOV); TString tipo = msk.get(F_TIPOELENCO); bool movprov = msk.get_bool(F_STAMPAMOVP); if (tipo=="C" || tipo=="F") @@ -1563,7 +1669,7 @@ bool CG3100_application::set_print(int m) _codice_fin = atol(msk.get(F_CODICEFIN1)); } - // _relmov.add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV + // _relmov->add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV if (tipo == "E") { _tipo_ini = "C"; @@ -1754,7 +1860,6 @@ void CG3100_application::init_print(const TMask& msk) reset_print(); _settata_prima_riga = FALSE; _tipo_clifo_prec = ""; - _tipo_clifo_precedente = ""; _codcf_prec = 0l; _numeroregp = 0; _documenti = 0; @@ -1987,17 +2092,17 @@ void CG3100_application::preprocess_header() break; } set_header (++soh,(const char*)sep); - if (_tipo_lista != fatture) - { - sep = ""; - set_header (++soh,(const char*)sep); - } + //if (_tipo_lista != fatture) + //{ + // sep = ""; + // set_header (++soh,(const char*)sep); + //} } int cg3100(int argc, char* argv[]) { CG3100_application a; - a.run(argc, argv, "Stampa movimenti"); + a.run(argc, argv, "Lista movimenti"); return 0; } diff --git a/cg/cg3100a.uml b/cg/cg3100a.uml index 4a22f54d7..bbcd86f55 100755 --- a/cg/cg3100a.uml +++ b/cg/cg3100a.uml @@ -1,183 +1,193 @@ #include "cg3100.h" -PAGE "Lista Movimenti" -1 -1 76 20 +PAGE "" -1 -1 76 20 NUMBER F_CODDITTA 5 BEGIN - PROMPT 2 1 "Ditta " - FLAGS "FRD" - USE LF_NDITTE KEY 1 - CHECKTYPE REQUIRED - INPUT CODDITTA F_CODDITTA - DISPLAY "Codice" CODDITTA - DISPLAY "Ragione sociale@50" RAGSOC - OUTPUT F_CODDITTA CODDITTA - OUTPUT F_RAGSOC RAGSOC + PROMPT 2 1 "Ditta " + FLAGS "FRD" + USE LF_NDITTE KEY 1 + CHECKTYPE REQUIRED + INPUT CODDITTA F_CODDITTA + DISPLAY "Codice" CODDITTA + DISPLAY "Ragione sociale@50" RAGSOC + OUTPUT F_CODDITTA CODDITTA + OUTPUT F_RAGSOC RAGSOC END STRING F_RAGSOC 50 BEGIN - PROMPT 2 2 "Ragione sociale " - FLAGS "D" + PROMPT 2 2 "Ragione sociale " + FLAGS "D" END DATE F_DATASTAMPA BEGIN - PROMPT 48 1 "Data stampa " - FLAGS "A" + PROMPT 48 1 "Data stampa " + FLAGS "A" END NUMBER F_ANNO 4 BEGIN - GROUP 3 - PROMPT 2 3 "Anno esercizio " - USE ESC - CHECKTYPE NORMAL - INPUT CODTAB F_ANNO - DISPLAY "Anno" CODTAB - DISPLAY "Data inizio esercizio" D0 - DISPLAY "Data fine esercizio" D1 - OUTPUT F_ANNO CODTAB - FLAGS "RZ" + GROUP 3 + PROMPT 2 3 "Anno esercizio " + USE ESC + CHECKTYPE NORMAL + INPUT CODTAB F_ANNO + DISPLAY "Anno" CODTAB + DISPLAY "Data inizio esercizio" D0 + DISPLAY "Data fine esercizio" D1 + OUTPUT F_ANNO CODTAB + FLAGS "RZ" END RADIOBUTTON F_MOVIMENTI 38 BEGIN - PROMPT 30 3 "Scelta stampa " - HELP "Indicare il tipo di stampa" - ITEM "0|Lista movimenti" - MESSAGE SHOW,F_CONTROLLO|SHOW,1@|SHOW,F_REGISTROFIN|SHOW,F_REGISTROINI - ITEM "1|Lista movimenti di sola prima nota" - MESSAGE HIDE,F_CONTROLLO|HIDE,1@|HIDE,F_REGISTROFIN|HIDE,F_REGISTROINI|HIDE,F_STAMPA + 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 + 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 END -LIST F_CONTROLLO 23 +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@ - ITEM "2|Si" MESSAGE SHOW,1@ - ITEM "1|Stampa movimenti errati" MESSAGE SHOW,1@ + 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 END TEXT DLG_NULL BEGIN - GROUP 1 - PROMPT 2 8 "Stampa messaggi : " + GROUP 1 + PROMPT 2 8 "Stampa messaggi : " END BOOLEAN F_ANNOC BEGIN - GROUP 1 - PROMPT 20 8 "anno di competenza " + GROUP 1 + PROMPT 20 8 "anno di competenza " END BOOLEAN F_ALLEGATO BEGIN - GROUP 1 - PROMPT 20 9 "allegato iva " - MESSAGE TRUE DISABLE,F_STAMPA|COPY,F_STAMPA - MESSAGE FALSE ENABLE,F_STAMPA + GROUP 1 + PROMPT 20 9 "allegato iva " + MESSAGE TRUE DISABLE,F_STAMPA|COPY,F_STAMPA + MESSAGE FALSE ENABLE,F_STAMPA END RADIOBUTTON F_DECIDI 10 BEGIN - PROMPT 2 10 "Stampa " - ITEM "2|Data" MESSAGE DISABLE,2@|RESET,2@|ENABLE,3@ - ITEM "1|Numero" MESSAGE DISABLE,3@|RESET,3@|ENABLE,2@ + PROMPT 2 10 "Stampa " + ITEM "2|data" MESSAGE DISABLE,2@|RESET,2@|ENABLE,3@ + ITEM "1|numero" MESSAGE DISABLE,3@|RESET,3@|ENABLE,2@ END DATE F_DATAINI BEGIN - PROMPT 18 11 "Stampa mov. dalla data " - GROUP 3 + PROMPT 19 11 "Stampa mov. dalla data " + //HELP "Se non indicato nessun valore viene effettuata una stampa completa in ordine di data" + GROUP 3 END DATE F_DATAFIN BEGIN - PROMPT 54 11 "alla data " - GROUP 3 + PROMPT 55 11 "alla data " + GROUP 3 END NUMBER F_NUMEROINI 7 BEGIN - PROMPT 18 12 "Stampa mov. dal numero " - USE LF_MOV KEY 1 - INPUT NUMREG F_NUMEROINI - DISPLAY "Numero registrazione" NUMREG - DISPLAY "Descrizione@50" DESCR - OUTPUT F_NUMEROINI NUMREG - CHECKTYPE NORMAL - FLAGS "R" - GROUP 2 + PROMPT 19 12 "Stampa mov. dal numero " + USE LF_MOV KEY 1 + INPUT NUMREG F_NUMEROINI + DISPLAY "Numero@6" NUMREG + DISPLAY "Data@10" DATAREG + DISPLAY "Causale" CODCAUS + DISPLAY "Documento" NUMDOC + DISPLAY "Descrizione@50" DESCR + OUTPUT F_NUMEROINI NUMREG + CHECKTYPE NORMAL + FLAGS "R" + GROUP 2 END NUMBER F_NUMEROFIN 7 BEGIN - PROMPT 54 12 "al numero " - COPY USE F_NUMEROINI - INPUT NUMREG F_NUMEROFIN - COPY DISPLAY F_NUMEROINI - OUTPUT F_NUMEROFIN NUMREG - CHECKTYPE NORMAL - FLAGS "R" - GROUP 2 + PROMPT 55 12 "al numero " + COPY USE F_NUMEROINI + INPUT NUMREG F_NUMEROFIN + COPY DISPLAY F_NUMEROINI + OUTPUT F_NUMEROFIN NUMREG + CHECKTYPE NORMAL + FLAGS "R" + GROUP 2 END STRING F_CAUSALEINI 3 BEGIN - PROMPT 2 14 "Stampa dalla causale " - USE LF_CAUSALI KEY 1 - INPUT CODCAUS F_CAUSALEINI - DISPLAY "Codice causale" CODCAUS - DISPLAY "Descrizione@50" DESCR - OUTPUT F_CAUSALEINI CODCAUS - FLAGS "UR" - HELP "Introdurre codice causale di inizio stampa: vuoto = inizio archivio" + PROMPT 2 14 "Stampa dalla causale " + USE LF_CAUSALI KEY 1 + INPUT CODCAUS F_CAUSALEINI + DISPLAY "Codice causale" CODCAUS + DISPLAY "Descrizione@50" DESCR + OUTPUT F_CAUSALEINI CODCAUS + FLAGS "UR" + HELP "Introdurre codice causale di inizio stampa: vuoto = inizio archivio" END STRING F_CAUSALEFIN 3 BEGIN - PROMPT 40 14 "alla causale " - COPY USE F_CAUSALEINI - INPUT CODCAUS F_CAUSALEFIN - DISPLAY "Codice causale" CODCAUS - DISPLAY "Descrizione@50" DESCR - OUTPUT F_CAUSALEFIN CODCAUS - FLAGS "UR" - HELP "Introdurre codice causale di fine stampa: vuoto = fine archivio" + PROMPT 40 14 "alla causale " + COPY USE F_CAUSALEINI + INPUT CODCAUS F_CAUSALEFIN + DISPLAY "Codice causale" CODCAUS + DISPLAY "Descrizione@50" DESCR + OUTPUT F_CAUSALEFIN CODCAUS + FLAGS "UR" + HELP "Introdurre codice causale di fine stampa: vuoto = fine archivio" END STRING F_REGISTROINI 3 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] DISPLAY "Descrizione@40" S0 OUTPUT F_REGISTROINI CODTAB[5,7] FLAGS "UR" + //CHECKTYPE NORMAL HELP "Introdurre cod. registro iva di inizio stampa: vuoto = inizio archivio" END STRING F_REGISTROFIN 3 BEGIN - PROMPT 40 15 "al reg. iva " - COPY USE F_REGISTROINI - INPUT CODTAB[5,7] F_REGISTROFIN + 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] - DISPLAY "Descrizione@40" S0 - OUTPUT F_REGISTROFIN CODTAB[5,7] - FLAGS "UR" - HELP "Introdurre cod. registro iva di fine stampa: vuoto = fine archivio" + DISPLAY "Cod. registro iva" CODTAB[5,7] + DISPLAY "Descrizione@40" S0 + OUTPUT F_REGISTROFIN CODTAB[5,7] + FLAGS "UR" + //CHECKTYPE NORMAL + HELP "Introdurre cod. registro iva di fine stampa: vuoto = fine archivio" END BOOLEAN F_STAMPA BEGIN - PROMPT 2 16 "Stampa imponibili, imposte e codici iva " + PROMPT 2 16 "Stampa imponibili, imposte e codici iva " END BOOLEAN F_STAMPAMOVP @@ -185,15 +195,21 @@ BEGIN PROMPT 2 17 "Stampa movimenti provvisori " END -BUTTON DLG_PRINT 9 2 +/* +TEXT DLG_NULL BEGIN - PROMPT -12 -1 "~Stampa" - MESSAGE EXIT,K_ENTER + PROMPT 2 17 "N.B. se non indicato nessun valore stampa completa in ordine di data" +END +*/ + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 -1 "" END -BUTTON DLG_CANCEL 9 2 +BUTTON DLG_QUIT 9 2 BEGIN - PROMPT -22 -1 "" + PROMPT -22 -1 "" END ENDPAGE @@ -205,3 +221,4 @@ ENDMASK + diff --git a/cg/cg3100b.uml b/cg/cg3100b.uml index ef37f0303..84a94f8c3 100755 --- a/cg/cg3100b.uml +++ b/cg/cg3100b.uml @@ -6,14 +6,14 @@ PAGE "" -1 -1 73 16 NUMBER F_CODDITTA 5 BEGIN PROMPT 2 1 "Ditta " - FLAGS "FRD" - USE LF_NDITTE KEY 1 - CHECKTYPE REQUIRED - INPUT CODDITTA F_CODDITTA - DISPLAY "Codice" CODDITTA + FLAGS "FRD" + USE LF_NDITTE KEY 1 + CHECKTYPE REQUIRED + INPUT CODDITTA F_CODDITTA + DISPLAY "Codice" CODDITTA DISPLAY "Ragione sociale @50" RAGSOC OUTPUT F_CODDITTA CODDITTA - OUTPUT F_RAGSOC RAGSOC + OUTPUT F_RAGSOC RAGSOC END STRING F_RAGSOC 50 @@ -62,7 +62,7 @@ BEGIN ITEM "F|Fornitori" MESSAGE HIDE,2@|SHOW,1@|RESET,1@ ITEM "E|Entrambi" - MESSAGE HIDE,1@|SHOW,2@|CLEAR,2@ + MESSAGE HIDE,1@|SHOW,2@|RESET,2@ END NUMBER F_CODICEINI 6 @@ -136,12 +136,12 @@ BEGIN END */ -BUTTON DLG_OK 10 2 +BUTTON DLG_OK 9 2 BEGIN PROMPT -12 -1 "" END -BUTTON DLG_CANCEL 10 2 +BUTTON DLG_QUIT 9 2 BEGIN PROMPT -22 -1 "" END diff --git a/cg/cg3100c.uml b/cg/cg3100c.uml index 85d45d994..d7e888fa1 100755 --- a/cg/cg3100c.uml +++ b/cg/cg3100c.uml @@ -1,3 +1,4 @@ + #include "cg3100.h" PAGE "" -1 -1 76 19 @@ -42,34 +43,34 @@ END RADIOBUTTON F_DECIDI 10 BEGIN PROMPT 2 8 "Stampa " - ITEM "2|Data" + ITEM "2|data" MESSAGE DISABLE,2@|RESET,2@|ENABLE,1@ - ITEM "1|Numero" + ITEM "1|numero" MESSAGE DISABLE,1@|RESET,1@|ENABLE,2@ END DATE F_DATAINI BEGIN - PROMPT 18 9 "Stampa mov. dalla data " + PROMPT 19 9 "Stampa mov. dalla data " GROUP 1 END DATE F_DATAFIN BEGIN - PROMPT 54 9 "alla data " + PROMPT 55 9 "alla data " GROUP 1 END NUMBER F_NUMEROINI 7 BEGIN - PROMPT 18 10 "Stampa mov. dal numero " + PROMPT 19 10 "Stampa mov. dal numero " FLAGS "R" GROUP 2 END NUMBER F_NUMEROFIN 7 BEGIN - PROMPT 54 10 "al numero " + PROMPT 55 10 "al numero " FLAGS "R" GROUP 2 END @@ -89,7 +90,7 @@ BEGIN PROMPT -12 -1 "" END -BUTTON DLG_CANCEL 9 2 +BUTTON DLG_QUIT 9 2 BEGIN PROMPT -22 -1 "" END diff --git a/cg/cg3500.cpp b/cg/cg3500.cpp index 86393e02e..f455eda9d 100755 --- a/cg/cg3500.cpp +++ b/cg/cg3500.cpp @@ -48,7 +48,7 @@ public: virtual void preprocess_header(); virtual bool preprocess_page(int,int); virtual print_action postprocess_page(int,int); - virtual print_action postprocess_print(int,int); + virtual void postclose_print(); bool riepilogo(); bool ricerca_cf(TConto&,int,real&,real&); @@ -62,7 +62,7 @@ public: void setta_riga_totale(); void get_dati_ditta(); int stampa_intestazione_ditta(); - TDate UltimaData(int,int,long,int); + TDate UltimaData(int,int,long); CG3500_application() {} }; @@ -118,6 +118,7 @@ bool CG3500_application::riepilogo() } _tmp_saldi->write(); esiste_conto = TRUE; + esiste_sc = FALSE; cp = conto.conto(); prg_conto_dare = 0.00; prg_conto_avere = 0.00; @@ -186,6 +187,7 @@ bool CG3500_application::riepilogo() } _tmp_saldi->write(); esiste_conto = TRUE; + esiste_sc = FALSE; } if (esiste_conto) { @@ -224,45 +226,49 @@ bool CG3500_application::riepilogo() continue; } // ho trovato un sottoconto - esiste_sc = TRUE; + //esiste_sc = TRUE; prg_dare = 0.00; prg_avere = 0.00; if (_richiesta == 1) - sld.prg_attuali(_annoese,conto,indbil,prg_dare,prg_avere); - else sld.prg_mov_eliminati(_annoese,conto,indbil,prg_dare,prg_avere); - + sld.prg_attuali(_annoese,conto,prg_dare,prg_avere); + else sld.prg_mov_eliminati(_annoese,conto,prg_dare,prg_avere); + saldo = prg_dare - prg_avere; prg_conto_dare += prg_dare; prg_conto_avere += prg_avere; - if (_scelta == 1) //riepilogo conti - { - _tmp_saldi->zero(); - _tmp_saldi->put(SLD_GRUPPO,conto.gruppo()); - _tmp_saldi->put(SLD_CONTO,conto.conto()); - _tmp_saldi->put(SLD_SOTTOCONTO,conto.sottoconto()); - _tmp_saldi->put(SLD_ANNOES,_annoese); - _tmp_saldi->put(SLD_FLAGSALINI,tipo_conto); - _tmp_saldi->put(SLD_PDARE,prg_dare); - _tmp_saldi->put(SLD_PAVERE,prg_avere); - if (saldo > 0.00) //va stampato in Dare - _tmp_saldi->put(SLD_PDARESCA,saldo); - else + if (prg_dare != ZERO || prg_avere != ZERO) + { + esiste_sc = TRUE; + if (_scelta == 1) //riepilogo conti { - saldo = saldo * (-1.00); - _tmp_saldi->put(SLD_PAVERESCA,saldo); + _tmp_saldi->zero(); + _tmp_saldi->put(SLD_GRUPPO,conto.gruppo()); + _tmp_saldi->put(SLD_CONTO,conto.conto()); + _tmp_saldi->put(SLD_SOTTOCONTO,conto.sottoconto()); + _tmp_saldi->put(SLD_ANNOES,_annoese); + _tmp_saldi->put(SLD_FLAGSALINI,tipo_conto); + _tmp_saldi->put(SLD_PDARE,prg_dare); + _tmp_saldi->put(SLD_PAVERE,prg_avere); + if (saldo > 0.00) //va stampato in Dare + _tmp_saldi->put(SLD_PDARESCA,saldo); + else + { + saldo = saldo * (-1.00); + _tmp_saldi->put(SLD_PAVERESCA,saldo); + } + _tmp_saldi->write(); + } + if (_scelta == 2) + { + _ultima_data = UltimaData(conto.gruppo(),conto.conto(),conto.sottoconto()); + _udata_max = fnc_max(_udata_max,_ultima_data); } - _tmp_saldi->write(); - } - if (_scelta == 2) - { - _ultima_data = UltimaData(conto.gruppo(),conto.conto(),conto.sottoconto(),_annoese); - _udata_max = fnc_max(_udata_max,_ultima_data); - } - gp = conto.gruppo(); - cp = conto.conto(); + gp = conto.gruppo(); + cp = conto.conto(); + } TRecnotype recnum = _pcn->recno(); _pcn->next(); @@ -271,40 +277,47 @@ bool CG3500_application::riepilogo() saldo_conto = prg_conto_dare - prg_conto_avere; prg_gruppo_dare += prg_conto_dare; prg_gruppo_avere += prg_conto_avere; - //scrivo il record del conto; - _tmp_saldi->zero(); - _tmp_saldi->put(SLD_GRUPPO,gp); - _tmp_saldi->put(SLD_CONTO,cp); - _tmp_saldi->put(SLD_SOTTOCONTO,0L); - _tmp_saldi->put(SLD_ANNOES,_annoese); - _tmp_saldi->put(SLD_DATAULMOV,_udata_max); - _tmp_saldi->put(SLD_PDARE,prg_conto_dare); - _tmp_saldi->put(SLD_PAVERE,prg_conto_avere); - if (saldo_conto > 0.00) //va stampato in Dare - _tmp_saldi->put(SLD_PDARESCA,saldo_conto); - else + if (esiste_sc) { - saldo_conto = saldo_conto * (-1.00); - _tmp_saldi->put(SLD_PAVERESCA,saldo_conto); + esiste_conto = TRUE; + //scrivo il record del conto; + _tmp_saldi->zero(); + _tmp_saldi->put(SLD_GRUPPO,gp); + _tmp_saldi->put(SLD_CONTO,cp); + _tmp_saldi->put(SLD_SOTTOCONTO,0L); + _tmp_saldi->put(SLD_ANNOES,_annoese); + _tmp_saldi->put(SLD_DATAULMOV,_udata_max); + _tmp_saldi->put(SLD_PDARE,prg_conto_dare); + _tmp_saldi->put(SLD_PAVERE,prg_conto_avere); + if (saldo_conto > 0.00) //va stampato in Dare + _tmp_saldi->put(SLD_PDARESCA,saldo_conto); + else + { + saldo_conto = saldo_conto * (-1.00); + _tmp_saldi->put(SLD_PAVERESCA,saldo_conto); + } + _tmp_saldi->write(); } - _tmp_saldi->write(); saldo_gruppo = prg_gruppo_dare - prg_gruppo_avere; - //scrivo il record del gruppo - _tmp_saldi->zero(); - _tmp_saldi->put(SLD_GRUPPO,gp); - _tmp_saldi->put(SLD_CONTO,0); - _tmp_saldi->put(SLD_SOTTOCONTO,0L); - _tmp_saldi->put(SLD_ANNOES,_annoese); - _tmp_saldi->put(SLD_PDARE,prg_gruppo_dare); - _tmp_saldi->put(SLD_PAVERE,prg_gruppo_avere); - if (saldo_gruppo > 0.00) //va stampato in Dare - _tmp_saldi->put(SLD_PDARESCA,saldo_gruppo); - else + if (esiste_conto) { - saldo_gruppo = saldo_gruppo * (-1.00); - _tmp_saldi->put(SLD_PAVERESCA,saldo_gruppo); - } - _tmp_saldi->write(); + //scrivo il record del gruppo + _tmp_saldi->zero(); + _tmp_saldi->put(SLD_GRUPPO,gp); + _tmp_saldi->put(SLD_CONTO,0); + _tmp_saldi->put(SLD_SOTTOCONTO,0L); + _tmp_saldi->put(SLD_ANNOES,_annoese); + _tmp_saldi->put(SLD_PDARE,prg_gruppo_dare); + _tmp_saldi->put(SLD_PAVERE,prg_gruppo_avere); + if (saldo_gruppo > 0.00) //va stampato in Dare + _tmp_saldi->put(SLD_PDARESCA,saldo_gruppo); + else + { + saldo_gruppo = saldo_gruppo * (-1.00); + _tmp_saldi->put(SLD_PAVERESCA,saldo_gruppo); + } + _tmp_saldi->write(); + } } _pcn->readat(recnum); } @@ -328,42 +341,47 @@ bool CG3500_application::ricerca_cf(TConto& conto,int indbil,real& prg_conto_dar for (int i = 0; i < items; i++) { _prog->addstatus(1); - const TRectype& r = _lista->saldi(i); - s = r.get_long(SLD_SOTTOCONTO); - esiste_sc = TRUE; + const TRectype* r = _lista->saldi(); + s = r->get_long(SLD_SOTTOCONTO); prg_dare = 0.00; prg_avere = 0.00; conto.set(g, c, s, tipo); //aggiunge a conto s if (_richiesta == 1) - sld.prg_attuali(_annoese,conto,indbil,prg_dare,prg_avere); - else sld.prg_mov_eliminati(_annoese,conto,indbil,prg_dare,prg_avere); + sld.prg_attuali(_annoese,conto,prg_dare,prg_avere); + else sld.prg_mov_eliminati(_annoese,conto,prg_dare,prg_avere); + saldo = prg_dare - prg_avere; prg_conto_dare += prg_dare; prg_conto_avere += prg_avere; - if (_scelta == 1) + + if (prg_dare != ZERO || prg_avere != ZERO) { - _tmp_saldi->zero(); - _tmp_saldi->put(SLD_GRUPPO,g); - _tmp_saldi->put(SLD_CONTO,c); - _tmp_saldi->put(SLD_SOTTOCONTO,s); - _tmp_saldi->put(SLD_ANNOES,_annoese); - _tmp_saldi->put(SLD_FLAGSALINI,tipo); - _tmp_saldi->put(SLD_PDARE,prg_dare); - _tmp_saldi->put(SLD_PAVERE,prg_avere); - if (saldo > 0.00) //va stampato in Dare - _tmp_saldi->put(SLD_PDARESCA,saldo); - else + esiste_sc = TRUE; + if (_scelta == 1) { - saldo = saldo * (-1.00); - _tmp_saldi->put(SLD_PAVERESCA,saldo); + _tmp_saldi->zero(); + _tmp_saldi->put(SLD_GRUPPO,g); + _tmp_saldi->put(SLD_CONTO,c); + _tmp_saldi->put(SLD_SOTTOCONTO,s); + _tmp_saldi->put(SLD_ANNOES,_annoese); + _tmp_saldi->put(SLD_FLAGSALINI,tipo); + _tmp_saldi->put(SLD_PDARE,prg_dare); + _tmp_saldi->put(SLD_PAVERE,prg_avere); + if (saldo > 0.00) //va stampato in Dare + _tmp_saldi->put(SLD_PDARESCA,saldo); + else + { + saldo = saldo * (-1.00); + _tmp_saldi->put(SLD_PAVERESCA,saldo); + } + _tmp_saldi->write(); } - _tmp_saldi->write(); - } - if (_scelta == 2) - { - _ultima_data = UltimaData(conto.gruppo(),conto.conto(),conto.sottoconto(),_annoese); - _udata_max = fnc_max(_udata_max,_ultima_data); - } + if (_scelta == 2) + { + _ultima_data = UltimaData(conto.gruppo(),conto.conto(),conto.sottoconto()); + _udata_max = fnc_max(_udata_max,_ultima_data); + } + } } delete _lista; return esiste_sc; @@ -386,7 +404,12 @@ tipo CG3500_application::leggi_conti(int counter) { TRecnotype pos; - if (counter == 0) _eof = _tmp_saldi->first(); + if (counter == 0) + { + _eof = _tmp_saldi->first(); + if (_eof) + return fine; + } do { @@ -419,7 +442,7 @@ tipo CG3500_application::leggi_conti(int counter) if (_eof) { - _ultima_data = UltimaData(_gcorr,_ccorr,_scorr,_annoese); + _ultima_data = UltimaData(_gcorr,_ccorr,_scorr); _tmp_saldi->readat(pos); _tipo = _tmp_saldi->get_char(SLD_FLAGSALINI); if (_tipo != 'C' && _tipo != 'F') @@ -443,7 +466,7 @@ tipo CG3500_application::leggi_conti(int counter) _cprec = _ccorr; } - _ultima_data = UltimaData(_gcorr,_ccorr,_scorr,_annoese); + _ultima_data = UltimaData(_gcorr,_ccorr,_scorr); _tmp_saldi->readat(pos); _tipo = _tmp_saldi->get_char(SLD_FLAGSALINI); if (_tipo != 'C' && _tipo != 'F') @@ -463,7 +486,12 @@ tipo CG3500_application::leggi_gruppi(int counter) { TRecnotype pos; - if (counter == 0) _eof = _tmp_saldi->first(); + if (counter == 0) + { + _eof = _tmp_saldi->first(); + if (_eof) + return fine; + } do { @@ -584,7 +612,11 @@ bool CG3500_application::preprocess_page(int file, int counter) _tp = leggi_conti(counter); if (_scelta == 2) _tp = leggi_gruppi(counter); - if (_tp == fine) + + if (_tp == fine && counter == 0) + return FALSE; + + if (_tp == fine) { if (_scelta == 1) setta_riga_sottoconto(); @@ -605,11 +637,11 @@ bool CG3500_application::preprocess_page(int file, int counter) return TRUE; } -print_action CG3500_application::postprocess_print(int file, int counter) +void CG3500_application::postclose_print() { _tmp_saldi->close(); - return NEXT_PAGE; + //return NEXT_PAGE; } print_action CG3500_application::postprocess_page(int file, int counter) @@ -625,7 +657,8 @@ void CG3500_application::setta_riga_sottoconto() TString udata = _ultima_data.string(); set_row(1,"%06ld", _scorr); - set_row(1,"@i %.32s@r",(const char*) _descr); + //set_row(1,"@i %.32s@r",(const char*) _descr); + set_row(1," %.32s@r",(const char*) _descr); set_row(1,"@42g%s",(const char*) udata); set_row(1,"@57g%r@77g%r@97g%r@117g%r",&_prg_dare,&_prg_avere,&_saldo_dare,&_saldo_avere); } @@ -642,13 +675,16 @@ void CG3500_application::setta_riga_conto() if (_scelta == 1) { set_row(r++,"%s",(const char*)riga); - set_row(r,"@b**** Totali conto %03d.%03d",_gconto,_cconto); - set_row(r,"@i %.27s@r",(const char*)_descrconto); + set_row(r,"**** Totali conto %03d.%03d",_gconto,_cconto); + // set_row(r,"@i %.27s@r",(const char*)_descrconto); + set_row(r," %.27s@r",(const char*)_descrconto); + } if (_scelta == 2) { set_row(r,"%03d", _ccorr); - set_row(r,"@i %.32s@r",(const char*)_descrconto); + //set_row(r,"@i %.32s@r",(const char*)_descrconto); + set_row(r," %.32s@r",(const char*)_descrconto); set_row(r,"@42g%s",(const char*)udata); } set_row(r++,"@57g%r@77g%r@97g%r@117g%r",&_prg_dare_conto,&_prg_avere_conto,&_saldo_dare_conto,&_saldo_avere_conto); @@ -668,8 +704,9 @@ void CG3500_application::setta_riga_gruppo() if (_scelta == 2) if (_tp == fine) r = 3; else r = 2; - set_row(r,"@b**** TOTALI GRUPPO %03d-",_ggruppo); - set_row(r,"@i %.30s@r",(const char*)_descrgruppo); + set_row(r,"**** TOTALI GRUPPO %03d-",_ggruppo); + //set_row(r,"@i %.30s@r",(const char*)_descrgruppo); + set_row(r," %.30s@r",(const char*)_descrgruppo); set_row(r++,"@57g%r@77g%r@97g%r@117g%r",&_prg_dare_gruppo,&_prg_avere_gruppo,&_saldo_dare_gruppo,&_saldo_avere_gruppo); set_row(r++,"%s",(const char*)riga); riga = ""; @@ -683,7 +720,7 @@ void CG3500_application::setta_riga_totale() _saldo_tot = _prg_dare_tot - _prg_avere_tot; if (_scelta == 1) r = 8; else r = 6; - set_row(r,"@b**** TOTALE GENERALE @57g%r@77g%r",&_prg_dare_tot,&_prg_avere_tot); + set_row(r,"**** TOTALE GENERALE @57g%r@77g%r",&_prg_dare_tot,&_prg_avere_tot); if (_saldo_tot > 0.00) set_row(r,"@97g%r",&_saldo_tot); else @@ -693,14 +730,14 @@ void CG3500_application::setta_riga_totale() } } -TDate CG3500_application::UltimaData(int g, int c, long s, int anno) +TDate CG3500_application::UltimaData(int g, int c, long s) { TLocalisamfile saldi(LF_SALDI, FALSE); //il parametro a false permette di usare un record corrente del file saldi differente a quello del file temporaneo TDate uldata; saldi.zero(); if (_annoese != 0) - saldi.put(SLD_ANNOES, anno); + saldi.put(SLD_ANNOES, _annoese); saldi.put(SLD_GRUPPO,g); if (c != 0) saldi.put(SLD_CONTO, c); @@ -828,7 +865,7 @@ int CG3500_application::stampa_intestazione_ditta() get_dati_ditta(); codice_ditta << get_firm(); - set_header (r, "Ditta %s %s Via %s %s %s %s", (const char*)codice_ditta, + set_header (r, "Ditta %s %s %s %s %s %s", (const char*)codice_ditta, (const char*)_ragsoc, (const char*)_viafis, (const char*)_cap, (const char*)_comunefis, (const char*)_provfis); diff --git a/cg/cg4600.cpp b/cg/cg4600.cpp index f952e8515..dc4682b8d 100755 --- a/cg/cg4600.cpp +++ b/cg/cg4600.cpp @@ -544,7 +544,8 @@ void CG4600_application::costi() numrig++; s = _saldi->get_long(SLD_SOTTOCONTO); - sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); + //sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); + sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil); _saldo = sale.saldo(); if (_saldo.is_zero()) continue; @@ -674,7 +675,8 @@ void CG4600_application::ricavi() numrig++; s = _saldi->get_long(SLD_SOTTOCONTO); - sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); + //sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); + sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil); _saldo = sale.saldo(); if (_saldo.is_zero()) continue; @@ -995,7 +997,8 @@ void CG4600_application::attivita() numrig++; s = _saldi->get_long(SLD_SOTTOCONTO); - sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); + //sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); + sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil); _saldo = sale.saldo(); if (_saldo == ZERO) continue; @@ -1180,7 +1183,8 @@ void CG4600_application::passivita() numrig++; s = _saldi->get_long(SLD_SOTTOCONTO); - sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); + //sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); + sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil); _saldo = sale.saldo(); if (_saldo.is_zero()) continue; diff --git a/cg/cg4600a.uml b/cg/cg4600a.uml index 3ca634a7b..3707900d4 100755 --- a/cg/cg4600a.uml +++ b/cg/cg4600a.uml @@ -57,13 +57,13 @@ END NUMBER F_ANNOCH 4 BEGIN PROMPT 69 4 "" - FLAGS "D" + FLAGS "RZD" END NUMBER F_ANNO 4 BEGIN PROMPT 69 5 "" - FLAGS "D" + FLAGS "RZD" END diff --git a/cg/cg5200.cpp b/cg/cg5200.cpp index 94d510da5..103d6a558 100755 --- a/cg/cg5200.cpp +++ b/cg/cg5200.cpp @@ -1,467 +1,565 @@ -// cg5200.cpp - Visualizzazione saldi - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cg5200.h" - -HIDDEN const char* REAL_PICTURE = "###.###.###.###"; - -class TRiga_array : public TArray -{ - public: - bool add_riga(const TRectype& rec_saldi); -}; - -bool TRiga_array::add_riga(const TRectype& rec_saldi) -{ - bool found = FALSE; - int annoes, annoesr; - char flag, flagr; - TDate udata, udatar; - long unum, unumr; - real pdaresca,paveresca,pdare,pavere,saldoini,pdarepro,paverepro; - real pdarescar,paverescar,pdarer,paverer,saldoinir,pdarepror,paverepror; - - for (int i = 0; i < items(); i++) - { - TRectype& r = (TRectype&)(*this)[i]; - annoes = r.get_int(SLD_ANNOES); - annoesr = rec_saldi.get_int(SLD_ANNOES); - if ( annoes == annoesr ) - { - pdaresca = r.get_real(SLD_PDARESCA); - paveresca = r.get_real(SLD_PAVERESCA); - flag = r.get_char(SLD_FLAGSALINI); - pdare = r.get_real(SLD_PDARE); - pavere = r.get_real(SLD_PAVERE); - saldoini = r.get_real(SLD_SALDO); - pdarepro = r.get_real(SLD_PDAREPRO); - paverepro = r.get_real(SLD_PAVEREPRO); - udata = r.get(SLD_DATAULMOV); - unum = r.get_long(SLD_NUMULTMOV); - pdarescar = rec_saldi.get_real(SLD_PDARESCA); - pdarescar += pdaresca; - paverescar = rec_saldi.get_real(SLD_PAVERESCA); - paverescar+= paveresca; - flagr = rec_saldi.get_char(SLD_FLAGSALINI); - pdarer = rec_saldi.get_real(SLD_PDARE); - pdarer += pdare; - paverer = rec_saldi.get_real(SLD_PAVERE); - paverer += pavere; - saldoinir = rec_saldi.get_real(SLD_SALDO); - udatar = rec_saldi.get(SLD_DATAULMOV); - unumr = rec_saldi.get_long(SLD_NUMULTMOV); - udatar = fnc_max(udatar,udata); - unumr = (unum > unumr) ? unum : unumr; - if (flagr == 'D') - saldoinir += saldoini; - else if (flagr == 'A') - saldoinir -= saldoini; - pdarepror = rec_saldi.get_real(SLD_PDAREPRO); - pdarepror += pdarepro; - paverepror = rec_saldi.get_real(SLD_PAVEREPRO); - paverepror += paverepro; - found = TRUE; - r.put(SLD_ANNOES, annoes); - r.put(SLD_PDARESCA, pdarescar); - r.put(SLD_PAVERESCA,paverescar); - r.put(SLD_PDARE, pdarer); - r.put(SLD_PAVERE,paverer); - r.put(SLD_SALDO, saldoinir); - r.put(SLD_PDAREPRO, pdarepror); - r.put(SLD_PAVEREPRO,paverepro); - r.put(SLD_DATAULMOV, udatar); - r.put(SLD_NUMULTMOV, unumr); - } - } - if (!found) - { - TRectype* r = new TRectype(rec_saldi);//ci copia anche i valori di rec_saldi - add(r); - } - return found; -} - -bool gruppo_handler (TMask_field& f, KEY k); -bool sottoc_handler (TMask_field& f, KEY k); - -class CG5200_application : public TBrowse_application -{ - friend bool gruppo_handler (TMask_field& f, KEY k); - friend bool sottoc_handler (TMask_field& f, KEY k); - - TMask* _msk; - TLocalisamfile* _pcon,* _clifo; - TCursor * _cur; - TRelation * _rel,* _rel1; - TRiga_array _riga; - int _items, _anno, _g, _c; - long _s; - bool _saldo_conto, _saldo_gruppo, _saldo_sottoc; - -protected: - virtual bool user_create(); - virtual bool user_destroy(); - virtual TRelation* get_relation() const { return _rel; } - virtual TMask* get_mask(int mode) { return _msk; } - virtual bool changing_mask(int mode) {return FALSE; } - virtual int read(TMask& m); - -public: - void add_r(int,int,real&,real&,real&,char,real&,real&, - real&,real&,TDate&,long,real&,real&,real&); - void compilasheet(); - bool fai_filtro(); - TMask* main_mask() const {return _msk;} - TSheet_field& ss() const { return (TSheet_field&)_msk->field(F_SHEET_SALDI);} - - CG5200_application() {} -}; - -HIDDEN CG5200_application * app() { return (CG5200_application*) MainApp(); } - -bool CG5200_application::fai_filtro() -{ - TSaldo sld; - int annop = 0; - char tipo; - - _saldo_gruppo = _saldo_conto = _saldo_sottoc = FALSE; - TMask* m = app()->main_mask(); - tipo = m->get(F_TIPOCF)[0]; - _anno = m->get_int(F_ANNO); - _g = m->get_int(F_GRUPPO); - _c = m->get_int(F_CONTO); - if (tipo == ' ') - _s = m->get_long(F_SOTTOCONTO); - else if (tipo == 'C') - _s = m->get_long(F_SOTTOC_CLIENTE); - else _s = m->get_long(F_SOTTOC_FORN); - if (_c == 0) - _saldo_gruppo = TRUE; - else if (_s == 0l) - _saldo_conto = TRUE; - else _saldo_sottoc = TRUE; - - TLocalisamfile& saldi = _rel1->lfile(); - TRectype from (saldi.curr()); - TRectype to (saldi.curr()); - from.zero(); - to.zero(); - - if (_anno != 0) - annop = sld.EsePre(_anno); - - if (annop != 0) - from.put(SLD_ANNOES,annop); - else if (_anno != 0) - from.put(SLD_ANNOES,_anno); - else from.put(SLD_ANNOES,0); - from.put(SLD_GRUPPO,_g); - if (_c != 0) - from.put(SLD_CONTO, _c); - if (_s != 0l) - from.put(SLD_SOTTOCONTO, _s); - - if (_anno != 0) - to.put(SLD_ANNOES,_anno); - else to.put(SLD_ANNOES, 9999); - to.put(SLD_GRUPPO,_g); - if (_c != 0) - to.put(SLD_CONTO,_c); - if (_s != 0l) - to.put(SLD_SOTTOCONTO,_s); - - if ( _saldo_gruppo || _saldo_conto ) - _cur->setkey(1); - - if (_saldo_sottoc) - _cur->setkey(2); - - _cur->setregion(from,to); - - return TRUE; -} - -bool gruppo_handler(TMask_field& f, KEY key) -{ - if ( key == K_TAB && f.mask().is_running() ) - { - const TMask& m = f.mask(); - const int gruppo = m.get_int(F_GRUPPO); - const int conto = m.get_int(F_CONTO); - const long sottoc = m.get_long(F_SOTTOCONTO); - TLocalisamfile& pconti = app()->get_relation()->lfile(); - - if (gruppo == 0) - { - if (conto != 0 || sottoc != 0) - return f.warning_box("Codice conto impossibile!"); - else - return f.error_box("E' obbligatorio l'inserimento del gruppo"); - } - if (conto > 0 && sottoc == 0) // conto => ricerca gruppo - { - pconti.zero() ; - pconti.put(PCN_GRUPPO, gruppo) ; - pconti.setkey(1) ; - pconti.read(_isequal, _nolock ); - if (pconti.bad()) - return f.warning_box ("Non esiste il gruppo relativo a questo conto"); - } - if (sottoc > 0) // sottoconto => ricerca conto - { - pconti.zero() ; - pconti.put(PCN_GRUPPO, gruppo) ; - pconti.put(PCN_CONTO, conto) ; - pconti.setkey(1) ; - pconti.read(_isequal, _nolock ); - if (pconti.bad()) - return f.warning_box ("Non esiste il conto relativo a questo sottoconto"); - else - { - TString tmcf = pconti.get(PCN_TMCF); - if (tmcf.not_empty()) - return f.warning_box ("Non puoi inserire un sottoconto di un conto relativo ad un cliente/fornitore"); - } - } - } - return TRUE; -} - - -bool sottoc_handler(TMask_field& f, KEY key) -{ - if (key == K_TAB) - { - const short id = f.dlg(); - TLocalisamfile clifo (LF_CLIFO); - int gruppo = f.mask().get_int(F_GRUPPO); - if (gruppo == 0) return TRUE; - int conto = f.mask().get_int(F_CONTO); - long sottoconto = f.mask().get_long(id); - if (sottoconto != 0 && conto == 0) return f.error_box("Manca il CONTO"); - if (id == F_SOTTOC_CLIENTE || id == F_SOTTOC_FORN) - { - char tmcf = f.mask().get(F_TIPOCF)[0]; - clifo.zero() ; - clifo.put(CLI_TIPOCF,tmcf); - clifo.put(CLI_CODCF,sottoconto); - clifo.setkey(1) ; - clifo.read(_isequal, _nolock ); - if (clifo.bad()) - return f.warning_box ("Registrazione assente"); - } - f.mask().stop_run(K_AUTO_ENTER); - } - return TRUE; -} - -bool CG5200_application::user_create() -{ - _msk = new TMask("cg5200a"); - _msk->set_handler(F_GRUPPO, gruppo_handler); - _msk->set_handler(F_SOTTOCONTO, sottoc_handler); - _msk->set_handler(F_SOTTOC_CLIENTE, sottoc_handler); - _msk->set_handler(F_SOTTOC_FORN, sottoc_handler); - _pcon = new TLocalisamfile(LF_PCON); - _clifo = new TLocalisamfile(LF_CLIFO); - _rel = new TRelation(LF_PCON); - _rel1 = new TRelation(LF_SALDI); - _cur = new TCursor(_rel1, "", 2); - set_search_field(F_GRUPPO); - TSheet_field& cs = ss(); - - return TRUE; -} - -bool CG5200_application::user_destroy() -{ - delete _msk; - delete _pcon; - delete _clifo; - delete _rel; - delete _rel1; - delete _cur; - - return TRUE; -} - -int CG5200_application::read(TMask& m) -{ - m.autoload(_rel); - fai_filtro(); - compilasheet(); - ss().force_update(); - - return NOERR; -} - -void CG5200_application::add_r(int numrig,int a,real& pds,real& pas,real& sc,char f,real& si,real& pd, - real& pa,real& s,TDate& d,long n,real& pdp,real& pap,real& sp) -{ - TSheet_field& cs = ss(); - TString dep (18); - if (sc > ZERO) - dep << sc.string(REAL_PICTURE) << " D"; - else if (sc < ZERO) - { - sc = -sc; - dep << sc.string(REAL_PICTURE) << " A"; - } - TToken_string& riga = cs.row(numrig); - riga.add(a, 0); - riga.add(pds.string(),1); - riga.add(pas.string(),2); - riga.add(dep,3); - dep = ""; - if (si != ZERO) - dep << si.string(REAL_PICTURE) << " " << f; - riga.add(dep,4); - riga.add(pd.string(),5); - riga.add(pa.string(),6); - dep = ""; - if (s > ZERO) - dep << s.string(REAL_PICTURE) << " D"; - else if (s < ZERO) - { - s = -s; - dep << s.string(REAL_PICTURE) << " A"; - } - riga.add(dep,7); - riga.add(d.string(),8); - riga.add(n,9); - riga.add(pdp.string(),10); - riga.add(pap.string(),11); - dep = ""; - if (sp > ZERO) - dep << sp.string(REAL_PICTURE) << " D"; - else if (sp < ZERO) - { - sp = -sp; - dep << sp.string(REAL_PICTURE) << " A"; - } - riga.add(dep,12); -} - -void CG5200_application::compilasheet() -{ - char flagsal = ' '; - real saldo = ZERO; - real saldosca = ZERO; - real saldopro = ZERO; - real saldo_gc = ZERO; - real saldoini_gc = ZERO; - real saldosca_gc = ZERO; - real saldopro_gc = ZERO; - real prg_dare_gc = ZERO; - real prg_avere_gc = ZERO; - real prg_daresca_gc = ZERO; - real prg_averesca_gc = ZERO; - real prg_darepro_gc = ZERO; - real prg_averepro_gc = ZERO; - real saldoini = ZERO; - real pdare = ZERO; - real pavere = ZERO; - real pdaresca = ZERO; - real paveresca = ZERO; - real pdarepro = ZERO; - real paverepro = ZERO; - int gruppo, conto, anno; - long sottoconto; - long ultimo_num = 0l; - TDate ultima_data = 0; - - ss().reset(); - _riga.destroy(); - - TRecnotype items = _cur->items(); - *_cur = 0l; - - for (int i = 0; i < items; i++,++(*_cur)) - { - anno = _cur->curr().get_int(SLD_ANNOES); - gruppo = _cur->curr().get_int(SLD_GRUPPO); - conto = _cur->curr().get_int(SLD_CONTO); - sottoconto = _cur->curr().get_long(SLD_SOTTOCONTO); - - if (gruppo != _g) continue; - - if (_saldo_conto && conto != _c) continue; - - if (_saldo_conto || _saldo_gruppo) - _riga.add_riga(_cur->curr()); - - if (_saldo_sottoc) - { - flagsal = _cur->curr().get_char(SLD_FLAGSALINI); - saldoini = _cur->curr().get_real(SLD_SALDO); - pdare = _cur->curr().get_real(SLD_PDARE); - pavere = _cur->curr().get_real(SLD_PAVERE); - pdaresca = _cur->curr().get_real(SLD_PDARESCA); - paveresca = _cur->curr().get_real(SLD_PAVERESCA); - pdarepro = _cur->curr().get_real(SLD_PDAREPRO); - paverepro = _cur->curr().get_real(SLD_PAVEREPRO); - ultima_data = _cur->curr().get(SLD_DATAULMOV); - ultimo_num = _cur->curr().get_long(SLD_NUMULTMOV); - if (flagsal == 'D') - saldo = pdare + saldoini - pavere; - else - saldo = pdare - saldoini - pavere; - saldosca = pdaresca - paveresca; - saldopro = pdarepro - paverepro; - - add_r(i,anno,pdaresca,paveresca,saldosca,flagsal,saldoini,pdare,pavere,saldo,ultima_data,ultimo_num,pdarepro,paverepro,saldopro); - } - } - if (_saldo_gruppo || _saldo_conto) - { - for (int j = 0; j < _riga.items(); j++) - { - TRectype& riga = (TRectype&)_riga[j]; - anno = riga.get_int(SLD_ANNOES); - pdaresca = riga.get_real(SLD_PDARESCA); - paveresca = riga.get_real(SLD_PAVERESCA); - saldosca = pdaresca - paveresca; - saldoini = riga.get_real(SLD_SALDO); - pdare = riga.get_real(SLD_PDARE); - pavere = riga.get_real(SLD_PAVERE); - saldo = pdare - pavere + saldoini; - if (saldoini > ZERO) - flagsal = 'D'; - else if (saldoini < ZERO) - { - flagsal = 'A'; - saldoini = -saldoini; - } - pdarepro = riga.get_real(SLD_PDAREPRO); - paverepro = riga.get_real(SLD_PAVEREPRO); - saldopro = pdarepro - paverepro; - ultima_data = riga.get(SLD_DATAULMOV); - ultimo_num = riga.get_long(SLD_NUMULTMOV); - add_r(j,anno,pdaresca,paveresca,saldosca,flagsal,saldoini,pdare,pavere,saldo,ultima_data,ultimo_num,pdarepro,paverepro,saldopro); - } - _riga.destroy(); - } -} - -int cg5200(int argc, char* argv[]) -{ - CG5200_application a; - a.run(argc, argv, "Visualizzazione saldi"); - return 0; -} - - - - +// cg5200.cpp - Visualizzazione saldi + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cg5200.h" + +//HIDDEN const char* REAL_PICTURE = "###.###.###.###"; + +class TRiga_array : public TArray +{ +public: + bool add_riga(const TRectype& rec_saldi); +}; + +bool TRiga_array::add_riga(const TRectype& rec_saldi) +{ + bool found = FALSE; + int annoes, annoesr; + char flag = ' ', flagr = ' '; + TDate udata, udatar; + long unum, unumr; + real pdaresca,paveresca,pdare,pavere,saldoini,pdarepro,paverepro; + real pdarescar,paverescar,pdarer,paverer,saldoinir,pdarepror,paverepror; + + for (int i = 0; i < items(); i++) + { + TRectype& r = (TRectype&)(*this)[i]; + annoes = r.get_int(SLD_ANNOES); + annoesr = rec_saldi.get_int(SLD_ANNOES); + if ( annoes == annoesr ) + { + pdaresca = r.get_real(SLD_PDARESCA); + paveresca = r.get_real(SLD_PAVERESCA); + flag = r.get_char(SLD_FLAGSALINI); + pdare = r.get_real(SLD_PDARE); + pavere = r.get_real(SLD_PAVERE); + saldoini = r.get_real(SLD_SALDO); + pdarepro = r.get_real(SLD_PDAREPRO); + paverepro = r.get_real(SLD_PAVEREPRO); + udata = r.get(SLD_DATAULMOV); + unum = r.get_long(SLD_NUMULTMOV); + pdarescar = rec_saldi.get_real(SLD_PDARESCA); + pdarescar += pdaresca; + paverescar = rec_saldi.get_real(SLD_PAVERESCA); + paverescar+= paveresca; + flagr = rec_saldi.get_char(SLD_FLAGSALINI); + pdarer = rec_saldi.get_real(SLD_PDARE); + pdarer += pdare; + paverer = rec_saldi.get_real(SLD_PAVERE); + paverer += pavere; + saldoinir = rec_saldi.get_real(SLD_SALDO); + udatar = rec_saldi.get(SLD_DATAULMOV); + unumr = rec_saldi.get_long(SLD_NUMULTMOV); + udatar = fnc_max(udatar,udata); + unumr = (unum > unumr) ? unum : unumr; + if (flagr == flag) + saldoinir += saldoini; + else saldoinir -= saldoini; + if (saldoinir < ZERO) // saldoinir e' piu' piccolo di saldoini => vince il flag di saldoini + { + flagr = flag; + saldoinir = -saldoinir; + } + pdarepror = rec_saldi.get_real(SLD_PDAREPRO); + pdarepror += pdarepro; + paverepror = rec_saldi.get_real(SLD_PAVEREPRO); + paverepror += paverepro; + found = TRUE; + r.put(SLD_ANNOES, annoes); + r.put(SLD_PDARESCA, pdarescar); + r.put(SLD_PAVERESCA,paverescar); + r.put(SLD_PDARE, pdarer); + r.put(SLD_PAVERE,paverer); + r.put(SLD_FLAGSALINI,flagr); + r.put(SLD_SALDO, saldoinir); + r.put(SLD_PDAREPRO, pdarepror); + r.put(SLD_PAVEREPRO,paverepro); + r.put(SLD_DATAULMOV, udatar); + r.put(SLD_NUMULTMOV, unumr); + } + } + if (!found) + { + TRectype* r = new TRectype(rec_saldi);//ci copia anche i valori di rec_saldi + add(r); + } + return found; +} + +bool gruppo_handler (TMask_field& f, KEY k); +bool sottoc_handler (TMask_field& f, KEY k); + +class CG5200_application : public TBrowse_application +{ + friend bool gruppo_handler (TMask_field& f, KEY k); + friend bool sottoc_handler (TMask_field& f, KEY k); + + TMask* _msk; + TLocalisamfile* _pcon,* _clifo; + TCursor * _cur; + TRelation * _rel,* _rel1; + TRiga_array _riga; + int _items, _anno, _g, _c; + long _s; + bool _saldo_conto, _saldo_gruppo, _saldo_sottoc; + +protected: + virtual bool user_create(); + virtual bool user_destroy(); + virtual TRelation* get_relation() const { return _rel; } + virtual TMask* get_mask(int mode) { return _msk; } + virtual bool changing_mask(int mode) {return FALSE; } + virtual int read(TMask& m); + virtual void init_query_mode(TMask&); + virtual void init_modify_mode(TMask&); + +public: + void add_r(int,int,real&,real&,real&,char,real&,real&, + real&,real&,TDate&,long,real&,real&,real&); + void compilasheet(); + bool fai_filtro(); + TMask* main_mask() const {return _msk;} + TSheet_field& ss() const { return (TSheet_field&)_msk->field(F_SHEET_SALDI);} + + CG5200_application() {} +}; + +HIDDEN CG5200_application * app() { return (CG5200_application*) MainApp(); } + +void CG5200_application::init_query_mode(TMask& m) +{ + m.disable(DLG_FINDREC); +} + +void CG5200_application::init_modify_mode(TMask& m) +{ + m.disable(DLG_FINDREC); +} + +bool CG5200_application::fai_filtro() +{ + TSaldo sld; + int annop = 0; + TString tipo (1); + + _saldo_gruppo = _saldo_conto = _saldo_sottoc = FALSE; + TMask* m = app()->main_mask(); + tipo = m->get(F_TIPOCF); + _anno = m->get_int(F_ANNO); + _g = m->get_int(F_GRUPPO); + _c = m->get_int(F_CONTO); + if (tipo == "") + _s = m->get_long(F_SOTTOCONTO); + else if (tipo == "C") + _s = m->get_long(F_SOTTOC_CLIENTE); + else _s = m->get_long(F_SOTTOC_FORN); + if (_c == 0) + _saldo_gruppo = TRUE; + else if (_s == 0l) + _saldo_conto = TRUE; + else _saldo_sottoc = TRUE; + + TLocalisamfile& saldi = _rel1->lfile(); + TRectype from (saldi.curr()); + TRectype to (saldi.curr()); + from.zero(); + to.zero(); + + if (_anno != 0) + annop = sld.EsePre(_anno); + + if (annop != 0) + from.put(SLD_ANNOES,annop); + else if (_anno != 0) + from.put(SLD_ANNOES,_anno); + else from.put(SLD_ANNOES,0); + from.put(SLD_GRUPPO,_g); + if (_c != 0) + from.put(SLD_CONTO, _c); + if (_s != 0l) + from.put(SLD_SOTTOCONTO, _s); + + if (_anno != 0) + to.put(SLD_ANNOES,_anno); + else to.put(SLD_ANNOES, 9999); + to.put(SLD_GRUPPO,_g); + if (_c != 0) + to.put(SLD_CONTO,_c); + if (_s != 0l) + to.put(SLD_SOTTOCONTO,_s); + + if ( _saldo_gruppo || _saldo_conto ) + _cur->setkey(1); + + if (_saldo_sottoc) + _cur->setkey(2); + + _cur->setregion(from,to); + + return TRUE; +} + +bool gruppo_handler(TMask_field& f, KEY key) +{ + if ( key == K_TAB && f.mask().is_running() ) + { + TMask& m = f.mask(); + const int gruppo = m.get_int(F_GRUPPO); + const int conto = m.get_int(F_CONTO); + const long sottoc = m.get_long(F_SOTTOCONTO); + TLocalisamfile& pconti = app()->get_relation()->lfile(); + + if (gruppo == 0) + { + if (conto != 0 || sottoc != 0) + return f.warning_box("Codice conto impossibile!"); + else + return f.error_box("E' obbligatorio l'inserimento del gruppo"); + } + if (conto > 0 && sottoc == 0) // conto => ricerca gruppo + { + pconti.zero() ; + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.setkey(1) ; + pconti.read(_isequal, _nolock ); + if (pconti.bad()) + return f.warning_box ("Non esiste il gruppo relativo a questo conto"); + } + if (sottoc > 0) // sottoconto => ricerca conto + { + pconti.zero() ; + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.put(PCN_CONTO, conto) ; + pconti.setkey(1) ; + pconti.read(_isequal, _nolock ); + if (pconti.bad()) + return f.warning_box ("Non esiste il conto relativo a questo sottoconto"); + /* + else + { + TString tmcf = pconti.get(PCN_TMCF); + if (tmcf.not_empty()) + return f.warning_box ("Non puoi inserire un sottoconto di un conto relativo ad un cliente/fornitore"); + } + */ + } + } + return TRUE; +} + + +bool sottoc_handler(TMask_field& f, KEY key) +{ + const short id = f.dlg(); + int gruppo; + long sottoconto = f.mask().get_long(id); + + if (key == K_TAB) + { + TLocalisamfile pconti(LF_PCON); + gruppo = f.mask().get_int(F_GRUPPO); + + if (gruppo == 0) + return TRUE; + + int conto = f.mask().get_int(F_CONTO); + + if (sottoconto != 0 && conto == 0) + return f.error_box("Manca il CONTO"); + + if (id == F_SOTTOCONTO) + { + pconti.zero(); + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.put(PCN_CONTO, conto); + pconti.put(PCN_SOTTOCONTO, sottoconto); + pconti.setkey(1); + pconti.read(_isequal, _nolock); + if (pconti.good()) + f.mask().stop_run(K_AUTO_ENTER); + } + + if (id == F_SOTTOC_CLIENTE || id == F_SOTTOC_FORN) + { + char tipo = id == F_SOTTOC_CLIENTE ? 'C' : 'F'; + TLocalisamfile clifo (LF_CLIFO); + if (sottoconto != 0) + { + clifo.zero(); + clifo.put(CLI_TIPOCF,tipo); + clifo.put(CLI_CODCF, sottoconto) ; + clifo.setkey(1); + if (clifo.read(_isequal, _nolock) == NOERR) + { + TString rs = clifo.get(CLI_RAGSOC); + f.mask().set(F_DESCR_CLIENTE, rs); + f.mask().set(F_DESCR_FORN, rs); + f.mask().stop_run(K_AUTO_ENTER); + } + else return f.error_box("Registrazione assente"); + + } + else + if (gruppo != 0 && conto != 0) + { + pconti.zero(); + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.put(PCN_CONTO, conto); + pconti.setkey(1); + pconti.read(_isequal, _nolock); + if (pconti.good()) + { + TString ds = pconti.get(PCN_DESCR); + f.mask().set(F_DESCR_CLIENTE, ds); + f.mask().set(F_DESCR_FORN, ds); + } + f.mask().stop_run(K_AUTO_ENTER); + } + // else + // return f.error_box("Registrazione assente"); + } + } + // f.mask().stop_run(K_AUTO_ENTER); + return TRUE; +} + +bool CG5200_application::user_create() +{ + _msk = new TMask("cg5200a"); + _msk->set_handler(F_GRUPPO, gruppo_handler); + _msk->set_handler(F_SOTTOCONTO, sottoc_handler); + _msk->set_handler(F_SOTTOC_CLIENTE, sottoc_handler); + _msk->set_handler(F_SOTTOC_FORN, sottoc_handler); + _pcon = new TLocalisamfile(LF_PCON); + _clifo = new TLocalisamfile(LF_CLIFO); + _rel = new TRelation(LF_PCON); + _rel1 = new TRelation(LF_SALDI); + _cur = new TCursor(_rel1, "", 2); + set_search_field(F_GRUPPO); + TSheet_field& cs = ss(); + + return TRUE; +} + +bool CG5200_application::user_destroy() +{ + delete _msk; + delete _pcon; + delete _clifo; + delete _rel; + delete _rel1; + delete _cur; + + return TRUE; +} + +int CG5200_application::read(TMask& m) +{ + m.autoload(_rel); + fai_filtro(); + compilasheet(); + ss().force_update(); + + return NOERR; +} + +void CG5200_application::add_r(int numrig,int a,real& pds,real& pas,real& sc,char f,real& si,real& pd, + real& pa,real& s,TDate& d,long n,real& pdp,real& pap,real& sp) +{ + TSheet_field& cs = ss(); + char segno = ' '; + + TToken_string& riga = cs.row(numrig); + /* + TString dep (18); + if (sc > ZERO) + dep << sc.string(REAL_PICTURE) << " D"; + else if (sc < ZERO) + { + sc = -sc; + dep << sc.string(REAL_PICTURE) << " A"; + } + */ + riga.add(a, 0); + riga.add(si.string(),1); + if (si != ZERO) + riga.add(f,2); + riga.add(pd.string(),3); + riga.add(pa.string(),4); + if (s > ZERO) + segno = 'D'; + else if (s < ZERO) + { + s = -s; + segno = 'A'; + } + riga.add(s.string(),5); + riga.add(segno,6); + segno = ' '; + if (sc > ZERO) + segno = 'D'; + else if (sc < ZERO) + { + sc = -sc; + segno = 'A'; + } + riga.add(pds.string(),7); + riga.add(pas.string(),8); + riga.add(sc.string(),9); + riga.add(segno,10); + /* + dep = ""; + if (si != ZERO) + dep << si.string(REAL_PICTURE) << " " << f; + dep = ""; + if (s > ZERO) + dep << s.string(REAL_PICTURE) << " D"; + else if (s < ZERO) + { + s = -s; + dep << s.string(REAL_PICTURE) << " A"; + } + */ + riga.add(d.string(),11); + riga.add(n,12); + riga.add(pdp.string(),13); + riga.add(pap.string(),14); + /* + dep = ""; + if (sp > ZERO) + dep << sp.string(REAL_PICTURE) << " D"; + else if (sp < ZERO) + { + sp = -sp; + dep << sp.string(REAL_PICTURE) << " A"; + } + */ + segno = ' '; + if (sp > ZERO) + segno = 'D'; + else if (sp < ZERO) + { + sp = -sp; + segno = 'A'; + } + riga.add(sp.string(),15); + riga.add(segno,16); +} + +void CG5200_application::compilasheet() +{ + char flagsal = ' '; + real saldo = ZERO; + real saldosca = ZERO; + real saldopro = ZERO; + real saldo_gc = ZERO; + real saldoini_gc = ZERO; + real saldosca_gc = ZERO; + real saldopro_gc = ZERO; + real prg_dare_gc = ZERO; + real prg_avere_gc = ZERO; + real prg_daresca_gc = ZERO; + real prg_averesca_gc = ZERO; + real prg_darepro_gc = ZERO; + real prg_averepro_gc = ZERO; + real saldoini = ZERO; + real pdare = ZERO; + real pavere = ZERO; + real pdaresca = ZERO; + real paveresca = ZERO; + real pdarepro = ZERO; + real paverepro = ZERO; + int gruppo, conto, anno; + long sottoconto; + long ultimo_num = 0l; + TDate ultima_data = 0; + + ss().reset(); + _riga.destroy(); + + TRecnotype items = _cur->items(); + *_cur = 0l; + + for (int i = 0; i < items; i++,++(*_cur)) + { + anno = _cur->curr().get_int(SLD_ANNOES); + gruppo = _cur->curr().get_int(SLD_GRUPPO); + conto = _cur->curr().get_int(SLD_CONTO); + sottoconto = _cur->curr().get_long(SLD_SOTTOCONTO); + + if (gruppo != _g) continue; + + if (_saldo_conto && conto != _c) continue; + + if (_saldo_conto || _saldo_gruppo) + _riga.add_riga(_cur->curr()); + + if (_saldo_sottoc) + { + flagsal = _cur->curr().get_char(SLD_FLAGSALINI); + saldoini = _cur->curr().get_real(SLD_SALDO); + pdare = _cur->curr().get_real(SLD_PDARE); + pavere = _cur->curr().get_real(SLD_PAVERE); + pdaresca = _cur->curr().get_real(SLD_PDARESCA); + paveresca = _cur->curr().get_real(SLD_PAVERESCA); + pdarepro = _cur->curr().get_real(SLD_PDAREPRO); + paverepro = _cur->curr().get_real(SLD_PAVEREPRO); + ultima_data = _cur->curr().get(SLD_DATAULMOV); + ultimo_num = _cur->curr().get_long(SLD_NUMULTMOV); + if (flagsal == 'D') + saldo = pdare + saldoini - pavere; + else + saldo = pdare - saldoini - pavere; + saldosca = saldo + pdaresca - paveresca; //in realta' non e' proprio il saldo degli scaricati ma quello complessivo + saldopro = pdarepro - paverepro; + + add_r(i,anno,pdaresca,paveresca,saldosca,flagsal,saldoini,pdare,pavere,saldo,ultima_data,ultimo_num,pdarepro,paverepro,saldopro); + } + } + if (_saldo_gruppo || _saldo_conto) + { + for (int j = 0; j < _riga.items(); j++) + { + TRectype& riga = (TRectype&)_riga[j]; + anno = riga.get_int(SLD_ANNOES); + pdaresca = riga.get_real(SLD_PDARESCA); + paveresca = riga.get_real(SLD_PAVERESCA); + //saldosca = pdaresca - paveresca; + flagsal = riga.get_char(SLD_FLAGSALINI); + saldoini = riga.get_real(SLD_SALDO); + pdare = riga.get_real(SLD_PDARE); + pavere = riga.get_real(SLD_PAVERE); + saldo = pdare - pavere + saldoini; + saldosca = saldo + pdaresca - paveresca; + pdarepro = riga.get_real(SLD_PDAREPRO); + paverepro = riga.get_real(SLD_PAVEREPRO); + saldopro = pdarepro - paverepro; + ultima_data = riga.get(SLD_DATAULMOV); + ultimo_num = riga.get_long(SLD_NUMULTMOV); + add_r(j,anno,pdaresca,paveresca,saldosca,flagsal,saldoini,pdare,pavere,saldo,ultima_data,ultimo_num,pdarepro,paverepro,saldopro); + } + _riga.destroy(); + } +} + +int cg5200(int argc, char* argv[]) +{ + CG5200_application a; + a.run(argc, argv, "Visualizzazione saldi"); + return 0; +} + + + + diff --git a/cg/cg5200.h b/cg/cg5200.h index 6655ced05..84c459698 100755 --- a/cg/cg5200.h +++ b/cg/cg5200.h @@ -1,11 +1,11 @@ -#define F_ANNO 101 -#define F_TIPOCF 102 -#define F_GRUPPO 103 -#define F_CONTO 104 -#define F_SOTTOCONTO 105 -#define F_DESCR_CONTO 106 -#define F_SOTTOC_CLIENTE 107 -#define F_DESCR_CLIENTE 108 -#define F_SOTTOC_FORN 109 -#define F_DESCR_FORN 110 -#define F_SHEET_SALDI 111 +#define F_ANNO 101 +#define F_TIPOCF 102 +#define F_GRUPPO 103 +#define F_CONTO 104 +#define F_SOTTOCONTO 105 +#define F_DESCR_CONTO 106 +#define F_SOTTOC_CLIENTE 107 +#define F_DESCR_CLIENTE 108 +#define F_SOTTOC_FORN 109 +#define F_DESCR_FORN 110 +#define F_SHEET_SALDI 111 diff --git a/cg/cg5200a.uml b/cg/cg5200a.uml index 8a4dda247..407b979f8 100755 --- a/cg/cg5200a.uml +++ b/cg/cg5200a.uml @@ -1,340 +1,377 @@ -#include "cg5200.h" - -TOOLBAR "" 0 20 0 2 - -#include - -ENDPAGE - -PAGE "Visualizzazione saldi" -1 -1 78 18 - -NUMBER F_ANNO 4 -BEGIN - PROMPT 4 1 "Anno esercizio " - KEY 1 - USE ESC - CHECKTYPE NORMAL - INPUT CODTAB[1,4] F_ANNO - DISPLAY "Anno" CODTAB[1,4] - DISPLAY "Data inizio esercizio" D0 - DISPLAY "Data fine esercizio" D1 - OUTPUT F_ANNO CODTAB[1,4] - FLAGS "RZ" -END - -GROUPBOX DLG_NULL 73 4 -BEGIN - PROMPT 3 2 "" - //FLAGS "R" -END - -LIST F_TIPOCF 9 -BEGIN - PROMPT 4 3 "Tipo " - FLAGS "U" - ITEM " |Conto" MESSAGE HIDE,2@|HIDE,3@|SHOW,1@ - ITEM "C|Cliente" MESSAGE HIDE,1@|HIDE,3@|SHOW,2@ - ITEM "F|Fornitore" MESSAGE HIDE,1@|HIDE,2@|SHOW,3@ - KEY 1 -END - -NUMBER F_GRUPPO 3 -BEGIN - PROMPT 26 3 "Gruppo " - USE LF_PCON KEY 1 SELECT CONTO="" - FIELD LF_PCON->GRUPPO - KEY 1 - INPUT GRUPPO F_GRUPPO - DISPLAY "Gruppo" GRUPPO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPO GRUPPO - CHECKTYPE NORMAL - FLAGS "R" -END - -NUMBER F_CONTO 3 -BEGIN - PROMPT 40 3 "Conto " - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") - FIELD LF_PCON->CONTO - KEY 1 - INPUT GRUPPO F_GRUPPO - INPUT CONTO F_CONTO - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_TIPOCF TMCF - OUTPUT F_GRUPPO GRUPPO - OUTPUT F_CONTO CONTO - OUTPUT F_DESCR_CONTO DESCR - FLAGS "R" - CHECKTYPE NORMAL - WARNING "Conto inesistente o mancante" - //MESSAGE DIRTY,F_SOTTOCONTO|DIRTY,F_SOTTOC_CLIENTE|DIRTY,F_SOTTOC_FORN -END - -NUMBER F_SOTTOCONTO 6 -BEGIN - PROMPT 54 3 "Sottoconto " - USE LF_PCON SELECT SOTTOCONTO!="" - FIELD LF_PCON->SOTTOCONTO - KEY 1 - INPUT GRUPPO F_GRUPPO - INPUT CONTO F_CONTO - INPUT SOTTOCONTO F_SOTTOCONTO - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Sottoconto" SOTTOCONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPO GRUPPO - OUTPUT F_CONTO CONTO - OUTPUT F_SOTTOCONTO SOTTOCONTO - OUTPUT F_DESCR_CONTO DESCR - //MESSAGE COPY,F_SOTTOC_FORN //li gestisco da programma senno' fanno casino - //MESSAGE COPY,F_SOTTOC_CLIENTE - FLAGS "R" - CHECKTYPE NORMAL - GROUP 1 - VALIDATE AUTOEXIT_FUNC 3 F_GRUPPO F_CONTO F_SOTTOCONTO - WARNING "Conto inesistente" -END - -NUMBER F_SOTTOC_CLIENTE 6 -BEGIN - PROMPT 54 3 "Cliente " - USE LF_CLIFO - //FIELD LF_CLIFO->CODCF - INPUT TIPOCF "C" - INPUT CODCF F_SOTTOC_CLIENTE - DISPLAY "Codice" CODCF - DISPLAY "Ragione Sociale@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - OUTPUT F_SOTTOC_CLIENTE CODCF - OUTPUT F_DESCR_CLIENTE RAGSOC - //MESSAGE COPY,F_SOTTOCONTO - //MESSAGE COPY,F_SOTTOC_FORN - FLAGS "R" - KEY 1 - CHECKTYPE NORMAL - GROUP 2 - VALIDATE AUTOEXIT_FUNC 3 F_GRUPPO F_CONTO F_SOTTOC_CLIENTE - WARNING "Conto inesistente" -END - -NUMBER F_SOTTOC_FORN 6 -BEGIN - PROMPT 54 3 "Fornitore " - USE LF_CLIFO - //FIELD LF_CLIFO->CODCF - INPUT TIPOCF "F" - INPUT CODCF F_SOTTOC_FORN - DISPLAY "Codice" CODCF - DISPLAY "Ragione Sociale@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - OUTPUT F_SOTTOC_FORN CODCF - OUTPUT F_DESCR_FORN RAGSOC - FLAGS "R" - KEY 1 //serve per l'autopremimento - CHECKTYPE NORMAL - //MESSAGE COPY,F_SOTTOCONTO - //MESSAGE COPY,F_SOTTOC_CLIENTE - GROUP 3 - VALIDATE AUTOEXIT_FUNC 3 F_GRUPPO F_CONTO F_SOTTOC_FORN - WARNING "Conto inesistente" -END - -STRING F_DESCR_CONTO 50 -BEGIN - PROMPT 4 4 "Descrizione " - USE LF_PCON KEY 2 - INPUT DESCR F_DESCR_CONTO - DISPLAY "Descrizione@50" DESCR - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Sottoconto" SOTTOCONTO - COPY OUTPUT F_SOTTOCONTO - MESSAGE COPY,F_DESCR_CLIENTE - MESSAGE COPY,F_DESCR_FORN - KEY 1 - CHECKTYPE NORMAL - GROUP 1 -END - -STRING F_DESCR_CLIENTE 50 -BEGIN - PROMPT 4 4 "Cliente " - USE LF_CLIFO KEY 2 - INPUT TIPOCF "C" - INPUT RAGSOC F_DESCR_CLIENTE - DISPLAY "Ragione Sociale Cliente@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Codice" CODCF - COPY OUTPUT F_SOTTOC_CLIENTE - MESSAGE COPY,F_DESCR_CONTO - MESSAGE COPY,F_DESCR_FORN - KEY 1 - CHECKTYPE NORMAL - GROUP 2 -END - -STRING F_DESCR_FORN 50 -BEGIN - PROMPT 4 4 "Fornitore " - USE LF_CLIFO KEY 2 - INPUT TIPOCF "F" - INPUT RAGSOC F_DESCR_FORN - DISPLAY "Ragione Sociale Fornitore@50" RAGSOC - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Codice" CODCF - COPY OUTPUT F_SOTTOC_FORN - MESSAGE COPY,F_DESCR_CONTO - MESSAGE COPY,F_DESCR_CLIENTE - KEY 1 - CHECKTYPE NORMAL - GROUP 3 -END - -SPREADSHEET F_SHEET_SALDI -BEGIN - PROMPT 2 6 "" - ITEM "Es." - ITEM "Progr.Mov.Elim.: Dare" - ITEM " Avere" - ITEM " Saldo" - ITEM " Saldo iniziale" - ITEM "Progr.Att.: Dare" - ITEM " Avere" - ITEM " Saldo" - ITEM "Ult.Op.: Data" - ITEM " Numero" - ITEM "Progr.Mov.Prov.: Dare" - ITEM " Avere" - ITEM " Saldo" -END - -ENDPAGE - -ENDMASK - -PAGE "" -1 -1 71 20 - -NUMBER 101 4 -BEGIN - PROMPT 1 1 "Anno esercizio " - FLAGS "R" -END - -NUMBER 102 15 -BEGIN - PROMPT 1 4 "Progr.Mov.Eliminati: Dare " - FLAGS "R" - PICTURE "." -END - -NUMBER 103 15 -BEGIN - PROMPT 42 4 "Avere " - FLAGS "R" - PICTURE "." -END - -STRING 104 17 -BEGIN - PROMPT 60 4 "Saldo " - FLAGS "R" -END - -/* -NUMBER 105 15 -BEGIN - PROMPT 1 5 "Progr.Attuali: Saldo Iniziale " - FLAGS "R" -END - -STRING 105 1 -BEGIN - PROMPT 1 5 "Segno " -END -*/ - -STRING 105 15 -BEGIN - PROMPT 1 5 "Saldo Iniziale " - FLAGS "R" -END - -NUMBER 106 15 -BEGIN - PROMPT 42 5 "Progr.Attuali: Dare " - FLAGS "R" - PICTURE "." -END - -NUMBER 107 15 -BEGIN - PROMPT 60 5 "Avere " - FLAGS "R" - PICTURE "." -END - -STRING 108 17 -BEGIN - PROMPT 1 6 "Saldo " - FLAGS "R" -END - -DATE 109 -BEGIN - PROMPT 1 8 "Ultima data operazione " - FLAGS "R" -END - -NUMBER 110 7 -BEGIN - PROMPT 1 9 "Ultimo numero operazione " - FLAGS "R" -END - -NUMBER 111 15 -BEGIN - PROMPT 1 6 "Progr.Mov.Provvisori: Dare " - FLAGS "R" - PICTURE "." -END - -NUMBER 112 15 -BEGIN - PROMPT 42 6 "Avere " - FLAGS "R" - PICTURE "." -END - -STRING 113 17 -BEGIN - PROMPT 60 6 "Saldo " - FLAGS "R" -END - -BUTTON DLG_OK 9 2 -BEGIN - PROMPT -13 -1 "" -END - -BUTTON DLG_CANCEL 9 2 -BEGIN - PROMPT -23 -1 "" -END - -BUTTON DLG_NULL 9 2 -BEGIN - PROMPT -33 -1 "Azzera" - MESSAGE RESET,1@ -END - -ENDPAGE - -ENDMASK +#include "cg5200.h" + +TOOLBAR "" 0 20 0 2 + +#include + +ENDPAGE + +PAGE "Visualizzazione saldi" -1 -1 78 18 + +NUMBER F_ANNO 4 +BEGIN + PROMPT 4 1 "Anno esercizio " + KEY 1 + USE ESC + CHECKTYPE NORMAL + INPUT CODTAB[1,4] F_ANNO + DISPLAY "Anno" CODTAB[1,4] + DISPLAY "Data inizio esercizio" D0 + DISPLAY "Data fine esercizio" D1 + OUTPUT F_ANNO CODTAB[1,4] + FLAGS "RZ" +END + +GROUPBOX DLG_NULL 73 4 +BEGIN + PROMPT 3 2 "" + //FLAGS "R" +END + +LIST F_TIPOCF 9 +BEGIN + PROMPT 4 3 "Tipo " + FLAGS "U" + ITEM " |Conto" MESSAGE HIDE,2@|HIDE,3@|SHOW,1@ + ITEM "C|Cliente" MESSAGE HIDE,1@|HIDE,3@|SHOW,2@ + ITEM "F|Fornitore" MESSAGE HIDE,1@|HIDE,2@|SHOW,3@ + KEY 1 +END + +NUMBER F_GRUPPO 3 +BEGIN + PROMPT 26 3 "Gruppo " + USE LF_PCON KEY 1 SELECT CONTO="" + FIELD LF_PCON->GRUPPO + KEY 1 + INPUT GRUPPO F_GRUPPO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPO GRUPPO + OUTPUT F_DESCR_CONTO DESCR + CHECKTYPE NORMAL + FLAGS "R" +END + +NUMBER F_CONTO 3 +BEGIN + PROMPT 40 3 "Conto " + USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") + FIELD LF_PCON->CONTO + KEY 1 + INPUT GRUPPO F_GRUPPO + INPUT CONTO F_CONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_TIPOCF TMCF + OUTPUT F_GRUPPO GRUPPO + OUTPUT F_CONTO CONTO + //OUTPUT F_DESCR_CLIENTE DESCR + //OUTPUT F_DESCR_FORN DESCR + OUTPUT F_DESCR_CONTO DESCR + FLAGS "R" + CHECKTYPE NORMAL + WARNING "Conto inesistente o mancante" + //MESSAGE DIRTY,F_SOTTOCONTO|DIRTY,F_SOTTOC_CLIENTE|DIRTY,F_SOTTOC_FORN + MESSAGE DIRTY,F_DESCR_CONTO|DIRTY,F_DESCR_CLIENTE|DIRTY,F_DESCR_FORN +END + +NUMBER F_SOTTOCONTO 6 +BEGIN + PROMPT 54 3 "Sottoconto " + USE LF_PCON + FIELD LF_PCON->SOTTOCONTO + KEY 1 + INPUT GRUPPO F_GRUPPO + INPUT CONTO F_CONTO + INPUT SOTTOCONTO F_SOTTOCONTO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_GRUPPO GRUPPO + OUTPUT F_CONTO CONTO + OUTPUT F_SOTTOCONTO SOTTOCONTO + OUTPUT F_DESCR_CONTO DESCR + //OUTPUT F_DESCR_CLIENTE DESCR + //OUTPUT F_DESCR_FORN DESCR + //MESSAGE COPY,F_SOTTOC_FORN //li gestisco da programma senno' fanno casino + //MESSAGE COPY,F_SOTTOC_CLIENTE + FLAGS "R" + CHECKTYPE NORMAL + GROUP 1 + WARNING "Conto inesistente" +END + +NUMBER F_SOTTOC_CLIENTE 6 +BEGIN + PROMPT 54 3 "Cliente " + USE LF_CLIFO + //FIELD LF_CLIFO->CODCF + INPUT TIPOCF "C" + INPUT CODCF F_SOTTOC_CLIENTE + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOC_CLIENTE CODCF + OUTPUT F_DESCR_CONTO RAGSOC + //OUTPUT F_DESCR_CLIENTE RAGSOC + //OUTPUT F_DESCR_FORN RAGSOC + FLAGS "R" + KEY 1 + CHECKTYPE NORMAL + WARNING "Cliente inesistente" + GROUP 2 +END + +NUMBER F_SOTTOC_FORN 6 +BEGIN + PROMPT 54 3 "Fornitore " + USE LF_CLIFO + //FIELD LF_CLIFO->CODCF + INPUT TIPOCF "F" + INPUT CODCF F_SOTTOC_FORN + DISPLAY "Codice" CODCF + DISPLAY "Ragione Sociale@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + OUTPUT F_SOTTOC_FORN CODCF + //OUTPUT F_DESCR_FORN RAGSOC + OUTPUT F_DESCR_CONTO RAGSOC + //OUTPUT F_DESCR_CLIENTE RAGSOC + FLAGS "R" + KEY 1 //serve per l'autopremimento + CHECKTYPE NORMAL + WARNING "Fornitore inesistente" + GROUP 3 +END + +STRING F_DESCR_CONTO 50 +BEGIN + PROMPT 4 4 "Descrizione " + USE LF_PCON KEY 2 + INPUT DESCR F_DESCR_CONTO + DISPLAY "Descrizione@50" DESCR + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_SOTTOCONTO + KEY 1 + CHECKTYPE NORMAL + GROUP 1 +END + +STRING F_DESCR_CLIENTE 50 +BEGIN + PROMPT 4 4 "Cliente " + USE LF_CLIFO KEY 2 + INPUT TIPOCF "C" + INPUT RAGSOC F_DESCR_CLIENTE + DISPLAY "Ragione Sociale Cliente@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOC_CLIENTE + KEY 1 + CHECKTYPE NORMAL + GROUP 2 +END + +STRING F_DESCR_FORN 50 +BEGIN + PROMPT 4 4 "Fornitore " + USE LF_CLIFO KEY 2 + INPUT TIPOCF "F" + INPUT RAGSOC F_DESCR_FORN + DISPLAY "Ragione Sociale Fornitore@50" RAGSOC + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Codice" CODCF + COPY OUTPUT F_SOTTOC_FORN + KEY 1 + CHECKTYPE NORMAL + GROUP 3 +END + +SPREADSHEET F_SHEET_SALDI +BEGIN + PROMPT 2 6 "" + ITEM "Es." + ITEM " Saldo iniziale" + ITEM "" + ITEM "Progr.Att.: Dare" + ITEM " Avere" + ITEM " Saldo" + ITEM "" + ITEM "Progr.Mov.Elim.: Dare" + ITEM " Avere" + ITEM "Saldo complessivo" + ITEM "" + ITEM "Ult.Op.: Data" + ITEM " Numero" + ITEM "Progr.Mov.Prov.: Dare" + ITEM " Avere" + ITEM " Saldo" + ITEM "" +END + +ENDPAGE + +ENDMASK + +PAGE "" -1 -1 70 16 + +NUMBER 101 4 +BEGIN + PROMPT 1 1 "Anno esercizio " + FLAGS "R" +END + +NUMBER 102 15 +BEGIN + PROMPT 1 3 "Saldo Iniziale " + FLAGS "R" + PICTURE "." +END + +STRING 103 1 +BEGIN + PROMPT 44 3 "" +END + +NUMBER 104 15 +BEGIN + PROMPT 1 4 "Progr.Attuali: Dare " + FLAGS "R" + PICTURE "." +END + +NUMBER 105 15 +BEGIN + PROMPT 45 4 "Avere " + FLAGS "R" + PICTURE "." +END + +NUMBER 106 15 +BEGIN + PROMPT 22 5 "Saldo " + FLAGS "R" + PICTURE "." +END + +STRING 107 1 +BEGIN + PROMPT 44 5 "" +END + +NUMBER 108 15 +BEGIN + PROMPT 1 6 "Progr.Mov.Eliminati: Dare " + FLAGS "R" + PICTURE "." +END + +NUMBER 109 15 +BEGIN + PROMPT 45 6 "Avere " + FLAGS "R" + PICTURE "." +END + +NUMBER 110 15 +BEGIN + PROMPT 1 7 "Saldo complessivo " + FLAGS "R" + PICTURE "." +END + +STRING 111 1 +BEGIN + PROMPT 44 7 "" +END + +/* +NUMBER 105 15 +BEGIN + PROMPT 1 5 "Progr.Attuali: Saldo Iniziale " + FLAGS "R" +END + +STRING 105 1 +BEGIN + PROMPT 1 5 "Segno " +END +*/ + +DATE 112 +BEGIN + PROMPT 1 8 "Ultima data operazione " + FLAGS "R" +END + +NUMBER 113 7 +BEGIN + PROMPT 1 9 "Ultimo numero operazione " + FLAGS "R" +END + +NUMBER 114 15 +BEGIN + PROMPT 1 10 "Progr.Mov.Provvisori: Dare " + FLAGS "R" + PICTURE "." +END + +NUMBER 115 15 +BEGIN + PROMPT 45 10 "Avere " + FLAGS "R" + PICTURE "." +END + +NUMBER 116 15 +BEGIN + PROMPT 1 11 "Saldo " + FLAGS "R" + PICTURE "." +END + +STRING 117 1 +BEGIN + PROMPT 44 11 "" +END + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_CANCEL 9 2 +BEGIN + PROMPT -22 -1 "" +END + +/* +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -13 -1 "" +END + +BUTTON DLG_CANCEL 9 2 +BEGIN + PROMPT -23 -1 "" +END + +BUTTON DLG_NULL 9 2 +BEGIN + PROMPT -33 -1 "Azzera" + MESSAGE RESET,1@ +END +*/ + +ENDPAGE + +ENDMASK