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

ACC_CALC_WEIGHT_ACT

 

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

Параметр

Тип

Описание

INVENTORYID

INTEGER

 

ENDDATE

DATE

 

 

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

Параметр

Тип

Описание

RESTWEIGHT

BIGINT

 

 

Описание

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

 

Определение

CREATE PROCEDURE ACC_CALC_WEIGHT_ACT(
    INVENTORYID INTEGER,
    ENDDATE DATE)
RETURNS (
    RESTWEIGHT BIGINT)
AS
declare variable tmpnet integer;
declare variable texportactitemid integer;
declare variable tmpweigth integer;
BEGIN
  FOR
    select
      coalesce(EAI.weight,0),
      EAI.exportactitemid
    from ExportActItems EAI
        left join exportacts EA on (EAI.exportactid = EA.exportactid and EA.state <> 10)
    where EAI.InventoryID = :InventoryID
      and EAI.OperationID = 1
    INTO :tmpnet,
    :Texportactitemid
    DO
    BEGIN
      select
        sum (coalesce(EAI2.weight,0))
      from ExportActItems EAI2
        left join exportacts EA2 on (EAI2.exportactid = EA2.exportactid and EA2.state <> 10)
      where EAI2.parentitemid = :Texportactitemid
     --  and EA2.regdate <= :enddate
      into :tmpweigth;
  END
  if (:tmpnet is null) then
      restweight = -1 ;
  else
    restweight = coalesce(:tmpnet,0) - coalesce(:tmpweigth,0);
  SUSPEND;

END

 

     Previous topic Chapter index Next topic