Procedura-AllDocsForDocQueueAndPeriod

Parametry:

NázevPopisDatový typ
DocQueue_IDChar(10)
DocumentTypeChar(2)
Period_IDChar(10)

Návratové hodnoty:

NázevPopisDatový typ
IDChar(10)

Tělo:

BEGIN
  /* JCD */
  if (DocumentType = '12') then
    for
      select A.ID from CustomsDeclarations A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Ostatní příjmy */
  if (DocumentType = '01') then
    for
      select A.ID from OtherIncomes A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Ostatní výdaje */
  if (DocumentType = '02') then
    for
      select A.ID from OtherExpenses A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Zálohové listy k faktuře přijaté */
  if (DocumentType = '11') then
    for 
      select A.ID from ReceivedDInvoices A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Zálohové listy k faktuře vydané */
  if (DocumentType = '10') then
    for 
      select A.ID from IssuedDInvoices A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Faktury vydané */
  if (DocumentType = '03') then
    for 
      select A.ID from IssuedInvoices A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Faktury přijaté */
  if (DocumentType = '04') then
    for 
      select A.ID from ReceivedInvoices A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Penalizační faktury */
  if (DocumentType = '17') then
    for 
      select A.ID from PenaltyInvoices A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Dobropisy faktur vydaných */
  if (DocumentType = '60') then
    for
      select A.ID from IssuedCreditNotes A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Dobropisy faktury přijatých */
  if (DocumentType = '61') then
    for
      select A.ID from ReceivedCreditNotes A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Danove zalohove listy vydane */
  if (DocumentType = '62') then
    for
      select A.ID from VATIssuedDInvoices A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Dobropisy danovych zalohovych listu vydanych */
  if (DocumentType = '63') then
    for
      select A.ID from VATIssuedDCreditNotes A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Danove zalohove listy prijate */
  if (DocumentType = '64') then
    for
      select A.ID from VATReceivedDInvoices A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
  /* Dobropisy danovych zalohovych listu prijatych */
  if (DocumentType = '65') then
    for
      select A.ID from VATReceivedDCreditNotes A
        where A.Period_ID = :Period_ID and
          A.DocQueue_ID = :DocQueue_ID
        into ID
    do begin
      suspend;
    end
END;

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