"localhost:/firebird/data/ILICHEVSK2.FDB". Процедуры Previous topic Chapter index Next topic

ADDITIONFORAKTCROP3

 

Входные параметры

Параметр

Тип

Описание

DATE1

DATE

 

DATE2

DATE

 

CROPID

INTEGER

 

PARTYID

INTEGER

 

PARTYDATE

DATE

 

CLASSID

INTEGER

 

CLIENTID

INTEGER

 

CONTRACTID

INTEGER

 

DOCROP

INTEGER

 

 

Выходные параметры

Параметр

Тип

Описание

REGDATE

DATE

 

SUMNET

INTEGER

 

DB

NUMERIC(4,2)

 

DA

NUMERIC(4,2)

 

OPERATIONN

VARCHAR(30)

 

K12

INTEGER

 

K3

INTEGER

 

OPERATIONTYPE

INTEGER

 

INVOICENUMBER

VARCHAR(31)

 

 

Описание

(Нет описания для процедуры ADDITIONFORAKTCROP3)

 

Определение

CREATE PROCEDURE ADDITIONFORAKTCROP3(
    DATE1 DATE,
    DATE2 DATE,
    CROPID INTEGER,
    PARTYID INTEGER,
    PARTYDATE DATE,
    CLASSID INTEGER,
    CLIENTID INTEGER,
    CONTRACTID INTEGER,
    DOCROP INTEGER)
RETURNS (
    REGDATE DATE,
    SUMNET INTEGER,
    DB NUMERIC(4,2),
    DA NUMERIC(4,2),
    OPERATIONN VARCHAR(30),
    K12 INTEGER,
    K3 INTEGER,
    OPERATIONTYPE INTEGER,
    INVOICENUMBER VARCHAR(31))
AS
declare variable tempdate date;
begin
 tempdate = :date1;
 for
 select it.regdate, sum(quality.dirt*it.net)/sum(it.net) , sum(it.net) from it
 inner join quality_select(it.BuhQualityid) quality on (0=0)
 where operationid = 22
  and it.regdate between :date1 and :date2
  and (((quality.cropid = :cropid) and (:DOCROP = 1)) or ((quality.classid = :classid) and (:DOCROP = 0)))
  and ((it.ownerid = :clientid) or (:clientid  = -1))
  and ((it.contractid = :contractid) or (:contractid  = -1))
 group by it.regdate
 into
 :regdate,
 :da,
 :k3
 do
 begin
 
 select  sum(it.net) from it
 inner join quality on (it.BuhQualityid = quality.qualityid)
 inner join operation on (it.operationid = operation.operationid)
 where
 it.regdate between :tempdate and :regdate
 and it.partyid = (select partyid from getpartyid(:PARTYID,:PARTYDATE, quality.cropid, quality.classid, it.storageid))
 and it.state >= 0
 and it.parentid >= 0
 and it.net is not null
 and it.net <> 0
 and operation.operationsubtype in (0,1)
 and (((quality.cropid = :cropid) and (:DOCROP = 1)) or ((quality.classid = :classid) and (:DOCROP = 0)))
 and ((it.ownerid = :clientid) or (:clientid  = -1))
 and ((it.contractid = :contractid) or (:contractid  = -1))
 into :sumnet;

 k12 = 0;
 db = 0;
 OPERATIONN = 'отходы з кат';
 OPERATIONTYPE = 3;
 tempdate = :regdate;
  suspend;
 end
end

 

     Previous topic Chapter index Next topic