Set DateFormat DMY
Declare @BelgeNo nVarChar(32), @KartNo Int

Set @KartNo = 2
Set @BelgeNo = 'B0000001'
INSERT INTO TBLSATFATBASLIK(
  CARIID, TUTARI, BELGENO, ACIKLAMA, TARIH, ISKONTOTIP, ALTISKONTO1Y,
  ALTISKONTO2Y, ALTISKONTO1, ALTISKONTO2, SATIRISKONTOSU, OZELKOD1,
  OZELKOD2, OZELKOD3, OZELKOD4, OZELKOD5, DOVIZID, KUR, DEPOID,
  PERSONELID, CARIDOVIZTUTARI, KDV, AY, YIL, DELETED, KAYITTARIHI,
  KARTNO, VADE, MASRAF, ENTEGRE, OTVTUTARI
  , SUBEID
)
VALUES(
  30,755.0300, @BelgeNo,'' , '24.11.2021',1,0.0000, 
  0.0000, 0.0000, 0.0000, 0.0000, '',
  '', '','','', 0, 1, 1, 
  1, 755.0300,55.9300, 11, 2021, 0, '24.11.2021 20:25:53', 
  @KartNo, '24.11.2021', 0, 0, 0.0000
  ,0
)

INSERT INTO TBLSATFATHAREKET(
  FATURAID, STOKID, BIRIMID, MIKTARI, KDV, KDVTUTARI, ISKONTO1, ISKONTO2,
  ISKONTO3, ISKONTO4, FIYATI, DOVIZID, KUR, ISKONTOTOPLAMI, SIRANO,
  SERINO, DEPOID, PERSONEL, MALIYET, RENKID, DESEN, BEDENID, OTVYUZDE, OTVTUTARI, PRIM
 , SIPARISID
)
  SELECT
    @KartNo, 2, 2, 5.0000, 8, 3.5185, 0.0000, 0.0000, 0.0000, 0.0000, 
    8.7963, 0, 1, 0.0000, 0,
    '', 1,1,(Select MALIYET From TBLSTOKLAR WITH(INDEX=TBLSTOKLAR_KARTNO) WHERE KARTNO = 2),
0,0,0,0.0000, 0.0000,0
  ,0
UNION ALL
  SELECT
    @KartNo, 3, 3, 4.0000, 8, 3.2593, 0.0000, 0.0000, 0.0000, 0.0000, 
    10.1852, 0, 1, 0.0000, 1,
    '', 1,1,(Select MALIYET From TBLSTOKLAR WITH(INDEX=TBLSTOKLAR_KARTNO) WHERE KARTNO = 3),
0,0,0,0.0000, 0.0000,0
  ,0
UNION ALL
  SELECT
    @KartNo, 4, 4, 3.0000, 8, 1.0444, 0.0000, 0.0000, 0.0000, 0.0000, 
    4.3519, 0, 1, 0.0000, 2,
    '', 1,1,(Select MALIYET From TBLSTOKLAR WITH(INDEX=TBLSTOKLAR_KARTNO) WHERE KARTNO = 4),
0,0,0,0.0000, 0.0000,0
  ,0
UNION ALL
  SELECT
    @KartNo, 5, 5, 2.0000, 8, 6.6667, 0.0000, 0.0000, 0.0000, 0.0000, 
    41.6667, 0, 1, 0.0000, 3,
    '', 1,1,(Select MALIYET From TBLSTOKLAR WITH(INDEX=TBLSTOKLAR_KARTNO) WHERE KARTNO = 5),
0,0,0,0.0000, 0.0000,0
  ,0
UNION ALL
  SELECT
    @KartNo, 8, 8, 5.0000, 8, 5.5556, 0.0000, 0.0000, 0.0000, 0.0000, 
    13.8889, 0, 1, 0.0000, 4,
    '', 1,1,(Select MALIYET From TBLSTOKLAR WITH(INDEX=TBLSTOKLAR_KARTNO) WHERE KARTNO = 8),
0,0,0,0.0000, 0.0000,0
  ,0
UNION ALL
  SELECT
    @KartNo, 15, 15, 4.0000, 8, 19.2593, 0.0000, 0.0000, 0.0000, 0.0000, 
    60.1852, 0, 1, 0.0000, 5,
    '', 1,1,(Select MALIYET From TBLSTOKLAR WITH(INDEX=TBLSTOKLAR_KARTNO) WHERE KARTNO = 15),
0,0,0,0.0000, 0.0000,0
  ,0
UNION ALL
  SELECT
    @KartNo, 20, 20, 3.0000, 8, 16.6244, 0.0000, 0.0000, 0.0000, 0.0000, 
    69.2685, 0, 1, 0.0000, 6,
    '', 1,1,(Select MALIYET From TBLSTOKLAR WITH(INDEX=TBLSTOKLAR_KARTNO) WHERE KARTNO = 20),
0,0,0,0.0000, 0.0000,0
  ,0

UPDATE TBLSTOKLAR SET SATF1DTARIH = '24.11.2021' WHERE KARTNO = 2
UPDATE TBLRESERVE SET MIKTAR = ISNULL(MIKTAR, 0) - 5.0000 WHERE CARIID = 30 AND BIRIMID IN(SELECT KARTNO FROM TBLBIRIMLEREX WHERE STOKID = 2)  AND RENKID = 0 AND DESENID = 0
UPDATE TBLSTOKLAR SET SATF1DTARIH = '24.11.2021' WHERE KARTNO = 3
UPDATE TBLRESERVE SET MIKTAR = ISNULL(MIKTAR, 0) - 4.0000 WHERE CARIID = 30 AND BIRIMID IN(SELECT KARTNO FROM TBLBIRIMLEREX WHERE STOKID = 3)  AND RENKID = 0 AND DESENID = 0
UPDATE TBLSTOKLAR SET SATF1DTARIH = '24.11.2021' WHERE KARTNO = 4
UPDATE TBLRESERVE SET MIKTAR = ISNULL(MIKTAR, 0) - 3.0000 WHERE CARIID = 30 AND BIRIMID IN(SELECT KARTNO FROM TBLBIRIMLEREX WHERE STOKID = 4)  AND RENKID = 0 AND DESENID = 0
UPDATE TBLSTOKLAR SET SATF1DTARIH = '24.11.2021' WHERE KARTNO = 5
UPDATE TBLRESERVE SET MIKTAR = ISNULL(MIKTAR, 0) - 2.0000 WHERE CARIID = 30 AND BIRIMID IN(SELECT KARTNO FROM TBLBIRIMLEREX WHERE STOKID = 5)  AND RENKID = 0 AND DESENID = 0
UPDATE TBLSTOKLAR SET SATF1DTARIH = '24.11.2021' WHERE KARTNO = 8
UPDATE TBLRESERVE SET MIKTAR = ISNULL(MIKTAR, 0) - 5.0000 WHERE CARIID = 30 AND BIRIMID IN(SELECT KARTNO FROM TBLBIRIMLEREX WHERE STOKID = 8)  AND RENKID = 0 AND DESENID = 0
UPDATE TBLSTOKLAR SET SATF1DTARIH = '24.11.2021' WHERE KARTNO = 15
UPDATE TBLRESERVE SET MIKTAR = ISNULL(MIKTAR, 0) - 4.0000 WHERE CARIID = 30 AND BIRIMID IN(SELECT KARTNO FROM TBLBIRIMLEREX WHERE STOKID = 15)  AND RENKID = 0 AND DESENID = 0
UPDATE TBLSTOKLAR SET SATF1DTARIH = '24.11.2021' WHERE KARTNO = 20
UPDATE TBLRESERVE SET MIKTAR = ISNULL(MIKTAR, 0) - 3.0000 WHERE CARIID = 30 AND BIRIMID IN(SELECT KARTNO FROM TBLBIRIMLEREX WHERE STOKID = 20)  AND RENKID = 0 AND DESENID = 0
Update TBLSTOKLAR SET  GIREN = (Select SUM(GIREN) FROM STOKDURUMU WHERE STOKKARTNO = TBLSTOKLAR.KARTNO),  CIKAN = (Select SUM(CIKAN) FROM STOKDURUMU WHERE STOKKARTNO = TBLSTOKLAR.KARTNO)
UPDATE TBLCARI SET  BAKIYE = (SELECT SUM(CARIBORC - CARIALACAK) FROM CARIDOKUM WHERE CARIID = TBLCARI.KARTNO),  TLBAKIYE = (SELECT SUM(TLBORC - TLALACAK) FROM CARIDOKUM WHERE CARIID = TBLCARI.KARTNO)
