<?xml version="1.0" encoding="iso-8859-9" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>ERP Nedir? | T&#252;rkiye'nin ERP Forum Platformu : OZEL HESAP KAPATILMAMISLAR</title>
  <link>http://www.erpne.org/</link>
  <description><![CDATA[XML içerik linki; ERP Nedir? | T&#252;rkiye'nin ERP Forum Platformu : SQL Veri Taban&#305; &#304;&#351;lemleri : OZEL HESAP KAPATILMAMISLAR]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 13 May 2026 16:54:16 +0000</pubDate>
  <lastBuildDate>Thu, 24 Mar 2016 17:34:46 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 11.10</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.erpne.org/RSS_post_feed.asp?TID=4315</WebWizForums:feedURL>
  <image>
   <title><![CDATA[ERP Nedir? | T&#252;rkiye'nin ERP Forum Platformu]]></title>
   <url>http://www.erpne.org/forum_images/logotype.png</url>
   <link>http://www.erpne.org/</link>
  </image>
  <item>
   <title><![CDATA[OZEL HESAP KAPATILMAMISLAR :  Hocam zaten * from dedik hepsi...]]></title>
   <link>http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22763.html#22763</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://www.erpne.org/member_profile.asp?PF=483">Conari</a><br /><strong>Konu:</strong> 4315<br /><strong>Gönderim Zamanı:</strong> 24&nbsp;Mart&nbsp;2016 Saat 17:34<br /><br />Hocam zaten * from dedik hepsi gelsin, diye sen bir kere istedigin alanlari seçeceksin.<div>&nbsp;</div><div>he kalan bakiyesi 1 TL altinda olanlar gelmesin diyorsan..</div><div>&nbsp;</div><div>select *,&nbsp;ALACAK-KAPATILMIS_TUTAR&nbsp; AS KALAN&nbsp;from tblcahar where alacak&gt;0 and KAPATILMIS_TUTAR&lt;&gt;ALACAK &nbsp;AND (ALACAK-KAPATILMIS_TUTAR)&gt;1</div>]]>
   </description>
   <pubDate>Thu, 24 Mar 2016 17:34:46 +0000</pubDate>
   <guid isPermaLink="true">http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22763.html#22763</guid>
  </item> 
  <item>
   <title><![CDATA[OZEL HESAP KAPATILMAMISLAR :   Conari Yazd&#305;: select * from...]]></title>
   <link>http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22758.html#22758</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://www.erpne.org/member_profile.asp?PF=874">social</a><br /><strong>Konu:</strong> 4315<br /><strong>Gönderim Zamanı:</strong> 23&nbsp;Mart&nbsp;2016 Saat 12:15<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Orjinalini yazan: Conari" alt="Orjinalini yazan: Conari" style="vertical-align: text-bottom;" /> <strong>Conari Yazdı:</strong><br /><br />select * from tblcahar where alacak&gt;0 and KAPATILMIS_TUTAR&lt;&gt;ALACAK <div>&nbsp;</div><div>Dövizliler için, döviz tipi kontrolü eklenmeli ve döviz tutarina bakilmali</div></td></tr></table><div><br></div><div><br></div><div>BUNA ALACAK BAKIYESI 1 TL UZERINDE OLANLARI ALMAMASINI SAGLAMAK LAZIM,sorun soyle oluyor mesela 1057,70 borc bakiyeli musteriden 1057,71 tahsilat yapilmis ve kapatmasi yapilmis,alacak bakiyesi 0,01kr kaldigindan oturu rapora bunu getiriyor hemde 0,01kr olarak degilde 1057,71 olarak tam tahsilatini getiriyor</div>]]>
   </description>
   <pubDate>Wed, 23 Mar 2016 12:15:44 +0000</pubDate>
   <guid isPermaLink="true">http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22758.html#22758</guid>
  </item> 
  <item>
   <title><![CDATA[OZEL HESAP KAPATILMAMISLAR :  select * from tblcahar where...]]></title>
   <link>http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22698.html#22698</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://www.erpne.org/member_profile.asp?PF=483">Conari</a><br /><strong>Konu:</strong> 4315<br /><strong>Gönderim Zamanı:</strong> 09&nbsp;Mart&nbsp;2016 Saat 13:09<br /><br />select * from tblcahar where alacak&gt;0 and KAPATILMIS_TUTAR&lt;&gt;ALACAK <div>&nbsp;</div><div>Dövizliler için, döviz tipi kontrolü eklenmeli ve döviz tutarina bakilmali</div>]]>
   </description>
   <pubDate>Wed, 09 Mar 2016 13:09:45 +0000</pubDate>
   <guid isPermaLink="true">http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22698.html#22698</guid>
  </item> 
  <item>
   <title><![CDATA[OZEL HESAP KAPATILMAMISLAR : tesekkurler ama bu benim istedigimi...]]></title>
   <link>http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22694.html#22694</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://www.erpne.org/member_profile.asp?PF=874">social</a><br /><strong>Konu:</strong> 4315<br /><strong>Gönderim Zamanı:</strong> 08&nbsp;Mart&nbsp;2016 Saat 18:32<br /><br />tesekkurler ama bu benim istedigimi karsilamiyor]]>
   </description>
   <pubDate>Tue, 08 Mar 2016 18:32:42 +0000</pubDate>
   <guid isPermaLink="true">http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22694.html#22694</guid>
  </item> 
  <item>
   <title><![CDATA[OZEL HESAP KAPATILMAMISLAR : SELECT * FROM .(&amp;#039;&amp;#039;,...]]></title>
   <link>http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22693.html#22693</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://www.erpne.org/member_profile.asp?PF=1592">rhan</a><br /><strong>Konu:</strong> 4315<br /><strong>Gönderim Zamanı:</strong> 08&nbsp;Mart&nbsp;2016 Saat 17:56<br /><br />SELECT * FROM &#091;dbo&#093;.&#091;OZELYASLANDIR&#093;('', 'H')<br>]]>
   </description>
   <pubDate>Tue, 08 Mar 2016 17:56:54 +0000</pubDate>
   <guid isPermaLink="true">http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22693.html#22693</guid>
  </item> 
  <item>
   <title><![CDATA[OZEL HESAP KAPATILMAMISLAR : CREATE FUNCTION .(@CARIKODU TDBCARIKOD,@DOVIZLIMI...]]></title>
   <link>http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22691.html#22691</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://www.erpne.org/member_profile.asp?PF=1592">rhan</a><br /><strong>Konu:</strong> 4315<br /><strong>Gönderim Zamanı:</strong> 08&nbsp;Mart&nbsp;2016 Saat 17:54<br /><br />CREATE FUNCTION &#091;dbo&#093;.&#091;OZELYASLANDIR&#093;(@CARIKODU TDBCARIKOD,@DOVIZLIMI VARCHAR(1))<br>RETURNS <br>--DECLARE <br>@TEMP TABLE ( CARIKOD VARCHAR(35),CARIISIM VARCHAR(100),BELGENO VARCHAR(20),BELGETARIHI SMALLDATETIME,ACIKLAMA VARCHAR(50),TAHSILAT FLOAT,ODEME FLOAT,<br>VADEGUNU SMALLDATETIME,ASILTUTAR FLOAT,DOVIZTUR INT,DOVIZTUTAR FLOAT,PLASIYERKODU VARCHAR(50),PLASIYERISMI VARCHAR(100),PROJE VARCHAR(15),INCKEYNO INT)<br>AS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>BEGIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br><br><br>IF @CARIKODU = '' <br>&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SET @CARIKODU = '%'<br>&nbsp;&nbsp; &nbsp;END<br><br>DECLARE @CKOD VARCHAR(100),@DOVTIP INT,@TB FLOAT,@TA FLOAT,@DB FLOAT,@DA FLOAT,@KURISIM VARCHAR(100),@HESAPTUTMASEKLI VARCHAR(100)<br>DECLARE @CARI_KOD VARCHAR(100),@CARI_ISIM VARCHAR(100),@BELGE_NO VARCHAR(100),@TARIH SMALLDATETIME ,@ACIKLAMA VARCHAR(100),@VADE_TARIHI SMALLDATETIME,@PROJE_KODU VARCHAR(100),@DOVIZ_TURU INT,@SUBE_KODU INT,@HAREKET_TURU VARCHAR(100),@BORC FLOAT,@ALACAK FLOAT,@DOVIZ_TUTAR FLOAT,@KAPATILMIS_TUTAR FLOAT,@INC_KEY_NUMBER FLOAT,@FIRMA_DOVIZ_TIPI FLOAT,@FIRMA_DOVIZ_TUTARI FLOAT,@PLASIYER_KODU VARCHAR(100),@PLASIYER_ACIKLAMA VARCHAR(100)<br>DECLARE @CKODU VARCHAR(100),@CARIISIM VARCHAR(100),@BELGENO VARCHAR(100),@BELGETARIHI SMALLDATETIME,@TMP_ACIKLAMA VARCHAR(100),@TMP_BORC FLOAT,@TMP_ALACAK FLOAT,@VADE SMALLDATETIME,@SONALACAK FLOAT,@ASILTUTAR FLOAT,@DOVIZTUR INT,@DOVIZTUTAR FLOAT,@MODUL VARCHAR(100),@KA VARCHAR(100)<br>DECLARE @BAKIYE FLOAT,@TOPLAM FLOAT<br><br><br>IF @DOVIZLIMI='E'<br>&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE CURCARI CURSOR FOR <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SELECT TRA.CARI_KOD,TRA.DOVIZ_TURU DOVIZTIP,TRA.BORC BORC, TRA.ALACAK ALACAK,TRA.BDOVTOP, TRA.ADOVTOP,ISNULL(KUR.ISIM,'YTL') KURISIM,HESAPTUTMASEKLI<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FROM TBLCASABIT CARIANA<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN(<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SELECT CARI_KOD,CAHAR.DOVIZ_TURU,SUM(BORC) BORC ,SUM(ALACAK) ALACAK,SUM(CASE WHEN BORC&gt;0 THEN DOVIZ_TUTAR ELSE 0 END) BDOVTOP,SUM(CASE WHEN ALACAK&gt;0 THEN DOVIZ_TUTAR ELSE 0 END) ADOVTOP<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FROM TBLCAHAR CAHAR<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHERE (HAREKET_TURU BETWEEN 'A' AND 'L')<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;AND CAHAR.DOVIZ_TURU&gt;=0<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;AND CAHAR.DOVIZ_TURU&lt;=99<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;GROUP BY CARI_KOD,DOVIZ_TURU<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; ) TRA <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; ON ( CARIANA.CARI_KOD = TRA.CARI_KOD )<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN NETSIS..KUR KUR ON ( KUR.SIRA = TRA.DOVIZ_TURU )<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHERE (CARIANA.CM_BORCT + CARIANA.CM_ALACT &lt;&gt; 0) AND TRA.CARI_KOD LIKE @CARIKODU ORDER BY&nbsp; CARIANA.CARI_KOD&nbsp; ASC ,TRA.DOVIZ_TURU<br><br><br><br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;OPEN CURCARI<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM CURCARI INTO @CKOD,@DOVTIP,@TB,@TA,@DB,@DA,@KURISIM,@HESAPTUTMASEKLI<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHILE @@FETCH_STATUS &lt;&gt; -1<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @DOVTIP&lt;&gt;0<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @HESAPTUTMASEKLI='K'<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD),BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,HAREKET_TURU,(CASE WHEN BORC&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE BORC END),(CASE WHEN ALACAK&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE ALACAK END),DOVIZ_TUTAR,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA,INC_KEY_NUMBER FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TBLCARIPLASIYER.PLASIYER_KODU) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHERE DOVIZ_TUTAR&nbsp; &lt;&gt; KAPATILMIS_TUTAR AND (CARI_KOD=@CKOD) AND DOVIZ_TURU = @DOVTIP<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ORDER BY VADE_TARIHI DESC<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;OPEN HAREKET<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM HAREKET INTO @CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@VADE_TARIHI,@PROJE_KODU,@DOVIZ_TURU,@SUBE_KODU,@HAREKET_TURU,@BORC,@ALACAK,@DOVIZ_TUTAR,@KAPATILMIS_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@INC_KEY_NUMBER<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHILE @@FETCH_STATUS &lt;&gt; -1<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SET @SONALACAK = (@BORC + @ALACAK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SET @ASILTUTAR = (@BORC + @ALACAK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @BORC &gt; 0&nbsp; SET @BORC = @BORC - @KAPATILMIS_TUTAR<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @ALACAK &gt; 0&nbsp; SET @ALACAK = @ALACAK&nbsp;&nbsp; - @KAPATILMIS_TUTAR<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;INSERT INTO @TEMP VALUES (@CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@BORC,@ALACAK,@VADE_TARIHI,@ASILTUTAR,@DOVIZ_TURU,@DOVIZ_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@PROJE_KODU,@INC_KEY_NUMBER)<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM HAREKET INTO @CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@VADE_TARIHI,@PROJE_KODU,@DOVIZ_TURU,@SUBE_KODU,@HAREKET_TURU,@BORC,@ALACAK,@DOVIZ_TUTAR,@KAPATILMIS_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@INC_KEY_NUMBER<br>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp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nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD), BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,(CASE WHEN BORC&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE BORC END),(CASE WHEN ALACAK&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE ALACAK END),INC_KEY_NUMBER,DOVIZ_TUTAR,FIRMA_DOVIZ_TIPI,FIRMA_DOVIZ_TUTARI,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TBLCARIPLASIYER.PLASIYER_KODU) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n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nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD), BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,(CASE WHEN BORC&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE BORC END),(CASE WHEN ALACAK&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE ALACAK END),INC_KEY_NUMBER,DOVIZ_TUTAR,FIRMA_DOVIZ_TIPI,FIRMA_DOVIZ_TUTARI,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TBLCARIPLASIYER.PLASIYER_KODU) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n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nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN<br><br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @HESAPTUTMASEKLI='K'<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD),BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,HAREKET_TURU,(CASE WHEN BORC&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE BORC END),(CASE WHEN ALACAK&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE ALACAK END),DOVIZ_TUTAR,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA,INC_KEY_NUMBER FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TBLCARIPLASIYER.PLASIYER_KODU) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHERE BORC+ALACAK&nbsp; &lt;&gt; KAPATILMIS_TUTAR AND (CARI_KOD=@CKOD) AND DOVIZ_TURU = @DOVTIP<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ORDER BY VADE_TARIHI DESC<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;OPEN HAREKET<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM HAREKET INTO @CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@VADE_TARIHI,@PROJE_KODU,@DOVIZ_TURU,@SUBE_KODU,@HAREKET_TURU,@BORC,@ALACAK,@DOVIZ_TUTAR,@KAPATILMIS_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@INC_KEY_NUMBER<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHILE @@FETCH_STATUS &lt;&gt; -1<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SET @SONALACAK = (@BORC + @ALACAK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SET @ASILTUTAR = (@BORC + @ALACAK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @BORC &gt; 0&nbsp; SET @BORC = @BORC - @KAPATILMIS_TUTAR<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @ALACAK &gt; 0&nbsp; SET @ALACAK = @ALACAK&nbsp;&nbsp; - @KAPATILMIS_TUTAR<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;INSERT INTO @TEMP VALUES (@CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@BORC,@ALACAK,@VADE_TARIHI,@ASILTUTAR,@DOVIZ_TURU,@DOVIZ_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@PROJE_KODU,@INC_KEY_NUMBER)<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM HAREKET INTO @CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@VADE_TARIHI,@PROJE_KODU,@DOVIZ_TURU,@SUBE_KODU,@HAREKET_TURU,@BORC,@ALACAK,@DOVIZ_TUTAR,@KAPATILMIS_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@INC_KEY_NUMBER<br>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp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;&nbsp; -- ALACAK<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD), BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,(CASE WHEN BORC&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE BORC END),(CASE WHEN ALACAK&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE ALACAK END),INC_KEY_NUMBER,DOVIZ_TUTAR,FIRMA_DOVIZ_TIPI,FIRMA_DOVIZ_TUTARI,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TB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p;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; SET @SONALACAK = @ALACAK<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; SET @ALACAK = (@TOPLAM - @BAKIYE - @ALACAK) * -1<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; IF&nbsp; @SONALACAK = @ALACAK SET @SONALACAK = @ALACAK<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ELSE<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; SET @SONALACAK = @ALACAK<br>&nbsp;&nbsp; &nbsp;&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BORC<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD), BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,(CASE WHEN BORC&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE BORC END),(CASE WHEN ALACAK&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE ALACAK END),INC_KEY_NUMBER,DOVIZ_TUTAR,FIRMA_DOVIZ_TIPI,FIRMA_DOVIZ_TUTARI,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TBLCARIPLASIYER.PLASIYER_KODU) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&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nbsp;&nbsp; &nbsp;CLOSE CURCARI<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DEALLOCATE CURCARI<br><br>&nbsp;&nbsp; &nbsp;END<br><br>IF @DOVIZLIMI='H'<br>&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE CURCARI CURSOR FOR <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SELECT CARI_KOD,0,CM_BORCT,CM_ALACT,0,0,'YTL',HESAPTUTMASEKLI FROM TBLCASABIT WHERE CARI_KOD LIKE @CARIKODU ORDER BY CARI_KOD<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br><br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;OPEN CURCARI<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM CURCARI INTO @CKOD,@DOVTIP,@TB,@TA,@DB,@DA,@KURISIM,@HESAPTUTMASEKLI<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHILE @@FETCH_STATUS &lt;&gt; -1<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @HESAPTUTMASEKLI='K'<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD),BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,HAREKET_TURU,(CASE WHEN BORC&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE BORC END),(CASE WHEN ALACAK&gt;0 AND DOVIZ_TURU &lt;&gt; 0 THEN DOVIZ_TUTAR ELSE ALACAK END),DOVIZ_TUTAR,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA,INC_KEY_NUMBER FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TBLCARIPLASIYER.PLASIYER_KODU) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHERE BORC+ALACAK&nbsp; &lt;&gt; KAPATILMIS_TUTAR AND (CARI_KOD=@CKOD) AND DOVIZ_TURU = @DOVTIP<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ORDER BY VADE_TARIHI DESC<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;OPEN HAREKET<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM HAREKET INTO @CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@VADE_TARIHI,@PROJE_KODU,@DOVIZ_TURU,@SUBE_KODU,@HAREKET_TURU,@BORC,@ALACAK,@DOVIZ_TUTAR,@KAPATILMIS_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@INC_KEY_NUMBER<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHILE @@FETCH_STATUS &lt;&gt; -1<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BEGIN<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SET @SONALACAK = (@BORC + @ALACAK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SET @ASILTUTAR = (@BORC + @ALACAK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @BORC &gt; 0&nbsp; SET @BORC = @BORC - @KAPATILMIS_TUTAR<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF @ALACAK &gt; 0&nbsp; SET @ALACAK = @ALACAK&nbsp;&nbsp; - @KAPATILMIS_TUTAR<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;INSERT INTO @TEMP VALUES (@CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@BORC,@ALACAK,@VADE_TARIHI,@ASILTUTAR,@DOVIZ_TURU,@DOVIZ_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@PROJE_KODU,@INC_KEY_NUMBER)<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM HAREKET INTO @CARI_KOD,@CARI_ISIM,@BELGE_NO,@T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nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD), BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,BORC,ALACAK,INC_KEY_NUMBER,DOVIZ_TUTAR,FIRMA_DOVIZ_TIPI,FIRMA_DOVIZ_TUTARI,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TBLCARIPLASIYER.PLASIYER_KODU) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHERE (CARI_KOD=@CKOD)<br>&nbsp;&nbsp; &nbsp;&nbsp;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;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; IF&nbsp; @SONALACAK = @ALACAK SET @SONALACAK = @ALACAK<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ELSE<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; SET @SONALACAK = @ALACAK<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; END<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;INSERT INTO @TEMP VALUES (@CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@BORC,@ALACAK,@VADE_TARIHI,@ASILTUTAR,@DOVIZ_TURU,@DOVIZ_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@PROJE_KODU,@INC_KEY_NUMBER)<br>&nbsp;&nbsp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p;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SET @BAKIYE = @TB-@TA&nbsp;&nbsp;&nbsp; -- BORC<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DECLARE HAREKET CURSOR FOR SELECT CARI_KOD,(SELECT CARI_ISIM FROM TBLCASABIT WITH (NOLOCK) WHERE TBLCASABIT.CARI_KOD = TBLCAHAR.CARI_KOD), BELGE_NO,TARIH,ACIKLAMA,VADE_TARIHI,TBLCAHAR.PROJE_KODU,DOVIZ_TURU,TBLCAHAR.SUBE_KODU,BORC,ALACAK,INC_KEY_NUMBER,DOVIZ_TUTAR,FIRMA_DOVIZ_TIPI,FIRMA_DOVIZ_TUTARI,KAPATILMIS_TUTAR,TBLCAHAR.PLASIYER_KODU,PLASIYER_ACIKLAMA FROM TBLCAHAR WITH (NOLOCK) &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LEFT OUTER JOIN TBLCARIPLASIYER WITH (NOLOCK) ON (TBLCAHAR.PLASIYER_KODU = TBLCARIPLASIYER.PLASIYER_KODU) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;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;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; SET @BORC = (@TOPLAM - @BAKIYE - @BORC) * -1<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; IF&nbsp; @SONALACAK = @BORC SET @SONALACAK = @BORC<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ELSE<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; SET @SONALACAK = @BORC<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; END<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;INSERT INTO @TEMP VALUES (@CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@BORC,@ALACAK,@VADE_TARIHI,@ASILTUTAR,@DOVIZ_TURU,@DOVIZ_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA,@PROJE_KODU,@INC_KEY_NUMBER)<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM HAREKET INTO @CARI_KOD,@CARI_ISIM,@BELGE_NO,@TARIH,@ACIKLAMA,@VADE_TARIHI,@PROJE_KODU,@DOVIZ_TURU,@SUBE_KODU,@BORC,@ALACAK,@INC_KEY_NUMBER,@DOVIZ_TUTAR,@FIRMA_DOVIZ_TIPI,@FIRMA_DOVIZ_TUTARI,@KAPATILMIS_TUTAR,@PLASIYER_KODU,@PLASIYER_ACIKLAMA<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; END<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; CLOSE HAREKET<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; DEALLOCATE HAREKET<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;END<br><br><br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FETCH NEXT FROM CURCARI INTO @CKOD,@DOVTIP,@TB,@TA,@DB,@DA,@KURISIM,@HESAPTUTMASEKLI<br>&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;END<br><br><br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CLOSE CURCARI<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DEALLOCATE CURCARI<br><br><br><br>&nbsp;&nbsp; &nbsp;END<br>&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;<br><br>RETURN<br><br>END]]>
   </description>
   <pubDate>Tue, 08 Mar 2016 17:54:34 +0000</pubDate>
   <guid isPermaLink="true">http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22691.html#22691</guid>
  </item> 
  <item>
   <title><![CDATA[OZEL HESAP KAPATILMAMISLAR : arkadaslar merhaba cari hareketinde...]]></title>
   <link>http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22689.html#22689</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://www.erpne.org/member_profile.asp?PF=874">social</a><br /><strong>Konu:</strong> 4315<br /><strong>Gönderim Zamanı:</strong> 08&nbsp;Mart&nbsp;2016 Saat 15:38<br /><br /><span style="line-height: 16.8px; : rgb251, 251, 253;">arkadaslar merhaba cari hareketinde alacak kaydi olupta özel hesap kismindan kapatilmamis haraketi olani nasil gorebilirim</span><div style="line-height: 16.8px; : rgb251, 251, 253;">&nbsp;</div><div style="line-height: 16.8px; : rgb251, 251, 253;">ornek alinin 50tl borcu var 50 tl alacagi var ve bakiyesi 0 diyelim ama özel hesap penceresi gösterilmesin isaretli ve alacak kaydinda pencere açilmadigi için 50 tl borca karsilik kapatma yapilmamis.</div><div style="line-height: 16.8px; : rgb251, 251, 253;">&nbsp;</div><div style="line-height: 16.8px; : rgb251, 251, 253;">bende istiyorumki cari haraketinde alacak kaydi olup borca kapatma yapilmamislari listelesin</div><div style="line-height: 16.8px; : rgb251, 251, 253;">&nbsp;</div><div style="line-height: 16.8px; : rgb251, 251, 253;">SELECT&nbsp;&nbsp;&nbsp;&nbsp; (CASE WHEN TBLCAHAR.ALACAK &gt; '0' THEN TBLCAHAR.KAPATILMIS_TUTAR &gt; '0') END) buna benzer birsey sanirim</div><div style="line-height: 16.8px; : rgb251, 251, 253;">yardimlarinizi bekliyorum tesekkurler</div><span style="font-size:10px"><br /><br />Düzenleyen social - 08&nbsp;Mart&nbsp;2016 Saat 15:39</span>]]>
   </description>
   <pubDate>Tue, 08 Mar 2016 15:38:16 +0000</pubDate>
   <guid isPermaLink="true">http://www.erpne.org/ozel-hesap-kapatilmamislar_topic4315_post22689.html#22689</guid>
  </item> 
 </channel>
</rss>