Skip to content

Instantly share code, notes, and snippets.

@serefyarar
Created May 21, 2014 07:13
Show Gist options
  • Save serefyarar/d6c505d68bd83db723b2 to your computer and use it in GitHub Desktop.
Save serefyarar/d6c505d68bd83db723b2 to your computer and use it in GitHub Desktop.
Nebim Fatura
UPDATE tbStokSiraNo SET nSonID = nSonID+1 WHERE nSiraIndex = 2
__nStokFisiID = SELECT nSonID FROM tbStokSiraNo WHERE nSiraIndex = 2
INSERT INTO tbStokFisiMaster VALUES (__nStokFisiID , 'FS' , '__GG/AA/YYYY' , 3, __FATURANO, __FIRMAID, '' , '__GG/AA/YYYY' , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Null , Null, Null, Null , Null, '' , 0, 0, 0, Null, '' , 0, 'sa' , getdate(), '__YAZIYLA TOTAL' ,0, 0, 0, 0, 0, 0 )
INSERT INTO tbStokFisiAciklamasi VALUES (__nStokFisiID,'','','','','');
/*Foreach Item In Cart*/
UPDATE tbStokSiraNo SET nSonID = nSonID+1 WHERE nSiraIndex = 1
__nIslemID = SELECT nSonID FROM tbStokSiraNo WHERE nSiraIndex = 1
UPDATE INTO tbStokFisiDetayi values (__nIslemID, __urunStokID, '__GG/AA/YYYY' , __FIRMAID, 0, 'FS' , '__GG/AA/YYYY' , __FATURANO, 3, '' , 0, '' , '' , '' , '' , '__GG/AA/YYYY' , 0, 0, 0, 0, 0, __ADET, 0, __ADETFIYAT, __TUTAR, '' , __BRUTFIYAT, __BRUTTUTAR, 0, 0, 0, __ISKONTO_YUZDE, __ISKONTO_TUTAR, '' , 0, Null, 0, Null, Null , __KDVORAN, 0, '' , '' , 0, 'sa' , getdate (), '' , 0, 0, '' , 0, 0, 0, Null, Null , __nStokFisiID, Null, '' , 'FS' , 0, 0, 0, 0, 'sa' , getdate () )
/*Endforeach*/
UPDATE tbStokFisidetayi set lGirisTutar = 0 , lGirisFiyat = 0 ,
lIskontoTutari = sign(lCikisMiktar1) *
round(abs(lBrutTutar) *
(1 - ((1 - (nIskontoYuzdesi * 0.01)) * 1)), 2 ),
lCikisTutar = sign(lCikisMiktar1) *
(abs(lBrutTutar) - (round(abs(lBrutTutar) *
(1 - ((1 - (nIskontoYuzdesi * 0.01)) * 1)), 2 ))),
lCikisFiyat = sign(lCikisMiktar1) *
(round((abs(lBrutFiyat * lCikisMiktar1) - (round(abs(lBrutFiyat * lCikisMiktar1) *
(1 - ((1 - (nIskontoYuzdesi * 0.01)) * 1)), 2 )))
/ abs(lCikisMiktar1), 4))
Where nStokFisiID = __nStokFisiID
/*
KdvSiz = select nKdvOrani , isnull(abs(round(sum(lBrutTutar - lIskontoTutari),2)),0) as KDVMatrahi From tbStokFisiDetayi where nStokFisiID = nStokFisiID group by nkdvOrani order by nkdvOrani
*/
UPDATE tbCariSiraNo SET nSonID = nSonID + 1 WHERE nSiraIndex = 1;
__nHareketID = SELECT nSonID FROM tbCariSiraNo WHERE nSiraIndex = 1;
/*Total fiyatlar miyatlar hesaplanılıyo. /*Burda bi stokfişi master update olmalı*/
INSERT INTO tbFirmaHareketi VALUES (__nHareketID, __FIRMAID, '__GG/AA/YYYY', '__GG/AA/YYYY', 'FS' , 'Evrak No :__FATURANO' , 24.77, 0, '__FATURANO' , 0, 'FS' , '' , 'sa' , getdate(), '' , 0, 0, '' , 0, 0, 'sa' , getdate())
INSERT INTO tbStokFisiOdemePlani VALUES (224 , '28/04/2014' , 24.77 , 'FS' , __nHareketID )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment