English
Forum

Completed: data base

 

Peter
Gückstock
Hi,
i'm not yet long here in the Community and come not yet integrally so clear,
where and how I mean Frangen on the right place write. I try it simply here.

my trouble is the following: I have a DB III data base in eien Listbox read. in the Listbox markiere I a Line and would like now The Feldinhalte the suitable Datensatzes for further Berechnung receive.
for a Lösungsvorschlag would I you grateful.
(be Beginner with qualmendem head)
CompileMarkSeparation
Programm-Kasse
unter Verwendung von Programm-Listbox4, Autor: Gerhard Putschalka
------Deklarationen
Declare LiBox&,BonBox1&,Zeile&,Anzahl&,BOk%,Anz_Spalten%,X%,Feld$,Zeile$,Lv_Liste#
Declare Dlg%,Ende%,InpFile$,SatzN%,OpCod$,Datum$,Betrag$,BOk%,Tx$,LV_Zeile&,Lv_Item#,LV_Selected#
declare LV_ColMask&,Listbox&,Number#,TxtBER#,Bon$,Bon3$,Bbox&,Kassieren%,UBox&
declare Epreis!,Gegeben!,EPreis$,Menge%,Posten!,Summe!,Umsatz!,Zurück!,übernehmen%,Art$,E%,S$
declare Bon2$,Bon1$,Bon0$,Zeilennummer%,Zeilennummer$,Index&,DsNr$,DsNr%
-----Definition der Funktion (link zum API)
Def @CreateWindowEx(12) ! USER32,CreateWindowExA
def GetSysColor(1) !USER32,GetSysColor
Def @GetSelectedCount(1) @Sendmessage(@&(1),$1032,0,0)
Dim TxtBer#,255    max. Textlänge einer Listboxzeile (sollte genügend groß sein)
Dim NumBer#,300    Größe = maximal auszuwählende Zeilen * 4 (bei Bedarf erweitern)
===========
Prozeduren
============
-----Modul1 Spalten für die Listbox erstellen

Proc Erstelle_Spalte

    Parameters Handle&,Maske&,Format&,Pixel&,Text$,Spalte&
    Long Lv_Liste#,0  = Maske&
    Long Lv_Liste#,4  = Format&
    Long Lv_Liste#,8  = Pixel&
    Long Lv_Liste#,12 = @add(Lv_Liste#,36)
    Long Lv_Liste#,16 = 220
    Long Lv_Liste#,20 = Spalte&
    string Lv_Liste#,36 = Text$
    @sendmessage (Handle&,$101B,Spalte&,Lv_Liste#)
    Inc Anz_Spalten%
    Return

Endproc

------Erstellen der Listboxen, Butten u.s.w.

Proc Erstelle_Dialog

    Let Dlg% = @CreateDialog(%Hwnd,Angebot,0,0,800,580)
    let Ende% = @createbutton(Dlg%,beenden,10,500,80,24)
    Let BOk% = @CreateButton(Dlg%,übernehmen,100,410,90,24)
    Let Kassieren% = @CreateButton(Dlg%,Kassieren,8,450,80,20)
    Usefont Ms Sans Serif,16,0,0,0,0
    setdialogfont 1
    Dim Lv_Liste#,256
    String Lv_Liste#,0 = SysListView32  muß SysListView32 lauten
    String Lv_Liste#,20 =
    Let LiBox& = @CreateWindowEx($0000280,Lv_Liste#,Lv_Liste#,$50408205,5,5,290,400,
    Dlg%,1,%hinstance,$200)
    @SendMessage(LiBox&,$1036,0,$00000023)  setze extended Style. $23 ist liniert.
    Let BBox& = control(LISTBOX,,$54A00148,550,50,200,350,
    Dlg%,2001,%HINSTANCE,$00020000)
    let UBox&=control(LISTBOX,,$54200140,250,80,280,60,
    Dlg%,2001,%HINSTANCE,$00020121)
    -------Einfügen der Spalten in die Listbox
    Erstelle_Spalte LiBox&,15,0,40,Nr.,0
    Erstelle_Spalte LiBox&,15,0,120,Artikel,1
    Erstelle_Spalte LiBox&,15,0,100,Preis,2
    Erstelle_Spalte BonBox1&,15,0,40,Nr.,0
    Let Anz_Spalten% = 3    initialisiere Spaltenzähler
    ----- initialisieren der Bereich für spätere Verwendung
    Long Lv_Liste#,0  = 1  Maske
    Long Lv_Liste#,4  = 0
    Long Lv_Liste#,8  = 0
    Long Lv_Liste#,12 = 0
    Long Lv_Liste#,16 = 0
    Long Lv_Liste#,20 = @add(Lv_Liste#,36)
    Long Lv_Liste#,24 = 220
    Long Lv_Liste#,28 = 0
    Long Lv_Liste#,32 = 0
    Return

EndProc

----------------------------------------------------
-----------------------Zeile hinzufügen

Proc Add_Zeile   füge eine Zeile zum Listview hinzu. Zeile& enthält die Zeilennummer.

    Declare X1%
    Long Lv_Liste#,4 = Zeile&  Zeile
    Long Lv_Liste#,8 = 0       Spalte
    Let X1% = 1               Schleifen- und Indexzähler
    String Lv_Liste#,36 = @$(X1%)
    @Sendmessage (LiBox&,$1007,0,Lv_Liste#)  Text in 1. Spalte
    Texte für die Spalten 2 - 3

    While (X1% < 3)

        Long Lv_Liste#,8 = X1%
        Inc X1%
        String Lv_Liste#,36 = @$(X1%)
        @Sendmessage(LiBox&,4142,Zeile&,Lv_Liste#)  Text in Folgespalte

    EndWhile

    Return
    ---------------------------
    Auswerten was selektiert wurde.
    Mit der Message $0190 wird ermittelt wieviele
    Zeilen markiert wurden.
    Mit der Message $0191 werden die Nummern der markierten Zeilen als LongInteger
    (= jeweils 4 Stellen) in die Bereichsvariable NumBer# übernommen.
    danach werden in der 2. Schleife  mit der Message $0189 die gespeicherten
    Zeilennummern ausgelesen und damit die jeweilige Textzeile in die Bereichsvariable
    TxtBer# übernommen.
    Let X%=0
    Let Anzahl&=@Sendmessage(ListBox&,$0190,0,0)
    @Sendmessage(ListBox&,$0191,Anzahl&,NumBer#)

    WhileNot (X% = Anzahl&)

        Let Index& = @Long(NumBer#,@Mul(X%,4))       Zeilennummer holen
        @Sendmessage(ListBox&,$0189,Index&,TxtBer#)  Text aus der Liste holen
        Inc X%

    EndWhile

EndProc

===========================================================
============Hier beginn mein Problem:======================
===========================================================

Proc Berechnen

    ---------------------------jetzt Eingabe, wieviele Artikel
    Menge%=0
    Menge%=@Input$(Anzahl:,ausgewählter Artikel,Menge%) funktioniert
    -------------------------
    Das Einlesen der Datenbank funktioniert auch .
    Jetzt möchte ich die Datensatznummer zur Bearbeitung erhalten, die der markierten
    Zeile in der Listbox entspricht.
    @dbOpen(#1,Sortiment_dbf.dbf)
    @dbUse(#1)
    DsNr$=Index&  mein Gedanke, Datensatznummer gleich Index von markierter Zeile
    @dbgo(DsNr$)  und dann zum entsprechenden Datensatz gehen
    geht aber nicht
    Momentan erhalte ich dummerweise immer den ersten Datensatz.
    die Berechnungen würden mit den richtigen Werten aus der DB auch funktionieren
    Epreis$=@dbGet$(Preis)   jetzt Preise berechnen und in Bon schreiben
    Art$=@dbGet$(Artikel)
    EPreis!=@val(EPreis$)
    Posten!=Menge%*EPreis!
    Decimals 2
    Summe!=Summe!+Posten!
    Decimals 2
    Umsatz!=Summe!
    Decimals 2
    Bon$=str$(Menge%),art$, Str$(EPreis!),  ,str$(Summe!)Str$(TxtBer#,0
    Bon3$=der Umsazt beträgt,str$(Umsatz!)
    @AddString(Bbox&,Bon$)

endproc

-----Modul Rückgeld berechnen

proc Rückgeld

    let Gegeben!=@input$(Bitte den vom Kunden erhaltenen Betrag eingeben,Eingabe,Gegeben!)
    Decimals 2
    Zurück!=Gegeben!-Summe!
    Decimals 2
    UseFont Arial,16,0,0,0,0
    SetDialogFont 1
    @AddString(Ubox&,Bon3$)

endproc

-----Modul Kassierung

proc Summe

    Bon3$=Summe,str$(Summe!)
    Bon2$=Gegeben,str$(Gegeben!)
    Bon1$=Rückgeld,str$(Zurück!)
    @Addstring(BBox&,--------------------)
    @Addstring(BBox&,Bon0$)
    @Addstring(BBox&,Bon3$)
    @Addstring(BBox&,Bon2$)
    @Addstring(BBox&,Bon1$)
    @Addstring(BBox&,Vielen Dank)

endproc

========================
Programm Start
========================
Erstelle_Dialog  erstelle Dialog, ListView, erstelle die Spalten
Let Zeile& = 0
jetzt öffnen wir die Kundendatei und lesen alle Sätze in die Listbox ein.
Let Anzahl& = @dbOpen(#1,Sortiment_dbf.dbf)
@dbUse(#1)
Let SatzN% = 0
Let OpCod$ = |<

While (SatzN% < Anzahl&)

    Inc SatzN% erhöhe Satzzahl
    @dbGo(OpCod$)
    Add_Zeile @dbGet$(lfdNr),@dbGet$(Artikel),@dbGet$(Preis)
    Let OpCod$ = >     für nächster Satz
    Let Zeile& = (Zeile& + 1)   erhöhe Zeilennummer

EndWhile

----------------------------------

WhileNot @GetFocus(Ende%)  1. Schleife bis beenden Button gedrückt wurde

    Hier kommen noch andere Module rein.

    if getfocus(BOK%)

        Berechnen

    Endif

    if getfocus(Kassieren%)

        Rückgeld
        summe

    endif

    -----------------Programm beenden
    waitkey  warte auf Ende-Button
    EndWhile   Ende_Schleife
    let E%=MessageBox(Wirklich beenden?,Programmende,282)
    -----------------Arrays freigeben
    Dispose TxtBer#
    Dispose NumBer#
    Disposelist#
    @dbClose(#1)
    end
 
Peter G.
Win XP, XProfan10
02/18/07  
 



moved to Programming / generally / Beginner-Questions

Please Source always with [ code] quelltext [ /code] einkapseln - habs supra korgieriert.

which Profanversion You uses should You in your Signatur present.
 
02/18/07  
 




Thomas
Freier
See you The Listbox7 on, there becomes the declared.
from all Feldern of/ one row becomes one String created, in the The boxes (Spalteninhalt) through one Tabulatorbyte (or @Chr$(09) ) separated go. These characters then through / or others .......with @Translate$(area$,, / ) supplant.
The Content one Field becomes then with @SubStr$(area$,n,/) determined (n = slot).
should directly on a Datensatz the data base zurückgegriffen go, z.B. circa MEMO-boxes auszulesen, is it meaningfully, in the 1. slot with BREITE=0, The Datensatznummer (&dbRecNo) To Save.

Greeting
Thomas suitor
 
Gruß Thomas
Windows XP SP2, XProfan X2
02/18/07  
 




Peter
Gückstock
Hello Thomas,

i want me for my late response entschuldigen, but I was betrieblich eingespannt and having for my PC quite no Time More.

many Thanks for your Help, it functions now.
but now have I two further ask:
1. How can The type and the Zeichengröße at reading the Data from the data base into Listbox change (zB. The Font enhance)? my try with setfont were ergebnislos.
2. Can individual Datensätzen in the Listbox different Schriftfarbe zuordnen? (circa z.B. zusammengehörige Datensätze from the others farblich To discern)

my Profanversion: 6.6

Greeting Peter Gückstock
 
Peter G.
Win XP, XProfan10
02/23/07  
 




Thomas
Freier
Hello Peter,

Schriftänderung for dialogs etc. only over UseFont s,n1,n2,n3,n4,n5
it can only colours for scheduler, not for a slot or row pretended go (my Kenntnisstand).
Gruppendarstellung I had through employment of Icons tested. The must Yes not The of Profan How in the example his. But Geschmackssache.
circa your Opportunities umzusetzen, come You How I do not circa Franks LISTVIEW around. rewards itself for Beginner but first ex XProfan 8.0 . The Anpassung for 6.6 isn't so simply. means SH-XProfan 8/9 and Franks LISTVIEW here procure and testing.
there The LISTVIEW shareware is, would I today XProfan 10 testing, d.h., The Help File here procure and study, whether The Version everything the what You release want without Franks LISTVIEW can.

Greeting
Thomas
 
Gruß Thomas
Windows XP SP2, XProfan X2
02/23/07  
 




Thomas
Freier
Nachtrag:

should it with Profan 6.6 stay and groups through Icons marked go,
here to Iconen search ( Michael Wodrich ?) or with
> Z-Icon.exe Tool can tappt im dunkeln not only available Icon-Files Edit,
>separate too Icons from Files z.B. EXE, DLL and ICL read, edit.....
beschaffen and in the own Program The Profan-Icon with
>P-Icon-Changer.exe
(should here to find his) replace.

Greeting
Thomas
 
Gruß Thomas
Windows XP SP2, XProfan X2
02/24/07  
 




Michael
Wodrich
Hello Thomas,

there have You well your HTML-Info into Notepad-Window to that Umkopieren pulled...
there are no left More in Your Text.

I Have no Icons on of my HP. and something like in Databases To make possible, there helps The ListView of Frank Abbing. too the Einfärben the Lines is so possible.

can your Posting Yes again Edit and the left add. About the Edit Window whom globe with the Kettenglied using...

Best wishes
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
02/24/07  
 



circa left To post must these just reinkopiert go - URLs go still vollautomatisch in left konvertiert...
 
02/24/07  
 




Thomas
Freier
Hello Michael,

use really in the principle no left. too on the Vereinswebseiten, its Webmaster i'm, go in the Guestbook no left registered or of me abgeändert. think, so can the leidige Topic, straight here first discusses, from the lane weg.
to the Icons : here or under profane.de having of/ one a ZIP with Iconen offered. who?
In Gerhards List view - for Profan 6.6 - can the 1.slot one Icon zugeordnet go. self uses .
so How Peter Gückstock it to has, Artikelgruppen deutlicher to emphasize, would Yes einfarbige Icons wealthy, The it well self with IrfanView.exe or the Z-Icon.exe of :
Andreas Baumann
Softwareservice
Flottenstr. 58
D-13407 Berlin
create can. Webadresse in the program not benannt. origin: 1999/2002.
somewhere at Search to Icon-Programs The Downloadadresse found.

Greeting
Thomas
 
Gruß Thomas
Windows XP SP2, XProfan X2
02/24/07  
 




Peter
Gückstock
thanks for Your Tipps. I have the so resolved:
eachone item the Gleichen group get in the first area the data base The same digit allocated. After the reading into Listbox and anschließendem sort to this slot have I coherent Blöcke receive.

Greeting Peter G.
 
Peter G.
Win XP, XProfan10
02/24/07  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.358 Views

Untitledvor 0 min.
H.Brill07/12/23
Georg Teles03/19/16
holmol9304/24/13
Stephie09/03/11

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie