Post by johnwillow54 on Jan 1, 2022 9:37:30 GMT -5
Hello i am currently testing out my stock management database. I have no problem at all with opening a bmp image within the graphics box displayed. However when i save the file path of the bmp image, when editing my records the saved path does not show the image in the graphics box. 3 hours so far i have spent and have made no progress what so ever. Can anyone detect what the problem is. Help is much needed. Thanks
Global hMain, hFind, stockdupNum, stockdupo, stockaddName, stockrecordIndex, stockCount
Global stockfilterCount, oldstocktype$
Dim stockname$(10000), stockSearch$(10000), stockdup$(500), stockcatogrie$(20), stocklocation$(20)
Dim stockbuilder$(10000, 45), stockexistInfo$(10,10), stockhContents$(20), forsaleon$(20), stockother$(20)
stockdupo=0
stockaddName=1
Call stockloadNames
'#2022
swide=270 'desired image width
shigh=158
'#
nomainwin
WindowWidth = 625 '595 695 795
WindowHeight = 605
UpperLeftX=Int((DisplayWidth-WindowWidth)/2)
UpperLeftY=Int((DisplayHeight-WindowHeight)/2)
Menu #main, "&Exit", "Exit", [endProgram]
'2022 updates
graphicbox #main.stockbox, 250, 175, 270, 158
button #main.loadimagestock,"Load Image", [loadimagestock], ul, 530, 175, 75,15
button #main.loadfilestock,",", [loadfilestock], ul, 510, 450, 18,18
button #main.runfilestock,",", [runfilestock], ul, 530, 450, 18,18
textbox #main.imagestockpath, 0,0,0,0
'########
texteditor #main.stockmemoedit,250, 475, 285, 60
Statictext #main.stockset1, "Memo:", 195, 475, 50, 20
Statictext #main.1stc, "Stock:", 10, 120, 60, 20
Listbox #main.stockname, stockname$(, modifyStock, 10, 150, 170, 270
' Statictext #main.inc, "Filter Contacts", 10, 170, 160, 20
Combobox #main.stockcatogriefilter, stockcatogrie$(, loadStockFilter, 298, 82, 150, 120
' Statictext #main.2stc, "Filter 2", 10, 200, 160, 20
Combobox #main.stocklocationfilter, stocklocation$(, loadStockFilter, 298, 82, 150, 120
Combobox #main.forsaleonfilter, forsaleon$(, loadStockFilter, 298, 82, 150, 120
Combobox #main.stockotherfilter, stockother$(, loadStockFilter, 298, 82, 150, 120
Statictext #main.3stc, "Name/ID", 195, 150, 50, 20
Textbox #main.stocktextboxname, 250, 150, 285, 20
Statictext #main.4stc, "Barcode", 395, 120, 50, 20
Textbox #main.stockreference, 450, 120, 85, 20
Statictext #main.5stc, "Stock Amount", 195, 340, 50, 30
Textbox #main.amountinstock, 250, 340, 80, 20
Statictext #main.6stc, "Purchase Price", 195, 370, 50, 30
Textbox #main.stockbulk, 250, 370, 80, 20
' Statictext #main.inc, "Name", 195, 270, 50, 20
Textbox #main.stcspare, 395, 370, 80, 20
Statictext #main.7stc, "Sell Price", 345, 370, 50, 20
Textbox #main.stcspare2, 250, 400, 80, 20
Statictext #main.8stc, "Unit", 195, 400, 50, 20
Statictext #main.9stc, "Allocation", 345, 340, 50, 20
combobox #main.stocklocation,stocklocation$(, [stockinputLoop] 395, 340, 80, 20
Statictext #main.10stc, "Unit Value", 345, 400, 50, 20
Textbox #main.stcspare4, 395, 400, 80, 20
Statictext #main.11stc, "Other", 195, 425, 50, 30
Textbox #main.stcspare5, 250, 450, 255, 20
Statictext #main.12stc, "Other", 395, 425, 50, 20
Textbox #main.stcspare6, 250, 450, 205, 20
Statictext #main.15stc, "Other", 195, 450, 50, 20
' Statictext #main, "Spare7", 195, 340, 50, 20
' Textbox #main.stcspare7, 250, 340, 225, 25
Statictext #main.13stc, "Catogrie", 195, 120, 50, 20
Combobox #main.stockcatogrie, stockcatogrie$(, [stockinputLoop], 250, 120, 125, 110
Statictext #main.14stc, "Other", 195, 450, 50, 30
Combobox #main.forsaleon, forsaleon$(, [stockinputLoop], 250, 425, 125, 110
Combobox #main.stockother, stockother$(, [stockinputLoop], 445, 425, 90, 110
' Statictext #main, "Memo", 195, 400, 50, 20
' Textbox #main.memostock, 250, 400, 225, 60
'extra spare fields:
textbox #main.stocksearchbox, 475, 80, 130, 25
'Stylebits #main.stcdefault, _BS_DEFPUSHBUTTON, 0, 0, 0
button #main.stcdefault, "GO", [stockincome], UL, 535, 0, 70, 25
'Statictext #main, "Mailing Date:", 10, 440, 150, 20
' Statictext #main.stockreference, "N/A", 10, 461, 150, 20
' Statictext #main, "This record last modified:", 10, 400, 150, 20
' Statictext #main.modexpDate, "N/A", 10, 421, 150, 20
stylebits #main.stcdel, _BS_BITMAP,0,0,0
stylebits #main.stcnew, _BS_BITMAP,0,0,0
stylebits #main.stcfind, _BS_BITMAP,0,0,0
stylebits #main.savestock, _BS_BITMAP,0,0,0
Button #main.stcdel, "e&del", [stcremoveEntry], UL, 95, 130, 25, 19
Button #main.stcnew, "&New Record", addstockRecord, UL, 20, 80, 40, 30
Button #main.stcfind "Find D&uplicates", stockduplicateControl, UL, 125, 130, 25, 19
Listbox #main.stcdup, stockdup$(, stockpick, 10, 360, 170, 60
Button #main.savestock, "S&ave Record", acceptstockEntry, UL, 60, 80, 40, 30
Open "Stock It" For Window_nf As #main
Print #main.stockcatogriefilter, "Select All";
print #main.stocklocationfilter, "Select All";
print #main.forsaleonfilter, "Select All";
print #main.stockotherfilter, "Select All";
Print #main.stockname, "SingleClickSelect"
Print #main.stcdup, "SingleClickSelect"
#main.14stc, "!hide"
#main.stcspare6, "!hide"
''For Graphics Box
gDC=GetDC(hwnd(#main.stockbox))
'create memory DC
mDC=CreateCompatibleDC(gDC)
'#######
[inputLoop]
Wait
[refresh]
timer 0
wait
[endProgram]
if hBitmap<>0 then unloadbmp "bitmap"
call ReleaseDC hwnd(#main.stockbox), gDC
call DeleteDC mDC
close #main
end
wait
[stockinputLoop]
Wait
[acceptstockEntry]
Call acceptstockEntry handle$
Wait
[addstockRecord]
if hBitmap<>0 then unloadbmp "bitmap"
'#main.stockbox, "discard"
#main.stockbox, "cls"
Call addstockRecord handle$
Wait
[stcremoveEntry]
call stockremoveEntry
wait
Sub stockloadNames
If stockexists("stockold.bak") Then
Kill "stockold.bak"
End If
If stockexists("stock.bak") Then
Name "stock.bak" As "stockold.bak"
End If
Open "stock.stk" For Random As #stock Len = 17030
Field #stock, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
Open "stock.bak" For Random As #stockCopy Len = 17030
Field #stockCopy, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
'if stock.dat doesn't exist, we will create it with 0 records
If Eof(#stock) <> 0 Then
Close #stock
Close #stockCopy
Call initializestockNames
Goto [stockskipIt]
End If
'create a backup of the file each time we make a change
Get #stock, 1
Put #stockCopy, 1
stockCount = Val(stockname$)
If stockCount = 0 Then
Close #stock
Close #stockCopy
Goto [stockskipIt]
End If
For index = 2 To stockCount + 1
Gettrim #stock, index
Put #stockCopy, index
stockname$(index - 1) = str$(index-1)+") "+stockname$
Next index
Close #stock
Close #stockCopy
[stockskipIt]
End Sub
Sub initializestockNames
'create the data file with 0 records
Open "stock.stk" For Random As #stock Len = 17030
Field #stock, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
stockname$ = "0"
Put #stock, 1
Close #stock
End Sub
Sub loadStockFilter handle$
redim stockname$(10000)
'show only the records that match the filter
Call addstockRecord handle$
Print #main.stockcatogriefilter, "selection? stockcatogfilter$"
print #main.stocklocationfilter, "selection? stocklocationfilter$"
print #main.forsaleonfilter, "selection? forsaleonfilter$"
print #main.stockotherfilter, "selection? stockotherfilter$"
Open "stock.stk" For Random As #stock Len = 17030
Field #stock, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
Get #stock, 1
stockCount = Val(stockname$)
If stockCount = 0 Then
Close #stock
Goto [stcmoveOn]
End If
'compare stage to filter
For index = 2 To stockCount + 1
Gettrim #stock, index
If stockcatogfilter$ = stockcatogrie$ Or stockcatogfilter$ = "All" Then
If stocklocationfilter$ = stocklocation$ or stocklocationfilter$ = "All" Then
If forsaleonfilter$ = forsaleon$ or forsaleonfilter$ = "All" Then
If stockotherfilter$ = stockother$ or stockotherfilter$ = "All" Then
stockname$(index - 1) = str$(index-1)+") "+stockname$
Else
stockname$(index - 1) = ""
End If
end if
end if
end if
Next index
Close #stock
Print #main.stockname, "Reload"
[stcmoveOn]
End Sub
Sub modifyStock handle$
stockaddName = 0
Print #main.stockname, "Selection? selection$"
If selection$ = "" Then [nostockName]
Print #main.stockname, "SelectionIndex? index"
If index = 0 Then [nostockName] 'This should never need to happen
stockrecordIndex=val(selection$)
[getstockRecord]
getIndex=stockrecordIndex+1
Open "stock.stk" For Random As #stock Len = 17030
Field #stock, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
Gettrim #stock, getIndex
Close #stock
'Graphics Box Image Part
[graphicspart]
if hBitmap<>0 then unloadbmp "bitmap"
print #main.imagestockpath,stockman16$
if stockman16$<>"" then
call getimagestock handle$
#main.stockbox, "flush"
else
end if
'###
'##
Print #main.stocktextboxname, stockname$
Print #main.stockreference, stockdate$
Print #main.amountinstock, stockcost$
' Print #main.stockbulk, stockamount$
Print #main.stcspare, stcspare$
Print #main.stcspare2, stcspare2$
' Print #main.stocklocation, stocklocation$
Print #main.stcspare4, stcspare4$
Print #main.stcspare5, stockman17$
Print #main.stcspare6, stcspare6$
'Print #main.stcspare7, stcspare7$
Print #main.stockcatogrie, "SelectIndex 20"
Print #main.stocklocation, "SelectIndex 20"
Print #main.forsaleon, "SelectIndex 20"
Print #main.stockother, "SelectIndex 20"
#main.stockmemoedit, "!cls"
#main.stockmemoedit, stc7$
' #main.stockbulk, week1$
'#time.week1, "!contents? wk1$"
' Print #main.memostock, "" ;
' Print #main.memostock, stcspare8$ ;
' Print #main.stockreference, stcspare10$
' Print #main.modexpDate, stcspare9$
For stageinvIndex = 0 To stockfilterCount-1
If stockcatogrie$(stageinvIndex) = stockcatogrie$ Then
Print #main.stockcatogrie, "SelectIndex "; stageinvIndex + 1
End If
If stocklocation$(stageinvIndex) = stocklocation$ Then
Print #main.stocklocation, "SelectIndex "; stageinvIndex + 1
end if
If forsaleon$(stageinvIndex) = forsaleon$ Then
Print #main.forsaleon, "SelectIndex "; stageinvIndex + 1
end if
If stockother$(stageinvIndex) = stockother$ Then
Print #main.stockother, "SelectIndex "; stageinvIndex + 1
end if
Next stageinvIndex
oldstocktype$=stockcatogrie$
'2022
'##
[nostockName]
end sub
Sub addstockRecord handle$
stockaddName = 1
#main.stockname, "SelectIndex 0"
'2022
'Graphics Box Image Part
[graphicspart2]
print #main.imagestockpath, ""
if hBitmap<>0 then unloadbmp "bitmap"
#main.stockbox, "cls"
'##
Print #main.stocktextboxname, ""
Print #main.stockreference, ""
Print #main.amountinstock, ""
Print #main.stockbulk, ""
Print #main.stcspare, ""
Print #main.stcspare2, ""
Print #main.stocklocation, "SelectIndex 20"
Print #main.stcspare4, ""
Print #main.stcspare5, ""
Print #main.stcspare6, ""
' Print #main.stcspare7, ""
Print #main.stockcatogrie, "SelectIndex 20"
Print #main.forsaleon, "SelectIndex 20"
Print #main.stockother, "SelectIndex 20"
#main.stockmemoedit, "!cls"
' Print #main.memostock, ""
Print #main.stocktextboxname, "!SetFocus"
' Print #main.stockreference, "N/A"
' Print #main.modexpDate, "N/A"
End Sub
Sub stockduplicateControl handle$
print #main.stockname, "locate 10, 150, 170, 180"
print #main, "refresh"
#main.duplicatename "!show"
#main.stcdup "show"
stockdupo=Abs(stockdupo-1)
If stockdupo=1 Then
text$="Hide Duplicates"
' Calldll #user32, "SetWindowTextA",_
' hFind As Ulong,_
' text$ As Ptr,_
' ret As Void
' Call resizeWindow
WindowWidth=150
WindowHeight=75
StaticText #stockpatience, "PLEASE WAIT...", 25, 15, 100, 25
Open "SEARCHING...", For Dialog_Modal As #stockpatience
For i1=1 To stockCount-1
For i2=i1+1 To stockCount
If Lower$(Mid$(stockname$(i1),Instr(stockname$(i1),") ")+2,10))=Lower$(Mid$(stockname$(i2),Instr(stockname$(i2),") ")+2,10)) Then
stockdupNum=stockdupNum+1
stockdup$(stockdupNum)=Mid$(stockname$(i1),Instr(stockname$(i1),") ")+2)+" @ "+Str$(i1)+" & "+Str$(i2)
End If
Next i2
Next i1
If stockdupNum=0 Then
stockdup$(1)="No Duplicates Found"
End If
Print #main.stcdup, "Reload"
Close #stockpatience
Else
print #main.stockname, "locate 10, 150, 170, 270"
print #main, "refresh"
#main.duplicatename "!hide"
#main.stcdup "hide"
text$="Find Duplicates"
' Calldll #user32, "SetWindowTextA",_
' hFind As Ulong,_
' text$ As Ptr,_
' ret As Void
For clearList=1 To stockdupNum
stockdup$(clearList)=""
Next clearList
Print #main.stcdup, "Reload"
stockdupNum=0
' Call resizeWindow
End If
End Sub
Sub acceptstockEntry handle$
Print #main.stocktextboxname, "!contents? stockname$";
If stockname$<>"" Then
'2022
Print #main.imagestockpath, "!contents? stockman16$";
'###
Print #main.stockreference, "!contents? stockdate$";
Print #main.amountinstock, "!contents? stockcost$";
Print #main.stockbulk, "!contents? stockamount$";
Print #main.stcspare, "!contents? stcspare$";
Print #main.stcspare2, "!contents? stcspare2$";
Print #main.stocklocation, "Selection? stocklocation$";
Print #main.stcspare4, "!contents? stcspare5$"
Print #main.stcspare5, "!contents? stockman17$"
Print #main.stcspare6, "!contents? stcspare4$"
'Print #main.stcspare7, "!contents? stcspare7$"
Print #main.stockcatogrie, "Selection? stockcatogrie$";
Print #main.forsaleon, "Selection? forsaleon$";
Print #main.stockother, "Selection? stockother$";
#main.stockmemoedit, "!contents? stc7$"
' Print #main.memostock, "!Contents? stcspare8$";
If stockaddName = 1 Then
stockCount = stockCount + 1
stockrecordIndex = stockCount
End If
stockname$(stockrecordIndex) = Str$(stockrecordIndex)+") "+stockname$
Print #main.stockname, "Reload"
date$=Date$()
If oldstocktype$="Opening Mailer" And stockcatogrie$="Follow Up Call" then
stcspare10$=Date$()
End If
[stcincome]
Open "stock.stk" For Random As #stock Len = 17030
Field #stock, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
Put #stock, stockrecordIndex + 1
Close #stock
If stockaddName = 0 Then [stcgoBack]
Open "stock.stk" For Random As #stock Len = 17030
Field #stock, 35 As count$, 16995 As fill$
count$ = Str$(stockCount)
Put #stock, 1
Close #stock
stockaddName = 0
Call loadStockFilter " "
[stcgoBack]
Print #main.stockname, "SelectIndex ";stockrecordIndex
Call addstockRecord handle$
Else
Notice "NO STOCK NAME"+Chr$(13)+"The Stock name must be entered, "_
+Chr$(13)+"before a record can be saved. "
End If
End Sub
sub stcsortem sortBy
WindowWidth=150
WindowHeight=75
StaticText #stockpatience, "PLEASE WAIT...", 25, 15, 100, 25
Open "SORTING...", For Dialog_Modal As #stockpatience
Call populatestcList
Sort stockbuilder$(), 2, stockCount+1, sortBy
Call savestockList
Call stockloadNames
Call loadStockFilter handle$
Close #stockpatience
Notice "SORT FINISHED"+Chr$(13)+"Sorted names reloaded"
End Sub
Sub populatestcList
Open "stock.stk" For random As #stock3 Len = 17030
Field #stock3, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
Open "stccontact.stk" For Random As #stock Len = 17030
Field #stock, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
Get #stock3, 1
stockCount = Val(stockname$)
Put #stock, 1
For index2 = 2 To stockCount + 1
Gettrim #stock3, index2
For column=1 To 45
Select Case column
Case 1
stockbuilder$(index2, column)=stockname$
Case 2
stockbuilder$(index2, column)=stockdate$
Case 3
stockbuilder$(index2, column)=stockcost$
Case 4
stockbuilder$(index2, column)=stockamount$
Case 5
stockbuilder$(index2, column)=stcspare$
Case 6
stockbuilder$(index2, column)=stcspare2$
Case 7
stockbuilder$(index2, column)=stocklocation$
Case 8
stockbuilder$(index2, column)=stcspare5$
Case 9
stockbuilder$(index2, column)=stcspare6$
Case 10
stockbuilder$(index2, column)=stcspare7$
Case 11
stockbuilder$(index2, column)=stockcatogrie$
Case 12
stockbuilder$(index2, column)=stcspare8$
Case 13
stockbuilder$(index2, column)=date$
Case 14
stockbuilder$(index2, column)=stcspare4$
Case 15
stockbuilder$(index2, column)=stcspare9$
Case 16
stockbuilder$(index2, column)=stcspare10$
Case 17
stockbuilder$(index2, column)=stcspare11$
Case 18
stockbuilder$(index2, column)=forsaleon$
Case 19
stockbuilder$(index2, column)=stockother$
Case 20
stockbuilder$(index2, column)=stc3$
Case 21
stockbuilder$(index2, column)=stc4$
Case 22
stockbuilder$(index2, column)=stc5$
Case 23
stockbuilder$(index2, column)=stc6$
Case 24
stockbuilder$(index2, column)=stc7$
Case 25
stockbuilder$(index2, column)=stc8$
Case 26
stockbuilder$(index2, column)=stockman1$
Case 27
stockbuilder$(index2, column)=stockman2$
Case 28
stockbuilder$(index2, column)=stockman3$
Case 29
stockbuilder$(index2, column)=stockman4$
Case 30
stockbuilder$(index2, column)=stockman5$
Case 31
stockbuilder$(index2, column)=stockman6$
Case 32
stockbuilder$(index2, column)=stockman7$
Case 33
stockbuilder$(index2, column)=stockman8$
Case 34
stockbuilder$(index2, column)=stockman9$
Case 35
stockbuilder$(index2, column)=stockman10$
Case 36
stockbuilder$(index2, column)=stockman11$
Case 37
stockbuilder$(index2, column)=stockman12$
Case 38
stockbuilder$(index2, column)=stockman13$
Case 39
stockbuilder$(index2, column)=stockman14$
Case 40
stockbuilder$(index2, column)=stockman15$
Case 41
stockbuilder$(index2, column)=stockman16$
Case 42
stockbuilder$(index2, column)=stockman17$
Case 43
stockbuilder$(index2, column)=stockman18$
Case 44
stockbuilder$(index2, column)=stockman19$
Case 45
stockbuilder$(index2, column)=stockman20$
End Select
Next column
Next index2
End Sub
Sub savestockList
For index2 = 2 To stockCount + 1
For column=1 To 45
Select Case column
Case 1
stockname$=stockbuilder$(index2, column)
Case 2
stockdate$=stockbuilder$(index2, column)
Case 3
stockcost$=stockbuilder$(index2, column)
Case 4
stockamount$=stockbuilder$(index2, column)
Case 5
stcspare$=stockbuilder$(index2, column)
Case 6
stcspare2$=stockbuilder$(index2, column)
Case 7
stocklocation$=stockbuilder$(index2, column)
Case 8
stcspare5$=stockbuilder$(index2, column)
Case 9
stcspare6$=stockbuilder$(index2, column)
Case 10
stcspare7$=stockbuilder$(index2, column)
Case 11
stockcatogrie$=stockbuilder$(index2, column)
Case 12
stcspare8$=stockbuilder$(index2, column)
Case 13
date$=stockbuilder$(index2, column)
Case 14
stcspare4$=stockbuilder$(index2, column)
Case 15
stcspare9$=stockbuilder$(index2, column)
Case 16
stcspare10$=stockbuilder$(index2, column)
Case 17
stcspare11$=stockbuilder$(index2, column)
Case 18
forsaleon$=stockbuilder$(index2, column)
Case 19
stockother$=stockbuilder$(index2, column)
Case 20
stc3$=stockbuilder$(index2, column)
Case 21
stc4$=stockbuilder$(index2, column)
Case 22
stc5$=stockbuilder$(index2, column)
Case 23
stc6$=stockbuilder$(index2, column)
Case 24
stc7$=stockbuilder$(index2, column)
Case 25
stc8$=stockbuilder$(index2, column)
Case 26
stockman1$=stockbuilder$(index2, column)
Case 27
stockman2$=stockbuilder$(index2, column)
Case 28
stockman3$=stockbuilder$(index2, column)
Case 29
stockman4$=stockbuilder$(index2, column)
Case 30
stockman5$=stockbuilder$(index2, column)
Case 31
stockman6$=stockbuilder$(index2, column)
Case 32
stockman7$=stockbuilder$(index2, column)
Case 33
stockman8$=stockbuilder$(index2, column)
Case 34
stockman9$=stockbuilder$(index2, column)
Case 35
stockman10$=stockbuilder$(index2, column)
Case 36
stockman11$=stockbuilder$(index2, column)
Case 37
stockman12$=stockbuilder$(index2, column)
Case 38
stockman13$=stockbuilder$(index2, column)
Case 39
stockman14$=stockbuilder$(index2, column)
Case 40
stockman15$=stockbuilder$(index2, column)
Case 41
stockman16$=stockbuilder$(index2, column)
Case 42
stockman17$=stockbuilder$(index2, column)
Case 43
stockman18$=stockbuilder$(index2, column)
Case 44
stockman19$=stockbuilder$(index2, column)
Case 45
stockman20$=stockbuilder$(index2, column)
End Select
Next column
Put #stock, index2
Next index2
Close #stock3
Close #stock
If stockexists("stcoldrecover.bak") Then
Kill "stcoldrecover.bak"
End If
If stockexists("stcrecover.bak") Then
Name "stcrecover.bak" As "stcoldrecover.bak"
End If
Name "stock.stk" As "stcrecover.bak"
Name "stccontact.stk" As "stock.stk"
End Sub
Function stockexists(a$)
Files DefaultDir$, a$, stockexistInfo$()
exists=val(stockexistInfo$(0,0))
End Function
Sub stockremoveEntry
Print #main.stockcatogriefilter, "selection? filter$"
If stockaddName=0 Then
Confirm "YOU ARE ABOUT TO DELETE THIS RECORD"+Chr$(13)+" "+Chr$(13)+Chr$(34)_
+stockname$(stockrecordIndex)+Chr$(34)+Chr$(13)+" "+Chr$(13)+"Do you want to proceed?";delAns$
If Lower$(delAns$)="no" Then [noinvDelete]
WindowWidth=150
WindowHeight=75
StaticText #stcpatience, "PLEASE WAIT...", 10, 15, 100, 25
Open "DELETING...", For Dialog_Modal As #stcpatience
Open "stock.stk" For Random As #stock Len = 17030
Field #stock, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
For moveincRecords=stockrecordIndex+1 To stockCount
Get #stock, moveincRecords+1
Put #stock, moveincRecords
Next moveincRecords
Get #stock, 1
stockname$(Val(stockname$))=""
stockname$=Str$(Val(stockname$)-1)
Put #stock, 1
Close #stock
Close #stcpatience
Call stockloadNames
Call loadStockFilter handle$
Notice "RECORD DELETED"+Chr$(13)+"Names reloaded"
Else
Notice "NO RECORD SELECTED!"+Chr$(13)+"Please select a record," _
+Chr$(13)+"then select delete from the menu."
End If
[noinvDelete]
End Sub
Sub stockpick handle$
Print #main.stcdup, "Selection? stcduplicate$"
locateRecord=Instr(stcduplicate$," @ ")
recordNum=Val(Mid$(stcduplicate$,locateRecord+3))
Print #main.stockname, "SelectIndex ";recordNum
Print #main.stockname, "SelectIndex 0"
End Sub
[stockincome]
#main.stocksearchbox, "!contents? stocksearchnow$"
Open "stock.stk" For Random As #stock Len = 17030
Field #stock, 100 As stockname$, 35 As stockdate$, 35 As stockcost$, 30 As stockamount$, 30 As stcspare$, _
20 As stcspare2$, 20 As stocklocation$,30 As stcspare4$,30 As stcspare5$, 30 As stcspare6$, 50 As stcspare7$, _
20 As stockcatogrie$, 500 As stcspare8$, 500 As stcspare9$, 200 As stcspare10$, 200 As stcspare11$, _
50 as forsaleon$, 50 as stockother$, 50 as stc3$, 50 as stc4$, 50 as stc5$, 50 as stc6$, 4000 as stc7$, 10000 as stc8$,_
10 as stockman1$,10 as stockman2$,10 as stockman3$,50 as stockman4$,50 as stockman5$,50 as stockman6$,50 as stockman7$,_
5 as stockman8$,5 as stockman9$,5 as stockman10$,5 as stockman11$,5 as stockman12$,5 as stockman13$,30 as stockman14$,_
20 as stockman15$,250 as stockman16$,250 as stockman17$,50 as stockman18$,20 as stockman19$,20 as stockman20$
Get #stock, 1
contactCount = Val(stockname$)
If contactCount = 0 Then
Close #stock
Goto [stcmoveOn]
End If
For index = 2 To contactCount + 1
Gettrim #stock, index
'If searchnow$ = name$ Then
If trim$(stocksearchnow$) = left$(stockname$, len(stocksearchnow$)) then
stockname$(index - 1) = str$(index-1)+") "+stockname$
Else
stockname$(index - 1) = ""
End If
Next index
Close #stock
Print #main.stockname, "reload"
#main.stocksearchbox, "!setfocus"
print #main.stocksearchbox, ""
'timer 400, [go]
wait
'2022
[loadimagestock]
'#main.stockbox, "flush"
filedialog "Open","*.bmp",bmp$
if bmp$="" then wait
'unload previous image, if there is one
if hBitmap<>0 then unloadbmp "bitmap"
'load bitmap
loadbmp "bitmap",bmp$
#main.imagestockpath,bmp$
'get handle of bitmap
hBitmap=hbmp("bitmap")
'get dimensions of image
bwide=BitmapWidth(hBitmap)
bhigh=BitmapHeight(hBitmap)
'select bmp into memory DC
oldBmp=SelectObject(mDC,hBitmap)
'display in graphicbox, scaled
call StretchBlt gDC,0,0,swide,shigh,mDC,0,0,bwide,bhigh
'#main.stockbox, "flush"
wait
Function GetDC(hWnd)
CallDLL #user32, "GetDC",_
hWnd As Long,_ 'window or control handle
GetDC As Long 'returns device context
End Function
Sub ReleaseDC hWnd, hDC
CallDLL#user32,"ReleaseDC",_
hWnd As Long,_ 'window or control handle
hDC As Long,_ 'handle of DC to delete
result As Long
End Sub
Function CreateCompatibleDC(hDC)
CallDLL #gdi32,"CreateCompatibleDC",_
hDC As Long,_ 'window DC
CreateCompatibleDC As Long 'memory DC
End Function
Sub DeleteDC hDC
CallDLL #gdi32, "DeleteDC",_
hDC As Long,_ 'memory DC to delete
r As Boolean
End Sub
Sub StretchBlt hDCdest,x,y,w,h,hDCsrc,x2,y2,w2,h2
CallDLL #gdi32, "SetStretchBltMode",_
hDCdest As Long,_ 'device context
_COLORONCOLOR As Long,_ 'color reduction mode
RESULT As Long
CallDLL #gdi32, "StretchBlt",_
hDCdest As Long,_ 'destination
x As Long,_ 'destination x pos
y As Long,_ 'destination y pos
w As Long,_ 'destination width desired
h As Long,_ 'destination height desired
hDCsrc As Long,_ 'source
x2 As Long,_ 'x location to start from source
y2 As Long,_ 'y location to start from source
w2 As Long,_ 'width desired from source
h2 As Long,_ 'height desired from source
_SRCCOPY As Ulong,_ 'dwRasterOperation
RESULT As Boolean
End Sub
Function BitmapWidth(Hbmp)
struct BITMAP,_
bmType As Long,_
bmWidth As Long,_
bmHeight As Long,_
bmWidthBytes As Long,_
bmPlanes As Word,_
bmBitsPixel As Word,_
bmBits As Long
nSize=Len(BITMAP.struct)
CallDLL #gdi32, "GetObjectA", Hbmp As Long,_
nSize As Long,BITMAP As struct,_
results As Long
BitmapWidth=BITMAP.bmWidth.struct
End Function
Function BitmapHeight(Hbmp)
struct BITMAP,_
bmType As Long,_
bmWidth As Long,_
bmHeight As Long,_
bmWidthBytes As Long,_
bmPlanes As Word,_
bmBitsPixel As Word,_
bmBits As Long
nSize=Len(BITMAP.struct)
CallDLL #gdi32, "GetObjectA", Hbmp As Long,_
nSize As Long,BITMAP As struct,_
results As Long
BitmapHeight=BITMAP.bmHeight.struct
End Function
Function SelectObject(hDC,hObject)
CallDLL #gdi32,"SelectObject",_
hDC As Long,_ 'memory device context
hObject As Long,_ 'handle of object
SelectObject As Long 'returns previously selected object
End Function
[graphicspart4]
sub getimagestock handle$
'if hBitmap<>0 then unloadbmp "bitmap"
'#main.stockbox, "flush"
#main.imagestockpath, "!contents? bmp$"
'#main.imagestockpath,bmp$
loadbmp "bitmap",bmp$
'get handle of bitmap
hBitmap=hbmp("bitmap")
'get dimensions of image
bwide=BitmapWidth(hBitmap)
bhigh=BitmapHeight(hBitmap)
'select bmp into memory DC
oldBmp=SelectObject(mDC,hBitmap)
'display in graphicbox, scaled
call StretchBlt gDC,0,0,swide,shigh,mDC,0,0,bwide,bhigh
#main.stockbox, "flush"
#main, "refresh"
end sub