From b865dbd7a97e164dbcdbfd5a86adff35455c46cf Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 3 Mar 2013 21:44:29 +0000 Subject: [PATCH] Correzioni liquidazione e dichiarazione annuale IVA git-svn-id: svn://10.65.10.50/branches/R_10_00@22809 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg3100.cpp | 61 ++++++++++++---------- cg/cg3500.cpp | 6 --- cg/cg4300.cpp | 2 +- cg/cg4300.h | 2 + cg/cg4301.cpp | 25 ++++++--- cg/cg4302.cpp | 13 ++++- cg/cg4400.cpp | 4 +- cg/cg5.cpp | 2 +- cg/cg5300.cpp | 36 ++----------- cg/cg5300a.uml | 5 +- cg/cg5700.cpp | 134 ++++++++++++++++++++++++++----------------------- cg/cg5700a.frm | 24 +-------- cg/cg5700a.uml | 13 ++--- cg/cg5700b.uml | 10 ++-- cg/cg5800.cpp | 76 ++++++++++++++-------------- cg/cg5800a.uml | 13 ++--- cg/cglib01.cpp | 2 +- cg/cglib02.cpp | 14 +++++- cg/cglib02.h | 1 + 19 files changed, 219 insertions(+), 224 deletions(-) diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index 15cc8baa4..8f9368c0f 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -350,28 +350,24 @@ const char * TListaMov_application::get_error(int err) const const int AllegClifo (int gruppo, int conto, long sottoconto) { - TLocalisamfile clifo(LF_CLIFO); - int alleg; + int alleg = 0; + TLocalisamfile clifo(LF_CLIFO); clifo.setkey(3); clifo.zero(); clifo.put(CLI_GRUPPO, gruppo); clifo.put(CLI_CONTO, conto); clifo.put(CLI_CODCF, sottoconto); - clifo.read(); - if (clifo.good()) - alleg = clifo.curr().get_int(CLI_ALLEG); - else - alleg = 0; + if (clifo.read() == NOERR) + alleg = clifo.get_int(CLI_ALLEG); return alleg; } -const char * DescrConto (long gruppo, long conto, long sottoconto, - const char* tipocf) +const char* DescrConto (int gruppo, int conto, long sottoconto, char tipocf) { TString& tmp = get_tmp_string(50); - +/* TString16 key; key << gruppo; if (conto != 0) @@ -382,7 +378,7 @@ const char * DescrConto (long gruppo, long conto, long sottoconto, if (tmp.empty()) { - key.format("%s|%ld",tipocf , sottoconto); + key.format("%c|%ld", tipocf , sottoconto); const TRectype & clifo = cache().get(LF_CLIFO, key); if (!clifo.empty()) @@ -399,20 +395,22 @@ const char * DescrConto (long gruppo, long conto, long sottoconto, tmp = clifo.get("RAGSOC"); } } +*/ + const TBill bill(gruppo, conto, sottoconto, tipocf); + tmp = bill.descrizione(); return tmp; } bool CausAlleg (const char * cod) { - const TRectype & caus = cache().get(LF_CAUSALI, cod); + const TRectype& caus = cache().get(LF_CAUSALI, cod); const bool allegb = caus.get_bool(CAU_ALLEG); - return allegb; } const char* TipoAttivita (const char* attreg, long codice_ditta) { - TString16 key; key.format("%ld|%s", codice_ditta, attreg); + TString16 key; key.format("%ld|%s", codice_ditta, attreg); return cache().get(LF_ATTIV, key, ATT_TIPOATT); } @@ -582,7 +580,6 @@ void TListaMov_application::stampa_errori_rmov() char tipoc = rec.get_char(RMV_TIPOCC); bool g = FALSE; - char t; TBill tc (gruppo,conto,sottoconto); @@ -606,7 +603,7 @@ void TListaMov_application::stampa_errori_rmov() set_row(_nr++, FR("@11gCodice gruppo/conto/sottoconto non presente in Piano dei Conti")); else { - t = pc.get_char(PCN_TMCF); + const char t = pc.get_char(PCN_TMCF); if (t != tipo) set_row(_nr++, FR("@11gIl tipo C/F indicato non corrisponde a quello presente su Piano dei Conti")); else @@ -924,13 +921,13 @@ bool TListaMov_application::preprocess_page(int file,int counter) { set_row(_nr,"@4g%3s", (const char*) _causale); set_row(_nr,"@8g%-.20s", (const char*) _descr_causale); - _causale_gia_stampata = TRUE; + _causale_gia_stampata = true; } const TRectype& currig = cur->curr(LF_RMOV); - int gruppo = currig.get_int(RMV_GRUPPO); - int conto = currig.get_int(RMV_CONTO); - long sottoconto = currig.get_long(RMV_SOTTOCONTO); - const TString4 tipoc = currig.get(RMV_TIPOC); + const int gruppo = currig.get_int(RMV_GRUPPO); + const int conto = currig.get_int(RMV_CONTO); + const long sottoconto = currig.get_long(RMV_SOTTOCONTO); + const char tipoc = currig.get_char(RMV_TIPOC); _descr = DescrConto(gruppo, conto, sottoconto, tipoc); _alleg = AllegClifo(gruppo, conto, sottoconto); _importo = currig.get_real(RMV_IMPORTO); @@ -1008,10 +1005,10 @@ bool TListaMov_application::preprocess_page(int file,int counter) _causale_gia_stampata = TRUE; } const TRectype& rmov = current_cursor()->curr(LF_RMOV); - int gruppo = rmov.get_int(RMV_GRUPPO); - int conto = rmov.get_int(RMV_CONTO); - long sottoconto = rmov.get_long(RMV_SOTTOCONTO); - const TString4 tipoc = rmov.get(RMV_TIPOC); + const int gruppo = rmov.get_int(RMV_GRUPPO); + const int conto = rmov.get_int(RMV_CONTO); + const long sottoconto = rmov.get_long(RMV_SOTTOCONTO); + const char tipoc = rmov.get_char(RMV_TIPOC); _descr = DescrConto(gruppo, conto, sottoconto, tipoc); _importo = rmov.get_real(RMV_IMPORTO); _appoggio = toupper(rmov.get_char(RMV_SEZIONE)); @@ -1907,11 +1904,20 @@ void TListaMov_application::incrementa_totali() const int colonna = tabiva.get_int("S7"); if ((colonna == 1)||(colonna == 3)) _totimposta += imposta; + if (colonna == 1) _totimponibile += imponibile; else - if (colonna == 3) + { + if (colonna == 3) _op_esenti += imponibile; + else + { + TString msg; msg << TR("Codice IVA senza colonna allegato clienti '") << codiva << "' considerata non imponibile."; + xvtil_statbar_set(msg); + _op_non_imp += imponibile; // 14-02-2013 Il default č ora questo (Sile) + } + } } else { @@ -1924,7 +1930,8 @@ void TListaMov_application::incrementa_totali() case 3: _op_esenti += imponibile; break; case 4: _op_non_imp += imponibile; break; default: - TString msg; msg << TR("Codice IVA senza colonna allegato fornitori '") << codiva << "'"; + _op_non_imp += imponibile; // 14-02-2013 Il default č ora questo (Sile) + TString msg; msg << TR("Codice IVA senza colonna allegato fornitori '") << codiva << "' considerata non imponibile."; xvtil_statbar_set(msg); break; } diff --git a/cg/cg3500.cpp b/cg/cg3500.cpp index 96c71d016..244ed2147 100755 --- a/cg/cg3500.cpp +++ b/cg/cg3500.cpp @@ -942,9 +942,3 @@ int cg3500 (int argc, char* argv[]) a.run(argc, argv, TR("Stampa riepilogo gruppi/conti")); return 0; } - - - - - - diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index 65ab3592f..5fcbd0a27 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -133,7 +133,7 @@ bool TLiquidazione_app::user_create() _att_r = &(_nditte->curr(LF_ATTIV)); _ditte = new TArray_sheet(-1, -1, -4, -4, TR("Selezione Ditte"), - HR("@1|Cod.@5R|Ragione Sociale@50|Vers.|Agr.Min")); + HR("@1|Codice@R|Ragione Sociale@50|Vers.|Agr.Min")); _n_ditte = 0l; // Caro tab11, ricordati che un giorno sarai un file unico! diff --git a/cg/cg4300.h b/cg/cg4300.h index 80afde291..4ab5491c2 100755 --- a/cg/cg4300.h +++ b/cg/cg4300.h @@ -624,6 +624,8 @@ public: bool look_iva(const char* cod); bool look_reg(const char* reg); bool look_lia(long ditta = 0l, bool create = FALSE, int anno = 0); + + int count_activities() const; // trova il mytical ufficio concessione da mettere nelle deleghe bool look_conc(TString& uffcon, TString& uffiva); diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 87c78aead..a2281a95f 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -179,6 +179,8 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) _isintr = _freqviva == "T" && !_lia->get_bool("B3"); // was CNF_DITTA->InTrtr _gest4 = _isbenzinaro && _lia->get_bool("B4"); // was CNF_DITTA->Gest74 + const bool has_single_activity = count_activities() == 1; + // controlla che il periodo corrente non sia l'inizio dell'attivita' // nel caso, differita va a FALSE _monthinatt = 1; @@ -248,7 +250,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) TString8 cattiv(codatt); cattiv << tipoatt; - const bool waspla = look_pla(cattiv, false); + const bool waspla = look_pla(cattiv, has_single_activity); if (!waspla) break; // Non calcolare attivitā inesistenti 29-11-2012 @@ -979,7 +981,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) const bool cau_intra = rcs.get_bool("INTRACOM"); const bool cau_valintra = rcs.get_bool("VALINTRA"); - if (_mov->get_long(MOV_NUMREG) == 63630) + if (_mov->get_long(MOV_NUMREG) == 10146) int cazzone = 1; // Inizio gestione IVA differita @@ -1367,8 +1369,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) // per la dichiarazione annuale fati iva if (month == 13 && !fattrit) { - const TString& iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11"); - if (tipomov == vendita) { const long codcf = _mov->get_long(MOV_CODCF); @@ -1405,16 +1405,25 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) } } - if (iva_vpn.not_empty()) + const TString& iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11"); + if (iva_vpn.full()) { switch (tipomov) { case vendita: // CD1 - 1 2 3 4 { - if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) && - sosp_imp != normale && sosp_imp != liquidazione) + // bool is_valid = !corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) && + // sosp_imp != normale && sosp_imp != liquidazione; + bool is_valid = tipodoc != "AF" && sosp_imp != normale && sosp_imp != liquidazione; + if (is_valid) { - cessioni_cd1_1 += imponibile; + if (movdiff) // 21-02-2013 Comprendere IVA differita registrata nell'anno! (imponibile=0) + { + if (date.year() == year_int) + cessioni_cd1_1 += imponibile_orig; + } + else + cessioni_cd1_1 += imponibile; if (iva_vpn.starts_with("CD1")) { if (tipocr == 4) diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index 202f3ce8d..a7f3cd16c 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -512,6 +512,15 @@ bool TLiquidazione_app::look_lam(int m, bool create) return ok; } +int TLiquidazione_app::count_activities() const +{ + TRelation rel(LF_ATTIV); + TRectype& rec = rel.curr(); + rec.put("CODDITTA", get_firm()); + TCursor cur(&rel, "", 1, &rec, &rec); + return cur.items(); +} + bool TLiquidazione_app::look_pla(const char* a, bool create) { // forza il tipoatt a 1 @@ -519,8 +528,8 @@ bool TLiquidazione_app::look_pla(const char* a, bool create) buf.ltrim(); buf.rtrim(1); buf << "1"; - while (buf.len() < 6) - buf.insert("0"); + //while (buf.len() < 6) buf.insert("0"); + buf.right_just(6, '0'); _pla_r->zero(); (*_pla_ditta) = format("%05ld", get_firm()); diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index 0cb08a6e1..d87ea1236 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -2608,8 +2608,7 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter) print_IVAxCassa(da_mese, a_mese); da_mese = 0; // vieta ristampa! } - else - _riga_prospettoXcassa.destroy(); // Elimina comunque tracking movimenti + _riga_prospettoXcassa.destroy(); // Elimina comunque tracking movimenti } if (_liquidazione) @@ -3381,6 +3380,7 @@ void TStampa_registri_app::no_movimenti() printer().open(); print_IVAxCassa(da, a); } + _riga_prospettoXcassa.destroy(); // Elimina comunque tracking movimenti if (_tipo_reg == riepilogativo || _liquidazione || _stampa_plafonds) { diff --git a/cg/cg5.cpp b/cg/cg5.cpp index 606527f37..4b5e4319b 100755 --- a/cg/cg5.cpp +++ b/cg/cg5.cpp @@ -14,7 +14,7 @@ int main(int argc,char** argv) case 4: cg5400(argc,argv); break; // Ripristino stampe case 5: cg5500(argc,argv); break; // Visualizzazione Liquidazione case 6: cg5600(argc,argv); break; // Ripristino liquidazione - case 7: cg5700(argc,argv); break; // Dichiarazione periodica + case 7: cg5700(argc,argv); break; // Comunicazione annuale dati IVA case 8: cg5800(argc,argv); break; // Quadro VT default: cg5000(argc,argv); break; // Parametri Studio } diff --git a/cg/cg5300.cpp b/cg/cg5300.cpp index 7b93f3426..be84953de 100755 --- a/cg/cg5300.cpp +++ b/cg/cg5300.cpp @@ -45,7 +45,6 @@ protected: // Relapp virtual bool protected_record(TRectype&) { return TRUE; } virtual void init_query_mode(TMask&); virtual void init_insert_mode(TMask& m); - virtual void init_modify_mode(TMask& m); virtual int rewrite(const TMask& m); // non si possono aggiungere record, se non ci sono vengono // creati automaticamente @@ -268,20 +267,15 @@ void TParaliq_app::init_array(TMask& m, bool update) { TToken_string& tt = sf.row(i); - // istanzia array _atts on le attivita' della ditta corrente - tt.cut(0); - tt.add(r.get(ATT_CODATT)); + // istanzia array _atts on le attivitā della ditta corrente + tt = r.get(ATT_CODATT); tt.add(r.get(ATT_TIPOATT)); - tt.add(""); - tt.add(""); - tt.add(""); - tt.add(""); } if (update) { sf.force_update(); - TString16 freq = cache().get(LF_NDITTE,newditta).get(NDT_FREQVIVA); + const TString& freq = cache().get(LF_NDITTE,newditta,NDT_FREQVIVA); m.set(F_FREQ_VERS, freq); } } @@ -333,31 +327,9 @@ void TParaliq_app::init_insert_mode(TMask& m) { // Inizializza array delle attivita' init_array(m, TRUE); - init_modify_mode(m); - - if (m.get_int(F_YEAR) >= 2002) - m.set(F_ROUNDLIQ, TCurrency::get_firm_dec()); + m.set(F_ROUNDLIQ, TCurrency::get_firm_dec()); } - -void TParaliq_app::init_modify_mode(TMask& m) -{ - const int anno_liq = m.get_int(F_YEAR); - if (anno_liq >= 2000) - { - m.enable(F_UTCR_IVA); - } - else - { - m.set(F_UTCR_IVA, " ", TRUE); - m.disable(F_UTCR_IVA); - } - - // Attiva la pagina degli arrotondamenti solo per le ditte in Euro dal 2002 - m.enable_page(1, (anno_liq >= 2002) && (TCurrency::get_firm_dec() > 0)); -} - - int TParaliq_app::rewrite(const TMask& m) { // scrive %LIA diff --git a/cg/cg5300a.uml b/cg/cg5300a.uml index 25e9d07e7..f8fc64f31 100755 --- a/cg/cg5300a.uml +++ b/cg/cg5300a.uml @@ -219,7 +219,7 @@ PAGE "" -1 -1 65 16 STRING F_CODATT 5 BEGIN - PROMPT 4 1 "Codice Attivita' " + PROMPT 4 1 "Codice Attivitā " FLAGS "DUZ" USE %AIS INPUT CODTAB F_CODATT @@ -279,6 +279,9 @@ BEGIN GROUP 1 END +ENDPAGE + +TOOLBAR "topbar" 0 0 0 2 BUTTON DLG_OK 9 2 BEGIN diff --git a/cg/cg5700.cpp b/cg/cg5700.cpp index 5100edb13..7a0d21a61 100755 --- a/cg/cg5700.cpp +++ b/cg/cg5700.cpp @@ -5,10 +5,12 @@ #include #include #include +#include #include #include #include +#include #include "cg5700.h" #include "cglib03.h" @@ -21,7 +23,6 @@ class TDich_periodica_selfirm_mask : public TAutomask protected: bool select_button(); - void build_nomiditte(); void build_ditte_sheet(); public: @@ -33,13 +34,11 @@ public: TDich_periodica_selfirm_mask::TDich_periodica_selfirm_mask() : TAutomask("cg5700a") { - _ditte = new TArray_sheet(-1, -1, -4, -4, TR("Selezione Ditte"), - HR("Cod.@5|Ragione Sociale@50")); + _ditte = new TArray_sheet(-1, -1, 70, 15, TR("Selezione Ditte"), + HR("Codice@6R|Ragione Sociale@50")); TDate oggi(TODAY); - _year = oggi.year(); - build_nomiditte(); build_ditte_sheet(); } @@ -48,46 +47,45 @@ TDich_periodica_selfirm_mask::~TDich_periodica_selfirm_mask() delete _ditte; } -void TDich_periodica_selfirm_mask::build_nomiditte() -{ - TString cod; - TRelation relditte(LF_NDITTE); - TRectype & ditta = relditte.lfile().curr(); - TCursor cur(&relditte); - const TRecnotype items = cur.items(); - - cur.freeze(); - _nomiditte.destroy(); - for (cur = 0L; cur.pos() < items; ++cur) - { - const long codditta = ditta.get_long("CODDITTA"); - bool good = prefix().exist(codditta); - - if (good) - { - TToken_string* d = new TToken_string(64); - d->add(codditta); - d->add(ditta.get("RAGSOC")); - _nomiditte.add(d); - } - } -} - void TDich_periodica_selfirm_mask::build_ditte_sheet() { + TTable pum("PUM"); + _ditte->destroy(); - long prima = -1; - - for (int i = 0; i < _nomiditte.items(); i++) + TPointer_array firms; + TPrefix::firms(firms); + + long good_company = -1; + + FOR_EACH_ARRAY_ITEM(firms, i, obj) { - TToken_string* d = new TToken_string(_nomiditte.row(i)); - const long pos = _ditte->add(d); - const char vers = d->get_char(2); - const bool selectable = vers != '?'; - _ditte->enable_row(pos, selectable); - if (selectable && prima < 0) - _ditte->select(prima = pos); - } + TToken_string* d = new TToken_string(63); + const long codditta = firms.get_long(i); + d->add(codditta); + d->add(cache().get(LF_NDITTE, codditta, NDT_RAGSOC)); + const long pos = _ditte->add(d); + + pum.put("CODTAB", _year); + if (pum.read(_isgteq) == NOERR && atoi(pum.get("CODTAB").left(4)) == _year) + { + if (good_company <= 0) + good_company = pos; + } + else + _ditte->disable_row(pos); + } + + if (good_company >= 0) + { + TToken_string& row = _ditte->row(good_company); + set(F_CODDITTA, row.get(0)); + set(F_RAGSOC, row.get(1)); + } + else + { + reset(F_CODDITTA); + reset(F_RAGSOC); + } } bool TDich_periodica_selfirm_mask::select_button() @@ -97,9 +95,9 @@ bool TDich_periodica_selfirm_mask::select_button() TToken_string& row = _ditte->row(_ditte->selected()); set(F_CODDITTA, row.get(0)); set(F_RAGSOC, row.get(1)); - return TRUE; + return true; } - return FALSE; + return false; } bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) @@ -112,24 +110,18 @@ bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_eve if (e == fe_modify) { - bool found = FALSE; - TString16 ditta = o.get(); - for (int i = 0; i < _ditte->items(); i++) + bool found = false; + const long ditta = atol(o.get()); + for (long i = 0; i < _ditte->items(); i++) { TToken_string& row = _ditte->row(i); - if (ditta == row.get(0)) + if (ditta == row.get_long(0)) { if (_ditte->row_enabled(i)) { set(F_CODDITTA, row.get(0)); set(F_RAGSOC, row.get(1)); - found = TRUE; - } - else - { - warning_box(FR("Non sono definiti i parametri liquidazione per la ditta %ld"), - atol(ditta)); - o.reset(); + found = true; } break; } @@ -169,10 +161,7 @@ bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_eve if (e == fe_modify) { _year = atoi(o.get()); - build_nomiditte(); build_ditte_sheet(); - set(F_CODDITTA, ""); - set(F_RAGSOC, ""); } break; default: @@ -243,6 +232,7 @@ class TDich_periodica_iva_mask : public TAutomask _is_euro; // importi in euro protected: void read_iva_data(); + real imposta_diff() const; public: void set_prospect(); @@ -250,7 +240,6 @@ public: virtual bool on_key(KEY k); virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); TDich_periodica_iva_mask(TDich_periodica_selfirm_mask *m); - virtual ~TDich_periodica_iva_mask() {}; }; TDich_periodica_iva_mask::TDich_periodica_iva_mask(TDich_periodica_selfirm_mask *m) @@ -272,6 +261,27 @@ TDich_periodica_iva_mask::TDich_periodica_iva_mask(TDich_periodica_selfirm_mask } } +real TDich_periodica_iva_mask::imposta_diff() const +{ + real imposta; + + const int anno = _sf->get_year(); + const TDate data_da(1,1,anno); + const TDate data_a(31,12,anno); + + TString query; + query = "USE IVADIFF SELECT (BETWEEN(DATAREGP,#DAL,#AL))&&(TIPOMOV>2)&&(STR(MOV.TOTDOC>0))"; + query << "\nBY DATAREGP DATAREG"; + query << "\nJOIN MOV INTO NUMREG==NUMREG"; + TISAM_recordset id(query); + id.set_var("#DAL", data_da); + id.set_var("#AL", data_a); + + for (bool ok = id.move_first(); ok; ok = id.move_next()) + imposta += id.get(RMI_IMPOSTA).as_real(); + return imposta; +} + void TDich_periodica_iva_mask::read_iva_data() { @@ -303,8 +313,8 @@ void TDich_periodica_iva_mask::read_iva_data() real cd2_5 = ZERO; real cd3_1 = ZERO; real cd3_2 = ZERO; - real cd3_3 = ZERO; - real cd3_4 = ZERO; + real cd3_3 = ZERO; + real cd3_4 = ZERO; TRelation relpum("PUM"); TRectype & pum = relpum.curr(); @@ -318,7 +328,7 @@ void TDich_periodica_iva_mask::read_iva_data() cur.freeze(); for (cur = 0L; cur.pos() < items; ++cur) { - const TString & codtab = pum.get("CODTAB"); + const TString& codtab = pum.get("CODTAB"); const TString& annoiva = codtab.left(4); if (annoiva != key) @@ -350,7 +360,7 @@ void TDich_periodica_iva_mask::read_iva_data() const real rettifica = lim.get_real("R5"); // Rettifiche real cd4 = lam.get_real("R0"); // Iva esigibile per il periodo - + cd4 += imposta_diff(); if (rettifica > ZERO) cd4 += rettifica; cd4.round(); diff --git a/cg/cg5700a.frm b/cg/cg5700a.frm index a4704c772..2ddf84970 100755 --- a/cg/cg5700a.frm +++ b/cg/cg5700a.frm @@ -28,26 +28,6 @@ BEGIN PROMPT 2 1 "@bAGENZIA DELLE ENTRATE" END -STRINGA -1 -BEGIN - PROMPT 2 2 "[]\ //\ " -END - -STRINGA -1 -BEGIN - PROMPT 2 3 "[]\\ // \\" -END - -STRINGA -1 -BEGIN - PROMPT 2 4 "[] \\//___\\" -END - -STRINGA -1 -BEGIN - PROMPT 2 5 "[] \/-----\\" -END - STRINGA -1 BEGIN PROMPT 2 6 "@bCOMUNICAZIONE" @@ -175,7 +155,7 @@ END STRINGA -1 BEGIN KEY "CD12_5 - Descrizione" - PROMPT 6 22 "di cui: acquisti beni strumentali" + PROMPT 6 22 "di cui cessioni beni strumentali" END VALUTA FF_CD1_5 18 @@ -245,7 +225,7 @@ END STRINGA -1 BEGIN KEY "CD2_5 - Descrizione" - PROMPT 6 29 "di cui: acquisti beni strumentali" + PROMPT 6 29 "di cui acquisti beni strumentali" END VALUTA FF_CD2_5 18 diff --git a/cg/cg5700a.uml b/cg/cg5700a.uml index 0f0550137..19be4fe83 100755 --- a/cg/cg5700a.uml +++ b/cg/cg5700a.uml @@ -1,22 +1,22 @@ #include "cg5700.h" -PAGE "Comunicazione Annuale dati IVA" -1 -1 72 8 +PAGE "Comunicazione Annuale dati IVA" -1 -1 60 8 NUMBER F_YEAR 4 BEGIN - PROMPT 1 1 "Anno liquidazione " - FLAGS "AR" + PROMPT 1 1 "Anno " + FLAGS "A" END NUMBER F_CODDITTA 5 BEGIN - PROMPT 1 3 "Codice ditta " + PROMPT 1 2 "Ditta " FLAGS "B" END -STRING F_RAGSOC 50 30 +STRING F_RAGSOC 50 BEGIN - PROMPT 28 3 "Rag.soc. " + PROMPT 7 3 "" FLAGS "B" END @@ -31,4 +31,5 @@ BEGIN END ENDPAGE + ENDMASK diff --git a/cg/cg5700b.uml b/cg/cg5700b.uml index 57632d76b..e2b1468a6 100755 --- a/cg/cg5700b.uml +++ b/cg/cg5700b.uml @@ -8,11 +8,7 @@ BEGIN MESSAGE EXIT, K_ENTER END -BUTTON DLG_QUIT 10 2 -BEGIN - PROMPT -22 -11 "" -END - +#include ENDPAGE PAGE "Comunicazione annuale dati IVA" 0 0 0 2 @@ -66,7 +62,7 @@ END CURRENCY F_CD1_5 18 BEGIN - PROMPT 1 8 " di cui: cess. beni strument. " + PROMPT 1 8 "di cui: cess. beni strumentali " FLAGS "D" END @@ -96,7 +92,7 @@ END CURRENCY F_CD2_5 18 BEGIN - PROMPT 1 13 " di cui: acq. beni strument. " + PROMPT 1 13 "di cui: acq. beni strumentali " FLAGS "D" END diff --git a/cg/cg5800.cpp b/cg/cg5800.cpp index aae5b5599..6904fb397 100755 --- a/cg/cg5800.cpp +++ b/cg/cg5800.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -12,12 +13,10 @@ class TQuadro_VT_selfirm_mask : public TAutomask { TArray_sheet * _ditte; - TString_array _nomiditte; int _year; protected: bool select_button(); - void build_nomiditte(); void build_ditte_sheet(); public: @@ -33,7 +32,6 @@ TQuadro_VT_selfirm_mask::TQuadro_VT_selfirm_mask() : TAutomask("cg5800a") const TDate oggi(TODAY); _year = oggi.year(); - build_nomiditte(); build_ditte_sheet(); } @@ -42,45 +40,46 @@ TQuadro_VT_selfirm_mask::~TQuadro_VT_selfirm_mask() delete _ditte; } -void TQuadro_VT_selfirm_mask::build_nomiditte() -{ - TRelation relditte(LF_NDITTE); - TRectype & ditta = relditte.lfile().curr(); - TCursor cur(&relditte); - const TRecnotype items = cur.items(); - - cur.freeze(); - _nomiditte.destroy(); - for (cur = 0L; cur.pos() < items; ++cur) - { - const long codditta = ditta.get_long("CODDITTA"); - bool good = prefix().exist(codditta); - - if (good) - { - TToken_string* d = new TToken_string(64); - d->add(codditta); - d->add(ditta.get("RAGSOC")); - _nomiditte.add(d); - } - } -} - void TQuadro_VT_selfirm_mask::build_ditte_sheet() { + TTable pum("PUM"); + _ditte->destroy(); - long prima = -1; - - for (int i = 0; i < _nomiditte.items(); i++) + TPointer_array firms; + TPrefix::firms(firms); + + long good_company = -1; + + FOR_EACH_ARRAY_ITEM(firms, i, obj) { - TToken_string* d = new TToken_string(_nomiditte.row(i)); - const long pos = _ditte->add(d); - const char vers = d->get_char(2); - const bool selectable = vers != '?'; - _ditte->enable_row(pos, selectable); - if (selectable && prima < 0) - _ditte->select(prima = pos); - } + TToken_string* d = new TToken_string(63); + const long codditta = firms.get_long(i); + d->add(codditta); + d->add(cache().get(LF_NDITTE, codditta, NDT_RAGSOC)); + const long pos = _ditte->add(d); + + pum.put("CODTAB", _year); + if (pum.read(_isgteq) == NOERR && atoi(pum.get("CODTAB").left(4)) == _year) + { + if (good_company <= 0) + good_company = pos; + } + else + _ditte->disable_row(pos); + } + + if (good_company >= 0) + { + TToken_string& row = _ditte->row(good_company); + set(F_CODDITTA, row.get(0)); + set(F_RAGSOC, row.get(1)); + } + else + { + reset(F_CODDITTA); + reset(F_RAGSOC); + } + } bool TQuadro_VT_selfirm_mask::select_button() @@ -162,7 +161,6 @@ bool TQuadro_VT_selfirm_mask::on_field_event(TOperable_field& o, TField_event e, if (e == fe_modify) { _year = atoi(o.get()); - build_nomiditte(); build_ditte_sheet(); set(F_CODDITTA, ""); set(F_RAGSOC, ""); diff --git a/cg/cg5800a.uml b/cg/cg5800a.uml index 1733abf06..3916601d0 100755 --- a/cg/cg5800a.uml +++ b/cg/cg5800a.uml @@ -1,22 +1,22 @@ -#include "cg5700.h" +#include "cg5800.h" PAGE "Quadro VT" -1 -1 72 8 NUMBER F_YEAR 4 BEGIN - PROMPT 1 1 "Anno liquidazione " - FLAGS "AR" + PROMPT 1 1 "Anno " + FLAGS "A" END NUMBER F_CODDITTA 5 BEGIN - PROMPT 1 3 "Codice ditta " + PROMPT 1 2 "Ditta " FLAGS "B" END -STRING F_RAGSOC 50 30 +STRING F_RAGSOC 50 BEGIN - PROMPT 28 3 "Rag.soc. " + PROMPT 7 3 "" FLAGS "B" END @@ -31,4 +31,5 @@ BEGIN END ENDPAGE + ENDMASK diff --git a/cg/cglib01.cpp b/cg/cglib01.cpp index 826100cae..ff41f4115 100755 --- a/cg/cglib01.cpp +++ b/cg/cglib01.cpp @@ -1156,7 +1156,7 @@ bool TBill::is_analitico() const return false; } -const char * num2str(const TString & s) +const char* num2str(const TString & s) { TString & str = get_tmp_string(20); diff --git a/cg/cglib02.cpp b/cg/cglib02.cpp index 3498f37d1..53dfb49d1 100755 --- a/cg/cglib02.cpp +++ b/cg/cglib02.cpp @@ -864,7 +864,19 @@ void TSaldo_agg::aggiorna(int gruppo, int conto, long sottoconto, const real& im const TBill bill(gruppo, conto, sottoconto); const TImporto imp(sezione, importo); _tab_conti.aggiorna_conto(bill, _anno_es, imp, _movap, - _provv, somma, _movimentato, scaricato); + _provv, somma, _movimentato, scaricato); +} + +void TSaldo_agg::aggiorna(const TRectype& rmov, bool somma, bool scaricato) +{ + const real imp = rmov.get(RMV_IMPORTO); + if (!imp.is_zero()) + { + const char sez = rmov.get_char(RMV_SEZIONE); + const TImporto importo(sez, imp); + const TBill bill(rmov); + aggiorna(bill, importo, somma, scaricato); + } } void TSaldo_agg::reset() diff --git a/cg/cglib02.h b/cg/cglib02.h index 552a3e920..71c3812d4 100755 --- a/cg/cglib02.h +++ b/cg/cglib02.h @@ -179,6 +179,7 @@ public: void aggiorna (const TBill& tc, const real& importo, char sezione, bool somma = true, bool scaricato = false) { aggiorna(tc.gruppo(), tc.conto(), tc.sottoconto(), importo, sezione, somma, scaricato);} void aggiorna (int gruppo, int conto, long sottoconto, const real& importo, char sezione, bool somma = true, bool scaricato = false); + void aggiorna (const TRectype& rmov, bool somma = true, bool scaricato = false); TConto* find(const TBill& c, int anno) { return _tab_conti.find(c, anno); }