details: https://code.openbravo.com/erp/devel/pi/rev/b15c3a32fea5 changeset: 17573:b15c3a32fea5 user: Javier Etxarri <javier.echarri <at> openbravo.com> date: Mon Jul 30 17:31:41 2012 +0200 summary: Fixes issue 20926: Generate Average Cost process should not consider elements in closed periods to be unposted
diffstat: src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml | 14 +++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diffs (31 lines): diff -r 96b2297ea85b -r b15c3a32fea5 src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml --- a/src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml Mon Jul 30 13:51:36 2012 +0200 +++ b/src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml Mon Jul 30 17:31:41 2012 +0200 @@ -148,6 +148,17 @@ IF (v_MinDateCosting IS NULL OR v_MinFirstInOut < v_MinDateCosting) THEN v_MinDateCosting := v_MinFirstInOut; END IF; + + SELECT GREATEST(MAX(enddate),v_MinDateCosting) ENDDATE + INTO v_MinDateCosting + FROM (SELECT enddate + 1 ENDDATE + FROM c_periodcontrol cpc JOIN c_period cp ON cpc.c_period_id = cp.c_period_id + WHERE (periodstatus='C' OR periodstatus='P') AND cp.ad_client_id = v_Client + GROUP BY enddate,cp.c_period_id + HAVING NOT EXISTS (SELECT 1 FROM c_periodcontrol pc + WHERE c_period_id=cp.c_period_id AND periodstatus='O') + ) periodClosed; + END IF; v_CheckResultStr := ''; @@ -311,7 +322,8 @@ AND ISMANUAL='N' AND COSTTYPE='AV' AND ISPRODUCTION = 'N' - AND AD_CLIENT_ID = v_Client; + AND AD_CLIENT_ID = v_Client + AND DATEFROM > v_MinDateCosting; v_rowcount:=SQL%ROWCOUNT; v_Deleted:=v_Deleted + v_rowcount; v_rowcount:=SQL%ROWCOUNT; ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits