Patch level : 12.0 1036
Files correlati : fp0.exe fp0100a.msk fp0300a.msk Commento : Aggiunto il regime speciale 3 al reverse charge
This commit is contained in:
		
							parent
							
								
									8db92bba96
								
							
						
					
					
						commit
						3b54d64097
					
				| @ -35,40 +35,40 @@ TParametri_mask::TParametri_mask(const char * n) : TAutomask(n) | ||||
| 
 | ||||
| void TParametri_mask::save_all() const | ||||
| { | ||||
| 	fp_settings().set_db_indirizzo(get(F_INDIRIZZO)); | ||||
| 	fp_settings().set_db_database(get(F_DATABASE)); | ||||
| 	fp_settings().set_db_user(get(F_USER)); | ||||
| 	fp_settings().set_db_password(get(F_PASSWORD)); | ||||
| 	fp_settings().set_fld_dest(get(F_FLDDEST)); | ||||
| 	fp_settings().set_fld_dest_usr(get(F_FLDUSRDEST)); | ||||
| 	fp_settings().set_cofi_tras(get(F_COFI)); | ||||
| 	fp_settings().set_gest_alleg(get_bool(F_ESPORTAALLEG)); | ||||
| 	fp_settings().set_allega_fat(get_bool(F_ESPORTADOC)); | ||||
| 	fp_settings().set_f8(get_bool(F_F8)); | ||||
| 	fp_settings().set_check_not_block(get_bool(F_CHECK_NOT_BLOCK)); | ||||
| 	fp_settings().set_no_sconti_fatt(get_bool(F_CHECK_NO_SCONTI)); | ||||
| 	fp_settings().set_no_export_pronto(get_bool(F_CHECK_NO_EXPORT_PRONTO)); | ||||
| 	fp_settings().set_data_start_fatt(get_date(F_STARTFATTEL)); | ||||
| 	fp_settings().set_data_start_new_fatt(get_date(F_STARTNEWFATT)); | ||||
| 	set_db_indirizzo(get(F_INDIRIZZO)); | ||||
| 	set_db_database(get(F_DATABASE)); | ||||
| 	set_db_user(get(F_USER)); | ||||
| 	set_db_password(get(F_PASSWORD)); | ||||
| 	set_fld_dest(get(F_FLDDEST)); | ||||
| 	set_fld_dest_usr(get(F_FLDUSRDEST)); | ||||
| 	set_cofi_tras(get(F_COFI)); | ||||
| 	set_gest_alleg(get_bool(F_ESPORTAALLEG)); | ||||
| 	set_allega_fat(get_bool(F_ESPORTADOC)); | ||||
| 	set_f8(get_bool(F_F8)); | ||||
| 	set_check_not_block(get_bool(F_CHECK_NOT_BLOCK)); | ||||
| 	set_no_sconti_fatt(get_bool(F_CHECK_NO_SCONTI)); | ||||
| 	set_no_export_pronto(get_bool(F_CHECK_NO_EXPORT_PRONTO)); | ||||
| 	set_data_start_fatt(get_date(F_STARTFATTEL)); | ||||
| 	set_data_start_new_fatt(get_date(F_STARTNEWFATT)); | ||||
| 	TFP_righe_custom().save_sheet(sfield(F_FORMPERS)); | ||||
| 	TFP_nota_piede_f().save_sheet(sfield(F_NPFSHEET)); | ||||
| } | ||||
| 
 | ||||
| void TParametri_mask::load_all() | ||||
| { | ||||
| 	set(F_INDIRIZZO, fp_settings().get_db_indirizzo()); | ||||
| 	set(F_DATABASE, fp_settings().get_db_database()); | ||||
| 	set(F_USER, fp_settings().get_db_user()); | ||||
| 	set(F_PASSWORD, fp_settings().get_db_password()); | ||||
| 	set(F_FLDDEST, fp_settings().get_fld_dest()); | ||||
| 	set(F_FLDUSRDEST, fp_settings().get_fld_dest_usr()); | ||||
| 	set(F_COFI, fp_settings().get_cofi_tras()); | ||||
| 	set(F_ESPORTAALLEG, fp_settings().get_gest_alleg()); | ||||
| 	set(F_ESPORTADOC, fp_settings().get_allega_fat()); | ||||
| 	set(F_F8, fp_settings().is_f8()); | ||||
| 	set(F_CHECK_NOT_BLOCK, fp_settings().get_check_not_block()); | ||||
| 	set(F_CHECK_NO_SCONTI, fp_settings().get_no_sconti_fatt()); | ||||
| 	set(F_CHECK_NO_EXPORT_PRONTO, fp_settings().get_no_export_pronto()); | ||||
| 	set(F_INDIRIZZO, get_db_indirizzo()); | ||||
| 	set(F_DATABASE, get_db_database()); | ||||
| 	set(F_USER, get_db_user()); | ||||
| 	set(F_PASSWORD, get_db_password()); | ||||
| 	set(F_FLDDEST, get_fld_dest()); | ||||
| 	set(F_FLDUSRDEST, get_fld_dest_usr()); | ||||
| 	set(F_COFI, get_cofi_tras()); | ||||
| 	set(F_ESPORTAALLEG, get_gest_alleg()); | ||||
| 	set(F_ESPORTADOC, get_allega_fat()); | ||||
| 	set(F_F8, is_f8()); | ||||
| 	set(F_CHECK_NOT_BLOCK, get_check_not_block()); | ||||
| 	set(F_CHECK_NO_SCONTI, get_no_sconti_fatt()); | ||||
| 	set(F_CHECK_NO_EXPORT_PRONTO, get_no_export_pronto()); | ||||
| 	TFP_righe_custom().load_sheet(sfield(F_FORMPERS)); | ||||
| 	TFP_nota_piede_f().load_sheet(sfield(F_NPFSHEET)); | ||||
| } | ||||
| @ -230,11 +230,11 @@ bool TParametri_mask::on_field_event(TOperable_field& o, TField_event e, long jo | ||||
| 	break; | ||||
| 	case F_STARTFATTEL: | ||||
| 		if (e == fe_init) | ||||
| 			o.set(fp_settings().get_data_start_fatt()); | ||||
| 			o.set(get_data_start_fatt()); | ||||
| 		break; | ||||
|   case F_STARTNEWFATT: | ||||
|     if (e == fe_init) | ||||
|       o.set(TFP_settings::get_date_start_new_fatt()); | ||||
|       o.set(get_date_start_new_fatt()); | ||||
| 	default: | ||||
| 		break; | ||||
| 	} | ||||
| @ -270,6 +270,7 @@ void TParametri_ditta::main_loop() | ||||
| 		ad << ip << "@" << db; | ||||
| 
 | ||||
| 		SSimple_query s(ad, usr, psw, TSDB_MSSQL); | ||||
| 
 | ||||
| 		if (s.sq_is_connect()) | ||||
| 		{ | ||||
| 			pm.save_all(); | ||||
|  | ||||
| @ -5,7 +5,7 @@ TOOLBAR "topbar" 0 0 0 2 | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| PAGE "Configurazione FP (1)" 0 2 0 0 | ||||
| PAGE "Parametri generali" 0 2 0 0 | ||||
| 
 | ||||
| GROUPBOX DLG_NULL 78 6 | ||||
| BEGIN | ||||
| @ -109,7 +109,7 @@ END | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| PAGE "Configurazione (2) " 0 2 0 0 | ||||
| PAGE "Personalizzazioni" 0 2 0 0 | ||||
| 
 | ||||
| SPREADSHEET F_FORMPERS 60 6 | ||||
| BEGIN | ||||
| @ -155,7 +155,7 @@ END | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| PAGE "Assistenza FP" 0 2 0 0 | ||||
| PAGE "Funzioni di assistenza" 0 2 0 0 | ||||
| 
 | ||||
| BUTTON F_SETPATCH 15 2 | ||||
| BEGIN | ||||
| @ -185,56 +185,56 @@ ENDPAGE | ||||
| 
 | ||||
| ENDMASK | ||||
| 
 | ||||
| PAGE "Elementi spredsheet" -1 -1 60 12 | ||||
| PAGE "Parametri tipi Documento" -1 -1 60 12 | ||||
| 
 | ||||
| STRING S_TIPODOC 4 | ||||
| STRING SC_TIPODOC 4 | ||||
| BEGIN | ||||
|   PROMPT 1 1  "Tipo doc " | ||||
|   HELP "Lasciare libero per tutti i tipo documento" | ||||
|   USE %TIP | ||||
|   SELECT S3[37,40]!="" | ||||
|   INPUT CODTAB S_TIPODOC | ||||
|   INPUT CODTAB SC_TIPODOC | ||||
|   DISPLAY "Codice@10" CODTAB | ||||
|   DISPLAY "Descrizione@50" S0 | ||||
|   DISPLAY "Tipo SDI@10" S3[37,40] | ||||
|   OUTPUT S_TIPODOC CODTAB | ||||
|   OUTPUT SC_TIPODOC CODTAB | ||||
|   FLAG "UPA" | ||||
| END | ||||
| 
 | ||||
| STRING S_TIPORIGA 4 | ||||
| STRING SC_TIPORIGA 4 | ||||
| BEGIN | ||||
| 	PROMPT 1 2  "Tipo riga " | ||||
| 	USE %TRI | ||||
| 	INPUT CODTAB S_TIPORIGA | ||||
| 	INPUT CODTAB SC_TIPORIGA | ||||
| 	DISPLAY "Codice@10" CODTAB | ||||
| 	DISPLAY "Descrizione@50" S0 | ||||
| 	OUTPUT S_TIPORIGA CODTAB | ||||
| 	OUTPUT SC_TIPORIGA CODTAB | ||||
| 	CHECKTYPE REQUIRED | ||||
| END | ||||
| 
 | ||||
| STRING S_QTA 10 | ||||
| STRING SC_QTA 10 | ||||
| BEGIN | ||||
| 	PROMPT 1 3 "Qta" | ||||
| END | ||||
| 
 | ||||
| STRING S_PREZZO 10 | ||||
| STRING SC_PREZZO 10 | ||||
| BEGIN | ||||
| 	PROMPT 1 4 "Prezzo" | ||||
| 	USE %FRR | ||||
| 	INPUT CODTAB S_PREZZO | ||||
| 	INPUT CODTAB SC_PREZZO | ||||
| 	DISPLAY "Codice@10" CODTAB | ||||
| 	DISPLAY "Descrizione@50" S0 | ||||
| 	OUTPUT S_PREZZO CODTAB | ||||
| 	OUTPUT SC_PREZZO CODTAB | ||||
| END | ||||
| 
 | ||||
| STRING S_IMPONIBILE 10 | ||||
| STRING SC_IMPONIBILE 10 | ||||
| BEGIN | ||||
| 	PROMPT 1 5 "Imponibile" | ||||
| 	USE %FRR | ||||
| 	INPUT CODTAB S_IMPONIBILE | ||||
| 	INPUT CODTAB SC_IMPONIBILE | ||||
| 	DISPLAY "Codice" CODTAB | ||||
| 	DISPLAY "Descrizione@50" S0 | ||||
| 	OUTPUT S_IMPONIBILE CODTAB | ||||
| 	OUTPUT SC_IMPONIBILE CODTAB | ||||
| END | ||||
| 
 | ||||
| ENDPAGE | ||||
| @ -259,17 +259,17 @@ ENDMASK | ||||
| 
 | ||||
| PAGE "Elementi NPF" -1 -1 60 12 | ||||
| 
 | ||||
| STRING S_DOC 4 | ||||
| STRING S_DOCPF 4 | ||||
| BEGIN | ||||
| 	PROMPT 1 1  "Tipo doc " | ||||
|   HELP "Lasciare libero per tutti i tipo documento" | ||||
|   USE %TIP | ||||
|   SELECT S3[37,40]!="" | ||||
|   INPUT CODTAB S_TIPODOC | ||||
|   INPUT CODTAB S_DOCPF | ||||
|   DISPLAY "Codice@10" CODTAB | ||||
|   DISPLAY "Descrizione@50" S0 | ||||
|   DISPLAY "Tipo SDI@10" S3[37,40] | ||||
|   OUTPUT S_TIPODOC CODTAB | ||||
|   OUTPUT S_DOCPF CODTAB | ||||
|   FLAG "UPA" | ||||
| END | ||||
| 
 | ||||
|  | ||||
| @ -176,11 +176,11 @@ void TCC_mask::save_all() | ||||
| 
 | ||||
| 			cfven.zero(); | ||||
| 			cfven.put(CFV_TIPOCF, get(F_TIPOCF)); | ||||
| 			cfven.put(CFV_CODCF, riga->get(xvtil_cid2index(S_CODCF))); | ||||
| 			cfven.put(CFV_CODCF, riga->get(cid2index(S_CODCF))); | ||||
| 			const int err = cfven.read(); | ||||
| 			if (err == NOERR || err == _iskeynotfound) | ||||
| 			{ | ||||
| 				cfven.put(CFV_PADESTIN, riga->get(xvtil_cid2index(S_CODSDI))); | ||||
| 				cfven.put(CFV_PADESTIN, riga->get(cid2index(S_CODSDI))); | ||||
| 				if (cfven.rewrite_write() != NOERR) | ||||
| 				{ | ||||
| 					TString msg = "Fallito salvataggio record in CFVEN "; | ||||
|  | ||||
| @ -56,7 +56,7 @@ public: | ||||
| 		disable(DLG_SAVEREC); | ||||
| 		disable(DLG_FINDREC); | ||||
| 		load_all_fields(); | ||||
| 		const TDate data_inizio = fp_settings().get_date_start_new_fatt(); | ||||
| 		const TDate data_inizio = get_date_start_new_fatt(); | ||||
| 
 | ||||
| 		if (today < data_inizio) | ||||
| 		{ | ||||
| @ -82,9 +82,10 @@ void TPA_mask::save_all_fields() const | ||||
| 	selected_docs.save_sheet(sfield(F_DOCUMENTI_TIPO)); | ||||
| 
 | ||||
| 	// Salvo le impostazioni
 | ||||
| 	fp_settings().set_esp_pri_empty(get_bool(F_SETDEFCOD)); | ||||
| 	fp_settings().set_esp_est(get_bool(F_SETCODEST)); | ||||
| 	fp_settings().set_esp_est_cod(get(F_VALCODEST)); | ||||
| 	set_esp_pri_empty(get_bool(F_SETDEFCOD)); | ||||
|   set_send_all_rifs(get_bool(F_SENDALLRIFS)); | ||||
| 	set_esp_est(get_bool(F_SETCODEST)); | ||||
| 	set_esp_est_cod(get(F_VALCODEST)); | ||||
| } | ||||
| 
 | ||||
| void TPA_mask::force_reload_sheet() | ||||
| @ -143,9 +144,10 @@ void TPA_mask::load_all_fields() | ||||
| 	sheet.force_update(); | ||||
| 	sheet.show(); | ||||
| 
 | ||||
| 	set(F_SETDEFCOD, fp_settings().get_esp_pri_empty()); | ||||
| 	set(F_SETCODEST, fp_settings().get_esp_est()); | ||||
| 	set(F_VALCODEST, fp_settings().get_esp_est_cod()); | ||||
| 	set(F_SETDEFCOD, get_esp_pri_empty()); | ||||
|   set(F_SENDALLRIFS, get_send_all_rifs());  | ||||
|   set(F_SETCODEST, get_esp_est()); | ||||
| 	set(F_VALCODEST, get_esp_est_cod()); | ||||
| } | ||||
| 
 | ||||
| void TPA_mask::fill() | ||||
| @ -164,7 +166,7 @@ void TPA_mask::fill() | ||||
| 	TString filter_selected		  = get(F_FATTSEL); | ||||
| 
 | ||||
| 	enable(DLG_OK, filter_selected.empty() || filter_selected == "E"); | ||||
| 	enable(DLG_SAVEREC, (fp_settings().is_f8() && filter_selected == "X") || filter_selected == "D"); | ||||
| 	enable(DLG_SAVEREC, (is_f8() && filter_selected == "X") || filter_selected == "D"); | ||||
| 	enable(DLG_FINDREC, filter_selected == "D"); | ||||
| 	enable(DLG_PRINT, _enable_chiave_fixer && filter_selected.empty()); | ||||
| 
 | ||||
| @ -193,8 +195,8 @@ void TPA_mask::fill() | ||||
| 	int fat_no_cod = 0; | ||||
| 
 | ||||
| 	// Disabilito la colonna del codice ufficio
 | ||||
| 	docs.enable_column(docs.cid2index(S_UFFICIO), false); | ||||
| 	const TDate data_inizio = fp_settings().get_date_start_new_fatt(); | ||||
| 	docs.enable_column(cid2index(S_UFFICIO), false); | ||||
| 	const TDate data_inizio = get_date_start_new_fatt(); | ||||
| 
 | ||||
| 	for (bool okc = rec.move_first(); okc; okc = rec.move_next()) | ||||
| 	{ | ||||
| @ -331,6 +333,7 @@ void TPA_mask::connect_keys() | ||||
| 		warning_box("Impossibile allineare le chiavi di uno sheet vuoto!"); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	TProgress_monitor pi(sht.items(), "Esportazione Fatture"); | ||||
| 	FOR_EACH_ARRAY_ROW(sht, r, riga) | ||||
| 	{ | ||||
| @ -445,6 +448,7 @@ void TPA_mask::export_paf() | ||||
| 	static const int col_cod_sdi = sfield(F_DOCS).cid2index(S_CODSDI); | ||||
| 	TString_array& sht = sfield(F_DOCS).rows_array(); | ||||
| 	TDoc_fp elab; | ||||
| 
 | ||||
| 	//elab.set_cache_insert(true);
 | ||||
| 	if (!sht.empty()) | ||||
| 	{ | ||||
| @ -661,6 +665,7 @@ void TPA_mask::set_err_paf() | ||||
| 	if (!sht.empty()) | ||||
| 	{ | ||||
| 		TProgress_monitor pi(sht.items(), "Cambio stato fatture"); | ||||
| 
 | ||||
| 		FOR_EACH_ARRAY_ROW(sht, r, riga) | ||||
| 		{ | ||||
| 			if (!pi.add_status()) | ||||
|  | ||||
| @ -5,9 +5,11 @@ | ||||
| #define F_SETDEFCOD			404 | ||||
| #define F_SETCODEST			405 | ||||
| #define F_VALCODEST			406 | ||||
| #define F_SENDALLRIFS		407 | ||||
| #define END_MASK				499 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #define F_DOCUMENTI_TIPO 301 | ||||
| 
 | ||||
| #define S_SELCODNUM   101 | ||||
|  | ||||
| @ -83,7 +83,7 @@ BEGIN | ||||
|   ITEM "Tipo SDI" | ||||
| END | ||||
| 
 | ||||
| GROUPBOX DLG_NULL 78 4 | ||||
| GROUPBOX DLG_NULL 78 5 | ||||
| BEGIN | ||||
|   PROMPT 1 12 "@BConfigurazione Esportazione" | ||||
| END | ||||
| @ -94,16 +94,21 @@ BEGIN | ||||
|   PROMPT 2 13 "Esporta privati con codice '0000000' se privi sia di pec che di cod. destinatario" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_SENDALLRIFS | ||||
| BEGIN | ||||
|   PROMPT 2 14 "Esporta tutti i dati dei documenti di riferimento" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_SETCODEST | ||||
| BEGIN | ||||
|   PROMPT 2 14 "Esporta esteri con codice" | ||||
|   PROMPT 2 15 "Esporta esteri con codice" | ||||
|   MESSAGE TRUE ENABLE,F_VALCODEST | ||||
|   MESSAGE FALSE DISABLE,F_VALCODEST | ||||
| END | ||||
| 
 | ||||
| STRING F_VALCODEST 7 | ||||
| BEGIN | ||||
|   PROMPT 40 14 "" | ||||
|   PROMPT 40 15 "" | ||||
|   CHECKTYPE REQUIRED | ||||
|   FLAG "D" | ||||
| END | ||||
|  | ||||
							
								
								
									
										119
									
								
								src/fp/fplib.h
									
									
									
									
									
								
							
							
						
						
									
										119
									
								
								src/fp/fplib.h
									
									
									
									
									
								
							| @ -10,7 +10,7 @@ | ||||
| #include <reputils.h> | ||||
| #include <vector> | ||||
| #include <memory> | ||||
| #include "cglib.h" | ||||
| #include "../cg/cglib.h" | ||||
| #include <map> | ||||
| 
 | ||||
| #define SQL_FLD				"sql/" | ||||
| @ -32,6 +32,8 @@ bool run_fp_psw_mask(); | ||||
| bool check_tables(); | ||||
| // Compila il numero di documento per la scrittura sui paf
 | ||||
| TString& complete_num_fp(const TCodice_numerazione& codnum, const int numdoc); | ||||
| 
 | ||||
| 
 | ||||
| // Genera la chiave per i paf
 | ||||
| bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt); | ||||
| bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt); | ||||
| @ -130,72 +132,61 @@ public: | ||||
| 	TFP_nota_piede_f(); | ||||
| }; | ||||
| 
 | ||||
| class TFP_settings : public TObject | ||||
| { | ||||
| public: | ||||
| 	// Getters
 | ||||
| 	const TString& get_db_indirizzo() const; | ||||
| 	const TString& get_db_database() const; | ||||
| 	const TString& get_db_str_con() const; | ||||
| 	const TString& get_db_user() const; | ||||
| 	const TString& get_db_password() const; | ||||
| 	const TString& get_fld_dest() const; | ||||
| 	const TString& get_fld_dest_usr() const; | ||||
| 	const TString& get_cofi_tras() const; | ||||
| 	const TString& get_data_start_fatt() const; | ||||
| 	const bool get_gest_alleg() const; | ||||
| 	const bool get_allega_fat() const; | ||||
| 	const bool get_esp_pri_empty() const; | ||||
| 	const bool get_esp_est() const; | ||||
| 	const TString& get_esp_est_cod() const; | ||||
| 	const bool is_f8() const; | ||||
| 	const bool get_check_not_block() const; | ||||
| 	const TString& get_body_mail(int idx = -1) const; | ||||
| 	const TString& get_npf(const char* tipodoc, int idx) const; | ||||
| 	const bool get_no_sconti_fatt() const; | ||||
| 	bool get_no_export_pronto() const; | ||||
| 	// Get tipidoc per NotaPiedeFattura
 | ||||
| 	const TString get_npf_tipodoc(int indx) const; | ||||
|   static TDate get_date_start_new_fatt(); | ||||
| // TFP_settings functions
 | ||||
| const TString& get_db_indirizzo(); | ||||
| const TString& get_db_database(); | ||||
| const TString& get_db_str_con(); | ||||
| const TString& get_db_user(); | ||||
| const TString& get_db_password(); | ||||
| const TString& get_fld_dest(); | ||||
| const TString& get_fld_dest_usr(); | ||||
| const TString& get_cofi_tras(); | ||||
| const TDate get_data_start_fatt(); | ||||
| const bool get_gest_alleg(); | ||||
| const bool get_allega_fat(); | ||||
| const bool get_esp_pri_empty(); | ||||
| const bool get_send_all_rifs(); | ||||
| const bool get_esp_est(); | ||||
| const TString& get_esp_est_cod(); | ||||
| const bool is_f8(); | ||||
| const bool get_check_not_block(); | ||||
| const TString& get_body_mail(int idx = -1); | ||||
| const TString& get_npf(const char* tipodoc, int idx); | ||||
| const bool get_no_sconti_fatt(); | ||||
| bool get_no_export_pronto(); | ||||
| // Get tipidoc per NotaPiedeFattura
 | ||||
| const TString & get_npf_tipodoc(int indx); | ||||
| TDate get_date_start_new_fatt(); | ||||
| 
 | ||||
| 	// Setters
 | ||||
| 	void set_db_indirizzo(const TString& ind) const; | ||||
| 	void set_db_database(const TString& db) const; | ||||
| 	void set_db_user(const TString& usr) const; | ||||
| 	void set_db_password(const TString& psw) const; | ||||
| 	void set_fld_dest(const TString& fld_dest) const; | ||||
| 	void set_fld_dest_usr(const TString& fld_dest_usr) const; | ||||
| 	void set_cofi_tras(const TString& cofi) const; | ||||
| 	void set_gest_alleg(bool gest_alleg) const; | ||||
| 	void set_allega_fat(bool allega_fatt) const; | ||||
| 	void set_esp_pri_empty(bool esp_pri) const; | ||||
| 	void set_esp_est(bool esp_est) const; | ||||
| 	void set_esp_est_cod(const TString& esp_est_cod) const; | ||||
| 	void set_f8(bool f8) const; | ||||
| 	void set_check_not_block(bool not_block) const; | ||||
| 	void set_body_mail(const char* msg, int idx = -1) const; | ||||
| 	void set_no_sconti_fatt(const bool no_sconti_fatt) const; | ||||
| 	void set_no_export_pronto(const bool no_export_pronto) const; | ||||
| 	void set_data_start_fatt(const char* date) const; | ||||
| 	void set_data_start_new_fatt(const char* date) const; | ||||
| // Setters
 | ||||
| void set_db_indirizzo(const TString& ind); | ||||
| void set_db_database(const TString& db); | ||||
| void set_db_user(const TString& usr); | ||||
| void set_db_password(const TString& psw); | ||||
| void set_fld_dest(const TString& fld_dest); | ||||
| void set_fld_dest_usr(const TString& fld_dest_usr); | ||||
| void set_cofi_tras(const TString& cofi); | ||||
| void set_gest_alleg(bool gest_alleg); | ||||
| void set_allega_fat(bool allega_fatt); | ||||
| void set_esp_pri_empty(bool esp_pri); | ||||
| void set_send_all_rifs(bool send_all_rifs); | ||||
| void set_esp_est(bool esp_est); | ||||
| void set_esp_est_cod(const TString& esp_est_cod); | ||||
| void set_f8(bool f8); | ||||
| void set_check_not_block(bool not_block); | ||||
| void set_body_mail(const char* msg, int idx = -1); | ||||
| void set_no_sconti_fatt(const bool no_sconti_fatt); | ||||
| void set_no_export_pronto(const bool no_export_pronto); | ||||
| void set_data_start_fatt(const char* date); | ||||
| void set_data_start_new_fatt(const char* date); | ||||
| 
 | ||||
| 	void set_npf(const char * tipodoc, const char* msg, int idx) const; | ||||
| 	void set_npf_tipodoc(const TString& tipodoc, int indx) const; | ||||
| void set_npf(const char * tipodoc, const char* msg, int idx); | ||||
| void set_npf_tipodoc(const TString& tipodoc, int indx); | ||||
| 
 | ||||
| 	void remove_para_ini(int idx); | ||||
| 	void remove_npf_ini(const char* tipodoc, int idx); | ||||
| 	void remove_tipodoc_npf(int idx) const; | ||||
| }; | ||||
| void remove_para_ini(int idx); | ||||
| void remove_npf_ini(const char* tipodoc, int idx); | ||||
| void remove_tipodoc_npf(int idx); | ||||
| 
 | ||||
| inline TFP_settings& fp_settings() | ||||
| { | ||||
| 	static TFP_settings* erbuggo = nullptr; | ||||
| 	if(erbuggo == nullptr) | ||||
| 	{ | ||||
| 		erbuggo = new TFP_settings(); | ||||
| 	} | ||||
| 	return *erbuggo; | ||||
| } | ||||
| 
 | ||||
| // Mannaggia il fruttivendolo
 | ||||
| class TFP_righe_custom : public TObject | ||||
| @ -567,8 +558,8 @@ public: | ||||
| 	int force_commit(); | ||||
| 	void set_cache_insert(const bool v) { _cache_insert = v; } | ||||
| 	bool tracciati_2021() const { return _tracciati_2021; } | ||||
| 
 | ||||
| 	TDoc_fp(); | ||||
| 	~TDoc_fp(); | ||||
| }; | ||||
| 
 | ||||
| #endif // __FPLIB_H
 | ||||
|  | ||||
| @ -15,8 +15,10 @@ | ||||
| #include <cfven.h> | ||||
| #include <nditte.h> | ||||
| #include <unloc.h> | ||||
| #include <indsp.h> | ||||
| #include "../cg/cfban.h" | ||||
| #include <modaut.h> | ||||
| #include <netutils.h> | ||||
| #include <urldefid.h> | ||||
| #include "../li/letint.h" | ||||
| 
 | ||||
| @ -38,6 +40,7 @@ bool set_connection(SSimple_query& s) | ||||
| SSimple_query& fp_db() | ||||
| { | ||||
| 	static SSimple_query* db = nullptr; | ||||
| 
 | ||||
| 	if (db == nullptr) | ||||
| 	{ | ||||
| 		db = new SSimple_query(); | ||||
| @ -50,24 +53,18 @@ SSimple_query& fp_db() | ||||
| 
 | ||||
| bool run_fp_psw_mask() | ||||
| { | ||||
| 	static TMask* m; | ||||
| 	// Cancello la maschera se esiste
 | ||||
| 	delete m; | ||||
| 	m = new TMask("Password", 1, 30, 5); | ||||
| 	m->add_button_tool(DLG_OK, "~Conferma", TOOL_OK); | ||||
| 	m->add_button_tool(DLG_CANCEL, "Annulla", TOOL_CANCEL); | ||||
| 	m->add_string(101, 0, "Password ", 1, 1, 15, "*"); | ||||
| 	m->field(101).check_type(CHECK_REQUIRED); | ||||
| 	while (m->run() == K_ENTER) | ||||
| 	{ | ||||
| 		if (m->get(101) == "sirioFATT99")	// Hardcoded password are the best!
 | ||||
| 	TMask m("Password", 1, 30, 5); | ||||
| 	 | ||||
| 	m.add_button_tool(DLG_OK, "~Conferma", TOOL_OK); | ||||
| 	m.add_button_tool(DLG_CANCEL, "Annulla", TOOL_CANCEL); | ||||
| 	m.add_string(101, 0, "Password ", 1, 1, 15, "*"); | ||||
| 	m.field(101).check_type(CHECK_REQUIRED); | ||||
| 	while (m.run() == K_ENTER) | ||||
| 	{ | ||||
| 		if (m.get(101) == "sirioFATT99")	// Hardcoded password are the best!
 | ||||
| 			return true; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			error_box("Password errata"); | ||||
| 		} | ||||
| 			return error_box("Password errata"); | ||||
| 	} | ||||
| 	return false; | ||||
| } | ||||
| @ -95,6 +92,7 @@ bool check_tables() | ||||
| 	{ | ||||
| 		TString file_version = TFilename(file->str).name_only(); | ||||
| 		file_version = file_version.mid(2, 4); | ||||
| 
 | ||||
| 		if (file_version <= version) | ||||
| 			continue; | ||||
| 		ifstream f(file->str); | ||||
| @ -154,10 +152,12 @@ TString& complete_num_fp(const TCodice_numerazione& codnum, const int numdoc) | ||||
| 	ret << prefisso << ndoc << postfisso; | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
| * HFATT: tipocf(1) + codcf(6) | ||||
| * BFATT: datadoc(8) + tipodoc_SDI(4) + numdoc(7) | ||||
| */ | ||||
| 
 | ||||
| // Crea la coppia di chiavi per il db PAF a partire da un documento vero e proprio
 | ||||
| bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt) | ||||
| { | ||||
| @ -172,6 +172,7 @@ bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt) | ||||
| 		bfatt.cut(0) << doc.get_date(DOC_DATADOC).date2ansi() << '_' << tipo_doc_sdi(doc) << '_' << complete_num_fp(codnum, doc.numero()); | ||||
| 		return hfatt.full() && bfatt.full(); | ||||
| } | ||||
| 
 | ||||
| // Crea la coppia di chiavi per il db PAF a partire da un semplice record di testata documento
 | ||||
| bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt) | ||||
| { | ||||
| @ -207,12 +208,12 @@ bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString& | ||||
| 	const TAnagrafica anag(LF_CLIFO, tipocf, codcf); | ||||
| 	if (coddest.empty()) | ||||
| 	{ | ||||
| 		if (pec.full() || fp_settings().get_esp_pri_empty()) | ||||
| 		if (pec.full() || get_esp_pri_empty()) | ||||
| 			coddest = "0000000"; | ||||
| 		// Controllo se è straniero
 | ||||
| 		else if (anag.estero() && anag.stato_partita_IVA() != "IT") | ||||
| 		{ | ||||
| 			coddest = fp_settings().get_esp_est() ? fp_settings().get_esp_est_cod() : ""; | ||||
| 			coddest = get_esp_est() ? get_esp_est_cod() : ""; | ||||
| 		} | ||||
| 	} | ||||
| 	else | ||||
| @ -1011,25 +1012,18 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc) | ||||
| 		return false; | ||||
| 	// Preparo il log
 | ||||
| 	log(-1, _bfatt); | ||||
| #ifndef  DBG | ||||
| 	// Controllo se il documento è almeno in stato di stampa
 | ||||
| 	if (doc.stato() < doc.tipo().stato_finale_stampa()) | ||||
| 	{ | ||||
| 		log(3, "Il documento non e' stato ancora stampato, verra' saltato"); | ||||
| 		return false; | ||||
| 	} | ||||
| #endif | ||||
| #ifndef DBG | ||||
| 	_is_pa = doc.clifor().get_int("ALLEG") == 7; | ||||
| 	if (!get_coddest(doc.clifor().tipo(), doc.clifor().codice(), _coddest, _pec, doc.get(DOC_CODINDSP))) | ||||
| 	if (!doc.get_coddest(_coddest, _pec)) | ||||
| 	{ | ||||
| 		log(1, "Impossibile trovare il codice destinatario per la fattura"); | ||||
| 		return false; | ||||
| 	} | ||||
| #else | ||||
| 	_is_pa = false; | ||||
| 	_coddest = "M5ITOJA"; | ||||
| #endif | ||||
| 	_enapec = _coddest == "0000000" && _pec.full(); | ||||
| 	_privato = _coddest.len() != 6; | ||||
| 	_caus = TCausale(doc.tipo().causale(), doc.anno()); | ||||
| @ -1046,7 +1040,7 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc) | ||||
| 	_idx_cassa_previdenziale = 1; | ||||
| 	// Controllo custom
 | ||||
| 	_has_cust = cached_custom_fp().has_custom(doc); | ||||
| 	if(check_initial(doc) || fp_settings().get_check_not_block()) | ||||
| 	if(check_initial(doc) || get_check_not_block()) | ||||
| 	{ | ||||
| 		return _paf_container.clean_and_erase_paf(_hfatt, _bfatt); | ||||
| 	} | ||||
| @ -1124,7 +1118,7 @@ int TDoc_fp::commit() | ||||
| 	if (_to_commit) | ||||
| 	{ | ||||
| 		// Controllo stato diagnosticato
 | ||||
| 		if (!fp_settings().get_no_export_pronto()) | ||||
| 		if (!get_no_export_pronto()) | ||||
| 		{ | ||||
| 			if (fp_db().sq_set_exec("UPDATE PAF0100F SET P1_GESTIONE = 'P' WHERE P1_GESTIONE = 'D'")) | ||||
| 			{ | ||||
| @ -1495,7 +1489,7 @@ void TDoc_fp::fill_buoni(map<TString20, TFPBuono_di_consegna>& buoni, const TStr | ||||
|     else  // Ultima riga
 | ||||
|     { | ||||
|       TToken_string b(memo, '\n'); | ||||
|       // "Buono di consegna  n. 1997 del 10-10-2019"
 | ||||
| 
 | ||||
|       for (int i = 0; i < b.items(); ++i) | ||||
|       { | ||||
|         TToken_string str(b.get(i), ' '); | ||||
| @ -1516,9 +1510,9 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
| 	bool ok = true; | ||||
| 	 | ||||
| 	ok &= export_paf0100f(); | ||||
| #ifndef DBG | ||||
| 
 | ||||
| 	ok &= export_paf3200f(); | ||||
| #endif | ||||
| 
 | ||||
| 	 | ||||
| 	// <CedentePrestatore>
 | ||||
| 	TPaf_record& paf0200f = _paf_container.get_paf("PAF0200F"); | ||||
| @ -1578,6 +1572,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
| 		if (_ditta.giuridica()) | ||||
| 		{ | ||||
| 			TISAM_recordset anagiu("USE ANAGIU\nFROM CODANAGR=#CODICE\nTO CODANAGR=#CODICE"); | ||||
| 			 | ||||
|       anagiu.set_var("#CODICE", get_firm().get(NDT_CODANAGR)); | ||||
| 			if (anagiu.move_first()) | ||||
| 			{ | ||||
| @ -1723,7 +1718,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
| 	paf2700f.set("PQ_GESTIONE", "D"); | ||||
| 	ok &= insert(paf2700f); | ||||
|   //   <DatiOrdineAcquisto>
 | ||||
|   if(doc.is_nota_credito() && doc.get(DOC_NUMDOCRIF).full()) | ||||
|   if((doc.is_nota_credito() || get_send_all_rifs()) && doc.get(DOC_NUMDOCRIF).full()) | ||||
|   { | ||||
|     TPaf_record& paf1400f = _paf_container.get_paf("PAF1400F"); | ||||
|     reset(paf1400f); | ||||
| @ -1867,7 +1862,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
| 	FOR_EACH_PHYSICAL_FPRDOC(doc, r, rdoc) | ||||
| 	{ | ||||
| 		// Controllo la riga
 | ||||
| 		if (check_row(*rdoc) && !fp_settings().get_check_not_block()) | ||||
| 		if (check_row(*rdoc) && !get_check_not_block()) | ||||
| 			return false; | ||||
| 		_idx_adg_doc_row = 1L; | ||||
| 		bool      skip_riga = false; | ||||
| @ -1912,7 +1907,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
| 					log(1, msg); | ||||
| 			} | ||||
| 			set_qta_prezzo(paf1800f, rdoc); | ||||
|       if (rdoc->iva().codice().empty()) | ||||
| 			if(rdoc->iva().codice().empty()) | ||||
| 			{ | ||||
| 				set_IVA(_codivadefault, paf1800f); | ||||
| 			} | ||||
| @ -1930,11 +1925,13 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
|       if (!riftesta) | ||||
|       { | ||||
|         TArray ancestors; | ||||
| 
 | ||||
|         find_ancestors(*rdoc, ancestors); | ||||
|         for (int i = ancestors.last(); i > 0; i = ancestors.pred(i)) | ||||
|         { | ||||
|           _has_bolla |= true; | ||||
|           const TAncestor& a = dynamic_cast<const TAncestor&>(ancestors[i]); | ||||
| 
 | ||||
|           ancestors_s.insert({ a._numdoc, a._datadoc });       // Per i buoni di consegna lavanderie
 | ||||
|           if (i == 1) | ||||
|           { | ||||
| @ -2080,10 +2077,9 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
| 			ok &= insert(paf2100f); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 
 | ||||
| 			// Salto tutte le altre righe
 | ||||
| 			continue; | ||||
| 		} | ||||
| 		// <ScontoMaggiorazione>
 | ||||
| 		TString80 sconto_expr = rdoc->get(RDOC_SCONTO); | ||||
| 		TToken_string sconti; | ||||
| @ -2131,6 +2127,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
|   if (!riftesta && f_buonocons) | ||||
|   { | ||||
|     TString& memo = riga_buoni_cons; | ||||
| 
 | ||||
|     if (memo.full()) | ||||
|     { | ||||
|       map<TString20, TFPBuono_di_consegna> buoni; | ||||
| @ -2347,7 +2344,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
| 	for(TObject* itm = tiva.first_item(); itm != nullptr; itm = tiva.succ_item()) | ||||
| 	{ | ||||
| 		const TRiepilogo_iva& riva = *dynamic_cast<const TRiepilogo_iva*>(itm); | ||||
| 		if (!check_riepilogo(doc, riva) && !fp_settings().get_check_not_block()) | ||||
| 		if (!check_riepilogo(doc, riva) && !get_check_not_block()) | ||||
| 			return false; | ||||
| 		add_riepilogo_iva(paf2200f, riva.cod_iva(), eiva, riva.imponibile(), riva.imposta()); | ||||
| 	} | ||||
| @ -2412,6 +2409,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) | ||||
| 		long      nprogr = 0; // Numero di file allegati
 | ||||
| 		// Se abilitato stampo il documento e lo allego
 | ||||
| 		TFilename rep; | ||||
| 
 | ||||
| 		if (_allegafattura) | ||||
| 		{ | ||||
| 			if (!dongle().active(RSAUT)) | ||||
| @ -2518,10 +2516,12 @@ bool TDoc_fp::doc_to_paf(const TRectype& rec) | ||||
| 		} | ||||
| 		return false; | ||||
| } | ||||
| 
 | ||||
| bool TDoc_fp::doc_to_paf(const TDoc_key& key) | ||||
| { | ||||
| 		return doc_to_paf(key_to_doc(key)); | ||||
| } | ||||
| 
 | ||||
| bool TDoc_fp::doc_to_paf(const TFilename& ini) | ||||
| { | ||||
| 		TConfig             cfg(ini, "33"); | ||||
| @ -2531,10 +2531,12 @@ bool TDoc_fp::doc_to_paf(const TFilename& ini) | ||||
| 		const TDoc_key      key(anno, codnum, ndoc); | ||||
| 		return doc_to_paf(key); | ||||
| } | ||||
| 
 | ||||
| bool TDoc_fp::doc_to_paf() | ||||
| { | ||||
| 	return _doc_rec != nullptr ? doc_to_paf(*_doc_rec) : false; | ||||
| } | ||||
| 
 | ||||
| TRectype& TDoc_fp::key_to_doc(const TDoc_key& key) | ||||
| { | ||||
| 	if(_doc_rec != nullptr) | ||||
| @ -2549,23 +2551,19 @@ TRectype& TDoc_fp::key_to_doc(const TDoc_key& key) | ||||
| TDoc_fp::TDoc_fp() : _doc_rec(nullptr), _log(nullptr), _cache_insert(false) | ||||
| { | ||||
| 	_ditta.init(LF_NDITTE, prefix().get_codditta()); | ||||
| 	_cofi = fp_settings().get_cofi_tras(); | ||||
| 	const TDate data_inizio = fp_settings().get_date_start_new_fatt(); | ||||
| 	_cofi = get_cofi_tras(); | ||||
| 	const TDate data_inizio = get_date_start_new_fatt(); | ||||
| 	_tracciati_2021 = (data_inizio <= today);	 | ||||
| 	if (_cofi.blank()) | ||||
| 		_cofi = _ditta.codice_fiscale(); | ||||
| #ifdef DBG | ||||
| 	_gestioneallegati = _allegafattura = false; | ||||
| #else | ||||
| 	_gestioneallegati = fp_settings().get_gest_alleg(); | ||||
| 	_allegafattura = fp_settings().get_allega_fat(); | ||||
| #endif | ||||
| 	_def_fld = fp_settings().get_fld_dest(); | ||||
| 	_gestioneallegati = get_gest_alleg(); | ||||
| 	_allegafattura = get_allega_fat(); | ||||
| 	_def_fld = get_fld_dest(); | ||||
| 	if (!_def_fld.ends_with("\\")) | ||||
| 	{ | ||||
| 		_def_fld << "\\"; | ||||
| 	} | ||||
| 	_def_usr_fld = fp_settings().get_fld_dest_usr(); | ||||
| 	_def_usr_fld = get_fld_dest_usr(); | ||||
| 	if (_def_usr_fld.empty()) | ||||
| 	{ | ||||
| 		_def_usr_fld = _def_fld; | ||||
| @ -2578,8 +2576,9 @@ TDoc_fp::TDoc_fp() : _doc_rec(nullptr), _log(nullptr), _cache_insert(false) | ||||
| 	_conai_str = ini_get_string(CONFIG_DITTA, "ve", "DESCCONAIASS"); | ||||
| 	if (_conai_str.empty()) | ||||
| 		_conai_str = "Contributo CONAI assolto ove dovuto"; | ||||
| 	_nascondi_sconti_righe_fatt = fp_settings().get_no_sconti_fatt(); | ||||
| 	_nascondi_sconti_righe_fatt = get_no_sconti_fatt(); | ||||
| } | ||||
| 
 | ||||
| TDoc_fp::~TDoc_fp() | ||||
| { | ||||
| 	commit(); | ||||
|  | ||||
| @ -4,8 +4,6 @@ | ||||
| #define FILE_SECTION				"fp" | ||||
| #define FP_TAB_MOD					"FP" | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #define FP_IP												"ip" | ||||
| #define FP_DB												"db" | ||||
| #define FP_USR											"usr" | ||||
| @ -26,6 +24,7 @@ | ||||
| #define FP_CHECK_NO_EXPORT_PRONTO		"noexportpronto" | ||||
| #define FP_DATASTARTFATT						"datastartfatt" | ||||
| #define FP_DATASTARTNEWFATT				  "startnewtracciato" | ||||
| #define FP_SEND_ALL_RIFS            "sendallrifs" | ||||
| 
 | ||||
| // Sheet fp0300
 | ||||
| #define FP_SLD_COD					"SLD" | ||||
| @ -49,241 +48,257 @@ | ||||
| #define FP_SHT_DEF_PREZZO				"PREZZONN" | ||||
| #define FP_SHT_DEF_IMPONIBILE		"IMPNS" | ||||
| 
 | ||||
| const TString& TFP_settings::get_db_indirizzo() const | ||||
| const TString& get_db_indirizzo() | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_IP); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_db_database() const | ||||
| const TString& get_db_database() | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_DB); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_db_str_con() const | ||||
| const TString& get_db_str_con() | ||||
| { | ||||
| 	return get_tmp_string().cut(0) << get_db_indirizzo() << "@" << get_db_database(); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_db_user() const | ||||
| const TString& get_db_user() | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_USR); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_db_password() const | ||||
| const TString& get_db_password() | ||||
| { | ||||
| 	return get_tmp_string().cut(0) << decode(ini_get_string(FILE_CONFIG, FILE_SECTION, FP_PSW)); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_fld_dest() const | ||||
| const TString& get_fld_dest() | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_FLD_DEST); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_fld_dest_usr() const | ||||
| const TString& get_fld_dest_usr() | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_FLD_USR_DEST, ""); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_cofi_tras() const | ||||
| const TString& get_cofi_tras() | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_COFI_TRAS); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_data_start_fatt() const | ||||
| const TDate get_data_start_fatt() | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_DATASTARTFATT, "01-01-2019"); | ||||
| 	return ini_get_date(FILE_CONFIG, FILE_SECTION, FP_DATASTARTFATT, "01-01-2019"); | ||||
| } | ||||
| 
 | ||||
| const bool TFP_settings::get_gest_alleg() const | ||||
| const bool get_gest_alleg() | ||||
| { | ||||
| 	return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_GEST_ALLEG); | ||||
| } | ||||
| 
 | ||||
| const bool TFP_settings::get_allega_fat() const | ||||
| const bool get_allega_fat() | ||||
| { | ||||
| 	return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ALLEG_FAT); | ||||
| } | ||||
| 
 | ||||
| const bool TFP_settings::get_esp_pri_empty() const | ||||
| const bool get_esp_pri_empty() | ||||
| { | ||||
| 	return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_PRI); | ||||
| } | ||||
| 
 | ||||
| const bool TFP_settings::get_esp_est() const | ||||
| const bool get_send_all_rifs() | ||||
| { | ||||
|   return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_SEND_ALL_RIFS); | ||||
| } | ||||
| 
 | ||||
| const bool get_esp_est() | ||||
| { | ||||
| 	return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_EST); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_esp_est_cod() const | ||||
| const TString& get_esp_est_cod() | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_ESP_EST_COD, "XXXXXXX"); | ||||
| } | ||||
| 
 | ||||
| const bool TFP_settings::is_f8() const | ||||
| const bool is_f8() | ||||
| { | ||||
| 	return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_F8); | ||||
| } | ||||
| 
 | ||||
| const bool TFP_settings::get_check_not_block() const | ||||
| const bool get_check_not_block() | ||||
| { | ||||
| 	return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NOT_BLOCK); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_body_mail(int idx) const | ||||
| const TString& get_body_mail(int idx) | ||||
| { | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_MAIL, "STOpsTOP", idx); | ||||
| } | ||||
| 
 | ||||
| const TString& TFP_settings::get_npf(const char * tipodoc, int idx) const | ||||
| const TString& get_npf(const char * tipodoc, int idx) | ||||
| { | ||||
| 	TString name; name << FP_NOTA_PIEDE_F << "-" << tipodoc; | ||||
| 
 | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, name, "FERMATIostrega", idx); | ||||
| } | ||||
| 
 | ||||
| const TString TFP_settings::get_npf_tipodoc(int indx) const | ||||
| const TString & get_npf_tipodoc(int indx) | ||||
| { | ||||
| 	TString name; name << FP_NOTA_PIEDE_F << "_tipodoc"; | ||||
| 
 | ||||
| 	return ini_get_string(FILE_CONFIG, FILE_SECTION, name, "FERMATIostrega", indx); | ||||
| } | ||||
| 
 | ||||
| TDate TFP_settings::get_date_start_new_fatt() | ||||
| TDate get_date_start_new_fatt() | ||||
| { | ||||
|   return ini_get_date(CONFIG_DITTA, FILE_SECTION, FP_DATASTARTNEWFATT, "01-01-2021"); | ||||
| } | ||||
| 
 | ||||
| const bool TFP_settings::get_no_sconti_fatt() const | ||||
| const bool get_no_sconti_fatt() | ||||
| { | ||||
| 	return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NO_SCONTI_FATT, false); | ||||
| } | ||||
| 
 | ||||
| bool TFP_settings::get_no_export_pronto() const | ||||
| bool get_no_export_pronto() | ||||
| { | ||||
| 	return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NO_EXPORT_PRONTO, false); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_db_indirizzo(const TString& ind) const | ||||
| void set_db_indirizzo(const TString& ind) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_IP, ind); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_db_database(const TString& db) const | ||||
| void set_db_database(const TString& db) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_DB, db); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_db_user(const TString& usr) const | ||||
| void set_db_user(const TString& usr) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_USR, usr); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_db_password(const TString& psw) const | ||||
| void set_db_password(const TString& psw) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_PSW, encode(psw)); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_fld_dest(const TString& fld_dest) const | ||||
| void set_fld_dest(const TString& fld_dest) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_FLD_DEST, fld_dest); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_fld_dest_usr(const TString& fld_dest_usr) const | ||||
| void set_fld_dest_usr(const TString& fld_dest_usr) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_FLD_USR_DEST, fld_dest_usr); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_cofi_tras(const TString& cofi) const | ||||
| void set_cofi_tras(const TString& cofi) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_COFI_TRAS, cofi); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_gest_alleg(const bool gest_alleg) const | ||||
| void set_gest_alleg(const bool gest_alleg) | ||||
| { | ||||
| 	ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_GEST_ALLEG, gest_alleg); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_allega_fat(const bool allega_fatt) const | ||||
| void set_allega_fat(const bool allega_fatt) | ||||
| { | ||||
| 	ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ALLEG_FAT, allega_fatt); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_esp_pri_empty(const bool esp_pri) const | ||||
| void set_esp_pri_empty(const bool esp_pri) | ||||
| { | ||||
| 	ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_PRI, esp_pri); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_esp_est(const bool esp_est) const | ||||
| void set_send_all_rifs(const bool esp_pri) | ||||
| { | ||||
|   ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_SEND_ALL_RIFS, esp_pri); | ||||
| } | ||||
| 
 | ||||
| void set_esp_est(const bool esp_est) | ||||
| { | ||||
| 	ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_ESP_EST, esp_est); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_esp_est_cod(const TString& esp_est_cod) const | ||||
| void set_esp_est_cod(const TString& esp_est_cod) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_ESP_EST_COD, esp_est_cod); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_f8(const bool f8) const | ||||
| void set_f8(const bool f8) | ||||
| { | ||||
| 	ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_F8, f8); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_check_not_block(const bool not_block) const | ||||
| void set_check_not_block(const bool not_block) | ||||
| { | ||||
| 	ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NOT_BLOCK, not_block); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_body_mail(const char* msg, int idx) const | ||||
| void set_body_mail(const char* msg, int idx) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_MAIL, msg, idx); | ||||
| } | ||||
| 
 | ||||
| // Set nota piede fattura
 | ||||
| void TFP_settings::set_npf(const char * tipodoc, const char* msg, int idx) const | ||||
| void set_npf(const char * tipodoc, const char* msg, int idx) | ||||
| { | ||||
| 	TString name; name << FP_NOTA_PIEDE_F << "-" << tipodoc; | ||||
| 
 | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, name, msg, idx); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_no_sconti_fatt(const bool no_sconti_fatt) const | ||||
| void set_no_sconti_fatt(const bool no_sconti_fatt) | ||||
| { | ||||
| 	ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NO_SCONTI_FATT, no_sconti_fatt); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_no_export_pronto(const bool no_export_pronto) const | ||||
| void set_no_export_pronto(const bool no_export_pronto) | ||||
| { | ||||
| 	ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NO_EXPORT_PRONTO, no_export_pronto); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_data_start_fatt(const char* date) const | ||||
| void set_data_start_fatt(const char* date) | ||||
| { | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, FP_DATASTARTFATT, date); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_data_start_new_fatt(const char* date) const | ||||
| void set_data_start_new_fatt(const char* date) | ||||
| { | ||||
|   ini_set_string(CONFIG_DITTA, FILE_SECTION, FP_DATASTARTNEWFATT, date); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::remove_para_ini(int idx) | ||||
| void remove_para_ini(int idx) | ||||
| { | ||||
| 	ini_remove(FILE_CONFIG, FILE_SECTION, FP_MAIL, idx); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::remove_npf_ini(const char * tipodoc, int idx) | ||||
| void remove_npf_ini(const char * tipodoc, int idx) | ||||
| { | ||||
| 	TString name; name << FP_NOTA_PIEDE_F << "-" << tipodoc; | ||||
| 
 | ||||
| 	ini_remove(FILE_CONFIG, FILE_SECTION, name, idx); | ||||
| } | ||||
| 
 | ||||
| void TFP_settings::set_npf_tipodoc(const TString& tipodoc, int indx) const | ||||
| void set_npf_tipodoc(const TString& tipodoc, int indx) | ||||
| { | ||||
| 	TString name; name << FP_NOTA_PIEDE_F << "_tipodoc"; | ||||
| 
 | ||||
| 	ini_set_string(FILE_CONFIG, FILE_SECTION, name, tipodoc, indx); | ||||
| } | ||||
| 
 | ||||
| // Rimuove linea ini in eccesso per tipodoc per nota piede fattura
 | ||||
| void TFP_settings::remove_tipodoc_npf(const int idx) const | ||||
| void remove_tipodoc_npf(const int idx) | ||||
| { | ||||
| 	TString name; name << FP_NOTA_PIEDE_F << "_tipodoc"; | ||||
| 
 | ||||
| 	ini_remove(FILE_CONFIG, FILE_SECTION, name, idx); | ||||
| } | ||||
| 
 | ||||
| @ -387,16 +402,16 @@ void TFP_nota_piede_f::write_ini_npf(const TString& tipodoc, TToken_string& msg) | ||||
| 	// Conto quanti ne avevo salvati prima nel file ini per poi controllare
 | ||||
| 	// che non sto salvando meno di quelli che ci sono già
 | ||||
| 	int previous_indx = 0; | ||||
| 	for (TString row = fp_settings().get_npf(tipodoc, previous_indx); row != "FERMATIostrega"; row = fp_settings().get_npf(tipodoc, previous_indx)) | ||||
| 	for (TString row = get_npf(tipodoc, previous_indx); row != "FERMATIostrega"; row = get_npf(tipodoc, previous_indx)) | ||||
| 		previous_indx++; | ||||
| 	// Vado a salvare ogni riga nel file ini
 | ||||
| 	for (const char* row = msg.get(); row; row = msg.get()) | ||||
| 		fp_settings().set_npf(tipodoc, row, indx++); | ||||
| 		set_npf(tipodoc, row, indx++); | ||||
| 
 | ||||
| 	if (indx < previous_indx) | ||||
| 	{ | ||||
| 		for (int i = indx; i < previous_indx; i++) | ||||
| 			fp_settings().remove_npf_ini(tipodoc, i); | ||||
| 			remove_npf_ini(tipodoc, i); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| @ -405,10 +420,10 @@ void TFP_nota_piede_f::delete_ini_npf(const TString& tipodoc) | ||||
| 	// Conto quanti ne avevo salvati prima nel file ini per poi controllare
 | ||||
| 	// che non sto salvando meno di quelli che ci sono già
 | ||||
| 	int previous_indx = 0; | ||||
| 	for (TString row = fp_settings().get_npf(tipodoc, previous_indx); row != "FERMATIostrega"; row = fp_settings().get_npf(tipodoc, previous_indx)) | ||||
| 	for (TString row = get_npf(tipodoc, previous_indx); row != "FERMATIostrega"; row = get_npf(tipodoc, previous_indx)) | ||||
| 		previous_indx++; | ||||
| 	for (int i = 0; i < previous_indx; i++) | ||||
| 		fp_settings().remove_npf_ini(tipodoc, i); | ||||
| 		remove_npf_ini(tipodoc, i); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| @ -418,7 +433,7 @@ TString TFP_nota_piede_f::get_ini_npf(const TString& tipodoc) | ||||
| 	TString msg; msg.cut(0); | ||||
| 
 | ||||
| 	int indx = 0; | ||||
| 	for (TString row = fp_settings().get_npf(tipodoc, indx); row != "FERMATIostrega"; row = fp_settings().get_npf(tipodoc, indx)) | ||||
| 	for (TString row = get_npf(tipodoc, indx); row != "FERMATIostrega"; row = get_npf(tipodoc, indx)) | ||||
| 	{ | ||||
| 		if(indx++ > 0) | ||||
| 			msg << '\n'; | ||||
| @ -432,7 +447,7 @@ void TFP_nota_piede_f::get_load() | ||||
| 	// Prima leggo i tipi doc che ho salvato dall'ini
 | ||||
| 	TString tipo_get = ""; | ||||
| 	int indx = 0; | ||||
| 	while ((tipo_get = fp_settings().get_npf_tipodoc(indx++)) != "FERMATIostrega") | ||||
| 	while ((tipo_get = get_npf_tipodoc(indx++)) != "FERMATIostrega") | ||||
| 		_tipi_doc.add(tipo_get); | ||||
| 
 | ||||
| 	const int itms = _tipi_doc.items(); | ||||
| @ -451,7 +466,7 @@ void TFP_nota_piede_f::load_sheet(TSheet_field& sheet_field) | ||||
| 	// Prima leggo i tipi doc che ho salvato dall'ini
 | ||||
| 	TString tipo_get = ""; | ||||
| 	int indx = 0; | ||||
| 	while((tipo_get = fp_settings().get_npf_tipodoc(indx++)) != "FERMATIostrega") | ||||
| 	while((tipo_get = get_npf_tipodoc(indx++)) != "FERMATIostrega") | ||||
| 		_tipi_doc.add(tipo_get); | ||||
| 
 | ||||
| 	int i = 0; | ||||
| @ -495,7 +510,7 @@ void TFP_nota_piede_f::save_new_tipidoc(TSheet_field& sheet_field) | ||||
| 	int n_tipidoc = 0; | ||||
| 	TString npf_get; | ||||
| 	// Conto quanti tipi doc ho nel file ini
 | ||||
| 	for (int i = 0; (npf_get = fp_settings().get_npf_tipodoc(i)) != "FERMATIostrega"; i++) | ||||
| 	for (int i = 0; (npf_get = get_npf_tipodoc(i)) != "FERMATIostrega"; i++) | ||||
| 	{ | ||||
| 		n_tipidoc++; | ||||
| 		_tipi_doc.add(npf_get); | ||||
| @ -507,12 +522,13 @@ void TFP_nota_piede_f::save_new_tipidoc(TSheet_field& sheet_field) | ||||
| 	{ | ||||
| 		TToken_string row = sheet_field.row(i); | ||||
| 		TString tipodoc_sf(row.get(0)); | ||||
| 		fp_settings().set_npf_tipodoc(tipodoc_sf, i); | ||||
| 
 | ||||
| 		set_npf_tipodoc(tipodoc_sf, i); | ||||
| 	} | ||||
| 
 | ||||
| 	if (items_sf < n_tipidoc) | ||||
| 		for (int i = items_sf; i < n_tipidoc; i++) | ||||
| 			fp_settings().remove_tipodoc_npf(i); | ||||
| 			remove_tipodoc_npf(i); | ||||
| } | ||||
| 
 | ||||
| void TFP_nota_piede_f::save_sheet(TSheet_field& sheet_field) | ||||
|  | ||||
| @ -63,7 +63,7 @@ bool TFp_mail_sender::send(const TString& msg) | ||||
| 	bool ok = false; | ||||
| 	if (_alleg && !_mail.blank() && _accord) | ||||
| 	{ | ||||
| 		_pdf_path = fp_settings().get_fld_dest_usr();		// Cartella dove ci sono i pdf generati
 | ||||
| 		_pdf_path = get_fld_dest_usr();		// Cartella dove ci sono i pdf generati
 | ||||
| 
 | ||||
| 		TFilename pdf; pdf << _pdf_path << _pdf_name; | ||||
| 
 | ||||
| @ -90,6 +90,7 @@ bool TFp_mail_sender::send(const TString& msg) | ||||
| 		TString hfatt, bfatt; | ||||
| 		TPaf_record paf0100f("PAF0100F"); | ||||
| 		TString query; | ||||
| 
 | ||||
| 		if (chiave_paf(fdoc, hfatt, bfatt) && paf0100f.search(nullptr, hfatt, bfatt)) | ||||
| 		{ | ||||
| 			query << "UPDATE PAF0100F SET P1_ERRINT = 'S' WHERE P1_KEYHEADERFATT = '" << hfatt << "' AND P1_KEYBODYFATT = '" << bfatt << "'"; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user