Permalink
Browse files

osposobio adresar

  • Loading branch information...
1 parent 208961c commit 602ef19dad7b7e919110123fd49bddd860625020 @vsasa vsasa committed Mar 29, 2012
Showing with 95 additions and 71 deletions.
  1. +1 −2 common/a_dbfs.prg
  2. +21 −17 common/common_fmk_util.prg
  3. +52 −46 common/cre_all_dbfs.prg
  4. +15 −0 common/sifrarnici_semaphores.prg
  5. +6 −6 fin/fin_stampa_suban_nalog.prg
View
@@ -87,8 +87,7 @@ AADD( gaDbfs, { F_TARIFA , "TARIFA" , "tarifa" , { | param | tarifa_from_sq
AADD( gaDbfs, { F_KONCIJ , "KONCIJ" , "koncij" , { | param | koncij_from_sql_server(param) } , "IDS" } )
AADD( gaDbfs, { F_BARKOD , "BARKOD" , "barkod" } )
-
-
+AADD( gaDbfs, { F_ADRES , "ADRES" , "adres" , { | param | adres_from_sql_server(param) } , "IDS" } )
AADD( gaDbfs, { F_STRINGS , "STRINGS" , "strings" } )
AADD( gaDbfs, { F_RNAL , "RNAL" , "rnal" } )
View
@@ -305,10 +305,12 @@ RETURN
function Adresar()
PushWa()
+
select (F_ADRES)
if !used()
O_ADRES
endif
+
SELECT(F_SIFK)
if !USED()
O_SIFK
@@ -320,54 +322,54 @@ if !USED()
endif
P_Adres()
+
USE
PopWa()
+
return nil
// --------------------------------
// --------------------------------
function P_Adres(cId,dx,dy)
-
-local fkontakt:=.f.
-
+local fkontakt := .f.
private ImeKol:={}
private Kol:={}
-if fieldpos("Kontakt")<>0
- fKontakt:=.t.
+if fieldpos("Kontakt") <> 0
+ fKontakt := .t.
endif
AADD(ImeKol, { "Naziv firme", {|| id } , "id" } )
AADD(ImeKol, { "Telefon " , {|| naz } , "naz" } )
AADD(ImeKol, { "Telefon 2" , {|| tel2} , "tel2" })
AADD(ImeKol, { "FAX " , {|| tel3} , "tel3" })
if fkontakt
- AADD(ImeKol, { "RJ " , {|| rj } , "rj" } )
+ AADD(ImeKol, { "RJ " , {|| rj } , "rj" } )
endif
AADD(ImeKol, { "Adresa" , {|| adresa } , "adresa" } )
AADD(ImeKol, { "Mjesto" , {|| mjesto } , "mjesto" } )
if fkontakt
- AADD(ImeKol, { "PTT", {|| PTT } , "PTT" } )
- AADD(ImeKol, { "Drzava", {|| drzava } , "drzava" } )
+ AADD(ImeKol, { "PTT", {|| PTT } , "PTT" } )
+ AADD(ImeKol, { "Drzava", {|| drzava } , "drzava" } )
endif
AADD(ImeKol, { "Dev.ziro-r.", {|| ziror } , "ziror" } )
AADD(ImeKol, { "Din.ziro-r.", {|| zirod } , "zirod" } )
if fkontakt
- AADD(ImeKol, { "Kontakt", {|| kontakt } , "kontakt" } )
- AADD(ImeKol, { "K7", {|| k7 } , "k7" } )
- AADD(ImeKol, { "K8", {|| k8 } , "k8" } )
- AADD(ImeKol, { "K9", {|| k9 } , "k9" } )
+ AADD(ImeKol, { "Kontakt", {|| kontakt } , "kontakt" } )
+ AADD(ImeKol, { "K7", {|| k7 } , "k7" } )
+ AADD(ImeKol, { "K8", {|| k8 } , "k8" } )
+ AADD(ImeKol, { "K9", {|| k9 } , "k9" } )
endif
-FOR i:=1 TO LEN(ImeKol); AADD(Kol,i); NEXT
-
+FOR i:=1 TO LEN(ImeKol)
+ AADD(Kol,i)
+NEXT
PushWa()
-
select sifk
set order to tag "ID"
seek "ADRES "
@@ -401,10 +403,12 @@ do while !eof() .and. ID="ADRES "
AADD (Kol, iif( sifk->UBrowsu='1',++i, 0) )
skip
+
enddo
PopWa()
-return PostojiSifra(F_ADRES,1,15,77,"Adresar:",@cId,dx,dy, {|Ch| AdresBlok(Ch)} )
+return PostojiSifra( F_ADRES, 1, MAXROWS()-15, MAXCOLS()-3,"Adresar:",@cId,dx,dy, {|Ch| AdresBlok(Ch)} )
+
// ----------------------------------------------------
@@ -472,7 +476,7 @@ return DE_CONT
function AdresBlok(Ch)
if Ch==K_F8 // koverte
- PKoverte()
+ PKoverte()
endif
RETURN DE_CONT
View
@@ -17,6 +17,7 @@ cre_sifk_sifv(ver)
cre_sifrarnici_1(ver)
cre_roba(ver)
cre_partn(ver)
+cre_adres(ver)
// TODO: http://redmine.bring.out.ba/issues/25815
cre_all_fin(ver)
@@ -42,22 +43,26 @@ local lShowMsg
lShowMsg:=.f.
if (nArea==nil)
- nArea:=-1
+ nArea:=-1
- if goModul:oDatabase:lAdmin
- lShowMsg:=.t.
- endif
+ if goModul:oDatabase:lAdmin
+ lShowMsg:=.t.
+ endif
endif
if lShowMsg
- MsgO("Kreiram systemske tabele")
+ MsgO("Kreiram systemske tabele")
endif
+
CreGParam(nArea)
+
CreParams(nArea)
-CreAdres(nArea)
+
+cre_adres()
+
if lShowMsg
- MsgC()
+ MsgC()
endif
return
@@ -66,7 +71,7 @@ function CreParams()
close all
if gReadOnly
- return
+ return
endif
aDbf:={}
@@ -79,17 +84,17 @@ AADD(aDbf, {"Fv","C",15,0} ) // sadrzaj
if !file(f18_ime_dbf("params"))
- DBCREATE2(PRIVPATH+"params.dbf",aDbf)
+ DBCREATE2(PRIVPATH+"params.dbf",aDbf)
endif
CREATE_INDEX("ID","fsec+fh+fvar+rbr",PRIVPATH+"params.dbf",.t.)
-
+
if !file(f18_ime_dbf("gparams"))
- DBCREATE2(PRIVPATH+"gparams.dbf",aDbf)
+ DBCREATE2(PRIVPATH+"gparams.dbf",aDbf)
endif
CREATE_INDEX("ID","fsec+fh+fvar+rbr", PRIVPATH + "gparams.dbf",.t.)
if !file(f18_ime_dbf("kparams"))
- DBCREATE2(KUMPATH+"KPARAMS.dbf",aDbf)
+ DBCREATE2(KUMPATH+"KPARAMS.dbf",aDbf)
endif
CREATE_INDEX("ID", "fsec+fh+fvar+rbr", KUMPATH+"kparams.dbf", .t.)
@@ -103,56 +108,57 @@ AADD(aDbf, {"Fv","C",15,0} ) // sadrzaj
cImeDBf:=ToUnix(KUMPATH+"secur.dbf")
if !file(f18_ime_dbf(cImeDbF))
- DBCREATE2(cImeDBF,aDbf)
+ DBCREATE2(cImeDBF,aDbf)
endif
CREATE_INDEX("ID","fsec+fh+fvar+rbr", cImeDBF, .t.)
return nil
-function CreAdres(nArea)
+function cre_adres( ver )
+local _alias
-if (nArea==nil)
- nArea:=-1
-endif
-
-if (nArea==-1 .or. nArea==F_KPARAMS)
- if !file(f18_ime_dbf("adres"))
- aDBF:={}
- AADD(aDBf,{ 'ID' , 'C' , 50 , 0 })
- AADD(aDBf,{ 'RJ' , 'C' , 30 , 0 })
- AADD(aDBf,{ 'KONTAKT' , 'C' , 30 , 0 })
- AADD(aDBf,{ 'NAZ' , 'C' , 15 , 0 })
- AADD(aDBf,{ 'TEL2' , 'C' , 15 , 0 })
- AADD(aDBf,{ 'TEL3' , 'C' , 15 , 0 })
- AADD(aDBf,{ 'MJESTO' , 'C' , 15 , 0 })
- AADD(aDBf,{ 'PTT' , 'C' , 6 , 0 })
- AADD(aDBf,{ 'ADRESA' , 'C' , 50 , 0 })
- AADD(aDBf,{ 'DRZAVA' , 'C' , 22 , 0 })
- AADD(aDBf,{ 'ziror' , 'C' , 30 , 0 })
- AADD(aDBf,{ 'zirod' , 'C' , 30 , 0 })
- AADD(aDBf,{ 'K7' , 'C' , 1 , 0 })
- AADD(aDBf,{ 'K8' , 'C' , 2 , 0 })
- AADD(aDBf,{ 'K9' , 'C' , 3 , 0 })
- DBCREATE2(SIFPATH+"ADRES.DBF",aDBf)
- endif
- CREATE_INDEX("ID","id+naz",SIFPATH+"ADRES.DBF")
+_alias := "adres"
+
+if !file(f18_ime_dbf( _alias ))
+ aDBF:={}
+ AADD(aDBf,{ 'ID' , 'C' , 50 , 0 })
+ AADD(aDBf,{ 'RJ' , 'C' , 30 , 0 })
+ AADD(aDBf,{ 'KONTAKT' , 'C' , 30 , 0 })
+ AADD(aDBf,{ 'NAZ' , 'C' , 15 , 0 })
+ AADD(aDBf,{ 'TEL2' , 'C' , 15 , 0 })
+ AADD(aDBf,{ 'TEL3' , 'C' , 15 , 0 })
+ AADD(aDBf,{ 'MJESTO' , 'C' , 15 , 0 })
+ AADD(aDBf,{ 'PTT' , 'C' , 6 , 0 })
+ AADD(aDBf,{ 'ADRESA' , 'C' , 50 , 0 })
+ AADD(aDBf,{ 'DRZAVA' , 'C' , 22 , 0 })
+ AADD(aDBf,{ 'ziror' , 'C' , 30 , 0 })
+ AADD(aDBf,{ 'zirod' , 'C' , 30 , 0 })
+ AADD(aDBf,{ 'K7' , 'C' , 1 , 0 })
+ AADD(aDBf,{ 'K8' , 'C' , 2 , 0 })
+ AADD(aDBf,{ 'K9' , 'C' , 3 , 0 })
+ DBCREATE2( _alias, aDBf )
+ reset_semaphore_version( _alias )
+ my_use( _alias )
+
endif
+CREATE_INDEX("ID","id+naz", _alias )
+
return
* kreiraj gparams u glavnom modulu
function CreGparam(nArea)
local aDbf
if (nArea==nil)
- nArea:=-1
+ nArea:=-1
endif
close all
if gReadonly
- return
+ return
endif
aDbf:={}
@@ -165,13 +171,13 @@ AADD(aDbf, {"Fv","C",15,0} ) // sadrzaj
if (nArea==-1 .or. nArea==F_GPARAMS)
- cImeDBf:= f18_ime_dbf("gparams")
+ cImeDBf:= f18_ime_dbf("gparams")
- if !file(cImeDbf)
- DBCREATE2(cImeDbf, aDbf)
- endif
+ if !file(cImeDbf)
+ DBCREATE2(cImeDbf, aDbf)
+ endif
- CREATE_INDEX("ID", "fsec+fh+fvar+rbr", cImeDBF )
+ CREATE_INDEX("ID", "fsec+fh+fvar+rbr", cImeDBF )
endif
return
@@ -51,6 +51,21 @@ return _result
// -----------------------------------------
// -----------------------------------------
+function adres_from_sql_server(algoritam)
+local _result := .f.
+local _i
+local _tbl := "adres"
+
+_result := sifrarnik_from_sql_server(_tbl, algoritam, F_ADRES, { "id", "naz", "rj", ;
+ "kontakt", "tel2", "tel3", "mjesto", "ptt", "adresa", "drzava", ;
+ "ziror", "zirod", "k7", "k8", "k9" } )
+
+return _result
+
+
+
+// -----------------------------------------
+// -----------------------------------------
function vrstep_from_sql_server(algoritam)
local _result := .f.
local _i
@@ -97,13 +97,13 @@ DO WHILE !eof() .and. eval(b2)
select (nArr)
IF gVar1=="1" .and. lJerry
- aRez:={PADR(cStr,30)}
- cStr:=opis
- aOpis:=SjeciStr(cStr,20)
+ aRez := {PADR(cStr,30)}
+ cStr := opis
+ aOpis := SjeciStr( cStr, 20 )
ELSE
- aRez:=SjeciStr(cStr,28)
- cStr:=opis
- aOpis:=SjeciStr(cStr,20)
+ aRez := SjeciStr( cStr, 28 )
+ cStr := opis
+ aOpis := SjeciStr( cStr, 20 )
ENDIF
@ prow(),pcol()+1 SAY Idpartner(idpartner)

0 comments on commit 602ef19

Please sign in to comment.