*FUNCTION otvor_navision_partneri
PARAMETERS menofirmy, menoalias, podmienka
PRIVATE lsql, m.curschema, m.updfieldlist, m.vysledok, m.tabschema, m.updschema, m.keyschema
lsql = 'SELECT customervendor.timestamp as tmsmp,'
lsql=lsql+'customervendor.RecordNo as rno,'
lsql=lsql+'customervendor.RecordType as rtyp,'
lsql=lsql+'customervendor.RecordState as rstat,'
lsql=lsql+'customervendor.No, customervendor.Name as meno,'
lsql=lsql+'customervendor.SearchName as sname,'
lsql=lsql+'customervendor.Name2, customervendor.Address as adresa,'
lsql=lsql+'customervendor.Address2 as adresa2, customervendor.City,'
lsql=lsql+'customervendor.Contact,'
lsql=lsql+'customervendor.PhoneNo,'
lsql=lsql+'customervendor.GlobalDimension1Code as gdc1,'
lsql=lsql+'customervendor.GlobalDimension2Code as gdc2,'
lsql=lsql+'customervendor.VCPostingGroup as vcp,'
lsql=lsql+'customervendor.CurrencyCode as curcode,'
lsql=lsql+'customervendor.CountryRegionCode as regcode,'
lsql=lsql+'customervendor.FaxNo,'
lsql=lsql+'customervendor.VATRegistrationNo as vatcislo,'
lsql=lsql+'customervendor.PostCode as psc,'
lsql=lsql+'customervendor.EMail,'
lsql=lsql+'customervendor.HomePage,'
lsql=lsql+'customervendor.RegistrationNo as regcislo,'
lsql=lsql+'customervendor.TaxRegistrationNo as taxcislo,'
lsql=lsql+'customervendor.District as district, customervendor.Post,'
lsql=lsql+'customervendor.DistrictCode as distcode,'
lsql=lsql+'customervendor.BankAccountNo as ucetno,'
lsql=lsql+'customervendor.IBAN,'
lsql=lsql+'customervendor.SWIFTCode as swift,'
lsql=lsql+'customervendor.CustomerType as typ'
lsql=lsql+' FROM '
lsql=lsql+m.navision_databaza+'.dbo."'+menofirmy+'$COMCustomerVendor" customervendor'
IF !EMPTY(m.podmienka)
    lsql=lsql+' WHERE '+m.podmienka
ENDIF 

m.curschema='tmsmp m, rno i, rtyp C(2), rstat c(1), no C(20), meno c(50), sname c(50), name2 c(50), adresa c(50), adresa2 c(50), city c(30), contact C(50), phoneno C(30), gdc1 C(20), gdc2 C(20)'
m.curschema=m.curschema+',vcp C(10), curcode C(10), regcode C(10), faxno C(30), vatcislo C(30), psc C(20), email c(80), homepage C(80), regcislo C(20), taxcislo C(20), district C(100), post C(100)'
m.curschema=m.curschema+',distcode C(10), ucetno C(30), iban C(50), swift C(20), typ c(1)'

m.updschema='rno '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[RecordNo],'
m.updschema=m.updschema+'tmsmp '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[timestamp],'
m.updschema=m.updschema+'rtyp '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[RecordType],'
m.updschema=m.updschema+'rstat '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[RecordState],'
m.updschema=m.updschema+'no '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[No],'
m.updschema=m.updschema+'meno '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[Name],'
m.updschema=m.updschema+'sname '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[SearchName],'
m.updschema=m.updschema+'name2 '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[Name2],'
m.updschema=m.updschema+'adresa '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[Address],'
m.updschema=m.updschema+'adresa2 '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[Address2],'
m.updschema=m.updschema+'city '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[City],'
m.updschema=m.updschema+'contact '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[Contact],'
m.updschema=m.updschema+'phoneno '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[PhoneNo],'
m.updschema=m.updschema+'gdc1 '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[GlobalDimension1Code],'
m.updschema=m.updschema+'gdc2 '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[GlobalDimension2Code],'
m.updschema=m.updschema+'vcp '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[VCPostingGroup],'
m.updschema=m.updschema+'curcode '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[CurrencyCode],'
m.updschema=m.updschema+'regcode '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[CountryRegionCode],'
m.updschema=m.updschema+'faxno '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[FaxNo],'
m.updschema=m.updschema+'vatcislo '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[VATRegistrationNo],'
m.updschema=m.updschema+'psc '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[PostCode],'
m.updschema=m.updschema+'email '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[Email],'
m.updschema=m.updschema+'homepage '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[HomePage],'
m.updschema=m.updschema+'regcislo '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[RegistrationNo],'
m.updschema=m.updschema+'taxcislo '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[TaxRegistrationNo],'
m.updschema=m.updschema+'district '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[District],'
m.updschema=m.updschema+'post '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[Post],'
m.updschema=m.updschema+'distcode '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[DistrictCode],'
m.updschema=m.updschema+'ucetno '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[BankAccountNo],'
m.updschema=m.updschema+'iban '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[IBAN],'
m.updschema=m.updschema+'swift '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[SWIFTCode],'
m.updschema=m.updschema+'typ '+m.navision_databaza+'.dbo."'+m.menofirmy+'$COMCustomerVendor".[CustomerType]'

m.updfieldlist="rno, tmsmp, rtyp, rstat, no, meno, sname, name2, adresa, adresa2, city, contact, phoneno, gdc1, gdc2,"
m.updfieldlist=m.updfieldlist+"vcp, curcode, regcode, faxno, vatcislo, psc, email, homepage,"
m.updfieldlist=m.updfieldlist+"regcislo, taxcislo, district, post, distcode, ucetno, iban, swift, typ"

m.tabschema=m.navision_databaza+".dbo."+CHR(34)+menofirmy+"$COMCustomerVendor"+CHR(34)

m.keyschema="rno"

RETURN nav_vytvor_cursor("navision_partneri",m.menoalias, m.tabschema, m.lsql, m.updfieldlist, m.updschema, m.keyschema, m.curschema)
