Patch level : 10.0 718

Files correlati     : cg0.exe
Ricompilazione Demo : [ ]
Commento

Bug  	 	0001612: 002240 - Gerling - inserimento fornitore/percipiente

si richiede di controllare che il bottone crea percipiente, qualora il campo codice percipiente presente nel campo codice percipiente sia già stato creato, eviti di dare errore 224 di scrittura anagrafic


git-svn-id: svn://10.65.10.50/trunk@20406 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-04-30 13:28:20 +00:00
parent 0bac14acdc
commit 5badf4c12a

View File

@ -318,7 +318,11 @@ bool TClifo_application::crea_percipienti(TMask_field& f, KEY key)
const TRectype & rec = cache().get(LF_ANAG, k);
if (!rec.empty())
return error_box("Esiste gia' una anagrafica con codice uguale del fornitore");
{
message_box("Esiste gia' una anagrafica con codice uguale del fornitore");
m.set(F_CODANAGPER, rec.get_long(ANA_CODANAGR));
return true;
}
m.set(F_CODANAGPER, percip);
}
else
@ -347,6 +351,8 @@ bool TClifo_application::crea_percipienti(TMask_field& f, KEY key)
int err = anag.write();
if (err == _isreinsert)
return true;
if (err == NOERR)
{
if (tipo == 'F')
@ -382,9 +388,13 @@ bool TClifo_application::crea_percipienti(TMask_field& f, KEY key)
bool TClifo_application::percip_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
const bool full = f.get().full();
if (f.to_check(key) && !m.field(F_CODANAGPER).empty())
{
if (f.to_check(key, true))
m.enable(DLG_ANAG, !full);
if (f.to_check(key) && full)
{
long percip = m.get_long(F_CODANAGPER);
const char tipo = m.get(F_TIPOAPER)[0];
TToken_string k;
@ -392,45 +402,45 @@ bool TClifo_application::percip_handler(TMask_field& f, KEY key)
k.add(tipo);
k.add(percip);
const TRectype & anag = cache().get(LF_ANAG, k);
const TString& c = m.get(F_COFI), p = m.get(F_PAIV);
const TString& c = m.get(F_COFI), p = m.get(F_PAIV);
if (key == K_TAB && anag.empty())
return true;
if ((c.full() && c != anag.get(ANA_COFI)) ||
(p.full() && p != anag.get(ANA_PAIV)))
return error_box(TR("Percipiente non corretto: codice fiscale o partita IVA diversa"));
if ((c.full() && c != anag.get(ANA_COFI)) ||
(p.full() && p != anag.get(ANA_PAIV)))
return error_box(TR("Percipiente non corretto: codice fiscale o partita IVA diversa"));
const TString& r = anag.get(ANA_RAGSOC);
if (key == K_TAB && m.field(F_RAGSOC).empty() &&
yesno_box(FR("Ragione sociale mancante: assumo %s"), (const char*)r))
{
m.set(F_RAGSOC, r.left(30), true);
m.set(F_RAGSOCA, r.mid(30), true);
}
const TString& r = anag.get(ANA_RAGSOC);
if (key == K_TAB && m.field(F_RAGSOC).empty() &&
yesno_box(FR("Ragione sociale mancante: assumo %s"), (const char*)r))
{
m.set(F_RAGSOC, r.left(30), true);
m.set(F_RAGSOCA, r.mid(30), true);
}
if (m.get(F_INDCF).empty()) m.set(F_INDCF, anag.get(ANA_INDRES));
if (m.get(F_CIVCF).empty()) m.set(F_CIVCF, anag.get(ANA_CIVRES));
if (m.get(F_CAPCF).empty()) m.set(F_CAPCF, anag.get(ANA_CAPRES));
if (m.get(F_COMCF).empty())
{
m.set(F_STATOCF, anag.get(ANA_STATORES), true);
m.set(F_COMCF, anag.get(ANA_COMRES), true);
}
if (c.empty()) m.set(F_COFI, anag.get(ANA_COFI));
if (p.empty()) m.set(F_PAIV, anag.get(ANA_PAIV));
if (m.get(F_TIPOAPER) == "F")
{
const TRectype & fis = cache().get(LF_ANAGFIS, anag.get(ANA_CODANAGR));
if (m.get(F_INDCF).empty()) m.set(F_INDCF, anag.get(ANA_INDRES));
if (m.get(F_CIVCF).empty()) m.set(F_CIVCF, anag.get(ANA_CIVRES));
if (m.get(F_CAPCF).empty()) m.set(F_CAPCF, anag.get(ANA_CAPRES));
if (m.get(F_COMCF).empty())
{
m.set(F_STATOCF, anag.get(ANA_STATORES), true);
m.set(F_COMCF, anag.get(ANA_COMRES), true);
}
if (c.empty()) m.set(F_COFI, anag.get(ANA_COFI));
if (p.empty()) m.set(F_PAIV, anag.get(ANA_PAIV));
if (m.get(F_TIPOAPER) == "F")
{
const TRectype & fis = cache().get(LF_ANAGFIS, anag.get(ANA_CODANAGR));
if (!fis.empty())
{
if (m.get(F_DATANASC).empty()) m.set(F_DATANASC, fis.get(ANF_DATANASC));
if (m.get(F_COMNASC).empty())
m.set(F_COMNASC, fis.get(ANF_COMNASC), true);
m.set(F_SESSO, fis.get(ANF_SESSO));
}
}
if (!fis.empty())
{
if (m.get(F_DATANASC).empty()) m.set(F_DATANASC, fis.get(ANF_DATANASC));
if (m.get(F_COMNASC).empty())
m.set(F_COMNASC, fis.get(ANF_COMNASC), true);
m.set(F_SESSO, fis.get(ANF_SESSO));
}
}
}
return true;
}