1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| Sub main
rem
rem ouverture table mouvement
rem
fichier = ConvertToURL("f:\Mes_Documents\Daniel\ODB\bourse.odb")
databasecontext = createUnoService("com.sun.star.sdb.DatabaseContext")
datasource = databasecontext.getByName(fichier)
connection = datasource.getconnection("root","daniel")
docbase = datasource.databasedocument
requete = connection.createstatement()
instrucsql = "insert into cours(isen,libelle,datevaleur,premier,plushaut,plusbas,dernier,volume) values('FR0000031122','AIR FRANCE','08/04/08','11.01','11.02','11.03','11.04','101')"
nbligne = requete.executeUpdate(instrucsql)
print nbligne
unrowset = createUnoService("com.sun.star.sdb.RowSet")
with unrowset
.activeConnection = connection
.commandType = com.sun.star.sdb.CommandType.TABLE
.command = "bourse.cours"
.execute
.next
print .columns(1).string
.dispose
end with
Rem
Rem Ouverture du menu
rem
DialogLibraries.LoadLibrary("Standard")
bibli = DialogLibraries.GetByName("Standard")
mondialogue = bibli.GetByName("menu")
dlg(1) = createUnoDialog(mondialogue)
dlg(1).Model.Title = "MENU GENERAL GESTION DE PORTEFEUILLE"
resu = dlg(1).execute
dlg(1).dispose
valeurinitiale = 0
avoirfiscal = 0
soldebancaire = 0
coupons = 0
droitsdegarde = 0
resultatacquis = 0
commissions = 0
End Sub
rem
rem MISE A JOUR DES COURS A PARTIR TELECHARGEMENT BOURSORAMA
rem
sub majcours
modif = dlg(1).getControl("etat")
modif.model.Text = "TRAITEMENT EN COURS"
courowset = createUnoService("com.sun.star.sdb.RowSet")
with courowset
.activeConnection = connection
.CommandType = com.sun.star.sdb.CommandType.TABLE
.command = "bourse.cours"
.execute
.next
print .columns(1).string
end with
taburl = convertToURL("f:\Mes_Documents\DANIEL\CALC\boursorama.xls")
tabcal = StarDesktop.LoadComponentFromURL(taburl,"_blank", 0, tabopt())
tabfeuilles =tabcal.sheets
tabfeu =tabfeuilles(0)
ligne = 0
tabcel = tabfeu.getCellByPosition(0,ligne)
tabiesn = tabcel.FormulaLocal
while (tabiesn <> "")
tabcel = tabfeu.getCellByPosition(0,ligne)
tabiesn = tabcel.string
tabcel = tabfeu.getCellByPosition(1,ligne)
tablib = tabcel.string
tabcel = tabfeu.getCellByPosition(2,ligne)
tabdate = tabcel.value
tabcel = tabfeu.getCellByPosition(3,ligne)
tabpremier = tabcel.value
tabcel = tabfeu.getCellByPosition(4,ligne)
tabhaut = tabcel.value
tabcel = tabfeu.getCellByPosition(5,ligne)
tabbas = tabcel.value
tabcel = tabfeu.getCellByPosition(6,ligne)
tabdernier = tabcel.value
tabcel = tabfeu.getCellByPosition(7,ligne)
tabvolume = tabcel.value
'with courowset
' .moveToInsertRow
' .updateString(2,tabiesn)
' .updateString(3,tablib)
' .updateDouble(4,tabdate)
' .updateDouble(5,tabpremier)
' .updateDouble(6,tabhaut)
' .updateDouble(7,tabbas)
' .updateDouble(8,tabdernier)
' .updateDouble(9,tabvolume)
' .insertRow
' .execute
' end with
print tabdate
print tabpremier
instrucsql = "insert into cours(isen,libelle,datevaleur,premier,plushaut,plusbas,dernier,volume) values('tabisen','tablib','09/04/08','tabpremier','tabhaut','tabbas','tabdernier','tabvolume')"
nbligne = requete.executeUpdate(instrucsql)
print nbligne |
Partager