"localhost:/firebird/data/ILICHEVSK2.FDB". ��������� Previous topic Chapter index Next topic

TRANSPORTPLAN_GETPLAN

 

������� ���������

��������

���

��������

BEGINDATE

DATE

 

OWNERID

INTEGER

 

TRSUBTYPE

INTEGER

 

AOPERATIONID

INTEGER

 

CROPID

INTEGER

 

CLASSID

INTEGER

 

ISALL

INTEGER

 

 

�������� ���������

��������

���

��������

TRANSPORTPLANID

INTEGER

 

PLANQUANTITY

INTEGER

 

PLANWEIGHT

INTEGER

 

 

��������

(��� �������� ��� ��������� TRANSPORTPLAN_GETPLAN)

 

�����������

CREATE PROCEDURE TRANSPORTPLAN_GETPLAN(
    BEGINDATE DATE,
    OWNERID INTEGER,
    TRSUBTYPE INTEGER,
    AOPERATIONID INTEGER,
    CROPID INTEGER,
    CLASSID INTEGER,
    ISALL INTEGER)
RETURNS (
    TRANSPORTPLANID INTEGER,
    PLANQUANTITY INTEGER,
    PLANWEIGHT INTEGER)
AS
BEGIN
  FOR
    select
      case
        when :isall is null then
           transportplanid
      end,
      sum(planquantity),
      sum(planweight)
    from transportplans tp
     left join quality on (tp.qualityid = quality.qualityid)
    where plandate = :begindate
      and (ownerid = :ownerid or (:ownerid = -1))
      and tp.operationid = :aoperationid
      and (cropid = :cropid or (:cropid = -1))
      and (classid = :classid or (:classid = -1))
      and transportsubtypeid = :trsubtype
      and :trsubtype<>-1
      and state = 0
   group by
      transportplanid
    INTO :transportplanid,
         :planquantity,
         :planweight
  DO
  BEGIN
    SUSPEND;
  END
END

 

     Previous topic Chapter index Next topic