Patch level : 12.00 1364

Files correlati     : ba0.exe cg0.exe cg1.exe cg1309.msk

Commento:
Eliminata la password di sercizio, ora i programmi protetti possono essere esguiti solo dagli  utenti supervisori (campo sugli utenti).
Anche la partita IVA e il codice fiscale errati sono controllati da OnlyOnePAIV.
Controllo partita IVA e codice fiscale aggiunto ordinamento per codice partita IVA e codice fiscale e i campo codice allegato e tipo persona.
This commit is contained in:
Alessandro Bonazzi 2024-10-18 00:26:23 +02:00
parent 3ba0ec2065
commit 24665f92bc
4 changed files with 93 additions and 18 deletions

View File

@ -254,17 +254,31 @@ HIDDEN bool almeno_cf_o_pi(TMask_field& f)
{ {
const bool occas = m.get_bool(F_OCCASIONALE); const bool occas = m.get_bool(F_OCCASIONALE);
const int alleg = m.get_int(F_ALLEG); const int alleg = m.get_int(F_ALLEG);
if (!occas && (alleg == 0 || alleg == 6 || alleg == 7)) // ... e non sono occasionale if (!occas && (alleg == 0 || alleg == 6 || alleg == 7)) // ... e non sono occasionale
{ {
const TEdit_field& cofi = m.efield(F_COFI); const TEdit_field& cofi = m.efield(F_COFI);
if (cofi.empty()) // Dal 2007 serve il codice fiscale const bool only_one_paiv = ini_get_bool(CONFIG_DITTA, "cg", "OnlyOnePaIV");
ok = cofi.yesno_box(TR("Codice fiscale assente per residente in Italia : lo accetto ugualmente ?"));
// Se NON sono privato (alleg != 6), serve partita IVA if (cofi.empty()) // Dal 2007 serve il codice fiscale
{
if (only_one_paiv && !supervisor())
return cofi.error_box(TR("Codice fiscale assente per residente in Italia"));
else
ok = cofi.yesno_box(TR("Codice fiscale assente per residente in Italia : lo accetto ugualmente ?"));
}
if (ok) if (ok)
{ {
const TEdit_field& paiv = m.efield(F_PAIV); const TEdit_field& paiv = m.efield(F_PAIV);
if (alleg != 6 && paiv.empty())
ok = paiv.yesno_box(TR("Partita IVA assente per non privato : la accetto ugualmente ?")); // Se NON sono privato (alleg != 6), serve partita IVA
if (alleg != 6 && paiv.empty())
{
if (only_one_paiv && !supervisor())
return paiv.error_box(TR("Partita IVA assente per non privato"));
else
ok = paiv.yesno_box(TR("Partita IVA assente per non privato : la accetto ugualmente ?"));
}
} }
} }
} }
@ -1028,7 +1042,7 @@ void TClifo_application::ini2mask(TConfig& ini, TMask& m, bool query)
break; break;
if (i == 0) if (i == 0)
indsp_sheet().reset(); indsp_sheet().reset();
riga.cut(0); riga.cut(0);
riga.add(ini.get(IND_RAGSOC)); riga.add(ini.get(IND_RAGSOC));
riga.add(ini.get(IND_INDIR)); riga.add(ini.get(IND_INDIR));
@ -1050,7 +1064,7 @@ void TClifo_application::ini2mask(TConfig& ini, TMask& m, bool query)
riga.add(com.get(COM_DENCOM)); riga.add(com.get(COM_DENCOM));
riga.add(ini.get(IND_INDIR2)); riga.add(ini.get(IND_INDIR2));
riga.add(ini.get(IND_CODIND)); riga.add(ini.get(IND_CODIND));
indsp_sheet().row(i)=riga; indsp_sheet().row(i)=riga;
// Load the sheets of CODINDDOC, CODINDSP, CODINDEFF. // Load the sheets of CODINDDOC, CODINDSP, CODINDEFF.
@ -1270,6 +1284,7 @@ void TClifo_application::reset_sheet()
TClifo_application& a = app(); TClifo_application& a = app();
a.field_sheet(F_CODINDDOC).destroy(); a.field_sheet(F_CODINDDOC).destroy();
a.field_sheet(F_CODINDDOC).add(nulla); a.field_sheet(F_CODINDDOC).add(nulla);
a.field_sheet(F_CODINDSP).destroy(); a.field_sheet(F_CODINDSP).destroy();
@ -1335,7 +1350,7 @@ void TClifo_application::common_f(const TMask& m)
indsp_pack(); indsp_pack();
TArray& rows=indsp_sheet().rows_array(); TArray& rows=indsp_sheet().rows_array();
int n_items = rows.items(); int n_items = rows.items();
for (int i = 0; i < n_items; i++) for (int i = 0; i < n_items; i++)
{ {
TToken_string& row=(TToken_string&)rows[i]; TToken_string& row=(TToken_string&)rows[i];
@ -1467,6 +1482,7 @@ void TClifo_application::indsp_sheet_rebuilder()
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
TToken_string& riga= righe.row(i); TToken_string& riga= righe.row(i);
rigav.format("%d", i+1); rigav.format("%d", i+1);
rigav.add(riga.get(0)); rigav.add(riga.get(0));
rigav.add(riga.get()); rigav.add(riga.get());
@ -1556,7 +1572,6 @@ bool TClifo_application::user_create() // initvar e arrmask
open_files(LF_CLIFO, LF_CFVEN, LF_INDSP, LF_TAB, LF_TABCOM, LF_MOV, LF_ANAG, open_files(LF_CLIFO, LF_CFVEN, LF_INDSP, LF_TAB, LF_TABCOM, LF_MOV, LF_ANAG,
LF_ANAGFIS, LF_PCON, LF_COMUNI, LF_TABMOD, LF_CFPRI, 0); LF_ANAGFIS, LF_PCON, LF_COMUNI, LF_TABMOD, LF_CFPRI, 0);
_has_cg = has_module(CGAUT, CHK_DONGLE); _has_cg = has_module(CGAUT, CHK_DONGLE);
_rel = new TClifoVI; _rel = new TClifoVI;
//gestisce i campi salvati sulla tabella di modulo lv020 (lvclifo) //gestisce i campi salvati sulla tabella di modulo lv020 (lvclifo)
_rel->add("&LV020" ,"CODTAB==" CLI_TIPOCF "+" CLI_CODCF, 1, LF_CLIFO, LVAUT); _rel->add("&LV020" ,"CODTAB==" CLI_TIPOCF "+" CLI_CODCF, 1, LF_CLIFO, LVAUT);

View File

@ -1,6 +1,6 @@
#define F_TIPO 201 #define F_TIPO 201
#define F_CLIFO 202 #define F_CLIFO 202
#define F_COFI 203 #define F_SORT 203
#define F_RESET 204 #define F_RESET 204
#define S_DIRTY 101 #define S_DIRTY 101
@ -10,4 +10,6 @@
#define S_PAIV 105 #define S_PAIV 105
#define S_COFI 106 #define S_COFI 106
#define S_ALLEG 107 #define S_ALLEG 107
#define S_ERROR 108 #define S_CODALLEG 108
#define S_TIPOPERS 109
#define S_ERROR 110

View File

@ -27,9 +27,12 @@ BEGIN
FLAGS "Z" FLAGS "Z"
END END
BOOLEAN F_COFI LISTBOX F_SORT 1 14
BEGIN BEGIN
PROMPT 31 1 "Controllo Codice Fiscale" PROMPT 31 1 "Ordinamento "
ITEM "1|Partita IVA"
ITEM "2|Codice fiscale"
ITEM "3|Codice"
END END
SPREADSHEET F_CLIFO 0 -1 SPREADSHEET F_CLIFO 0 -1
@ -42,6 +45,8 @@ BEGIN
ITEM "Partita IVA" ITEM "Partita IVA"
ITEM "Codice Fiscale@16" ITEM "Codice Fiscale@16"
ITEM "Allegato@28" ITEM "Allegato@28"
ITEM "Codice allegato"
ITEM "Tipo persona"
ITEM "Problema riscontrato@50" ITEM "Problema riscontrato@50"
END END
@ -105,9 +110,21 @@ BEGIN
ITEM "G|Gruppo IVA" ITEM "G|Gruppo IVA"
END END
NUMBER S_CODALLEG 7
BEGIN
PROMPT 1 7 "Codice allegato"
END
LISTBOX S_TIPOPERS 1 9
BEGIN
PROMPT 1 8 "Allegato "
ITEM "F|Fisica"
ITEM "1|Giuridica"
END
MEMO S_ERROR 50 3 MEMO S_ERROR 50 3
BEGIN BEGIN
PROMPT 1 7 "Problema riscontrato" PROMPT 1 9 "Problema riscontrato"
FLAGS "D" FLAGS "D"
END END

View File

@ -31,10 +31,43 @@ public:
TCheck_PIVA_mask() : TAutomask("cg1300l"), _last_row(0) {} TCheck_PIVA_mask() : TAutomask("cg1300l"), _last_row(0) {}
}; };
int sort(TSheet_field & s, int r1, int r2)
{
const int key = s.mask().get_int(F_SORT);
switch (key)
{
case 1:
{
const TString & p1 = s.get_str_row_cell(r1, S_PAIV);
const TString & p2 = s.get_str_row_cell(r2, S_PAIV);
return strcmp(p1, p2);
}
break;
case 2:
{
const TString & c1 = s.get_str_row_cell(r1, S_COFI);
const TString & c2 = s.get_str_row_cell(r2, S_COFI);
return strcmp(c1, c2);
}
break;
case 3:
{
long c1 = s.get_long_row_cell(r1, S_CODCF);
long c2 = s.get_long_row_cell(r2, S_CODCF);
return c1 - c2;
}
break;
}
return 0;
}
// Carica lo sheet in base alle impostazioni correnti (F_CLIFO, F_COFI) // Carica lo sheet in base alle impostazioni correnti (F_CLIFO, F_COFI)
void TCheck_PIVA_mask::load_sheet() void TCheck_PIVA_mask::load_sheet()
{ {
const bool check_cofi = get_bool(F_COFI);
TSheet_field& s = sfield(F_CLIFO); TSheet_field& s = sfield(F_CLIFO);
// Elenco di tutti i clienti (o fornitori) // Elenco di tutti i clienti (o fornitori)
TISAM_recordset clifo("USE CLIFO\nFROM TIPOCF=#TIPO\nTO TIPOCF=#TIPO"); TISAM_recordset clifo("USE CLIFO\nFROM TIPOCF=#TIPO\nTO TIPOCF=#TIPO");
@ -129,12 +162,15 @@ void TCheck_PIVA_mask::load_sheet()
alleg = "0"; alleg = "0";
s.set_row_cell(S_ALLEG, alleg, r); s.set_row_cell(S_ALLEG, alleg, r);
s.set_row_cell(S_SOSPESO, clifo.get(CLI_SOSPESO).as_bool(), r); s.set_row_cell(S_SOSPESO, clifo.get(CLI_SOSPESO).as_bool(), r);
s.set_row_cell(S_CODALLEG, clifo.get(CLI_CODALLEG).as_int(), r);
s.set_row_cell(S_TIPOPERS, clifo.get(CLI_TIPOPERS).as_string(), r);
msg.trim(); msg.trim();
s.set_row_cell(S_ERROR, msg, r); s.set_row_cell(S_ERROR, msg, r);
} }
} }
} }
} }
s.sort(sort);
s.force_update(); s.force_update();
_row = s.items() > 0 ? s.row(0) : EMPTY_STRING; _row = s.items() > 0 ? s.row(0) : EMPTY_STRING;
_last_row = 0; _last_row = 0;
@ -207,9 +243,14 @@ bool TCheck_PIVA_mask::on_field_event(TOperable_field& o, TField_event e, long j
if (e == fe_init || e == fe_modify) if (e == fe_init || e == fe_modify)
update_sheet(); update_sheet();
break; break;
case F_COFI: case F_SORT:
if (e == fe_modify) if (e == fe_modify)
update_sheet(); {
TSheet_field& s = sfield(F_CLIFO);
s.sort(sort);
s.force_update();
}
break; break;
case F_RESET: case F_RESET:
if (e == fe_button) if (e == fe_button)