diff --git a/ve/listadoc.frm b/ve/listadoc.frm index 7022051bd..a99528ca8 100755 --- a/ve/listadoc.frm +++ b/ve/listadoc.frm @@ -245,6 +245,20 @@ BEGIN MESSAGE COPY,37 END +STRINGA 16 20 +BEGIN + KEY "Liquidazione differita" + PROMPT 140 2 "" + MESSAGE _STREXPR,IF(33->LIQDIFF=="X","Liquidazione differita","") +END + +STRINGA 17 20 +BEGIN + KEY "IVA per cassa" + PROMPT 140 2 "" + MESSAGE _STREXPR,IF(33->IVAXCASSA=="X","IVA per cassa","") +END + SECTION H_RIGHE 3 0 2 GROUP FLAGS "D" STRINGA 1 20 diff --git a/ve/ve0300.cpp b/ve/ve0300.cpp index 3d07b5735..b1381c115 100755 --- a/ve/ve0300.cpp +++ b/ve/ve0300.cpp @@ -100,6 +100,9 @@ public: // GROUP void group( const int g ) { _out << "GR " << g << "\n"; }; + // MODULE + void module( const TString& m ) { _out << "MO " << m << "\n"; }; + // PICTURE void picture( const int p) { _out << "PI " << p << "\n"; }; // void picture( const TString & s) { _out << "PI " << '\"' << s << "\"\n"; }; @@ -441,7 +444,7 @@ class TField : public TObject int _size; int _stato; int _x, _y; - TString _prompt, _flag, _help, _warning, _fieldname; + TString _prompt, _flag, _help, _warning, _fieldname, _modules; TToken_string _use, _input, _display, _output, _special, _items, _configs; TToken_string _copy; @@ -478,12 +481,14 @@ public: void help( const TString& help ){ _help = help; } void warning( const TString& warning ){ _warning = warning; } void fieldname( const TString& fieldname ){ _fieldname = fieldname; } + void modules( const TString& m ){ _modules = m; } TString& nome( ){ return _nome; } TString& prompt( ){ return _prompt; } TString& flag( ){ return _flag; } TString& help( ){ return _help; } TString& warning( ){ return _warning; } TString& fieldname( ){ return _fieldname; } + TString& modules( ){ return _modules; } void use( TToken_string& use ){ _use = use; } void input( TToken_string& input ){ _input = input; } @@ -603,7 +608,6 @@ static void genera_gruppo( const TObject& gruppo ) row_pos = line.find("%S"); const bool field = line.left(2) == "%F"; - if (field && row > MAX_LINES_PER_PAGE) { // Passa alla pagina successiva @@ -694,12 +698,13 @@ TField::TField( TString& campo, TConfig& pro ) : _nome( campo ) _prompt = pro.get( "PROMPT", campo ); if( _prompt[ 0 ] == '\"' ) { - _prompt.ltrim( 1 ); - _prompt.rtrim( 1 ); + _prompt.rtrim(1); + _prompt.ltrim(1); }; _flag = pro.get( "FLAG", campo ); - _help = pro.get( "FLAG", campo ); - _warning = pro.get( "FLAG", campo ); + _help = pro.get( "HELP", campo ); + _warning = pro.get( "WARNING", campo ); + _modules = pro.get( "MODULE", campo ); _modules.strip("\""); _use = pro.get( "USE", campo ); _use.separator( '~' ); _input = pro.get( "INPUT", campo ); @@ -736,6 +741,7 @@ TField::TField( ) _flag = ""; _help = ""; _warning = ""; + _modules = ""; _use = ""; _use.separator( '~' ); _input = ""; @@ -770,6 +776,7 @@ TObject* TField::dup() const f->_flag = _flag; f->_help = _help; f->_warning = _warning; + f->_modules = _modules; f->_use = _use; f->_id = _id; f->_input = _input; @@ -858,9 +865,9 @@ void TField::genera( ) case S_OBBLIGATORIO : case S_NOCHECK : m.prompt( _x, _y + m.line( ), _prompt ); - m.flag( _flag ); + if (_flag.full()) m.flag( _flag ); break; - default: + default: break; } if ((_type == T_DATA || _type == T_STRINGA || @@ -868,16 +875,17 @@ void TField::genera( ) _type == T_GOLEM || _type == T_CURRENCY) && (_stato == S_OBBLIGATORIO || (!_use.blank()))) m.check( _stato ); - if ( !_fieldname.blank( ) ) m.field( _fieldname ); - if ( !_items.blank( ) ) m.item( _items ); - if ( !_use.blank( ) ) m.use( _use ); - if ( !_input.blank( ) ) m.input( _input ); - if ( !_display.blank( ) ) m.display( _display ); - if ( !_output.blank( ) ) m.output( _output ); - if ( !_copy.blank( ) ) m.copy( _copy ); - if ( !_help.blank( ) ) m.help( _help ); - if ( !_warning.blank( ) ) m.warning( _warning ); - if ( !_special.blank( ) ) m.outline( _special ); + if ( _fieldname.full( ) ) m.field( _fieldname ); + if ( _items.full( ) ) m.item( _items ); + if ( _use.full( ) ) m.use( _use ); + if ( _input.full( ) ) m.input( _input ); + if ( _display.full( ) ) m.display( _display ); + if ( _output.full( ) ) m.output( _output ); + if ( _copy.full( ) ) m.copy( _copy ); + if ( _help.full( ) ) m.help( _help ); + if ( _warning.full( ) ) m.warning( _warning ); + if ( _special.full( ) ) m.outline( _special ); + if ( _modules.full()) m.module(_modules); m.end( ); if ( ( m.line( ) > MAX_LINES_PER_PAGE )) m.end( ); @@ -996,6 +1004,8 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TAssoc_array& a ) campo->warning( value ); else if( key == "HELP" ) campo->help( value ); + else if( key == "MODULE" ) + campo->modules( value ); else if( key == "SPECIAL" ) campo->special( (TToken_string & )value ); else if( key == "ITEMS" ) @@ -1063,7 +1073,7 @@ void TMask_generator::intestazione_pagina( const char* def_title) _m->control( T_STRINGA, DLG_NULL, 4 ); _m->begin( ); - _m->prompt( 2, 1, "Cod. num. " ); + _m->prompt( 2, 1, "Cod. num. "); _m->flag( "D" ); _m->group( 2 ); _m->end( ); diff --git a/ve/ve0300a.src b/ve/ve0300a.src index 1d1cd91a7..352100431 100755 --- a/ve/ve0300a.src +++ b/ve/ve0300a.src @@ -102,6 +102,7 @@ FIELDNAME=IVAXCASSA MSKID=F_IVAXCASSA TYPE=T_CHECKBOX PROMPT="IVA per cassa" +MODULE=IC [STATOPAIV] // il campo e' letto nel file 20 clifo diff --git a/ve/ve1100.cpp b/ve/ve1100.cpp index dbd2442e8..465552533 100755 --- a/ve/ve1100.cpp +++ b/ve/ve1100.cpp @@ -307,7 +307,7 @@ bool TDocumento_form::doc_arrange() { if (offset_x() != 0 || offset_y() != 0) { - error_box(FR("Non e' possibile settare contemporaneamente gli offset" + error_box(FR("Non è possibile impostare contemporaneamente gli offset" " e i parametri di posizionamento del modulo %s."), (const char*)name()); return false; } @@ -381,14 +381,14 @@ void TDocumento_form::print_documento() if (_doc->tipo().add_conai() && _doc->clifor().vendite().get_bool("CONAIASS")) { TRiga_documento last_row(_doc); - TConfig c(CONFIG_DITTA); last_row = _rdocfile->curr(); _rdocfile->zero(); - TString80 desc(c.get("DESCCONAIASS")); - if (desc.empty()) - desc = TR("Contributo CONAI assolto"); - _rdocfile->put(RDOC_DESCR, desc); + const TString& desc = ini_get_string(CONFIG_DITTA, "ve", "DESCCONAIASS"); + if (desc.blank()) + _rdocfile->put(RDOC_DESCR, TR("Contributo CONAI assolto")); + else + _rdocfile->put(RDOC_DESCR, desc); body.update(); const word h = body.height(); if (pr.rows_left() <= h+1) // salto pagina @@ -1232,7 +1232,6 @@ enum behaviour #define BY_NUM_KEY 1 #define BY_DATE_KEY 3 - class TStampaDoc_application: public TSkeleton_application { TString _codnum; // codice di numerazione @@ -1967,13 +1966,13 @@ TStampaDoc_application::TOutput_mode TStampaDoc_application::key2mode(KEY k) con switch (k) { - case 'A': mode = out_preview; break; - case 'E': mode = out_mail; break; - case 'e': mode = out_signed_mail; break; - case 'P': mode = out_pdf; break; - case 'p': mode = out_signed_pdf; break; - case 'S': - default : mode = out_print; break; + case 'A': mode = out_preview; break; + case 'E': mode = out_mail; break; + case 'e': mode = out_signed_mail; break; + case 'P': mode = out_pdf; break; + case 'p': mode = out_signed_pdf; break; + case 'S': + default : mode = out_print; break; } return mode; } @@ -1982,7 +1981,7 @@ bool TStampaDoc_application::create() { _firmrel= new TRelation(LF_NDITTE); // istanziamento e impostazione della relazione di gestione della ditta corrente _firmrel->add(LF_ANAG, "TIPOA=TIPOA|CODANAGR=CODANAGR"); - _firmrel->add(LF_UNLOC,"CODDITTA=CODDITTA"); // si posiziona sulla prima unita' locale della ditta + _firmrel->add(LF_UNLOC, "CODDITTA=CODDITTA"); // si posiziona sulla prima unita' locale della ditta _firmrel->add(LF_COMUNI, "STATO=STATORES|COM=COMRES", 1, LF_ANAG, 100+LF_COMUNI); _firmrel->add(LF_COMUNI, "STATO=STATORES|COM=COMRF", 1, LF_ANAG, 200+LF_COMUNI); open_files(LF_TABCOM, LF_TAB, LF_OCCAS, LF_CLIFO, LF_INDSP, LF_CFVEN, LF_MOVMAG, LF_RMOVMAG, LF_CONDV, LF_ANAMAG , LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_CAUSALI, 0); diff --git a/ve/ve2400.cpp b/ve/ve2400.cpp index 11a23ceae..92d0872a1 100755 --- a/ve/ve2400.cpp +++ b/ve/ve2400.cpp @@ -2096,7 +2096,7 @@ int ve2400(int argc, char* argv[]) { TAnagrafica_magazzino a; - a.run(argc, argv, "Anagrafica di magazzino"); + a.run(argc, argv, TR("Anagrafica di magazzino")); return 0; } diff --git a/ve/vefat.rep b/ve/vefat.rep index acba5c1db..ddfbedbe0 100755 --- a/ve/vefat.rep +++ b/ve/vefat.rep @@ -175,11 +175,19 @@ MESSAGE APPEND,26 - + + + + 33.IVAXCASSA + +
  • +
  • + + @@ -367,7 +375,7 @@ NEGATE C; AND IF -"Iva a esigibilt&#E0; differita ai sensi dell' art. 6 comma 5, del dpr n.633F;2973 e dell' art.7 legge 2F;2009" +"IVA a esigibilit&#E0; differita ai sensi dell'art. 6 comma 5, del dpr n.633F;2973 e dell' art.7 legge 2F;2009" #THIS ! THEN @@ -381,7 +389,7 @@ NEGATE C; AND IF -"Iva a esigibilt&#E0; differita ai sensi dell' art. 6 comma 5, del dpr n.633F;2973 e dell' art.7 legge 2F;2009" +"IVA a esigibilit&#E0; differita ai sensi dell'art. 6 comma 5, del dpr n.633F;2973 e dell' art.7 legge 2F;2009" #THIS ! THEN diff --git a/ve/velib.h b/ve/velib.h index d3c681fa0..87be11bc6 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -1047,6 +1047,8 @@ public: static bool numdocrif_search_handler( TMask_field& f, KEY key ); static bool ragsoc_search_handler( TMask_field& f, KEY key ); static bool datadocrif_handler(TMask_field& f, KEY key); + static bool liqdiff_handler( TMask_field& f, KEY key ); + virtual void highlight_row(int row, COLOR back = COLOR_INVALID, COLOR fore = COLOR_INVALID, bool dirty = true, bool update = true); void highlight(); diff --git a/ve/velib04b.cpp b/ve/velib04b.cpp index 5a0ddc513..4f03b4913 100755 --- a/ve/velib04b.cpp +++ b/ve/velib04b.cpp @@ -1438,6 +1438,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) mov_rec.put(MOV_DCODNUM, doc.get(DOC_CODNUM)); mov_rec.put(MOV_DNDOC, doc.get(DOC_NDOC)); mov_rec.put(MOV_LIQDIFF, doc.get(DOC_LIQDIFF)); + mov_rec.put(MOV_IVAXCASSA, doc.get(DOC_IVAXCASSA)); mov_rec.put(MOV_CONTRATTO, doc.get(DOC_CONTRATTO)); mov_rec.put(MOV_MODPAG, doc.get(DOC_MODPAG)); mov_rec.put(MOV_CONTSEP, doc.get(DOC_CONTSEP)); @@ -1624,6 +1625,7 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc) mov_rec.put(MOV_DCODNUM, doc.get(DOC_CODNUM)); mov_rec.put(MOV_DNDOC, doc.get(DOC_NDOC)); mov_rec.put(MOV_LIQDIFF, doc.get(DOC_LIQDIFF)); + mov_rec.put(MOV_IVAXCASSA, doc.get(DOC_IVAXCASSA)); mov_rec.put(MOV_CONTRATTO, doc.get(DOC_CONTRATTO)); mov_rec.put(MOV_MODPAG, doc.get(DOC_MODPAG)); mov_rec.put(MOV_CONTSEP, doc.get(DOC_CONTSEP)); @@ -1636,7 +1638,7 @@ error_type TContabilizzazione::search_costo_ricavo(TBill& conto, const TRiga_doc { const int items = _search_seq->items(); TLocalisamfile & cli_file = _clifo->lfile(); // YES, arriva qui dentro quando la relazione e' gia' posizionata - const bool is_cli = cli_file.get(CLI_TIPOCF) == "C"; + const bool is_cli = cli_file.get_char(CLI_TIPOCF) != 'F'; bool skip_art_related = false; bool skip_clifo = _clifo->bad(); TCodiceIVA codiva(r.get(RDOC_CODIVA)); @@ -3088,7 +3090,7 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi const bool has_sc = sc_enabled(head.get_date(MOV_DATAREG)); if (has_sc) - write_scadenze(doc, numreg == old_numreg); // Recontbilizing? + write_scadenze(doc, numreg == old_numreg); // Recontabilizing? if (good() && in_enabled()) write_intra(doc); @@ -3199,8 +3201,8 @@ error_type TContabilizzazione::compile_head_anticipo(TDocumento& doc) head.put(MOV_TIPODOC,_caus->tipo_doc()); head.put(MOV_CODCAUS,_caus->codice()); descr = doc.get_bool(DOC_ACCSALDO) ? TR("Saldo fattura") : TR("Acconto fattura"); - descr << " n. " << doc.numero(); - descr << " del " << doc.get_date(DOC_DATADOC).string(); + descr << TR(" n. ") << doc.numero(); + descr << TR(" del ") << doc.get_date(DOC_DATADOC).string(); head.put(MOV_DESCR,descr); head.put(MOV_TIPOMOV,char(_caus->tipomov()+'0')); head.zero(MOV_REG); @@ -3208,7 +3210,7 @@ error_type TContabilizzazione::compile_head_anticipo(TDocumento& doc) head.zero(MOV_CODPAG); head.zero(MOV_CORRLIRE); head.zero(MOV_CORRVALUTA); - TString codval = head.get(MOV_CODVALI); +// TString4 codval = head.get(MOV_CODVALI); // real cambio = head.get_real(MOV_CAMBIOI); head.zero(MOV_CODVALI); head.zero(MOV_CAMBIOI); @@ -3382,7 +3384,7 @@ error_type TContabilizzazione::write_pagamento_anticipo(TDocumento& doc) const TRectype& mov = _anticipo->curr(); const int anno = mov.get_date(MOV_DATAREG).year(); const long numreg = mov.get_long(MOV_NUMREG); - const TString16 numpart(mov.get(MOV_NUMDOC)); // Nessun controllo se prot.iva o numdoc xche' tanto proviene dal mov precedentemente scritto + const TString8 numpart(mov.get(MOV_NUMDOC)); // Nessun controllo se prot.iva o numdoc xche' tanto proviene dal mov precedentemente scritto TPartita* partita = new TPartita(_co_cliente,anno,numpart); partita->allinea(); @@ -3395,8 +3397,8 @@ error_type TContabilizzazione::write_pagamento_anticipo(TDocumento& doc) TRiga_partite& rpart = partita->riga(r); if (rpart.is_fattura()) { - TString16 s1 = rpart.get(PART_NUMDOC); s1.trim(); - TString16 s2 = numpart; s2.trim(); + TString8 s1 = rpart.get(PART_NUMDOC); s1.trim(); + TString8 s2 = numpart; s2.trim(); if (s1 == s2) // Bisogna tener conto dell'allineamento! { nriga = r; @@ -3440,9 +3442,9 @@ error_type TContabilizzazione::write_pagamento_anticipo(TDocumento& doc) TCurrency_documento impval(doc.get_real(DOC_IMPPAGATO), doc); TCurrency_documento imp(impval); imp.change_to_firm_val(); - real cambio = doc.get_real(DOC_CAMBIO); - TString16 val(doc.get(DOC_CODVAL)); - TDate datacam(doc.get_date(DOC_DATACAMBIO)); + const real cambio = doc.get_real(DOC_CAMBIO); + const TString4 val(doc.get(DOC_CODVAL)); + const TDate datacam(doc.get_date(DOC_DATACAMBIO)); const bool valuta = val.not_empty(); riga_part.put(PART_IMPORTO,imp.get_num()); riga_part.put(PART_IMPORTOVAL,impval.get_num()); diff --git a/ve/velib06.cpp b/ve/velib06.cpp index 6c372c8c8..a9d5b5930 100755 --- a/ve/velib06.cpp +++ b/ve/velib06.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -159,6 +158,7 @@ TDocumento_mask::TDocumento_mask(const char* td) set_field_handler( F_CODVAL1, codval_handler ); set_field_handler( F_NUMDOCRIF, datadocrif_handler); set_field_handler( F_DATADOCRIF, datadocrif_handler); + set_field_handler( F_LIQDIFF, liqdiff_handler); set_handler( DLG_ELABORA, elabora_handler ); set_handler( DLG_PRINT, print_handler ); @@ -1092,7 +1092,14 @@ void TDocumento_mask::cli2mask(bool force_load) set(F_SPESEINC, ven_rec.get(CFV_PERCSPINC)); set(F_ADDBOLLI, ven_rec.get(CFV_ADDBOLLI)); set(F_CATVEN, ven_rec.get(CFV_CATVEN)); - set(F_LIQDIFF, c.get_int(CLI_ALLEG) == 7 && ven_rec.get_bool(CFV_FATTSOSP) ? "X" : ""); + + const int alleg = c.get_int(CLI_ALLEG); + const bool ivadiff = alleg == 7 && ven_rec.get_bool(CFV_FATTSOSP); + set(F_LIQDIFF, ivadiff ? "X" : ""); + + const TDate datadoc = doc().get(DOC_DATADOC); + const bool IVAxCassa = !ivadiff && (alleg < 5 || alleg == 7) && gestione_IVAxCassa(datadoc); + set(F_IVAXCASSA, IVAxCassa ? "X" : ""); pos = id2pos(F_CODLIST); @@ -2096,7 +2103,7 @@ bool TDocumento_mask::clifo_handler( TMask_field& f, KEY key ) } else d.zero(DOC_OCFPI); - } + } return true; } @@ -3708,7 +3715,7 @@ bool TDocumento_mask::anno_handler( TMask_field& f, KEY key) return true; } -TString16 __codnum; +static TString4 __codnum; bool tipodoc_ok(const TString & tipodoc) { @@ -3746,8 +3753,8 @@ bool TDocumento_mask::num_handler( TMask_field& f, KEY key) // Ottengo la maschera TMask& m = f.mask(); const TString & codnum = f.get(); - TCursor * cur = m.efield(F_TIPODOC).browse()->cursor(); - TCursor * descur = m.efield(F_DESTIPODOC).browse()->cursor(); + TCursor* cur = m.efield(F_TIPODOC).browse()->cursor(); + TCursor* descur = m.efield(F_DESTIPODOC).browse()->cursor(); __codnum = codnum; if (codnum.full()) diff --git a/ve/velib06a.cpp b/ve/velib06a.cpp index 58dcafee4..480fb0ba9 100755 --- a/ve/velib06a.cpp +++ b/ve/velib06a.cpp @@ -23,6 +23,7 @@ #include "ve0100n.h" #include "../cg/cg2103.h" +#include "../cg/cglib03.h" #include "../db/dblib.h" #include "../mg/mglib.h" #include "../db/dblib.h" @@ -303,16 +304,25 @@ bool data_hndl( TMask_field& field, KEY key ) TDocumento_mask& m = (TDocumento_mask &) field.mask(); if (field.to_check(key)) { - if (m.id2pos(F_DATAINSC) >= 0) + if (m.id2pos(F_DATAINSC) > 0) { TEdit_field & e = m.efield(F_DATAINSC); e.set_dirty(); e.on_hit(); } - if (m.id2pos(F_DATACAMBIO1) >= 0 && !m.get(F_CODVAL).empty()) + if (m.id2pos(F_DATACAMBIO1) > 0 && !m.get(F_CODVAL).empty()) m.set(F_DATACAMBIO1, field.get(), true); } + + // Abilita IVA per cassa su modifica o inizializzazione DATADOC + if (key == K_TAB && m.id2pos(F_IVAXCASSA) > 0) + { + TDate d = field.get(); + if (!d.ok()) d = TODAY; + m.enable(F_IVAXCASSA, gestione_IVAxCassa(d)); + } + if (key == K_ENTER || field.to_check(key)) { const TDate datadoc(m.get(F_DATADOC)); @@ -2526,6 +2536,16 @@ bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key) return true; } +bool TDocumento_mask::liqdiff_handler( TMask_field& f, KEY key ) +{ + if (key == K_ENTER && f.get().full()) + { + if (f.mask().get_bool(F_IVAXCASSA)) + return f.error_box(TR("Non è ammesso selezionare IVA per cassa e liquidazione differita")); + } + return true; +} + bool link_handler( TMask_field& f, KEY key ) { if (key == K_SPACE) diff --git a/ve/velib07.cpp b/ve/velib07.cpp index b9a755e64..27b5e068e 100755 --- a/ve/velib07.cpp +++ b/ve/velib07.cpp @@ -1,11 +1,11 @@ #include "velib07.h" -#include - #include "../cg/cgsaldac.h" #include "../cg/cglib02.h" #include "../db/dblib.h" +#include + /////////////////////////////////////////////////////////// // TMateriali_base_recordset ///////////////////////////////////////////////////////////