Patch level : 12.0 830
Files correlati : cg2.exe Commento : - [Prima nota] Aggiunto calcolo totdoc da ini f1 se non valorizzato - Corretti controlli FPPRO quando salvo un movimento
This commit is contained in:
parent
1868cc986d
commit
1fbf34ce1f
@ -1453,6 +1453,16 @@ void TPrimanota_application::write_fppro()
|
||||
"Movimento registrato senza collegamento ai documenti in ingresso.");
|
||||
}
|
||||
|
||||
bool TPrimanota_application::has_tot_doc(TToken_string& fppro_keys)
|
||||
{
|
||||
TString query;
|
||||
query << "SELECT PQ_IMPTOTDOC AS TOT FROM PAA2700F\n" <<
|
||||
"WHERE PQ_KEYPRGINVIO = '" << fppro_keys.get(0) << "' AND PQ_KEYHEADERFATT = '" << fppro_keys.get(1) << "' AND PQ_KEYBODYFATT = '" << fppro_keys.get(2) << "'";
|
||||
fp_db().sq_set_exec(query);
|
||||
const TString tot = fp_db().sq_get("TOT");
|
||||
return tot.full() && real(tot) != 0;
|
||||
}
|
||||
|
||||
int TPrimanota_application::write(const TMask& m)
|
||||
{
|
||||
static int lasterr = NOERR;
|
||||
@ -2258,6 +2268,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
}
|
||||
if (_f1_ini && msk.find_by_id(FS_RECALC) != NULL)
|
||||
{
|
||||
msk.set(F_TOTALE, calcola_imp());
|
||||
msk.set(F_COLFPPRO, "X");
|
||||
msk.set(FS_RECALC, "");
|
||||
}
|
||||
@ -2440,13 +2451,16 @@ int TPrimanota_application::save_fppro()
|
||||
const TString& keyheaderfatt = fppro_keys.get();
|
||||
const TString& keybodyfatt = fppro_keys.get();
|
||||
|
||||
// Controllo che i dati corrispondano a quelli nella fattura in ingresso
|
||||
TString where_str;
|
||||
where_str << " (PZ_DATA = \'" << data_documento.date2ansi() << "\' AND PQ_IMPTOTDOC = \'" << tot_doc << "\' AND PZ_NUMERO = \'" << (!numero_docext.empty() ? numero_docext : numero_doc) << "\') ";
|
||||
if (has_tot_doc(fppro_keys))
|
||||
where_str << " (PZ_DATA = \'" << data_documento.date2ansi() << "\' AND PQ_IMPTOTDOC = \'" << tot_doc << "\' AND PZ_NUMERO = \'" << (!numero_docext.empty() ? numero_docext : numero_doc) << "\') ";
|
||||
else
|
||||
where_str << " (PZ_DATA = \'" << data_documento.date2ansi() << "\' AND PZ_NUMERO = \'" << (!numero_docext.empty() ? numero_docext : numero_doc) << "\') ";
|
||||
TString& query = TPro_msk::query_fppro(keyprginvio, keyheaderfatt, keybodyfatt, where_str);
|
||||
|
||||
fp_db().sq_set_exec(query);
|
||||
const int n = fp_db().sq_items();
|
||||
if (n != 1)
|
||||
if(has_f1_db(&msk) && fp_db().sq_items() != 1)
|
||||
{
|
||||
warning_box(TString("Attenzione, ") << "al movimento non è stato abbinato nessun documento elettronico.\n" <<
|
||||
"Per consentire una corretta archiviazione sostitutiva si consiglia di non confermare la registrazione e di procedere\n" <<
|
||||
@ -2457,12 +2471,10 @@ int TPrimanota_application::save_fppro()
|
||||
const int numreg = fp_db().sq_get_int("PZ_NUMREGCONT");
|
||||
if (numreg != 0)
|
||||
{
|
||||
const bool key = noyes_box(
|
||||
TString("Il documento ") << data_documento.year() << " / " << numero_doc <<
|
||||
" è già stato inserito con la registrazione numero " << numreg <<
|
||||
"\nSi desidera continuare comunque?");
|
||||
if(!key)
|
||||
return pro_notsaved;
|
||||
TString msg; msg << "Attenzione il documento " << data_documento.year() << " / " << numero_doc <<
|
||||
" appena registrato e' gia' stato inserito con la registrazione numero " << numreg <<
|
||||
"\nControllare e nel caso provvedere a correggere l'associazione del movimento ai documenti in ingresso.";
|
||||
warning_box(msg);
|
||||
}
|
||||
|
||||
// Devo controllare che la data operazione sia maggiore della data ric
|
||||
|
@ -217,6 +217,7 @@ protected: // TApplication
|
||||
|
||||
// Metodo chiamato dalla write e rewrite per salvare su db fatt.
|
||||
void write_fppro();
|
||||
static bool has_tot_doc(TToken_string& fppro_keys);
|
||||
// Salvo dati fornitore e registrazione contabile sul db FPPRO
|
||||
int save_fppro();
|
||||
// Salva sul movimento il riferimento al documento in FPPRO (keys)
|
||||
|
Loading…
x
Reference in New Issue
Block a user