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

WEIGHER_CROPS

 

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

Параметр

Тип

Описание

REGDATEB

DATE

 

REGDATEE

DATE

 

OPERATIONID

INTEGER

 

STORAGEIN

VARCHAR(50)

 

TRANSPORTSUBTYPE

INTEGER

 

DELETEDRECORDSSHOW

INTEGER

 

NOTWEIGHTEDSHOW

INTEGER

 

ONOWNERSHOW

INTEGER

 

SHOWHARVESTYEAR

INTEGER

 

 

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

Параметр

Тип

Описание

CLIENTID

INTEGER

 

CLIENTNAME

VARCHAR(100)

 

CROPS

VARCHAR(100)

 

CLASSID

INTEGER

 

NET

INTEGER

 

WEIGHTUSERID

INTEGER

 

SHIFT

INTEGER

 

OWNERID

INTEGER

 

 

Описание

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

 

Определение

CREATE PROCEDURE WEIGHER_CROPS(
    REGDATEB DATE,
    REGDATEE DATE,
    OPERATIONID INTEGER,
    STORAGEIN VARCHAR(50),
    TRANSPORTSUBTYPE INTEGER,
    DELETEDRECORDSSHOW INTEGER,
    NOTWEIGHTEDSHOW INTEGER,
    ONOWNERSHOW INTEGER,
    SHOWHARVESTYEAR INTEGER)
RETURNS (
    CLIENTID INTEGER,
    CLIENTNAME VARCHAR(100),
    CROPS VARCHAR(100),
    CLASSID INTEGER,
    NET INTEGER,
    WEIGHTUSERID INTEGER,
    SHIFT INTEGER,
    OWNERID INTEGER)
AS
declare variable TCLASSID integer;
declare variable TRCROP varchar(60);
declare variable TRNET integer;
declare variable CARLABQUALITYID integer;
declare variable TRAILERLABQUALITYID integer;
declare variable HARVESTYEAR integer;
begin
  for
    select
        case
          when (:ONOWNERSHOW = 0) then
            case
              when (bin_and((select coalesce(ENVIRONMENTOPTIONS.WEIGHEROPTIONS,0) from ENVIRONMENTOPTIONS),1) = 1) then
                WEIGHER.SENDERID
              else WEIGHER.CLIENTID
            end
          else WEIGHER.OWNERID
        end CLIENTID,
        case
          when (:ONOWNERSHOW = 0) then
            case
             when (bin_and((select coalesce(ENVIRONMENTOPTIONS.WEIGHEROPTIONS,0) from ENVIRONMENTOPTIONS),1) = 1) then
               WEIGHER.SENDERNAME
             else WEIGHER.CLIENTNAME
          end
          else WEIGHER.OWNERNAME
        end CLIENTNAME,
        WEIGHER.CARCLASSID, WEIGHER.CARCROP, WEIGHER.TRAILERCLASSID, WEIGHER.TRAILERCROP,
        WEIGHER.CARNET, WEIGHER.TRAILERNET, WEIGHER.WEIGHTUSERID, WEIGHER.SHIFT,
        WEIGHER.OWNERID, WEIGHER.CARLABQUALITYID, WEIGHER.TRAILERLABQUALITYID
      from WEIGHER(:REGDATEB, :REGDATEE, :OPERATIONID, :STORAGEIN, :TRANSPORTSUBTYPE, :DELETEDRECORDSSHOW, :NOTWEIGHTEDSHOW, 0)
    into :CLIENTID, :CLIENTNAME, :CLASSID, :CROPS, :TCLASSID, :TRCROP, :NET, :TRNET,
         :WEIGHTUSERID, :SHIFT, :OWNERID, :CARLABQUALITYID, :TRAILERLABQUALITYID

  do begin
    if (:SHOWHARVESTYEAR = 1) then begin
      select QUALITY_SELECT.HARVESTYEAR
        from QUALITY_SELECT(:CARLABQUALITYID)
      into :HARVESTYEAR;

      CROPS = :CROPS || ' ' || coalesce(:HARVESTYEAR,'') || ' р.в.';

      select QUALITY_SELECT.HARVESTYEAR
        from QUALITY_SELECT(:TRAILERLABQUALITYID)
      into :HARVESTYEAR;

      TRCROP = :TRCROP || ' ' || coalesce(:HARVESTYEAR,'') || ' р.в.';
    end

    if (((CROPS <> TRCROP) or (CROPS is null)) and (TRCROP is not null)) then begin
      if (CROPS is not null) then
        suspend;

      CLASSID = TCLASSID;
      CROPS = TRCROP;
      NET = TRNET;
    end
    else NET = coalesce(:NET,0) + coalesce(:TRNET,0);

    suspend;

    TRCROP = null;
  end
end

 

     Previous topic Chapter index Next topic