From e0be8dc3ec932552c90aa4c0c6e8eb5641bc9bf1 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 11 Mar 2011 14:47:59 +0000 Subject: [PATCH] Patch level : 10.952 Files correlati : mg4.exe Ricompilazione Demo : [ ] Commento : MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 0001806: Diana2000 - chiusure di magazzino dopo la chiusura di magazzino, lanciando l'inventario non vengono reperiti i costi se selezionato ultimo costo. Ho verificato che : su stomag nel campo ultcos1 ci sono degli importi corretti; il record di stomag ha anno di riferimento = 2011 e anno costo = 2010, lanciando l'inventario per il 2010 i costi sono a 0, lanciando l'inventario i valori ci sono ma viene giustamente esposta la giacenza del 2011. Inolte chiedono di poter selezionare anche il deposito oltre al magazzino (ora รจ possibile solo richiedere la stampa di tutti i magazzini) Nota : L'inventario e' per magazzino. Per questa parte si dovrebbe aprire una segnalazione per poi discuterla git-svn-id: svn://10.65.10.50/branches/R_10_00@21775 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- mg/mglib02.cpp | 63 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/mg/mglib02.cpp b/mg/mglib02.cpp index 1ed35c49f..6694214cb 100755 --- a/mg/mglib02.cpp +++ b/mg/mglib02.cpp @@ -854,12 +854,17 @@ real TArticolo_giacenza::ultimo_costo(int annoes) const } else { - const int index = find_storico(annoes); - - if (index >= 0 ) + const int nextes = esercizi().next(annoes); + + if (nextes > 0) { - const real costo = storico(annoes).row(index).get_real(STOMAG_ULTCOS1); - return costo.is_zero() ? costo_standard(annoes) : costo; + const int index = find_storico(nextes); + + if (index >= 0 ) + { + const real costo = storico(nextes).row(index).get_real(STOMAG_ULTCOS1); + return costo.is_zero() ? costo_standard(annoes) : costo; + } } } return ZERO; @@ -875,18 +880,23 @@ real TArticolo_giacenza::media_costi(int annoes) const } else { - const int index = find_storico(annoes); - - if (index >= 0 ) + const int nextes = esercizi().next(annoes); + + if (nextes > 0) { - const TRectype & rec = storico(annoes).row(index); - real costo = rec.get_real(STOMAG_ULTCOS1); - - costo = (costo + rec.get_real(STOMAG_ULTCOS2)) / 2.0; - return costo.is_zero() ? costo_standard(annoes) : costo; + const int index = find_storico(nextes); + + if (index >= 0 ) + { + const TRectype & rec = storico(nextes).row(index); + real costo = rec.get_real(STOMAG_ULTCOS1); + + costo = (costo + rec.get_real(STOMAG_ULTCOS2)) / 2.0; + return costo.is_zero() ? costo_standard(annoes) : costo; + } } } - return ZERO; + return ZERO; } real TArticolo_giacenza::prezzo_listino(int annoes, const char * catven, const char * codlist) const @@ -909,11 +919,16 @@ real TArticolo_giacenza::prezzo_listino(int annoes, const char * catven, const c } else { - const int index = find_storico(annoes); + const int nextes = esercizi().next(annoes); + + if (nextes > 0) + { + const int index = find_storico(nextes); - if (index >= 0 ) - return storico(annoes).row(index).get_real(STOMAG_PRZLIST); - } + if (index >= 0 ) + return storico(nextes).row(index).get_real(STOMAG_PRZLIST); + } + } return ZERO; } @@ -923,10 +938,14 @@ real TArticolo_giacenza::costo_standard(int annoes) const return get_real(ANAMAG_COSTSTD); else { - const int index = find_storico(annoes); - - if (index >= 0 ) - return storico(annoes).row(index).get_real(STOMAG_COSTSTD); + const int nextes = esercizi().next(annoes); + if (nextes > 0) + { + const int index = find_storico(nextes); + + if (index >= 0 ) + return storico(nextes).row(index).get_real(STOMAG_COSTSTD); + } } return ZERO; }