Входные параметры
Параметр | Тип | Описание |
---|---|---|
RESIDUEDATE |
DATE |
|
CROPID |
INTEGER |
|
CLASSID |
INTEGER |
|
OWNERID |
INTEGER |
|
CONTRACTID |
INTEGER |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
CROPFULLNAME |
VARCHAR(150) |
|
CROPTYPEID |
INTEGER |
|
HARVESTYEAR |
INTEGER |
|
CARGORESIDUE |
INTEGER |
|
HUMIDITY |
DECIMAL(4,2) |
|
GRAINUNIT |
INTEGER |
|
GLUTEN |
DECIMAL(4,2) |
|
GLUTENQUALITY |
INTEGER |
|
PROTEIN |
DECIMAL(4,2) |
|
GOLOVNEVIE |
DECIMAL(15,4) |
|
DROPNUMBER |
INTEGER |
|
GLASSNESS |
INTEGER |
|
TURTLEBUG |
DECIMAL(4,2) |
|
OIL_M |
DECIMAL(4,2) |
|
DIRT |
DECIMAL(4,2) |
|
MINERAL |
DECIMAL(4,2) |
|
SPOILT |
DECIMAL(4,2) |
|
DIRTSEED |
DECIMAL(4,2) |
|
ORGANIC |
DECIMAL(4,2) |
|
FUSARIOSE |
DECIMAL(4,2) |
|
BRAND |
DECIMAL(4,2) |
|
D_MAIZE |
DECIMAL(4,2) |
|
D_PEA |
DECIMAL(4,2) |
|
D_OATS |
DECIMAL(4,2) |
|
D_SUNFLOWER |
DECIMAL(4,2) |
|
D_SOY |
DECIMAL(4,2) |
|
SCREENING |
DECIMAL(4,2) |
|
ACROSPIRE |
DECIMAL(4,2) |
|
DEFECTIVE |
DECIMAL(4,2) |
|
BEATEN |
DECIMAL(4,2) |
|
CORRODED |
DECIMAL(4,2) |
|
GREEN |
DECIMAL(4,2) |
|
NEVYPOLNENNYE |
DECIMAL(4,2) |
|
SMALLGRAIN |
DECIMAL(4,2) |
|
NAKED |
DECIMAL(4,2) |
|
S_BARLEY |
DECIMAL(4,2) |
|
S_RYE |
DECIMAL(4,2) |
|
S_PEA |
DECIMAL(4,2) |
|
S_TRITICALE |
DECIMAL(4,2) |
|
S_MAIZE |
DECIMAL(4,2) |
|
S_SOY |
DECIMAL(4,2) |
|
S_PROSO |
DECIMAL(4,2) |
|
Описание
Остаток груза по клиенту/культуре
Определение
CREATE PROCEDURE ACN_CARGO_RESIDUE(
RESIDUEDATE DATE,
CROPID INTEGER,
CLASSID INTEGER,
OWNERID INTEGER,
CONTRACTID INTEGER)
RETURNS (
CROPFULLNAME VARCHAR(150),
CROPTYPEID INTEGER,
HARVESTYEAR INTEGER,
CARGORESIDUE INTEGER,
HUMIDITY DECIMAL(4,2),
GRAINUNIT INTEGER,
GLUTEN DECIMAL(4,2),
GLUTENQUALITY INTEGER,
PROTEIN DECIMAL(4,2),
GOLOVNEVIE DECIMAL(15,4),
DROPNUMBER INTEGER,
GLASSNESS INTEGER,
TURTLEBUG DECIMAL(4,2),
OIL_M DECIMAL(4,2),
DIRT DECIMAL(4,2),
MINERAL DECIMAL(4,2),
SPOILT DECIMAL(4,2),
DIRTSEED DECIMAL(4,2),
ORGANIC DECIMAL(4,2),
FUSARIOSE DECIMAL(4,2),
BRAND DECIMAL(4,2),
D_MAIZE DECIMAL(4,2),
D_PEA DECIMAL(4,2),
D_OATS DECIMAL(4,2),
D_SUNFLOWER DECIMAL(4,2),
D_SOY DECIMAL(4,2),
SCREENING DECIMAL(4,2),
ACROSPIRE DECIMAL(4,2),
DEFECTIVE DECIMAL(4,2),
BEATEN DECIMAL(4,2),
CORRODED DECIMAL(4,2),
GREEN DECIMAL(4,2),
NEVYPOLNENNYE DECIMAL(4,2),
SMALLGRAIN DECIMAL(4,2),
NAKED DECIMAL(4,2),
S_BARLEY DECIMAL(4,2),
S_RYE DECIMAL(4,2),
S_PEA DECIMAL(4,2),
S_TRITICALE DECIMAL(4,2),
S_MAIZE DECIMAL(4,2),
S_SOY DECIMAL(4,2),
S_PROSO DECIMAL(4,2))
AS
declare variable PARTYID integer;
declare variable BEGINDATE date;
declare variable OUTCOMELASTDATE date;
declare variable OUTCOMELASTINVENTORYID integer;
declare variable HARVESTYEAR_C integer;
declare variable OUTCOMERESIDUE integer;
declare variable AFTEROUTCOMERESIDUE integer;
declare variable HUMIDITY_C decimal(15,4);
declare variable GRAINUNIT_C decimal(15,4);
declare variable GLUTEN_C decimal(15,0);
declare variable GLUTENQUALITY_C decimal(15,4);
declare variable PROTEIN_C decimal(15,4);
declare variable GOLOVNEVIE_C decimal(15,4);
declare variable DROPNUMBER_C decimal(15,4);
declare variable GLASSNESS_C decimal(15,4);
declare variable TURTLEBUG_C decimal(15,4);
declare variable OIL_M_C decimal(15,4);
declare variable DIRT_C decimal(15,4);
declare variable MINERAL_C decimal(15,4);
declare variable SPOILT_C decimal(15,4);
declare variable DIRTSEED_C decimal(15,4);
declare variable ORGANIC_C decimal(15,4);
declare variable FUSARIOSE_C decimal(15,4);
declare variable BRAND_C decimal(15,4);
declare variable D_MAIZE_C decimal(15,4);
declare variable D_PEA_C decimal(15,4);
declare variable D_OATS_C decimal(15,4);
declare variable D_SUNFLOWER_C decimal(15,4);
declare variable D_SOY_C decimal(15,4);
declare variable SCREENING_C decimal(15,4);
declare variable ACROSPIRE_C decimal(15,4);
declare variable DEFECTIVE_C decimal(15,4);
declare variable BEATEN_C decimal(15,4);
declare variable CORRODED_C decimal(15,4);
declare variable GREEN_C decimal(15,4);
declare variable NEVYPOLNENNYE_C decimal(15,4);
declare variable SMALLGRAIN_C decimal(15,4);
declare variable NAKED_C decimal(15,4);
declare variable S_BARLEY_C decimal(15,4);
declare variable S_RYE_C decimal(15,4);
declare variable S_PEA_C decimal(15,4);
declare variable S_TRITICALE_C decimal(15,4);
declare variable S_MAIZE_C decimal(15,4);
declare variable S_SOY_C decimal(15,4);
declare variable S_PROSO_C decimal(15,4);
begin
for
select PARTIES.PARTYID, PARTIES.BEGINDATE, QUALITY_CROPFULLNAME.CROPFULLNAME,
(select CROP.CROPTYPEID from CROP where (CROP.CROPID = :CROPID)) CROPTYPEID
from PARTIES
left join QUALITY_CROPFULLNAME(:CROPID, PARTIES.CLASSID, null, 1) on (0=0)
where (PARTIES.CROPID = :CROPID)
and ((:CLASSID = -1) or (PARTIES.CLASSID = :CLASSID))
and (PARTIES.STATE = 1)
order by PARTIES.PARTYNAME
into :PARTYID, :BEGINDATE, :CROPFULLNAME, :CROPTYPEID
do begin
CARGORESIDUE = null;
OUTCOMERESIDUE = null;
AFTEROUTCOMERESIDUE = null;
HARVESTYEAR = null;
HUMIDITY_C = null;
GRAINUNIT_C = null;
GLUTEN_C = null;
GLUTENQUALITY_C = null;
PROTEIN_C = null;
GOLOVNEVIE_C = null;
DROPNUMBER_C = null;
GLASSNESS_C = null;
TURTLEBUG_C = null;
OIL_M_C = null;
DIRT_C = null;
MINERAL_C = null;
SPOILT_C = null;
DIRTSEED_C = null;
ORGANIC_C = null;
FUSARIOSE_C = null;
BRAND_C = null;
D_MAIZE_C = null;
D_PEA_C = null;
D_OATS_C = null;
D_SUNFLOWER_C = null;
D_SOY_C = null;
SCREENING_C = null;
ACROSPIRE_C = null;
DEFECTIVE_C = null;
BEATEN_C = null;
CORRODED_C = null;
GREEN_C = null;
NEVYPOLNENNYE_C = null;
SMALLGRAIN_C = null;
NAKED_C = null;
S_BARLEY_C = null;
S_RYE_C = null;
S_PEA_C = null;
S_TRITICALE_C = null;
S_MAIZE_C = null;
S_SOY_C = null;
S_PROSO_C = null;
select coalesce(max(IT.REGDATE),:BEGINDATE), max(IT.INVENTORYID)
from IT
where (IT.PARTYID = :PARTYID) and (IT.REGDATE > :BEGINDATE)
and (IT.OPERATIONID = 5) and (IT.OWNERID = :OWNERID) and (IT.STATE >= 0)
and ((:CONTRACTID = -1) or (IT.CONTRACTID = :CONTRACTID))
into :OUTCOMELASTDATE, :OUTCOMELASTINVENTORYID;
select
sum(case
when ((IT.OPERATIONID = 1) or ((IT.OPERATIONID = 17) and (IT.NET > 0))) then
IT.NET
else
case
when ((IT.OPERATIONID = 17) and (IT.NET < 0)) then
IT.NET
else -IT.NET
end
end),
QUALITY_SELECT.HARVESTYEAR, QUALITY_SELECT.HUMIDITY, QUALITY_SELECT.GRAINUNIT, QUALITY_SELECT.GLUTEN,
QUALITY_SELECT.GLUTENQUALITY, QUALITY_SELECT.PROTEIN, QUALITY_SELECT.GOLOVNEVIE,
QUALITY_SELECT.DROPNUMBER, QUALITY_SELECT.GLASSNESS, QUALITY_SELECT.TURTLEBUG, QUALITY_SELECT.OIL_M,
QUALITY_SELECT.DIRT, QUALITY_SELECT.MINERAL, QUALITY_SELECT.SPOILT, QUALITY_SELECT.DIRTSEED,
QUALITY_SELECT.ORGANIC, QUALITY_SELECT.FUSARIOSE, QUALITY_SELECT.BRAND,
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 81, 2, QUALITY_SELECT.MAIZE))), -- кукуруза
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 114, 2, QUALITY_SELECT.PEA))), -- горох
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 115, 2, QUALITY_SELECT.OATS))), -- овес
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 82, 2, QUALITY_SELECT.SUNFLOWER))), -- подсолнечник
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 128, 2, QUALITY_SELECT.SOY))), -- соя
case
when (CROP.CROPTYPEID = 5) then
QUALITY_SELECT.OILSEED
else QUALITY_SELECT.SCREENING
end SCREENING,
QUALITY_SELECT.ACROSPIRE, QUALITY_SELECT.DEFECTIVE, QUALITY_SELECT.BEATEN,
QUALITY_SELECT.CORRODED, QUALITY_SELECT.GREEN, QUALITY_SELECT.NEVYPOLNENNYE,
QUALITY_SELECT.SMALLGRAIN, QUALITY_SELECT.NAKED,
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 73, 1, QUALITY_SELECT.BARLEY))), -- ячмень
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 74, 1, QUALITY_SELECT.RYE))), -- рожь
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 114, 1, QUALITY_SELECT.PEA))), -- горох
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 113, 1, QUALITY_SELECT.TRITICALE))),-- тритикале
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 81, 1, QUALITY_SELECT.MAIZE))), -- кукуруза
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 128, 1, QUALITY_SELECT.SOY))), -- соя
min((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 145, 1, QUALITY_SELECT.PROSO))) -- просо
from IT
left join QUALITY_SELECT((select IT.BUHQUALITYID from IT where (IT.INVENTORYID = :OUTCOMELASTINVENTORYID))) on (0=0)
left join CROP on (CROP.CROPID = QUALITY_SELECT.CROPID)
where (IT.PARTYID = :PARTYID) and (IT.REGDATE between :BEGINDATE and :OUTCOMELASTDATE)
and (IT.STATE >=0) and (IT.OPERATIONID in (1,5,17)) and (IT.OWNERID = :OWNERID)
-- and (IT.INVENTORYID <= :OUTCOMELASTINVENTORYID)
and ((:CONTRACTID = -1) or (IT.CONTRACTID = :CONTRACTID))
group by QUALITY_SELECT.HARVESTYEAR, QUALITY_SELECT.HUMIDITY, QUALITY_SELECT.GRAINUNIT, QUALITY_SELECT.GLUTEN,
QUALITY_SELECT.GLUTENQUALITY, QUALITY_SELECT.PROTEIN, QUALITY_SELECT.GOLOVNEVIE,
QUALITY_SELECT.DROPNUMBER, QUALITY_SELECT.GLASSNESS, QUALITY_SELECT.TURTLEBUG, QUALITY_SELECT.OIL_M,
QUALITY_SELECT.DIRT, QUALITY_SELECT.MINERAL, QUALITY_SELECT.SPOILT, QUALITY_SELECT.DIRTSEED,
QUALITY_SELECT.ORGANIC, QUALITY_SELECT.FUSARIOSE, QUALITY_SELECT.BRAND, SCREENING,
QUALITY_SELECT.ACROSPIRE, QUALITY_SELECT.DEFECTIVE, QUALITY_SELECT.BEATEN,
QUALITY_SELECT.CORRODED, QUALITY_SELECT.GREEN, QUALITY_SELECT.NEVYPOLNENNYE,
QUALITY_SELECT.SMALLGRAIN, QUALITY_SELECT.NAKED
into :OUTCOMERESIDUE, :HARVESTYEAR, :HUMIDITY, :GRAINUNIT, :GLUTEN, :GLUTENQUALITY,
:PROTEIN, :GOLOVNEVIE, :DROPNUMBER, :GLASSNESS, :TURTLEBUG, :OIL_M,
:DIRT, :MINERAL, :SPOILT, :DIRTSEED, :ORGANIC, :FUSARIOSE, :BRAND,
:D_MAIZE, :D_PEA, :D_OATS, :D_SUNFLOWER, :D_SOY,
:SCREENING, :ACROSPIRE, :DEFECTIVE, :BEATEN, :CORRODED, :GREEN, :NEVYPOLNENNYE,
:SMALLGRAIN, :NAKED,
:S_BARLEY, :S_RYE, :S_PEA, :S_TRITICALE, :S_MAIZE, :S_SOY, :S_PROSO;
select
QUALITY_SELECT.HARVESTYEAR, sum(IT.NET),
sum(QUALITY_SELECT.HUMIDITY * IT.NET), sum(QUALITY_SELECT.GRAINUNIT * IT.NET),
sum(QUALITY_SELECT.GLUTEN * IT.NET), sum(QUALITY_SELECT.GLUTENQUALITY * IT.NET),
sum(QUALITY_SELECT.PROTEIN * IT.NET), sum(QUALITY_SELECT.GOLOVNEVIE * IT.NET),
sum(QUALITY_SELECT.DROPNUMBER * IT.NET), sum(QUALITY_SELECT.GLASSNESS * IT.NET),
sum(QUALITY_SELECT.TURTLEBUG * IT.NET), sum(QUALITY_SELECT.OIL_M * IT.NET),
sum(QUALITY_SELECT.DIRT * IT.NET), sum(QUALITY_SELECT.MINERAL * IT.NET),
sum(QUALITY_SELECT.SPOILT * IT.NET), sum(QUALITY_SELECT.DIRTSEED * IT.NET),
sum(QUALITY_SELECT.ORGANIC * IT.NET), sum(QUALITY_SELECT.FUSARIOSE * IT.NET),
sum(QUALITY_SELECT.BRAND * IT.NET),
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 81, 2, QUALITY_SELECT.MAIZE)) * IT.NET), -- кукуруза
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 114, 2, QUALITY_SELECT.PEA)) * IT.NET), -- горох
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 115, 2, QUALITY_SELECT.OATS)) * IT.NET), -- овес
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 82, 2, QUALITY_SELECT.SUNFLOWER)) * IT.NET), -- подсолнечник
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 128, 2, QUALITY_SELECT.SOY)) * IT.NET), -- соя
case
when (max(CROP.CROPTYPEID) = 5) then
sum(QUALITY_SELECT.OILSEED * IT.NET)
else sum(QUALITY_SELECT.SCREENING * IT.NET)
end,
sum(QUALITY_SELECT.ACROSPIRE * IT.NET), sum(QUALITY_SELECT.DEFECTIVE * IT.NET),
sum(QUALITY_SELECT.BEATEN * IT.NET), sum(QUALITY_SELECT.CORRODED * IT.NET),
sum(QUALITY_SELECT.GREEN * IT.NET), sum(QUALITY_SELECT.NEVYPOLNENNYE * IT.NET),
sum(QUALITY_SELECT.SMALLGRAIN * IT.NET), sum(QUALITY_SELECT.NAKED * IT.NET),
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 73, 1, QUALITY_SELECT.BARLEY)) * IT.NET), -- ячмень
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 74, 1, QUALITY_SELECT.RYE)) * IT.NET), -- рожь
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 114, 1, QUALITY_SELECT.PEA)) * IT.NET), -- горох
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 113, 1, QUALITY_SELECT.TRITICALE)) * IT.NET),-- тритикале
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 81, 1, QUALITY_SELECT.MAIZE)) * IT.NET), -- кукуруза
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 128, 1, QUALITY_SELECT.SOY)) * IT.NET), -- соя
sum((select QUALITY_IS_PARENT.V from QUALITY_IS_PARENT(QUALITY_SELECT.CROPID, QUALITY_SELECT.CLASSID, 145, 1, QUALITY_SELECT.PROSO)) * IT.NET) -- просо
from IT
left join QUALITY_SELECT(IT.BUHQUALITYID) on (0=0)
left join CROP on (CROP.CROPID = QUALITY_SELECT.CROPID)
where (IT.PARTYID = :PARTYID) and (IT.REGDATE between :OUTCOMELASTDATE + 1 and :RESIDUEDATE)
and (IT.STATE >=0) and (IT.OPERATIONID in (1,17)) and (IT.OWNERID = :OWNERID)
and (IT.NET <> 0)
-- and (IT.INVENTORYID > :OUTCOMELASTINVENTORYID)
and ((:CONTRACTID = -1) or (IT.CONTRACTID = :CONTRACTID))
group by QUALITY_SELECT.HARVESTYEAR
into :HARVESTYEAR_C, :AFTEROUTCOMERESIDUE, :HUMIDITY_C, :GRAINUNIT_C, :GLUTEN_C, :GLUTENQUALITY_C,
:PROTEIN_C, :GOLOVNEVIE_C, :DROPNUMBER_C, :GLASSNESS_C, :TURTLEBUG_C, :OIL_M_C,
:DIRT_C, :MINERAL_C, :SPOILT_C, :DIRTSEED_C, :ORGANIC_C, :FUSARIOSE_C, :BRAND_C,
:D_MAIZE_C, :D_PEA_C, :D_OATS_C, :D_SUNFLOWER_C, :D_SOY_C,
:SCREENING_C, :ACROSPIRE_C, :DEFECTIVE_C, :BEATEN_C, :CORRODED_C, :GREEN_C, :NEVYPOLNENNYE_C,
:SMALLGRAIN_C, :NAKED_C,
:S_BARLEY_C, :S_RYE_C, :S_PEA_C, :S_TRITICALE_C, :S_MAIZE_C, :S_SOY_C, :S_PROSO_C;
CARGORESIDUE = coalesce(OUTCOMERESIDUE,0) + coalesce(AFTEROUTCOMERESIDUE,0);
if (CARGORESIDUE > 0) then begin
HARVESTYEAR = coalesce(HARVESTYEAR,HARVESTYEAR_C);
HUMIDITY = (coalesce(HUMIDITY_C,0) + coalesce((HUMIDITY * OUTCOMERESIDUE),0)) / CARGORESIDUE;
GRAINUNIT = (coalesce(GRAINUNIT_C,0) + coalesce((GRAINUNIT * OUTCOMERESIDUE),0)) / CARGORESIDUE;
GLUTEN = (coalesce(GLUTEN_C,0) + coalesce((GLUTEN * OUTCOMERESIDUE),0)) / CARGORESIDUE;
GLUTENQUALITY = (coalesce(GLUTENQUALITY_C,0) + coalesce((GLUTENQUALITY * OUTCOMERESIDUE),0)) / CARGORESIDUE;
PROTEIN = (coalesce(PROTEIN_C,0) + coalesce((PROTEIN * OUTCOMERESIDUE),0)) / CARGORESIDUE;
GOLOVNEVIE = (coalesce(GOLOVNEVIE_C,0) + coalesce((GOLOVNEVIE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
DROPNUMBER = (coalesce(DROPNUMBER_C,0) + coalesce((DROPNUMBER * OUTCOMERESIDUE),0)) / CARGORESIDUE;
GLASSNESS = (coalesce(GLASSNESS_C,0) + coalesce((GLASSNESS * OUTCOMERESIDUE),0)) / CARGORESIDUE;
TURTLEBUG = (coalesce(TURTLEBUG_C,0) + coalesce((TURTLEBUG * OUTCOMERESIDUE),0)) / CARGORESIDUE;
OIL_M = (coalesce(OIL_M_C,0) + coalesce((OIL_M * OUTCOMERESIDUE),0)) / CARGORESIDUE;
DIRT = (coalesce(DIRT_C,0) + coalesce((DIRT * OUTCOMERESIDUE),0)) / CARGORESIDUE;
MINERAL = (coalesce(MINERAL_C,0) + coalesce((MINERAL * OUTCOMERESIDUE),0)) / CARGORESIDUE;
SPOILT = (coalesce(SPOILT_C,0) + coalesce((SPOILT * OUTCOMERESIDUE),0)) / CARGORESIDUE;
DIRTSEED = (coalesce(DIRTSEED_C,0) + coalesce((DIRTSEED * OUTCOMERESIDUE),0)) / CARGORESIDUE;
ORGANIC = (coalesce(ORGANIC_C,0) + coalesce((ORGANIC * OUTCOMERESIDUE),0)) / CARGORESIDUE;
FUSARIOSE = (coalesce(FUSARIOSE_C,0) + coalesce((FUSARIOSE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
BRAND = (coalesce(BRAND_C,0) + coalesce((BRAND * OUTCOMERESIDUE),0)) / CARGORESIDUE;
D_MAIZE = (coalesce(D_MAIZE_C,0) + coalesce((D_MAIZE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
D_PEA = (coalesce(D_PEA_C,0) + coalesce((D_PEA * OUTCOMERESIDUE),0)) / CARGORESIDUE;
D_OATS = (coalesce(D_OATS_C,0) + coalesce((D_OATS * OUTCOMERESIDUE),0)) / CARGORESIDUE;
D_SUNFLOWER = (coalesce(D_SUNFLOWER_C,0) + coalesce((D_SUNFLOWER * OUTCOMERESIDUE),0)) / CARGORESIDUE;
D_SOY = (coalesce(D_SOY_C,0) + coalesce((D_SOY * OUTCOMERESIDUE),0)) / CARGORESIDUE;
SCREENING = (coalesce(SCREENING_C,0) + coalesce((SCREENING * OUTCOMERESIDUE),0)) / CARGORESIDUE;
ACROSPIRE = (coalesce(ACROSPIRE_C,0) + coalesce((ACROSPIRE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
DEFECTIVE = (coalesce(DEFECTIVE_C,0) + coalesce((DEFECTIVE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
BEATEN = (coalesce(BEATEN_C,0) + coalesce((BEATEN * OUTCOMERESIDUE),0)) / CARGORESIDUE;
CORRODED = (coalesce(CORRODED_C,0) + coalesce((CORRODED * OUTCOMERESIDUE),0)) / CARGORESIDUE;
GREEN = (coalesce(GREEN_C,0) + coalesce((GREEN * OUTCOMERESIDUE),0)) / CARGORESIDUE;
NEVYPOLNENNYE = (coalesce(NEVYPOLNENNYE_C,0) + coalesce((NEVYPOLNENNYE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
SMALLGRAIN = (coalesce(SMALLGRAIN_C,0) + coalesce((SMALLGRAIN * OUTCOMERESIDUE),0)) / CARGORESIDUE;
NAKED = (coalesce(NAKED_C,0) + coalesce((NAKED * OUTCOMERESIDUE),0)) / CARGORESIDUE;
S_BARLEY = (coalesce(S_BARLEY_C,0) + coalesce((S_BARLEY * OUTCOMERESIDUE),0)) / CARGORESIDUE;
S_RYE = (coalesce(S_RYE_C,0) + coalesce((S_RYE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
S_PEA = (coalesce(S_PEA_C,0) + coalesce((S_PEA * OUTCOMERESIDUE),0)) / CARGORESIDUE;
S_TRITICALE = (coalesce(S_TRITICALE_C,0) + coalesce((S_TRITICALE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
S_MAIZE = (coalesce(S_MAIZE_C,0) + coalesce((S_MAIZE * OUTCOMERESIDUE),0)) / CARGORESIDUE;
S_SOY = (coalesce(S_SOY_C,0) + coalesce((S_SOY * OUTCOMERESIDUE),0)) / CARGORESIDUE;
S_PROSO = (coalesce(S_PROSO_C,0) + coalesce((S_PROSO * OUTCOMERESIDUE),0)) / CARGORESIDUE;
suspend;
end
end
end