Patch level : 10.0 706

Files correlati     : pe0.exe
Ricompilazione Demo : [ ]
Commento
         scelta costi sui preventivi
bisognao cambiare le posizione dello sheet da 9 a 10 sui profili personalizzati


git-svn-id: svn://10.65.10.50/trunk@20358 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-04-20 10:41:59 +00:00
parent a18673dc45
commit 9be3a61cee
3 changed files with 37 additions and 14 deletions

View File

@ -26,6 +26,7 @@
#define F_REVISION F_USERFLD+10
#define F_LOAD_COSTS F_USERFLD+11
#define F_COPIA_TUTTO F_USERFLD+12
#define F_TIPO_COSTO F_USERFLD+13
#define FOR_EACH_DOC_ROW_BACK(d, r, row) const TRiga_documento* row = NULL; for (int r = d.rows(); r > 0 && (row = &d[r]) != NULL; r--)
//////////////////////////////////////////
@ -71,8 +72,10 @@ public:
virtual void user_set_handler( short fieldid, int index);
virtual void user_set_row_handler(TMask& rm, short field, int index);
const real get_costo(const TArticolo_giacenza & art);
void update_prezzo_vendita(TMask & row_mask);
void update_costi_ricavi(int row = -1, bool update_sheet = false);
bool var_cost() const { return _field_costo == "VAR"; }
virtual TVariable_mask * riga_mask(int numriga);
virtual void doc2mask(bool reload_clifo = true, bool force_load = false, bool update = true);
@ -595,13 +598,6 @@ bool TGestione_preventivo_msk::pe_new_revision_handler(TMask_field& f, KEY k)
ok = d.write() == NOERR;
if (ok)
{
/* Trucco demenziale che non aggiorna bene ne' la TMask ne' la TRelation_application
mask.doc2mask(false);
mask.load_checks();
mask.mask2doc();
const int err = app().get_relation()->lfile().read(mask.doc());
app().get_relation()->save_status();
*/
mask.enable(DLG_NEXTREC); // Mi assicuro che sia acceso il bottone Avanti
mask.stop_run(K_NEXT); // Passo al documento successivo appena creato
}
@ -620,6 +616,31 @@ bool TGestione_preventivo_msk::pe_new_revision_handler(TMask_field& f, KEY k)
return ok;
}
const real TGestione_preventivo_msk::get_costo(const TArticolo_giacenza & art)
{
if (_field_costo == "VAR")
{
const int annoes = esercizi().date2esc(doc().get_date(DOC_DATADOC));
switch (get_int(F_TIPO_COSTO))
{
case 1 : // Ultimo costo
return art.ultimo_costo(annoes);
case 2 : // Media ultimi costi
return art.media_costi(annoes);
case 4 : // Costo standard
return art.costo_standard(annoes);
case 5 : // Costo medio
return art.costo_medio(annoes, "", "");
case 6 : // Costo medio pond.
return art.costo_mediopond(annoes, "", "");
default :
return ZERO;
}
}
return art.get_real(_field_costo);
}
bool TGestione_preventivo_msk::pe_update_costi_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
@ -648,7 +669,7 @@ bool TGestione_preventivo_msk::pe_update_costi_handler(TMask_field& f, KEY k)
if (codart.full())
{
const TArticolo_giacenza & art = cached_article(codart);
const real costo = art.get_real(mask._field_costo);
const real costo = mask.get_costo(art);
row.put(RDOC_COSTO, costo);
row.autoload(sf);
@ -683,7 +704,7 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
if (codart.full())
{
const TArticolo_giacenza & art = cached_article(codart);
const real costo = art.get_real(mask._field_costo);
const real costo = mask.get_costo(art);
if (has_k)
{
@ -772,7 +793,7 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
}
if (price_enabled)
{
const real costo = art.get_real(mask._field_costo);
const real costo = mask.get_costo(art);
row.put(RDOC_COSTO, costo);
}
@ -1053,7 +1074,7 @@ TGestione_preventivo_msk::TGestione_preventivo_msk(const char* tipodoc) : TDocum
TFilename pn; doc().tipo().profile_name(pn);
TConfig prof(pn, "MAIN");
_field_costo = prof.get("FieldCosto", NULL, -1, ANAMAG_ULTCOS1);
_field_costo = prof.get("FieldCosto", NULL, -1, "VAR");
}
//////////////////////////////////////////
@ -1083,6 +1104,8 @@ TMask* TGestione_preventivo_app::get_mask( int mode )
TSheet_field & sh = m->sfield(F_SHEET);
const int y = m->sh_y() - 1;
if (m->var_cost())
m->add_list(F_TIPO_COSTO, sh.page(), "Tipo costo", 2, y - 1, 20, "", "1|2|4|5|6", "Ultimo costo|Media ultimi costi|Costo standard|Costo medio|Costo medio ponder.");
m->add_button(F_LOAD_COSTS, sh.page(), "Costi", 66, y - 2, 4, 1, "");
m->set_handler(F_LOAD_COSTS, TGestione_preventivo_msk::pe_update_costi_handler);
m->add_button(F_REVISION, sh.page(), "Rev.", 73, y - 2, 4, 1, "");

View File

@ -20,7 +20,7 @@ CANCELLA=
STAMPA=
RAGGRUPPA=
USER=
SHEET_LINE=9
SHEET_LINE=10
// Indica se il documento è indirizzato ad un cliente o ad un fornitore
TIPOCF=C

View File

@ -125,7 +125,7 @@ public:
bool TRelArticoligiac_multirel_app::user_create()
{
bool ok = TMultirel_application::user_create();
TMultirel_application::user_create();
_mask = new TArtgiac_mask;
if (!_mask->livelli_giac().enabled())
@ -133,7 +133,7 @@ bool TRelArticoligiac_multirel_app::user_create()
_rel = new TRelation(LF_ANAMAG);
set_search_field(F_CODART);
return ok;
return true;
}
bool TRelArticoligiac_multirel_app::user_destroy()