Patch level : 12.0
Files correlati : cg Commento: Modificata leggermente la logica per abbinare forzatamente un documento elettronico ad un movimento di prima nota. La soluzione non è delle più eleganti ma è fatta così per farla coesistere con la logica precedente. Quando l'utente abbina manualmente i documenti dalla prima nota, una volta chiusa la maschera dell abbinamento all fppro, in prima nota vengono spenti i campo cancella ed elimina in modo che l'utente sia obbligato a registrare il movimento. Se si lascia all'utente la possibilità di non registrare si crea la casistica in cui il documento risulta collegato per l'fppro (perche la query sql è già stata fatta) ma gli archivi di campo non vengono aggiornati quindi in MOV il documento non risulta collegato
This commit is contained in:
parent
7ae80a0181
commit
e413e6d0d9
@ -1536,6 +1536,7 @@ void TPrimanota_application::write_fppro()
|
|||||||
{
|
{
|
||||||
if (main_app().has_module(FPAUT) && !ini_get_bool(CONFIG_INSTALL, "Main", "SkipFPPRO"))
|
if (main_app().has_module(FPAUT) && !ini_get_bool(CONFIG_INSTALL, "Main", "SkipFPPRO"))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Controllo se la registrazione ha avuto effetto anche su FPPRO allora salvo riferimento sul mov
|
// Controllo se la registrazione ha avuto effetto anche su FPPRO allora salvo riferimento sul mov
|
||||||
if (save_fppro() > 0 && !save_dbmov())
|
if (save_fppro() > 0 && !save_dbmov())
|
||||||
message_box(
|
message_box(
|
||||||
@ -1667,8 +1668,15 @@ int TPrimanota_application::write(const TMask& m)
|
|||||||
if (movcoll != 0L)
|
if (movcoll != 0L)
|
||||||
set_movcoll(movcoll, numreg);
|
set_movcoll(movcoll, numreg);
|
||||||
}
|
}
|
||||||
write_fppro();
|
if (!_coll_forzato)
|
||||||
|
write_fppro();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TMask& msk = curr_mask();
|
||||||
|
msk.enable(DLG_CANCEL, true);
|
||||||
|
msk.enable(DLG_QUIT, true);
|
||||||
|
_coll_forzato = false;
|
||||||
|
}
|
||||||
_saldi.registra();
|
_saldi.registra();
|
||||||
check_saldi();
|
check_saldi();
|
||||||
|
|
||||||
@ -1791,8 +1799,15 @@ int TPrimanota_application::rewrite(const TMask& m)
|
|||||||
const int err = _rel->rewrite(true);
|
const int err = _rel->rewrite(true);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
{
|
{
|
||||||
write_fppro();
|
if (!_coll_forzato)
|
||||||
|
write_fppro();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TMask& msk = curr_mask();
|
||||||
|
msk.enable(DLG_CANCEL, true);
|
||||||
|
msk.enable(DLG_QUIT, true);
|
||||||
|
_coll_forzato = false;
|
||||||
|
}
|
||||||
_saldi.registra();
|
_saldi.registra();
|
||||||
check_saldi();
|
check_saldi();
|
||||||
|
|
||||||
@ -2744,6 +2759,63 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//QUI/
|
||||||
|
bool TPrimanota_application::collega_fppro(TString fpprokeys)
|
||||||
|
{
|
||||||
|
TMask& msk = curr_mask();
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
// Provo a vedere se hanno l'FP: se c'è l'indirizzo controllo che non sia F8 se non c'è non hanno l'FP
|
||||||
|
if (!has_f1_db(msk))
|
||||||
|
{
|
||||||
|
error_box(TR("ATTENZIONE! F1 assente, contattare l'assistenza!"));
|
||||||
|
ok &= false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TDate data_operazione(msk.get(F_DATAREG));
|
||||||
|
const TDate data_documento(msk.get(F_DATADOC));
|
||||||
|
|
||||||
|
// Controllo che sto registrando un documento d'acquisto
|
||||||
|
if (!check_causale(msk.get(F_CODCAUS), data_operazione.year()))
|
||||||
|
{
|
||||||
|
error_box(TR("ATTENZIONE! Il movimento è di acquisto!"));
|
||||||
|
ok &= false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& numero_docext = msk.get(F_NUMDOCEXT);
|
||||||
|
real tot_doc = msk.get_real(F_TOTALE);
|
||||||
|
const real ritfis = msk.get_real(F_RITFIS);
|
||||||
|
const real ritsoc = msk.get_real(F_RITSOC);
|
||||||
|
tot_doc = tot_doc + ritfis + ritsoc;
|
||||||
|
TToken_string fppro_keys(fpprokeys, ';');
|
||||||
|
const TString& keyprginvio = fppro_keys.get();
|
||||||
|
const TString& keyheaderfatt = fppro_keys.get();
|
||||||
|
const TString& keybodyfatt = fppro_keys.get();
|
||||||
|
const int numregcont = msk.get_int(F_NUMREG);
|
||||||
|
const int clifor = msk.get_int(F_CODCLIFOR);
|
||||||
|
|
||||||
|
TString update_query;
|
||||||
|
update_query << "UPDATE FPPRO00F\n" <<
|
||||||
|
"SET PZ_TIPOCF = 'F', PZ_CLIFOR = '" << clifor << "', PZ_DATACONT = '" << TDate(TODAY).date2ansi() << "', " <<
|
||||||
|
"PZ_NUMREGCONT = '" << numregcont << "', PZ_DATAREGCONT = '" << data_operazione.date2ansi() << "'\n" <<
|
||||||
|
"WHERE PZ_KEYPRGINVIO = '" << keyprginvio << "' AND PZ_KEYHEADERFATT = '" << keyheaderfatt << "' AND PZ_KEYBODYFATT = '" << keybodyfatt << "';";
|
||||||
|
|
||||||
|
fp_db().sq_set_exec(update_query);
|
||||||
|
ok &= fp_db().sq_commit();
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
error_box("Attenzione non e' stato possibile registrare la fattura nel database.");
|
||||||
|
save_dbmov(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_coll_forzato = true;
|
||||||
|
msk.enable(DLG_CANCEL, false);
|
||||||
|
msk.enable(DLG_QUIT, false);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
int TPrimanota_application::save_fppro()
|
int TPrimanota_application::save_fppro()
|
||||||
{
|
{
|
||||||
TMask& msk = curr_mask();
|
TMask& msk = curr_mask();
|
||||||
|
@ -4310,6 +4310,7 @@ bool TPro_msk::riporta(TMask_field& f)
|
|||||||
//return true;
|
//return true;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
TSheet_field& sf = msk.sfield(F_SHEETFPPROS);
|
TSheet_field& sf = msk.sfield(F_SHEETFPPROS);
|
||||||
|
TString fpprokeys;
|
||||||
|
|
||||||
FOR_EACH_SHEET_ROW(sf, nr, row)
|
FOR_EACH_SHEET_ROW(sf, nr, row)
|
||||||
{
|
{
|
||||||
@ -4317,6 +4318,7 @@ bool TPro_msk::riporta(TMask_field& f)
|
|||||||
{
|
{
|
||||||
app().pro_mask()->set_doc(sf, nr);
|
app().pro_mask()->set_doc(sf, nr);
|
||||||
_riporta = f.dlg() == DLG_OK;
|
_riporta = f.dlg() == DLG_OK;
|
||||||
|
fpprokeys = sf.get_str_row_cell(nr, F_KEYFPPROS);
|
||||||
ok = true;
|
ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4328,13 +4330,26 @@ bool TPro_msk::riporta(TMask_field& f)
|
|||||||
message_box("Nessun documento selezionato.");
|
message_box("Nessun documento selezionato.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!fpprokeys.empty())
|
||||||
|
{
|
||||||
|
app().collega_fppro(fpprokeys);
|
||||||
|
}
|
||||||
|
|
||||||
app().curr_mask().enable(DLG_LINK, false);
|
app().curr_mask().enable(DLG_LINK, false);
|
||||||
app().curr_mask().enable(DLG_EDIT, true);
|
app().curr_mask().enable(DLG_EDIT, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
msk.stop_run(K_QUIT);
|
msk.stop_run(K_QUIT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TPro_msk::riportaNumeroRegistrazione(int n)
|
||||||
|
{
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
void TPro_msk::fppro_selfatt() const
|
void TPro_msk::fppro_selfatt() const
|
||||||
{
|
{
|
||||||
const TMask& mask = *this;
|
const TMask& mask = *this;
|
||||||
|
@ -95,6 +95,7 @@ public:
|
|||||||
|
|
||||||
// Carica documenti FPPRO sulla maschera
|
// Carica documenti FPPRO sulla maschera
|
||||||
bool riporta(TMask_field& f);
|
bool riporta(TMask_field& f);
|
||||||
|
bool riportaNumeroRegistrazione(int n);
|
||||||
bool load_fppro_mask(TMask & msk);
|
bool load_fppro_mask(TMask & msk);
|
||||||
|
|
||||||
TPro_msk(TMask& cg_msk);
|
TPro_msk(TMask& cg_msk);
|
||||||
@ -160,6 +161,7 @@ class TPrimanota_application : public TRelation_application
|
|||||||
// bool _f1_ini;
|
// bool _f1_ini;
|
||||||
// bool _f1_liq;
|
// bool _f1_liq;
|
||||||
TString _num_doc_rif_partite;
|
TString _num_doc_rif_partite;
|
||||||
|
bool _coll_forzato = false; // Abbinato manualmente un documento all FPPRO
|
||||||
friend class TPro_msk;
|
friend class TPro_msk;
|
||||||
|
|
||||||
static bool showpartite_handler(TMask_field& f, KEY k);
|
static bool showpartite_handler(TMask_field& f, KEY k);
|
||||||
@ -279,6 +281,8 @@ protected: // TApplication
|
|||||||
// Metodo chiamato dalla write e rewrite per salvare su db fatt.
|
// Metodo chiamato dalla write e rewrite per salvare su db fatt.
|
||||||
void write_fppro();
|
void write_fppro();
|
||||||
static bool has_tot_doc(TToken_string& fppro_keys);
|
static bool has_tot_doc(TToken_string& fppro_keys);
|
||||||
|
//Collega un movimento contabile al suo doc elettronico
|
||||||
|
bool collega_fppro(TString fpprokeys);
|
||||||
// Salvo dati fornitore e registrazione contabile sul db FPPRO
|
// Salvo dati fornitore e registrazione contabile sul db FPPRO
|
||||||
int save_fppro();
|
int save_fppro();
|
||||||
// Salva sul movimento il riferimento al documento in FPPRO (keys)
|
// Salva sul movimento il riferimento al documento in FPPRO (keys)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user