Ge ntegreerde proef Boekhouden - Informaticausers.skynet.be/xterm/gip.pdfVoor informatica heb...

220
Ge¨ ıntegreerde proef Boekhouden - Informatica Lennart Yseboodt Schooljaar 2001-2002

Transcript of Ge ntegreerde proef Boekhouden - Informaticausers.skynet.be/xterm/gip.pdfVoor informatica heb...

Geıntegreerde proefBoekhouden - Informatica

Lennart Yseboodt

Schooljaar 2001-2002

Woord vooraf

Elke 6de jaars moet een geıntegreerde proef maken, die op het einde van het jaarmoet worden afgegeven. Dit was geen sinecure daar het de eerste keer was dat ikeen groot project op lange termijn moest plannen en voorbereiden.

Vanaf het begin van het jaar heb ik steeds geprobeerd elke deeltaak tot eengoed einde te brengen wat in de meeste gevallen goed gelukt is. Voor informaticaheb geprobeert een programma te ontwikkelen dat op een hoger niveau stond danhetgene wat ons in de cursus aangeboden werd. Mede dankzij Mevr. Jegers diehierin zeer soepel is geweest is dit gelukt.

Omdat ik vrijheid van gedachten zeer belangrijk vind, heb ik deze bundel onderde GNU General Free Documentation License1 en het programma zelf onder de GNUGeneral Public License2 geplaatst. De GPL heb ik vertaald naar het Nederlands, dezestaat op de GNU website, bij de lijst van vertalingen.

Dankbetuigingen

Eerst en vooral zou ik Forest & Bold willen bedanken om mij een schooljaar lang tewillen begeleiden als GIP bedrijf.Ook zou ik Dhr Blommaert willen bedanken, die mij steeds van goede raad heeftvoorzien tijdens het schooljaar, waardoor het maken van de GIP heel wat aange-namer was.Mvr. Jegers heeft bijzondere prestaties geleverd door zeer soepel te zijn met mijnniet gemakkelijk te verbeteren en soms nukkige GIP.Steven Van Heghe, mijn neef die me altijd steunt.Dhr. Bisschop die ons altijd bereidwillend geholpen heeft.

Door het werk van deze personen is deze bundel gerealiseerd :Richard Stallman, oprichter van de FSF die het besturingssysteem GNU3 maakt(e),waaronder dit document geschreven is.

1http://www.gnu.org/licenses/fdl.txt2http://www.gnu.org/licenses/gpl.txt3Dit systeem staat ook bekend als (GNU/)Linux

i

WOORD VOORAF ii

Linus Torvalds voor het beginnen van een revolutie.Daniel Robbins voor Gentoo GNU/Linux (en vooral Portage).Donald E Knuth, die de opmaaktaal TEX schreef, dat dit document zijn huidige vormgaf.Leslie Lamport, voor LATEX , een onmisbaar programma om met TEX te werken.Tobias Oetiker, voor zijn schitterende LATEX 2ε handleiding.Mark Edel, voor NEdit, mijn favoriete editor.

Inhoudsopgave

Woord vooraf i

Inleiding vii

I GIP Boek 1

1 Forest & Bold 2

2 Documentverwerking 32.1 Investeringen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1.1 Fontshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.2 IT Pro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.3 Polygoon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1.4 Duerinck Foto BVBA . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 Aankopen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2.1 Lithos(1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2.2 Lithos(2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2.3 Enfa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.4 Ass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.5 Emico NV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.6 Lefevre-Beel NV . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.7 Creditnota Lithos(1) . . . . . . . . . . . . . . . . . . . . . . . 5

2.3 Verkopen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3.1 Rockwell(1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3.2 Rockwell(2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3.3 Marcq & Roba . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3.4 Telenet Operaties NV . . . . . . . . . . . . . . . . . . . . . . 62.3.5 Totte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3.6 Creditnota Rockwell(1) . . . . . . . . . . . . . . . . . . . . . . 7

iii

INHOUDSOPGAVE iv

3 Balansanalyse 83.1 Boekjaar 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.1.1 Vermogensverdeling . . . . . . . . . . . . . . . . . . . . . . . . 83.1.2 Liquiditeit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.1.3 Omlooptijden & omloopsnelheden . . . . . . . . . . . . . . . . 93.1.4 Solvabiliteit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.1.5 Rentabiliteit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.2 Boekjaar 2001 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2.1 Vermogensverdeling . . . . . . . . . . . . . . . . . . . . . . . . 123.2.2 Liquiditeit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2.3 Omlooptijden & omloopsnelheden . . . . . . . . . . . . . . . . 133.2.4 Solvabiliteit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.2.5 Rentabiliteit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.3 Conclusie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

4 Sims 0.2 194.1 API0 (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.2 CFG CLASS (class) . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.3 Customers ADDEDF (module) . . . . . . . . . . . . . . . . . . . . . 284.4 Customers ADDEDEV (module) . . . . . . . . . . . . . . . . . . . . 304.5 CustomersEV (module) . . . . . . . . . . . . . . . . . . . . . . . . . . 344.6 CustomersF (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . 394.7 DBG CLASS (class) . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.8 DBS CLASS (class) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484.9 FLIB DBG (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . 734.10 FLIB NDBG (module) . . . . . . . . . . . . . . . . . . . . . . . . . . 774.11 frmCustomers (formcode) . . . . . . . . . . . . . . . . . . . . . . . . 814.12 frmCustomersADDED (formcode) . . . . . . . . . . . . . . . . . . . . 834.13 frmInvoices (formcode) . . . . . . . . . . . . . . . . . . . . . . . . . . 854.14 frmMain (formcode) . . . . . . . . . . . . . . . . . . . . . . . . . . . 864.15 frmParts (formcode) . . . . . . . . . . . . . . . . . . . . . . . . . . . 884.16 frmPartsADDED (formcode) . . . . . . . . . . . . . . . . . . . . . . . 904.17 frmPC (formcode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 924.18 frmPCADDED (formcode) . . . . . . . . . . . . . . . . . . . . . . . . 944.19 frmSplash (formcode) . . . . . . . . . . . . . . . . . . . . . . . . . . . 964.20 INIT (coremodule) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 984.21 InvoiceEV (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1014.22 MainEV (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1034.23 MEMCORE (coremodule) . . . . . . . . . . . . . . . . . . . . . . . . 1084.24 PartsADDEDEV (module) . . . . . . . . . . . . . . . . . . . . . . . . 1164.25 PartsEV (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

INHOUDSOPGAVE v

4.26 PartsF (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1234.27 PC ADDEDEV (module) . . . . . . . . . . . . . . . . . . . . . . . . 1264.28 PC ADDEDF (module) . . . . . . . . . . . . . . . . . . . . . . . . . 1314.29 PCsEV (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1344.30 PCsF (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1384.31 SplashEV (module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

II Overige deeltaken 148

5 Bevestiging medewerking 149

6 Probleemdefinitie 1506.1 Het bedrijf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1506.2 Doel van het programma . . . . . . . . . . . . . . . . . . . . . . . . . 150

7 Algemeen beeld van het bedrijf (Frans) 151

8 Analyse van een arbeidsovereenkomst 1528.1 Situering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1528.2 Algemeen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1528.3 Artikel 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1528.4 Artikel 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1538.5 Artikel 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1538.6 Artikel 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1538.7 Artikel 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1538.8 Artikel 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1548.9 Artikel 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1548.10 Artikel 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1548.11 Artikel 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1548.12 Artikel 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1548.13 Artikel 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1558.14 Artikel 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1558.15 Artikel 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1558.16 Artikel 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

9 Gebruikershandleiding Sims 1569.1 Systeemvereisten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1569.2 Sims downloaden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

9.2.1 Hoe downloaden . . . . . . . . . . . . . . . . . . . . . . . . . 1569.2.2 Sims uitpakken . . . . . . . . . . . . . . . . . . . . . . . . . . 157

9.3 Sims installeren . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

INHOUDSOPGAVE vi

9.3.1 Bestanden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1579.3.2 Sims opstarten . . . . . . . . . . . . . . . . . . . . . . . . . . 1579.3.3 Mogelijke fouten . . . . . . . . . . . . . . . . . . . . . . . . . 158

9.4 Configuratie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1589.4.1 Config.cfg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

9.5 De klantenlijst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1599.5.1 Klanten toevoegen . . . . . . . . . . . . . . . . . . . . . . . . 1599.5.2 Klanten verwijderen . . . . . . . . . . . . . . . . . . . . . . . 1599.5.3 Klantgegevens wijzigen . . . . . . . . . . . . . . . . . . . . . . 1609.5.4 Zoeken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

10 Programmeurshandleiding Sims 16410.1 Publiek van deze handleiding . . . . . . . . . . . . . . . . . . . . . . 16410.2 Licentieovereenkomst . . . . . . . . . . . . . . . . . . . . . . . . . . . 16410.3 Licentieovereenkomst van Sims . . . . . . . . . . . . . . . . . . . . . 16410.4 Software vereisten voor Sims . . . . . . . . . . . . . . . . . . . . . . . 16510.5 De broncode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

10.5.1 Directory structuur van de bronbestanden . . . . . . . . . . . 16510.5.2 Objecten & Functies . . . . . . . . . . . . . . . . . . . . . . . 16510.5.3 Gebeurtenissen afhandelen . . . . . . . . . . . . . . . . . . . . 17010.5.4 Formulieren en andere bestanden . . . . . . . . . . . . . . . . 17110.5.5 Modificaties in de hoofdcode invoeren . . . . . . . . . . . . . . 172

11 Besluit 173

III Bijlagen 174

12 Facturen 175

13 Jaarrekeningen 192

14 GNU Algemene Publieke Licentie 20114.1 English disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20114.2 Nederlandse waarschuwing . . . . . . . . . . . . . . . . . . . . . . . . 20114.3 Auteursrecht . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20114.4 Voorwoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20214.5 Bepalingen en voorwaarden . . . . . . . . . . . . . . . . . . . . . . . 20414.6 Deze bepalingen op uw nieuwe Programma toepassen. . . . . . . . . . 209

Inleiding

Toen ik vorig jaar een GIP bedrijf moest kiezen dacht ik meteen aan Forest & Bold,dat in mijn buurt gevestigd is. Ik heb een afspraak gemaakt en zij waren bereid ommij bij deze taak te helpen, ondanks het feit dat ik voor hun niets kon doen daarzij met Apple computers werken. Ondanks dit heeft Forest & Bold mij het hele jaaraltijd zeer stipt en correct geholpen met interviews en documenten, waarvoor mijndank.

Omdat ik van Mevr. Jegers mocht kiezen wat ik dan zou maken, heb ik gekozenom een programma te maken, dat enerzijds zoveel mogelijk aanleunde bij wat wein de les zagen en toch nuttig kon zijn voor een breed publiek. Na wat wikken enwegen heb ik een programma gemaakt voor stockbeheer, uitgewerkt voor hardwareonderdelen en facturen voor computerwinkels. Het programma is zo opgesteld dathet met zeer weinig moeite omgevormd kan worden voor andere producten.

Het programma heet Sims4 - Stock & Invoice Management System en is bedoeldvoor mensen die in een (computer)winkel werken en een gratis5 programma voorstockbeheer willen.

4Er bestaat ook een spel genaamd ’Sims(c)’, beiden hebben niets met elkaar te maken5Een correctere term zou ’vrij’ zijn

vii

Deel I

GIP Boek

1

Hoofdstuk 1

Forest & Bold

Forest & Bold werd in 1992 door Koen Meeuwels opgericht. Het bedrijf is gespe-cialiseerd in reclamecampagnes voor middelgrote en grote bedrijven.

In 1992 besloot Koen Meeuwels om een reclamebureau te starten. Hij renoveerdezijn ouderlijk huis tot kantoorruimte. Het bedrijf is rustig maar vastberaden gegroeid,zowel qua omzet als personeelsbestand. Gemiddeld wordt elk anderhalf jaar iemandaangenomen. Tijdens vakanties kunnen jobstudenten er terecht als grafisch ontwer-per. Er werken nu in totaal 7 mensen.

Ondanks het feit dat vele jonge of informatica gerichte bedrijven failliet zijngegaan tijdens de ’.com’ crisis, heeft Forest & Bold hier geen of zeer weinig hindervan ondervonden: dit wijst op gezond management en een goede balans. De omzetbedraagt nu gemiddeld 150.000.000 BEF per jaar met een winstmarge van 12.6%.

Naar de toekomst toe ziet men een gestage groei, geen spectaculaire vernieuwin-gen of veranderingen. Men gaat met de hedendaagse technologie mee zonder zich ingevaarlijke financiele avonturen te storten.

Dhr. Huyens (Financieel directeur Forest & Bold) heeft weet van de vereistedocumenten en zal deze bezorgen voor januari. Het bleek geen probleem om debalans te mogen inkijken.

Het bedrijf gebruikt Mac G4 computers voor al zijn ontwerpen en administratie.Men is nog niet overgeschakeld op Mac OS X, omdat de meest gebruikte pakkettennog niet in Carbon versie beschikbaar zijn. Dit zou de systeemstabiliteit niet tengoede komen, dus men heeft besloten zich voorlopig tot MacOS 9.1 te beperken.

Net daarom is het vrij zinloos een programma voor dit bedrijf te schrijven. Ikheb dus een programma geschreven dat van algemeen nut is voor mensen die eenhardware winkel uitbaten. Het programma zal de voorraad van tweedehandshandsonderdelen bijhouden. Het heeft ook de mogelijkheid een pc samen te stellen, waarnade onderdelen uit de stock verdwijnen, en omgedraaid.

2

Hoofdstuk 2

Boekhoudkundige verwerking vandocumenten

2.1 Investeringen

2.1.1 Fontshop

Zie factuur op pagina 175.Beschrijving APKO +/- D/C Rekening Bedrag

Bezit stijgt A + D 211201 Licentie(software) 12000

Vordering stijgt A + D 41110 Aftrekbare BTW 2520

Schuld stijgt P + C 440001 (fontShop) 14520

2.1.2 IT Pro

Zie factuur op pagina 176.Beschrijving APKO +/- D/C Rekening Bedrag

Bezit stijgt A + D 23200 Uitrusting 98900

Vordering stijgt A + D 41110 Aftrekbare BTW 20769

Schuld stijgt P + C 440002 IT Pro 119669

3

HOOFDSTUK 2. DOCUMENTVERWERKING 4

2.1.3 Polygoon

Zie factuur op pagina 177.Beschrijving APKO +/- D/C Rekening Bedrag

Bezit stijgt A + D 23200 Uitrusting 117409

Kost stijgt K + D 60200 Dienst 3300

Kost stijgt K + D 60600 Aankoopkosten 350

Vordering stijgt A + D 41110 Aftrekbare BTW 25422

Schuld stijgt P + C 440003 (Polygoon) 146481

2.1.4 Duerinck Foto BVBA

Zie factuur op pagina 178.Beschrijving APKO +/- D/C Rekening Bedrag

Kost stijgt A + D 60200 (fotoshoot) 4900

Kost stijgt A + D 601001 (hulpstof ICT) 100

Vordering stijgt A + D 41110 Aftrekbare BTW 1050

Schuld stijgt P + C 440004 (Duerinck) 6050

2.2 Aankopen

2.2.1 Lithos(1)

Zie factuur op pagina 179.Beschrijving APKO +/- D/C Rekening Bedrag

Kost stijgt K + D 60100 Aankopen hulpstof 297630

Vordering stijgt A + D 41110 Terug te vord. BTW 62502

Schuld stijgt P + C 440005 (Lithos) 360132

2.2.2 Lithos(2)

Zie factuur op pagina 180.Beschrijving APKO +/- D/C Rekening Bedrag

Kost stijgt K + D 60100 Aankopen hulpstof 53934

Vordering stijgt A + D 41110 Terug te vord. BTW 11326

Schuld stijgt P + C 440005 (Lithos) 65260

HOOFDSTUK 2. DOCUMENTVERWERKING 5

2.2.3 Enfa

Zie factuur op pagina 181.Beschrijving APKO +/- D/C Rekening Bedrag

Kost stijgt K + D 61240 Drukw. & Kantoorbehoeften 12977

Vordering stijgt A + D 41110 Terug te vord BTW 2725

Schuld stijgt P + C 440006 (Enfa) 15702

2.2.4 Ass

Zie factuur op pagina 182.Beschrijving APKO +/- D/C Rekening Bedrag

Kost stijgt K + D 60100 Aankopen hulpstof 12763

Vordering stijgt A + D 41110 Terug te vord BTW 2144

Kost daakt K - C 60801 2554

Schuld stijgt P + C 440004 (Ass) 12353

2.2.5 Emico NV

Zie factuur op pagina 183.Beschrijving APKO +/- D/C Rekening Bedrag

Kost stijgt K + D 60100 Aankopen hulpstof 83246

Vordering stijgt A + D 41110 Terug te vord. BTW 17482

Schuld stijgt P + C 440008 (Emico) 100728

2.2.6 Lefevre-Beel NV

Zie factuur op pagina 184.Beschrijving APKO +/- D/C Rekening Bedrag

Kost stijgt K + D 60100 Aankopen hulpstof 8512

Vordering stijgt A + D 41110 Terug te vord. BTW 1788

Schuld stijgt P + C 440009 (Lefevre-Beel) 10300

2.2.7 Creditnota Lithos(1)

Zie factuur op pagina 185.Beschrijving APKO +/- D/C Rekening Bedrag

Schuld daalt P - D 44005 (Lithos) 18150

Kost daalt K - C 60110 Waardeverm. voorr. terugn(-) 15000

Vordering daalt A - C 41120 Aftr. BTW/Credit nota’s(-) 3150

HOOFDSTUK 2. DOCUMENTVERWERKING 6

2.3 Verkopen

2.3.1 Rockwell(1)

Zie factuur op pagina 186.Beschrijving APKO +/- D/C Rekening Bedrag

Vordering stijgt A + D 400001 (Rockwell) 47190

Opbrengst stijgt O + C 70400 Verkopen HG 39000

Schuld stijgt P + C 45110 Verschuldige BTW 8190

2.3.2 Rockwell(2)

Zie factuur op pagina 187.Beschrijving APKO +/- D/C Rekening Bedrag

Vordering stijgt A + D 400001 (Rockwell) 21949

Opbrengst stijgt O + C 70400 Verkopen HG 18140

Schuld stijgt P + C 45110 Verschuldigde BTW 3809

2.3.3 Marcq & Roba

Zie factuur op pagina 188.Beschrijving APKO +/- D/C Rekening Bedrag

Vordering stijgt A + D 400002 (Marcq&Roba) 492586

Opbrengst stijgt O + C 70400 Verkopen HG 407096

Schuld stijgt P + C 45110 Verschuldigde BTW 85490

2.3.4 Telenet Operaties NV

Zie factuur op pagina 189.Beschrijving APKO +/- D/C Rekening Bedrag

Vordering stijgt A + D 400003 (Telenet) 68728

Opbrengst stijgt O + C 70400 Verkopen HG 56800

Schuld stijgt P + C 45110 11928

2.3.5 Totte

Zie factuur op pagina 190.Beschrijving APKO +/- D/C Rekening Bedrag

Vordering stijgt A + D 400004 (Totte) 10769

Opbrengst stijgt O + C 70400 Verkopen HG 8900

Schuld stijgt P + C 45110 Verschuldigde BTW 1869

HOOFDSTUK 2. DOCUMENTVERWERKING 7

2.3.6 Creditnota Rockwell(1)

Zie factuur op pagina 191.Beschrijving APKO +/- D/C Rekening Bedrag

Opbrengst daalt O - D 70410 Inkomende retour HG 15000

Schuld daalt P - D 45120 BTW creditnotas 3150

Vordering daalt A - C 400001 (Rockwell) 18150

Hoofdstuk 3

Balansanalyse

Jaarrekening Forest & Bold, pagina’s 192 - 196 (2000), 197 - 200 (2001).

3.1 Boekjaar 2000

3.1.1 Vermogensverdeling

0 I 7500000 II 0

4623868 III 00 IV 15250000 V -14292580 VI 0

5269014 VII 00 VIII 3352441

784365 IX 6616321137257 X 0

10814504 TOTAAL 10814504

4623869 VA EV 8457426190636 VlA VVLT 3352441

VVKT 6616321

42.8% VA EV 7.8%57.2% VlA VVLT 31.0%

VVKT 61.2%100% 100%

Zie ook de grafieken op pagina 16.

3.1.2 Liquiditeit

Current ratio

6190636

6616321= 0.93

Forest & Bold kan indien het al zijn vorderingen onmiddellijk int, en al zijn voorradenonmiddellijk kan verkopen aan de waarde zoals aangeduid in de boekhouding (er zijngeen voorraden), slechts 93% van zijn vorderingen op korte termijn betalen.

8

HOOFDSTUK 3. BALANSANALYSE 9

Quick ratio

6190636− 0

6616321= 0.93

Daar er geen voorraden zijn is de Quick ratio identiek aan de current ratio.

Thesaurie ratio

6190636− 5269014

6616321= 0.14

Indien alle vorderingen niet meer geınd zouden kunnen worden, en Forest & Boldzijn leveranciers moet betalen met de liquide middelen die het heeft (bank & kas),dan kan slecht 14% van de verschuldigde som aan de leveranciers worden betaald.

3.1.3 Omlooptijden & omloopsnelheden

Voorraadrotatie

8534334

(0 + 0)/2= /

Daar dit een dienstenverlenend bedrijf is, en geen voorraden heeft, kan de voor-raadrotatie niet berekend worden.

Hetzelfde geldt voor de omlooptijden van de voorraad.

Klantenrotatie

In de balans staat:

Brutowinst7794333

Omzet 12905369Aankopen -5111036

Men trekt hier een aantal aankopen van de omzet af, ik ben echter van meningdat deze net zo goed opbrengsten zijn, dus ik neem 12905369 als (70-74) opbrengs-tencijfer.

129053695261659+2338210

2·1.21

= 4.11

De noemer is het gemiddelde van de handelsvorderingen van de boekjaren 2000 en1999. Dit betekent dat er gemiddeld in een boekjaar 4.11 keer alle vorderingen geındworden.

HOOFDSTUK 3. BALANSANALYSE 10

Omlooptijd klanten

365

4.11= 88.8

Forest & Bold kent een gemiddeld betalingsuitstel van 89 dagen toe. Gezien hun zeerlage current ratio zou het aan te raden zijn om een strikter betalingsbeleid te gaanvoeren of met discontokrediet te gaan werken. Als men discontokrediet gebruikt, dandraagt de bank het risico van de vordering en stijgen de liquide middelen en aldusook de liquiditeitsratio’s.

Leveranciersrotatie

5111036 + 51242376616321+6926331

2·1.21

= 1.83

Forest & Bold betaalt bijna 2 keer per jaar de schulden aan de leveranciers.

Omlooptijden leveranciers

365

1.83= 199.45

Forest & Bold krijgt een gemiddeld betalingsuitstel van 6.5 maanden.

Vergelijking omlooptijden

Als men de omlooptijden van klanten & leveranciers bekijkt lijkt er geen vuiltje aande lucht de zijn. De klanten betalen bijna 3x zo snel als zij de leveranciers moeten be-talen: kijkt men echter naar de verhouding tussen de vorderingen en de schulden,danziet men een ander beeld. De gemiddelde schuld (1999-2000) was 1.7 keer groter dande gemiddelde vordering. Als men de evolutie van 1999 naar 2000 bekijkt is hetpositiever: de vorderingen verdubbelen bijna (x1.86). Daar Forest & Bold hoofdza-kelijk bedrijven als klant heeft is de kans op dubieuze debiteuren minder groot danbij hoofdzakelijk particuliere klanten.

Zie ook de grafieken BA3 en BA4 op pagina 17.

HOOFDSTUK 3. BALANSANALYSE 11

3.1.4 Solvabiliteit

Schuldgraad

9968762

10814504= 0.922

Meer dan 92% van het totaal vermogen wordt uitgemaakt door schulden, de normis hier 50%. De reden dat Forest & Bold zo diep in de schulden zit is omdat heteen zeer jong bedrijf is dat een trage groei kent. Ook zit het in een branche waar deconcurrentie moordend is en de winstmarges relatief laag.

Financiele zelfstandigheid

1− 0.922 = 0.078

Forest & Bold is voor 7.8% financieel zelfstandig.

Conclusie

In 2000 bestond Forest & Bold nog maar 6 jaar en hadden dus nog niet echt grotenaam gemaakt, hun schuldgraad is met +- 90% zeer hoog. Dit is echter niet ongewoonvoor jonge bedrijven of bedrijven die in een nieuwe branche naam moeten maken.

3.1.5 Rentabiliteit

Rentabiliteit op het eigen vermogen

−649421

845742= −0.76

Forest & Bold maken een verlies van 76% op hun eigen vermogen. Dit hoge cijfervalt mede te verklaren door het feit dat hun eigen vermogen slechts 10% van hettotaal vermogen bedraagt.

Rentabiliteit op het totaal vermogen

−648671 + 175394

10814504= −0.043

Omdat het vreemd vermogen meer dan 90% van het passiva vertegenwoordigt is hetlogisch dat deze waarde lager ligt dan de rentabiliteit op het eigen vermogen. Ookhier maakt Forest & Bold verlies, en dit zelfs zonder rekening te houden met hetverlies dat nog overgedragen moet worden.

HOOFDSTUK 3. BALANSANALYSE 12

3.2 Boekjaar 2001

3.2.1 Vermogensverdeling

0 I 7500000 II 0

4091338 III 00 IV 15250000 V -8700750 VI 0

4685414 VII 00 VIII 2155725

3023008 IX 8378023151457 X 12544

10814504 TOTAAL 10814504

4091338 VA EV 14049257859879 VlA VVLT 2155725

VVKT 8390567

34.2% VA EV 11.8%65.8% VlA VVLT 18.0%

VVKT 70.2%100% 100%

Zie ook de grafieken op pagina 16

3.2.2 Liquiditeit

Current ratio

7859879

8390567= 0.93

Deze ratio is hetzelfde gebleven in vergelijking met vorig jaar. Hij zou nog ietsomhoog moeten om de norm 1 te halen.

Quick ratio

Daar er geen voorraden zijn is deze ratio dezelfde als de Current ratio.

Thesaurie ratio

3174465

830567= 0.37

Een zeer sterke stijging van het thesaurie ratio tegenover het vorige jaar, te ver-klaren door veel grotere geldvoorraad. Dit stelt hen in staat om onmiddellijk, zonderklanten om te zetten in geld, 37% van de leveranciersschuld te betalen.

HOOFDSTUK 3. BALANSANALYSE 13

Vergelijking ratio’s

Current : De current ratio is van 1999 naar 2000 sterk gestegen door een toenamein handelsdebiteuren, deze is constant gebleven van 2000 naar 2001 ondanks dat dethesaurie ratio wel gestegen is.

Thesaurie : De thesaurie ratio daalt lichtjes van 1999 naar 2000 omdat de geld-voorraden slinken, echter deze stijgen substantieel van 2000 naar 2001 zonder dat decurrent ratio daalt! Dwz dat als x klanten betaald hebben ze er nog eens x bijgekre-gen hebben. Deze ratio gaat de goede kant op en zal hopelijk snel de norm van 75%halen.

Zie ook de grafiek BA5 op pagina 18

3.2.3 Omlooptijden & omloopsnelheden

Voorraadrotatie

Daar er geen voorraad is kan deze omloopsnelheid niet berekend worden.Hetzelfde geldt voor de omlooptijd van de voorraad.

Klantenrotatie

180585234530929+5261659

2·1.21

= 4.46

Een lichte stijging tegenover 2000, om hun liquiditeit op te krikken heeft Forest& Bold blijkbaar een strikter betalingsbeleid gevoerd of een aantal klanten heeftsneller betaald. De omzet is met 40% gestegen, dit jaar wordt er ook voor het eerstwinst gemaakt (in de periode 1999-2001).

Omlooptijd klanten

365

4.46= 81.83

De klanten krijgen nu een gemiddeld betalingsuitstel van 80 dagen, dit zou nogiets verder omlaag gebracht kunnen worden om de schuldgraad te verbeteren.

HOOFDSTUK 3. BALANSANALYSE 14

Leveranciersrotatie

94297816809537+6419151

2·1.21

= 1.73

Waarschijnlijk door de snellere klantenrotatie heeft Forest & Bold beslist om hunleveranciers iets sneller te betalen, dit resulteert in een stijging van 14% rotatiesnel-heid. Het sneller betalen van de leveranciers is gunstig voor het rendement (EV).

Omlooptijden leveranciers

365

1.73= 211

Gemiddeld worden nu om de 7 maanden alle leveranciers uitbetaald.

3.2.4 Solvabiliteit

Schuldgraad

10546292

11951217= 0.88 = 88%

Forest & Bold’s Passiva is voor 88% vreemd vermogen, schulden dus. Dit valt teverklaren doordat het een jong bedrijf is dat door zware concurrentie met verliesloopt.

Financiele zelfstandigheid

1404925

11951217= 0.12 = 12%

Conclusie

Net zoals bij het thesaurie ratio neemt in 2000 de financiele zelfstandigheid een dip,dit kan misschien verklaard worden door de .com & Y2k crisis die het vertrouwen ineen reclamebureau enigszins kunnen doen dalen. Zie ook de grafiek op pagina 18.

HOOFDSTUK 3. BALANSANALYSE 15

3.2.5 Rentabiliteit

Rentabiliteit op het eigen vermogen

559183

1404925= 0.4

Forest & Bold heeft een rendement van 40% op het eigen vermogen, echter heteigen vermogen geeft nogal extreme getallen omdat de schuldgraad enorm hoog ligt.

Rentabiliteit op het totaal vermogen

560133 + 251868

11951217= 0.07

Een zeer laag rentabiliteit ratio, maar toch een kleine maar positieve verbeteringtegenover 2000, dat niet echt een goed jaar was.

3.3 Conclusie

Forest & Bold voldoet niet aan de hoofdfinancieringsregel want ze hebben 4.4% vanhun Vast actief gekocht met vreemd vermogen op korte termijn: VA>EV+VVLT Zezullen hiervoor een krediet bij de bank moeten aanvragen, of het betalen met liquidemiddelen. Dit is goed mogelijk aangezien ze zeer veel geldvoorraad hebben.

Ze voldoen ook niet aan de liquiditeitsregel, maw, Forest & Bold is overliquide.Dit komt door een massale hoeveelheid aan handelsdebiteurs.

Ook aan de solvabiliteitsregel wordt niet voldaan, het VVKT is 4.4% groter danalle liquide middelen waar ook dubieuze debiteuren in kunnen zitten.

Al met al zijn er geen grote rampen te zien op deze balans, Forest & Bold zitdiep in de schulden en kan net het hoofd boven water houden, maar ze maken winsten van zodra ze alle overgedragen verliezen hebben goedgemaakt kan dit bedrijf flinkbeginnen te renderen.

HOOFDSTUK 3. BALANSANALYSE 16

EDNOTE: Replace by BA1 & BA2

HOOFDSTUK 3. BALANSANALYSE 17

EDNOTE: Peplace by BA3 & BA4

HOOFDSTUK 3. BALANSANALYSE 18

EDNOTE : Replace by BA5 & BA6

Hoofdstuk 4

Sims 0.2

4.1 API0 (module)

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : API0.bas *’* OBJECT : API0 *’* DESCRIPTION : Function definitions of Windows GDI API calls *’* *’**********************************************************************************

Public Const SWP_NOMOVE = 2Public Const SWP_NOSIZE = 1Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZEPublic Const HWND_TOPMOST = -1

19

HOOFDSTUK 4. SIMS 0.2 20

Public Const HWND_NOTOPMOST = -2

Declare Function SetWindowPos Lib "user32" _(ByVal hwnd As Long, _ByVal hWndInsertAfter As Long, _ByVal x As Long, _ByVal y As Long, _ByVal cx As Long, _ByVal cy As Long, _ByVal wFlags As Long) As Long

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : SetTopMostWindow *’* SCOPE : Public *’* DESCRIPTION : Make windows Always on Top *’*********************************************************

Public Function SetTopMostWindow(F As Form, Topmost As Boolean) As Long

SyS.DBG.enterFunction "API{SetTopMostWindow}"

If Topmost = True Then ’Make the window topmostSetTopMostWindow = SetWindowPos(F.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)

ElseSetTopMostWindow = SetWindowPos(F.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)’SetTopMostWindow = False

End If

SyS.DBG.leaveFunction "API{SetTopMostWindow}"

End Function

HOOFDSTUK 4. SIMS 0.2 21

4.2 CFG CLASS (class)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : CFG_CLASS.cls *’* OBJECT : CFG_CLASS *’* DESCRIPTION : Manages the configuration file *’* *’**********************************************************************************

’ Private vars

Private Const C_INPUT As Integer = 0Private Const C_OUTPUT As Integer = 1Private fn As Integer

’ Public vars

Public loadSucces As Boolean

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Class_Initialize *’* SCOPE : Private *’* DESCRIPTION : Loads the class/config *’*********************************************************

HOOFDSTUK 4. SIMS 0.2 22

Private Sub Class_Initialize()

SyS.DBG.enterFunction "Class_Initialise"

Dim fo As Boolean

SyS.DBG.makeLogEntry "Loading config..."

fn = FreeFilefo = openConfig(C_INPUT)If fo = False Then

loadSucces = FalseSyS.DBG.makeLogEntry "ERROR- Config file couldn’t be read"SyS.DBG.leaveFunction "Class_Initialize (indirect)"Exit Sub

End If

loadSucces = True ’ Loaded OK

loadConfig

SyS.DBG.leaveFunction "Class_Initialise"

End Sub

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : openConfig *’* SCOPE : Private *’* DESCRIPTION : Opens the configuration file *’*********************************************************

Private Function openConfig(mode As Integer) As Boolean

SyS.DBG.enterFunction "openConfig"

On Error GoTo badConfigOpen

If mode = C_INPUT ThenOpen App.Path & "\config.cfg" For Input As fn

ElseIf mode = C_OUTPUT ThenOpen App.Path & "\config.cfg" For Output As fn

End If

openConfig = True

SyS.DBG.leaveFunction "openConfig"

Exit Function

HOOFDSTUK 4. SIMS 0.2 23

badConfigOpen:

SyS.DBG.enterFunction "openConfig-badConfigOpen"openConfig = FalseSyS.DBG.makeLogEntry "Config /open failed, type " & _IIf(mode = 0, "INPUT", "OUPUT")SyS.DBG.makeLogEntry "Reason : " & Err.Description & _" (" & Str(Err.Number) & ")"SyS.DBG.leaveFunction "openConfig-badConfigOpen"SyS.DBG.leaveFunction "openConfig (indirect)"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : loadConfig *’* SCOPE : Private *’* DESCRIPTION : Loads config in global *’* SyS.Config.* *’*********************************************************

Private Function loadConfig()

SyS.DBG.enterFunction "loadConfig"

Dim l As StringDim CMD As String, ARG As StringDim ipos As Integer

setDefaultConfig

Do While Not (EOF(fn))

Input #fn, ll = Trim(l)

If Not (Left(l, 1) = "#" Or InStr(1, l, "=") <= 1) ThenSyS.DBG.makeLogEntry "Found value :" & lipos = InStr(1, l, "=")CMD = Left(l, ipos - 1)ARG = Right(l, Len(l) - (ipos))SyS.DBG.makeLogEntry "CMD: " & CMDSyS.DBG.makeLogEntry "ARG: " & ARGprocessCA CMD, ARG

ElseIf Not (l = "" Or Left(l, 1) = "#") _Then SyS.DBG.makeLogEntry "Comment/Invalid statement ignored : " & l

End If

HOOFDSTUK 4. SIMS 0.2 24

Loop

SyS.DBG.makeLogEntry "Closing I/Config file"Close #fn

SyS.DBG.leaveFunction "loadConfig"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : processCA *’* SCOPE : private *’* DESCRIPTION : Processes settings *’*********************************************************

Private Function processCA(CMD As String, ARG As String)

SyS.DBG.enterFunction "processCA"

Select Case LCase(CMD)

Case "caption"SyS.Config.appCaption = ARG

Case "database"SyS.Config.dbaseFileName = ARG

Case "showpartonboot"SyS.Config.bShowPart = IIf(LCase(ARG) = "false", False, True)

Case "showcustomersonboot"SyS.Config.bShowCust = IIf(LCase(ARG) = "false", False, True)

Case "showpcsonboot"SyS.Config.bShowPC = IIf(LCase(ARG) = "false", False, True)

Case "showinvoiceonboot"SyS.Config.bShowInvoice = IIf(LCase(ARG) = "false", False, True)

Case "fieldNA"SyS.Config.emptyString = ARG

Case "defaultCurrency"SyS.Config.defCurrency = ARG

Case ElseSyS.DBG.makeLogEntry "Invalid entry : " & CMD & ":" & ARG

HOOFDSTUK 4. SIMS 0.2 25

End Select

SyS.DBG.leaveFunction "processCA"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : setDefaultConfig *’* SCOPE : Private *’* DESCRIPTION : Sets default values *’*********************************************************

Private Function setDefaultConfig()

SyS.DBG.enterFunction "setDefaultConfig"

With SyS.Config.appCaption = "Unconfigered".dbaseFileName = App.Path & "\core.mdb".bShowCust = False.bShowPart = False.bShowPC = False.bShowInvoice = False.emptyString = "NONE".defCurrency = "EUR"

End With

SyS.DBG.leaveFunction "setDefaultConfig"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : saveConfig *’* SCOPE : Private *’* DESCRIPTION : function that saves the conf *’*********************************************************

Private Function saveConfig()

SyS.DBG.enterFunction "saveConfig"

If loadSucces = False Then setDefaultConfig’ If no config found we want a valid one :) << obs ? no!

Print #fn, "# Sims 0.1"Print #fn, "# Configuration file: see the manual for details."Print #fn, "# Sims falls under the GNU Public License." & vbCrLf

HOOFDSTUK 4. SIMS 0.2 26

Print #fn, "# Appearance"Print #fn, vbTab & "Caption=" & SyS.Config.appCaption & vbCrLf

Print #fn, "# File locations"Print #fn, vbTab & "DataBase=" & SyS.Config.dbaseFileName & vbCrLf

Print #fn, "#Window management"Print #fn, vbTab & "ShowPartOnBoot=" _& IIf(SyS.Config.bShowPart, "TRUE", "FALSE")Print #fn, vbTab & "ShowCustomersOnBoot=" _& IIf(SyS.Config.bShowCust, "TRUE", "FALSE")Print #fn, vbTab & "ShowPCsOnBoot=" & _IIf(SyS.Config.bShowPC, "TRUE", "FALSE")Print #fn, vbTab & "ShowInvoiceOnBoot=" & _IIf(SyS.Config.bShowInvoice, "TRUE", "FALSE")

Print #fn, "#General"Print #fn, vbTab & "fieldNA=" & SyS.Config.emptyStringPrint #fn, vbTab & "defaultCurrency=" & SyS.Config.defCurrency

Print #fn, vbCrLf & "### END CONFIG"

Close #fn

SyS.DBG.leaveFunction "saveConfig"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Class_Terminate *’* SCOPE : Private *’* DESCRIPTION : DESTRUCTOR *’*********************************************************

Private Sub Class_Terminate()

SyS.DBG.enterFunction "Class_Terminate"

Dim opf As Boolean

opf = openConfig(C_OUTPUT)

If opf = False ThenSyS.DBG.makeLogEntry "openConfig(OUTPUT) failed, aborting..."Exit Sub

ElsesaveConfig

HOOFDSTUK 4. SIMS 0.2 27

End If

SyS.DBG.leaveFunction "Class_Terminate"

End Sub

HOOFDSTUK 4. SIMS 0.2 28

4.3 Customers ADDEDF (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : Customers_ADDEDF.bas *’* OBJECT : Customers_ADDEDF *’* DESCRIPTION : Provides functions for Customers_ADDEDEV (& validations) *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Cust_fillFields(UIN) *’* SCOPE : Public *’* DESCRIPTION : Fills the txtFields *’*********************************************************

Public Function Cust_fillFields(UIN As Long)

SyS.DBG.enterFunction "Cust_fillFields"

SyS.DBS.Customer_PEEK (UIN)

With SyS.DbBuf.Customer

SyS.FRM.Customers_ADDED.txtCity = .CitySyS.FRM.Customers_ADDED.txtEmail = .EMailSyS.FRM.Customers_ADDED.txtFax = .Fax

HOOFDSTUK 4. SIMS 0.2 29

SyS.FRM.Customers_ADDED.txtFirstName = .SurnameSyS.FRM.Customers_ADDED.txtName = .NameSyS.FRM.Customers_ADDED.txtPCode = .PostnumberSyS.FRM.Customers_ADDED.txtPhone = .PhoneSyS.FRM.Customers_ADDED.txtStreet = .Adress

End With

SyS.DBG.leaveFunction "Cust_fillFields"

End Function

HOOFDSTUK 4. SIMS 0.2 30

4.4 Customers ADDEDEV (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : Customers_ADDEDEV.bas *’* OBJECT : Customers_ADDEDEV *’* DESCRIPTION : Event handler for Sys.FRM.Customers_ADDED *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : CustomersADDED_Load *’* SCOPE : Public *’* DESCRIPTION : Loads the form *’*********************************************************

Public Function CustomersADDED_Load()

SyS.DBG.enterFunction "CustomersADD_Load"

SyS.FRM.Customers_ADDED.ShowSyS.SysBuf.Cust_saveOK = True ’ WARNING << FOR DEBUGGING ONLY !!!’^^ obsolete by locking ??

If SyS.SysBuf.Cust_AddEdit > -1 ThenSyS.FRM.Customers_ADDED.Caption = "Edit " & _

SyS.iOBJ.Cust_LV.ListItems(curSelLV _

HOOFDSTUK 4. SIMS 0.2 31

(SyS.iOBJ.Cust_LV)).SubItems(1) & _" " & SyS.iOBJ.Cust_LV.ListItems(curSelLV(SyS.iOBJ.Cust_LV)).TextSyS.FRM.Customers_ADDED.cmdAdd.Caption = "Change"’Cust_fillFields (CLng(SyS.iOBJ.Cust_LV. _

ListItems(curSelLV(SyS.iOBJ.Cust_LV)).Tag))Cust_fillFields (SyS.SysBuf.Cust_AddEdit_UIN)SyS.FRM.Customers_ADDED.chkCAdd.Value = 2SyS.FRM.Customers_ADDED.chkCAdd.enabled = FalseSyS.FRM.Customers_ADDED.chkClAdd.Value = 2SyS.FRM.Customers_ADDED.chkClAdd.enabled = False

End If

SetTopMostWindow SyS.FRM.Customers_ADDED, True

SyS.lOBJ.Customers_ADDED = True

SyS.DBG.leaveFunction "Customers_ADDED_Load"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : CustomersADDED_QUnload *’* SCOPE : Public *’* DESCRIPTION : Unloads the form *’*********************************************************

Public Function CustomersADDED_QUnload()

SyS.DBG.enterFunction "Customers_QUnload"

SyS.FRM.Customers.cmdAdd.enabled = True

SyS.lOBJ.Customers_ADDED = False

SyS.DBG.leaveFunction "Customers_QUnload"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : CustomersAddED_Cancel_Click *’* SCOPE : Public *’* DESCRIPTION : Cancels the operation *’*********************************************************

Public Function CustomersAddED_Cancel_Click()

SyS.DBG.enterFunction "Customers_ADDED_Cancel_Click"

HOOFDSTUK 4. SIMS 0.2 32

Unload SyS.FRM.Customers_ADDED

SyS.DBG.leaveFunction "Customers_ADDED_Cancel_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : CustomersAddED_Add_Click *’* SCOPE : Public *’* DESCRIPTION : Adds the record *’*********************************************************

Public Function CustomersAddED_Add_Click()

SyS.DBG.enterFunction "CustomersAddED_Add_Click"

Dim Tobj As Object

If SyS.SysBuf.Cust_saveOK Then

SyS.DBS.Customer_PEEK (SyS.SysBuf.Cust_AddEdit_UIN)

With SyS.DbBuf.Customer

.Adress = frmCustomers_ADDED.txtStreetIf Not SyS.SysBuf.Cust_AddEdit = -1 Then .Date = Now.EMail = frmCustomers_ADDED.txtEmail.Fax = frmCustomers_ADDED.txtFax.City = frmCustomers_ADDED.txtCity.Customer_UIN = 0 ’??.Name = frmCustomers_ADDED.txtName.Postnumber = frmCustomers_ADDED.txtPCode.Phone = frmCustomers_ADDED.txtPhone.Surname = frmCustomers_ADDED.txtFirstName

End With

If SyS.SysBuf.Cust_AddEdit = -1 ThenSyS.DBS.Customer_POKEIf SyS.FRM.Customers_ADDED.chkCAdd.Value = 1 Then

CustomersAddED_Cancel_ClickElse

If SyS.FRM.Customers_ADDED.chkClAdd.Value = 1 ThenFor Each Tobj In SyS.FRM.Customers_ADDED

If TypeName(Tobj) = "TextBox" ThenTobj.Text = ""

End If

HOOFDSTUK 4. SIMS 0.2 33

Next TobjEnd If

End If

ElseSyS.DBS.Customer_EDIT (SyS.SysBuf.Cust_AddEdit_UIN)CustomersAddED_Cancel_Click

End If

Customers_fillList

Else

SyS.DBG.makeLogEntry "Badsave"

End IfSyS.DBG.leaveFunction "CustomersAddED_Add_Click"

End Function

HOOFDSTUK 4. SIMS 0.2 34

4.5 CustomersEV (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : CustomersEV.bas *’* OBJECT : CustomersEV *’* DESCRIPTION : Event handler for Sys.FRM.Customers *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_Load *’* SCOPE : Public *’* DESCRIPTION : Load sys.frm.Customers *’*********************************************************

Public Function Customers_Load()

SyS.DBG.enterFunction "Customers_Load"

SyS.FRM.Main.mnuCustomers.Checked = TrueSyS.FRM.Customers.Show 0SyS.Config.bShowCust = TrueSyS.FRM.Customers.LV.Left = PixelsToTwipsX(4)SyS.DBG.makeLogEntry "Ok marker"

SyS.iOBJ.Cust_SBar.Panels.Clear

HOOFDSTUK 4. SIMS 0.2 35

SyS.iOBJ.Cust_SBar.Panels.Add 1, "P1", "Recordcount : " & SyS.DBS.numCustomersSyS.iOBJ.Cust_SBar.Panels(1).Width = SyS.iOBJ.Cust_SBar.Panels(1).Width + 300SyS.iOBJ.Cust_SBar.Panels.Add 2, "P2", "Results found : (no search)"SyS.iOBJ.Cust_SBar.Panels(2).Width = SyS.iOBJ.Cust_SBar.Panels(2).Width + 800

Customers_setListdoUpdateCustomers_fillList

SyS.iOBJ.Cust_CBar.Bands.Add 1, "std", , , , frmCustomers.cbHolderSTDSyS.iOBJ.Cust_CBar.Bands.Add 2, "search", , , True, frmCustomers.cbHolderSRC

SyS.lOBJ.Customers = True

SyS.DBG.leaveFunction "Customers_Load"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_QUnload *’* SCOPE : Public *’* DESCRIPTION : UnLoad sys.frm.Customers *’*********************************************************

Public Function Customers_QUnload()

SyS.DBG.enterFunction "Customers_QUnload"

SyS.FRM.Main.mnuCustomers.Checked = FalseSyS.Config.bShowCust = False

SyS.lOBJ.Customers = False

SyS.DBG.leaveFunction "Customers_QUnload"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_Resize *’* SCOPE : Public *’* DESCRIPTION : Adjusts contents to size *’*********************************************************

Public Function Customers_Resize()

’ Explicit no debug entry (flood)

HOOFDSTUK 4. SIMS 0.2 36

STDW_CRF SyS.FRM.Customers, SyS.iOBJ.Cust_LV, SyS.iOBJ.Cust_CBar, _SyS.iOBJ.Cust_SBar

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_cBar_Resize *’* SCOPE : Public *’* DESCRIPTION : Adjust LV to cBar *’*********************************************************

Public Function Customers_cBar_Resize()

SyS.DBG.enterFunction "Customers_cBar_Resize"

STDW_CRF SyS.FRM.Customers, SyS.iOBJ.Cust_LV, SyS.iOBJ.Cust_CBar, _SyS.iOBJ.Cust_SBar

SyS.DBG.leaveFunction "Customers_cBar_Resize"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_cmdAdd_Click *’* SCOPE : Public *’* DESCRIPTION : Event Add record *’*********************************************************

Public Function Customers_cmdAdd_Click()

SyS.DBG.enterFunction "Customers_cmdAdd_Click"

SyS.FRM.Customers.cmdAdd.enabled = FalseSyS.SysBuf.Cust_AddEdit = -1 ’ New customerLoad SyS.FRM.Customers_ADDED

SyS.DBG.leaveFunction "Customers_cmdAdd_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_cmdDel_Click *’* SCOPE : Public *’* DESCRIPTION : Event delete record button *’*********************************************************

HOOFDSTUK 4. SIMS 0.2 37

Public Function Customers_cmdDel_Click()

SyS.DBG.enterFunction "Customers_cmdDel_Click"

Dim c As Integer

c = curSelLV(SyS.iOBJ.Cust_LV)SyS.DBG.makeLogEntry "DelNLV=" & cIf Not c = -1 Then SyS.DBS.Customer_DEL _(SyS.iOBJ.Cust_LV.ListItems(c).Tag)Customers_fillList

SyS.DBG.leaveFunction "Customers_cmdDel_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_cmdEdit_Click *’* SCOPE : Public *’* DESCRIPTION : Event to change record *’*********************************************************

Public Function Customers_cmdEdit_Click()

SyS.DBG.enterFunction "Customers_cmdEdit_Click"

If SyS.iOBJ.Cust_LV.ListItems.Count = 0 Then Exit Function

SyS.SysBuf.Cust_AddEdit = curSelLV(SyS.iOBJ.Cust_LV)SyS.SysBuf.Cust_AddEdit_UIN = SyS.iOBJ.Cust_LV.ListItems _(SyS.SysBuf.Cust_AddEdit).TagLoad SyS.FRM.Customers_ADDED

SyS.DBG.leaveFunction "Customers_cmdEdit_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_cmdSearch_Click *’* SCOPE : Public *’* DESCRIPTION : Quick search *’*********************************************************

Public Function Customers_cmdSearch_Click()

SyS.DBG.enterFunction "Customers_cmdSearch_Click"

HOOFDSTUK 4. SIMS 0.2 38

If SyS.FRM.Customers.chkInRes.Value = 0 Then Customers_fillList

Customers_QSearch (SyS.FRM.Customers.txtSearch.Text)

SyS.DBG.leaveFunction "Customers_cmdSearch_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_ShowAll_Click *’* SCOPE : Public *’* DESCRIPTION : Refreshes the list no search *’*********************************************************

Public Function Customers_ShowAll_Click()

SyS.DBG.enterFunction "Customers_ShowAll_Click"

Customers_fillList

SyS.DBG.leaveFunction "Customers_ShowAll_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : iOBJ_Cust_LV_Column_Click *’* SCOPE : Public *’* DESCRIPTION : Resorts the columns *’*********************************************************

Public Function iOBJ_Cust_LV_Column_Click(columnIndex As Integer)

SyS.DBG.enterFunction "iOBJ_Cust_LV_Column_Click"

SyS.iOBJ.Cust_LV.SortKey = columnIndex - 1SyS.iOBJ.Cust_LV.Sorted = True

SyS.DBG.leaveFunction "iOBJ_Cust_LV_Column_Click"

End Function

HOOFDSTUK 4. SIMS 0.2 39

4.6 CustomersF (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : CustomersF.bas *’* OBJECT : CustomersF *’* DESCRIPTION : Provides functions for frmCustomers *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_fillList *’* SCOPE : Public *’* DESCRIPTION : Fills the LV *’*********************************************************

Public Function Customers_fillList()

SyS.DBG.enterFunction "Customers_FillList"

Dim c As LongDim LV As ListViewSet LV = SyS.FRM.Customers.LV

LV.ListItems.Clear

For c = 1 To SyS.DBS.numCustomers

HOOFDSTUK 4. SIMS 0.2 40

SyS.DBS.clearBufSyS.DBS.Customer_PEEK , c’SyS.DBG.makeLogEntry "Got klant ’" & Str(c) & "’"

LV.ListItems.Add c, , SyS.DbBuf.Customer.Name ’ Primary itemLV.ListItems(c).Tag = SyS.DbBuf.Customer.Customer_UIN ’ Tuck away UIN

With LV.ListItems(c).SubItems(1) = SyS.DbBuf.Customer.Surname.SubItems(2) = SyS.DbBuf.Customer.Adress.SubItems(3) = SyS.DbBuf.Customer.City.SubItems(4) = SyS.DbBuf.Customer.Postnumber.SubItems(5) = SyS.DbBuf.Customer.Fax.SubItems(6) = SyS.DbBuf.Customer.Phone.SubItems(7) = SyS.DbBuf.Customer.EMail.SubItems(8) = SyS.DbBuf.Customer.Date

End With

Next c

SyS.iOBJ.Cust_SBar.Panels(1).Text = "Recordcount : " & SyS.DBS.numCustomersSyS.iOBJ.Cust_SBar.Panels(2).Text = "Results found : (no search)"

SyS.DBG.leaveFunction "Customers_FillList"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_setList *’* SCOPE : Public *’* DESCRIPTION : Sets the LV *’*********************************************************

Public Function Customers_setList()

SyS.DBG.enterFunction "Customers_setList"

Dim LV As ListViewSet LV = SyS.FRM.Customers.LV

LV.ListItems.ClearLV.ColumnHeaders.Clear

LV.View = 3

LV.ColumnHeaders.Add 1, "Naam", "Name"LV.ColumnHeaders.Add 2, "Voornaam", "First name"

HOOFDSTUK 4. SIMS 0.2 41

LV.ColumnHeaders.Add 3, "Adres", "Adress"LV.ColumnHeaders.Add 4, "Gemeente", "City"LV.ColumnHeaders.Add 5, "Postcode", "Postal number"LV.ColumnHeaders.Add 6, "Fax", "Fax"LV.ColumnHeaders.Add 7, "Telefoon", "Phone"LV.ColumnHeaders.Add 8, "Email", "Email"LV.ColumnHeaders.Add 9, "Datum klant", "Date added"

SyS.DBG.leaveFunction "Customers_setList"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customers_QSearch *’* SCOPE : Public *’* DESCRIPTION : Quicksearches the LV *’*********************************************************

Public Function Customers_QSearch(SearchTerm As String)

SyS.DBG.enterFunction "Custumors_QSearch"

Dim x As Long, y As LongDim doDel As Boolean

x = 1: doDel = True

SyS.DBG.makeLogEntry "QSearch : LC=" & SyS.iOBJ.Cust_LV.ListItems.Count

Do While x <= SyS.iOBJ.Cust_LV.ListItems.Count

If InStr(SyS.iOBJ.Cust_LV.ListItems(x).Text, SearchTerm) >= 1 _Then doDel = FalseFor y = 1 To 8

If InStr(SyS.iOBJ.Cust_LV.ListItems(x).SubItems(y), SearchTerm) _>= 1 Then doDel = False

Next y

If doDel = True Then SyS.iOBJ.Cust_LV.ListItems.Remove x

If doDel = False Thenx = x + 1doDel = True

End If

Loop

HOOFDSTUK 4. SIMS 0.2 42

SyS.iOBJ.Cust_SBar.Panels(2).Text = "Results found : " & _SyS.iOBJ.Cust_LV.ListItems.Count

SyS.DBG.leaveFunction "Custumors_QSearch"

End Function

HOOFDSTUK 4. SIMS 0.2 43

4.7 DBG CLASS (class)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : DBG_CLASS.cls *’* OBJECT : DBG_CLASS *’* DESCRIPTION : Provides debugging services *’* *’**********************************************************************************

’ Private variables

Private fn As Integer ’FilenumberPrivate filename As StringPrivate ns As Integer ’Number of spc() to printPrivate Const spacing As Integer = 5

’public variables

Public loadSucces As BooleanPublic enabled As Boolean

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Class_Initialize *’* SCOPE : Private *’* DESCRIPTION : CONSTRUCTOR *’*********************************************************

HOOFDSTUK 4. SIMS 0.2 44

Private Sub Class_Initialize()

On Error GoTo badInit

Dim T As String

fn = FreeFilens = 0

T = IIf(Right(App.Path, 1) = "\", "DEBUG ", "\DEBUG ")filename = App.Path & T & Format(Now, "yymmdd - HhNn ")

If Dir(filename & ".DBG") <> "" ThenDo

filename = filename & "X"Loop Until Dir(filename & ".DBG") = ""

End If

filename = filename & ".DBG"

Open filename For Output As fn

writeHeader

loadSucces = Trueenabled = True

Exit Sub

badInit:

loadSucces = False

End Sub

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : writeHeader *’* SCOPE : Private *’* DESCRIPTION : Writes file header *’*********************************************************

Private Function writeHeader()

Print #fn, "Sims 0.1 - DEBUG FILE"Print #fn, "=====================" & vbCrPrint #fn, "Logging started : " & Format(Now, "dddddd ttttt") & vbCr

HOOFDSTUK 4. SIMS 0.2 45

DoEvents

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Class_Terminate *’* SCOPE : Private *’* DESCRIPTION : DESTRUCTOR *’*********************************************************

Private Sub Class_Terminate()

Close fn

DoEvents

End Sub

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : enterFunction *’* SCOPE : Public *’* DESCRIPTION : Called when entering f() *’*********************************************************

Public Function enterFunction(fname As String)

If enabled = False Then Exit Function

Print #fn,writeTimePrint #fn, dFill(ns); "[[[ " & fname & " [[["ns = ns + spacing’Print #fn,DoEvents

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : writeTime *’* SCOPE : Private *’* DESCRIPTION : Called before logentry *’*********************************************************

Private Function writeTime()

If enabled = False Then Exit Function

HOOFDSTUK 4. SIMS 0.2 46

Print #fn, "(" & Format(Now, "HhNnSs") & ")" & vbTab;

DoEvents

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : leaveFunction *’* SCOPE : Public *’* DESCRIPTION : Called when leaving f() *’*********************************************************

Public Function leaveFunction(fname As String)

If enabled = False Then Exit Function

writeTimens = ns - spacingPrint #fn, dFill(ns); "]]] " & fname & " ]]]"Print #fn,

DoEvents

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : makeLogEntry *’* SCOPE : Public *’* DESCRIPTION : For debugging messages *’*********************************************************

Public Function makeLogEntry(message As String)

If enabled = False Then Exit Function

writeTimePrint #fn, dFill(ns); message

DoEvents

End Function

HOOFDSTUK 4. SIMS 0.2 47

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : dFill *’* SCOPE : Private *’* DESCRIPTION : For filling regions *’*********************************************************

Private Function dFill(n As Integer)

Dim c As Integer

For c = 1 To ndFill = dFill & "~"

Next c

End Function

HOOFDSTUK 4. SIMS 0.2 48

4.8 DBS CLASS (class)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : DBS_CLASS.cls *’* OBJECT : DBS_CLASS *’* DESCRIPTION : This class is a highlevel API for the Database *’* *’**********************************************************************************

’ Private variables

Private RCRDS As RCRDS_TPPrivate DB As Database

’ Public variables

Public loadSucces As Boolean

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : initDB *’* SCOPE : Private *’* DESCRIPTION : Inits LOCKED/STATUS’s *’*********************************************************

Private Function initDB()

HOOFDSTUK 4. SIMS 0.2 49

SyS.DBG.enterFunction "initDB"

’ NOTE: rewrite this function using an array of pointers,’ = nested 2x for to clear it all. ESTH +4

If Not RCRDS.Customers.RecordCount = 0 ThenRCRDS.Customers.MoveFirstDo Until RCRDS.Customers.EOF

RCRDS.Customers.EditRCRDS.Customers.Fields("LOCKED") = 0RCRDS.Customers.UpdateRCRDS.Customers.MoveNext

LoopEnd If

If Not RCRDS.Parts.RecordCount = 0 ThenRCRDS.Parts.MoveFirstDo Until RCRDS.Parts.EOF

RCRDS.Parts.EditRCRDS.Parts.Fields("LOCKED") = 0RCRDS.Parts.Fields("WQ") = RCRDS.Parts.Fields("Quantity") ’OMFGRCRDS.Parts.UpdateRCRDS.Parts.MoveNext

LoopEnd If

If Not RCRDS.Invoices.RecordCount = 0 ThenRCRDS.Invoices.MoveFirstDo Until RCRDS.Invoices.EOF

RCRDS.Invoices.EditRCRDS.Invoices.Fields("LOCKED") = 0RCRDS.Invoices.UpdateRCRDS.Invoices.MoveNext

LoopEnd If

If Not RCRDS.PART_IV.RecordCount = 0 ThenRCRDS.PART_IV.MoveFirstDo Until RCRDS.PART_IV.EOF

RCRDS.PART_IV.EditRCRDS.PART_IV.Fields("LOCKED") = 0RCRDS.PART_IV.UpdateRCRDS.PART_IV.MoveNext

LoopEnd If

If Not RCRDS.Part_Pc.RecordCount = 0 ThenRCRDS.Part_Pc.MoveFirstDo Until RCRDS.Part_Pc.EOF

HOOFDSTUK 4. SIMS 0.2 50

RCRDS.Part_Pc.EditRCRDS.Part_Pc.Fields("LOCKED") = 0RCRDS.Part_Pc.UpdateRCRDS.Part_Pc.MoveNext

LoopEnd If

If Not RCRDS.Part_type.RecordCount = 0 ThenRCRDS.Part_type.MoveFirstDo Until RCRDS.Part_type.EOF

RCRDS.Part_type.EditRCRDS.Part_type.Fields("LOCKED") = 0RCRDS.Part_type.UpdateRCRDS.Part_type.MoveNext

LoopEnd If

If Not RCRDS.Pc.RecordCount = 0 ThenRCRDS.Pc.MoveFirstDo Until RCRDS.Pc.EOF

RCRDS.Pc.EditRCRDS.Pc.Fields("LOCKED") = 0RCRDS.Pc.UpdateRCRDS.Pc.MoveNext

LoopEnd If

If Not RCRDS.PC_IV.RecordCount = 0 ThenRCRDS.PC_IV.MoveFirstDo Until RCRDS.PC_IV.EOF

RCRDS.PC_IV.EditRCRDS.PC_IV.Fields("LOCKED") = 0RCRDS.PC_IV.UpdateRCRDS.PC_IV.MoveNext

LoopEnd If

SyS.DBG.leaveFunction "initDB"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Class_Initialize *’* SCOPE : Private *’* DESCRIPTION : CONSTRUCTOR *’*********************************************************

Private Sub Class_Initialize()

HOOFDSTUK 4. SIMS 0.2 51

SyS.DBG.enterFunction "Class_Initialize (DBS)"

On Error GoTo loadError

Set DB = OpenDatabase(SyS.Config.dbaseFileName)Set RCRDS.Customers = DB.OpenRecordset("Customers")Set RCRDS.Part_Pc = DB.OpenRecordset("PART_PC")Set RCRDS.PART_IV = DB.OpenRecordset("PART_IV")Set RCRDS.Parts = DB.OpenRecordset("PART")Set RCRDS.Pc = DB.OpenRecordset("PC")Set RCRDS.PC_IV = DB.OpenRecordset("PC_IV")Set RCRDS.Part_type = DB.OpenRecordset("PART_TYPE")Set RCRDS.Invoices = DB.OpenRecordset("Invoice")

initDB ’ Reset Locked/Status

loadSucces = True

SyS.DBG.leaveFunction "Class_Initialize (DBS)"Exit Sub

loadError:

SyS.DBG.enterFunction "Class_Initialize (DBS)_loadError:"loadSucces = FalseSet DB = NothingSyS.DBG.makeLogEntry "Err:" & Err.Description & " (" & Err.Number & ")"SyS.DBG.leaveFunction "Class_Initialize (DBS)_loadError:"SyS.DBG.leaveFunction "Class_Initialize (DBS)>ERROR"

End Sub

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Class_Terminate *’* SCOPE : Private *’* DESCRIPTION : DESTRUCTOR *’*********************************************************

Private Sub Class_Terminate()

SyS.DBG.enterFunction "Class_Terminate (DBS)"

If loaded(DB) Then

With RCRDS.Customers.Close ’ FlushingSet .Customers = Nothing ’ Clearing pointer

HOOFDSTUK 4. SIMS 0.2 52

.Part_Pc.CloseSet .Part_Pc = Nothing.PART_IV.CloseSet .PART_IV = Nothing.Parts.CloseSet .Parts = Nothing.Pc.CloseSet .Pc = Nothing.PC_IV.CloseSet .PC_IV = Nothing.Part_type.CloseSet .Part_type = Nothing.Invoices.CloseSet .Invoices = Nothing

End With

End If

SyS.DBG.makeLogEntry "Nullified RCRDS"

If loaded(DB) Then DB.CloseSet DB = Nothing

SyS.DBG.makeLogEntry "Database completely closed"

SyS.DBG.leaveFunction "Class_Terminate (DBS)"

End Sub

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customer_POKE *’* SCOPE : Public *’* DESCRIPTION : Adds customer *’*********************************************************

Public Function Customer_POKE()

SyS.DBG.enterFunction "Customer_POKE"

On Error GoTo CustBadPoke

With SyS.DbBuf.CustomerRCRDS.Customers.AddNewRCRDS.Customers.Fields("Name") = IIf(.Name = "", "N/A", .Name)RCRDS.Customers.Fields("Surname") = IIf(.Surname = "", "N/A", .Surname)RCRDS.Customers.Fields("Adress") = IIf(.Adress = "", "N/A", .Adress)RCRDS.Customers.Fields("City") = IIf(.City = "", "N/A", .City)RCRDS.Customers.Fields("Postnumber") = _

HOOFDSTUK 4. SIMS 0.2 53

IIf(.Postnumber = "", "N/A", .Postnumber)RCRDS.Customers.Fields("Fax") = IIf(.Fax = "", "N/A", .Fax)RCRDS.Customers.Fields("Phone") = IIf(.Phone = "", "N/A", .Phone)RCRDS.Customers.Fields("Email") = IIf(.EMail = "", "N/A", .EMail)RCRDS.Customers.Fields("Date") = Now

SyS.DbBuf.Customer.Customer_UIN = RCRDS.Customers.Fields("Customers_UIN")RCRDS.Customers.UpdateEnd With

SyS.DBG.leaveFunction "Customer_POKE"Exit Function

CustBadPoke:

SyS.DBG.makeLogEntry "ERROR: CustBadPoke::" & Err.Number & "::" _& Err.DescriptionSyS.DBG.leaveFunction "Customer_POKE"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customer_EDIT *’* SCOPE : Public *’* DESCRIPTION : Changes cust field *’*********************************************************

Public Function Customer_EDIT(UIN As Long)

SyS.DBG.enterFunction "Customer_EDIT"

If goPOS(RCRDS.Customers, UIN) ThenRCRDS.Customers.EditWith SyS.DbBuf.Customer

RCRDS.Customers.Fields("Adress") = IIf(.Adress = "", "N/A", .Adress)RCRDS.Customers.Fields("City") = IIf(.City = "", "N/A", .City)RCRDS.Customers.Fields("EMail") = IIf(.EMail = "", "N/A", .EMail)RCRDS.Customers.Fields("Fax") = IIf(.Fax = "", "N/A", .Fax)RCRDS.Customers.Fields("Name") = IIf(.Name = "", "N/A", .Name)RCRDS.Customers.Fields("Phone") = IIf(.Phone = "", "N/A", .Phone)RCRDS.Customers.Fields("Postnumber") =_IIf(.Postnumber = "", "N/A", .Postnumber)RCRDS.Customers.Fields("Surname") = IIf(.Surname = "", "N/A", .Surname)

End WithRCRDS.Customers.Update

Else

HOOFDSTUK 4. SIMS 0.2 54

SyS.DBG.makeLogEntry "BAD EDIT -> goPos ret False"End If

SyS.DBG.leaveFunction "Customer_EDIT"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customer_DEL *’* SCOPE : Public *’* DESCRIPTION : Dels customer *’*********************************************************

Public Function Customer_DEL(UIN As Long)

SyS.DBG.enterFunction "Customer_DEL"

If goPOS(RCRDS.Customers, UIN) ThenIf RCRDS.Customers.Fields("LOCKED") = 0 Then

RCRDS.Customers.DeleteElse

SyS.DBG.makeLogEntry "Did not delete locked field : " & UINEnd If

End If

SyS.DBG.leaveFunction "Customer_DEL"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Customer_PEEK *’* SCOPE : Public *’* DESCRIPTION : Reads customer *’*********************************************************

Public Function Customer_PEEK(Optional UIN As Long = -1, _Optional ABSP As Long = -1) As Boolean

SyS.DBG.enterFunction "Customer_PEEK"

Customer_PEEK = True

If (UIN = -1 And ABSP = -1) Or (UIN <> -1 And ABSP <> -1) ThenCustomer_PEEK = FalseSyS.DBG.makeLogEntry "Internal Syntax error ;)"

End If

HOOFDSTUK 4. SIMS 0.2 55

If UIN <> -1 ThenIf Not goPOS(RCRDS.Customers, UIN) Then

Customer_PEEK = FalseEnd If

ElseIf Not goPOS(RCRDS.Customers, , ABSP) Then

Customer_PEEK = FalseEnd If

End If

If Customer_PEEK Then

With SyS.DbBuf.Customer

.Adress = RCRDS.Customers.Fields("Adress")

.City = RCRDS.Customers.Fields("City")

.Customer_UIN = RCRDS.Customers.Fields("Customers_UIN")

.Date = RCRDS.Customers.Fields("Date")

.EMail = RCRDS.Customers.Fields("EMail")

.Fax = RCRDS.Customers.Fields("Fax")

.Name = RCRDS.Customers.Fields("Name")

.Phone = RCRDS.Customers.Fields("Phone")

.Postnumber = RCRDS.Customers.Fields("Postnumber")

.Surname = RCRDS.Customers.Fields("Surname")

End With

Else

SyS.DBG.makeLogEntry "Failed to read (" & UIN & "," & ABSP & ")"

End If

SyS.DBG.leaveFunction "Customer_PEEK"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_PEEK *’* SCOPE : Public *’* DESCRIPTION : Reads part *’*********************************************************

Public Function Parts_PEEK(Optional UIN As Long = -1, _Optional ABSP As Long = -1) As Boolean

SyS.DBG.enterFunction "Parts_PEEK"

HOOFDSTUK 4. SIMS 0.2 56

Parts_PEEK = True

If (UIN = -1 And ABSP = -1) Or (UIN <> -1 And ABSP <> -1) ThenParts_PEEK = FalseSyS.DBG.makeLogEntry "Internal Syntax error ;)"

End If

If UIN <> -1 ThenIf Not goPOS(RCRDS.Parts, UIN) Then

Parts_PEEK = FalseEnd If

ElseIf Not goPOS(RCRDS.Parts, , ABSP) Then

Parts_PEEK = FalseEnd If

End If

If Parts_PEEK Then

With SyS.DbBuf.Parts

.Manufacturer = RCRDS.Parts.Fields("Manufacturer")

.Note = RCRDS.Parts.Fields("Note")

.PART_UIN = RCRDS.Parts.Fields("PART_UIN")

.PartName = RCRDS.Parts.Fields("Name")

.Price = RCRDS.Parts.Fields("Price")

.Stock = RCRDS.Parts.Fields("Quantity")

.TStock = RCRDS.Parts.Fields("WQ")

.TYPE_REF = IIf(IsNull(RCRDS.Parts.Fields("Type_REF")),_-1, RCRDS.Parts.Fields("Type_REF"))

End With

Else

SyS.DBG.makeLogEntry "Failed to read (" & UIN & "," & ABSP & ")"

End If

SyS.DBG.leaveFunction "Parts_PEEK"

End Function

HOOFDSTUK 4. SIMS 0.2 57

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_POKE *’* SCOPE : Public *’* DESCRIPTION : Addz part *’*********************************************************

Public Function Parts_POKE()

SyS.DBG.enterFunction "Parts_POKE"

On Error GoTo badPartsPoke

RCRDS.Parts.AddNewWith SyS.DbBuf.Parts

RCRDS.Parts.Fields("Manufacturer") =_IIf(.Manufacturer = "", "N/A", .Manufacturer)

RCRDS.Parts.Fields("Note") = IIf(.Note = "", "N/A", .Note)RCRDS.Parts.Fields("Name") = IIf(.PartName = "", "N/A", .PartName)RCRDS.Parts.Fields("Price") = IIf(.Price = "", "N/A", .Price)RCRDS.Parts.Fields("Quantity") = .StockRCRDS.Parts.Fields("WQ") = .Stock ’ Auto mode for nowRCRDS.Parts.Fields("Type_REF") = IIf(.TYPE_REF <= 0, -1, .TYPE_REF)RCRDS.Parts.Fields("LOCKED") = 0.PART_UIN = RCRDS.Parts.Fields("Part_UIN")

End WithRCRDS.Parts.Update

SyS.DBG.leaveFunction "Parts_POKE"Exit Function

badPartsPoke:

SyS.DBG.makeLogEntry "badPartsPoke::" & Err.Number & "::" & Err.DescriptionSyS.DBG.leaveFunction "Parts_POKE(ERR)"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_DEL *’* SCOPE : Public *’* DESCRIPTION : Deletes part *’*********************************************************

Public Function Parts_DEL(UIN As Long)

HOOFDSTUK 4. SIMS 0.2 58

SyS.DBG.enterFunction "Parts_DEL"

SyS.DBG.makeLogEntry "Request delete : " & UIN

If goPOS(RCRDS.Parts, UIN) ThenIf RCRDS.Parts.Fields("LOCKED") = 0 Then

RCRDS.Parts.DeleteEnd If

ElseSyS.DBG.makeLogEntry "Delete parts failed, (not found ?)"

End If

SyS.DBG.leaveFunction "Parts_DEL"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_EDIT *’* SCOPE : Public *’* DESCRIPTION : Edits part *’*********************************************************

Public Function Parts_EDIT(UIN As Long)

SyS.DBG.enterFunction "Parts_EDIT"

If goPOS(RCRDS.Parts, UIN) ThenSyS.DBG.makeLogEntry RCRDS.Parts.Fields("LOCKED")If RCRDS.Parts.Fields("LOCKED") = 0 Then

RCRDS.Parts.EditWith SyS.DbBuf.Parts

RCRDS.Parts.Fields("Type_REF") = .TYPE_REFRCRDS.Parts.Fields("Manufacturer") = .ManufacturerRCRDS.Parts.Fields("Name") = .PartNameRCRDS.Parts.Fields("Note") = .NoteRCRDS.Parts.Fields("Price") = .PriceRCRDS.Parts.Fields("WQ") = .TStockRCRDS.Parts.Fields("Quantity") = .Stock ’ Aaah sync

End WithRCRDS.Parts.Update

ElseSyS.DBG.makeLogEntry "Cant write to prtected field : " & Str(UIN)

End IfElse

SyS.DBG.makeLogEntry "Hm, not found : " & Str(UIN)

End If

HOOFDSTUK 4. SIMS 0.2 59

SyS.DBG.leaveFunction "Parts_EDIT"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_PEEK *’* SCOPE : Public *’* DESCRIPTION : Read PC *’*********************************************************

Public Function PC_PEEK(Optional UIN As Long = -1,_Optional ABSP As Long = -1) As Boolean

SyS.DBG.enterFunction "PC_PEEK"

PC_PEEK = True

If (UIN = -1 And ABSP = -1) Or (UIN <> -1 And ABSP <> -1) ThenPC_PEEK = FalseSyS.DBG.makeLogEntry "Internal Syntax error ;)"

End If

If UIN <> -1 ThenIf Not goPOS(RCRDS.Pc, UIN) Then

PC_PEEK = FalseEnd If

ElseIf Not goPOS(RCRDS.Pc, , ABSP) Then

PC_PEEK = FalseEnd If

End If

If PC_PEEK Then

With SyS.DbBuf.Pc

.Description = RCRDS.Pc.Fields("Description")

.PC_UIN = RCRDS.Pc.Fields("PC_UIN")

.Price = RCRDS.Pc.Fields("Price")

End With

Else

SyS.DBG.makeLogEntry "Failed to read (" & UIN & "," & ABSP & ")"

HOOFDSTUK 4. SIMS 0.2 60

End If

SyS.DBG.leaveFunction "PC_PEEK"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_POKE *’* SCOPE : Public *’* DESCRIPTION : Addz PC *’*********************************************************

Public Function PC_POKE()

SyS.DBG.enterFunction "PC_POKE"

On Error GoTo badPcPoke

RCRDS.Pc.AddNew

With SyS.DbBuf.PcRCRDS.Pc.Fields("Description") = .DescriptionRCRDS.Pc.Fields("Price") = .Price.PC_UIN = RCRDS.Pc.Fields("PC_UIN")

End WithRCRDS.Pc.Update

SyS.DBG.leaveFunction "PC_POKE"

Exit Function

badPcPoke:

SyS.DBG.makeLogEntry "BadpcPoke::" & Err.Number & "::" & Err.DescriptionSyS.DBG.leaveFunction "PC_POKE"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PART_PC_POKE *’* SCOPE : Public *’* DESCRIPTION : Links Pa2Pc *’*********************************************************

Public Function PART_PC_POKE()

SyS.DBG.enterFunction "PART_PC_POKE"

HOOFDSTUK 4. SIMS 0.2 61

On Error GoTo badpartpcpoke

RCRDS.Part_Pc.AddNewWith SyS.DbBuf.Part_Pc

RCRDS.Part_Pc.Fields("PART_REF") = .Part_REFRCRDS.Part_Pc.Fields("PC_REF") = .PC_REFRCRDS.Part_Pc.Fields("Quantity") = .QuantityRCRDS.Part_Pc.Fields("cPrice") = .cPrice.Part_PC_UIN = RCRDS.Part_Pc.Fields("PART_PC_UIN")

End WithRCRDS.Part_Pc.Update

SyS.DBG.leaveFunction "PART_PC_POKE"Exit Function

badpartpcpoke:

SyS.DBG.makeLogEntry "BadPartPcPoke::" & _Err.Number & "::" & Err.DescriptionSyS.DBG.leaveFunction "PART_PC_POKE"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PART_PC_PEEK *’* SCOPE : Public *’* DESCRIPTION : Reads link pa2pc *’*********************************************************

Public Function PART_PC_PEEK(Optional UIN As Long = -1,_Optional ABSP As Long = -1) As Boolean

SyS.DBG.enterFunction "PART_PC_PEEK"

PART_PC_PEEK = True

If (UIN = -1 And ABSP = -1) Or (UIN <> -1 And ABSP <> -1) ThenPART_PC_PEEK = FalseSyS.DBG.makeLogEntry "Internal Syntax error ;)"

End If

If UIN <> -1 ThenIf Not goPOS(RCRDS.Part_Pc, UIN) Then

PART_PC_PEEK = FalseEnd If

ElseIf Not goPOS(RCRDS.Part_Pc, , ABSP) Then

HOOFDSTUK 4. SIMS 0.2 62

PART_PC_PEEK = FalseEnd If

End If

If PART_PC_PEEK Then

With SyS.DbBuf.Part_Pc.cPrice = RCRDS.Part_Pc.Fields("cPrice").Part_PC_UIN = RCRDS.Part_Pc.Fields("PART_PC_UIN").Part_REF = RCRDS.Part_Pc.Fields("Part_REF").PC_REF = RCRDS.Part_Pc.Fields("PC_REF").Quantity = RCRDS.Part_Pc.Fields("Quantity")

End With

ElseSyS.DBG.makeLogEntry "Failed to read (" & UIN & "," & ABSP & ")"

End If

SyS.DBG.leaveFunction "PART_PC_PEEK"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PART_PC_DEL *’* SCOPE : Public *’* DESCRIPTION : Dels Part_PC *’*********************************************************

Public Function PART_PC_DEL(UIN As Long) ’ Useless ?

SyS.DBG.enterFunction "PART_PC_DEL"

If Not goPOS(RCRDS.Part_Pc, UIN) ThenSyS.DBG.makeLogEntry "Request delete :: " & Str(UIN)_& ":: fail: not found: FIXME"

ElseIf RCRDS.Part_Pc.Fields("LOCKED") = 0 Then

RCRDS.Part_Pc.DeleteElse

SyS.DBG.makeLogEntry "Cannot del locked field"End If

End If

SyS.DBG.leaveFunction "PART_PC_DEL"

End Function

HOOFDSTUK 4. SIMS 0.2 63

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PART_PC_CLEARREF *’* SCOPE : Public *’* DESCRIPTION : Clears refs 2 pc *’*********************************************************

Public Function PART_PC_CLEARREF(pcUIN As Long)

SyS.DBG.enterFunction "PART_PC_CLEARREF"

If RCRDS.Part_Pc.RecordCount = 0 Then Exit Function

RCRDS.Part_Pc.MoveFirst

Do Until RCRDS.Part_Pc.EOFIf RCRDS.Part_Pc.Fields("PC_REF") = pcUIN Then

RCRDS.Part_Pc.DeleteIf RCRDS.Part_Pc.RecordCount = 0 Then

SyS.DBG.leaveFunction "PART_PC_CLEARREF"Exit Function

End IfRCRDS.Part_Pc.MoveFirst

ElseRCRDS.Part_Pc.MoveNext

End IfLoop

SyS.DBG.leaveFunction "PART_PC_CLEARREF"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : goPOS *’* SCOPE : Public *’* DESCRIPTION : Recordset mover ;) *’*********************************************************

Private Function goPOS(x As Recordset, Optional UIN As Long = _-1, Optional ABSP As Long = -1) As Boolean

SyS.DBG.enterFunction "goPOS"

On Error GoTo DBS_badGoPos

Dim c As Long

If x.RecordCount <= 0 Then

HOOFDSTUK 4. SIMS 0.2 64

SyS.DBG.leaveFunction "goPOS/empty"goPOS = FalseExit Function

End If

If UIN <> -1 Thenx.MoveFirst

Do Until (x.EOF) = TrueIf x.Fields(0) = UIN Then ’ WARNING :: UIN __ALWAYS__ on first POS !!!

’ If not u fall in a bucket of pain ;)Exit Do

End Ifx.MoveNext

Loop

goPOS = Not x.EOFElse

If ABSP > x.RecordCount Then ’ ABSP uses C style countinggoPOS = False

Elsex.MoveFirstSyS.DBG.makeLogEntry "Req=" & ABSPDo Until c = ABSP - 1

x.MoveNextc = c + 1SyS.DBG.makeLogEntry "EDBG//*->ABSP_LOOP(" & c & ")"

LoopgoPOS = True

End IfEnd If

SyS.DBG.leaveFunction "goPOS"Exit Function

DBS_badGoPos:

SyS.DBG.makeLogEntry "ERR::badGoPos::" & Err.Number & "::" & Err.DescriptionSyS.DBG.leaveFunction "goPOS"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : clearBuf *’* SCOPE : Public *’* DESCRIPTION : Clears SyS.DbBuf *’*********************************************************

HOOFDSTUK 4. SIMS 0.2 65

Public Function clearBuf()

Dim TMP As DBS_BUF_TPSyS.DbBuf = TMP ’ XOR SyS.DBBuf,SyS.DBBuf :)

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : makeNewDBase *’* SCOPE : Public *’* DESCRIPTION : Creates new CoreDB *’*********************************************************

Public Function makeNewDBase(fname As String) As Boolean

SyS.DBG.enterFunction "makeNewDBase"

On Error GoTo baddbcreate

Dim nDB As Database

Dim T_Customers As TableDefDim I_Customers As IndexDim F_Customers_UIN As FieldDim F_Cust_Name As FieldDim F_Cust_Surname As FieldDim F_Cust_Adress As FieldDim F_Cust_City As FieldDim F_Cust_PostNumber As FieldDim F_Cust_Fax As FieldDim F_Cust_Phone As FieldDim F_Cust_Email As FieldDim F_Cust_Date As FieldDim F_Cust_LOCKED As FieldDim F_Cust_STATUS As Field

Dim T_PART_PC As TableDefDim I_PART_PC As IndexDim F_PART_PC_UIN As FieldDim F_PPC_PART_REF As FieldDim F_PPC_PC_REF As FieldDim F_PPC_Quantity As FieldDim F_PPC_cPrice As FieldDim F_PPC_LOCKED As FieldDim F_PPC_STATUS As Field

Dim T_PART_IV As TableDef

HOOFDSTUK 4. SIMS 0.2 66

Dim I_PART_IV As IndexDim F_PART_IV_UIN As FieldDim F_PIV_PART_REF As FieldDim F_PIV_Invoice_REF As FieldDim F_PIV_Quantity As FieldDim F_PIV_cPrice As FieldDim F_PIV_LOCKED As FieldDim F_PIV_STATUS As Field

Dim T_PART As TableDefDim I_PART As IndexDim F_PART_UIN As FieldDim F_PART_Type_REF As FieldDim F_PART_Manufacturer As FieldDim F_PART_Name As FieldDim F_PART_Note As FieldDim F_PART_Price As FieldDim F_PART_Quantity As FieldDim F_PART_TQuant As FieldDim F_PART_LOCKED As FieldDim F_PART_STATUS As Field

Dim T_PC As TableDefDim I_PC As IndexDim F_PC_UIN As FieldDim F_PC_Description As FieldDim F_PC_Price As FieldDim F_PC_LOCKED As FieldDim F_PC_STATUS As Field

Dim T_PC_IV As TableDefDim I_PC_IV As IndexDim F_PC_IV_UIN As FieldDim F_PCIV_PC_REF As FieldDim F_PCIV_Invoice_REF As FieldDim F_PCIV_LOCKED As FieldDim F_PCIV_STATUS As Field

Dim T_PART_TYPE As TableDefDim I_PART_TYPE As IndexDim F_PT_Type_UIN As FieldDim F_PT_Name As FieldDim F_PT_LOCKED As FieldDim F_PT_STATUS As Field

Dim T_Invoice As TableDefDim I_Invoice As IndexDim F_INV_Invoice_UIN As FieldDim F_INV_Cust_REF As Field

HOOFDSTUK 4. SIMS 0.2 67

Dim F_INV_Date As FieldDim F_INV_TPrice As FieldDim F_INV_Reduc As FieldDim F_INV_LOCKED As FieldDim F_INV_STATUS As Field

Set nDB = DBEngine.CreateDatabase(fname, dbLangGeneral)

Set T_Customers = nDB.CreateTableDef("Customers")Set F_Customers_UIN = T_Customers.CreateField("Customers_UIN", dbLong)F_Customers_UIN.Attributes = dbAutoIncrFieldT_Customers.Fields.Append F_Customers_UINSet F_Cust_Name = T_Customers.CreateField("Name", dbText)T_Customers.Fields.Append F_Cust_NameSet F_Cust_Surname = T_Customers.CreateField("Surname", dbText)T_Customers.Fields.Append F_Cust_SurnameSet F_Cust_Adress = T_Customers.CreateField("Adress", dbText)T_Customers.Fields.Append F_Cust_AdressSet F_Cust_City = T_Customers.CreateField("City", dbText)T_Customers.Fields.Append F_Cust_CitySet F_Cust_PostNumber = T_Customers.CreateField("Postnumber", dbText)T_Customers.Fields.Append F_Cust_PostNumberSet F_Cust_Fax = T_Customers.CreateField("Fax", dbText)T_Customers.Fields.Append F_Cust_FaxSet F_Cust_Phone = T_Customers.CreateField("Phone", dbText)T_Customers.Fields.Append F_Cust_PhoneSet F_Cust_Email = T_Customers.CreateField("Email", dbText)T_Customers.Fields.Append F_Cust_EmailSet F_Cust_Date = T_Customers.CreateField("Date", dbDate)T_Customers.Fields.Append F_Cust_DateSet F_Cust_STATUS = T_Customers.CreateField("STATUS", dbLong)T_Customers.Fields.Append F_Cust_STATUSSet F_Cust_LOCKED = T_Customers.CreateField("LOCKED", dbLong)T_Customers.Fields.Append F_Cust_LOCKED

Set I_Customers = T_Customers.CreateIndexI_Customers.Name = "PrimaryKey"I_Customers.Primary = TrueI_Customers.Unique = TrueSet F_Customers_UIN = I_Customers.CreateField("Customers_UIN")I_Customers.Fields.Append F_Customers_UINT_Customers.Indexes.Append I_Customers

nDB.TableDefs.Append T_Customers

Set T_PART_PC = nDB.CreateTableDef("PART_PC")Set F_PART_PC_UIN = T_PART_PC.CreateField("PART_PC_UIN", dbLong)

F_PART_PC_UIN.Attributes = dbAutoIncrFieldT_PART_PC.Fields.Append F_PART_PC_UINSet F_PPC_PART_REF = T_PART_PC.CreateField("PART_REF", dbLong)

HOOFDSTUK 4. SIMS 0.2 68

T_PART_PC.Fields.Append F_PPC_PART_REFSet F_PPC_PC_REF = T_PART_PC.CreateField("PC_REF", dbLong)T_PART_PC.Fields.Append F_PPC_PC_REFSet F_PPC_Quantity = T_PART_PC.CreateField("Quantity", dbLong)T_PART_PC.Fields.Append F_PPC_QuantitySet F_PPC_cPrice = T_PART_PC.CreateField("cPrice", dbText)T_PART_PC.Fields.Append F_PPC_cPriceSet F_PPC_STATUS = T_PART_PC.CreateField("STATUS", dbLong)T_PART_PC.Fields.Append F_PPC_STATUSSet F_PPC_LOCKED = T_PART_PC.CreateField("LOCKED", dbLong)T_PART_PC.Fields.Append F_PPC_LOCKED

Set I_PART_PC = T_PART_PC.CreateIndexI_PART_PC.Name = "PrimaryKey"I_PART_PC.Primary = TrueI_PART_PC.Unique = TrueSet F_PART_PC_UIN = I_PART_PC.CreateField("PART_PC_UIN")I_PART_PC.Fields.Append F_PART_PC_UINT_PART_PC.Indexes.Append I_PART_PC

nDB.TableDefs.Append T_PART_PC

Set T_PART_IV = nDB.CreateTableDef("PART_IV")Set F_PART_IV_UIN = T_PART_IV.CreateField("PART_IV_UIN", dbLong)

F_PART_IV_UIN.Attributes = dbAutoIncrFieldT_PART_IV.Fields.Append F_PART_IV_UINSet F_PIV_PART_REF = T_PART_IV.CreateField("PART_REF", dbLong)T_PART_IV.Fields.Append F_PIV_PART_REFSet F_PIV_Invoice_REF = T_PART_IV.CreateField("Invoice_REF", dbLong)T_PART_IV.Fields.Append F_PIV_Invoice_REFSet F_PIV_Quantity = T_PART_IV.CreateField("Quantity", dbLong)T_PART_IV.Fields.Append F_PIV_QuantitySet F_PIV_cPrice = T_PART_IV.CreateField("cPrice", dbText)T_PART_IV.Fields.Append F_PIV_cPriceSet F_PIV_STATUS = T_PART_IV.CreateField("STATUS", dbLong)T_PART_IV.Fields.Append F_PIV_STATUSSet F_PIV_LOCKED = T_PART_IV.CreateField("LOCKED", dbLong)T_PART_IV.Fields.Append F_PIV_LOCKED

Set I_PART_IV = T_PART_IV.CreateIndexI_PART_IV.Name = "PrimaryKey"I_PART_IV.Primary = TrueI_PART_IV.Unique = TrueSet F_PART_IV_UIN = I_PART_IV.CreateField("PART_IV_UIN")I_PART_IV.Fields.Append F_PART_IV_UINT_PART_IV.Indexes.Append I_PART_IV

nDB.TableDefs.Append T_PART_IV

Set T_PART = nDB.CreateTableDef("PART")Set F_PART_UIN = T_PART.CreateField("PART_UIN", dbLong)

HOOFDSTUK 4. SIMS 0.2 69

F_PART_UIN.Attributes = dbAutoIncrFieldT_PART.Fields.Append F_PART_UINSet F_PART_Type_REF = T_PART.CreateField("Type_REF", dbLong)T_PART.Fields.Append F_PART_Type_REFSet F_PART_Manufacturer = T_PART.CreateField("Manufacturer", dbText)T_PART.Fields.Append F_PART_ManufacturerSet F_PART_Name = T_PART.CreateField("Name", dbText)T_PART.Fields.Append F_PART_NameSet F_PART_Note = T_PART.CreateField("Note", dbText)T_PART.Fields.Append F_PART_NoteSet F_PART_Price = T_PART.CreateField("Price", dbText)T_PART.Fields.Append F_PART_PriceSet F_PART_Quantity = T_PART.CreateField("Quantity", dbLong)T_PART.Fields.Append F_PART_QuantitySet F_PART_TQuant = T_PART.CreateField("WQ", dbLong)T_PART.Fields.Append F_PART_TQuantSet F_PART_LOCKED = T_PART.CreateField("LOCKED", dbLong)T_PART.Fields.Append F_PART_LOCKEDSet F_PART_STATUS = T_PART.CreateField("STATUS", dbLong)T_PART.Fields.Append F_PART_STATUS

Set I_PART = T_PART.CreateIndexI_PART.Name = "PrimaryKey"I_PART.Primary = TrueI_PART.Unique = TrueSet F_PART_UIN = I_PART.CreateField("PART_UIN")I_PART.Fields.Append F_PART_UINT_PART.Indexes.Append I_PART

nDB.TableDefs.Append T_PART

Set T_PC = nDB.CreateTableDef("PC")Set F_PC_UIN = T_PC.CreateField("PC_UIN", dbLong)F_PC_UIN.Attributes = dbAutoIncrFieldT_PC.Fields.Append F_PC_UINSet F_PC_Description = T_PC.CreateField("Description", dbMemo)T_PC.Fields.Append F_PC_DescriptionSet F_PC_Price = T_PC.CreateField("Price", dbText)T_PC.Fields.Append F_PC_PriceSet F_PC_LOCKED = T_PC.CreateField("LOCKED", dbLong)T_PC.Fields.Append F_PC_LOCKEDSet F_PC_STATUS = T_PC.CreateField("STATUS", dbLong)T_PC.Fields.Append F_PC_STATUS

Set I_PC = T_PC.CreateIndexI_PC.Name = "PrimaryKey"I_PC.Primary = TrueI_PC.Unique = TrueSet F_PC_UIN = I_PC.CreateField("PC_UIN")I_PC.Fields.Append F_PC_UIN

HOOFDSTUK 4. SIMS 0.2 70

T_PC.Indexes.Append I_PCnDB.TableDefs.Append T_PC

Set T_PC_IV = nDB.CreateTableDef("PC_IV")Set F_PC_IV_UIN = T_PC_IV.CreateField("PC_IV_UIN", dbLong)F_PC_IV_UIN.Attributes = dbAutoIncrFieldT_PC_IV.Fields.Append F_PC_IV_UINSet F_PCIV_PC_REF = T_PC_IV.CreateField("PC_REF", dbLong)T_PC_IV.Fields.Append F_PCIV_PC_REFSet F_PCIV_Invoice_REF = T_PC_IV.CreateField("Invoice_REF", dbLong)T_PC_IV.Fields.Append F_PCIV_Invoice_REFSet F_PCIV_LOCKED = T_PC_IV.CreateField("LOCKED", dbLong)T_PC_IV.Fields.Append F_PCIV_LOCKEDSet F_PCIV_STATUS = T_PC_IV.CreateField("STATUS", dbLong)T_PC_IV.Fields.Append F_PCIV_STATUS

Set I_PC_IV = T_PC_IV.CreateIndexI_PC_IV.Name = "PrimaryKey"I_PC_IV.Primary = TrueI_PC_IV.Unique = TrueSet F_PC_IV_UIN = I_PC_IV.CreateField("PC_IV_UIN")I_PC_IV.Fields.Append F_PC_IV_UINT_PC_IV.Indexes.Append I_PC_IV

nDB.TableDefs.Append T_PC_IV

Set T_PART_TYPE = nDB.CreateTableDef("PART_TYPE")Set F_PT_Type_UIN = T_PART_TYPE.CreateField("PART_Type_UIN", dbLong)F_PT_Type_UIN.Attributes = dbAutoIncrFieldT_PART_TYPE.Fields.Append F_PT_Type_UINSet F_PT_Name = T_PART_TYPE.CreateField("Name", dbText)T_PART_TYPE.Fields.Append F_PT_NameSet F_PT_LOCKED = T_PART_TYPE.CreateField("LOCKED", dbLong)T_PART_TYPE.Fields.Append F_PT_LOCKEDSet F_PT_STATUS = T_PART_TYPE.CreateField("STATUS", dbLong)T_PART_TYPE.Fields.Append F_PT_STATUS

Set I_PART_TYPE = T_PART_TYPE.CreateIndexI_PART_TYPE.Name = "PrimaryKey"I_PART_TYPE.Primary = TrueI_PART_TYPE.Unique = TrueSet F_PT_Type_UIN = I_PART_TYPE.CreateField("PART_Type_UIN")I_PART_TYPE.Fields.Append F_PT_Type_UINT_PART_TYPE.Indexes.Append I_PART_TYPE

nDB.TableDefs.Append T_PART_TYPE

Set T_Invoice = nDB.CreateTableDef("Invoice")Set F_INV_Invoice_UIN = T_Invoice.CreateField("Invoice_UIN", dbLong)F_INV_Invoice_UIN.Attributes = dbAutoIncrFieldT_Invoice.Fields.Append F_INV_Invoice_UIN

HOOFDSTUK 4. SIMS 0.2 71

Set F_INV_Cust_REF = T_Invoice.CreateField("Cust_REF", dbLong)T_Invoice.Fields.Append F_INV_Cust_REFSet F_INV_Date = T_Invoice.CreateField("Date", dbText)T_Invoice.Fields.Append F_INV_DateSet F_INV_TPrice = T_Invoice.CreateField("TPrice", dbText)T_Invoice.Fields.Append F_INV_TPriceSet F_INV_Reduc = T_Invoice.CreateField("Reduc", dbText)T_Invoice.Fields.Append F_INV_ReducSet F_INV_LOCKED = T_Invoice.CreateField("LOCKED", dbLong)T_Invoice.Fields.Append F_INV_LOCKEDSet F_INV_STATUS = T_Invoice.CreateField("STATUS", dbLong)T_Invoice.Fields.Append F_INV_STATUS

Set I_Invoice = T_Invoice.CreateIndexI_Invoice.Name = "PrimaryKey"I_Invoice.Primary = TrueI_Invoice.Unique = TrueSet F_INV_Invoice_UIN = I_Invoice.CreateField("Invoice_UIN")I_Invoice.Fields.Append F_INV_Invoice_UINT_Invoice.Indexes.Append I_Invoice

nDB.TableDefs.Append T_Invoice

makeNewDBase = True

SyS.DBG.leaveFunction "makeNewDBase"

Exit Function

baddbcreate:

SyS.DBG.enterFunction "makeNewDBase: ERROR:"

makeNewDBase = FalseSyS.DBG.makeLogEntry Err.Description

SyS.DBG.leaveFunction "makeNewDBase: ERROR:"SyS.DBG.leaveFunction "makeNewDBase"

Exit Function

End Function

Public Function numCustomers() As Long

numCustomers = RCRDS.Customers.RecordCount

End Function

Public Function numParts() As Long

HOOFDSTUK 4. SIMS 0.2 72

numParts = RCRDS.Parts.RecordCount

End Function

Public Function numPCs() As Long

numPCs = RCRDS.Pc.RecordCount

End Function

Public Function numInvoices() As Long

numInvoices = RCRDS.Invoices.RecordCount

End Function

Public Function numPC_IV() As Long

numPC_IV = RCRDS.PC_IV.RecordCount

End Function

Public Function numPart_pc() As Long

numPart_pc = RCRDS.Part_Pc.RecordCount

End Function

Public Function numPartType() As Long

numPartType = RCRDS.Part_type.RecordCount

End Function

Public Function numPart_IV() As Long

numPart_IV = RCRDS.PART_IV.RecordCount

End Function

HOOFDSTUK 4. SIMS 0.2 73

4.9 FLIB DBG (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : FLIB_DBG.bas *’* OBJECT : FLIB_DBG *’* DESCRIPTION : Common function library w/ debugging *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : doUpdate *’* SCOPE : Public *’* DESCRIPTION : Processes background events *’*********************************************************

Public Function doUpdate(Optional T As Integer = 100)

SyS.DBG.enterFunction "doUpdate"

Dim c As Integer

For c = 1 To TDoEvents

Next c

SyS.DBG.leaveFunction "doUpdate"

HOOFDSTUK 4. SIMS 0.2 74

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : curSelLV *’* SCOPE : Public *’* DESCRIPTION : Returns the first sel obj LV *’*********************************************************

Public Function curSelLV(LV As ListView) As Long

SyS.DBG.enterFunction "curSelLV"

Dim c As Long

For c = 1 To LV.ListItems.Count

If LV.ListItems(c).Selected ThencurSelLV = cSyS.DBG.leaveFunction "cueSelLV"Exit Function

End If

Next c

curSelLV = -1

SyS.DBG.leaveFunction "cueSelLV"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : SEDT_ASM *’* SCOPE : Public *’* DESCRIPTION : Assembles UIN and Type *’*********************************************************

Public Function SEDT_ASM(UIN As Long, dtype As String) As String

SyS.DBG.enterFunction "SEDT_ASM"

Do Until Len(dtype) >= 2dtype = dtype & " "

Loop

SEDT_ASM = Left(dtype, 2) & Str(UIN)

HOOFDSTUK 4. SIMS 0.2 75

SyS.DBG.leaveFunction "SEDT_ASM"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : SEDT_UIN *’* SCOPE : Public *’* DESCRIPTION : Extracts UIN from ASM *’*********************************************************

Public Function SEDT_UIN(ASM As String) As Long

SyS.DBG.enterFunction "SEDT_UIN"

SEDT_UIN = CLng(Right(ASM, Len(ASM) - 2))

SyS.DBG.leaveFunction "SEDT_UIN"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : SEDT_DTYPE *’* SCOPE : Public *’* DESCRIPTION : Extracts DType from ASM *’*********************************************************

Public Function SEDT_DTYPE(ASM As String) As String

SyS.DBG.enterFunction "SEDT_DTYPE"

SEDT_DTYPE = Left(ASM, 2)

SyS.DBG.leaveFunction "SEDT_DTYPE"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : DD_goodType *’* SCOPE : Public *’* DESCRIPTION : Checks for Syntax on ASM *’*********************************************************

Public Function DD_goodType(D As MSComctlLib.DataObject)

SyS.DBG.enterFunction "DD_goodType"

HOOFDSTUK 4. SIMS 0.2 76

DD_goodType = D.GetFormat(1)’Add check s/format Sims s

SyS.DBG.leaveFunction "DD_goodType"

End Function

HOOFDSTUK 4. SIMS 0.2 77

4.10 FLIB NDBG (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : FLIB_NDBG.bas *’* OBJECT : FLIB_NDBG *’* DESCRIPTION : Common Function Library w/o debugging *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : loaded *’* SCOPE : Public *’* DESCRIPTION : Checks if an object is set *’*********************************************************

Public Function loaded(x As Object) As Boolean

On Error GoTo E91 ’ Run to hell :(

Dim T As String

T = x.Name

loaded = True

Exit Function

HOOFDSTUK 4. SIMS 0.2 78

E91:

If Err.Number = 91 Then loaded = False Else loaded = True

Exit Function

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : TwipsToPixelsX *’* SCOPE : Public *’* DESCRIPTION : T->P(X) *’*********************************************************

Public Function TwipsToPixelsX(Twips As Long) As Long

TwipsToPixelsX = Twips / Screen.TwipsPerPixelX

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PixelsToTwipsX *’* SCOPE : Public *’* DESCRIPTION : P->T(X) *’*********************************************************

Public Function PixelsToTwipsX(Pixels As Long) As Long

PixelsToTwipsX = Pixels * Screen.TwipsPerPixelX

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : TwipsToPixelsY *’* SCOPE : Public *’* DESCRIPTION : T->P(Y) *’*********************************************************

Public Function TwipsToPixelsY(Twips As Long) As Long

TwipsToPixelsY = Twips / Screen.TwipsPerPixelY

End Function

HOOFDSTUK 4. SIMS 0.2 79

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PixelsToTwipsY *’* SCOPE : Public *’* DESCRIPTION : P->T(Y) *’*********************************************************

Public Function PixelsToTwipsY(Pixels As Long) As Long

PixelsToTwipsY = Pixels * Screen.TwipsPerPixelY

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : STDW_CRF *’* SCOPE : Public *’* DESCRIPTION : Common Resize Function *’*********************************************************

Public Function STDW_CRF(F As Form, LV As ListView, _CB As CoolBar, SB As StatusBar)

If F.WindowState = vbMinimized Then Exit Function

LV.Top = CB.Top + CB.Height

If F.Width < 3000 Then F.Width = 3000If F.Height < 3000 Then F.Height = 3000

LV.Width = F.Width - PixelsToTwipsX(15)LV.Height = F.Height - (SB.Height + LV.Top + 400)CB.Width = F.Width - PixelsToTwipsX(15)

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : TLVW_CRF *’* SCOPE : Public *’* DESCRIPTION : Resizes STDW w/ 2 LV’s *’*********************************************************

Public Function TLVW_CRF(F As Form, LV1 As ListView, LV2 As ListView, _CB As CoolBar, SB As StatusBar, P As Integer)

Dim T As Long

HOOFDSTUK 4. SIMS 0.2 80

If F.WindowState = vbMinimized Then Exit Function

T = F.Height - (CB.Top + CB.Height + SB.Height + 30)’ Total space for 2 LV’s

If F.Width < 3000 ThenF.Width = 3000Exit Function

End IfIf F.Height < 3000 Then

F.Height = 3000Exit Function

End If

LV1.Top = CB.Top + CB.HeightLV1.Height = (T / 100) * PLV1.Width = F.Width - PixelsToTwipsX(15)LV1.Left = PixelsToTwipsX(4)

LV2.Top = LV1.Top + LV1.Height + PixelsToTwipsY(5)LV2.Width = LV1.WidthLV2.Height = T - LV1.Height - CB.Height ’ Sort of beauty errorLV2.Left = PixelsToTwipsX(4)

CB.Width = F.Width - PixelsToTwipsX(15)

End Function

HOOFDSTUK 4. SIMS 0.2 81

4.11 frmCustomers (formcode)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmCustomers.frm *’* OBJECT : frmCustomers *’* DESCRIPTION : Customerlist :: MDI child *’* *’**********************************************************************************

Private Sub Form_Load()

Customers_Load

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Customers_QUnload

End Sub

Private Sub Form_Resize()

Customers_Resize

End Sub

HOOFDSTUK 4. SIMS 0.2 82

Private Sub cBar_HeightChanged(ByVal NewHeight As Single)

Customers_cBar_Resize

End Sub

Private Sub cmdAdd_Click()

Customers_cmdAdd_Click

End Sub

Private Sub cmdDel_Click()

Customers_cmdDel_Click

End Sub

Private Sub cmdEdit_Click()

Customers_cmdEdit_Click

End Sub

Private Sub cmdSearch_Click()

Customers_cmdSearch_Click

End Sub

Private Sub cmdShowAll_Click()

Customers_ShowAll_Click

End Sub

Private Sub LV_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)

iOBJ_Cust_LV_Column_Click (ColumnHeader.Index)

End Sub

HOOFDSTUK 4. SIMS 0.2 83

4.12 frmCustomersADDED (formcode)

Option Explicit’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmCustomers_ADDED.frm *’* OBJECT : frmCustomers_ADDED *’* DESCRIPTION : LForm to add customer (put/exist) *’* *’**********************************************************************************

Private Sub cmdAdd_Click()

CustomersAddED_Add_Click

End Sub

Private Sub Form_Load()

CustomersADDED_Load

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

CustomersADDED_QUnload

End Sub

Private Sub cmdCancel_Click()

HOOFDSTUK 4. SIMS 0.2 84

CustomersAddED_Cancel_Click

End Sub

HOOFDSTUK 4. SIMS 0.2 85

4.13 frmInvoices (formcode)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmInvoices.frm *’* OBJECT : frmInvoices *’* DESCRIPTION : Invoice list :: MDI child *’* *’**********************************************************************************

Private Sub Form_Load()

Invoice_Load

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Invoice_QUnload

End Sub

HOOFDSTUK 4. SIMS 0.2 86

4.14 frmMain (formcode)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmMain.frm *’* OBJECT : frmMain *’* DESCRIPTION : Main form :: MDI parent *’* *’**********************************************************************************

Private Sub MDIForm_Load()

Main_Load

End Sub

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Main_QUnload

End Sub

Private Sub mnuCustomers_Click()

Main_mnuCustomers_Click

End Sub

HOOFDSTUK 4. SIMS 0.2 87

Private Sub mnuInvoices_Click()

Main_mnuInvoices_Click

End Sub

Private Sub mnuParts_Click()

Main_mnuParts_Click

End Sub

Private Sub mnuPC_Click()

Main_mnuPC_Click

End Sub

Private Sub mnuQuit_Click()

Main_mnuQuit_Click

End Sub

HOOFDSTUK 4. SIMS 0.2 88

4.15 frmParts (formcode)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmParts.frm *’* OBJECT : frmParts *’* DESCRIPTION : Show parts list :: MDI child *’* *’**********************************************************************************Private Sub Form_Load()

Parts_Load

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Parts_QUnload

End Sub

Private Sub Form_Resize()

Parts_Resize

End Sub

HOOFDSTUK 4. SIMS 0.2 89

Private Sub cBar_HeightChanged(ByVal NewHeight As Single)

Parts_cBar_HeightChanged

End Sub

Private Sub cmdAdd_Click()

Parts_cmdAdd_Click

End Sub

Private Sub cmdDel_Click()

Parts_cmdDel_Click

End Sub

Private Sub LV_OLEStartDrag(Data As MSComctlLib.DataObject, _AllowedEffects As Long)

Parts_DragDrop_Out Data

End Sub

HOOFDSTUK 4. SIMS 0.2 90

4.16 frmPartsADDED (formcode)

Option Explicit’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmParts_ADDED.frm *’* OBJECT : frmParts_ADDED *’* DESCRIPTION : Allows to add/edit a part record *’* *’**********************************************************************************

Private Sub Form_Load()

Parts_ADDED_Load

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Parts_ADDED_QUnLoad

End Sub

Private Sub cmdAdd_Click()

PartsAE_cmdAdd_Click

End Sub

Private Sub cmdCancel_Click()

HOOFDSTUK 4. SIMS 0.2 91

PartsAE_cmdCancel_Click

End Sub

HOOFDSTUK 4. SIMS 0.2 92

4.17 frmPC (formcode)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmPC.frm *’* OBJECT : frmPC *’* DESCRIPTION : List of assembled PC’s :: MDI child *’* *’**********************************************************************************

Private Sub Form_Load()

PC_Load

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

PC_QUnload

End Sub

Private Sub Form_Resize()

PC_Resize

End Sub

HOOFDSTUK 4. SIMS 0.2 93

Private Sub cmdAdd_Click()

PC_cmdAdd_Click

End Sub

Private Sub LVpc_ItemClick(ByVal Item As MSComctlLib.ListItem)

PC_LVpc_ItemClick Item

End Sub

Private Sub cmdEdit_Click()

PC_cmdEdit_Click

End Sub

HOOFDSTUK 4. SIMS 0.2 94

4.18 frmPCADDED (formcode)

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmPC_ADDED.frm *’* OBJECT : frmPC_ADDED *’* DESCRIPTION : Assembles PC’s D&D *’* *’**********************************************************************************

Private Sub cmdAdd_Click()

PCAE_cmdAdd_Click

End Sub

Private Sub cmdCancel_Click()

PC_AE_Cancel

End Sub

Private Sub Form_Load()

PC_AE_Load

End Sub

Private Sub Form_Unload(Cancel As Integer)

HOOFDSTUK 4. SIMS 0.2 95

PC_AE_QUnload

End Sub

Private Sub LVpart_OLEDragDrop(Data As MSComctlLib.DataObject,_Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)

PC_AE_DragDrop_In Data

End Sub

HOOFDSTUK 4. SIMS 0.2 96

4.19 frmSplash (formcode)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : frmSplash.frm *’* OBJECT : frmSplash *’* DESCRIPTION : Splash form that loads the system *’* *’**********************************************************************************Private Sub Form_Load()

Splash_Load

End Sub

Private Sub pctStart_DblClick()

shutDownSys

End Sub

Private Sub tmrALL_Timer()

Splash_tmrALL_Timer

End Sub

Private Sub tmrCFG_Timer()

HOOFDSTUK 4. SIMS 0.2 97

Splash_tmrCFG_Timer

End Sub

Private Sub tmrDBG_Timer()

Splash_tmrDBG_Timer

End Sub

Private Sub tmrDBS_Timer()

Splash_tmrDBS_Timer

End Sub

Private Sub CmdNewDB_Click()

Splash_cmdNewDB_Click

End Sub

Private Sub cmdOpenDB_Click()

Splash_cmdOpenDB_Click

End Sub

HOOFDSTUK 4. SIMS 0.2 98

4.20 INIT (coremodule)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : INIT.bas *’* OBJECT : INIT *’* DESCRIPTION : Basic boot/shutdownsystem *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : main *’* SCOPE : Private *’* DESCRIPTION : Boot function() *’*********************************************************

Private Sub Main()

On Error GoTo badEarlyInit

Set SyS.FRM.Splash = frmSplashSet SyS.FRM.Main = frmMainSet SyS.FRM.Customers = frmCustomersSet SyS.FRM.Customers_ADDED = frmCustomers_ADDEDSet SyS.FRM.Parts = frmPartsSet SyS.FRM.Invoices = frmInvoicesSet SyS.FRM.PCs = frmPC

HOOFDSTUK 4. SIMS 0.2 99

Set SyS.FRM.Parts_ADDED = frmParts_ADDEDSet SyS.FRM.PCs_ADDED = frmPC_ADDED

Set SyS.iOBJ.Cust_LV = frmCustomers.LVSet SyS.iOBJ.Cust_SBar = frmCustomers.sBarSet SyS.iOBJ.Cust_CBar = frmCustomers.cBarSet SyS.iOBJ.Part_CBar = frmParts.cBarSet SyS.iOBJ.Part_LV = frmParts.LVSet SyS.iOBJ.Part_SBar = frmParts.sBarSet SyS.iOBJ.PC_CB = frmPC.CBSet SyS.iOBJ.PC_LVpart = frmPC.LVpartSet SyS.iOBJ.PC_LVpc = frmPC.LVpcSet SyS.iOBJ.PC_SB = frmPC.SBSet SyS.iOBJ.PCAE_LV = frmPC_ADDED.LVpart

With SyS.lOBJ.Customers = False.Customers_ADDED = False.Invoices = False.Main = False.Parts = False.Pc = False.Splash = False.Customers_ADDED = False.Parts_ADDED = False.Pc_ADDED = False

End With

Load SyS.FRM.Splash

Exit Sub

badEarlyInit:

MsgBox "An early initialisation error occured, this should not happen and _indicates a serious (bug?) soft/hardware problem" _& vbCrLf & "Please report the following number to your supplier _: " & "001-" & Err.Number, vbCritical, "Fatal error"

End Sub

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : shutDownSys *’* SCOPE : Public *’* DESCRIPTION : Brings the system down *’*********************************************************

HOOFDSTUK 4. SIMS 0.2 100

Public Function shutDownSys()

SyS.DBG.enterFunction "shutDownSys"

’ Possible bug when QUnload still needs db/dbg...’ Force close windows ?

Set SyS.DBS = NothingSet SyS.CFG = Nothing

SyS.DBG.leaveFunction "shutDownSys"

SyS.DBG.leaveFunction "SIMS"

Set SyS.DBG = Nothing

End

End Function

HOOFDSTUK 4. SIMS 0.2 101

4.21 InvoiceEV (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : InvoiceEV.bas *’* OBJECT : InvoiceEV *’* DESCRIPTION : Event Handler for frmInvoice *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Invoice_Load *’* SCOPE : Public *’* DESCRIPTION : Loads frmInvoices *’*********************************************************

Public Function Invoice_Load()

SyS.DBG.enterFunction "Invoice_Load"

SyS.FRM.Main.mnuInvoices.Checked = TrueSyS.Config.bShowInvoice = TrueSyS.FRM.Invoices.Show

SyS.lOBJ.Invoices = True

SyS.DBG.leaveFunction "Invoice_Load"

HOOFDSTUK 4. SIMS 0.2 102

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Invoice_QUnload *’* SCOPE : Public *’* DESCRIPTION : Unloads frmInvoices *’*********************************************************

Public Function Invoice_QUnload()

SyS.DBG.enterFunction "Invoice_QUnload"

SyS.FRM.Main.mnuInvoices.Checked = FalseSyS.Config.bShowInvoice = False

SyS.lOBJ.Invoices = False

SyS.DBG.leaveFunction "Invoice_QUnload"

End Function

HOOFDSTUK 4. SIMS 0.2 103

4.22 MainEV (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : mainEV.bas *’* OBJECT : mainEV *’* DESCRIPTION : MDI Parent Event Handler (MPEH) *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Main_Load *’* SCOPE : Public *’* DESCRIPTION : Handels sys.frm.main_Load *’*********************************************************

Public Function Main_Load()

SyS.DBG.enterFunction "Main_Load"

SyS.FRM.Main.Caption = SyS.Config.appCaptionSyS.FRM.Main.Visible = True

If SyS.Config.bShowCust ThenLoad SyS.FRM.Customers

End If

HOOFDSTUK 4. SIMS 0.2 104

If SyS.Config.bShowPart ThenLoad SyS.FRM.Parts

End If

If SyS.Config.bShowInvoice ThenLoad SyS.FRM.Invoices

End If

If SyS.Config.bShowPC ThenLoad SyS.FRM.PCs

End If

SyS.FRM.Main.mnuCustomers.Checked = SyS.Config.bShowCustSyS.FRM.Main.mnuParts.Checked = SyS.Config.bShowPartSyS.FRM.Main.mnuPC.Checked = SyS.Config.bShowPCSyS.FRM.Main.mnuInvoices.Checked = SyS.Config.bShowInvoice

SyS.lOBJ.Main = True

SyS.DBG.leaveFunction "Main_Load"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Main_QUnload *’* SCOPE : Public *’* DESCRIPTION : Unloads the Main form *’*********************************************************

Public Function Main_QUnload()

SyS.DBG.enterFunction "Main_QUnload"

’Ltrz d00dz

SyS.lOBJ.Main = False ’ Hmmm, it never gets the chance to unload (shutdownsys)

SyS.DBG.leaveFunction "Main_QUnload>shutDownSys"

shutDownSys

End Function

HOOFDSTUK 4. SIMS 0.2 105

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Main_mnuQuit_Click *’* SCOPE : Public *’* DESCRIPTION : Call to exit *’*********************************************************

Public Function Main_mnuQuit_Click()

SyS.DBG.enterFunction "Main_mnuQuit_Click"

SyS.DBG.leaveFunction "Main_mnuQuit_Click>shutDownSys"

shutDownSys

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Main_mnuParts_Click *’* SCOPE : Public *’* DESCRIPTION : Switches Parts on/off *’*********************************************************

Public Function Main_mnuParts_Click()

SyS.DBG.enterFunction "Main_mnuParts_Click"

If SyS.FRM.Main.mnuParts.Checked ThenUnload SyS.FRM.Parts

Else ’ << asking for probs, add err_hLoad SyS.FRM.Parts

End If

SyS.DBG.leaveFunction "Main_mnuParts_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Main_mnuCustomers_Click *’* SCOPE : Public *’* DESCRIPTION : Switches Parts on/off *’*********************************************************

Public Function Main_mnuCustomers_Click()

SyS.DBG.enterFunction "Main_mnuCustomers_Click"

HOOFDSTUK 4. SIMS 0.2 106

If SyS.FRM.Main.mnuCustomers.Checked ThenUnload SyS.FRM.Customers

Else ’<< Dito as aboveLoad SyS.FRM.Customers

End If

SyS.DBG.leaveFunction "Main_mnuCustomers_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Main_mnuInvoices_Click *’* SCOPE : Public *’* DESCRIPTION : Switch *’*********************************************************

Public Function Main_mnuInvoices_Click()

SyS.DBG.enterFunction "Main_mnuInvoices_Click"

If SyS.FRM.Main.mnuInvoices.Checked ThenUnload SyS.FRM.Invoices

ElseLoad SyS.FRM.Invoices

End If

SyS.DBG.leaveFunction "Main_mnuInvoices_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Main_mnuPC_Click *’* SCOPE : Public *’* DESCRIPTION : Switch *’*********************************************************

Public Function Main_mnuPC_Click()

SyS.DBG.enterFunction "Main_mnuPC_Click"

If SyS.FRM.Main.mnuPC.Checked ThenUnload SyS.FRM.PCs

ElseLoad SyS.FRM.PCs

End If

HOOFDSTUK 4. SIMS 0.2 107

SyS.DBG.leaveFunction "Main_mnuPC_Click"

End Function

HOOFDSTUK 4. SIMS 0.2 108

4.23 MEMCORE (coremodule)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : MEMCORE.bas *’* OBJECT : MEMCORE *’* DESCRIPTION : Contains all data types *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* TYPE NAME : CONFIG_TP *’* PARENT : SYS_TP *’* DESCRIPTION : Configuration buffer *’*********************************************************

Public Type CONFIG_TP

appCaption As StringdbaseFileName As String

bShowCust As Boolean ’Show form @ boot ?bShowPart As BooleanbShowPC As BooleanbShowInvoice As Boolean

emptyString As String

HOOFDSTUK 4. SIMS 0.2 109

defCurrency As String

End Type

’*********************************************************’* Sims 0.1 *’* Type Name : DTA_TP *’* Parent : SyS *’* Description : General Data buffer (sys) *’*********************************************************

Public Type DTA_TP

Cust_saveOK As BooleanCust_AddEdit As LongCust_AddEdit_UIN As Long

Part_AddEdit As BooleanPart_AddEdit_UIN As Long

PC_AE As Boolean ’ false = add :: true = editPC_AE_UIN As Long ’ :?

End Type

’*********************************************************’* Sims 0.1 *’* Type Name : IOBJ_TP *’* Parent : SyS *’* Description : General Important objects *’*********************************************************

Public Type IOBJ_TP

Cust_LV As ListViewCust_SBar As StatusBarCust_CBar As CoolBar ’ << Stupid bug in M$ JUNK program

Part_LV As ListViewPart_SBar As StatusBarPart_CBar As CoolBar

PC_LVpc As ListViewPC_LVpart As ListViewPC_SB As StatusBarPC_CB As CoolBar

PCAE_LV As ListView

HOOFDSTUK 4. SIMS 0.2 110

End Type

’*********************************************************’* Sims 0.1 *’* Type Name : OBJ_LOAD_TP *’* Parent : SyS *’* Description : Cross Reference Load Status’s*’*********************************************************

Public Type OBJ_LOAD_TP

Customers As BooleanCustomers_ADDED As BooleanInvoices As BooleanMain As BooleanParts As BooleanParts_ADDED As BooleanPc As BooleanPc_ADDED As BooleanSplash As Boolean

End Type

’*********************************************************’* Sims 0.1 *’* TYPE NAME : FRM_TP *’* PARENT : SyS *’* DESCRIPTION : Holds pointers to forms *’*********************************************************

Public Type FRM_TP

Main As MDIForm

Splash As Form

Customers As FormParts As FormInvoices As FormPCs As FormCustomers_ADDED As FormParts_ADDED As FormPCs_ADDED As Form

End Type

HOOFDSTUK 4. SIMS 0.2 111

’*********************************************************’* Sims 0.1 *’* TYPE NAME : RCRDS_TP *’* PARENT : Private member of DBS_CLASS *’* DESCRIPTION : Recordset container *’*********************************************************

Public Type RCRDS_TP

Customers As RecordsetPart_Pc As RecordsetPART_IV As RecordsetParts As RecordsetPc As RecordsetPC_IV As RecordsetPart_type As RecordsetInvoices As Recordset

End Type

’*********************************************************’* Sims 0.1 *’* TYPE NAME : Klant_TP *’* PARENT : DBS_BUF_TP *’* DESCRIPTION : Klant table buffer *’*********************************************************

Public Type Customer_TP

Customer_UIN As LongName As StringSurname As StringAdress As StringCity As StringPostnumber As StringFax As StringPhone As StringEMail As StringDate As Date

End Type

’*********************************************************’* Sims 0.1 *’* Type Name : Parts_TP *’* Parent : DBS_BUF_TP *’* Description : Parts table buffer *’*********************************************************

HOOFDSTUK 4. SIMS 0.2 112

Public Type Parts_TP

PART_UIN As LongTYPE_REF As LongManufacturer As StringPartName As StringNote As StringPrice As StringStock As LongTStock As Long

End Type

’*********************************************************’* Sims 0.1 *’* Type Name : Invoice_TP *’* Parent : DBS_BUF_TP *’* Description : Invoices *’*********************************************************

Public Type Invoice_TP

Invoice_UIN As LongCust_REF As LongDate As StringTPrice As StringReduction As String

End Type

’*********************************************************’* Sims 0.1 *’* Type Name : Part_IV_TP *’* Parent : DBS_BUF_TP *’* Description : Links Parts 2 invoices *’*********************************************************

Public Type Part_IV_TP

Part_IV_UIN As LongPart_REF As LongInvoice_REF As LongQuantity As LongcPrice As String

End Type

HOOFDSTUK 4. SIMS 0.2 113

’*********************************************************’* Sims 0.1 *’* Type Name : Part_PC_TP *’* Parent : DBS_BUF_TP *’* Description : Links parts 2 PC’s *’*********************************************************

Public Type Part_PC_TP

Part_PC_UIN As LongPart_REF As LongPC_REF As LongQuantity As LongcPrice As String

End Type

’*********************************************************’* Sims 0.1 *’* Type Name : Part_Type_TP *’* Parent : DBS_BUF_TP *’* Description : Descripes HW type *’*********************************************************

Public Type Part_Type_TP

Part_Type_UIN As LongName As String

End Type

’*********************************************************’* Sims 0.1 *’* Type Name : PC_TP *’* Parent : DBS_BUF_TP *’* Description : PC’s *’*********************************************************

Public Type PC_TP

PC_UIN As LongDescription As StringPrice As String

End Type

HOOFDSTUK 4. SIMS 0.2 114

’*********************************************************’* Sims 0.1 *’* Type Name : PC_IV_TP *’* Parent : DBS_BUF_TP *’* Description : Links pc’s to invoices *’*********************************************************

Public Type PC_IV_TP

PC_IV_UIN As LongPC_REF As LongInvoice_REF As Long

End Type

’*********************************************************’* Sims 0.1 *’* TYPE NAME : DBS_BUF_TP *’* PARENT : SyS_TP *’* DESCRIPTION : Table buffer parent *’*********************************************************

Public Type DBS_BUF_TP

Customer As Customer_TPParts As Parts_TPInvoice As Invoice_TPPart_Invoice As Part_IV_TPPart_Pc As Part_PC_TPPart_type As Part_Type_TPPc As PC_TPPc_Invoice As PC_IV_TP

End Type

’*********************************************************’* Sims 0.1 *’* TYPE NAME : SYS_TP *’* PARENT : NONE, SYS=ROOT STRUCT *’* DESCRIPTION : PARENT DATA CONTAINER *’*********************************************************

Public Type SYS_TP

Config As CONFIG_TPDbBuf As DBS_BUF_TP ’ The global Data Transfer Buffer (DTB)SysBuf As DTA_TPFRM As FRM_TPiOBJ As IOBJ_TP

HOOFDSTUK 4. SIMS 0.2 115

lOBJ As OBJ_LOAD_TP

DBG As DBG_CLASSCFG As CFG_CLASSDBS As DBS_CLASS

End Type

’ Declarations *******************************************

Public SyS As SYS_TP ’ <- One very important memory eating, big fat’ super root type :D

HOOFDSTUK 4. SIMS 0.2 116

4.24 PartsADDEDEV (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : Parts_ADDEDEV.bas *’* OBJECT : Parts_ADDEDEV *’* DESCRIPTION : Event handle for frmParts_ADDED *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_ADDED_Load *’* SCOPE : Public *’* DESCRIPTION : Loads PADDED *’*********************************************************

Public Function Parts_ADDED_Load()

SyS.DBG.enterFunction "Parts_ADDED_Load"

SyS.lOBJ.Parts_ADDED = True

If SyS.SysBuf.Part_AddEdit = True ThenSyS.FRM.Parts_ADDED.Caption = "Edit <field>"SyS.FRM.Parts_ADDED.cmdAdd.Caption = "Change"

ElseSyS.FRM.Parts_ADDED.Caption = "Add new part"

HOOFDSTUK 4. SIMS 0.2 117

SyS.FRM.Parts_ADDED.cmdAdd.Caption = "Add"End If

’ Expermental : make non req MDI, MDI to prevent hide bug

SetTopMostWindow frmParts_ADDED, True

SyS.DBG.leaveFunction "Parts_ADDED_Load"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_ADDED_QUnload *’* SCOPE : Public *’* DESCRIPTION : Unloads PADDED *’*********************************************************

Public Function Parts_ADDED_QUnLoad()

SyS.DBG.enterFunction "Parts_ADDED_QUnLoad"

SyS.lOBJ.Parts_ADDED = False

SyS.DBG.leaveFunction "Parts_ADDED_QUnLoad"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PartsAE_cmdAdd_Click *’* SCOPE : Public *’* DESCRIPTION : Adds a new part *’*********************************************************

Public Function PartsAE_cmdAdd_Click()

SyS.DBG.enterFunction "PartsAE_cmdAdd_Click"

With SyS.DbBuf.Parts.Manufacturer = frmParts_ADDED.txtManufact.Note = frmParts_ADDED.txtNote.PartName = frmParts_ADDED.txtName.Price = frmParts_ADDED.txtPrice.Stock = IIf(frmParts_ADDED.txtStock = "", 0, _IIf(IsNumeric(frmParts_ADDED.txtStock), Val(frmParts_ADDED.txtStock), 0))

End With

SyS.DBS.Parts_POKE

HOOFDSTUK 4. SIMS 0.2 118

Parts_FillList

SyS.DBG.leaveFunction "PartsAE_cmdAdd_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PartsAE_cmdCancel_Click *’* SCOPE : Public *’* DESCRIPTION : Cancels adding part *’*********************************************************

Public Function PartsAE_cmdCancel_Click()

SyS.DBG.enterFunction "PartsAE_cmdCancel_Click"

Unload SyS.FRM.Parts_ADDED

SyS.DBG.leaveFunction "PartsAE_cmdCancel_Click"

End Function

HOOFDSTUK 4. SIMS 0.2 119

4.25 PartsEV (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : PartsEV.bas *’* OBJECT : PartsEV *’* DESCRIPTION : Event handler for SyS.FRM.Parts *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_Load *’* SCOPE : Public *’* DESCRIPTION : Loads sys.frm.parts *’*********************************************************

Public Function Parts_Load()

SyS.DBG.enterFunction "Parts_Load"

SyS.FRM.Parts.Show 0SyS.FRM.Main.mnuParts.Checked = TrueSyS.FRM.Parts.Visible = TrueSyS.Config.bShowPart = True

SyS.iOBJ.Part_LV.Left = PixelsToTwipsX(4)

HOOFDSTUK 4. SIMS 0.2 120

SyS.iOBJ.Part_CBar.Bands.Add 1, "std", , , , frmParts.cbHolderSTDSyS.iOBJ.Part_CBar.Bands.Add 2, "search", , , True, frmParts.cbHolderSRC

SyS.iOBJ.Part_SBar.Panels.Add 1, "P1", "Recordcount : " & SyS.DBS.numPartsSyS.iOBJ.Part_SBar.Panels.Add 2, "P2", "Results found : (no search)"SyS.iOBJ.Part_SBar.Panels(1).Width = SyS.iOBJ.Part_SBar.Panels(1).Width + 300SyS.iOBJ.Part_SBar.Panels(2).Width = SyS.iOBJ.Part_SBar.Panels(2).Width + 800

Parts_SetListParts_FillList

SyS.lOBJ.Parts = True

SyS.DBG.leaveFunction "Parts_Load"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_QUnload *’* SCOPE : Public *’* DESCRIPTION : UnLoad sys.frm.parts *’*********************************************************

Public Function Parts_QUnload()

SyS.DBG.enterFunction "Parts_QUnload"

SyS.FRM.Main.mnuParts.Checked = FalseSyS.Config.bShowPart = False

SyS.lOBJ.Parts = False

SyS.DBG.leaveFunction "Parts_QUnload"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_Resize *’* SCOPE : Public *’* DESCRIPTION : Resizes sys.frm.parts *’*********************************************************

Public Function Parts_Resize()

’ Explicit no DBG

STDW_CRF SyS.FRM.Parts, SyS.iOBJ.Part_LV, SyS.iOBJ.Part_CBar, _

HOOFDSTUK 4. SIMS 0.2 121

SyS.iOBJ.Part_SBar

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_cBar_HeightChanged *’* SCOPE : Public *’* DESCRIPTION : Calls resize cuz bar changed *’*********************************************************

Public Function Parts_cBar_HeightChanged()

SyS.DBG.enterFunction "Parts_cBar_HeightChanged"

STDW_CRF SyS.FRM.Parts, SyS.iOBJ.Part_LV, SyS.iOBJ.Part_CBar, _SyS.iOBJ.Part_SBar

SyS.DBG.leaveFunction "Parts_cBar_HeightChanged"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_cmdAdd_Click *’* SCOPE : Public *’* DESCRIPTION : Loads form to add part *’*********************************************************

Public Function Parts_cmdAdd_Click()

SyS.DBG.enterFunction "Parts_cmdAdd_Click"

SyS.SysBuf.Part_AddEdit = False ’ FALSE=ADD,TRUE=EDITLoad SyS.FRM.Parts_ADDEDSyS.FRM.Parts_ADDED.Show 0

SyS.DBG.leaveFunction "Parts_cmdAdd_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_cmdDel_Click *’* SCOPE : Public *’* DESCRIPTION : Deletes a Parts *’*********************************************************

HOOFDSTUK 4. SIMS 0.2 122

Public Function Parts_cmdDel_Click()

SyS.DBG.enterFunction "Parts_cmdDel_Click"

If SyS.iOBJ.Part_LV.ListItems.Count = 0 Then Exit Function

SyS.DBS.Parts_DEL (SyS.iOBJ.Part_LV.SelectedItem.Tag)

Parts_FillList

SyS.DBG.leaveFunction "Parts_cmdDel_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_DragDrop_Out *’* SCOPE : Public *’* DESCRIPTION : Assemble ID str and transmits*’*********************************************************

Public Function Parts_DragDrop_Out(ByRef Data As MSComctlLib.DataObject)

SyS.DBG.enterFunction "Parts_DragDrop_Out"

Data.SetData SEDT_ASM(Val(SyS.iOBJ.Part_LV.SelectedItem.Tag), "AA")

SyS.DBG.leaveFunction "Parts_DragDrop_Out"

End Function

HOOFDSTUK 4. SIMS 0.2 123

4.26 PartsF (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : PartsF.bas *’* OBJECT : PartsF *’* DESCRIPTION : Provides function for SyS.FRM.Parts *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_FillList *’* SCOPE : Public *’* DESCRIPTION : Fills the LV *’*********************************************************

Public Function Parts_FillList()

SyS.DBG.enterFunction "Parts_FillList"

Dim c As Long

SyS.iOBJ.Part_LV.ListItems.Clear

For c = 1 To SyS.DBS.numParts

SyS.DBS.clearBuf

HOOFDSTUK 4. SIMS 0.2 124

SyS.DBS.Parts_PEEK , c

SyS.iOBJ.Part_LV.ListItems.Add c, , SyS.DbBuf.Parts.PartNameWith SyS.iOBJ.Part_LV.ListItems(c)

.SubItems(1) = SyS.DbBuf.Parts.Manufacturer

.SubItems(2) = "UNIP"

.SubItems(3) = SyS.DbBuf.Parts.Price & " EUR"

.SubItems(4) = SyS.DbBuf.Parts.Note

.SubItems(5) = SyS.DbBuf.Parts.StockEnd WithSyS.iOBJ.Part_LV.ListItems(c).Tag = SyS.DbBuf.Parts.PART_UINSyS.DBG.makeLogEntry "Wrote to tag(" & c & ")::" & SyS.DbBuf.Parts.PART_UIN

Next c

SyS.DBG.leaveFunction "Parts_FillList"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_SetList *’* SCOPE : Public *’* DESCRIPTION : Inits the P_LV *’*********************************************************

Public Function Parts_SetList()

SyS.DBG.enterFunction "Parts_SetList"

With SyS.iOBJ.Part_LV

.View = 3

.ColumnHeaders.ClearWith .ColumnHeaders

.Add 1, , "Name"

.Add 2, , "Manufacturer"

.Add 3, , "Type"

.Add 4, , "Price"

.Add 5, , "Note"

.Add 6, , "Stock quantity"

End With

End With

SyS.DBG.leaveFunction "Parts_SetList"

HOOFDSTUK 4. SIMS 0.2 125

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Parts_StockChange *’* SCOPE : Public *’* DESCRIPTION : Changes stock in LV *’*********************************************************

Public Function Parts_StockChange(UIN As Long, corr As Long) As Boolean

SyS.DBG.enterFunction "Parts_StockChange"

Dim c As Long

For c = 1 To SyS.iOBJ.Part_LV.ListItems.CountIf Val(SyS.iOBJ.Part_LV.ListItems(c).Tag) = UIN Then

Exit ForEnd If

Next c

If UIN <> Val(SyS.iOBJ.Part_LV.ListItems(c).Tag) ThenParts_StockChange = False ’ Not found UINSyS.DBG.makeLogEntry "Fixme : bad UIN"SyS.DBG.leaveFunction "Parts_StockChange"Exit Function

End If

SyS.iOBJ.Part_LV.ListItems(c).SubItems(5) = _Trim(Str(Val(SyS.iOBJ.Part_LV.ListItems(c).SubItems(5)) + corr))

Parts_StockChange = True

SyS.DBG.leaveFunction "Parts_StockChange"

End Function

HOOFDSTUK 4. SIMS 0.2 126

4.27 PC ADDEDEV (module)

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : PC_ADDEDEV.bas *’* OBJECT : PC_ADDEDEV *’* DESCRIPTION : Event handler for the PC assembly form *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_AE_Load *’* SCOPE : Public *’* DESCRIPTION : Loads the pc edit window *’*********************************************************

Public Function PC_AE_Load()

SyS.DBG.enterFunction "PC_AE_Load"

SetTopMostWindow SyS.FRM.PCs_ADDED, True

PCAE_InitLV

SyS.lOBJ.Pc_ADDED = TrueSyS.FRM.PCs_ADDED.Show 0

SyS.DBG.leaveFunction "PC_AE_Load"

HOOFDSTUK 4. SIMS 0.2 127

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_AE_QUnload *’* SCOPE : Public *’* DESCRIPTION : Unloads the PCAE edit window *’*********************************************************

Public Function PC_AE_QUnload()

SyS.DBG.enterFunction "PC_AE_QUnload"

SyS.lOBJ.Pc_ADDED = False

SyS.DBG.leaveFunction "PC_AE_QUnload"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_AE_Cancel *’* SCOPE : Public *’* DESCRIPTION : Cancels a PC adding/edit *’*********************************************************

Public Function PC_AE_Cancel()

SyS.DBG.enterFunction "PC_AE_Cancel"

’ We reset the partsParts_FillList ’ Euh ???Unload SyS.FRM.PCs_ADDED

’ When cancelling, return the items in stock !’ Obsolete ? nice 4 dbg

SyS.DBG.leaveFunction "PC_AE_Cancel"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_AE_DragDrop_In *’* SCOPE : Public *’* DESCRIPTION : Handles incoming object *’*********************************************************

Public Function PC_AE_DragDrop_In(Data As MSComctlLib.DataObject)

HOOFDSTUK 4. SIMS 0.2 128

SyS.DBG.enterFunction "PC_AE_DragDrop_In"

Dim UIN As Long, dtype As String, c As Integer

If Not DD_goodType(Data) ThenSyS.DBG.makeLogEntry "Invalid object dropped in PC_AE_LV"Exit Function

End If

UIN = SEDT_UIN(Data.GetData(1))dtype = SEDT_DTYPE(Data.GetData(1))

SyS.DBG.makeLogEntry "DD0: " & UIN & "::" & dtype

Select Case SEDT_DTYPE(Data.GetData(1))Case "AA"

’First we get tha thingSyS.DBS.Parts_PEEK UINIf Not (SyS.DbBuf.Parts.Stock <= 0 Or SyS.DbBuf.Parts.TStock_

<= 0) ThenSyS.DBG.makeLogEntry "TStock = " &_

SyS.DbBuf.Parts.TStock & "::Stock = " & SyS.DbBuf.Parts.Stock’ Okay, so stock is fine for reduction’ So we reduce, not real, but temp stockSyS.DbBuf.Parts.TStock = SyS.DbBuf.Parts.TStock - 1’ and we flush right awaySyS.DBS.Parts_EDIT (UIN)’ flushed.... okay what now’ Now, we show user stock goneParts_StockChange UIN, -1’ Okay, done’ Now we add it to the new basket...’ We still didn’t waste Parts so why not save DBS call ?If PCAE_UINnew(UIN) Then

c = SyS.iOBJ.PCAE_LV.ListItems.Count + 1SyS.iOBJ.PCAE_LV.ListItems.Add c, , "1"SyS.iOBJ.PCAE_LV.ListItems(c).Tag = Str(UIN)SyS.iOBJ.PCAE_LV.ListItems(c).SubItems(1) = _SyS.DbBuf.Parts.PartNameSyS.iOBJ.PCAE_LV.ListItems(c).SubItems(2) = _SyS.DbBuf.Parts.ManufacturerSyS.iOBJ.PCAE_LV.ListItems(c).SubItems(3) = _SyS.DbBuf.Parts.TYPE_REFSyS.iOBJ.PCAE_LV.ListItems(c).SubItems(4) = _SyS.DbBuf.Parts.PriceSyS.iOBJ.PCAE_LV.ListItems(c).SubItems(5) = _SyS.DbBuf.Parts.Note

Else

HOOFDSTUK 4. SIMS 0.2 129

PCAE_ChangeStock UIN, 1End If’Kayz, thingie is added, the universe saved.

End If

Case ElseSyS.DBG.makeLogEntry "Invalid dType : "_

& SEDT_DTYPE(Data.GetData(1))

End Select

SyS.DBG.leaveFunction "PC_AE_DragDrop_In"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PCAE_cmdAdd_Click *’* SCOPE : Public *’* DESCRIPTION : Adds new pc *’*********************************************************

Public Function PCAE_cmdAdd_Click()

SyS.DBG.enterFunction "PCAE_cmdAdd_Click"

’ loop around the elements in LV’ edit parts

Dim c As Long, UIN As Long, q As Long, pcnuin As Long

With SyS.DbBuf.Pc.Description = frmPC_ADDED.txtDescr.Price = Str(frmPC_ADDED.txtPrice)

End With

SyS.DBS.PC_POKEpcnuin = SyS.DbBuf.Pc.PC_UIN

SyS.DBG.makeLogEntry "Okay, made new pc, uin = " & pcnuin

For c = 1 To SyS.iOBJ.PCAE_LV.ListItems.Count

UIN = SyS.iOBJ.PCAE_LV.ListItems(c).Tagq = CDbl(SyS.iOBJ.PCAE_LV.ListItems(c).Text)

SyS.DBS.Parts_PEEK UINSyS.DbBuf.Parts.Stock = SyS.DbBuf.Parts.TStock

HOOFDSTUK 4. SIMS 0.2 130

’ This *should* be righto not ?SyS.DBS.Parts_EDIT UIN ’ Updated the stock

With SyS.DbBuf.Part_Pc

.cPrice = SyS.DbBuf.Parts.Price

.Part_REF = SyS.DbBuf.Parts.PART_UIN

.PC_REF = pcnuin

.Quantity = q

End With ’ and made the link

SyS.DBS.PART_PC_POKE

Next c

PC_FillLVpc

SyS.DBG.leaveFunction "PCAE_cmdAdd_Click"

End Function

HOOFDSTUK 4. SIMS 0.2 131

4.28 PC ADDEDF (module)

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : PC_ADDEDF.bas *’* OBJECT : PC_ADDEDF *’* DESCRIPTION : Provide functions for PC_ADDEDF *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PCAE_InitLV *’* SCOPE : Public *’* DESCRIPTION : Creates LV headers *’*********************************************************

Public Function PCAE_InitLV()

SyS.DBG.enterFunction "PCAE_InitLV"

With frmPC_ADDED.LVpart.View = 3With .ColumnHeaders

.Add 1, , "Number"

.Add 2, , "Name"

.Add 3, , "Manufacturer"

.Add 4, , "Type"

.Add 5, , "Price"

.Add 6, , "Note"

HOOFDSTUK 4. SIMS 0.2 132

End WithEnd With

SyS.DBG.leaveFunction "PCAE_InitLV"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PCAE_UINnew *’* SCOPE : Public *’* DESCRIPTION : Checks if a part is new in LV*’*********************************************************

Public Function PCAE_UINnew(UIN As Long) As Boolean

SyS.DBG.enterFunction "PCAE_UINnew"

Dim c As Long

For c = 1 To SyS.iOBJ.PCAE_LV.ListItems.CountIf UIN = Val(SyS.iOBJ.PCAE_LV.ListItems(c).Tag) Then

PCAE_UINnew = FalseSyS.DBG.leaveFunction "PCAE_UINnew(false)"Exit Function

End IfNext c

PCAE_UINnew = True

SyS.DBG.leaveFunction "PCAE_UINnew(true)"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PCAE_ChangeStock *’* SCOPE : Public *’* DESCRIPTION : Changes stock of P in PAELV *’*********************************************************

Public Function PCAE_ChangeStock(UIN As Long, corr As Long) As Boolean

SyS.DBG.enterFunction "PCAE_ChangeStock"

Dim c As Long

For c = 1 To SyS.iOBJ.PCAE_LV.ListItems.Count

HOOFDSTUK 4. SIMS 0.2 133

If UIN = Val(SyS.iOBJ.PCAE_LV.ListItems(c).Tag) ThenSyS.iOBJ.PCAE_LV.ListItems(c).Text = _Trim(Str(Val(SyS.iOBJ.PCAE_LV.ListItems(c)) + corr))Exit For

End If

Next c

PCAE_ChangeStock = True

If Not UIN = Val(SyS.iOBJ.PCAE_LV.ListItems(c).Tag) ThenPCAE_ChangeStock = False ’ not foundSyS.DBG.makeLogEntry "Fixme : UIN not found"

End If

SyS.DBG.leaveFunction "PCAE_ChangeStock"

End Function

HOOFDSTUK 4. SIMS 0.2 134

4.29 PCsEV (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : PCsEV.bas *’* OBJECT : PCsEV *’* DESCRIPTION : Event Handler for frmPC *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_Load *’* SCOPE : Public *’* DESCRIPTION : Loads frmPC *’*********************************************************

Public Function PC_Load()

SyS.DBG.enterFunction "PC_Load"

SyS.iOBJ.PC_CB.Bands.Add 1, "STD", , , False, frmPC.cbHolderSTDSyS.iOBJ.PC_CB.Top = PixelsToTwipsY(2)SyS.iOBJ.PC_CB.Left = PixelsToTwipsX(2)SyS.iOBJ.PC_SB.Panels.Add 1, , "Recordcount : "

PC_InitLVPC_FillLVpc

HOOFDSTUK 4. SIMS 0.2 135

SyS.FRM.PCs.Show 0SyS.FRM.Main.mnuPC.Checked = TrueSyS.Config.bShowPC = True

SyS.lOBJ.Pc = True

SyS.DBG.leaveFunction "PC_Load"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_QUnload *’* SCOPE : Public *’* DESCRIPTION : Unloads frmPC *’*********************************************************

Public Function PC_QUnload()

SyS.DBG.enterFunction "PC_QUnload"

SyS.FRM.Main.mnuPC.Checked = FalseSyS.Config.bShowPC = False

SyS.lOBJ.Pc = False

SyS.DBG.leaveFunction "PC_QUnload"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_Resize *’* SCOPE : Public *’* DESCRIPTION : Resizes PC window *’*********************************************************

Public Function PC_Resize()

Dim fP As CoolBar

Set fP = SyS.FRM.PCs.CB ’ Pointer bug workaround’<< im nuts pointer2pointer ???

TLVW_CRF SyS.FRM.PCs, SyS.FRM.PCs.LVpc, SyS.FRM.PCs.LVpart, _fP, SyS.FRM.PCs.SB, 32

End Function

HOOFDSTUK 4. SIMS 0.2 136

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_cmdAdd_Click *’* SCOPE : Public *’* DESCRIPTION : Opens PCAE window *’*********************************************************

Public Function PC_cmdAdd_Click()

SyS.DBG.enterFunction "PC_cmdAdd_click"

SyS.SysBuf.PC_AE = FalseSyS.SysBuf.PC_AE_UIN = -1 ’:?Load SyS.FRM.PCs_ADDED

SyS.DBG.leaveFunction "PC_cmdAdd_click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_cmdEdit_Click *’* SCOPE : Public *’* DESCRIPTION : Opens edit window for PC *’*********************************************************

Public Function PC_cmdEdit_Click()

SyS.DBG.enterFunction "PC_cmdEdit_Click"

If SyS.iOBJ.PC_LVpc.ListItems.Count <= 0 ThenSyS.DBG.leaveFunction "PC_cmdEdit_Click >empty LV"Exit Function

End If

SyS.SysBuf.PC_AE = TrueSyS.SysBuf.PC_AE_UIN = SyS.iOBJ.PC_LVpc.SelectedItem.Tag’ Err check for non selLoad SyS.FRM.PCs_ADDED ’ One UIN to unite them all

SyS.DBG.leaveFunction "PC_cmdEdit_Click"

End Function

HOOFDSTUK 4. SIMS 0.2 137

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_LVpc_ItemClick *’* SCOPE : Public *’* DESCRIPTION : Fills parts when click item *’*********************************************************

Public Function PC_LVpc_ItemClick(ByVal Item As MSComctlLib.ListItem)

SyS.DBG.enterFunction "PC_LVpc_ItemClick"

PC_FillLVPart Item.Tag

SyS.DBG.leaveFunction "PC_LVpc_ItemClick"

End Function

HOOFDSTUK 4. SIMS 0.2 138

4.30 PCsF (module)

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : PCsF.bas *’* OBJECT : PCsF *’* DESCRIPTION : Provides funtions for PCsEV *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_InitLV *’* SCOPE : Public *’* DESCRIPTION : Inits PC headers LV *’*********************************************************

Public Function PC_InitLV()

SyS.DBG.enterFunction "PC_InitLV"

With SyS.iOBJ.PC_LVpc

.ColumnHeaders.Add 1, , "PC Description"

.ColumnHeaders.Add 2, , "Total price"

End With

With SyS.iOBJ.PC_LVpart.ColumnHeaders

HOOFDSTUK 4. SIMS 0.2 139

.Add 1, , "Name"

.Add 2, , "Manufacturer"

.Add 3, , "Type"

.Add 4, , "Price"

.Add 5, , "Note"

.Add 6, , "Quantity"

End With

SyS.DBG.leaveFunction "PC_InitLV"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_FillLV *’* SCOPE : Public *’* DESCRIPTION : Fills the LV *’*********************************************************

Public Function PC_FillLVpc()

SyS.DBG.enterFunction "PC_FillLVpc"

Dim c As Long

SyS.iOBJ.PC_LVpc.ListItems.Clear

For c = 1 To SyS.DBS.numPCs

SyS.DBS.PC_PEEK , cWith SyS.iOBJ.PC_LVpc

.ListItems.Add c, , SyS.DbBuf.Pc.Description

.ListItems(c).Tag = SyS.DbBuf.Pc.PC_UIN

.ListItems(c).SubItems(1) = SyS.DbBuf.Pc.PriceEnd With

Next c

SyS.iOBJ.PC_SB.Panels(1).Text = "Recordcount : " & Str(SyS.DBS.numPCs)

SyS.DBG.leaveFunction "PC_FillLVpc"

End Function

HOOFDSTUK 4. SIMS 0.2 140

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : PC_FillLVPart *’* SCOPE : Public *’* DESCRIPTION : Fills parts for UIN pc *’*********************************************************

Public Function PC_FillLVPart(UIN As Long)

SyS.DBG.enterFunction "PC_FillLVPart"

’Kayz, we got the UIN... now we gotta go get the parts...

Dim c As Long, n As Long

SyS.iOBJ.PC_LVpart.ListItems.Clear

For c = 1 To SyS.DBS.numPart_pc

SyS.DBG.makeLogEntry "Read ok ???:::" & SyS.DBS.PART_PC_PEEK(, c)SyS.DBG.makeLogEntry "Compare (" & c & "):" & UIN & "<-->" _& SyS.DbBuf.Part_Pc.PC_REFIf SyS.DbBuf.Part_Pc.PC_REF = UIN Then

SyS.DBG.makeLogEntry "n=" & nn = n + 1SyS.DBS.Parts_PEEK SyS.DbBuf.Part_Pc.Part_REFWith SyS.iOBJ.PC_LVpart

.ListItems.Add n, , SyS.DbBuf.Parts.PartName

.ListItems(n).SubItems(1) = SyS.DbBuf.Parts.Manufacturer

.ListItems(n).SubItems(2) = SyS.DbBuf.Parts.TYPE_REF

.ListItems(n).SubItems(3) = SyS.DbBuf.Parts.Price & "EUR"

.ListItems(n).SubItems(4) = SyS.DbBuf.Parts.Note

.ListItems(n).SubItems(5) = SyS.DbBuf.Part_Pc.QuantityEnd With

End If

Next c

SyS.DBG.leaveFunction "PC_FillLVPart"

End Function

HOOFDSTUK 4. SIMS 0.2 141

4.31 SplashEV (module)

Option Explicit

’**********************************************************************************’* * *’* JDP Sims 0.1 - Stock & Invoice Management System. *’* Copyright (C) 2002 Lennart Yseboodt. *’* *’* =================================================== *’* *’* This program is free software; you can redistribute it and/or *’* modify it under the terms of the GNU General Public License *’* as published by the Free Software Foundation; either version 2 *’* of the License, or (at your option) any later version. *’* *’* This program is distributed in the hope that it will be useful, *’* but WITHOUT ANY WARRANTY; without even the implied warranty of *’* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *’* GNU General Public License for more details. *’* *’* You should have received a copy of the GNU General Public License *’* along with this program; if not, write to the Free Software *’* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *’* *’* FILENAME : SplashEV.bas *’* OBJECT : SplashEV *’* DESCRIPTION : Event Handler for SyS.FRM.Splash *’* *’**********************************************************************************

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Splash_Load *’* SCOPE : Public *’* DESCRIPTION : Handles sys.frm.splash_Load()*’*********************************************************

Public Function Splash_Load()

If Dir(App.Path & "\logo.jpg") <> "" ThenSyS.FRM.Splash.pctStart.Picture = LoadPicture(App.Path & "\logo.jpg")SyS.FRM.Splash.Width = SyS.FRM.Splash.pctStart.WidthSyS.FRM.Splash.Height = SyS.FRM.Splash.pctStart.Height

End If

SyS.FRM.Splash.Visible = True

’ Debugger ->

HOOFDSTUK 4. SIMS 0.2 142

Set SyS.DBG = New DBG_CLASSSyS.FRM.Splash.tmrDBG.enabled = True

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Splash_tmrDBG_Timer *’* SCOPE : Public *’* DESCRIPTION : Handels the Debugger load *’*********************************************************

Public Function Splash_tmrDBG_Timer()

If loaded(SyS.DBG) ThenWith SyS.FRM.Splash

.tmrDBG.enabled = FalseIf SyS.DBG.loadSucces Then

SyS.DBG.enterFunction "SIMS"SyS.DBG.enterFunction "Splash_tmrDBG_Timer::DBG LOAD SUCCESS".lblSdebug.Caption = "DONE :)".lblSdebug.ForeColor = vbGreen.pbarStart.Value = .pbarStart.Value + 25SyS.DBG.makeLogEntry "DBG LOAD OK"Set SyS.CFG = New CFG_CLASS.tmrCFG.enabled = TrueSyS.DBG.leaveFunction "Splash_tmrDBG_Timer::DBG LOAD SUCCESS"

Else.lblSdebug.Caption = "FAILED :(".lblSdebug.ForeColor = vbRed’ Halting execution (CFG needs DBG)

End IfEnd With

End If

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Splash_tmrCFG_Timer *’* SCOPE : Public *’* DESCRIPTION : Handels the Configger load *’*********************************************************

Public Function Splash_tmrCFG_Timer()

SyS.DBG.enterFunction "Splash_tmrCFG_Timer"

HOOFDSTUK 4. SIMS 0.2 143

Static fail As Boolean

SyS.DBG.makeLogEntry "CFG_Load :: fail :: " & IIf(fail, "TRUE", "FALSE")

If loaded(SyS.CFG) ThenWith SyS.FRM.Splash

.tmrCFG.enabled = FalseIf SyS.CFG.loadSucces Then

.lblSconfig.Caption = "DONE :)"

.lblSconfig.ForeColor = vbGreenSyS.DBG.makeLogEntry "CFG LOAD OK".pbarStart.Value = .pbarStart.Value + 25Set SyS.DBS = New DBS_CLASS.tmrDBS.enabled = True

ElseIf fail Then

.lblSconfig.Caption = "FAILED :("

.lblSconfig.ForeColor = vbRedSyS.DBG.makeLogEntry "CFG LOAD FAIL"

ElseSyS.DBG.makeLogEntry "Trying to make new config on the fly"

Set SyS.CFG = NothingDoEventsSet SyS.CFG = New CFG_CLASS ’ RetryDoEventsfail = True.tmrCFG.enabled = True

End If’Halting execution (No config, no defaults...)<< Change, imp f already !!!

End IfEnd With

End If

SyS.DBG.leaveFunction "Splash_tmrCFG_Timer"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Splash_tmrDBS_Timer *’* SCOPE : Public *’* DESCRIPTION : Handels the Database load *’*********************************************************

Public Function Splash_tmrDBS_Timer()

HOOFDSTUK 4. SIMS 0.2 144

SyS.DBG.enterFunction "Splash_tmrDBS_Timer"

If loaded(SyS.DBS) ThenWith SyS.FRM.Splash

.tmrDBS.enabled = FalseIf SyS.DBS.loadSucces Then

.lblSdatabase.Caption = "DONE :)"

.lblSdatabase.ForeColor = vbGreenSyS.DBG.makeLogEntry "DBS LOAD OK".pbarStart.Value = .pbarStart.Value + 40.tmrALL.enabled = True

Else.lblSdatabase.Caption = "FAILED :(".lblSdatabase.ForeColor = vbRedSyS.DBG.makeLogEntry "DBS LOAD FAIL"frmSplash.tmrDBS.enabled = FalsefrmSplash.CmdNewDB.Visible = TruefrmSplash.cmdOpenDB.Visible = True

End IfEnd With

End If

SyS.DBG.leaveFunction "Splash_tmrDBS_Timer"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Splash_tmrALL_Timer *’* SCOPE : Public *’* DESCRIPTION : Finalisez load *’*********************************************************

Public Function Splash_tmrALL_Timer()

’ If we got here, tha core should be fine.

Static NT As Integer

SyS.DBG.enterFunction "Splash_tmrALL_Timer"

SyS.FRM.Splash.pbarStart.Value = 100SyS.FRM.Splash.lblSStartup.ForeColor = vbGreenSyS.FRM.Splash.lblSStartup.Caption = "DONE :)"

doUpdate (1000)

NT = NT + 1

HOOFDSTUK 4. SIMS 0.2 145

If NT = 1 ThenSyS.DBG.leaveFunction "Splash_tmrALL_Timer*"Exit Function

End If

SyS.FRM.Splash.tmrALL.enabled = False

SyS.DBG.makeLogEntry "Unload splash..."

Unload SyS.FRM.Splash

doUpdate (1000)

’Do Until Not loaded(sys.frm.splash)’ DoEvents’Loop

SyS.DBG.leaveFunction "Splash_tmrALL_Timer>sys.frm.main_Load"

Load SyS.FRM.Main

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Splash_cmdNewDB_Click *’* SCOPE : Public *’* DESCRIPTION : Button for new DBase *’*********************************************************

Public Function Splash_cmdNewDB_Click()

SyS.DBG.enterFunction "Splash_cmdNewDB_Click"

frmSplash.lblSdatabase.Caption = "New..."frmSplash.lblSdatabase.ForeColor = vbWhite

With frmSplash.cdgDBase.DefaultExt = "mdb".DialogTitle = "Please select where to save the new database".InitDir = App.Path.filename = "Core".ShowSave

End With

SyS.DBG.makeLogEntry "SelFN=" & frmSplash.cdgDBase.filename

If frmSplash.cdgDBase.filename = "" Or Dir(frmSplash.cdgDBase.filename)_<> "" Then Exit Function

HOOFDSTUK 4. SIMS 0.2 146

SyS.DBG.makeLogEntry "Survived filenamecheck"

SyS.DBG.makeLogEntry "Going to create the database..."

frmSplash.CmdNewDB.Visible = FalsefrmSplash.cmdOpenDB.Visible = False

If SyS.DBS.makeNewDBase(frmSplash.cdgDBase.filename) Then

SyS.Config.dbaseFileName = frmSplash.cdgDBase.filenameSet SyS.DBS = NothingSet SyS.DBS = New DBS_CLASS ’ Retry :)frmSplash.tmrDBS.enabled = True

Else

MsgBox "Database creation failed, refer to Debug logs", vbCritical

End If

SyS.DBG.leaveFunction "Splash_cmdNewDB_Click"

End Function

’*********************************************************’* Sims 0.1 *’* FUNCTION/SUB NAME : Splash_cmdOpenDB_Click *’* SCOPE : Public *’* DESCRIPTION : Button to search DBase *’*********************************************************

Public Function Splash_cmdOpenDB_Click()

SyS.DBG.enterFunction "Splash_cmdOpenDB_Click"

frmSplash.lblSdatabase.Caption = "Open..."frmSplash.lblSdatabase.ForeColor = vbWhite

With frmSplash.cdgDBase.DefaultExt = "mdb".DialogTitle = "Locate database".InitDir = App.Path.ShowOpen

End With

If frmSplash.cdgDBase.filename = "" Or Dir(frmSplash.cdgDBase.filename) _= "" Then Exit Function

HOOFDSTUK 4. SIMS 0.2 147

SyS.Config.dbaseFileName = frmSplash.cdgDBase.filename

Set SyS.DBS = NothingSet SyS.DBS = New DBS_CLASSfrmSplash.tmrDBS.enabled = True

SyS.DBG.leaveFunction "Splash_cmdOpenDB_Click"

End Function

Deel II

Overige deeltaken

148

Hoofdstuk 5

Bevestiging medewerking

EDNOTE: Replace by letter

149

Hoofdstuk 6

Probleemdefinitie

6.1 Het bedrijf

Mijn (virtueel) GIP bedrijf voor Informatica is een relatief kleine computerwinkel.Deze winkel heeft een zeer ruime voorraad 2de hands en oudere hardware. Momenteelligt deze ordeloos opgeslagen in het magazijn. De uiteindelijk bedoeling is om vanal deze hardware zoveel mogelijk goede 2de hands computers te maken die dan vooreen zacht prijsje de deur uit gaan.

6.2 Doel van het programma

Het is de bedoeling dat alle onderdelen worden ingegeven en opgeslagen in eendatabase. Als men met de assemblage begint, selecteert men alle onderdelen diein de computer zitten, de onderdelen verdwijnen uit de stock en een nieuwe recordwordt aangemaakt in een andere tabel, waar de volledige computer worden opgesla-gen. Onderdelen kunnen ook afzonderlijk verkocht worden en ook hiervoor kan eenfactuur worden afgedrukt.

Bij verkoop van een computer, komen de onderdelen in een tabel waar alleverkochte onderdelen worden opgeslagen, uiteraard met een referentie naar de klanten dus de computer waar ze inzitten. Men kan ook een factuur laten afdrukken metdaarop de informatie over de winkel en de klant, de onderdelen die in de computerzitten en de totaalprijs wordt berekend. Wordt er een computer binnengebracht, kanmen meteen zien of deze nog in garantie is en welke onderdelen erin zitten. Dancontroleert het programma of dergelijk onderdeel nog in stock is.

Met deze manier van gecentraliseerde opslag vermijdt men het tijdrovende zoekenin het (rommelige) magazijn, men wint niet alleen tijd voor zichzelf, maar de klantmoet ook minder lang wachten.

150

Hoofdstuk 7

Algemeen beeld van het bedrijf(Frans)

Forest & Bold est une jeune entreprise, elle a 9 ans. L’entreprise a ete etablie en1992 par M K. Meeuwels, qui voulait creer une agence publicitaire. Maintenant F&Ba une grande clientele variee, le chiffre d’affaires augmente constamment.

F&B est specialise en de grandes campagnes pour des moyennes et grandes en-treprises. Ils font des affiches etonnantes, des bannir pour l’Internet ou une pagebranchee dans un magazine. Les createurs utilisent Photoshop, Flash et Quark, caassure des pages tres soignees et attractives.

En 1992 M Meeuwels decidait de creer une agence publicitaire, la BVBA Forest &Bold etait nee. Il renovait la maison ou il a grandi. Les chiffres d’affaires et le nom-bre d’employers ont grandi constamment. Maintenant F&B emploient 7 personnes.Pendant les vacances ils engagent des etudiants.

Forest & Bold est une entreprise en bonne sante, la crise ”.com” a detruit beau-coup d’entreprises, mais Forest & Bold n’ont pas eu de problemes. Le total detransactions est de plus de 150.000.000 BEF, il est donc clair qu’ils ont un bonmanagement, et un bilan stable. Pour l’avenir ils voient un avancement poursuivi,ils n’ont pas l’intention de faire des changements majeurs. Ils progressent avec latechnologie d’aujourd’hui sans se plonger dans une aventure dangereuse.

Je ne vais pas ecrire un programme pour cette entreprise parce qu’ils utilisent desMacs. Donc j’ai decide d’ ecrire un programme pour le magasin ou j’ai travaille. Ilsont une grande reserve de parts qui doit etre sauve dans un data base. Si un clientveut acheter une piece, le vendeur peut voir immediatement si la piece est encore destock, sans devoir chercher dans le magasin.

S’ils assemblent un ordinateur, le programme sait que certaines parts sont utilisees,quand une part ne marche plus, le vendeur peut voir (sans ouvrir l’ordinateur!), si lapiece est encore en stock pour etre remplacee, si non, le programme fait la suggestionpour une autre piece qui est compatible.

151

Hoofdstuk 8

Analyse van eenarbeidsovereenkomst

8.1 Situering

Ik zal een arbeidsovereenkomst bespreken voor een handelsvertegenwoordiger in detelecommunicatie en reclame sector. De overeenkomst bestaat uit 3 paginas met13 artikels, waarvan 1 artikel verwijderd werd, de overeenkomst werd ook anoniemgemaakt.

8.2 Algemeen

De overeenkomst is een contract tussen Koen Meekels, de oprichter en algemeendirecteur van Forest & Bold, en de handelsvertegenwoordiger. De overeenkomstbegint op 16 augustus 1999, voor onbepaalde duur. Er staat een referentie naar dewet van 3 juli 1978 betreffende de arbeidsovereenkomsten. Dit contract is dus eenaan Forest & Bold aangepaste versie van het standaard contract dat de wet voorziet.

8.3 Artikel 1

De eerste 6 maanden worden als proeftijd beschouwd.een verlenging is niet mogelijk(handelsvertegenwoordiger), dus na 6 maanden wordt het een verbintenis van on-bepaalde duur.

152

HOOFDSTUK 8. ANALYSE VAN EEN ARBEIDSOVEREENKOMST 153

8.4 Artikel 2

Dit artikel omschrijft algemeen het werk dat de handelsvertegenwoordiger moetuitvoeren. De vertegenwoordiger moet de diensten en producten die Forest & Boldaanbiedt, vertegenwoordigen bij klanten en proberen te verkopen. Door deze over-eenkomst verliest hij het recht om zelfstandig dit soort diensten of producten aan tebieden of te verkopen, bij de klanten van de onderneming of in de sector.

Dit is een normale stap: gezien de informatie waarover de vertegenwoordigerbeschikt zou hij op oneerlijke wijze kunnen concurreren met de onderneming. Deduur van de verbodsperiode is 1 jaar, zoals vermeld in artikel 11.

8.5 Artikel 3

In dit artikel staan de werkuren vermeld. Van maandag tot donderdag is dit van 9uur tot 17.45, met 1 uur pauze tussen 12.30 en 13.30. Op vrijdag eindigt de werkdagom 16.45. Het is dus een werkweek van 37 uur en 45 minuten. Het maximum van38 uur wordt dus niet overschreden. De uren zullen wel vrij onregelmatig zijn daarhet begin van de werkdag overeenstemt met het bezoeken van de eerste klant en heteinde met het bezoeken van de laatste klant.

8.6 Artikel 4

De handelsvertegenwoordiger moet zich om 9 uur aanmelden bij de hoofdzetel van deonderneming voor instructies (tenzij anders afgesproken). Hij moet zich houden aande afspraken van de werknemer inzake de klanten die bezocht worden, de aangebodenartikelen en de verkoopsvoorwaarden.

De handelsvertegenwoordiger moet dagelijks de bestellingen aan de werkgeverovermaken in de vorm van bestelbons waarop de aard van het werk of de hoeveelheidgoederen staan alsmede de overeengekomen prijs van deze goederen. Er moet ookeen dagelijks rapport afgegeven worden waarop de naam en het adres van de klantenstaan die de vertegenwoordiger bezocht heeft alsmede de tijd bij elk van hen besteed.Zo kan de werkgever de prestaties van de vertegenwoordiger evalueren.

8.7 Artikel 5

De vaste brutowedde is 58.000 BEF, dit wordt echter aangevuld met een com-missieloon : Hij krijgt 5% op alle bestellingen van klanten die door hem zijn gewor-ven, dit voor 1 jaar vanaf facturatiedatum van de eerste factuur. (Dit na aftrek vankosten, en creditnota’s). Wordt de order niet uitgevoerd, buiten de schuld van de

HOOFDSTUK 8. ANALYSE VAN EEN ARBEIDSOVEREENKOMST 154

vertegenwoordiger, dan krijgt hij 5% van de prijs die op de bestelbon vermeld staat.De werkgever heeft 8 dagen tijd om bezwaar aan te tekenen tegen een bestelbon. Debezoldiging (en het commissieloon, indien van toepassing) wordt giraal gestort op debankrekening van de vertegenwoordiger.

8.8 Artikel 6

Voordelen zoals 13de maand en productiepremie dienen beschouwd te worden alsvrijgevigheid van de werkgever m.a.w de vertegenwoordiger heeft er geen recht op,omdat deze voordelen niet gewaarborgd worden met een Koninklijk Besluit in deCAO van het bevoegd paritair comite.

8.9 Artikel 7

Alles wat de vertegenwoordiger creeert tijdens de uitvoering van zijn werk wordtovergedragen aan de werkgever, die deze werken mag exploiteren, zelfs op manierendie op het ogenblik van het afsluiten van het contract nog niet bekend zijn.

8.10 Artikel 8

De handelsvertegenwoordiger moet controleren of de klanten die hij aanbrengt vol-doende kredietwaardig zijn. Indien hij dit niet doet kan de werkgever bij niet betalenvan de klant van de vertegenwoordigereen vergoeding eisen die het commissieloon nietoverschrijdt, tenzij bij grove fouten of nalatigheid.

8.11 Artikel 9

Indien de vertegenwoordiger niet in staat is klanten te bezoeken, heeft de werkgeverhet recht om dit zelf te doen of dit te laten doen door een door hem gekozen verte-genwoordiger. De plaatsvervanger heeft dan recht op het commissieloon van de doorhem afgesloten contracten. Indien er een betwisting bestaat beslist de klant door wiehij zich heeft laten overhalen om met Forest & Bold een contract af te sluiten.

8.12 Artikel 10

Tijdens en na de duur van zijn arbeid bij Forest & Bold is de vertegenwoordigergehouden tot geheimhouding inzake de fabricatiegeheimen en procedes, de klantenen de verkoopsvoorwaarden, die gebruikelijk zijn bij de onderneming. Alle informatie

HOOFDSTUK 8. ANALYSE VAN EEN ARBEIDSOVEREENKOMST 155

die hij van de werkgever ontvangt dient teruggegeven te worden bij het beeindigenvan het contract.

8.13 Artikel 11

Het is de vertegenwoordiger verboden om gedurende zijn werkzaamheid bij Forest& Bold, en 1 jaar daarna, arbeid te verrichten voor derden die concurrentie vormenvoor de onderneming. Hij mag tot 1 jaar na het beeindigen van zijn contract nietopnieuw werkzaam zijn in een onderneming in dezelfde sector.

Artikel 12 werd verwijderd

8.14 Artikel 13

De vertegenwoordiger bevestigt hiermee een kopie van het arbeidsreglement te hebbenontvangen.

8.15 Artikel 14

Na de proefperiode ontvangt de vertegenwoordiger een bedrijfswagen bestemd voorprofessioneel gebruik. De vertegenwoordiger dient de wagen goed te behandelen ener alle zorg voor te dragen dat de wagen de staat bewaart waarin hij zich bevindt.Indien de wagen de normale onderhoudsbeurten ondergaat zijn alle kosten voor dewerkgever, dit uitgezonderd voor boetes die ten laste van de werknemer vallen.

8.16 Artikel 15

De vertegenwoordiger en de werkgever aanvaarden de lijst die bij het contract zit.Deze lijst bevat de klanten van de onderneming in de sector aan de handelsvertegen-woordiger toegewezen. Hij kan deze lijst niet gebruiken voor prive-doeleinden, nochoverdragen aan derden, omdat de lijst eigendom van de onderneming blijft.

Hoofdstuk 9

Gebruikershandleiding Sims

Deze handleiding is bedoelt voor personen die Sims willen gebruiken om hun stockte beheren. Indien U aanpassingen wenst te maken aan Sims, kan U best ook deProgrammeurshandleiding lezen, deze geeft een overzicht van de in Sims aanwezigeklassen en hun functies.

9.1 Systeemvereisten

De minimum systeemvereisten van het besturingssysteem dat U draait volstaan.Een systeem waar Sims gegarandeerd op draait :

• Intel/AMD/VIA/Cyrix x86 compatibele CPU met 300 MhZ kloksnelheid

• 64 Mb SDRAM/EDORAM

• 10 Mb hardeschijf ruimte (meer is vereist voor de database)

• Een VGA scherm met een resolutie van 800x600. 1280x1024 is aanbevolen.

• Muis

9.2 Sims downloaden

9.2.1 Hoe downloaden

U kan de laatste versie van Sims vinden op http://users.skynet.be/bk317723/Sims.zipDit bestand bevat zowel de broncode als de uitvoerbare vorm van Sims.U klikt op de link hierboven, er zal een venster verschijnen : Klik op save. Daarnakiest u waar u het bestand wil opslaan en het downloaden begint.

156

HOOFDSTUK 9. GEBRUIKERSHANDLEIDING SIMS 157

9.2.2 Sims uitpakken

Nadat u Sims hebt gesaved, zal u het moeten uitpakken, u kan dit met het programmawinzip 8.0 doen, te vinden op www.winzip.com. Als u niet weet hoe u een zip bestandkan uitpakken, moet u eerst de Winzip handleiding lezen.

9.3 Sims installeren

9.3.1 Bestanden

Nadat u het programma hebt uitgepakt wordt er een map ”Sims” gemaakt metvolgende inhoud :

• Bas

• Bin

• Cls

• Doc

• Frm

• Prj

• Var

Indien u Sims enkel wil gebruiken zijn enkel de onderlijnde mappen van belang. InBin vindt u het uitvoerbare bestand (Sims.exe) en de bestanden die nodig zijn omSims te laten werken. In Doc bevindt zich de gebruikershandleiding voor Sims, dieu nu aan het lezen bent, alsook de programmeerhandleiding, die enkel van belang isals u Sims wil aanpassen.

9.3.2 Sims opstarten

Nu moet u de executable van Sims zoeken waar u deze geınstalleerd heeft, zie hiervoor de bijgevoegde schermafdruk, deze staat op pagina 161. De eerste keer dat Simsopstart moet het een database aanmaken. Dit is een eenmalige procedure. Om Simste starten dubbelklikt u op Sims.exe (zie p. 161)

U ziet dan het opstartlogo van Sims, dat stopt bij het openen van de database(schermafdruk UM2, p161)

Bij opening database staat een rood ”Failed”. Dit is normaal als u de eerste keeropstart. U kan nu een nieuwe database aanmaken door op ’new’ te klikken, en op

HOOFDSTUK 9. GEBRUIKERSHANDLEIDING SIMS 158

’save’ te klikken in het ”save as”dialoogvenster. U mag de database zelf een naamgeven of de standaardnaam gebruiken.Nota: Als u op ”open” klikt dan kan u een al bestaande database openen. Dit kanvan pas komen als u de map van Sims verplaatst hebt.Na deze stap start Sims gewoon verder op.

9.3.3 Mogelijke fouten

Er kunnen een aantal fouten optreden als u start :

• Het laden van de debugger faalt : waarschijnlijk start u Sims van een CDROMop, kopieer het programma naar de harde schijf, en zorg ervoor dat er schrijf-toegang in de map van Sims is. Dit doet u door op de map van Sims terechtsklikken → ”properties”, en dan het attribuut ”read-only”uit te zetten.Dit vakje ”Alleen lezen”moet uitgeschakeld zijn.( zie figuur UM3 op pagina163)

• Het laden van het configuratiebestand faalt : Dit kan enkel en alleen als hetbestand config.cfg in die map reeds bestaat en er lees, noch schrijfrechten opzijn. Dit kan bijna niet onopzettelijk voorkomen, mocht dit toch gebeuren,verwijder dan config.cfg, Sims zal dit bestand dan opnieuw aanmaken.

• Het laden van de database faalt, ondanks dat deze bestaat,dit kan veroorzaaktworden door vrij veel zaken :

- Geen leestoegang op het bestand.

- Het bestand is corrupt.

- Het bestand is reeds geopend.

Nu komt u in het hoofdscherm van Sims terecht. Voor een beeldafdruk hiervan kijkop pagina 163, UM4.

9.4 Configuratie

Sims is een complex programma dat zeer veel mogelijkheden heeft. De snelste manierom Sims aan uw wensen aan te passen is het configuratiebestand aan te passen. Ukan het configuratiebestand met eender welke text editor aanpassen, bijvoorbeeldnotepad. Het configuratiebestand bevindt zich in de directory van Sims en heetconfig.cfg.

HOOFDSTUK 9. GEBRUIKERSHANDLEIDING SIMS 159

9.4.1 Config.cfg

Regels die met ”#”beginnen zijn commentaar en worden genegeerd.Caption De titel van het hoofdformulierDatabase Het pad naar de database.ShowPartOnBoot Of het scherm met de onderdelen moet getoond worden bij

het opstarten. Dit mag enkel de waarde ’TRUE’ of ’FALSE’hebben.

ShowCustomersOnBoot Hetzelfde voor het scherm met de klantenlijstShowPCsOnBoot Hetzelfde voor het scherm met de ComputersShowInvoiceOnBoot Hetzelfde voor het scherm met facturenFieldNA Een woord waarmee u wilt aanduiden dat een veld leeg is.DefaultCurrency De ISO code van de munt waarmee u wil werken.

9.5 De klantenlijst

In dit scherm, dat u kan openen door in het hoofdscherm op Windows en dan opCustomers te klikken, beheert u uw klantenbestand. Centraal is een lijst van al uwklanten, onderaan ziet u hoeveel klanten er in de lijst zijn, en indien u op een klantgezocht hebt, hoeveel resultaten gevonden werden. De 2 balken bovenaan zijn voorhet beheren van de klanten.

9.5.1 Klanten toevoegen

Om een nieuwe klant te maken, klikt u op ’add’, er verschijnt dan een venster : Allevelden zijn optioneel, u mag invullen wat u wil. Indien u wilt aangeven dat een veldniet bestaat typt u het woord dat u in het configuratiebestand hebt gedefinieerd alszijnde ”fieldNA”. Dit is echter optioneel. Indien u meerdere klanten wil toevoegen,zet dan ”close on add” af, dan blijft het scherm open na het toevoegen van de klant;zodat u meteen een nieuwe kan bijvoegen. Indien u ”Clear on add” aanzet, danworden de velden leeggemaakt, dit is nuttig als het om een compleet andere klantbetreft, laat u het echter uitstaan dan blijven de velden behouden.

9.5.2 Klanten verwijderen

Om een klant te verwijderen, klikt u op deze in de lijst en daarna op delete, de klantwordt dan verwijderd. Deze mogelijkheid is niet beschikbaar als u op die momentde klant aan het bewerken bent.

HOOFDSTUK 9. GEBRUIKERSHANDLEIDING SIMS 160

9.5.3 Klantgegevens wijzigen

Indien u de gegevens van een klant wil wijzigen, dan klikt u op de klant en daarnaop ”edit”, u kan dan de foutieve velden wijzigen en daarna de klant terug toevoegen,analoog met het maken van een nieuwe klant.

9.5.4 Zoeken

Het kan nodig zijn om op een bepaald criteria klanten te zoeken indien de lijstuitgebreider wordt. Dan typt u gewoon in het tekstveld naast de knop ”search” determ die u wilt zoeken. Daarna klikt op search en in de lijst verschijnen enkel nog deklanten die ergens in hun gegevens die term bevatten. Wenst u opnieuw te zoekendan kan U deze procedure herhalen. Indien u terug alle velden wil klikt u op ”showall”.

Het vakje ”in result” is voor geavanceerde zoekopdrachten, stel u wenst een lijstvan alle klanten die Janssens heten, en die in Antwerpen wonen. Dan zoekt u eerstop Janssens : alle klanten met de naam Janssens blijven dan over. Indien u dan hetvakje ”in result” aankruist en zoekt op Antwerpen, dan blijven slechts degenen overdie in Antwerpen wonen.

HOOFDSTUK 9. GEBRUIKERSHANDLEIDING SIMS 161

UM Graph P1 (UM 1 & 2]

HOOFDSTUK 9. GEBRUIKERSHANDLEIDING SIMS 162

UM Graph P2 (UM 3 & 4]

HOOFDSTUK 9. GEBRUIKERSHANDLEIDING SIMS 163

UM Graph P3 (UM 5 & 6]

Hoofdstuk 10

Programmeurshandleiding Sims

10.1 Publiek van deze handleiding

Dit document is bedoelt voor redelijk ervaren VB programmeurs die aanpassingenwillen doen aan Sims, bijvoorbeeld om het programma aan te passen aan hun eigennoden, of fouten willen verbeteren. Voor U dit doet is het aan te raden om delicentie-overeenkomst door te lezen. Indien U simpelweg Sims wil leren gebruikenmoet u de Gebruikershandleiding lezen, en niet deze Programmeurshandleiding.

10.2 Licentieovereenkomst

Deze handleidingen zijn onderworpen aan de bepalingen gesteld in de GNU GeneralFree Documentation License (verie 2).

10.3 Licentieovereenkomst van Sims

Dit Programma is vrije software; u kan het verspreiden en/of wijzigen onder debepalingen van de GNU Algemene Publieke Licentie, zoals uitgegeven door de FreeSoftware Foundation; oftewel versie 2 van de Licentie,of (naar vrije keuze) een latereversie.

Dit Programma is verspreid met de hoop dat het nuttig zal zijn maar ZONDEREENDER WELKE GARANTIE; zelfs zonder de impliciete garantie van VERKOOP-BAARHEID of GESCHIKTHEID VOOR EEN BEPAALD DOEL. Zie de GNU Al-gemene Publieke Licentie voor meer details.

164

HOOFDSTUK 10. PROGRAMMEURSHANDLEIDING SIMS 165

10.4 Software vereisten voor Sims

Als U aanpassingen aan de broncode van Sims wil brengen hebt U eerst en vooralde broncode nodig die bij het pakket zit.

• Windows 95 of hoger (voor Windows NT4 is Service Pack 5 vereist)

• Visual Basic 6.0 Professional of Enterprise.

• Service Pack 5.0 voor Visual Basic 6.01

10.5 De broncode

10.5.1 Directory structuur van de bronbestanden

Als U de bestanden uitgepakt hebt uit het Winzip bestand, komen deze in een mapmet de naam ”Sims” en daarachter het versienummer. In deze map zitten de volgendesubdirectorys:

BAS In deze map zitten alle standaardmodule bestanden van Sims.

BIN In deze map zit een pregecompileerde versie van Sims.

CLS In deze map bevinden zich de klasse bestanden van Sims.

FRM Hier staan alle formulier-definitie bestanden.

PRJ In deze map zit het project bestand en het VB configuratie bestand voor Sims.

VAR In deze map vindt u de PSD versies van de logos alsmede alle tekstbestandenzoals de Readme en het Changelog.

10.5.2 Objecten & Functies

SyS

Het hoofdobject dat alle andere objecten bevat heet SyS, en wordt publiek gedecla-reerd in de module MEMCORE. Het is een type dat alle andere objecten bevat.

1U kan dit verkrijgen op www.microsoft.com

HOOFDSTUK 10. PROGRAMMEURSHANDLEIDING SIMS 166

DBG

DBG is van het type DBG CLASS, deze klasse dient om het debuggen van het Pro-gramma te vergemakkelijken. In het begin van het programma wordt dit objectgeınitialiseerd, het opent dan een bestand voor schrijven en schrijft daar de datumen het uur naar weg. De bestandsnaam is DEBUG en daarna de datum en het uur.Als het DBG niet lukt om een bestand te openen, zet het zijn publieke boolean’loadsucces’ op ’false’, anders op ’true’. Indien U functies aanroept als loadSuccesop ’false’ staat, worden deze genegeerd. Er is geen controle voorzien als u manueelloadSucces wijzigt en daarna functies aanroept. Indien het object vernietigd wordt,dan sluit het zijn debugbestand.

enterFunction

Elke functie van Sims begint met de regel SyS.DBG.enterFunction(functienaam)Deze functie schrijft dan weg in het debugbestand dat de functie werd aangeroepen,en verhoogt dan het aantal tabs voor een lijn geschreven wordt.

leaveFunction

Voor U een functie beeindigt moet u Leavefuntion aanroepen met dezelfde func-tie naam, het aantal tabs vermindert dan terug. Als u met een foutenafhandelaarwerkt, moet U ervoor zorgen dat ook daar leaveFunction wordt aangeroepen, an-ders klopt de structuur van het Debugbestand niet meer.

makeLogEntry

Met deze functie kan u een string naar keuze wegschrijven, deze bevindt zich danonder de aanroep van de laatste functie.

Maken en vernietigen van een Debugobject

Het standaardobject SyS.DBG wordt gemaakt en vernietigd in Main() enshutDownSys() respectievelijk, indien u om een uitzonderlijke reden een nieuw objectwil maken, kan u dit op volgende wijze :

Dim <varname> as DBG_CLASS

Set <varname> = new DBG_CLASS

Door dit te doen wordt een DBG object gemaakt en zijn constructor aangeroepen diehet bestand maakt. Vernietig voor het beeindigen van het programma zelfgemaakteobjecten met :

HOOFDSTUK 10. PROGRAMMEURSHANDLEIDING SIMS 167

Set <varnam> = Nothing

CFG

CFG is het object dat het configuratiebestand regelt. Het configuratiebestand iszeer belangrijk omdat er erg veel opties in opgeslagen zitten. Ik heb gekozen om tewerken met een configuratiebestand en niet met het register omdat dit prettiger isvoor geavanceerde gebruikers die graag zelf de configuratiebestanden aanpassen. Hetconfiguratie bestand heet config.cfg, u kan een andere naam kiezen als u daarvoorde broncode aanpast.

Constructie

Bij het initialiseren van het configuratiebestand wordt eerst gecontroleerd of hetbestand bestaat en of er leestoegang op is. Als dit niet het geval is, wordt net zoalsbij DBG de publieke boolean loadsucces op false gezet. Is het bestand leesbaardan wordt het lijn per lijn ingelezen. Regels die beginnen met een hekje (#) wordengenegeerd, andere regels worden behandeld. Een regel bestaat altijd uit een woord,daarna een ’=’ en daarna een waarde of weer een woord. Regels zonder ’=’ zijnongeldig en worden genegeerd. Indien het eerste woord herkend wordt, dan wordtde waarde achter het ’=’ teken in de correcte variable opgeslagen. Deze variablenbevinden zich in SyS.Config

SyS.Config

SyS.Config, is een type dat de variabelen bevat die worden ingevult door CFG bijhet starten van het Programma. Bij het afsluiten worden deze waarden weggeschre-ven in het configuratiebestand. SyS.Config wordt gedefineerd als een CONFIG TPin Memcore.bas.

Destructie

Bij destructie wordt het configuratiebestand weggeschreven. Indien er hierbij eenfout optreedt, wordt dit weggeschreven in de debugbestanden.

On the fly aanmaken van de config file

Indien bij het laden van Sims het configuratiebestand niet gevonden wordt, wordthet object vernietigd waardoor de standaardwaarden worden weggeschreven, daarnawordt nog een maal geprobeerd om het terug aan te maken, indien dit lukt wordt ergewoon voortgegaan met het laden.

HOOFDSTUK 10. PROGRAMMEURSHANDLEIDING SIMS 168

DBS

DBS is de klasse die met de database communiceert. Ik heb gekozen om de reedszeer abstracte JET-engine nogmaals te omwikkelen met een API (DBS), omdat mendan vrij makkelijk Sims zou kunnen aanpassen om bvb. ADO ipv DAO te gaangebruiken, of nog extremer, men zou DBS kunnen laten communiceren met een DBSserver (die u dan ook moet schrijven) om zo de database door meerdere gebruikerste laten gebruiken over internet of netwerk.

De database heeft deze mogelijkheid : als een veld in gebruik is krijgt de desbe-treffende record de status ’LOCKED’, dit wordt in beperkte mate slechts gebruiktdoor Sims, maar U hoeft dan geen locking mechanisme meer te maken als u netwerkfunctionaliteit wenst. In praktijk wordt dan het veld ’LOCKED’ van een record inrecordset op een waarde anders dan 0 gesteld. De functies setLock(), clearLock()

en isLocked() bedienen dit mechanisme in elke Sims versie hoger dan 0.1.1-pre6.

Constructie

Bij het maken van het DBS object, gaat DBS kijken in SyS.Config, waar de da-tabase gevonden zou moeten worden, het zal dan proberen het private DB objectin DBS te maken, en indien dit lukt de recordsets verbinden. Bij succes wordt netzoals bij de andere klassen de publieke boolean loadSucces op ”true” gezet. Indienhet mislukt hebt u de interessante mogelijk om een nieuwe database te maken metmakeNewDBase

makeNewDBase

Make newDBase neemt een string als argument, die een niet bestaand bestand zoumoeten zijn. Indien het bestand niet bestaat en de schijf schrijfbaar is creeert DBS ereen nieuwe Sims compatibele maar lege database. In plaats van een nieuwe databasete maken kan u ook altijd dezelfde truc toepassen als met CFG door SyS.Config aante passen en proberen DBS opnieuw te maken. Dit wordt toegepast in de ”Open”knop op het Splash screen, als er geen database gevonden wordt.

I/O Functies

De I/O functies werken allemaal hetzelfde. Om een record te lezen gebruikt u<tablename> PEEK(UIN,ABS), met UIN xOr ABS niet (-1) als waarde hebbend. Deandere functies nemen enkel een UIN als argument.

• <tablename> EDIT(UIN) Record overschrijven met DBBuf.

• <tablename> POKE(VOID)Record toevoegen.

HOOFDSTUK 10. PROGRAMMEURSHANDLEIDING SIMS 169

• <tablename> DEL(UIN)Record verwijderen. (Status<<1;).

• <tablename> <tablespecific>(UIN || VOID)

De eigelijke datatransfer gebeurt in het globale object SyS.DBbuf, u moet hier oplet-ten voor datacorruptie! Na een aanroep van DBS kan u de gehele DBBuf niet meergebruiken. Als u toch DBS calls wil uitsparen moet U zich eerst grondig bekendmaken met de desbetreffende functies.

Destructie

Bij het vernietigen van het DBS object ( door set <object> = Nothing ) wordtde database weggeschreven en gesloten. Omdat Sims niet multithreaded is, is hettheoretisch mogelijk om dit tijdens de uitvoer van het programma te doen, u moetdan echter er wel voor zorgen dat alle database gerelateerde controls disabled zijnomdat er niet gecontroleerd wordt tijdens uitvoer of DBS daadwerkelijk een geldigDBS CLASS object is.

FRM

FRM is een type dat pointers naar formulieren bevat, u moet indien u een nieuwformulier invoegt het type aanpassen en in de functie Main() en Init.bas ervoor zorgendat de pointer ingesteld wordt dmv:

SyS.FRM.<FORM> = <object as form>

DBBuf

Door de bekende beperking in Visual Basic dat er geen zelfgemaakte types als argu-ment kunnen worden meegegeven in niet publieke klassen, is men verplicht om eenGlobal Buffer Systeem te gebruiken. Dit houdt in dat indien u bijvoorbeeld iets wilschrijven in de database u eerst de relevante waarden van DBBuf moet invullen endan pas de juiste functie van DBS kan aanroepen. Bij het lezen moet u eerst defunctie aanroepen (meestal is het argument de UIN(Unique Identification Number))waarna de waarden in SyS.DBBuf.* verschijnen.

SySBuf

SySBuf is een globale vuilnisbak voor allerhande variabelen die u nodig hebt tijdensuitvoer die niet lokaal is. Probeer zo weinig mogelijk data hier bij te maken aangeziendeze altijd bestaan en dus permanent RAM geheugen innemen. SySBuf wordt zoalselke globaal type gedefinieerd in de Memcore.bas.

HOOFDSTUK 10. PROGRAMMEURSHANDLEIDING SIMS 170

Lobj

In Lobj staan enkel booleaanse waarden om aan te duiden of een bepaald for-mulier geladen is of niet. Dit omslachtige mechanisme is nodig omdat de functieisLoaded(obj) het formulier laadt in plaats van weer te geven of het geladen is. Dewaarden worden gewijzigd in de Form Load en de Form QueryUnload gebeurtenis-sen.

Iobj

Iobj dient dezelfde functie als FRM maar dan voor widgets op het scherm. Dit objectbestaat omwille van gebruiksgemak, omdat de Intellisense van VB niet weet welkeobjecten op een pointer staan. Dwz dat als ik een textbox(txtTest) plaats op frmX,dan gaat frmX.txtTest in de lijst komen, maar niet in de lijst van SyS.FRM.X.,alhoewel een referentie naar SyS.FRM.X.txtTest wel zal werken tijden uitvoer vanhet programma.

10.5.3 Gebeurtenissen afhandelen

Om de code puur en modulair te houden heb ik ervoor gekozen om in het eventzelf een funtie aan te roepen die de gebeurtenis afhandelt. Dit laat hergebruik vandeze functie makkelijker toe. Hiermee vermijden we overladen formulieren vol metonoverzichtelijke code, waar deze nu zoveel opgesplitst kan worden als men wenst.

Modules

Voor elk formulier worden er 2 modules aangemaakt, de modulenaam is de naamvan het formulier, zonder de prefix, met ’EV’ erachter (EVENT) en nog een modulemet ’F’ erachter (FUNCTIONS). Dus bijvoorbeeld de modules voor frmSplash zijnSplashEV en SplashF.

Functies

Voor elke gebeurtenis moet een corresponderende functie bestaan, deze is de naamvan het formulier zonder prefix, een underscore (’ ’), de naam van het object, zonderprefix, weer een underscore, en uiteindelijk de naam van de gebeurtenis. Voorbeeld,op het formulier frmMain staat een textbox, txtTest, die van waarde veranderd;de corresponderende functienaam is dan Main Test Change().

HOOFDSTUK 10. PROGRAMMEURSHANDLEIDING SIMS 171

10.5.4 Formulieren en andere bestanden

Bestandslayout

Elke bronbestand moet met de Engelse disclaimer van de GPL (GNU General PublicLicense) beginnen. De bestandsnaam moet ingevuld zijn alsmede de naam van hetobject en een korte beschrijving. Voorbeeld :

*********************************************************************************** * ** JDP Sims 0.1 - Stock & Invoice Management System. ** Copyright (C) 2002 Lennart Yseboodt. ** ** =================================================== ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License ** as published by the Free Software Foundation; either version 2 ** of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** FILENAME : INIT.bas ** OBJECT : INIT ** DESCRIPTION : Basic boot/shutdownsystem ** ***********************************************************************************

Functielayout

Elke functie moet worden voorafgegaan door een beschrijving :

********************************************************** Sims 0.1 ** FUNCTION/SUB NAME : main ** SCOPE : Private ** DESCRIPTION : Boot function() **********************************************************

Klasse bestanden

De naam van een klasse bestand moet altijd eindigen op ’ CLASS’.

HOOFDSTUK 10. PROGRAMMEURSHANDLEIDING SIMS 172

Type definities

De naam van een type moet altijd eindigen op ’ TP’.

10.5.5 Modificaties in de hoofdcode invoeren

Indien U een wijziging aan Sims gemaakt hebt die van algemeen nut is, dan kan ualtijd de gewijzigde broncode opsturen naar de auteur, [email protected] als U aan de voorgaande regels voor het maken van code hebt voldaan zal uwbijdrage in de code worden opgenomen. De code zal enkel bijgevoegd worden indienhij van algemeen nut is, zorg er ook voor dat U de laatste versie van Sims aanpast.Er kan pas externe code worden geaccepteerd na juli 2002.

Licentiewaarschuwing

Indien u niet bekent bent met de GNU GPL moet U hetvolgende weten :

• Alle modificaties aan Sims vallen automatisch ook onder de GPL.

• U bent verplicht de gewijzigde code beschikbaar te stellen aan derde partijen.

• Men mag Uw code gebruiken in andere Vrije Programma’s

Voor U de code wijzigt is het ten zeerste aan te raden om het licentiedocument telezen.

Hoofdstuk 11

Besluit

Ik vond de GIP buitengewoon nuttig en ik heb er veel van geleerd. Eerst en vooralheb ik op 2 jaar tijd een aanzienlijke ervaring met Visual Basic opgebouwd. Dit isgeen goede taal, maar voor RAD1 is ze onversmaadbaar.

Ik heb meer begrip gekregen voor puur object georienteerd programmeren, en hebdit proberen toe te passen in Sims. Ik heb de drag & drop techniek van Windowsgeleerd, deze wordt in de GIP intensief gebruikt.

Ik heb de opmaaktaal LATEX geleerd, daardoor was het maken van deze eindbundeleen puur plezier. Later zal dit me ook nog van pas komen bij het schrijven vanhandleidingen, thesissen en andere documenten. Ik ben gespaard gebleven van defrustraties waar men mee te kampen heeft als met een WYSIWYG editor gebruikt.

Er zijn een aantal misstappen geweest, waaronder Sims 0.1.0. Deze versie wasvan bij het begin te dode opgeschreven, er werd gebruik gemaakt van een beta versievan ADO, waarvan de wrapper zich dan nog in een externe DLL bevond.

Al met al is de GIP iets geworden waar ik trots op ben, een bundel (bijna) vollediggeschreven met Vrije Software en het resultaat is zelf Vrije Software.

Nothing would please me more than being able to hire tenprogrammers and deluge the hobby market with good software.

- Bill Gates 1976

We are still waiting...- Alan Cox 2002

1Rapid Application Developement

173

Deel III

Bijlagen

174

Hoofdstuk 12

Facturen

FontShop

175

HOOFDSTUK 12. FACTUREN 176

IT Pro

HOOFDSTUK 12. FACTUREN 177

Polygoon

HOOFDSTUK 12. FACTUREN 178

Duerinck Foto

HOOFDSTUK 12. FACTUREN 179

Lithos Factuur 00884/01

HOOFDSTUK 12. FACTUREN 180

Lithos Factuur 02189/01

HOOFDSTUK 12. FACTUREN 181

Enfa fact

HOOFDSTUK 12. FACTUREN 182

Ass factuur

HOOFDSTUK 12. FACTUREN 183

Emico NV

HOOFDSTUK 12. FACTUREN 184

Lefevre Beel NV

HOOFDSTUK 12. FACTUREN 185

Creditnota Lithos

HOOFDSTUK 12. FACTUREN 186

Rockwell Fact 08/1408

HOOFDSTUK 12. FACTUREN 187

Rockwell Fact 09/1409

HOOFDSTUK 12. FACTUREN 188

Marcq & Roba

HOOFDSTUK 12. FACTUREN 189

Telenet Operaties NV

HOOFDSTUK 12. FACTUREN 190

Totte

HOOFDSTUK 12. FACTUREN 191

Creditnota Rockwell

Hoofdstuk 13

Jaarrekeningen

2k-1

192

HOOFDSTUK 13. JAARREKENINGEN 193

2k-2

HOOFDSTUK 13. JAARREKENINGEN 194

2k-3

HOOFDSTUK 13. JAARREKENINGEN 195

2k-4

HOOFDSTUK 13. JAARREKENINGEN 196

2k-5

HOOFDSTUK 13. JAARREKENINGEN 197

21k-1

HOOFDSTUK 13. JAARREKENINGEN 198

21k-2

HOOFDSTUK 13. JAARREKENINGEN 199

21k-3

HOOFDSTUK 13. JAARREKENINGEN 200

21k-4

Hoofdstuk 14

GNU Algemene Publieke Licentie

14.1 English disclaimer

This is an unofficial translation of the GNU General Public License into Dutch. Itwas not published by the Free Software Foundation, and does not legally state thedistribution terms for software that uses the GNU GPL–only the original Englishtext of the GNU GPL does that. However, we hope that this translation will helpDutch speakers understand the GNU GPL better.

14.2 Nederlandse waarschuwing

vertaling GPL Dit is een niet officiele vertaling van de GNU Algemene Publieke Li-centie in het Nederlands. Deze licentie is niet gepubliceerd door de Free SoftwareFoundation, de condities van software onder de GPL hieronder zijn niet rechtsgeldig.Enkel de originele Engelse tekst van de GNU GPL bevat geldige richtlijnen. Daar-entegen hopen we dat deze vertaling de Nederlandstaligen helpt om de GNU GPLbeter te begrijpen.

14.3 Auteursrecht

Auteursrecht (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite330, Boston, MA 02111-1307 USA Het is eenieder toegestaan om dit licentiedocumentte kopieren en er letterlijke kopieen van te verspreiden, maar het te veranderen isverboden.

201

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 202

14.4 Voorwoord

De licenties van de meeste software zijn zo opgesteld om U het recht te ontnemen omdie software te delen en te wijzigen. Hier tegenover staat de GNU Algemene PubliekeLicentie, die bedoeld is om U de vrijheid te garanderen dat U de software kan delenen wijzigen – om er zeker van te zijn dat de software vrij is voor alle gebruikers. DezeAlgemene Publieke Licentie is van toepassing op het merendeel van de Free SoftwareFoundation’s software en van alle andere programma’s waarvan de auteur ze plaatstonder deze licentie. (Sommige software van de Free Software Foundation is gedektdoor de GNU Algemene Minder Publieke Licentie). U kan deze ook toepassen op uweigen programma’s.

Wanneer we het hebben over vrije software, dan hebben we het over vrijheid, nietprijs. Onze Algemene Publieke Licentie laat u toe om kopieen te verspreiden vanvrije software (en dat U geld kan vragen voor deze dienst) en dat U er de broncodevan hebt of kan krijgen als U dat wenst, dat U de software kan wijzigen of er delenvan kan gebruiken in nieuwe vrije programma’s en dat U weet dat U deze dingen kandoen.

Om deze rechten te beschermen, moeten we verbieden dat iemand U deze rechtenontzegt of vraagt deze op te geven. Deze restricties brengen enkele verantwoordelijk-heden mee indien U kopieen van de software verspreidt of de software wijzigt.

Bijvoorbeeld, als U kopieen van zulk programma verspreidt, kostenloos of vooreen vergoeding, dan moet U de personen die de software ontvangen al de rechtengeven die U hebt. U moet uzelf ervan verzekeren dan ook zij de broncode ontvangenof kunnen verkrijgen. U moet hen ook deze licentie tonen zodat ze hun rechtenkennen.

We beschermen uw rechten met twee stappen

1. de software wordt auteursrechtelijk beschermd, en

2. we bieden U deze licentie die U de legale toestemming geeft om de software tekopıeren, te verspreiden en/of te wijzigen.

Alsook willen we voor de bescherming van de auteur en onszelf iedereen ervan ver-zekeren dat er geen garantie is voor deze vrije software. Als de software gewijzigd isdoor iemand anders en doorgegeven, dan willen we dat de ontvanger weet dat wat zeontvangen hebben niet het origineel is, zodat problemen veroorzaakt door anderengeen effect hebben op de reputatie van de oorspronkelijke auteur.

Ten laatste, elk vrij programma wordt voortdurend bedreigd door software paten-ten. We wensen het gevaar te vermijden dat de verdelers van een vrij programmauiteindelijk een patent verkrijgen op het programma en het daarmee in eigendom vaneen particulier brengen. Om dit te vermijden, hebben we het duidelijk gemaakt dat

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 203

elk patent in licentie gegeven moet zijn voor eenieders vrij gebruik, oftewel helemaalniet in licentie gegeven mag zijn.

De exacte bepalingen en condities om te kopieren, verspreiden en wijzigen volgenhieronder.

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 204

14.5 Bepalingen en voorwaarden

0. Deze licentie is van toepassing op elk programma of ander werk dat een notie be-vat van de eigenaar die zegt dat het verspreid mag worden onder de bepalingenvan deze licentie. Het ”Programma”, verder in de tekst, verwijst naar eenderzulk programma of werk, en een ”werk gebaseerd op het programma”verwijstnaar het Programma of eender welk ander afgeleid werk onder de wet van hetauteursrecht: dit wil zeggen, een werk dat het Programma of een deel ervanbevat, letterlijk oftewel gewijzigd en/of vertaald naar een andere taal. (Hiernavallen vertalingen zonder beperking onder de term ”wijziging”.) Elke licen-tiehouder wordt geadresseerd als ”u”.

Andere handelingen dan kopieren, verspreiden en wijzigen zijn niet gedekt doordeze licentie; hiervoor is deze licentie niet bedoeld. De handeling om het Pro-gramma uit te voeren is niet gelimiteerd, en de uitvoer van het Programma isenkel gedekt als de inhoud bestaat uit een werk gebaseerd op het Programma(onafhankelijk of deze uitvoer gemaakt is door het Programma uit te voeren).Of dit waar is hangt af van wat het Programma doet.

1. U mag letterlijke exemplaren verspreiden van de programma broncode en dezekopieren zoals U deze ontvangt, in eender welke vorm, op voorwaarde dat Uervoor oplet dat U op elke kopie de gepaste auteursrechten en afwijzing vangarantie vermeldt; hou alle referenties naar deze licentie en naar het ontbrekenvan garantie intact ;en geef aan elke andere ontvanger van het Programma eenkopie van deze licentie, bijgevoegd bij het Programma.

U mag een honorarium vragen voor de fysische daad van het afleveren van eenkopie, en U mag indien U dat wenst een garantie bescherming bieden voor eenhonorarium.

2. U mag uw kopie of kopijen van het Programma, of een deel van het Programma,wijzigen, daarbij een werk gebaseerd op het Programma vormend. U magdeze wijzigingen kopieren en verspreiden onder de bepalingen van Paragraaf 1hierboven, indien U ook aan al deze voorwaarden voldoet:

a) U moet in de gewijzigde bestanden duidelijk vermelden dat U het bestandgewijzigd hebt en de datum waarop U dat gedaan hebt.

b) U moet elk werk dat U publiceert of verspreidt en dat volledig of gedeel-telijk bestaat uit het Programma, of daarvan een afgeleid werk is, als eengeheel in licentie geven, zonder kosten, aan alle derde partijen onder debepalingen van deze Licentie.

c) Indien het gewijzigde Programma normaal gezien interactief parametersinleest, dan moet U er voor zorgen dat wanneer het Programma zon-

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 205

der deze parameters gestart wordt, het een boodschap weergeeft met eengepast auteursrechtbericht en een mededeling dat er geen garantie is (ofanders, dat U een garantie voorziet) en dat gebruikers het Programmamogen verspreiden onder deze voorwaarden. De boodschap moet de ge-bruiker ook duidelijk maken hoe hij een kopij van deze Licentie kan bek-ijken. (Uitzondering : als het Programma zelf interactief is en normaalgeen boodschap toont, dan is het niet vereist dat uw werk gebaseerd opdit Programma zulk een boodschap weergeeft.

Deze vereisten zijn van toepassing op het werk als een geheel. Als herkenbarestukken van dat werk niet afgeleid zijn van het Programma, en redelijkerwijsonafhankelijk beschouwd kunnen worden, dan is deze licentie, en zijn bepalin-gen, niet van toepassing op die delen als U die als aparte werken verspreidt.Maar als U die zelfde delen verspreidt als deel van een geheel dat een werk isgebaseerd op het Programma, dan moet de verspreiding van het geheel op debepalingen van deze licentie geschieden, dewelke’s vergunningen voor anderelicentiehouders zich uitbreiden tot het volledige geheel, en dus tot elke deel vanhet werk, onafhankelijk van wie het geschreven heeft.

Dus, het is niet de bedoeling van deze sectie om uw rechten op te eisen of tewedijveren om uw rechten op werk dat geheel door uzelf geschreven is, het iseerder de bedoeling het recht controle uit te oefenen mogelijk te maken op deverspreiding van afgeleide of collectieve werken gebaseerd op het Programma.

Daarenboven, de bundeling van een werk niet gebaseerd op het Programmamet het Programma (of met een werk gebaseerd op het Programma) op eenopslagmedium of verspreidingsmedium brengt het ander werk niet onder dezelicentie.

3. U mag het Programma, of een werk gebaseerd op het Programma, zie paragraaf2, verspreiden en kopieren, in binaire of uitvoerbare vorm onder de bepalingenvan paragraaf 1 en 2 hierboven, op voorwaarde dat U aan een van de volgendevoorwaarden voldoet :

a) Voeg een volledige overeenkomende broncode bij, leesbaar door computers,verspreid onder de bepalingen van de paragrafen 1 en 2, op een mediumdat gebruikelijk is voor het uitwisselen van software; of,

b) Voeg een voor minstens 3 jaar geldige, geschreven, offerte bij, om de com-plete overeenstemmende broncode, op een medium dat hiervoor gebruike-lijk is, voor Computers leesbaar, verspreidbaar onder de bepalingen vande paragrafen 1 en 2 hierboven, aan elke derde partij te leveren, vooreen vergoeding die niet meer bedraagt dan de kost om de broncode tekopieren.

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 206

c) Voeg de informatie bij die U ontving betreffende het aanbod om de bij-passende broncode te verkrijgen. (Dit alternatief is enkel toegestaan voorniet commerciele verspreiding en enkel als U het programma in binaireof uitvoerbare vorm ontving met zulk een aanbod, in overeenstemmingmet subparagraaf b erboven.) De broncode van een werk is de vormvan het werk waaraan voorkeur wordt gegeven om er wijzigingen in aante brengen. Voor een uitvoerbaar werk betekent volledige broncode allecode van alle modules waar het werk uit bestaat, en daarbovenop alledefinitie bestanden van de interface(s) en alle scripts om het programmate compileren en het uitvoerbare bestand te installeren. Als een speci-ale uitzondering moet de verspreide broncode niets bevatten dat normaalverspreid (in broncode of uitvoerbare vorm ) wordt met de hoofdcompo-nenten (compiler, kernel, enz...) van het besturingssysteem op dewelkehet Programma draait, tenzij die component bij het uitvoerbare bestandzit.

Als verspreiding van een uitvoerbaar bestand of binaire code mogelijk gemaaktwordt door toegang tot het kopieren van een vooraf bepaalde plaats, dan telthet mogelijk maken de broncode van diezelfde plaats te kopieren als het ver-spreiden van de broncode, zelfs indien het mee kopieren van de broncode op-tioneel is.

4. U mag het Programma niet kopieren, wijzigen, verder in licentie geven of ver-spreiden behalve zoals expliciet vermeld in deze licentie. Eender welke pogingom het programma op een andere manier te kopieren, wijzigen, verder in li-centie geven of verspreiden is ongeldig en verklaart automatisch uw rechtenbepaald in deze licentie nietig. Derde partijen die kopieen of rechten van Uhebben ontvangen onder deze licentie blijven hun rechten behouden zolang zede voorwaarden niet schenden.

5. U bent niet verplicht deze licentieovereenkomst te accepteren, aangezien U dezeniet ondertekend hebt. Echter, niets anders geeft U de toestemming om hetProgramma of werken gebaseerd op het Programma te wijzigen of te versprei-den. Deze daden zijn door de wet verboden als U deze licentieovereenkomstniet accepteert. Daarom geeft u aan dat door het Programma te verspreidenof te wijzigen, U deze licentie, en al zijn voorwaarden en bepalingen in verbandmet kopieren, wijzigen of verspreiden van het Programma, of werken gebaseerdop het Programma, accepteert om dat te kunnen doen.

6. Elke keer U het Programma (of een werk gebaseerd op het Programma) ver-spreidt, krijgt de ontvanger automatisch een licentie van de originele licen-tiehouder om het Programma te kopieren, verspreiden of wijzigen, onderworpen

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 207

aan deze bepalingen en voorwaarden. U mag de ontvanger geen beperkingenopleggen om de rechten uit te oefenen die hierin bepaald zijn.

7. Als door gevolg van een rechterlijke uitspraak of beweringen van patenten-schending of door eender welke andere reden (niet beperkt tot patentenproble-men) U bepalingen worden opgelegd (door rechterlijk bevel, overeenkomst, ofop andere wijze) die in tegenspraak zijn met bepalingen in deze licentie, dansluit dat U niet uit om aan de voorwaarden van deze licentie te voldoen. Als Uhet Programma niet kan verspreiden en daarbij zowel aan tegelijk de bepalin-gen van deze licentie als aan andere relevante verplichtingen kan voldoen, danmag U als gevolg daarvan het Programma helemaal niet verspreiden. Bijvoor-beeld, als een patent licentieovereenkomst niet zou toestaan dat het programmazonder het betalen van royalty’s vrij verspreid mag worden door zij die het Pro-gramma direct van U verkrijgen en zij die het indirect door U verkrijgen, danis de enige manier om zowel daaraan als aan deze licentie te voldoen dat U zichcompleet onthoudt van het verspreiden van het Programma.

Als een deel van dit artikel ongeldig wordt geacht, of het kan niet afgedwon-gen worden onder bepaalde omstandigheden dan is het de bedoeling dat hetoverwicht van dit artikel van toepassing is. In andere omstandigheden geldtdit artikel volledig.

Het is niet het doel van dit artikel om u er toe aan te zetten om patenten, ofandere aanspraken van bezit, te schenden of de geldigheid van zulke aansprakenaan te vechten. Het enige doel van dit artikel is om de integriteit te beschermenvan het vrije software verspreidingssysteem, dat wordt toegepast door middelvan Publieke Licentie praktijken. Veel mensen hebben royale bijdragen geleverdaan het systeem van vrije software rekenend op de betrouwbaarheid van zijntoepassing. Het is aan de auteur/donor om te bepalen of hij of zij bereidt is omsoftware te verspreiden door middel van een ander systeem en een gelicensieerdekan die keuze niet afdwingen.

Dit artikel is bedoeld om zeer duidelijk te maken wat geloofd wordt een gevolgte zijn van de rest van deze licentie.

8. Als de verspreiding of het gebruik van het Programma gelimiteerd is in bepaaldelanden, door patenten of door samenwerking van auteursrechthouders, dan magde oorspronkelijke auteursrechthouder die het Programma onder deze licen-tie plaatste een expliciete geografische beperking toevoegen zodat verspreidingenkel toegestaan is in of tussen landen die niet uitgesloten zijn. In dat gevalbevat deze licentie de beperking alsof ze in de kern van deze licentie geschrevenwas.

9. De Free Software Foundation mag gereviseerde en/of nieuwe versies van de

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 208

Algemene Publieke Licentie uitbrengen van tijd tot tijd. Zulke nieuwe ver-sies zullen gelijkaardig in karakter zijn in vergelijking met de huidige versiemaar kunnen in details verschillen om nieuwe problemen of aangelegenhedente behandelen. Elke versie krijgt een expliciet versienummer mee. Als het Pro-gramma een versie van deze licentie specificeert waarop het van toepassing is enelke volgende versie”, dan hebt U de keuze om de bepalingen en voorwaardenvan die licentie te volgen, of van eender welke versie die later uitgegeven werddoor de Free Software Foundation. Als het programma geen versie nummervan de licentie specificeert, dan mag U de bepalingen en voorwaarden volgenvan eender welke versie ooit uitgegeven door de Free Software Foundation.

10. Indien U delen van het Programma wil invoegen in andere vrije Programma’sdewelke’s verspreidingsvoorwaarden anders zijn, dan moet U de auteur van datprogramma om toestemming vragen. Voor software waarvan het auteursrechtbij de Free Software Foundation rust, schrijf naar de Free Software Foundation;we maken hier soms uitzonderingen op. Onze beslissing zal geleid worden dooronze twee hoofddoelen om de vrije status van de afgeleiden van onze vrijesoftware te vrijwaren en om het delen en hergebruiken van software in hetalgemeen te promoten.

11. OMDAT HET PROGRAMMA ZONDER KOSTEN IN LICENTIE GEGE-VEN WORDT, IS ER GEEN GARANTIE VOOR HET PROGRAMMA,VOOR ZOVER MOGELIJK BINNEN DE GELDENDE WETGEVING.UITGEZONDERD WANNEER HET EXPLICIET GESCHREVEN STAATLEVEREN DE AUTEURSRECHTHOUDERS HET PROGRAMMA ”ZO-ALS HET IS”, ZONDER EENDER WELKE GARANTIE, EXPLICIETUITGEDRUKT OF IMPLICIET BEDOELD, ZOALS, MAAR NIET GELIMI-TEERD TOT, DE IMPLICIETE GARANTIES VAN VERKOOPBAARHEIDEN GESCHIKTHEID VOOR EEN BEPAALD DOEL. HET VOLLEDIGERISICO BETREFFENDE DE KWALITEIT EN DE PRESTATIES VAN HETPROGRAMMA LIGT BIJ U. MOCHT HET PROGRAMMA DEFECT BLI-JKEN DAN DRAAGT U DE KOSTEN VAN ALLE BENODIGDE DIEN-STEN, REPARATIES OF CORRECTIES.

12. IN GEEN ENKEL GEVAL, TENZIJ VEREIST DOOR DE GELDENDEWET, OF SCHRIFTELIJK OVEREENGEKOMEN ZAL DE AUTEURS-RECHTHOUDER, OF EENDER WELKE DERDE PARTIJ DIE HETPROGRAMMA MAG WIJZIGEN EN/OF VERSPREIDEN ZOALS TOE-GESTAAN HIERBOVEN, VERANTWOORDELIJK KUNNEN WORDENGEACHT TEGENOVER U BETREFFENDE ALGEMENE, SPECIALE,UITZONDERLIJKE OF RESULTERENDE SCHADE DIE VOORTVLOEITUIT HET GEBRUIK, OF DE ONKUNDIGHEID OM HET PROGRAMMA

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 209

TE GEBRUIKEN (INCLUSIEF, MAAR NIET GELIMITEERD TOT HETVERLIES VAN GEGEVENS, GEGEVENS DIE CORRUPT WORDEN, OFVERLIEZEN GELEDEN DOOR U OF DERDE PARTIJEN OF EEN FALINGVAN HET PROGRAMMA OM SAMEN TE WERKEN MET ANDERE PRO-GRAMMA’S), ZELFS INDIEN DE AUTEURSRECHTHOUDER OF EENANDERE PARTIJ GEINFORMEERD WAS OVER DE MOGELIJKHEIDTOT ZULKE SCHADE.

14.6 Deze bepalingen op uw nieuwe Programma

toepassen.

Als U een nieuw Programma ontwikkelt en U wenst dat het van het grootst mogelijknut is voor iedereen, dan is de beste manier om dit te bereiken door het Programmavrije software te maken dewelke iedereen kan verspreiden en wijzigen onder dezebepalingen. Om dit te doen, voeg volgende boodschap toe aan het Programma.Het is het veiligst om ze in te voegen aan het begin van elk bronbestand, dit omhet ontbreken van garantie duidelijk te maken; en elk bestand zou minstens de -auteursrecht”lijn en een directief naar waar de volledige boodschap gevonden kanworden moeten bevatten.

<een regel voor de naam van het Programma en zijn doel>Auteursrecht (C) <jaar> <naam van de Auteur>

Dit Programma is vrije software; U kan het verspreiden en/of wijzigen onder de bepa-lingen van de GNU Algemene Publieke Licentie, zoals uitgegeven door de Free SoftwareFoundation; oftewel versie 2 van de Licentie,of (naar vrije keuze) een latere versie.

Dit Programma is verspreid met de hoop dat het nuttig zal zijn maar ZONDER EEN-DER WELKE GARANTIE; zelfs zonder de impliciete garantie van VERKOOPBAARHEIDof GESCHIKTHEID VOOR EEN BEPAALD DOEL. Zie de GNU Algemene Publieke Li-centie voor meer details.

U zou een kopie van de GNU Algemene Publieke Licentie ontvangen moeten hebbensamen met dit Programma; indien dit niet zo is, schrijf naar de Free Software Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

Voeg ook informatie bij hoe men U kan contacteren via e-mail en gewone post. Alshet Programma interactief is, laat het een korte boodschap tonen zoals deze wanneerhet in interactieve modus start:

Fiscus versie 69, Auteursrecht (C) <jaar> <naam v/d auteur>

HOOFDSTUK 14. GNU ALGEMENE PUBLIEKE LICENTIE 210

Fiscus komt met ABSULUUT GEEN GARANTIE; voor details typ ’toon w’. Dit is vrijesoftware en het is U toegestaan deze te verspreiden onder bepaalde voorwaarden;typ ’toonc’ voor meer details.

U zou ook uw werkgever (indien U als programmeur werkt) of uw school, indiendie er is, om een auteursrecht afwijzing”te laten tekenen voor het Programma, in-dien nodig. Hier is een voorbeeld; wijzig de namen:

Yoyodyne, NV., verwerpt hier alle auteursrechtlijk interesses in het Programma Fiscus(dat belastingsaangiften invult) geschreven door James Hacker.

<handtekening van Ty Coon>, 21 April 1984 Ty Coon, Vice voorzitter.

Deze Algemene Publieke Licentie laat niet toe dat het Programma verwerkt wordtin een commercieel programma. Als uw Programma een subroutine bibliotheek is,dan kan U het misschien nuttige beschouwen om toe te staan dat uw Programmagelinkt word met commerciele programma’s. Als dat is wat U wil doen, dan moet Ude GNU Algemene Minder Publieke Licentie gebruiken in plaats van deze licentie.

Index

API0, 19auteursrecht, 202

Bas, 157Bin, 157

CFG CLASS, 21Cls, 157comissieloon, 154config.cfg, 158, 159, 167current ratio, 8, 12Customers ADDEDEV, 30Customers ADDEDF, 28CustomersEV, 34CustomersF, 39

database, 157DBBuf, 169DBG CLASS, 43DBS CLASS, 48debugger, 158, 166Doc, 157

enterFunction, 166

factuur, 150FLIB DBG, 73FLIB NDBG, 77Forest & Bold, vii, 2, 151Free Documentation License, iFrm, 157frmCustomers, 81frmCustomersADDED, 83frmInvoices, 85frmMain, 86

frmParts, 88frmPartsADDED, 90frmPC, 92frmPCADDED, 94frmSplash, 96

garantie, 208Gebruikershandleiding, 156General Public License, 201GNU, iGNU LGPL, 210

handelsvertegenwoordiger, 152handelsvorderingen, 9hoofdscherm, 158

INIT, 98InvoiceEV, 101Iobj, 170

Klanten, 159klantenlijst, 155klantenrotatie, 9, 13

leaveFunction, 166leveranciersrotatie, 10, 14leveranciersschuld, 9Linux, iLobj, 170

Macintosh, 2MainEV, 103makeLogEntry, 166makeNewDBase, 168Meeuwels, 151

211

INDEX 212

MEMCORE, 108

PartsADDEDEV, 116PartsEV, 119PartsF, 123PC ADDEDEV, 126PC ADDEDF, 131PCsEV, 134PCsF, 138Prj, 157

quick ratio, 9, 12

RAD, 173rentabiliteit, 11, 15

SplashEV, 141SySBuf, 169systeemvereisten, 156

thesaurie ratio, 9, 12

UIN, 169

Var, 157vertalingen, 204voorraad, 9vorderingen, 8vrijheid, 201

winstmarge, 2, 11