MyTetra Share
Делитесь знаниями!
RecalculationAmount
Время создания: 23.09.2019 14:11
Раздел: INFO - JOB - CUBA - GroovyScripts
Запись: wwwlir/Tetra/master/base/1569219060a6gpvryfg7/text.html на raw.githubusercontent.com

import com.haulmont.cuba.core.global.*

import com.groupstp.rtneo.entity.*


DataManager dataManager = AppBeans.get(DataManager.NAME)

String contrId = '3b74c39f-b58b-e73f-76ae-4dfeb2f72201';

List<ContragentRealEstate> cres = dataManager.load(ContragentRealEstate.class)

.query('select e from rtneo$ContragentRealEstate e where e.contragent.id = :contrId order by e.id')

.parameter("contrId", UUID.fromString(contrId))

.view("contragentRealEstate-calc")

.list();

log.debug(cres.size());

for(i=0;i<cres.size();i++)

{

if(cres.get(i).getCategory()!=null && cres.get(i).getCategory().getUnit()!=null && cres.get(i).getCategory().getUnit().getIsArea()&& cres.get(i).getCategory().getIsLiving()!=true && cres.get(i).getShare()<1 && cres.get(i).getShare()>0 )

{

area =cres.get(i).getRealEstate().getArea()

ownType=cres.get(i).getOwnType()

if(area!=null && ownType!=null && ownType.toString()=='OWN' )

{

ContragentRealEstate cre=cres.get(i)

oldCalc=cre.getCalculationAmount();

////////////log.debug(cre.getRealEstate().getArea())

cre.setCalculationAmount(cres.get(i).getShare()*area);

newCalc=cre.getCalculationAmount();

log.debug(cres.get(i).getShare().multiply(area));

log.debug(cre.getId().toString()+":"+oldCalc+":"+newCalc);

dataManager.commit(cre);

}

}

}

Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования