clear
set century on
set date german
set exclusive off
set confirm on
set console off
SET SAFETY OFF
set status bar off
set talk off
set deleted on
SET REPROCESS TO AUTOMATIC
SET OPTIMIZE ON
SET MULTILOCKS ON
SET DECIMALS TO 4

CLOSE DATABASES

set sysmenu save
SET SYSMENU OFF
DEACTIVATE WINDOW "Standard"
putanja=CURDIR()
set default to &putanja

*set procedure to sve_proc

USE firma
mopcija=ALLTRIM(firma.opcioni)
mglavni=ALLTRIM(firma.glavni)
mrobbaz=ALLTRIM(firma.robno)+"\belcar"
mldbaz=ALLTRIM(firma.ld)
CLOSE databases
SET DEFAULT TO &mglavni
set path to &mopcija

*=MESSAGEBOX(mglavni+mopcija)



USE parame
nazfir=ALLTRIM(naziv)+" "+ALLTRIM(naziv1)
*mdat=CTOD(dekript(parame.mks))
*IF mdat>DATE()	*
*	poruka("Ne mozete raditi sa starim datumom!")
*	CLOSE ALL
*	CLEAR EVENTS
*	RETURN
*ELSE
*	mdat=kript(DTOC(mdat))	
*	replace parame.mks WITH mdat
*endif
CLOSE databases


MODIFY WINDOW SCREEN TITLE 'Finansijsko knjigovodstvo - '+nazfir 
WITH _Screen
.WindowState = 2 
.MaxHeight=735
.MaxWidth=1020
.MaxButton=.f.
.Closable=.f.
.AutoCenter=.t.
.backcolor=0
.movable=.T.
*.left=6
*.top=25
.fontbold=.t.
.fontsize=14
*.maxbutton=.f.
*.fontname="Tahoma"
*.picture=putanja+"\nsgeo.jpg"
ENDWITH

public m.sifkupdob, m.nazkupdob, m.adrkupdob, m.telkupdob, m.zirkupdob, m.meskupdob,M.MATKUPDOB, m.naz1kupdob, m.kuppdv, m.pttkupdob
PUBLIC m.firma, m.adresa, M.MESTO, m.telefon, m.radnik, m.prio, m.sifrad, m.kurs,m.maticni, m.pib
PUBLIC oli, sta, sporocilo, merror, mess, mess1, mprog, mlineno, M.slovima,m.radnik,m.nalog, M.DOKUMENT
PUBLIC m.korisnik, m.smena, m.datum
PUBLIC M.OD, M.DO, stanal, stanal1
PUBLIC m.konto, m.analitika, m.nazkon, trazio,m.dug,m.pot,m.sal, M.VALUTA, M.BROJDNE, m.brojdne1
PUBLIC statros,statros1, m.konto1, m.analitika1, M.NAZKON1, m.konto2, m.analitika2, M.NAZKON2
PUBLIC prvastavka, m.poslovna, m.blagajna, m.nazblag, stablag, m.donos, m.slovima, m.troska, m.naztros, m.nesto
PUBLIC m.konbla, m.anabla, mldnalog
****** komitenti **********
m.sifkupdob=SPACE(6)
m.nazkupdob=space(50)
m.adrkupdob=SPACE(30)
m.telkupdob=SPACE(20)
m.zirkupdob=SPACE(25)
m.matkupdob=SPACE(20)
m.meskupdob=SPACE(30)
m.naz1kupdob=SPACE(50)
m.kuppdb=SPACE(1)
m.pttkupdob=SPACE(5)
mldnalog=SPACE(10)

m.slovima=SPACE(30)
m.blagajna=SPACE(2)
m.donos=0
stablag=SPACE(1)
m.poslovna=SPACE(4)
prvastavka=.t.
M.BROJDNE=0
m.brojdne1=0
M.VALUTA="Din"
m.dug=0
m.pot=0
m.sal=0
M.NALOG=SPACE(10)
M.DOKUMENT=SPACE(10)
trazio=.t.
stanal=SPACE(1)
stanal1=SPACE(1)
m.datum=DATE()
M.OD=DATE()
M.DO=DATE()
m.konto=SPACE(8)
m.analitika=SPACE(7)
m.konbla=SPACE(8)
m.anabla=SPACE(7)
m.nazkon=SPACE(60)
m.konto1=SPACE(8)
m.analitika1=SPACE(7)
m.nazkon1=SPACE(60)
m.konto2=SPACE(8)
m.analitika2=SPACE(7)
m.nazkon2=SPACE(60)
oli=SPACE(1)
sporocilo=SPACE(40)
m.prio=0
m.slovima=SPACE(1)
m.korisnik=SPACE(20)
m.troska=SPACE(6)
m.naztros=SPACE(40)
m.nesto=SPACE(30)
	DO otvaranje
ON ERROR do greska with ERROR(),MESSAGE(),MESSAGE(1),PROGRAM(),LINENO()
	DO FORM lozinka
*		m.korisnik='sasa'
*		m.prio=10
*		m.sifrad="001"
*		m.smena=1
*		prosao=.t.
*IF prosao=.t.
*	CLOSE databases
*	DO otvaranje
	do form osnova
	do menU1.mpr
*endif
read event
CLOSE all
return







***************************************************

procedure otvaranje

CLOSE ALL

ERASE DKNJIGA.CDX

ERASE pknjiga.DBF
ERASE pknjiga.CDX
CREATE TABLE pknjiga;
	(;
	datum 		d(8),;
	nalog		c(10),;
	dokument	c(10),;
	konto		c(8),;
	analitika	c(7),;
	opis		c(30),;
	zatvara		c(20),;
	duguje		n(17,2),;
	potrazuje	n(17,2),;
	eduguje		n(17,2),;
	epotrazuje	n(17,2),;
	saldo		n(17,2),;
	esaldo		n(17,2),;
	datknji		d(8),;
	dpo			d(8),;
	valuta		d(8),;
	osnovica	n(15,2),;
	mtroska		c(6),;
	automatika	c(2))

ERASE tknjiga.DBF
ERASE tknjiga.CDX
CREATE TABLE tknjiga;
	(;
	rb			n(4),;
	datum 		d(8),;
	nalog		c(10),;
	dokument	c(10),;
	konto		c(8),;
	analitika	c(7),;
	opis		c(30),;
	nazkon		c(60),;
	zatvara		c(20),;
	duguje		n(17,2),;
	potrazuje	n(17,2),;
	eduguje		n(17,2),;
	epotrazuje	n(17,2),;
	saldo		n(17,2),;
	esaldo		n(17,2),;
	datknji		d(8),;
	linija		n(1),;
	dpo			d(8),;
	valuta		d(8),;
	osnovica	n(15,2),;
	mtroska		c(6),;
	naziv		c(39),;
	automatika	c(2))
	
ERASE psknjiga.DBF
ERASE psknjiga.CDX
CREATE TABLE psknjiga;
	(;
	datum 		d(8),;
	nalog		c(10),;
	dokument	c(10),;
	konto		c(8),;
	analitika	c(7),;
	opis		c(30),;
	zatvara		c(20),;
	duguje		n(17,2),;
	potrazuje	n(17,2),;
	eduguje		n(17,2),;
	epotrazuje	n(17,2),;
	saldo		n(17,2),;
	esaldo		n(17,2),;
	datknji		d(8),;
	linija		n(1),;
	dpo			d(8),;
	valuta		d(8),;
	mtroska		c(6),;
	automatika	c(2))	
	
ERASE zknjiga.DBF
ERASE zknjiga.CDX
CREATE TABLE zknjiga;
	(;
	datum 		d(8),;
	nalog		c(10),;
	dokument	c(10),;
	konto		c(8),;
	analitika	c(7),;
	opis		c(30),;
	zatvara		c(20),;
	duguje		n(17,2),;
	potrazuje	n(17,2),;
	eduguje		n(17,2),;
	epotrazuje	n(17,2),;
	saldo		n(17,2),;
	esaldo		n(17,2),;
	datknji		d(8),;
	linija		n(1),;
	dpo			d(8),;
	valuta		d(8),;
	osnovica	n(15,2),;
	mtroska		c(6),;
	automatika	c(2))


ERASE karkon.DBF
ERASE karkon.CDX
CREATE TABLE karkon;
	(datum 		d(8),;
	nalog		c(10),;
	dokument	c(10),;
	konto		c(8),;
	analitika	c(7),;
	opis		c(60),;
	zatvara		c(20),;
	duguje		n(17,2),;
	potrazuje	n(17,2),;
	eduguje		n(17,2),;
	epotrazuje	n(17,2),;
	saldo		n(17,2),;
	esaldo		n(17,2),;
	datknji		d(8),;
	nazkupdob	c(60),;
	dpo			d(8),;
	valuta		d(8),;
	datsta		d(8),;
	oznaka		c(1),;
	OZNAKA1		C(1),;
	mtroska		c(6),;
	automatika	c(2))
	
ERASE zaklist.dbf
ERASE zaklist.cdx
CREATE TABLE zaklist;
	(konto		c(8),;
	analitika	c(7),;
	opis		c(180),;
	psdu		n(15,2),;
	pspo		n(15,2),;
	pbpsdu		n(15,2),;
	pbpspo		n(15,2),;
	pspsdu		n(15,2),;
	pspspo		n(15,2),;
	saldo		n(15,2),;
	klasa		c(1),;
	subklasa	c(2),;
	sub3		c(3),;
	mtroska		c(6))


ERASE upopre.dbf
ERASE upopre.cdx
CREATE TABLE upopre;
	(analitika	c(7),;
	naziv		c(30),;
	adresa		c(30),;
	MESTO		C(30),;
	PIB			C(9),;
	k150		n(15,2),;
	k202		n(15,2),;
	k433		n(15,2),;
	k430		n(15,2),;
	saldo		n(15,2),;
	mtroska		c(6))


ERASE upopre1.dbf
ERASE upopre1.cdx
CREATE TABLE upopre1;
	(konto		c(8),;
	analitika	c(7),;
	naziv		c(60),;
	suma		n(15,2),;
	suma1		n(15,2),;
	razlika		n(15,2),;
	mtroska		c(6))

ERASE kepu.dbf
ERASE kepu.cdx
CREATE TABLE kepu;
	(rb			n(5),;
	datum		d(8),;
	opis		c(60),;
	zaduzenje	n(15,2),;
	razduzenje	n(15,2),;
	uplata		n(15,2),;
	nalog		c(10),;
	dokument	c(10))


ERASE imzarada.dbf
ERASE imzarada.cdx
CREATE TABLE imzarada;
	(datum		d(8),;
	nalog		c(10),;
	konto		c(8),;
	dokument	c(10),;
	duguje		n(17,2),;
	potrazuje	n(17,2))


ERASE prazna.dbf
ERASE prazna.cdx
CREATE TABLE prazna;
	(prazno		c(63))


ERASE naznal.dbf
ERASE naznal.cdx
CREATE TABLE naznal;
	(naziv		c(10))


CLOSE ALL



OPEN DATABASE &mrobbaz SHARED

USE kupdob ALIAS kupdob SHARED IN 0

open database fin shared	

USE parame ALIAS parame SHARED IN 0
	m.kurs	 =parame.kurs
	m.firma	 =ALLTRIM(parame.naziv)+" "+ALLTRIM(parame.naziv1)
	m.adresa =parame.adresa
	m.mesto  =parame.ptt+" "+parame.mesto
	m.telefon=parame.tel1
	m.tel2	 =parame.tel2
	m.fax	 =parame.fax
	m.maticni=parame.maticni
	m.registar=parame.registar
	m.delatnost=parame.delatnost
	m.ziro   =parame.ziro
	m.pib    =parame.pib
	m.poslovna=parame.poslovna

USE konplan ALIAS konplan SHARED IN 0
USE greska 	ALIAS greska SHARED IN 0
USE firma 	ALIAS firma EXCLUSIVE IN 0
USE gknjiga ALIAS gknjiga SHARED IN 0
USE radnici ALIAS radnici SHARED IN 0 
USE DNEKNJI ALIAS DNEKNJI SHARED IN 0
USE troskovi ALIAS troskovi shared IN 0	
USE blagajne ALIAS blagajne SHARED IN 0
USE blisp ALIAS blisp SHARED IN 0
USE blupl ALIAS blupl SHARED IN 0
USE MTROSKA ALIAS MTROSKA SHARED IN 0


USE dknjiga ALIAS dknjiga exclusive IN 0
USE tknjiga ALIAS tknjiga EXCLUSIVE IN 0
USE upopre	ALIAS upopre EXCLUSIVE IN 0
USE upopre1 ALIAS upopre1 EXCLUSIVE IN 0
USE zknjiga ALIAS zknjiga EXCLUSIVE IN 0
USE psknjiga ALIAS psknjiga EXCLUSIVE IN 0
USE imzarada ALIAS imzarada EXCLUSIVE IN 0
USE prazna ALIAS prazna EXCLUSIVE IN 0
USE naznal ALIAS naznal EXCLUSIVE IN 0

SELECT upopre1
INDEX ON konto+analitika TAG konto OF upopre1 additive
INDEX on naziv TAG naziv OF upopre1 additive
INDEX on analitika TAG analitika OF upopre1 additive
INDEX on suma TAG suma OF upopre1 additive
INDEX on suma1 TAG suma1 OF upopre1 additive
INDEX on razlika TAG razlika OF upopre1 additive

SELECT Dknjiga
INDEX ON nalog+dokument TAG nalog OF Dknjiga ADDITIVE

SELECT tknjiga
INDEX ON rb TAG rb OF tknjiga ADDITIVE
INDEX ON nalog TAG nalog OF tknjiga ADDITIVE
INDEX ON konto TAG konto OF tknjiga ADDITIVE
INDEX ON datum TAG datum OF tknjiga ADDITIVE
INDEX ON analitika TAG analitika OF tknjiga ADDITIVE
INDEX ON duguje TAG duguje OF tknjiga ADDITIVE
INDEX ON potrazuje TAG potrazuje OF tknjiga ADDITIVE
INDEX ON opis TAG opis OF tknjiga ADDITIVE
INDEX ON zatvara TAG zatvara OF tknjiga ADDITIVE

USE pknjiga	ALIAS Pknjiga EXCLUSIVE IN 0
SELECT pknjiga
INDEX ON nalog+dokument TAG nalog OF pknjiga ADDITIVE
INDEX ON datum TAG datum OF pknjiga ADDITIVE
INDEX ON konto+analitika+DTOS(datum) TAG pknjiga OF pknjiga additive

USE karkon	ALIAS karkon EXCLUSIVE IN 0
SELECT karkon
INDEX ON nalog+dokument TAG nalog OF karkon ADDITIVE
INDEX ON datum TAG datum OF karkon ADDITIVE
INDEX ON konto+analitika+DTOS(dpo) TAG konto OF karkon additive
INDEX ON duguje TAG duguje OF karkon DESCENDING additive
INDEX ON potrazuje TAG potrazuje OF karkon DESCENDING additive
INDEX ON saldo TAG saldo OF karkon DESCENDING additive
INDEX ON zatvara TAG zatvara OF karkon additive
INDEX ON dpo TAG dpo OF karkon additive
INDEX ON valuta TAG valuta OF karkon additive
INDEX ON opis TAG opis OF karkon additive
INDEX ON eduguje TAG eduguje OF karkon DESCENDING additive
INDEX ON epotrazuje TAG epotrazuje OF karkon DESCENDING additive
INDEX ON nazkupdob TAG nazkupdob OF karkon additive
INDEX ON analitika TAG analitika OF karkon additive
INDEX on dokument TAG dokument OF karkon additive

USE zaklist	ALIAS zaklist EXCLUSIVE IN 0
select zaklist 
INDEX ON konto+analitika TAG konto OF zaklist additive

SELECT upopre
INDEX ON analitika TAG analitika OF upopre additive
INDEX ON naziv	TAG naziv	OF upopre additive
INDEX ON saldo	TAG saldo	OF upopre DESCENDING additive
INDEX ON k202	TAG k202	OF upopre DESCENDING additive
INDEX ON k430	TAG k430	OF upopre DESCENDING additive
INDEX ON k433	TAG k433	OF upopre DESCENDING additive
INDEX ON k150	TAG k150	OF upopre DESCENDING additive

SELECT zknjiga
INDEX ON konto+analitika TAG zknjiga OF zknjiga additive

USE kepu ALIAS kepu EXCLUSIVE IN 0
SELECT kepu
INDEX ON datum TAG datum OF kepu additive

RETURN
******************************************************************


FUNCTION okom(mmkupdob)
SELECT kupdob
SET ORDER TO tag kupdob
GOTO top
SEEK mmkupdob
IF !FOUND()
	=MESSAGEBOX("Zao mi je ali takav kupac ne postoji","Upozorenje",48)
	m.sifkupdob=SPACE(6)
	m.nazkupdob=SPACE(30)
	m.adrkupdob=SPACE(30)
	m.meskupdob=SPACE(30)
	m.pibkupdob=SPACE(12)
ELSE
	m.sifkupdob=kupdob.kupdob
	m.nazkupdob=kupdob.naziv
	m.adrkupdob=kupdob.adresa
	m.meskupdob=kupdob.mesto
	m.pibkupdob=kupdob.pib
ENDIF

RETURN
****************************************


FUNCTION poruka(porukica)
=MESSAGEBOX(porukica,"Poruka!!!!",48)
RETURN



***********************************************************************
FUNCTION nadjikom(mmkupdob)

SELECT kupdob
SET ORDER TO tag kupdob
GOTO top
SEEK mmkupdob
IF !FOUND()
	=PORUKA("Zao mi je ali takav kupac ne postoji")
ELSE
	m.sifkupdob=kupdob.kupdob
	m.nazkupdob=kupdob.naziv
	m.adrkupdob=kupdob.adresa
	m.meskupdob=kupdob.mesto
ENDIF

RETURN



*************************************************************************
PROCEDURE fenix
CLOSE ALL
*DO FORM indexiraj
CLOSE ALL
open database belcar shared	
DO otvaranje
RETURN

*************************************************************
FUNCTION rolock()
DO WHILE !RLOCK()
=MESSAGEBOX("Neko je zakljucao slog","Poruka!",0,1)
ENDDO
RETURN

************************************************************
FUNCTION robica()
PARAMETERS mrobica
SELECT zalihe
SET ORDER to tag sifra
GOTO top
SEEK mrobica
m.ncena=zalihe.nabcen
m.pcena=zalihe.procen
kolicina=zalihe.ukol-zalihe.ikol
RETURN (kolicina)



*********************************************************************
FUNCTION dodzal()
PARAMETERS msifra, mkolicina, mncen, mpcen, dalip, dalin, mstaje
SELECT roba
SET ORDER TO tag sifrob
GOTO top
SEEK msifra
IF FOUND()
	IF mstaje="U"
		replace uvrednost 	WITH uvrednost+mkolicina*mncen
		replace ukol		WITH ukol+mkolicina
		msncen=(kolicina*nabcen+mkolicina*mncen)/(kolicina+mkolicina)
		IF dalin=.t.
			replace nabcen 		WITH msncen
		endif
		IF dalip=.t.
			replace procen		WITH mpcen
		endif	
		replace kolicina	WITH kolicina+mkolicina
	ENDIF
	IF mstaje="I"
		replace ivrednost 	WITH ivrednost+mkolicina*mpcen
		replace ikol		WITH ikol+mkolicina
		IF dalip=.t.
			replace procen		WITH mpcen
		endif	
		replace kolicina	WITH kolicina+mkolicina
	ENDIF

endif	
return
*********************************************************************
FUNCTION oduzal()
PARAMETERS msifra, mkolicina, mncen, mpcen, dalip, dalin, mstaje
SELECT roba
SET ORDER TO tag sifrob
GOTO top
SEEK msifra
IF FOUND()
	IF mstaje="U"
		replace uvrednost 	WITH uvrednost-mkolicina*mncen
		replace ukol		WITH ukol-mkolicina
		IF dalip=.t.
			replace procen		WITH mpcen
		endif	
		replace kolicina	WITH kolicina-mkolicina
	ENDIF
	IF mstaje="I"
		replace ivrednost 	WITH ivrednost-mkolicina*mpcen
		replace ikol		WITH ikol-mkolicina
		IF dalip=.t.
			replace procen		WITH mpcen
		endif	
		replace kolicina	WITH kolicina-mkolicina
	ENDIF

endif	
return

*********************************************************************

function SLOVIMA( broj )
DECLARE imebr[9]
  local _trojka,;
  tric,;
  cs,;
  cd,;
  cj,;
  sl1

  imebr[1]="jedan"
  imebr[2]="dva"
  imebr[3]="tri"
  imebr[4]="cetiri"
  imebr[5]="pet"
  imebr[6]="sest"
  imebr[7]="sedam"
  imebr[8]="osam"
  imebr[9]="devet"

  rez   = " "
  celi  = int( broj )
  dec   = ( broj - celi ) * 100
  cbroj = str( celi, 15 )
  i     = 1

  if broj == 0 
           return "nula" 
  endif

    DO while ( i < 15 )
      tric    = substr( cbroj, i, 3 )
      _trojka = val( tric )
      if tric # "   " .and. ( tric # "000" .or. i = 4 )
        cs = val( substr( tric, 1, 1 ) )
        cd = val( substr( tric, 2, 1 ) )
        cj = val( substr( tric, 3, 1 ) )
        do case
          case cs = 1
            rez = rez+ "sto"
          case cs = 2
            rez = rez+ "dve"
          case cs > 2
            rez = rez+ imebr[cs]
        endcase
        do case
          case cs > 4
            rez = rez+ "stotina"
          case cs > 1
            rez =rez+ "stotine"
        endcase
        sl1 = iif( cj = 0, "", imebr[cj] )
        do case
          case cd =4
            rez =rez+ "cetr"
          case cd = 5
            rez =rez+ "pe"
          case cd = 6
            rez =rez+ "sez"
          case cd = 9
            rez =rez+ "deve"
          case cd > 1
            rez =rez+ imebr[cd]
          case cd = 1
            sl1 = ""
            do case
              case cj = 0
                rez =rez+ "deset"
              case cj = 1
                rez =rez+ "jeda"
              case cj = 4
                rez =rez+ "cetr"
              otherwise
                rez =rez+ imebr[cj]
            endcase
            if cj > 0 
            	 rez =rez+ "naest" 
          	endif
          endcase
          if cd > 1 
          	 rez =rez+ "deset" 
          endif
            do case
              case cj = 1 .and. ( i == 4 .or. i == 10 ) .and. cd # 1
                sl1 = "jedna"
              case cj = 2 .and. ( i == 4 .or. i == 10 ) .and. cd # 1
                sl1 = "dve"
            endcase
            rez =rez+ sl1
            do case
              case i = 1 .or. i == 10
                rez =rez+ "hiljad"
                do case
                  case ( _trojka % 100 > 11 .and. _trojka % 100 < 19 ) .or. cj == 1
                    rez =rez+ "a"
                  case _trojka = 1
                    rez =rez+ "u"
                  case cj > 4 .or. cj = 0
                    rez =rez+ "a"
                  case cj > 1
                    rez =rez+ "e"
                endcase
              case i = 4
                rez =rez+ "milijard"
                do case
                  case ( _trojka % 100 > 11 .and. _trojka % 100 < 19 )
                    rez =rez+ "i"
                  case cj = 1
                    rez =rez+ "a"
                  case cj > 4 .or. cj = 0
                    rez =rez+ "i"
                  case cj > 1
                    rez =rez+ "e"
                endcase
              case i = 7
                rez =rez+ "milion"
                if cj # 1 .or. ( _trojka % 100 > 11 .and. _trojka % 100 < 19 )
                  rez =rez+ "a"
                endif
            endcase
          endif
          i =i+ 3
        enddo
        return( rez + " i " + transform( dec, "@L 99" ) + "/100" )
        **********************************************************************



procedure kript
PARAMETERS slogic
n=LEN(slogic)
mslogic=""
for i=1 to n
mSLOGic=mSLOGic+CHR(ASC(SUBSTR(slogic,i,1))+114)
NEXT i
return(mslogic)



PROCEDURE dekript
PARAMETERS slogic
n=LEN(slogic)
mslogic=""
for i=1 to n
mSLOGic=mSLOGic+CHR(ASC(SUBSTR(slogic,i,1))-114)
NEXT i
return(mslogic)


PROCEDURE kripro
PARAMETERS mjedan,mdva
broj=0
FOR i=1 TO 10
	broj=broj+ASC(SUBSTR(prva,i,1))
	broj=broj+ASC(SUBSTR(druga,i,1))
NEXT i
return(broj)


PROCEDURE placeno
SELECT parame 
m.dokle=CTOD(dekript(parame.mkd))
m.kolko=VAL(ALLTRIM(dekript(parame.mkl)))
m.dani =VAL(ALLTRIM(dekript(parame.mkn)))
IF m.kolko>0
	IF DATE()>m.dokle
		m.proso=.f.
		*DO FORM registruj
			IF m.proso=.f.
				CLOSE ALL
				cancel
				RETURN
			ENDIF
	ENDIF
ENDIF
return				


PROCEDURE greska
PARAMETER gr1,gr2,gr3,gr4,gr5
merror=gr1
mess=gr2
mess1=gr3
mprog=gr4
mlineno=gr5
SELECT greska
APPEND BLANK
replace datum WITH DATE()
replace vreme WITH TIME()
replace greska WITH merror
replace por	WITH mess
replace por1 WITH mess1
replace pro WITH mprog
replace lini	WITH mlineno
replace radnik WITH m.sifrad
DO FORM greska
RETURN


FUNCTION pripremi(sta)
	=CURSORSETPROP("Buffering",3,sta)
return(0)

FUNCTION upisi()
	=TABLEUPDATE(1,.t.)
return(0)

FUNCTION pocdat()
mgod=YEAR(DATE())
mdatum=CTOD("01.01."+ALLTRIM(STR(mgod)))
return(mdatum)