Patch level : 2.0 518
Files correlati : sv0400a.msk sv1.exe sv1100a.frm Ricompilazione Demo : [ ] Commento : GF20054 La statistica per articoli omaggio non viene evidenziata se non ho spuntato anche righe merci, inoltre evidenzia solo una statistica per qta riportando i valori a zero. git-svn-id: svn://10.65.10.50/trunk@11299 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d1dfee1373
commit
ac7f6b9cd9
@ -9,6 +9,7 @@
|
||||
#define F_PRESTAZIONI 112
|
||||
#define F_OMAGGI 113
|
||||
#define F_RAGGRUPPA_OMAGGI 114
|
||||
#define F_OMAGGI_VALORE 115
|
||||
#define F_AGENTE 121
|
||||
#define F_CLIENTE 122
|
||||
#define F_ZONA 123
|
||||
|
@ -62,12 +62,6 @@ BEGIN
|
||||
FIELD StatPrestazioni
|
||||
END
|
||||
|
||||
BOOLEAN F_SPESEDOC
|
||||
BEGIN
|
||||
PROMPT 40 6 "Includi righe Spese"
|
||||
FIELD StatSpesedoc
|
||||
END
|
||||
|
||||
BOOLEAN F_OMAGGI
|
||||
BEGIN
|
||||
PROMPT 2 7 "Includi righe Omaggi"
|
||||
@ -76,12 +70,23 @@ BEGIN
|
||||
MESSAGE TRUE ENABLE,F_RAGGRUPPA_OMAGGI
|
||||
END
|
||||
|
||||
BOOLEAN F_SPESEDOC
|
||||
BEGIN
|
||||
PROMPT 40 5 "Includi righe Spese"
|
||||
FIELD StatSpesedoc
|
||||
END
|
||||
|
||||
BOOLEAN F_RAGGRUPPA_OMAGGI
|
||||
BEGIN
|
||||
PROMPT 40 7 "Raggruppa Omaggi con Merce"
|
||||
PROMPT 40 6 "Raggruppa Omaggi con Merce"
|
||||
FIELD OmaggioIsMerce
|
||||
END
|
||||
|
||||
BOOLEAN F_OMAGGI_VALORE
|
||||
BEGIN
|
||||
PROMPT 40 7 "Valorizza Omaggi"
|
||||
FIELD OmaggioValore
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 5
|
||||
BEGIN
|
||||
|
@ -7,8 +7,8 @@ int main(int argc, char** argv)
|
||||
int n = argc > 1 ? atoi(argv[1]+1) : 0;
|
||||
switch(n)
|
||||
{
|
||||
case 1 : sv1200(argc, argv); break;
|
||||
default: sv1100(argc, argv); break;
|
||||
case 1 : sv1200(argc, argv); break; // Stampa Statistiche
|
||||
default: sv1100(argc, argv); break; // Stampa Schede
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
|
@ -138,7 +138,7 @@ BEGIN
|
||||
FIELD R0
|
||||
END
|
||||
|
||||
NUMERO FF_SECONDCOLUMN 17
|
||||
VALUTA FF_SECONDCOLUMN 17
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Totale" "Totale"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
|
@ -363,7 +363,7 @@ class TStampa_stat : public TPrint_application
|
||||
TFrequenza_colonne _freq;
|
||||
TCodart_livelli* _liv_art;
|
||||
TCodgiac_livelli* _liv_giac;
|
||||
TRecord_cache *_magazz,*_tipodoc,*_catven,*_zone,*_ums;
|
||||
TRecord_cache *_tipodoc,*_catven;
|
||||
TLocalisamfile * _umart,*_anamag,*_clifor,*_agenti;
|
||||
TTable *_spp, *_prs;
|
||||
|
||||
@ -1227,10 +1227,9 @@ void TStampa_stat::set_filled_row(char section,int row,char c,int pos,int len)
|
||||
void TStampa_stat::set_row_atpos(char section,int nrow,const char * f,int pos)
|
||||
{
|
||||
TString256 ss;
|
||||
int l=strlen(f);
|
||||
ss.cut(0);
|
||||
if (pos <= _colpage*_pagewidth)
|
||||
{
|
||||
int l = strlen(f);
|
||||
const int firstpos=(_colpage-1)*_pagewidth;
|
||||
if (pos+l >= firstpos)
|
||||
{
|
||||
@ -1371,11 +1370,8 @@ bool TStampa_stat::user_create()
|
||||
_liv_art = new TCodart_livelli;
|
||||
_liv_giac = new TCodgiac_livelli;
|
||||
|
||||
_magazz = new TRecord_cache("MAG");
|
||||
_ums = new TRecord_cache("%UMS");
|
||||
_tipodoc = new TRecord_cache("%TIP");
|
||||
_catven = new TRecord_cache("CVE");
|
||||
_zone = new TRecord_cache("ZON");
|
||||
|
||||
_umart = new TLocalisamfile(LF_UMART);
|
||||
_anamag = new TLocalisamfile(LF_ANAMAG);
|
||||
@ -1409,11 +1405,8 @@ bool TStampa_stat::user_destroy()
|
||||
delete _liv_art;
|
||||
delete _liv_giac;
|
||||
// cancella le cache
|
||||
delete _ums;
|
||||
delete _magazz;
|
||||
delete _tipodoc;
|
||||
delete _catven;
|
||||
delete _zone;
|
||||
// cancella i files
|
||||
delete _umart;
|
||||
delete _anamag;
|
||||
@ -1784,8 +1777,9 @@ void TStampa_stat::standardize_um(TSVriep_record& rieprec, bool force)
|
||||
else
|
||||
{
|
||||
// non è un articolo: converte in base alla UM di riferimento in tabella
|
||||
um=_ums->get(um).get("S7");
|
||||
fc=_ums->get(um).get_real("R10");
|
||||
const TRectype& ums = cache().get("%UMS", um);
|
||||
um = ums.get("S7");
|
||||
fc = ums.get_real("R10");
|
||||
}
|
||||
if (um != rieprec.get(SVS_UMQTA))
|
||||
{
|
||||
@ -1820,13 +1814,13 @@ const real TStampa_stat::fc_um(const TRectype& statrec,const TSVriep_record& rie
|
||||
{
|
||||
// è una UM dell'articolo: uso i fc per convertirla
|
||||
um=_umart->get(UMART_UM);
|
||||
fc=fc/_umart->get_real(UMART_FC);
|
||||
fc /= _umart->get_real(UMART_FC);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TString a = rieprec.get(SVR_CODART); a.trim();
|
||||
TString u = rieprec.get(SVR_UMQTA);
|
||||
TString80 a = rieprec.get(SVR_CODART); a.trim();
|
||||
TString4 u = rieprec.get(SVR_UMQTA);
|
||||
error_box("L'articolo '%s' non ha l'unita' di misura %s\n"
|
||||
"ma esistono statistiche che la utilizzano ugualmente",
|
||||
(const char*)a, (const char*)u);
|
||||
@ -1834,8 +1828,9 @@ const real TStampa_stat::fc_um(const TRectype& statrec,const TSVriep_record& rie
|
||||
}
|
||||
if (um != statrec.get(SVS_UMQTA))
|
||||
{
|
||||
um=_ums->get(um).get("S7");
|
||||
fc=_ums->get(um).get_real("R10");
|
||||
const TRectype& ums = cache().get("%UMS", um);
|
||||
um = ums.get("S7");
|
||||
fc = ums.get_real("R10");
|
||||
}
|
||||
if (um != statrec.get(SVS_UMQTA))
|
||||
{
|
||||
@ -2342,11 +2337,11 @@ const TString& TStampa_stat::get_descrpart(const char *lev_code, TSVriep_record
|
||||
_agenti->zero();
|
||||
return _agenti->get(AGE_RAGSOC);
|
||||
case CHR_MAGAZZ: // mag
|
||||
return _magazz->get(rieprec.get(SVR_MAG)).get("S0");
|
||||
return cache().get("MAG", rieprec.get(SVR_MAG), "S0");
|
||||
case CHR_ZONA: // zona
|
||||
return _zone->get(rieprec.get(SVR_ZONA)).get("S0");
|
||||
return cache().get("ZON", rieprec.get(SVR_ZONA), "S0");
|
||||
case CHR_UMISURA: // Unità di misura
|
||||
return _ums->get(rieprec.get(SVR_UMQTA)).get("S0");
|
||||
return cache().get("%UMS", rieprec.get(SVR_UMQTA), "S0");
|
||||
default:
|
||||
NFCHECK("ai chent recognaiz the code of the key part!");
|
||||
return EMPTY_STRING;
|
||||
|
@ -90,7 +90,7 @@ NUMBER F_NUMERO 3
|
||||
BEGIN
|
||||
PROMPT 74 4 ""
|
||||
FLAGS "U"
|
||||
NUM_EXPR #THIS_FIELD>0
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Inserire un numero maggiore di zero"
|
||||
END
|
||||
|
||||
|
@ -335,6 +335,7 @@ void TStats_agg::init()
|
||||
_spesedoc = ini.get_bool("StatSpesedoc");
|
||||
_omaggi = ini.get_bool("StatOmaggi");
|
||||
_omaggio_is_merce = ini.get_bool("OmaggioIsMerce");
|
||||
_omaggi_valore = ini.get_bool("OmaggioValore");
|
||||
|
||||
_art_nocode = ini.get_bool("ArtNoCode");
|
||||
_art_noanag = ini.get_bool("ArtNoAnag");
|
||||
@ -464,30 +465,28 @@ bool TStats_agg::can_add(const TRiga_documento& rdoc) const
|
||||
test_firm();
|
||||
|
||||
const TTipo_documento& tip = rdoc.doc().tipo();
|
||||
bool ok = tip.statistiche();
|
||||
const char tipo = rdoc.tipo().tipo();
|
||||
|
||||
if (ok)
|
||||
bool ok = tip.statistiche();
|
||||
if (ok) // Controlla se il tipo documento e' attivo per le statistiche
|
||||
{
|
||||
const char tipo = rdoc.tipo().tipo();
|
||||
switch(tipo)
|
||||
{
|
||||
case RIGA_MERCE : ok = _merce; break;
|
||||
case RIGA_OMAGGI : ok = _omaggi; break;
|
||||
case RIGA_PRESTAZIONI: ok = _prestazioni; break;
|
||||
case RIGA_SPESEDOC : ok = _spesedoc; break;
|
||||
default : ok = FALSE; break;
|
||||
default : ok = false; break;
|
||||
}
|
||||
if (ok && (tipo == RIGA_MERCE || tipo == RIGA_OMAGGI) && !rdoc.is_articolo())
|
||||
{
|
||||
const TString& codart = rdoc.get(RDOC_CODART);
|
||||
if (codart.empty())
|
||||
ok = _art_nocode;
|
||||
else
|
||||
ok = _art_noanag;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok && (tipo == RIGA_MERCE || tipo == RIGA_OMAGGI) && !rdoc.is_articolo())
|
||||
{
|
||||
const TString& codart = rdoc.get(RDOC_CODART);
|
||||
if (codart.empty())
|
||||
ok = _art_nocode;
|
||||
else
|
||||
ok = _art_noanag;
|
||||
}
|
||||
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -496,64 +495,57 @@ void TStats_agg::reset()
|
||||
_data.destroy();
|
||||
}
|
||||
|
||||
bool TStats_agg::sub(const TRiga_documento& rdoc)
|
||||
{
|
||||
bool ok = can_add(rdoc);
|
||||
bool TStats_agg::algebric_sum(const TRiga_documento& rdoc, int sign)
|
||||
{
|
||||
const bool ok = can_add(rdoc);
|
||||
if (ok)
|
||||
{
|
||||
TStats_data& data = find(rdoc);
|
||||
|
||||
real val_riga;
|
||||
const TDocumento & d = rdoc.doc();
|
||||
|
||||
if (_valfield.empty())
|
||||
val_riga = rdoc.imponibile();
|
||||
{
|
||||
if (_omaggi_valore && rdoc.is_omaggio())
|
||||
val_riga = rdoc.imponibile_omaggio();
|
||||
else
|
||||
val_riga = rdoc.imponibile();
|
||||
}
|
||||
else
|
||||
val_riga = rdoc.get_real(_valfield);
|
||||
if (d.in_valuta())
|
||||
|
||||
const TDocumento& d = rdoc.doc();
|
||||
if (d.in_valuta())
|
||||
{
|
||||
TCurrency_documento v(val_riga, d);
|
||||
v.change_to_firm_val();
|
||||
val_riga = v.get_num();
|
||||
}
|
||||
data._valore -= val_riga;
|
||||
|
||||
if (sign < 0)
|
||||
data._valore -= val_riga;
|
||||
else
|
||||
data._valore += val_riga;
|
||||
|
||||
real qta = rdoc.quantita();
|
||||
|
||||
if (qta.is_zero())
|
||||
qta = 1.0;
|
||||
data._quantita -= qta;
|
||||
qta = UNO;
|
||||
|
||||
if (sign < 0)
|
||||
data._quantita -= qta;
|
||||
else
|
||||
data._quantita += qta;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TStats_agg::sub(const TRiga_documento& rdoc)
|
||||
{
|
||||
return algebric_sum(rdoc, -1);
|
||||
}
|
||||
|
||||
bool TStats_agg::add(const TRiga_documento& rdoc)
|
||||
{
|
||||
bool ok = can_add(rdoc);
|
||||
if (ok)
|
||||
{
|
||||
TStats_data& data = find(rdoc);
|
||||
real val_riga;
|
||||
const TDocumento & d = rdoc.doc();
|
||||
|
||||
if (_valfield.empty())
|
||||
val_riga = rdoc.imponibile();
|
||||
else
|
||||
val_riga = rdoc.get_real(_valfield);
|
||||
if (d.in_valuta())
|
||||
{
|
||||
TCurrency_documento v(val_riga, d);
|
||||
v.change_to_firm_val();
|
||||
val_riga = v.get_num();
|
||||
}
|
||||
data._valore += val_riga;
|
||||
|
||||
real qta = rdoc.quantita();
|
||||
|
||||
if (qta.is_zero())
|
||||
qta = 1.0;
|
||||
data._quantita += qta;
|
||||
}
|
||||
return ok;
|
||||
return algebric_sum(rdoc, +1);
|
||||
}
|
||||
|
||||
bool TStats_agg::empty()
|
||||
|
@ -59,7 +59,7 @@ class TStats_agg : public TObject
|
||||
TAssoc_array _data;
|
||||
|
||||
TFrequenza_statistiche _frequenza;
|
||||
bool _merce, _prestazioni, _spesedoc, _omaggi, _omaggio_is_merce;
|
||||
bool _merce, _prestazioni, _spesedoc, _omaggi, _omaggio_is_merce, _omaggi_valore;
|
||||
bool _art_nocode, _art_noanag, _art_noanag_grp;
|
||||
bool _agente, _cliente, _zona, _articolo, _giacenza, _magazzino,_catvend;
|
||||
TString16 _valfield;
|
||||
@ -69,6 +69,7 @@ protected:
|
||||
void put_key(TRectype& stat, TToken_string& key) const;
|
||||
TStats_agg::TStats_data& find(const TRiga_documento& rdoc);
|
||||
bool can_add(const TRiga_documento& rdoc) const;
|
||||
bool algebric_sum(const TRiga_documento& rdoc, int sign); // Implements Add and Sub
|
||||
|
||||
public:
|
||||
void init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user