7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 1/225
Topic Page No.
1. Preface 1
2. Objectives. 3
3. System Analysis 14
4. Feasibility Study 19
• Technical Feasibility 20
• Economical Feasibility 23
• Operational Feasibility 26
5. Software Engineering Paradigm 29
6. Software and Hardware Requirement Specifications 32
7. Program Structure 35
8. System Design 39
• DFDs 56
• Database Design & Normalization 60
9.
Coding 67
10. Code Efficiency 259
11. Optimization of Code 261
12. Output Screens 263
13. Implementation and Maintenance 292
• Testing 297
14. System Security Measures 308
15. Cost Estimation of the Project 310
16. PERT Chart, Gantt Chart 313
17. Future Scope and further enhancement of the Project 317
18. Bibliography 322
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 2/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 3/225
Due to the expantion of computers and its applications from large enterprises to
the personal computers, the productivity of the concerned has been increased many folds.
Today with the development of user-friendly software applications at a reasonable cost
and its subsequent expansion as per the requirement has made many impossible tasks and
complex topics possible with very little efforts. Today with the all round development in
software, user friendly applications require an understanding for related terms such as
intelligence, knowledge, reasoning, thought, cognition, learning and a number of
computer related terms to develop an application which can be used in any required field
with little or no knowledge. An ocean of data, details of complex data, reports and
returns, records and updating with summary details are made available by
AUTOMATION.
The software has been made users friendly where it does not require any
expertise/training in operations. The proposed software has been developed by using
C#.NET as front-end and SQL 2000 as back-end.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 4/225
The objective of this project is to serve the maintain GUN STOCKS to provide better
service to their customers by computerizing their complete process of billing and
customer record related functions. These processes start from manage the stock of Gun
House there are various type of gun avalabe such as Arms,Ammunation and Accessories.
This Software has a part of tally and all expands related to the wappons.
To develop our software, which will be used for projecting sales and revenue for forth
coming years, the following are the main points to be considered:
1. The proposed software is mainly developed for those Gun Houses which are
exclusively dealing with customer oriented product sales.
2. Generalized and customized software, which can be configured for large Gun
Houses as well as small ones.
3. To provide a tool that will monitor the sales team performance and activities that are
carried on regular basis.
4. To make available the analyzed data for orders received for various products during
current/previous years.
Keeping following in view has also evolved the objective of the proposed project:
The Customer (Delar,Suppliers,Parties) details can be
accessed through the DataBase, Party,Suppliers,Prodcutinsert tables respectively.
It should maintain the records of the Stock about gun&wappons,Suppliers,party
Region which is stored in the catagories of wappons.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 5/225
Cash Flow Analysis of the organization.
Prepare the bills for the customers & Receive the payment from the customer.
Calculate the outstanding bills & maintain the information about the receipts.
We maintain the records of the bill, payment, outstand & receipt.
Report generation and printing.
System Administration & Project Security & Security of data.
Evaluate the performance of the system.
Enhancement of Reliability of the system.
Increases the efficiency and effectiveness
Remove the Redundancies
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 6/225
One of the most difficult tasks of system analysis is to develop a clear
understanding of the problem being investigated, without which it becomes impossible to
specify the requirements for a new project with any accuracy. Careful analysis suggests a
number of different problems, the problem of reliability, accuracy, timeliness, validity,
and the problem of economy.
System analysis is an activity conducted with the following objectives:
Identify the customer’s need.
Evaluate the system concept for the feasibility.
Perform economic and technical analysis.
Establish cost and schedule constraints among others.
Identification of the need
For better understanding and assimilation of the proposed project, it is proposed that the
existing manual methods for keeping the various data records of the Organization is
problematic and existing infrastructure are not able to cope up with ever increasing
expansion demand of the Organization. Due to which the profit of the Organization is
reducing and has become the problem for the management. The management has now
decided to address the existing problems of the manual system and decided automization
of the Organization. The adopted system should cover a very broad spectrum of
requirement / concepts which mean an organized relationship among the functioning units
or components to achieve the predetermined goals. An organization combines policies,
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 7/225
personnel, equipment and computer facilities to co-ordinate the activities of an
organization.
The analysis is required to find out exactly what must the system do? During analysis it
attends to develop a complete functional understanding of the proposed system. The
document identifies a number of function or processes, which must be performed by the
system. The objective is to define each of the logical function more correctly.
Basically an organization dealing with various activities represents an organized way of
achieving the predetermined objectives of an organization. For automization the records /
requirements of the Medicos as proposed in this project, the system has been defined
consisting of orderly grouping of inter dependent components linked together. The
component may be simple or complex, basic or advanced. They may be single computers
with a keyboard, memory and printer or a series of intelligent terminals linked to a
mainframe. In either case each component is a part of the total system and has to do its
own share of work for the system to achieve the desired goal. Following characteristics of
a system have been considered for the proposed project: -
Organization Growth:
Organization implies structure and order. It is the arrangement of components that
helps to achieve objectives. In the design of the automization, for example, the
hierarchical relationships starting with the President (owner) on the top and leading
downwards. Accordingly the above system is designed around an input device, a central
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 8/225
processing unit, an output device and one or more storage units. ‘When these units are
linked together, they work as a whole system for generating information.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 9/225
Efficiency in managing business:
An efficient system is a system, which gives us right information at right time. For
e.g. the processing of insertion & leave information of canteen order is very important for
the organization as it helps in structuring the canteen. Resource planning assumes greater
importance and the management would need timely information about organization.
Need to manage business critical functions:
There are various functions, which are very critical to the organization. These critical
functions or business processes need to be run efficiently and effectively so that the
management can focus on process improvements and employee satisfaction. Some of the
functions are very difficult to be monitored manually.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 10/225
Preliminary investigation
The first step in the system development life cycle is the preliminary
investigation. It is the collecting of information that helps the team members in evaluating
the merits of the project request and thus make an informed judgement about the
feasibility of the proposed project.
For this proposed system we have done some preliminary investigation and gathered data
through primary methods.
Reviewing organization documents:
Firstly we have to learn about the organization involved in or affected by the project.
We reviewed the working of the different departments of the organization and who are
the persons directly associated with the departments who are going to interact with the
system.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 11/225
On site observations:
In this process we monitored the office environment, the work load of the system and
the users, methods of work and the facilities provided by the organization to the users.
The purpose of on site observation is to get as specific as possible to the real system being
studied.
Conducting interviews:
The last two techniques tell us how the system should operate, but they do not include
enough details for a decision to be made. We prepared a questionnaire for the users of the
proposed system to learn more about the nature of the project request and the depth to
which users may retrieve information from it. Sometimes we also conducted interviews to
provide details that further explained the project and show whether assistance is merited
economically, operationally and technically.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 12/225
FEASIBILITY STUDY
Preliminary investigation examines project feasibility, the likelihood of the system being
useful to the organization. The feasibility studies may be carried out in three phases:
Technical Feasibility
Operational Feasibility
Economic Feasibility
Technical feasibility:
There are a number of technical issues that are generally raised during the feasibility
stage of the investigation.
Is it technically possible to develop the system?
This Canteen Management system is technically feasible within existing technologies.
The implementation team is well equipped to develop the solution and the management
has agreed to provide the infrastructure need.
Does the proposed system have the technical capacity to hold the data required?
This system is going to hold a large database, which can store as much data as required
by the business. This would hold good for branches and should Canteen Management
System look to open more branches they would need to add hard disks and RAM to scale
up the application.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 13/225
How far the proposed system gives technical guarantees of accuracy, reliability, ease
of access and data security?
This system guarantees the accuracy, reliability, ease of access and security of data at
all times as different validations and retrieval checks will be performed before submitting
or retrieving any information. This would be sufficiently tested and validated during the
testing phase and implementation team would seek a sign off on the functionality of the
system.
Can the system be upgraded?
The scope of the system goes far beyond the expectations because as the organization
grows and the functions grow respectively. Module upgrade is possible as and when the
functioning of any department changes.
Economic feasibility:
Economic analysis is the most frequently used method for evaluating the effectiveness of
a candidate system. More commonly known as cost/benefit analysis, the procedure is to
determine the benefits and savings that are expected from a candidate system and
compare them with costs. If benefits outweight costs, then the decision is made to design
and implement the system. This is an ongoing effort that improves in accuracy at each
phase of the system life cycle.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 14/225
COST-BENEFIT ANALYSIS
Cost-benefit analysis is complicated by criteria that vary with the characteristics of the
system to be developed, the relative size of the project, and the expected return on
investment desired as part of a company’s strategic plan. In addition many benefits
derived from computer-based systems are ignitable (e.g. better design quality through
iterative intimation, increased customer satisfaction through programmable control, and
better business decisions through reformatted and pre-analyzed sales data). Direct
quantities comparisons may be difficulty to achieve. In a nutshell the following steps are
to be followed:
To study the existing system.
To define the scope of the proposed system.
To study the strengths and weakness of the existing system.
To study various alternatives.
To carry out feasibility studies.
To get the management approvals.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 15/225
Operational feasibility:
Proposed Systems are beneficial only if they can be termed into information systems
that will meet the operating requirements of the organization. This test of feasibility asks
if the system will work when it is developed and installed. The important questions useful
to test the operational feasibility of a project are as under.
Is there sufficient support for the proposed system from the management and users?
This is an important question that would help us perceive any resistance that might
come from the end user community. Canteen Management System is committed to this
project and is highly supportive. There was no resistance from the organization for the
proposed system as they were happy to learn that the manual system is being automated.
Are current business methods not acceptable to the users? Are they ready to
embrace a change bringing about a more operational and useful system?
The end user community was tired getting a lashing from their management that they
are not providing right and the accurate information. They have spent countless nights in
re-working to provide accurate information. However, the problem of timeliness still
persists. The users of the proposed system welcomed the change as they knew that the
new system would bring right, useful information as and when required.
Will it produce efficient result? Will the performance of plant fall down after
implementation?
The genuine concerns about the proposed system pertain to how would a person be
able to quickly adapt to a new system. Implementation team proposed an extensive
training plan to address this concern and also assured them 2 weeks of post
implementation support.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 16/225
Other feasibility:
Like Social, Management, Legal and Time Feasibility of the proposed system has also
been checked to find the above aspect of the system.
Therefore System Analysis is concerned with the study of existing systems and
Procedures and identification of the requirements of proposed system. In this phase,
queries regarding of the actual problem , the problems encountered in the presently
available system are also discovered.
SOFTWARE ENGINEERING PARADIGM
To solve actual problems we incorporate a development strategy that encompasses the
process, methods and tool layers referred to as a process model of a software-engineering
paradigm. A process model for software engineering is chosen based on the nature of the
project and application, the methods and tools to be used, and the controls and
deliverables that are required.
For this system we are incorporating all the methods, processes and tools using
prototyping paradigm. It begins with requirements gathering. We met the users of the
system and defined the overall objectives for the software, identify whatever requirements
are known and outline areas where further definition is mandatory.
A “quick design” is then visible to the user which further leads to the construction
of a prototype. This Prototype is evaluated by the customer interactively which enables
the developer to better understand what needs to be done. The prototype can serve as “
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 17/225
the first system ”. Users get a feel for the actual system and the developers get to build
same thing immediately.
The prototyping paradigm:
The software requirement specification is produced at the culmination of the analysis
task. The function and performance allocated to various software as establishing by
developing a detailed validation criteria as per the following refines part of system
engineering: -
C us t om er t es t -d r i vesm ock - up
B u i l d / R ev i seM ock -up
L i s t en t oC us t om er
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 18/225
HARDWARE USED
Pentium IV.
512 MB RAM
160 GB Hard Disk
SOFTWARE USED
Windows XP and Above.
C#.NET(As front-end)
SQL-2000(As back-end)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 19/225
SOFTWARE REQUIREMENTS SPECIFICATIONS
The introduction of the software requirements specification states the goals and
objectives of the software, describing it in the context of the computer –based system.
However, the introduction may be nothing more than the software scope of planning
document for the modules.
Following are the basic requirements of Canteen Management system:
Maintain the customer such as Delars, Client, Representative and check these
information.
Manage the different type of the customer & maintain the database of the
customer.
Define the category of the Wappons such as Arms,Ammunation &
Accessories(Gun,Revolver,Pistole,Rifle).
Maintain the information about the product, supplement, unit, booking Stock.
Maintain the Order No. & Order Date.
System should capable for these requirements which is necessary for checking the
order of stock.
Maintain the records of insertion, modification, deletion of the Gun House.
Organization should generate the bill after Order of the Gun House.
System should capable for maintaining the payment which is collected by the
customer and calculate the balance of the customer.
System should capable to generate the receipt for the customer.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 20/225
System should capable to generate the different reports which is useful for
showing the relative information about the customer, date wise product, bill,
payment, receipt.
The information Description:
It provides a detailed description of the problem that must solve. In the proposed
system the requirement has been collected from the user as well as from the existing
systems keeping in view of the future advancement and its expansion. Information
content, flow, and structure are documented. Hardware, software, and human interfaces
are described for external system elements and internal software function.
Bharat Gun House process the following steps:
First of all enter the Login name &Password,There are two type of Login
Administrator & User.
Administrator module manage all the master like Unit, Stock,Consignment,
Transfer to other party,Return Consignment, Received from the
party,Dues,Reports Daily saling & purchaseing,All Updation & Deletion part of
the Bharat Gun House.
Administrator maintain the database of these masters.
In customer module insertion of the new customer. Customer can be Delar, Client,
Representative.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 21/225
Insertion, deletion, modification of the customer & maintain the records of the
customer.
In Order module receive the Order from the different type of customer.
Operator checks all the entries like unit, location, Gun House category, product.
After checking these entries Administrator generate the Order no, Order date of
Gun House.
Operator maintain the premium & discount according to the advertisement
category, color, situation of the page.
Operator prepare the canteen’s bill for the customer after some checking.
Customer payment the bill which generated by the organization.
Customer can pay these Payments by different type like Cash, DD, Cheque.
In the Payment module we check the payment of the bill in different manner such
as collection of payment & balance of the customer.
In the Receipt module after checking all these entries opreator generate the bill
receipt.
Bill receipt contain the receipt no, receipt date, receipt amount.
After completing all these work generate the reports like product, unit, bill,
payment, receipt.
Number of Modules:
According to the Structure chart this System is primarily divided into Number of
modules and these modules are further divided into sub modules where required to design
the objective efficiently.
Bharat Gun House software contains the following modules:
Module 1:
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 22/225
Gun Stock Module:
Insertion of new Gun Stock such as Arms,Accessories,Rifle,Pistole.
Update and Delete of Gun Stock.
Show all Record on the basis of Arms(gun,accessories,rifle,pistole).
Ammunation(gun,accessories,rifle,pistol),Accessories(gun,accessories,rifle,pistol)
.
Administrative Module represents information of all Wappons like
Classification,Producttype,ArmsNo.,Bore,Company,Type,Variety,Purchase
price,Market price,QTY,Location. They are used to enter all information of Wappons.
Module 2:
Consignment Module:
Received Consignment from other Party.
Maintain the category of Products such as Arms & Ammunation.
Maintain the Party information.
Return the Consignment to the party.
Update or delete Consignment record.
Given Own data to other Party.
Received own data to other Party.
Record all the received and given consignment to other and ourself also.
This module is used to provide the information Received & Given consignment to
othesr and ourself also.
Module 3:
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 23/225
Purchase Module:
Add purchased data in the stock through the purchased from.
Update & Delete purchased data if any entry is wrong.
Add New Party & Suppliers.
Update & Delete these profile.
This module is used to provide the information daily purchased data & and provide
the information about Suppliers & Party.
Module 4:
Sale Module:
Maintain the Order Date.
Maintain the record of customer.
Maintain the day for Add.
Maintain the Category of Add.
Maintain the Category of Add.
Product sale &Billing.
Billing on two basis Bill/Invoice or Cash Memo
Module 5:
Repair Module:
Received Arms & Ammunation for repairing.
Describing the repair type of the product.
Update/Delete
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 24/225
Return to the party after repairing the product &maintaining the Account of that party
on the basis of payable,received&due amount.
Update/Delete.
This module is used to provide the detail that have been taken by customer, Item,
representative (group) during the current financial year.
Daily saling products due ,received & payable Amount.
Module 6:
Reports Module:
Stock Reports.
Daily Purchased reports.
Daily Sale reports.
Repair reports.
Daily Police report.
Account reports.
Consignment reports.
This module provide the information about all type of working of this software in the
form of crystalreports.
Module 7:
Dues Module:
Dues remaining over gun house check Account.
Dues remaining over others Check Account.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 25/225
This module provide the information about account information.
Functional Description:
It describes the details of each function which have been used to solve the problem has
been presented. This also used to provide processing narrative for each function, design
constraints with justification and performance characteristics. Behavioral Description of
the specification examines the operation of the software as a consequence of external
events and internally generated control characteristics.
Validation Criteria is probably the most important section of the Software.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 26/225
An overview of RDBMS
RDBMS is the acronym for the relational database management system. The
concept of relational database is known since 1980 the idea of database management
system is quit old. The most famous RDBMS packages are SQL-2000, SYBASE,SQL-
2000,SQL-2005 and INFORMIX etc.
For this software we preferred SQL-2000 as our backend tool.
What Is Database Management System?
A database management system is essentially a collection of interrelated data and
set of programs to access this data. The collection of data is called DATABASE. The
primary objective of DBMS is to provide a convenient environment to retrieve and store
database information. Database system supports single user and multi-user. While DBMS
let only one person to access data.
A Database consists of two parts namely the database management and the database
application. Database management systems the programs that organize and maintain the
information whereas the database application is the program that let us view, retrieve and
update information stored in DBMS. DBMS has to protect database against unintentional
that could be caused by the users and application like disk crack etc and in case of multi-
user system, it must be capable of notifying any database change to the other user
Characteristics of A Database Management System:It represents complex relationship between data.
Keep a tight control of data redundancy.
Enforces user-defined rules to ensure the integrity of table data.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 27/225
Has centralized data dictionary for the storage of information pertaining to data and its
manipulation
Ensures that data can be shared across authorization.
Enforces data access authorization.
Has automatic, intelligent back up and recovery procedures for data.
Have different interfaces which users can manipulate data.
Database Management System Offers the Following Services:Data Definition: It is a method of data definition and storage.
Data Maintenance: It checks whether each record has fields containing all
information about one particular item.
Data Manipulation: Allows data in the database to be inserted, updated, deleted
and stored
Data Display: This helps in viewing data.
Data Integrity: This ensures the accuracy of the data.
Introduction to SQL-2000:Every business enterprise maintains large volumes of data for its operation. With
more and more people accessing this data for their work, they need to maintain its
integrity, relevance increases. Normally with the traditional methods of storing data and
information in files, the chances that the data loses its integrity and validity are very high.
With the birth of new concepts of data storage and manipulation known as DATABASE”
and “DATABASE MANAGEMENT”, today it is possible to maintain data pertaining to
any operation with security. A database is an aggregation of data in contiguous locations
in some organized fashion. This organized fashion normally involves storing the data in
the form of TABLES. A table is a unit of storage, which holds data in the form of rows
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 28/225
and columns. Thus a collections of all tables with their interrelationships could be termed
as database.
A program or “Software” that can help us to access this data and perform certain pre
defined operations on it, is called a DATABASE MANAGEMENT SYSTEM or a
DBMS. The DBMS whose designs are based on the relational theory in mathematics is
called the Relational Database Management System or RDBMS.
SQL-2000 is an Object Relational Database Management System (ORDBMS). SQL-2000
database offers capabilities of both relational & object oriented database systems. SQL-
2000 supports very large database that could contain hundreds of terabytes of
information. It also provides access to many concurrent users to the of thousands or ten
thousand users.
SQL-2000 data partitioning features helps to minimize the problems. A large table that is
partitioned can enhance the performance because accessing can be done on Multi-
partition in parallel. Even if one or more partitions fail then the partitions are available to
applications.
SQL-2000 supports Multi Thread Servers (MTS). SQL-2000 has advance queuing
features. These features allow multiple executions, acceptable at the same time for
transactions.
SQL-2000 provides ten fold size improvements. It can support ten times the amounts of
data. Individual table can now have up to one thousand. I addition, the database can now
support very large objects known as LOBS.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 29/225
SQL-2000's reliability is built around technologies such as:The SQL-2000 parallel server product.
Disk mirroring.
Fast and simple recovery mechanisms.
SQL-2000 now offers most of the features that most operating systems have had for years
Account disablement after a specified number of failed attempts.
Password expiration and forced password changes.
Password history maintenance to prevent users from reusing previous passwords.
Complex password enforcement that forces users to choose passwords which cannot
easily be guessed by potential intruders.
Tools of SQL-2000:The tools of SQL-2000 are so user friendly that a person with minimum skills in
the field of computers can access. They are
SQL* PLUS.
PL/SQL.
FORMS.
REPORTS.
SQL*PLUS
SQL*PLUS is a structured query language supported by SQL-2000. Through
SQL*PLUS we can store, retrieve, edit, enter and run SQL commands and PL/SQL
blocks. Using SQL*PLUS we can also format query results in the form of report.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 30/225
PL/SQL
PL/SQL is an extension of SQL. PL/SQL block can contain any number of SQL
statements integrated with flow of control statements. Thus PL/SQL combines the data
manipulating power of SQL with data processing power of procedural language.
Forms
This tool is used for generating and executing forms based applications. A form
basically comprises blocks and fields. Multiple tables can be accessed over a single form,
based on the application with help of transaction commands.
Reports
It is an application development tool of SQL-2000 for developing, executing,
displaying, and printing reports. SQL-2000 reports are powerful, yet easy to use.
Creation of Database:This section consists of a list of Application related tables. First of all, Tables are
created using the SQL command, CREATE and some constraints are applied on it, which
are explained later in this section.
Create Command
The syntax of CREATE command is as follows:
CREATE table <table-name> (<column 1><type>, <column2><type>,.............);
CREATE command is a part of DATA Definition Language (DDL) which is used for
creating the tables for data storage.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 31/225
For each table, the constraints used are Primary Key, Referential integrity constraints,
foreign key, and indexes.
Primary Key
This constraint avoids duplication of rows and does not allow NULL values, when
enforced in a column or set of columns. As a result it is used to identify a row. If primary
key constraints are assigned to a combination of columns, it is said to be a Composite
key, which can contain a maximum of 16 columns.
Referential Integrity Constraints
To establish a 'parent-child' or a 'master detail' relationship between two tables
having a common column, we make use of referential integrity constraint. To implement
this, we should define the column in the parent table as a primary key and the same
column in the child table as a foreign key referring to the corresponding parent entry.
Index
We create indexes explicitly to speed up SQL statement on a table. The index
points directly to the location of the rows containing the values. We create an index on a
column or a combination of columns using CREATE INDEX command.
Foreign Key
This constraint helps to understand the relationship between tables.
Insert Command
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 32/225
Once the table is created, INSERT command of Data Manipulation Language
(DML) is used to insert records into the table. The values are separated by commas and
must be entered in the same order as they are defined in the table.
The syntax of INSERT command is as follows:
INSERT into <table-name> values (list of data values);
Example
Insert into CTG_MASTER values (‘CTG00011’, ‘DIS’,’DISPLAY’);
If a user wants to enter 100 records then he has to write insert statement 100 times. He
can avoid this by making use of substitution variable. To understand this, use the
following insert command:
INSERT into CTG_MASTER values (‘&CTG_ID’, ‘&CTG _code’, ‘&CTG _Name’,);
If you want to insert another records in the same table just write run or type / Run
command is used for executing previous command.
Select Command
Select command is used to retrieve records from the table
The syntax of SELECT command is as follows:
SELECT column_name1, column_name2.......from table_name..........;
To select specific row from a table we include a ‘Where’ clause in the select command.
We can retrieve only the rows, which satisfy the ‘Where’, condition. To arrange the
displayed rows according to some predefined order we can use the ‘order by’ clause. The
‘order by’ clause should be the last clause in a select command.
The syntax for SELECT command along with the WHERE clause is given below:
SELECT column1, column2,..........from table_name1,..........WHERE conditions
[order by];
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 33/225
Table Descriptions and Validations
This section consists of a list of the Application related tables. The Table list
briefly describes each of the tables and can be used to quickly identify tables for which
details are required. It further contains detailed definitions of the underlying tables. For
each table, it provides information about primary keys, foreign keys, and indexes. It also
gives a detailed description of each column and its characteristics.
Introduction to C#.NET:GUI Tool used in the Development of this project is Microsoft Developer Studio’s
C#.NET. Integrated Development Environment (IDE) makes it easy for the Developer to
manage classes, modules, forms, User Controls etc. It makes the work of a Developer a
lot easier. It is referred to as the integrated development environment or IDE because it
integrates many different functions such as design, editing, compiling, and debugging
within a common environment.
Package and Deployment Tool
The Package and Deployment Wizard automates many of the steps involved in
distributing applications by presenting you with choices about how you want to configure
your .cab files.
Why opt C#.NET
The "C#.NET" refers to the method used to create the graphical user interface
(GUI). Which makes system more elegant & user-friendly even for non-computer literate.
Whether our goal is to create a small utility for our self or our work group, a large
enterprise-wide system, or even distributed applications spanning the globe via the
Internet, C#.NET has the tools we need.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 34/225
Data access features allow us to create databases, front-end applications, and scalable
server-side components for most popular database formats, including Microsoft SQL
Server, SQL-2000 and other enterprise-level databases.
Internet capabilities make it easy to provide access to documents and applications across
the Internet or Intranet from within our application, or to create Internet server
applications.
Finished application is a true .exe file that uses a C#.NET Virtual Machine that can be
freely distributed.
Connection
Represents a unique session with a data source. You can use this object to connect
to a data source such as SQL-2000, SQL Server or Access or even Microsoft Excel
spreadsheet. A Connection Object is created using the create Object method of the Server
object.
class db
{ public static System.Data.SqlClient.SqlCommand com;
public static System.Data.SqlClient.SqlConnection con;public static System.Data.SqlClient.SqlDataReader dr;
public static int sid,slimit; public static stringgunid,stgunid,prona,comna,customername,licenceno,str1,str2,bhdues,rpdues; static db()
{con = new System.Data.SqlClient.SqlConnection();con.ConnectionString = "data source=.;initial
catalog=bharat;integrated security=true";
com = new System.Data.SqlClient.SqlCommand();con.Open();com.Connection = con;
}}
Connection object allows commands to be executed using the Execute method.
The Execute command returns a Recordset object.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 35/225
Introduction:
The design of a system is essentilly a blueprint or a plan for a solution for the
system. A system can be a collection of componentes with clearly defined behavior,
which interact with each other to produce some services.
System design is the creative act of invention, developing new inputs, a database,
offline files, method, procedures and output for processing business data to meet
organization objectives. System designs build information gathered during the system
analysis.
The designing part has essentially two levels:-
System Design Level
Detailed Design Level
The System Design Level ( or the Top- Level Design ) focuses on the types of
modules needed for the system and how these modules need to be interconnected.
The Detailed Design Level ( or the Logic Design ) focuses, internal design of modules
are specified i.e. how the specifications of the module can be satisfied.
Designing is the most important part of the software development. It requires a careful
planning and logical thinking on part of the system designer upmost care should be taken
because if this phase contains any errors then it will effect the performance of the system.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 36/225
Design objective:
The goal of the system design is not simply to produce a design but to find the
best possible design , within the limitations imposed by the requirements and the physical
and social environment in which the system will operate.
Some of the desirable properties for a software design are:
Verifiability The system design should be correct such that its correctness can be
verified.
Completeness All different components of design should be specified. that is , all
relevant data structures , modules , external interfaces and module interconnections are
specified.
Efficiency The system should utilize all the scarce and expensive resources efficiently.
Simplicity & understandability This is the most important aspect of the quality
consideration. A system should be developed such as to impose a little job on the
maintenance and upgradation phase.
Reliability To avoid the errors inherent in the manual system and to generate
consistent and reliable outputs.
User-Friendliness To make the system completely menu driven and hence user
friendly in order to aid the users , or users unfamiliar with the knowledge of computers.
Avoid Redundancy & Maintain Consistency
To design the system in such a way so
as to reduce redundant information and to maintain consistency of information in the
system.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 37/225
Input Design
Inaccurate input data are the most common cause of errors in data processing.
Errors can be controlled while input design. The goal of designing input data is to make
data entry as easy, logical and error free as possible. While designing the forms where the
user inputs the data care should be taken about the following points.
The allocated space for each field.
Only a single dot can be accepted in amount type fields
Field sequence that must match that in the source document.
The format in which the data fields are entered; for example:-filling out the date field is
required through the edited format MM-DD-YY
Database Design
A well designed database makes programming and tuning application much
easier. A logical database design is typically a block diagram of entities and relationships.
Referred to as an E-R Diagram. Relational database uses a term Entity to represent and
object in the logical design and attribute to represent properties of the entities. For
example the tables in our database are entities and field in each table are attributes of each
entities.
Logical design creating all entities in the database and establishing relationship between
entities. Logical design does not take in to account the type of database or the system on
which the database with besides. Physical database design is taking the logical database
and creating with database and database object to represent the entities and relationship in
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 38/225
the logical database design. In the physical design each entity become a table and the
attribute of the entities become column of the tables.
Database Design Goals :-
It is important to understand some of the goal before beginning the process of
designing a database.
The design goals for logical database are:
Establish database purpose
Support all Queries and produce all reports
Be-able to perform all calculation
Process all transactions
Enforce restrictions and Defaults
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 39/225
Database Designing Process:Retrieving Information and Analyzing Information:-
The first step in designing a database is to talk to people who will use it. Gather all
information to be represented in your database. Gather all the reports generated by hand
that you expect with the database. Add in new report that the user want. Gather any
information sheets and any available information on the data and there characteristics.
Break Down Information Into Separate entities :-
Get a piece of paper or a database design tool and break down the collected data
items, collected into separate entities.
An entity is a distinct object in the database. Each entity becomes its own table.
Assigning Attributes to each Entity:-
When you have created separate entities for each object, assign attributes to each
entity. An attribute is property or characteristic of the object, such as its name, address
etc. Each attribute becomes the fields in the table.
Identify a Unique Identifier for each entity:-
A row in a relational database needs to be uniquely identified so you can retrieve
that row and only one row. Select one or more attributes that are uniquely identified a
single row in the entity. This unique identifier is called Primary Key.
Establish Relationship Among Entities:-
Determine the types of relationship that exists among your entities. There are
three types of relationship in relational database design:
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 40/225
One-to-One
One-to-Many
Many-to-Many
One-to-One A One-to-One relationship is one in which each row in one table
represented by a single row in another table.
One-to-Many A One-to-Many relationship is one in which a row in one table may be
represented by many rows in another table.
Many-to-Many A Many-to-Many relationship is one in which arrow from one entity
may be represented by one or many row in another table and a row from second table
may be represented by One-to-Many row in the first table.
Normalization of the Logical Design:
When you have established relationship for your logical design, to normalize the
design. Normalization involves a set of rules used to test the soundness of your database
design. Each rule applied to the logical database design , then the logical design said to be
in rule# form. For which rule# is first, second, third and so on to fifth.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 41/225
Table Design:
Any Programming environment to create containers, to manage human data, can
be conceptualized as Data Management System. Traditionally, the block of human data
being managed is called a Database. Hence, in very simple terms these programming
environments can be conceptualized as database management system.
All Database Management Systems allow users to create containers for data storage and
management. These containers are called ‘Field’. The minimum information that has to
be given to the DBMS for a suitable container to be constructed which can hold free from
human data is:-
Field Name
Field Length
The type of data that can be placed in to the Field
Field Name :
When we wish to view the contents of the field later all we need to do is to tell the
programming environment the field name. The programming environment is intelligent
enough to fetch for us contents of the field.
Field Length :
This is the manner we ‘Rigidize’ free from human data. We create container of a
pre-determined length into which we will store ‘Free Form’ human data for management.
We will have to try our best and decide the longest name we wish to manage and decide
on the container length accordingly.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 42/225
Field Data Type :
Human data is mainly of two type character or numeric if numbers then we can
have whole number or floats. We would then have to inform the programming
environment, which is creating field for us, what kind of data we will store in the field
when it is being used. The simplest reason being that we would have to separate character
and number data types.
We would imagine that each field was an object created us by the RDBMS. Then
the fields create for us in the same horizontal plane would be another distinct object
created for us by RDBMS. Multiple field placed in the same horizontal plane is an object
called ‘Record’ by RDBMS several records of equal length placed one below the other to
enable user to continue to store data is called ‘Table’.
Entity relationship diagram
1
M
1
Customer Designation
Purchase
Wing
Department
Organization
Employee
Item
Purchase
Has
Has
Group
Stock ContainSection
Has
Attendance
Has
Salary
Has
Receives
Has
Contain
M
Has
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 43/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 44/225
DFD
Salary
Emp_Info
Zero Leve l DFD
Report DataCust_Info
Consumer / Client
CMSReceipt / Goods Management
Employee
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 45/225
Attendance Table
Report Data
Salary Info
Salary InfoEmp Info
Sale Info
O r d e r I n f o
C u s t I n f o
Receipt / Goods
Cust Info
Cust Info
C u s t I n f o
Order Info
Customer (1)
Processing of Customer Data.
(3)
GenerateReports
(2)
Order Processing
Management
Orders Data
(4)Gives
Payments
Sale Table
Attendance InfoEmp Info
Employee(5)
VarifiesAttendance
(6)
Calculate
Salary
Salary Details
Customer Data
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 46/225
Tables Description:
Table Name : Customer
Purpose : Table to store the Information about the Customer.
Field DataType Remark
Cust_Id Varchar2(10) Primary Key
Cust_Name Varchar2(20) Not Null
Desig_Id Varchar2(10) Foreign Key
Address Varchar2 (50) Not Null
Unit Varchar2(4)
Status Varchar2(2)
Phone Varchar2(50)
Dob Date
Liquor_Quota Number(4)
Wing_Id Varchar2(10) Foreign Key
Dept_No Varchar2(10) Foreign Key
NoOfPerson Number(2)
Income Number(10,2)
Card_No Varchar2(10) Not Null
Issued_OnDate
Valid_Up_ToDate
Renewed_Up_ToDate
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 47/225
Table Name : Item
Purpose : Table to store the Information about the Item.
Field DataType Remark
Item_Id Varchar2(10) Primary Key
Item_Name Varchar2(20) Not Null
0Item_Desc Varchar2(50)
Item_Price Number(10,2) Not Null
Group_Id Varchar2(10) Foreign Key
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 48/225
Table Name : Canteen
Purpose : Table to store the Description of the Canteen.
Field DataType Remark
Canteen_Id Varchar2(10) Primary key
Canteen_Name Varchar2(20) Not Null
Canteen_Desc Varchar2(50)
Canteen_Address Varchar2(50) Not Null
Canteen_Ph_No Varchar2(50)
Canteen_Head Varchar2(20) Not Null
Table Name : Designation
Purpose : Table to store the Information of the Designation.
Field DataType Remark
Desig_Id Varchar2(10) Primary key
Desc Varchar2(50)
BSalary Number(10,2)
Table Name: Department
Purpose : Table to store the Details of Department.
Field DataType Remark
Dept_Id Varchar2(10) Primary key
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 49/225
Desc Varchar2(50)
Dept_Name Varchar2(20)
Org_Id Varchar2(10) Foreign Key
Table Name : Organization
Purpose : Table to store the Information of Organization.
Field DataType Remark
Org_Id Varchar2(10) Primary key
Org_Name Varchar2(20)
Desc Varchar2(50)
Table Name : Wing
Purpose : Table to store Details of Wing.
Field DataType Remark
Wing_Id Varchar2(10) Primary key
Wing_Name Varchar2(20)
Remark Varchar2(50)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 50/225
Table Name : Section
Purpose : Table to store the details of Section.
Field DataType Remark
Sec_Id Varchar2(10)Primary key
Sec_Name Varchar2(20)
Desc Varchar2(50)
Dept_Id Varchar2(10) Foreign Key
Table Name : Employee
Purpose : Table to store the Information of the Employee.
Field DataType Remark
Emp_Id Varchar2(10) Primary key
Emp_Name Varchar2(20) Not Null
Doj Date Not Null
Dol Date
Sex Varchar2(2) Not Null
Address Varchar2(50) Not Null
Desig_Id Varchar2(10) Foreign Key
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 51/225
Phone_No Varchar2(50)
DA Number(6,2)
HRA Number (6,2)
Other_Allowances Number(6,2)
Section_Id Varchar2(10) Foreign Key
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 52/225
Table Name : Attendence
Purpose : Table to store the Information of the Attendence
Field DataType Remark
Emp_Id Varchar2(10)Foreign Key
Date Date
Primary Key(Emp_Id,
Date)
Status Varchar2(10) Not Null
Reason Varchar2(50)
Leave_Type Varchar2(10)
Table Name : Group
Purpose : Table to store the Information of the Group
Field DataType Remark
Group_Id Varchar2(10) Primary key
Group_Desc Varchar2(50)
Remarks Varchar2(50)
Table Name : MSalary
Purpose : Table to store the Information of the Msalary
Field DataType Remark
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 53/225
Sal_Slip_No Varchar2(10) Primary key
Sal_Date Date Not Null
Sal_Days Number(2)
Sal_Amount Number(10,2) Not Null
Emp_Id Varchar2(10) Foreign Key
Net_Salary Number(10,2)
No_Holidays Number(2)
Deduction Number(6,2)
Payment_Mode Varchar2(10) Not Null
Payment_Date Date Not Null
Mode_Date Date
Mode_No Varchar2(10)
Bank_Name Varchar2(20)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 54/225
Table Name : Stock
Purpose : Table to store the Information of the Stock
Field DataType Remark
Item_Id Varchar2(10) Primary key
Quantity_Available Number(4) Not Null
ReOrderLevel Number(4) Not Null
Table Name : Sale
Purpose : Table to store the Information of the Sale
Field DataType Remark
Bill_No Varchar2(10) Primary key
Cust_Id Varchar2(10) Foreign Key
Date Date
Total_Price Number(6,2)
Total_Quantity Number(4)
Table Name : SaleItem
Purpose : Table to store the Information saleitem.
Field DataType Remark
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 55/225
Bill_No Varchar2(10) Foreign key
Item_Id Varchar2(10) Foreign Key
Quantity Number(4)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 56/225
Efficiency of the coding is concerned with the proper use of resources by the
software. The need of efficiency arises due to the cost considerations. If some resources
are scarce and expensive, they must be used efficiently. In computer system, the resources
that are most often considered for efficiency are processor time and efficiency. An
efficient coding is the one, which consumes less processing time and less memory.
The coding of the project is quite efficient in handling the errors, validating entries
and searching the database as fast as it can. The coding of the project is written in such a
way that it can be altered easily in future, if there is a need from the programmer’s side or
from the customer’s side.
By efficiency the CPU overhead is reduced, to increase the system throughput and
reaction time and waiting period is reduced accordingly.
Proper Balancing of CPU & I/O Bound Instruction is being done by the help of
code efficiency, CPU & I/O bound instruction are streamline. Therefore reducing the
corresponding load on CPU as well as on memory/other system resources.
The speed of execution is enhanced by the help of code efficiency.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 57/225
Optimization though does not provide any additional checks to the software
however it provides that the software be made functional to its desired efficiency
consistency with recurred standard.
In these software project optimizations been achieved for the following laid down
aspects:-
1. Speed of Program Execution :-It has been ensured that the procedure
adopted/design/coding done is optimized and superfluous details omitted to meet
the requirements. By ensuring this, the speed of execution is enhanced which has
future initiated similar reaction in other sub modules
2. CPU Overheads :-By optimization the CPU overheads is reduced to increase the
system throughput and reaction time, waiting period is reduced accordingly.
3. Proper Balancing of CPU & I/O Bound Instructions :-By optimizing, CPU &
I/O bound instructions are streamlining we can reduce the corresponding load on
CPU as well as on memory / other system resources.
4. Crash Recovery:- It has been ensured that the crash recovery is automatic to
avoid undue delay is giving direct instructions at the time of crash.
Other security and protection like auto backup, protection form unauthorized
access and normalization of database tables has been ensured to achieve the
recurred efficiency.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 58/225
This is the most important section of the software requirement specification.
Different classes of tests are conducted to validate function, performance and constraints.
This section demands a thorough understanding of software requirements. We have given
proper time and attention by validating data and database as far as possible.
Validation as the name suggests validate the requirement and act as a rider to
ensure that the design software is utilized to its thresh-hold without any error.
In the above software project the requirement of validity checks arises to ensure
that the various input data endorse by the user is entered in correct form and design.
These validation checks in this system have been included to ensure its correctness and
desired accuracy.
Few of them are given as under :-
1.Customer ID: Validation proved that the details of Customer ID be entered on
the correct field and format, any discrepancy to the proposed format will show the
error and the user can correct the data accordingly.
2. Date: Likewise date has to be entered in the correct field/format i.e. DD-MM-YY
and any variation to the above will show an error to the user.
3. Amount: Amount has to be entered in the correct format i.e. only numeric value
and any variation to the above will show an error to the user, otherwise it would
be problematic to further calculation.
1. IsLength() :-
This function ensures that the data entered in that field is not empty. It does this
by obtaining the length of the field’s value with VB Script’s built- in Len () function. If a
length of 0 is returned, the user is altered that the field is empty.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 59/225
public Length(val)
if len(val.value)>0
{
isLength = true;
}
Else
{
msgbox "This value can't be empty.";
val.select;
Length = false;
}
}
2. IsNumber()
This function checks to see whether that field’s value is numeric, using C#.NET
Script’s IsNumber() function.
function isNumber(val)
if isNumeric(val.value)
{
isNumber = true;
}
else
{ msgbox "This value must be numeric.";
val.select;
isNumber = false;
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 60/225
}
The proposed software can be used to its organization and desired accuracy can be
insured as proposed.
These validation checks have been provided in all the modules so that the software
may be run for it’s laid down standard.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 61/225
Implementation :-
Implementation phase is primarily concerned with user training , site preparation
and file conversions. Implementation is the process of having systems personnel check
out and put new equipment into use , train users, install new application and construct any
files of data needed. This phase is less creative than system design. Depending on the size
of the organization and the risk involved , the developers may choose to run both old and
the new system in the parallel way to compare the results.
Implementation of the present project can be simply done by installing the
Executable / batch file on any local machine having any Operating System and SQL-
2000 as the backend.
Before installing at client side its better to implement the software as a parallel run
in order to test the software function. This time period can be between 15 days to 2
months.
Later if the system shows a efficient functionality then the software can be used in
complete and then the old system can be discarded if present.
Once the proposed system has been tested to its requirement the another important
aspect is its correct implementation so that the desired goals of the organization be
achieved. Methods/implementation technique is adopted depending upon the organization
requirement. Using following two techniques carries implementation: -
1. Serial implementation
2. Parallel implementation
1. Serial Implementation :-
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 62/225
This technique of implementing is adopted when the entire system is to be
replaced in one go and the existing system is changed with the proposed system. The
system has its own advantages and disadvantages and is adopted keeping in view of the
organization requirement this technique is fast however some factor is high for the
organization the entire existing system has to be changed simultaneously therefore large
amount of existing data has to be stored before change over.
2. Parallel implementation :-
This is achieved by dividing the entire processing/system into various sub
systems. The existing system is therefore replaced to the new system step by step and the
organization remains functional during change over. The system avoids the storage of
existing data as it is being done in phases however taken more time and risk involves is
much less.
Evaluation of the system is performed to identify its strengths and weaknesses.
The actual evaluation can occur along any of the following dimensions :-
1. Operation Evaluation :-
Assessment of the manner in which the system function , including ease of use, response
time, overall reliability and level of utillization.
2. Organizational impact :-
Identification and measurement of benefits to the organization in areas such as
financial concerns , operational efficiency , and competitive impact.
3. User Manager Assessment :-
Evaluation of the attiudes of senior and user manager within the organization , as
well as end-users.
4. Development Performance :-
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 63/225
Evaluation of the development process in accordance with development time and
effort , conformance to the budgets and standards criteria.
Maintenance is necessary to the eliminate errors in the working system during its
working life and to tune the system to any variations in its working environment. Often
small system deficiencies are found as a system is brought and changes are made to
resource availability to carry out these maintenance functions. The importance of
maintenance is to bring the standards. The maintenance of existing software can account
for over 60 percent of all effort expended by a development organization. Change is in
editable when computer based systems are built; therefore, we must develop mechanisms
for evaluating, controlling and making modifications.
1. Corrective maintenance :- This pertains to the changes the software to correct
defects.
2. Adaptive maintenance :- Overtime, the original environment for which the web
application was developed is likely to change. This maintenance results in
modification to the software to accommodate changes to its external environment.
3. Enhancement :- As software is used, the customer/user will recognize additional
functions that will provide benefit. Perfective maintenance extends the software
beyond its original functional requirements.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 64/225
Introduction :-
Software testing is an important element of s/w quality assurance and represents
the ultimate review of specification, design and coding. The increasing visibility of
software as a system element and costs associated with a software failure are motivating
forces for well planned, through testing.
Testing presents an interesting challenge for the software engineer. During the
earlier definition and development phases, the engineer attempts to build software from
an abstract concept to an acceptable implementation. In testing the engineer creates a
series of test cases that are intended to demolish the s/w that has been built. Testing
requires that the developer discard preconceived notions of the correctness of the s/w
developed and overcome a conflict of interest that occurs when errors are uncovered.
Theoretically, a newly designed system should have all the pieces in working
order, but in reality, each piece works independently. The purpose of system testing is to
consider all the likely variations to which it will be subjected and then push the system to
its limits. It is a tedious but a necessary step in a system development.
1. TESTING OBJECTIVES :-
Testing is a process of executing a program with the intent of finding an error.
1. A good test case is one that has a high probability of finding an as-yet-
undiscovered error.
2. A successful test is one that uncovers an as-yet-undiscovered error.
The above objectives imply a dramatic change in viewpoint. They move counter
to the commonly held view that a successful test is one in which no errors are found. Our
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 65/225
objective is to design tests that systematically uncover different classes of errors and do
so with a minimum amount of time and effort.
If testing is conducted successfully (according to the objectives stated above), it
will uncover errors in the software.
Testing cannot show the absence of defects, it can only show that software errors
are present.
2. TESTING TECHNIQUES
The techniques followed throughout the testing of the system are as under
Black-Box Testing :-
Black box testing focuses on the functional requirements of the software. That is,
Black Box testing enables the software engineer to derive sets of input conditions that
will fully exercise all functional requirements for a program. Black Box Testing is not an
alternative to white-box techniques. Rather, it is a complementary approach that is likely
to uncover a different class of errors than white-box methods.
Black-Box Testing attempts to find errors in the following categories:
(1) Incorrect or Missing functions.
(2) Interface errors.
(3) Errors in data structures or External data base access.
(4) Performance errors.
(5) Initialization and Termination errors.
Unlike White Box Testing, which is performed early in the testing process, Black
Box Testing tends to be applied during later stages of testing. Because Black Box Testing
purposely disregards control structure, attention is focused on the information domain.
Tests are designed to answer the following questions:
1. How is functional validity tested?
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 66/225
2. What classes of input will make good test cases?
3. Is the system particularly sensitive to certain input values?
4. How are the boundaries of a data class isolated?
5. What data rates and data volume can the system tolerate?
6. What effect will specific combinations of data have on system operation?
7. By applying black box techniques, we derive a set of test cases that satisfy the
following criteria:
(1) Test cases that reduce, by a count that is greater than one, the number of
additional test cases that must be designed to achieve reasonable testing.
(2) Test cases that tell us something about the presence or absence of classes of
errors, rather than errors associated only with the specific test at hand.
White-Box Testing :-
White Box Testing knowing the internal workings of a product tests can be
conducted to ensure that internal operations are performed according to specifications and
all internal components have been adequately exercised.
Using white box testing methods the test cases that can derived are:
(1) All independent paths with in a module have been exercised at least once.
(2) Exercise all logical decisions on their true and false sides.
(3) Execute all loops at their boundaries and within their operational bounds.
(4) Exercise internal data structures to ensure their validity.
2. Program Testing :- A program represents the logical elements of a
system. For a program to run satisfactorily, it must compile and test data correctly
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 67/225
and tie in properly with other program. Program testing checks for two types of
error: syntax and logical.
A syntax error is a program statement that violets one or more rules of the
language in which it is written. These errors are shown through error messages generated
by the computer.
A logical error deals with incorrect data fields, output of range items and invalid
combinations. The programs are checked for syntax under C#.NET environment and
codes are carefully written and each logical path is traced during the testing for avoiding
the logical errors. No error is left for correction.
3. Method Testing :-
Methods are invariably related to each other and interact in a complete program.
Each method is tested to see whether it confirms to relate methods in a system. Each
portion of the system is tested against the entire module with both test and lives data
before the entire system is ready to be tested. All methods of a program are connected to
one another and test is carried out to see whether the path of the methods and objects are
in order.
4. Testing Information flow :-
In this test process two class inputs were taken they are:
1. Software configuration that includes s/w requirement specification
designs specification and source code.
2. Test Configuration that includes a test plan and procedure, testing tools
and test cases and their expected results.
The test was conducted and all results are evaluated. i.e. the test results were
compared with the expected results and concluded that software quality and reliability are
acceptable.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 68/225
5. Condition Testing :-
In this testing the logical condition in the program module is tested. The Boolean
operator, the Boolean variable, pair of Boolean parentheses, a relational operator, and
arithmetic expression are tested. If a condition is incorrect, then at least one component of
the condition is incorrect. Thus the types of errors in condition testing are Boolean
Operator Error, Boolean Variable Error, Boolean Parenthesis Error, Relations Operator
Error and Arithmetic Error.
6. Data Flow Testing :-
The data flow testing method selects test paths of program according to the
locations of definitions and uses of variables in the program.
7. Loop Testing :-
a. Simple Loops :-
The following sets of tests were conducted to simple loops where ‘n’ is the
maximum number allowable passes through the loop.
a. Skipped the loop entirely.
b. Only one pass through the loop
c. Two passes through the loop
d. m passes through the loop
e. n-1,n,n+1 passes through loop
Nested Loops
The test approach for simple loops is extended to nested loops, the number of
possible tests grow in and geometrically as the level of nesting increases.
8. System Testing :-
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 69/225
System testing is series of different tests whose primary purpose is to fully
exercise the computer-based system. Although each test has a different purpose, all the
work should verify that all system elements have been properly integrated and perform
allocated functions.
9. Recovery Testing :-
This is a system testing that force the s/w to fail in a variety of ways and verifies
that recovery is properly performed. If recovery is automatic re-initialization, checking
pointing mechanisms, data recovery, and restart are each evaluated for correctness. If
recovery requires human intervention, the mean time to repair evicted to determine
whether it is within acceptable limits
10. Security Testing :-
During this testing, the tester plays the role of the individual who desires to
penetrate the system. The tester may attempt to acquire passwords through external
clerical means and may attack the system with custom s/w design to breakdown any
defenses that have been constructed. The tester may also overview the system there by
denying service to others and may purposely cause system errors to penetrate during
recovery and may browse through insecure data, hoping to find the key to system entry.
12. Performance Testing :-
This testing is designed to test the run time performance of s/w within the context
of an integrated system. This testing occurs throughout all steps in the testing process.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 70/225
CLIENT NEEDS ACCEPTANCE TESTING
REQUIREMENTS SYSTEM TESTING
DESIGN INTEGRATION TESTING
CODE UNIT TESTING
To make the better control over system security, the back end SQL-2000 is
selected. Because SQL-2000 provides such security features which can not be provided
by any other RDBMS.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 71/225
Outsiders (hackers) may attempt access for sport, profit or with more malevolent
intent. A variety of security measures are provided by the application
In this project there is login and password security. Only valid user can enter in the
project, hence it is quite safe from unauthorized access.
In some cases, internal personnel may attempt unauthorized access. There are also
some restrictions for the employees who work in the agency. In this project we have
distributed the access rights. Here we have categorized the rights among employees as per
their designation. Higher the designation higher the access rights.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 72/225
A) Procurement Cost: This would include the following
Cost of Equipment : 30,000/-
Installation Cost : 5,000/-
Cost of Application Preparation : 3,000/-
Cost of Hiring Consultants : 5,000/-
B) Start Up Cost : This would include the Following
Cost of system software : 72,000/-
Communication software : 2,500/-
Cost of Recruiting Additional Manpower : NIL
C) Project Cost : This would include the following
Development Cost of the Project : 30000/-
Cost of Management Time : 3,000/-
Training Cost : NIL
Data Preparation Cost : 4,000/-
Conversion Cost : 5,00/-
Others : 2,000/-
D) Ongoing Cost
Maintenance Cost (Hardware) : 2,000/-
Maintenance Cost (Software) : 2,000/-
Maintenance Cost (Manpower) : 2,000/-
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 73/225
Depreciation : 1000/-
Addition Training : 1000/-
Total Cost 1,70,000/-
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 74/225
CRITICAL PATH
0-1, 1-2, 2-3, 3-4, 3-5, 5-6, 6-7, 6-8, 7-8, 8-10, 10-11, 11-12
R/NO. ACTIVITY TYPE OF ACTIVITY DURATION IN WEEK
1 0-1 Study existing system 1
2 1-2 Study proposed system 3
3 2-3 Analysis 2
4 3-4 Feasibility study 1
5 3-5 Software Requirement &
Analysis
1.5
6 4-5 Dummy 0
7 5-6 Design 2.5
8 6-7 Testing 59 6-8 Coding 2
10 6-9 Training 3
11 7-8 Dummy 0
12 9-10 Dummy 0
13 8-10 Implementation 2
14 10-11 Optimization 1
15 11-12 Review 1
Total Duration 20 Weeks
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 75/225
R/NO. ACTIVITY TYPE OF ACTIVITY DURATION IN WEEK
1 0-1 Study existing system 1
2 1-2 Study proposed system 3
3 2-3 Analysis 2
4 3-4 Feasibility study 1
5 3-5 Software Requirement &
Analysis
1.5
6 4-5 Dummy 0
7 5-6 Design 2.5
8 6-7 Testing 5
9 6-8 Coding 2
10 6-9 Training 3
11 7-8 Dummy 0
12 9-10 Dummy 0
13 8-10 Implementation 2
14 10-11 Optimization 1
15 11-12 Review 1
Total Duration 20 Weeks
Now a days what ever new & old product we prepared it’s success depends upon
better canteen. This is only reason that every successful businessman pays more and more
attention towards the attractive canteen of his product before launching it for the use of
general public.
6 101 14 16 18840 2 3 5 7 9 11 12 13 15 17 19 20
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 76/225
Hence not at the present but in future too it will be more essential, because we all
are living in a competition age. For this they opt different method of an attractive and
pleasant canteen.
The application can be used in different Canteen Management System, which
manage the Customer’s Database, Royalty Database, Bill, Payment & Outstand
Calculations & Receipt Entry Database and report generation. It is useful to maintain
daily activities of the Canteen Management System like insertion of new Customer record
and modifications in existing record, calculation of Bills and report generation etc. The
Application will be more users friendly and will allow faster processing of Images &
Data. The user will find this application easy to use.
This application can be used in any organization using the same interfaces for the
various members of the organization. This application is
easily extensible and upgradable according to the organizations need with little or no
changes. Besides all these things, the system is very useful to the organization and
customer as it enables them to interact with each other and provides them with latest
information about their business facilities.
Canteen Management System is new information system. It’s aimed at being a
reliable, efficient & user friendly, ERP (Enterprises Resource Planning) software.
Now a days many products are being prepared but their success depend upon
the information they provide. So, a software which gives relevant information , gets its
own way to success. Hence not at the present but in future too it will be more essential.
The product, CMS ( Canteen Management System ) gives the complete and relevant
information to the canteen.
With the necessity to adapt an efficient and elegant approach towards work
professionally and the need to speed up the working process becoming a requirement,
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 77/225
switching towards information technology has become the best option. Since many
Canteen System are realizing this fact, the need to
automate their systems has drawn them towards purchasing a software product, which
enhances their work speed. So any product directed towards
this segment would find a place for itself. No standard software product is offering and
gives the opportunity for the present package a mark for itself.
The software will be made in a very simple and user-friendly environment so that a
novice user can also operate it efficiently and accurately.
This software can be used by any Canteen Management System all over the INDIA after
making some tiny adjustments.
The proposed system is a much better system developed with latest technologies.
The proposed system will be less time consuming, which is what needed the Canteen
Management now a days. Since the whole system will be computerized, therefore, it
obviously has advantages over the currently prevalent system with no or less
computerization.
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 78/225
In future the proposed system will also calculate cash inflows and outflows and
will maintain profit and loss account. The system can also become more efficient by
using software to manage bar code reader information .
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 79/225
SR/NO. TITLE AUTHOR 1 Software Engineering Pressman
2 The complete reference Ivan Barose
3 C#.NET O’RELLY Tata McGraw-Hill
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 80/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 81/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 82/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 83/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 84/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 85/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 86/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 87/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 88/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 89/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 90/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 91/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 92/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 93/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 94/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 95/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 96/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 97/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 98/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 99/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 100/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 101/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 102/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 103/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 104/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 105/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 106/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 107/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 108/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 109/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 110/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 111/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 112/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 113/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 114/225
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 115/225
Connection
using System;using System.Collections.Generic;
using System.Text;using System.Data.SqlClient;
namespace Bharat_Gun_House{ class db
{ public static System.Data.SqlClient.SqlCommand com;
public static System.Data.SqlClient.SqlConnection con;public static System.Data.SqlClient.SqlDataReader dr;
public static int sid,slimit; public static stringgunid,stgunid,prona,comna,customername,licenceno,str1,str2,bhdues,rpdues; public static string admin, user; static db()
{
con = new System.Data.SqlClient.SqlConnection();con.ConnectionString = "data source=.;initial catalog=bharat;integratedsecurity=true";
com = new System.Data.SqlClient.SqlCommand();con.Open();com.Connection = con;
//com.CommandText = "select * from users"; //dr = com.ExecuteReader(); //dr.Close();
}}
}
using System;using System.Collections.Generic;using System.Text;using System.Data.SqlClient;
namespace Bharat_Gun_House{ class db
{ public static System.Data.SqlClient.SqlCommand com;
public static System.Data.SqlClient.SqlConnection con;public static System.Data.SqlClient.SqlDataReader dr;
public static int sid,slimit; public static stringgunid,stgunid,prona,comna,customername,licenceno,str1,str2,bhdues,rpdues;
public static string admin, user; static db()
{con = new System.Data.SqlClient.SqlConnection();con.ConnectionString = "data source=.;initial catalog=bharat;integrated
security=true";com = new System.Data.SqlClient.SqlCommand();con.Open();com.Connection = con;
//com.CommandText = "select * from users"; //dr = com.ExecuteReader(); //dr.Close();
}}
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 116/225
using System;using System.Collections.Generic;using System.Text;using System.Data.SqlClient;
namespace Bharat_Gun_House{ class db
{ public static System.Data.SqlClient.SqlCommand com;
public static System.Data.SqlClient.SqlConnection con;public static System.Data.SqlClient.SqlDataReader dr;
public static int sid,slimit; public static stringgunid,stgunid,prona,comna,customername,licenceno,str1,str2,bhdues,rpdues; public static string admin, user; static db()
{con = new System.Data.SqlClient.SqlConnection();con.ConnectionString = "data source=.;initial catalog=bharat;integrated
security=true";com = new System.Data.SqlClient.SqlCommand();con.Open();com.Connection = con;
//com.CommandText = "select * from users"; //dr = com.ExecuteReader(); //dr.Close();
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class btnshow : Form
{ public btnshow()
{InitializeComponent();
}
bharatDataSetTableAdapters.StockGGTableAdapter da = newBharat_Gun_House.bharatDataSetTableAdapters. StockGGTableAdapter(); String mainsql1 = "select * from priya3 where subitemsid>0 ",sql1=""; bool firsttime = true; private void FrmSearhStock_Load(object sender, EventArgs e)
{ // TODO: This line of code loads data into the 'bharatDataSet.StockGG' table.
You can move, or remove it, as needed. this.stockGGTableAdapter.Fill(this.bharatDataSet.StockGG); db.dr.Close(); db.com.CommandText = "select distinct classification as cc from priya3"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbclassification.Items.Add(db.dr["cc"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct gunname as cc from priya3"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbproductname.Items.Add(db.dr["cc"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct bore as cc from priya3"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 117/225
{ this.cmbbore.Items.Add(db.dr["cc"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct location as cc from priya3"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{
this.cmblocation.Items.Add(db.dr["cc"].ToString());}
db.dr.Close(); db.com.CommandText = "select distinct company as cc from priya3"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbcompany.Items.Add(db.dr["cc"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct Type as cc from priya3"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbtype.Items.Add(db.dr["cc"].ToString());
}
db.dr.Close();
db.com.CommandText = "select distinct Lodertype as cc from priya3"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbvariety.Items.Add(db.dr["cc"].ToString());
} db.dr.Close();
ShowData(); this.cmbclassification.SelectedIndex = 0; this.cmbcompany.SelectedIndex = 0; this.cmbbore.SelectedIndex = 0; this.cmbproductname.SelectedIndex = 0; this.cmblocation.SelectedIndex = 0; this.cmbtype.SelectedIndex = 0;
this.cmbvariety.SelectedIndex = 0;}
String GetQueryString(String query, String remove){
int pos = query.IndexOf(remove); int len = remove.Length; if (pos >= 0 && len > 0)
{ String s1 = query.Substring(0, pos); String s2 = query.Substring(pos + len); return s1 + s2;
} return query;
} void ShowData()
{
db.com.CommandText = "delete from StockGG"; db.com.ExecuteNonQuery();
bharatDataSet.StockGG.Rows.Clear(); db.com.CommandText = mainsql1 +classification +productname +bore+company+location+datepic+Type+LoderType; db.dr=db.com.ExecuteReader(); while (db.dr.Read())
{ bharatDataSet.StockGGRow row = bharatDataSet.StockGG.NewStockGGRow();
row.armsno = db.dr["armsno"].ToString();row.classification = db.dr["classification"].ToString();row.company = db.dr["company"].ToString();row.bore = Convert.ToDecimal(db.dr["bore"]);row.saddress = db.dr["saddress"].ToString();row.sname = db.dr["sname"].ToString();row.Subitemsid = Convert.ToInt32(db.dr["Subitemsid"]);row.supplierid = Convert.ToInt32(db.dr["supplierid"]);row.qty = Convert.ToInt32(db.dr["qty"]);row.purchaseprice = Convert.ToInt32(db.dr["purchaseprice"]);row.purchasedate = Convert.ToDateTime(db.dr["purchasedate"]);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 118/225
row.marketprice = Convert.ToInt32(db.dr["marketprice"]);row.location = db.dr["location"].ToString();row.gunname = db.dr["gunname"].ToString();row.Type=db.dr["Type"].ToString();row.Lodertype = db.dr["Lodertype"].ToString();row.Partyname=db.dr["Partyname"].ToString();row.Partyaddress = db.dr["Partyaddress"].ToString();bharatDataSet.StockGG.Rows.Add(row);
da.Update(bharatDataSet.StockGG);}
db.dr.Close();}
private void btnclose_Click(object sender, EventArgs e){
this.Close();}
String classification = " and classification Like '%'"; String productname = " and gunname Like '%'"; String company = " and company Like '%'"; String bore = " and bore Like '%'"; String location = " and location Like '%'"; String datepic = " and purchasedate Like '%'"; String Type = " and Type Like '%k'";
String LoderType = "and Lodertype Like '%'"; private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e){
if (this.cmbclassification.SelectedItem == "All"){
mainsql1 = GetQueryString(mainsql1, classification);classification = " and classification Like '%'";
} else
{mainsql1 = GetQueryString(mainsql1, classification);classification = " and classification='" +
this.cmbclassification.SelectedItem.ToString() + "'";}
ShowData();
this.cmbproductname.Focus();
}
private void cmbproductname_SelectedIndexChanged( object sender, EventArgs e){
if (this.cmbproductname.SelectedItem == "All"){
mainsql1 = GetQueryString(mainsql1, productname);productname = " and gunname Like '%'";
} else
{mainsql1 = GetQueryString(mainsql1, productname);productname = " and gunname='" +
this.cmbproductname.SelectedItem.ToString() + "'";
}ShowData();
this.cmbbore.Focus();}
private void cmbbore_SelectedIndexChanged( object sender, EventArgs e){
if (this.cmbbore.SelectedItem == "All"){
mainsql1 = GetQueryString(mainsql1, bore);bore = " and bore Like '%'";
} else
{mainsql1 = GetQueryString(mainsql1, bore);bore = " and bore='" + this.cmbbore.SelectedItem.ToString() + "'";
}ShowData();
this.cmbcompany.Focus();}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 119/225
private void cmbcompany_SelectedIndexChanged( object sender, EventArgs e){
if (this.cmbcompany.SelectedItem == "All"){
mainsql1 = GetQueryString(mainsql1, company);company = " and company Like '%'";
}
else{
mainsql1 = GetQueryString(mainsql1, company);company = " and company='" + this.cmbcompany.SelectedItem.ToString() +
"'";}ShowData();
this.cmblocation.Focus();}
private void cmblocation_SelectedIndexChanged( object sender, EventArgs e){
if (this.cmblocation.SelectedItem == "All"){
mainsql1 = GetQueryString(mainsql1, location);location = " and location Like '%'";
} else{
mainsql1 = GetQueryString(mainsql1, location);location = " and location='" + this.cmblocation.SelectedItem.ToString() +
"'";}ShowData();
this.datetimepic.Focus();}
private void datetimepic_ValueChanged(object sender, EventArgs e){
mainsql1 = GetQueryString(mainsql1, datepic);datepic = " and purchasedate='" +
this.datetimepic.Value.Date.ToShortDateString()+ "'";ShowData();
this.chkgun.Focus();}
String cl = " and classification Like '%'"; String pro = " and gunname Like '%'"; String br = " and bore Like '%'"; String ty = " and Type Like '%'"; void DisplayData()
{ db.com.CommandText = "delete from StockGG"; db.com.ExecuteNonQuery();
bharatDataSet.StockGG.Rows.Clear(); db.com.CommandText = mainsql1 +cl+pro+br+ty; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ bharatDataSet.StockGGRow row = bharatDataSet.StockGG.NewStockGGRow();
row.armsno = db.dr["armsno"].ToString();row.classification = db.dr["classification"].ToString();row.company = db.dr["company"].ToString();row.bore = Convert.ToDecimal(db.dr["bore"]);row.saddress = db.dr["saddress"].ToString();row.sname = db.dr["sname"].ToString();row.Subitemsid = Convert.ToInt32(db.dr["Subitemsid"]);row.supplierid = Convert.ToInt32(db.dr["supplierid"]);row.qty = Convert.ToInt32(db.dr["qty"]);row.purchaseprice = Convert.ToInt32(db.dr["purchaseprice"]);row.purchasedate = Convert.ToDateTime(db.dr["purchasedate"]);row.marketprice = Convert.ToInt32(db.dr["marketprice"]);row.location = db.dr["location"].ToString();row.gunname = db.dr["gunname"].ToString();row.Type = db.dr["Type"].ToString();row.Partyname = db.dr["Partyname"].ToString();row.Partyaddress = db.dr["Partyaddress"].ToString();bharatDataSet.StockGG.Rows.Add(row);da.Update(bharatDataSet.StockGG);
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 120/225
db.dr.Close();}
private void btncancel_Click(object sender, EventArgs e){
this.Close();}
private void chkgun_CheckedChanged(object sender, EventArgs e){
this.chkRifle.CheckState = CheckState.Unchecked; this.chkPistole.CheckState = CheckState.Unchecked; this.chkRevolver.CheckState = CheckState.Unchecked;
GetQueryString(mainsql1, pro);pro = " and gunname='"+this.chkgun.Text+"'";DisplayData();
}
private void radArms_CheckedChanged(object sender, EventArgs e){
GetQueryString(mainsql1,cl);cl = " and classification='"+this.radArms.Text+"'";DisplayData();
}
private void radAmmunation_CheckedChanged( object sender, EventArgs e){
GetQueryString(mainsql1,cl);cl = " and classification='" + this.radAmmunation.Text + "'";DisplayData();
}
private void radAcessories_CheckedChanged( object sender, EventArgs e){
GetQueryString(mainsql1, cl);cl = " and classification='" + this.radAcessories.Text + "'";DisplayData();
}
private void radbore_CheckedChanged(object sender, EventArgs e){
GetQueryString(mainsql1,br);br = " and bore Like '%'";DisplayData();
}
private void chkPistole_CheckedChanged(object sender, EventArgs e){
this.chkRifle.CheckState = CheckState.Unchecked; this.chkgun.CheckState = CheckState.Unchecked; this.chkRevolver.CheckState = CheckState.Unchecked;
GetQueryString(mainsql1, pro);pro = " and gunname='" + this.chkPistole.Text + "'";DisplayData();
}
private void chkRifle_CheckedChanged(object sender, EventArgs e)
{ this.chkgun.CheckState =CheckState.Unchecked; this.chkPistole.CheckState = CheckState.Unchecked; this.chkRevolver.CheckState = CheckState.Unchecked;
GetQueryString(mainsql1, pro);pro = " and gunname='" + this.chkRifle.Text + "'";DisplayData();
}
private void chkRevolver_CheckedChanged(object sender, EventArgs e){
this.chkRifle.CheckState = CheckState.Unchecked; this.chkPistole.CheckState = CheckState.Unchecked; this.chkgun.CheckState = CheckState.Unchecked;
GetQueryString(mainsql1, pro);pro = " and gunname='" + this.chkRevolver.Text + "'";DisplayData();
}
private void chkgun_KeyPress(object sender, KeyPressEventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 121/225
{ if (e.KeyChar==32)
{ this.chkPistole.Focus();
}}
private void cmbtype_SelectedIndexChanged( object sender, EventArgs e)
{ if (this.cmbtype.SelectedItem == "All")
{mainsql1 = GetQueryString(mainsql1,Type);Type = " and Type Like '%'";
} else
{mainsql1 = GetQueryString(mainsql1, Type);Type = " and Type='" + this.cmbtype.SelectedItem.ToString() + "'";
}ShowData();
}
private void radtype_CheckedChanged(object sender, EventArgs e){
GetQueryString(mainsql1, ty);ty = " and Type Like '%'";DisplayData();
}
private void cmbvariety_SelectedIndexChanged( object sender, EventArgs e){
if (this.cmbvariety.SelectedItem == "All"){
mainsql1 = GetQueryString(mainsql1, LoderType);LoderType = " and Lodertype Like '%'";
} else
{mainsql1 = GetQueryString(mainsql1, LoderType);LoderType = " and Lodertype='" + this.cmbvariety.SelectedItem.ToString() +
"'";
}ShowData();
}
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class ConsinmentAccept : Form
{ public ConsinmentAccept()
{InitializeComponent();
} int quantity,supid=0,qty,useqty=0,remainqty=0,returnqty=0,cnt,bcnt; string dtr=""; private void btnsave_Click(object sender, EventArgs e)
{ try
{ db.com.CommandText = "select sum(qty) from productinsert where armsno!=''";
cnt = Convert.ToInt32(db.com.ExecuteScalar());}
catch { cnt = 0; }
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 122/225
try{
if (cnt <= 1000){
db.com.CommandText = "SELECT sum(qty) FROM PRODUCTINSERT WHERE bore>0and armsno=''";
bcnt = Convert.ToInt32(db.com.ExecuteScalar()); if (bcnt <= 1000)
{ db.com.CommandText = "select * from productinsert whereClassification='" + this.cmbclassification.Text + "' and gunname='" + this.cmbpna.Text +"' and bore='" + this.cmbbty.Text + "' and type='" + this.cmbType.Text + "' and company='"+ this.txtcna.Text + "'and armsno='"+this.txtpno.Text+"'andlodertype='"+this.cmbvariety.Text+"'"; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ db.dr.Close();
qty = Convert.ToInt32(this.numericqty.Value); db.com.CommandText = "insert into productinsert values(" + Sno+ "," + SubitemID + ",'" + this.txtpno.Text + "','" + this.cmbpna.Text + "','" +this.txtcna.Text + "'," + this.cmbbty.Text + ",'" + this.cmbType.Text +"','"+this.cmbvariety.Text+"'," + this.txtprs.Text + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + supid + "," + PartyID + "," +
this.numericqty.Value + ",'" + this.cmbclassification.Text + "'," + this.txtmprice.Text +",'" + this.txtLocation.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into ConsignmentReceive values("+ ConsignmentID + "," + PartyID + "," + ItemID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + ")"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into Consignmentdetail values(" +ConsignmentID + "," + PartyID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + "," + useqty +"," + qty + ",'" + dtr + "'," + returnqty + ")"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.cmbbty.Text = ""; this.cmbclassification.Text = ""; this.cmbpartyname.Text = ""; this.cmbpna.Text = "";
this.cmbType.Text = ""; this.txtaddress.Text = ""; this.txtcna.Text = ""; this.txtLocation.Text = ""; this.txtmprice.Text = ""; this.txtpno.Text = ""; this.txtprs.Text = ""; this.cmbvariety.Text = ""; this.cmbbty.Enabled = false; this.cmbpna.Enabled = false; this.cmbclassification.Enabled = false; this.txtcna.Enabled = false; this.datere.Enabled = false; this.txtpno.Enabled = false; this.txtprs.Enabled = false; this.txtaddress.Enabled = false;
this.cmbpartyname.Enabled = false; this.numericqty.Enabled = false; this.cmbType.Enabled = false; this.cmbvariety.Enabled = false;
} else
{ db.dr.Close(); db.com.CommandText = "insert into productinsert values(" + Sno+ "," + SubitemID + ",'" + this.txtpno.Text + "','" + this.cmbpna.Text + "','" +this.txtcna.Text + "'," + this.cmbbty.Text + ",'" + this.cmbType.Text +"','"+this.cmbvariety.Text+"'," + this.txtprs.Text + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + supid + "," + PartyID + "," +this.numericqty.Value + ",'" + this.cmbclassification.Text + "'," + this.txtmprice.Text +",'" + this.txtLocation.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into ConsignmentReceive values("+ ConsignmentID + "," + PartyID + "," + ItemID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + ")";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 123/225
db.com.ExecuteNonQuery(); db.com.CommandText = "insert into Consignmentdetail values(" +ConsignmentID + "," + PartyID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + "," + useqty +"," + remainqty + ",'" + dtr + "'," + returnqty + ")"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.cmbbty.Text = "";
this.cmbclassification.Text = ""; this.cmbpartyname.Text = ""; this.cmbpna.Text = ""; this.cmbType.Text = ""; this.txtaddress.Text = ""; this.txtcna.Text = ""; this.txtLocation.Text = ""; this.txtmprice.Text = ""; this.txtpno.Text = ""; this.txtprs.Text = ""; this.numericqty.Value = 1; this.cmbbty.Enabled = false; this.cmbpna.Enabled = false; this.cmbclassification.Enabled = false; this.txtcna.Enabled = false; this.datere.Enabled = false;
this.txtpno.Enabled = false; this.txtprs.Enabled = false; this.txtaddress.Enabled = false; this.cmbpartyname.Enabled = false; this.numericqty.Enabled = false;
}
} else
{ MessageBox.Show("BULLETS LIMIT EXEED :-" + bcnt.ToString()); db.com.CommandText = "select * from productinsert whereClassification='" + this.cmbclassification.Text + "' and gunname='" + this.cmbpna.Text +"' and bore='" + this.cmbbty.Text + "' and type='" + this.cmbType.Text + "' and company='"+ this.txtcna.Text + "'and armsno='"+this.txtpno.Text+"'andlodertype='"+this.cmbvariety.Text+"'";
db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ db.dr.Close();
qty = Convert.ToInt32(this.numericqty.Value); db.com.CommandText = "insert into productinsert values(" + Sno+ "," + SubitemID + ",'" + this.txtpno.Text + "','" + this.cmbpna.Text + "','" +this.txtcna.Text + "'," + this.cmbbty.Text + ",'" + this.cmbType.Text +"','"+this.cmbvariety.Text+"'," + this.txtprs.Text + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + supid + "," + PartyID + "," +this.numericqty.Value + ",'" + this.cmbclassification.Text + "'," + this.txtmprice.Text +",'" + this.txtLocation.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into ConsignmentReceive values("+ ConsignmentID + "," + PartyID + "," + ItemID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + ")";
db.com.ExecuteNonQuery(); db.com.CommandText = "insert into Consignmentdetail values(" +ConsignmentID + "," + PartyID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + "," + useqty +"," + qty + ",'" + dtr + "'," + returnqty + ")"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.cmbbty.Text = ""; this.cmbclassification.Text = ""; this.cmbpartyname.Text = ""; this.cmbpna.Text = ""; this.cmbType.Text = ""; this.txtaddress.Text = ""; this.txtcna.Text = ""; this.txtLocation.Text = ""; this.txtmprice.Text = ""; this.txtpno.Text = ""; this.txtprs.Text = ""; this.cmbbty.Enabled = false; this.cmbpna.Enabled = false;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 124/225
this.cmbclassification.Enabled = false; this.txtcna.Enabled = false; this.datere.Enabled = false; this.txtpno.Enabled = false; this.txtprs.Enabled = false; this.txtaddress.Enabled = false; this.cmbpartyname.Enabled = false; this.numericqty.Enabled = false;
this.cmbType.Enabled = false;
} else
{ db.dr.Close(); db.com.CommandText = "insert into productinsert values(" + Sno+ "," + SubitemID + ",'" + this.txtpno.Text + "','" + this.cmbpna.Text + "','" +this.txtcna.Text + "'," + this.cmbbty.Text + ",'" + this.cmbType.Text +"','"+this.cmbvariety.Text+"'," + this.txtprs.Text + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + supid + "," + PartyID + "," +this.numericqty.Value + ",'" + this.cmbclassification.Text + "'," + this.txtmprice.Text +",'" + this.txtLocation.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into ConsignmentReceive values("+ ConsignmentID + "," + PartyID + "," + ItemID + "," + SubitemID + ",'" +
this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + ")"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into Consignmentdetail values(" +ConsignmentID + "," + PartyID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + "," + useqty +"," + remainqty + ",'" + dtr + "'," + returnqty + ")"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.cmbbty.Text = ""; this.cmbclassification.Text = ""; this.cmbpartyname.Text = ""; this.cmbpna.Text = ""; this.cmbType.Text = ""; this.txtaddress.Text = ""; this.txtcna.Text = ""; this.txtLocation.Text = ""; this.txtmprice.Text = "";
this.txtpno.Text = ""; this.txtprs.Text = ""; this.numericqty.Value = 1; this.cmbbty.Enabled = false; this.cmbpna.Enabled = false; this.cmbclassification.Enabled = false; this.txtcna.Enabled = false; this.datere.Enabled = false; this.txtpno.Enabled = false; this.txtprs.Enabled = false; this.txtaddress.Enabled = false; this.cmbpartyname.Enabled = false; this.numericqty.Enabled = false;
}}
} else
{ MessageBox.Show("Limit Exeed :-" + cnt.ToString()); db.com.CommandText = "select * from productinsert whereClassification='" + this.cmbclassification.Text + "' and gunname='" + this.cmbpna.Text +"' and bore='" + this.cmbbty.Text + "' and type='" + this.cmbType.Text + "' and company='"+ this.txtcna.Text + "'and armsno='"+this.txtpno.Text+"'andlodertype='"+this.cmbvariety.Text+"'"; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ db.dr.Close();
qty = Convert.ToInt32(this.numericqty.Value); db.com.CommandText = "insert into productinsert values(" + Sno +"," + SubitemID + ",'" + this.txtpno.Text + "','" + this.cmbpna.Text + "','" +this.txtcna.Text + "'," + this.cmbbty.Text + ",'" + this.cmbType.Text +"','"+this.cmbvariety.Text+"'," + this.txtprs.Text + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + supid + "," + PartyID + "," +
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 125/225
this.numericqty.Value + ",'" + this.cmbclassification.Text + "'," + this.txtmprice.Text +",'" + this.txtLocation.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into ConsignmentReceive values(" +ConsignmentID + "," + PartyID + "," + ItemID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + ")"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into Consignmentdetail values(" +
ConsignmentID + "," + PartyID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + "," + useqty +"," + qty + ",'" + dtr + "'," + returnqty + ")"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.cmbbty.Text = ""; this.cmbclassification.Text = ""; this.cmbpartyname.Text = ""; this.cmbpna.Text = ""; this.cmbType.Text = ""; this.txtaddress.Text = ""; this.txtcna.Text = ""; this.txtLocation.Text = ""; this.txtmprice.Text = ""; this.txtpno.Text = ""; this.txtprs.Text = "";
this.cmbbty.Enabled = false; this.cmbpna.Enabled = false; this.cmbclassification.Enabled = false; this.txtcna.Enabled = false; this.datere.Enabled = false; this.txtpno.Enabled = false; this.txtprs.Enabled = false; this.txtaddress.Enabled = false; this.cmbpartyname.Enabled = false; this.numericqty.Enabled = false; this.cmbType.Enabled = false;
} else
{ db.dr.Close(); db.com.CommandText = "insert into productinsert values(" + Sno +
"," + SubitemID + ",'" + this.txtpno.Text + "','" + this.cmbpna.Text + "','" +this.txtcna.Text + "'," + this.cmbbty.Text + ",'" + this.cmbType.Text +"','"+this.cmbvariety.Text+"'," + this.txtprs.Text + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + supid + "," + PartyID + "," +this.numericqty.Value + ",'" + this.cmbclassification.Text + "'," + this.txtmprice.Text +",'" + this.txtLocation.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into ConsignmentReceive values(" +ConsignmentID + "," + PartyID + "," + ItemID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + ")"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into Consignmentdetail values(" +ConsignmentID + "," + PartyID + "," + SubitemID + ",'" +this.datere.Value.Date.ToShortDateString() + "'," + this.numericqty.Value + "," + useqty +"," + remainqty + ",'" + dtr + "'," + returnqty + ")"; db.com.ExecuteNonQuery();
MessageBox.Show("Record Inserted"); this.cmbbty.Text = ""; this.cmbclassification.Text = ""; this.cmbpartyname.Text = ""; this.cmbpna.Text = ""; this.cmbType.Text = ""; this.txtaddress.Text = ""; this.txtcna.Text = ""; this.txtLocation.Text = ""; this.txtmprice.Text = ""; this.txtpno.Text = ""; this.txtprs.Text = ""; this.numericqty.Value = 1; this.cmbbty.Enabled = false; this.cmbpna.Enabled = false; this.cmbclassification.Enabled = false; this.txtcna.Enabled = false; this.datere.Enabled = false; this.txtpno.Enabled = false; this.txtprs.Enabled = false;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 126/225
this.txtaddress.Enabled = false; this.cmbpartyname.Enabled = false; this.numericqty.Enabled = false;
}}
} catch (Exception ee) { MessageBox.Show(ee.ToString()); }
} string consin; int cons,Sno,ConsignmentID; private void ConsinmentAccept_Load(object sender, EventArgs e)
{this.cmbbty.Enabled = false;
this.cmbpna.Enabled = false; this.cmbclassification.Enabled = false; this.txtcna.Enabled = false; this.datere.Enabled = false; this.txtpno.Enabled = false; this.txtprs.Enabled = false; this.txtaddress.Enabled = false; this.cmbpartyname.Enabled = false; this.numericqty.Enabled = false; this.cmbpartyname.Enabled = false;
this.cmbType.Enabled = false; this.txtLocation.Enabled = false; this.txtaddress.Enabled = false; this.txtmprice.Enabled = false; this.cmbvariety.Enabled = false; try
{ db.dr.Close(); db.com.CommandText = "select distinct ITEMNAME as aa from ITEMS"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if(db.dr["aa"].ToString()!="") this.cmbclassification.Items.Add(db.dr["aa"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct bore as bb from productinsert";
db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["bb"].ToString() != "") this.cmbbty.Items.Add(db.dr["bb"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct ITEMNAME as cc from SUBITEM"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["cc"].ToString() != "") this.cmbpna.Items.Add(db.dr["cc"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct company as dd from productinsert";
db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["dd"].ToString() != "") this.txtcna.Items.Add(db.dr["dd"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct partyname as par from party"; db.dr = db.com.ExecuteReader(); while(db.dr.Read())
{ if (db.dr["par"].ToString() != "") this.cmbpartyname.Items.Add(db.dr["par"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct type as dd from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["dd"].ToString() != "")
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 127/225
this.cmbType.Items.Add(db.dr["dd"].ToString());}
db.dr.Close();
db.com.CommandText = "select distinct lodertype as dd from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{
if (db.dr["dd"].ToString() != "") this.cmbvariety.Items.Add(db.dr["dd"].ToString());
} db.dr.Close();
db.com.CommandText = "select max(Sno)from productinsert";Sno = Convert.ToInt32(db.com.ExecuteScalar());
db.com.CommandText = "select max(ConsignmentID)from ConsignmentReceive";ConsignmentID = Convert.ToInt32(db.com.ExecuteScalar());
}
catch {ConsignmentID = 0;
}}
private void btncl_Click(object sender, EventArgs e){
this.Close();}
private void btnadd_Click(object sender, EventArgs e){
this.cmbbty.Enabled = true; this.cmbpna.Enabled = true; this.cmbclassification.Enabled = true; this.txtcna.Enabled = true; this.datere.Enabled = true; this.txtpno.Enabled = true; this.txtprs.Enabled = true;
this.txtaddress.Enabled = true; this.cmbpartyname.Enabled = true; this.numericqty.Enabled = true; this.cmbpartyname.Enabled = true; this.cmbType.Enabled = true; this.txtLocation.Enabled = true; this.txtaddress.Enabled = true;
this.txtmprice.Enabled= true; this.cmbvariety.Enabled = true;
Sno++;ConsignmentID++;
}
private void linkLimit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e){
SetLimit sl = new SetLimit();sl.Show();
this.Hide();}
private void btnref_Click(object sender, EventArgs e){
db.com.CommandText = "select * from Limit "; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ db.slimit = Convert.ToInt32(db.dr[0].ToString());
} db.dr.Close();
}
private void Linknewuser_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 128/225
FrmSupplier sup = new FrmSupplier();sup.Show();
} int PartyID,ItemID; private void cmbpartyname_SelectedIndexChanged( object sender, EventArgs e)
{ db.com.CommandText = "select * from party wherePartyName='"+this.cmbpartyname.Text+"'";
db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ this.txtaddress.Text = db.dr["PartyAddress"].ToString();
PartyID = Convert.ToInt32(db.dr["PartyID"]);}
db.dr.Close(); this.datere.Focus();
} int SubitemID; private void cmbpna_SelectedIndexChanged(object sender, EventArgs e)
{ db.com.CommandText = "select SubitemsID from Subitem whereItemName='"+this.cmbpna.Text+"'";
SubitemID = Convert.ToInt32(db.com.ExecuteScalar()); this.cmbbty.Focus();
}
private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e){
try{
db.com.CommandText = "select itemId from Items where ItemName='" +this.cmbclassification.Text + "'";
ItemID = Convert.ToInt32(db.com.ExecuteScalar()); this.cmbpna.Focus();
} catch { }
}
private void cmbbty_SelectedIndexChanged(object sender, EventArgs e){
this.cmbType.Focus();
}
private void cmbType_SelectedIndexChanged( object sender, EventArgs e){
this.cmbvariety.Focus();}
private void txtcna_SelectedIndexChanged(object sender, EventArgs e){
this.cmbpartyname.Focus();}
private void datere_ValueChanged(object sender, EventArgs e){
this.txtprs.Focus();}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ FrmParty par = new FrmParty();
par.Show(); this.Close();
}
private void txtprs_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter){
this.txtmprice.Focus();}
}
private void txtmprice_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter){
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 129/225
this.txtpno.Focus();}
}
private void txtpno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter){
this.numericqty.Focus();}
}
private void numericqty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter){
this.txtLocation.Focus();}
}
private void txtLocation_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter){
this.btnsave.Focus();}}
private void txtaddress_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter){
}
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ FrmConsignmentedit edt = new FrmConsignmentedit();
edt.Show();
this.Close();}
private void txtprs_KeyDown_1(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtmprice.Focus();
}
private void txtmprice_KeyDown_1(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpno.Focus();
} private void cmbvariety_SelectedIndexChanged( object sender, EventArgs e)
{
this.txtcna.Focus();}
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmConsignmentedit : Form
{ public FrmConsignmentedit()
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 130/225
{InitializeComponent();
} int sn; private void FrmConsignmentedit_Load(object sender, EventArgs e)
{ try
{
db.com.CommandText = "delete from receivedetail"; db.com.ExecuteNonQuery(); db.com.CommandText = "Select * from consignment_view"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (Convert.ToInt32(db.dr["sno"])!= sn)
{ bharatDataSet.receivedetailRow r =bharatDataSet.receivedetail.NewreceivedetailRow();
r.Sno = Convert.ToInt32(db.dr["sno"]);sn = Convert.ToInt32(db.dr["sno"]);r.subitemsid = Convert.ToInt32(db.dr["subitemsid"]);r.consignmentid = Convert.ToInt32(db.dr["consignmentid"]);r.armsno = db.dr["armsno"].ToString();r.bore = Convert.ToDecimal(db.dr["bore"]);
r.classification = db.dr["classification"].ToString();r.company = db.dr["company"].ToString();r.gunname = db.dr["gunname"].ToString();r.location = db.dr["location"].ToString();r.Lodertype = db.dr["Lodertype"].ToString();r.marketprice = Convert.ToInt32(db.dr["marketprice"]);r.partyaddress = db.dr["partyaddress"].ToString();r.partyid = Convert.ToInt32(db.dr["partyid"]);r.partyname = db.dr["partyname"].ToString();r.qty = Convert.ToInt32(db.dr["qty"].ToString());r.receivedate = db.dr["conreceivedate"].ToString();r.type = db.dr["Type"].ToString();r.useqty = Convert.ToInt32(db.dr["useqty"]);r.remainingqty = Convert.ToInt32(db.dr[14]);bharatDataSet.receivedetail.Rows.Add(r);receivedetailTableAdapter.Update(bharatDataSet.receivedetail);
}
} db.dr.Close();}
catch (Exception ee) { MessageBox.Show(ee.ToString()); }}
int subitemsid,partyid,sno,conid; string str; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{ try
{sno = Convert.ToInt32(this.dataGridView2.Rows[e.RowIndex].Cells[0].Value);
db.com.CommandText = "select * from receivedetail where sno="+sno+""; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ this.txtpno.Text = db.dr["armsno"].ToString();
this.txtbore.Text = db.dr["bore"].ToString(); this.txtcn.Text = db.dr["company"].ToString(); this.txtloca.Text = db.dr["location"].ToString(); this.txtmprice.Text =Convert.ToInt32(db.dr["marketprice"]).ToString(); this.txtaddr.Text = db.dr["partyaddress"].ToString(); this.txtpname.Text = db.dr["partyname"].ToString(); this.txtprona.Text = db.dr["gunname"].ToString(); this.txtclassi.Text = db.dr["classification"].ToString(); this.txtqt.Text = Convert.ToInt32(db.dr["qty"]).ToString(); this.txtdate.Text = db.dr["receivedate"].ToString();
subitemsid = Convert.ToInt32(db.dr["subitemsid"]); this.txtty.Text = db.dr["Type"].ToString();
partyid = Convert.ToInt32(db.dr["partyid"]);conid = Convert.ToInt32(db.dr["consignmentid"]);
this.txtuse.Text = db.dr["useqty"].ToString(); this.txtremain.Text = db.dr[14].ToString(); this.txtvariety.Text = db.dr["Lodertype"].ToString();
} db.dr.Close();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 131/225
} catch (Exception ee) { MessageBox.Show(ee.ToString()); }
}
private void btncan_Click(object sender, EventArgs e){
this.Close(); ConsinmentAccept cn = new ConsinmentAccept();
cn.Show();}
private void btndit_Click(object sender, EventArgs e){
try{
db.com.CommandText = "select itemid from items where itemname='" +this.txtclassi.Text + "'"; int itemid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "select partyid from party where partyname='" +this.txtpname.Text + "'and partyaddress='" + this.txtaddr.Text + "'"; int pid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "select subitemsid from subitem where itemname='" +this.txtprona.Text + "'"; int sid = Convert.ToInt32(db.com.ExecuteScalar());
db.com.CommandText = "update productinsert set classification='" +this.txtclassi.Text + "',armsno='" + this.txtpno.Text + "',bore='" + this.txtbore.Text +"',type='" + this.txtty.Text + "',Lodertype='"+this.txtvariety.Text+"',company='" +this.txtcn.Text + "',gunname='" + this.txtprona.Text + "', location='" + this.txtloca.Text+ "',marketprice=" + this.txtmprice.Text + ",partyid=" + partyid + ",subitemsid=" + sid +" where sno=" + sno + ""; db.com.ExecuteNonQuery(); db.com.CommandText = "Update consignmentreceive set partyid=" + pid +",subitemsid=" + sid + ",CONRECEIVEDATE='" + this.txtdate.Text + "',qty=" +this.txtqt.Text + ",itemid=" + itemid + " where consignmentid=" + conid + ""; db.com.ExecuteNonQuery(); db.com.CommandText = "Update consignmentdetail set partyid=" + pid +",subitemid=" + sid + ",RECEIVEDATE='" + this.txtdate.Text + "',qty=" + this.txtqt.Text +",useqty=" + this.txtuse.Text + ",remainingqty=" + this.txtremain.Text + " whereconsignmentid=" + conid + ""; db.com.ExecuteNonQuery(); MessageBox.Show("Record Updated");
this.Close(); FrmConsignmentedit edt = new FrmConsignmentedit();
edt.Show();}
catch { }}
private void btndel_Click(object sender, EventArgs e){
try{
DialogResult DR = MessageBox.Show("Are You Sure", "Delete",MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DR == DialogResult.Yes)
{ db.com.CommandText = "delete from productinsert where sno=" + sno +
""; db.com.ExecuteNonQuery(); db.com.CommandText = "delete from consignmentreceive whereconsignmentid=" + conid + ""; db.com.ExecuteNonQuery(); db.com.CommandText = "delete from consignmentdetail whereconsignmentid=" + conid + ""; db.com.ExecuteNonQuery();
}}
catch { }}
private void txtclassi_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtprona.Focus();
}
private void txtprona_KeyDown(object sender, KeyEventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 132/225
{ if (e.KeyCode == Keys.Enter) this.txtbore.Focus();
}
private void txtbore_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.txtty.Focus();}
private void txtty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtvariety.Focus();
}
private void txtcn_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpname.Focus();
}
private void txtpname_KeyDown(object sender, KeyEventArgs e)
{ if (e.KeyCode == Keys.Enter) this.txtdate.Focus();
}
private void txtdate_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtmprice.Focus();
}
private void txtmprice_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpno.Focus();
}
private void txtpno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtqt.Focus();
}
private void txtqt_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtuse.Focus();
}
private void txtuse_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtremain.Focus();
}
private void txtremain_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtloca.Focus();
}
private void txtloca_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtaddr.Focus();
}
private void txtaddr_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btndit.Focus();
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 133/225
private void txtvariety_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtcn.Focus();
}
}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class Returncon : Form
{ public Returncon()
{InitializeComponent();
} private void Returncon_Load(object sender, EventArgs e)
{ this.cmbpna.Enabled = false; this.cmbclassification.Enabled = false; this.cmbbore.Enabled = false; this.datere.Enabled = false; this.cmbcna.Enabled = false; this.txtprs.Enabled = false; this.txtarmsno.Enabled = false; this.cmbparty.Enabled = false; this.cmbtype.Enabled = false; this.txtaddress.Enabled = false; this.txtmaprice.Enabled = false; this.numericqty.Value = 1; this.numericqty.Enabled = false; this.cmbparty.Enabled = false; this.cmbvariety.Enabled = false;
db.com.CommandText = "select itemname from Subitem"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if(db.dr["itemname"].ToString()!="") this.cmbpna.Items.Add(db.dr["itemname"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct itemname as it from items "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if(db.dr["it"].ToString()!="") this.cmbclassification.Items.Add(db.dr["it"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct bore as cc from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 134/225
if (db.dr["cc"].ToString() != "") this.cmbbore.Items.Add(db.dr["cc"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct company as dd from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{
if (db.dr["dd"].ToString() != "") this.cmbcna.Items.Add(db.dr["dd"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct Type as ty from productinsert"; db.dr=db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["ty"].ToString() != "") this.cmbtype.Items.Add(db.dr["ty"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct LoderType as ty from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["ty"].ToString() != "") this.cmbvariety.Items.Add(db.dr["ty"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct partyname as ty from party"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["ty"].ToString() != "") this.cmbparty.Items.Add(db.dr["ty"].ToString());
} db.dr.Close();
} private void btncl_Click(object sender, EventArgs e)
{
this.Close();}
int mqty,pty,pid,qqty; private void btnsave_Click(object sender, EventArgs e)
{ try
{ db.com.CommandText = "select partyid from party where partyname='" +this.cmbparty.Text + "'and partyaddress='" + this.txtaddress.Text + "'";
pid = Convert.ToInt32(db.com.ExecuteScalar());}
catch { } try
{ db.com.CommandText = "select qty from productinsert whereclassification='" + this.cmbclassification.Text + "'and gunname='" + this.cmbpna.Text +
"'and bore='" + this.cmbbore.Text + "' and company='" + this.cmbcna.Text + "'and type='" +this.cmbtype.Text + "'and armsno='" + this.txtarmsno.Text + "'";
qqty = Convert.ToInt32(db.com.ExecuteScalar()); if (qqty >=1)
{ db.com.CommandText = "insert into GivenStock values(" + sn + "," + pid+ ",'" + this.txtarmsno.Text + "','" + this.cmbparty.Text + "','" + this.txtaddress.Text +"','" + this.cmbclassification.Text + "','" + this.cmbpna.Text + "','" + this.cmbbore.Text+ "','" + this.cmbtype.Text + "','"+this.cmbvariety.Text+"','" + this.cmbcna.Text + "','"+ this.datere.Value.Date.ToShortDateString() + "'," + this.txtprs.Text + "," +this.txtmaprice.Text + "," + this.numericqty.Value + ")"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); db.com.CommandText = "update productinsert set qty=qty-" +this.numericqty.Value + " where classification='" + this.cmbclassification.Text + "'andgunname='" + this.cmbpna.Text + "'and bore=" + this.cmbbore.Text + "and company='" +this.cmbcna.Text + "'and type='" + this.cmbtype.Text + "'and armsno='" +this.txtarmsno.Text + "'and lodertype='"+this.cmbvariety.Text+"'"; db.com.ExecuteNonQuery(); this.cmbpna.Text = "";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 135/225
this.cmbcna.Text = ""; this.txtprs.Text = ""; this.cmbparty.Text = ""; this.txtmaprice.Text = ""; this.cmbtype.Text = ""; this.cmbclassification.Text = ""; this.cmbbore.Text = ""; this.numericqty.Value = 1;
this.txtarmsno.Text = ""; this.cmbvariety.Text = "";
} else
{ MessageBox.Show("Sorry Record does not exist in the Stock"); }}
catch { MessageBox.Show("Record does not exist"); }}
private void btncl_Click_1(object sender, EventArgs e){
this.Close();}
int sn; private void btnadd_Click(object sender, EventArgs e)
{ try
{ db.com.CommandText = "select max(sno)+1 from GivenStock";sn = Convert.ToInt32(db.com.ExecuteScalar());
} catch { sn = 1; } this.cmbpna.Enabled = true; this.cmbclassification.Enabled = true; this.cmbbore.Enabled = true; this.datere.Enabled = true; this.cmbcna.Enabled = true; this.txtprs.Enabled = true; this.txtarmsno.Enabled = true; this.cmbparty.Enabled = true; this.cmbtype.Enabled = true; this.txtmaprice.Enabled = true; this.numericqty.Enabled = true; this.cmbparty.Enabled = true;
this.cmbvariety.Enabled = true;}
private void btnref_Click(object sender, EventArgs e){
db.com.CommandText = "select distinct productna as aa from consinmentreturn"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbpna.Items.Add(db.dr["aa"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct productty as bb from consinmentreturn "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbclassification.Items.Add(db.dr["bb"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct borety as cc from consinmentreturn "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbbore.Items.Add(db.dr["cc"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct companyna as dd from consinmentreturn "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbcna.Items.Add(db.dr["dd"].ToString());
} db.dr.Close();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 136/225
} private void txtarmsno_KeyDown(object sender, KeyEventArgs e)
{ if (e.KeyCode == Keys.Enter) this.cmbclassification.Focus();
}
private void cmbpna_SelectedIndexChanged(object sender, EventArgs e)
{ this.cmbbore.Focus();
}
private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e){
this.cmbpna.Focus();}
private void cmbbore_SelectedIndexChanged( object sender, EventArgs e){
this.cmbtype.Focus();}
private void cmbtype_SelectedIndexChanged( object sender, EventArgs e){
this.cmbparty.Focus();}
private void cmbcna_SelectedIndexChanged(object sender, EventArgs e){
this.txtprs.Focus();}
private void txtprs_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtmaprice.Focus();
}
private void txtmaprice_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.datere.Focus();
}
private void datere_ValueChanged(object sender, EventArgs e){
this.numericqty.Focus();}
private void numericqty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnsave.Focus();
}
private void button1_Click(object sender, EventArgs e){
FrmGivenStockEdit gsedt = new FrmGivenStockEdit();
gsedt.Show(); this.Close();
}
private void cmbparty_SelectedIndexChanged( object sender, EventArgs e){
db.com.CommandText = "select partyaddress from party where partyname='" +this.cmbparty.Text + "'"; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ this.txtaddress.Text = db.dr["partyaddress"].ToString();
} db.dr.Close(); this.cmbcna.Focus();
}}
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 137/225
using System;using System.Collections.Generic;
using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmGivenStockEdit : Form
{ public FrmGivenStockEdit()
{InitializeComponent();
}
private void FrmGivenStockEdit_Load(object sender, EventArgs e)
{ // TODO: This line of code loads data into the 'bharatDataSet.GivenStock'table. You can move, or remove it, as needed. this.givenStockTableAdapter.Fill(this.bharatDataSet.GivenStock);
} int snum; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{ try
{snum =
Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value); db.com.CommandText = "select * from givenstock where sno=" + snum + ""; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{
this.txtarmsno.Text = db.dr["armsno"].ToString(); this.txtclassification.Text = db.dr["classification"].ToString(); this.txtproductname.Text = db.dr["gunname"].ToString(); this.txtbore.Text = db.dr["bore"].ToString(); this.txttype.Text = db.dr["type"].ToString(); this.txtvariety.Text = db.dr["lodertype"].ToString(); this.txtcompany.Text = db.dr["company"].ToString(); this.txtparty.Text = db.dr["name"].ToString(); this.txtaddress.Text = db.dr["address"].ToString(); this.txtprs.Text = db.dr["productprice"].ToString(); this.txtmaprice.Text = db.dr["marketprice"].ToString(); this.txtqty.Text = db.dr["qty"].ToString(); this.txtdate.Text = db.dr["givendate"].ToString();
} db.dr.Close();}
catch { }
}
private void btnexit_Click(object sender, EventArgs e){
this.Close(); Returncon rcn = new Returncon();
rcn.Show();}
int parid; private void btnedit_Click(object sender, EventArgs e)
{ db.com.CommandText = "select partyid from party wherepartyname='"+this.txtparty.Text+"'and partyaddress='"+this.txtaddress.Text+"'";
parid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "update givenstock setpartyid="+parid+",classification='"+this.txtclassification.Text+"',company='"+this.txtcompany.Text+"',gunname='"+this.txtproductname.Text+"',bore='"+this.txtbore.Text+"',type='"+this.txttype.Text+"',lodertype='"+this.txtvariety.Text+"',armsno='"+this.txtarmsno.Text+"',name='"+this.txtparty.Text+"',address='"+this.txtaddress.Text+"',productprice="+this.txtprs
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 138/225
.Text+",marketprice="+this.txtmaprice.Text+",givendate='"+this.txtdate.Text+"',qty="+this.txtqty.Text+" where sno="+snum+""; db.com.ExecuteNonQuery(); db.com.CommandText = "update productinsert set qty=qty-" + this.txtqty.Text +" where classification='" + this.txtclassification.Text + "'and gunname='" +this.txtproductname.Text + "'and bore='" + this.txtbore.Text + "'and company='" +this.txtcompany.Text + "'and type='" + this.txttype.Text + "'and armsno='" +this.txtarmsno.Text + "'and lodertype='"+this.txtvariety.Text+"'";
db.com.ExecuteNonQuery(); MessageBox.Show("Record Updated"); this.Close(); FrmGivenStockEdit cnedit = new FrmGivenStockEdit();
cnedit.Show();}
private void btndelete_Click(object sender, EventArgs e){
DialogResult dr = MessageBox.Show("Are youSure ?","Delete",MessageBoxButtons.YesNo,MessageBoxIcon.Question); if (dr == DialogResult.Yes)
{ db.com.CommandText = "update productinsert set qty=qty+" +this.txtqty.Text + " where classification='" + this.txtclassification.Text + "'andgunname='" + this.txtproductname.Text + "'and bore='" + this.txtbore.Text + "'and
company='" + this.txtcompany.Text + "'and type='" + this.txttype.Text + "'and armsno='" +this.txtarmsno.Text + "'and lodertype='"+this.txtvariety.Text+"'"; db.com.ExecuteNonQuery(); db.com.CommandText = "delete from givenstock where sno=" + snum + ""; db.com.ExecuteNonQuery(); this.Close(); FrmGivenStockEdit gedit = new FrmGivenStockEdit();
gedit.Show();}
}
private void txtarmsno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtclassification.Focus();
}
private void txtclassification_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtproductname.Focus();
}
private void txtproductname_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtbore.Focus();
}
private void txtbore_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txttype.Focus();
}
private void txttype_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtparty.Focus();
}
private void txtparty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtcompany.Focus();
}
private void txtcompany_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtprs.Focus();
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 139/225
private void txtprs_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtmaprice.Focus();
}
private void txtmaprice_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtdate.Focus();
}
private void txtdate_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtqty.Focus();
}
private void txtqty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtaddress.Focus();
}
private void txtaddress_KeyDown(object sender, KeyEventArgs e){ if (e.KeyCode == Keys.Enter) this.btnedit.Focus();
}}
}
using System;
using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class frmReceiveOwnData : Form
{ public frmReceiveOwnData()
{InitializeComponent();
} private void frmReceiveOwnData_Load(object sender, EventArgs e)
{ // TODO: This line of code loads data into the 'bharatDataSet.GivenStock'table. You can move, or remove it, as needed. this.givenStockTableAdapter.Fill(this.bharatDataSet.GivenStock);
} string arno, cl, co, gn,ty,lo; int qqty; decimal br; private void btnsave_Click(object sender, EventArgs e)
{ DialogResult dr = MessageBox.Show("Are You Sure To ReceiveData ?","Data",MessageBoxButtons.YesNo,MessageBoxIcon.Question); if (dr == DialogResult.Yes)
{ try
{ db.com.CommandText = "select * from GivenStock where sno=" + sn + ""; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 140/225
bharatDataSet.ReturnStockRow r =bharatDataSet.ReturnStock.NewReturnStockRow();
r.address = db.dr["address"].ToString();r.armsno = db.dr["armsno"].ToString();arno = db.dr["armsno"].ToString();r.bore = Convert.ToDecimal(db.dr["bore"]);br = Convert.ToDecimal(db.dr["bore"]);r.Classification = db.dr["classification"].ToString();
cl = db.dr["classification"].ToString();r.company = db.dr["company"].ToString();co= db.dr["company"].ToString();r.givendate = db.dr["givendate"].ToString();r.gunname = db.dr["gunname"].ToString();gn= db.dr["gunname"].ToString();r.Lodertype = db.dr["lodertype"].ToString();lo = db.dr["lodertype"].ToString();r.marketprice = Convert.ToInt32(db.dr["marketprice"]);r.name = db.dr["name"].ToString();r.partyID = Convert.ToInt32(db.dr["partyid"]);r.productprice = Convert.ToInt32(db.dr["productprice"]);r.qty = Convert.ToInt32(db.dr["qty"]);qqty= Convert.ToInt32(db.dr["qty"]);r.Sno = Convert.ToInt32(db.dr["sno"]);r.type = db.dr["type"].ToString();
ty = db.dr["type"].ToString();bharatDataSet.ReturnStock.Rows.Add(r);returnStockTableAdapter.Update(bharatDataSet.ReturnStock);
} db.dr.Close(); db.com.CommandText = "select * from productinsert whereclassification='" + cl.ToString() + "'and gunname='" + gn.ToString() + "'and bore=" + br +"and company='" + co.ToString() + "'and type='" + ty.ToString() + "'and armsno='" +arno.ToString() + "'and lodertype='" + lo + "'"; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ db.dr.Close(); db.com.CommandText = "update productinsert set qty=qty+" + qqty +" where classification='" + cl.ToString() + "'and gunname='" + gn.ToString() + "'andbore=" + br + "and company='" + co.ToString() + "'and type='" + ty.ToString() + "'andarmsno='" + arno.ToString() + "'and lodertype='" + lo + "'";
db.com.ExecuteNonQuery(); db.com.CommandText = "delete from GivenStock where sno=" + sn +""; db.com.ExecuteNonQuery(); this.givenStockTableAdapter.Fill(bharatDataSet.GivenStock);
} else
{ db.dr.Close(); MessageBox.Show("Record can't be Accepted Because it's not matchthe Record");
}
} catch { }
}
} private void btncl_Click(object sender, EventArgs e)
{ this.Close();
} int sn; private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
{ try
{sn = Convert.ToInt32(this.dataGridView2.Rows[e.RowIndex].Cells[0].Value);
} catch { }
}}
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 141/225
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmtotalConsinmentRecord : Form
{ public FrmtotalConsinmentRecord()
{InitializeComponent();
}
int ssn; private void FrmtotalConsinmentRecord_Load( object sender, EventArgs e){
// TODO: This line of code loads data into the 'bharatDataSet.productinsert'table. You can move, or remove it, as needed. this.productinsertTableAdapter.Fill( this.bharatDataSet.productinsert); // TODO: This line of code loads data into the 'bharatDataSet.GivenStock'table. You can move, or remove it, as needed. this.givenStockTableAdapter.Fill(this.bharatDataSet.GivenStock); try
{ db.com.CommandText = "delete from receivedetail"; db.com.ExecuteNonQuery(); db.com.CommandText = "Select * from consignment_view"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{
if (ssn != Convert.ToInt32(db.dr["sno"])){
bharatDataSet.receivedetailRow r =bharatDataSet.receivedetail.NewreceivedetailRow();
ssn = Convert.ToInt32(db.dr["sno"]);r.Sno = Convert.ToInt32(db.dr["sno"]);r.subitemsid = Convert.ToInt32(db.dr["subitemsid"]);r.consignmentid = Convert.ToInt32(db.dr["consignmentid"]);r.armsno = db.dr["armsno"].ToString();r.bore = Convert.ToDecimal(db.dr["bore"]);r.classification = db.dr["classification"].ToString();r.company = db.dr["company"].ToString();r.gunname = db.dr["gunname"].ToString();r.location = db.dr["location"].ToString();r.marketprice = Convert.ToInt32(db.dr["marketprice"]);r.partyaddress = db.dr["partyaddress"].ToString();
r.partyid = Convert.ToInt32(db.dr["partyid"]);r.partyname = db.dr["partyname"].ToString();r.qty = Convert.ToInt32(db.dr["qty"].ToString());r.receivedate = db.dr["conreceivedate"].ToString();r.type = db.dr["Type"].ToString();r.useqty = Convert.ToInt32(db.dr["useqty"]);r.remainingqty = Convert.ToInt32(db.dr[14]);bharatDataSet.receivedetail.Rows.Add(r);receivedetailTableAdapter.Update(bharatDataSet.receivedetail);
}}
db.dr.Close();}
catch { }}
private void btnRef_Click(object sender, EventArgs e){
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 142/225
private void btncan_Click(object sender, EventArgs e){
this.Close();}
private void dataGridView1_CellDoubleClick( object sender,DataGridViewCellEventArgs e)
{ String aa= this.dataGridView1.SelectedCells[0].Value.ToString();
}
private void dataGridView2_CellDoubleClick( object sender,DataGridViewCellEventArgs e)
{ string dd = this.dataGridView2.SelectedCells[0].Value.ToString();
}
private void dataGridView3_CellEndEdit(object sender, DataGridViewCellEventArgs e){
}
private void dataGridView3_CellDoubleClick( object sender,
DataGridViewCellEventArgs e){ string dd = this.dataGridView3.SelectedCells[0].Value.ToString();
}
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ Frmstockedit sedt = new Frmstockedit();
sedt.Show(); this.Close();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ FrmConsignmentedit edt = new FrmConsignmentedit();
edt.Show(); this.Close();
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ FrmGivenStockEdit gr = new FrmGivenStockEdit();
gr.Show(); this.Close();
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmPurchasedata : Form
{ public FrmPurchasedata()
{
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 143/225
InitializeComponent();}
int Sno; private void FrmPurchasedata_Load(object sender, EventArgs e)
{ this.cmbbore.Enabled = false;
this.cmbclassification.Enabled = false; this.cmbcompany.Enabled = false; this.cmbguntype.Enabled = false; this.cmbtype.Enabled = false; this.datetimepurdate.Enabled = false; this.txtadd.Enabled = false; this.txtarmno.Enabled = false; this.txtBillno.Enabled = false; this.txtLocation.Enabled = false; this.txtmarketprice.Enabled = false; this.txtpurchasepri.Enabled = false; this.txttotalamount.Enabled = false; this.numericUpDown1.Enabled = false; this.cmbsuppname.Enabled = false; this.txtdueamount.Enabled = false; this.cmbvariety.Enabled = false;
this.txtarmno.Enabled = false; this.txtLocation.Enabled = false; this.txtBillno.Enabled = false; this.txtpayable.Enabled = false; try
{ db.com.CommandText = "select distinct ItemName as it from Items"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbclassification.Items.Add(db.dr["it"].ToString());
} db.dr.Close();
} catch { }
try
{ db.com.CommandText = "select distinct ItemName as itname from SubItem"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["itname"].ToString() != "") this.cmbguntype.Items.Add(db.dr["itname"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct bore as itname from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if(db.dr["itname"].ToString()!="") this.cmbbore.Items.Add(db.dr["itname"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct Company as itname fromproductinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["itname"].ToString() != "") this.cmbcompany.Items.Add(db.dr["itname"].ToString());
} db.dr.Close(); db.com.CommandText = "select distinct type as ty from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbtype.Items.Add(db.dr["ty"].ToString());
} db.dr.Close(); this.cmbtype.Items.Remove("");
db.com.CommandText = "select distinct Lodertype as ty from productinsert";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 144/225
db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbvariety.Items.Add(db.dr["ty"].ToString());
} db.dr.Close(); this.cmbtype.Items.Remove("");
}
catch { } try
{ db.com.CommandText = "select distinct sname as sn from Suppliers"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbsuppname.Items.Add(db.dr["Sn"].ToString());
} db.dr.Close();
}catch{}}
int Billld,flag,sno,PID=0,cnt,bcnt,pur,total,qt; private void btnsave_Click(object sender, EventArgs e)
{
db.com.CommandText = "select count(armsno) from productinsert where armsno!=''";cnt = Convert.ToInt32(db.com.ExecuteScalar()); if (cnt <= 1000)
{
db.com.CommandText = "SELECT sum(qty) FROM PRODUCTINSERT WHERE bore>0and armsno=''";
bcnt = Convert.ToInt32(db.com.ExecuteScalar()); if (bcnt <= 1000)
{fsave();
} else
{ DialogResult dr = MessageBox.Show("Bullets Limit Exceed", "Limit",MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes)
{fsave();
}}
} else
{ DialogResult dr = MessageBox.Show("Gun Limit Exceed", "Limit",MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes)
{fsave();
}}
} void fsave()
{
if (this.cmbbore.Text == "0"){
this.cmbbore.Text = "0";}
if (this.txtmarketprice.Text == ""){
this.txtmarketprice.Text = "0";}
try{
db.com.CommandText = "select max(BillID) from ppurchase";Billld = Convert.ToInt32(db.com.ExecuteScalar());Billld++;
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 145/225
catch{
Billld = 1;}
try{
db.com.CommandText = "select max(sno) from productinsert";sno = Convert.ToInt32(db.com.ExecuteScalar());
sno++;}
catch { sno = 1; }
//try{
db.com.CommandText = "select * from productinsert whereClassification='" + this.cmbclassification.Text + "' and gunname='" + this.cmbguntype.Text+ "' and bore=" + this.cmbbore.Text + " and type='" + this.cmbtype.Text + "' andlodertype='"+this.cmbvariety.Text+"' and company='" + this.cmbcompany.Text + "' andarmsno='" + this.txtarmno.Text + "'and supplierid=" + suppid + ""; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ int qt = Convert.ToInt32(this.numericUpDown1.Value); db.dr.Close();
try{ db.com.CommandText = "update productinsert setqty=qty+" + qt + " where Classification='" + this.cmbclassification.Text + "' andgunname='" + this.cmbguntype.Text + "' and bore='" + this.cmbbore.Text + "' and type='" +this.cmbtype.Text + "' and company='" + this.cmbcompany.Text + "'"; db.com.ExecuteNonQuery();
} catch { }
flag = 1;
db.com.CommandText = "insert into PPurchase values(" +Billld + ",'" + this.txtBillno.Text + "','" +this.datetimepurdate.Value.Date.ToShortDateString() + "'," + suppid + "," +this.txttotalamount.Text + " )"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into purchasedItems values("
+ Billld + "," + SubID + "," + this.numericUpDown1.Value + "," + this.txttotalamount.Text+ ")"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into datapurchasevalues("+SubID+",'"+this.txtarmno.Text+"','"+this.cmbguntype.Text+"',"+this.cmbbore.Text+",'"+this.cmbcompany.Text+"','"+this.cmbtype.Text+"','"+this.cmbvariety.Text+"',"+this.txtpurchasepri.Text+",'"+this.cmbclassification.Text+"',"+this.txtmarketprice.Text+",'"+this.txtLocation.Text+"','"+this.cmbsuppname.Text+"','"+this.txtadd.Text+"','"+linc+"','"+valid+"',"+Billld+",'"+this.txtBillno.Text+"','"+this.datetimepurdate.Value.Date.ToShortDateString()+"',"+this.txttotalamount.Text+","+this.txtpayable.Text+","+this.txtreceived.Text+","+this.txtdueamount.Text+","+this.numericUpDown1.Value+")"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); db.dr.Close(); this.cmbbore.Text = "";
this.cmbclassification.Text = ""; this.cmbcompany.Text = ""; this.cmbguntype.Text = ""; this.txtadd.Text = ""; this.txtarmno.Text = ""; this.txtmarketprice.Text = ""; this.txtpurchasepri.Text = ""; this.txtLocation.Text = ""; this.txtBillno.Text = ""; this.txttotalamount.Text = ""; this.cmbtype.Text = ""; this.cmbsuppname.Text = ""; this.txtdueamount.Text = ""; this.cmbvariety.Text = ""; this.numericUpDown1.Value = 1;
} else
{ db.dr.Close();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 146/225
db.com.CommandText = "insert into PPurchase values(" +Billld + ",'" + this.txtBillno.Text + "','" +this.datetimepurdate.Value.Date.ToShortDateString() + "'," + suppid + "," +this.txttotalamount.Text + " )"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into productinsert values(" +sno + "," + SubID + ",'" + this.txtarmno.Text + "','" + this.cmbguntype.Text.ToString() +"','" + this.cmbcompany.Text.ToString() + "'," + this.cmbbore.Text.ToString() + ",'" +
this.cmbtype.Text + "','"+this.cmbvariety.Text+"'," + this.txtpurchasepri.Text + ",'" +this.datetimepurdate.Value.Date.ToShortDateString() + "'," + suppid + "," + PID + "," +this.numericUpDown1.Value + ",'" + this.cmbclassification.Text + "'," +this.txtmarketprice.Text + ",'" + this.txtLocation.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into purchasedItems values("+ Billld + "," + SubID + "," + this.numericUpDown1.Value + "," + this.txttotalamount.Text+ ")"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into datapurchase values(" +SubID + ",'" + this.txtarmno.Text + "','" + this.cmbguntype.Text + "'," +this.cmbbore.Text + ",'" + this.cmbcompany.Text + "','" + this.cmbtype.Text +"','"+this.cmbvariety.Text+"'," + this.txtpurchasepri.Text + ",'" +this.cmbclassification.Text + "'," + this.txtmarketprice.Text + ",'" +this.txtLocation.Text + "','" + this.cmbsuppname.Text + "','" + this.txtadd.Text + "','" +linc + "','" + valid + "'," + Billld + ",'" + this.txtBillno.Text + "','" +
this.datetimepurdate.Value.Date.ToShortDateString() + "'," + this.txttotalamount.Text +","+this.txtpayable.Text+","+this.txtreceived.Text+"," + this.txtdueamount.Text + "," +this.numericUpDown1.Value + ")"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.cmbbore.Text = ""; this.cmbclassification.Text = ""; this.cmbcompany.Text = ""; this.cmbguntype.Text = ""; this.txtadd.Text = ""; this.txtarmno.Text = ""; this.txtmarketprice.Text = ""; this.txtpurchasepri.Text = ""; this.txtLocation.Text = ""; this.txtBillno.Text = ""; this.txttotalamount.Text = ""; this.cmbtype.Text = "";
this.cmbsuppname.Text = ""; this.txtdueamount.Text = ""; this.txtpayable.Text = ""; this.numericUpDown1.Value = 1;
}
} // catch (Exception ee) { MessageBox.Show(ee.ToString());
//}}
private void btnadd_Click(object sender, EventArgs e){
this.cmbbore.Enabled = true; this.cmbclassification.Enabled = true; this.cmbcompany.Enabled = true; this.cmbguntype.Enabled = true;
this.cmbtype.Enabled = true; this.datetimepurdate.Enabled = true; this.txtadd.Enabled = true; this.txtarmno.Enabled = true; this.txtBillno.Enabled = true;
txtLocation.Enabled = true; this.txtmarketprice.Enabled = true; this.txtpurchasepri.Enabled = true; this.txttotalamount.Enabled = true; this.numericUpDown1.Enabled = true; this.cmbsuppname.Enabled = true; this.txtdueamount.Enabled = true; this.cmbvariety.Enabled = true; this.txtarmno.Enabled = true; this.txtLocation.Enabled = true; this.txtBillno.Enabled = true; this.txtpayable.Enabled = true;
}
private void btnclose_Click(object sender, EventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 147/225
{ this.Close();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ purchasedataedit pr = new purchasedataedit();
pr.Show(); this.Close();
}
int ItemID;private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e){
db.com.CommandText = "select ItemID from Items where ItemName='" +this.cmbclassification.Text + "'";
ItemID = Convert.ToInt32(db.com.ExecuteScalar()); this.cmbguntype.Focus();
}
int SubID; private void cmbguntype_SelectedIndexChanged( object sender, EventArgs e)
{
db.com.CommandText = "select SubItemsID from SubItem whereItemName='"+this.cmbguntype.Text+"'";SubID = Convert.ToInt32(db.com.ExecuteScalar());
this.cmbcompany.Focus();}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ FrmSupplier sup = new FrmSupplier();
sup.Show();}
private void cmbcompany_SelectedIndexChanged( object sender, EventArgs e){
this.cmbbore.Focus();
}
private void cmbbore_SelectedIndexChanged( object sender, EventArgs e){
this.cmbtype.Focus();}
private void cmbtype_SelectedIndexChanged( object sender, EventArgs e){
this.txtarmno.Focus();}
private void txtarmno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.cmbsuppname.Focus();
}
private void txtpurchasepri_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtmarketprice.Focus();
}
private void txtmarketprice_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.datetimepurdate.Focus();
}
private void datetimepurdate_ValueChanged( object sender, EventArgs e){
this.txtLocation.Focus();}
private void txtLocation_KeyDown(object sender, KeyEventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 148/225
{ if (e.KeyCode == Keys.Enter) this.txtBillno.Focus();
}
private void txtBillno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.numericUpDown1.Focus();}
int suppid; String linc,valid; private void cmbsuppname_SelectedIndexChanged( object sender, EventArgs e)
{ db.com.CommandText = "select * from Suppliers where Sname='" +this.cmbsuppname.Text + "'"; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{suppid = Convert.ToInt32(db.dr["SupplierID"]);
this.txtadd.Text = db.dr["Saddress"].ToString();linc = db.dr["licenceno"].ToString();valid = db.dr["validdate"].ToString();
}
db.dr.Close(); this.txtpurchasepri.Focus();}
private void txtmarketprice_KeyDown_1(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.datetimepurdate.Focus();
}
private void txtpurchasepri_KeyDown_1(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtmarketprice.Focus();
}
private void txttotalamount_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpayable.Focus();
}
private void numericUpDown1_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txttotalamount.Focus();
}
private void txtdueamount_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.numericUpDown1.Focus();}
private void txtpayable_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtreceived.Focus();
}
private void txtdueamount_Enter(object sender, EventArgs e){
int pa = Convert.ToInt32(this.txtpayable.Text); int re = Convert.ToInt32(this.txtreceived.Text); int due = pa - re; this.txtdueamount.Text = due.ToString();
}
private void txttotalamount_Enter(object sender, EventArgs e){
pur = Convert.ToInt32(this.txtpurchasepri.Text);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 149/225
qt = Convert.ToInt32(this.numericUpDown1.Value);total = pur * qt;
this.txttotalamount.Text = total.ToString();}
private void txtreceived_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.txtdueamount.Focus();}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;
using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class purchasedataedit : Form
{ public purchasedataedit()
{InitializeComponent();
}
private void purchasedataedit_Load(object sender, EventArgs e){
// TODO: This line of code loads data into the 'bharatDataSet.dataPurchase'table. You can move, or remove it, as needed. this.dataPurchaseTableAdapter.Fill(this.bharatDataSet.dataPurchase);
} int subid=0,itemid=0,supid; private void btnedit_Click(object sender, EventArgs e)
{ try
{ db.com.CommandText = "select Subitemsid from Subitem whereitemname='"+this.txtpna.Text+"'";
subid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "select itemid from items whereitemname='"+this.txtclassi.Text+"'";
itemid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "select supplierid from suppliers wheresname='"+this.txtsuppna.Text+"'and saddress='"+this.txtadd.Text+"'";
supid = Convert.ToInt32(db.com.ExecuteScalar()); /*db.com.CommandText = "update ppurchase set billno='" +
this.txtbillno.Text + "',billdate='" + this.txtpurdate.Text + "',totalAmount=" +this.txttotalamoun.Text + ",supplierid=" + supid + " where billid=" + bno + "";
db.com.ExecuteNonQuery();db.com.CommandText = "update purchaseditems set qty=" + this.txtqty.Text +
",price=" + this.txttotalamoun.Text + ",Subitemsid=" + subid + " where billid=" +this.txtbillID.Text + "";
db.com.ExecuteNonQuery();*/ db.com.CommandText = "update datapurchase set armsno='" +this.txtarmno.Text + "',gunname='" + this.txtpna.Text + "',bore=" + this.txtbore.Text +",company='" + this.txtcompy.Text + "',type='" + this.txttype.Text +"',LoderType='"+this.txtvariety.Text+"',purchaseprice=" + this.txtpurchasepri.Text +",classificatino='" + this.txtclassi.Text + "',marketprice=" + this.txtmarketpric.Text +",location='" + this.txtlocation.Text + "',sname='" + this.txtsuppna.Text + "',saddress='"+ this.txtadd.Text + "',lincenceno='" + this.txtlicence.Text + "',validdate='" +this.txtvalid.Text + "',billno='" + this.txtbillno.Text + "',billdate='" +this.txtpurdate.Text + "',totalamount=" + this.txttotalamoun.Text + ",payable=" +this.txtPayable.Text + ",dueAmount=" + this.txtdue.Text+",received="+this.txtrecevied.Text+" where billid=" + bid + ""; db.com.ExecuteNonQuery();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 150/225
db.com.CommandText = "update productinsert set Subitemsid=" + subid +",gunname='" + this.txtpna.Text + "',company='" + this.txtcompy.Text + "',bore=" +this.txtbore.Text + ",type='" + this.txttype.Text +"',Lodertype='"+this.txtvariety.Text+"',purchaseprice=" + this.txtpurchasepri.Text +",marketprice=" + this.txtmarketpric.Text + ",classification='" + this.txtclassi.Text +"',armsno='" + this.txtarmno.Text + "',supplierid=" + supid + " where subitemsid=" + subid+ " and supplierid=" + supid + ""; db.com.ExecuteNonQuery();
MessageBox.Show("updated"); this.txtarmno.Text = ""; this.txtadd.Text = ""; this.txtbore.Text = ""; this.txtclassi.Text = ""; this.txtcompy.Text = ""; this.txtpurchasepri.Text = ""; this.txtpna.Text = ""; this.txtpurchasepri.Text = ""; this.txtsuppna.Text = ""; this.txtpurdate.Text = ""; this.txtqty.Text = ""; this.txttype.Text = ""; this.txtbillno.Text = ""; this.txttotalamoun.Text = ""; this.txtvariety.Text = "";
this.Close(); purchasedataedit pr = new purchasedataedit();pr.Show();
} catch (Exception ee) { MessageBox.Show(ee.ToString()); }
} int suppid; private void btndel_Click(object sender, EventArgs e)
{ try
{ db.com.CommandText = "select Subitemsid from Subitem where itemname='" +this.txtpna.Text + "'";
subid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "select supplierid from suppliers where sname='" +this.txtsuppna.Text + "'and saddress='" + this.txtadd.Text + "'";
supid = Convert.ToInt32(db.com.ExecuteScalar());
DialogResult drs =MessageBox.Show("Are u Sure to Delete", "del",MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (drs == DialogResult.Yes)
{ /*db.com.CommandText = "delete from ppurchase where billid=" +this.txtbillID.Text + "";
db.com.ExecuteNonQuery();db.com.CommandText = "delete from purchaseditems where billid=" +
this.txtbillID.Text + "";db.com.ExecuteNonQuery();*/
db.com.CommandText = "delete from productinsert where Subitemsid=" +subid + " and gunname='" + this.txtpna.Text + "' and company='" + this.txtcompy.Text + "'and bore=" + this.txtbore.Text + " and type='" + this.txttype.Text + "' andlodertype='"+this.txtvariety.Text+"' and purchaseprice=" + this.txtpurchasepri.Text + "and marketprice=" + this.txtmarketpric.Text + " and classification='" +this.txtclassi.Text + "' and armsno='" + this.txtarmno.Text + "' and supplierid=" + supid
+ ""; db.com.ExecuteNonQuery(); db.com.CommandText="delete from datapurchase where billid="+bid+""; db.com.ExecuteNonQuery(); this.txtarmno.Text = ""; this.txtadd.Text = ""; this.txtbore.Text = ""; this.txtclassi.Text = ""; this.txtcompy.Text = ""; this.txtmarketpric.Text = ""; this.txtpna.Text = ""; this.txtpurchasepri.Text = ""; this.txtsuppna.Text = ""; this.txtpurdate.Text = ""; this.txtqty.Text = ""; this.txttype.Text = ""; this.txtbillno.Text = ""; this.txttotalamoun.Text = ""; this.Close(); purchasedataedit pr = new purchasedataedit();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 151/225
pr.Show();}
} catch { }
}
int bid; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{ try
{bid =
Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[15].Value); db.com.CommandText = "select * from datapurchase where BillID=" + bid +""; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ this.txtarmno.Text = db.dr["armsno"].ToString(); this.txtadd.Text = db.dr["saddress"].ToString(); this.txtbore.Text = db.dr["bore"].ToString(); this.txtclassi.Text = db.dr["classificatino"].ToString(); this.txtcompy.Text = db.dr["company"].ToString(); this.txtmarketpric.Text = db.dr["marketprice"].ToString();
this.txtpna.Text = db.dr["gunname"].ToString(); this.txtpurchasepri.Text = db.dr["purchaseprice"].ToString(); this.txtsuppna.Text = db.dr["sname"].ToString(); this.txtpurdate.Text = db.dr["billdate"].ToString(); this.txttype.Text = db.dr["Type"].ToString(); this.txtqty.Text = (db.dr["Qty"]).ToString(); this.txtbillno.Text = db.dr["billno"].ToString(); this.txttotalamoun.Text = db.dr["totalAmount"].ToString(); this.txtPayable.Text = db.dr["payable"].ToString(); this.txtdue.Text = db.dr["DueAmount"].ToString(); this.txtbillno.Text = db.dr["billno"].ToString(); this.txtlicence.Text = db.dr["lincenceno"].ToString(); this.txtvalid.Text = db.dr["validdate"].ToString(); this.txtlocation.Text = db.dr["location"].ToString(); this.txtvariety.Text = db.dr["Lodertype"].ToString(); this.txtrecevied.Text = db.dr["received"].ToString();
}
db.dr.Close();}
catch { }}
private void btncancel_Click(object sender, EventArgs e){
this.Close();}
private void txtclassi_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpna.Focus();
}
private void txtpna_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtcompy.Focus();
}
private void txtcompy_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtarmno.Focus();
}
private void txtarmno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtbore.Focus();
}
private void txtbore_KeyDown(object sender, KeyEventArgs e){
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 152/225
if (e.KeyCode == Keys.Enter) this.txttype.Focus();
}
private void txttype_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtvariety.Focus();
}
private void txtsuppna_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpurchasepri.Focus();
}
private void txtpurchasepri_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtmarketpric.Focus();
}
private void txtmarketprice_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txttotalamoun.Focus();}
private void txttotalamount_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpurdate.Focus();
}
private void txtbillID_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtbillno.Focus();
}
private void txtbillno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)this.txtqty.Focus();
}
private void txtqty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtadd.Focus();
}
private void txtadd_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.btnedit.Focus();}
private void txtpurdate_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtlicence.Focus();
}
private void txtlicence_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtvalid.Focus();
}
private void txtvalid_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtsuppna.Focus();
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 153/225
private void txtpurchasepri_KeyDown_1(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtmarketpric.Focus();
}
private void txtmarketpric_KeyDown(object sender, KeyEventArgs e)
{ if (e.KeyCode == Keys.Enter) this.txttotalamoun.Focus();
}
private void txttotalamoun_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtPayable.Focus();
}
private void txtPayable_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtdue.Focus();
}
private void txtdue_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtbillno.Focus();
}
private void txtqty_KeyDown_1(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtlocation.Focus();
}
private void txtlocation_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnedit.Focus();
}
private void txtvariety_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpurdate.Focus();
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmSupplier : Form
{ public FrmSupplier()
{InitializeComponent();
}
private void groupBox2_Enter(object sender, EventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 154/225
{
} int ssid, ccid; private void btnsave_Click(object sender, EventArgs e)
{ if (this.txtcontact.Text == "")
{
this.txtcontact.Text = "0";}
db.com.CommandText = "select stateid from states wherestatename='"+this.cmbstate.Text+"'";
ssid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "select cityid from cities where cityname='" +this.cmbcity.Text + "'";
ccid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "select * from cities where stateid="+ssid+" andcityid="+ccid+""; db.dr = db.com.ExecuteReader(); if(db.dr.Read() )
{ try
{ db.dr.Close();
db.com.CommandText = "insert into Suppliers values(" + this.txtid.Text+ ",'" + this.txtsupname.Text + "','" + this.txtaddress.Text + "','" + this.txtlino.Text +"','" + this.txtvalid.Text + "','" + this.cmbstate.Text + "','" + this.cmbcity.Text +"','" + this.txtcontact.Text + "')"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.txtsupname.Text = ""; this.txtcontact.Text = ""; this.txtid.Text = ""; this.txtlino.Text = ""; this.txtaddress.Text = ""; this.txtvalid.Text = ""; this.cmbstate.Text = ""; this.cmbcity.Text = "";
} catch { }
} else
{ db.dr.Close(); try
{ db.com.CommandText = "insert into Suppliers values(" + this.txtid.Text+ ",'" + this.txtsupname.Text + "','" + this.txtaddress.Text + "','" + this.txtlino.Text +"','" + this.txtvalid.Text + "','" + this.cmbstate.Text + "','" + this.cmbcity.Text +"','" + this.txtcontact.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into states values(" + stateid + ",'" +this.cmbstate.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into Cities values(" + cityid + "," +stateid + ",'" + this.cmbcity.Text + "')";
db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.txtsupname.Text = ""; this.txtcontact.Text = ""; this.txtid.Text = ""; this.txtlino.Text = ""; this.txtaddress.Text = ""; this.txtvalid.Text = ""; this.cmbstate.Text = ""; this.cmbcity.Text = "";
} catch { } this.Close(); FrmSupplier sup = new FrmSupplier();
sup.Show();}
}
private void btndel_Click(object sender, EventArgs e){
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 155/225
}
private void btncan_Click(object sender, EventArgs e){
this.Close(); Frmproductinsert st = new Frmproductinsert();
st.Show();
} int stateid,cityid; private void FrmSupplier_Load(object sender, EventArgs e)
{ try
{ db.com.CommandText = "select distinct statename as st from States"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbstate.Items.Add(db.dr["st"].ToString());
} db.dr.Close();}
catch { } try
{
db.com.CommandText = "select max(stateid)from States";stateid = Convert.ToInt32(db.com.ExecuteScalar());stateid++;
}catch{stateid = 1;} try
{ db.com.CommandText = "select max(cityid)from cities";
cityid = Convert.ToInt32(db.com.ExecuteScalar());cityid++;
} catch
{cityid = 1;}
db.com.CommandText = "select max(supplierid) from suppliers";supplierid = Convert.ToInt32(db.com.ExecuteScalar());
supplierid++; this.txtid.Text = supplierid.ToString(); this.txtid.Enabled = false;
} int supplierid; private void txtsid_KeyPress(object sender, KeyPressEventArgs e)
{ if (e.KeyChar == 13)
{ this.txtsupname.Focus();
}}
private void txtsup_KeyPress(object sender, KeyPressEventArgs e){
if (e.KeyChar == 13)
{ this.txtlino.Focus();
}}
private void txtlino_KeyPress(object sender, KeyPressEventArgs e){
if (e.KeyChar == 13){}
}
private void txtadd_KeyPress(object sender, KeyPressEventArgs e){
if (e.KeyChar == 13){
}
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 156/225
private void datetime_KeyPress(object sender, KeyPressEventArgs e){
if (e.KeyChar == 13){
this.txtaddress.Focus();}
}
private void cmbstate_KeyPress(object sender, KeyPressEventArgs e){
if (e.KeyChar == 13){
}
}
private void txtpin_KeyPress(object sender, KeyPressEventArgs e){
if (e.KeyChar == 13){
}
}
private void cmbcity_KeyPress(object sender, KeyPressEventArgs e){ if (e.KeyChar == 13)
{
}}
private void txtcont_KeyPress(object sender, KeyPressEventArgs e){
if (e.KeyChar == 13){
this.btnsave.Focus();}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
e){
Stockinsertfrm st = new Stockinsertfrm();st.Show();st.Close();
}
private void txtid_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtsupname.Focus();
}
private void txtsupname_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter) this.txtlino.Focus();
}
private void txtlino_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtvalid.Focus();
}
private void txtvalid_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtcontact.Focus();
}
private void txtcontact_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.cmbstate.Focus();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 157/225
}
private void cmbstate_SelectedIndexChanged( object sender, EventArgs e){
try{
this.cmbcity.Items.Clear(); db.com.CommandText = "select stateid from states where statename='" +
this.cmbstate.Text + "'"; int sid = Convert.ToInt16(db.com.ExecuteScalar()); db.com.CommandText = "select * from cities where stateid=" + sid + ""; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbcity.Items.Add(db.dr["CityName"].ToString());
} db.dr.Close();
} catch { }
} private void txtpincode_KeyDown(object sender, KeyEventArgs e)
{ if (e.KeyCode == Keys.Enter) this.txtaddress.Focus();
}
private void txtaddress_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnsave.Focus();
}
private void cmbstate_DropDownClosed(object sender, EventArgs e){
this.cmbcity.Focus();}
int cid;
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{
public partial class FrmParty : Form{
public FrmParty(){
InitializeComponent();}
private void pictureBox3_Click(object sender, EventArgs e){
}
private void btnsa_Click(object sender, EventArgs e){
db.com.CommandText = "insert into party values('" + this.txtparty.Text + "','"+ this.txtpartyname.Text + "','" + this.txtpartyadd.Text + "')"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.txtpartyname.Text = ""; this.txtpartyadd.Text = "";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 158/225
this.txtparty.Text = "";}
private void btncan_Click(object sender, EventArgs e){
this.Close(); ConsinmentAccept cn = new ConsinmentAccept();
cn.Show();
} int partyid; private void FrmParty_Load(object sender, EventArgs e)
{ try
{ db.com.CommandText = "select max(partyid) from party";
partyid = Convert.ToInt32(db.com.ExecuteScalar());partyid++;
this.txtparty.Text = partyid.ToString(); this.txtparty.Enabled = false;
} catch { partyid = 0; }
}
private void txtpartyname_KeyDown(object sender, KeyEventArgs e)
{ if (e.KeyCode == Keys.Enter) this.txtpartyadd.Focus();
}
private void txtpartyadd_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnsa.Focus();
}
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;
using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class PartyEditRecord : Form
{ public PartyEditRecord()
{InitializeComponent();
}
private void PartyEditRecord_Load(object sender, EventArgs e){
// TODO: This line of code loads data into the 'bharatDataSet.party' table.
You can move, or remove it, as needed. this.partyTableAdapter.Fill(this.bharatDataSet.party);
} private void dataGridView1_CellDoubleClick_1( object sender,DataGridViewCellEventArgs e)
{
}
private void btnedit_Click(object sender, EventArgs e){
try{
db.com.CommandText = "update party set partyaddress='" +this.txtAddress.Text + "',partyname='" + this.txtname.Text + "' where partyid=" +this.txtpartyid.Text + ""; db.com.ExecuteNonQuery(); MessageBox.Show("Record Updated"); this.txtpartyid.Text = "";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 159/225
this.txtname.Text = ""; this.txtAddress.Text = ""; this.Close(); PartyEditRecord pr = new PartyEditRecord();
pr.Show();}
catch { }}
private void btndel_Click(object sender, EventArgs e){
try{
DialogResult dr = MessageBox.Show("Record Deleted", "del",MessageBoxButtons.YesNo, MessageBoxIcon.Question); if(dr==DialogResult.Yes)
{ db.com.CommandText = "delete from party where partyid=" +this.txtpartyid.Text + ""; db.com.ExecuteNonQuery(); this.txtpartyid.Text = ""; this.txtname.Text = ""; this.txtAddress.Text = ""; this.Close();
PartyEditRecord pr = new PartyEditRecord();pr.Show();}
} catch { }
}
private void btncancel_Click(object sender, EventArgs e){
this.Close();}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e){
try{
int pana =
Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value); db.com.CommandText = "select * from party where partyid='" + pana + "'"; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ this.txtpartyid.Text = db.dr[0].ToString(); this.txtname.Text = db.dr[1].ToString(); this.txtAddress.Text = db.dr[2].ToString();
} db.dr.Close();
} catch { }
}
private void txtpartyid_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtname.Focus();
}
private void txtname_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtAddress.Focus();
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnedit.Focus();
}
}
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 160/225
using System;
using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmSuppliereditRe : Form
{ public FrmSuppliereditRe()
{InitializeComponent();
}
private void FrmSuppliereditRe_Load(object sender, EventArgs e){ // TODO: This line of code loads data into the 'bharatDataSet.Suppliers'table. You can move, or remove it, as needed. this.suppliersTableAdapter.Fill(this.bharatDataSet.Suppliers); this.txtid.Enabled = false; this.txtadd.Enabled = false; this.txtsup.Enabled = false; this.txtlino.Enabled = false; this.txtvalid.Enabled = false; this.txtcity.Enabled = false; this.txtcontact.Enabled = false; this.txtstate.Enabled = false;
} int ssid; private void btncan_Click(object sender, EventArgs e)
{ this.Close();
} private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{ this.txtadd.Enabled = true; this.txtsup.Enabled = true; this.txtlino.Enabled = true; this.txtvalid.Enabled = true; this.txtcity.Enabled = true; this.txtcontact.Enabled = true; this.txtstate.Enabled = true; try
{ssid =Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value);
db.com.CommandText = "select * from Suppliers where supplierid=" + ssid +
""; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ this.txtadd.Text = db.dr["saddress"].ToString(); this.txtsup.Text = db.dr["sname"].ToString(); this.txtlino.Text = db.dr["licenceno"].ToString(); this.txtvalid.Text = db.dr["validdate"].ToString(); this.txtcity.Text = db.dr["City"].ToString(); this.txtcontact.Text = db.dr["contact"].ToString(); this.txtid.Text = db.dr["supplierid"].ToString(); this.txtstate.Text = db.dr["state"].ToString();
} db.dr.Close();
} catch { }
}
private void btnEdit_Click(object sender, EventArgs e){
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 161/225
try{
db.com.CommandText = "update Suppliers set sname='" + this.txtsup.Text +"',saddress='" + this.txtadd.Text + "',validdate='" + this.txtvalid.Text + "',licenceno='"+ this.txtlino.Text + "',contact='" + this.txtcontact.Text + "',state='" +this.txtstate.Text + "',city='" + this.txtcity.Text + "', where supplierid=" +this.txtid.Text + ""; db.com.ExecuteNonQuery();
this.txtadd.Text = ""; this.txtsup.Text = ""; this.txtlino.Text = ""; this.txtvalid.Text = ""; this.txtadd.Text = ""; this.txtstate.Text = ""; this.txtcity.Text = ""; this.txtcontact.Text = ""; this.txtid.Text = ""; this.txtadd.Enabled = false; this.txtsup.Enabled = false; this.txtlino.Enabled = false; this.txtvalid.Enabled = false; this.txtcity.Enabled = false; this.txtcontact.Enabled = false; this.txtstate.Enabled = false;
} catch { }}
private void btndel_Click(object sender, EventArgs e){
try{
db.com.CommandText = "delete from Suppliers where supplierid='" +this.txtid.Text + "'"; db.com.ExecuteNonQuery(); this.txtadd.Text = ""; this.txtsup.Text = ""; this.txtlino.Text = ""; this.txtvalid.Text = ""; this.txtadd.Text = ""; this.txtstate.Text = "";
this.txtcity.Text = ""; this.txtcontact.Text = ""; this.txtid.Text = ""; this.txtsup.Enabled = false; this.txtlino.Enabled = false; this.txtvalid.Enabled = false; this.txtadd.Enabled = false; this.txtcity.Enabled = false; this.txtcontact.Enabled = false; this.txtstate.Enabled = false;
} catch { }
}
private void txtid_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtlino.Focus();
}
private void txtlino_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtvalid.Focus();
}
private void txtvalid_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtsup.Focus();
}
private void txtcontact_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtadd.Focus();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 162/225
}
private void txtstate_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtcity.Focus();
}
private void txtsup_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtstate.Focus();
}
private void txtcity_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtcontact.Focus();
}
private void txtpincode_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtadd.Focus();
}
private void txtadd_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnEdit.Focus();
}
private void btncan_Click_1(object sender, EventArgs e){
this.Close();}
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmOrder : Form
{
public FrmOrder(){
InitializeComponent();}
private void timer1_Tick(object sender, EventArgs e){
if (this.label1.Right > 0 && this.label1.Right < 9) this.label1.Left = this.Right; this.label1.Left = this.label1.Left - 10;
} int sno=0; private void FrmOrder_Load(object sender, EventArgs e)
{ this.txtsno.Focus(); try
{ db.com.CommandText = "select max(sno) from orders";
sno = Convert.ToInt32(db.com.ExecuteScalar());sno++;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 163/225
this.txtsno.Text = sno.ToString();}
catch { sno = 1; }}
private void btnsave_Click(object sender, EventArgs e){
try
{ db.com.CommandText = "insert into orders values('" + this.txtsno.Text +"','" + this.txtcname.Text + "','" + this.txtlicence.Text + "','" + this.txtvalid.Text +"','" + this.datetime.Value.Date.ToShortDateString() + "'," + this.numqty.Value +",'"+this.txttypeoforder.Text+"')"; db.com.ExecuteNonQuery(); MessageBox.Show("Record Inserted"); this.txtsno.Text = ""; this.txtlicence.Text = ""; this.txtvalid.Text = ""; this.txtcname.Text = ""; this.txttypeoforder.Text = ""; this.numqty.Value = 0;
} catch { }
}
private void btnedit_Click(object sender, EventArgs e){ try
{ db.com.CommandText = "update orders set name='" + this.txtcname.Text +"',licenceno='" + this.txtlicence.Text + "',valid='" + this.txtvalid.Text +"',orderdate='" + this.datetime.Value.Date.ToShortDateString() + "',qty=" +this.numqty.Value + " where sno='" + this.txtsno.Text + "'"; db.com.ExecuteNonQuery(); this.txtsno.Text = ""; this.txtlicence.Text = ""; this.txtvalid.Text = ""; this.txtcname.Text = "";
} catch { }
}
private void btndelete_Click(object sender, EventArgs e){
try{
db.com.CommandText = "delete from orders where sno='" + this.txtsno.Text +"'"; db.com.ExecuteNonQuery(); this.txtsno.Text = ""; this.txtlicence.Text = ""; this.txtvalid.Text = ""; this.txtcname.Text = "";
} catch { }
}
private void btncancel_Click(object sender, EventArgs e)
{ this.Close();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ this.Close(); FrmorderEdit oe = new FrmorderEdit();
oe.Show();}
private void txtsno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtcname.Focus();
}
private void txtcname_KeyDown(object sender, KeyEventArgs e){
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 164/225
if (e.KeyCode == Keys.Enter) this.datetime.Focus();
}
private void datetime_CloseUp(object sender, EventArgs e){
this.txtlicence.Focus();}
private void txtlicence_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtvalid.Focus();
}
private void txtvalid_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txttypeoforder.Focus();
}
private void txttypeoforder_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.numqty.Focus();}
private void numqty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnsave.Focus();
}
}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmBill : Form
{ public FrmBill()
{InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e){
if (this.label1.Right > 0 && this.label1.Right <=9) this.label1.Left = this.Right; this.label1.Left = this.label1.Left - 10;
} int BillID = 0,cid=0; private void FrmBill_Load(object sender, EventArgs e)
{ this.btnclear.Enabled = true; this.cmbvariety.Enabled = true; db.com.CommandText = "select distinct armsno as aa from productinsert"; db.dr = db.com.ExecuteReader(); while(db.dr.Read())
{ if(db.dr["aa"].ToString()!="")
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 165/225
this.cmbarmsno.Items.Add(db.dr["aa"]);}db.dr.Close();
db.com.CommandText = "select distinct statename as st from states"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if(db.dr["st"].ToString()!="") this.cmbstate.Items.Add(db.dr["st"]);
} db.dr.Close();
db.com.CommandText = "select distinct Classification as cl fromproductinsert"; db.dr = db.com.ExecuteReader(); while(db.dr.Read())
{ if (db.dr["cl"].ToString() != "") this.cmbclassification.Items.Add(db.dr["cl"].ToString());
}db.dr.Close();
try{
db.com.CommandText = "select max(Billid) from bill";BillID = Convert.ToInt32(db.com.ExecuteScalar());BillID++;
} catch { BillID = 1; } try
{ db.com.CommandText = "select max(CID) from customers ";
cid = Convert.ToInt32(db.com.ExecuteScalar());cid++;
} catch { cid = 1; }
} int qty1,qty2,stateid,cityid,markt; private void btnsave_Click(object sender, EventArgs e)
{
try{
db.com.CommandText = "select max(stateid) from states";
stateid = Convert.ToInt32(db.com.ExecuteScalar());
} catch
{stateid = 1;
} try{ db.com.CommandText = "select max(cityid) from cities";
cityid = Convert.ToInt32(db.com.ExecuteScalar());
} catch
{ cityid = 1; } // try
{
qty2 = Convert.ToInt32(this.numberqty.Value); db.com.CommandText = "select sum(qty) from productinsert wheresubitemsid=" + subid + " and classification='" + this.cmbclassification.Text + "' andbore=" + this.cmbbore.Text + " and type='" + this.cmbtype.Text + "' and company='" +this.cmbcompany.Text + "'and armsno='" + this.cmbarmsno.Text + "'andlodertype='"+this.cmbvariety.Text+"'";
qty1 = Convert.ToInt32(db.com.ExecuteScalar());}
//catch { } if (qty1 > 0 && qty2<=qty1)
{ try
{ db.com.CommandText = "select purchaseprice from productinsert wherearmsno='" + this.cmbarmsno.Text + "' and company='" + this.cmbcompany.Text + "'andclassification='" + this.cmbclassification.Text + "'and gunname='" + this.cmbproname.Text+ "'and bore=" + this.cmbbore.Text + "and type='" + cmbtype.Text + "'andlodertype='"+this.cmbvariety.Text+"'";
markt = Convert.ToInt32(db.com.ExecuteScalar()); int quantity = Convert.ToInt32(this.numberqty.Value);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 166/225
db.customername = this.txtcname.Text; db.licenceno = this.txtlicence.Text; db.com.CommandText = "insert into Bill values(" + BillID + "," + cid +",'" + this.datetime.Value.Date.ToShortDateString() + "'," + itemid + "," + subid + "," +this.txtpayable.Text + "," + this.txtreceiveamount.Text + "," + this.txtdue.Text + "," +this.numberqty.Value + ")"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into customers values(" + cid + ",'" +
this.txtcname.Text + "','" + this.txtlicence.Text + "','" + this.txtvalid.Text + "','" +this.txtaddress.Text + "','" + this.txtcontactno.Text + "','" + this.cmbcity.Text + "','"+ this.cmbstate.Text + "')"; db.com.ExecuteNonQuery(); db.com.CommandText = "insert into datasalevalues('"+this.txtcname.Text+"','"+this.txtaddress.Text+"','"+this.txtlicence.Text+"','"+this.txtvalid.Text+"','"+this.cmbstate.Text+"','"+this.cmbcity.Text+"','"+this.cmbarmsno.Text+"','"+this.cmbclassification.Text+"','"+this.datetime.Value.Date.ToShortDateString()+"','"+this.cmbproname.Text+"',"+this.cmbbore.Text+",'"+this.cmbtype.Text+"','"+this.cmbvariety.Text+"','"+this.cmbcompany.Text+"',"+this.txtprie.Text+","+this.txtpayable.Text+","+this.txtreceiveamount.Text+","+this.txtdue.Text+","+this.numberqty.Value+","+markt+")"; db.com.ExecuteNonQuery(); db.com.CommandText = "select statename from states wherestatename='"+this.cmbstate.Text+"'"; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ db.dr.Close();}
else {
db.dr.Close();stateid++;
db.com.CommandText = "insert into states values(" + stateid + ",'"+ this.cmbstate.Text + "')"; db.com.ExecuteNonQuery();
} db.com.CommandText = "select cityname from cities wherecityname='"+this.cmbcity.Text+"'"; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{
db.dr.Close();}
else{
db.dr.Close();cityid++;
db.com.CommandText = "insert into cities values(" + cityid + "," +stateid + ",'" + this.cmbcity.Text + "')"; db.com.ExecuteNonQuery();
} db.com.CommandText = "update productinsert set qty=qty-" + quantity +" where subitemsid=" + subid + " and classification='" + this.cmbclassification.Text + "'and bore=" + this.cmbbore.Text + " and type='" + this.cmbtype.Text + "' and company='" +this.cmbcompany.Text + "'and armsno='"+this.cmbarmsno.Text+"'andlodertype='"+this.cmbvariety.Text+"'";
db.com.ExecuteNonQuery();
db.com.CommandText = "delete from orders wherename='"+this.txtcname.Text+"' and licenceno='"+this.txtlicence.Text+"'"; db.com.ExecuteNonQuery();
MessageBox.Show("Record Inserted.."); this.txtaddress.Text = ""; this.cmbarmsno.Text = ""; this.cmbcity.Text = ""; this.txtcname.Text = ""; this.txtcontactno.Text = ""; this.txtdue.Text = ""; this.txtlicence.Text = ""; this.txtpayable.Text = ""; this.txtreceiveamount.Text = ""; this.cmbstate.Text = ""; this.txtvalid.Text = ""; this.cmbbore.Text = ""; this.cmbclassification.Text = "";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 167/225
this.cmbcompany.Text = ""; this.cmbproname.Text = ""; this.cmbtype.Text = ""; this.numberqty.Value = 1; this.datetime.Text = ""; this.lbldue.Visible = true; this.btncancel.Enabled = true; this.btnsave.Enabled = true;
this.txtdue.Visible = true; this.Close(); CRVCustomerReport rd = new CRVCustomerReport();
rd.Show();}
catch { }}
else {
MessageBox.Show("Limit Exceed"+" Stock Quantity is="+qty1.ToString()+"OrDosen't Exist");
}}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{
FrmConsignmentedit bill = new FrmConsignmentedit();bill.Show(); this.Hide();
}
private void btncancel_Click(object sender, EventArgs e){
this.Close();}
int subid,itemid; private void cmbproname_SelectedIndexChanged( object sender, EventArgs e)
{ this.cmbbore.Items.Clear(); this.cmbbore.Text = ""; this.cmbtype.Text = ""; this.cmbcompany.Text = ""; db.com.CommandText = "select Subitemsid from subitem where
itemname='"+this.cmbproname.Text+"'";subid = Convert.ToInt32(db.com.ExecuteScalar());
db.com.CommandText = "select distinct bore as bb from productinsert wheregunname='"+this.cmbproname.Text+"' and classification='"+this.cmbclassification.Text+"'"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbbore.Items.Add(db.dr["bb"]);
} db.dr.Close();
if (this.cmbbore.Items.Count >= 2){
for (int i = 0; i < cmbbore.Items.Count; i++){
for (int j = i + 1; j < cmbbore.Items.Count; j++){
if (this.cmbbore.Items[i].ToString() ==this.cmbbore.Items[j].ToString())
{ this.cmbbore.Items.RemoveAt(i);
}}
}}
}
private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e){
this.cmbcompany.Text = ""; this.cmbbore.Text = ""; this.cmbproname.Text = ""; this.cmbtype.Text=""; this.cmbproname.Items.Clear();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 168/225
db.com.CommandText = "select itemid from items where itemname='" +this.cmbclassification.Text + "'";
itemid = Convert.ToInt32(db.com.ExecuteScalar()); db.com.CommandText = "select distinct gunname as gn from productinsert whereclassification='"+this.cmbclassification.Text+"'"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{
if (db.dr["gn"].ToString() != "") this.cmbproname.Items.Add(db.dr["gn"].ToString());
} db.dr.Close();
}
private void txtcname_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtaddress.Focus();
}
private void txtaddress_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtlicence.Focus();
}
private void txtlicence_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtvalid.Focus();
}
private void txtvalid_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtcontactno.Focus();
}
private void txtcontactno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.cmbstate.Focus();}
private void txtstate_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.cmbcity.Focus();
}
private void txtcity_KeyDown(object sender, KeyEventArgs e){
}
private void txtarmsno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter){
this.cmbclassification.Focus();}
}
private void cmbbore_SelectedIndexChanged( object sender, EventArgs e){
this.cmbtype.Items.Clear(); this.cmbcompany.Items.Clear(); db.com.CommandText = "select type,company from productinsert where gunname='"+ this.cmbproname.Text + "'and classification='"+this.cmbclassification.Text+"' andbore='"+this.cmbbore.Text+"'"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["type"].ToString() != "") this.cmbtype.Items.Add(db.dr["type"].ToString());
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 169/225
if (db.dr["company"].ToString() != "") this.cmbcompany.Items.Add(db.dr["company"].ToString());
} db.dr.Close(); if (this.cmbtype.Items.Count >= 2)
{ for (int i = 0; i < cmbtype.Items.Count; i++)
{ for (int j = i + 1; j < cmbtype.Items.Count; j++)
{ if (this.cmbtype.Items[i].ToString() ==this.cmbtype.Items[j].ToString())
{ this.cmbtype.Items.RemoveAt(i);
}}
}}
if (this.cmbcompany.Items.Count >= 2){
for (int i = 0; i < cmbcompany.Items.Count; i++){
for (int j = i + 1; j < cmbcompany.Items.Count; j++){
if (this.cmbcompany.Items[i].ToString() ==
this.cmbcompany.Items[j].ToString()){ this.cmbcompany.Items.RemoveAt(i);
}}
}}
} int rs,remainrs,duers; private void txtpayable_KeyDown(object sender, KeyEventArgs e)
{ if (e.KeyCode == Keys.Enter) this.txtreceiveamount.Focus();
}
private void txtreceiveamount_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtdue.Focus();
}
private void txtdue_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnsave.Focus();
} private void radbillinvoice_CheckedChanged( object sender, EventArgs e)
{ this.lbldue.Visible = true; this.txtdue.Visible = true; //this.numberqty.Location = new Point(362, 266); //this.label10.Location = new Point(281, 270);
Enable();
}
private void radcashmemo_CheckedChanged(object sender, EventArgs e){
this.txtdue.Text = "0"; this.lbldue.Visible = false; this.txtdue.Visible = false; //this.numberqty.Location = new Point(362, 241); //this.label10.Location = new Point(282, 246);
}
void Enable(){
this.txtaddress.Enabled = true; this.cmbarmsno.Enabled = true; this.cmbcity.Enabled = true; this.txtcname.Enabled = true; this.txtcontactno.Enabled = true; this.txtdue.Enabled = true; this.txtlicence.Enabled = true;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 170/225
this.txtpayable.Enabled = true; this.txtreceiveamount.Enabled = true; this.cmbstate.Enabled = true; this.txtvalid.Enabled = true; this.cmbbore.Enabled = true; this.cmbclassification.Enabled = true; this.cmbcompany.Enabled = true; this.cmbproname.Enabled = true;
this.cmbtype.Enabled = true; this.numberqty.Enabled = true; this.datetime.Enabled = true; this.lbldue.Visible = true; this.btncancel.Enabled = true; this.btnsave.Enabled = true; this.txtdue.Visible = true; this.txtprie.Enabled = true;
}
private void txtdue_Enter(object sender, EventArgs e){
try{
rs = Convert.ToInt32(this.txtpayable.Text);remainrs = Convert.ToInt32(this.txtreceiveamount.Text);
duers = rs - remainrs; this.txtdue.Text = duers.ToString();}
catch { }}
private void numberqty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpayable.Focus();
}
private void btnclear_Click(object sender, EventArgs e){
this.txtaddress.Text = ""; this.cmbarmsno.Text = ""; this.txtcname.Text = "";
this.txtcontactno.Text = ""; this.txtdue.Text = ""; this.txtlicence.Text = ""; this.txtpayable.Text = ""; this.txtreceiveamount.Text = ""; this.txtvalid.Text = ""; this.cmbbore.Text = ""; this.cmbcity.Text = ""; this.cmbclassification.Text = ""; this.cmbcompany.Text = ""; this.cmbproname.Text = ""; this.cmbstate.Text = ""; this.cmbtype.Text = ""; this.cmbvariety.Text = ""; this.txtprie.Text = ""; this.numberqty.Value = 1;
}
private void cmbstate_DropDownClosed(object sender, EventArgs e){
this.cmbcity.Focus();}
private void cmbstate_KeyDown(object sender, KeyEventArgs e){
if(e.KeyCode== Keys.Enter) this.cmbcity.Focus();
}
private void cmbstate_SelectedIndexChanged( object sender, EventArgs e){
db.com.CommandText = "select stateid from states wherestatename='"+this.cmbstate.Text+"'"; int ssid = Convert.ToInt32(db.com.ExecuteScalar()); this.cmbcity.Items.Clear();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 171/225
db.com.CommandText = "select cityname as ci from cities wherestateid="+ssid+""; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["ci"].ToString() != "") this.cmbcity.Items.Add(db.dr["ci"]);
} db.dr.Close();
}
private void cmbcity_KeyDown(object sender, KeyEventArgs e){
}
private void cmbarmsno_DropDownClosed(object sender, EventArgs e){
this.cmbtype.Focus();}
private void cmbarmsno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.cmbclassification.Focus();
}
private void cmbclassification_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.cmbproname.Focus();
}
private void cmbclassification_DropDownClosed( object sender, EventArgs e){
this.cmbproname.Focus();}
private void cmbproname_DropDownClosed(object sender, EventArgs e){
this.cmbbore.Focus();}
private void cmbproname_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.cmbbore.Focus();
}
private void cmbbore_DropDownClosed(object sender, EventArgs e){
this.cmbarmsno.Focus();}
private void cmbtype_DropDownClosed(object sender, EventArgs e){
this.cmbcompany.Focus();}
private void cmbtype_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.cmbcompany.Focus();
}
private void cmbcompany_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.datetime.Focus();
}
private void cmbcompany_DropDownClosed(object sender, EventArgs e){
this.cmbvariety.Focus();}
private void datetime_CloseUp(object sender, EventArgs e){
this.txtprie.Focus();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 172/225
}
private void cmbbore_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.cmbtype.Focus();
}
private void cmbtype_SelectedIndexChanged( object sender, EventArgs e){
db.com.CommandText = "select * from productinsert where
type='"+this.cmbtype.Text+"'"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbvariety.Items.Clear(); this.cmbvariety.Items.Add(db.dr["Lodertype"]);
}db.dr.Close();
}
private void cmbcity_DropDownClosed(object sender, EventArgs e){
this.cmbclassification.Focus();}
private void label7_Click(object sender, EventArgs e){
}
private void cmbcompany_SelectedIndexChanged( object sender, EventArgs e){
}
private void cmbvariety_DropDownClosed(object sender, EventArgs e){
this.datetime.Focus();}
private void txtprie_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.numberqty.Focus();
}
private void numberqty_Enter(object sender, EventArgs e){
}
private void txtpayable_Enter(object sender, EventArgs e){
int aa = Convert.ToInt32(this.txtprie.Text); int bb = Convert.ToInt32(this.numberqty.Value);
int cc = aa * bb; this.txtpayable.Text = cc.ToString();
}
}
}
using System;using System.Collections.Generic;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 173/225
using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{
public partial class FrmRepair : Form{
public FrmRepair(){
InitializeComponent();}
private void btnok_Click(object sender, EventArgs e){
try{
db.com.CommandText = "insert into repairvalues("+maxsno+",'"+this.txtname.Text+"','"+this.txtadd.Text+"','"+this.txtdesc.Text+"','"+this.txtrepair.Text+"','"+this.txtpaya.Text+"',"+this.txtreceived.Text+","+this.txtdue.Text+",'"+this.datetime.Value.Date.ToShortDateString()+ "')"; db.com.ExecuteNonQuery(); bharatDataSet.repairtRow rw = bharatDataSet.repairt.NewrepairtRow();
rw.Name = this.txtname.Text;rw.address = this.txtadd.Text;rw.description = this.txtdesc.Text;rw.repairtype = this.txtrepair.Text;rw.payable = Convert.ToInt32(this.txtpaya.Text);rw.received = Convert.ToInt32(this.txtreceived.Text);rw.due = Convert.ToInt32(this.txtdue.Text);rw.rdate = this.datetime.Value.Date.ToShortDateString();
this.bharatDataSet.repairt.Rows.Add(rw); MessageBox.Show("Record Inserted"); this.txtname.Text = ""; this.txtdesc.Text = ""; this.txtrepair.Text = ""; this.txtpaya.Text = ""; this.txtdue.Text = ""; this.txtreceived.Text = ""; this.txtadd.Text = "";
} catch { }
} private void btncancel_Click(object sender, EventArgs e)
{ this.Close();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ FrmRepairEdit edt = new FrmRepairEdit();
edt.Show(); this.Close();
} int maxsno;
private void FrmRepair_Load(object sender, EventArgs e){
this.txtname.Focus(); try
{ db.com.CommandText = "select max(sno) from repair";
maxsno = Convert.ToInt32(db.com.ExecuteScalar());maxsno++;
} catch { maxsno++; }
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ FrmRepairEdit edt = new FrmRepairEdit();
edt.Show(); this.Close();
} private void txtarmsno_KeyDown(object sender, KeyEventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 174/225
{ if (e.KeyCode == Keys.Enter) this.txtname.Focus();
} private void cmbclassifiation_DropDownClosed( object sender, EventArgs e)
{ this.txtdesc.Focus();
}
private void txtparty_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.datetime.Focus();
}
private void txtname_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtadd.Focus();
}
private void txtadd_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtdesc.Focus();
}
private void txtdesc_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtrepair.Focus();
}
private void txtpaya_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtreceived.Focus();
}
private void txtreceived_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.txtdue.Focus();}
private void txtdue_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.datetime.Focus();
}
private void datetime_CloseUp(object sender, EventArgs e){
this.btnok.Focus();}
int paya, rec, due; private void txtrepair_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter) this.txtpaya.Focus();
} private void txtdue_Enter(object sender, EventArgs e)
{paya = Convert.ToInt32(this.txtpaya.Text);rec = Convert.ToInt32(this.txtreceived.Text);due = paya - rec;
this.txtdue.Text = due.ToString();}
private void linkLabel2_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgse)
{ FrmrepairDues1 du = new FrmrepairDues1();
du.Show(); this.Close();
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 175/225
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmRepairEdit : Form
{ public FrmRepairEdit()
{
InitializeComponent();}
private void FrmRepairEdit_Load(object sender, EventArgs e){
// TODO: This line of code loads data into the 'bharatDataSet.repair' table.You can move, or remove it, as needed. this.repairTableAdapter.Fill(this.bharatDataSet.repair);
} private void btnEdit_Click(object sender, EventArgs e)
{ try
{ db.com.CommandText = "update repair set party='" + this.txtname.Text +"',address='"+this.txtadd.Text+"',rdate='"+this.txtdate.Text+"',description='"+this.txtdesc.Text+"',due="+this.txtdue.Text+",payable="+this.txtpaya.Text+",received="+this.txtreceived.Text+",repairtype='"+this.txtrepair.Text+"'where sno="+sno+"";
db.com.ExecuteNonQuery(); MessageBox.Show("Record Updated"); this.txtadd.Text = ""; this.txtdate.Text = ""; this.txtdesc.Text = ""; this.txtdue.Text = ""; this.txtname.Text = ""; this.txtpaya.Text = ""; this.txtreceived.Text = ""; this.txtrepair.Text = ""; this.Close(); FrmRepairEdit re = new FrmRepairEdit();
re.Show();}
catch { }}
private void btnDelete_Click(object sender, EventArgs e){
try{
DialogResult dr = MessageBox.Show("Are u sure toDelete ?","Delete",MessageBoxButtons.YesNo,MessageBoxIcon.Question); if (dr == DialogResult.Yes)
{ db.com.CommandText = "delete from repair where sno=" + sno + ""; db.com.ExecuteNonQuery(); this.Close(); FrmRepairEdit re = new FrmRepairEdit();
re.Show();}
} catch { }
} private void btncancel_Click(object sender, EventArgs e)
{
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 176/225
this.Close();}
int sno; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{sno = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value);
db.com.CommandText = "select * from repair where sno="+sno+""; db.dr = db.com.ExecuteReader();
if (db.dr.Read()){
this.txtadd.Text = db.dr["address"].ToString(); this.txtdate.Text = db.dr["rdate"].ToString(); this.txtdesc.Text = db.dr["description"].ToString(); this.txtdue.Text = db.dr["due"].ToString(); this.txtname.Text = db.dr["party"].ToString(); this.txtpaya.Text = db.dr["payable"].ToString(); this.txtreceived.Text = db.dr["received"].ToString(); this.txtrepair.Text = db.dr["repairtype"].ToString();
}db.dr.Close();
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House
{ public partial class FrmBackToParty : Form
{ public FrmBackToParty()
{InitializeComponent();
}
private void FrmBackToParty_Load(object sender, EventArgs e){
// TODO: This line of code loads data into the 'bharatDataSet.repair' table.You can move, or remove it, as needed. this.repairTableAdapter.Fill(this.bharatDataSet.repair);
}
private void btnok_Click(object sender, EventArgs e){
int max; try
{ db.com.CommandText = "select max(sno) from partyback";
max = Convert.ToInt32(db.com.ExecuteScalar());max++;
} catch { max = 1; } try
{ db.com.CommandText = "insert into partyback values("+max+",'" +this.txtname.Text + "','" + this.txtadd.Text + "','" + this.txtdesc.Text + "','" +this.txtrepair.Text +"',"+this.txtpaya.Text+","+this.txtreceived.Text+","+this.txtdue.Text+",'"+this.dateTimePicker1.Value.Date.ToShortDateString()+ "')"; db.com.ExecuteNonQuery();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 177/225
db.com.CommandText = "delete from repair whereparty='"+this.txtname.Text+"' and address='"+this.txtadd.Text+"'"; db.com.ExecuteNonQuery();
MessageBox.Show("Return Successfully....."); this.txtadd.Text = ""; this.txtdesc.Text = ""; this.txtdue.Text = "";
this.txtname.Text = ""; this.txtpaya.Text = ""; this.txtreceived.Text = ""; this.txtrepair.Text = ""; this.Close(); FrmBackToParty pa = new FrmBackToParty();
pa.Show();}
catch { }}
private void btncancel_Click(object sender, EventArgs e){
this.Close();}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ Frmpartybackedit par = new Frmpartybackedit();
par.Show(); this.Close();
}
private void pictureBox1_Click(object sender, EventArgs e){
} int nn; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{nn = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value);
db.com.CommandText = "select * from repair where sno="+nn+""; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ this.txtname.Text = db.dr["party"].ToString(); this.txtadd.Text = db.dr["address"].ToString(); this.txtdesc.Text = db.dr["description"].ToString(); this.txtrepair.Text = db.dr["repairtype"].ToString(); this.txtpaya.Text = db.dr["payable"].ToString(); this.txtreceived.Text = db.dr["received"].ToString(); this.txtdue.Text = db.dr["due"].ToString();
}db.dr.Close();
}
private void txtname_KeyDown(object sender, KeyEventArgs e)
{ if (e.KeyCode == Keys.Enter) this.txtadd.Focus();
}
private void txtadd_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtdesc.Focus();
}
private void txtdesc_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtrepair.Focus();
}
private void txtrepair_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 178/225
this.txtpaya.Focus();}
private void txtpaya_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtreceived.Focus();
}
private void txtdue_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.dateTimePicker1.Focus();
}
private void txtreceived_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtdue.Focus();
}
private void dateTimePicker1_CloseUp(object sender, EventArgs e){
this.btnok.Focus();
}}}
using System;using System.Collections.Generic;
using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class Frmpartybackedit : Form
{ public Frmpartybackedit()
{InitializeComponent();
}
private void Frmpartybackedit_Load(object sender, EventArgs e)
{ // TODO: This line of code loads data into the 'bharatDataSet.partyback'table. You can move, or remove it, as needed. this.partybackTableAdapter.Fill(this.bharatDataSet.partyback);
} private void btnEdit_Click(object sender, EventArgs e)
{ db.com.CommandText = "update partyback setparty='"+this.txtname.Text+"',address='"+this.txtadd.Text+"',description='"+this.txtdesc.Text+"',repairtype='"+this.txtrepair.Text+"',payable="+this.txtpaya.Text+",received="+this.txtreceived.Text+",due="+this.txtdue.Text+",rdate='"+this.txtdate1.Text+"' wheresno="+sn+""; db.com.ExecuteNonQuery(); MessageBox.Show("Updated.."); this.txtadd.Text = ""; this.txtdate1.Text = ""; this.txtdesc.Text = ""; this.txtdue.Text = ""; this.txtname.Text = ""; this.txtpaya.Text = "";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 179/225
this.txtreceived.Text = ""; this.txtrepair.Text = ""; Frmpartybackedit ed = new Frmpartybackedit();
ed.Show();}
private void btndelete_Click(object sender, EventArgs e){
try{
DialogResult dr=MessageBox.Show("Are Usure ?","Delete",MessageBoxButtons.YesNo,MessageBoxIcon.Question); if(dr==DialogResult.Yes)
{ db.com.CommandText="delete from partyback where sno="+sn+"";
db.com.ExecuteNonQuery(); this.txtadd.Text=""; this.txtdate1.Text=""; this.txtdesc.Text=""; this.txtdue.Text=""; this.txtname.Text=""; this.txtpaya.Text=""; this.txtreceived.Text=""; this.txtrepair.Text="";
this.Close(); Frmpartybackedit ed = new Frmpartybackedit();ed.Show();
}}
catch { }}
private void btnref_Click(object sender, EventArgs e){}
private void btncancel_Click(object sender, EventArgs e){
this.Close();}
private void groupBox1_Enter(object sender, EventArgs e){
}
private void txtarmsno_KeyDown(object sender, KeyEventArgs e){
}
private void txtparty_KeyDown(object sender, KeyEventArgs e){
}
private void txtdate_KeyDown(object sender, KeyEventArgs e)
{
} int sn; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{sn = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value);
db.com.CommandText = "select * from partyback where sno="+sn+""; db.dr = db.com.ExecuteReader(); if (db.dr.Read())
{ this.txtadd.Text = db.dr["address"].ToString(); this.txtname.Text = db.dr["party"].ToString(); this.txtdesc.Text = db.dr["description"].ToString(); this.txtrepair.Text = db.dr["repairtype"].ToString(); this.txtpaya.Text = db.dr["payable"].ToString(); this.txtreceived.Text = db.dr["received"].ToString(); this.txtdue.Text = db.dr["due"].ToString();
}db.dr.Close();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 180/225
}
private void txtname_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtadd.Focus();
}
private void txtadd_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtdesc.Focus();
}
private void txtdesc_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtrepair.Focus();
}
private void txtrepair_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtpaya.Focus();
}
private void txtpaya_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtreceived.Focus();
}
private void txtreceived_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtdue.Focus();
}
private void txtdue_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.txtdate1.Focus();}
private void txtdate1_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnEdit.Focus();
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class StockReortFrm : Form
{ public StockReortFrm()
{InitializeComponent();
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 181/225
private void StockReortFrm_Load(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(bh.productinsert);
StocklReport ss = new StocklReport();
ss.SetDataSource(bh);crystalReportViewer1.ReportSource = ss;
db.com.CommandText = "select distinct gunname as gg from productinsert "; db.dr = db.com.ExecuteReader(); while(db.dr.Read())
{ this.cmbpnamee.Items.Add(db.dr["gg"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct bore as gg from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbboree.Items.Add(db.dr["gg"].ToString());
}
db.dr.Close();
db.com.CommandText = "select distinct company as gg from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbcompanyy.Items.Add(db.dr["gg"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct classification as gg from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbclassificationn.Items.Add( db.dr["gg"].ToString());
}
db.dr.Close();
db.com.CommandText = "select distinct location as gg from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmblocation.Items.Add(db.dr["gg"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct gunname as gg from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbpname.Items.Add(db.dr["gg"].ToString());
}
db.dr.Close();}
private void cmbproname_SelectedValueChanged( object sender, EventArgs e){
string gg;gg = this.cmbproname.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='" + gg +
"'";}
private void cmbcompany_SelectedValueChanged( object sender, EventArgs e){
string gg;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 182/225
gg = this.cmbcompany.Text; bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
crystalReportViewer1.SelectionFormula = "{productinsert.company}='" + gg +"'";
}
private void cmbclas_SelectedValueChanged( object sender, EventArgs e){
string gg;gg = this.cmbclas.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
crystalReportViewer1.SelectionFormula = "{productinsert.classification}='" +gg + "'";}
private void dateTimePicker1_ValueChanged( object sender, EventArgs e){
string gg;gg = this.dateTimePicker1.Value.ToShortDateString();
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.purchasedate}='" + gg
+ "'";}
private void button4_Click(object sender, EventArgs e){
if (this.chgunn.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Arms'" ;
}
if (this.chgunn.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Ammunation'" ;}
if (this.chgunn.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 183/225
crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Acessories'" ;}
if (this.chgunn.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.bore}>0";}
if (this.chpistolee.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);
crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'and {productinsert.classification}='Arms'";
} if (this.chpistolee.Checked && this.radammunationn.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Ammunation'";}
if (this.chpistolee.Checked && this.radacessoriess.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Acessories'";}
if (this.chpistolee.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.bore}>0";}
if (this.chrevolverr.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Arms'";}
if (this.chrevolverr.Checked && this.radammunationn.Checked)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 184/225
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
crystalReportViewer1.SelectionFormula ="{productinsert.gunname}='Revolver' and {productinsert.classification}='Ammunation'";
} if (this.chrevolverr.Checked && this.radacessoriess.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Acessories'";}
if (this.chrevolverr.Checked && this.radboree.Checked)
{ bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.bore}>0";}
if (this.chriflee.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Arms'";}
if (this.chriflee.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Ammunation'";}
if (this.chriflee.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Acessories'";}
if (this.chriflee.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 185/225
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.bore}>0";}
}
private void cmbpnamee_SelectedIndexChanged( object sender, EventArgs e){
string gg;gg = this.cmbpnamee.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='" + gg +
"'"; this.cmbboree.Text = ""; this.cmbclassificationn.Text = ""; this.cmbcompanyy.Text = "";
this.cmblocation.Text = ""; this.cmbproname.Text = "";}
private void cmbcompanyy_SelectedIndexChanged( object sender, EventArgs e){
string gg;gg = this.cmbcompanyy.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.company}='" + gg +
"'";
this.cmbboree.Text = ""; this.cmbclassificationn.Text = ""; this.cmbpnamee.Text = ""; this.cmblocation.Text = ""; this.cmbproname.Text = "";
}
private void cmbclassificationn_SelectedIndexChanged( object sender, EventArgs e){
string gg;gg = this.cmbclassificationn.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.classification}='" +
gg + "'"; this.cmbboree.Text = ""; this.cmbclassificationn.Text = ""; this.cmbcompanyy.Text = ""; this.cmblocation.Text = ""; this.cmbproname.Text = "";
}
private void cmbboree_SelectedIndexChanged( object sender, EventArgs e){
string gg;gg = this.cmbboree.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 186/225
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.bore}=" + gg + "";
}
private void dateTimee_ValueChanged(object sender, EventArgs e){
string gg;gg = this.dateTimee.Value.ToShortDateString();
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.purchasedate}='" + gg
+ "'";}
private void button3_Click(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(bh.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(bh);crystalReportViewer1.ReportSource = ss;
}
private void cmbpname_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='" +this.cmbpname.Text + "'and {productinsert.location}='" + this.cmblocation.Text + "'";
}
private void chpistolee_CheckStateChanged( object sender, EventArgs e){
this.chgunn.CheckState = CheckState.Unchecked; this.chrevolverr.CheckState = CheckState.Unchecked; this.chriflee.CheckState = CheckState.Unchecked;
}
private void chgunn_CheckStateChanged(object sender, EventArgs e){
this.chrevolverr.CheckState = CheckState.Unchecked; this.chriflee.CheckState = CheckState.Unchecked;
this.chpistolee.CheckState = CheckState.Unchecked;}
private void chriflee_CheckedChanged(object sender, EventArgs e){
this.chrevolverr.CheckState = CheckState.Unchecked;
this.chgunn.CheckState = CheckState.Unchecked; this.chpistolee.CheckState = CheckState.Unchecked;
}
private void chrevolverr_CheckedChanged(object sender, EventArgs e){
this.chgunn.CheckState = CheckState.Unchecked;
this.chriflee.CheckState = CheckState.Unchecked; this.chpistolee.CheckState = CheckState.Unchecked;
}
private void radarmss_CheckedChanged(object sender, EventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 187/225
{ if (this.chgunn.Checked && this.radarmss.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Arms'" ;}
if (this.chpistolee.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Arms'";
} if (this.chrevolverr.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Revolver'
and {productinsert.classification}='Arms'";}
if (this.chriflee.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Arms'";}
}
private void radammunationn_CheckedChanged( object sender, EventArgs e){
if (this.chgunn.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Ammunation'" ;}
if (this.chpistolee.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Ammunation'";}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 188/225
if (this.chrevolverr.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);
crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Ammunation'";}
if (this.chriflee.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Ammunation'";}
}
private void radacessoriess_CheckedChanged( object sender, EventArgs e){
if (this.chgunn.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Acessories'" ;}
if (this.chpistolee.Checked && this.radacessoriess.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Acessories'";}
if (this.chrevolverr.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Acessories'";}
if (this.chriflee.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Acessories'";}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 189/225
}
private void radboree_CheckedChanged(object sender, EventArgs e){
if (this.chrevolverr.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.bore}>0";}
if (this.chpistolee.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);
crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'and {productinsert.bore}>0";
} if (this.chriflee.Checked && this.radboree.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.bore}>0";}
}
private void datetime1_ValueChanged(object sender, EventArgs e){
String strr1 = this.dateTimee.Value.Date.ToShortDateString(); String strr = this.datetime1.Value.Date.ToShortDateString(); bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.purchasedate}>= '" +
strr1 + "' and {productinsert.purchasedate}<='" + strr + "'";}
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 190/225
namespace Bharat_Gun_House{ public partial class Frmdaliyconreport : Form
{ public Frmdaliyconreport()
{InitializeComponent();
}
private void button1_Click(object sender, EventArgs e){
bharatDataSet da = new bharatDataSet();bharatDataSetTableAdapters.receivedetailTableAdapter ta = new
Bharat_Gun_House.bharatDataSetTableAdapters. receivedetailTableAdapter();ta.Fill(da.receivedetail);
DailyConReport dl = new DailyConReport();dl.SetDataSource(da);crystalReportViewer1.ReportSource = dl;crystalReportViewer1.SelectionFormula = "{receivedetail.Receivedate}='" +
this.dateTimePicker1.Value.Date.ToShortDateString() + "'";}
private void button2_Click(object sender, EventArgs e)
{ this.Close();}
private void crystalReportViewer1_Load(object sender, EventArgs e){
}
private void comboBox1_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet da = new bharatDataSet();bharatDataSetTableAdapters.receivedetailTableAdapter ta = new
Bharat_Gun_House.bharatDataSetTableAdapters. receivedetailTableAdapter();ta.Fill(da.receivedetail);
DailyConReport dl = new DailyConReport();dl.SetDataSource(da);
crystalReportViewer1.ReportSource = dl;crystalReportViewer1.SelectionFormula = "{receivedetail.partyname}='"
+this.cmbparty.Text+ "'";}
private void dateTimePicker1_ValueChanged( object sender, EventArgs e){
bharatDataSet da = new bharatDataSet();bharatDataSetTableAdapters.receivedetailTableAdapter ta = new
Bharat_Gun_House.bharatDataSetTableAdapters. receivedetailTableAdapter();ta.Fill(da.receivedetail);
DailyConReport dl = new DailyConReport();dl.SetDataSource(da);crystalReportViewer1.ReportSource = dl;crystalReportViewer1.SelectionFormula = "{receivedetail.Receivedate}='" +
this.dateTimePicker1.Value.Date.ToShortDateString() + "'";
}
private void Frmdaliyconreport_Load(object sender, EventArgs e){
try{
db.com.CommandText = "delete from receivedetail"; db.com.ExecuteNonQuery(); db.com.CommandText = "Select * from consignment_view"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ bharatDataSet.receivedetailRow r =bharatDataSet.receivedetail.NewreceivedetailRow();
r.Sno = Convert.ToInt32(db.dr["sno"]);r.subitemsid = Convert.ToInt32(db.dr["subitemsid"]);r.consignmentid = Convert.ToInt32(db.dr["consignmentid"]);r.armsno = db.dr["armsno"].ToString();r.bore = Convert.ToDecimal(db.dr["bore"]);r.classification = db.dr["classification"].ToString();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 191/225
r.company = db.dr["company"].ToString();r.gunname = db.dr["gunname"].ToString();r.Lodertype = db.dr["lodertype"].ToString();r.location = db.dr["location"].ToString();r.marketprice = Convert.ToInt32(db.dr["marketprice"]);r.partyaddress = db.dr["partyaddress"].ToString();r.partyid = Convert.ToInt32(db.dr["partyid"]);r.partyname = db.dr["partyname"].ToString();
r.qty = Convert.ToInt32(db.dr["qty"].ToString());r.receivedate = db.dr["conreceivedate"].ToString();r.type = db.dr["Type"].ToString();r.useqty = Convert.ToInt32(db.dr["useqty"]);r.remainingqty = Convert.ToInt32(db.dr[14]);bharatDataSet.receivedetail.Rows.Add(r);receivedetailTableAdapter.Update(bharatDataSet.receivedetail);
} db.dr.Close();
} catch (Exception ee) { MessageBox.Show(ee.ToString()); } db.com.CommandText = "select distinct partyname as nm from consignment_view"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbparty.Items.Add(db.dr["nm"].ToString());
} db.dr.Close();}
private void button1_Click_1(object sender, EventArgs e){
bharatDataSet da = new bharatDataSet();bharatDataSetTableAdapters.receivedetailTableAdapter ta = new
Bharat_Gun_House.bharatDataSetTableAdapters. receivedetailTableAdapter();ta.Fill(da.receivedetail);
DailyConReport dl = new DailyConReport();dl.SetDataSource(da);crystalReportViewer1.ReportSource = dl;
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;
using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmReturnrep : Form
{ public FrmReturnrep()
{InitializeComponent();
}
private void FrmReturnrep_Load(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ConReturnTableAdapter ret = new
Bharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
ConsinReturnReport cr = new ConsinReturnReport();cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 192/225
db.com.CommandText = "select distinct gunname as pr from conreturn"; db.dr = db.com.ExecuteReader(); while(db.dr.Read())
{ if (db.dr["pr"] != "")
{ this.cmbproductname.Items.Add(db.dr["pr"].ToString());
}}
db.dr.Close();
db.com.CommandText = "select distinct party as par from conreturn"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["par"] != "") this.cmbparty.Items.Add(db.dr["par"].ToString());
} db.dr.Close();
} private void cmbproductname_SelectedIndexChanged( object sender, EventArgs e)
{ bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.ConReturnTableAdapter ret = newBharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
ConsinReturnReport cr = new ConsinReturnReport();cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;crystalReportViewer1.SelectionFormula = "{Conreturn.gunname}='" +
this.cmbproductname.Text + "'";}
private void cmbparty_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ConReturnTableAdapter ret = new
Bharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
ConsinReturnReport cr = new ConsinReturnReport();
cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;crystalReportViewer1.SelectionFormula = "{Conreturn.party}='" +
this.cmbparty.Text + "'";}
private void dateTimePicker1_ValueChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ConReturnTableAdapter ret = new
Bharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
ConsinReturnReport cr = new ConsinReturnReport();cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;crystalReportViewer1.SelectionFormula = "{Conreturn.returndate}='" +
this.dateTimePicker1.Value.Date.ToShortDateString() + "'";}
private void btnshowall_Click(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ConReturnTableAdapter ret = new
Bharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
ConsinReturnReport cr = new ConsinReturnReport();cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;
}}
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 193/225
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;
using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmGivenToOtherReport : Form
{ public FrmGivenToOtherReport()
{InitializeComponent();
}
private void FrmGivenToOtherReport_Load(object sender, EventArgs e){
db.com.CommandText = "select distinct itemname as pro from subitem"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbproductname.Items.Add(db.dr["pro"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct itemname as comp from items"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbclassification.Items.Add(db.dr["comp"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct partyname as par from party";
db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbparty.Items.Add(db.dr["par"].ToString());
} db.dr.Close(); bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.GivenStockTableAdapter pa = newBharat_Gun_House.bharatDataSetTableAdapters. GivenStockTableAdapter();
pa.Fill(bh.GivenStock); GiveDataToOtherPartyReport gi = new GiveDataToOtherPartyReport();
gi.SetDataSource(bh);crystalReportViewer1.ReportSource = gi;
}
private void dateTimePicker1_ValueChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.GivenStockTableAdapter pa = new
Bharat_Gun_House.bharatDataSetTableAdapters. GivenStockTableAdapter();pa.Fill(bh.GivenStock);
GiveDataToOtherPartyReport giv = new GiveDataToOtherPartyReport();giv.SetDataSource(bh);crystalReportViewer1.ReportSource = giv;crystalReportViewer1.SelectionFormula = "{GivenStock.givendate}='" +
this.dateTimePicker1.Value.Date.ToShortDateString() + "'";}
private void cmbproductname_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.GivenStockTableAdapter pa = new
Bharat_Gun_House.bharatDataSetTableAdapters. GivenStockTableAdapter();pa.Fill(bh.GivenStock);
GiveDataToOtherPartyReport giv = new GiveDataToOtherPartyReport();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 194/225
giv.SetDataSource(bh);crystalReportViewer1.ReportSource = giv;crystalReportViewer1.SelectionFormula =
"{GivenStock.gunname}='"+this.cmbproductname.Text+"'"; this.cmbclassification.Text = ""; this.cmbparty.Text = "";
}
private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.GivenStockTableAdapter pa = new
Bharat_Gun_House.bharatDataSetTableAdapters. GivenStockTableAdapter();pa.Fill(bh.GivenStock);
GiveDataToOtherPartyReport giv = new GiveDataToOtherPartyReport();giv.SetDataSource(bh);crystalReportViewer1.ReportSource = giv;crystalReportViewer1.SelectionFormula =
"{GivenStock.classification}='" +this.cmbclassification.Text+"'"; this.cmbparty.Text = ""; this.cmbproductname.Text = "";
}
private void cmbparty_SelectedIndexChanged( object sender, EventArgs e)
{ string cm = this.cmbparty.Text; bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.GivenStockTableAdapter pa = newBharat_Gun_House.bharatDataSetTableAdapters. GivenStockTableAdapter();
pa.Fill(bh.GivenStock); GiveDataToOtherPartyReport giv = new GiveDataToOtherPartyReport();
giv.SetDataSource(bh);crystalReportViewer1.ReportSource = giv;crystalReportViewer1.SelectionFormula = "{GivenStock.name}='" +cm+ "'";
this.cmbclassification.Text = ""; this.cmbproductname.Text = "";
}
private void BTNSHOWALL_Click(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.GivenStockTableAdapter pa = newBharat_Gun_House.bharatDataSetTableAdapters. GivenStockTableAdapter();
pa.Fill(bh.GivenStock); GiveDataToOtherPartyReport giv = new GiveDataToOtherPartyReport();
giv.SetDataSource(bh);crystalReportViewer1.ReportSource = giv;
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmReturnOwnData : Form
{ public FrmReturnOwnData()
{
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 195/225
InitializeComponent();}
private void FrmReturnOwnData_Load(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ReturnStockTableAdapter redata = new
Bharat_Gun_House.bharatDataSetTableAdapters. ReturnStockTableAdapter();
redata.Fill(bh.ReturnStock); ReturnOwnData rdata = new ReturnOwnData();
rdata.SetDataSource(bh);crystalReportViewer1.ReportSource = rdata;
db.com.CommandText = "select distinct partyname as pa from party"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbparty.Items.Add(db.dr["pa"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct company as cna from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbcompanyname.Items.Add(db.dr["cna"].ToString());}
db.dr.Close();
db.com.CommandText = "select distinct itemname as clas from items"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbclassification.Items.Add(db.dr["clas"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct itemname as prna from subitem"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{
this.cmbproductname.Items.Add(db.dr["prna"].ToString());}
db.dr.Close();}
private void cmbparty_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ReturnStockTableAdapter redata = new
Bharat_Gun_House.bharatDataSetTableAdapters. ReturnStockTableAdapter();redata.Fill(bh.ReturnStock);
ReturnOwnData rdata = new ReturnOwnData();rdata.SetDataSource(bh);crystalReportViewer1.ReportSource = rdata;crystalReportViewer1.SelectionFormula =
"{ReturnStock.name}='"+this.cmbparty.Text+"'";
this.cmbclassification.Text = ""; this.cmbproductname.Text = ""; this.cmbcompanyname.Text = "";
}
private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ReturnStockTableAdapter redata = new
Bharat_Gun_House.bharatDataSetTableAdapters. ReturnStockTableAdapter();redata.Fill(bh.ReturnStock);
ReturnOwnData rdata = new ReturnOwnData();rdata.SetDataSource(bh);crystalReportViewer1.ReportSource = rdata;crystalReportViewer1.SelectionFormula = "{ReturnStock.classification}='" +
this.cmbclassification.Text + "'"; this.cmbparty.Text = ""; this.cmbproductname.Text = ""; this.cmbcompanyname.Text = "";
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 196/225
private void cmbcompanyname_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ReturnStockTableAdapter redata = new
Bharat_Gun_House.bharatDataSetTableAdapters. ReturnStockTableAdapter();redata.Fill(bh.ReturnStock);
ReturnOwnData rdata = new ReturnOwnData();
rdata.SetDataSource(bh);crystalReportViewer1.ReportSource = rdata;crystalReportViewer1.SelectionFormula = "{ReturnStock.company}='" +
this.cmbcompanyname.Text + "'"; this.cmbclassification.Text = ""; this.cmbproductname.Text = ""; this.cmbparty.Text = "";
}
private void cmbproductname_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ReturnStockTableAdapter redata = new
Bharat_Gun_House.bharatDataSetTableAdapters. ReturnStockTableAdapter();redata.Fill(bh.ReturnStock);
ReturnOwnData rdata = new ReturnOwnData();
rdata.SetDataSource(bh);crystalReportViewer1.ReportSource = rdata;crystalReportViewer1.SelectionFormula = "{ReturnStock.gunname}='" +
this.cmbproductname.Text + "'"; this.cmbclassification.Text = ""; this.cmbparty.Text = ""; this.cmbcompanyname.Text = "";
}
private void datetime_ValueChanged(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ReturnStockTableAdapter redata = new
Bharat_Gun_House.bharatDataSetTableAdapters. ReturnStockTableAdapter();redata.Fill(bh.ReturnStock);
ReturnOwnData rdata = new ReturnOwnData();rdata.SetDataSource(bh);
crystalReportViewer1.ReportSource = rdata;crystalReportViewer1.SelectionFormula = "{ReturnStock.givendate}='" +
this.datetime.Value.Date.ToShortDateString() + "'"; this.cmbclassification.Text = ""; this.cmbproductname.Text = ""; this.cmbcompanyname.Text = ""; this.cmbparty.Text = "";
}
private void btnshowall_Click(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ReturnStockTableAdapter rr = new
Bharat_Gun_House.bharatDataSetTableAdapters. ReturnStockTableAdapter();rr.Fill(bh.ReturnStock);
ReturnOwnData red = new ReturnOwnData();
red.SetDataSource(bh);crystalReportViewer1.ReportSource = red;
}}
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 197/225
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;
using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class StockReortFrm : Form
{ public StockReortFrm()
{InitializeComponent();
}
private void StockReortFrm_Load(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(bh.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(bh);crystalReportViewer1.ReportSource = ss;
db.com.CommandText = "select distinct gunname as gg from productinsert "; db.dr = db.com.ExecuteReader(); while(db.dr.Read())
{ this.cmbpnamee.Items.Add(db.dr["gg"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct bore as gg from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbboree.Items.Add(db.dr["gg"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct company as gg from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbcompanyy.Items.Add(db.dr["gg"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct classification as gg from productinsert"; db.dr = db.com.ExecuteReader();
while (db.dr.Read()){
this.cmbclassificationn.Items.Add( db.dr["gg"].ToString());}
db.dr.Close();
db.com.CommandText = "select distinct location as gg from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmblocation.Items.Add(db.dr["gg"].ToString());
} db.dr.Close();
db.com.CommandText = "select distinct gunname as gg from productinsert "; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbpname.Items.Add(db.dr["gg"].ToString());
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 198/225
db.dr.Close();}
private void cmbproname_SelectedValueChanged( object sender, EventArgs e){
string gg;gg = this.cmbproname.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='" + gg +
"'";}
private void cmbcompany_SelectedValueChanged( object sender, EventArgs e){
string gg;gg = this.cmbcompany.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.company}='" + gg +
"'";}
private void cmbclas_SelectedValueChanged( object sender, EventArgs e){
string gg;gg = this.cmbclas.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.classification}='" +
gg + "'";}
private void dateTimePicker1_ValueChanged( object sender, EventArgs e){
string gg;gg = this.dateTimePicker1.Value.ToShortDateString();
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);
crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.purchasedate}='" + gg
+ "'";}
private void button4_Click(object sender, EventArgs e){
if (this.chgunn.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Arms'" ;
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 199/225
if (this.chgunn.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);
crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Ammunation'" ;}
if (this.chgunn.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Acessories'" ;}
if (this.chgunn.Checked && this.radboree.Checked){ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.bore}>0";}
if (this.chpistolee.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Arms'";}
if (this.chpistolee.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'and {productinsert.classification}='Ammunation'";
} if (this.chpistolee.Checked && this.radacessoriess.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Acessories'";}
if (this.chpistolee.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 200/225
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.bore}>0";}
if (this.chrevolverr.Checked && this.radarmss.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Arms'";}
if (this.chrevolverr.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Ammunation'";}
if (this.chrevolverr.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Acessories'";}
if (this.chrevolverr.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.bore}>0";}
if (this.chriflee.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Arms'";}
if (this.chriflee.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 201/225
crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'and {productinsert.classification}='Ammunation'";
} if (this.chriflee.Checked && this.radacessoriess.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Acessories'";}
if (this.chriflee.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'and {productinsert.bore}>0";}
}
private void cmbpnamee_SelectedIndexChanged( object sender, EventArgs e){
string gg;gg = this.cmbpnamee.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='" + gg +
"'"; this.cmbboree.Text = ""; this.cmbclassificationn.Text = ""; this.cmbcompanyy.Text = ""; this.cmblocation.Text = ""; this.cmbproname.Text = "";
}
private void cmbcompanyy_SelectedIndexChanged( object sender, EventArgs e){
string gg;gg = this.cmbcompanyy.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.company}='" + gg +
"'"; this.cmbboree.Text = ""; this.cmbclassificationn.Text = ""; this.cmbpnamee.Text = ""; this.cmblocation.Text = ""; this.cmbproname.Text = "";
}
private void cmbclassificationn_SelectedIndexChanged( object sender, EventArgs e){
string gg;gg = this.cmbclassificationn.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 202/225
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.classification}='" +
gg + "'"; this.cmbboree.Text = ""; this.cmbclassificationn.Text = "";
this.cmbcompanyy.Text = ""; this.cmblocation.Text = ""; this.cmbproname.Text = "";
}
private void cmbboree_SelectedIndexChanged( object sender, EventArgs e){
string gg;gg = this.cmbboree.Text;
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
crystalReportViewer1.SelectionFormula = "{productinsert.bore}=" + gg + "";}
private void dateTimee_ValueChanged(object sender, EventArgs e){
string gg;gg = this.dateTimee.Value.ToShortDateString();
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.purchasedate}='" + gg
+ "'";}
private void button3_Click(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(bh.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(bh);crystalReportViewer1.ReportSource = ss;
}
private void cmbpname_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='" +
this.cmbpname.Text + "'and {productinsert.location}='" + this.cmblocation.Text + "'";
}
private void chpistolee_CheckStateChanged( object sender, EventArgs e){
this.chgunn.CheckState = CheckState.Unchecked; this.chrevolverr.CheckState = CheckState.Unchecked; this.chriflee.CheckState = CheckState.Unchecked;
}
private void chgunn_CheckStateChanged(object sender, EventArgs e){
this.chrevolverr.CheckState = CheckState.Unchecked;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 203/225
this.chriflee.CheckState = CheckState.Unchecked; this.chpistolee.CheckState = CheckState.Unchecked;
}
private void chriflee_CheckedChanged(object sender, EventArgs e){
this.chrevolverr.CheckState = CheckState.Unchecked;
this.chgunn.CheckState = CheckState.Unchecked; this.chpistolee.CheckState = CheckState.Unchecked;
}
private void chrevolverr_CheckedChanged(object sender, EventArgs e){
this.chgunn.CheckState = CheckState.Unchecked;
this.chriflee.CheckState = CheckState.Unchecked; this.chpistolee.CheckState = CheckState.Unchecked;
}
private void radarmss_CheckedChanged(object sender, EventArgs e){
if (this.chgunn.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Arms'" ;}
if (this.chpistolee.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Arms'";}
if (this.chrevolverr.Checked && this.radarmss.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Revolver'
and {productinsert.classification}='Arms'";
} if (this.chriflee.Checked && this.radarmss.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Arms'";}
}
private void radammunationn_CheckedChanged( object sender, EventArgs e){
if (this.chgunn.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 204/225
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Ammunation'" ;
} if (this.chpistolee.Checked && this.radammunationn.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Ammunation'";}
if (this.chrevolverr.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Ammunation'";}
if (this.chriflee.Checked && this.radammunationn.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);
crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Ammunation'";}
}
private void radacessoriess_CheckedChanged( object sender, EventArgs e){
if (this.chgunn.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);
crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Gun' and
{productinsert.classification}='Acessories'" ;}
if (this.chpistolee.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.classification}='Acessories'";}
if (this.chrevolverr.Checked && this.radacessoriess.Checked){
bharatDataSet yy = new bharatDataSet();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 205/225
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.classification}='Acessories'";
} if (this.chriflee.Checked && this.radacessoriess.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.classification}='Acessories'";}
}
private void radboree_CheckedChanged(object sender, EventArgs e){ if (this.chrevolverr.Checked && this.radboree.Checked)
{ bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula =
"{productinsert.gunname}='Revolver' and {productinsert.bore}>0";}
if (this.chpistolee.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Pistole'
and {productinsert.bore}>0";}
if (this.chriflee.Checked && this.radboree.Checked){
bharatDataSet yy = new bharatDataSet();bharatDataSetTableAdapters.productinsertTableAdapter pi = new
Bharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();pi.Fill(yy.productinsert);
StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;crystalReportViewer1.SelectionFormula = "{productinsert.gunname}='Rifle'
and {productinsert.bore}>0";}
}
private void datetime1_ValueChanged(object sender, EventArgs e){
String strr1 = this.dateTimee.Value.Date.ToShortDateString(); String strr = this.datetime1.Value.Date.ToShortDateString(); bharatDataSet yy = new bharatDataSet();
bharatDataSetTableAdapters.productinsertTableAdapter pi = newBharat_Gun_House.bharatDataSetTableAdapters. productinsertTableAdapter();
pi.Fill(yy.productinsert); StocklReport ss = new StocklReport();
ss.SetDataSource(yy);crystalReportViewer1.ReportSource = ss;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 206/225
crystalReportViewer1.SelectionFormula = "{productinsert.purchasedate}>= '" +strr1 + "' and {productinsert.purchasedate}<='" + strr + "'";
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;
using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class CRViewerPurchase : Form
{ public CRViewerPurchase()
{InitializeComponent();
} string sql1; bool firsttime = true; private void CRViewerPurchase_Load(object sender, EventArgs e)
{ db.com.CommandText = "select distinct itemname as it from items";
db.dr = db.com.ExecuteReader(); while (db.dr.Read()) this.cmbclassification.Items.Add(db.dr["it"]); db.dr.Close(); db.com.CommandText = "select distinct itemname as itt from subitem"; db.dr = db.com.ExecuteReader(); while (db.dr.Read()) this.cmbproductname.Items.Add(db.dr["itt"]); db.dr.Close(); db.com.CommandText = "select distinct bore as bb from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read()) this.cmbbore.Items.Add(db.dr["bb"]); db.dr.Close(); db.com.CommandText = "select distinct type as ty from productinsert"; db.dr = db.com.ExecuteReader();
while (db.dr.Read()) this.cmbtype.Items.Add(db.dr["ty"]); db.dr.Close(); db.com.CommandText = "select distinct location as ty from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read()) this.cmblocation.Items.Add(db.dr["ty"]); db.dr.Close(); db.com.CommandText = "select distinct company as ty from productinsert"; db.dr = db.com.ExecuteReader(); while (db.dr.Read()) this.cmbcompany.Items.Add(db.dr["ty"]); db.dr.Close(); db.com.CommandText = "select distinct sname as ty from datapurchase"; db.dr = db.com.ExecuteReader(); while (db.dr.Read()) this.cmbname.Items.Add(db.dr["ty"]); db.dr.Close();
sql1 = "Select * from datapurchase where BillID>0 ";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 207/225
display(); /*db.com.CommandText = "Select Min(BillDate) from datapurchase";
this.datetime1.Value = Convert.ToDateTime(db.com.ExecuteScalar()).AddDays(-1);*/ this.cmbbore.SelectedIndex = 0; this.cmbclassification.SelectedIndex = 0; this.cmbcompany.SelectedIndex = 0; this.cmblocation.SelectedIndex = 0;
this.cmbname.SelectedIndex = 0; this.cmbproductname.SelectedIndex = 0; this.cmbtype.SelectedIndex = 0;
firsttime = false;}
void display(){
db.com.CommandText = "Delete from DailyPurchase"; int i = db.com.ExecuteNonQuery(); db.com.CommandText = sql1; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ bharatDataSet.DailyPurchaseRow da =bharatDataSet.DailyPurchase.NewDailyPurchaseRow();
da.subitemsid = Convert.ToInt32(db.dr["subitemsid"]);da.armsno = db.dr["armsno"].ToString();da.BillDate = db.dr["BillDate"].ToString();da.BillID = Convert.ToInt32(db.dr["BillID"]);da.Billno = db.dr["Billno"].ToString();da.bore = Convert.ToDecimal(db.dr["bore"]);da.classification = db.dr[8].ToString();da.company = db.dr["company"].ToString();da.gunname = db.dr["gunname"].ToString();da.lincenceno = db.dr[13].ToString();da.Lodertype=db.dr["Lodertype"].ToString();da.location = db.dr["location"].ToString();da.marketprice = Convert.ToInt32(db.dr["marketprice"]);da.purchaseprice = Convert.ToInt32(db.dr["purchaseprice"]);da.qty = Convert.ToInt32(db.dr["Qty"]);da.saddress = db.dr["saddress"].ToString();da.sname = db.dr["sname"].ToString();
da.TotalAmount = Convert.ToInt32(db.dr["TotalAmount"]);da.dueAmount = Convert.ToInt32(db.dr["dueamount"]);da.Payable = Convert.ToInt32(db.dr["payable"]);da.type = db.dr["type"].ToString();da.validdate = db.dr["validdate"].ToString();da.Received = Convert.ToInt32(db.dr["received"]);bharatDataSet.DailyPurchase.Rows.Add(da);dailyPurchaseTableAdapter.Update(bharatDataSet.DailyPurchase);
} db.dr.Close();
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.DailyPurchaseTableAdapter dd = new
Bharat_Gun_House.bharatDataSetTableAdapters. DailyPurchaseTableAdapter();dd.Fill(bh.DailyPurchase);
PurchaseReport pr = new PurchaseReport();
pr.SetDataSource(bh);crystalReportViewer1.ReportSource = pr;
this.crystalReportViewer1.RefreshReport();}
String GetQueryString(String query, String remove){
int pos = query.IndexOf(remove); int len = remove.Length; if (pos >= 0 && len > 0)
{ String s1 = query.Substring(0, pos); String s2 = query.Substring(pos + len); return s1 + s2;
} return query;
}
String classif = "and Classificatino Like '%'"; private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 208/225
{ if (firsttime) return; if (this.cmbclassification.SelectedItem.ToString() == "All")
{sql1 = GetQueryString(sql1, classif);classif = "and Classificatino like '%'";
} else
{sql1 = GetQueryString(sql1, classif);classif = "and Classificatino='" +
this.cmbclassification.SelectedItem.ToString() + "'";}sql1 = sql1 + classif;display();
}
String prodname = "and GunName Like '%'"; private void cmbproductname_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmbproductname.SelectedItem.ToString() == "All")
{sql1 = GetQueryString(sql1, prodname);
prodname = "and GunName like '%'";} else
{sql1 = GetQueryString(sql1, prodname);prodname = "and GunName='" + this.cmbproductname.SelectedItem.ToString() +
"'";}sql1 = sql1 + prodname;display();
}
String loc = "and Location Like '%'"; private void cmblocation_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmblocation.SelectedItem.ToString() == "All")
{sql1 = GetQueryString(sql1, loc);loc = "and Location like '%'";
} else
{sql1 = GetQueryString(sql1, loc);loc = "and Location='" + this.cmblocation.SelectedItem.ToString() + "'";
}sql1 = sql1 + loc;display();
}
String company = "and company Like '%'"; private void cmbcompany_SelectedIndexChanged( object sender, EventArgs e)
{
if (firsttime) return; if (this.cmbcompany.SelectedItem.ToString() == "All")
{sql1 = GetQueryString(sql1, company);company = "and company like '%'";
} else
{sql1 = GetQueryString(sql1, company);company = "and company='" + this.cmbcompany.SelectedItem.ToString() + "'";
}sql1 = sql1 + company;display();
}
String bore = "and Bore Like '%'"; private void cmbbore_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmbbore.SelectedItem.ToString() == "All")
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 209/225
{sql1 = GetQueryString(sql1, bore);bore = "and Bore like '%'";
} else
{sql1 = GetQueryString(sql1, bore);bore = "and Bore='" + this.cmbbore.SelectedItem.ToString() + "'";
}sql1 = sql1 + bore;display();
}
String type = "and type Like '%'"; private void cmbtype_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmbtype.SelectedItem.ToString() == "All")
{sql1 = GetQueryString(sql1, type);type = "and type like '%'";
} else
{
sql1 = GetQueryString(sql1, type);type = "and type='" + this.cmbtype.SelectedItem.ToString() + "'";}sql1 = sql1 + type;display();
}
String sname = "and sname Like '%'"; private void cmbname_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmbname.SelectedItem.ToString() == "All")
{sql1 = GetQueryString(sql1, sname);sname = "and sname like '%'";
} else
{sql1 = GetQueryString(sql1, sname);sname = "and sname='" + this.cmbname.SelectedItem.ToString() + "'";
}sql1 = sql1 + sname;display();
}
String bdate = " and BillDate Like '%'"; private void datetime1_CloseUp(object sender, EventArgs e)
{ if (firsttime) return;
sql1 = GetQueryString(sql1, bdate);bdate = "and BillDate='" + this.datetime1.Value.Date.ToShortDateString() +
"'";sql1 = sql1 + bdate;
display();}
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class Frmsalereport : Form
{
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 210/225
public Frmsalereport(){
InitializeComponent();}
bool firsttime = true; string msql1; private void Frmsalereport_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'bharatDataSet.dataview' table.You can move, or remove it, as needed. this.dataviewTableAdapter.Fill(this.bharatDataSet.dataview); db.com.CommandText = "select distinct classification as cl from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["cl"]!="") this.cmbclassification.Items.Add(db.dr["cl"]);
}db.dr.Close();
db.com.CommandText = "select distinct bore as br from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["br"] != "")
this.cmbbore.Items.Add(db.dr["br"]);} db.dr.Close(); db.com.CommandText = "select distinct company as cm from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["cm"] != "") this.cmbcompany.Items.Add(db.dr["cm"]);
} db.dr.Close(); db.com.CommandText = "select distinct gunname as gu from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["gu"] != "") this.cmbproductname.Items.Add(db.dr["gu"]);
} db.dr.Close(); db.com.CommandText = "select distinct type as ty from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["ty"] != "") this.cmbtype.Items.Add(db.dr["ty"]);
} db.dr.Close(); db.com.CommandText = "select distinct armsno as ar from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ if (db.dr["ar"] != "") this.cmbarmsno.Items.Add(db.dr["ar"]);
} db.dr.Close();
msql1 = "select * from datasale where qty>0";display();
/*db.com.CommandText = "Select Min(saleDate) from datasale";this.date1.Value = Convert.ToDateTime(db.com.ExecuteScalar()).AddDays(-1);*/
this.cmbarmsno.SelectedIndex = 0; this.cmbbore.SelectedIndex = 0; this.cmbclassification.SelectedIndex = 0; this.cmbcompany.SelectedIndex = 0; this.cmbproductname.SelectedIndex = 0; this.cmbtype.SelectedIndex = 0;
firsttime = false;}
void display(){
db.com.CommandText = "Delete from dataview"; db.com.ExecuteNonQuery(); db.com.CommandText = msql1;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 211/225
db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ bharatDataSet.dataviewRow row = bharatDataSet.dataview.NewdataviewRow();
row.armsno = db.dr["armsno"].ToString();row.bore = Convert.ToDecimal(db.dr["bore"]);row.caddress = db.dr["caddress"].ToString();row.city = db.dr["city"].ToString();
row.classification = db.dr["classification"].ToString();row.cname = db.dr["cname"].ToString();row.company = db.dr["company"].ToString();row.due = Convert.ToInt32(db.dr["due"]);row.gunname = db.dr["gunname"].ToString();row.licenceno = db.dr["licenceno"].ToString() ;row.payable = Convert.ToInt32(db.dr["payable"]);row.purchaseprice = Convert.ToInt32(db.dr["purchaseprice"]);row.qty = Convert.ToInt32(db.dr["qty"]);row.received=Convert.ToInt32(db.dr["received"]);row.saledate = db.dr["saledate"].ToString();row.state = db.dr["state"].ToString();row.type = db.dr["type"].ToString();row.validupto = db.dr["validupto"].ToString();row.Marketprie = Convert.ToInt32(db.dr["marketprie"]);bharatDataSet.dataview.Rows.Add(row);
dataviewTableAdapter.Update(bharatDataSet.dataview);} db.dr.Close(); bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.dataviewTableAdapter cc = newBharat_Gun_House.bharatDataSetTableAdapters. dataviewTableAdapter();
cc.Fill(bh.dataview); DailySalesReport sa = new DailySalesReport();
sa.SetDataSource(bh);crystalReportViewer1.ReportSource = sa;
}
String GetQueryString(String query, String remove){
int pos = query.IndexOf(remove); int len = remove.Length; if (pos >= 0 && len > 0)
{ String s1 = query.Substring(0, pos); String s2 = query.Substring(pos + len); return s1 + s2;
} return query;
}
String classif = "and Classification Like '%'"; String pro = "and gunname Like '%'"; private void cmbproductname_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmbproductname.SelectedItem.ToString() == "All")
{msql1 = GetQueryString(msql1, pro);
pro = "and gunname like '%'";}
else{
msql1 = GetQueryString(msql1, pro);pro="and gunname='"+this.cmbproductname.SelectedItem.ToString()+ "'";
}msql1 = msql1 + pro;display();
}
private void cmbclassification_SelectedIndexChanged( object sender, EventArgs e){
if (firsttime) return; if (this.cmbclassification.SelectedItem.ToString() == "All")
{msql1 = GetQueryString(msql1, classif);classif = "and Classification like '%'";
} else
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 212/225
{msql1 = GetQueryString(msql1, classif);classif = "and Classification='" +
this.cmbclassification.SelectedItem.ToString() + "'";}msql1 = msql1 + classif;display();
}
String bore = "and bore like '%'"; private void cmbbore_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if(this.cmbbore.SelectedItem.ToString()== "All")
{msql1=GetQueryString(msql1,bore);bore = "and bore like '%'";}
else{
msql1 = GetQueryString(msql1, bore);bore = "and bore='" + this.cmbbore.SelectedItem.ToString() + "'";
}msql1 = msql1 + bore;display();
} String company = "and company like '%'"; private void cmbcompany_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmbcompany.SelectedItem.ToString() == "All")
{msql1 = GetQueryString(msql1, company);company = "and company like '%'";
} else
{msql1 = GetQueryString(msql1, company);company = "and company='" + this.cmbcompany.SelectedItem.ToString() + "'";
}msql1 = msql1 + company;display();
} String type = "and type like '%'"; private void cmbtype_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmbtype.SelectedItem.ToString() == "All")
{msql1 = GetQueryString(msql1, type);type = "and type like '%'";
} else
{msql1 = GetQueryString(msql1, type);type = "and type='" + this.cmbtype.SelectedItem.ToString() + "'";
}msql1 = msql1 + type;
display();}
String armsno = "and armsno like '%'"; private void cmbarmsno_SelectedIndexChanged( object sender, EventArgs e)
{ if (firsttime) return; if (this.cmbarmsno.SelectedItem.ToString() == "All")
{msql1 = GetQueryString(msql1, armsno);armsno = "and armsno like '%'";
} else
{msql1 = GetQueryString(msql1, armsno);armsno = "and armsno='"+this.cmbarmsno.SelectedItem.ToString()+ "'";
}msql1 = msql1 + armsno;display();
} String bdate = "and saledate like '%'";
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 213/225
private void date1_ValueChanged(object sender, EventArgs e){
/*if (firsttime) return;msql1 = GetQueryString(msql1, bdate);bdate = "and saleDate='" + this.date1.Value.Date.ToShortDateString() + "'";msql1 = msql1 + bdate;display();*/
}
private void btnshowall_Click(object sender, EventArgs e){
this.Close();}
private void dateTimePicker1_ValueChanged( object sender, EventArgs e){
String strr1 = this.date1.Value.Date.ToShortDateString(); String strr = this.date2.Value.Date.ToShortDateString(); bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.dataviewTableAdapter cc = newBharat_Gun_House.bharatDataSetTableAdapters. dataviewTableAdapter();
cc.Fill(bh.dataview); DailySalesReport sa = new DailySalesReport();
sa.SetDataSource(bh);
crystalReportViewer1.ReportSource = sa;crystalReportViewer1.SelectionFormula = "{dataview.saledate}>= '" + strr1 + "'and {dataview.saledate}<='" + strr + "'";
}}
}
using System;
using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class CRVPolicefrm : Form
{ public CRVPolicefrm()
{InitializeComponent();
} int sno1;
private void btnsave_Click(object sender, EventArgs e){
try {
db.com.CommandText = "select max(sno) from policetable";sno1=Convert.ToInt32(db.com.ExecuteScalar());sno1++;
} catch { sno1++; } try
{ string str = DateTime.Now.ToShortDateString(); db.com.CommandText = "insert into policetable values("+sno1+",'" +this.txtfollowing.Text + "','" + this.txtto.Text + "','" + this.txtlicenceno.Text +"','"+this.txtTranslino.Text+"','" + this.txtvalidup.Text + "','" + this.txtagainst.Text +"','" + str + "')"; db.com.ExecuteNonQuery(); MessageBox.Show("Record inserted");
} catch { }
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 214/225
}
private void button2_Click(object sender, EventArgs e){
this.txtvalidup.Text = ""; this.txtto.Text = "";
this.txtlicenceno.Text = ""; this.txtfollowing.Text = ""; this.txtagainst.Text = ""; this.txtTranslino.Text = ""; this.Close();
}
private void button3_Click(object sender, EventArgs e){
this.txtvalidup.Text = ""; this.txtto.Text = ""; this.txtlicenceno.Text = ""; this.txtfollowing.Text = ""; this.txtagainst.Text = ""; policevierw ob = new policevierw();
ob.Show();
}
private void txtfollowing_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtto.Focus();
}
private void txtto_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtlicenceno.Focus();
}
private void txtlicenceno_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter)
this.txtvalidup.Focus();}
private void txtvalidup_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.txtagainst.Focus();
}
private void txtagainst_KeyDown(object sender, KeyEventArgs e){
}
private void txttotal_KeyDown(object sender, KeyEventArgs e){
if (e.KeyCode == Keys.Enter) this.btnsave.Focus();
}
private void radjourny_CheckedChanged(object sender, EventArgs e){
this.lbljourny.Visible = true; this.txtlicenceno.Visible = true;
}
private void radtransport_CheckedChanged(object sender, EventArgs e){
this.lbltransport.Visible = true; this.txtTranslino.Visible = true;
}
private void CRVPolicefrm_Load(object sender, EventArgs e){
this.lbltransport.Enabled = true; this.lbljourny.Enabled = true;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 215/225
this.txtTranslino.Enabled = true; this.txtlicenceno.Enabled = true; this.lbltransport.Visible = false; this.lbljourny.Visible = false; this.txtTranslino.Visible = false; this.txtlicenceno.Visible = false;
}}
}
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 216/225
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class policevierw : Form
{ public policevierw()
{InitializeComponent();
} private void policevierw_Load(object sender, EventArgs e)
{ bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.policetableTableAdapter da = newBharat_Gun_House.bharatDataSetTableAdapters. policetableTableAdapter();
da.Fill(bh.policetable); CRdailyPoliceReport rpt = new CRdailyPoliceReport();
rpt.SetDataSource(bh);
crystalReportViewer1.ReportSource = rpt;crystalReportViewer1.SelectionFormula = "{policetable.dailydate}='"+DateTime.Now.ToShortDateString() + "'";
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmRepairReport : Form
{ public FrmRepairReport()
{InitializeComponent();
}
private void FrmRepairReport_Load(object sender, EventArgs e){
db.com.CommandText = "select distinct party as pa from repair"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbname.Items.Add(db.dr["pa"]);
}db.dr.Close();
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.repairTableAdapter da = new
Bharat_Gun_House.bharatDataSetTableAdapters. repairTableAdapter();da.Fill(bh.repair);
CRVRepairDues du = new CRVRepairDues();du.SetDataSource(bh);crystalReportViewer1.ReportSource = du;
}
private void cmbname_SelectedIndexChanged( object sender, EventArgs e)
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 217/225
{ bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.repairTableAdapter da = newBharat_Gun_House.bharatDataSetTableAdapters. repairTableAdapter();
da.Fill(bh.repair); CRVRepairDues du = new CRVRepairDues();
du.SetDataSource(bh);crystalReportViewer1.ReportSource = du;
crystalReportViewer1.SelectionFormula ="{repair.party}='"+this.cmbname.Text+"'";
}
private void dateTimePicker1_ValueChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.repairTableAdapter da = new
Bharat_Gun_House.bharatDataSetTableAdapters. repairTableAdapter();da.Fill(bh.repair);
CRVRepairDues du = new CRVRepairDues();du.SetDataSource(bh);crystalReportViewer1.ReportSource = du;crystalReportViewer1.SelectionFormula = "{repair.rdate}='" +
this.dateTimePicker1.Value.Date.ToShortDateString() + "'";}
private void btnshowall_Click(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.repairTableAdapter da = new
Bharat_Gun_House.bharatDataSetTableAdapters. repairTableAdapter();da.Fill(bh.repair);
CRVRepairDues du = new CRVRepairDues();du.SetDataSource(bh);crystalReportViewer1.ReportSource = du;
}
private void lnkdues_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e){
db.rpdues = this.cmbname.Text; FrmrepairDues1 fr = new FrmrepairDues1();
fr.Show();
this.Close();}
}}
using System;
using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmCheckDues : Form
{ public FrmCheckDues()
{InitializeComponent();
}
private void FrmCheckDues_Load(object sender, EventArgs e){
db.com.CommandText = "select distinct party as pa from repairdues"; db.dr = db.com.ExecuteReader();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 218/225
while (db.dr.Read()){
this.cmbname.Items.Add(db.dr["pa"]);}
db.dr.Close(); bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.repairduesTableAdapter da = newBharat_Gun_House.bharatDataSetTableAdapters. repairduesTableAdapter();
da.Fill(bh.repairdues); CRVcheckduesreturns ch = new CRVcheckduesreturns();
ch.SetDataSource(bh);crystalReportViewer1.ReportSource = ch;
}
private void cmbname_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.repairduesTableAdapter da = new
Bharat_Gun_House.bharatDataSetTableAdapters. repairduesTableAdapter();da.Fill(bh.repairdues);
CRVcheckduesreturns ch = new CRVcheckduesreturns();ch.SetDataSource(bh);crystalReportViewer1.ReportSource = ch;crystalReportViewer1.SelectionFormula =
"{repairdues.party}='"+this.cmbname.Text+"'";}
private void datetimep_ValueChanged(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.repairduesTableAdapter da = new
Bharat_Gun_House.bharatDataSetTableAdapters. repairduesTableAdapter();da.Fill(bh.repairdues);
CRVcheckduesreturns ch = new CRVcheckduesreturns();ch.SetDataSource(bh);crystalReportViewer1.ReportSource = ch;crystalReportViewer1.SelectionFormula =
"{repairdues.rdate}='"+this.datetimep.Value.Date.ToShortDateString()+ "'";}
private void btnshow_Click(object sender, EventArgs e)
{ bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.repairduesTableAdapter da = newBharat_Gun_House.bharatDataSetTableAdapters. repairduesTableAdapter();
da.Fill(bh.repairdues); CRVcheckduesreturns ch = new CRVcheckduesreturns();
ch.SetDataSource(bh);crystalReportViewer1.ReportSource = ch;
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmReturnrep : Form
{ public FrmReturnrep()
{InitializeComponent();
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 219/225
}
private void FrmReturnrep_Load(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ConReturnTableAdapter ret = new
Bharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
ConsinReturnReport cr = new ConsinReturnReport();cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;
db.com.CommandText = "select distinct gunname as pr from conreturn"; db.dr = db.com.ExecuteReader(); while(db.dr.Read())
{ if (db.dr["pr"] != "")
{ this.cmbproductname.Items.Add(db.dr["pr"].ToString());
}}
db.dr.Close();
db.com.CommandText = "select distinct party as par from conreturn";
db.dr = db.com.ExecuteReader(); while (db.dr.Read()){
if (db.dr["par"] != "") this.cmbparty.Items.Add(db.dr["par"].ToString());
} db.dr.Close();
} private void cmbproductname_SelectedIndexChanged( object sender, EventArgs e)
{ bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.ConReturnTableAdapter ret = newBharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();
ret.Fill(bh.ConReturn); ConsinReturnReport cr = new ConsinReturnReport();
cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;
crystalReportViewer1.SelectionFormula = "{Conreturn.gunname}='" +this.cmbproductname.Text + "'";
}
private void cmbparty_SelectedIndexChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ConReturnTableAdapter ret = new
Bharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
ConsinReturnReport cr = new ConsinReturnReport();cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;crystalReportViewer1.SelectionFormula = "{Conreturn.party}='" +
this.cmbparty.Text + "'";}
private void dateTimePicker1_ValueChanged( object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ConReturnTableAdapter ret = new
Bharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
ConsinReturnReport cr = new ConsinReturnReport();cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;crystalReportViewer1.SelectionFormula = "{Conreturn.returndate}='" +
this.dateTimePicker1.Value.Date.ToShortDateString() + "'";}
private void btnshowall_Click(object sender, EventArgs e){
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.ConReturnTableAdapter ret = new
Bharat_Gun_House.bharatDataSetTableAdapters. ConReturnTableAdapter();ret.Fill(bh.ConReturn);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 220/225
ConsinReturnReport cr = new ConsinReturnReport();cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmAccount1 : Form
{ public FrmAccount1()
{InitializeComponent();
} int loss, profit, nolspro = 0; bool first=true; String msql; private void FrmAccount1_Load(object sender, EventArgs e)
{ db.com.CommandText = "select distinct classification as cl from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{
this.cmbclass.Items.Add(db.dr["cl"]);} db.dr.Close();
db.com.CommandText = "select distinct gunname as cl from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbpname.Items.Add(db.dr["cl"]);
} db.dr.Close();
db.com.CommandText = "select distinct bore as cl from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbbore.Items.Add(db.dr["cl"]);
} db.dr.Close();
db.com.CommandText = "select distinct company as cl from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbcompany.Items.Add(db.dr["cl"]);
} db.dr.Close();
db.com.CommandText = "select distinct type as cl from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbtype.Items.Add(db.dr["cl"]);
} db.dr.Close();
db.com.CommandText = "select distinct lodertype as cl from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmblodertype.Items.Add(db.dr["cl"]);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 221/225
} db.dr.Close();
msql = "select * from datasale where qty>0";showdata();
this.cmbbore.SelectedIndex = 0; this.cmbclass.SelectedIndex = 0; this.cmbcompany.SelectedIndex = 0; this.cmblodertype.SelectedIndex = 0;
this.cmbpname.SelectedIndex = 0; this.cmbtype.SelectedIndex = 0;
first = false;}
String GetQueryString(String query, String remove){
int pos = query.IndexOf(remove); int len = remove.Length; if (pos >= 0 && len > 0)
{ String s1 = query.Substring(0, pos); String s2 = query.Substring(pos + len); return s1 + s2;
} return query;
}
void showdata(){ try
{ db.com.CommandText = "delete from lossProfit"; db.com.ExecuteNonQuery(); db.com.CommandText = msql; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ bharatDataSet.LossProfitRow rw =bharatDataSet.LossProfit.NewLossProfitRow();
rw.armsno = db.dr["armsno"].ToString();rw.bore = Convert.ToDecimal(db.dr["bore"]);rw.classification = db.dr["classification"].ToString();rw.company = db.dr["company"].ToString(); ;rw.gunname = db.dr["gunname"].ToString();
rw.Lodertype = db.dr["lodertype"].ToString();rw.type = db.dr["type"].ToString();rw.saledate = db.dr["saledate"].ToString();rw.payable = Convert.ToInt32(db.dr["payable"]);rw.purchaseprice = Convert.ToInt32(db.dr["purchaseprice"]);rw.Marketprie = Convert.ToInt32(db.dr["marketprie"]);
if (Convert.ToInt32(db.dr["marketprie"]) >Convert.ToInt32(db.dr["purchaseprice"]))
{profit = Convert.ToInt32(db.dr["marketprie"]) -
Convert.ToInt32(db.dr["purchaseprice"]);rw.Profit = profit;
} else if (Convert.ToInt32(db.dr["marketprie"]) <Convert.ToInt32(db.dr["purchaseprice"]))
{
loss = Convert.ToInt32(db.dr["purchaseprice"]) -Convert.ToInt32(db.dr["marketprie"]);
rw.Loss = loss;}
else{
rw.equal = nolspro;}bharatDataSet.LossProfit.Rows.Add(rw);lossProfitTableAdapter.Update(bharatDataSet.LossProfit);
} db.dr.Close();}
catch { }
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.LossProfitTableAdapter da = new
Bharat_Gun_House.bharatDataSetTableAdapters. LossProfitTableAdapter();da.Fill(bh.LossProfit);
CRVAccountReport ac = new CRVAccountReport();ac.SetDataSource(bh);
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 222/225
crystalReportViewer1.ReportSource = ac;}
String classi = "and classification like '%'";
String bo = "and bore like '%'"; String co = "and company like '%'"; String ty = "and type like '%'";
String loder = "and lodertype like '%'"; String date1 = "and saledate like'%'";
private void cmbclass_SelectedIndexChanged( object sender, EventArgs e){
if (first) return; if (this.cmbclass.SelectedItem == "All")
{msql = GetQueryString(msql, classi);classi = "and classification like '%'";
} else
{msql = GetQueryString(msql, classi);classi="and classification='"+this.cmbclass.Text+"'";
}
msql = msql + classi;showdata();}
String gun = "and gunname like '%'"; private void cmbpname_SelectedIndexChanged( object sender, EventArgs e)
{ if (first) return; if (this.cmbpname.SelectedItem == "All")
{msql=GetQueryString(msql,gun);gun=" and gunname like '%'";
} else
{msql = GetQueryString(msql, gun);gun=" and gunname='"+this.cmbpname.Text+"'";
}
msql=msql+gun;showdata();
}
private void cmbbore_SelectedIndexChanged( object sender, EventArgs e){
if (first) return;
if (this.cmbbore.SelectedItem == "All"){
msql=GetQueryString(msql,bo);bo=" and bore like '%'";
} else
{msql = GetQueryString(msql, bo);
bo=" and bore="+this.cmbbore.Text+"";}msql=msql+bo;showdata();
}
private void cmbtype_SelectedIndexChanged( object sender, EventArgs e){
if (first) return; if (this.cmbtype.SelectedItem == "All")
{msql = GetQueryString(msql, ty);ty = " and type like '%'";
} else
{msql = GetQueryString(msql, ty);ty = " and type='" + this.cmbtype.Text + "'";
}msql = msql + ty;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 223/225
showdata();}
private void cmblodertype_SelectedIndexChanged( object sender, EventArgs e){
if (first) return; if (this.cmblodertype.SelectedItem == "All")
{
msql = GetQueryString(msql, loder);loder = " and lodertype like '%'";
} else
{msql = GetQueryString(msql, loder);loder = " and lodertype='" + this.cmblodertype.Text + "'";
}msql = msql + loder;showdata();
}
private void cmbcompany_SelectedIndexChanged( object sender, EventArgs e){
if (first) return; if (this.cmbcompany.SelectedItem == "All")
{ msql = GetQueryString(msql, co);co = " and company like '%'";
} else
{msql = GetQueryString(msql, co);co = " and company='" + this.cmbcompany.Text + "'";
}msql = msql + co;showdata();
}
private void btnshowall_Click(object sender, EventArgs e){
msql = "select * from datasale where qty>0";showdata();
bharatDataSet bh = new bharatDataSet();bharatDataSetTableAdapters.LossProfitTableAdapter da = new
Bharat_Gun_House.bharatDataSetTableAdapters. LossProfitTableAdapter();da.Fill(bh.LossProfit);
CRVAccountReport ac = new CRVAccountReport();ac.SetDataSource(bh);crystalReportViewer1.ReportSource = ac;
}
private void datetimep_ValueChanged(object sender, EventArgs e){
if (first) return;msql = GetQueryString(msql, date1);date1 = " and saledate='" + this.datetimep.Value.Date.ToShortDateString() +
"'";msql = msql + date1;
showdata();}
}}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 224/225
using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House{ public partial class FrmPartyDueReport : Form
{ public FrmPartyDueReport()
{InitializeComponent();
}
private void FrmPartyDueReport_Load(object sender, EventArgs e){
db.com.CommandText = "select distinct cname as na from datasale"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbpartyname.Items.Add(db.dr["na"]);
} db.dr.Close();
}
private void cmbpartyname_SelectedIndexChanged( object sender, EventArgs e){ bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.datasaleTableAdapter da = newBharat_Gun_House.bharatDataSetTableAdapters. datasaleTableAdapter();
da.Fill(bh.datasale); CrPartyDues cr = new CrPartyDues();
cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;crystalReportViewer1.SelectionFormula =
"{datasale.cname}='"+this.cmbpartyname.Text+"'";}
private void btnshowall_Click(object sender, EventArgs e){
this.cmbpartyname.SelectedIndex = 0; bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.datasaleTableAdapter da = newBharat_Gun_House.bharatDataSetTableAdapters. datasaleTableAdapter();
da.Fill(bh.datasale); CrPartyDues cr = new CrPartyDues();
cr.SetDataSource(bh);crystalReportViewer1.ReportSource = cr;
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgse)
{ FrmSubmitDues du = new FrmSubmitDues();
du.Show(); this.Close();
}}
}
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;
namespace Bharat_Gun_House
7/29/2019 Dinesh Doc
http://slidepdf.com/reader/full/dinesh-doc 225/225
{ public partial class FrmBharatDues : Form
{ public FrmBharatDues()
{InitializeComponent();
}
private void FrmBharatDues_Load(object sender, EventArgs e){
db.com.CommandText = "select distinct sname as sn from datapurchase"; db.dr = db.com.ExecuteReader(); while (db.dr.Read())
{ this.cmbsname.Items.Add(db.dr["sn"]);
} db.dr.Close(); bharatDataSet bh = new bharatDataSet();
bharatDataSetTableAdapters.dataPurchaseTableAdapter da = newBharat_Gun_House.bharatDataSetTableAdapters. dataPurchaseTableAdapter();