Procedura-MainBookTurnovers

Parametry:

NázevPopisDatový typ
InAccount_IDChar(10)
InAccDateFromFloat(0, 0)
InAccDateToFloat(0, 0)
InAllowRequestsChar(1)
InAuditedChar(1)
InDivisionSelIDVarChar(10)
InDivisionsWithChildsChar(1)
InBusOrderSelIDVarChar(10)
InBusOrdersWithChildsChar(1)
InBusTransactionSelIDVarChar(10)
InBusTransactionsWithChildsChar(1)
InBusProjectSelIDVarChar(10)
InBusProjectsWithChildsChar(1)
InFirmSelIDVarChar(10)

Návratové hodnoty:

NázevPopisDatový typ
Account_IDChar(10)
DebitAmountNumeric(15, 2)
SAccount_IDChar(10)
CreditAmountNumeric(15, 2)
AccDate$DateDouble(0, 0)
OrdNumberVarChar(24)
TextVarChar(200)
IDChar(10)
Division_IDChar(10)

Tělo:

begin
  mSQL =
    'select ' ||
    '  GLV.ID, GLV.Account_ID, GLV.DebitAmount, GLV.SAccount_ID, GLV.CreditAmount, ' ||
    '  GLV.AccDate$Date, GLV.OrdNumber, GLV.Text, GLV.Division_ID, ' ||
    '  P.Code, ADQ.Code ' ||
    'from ' ||
    '  GeneralLedgerSingle_VIEW GLV ' ||
    '  left join Periods P on P.ID = GLV.Period_ID ' ||
    '  left join AccDocQueues ADQ ON ADQ.ID = GLV.AccDocQueue_ID ';
  mSQL = mSQL || ' where 1=1 ';
  select mRet from DSQL$GetAccountsCondition('GLV', :InAccDateFrom, :InAccDateTo,
      :InAllowRequests, :InAudited, :InDivisionSelID, :InDivisionsWithChilds,
      :InBusOrderSelID, :InBusOrdersWithChilds, :InBusTransactionSelID,
      :InBusTransactionsWithChilds, :InBusProjectSelID, :InBusProjectsWithChilds,
      :InFirmSelID, null, null,
      null, null, null)
  into :mHlp;
  if (mHlp <> ' ') then
    mSQL = mSQL || ' and ' || mHlp;
  if (InAccount_ID is not Null and InAccount_ID <> '') then
    mSQL = mSQL || ' and GLV.Account_ID = ''' || InAccount_ID || '''';
  else
    --v puvodni verzi z 10.02 se pocitalo, ze se ten parametr vzdy zohledni
    mSQL = mSQL || ' and GLV.Account_ID is null ';
  for execute statement mSQL
  into
    :ID, :Account_ID, :DebitAmount, :SAccount_ID, :CreditAmount,
    :AccDate$Date, :mOrdNumber, :Text, :Division_ID,
    :mPeriodCode, :mAccDocQueueCode
  do begin
    OrdNumber = mAccDocQueueCode || '-' || CAST(mOrdNumber as VARCHAR(8)) || '/' || mPeriodCode;
    suspend;
  end
end

Generated by ABRA Software a.s. 27.10.2021 16:34:16