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"
mzajbaz=ALLTRIM(firma.zajednicka)+"\str"
mldbaz=ALLTRIM(firma.ld)
xlsput=ALLTRIM(firma.xlsputanja)
CLOSE databases
SET DEFAULT TO &mglavni
set path to &mopcija


nazfir=""

MODIFY WINDOW SCREEN TITLE ' Import podataka ' 
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
ON ERROR do greska with ERROR(),MESSAGE(),MESSAGE(1),PROGRAM(),LINENO()
	do form osnova
	
	do FORM import
*endif
read event
CLOSE all
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

DO FORM greska
RETURN


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

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


************** formatiranje vodecih nula kod automatskog sifriranja **********
FUNCTION formsifb(mvarijabla,mduzina)
mvar1=ALLTRIM(STR(VAL(mvarijabla)+1))
ml=LEN(mvar1)
mvarijabla=REPLICATE("0",mduzina-ml)+mvar1
RETURN(mvarijabla)

**********************************************************************
************** formatiranje vodecih nula kod automatskog sifriranja be inkrementiranja **********
FUNCTION formsifb(mvarijabla,mduzina)
mvar1=ALLTRIM(STR(VAL(mvarijabla)))
ml=LEN(mvar1)
mvarijabla=REPLICATE("0",mduzina-ml)+mvar1
RETURN(mvarijabla)

**********************************************************************
************** formatiranje vodecih nula kod automatskog sifriranja be inkrementiranja sa numerik ulazom**********
FUNCTION formsifbn(mvarijabla,mduzina)
mvar1=ALLTRIM(STR((mvarijabla)))
ml=LEN(mvar1)
mvarijabla=REPLICATE("0",mduzina-ml)+mvar1
RETURN(mvarijabla)

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

************** formatiranje krajnjih blankova da bi nasao dokumente u gk **********
FUNCTION formdok(mvarijabla,mduzina)
mvar1=ALLTRIM(mvarijabla)
ml=LEN(mvar1)
mvarijabla=mvar1+REPLICATE(" ",mduzina-ml)
RETURN(mvarijabla)


RETURN
