diff --git a/cg/Attic/cg1400a.uml b/cg/Attic/cg1400a.uml index d1d4bfaf2..f20c88da0 100755 --- a/cg/Attic/cg1400a.uml +++ b/cg/Attic/cg1400a.uml @@ -145,7 +145,7 @@ END STRING F_PROFILO 5 BEGIN PROMPT 2 13 "Profilo " - VALIDATE ZEROFILL_FUNC 5 + FLAGS "UZ" CHECKTYPE REQUIRED END diff --git a/cg/cg0100a.uml b/cg/cg0100a.uml index 451546618..ee0df0dd0 100755 --- a/cg/cg0100a.uml +++ b/cg/cg0100a.uml @@ -27,6 +27,7 @@ BEGIN DISPLAY "Descrizione@50" DESCR OUTPUT FLD_CM1_GRUPPO GRUPPO OUTPUT FLD_CM1_DESCG DESCR + OUTPUT FLD_CM1_DESC DESCR CHECKTYPE NORMAL END @@ -43,7 +44,7 @@ BEGIN FIELD LF_PCON->CONTO FLAGS "R" KEY 1 - USE LF_PCON KEY 1 SELECT ((CONTO!="") && (SOTTOCONTO="")) + USE LF_PCON KEY 1 SELECT ((CONTO!="")&&(SOTTOCONTO="")) COPY INPUT FLD_CM1_GRUPPO INPUT CONTO FLD_CM1_CONTO DISPLAY "Gruppo" GRUPPO @@ -52,6 +53,7 @@ BEGIN OUTPUT FLD_CM1_GRUPPO GRUPPO OUTPUT FLD_CM1_CONTO CONTO OUTPUT FLD_CM1_DESCC DESCR + OUTPUT FLD_CM1_DESC DESCR CHECKTYPE NORMAL END diff --git a/cg/cg0200a.uml b/cg/cg0200a.uml index 12d049850..c94ad053e 100755 --- a/cg/cg0200a.uml +++ b/cg/cg0200a.uml @@ -182,6 +182,19 @@ BEGIN HELP "Localita' del recapito" END +STRING F_CAPCF 5 +BEGIN + PROMPT 50 8 "CAP " + FIELD LF_CLIFO->CAPCF + HELP "Codice di avviamento postale del recapito" +END + +STRING F_PROVCF 5 +BEGIN + PROMPT 63 8 "Prov." + FLAGS "D" +END + NUMBER F_STATOCF 3 BEGIN PROMPT 2 9 "Comune:Stato " @@ -208,19 +221,6 @@ BEGIN COPY OUTPUT F_STATOCF END -STRING F_PROVCF 5 -BEGIN - PROMPT 63 8 "Prov." - FLAGS "D" -END - -STRING F_CAPCF 5 -BEGIN - PROMPT 50 8 "CAP " - FIELD LF_CLIFO->CAPCF - HELP "Codice di avviamento postale del recapito" -END - STRING F_COMCF 4 BEGIN PROMPT 8 10 ":Codice " diff --git a/cg/cg0500.cpp b/cg/cg0500.cpp index 328a2d055..75280752f 100755 --- a/cg/cg0500.cpp +++ b/cg/cg0500.cpp @@ -41,7 +41,9 @@ typedef enum { no_descr, acquisto, vendita, incasso_pagamento, int _anno_iva; protected: + static bool filtra_reg(const TRelation * r); + void set_reg_filter(); static bool tipocf_hndl (TMask_field& f, KEY k); static bool cod_reg_hndl (TMask_field& f, KEY k); @@ -69,7 +71,6 @@ protected: void causale_vendite (); void causale_acquisti(); -protected: virtual bool user_create(); virtual bool user_destroy(); @@ -99,7 +100,7 @@ public: void add_riga (int numrig, char sz, TConto& tc, const TString& d, const TString& da); bool mostra_campi(TMask_field& f); - + bool valuta() const { return _valuta; } bool saldaconto() const { return _saldaconto; } int anno_iva() const { return _anno_iva; } @@ -275,6 +276,15 @@ bool TCaus_app::m770_hndl (TMask_field& f, KEY k) return TRUE; } +void TCaus_app::set_reg_filter() +{ + TEdit_field& reg = _msk->efield(F_COD_REG); + reg.browse()->cursor()->set_filterfunction(filtra_reg); + + TEdit_field& des = _msk->efield(F_DES_REG); + des.browse()->cursor()->set_filterfunction(filtra_reg); +} + bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k) { // Testo K_TAB perche' il controllo deve scattare anche all'inizio @@ -289,10 +299,9 @@ bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k) { m.hide(F_TIPO_MOV_2); if (app().saldaconto()) m.show(F_TIPO_MOV_1); - + field_reg.enable(); m.enable(F_DES_REG); - field_reg.check_type(CHECK_REQUIRED); TTable tabtpd("%TPD"); tabtpd.put("CODTAB", val); @@ -307,32 +316,32 @@ bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k) if (corrisp) // vendite con corrispettivi { app()._filtro = 2; - field_reg.browse()->cursor()->set_filterfunction(filtra_reg); + app().set_reg_filter(); } else // vendite senza corrispettivi { app()._filtro = 1; - field_reg.browse()->cursor()->set_filterfunction(filtra_reg); + app().set_reg_filter(); } } else if ( i == 2 ) // acquisti { app()._filtro = 3; - field_reg.browse()->cursor()->set_filterfunction(filtra_reg); + app().set_reg_filter(); } else if ( i == 9 ) // sia acquisti che vendite { app()._filtro = 4; - field_reg.browse()->cursor()->set_filterfunction(filtra_reg); + app().set_reg_filter(); } } } else // TIPODOC vuoto || IN || PG || AN { field_reg.reset(); - field_reg.disable(); + field_reg.enable(m.query_mode()); m.reset(F_DES_REG); - m.disable(F_DES_REG); + m.enable(F_DES_REG, m.query_mode()); m.hide(F_TIPO_MOV_1); if (app().saldaconto()) @@ -865,7 +874,6 @@ void TCaus_app::init_insert_mode(TMask& m) void TCaus_app::init_modify_mode(TMask& m) { init_mask(m); - m.efield(F_COD_REG).check_type(CHECK_NONE); // Disabilita temporaneamente il check sui registri } diff --git a/cg/cg0500a.uml b/cg/cg0500a.uml index a7c68b500..e795b28f8 100755 --- a/cg/cg0500a.uml +++ b/cg/cg0500a.uml @@ -98,7 +98,7 @@ BEGIN HELP "Codice registro collegato alla causale" FIELD REG USE REG - INPUT CODTAB[1,4] F_ANNOES SELECT + INPUT CODTAB[1,4] F_ANNOES INPUT CODTAB[5,7] F_COD_REG DISPLAY "Anno" CODTAB[1,4] DISPLAY "Codice registro " CODTAB[5,7] @@ -110,14 +110,13 @@ BEGIN OUTPUT F_CORRISP B0 OUTPUT F_DES_REG S0 WARNING "Registro assente o non compatibile col tipo documento" - CHECKTYPE NORMAL - FLAGS "DUZ" + CHECKTYPE REQUIRED + FLAGS "UZ" END STRING F_DES_REG 50 BEGIN PROMPT 24 4 "" - HELP "Codice registro collegato alla causale" USE REG KEY 2 INPUT S0 F_DES_REG DISPLAY "Descrizione @50" S0 @@ -126,10 +125,20 @@ BEGIN DISPLAY "Tipo" I0 DISPLAY "Corrispettivi" B0 COPY OUTPUT F_COD_REG - CHECKTYPE NORMAL - FLAGS "D" + CHECKTYPE REQUIRED END +NUMBER F_ANNOES 4 +BEGIN + PROMPT 2 5 "Anno liquidaz. " + FLAGS "HA" +END + +NUMBER F_TIPO_REG 1 +BEGIN + PROMPT 25 5 "Tipo " + FLAGS "H" +END // Questo rimane quasi sempre nascosto STRING F_TIPO_MOV 2 @@ -179,18 +188,6 @@ BEGIN ITEM "6|Ritenute per prestazioni occasionali" END -NUMBER F_ANNOES 4 -BEGIN - PROMPT 2 5 "" - FLAGS "AH" -END - -NUMBER F_TIPO_REG 1 -BEGIN - PROMPT 23 5 "" - FLAGS "H" -END - BOOLEAN F_CORRISP BEGIN PROMPT 33 5 "" diff --git a/cg/cg1.cpp b/cg/cg1.cpp index d36d8d762..f3e3ab578 100755 --- a/cg/cg1.cpp +++ b/cg/cg1.cpp @@ -1,5 +1,7 @@ #include #include + +#define __MAIN__ #include "cg1.h" #define usage "Error - usage : %s -{0|1|2|3|4|5} [params]" diff --git a/cg/cg1.h b/cg/cg1.h index ea47f786a..e0682440b 100755 --- a/cg/cg1.h +++ b/cg/cg1.h @@ -1,21 +1,10 @@ #ifndef __CG1_H #define __CG1_H -#ifdef MAIN -#define extern -#endif - -#ifdef MAIN -#undef extern -#endif - #ifndef __STRINGS_H #include #endif -const MAXSTR = 128; -static char __tmp [MAXSTR]; - int cg1100(int argc, char* argv[]); int cg1200(int argc, char* argv[]); int cg1300(int argc, char* argv[]); @@ -24,6 +13,17 @@ int cg1500(int argc, char* argv[]); int cg1600(int argc, char* argv[]); int cg1700(int argc, char* argv[]); +#ifdef __MAIN__ +#define extern +#endif + +extern TString80 tmp; + +#ifdef __MAIN__ +#undef extern +#endif + + #endif // __CG1_H diff --git a/cg/cg1100.cpp b/cg/cg1100.cpp index 94835f945..ec8c5de1b 100755 --- a/cg/cg1100.cpp +++ b/cg/cg1100.cpp @@ -30,9 +30,6 @@ enum stampe { senza_ana_bil }; -extern char __tmp [MAXSTR]; -static TFixed_string tmp(__tmp, MAXSTR); - class CG1100_application : public TPrintapp { struct bil_ivd @@ -1139,7 +1136,7 @@ const char* CG1100_application::descrizione_numero(char sezione, char lettera, i tmp = tabivd.get("S0"); else tmp = ""; - return (__tmp); + return tmp; } diff --git a/cg/cg1200.cpp b/cg/cg1200.cpp index 1664e21d4..8c0dbc4f5 100755 --- a/cg/cg1200.cpp +++ b/cg/cg1200.cpp @@ -26,9 +26,6 @@ enum pw { clienti = 1, fornitori = 2, both = 3 }; bool mask2_reset_fields(TMask_field& mf, KEY k); -extern char __tmp [MAXSTR]; -static TFixed_string tmp(__tmp, MAXSTR); - class CG1200_App : public TPrintapp { friend bool mask2_reset_fields(TMask_field& mf, KEY k); @@ -136,7 +133,7 @@ const char* CG1200_App::descrizione_conto_ric(int gruppo, int conto, long sottoc pconti.zero(); tmp = pconti.get(PCN_DESCR); - return (__tmp); + return tmp; } const char* CG1200_App::descrizione_allegato(char tipocf,long cod) @@ -153,7 +150,7 @@ const char* CG1200_App::descrizione_allegato(char tipocf,long cod) _tipoaper = clifo.get_char(CLI_TIPOAPER); tmp = clifo.get(CLI_RAGSOC); - return (__tmp); + return tmp; } bool CG1200_App::preprocess_page(int file, int counter) @@ -402,7 +399,7 @@ const char* CG1200_App::compatta_ragsoc(TString& ragsoc,char tipoa) tmp = ragsoc; - return (__tmp); + return tmp; } void CG1200_App::preprocess_header() diff --git a/cg/cg1400a.uml b/cg/cg1400a.uml index d1d4bfaf2..f20c88da0 100755 --- a/cg/cg1400a.uml +++ b/cg/cg1400a.uml @@ -145,7 +145,7 @@ END STRING F_PROFILO 5 BEGIN PROMPT 2 13 "Profilo " - VALIDATE ZEROFILL_FUNC 5 + FLAGS "UZ" CHECKTYPE REQUIRED END diff --git a/cg/cg1500.cpp b/cg/cg1500.cpp index 3c153699d..98ba6cae6 100755 --- a/cg/cg1500.cpp +++ b/cg/cg1500.cpp @@ -24,8 +24,6 @@ #include "cg1.h" #include "cg1500.h" -static TString256 TMP; - bool my_handler (TMask_field& f, KEY k); bool mask_anno (TMask_field& f, KEY k); bool mask_datalim (TMask_field& f, KEY k); @@ -2857,11 +2855,6 @@ TDate CG1500_application::UltimaData(int g, int c, long s, int anno) const char* CG1500_application::DescrizioneConto(int g, int c, long s, char tipocf) { - /* - TConto tc (g,c,s,tipocf); - TMP = tc.descrizione(); - return TMP; - */ TString80 ragsoc; const char* desc = NULL; TLocalisamfile pconti(LF_PCON,FALSE); @@ -2875,7 +2868,7 @@ const char* CG1500_application::DescrizioneConto(int g, int c, long s, pconti.put(PCN_SOTTOCONTO, s); pconti.read(); if (pconti.good()) - TMP = pconti.get(PCN_DESCR); + tmp = pconti.get(PCN_DESCR); else { clifo.setkey(1); //occorre settare la chiave 1, anche se di solito e' di default, poiche' nella create il file clifo e' stato aperto con la chiave 3 @@ -2898,12 +2891,12 @@ const char* CG1500_application::DescrizioneConto(int g, int c, long s, } else desc = clifo.get("RAGSOC"); - TMP = desc; + tmp = desc; } else - TMP = ""; + tmp = ""; } - return TMP; + return tmp; } bool CG1500_application::user_create() diff --git a/cg/cg1600.cpp b/cg/cg1600.cpp index 8648f1c47..765c5a6c8 100755 --- a/cg/cg1600.cpp +++ b/cg/cg1600.cpp @@ -21,9 +21,6 @@ #include "cg1.h" #include "cg1600.h" -extern char __tmp [MAXSTR]; -static TFixed_string tmp(__tmp, MAXSTR); - bool our_handler (TMask_field & f,KEY k); class Anno_es : public TObject @@ -4614,7 +4611,7 @@ const char* CG1600_application::descrizione_sezione(char sezione) tmp = tabivd.get("S0"); else tmp = ""; - return (__tmp); + return tmp; } const char* CG1600_application::descrizione_lettera(char sezione, char lettera) @@ -4631,7 +4628,7 @@ const char* CG1600_application::descrizione_lettera(char sezione, char lettera) tmp = tabivd.get("S0"); else tmp = ""; - return (__tmp); + return tmp; } const char* CG1600_application::descrizione_numeroromano(char sezione, char lettera, int numr) @@ -4652,7 +4649,7 @@ const char* CG1600_application::descrizione_numeroromano(char sezione, char lett tmp = tabivd.get("S0"); else tmp = ""; - return (__tmp); + return tmp; } const char* CG1600_application::descrizione_numero(char sezione, char lettera, int numr, int numero) @@ -4672,7 +4669,7 @@ const char* CG1600_application::descrizione_numero(char sezione, char lettera, i tmp = tabivd.get("S0"); else tmp = ""; - return (__tmp); + return tmp; } const char* CG1600_application::descrizione_sottoconto(int gruppo, int conto, long sottoc) @@ -4689,7 +4686,7 @@ const char* CG1600_application::descrizione_sottoconto(int gruppo, int conto, lo if (pconti.bad()) pconti.zero(); tmp = pconti.get(PCN_DESCR); - return (__tmp); + return tmp; } const char* CG1600_application::descr_sottoc_clifo(char tipocf,long s) @@ -4704,7 +4701,7 @@ const char* CG1600_application::descr_sottoc_clifo(char tipocf,long s) if (clifo.bad()) clifo.zero(); tmp = clifo.get(CLI_RAGSOC); - return (__tmp); + return tmp; } void CG1600_application::preprocess_header() diff --git a/cg/cg1600a.uml b/cg/cg1600a.uml index e41fa26de..b41824f65 100755 --- a/cg/cg1600a.uml +++ b/cg/cg1600a.uml @@ -75,12 +75,7 @@ END LIST F_TIPOSTAMPA1 23 BEGIN -<<<<<<< cg1600a.uml - PROMPT 4 7 "Tipo stampa1 " - HELP "Indicare il tipo di stampa che si vuole avere" -======= PROMPT 4 7 "Tipo stampa " ->>>>>>> 1.5 ITEM "1|Per data " MESSAGE HIDE,F_DATALIM MESSAGE RESET,F_DATALIM @@ -95,12 +90,8 @@ END DATE F_DATASTAMPA BEGIN -<<<<<<< cg1600a.uml PROMPT 4 4 "Data stampa " HELP "Indicare la data da stampare sul bilancio" -======= - PROMPT 4 8 "Data stampa " ->>>>>>> 1.5 FLAGS "A" END diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 097ec14c4..8f134a9dd 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -75,7 +75,7 @@ TMask* TPrimanota_application::load_mask(int n) m->set_handler(F_OCCASEDIT, occas_handler); m->set_handler(F_SOLAIVA, solaiva_handler); m->set_handler(F_SHEETIVA, iva_handler); - + TSheet_field& is = (TSheet_field&)m->field(F_SHEETIVA); is.set_notify(iva_notify); TMask& ism = is.sheet_mask(); @@ -220,6 +220,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year) m->show(F_NUMRIF, sal); m->enable(F_ANNORIF, ins); // Dis/abilita anno e riferimento partita m->enable(F_NUMRIF, ins); + m->field(F_NUMRIF).set_justify(iva == iva_acquisti ? _num_for : _num_cli); if (ins) { @@ -365,6 +366,8 @@ void TPrimanota_application::on_config_change() TConfig cnf(CONFIG_DITTA); _ges_val = cnf.get_bool("GesVal"); _ges_sal = cnf.get_bool("GesSal"); + _num_cli = cnf.get_bool("NrCliDx"); + _num_for = cnf.get_bool("NrForDx"); } @@ -688,11 +691,11 @@ void TPrimanota_application::mask2rel(const TMask& m) _rel->lfile().put("TIPO", clifo()); int err = ~NOERR; - if (m.get_bool(F_OCCASIONALE)) + if (m.field(F_OCCASEDIT).active()) // Se e' un occasionale { TRelation occas(LF_OCCAS); const TMask& om = occas_mask(); - om.autosave(&occas); + om.autosave(&occas); // Salva i dati anagrafici err = occas.write(); if (err == _isreinsert) diff --git a/cg/cg2100.h b/cg/cg2100.h index 9115aa7d5..6f7cf642b 100755 --- a/cg/cg2100.h +++ b/cg/cg2100.h @@ -42,7 +42,6 @@ #define F_CAMBIO 127 #define F_VISVAL 128 #define F_PROVVISORIO 129 -#define F_OCCASIONALE 130 #define F_OCCASEDIT 131 #define F_SOLAIVA 132 #define F_CORRLIRE 133 diff --git a/cg/cg2100c.uml b/cg/cg2100c.uml index be53a1f5a..009222829 100755 --- a/cg/cg2100c.uml +++ b/cg/cg2100c.uml @@ -241,6 +241,7 @@ NUMBER F_CLIENTE 6 BEGIN PROMPT 1 10 "Cliente " HELP "Codice del cliente" + FLAGS "R" FIELD LF_MOV->CODCF GROUP 1 USE LF_CLIFO KEY 1 @@ -261,7 +262,6 @@ BEGIN OUTPUT F_CODPAG CODPAG OUTPUT F_STATOPAIV STATOPAIV OUTPUT F_PIVACLIENTE PAIV - OUTPUT F_OCCASIONALE OCCAS MESSAGE COPY,F_FORNITORE CHECKTYPE REQUIRED WARNING "Cliente assente" @@ -271,6 +271,7 @@ END NUMBER F_FORNITORE 6 BEGIN PROMPT 1 10 "Fornitore " + FLAGS "R" HELP "Codice del fornitore" FIELD LF_MOV->CODCF GROUP 2 @@ -289,7 +290,6 @@ BEGIN OUTPUT F_GRUPPORIC GRUPPORIC OUTPUT F_CONTORIC CONTORIC OUTPUT F_SOTTOCONTORIC SOTTOCRIC - OUTPUT F_OCCASIONALE OCCAS OUTPUT F_CODPAG CODPAG OUTPUT F_STATOPAIV STATOPAIV OUTPUT F_PIVAFORNITORE PAIV @@ -336,7 +336,7 @@ STRING F_PIVACLIENTE 14 BEGIN PROMPT 1 11 "Partita IVA " HELP "Partita IVA del cliente del documento" - GROUP 1 + GROUP 1 7 USE LF_CLIFO KEY 5 INPUT TIPOCF "C" INPUT STATOPAIV F_STATOPAIV @@ -353,7 +353,7 @@ STRING F_PIVAFORNITORE 14 BEGIN PROMPT 1 11 "Partita IVA " HELP "Partita IVA del fornitore del documento" - GROUP 2 + GROUP 2 7 USE LF_CLIFO KEY 5 INPUT TIPOCF "F" INPUT STATOPAIV F_STATOPAIV @@ -381,22 +381,15 @@ BEGIN ITEM "LU|Lussemburgo" ITEM "NL|Olanda" ITEM "PT|Portogallo" - GROUP 1 + GROUP 1 7 END -BUTTON F_OCCASEDIT 18 +BUTTON F_OCCASEDIT 56 BEGIN - PROMPT 32 11 "Dati anagrafici" + PROMPT 1 11 "Dati anagrafici del cliente o fornitore occasionale" FLAGS "H" END -BOOLEAN F_OCCASIONALE -BEGIN - MESSAGE FALSE HIDE,F_OCCASEDIT|ENABLE,F_PIVACLIENTE|ENABLE,F_PIVAFORNITORE|SHOW,F_STATOPAIV - MESSAGE TRUE SHOW,F_OCCASEDIT|DISABLE,F_PIVACLIENTE|DISABLE,F_PIVAFORNITORE|HIDE,F_STATOPAIV - FLAGS "GH" -END - STRING F_CODPAG 4 BEGIN PROMPT 60 11 "Pagamento " @@ -418,7 +411,7 @@ BEGIN PROMPT 1 12 "Valuta " HELP "Codice della valuta per operazione con l'estero" FIELD LF_MOV->CODVAL - FLAGS "U" + FLAGS "UZ" GROUP 3 USE %VAL INPUT CODTAB F_VALUTA @@ -517,7 +510,7 @@ BEGIN PROMPT 68 15 "/ " FIELD LF_PARTITE->NUMPART FLAGS "D" - HELP "Numero documento (o protocollo IVA) di riferimento" + HELP "Numero documento di riferimento" WARNING "E' richiesto il numero di riferimento partita" CHECKTYPE REQUIRED END @@ -527,7 +520,7 @@ BEGIN PROMPT 1 17 "Valuta intracom. " HELP "Codice della valuta per operazione intracomunitaria" FIELD CODVALI - FLAGS "U" + FLAGS "UZ" GROUP 4 USE %VAL INPUT CODTAB F_VALUTAINTRA diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index 59567c302..349150a89 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -322,16 +322,12 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo) } } - -void TPrimanota_application::reset_cgs_row(int n) +void TPrimanota_application::reset_sheet_row(TSheet_field& s, int n) { - TSheet_field& cg = cgs(); - cg.row(cg.items()); // Append a new line - cg.destroy(n); // Remove line n + s.row(s.items()); // Append a new line + s.destroy(n); // Remove line n } - - int TPrimanota_application::set_cgs_row(int n, const TImporto& imp, TBill& conto, const char* desc, char tipo) @@ -590,34 +586,27 @@ void TPrimanota_application::generazione_righe_cg(int r) bool TPrimanota_application::cg_notify(int r, KEY k) -{ +{ + TSheet_field& cg = app().cgs(); + const char tipo = cg.row(r).right(1)[0]; + switch(k) { case K_SPACE: - { - TSheet_field& cg = app().cgs(); - TToken_string& row = cg.row(r); - const char tipo = row.right(1)[0]; cg.sheet_mask().enable(DLG_DELREC, tipo <= ' '); + break; + case K_ENTER: + if (app().iva() == nessuna_iva) + app().generazione_righe_cg(r); + app().calcola_saldo(); + break; + case K_DEL: + if (tipo > ' ') + return error_box("La riga %d non puo' essere cancellata", r+1); + default: + break; } - break; - case K_ENTER: - if (app().iva() == nessuna_iva) - app().generazione_righe_cg(r); - app().calcola_saldo(); - break; - case K_DEL: -{ - TToken_string& row = app().cgs().row(r); - const char tipo = row.right(1)[0]; - if (tipo > ' ') - return error_box("La riga %d non puo' essere cancellata", r+1); -} -break; -default: -break; -} -return TRUE; + return TRUE; } bool TPrimanota_application::descr_handler(TMask_field& f, KEY k) @@ -767,7 +756,7 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key) { f.warning_box("L'imposta dovrebbe essere %s", (const char*)imposta.string(".")); if (val.is_zero()) f.set(imposta.string()); - } + } } else if (key == K_F8) { @@ -788,6 +777,9 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key) } +// Calcola il totale degli imponibili e delle imposte e aggiorna +// i corrispondenti campi della maschera +// Certified 99% real TPrimanota_application::calcola_imp() const { TArray& rows = ivas().rows_array(); @@ -907,11 +899,12 @@ bool TPrimanota_application::iva_notify(int r, KEY k) // Aggiorna conto sulla riga contabile if (newpos < 0) { - if (delimp >= 0) app().reset_cgs_row(delimp); // Cancella vecchia riga + if (delimp >= 0) + app().reset_cgs_row(delimp); // Cancella vecchia riga const TImporto val(app().real2imp(imponibile, 'I')); - if (conto.ok() && !val.is_zero()) // Se c'e' imponibile ... - { // crea una nuova riga contabile + if (conto.ok() && !val.is_zero()) // Se c'e' imponibile ... + { // crea una nuova riga contabile const TString80 d(cau.desc_agg(2)); app().set_cgs_row(-1, val, conto, d, 'I'); } @@ -920,8 +913,8 @@ bool TPrimanota_application::iva_notify(int r, KEY k) { TImporto val(app().real2imp(imponibile, 'I')); val = app().add_cgs_imp(newpos, val); - if (val.valore().is_zero()) // Se la riga si e' azzerata ... - { // ... cancellala + if (val.valore().is_zero()) // Se la riga si e' azzerata ... + { // ... cancellala app().reset_cgs_row(newpos); newpos = -1; } @@ -935,7 +928,10 @@ bool TPrimanota_application::iva_notify(int r, KEY k) int newposiva = type2pos(tipod); if (newposiva < 0) - { + { + if (deliva >= 0) + app().reset_ivas_row(deliva); + if (!imposta.is_zero()) // Se c'e' imposta ... { // ... crea nuova riga per l'IVA const TImporto val(app().real2imp(imposta, 'I')); @@ -959,6 +955,10 @@ oldposiva = newposiva; if (r == 0) // Se cambio la prima riga ... app().add_cgs_tot(app().curr_mask()); // ... ricalcola conti + + if (imponibile.is_zero() && imposta.is_zero()) // Svuota riga iva nulla + app().reset_ivas_row(r); + app().calcola_imp(); // Ricalcola totale IVA app().calcola_saldo(); // Ricalcola sbilanci } @@ -991,9 +991,9 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k) const real im(row.get(0)); if (!im.is_zero()) { - const TBill c(row, 6, 0x0); - if (!c.ok()) - return f.error_box("Il conto della riga iva %d non e' completo", i+1); + TBill c(row, 6, 0x0); + if (!c.ok() || !c.find()) + return error_box("Il conto della riga iva %d e' errato o incompleto", i+1); } } } @@ -1408,33 +1408,46 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key) if (!suspended_handler(f, key)) return FALSE; - if (key == K_TAB && f.focusdirty()) + if (key == K_TAB && f.active()) { - TMask& m = f.mask(); - app().add_cgs_tot(m); + const char cf = app().clifo(); + TLocalisamfile& clifo = ((TEdit_field&)f).browse()->cursor()->file(); + if (clifo.get_char(CLI_TIPOCF) != cf) + { + clifo.put(CLI_TIPOCF, cf); + clifo.read(); + } - TLocalisamfile& clifo = ((TEdit_field&)f).browse()->cursor()->file(); const int alleg = clifo.get_int(CLI_ALLEG); + TMask& m = f.mask(); TEdit_field& upi = m.efield(F_RIEPILOGO); upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL); + + const bool occas = clifo.get_bool(CLI_OCCAS); + m.show(F_OCCASEDIT, occas); // Dati anagrfici + m.show(-7, !occas); // Partita IVA e stato partita IVA - if (clifo.get_bool(CLI_OCCAS)) - m.send_key(K_SPACE, F_OCCASEDIT); // Lancia maschera occasionali - - if (m.field(F_VISVAL).active()) - { - const TString16 valuta(clifo.get("CODVAL")); - if (valuta.not_empty() && valuta != m.get(F_VALUTA)) - { - TTable val("%val"); - val.put("CODTAB", valuta); - if (val.read() == NOERR) + if (f.focusdirty()) + { + app().add_cgs_tot(m); + + if (m.field(F_VISVAL).active()) + { + const TString16 valuta(clifo.get("CODVAL")); + if (valuta.not_empty() && valuta != m.get(F_VALUTA)) { - m.set(F_VALUTA, valuta); - m.set(F_CAMBIO, val.get("R0"), TRUE); - } - } - } + TTable val("%val"); + val.put("CODTAB", valuta); + if (val.read() == NOERR) + { + m.set(F_VALUTA, valuta); + m.set(F_CAMBIO, val.get("R0"), TRUE); + } + } + } + if (occas) + m.send_key(K_SPACE, F_OCCASEDIT); // Lancia maschera occasionali + } } return TRUE; } diff --git a/cg/cg2102.h b/cg/cg2102.h index dff7a87d9..feac3d214 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -40,8 +40,10 @@ class TPrimanota_application : public TRelation_application TLibro_giornale* _giornale; // Libro giornale corrente TipoIVA _iva; // Tipo di IVA corrente bool _ges_val, _ges_sal; // Gestione valuta e saldaconto + bool _num_cli, _num_for; // Riferimento partita allineato a destra bool _savenew; // Registra e nuovo short _firstfocus; // First field to gain focus + bool _iva_showed; // Lo sheet IVA e' gia' stato visualizzato una volta? TSaldo_agg _saldi; // Saldi da aggiornare @@ -89,6 +91,8 @@ class TPrimanota_application : public TRelation_application static bool cg_notify(int r, KEY key); static bool cg_handler(TMask_field& f, KEY key); static bool pag_notify(int r, KEY key); + + void reset_sheet_row(TSheet_field& s, int n); protected: virtual bool user_create(); @@ -165,12 +169,14 @@ protected: real calcola_imp() const; int set_cgs_row(int n, const TImporto& importo, TBill& conto, const char* desc, char tipo); - void reset_cgs_row(int n); void disable_cgs_cells(int n, char tipo); void add_cgs_tot(TMask& m); void add_cgs_rit(bool fisc); void generazione_righe_cg(int r); + void reset_cgs_row(int n) { reset_sheet_row(cgs(), n); } + void reset_ivas_row(int n) { reset_sheet_row(ivas(), n); } + void* get_app_data() { return _app_data; } void set_app_data(void* v) { _app_data = v; } diff --git a/cg/cg2103.cpp b/cg/cg2103.cpp index 2585b3bc3..5a8b3c286 100755 --- a/cg/cg2103.cpp +++ b/cg/cg2103.cpp @@ -150,6 +150,7 @@ bool TRegistro::read_att() chiave << attivita() << "1"; TTable pla("PLA"); + attiv.setkey(1); pla.put("CODTAB", chiave); if (pla.read() == NOERR) { diff --git a/cg/cg3.cpp b/cg/cg3.cpp index 445f7c893..2a54d226f 100755 --- a/cg/cg3.cpp +++ b/cg/cg3.cpp @@ -1,6 +1,7 @@ #include #include +#define __MAIN__ #include "cg3.h" #define usage "Error - usage : %s -{0|1|2|3|4|5}" diff --git a/cg/cg3.h b/cg/cg3.h index 83322e80b..db23edc9d 100755 --- a/cg/cg3.h +++ b/cg/cg3.h @@ -1,11 +1,17 @@ #ifndef __CG3_H #define __CG3_H -#ifdef MAIN +#ifndef __STRINGS_H +#include +#endif + +#ifdef __MAIN__ #define extern #endif -#ifdef MAIN +extern TString256 TMP; + +#ifdef __MAIN__ #undef extern #endif diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index 6dc242b2e..65696c8eb 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -6,8 +6,6 @@ #include #include #include -#include -#include #include #include @@ -25,8 +23,6 @@ #include "cglib03.h" #include "cg2103.h" -static TString256 TMP; - enum liste { movimenti=1, fatture=2, diff --git a/cg/cg3100a.uml b/cg/cg3100a.uml index c6803f513..f13e4028e 100755 --- a/cg/cg3100a.uml +++ b/cg/cg3100a.uml @@ -1,249 +1,232 @@ -#include "cg3100.h" - -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 -END - -STRING F_RAGSOC 50 -BEGIN - PROMPT 2 2 "Ragione sociale " - FLAGS "D" -END - -DATE F_DATASTAMPA -BEGIN - PROMPT 48 1 "Data stampa " - HELP "Data in cui viene effettuata la stampa" - FLAGS "A" -END - -NUMBER F_ANNO 4 -BEGIN - GROUP 3 - PROMPT 2 3 "Anno esercizio " - HELP "Anno d'esercizio di cui si vuole la lista" - 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,F_REGISTROFIN|SHOW,F_REGISTROINI|SHOW,F_STAMPA|HIDE,1@|RESET,1@ - ITEM "1|Lista movimenti di sola prima nota" - MESSAGE HIDE,F_CONTROLLO|RESET,F_CONTROLLO|HIDE,1@|RESET,1@|HIDE,F_REGISTROFIN|RESET,F_REGISTROFIN|HIDE,F_REGISTROINI|RESET,F_REGISTROINI|HIDE,F_STAMPA|RESET,F_STAMPA -END - - -LIST F_CONTROLLO 21 -BEGIN - PROMPT 2 7 "Controllo movimenti errati " - HELP "Indicare il tipo di controllo per movimenti errati" - ITEM "3|No" MESSAGE HIDE,1@|RESET,1@ - ITEM "2|Si" MESSAGE SHOW,1@ - ITEM "1|Stampa movimenti errati" MESSAGE SHOW,1@ -END - -TEXT DLG_NULL -BEGIN - GROUP 1 - PROMPT 2 8 "Stampa messaggi : " -END - -BOOLEAN F_ANNOC -BEGIN - GROUP 1 - PROMPT 20 8 "Anno di competenza " - HELP "Indicare se stampa l'anno di competenza" -END - -BOOLEAN F_ALLEGATO -BEGIN - GROUP 1 - PROMPT 20 9 "Allegato iva " - HELP "Indicare se stampare l'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 " - HELP "Indicare il criterio di scelta dei movimenti" - 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 -<<<<<<< cg3100a.uml - PROMPT 19 11 "Stampa mov. dalla data " - HELP "Data da cui iniziare la stampa" -======= - PROMPT 16 11 "Stampa mov. dalla data " - //HELP "Se non indicato nessun valore viene effettuata una stampa completa in ordine di data" ->>>>>>> 1.12 - GROUP 3 -END - -DATE F_DATAFIN -BEGIN -<<<<<<< cg3100a.uml - PROMPT 55 11 "alla data " - HELP "Data fino a cui stampare i movimenti" -======= - PROMPT 52 11 "alla data " ->>>>>>> 1.12 - GROUP 3 -END - -NUMBER F_NUMEROINI 7 -BEGIN -<<<<<<< cg3100a.uml - PROMPT 19 12 "Stampa mov. dal numero " - HELP "Numero del movimento da cui iniziare la stampa" -======= - PROMPT 16 12 "Stampa mov. dal numero " ->>>>>>> 1.12 - 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 -<<<<<<< cg3100a.uml - PROMPT 55 12 "al numero " - HELP "Numero del movimenti fino cui fare la stampa" -======= - PROMPT 52 12 "al numero " ->>>>>>> 1.12 - COPY USE F_NUMEROINI - INPUT NUMREG F_NUMEROFIN - COPY DISPLAY F_NUMEROINI - OUTPUT F_NUMEROFIN NUMREG - CHECKTYPE NORMAL - FLAGS "R" - NUM_EXPR {(#F_NUMEROFIN==0)||(#F_NUMEROFIN>=#F_NUMEROINI)} - WARNING "Limite superiore errato" - 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 "U" - HELP "Causale di inizio stampa: vuoto = inizio archivio" - VALIDATE ZEROFILL_FUNC 3 -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 "U" - HELP "Causale di fine stampa: vuoto = fine archivio" - VALIDATE ZEROFILL_FUNC 3 -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[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 "U" - //CHECKTYPE NORMAL - HELP "Codice registro iva di inizio stampa: vuoto = inizio archivio" - VALIDATE ZEROFILL_FUNC 3 -END - -STRING F_REGISTROFIN 3 -BEGIN - PROMPT 40 15 "al reg. iva " - COPY USE F_REGISTROINI - //INPUT CODTAB[1,5] F_ANNO SELECT - 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 "U" - //CHECKTYPE NORMAL - HELP "Codice registro iva di fine stampa: vuoto = fine archivio" - VALIDATE ZEROFILL_FUNC 3 -END - -BOOLEAN F_STAMPA -BEGIN - PROMPT 2 16 "Stampa imponibili, imposte e codici iva " - HELP "Indicare se stampare i valori degli imponibili, dell'imposte e i codici IVA" -END - -BOOLEAN F_STAMPAMOVP -BEGIN - PROMPT 2 17 "Stampa movimenti provvisori " - HELP "Indicare se stampare i movimenti provvisori" -END - -/* -TEXT DLG_NULL -BEGIN - PROMPT 2 17 "N.B. se non indicato nessun valore stampa completa in ordine di data" -END -*/ - -BUTTON DLG_PRINT 9 2 -BEGIN - PROMPT -12 -1 "~Stampa" - MESSAGE EXIT,K_ENTER -END - -BUTTON DLG_QUIT 9 2 -BEGIN - PROMPT -22 -1 "" -END - -ENDPAGE - -ENDMASK +#include "cg3100.h" + +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 +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 2 2 "Ragione sociale " + FLAGS "D" +END + +DATE F_DATASTAMPA +BEGIN + PROMPT 48 1 "Data stampa " + HELP "Data in cui viene effettuata la stampa" + FLAGS "A" +END + +NUMBER F_ANNO 4 +BEGIN + GROUP 3 + PROMPT 2 3 "Anno esercizio " + HELP "Anno d'esercizio di cui si vuole la lista" + 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,F_REGISTROFIN|SHOW,F_REGISTROINI|SHOW,F_STAMPA|HIDE,1@|RESET,1@ + ITEM "1|Lista movimenti di sola prima nota" + MESSAGE HIDE,F_CONTROLLO|RESET,F_CONTROLLO|HIDE,1@|RESET,1@|HIDE,F_REGISTROFIN|RESET,F_REGISTROFIN|HIDE,F_REGISTROINI|RESET,F_REGISTROINI|HIDE,F_STAMPA|RESET,F_STAMPA +END + + +LIST F_CONTROLLO 21 +BEGIN + PROMPT 2 7 "Controllo movimenti errati " + HELP "Indicare il tipo di controllo per movimenti errati" + ITEM "3|No" MESSAGE HIDE,1@|RESET,1@ + ITEM "2|Si" MESSAGE SHOW,1@ + ITEM "1|Stampa movimenti errati" MESSAGE SHOW,1@ +END + +TEXT DLG_NULL +BEGIN + GROUP 1 + PROMPT 2 8 "Stampa messaggi : " +END + +BOOLEAN F_ANNOC +BEGIN + GROUP 1 + PROMPT 20 8 "Anno di competenza " + HELP "Indicare se stampa l'anno di competenza" +END + +BOOLEAN F_ALLEGATO +BEGIN + GROUP 1 + PROMPT 20 9 "Allegato iva " + HELP "Indicare se stampare l'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 " + HELP "Indicare il criterio di scelta dei movimenti" + 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 + HELP "Data da cui iniziare la stampa" + PROMPT 16 11 "Stampa mov. dalla data " + GROUP 3 +END + +DATE F_DATAFIN +BEGIN + HELP "Data fino a cui stampare i movimenti" + PROMPT 52 11 "alla data " + GROUP 3 +END + +NUMBER F_NUMEROINI 7 +BEGIN + HELP "Numero del movimento da cui iniziare la stampa" + PROMPT 16 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 + HELP "Numero del movimenti fino cui fare la stampa" + PROMPT 52 12 "al numero " + COPY USE F_NUMEROINI + INPUT NUMREG F_NUMEROFIN + COPY DISPLAY F_NUMEROINI + OUTPUT F_NUMEROFIN NUMREG + CHECKTYPE NORMAL + FLAGS "R" + NUM_EXPR {(#F_NUMEROFIN==0)||(#F_NUMEROFIN>=#F_NUMEROINI)} + WARNING "Limite superiore errato" + 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 "U" + HELP "Causale di inizio stampa: vuoto = inizio archivio" + VALIDATE ZEROFILL_FUNC 3 +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 "U" + HELP "Causale di fine stampa: vuoto = fine archivio" + VALIDATE ZEROFILL_FUNC 3 +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[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 "U" + //CHECKTYPE NORMAL + HELP "Codice registro iva di inizio stampa: vuoto = inizio archivio" + VALIDATE ZEROFILL_FUNC 3 +END + +STRING F_REGISTROFIN 3 +BEGIN + PROMPT 40 15 "al reg. iva " + COPY USE F_REGISTROINI + //INPUT CODTAB[1,5] F_ANNO SELECT + 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 "U" + //CHECKTYPE NORMAL + HELP "Codice registro iva di fine stampa: vuoto = fine archivio" + VALIDATE ZEROFILL_FUNC 3 +END + +BOOLEAN F_STAMPA +BEGIN + PROMPT 2 16 "Stampa imponibili, imposte e codici iva " + HELP "Indicare se stampare i valori degli imponibili, dell'imposte e i codici IVA" +END + +BOOLEAN F_STAMPAMOVP +BEGIN + PROMPT 2 17 "Stampa movimenti provvisori " + HELP "Indicare se stampare i movimenti provvisori" +END + +/* +TEXT DLG_NULL +BEGIN + PROMPT 2 17 "N.B. se non indicato nessun valore stampa completa in ordine di data" +END +*/ + +BUTTON DLG_PRINT 9 2 +BEGIN + PROMPT -12 -1 "~Stampa" + MESSAGE EXIT,K_ENTER +END + +BUTTON DLG_QUIT 9 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE + +ENDMASK diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index 74bc2abf8..dcddddda6 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -1,8 +1,10 @@ +#include +#include #include #include +#include #include #include -#include #include #include @@ -13,16 +15,12 @@ #include #include #include -#include -#include #include "cg3.h" #include "cg3200.h" #include "cglib.h" #include "cglib03.h" -static TString256 tmp; - int date2esc(const TDate& d, int* prevesc = NULL); bool sottoc_handler_ini (TMask_field& f, KEY k); bool sottoc_handler_fine (TMask_field& f, KEY k); @@ -1916,10 +1914,10 @@ const char* TMastrini_application::descrizione_classe(char sezione, char lettera tabivd.read(); dep2 = tabivd.get("CODTAB"); if (dep == dep2) - tmp = tabivd.get("S0"); + TMP = tabivd.get("S0"); else - tmp = ""; - return (tmp); + TMP = ""; + return TMP; } //Ricerca la descrizione relativa al gruppo da stampare @@ -1931,8 +1929,8 @@ const char* TMastrini_application::descrizione_gruppo() pconti.zero(); pconti.put(PCN_GRUPPO,_gruppo); if (pconti.read() != NOERR) pconti.zero(); - tmp = pconti.get(PCN_DESCR); - return tmp; + TMP = pconti.get(PCN_DESCR); + return TMP; } // Ricerca la descrizione relativa al conto da stampare @@ -1945,8 +1943,8 @@ const char* TMastrini_application::descrizione_conto() pconti.put(PCN_GRUPPO,_gruppo); pconti.put(PCN_CONTO,_conto); if (pconti.read() != NOERR) pconti.zero(); - tmp = pconti.get(PCN_DESCR); - return tmp; + TMP = pconti.get(PCN_DESCR); + return TMP; } bool TMastrini_application::user_create() diff --git a/cg/cg3300.cpp b/cg/cg3300.cpp index 8543ef35a..318f13418 100755 --- a/cg/cg3300.cpp +++ b/cg/cg3300.cpp @@ -5,15 +5,11 @@ #include #include #include -#include +#include #include #include -#include -#include -#include -#include -#include #include +#include #include #include @@ -36,10 +32,6 @@ #define DISTANZA_HEADER_CORPO 5 #define LUNGHEZZA_RECORD 128 -#define MAXSTR 128 -static char __tmp[MAXSTR]; -static TFixed_string tmp(__tmp, MAXSTR); - const int CODTABLEN = 15; HIDDEN const char * SEGNO_MENO = "-"; @@ -203,9 +195,9 @@ const char * CG3300_application::decodifica_desc_att (TString & codatt) if (attivita.bad()) attivita.zero(); - tmp = attivita.get ("S0"); + TMP = attivita.get ("S0"); - return __tmp; + return TMP; } bool CG3300_application::corrispettivo (const char * tipodoc) diff --git a/cg/cg3400.cpp b/cg/cg3400.cpp index 9002387c1..4a1601ee2 100755 --- a/cg/cg3400.cpp +++ b/cg/cg3400.cpp @@ -1,13 +1,12 @@ // cg3400 - Stampa libro giornale -#include +#include #include -#include +#include +#include #include #include -#include -#include -#include +#include #include #include @@ -22,6 +21,7 @@ #include #include +#include "cg3.h" #include "conto.h" #include "cglib03.h" #include "cg2103.h" @@ -44,8 +44,6 @@ HIDDEN const int AVERE132 = 112; HIDDEN const int DARE198 = 150; HIDDEN const int AVERE198 = 174; -HIDDEN TString256 tmp; - HIDDEN int date2esc(const TDate& d, int* prevesc = NULL); HIDDEN enum descr { causale, conto, operazione }; @@ -241,23 +239,25 @@ TRectype& CG3400_application::look_com (const char * cod) return _com->curr(); } -const char* CG3400_application::SimboloValuta (const char* cod) -{ - TString16 codtab; +/* + const char* CG3400_application::SimboloValuta (const char* cod) + { + TString16 codtab; - codtab.format ("%-3s", cod); + codtab.format ("%-3s", cod); - _tabval->zero(); - _tabval->put("CODTAB", codtab); - _tabval->read(); + _tabval->zero(); + _tabval->put("CODTAB", codtab); + _tabval->read(); - if (_tabval->good()) - tmp = _tabval->get("S7"); - else - tmp = ""; + if (_tabval->good()) + TMP = _tabval->get("S7"); + else + TMP = ""; - return tmp; -} + return TMP; + } + */ const char * CG3400_application::get_descr_caus (const char * codcaus) { @@ -267,8 +267,8 @@ const char * CG3400_application::get_descr_caus (const char * codcaus) caus.put (CAU_CODCAUS, codcaus); if (caus.read() != NOERR) caus.zero(); - tmp = caus.get(CAU_DESCR); - return tmp; + TMP = caus.get(CAU_DESCR); + return TMP; } void CG3400_application::get_dati_ditta () diff --git a/cg/cg3500.cpp b/cg/cg3500.cpp index 378cb3afb..7f4ebc485 100755 --- a/cg/cg3500.cpp +++ b/cg/cg3500.cpp @@ -1,17 +1,16 @@ //Stampa riepilogo gruppi/conti +#include +#include +#include #include #include -#include -#include #include -#include -#include + #include #include #include #include - #include #include #include diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index a15453ed4..a33781a40 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -822,7 +822,7 @@ void CG4400_application::calcola_progressivi() int CG4400_application::riga_rmoviva() { - TString codiva; + TString16 codiva; real impo, impos; int tipodet, tipocr, tipoatt; bool intra; @@ -2325,9 +2325,7 @@ bool CG4400_application::set_print(int n) else { _tipo_riepilogativo = ' '; - TDate primo = format("01/%02d/%4d", _fino_a_mese+1, _annoes); - --primo; - giorni_del_mese = primo.day(); + giorni_del_mese = TDate::last_day(_fino_a_mese, _annoes); } _data_a=format("%02d/%02d/%4d",giorni_del_mese,_fino_a_mese,_annoes); } diff --git a/cg/cg5100a.uml b/cg/cg5100a.uml index bf927c85f..a9af939c7 100755 --- a/cg/cg5100a.uml +++ b/cg/cg5100a.uml @@ -43,22 +43,12 @@ BEGIN FIELD PcTcCm END -GROUPBOX DLG_NULL 53 4 +GROUPBOX DLG_NULL 76 4 BEGIN PROMPT 2 3 "Archivi in comune" END -RADIOBUTTON LST_RIFPAR 20 -BEGIN - PROMPT 55 3 "Riferimenti partite " - HELP "Indicaer il criterio dei riferimenti delle partite" - ITEM " |N. protocollo" - ITEM "X|N. documento" - HELP "" - FIELD RifPar -END - GROUPBOX DLG_NULL 76 12 BEGIN PROMPT 2 6 "" diff --git a/cg/cg5200a.uml b/cg/cg5200a.uml index 84c28d33a..c7a073b34 100755 --- a/cg/cg5200a.uml +++ b/cg/cg5200a.uml @@ -53,6 +53,7 @@ BEGIN DISPLAY "Gruppo" GRUPPO DISPLAY "Descrizione@50" DESCR OUTPUT F_GRUPPO GRUPPO + OUTPUT F_DESCR_CONTO DESCR CHECKTYPE NORMAL VALIDATE CHECK_FIELD F_GRUPPO FLAGS "R" diff --git a/cg/cg5300a.uml b/cg/cg5300a.uml index 56b0363de..4d131167c 100755 --- a/cg/cg5300a.uml +++ b/cg/cg5300a.uml @@ -53,7 +53,7 @@ BEGIN PROMPT 4 4 "Parametri ditta" END -LIST F_FREQ_VERS 14 +LIST F_FREQ_VERS 1 14 BEGIN PROMPT 6 5 "Frequenza versamenti " HELP "Indicare la frequenza dei versamenti delle liquidazioni IVA" diff --git a/cg/cg5400.cpp b/cg/cg5400.cpp index 451bbb8fd..07662469c 100755 --- a/cg/cg5400.cpp +++ b/cg/cg5400.cpp @@ -21,8 +21,8 @@ class TRipristina_stampa : public TApplication virtual bool create() ; virtual bool destroy() ; bool menu(MENU_TAG); - bool do_restore(long firm, const char * reg, const char * year, int month, - bool giornale); + bool do_restore(long firm, const char * reg, int year, int month, + int day, bool giornale); static bool firm_handler(TMask_field& f, KEY key); public: @@ -50,7 +50,7 @@ bool TRipristina_stampa::firm_handler(TMask_field& f, KEY key) } bool TRipristina_stampa::do_restore(long firm, const char * regist, - const char * year, int month, + int year, int month, int day, bool giornale) { bool ok = TRUE; @@ -65,14 +65,13 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist, TTable reg("REG"); TString16 s; - s.format("%-4s%s", year, regist); + s.format("%04d%s", year, regist); reg.zero(); reg.put("CODTAB", s); if (reg.read(_isequal, _lock) == NOERR) { TDate dlast(reg.get_date("D3")); - int wyear = atoi(year); if (giornale) { @@ -87,11 +86,11 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist, TDate wd(esc.get_date("D0")); - wyear = wd.year(); + year = wd.year(); if (wd.month() > month) - wyear++; + year++; } - TDate d(1, month, wyear); + TDate d(day, month, year); TRectype from(mov.curr()); from.zero(); TRectype to(from); @@ -164,23 +163,23 @@ bool TRipristina_stampa::menu(MENU_TAG) while (_msk->run() == K_ENTER) { const long firm = _msk->get_long(F_FIRM); - const TString16 reg = _msk->get(F_REG); + const TString16 reg = _msk->get(F_REG); const bool giornale = _msk->get_int(F_TIPO) == 5; - const TString16 year = _msk->get(giornale ? F_ESER : F_YEAR); - int month = _msk->get_int(F_MESE); + const int year = _msk->get_int(giornale ? F_ESER : F_YEAR); + const int month = _msk->get_int(F_MESE); + const int day = giornale ? _msk->get_int(F_DAY) : 1; if (prefhndl->exist(firm)) { - TString mess; - - mess.format("Attenzione sara' ripristinata la stampa\n del registro %s %s %s della ditta %ld dal mese di %s. Devo continuare", - (const char *) reg, giornale ? "esercizio" : "anno", - (const char *) year, (const char *) firm, itom(month)); + TString256 mess("Attenzione sara' ripristinata la stampa\n del registro "); + mess << reg << " dell'" << (giornale ? "esercizio " : "anno ") << year + << " della ditta " << firm << "dal " << day << '-' << month << '-' << year; + if (yesno_box((const char *) mess)) { - mess.rtrim(16); mess << " Devo veramente continuare"; + mess << "\nSi desidera veramente continuare"; if (yesno_box((const char *) mess)) - do_restore(firm, reg, year, month, giornale); + do_restore(firm, reg, year, month, day, giornale); } } else error_box("Gli archivi della ditta %d non sono stati ancora generati",firm); diff --git a/cg/cg5400.h b/cg/cg5400.h index 7941c000e..51632b84b 100755 --- a/cg/cg5400.h +++ b/cg/cg5400.h @@ -6,4 +6,4 @@ #define F_YEAR 106 #define F_ESER 107 #define F_MESE 108 - +#define F_DAY 109 diff --git a/cg/cg5400a.uml b/cg/cg5400a.uml index cddd37e54..0d046d807 100755 --- a/cg/cg5400a.uml +++ b/cg/cg5400a.uml @@ -1,6 +1,6 @@ #include "cg5400.h" -PAGE "Ripristino stampa giornale" -1 -1 78 11 +PAGE "Ripristino stampa registri" -1 -1 78 11 NUMBER F_FIRM 5 BEGIN @@ -44,7 +44,7 @@ BEGIN OUTPUT F_YEAR CODTAB[1,4] OUTPUT F_REG CODTAB[5,7] OUTPUT F_DREG S0 - OUTPUT F_TIPO I0 + OUTPUT F_TIPO I0 CHECKTYPE REQUIRED HELP "Codice del registro di cui ripristinare la stampa" WARNING "Registro assente" @@ -68,10 +68,10 @@ END LIST F_TIPO BEGIN FLAGS "HG" - ITEM "1|Vendite" MESSAGE HIDE,F_ESER|SHOW,F_YEAR - ITEM "2|Vendite" MESSAGE HIDE,F_ESER|SHOW,F_YEAR - ITEM "3|Riepilogativo" MESSAGE HIDE,F_ESER|SHOW,F_YEAR - ITEM "5|Giornale" MESSAGE SHOW,F_ESER|HIDE,F_YEAR + ITEM "1|Vendite" MESSAGE HIDE,F_ESER|SHOW,F_YEAR|HIDE,F_DAY + ITEM "2|Vendite" MESSAGE HIDE,F_ESER|SHOW,F_YEAR|HIDE,F_DAY + ITEM "3|Riepilogativo" MESSAGE HIDE,F_ESER|SHOW,F_YEAR|HIDE,F_DAY + ITEM "5|Giornale" MESSAGE SHOW,F_ESER|HIDE,F_YEAR|SHOW,F_DAY END NUMBER F_YEAR 4 @@ -97,12 +97,18 @@ BEGIN WARNING "Esercizio assente" END + +NUMBER F_DAY 2 +BEGIN + PROMPT 4 6 "Giorno " + HELP "Giorno da cui ripristinare la stampa del giornale" +END + LIST F_MESE 10 BEGIN PROMPT 4 7 "Mese " FLAGS "M" - HELP "Mese di ripristino" - HELP "Mese da cui ripristinare la stampa" + HELP "Mese da cui ripristinare la stampa del registro" END BUTTON DLG_OK 9 2 diff --git a/cg/cglib01.cpp b/cg/cglib01.cpp index 8c0d75201..64f34002e 100755 --- a/cg/cglib01.cpp +++ b/cg/cglib01.cpp @@ -15,8 +15,6 @@ #include "cglib.h" -HIDDEN TString256 tmp; - // aep e' l'esercizio precedente TSaldi_list::TSaldi_list(int gr, int co, int aec, int aep) { @@ -196,17 +194,13 @@ real TSaldo::calcola_saldo_iniziale(int g,int c,long s,int indbil) const char* TSaldo::causale_chiusura_es() { TConfig conf(CONFIG_DITTA); - tmp = conf.get("CoCaCh"); - - return tmp; + return conf.get("CoCaCh"); } const char* TSaldo::causale_apertura_es() { TConfig conf(CONFIG_DITTA); - tmp = conf.get("CoCaAp"); - - return tmp; + return conf.get("CoCaAp"); } void TSaldo::leggi_mov(long nr) diff --git a/cg/conto.cpp b/cg/conto.cpp index 7ca87bb91..fabc449d9 100755 --- a/cg/conto.cpp +++ b/cg/conto.cpp @@ -106,44 +106,46 @@ int TBill::compare(const TSortable& s) const // Certified 95% -void TBill::describe() -{ - int err = NOERR; - +bool TBill::find() +{ + bool ok = FALSE; + if ((_tipo != 'C' && _tipo != 'F') || _sottoconto == 0L) { TRectype pcon(LF_PCON); - read(pcon); - } - if ((_tipo == 'C' || _tipo == 'F') && _sottoconto != 0L) - { - TLocalisamfile clifo(LF_CLIFO, FALSE); - clifo.setkey(1); - clifo.zero(); - clifo.put("TIPOCF", _tipo); - clifo.put("CODCF", _sottoconto); - err = clifo.read(); - if (err == NOERR) + ok = read(pcon); + } + else + if ((_tipo == 'C' || _tipo == 'F') && _sottoconto != 0L) { - _descrizione = clifo.get("RAGSOC"); - if (_tipo_cr < 0) _tipo_cr = 0; - _sospeso = clifo.get_bool("SOSPESO"); - - const char tipoa = clifo.get_char("TIPOAPER"); - if (tipoa == 'F') - { - TString80 nome = _descrizione.mid(30); - _descrizione.cut(30); - _descrizione.trim(); nome.trim(); - _descrizione << ' ' << nome; - } - if (_gruppo == 0 || _conto == 0) - { - _gruppo = clifo.get_int("GRUPPO"); - _conto = clifo.get_int("CONTO"); - } - } - } + TLocalisamfile clifo(LF_CLIFO, FALSE); + clifo.setkey(1); + clifo.put("TIPOCF", _tipo); + clifo.put("CODCF", _sottoconto); + ok = clifo.read() == NOERR; + if (ok) + { + _descrizione = clifo.get("RAGSOC"); + if (_tipo_cr < 0) _tipo_cr = 0; + _sospeso = clifo.get_bool("SOSPESO"); + + const char tipoa = clifo.get_char("TIPOAPER"); + if (tipoa == 'F') + { + TString80 nome = _descrizione.mid(30); + _descrizione.cut(30); + _descrizione.trim(); nome.trim(); + _descrizione << ' ' << nome; + } + if (_gruppo == 0 || _conto == 0) + { + _gruppo = clifo.get_int("GRUPPO"); + _conto = clifo.get_int("CONTO"); + } + } + } + + return ok; } @@ -180,8 +182,8 @@ int TBill::tipo_att() if (ib == ib_passivita || ib == ib_ricavi) { read(rec); - const int ricser = rec.get_int("RICSER"); - tipo_att = (ricser == 0) ? 2 : 1; + const int ricser = rec.get_int("RICSER"); // 0 = Altre attivita 1 = Servizi + tipo_att = (ricser == 1) ? 1 : 2; } } return tipo_att; @@ -192,8 +194,7 @@ const TString& TBill::descrizione() { if (_descrizione.empty()) { - describe(); - if (_descrizione.empty()) + if (!find()) _descrizione = "Sconosciuto"; } return _descrizione; @@ -202,7 +203,7 @@ const TString& TBill::descrizione() int TBill::tipo_cr() { if (_tipo_cr < 0) - describe(); + find(); return _tipo_cr; } diff --git a/cg/conto.h b/cg/conto.h index 5160550ab..d955a5ed0 100755 --- a/cg/conto.h +++ b/cg/conto.h @@ -21,7 +21,6 @@ class TBill : public TSortable protected: virtual int compare(const TSortable& s) const; virtual const char* class_name() const { return "Conto"; } - void describe(); const TBill& copy(const TBill& b); @@ -46,6 +45,7 @@ public: int conto() const { return _conto; } long sottoconto() const { return _sottoconto; } + bool find(); const TString& descrizione(); int tipo_cr(); void tipo_cr(int tcr) { _tipo_cr = tcr; }