select katsopr.NSOPR,katmc.name,spsopr.kolfact,mnplan.number,VALSPMNP.kolfield7,VALSPMNP.kolfield5
from katsopr,objacct,spsopr,mnplan,SpObjAcc,VALSPMNP,SpMnPlan,SpMnPl,katmc
where
((
281474982447392==katsopr.nrec
and katsopr.nrec==objacct.cowner
and objacct.cobject==mnplan.nrec
and katsopr.nrec==spsopr.csopr
and mnplan.nrec == SpMnPlan.cMnPlan
and SpMnPlan.Nrec == SpMnPl.cSpMnPlan
and 23 == SpMnPl.wKolAn
and 1 == SpObjAcc.Kindrec
and 18 == SpObjAcc.typePos
and SpMnPl.Nrec == SpObjAcc.cPos
and 45 == SpObjAcc.typeObj // тип позиции накладной
and 502 == SpObjAcc.VidSopr // НГП
and SpMnPl.nrec == VALSPMNP.cSpMnPl
and spsopr.CMCUSL==katmc.nrec
))
and spsopr.nrec = spobjacc.cobject
;
select katsopr.NSOPR,katmc.name,spsopr.kolfact,mnplan.number,VALSPMNP.kolfield7,VALSPMNP.kolfield5
from katsopr,objacct,spsopr,mnplan,SpObjAcc,VALSPMNP,SpMnPlan,SpMnPl,katmc
where
((
objacct.cowner /== katsopr.nrec and (281474982447392 = katsopr.nrec)
and objacct.cobject == mnplan.nrec
and katsopr.nrec == spsopr.csopr
and mnplan.nrec == SpMnPlan.cMnPlan
and SpMnPlan.Nrec == SpMnPl.cSpMnPlan
and 23 == SpMnPl.wKolAn
and 1 == SpObjAcc.Kindrec (noindex)
and 18 == SpObjAcc.typePos
and SpMnPl.Nrec == SpObjAcc.cPos
and 45 == SpObjAcc.typeObj // тип позиции накладной
and SpMnPl.nrec == VALSPMNP.cSpMnPl
and spsopr.CMCUSL == katmc.nrec
and spsopr.nrec == spobjacc.cobject
));