my little project sample code

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

Post Reply
skonuk
Posts: 28
Joined: Fri Sep 17, 2010 7:37 pm
Location: turkey-bursa

my little project sample code

Post by skonuk » Tue Dec 17, 2013 9:37 am

"Esgici Hocam",
ben siteyi oldukça yavaştan takip edebiliyorum.
programlamada benim aslı mesleğim değil, biraz hobi gibi,
Belki ilgilenen arkadaşlara kod yapısında vs katkısı olur diye gönderdim.
Saygılar,

Programı derlemek için ayrıca
hbmk.hbm dosya içeriğide aşağıdaki şekilde ayarladım.

hbfbird.hbc
-w0 -es0
-u+simpleio.ch


Not : daha evvelki çalışmalarımda "-w0" değişkeninin önemini bilmiyordum.
çok daha kolay kodlama yapabiliyorum.

benim gibi acemiler için çok önemli bir değişken ,
umarım faydalı olur.

Salim

Google Translate

"Esgic the Teacher",
  I can follow the site is quite slow.
programming is not my original profession, as a little hobby,
Maybe contribution would be interested friends, etc. I've sent in code structure.
Sincerely,

To compile the program also
I've set the following in the file hbmk.hbm content.

hbfbird.hbc
-w0-es0
-u + simpleio.ch


Note: In my previous researches "-w0" I did not know the importance of variables.
I can make coding much easier.

a crucial variable for novices like me,
hopefully be useful.






Code: Select all

#include "hmg.ch"
#require "hbfbird"
static db
static ndialect
request HB_LANG_TR857
REQUEST HB_CODEPAGE_TR857

 HB_cdPSELECT("tr857")
HB_LANGSELECT("tr857")

 
PROC main()

LOCAL cServer := "localhost:"
   LOCAL cDatabase
   LOCAL cUser := "SYSDBA"
   LOCAL cPass := "masterkey"
*   LOCAL nPageSize := 1024
 *  LOCAL cCharSet := "ASCII"
 LOCAL fetch_stat
   LOCAL cName
   NDIALECT := 1
   DB := NIL
 nDialect := 1
 PUBLIC STOKKART,CARIKART
 

  * LOCAL trans, qry

  * LOCAL db, x, y
  * LOCAL num_cols
  * LOCAL columns

  * LOCAL tmp
   hb_FNameSplit( hb_argv( 0 ), NIL, @cName, NIL )
   cDatabase := "C:\fairway\DATABASE\FBTEST.FDB"


   /* Connect rdbms */
   db := FBConnect( cServer + cDatabase, cUser, cPass )
   IF HB_ISNUMERIC( db )
      MSGINFO("Bağlantı Hatası:"+FBError( db ))
	  MSGINFO('Program Satıcınızla İletişime Geçiniz...!')
      QUIT
	else
		msginfo('Database Bağlantısı Başarılı, İyi Çalışmalar.')
   ENDIF

   DEFINE WINDOW Win_1 ;
		ROW 0 ;
		COL 0 ;
		WIDTH 900 ;
		HEIGHT 750  BACKCOLOR BLACK ;
		TITLE 'Fairway Software - Salim Konukergil (c)' ;
		WINDOWTYPE MAIN  

		DEFINE MAIN MENU 

			DEFINE POPUP "Kartlar"
                MENUITEM "Stok Kartları" action KARTFORM('STOK')
				MENUITEM "Cari Hesap Kartları" action KARTFORM('CARI')
	       END POPUP

		   DEFINE POPUP "Hareketler"
				MENUITEM "Satış Faturaları"  action msginfo('FATURA')
			END POPUP

	   END MENU 
		
		
	END WINDOW

	Win_1.Center

	Win_1.Activate

RETURN   
*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FUNCTION KARTFORM
PARA FORMADI

LOCAL FORMNAME :="CARIKART"
local xCARI_ID :='0'
local xCARI_KOD :=''
local xCARI_UNVAN :=''
local xCARI_VDAD :=''
local xCARI_VDNO :=''
local xCARI_ADRES :=''

IF FORMADI = 'STOK'
	FORMNAME='STOKKART'
	FORMTITLE='Stok Kartları'
	XPARAM='2'
ELSEIF FORMADI='CARI'
	FORMNAME='CARIKART'
	FORMTITLE='Cari Kartları'
	XPARAM='1'
ENDIF

IF !_IsWIndowDefined ( FORMNAME ) 
	DEFINE WINDOW &(FORMNAME) ;
		ROW 0 ;
		COL 0 ;
		WIDTH 800 ;
		HEIGHT 625  ;
		TITLE FORMTITLE ;
		WINDOWTYPE CHILD  ON INIT CKARTLOAD(XPARAM)
		
			DEFINE TOOLBAR TBAR BUTTONSIZE 75,75 IMAGESIZE 75,40 
				BUTTON BUTTON_1 CAPTION 'Yeni'	 PICTURE 'ekle.bmp'   ACTION CKARTEKLE(XPARAM)
				BUTTON BUTTON_2 CAPTION 'Düzelt' PICTURE 'duzelt.bmp' ACTION CKARTEDIT(XPARAM)
				BUTTON BUTTON_3 CAPTION 'Sil' 	 PICTURE 'cikart.bmp' && ACTION CKARTDELETE(XPARAM)
				BUTTON BUTTON_4 CAPTION 'Onayla' PICTURE 'kaydet.bmp' ACTION CKARTSAVE(XPARAM)
				BUTTON BUTTON_5 CAPTION 'Vazgeç' PICTURE 'vazgec.bmp' ACTION CKARTINIT(XPARAM)
			END TOOLBAR
				
			
		DEFINE TAB Tab_1 AT 85,10 WIDTH 775 HEIGHT 500 

			PAGE 'Kart Listesi' 
				
				IF FORMADI='CARI'
			
					@ 30,10 grid grid1 width 700 height 400	headers {'','Cari Kod','Ünvanı (Adı-Soyadı)','','',''} 	widths { 0, 100,300,0,0,0 } justify {0,0,0,0,0,0} columncontrols	{ {'TEXTBOX','NUMERIC',repl('9',10)} , {'TEXTBOX','CHARACTER'} ,{'TEXTBOX','CHARACTER'},{'TEXTBOX','CHARACTER'} ,{'TEXTBOX','CHARACTER'} ,{'TEXTBOX','CHARACTER'} } ;
					ON CHANGE  Ckartgoster('1')
				
				ELSEIF FORMADI='STOK'
				
					@ 30,10 grid grid1 width 700 height 400	headers {'','Stok Kodu','Stok Cinsi','Brm','Satış Fiyatı','KDV%'} 	widths { 0, 100,300,75,100,50 } justify {0,0,0,0,1,1} columncontrols	{ {'TEXTBOX','NUMERIC',repl('9',10)} , {'TEXTBOX','CHARACTER'} ,{'TEXTBOX','CHARACTER'},{'TEXTBOX','CHARACTER'},{'TEXTBOX','NUMERIC','999999.9999'},{'TEXTBOX','NUMERIC','99.99'}  } ;
					ON CHANGE  Ckartgoster('2')
				ENDIF
				
			END PAGE

			PAGE 'Kart Tanımları' 
			
				IF FORMADI='CARI'
					@ 030, 010 label label1 value 'Kodu'
					@ 030, 300 label label0 value '0' INVISIBLE
					@ 055, 010 label label2 value 'Ünvanı(Adı-Soyadı)'
					@ 080, 010 label label3 value 'Adresi'				
					@ 105, 010 label label4 value 'Vergi Dairesi'
					@ 130, 010 label label5 value 'TC No/Vergi No'
					
					@ 030,125 textbox text1 width 100 height 20 value '' maxlength 19 
					@ 055,125 textbox text2 width 250 height 20 value '' maxlength 39 
					@ 080,125 textbox text3 width 300 height 20 value '' maxlength 49
					@ 105,125 textbox text4 width 150 height 20 value '' maxlength 20
					@ 130,125 textbox text5 width 100 height 20 value '' maxlength 11
					FOR DD=1 TO 5
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"FONTCOLOR",BLACK)
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"BACKCOLOR",YELLOW)
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"DISABLEDBACKCOLOR",WHITE)
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"DISABLEDFONTCOLOR",RED)
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"ENABLED",.F.)
					NEXT
				ELSEIF FORMADI='STOK'
					@ 030, 010 label label1 value 'Stok Kodu'
					@ 030, 300 label label0 value '0' INVISIBLE
					@ 055, 010 label label2 value 'Stok Cinsi & Tanım'
					@ 080, 010 label label3 value 'Birim'				
					@ 105, 010 label label4 value 'Birim Fiyatı'
					@ 130, 010 label label5 value 'KDV %'
					
					@ 030,125 textbox text1 width 100 height 20 value '' maxlength 19
					@ 055,125 textbox text2 width 250 height 20 value '' maxlength 39 
					@ 080,125 textbox text3 width 050 height 20 value '' maxlength 3
					@ 105,125 TEXTBOX text4 width 150 height 20 value 0 NUMERIC INPUTMASK "999,999.9999" 
					@ 130,125 TEXTBOX text5 width 150 height 20 value 0 NUMERIC INPUTMASK "99.99"
					FOR DD=1 TO 5
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"FONTCOLOR",BLACK)
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"BACKCOLOR",YELLOW)
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"DISABLEDBACKCOLOR",WHITE)
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"DISABLEDFONTCOLOR",BLACK)
						SETPROPERTY(FORMNAME,"TEXT"+ALLTRIM(STR(DD)),"ENABLED",.F.)
					NEXT
				ENDIF				
  
			END PAGE
			
		END TAB
	                             	
	END WINDOW
	&(FORMNAME).Center
	&(FORMNAME).Activate
ELSE
	&(FORMNAME).CENTER
	&(FORMNAME).RESTORE
	&(FORMNAME).SETFOCUS
ENDIF

RETURN NIL


*-----------------------------------------------------------------------------------------------------------------------------------------------------------------
FUNCTION CKARTDELETE
PARA STOCARI
local trans

IF STOCARI='1' 
	XFORM='CARIKART'
ELSEIF STOCARI='2'
	XFORM='STOKKART'
ENDIF

SATIR=GETPROPERTY(XFORM,"Grid1","VALUE")
XID=GETPROPERTY(XFORM,"GRID1","CELL",SATIR,1)
XAD=GETPROPERTY(XFORM,"GRID1","CELL",SATIR,3)
IF STOCARI='1'
	QUERY = "DELETE FROM CARI WHERE CARI_ID="+ALLTRIM(STR(XID))
ELSEIF STOCARI='2'
	QUERY = "DELETE FROM STOK WHERE STOK_ID="+ALLTRIM(STR(XID))
ENDIF
IF XID=0
	MSGINFO('Bir Kayıt Seçilmedi..!')
	RETURN NIL
ENDIF
MSGINFO('Silmeden hareketler kontrol edilecek .!')
MESAJ="< " +CARAD+" >  Kartı Silinecek mi?"
SILOK=MSGYESNO(MESAJ,"Dikkat")
IF SILOK=.T.
	IF MSGYESNO(" < " + XAD+" >  Silinecektir.","Eminmisiniz?") = .T.
		trans := FBStartTransaction( db )
		FBExecute( db, QUERY, nDialect, trans )
		fbcommit(trans)
		DELETE ITEM SATIR FROM GRID1 OF &(XFROM)
	ENDIF
ENDIF
RETURN NIL
*-----------------------------------------------------------------------------------------------------------------------------------------------------------------
FUNCTION CKARTGOSTER
PARA STOCARI
IF STOCARI='1' && CARI KART GOSTER
	XFORM='CARIKART'
	SATIR=GETPROPERTY(XFORM,"GRID1","VALUE")
	VLUE=GETPROPERTY(XFORM,"GRID1","CELL",SATIR,1)
	SETPROPERTY(XFORM,"LABEL0","VALUE",VLUE)
	SETPROPERTY(XFORM,"LABEL0","VISIBLE",.T.)
	VLUE=GETPROPERTY(XFORM,"GRID1","CELL",SATIR,2)
	SETPROPERTY(XFORM,"text1","VALUE",VLUE)
ELSEIF STOCARI='2' && STOK KART GOSTER
	XFORM='STOKKART'
	SATIR=GETPROPERTY(XFORM,"GRID1","VALUE")
	VLUE=GETPROPERTY(XFORM,"GRID1","CELL",SATIR,1)
	SETPROPERTY(XFORM,"LABEL0","VALUE",VLUE)
	FOR D=1 TO 5
		VLUE=GETPROPERTY(XFORM,"GRID1","CELL",SATIR,D+1)
		IF D<4
			SETPROPERTY(XFORM,"TEXT"+ALLTRIM(STR(D)),"VALUE",VLUE)
		ELSE
			SETPROPERTY(XFORM,"TEXT"+ALLTRIM(STR(D)),"VALUE",VLUE)
		ENDIF
	NEXT
ENDIF
RETURN .T.
*-------------------------------------------------------------------------------------------------------------------------------------------------------------------

FUNCTION CKARTSAVE
PARA XTYPE

LOCAL FETCH_STAT, trans
HATA := .F.
IF XTYPE='1'
	XFORM="CARIKART"
	DO CASE
		CASE EMPTY(GETPROPERTY(XFORM,"TEXT1","VALUE"))
					MSGINFO('Kod Boş Geçilemez.!')
					HATA:=.T.
		CASE EMPTY(GETPROPERTY(XFORM,"TEXT2","VALUE"))
					MSGINFO('Ünvan Boş Geçilemez.!')
					HATA:=.T.
		CASE EMPTY(GETPROPERTY(XFORM,"TEXT3","VALUE"))
					MSGINFO('Adres Boş Geçilemez.!')
					hata := .t.
		CASE EMPTY(GETPROPERTY(XFORM,"TEXT5","VALUE"))
					MSGINFO('Vergi No&Tc No Boş Geçilemez.!')
					hata := .t.
	endcase
ELSEIF XTYPE='2'
	XFORM="STOKKART"
	DO CASE
		CASE EMPTY(GETPROPERTY(XFORM,"TEXT1","VALUE"))
					MSGINFO('Stok Kodu Boş Geçilemez.!')
					HATA:=.T.
		CASE EMPTY(GETPROPERTY(XFORM,"TEXT2","VALUE"))
					MSGINFO('Stok Tanımı Boş Geçilemez.!')
					HATA:=.T.
		CASE EMPTY(GETPROPERTY(XFORM,"TEXT3","VALUE"))
					MSGINFO('Birim Boş Geçilemez.!')
					hata := .t.
	ENDCASE
ENDIF

IF HATA
	RETURN NIL
ENDIF
IF XTYPE='1' && cARI KART İSE
	CKOD=GETPROPERTY(XFORM,"TEXT1","VALUE")
	CUNV=GETPROPERTY(XFORM,"TEXT2","VALUE")
	CADR=GETPROPERTY(XFORM,"TEXT3","VALUE")
	CVDA=GETPROPERTY(XFORM,"TEXT4","VALUE")
	CVDN=GETPROPERTY(XFORM,"TEXT5","VALUE")

	IF val( GETPROPERTY(XFORM,"LABEL0","VALUE") ) = 0 
		query='INSERT INTO CARI (CARI_KOD,CARI_UNVAN,CARI_ADRES,CARI_VDAD,CARI_VDNO) VALUES'
		query=query+'("'+ckod+'" , "'+cunv+'" , "'+cadr+'" , "'+cvda+'" , "'+cvdn+'") returning CARI_ID'
		qry:=FBQUERY(db,query,ndialect)
		IF HB_ISNUMERIC( qry )
			MSGINFO(FBERROR(QRY))
		else
			DO WHILE ( fetch_stat := FBFetch( qry ) ) == 0
				   CID=(FBGETDATA(qry,1))
			enddo
			fbfree(qry)
			MSGINFO('Yeni Kayıt Yapıldı...!')
			ADD ITEM {VAL(CID),CKOD,CUNV,CADR,CVDA,CVDN} TO GRID1 OF &(XFORM)
		endif
	ELSE
		query='UPDATE CARI SET CARI_KOD="'+CKOD+'",  CARI_UNVAN="'+CUNV+'", CARI_ADRES="'+CADR
		query=query+'", CARI_VDAD="'+CVDA+'", CARI_VDNO="'+CVDN+'"  WHERE CARI_ID='+ALLTRIM(GETPROPERTY(XFORM,"LABEL0","VALUE"))
		trans := FBStartTransaction( db )
		qry:=FBQUERY(db,query,ndialect,trans)
		fbcommit(trans)
		IF HB_ISNUMERIC( qry )
			MSGINFO(FBERROR(QRY))
		else
			SATIR=GETPROPERTY(XFORM,"GRID1","VALUE")
			SETPROPERTY(XFORM,"GRID1","CELL",SATIR,2,CKOD)
		    SETPROPERTY(XFORM,"GRID1","CELL",SATIR,3,CUNV)
			SETPROPERTY(XFORM,"GRID1","CELL",SATIR,4,CADR)
			SETPROPERTY(XFORM,"GRID1","CELL",SATIR,5,CVDA)
			SETPROPERTY(XFORM,"GRID1","CELL",SATIR,6,CVDN)
		endif
	ENDIF
	CKARTINIT("1")
	CKARTGOSTER("1")
ELSEIF XTYPE='2' && STOK KART İSE
	SKOD=GETPROPERTY(XFORM,"TEXT1","VALUE")
	STAN=GETPROPERTY(XFORM,"TEXT2","VALUE")
	SBRM=GETPROPERTY(XFORM,"TEXT3","VALUE")
	SFYT=GETPROPERTY(XFORM,"TEXT4","VALUE")
	SKDV=GETPROPERTY(XFORM,"TEXT5","VALUE")
	IF val(GETPROPERTY(XFORM,"LABEL0","VALUE") ) = 0 
		query='INSERT INTO STOK (STOK_KOD,STOK_AD,STOK_BRM,STOK_FYT,STOK_KDV) VALUES'
		query=query+'("'+Skod+'" , "'+STAN+'" , "'+SBRM+'" , "'+STR(SFYT)+'" , "'+STR(SKDV)+'") returning STOK_ID'
		qry:=FBQUERY(db,query,ndialect)
		IF HB_ISNUMERIC( qry )
			MSGINFO(FBERROR(QRY))
		else
			DO WHILE ( fetch_stat := FBFetch( qry ) ) == 0
				   CID=(FBGETDATA(qry,1))
			enddo
			fbfree(qry)
			MSGINFO('Yeni Kayıt Yapıldı...!')
			ADD ITEM {VAL(CID),SKOD,STAN,SBRM,SFYT,SKDV} TO GRID1 OF &(XFORM)
		endif
	ELSE
		query='UPDATE STOK SET STOK_KOD="'+SKOD+'",  STOK_AD="'+STAN+'", STOK_BRM="'+SBRM
		query=query+'", STOK_FYT="'+STR(SFYT)+'", STOK_KDV="'+STR(SKDV)+'"  WHERE STOK_ID='+ALLTRIM(GETPROPERTY(XFORM,"LABEL0","VALUE"))
		trans := FBStartTransaction( db )
		qry:=FBQUERY(db,query,ndialect,trans)
		fbcommit(trans)
		IF HB_ISNUMERIC( qry )
			MSGINFO(FBERROR(QRY))
		else
			SATIR=GETPROPERTY(XFORM,"GRID1","VALUE")
			SETPROPERTY(XFORM,"GRID1","CELL",SATIR,2,SKOD)
		    SETPROPERTY(XFORM,"GRID1","CELL",SATIR,3,STAN)
			SETPROPERTY(XFORM,"GRID1","CELL",SATIR,4,SBRM)
			SETPROPERTY(XFORM,"GRID1","CELL",SATIR,5,SFYT)
			SETPROPERTY(XFORM,"GRID1","CELL",SATIR,6,SKDV)
		   
		endif
		
	ENDIF
	CKARTINIT("2")
	CKARTGOSTER("2")

	
ENDIF
	
	
RETURN NIL
*/
*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*

FUNCTION CKARTLOAD
param XTYPE
LOCAL FETCH_STAT

IF XTYPE='1' && CARİ KARTLARI İSE
	XFORM='CARIKART'
	qry := FBQuery( db, "SELECT CARI_ID, CARI_KOD, CARI_UNVAN, CARI_ADRES, CARI_VDAD, CARI_VDNO FROM CARI", nDialect )
ELSEIF XTYPE='2' && STOK KARTLARI İSE
	XFORM='STOKKART'
	qry := FBQuery( db, "SELECT STOK_ID, STOK_KOD, STOK_AD, STOK_BRM, STOK_FYT, STOK_KDV FROM STOK", nDialect)
	
ENDIF

IF HB_ISNUMERIC( qry )
	MSGINFO('Hata:'+FBERROR(QRY))
	RETURN NIL
ENDIF

DELETE ITEM ALL FROM GRID1 OF &(XFORM)
	
DO WHILE ( fetch_stat := FBFetch( qry ) ) == 0 
	IF XTYPE = '1'
		ADD ITEM {VAL(FBGETDATA(QRY,1)),FBGETDATA(QRY,2),FBGETDATA(QRY,3),FBGETDATA(QRY,4),FBGETDATA(QRY,5),FBGETDATA(QRY,6)} TO GRID1 OF &(XFORM)
	ELSEIF XTYPE = '2'
		ADD ITEM {VAL(FBGETDATA(QRY,1)),FBGETDATA(QRY,2),FBGETDATA(QRY,3),FBGETDATA(QRY,4),VAL(FBGETDATA(QRY,5)),VAL(FBGETDATA(QRY,6))} TO GRID1 OF &(XFORM)
	ENDIF
ENDDO
FBFREE(QRY)
SETPROPERTY( XFORM,"GRID1" , "VALUE", 1)
RETURN NIL


*--------------------------------------------------------------------------------------------------------------------------------------------------------------------

FUNCTION CKARTEDIT
PARA XTYPE
CKARTGOSTER(XTYPE)
IF XTYPE='1'
	XFORM='CARIKART'
ELSE
	XFORM='STOKKART'
ENDIF
SETPROPERTY(XFORM,"BUTTON_1","ENABLED",.F.)
SETPROPERTY(XFORM,"BUTTON_2","ENABLED",.F.)
SETPROPERTY(XFORM,"BUTTON_3","ENABLED",.F.)
SETPROPERTY(XFORM,"BUTTON_4","ENABLED",.T.)
SETPROPERTY(XFORM,"BUTTON_5","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT1","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT2","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT3","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT4","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT5","ENABLED",.T.)
SETPROPERTY(XFORM,"Tab_1","VALUE",2)
SETPROPERTY(XFORM,"Grid1","ENABLED",.F.)
SETFOCUS TEXT1 OF &(XFORM)
RETURN NIL


*--------------------------------------------------------------------------------------------------------------------------------------------------------------------

FUNCTION CKARTEKLE
PARA XTYPE
IF XTYPE='1'
	XFORM='CARIKART'
ELSE
	XFORM='STOKKART'
ENDIF
SETPROPERTY(XFORM,"BUTTON_1","ENABLED",.F.)
SETPROPERTY(XFORM,"BUTTON_2","ENABLED",.F.)
SETPROPERTY(XFORM,"BUTTON_3","ENABLED",.F.)
SETPROPERTY(XFORM,"BUTTON_4","ENABLED",.T.)
SETPROPERTY(XFORM,"BUTTON_5","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT1","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT2","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT3","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT4","ENABLED",.T.)
SETPROPERTY(XFORM,"TEXT5","ENABLED",.T.)
SETPROPERTY(XFORM,"Tab_1","VALUE",2)
SETPROPERTY(XFORM,"Grid1","ENABLED",.F.)

SETPROPERTY(XFORM,"LABEL0","VALUE","0")
SETPROPERTY(XFORM,"TEXT1","VALUE","")
SETPROPERTY(XFORM,"TEXT2","VALUE","")
SETPROPERTY(XFORM,"TEXT3","VALUE","")
IF XTYPE="2"
	SETPROPERTY(XFORM,"TEXT4","VALUE",0)
	SETPROPERTY(XFORM,"TEXT5","VALUE",0)
ELSE
	SETPROPERTY(XFORM,"TEXT4","VALUE","")
	SETPROPERTY(XFORM,"TEXT5","VALUE","")
ENDIF
SETFOCUS TEXT1 OF &(XFORM)
RETURN NIL

*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FUNCTION CKARTINIT

PARA XTYPE
IF XTYPE='1'
	XFORM='CARIKART'
ELSE
	XFORM='STOKKART'
ENDIF
SETPROPERTY(XFORM,"BUTTON_1","ENABLED",.t.)
SETPROPERTY(XFORM,"BUTTON_2","ENABLED",.t.)
SETPROPERTY(XFORM,"BUTTON_3","ENABLED",.t.)
SETPROPERTY(XFORM,"BUTTON_4","ENABLED",.f.)
SETPROPERTY(XFORM,"BUTTON_5","ENABLED",.f.)
SETPROPERTY(XFORM,"TEXT1","ENABLED",.F.)
SETPROPERTY(XFORM,"TEXT2","ENABLED",.F.)
SETPROPERTY(XFORM,"TEXT3","ENABLED",.F.)
SETPROPERTY(XFORM,"TEXT4","ENABLED",.F.)
SETPROPERTY(XFORM,"TEXT5","ENABLED",.F.)
SETPROPERTY(XFORM,"TEXT1","VALUE","")
SETPROPERTY(XFORM,"TEXT2","VALUE","")
SETPROPERTY(XFORM,"TEXT3","VALUE","")
SETPROPERTY(XFORM,"TEXT4","VALUE","")
SETPROPERTY(XFORM,"TEXT5","VALUE","")

SETPROPERTY(XFORM,"Tab_1","VALUE",1)
SETPROPERTY(XFORM,"Grid1","ENABLED",.T.)

SETFOCUS GRID1 OF &(XFORM)
RETURN NIL

*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

firebird db create scripts ;

Code: Select all

CREATE TABLE CARI (
  CARI_ID INTEGER,
  CARI_KOD VARCHAR(20),
  CARI_UNVAN VARCHAR(40),
  CARI_VDNO VARCHAR(12),
  CARI_VDAD VARCHAR(20),
  CARI_ADRES VARCHAR(50));


CREATE INDEX IDX_CARI1 ON CARI(CARI_ID);


SET TERM ^ ;

CREATE TRIGGER BI_CARI_CARI_ID FOR CARI
ACTIVE BEFORE INSERT
POSITION 0
AS
BEGIN
  IF (NEW.CARI_ID IS NULL) THEN
      NEW.CARI_ID = GEN_ID(CARI_CARI_ID_GEN, 1);
END^

SET TERM ; ^

Code: Select all

CREATE TABLE STOK (
  STOK_ID INTEGER,
  STOK_KOD VARCHAR(20),
  STOK_AD VARCHAR(40),
  STOK_BRM VARCHAR(3),
  STOK_FYT NUMERIC(15, 4) DEFAULT 0.0,
  STOK_KDV NUMERIC(15, 2) DEFAULT 0.0);


ALTER TABLE STOK ADD PRIMARY KEY (STOK_ID);


SET TERM ^ ;

CREATE TRIGGER BI_STOK_STOK_ID FOR STOK
ACTIVE BEFORE INSERT
POSITION 0
AS
BEGIN
  IF (NEW.STOK_ID IS NULL) THEN
      NEW.STOK_ID = GEN_ID(STOK_STOK_ID_GEN, 1);
END^

SET TERM ; ^

skonuk
Posts: 28
Joined: Fri Sep 17, 2010 7:37 pm
Location: turkey-bursa

Post by skonuk » Tue Dec 17, 2013 9:41 am

I wrote incorrectly in the Forum section.
Sorry.

User avatar
esgici
Posts: 4509
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 386 times
Been thanked: 111 times
Contact:

Post by esgici » Tue Dec 17, 2013 10:42 am

Tekrar hoşgeldin Salim kardeş

Seni burda daha sık görmeyi çok arzu ediyorum ama bilirsin, bu işler zorla olmaz.

Sağlık olsun, seyrek görünmek hiç görünmemekten iyidir.

Thanks to share your work.

I will look it soon.

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D

User avatar
serge_girard
Posts: 2317
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 555 times
Been thanked: 116 times
Contact:

Post by serge_girard » Tue Dec 17, 2013 10:59 am

Salim,

Thanks for sharing! I suppose I need Firebird?

Greetings, Serge

skonuk
Posts: 28
Joined: Fri Sep 17, 2010 7:37 pm
Location: turkey-bursa

Post by skonuk » Tue Dec 17, 2013 12:28 pm

Örnek firebird veritabanını kullanarak çalışıyor,

Programı derlediğim dizine harbour\contrib\hbfbird klasöründeki dosyaları kopyaladım. (hbfbird.hbc ve hbfbird.hbx dosyaları)

getproperty ve setproperty oldukça sevimli fonksiyonlar.

*-----------------------------------------

Example using the Firebird database is running,

I compiled the program directory harbor \ contrib \ hbfbird I copied files in the folder. (hbfbird.hbc and hbfbird.hbx files)

GetProperty and SetProperty functions quite cute.

Post Reply