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

DESK_JOURNAL_SELECTORDERSILAGES

 

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

��������

���

��������

ORDERLOADITEMID

INTEGER

 

ROUTEID

INTEGER

 

 

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

��������

���

��������

SILAGEID

INTEGER

 

ROUTESILAGECHEMAID

INTEGER

 

NAME

VARCHAR(30)

 

CROPFULLNAME

VARCHAR(100)

 

WEIGHT

INTEGER

 

PERCENTWEIGHT

INTEGER

 

 

��������

(��� �������� ��� ��������� DESK_JOURNAL_SELECTORDERSILAGES)

 

�����������

CREATE PROCEDURE DESK_JOURNAL_SELECTORDERSILAGES(
    ORDERLOADITEMID INTEGER,
    ROUTEID INTEGER)
RETURNS (
    SILAGEID INTEGER,
    ROUTESILAGECHEMAID INTEGER,
    NAME VARCHAR(30),
    CROPFULLNAME VARCHAR(100),
    WEIGHT INTEGER,
    PERCENTWEIGHT INTEGER)
AS
declare variable CROPID integer;
declare variable CLASSID integer;
declare variable SORTID integer;
begin
  SELECT CROPID, CLASSID, SORTID
  FROM Orderloaditems
    LEFT JOIN Quality on (Orderloaditems.Qualityid = Quality.Qualityid)
  WHERE OrderloaditemID = :OrderloaditemID
  INTO
    :CROPID, :CLASSID, :SORTID;

  for select
    Silage.SilageID,
    Routesilagechema.RouteSilageChemaID,
    Silage.Name,
    Quality_cropfullname_byid.CropFullName,
    Silage.Weight,
    Routesilagechema.Percentweight
  from Silage
  left join Silagepacks on (silage.Silagepackid = Silagepacks.Silagepackid)
  left join Quality on (SilagePacks.QualityID = Quality.QualityID)
  left join Quality_cropfullname_byid(SilagePacks.QualityID, 1) on (0 = 0)
  left join Routesilagechema on (Routesilagechema.Routechemaid = :RouteID and Routesilagechema.Silageid = Silage.SilageID)
  where Quality.CropID = :CropID and Quality.Classid = :ClassID and (Quality.SortID = :SortID or (:SortID is null))
  into
    :SilageID,
    :RouteSilageChemaID,
    :Name,
    :CropFullName,
    :Weight,
    :Percentweight
  do
    suspend;
end

 

     Previous topic Chapter index Next topic