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