sthar_bilgi2.sql 848 B

12345678910111213141516
  1. set @dbakiye := 0;
  2. select date(t.tarih) as tarih,t.fiþno,round(t.kdvsizbf,3) as nf,round(t.kdvlibf,3) as bf ,round(t.giris,2) as giriþ,round(t.cikis,2) as çýkýþ,
  3. round((@dbakiye := @dbakiye + giris-cikis),2) as bakiye,t.hareket_tipi from(
  4. select tarih as tarih,fisno as fiþno,nf as kdvsizbf,bf as kdvlibf , miktar,
  5. case when (ftip='C' and hedef=28) or (ftip='G' and hedef=28) then miktar else 0 end as giris,
  6. case when ftip='C' and kaynak=28 or (ftip='G' and kaynak=28) then miktar else 0 end as cikis,
  7. (case
  8. when ftip='C' and kaynak=28 then concat(hedef," satýþ")
  9. when ftip='G' and kaynak=28 then concat(hedef," karþý alým")
  10. when ftip='G' and hedef=28 then concat(kaynak," alým")
  11. when ftip='C' and hedef=28 then concat(kaynak," karþý satýþ")
  12. end
  13. ) as hareket_tipi
  14. from sthar where hedef=28 or kaynak=28
  15. order by inckeyno
  16. )as t;