From 23b904191b7deb3bdcd78dedf8e787c1333ab3ab Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 9 Jan 1995 16:50:37 +0000 Subject: [PATCH] Sistemata stampa deleghe git-svn-id: svn://10.65.10.50/trunk@838 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/Attic/cg1400.cpp | 72 +++++++++++++++++--------------------------- cg/Attic/cg1400a.uml | 2 ++ cg/cg1400.cpp | 72 +++++++++++++++++--------------------------- cg/cg1400a.uml | 2 ++ 4 files changed, 60 insertions(+), 88 deletions(-) diff --git a/cg/Attic/cg1400.cpp b/cg/Attic/cg1400.cpp index 2bf5dfce5..a8ed62620 100755 --- a/cg/Attic/cg1400.cpp +++ b/cg/Attic/cg1400.cpp @@ -19,11 +19,9 @@ class TStampa_deleghe_IVA : public TApplication TArray_sheet* _ditte; int _mese, _anno, _tipo; - TString16 _azienda, _dipendenza; + TString16 _azienda, _dipendenza, _concessione; TFilename _profilo; - bool _stampa_distinte, _aggiorna_codici, _definitiva; - - bool test_comrf(TLocalisamfile& anag, TLocalisamfile& com); + bool _stampa_distinte, _aggiorna_codici, _definitiva, _contofis; protected: virtual bool create(); @@ -46,12 +44,12 @@ bool TStampa_deleghe_IVA::create() _nditte = new TRelation(LF_NDITTE); _nditte->add(LF_ANAG, "TIPOA=TIPOA|CODANAGR=CODANAGR"); - _nditte->add(LF_COMUNI, "COM=COMRF", 1, LF_ANAG); + _nditte->add(LF_COMUNI, "COM=COMRF(COMRES)", 1, LF_ANAG); _banche = new TTable("%BAN"); _ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Deleghe da stampare", - "@1|Cod.@5|Ragione Sociale@50|Importo@15|ABI@5|CAB@5|Concessione"); + "@1|Cod.@5|Ragione Sociale@30|Importo@15|Interessi@15|ABI@5|CAB@5|Concessione|Tit. Conto Fis."); TConfig c(CONFIG_STUDIO, "cg"); _azienda = c.get("CodABI"); @@ -96,26 +94,13 @@ HIDDEN bool profile_handler(TMask_field& f, KEY k) return TRUE; } -// Posiziona correttamente il comune di residenza fiscale se non specificato -// in anagrafica in quanto uguale a quello di residenza -bool TStampa_deleghe_IVA::test_comrf(TLocalisamfile& anag, TLocalisamfile& com) -{ - if (anag.get("COMRF").empty()) - { - com.zero("STATO"); - com.put("COM", anag.get("COMRES")); - if (com.read() != NOERR) - com.zero(); - } - return com.good(); -} - int TStampa_deleghe_IVA::select() { TMask m("cg1400a"); m.set_handler(F_ABI, abi_handler); m.set_handler(F_PROFILO, profile_handler); + m.set(F_CONCESSIONE, _concessione); m.set(F_ABI, _azienda); m.set(F_CAB, _dipendenza); if (m.run() != K_ENTER) @@ -130,17 +115,15 @@ int TStampa_deleghe_IVA::select() _definitiva = m.get_bool(F_DEFINITIVA); _stampa_distinte = m.get_bool(F_DISTINTA); _aggiorna_codici = m.get_bool(F_AGGIORNA); + _contofis = m.get_bool(F_CONTOFIS); _profilo = "del"; - if (m.get_bool(F_CONTOFIS)) - _profilo = m.get(F_PROFILO); - else - _profilo << _azienda; + _profilo << m.get(F_PROFILO); const TDate pd(m.get(F_DATA)); printer().setdate(pd); - const int concessione = m.get_int(F_CONCESSIONE); + _concessione = m.get(F_CONCESSIONE); const long soloabi = m.get_long(F_SOLO_ABI); const long solocab = m.get_long(F_SOLO_CAB); @@ -154,10 +137,12 @@ int TStampa_deleghe_IVA::select() { TLocalisamfile& anag = _nditte->lfile(LF_ANAG); TLocalisamfile& com = _nditte->lfile(LF_COMUNI); // Comune residenza fiscale - test_comrf(anag, com); - const int con = com.get_int("UFFCONC"); - if (concessione != 0 && concessione != con) continue; + const TString16 con = com.get("UFFCONC"); + if (_concessione.not_empty() && _concessione != con) continue; + + const bool cf = anag.get_bool("TITCF"); + if (_contofis != cf) continue; const long dit = _nditte->lfile().get_long("CODDITTA"); chiave.format("%05ld%04d%02d%d", dit, _anno, _mese, _tipo); @@ -168,13 +153,15 @@ int TStampa_deleghe_IVA::select() const long cab = deleghe.get_long("S8"); if ((soloabi == 0 || soloabi == abi) && (solocab == 0 || solocab == cab)) { - d = " "; // Selezione - d.add(dit); // Codice ditta - d.add(_nditte->lfile().get("RAGSOC")); // Ragione sociale - d.add(deleghe.get_real("R0").string(".")); // Importo - d.add(abi ? format("%05ld", abi) : ""); // Azienda - d.add(cab ? format("%05ld", cab) : ""); // Dipendenza - d.add(con ? format("%03d", con) : ""); // Concessione + d = " "; // Selezione + d.add(dit); // Codice ditta + d.add(_nditte->lfile().get("RAGSOC").left(30)); // Cognome + d.add(deleghe.get_real("R0").string(".")); // Importo + d.add(deleghe.get_real("R1").string(".")); // Interesse + d.add(abi ? format("%05ld", abi) : ""); // Azienda + d.add(cab ? format("%05ld", cab) : ""); // Dipendenza + d.add(con); // Concessione + d.add(cf ? "X" : " "); // Conto fiscale _ditte->add(d); } } @@ -282,7 +269,6 @@ void TStampa_deleghe_IVA::print_distinta() const TString16 cod(riga.get(1)); _nditte->lfile().put("CODDITTA", cod); _nditte->read(); - test_comrf(_nditte->lfile(LF_ANAG), com); TParagraph_string dencom(com.get("DENCOM"), 18); @@ -323,14 +309,14 @@ bool TStampa_deleghe_IVA::print_deleghe() TCursor& cur = *f.cursor(); TLocalisamfile& delega = cur.file(); - TLocalisamfile& anag = cur.file(LF_ANAG); - TLocalisamfile& com = cur.file(-12); // Comune residenza fiscale TString16 chiave; for (int i = 0; ok && i < _ditte->items(); i++) if (_ditte->checked(i)) - { - const long d = _ditte->row(i).get_long(1); + { + TToken_string& r = _ditte->row(i); + + const long d = r.get_long(1); chiave.format("%05ld%04d%02d%d", d, _anno, _mese, _tipo); delega.put("CODTAB", chiave); @@ -340,14 +326,11 @@ bool TStampa_deleghe_IVA::print_deleghe() { delega.put("S7", _azienda); delega.put("S8", _dipendenza); + delega.put("S9", r.get(7)); delega.rewrite(); cur.repos(); // Riposiziona il cursore } - if (!test_comrf(anag, com)) - warning_box("Manca il comune di residenza fiscale di %s", - (const char*)anag.get("RAGSOC")); - ok = f.print(-1); // Stampa solo il record corrente if (!ok) break; @@ -362,6 +345,7 @@ bool TStampa_deleghe_IVA::print_deleghe() { delega.put("S7", ""); delega.put("S8", ""); + delega.put("S9", ""); scrivi = TRUE; } if (scrivi) diff --git a/cg/Attic/cg1400a.uml b/cg/Attic/cg1400a.uml index fd17dbddc..d1d4bfaf2 100755 --- a/cg/Attic/cg1400a.uml +++ b/cg/Attic/cg1400a.uml @@ -169,6 +169,8 @@ END BOOLEAN F_CONTOFIS BEGIN PROMPT 43 13 "Titolari Conto fiscale" + MESSAGE FALSE ENABLE,F_PROFILO + MESSAGE TRUE DISABLE,F_PROFILO|"TITCF",F_PROFILO END BUTTON DLG_SELECT 9 2 diff --git a/cg/cg1400.cpp b/cg/cg1400.cpp index 2bf5dfce5..a8ed62620 100755 --- a/cg/cg1400.cpp +++ b/cg/cg1400.cpp @@ -19,11 +19,9 @@ class TStampa_deleghe_IVA : public TApplication TArray_sheet* _ditte; int _mese, _anno, _tipo; - TString16 _azienda, _dipendenza; + TString16 _azienda, _dipendenza, _concessione; TFilename _profilo; - bool _stampa_distinte, _aggiorna_codici, _definitiva; - - bool test_comrf(TLocalisamfile& anag, TLocalisamfile& com); + bool _stampa_distinte, _aggiorna_codici, _definitiva, _contofis; protected: virtual bool create(); @@ -46,12 +44,12 @@ bool TStampa_deleghe_IVA::create() _nditte = new TRelation(LF_NDITTE); _nditte->add(LF_ANAG, "TIPOA=TIPOA|CODANAGR=CODANAGR"); - _nditte->add(LF_COMUNI, "COM=COMRF", 1, LF_ANAG); + _nditte->add(LF_COMUNI, "COM=COMRF(COMRES)", 1, LF_ANAG); _banche = new TTable("%BAN"); _ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Deleghe da stampare", - "@1|Cod.@5|Ragione Sociale@50|Importo@15|ABI@5|CAB@5|Concessione"); + "@1|Cod.@5|Ragione Sociale@30|Importo@15|Interessi@15|ABI@5|CAB@5|Concessione|Tit. Conto Fis."); TConfig c(CONFIG_STUDIO, "cg"); _azienda = c.get("CodABI"); @@ -96,26 +94,13 @@ HIDDEN bool profile_handler(TMask_field& f, KEY k) return TRUE; } -// Posiziona correttamente il comune di residenza fiscale se non specificato -// in anagrafica in quanto uguale a quello di residenza -bool TStampa_deleghe_IVA::test_comrf(TLocalisamfile& anag, TLocalisamfile& com) -{ - if (anag.get("COMRF").empty()) - { - com.zero("STATO"); - com.put("COM", anag.get("COMRES")); - if (com.read() != NOERR) - com.zero(); - } - return com.good(); -} - int TStampa_deleghe_IVA::select() { TMask m("cg1400a"); m.set_handler(F_ABI, abi_handler); m.set_handler(F_PROFILO, profile_handler); + m.set(F_CONCESSIONE, _concessione); m.set(F_ABI, _azienda); m.set(F_CAB, _dipendenza); if (m.run() != K_ENTER) @@ -130,17 +115,15 @@ int TStampa_deleghe_IVA::select() _definitiva = m.get_bool(F_DEFINITIVA); _stampa_distinte = m.get_bool(F_DISTINTA); _aggiorna_codici = m.get_bool(F_AGGIORNA); + _contofis = m.get_bool(F_CONTOFIS); _profilo = "del"; - if (m.get_bool(F_CONTOFIS)) - _profilo = m.get(F_PROFILO); - else - _profilo << _azienda; + _profilo << m.get(F_PROFILO); const TDate pd(m.get(F_DATA)); printer().setdate(pd); - const int concessione = m.get_int(F_CONCESSIONE); + _concessione = m.get(F_CONCESSIONE); const long soloabi = m.get_long(F_SOLO_ABI); const long solocab = m.get_long(F_SOLO_CAB); @@ -154,10 +137,12 @@ int TStampa_deleghe_IVA::select() { TLocalisamfile& anag = _nditte->lfile(LF_ANAG); TLocalisamfile& com = _nditte->lfile(LF_COMUNI); // Comune residenza fiscale - test_comrf(anag, com); - const int con = com.get_int("UFFCONC"); - if (concessione != 0 && concessione != con) continue; + const TString16 con = com.get("UFFCONC"); + if (_concessione.not_empty() && _concessione != con) continue; + + const bool cf = anag.get_bool("TITCF"); + if (_contofis != cf) continue; const long dit = _nditte->lfile().get_long("CODDITTA"); chiave.format("%05ld%04d%02d%d", dit, _anno, _mese, _tipo); @@ -168,13 +153,15 @@ int TStampa_deleghe_IVA::select() const long cab = deleghe.get_long("S8"); if ((soloabi == 0 || soloabi == abi) && (solocab == 0 || solocab == cab)) { - d = " "; // Selezione - d.add(dit); // Codice ditta - d.add(_nditte->lfile().get("RAGSOC")); // Ragione sociale - d.add(deleghe.get_real("R0").string(".")); // Importo - d.add(abi ? format("%05ld", abi) : ""); // Azienda - d.add(cab ? format("%05ld", cab) : ""); // Dipendenza - d.add(con ? format("%03d", con) : ""); // Concessione + d = " "; // Selezione + d.add(dit); // Codice ditta + d.add(_nditte->lfile().get("RAGSOC").left(30)); // Cognome + d.add(deleghe.get_real("R0").string(".")); // Importo + d.add(deleghe.get_real("R1").string(".")); // Interesse + d.add(abi ? format("%05ld", abi) : ""); // Azienda + d.add(cab ? format("%05ld", cab) : ""); // Dipendenza + d.add(con); // Concessione + d.add(cf ? "X" : " "); // Conto fiscale _ditte->add(d); } } @@ -282,7 +269,6 @@ void TStampa_deleghe_IVA::print_distinta() const TString16 cod(riga.get(1)); _nditte->lfile().put("CODDITTA", cod); _nditte->read(); - test_comrf(_nditte->lfile(LF_ANAG), com); TParagraph_string dencom(com.get("DENCOM"), 18); @@ -323,14 +309,14 @@ bool TStampa_deleghe_IVA::print_deleghe() TCursor& cur = *f.cursor(); TLocalisamfile& delega = cur.file(); - TLocalisamfile& anag = cur.file(LF_ANAG); - TLocalisamfile& com = cur.file(-12); // Comune residenza fiscale TString16 chiave; for (int i = 0; ok && i < _ditte->items(); i++) if (_ditte->checked(i)) - { - const long d = _ditte->row(i).get_long(1); + { + TToken_string& r = _ditte->row(i); + + const long d = r.get_long(1); chiave.format("%05ld%04d%02d%d", d, _anno, _mese, _tipo); delega.put("CODTAB", chiave); @@ -340,14 +326,11 @@ bool TStampa_deleghe_IVA::print_deleghe() { delega.put("S7", _azienda); delega.put("S8", _dipendenza); + delega.put("S9", r.get(7)); delega.rewrite(); cur.repos(); // Riposiziona il cursore } - if (!test_comrf(anag, com)) - warning_box("Manca il comune di residenza fiscale di %s", - (const char*)anag.get("RAGSOC")); - ok = f.print(-1); // Stampa solo il record corrente if (!ok) break; @@ -362,6 +345,7 @@ bool TStampa_deleghe_IVA::print_deleghe() { delega.put("S7", ""); delega.put("S8", ""); + delega.put("S9", ""); scrivi = TRUE; } if (scrivi) diff --git a/cg/cg1400a.uml b/cg/cg1400a.uml index fd17dbddc..d1d4bfaf2 100755 --- a/cg/cg1400a.uml +++ b/cg/cg1400a.uml @@ -169,6 +169,8 @@ END BOOLEAN F_CONTOFIS BEGIN PROMPT 43 13 "Titolari Conto fiscale" + MESSAGE FALSE ENABLE,F_PROFILO + MESSAGE TRUE DISABLE,F_PROFILO|"TITCF",F_PROFILO END BUTTON DLG_SELECT 9 2