Vous êtes sur la page 1sur 244

IRSPDA.

NET INVENTORY
MANAGEMENT
SYSTEM

Submitted by: Under the supervision


Ram Kinkar Pandey Mr. Arnab Chaudhary
Roll No. I: 2041050065 Project Leader, PI Softek
(2004-2005) Noida

Allahabad Agriculture Institute


Deemed University
Allahabad
IRSPDA.NET INVENTORY

MANAGEMENT

SYSTEM

Undertaken at
PI SOFTEK LTD.
NOIDA
PROJECT REPORT

Submitted to Allahabad Agriculture Institute


– Deemed University
in the partial fulfillment of the requirements
for the Degree Of s M.Sc. (IT)

Submitted by: Under the Supervision:


Ram Kinkar Pandey Mr. Arnab Chaudhary
Roll No: I-2041050065 Project Leader, P I Softek
(2004-2005) Noida

Allahabad Agriculture Institute


Deemed University
Allahabad
IRSPDA.NET INVENTORY
MANAGEMENT
SYSTEM

-Ram Kinkar Pandey

Allahabad Agriculture Institute


Deemed University
Allahabad
This project is dedicated to
My mother
Smt. Jai Mani Pandey

And

My father
Sri. Jitendra Pandey
Contents at a
Contents glance
Contents at a Glance
Preface………………………………………………………………………………………........
Acknowledgements………………………………………………………………………………
Certificate (By the Director)……………………………………………………………………...
Certificate (By the Team Leader)…………………………………………………………………
Certificate (By the Supervisor)……………………………………………………………………
Declaration……………………………………………………………………………………….

Section 1: Introduction
1.1. Company Profile……………………………………………………………………………
1.2. Product Synopsis………………………………………………………………………........
1.2.1. Purpose & Scope………………………………………………………………….
1.2.2. Product Description……………………………………………………………….
1.3. Benefits of the System……………………………………………………………………….

Section 2: System Development Tools


2.1. VB.NET language…………………………………………………………………………...
2.2. Crossfire 5.0 language………………………………………………………………………..

Section 3: System Requirement Specifications


3.1. Requirement Specifications......……………………………………………………………….

Section 4: Implementation Details


4.1. VB .Net codes for various phases of the application……………………………………….....
4.2. Screen Shots…………………………………………………………………………………

Section 5: Conclusion
5.1. Scope of Enhancement………………………………………………………………………
5.2. User Feed Back………………………………………………………………………………
5.3. Conclusion…………………………………………………………………………………...

Section 6: Bibliography
Preface
With the advent of various programming technologies and their broad support toward
a lot of stuffs, our needs have escalated over the years, making computers and similar automatic
devices our friend, relative, and teacher and guides many times. The need for integrating our daily
use devices to these machines has become more and more important. Finding the various fields
of application for the use of these revolutionary machines is not a new era of research, but even
now it has much potential to attract the programmers for making it more functional for
simplifying their daily life tasks.

It was very much expected that there will one day when every will have computer not on
his desk but on his hands, but it was difficult to imagine that it would be so early. Just about
thirty years ago and computers were of the size of a whole room or bigger and now, Laptops,
Notebook computers are gong to be essentials in just a few days. I am using the word essential
which would seem hyper to you but be sure it is going to happen because who has thought that
one day the computer will be in every fifth home in all the major cities then in next the time is
for the Laptops, Notebook computers and PDAs.

When talking about the suitability and flexibility of moving along with data, then we
have to compromise with the size and power requirements. In fact, there is nothing like some
sort of competition between the computers and these so popular handheld devices, each one has
its own necessity. As the experts say, after sometimes it will be very obvious to have larger and
stronger machines in the office and the handheld devices with the executives (as it is the case
with the company in which I am working). Now, those executives should be facilitated with the
software/hardware means to transfer and update their data from the big machines in office as
easy as possible. Major software technologies are providing the means to make this type of
transfer possible and descent approaches towards this era of application is the necessity of time.
My project is just a little attempt in this direction.

The application may be not fulfilling all the need of the hungry industry and technology
but it may be said an attempt to make an effort toward simplifying the business needs with using
the assistance of technology with its efficient use.

The next targets are to make the same feasible with now popular technology like
Bluetooth. After which, there will be no need to put the PDA down on any tray near the
computer and the same targets could be achievable wirelessly. I was unable to do that stuff
because of the lack of time and resources right now.

I hope you will appreciate the efforts and forgot the errors and inefficiency that it may
have as just an educational project it is. Also, it was hard to manage the efficiency and cost.
Acknowledgements
The project as it stands today is the sincere contributions of a few spirited individuals
and the help of some of my friends. I take this opportunity to express my sincere gratitude to Mr.
Mr. Pankaj Sharma, Director of P. I. Softek Ltd, Mr. Arvind Sharma & Mr. Kiran Pandit,
HR Managers for their valuable suggestion, constant encouragement, silent support &
unwavering confidence, without which this project would not have been possible. It was they
who motivated for this cause (to do something entirely new) and always was present with their
expert guidance and disciplined ideas.

I am sincerely indebted to my mentor Mr. Arnab Chaudhary for his outstanding and
undeniable considerations. I also thank my team members and all the staff members for giving
me a congenial environment to work in.

I would also like to thank all my friends who have bore with me during this project, apart
from that, those who have helped up in some way or the other. Last but not the least I would like
to extend my heartfelt thanks to my parent, who were with me when I was some expensive about
the project. Their help and encouragement also proved to be a handful.

- Ram Kinkar Pandey


(M. Sc. IT)
Certificate
To Whom It May Concern

This is to certify that Mr. Ram Kinkar Pandey, a student of M.Sc. IT in Allahabad
Agriculture Institute – Deemed University, Allahabad, has successfully undertaken
this project on ‘IRSPDA.NET Inventory Management System’ for the partial fulfillment of
his master degree.

This project which will be taken as the final-project for his master degree in Computer
Science embodies the bona fide work done by him under the guidance of P. I. Softek Ltd,
Noida from 08th February 2005 to 31st March 2005.

His performance and general behavior during the training period was excellent and descent.
According to my best knowledge, this work has not been submitted to any other Institute / University
for award of any other degree by him or any other else.

(Mr. Pankaj Sharma)


Director,
P.I. Softek Ltd, Noida
Certificate
To Whom It May Concern

This is to certify that Mr. Ram Kinkar Pandey, a student of M.Sc. IT in Allahabad
Agriculture Institute – Deemed University, Allahabad, Enrollment No: I-
2041050065 has successfully undertaken this project on ‘IRSPDA.NET Inventory
Management System’ for the partial fulfillment of his master degree.

This project which will be taken as the final-project for his master degree in Computer
Science embodies the bona fide work done by him under the guidance of P. I. Softek Ltd,
Noida from 08th February 2005 to 31st March 2005.

His performance and general behavior during the training period was excellent and
descent. According to my best knowledge, this work and the matter embodied in this project has
not been submitted to any other Institute / University for award of any other degree/ any course
of study by him or any other else.

(Mr. Pankaj Sharma) (Mr. Arnab Chaudhary)


Director, Team Leader,
P.I. Softek Ltd, P.I. Softek Ltd,
Noida - 201301 Noida – 201301.
Certificate
To Whom It May Concern

This is to certify that the project report entitled “IRSPDA.NET Inventory


Management System” developed at P. I. Softek Ltd, Noida is submitted by Ram Kinkar
Pandey, a student of MSC IT (2004-2005), Allahabad Agriculture Institute – deemed
university, Allahabad, in the partial fulfillment of the requirement for the award of degree,
Master of Science (Information Technology), under my supervision and guidance.

This application has been developed for Palm Handheld with front-end as VB.NET and
Crossfire 5.0 and back-end as PDB (Palm database files).

I wish his all the success in future and a definite bright future.

(Mr. Manjeet Singh)


Declaration
I hereby declare that the work presented in this project entitled “IRSPDA.NET Inventory
Management System”, submitted towards my final project for the completion of M. Sc. IT
degree at Allahabad Agriculture Institute – Deemed University, Allahabad, is an authentic record
of my work carried out under the guidance of P. I. Softek, Noida. The project was done in full
compliance with the requirements and constraints of the prescribed curriculum.

- Ram Kinkar Pandey

Place: Allahabad; Date: 2nd April 2005


Introduction
Section 1

In This Section
√ Company Profile
√ Product Synopsis
√ Benefits of the System
Company profile
PI Softek LTD. is a global software services company providing custom technology
solutions. Combining proven expertise in technology, and an understanding of emerging business
domains, they deliver a range of services that include e-business solutions, strategic consulting,
maintenance, and product development. Its aim is to offer rapid delivery of innovative, business
applications with emphasis on high quality and cost-effectiveness. At each stage of the
development process it’s emphasis is to deliver quality and rich user experience.

This company offers wide range of services like IT Strategic Consultancy, Software
Maintenance, Offshore Development, Customized Software Development and Product
Engineering. It offers rapid delivery of innovative, business solutions by working with best-in-
class employee and emphasis on high quality, cost-effectiveness and On-Time Delivery. Its focus
is to take care of each area of development process ranging from requirement Analysis and
Specification to implementation. At each stage of the development cycle company’s emphasis is
to deliver quality and rich user experience.

Its primary areas of expertise are .NET, Desktop applications, PDA based application, e-
Solutions ranging from Web based business application to Portals and Client Server applications.

It follows rapid development methodologies and component-based frameworks and use UML
CASE tools for requirement, analysis and designing. Microsoft Project is being used for
scheduling and estimation.

Quality in their product is ensured by their QA team by using automated QA tools like
Visual Test for testing and Relationship 99 and Microsoft ATS for tracking defects. In order to
keep everyone updated, feedback to developers and customers are done on a regular basis.

Company specializes in e-Solutions and wireless technologies. They are well versed with
latest emerging technology .net (C#, VB.net, ADO.net, ASP.net) and have developed some
sophisticated applications using it; which supports multiple language, multiple database support,
role based security, custom controls etc. Their other expertise includes Rational Rose, COM+,
XML, XSL, ASP, JAVA, Satellite Forms, VB, VC++, Crystal Reports, Active Reports, Microsoft
Project, Visio. In all of their products they have used n-tier windows DNA architecture and they
support multiple Data sources like SQL Server, Microsoft Access and Oracle.

The other information regarding the company may also be collected through the company’s
website named www.pisoftek.com and for correspondence, you may go through the following
addresses:

USA INDIA
Priya International Limited. PI Softek Limited.
95, Houghton Lane B-4, Sector-59, Noida(U.P.) Pin 201307
Boxborough, MA01719 USA Phone: 91 - 120 - 2588846/47
Phone: 978 - 263 - 7318 Phone: 91 - 120 - 2582594
Fax: 978 - 263 - 4389 Fax: 91 - 120 - 2582614
piltd@piltd.com info@pisoftek.com
Product Synopsis
When ever you start to make/ launch a product, there are some specific questions that are
needed to be asked and answered as well. For example: -

Why the project is being made? Means the purpose …

For which environment/ people, the product is intended to? Means the scope …

A short description of the project to show others what are you doing …

Purpose and scope: -


The purpose of the project is almost clear by the name. Inventory management was what
that leaded to the database and even today databases are evaluated on the ease of inserting/
modifying/ updating the data. The purpose is to concentrate on the public dealing and not on
the on ground data entry. The product is taking care of all sort of inventory management and
also notifying you about the current situations of the stock. Just what you have to do is to put
your PDA on the synchronization cradle regularly.

The scope of the product is of course the large scale companies, for which there are a
large customer base and a high reputation. The executives need to be with the clients more and
more and can’t wait for the inventory management staff for giving them the latest inventory
information. One thing is very famous is the corporate world, if you need quick and reliable
response then make the things automated. That’s what our product is doing.

Short description: -
The product was developed in an emulator environment of 8 MB memory and tested in
a 16 MB memory. Treo 650 is a very costly device and so I was unable to move up for the higher
memory devices. The product is not only taking care of data entry phases but also taking care of
notifying its owner the current position of the particular stock when he is gong to take any
decision related to that [particular stock. This facilitates the executives a smart inventory
consultant in his hand, showing them the related information of inventory before making any
decision, because the large and reputed companies cannot take risk of taking back their decisions.
Benefits of the System
Inventory; the backbone of any business organization; Invoices, purchase orders, stock
entries and a lot of old paper work. Is there is some way out? This inventory assistant gives you
the ability to take inventory counts or walk around stock locations and enter purchase order
directly into your off the self handheld device. These can be finally uploaded to the desktop and
transferred to your central server database.

After inputting information into their PDA, retail staff simply places it in the
synchronization cradle to send inventory information to the store controller PC, which then
relays up to minute data to Corporate Headquarters via modem. This reduces administrative
paperwork, eliminate the costs of employee time and office supplies, and reduces mistakes due to
human errors. All of this leads to increased accuracy in inventory management. It helps staff over
and under stocking, identifying goods for discounting and generally move inventory more
quickly.

With easy to use full-localized interface, my system is quick to learn and simple to
operate. As about the benefits of this system, then it could be visualize very easily.

The employees can dramatically improve in-store inventory control. The system not only
improves efficiency in ordering and stock inspection but also streamline the full product
management process, including purchasing, selling, stocking, self price audits and price checks,
re-ticketing, discontinuance and customer enquiry. That’s why it is a totally merchandise solution.

The PDA is going to be very popular with store employees. It has reduced the time they
spend managing inventory and freed them from the checkout so they can get out into the store
and spend more time with the customers. In any retail environment, customers who get personal
service become return customers and drive the business forward.
System
Section 2 development tools

In this section
√ VB .Net Language
√ Crossfire 5.0 Language
VB. Net Language
Visual Basic .NET, the next generation of Visual Basic, is designed to be the easiest and most
productive tool for creating .NET applications, including Windows applications, Web Services,
and Web applications. While providing the traditional ease-of-use of Visual Basic development,
Visual Basic .NET also allows optional use of new language features. Inheritance, method
overloading, structured exception handling, and free threading all make Visual Basic a powerful
object-oriented programming language.

Visual Basic .NET fully integrates with the .NET Framework and the Common
Language Runtime, which together provide language interoperability, simplified deployment,
enhanced security, and improved versioning support.

Visual Basic .NET has many new and improved features that make it a powerful object-
oriented programming language, including inheritance, interfaces, and overloading. Other new
language features include free threading and structured exception handling. Visual Basic .NET
also fully integrates the .NET Framework and the Common Language Runtime, which provide
language interoperability, garbage collection, enhanced security, and improved versioning
support.

What is new in VB .Net Language?

A number of languages are in the market; Microsoft Visual Basic was cool too, and still
then they call it a new language not just an extension of Visual Basic. Why?

Visual Basic .NET has many new and improved language features such as inheritance, interfaces,
and overloading that make it a powerful object-oriented programming language. As a Visual
Basic developer, you can now create multithreaded, scalable applications using explicit
multithreading. Other new language features in Visual Basic .NET include structured exception
handling, custom attributes, and common language specification (CLS) compliance.

The CLS is a set of rules that standardizes such things as data types and how objects are
exposed and interoperate. Visual Basic .NET adds several features that take advantage of the
CLS. Any CLS-compliant language can use the classes, objects, and components you create in
Visual Basic .NET. And you, as a Visual Basic user, can access classes, components, and objects
from other CLS-compliant programming languages without worrying about language-specific
differences such as data types. CLS features used by Visual Basic .NET programs include
assemblies, namespaces, and attributes.

Visual Basic .NET supports many new or improved object-oriented language features
such as inheritance, overloading, the Overrides keyword, interfaces, shared members, and
constructors. Also included are structured exception handling, delegates, and several new data
types.
What's New in Visual Basic .NET 2003?
Visual Basic .NET 2003 has added functionality that simplifies bit manipulation and loop
variable declaration.
Bit Shift Operators: Visual Basic .NET now supports arithmetic left and right shift
operations on integral data types (Byte, Short, Integer, and Long). Arithmetic shifts are
not circular, which means the bits shifted off one end of the result are not reintroduced
at the other end. The corresponding assignment operators are provided as well.

Loop Variable Declaration: Visual Basic .NET now allows you to declare a loop
variable as part of a For or For Each loop. You can include an As clause for the variable
in the For or For Each statement, provided no variable of that name has been declared
outside the loop. The scope of a loop variable declared in this manner is the loop itself.

What was already added by Visual Basic .Net 2002?


Visual Basic .NET 2003 also includes the following features, which were introduced in
Visual Basic .NET 2002. The features are as given below:

Inheritance: Visual Basic .NET supports inheritance by allowing you to define classes
that serve as the basis for derived classes. Derived classes inherit and can extend the
properties and methods of the base class. They can also override inherited methods with
new implementations. All classes created with Visual Basic .NET are inheritable by
default. Because the forms you design are really classes, you can use inheritance to define
new forms based on existing ones.

Exception Handling: Visual Basic .NET supports structured exception handling, using
an enhanced version of the Try...Catch...Finally syntax supported by other languages
such as C++. Structured exception handling combines a modern control structure
(similar to Select Case or While) with exceptions, protected blocks of code, and filters.
Structured exception handling makes it easy to create and maintain programs with
robust, comprehensive error handlers.

Overloading: Overloading is the ability to define properties, methods, or procedures


that have the same name but use different data types. Overloaded procedures allow you
to provide as many implementations as necessary to handle different kinds of data, while
giving the appearance of a single, versatile procedure.

Overriding Properties and Methods: The Overrides keyword allows derived objects
to override characteristics inherited from parent objects. Overridden members have the
same arguments as the members inherited from the base class, but different
implementations. A member's new implementation can call the original implementation
in the parent class by preceding the member name with MyBase.

Constructors and Destructors: Constructors are procedures that control initialization


of new instances of a class. Conversely, destructors are methods that free system
resources when a class leaves scope or is set to Nothing. Visual Basic .NET supports
constructors and destructors using the Sub New and Sub Finalize procedures.

Data Types: Visual Basic .NET introduces three new data types. The Char data type is
an unsigned 16-bit quantity used to store Unicode characters. It is equivalent to the
.NET Framework System. Char data type. The Short data type, a signed 16-bit integer,
was named Integer in earlier versions of Visual Basic. The Decimal data type is a 96-bit
signed integer scaled by a variable power of 10. In earlier versions of Visual Basic, it was
available only within a Variant.
Interfaces: Interfaces describe the properties and methods of classes, but unlike classes,
do not provide implementations. The Interface statement allows you to declare
interfaces, while the Implements statement lets you write code that puts the items
described in the interface into practice.

Delegates: Delegates — objects that can call the methods of objects on your behalf —
are sometimes described as type-safe, object-oriented function pointers. You can use
delegates to let procedures specify an event handler method that runs when an event
occurs. You can also use delegates with multithreaded applications.

Shared Members: Shared members are properties, procedures, and fields that are
shared by all instances of a class. Shared data members are useful when multiple objects
need to use information that is common to all. Shared class methods can be used
without first creating an object from a class.

References: References allow you to use objects defined in other assemblies. In Visual
Basic .NET, references point to assemblies instead of type libraries.

Namespaces: Namespaces prevent naming conflicts by organizing classes, interfaces,


and methods into hierarchies.

Assemblies: Assemblies replace and extend the capabilities of type libraries by,
describing all the required files for a particular component or application. An assembly
can contain one or more namespaces.

Attributes: Attributes enable you to provide additional information about program


elements. For example, you can use an attribute to specify which methods in a class
should be exposed when the class is used as a XML Web service.

Multithreading: Visual Basic .NET allows you to write applications that can perform
multiple tasks independently. A task that has the potential of holding up other tasks can
execute on a separate thread, a process known as multithreading. By causing complicated
tasks to run on threads that are separate from your user interface, multithreading makes
your applications more responsive to user input.
Crossfire 5.0 Language
Many of us may have experience of programming a desktop application, but applications
written for devices like Palm powered ones, are a bit different from those of the regular desktop
application. Not only this, but it also differs in the way the users interact with the application. Let
me point out some of the major differences as are listed below:

1. Screen Size
2. Quick turn around expected
3. PC Connectivity
4. Input methods
5. Power
6. Memory
7. File System
8. Backward Compatibility

Now, so these were the differences. We have many languages that are being used for the
desktop application, but as about such limitations, we have to think about a specialist. Such a way
was MobileVB previously and now the present one AppForge Crossfire 5.0. I am not going in
much detail of the MobileVB (as it is still new for many of you viewers) and not much of that
how Crossfire takes care of the above limitations.

AppForge Crossfire software offers the fastest way to create applications for mobile
computers, phones, bar code scanners, and other devices running Palm OS®, Microsoft®
Pocket PC, or Symbian OS. Our software integrates into Microsoft® Visual Studio® .NET to
give you the power to turn your ideas into finished products in record time.

With Crossfire, you can develop, run and test mobile and wireless applications in Visual
Basic .NET or C#. The controls that you use to create mobile programs will work both on a
mobile device and under Windows. This means that, as a developer, you don’t need to have a
wireless device to test and develop an application – you simply run the application from within
Visual Studio .NET, saving hours of development time.

Crossfire enables developers to write a single application and deploy it to multiple


handheld platforms without any significant modifications. While you may choose to adjust the
layout of individual forms to best accommodate the characteristics of a particular device, the
majority of your code - the "business logic" – can be shared among all targeted devices.

Now, the simple question is that how this whole thing works and to do for making an
Palm OS® (or any Palm Based application), means How AppForge Crossfire works? The
following are the steps for doing the stuff….

1. Install it - Load Crossfire software on a PC and you are ready to start developing
handheld applications. The next time you launch Visual Studio .NET, a new "AppForge" menu
appears in the main menu bar.
2. Write it - Use the Visual Basic .NET or C# language from within Visual Studio .NET
to create the application. First, use the Crossfire project template to open a new project and
display the AppForge toolbar. Next, use the controls to build the interface. Finally, write Visual
Basic .NET code to make the application functional.
3. Compile it - To test, simply choose the standard Run menu option in Visual Studio
.NET. The application compiles in Windows, so you can accurately test and evaluate it without
leaving the Visual Studio IDE.
4. Upload it - After completing the application, choose Deploy to Device in the
AppForge menu and transfer the application to a handheld device with Crossfire Client installed.
5. Run it - The project runs the same whether in Palm OS®, Pocket PC, or Symbian
OS.

Now, the following is the description of Crossfire 5.0 features as available on the
AppForge’s website. It contains all the low level descriptions and comparisons.

Crossfire and MobileVB contain all the features as indicated below.

Standard Features
Data Features
Palm OS Only Features
Nokia Series 60 Only Features
Nokia 9300/9500 Only Features
Standard Features
Textbox, List box, Combo box, Label, Grid, Button,
Basic Ingots
Checkbox, Radio button, Graphic Button, Graphic, X X X X X
(Controls)
Shape, Filmstrip, Tone, Timer
Up Down A scrollbar with only arrows and no shaft. X X X X X
Time Picker Input mechanism for times. X X X X X
Date Picker Input mechanism for dates. X X X X X
Paints text, graphics, and shapes, with multiple fonts and
Owner Draw Grid X X X X X
colors into a grid.
Scrollbars Can be used to create custom scrolling actions. X X X X X
Slider Input or output data on a predetermined scale. X X X X X
Plays movies converted from .AVI to AppForge (.RMV)
Movie X X X X X
format.
Widget Provides a blank canvas that receives all events. X X X X X
Visual Basic AppForge supports most common Visual Basic
X X X X X
Functions functions.
Format Functions Support for native Visual Basic Format functions. X X X X X
Floating Point Double Precision floating point operations. X X X X X
z-order Controls can overlap on a form. X X X X X
User-Defined
Full support for Visual Basic user-defined types. X X X X X
Types
Focus Events Includes LostFocus, GotFocus, and Validate Events X X X X X
Numeric Support Byte, Char, Integer, Long, Single, Double, and Currency X X X X X
Control Arrays Groups of controls with same name, type and event X X X X X
Controls
Reference all controls on a form with one procedure call. X X X X X
Collection

Support for these statements: If...Then...End If; Select...


Case... End Select; For... Next; Do Until... Loop; Do
Control Structures X X X X X
While...Loop; Do...Loop Until; Do...Loop While; While...
Wend
Debug Apps in VB Run your application in the IDE to test it. X X X X X
Financial
Visual Basic financial functions. X X X X X
Functions
Redim Dynamically change the size of an array X X X X X
Implements Implement external Interfaces and internal User Defined
X X X X X
keyword Classes.
User Defined
Provides for object oriented programming methodologies X X X X X
Classes
Database
Converter & Microsoft Access (.MDB) to Palm OS (.PDB) X X X X X
Viewer
Graphic Converter
Microsoft Paint (.BMP) to AppForge Graphic (.RGX) X X X X X
& Viewer
Font Converter &
TrueType Font (.TTF) to AppForge Font (.CMF) X X X X X
Viewer
Movie Converter Audio Video Interleave (.AVI) to AppForge Movie
X X X X X
& Viewer (.RMV)
Color 24-bit color BMP support. X X X X X
Menus Provides native device menu support. X X X X X
Enables Ingots to adapt their appearance to the native
Native Appearance
look device. Assists with creating true cross-platform X X X X X
Properties
applications.
Support for localization settings within the following
Localization functions: FormatDateTime(), Weekday(), X X X X X
WeekdayName(), DateDiff(), all Numbers and Currency.
Unicode Provides for the display of fonts in multiple languages. X X X X X
Provides functions to access volumes, directories, and
Filesystem Access files on a device’s file system. Both binary and text files X X X X X
are supported.
InputBox Similar to a Message BoX, but prompts user for input. X X X X X
SysInfo Standard access to various system dependent metrics. X X X X X
PNG Graphics
Reduces image file size. X X X X X
format
Zoom Window Provides a zoomed view of application forms. X X X X X
Single File Create a single, self extracting installation file including
X X X X X
Installation Booster, Databases, graphics, etc.
Documentation Includes a User's Guide/User's Manual and a Help file. X X X X X
What you see is what you get. Design your applications
WYSIWYG visually, seeing them in Visual Basic just as they will X X X X X
appear in the device.
Sample Learn by example from the AppForge Samples and
X X X X X
Applications Tutorials.
Message Boxes Support for the native system Message Boxes. X X X X X
TrueType Fonts Use Adobe TrueType fonts on the handheld device. X X X X X
Provide a set of common interfaces to address basic
Telephony support X X X X X
phone operations.
SMS Text messaging services in MobileVB applications. X X X
Wireless Internet Send and receive data wirelessly using INetHTTP. X X X X X
Socket Provides for socket-based TCP/IP communication. X X X X X
Alarm Wakes up and notifies the user when an event occurs. X X X X X
Serial Supports communications through the serial port. X X X X
Supports communications via Bluetooth. ClientSocket
Bluetooth Ingot allows access of TCP/IP resources through a X X X X X
BlueTooth network device.
Title Bar Application title bar on the handheld device. X X X X X
Camera Ingot Enables control of built-in camera on device. X* X X X* X
Signature Capture Serves as an input for drawn signatures and images. X X X X
A cross-platform way to make calls into external libraries
Fuser SDK X X X X X
or applications on the device.
Full Screen Crossfire allows developers to utilize the full screen on a
X X
Support device
Command line Drive the compilation process from the command
X X X X X
compiler prompt.
*see the specifics on camera support in Crossfire Class Library (.pdf) under
AppForge.Multimedia>Camera Class

DATA FEATURES

Intellisync™ powered synchronization is available to sync


AppForge Data corporate backend databases with handheld devices
X X*
Sync through AppForge Data Sync (*Smartphone and
Symbian not supported).
AppForge
SQL Server CE, Pocket Access, PDBs, and SymbianDB X X X X X
Database Model
Enables barcode scanning with Intermec, HHP, Socket,
Scanner X X
Symbol® and Symbol® compatible devices.
iAnywhere
True relational database capabilities on your handheld. X X
Ultralite database
PIM Library Get / update Outlook and PIM data. X X X X X
PDB Library Support for Palm Databases. X X X X X

Palm OS other features


Palm Extended
Collection of Palm specific functions. X
Functions
Palm Packager and
Self-extracting installer. X
Installer
App Size Compiled code size (.AFX) can exceed 64K X
Database
The AppForge Universal Conduit (UC). X
Synchronization
Enables AppForge applications to Interoperate with
Extensibility *
other Palm applications.
Nokia Series 60 other features
Provides control of the NaviPane (blue bar near the top
NaviPane Ingot X
of the form on most Nokia Series 60 applications)
AFScrollNS60 Ingot enables you to control the behavior
Scroll Ingot X
of the blue arrows at the bottom of the screen.

Nokia 9300 / 9500 other features


Title Bar Ingot X
Window
X
Background Ingot
Command Button
X
Area Ingot
System
Requirement Specification
Section 3

In this section
√ Requirement Specification
Requirement Specifications
A different set of requirements as far as this particular project is concerned. As this project is
targeted, to be executed on the PDA, a not very well familiar environment for most of you even
today’s world.

Some specific requirements may be written as given below:

PalmOS

Booster 5.0 Runtime Environment

Treo 650 or the Emulator

At least 8 MB of memory (that was the least on which it was tested).

Crossfire 5.0 or later.

Many other accessories like synchronization cradle, or the application required for
synchronization are not part of requirement specification here, as they are part of standard
accessory set of the device Treo 650. Treo 650 may be considered as an advance device as it also
provide support for Bluetooth transfer as well that is not utilized in my project till now.

I have used VB .Net for the development, but as it is not need specifically for the running of the
product, I am not mentioning it as essential.
Implementation Details
Section 4

In this section
√ VB .Net codes
√ Screen shots
VB .Net Codes
frmLogin.vb

Option Strict Off


Option Explicit On

Public Class frmLogin


Inherits System.Windows.Forms.Form
Dim objUserRec As tuserRecord 'User DB structure obj

Private Sub VisibilityButton(ByVal bVis As Boolean)


btnSignIn.Visible = bVis
End Sub

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents lblIRS As AppForge.Controls.Label
Friend WithEvents lblIRS2 As AppForge.Controls.Label
Friend WithEvents lblLine As AppForge.Controls.Label
Friend WithEvents lblUser As AppForge.Controls.Label
Friend WithEvents blPass As AppForge.Controls.Label
Friend WithEvents txtUser As AppForge.Controls.TextBox
Friend WithEvents txtPass As AppForge.Controls.TextBox
Friend WithEvents btnSignIn As AppForge.Controls.Button
Friend WithEvents lblSignIn As AppForge.Controls.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmLogin))
Me.lblIRS = New AppForge.Controls.Label
Me.lblIRS2 = New AppForge.Controls.Label
Me.lblLine = New AppForge.Controls.Label
Me.lblUser = New AppForge.Controls.Label
Me.blPass = New AppForge.Controls.Label
Me.txtUser = New AppForge.Controls.TextBox
Me.txtPass = New AppForge.Controls.TextBox
Me.btnSignIn = New AppForge.Controls.Button
Me.lblSignIn = New AppForge.Controls.Label
CType(Me.lblIRS, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblIRS2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLine, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblUser, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.blPass, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtUser, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtPass, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnSignIn, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblSignIn, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'lblIRS
'
Me.lblIRS.CausesValidation = False
Me.lblIRS.Location = New System.Drawing.Point(8, 17)
Me.lblIRS.OcxState = CType(resources.GetObject("lblIRS.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblIRS.Size = New System.Drawing.Size(28, 16)
Me.lblIRS.TabIndex = 0
Me.lblIRS.TabStop = False
'
'lblIRS2
'
Me.lblIRS2.CausesValidation = False
Me.lblIRS2.Location = New System.Drawing.Point(8, 39)
Me.lblIRS2.OcxState = CType(resources.GetObject("lblIRS2.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblIRS2.Size = New System.Drawing.Size(148, 22)
Me.lblIRS2.TabIndex = 1
Me.lblIRS2.TabStop = False
'
'lblLine
'
Me.lblLine.CausesValidation = False
Me.lblLine.Location = New System.Drawing.Point(4, 78)
Me.lblLine.OcxState = CType(resources.GetObject("lblLine.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLine.Size = New System.Drawing.Size(152, 12)
Me.lblLine.TabIndex = 2
Me.lblLine.TabStop = False
'
'lblUser
'
Me.lblUser.CausesValidation = False
Me.lblUser.Location = New System.Drawing.Point(12, 93)
Me.lblUser.OcxState = CType(resources.GetObject("lblUser.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblUser.Size = New System.Drawing.Size(60, 12)
Me.lblUser.TabIndex = 3
Me.lblUser.TabStop = False
'
'blPass
'
Me.blPass.CausesValidation = False
Me.blPass.Location = New System.Drawing.Point(12, 110)
Me.blPass.OcxState = CType(resources.GetObject("blPass.OcxState"),
System.Windows.Forms.AxHost.State)
Me.blPass.Size = New System.Drawing.Size(60, 14)
Me.blPass.TabIndex = 4
Me.blPass.TabStop = False
'
'txtUser
'
Me.txtUser.Location = New System.Drawing.Point(76, 91)
Me.txtUser.OcxState = CType(resources.GetObject("txtUser.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtUser.Size = New System.Drawing.Size(80, 14)
Me.txtUser.TabIndex = 5
'
'txtPass
'
Me.txtPass.Location = New System.Drawing.Point(76, 110)
Me.txtPass.OcxState = CType(resources.GetObject("txtPass.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtPass.Size = New System.Drawing.Size(80, 14)
Me.txtPass.TabIndex = 6
'
'btnSignIn
'
Me.btnSignIn.Location = New System.Drawing.Point(105, 133)
Me.btnSignIn.OcxState = CType(resources.GetObject("btnSignIn.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnSignIn.Size = New System.Drawing.Size(50, 20)
Me.btnSignIn.TabIndex = 7
'
'lblSignIn
'
Me.lblSignIn.CausesValidation = False
Me.lblSignIn.Location = New System.Drawing.Point(64, 66)
Me.lblSignIn.OcxState = CType(resources.GetObject("lblSignIn.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblSignIn.Size = New System.Drawing.Size(36, 12)
Me.lblSignIn.TabIndex = 8
Me.lblSignIn.TabStop = False
'
'frmLogin
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.lblSignIn)
Me.Controls.Add(Me.btnSignIn)
Me.Controls.Add(Me.txtPass)
Me.Controls.Add(Me.txtUser)
Me.Controls.Add(Me.blPass)
Me.Controls.Add(Me.lblUser)
Me.Controls.Add(Me.lblLine)
Me.Controls.Add(Me.lblIRS2)
Me.Controls.Add(Me.lblIRS)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmLogin"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Login Screen"
CType(Me.lblIRS, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblIRS2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLine, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblUser, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.blPass, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtUser, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtPass, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnSignIn, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblSignIn, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

Public Sub InitializeInitialize()

If OpenAllDatabase() <> True Then


End
End If
End Sub
Public Function ValidateTextbox() As Boolean

If Trim(txtUser.Text) = System.String.Empty Then


MsgBox("Enter the User Name", MsgBoxStyle.Information, "IRS")
txtUser.Text = System.String.Empty
txtUser.Focus()
Return False
End If

If Trim(txtPass.Text) = System.String.Empty Then


MsgBox("Enter the Password", MsgBoxStyle.Information, "IRS")
txtPass.Text = System.String.Empty
txtPass.Focus()
Return False
End If

Return True

End Function

Private Sub btnSignIn_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnSignIn.ClickEvent

If ValidateTextbox() = False Then


Exit Sub
Else

If objData.GetNumRecords(UsrDBName) > 0 Then 'check total records > 0

objData.MoveToFirstRecord(UsrDBName)
objData.SetSortFields(UsrDBName, 0)
objData.FindRecordByField(objUserRec, Trim(txtUser.Text).PadRight(30, ""), 0,
UsrDBName)

If Trim(txtUser.Text) = Trim(objData.GetFieldValue(0, UsrDBName)) And


Trim(txtPass.Text) = Trim(objData.GetFieldValue(3, UsrDBName)) Then

If g_objMain Is Nothing Then


g_objMain = New frmMain
End If
LoadForm(g_objMain)
Me.Hide()

Else

MsgBox("No matching record found in User table", MsgBoxStyle.Information)


Exit Sub

End If
Else

MsgBox("User database has no records", MsgBoxStyle.Information)


Exit Sub
End If
End If
End Sub

Private Sub frmLogin_KeyDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Select Case e.KeyCode

Case vchrLaunch, vchrMenu, vchrFind, vchrCalc, vchrHard1, vchrHard2, vchrHard3,


vchrHard4, vchrHardPower, vchrHardCradle
MsgBox("Please exit the application first")
Exit Sub

End Select

End Sub

Private Sub frmLogin_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


MyBase.Load
InitializeInitialize()
txtUser.Focus()
End Sub

Private Sub frmLogin_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles


MyBase.Closed
End Sub

End Class
frmMain.vb

Option Strict Off


Option Explicit On

Public Class frmMain

Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents btnInventory As AppForge.Controls.Button
Friend WithEvents btnCommodity As AppForge.Controls.Button
Friend WithEvents btnUom As AppForge.Controls.Button
Friend WithEvents btnLocation As AppForge.Controls.Button
Friend WithEvents btnConsign As AppForge.Controls.Button
Friend WithEvents btnExit As AppForge.Controls.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmMain))
Me.btnInventory = New AppForge.Controls.Button
Me.btnCommodity = New AppForge.Controls.Button
Me.btnUom = New AppForge.Controls.Button
Me.btnLocation = New AppForge.Controls.Button
Me.btnConsign = New AppForge.Controls.Button
Me.btnExit = New AppForge.Controls.Button
CType(Me.btnInventory, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnCommodity, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnUom, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnLocation, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnConsign, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnExit, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'btnInventory
'
Me.btnInventory.Location = New System.Drawing.Point(42, 16)
Me.btnInventory.OcxState = CType(resources.GetObject("btnInventory.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnInventory.Size = New System.Drawing.Size(76, 20)
Me.btnInventory.TabIndex = 0
'
'btnCommodity
'
Me.btnCommodity.Location = New System.Drawing.Point(42, 40)
Me.btnCommodity.OcxState = CType(resources.GetObject("btnCommodity.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnCommodity.Size = New System.Drawing.Size(76, 20)
Me.btnCommodity.TabIndex = 1
'
'btnUom
'
Me.btnUom.Location = New System.Drawing.Point(42, 64)
Me.btnUom.OcxState = CType(resources.GetObject("btnUom.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnUom.Size = New System.Drawing.Size(76, 20)
Me.btnUom.TabIndex = 2
'
'btnLocation
'
Me.btnLocation.Location = New System.Drawing.Point(42, 88)
Me.btnLocation.OcxState = CType(resources.GetObject("btnLocation.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnLocation.Size = New System.Drawing.Size(76, 20)
Me.btnLocation.TabIndex = 3
'
'btnConsign
'
Me.btnConsign.Location = New System.Drawing.Point(42, 112)
Me.btnConsign.OcxState = CType(resources.GetObject("btnConsign.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnConsign.Size = New System.Drawing.Size(76, 20)
Me.btnConsign.TabIndex = 4
'
'btnExit
'
Me.btnExit.Location = New System.Drawing.Point(42, 136)
Me.btnExit.OcxState = CType(resources.GetObject("btnExit.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnExit.Size = New System.Drawing.Size(76, 20)
Me.btnExit.TabIndex = 5
'
'frmMain
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.btnConsign)
Me.Controls.Add(Me.btnLocation)
Me.Controls.Add(Me.btnUom)
Me.Controls.Add(Me.btnCommodity)
Me.Controls.Add(Me.btnInventory)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmMain"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Main Menu"
CType(Me.btnInventory, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnCommodity, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnUom, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnLocation, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnConsign, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnExit, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub btnLocation_ClickEvent(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnLocation.ClickEvent
If (g_objLocList Is Nothing) Then
g_objLocList = New frmLocationList
End If
g_objLocList.InitializeLocLookUp()
LoadForm(g_objLocList)
g_Last_Screen = "MainLoc"
Me.Hide()
End Sub

Private Sub btnInventory_ClickEvent(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnInventory.ClickEvent
If (g_objEqptList Is Nothing) Then
g_objEqptList = New frmEqptList
End If
g_objEqptList.InitializeEqptLookUp()
LoadForm(g_objEqptList)
g_objMain.Hide()
'g_objMain = Nothing

End Sub

Private Sub btnConsign_ClickEvent(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnConsign.ClickEvent

If (g_objConsignList Is Nothing) Then


g_objConsignList = New frmConsignLocList
End If
g_objConsignList.InitializeConsignLookUp()
LoadForm(g_objConsignList)
g_Last_Screen = "MainConsign"

Me.Hide()

End Sub

Private Sub btnUom_ClickEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnUom.ClickEvent
If (g_objUOMList Is Nothing) Then
g_objUOMList = New frmUomList
End If
g_objUOMList.InitializeUomLookUp()
LoadForm(g_objUOMList)
g_Last_Screen = "MainUOM"
Me.Hide()
End Sub

Private Sub btnCommodity_ClickEvent(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCommodity.ClickEvent
If (g_objCommList Is Nothing) Then
g_objCommList = New frmCommodityList
End If
g_objCommList.InitializeCommLookUp()
LoadForm(g_objCommList)
g_Last_Screen = "MainComm"
Me.Hide()
End Sub

Private Sub frmMain_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles


MyBase.Closed
'CloseAllDatabase()
objData = Nothing
End
End Sub
Private Sub btnExit_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles
btnExit.ClickEvent
'ReleaseKeys()
End

End Sub
End Class
frmEqptList.vb

Option Strict Off


Option Explicit On

Public Class frmEqptList


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents grdEqptHeader As AppForge.Controls.OwnerDrawGrid
Friend WithEvents GrdEqptList As AppForge.Controls.OwnerDrawGrid
Friend WithEvents BtnEqptAdd As AppForge.Controls.Button
Friend WithEvents BtnEqptEdit As AppForge.Controls.Button
Friend WithEvents BtnEqptDel As AppForge.Controls.Button
Friend WithEvents tmrEqpt As AppForge.Controls.Timer
Friend WithEvents btnEqptCancel As AppForge.Controls.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmEqptList))
Me.grdEqptHeader = New AppForge.Controls.OwnerDrawGrid
Me.GrdEqptList = New AppForge.Controls.OwnerDrawGrid
Me.BtnEqptAdd = New AppForge.Controls.Button
Me.BtnEqptEdit = New AppForge.Controls.Button
Me.BtnEqptDel = New AppForge.Controls.Button
Me.tmrEqpt = New AppForge.Controls.Timer
Me.btnEqptCancel = New AppForge.Controls.Button
CType(Me.grdEqptHeader, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GrdEqptList, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BtnEqptAdd, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BtnEqptEdit, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BtnEqptDel, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.tmrEqpt, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnEqptCancel, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'grdEqptHeader
'
Me.grdEqptHeader.Location = New System.Drawing.Point(0, 16)
Me.grdEqptHeader.OcxState = CType(resources.GetObject("grdEqptHeader.OcxState"),
System.Windows.Forms.AxHost.State)
Me.grdEqptHeader.Size = New System.Drawing.Size(160, 24)
Me.grdEqptHeader.TabIndex = 0
'
'GrdEqptList
'
Me.GrdEqptList.Location = New System.Drawing.Point(0, 43)
Me.GrdEqptList.OcxState = CType(resources.GetObject("GrdEqptList.OcxState"),
System.Windows.Forms.AxHost.State)
Me.GrdEqptList.Size = New System.Drawing.Size(160, 86)
Me.GrdEqptList.TabIndex = 1
'
'BtnEqptAdd
'
Me.BtnEqptAdd.Location = New System.Drawing.Point(0, 135)
Me.BtnEqptAdd.OcxState = CType(resources.GetObject("BtnEqptAdd.OcxState"),
System.Windows.Forms.AxHost.State)
Me.BtnEqptAdd.Size = New System.Drawing.Size(39, 20)
Me.BtnEqptAdd.TabIndex = 2
'
'BtnEqptEdit
'
Me.BtnEqptEdit.Location = New System.Drawing.Point(40, 135)
Me.BtnEqptEdit.OcxState = CType(resources.GetObject("BtnEqptEdit.OcxState"),
System.Windows.Forms.AxHost.State)
Me.BtnEqptEdit.Size = New System.Drawing.Size(39, 20)
Me.BtnEqptEdit.TabIndex = 3
'
'BtnEqptDel
'
Me.BtnEqptDel.Location = New System.Drawing.Point(81, 135)
Me.BtnEqptDel.OcxState = CType(resources.GetObject("BtnEqptDel.OcxState"),
System.Windows.Forms.AxHost.State)
Me.BtnEqptDel.Size = New System.Drawing.Size(39, 20)
Me.BtnEqptDel.TabIndex = 4
'
'tmrEqpt
'
Me.tmrEqpt.Location = New System.Drawing.Point(128, 96)
Me.tmrEqpt.OcxState = CType(resources.GetObject("tmrEqpt.OcxState"),
System.Windows.Forms.AxHost.State)
Me.tmrEqpt.Size = New System.Drawing.Size(32, 32)
Me.tmrEqpt.TabIndex = 5
'
'btnEqptCancel
'
Me.btnEqptCancel.Location = New System.Drawing.Point(121, 135)
Me.btnEqptCancel.OcxState = CType(resources.GetObject("btnEqptCancel.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnEqptCancel.Size = New System.Drawing.Size(39, 20)
Me.btnEqptCancel.TabIndex = 6
'
'frmEqptList
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnEqptCancel)
Me.Controls.Add(Me.tmrEqpt)
Me.Controls.Add(Me.BtnEqptDel)
Me.Controls.Add(Me.BtnEqptEdit)
Me.Controls.Add(Me.BtnEqptAdd)
Me.Controls.Add(Me.GrdEqptList)
Me.Controls.Add(Me.grdEqptHeader)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmEqptList"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Equipment List"
CType(Me.grdEqptHeader, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GrdEqptList, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.BtnEqptAdd, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.BtnEqptEdit, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.BtnEqptDel, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.tmrEqpt, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnEqptCancel, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim objEqptList As tinventoryRecord ' Inventory db structure obj

Public iSelectedRow As Integer


Private bInitialSetup As Boolean = True
Public iEqptIndex As Integer
Private iRow As Integer
Private iNumRow As Integer

Private Sub VisibilityButton(ByVal boolVisible As Boolean)

BtnEqptAdd.Visible = boolVisible
BtnEqptEdit.Visible = boolVisible
BtnEqptDel.Visible = boolVisible

End Sub

Public Sub InitializeEqptLookUp()

objData.MoveToFirstRecord(InvDBName)

GrdEqptList.Refresh()
FillGrid()
AddHeader()
AddItems()

End Sub

Public Sub FillGrid()

VisibilityButton(False)

GrdEqptList.Cols = CShort(3)
GrdEqptList.set_RowHeight(0, (fGetStringHeight(iFontHandle_DeviceDefault) + 4))
GrdEqptList.set_ColWidth(0, CShort(40))
GrdEqptList.set_ColWidth(1, CShort(40))
GrdEqptList.set_ColWidth(2, CShort(90))

grdEqptHeader.Cols = CShort(3)
grdEqptHeader.set_ColWidth(0, CShort(40))
grdEqptHeader.set_ColWidth(1, CShort(40))
grdEqptHeader.set_ColWidth(2, CShort(90))

VisibilityButton(True)

End Sub

Private Sub AddHeader()

grdEqptHeader.RemoveItem(0)
grdEqptHeader.Refresh()
grdEqptHeader.AddItem("Item#" & Chr(9) & "Asset#" & Chr(9) & " Description")

End Sub
Private Sub AddItems()
Try
Dim strItem As String

iNumRow = 0
iRow = 0

While Not objData.EndOfFile(InvDBName)


strItem = Trim(objData.GetFieldValue(0, InvDBName))

GrdEqptList.AddItem(Trim(objData.GetFieldValue(0, InvDBName) & Chr(9) &


objData.GetFieldValue(2, InvDBName) & Chr(9) & objData.GetFieldValue(10, InvDBName)))
iNumRow = iNumRow + 1

objData.MoveToNextRecord(InvDBName)

End While
GrdEqptList.Refresh()

Catch ex As Exception
Throw ex
End Try

End Sub

Private Sub RemoveItems()


For iRow = 0 To iNumRow
GrdEqptList.RemoveItem(0)
Next
End Sub
Private Sub GrdEqptList_PaintCell(ByVal sender As Object, ByVal e As
AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles GrdEqptList.PaintCell

If objData.GoToRecordIndex(e.row, InvDBName) = False Then


Exit Sub
End If
'common code for all forms
If e.selected Then
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHT)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHTTEXT)
Else
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
End If

e.canvas.Erase()

e.canvas.DrawText(e.x + 3, e.y + 3, GrdEqptList.get_TextMatrix(e.row, e.col))

End Sub
Private Sub GrdEqptList_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)
Handles GrdEqptList.SelectCell

iSelectedRow = CInt(GrdEqptList.Row)
objData.GoToRecordIndex(iSelectedRow, InvDBName)

End Sub

Private Sub GrdEqptList_LeftColChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles GrdEqptList.LeftColChanged

grdEqptHeader.LeftCol = GrdEqptList.LeftCol

End Sub

Private Sub grdEqptHeader_LeftColChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles grdEqptHeader.LeftColChanged
GrdEqptList.LeftCol = grdEqptHeader.LeftCol

End Sub

Private Sub grdlocHeader_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)


Handles grdEqptHeader.SelectCell

tmrEqpt.Enabled = False
tmrEqpt.Enabled = True

End Sub

Private Sub SortDatabase()

Select Case grdEqptHeader.Col


Case 0
objData.SetSortFields(InvDBName, 0)
Case 1
objData.SetSortFields(InvDBName, 2)
Case 2
objData.SetSortFields(InvDBName, 10)
End Select

End Sub
'See grdlocHeader_SelectCell for an explanation of this timer.
Private Sub tmrEqpt_TimerEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles tmrEqpt.TimerEvent

Dim myUID As Long

If iSelectedRow = 0 Then iSelectedRow = 1

objData.GoToRecordIndex(iSelectedRow, InvDBName)
myUID = objData.RecordUniqueID(InvDBName)
SortDatabase()
objData.FindRecordbyID(myUID, InvDBName)

If (bInitialSetup) Then
GrdEqptList.Row = 0
bInitialSetup = False
Else
GrdEqptList.Row = objData.CurrentIndex(InvDBName)
End If

GrdEqptList.Refresh() 'Refresh the grid with the new sort order.


tmrEqpt.Enabled = False

End Sub

Private Sub grdEqptHeader_PaintCell(ByVal sender As Object, ByVal e As


AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles grdEqptHeader.PaintCell

e.canvas.Reset()

e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)

If e.selected Then
e.canvas.DrawText(e.x + 3, e.y + 3, grdEqptHeader.get_TextMatrix(e.row, e.col) & "*")
Else
e.canvas.DrawText(e.x + 3, e.y + 3, grdEqptHeader.get_TextMatrix(e.row, e.col))
End If
End Sub

Private Sub BtnEqptAdd_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles BtnEqptAdd.ClickEvent
Try
SetPropertiesToInitialValue()
g_Inventory_mode = "Add"

'Find Max Number index #


objData.SetSortFields(InvDBName, 0)
objData.MoveToLastRecord(InvDBName)
g_ItemNo = objData.GetFieldValue(0, InvDBName)

If g_ItemNo = 0 Then
g_ItemNo = 1
Else
g_ItemNo = g_ItemNo + 1
End If

If g_objItem Is Nothing Then


g_objItem = New frmItemDetails
End If

'Load form and initialize


g_objItem.InitializeItemScreen()
LoadForm(g_objItem)

RemoveItems()
Me.Hide()

Catch ex As Exception
Throw ex
End Try

End Sub

Private Sub BtnEqptEdit_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles BtnEqptEdit.ClickEvent

Dim iTemp As String

If g_objItem Is Nothing Then


g_objItem = New frmItemDetails
End If

iTemp = Trim(GrdEqptList.get_TextMatrix(iSelectedRow, 0))


g_ItemNo = iTemp
g_objItem.PopulateItemScreen(g_ItemNo)

g_Inventory_mode = "Edit" 'Global variable value

g_objItem.InitializeItemScreen()

LoadForm(g_objItem)
RemoveItems()
Me.Hide()

End Sub

Private Sub BtnEqptDel_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles BtnEqptDel.ClickEvent
Dim itemp As String

Try
itemp = Trim(GrdEqptList.get_TextMatrix(iSelectedRow, 0))
If (MessageBox.Show("Delete ItemNo: " & itemp & " ?", "Confirmation",
MessageBoxButtons.YesNo) = DialogResult.Yes) Then
g_ItemNo = itemp
objData.FindRecordByField(objEqptList, itemp, 0, InvDBName)
objData.DeleteOneRecord(InvDBName)
GrdEqptList.RemoveItem(GrdEqptList.Row)
GrdEqptList.Row = GrdEqptList.Row - 1
GrdEqptList.Refresh()
End If
Catch ex As Exception
MessageBox.Show("Error Occured While Deleting Record:" + ex.Message, "Information")
End Try

End Sub

Private Sub btnEqptCancel_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnEqptCancel.ClickEvent
If (g_objMain Is Nothing) Then
g_objMain = New frmMain
End If
LoadForm(g_objMain)
RemoveItems()
g_objEqptList.Close()
g_objEqptList = Nothing
End Sub

Private Sub SetPropertiesToInitialValue()


Try
Asset = System.String.Empty
CommodityCode = System.String.Empty
CommodityCode1 = System.String.Empty
CommodityCode2 = System.String.Empty
CommodityCode3 = System.String.Empty
CommodityCode4 = System.String.Empty
CommodityCode5 = System.String.Empty
CommodityCode6 = System.String.Empty
CommodityDesc = System.String.Empty
CommodityDesc1 = System.String.Empty
CommodityDesc2 = System.String.Empty
CommodityDesc3 = System.String.Empty
CommodityDesc4 = System.String.Empty
CommodityDesc5 = System.String.Empty
CommodityDesc6 = System.String.Empty
Quantity = 0
UOM = System.String.Empty
ShortDescription = System.String.Empty
DateAvail = Now
MaterialConstruct = System.String.Empty
StorageLocation = System.String.Empty
SpareParts = System.String.Empty
ScopeReference = System.String.Empty
Dwags = System.String.Empty
Status = 0
Where = 0
Condition = 0
Manufacturer = System.String.Empty
Serial = System.String.Empty
NewUsed = 0
Dimension = System.String.Empty
Parts = System.String.Empty
Weight = 0
MfgNo = System.String.Empty
DisplayCode = 0
LongDescription = System.String.Empty
LocationCode = System.String.Empty
LocationContact = System.String.Empty
LocationDecription = System.String.Empty
LocationEmail = System.String.Empty
LocationFax = System.String.Empty
LocationPhone = System.String.Empty
ConsignMentCode = System.String.Empty
ConsignMentContact = System.String.Empty
ConsignMentDesc = System.String.Empty
ConsignMentEmail = System.String.Empty
ConsignMentFax = System.String.Empty
ConsignMentPhone = System.String.Empty
ForeignCurrency = "" '0
ConversionFactor = 0
ForeignCost = 0
ForeignNBV = 0
isUpdate = False
OriginalCost = 0
TotalCost = 0
OriginalFrieght = 0
OriginalInstall = 0
LifeRemaining = 0
YearCapital = 0
ForeignNBV = 0
TaxValue = 0
AskingPrice = 0
LowestPrice = 0

Catch ex As Exception
Throw ex
End Try
End Sub
End Class
frmItemDetails.vb

Option Strict Off


Option Explicit On

Public Class frmItemDetails


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label7 As AppForge.Controls.Label
Friend WithEvents Label8 As AppForge.Controls.Label
Friend WithEvents Label9 As AppForge.Controls.Label
Friend WithEvents Label10 As AppForge.Controls.Label
Friend WithEvents Label11 As AppForge.Controls.Label
Friend WithEvents Label12 As AppForge.Controls.Label
Friend WithEvents txtItem As AppForge.Controls.TextBox
Friend WithEvents lblItem As AppForge.Controls.Label
Friend WithEvents lblAsset As AppForge.Controls.Label
Friend WithEvents txtAsset As AppForge.Controls.TextBox
Friend WithEvents txtComm1 As AppForge.Controls.TextBox
Friend WithEvents txtCommDesc1 As AppForge.Controls.TextBox
Friend WithEvents txtComm2 As AppForge.Controls.TextBox
Friend WithEvents txtComm4 As AppForge.Controls.TextBox
Friend WithEvents txtCommDesc2 As AppForge.Controls.TextBox
Friend WithEvents txtComm5 As AppForge.Controls.TextBox
Friend WithEvents txtCommDesc4 As AppForge.Controls.TextBox
Friend WithEvents txtCommDesc5 As AppForge.Controls.TextBox
Friend WithEvents btnSave As AppForge.Controls.Button
Friend WithEvents btnCancel As AppForge.Controls.Button
Friend WithEvents btnItemLookup As AppForge.Controls.Button
Friend WithEvents Label1 As AppForge.Controls.Label
Friend WithEvents btnCommlookup As AppForge.Controls.Button
Friend WithEvents txtCommDesc6 As AppForge.Controls.TextBox
Friend WithEvents txtComm6 As AppForge.Controls.TextBox
Friend WithEvents txtCommCode As AppForge.Controls.TextBox
Friend WithEvents txtCommDesc As AppForge.Controls.TextBox
Friend WithEvents txtComm3 As AppForge.Controls.TextBox
Friend WithEvents txtCommDesc3 As AppForge.Controls.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmItemDetails))
Me.txtItem = New AppForge.Controls.TextBox
Me.lblItem = New AppForge.Controls.Label
Me.lblAsset = New AppForge.Controls.Label
Me.txtAsset = New AppForge.Controls.TextBox
Me.Label7 = New AppForge.Controls.Label
Me.Label8 = New AppForge.Controls.Label
Me.Label9 = New AppForge.Controls.Label
Me.Label10 = New AppForge.Controls.Label
Me.Label11 = New AppForge.Controls.Label
Me.Label12 = New AppForge.Controls.Label
Me.txtComm1 = New AppForge.Controls.TextBox
Me.txtCommDesc1 = New AppForge.Controls.TextBox
Me.txtComm2 = New AppForge.Controls.TextBox
Me.txtComm4 = New AppForge.Controls.TextBox
Me.txtCommDesc2 = New AppForge.Controls.TextBox
Me.txtComm5 = New AppForge.Controls.TextBox
Me.txtCommDesc4 = New AppForge.Controls.TextBox
Me.txtCommDesc5 = New AppForge.Controls.TextBox
Me.btnSave = New AppForge.Controls.Button
Me.btnCancel = New AppForge.Controls.Button
Me.btnItemLookup = New AppForge.Controls.Button
Me.txtCommDesc6 = New AppForge.Controls.TextBox
Me.txtComm6 = New AppForge.Controls.TextBox
Me.txtComm3 = New AppForge.Controls.TextBox
Me.txtCommDesc3 = New AppForge.Controls.TextBox
Me.Label1 = New AppForge.Controls.Label
Me.txtCommCode = New AppForge.Controls.TextBox
Me.btnCommlookup = New AppForge.Controls.Button
Me.txtCommDesc = New AppForge.Controls.TextBox
CType(Me.txtItem, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblItem, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblAsset, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtAsset, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label7, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label8, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label9, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label10, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label11, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label12, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtComm1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCommDesc1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtComm2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtComm4, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCommDesc2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtComm5, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCommDesc4, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCommDesc5, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnSave, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnCancel, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnItemLookup, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCommDesc6, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtComm6, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtComm3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCommDesc3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCommCode, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnCommlookup, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCommDesc, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'txtItem
'
Me.txtItem.Location = New System.Drawing.Point(44, 16)
Me.txtItem.OcxState = CType(resources.GetObject("txtItem.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtItem.Size = New System.Drawing.Size(63, 12)
Me.txtItem.TabIndex = 17
'
'lblItem
'
Me.lblItem.CausesValidation = False
Me.lblItem.Location = New System.Drawing.Point(5, 16)
Me.lblItem.OcxState = CType(resources.GetObject("lblItem.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblItem.Size = New System.Drawing.Size(23, 12)
Me.lblItem.TabIndex = 16
Me.lblItem.TabStop = False
'
'lblAsset
'
Me.lblAsset.CausesValidation = False
Me.lblAsset.Location = New System.Drawing.Point(4, 30)
Me.lblAsset.OcxState = CType(resources.GetObject("lblAsset.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblAsset.Size = New System.Drawing.Size(36, 11)
Me.lblAsset.TabIndex = 18
Me.lblAsset.TabStop = False
'
'txtAsset
'
Me.txtAsset.Location = New System.Drawing.Point(44, 30)
Me.txtAsset.OcxState = CType(resources.GetObject("txtAsset.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtAsset.Size = New System.Drawing.Size(112, 12)
Me.txtAsset.TabIndex = 24
'
'Label7
'
Me.Label7.CausesValidation = False
Me.Label7.Location = New System.Drawing.Point(8, 106)
Me.Label7.OcxState = CType(resources.GetObject("Label7.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label7.Size = New System.Drawing.Size(8, 12)
Me.Label7.TabIndex = 30
Me.Label7.TabStop = False
'
'Label8
'
Me.Label8.CausesValidation = False
Me.Label8.Location = New System.Drawing.Point(8, 119)
Me.Label8.OcxState = CType(resources.GetObject("Label8.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label8.Size = New System.Drawing.Size(8, 12)
Me.Label8.TabIndex = 31
Me.Label8.TabStop = False
'
'Label9
'
Me.Label9.CausesValidation = False
Me.Label9.Location = New System.Drawing.Point(8, 133)
Me.Label9.OcxState = CType(resources.GetObject("Label9.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label9.Size = New System.Drawing.Size(12, 12)
Me.Label9.TabIndex = 32
Me.Label9.TabStop = False
'
'Label10
'
Me.Label10.CausesValidation = False
Me.Label10.Location = New System.Drawing.Point(8, 147)
Me.Label10.OcxState = CType(resources.GetObject("Label10.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label10.Size = New System.Drawing.Size(8, 11)
Me.Label10.TabIndex = 33
Me.Label10.TabStop = False
'
'Label11
'
Me.Label11.CausesValidation = False
Me.Label11.Location = New System.Drawing.Point(9, 79)
Me.Label11.OcxState = CType(resources.GetObject("Label11.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label11.Size = New System.Drawing.Size(8, 9)
Me.Label11.TabIndex = 28
Me.Label11.TabStop = False
'
'Label12
'
Me.Label12.CausesValidation = False
Me.Label12.Location = New System.Drawing.Point(9, 92)
Me.Label12.OcxState = CType(resources.GetObject("Label12.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label12.Size = New System.Drawing.Size(7, 11)
Me.Label12.TabIndex = 29
Me.Label12.TabStop = False
'
'txtComm1
'
Me.txtComm1.Location = New System.Drawing.Point(18, 77)
Me.txtComm1.OcxState = CType(resources.GetObject("txtComm1.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtComm1.Size = New System.Drawing.Size(50, 12)
Me.txtComm1.TabIndex = 34
'
'txtCommDesc1
'
Me.txtCommDesc1.Location = New System.Drawing.Point(70, 77)
Me.txtCommDesc1.OcxState = CType(resources.GetObject("txtCommDesc1.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCommDesc1.Size = New System.Drawing.Size(50, 12)
Me.txtCommDesc1.TabIndex = 35
'
'txtComm2
'
Me.txtComm2.Location = New System.Drawing.Point(18, 91)
Me.txtComm2.OcxState = CType(resources.GetObject("txtComm2.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtComm2.Size = New System.Drawing.Size(50, 12)
Me.txtComm2.TabIndex = 36
'
'txtComm4
'
Me.txtComm4.Location = New System.Drawing.Point(18, 118)
Me.txtComm4.OcxState = CType(resources.GetObject("txtComm4.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtComm4.Size = New System.Drawing.Size(50, 12)
Me.txtComm4.TabIndex = 38
'
'txtCommDesc2
'
Me.txtCommDesc2.Location = New System.Drawing.Point(70, 90)
Me.txtCommDesc2.OcxState = CType(resources.GetObject("txtCommDesc2.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCommDesc2.Size = New System.Drawing.Size(50, 12)
Me.txtCommDesc2.TabIndex = 39
'
'txtComm5
'
Me.txtComm5.Location = New System.Drawing.Point(18, 132)
Me.txtComm5.OcxState = CType(resources.GetObject("txtComm5.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtComm5.Size = New System.Drawing.Size(50, 12)
Me.txtComm5.TabIndex = 40
'
'txtCommDesc4
'
Me.txtCommDesc4.Location = New System.Drawing.Point(70, 117)
Me.txtCommDesc4.OcxState = CType(resources.GetObject("txtCommDesc4.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCommDesc4.Size = New System.Drawing.Size(50, 12)
Me.txtCommDesc4.TabIndex = 42
'
'txtCommDesc5
'
Me.txtCommDesc5.Location = New System.Drawing.Point(70, 130)
Me.txtCommDesc5.OcxState = CType(resources.GetObject("txtCommDesc5.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCommDesc5.Size = New System.Drawing.Size(50, 12)
Me.txtCommDesc5.TabIndex = 43
'
'btnSave
'
Me.btnSave.Location = New System.Drawing.Point(124, 100)
Me.btnSave.OcxState = CType(resources.GetObject("btnSave.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnSave.Size = New System.Drawing.Size(32, 20)
Me.btnSave.TabIndex = 44
'
'btnCancel
'
Me.btnCancel.Location = New System.Drawing.Point(124, 124)
Me.btnCancel.OcxState = CType(resources.GetObject("btnCancel.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnCancel.Size = New System.Drawing.Size(32, 20)
Me.btnCancel.TabIndex = 45
'
'btnItemLookup
'
Me.btnItemLookup.Location = New System.Drawing.Point(110, 16)
Me.btnItemLookup.OcxState = CType(resources.GetObject("btnItemLookup.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnItemLookup.Size = New System.Drawing.Size(17, 12)
Me.btnItemLookup.TabIndex = 46
'
'txtCommDesc6
'
Me.txtCommDesc6.Location = New System.Drawing.Point(70, 144)
Me.txtCommDesc6.OcxState = CType(resources.GetObject("txtCommDesc6.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCommDesc6.Size = New System.Drawing.Size(50, 12)
Me.txtCommDesc6.TabIndex = 50
'
'txtComm6
'
Me.txtComm6.Location = New System.Drawing.Point(18, 145)
Me.txtComm6.OcxState = CType(resources.GetObject("txtComm6.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtComm6.Size = New System.Drawing.Size(50, 12)
Me.txtComm6.TabIndex = 49
'
'txtComm3
'
Me.txtComm3.Location = New System.Drawing.Point(18, 105)
Me.txtComm3.OcxState = CType(resources.GetObject("txtComm3.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtComm3.Size = New System.Drawing.Size(50, 12)
Me.txtComm3.TabIndex = 37
'
'txtCommDesc3
'
Me.txtCommDesc3.Location = New System.Drawing.Point(70, 104)
Me.txtCommDesc3.OcxState = CType(resources.GetObject("txtCommDesc3.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCommDesc3.Size = New System.Drawing.Size(50, 12)
Me.txtCommDesc3.TabIndex = 41
'
'Label1
'
Me.Label1.CausesValidation = False
Me.Label1.Location = New System.Drawing.Point(4, 45)
Me.Label1.OcxState = CType(resources.GetObject("Label1.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label1.Size = New System.Drawing.Size(80, 10)
Me.Label1.TabIndex = 26
Me.Label1.TabStop = False
'
'txtCommCode
'
Me.txtCommCode.Location = New System.Drawing.Point(84, 45)
Me.txtCommCode.OcxState = CType(resources.GetObject("txtCommCode.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCommCode.Size = New System.Drawing.Size(52, 12)
Me.txtCommCode.TabIndex = 27
'
'btnCommlookup
'
Me.btnCommlookup.Location = New System.Drawing.Point(138, 45)
Me.btnCommlookup.OcxState = CType(resources.GetObject("btnCommlookup.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnCommlookup.Size = New System.Drawing.Size(16, 12)
Me.btnCommlookup.TabIndex = 47
'
'txtCommDesc
'
Me.txtCommDesc.Location = New System.Drawing.Point(6, 61)
Me.txtCommDesc.OcxState = CType(resources.GetObject("txtCommDesc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCommDesc.Size = New System.Drawing.Size(148, 12)
Me.txtCommDesc.TabIndex = 48
'
'frmItemDetails
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.txtCommDesc6)
Me.Controls.Add(Me.txtComm6)
Me.Controls.Add(Me.btnItemLookup)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnSave)
Me.Controls.Add(Me.txtCommDesc5)
Me.Controls.Add(Me.txtCommDesc4)
Me.Controls.Add(Me.txtComm5)
Me.Controls.Add(Me.txtCommDesc2)
Me.Controls.Add(Me.txtComm4)
Me.Controls.Add(Me.txtComm2)
Me.Controls.Add(Me.txtCommDesc1)
Me.Controls.Add(Me.txtComm1)
Me.Controls.Add(Me.Label10)
Me.Controls.Add(Me.Label9)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.txtAsset)
Me.Controls.Add(Me.lblAsset)
Me.Controls.Add(Me.txtItem)
Me.Controls.Add(Me.lblItem)
Me.Controls.Add(Me.Label11)
Me.Controls.Add(Me.Label12)
Me.Controls.Add(Me.txtComm3)
Me.Controls.Add(Me.txtCommDesc3)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtCommCode)
Me.Controls.Add(Me.btnCommlookup)
Me.Controls.Add(Me.txtCommDesc)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmItemDetails"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "New Equipment Maintenace"
CType(Me.txtItem, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblItem, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblAsset, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtAsset, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label7, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label8, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label9, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label10, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label11, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label12, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtComm1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCommDesc1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtComm2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtComm4, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCommDesc2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtComm5, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCommDesc4, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCommDesc5, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnSave, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnCancel, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnItemLookup, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCommDesc6, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtComm6, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtComm3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCommDesc3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCommCode, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnCommlookup, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCommDesc, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

Dim objInv As tinventoryRecord ' Inventory DB structure


Dim objCommList As tcommodityRecord 'Commodity db structure

Public Sub InitializeItemScreen()


If g_Inventory_mode = "Add" Then
Me.Text = " New Equipment Maintenance"
PopulateWithCurrentValues()
'txtAsset.Focus()
ElseIf g_Inventory_mode = "Edit" Then
Me.Text = " Edit Equipment Maintenance"
PopulateItemScreen(g_ItemNo)
'txtItem.Focus()
End If
txtItem.Text = g_ItemNo
End Sub
Public Sub PopulateItemScreen(ByVal iTemp As String)
Dim itemp1 As String
Dim itempCommCode As String
If g_objItem Is Nothing Then
g_objItem = New frmItemDetails
End If

objData.FindRecordByField(objInv, iTemp, 0, InvDBName)

g_objItem.txtItem.Text = iTemp 'objData.GetFieldValue(0, InvDBName)


g_objItem.txtAsset.Text = objData.GetFieldValue(2, InvDBName)
g_objItem.txtCommCode.Text = objData.GetFieldValue(3, InvDBName)
itempCommCode = Trim(g_objItem.txtCommCode.Text)

objData.FindRecordByField(objCommList, Trim(itempCommCode).PadRight(4, " "), 0,


CommDBName)
itemp1 = objData.GetFieldValue(1, CommDBName)
g_objItem.txtCommDesc.Text = itemp1 g_objItem.txtComm1.Text =
objData.GetFieldValue(2, CommDBName)
g_objItem.txtComm2.Text = objData.GetFieldValue(3, CommDBName)
g_objItem.txtComm3.Text = objData.GetFieldValue(4, CommDBName)
g_objItem.txtComm4.Text = objData.GetFieldValue(5, CommDBName)
g_objItem.txtComm5.Text = objData.GetFieldValue(6, CommDBName)
g_objItem.txtComm6.Text = objData.GetFieldValue(7, CommDBName)

g_objItem.txtCommDesc1.Text = objData.GetFieldValue(4, InvDBName)


g_objItem.txtCommDesc2.Text = objData.GetFieldValue(5, InvDBName)
g_objItem.txtCommDesc3.Text = objData.GetFieldValue(6, InvDBName)
g_objItem.txtCommDesc4.Text = objData.GetFieldValue(7, InvDBName)
g_objItem.txtCommDesc5.Text = objData.GetFieldValue(8, InvDBName)
g_objItem.txtCommDesc6.Text = objData.GetFieldValue(9, InvDBName)
End Sub
Private Sub PopulateWithCurrentValues()
txtAsset.Text = Asset
txtCommCode.Text = CommodityCode
txtCommDesc.Text = CommodityDesc
txtComm1.Text = CommodityCode1
txtComm2.Text = CommodityCode2
txtComm3.Text = CommodityCode3
txtComm4.Text = CommodityCode4
txtComm5.Text = CommodityCode5
txtComm6.Text = CommodityCode6
txtCommDesc1.Text = CommodityDesc1
txtCommDesc2.Text = CommodityDesc2
txtCommDesc3.Text = CommodityDesc3
txtCommDesc4.Text = CommodityDesc4
txtCommDesc5.Text = CommodityDesc5
txtCommDesc6.Text = CommodityDesc6
End Sub
Private Sub SetCurrentValues()
Asset = txtAsset.Text
CommodityCode = txtCommCode.Text
CommodityDesc = txtCommDesc.Text
CommodityCode1 = txtComm1.Text
CommodityCode2 = txtComm2.Text
CommodityCode3 = txtComm3.Text
CommodityCode4 = txtComm4.Text
CommodityCode5 = txtComm5.Text
CommodityCode6 = txtComm6.Text
CommodityDesc1 = txtCommDesc1.Text
CommodityDesc2 = txtCommDesc2.Text
CommodityDesc3 = txtCommDesc3.Text
CommodityDesc4 = txtCommDesc4.Text
CommodityDesc5 = txtCommDesc5.Text
CommodityDesc6 = txtCommDesc6.Text
End Sub
Private Function EmptyItem_Fields()

g_objItem.txtAsset.Text = ""
g_objItem.txtComm1.Text = ""
g_objItem.txtComm2.Text = ""
g_objItem.txtComm3.Text = ""
g_objItem.txtComm4.Text = ""
g_objItem.txtComm5.Text = ""
g_objItem.txtComm6.Text = ""
g_objItem.txtCommCode.Text = ""
g_objItem.txtCommDesc.Text = ""
g_objItem.txtCommDesc1.Text = ""
g_objItem.txtCommDesc2.Text = ""
g_objItem.txtCommDesc3.Text = ""
g_objItem.txtCommDesc4.Text = ""
g_objItem.txtCommDesc5.Text = ""
g_objItem.txtCommDesc6.Text = ""
g_objItem.txtItem.Text = ""

End Function

Private Function EmptyQty_Fields()


g_objQty.txtQty.Text = ""
g_objQty.txtDate.Text = Today()
g_objQty.txtShortDesc.Text = ""
g_objQty.txtUOM.Text = ""
End Function

Private Function AddItemRecord() As Boolean

objInv.inv_commvalue4 = txtCommDesc4.Text
If (Len(Trim(objInv.inv_commvalue4)) > 0) Then
objData.EditSingleField(objInv, InvDBName, 7)
End If

objInv.inv_commvalue5 = txtCommDesc5.Text
If (Len(Trim(objInv.inv_commvalue5)) > 0) Then
objData.EditSingleField(objInv, InvDBName, 8)
End If

objInv.inv_commvalue6 = txtCommDesc6.Text
If (Len(Trim(objInv.inv_commvalue6)) > 0) Then
objData.EditSingleField(objInv, InvDBName, 9)
End If

Return True

End Function
Private Function AddBlankRecord() As Boolean
Dim iTemp As Double

objData.FindRecordByField(objInv, CStr(CInt(g_ItemNo)), 0, InvDBName)

iTemp = objData.GetFieldValue(0, InvDBName)


If g_ItemNo <> iTemp Then

objInv.inv_eqpid = CDbl(CInt(g_ItemNo))
If (g_Inventory_mode = "Add") Then

objData.CreateSingleFieldRecord(objInv, InvDBName, 0)

End If
End If
Return True
End Function
Private Sub EditValues()

objInv.inv_asidnumber = txtAsset.Text
objData.EditSingleField(objInv, InvDBName, 2)

objInv.inv_commcode = txtCommCode.Text
objData.EditSingleField(objInv, InvDBName, 3)

End Sub
Private Sub AddCommValues()
objInv.inv_commvalue1 = txtCommDesc1.Text
If (Len(Trim(objInv.inv_commvalue1)) > 0) Then
objData.EditSingleField(objInv, InvDBName, 4)
End If
objInv.inv_commvalue2 = txtCommDesc2.Text
If (Len(Trim(objInv.inv_commvalue2)) > 0) Then
objData.EditSingleField(objInv, InvDBName, 5)
End If

objInv.inv_commvalue3 = txtCommDesc3.Text
If (Len(Trim(objInv.inv_commvalue3)) > 0) Then
objData.EditSingleField(objInv, InvDBName, 6)
End If
End Sub

Private Function TextValidation() As Boolean

If Trim(txtCommCode.Text) = System.String.Empty Then


MsgBox("Commodity Code cannot be blank", MsgBoxStyle.Information, "IRS")
txtCommCode.Text = System.String.Empty
txtCommCode.Focus()
Return False
End If

Return True
End Function

Private Sub btnSave_ClickEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnSave.ClickEvent
Try
If (TextValidation()) Then
If (AddBlankRecord()) Then
EditValues()
AddCommValues()

If (AddItemRecord()) Then

'Setting Properties
SetCurrentValues()
If g_objQty Is Nothing Then
g_objQty = New frmQuantity
End If
g_objQty.InitializeQtyScreen()
LoadForm(g_objQty)
Else
MessageBox.Show("Record Not Saved", "Information")
End If
End If
Else
Exit Sub
End If
g_objItem.Close()
g_objItem = Nothing
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
End Sub
Private Sub ClearMemory()
g_objCommList = Nothing
g_objEqptList = Nothing
End Sub

Private Sub btnCancel_ClickEvent(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancel.ClickEvent
If g_objEqptList Is Nothing Then
g_objEqptList = New frmEqptList
End If
g_objEqptList.InitializeEqptLookUp()
LoadForm(g_objEqptList)
g_objItem.Close() 'Me.Hide()
g_objItem = Nothing
End Sub

Private Sub btnItemLookup_ClickEvent(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnItemLookup.ClickEvent
If (g_objEqptList Is Nothing) Then
g_objEqptList = New frmEqptList
End If
g_objEqptList.InitializeEqptLookUp()
LoadForm(g_objEqptList)
Me.Hide()

End Sub

Private Sub btnCommlookup_ClickEvent(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCommlookup.ClickEvent
If (g_objCommList Is Nothing) Then
g_objCommList = New frmCommodityList
End If
g_objCommList.InitializeCommLookUp()
LoadForm(g_objCommList)
g_Last_Screen = "Commodity"
Me.Hide()

End Sub

End Class
frmQuantity.vb

Option Strict Off


Option Explicit On

Public Class frmQuantity


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents lblDate As AppForge.Controls.Label
Friend WithEvents lblShortDesc As AppForge.Controls.Label
Friend WithEvents txtDate As AppForge.Controls.TextBox
Friend WithEvents txtQty As AppForge.Controls.TextBox
Friend WithEvents lblQty As AppForge.Controls.Label
Friend WithEvents txtShortDesc As AppForge.Controls.TextBox
Friend WithEvents btnQtyBack As AppForge.Controls.Button
Friend WithEvents btnQtyNext As AppForge.Controls.Button
Friend WithEvents txtUOM As AppForge.Controls.TextBox
Friend WithEvents btnUomLkp As AppForge.Controls.Button
Friend WithEvents btnDate As AppForge.Controls.Button
Friend WithEvents Label1 As AppForge.Controls.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmQuantity))
Me.lblDate = New AppForge.Controls.Label
Me.lblShortDesc = New AppForge.Controls.Label
Me.txtDate = New AppForge.Controls.TextBox
Me.txtQty = New AppForge.Controls.TextBox
Me.lblQty = New AppForge.Controls.Label
Me.txtShortDesc = New AppForge.Controls.TextBox
Me.btnQtyBack = New AppForge.Controls.Button
Me.btnQtyNext = New AppForge.Controls.Button
Me.txtUOM = New AppForge.Controls.TextBox
Me.btnUomLkp = New AppForge.Controls.Button
Me.btnDate = New AppForge.Controls.Button
Me.Label1 = New AppForge.Controls.Label
CType(Me.lblDate, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblShortDesc, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtDate, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtQty, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblQty, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtShortDesc, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnQtyBack, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnQtyNext, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtUOM, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnUomLkp, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnDate, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'lblDate
'
Me.lblDate.CausesValidation = False
Me.lblDate.Location = New System.Drawing.Point(6, 91)
Me.lblDate.OcxState = CType(resources.GetObject("lblDate.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblDate.Size = New System.Drawing.Size(48, 12)
Me.lblDate.TabIndex = 61
Me.lblDate.TabStop = False
'
'lblShortDesc
'
Me.lblShortDesc.CausesValidation = False
Me.lblShortDesc.Location = New System.Drawing.Point(6, 54)
Me.lblShortDesc.OcxState = CType(resources.GetObject("lblShortDesc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblShortDesc.Size = New System.Drawing.Size(72, 11)
Me.lblShortDesc.TabIndex = 51
Me.lblShortDesc.TabStop = False
'
'txtDate
'
Me.txtDate.Location = New System.Drawing.Point(55, 89)
Me.txtDate.OcxState = CType(resources.GetObject("txtDate.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtDate.Size = New System.Drawing.Size(81, 14)
Me.txtDate.TabIndex = 50
'
'txtQty
'
Me.txtQty.Location = New System.Drawing.Point(56, 17)
Me.txtQty.OcxState = CType(resources.GetObject("txtQty.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtQty.Size = New System.Drawing.Size(56, 14)
Me.txtQty.TabIndex = 49
'
'lblQty
'
Me.lblQty.CausesValidation = False
Me.lblQty.Location = New System.Drawing.Point(6, 17)
Me.lblQty.OcxState = CType(resources.GetObject("lblQty.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblQty.Size = New System.Drawing.Size(38, 15)
Me.lblQty.TabIndex = 48
Me.lblQty.TabStop = False
'
'txtShortDesc
'
Me.txtShortDesc.Location = New System.Drawing.Point(6, 70)
Me.txtShortDesc.OcxState = CType(resources.GetObject("txtShortDesc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtShortDesc.Size = New System.Drawing.Size(148, 14)
Me.txtShortDesc.TabIndex = 55
'
'btnQtyBack
'
Me.btnQtyBack.Location = New System.Drawing.Point(75, 136)
Me.btnQtyBack.OcxState = CType(resources.GetObject("btnQtyBack.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnQtyBack.Size = New System.Drawing.Size(40, 20)
Me.btnQtyBack.TabIndex = 68
'
'btnQtyNext
'
Me.btnQtyNext.Location = New System.Drawing.Point(119, 136)
Me.btnQtyNext.OcxState = CType(resources.GetObject("btnQtyNext.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnQtyNext.Size = New System.Drawing.Size(40, 20)
Me.btnQtyNext.TabIndex = 69
'
'txtUOM
'
Me.txtUOM.Location = New System.Drawing.Point(55, 35)
Me.txtUOM.OcxState = CType(resources.GetObject("txtUOM.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtUOM.Size = New System.Drawing.Size(81, 14)
Me.txtUOM.TabIndex = 70
'
'btnUomLkp
'
Me.btnUomLkp.Location = New System.Drawing.Point(138, 35)
Me.btnUomLkp.OcxState = CType(resources.GetObject("btnUomLkp.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnUomLkp.Size = New System.Drawing.Size(16, 14)
Me.btnUomLkp.TabIndex = 71
'
'btnDate
'
Me.btnDate.Location = New System.Drawing.Point(138, 89)
Me.btnDate.OcxState = CType(resources.GetObject("btnDate.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnDate.Size = New System.Drawing.Size(16, 14)
Me.btnDate.TabIndex = 72
'
'Label1
'
Me.Label1.CausesValidation = False
Me.Label1.Location = New System.Drawing.Point(6, 35)
Me.Label1.OcxState = CType(resources.GetObject("Label1.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label1.Size = New System.Drawing.Size(29, 12)
Me.Label1.TabIndex = 59
Me.Label1.TabStop = False
'
'frmQuantity
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnDate)
Me.Controls.Add(Me.btnUomLkp)
Me.Controls.Add(Me.txtUOM)
Me.Controls.Add(Me.btnQtyNext)
Me.Controls.Add(Me.btnQtyBack)
Me.Controls.Add(Me.lblDate)
Me.Controls.Add(Me.lblShortDesc)
Me.Controls.Add(Me.txtDate)
Me.Controls.Add(Me.txtQty)
Me.Controls.Add(Me.lblQty)
Me.Controls.Add(Me.txtShortDesc)
Me.Controls.Add(Me.Label1)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmQuantity"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "New Equipment Maintenance"
CType(Me.lblDate, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblShortDesc, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtDate, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtQty, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblQty, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtShortDesc, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnQtyBack, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnQtyNext, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtUOM, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnUomLkp, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnDate, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim objInv As tinventoryRecord ' Inventory DB structure
Public Sub InitializeQtyScreen()
Dim dtDate As Date
If g_Inventory_mode = "Add" Then
Me.Text = " New Equipment Maintenance"
'txtDate.Text = Today()
PopulateCurrentData()
ElseIf g_Inventory_mode = "Edit" Then
Me.Text = " Edit Equipment Maintenance"
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)

txtQty.Text = objData.GetFieldValue(11, InvDBName)


txtUOM.Text = objData.GetFieldValue(12, InvDBName)
txtShortDesc.Text = objData.GetFieldValue(10, InvDBName)
dtDate = objData.GetFieldValue(13, InvDBName)
If (dtDate = #12:00:00 AM#) Then
txtDate.Text = ""
Else
txtDate.Text = objData.GetFieldValue(13, InvDBName)
End If

End If

End Sub
Private Sub SetCurrentValues()
UOM = txtUOM.Text
Quantity = CInt(txtQty.Text)
ShortDescription = txtShortDesc.Text
DateAvail = txtDate.Text
End Sub
Private Sub PopulateCurrentData()
Dim strDate As String
txtUOM.Text = UOM
txtQty.Text = Quantity
txtShortDesc.Text = ShortDescription
strDate = DateAvail
If (strDate = #12:00:00 AM#) Then
strDate = Date.Today
End If
txtDate.Text = strDate
End Sub
Private Function EmptyMat_Fields()
g_objMat.txtDwags.Text = ""
g_objMat.txtMatConstruct.Text = ""
g_objMat.txtScopeRef.Text = ""
g_objMat.txtSpareParts.Text = ""
g_objMat.txtStorageLoc.Text = ""
g_objMat.cbStatus.Text = ""
g_objMat.cbCondition.Text = ""
g_objMat.cbWhere.Text = ""
End Function
Private Function AddQtyRecord() As Boolean
'Setting the pointer
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)
'stroing the values in the fields and editing the record in the database
objInv.inv_shortdesc = txtShortDesc.Text
objData.EditSingleField(objInv, InvDBName, 10)
objInv.inv_qty = txtQty.Text
objData.EditSingleField(objInv, InvDBName, 11)

Return True
End Function
Private Sub AddMoreQtyRecord()
objInv.inv_uomcode = txtUOM.Text
objData.EditSingleField(objInv, InvDBName, 12)
objInv.inv_dateavail = txtDate.Text
objData.EditSingleField(objInv, InvDBName, 13)
End Sub
Public Function TextValidation() As Boolean
If Trim(txtQty.Text) = System.String.Empty Then
MsgBox("Quantity cannot be blank", MsgBoxStyle.Information, "IRS")
txtQty.Text = System.String.Empty
txtQty.Focus()
Return False

ElseIf Not IsNumeric(txtQty.Text) Then


MsgBox("Quantity must be numeric", MsgBoxStyle.Information, "IRS")
txtQty.Text = System.String.Empty
txtQty.Focus()
Return False

ElseIf CInt(txtQty.Text) < 0 Then


MsgBox("Quantity must be greater than 0", MsgBoxStyle.Information, "IRS")
txtQty.Text = System.String.Empty
txtQty.Focus()
Return False
End If

If Trim(txtUOM.Text) = System.String.Empty Then


MsgBox("UOM cannot be blank", MsgBoxStyle.Information, "IRS")
txtUOM.Text = System.String.Empty
txtUOM.Focus()
Return False
End If

Return True
End Function

Private Sub SaveCurrentAndLoadNext()


Try
SetCurrentValues()
g_objMat.InitializeMatScreen()
LoadForm(g_objMat)
Catch ex As Exception
Throw ex
End Try
End Sub
Private Sub btnQtyNext_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles btnQtyNext.ClickEvent
Try

' For textbox validation


If TextValidation() = False Then
Exit Sub
Else
g_objUOMList = Nothing
If AddQtyRecord() = True Then
AddMoreQtyRecord()
If g_objMat Is Nothing Then
g_objMat = New frmMaterialDetails
End If
If g_objMat Is Nothing Then
g_objMat = New frmMaterialDetails
End If
SaveCurrentAndLoadNext()
Else
MsgBox("Error in Adding Quantity Details", MsgBoxStyle.Information)
Exit Sub
End If

End If
g_objQty.Close()
g_objQty = Nothing
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
End Sub

Private Sub btnQtyBack_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnQtyBack.ClickEvent
If (g_objItem Is Nothing) Then
g_objItem = New frmItemDetails
End If
g_objItem.InitializeItemScreen()
LoadForm(g_objItem)
g_objQty.Close()
g_objQty = Nothing
'Me.Hide()
End Sub

Private Sub btnUomLkp_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnUomLkp.ClickEvent
If (g_objUOMList Is Nothing) Then
g_objUOMList = New frmUomList
End If
g_objUOMList.InitializeUomLookUp()
LoadForm(g_objUOMList)
g_Last_Screen = "UOM"
Me.Hide()

End Sub

Private Sub btnDate_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles


btnDate.ClickEvent
If g_objDate Is Nothing Then
g_objDate = New frmDate
End If
LoadForm(g_objDate)
Me.Hide()
End Sub

Private Sub txtDate_Validating(ByVal sender As Object, ByVal e As


System.ComponentModel.CancelEventArgs) Handles txtDate.Validating

End Sub
End Class
frmMaterialDetails.vb

Option Strict Off


Option Explicit On

Public Class frmMaterialDetails


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents lblCondition As AppForge.Controls.Label
Friend WithEvents lblWhere As AppForge.Controls.Label
Friend WithEvents txtStorageLoc As AppForge.Controls.TextBox
Friend WithEvents lblStorageLoc As AppForge.Controls.Label
Friend WithEvents lblStatus As AppForge.Controls.Label
Friend WithEvents lblScopeRef As AppForge.Controls.Label
Friend WithEvents lblSpareParts As AppForge.Controls.Label
Friend WithEvents txtMatConstruct As AppForge.Controls.TextBox
Friend WithEvents lblMatConst As AppForge.Controls.Label
Friend WithEvents txtDwags As AppForge.Controls.TextBox
Friend WithEvents txtScopeRef As AppForge.Controls.TextBox
Friend WithEvents txtSpareParts As AppForge.Controls.TextBox
Friend WithEvents cbStatus As AppForge.Controls.ComboBox
Friend WithEvents cbCondition As AppForge.Controls.ComboBox
Friend WithEvents btnMatBack As AppForge.Controls.Button
Friend WithEvents btnMatNext As AppForge.Controls.Button
Friend WithEvents cbWhere As AppForge.Controls.ComboBox
Friend WithEvents Label1 As AppForge.Controls.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmMaterialDetails))
Me.lblCondition = New AppForge.Controls.Label
Me.lblWhere = New AppForge.Controls.Label
Me.txtStorageLoc = New AppForge.Controls.TextBox
Me.lblStorageLoc = New AppForge.Controls.Label
Me.lblStatus = New AppForge.Controls.Label
Me.lblScopeRef = New AppForge.Controls.Label
Me.lblSpareParts = New AppForge.Controls.Label
Me.txtMatConstruct = New AppForge.Controls.TextBox
Me.lblMatConst = New AppForge.Controls.Label
Me.txtDwags = New AppForge.Controls.TextBox
Me.txtScopeRef = New AppForge.Controls.TextBox
Me.txtSpareParts = New AppForge.Controls.TextBox
Me.cbStatus = New AppForge.Controls.ComboBox
Me.cbWhere = New AppForge.Controls.ComboBox
Me.cbCondition = New AppForge.Controls.ComboBox
Me.btnMatBack = New AppForge.Controls.Button
Me.btnMatNext = New AppForge.Controls.Button
Me.Label1 = New AppForge.Controls.Label
CType(Me.lblCondition, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblWhere, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtStorageLoc, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblStorageLoc, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblStatus, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblScopeRef, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblSpareParts, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtMatConstruct, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblMatConst, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtDwags, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtScopeRef, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtSpareParts, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbStatus, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbWhere, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbCondition, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnMatBack, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnMatNext, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Label1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'lblCondition
'
Me.lblCondition.CausesValidation = False
Me.lblCondition.Location = New System.Drawing.Point(6, 127)
Me.lblCondition.OcxState = CType(resources.GetObject("lblCondition.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblCondition.Size = New System.Drawing.Size(42, 12)
Me.lblCondition.TabIndex = 64
Me.lblCondition.TabStop = False
'
'lblWhere
'
Me.lblWhere.CausesValidation = False
Me.lblWhere.Location = New System.Drawing.Point(6, 109)
Me.lblWhere.OcxState = CType(resources.GetObject("lblWhere.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblWhere.Size = New System.Drawing.Size(30, 12)
Me.lblWhere.TabIndex = 63
Me.lblWhere.TabStop = False
'
'txtStorageLoc
'
Me.txtStorageLoc.Location = New System.Drawing.Point(100, 30)
Me.txtStorageLoc.OcxState = CType(resources.GetObject("txtStorageLoc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtStorageLoc.Size = New System.Drawing.Size(56, 12)
Me.txtStorageLoc.TabIndex = 60
'
'lblStorageLoc
'
Me.lblStorageLoc.CausesValidation = False
Me.lblStorageLoc.Location = New System.Drawing.Point(6, 31)
Me.lblStorageLoc.OcxState = CType(resources.GetObject("lblStorageLoc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblStorageLoc.Size = New System.Drawing.Size(72, 12)
Me.lblStorageLoc.TabIndex = 59
Me.lblStorageLoc.TabStop = False
'
'lblStatus
'
Me.lblStatus.CausesValidation = False
Me.lblStatus.Location = New System.Drawing.Point(6, 92)
Me.lblStatus.OcxState = CType(resources.GetObject("lblStatus.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblStatus.Size = New System.Drawing.Size(30, 13)
Me.lblStatus.TabIndex = 54
Me.lblStatus.TabStop = False
'
'lblScopeRef
'
Me.lblScopeRef.CausesValidation = False
Me.lblScopeRef.Location = New System.Drawing.Point(6, 60)
Me.lblScopeRef.OcxState = CType(resources.GetObject("lblScopeRef.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblScopeRef.Size = New System.Drawing.Size(61, 11)
Me.lblScopeRef.TabIndex = 52
Me.lblScopeRef.TabStop = False
'
'lblSpareParts
'
Me.lblSpareParts.CausesValidation = False
Me.lblSpareParts.Location = New System.Drawing.Point(6, 43)
Me.lblSpareParts.OcxState = CType(resources.GetObject("lblSpareParts.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblSpareParts.Size = New System.Drawing.Size(88, 13)
Me.lblSpareParts.TabIndex = 51
Me.lblSpareParts.TabStop = False
'
'txtMatConstruct
'
Me.txtMatConstruct.Location = New System.Drawing.Point(100, 16)
Me.txtMatConstruct.OcxState = CType(resources.GetObject("txtMatConstruct.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtMatConstruct.Size = New System.Drawing.Size(56, 12)
Me.txtMatConstruct.TabIndex = 49
'
'lblMatConst
'
Me.lblMatConst.CausesValidation = False
Me.lblMatConst.Location = New System.Drawing.Point(6, 16)
Me.lblMatConst.OcxState = CType(resources.GetObject("lblMatConst.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblMatConst.Size = New System.Drawing.Size(66, 11)
Me.lblMatConst.TabIndex = 48
Me.lblMatConst.TabStop = False
'
'txtDwags
'
Me.txtDwags.Location = New System.Drawing.Point(114, 74)
Me.txtDwags.OcxState = CType(resources.GetObject("txtDwags.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtDwags.Size = New System.Drawing.Size(42, 12)
Me.txtDwags.TabIndex = 57
'
'txtScopeRef
'
Me.txtScopeRef.Location = New System.Drawing.Point(100, 58)
Me.txtScopeRef.OcxState = CType(resources.GetObject("txtScopeRef.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtScopeRef.Size = New System.Drawing.Size(56, 12)
Me.txtScopeRef.TabIndex = 56
'
'txtSpareParts
'
Me.txtSpareParts.Location = New System.Drawing.Point(100, 44)
Me.txtSpareParts.OcxState = CType(resources.GetObject("txtSpareParts.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtSpareParts.Size = New System.Drawing.Size(56, 12)
Me.txtSpareParts.TabIndex = 55
'
'cbStatus
'
Me.cbStatus.Location = New System.Drawing.Point(50, 92)
Me.cbStatus.OcxState = CType(resources.GetObject("cbStatus.OcxState"),
System.Windows.Forms.AxHost.State)
Me.cbStatus.Size = New System.Drawing.Size(66, 12)
Me.cbStatus.TabIndex = 65
'
'cbWhere
'
Me.cbWhere.Location = New System.Drawing.Point(50, 110)
Me.cbWhere.OcxState = CType(resources.GetObject("cbWhere.OcxState"),
System.Windows.Forms.AxHost.State)
Me.cbWhere.Size = New System.Drawing.Size(60, 12)
Me.cbWhere.TabIndex = 66
'
'cbCondition
'
Me.cbCondition.Location = New System.Drawing.Point(50, 127)
Me.cbCondition.OcxState = CType(resources.GetObject("cbCondition.OcxState"),
System.Windows.Forms.AxHost.State)
Me.cbCondition.Size = New System.Drawing.Size(58, 12)
Me.cbCondition.TabIndex = 67
'
'btnMatBack
'
Me.btnMatBack.Location = New System.Drawing.Point(115, 110)
Me.btnMatBack.OcxState = CType(resources.GetObject("btnMatBack.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnMatBack.Size = New System.Drawing.Size(40, 20)
Me.btnMatBack.TabIndex = 68
'
'btnMatNext
'
Me.btnMatNext.Location = New System.Drawing.Point(115, 134)
Me.btnMatNext.OcxState = CType(resources.GetObject("btnMatNext.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnMatNext.Size = New System.Drawing.Size(40, 20)
Me.btnMatNext.TabIndex = 69
'
'Label1
'
Me.Label1.CausesValidation = False
Me.Label1.Location = New System.Drawing.Point(7, 75)
Me.Label1.OcxState = CType(resources.GetObject("Label1.OcxState"),
System.Windows.Forms.AxHost.State)
Me.Label1.Size = New System.Drawing.Size(104, 12)
Me.Label1.TabIndex = 53
Me.Label1.TabStop = False
'
'frmMaterialDetails
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnMatNext)
Me.Controls.Add(Me.btnMatBack)
Me.Controls.Add(Me.cbCondition)
Me.Controls.Add(Me.cbWhere)
Me.Controls.Add(Me.cbStatus)
Me.Controls.Add(Me.lblCondition)
Me.Controls.Add(Me.lblWhere)
Me.Controls.Add(Me.txtStorageLoc)
Me.Controls.Add(Me.lblStorageLoc)
Me.Controls.Add(Me.lblStatus)
Me.Controls.Add(Me.lblScopeRef)
Me.Controls.Add(Me.lblSpareParts)
Me.Controls.Add(Me.txtMatConstruct)
Me.Controls.Add(Me.lblMatConst)
Me.Controls.Add(Me.txtDwags)
Me.Controls.Add(Me.txtScopeRef)
Me.Controls.Add(Me.txtSpareParts)
Me.Controls.Add(Me.Label1)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmMaterialDetails"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "frmMaterialDetails"
CType(Me.lblCondition, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblWhere, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtStorageLoc, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblStorageLoc, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblStatus, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblScopeRef, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblSpareParts, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtMatConstruct, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblMatConst, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtDwags, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtScopeRef, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtSpareParts, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbStatus, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbWhere, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbCondition, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnMatBack, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnMatNext, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Label1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim objInv As tinventoryRecord ' Inventory DB structure
Public Sub InitializeMatScreen()

cbStatus.AddItem("")
cbStatus.AddItem("Surplus")
cbStatus.AddItem("Idle")
'Where Combobox
cbWhere.AddItem("")
cbWhere.AddItem("Out of Svs.")
cbWhere.AddItem("In Service")
'Condition Combobox
cbCondition.AddItem("")
cbCondition.AddItem("Excellent")
cbCondition.AddItem("Good")
cbCondition.AddItem("Fair")
cbCondition.AddItem("Poor")

If g_Inventory_mode = "Add" Then


Me.Text = " New Equipment Maintenance"
PopulateCurrentData()

ElseIf g_Inventory_mode = "Edit" Then


Me.Text = " Edit Equipment Maintenance"
'Locate The Editing Record And Populate The Respective
'Controls with Their Respective Values
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)
txtDwags.Text = objData.GetFieldValue(21, InvDBName)
txtMatConstruct.Text = objData.GetFieldValue(25, InvDBName)
txtScopeRef.Text = objData.GetFieldValue(22, InvDBName)
txtSpareParts.Text = objData.GetFieldValue(20, InvDBName)
txtStorageLoc.Text = objData.GetFieldValue(19, InvDBName)

Dim intCounter As Integer


For intCounter = 0 To cbCondition.ListCount
If (cbCondition.get_List(intCounter) = objData.GetFieldValue(17, InvDBName)) Then
cbCondition.ListIndex = intCounter
Exit For
End If
Next
For intCounter = 0 To cbStatus.ListCount
If (cbStatus.get_List(intCounter) = objData.GetFieldValue(14, InvDBName)) Then
cbStatus.ListIndex = intCounter
Exit For
End If
Next

For intCounter = 0 To cbWhere.ListCount


If (cbWhere.get_List(intCounter) = objData.GetFieldValue(15, InvDBName)) Then
cbWhere.ListIndex = intCounter
Exit For
End If
Next
End If

End Sub

Private Sub EmptyManu_Fields()


g_objManu.txtDimensions.Text = ""
g_objManu.txtLongDesc.Text = ""
g_objManu.txtManufacturer.Text = ""
g_objManu.txtMfgNo.Text = ""
g_objManu.txtParts.Text = ""
g_objManu.txtSerial.Text = ""
g_objManu.txtWeight.Text = "0"
g_objManu.cbDispCode.Text = ""
g_objManu.cbNewUsed.Text = ""

End Sub
Private Sub SetCurrentData()
MaterialConstruct = txtMatConstruct.Text
StorageLocation = txtStorageLoc.Text
SpareParts = txtSpareParts.Text
ScopeReference = txtScopeRef.Text
Dwags = txtDwags.Text
Status = cbStatus.ListIndex
Where = cbWhere.ListIndex
Condition = cbCondition.ListIndex
End Sub
Private Sub PopulateCurrentData()
txtMatConstruct.Text = MaterialConstruct
txtStorageLoc.Text = StorageLocation
txtSpareParts.Text = SpareParts
txtScopeRef.Text = ScopeReference
txtDwags.Text = Dwags
cbStatus.ListIndex = Status
cbWhere.ListIndex = Where
cbCondition.ListIndex = Condition
End Sub
Private Function AddMatRecord() As Boolean

'Setting the pointer


objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)
'stroing the values in the fields and editing the record in the database
objInv.inv_status = cbStatus.Text
objData.EditSingleField(objInv, InvDBName, 14)

objInv.inv_where = cbWhere.Text
objData.EditSingleField(objInv, InvDBName, 15)

objInv.inv_condition = cbCondition.Text
objData.EditSingleField(objInv, InvDBName, 17)
Return True
End Function
Private Sub AddMoreMaTRecords()

objInv.inv_assettag = txtStorageLoc.Text
objData.EditSingleField(objInv, InvDBName, 19)

objInv.inv_spareparts = txtSpareParts.Text
objData.EditSingleField(objInv, InvDBName, 20)

objInv.inv_dwgsmanuals = txtDwags.Text
objData.EditSingleField(objInv, InvDBName, 21)

End Sub

Private Sub AddFewMoreMatRecords()

objInv.inv_scrapcode = txtScopeRef.Text
objData.EditSingleField(objInv, InvDBName, 22)

objInv.inv_constmatl = txtMatConstruct.Text
objData.EditSingleField(objInv, InvDBName, 25)

End Sub

Public Function TextValidation() As Boolean


If Trim(txtSpareParts.Text) = System.String.Empty Then
MsgBox("Spare Parts cannot be blank", MsgBoxStyle.Information, "IRS")
txtSpareParts.Text = System.String.Empty
txtSpareParts.Focus()
Return False
End If

If Trim(cbStatus.Text) = System.String.Empty Then


MsgBox("Status cannot be blank", MsgBoxStyle.Information, "IRS")
cbStatus.Text = System.String.Empty
cbStatus.Focus()
Return False
End If

If Trim(txtDwags.Text) = System.String.Empty Then


MsgBox("Dwgs/Manuals cannot be blank", MsgBoxStyle.Information, "IRS")

txtDwags.Text = System.String.Empty
txtDwags.Focus()
Return False
End If

If Trim(cbWhere.Text) = System.String.Empty Then


MsgBox("Where cannot be blank", MsgBoxStyle.Information, "IRS")
cbWhere.Text = System.String.Empty
cbWhere.Focus()
Return False
End If

If Trim(cbCondition.Text) = System.String.Empty Then


MsgBox("Condition cannot be blank", MsgBoxStyle.Information, "IRS")
cbCondition.Text = System.String.Empty
cbCondition.Focus()
Return False
End If

Return True
End Function

Private Sub btnMatNext_ClickEvent(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnMatNext.ClickEvent
Try

' For textbox validation


If TextValidation() = False Then
Exit Sub
Else
cbCondition.AddItem("Excellent")
cbCondition.AddItem("Good")
cbCondition.AddItem("Fair")
cbCondition.AddItem("Poor")
If AddMatRecord() = True Then

AddMoreMaTRecords()

AddFewMoreMatRecords()

If (cbCondition.Text = "Excellent") Then


ConditionFactor = 0.5
ElseIf (cbCondition.Text = "Good") Then
ConditionFactor = 0.8 * 0.35
ElseIf (cbCondition.Text = "Fair") Then
ConditionFactor = 0.8 * 0.2
Else
ConditionFactor = 0.1
End If
SetCurrentData()

If g_objManu Is Nothing Then


g_objManu = New frmManufactDetails
End If

g_objManu.InitializeManuScreen()

LoadForm(g_objManu)
Else
MsgBox("Error in Adding Quantity Details", MsgBoxStyle.Information)
Exit Sub
End If

End If
g_objMat.Close()
g_objMat = Nothing
Catch Exc As Exception
MessageBox.Show(Exc.Message)
End Try
End Sub

Private Sub btnMatBack_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnMatBack.ClickEvent
Try
If (g_objQty Is Nothing) Then
g_objQty = New frmQuantity
End If
g_objQty.InitializeQtyScreen()
LoadForm(g_objQty)
g_objMat.Close()
g_objMat = Nothing
Catch Exc As Exception
MessageBox.Show(Exc.Message)
End Try
End Sub

End Class
frmManufactDetails.vb

Option Strict Off


Option Explicit On

Public Class frmManufactDetails


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtMfgNo As AppForge.Controls.TextBox
Friend WithEvents txtLongDesc As AppForge.Controls.TextBox
Friend WithEvents lblLngDesc As AppForge.Controls.Label
Friend WithEvents lblDispCode As AppForge.Controls.Label
Friend WithEvents lblMfg As AppForge.Controls.Label
Friend WithEvents lblSerial As AppForge.Controls.Label
Friend WithEvents txtWeight As AppForge.Controls.TextBox
Friend WithEvents lblWeight As AppForge.Controls.Label
Friend WithEvents lblParts As AppForge.Controls.Label
Friend WithEvents lblDim As AppForge.Controls.Label
Friend WithEvents lblNewUsed As AppForge.Controls.Label
Friend WithEvents txtSerial As AppForge.Controls.TextBox
Friend WithEvents txtManufacturer As AppForge.Controls.TextBox
Friend WithEvents lblManufact As AppForge.Controls.Label
Friend WithEvents txtParts As AppForge.Controls.TextBox
Friend WithEvents txtDimensions As AppForge.Controls.TextBox
Friend WithEvents cbNewUsed As AppForge.Controls.ComboBox
Friend WithEvents btnManuNext As AppForge.Controls.Button
Friend WithEvents btnManuBack As AppForge.Controls.Button
Friend WithEvents cbDispCode As AppForge.Controls.ComboBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmManufactDetails))
Me.txtMfgNo = New AppForge.Controls.TextBox
Me.txtLongDesc = New AppForge.Controls.TextBox
Me.lblLngDesc = New AppForge.Controls.Label
Me.lblDispCode = New AppForge.Controls.Label
Me.lblMfg = New AppForge.Controls.Label
Me.lblSerial = New AppForge.Controls.Label
Me.txtWeight = New AppForge.Controls.TextBox
Me.lblWeight = New AppForge.Controls.Label
Me.lblParts = New AppForge.Controls.Label
Me.lblDim = New AppForge.Controls.Label
Me.lblNewUsed = New AppForge.Controls.Label
Me.txtSerial = New AppForge.Controls.TextBox
Me.txtManufacturer = New AppForge.Controls.TextBox
Me.lblManufact = New AppForge.Controls.Label
Me.txtParts = New AppForge.Controls.TextBox
Me.txtDimensions = New AppForge.Controls.TextBox
Me.cbNewUsed = New AppForge.Controls.ComboBox
Me.btnManuNext = New AppForge.Controls.Button
Me.btnManuBack = New AppForge.Controls.Button
Me.cbDispCode = New AppForge.Controls.ComboBox
CType(Me.txtMfgNo, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtLongDesc, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLngDesc, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblDispCode, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblMfg, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblSerial, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtWeight, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblWeight, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblParts, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblDim, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblNewUsed, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtSerial, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtManufacturer, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblManufact, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtParts, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtDimensions, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbNewUsed, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnManuNext, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnManuBack, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbDispCode, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'txtMfgNo
'
Me.txtMfgNo.Location = New System.Drawing.Point(78, 88)
Me.txtMfgNo.OcxState = CType(resources.GetObject("txtMfgNo.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtMfgNo.Size = New System.Drawing.Size(76, 12)
Me.txtMfgNo.TabIndex = 66
'
'txtLongDesc
'
Me.txtLongDesc.Location = New System.Drawing.Point(4, 132)
Me.txtLongDesc.OcxState = CType(resources.GetObject("txtLongDesc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLongDesc.Size = New System.Drawing.Size(80, 24)
Me.txtLongDesc.TabIndex = 65
'
'lblLngDesc
'
Me.lblLngDesc.CausesValidation = False
Me.lblLngDesc.Location = New System.Drawing.Point(4, 119)
Me.lblLngDesc.OcxState = CType(resources.GetObject("lblLngDesc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLngDesc.Size = New System.Drawing.Size(78, 12)
Me.lblLngDesc.TabIndex = 64
Me.lblLngDesc.TabStop = False
'
'lblDispCode
'
Me.lblDispCode.CausesValidation = False
Me.lblDispCode.Location = New System.Drawing.Point(4, 104)
Me.lblDispCode.OcxState = CType(resources.GetObject("lblDispCode.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblDispCode.Size = New System.Drawing.Size(44, 12)
Me.lblDispCode.TabIndex = 63
Me.lblDispCode.TabStop = False
'
'lblMfg
'
Me.lblMfg.CausesValidation = False
Me.lblMfg.Location = New System.Drawing.Point(4, 90)
Me.lblMfg.OcxState = CType(resources.GetObject("lblMfg.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblMfg.Size = New System.Drawing.Size(64, 11)
Me.lblMfg.TabIndex = 62
Me.lblMfg.TabStop = False
'
'lblSerial
'
Me.lblSerial.CausesValidation = False
Me.lblSerial.Location = New System.Drawing.Point(4, 29)
Me.lblSerial.OcxState = CType(resources.GetObject("lblSerial.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblSerial.Size = New System.Drawing.Size(34, 9)
Me.lblSerial.TabIndex = 61
Me.lblSerial.TabStop = False
'
'txtWeight
'
Me.txtWeight.Location = New System.Drawing.Point(122, 72)
Me.txtWeight.OcxState = CType(resources.GetObject("txtWeight.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtWeight.Size = New System.Drawing.Size(32, 12)
Me.txtWeight.TabIndex = 58
'
'lblWeight
'
Me.lblWeight.CausesValidation = False
Me.lblWeight.Location = New System.Drawing.Point(80, 72)
Me.lblWeight.OcxState = CType(resources.GetObject("lblWeight.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblWeight.Size = New System.Drawing.Size(31, 16)
Me.lblWeight.TabIndex = 54
Me.lblWeight.TabStop = False
'
'lblParts
'
Me.lblParts.CausesValidation = False
Me.lblParts.Location = New System.Drawing.Point(4, 72)
Me.lblParts.OcxState = CType(resources.GetObject("lblParts.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblParts.Size = New System.Drawing.Size(34, 12)
Me.lblParts.TabIndex = 53
Me.lblParts.TabStop = False
'
'lblDim
'
Me.lblDim.CausesValidation = False
Me.lblDim.Location = New System.Drawing.Point(4, 55)
Me.lblDim.OcxState = CType(resources.GetObject("lblDim.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblDim.Size = New System.Drawing.Size(47, 11)
Me.lblDim.TabIndex = 52
Me.lblDim.TabStop = False
'
'lblNewUsed
'
Me.lblNewUsed.CausesValidation = False
Me.lblNewUsed.Location = New System.Drawing.Point(4, 42)
Me.lblNewUsed.OcxState = CType(resources.GetObject("lblNewUsed.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblNewUsed.Size = New System.Drawing.Size(52, 9)
Me.lblNewUsed.TabIndex = 51
Me.lblNewUsed.TabStop = False
'
'txtSerial
'
Me.txtSerial.Location = New System.Drawing.Point(74, 31)
Me.txtSerial.OcxState = CType(resources.GetObject("txtSerial.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtSerial.Size = New System.Drawing.Size(80, 12)
Me.txtSerial.TabIndex = 50
'
'txtManufacturer
'
Me.txtManufacturer.Location = New System.Drawing.Point(74, 16)
Me.txtManufacturer.OcxState = CType(resources.GetObject("txtManufacturer.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtManufacturer.Size = New System.Drawing.Size(80, 12)
Me.txtManufacturer.TabIndex = 49
'
'lblManufact
'
Me.lblManufact.CausesValidation = False
Me.lblManufact.Location = New System.Drawing.Point(4, 16)
Me.lblManufact.OcxState = CType(resources.GetObject("lblManufact.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblManufact.Size = New System.Drawing.Size(62, 16)
Me.lblManufact.TabIndex = 48
Me.lblManufact.TabStop = False
'
'txtParts
'
Me.txtParts.Location = New System.Drawing.Point(44, 72)
Me.txtParts.OcxState = CType(resources.GetObject("txtParts.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtParts.Size = New System.Drawing.Size(30, 12)
Me.txtParts.TabIndex = 57
'
'txtDimensions
'
Me.txtDimensions.Location = New System.Drawing.Point(58, 57)
Me.txtDimensions.OcxState = CType(resources.GetObject("txtDimensions.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtDimensions.Size = New System.Drawing.Size(96, 12)
Me.txtDimensions.TabIndex = 56
'
'cbNewUsed
'
Me.cbNewUsed.Location = New System.Drawing.Point(56, 45)
Me.cbNewUsed.OcxState = CType(resources.GetObject("cbNewUsed.OcxState"),
System.Windows.Forms.AxHost.State)
Me.cbNewUsed.Size = New System.Drawing.Size(48, 8)
Me.cbNewUsed.TabIndex = 67
'
'btnManuNext
'
Me.btnManuNext.Location = New System.Drawing.Point(118, 139)
Me.btnManuNext.OcxState = CType(resources.GetObject("btnManuNext.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnManuNext.Size = New System.Drawing.Size(40, 20)
Me.btnManuNext.TabIndex = 69
'
'btnManuBack
'
Me.btnManuBack.Location = New System.Drawing.Point(118, 116)
Me.btnManuBack.OcxState = CType(resources.GetObject("btnManuBack.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnManuBack.Size = New System.Drawing.Size(40, 20)
Me.btnManuBack.TabIndex = 70
'
'cbDispCode
'
Me.cbDispCode.Location = New System.Drawing.Point(60, 104)
Me.cbDispCode.OcxState = CType(resources.GetObject("cbDispCode.OcxState"),
System.Windows.Forms.AxHost.State)
Me.cbDispCode.Size = New System.Drawing.Size(56, 12)
Me.cbDispCode.TabIndex = 68
'
'frmManufactDetails
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnManuBack)
Me.Controls.Add(Me.btnManuNext)
Me.Controls.Add(Me.cbNewUsed)
Me.Controls.Add(Me.txtMfgNo)
Me.Controls.Add(Me.txtLongDesc)
Me.Controls.Add(Me.lblLngDesc)
Me.Controls.Add(Me.lblDispCode)
Me.Controls.Add(Me.lblMfg)
Me.Controls.Add(Me.lblSerial)
Me.Controls.Add(Me.txtWeight)
Me.Controls.Add(Me.lblWeight)
Me.Controls.Add(Me.lblParts)
Me.Controls.Add(Me.lblDim)
Me.Controls.Add(Me.lblNewUsed)
Me.Controls.Add(Me.txtSerial)
Me.Controls.Add(Me.txtManufacturer)
Me.Controls.Add(Me.lblManufact)
Me.Controls.Add(Me.txtParts)
Me.Controls.Add(Me.txtDimensions)
Me.Controls.Add(Me.cbDispCode)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmManufactDetails"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "New Equipment Maintenance"
CType(Me.txtMfgNo, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtLongDesc, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLngDesc, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblDispCode, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblMfg, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblSerial, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtWeight, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblWeight, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblParts, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblDim, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblNewUsed, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtSerial, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtManufacturer, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblManufact, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtParts, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtDimensions, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbNewUsed, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnManuNext, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnManuBack, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbDispCode, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim objInv As tinventoryRecord ' Inventory DB structure
Public Sub InitializeManuScreen()

'Loading Items of Combo Box


'Disp Code Combo
cbDispCode.AddItem("")
cbDispCode.AddItem("Normal")
cbDispCode.AddItem("Propritary")
'New Used Combo
cbNewUsed.AddItem("")
cbNewUsed.AddItem("New")
cbNewUsed.AddItem("Used")
cbNewUsed.AddItem("Refer")

If g_Inventory_mode = "Add" Then


Me.Text = " New Equipment Maintenance"
PopulateWithCurrentData()

ElseIf g_Inventory_mode = "Edit" Then


Me.Text = " Edit Equipment Maintenance"
'Locating Record For Editing And Populating
'Controls with therir respective values
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)
txtDimensions.Text = objData.GetFieldValue(27, InvDBName)
txtLongDesc.Text = objData.GetFieldValue(30, InvDBName)
txtManufacturer.Text = objData.GetFieldValue(23, InvDBName)
txtMfgNo.Text = objData.GetFieldValue(24, InvDBName)
txtParts.Text = objData.GetFieldValue(49, InvDBName)
txtSerial.Text = objData.GetFieldValue(18, InvDBName)
txtWeight.Text = objData.GetFieldValue(28, InvDBName)

Dim intCounter As Integer


For intCounter = 0 To cbNewUsed.ListCount
If (cbNewUsed.get_List(intCounter) = objData.GetFieldValue(16, InvDBName)) Then
cbNewUsed.ListIndex = intCounter
Exit For
End If
Next

For intCounter = 0 To cbDispCode.ListCount


If (cbDispCode.get_List(intCounter) = objData.GetFieldValue(26, InvDBName)) Then
cbDispCode.ListIndex = intCounter
Exit For
End If
Next

End If

End Sub

Private Sub EmptyLoc_Fields()


g_objLoc.txtLocCode.Text = ""
g_objLoc.txtLocDesc.Text = ""
g_objLoc.txtLocContact.Text = ""
g_objLoc.txtLocPhone.Text = ""
g_objLoc.txtLocFax.Text = ""
g_objLoc.txtLocEmail.Text = ""
End Sub
Private Sub PopulateWithCurrentData()
txtManufacturer.Text = Manufacturer
txtSerial.Text = Serial
cbNewUsed.ListIndex = NewUsed
txtDimensions.Text = Dimension
txtParts.Text = Parts
txtWeight.Text = Weight
txtMfgNo.Text = MfgNo
cbDispCode.ListIndex = DisplayCode
txtLongDesc.Text = LongDescription
End Sub
Private Sub SetCurrentData()
Manufacturer = txtManufacturer.Text
Serial = txtSerial.Text
NewUsed = cbNewUsed.ListIndex
Dimension = txtDimensions.Text
Parts = txtParts.Text
Weight = txtWeight.Text
MfgNo = txtMfgNo.Text
DisplayCode = cbDispCode.ListIndex
LongDescription = txtLongDesc.Text
End Sub

Private Function AddManuRecord() As Boolean

'Setting the pointer


objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)
'stroing the values in the fields and editing the record in the database
objInv.inv_newused = cbNewUsed.Text
objData.EditSingleField(objInv, InvDBName, 16)

objInv.inv_serialnumber = txtSerial.Text
objData.EditSingleField(objInv, InvDBName, 18)

objInv.inv_manufacturer = txtManufacturer.Text
objData.EditSingleField(objInv, InvDBName, 23)

Return True
End Function
Private Sub AddMoreManuRecord()

objInv.inv_mfgmodelno = txtMfgNo.Text
objData.EditSingleField(objInv, InvDBName, 24)

objInv.inv_disposalcode = cbDispCode.Text
objData.EditSingleField(objInv, InvDBName, 26)

objInv.inv_dimensions = txtDimensions.Text
objData.EditSingleField(objInv, InvDBName, 27)

End Sub
Private Sub AddSomeMoreManuRecord()

objInv.inv_weight = txtWeight.Text
objData.EditSingleField(objInv, InvDBName, 28)

objInv.inv_longdesc = txtLongDesc.Text
objData.EditSingleField(objInv, InvDBName, 30)

objInv.inv_invtag = txtParts.Text
objData.EditSingleField(objInv, InvDBName, 49)
End Sub
Public Function TextValidation() As Boolean
Try
If Trim(cbNewUsed.Text) = System.String.Empty Then
MsgBox("New/ Used cannot be blank", MsgBoxStyle.Information, "IRS")
cbNewUsed.Text = System.String.Empty
cbNewUsed.Focus()
Return False
End If
If Trim(cbDispCode.Text) = System.String.Empty Then
MsgBox("DispCode cannot be blank", MsgBoxStyle.Information, "IRS")
cbDispCode.Text = System.String.Empty
cbDispCode.Focus()
Return False
End If

' added to fix the bug dated 4th april'05


If txtWeight.Text = System.String.Empty Then
txtWeight.Text = 0
'Return False
End If

If Not (IsNumeric(txtWeight.Text)) Then


MsgBox(" Weight Must be Numeric", MsgBoxStyle.Information, "IRS")
txtWeight.Text = 0
txtWeight.Focus()
Return False
End If
If CInt(txtWeight.Text) < 0 Then
MsgBox("Weight must be greater than 0", MsgBoxStyle.Information, "IRS")
txtWeight.Text = 0
txtWeight.Focus()
Return False
End If

Return True
Catch Exc As Exception
Throw Exc
End Try
End Function
Private Sub btnManuNext_ClickEvent(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnManuNext.ClickEvent
Try
If TextValidation() = False Then
Exit Sub
Else

If AddManuRecord() = True Then


AddMoreManuRecord()
AddSomeMoreManuRecord()
'Added For Checking Only
SetCurrentData()

If g_objLoc Is Nothing Then


g_objLoc = New frmLocation
End If

g_objLoc.InitializeLocScreen()

LoadForm(g_objLoc)
Else
MsgBox("Error in Adding Quantity Details", MsgBoxStyle.Information)
Exit Sub
End If

End If
g_objManu.Close()
g_objManu = Nothing 'Me.Hide()
Catch Exc As Exception
MessageBox.Show(Exc.Message)
End Try
End Sub

Private Sub btnManuBack_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnManuBack.ClickEvent
If (g_objMat Is Nothing) Then
g_objMat = New frmMaterialDetails
End If
g_objMat.InitializeMatScreen()
LoadForm(g_objMat)
g_objManu.Close()
g_objManu = Nothing
End Sub

End Class

frmLocation.vb

Option Strict Off


Option Explicit On

Public Class frmLocation


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtLocEmail As AppForge.Controls.TextBox
Friend WithEvents txtLocFax As AppForge.Controls.TextBox
Friend WithEvents txtLocContact As AppForge.Controls.TextBox
Friend WithEvents btnLocNext As AppForge.Controls.Button
Friend WithEvents btnLocBack As AppForge.Controls.Button
Friend WithEvents lblLocEmail As AppForge.Controls.Label
Friend WithEvents lblLOcFax As AppForge.Controls.Label
Friend WithEvents lblLocContact As AppForge.Controls.Label
Friend WithEvents txtLocDesc As AppForge.Controls.TextBox
Friend WithEvents txtLocCode As AppForge.Controls.TextBox
Friend WithEvents lblLocCode As AppForge.Controls.Label
Friend WithEvents lblLocPhone As AppForge.Controls.Label
Friend WithEvents btnLocLookup As AppForge.Controls.Button
Friend WithEvents txtLocPhone As AppForge.Controls.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmLocation))
Me.txtLocEmail = New AppForge.Controls.TextBox
Me.txtLocFax = New AppForge.Controls.TextBox
Me.txtLocContact = New AppForge.Controls.TextBox
Me.btnLocNext = New AppForge.Controls.Button
Me.btnLocBack = New AppForge.Controls.Button
Me.lblLocEmail = New AppForge.Controls.Label
Me.lblLOcFax = New AppForge.Controls.Label
Me.lblLocContact = New AppForge.Controls.Label
Me.txtLocDesc = New AppForge.Controls.TextBox
Me.txtLocCode = New AppForge.Controls.TextBox
Me.lblLocCode = New AppForge.Controls.Label
Me.lblLocPhone = New AppForge.Controls.Label
Me.txtLocPhone = New AppForge.Controls.TextBox
Me.btnLocLookup = New AppForge.Controls.Button
CType(Me.txtLocEmail, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtLocFax, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtLocContact, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnLocNext, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnLocBack, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLocEmail, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLOcFax, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLocContact, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtLocDesc, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtLocCode, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLocCode, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLocPhone, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtLocPhone, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnLocLookup, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'txtLocEmail
'
Me.txtLocEmail.Location = New System.Drawing.Point(58, 98)
Me.txtLocEmail.OcxState = CType(resources.GetObject("txtLocEmail.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLocEmail.Size = New System.Drawing.Size(98, 14)
Me.txtLocEmail.TabIndex = 25
'
'txtLocFax
'
Me.txtLocFax.Location = New System.Drawing.Point(58, 83)
Me.txtLocFax.OcxState = CType(resources.GetObject("txtLocFax.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLocFax.Size = New System.Drawing.Size(98, 14)
Me.txtLocFax.TabIndex = 24
'
'txtLocContact
'
Me.txtLocContact.Location = New System.Drawing.Point(58, 53)
Me.txtLocContact.OcxState = CType(resources.GetObject("txtLocContact.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLocContact.Size = New System.Drawing.Size(98, 14)
Me.txtLocContact.TabIndex = 22
'
'btnLocNext
'
Me.btnLocNext.Location = New System.Drawing.Point(114, 138)
Me.btnLocNext.OcxState = CType(resources.GetObject("btnLocNext.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnLocNext.Size = New System.Drawing.Size(40, 20)
Me.btnLocNext.TabIndex = 21
'
'btnLocBack
'
Me.btnLocBack.Location = New System.Drawing.Point(72, 138)
Me.btnLocBack.OcxState = CType(resources.GetObject("btnLocBack.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnLocBack.Size = New System.Drawing.Size(40, 20)
Me.btnLocBack.TabIndex = 20
'
'lblLocEmail
'
Me.lblLocEmail.CausesValidation = False
Me.lblLocEmail.Location = New System.Drawing.Point(6, 101)
Me.lblLocEmail.OcxState = CType(resources.GetObject("lblLocEmail.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLocEmail.Size = New System.Drawing.Size(32, 14)
Me.lblLocEmail.TabIndex = 19
Me.lblLocEmail.TabStop = False
'
'lblLOcFax
'
Me.lblLOcFax.CausesValidation = False
Me.lblLOcFax.Location = New System.Drawing.Point(6, 84)
Me.lblLOcFax.OcxState = CType(resources.GetObject("lblLOcFax.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLOcFax.Size = New System.Drawing.Size(40, 13)
Me.lblLOcFax.TabIndex = 18
Me.lblLOcFax.TabStop = False
'
'lblLocContact
'
Me.lblLocContact.CausesValidation = False
Me.lblLocContact.Location = New System.Drawing.Point(6, 54)
Me.lblLocContact.OcxState = CType(resources.GetObject("lblLocContact.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLocContact.Size = New System.Drawing.Size(40, 12)
Me.lblLocContact.TabIndex = 16
Me.lblLocContact.TabStop = False
'
'txtLocDesc
'
Me.txtLocDesc.Location = New System.Drawing.Point(6, 34)
Me.txtLocDesc.OcxState = CType(resources.GetObject("txtLocDesc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLocDesc.Size = New System.Drawing.Size(150, 14)
Me.txtLocDesc.TabIndex = 15
'
'txtLocCode
'
Me.txtLocCode.Location = New System.Drawing.Point(77, 17)
Me.txtLocCode.OcxState = CType(resources.GetObject("txtLocCode.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLocCode.Size = New System.Drawing.Size(62, 14)
Me.txtLocCode.TabIndex = 14
'
'lblLocCode
'
Me.lblLocCode.CausesValidation = False
Me.lblLocCode.Location = New System.Drawing.Point(6, 17)
Me.lblLocCode.OcxState = CType(resources.GetObject("lblLocCode.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLocCode.Size = New System.Drawing.Size(60, 12)
Me.lblLocCode.TabIndex = 13
Me.lblLocCode.TabStop = False
'
'lblLocPhone
'
Me.lblLocPhone.CausesValidation = False
Me.lblLocPhone.Location = New System.Drawing.Point(6, 68)
Me.lblLocPhone.OcxState = CType(resources.GetObject("lblLocPhone.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLocPhone.Size = New System.Drawing.Size(36, 15)
Me.lblLocPhone.TabIndex = 17
Me.lblLocPhone.TabStop = False
'
'txtLocPhone
'
Me.txtLocPhone.Location = New System.Drawing.Point(58, 68)
Me.txtLocPhone.OcxState = CType(resources.GetObject("txtLocPhone.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLocPhone.Size = New System.Drawing.Size(98, 14)
Me.txtLocPhone.TabIndex = 23
'
'btnLocLookup
'
Me.btnLocLookup.Location = New System.Drawing.Point(140, 18)
Me.btnLocLookup.OcxState = CType(resources.GetObject("btnLocLookup.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnLocLookup.Size = New System.Drawing.Size(16, 13)
Me.btnLocLookup.TabIndex = 26
'
'frmLocation
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnLocLookup)
Me.Controls.Add(Me.txtLocEmail)
Me.Controls.Add(Me.txtLocFax)
Me.Controls.Add(Me.txtLocContact)
Me.Controls.Add(Me.btnLocNext)
Me.Controls.Add(Me.btnLocBack)
Me.Controls.Add(Me.lblLocEmail)
Me.Controls.Add(Me.lblLOcFax)
Me.Controls.Add(Me.lblLocContact)
Me.Controls.Add(Me.txtLocDesc)
Me.Controls.Add(Me.txtLocCode)
Me.Controls.Add(Me.lblLocCode)
Me.Controls.Add(Me.lblLocPhone)
Me.Controls.Add(Me.txtLocPhone)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmLocation"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "New Equipment Maintenance"
CType(Me.txtLocEmail, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtLocFax, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtLocContact, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnLocNext, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnLocBack, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLocEmail, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLOcFax, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLocContact, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtLocDesc, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtLocCode, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLocCode, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLocPhone, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtLocPhone, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnLocLookup, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

#Region "Variable Declaration"


Private objInv As tinventoryRecord ' Inventory DB structure
Dim objLocList As tlocationRecord 'Location db structure obj
#End Region

Private Sub EmptyConsign_Fields()


g_objConsign.txtConsignCode.Text = ""
g_objConsign.txtConsignDesc.Text = ""
g_objConsign.txtConsignContact.Text = ""
g_objConsign.txtConsignPhone.Text = ""
g_objConsign.txtConsignFax.Text = ""
g_objConsign.txtConsignEmail.Text = ""

End Sub
Private Sub PopulateWithCurrentData()
txtLocCode.Text = LocationCode
txtLocDesc.Text = LocationDecription
txtLocContact.Text = LocationContact
txtLocPhone.Text = LocationPhone
txtLocFax.Text = LocationFax
txtLocEmail.Text = LocationEmail
End Sub
Private Sub SetCurrentData()
LocationCode = txtLocCode.Text
LocationDecription = txtLocDesc.Text
LocationContact = txtLocContact.Text
LocationPhone = txtLocPhone.Text
LocationFax = txtLocFax.Text
LocationEmail = txtLocEmail.Text
End Sub
Public Function TextValidation() As Boolean
If Trim(txtLocCode.Text) = System.String.Empty Then
MsgBox("Inventory Location cannot be blank", MsgBoxStyle.Information, "IRS")
txtLocCode.Text = System.String.Empty
txtLocCode.Focus()
Return False
End If
Return True
End Function

Private Sub btnLocBack_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnLocBack.ClickEvent
Try
If (g_objManu Is Nothing) Then
g_objManu = New frmManufactDetails
End If
g_objManu.InitializeManuScreen()
LoadForm(g_objManu)
g_objLoc.Close()
g_objLoc = Nothing
'Me.Hide()
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try

End Sub
Public Sub InitializeLocScreen()
Try

If g_Inventory_mode = "Add" Then


Me.Text = " New Equipment Maintenance"
PopulateWithCurrentData()
ElseIf g_Inventory_mode = "Edit" Then
Me.Text = " Edit Equipment Maintenance"
'Locating Record for editing operation and Populating the respective
'Control with Respective values
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)
txtLocCode.Text = objData.GetFieldValue(31, InvDBName)
If Not txtLocCode.Text = System.String.Empty Then
txtLocContact.Text = objData.GetFieldValue(34, InvDBName)
txtLocDesc.Text = "" 'objData.GetFieldValue(31, InvDBName)
txtLocEmail.Text = objData.GetFieldValue(32, InvDBName)
txtLocFax.Text = objData.GetFieldValue(36, InvDBName)
txtLocPhone.Text = objData.GetFieldValue(35, InvDBName)

objData.FindRecordByField(objLocList, Trim(txtLocCode.Text).PadRight(3, ""), 0,


LocDBName)

g_objLoc.txtLocDesc.Text = objData.GetFieldValue(1, LocDBName)


End If
End If
Catch Exc As Exception
MessageBox.Show(Exc.Message, "Error")
End Try
End Sub

Private Sub btnLocNext_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnLocNext.ClickEvent
Try

' For textbox validation


If TextValidation() = False Then
Exit Sub
Else
g_objLocList = Nothing
If AddLocationRecord() = True Then
AddMoreLocationRecord()
If g_objConsign Is Nothing Then
g_objConsign = New frmConsignment
End If
SetCurrentData()
g_objConsign.InitializeConsignmentForm()
LoadForm(g_objConsign)
Me.Hide()

Else
If (g_Inventory_mode = "Edit") Then
MsgBox("Error in Editing Location details", MsgBoxStyle.Information)
Else
MsgBox("Error in Adding Location details", MsgBoxStyle.Information)
End If

Exit Sub
End If

End If
g_objLoc.Close()
g_objLoc = Nothing ' Me.Hide()
Catch Exc As Exception
MessageBox.Show(Exc.Message)
End Try
End Sub

Private Sub btnLocLookup_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnLocLookup.ClickEvent
If (g_objLocList Is Nothing) Then
g_objLocList = New frmLocationList
End If
g_objLocList.InitializeLocLookUp()
LoadForm(g_objLocList)
Me.Hide()
g_Last_Screen = "Loc"
End Sub

Private Function AddLocationRecord() As Boolean


Try
' editing the fields after creating the Inventory record
'Setting the pointer
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)

'stroing the values in the fields and editing the record in the database

objInv.inv_loccode = txtLocCode.Text
objData.EditSingleField(objInv, InvDBName, 31)

objInv.inv_locname = txtLocContact.Text
objData.EditSingleField(objInv, InvDBName, 34)

Return True
Catch ex As Exception
Throw ex
End Try
End Function
Private Sub AddMoreLocationRecord()
objInv.inv_locphone = txtLocPhone.Text
objData.EditSingleField(objInv, InvDBName, 35)

objInv.inv_locfax = txtLocFax.Text
objData.EditSingleField(objInv, InvDBName, 36)

objInv.inv_locemail = txtLocEmail.Text
objData.EditSingleField(objInv, InvDBName, 32)
End Sub
End Class
frmConsignment.vb

Option Strict Off


Option Explicit On

Public Class frmConsignment


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtConsignEmail As AppForge.Controls.TextBox
Friend WithEvents txtConsignFax As AppForge.Controls.TextBox
Friend WithEvents txtConsignPhone As AppForge.Controls.TextBox
Friend WithEvents txtConsignContact As AppForge.Controls.TextBox
Friend WithEvents BtnConsignNext As AppForge.Controls.Button
Friend WithEvents btnConsignBack As AppForge.Controls.Button
Friend WithEvents lblConsignEmail As AppForge.Controls.Label
Friend WithEvents lblConsignFax As AppForge.Controls.Label
Friend WithEvents lblConsignPhone As AppForge.Controls.Label
Friend WithEvents lblConsignContact As AppForge.Controls.Label
Friend WithEvents txtConsignDesc As AppForge.Controls.TextBox
Friend WithEvents txtConsignCode As AppForge.Controls.TextBox
Friend WithEvents LblConsignCode As AppForge.Controls.Label
Friend WithEvents btnConsignLkp As AppForge.Controls.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmConsignment))
Me.txtConsignEmail = New AppForge.Controls.TextBox
Me.txtConsignFax = New AppForge.Controls.TextBox
Me.txtConsignPhone = New AppForge.Controls.TextBox
Me.txtConsignContact = New AppForge.Controls.TextBox
Me.BtnConsignNext = New AppForge.Controls.Button
Me.btnConsignBack = New AppForge.Controls.Button
Me.lblConsignEmail = New AppForge.Controls.Label
Me.lblConsignFax = New AppForge.Controls.Label
Me.lblConsignPhone = New AppForge.Controls.Label
Me.lblConsignContact = New AppForge.Controls.Label
Me.txtConsignDesc = New AppForge.Controls.TextBox
Me.txtConsignCode = New AppForge.Controls.TextBox
Me.LblConsignCode = New AppForge.Controls.Label
Me.btnConsignLkp = New AppForge.Controls.Button
CType(Me.txtConsignEmail, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtConsignFax, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtConsignPhone, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtConsignContact, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BtnConsignNext, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnConsignBack, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblConsignEmail, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblConsignFax, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblConsignPhone, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblConsignContact, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtConsignDesc, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtConsignCode, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LblConsignCode, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnConsignLkp, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'txtConsignEmail
'
Me.txtConsignEmail.Location = New System.Drawing.Point(54, 100)
Me.txtConsignEmail.OcxState = CType(resources.GetObject("txtConsignEmail.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtConsignEmail.Size = New System.Drawing.Size(99, 14)
Me.txtConsignEmail.TabIndex = 38
'
'txtConsignFax
'
Me.txtConsignFax.Location = New System.Drawing.Point(55, 83)
Me.txtConsignFax.OcxState = CType(resources.GetObject("txtConsignFax.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtConsignFax.Size = New System.Drawing.Size(98, 14)
Me.txtConsignFax.TabIndex = 37
'
'txtConsignPhone
'
Me.txtConsignPhone.Location = New System.Drawing.Point(55, 67)
Me.txtConsignPhone.OcxState = CType(resources.GetObject("txtConsignPhone.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtConsignPhone.Size = New System.Drawing.Size(98, 14)
Me.txtConsignPhone.TabIndex = 36
'
'txtConsignContact
'
Me.txtConsignContact.Location = New System.Drawing.Point(55, 51)
Me.txtConsignContact.OcxState = CType(resources.GetObject("txtConsignContact.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtConsignContact.Size = New System.Drawing.Size(98, 14)
Me.txtConsignContact.TabIndex = 35
'
'BtnConsignNext
'
Me.BtnConsignNext.Location = New System.Drawing.Point(113, 136)
Me.BtnConsignNext.OcxState = CType(resources.GetObject("BtnConsignNext.OcxState"),
System.Windows.Forms.AxHost.State)
Me.BtnConsignNext.Size = New System.Drawing.Size(40, 20)
Me.BtnConsignNext.TabIndex = 34
'
'btnConsignBack
'
Me.btnConsignBack.Location = New System.Drawing.Point(69, 137)
Me.btnConsignBack.OcxState = CType(resources.GetObject("btnConsignBack.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnConsignBack.Size = New System.Drawing.Size(40, 20)
Me.btnConsignBack.TabIndex = 33
'
'lblConsignEmail
'
Me.lblConsignEmail.CausesValidation = False
Me.lblConsignEmail.Location = New System.Drawing.Point(5, 99)
Me.lblConsignEmail.OcxState = CType(resources.GetObject("lblConsignEmail.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblConsignEmail.Size = New System.Drawing.Size(32, 16)
Me.lblConsignEmail.TabIndex = 32
Me.lblConsignEmail.TabStop = False
'
'lblConsignFax
'
Me.lblConsignFax.CausesValidation = False
Me.lblConsignFax.Location = New System.Drawing.Point(5, 83)
Me.lblConsignFax.OcxState = CType(resources.GetObject("lblConsignFax.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblConsignFax.Size = New System.Drawing.Size(40, 13)
Me.lblConsignFax.TabIndex = 31
Me.lblConsignFax.TabStop = False
'
'lblConsignPhone
'
Me.lblConsignPhone.CausesValidation = False
Me.lblConsignPhone.Location = New System.Drawing.Point(5, 66)
Me.lblConsignPhone.OcxState = CType(resources.GetObject("lblConsignPhone.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblConsignPhone.Size = New System.Drawing.Size(44, 16)
Me.lblConsignPhone.TabIndex = 30
Me.lblConsignPhone.TabStop = False
'
'lblConsignContact
'
Me.lblConsignContact.CausesValidation = False
Me.lblConsignContact.Location = New System.Drawing.Point(5, 50)
Me.lblConsignContact.OcxState = CType(resources.GetObject("lblConsignContact.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblConsignContact.Size = New System.Drawing.Size(40, 14)
Me.lblConsignContact.TabIndex = 29
Me.lblConsignContact.TabStop = False
'
'txtConsignDesc
'
Me.txtConsignDesc.Location = New System.Drawing.Point(5, 33)
Me.txtConsignDesc.OcxState = CType(resources.GetObject("txtConsignDesc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtConsignDesc.Size = New System.Drawing.Size(148, 14)
Me.txtConsignDesc.TabIndex = 28
'
'txtConsignCode
'
Me.txtConsignCode.Location = New System.Drawing.Point(88, 17)
Me.txtConsignCode.OcxState = CType(resources.GetObject("txtConsignCode.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtConsignCode.Size = New System.Drawing.Size(48, 14)
Me.txtConsignCode.TabIndex = 27
'
'LblConsignCode
'
Me.LblConsignCode.CausesValidation = False
Me.LblConsignCode.Location = New System.Drawing.Point(5, 17)
Me.LblConsignCode.OcxState = CType(resources.GetObject("LblConsignCode.OcxState"),
System.Windows.Forms.AxHost.State)
Me.LblConsignCode.Size = New System.Drawing.Size(79, 12)
Me.LblConsignCode.TabIndex = 26
Me.LblConsignCode.TabStop = False
'
'btnConsignLkp
'
Me.btnConsignLkp.Location = New System.Drawing.Point(137, 18)
Me.btnConsignLkp.OcxState = CType(resources.GetObject("btnConsignLkp.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnConsignLkp.Size = New System.Drawing.Size(16, 13)
Me.btnConsignLkp.TabIndex = 39
'
'frmConsignment
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnConsignLkp)
Me.Controls.Add(Me.txtConsignEmail)
Me.Controls.Add(Me.txtConsignFax)
Me.Controls.Add(Me.txtConsignPhone)
Me.Controls.Add(Me.txtConsignContact)
Me.Controls.Add(Me.BtnConsignNext)
Me.Controls.Add(Me.btnConsignBack)
Me.Controls.Add(Me.lblConsignEmail)
Me.Controls.Add(Me.lblConsignFax)
Me.Controls.Add(Me.lblConsignPhone)
Me.Controls.Add(Me.lblConsignContact)
Me.Controls.Add(Me.txtConsignDesc)
Me.Controls.Add(Me.txtConsignCode)
Me.Controls.Add(Me.LblConsignCode)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmConsignment"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "New Equipment Maintenance"
CType(Me.txtConsignEmail, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtConsignFax, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtConsignPhone, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtConsignContact, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.BtnConsignNext, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnConsignBack, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblConsignEmail, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblConsignFax, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblConsignPhone, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblConsignContact, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtConsignDesc, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtConsignCode, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LblConsignCode, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnConsignLkp, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
#Region "Variable Declaration"
Dim objInv As tinventoryRecord ' Inventory DB structure
Dim objConsignList As tlocationRecord 'Location db structure obj
#End Region

Private Sub EmptyCurrency_Fields()


g_objCurrency.txtForeignCost.Text = "0"
g_objCurrency.txtForeignCurr.Text = ""
g_objCurrency.txtForeignNBV.Text = "0"
g_objCurrency.txtUom.Text = ""
g_objCurrency.ckUpdt.Value = AppForge.Controls.CheckBoxValue.Unchecked

End Sub
Private Sub SetCurrentData()
ConsignMentCode = txtConsignCode.Text
ConsignMentDesc = txtConsignDesc.Text
ConsignMentContact = txtConsignContact.Text
ConsignMentPhone = txtConsignPhone.Text
ConsignMentFax = txtConsignFax.Text
ConsignMentEmail = txtConsignEmail.Text
End Sub
Private Sub PopulateWithCurrentData()
txtConsignCode.Text = ConsignMentCode
txtConsignDesc.Text = ConsignMentDesc
txtConsignContact.Text = ConsignMentContact
txtConsignPhone.Text = ConsignMentPhone
txtConsignFax.Text = ConsignMentFax
txtConsignEmail.Text = ConsignMentEmail
End Sub
Private Sub btnConsignBack_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles btnConsignBack.ClickEvent
If (g_objLoc Is Nothing) Then
g_objLoc = New frmLocation
End If
g_objLoc.InitializeLocScreen()
LoadForm(g_objLoc)
g_objConsign.Close()
g_objConsign = Nothing
'Me.Hide()
End Sub
Public Sub InitializeConsignmentForm()
Try

If g_Inventory_mode = "Add" Then


Me.Text = " New Equipment Maintenance"
PopulateWithCurrentData()
'EmptyConsign_Fields()
ElseIf g_Inventory_mode = "Edit" Then
Me.Text = " Edit Equipment Maintenance"
'Locating Record For Editing And
'Populating The values in Respective controls
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)

txtConsignCode.Text = objData.GetFieldValue(50, InvDBName)


If Not txtConsignCode.Text = System.String.Empty Then

txtConsignContact.Text = objData.GetFieldValue(52, InvDBName)


txtConsignDesc.Text = "" 'objData.GetFieldValue(50, InvDBName)
txtConsignEmail.Text = objData.GetFieldValue(51, InvDBName)
txtConsignFax.Text = objData.GetFieldValue(54, InvDBName)
txtConsignPhone.Text = objData.GetFieldValue(53, InvDBName)

objData.FindRecordByField(objConsignList, Trim(txtConsignCode.Text).PadRight(3,
""), 0, LocDBName)
'objData.FindRecordbyID(CInt(iTemp), LocDBName)
g_objConsign.txtConsignDesc.Text = objData.GetFieldValue(1, LocDBName)
End If
End If
Catch Exc As Exception
MessageBox.Show(Exc.Message)
End Try
End Sub
Private Sub BtnConsignNext_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles BtnConsignNext.ClickEvent
Try
If g_objCurrency Is Nothing Then
g_objCurrency = New frmCurrency
End If

' If TextValidation() = False Then


' Exit Sub
'Else
g_objConsignList = Nothing
If AddConsignmentRecord() = True Then
AddMoreConsignmentRecord()
SetCurrentData()
g_objCurrency.InitializeCurrencyForm()
LoadForm(g_objCurrency)
Else
If (g_Inventory_mode = "Add") Then
MsgBox("Error in Adding Item details", MsgBoxStyle.Information)
Else
MessageBox.Show("Error In Editing Details", "Information")
End If
Exit Sub
End If
'End If
g_objConsign.Close()
g_objConsign = Nothing 'Me.Hide()
Catch Exc As Exception
MessageBox.Show(Exc.Message, "Error")
End Try

End Sub

Private Sub btnConsignLkp_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnConsignLkp.ClickEvent
If g_objConsignList Is Nothing Then
g_objConsignList = New frmConsignLocList
End If
g_objConsignList.InitializeConsignLookUp()
LoadForm(g_objConsignList)
Me.Hide()
g_Last_Screen = "Consign"

End Sub

Private Function AddConsignmentRecord() As Boolean

' editing the fields after creating the Inventory record


'Setting the pointer
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)

'stroing the values in the fields and editing the record in the database
objInv.inv_consignmentcode = txtConsignCode.Text
objData.EditSingleField(objInv, InvDBName, 50)

objInv.inv_consignmentcontact = txtConsignContact.Text
objData.EditSingleField(objInv, InvDBName, 52)

Return True
End Function
Private Sub AddMoreConsignmentRecord()
objInv.inv_consignmentphone = txtConsignPhone.Text
objData.EditSingleField(objInv, InvDBName, 53)

objInv.inv_consignmentfax = txtConsignFax.Text
objData.EditSingleField(objInv, InvDBName, 54)

objInv.inv_consignmentemail = txtConsignEmail.Text
objData.EditSingleField(objInv, InvDBName, 51)
End Sub

Private Function TextValidation() As Boolean


Try
If (txtConsignCode.Text = System.String.Empty) Then
txtConsignCode.Text = System.String.Empty
MessageBox.Show("Consignment Code Can't be Blank", "Information")
txtConsignCode.Focus()
Return (False)
End If
Return True
Catch ex As Exception
Throw ex
End Try
End Function

End Class
frmCurrency.vb

Option Strict Off


Option Explicit On

Public Class frmCurrency


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtUom As AppForge.Controls.TextBox
Friend WithEvents btnCurrBack As AppForge.Controls.Button
Friend WithEvents lblUOM As AppForge.Controls.Label
Friend WithEvents lblNoUpdt As AppForge.Controls.Label
Friend WithEvents lblForeignNBV As AppForge.Controls.Label
Friend WithEvents lblForeignCost As AppForge.Controls.Label
Friend WithEvents txtConverFact As AppForge.Controls.TextBox
Friend WithEvents txtForeignCurr As AppForge.Controls.TextBox
Friend WithEvents lblForeignCurr As AppForge.Controls.Label
Friend WithEvents txtForeignNBV As AppForge.Controls.TextBox
Friend WithEvents txtForeignCost As AppForge.Controls.TextBox
Friend WithEvents lblConverFac As AppForge.Controls.Label
Friend WithEvents ckUpdt As AppForge.Controls.CheckBox
Friend WithEvents btnCurrNext As AppForge.Controls.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmCurrency))
Me.txtUom = New AppForge.Controls.TextBox
Me.btnCurrBack = New AppForge.Controls.Button
Me.lblUOM = New AppForge.Controls.Label
Me.lblNoUpdt = New AppForge.Controls.Label
Me.lblForeignNBV = New AppForge.Controls.Label
Me.lblForeignCost = New AppForge.Controls.Label
Me.txtConverFact = New AppForge.Controls.TextBox
Me.txtForeignCurr = New AppForge.Controls.TextBox
Me.lblForeignCurr = New AppForge.Controls.Label
Me.txtForeignNBV = New AppForge.Controls.TextBox
Me.txtForeignCost = New AppForge.Controls.TextBox
Me.lblConverFac = New AppForge.Controls.Label
Me.ckUpdt = New AppForge.Controls.CheckBox
Me.btnCurrNext = New AppForge.Controls.Button
CType(Me.txtUom, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnCurrBack, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblUOM, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblNoUpdt, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblForeignNBV, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblForeignCost, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtConverFact, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtForeignCurr, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblForeignCurr, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtForeignNBV, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtForeignCost, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblConverFac, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.ckUpdt, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnCurrNext, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'txtUom
'
Me.txtUom.Location = New System.Drawing.Point(84, 107)
Me.txtUom.OcxState = CType(resources.GetObject("txtUom.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtUom.Size = New System.Drawing.Size(68, 14)
Me.txtUom.TabIndex = 38
'
'btnCurrBack
'
Me.btnCurrBack.Location = New System.Drawing.Point(68, 136)
Me.btnCurrBack.OcxState = CType(resources.GetObject("btnCurrBack.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnCurrBack.Size = New System.Drawing.Size(40, 20)
Me.btnCurrBack.TabIndex = 33
'
'lblUOM
'
Me.lblUOM.CausesValidation = False
Me.lblUOM.Location = New System.Drawing.Point(5, 108)
Me.lblUOM.OcxState = CType(resources.GetObject("lblUOM.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblUOM.Size = New System.Drawing.Size(32, 14)
Me.lblUOM.TabIndex = 32
Me.lblUOM.TabStop = False
'
'lblNoUpdt
'
Me.lblNoUpdt.CausesValidation = False
Me.lblNoUpdt.Location = New System.Drawing.Point(5, 88)
Me.lblNoUpdt.OcxState = CType(resources.GetObject("lblNoUpdt.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblNoUpdt.Size = New System.Drawing.Size(43, 13)
Me.lblNoUpdt.TabIndex = 31
Me.lblNoUpdt.TabStop = False
'
'lblForeignNBV
'
Me.lblForeignNBV.CausesValidation = False
Me.lblForeignNBV.Location = New System.Drawing.Point(5, 68)
Me.lblForeignNBV.OcxState = CType(resources.GetObject("lblForeignNBV.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblForeignNBV.Size = New System.Drawing.Size(58, 11)
Me.lblForeignNBV.TabIndex = 30
Me.lblForeignNBV.TabStop = False
'
'lblForeignCost
'
Me.lblForeignCost.CausesValidation = False
Me.lblForeignCost.Location = New System.Drawing.Point(5, 50)
Me.lblForeignCost.OcxState = CType(resources.GetObject("lblForeignCost.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblForeignCost.Size = New System.Drawing.Size(56, 15)
Me.lblForeignCost.TabIndex = 29
Me.lblForeignCost.TabStop = False
'
'txtConverFact
'
Me.txtConverFact.Location = New System.Drawing.Point(84, 33)
Me.txtConverFact.OcxState = CType(resources.GetObject("txtConverFact.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtConverFact.Size = New System.Drawing.Size(68, 14)
Me.txtConverFact.TabIndex = 28
'
'txtForeignCurr
'
Me.txtForeignCurr.Location = New System.Drawing.Point(84, 17)
Me.txtForeignCurr.OcxState = CType(resources.GetObject("txtForeignCurr.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtForeignCurr.Size = New System.Drawing.Size(68, 14)
Me.txtForeignCurr.TabIndex = 27
'
'lblForeignCurr
'
Me.lblForeignCurr.CausesValidation = False
Me.lblForeignCurr.Location = New System.Drawing.Point(5, 16)
Me.lblForeignCurr.OcxState = CType(resources.GetObject("lblForeignCurr.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblForeignCurr.Size = New System.Drawing.Size(75, 12)
Me.lblForeignCurr.TabIndex = 26
Me.lblForeignCurr.TabStop = False
'
'txtForeignNBV
'
Me.txtForeignNBV.Location = New System.Drawing.Point(84, 66)
Me.txtForeignNBV.OcxState = CType(resources.GetObject("txtForeignNBV.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtForeignNBV.Size = New System.Drawing.Size(68, 14)
Me.txtForeignNBV.TabIndex = 36
'
'txtForeignCost
'
Me.txtForeignCost.Location = New System.Drawing.Point(84, 50)
Me.txtForeignCost.OcxState = CType(resources.GetObject("txtForeignCost.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtForeignCost.Size = New System.Drawing.Size(68, 14)
Me.txtForeignCost.TabIndex = 35
'
'lblConverFac
'
Me.lblConverFac.CausesValidation = False
Me.lblConverFac.Location = New System.Drawing.Point(5, 34)
Me.lblConverFac.OcxState = CType(resources.GetObject("lblConverFac.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblConverFac.Size = New System.Drawing.Size(76, 12)
Me.lblConverFac.TabIndex = 39
Me.lblConverFac.TabStop = False
'
'ckUpdt
'
Me.ckUpdt.Location = New System.Drawing.Point(60, 87)
Me.ckUpdt.OcxState = CType(resources.GetObject("ckUpdt.OcxState"),
System.Windows.Forms.AxHost.State)
Me.ckUpdt.Size = New System.Drawing.Size(28, 18)
Me.ckUpdt.TabIndex = 40
'
'btnCurrNext
'
Me.btnCurrNext.Location = New System.Drawing.Point(112, 136)
Me.btnCurrNext.OcxState = CType(resources.GetObject("btnCurrNext.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnCurrNext.Size = New System.Drawing.Size(40, 20)
Me.btnCurrNext.TabIndex = 41
'
'frmCurrency
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnCurrNext)
Me.Controls.Add(Me.ckUpdt)
Me.Controls.Add(Me.lblConverFac)
Me.Controls.Add(Me.txtUom)
Me.Controls.Add(Me.btnCurrBack)
Me.Controls.Add(Me.lblUOM)
Me.Controls.Add(Me.lblNoUpdt)
Me.Controls.Add(Me.lblForeignNBV)
Me.Controls.Add(Me.lblForeignCost)
Me.Controls.Add(Me.txtConverFact)
Me.Controls.Add(Me.txtForeignCurr)
Me.Controls.Add(Me.lblForeignCurr)
Me.Controls.Add(Me.txtForeignNBV)
Me.Controls.Add(Me.txtForeignCost)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmCurrency"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "New Equipment Maintenance"
CType(Me.txtUom, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnCurrBack, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblUOM, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblNoUpdt, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblForeignNBV, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblForeignCost, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtConverFact, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtForeignCurr, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblForeignCurr, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtForeignNBV, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtForeignCost, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblConverFac, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.ckUpdt, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnCurrNext, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

#Region "Variable Declaration"


Dim objInv As tinventoryRecord ' Inventory DB structure
#End Region
Private Sub EmptyCost_fields()
g_objCost.txtAskPrice.Text = "0"
g_objCost.txtCost.Text = "0"
g_objCost.txtLifeRemain.Text = "0"
g_objCost.txtLowestPrice.Text = "0"
g_objCost.txtNBV.Text = ""
g_objCost.txtOrigFreight.Text = ""
g_objCost.txtOrigInstall.Text = ""
g_objCost.TxtTaxValue.Text = "0"
g_objCost.txtTotCost.Text = ""
g_objCost.txtYearCap.Text = ""
End Sub
Private Sub PopulateWithCurrentData()

txtForeignCurr.Text = ForeignCurrency
txtConverFact.Text = ConversionFactor
txtForeignCost.Text = ForeignCost
txtForeignNBV.Text = NBV
txtUom.Text = UOM
If (isUpdate = True) Then
ckUpdt.Value = AppForge.Controls.CheckBoxValue.Checked
Else
ckUpdt.Value = AppForge.Controls.CheckBoxValue.Unchecked
End If

End Sub
Private Sub SetCurrentData()

ForeignCurrency = txtForeignCurr.Text
ConversionFactor = txtConverFact.Text
ForeignCost = txtForeignCost.Text
NBV = txtForeignNBV.Text
isUpdate = ckUpdt.Value
End Sub
Private Sub EditCostvalues()

objInv.inv_originalcost = OriginalCost
objData.EditSingleField(objInv, InvDBName, 38)

objInv.inv_totalcost = TotalCost
objData.EditSingleField(objInv, InvDBName, 40)

End Sub

Private Sub btnCurrBack_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnCurrBack.ClickEvent
If (g_objConsign Is Nothing) Then
g_objConsign = New frmConsignment
End If
g_objConsign.InitializeConsignmentForm()
LoadForm(g_objConsign)
g_objCurrency.Close()
g_objCurrency = Nothing

'Me.Hide()

End Sub
Public Sub InitializeCurrencyForm()
Try

If (g_Inventory_mode = "Add") Then


Me.Text = " New Equipment Maintenance"
PopulateWithCurrentData()
Else
Me.Text = " Edit Equipment Maintenance"
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)
txtConverFact.Text = objData.GetFieldValue(56, InvDBName)
txtForeignCost.Text = objData.GetFieldValue(57, InvDBName)
txtForeignCurr.Text = objData.GetFieldValue(55, InvDBName)
txtForeignNBV.Text = objData.GetFieldValue(58, InvDBName)

If (Len(Trim(objData.GetFieldValue(66, InvDBName))) > 0) Then


If (objData.GetFieldValue(66, InvDBName) = "True") Then
ckUpdt.Value = AppForge.Controls.CheckBoxValue.Checked
Else
ckUpdt.Value = AppForge.Controls.CheckBoxValue.Unchecked
End If
Else
ckUpdt.Value = AppForge.Controls.CheckBoxValue.Unchecked
End If
txtUom.Text = UOM
End If
Catch ex As Exception
Throw ex
Finally

End Try
End Sub

Private Sub StoreValues()


ForeignNBV = txtForeignNBV.Text
ConversionFactor = CDbl(txtConverFact.Text)
OriginalCost = CDbl(txtForeignCost.Text) * CDbl(txtConverFact.Text)
AskingPrice = OriginalCost / 10
TotalCost = Quantity * OriginalCost
LowestPrice = AskingPrice * 0.5

End Sub
Private Sub btnCurrNext_ClickEvent(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCurrNext.ClickEvent
Try
If TextValidation() = False Then
Exit Sub
Else
If AddCurrencyRecord() = True Then
AddMoreCurrencyRecord()
SetCurrentData()

If g_objCost Is Nothing Then

g_objCost = New frmCostDetails

End If

Call StoreValues()
Call EditCostvalues()

g_objCost.InitializeCostDetailForm()

LoadForm(g_objCost)

Else
If (g_Inventory_mode = "Add") Then
MsgBox("Error in Adding Item details", MsgBoxStyle.Information)
Else
MessageBox.Show("Error in Adding Item details", "information")
End If
Exit Sub
End If
End If
g_objCurrency.Close()
g_objCurrency = Nothing 'Me.Hide()
Catch Exc As Exception
MessageBox.Show(Exc.Message, "Error")
End Try
End Sub

Private Function TextValidation() As Boolean


Try
If txtForeignNBV.Text = System.String.Empty Then
txtForeignNBV.Text = 0
End If

If txtConverFact.Text = System.String.Empty Then


txtConverFact.Text = 0
End If

If txtForeignCost.Text = System.String.Empty Then


txtForeignCost.Text = 0
End If
If Not (IsNumeric(txtForeignNBV.Text)) Then
MessageBox.Show("Foreign NBV must be numeric", "Information")
txtForeignNBV.Text = 0
txtForeignNBV.Focus()
Return (False)
End If
If CInt(txtForeignNBV.Text) < 0 Then
MsgBox(" ForeignNBV must be greater than 0", MsgBoxStyle.Information, "IRS")
txtForeignNBV.Text = 0
txtForeignNBV.Focus()
Return False

End If

If Not (IsNumeric(txtConverFact.Text)) Then


MessageBox.Show("Conversion factor must be numeric", "Information")
txtConverFact.Text = 0
txtConverFact.Focus()
Return (False)
End If
If CInt(txtConverFact.Text) < 0 Then
MsgBox(" Conversion Factor must be greater than 0", MsgBoxStyle.Information, "IRS")
txtConverFact.Text = 0
txtConverFact.Focus()
Return False

End If

If Not (IsNumeric(txtForeignCost.Text)) Then


MessageBox.Show("Foreign Cost must be numeric", "Information")
txtForeignCost.Text = 0
txtForeignCost.Focus()
Return (False)
End If
If CInt(txtForeignCost.Text) < 0 Then
MsgBox(" Foreign Cost must be greater than 0", MsgBoxStyle.Information, "IRS")
txtForeignCost.Text = 0
txtForeignCost.Focus()
Return False

End If
Return True
Catch ex As Exception
Throw ex
End Try
End Function

Private Function AddCurrencyRecord() As Boolean


Try
' editing the fields after creating the Inventory record
'Setting the pointer
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)

'storing the values in the fields and editing the record in the database
objInv.inv_foreigncurr = txtForeignCurr.Text
objData.EditSingleField(objInv, InvDBName, 55)

objInv.inv_conversionfactor = txtConverFact.Text
objData.EditSingleField(objInv, InvDBName, 56)

objInv.inv_foreigncost = txtForeignCost.Text
objData.EditSingleField(objInv, InvDBName, 57)

Return True
Catch ex As Exception
Throw ex
End Try
End Function
Private Sub AddMoreCurrencyRecord()

objInv.inv_foreignnbv = txtForeignNBV.Text
objData.EditSingleField(objInv, InvDBName, 58)

If (ckUpdt.Value = AppForge.Controls.CheckBoxValue.Checked) Then


objInv.inv_noupdate = True
Else
objInv.inv_noupdate = False
End If

objData.EditSingleField(objInv, InvDBName, 66)

End Sub

End Class
frmCostDetails.vb

Option Strict Off


Option Explicit On

Public Class frmCostDetails


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtNBV As AppForge.Controls.TextBox
Friend WithEvents BtnCostBack As AppForge.Controls.Button
Friend WithEvents lblNBV As AppForge.Controls.Label
Friend WithEvents lblYearCap As AppForge.Controls.Label
Friend WithEvents lblLifeRem As AppForge.Controls.Label
Friend WithEvents lblOrigInstall As AppForge.Controls.Label
Friend WithEvents txtOrigFreight As AppForge.Controls.TextBox
Friend WithEvents txtCost As AppForge.Controls.TextBox
Friend WithEvents lblCost As AppForge.Controls.Label
Friend WithEvents txtYearCap As AppForge.Controls.TextBox
Friend WithEvents txtLifeRemain As AppForge.Controls.TextBox
Friend WithEvents txtOrigInstall As AppForge.Controls.TextBox
Friend WithEvents lblTotCost As AppForge.Controls.Label
Friend WithEvents txtTotCost As AppForge.Controls.TextBox
Friend WithEvents lblOriFght As AppForge.Controls.Label
Friend WithEvents lblTaxValue As AppForge.Controls.Label
Friend WithEvents lblAskPrice As AppForge.Controls.Label
Friend WithEvents lblLowPrice As AppForge.Controls.Label
Friend WithEvents txtLowestPrice As AppForge.Controls.TextBox
Friend WithEvents txtAskPrice As AppForge.Controls.TextBox
Friend WithEvents TxtTaxValue As AppForge.Controls.TextBox
Friend WithEvents BtnCostReturn As AppForge.Controls.Button

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()


Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmCostDetails))
Me.txtNBV = New AppForge.Controls.TextBox
Me.BtnCostReturn = New AppForge.Controls.Button
Me.BtnCostBack = New AppForge.Controls.Button
Me.lblNBV = New AppForge.Controls.Label
Me.lblYearCap = New AppForge.Controls.Label
Me.lblLifeRem = New AppForge.Controls.Label
Me.lblOrigInstall = New AppForge.Controls.Label
Me.txtOrigFreight = New AppForge.Controls.TextBox
Me.txtCost = New AppForge.Controls.TextBox
Me.lblCost = New AppForge.Controls.Label
Me.txtYearCap = New AppForge.Controls.TextBox
Me.txtLifeRemain = New AppForge.Controls.TextBox
Me.txtOrigInstall = New AppForge.Controls.TextBox
Me.lblTotCost = New AppForge.Controls.Label
Me.txtTotCost = New AppForge.Controls.TextBox
Me.lblOriFght = New AppForge.Controls.Label
Me.lblTaxValue = New AppForge.Controls.Label
Me.lblAskPrice = New AppForge.Controls.Label
Me.lblLowPrice = New AppForge.Controls.Label
Me.txtLowestPrice = New AppForge.Controls.TextBox
Me.txtAskPrice = New AppForge.Controls.TextBox
Me.TxtTaxValue = New AppForge.Controls.TextBox
CType(Me.txtNBV, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BtnCostReturn, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BtnCostBack, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblNBV, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblYearCap, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLifeRem, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblOrigInstall, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtOrigFreight, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtCost, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblCost, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtYearCap, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtLifeRemain, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtOrigInstall, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblTotCost, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtTotCost, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblOriFght, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblTaxValue, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblAskPrice, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.lblLowPrice, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtLowestPrice, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.txtAskPrice, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TxtTaxValue, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'txtNBV
'
Me.txtNBV.Location = New System.Drawing.Point(35, 92)
Me.txtNBV.OcxState = CType(resources.GetObject("txtNBV.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtNBV.Size = New System.Drawing.Size(32, 12)
Me.txtNBV.TabIndex = 38
'
'BtnCostReturn
'
Me.BtnCostReturn.Location = New System.Drawing.Point(117, 138)
Me.BtnCostReturn.OcxState = CType(resources.GetObject("BtnCostReturn.OcxState"),
System.Windows.Forms.AxHost.State)
Me.BtnCostReturn.Size = New System.Drawing.Size(40, 20)
Me.BtnCostReturn.TabIndex = 34
'
'BtnCostBack
'
Me.BtnCostBack.Location = New System.Drawing.Point(73, 138)
Me.BtnCostBack.OcxState = CType(resources.GetObject("BtnCostBack.OcxState"),
System.Windows.Forms.AxHost.State)
Me.BtnCostBack.Size = New System.Drawing.Size(40, 20)
Me.BtnCostBack.TabIndex = 33
'
'lblNBV
'
Me.lblNBV.CausesValidation = False
Me.lblNBV.Location = New System.Drawing.Point(8, 92)
Me.lblNBV.OcxState = CType(resources.GetObject("lblNBV.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblNBV.Size = New System.Drawing.Size(23, 11)
Me.lblNBV.TabIndex = 32
Me.lblNBV.TabStop = False
'
'lblYearCap
'
Me.lblYearCap.CausesValidation = False
Me.lblYearCap.Location = New System.Drawing.Point(8, 76)
Me.lblYearCap.OcxState = CType(resources.GetObject("lblYearCap.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblYearCap.Size = New System.Drawing.Size(71, 12)
Me.lblYearCap.TabIndex = 31
Me.lblYearCap.TabStop = False
'
'lblLifeRem
'
Me.lblLifeRem.CausesValidation = False
Me.lblLifeRem.Location = New System.Drawing.Point(8, 61)
Me.lblLifeRem.OcxState = CType(resources.GetObject("lblLifeRem.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLifeRem.Size = New System.Drawing.Size(61, 11)
Me.lblLifeRem.TabIndex = 30
Me.lblLifeRem.TabStop = False
'
'lblOrigInstall
'
Me.lblOrigInstall.CausesValidation = False
Me.lblOrigInstall.Location = New System.Drawing.Point(8, 47)
Me.lblOrigInstall.OcxState = CType(resources.GetObject("lblOrigInstall.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblOrigInstall.Size = New System.Drawing.Size(62, 9)
Me.lblOrigInstall.TabIndex = 29
Me.lblOrigInstall.TabStop = False
'
'txtOrigFreight
'
Me.txtOrigFreight.Location = New System.Drawing.Point(88, 31)
Me.txtOrigFreight.OcxState = CType(resources.GetObject("txtOrigFreight.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtOrigFreight.Size = New System.Drawing.Size(68, 12)
Me.txtOrigFreight.TabIndex = 28
'
'txtCost
'
Me.txtCost.Location = New System.Drawing.Point(28, 16)
Me.txtCost.OcxState = CType(resources.GetObject("txtCost.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtCost.Size = New System.Drawing.Size(39, 12)
Me.txtCost.TabIndex = 27
'
'lblCost
'
Me.lblCost.CausesValidation = False
Me.lblCost.Location = New System.Drawing.Point(8, 16)
Me.lblCost.OcxState = CType(resources.GetObject("lblCost.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblCost.Size = New System.Drawing.Size(20, 11)
Me.lblCost.TabIndex = 26
Me.lblCost.TabStop = False
'
'txtYearCap
'
Me.txtYearCap.Location = New System.Drawing.Point(88, 77)
Me.txtYearCap.OcxState = CType(resources.GetObject("txtYearCap.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtYearCap.Size = New System.Drawing.Size(68, 12)
Me.txtYearCap.TabIndex = 37
'
'txtLifeRemain
'
Me.txtLifeRemain.Location = New System.Drawing.Point(88, 61)
Me.txtLifeRemain.OcxState = CType(resources.GetObject("txtLifeRemain.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLifeRemain.Size = New System.Drawing.Size(68, 12)
Me.txtLifeRemain.TabIndex = 36
'
'txtOrigInstall
'
Me.txtOrigInstall.Location = New System.Drawing.Point(88, 46)
Me.txtOrigInstall.OcxState = CType(resources.GetObject("txtOrigInstall.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtOrigInstall.Size = New System.Drawing.Size(68, 12)
Me.txtOrigInstall.TabIndex = 35
'
'lblTotCost
'
Me.lblTotCost.CausesValidation = False
Me.lblTotCost.Location = New System.Drawing.Point(69, 16)
Me.lblTotCost.OcxState = CType(resources.GetObject("lblTotCost.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblTotCost.Size = New System.Drawing.Size(48, 12)
Me.lblTotCost.TabIndex = 39
Me.lblTotCost.TabStop = False
'
'txtTotCost
'
Me.txtTotCost.Location = New System.Drawing.Point(113, 16)
Me.txtTotCost.OcxState = CType(resources.GetObject("txtTotCost.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtTotCost.Size = New System.Drawing.Size(44, 12)
Me.txtTotCost.TabIndex = 40
'
'lblOriFght
'
Me.lblOriFght.CausesValidation = False
Me.lblOriFght.Location = New System.Drawing.Point(8, 30)
Me.lblOriFght.OcxState = CType(resources.GetObject("lblOriFght.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblOriFght.Size = New System.Drawing.Size(68, 12)
Me.lblOriFght.TabIndex = 41
Me.lblOriFght.TabStop = False
'
'lblTaxValue
'
Me.lblTaxValue.CausesValidation = False
Me.lblTaxValue.Location = New System.Drawing.Point(73, 94)
Me.lblTaxValue.OcxState = CType(resources.GetObject("lblTaxValue.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblTaxValue.Size = New System.Drawing.Size(45, 11)
Me.lblTaxValue.TabIndex = 42
Me.lblTaxValue.TabStop = False
'
'lblAskPrice
'
Me.lblAskPrice.CausesValidation = False
Me.lblAskPrice.Location = New System.Drawing.Point(8, 108)
Me.lblAskPrice.OcxState = CType(resources.GetObject("lblAskPrice.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblAskPrice.Size = New System.Drawing.Size(52, 12)
Me.lblAskPrice.TabIndex = 43
Me.lblAskPrice.TabStop = False
'
'lblLowPrice
'
Me.lblLowPrice.CausesValidation = False
Me.lblLowPrice.Location = New System.Drawing.Point(8, 125)
Me.lblLowPrice.OcxState = CType(resources.GetObject("lblLowPrice.OcxState"),
System.Windows.Forms.AxHost.State)
Me.lblLowPrice.Size = New System.Drawing.Size(56, 12)
Me.lblLowPrice.TabIndex = 44
Me.lblLowPrice.TabStop = False
'
'txtLowestPrice
'
Me.txtLowestPrice.Location = New System.Drawing.Point(76, 124)
Me.txtLowestPrice.OcxState = CType(resources.GetObject("txtLowestPrice.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtLowestPrice.Size = New System.Drawing.Size(56, 12)
Me.txtLowestPrice.TabIndex = 45
'
'txtAskPrice
'
Me.txtAskPrice.Location = New System.Drawing.Point(76, 109)
Me.txtAskPrice.OcxState = CType(resources.GetObject("txtAskPrice.OcxState"),
System.Windows.Forms.AxHost.State)
Me.txtAskPrice.Size = New System.Drawing.Size(56, 12)
Me.txtAskPrice.TabIndex = 46
'
'TxtTaxValue
'
Me.TxtTaxValue.Location = New System.Drawing.Point(122, 92)
Me.TxtTaxValue.OcxState = CType(resources.GetObject("TxtTaxValue.OcxState"),
System.Windows.Forms.AxHost.State)
Me.TxtTaxValue.Size = New System.Drawing.Size(34, 12)
Me.TxtTaxValue.TabIndex = 47
'
'frmCostDetails
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.TxtTaxValue)
Me.Controls.Add(Me.txtAskPrice)
Me.Controls.Add(Me.txtLowestPrice)
Me.Controls.Add(Me.lblLowPrice)
Me.Controls.Add(Me.lblAskPrice)
Me.Controls.Add(Me.lblTaxValue)
Me.Controls.Add(Me.lblOriFght)
Me.Controls.Add(Me.txtTotCost)
Me.Controls.Add(Me.lblTotCost)
Me.Controls.Add(Me.txtNBV)
Me.Controls.Add(Me.BtnCostReturn)
Me.Controls.Add(Me.BtnCostBack)
Me.Controls.Add(Me.lblNBV)
Me.Controls.Add(Me.lblYearCap)
Me.Controls.Add(Me.lblLifeRem)
Me.Controls.Add(Me.lblOrigInstall)
Me.Controls.Add(Me.txtOrigFreight)
Me.Controls.Add(Me.txtCost)
Me.Controls.Add(Me.lblCost)
Me.Controls.Add(Me.txtYearCap)
Me.Controls.Add(Me.txtLifeRemain)
Me.Controls.Add(Me.txtOrigInstall)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmCostDetails"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "New Equipment Maintenance"
CType(Me.txtNBV, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.BtnCostReturn, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.BtnCostBack, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblNBV, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblYearCap, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLifeRem, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblOrigInstall, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtOrigFreight, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtCost, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblCost, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtYearCap, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtLifeRemain, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtOrigInstall, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblTotCost, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtTotCost, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblOriFght, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblTaxValue, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblAskPrice, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLowPrice, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtLowestPrice, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.txtAskPrice, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TxtTaxValue, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

#Region "Variable Declaration"


Private objInv As tinventoryRecord ' Inventory DB structure
#End Region
Private Sub PopulateWithCurrentValue()
txtAskPrice.Text = OriginalCost * ConditionFactor
txtCost.Text = OriginalCost
txtLifeRemain.Text = LifeRemaining
txtLowestPrice.Text = CDbl(txtAskPrice.Text) * 0.5
txtNBV.Text = ConditionFactor * ForeignNBV
txtOrigFreight.Text = OriginalFrieght
txtOrigInstall.Text = OriginalInstall
TxtTaxValue.Text = TaxValue
txtTotCost.Text = OriginalCost * Quantity
txtYearCap.Text = YearCapital
End Sub
Private Sub SetCurrentValue()
OriginalCost = txtCost.Text
TotalCost = txtTotCost.Text
OriginalFrieght = txtOrigFreight.Text
OriginalInstall = txtOrigInstall.Text
LifeRemaining = txtLifeRemain.Text
YearCapital = txtYearCap.Text
ForeignNBV = txtNBV.Text
TaxValue = TxtTaxValue.Text
AskingPrice = txtAskPrice.Text
LowestPrice = txtLowestPrice.Text
End Sub
Private Sub BtnCostBack_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles BtnCostBack.ClickEvent
If (g_objCurrency Is Nothing) Then
g_objCurrency = New frmCurrency
End If
g_objCurrency.InitializeCurrencyForm()
LoadForm(g_objCurrency)
g_objCost.Close()
g_objCost = Nothing
End Sub

Public Sub InitializeCostDetailForm()


Try

If (g_Inventory_mode = "Edit") Then


Me.Text = " Edit Equipment Maintenance"
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)
txtAskPrice.Text = objData.GetFieldValue(43, InvDBName)
txtCost.Text = objData.GetFieldValue(38, InvDBName)
txtLifeRemain.Text = objData.GetFieldValue(60, InvDBName)
txtLowestPrice.Text = objData.GetFieldValue(44, InvDBName)
txtNBV.Text = objData.GetFieldValue(41, InvDBName)
txtOrigFreight.Text = objData.GetFieldValue(63, InvDBName)
txtOrigInstall.Text = objData.GetFieldValue(64, InvDBName)
TxtTaxValue.Text = objData.GetFieldValue(62, InvDBName)
txtTotCost.Text = objData.GetFieldValue(40, InvDBName)
txtYearCap.Text = objData.GetFieldValue(61, InvDBName)
Else
Me.Text = " New Equipment Maintenance"
PopulateWithCurrentValue()

End If
Catch Exc As Exception
Throw Exc
End Try
End Sub

Private Sub BtnCostReturn_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles BtnCostReturn.ClickEvent
Try
If TextValidation() = False Then
Exit Sub
Else
If AddCostDtlsRecord() = True Then
AddMoreCostDtlsRecord()
AddFewMoreCostDtlsRecord()
SetCurrentValue()
If (g_objEqptList Is Nothing) Then
g_objEqptList = New frmEqptList
End If
g_objEqptList.InitializeEqptLookUp()
LoadForm(g_objEqptList)
g_objCost.Close()
g_objCost = Nothing
Else
If (g_Inventory_mode = "Add") Then
MsgBox("Error in Adding Item details", MsgBoxStyle.Information)
Else
MsgBox("Error in Editing Item details", MsgBoxStyle.Information)
End If
Exit Sub
End If
End If

Catch ex As Exception
MessageBox.Show("Error Occured While Saving " + ex.Message, "Error")
End Try
End Sub
Private Function TextValidation() As Boolean

Try
If Me.txtAskPrice.Text = System.String.Empty Then
txtAskPrice.Text = 0
End If
If Not (IsNumeric(txtAskPrice.Text)) Then
MessageBox.Show("Ask Price Should Be Numberic Type", "Information")
txtAskPrice.Text = System.String.Empty
txtAskPrice.Focus()
Return False
End If
If CInt(txtAskPrice.Text) < 0 Then
MsgBox(" Asking Price must be greater than 0", MsgBoxStyle.Information, "IRS")
txtAskPrice.Text = 0
txtAskPrice.Focus()
Return False

End If
If Me.txtLifeRemain.Text = System.String.Empty Then
txtLifeRemain.Text = 0
End If
If Not (IsNumeric(txtLifeRemain.Text)) Then
MessageBox.Show("Life Remaining Should Be Numberic Type", "Information")
txtLifeRemain.Text = System.String.Empty
txtLifeRemain.Focus()
Return False
End If
If CInt(txtLifeRemain.Text) < 0 Then
MsgBox(" Life Remaining must be greater than 0", MsgBoxStyle.Information, "IRS")
txtLifeRemain.Text = 0
txtLifeRemain.Focus()
Return False

End If
If Me.txtLowestPrice.Text = System.String.Empty Then
txtLowestPrice.Text = 0
End If
If Not (IsNumeric(txtLowestPrice.Text)) Then
MessageBox.Show("Lowest Price Should Be Numberic Type", "Information")
txtLowestPrice.Text = System.String.Empty
txtLowestPrice.Focus()
Return False
End If
If CInt(txtLowestPrice.Text) < 0 Then
MsgBox(" Lowest price must be greater than 0", MsgBoxStyle.Information, "IRS")
txtLowestPrice.Text = 0
txtLowestPrice.Focus()
Return False

End If
If Me.txtNBV.Text = System.String.Empty Then
txtNBV.Text = 0
End If
If Not (IsNumeric(txtNBV.Text)) Then
MessageBox.Show("NBV Should Be Numberic Type", "Information")
txtNBV.Text = System.String.Empty
txtNBV.Focus()
Return False
End If
If CInt(txtNBV.Text) < 0 Then
MsgBox(" NBV must be greater than 0", MsgBoxStyle.Information, "IRS")
txtNBV.Text = 0
txtNBV.Focus()
Return False

End If
If Me.txtOrigFreight.Text = System.String.Empty Then
txtOrigFreight.Text = 0
End If
If Not (IsNumeric(txtOrigFreight.Text)) Then
MessageBox.Show("Original Freight Should Be Numberic Type", "Information")
txtOrigFreight.Text = System.String.Empty
txtOrigFreight.Focus()
Return False
End If
If CInt(txtOrigFreight.Text) < 0 Then
MsgBox(" Original Freight must be greater than 0", MsgBoxStyle.Information, "IRS")
txtOrigFreight.Text = 0
txtOrigFreight.Focus()
Return False
End If
If Me.txtOrigInstall.Text = System.String.Empty Then
txtOrigInstall.Text = 0
End If
If Not (IsNumeric(txtOrigInstall.Text)) Then
MessageBox.Show("Original Install Should Be Numeric Type", "Information")
txtOrigInstall.Text = System.String.Empty
txtOrigInstall.Focus()
Return False
End If
If CInt(txtOrigInstall.Text) < 0 Then
MsgBox(" Original Install must be greater than 0", MsgBoxStyle.Information, "IRS")
txtOrigInstall.Text = 0
txtOrigInstall.Focus()
Return False
End If

If Me.TxtTaxValue.Text = System.String.Empty Then


TxtTaxValue.Text = 0
End If
If Not (IsNumeric(TxtTaxValue.Text)) Then
MessageBox.Show("Tax Value Should Be Numeric Type", "Information")
TxtTaxValue.Text = System.String.Empty
TxtTaxValue.Focus()
Return False
End If
If CInt(TxtTaxValue.Text) < 0 Then
MsgBox(" Tax Value must be greater than 0", MsgBoxStyle.Information, "IRS")
TxtTaxValue.Text = 0
TxtTaxValue.Focus()
Return False
End If
If Me.txtCost.Text = System.String.Empty Then
txtCost.Text = 0
End If
If Not (IsNumeric(txtCost.Text)) Then
MessageBox.Show("Total Cost Should Be Numeric Type", "Information")
txtCost.Text = System.String.Empty
'txtCost.Focus()
Return False
End If
txtTotCost.Text = txtCost.Text
If Me.txtYearCap.Text = System.String.Empty Then
txtYearCap.Text = 0
End If
If Not (IsNumeric(txtYearCap.Text)) Then
MessageBox.Show("Year Capital Should Be Numeric Type", "Information")
txtYearCap.Text = System.String.Empty
txtYearCap.Focus()
Return False
End If

If CInt(txtYearCap.Text) < 0 Then


MessageBox.Show("Year Cap Must Be Greater Than Zero", "Information")
txtYearCap.Text = System.String.Empty
txtYearCap.Focus()
Return False
End If
Return True

Catch ex As Exception
Throw ex
End Try
End Function

Private Function AddCostDtlsRecord() As Boolean


Try
'EmptyQty_Fields()

' editing the fields after creating the Inventory record


'Setting the pointer
objData.FindRecordByField(objInv, g_ItemNo, 0, InvDBName)

'stroing the values in the fields and editing the record in the database
objInv.inv_originalcost = txtCost.Text
objData.EditSingleField(objInv, InvDBName, 38)
objInv.inv_totalcost = txtCost.Text
objData.EditSingleField(objInv, InvDBName, 40)

objInv.inv_orifreight = txtOrigFreight.Text
objData.EditSingleField(objInv, InvDBName, 63)

Return True
Catch ex As Exception
Throw ex
End Try
End Function
Private Sub AddMoreCostDtlsRecord()
objInv.inv_oriinstall = txtOrigInstall.Text
objData.EditSingleField(objInv, InvDBName, 64)

objInv.inv_liferemain = txtLifeRemain.Text
objData.EditSingleField(objInv, InvDBName, 60)

objInv.inv_yearcap = txtYearCap.Text
objData.EditSingleField(objInv, InvDBName, 61)

End Sub
Private Sub AddFewMoreCostDtlsRecord()

objInv.inv_nbv = txtNBV.Text
objData.EditSingleField(objInv, InvDBName, 41)

objInv.inv_taxvalue = TxtTaxValue.Text
objData.EditSingleField(objInv, InvDBName, 62)

objInv.inv_askingprice = txtAskPrice.Text
objData.EditSingleField(objInv, InvDBName, 43)

objInv.inv_lowestprice = txtLowestPrice.Text
objData.EditSingleField(objInv, InvDBName, 44)
End Sub
End Class
frmUOMList.vb

Option Strict Off


Option Explicit On

Public Class frmUomList


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents GrdUomList As AppForge.Controls.OwnerDrawGrid
Friend WithEvents grdUomHeader As AppForge.Controls.OwnerDrawGrid
Friend WithEvents btnUomOk As AppForge.Controls.Button
Friend WithEvents btnUomCancel As AppForge.Controls.Button
Friend WithEvents tmrUom As AppForge.Controls.Timer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmUomList))
Me.GrdUomList = New AppForge.Controls.OwnerDrawGrid
Me.grdUomHeader = New AppForge.Controls.OwnerDrawGrid
Me.btnUomOk = New AppForge.Controls.Button
Me.btnUomCancel = New AppForge.Controls.Button
Me.tmrUom = New AppForge.Controls.Timer
CType(Me.GrdUomList, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdUomHeader, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnUomOk, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnUomCancel, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.tmrUom, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GrdUomList
'
Me.GrdUomList.Location = New System.Drawing.Point(0, 41)
Me.GrdUomList.OcxState = CType(resources.GetObject("GrdUomList.OcxState"),
System.Windows.Forms.AxHost.State)
Me.GrdUomList.Size = New System.Drawing.Size(160, 85)
Me.GrdUomList.TabIndex = 6
'
'grdUomHeader
'
Me.grdUomHeader.Location = New System.Drawing.Point(0, 16)
Me.grdUomHeader.OcxState = CType(resources.GetObject("grdUomHeader.OcxState"),
System.Windows.Forms.AxHost.State)
Me.grdUomHeader.Size = New System.Drawing.Size(160, 24)
Me.grdUomHeader.TabIndex = 5
'
'btnUomOk
'
Me.btnUomOk.Location = New System.Drawing.Point(0, 139)
Me.btnUomOk.OcxState = CType(resources.GetObject("btnUomOk.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnUomOk.Size = New System.Drawing.Size(56, 20)
Me.btnUomOk.TabIndex = 7
'
'btnUomCancel
'
Me.btnUomCancel.Location = New System.Drawing.Point(105, 139)
Me.btnUomCancel.OcxState = CType(resources.GetObject("btnUomCancel.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnUomCancel.Size = New System.Drawing.Size(56, 20)
Me.btnUomCancel.TabIndex = 8
'
'tmrUom
'
Me.tmrUom.Location = New System.Drawing.Point(128, 92)
Me.tmrUom.OcxState = CType(resources.GetObject("tmrUom.OcxState"),
System.Windows.Forms.AxHost.State)
Me.tmrUom.Size = New System.Drawing.Size(32, 32)
Me.tmrUom.TabIndex = 9
'
'frmUomList
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.tmrUom)
Me.Controls.Add(Me.btnUomCancel)
Me.Controls.Add(Me.btnUomOk)
Me.Controls.Add(Me.GrdUomList)
Me.Controls.Add(Me.grdUomHeader)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmUomList"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "UOM List"
CType(Me.GrdUomList, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdUomHeader, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnUomOk, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnUomCancel, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.tmrUom, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim objUomList As tuomRecord 'UOm db structure obj

Public iSelectedRow As Integer


Private bInitialSetup As Boolean = True
Public iUomIndex As Integer

Private iRow As Integer


Private iNumRow As Integer
Private Sub VisibilityButton(ByVal boolVisible As Boolean)

btnUomOk.Visible = boolVisible
btnUomCancel.Visible = boolVisible

End Sub
Public Sub InitializeUomLookUp()
objData.MoveToFirstRecord(UomDBName)

GrdUomList.Refresh()
FillGrid()
AddHeader()
AddItems()

End Sub
Public Sub FillGrid()

VisibilityButton(False)
GrdUomList.Refresh()

GrdUomList.Cols = 2
GrdUomList.set_RowHeight(0, (fGetStringHeight(iFontHandle_DeviceDefault) + 4))
GrdUomList.set_ColWidth(0, CShort(70))
GrdUomList.set_ColWidth(1, CShort(80))

grdUomHeader.Cols = CShort(2)
grdUomHeader.set_ColWidth(0, CShort(70))
grdUomHeader.set_ColWidth(1, CShort(80))

VisibilityButton(True)

End Sub

Private Sub AddHeader()

grdUomHeader.RemoveItem(0)
grdUomHeader.Refresh()
grdUomHeader.AddItem("UOM Code" & Chr(9) & " Description")

End Sub
Private Sub AddItems()
iNumRow = 0
iRow = 0
While Not objData.EndOfFile(UomDBName)

GrdUomList.AddItem(Trim(objData.GetFieldValue(0, UomDBName) & Chr(9) &


objData.GetFieldValue(1, UomDBName)))
iNumRow = iNumRow + 1

objData.MoveToNextRecord(UomDBName)

End While

GrdUomList.Refresh()

End Sub
Private Sub grdUomList_PaintCell(ByVal sender As Object, ByVal e As
AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles GrdUomList.PaintCell

If objData.GoToRecordIndex(e.row, UomDBName) = False Then


Exit Sub
End If
'common code for all forms
If e.selected Then
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHT)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHTTEXT)
Else
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
End If

e.canvas.Erase()

e.canvas.DrawText(e.x + 3, e.y + 3, GrdUomList.get_TextMatrix(e.row, e.col))

End Sub
Private Sub grdUomlist_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)
Handles GrdUomList.SelectCell

iSelectedRow = CInt(GrdUomList.Row)
objData.GoToRecordIndex(iSelectedRow, UomDBName)

End Sub
Private Sub grdUomList_LeftColChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles GrdUomList.LeftColChanged

grdUomHeader.LeftCol = GrdUomList.LeftCol

End Sub

Private Sub grdUomHeader_LeftColChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles grdUomHeader.LeftColChanged
GrdUomList.LeftCol = grdUomHeader.LeftCol

End Sub
Private Sub grdUomHeader_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)
Handles grdUomHeader.SelectCell

tmrUom.Enabled = False
tmrUom.Enabled = True

End Sub

Private Sub SortDatabase()

Select Case grdUomHeader.Col


Case 0
objData.SetSortFields(UomDBName, 0)
Case 1
objData.SetSortFields(UomDBName, 1)
End Select

End Sub
'See grdlocHeader_SelectCell for an explanation of this timer.
Private Sub tmrUom_TimerEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles tmrUom.TimerEvent

Dim myUID As Long


If iSelectedRow = 0 Then iSelectedRow = 1

objData.GoToRecordIndex(iSelectedRow, UomDBName)
myUID = objData.RecordUniqueID(UomDBName)
SortDatabase()
objData.FindRecordbyID(myUID, UomDBName)

If (bInitialSetup) Then
GrdUomList.Row = 0
bInitialSetup = False
Else
GrdUomList.Row = objData.CurrentIndex(UomDBName)
End If

GrdUomList.Refresh() 'Refresh the grid with the new sort order.


tmrUom.Enabled = False

End Sub

Private Sub grdUomHeader_PaintCell(ByVal sender As Object, ByVal e As


AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles grdUomHeader.PaintCell

e.canvas.Reset()

e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
'e.canvas.CurrentFont = iFontHandle_Medium_Bold 'This font handle was created in
modCommon.setupFonts

If e.selected Then
e.canvas.DrawText(e.x + 3, e.y + 3, grdUomHeader.get_TextMatrix(e.row, e.col) & "*")
Else
e.canvas.DrawText(e.x + 3, e.y + 3, grdUomHeader.get_TextMatrix(e.row, e.col))
End If
End Sub

Private Sub btnUomCancel_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnUomCancel.ClickEvent
If g_Last_Screen = "MainUOM" Then
LoadForm(g_objMain)
ElseIf g_Last_Screen = "UOM" Then
LoadForm(g_objQty)
End If

For iRow = 0 To iNumRow


GrdUomList.RemoveItem(0)
Next

Me.Hide()
End Sub

Private Sub btnUomOk_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnUomOk.ClickEvent
Dim iTemp As String

If g_Last_Screen = "UOM" Then

iTemp = Trim(GrdUomList.get_TextMatrix(iSelectedRow, 0))


objData.FindRecordByField(objUomList, iTemp, 0, UomDBName)

g_objQty.txtUOM.Text = Trim(iTemp)
LoadForm(g_objQty)

ElseIf g_Last_Screen = "MainUOM" Then


LoadForm(g_objMain)
End If

For iRow = 0 To iNumRow


GrdUomList.RemoveItem(0)
Next

Me.Hide()
End Sub

End Class
frmLocationList.vb

Option Strict Off


Option Explicit On

Public Class frmLocationList


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents GrdLocList As AppForge.Controls.OwnerDrawGrid
Friend WithEvents grdLocHeader As AppForge.Controls.OwnerDrawGrid
Friend WithEvents btnLocOk As AppForge.Controls.Button
Friend WithEvents btnLocCancel As AppForge.Controls.Button
Friend WithEvents tmrLoc As AppForge.Controls.Timer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmLocationList))
Me.GrdLocList = New AppForge.Controls.OwnerDrawGrid
Me.grdLocHeader = New AppForge.Controls.OwnerDrawGrid
Me.btnLocOk = New AppForge.Controls.Button
Me.btnLocCancel = New AppForge.Controls.Button
Me.tmrLoc = New AppForge.Controls.Timer
CType(Me.GrdLocList, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdLocHeader, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnLocOk, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnLocCancel, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.tmrLoc, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GrdLocList
'
Me.GrdLocList.Location = New System.Drawing.Point(0, 42)
Me.GrdLocList.OcxState = CType(resources.GetObject("GrdLocList.OcxState"),
System.Windows.Forms.AxHost.State)
Me.GrdLocList.Size = New System.Drawing.Size(160, 90)
Me.GrdLocList.TabIndex = 6
'
'grdLocHeader
'
Me.grdLocHeader.Location = New System.Drawing.Point(0, 16)
Me.grdLocHeader.OcxState = CType(resources.GetObject("grdLocHeader.OcxState"),
System.Windows.Forms.AxHost.State)
Me.grdLocHeader.Size = New System.Drawing.Size(160, 24)
Me.grdLocHeader.TabIndex = 5
'
'btnLocOk
'
Me.btnLocOk.Location = New System.Drawing.Point(1, 137)
Me.btnLocOk.OcxState = CType(resources.GetObject("btnLocOk.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnLocOk.Size = New System.Drawing.Size(56, 20)
Me.btnLocOk.TabIndex = 7
'
'btnLocCancel
'
Me.btnLocCancel.Location = New System.Drawing.Point(104, 137)
Me.btnLocCancel.OcxState = CType(resources.GetObject("btnLocCancel.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnLocCancel.Size = New System.Drawing.Size(56, 20)
Me.btnLocCancel.TabIndex = 8
'
'tmrLoc
'
Me.tmrLoc.Location = New System.Drawing.Point(124, 92)
Me.tmrLoc.OcxState = CType(resources.GetObject("tmrLoc.OcxState"),
System.Windows.Forms.AxHost.State)
Me.tmrLoc.Size = New System.Drawing.Size(32, 32)
Me.tmrLoc.TabIndex = 9
'
'frmLocationList
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.tmrLoc)
Me.Controls.Add(Me.btnLocCancel)
Me.Controls.Add(Me.btnLocOk)
Me.Controls.Add(Me.GrdLocList)
Me.Controls.Add(Me.grdLocHeader)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmLocationList"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Location List"
CType(Me.GrdLocList, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdLocHeader, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnLocOk, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnLocCancel, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.tmrLoc, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim objLocList As tlocationRecord 'Location db structure obj
Public iSelectedRow As Integer
Private bInitialSetup As Boolean = True
Public iLocIndex As Integer

Private iRow As Integer


Private iNumRow As Integer
Private Sub VisibilityButton(ByVal boolVisible As Boolean)

btnLocOk.Visible = boolVisible
btnLocCancel.Visible = boolVisible

End Sub
Public Sub InitializeLocLookUp()
objData.MoveToFirstRecord(LocDBName)

GrdLocList.Refresh()
FillGrid()
AddHeader()
AddItems()

End Sub
Public Sub FillGrid()

VisibilityButton(False)
GrdLocList.Refresh()

GrdLocList.Cols = 2
GrdLocList.set_RowHeight(0, (fGetStringHeight(iFontHandle_DeviceDefault) + 4))
GrdLocList.set_ColWidth(0, CShort(60))
GrdLocList.set_ColWidth(1, CShort(100))
grdLocHeader.Cols = CShort(2)
grdLocHeader.set_ColWidth(0, CShort(60))
grdLocHeader.set_ColWidth(1, CShort(100))

VisibilityButton(True)

End Sub

Private Sub AddHeader()

grdLocHeader.RemoveItem(0)
grdLocHeader.Refresh()
grdLocHeader.AddItem("Loc Code" & Chr(9) & "Loc Description")

End Sub
Private Sub AddItems()
iNumRow = 0
iRow = 0
While Not objData.EndOfFile(LocDBName)

If objData.GetFieldValue(18, LocDBName) = "True" Then

GrdLocList.AddItem(Trim(objData.GetFieldValue(0, LocDBName) & Chr(9) &


objData.GetFieldValue(1, LocDBName)))
iNumRow = iNumRow + 1
End If

objData.MoveToNextRecord(LocDBName)

End While

GrdLocList.Refresh()

End Sub

Private Sub grdLocList_PaintCell(ByVal sender As Object, ByVal e As


AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles GrdLocList.PaintCell

If objData.GoToRecordIndex(e.row, LocDBName) = False Then


Exit Sub
End If
'common code for all forms
If e.selected Then
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHT)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHTTEXT)
Else
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
End If
e.canvas.Erase()

e.canvas.DrawText(e.x + 3, e.y + 3, GrdLocList.get_TextMatrix(e.row, e.col))

End Sub

Private Sub grdLoclist_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)


Handles GrdLocList.SelectCell

iSelectedRow = CInt(GrdLocList.Row)
objData.GoToRecordIndex(iSelectedRow, LocDBName)

End Sub

Private Sub grdLocList_LeftColChanged(ByVal sender As Object, ByVal e As System.EventArgs)


Handles GrdLocList.LeftColChanged

grdLocHeader.LeftCol = GrdLocList.LeftCol

End Sub

Private Sub grdLocHeader_LeftColChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles grdLocHeader.LeftColChanged
GrdLocList.LeftCol = grdLocHeader.LeftCol

End Sub

Private Sub grdlocHeader_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)


Handles grdLocHeader.SelectCell

tmrLoc.Enabled = False
tmrLoc.Enabled = True

End Sub

Private Sub SortDatabase()

Select Case grdLocHeader.Col


Case 0
objData.SetSortFields(LocDBName, 0)
Case 1
objData.SetSortFields(LocDBName, 1)
End Select

End Sub
'See grdlocHeader_SelectCell for an explanation of this timer.
Private Sub tmrloc_TimerEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles
tmrLoc.TimerEvent

Dim myUID As Long


If iSelectedRow = 0 Then iSelectedRow = 1

objData.GoToRecordIndex(iSelectedRow, LocDBName)
myUID = objData.RecordUniqueID(LocDBName)
SortDatabase()
objData.FindRecordbyID(myUID, LocDBName)

If (bInitialSetup) Then
GrdLocList.Row = 0
bInitialSetup = False
Else
GrdLocList.Row = objData.CurrentIndex(LocDBName)
End If

GrdLocList.Refresh() 'Refresh the grid with the new sort order.


tmrLoc.Enabled = False

End Sub
Private Sub grdLocHeader_PaintCell(ByVal sender As Object, ByVal e As
AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles grdLocHeader.PaintCell

e.canvas.Reset()

e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
'e.canvas.CurrentFont = iFontHandle_Medium_Bold 'This font handle was created in
modCommon.setupFonts

If e.selected Then
e.canvas.DrawText(e.x + 3, e.y + 3, grdLocHeader.get_TextMatrix(e.row, e.col) & "*")
Else
e.canvas.DrawText(e.x + 3, e.y + 3, grdLocHeader.get_TextMatrix(e.row, e.col))
End If
End Sub

Private Sub btnLocCancel_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnLocCancel.ClickEvent
If g_Last_Screen = "MainLoc" Then

LoadForm(g_objMain)
ElseIf g_Last_Screen = "Loc" Then
LoadForm(g_objLoc)
End If

For iRow = 0 To iNumRow


GrdLocList.RemoveItem(0)
Next

Me.Hide()
End Sub
Private Sub btnLocOk_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles btnLocOk.ClickEvent
Dim iTemp As String

If g_Last_Screen = "Loc" Then

iTemp = Trim(GrdLocList.get_TextMatrix(iSelectedRow, 0))

objData.FindRecordByField(objLocList, iTemp, 0, LocDBName)

g_objLoc.txtLocCode.Text = iTemp g_objLoc.txtLocDesc.Text =


objData.GetFieldValue(1, LocDBName)
g_objLoc.txtLocContact.Text = objData.GetFieldValue(8, LocDBName)
g_objLoc.txtLocPhone.Text = objData.GetFieldValue(4, LocDBName)
g_objLoc.txtLocFax.Text = objData.GetFieldValue(5, LocDBName)
g_objLoc.txtLocEmail.Text = objData.GetFieldValue(7, LocDBName)

LoadForm(g_objLoc)

ElseIf g_Last_Screen = "MainLoc" Then

LoadForm(g_objMain)

End If

For iRow = 0 To iNumRow


GrdLocList.RemoveItem(0)
Next

Me.Hide()
End Sub
End Class
frmConsignmentList.vb

Option Strict Off


Option Explicit On

Public Class frmConsignLocList


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents GrdConsignList As AppForge.Controls.OwnerDrawGrid
Friend WithEvents grdConHeader As AppForge.Controls.OwnerDrawGrid
Friend WithEvents btnConsignOk As AppForge.Controls.Button
Friend WithEvents btnConsignCancel As AppForge.Controls.Button
Friend WithEvents tmrConsign As AppForge.Controls.Timer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmConsignLocList))
Me.GrdConsignList = New AppForge.Controls.OwnerDrawGrid
Me.grdConHeader = New AppForge.Controls.OwnerDrawGrid
Me.btnConsignOk = New AppForge.Controls.Button
Me.btnConsignCancel = New AppForge.Controls.Button
Me.tmrConsign = New AppForge.Controls.Timer
CType(Me.GrdConsignList, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdConHeader, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnConsignOk, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnConsignCancel, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.tmrConsign, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GrdConsignList
'
Me.GrdConsignList.Location = New System.Drawing.Point(1, 39)
Me.GrdConsignList.OcxState = CType(resources.GetObject("GrdConsignList.OcxState"),
System.Windows.Forms.AxHost.State)
Me.GrdConsignList.Size = New System.Drawing.Size(159, 94)
Me.GrdConsignList.TabIndex = 6
'
'grdConHeader
'
Me.grdConHeader.Location = New System.Drawing.Point(1, 16)
Me.grdConHeader.OcxState = CType(resources.GetObject("grdConHeader.OcxState"),
System.Windows.Forms.AxHost.State)
Me.grdConHeader.Size = New System.Drawing.Size(159, 22)
Me.grdConHeader.TabIndex = 5
'
'btnConsignOk
'
Me.btnConsignOk.Location = New System.Drawing.Point(1, 136)
Me.btnConsignOk.OcxState = CType(resources.GetObject("btnConsignOk.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnConsignOk.Size = New System.Drawing.Size(56, 20)
Me.btnConsignOk.TabIndex = 7
'
'btnConsignCancel
'
Me.btnConsignCancel.Location = New System.Drawing.Point(104, 136)
Me.btnConsignCancel.OcxState = CType(resources.GetObject("btnConsignCancel.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnConsignCancel.Size = New System.Drawing.Size(56, 20)
Me.btnConsignCancel.TabIndex = 8
'
'tmrConsign
'
Me.tmrConsign.Location = New System.Drawing.Point(124, 92)
Me.tmrConsign.OcxState = CType(resources.GetObject("tmrConsign.OcxState"),
System.Windows.Forms.AxHost.State)
Me.tmrConsign.Size = New System.Drawing.Size(32, 32)
Me.tmrConsign.TabIndex = 9
'
'frmConsignLocList
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.tmrConsign)
Me.Controls.Add(Me.btnConsignCancel)
Me.Controls.Add(Me.btnConsignOk)
Me.Controls.Add(Me.GrdConsignList)
Me.Controls.Add(Me.grdConHeader)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmConsignLocList"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Consignment Location List"
CType(Me.GrdConsignList, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdConHeader, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnConsignOk, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnConsignCancel, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.tmrConsign, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim objConsignList As tlocationRecord 'Location db structure obj
Public iSelectedRow As Integer
Private bInitialSetup As Boolean = True
Public iConLocIndex As Integer

Private iRow As Integer


Private iNumRow As Integer
Private Sub VisibilityButton(ByVal boolVisible As Boolean)

btnConsignOk.Visible = boolVisible
btnConsignCancel.Visible = boolVisible

End Sub
Public Sub InitializeConsignLookUp()

objData.MoveToFirstRecord(LocDBName)

GrdConsignList.Refresh()
FillGrid()
AddHeader()
AddItems()

End Sub
Public Sub FillGrid()

VisibilityButton(False)
GrdConsignList.Refresh()

GrdConsignList.Cols = 2
GrdConsignList.set_RowHeight(0, (fGetStringHeight(iFontHandle_DeviceDefault) + 4))
GrdConsignList.set_ColWidth(0, CShort(60))
GrdConsignList.set_ColWidth(1, CShort(100))
grdConHeader.Cols = CShort(2)
grdConHeader.set_ColWidth(0, CShort(60))
grdConHeader.set_ColWidth(1, CShort(100))

VisibilityButton(True)

End Sub

Private Sub AddHeader()

grdConHeader.RemoveItem(0)
grdConHeader.Refresh()
grdConHeader.AddItem("Loc Code" & Chr(9) & " Loc Name")

End Sub
Private Sub AddItems()

'VisibilityButton(False)
iNumRow = 0
iRow = 0

While Not objData.EndOfFile(LocDBName)


If objData.GetFieldValue(18, LocDBName) = "False" Then
GrdConsignList.AddItem(Trim(objData.GetFieldValue(0, LocDBName) & Chr(9) &
objData.GetFieldValue(1, LocDBName)))
iNumRow = iNumRow + 1
End If
objData.MoveToNextRecord(LocDBName)
End While
GrdConsignList.Refresh()

End Sub
Private Sub grdConsignList_PaintCell(ByVal sender As Object, ByVal e As
AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles GrdConsignList.PaintCell

If objData.GoToRecordIndex(e.row, LocDBName) = False Then


Exit Sub
End If
'common code for all forms
If e.selected Then
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHT)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHTTEXT)
Else
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
End If

e.canvas.Erase()
e.canvas.DrawText(e.x + 3, e.y + 3, GrdConsignList.get_TextMatrix(e.row, e.col))

End Sub
Private Sub GrdConsignList_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)
Handles GrdConsignList.SelectCell

iSelectedRow = CInt(GrdConsignList.Row)
objData.GoToRecordIndex(iSelectedRow, LocDBName)

End Sub

Private Sub GrdConsignList_LeftColChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles GrdConsignList.LeftColChanged

grdConHeader.LeftCol = GrdConsignList.LeftCol

End Sub

Private Sub grdConHeader_LeftColChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles grdConHeader.LeftColChanged
GrdConsignList.LeftCol = grdConHeader.LeftCol

End Sub

Private Sub grdConHeader_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)


Handles grdConHeader.SelectCell

tmrConsign.Enabled = False
tmrConsign.Enabled = True

End Sub

Private Sub SortDatabase()

Select Case grdConHeader.Col


Case 0
objData.SetSortFields(LocDBName, 0)
Case 1
objData.SetSortFields(LocDBName, 1)
End Select

End Sub
'See grdlocHeader_SelectCell for an explanation of this timer.
Private Sub tmrConsign_TimerEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles tmrConsign.TimerEvent

Dim myUID As Long

If iSelectedRow = 0 Then iSelectedRow = 1

objData.GoToRecordIndex(iSelectedRow, LocDBName)
myUID = objData.RecordUniqueID(LocDBName)
SortDatabase()
objData.FindRecordbyID(myUID, LocDBName)

If (bInitialSetup) Then
GrdConsignList.Row = 0
bInitialSetup = False
Else
GrdConsignList.Row = objData.CurrentIndex(LocDBName)
End If

GrdConsignList.Refresh() 'Refresh the grid with the new sort order.


tmrConsign.Enabled = False

End Sub

Private Sub grdConHeader_PaintCell(ByVal sender As Object, ByVal e As


AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles grdConHeader.PaintCell

e.canvas.Reset()

e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
'e.canvas.CurrentFont = iFontHandle_Medium_Bold 'This font handle was created in
modCommon.setupFonts

If e.selected Then
e.canvas.DrawText(e.x + 3, e.y + 3, grdConHeader.get_TextMatrix(e.row, e.col) & "*")
Else
e.canvas.DrawText(e.x + 3, e.y + 3, grdConHeader.get_TextMatrix(e.row, e.col))
End If
End Sub

Private Sub btnConsignOk_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnConsignOk.ClickEvent
Dim iTemp As String

VisibilityButton(False)
If g_Last_Screen = "Consign" Then

iTemp = Trim(GrdConsignList.get_TextMatrix(iSelectedRow, 0))

objData.FindRecordByField(objConsignList, iTemp, 0, LocDBName)

g_objConsign.txtConsignCode.Text = iTemp g_objConsign.txtConsignDesc.Text =


objData.GetFieldValue(1, LocDBName)
g_objConsign.txtConsignContact.Text = objData.GetFieldValue(8, LocDBName)
g_objConsign.txtConsignPhone.Text = objData.GetFieldValue(4, LocDBName)
g_objConsign.txtConsignFax.Text = objData.GetFieldValue(5, LocDBName)
g_objConsign.txtConsignEmail.Text = objData.GetFieldValue(7, LocDBName)
VisibilityButton(True)
LoadForm(g_objConsign)

ElseIf g_Last_Screen = "MainConsign" Then

VisibilityButton(True)
LoadForm(g_objMain)

End If

For iRow = 0 To iNumRow


GrdConsignList.RemoveItem(0)
Next
Me.Hide()
End Sub

Private Sub btnConsignCancel_ClickEvent(ByVal sender As Object, ByVal e As


System.EventArgs) Handles btnConsignCancel.ClickEvent
If g_Last_Screen = "MainConsign" Then
LoadForm(g_objMain)
ElseIf g_Last_Screen = "Consign" Then
LoadForm(g_objConsign)
End If
For iRow = 0 To iNumRow
GrdConsignList.RemoveItem(0)
Next

Me.Hide()
End Sub
End Class
frmCommodityList.vb

Option Strict Off


Option Explicit On

Public Class frmCommodityList


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents GrdCommList As AppForge.Controls.OwnerDrawGrid
Friend WithEvents grdCommHeader As AppForge.Controls.OwnerDrawGrid
Friend WithEvents btnCommOk As AppForge.Controls.Button
Friend WithEvents btnCommCancel As AppForge.Controls.Button
Friend WithEvents tmrComm As AppForge.Controls.Timer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmCommodityList))
Me.GrdCommList = New AppForge.Controls.OwnerDrawGrid
Me.grdCommHeader = New AppForge.Controls.OwnerDrawGrid
Me.btnCommOk = New AppForge.Controls.Button
Me.btnCommCancel = New AppForge.Controls.Button
Me.tmrComm = New AppForge.Controls.Timer
CType(Me.GrdCommList, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdCommHeader, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnCommOk, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnCommCancel, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.tmrComm, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GrdCommList
'
Me.GrdCommList.Location = New System.Drawing.Point(0, 42)
Me.GrdCommList.OcxState = CType(resources.GetObject("GrdCommList.OcxState"),
System.Windows.Forms.AxHost.State)
Me.GrdCommList.Size = New System.Drawing.Size(160, 84)
Me.GrdCommList.TabIndex = 6
'
'grdCommHeader
'
Me.grdCommHeader.Location = New System.Drawing.Point(0, 16)
Me.grdCommHeader.OcxState = CType(resources.GetObject("grdCommHeader.OcxState"),
System.Windows.Forms.AxHost.State)
Me.grdCommHeader.Size = New System.Drawing.Size(160, 24)
Me.grdCommHeader.TabIndex = 5
'
'btnCommOk
'
Me.btnCommOk.Location = New System.Drawing.Point(0, 137)
Me.btnCommOk.OcxState = CType(resources.GetObject("btnCommOk.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnCommOk.Size = New System.Drawing.Size(52, 22)
Me.btnCommOk.TabIndex = 7
'
'btnCommCancel
'
Me.btnCommCancel.Location = New System.Drawing.Point(108, 137)
Me.btnCommCancel.OcxState = CType(resources.GetObject("btnCommCancel.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnCommCancel.Size = New System.Drawing.Size(52, 22)
Me.btnCommCancel.TabIndex = 8
'
'tmrComm
'
Me.tmrComm.Location = New System.Drawing.Point(124, 84)
Me.tmrComm.OcxState = CType(resources.GetObject("tmrComm.OcxState"),
System.Windows.Forms.AxHost.State)
Me.tmrComm.Size = New System.Drawing.Size(32, 32)
Me.tmrComm.TabIndex = 9
'
'frmCommodityList
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.tmrComm)
Me.Controls.Add(Me.btnCommCancel)
Me.Controls.Add(Me.btnCommOk)
Me.Controls.Add(Me.GrdCommList)
Me.Controls.Add(Me.grdCommHeader)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmCommodityList"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Commodity List"
CType(Me.GrdCommList, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdCommHeader, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnCommOk, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnCommCancel, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.tmrComm, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region
Dim objCommList As tcommodityRecord 'Commodity db structure obj
Public iSelectedRow As Integer
Private bInitialSetup As Boolean = True
Public iCommIndex As Integer

Private iRow As Integer


Private iNumRow As Integer
Private Sub VisibilityButton(ByVal boolVisible As Boolean)

btnCommOk.Visible = boolVisible
btnCommCancel.Visible = boolVisible

End Sub
Public Sub InitializeCommLookUp()
objData.MoveToFirstRecord(CommDBName)

GrdCommList.Refresh()
FillGrid()
AddHeader()
AddItems()

End Sub
Public Sub FillGrid()

VisibilityButton(False)
GrdCommList.Cols = CShort(2)
GrdCommList.set_RowHeight(0, (fGetStringHeight(iFontHandle_DeviceDefault) + 4))
GrdCommList.set_ColWidth(0, CShort(50))
GrdCommList.set_ColWidth(1, CShort(100))
grdCommHeader.Cols = CShort(2)
grdCommHeader.set_ColWidth(0, CShort(50))
grdCommHeader.set_ColWidth(1, CShort(80))

VisibilityButton(True)

End Sub

Private Sub AddHeader()

grdCommHeader.RemoveItem(0)
grdCommHeader.Refresh()
grdCommHeader.AddItem("Code" & Chr(9) & " Description")

End Sub
Private Sub AddItems()
iNumRow = 0
iRow = 0
While Not objData.EndOfFile(CommDBName)

GrdCommList.AddItem(Trim(objData.GetFieldValue(0, CommDBName) & Chr(9) &


objData.GetFieldValue(1, CommDBName)))
iNumRow = iNumRow + 1

objData.MoveToNextRecord(CommDBName)

End While

GrdCommList.Refresh()

End Sub

Private Sub grdCommList_PaintCell(ByVal sender As Object, ByVal e As


AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles GrdCommList.PaintCell

If objData.GoToRecordIndex(e.row, CommDBName) = False Then


Exit Sub
End If
'common code for all forms
If e.selected Then
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHT)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.HIGHLIGHTTEXT)
Else
e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
End If

e.canvas.Erase()

e.canvas.DrawText(e.x + 3, e.y + 3, GrdCommList.get_TextMatrix(e.row, e.col))


End Sub

Private Sub grdCommList_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)


Handles GrdCommList.SelectCell

iSelectedRow = CInt(GrdCommList.Row)
objData.GoToRecordIndex(iSelectedRow, CommDBName)

End Sub

Private Sub grdCommList_LeftColChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles GrdCommList.LeftColChanged

grdCommHeader.LeftCol = GrdCommList.LeftCol

End Sub

Private Sub grdCommHeader_LeftColChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles grdCommHeader.LeftColChanged
GrdCommList.LeftCol = grdCommHeader.LeftCol

End Sub

Private Sub grdCommHeader_SelectCell(ByVal sender As Object, ByVal e As System.EventArgs)


Handles grdCommHeader.SelectCell

tmrComm.Enabled = False
tmrComm.Enabled = True

End Sub

Private Sub SortDatabase()

Select Case grdCommHeader.Col


Case 0
objData.SetSortFields(CommDBName, 0)
Case 1
objData.SetSortFields(CommDBName, 1)
End Select

End Sub
'See grdlocHeader_SelectCell for an explanation of this timer.
Private Sub tmrComm_TimerEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Handles tmrComm.TimerEvent

Dim myUID As Long

If iSelectedRow = 0 Then iSelectedRow = 1

objData.GoToRecordIndex(iSelectedRow, CommDBName)
myUID = objData.RecordUniqueID(CommDBName)
SortDatabase()
objData.FindRecordbyID(myUID, CommDBName)

If (bInitialSetup) Then
GrdCommList.Row = 0
bInitialSetup = False
Else
GrdCommList.Row = objData.CurrentIndex(CommDBName)
End If

GrdCommList.Refresh() 'Refresh the grid with the new sort order.


tmrComm.Enabled = False

End Sub

Private Sub grdCommHeader_PaintCell(ByVal sender As Object, ByVal e As


AppForge.Controls.OwnerDrawGrid.PaintCellEventArgs) Handles grdCommHeader.PaintCell

e.canvas.Reset()

e.canvas.BrushColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOW)
e.canvas.Erase()
e.canvas.PenColor = myShell.TranslateColor(AppForge.LogicalColor.WINDOWTEXT)
'e.canvas.CurrentFont = iFontHandle_Medium_Bold 'This font handle was created in
modCommon.setupFonts

If e.selected Then
e.canvas.DrawText(e.x + 3, e.y + 3, grdCommHeader.get_TextMatrix(e.row, e.col) & "*")
Else
e.canvas.DrawText(e.x + 3, e.y + 3, grdCommHeader.get_TextMatrix(e.row, e.col))
End If
End Sub

Private Sub btnCommCancel_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnCommCancel.ClickEvent
If g_Last_Screen = "MainComm" Then
LoadForm(g_objMain)
ElseIf g_Last_Screen = "Commodity" Then
LoadForm(g_objItem)
End If

For iRow = 0 To iNumRow


GrdCommList.RemoveItem(0)
Next
Me.Hide()
End Sub

Private Sub btnCommOk_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnCommOk.ClickEvent
Dim iTemp As String
Dim itemp1 As String
If g_Last_Screen = "Commodity" Then
iTemp = Trim(GrdCommList.get_TextMatrix(iSelectedRow, 0))
iTemp1 = Trim(GrdCommList.get_TextMatrix(iSelectedRow, 1))

objData.FindRecordByField(objCommList, iTemp, 0, CommDBName)


g_objItem.txtCommCode.Text = iTemp g_objItem.txtCommDesc.Text = itemp1
g_objItem.txtComm1.Text = objData.GetFieldValue(2, CommDBName)
g_objItem.txtComm2.Text = objData.GetFieldValue(3, CommDBName)
g_objItem.txtComm3.Text = objData.GetFieldValue(4, CommDBName)
g_objItem.txtComm4.Text = objData.GetFieldValue(5, CommDBName)
g_objItem.txtComm5.Text = objData.GetFieldValue(6, CommDBName)
g_objItem.txtComm6.Text = objData.GetFieldValue(7, CommDBName)
LoadForm(g_objItem)
ElseIf g_Last_Screen = "MainComm" Then

LoadForm(g_objMain)

End If

For iRow = 0 To iNumRow


GrdCommList.RemoveItem(0)
Next

Me.Hide()
End Sub
End Class
frmDate.vb

Option Strict Off


Option Explicit On

Public Class frmDate


Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()


MyBase.New()

'This call is required by the Windows Form Designer.


InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer


Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer


'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents dtPicker As AppForge.Controls.DatePicker
Friend WithEvents btnDateOk As AppForge.Controls.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmDate))
Me.dtPicker = New AppForge.Controls.DatePicker
Me.btnDateOk = New AppForge.Controls.Button
CType(Me.dtPicker, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.btnDateOk, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'dtPicker
'
Me.dtPicker.Location = New System.Drawing.Point(3, 16)
Me.dtPicker.OcxState = CType(resources.GetObject("dtPicker.OcxState"),
System.Windows.Forms.AxHost.State)
Me.dtPicker.Size = New System.Drawing.Size(157, 140)
Me.dtPicker.TabIndex = 0
'
'btnDateOk
'
Me.btnDateOk.Location = New System.Drawing.Point(112, 140)
Me.btnDateOk.OcxState = CType(resources.GetObject("btnDateOk.OcxState"),
System.Windows.Forms.AxHost.State)
Me.btnDateOk.Size = New System.Drawing.Size(48, 16)
Me.btnDateOk.TabIndex = 1
'
'frmDate
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 20)
Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte),
CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(160, 160)
Me.Controls.Add(Me.btnDateOk)
Me.Controls.Add(Me.dtPicker)
Me.Font = New System.Drawing.Font("AFPalm .NET", 16.0!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmDate"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = " Select Date"
CType(Me.dtPicker, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.btnDateOk, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub frmDate_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load

End Sub

Private Sub btnDateOk_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)


Handles btnDateOk.ClickEvent
LoadForm(g_objQty)
g_objQty.txtDate.Text = dtPicker.Value
Me.Hide()
End Sub
End Class
BaseClass.vb

Public Interface BaseClassStructure


Function GetFieldType(ByVal indx As Integer) As String
Function setValue(ByVal indx As Integer, ByVal sVal As String)
Function getFieldValue(ByVal indx As Integer) As String
ReadOnly Property iFieldCount() As Integer
End Interface
Datebase.vb
Option Explicit On

Imports System.Runtime.InteropServices

Public Class DataBase

Public Function OpenDatabase(ByVal sDBName As String) As Boolean


Select Case sDBName

Case InvDBName 'Inventory


#If APPTYPE = "PDA" Then
dbinventory =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & InvDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If

#If APPTYPE = "PPC" Then


dbinventory =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & InvDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If
If dbinventory <> 0 Then
OpenDatabase = True 'on successful opening of database

Else

OpenDatabase = False 'fail to open the database

#If APPTYPE = "PDA" Then


MsgBox("Could not open database -" & InvDBName & ".pdb" + vbCrLf + vbCrLf +
"Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation, "IRS")
#End If
#If APPTYPE = "PPC" Then
MsgBox("Could not open database -" & InvDBName & ".pdb" + vbCrLf + vbCrLf
+ "Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation,"IRS")
#End If
End If

'--------------------------------------------------
Case LocDBName 'Location
' Open the database
#If APPTYPE = "PDA" Then
dblocation =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & LocDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If
#If APPTYPE = "PPC" Then
dblocation =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & LocDBName", 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If
If dblocation <> 0 Then
OpenDatabase = True 'on successful opening of the database
Else
'We failed to open the database
OpenDatabase = False
#If APPTYPE = "PDA" Then
MsgBox("Could not open database -" & LocDBName & ".pdb" + vbCrLf + vbCrLf +
"Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation, "IRS")
#End If

#If APPTYPE = "PPC" Then


MsgBox("Could not open database -" & LocDBName & ".pdb" + vbCrLf + vbCrLf +
"Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation,"IRS")
#End If
End If
'--------------------------------------------
Case CommDBName ' Commodity database
' Open the database
#If APPTYPE = "PDA" Then
dbcommodity =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & CommDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If
#If APPTYPE = "PPC" Then
dbcommodity =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & CommDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If
If dbcommodity <> 0 Then
'On successfully opening the database
OpenDatabase = True 'On successfully opening the database

Else
OpenDatabase = False 'fail to open the database
#If APPTYPE = "PDA" Then
MsgBox("Could not open database -" & CommDBName & ".pdb" + vbCrLf + vbCrLf
+ "Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation, "IRS")
#End If
#If APPTYPE = "PPC" Then
MsgBox("Could not open database -" & CommDBName & ".pdb" + vbCrLf + vbCrLf + "Potential
causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database path in the
PDBOpen call is incorrect", vbExclamation,"IRS")
#End If
End If
'---------------------------------------------------------
Case UomDBName 'UOM database
' Open the database
#If APPTYPE = "PDA" Then
dbuom =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & UomDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If
#If APPTYPE = "PDA" Then
dbuom =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & UomDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If
If dbuom <> 0 Then
OpenDatabase = True 'on successful opening of the database

Else
OpenDatabase = False 'fail to open the database
#If APPTYPE = "PDA" Then
MsgBox("Could not open database -" & UomDBName & ".pdb" + vbCrLf + vbCrLf +
"Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation, "IRS")
#End If
#If APPTYPE = "PPC" Then
MsgBox("Could not open database -" & UomDBName & ".pdb" + vbCrLf + vbCrLf +
"Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation,"IRS")
#End If
End If
'--------------------------------------
Case UsrDBName 'User database
' Open the database
#If APPTYPE = "PDA" Then
dbuser =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & UsrDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)

#End If
#If APPTYPE = "PPC" Then
dbuser =
AFPDBClassInstance.PDBOpen(AppForge.MobileVB.Compatibility.tOpenStyle.Byfilename,
g_appPath & "\" & UsrDBName, 0, 0, 0, 0,
AppForge.MobileVB.Compatibility.tOpenMode.afModeReadWrite)
#End If
If dbuser <> 0 Then
OpenDatabase = True 'On successfully opening the database

Else
OpenDatabase = False 'fail to open the database
#If APPTYPE = "PDA" Then
MsgBox("Could not open database -" & UsrDBName & ".pdb" + vbCrLf + vbCrLf +
"Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation, "IRS")
#End If

#If APPTYPE = "PPC" Then


MsgBox("Could not open database -" & UsrDBName & ".pdb"+ vbCrLf + vbCrLf +
"Potential causes are:" + vbCrLf + "1. Database file does not exist" + vbCrLf + "2. The database
path in the PDBOpen call is incorrect", vbExclamation,"IRS")
#End If
End If
Case Else
'do nothing

End Select
End Function
' Function To Find the No of Records in the Databse
Public Function GetNumRecords(ByVal sDBName As String) As Integer

Select Case sDBName

Case InvDBName 'Inventory


Return AFPDBClassInstance.PDBNumRecords(dbinventory)
Case LocDBName 'Location
Return AFPDBClassInstance.PDBNumRecords(dblocation)
Case CommDBName 'Commodity
Return AFPDBClassInstance.PDBNumRecords(dbcommodity)
Case UomDBName 'UOM
Return AFPDBClassInstance.PDBNumRecords(dbuom)
Case UsrDBName 'User
Return AFPDBClassInstance.PDBNumRecords(dbuser)
Case Else
'do nothing
End Select

End Function

'Move to the First Record


Public Function MoveToFirstRecord(ByVal sDBName As String)
Select Case sDBName

Case InvDBName 'inventory


AFPDBClassInstance.PDBMoveFirst(dbinventory)
Case LocDBName 'location
AFPDBClassInstance.PDBMoveFirst(dblocation)
Case CommDBName 'commodity
AFPDBClassInstance.PDBMoveFirst(dbcommodity)
Case UomDBName 'uom
AFPDBClassInstance.PDBMoveFirst(dbuom)
Case UsrDBName 'user
AFPDBClassInstance.PDBMoveFirst(dbuser)
Case Else
'do nothing
End Select

End Function

'Move to the Previous Record


Public Function MoveToPrevRecord(ByVal sDBName As String)
Select Case sDBName

Case InvDBName 'inventory


AFPDBClassInstance.PDBMovePrev(dbinventory)
Case LocDBName 'location
AFPDBClassInstance.PDBMovePrev(dblocation)
Case CommDBName 'commodity
AFPDBClassInstance.PDBMovePrev(dbcommodity)
Case UomDBName 'uom
AFPDBClassInstance.PDBMovePrev(dbuom)
Case UsrDBName 'user
AFPDBClassInstance.PDBMovePrev(dbuser)
Case Else
'do nothing
End Select
End Function

'Move to the Next Record


Public Function MoveToNextRecord(ByVal sDBName As String)
Select Case sDBName

Case InvDBName 'inventory


AFPDBClassInstance.PDBMoveNext(dbinventory)
Case LocDBName 'location
AFPDBClassInstance.PDBMoveNext(dblocation)
Case CommDBName 'Commodity
AFPDBClassInstance.PDBMoveNext(dbcommodity)
Case UomDBName 'uom
AFPDBClassInstance.PDBMoveNext(dbuom)
Case UsrDBName 'user
AFPDBClassInstance.PDBMoveNext(dbuser)
Case Else
'do nothing
End Select

End Function

'Move to the Last Record


Public Function MoveToLastRecord(ByVal sDBName As String)
Select Case sDBName

Case InvDBName ' inventory


AFPDBClassInstance.PDBMoveLast(dbinventory)
Case LocDBName 'location
AFPDBClassInstance.PDBMoveLast(dblocation)
Case CommDBName 'commodity
AFPDBClassInstance.PDBMoveLast(dbcommodity)
Case UomDBName 'uom
AFPDBClassInstance.PDBMoveLast(dbuom)
Case UsrDBName 'user
AFPDBClassInstance.PDBMoveLast(dbuser)
Case Else
'do nothing
End Select

End Function

'Get The Record Unique ID


Public Function RecordUniqueID(ByVal sDBName As String) As Integer
Dim myUID As Integer

Select Case sDBName


Case InvDBName ' inventory
myUID = AFPDBClassInstance.PDBRecordUniqueID(dbinventory)
Return myUID
Case LocDBName 'location
myUID = AFPDBClassInstance.PDBRecordUniqueID(dblocation)
Return myUID
Case CommDBName 'Commodity
myUID = AFPDBClassInstance.PDBRecordUniqueID(dbcommodity)
Return myUID
Case UomDBName 'uom
myUID = AFPDBClassInstance.PDBRecordUniqueID(dbuom)
Return myUID
Case UsrDBName 'user
myUID = AFPDBClassInstance.PDBRecordUniqueID(dbuser)
Return myUID
Case Else
'do nothing
End Select

End Function

'Find The Record By Unique ID


Public Function FindRecordbyID(ByVal myUID As Integer, ByVal sDBName As String)
Select Case sDBName

Case InvDBName 'inventory


AFPDBClassInstance.PDBFindRecordByID(dbinventory, myUID)
Case LocDBName 'location
AFPDBClassInstance.PDBFindRecordByID(dblocation, myUID)
Case CommDBName 'commodity
AFPDBClassInstance.PDBFindRecordByID(dbcommodity, myUID)
Case UomDBName 'uom
AFPDBClassInstance.PDBFindRecordByID(dbuom, myUID)
Case UsrDBName 'user
AFPDBClassInstance.PDBFindRecordByID(dbuser, myUID)
Case Else
'do noting
End Select

End Function

'Get the Index of the Current Record


Public Function CurrentIndex(ByVal sDBName As String) As Integer

Select Case sDBName

Case InvDBName 'inventory


Return AFPDBClassInstance.PDBCurrentIndex(dbinventory)
Case LocDBName 'location
Return AFPDBClassInstance.PDBCurrentIndex(dblocation)
Case CommDBName 'commodity
Return AFPDBClassInstance.PDBCurrentIndex(dbcommodity)
Case UomDBName 'uom
Return AFPDBClassInstance.PDBCurrentIndex(dbuom)
Case UsrDBName 'user
Return AFPDBClassInstance.PDBCurrentIndex(dbuser)
Case Else
'do nothing
End Select

End Function

'Sort the Database by Field id passes as argument


Public Function SetSortFields(ByVal sDBName As String, ByVal iFieldID As Integer)
Select Case sDBName

Case InvDBName 'inventory


AFPDBClassInstance.PDBSetSortFields(dbinventory, iFieldID)
Case LocDBName 'location
AFPDBClassInstance.PDBSetSortFields(dblocation, iFieldID)
Case CommDBName 'commodity
AFPDBClassInstance.PDBSetSortFields(dbcommodity, iFieldID)
Case UomDBName 'uom
AFPDBClassInstance.PDBSetSortFields(dbuom, iFieldID)
Case UsrDBName 'user
AFPDBClassInstance.PDBSetSortFields(dbuser, iFieldID)
Case Else
'do nothing
End Select
End Function

'Delete One Record


Public Function DeleteOneRecord(ByVal sDBName As String) As Boolean

Select Case sDBName

Case InvDBName 'inventory


DeleteOneRecord = AFPDBClassInstance.PDBDeleteRecordEx(dbinventory,
AppForge.MobileVB.Compatibility.tDeleteMode.afDeleteModeRemove)
Case LocDBName 'location
DeleteOneRecord = AFPDBClassInstance.PDBDeleteRecordEx(dblocation,
AppForge.MobileVB.Compatibility.tDeleteMode.afDeleteModeRemove)
Case CommDBName 'commodity
DeleteOneRecord = AFPDBClassInstance.PDBDeleteRecordEx(dbcommodity,
AppForge.MobileVB.Compatibility.tDeleteMode.afDeleteModeRemove)
Case UomDBName 'uom
DeleteOneRecord = AFPDBClassInstance.PDBDeleteRecordEx(dbuom,
AppForge.MobileVB.Compatibility.tDeleteMode.afDeleteModeRemove)
Case UsrDBName 'user
DeleteOneRecord = AFPDBClassInstance.PDBDeleteRecordEx(dbuser,
AppForge.MobileVB.Compatibility.tDeleteMode.afDeleteModeRemove)

Case Else
'do noting
End Select

End Function

'Go to beginning of the file


Public Function BeginningOfFile(ByVal sDBName As String) As Boolean
Select Case sDBName
Case InvDBName 'inventory
Return AFPDBClassInstance.PDBBof(dbinventory)
Case LocDBName 'location
Return AFPDBClassInstance.PDBBof(dblocation)
Case CommDBName 'commodity
Return AFPDBClassInstance.PDBBof(dbcommodity)
Case UomDBName 'uom
Return AFPDBClassInstance.PDBBof(dbuom)
Case UsrDBName 'user
Return AFPDBClassInstance.PDBBof(dbuser)
Case Else
'do nothing
End Select

End Function

'go to end of the file


Public Function EndOfFile(ByVal sDBName As String) As Boolean
Select Case sDBName
Case InvDBName 'inventory
Return AFPDBClassInstance.PDBEof(dbinventory)
Case LocDBName 'location
Return AFPDBClassInstance.PDBEof(dblocation)
Case CommDBName 'commodity
Return AFPDBClassInstance.PDBEof(dbcommodity)
Case UomDBName 'uom
Return AFPDBClassInstance.PDBEof(dbuom)
Case UsrDBName 'user
Return AFPDBClassInstance.PDBEof(dbuser)
Case Else
'do nothing
End Select
End Function

'Get Field Value by Field Index


Public Function GetFieldValue(ByVal fldIndex As Integer, ByVal sDBName As String) As String

Select Case sDBName


Case InvDBName 'Inventory
Dim sValue As String
Dim sdtValue As Date
Dim sdblValue As Double
Dim sboolValue As Boolean
Dim slngValue As Long
Dim retVal As String
Dim InvStruct As tinventoryRecord
If (fldIndex = tinventoryDatabaseFields.inv_eqpid_Field) Then
AFPDBClassInstance.PDBGetField(dbinventory, fldIndex, sdblValue)
retVal = CStr(sdblValue)

Else

If InvStruct.GetFieldType(fldIndex) = s_string Then


AFPDBClassInstance.PDBGetField(dbinventory, fldIndex, sValue)
retVal = Trim(sValue)
ElseIf InvStruct.GetFieldType(fldIndex) = d_date Then
AFPDBClassInstance.PDBGetField(dbinventory, fldIndex, sdtValue)
retVal = CStr(Trim(sdtValue))
ElseIf InvStruct.GetFieldType(fldIndex) = bool_boolean Then
AFPDBClassInstance.PDBGetField(dbinventory, fldIndex, sboolValue)
retVal = CStr(Trim(sboolValue))
ElseIf InvStruct.GetFieldType(fldIndex) = dbl_double Then
AFPDBClassInstance.PDBGetField(dbinventory, fldIndex, sdblValue)
retVal = CStr(sdblValue)

ElseIf InvStruct.GetFieldType(fldIndex) = l_long Then


AFPDBClassInstance.PDBGetField(dbinventory, fldIndex, CDec(slngValue))
retVal = CStr(Trim(slngValue))
End If
End If
Return retVal
Case LocDBName 'location

Dim sValue As String


Dim sdtValue As Date
Dim sboolValue As Boolean
Dim retVal As String
Dim locStruct As tlocationRecord

If (fldIndex = tlocationDatabaseFields.loc_loccode_Field) Then


AFPDBClassInstance.PDBGetField(dblocation, fldIndex, sValue)
retVal = Trim(sValue)
Else
If locStruct.GetFieldType(fldIndex) = s_string Then
AFPDBClassInstance.PDBGetField(dblocation, fldIndex, sValue)
retVal = Trim(sValue)
ElseIf locStruct.GetFieldType(fldIndex) = d_date Then
AFPDBClassInstance.PDBGetField(dblocation, fldIndex, sdtValue)
retVal = CStr(Trim(sdtValue))
ElseIf locStruct.GetFieldType(fldIndex) = bool_boolean Then
AFPDBClassInstance.PDBGetField(dblocation, fldIndex, sboolValue)
retVal = CStr(Trim(sboolValue))
End If
End If
Return retVal

Case CommDBName 'Commodity

Dim sValue As String


Dim sdtValue As Date
Dim sboolValue As Boolean
Dim retVal As String
Dim commStruct As tcommodityRecord
If (fldIndex = tcommodityDatabaseFields.cmd_commcode_Field) Then
AFPDBClassInstance.PDBGetField(dbcommodity, fldIndex, sValue)
retVal = Trim(sValue)
Else
If commStruct.GetFieldType(fldIndex) = s_string Then
AFPDBClassInstance.PDBGetField(dbcommodity, fldIndex, sValue)
retVal = Trim(sValue)
ElseIf commStruct.GetFieldType(fldIndex) = d_date Then
AFPDBClassInstance.PDBGetField(dbcommodity, fldIndex, sdtValue)
retVal = CStr(Trim(sdtValue))
ElseIf commStruct.GetFieldType(fldIndex) = bool_boolean Then
AFPDBClassInstance.PDBGetField(dbcommodity, fldIndex, sboolValue)
retVal = CStr(Trim(sboolValue))

End If
End If
Return retVal

Case UomDBName 'UOM


Dim sValue As String
Dim sdtValue As Date
Dim sboolValue As Boolean
Dim retVal As String
Dim uomStruct As tuomRecord
If (fldIndex = tuomDatabaseFields.uom_uomcode_Field) Then
AFPDBClassInstance.PDBGetField(dbuom, fldIndex, sValue)
retVal = Trim(sValue)
Else
If uomStruct.GetFieldType(fldIndex) = s_string Then
AFPDBClassInstance.PDBGetField(dbuom, fldIndex, sValue)
retVal = Trim(sValue)
ElseIf uomStruct.GetFieldType(fldIndex) = d_date Then
AFPDBClassInstance.PDBGetField(dbuom, fldIndex, sdtValue)
retVal = CStr(Trim(sdtValue))
ElseIf uomStruct.GetFieldType(fldIndex) = bool_boolean Then
AFPDBClassInstance.PDBGetField(dbuom, fldIndex, sboolValue)
retVal = CStr(Trim(sboolValue))
End If
End If
Return retVal

Case UsrDBName 'user


Dim sValue As String
Dim sdtValue As Date
Dim sboolValue As Boolean
Dim retVal As String
Dim userStruct As tuserRecord
If (fldIndex = tuserDatabaseFields.usr_userid_Field) Then

AFPDBClassInstance.PDBGetField(dbuser, fldIndex, sValue)


retVal = Trim(sValue)
Else
If userStruct.GetFieldType(fldIndex) = s_string Then
AFPDBClassInstance.PDBGetField(dbuser, fldIndex, sValue)
retVal = Trim(sValue)
ElseIf userStruct.GetFieldType(fldIndex) = d_date Then
AFPDBClassInstance.PDBGetField(dbuser, fldIndex, sdtValue)
retVal = CStr(Trim(sdtValue))
ElseIf userStruct.GetFieldType(fldIndex) = bool_boolean Then
AFPDBClassInstance.PDBGetField(dbuser, fldIndex, sboolValue)
retVal = CStr(Trim(sboolValue))
End If
End If
Return retVal

Case Else
'do nothing
End Select
End Function
'Go to Record of Specified Index
Public Function GoToRecordIndex(ByVal index As Integer, ByVal sDBName As String) As
Boolean

Select Case sDBName


Case InvDBName ' Inventory
Return AFPDBClassInstance.PDBGotoIndex(dbinventory, index)
Case LocDBName 'Location
Return AFPDBClassInstance.PDBGotoIndex(dblocation, index)
Case CommDBName 'Commodity
Return AFPDBClassInstance.PDBGotoIndex(dbcommodity, index)
Case UomDBName 'uom
Return AFPDBClassInstance.PDBGotoIndex(dbuom, index)
Case UsrDBName 'user
Return AFPDBClassInstance.PDBGotoIndex(dbuser, index)
Case Else
'do nothing
End Select

End Function

'Read Record -----


Public Function ReadRecord(ByRef currentRec As BaseClassStructure, ByVal sDBName As
String) As Boolean
Dim iCtr As Integer

Select Case sDBName

Case InvDBName ' Inventory

Dim objInv As tinventoryRecord


Dim sVal As String
objInv = CType(currentRec, tinventoryRecord)
For iCtr = 0 To objInv.iFieldCount
sVal = GetFieldValue(iCtr, sDBName).ToString
objInv.setValue(iCtr, sVal)
Next
currentRec = objInv
Return True

Case LocDBName 'Location

Dim objLoc As tlocationRecord


Dim sVal As String
objLoc = CType(currentRec, tlocationRecord)
For iCtr = 0 To objLoc.iFieldCount
sVal = GetFieldValue(iCtr, sDBName).ToString
objLoc.setValue(iCtr, sVal)
Next
currentRec = objLoc
Return True
Case CommDBName 'Commmodity

Dim objComm As tcommodityRecord


Dim sVal As String
objComm = CType(currentRec, tcommodityRecord)
For iCtr = 0 To objComm.iFieldCount
sVal = GetFieldValue(iCtr, sDBName).ToString
objComm.setValue(iCtr, sVal)
Next
currentRec = objComm
Return True

Case UomDBName 'UOM

Dim objUom As tuomRecord


Dim sVal As String
objUom = CType(currentRec, tuomRecord)
For iCtr = 0 To objuom.iFieldCount
sVal = GetFieldValue(iCtr, sDBName).ToString
objUom.setValue(iCtr, sVal)
Next
currentRec = objUom
Return True

Case UsrDBName 'User

Dim objUser As tuserRecord


Dim sVal As String
objUser = CType(currentRec, tuserRecord)
For iCtr = 0 To objUser.iFieldCount
sVal = GetFieldValue(iCtr, sDBName).ToString
objUser.setValue(iCtr, sVal)
Next
currentRec = objUser
Return True

Case Else
'do nothing
End Select

End Function

'Write the fields of the record to the Database


Public Function WriteRecord(ByVal MyRecord As BaseClassStructure, ByVal sDBName As
String) As Boolean

Dim iCtr As Integer


Dim sDataType As String

Dim int As Integer


Dim str As String
Dim b_Bool As Boolean
Dim d_Decimal As Decimal
Dim d_Double As Double
Dim s_shrt As Short
Dim dt_date As Date

Select Case sDBName

Case InvDBName 'inventory

Dim objInv As tinventoryRecord


objInv = CType(MyRecord, tinventoryRecord)
For iCtr = 0 To objInv.iFieldCount
sDataType = objInv.GetFieldType(iCtr)
Select Case sDataType
Case s_string
str = objInv.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbinventory, iCtr, str)
Case d_date
dt_date = objInv.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbinventory, iCtr, dt_date)
Case dbl_double
d_Double = objInv.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbinventory, iCtr, d_Double)
Case bool_boolean
b_Bool = objInv.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbinventory, iCtr, b_Bool)
End Select
Next
MyRecord = objInv
Return True

Case LocDBName 'Location

Dim objLoc As tlocationRecord


objLoc = CType(MyRecord, tlocationRecord)
For iCtr = 0 To objLoc.iFieldCount
sDataType = objLoc.GetFieldType(iCtr)
Select Case sDataType
Case s_string
str = objLoc.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dblocation, iCtr, str)
Case d_date
dt_date = objLoc.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dblocation, iCtr, dt_date)
Case bool_boolean
b_Bool = objLoc.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dblocation, iCtr, b_Bool)
End Select
Next
MyRecord = objLoc
Return True
Case CommDBName 'Commodity

Dim objcomm As tcommodityRecord


objcomm = CType(MyRecord, tcommodityRecord)
For iCtr = 0 To objcomm.iFieldCount
sDataType = objcomm.GetFieldType(iCtr)
Select Case sDataType
Case s_string
str = objcomm.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbcommodity, iCtr, str)
Case d_date
dt_date = objcomm.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbcommodity, iCtr, dt_date)
Case bool_boolean
b_Bool = objcomm.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbcommodity, iCtr, b_Bool)
End Select
Next
MyRecord = objcomm
Return True

Case UomDBName 'UOM

Dim objUom As tuomRecord


objUom = CType(MyRecord, tuomRecord)
For iCtr = 0 To objUom.iFieldCount
sDataType = objUom.GetFieldType(iCtr)
Select Case sDataType
Case s_string
str = objUom.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbuom, iCtr, str)
Case d_date
dt_date = objUom.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbuom, iCtr, dt_date)
Case bool_boolean
b_Bool = objUom.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbuom, iCtr, b_Bool)
End Select
Next
MyRecord = objUom
Return True

Case UsrDBName 'User

Dim objUser As tuserRecord


objUser = CType(MyRecord, tuserRecord)
For iCtr = 0 To objUser.iFieldCount
sDataType = objUser.GetFieldType(iCtr)
Select Case sDataType
Case s_string
str = objUser.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbuser, iCtr, str)
Case d_date
dt_date = objUser.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbuser, iCtr, dt_date)
Case bool_boolean
b_Bool = objUser.getFieldValue(iCtr)
AFPDBClassInstance.PDBWriteField(dbuser, iCtr, b_Bool)
End Select
Next
MyRecord = objUser
Return True
Case Else
'do nothing
End Select

End Function
'Write a single field of the record to the Database
Public Function WriteSingleFieldRecord(ByVal MyRecord As BaseClassStructure, ByVal
sDBName As String, ByVal iFldNo As Integer) As Boolean

Dim sDataType As String


Dim int As Integer
Dim str As String
Dim b_Bool As Boolean
Dim d_Decimal As Decimal
Dim d_Double As Double
Dim s_shrt As Short
Dim dt_date As Date

Select Case sDBName

Case InvDBName 'inventory

Dim objInv As tinventoryRecord

objInv = CType(MyRecord, tinventoryRecord)

sDataType = objInv.GetFieldType(iFldNo)

Select Case sDataType


Case s_string
str = objInv.getFieldValue(iFldNo).ToString
AFPDBClassInstance.PDBWriteField(dbinventory, iFldNo, str)
Case d_date
dt_date = CDate(objInv.getFieldValue(iFldNo))
AFPDBClassInstance.PDBWriteField(dbinventory, iFldNo, dt_date)
Case dbl_double

d_Double = CDbl(CInt(objInv.getFieldValue(iFldNo)))

AFPDBClassInstance.PDBWriteField(dbinventory, iFldNo, d_Double)


Case bool_boolean
b_Bool = CBool(objInv.getFieldValue(iFldNo))
AFPDBClassInstance.PDBWriteField(dbinventory, iFldNo, b_Bool)
End Select
MyRecord = objInv

Return True

Case LocDBName 'Location

Dim objLoc As tlocationRecord


objLoc = CType(MyRecord, tlocationRecord)
sDataType = objLoc.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = objLoc.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dblocation, iFldNo, str)
Case d_date
dt_date = objLoc.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dblocation, iFldNo, dt_date)
Case bool_boolean
b_Bool = objLoc.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dblocation, iFldNo, b_Bool)
End Select

MyRecord = objLoc
Return True

Case CommDBName 'Commodity

Dim objcomm As tcommodityRecord


objcomm = CType(MyRecord, tcommodityRecord)

sDataType = objcomm.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = objcomm.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbcommodity, iFldNo, str)
Case d_date
dt_date = objcomm.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbcommodity, iFldNo, dt_date)
Case bool_boolean
b_Bool = objcomm.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbcommodity, iFldNo, b_Bool)
End Select

MyRecord = objcomm
Return True

Case UomDBName 'UOM

Dim objUom As tuomRecord


objUom = CType(MyRecord, tuomRecord)
sDataType = objUom.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = objUom.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbuom, iFldNo, str)
Case d_date
dt_date = objUom.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbuom, iFldNo, dt_date)
Case bool_boolean
b_Bool = objUom.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbuom, iFldNo, b_Bool)
End Select

MyRecord = objUom
Return True

Case UsrDBName 'User

Dim objUser As tuserRecord


objUser = CType(MyRecord, tuserRecord)
sDataType = objUser.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = objUser.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbuser, iFldNo, str)
Case d_date
dt_date = objUser.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbuser, iFldNo, dt_date)
Case bool_boolean
b_Bool = objUser.getFieldValue(iFldNo)
AFPDBClassInstance.PDBWriteField(dbuser, iFldNo, b_Bool)
End Select

MyRecord = objUser
Return True
Case Else
'do nothing
End Select

End Function
'move pointer to the search record if found
Public Function FindRecordByField(ByVal MyRecord As BaseClassStructure, ByVal sSearchText
As String, ByVal iFldNo As Integer, ByVal sDBName As String)

Dim iCtr As Integer


Dim sVal As String

Dim sDataType As String

Dim int As Integer


Dim str As String
Dim b_Bool As Boolean
Dim d_Decimal As Decimal
Dim d_Double As Double
Dim s_shrt As Short
Dim dt_date As Date

Select Case sDBName

Case InvDBName 'Inventory


sDataType = MyRecord.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = sSearchText
AFPDBClassInstance.PDBFindRecordByField(dbinventory, iFldNo, str)
Case d_date
dt_date = CDate(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dbinventory, iFldNo, dt_date)

Case bool_boolean
b_Bool = CBool(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dbinventory, iFldNo, b_Bool)
Case dbl_double
d_Double = CDbl(CInt(sSearchText))
AFPDBClassInstance.PDBFindRecordByField(dbinventory, iFldNo, d_Double)
End Select

Case LocDBName 'Location


Dim objLoc As tlocationRecord
objLoc = CType(MyRecord, tlocationRecord)
sDataType = objLoc.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = sSearchText
AFPDBClassInstance.PDBFindRecordByField(dblocation, iFldNo, str)
Case d_date
dt_date = CDate(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dblocation, iFldNo, dt_date)

Case bool_boolean
b_Bool = CBool(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dblocation, iFldNo, b_Bool)

End Select

Case CommDBName 'Commodity


Dim objComm As tcommodityRecord
objComm = CType(MyRecord, tcommodityRecord)
sDataType = objComm.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = sSearchText
AFPDBClassInstance.PDBFindRecordByField(dbcommodity, iFldNo, str)
Case d_date
dt_date = CDate(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dbcommodity, iFldNo, dt_date)

Case bool_boolean
b_Bool = CBool(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dbcommodity, iFldNo, b_Bool)

End Select

Case UomDBName 'UOM


Dim objUom As tuomRecord
objUom = CType(MyRecord, tuomRecord)
sDataType = objUom.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = sSearchText
AFPDBClassInstance.PDBFindRecordByField(dbuom, iFldNo, str)
Case d_date
dt_date = CDate(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dbuom, iFldNo, dt_date)

Case bool_boolean
b_Bool = CBool(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dbuom, iFldNo, b_Bool)
End Select

Case UsrDBName 'User


sDataType = MyRecord.GetFieldType(iFldNo)
Select Case sDataType
Case s_string
str = sSearchText
AFPDBClassInstance.PDBFindRecordByField(dbuser, iFldNo, str)

Case d_date
dt_date = CDate(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dbuser, iFldNo, dt_date)
Case bool_boolean
b_Bool = CBool(sSearchText)
AFPDBClassInstance.PDBFindRecordByField(dbuser, iFldNo, b_Bool)
End Select

Case Else
'do nothing

End Select

End Function
' Creation of record structure by Schema involves
'Create Record By Schema ,Write to the Database then Update
Public Function CreateRecord(ByVal MyRecord As BaseClassStructure, ByVal sDBName As
String) As Boolean

Select Case sDBName

Case InvDBName 'Inventory


' Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dbinventory)
'Write the new record + Update the new record
CreateRecord = WriteRecord(MyRecord, sDBName)
AFPDBClassInstance.PDBUpdateRecord(dbinventory)
Return CreateRecord

Case LocDBName 'Location


'Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dblocation)
'Write the new record + Update the new record
CreateRecord = WriteRecord(MyRecord, sDBName)
AFPDBClassInstance.PDBUpdateRecord(dblocation)
Return CreateRecord

Case CommDBName 'Commodity


'Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dbcommodity)
'Write the new record + Update the new record
CreateRecord = WriteRecord(MyRecord, sDBName)
AFPDBClassInstance.PDBUpdateRecord(dbcommodity)
Return CreateRecord

Case UomDBName 'UOM


'Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dbuom)
'Write the new record + Update the new record
CreateRecord = WriteRecord(MyRecord, sDBName)
AFPDBClassInstance.PDBUpdateRecord(dbuom)
Return CreateRecord

Case UsrDBName 'User


'Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dbuser)
'Write the new record + Update the new record
CreateRecord = WriteRecord(MyRecord, sDBName)
AFPDBClassInstance.PDBUpdateRecord(dbuser)
Return CreateRecord

Case Else
'do nothing
End Select

End Function
Public Function CreateSingleFieldRecord(ByVal MyRecord As BaseClassStructure, ByVal
sDBName As String, ByVal iFldNo As Integer) As Boolean
Select Case sDBName

Case InvDBName 'Inventory


' Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dbinventory)
'Write the new record + Update the new record

CreateSingleFieldRecord = WriteSingleFieldRecord(MyRecord, sDBName, iFldNo)

AFPDBClassInstance.PDBUpdateRecord(dbinventory)
Return CreateSingleFieldRecord
Case LocDBName 'Location
'Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dblocation)
'Write the new record + Update the new record
CreateSingleFieldRecord = WriteSingleFieldRecord(MyRecord, sDBName, iFldNo)
AFPDBClassInstance.PDBUpdateRecord(dblocation)
Return CreateSingleFieldRecord

Case CommDBName 'Commodity


'Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dbcommodity)
'Write the new record + Update the new record
CreateSingleFieldRecord = WriteSingleFieldRecord(MyRecord, sDBName, iFldNo)
AFPDBClassInstance.PDBUpdateRecord(dbcommodity)
Return CreateSingleFieldRecord
Case UomDBName 'UOM
'Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dbuom)
'Write the new record + Update the new record
CreateSingleFieldRecord = WriteSingleFieldRecord(MyRecord, sDBName, iFldNo)
AFPDBClassInstance.PDBUpdateRecord(dbuom)
Return CreateSingleFieldRecord
Case UsrDBName 'User
'Create a new record
AFPDBClassInstance.PDBCreateRecordBySchema(dbuser)
'Write the new record + Update the new record
CreateSingleFieldRecord = WriteSingleFieldRecord(MyRecord, sDBName, iFldNo)
AFPDBClassInstance.PDBUpdateRecord(dbuser)
Return CreateSingleFieldRecord
Case Else
'do nothing
End Select

End Function
'Edit a single field
Public Function EditSingleField(ByVal MyRecord As BaseClassStructure, ByVal sDBName As
String, ByVal iFieldNo As Integer) As Boolean

Dim sDataType As String


Dim int As Integer
Dim str As String
Dim b_Bool As Boolean
Dim d_Decimal As Decimal
Dim d_Double As Double
Dim s_shrt As Short
Dim dt_date As Date
Dim l_lng As Long

Select Case sDBName

Case InvDBName 'Inventory

Dim objInv As tinventoryRecord


objInv = CType(MyRecord, tinventoryRecord)
sDataType = objInv.GetFieldType(iFieldNo)
AFPDBClassInstance.PDBEditRecord(dbinventory)
Select Case sDataType
Case s_string
str = objInv.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbinventory, iFieldNo, str)
Case d_date
dt_date = objInv.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbinventory, iFieldNo, dt_date)
Case dbl_double
d_Double = CDbl(CInt(objInv.getFieldValue(iFieldNo)))
AFPDBClassInstance.PDBWriteField(dbinventory, iFieldNo, d_Double)
Case bool_boolean
If (objInv.getFieldValue(iFieldNo) = "True") Then
b_Bool = True
Else
b_Bool = False
End If
AFPDBClassInstance.PDBWriteField(dbinventory, iFieldNo, b_Bool)
Case l_long
l_lng = CLng(CInt(objInv.getFieldValue(iFieldNo)))
AFPDBClassInstance.PDBWriteField(dbinventory, iFieldNo, l_lng)
End Select
'After change, Update the record

AFPDBClassInstance.PDBUpdateRecord(dbinventory)
MyRecord = objInv
Return True

Case LocDBName 'Location

Dim objLoc As tlocationRecord


objLoc = CType(MyRecord, tlocationRecord)
sDataType = objLoc.GetFieldType(iFieldNo)
AFPDBClassInstance.PDBEditRecord(dblocation)
Select Case sDataType
Case s_string
str = objLoc.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dblocation, iFieldNo, str)
Case d_date
dt_date = objLoc.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dblocation, iFieldNo, dt_date)
Case bool_boolean
b_Bool = objLoc.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dblocation, iFieldNo, b_Bool)
End Select
'After change, Update the record
AFPDBClassInstance.PDBUpdateRecord(dblocation)
MyRecord = objLoc
Return True

Case CommDBName 'Commodity

Dim objComm As tcommodityRecord


objComm = CType(MyRecord, tcommodityRecord)
sDataType = objComm.GetFieldType(iFieldNo)
AFPDBClassInstance.PDBEditRecord(dbcommodity)
Select Case sDataType
Case s_string
str = objComm.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbcommodity, iFieldNo, str)
Case d_date
dt_date = objComm.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbcommodity, iFieldNo, dt_date)
Case bool_boolean
b_Bool = objComm.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbcommodity, iFieldNo, b_Bool)
End Select
'After change,Update the record
AFPDBClassInstance.PDBUpdateRecord(dbcommodity)
MyRecord = objComm
Return True

Case UomDBName 'UOM

Dim objUom As tuomRecord


objUom = CType(MyRecord, tuomRecord)
sDataType = objUom.GetFieldType(iFieldNo)
AFPDBClassInstance.PDBEditRecord(dbuom)
Select Case sDataType
Case s_string
str = objUom.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbuom, iFieldNo, str)
Case d_date
dt_date = objUom.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbuom, iFieldNo, dt_date)
Case bool_boolean
b_Bool = objUom.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbuom, iFieldNo, b_Bool)
End Select
'After change, Update the record
AFPDBClassInstance.PDBUpdateRecord(dbuom)
MyRecord = objUom
Return True

Case UsrDBName 'User

Dim objUser As tuserRecord


objUser = CType(MyRecord, tuserRecord)
sDataType = objUser.GetFieldType(iFieldNo)
AFPDBClassInstance.PDBEditRecord(dbuser)
Select Case sDataType
Case s_string
str = objUser.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbuser, iFieldNo, str)
Case d_date
dt_date = objUser.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbuser, iFieldNo, dt_date)
Case bool_boolean
b_Bool = objUser.getFieldValue(iFieldNo)
AFPDBClassInstance.PDBWriteField(dbuser, iFieldNo, b_Bool)
End Select
'After change, Update the record
AFPDBClassInstance.PDBUpdateRecord(dbuser)
MyRecord = objUser
Return True

Case Else
'do nothing

End Select
End Function

'Edit the Record


Public Function EditRecord(ByVal MyRecord As BaseClassStructure, ByVal sDBName As String)
As Boolean

Select Case sDBName

Case InvDBName ' Inventory


'Set the current record in dbinventory to an edit state.
AFPDBClassInstance.PDBEditRecord(dbinventory)
'Now edit the record
EditRecord = WriteRecord(MyRecord, sDBName)
'After change , Update the record
AFPDBClassInstance.PDBUpdateRecord(dbinventory)
Case LocDBName 'Location
'Set the current record in dbLocation to an edit state.
AFPDBClassInstance.PDBEditRecord(dblocation)
'Now edit the record
EditRecord = WriteRecord(MyRecord, sDBName)
'After change , Update the record
AFPDBClassInstance.PDBUpdateRecord(dblocation)
Case CommDBName ' Commodity
'Set the current record in dbcommodity to an edit state.
AFPDBClassInstance.PDBEditRecord(dbcommodity)
'Now edit the record
EditRecord = WriteRecord(MyRecord, sDBName)
'After change , Update the record
AFPDBClassInstance.PDBUpdateRecord(dbcommodity)
Case InvDBName ' UOM
'Set the current record in dbUom to an edit state.
AFPDBClassInstance.PDBEditRecord(dbuom)
'Now edit the record
EditRecord = WriteRecord(MyRecord, sDBName)
'After change , Update the record
AFPDBClassInstance.PDBUpdateRecord(dbuom)
Case InvDBName ' User
'Set the current record in dbUser to an edit state.
AFPDBClassInstance.PDBEditRecord(dbuser)
'Now edit the record
EditRecord = WriteRecord(MyRecord, sDBName)
'After change , Update the record
AFPDBClassInstance.PDBUpdateRecord(dbuser)
Case Else
'do nothing
End Select
End Function

'get total number of fields


Public Function GetNumFields(ByVal sDBName As String) As Short

Select Case sDBName


Case InvDBName 'Inventory
Return AFPDBClassInstance.PDBGetNumFields(dbinventory)
Case LocDBName 'Location
Return AFPDBClassInstance.PDBGetNumFields(dblocation)
Case CommDBName 'Commodity
Return AFPDBClassInstance.PDBGetNumFields(dbcommodity)
Case UomDBName 'Uom
Return AFPDBClassInstance.PDBGetNumFields(dbuom)
Case UsrDBName 'User
Return AFPDBClassInstance.PDBGetNumFields(dbuser)
Case Else
'do nothing
End Select

End Function
Public Sub CloseDatabase(ByVal sDBName As String)

' Close the database


Select Case sDBName
Case InvDBName ' Inventory
AFPDBClassInstance.PDBClose(dbinventory)
dbinventory = 0
Case LocDBName 'Location
AFPDBClassInstance.PDBClose(dblocation)
dblocation = 0
Case CommDBName 'Commodity
AFPDBClassInstance.PDBClose(dbcommodity)
dbcommodity = 0
Case UomDBName 'UOM
AFPDBClassInstance.PDBClose(dbuom)
dbuom = 0
Case UsrDBName 'User
AFPDBClassInstance.PDBClose(dbuser)
dbuser = 0
Case Else
'do nothing
End Select

End Sub

End Class
Global.vb

Imports System.Runtime.InteropServices
Module Global

'This is an instance of the AFPDBLibrary class used within this module.


Public AFPDBClassInstance As New AppForge.MobileVB.Compatibility.PDBLibrary

'Constant decleration to specify variable types


Public Const i_int = 0
Public Const s_string = 1
Public Const d_date = 3
Public Const dbl_double = 5
Public Const bool_boolean = 6
Public Const dec_decimal = 7
Public Const s_short = 8
Public Const l_long = 9

'---------------------------------------------------------------------------
'Database Structure Declaration
'---------------------------------------------------------------------------
' Commodity Database
'CreatorID and TypeID for Commodity Database
Public Const commodity_CreatorID As Integer = &H49525350
Public Const commodity_TypeID As Integer = &H44415441

'Global variable to store the database handle


Public dbcommodity As Integer

' Enumerated Commodity DB Fields


Public Enum tcommodityDatabaseFields
cmd_commcode_Field = 0
cmd_description_Field = 1
cmd_spec1_Field = 2
cmd_spec2_Field = 3
cmd_spec3_Field = 4
cmd_spec4_Field = 5
cmd_spec5_Field = 6
cmd_spec6_Field = 7
cmd_pagenumber_Field = 8
cmd_adddatetime_Field = 9
cmd_adduser_Field = 10
cmd_addprog_Field = 11
cmd_lmdatetime_Field = 12
cmd_lmuser_Field = 13
cmd_lmprog_Field = 14
cmd_inactive_Field = 15
End Enum

'Commodity DB structure implements BaseClassStructure interface


<StructLayout(LayoutKind.Sequential, Pack:=4)> _
Public Structure tcommodityRecord : Implements BaseClassStructure 'implements
BaseClassStructure interface

<MarshalAs(UnmanagedType.BStr)> Public cmd_commcode As String


<MarshalAs(UnmanagedType.BStr)> Public cmd_description As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_spec1 As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_spec2 As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_spec3 As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_spec4 As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_spec5 As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_spec6 As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_pagenumber As String
Public cmd_adddatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public cmd_adduser As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_addprog As String
Public cmd_lmdatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public cmd_lmuser As String
<MarshalAs(UnmanagedType.BStr)> Public cmd_lmprog As String
<MarshalAs(UnmanagedType.VariantBool)> Public cmd_inactive As Boolean
'Public Const iFieldCount = 15 'Total # of fields
Private Const FieldCount As Integer = 15
Public ReadOnly Property iFieldCount() As Integer Implements BaseClassStructure.iFieldCount
Get
Return FieldCount
End Get

End Property

'Pass the field index # to get the data type


Public Function GetFieldType(ByVal indx As Integer) As String Implements
BaseClassStructure.GetFieldType

Select Case indx


Case 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 14
Return s_string
Case 9, 12
Return d_date
Case 15
Return bool_boolean
End Select

End Function

'Pass the field index # current value present in the control to be set into the data field
Public Function setValue(ByVal indx As Integer, ByVal sVal As String) Implements
BaseClassStructure.setValue

Select Case indx


Case 0
cmd_commcode = sVal
Case 1
cmd_description = sVal
Case 2
cmd_spec1 = sVal
Case 3
cmd_spec2 = sVal
Case 4
cmd_spec3 = sVal
Case 5
cmd_spec4 = sVal
Case 6
cmd_spec5 = sVal
Case 7
cmd_spec6 = sVal
Case 8
cmd_pagenumber = sVal
Case 9
cmd_adddatetime = CDate(sVal)
Case 10
cmd_adduser = sVal
Case 11
cmd_addprog = sVal
Case 12
cmd_lmdatetime = CDate(sVal)
Case 13
cmd_lmuser = sVal
Case 14
cmd_lmprog = sVal
Case 15
cmd_inactive = CBool(sVal)

End Select

End Function

'Pass the field index # to get the value of the field


Public Function getFieldValue(ByVal indx As Integer) As String Implements
BaseClassStructure.GetFieldvalue
Select Case indx
Case 0
getFieldValue = cmd_commcode
Case 1
getFieldValue = cmd_description
Case 2
getFieldValue = cmd_spec1
Case 3
getFieldValue = cmd_spec2
Case 4
getFieldValue = cmd_spec3
Case 5
getFieldValue = cmd_spec4
Case 6
getFieldValue = cmd_spec5
Case 7
getFieldValue = cmd_spec6
Case 8
getFieldValue = cmd_pagenumber
Case 9
getFieldValue = cmd_adddatetime
Case 10
getFieldValue = cmd_adduser
Case 11
getFieldValue = cmd_addprog
Case 12
getFieldValue = cmd_lmdatetime
Case 13
getFieldValue = cmd_lmuser
Case 14
getFieldValue = cmd_lmprog
Case 15
getFieldValue = cmd_inactive
End Select

End Function

End Structure 'End of CommodityDB structure decleration


'---------------------------------
'Location Database
'----------------------------------

' constants for the CreatorID and TypeID


Public Const location_CreatorID As Integer = &H49525350
Public Const location_TypeID As Integer = &H44415441

' Global variable to store the database handle


Public dblocation As Integer

' Enumerated Location DB Fields to access converted database Fields


Public Enum tlocationDatabaseFields
loc_loccode_Field = 0
loc_name_Field = 1
loc_companycode_Field = 2
loc_division_Field = 3
loc_generalphone_Field = 4
loc_generalfax_Field = 5
loc_spare_Field = 6
loc_email_Field = 7
loc_add1_Field = 8
loc_add2_Field = 9
loc_city_Field = 10
loc_state_Field = 11
loc_zip1_Field = 12
loc_zip2_Field = 13
loc_province_Field = 14
loc_country_Field = 15
loc_postalcode_Field = 16
loc_inactive_Field = 17
loc_consignment_Field = 18
loc_notes_Field = 19
loc_adddatetime_Field = 20
loc_adduser_Field = 21
loc_addprog_Field = 22
loc_lmdatetime_Field = 23
loc_lmuser_Field = 24
loc_lmprog_Field = 25
End Enum
'Location DB structure implements BaseClassStructure interface
<StructLayout(LayoutKind.Sequential, Pack:=4)> _
Public Structure tlocationRecord : Implements BaseClassStructure 'implements BaseClassStructure
interface
<MarshalAs(UnmanagedType.BStr)> Public loc_loccode As String
<MarshalAs(UnmanagedType.BStr)> Public loc_name As String
<MarshalAs(UnmanagedType.BStr)> Public loc_companycode As String
<MarshalAs(UnmanagedType.BStr)> Public loc_division As String
<MarshalAs(UnmanagedType.BStr)> Public loc_generalphone As String
<MarshalAs(UnmanagedType.BStr)> Public loc_generalfax As String
<MarshalAs(UnmanagedType.BStr)> Public loc_spare As String
<MarshalAs(UnmanagedType.BStr)> Public loc_email As String
<MarshalAs(UnmanagedType.BStr)> Public loc_add1 As String
<MarshalAs(UnmanagedType.BStr)> Public loc_add2 As String
<MarshalAs(UnmanagedType.BStr)> Public loc_city As String
<MarshalAs(UnmanagedType.BStr)> Public loc_state As String
<MarshalAs(UnmanagedType.BStr)> Public loc_zip1 As String
<MarshalAs(UnmanagedType.BStr)> Public loc_zip2 As String
<MarshalAs(UnmanagedType.BStr)> Public loc_province As String
<MarshalAs(UnmanagedType.BStr)> Public loc_country As String
<MarshalAs(UnmanagedType.BStr)> Public loc_postalcode As String
<MarshalAs(UnmanagedType.VariantBool)> Public loc_inactive As Boolean
<MarshalAs(UnmanagedType.VariantBool)> Public loc_consignment As Boolean
<MarshalAs(UnmanagedType.BStr)> Public loc_notes As String
Public loc_adddatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public loc_adduser As String
<MarshalAs(UnmanagedType.BStr)> Public loc_addprog As String
Public loc_lmdatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public loc_lmuser As String
<MarshalAs(UnmanagedType.BStr)> Public loc_lmprog As String
'Public Const iFieldCount = 25 'Total # of fields
Private Const FieldCount As Integer = 25
Public ReadOnly Property iFieldCount() As Integer Implements BaseClassStructure.iFieldCount
Get
Return FieldCount
End Get

End Property

'Pass the field index # to get the data type


Public Function GetFieldType(ByVal indx As Integer) As String Implements
BaseClassStructure.GetFieldType
Select Case indx
Case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 21, 22, 24, 25
Return s_string
Case 20, 23
Return d_date
Case 17, 18
Return bool_boolean
End Select

End Function

'Pass the field index # current value present in the control to be set into the data field
Public Function setValue(ByVal indx As Integer, ByVal sVal As String) Implements
BaseClassStructure.setValue

Select Case indx


Case 0
loc_loccode = sVal
Case 1
loc_name = sVal
Case 2
loc_companycode = sVal
Case 3
loc_division = sVal
Case 4
loc_generalphone = sVal
Case 5
loc_generalfax = sVal
Case 6
loc_spare = sVal
Case 7
loc_email = sVal
Case 8
loc_add1 = sVal
Case 9
loc_add2 = sVal
Case 10
loc_city = sVal
Case 11
loc_state = sVal
Case 12
loc_zip1 = sVal
Case 13
loc_zip2 = sVal
Case 14
loc_province = sVal
Case 15
loc_country = sVal
Case 16
loc_postalcode = sVal
Case 17
loc_inactive = CBool(sVal)
Case 18
loc_consignment = CBool(sVal)
Case 19
loc_notes = sVal
Case 20
loc_adddatetime = CDate(sVal)
Case 21
loc_adduser = sVal
Case 22
loc_addprog = sVal
Case 23
loc_lmdatetime = CDate(sVal)
Case 24
loc_lmuser = sVal
Case 25
loc_lmprog = sVal

End Select

End Function

'Pass the field index # to get the value of the field


Public Function getFieldValue(ByVal indx As Integer) As String Implements
BaseClassStructure.getFieldValue

Select Case indx


Case 0
getFieldValue = loc_loccode
Case 1
getFieldValue = loc_name
Case 2
getFieldValue = loc_companycode
Case 3
getFieldValue = loc_division
Case 4
getFieldValue = loc_generalphone
Case 5
getFieldValue = loc_generalfax
Case 6
getFieldValue = loc_spare
Case 7
getFieldValue = loc_email
Case 8
getFieldValue = loc_add1
Case 9
getFieldValue = loc_add2
Case 10
getFieldValue = loc_city
Case 11
getFieldValue = loc_state
Case 12
getFieldValue = loc_zip1
Case 13
getFieldValue = loc_zip2
Case 14
getFieldValue = loc_province
Case 15
getFieldValue = loc_country
Case 16
getFieldValue = loc_postalcode
Case 17
getFieldValue = loc_inactive
Case 18
getFieldValue = loc_consignment
Case 19
getFieldValue = loc_notes
Case 20
getFieldValue = loc_adddatetime
Case 21
getFieldValue = loc_adduser
Case 22
getFieldValue = loc_addprog
Case 23
getFieldValue = loc_lmdatetime
Case 24
getFieldValue = loc_lmuser
Case 25
getFieldValue = loc_lmprog

End Select

End Function

End Structure ' End of LocationDB structure declaration


'---------------------
' UOM database
'--------------------

'Constants for the CreatorID and TypeID


Public Const uom_CreatorID As Integer = &H49525350
Public Const uom_TypeID As Integer = &H44415441

' Global variable to store the database handle


Public dbuom As Integer

' Enumerated fields to get access to the converted database Fields


Public Enum tuomDatabaseFields
uom_uomcode_Field = 0
uom_description_Field = 1
uom_adddatetime_Field = 2
uom_adduser_Field = 3
uom_addprog_Field = 4
uom_lmdatetime_Field = 5
uom_lmuser_Field = 6
uom_lmprog_Field = 7
uom_inactive_Field = 8
End Enum
' UOM DB structure implements the BaseClassStructure interface
<StructLayout(LayoutKind.Sequential, Pack:=4)> _
Public Structure tuomRecord : Implements BaseClassStructure 'implements BaseClassStructure
interface
<MarshalAs(UnmanagedType.BStr)> Public uom_uomcode As String
<MarshalAs(UnmanagedType.BStr)> Public uom_description As String
Public uom_adddatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public uom_adduser As String
<MarshalAs(UnmanagedType.BStr)> Public uom_addprog As String
Public uom_lmdatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public uom_lmuser As String
<MarshalAs(UnmanagedType.BStr)> Public uom_lmprog As String
<MarshalAs(UnmanagedType.VariantBool)> Public uom_inactive As Boolean
'Public Const iFieldCount = 8 'Total # of fields
Private Const FieldCount As Integer = 8
Public ReadOnly Property iFieldCount() As Integer Implements BaseClassStructure.iFieldCount
Get
Return FieldCount
End Get

End Property

'Pass the field index # to get the data type


Public Function GetFieldType(ByVal indx As Integer) As String Implements
BaseClassStructure.GetFieldType

Select Case indx


Case 0, 1, 3, 4, 5, 6, 7
Return s_string
Case 2, 5
Return d_date
Case 8
Return bool_boolean
End Select

End Function

'Pass the field index # current value present in the control to be set into the data field
Public Function setValue(ByVal indx As Integer, ByVal sVal As String) Implements
BaseClassStructure.setValue

Select Case indx


Case 0
uom_uomcode = sVal
Case 1
uom_description = sVal
Case 2
uom_adddatetime = CDate(sVal)
Case 3
uom_adduser = sVal
Case 4
uom_addprog = sVal
Case 5
uom_lmdatetime = CDate(sVal)
Case 6
uom_lmuser = sVal
Case 7
uom_lmprog = sVal
Case 8
uom_inactive = CBool(sVal)

End Select

End Function

'Pass the field index # to get the value of the field


Public Function getFieldValue(ByVal indx As Integer) As String Implements
BaseClassStructure.getFieldValue
Select Case indx
Case 0
getFieldValue = uom_uomcode
Case 1
getFieldValue = uom_description
Case 2
getFieldValue = uom_adddatetime
Case 3
getFieldValue = uom_adduser
Case 4
getFieldValue = uom_addprog
Case 5
getFieldValue = uom_lmdatetime
Case 6
getFieldValue = uom_lmuser
Case 7
getFieldValue = uom_lmprog
Case 8
getFieldValue = uom_inactive
End Select

End Function
End Structure ' End of UOMDB structure declaration

'----------------------------
'User Datatabase
'----------------------------
' Constants for the CreatorID and TypeID
Public Const user_CreatorID As Integer = &H49525350
Public Const user_TypeID As Integer = &H44415441

' Global variable to store the database handle


Public dbuser As Integer

'Enumerated fields to get access to the converted database Fields


Public Enum tuserDatabaseFields
usr_userid_Field = 0
usr_name_Field = 1
usr_title_Field = 2
usr_password_Field = 3
usr_securitylevel_Field = 4
usr_quoteflag_Field = 5
usr_phone_Field = 6
usr_fax_Field = 7
usr_emailaddress_Field = 8
usr_adddatetime_Field = 9
usr_adduser_Field = 10
usr_addprog_Field = 11
usr_lmdatetime_Field = 12
usr_lmuser_Field = 13
usr_lmprog_Field = 14
usr_inactive_Field = 15
End Enum
' User DB Structure implements the BaseClassStructure
<StructLayout(LayoutKind.Sequential, Pack:=4)> _
Public Structure tuserRecord : Implements BaseClassStructure 'implements BaseClassStructure
interface
<MarshalAs(UnmanagedType.BStr)> Public usr_userid As String
<MarshalAs(UnmanagedType.BStr)> Public usr_name As String
<MarshalAs(UnmanagedType.BStr)> Public usr_title As String
<MarshalAs(UnmanagedType.BStr)> Public usr_password As String
<MarshalAs(UnmanagedType.BStr)> Public usr_securitylevel As String
<MarshalAs(UnmanagedType.VariantBool)> Public usr_quoteflag As Boolean
<MarshalAs(UnmanagedType.BStr)> Public usr_phone As String
<MarshalAs(UnmanagedType.BStr)> Public usr_fax As String
<MarshalAs(UnmanagedType.BStr)> Public usr_emailaddress As String
Public usr_adddatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public usr_adduser As String
<MarshalAs(UnmanagedType.BStr)> Public usr_addprog As String
Public usr_lmdatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public usr_lmuser As String
<MarshalAs(UnmanagedType.BStr)> Public usr_lmprog As String
<MarshalAs(UnmanagedType.VariantBool)> Public usr_inactive As Boolean

Private Const FieldCount As Integer = 15

Public ReadOnly Property iFieldCount() As Integer Implements BaseClassStructure.iFieldCount


Get
Return FieldCount
End Get
End Property

'Pass the field index # to get the data type


Public Function GetFieldType(ByVal indx As Integer) As String Implements
BaseClassStructure.GetFieldType

Select Case indx


Case 0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 13, 14
Return s_string
Case 9, 12
Return d_date
Case 5, 15
Return bool_boolean
End Select

End Function

'Pass the field index # current value present in the control to be set into the data field
Public Function setValue(ByVal indx As Integer, ByVal sVal As String) Implements
BaseClassStructure.setValue

Select Case indx


Case 0
usr_userid = sVal
Case 1
usr_name = sVal
Case 2
usr_title = sVal
Case 3
usr_password = sVal
Case 4
usr_securitylevel = sVal
Case 5
usr_quoteflag = CBool(sVal)
Case 6
usr_phone = sVal
Case 7
usr_fax = sVal
Case 8
usr_emailaddress = sVal
Case 9
usr_adddatetime = CDate(sVal)
Case 10
usr_adduser = sVal
Case 11
usr_addprog = sVal
Case 12
usr_lmdatetime = CDate(sVal)
Case 13
usr_lmuser = sVal
Case 14
usr_lmprog = sVal
Case 15
usr_inactive = CBool(sVal)

End Select

End Function

'Pass the field index # to get the value of the field


Public Function getFieldValue(ByVal indx As Integer) As String Implements
BaseClassStructure.getFieldValue
Select Case indx
Case 0
getFieldValue = usr_userid
Case 1
getFieldValue = usr_name
Case 2
getFieldValue = usr_title
Case 3
getFieldValue = usr_password
Case 4
getFieldValue = usr_securitylevel
Case 5
getFieldValue = usr_quoteflag
Case 6
getFieldValue = usr_phone
Case 7
getFieldValue = usr_fax
Case 8
getFieldValue = usr_emailaddress
Case 9
getFieldValue = usr_adddatetime
Case 10
getFieldValue = usr_adduser
Case 11
getFieldValue = usr_addprog
Case 12
getFieldValue = usr_lmdatetime
Case 13
getFieldValue = usr_lmuser
Case 14
getFieldValue = usr_lmprog
Case 15
getFieldValue = usr_inactive
End Select

End Function
End Structure ' End of UserDB Structure declaration
'-------------------------------
' Inventory Database Structure
'-------------------------------
'Constants for the CreatorID and TypeID
Public Const inventory_CreatorID As Integer = &H49525350
Public Const inventory_TypeID As Integer = &H44415441

'Global variable to store the database handle


Public dbinventory As Integer

'Enumerated Fields to get access to the converted database Fields


Public Enum tinventoryDatabaseFields
inv_eqpid_Field = 0
inv_trannumber_Field = 1
inv_asidnumber_Field = 2
inv_commcode_Field = 3
inv_commvalue1_Field = 4
inv_commvalue2_Field = 5
inv_commvalue3_Field = 6
inv_commvalue4_Field = 7
inv_commvalue5_Field = 8
inv_commvalue6_Field = 9
inv_shortdesc_Field = 10
inv_qty_Field = 11
inv_uomcode_Field = 12
inv_dateavail_Field = 13
inv_status_Field = 14
inv_where_Field = 15
inv_newused_Field = 16
inv_condition_Field = 17
inv_serialnumber_Field = 18
inv_assettag_Field = 19
inv_spareparts_Field = 20
inv_dwgsmanuals_Field = 21
inv_scrapcode_Field = 22
inv_manufacturer_Field = 23
inv_mfgmodelno_Field = 24
inv_constmatl_Field = 25
inv_disposalcode_Field = 26
inv_dimensions_Field = 27
inv_weight_Field = 28
inv_msds_Field = 29
inv_longdesc_Field = 30
inv_loccode_Field = 31
inv_locemail_Field = 32
inv_spare_Field = 33
inv_locname_Field = 34
inv_locphone_Field = 35
inv_locfax_Field = 36
inv_datepurchased_Field = 37
inv_originalcost_Field = 38
inv_spare1_Field = 39
inv_totalcost_Field = 40
inv_nbv_Field = 41
inv_assetnumber_Field = 42
inv_askingprice_Field = 43
inv_lowestprice_Field = 44
inv_recordstatus_Field = 45
inv_webenabled_Field = 46
inv_activequote_Field = 47
inv_historyquote_Field = 48
inv_invtag_Field = 49
inv_consignmentcode_Field = 50
inv_consignmentemail_Field = 51
inv_consignmentcontact_Field = 52
inv_consignmentphone_Field = 53
inv_consignmentfax_Field = 54
inv_foreigncurr_Field = 55
inv_conversionfactor_Field = 56
inv_foreigncost_Field = 57
inv_foreignnbv_Field = 58
inv_edo_Field = 59
inv_liferemain_Field = 60
inv_yearcap_Field = 61
inv_taxvalue_Field = 62
inv_orifreight_Field = 63
inv_oriinstall_Field = 64
inv_moa_Field = 65
inv_noupdate_Field = 66
inv_webspecial_Field = 67
inv_transactionlocks_Field = 68
inv_bidlocks_Field = 69
inv_notes_Field = 70
inv_adddatetime_Field = 71
inv_adduser_Field = 72
inv_addprog_Field = 73
inv_lmdatetime_Field = 74
inv_lmuser_Field = 75
inv_lmprog_Field = 76
inv_divcode_Field = 77
inv_flag_Field = 78
inv_img_Field = 79
End Enum
' Inventory DB implements BaseClassStructure
<StructLayout(LayoutKind.Sequential, Pack:=4)> _
Public Structure tinventoryRecord : Implements BaseClassStructure 'implements
BaseClassStructure interface
Public inv_eqpid As Double
Public inv_trannumber As Double
<MarshalAs(UnmanagedType.BStr)> Public inv_asidnumber As String
<MarshalAs(UnmanagedType.BStr)> Public inv_commcode As String
<MarshalAs(UnmanagedType.BStr)> Public inv_commvalue1 As String
<MarshalAs(UnmanagedType.BStr)> Public inv_commvalue2 As String
<MarshalAs(UnmanagedType.BStr)> Public inv_commvalue3 As String
<MarshalAs(UnmanagedType.BStr)> Public inv_commvalue4 As String
<MarshalAs(UnmanagedType.BStr)> Public inv_commvalue5 As String
<MarshalAs(UnmanagedType.BStr)> Public inv_commvalue6 As String
<MarshalAs(UnmanagedType.BStr)> Public inv_shortdesc As String
Public inv_qty As Double
<MarshalAs(UnmanagedType.BStr)> Public inv_uomcode As String
Public inv_dateavail As Date
<MarshalAs(UnmanagedType.BStr)> Public inv_status As String
<MarshalAs(UnmanagedType.BStr)> Public inv_where As String
<MarshalAs(UnmanagedType.BStr)> Public inv_newused As String
<MarshalAs(UnmanagedType.BStr)> Public inv_condition As String
<MarshalAs(UnmanagedType.BStr)> Public inv_serialnumber As String
<MarshalAs(UnmanagedType.BStr)> Public inv_spareparts As String
<MarshalAs(UnmanagedType.BStr)> Public inv_assettag As String
<MarshalAs(UnmanagedType.BStr)> Public inv_dwgsmanuals As String
<MarshalAs(UnmanagedType.BStr)> Public inv_scrapcode As String
<MarshalAs(UnmanagedType.BStr)> Public inv_manufacturer As String
<MarshalAs(UnmanagedType.BStr)> Public inv_mfgmodelno As String
<MarshalAs(UnmanagedType.BStr)> Public inv_constmatl As String
<MarshalAs(UnmanagedType.BStr)> Public inv_disposalcode As String
<MarshalAs(UnmanagedType.BStr)> Public inv_dimensions As String
Public inv_weight As Double
<MarshalAs(UnmanagedType.BStr)> Public inv_msds As String
<MarshalAs(UnmanagedType.BStr)> Public inv_longdesc As String
<MarshalAs(UnmanagedType.BStr)> Public inv_loccode As String
<MarshalAs(UnmanagedType.BStr)> Public inv_locemail As String
<MarshalAs(UnmanagedType.BStr)> Public inv_spare As String
<MarshalAs(UnmanagedType.BStr)> Public inv_locname As String
<MarshalAs(UnmanagedType.BStr)> Public inv_locphone As String
<MarshalAs(UnmanagedType.BStr)> Public inv_locfax As String
Public inv_datepurchased As Date
'Since AppForge Has Not Support For Long So Cost field i.e. Field no.38
'is converted into Double
'Public inv_originalcost As Long
Public inv_originalcost As Double

<MarshalAs(UnmanagedType.BStr)> Public inv_spare1 As String


Public inv_totalcost As Double
Public inv_nbv As Double
<MarshalAs(UnmanagedType.BStr)> Public inv_assetnumber As String
Public inv_askingprice As Double
Public inv_lowestprice As Double
<MarshalAs(UnmanagedType.BStr)> Public inv_recordstatus As String
<MarshalAs(UnmanagedType.VariantBool)> Public inv_webenabled As Boolean
<MarshalAs(UnmanagedType.BStr)> Public inv_activequote As String
<MarshalAs(UnmanagedType.BStr)> Public inv_historyquote As String
<MarshalAs(UnmanagedType.BStr)> Public inv_invtag As String
<MarshalAs(UnmanagedType.BStr)> Public inv_consignmentcode As String
<MarshalAs(UnmanagedType.BStr)> Public inv_consignmentemail As String
<MarshalAs(UnmanagedType.BStr)> Public inv_consignmentcontact As String
<MarshalAs(UnmanagedType.BStr)> Public inv_consignmentphone As String
<MarshalAs(UnmanagedType.BStr)> Public inv_consignmentfax As String
<MarshalAs(UnmanagedType.BStr)> Public inv_foreigncurr As String
Public inv_conversionfactor As Double
Public inv_foreigncost As Double
Public inv_foreignnbv As Double
<MarshalAs(UnmanagedType.BStr)> Public inv_edo As String
Public inv_liferemain As Double
Public inv_yearcap As Double
Public inv_taxvalue As Double
Public inv_orifreight As Double
Public inv_oriinstall As Double
Public inv_moa As Double
<MarshalAs(UnmanagedType.VariantBool)> Public inv_noupdate As Boolean
<MarshalAs(UnmanagedType.VariantBool)> Public inv_webspecial As Boolean
<MarshalAs(UnmanagedType.BStr)> Public inv_transactionlocks As String
<MarshalAs(UnmanagedType.BStr)> Public inv_bidlocks As String
<MarshalAs(UnmanagedType.BStr)> Public inv_notes As String
Public inv_adddatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public inv_adduser As String
<MarshalAs(UnmanagedType.BStr)> Public inv_addprog As String
Public inv_lmdatetime As Date
<MarshalAs(UnmanagedType.BStr)> Public inv_lmuser As String
<MarshalAs(UnmanagedType.BStr)> Public inv_lmprog As String
<MarshalAs(UnmanagedType.BStr)> Public inv_divcode As String
<MarshalAs(UnmanagedType.VariantBool)> Public inv_flag As Boolean
<MarshalAs(UnmanagedType.BStr)> Public inv_img As String
'Public Const iFieldCount = 79 'Total # of fields
Private Const FieldCount As Integer = 79

Public ReadOnly Property iFieldCount() As Integer Implements BaseClassStructure.iFieldCount


Get
Return FieldCount
End Get

End Property

'Pass the field index # to get the data type


Public Function GetFieldType(ByVal indx As Integer) As String Implements
BaseClassStructure.GetFieldType

Select Case indx


Case 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30,
31, 32, 33, 34, 35, 36, 39, 42, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 59, 68, 69, 70, 72, 73, 75, 76, 77, 79
Return s_string
Case 13, 37, 71, 74
Return d_date
Case 46, 66, 67, 78
Return bool_boolean
Case 0, 1, 11, 28, 38, 40, 41, 43, 44, 56, 57, 58, 60, 61, 62, 63, 64, 65
Return dbl_double
'Since AppForge Has Not Support For Long So Cost field i.e. Field no.38
'is converted into Double
'Case 38
'Return l_long
End Select

End Function
'Pass the field index # current value present in the control to be set into the data field
Public Function setValue(ByVal indx As Integer, ByVal sVal As String) Implements
BaseClassStructure.setValue

Select Case indx


Case 0
inv_eqpid = CDbl(sVal)
Case 1
inv_trannumber = CDbl(sVal)
Case 2
inv_asidnumber = sVal
Case 3
inv_commcode = sVal
Case 4
inv_commvalue1 = sVal
Case 5
inv_commvalue2 = sVal
Case 6
inv_commvalue3 = sVal
Case 7
inv_commvalue4 = sVal
Case 8
inv_commvalue5 = sVal
Case 9
inv_commvalue6 = sVal
Case 10
inv_shortdesc = sVal
Case 11
inv_qty = CDbl(sVal)
Case 12
inv_uomcode = sVal
Case 13
inv_dateavail = CDate(sVal)
Case 14
inv_status = sVal
Case 15
inv_where = sVal
Case 16
inv_newused = sVal
Case 17
inv_condition = sVal
Case 18
inv_serialnumber = sVal
Case 19
inv_assettag = sVal
Case 20
inv_spareparts = sVal
Case 21
inv_dwgsmanuals = sVal
Case 22
inv_scrapcode = sVal
Case 23
inv_manufacturer = sVal
Case 24
inv_mfgmodelno = sVal
Case 25
inv_constmatl = sVal
Case 26
inv_disposalcode = sVal
Case 27
inv_dimensions = sVal
Case 28
inv_weight = CDbl(sVal)
Case 29
inv_msds = sVal
Case 30
inv_longdesc = sVal
Case 31
inv_loccode = sVal
Case 32
inv_locemail = sVal
Case 33
inv_spare = sVal
Case 34
inv_locname = sVal
Case 35
inv_locphone = sVal
Case 36
inv_locfax = sVal
Case 37
inv_datepurchased = CDate(sVal)
Case 38
inv_originalcost = CDbl(sVal)
Case 39
inv_spare1 = sVal
Case 40
inv_totalcost = CDbl(sVal)
Case 41
inv_nbv = CDbl(sVal)
Case 42
inv_assetnumber = sVal
Case 43
inv_askingprice = CDbl(sVal)
Case 44
inv_lowestprice = CDbl(sVal)
Case 45
inv_recordstatus = sVal
Case 46
inv_webenabled = CBool(sVal)
Case 47
inv_activequote = sVal
Case 48
inv_historyquote = sVal
Case 49
inv_invtag = sVal
Case 50
inv_consignmentcode = sVal
Case 51
inv_consignmentemail = sVal
Case 52
inv_consignmentcontact = sVal
Case 53
inv_consignmentphone = sVal
Case 54
inv_consignmentfax = sVal
Case 55
inv_foreigncurr = sVal
Case 56
inv_conversionfactor = CDbl(sVal)
Case 57
inv_foreigncost = CDbl(sVal)
Case 58
inv_foreignnbv = CDbl(sVal)
Case 59
inv_edo = sVal
Case 60
inv_liferemain = CDbl(sVal)
Case 61
inv_yearcap = CDbl(sVal)
Case 62
inv_taxvalue = CDbl(sVal)
Case 63
inv_orifreight = CDbl(sVal)
Case 64
inv_oriinstall = CDbl(sVal)
Case 65
inv_moa = CDbl(sVal)
Case 66
inv_noupdate = CBool(sVal)
Case 67
inv_webspecial = CBool(sVal)
Case 68
inv_transactionlocks = sVal
Case 69
inv_bidlocks = sVal
Case 70
inv_notes = sVal
Case 71
inv_adddatetime = CDate(sVal)
Case 72
inv_adduser = sVal
Case 73
inv_addprog = sVal
Case 74
inv_lmdatetime = CDate(sVal)
Case 75
inv_lmuser = sVal
Case 76
inv_lmprog = sVal
Case 77
inv_divcode = sVal
Case 78
inv_flag = sVal
Case 79
inv_img = sVal

End Select
End Function
'Pass the field index # to get the value of the field
Public Function getFieldValue(ByVal indx As Integer) As String Implements
BaseClassStructure.getFieldValue

Select Case indx


Case 0

getFieldValue = CStr(CInt(inv_eqpid))

Case 1
getFieldValue = CStr(CInt(inv_trannumber))
Case 2
getFieldValue = inv_asidnumber
Case 3
getFieldValue = inv_commcode
Case 4
getFieldValue = inv_commvalue1
Case 5
getFieldValue = inv_commvalue2
Case 6
getFieldValue = inv_commvalue3
Case 7
getFieldValue = inv_commvalue4
Case 8
getFieldValue = inv_commvalue5
Case 9
getFieldValue = inv_commvalue6
Case 10
getFieldValue = inv_shortdesc
Case 11
getFieldValue = CStr(CInt(inv_qty))
Case 12
getFieldValue = inv_uomcode
Case 13
getFieldValue = inv_dateavail
Case 14
getFieldValue = inv_status
Case 15
getFieldValue = inv_where
Case 16
getFieldValue = inv_newused
Case 17
getFieldValue = inv_condition
Case 18
getFieldValue = inv_serialnumber
Case 19
getFieldValue = inv_assettag
Case 20
getFieldValue = inv_spareparts
Case 21
getFieldValue = inv_dwgsmanuals
Case 22
getFieldValue = inv_scrapcode
Case 23
getFieldValue = inv_manufacturer
Case 24
getFieldValue = inv_mfgmodelno
Case 25
getFieldValue = inv_constmatl
Case 26
getFieldValue = inv_disposalcode
Case 27
getFieldValue = inv_dimensions
Case 28
getFieldValue = CStr(CInt(inv_weight))
Case 29
getFieldValue = inv_msds
Case 30
getFieldValue = inv_longdesc
Case 31
getFieldValue = inv_loccode
Case 32
getFieldValue = inv_locemail
Case 33
getFieldValue = inv_spare
Case 34
getFieldValue = inv_locname
Case 35
getFieldValue = inv_locphone
Case 36
getFieldValue = inv_locfax
Case 37
getFieldValue = inv_datepurchased
Case 38
getFieldValue = CStr(CInt(inv_originalcost))
Case 39
getFieldValue = inv_spare1
Case 40
getFieldValue = CStr(CInt(inv_totalcost))
Case 41
getFieldValue = CStr(CInt(inv_nbv))
Case 42
getFieldValue = inv_assetnumber
Case 43
getFieldValue = CStr(CInt(inv_askingprice))
Case 44
getFieldValue = CStr(CInt(inv_lowestprice))
Case 45
getFieldValue = inv_recordstatus
Case 46
getFieldValue = inv_webenabled
Case 47
getFieldValue = inv_activequote
Case 48
getFieldValue = inv_historyquote
Case 49
getFieldValue = inv_invtag
Case 50
getFieldValue = inv_consignmentcode
Case 51
getFieldValue = inv_consignmentemail
Case 52
getFieldValue = inv_consignmentcontact
Case 53
getFieldValue = inv_consignmentphone
Case 54
getFieldValue = inv_consignmentfax
Case 55
getFieldValue = inv_foreigncurr
Case 56
getFieldValue = CStr(CInt(inv_conversionfactor))
Case 57
getFieldValue = CStr(CInt(inv_foreigncost))
Case 58
getFieldValue = CStr(CInt(inv_foreignnbv))
Case 59
getFieldValue = inv_edo
Case 60
getFieldValue = CStr(CInt(inv_liferemain))
Case 61
getFieldValue = CStr(CInt(inv_yearcap))
Case 62
getFieldValue = CStr(CInt(inv_taxvalue))
Case 63
getFieldValue = CStr(CInt(inv_orifreight))
Case 64
getFieldValue = CStr(CInt(inv_oriinstall))
Case 65
getFieldValue = inv_moa
Case 66
getFieldValue = CStr(inv_noupdate)
Case 67
getFieldValue = inv_webspecial
Case 68
getFieldValue = inv_transactionlocks
Case 69
getFieldValue = inv_bidlocks
Case 70
getFieldValue = inv_notes
Case 71
getFieldValue = inv_adddatetime
Case 72
getFieldValue = inv_adduser
Case 73
getFieldValue = inv_addprog
Case 74
getFieldValue = inv_lmdatetime
Case 75
getFieldValue = inv_lmuser
Case 76
getFieldValue = inv_lmprog
Case 77
getFieldValue = inv_divcode
Case 78
getFieldValue = inv_flag
Case 79
getFieldValue = inv_img

End Select

End Function

End Structure

End Module
Utility.vb

Option Explicit On

Module Utility

'Form Objects
Public g_objLogin As New frmLogin

Public g_objMain As frmMain

Public g_objDate As frmDate


Public g_objItem As frmItemDetails
Public g_objQty As frmQuantity
Public g_objMat As frmMaterialDetails
Public g_objManu As frmManufactDetails
Public g_objLoc As frmLocation
Public g_objConsign As frmConsignment
Public g_objCurrency As frmCurrency
Public g_objCost As frmCostDetails

' Lookup objects

Public g_objEqptList As frmEqptList


Public g_objLocList As frmLocationList
Public g_objConsignList As frmConsignLocList
Public g_objCommList As frmCommodityList
Public g_objUOMList As frmUomList

'Global variables
Public g_Inventory_mode As String
Public g_Last_Screen As String
Public g_ItemNo As Double

'Database Constants
Public Const InvDBName = "inventory"
Public Const UsrDBName = "user"
Public Const UomDBName = "uom"
Public Const LocDBName = "location"
Public Const CommDBName = "commodity"

'Database Object
Public objData As DataBase

'FontType Variables
Public iFontHandle_DeviceDefault As Integer
Public iFontHandle_Small As Integer
Public iFontHandle_Small_Bold As Integer
Public iFontHandle_Medium As Integer
Public iFontHandle_Medium_Bold As Integer
Public iFontHandle_Large As Integer
Public iFontHandle_Large_Bold As Integer
'--------------------------------------------------------------------------------------
'Key press constants
Public Const vchrMenu = &H105 ' Menu button
Public Const vchrLaunch = &H108 ' Launch button (home key)
Public Const vchrKeyboard = &H109 ' Request to pop-up keyboard
Public Const vchrFind = &H10A ' Find button
Public Const vchrCalc = &H10B ' Calculator buttons
Public Const vchrKeyboardAlpha = &H110 ' Alpha-keyboard button
Public Const vchrKeyboardNumeric = &H111 ' Number-keyboard button
Public Const vchrHard1 = &H204 ' Leftmost hard key ' (usually Calendar)
Public Const vchrHard2 = &H205 ' Center-left hard key ' (usually PhoneBook)
Public Const vchrHard3 = &H206 ' Center-right hard key ' (usually To Do)
Public Const vchrHard4 = &H207 ' Rightmost hard key ' (usually Memo)
Public Const vchrHardPower = &H208 ' Power button
Public Const vchrHardCradle = &H209 ' Cradle button (HotSync)
Public Const vchrHardContrast = &H20B ' Contrast button
Public Const vchrHardAntenna = &H20C ' Antenna switch

#If APPTYPE = "PPC" Then


'Pocket PC keys (differ depending on device)
Public Const VK_APP_LAUNCH1 As Long = &HC1
Public Const VK_APP_LAUNCH2 As Long = &HC2
Public Const VK_APP_LAUNCH3 As Long = &HC3
Public Const VK_APP_LAUNCH4 As Long = &HC4
Public Const VK_APP_LAUNCH5 As Long = &HC5
Public Const VK_APP_LAUNCH6 As Long = &HC6
Public Const VK_APP_LAUNCH7 As Long = &HC7
Public Const VK_APP_LAUNCH8 As Long = &HC8
Public Const VK_APP_LAUNCH9 As Long = &HC9
Public Const VK_APP_LAUNCH10 As Long = &HCA
Public Const VK_APP_LAUNCH11 As Long = &HCB
Public Const VK_APP_LAUNCH12 As Long = &HCC
Public Const VK_APP_LAUNCH13 As Long = &HCD
Public Const VK_APP_LAUNCH14 As Long = &HCE
Public Const VK_APP_LAUNCH15 As Long = &HCF
#End If
'---------------------------------------------------------------------------------------
'Setting the Launch path
#If APPTYPE = "PDA" Then
Public g_appPath As String = "D:\IRSPDA\Database\PDB"
#End If

#If APPTYPE = "PPC" Then


Public g_appPath As String = "\Program Files\AppForge Projects\IRSPDA"
#End If

' Myshell for graphics functionality


Public myShell As New AppForge.Shell

'Color Constants
Public lCOLOR_HIGHLIGHT As Integer
Public lCOLOR_HIGHLIGHTTEXT As Integer
Public lCOLOR_WINDOWBKG As Integer
Public lCOLOR_WINDOWTEXT As Integer

Public Const iBUFFER_X As Integer = 3


Public Const iBUFFER_Y As Integer = 3

Public Function fGetStringHeight(ByVal iFontHandle As Integer) As Short


Dim myShell As New AppForge.Shell
Dim siWidth As Short
Dim siHeight As Short
myShell.FontManager.GetStringBounds(iFontHandle, "", 0, -1, siWidth, siHeight)
fGetStringHeight = siHeight
End Function

'Load Form method to show the Form


Public Sub LoadForm(ByVal objFrm As Form)

objFrm.Show()

End Sub

' Register Keys


Public Sub RegisterKeys()

AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrMenu)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrLaunch)
'AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrKeyboard)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrFind)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrCalc)
'AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrKeyboardAlpha)
'AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrKeyboardNumeric)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrHard1)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrHard2)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrHard3)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrHard4)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrHardPower)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrHardCradle)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrHardContrast)
AppForge.MobileVB.Compatibility.Device.RegisterKeyCode(vchrHardAntenna)

End Sub

' Release Keys


Public Sub ReleaseKeys()

AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrMenu)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrLaunch)
'AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrKeyboard)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrFind)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrCalc)
'AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrKeyboardAlpha)
'AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrKeyboardNumeric)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrHard1)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrHard2)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrHard3)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrHard4)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrHardPower)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrHardCradle)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrHardContrast)
AppForge.MobileVB.Compatibility.Device.ReleaseKeyCode(vchrHardAntenna)

End Sub
' Database Functions
Public Function OpenAllDatabase() As Boolean
'MsgBox("in open database")
Try
objData = New DataBase

objData.OpenDatabase("inventory")
objData.OpenDatabase("location")
objData.OpenDatabase("uom")
objData.OpenDatabase("commodity")
objData.OpenDatabase("user")

Return True

Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
Return False
End Try

End Function

Public Function CloseAllDatabase() As Boolean

Try

objData.CloseDatabase("inventory")

objData.CloseDatabase("user")

objData.CloseDatabase("location")

objData.CloseDatabase("uom")

objData.CloseDatabase("commodity")

Return True
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
Return False
End Try

End Function

Public Sub DestroyObject()

g_objMain = Nothing
g_objEqptList = Nothing
g_objLocList = Nothing
g_objConsignList = Nothing
g_objCommList = Nothing
g_objUOMList = Nothing

End Sub
#Region "Properties"

#Region "frmItemDetails"

Private pi_strAsset As String


Public Property Asset() As String
Get
Return pi_strAsset
End Get
Set(ByVal Value As String)
pi_strAsset = Value
End Set
End Property

Private pi_strCommCode As String


Public Property CommodityCode() As String
Get
Return pi_strCommCode
End Get
Set(ByVal Value As String)
pi_strCommCode = Value
End Set
End Property

Private pi_strCommDesc As String


Public Property CommodityDesc() As String
Get
Return pi_strCommDesc
End Get
Set(ByVal Value As String)
pi_strCommDesc = Value
End Set
End Property
Private pi_strCommCode1 As String
Public Property CommodityCode1() As String
Get
Return pi_strCommCode1
End Get
Set(ByVal Value As String)
pi_strCommCode1 = Value
End Set
End Property
Private pi_strCommCode2 As String
Public Property CommodityCode2() As String
Get
Return pi_strCommCode2
End Get
Set(ByVal Value As String)
pi_strCommCode2 = Value
End Set
End Property
Private pi_strCommCode3 As String
Public Property CommodityCode3() As String
Get
Return pi_strCommCode3
End Get
Set(ByVal Value As String)
pi_strCommCode3 = Value
End Set
End Property
Private pi_strCommCode4 As String
Public Property CommodityCode4() As String
Get
Return pi_strCommCode4
End Get
Set(ByVal Value As String)
pi_strCommCode4 = Value
End Set
End Property
Private pi_strCommCode5 As String
Public Property CommodityCode5() As String
Get
Return pi_strCommCode5
End Get
Set(ByVal Value As String)
pi_strCommCode5 = Value
End Set
End Property
Private pi_strCommCode6 As String
Public Property CommodityCode6() As String
Get
Return pi_strCommCode6
End Get
Set(ByVal Value As String)
pi_strCommCode6 = Value
End Set
End Property
Private pi_strCommDesc1 As String
Public Property CommodityDesc1() As String
Get
Return pi_strCommDesc1
End Get
Set(ByVal Value As String)
pi_strCommDesc1 = Value
End Set
End Property
Private pi_strCommDesc2 As String
Public Property CommodityDesc2() As String
Get
Return pi_strCommDesc2
End Get
Set(ByVal Value As String)
pi_strCommDesc2 = Value
End Set
End Property
Private pi_strCommDesc3 As String
Public Property CommodityDesc3() As String
Get
Return pi_strCommDesc3
End Get
Set(ByVal Value As String)
pi_strCommDesc3 = Value
End Set
End Property
Private pi_strCommDesc4 As String
Public Property CommodityDesc4() As String
Get
Return pi_strCommDesc4
End Get
Set(ByVal Value As String)
pi_strCommDesc4 = Value
End Set
End Property
Private pi_strCommDesc5 As String
Public Property CommodityDesc5() As String
Get
Return pi_strCommDesc5
End Get
Set(ByVal Value As String)
pi_strCommDesc5 = Value
End Set
End Property
Private pi_strCommDesc6 As String
Public Property CommodityDesc6() As String
Get
Return pi_strCommDesc6
End Get
Set(ByVal Value As String)
pi_strCommDesc6 = Value
End Set
End Property

#End Region

#Region "frmQuantity"

Private intQty As Integer


Public Property Quantity() As Integer
Get
Return intQty
End Get
Set(ByVal Value As Integer)
intQty = Value
End Set
End Property

Private strUOM As String


Public Property UOM() As String
Get
Return strUOM
End Get
Set(ByVal Value As String)
strUOM = Value
End Set
End Property
Private strSrtDesc As String
Public Property ShortDescription() As String
Get
Return strSrtDesc
End Get
Set(ByVal Value As String)
strSrtDesc = Value
End Set
End Property
Private dtAvail As Date
Public Property DateAvail() As Date
Get
Return dtAvail
End Get
Set(ByVal Value As Date)
dtAvail = Value
End Set
End Property

#End Region

#Region "frmMaterialDetails"
Private pi_strMaterialConstruct As String
Public Property MaterialConstruct() As String
Get
Return pi_strMaterialConstruct
End Get
Set(ByVal Value As String)
pi_strMaterialConstruct = Value
End Set
End Property
Private pi_strStorageLoc As String
Public Property StorageLocation() As String
Get
Return pi_strStorageLoc
End Get
Set(ByVal Value As String)
pi_strStorageLoc = Value
End Set
End Property
Private pi_strSpareParts As String
Public Property SpareParts() As String
Get
Return pi_strSpareParts
End Get
Set(ByVal Value As String)
pi_strSpareParts = Value
End Set
End Property
Private pi_strScopeRef As String
Public Property ScopeReference() As String
Get
Return pi_strScopeRef
End Get
Set(ByVal Value As String)
pi_strScopeRef = Value
End Set
End Property
Private pi_strDwags As String
Public Property Dwags() As String
Get
Return pi_strDwags
End Get
Set(ByVal Value As String)
pi_strDwags = Value
End Set
End Property
Private pi_intStatus As Integer
Public Property Status() As Integer
Get
Return pi_intStatus
End Get
Set(ByVal Value As Integer)
pi_intStatus = Value
End Set
End Property
Private pi_intWhere As Integer
Public Property Where() As Integer
Get
Return pi_intWhere
End Get
Set(ByVal Value As Integer)
pi_intWhere = Value
End Set
End Property
Private pi_intCondition As Integer
Public Property Condition() As Integer
Get
Return pi_intCondition
End Get
Set(ByVal Value As Integer)
pi_intCondition = Value
End Set
End Property
#End Region

#Region "frmManufactDetails"
Private pi_strManuf As String
Public Property Manufacturer() As String
Get
Return pi_strManuf
End Get
Set(ByVal Value As String)
pi_strManuf = Value
End Set
End Property
Private pi_strSerial As String
Public Property Serial() As String
Get
Return pi_strSerial
End Get
Set(ByVal Value As String)
pi_strSerial = Value
End Set
End Property
Private pi_intNewUsed As Integer
Public Property NewUsed() As Integer
Get
Return pi_intNewUsed
End Get
Set(ByVal Value As Integer)
pi_intNewUsed = Value
End Set
End Property
Private pi_strDimension As String
Public Property Dimension() As String
Get
Return pi_strDimension
End Get
Set(ByVal Value As String)
pi_strDimension = Value
End Set
End Property
Private pi_strParts As String
Public Property Parts() As String
Get
Return pi_strParts
End Get
Set(ByVal Value As String)
pi_strParts = Value
End Set
End Property
Private pi_strWeight As Double
Public Property Weight() As Double
Get
Return pi_strWeight
End Get
Set(ByVal Value As Double)
pi_strWeight = Value
End Set
End Property
Private pi_strMfgNo As String
Public Property MfgNo() As String
Get
Return pi_strMfgNo
End Get
Set(ByVal Value As String)
pi_strMfgNo = Value
End Set
End Property
Private pi_intDispCode As Integer
Public Property DisplayCode() As String
Get
Return pi_intDispCode
End Get
Set(ByVal Value As String)
pi_intDispCode = Value
End Set
End Property
Private pi_strLongDesc As String
Public Property LongDescription() As String
Get
Return pi_strLongDesc
End Get
Set(ByVal Value As String)
pi_strLongDesc = Value
End Set
End Property

#End Region

#Region "frmLocation"
Private pi_strLocationCode As String
Public Property LocationCode() As String
Get
Return pi_strLocationCode
End Get
Set(ByVal Value As String)
pi_strLocationCode = Value
End Set
End Property
Private pi_strLocDesc As String
Public Property LocationDecription() As String
Get
Return pi_strLocDesc
End Get
Set(ByVal Value As String)
pi_strLocDesc = Value
End Set
End Property
Private pi_strLocContact As String
Public Property LocationContact() As String
Get
Return pi_strLocContact
End Get
Set(ByVal Value As String)
pi_strLocContact = Value
End Set
End Property
Private pi_strLocPhone As String
Public Property LocationPhone() As String
Get
Return pi_strLocPhone
End Get
Set(ByVal Value As String)
pi_strLocPhone = Value
End Set
End Property
Private pi_strLocFax As String
Public Property LocationFax() As String
Get
Return pi_strLocFax
End Get
Set(ByVal Value As String)
pi_strLocFax = Value
End Set
End Property
Private pi_strLocEmail As String
Public Property LocationEmail() As String
Get
Return pi_strLocEmail
End Get
Set(ByVal Value As String)
pi_strLocEmail = Value
End Set
End Property
#End Region

#Region "frmConsignMent"
Private pi_strConsignCode As String
Public Property ConsignMentCode() As String
Get
Return pi_strConsignCode
End Get
Set(ByVal Value As String)
pi_strConsignCode = Value
End Set
End Property
Private pi_strConsignDesc As String
Public Property ConsignMentDesc() As String
Get
Return pi_strConsignDesc
End Get
Set(ByVal Value As String)
pi_strConsignDesc = Value
End Set
End Property

Private pi_strConsignContact As String


Public Property ConsignMentContact() As String
Get
Return pi_strConsignContact
End Get
Set(ByVal Value As String)
pi_strConsignContact = Value
End Set
End Property

Private pi_strConsignPhone As String


Public Property ConsignMentPhone() As String
Get
Return pi_strConsignPhone
End Get
Set(ByVal Value As String)
pi_strConsignPhone = Value
End Set
End Property

Private pi_strConsignFax As String


Public Property ConsignMentFax() As String
Get
Return pi_strConsignFax
End Get
Set(ByVal Value As String)
pi_strConsignFax = Value
End Set
End Property

Private pi_strConsignEmail As String


Public Property ConsignMentEmail() As String
Get
Return pi_strConsignEmail
End Get
Set(ByVal Value As String)
pi_strConsignEmail = Value
End Set
End Property

#End Region

#Region "frmCurrency"
Private pi_intForCurr As String
Public Property ForeignCurrency() As String
Get
Return pi_intForCurr
End Get
Set(ByVal Value As String)
pi_intForCurr = Value
End Set
End Property
Private pi_intConFact As Double
Public Property ConversionFactor() As Double
Get
Return pi_intConFact
End Get
Set(ByVal Value As Double)
pi_intConFact = Value
End Set
End Property
Private pi_intForCost As Double
Public Property ForeignCost() As Double
Get
Return pi_intForCost
End Get
Set(ByVal Value As Double)
pi_intForCost = Value
End Set
End Property
Private pi_intForeignNBV As Integer
Public Property NBV() As Integer
Get
Return pi_intForeignNBV
End Get
Set(ByVal Value As Integer)
pi_intForeignNBV = Value
End Set
End Property
Private pi_blnForCurr As Boolean
Public Property isUpdate() As Boolean
Get
Return pi_blnForCurr
End Get
Set(ByVal Value As Boolean)
pi_blnForCurr = Value
End Set
End Property
#End Region

#Region "frmCostDetails"
Private pi_dblCost As Double
Public Property OriginalCost() As Double
Get
Return pi_dblCost
End Get
Set(ByVal Value As Double)
pi_dblCost = Value
End Set
End Property
Private pi_dblTotalCost As Double
Public Property TotalCost() As Double
Get
Return pi_dblTotalCost
End Get
Set(ByVal Value As Double)
pi_dblTotalCost = Value
End Set
End Property
Private pi_dblOrgFrt As Double
Public Property OriginalFrieght() As Double
Get
Return pi_dblOrgFrt
End Get
Set(ByVal Value As Double)
pi_dblOrgFrt = Value
End Set
End Property
Private pi_dblOrgInstall As Double
Public Property OriginalInstall() As Double
Get
Return pi_dblOrgInstall
End Get
Set(ByVal Value As Double)
pi_dblOrgInstall = Value
End Set
End Property
Private pi_dblLifeRemaining As Double
Public Property LifeRemaining() As Double
Get
Return pi_dblLifeRemaining
End Get
Set(ByVal Value As Double)
pi_dblLifeRemaining = Value
End Set
End Property
Private pi_dblYeapCap As Double
Public Property YearCapital() As Double
Get
Return pi_dblYeapCap
End Get
Set(ByVal Value As Double)
pi_dblYeapCap = Value
End Set
End Property
Private pi_dblNBV As Double
Public Property ForeignNBV() As Double
Get
Return pi_dblNBV
End Get
Set(ByVal Value As Double)
pi_dblNBV = Value
End Set
End Property
Private pi_dblTaxValue As Double
Public Property TaxValue() As Double
Get
Return pi_dblTaxValue
End Get
Set(ByVal Value As Double)
pi_dblTaxValue = Value
End Set
End Property
Private pi_dblAskPrc As Double
Public Property AskingPrice() As Double
Get
Return pi_dblAskPrc
End Get
Set(ByVal Value As Double)
pi_dblAskPrc = Value
End Set
End Property
Private pi_dblLowestPrice As Double
Public Property LowestPrice() As Double
Get
Return pi_dblLowestPrice
End Get
Set(ByVal Value As Double)
pi_dblLowestPrice = Value
End Set
End Property
#End Region
#Region "Others"
Private pi_strCondition As Double
Public Property ConditionFactor() As Double
Get
Return pi_strCondition
End Get
Set(ByVal Value As Double)
pi_strCondition = Value
End Set
End Property
#End Region

#End Region

End Module
AssemblyInfo.vb

Imports System.Reflection
Imports System.Runtime.InteropServices

' General Information about an assembly is controlled through the following


' set of attributes. Change these attribute values to modify the information
' associated with an assembly.

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>

'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("250A41AD-F8B1-4B0C-89BA-ECBBD996C2F6")>

' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:

<Assembly: AssemblyVersion("1.0.*")>
Screen Shots
The technical details are for the experts and future extenders, the other things are
always part of every project, more or less. But the part, about which a lay man, a simple user is
concerned about is this present phase; the screen shots ……..

Screen shots… How could you forget to include the screen shots of your project in
your documentation? We are programmer not poet/ writers, who can make a clear picture by
only words for what ever they see, whatever they feel. Obviously, the best presentation is that
need not to speak by its own words, but let the words be played by viewer’s mind itself. A picture
is of course have no alternate in words, that’s why I am about to present what my application
look like, what is the thing for which I feel proud for being made by me.

So, the presentation by picture starts now, one by one ……..

The first screen showing the look on the emulator. Some limitations we have gone through
The login screen in the Investment Recovery System and the message displayed after it.

The menus and interfaces displayed on the emulator


The various interfaces used with in the system

The various interfaces used within the system


The various interfaces used within the system

The data entry phases


The various data entry phases

Currency conversion and Date selection phases


Conclusion
Section 5

In this section
√ Scope of enhancement
√ User Feed back
√ Conclusion
Scope of Enhancement
Finally it’s done and nothing remains to do something to add up in it for future, could
some one say about any project or any assignment. My project is also not extra ordinary.

According to my best knowledge, the best PDA that are available in the market are of
capacity 200 MB or more than it and I worked on just 8 MB and 16 MB devices, of course much
of the world is still remained to be explore.

More over, it is still necessary to come in the server room or to master computer for
submitting their respective entries, it is something like having an excellent staff for doing your
inventory management, but as about our goal, we want to make fully comfortable and constraint-
less. One such option lies in the very popular Blue tooth technology.

As about the Bluetooth, Bluetooth is a wireless technology that enables any electrical device to
wirelessly communicate in the 2.5 GHz ISM (license free) frequency band. It allows devices such
as mobile phones, headsets, PDA's and portable computers to communicate and send data to
each other without the need for wires or cables to link to devices together. It has been specifically
designed as a low cost, low power, radio technology, which is particularly suited to the short
range Personal Area Network (PAN) application. (It is the design focus on low cost, low size
and low power, which distinguishes it from the IEEE 802.11 wireless LAN technology).

What one can think after reading the above description about Bluetooth, why not we
should go for the Bluetooth for the sane goal? No need to have a synchronization cradle, no
need to go in a server room or sending your PDA away from your hand.

This would be an obvious enhancement toward this project. I am willing to take care of
that target but because of the time/money constraints, it was obvious to go with the things that
are available, so that is the present one.

I hope, it will attract the attention of many of my friends towards this era of application.
User Feedback
User; he is ultimate destination, where the success or failure of any product is expected
to be decided. There are a lot of examples of many expensive and highly technical projects that
failed only because of not getting user’s proper anticipation. That’s why before finalizing this
product, it was necessary to take support of a person far away from the programming side of the
project and also has a good knowledge of the system, so he can test the possibilities for which
the product could be a failure.

I asked a technical staff of the company to work with product and to find out the bugs,
of course he reported some bugs initially but that was the sign a good testing skill and it help me
a lot to find out the bugs that I left unconsciously. As my target system was Treo 650, which a
very costly stuff tats why I was constrained to the simulators of the actual product that were
available to me at that time.

So, that may be said the user feedback. Although I have not testing between a lot of
people and a lot of data as the target machine with us was of only 8 MB, but the results were
convincing to anybody that the product would work for the actual machine too, as good as it
works for the simulator.
Conclusion
Definitely I am not starting a brand new thing and there are still many successfully
running products till the date, but it was to just an attempt to utilize my capability to attract
attention of the Indian programmer in his direction. There are obvious limitations in the product
presented by me, but under provided resources, technical helps and a short scale of time, I tried
my best.

Definitely I am looking for more resources to move more into this direction and want to
make a complete product that removes the necessity of putting the PDA on the synchronization
cradle and it is not very much problematic because the target device Treo 650 is also capable of
Bluetooth based data transfer.

The product I presented is now under the investigation of the technical section of my
company to look over the future prospects for making a specialist or generalized product for the
field. I am hoping it will take a good shape in the near future that will also be better for my
carrier aspects.

I hope my efforts for going towards a costly/ unfamiliar but very useful way of
application, in the form of this project will be praised by my educational institution and I will get
a good response from the institution and the industry as well.
Bibliography
Section 6

In this section
√ Bibliography
Bibliography
Taking something entirely new as a project is always problematic as far as the availability
of resources is concerned. I tried and tried to get some good and feasible books for the topic in
India, but either that may be hardly available in India or it is not possible for me to get them in
Delhi, Allahabad or in any other nearest big city.

That’s why I got the material from the websites only and no books for the references. As
about the Microsoft Visual .Net, there are so many books but they are not in the reference of
PDAs or Crossfire 5.0, so I am not mentioning any particular books for that one. I am writing
down some websites for whom I am especially thankful for the respective owners. I am writing
them as technical references in the next paragraph:-

Technical References:-
√ www.AppForge.com
√ www.palm.com
√ www.palmOS.com
√ www.palmsource.com

Vous aimerez peut-être aussi