Procedura-POSSHIFTROWSX6

Popis:
Podle skladů

Parametry:

NázevPopisDatový typ
objidChar(10)

Návratové hodnoty:

NázevPopisDatový typ
idChar(10)
objversionInteger
parent_idChar(10)
store_idChar(10)
quantityFloat(0, 0)
amountFloat(0, 0)
discountFloat(0, 0)

Tělo:

begin
  for
    select            
      max(PD2.ID), 
      max(pd2.objversion), 
      max(PD.posshift_id), 
      pd2.store_id, 
      sum(pd2.quantity), 
      sum(pd2.tamount), 
      sum(pd2.documentdiscount+pd2.rowdiscount+pd2.actiondiscount+pd2.dealerdiscount+pd2.financialdocumentdiscount)
    from
      posdocuments2 pd2
      join posdocuments PD on pd.id=pd2.parent_id
      join stores St on St.id=pd2.store_id
    where
      PD.posshift_id=:objid and
      PD.opened = 'N'
    group by
      pd2.store_id,
      st.code
    order by
      st.code
    into
      :id, 
      :objversion, 
      :parent_id, 
      :store_id, 
      :Quantity, 
      :Amount, 
      :Discount
  do
    suspend;
end

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