Patch level :10.0 futura
Files correlati : Ricompilazione Demo : [ ] Commento :calcolo del fido quasi funzionante! Manca solo la gestione della maschera. git-svn-id: svn://10.65.10.50/trunk@17804 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
07545bcbd0
commit
dda7153508
@ -3063,6 +3063,9 @@ void TDocumento_mask::user_set_handler(short fieldid, int index)
|
|||||||
case 5:
|
case 5:
|
||||||
set_field_handler(fieldid, dummy_hndl);
|
set_field_handler(fieldid, dummy_hndl);
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
set_field_handler(fieldid, fido_hndl);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#include "veini.h"
|
#include "veini.h"
|
||||||
#include "sconti.h"
|
#include "sconti.h"
|
||||||
|
|
||||||
|
#include "velib07.h"
|
||||||
|
|
||||||
#include "../cg/cg2103.h"
|
#include "../cg/cg2103.h"
|
||||||
#include "../db/dblib.h"
|
#include "../db/dblib.h"
|
||||||
#include "../mg/mglib.h"
|
#include "../mg/mglib.h"
|
||||||
@ -143,6 +145,34 @@ bool smart_hndl( TMask_field& field, KEY key )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool fido_hndl(TMask_field& field, KEY key)
|
||||||
|
{
|
||||||
|
if (key == K_ENTER && !field.empty())
|
||||||
|
{
|
||||||
|
TDocumento_mask & m = (TDocumento_mask &) field.mask();
|
||||||
|
const real fido_bau(field.get());
|
||||||
|
const char tipocf = m.get(F_TIPOCF)[0];
|
||||||
|
const long codcf = m.get_long(F_CODCF);
|
||||||
|
const TDate& datadoc = m.get_date(F_DATADOC);
|
||||||
|
TConfig config_ditta(CONFIG_DITTA, "ve");
|
||||||
|
const int riskdays = config_ditta.get_int("FIDO_RISKDAYS");
|
||||||
|
const real perc_toll = config_ditta.get("FIDO_PERCTOLL");
|
||||||
|
//calcola l'esposizione PRIMA del documento corrente
|
||||||
|
const real esposizione = calcola_fido_cliente (tipocf, codcf, datadoc, riskdays);
|
||||||
|
//prende il valore del documento corrente
|
||||||
|
const real totdoc = m.doc().totale_doc();
|
||||||
|
//esposizione comprensiva del documento corrente
|
||||||
|
const real esposizione_totale = esposizione + totdoc;
|
||||||
|
const real fido_con_tolleranza = fido_bau * (CENTO + perc_toll) / CENTO;
|
||||||
|
|
||||||
|
if (esposizione_totale > fido_con_tolleranza)
|
||||||
|
return yesno_box(FR("Attenzione! Il cliente %ld risulta fuori fido.\nEsposizione corrente: %s\n"
|
||||||
|
"Tot. Doc. corrente: %s\nEsposizione totale: %s\nRegistrare ugualmente il documento?"),
|
||||||
|
codcf, esposizione.stringa(), totdoc.stringa(), esposizione_totale.stringa());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool ora_hndl( TMask_field& field, KEY key )
|
bool ora_hndl( TMask_field& field, KEY key )
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -601,6 +601,8 @@ bool TDocument_report::execute_usr_word(unsigned int opcode, TVariant_stack& sta
|
|||||||
// Metodi non appartenenti a classi
|
// Metodi non appartenenti a classi
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
|
|
||||||
|
// METODI PER IL CALCOLO DEL FIDO
|
||||||
|
|
||||||
//estrazioni mastri clienti e/o fornitori
|
//estrazioni mastri clienti e/o fornitori
|
||||||
static const TString_array& mastro(char tipocf)
|
static const TString_array& mastro(char tipocf)
|
||||||
{
|
{
|
||||||
@ -609,7 +611,7 @@ static const TString_array& mastro(char tipocf)
|
|||||||
|
|
||||||
if (a.empty())
|
if (a.empty())
|
||||||
{
|
{
|
||||||
TISAM_recordset mastri("USE PCON SELECT (CONTO!=\"\")&&(SOTTOCONTO="")");
|
TISAM_recordset mastri("USE PCON SELECT (CONTO!=\"\")&&(SOTTOCONTO=\"\")");
|
||||||
for (bool ok = mastri.move_first(); ok; ok = mastri.move_next())
|
for (bool ok = mastri.move_first(); ok; ok = mastri.move_next())
|
||||||
{
|
{
|
||||||
const int gruppo = mastri.get(PCN_GRUPPO).as_int();
|
const int gruppo = mastri.get(PCN_GRUPPO).as_int();
|
||||||
@ -679,7 +681,7 @@ static real calcola_esposto_da_saldaconto (const char tipocf, const long codcf,
|
|||||||
|
|
||||||
TString4 str_tipocf = tipocf;
|
TString4 str_tipocf = tipocf;
|
||||||
partite.set_var("#TIPOCF", TVariant(str_tipocf));
|
partite.set_var("#TIPOCF", TVariant(str_tipocf));
|
||||||
partite.set_var("#CODCFCF", codcf);
|
partite.set_var("#CODCF", codcf);
|
||||||
partite.set_var("#DATACALC", datacalc);
|
partite.set_var("#DATACALC", datacalc);
|
||||||
//data considerante i giorni di rischio ammessi dall'utonto
|
//data considerante i giorni di rischio ammessi dall'utonto
|
||||||
TDate data_sbf = datacalc;
|
TDate data_sbf = datacalc;
|
||||||
@ -754,9 +756,9 @@ static real calcola_fido_da_documenti(const char tipocf, const long codcf, const
|
|||||||
|
|
||||||
TISAM_recordset documenti(query);
|
TISAM_recordset documenti(query);
|
||||||
|
|
||||||
TString4 str_tipocf = tipocf;
|
const char str_tipocf[2] = { tipocf, 0 };
|
||||||
documenti.set_var("#TIPOCF", TVariant(str_tipocf));
|
documenti.set_var("#TIPOCF", TVariant(str_tipocf));
|
||||||
documenti.set_var("#CODCFCF", codcf);
|
documenti.set_var("#CODCF", codcf);
|
||||||
documenti.set_var("#ANNO", TVariant((long)datacalc.year()));
|
documenti.set_var("#ANNO", TVariant((long)datacalc.year()));
|
||||||
documenti.set_var("#DATACALC", datacalc);
|
documenti.set_var("#DATACALC", datacalc);
|
||||||
documenti.set_var("#CODNUM", TVariant(num_fido));
|
documenti.set_var("#CODNUM", TVariant(num_fido));
|
||||||
@ -802,9 +804,11 @@ real calcola_fido_cliente (const char tipocf, const long codcf, const TDate& dat
|
|||||||
//PRIMA PARTE: controlla i movimenti
|
//PRIMA PARTE: controlla i movimenti
|
||||||
real saldo_contabile = calcola_saldo_contabile(tipocf, codcf, datacalc);
|
real saldo_contabile = calcola_saldo_contabile(tipocf, codcf, datacalc);
|
||||||
//SECONDA PARTE: controlla il saldaconto
|
//SECONDA PARTE: controlla il saldaconto
|
||||||
real esposto = calcola_esposto_da_saldaconto(tipocf, codcf, datacalc, riskdays);
|
real esposto_saldaconto = calcola_esposto_da_saldaconto(tipocf, codcf, datacalc, riskdays);
|
||||||
//TERZA PARTE: controlla i documenti
|
//TERZA PARTE: controlla i documenti
|
||||||
real tot_documenti = calcola_fido_da_documenti(tipocf, codcf, datacalc);
|
real tot_documenti = calcola_fido_da_documenti(tipocf, codcf, datacalc);
|
||||||
|
|
||||||
return saldo_contabile + esposto + tot_documenti;
|
return saldo_contabile + esposto_saldaconto + tot_documenti;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FINE METODI PER IL CALCOLO DEL FIDO
|
||||||
|
@ -123,8 +123,7 @@ public:
|
|||||||
// Metodi non appartenenti a classi
|
// Metodi non appartenenti a classi
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
//metodo per il calcolo del fido cliente
|
//metodo per il calcolo del fido cliente
|
||||||
real calcola_fido_cliente (const char tipocf, const long codcf, const TDate& datacalc, const int riskdays,
|
real calcola_fido_cliente (const char tipocf, const long codcf, const TDate& datacalc, const int riskdays);
|
||||||
real& saldo, real& saldo_sbf);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ bool evasion_check_handler( TMask_field& f, KEY key );
|
|||||||
bool codcms_handler(TMask_field &f, KEY key);
|
bool codcms_handler(TMask_field &f, KEY key);
|
||||||
bool numdocrif_hndl(TMask_field& field, KEY key);
|
bool numdocrif_hndl(TMask_field& field, KEY key);
|
||||||
bool smart_hndl(TMask_field& field, KEY key);
|
bool smart_hndl(TMask_field& field, KEY key);
|
||||||
|
bool fido_hndl(TMask_field& field, KEY key);
|
||||||
|
|
||||||
bool tipodoc_ok(const TString & tipodoc);
|
bool tipodoc_ok(const TString & tipodoc);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user