diff --git a/cd/test/fp1080.txt b/cd/test/fp1080.txt new file mode 100644 index 000000000..ea4e2ea00 --- /dev/null +++ b/cd/test/fp1080.txt @@ -0,0 +1,3 @@ +fp0.exe + +I clienti privati esteri ( Tipo allegato 5 o 9 e Stato CF) compilato non devono più avere codice fiacle e patita IVA compilati. diff --git a/cd/test/fp1080a.ini b/cd/test/fp1080a.ini new file mode 100644 index 000000000..d17bcd8a5 --- /dev/null +++ b/cd/test/fp1080a.ini @@ -0,0 +1,19 @@ +[Main] +Demo=0 + +[fp0] +File(0) = fp0.exe|X +Patch = 1080 +Versione = 21511200 + +[fp] +Data = 09-09-2021 +Descrizione = Fattura Elettronica +Dischi = 1 +Moduli = cg,ve +OEM = +Patch = 1080 +PostProcess = +PreProcess = +Versione = 21511200 + diff --git a/cd/test/fp1080a1.zip b/cd/test/fp1080a1.zip new file mode 100644 index 000000000..783697d90 Binary files /dev/null and b/cd/test/fp1080a1.zip differ diff --git a/src/fp/fplib01.cpp b/src/fp/fplib01.cpp index 83303c58e..47c20068c 100644 --- a/src/fp/fplib01.cpp +++ b/src/fp/fplib01.cpp @@ -935,11 +935,16 @@ bool TDoc_fp::check_initial(TDocumentoEsteso& doc) log(1, "Il codice destinatario ha una lunghezza non conforme."); ok = false; } - if (_rec_clifo.get(CLI_PAIV).empty() && _rec_clifo.get(CLI_COFI).empty()) + + const int alleg = _rec_clifo.get_int(CLI_ALLEG); + bool privato = (alleg == 5 || alleg == 9) && _rec_clifo.get(CLI_STATOCF).full(); + + if (_rec_clifo.get(CLI_PAIV).empty() && _rec_clifo.get(CLI_COFI).empty() && !privato) { log(1, "Sia la partita IVA che il codice fiscale del cessionario committente sono vuoti, almeno uno dei due deve essere valorizzato."); ok = false; } + TPagamento& pag = doc.pagamento(); if(pag.cond_pag_sdi().empty()) { diff --git a/src/ve/ve0100.cpp b/src/ve/ve0100.cpp index 1de962774..b893b128f 100755 --- a/src/ve/ve0100.cpp +++ b/src/ve/ve0100.cpp @@ -108,6 +108,15 @@ void TMotore_application::init_query_mode( TMask& m ) } } +bool TMotore_application::can_make_doc_def() +{ + static TToken_string __confirm_aut_users = "*"; + + if (__confirm_aut_users == "*") + __confirm_aut_users = ini_get_string(CONFIG_STUDIO, "VE", "AHUsers", ""); + return __confirm_aut_users.blank() || __confirm_aut_users.find(user()) >= 0; +} + void TMotore_application::init_insert_mode( TMask& m ) { TDocumento_mask& dm = (TDocumento_mask&)m; @@ -193,10 +202,16 @@ void TMotore_application::init_insert_mode( TMask& m ) dm.cli2mask(true); } - if (provv == 'P') + if (provv == 'P' && can_make_doc_def()) + { m.enable(DLG_CONFERMA); + m.show(DLG_CONFERMA); + } else + { m.disable(DLG_CONFERMA); + m.hide(DLG_CONFERMA); + } m.disable(DLG_PRINT); m.disable(DLG_PREVIEW); m.disable(DLG_EMAIL); @@ -226,22 +241,23 @@ void TMotore_application::init_modify_mode( TMask& m ) enable_menu_item(MENU_ITEM_ID(1)); if (provv == 'P') { - m.enable(DLG_CONFERMA); - m.disable(DLG_PRINT); + if (can_make_doc_def()) + { + m.enable(DLG_CONFERMA); + m.show(DLG_CONFERMA); + } m.disable(DLG_EMAIL); - m.disable(DLG_PREVIEW); - enable_menu_item(M_FILE_PRINT, false); - enable_menu_item(M_FILE_PREVIEW, false); } else { m.disable(DLG_CONFERMA); - m.enable(DLG_PRINT, enable_print); - m.enable(DLG_EMAIL, enable_print); - m.enable(DLG_PREVIEW, enable_print); - enable_menu_item(M_FILE_PRINT, enable_print); - enable_menu_item(M_FILE_PREVIEW, enable_print); + m.hide(DLG_CONFERMA); + m.enable(DLG_EMAIL, enable_print); } + m.enable(DLG_PRINT, enable_print); + m.enable(DLG_PREVIEW, enable_print); + enable_menu_item(M_FILE_PRINT, enable_print); + enable_menu_item(M_FILE_PREVIEW, enable_print); m.enable(DLG_ELABORA); m.disable(F_STATO); diff --git a/src/ve/ve0100.h b/src/ve/ve0100.h index bab5e9ad0..7e974e063 100755 --- a/src/ve/ve0100.h +++ b/src/ve/ve0100.h @@ -45,6 +45,7 @@ protected: virtual bool menu(MENU_TAG mt); virtual TMask* get_mask(int mode); virtual bool changing_mask(int mode); + bool can_make_doc_def(); virtual void init_query_mode(TMask& m); virtual void init_insert_mode(TMask& m); virtual void init_modify_mode(TMask& m); diff --git a/src/ve/velib03.cpp b/src/ve/velib03.cpp index 832dd57ef..607ebf603 100755 --- a/src/ve/velib03.cpp +++ b/src/ve/velib03.cpp @@ -478,8 +478,9 @@ real TDocumento::imponibile_bolli_esenti() const bool TDocumento::bolli_esenti_dovuti() const { const real impmin_bolli = ini_get_real(CONFIG_STUDIO, "ve", "IMPMINBOLLI"); + const real imponibile_esente = imponibile_bolli_esenti(); - return imponibile_bolli_esenti() >= impmin_bolli; + return imponibile_esente > ZERO && impmin_bolli > ZERO && imponibile_esente >= impmin_bolli; } real TDocumento::bolli(real & imp, int ndec, TTipo_importo t) const