Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 413

ST.

XAVIERS COLLEGE OF
MANAGEMENT
AND TECHNOLOGY

PROJECT
REPORT
ON

PHARMACY MANAGEMENT
SYSTEM

SUBMITTED BY

COURSE

ENROLLMENT NO.
BATCH
GUIDED BY

AMRENDRA KUMAR

BCA
12303302062

2013-2016
:

MR. RAVI KUMAR

[PROPRITER RK CRYSTAL TECHNOLOGY]

PROJECT REPORT
ON
GENYSISX MULTIPAGE
RESPONSIVE WEBSITE

FOR
R.K CRYSTAL TECHNOLOGY
AT
BORING ROAD, PATNA, 800023

BACHELOR OF COMPUTER APPLICATIONS (20132016)

ARYABHATTA KNOWLEDGE UNIVERSITY

SUBMITTED BY:

(RAV GROUP)

RUPALI, 47

AMRENDRA, 12
VEENA KUMARI, 56

I am using this opportunity to express my gratitude to


everyone who supported me throughout the course of this
project.
I am sincerely grateful for MR.MANISH KUMAR for his
constant encouragement and guidance.

I express my warm thanks to BCA COORDINATOR MR.


RAKESH PATHAK AND MR.PRAKASH UPADHYAY, for their
suggestions and inspirations during the project.

My special thanks & appreciation goes to the


Principal

Fr.Dr.T.Nishant

S.J

(St.

Xaviers

College

of

Management & Technology) for his support.

I would also like to give heartiest thanks to my group member


for their cooperation to complete this project.

Contents
Description
Page no.
1.

Introduction
8

2.

Objective.
9

3.

System Requirement and Study...

10-

Analysis
About Organization
Feasibility Study
Design

14-

13

4.
25

System Design
Module Hierarchy of System
7

Data Flow Diagram


Detailed Design

5.

ER Diagram
Data Dictionary
Table Structure
Process Logic
Environment & Tools...

47-

50

6.

Front End Tool


Back End Tool
O/S Specification
Hardware
Tools Description
References..

51

Introduction
Websites have changed quite a bit since their inception
and now include many different flavors and varieties. In
the 90s, when websites were becoming increasingly
popular, most of the websites were static html. Static html
implied that each page was planned out and hand coded
to match the plan. A static website contains Web pages
with fixed content. Each page is coded in HTML and
displays the same information to every visitor. Static sites
are the most basic type of website and are the easiest to

create. They do not require any Web programming or


database design. A static site can be built by simply
creating a few HTML pages and publishing them to a Web
server. Times changes and static pages are replaced by
Dynamic pages. A dynamic web page is a web page that
displays different content each time it's viewed. For
example, the page may change with the time of day, the
user that accesses the webpage, or the type of user
interaction. There are two types of dynamic web pages.
Client-Side Scripting
Web pages that change in response to an action within that web page, such as a
mouse or a keyboard action, use client-side scripting. Client-side scripts generate
client-side content. Client-side content is content that's generated on the user's
computer rather than the server. In these cases, the user's web browser would
download the web page content from the server, process the code that's embedded
in the web page, and then display the updated content to the user. Scripting
languages such as JavaScript and Flash allow a web page to respond to client-side
events.

Server-Side Scripting
Web pages that change when a web page is loaded or visited use server-side
scripting. Server-side content is content that's generated when a web page is
loaded. For example, login pages, forums, submission forms, and shopping carts,
all use server-side scripting since those web pages change according to what is
submitted to it. Scripting languages such as PHP, JSP allow a web page to respond
to submission events.

Websites
organizations

are

proved

and

institutions

boon
etc.,

to

the
as

business

now

every

organizational and professional wants to be the part of


this website world.
MULTIPAGE RESPONSIVE WEBSITE is the way to
connect to the customer and also the customer to connect
to the company.

Objectives
The top most objective of this project is to provide a
webpage which is responsive and can be easily open
in each and every device.

10

Next priority is given to prevent unauthorized access


to the unauthorized person. For that the login pages is
hardly coded.

Keeping in view the sensitiveness information, only


selected person will be able to access it with the help of
authorized password.
The webpage will use to show Product information,
Customer

information,

Team

member

information,

Company details etc.


This webpage is helpful to the customer to know about
the company.
To check the customer query and to help them in better
manner.

REQUIREMENT ANALYSIS
After analyzing the requirement of the company
11

I found following webpages are mainly maintained there:

1. HOME PAGE
2. ABOUT US PAGE
2.1 OUR COMPANY
2.2 OUR TEAM
2.3 MISSION AND VISION
2.4 OUR CLIENTS
2.5 TESTIMONIALS
2.6 PAYMENTS OPTIONS
2.7 LETTER FROM CEO DESK
3. SERVICES
3.1 WEB HOSTING
3.1.1 LINUX
3.1.2 WINDOWS
3.2 WEB DEVELOPMENT
3.2.1 WEB APPLICATION
3.2.2 WEBSITE
3.3 WINDOW APPLICATION
3.4 SPECIAL PRESENTATION
12

3.5 CINEMATIC OPENER


3.6 SITE BACKUP AND RESTORE
3.7 SSL CERTIFICATE
3.8 SEARCH ENGINE OPTIMIZATION
4. PRICING
4.1 WEB HOSTING
4.1.1 LINUX
4.1.2 WINDOWS
4.2 WEB DEVELOPMENT
4.2.1 WEB APPLICATION
4.2.2 WEBSITE
4.3 WINDOW APPLICATION
4.4 SPECIAL PRESENTATION
4.5 CINEMATIC OPENER
4.6 SITE BACKUP AND RESTORE
4.7 SSL CERTIFICATE
4.8 SEARCH ENGINE OPTIMIZATION
5. TEMPLATES
5.1 BUSINESS
5.2 PHOTOGRAPH
13

5.3 MUSIC
5.4 REAL STATE
5.5 DESIGN
5.6 RESTURANT AND FOOD
5.7 ACCOMODATION
5.8 EVENTS
5.9 PORTFLIO AND CV
5.10 HEALTH
5.11 FASHION AND BEUTY
5.12 EDUCATION
5.13 LANDING PAGE
6. FEEDBACK
7. CONTACT US
8. PAYMENT

14

About Organization

Kurji Holy Family Hospital, is situated on the bank of


the river Ganga and adjacent to Sadaquat ashram, is
noted for its highly dedicated team of medical and
paramedical

personnel,

together

with

good

infrastructure and clean environment that is conducive for


healing. Holy Family Hospital had its beginning in Patna
city in 1939 by the medical mission sisters.
Kurji Holy family Hospital, today offers specialised care in
Medicine, Surgery, Pediatrics, OB/Gynae, Orthopedics,
eye, ENT, and Plastic Surgery.
The

Hospital

has

computerized

the

Registration,

Admission, Pharmacy, Laboratory, and Personnel Billing,


Accounts and Administration Department.

15

Feasibility Study
One of the most important things to be done before the
initiation of the software development is the feasibility analysis
to test whether the software is feasible or not. The major tests
of feasibility will be operational feasibility, technical feasibility
and economical feasibility.

Operational Feasibility: - Any software to be developed must


be easy to operate. In my project, during the analysis I went
through the work flow of various departments in pharmacy
management system of the hospital and critically analyse their
performance. Hence found the system is operationally feasible.

16

Technical Feasibility:

Since the organization has all the

equipments available according to the software requirements.


And also the users over there are technically well trained to
handle the software. Hence it is technically feasible.

Economical Feasibility: - Since the organization was already


computerized and have all the equipment available that are
required for the proposed system, and the tools that are
required for proposed system to be developed were available at
my college and thus not require heavy investments, hence it is
economically feasible.

Design
Good design is the key to engineering. Design is a
creative process requiring insight and flair on the part of the
designer. It must be practiced and learnt by experience and
study of existing systems.
Any design problem has been tackled in two stages.

17

Identify the gross features of at least one possible


solution.
Describe each abstraction used in the solution.
The activities involved with design process are:

Architectural Design: The sub-systems making of the


system

and

their

relationships

are

identified

and

documented.

Abstract

Specification:

For

each

sub-system,

an

abstract specification of the services it provides and the


constraint under which it must operate is produced.

Interface Design: For each sub-system, its interface with


other sub-systems is designed and documented.

Component Design: Services are allotted to different


components and interfaces of theses components are
designed.

Data Structure Design: The data structures used in the


system implementation are designed in details and
specified.

Algorithmic Design: The algorithms used to provide


services are designed in detail and specified.

PHARMACY

MANAGEMENT

SYSTEM

HIERARCHY DIAGRAM
18

Pharmacy management system

Main store

Sales store

Admin

Purchase detail
Supplier Transfer detail

Store keeper

Inpatient

Sales detail

Department

19

Modules wise description


The Pharmacy Management System has two main
modules:

Mainstore module

Salestore module
All the pharmacy management work involves only these two
main modules which further contains some submodules.

The main store module has one main module

Admin module

Further admin module contains three Sub-modules

Supplier

Transfer detail

Purchase detail

The sale module has one main module

Storekeeper

Further storekeeper module has three sub-module

Inpatient

Sale detail

Department

20

1. Admin module:The main store module contains Admin module which


contains information regarding Administrative person of the
pharmacy management system i.e. Admin_name, Password,
Store.

1.1 Supplier module:Supplier module contains the information of the supplier


i.e. supplier_id, supplier_name, supplier_address, contact,
s_email, CST_No, Vat_No.

1.2 Transfer detail module:Transfer detail module contains the information regarding
transfer of all the medicine stock i.e. Receipt no, Transfer
quantity, product_id, date, username, from main store to
sales store.

1.3 Purchase detail module:Purchase detail module contains the information regarding
Purchase of all the medicines from the different supplier
i.e. Invoice no, purchased quantity, product_id, supplier_id,
date, username, Amount.

21

2. Storekeeper module:Storekeeper has right to access only sale store. The store
keeper

module

also

contains

the

information

about

storekeeper i.e. storekeeper_name, password, stor.

2.1 Inpatient module:Inpatient module contains the information about the


patient admitted in the hospital, such details are Ip_no,
Patient_name, Sex, Age, Address, Doctor_Id, Departmnt_od,
Bed_no, Marital Status, Nationality, Phone_no, Zip_no,
Emergency Phone_no etc.

2.2 Sale detail module:Sale detail module contains the information regarding
selling of all the medicines from salestore i.e. Bill_no,
sold_quantity,

product_id,

Patient_id,

date,

username,

Total_amount.

2.3 Department module:Department module contains the information of the


department i.e., department_id, department_name.

22

Data Flow Diagram


A data flow diagram is a graphical
representation that depicts information flow and the
transforms that are applied as data move from input to

23

output. The basic form of a data flow diagram is known


as data flow graph or a bubble chart. The data flow
diagram serves two purposes:
To provide an indication of how data are transformed
as they move through the system.
To depict the functions that transforms the data flow.
The DFD provides additional information that
is used during the analysis of the information domain
and serves as a basis for the modeling of function a
description of each function presented in the DFD is
contained in a process specification. The DFD may be
used to represent a system or software at any level of
abstraction. In fact, DFDs may be partitioned into levels
that

represent

functional
mechanism

detail.
for

increasing
Therefore,
functional

information
the

DFD

modeling

flow

and

provides
as

well

a
as

information flow modeling.


A 0-level DFD, also called a fundamental
system model or a context model, represents the entire
software element as a single bubble with input and
output data indicated by incoming and outgoing arrows,
respectively.DFD graphical notation must be augmented
with descriptive text. A process specification can be
used to specify the processing details implied by a
bubble within the body.

24

CONTEXT LEVEL DFD/ 0 LEVEL DFD

Supply
medicine

Status of
store

Supplier

Admin
Generat
e
invoice

Transfe
r stock

Order for
medicine

Collect
money

Maintain
main
stock

Check
status

Order to
supplier

Pharmacy Management
System
(Kurji Holy Family
Hospital)

Maintain
sales stock

Status
of

Prescriptio
n
Bill
genera
te

Prescription

Generat
e bill
Payment

Paymen
t

Check
store
status
Received
medicin
e

Issue
medicin
e

25

Patient

Store Keeper

1ST LEVEL DFD (work flow of pharmacy


management system)

Order
medicin

1.0
Order

Generat
e

Admin

Supplier

Supply
medicin
e

Purchas
e details

Transfer
Prurchase

Admin

Check
status

2.0
Main stock

Update
Transfer
details

Transfer &
update

26

Get updated
status of
stock

3.0
Sales store
Store keeper

Generate
bill

Updat
e

Issue details

Received
Payment
Payment
Prescriptio

Receive
d
medicin

4.0
Patient

2ND LEVEL DFD FOR ORDERING OF MEDICINE MODULE

Admin

Details
of
medicin

1.1
Order to supply
medicine

27

Medicine
detail

Storekeepe
r

Bill receipt
of order

1.2
Generate
invoice

Updat
e

Invoice
detail

Received
invoice
Confirmation

28

2nd Level DFD for MAINTAINING MAIN


Done
1.3
STOCK
payement
Payment
Updat
e

Admin

Check
medicine
id & batch
Storekeepe
Storekeepe
r
r
Storekeepe
r

Medicine
Get
received
medicine
stock details

Payment table

Payment
received

2.1
Check main
store status
1.4
Received
medicine

Updat
e
Updat
e

Transfer table of
main store
Purchase
detail table

Transfer

Add
Quantity of
medicine

2.2
Transfer to
main store

Transfer
table of
sales store

29

2nd Level DFD for MAINTAINING SALES STORE

Check
medicine

Store
Admin
keeper

Check
stock
Get stock
details
Get
medicine
stock details

Admin

Store
keeper

Enter
Quantity of
medicine to
transfer

Enter medicine
asked by
patient

Updat
e

3.1
2.3
Sales store
Maintain stock

Give
prescripti
on
Updat
e

Patient
Main stock
table

Transfer

2.4
Transfer to sales
store

Updat
e

Available

3.2
Billing

Confirm

30

3.3
Payment
Patient

Bill
received

Updat
e
Payment
table

Do
payment

Issue

Store
keeper

Issue
medicin

3.4
Issue medicine

Updat
e
Cash salesl
table

2nd Level DFD for ISSUE MEDICINE TO PATIENT

31

Give
prescriptio
n

4.1
Storekeeper

Patient

Check store
status

Enter
medicine
details

4.2
Billing

Store
keeper

Confirmatio
n

32

Ptaient

Bill
received

4.3
Payment

Do
payment

Confirmation

4.4
Received
medicine
Patient

Medicine

ER Diagram
The ER-Diagram was originally proposed by
Peter Chen for the design of relational database systems
and has been extended by others. The ERD enables a
software engineer to fully specify the data objects that are
input and output from a system, the attributes that define
the properties of these objects, and their relationships.
33

Sets of primary components are identified for ERD: data


objects,

attributes,

relationships,

and

various

type

indicators. The primary purpose of ERD is to represent


data objects and their relationships. The ER-data model
perceives the real world as consisting of basic objects,
called entities and facilitates database design by allowing
specification of an enterprise schema, which represents
the overall logical structure of a database. The ERdiagram is one of several semantic data models; the
semantic aspect of the model lies in its representation of
the meaning of the data. The ER- diagram is very useful in
mapping the meanings and interactions of real-world
enterprises into a conceptual schema.

34

E-R DIAGRAM

S_Add

S_id
P_id

P_name

Contact

P_type
S_name

S_email

MFG by

Power

Cst_no
P_name

P_class
M

Supply

Medicine

P_sub_
class

Supplier

M
P_id

Bill no

To
S_id

Date

U_name

Store

P_id

Receipt_no

Admin

35

Managed by

Password

Total_qty

1
Transfer Medicine

Sales
Store
1

Batch

1
M

P_id
P_id

Batch
Storekeepe
r

Batch

Mainstore

Tranfer
medicine
U_name

Receipt_no

Store

Total_qty

Password

Total_qty

Receipt_no
Date

Store
U_name

Password

36
Storekeeper

Dep id

Store

1
Opd no

Product qty

Issue Medicine to

Date
Opd no
Pat_name

Gender
Age

Fathres
name

Dep_id

Dep_name
Admits

Patient
Address
Phone no

M
Departmen
t

M
1
Zip no.
Pat_category
Doctor
Doc_id

Prescribed
medicine

Dep_id

Doc_name
Email id

Address

37

38

Data Dictionary
M

Works

Phone_no
Srno

Data Name

Data
Size

Data Type

Table Used

User_id

20

Varchar2

Cash_sale_master
Department_return_master
Sale Return_master

P_id

Varchar2

Purchase_detail, Product
Sales_stock, Main_stock
Inpatient_issue_detail
Cash_sale_detail
Department_return_detail
Sale_return_detail, transfer_detail
Transfer_to_mainstock

Total_qty

10,3

Varchar2

Main_stock, Sales_stock

Bill_no

20

Varchar2

Cash_sale_master
Cash_sale_detail

Receipt_no

20

Varchar2

Purchase_detail
Purchase_master
Main_stock, Sales_stock
Inpatient_issue_detail

39

Batch

10

Varchar2

Purchase_detail,main_stock Sale_stock
Inpatient_issue_detail
Cash_sale_detail
Department_return_detail
Transfer_to_main_stock
Transfer_detail

Srno

Data Name

Data
Size

Data Type

Table Used

Issued_qty

10

Varchar2

Inpatient_issue_detail
Cash_sale_detail

Remarks

50

Varchar2

Department_issu_master
Inpatient_isuue_master
Cash_sale_master

Ip_no

20

Varchar2

Admission_detail
Inpatient_issue_master
Cash_sale_master

10

Opd_no

20

Varchar2

Admission_detail,
Patient_detail,
Cash_sale_master

11

Doc_id

10

Varchar2

Admission_detail
Cash_sale_master

12

IP_issue_no

16

Varchar2

Impatient_issue_detail
Impatient_issue_master

40

13

Total_amount

(10,3)

number

Department issue master


Impatient_issue_master
Purchase_master

14

Roundoff_amount

(10,3)

number

Department issue master


Impatient_issue_master
Purchase_master

15

Net_amount

(10,3)

number

Department issue master


Impatient_issue_master
Purchase_master

Srno

Data Name

Data
Size

Data Type

Table Used

16

Amount

10,3

Varchar2

Inpatient_issue_detail
Cash_sale_detail
Department_issue_detail

17

Total_Amount

(10,3)

Number

Purchase_detail
Department_return_detail
Sale_return_detail

18

Trans_no.

16

Varchar2

Transfer_to_main_stock
Transfer_detail

19

Transfer_date

Date

Transfer_to_main_stock
Transfer_detail

20

Trans_from

Varchar2

Transfer_to_main_stock
Transfer_detail

41

21

Trans_to

Varchar2

Transfer_to_main_stock
Transfer_detail

22

Trans_by

20

Varchar2

Transfer_to_main_stock
Transfer_detail

23

Trans_qty

10

Varchar2

Transfer_to_main_stock
Transfer_detail

24

Dep_id

16

Varchar2

Department
Department_return_master

25

Status

Varchar2

Department issue master


Impatient_issue_master
Purchase_master

TABLE STRUCTURE
User (log_in)
Data

Data Type

Size

Description

Comment

Varchar2

20

Not Null

User/admin

Name
u_nm

name
Pass

Varchar2

10

Store

Varchar2

Not Null

Password
Store

42

PRODUCT
Data Name

Data

Size

Type

Descriptio

Comment

P_ID

Number

Primary Key

Product id

P_NM

Varchar2

20

Not Null

Product
name

P_TYPE

Varchar2

20

Not Null

Product type

POWER

Varchar2

20

Not Null

Medicine
power

P_CLASS

Varchar2

20

Not Null

Product class

P_S_CLASS

Varchar2

20

Not Null

Product

sub

class
MFGBY

Varchar2

20

Not Null

Manufactured
by

Supplier (supplier)
Data

Data

Size

Description

Comment

Name

Type

S_ID

Number

Primary Key

Supplier id

S_NAME

Varchar2

20

Not Null

Supplier
name

S_ADD

Varchar2

70

Not Null

Supplier
address

CONTACT

Number

20

Not Null

Contact no.

43

S_EMAIL

Varchar2

30

Not Null

Email id

CST_NO

Varchar2

20

Not Null

Central
sales-tax
no.

VAT_NO

Varchar2

20

Not Null

Value
added-tax
no.

Purchase detail (purchase_detail)


Data Name

Data Type

Size

Description

Description

Receipt_no.

Varchar2

16

Foreign Key

Receipt no.

P_id

Number

Not null

Product id

Batch

Varchar2

10

Not null

Product name

MFG

Date

Not null

Manufacture

REC_QTY

Number

(10,3)

Not null

Received qty

FREE_QTY

Number

(10,3)

Not null

Free quantity

CONV_FACT

Number

(10,3)

Not null

Conversion

date

factor
TOTAL_QTY

Number

(10,3)

Not null

Total qty

MRP_UNIT

Number

(10,3)

Not null

MRP per unit

TAX

Number

Not null

Tax

PACKCOST_PACK

Number

(10,3)

Not null

PACKMRP_PACK

Number

(10,3)

Not null

TOTAL_PACKCOST

Number

(10,3)

Not null

TOTAL_PACKMRP

Number

(10,3)

Not null

44

VAT

Number

Not null

COSTPRICE_PACK

Number

(10,3)

Not null

COSTPRICE_UNIT

Number

(10,3)

Not null

ACTUAL_MRP_UNIT

Number

(10,3)

Not null

TOTALCOST_PRICE

Number

(10,3)

Not null

Purchase Master (purchase_master)


Data Name

Data Type

Size

Description

RECEIPT_NO.

Varchar2

16

Primary Key

RECEIPT_DATE

Date

Not null

INVOICE_N0

Varchar2

16

Not null

S_ID

Varchar2

Not null

CREATED_BY

Varchar2

20

Not null

CREATED_ON

Date

Not null

VERIFIED_BY

Varchar2

20

Not null

VERIFIED_ON

Date

Not null

REMARKS

Varchar2

50

Not null

VAT_AMT

Number

(5,3)

Not null

Comment

Supplier id

Value added
tax amount

TOTAL_AMT

Number

10

STATUS

Varchar2

45

Mainstock (main_stock)

Date name

Data type

Size

Description

Comment

RECEIPT_NO

Varchar2

16

Foreign key

Receipt no.

P_ID

Varchar2

Not null

Product id

BATCH

Varchar2

10

Not null

Batch

TOTAL_QTY

Number

10

Not null

Salestock
Data Name

Data Type

Size

Description

RECEIPT_NO

Varchar2

16

Foreign key

P_ID

Varchar2

Not null

BATCH

Varchar2

10

Not null

TOTAL_QTY

Number

10

Not null

Comment

Product id

46

Inpatient_issue_detail

Date name

Data type

Size

Description

Comment

IP_ISSUE_NO

Varchar2

16

Foreign key

Inpatient
issue no.

P_ID

Number

Foreign key

BATCH

Varchar2

10

Not null

10

Not null

QTY_ISSUED Number
AMOUNT

Number

(10,3)

Not null

RECEIPT_NO

Varchar2

16

Not null

Product id

Inpatient_issue_master

Date name

Data type

Size

Description

Comment

IP_ISSUE_NO

Varchar2

16

Primary Key

Inpatient
issue no.

ISSUE_DATE

Date

Not null

47

IP_NO

Number

16

Foreign key

Inpatient
no.

PRESCRIBED_BY

Varchar2

20

Not null

REMARKS

Varchar2

50

Not null

ISSUED_BY

Varchar2

20

Not null

TOTAL_AMOUNT

Number

(10,2)

Not null

ROUNDOFF_AMOUN

Number

Not null

NET_AMOUNT

Number

10

Not null

STATUS

Varchar2

Not null

Department_issue_detail

Date name

Data type

Size

Description

Comment

DP_ISSUE NO

Varchar2

20

Foreign Key

Department
issue no.

P_ID

Number

20

Not null

BATCH

Varchar2

20

Not null

QTY_ISSUED

Number

20

Not null

AMOUNT

Number

RECEIPT_NO

Varchar2

Product id

Not null
20

Not null

48

Department_issue_master

Date name

Data type

Size

Description

Comment

DP_ISSUE NO

Varchar2

16

Primary Key

Department
issue no.

DEP_ID

Varchar2

Not null

Department
id

ISSUE_DATE

Date

Not null

REMARKS

Varchar2

50

Not null

ISSUED_BY

Varchar2

20

Not null

TOTAL_AMOUNT

Number

(10,3)

Not null

ROUNDOFF_AMOUN

Number

Not null

NET_AMOUNT

Number

10

Not null

STATUS

Varchar2

Not null

Cash sale detail


Date name

Data type

Size

Description

BILL_NO

Varchar2

16

foreign Key

P_ID

Number

Not null

BATCH

Varchar2

10

Not null

ISSUED_QTY

Number

10

Not null

AMOUNT

Number

(10,3)

Not null

Comment

Product id

49

RECEIPT_NO

Varchar2

16

Not null

Date name

Data type

Size

Description

Comment

DEP_ID

Varchar2

16

Primary Key

Department

Department

id
DEP_NAME

Varchar2

20

Not null

Department
name

Cash sale master


Date name

Data type

Size

Description

BILL_NO

Varchar2

16

Primary Key

OPD_NO

Varchar2

16

Not null

Comment

Outpatient
department
no.

IP_NO

Varchar2

16

Not null

Inpatient no

DOC_ID

Varchar2

10

Not null

Doctor id

USER_ID

Varchar2

10

Not null

BILL_DATE

Date

Not null

50

TOTAL_AMOUNT

Number

(10,3)

Not null

ROUNDOFF_AMOUNT

Number

Not null

NET_AMOUNT

Number

10

Not null

STATUS

Varchar2

Not null

REMARKS

Varchar2

50

Not null

Data name

Data type

Size

Description

OPD_NO

Varchar2

16

Primary Key

IP_NO

Varchar2

16

Not null

ADDMISSION_DATE

Date

Not null

PREVIOUS_IP_NO

Varchar2

16

Not null

DOC_ID

Varchar2

16

Not null

PATIENT_TYPE

Varchar2

10

Not null

SERVICE

Varchar2

10

Not null

WARD_NO

Varchar2

10

Not null

BED

Varchar2

10

Not null

CATEGORY

Varchar2

10

Not null

Admission detail
Comment

Doctor id

51

Department Return Detail


Data name

Data type

Size

Description

Comment

DP_RETURN_NO

Varchar2

16

Foreign Key

Department
return no.

P_ID

Number

Foregn key

BATCH

Varchar2

Not null

RETURN_QTY

Number

10

Not null

RECEIPT_NO

Varchar2

16

Not null

TOTAL_AMOUNT

Number

(10,3)

Not null

DEPAERTMENT RETURN MASTER


Data name

Data type

Size

Description

DP_RETURN_NO

Varchar2

16

Primary Key

DP_RETURN_DATE

Date

Not null

DEP_ID

Number

16

Not null

REMARKS

Varchar2

50

Not null

TOTAL_AMOUNT

Number

(10,3)

Not null

ROUNDOFF_AMOUNT

Number

Not null

Comment

Department id

52

NET_AMOUNT

Number

10

Not null

USER_ID

Varchar2

20

Not null

SALE RETURN MASTER


Data name

Data type

Size

Description

RETURN_NO

Varchar2

16

Primary Key

RETURN_DATE

Number

16

Not null

REMARKS

Date

Not null

TOTAL_AMOUNT

Varchar2

16

Not null

ROUNDOFF_AMOUNT

Varchar2

16

Not null

NET_AMOUNT

Varchar2

10

Not null

USER_ID

Not null

IP_NO

Foreign Key

OPD_NO

Foreign Key

Comment

SALE RETURN DETAIL


Data name

Data type

Size

Description

RETURN_NO

Varchar2

16

Foreign Key

Comment

53

P_ID

Number

Foreign Key

BATCH

Varchar2

10

Not null

RETURN_QTY

Number

10

Not null

RECEIPT_NO

Varchar2

16

Foreign Key

TOTAL_AMOUNT

Number

(10,3)

Not null

Patient detail
Date name

Data type

Size

Description

OPD_NO

Varchar2

16

Primary Key

PAT_NAME

Varchar2

16

Not null

FATHERS_NAME

Varchar2

Not null

SEX

Varchar2

10

Not null

AGE

Number

16

Not null

VILLAGE

Varchar2

10

Not null

HOUSE

Varchar2

10

Not null

PS

Varchar2

10

Not null

DISTRICT

Varchar2

10

Not null

PO

Varchar2

Not null

OCCUPATION

Varchar2

10

Not null

MARITAL_STATUS

Varchar2

Not null

REGION

Varchar2

Not null

NATIONALITY

Varchar2

Not null

PAT_CATEGORY

Varchar2

Not null

Comment

Patient name

Postal

Post office

54

ZIP_NO

Varchar2

Not null

PHONE_NO

Number

Not null

NAME

Varchar2

Not null

RELATIONSHIP

Varchar2

Not null

ADDRESS

Varchar2

Not null

EMERGENCY_PHONE_NO

Number

Not null

TRANSFER TO MAIN STOCK


Data name

Data type

Size

Description

Comment

TRANS_NO

Varchar2

16

Primary Key

Transfer no

TRANS_DATE

Date

Not null

Transfer
date

TRANSFER_FROM

Varchar2

10

Not null

TRANS_TO

Varchar2

10

Not null

P_ID

Number

Not null

BATCH

Varchar2

10

Not null

TRANS_QTY

Number

10

Not null

Transfer to

Transfer
quantity

TRANSFERRED_BY

Varchar2

20

Not null

RECEIPT_NO

Varchar2

16

Foreign Key

55

TRANSFER DETAIL
Data name

Data type

Size

Description

Comment

TRANS_NO

Varchar2

16

Foreign Key

Transfer no

TRANS_DATE

Date

16

Not null

TRANS_FROM

Varchar2

10

Not null

TRANS_TO

Varchar2

10

Not null

P_ID

Number

Not null

BATCH

Varchar2

10

Not null

TRANSFERRED_BY

Varchar2

20

Not null

TRANSFER_QTY

Number

10

Not null

RECEIPT_NO

Varchar2

16

Not null

Product id

56

Process Logic

The process logic of this project is as follows:1. Login module


a.

Enter userid & password

b. Accept password
c. If valid
Enter into specified module (main & sales
store)
Else
Try for three time and exit
d. End

57

2. Store keeper module


a. Add all necessary information about store
keeper
b. Generate store keeper code
c. Specify store
d. Verified store keeper information
e. Update store keeper information in database

3. Product module
a. Received product
b. Check product
c. Add all details about medicines
d. Verified stock
e. Update stock

4. Supplier module
a. Product order given to supplier.
58

b. Add all necessary information about supplier


c. Generate supplier code
d. Verified supplier information
e. Update supplier information in database

5. Transfer module
a. Insert product code or name
b. Give the quantity to transfer
c. Give the code of a store to which product to be
transfer [s4 to s1] i.e. [main store to sales
store] or vice versa
d. Update both the stock
59

e. Verify the transfer details


f. Record in transfer table

6. Transaction module
a. Customer will order
b. Generate invoice
c. Order confirmation
d. Product issue
e. Bill generate
f. Received payment
g. Product given to customer

Tools & Platform Specification

Software
Front end tools: C#.net
RDBMS/Back end: Oracle 11g
60

Language/sub-languages: SQL
Operating System
Windows 98/ 7/8/8.1,XP,Vista
Hardware
Processor: Intel Pentium 4. 1.6 GHz
Memory: 256 MB RAM
Hard Disk: 40 GB

Language Specification
C# as front-end tool:
Introduction:
C# is a multi-paradigm, object-oriented programming
language encompassing strong typing, essential,
declarative, efficient, class-based and componentoriented programming disciplines.
C# is one of the programming languages designed for
the Common Language Infrastructure.
C# is a well-designed and type-safe that allows C
Sharp developers to build a wide array of secure and
robust applications that run on the .NET Framework.

61

Reasons of selection:
C# language is projected to be a simple, modern, generalpurpose, object-oriented programming language.
C# helps us to import a namespace and use the classes
in a componentno COM plumbing or registry lookups
required.
C# simplifies the syntax to be more constant and more
rational while also eliminating some of the more difficult
features of C++.
C# allows us to access memory directly using unsafe code
blocks
C# allows us to implement an interface in a base class
and re-implement the interface in the derived class and
provide a new definition for it C# permits nested classes
which are not allowed in C and C++
C# establishes better event management using delegates
and supports conditional compilation & cross-language
interoperability with any .NET language
C# is based on reflection mechanism which is biggest
advantage of C#.

62

Oracle as the back-end tool

Introduction:
Oracle is an RDBMS. It is the software
provided by a vendor such as Oracle Corporation
that manages a relational database. This supports
the user of declarative statements, which describe
the rules that the data must satisfy.

Reasons of selection:

RDBMS approach
It can manage structured data, nonstructural
data, relational, multidimensional and even objectoriented. The performance of oracle is the best.
Manageability in the distributed or centralized all
types of architecture is highly impressive. Lots of
functional enhancements make it an obvious choice.
The topmost quality of this product is its security
features.

63

Multi-user environment approach


Oracle is client-server based so it allows
multiple users to access the database for their work
and it needs to maintain integrity and validity.
The

client-server

technology

involves

segregating the processing of an application between


two systems. One performs all activities related to the
database (server) and the other performs activities
that help the user to interact with the application
(client). A client or front-end database application
also interacts with the database by requesting and
receiving information from the database server. It
acts as an interface between the user and the
database. Further, it also checks for validation
against the data entered by the user.

64

Data manipulation convenience


The Oracle with the help of English like
language

provides

data

manipulation

facility

Language SQL stands for structured query language.


This language helps user to extract the information
from a database easily.

REFERENCES
While developing my project I have taken help from
persons and also consulted with books. The books lists
are as follows:
1. OReilly.C.Sharp.5.0.in a Nutshell 5th Edition
2.Tutorialpoints.com/CSharp,codeproject.com
MSDN.microsoft.com
3. Software Engineering Rajib Mall
4. SQL& PL/SQL for oracle 10g BLACK BOOK
(Wiley India)

65

66

Contents

Description
Page no
1. System Requirement and Study
54-60
System Analysis
Preliminary Investigation
Feasibility Study
2. Software Engineering Paradigm.
61-64
3. Environment & Tools.
65-68
Front End Tool
Back End Tool
O/S specification
Hardware
Tools Description
4. Design..
69-74
System Design
Data Flow Diagram
Detailed Design.
75-114
Use Case Diagram
Class diagram

67

Sequence Diagram
Event Diagram
Activity Diagram
Data Dictionary
Table Structure
5. Snapshots & Coding
115-261
6. Code Efficiency..
262
7. Validation Check
263-265
8. Testing..
266
9. Security mechanism.
267
10. Future Scope ..
268
11. Conclusion
269
12. Bibliograpghy..
270

System Analysis

68

I have opted tools for this project after realizing,


understanding and defining objective. A detailed
analysis of the system is made in this phase to
familiarize designers with the operation of the
existing system. I analyse many of the commonly
used systems analysis techniques such as data flow
diagrams and data analysis during the analysis..
Analysis

must

be

spending

considerable

time

examining components, such as the various forms


used in the system, as well as the operation of
existing computer systems.
A detailed analysis during this project I
found different types of problem which are given
below: -

System Study
Existing System.
Proposed System.
Benefits of the proposed system.

Existing system: - There was an existing system


that manages the official pharmacy related works,

69

but it was in vb6. The organization wanted to have it


in C#.net with having some new features.

Proposed system: - To meet the requirements and


needs of the organization, proposed system had been
studied and found that it can cater all their
requirements. The developed software will work
under any type of Window based environment.
The features of this system are listed below:A The proposed system has a user-friendly screen, which is
similar to that of paper design to accept data.
B

Any type of report such as stock information, patient


information, purchasing and selling information can be
obtained.

C Searching facilities are also available in this project such


as medicine sold to patients etc.

Benefits of the proposed system : User-friendly and menu support.


Upgradeable with slight modification in coding.
Easy application maintenance due to its robustness.

70

A central database for all the data related to ensure data


consistency.

Output Analysis

This phase results in a detailed model of the


system. The model describes the system functions,
system data and system information flows.
So, I have gone for following phases for analysis
of Pharmacy Management System (Kurji Holy Family
Hospital, Patna). These are:

Identification of Need

71

Whenever there is an opportunity to develop


a system, the organizations usually face problems or
have opportunity due to the following:
Rapid increment of purchasing and selling of medicines
To keep the doctors, staff, patient information
Inefficiency of an existing system
Structural error in the existing system, etc.
Thus a thorough analysis of the situation is
required. So to sort out the problems, I have scanned
the following:-

The information being supplied and its form


The control of the information processing
Data security.

Preliminary Investigation
When the request is made, the first system
activity

Preliminary

Investigation

begins.

Its

purpose is to evaluate project request. It is the first


step in Software Development Life Cycle (SDLC) to
determine the feasibility of the system.
72

For this, I have scanned the request made by the


organisation. I have gone through all the preliminary
investigation stage.
Clarity and understand the project request
Determine the size of the project
Determine the technical and operational feasibility of
alternative approaches

73

Feasibility Study
The feasibility study proposes one or more
conceptual solutions to the problem set for the
project. The conceptual solutions give an idea of what
the system will look like. They define what will be
done on computer and will remain manual. They also
indicate what input will be needed and what outputs
will be produced. These solutions must be proven
feasible and a preferred solution must be accepted.
Three things must be done to establish feasibility.
That three are:
Technical Feasibility
Economical Feasibility
Operational Feasibility

Technical Feasibility:
In technical feasibility I studied the number of technical
issues arises. They are:

74

Is the project is technically feasible?

Is it within the state of the art?

Can the project be upgraded if any?


So I have tried to solve best all the issues that
mention above in my project.

Since the organization has all the equipments available


according to the software requirements. And also the
users over there are technically well trained to handle
the software.
My Project is in modular nature so without any
disturbance it can be further upgraded by addition or
modification of modules without any adverse effect on
the performance. Hence it is technically feasible.

Economical Feasibility:
There are number of financial issues arise. They are:

Is it financially feasible?
Can development be completed at a cost the clients
afford?

75

The cost of hardware and software for the development


of proposed system is feasible or not?

Since the organization was already computerized and


have all the equipment available that are required for
the proposed sytem, and the tools that are required
for proposed system to be developed were available at
my college and thus not require heavy investments,
hence it is economically feasible.

Operational Feasibility:
In operational feasibility there are also some
issues to solve. They are:
Does the organization have the resources needed
to succeed?
Will the system be used if it is developed?
Will

there

be

resistance

from

users

that

will

undermine the possible application benefits?


Have

the

user

involved

in

the

planning

and

development of the project?

76

Any software to be developed must be easy to operate.


The system is menu driven and developed in widows
.since we know that the people generally uses windows
and it is easy to operate. Also the system will be easy to
understand and efficient to use. Any user having even
minimum knowledge of computer can use this software
and hence the proposed system is operationally feasible.
And reduces lots of time and effort.

Software Engineering Paradigm

To solve any problem in an organization, a software


engineering or a team of engineers must incorporate

77

development

strategy

that

encompasses

the

process, methods and tools layers. This strategy is


referred

as

process

model

or

software

engineering paradigm.Software engineering is a


layered technology.
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. There
are

so

suggested

many
by

software
expert

for

engineering
software

paradigm

development.

Software paradigms are used on the nature of


project. These are:

Linear Sequential Model

Waterfall model

Incremental model

The Prototype model

The RAD model

The Spiral model

78

From the above all software paradigms I have chosen


the Incremental model as the requirement of
project. For choosing this model I have scan
The characteristic of the product
The project environment in which the
software
team works
The requirement of the Organization

The incremental build model is a method of software


development where the product is designed, implemented and
tested incrementally (a little more is added each time) until

the product is finished. It involves both development and


maintenance. The product is defined as finished when it
satisfies all of its requirements. This model combines the
elements of the waterfall model with the iterative philosophy of
prototyping.

The product is decomposed into a number of components,


each of which is designed and built separately (termed as
builds). Each component is delivered to the client when it is
completed. This allows partial utilization of the product and
avoids a long development time. It also avoids a large initial
capital outlay and subsequent long waiting period. This

79

model of development also helps ease the traumatic effect


of introducing a completely new system all at once.

Due to the following reason, I have choosen the incremental


model for the development purpose.
1. After each iteration, regression testing should be conducted.
During this testing, faulty elements of the software can be
quickly identified because few changes are made within any
single iteration.

2. It is generally easier to test and debug than other methods


of software development because relatively smaller changes
are made during each iteration. This allows for more
targeted and rigorous testing of each element within the
overall product.

3. Customer can respond to features and review the product


for any needful changes.

4. Initial product delivery is faster and costs lower.


80

System/informati
on engineering
Analysi
s

Increment
2

Increment
1
Cod
Tes
e
t

Desig
n

Analysi
s

Increment
3

Delivery of
1st
Increment

Desig
n

Cod
e

Analysi
s

Desig
n

Increment4

Analysi
s

Tes
t

Delivery of
2nd
Increment

Cod
e

Test

Desig
n

Cod
e

Delivery
of 3rd
Incremen

Test

Delivery of
4th
Increment
81

Incremental
Calender

Tools & Platform Specification


Software
Front end tools: C#
RDBMS/Back end: Oracle 10g
Language/sub-languages: SQL
Operating System
Windows 98/ 7/8/8.1,XP,Vista
Hardware
Processor: Intel Pentium 4, 1.6 GHz
Memory: 256 MB RAM
Hard Disk: 40 GB

Language Specification

C# as front-end tool:
Introduction:
C# is a multi-paradigm, object-oriented programming
language encompassing strong typing, essential,

82

declarative, efficient, class-based, and componentoriented programming disciplines.


C# is one of the programming languages designed for
the Common Language Infrastructure.
C# is a well-designed and type-safe that allows C Sharp
developers to build a wide array of secure and robust
applications that run on the .NET Framework.

Reasons of selection:
C# language is projected to be a simple, modern, generalpurpose, object-oriented programming language.
C# helps us to import a namespace and use the classes
in a componentno COM plumbing or registry lookups
required.
C# simplifies the syntax to be more constant and more
rational while also eliminating some of the more difficult
features of C++.
C# allows us to access memory directly using unsafe code
blocks
C# allows us to implement an interface in a base class
and re-implement the interface in the derived class and
provide a new definition for it C# permits nested classes
which are not allowed in C and C++
C# establishes better event management using delegates
and supports conditional compilation & cross-language
interoperability with any .NET language.
C# is based on reflection mechanism which is biggest
advantage of C#.
83

ORACLE
Introduction:
Oracle is an RDBMS. It is the software provided by
a vendor such as Oracle Corporation that manages a
relational

database.

This

supports

the

user

of

declarative statements, which describe the rules that


the data must satisfy.

Reasons of selection:

1. RDBMS approach
It can manage structured data, nonstructural data,
relational, multidimensional and even object-oriented.
The performance of oracle is the best. Manageability in
the distributed or centralized all types of architecture is
84

highly impressive. Lots of functional enhancements


make it an obvious choice. The topmost quality of this
product is its security features.

2. Multi-user environment approach


Oracle is client-server based so it allows multiple
users to access the database for their work and it needs
to maintain integrity and validity. The client-server
technology involves segregating the processing of an
application between two systems. One performs all
activities related to the database (server) and the other
performs activities that help the user to interact with
the application (client). A client or front-end database
application

also

interacts

with

the

database

by

requesting and receiving information from the database


server. It acts as an interface between the user and the

85

database. Further, it also checks for validation against


the data entered by the user.

4. Data manipulation convenience


The Oracle with the help of English like
language

provides

data

manipulation

facility

Language SQL stands for structured query language.


This language helps user to extract the information
from a database easily.

CONTEXT LEVEL DFD/ 0 LEVEL DFD

Supply
medicine

Status of
store

Supplier

Admin
Generat
e invoice

Order for
medicine

Transfe
r stock

Maintain
main
stock

86

Check
status

Collect
money

Order to
supplier

Pharmacy Management
System
(Kurji Holi Family
Hospital)

Maintain
sales stock

Status
of

Prescriptio
n
Bill
genera
te

Prescription

Generat
e bill
Payment

Paymen
t

Check
store
status
Received
medicin
e

Patient

Issue
medicin
e

Store Keeper

1ST LEVEL DFD (working flow of pharmacy


management system)

87

Order
medicin

1.0
Order

Generat
e

Admin

Supplier

Purchas
e details

Supply
medicin
e

Transfer
Prurchase

Admin

Check
status

Get updated
status of
stock

2.0
Main stock

Update
Transfer
details

Transfer &
update

3.0
Sales store
Store keeper

Receive
d

88

Updat
e

Generate
bill

Issue details

Received
Payment
Payment
Prescriptio

4.0
Patient

2ND LEVEL DFD FOR ORDERING OF MEDICINE


MODULE

Admin

Details
of
medicin

1.1
Order to supply
medicine

89

Medicine
detail

Storekeepe
r

Bill receipt
of order

1.2
Generate
invoice

Updat
e

Invoice
detail

Received
invoice
Confirmation

90

2nd Level DFD for MAINTAINING


Done
1.3
MAIN STOCKpayement
Payment
Updat
e

Admin

Check
medicine
id & batch
Storekeepe
Storekeepe
r
r
Storekeepe
r

Medicine
Get
received
medicine
stock details

Payment table

Payment
received

2.1
Check main
store status
1.4
Received
medicine

Updat
e
Updat
e

Transfer table of
main store
Purchase
detail table

Transfer

Add
Quantity of
medicine

2.2
Transfer to
main store

91

2nd Level DFD for MAINTAING SALES

STORE
Updat
e

Admin
Store
keeper

Admin

Check
medicine
Check
stock

2.3
Maintain3.1
stock
Sales store

Patient
Main stock
table

Get stock
details
Transfer
Get
medicine
stock details
Enter
2.4
Quantity of
Transfer
to sales
medicine to
store
transfer
Available

Store
keeper

Give
prescripti
on
Updat
e

Enter medicine
asked by
patient

Updat
e

Transfer
table of
sales store

3.2
Billing

92

Confirm

3.3
Payment
Patient

Bill
received

Updat
e
Payment
table

Do
payment

Issue

Store
keeper

Issue
medicin

3.4
Issue medicine

Updat
e
Cash salesl
table

2nd Level DFD for ISSUE MEDICINE TO PATIENT


93

Give
prescriptio
n

4.1
Storekeeper

Patient

Check store
status

Enter
medicine
details

4.2
Billing

Store
keeper

Confirmatio
n

94

Ptaient

Bill
received

4.3
Payment

Do
payment

Confirmation

4.4
Received
medicine
Patient

Medicine

USE CASE DIAGRAM


Add new medicine

1.

Add new supplier

95

Add new store keeper

Update main stock

<< Admin
>>

Transfer main stock to


slaes stock

2.
Issue medicine to patient

Return medicine to main


store

Issue medicine to
Inpatient

<< Store
keeper >>

Issue medicine to
department

Scenario 1.1(Adding new medicine)


Fill necessary details of
medicine

<<
>>

Uses

<<

Extends

96

Add all details of


medicine

<<

Extends

Generate medicine id

<< Admin
>>

<<

Extends

Record & update


medicines info

Scenario 1.2(Adding new supplier)

<<

Add details of supplier


Uses

<<

Extends

Maintain supplier code

<<
<< Admin
Scenari
>>

Extends

Records & update


supplier information

1.3(Adding new store keeper)

<<
>>

Fill store keepers


information
Uses

97

>>

<<

Extends

Generate store keepers


id

<<

Extends

Update store keepers


information

<<v Admin
>>
Scenario 1.4

(Transfer to main store to sales store)


Add details of supplier

<<

Uses

<<

Extends

Maintain supplier code

<<
<< Scenario
Admin
>>

Extends

Records & update


supplier information

1.5(Update main stock)

98

>>

Provide medicine
information

<<

Uses

<<

Extends

Provide main store id

<<

Extends

Transfer medicine

<< Admin
>>

<<

Extends

Update main store

Scenario 2.1 (Issue medicine to patient)

99

Ask patient details

<<

Uses

<<

Extends

>>

Ask prescription

<<

Extends

Generate bill

<< Store
keeper >>

<<

Extends

Update stock

Scenario 2.2
(Return medicine to main store)
Add Product details

<<

Uses

<<

Extends

Add quantity to return

<<
<< Store
Scenario 2.3
Keeper >>

Extends

Update stock

100

>>

(Issue medicine to Inpatient)


Ask inpatient details

<<

Uses

<<

Extends

Ask prescription

<<

Extends

Generate bill

<< Store
keeper >>

<<

Extends

Add bill in patient account

<<

Extends

Update stock

101

Scenario 2.4(Issue medicine to Department)


Ask product details

<<

Uses

<<

Extends

Add department details

<<

Extends

Add quantity to issue

<< Store
keeper >>

<<

Extends

Update stock

102

>>

Class Diagram

Relation between Admin and


Mainstore.

Admin maintains
mainstore
MainStore
User_iReceipt_no
d
P_id

Admin

Batch

User_id

Maintain
s
Total Qty

Pass

Trans_to_sales_stock()

Store
Create_user()
Add_new_supplier()

Add_supplier()
Add_item()
View_main_stock()

View_main_stock()
View_sales_stock()
1

103

Receipt_n
o.

Supplier

S_id
User_i
d
S_name
S_add Supplys
medicine
contact
to

Admin
User_id
Pass
store
Create_user()
Add_new_supplier()
View_main_stock()
View_sales_stock()
1

S_id
104

SaleStore
Receipt_no
Relation between Admin and
1
P_id
Receipt_
Supplier.
no
Batch
Total Qty
Return_to_main_stock()
Cash_sale()

Transfer_medic
View_sale_stock()
ine
Inpatient_issue()

Department_issue()
Inpatient_return()

MainStore
Receipt_no

Depertment_return()
Cash_sale_retuen()

P_id
Batch

Total Qty
Trans_to_sale_stock()
Add_supplier()
Add_item()
View_main_stock()

Receipt_n
o

105

Transfer medicine from


mainstore to salestore.
Return medicine from
SaleStoresalestore to mainstore.
User_i
d

Receipt_no

P_id
Batch

Maintain
s

Total Qty
Return_to_main_stock()
Cash_sale()
View_sale_stock()
Inpatient_issue()
Department_issue()
Inpatient_return()
Depertment_return()
Cash_sale_retuen()

StoreKeeper
User_id
password
store
View_sale_stock()
Cash_sale()
Department_issue()
Return_medicine()

106

Patient
opd_no
Patient_name
M

Father name
Gender
Age
Address
Maritalstatus
Nationality
Zip_no.

Receipt_
no

Pat_category
Emergency_ph
_no

occupation

Opd_n
o

Storekeeper maintains
salestore

Storekeeper
User_id
password
store
M

View_sale_stock()
Cash_sale()
Department_issue()
return

107

Issue
medicine
M

User_i
d
Storekeeper issued medicine
to patient
Department

Dep_id
Dep_name

User_i
d

Admits_patient()
Change()
Find()

108

Issue
medicine

Storekeeper
User_id
password

store

View_sale_stock()

Doc_i
Cash_sale()
d
Works
in

Department_issue()
Return_medicine()

Dep_i
d

Doctor
Doct_id
Dep_i
d

Doc_name
Dep_id
Add()
Change()
Find()

Storekeeper provides
medicine to different
departments.

Doctor work in different


109

Patient

Opd_n
o

opd_no
Patient_name
Father name
Gender
Age

Department
Dep_id
Dep_name

Address

Add()

Marital- status

Change()

Nationality

Find()

Zip_no.
Pat_category

Admits
in

Emergency_ph_no
occupation

Dep_i
d

110

Patient admits in different


departments according to
their diseases.

SEQUENCE DIAGRAM
Scenario1. Add new product

Admin

Stock

Databas

Display menu to add


item
Insert product
information

Show
item_id

Ask for
Generate
item_id

Insert additional
information
Store information
in DB
111

Confirm inserted
item
Confirme
d

Scenario2. Add new supplier


Main

Admin

Databas

Display menu to new


supplier
Insert suppliers
information

Show
supplier_id

Ask for
item_id
Generate
supplier_id

Insert additional
information
Store information in

Confirm inserted

112

Confirme

Scenario3. Add new store keeper

Admi
n

Main

Databas

Display menu to add new


store keeper

Insert store
keepers
information

Show store

Ask for store keeper


_id
Generate
supplier_id

Insert additional

113

Store information in
DB
Confirm inserted
details

Confirme

Scenario4. Update main store


Admin

Sales
Databas

Display menu to add in


main store
Insert information
regarding medicine
Check medicine id &
batch
Give medicine id &
batch
Enter quantity of
medicine to transfer
Update information in
DB
114

Confirm updated
information
Confirme
d

Scenario5. Transfer from main store to


sales store
Admin

Sales

Database

Display menu to add in


sales store
Insert information
regarding medicine
Ask for
store_id
Insert
store_id

Check medicine id &


batch

115

Give medicine id &


batch
Enter quantity of
medicine to transfer

Update
transfered
information in

Confirm update
information
Confirme

Scenario6. Issue medicine to out-patient


Patient

StoreKeep
er

Sales store

Databas

Give Prescription
Display menu to
issue medicine

Ask for patient id


Give Patient
id

Insert
medicine
information
Insert patient

Check
med.
stock
Show
available
med. qty
116

Generate Bill
Do
payment
Confirm
Payment

Store issued
information in
DB

Confirm
Bill

Issue
medicine

Update
DB
Confirm
Update

Confirme
d

Scenario7. Issue medicine to In-patient


Patien
Give
Prescription

StoreKeep
er

Databa

Display menu to
issue medicine
Check
medicine
stock

Give patient
id

Sales store

Check med.
stock
Show
available
medicine

117

Insert
patient id
Enter medicine
qty
Generate
Bill

Confirmed
Bill

Store issued
information in
DB
Update
DB

Confirme

Confirm
Update

Issue
medicine

Scenario8. Issue medicine to Department

Departme
nt

StoreKeep

Ask for
Medicine

Give
department id

Sales store

Databa

Display menu
to issue
medicine

Insert
department id
118

Check med.
stock

Generate Transfer
no.
Issue
medicine

Show
available
medicine qty

Store issue
information in
DB
Update
DB

Confirme
d

Confirm
Update

Scenario9. Return medicine to main store

Patien
t

StoreKeep
er
Give
Medicine

Sales store

Databas

Display menu
to return

Give bill
no.

Check
information
in DB 119

Show result
Ask
medicine to
return
Enter
medicine qty
Store
information in
Update
DB
Confirm
Update

Confirm
ed

Return
Money

Event diagram
Order
medicine,
do

Admin
Transfer
medicin
e

Update
store

Receive
d
medicin

Generate
invoice
Receive
d
paymen

Supplier

Show
main
store

120

Transfer
medicin
e
Update
store

Main store

Show
sales store
status
Return
medicin

Sales store

Show sales
store

Give
prescription

Patient
Pay
doctor
s fees

Treat
patien
t

Bill payment

Sales
Medicine
Update
Patient

Get
admit

Maintain
sales
store

Storekeep
er

Update
medicine
table

Give
medicine

Receive
Demand
medicin
Prescribed
medicine

Doctor
Works

Update
sales store,
Return
medicine

Received
Medicine

Allot
doctor,
Provide

Managed
patient,

Departm
ent
And workers

Activity diagram

User

121

Log in

If store
keeper

Sales store

If admin

Main stock

Update sales
stock

Sales medicine

If out
-patie
nt

Cash
sales

If inpatient
Credit sales

If
If transfer
purchase
medicine to sales
medicine
store
Update main
stock

End

Data Dictionary

122

Srno

Data Name

Data
Size

Data Type

Table Used

User_id

20

Varchar2

Cash_sale_master
Department_return_master
Sale return_master

P_id

Varchar2

Purchase_detail
Product, sles_stock Main_stock
Inpatient_issue_detail
Cash_sale_detail
Department_return_detail
Sale_return_detail, transfer_detail
Transfer_to_mainstock

Total_qty

10,3

Varchar2

Main_stock
Sales_stock

Bill_no

20

Varchar2

Cash_sale_master
Cash_sale_detail

Receipt_no

20

Varchar2

Purchase_detail
Purchase_master
Main_stock
Sales_stock
Inpatient_issue_detail

Batch

10

Varchar2

Purchase_detail
Main_stock, sale_stock
Inpatient_issue_detail
Cash_sale_detail
Department_return_detail

123

Transfer_to_main_stock Transfer_detail

124

Srno

Data Name

Data

Data Type

Table Used

Varchar2

Inpatient_issue_detail

Size
7

Issued_qty

10

Cash_sale_detail
8

Remarks

50

Varchar2

Department_issue_master
Inpatient_isuue_master
Cash_sale_master

Ip_no

20

Varchar2

Admission_detail
Inpatient_issue_master
Cash_sale_master

10

Opd_no

20

Varchar2

Admission_detail
Patient_detail
Cash_sale_master

11

Doc_id

10

Varchar2

Admission_detail
Cash_sale_master

12

IP_issue_no

16

Varchar2

Impatient_issue_detail
Impatient_issue_master

13

Total_amount

(10,3)

Number

Department issue
Master,Impatient_issue_master
Purchase_master

15

Roundoff_amoun

(10,3)

Number

Department issue master


Impatient_issue_master
Purchase_master

15

Net_amount

(10,3)

Number

Department issue master


Impatient_issue_master

125

Purchase_master

16

status

Varchar2

Department issue master


Impatient_issue_master
Purchase_master

Srno

Data Name

Data

Data Type

Table Used

Varchar2

Inpatient_issue_detail

Size
17

Amount

10,3

Cash_sale_detail
Department_issue_detail
18

Total_Amount

(10,3)

Number

Purchase_detail
Department_return_detail
Sale_return_detail

19

Trans_no.

16

Varchar2

Transfer_to_main_stock
Transfer_detail

20

Transfer_date

Date

Transfer_to_main_stock
Transfer_detail

21

Trans_from

Varchar2

Transfer_to_main_stock
Transfer_detail

22

Trans_to

Varchar2

Transfer_to_main_stock
Transfer_detail

23

Trans_by

20

Varchar2

Transfer_to_main_stock
Transfer_detail

126

24

Trans_qty

10

Varchar2

Transfer_to_main_stock
Transfer_detail

25

Dep_id

16

Varchar2

Department
Department_return_master

TABLE STRUCTURE
User (log_in)
Data

Data Type

Size

Description

Comment

Varchar2

20

Not Null

User/admi

Name
u_nm

n name
Pass

Varchar2

10

Store

Varchar2

Not Null

password
store

PRODUCT
Data Name

Data

Size

Type
P_ID

Number

Descriptio

Comment

n
5

Primary Key

Product id

127

P_NM

Varchar2

20

Not Null

Product
name

P_TYPE

Varchar2

20

Not Null

Product type

POWER

Varchar2

20

Not Null

Medicine
power

P_CLASS

Varchar2

20

Not Null

Product class

P_S_CLASS

Varchar2

20

Not Null

Product

sub

class
MFGBY

Varchar2

20

Not Null

Manufactured
by

Supplier (supplier)
Data

Data

Size

Description

Comment

Name

Type

S_ID

Number

Primary Key

Supplier id

S_NAME

Varchar2

20

Not Null

Supplier
name

S_ADD

Varchar2

70

Not Null

Supplier
address

CONTACT

Number

20

Not Null

Contact no.

S_EMAIL

Varchar2

30

Not Null

Email id

CST_NO

Varchar2

20

Not Null

Central
sales-tax
no.

VAT_NO

Varchar2

20

Not Null

Value
added-tax

128

no.

Purchase detail (purchase_detail)


Data Name

Data Type

Size

Description

Description

Receipt_no.

Varchar2

16

Foreign Key

Receipt no.

P_id

Number

Not null

Product id

Batch

Varchar2

10

Not null

Product name

MFG

Date

Not null

Manufacture
date

REC_QTY

Number

(10,3)

Not null

Received qty

FREE_QTY

Number

(10,3)

Not null

Free quantity

CONV_FACT

Number

(10,3)

Not null

Conversion
factor

TOTAL_QTY

Number

(10,3)

Not null

Total qty

MRP_UNIT

Number

(10,3)

Not null

MRP per unit

TAX

Number

Not null

Tax

PACKCOST_PACK

Number

(10,3)

Not null

PACKMRP_PACK

Number

(10,3)

Not null

TOTAL_PACKCOST

Number

(10,3)

Not null

TOTAL_PACKMRP

Number

(10,3)

Not null

VAT

Number

Not null

COSTPRICE_PACK

Number

(10,3)

Not null

COSTPRICE_UNIT

Number

(10,3)

Not null

ACTUAL_MRP_UNIT

Number

(10,3)

Not null

129

TOTALCOST_PRICE

Number

(10,3)

Not null

Purchase Master (purchase_master)


Data Name

Data Type

Size

Description

RECEIPT_NO.

Varchar2

16

Primary Key

RECEIPT_DATE

Date

Not null

INVOICE_N0

Varchar2

16

Not null

S_ID

Varchar2

Not null

CREATED_BY

Varchar2

20

Not null

CREATED_ON

Date

Not null

VERIFIED_BY

Varchar2

20

Not null

VERIFIED_ON

Date

Not null

REMARKS

Varchar2

50

Not null

VAT_AMT

Number

(5,3)

Not null

Comment

Supplier id

Value added
tax amount

TOTAL_AMT

Number

10

STATUS

Varchar2

130

Mainstock (main_stock)

Date name

Data type

Size

Description

Comment

RECEIPT_NO

Varchar2

16

Foreign key

Receipt no.

P_ID

Varchar2

Not null

Product id

BATCH

Varchar2

10

Not null

Batch

TOTAL_QTY

Number

10

Not null

Salestock
Data Name

Data Type

Size

Description

RECEIPT_NO

Varchar2

16

Foreign key

P_ID

Varchar2

Not null

BATCH

Varchar2

10

Not null

TOTAL_QTY

Number

10

Not null

Comment

Product id

Inpatient_issue_detail

Date name

Data type

Size

Description

Comment

131

IP_ISSUE_NO

Varchar2

16

Foreign key

Inpatient
issue no.

P_ID

Number

Foreign key

BATCH

Varchar2

10

Not null

10

Not null

QTY_ISSUED Number
AMOUNT

Number

(10,3)

Not null

RECEIPT_NO

Varchar2

16

Not null

Product id

Inpatient_issue_master

Date name

Data type

Size

Description

Comment

IP_ISSUE_NO

Varchar2

16

Primary Key

Inpatient
issue no.

ISSUE_DATE

Date

Not null

IP_NO

Number

16

Foreign key

Inpatient
no.

PRESCRIBED_BY

Varchar2

20

Not null

REMARKS

Varchar2

50

Not null

ISSUED_BY

Varchar2

20

Not null

TOTAL_AMOUNT

Number

(10,2)

Not null

132

ROUNDOFF_AMOUN

Number

Not null

NET_AMOUNT

Number

10

Not null

STATUS

Varchar2

Not null

Department_issue_detail

Date name

Data type

Size

Description

Comment

DP_ISSUE NO

Varchar2

20

Foreign Key

Department
issue no.

P_ID

Number

20

Not null

BATCH

Varchar2

20

Not null

QTY_ISSUED

Number

20

Not null

AMOUNT

Number

RECEIPT_NO

Varchar2

Product id

Not null
20

Not null

Department_issue_master

Date name

Data type

Size

Description

Comment

DP_ISSUE NO

Varchar2

16

Primary Key

Department

133

issue no.
DEP_ID

Varchar2

Not null

Department
id

ISSUE_DATE

Date

Not null

REMARKS

Varchar2

50

Not null

ISSUED_BY

Varchar2

20

Not null

TOTAL_AMOUNT

Number

(10,3)

Not null

ROUNDOFF_AMOUN

Number

Not null

NET_AMOUNT

Number

10

Not null

STATUS

Varchar2

Not null

Cash sale detail


Date name

Data type

Size

Description

BILL_NO

Varchar2

16

foreign Key

P_ID

Number

Not null

BATCH

Varchar2

10

Not null

ISSUED_QTY

Number

10

Not null

AMOUNT

Number

(10,3)

Not null

RECEIPT_NO

Varchar2

16

Not null

Comment

Product id

134

Department
Date name

Data type

Size

Description

Comment

DEP_ID

Varchar2

16

Primary Key

Department
id

DEP_NAME

Varchar2

20

Not null

Department
name

Cash sale master


Date name

Data type

Size

Description

BILL_NO

Varchar2

16

Primary Key

OPD_NO

Varchar2

16

Not null

Comment

Outpatient
department
no.

IP_NO

Varchar2

16

Not null

Inpatient no

DOC_ID

Varchar2

10

Not null

Doctor id

USER_ID

Varchar2

10

Not null

BILL_DATE

Date

Not null

TOTAL_AMOUNT

Number

(10,3)

Not null

ROUNDOFF_AMOUNT

Number

Not null

NET_AMOUNT

Number

10

Not null

STATUS

Varchar2

Not null

REMARKS

Varchar2

50

Not null

135

Admission detail
Data name

Data type

Size

Description

OPD_NO

Varchar2

16

Primary Key

IP_NO

Varchar2

16

Not null

ADDMISSION_DATE

Date

Not null

PREVIOUS_IP_NO

Varchar2

16

Not null

DOC_ID

Varchar2

16

Not null

PATIENT_TYPE

Varchar2

10

Not null

SERVICE

Varchar2

10

Not null

WARD_NO

Varchar2

10

Not null

BED

Varchar2

10

Not null

CATEGORY

Varchar2

10

Not null

Comment

Doctor id

Department Return Detail


Data name

Data type

Size

Description

Comment

136

DP_RETURN_NO

Varchar2

16

Foreign Key

Department
return no.

P_ID

Number

Foregn key

BATCH

Varchar2

Not null

RETURN_QTY

Number

10

Not null

RECEIPT_NO

Varchar2

16

Not null

TOTAL_AMOUNT

Number

(10,3)

Not null

DEPAERTMENT RETURN MASTER


Data name

Data type

Size

Description

DP_RETURN_NO

Varchar2

16

Primary Key

DP_RETURN_DATE

Date

Not null

DEP_ID

Number

16

Not null

REMARKS

Varchar2

50

Not null

TOTAL_AMOUNT

Number

(10,3)

Not null

ROUNDOFF_AMOUNT

Number

Not null

NET_AMOUNT

Number

10

Not null

USER_ID

Varchar2

20

Not null

Comment

Department id

137

SALE RETURN MASTER


Data name

Data type

Size

Description

RETURN_NO

Varchar2

16

Primary Key

RETURN_DATE

Number

16

Not null

REMARKS

Date

Not null

TOTAL_AMOUNT

Varchar2

16

Not null

ROUNDOFF_AMOUNT

Varchar2

16

Not null

NET_AMOUNT

Varchar2

10

Not null

USER_ID

Not null

IP_NO

Foreign Key

OPD_NO

Foreign Key

Comment

SALE RETURN DETAIL


Data name

Data type

Size

Description

RETURN_NO

Varchar2

16

Foreign Key

P_ID

Number

Foreign Key

BATCH

Varchar2

10

Not null

RETURN_QTY

Number

10

Not null

RECEIPT_NO

Varchar2

16

Foreign Key

TOTAL_AMOUNT

Number

(10,3)

Not null

Comment

138

Patient detail
Date name

Data type

Size

Description

OPD_NO

Varchar2

16

Primary Key

PAT_NAME

Varchar2

16

Not null

FATHERS_NAME

Varchar2

Not null

SEX

Varchar2

10

Not null

AGE

Number

16

Not null

VILLAGE

Varchar2

10

Not null

HOUSE

Varchar2

10

Not null

PS

Varchar2

10

Not null

DISTRICT

Varchar2

10

Not null

PO

Varchar2

Not null

OCCUPATION

Varchar2

10

Not null

MARITAL_STATUS

Varchar2

Not null

REGION

Varchar2

Not null

NATIONALITY

Varchar2

Not null

PAT_CATEGORY

Varchar2

Not null

ZIP_NO

Varchar2

Not null

PHONE_NO

Number

Not null

NAME

Varchar2

Not null

RELATIONSHIP

Varchar2

Not null

ADDRESS

Varchar2

Not null

EMERGENCY_PHONE_NO

Number

Not null

Comment

Patient name

postal

Post office

139

TRANSFER TO MAIN STOCK


Data name

Data type

Size

Description

Comment

TRANS_NO

Varchar2

16

Primary Key

Transfer no

TRANS_DATE

Date

Not null

Transfer
date

TRANSFER_FROM

Varchar2

10

Not null

TRANS_TO

Varchar2

10

Not null

P_ID

Number

Not null

BATCH

Varchar2

10

Not null

TRANS_QTY

Number

10

Not null

Transfer to

Transfer
quantity

TRANSFERRED_BY

Varchar2

20

Not null

RECEIPT_NO

Varchar2

16

Foreign Key

TRANSFER DETAIL

140

Data name

Data type

Size

Description

Comment

TRANS_NO

Varchar2

16

Foreign Key

Transfer no

TRANS_DATE

Date

16

Not null

TRANS_FROM

Varchar2

10

Not null

TRANS_TO

Varchar2

10

Not null

P_ID

Number

Not null

BATCH

Varchar2

10

Not null

TRANSFERRED_BY

Varchar2

20

Not null

TRANSFER_QTY

Number

10

Not null

RECEIPT_NO

Varchar2

16

Not null

Product id

141

SNAPSHOTS
AND
CODING
142

CLASS FILE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Windows.Forms;
namespace KURJI
{
class database
{
OleDbConnection conn;
OleDbCommand cmd;
OleDbDataAdapter da;
public database()
{
conn = new OleDbConnection("Provider =MSDAORA.1;User ID =system;
Password=system;database=orcl");

143

conn.Open();
}
public DataSet getDataTable(string strOrcl)
{
cmd = new OleDbCommand();
DataSet dt = new DataSet();
cmd.CommandType = CommandType.Text;
cmd.CommandText = strOrcl;
cmd.Connection = conn;
da = new OleDbDataAdapter();
da.SelectCommand = cmd;
da.Fill(dt);
da.Dispose();
return dt;
}
public void ExecuteOrcl(string OrclStr)
{
try
{
cmd = new OleDbCommand(OrclStr, conn );
cmd.ExecuteNonQuery();
}
catch
{
MessageBox.Show("transaction not complited please try again");

144

}
}
}
}

LOGIN FORM

145

CODE OF MATERIAL LOGIN

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

146

using System.Windows.Forms;
using System.Data.OleDb;
using User;
namespace KURJI
{

public partial class Login : Form


{
string sql;
database db=new database();
DataSet ds;

public Login()
{
InitializeComponent();
}
private void Log_In_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.A && e.Shift)
{

log();
}
}

147

private void button3_Click(object sender, EventArgs e)


{
Main_Store k = new Main_Store();
k.Show();
}

public void log()


{
string str;

if (txtunm.Text == "" && txtpass.Text == "")


{
MessageBox.Show("Enter the Username and Password");
}
else if (txtunm.Text == "")
{
MessageBox.Show("Enter the Username");
}
else if (txtpass.Text == "")
{
MessageBox.Show("Enter the Password");
}
else
{

148

str = "select * from log_in where u_nm='" + txtunm.Text + "'";


db = new database();
ds = new DataSet();
ds = db.getDataTable(str);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
UserAccess.C_User = txtunm.Text;
if ((txtpass.Text == ds.Tables[0].Rows[0][1].ToString()) &&
(String.IsNullOrEmpty(ds.Tables[0].Rows[0][2].ToString())))
{
if (cmbstore.Text == "S1")
{
MessageBox.Show("Welcome To The Pharmacy");
Pharmacy a = new Pharmacy();
a.ShowDialog(this);
btnadmin.Enabled = true;
}
else if (cmbstore.Text == "S4")
{
MessageBox.Show("Welcome To The Mainstore..");
Main_Store a = new Main_Store();
a.ShowDialog(this);
btnadmin.Enabled = true;
}

149

else
{
MessageBox.Show("incorrect store ");
btnadmin.Enabled = false;
}
}
else if ((txtpass.Text == ds.Tables[0].Rows[0][1].ToString()) &&
(cmbstore.Text == ds.Tables[0].Rows[0][2].ToString()) && (ds.Tables[0].Rows[0]
[2].ToString() == "S1"))
{
MessageBox.Show("Welcome To The Pharmacy");
Pharmacy a = new Pharmacy();
a.ShowDialog(this);
btnadmin.Enabled = false;
}
else if ((txtpass.Text == ds.Tables[0].Rows[0][1].ToString()) &&
(cmbstore.Text == ds.Tables[0].Rows[0][2].ToString()) && (ds.Tables[0].Rows[0]
[2].ToString() == "S4"))
{
MessageBox.Show("Welcome To The Mainstore..");
Main_Store a = new Main_Store();
a.ShowDialog(this);
btnadmin.Enabled = false;
}
else
{

150

MessageBox.Show("password or store ");


btnadmin.Enabled = false;
}

}
else
{

MessageBox.Show("incorrect user ");


btnadmin.Enabled = false;
}

}
}
private void Login_Load(object sender, EventArgs e)
{
txtunm.Text = "nitesh";
txtpass.Text = "n";
cmbstore.Items.Add("S1");
cmbstore.Items.Add("S4");
cmbstore.Text = "S1";
}

151

private void btnadmin_Click(object sender, EventArgs e)


{
Admin_Access k = new Admin_Access();
k.Show();
}

private void btnlogin_Click(object sender, EventArgs e)


{
log();
UserAccess.C_Receipt = txtunm.Text;
}
}
}
namespace User
{
public static class UserAccess
{
private static string userid =null;
private static string receipt_no= null;
public static string C_User
{
get
{
return userid;

152

}
set
{
userid= value;
}

public static string C_Receipt


{
get
{
return receipt_no;
}
set
{
receipt_no = value;
}
}
}
}

153

Material receipt new

154

CODE OF MATERIAL RECEIPT NEW

using System;
using System.Collections.Generic;

155

using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using User;
using System.Text.RegularExpressions;

namespace KURJI
{
public partial class Material_Receipts_New : Form
{

Decimal r,q, rs,p,t;


string sql;
DataSet ds;
database db = new database();
public Material_Receipts_New()
{
InitializeComponent();
TxtUserId.Text = (UserAccess.C_User).ToString();
}
private void addbtn_Click(object sender, EventArgs e)

156

if (TxtMCode.Text == "" || m_name.Text == "" || b_no.Text == "" ||


mfg.Text == "" || exp.Text == "" || r_qty.Text == "" ||
f_qty.Text == "" || c_factor.Text == "" || t_qty.Text == "" || mrp_p.Text ==
"" || tax.Text == "" || pack_c_p.Text == "" || p_mrp_p.Text == "" ||
t_p_m.Text == "" || c_p_u.Text == "" || a_m_u.Text == "" || c_p_p.Text
== "" || txttotal.Text=="" || vatamt.Text =="")
{
MessageBox.Show("Please Enter Full Detail");
}
else
{
DataGridView1.Rows.Add(TxtMCode.Text, m_name.Text, b_no.Text,
mfg.Text, exp.Text, int.Parse(r_qty.Text), int.Parse(f_qty.Text),
int.Parse(c_factor.Text), int.Parse(t_qty.Text), decimal.Parse(mrp_p.Text),
decimal.Parse(tax.Text), decimal.Parse(pack_c_p.Text),
decimal.Parse(p_mrp_p.Text), decimal.Parse(t_p_c.Text),
decimal.Parse(t_p_m.Text), decimal.Parse(vatamt.Text),
decimal.Parse(c_p_p.Text), decimal.Parse(c_p_u.Text),
decimal.Parse(a_m_u.Text), decimal.Parse(txttotal.Text));

TxtMCode.Text = "";
m_name.Text = "";
b_no.Text = "";
mfg.Text = "";
exp.Text = "";
r_qty.Text = "";
f_qty.Text = "";

157

c_factor.Text = "";
t_qty.Text = "";
mrp_p.Text = "";
tax.Text = "";
pack_c_p.Text = "";
p_mrp_p.Text = ""; t_p_c.Text = "";
t_p_m.Text = ""; c_p_u.Text = ""; a_m_u.Text = ""; c_p_p.Text = "";
TxtTAmount.Text = ""; vatamt.Text = "";
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
TxtTAmount.Text = "";
q=q+
(Convert.ToDecimal(DataGridView1.Rows[i].Cells["t_amt"].Value));

TxtVatAmount.Text = "";
p=p+
(Convert.ToDecimal(DataGridView1.Rows[i].Cells["_v_amt"].Value));

TxtTAmount.Text = Convert.ToString(q);
q = 0;

TxtVatAmount.Text = Convert.ToString(p);
p = 0;

158

t= 0;
string content = TxtTAmount.Text;

string[] str = content.Split('.');

foreach (string word in str)


{
TxtRoundOff.Text = "."+word.ToString();

TxtNetAmount.Text = Math.Round(double.Parse(TxtTAmount.Text),
0).ToString();

ChangeBtn.Enabled = false;
DeleteBtn.Enabled = true;
RecordBtn.Enabled = true;
addbtn.Enabled = false;
}
}
public void insert_purchase()
{
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
CancelBtn.Enabled = true;

159

sql = "insert into purchase_detail values( '" + TxtNumber.Text + "','" +


DataGridView1.Rows[i].Cells["m_code"].Value + "','" +
DataGridView1.Rows[i].Cells["Batch"].Value + "','" +
DataGridView1.Rows[i].Cells["_mfg"].Value + "','" +
DataGridView1.Rows[i].Cells["_exp"].Value + "'," +
DataGridView1.Rows[i].Cells["_r_qty"].Value + "," +
DataGridView1.Rows[i].Cells["_f_qty"].Value + "," +
DataGridView1.Rows[i].Cells["c_f"].Value + "," +
DataGridView1.Rows[i].Cells["_t_qty"].Value + "," +
DataGridView1.Rows[i].Cells["_mrp_p"].Value + "," +
DataGridView1.Rows[i].Cells["tx"].Value + "," +
DataGridView1.Rows[i].Cells["p_cost_p"].Value + "," +
DataGridView1.Rows[i].Cells["p_mr_p"].Value + "," +
DataGridView1.Rows[i].Cells["t_p_cost"].Value + "," +
DataGridView1.Rows[i].Cells["t_p_mrp"].Value + "," +
DataGridView1.Rows[i].Cells["_v_amt"].Value + "," +
DataGridView1.Rows[i].Cells["_c_p_p"].Value + "," +
DataGridView1.Rows[i].Cells["_p_u"].Value + "," +
DataGridView1.Rows[i].Cells["A_mrp_u"].Value + "," +
DataGridView1.Rows[i].Cells["t_amt"].Value + " )";

db.ExecuteOrcl(sql);
}

sql = "insert into


purchase_master(Receipt_no,Receipt_Date,Invoice_no,S_Id,Created_by
,Created_on,remarks,vat_amt,Total_amt,status )values('" + TxtNumber.Text + "','"
+ dd.Text + "','" + TxtInvoice.Text + "'," + int.Parse(TxtSupplier.Text) + ",'" +
TxtUserId.Text + "','" + created_on.Text + "','" + TxtRemarks.Text+ "'," +
decimal.Parse(TxtVatAmount.Text) + "," + decimal.Parse(TxtNetAmount.Text) +
",'N')";

160

db.ExecuteOrcl(sql);
MessageBox.Show("The following Product Having Invoice No." +
TxtInvoice.Text + " has been succesfully added as New Purchase");
RecordBtn.Enabled = false;
}

private void RecordBtn_Click(object sender, EventArgs e)


{
if (TxtSupplier.Text == "" || TxtTAmount.Text == "" || TxtInvoice.Text ==
"" || TxtRemarks.Text == "")
{
MessageBox.Show("Enter full detail");
}

else
{

sql = "Select receipt_no from purchase_detail";

ds = new DataSet();

ds = db.getDataTable(sql);

int p = ds.Tables[0].Rows.Count;

161

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

string str4 = ds.Tables[0].Rows[j]["receipt_no"].ToString();


string yr = dd.Value.Year.ToString().ToString().Substring(2, 2);
string mn = dd.Value.Month.ToString();
string day = dd.Value.Day.ToString();

string str1 = str4.Substring(8, 6);

string str3 = str4.Substring(0, 4);

int l = int.Parse(str1) + 1;

if (int.Parse(mn) > 3)
{

if ((int.Parse(mn) == 4) && (int.Parse(day) == 1))


{

162

TxtNumber.Text = (str3 + yr + (int.Parse(yr) + 1) +


"0000001").ToString();

insert_purchase();

}
else
{

TxtNumber.Text = (str3 + yr + (int.Parse(yr) + 1) + l).ToString();

insert_purchase();

}
}
else
{

TxtNumber.Text = (str3 + (int.Parse(yr) - 1) + yr + l).ToString();


insert_purchase();
}
}

163

else
{
TxtNumber.Text = "PHMR1415000001";
insert_purchase();
}
}
}
private void c_factor_Leave(object sender, EventArgs e)
{
if(c_factor.Text!="")
{
if (int.Parse(c_factor.Text) != 0)
{
if (r_qty.Text != "" && c_factor.Text != "" && f_qty.Text != "")
{
r = (Convert.ToDecimal(r_qty.Text)) +
(Convert.ToDecimal(f_qty.Text));
r = r * (Convert.ToDecimal(c_factor.Text));
t_qty.Text = (Convert.ToString(r));
}
else
{
MessageBox.Show("Please Enter Full Detail");
c_factor.Focus();
}

164

}
else
{
MessageBox.Show("Cannot Enter 0");
c_factor.Text = "";
}

}
else{
MessageBox .Show("Please Enter The Conversion Factor");
}
}
private void s_name_TextChanged(object sender, EventArgs e)
{

dataGridView2.Visible = true;
groupBox3.Visible = true;
string str = "%" + s_name.Text + "%";
sql = "select s_id,s_name from supplier where (s_name like '" + str + "' or
s_id like '" + str + "')";
ds = new DataSet();

ds = db.getDataTable(sql);
dataGridView2.DataSource = ds.Tables [0];
dataGridView2.DataMember = "";

165

dataGridView2.Columns["s_id"].HeaderCell.Value = "ID";
dataGridView2.Columns["s_name"].HeaderCell.Value = "NAME";
}

private void Material_Receipts_New_Load(object sender, EventArgs e)


{

private void p_mrp_p_Leave(object sender, EventArgs e)


{
addbtn.Enabled = true;
if (tax.Text != "" && pack_c_p.Text != "")
{
rs = (Convert.ToDecimal(r_qty.Text)) *
(Convert.ToDecimal(p_mrp_p.Text));
t_p_m.Text = (Convert.ToString(rs));
rs = (Convert.ToDecimal(r_qty.Text)) *
(Convert.ToDecimal(pack_c_p.Text));
t_p_c.Text = (Convert.ToString(rs));

r = (Convert.ToDecimal(p_mrp_p.Text)) * ((Convert.ToDecimal(tax.Text)
/ 100));
rs = (Convert.ToDecimal(r)) + (Convert.ToDecimal(pack_c_p.Text));
c_p_p.Text = (Convert.ToString(rs));

166

rs = (Convert.ToDecimal(c_p_p.Text)) /
(Convert.ToDecimal(c_factor.Text));
c_p_u.Text = (Convert.ToString(rs));
r = (Convert.ToDecimal(t_p_m.Text)) * ((Convert.ToDecimal(tax.Text) /
100));
vatamt.Text = (Convert.ToString(r));
rs = (Convert.ToDecimal(r)) + (Convert.ToDecimal(t_p_c.Text));
txttotal.Text = (Convert.ToString(rs));
}
else
{
MessageBox.Show("Enter Full Detail");
}

private void CancelBtn_Click(object sender, EventArgs e)


{

this.Refresh();
TxtSupplier.Text = "";

s_name.Text = "";
TxtNetAmount.Text = "";

167

TxtTAmount.Text = "";
TxtUserId.Text = "";
TxtNumber.Text = "";
TxtVatAmount.Text = "";
TxtInvoice.Text = "";

TxtRemarks.Text = "";
created_on.Text = "";
TxtRoundOff.Text = "";

TxtMCode.Text = "";
m_name.Text = "";
b_no.Text = "";
mfg.Text = "";
exp.Text = "";
r_qty.Text = "";
f_qty.Text = "";
c_factor.Text = "";
t_qty.Text = "";
mrp_p.Text = "";
tax.Text = "";
pack_c_p.Text = "";
p_mrp_p.Text = ""; t_p_c.Text = "";
t_p_m.Text = ""; c_p_u.Text = ""; txttotal.Text = ""; a_m_u.Text = "";
c_p_p.Text = ""; TxtTAmount.Text = ""; vatamt.Text = "";

168

DataGridView1.Rows.Clear();

dataGridView2.Visible = false;
groupBox3.Visible = false;

dataGridView3.Visible = false;
groupBox4.Visible = false;
}

private void DoneBtn_Click(object sender, EventArgs e)


{
this.Close();
Material_Receipts_Lists k = new Material_Receipts_Lists();
k.Show();

private void DeleteBtn_Click(object sender, EventArgs e)


{
DataGridView1.Rows.RemoveAt(DataGridView1.CurrentCell.RowIndex);
}

private void DataGridView1_DoubleClick(object sender, EventArgs e)

169

{
ChangeBtn.Enabled = true;
TxtMCode.Text =
DataGridView1.SelectedRows[0].Cells["m_code"].Value.ToString();
m_name.Text =
DataGridView1.SelectedRows[0].Cells["nm"].Value.ToString();
b_no.Text =
DataGridView1.SelectedRows[0].Cells["Batch"].Value.ToString();
mfg.Text =
DataGridView1.SelectedRows[0].Cells["_mfg"].Value.ToString();
exp.Text = DataGridView1.SelectedRows[0].Cells["_exp"].Value.ToString();
r_qty.Text =
DataGridView1.SelectedRows[0].Cells["_r_qty"].Value.ToString();
f_qty.Text =
DataGridView1.SelectedRows[0].Cells["_f_qty"].Value.ToString();
c_factor.Text =
DataGridView1.SelectedRows[0].Cells["c_f"].Value.ToString();
t_qty.Text =
DataGridView1.SelectedRows[0].Cells["_t_qty"].Value.ToString();
mrp_p.Text =
DataGridView1.SelectedRows[0].Cells["_mrp_p"].Value.ToString();
tax.Text = DataGridView1.SelectedRows[0].Cells["tx"].Value.ToString();
pack_c_p.Text =
DataGridView1.SelectedRows[0].Cells["p_cost_p"].Value.ToString();
p_mrp_p.Text =
DataGridView1.SelectedRows[0].Cells["p_mr_p"].Value.ToString();
t_p_c.Text =
DataGridView1.SelectedRows[0].Cells["t_p_cost"].Value.ToString();
t_p_m.Text =
DataGridView1.SelectedRows[0].Cells["t_p_mrp"].Value.ToString();

170

vatamt.Text =
DataGridView1.SelectedRows[0].Cells["_v_amt"].Value.ToString();
c_p_p.Text =
DataGridView1.SelectedRows[0].Cells["_c_p_p"].Value.ToString();
c_p_u.Text =
DataGridView1.SelectedRows[0].Cells["_p_u"].Value.ToString();
a_m_u.Text =
DataGridView1.SelectedRows[0].Cells["A_mrp_u"].Value.ToString();
txttotal.Text =
DataGridView1.SelectedRows[0].Cells["_dis"].Value.ToString();
TxtTAmount.Text =
DataGridView1.SelectedRows[0].Cells["t_amt"].Value.ToString();

private void ChangeBtn_Click(object sender, EventArgs e)


{
DataGridView1.Rows.RemoveAt(DataGridView1.CurrentCell.RowIndex);
addbtn.Enabled = false;

rs = (Convert.ToDecimal(r_qty.Text)) *
(Convert.ToDecimal(p_mrp_p.Text));
t_p_m.Text = (Convert.ToString(rs));

rs = (Convert.ToDecimal(r_qty.Text)) *
(Convert.ToDecimal(pack_c_p.Text));
t_p_c.Text = (Convert.ToString(rs));

171

r = (Convert.ToDecimal(p_mrp_p.Text)) * ((Convert.ToDecimal(tax.Text) /
100));
rs = (Convert.ToDecimal(r)) + (Convert.ToDecimal(pack_c_p.Text));
c_p_p.Text = (Convert.ToString(rs));

rs = (Convert.ToDecimal(c_p_p.Text)) /
(Convert.ToDecimal(c_factor.Text));
c_p_u.Text = (Convert.ToString(rs));
r = (Convert.ToDecimal(t_p_m.Text)) * ((Convert.ToDecimal(tax.Text) /
100));
vatamt.Text = (Convert.ToString(r));
rs = (Convert.ToDecimal(r)) + (Convert.ToDecimal(t_p_c.Text));
TxtTAmount.Text = (Convert.ToString(rs));
DataGridView1.Rows.Add(TxtMCode.Text, m_name.Text, b_no.Text,
mfg.Text, exp.Text, int.Parse(r_qty.Text), int.Parse(f_qty.Text),
int.Parse(c_factor.Text), int.Parse(t_qty.Text), decimal.Parse(mrp_p.Text),
decimal.Parse(tax.Text), decimal.Parse(pack_c_p.Text),
decimal.Parse(p_mrp_p.Text), decimal.Parse(t_p_c.Text),
decimal.Parse(t_p_m.Text), decimal.Parse(vatamt.Text),
decimal.Parse(c_p_p.Text), decimal.Parse(c_p_u.Text),
decimal.Parse(a_m_u.Text), decimal.Parse(txttotal.Text),
decimal.Parse(TxtTAmount.Text));
ChangeBtn.Enabled = false;
for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
{
TxtTAmount.Text = "";
q=q+
(Convert.ToDecimal(DataGridView1.Rows[i].Cells["t_amt"].Value));

172

TxtVatAmount.Text = "";
p=p+
(Convert.ToDecimal(DataGridView1.Rows[i].Cells["_v_amt"].Value));

t=t+
(Convert.ToDecimal(DataGridView1.Rows[i].Cells["_dis"].Value));
}
TxtTAmount.Text = Convert.ToString(q);
q = 0;

TxtVatAmount.Text = Convert.ToString(p);
p = 0;

t = 0;
TxtNetAmount.Text = Math.Round(double.Parse(TxtTAmount.Text),
0).ToString();

TxtMCode.Text = "";
m_name.Text = "";
b_no.Text = "";
mfg.Text = "";
exp.Text = "";
r_qty.Text = "";

173

f_qty.Text = "";
c_factor.Text = "";
t_qty.Text = "";
mrp_p.Text = "";
tax.Text = "";
pack_c_p.Text = "";
p_mrp_p.Text = ""; t_p_c.Text = "";
t_p_m.Text = ""; c_p_u.Text = ""; txttotal.Text = ""; a_m_u.Text = "";
c_p_p.Text = ""; vatamt.Text = "";

private void m_name_TextChanged(object sender, EventArgs e)


{

dataGridView3.Visible = true;
groupBox4.Visible = true;
string str = "%" + m_name.Text + "%";
sql = "select p_id,p_nm,p_type,power from product where (p_nm like '" +
str + "' or p_id like '" + str + "')";
ds = new DataSet();
ds = db.getDataTable(sql );
dataGridView3.DataSource = ds.Tables[0] ;
dataGridView3.DataMember = "";
dataGridView3.Columns["p_id"].HeaderCell.Value = "ID";
dataGridView3.Columns["p_nm"].HeaderCell.Value = "NAME";

174

dataGridView3.Columns["p_type"].HeaderCell.Value = "TYPE";
dataGridView3.Columns["power"].HeaderCell.Value = "POWER";
}
private void c_factor_TextChanged(object sender, EventArgs e)
{
if (Regex.IsMatch(c_factor.Text, "[^0-9]"))
{
MessageBox.Show("please enter a number");
c_factor.Text = "";

}
}

private void r_qty_TextChanged(object sender, EventArgs e)


{
if (Regex.IsMatch(r_qty.Text, "[^0-9]"))
{
MessageBox.Show("please enter a number");
r_qty.Text = "";

}
}

private void f_qty_TextChanged(object sender, EventArgs e)


{

175

if (Regex.IsMatch(f_qty.Text, "[^0-9]"))
{
MessageBox.Show("Please Enter a Number");
f_qty.Text = "";

}
}

private void r_qty_Leave(object sender, EventArgs e)


{
if (r_qty.Text != "")
{
if (int.Parse(r_qty.Text) == 0)
{
MessageBox.Show("Cannot Enter 0 ");
r_qty.Text = "";

}
}
else
{
MessageBox.Show("Please Enter the received quantity");
r_qty.Focus();
}

176

private void btncanprod_Click(object sender, EventArgs e)


{
groupBox4.Visible = false;
m_name.Text = "";
TxtMCode.Text = "";
}

private void btndoneprod_Click(object sender, EventArgs e)


{
try
{
TxtMCode.Text =
dataGridView3.SelectedRows[0].Cells["p_id"].Value.ToString();
m_name.Text =
dataGridView3.SelectedRows[0].Cells["p_nm"].Value.ToString();

dataGridView3.Visible = false;
groupBox4.Visible = false;
}
catch
{
MessageBox.Show("Invalid Product Name");
}
}

177

private void btndonesupp_Click(object sender, EventArgs e)


{
try
{
TxtSupplier.Text =
dataGridView2.SelectedRows[0].Cells["s_id"].Value.ToString();
s_name.Text =
dataGridView2.SelectedRows[0].Cells["s_name"].Value.ToString();

dataGridView2.Visible = false;
groupBox3.Visible = false;
}
catch
{
MessageBox.Show("Invalid Supplier Name");
}
}

private void btncansupp_Click(object sender, EventArgs e)


{
TxtSupplier.Text = "";
s_name.Text = "";
dataGridView2.Visible = false;
groupBox3.Visible = false;
}

178

private void mrp_p_Leave(object sender, EventArgs e)


{
a_m_u.Text = mrp_p.Text;
}

private void mrp_p_TextChanged(object sender, EventArgs e)


{
if (System.Text.RegularExpressions.Regex.IsMatch(mrp_p.Text, "[^0-9]"))
{
MessageBox.Show("Please enter a number");
mrp_p.Text = "";

private void p_mrp_p_TextChanged(object sender, EventArgs e)


{
if (System.Text.RegularExpressions.Regex.IsMatch(p_mrp_p.Text, "[^09]"))
{
MessageBox.Show("Please enter a number");
p_mrp_p.Text = "";

179

private void tax_TextChanged(object sender, EventArgs e)


{
if (System.Text.RegularExpressions.Regex.IsMatch(tax.Text, "[^0-9]"))
{
MessageBox.Show("Please enter a number");
tax.Text = "";

private void pack_c_p_TextChanged(object sender, EventArgs e)


{
if (System.Text.RegularExpressions.Regex.IsMatch(pack_c_p.Text, "[^09]"))
{
MessageBox.Show("Please enter a number");
pack_c_p.Text = "";
}
}
private void f_qty_Leave(object sender, EventArgs e)

180

{
if (f_qty.Text == "")
{

MessageBox.Show("Please Enter The Free Quantity");


f_qty.Focus();
}

private void tax_Leave(object sender, EventArgs e)


{
if (tax.Text == "")
{

MessageBox.Show("Please Enter Tax");


tax.Focus();
}
}
}
}

181

182

Material Receipt List

183

CODE OF MATERIAL RECEIPT LIST

namespace KURJI
{
public partial class Material_Receipts_Lists : Form
{

184

string str1;
decimal q;
string sql;
database db = new database();
DataSet ds;
public Material_Receipts_Lists()
{
InitializeComponent();
}

private void Verifybtn_Click(object sender, EventArgs e)


{
if (DataGridView1.Rows.Count > 0)
{
int i;
i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);
str1 =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["receipt_no"].Value.ToS
tring();
UserAccess.C_Receipt =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["status"].Value.ToStrin
g();

MessageBox.Show((UserAccess.C_Receipt).ToString());

185

string status =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["status"].Value.ToStrin
g();
if (status == "D")
{
MessageBox.Show("Cannot Verify Deleted Item");
}
else
{
Material_Receipts_Verify m = new Material_Receipts_Verify(str1);
m.Show();
}
}
else
{
MessageBox.Show("");
}
}
public void delete()
{
if (DataGridView1.Rows.Count > 0)
{
int i;
i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);

186

str1 =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["receipt_no"].Value.ToS
tring();
UserAccess.C_Receipt =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["status"].Value.ToStrin
g();
MessageBox.Show((UserAccess.C_Receipt).ToString());

string status =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["status"].Value.ToStrin
g();
if (status == "V")
{
MessageBox.Show("Cannot Verify,The Record Is Already Verified");

}
else if (status == "D")
{
MessageBox.Show("Cannot Delete,The Record Is Already Deleted");
}
else
{
sql = "update purchase_master set status='D' where receipt_no='" +
DataGridView1.Rows[i].Cells[0].Value + "'";
db.ExecuteOrcl(sql);
DataGridView1.Rows[i].Cells[4].Value = "D";
}

187

}
else
{
MessageBox.Show("No Data Found,Can't Be Deleted");
}

}
public void show_receipt_list()
{
sql = "select
purchase_master.receipt_no,purchase_master.receipt_date,supplier.s_name,purc
hase_master.total_amt,purchase_master.status from purchase_master inner join
supplier on supplier.s_id=purchase_master.s_id where
purchase_master.receipt_date between'" + dateTimePicker1.Text + "' and '" +
dateTimePicker2.Text + "'order by purchase_master.receipt_no";
ds = new DataSet();
ds = db.getDataTable(sql);
DataGridView1.DataSource = ds.Tables[0];
DataGridView1.DataMember = "";
int t = ds.Tables[0].Rows.Count;
if (t > 0)
{
DataGridView1.Columns["receipt_no"].HeaderCell.Value = "Receipt
Number";
DataGridView1.Columns["receipt_no"].Width = 125;
DataGridView1.Columns["receipt_date"].HeaderCell.Value = "Receipt
Date";

188

DataGridView1.Columns["s_name"].HeaderCell.Value = "Supplier
Name";
DataGridView1.Columns["total_amt"].HeaderCell.Value = "Total
Amount";
DataGridView1.Columns["status"].HeaderCell.Value = "Status";
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
TxtTotalAmt.Text = "";
q=q+
(Convert.ToDecimal(DataGridView1.Rows[i].Cells["total_amt"].Value));
}
TxtTotalAmt.Text = Convert.ToString(q);
q = 0;
Deletebtn.Enabled = true;
}
else
{
MessageBox.Show("No Data Found ");
}
}

private void Showbtn_Click(object sender, EventArgs e)


{

show_receipt_list();
}

189

private void Material_Receipts_Load(object sender, EventArgs e)


{

private void Displaybtn_Click(object sender, EventArgs e)


{

if (DataGridView1.Rows.Count > 0)
{
int i;
i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);

str1 =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["receipt_no"].Value.ToS
tring();

Material_Receipts_Display m = new Material_Receipts_Display(str1);


m.Show();
}
else {
MessageBox.Show("Cannot Display ,Please select any Row");
}
}

190

private void Deletebtn_Click(object sender, EventArgs e)


{
delete();
}
private void Donebtn_Click(object sender, EventArgs e)
{
this.Close();
}

private void btnnew_Click(object sender, EventArgs e)


{
Material_Receipts_New k = new Material_Receipts_New();
k.Show();
}

}
}

191

Transfer To Sales Stock New

192

CODE OF TRANSFER TO SALES STOCK

namespace KURJI
{
public partial class Transfer_Sales_Stock : Form
{
database db = new database();
DataSet ds;

193

string sql;
string rec;
public Transfer_Sales_Stock()
{
InitializeComponent();
txttransferedby.Text = (UserAccess.C_User).ToString();
}

private void label3_Click(object sender, EventArgs e)


{
MessageBox.Show("Not yet");
}

private void DoneBtn_Click(object sender, EventArgs e)


{
this.Close();
}

private void linkLabel1_LinkClicked(object sender,


LinkLabelLinkClickedEventArgs e)
{
View_Main_Stock f1 = new View_Main_Stock();
f1.Show();
}

194

public void record()


{
if (txtcode.Text != "" && tqty.Text != "")
{
int stkqty = int.Parse(txtstockqty.Text);
int trsqty = int.Parse(tqty.Text);
int mainstkp_id = int.Parse(txtcode.Text);
string mainbatch = (b_no.Text).ToString().Trim();

if ((trsqty <= stkqty) && (trsqty > 0))


{
stkqty = stkqty - trsqty;
txtstockqty.Text = stkqty.ToString();

sql = "update main_stock set total_qty= " + stkqty + " where p_id=
" + mainstkp_id + " and batch= '" + mainbatch + "'";

db.ExecuteOrcl(sql);
MessageBox.Show(b_no.Text.Length.ToString());
sql = "select p_id,batch,total_qty from sales_stock";

ds = new DataSet();

ds = db.getDataTable(sql);

195

int b;
int sstrow = ds.Tables[0].Rows.Count;

int d = 0;

if (sstrow > 0)
{
for (b = 0; b < sstrow; b++)
{
Int32 ssp = Convert.ToInt32(ds.Tables[0].Rows[b]["p_id"]);
string ssbatch = ds.Tables[0].Rows[b]
["batch"].ToString().Trim();
Int32 ssqty = Convert.ToInt32(ds.Tables[0].Rows[b]
["total_qty"]);
if ((mainstkp_id == ssp) && (mainbatch == ssbatch))
{
MessageBox.Show(" hhhhhsss");
d = 1;
ssqty = ssqty + trsqty;
sql = "update sales_stock set receipt_no='" + rec + "',
total_qty= " + ssqty + " where p_id= " + ssp + " and batch= '" + ssbatch + "' ";

db.ExecuteOrcl(sql);
}

196

}
if (d == 0)
{
MessageBox.Show("hello");

sql = "insert into sales_stock values('" + rec + "'," +


mainstkp_id + ", '" + mainbatch + "', " + trsqty + ")";

db.ExecuteOrcl(sql);
}
}
if (sstrow == 0)
{
MessageBox.Show("hiii");
sql = "insert into sales_stock values('" + rec + "', " + mainstkp_id
+ ", '" + mainbatch + "', " + trsqty + ")";
db.ExecuteOrcl(sql);
}

sql = "Select trans_no from transfer_detail order by trans_no ";

ds = new DataSet();

ds = db.getDataTable(sql);

197

int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

string str4 = ds.Tables[0].Rows[j]["trans_no"].ToString().Trim();

string str1 = str4.Substring(4, 10);


MessageBox.Show(str1);

string str3 = str4.Substring(0, 4);


MessageBox.Show(str3);

int l = int.Parse(str1) + 1;

MessageBox.Show(l.ToString());

TxtNumber.Text = str3 + Convert.ToString(l);

sql = "insert into Transfer_Detail values('" + TxtNumber.Text +


"','" + transferdate.Text + "','" + TxtStore.Text + "','" + txtsalestore.Text + "'," +
int.Parse(txtcode.Text) + ",'" + b_no.Text + "','" + txttransferedby.Text + "'," +
int.Parse(tqty.Text) + ", '" + rec + "' )";

198

db.ExecuteOrcl(sql);
}
else
{
TxtNumber.Text = "TMTS1400000001";
sql = "insert into Transfer_Detail values('" + TxtNumber.Text +
"','" + transferdate.Text + "','" + TxtStore.Text + "','" + txtsalestore.Text + "'," +
int.Parse(txtcode.Text) + ",'" + b_no.Text + "','" + txttransferedby.Text + "'," +
int.Parse(tqty.Text) + ", '" + rec + "' )";

db.ExecuteOrcl(sql);

}
}
else
{
MessageBox.Show(" can't transfer this much Qty");
}
tqty.Text = "";
ttcp.Text = "";

}
else
{
MessageBox.Show("please Enter your detail");

199

}
}
private void RecordBtn_Click(object sender, EventArgs e)
{
record();
}
private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
int i = dataGridView1.Rows.IndexOf(dataGridView1.CurrentRow);
string str1 = (dataGridView1.Rows[i].Cells[1].Value).ToString();
MessageBox.Show(str1);
}

public void cal_amount()


{
if (txtstockqty.Text != "")
{
if (tqty.Text != "" && int.Parse(tqty.Text) != 0 && int.Parse(tqty.Text) <=
int.Parse(txtstockqty.Text))
{
decimal ds = decimal.Parse(tqty.Text);
decimal ds1 = decimal.Parse(cppunit.Text);
decimal ds3 = ds * ds1;
ttcp.Text = ds3.ToString();
}

200

else
{
MessageBox.Show("please enter Qty");
}
}
else
{
MessageBox.Show("Cannot Transfer");
}
}
private void tqty_Leave(object sender, EventArgs e)
{
cal_amount();
}
private void cmdaccept_Click(object sender, EventArgs e)
{

try
{

if (dataGridView1.Rows.Count > 1)
{
int i = 0;
i = dataGridView1.Rows.IndexOf(dataGridView1.CurrentRow);

201

txtprod_search.Text =
dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
txttype.Text =
dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
txtcode.Text =
dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
b_no.Text =
dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
txtstockqty.Text =
dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
mrppunit.Text =
dataGridView1.SelectedRows[0].Cells[5].Value.ToString();
a_m_u.Text =
dataGridView1.SelectedRows[0].Cells[6].Value.ToString();
mfg.Text =
dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
exp.Text =
dataGridView1.SelectedRows[0].Cells[8].Value.ToString();
cppunit.Text =
dataGridView1.SelectedRows[0].Cells[9].Value.ToString();
tcp.Text =
dataGridView1.SelectedRows[0].Cells[10].Value.ToString();
rec = dataGridView1.SelectedRows[0].Cells[11].Value.ToString();
groupBox3.Visible = false;

}
else
{
MessageBox.Show("cannot select ");

202

}
}
catch
{
MessageBox.Show("Select any Row");
}
}

public void prod_search()


{
string str = txtprod_search.Text + "%";

sql = "select
product.p_nm,product.p_type,main_stock.p_id,main_stock.batch,main_stock.tot
al_qty,purchase_detail.mrp_unit,purchase_detail.actual_mrp_unit,purchase_det
ail.mfg,purchase_detail.exp,purchase_detail.costprice_unit,
(purchase_detail.costprice_unit*main_stock.total_qty)totalcostprice,main_stock.r
eceipt_no from product,main_stock,purchase_detail where
product.p_id=main_stock.p_id and main_stock.p_id=purchase_detail.p_id and
purchase_detail.batch=main_stock.batch and
purchase_detail.receipt_no=main_stock.receipt_no and product.p_nm like ('" +
str + "')order by product.p_nm";

ds = new DataSet();

ds = db.getDataTable(sql);
dataGridView1.Visible = true;

203

groupBox3.Visible = true;
dataGridView1.DataSource = ds.Tables[0];

dataGridView1.Columns[0].HeaderCell.Value = "Product Name";

dataGridView1.Columns[1].HeaderCell.Value = "Product Type";


dataGridView1.Columns[2].HeaderCell.Value = "Product Id";
dataGridView1.Columns[3].HeaderCell.Value = "Batch";
dataGridView1.Columns[4].HeaderCell.Value = "Total Quantity";
dataGridView1.Columns[5].HeaderCell.Value = "MRP/Unit";
dataGridView1.Columns[6].HeaderCell.Value = "Actual Mrp/Unit";
dataGridView1.Columns[7].HeaderCell.Value = "Mfg Date";
dataGridView1.Columns[8].HeaderCell.Value = "Cost Price/Unit";
dataGridView1.Columns[9].HeaderCell.Value = "Total Cost Price";

}
private void tqty_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions .Regex.IsMatch(tqty.Text, "[^0-9]"))
{
MessageBox.Show("Please enter a number");
tqty.Text = "";
}
}

204

private void Transfer_Sales_Stock_Load(object sender, EventArgs e)


{

}
private void btncancel_Click(object sender, EventArgs e)
{

txttype.Text = "";
b_no.Text = "";
txtstockqty.Text = "";
cppunit.Text = "";
tcp.Text = "";
a_m_u.Text = "";
mrppunit.Text = "";
mfg.Text = "";
exp.Text = "";
dataGridView1.Visible = false;
groupBox3.Visible = false;
}

private void txtprod_search_Leave(object sender, EventArgs e)


{
prod_search();
}

205

private void Label9_Click(object sender, EventArgs e)


{

}
}

Transfer To Sales Stock List

206

207

CODE OF TRANSFER TO SALES STOCK LIST

namespace KURJI
{
public partial class Transfer_To_Sales_Stock_List : Form
{
database db=new database();
DataSet ds;
string sql;

public Transfer_To_Sales_Stock_List()
{
InitializeComponent();
}

208

public void show_list()


{
sql = "select
t.trans_no,t.trans_date,t.transfered_by,t.trans_from,t.trans_to,p.p_nm,p.p_type,
p.power,t.p_id,t.batch,t.transfer_qty,pr.mrp_unit,pr.costprice_unit,
(pr.costprice_unit*t.transfer_qty) total_costprice,pr.mfg,pr.exp from product
p,purchase_detail pr,transfer_detail t where p.p_id=t.p_id and t.p_id=pr.p_id and
t.batch=pr.batch and t.receipt_no=pr.receipt_no and t.trans_date between '" +
datefrom.Text + "' and '" + dateto.Text + "'";
ds = new DataSet();

ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
int j = ds.Tables[0].Rows.Count - 1;
txtfrom.Text = ds.Tables[0].Rows[0]["trans_no"].ToString().Trim();
txtto.Text = ds.Tables[0].Rows[j]["trans_no"].ToString().Trim();
dataGridView2.DataSource = ds.Tables[0];
decimal q = 0;
for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)
{
TxtTotalAmt.Text = "";

q=q+
(Convert.ToDecimal(dataGridView2.Rows[i].Cells["total_costprice"].Value));
}

209

TxtTotalAmt.Text = q.ToString();
}
else
{
MessageBox.Show("no data found");
}
}
private void Showbtn_Click(object sender, EventArgs e)
{
show_list();
}

private void Transfer_To_Sales_Stock_List_Load(object sender, EventArgs e)


{

private void Donebtn_Click(object sender, EventArgs e)


{
this.Close();
}

private void btnnew_Click(object sender, EventArgs e)


{
Transfer_Sales_Stock k = new Transfer_Sales_Stock();

210

k.Show();
}

}
}

Main Stock

211

212

CODE OF VIEW MAIN STOCK

namespace KURJI
{
public partial class View_Main_Stock : Form
{
database db=new database();
DataSet ds;
string sql;

public View_Main_Stock()
{
InitializeComponent();
}
public void prod_search()
{

213

string str = "%" + txtproductsearch.Text + "%";

sql = "select
product.p_nm,product.p_type,main_stock.p_id,main_stock.batch,main_stock.tot
al_qty,purchase_detail.mrp_unit,purchase_detail.actual_mrp_unit,purchase_det
ail.mfg,purchase_detail.exp,purchase_detail.costprice_unit,
(purchase_detail.costprice_unit*main_stock.total_qty)totalcostprice from
product,main_stock,purchase_detail where product.p_id=main_stock.p_id and
main_stock.p_id=purchase_detail.p_id and
purchase_detail.batch=main_stock.batch and
purchase_detail.receipt_no=main_stock.receipt_no and product.p_nm like ('" +
str + "')";

ds = new DataSet();
ds = db.getDataTable(sql);
dataGridView1.Visible = true;
dataGridView1.DataSource = ds.Tables[0];

dataGridView1.Columns[0].HeaderCell.Value = "Product Name";

dataGridView1.Columns[1].HeaderCell.Value = "Product Type";


dataGridView1.Columns[2].HeaderCell.Value = "Product Id";
dataGridView1.Columns[3].HeaderCell.Value = "Batch";
dataGridView1.Columns[4].HeaderCell.Value = "Total Quantity";
dataGridView1.Columns[5].HeaderCell.Value = "MRP/Unit";
dataGridView1.Columns[6].HeaderCell.Value = "Actual Mrp/Unit";

214

dataGridView1.Columns[7].HeaderCell.Value = "Mfg Date";


dataGridView1.Columns[8].HeaderCell.Value = "Cost Price/Unit";
dataGridView1.Columns[9].HeaderCell.Value = "Total Cost Price";
}
private void txtproductsearch_Leave(object sender, EventArgs e)
{
prod_search();
}

private void View_Main_Stock_Load(object sender, EventArgs e)


{

private void dataGridView1_Click(object sender, EventArgs e)


{
try
{
int i = dataGridView1.Rows.IndexOf(dataGridView1.CurrentRow);
txtcode.Text =
dataGridView1.SelectedRows[0].Cells["p_id"].Value.ToString();
m_name.Text =
dataGridView1.SelectedRows[0].Cells["p_nm"].Value.ToString();
b_no.Text =
dataGridView1.SelectedRows[0].Cells["batch"].Value.ToString();

215

txttype.Text =
dataGridView1.SelectedRows[0].Cells["p_type"].Value.ToString();
cppunit.Text =
dataGridView1.SelectedRows[0].Cells["costprice_unit"].Value.ToString();
tcp.Text =
dataGridView1.SelectedRows[0].Cells["totalcostprice"].Value.ToString();
txtstockqty.Text =
dataGridView1.SelectedRows[0].Cells["total_qty"].Value.ToString();
a_m_u.Text =
dataGridView1.SelectedRows[0].Cells["actual_mrp_unit"].Value.ToString();
mfg.Text =
dataGridView1.SelectedRows[0].Cells["mfg"].Value.ToString();
exp.Text =
dataGridView1.SelectedRows[0].Cells["exp"].Value.ToString();
mrppunit.Text =
dataGridView1.SelectedRows[0].Cells["mrp_unit"].Value.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

}
}

216

217

Add New Product

218

219

CODE OF ADD NEW PRODUCT

namespace KURJI
{
public partial class New_Product : Form
{
string sql;
database db = new database();
DataSet ds;

public New_Product()
{
InitializeComponent();
}
public void record_product()
{
if (txtclass.Text == "" || txtmfgby.Text == "" || txtpnm.Text == "" ||
txtpower.Text == "" || txtsclass.Text == "" || txttype.Text == "")

220

{
MessageBox.Show("Enter your Full detail");
}
else
{
sql = "select p_id from product order by p_id";
ds = new DataSet();

ds = db.getDataTable(sql);

int p = ds.Tables[0].Rows.Count;

if (p > 0)
{

int pr = Convert.ToInt32(ds.Tables[0].Rows[p - 1]["p_id"]);


pr = pr + 1;
MessageBox.Show(pr.ToString());
txtpid.Text = pr.ToString();
sql = "insert into product values(" + int.Parse(txtpid.Text) + ",'" +
txtpnm.Text + "','" + txttype.Text + "','" + txtpower.Text + "','" + txtclass.Text + "','"
+ txtsclass.Text + "','" + txtmfgby.Text + "')";
db = new database();
db.ExecuteOrcl(sql);

221

}
else
{
txtpid.Text = "10001";
sql = "insert into product values(" + int.Parse(txtpid.Text) + ",'" +
txtpnm.Text + "','" + txttype.Text + "','" + txtpower.Text + "','" + txtclass.Text + "','"
+ txtsclass.Text + "','" + txtmfgby.Text + "')";

db.ExecuteOrcl(sql);

}
}
}
private void btmrecord_Click(object sender, EventArgs e)
{
record_product();
}
public void search_product()
{
string str = "%" + txtsearch.Text + "%";
sql = "select p_nm product_Name,p_id product_id,p_type
Type,power,mfgby,p_class,p_s_class from product where ((p_nm like '" + str + "')
or (p_id like '" + str + "')) ";
ds = new DataSet();

ds = db.getDataTable(sql);

222

dataGridView1.DataSource = ds.Tables[0];
}
private void textBox1_Leave(object sender, EventArgs e)
{
search_product();
}

private void btnref_Click(object sender, EventArgs e)


{
disp();
}
public void disp()
{
sql = "select p_nm product_Name,p_id product_id,p_type
Type,power,mfgby,p_class,p_s_class from product";
ds = new DataSet();

ds = db.getDataTable(sql);
dataGridView1.DataSource = ds.Tables[0];

private void New_Product_Load(object sender, EventArgs e)


{
disp();

223

private void btncan_Click(object sender, EventArgs e)


{
txtsearch.Text = "";
txtpid.Text = "";
txtpnm.Text = "";
txttype.Text = ""; txtpower.Text = ""; txtmfgby.Text = ""; txtclass.Text = "";
txtsclass.Text = "";
}

private void btndone_Click(object sender, EventArgs e)


{
this.Close();
}

}
}

224

Add New Supplier

225

226

CODE OF ADD NEW SUPPLIER

namespace KURJI
{
public partial class New_Supplier : Form
{
string sql;
database db = new database();
DataSet ds;

public New_Supplier()
{
InitializeComponent();
}
public void disp()
{
sql = "select * from supplier";

227

ds = new DataSet();

ds = db.getDataTable(sql);
dataGridView1.DataSource = ds.Tables[0];

}
private void btnref_Click(object sender, EventArgs e)
{
disp();

}
public void record()
{
if (txtsnm.Text == "" || txtvat.Text == "" || txtemail.Text == "" ||
txtcst.Text == "" || txtcontact.Text == "" || txtaddress.Text == "")
{
MessageBox.Show("Enter Full Details");
}
else
{
sql = "select s_id from supplier order by s_id";
ds = new DataSet();

ds = db.getDataTable(sql);

228

int p = ds.Tables[0].Rows.Count;

if (p > 0)
{

int pr = Convert.ToInt32(ds.Tables[0].Rows[p - 1]["s_id"]);


pr = pr + 1;
MessageBox.Show(pr.ToString());
txtsid.Text = pr.ToString();
sql = "insert into supplier values(" + int.Parse(txtsid.Text) + ",'" +
txtsnm.Text + "','" + txtaddress.Text + "'," + int.Parse(txtcontact.Text) + ",'" +
txtemail.Text + "','" + txtcst.Text + "','" + txtvat.Text + "')";

db.ExecuteOrcl(sql);
}
else
{
txtsid.Text = "1001";
sql = "insert into supplier values(" + int.Parse(txtsid.Text) + ",'" +
txtsnm.Text + "','" + txtaddress.Text + "'," + int.Parse(txtcontact.Text) + ",'" +
txtemail.Text + "','" + txtcst.Text + "','" + txtvat.Text + "')";

db.ExecuteOrcl(sql);

229

}
}
private void btmrecord_Click(object sender, EventArgs e)
{
record();
}
public void supplier_search()
{
string str = "%" + txtsearch.Text + "%";
sql = "select * from supplier where ((s_name like '" + str + "') or (s_id like
'" + str + "')) ";
ds = new DataSet();

ds = db.getDataTable(sql);
dataGridView1.DataSource = ds.Tables[0];
}
private void txtsearch_Leave(object sender, EventArgs e)
{
supplier_search();
}

private void New_Supplier_Load(object sender, EventArgs e)

230

{
disp();
}

private void btndone_Click(object sender, EventArgs e)


{
this.Close();
}

private void btncancel_Click(object sender, EventArgs e)


{
txtsearch.Text = "";
txtsid.Text = "";
txtsnm.Text = "";
txtaddress.Text = ""; txtcontact.Text = ""; txtemail.Text = ""; txtcst.Text =
""; txtvat.Text = "";
}

}
}

231

232

Transfer To Main Stock List

233

CODE OF TRANSFER TO MAIN STOCK LIST

namespace KURJI
{
public partial class Transfer_To_Main_Stock_List : Form
{
public Transfer_To_Main_Stock_List()
{
InitializeComponent();
}
public void display_sales_tranfer_list()
{
string sql = " select
t.trans_no,t.trans_date,t.transfered_by,t.trans_from,t.trans_to,p.p_nm,p.p_type,
p.power,t.p_id,t.batch,t.trans_qty,pr.mrp_unit,pr.costprice_unit,
(pr.costprice_unit*t.trans_qty) total_costprice,pr.mfg,pr.exp from product
p,purchase_detail pr,transfer_to_main_stock t where p.p_id=t.p_id and
t.p_id=pr.p_id and t.batch=pr.batch and t.receipt_no=pr.receipt_no and
t.trans_date between '" + datefrom.Text + "' and '" + dateto.Text + "'order by
t.trans_no";

234

database db = new database();


DataSet ds = new DataSet();
ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();

dataGridView2.DataSource = ds.Tables[0];
decimal q = 0;
for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)
{
TxtTotalAmt.Text = "";

q=q+
(Convert.ToDecimal(dataGridView2.Rows[i].Cells["total_costprice"].Value));

}
TxtTotalAmt.Text = q.ToString();
}
else
{

235

MessageBox.Show("No Data Found");


}
}
private void Showbtn_Click(object sender, EventArgs e)
{
display_sales_tranfer_list();
}

private void Transfer_To_Main_Stock_List_Load(object sender, EventArgs e)


{

private void Donebtn_Click(object sender, EventArgs e)


{
this.Close();
}

private void btnnew_Click(object sender, EventArgs e)


{
Transfer_To_Main_Stock_New f = new Transfer_To_Main_Stock_New();
f.Show();

}
}

236

Transfer To Main Stock New

237

238

CODE OF TRANSFER TO MAIN STOCK NEW

namespace KURJI
{
public partial class Transfer_To_Main_Stock_New : Form
{
string sql,rec;
database db = new database();
DataSet ds;

public Transfer_To_Main_Stock_New()
{
InitializeComponent();
txttransferedby.Text = (UserAccess.C_User).ToString();
}
public void product_search()
{
string str = txtproduct_search.Text + "%";

239

sql = "select
p.p_nm,p.p_type,m.p_id,m.batch,m.total_qty,pr.mrp_unit,pr.actual_mrp_unit,pr.
mfg,pr.exp,pr.costprice_unit,
(pr.costprice_unit*m.total_qty)totalcostprice,m.receipt_no from product
p,sales_stock m,purchase_detail pr where p.p_id=m.p_id and m.p_id=pr.p_id
and pr.batch=m.batch and pr.receipt_no=m.receipt_no and p.p_nm like ('" +
str + "')";

ds = new DataSet();

ds = db.getDataTable(sql);

dataGridView1.Visible = true;
groupBox3.Visible = true;

dataGridView1.DataSource = ds.Tables[0];
}

private void cmdaccept_Click(object sender, EventArgs e)


{
try
{

if (dataGridView1.Rows.Count > 0)
{
int i = 0;

240

i = dataGridView1.Rows.IndexOf(dataGridView1.CurrentRow);
txtproduct_search.Text =
dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
txttype.Text =
dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
txtcode.Text =
dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
b_no.Text =
dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
txtstockqty.Text =
dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
mrppunit.Text =
dataGridView1.SelectedRows[0].Cells[5].Value.ToString();
a_m_u.Text =
dataGridView1.SelectedRows[0].Cells[6].Value.ToString();
mfg.Text =
dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
exp.Text =
dataGridView1.SelectedRows[0].Cells[8].Value.ToString();
cppunit.Text =
dataGridView1.SelectedRows[0].Cells[9].Value.ToString();
tcp.Text =
dataGridView1.SelectedRows[0].Cells[10].Value.ToString();
rec = dataGridView1.SelectedRows[0].Cells[11].Value.ToString();
groupBox3.Visible = false;

}
else
{

241

MessageBox.Show("cannot select ");


}
}
catch
{
MessageBox.Show("Select any Row");
}

private void tqty_TextChanged(object sender, EventArgs e)


{
if(Regex.IsMatch(tqty.Text,"[^0-9]"))
{
MessageBox.Show("please enter a number");
tqty.Text = "";

}
}
public void cal_amount()
{
if (txtstockqty.Text != "")
{

if (tqty.Text != "" && int.Parse(tqty.Text) != 0)

242

{
if (int.Parse(tqty.Text) <= int.Parse(txtstockqty.Text))
{
decimal ds = decimal.Parse(tqty.Text);
decimal ds1 = decimal.Parse(cppunit.Text);
decimal ds3 = ds * ds1;
ttcp.Text = ds3.ToString();
}
else
{
MessageBox.Show("Too Much Quantity,Can't Transfer");
}
}
else
{
MessageBox.Show("Please Enter Quantity");
}
}
else
{
MessageBox.Show("You don't have Stock Qty,Can't Transfer");
}
}
private void tqty_Leave(object sender, EventArgs e)
{

243

cal_amount();
txtcode.Focus();
}
public void record()
{
if (txtcode.Text != "" && tqty.Text != "")
{
int stkqty = int.Parse(txtstockqty.Text);
int trsqty = int.Parse(tqty.Text);
int mainstkp_id = int.Parse(txtcode.Text);
string mainbatch = (b_no.Text).ToString().Trim();

if ((trsqty <= stkqty) && (trsqty > 0))


{
stkqty = stkqty - trsqty;
txtstockqty.Text = stkqty.ToString();

sql = "update sales_stock set total_qty= " + stkqty + " where p_id=
" + mainstkp_id + " and batch= '" + mainbatch + "'";
db.ExecuteOrcl(sql);

sql = "select p_id,batch,total_qty from main_stock";

ds = new DataSet();

244

ds = db.getDataTable(sql);

int b;
int sstrow = ds.Tables[0].Rows.Count;
if (sstrow > 0)
{
for (b = 0; b < sstrow; b++)
{
Int32 ssp = Convert.ToInt32(ds.Tables[0].Rows[b]["p_id"]);
string ssbatch = ds.Tables[0].Rows[b]
["batch"].ToString().Trim();
Int32 ssqty = Convert.ToInt32(ds.Tables[0].Rows[b]
["total_qty"]);
if ((mainstkp_id == ssp) && (mainbatch == ssbatch))
{

ssqty = ssqty + trsqty;


sql = "update main_stock set receipt_no='" + rec + "',
total_qty= " + ssqty + " where p_id= " + ssp + " and batch= '" + ssbatch + "' ";

db.ExecuteOrcl(sql);
}
}

245

sql = "Select trans_no from transfer_to_main_stock order by


trans_no ";
ds = new DataSet();
ds = db.getDataTable(sql);

int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

string str4 = ds.Tables[0].Rows[j]["trans_no"].ToString().Trim();

string str1 = str4.Substring(4, 10);

string str3 = str4.Substring(0, 4);

int l = int.Parse(str1) + 1;

246

TxtNumber.Text = str3 + Convert.ToString(l);

sql = "insert into transfer_to_main_stock values('" +


TxtNumber.Text + "','" + transferdate.Text + "','" + TxtStore.Text + "','" +
txtsalestore.Text + "'," + int.Parse(txtcode.Text) + ",'" + b_no.Text + "'," +
int.Parse(tqty.Text) + ",'" + txttransferedby.Text + "','" + rec + "' )";

db.ExecuteOrcl(sql);
}
else
{
TxtNumber.Text = "TMTS1400000001";
sql = "insert into transfer_to_main_stock values('" +
TxtNumber.Text + "','" + transferdate.Text + "','" + TxtStore.Text + "','" +
txtsalestore.Text + "'," + int.Parse(txtcode.Text) + ",'" + b_no.Text + "'," +
int.Parse(tqty.Text) + ",'" + txttransferedby.Text + "','" + rec + "' )";

db.ExecuteOrcl(sql);

247

else
{
MessageBox.Show(" Can't Transfer This Much Quantity");
}
tqty.Text = "";
ttcp.Text = "";

}
else
{
MessageBox.Show("Please Enter Your Detail");
}

private void RecordBtn_Click(object sender, EventArgs e)


{
record();
}
private void Transfer_To_Main_Stock_New_Load(object sender, EventArgs e)
{

private void DoneBtn_Click(object sender, EventArgs e)

248

{
this.Close();
}

private void txtproduct_search_Leave(object sender, EventArgs e)


{
product_search();
}

private void btncancel_Click(object sender, EventArgs e)


{
txtcode.Text = "";
txtproduct_search.Text = "";
b_no.Text = "";
cppunit.Text = "";
tcp.Text = "";
txttype.Text = "";
a_m_u.Text = "";
tqty.Text = "";
txtstockqty.Text = "";
mrppunit.Text = "";
ttcp.Text = "";
groupBox3.Visible = false;
dataGridView1.Visible = false;
}

249

}
}

Sales Stock

250

251

CODE OF VIEW SALES STOCK

namespace KURJI
{
public partial class View_Sales_Stock : Form
{
string sql;
DataSet ds;
database db=new database();

public View_Sales_Stock()
{
InitializeComponent();
}
public void prod_search()
{
string str = "%" + txtproductsearch.Text + "%";

sql = "select
p.p_nm,p.p_type,p.power,s.p_id,s.batch,s.total_qty,pr.mrp_unit,pr.actual_mrp_u
nit,pr.mfg,pr.exp,pr.costprice_unit,(pr.costprice_unit*s.total_qty)totalcostprice
from product p,sales_stock s,purchase_detail pr where p.p_id=s.p_id and

252

s.p_id=pr.p_id and pr.batch=s.batch and pr.receipt_no=s.receipt_no and p.p_nm


like ('" + str + "')";
ds = new DataSet();

ds = db.getDataTable(sql);

dataGridView1.Visible = true;
dataGridView1.DataSource = ds.Tables[0];
}
private void txtproductsearch_Leave(object sender, EventArgs e)
{
prod_search();
}
private void dataGridView1_Click(object sender, EventArgs e)
{
try
{
int i = dataGridView1.Rows.IndexOf(dataGridView1.CurrentRow);
txtcode.Text =
dataGridView1.SelectedRows[0].Cells["p_id"].Value.ToString();
m_name.Text =
dataGridView1.SelectedRows[0].Cells["p_nm"].Value.ToString();
b_no.Text =
dataGridView1.SelectedRows[0].Cells["batch"].Value.ToString();
txttype.Text =
dataGridView1.SelectedRows[0].Cells["p_type"].Value.ToString();

253

cppunit.Text =
dataGridView1.SelectedRows[0].Cells["costprice_unit"].Value.ToString();
tcp.Text =
dataGridView1.SelectedRows[0].Cells["totalcostprice"].Value.ToString();
txtstockqty.Text =
dataGridView1.SelectedRows[0].Cells["total_qty"].Value.ToString();
a_m_u.Text =
dataGridView1.SelectedRows[0].Cells["actual_mrp_unit"].Value.ToString();
mfg.Text =
dataGridView1.SelectedRows[0].Cells["mfg"].Value.ToString();
exp.Text =
dataGridView1.SelectedRows[0].Cells["exp"].Value.ToString();
mrppunit.Text =
dataGridView1.SelectedRows[0].Cells["mrp_unit"].Value.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

private void View_Sales_Stock_Load(object sender, EventArgs e)


{

private void a_m_u_TextChanged(object sender, EventArgs e)

254

private void groupBox2_Enter(object sender, EventArgs e)


{

}
}
}

Cash Sales Bill Only List

255

256

CODE OF CASH SALES BILL ONLY LIST

namespace KURJI
{
public partial class Cash_Sales_Bill_Only_List : Form
{
database db = new database();
public Cash_Sales_Bill_Only_List()
{
InitializeComponent();
}

public void display_list()


{
if (DataGridView1.Rows.Count > 0)

257

{
int i;
i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);

string str1 =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells[0].Value.ToString();

if (cmbpatient_type.Text == "OPD")
{
if
(DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["ip_no"].Value.ToStrin
g() == "")
{
Cash_Sales_Bill_Only_Display f = new
Cash_Sales_Bill_Only_Display(str1, cmbpatient_type.Text);
f.Show();
}
else
{
MessageBox.Show("Refresh List");
}
}
else
{

258

if
(DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["ip_no"].Value.ToStrin
g() != "")
{
Cash_Sales_Bill_Only_Display f = new
Cash_Sales_Bill_Only_Display(str1, cmbpatient_type.Text);
f.Show();
}
else
{
MessageBox.Show("Refresh List");
}
}
}
else
{
MessageBox.Show("Cannot Display");
}
}
private void Cash_Sales_Bill_Only_List_Load(object sender, EventArgs e)
{

}
public void sum_total()
{
decimal q = 0;

259

for (int i = 0; i < DataGridView1.Rows.Count; i++)


{
txttotal_amount.Text = "";
q=q+
(Convert.ToDecimal(DataGridView1.Rows[i].Cells["net_amount"].Value));
}
txttotal_amount.Text = Convert.ToString(q);
q = 0;
}
public void cash_sale_list()
{
if (cmbpatient_type.Text == "OPD")
{
string sql = "select
m.bill_no,m.opd_no,m.ip_no,p.pat_name,m.bill_date,m.net_amount from
Patient_detail p,Cash_Sale_Master m where p.opd_no=m.opd_no and
m.bill_date between '" + datefrom.Text + "'and'" + dateto.Text + "'order by
m.bill_no";

DataSet ds = new DataSet();


ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();
DataGridView1.DataSource = ds.Tables[0];

260

sum_total();

}
else
{
MessageBox.Show("No Record Found");
}
}
else if (cmbpatient_type.Text == "IP")
{

MessageBox.Show(cmbpatient_type.Text);
string sql = "select
m.bill_no,m.ip_no,m.opd_no,p.pat_name,m.bill_date,m.net_amount from
Patient_detail p,admission_detail ad,Cash_Sale_Master m where
p.opd_no=m.opd_no and p.opd_no=ad.opd_no and m.ip_no=ad.ip_no and
m.bill_date between '" + datefrom.Text + "'and'" + dateto.Text + "'order by
m.bill_no";

DataSet ds = new DataSet();


ds = db.getDataTable(sql);
ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();

261

DataGridView1.DataSource = ds.Tables[0];
sum_total();
}
else
{
MessageBox.Show("No Record Found");
}
}
else
{
MessageBox.Show("Invalid Selection");
}
}

private void btnnew_Click(object sender, EventArgs e)


{
if (cmbpatient_type.Text != "")
{
Cash_Sales_Bill_Only_New k = new
Cash_Sales_Bill_Only_New(cmbpatient_type.Text);
k.Show();
}
else
{
MessageBox.Show("please select opd or ip");

262

}
}

private void btndone_Click(object sender, EventArgs e)


{
this.Close();
}

private void btndis_Click(object sender, EventArgs e)


{
display_list();
}

private void btnshow_Click(object sender, EventArgs e)


{
cash_sale_list();
}
}
}

263

Cash Sales Bill Only New

264

265

CODE OF CASH SALES BILL ONLY NEW

namespace KURJI
{
public partial class Cash_Sales_Bill_Only_New : Form
{
database db = new database();
string sql, patient_type;
DataSet ds;

string rec;
public Cash_Sales_Bill_Only_New(string patient)
{
InitializeComponent();
patient_type = patient;
txtuser_id.Text = UserAccess.C_User;
}

private void cmdrecord_Click(object sender, EventArgs e)

266

{
if (txtremark.Text != "" && m_name.Text != "" && ComboBox1.Text != ""
&& textBox1.Text != "" && txtdate.Text != "" && txtuser_id.Text != "" &&
DataGridView1.Rows.Count > 1)
{
insert_cash_sale();
update_sales();
}
else
{
MessageBox.Show("Please enter full detail");
}
}

public void update_sales()


{
Int32 sqty = 0;
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
sqty = Convert.ToInt32(DataGridView1.Rows[i].Cells["stockqty"].Value)
- Convert.ToInt32(DataGridView1.Rows[i].Cells["issqty"].Value);
sql = "update sales_stock set total_qty= " + sqty + " where p_id= " +
DataGridView1.Rows[i].Cells["Material_Code"].Value + " and batch= '" +
DataGridView1.Rows[i].Cells["Batch"].Value + "'";
db.ExecuteOrcl(sql);
}
}

267

public void insert_cash_sale()


{
sql = "select * from Cash_Sale_detail";
ds = new DataSet();

ds = db.getDataTable(sql);
int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

string str4 = ds.Tables[0].Rows[j]["Bill_no"].ToString();

string str1 = str4.Substring(4, 10);

string str3 = str4.Substring(0, 4);

int l = int.Parse(str1) + 1;

txtNumber.Text = str3 + Convert.ToString(l);


if (patient_type == "IP")
{

268

for (int i = 0; i < DataGridView1.Rows.Count; i++)


{
cmdcancel.Enabled = true;
sql = "insert into Cash_Sale_detail values('" + txtNumber.Text +
"'," + DataGridView1.Rows[i].Cells["Material_Code"].Value + ",'" +
DataGridView1.Rows[i].Cells["Batch"].Value + "'," +
DataGridView1.Rows[i].Cells["issqty"].Value + "," +
DataGridView1.Rows[i].Cells["Amount"].Value + ",'" +
DataGridView1.Rows[i].Cells["receipt_no"].Value + "')";

db.ExecuteOrcl(sql);
}
sql = "insert into
Cash_Sale_master(Bill_NO,opd_no,Doc_Id,User_Id,Bill_Date,Total_amount,Roun
doff_amount,Net_amount,status,Remarks,ip_no)values('" + txtNumber.Text + "','"
+ txtopd.Text + "','" + ComboBox1.Text + "','" + txtuser_id.Text + "','" +
txtdate.Text + "'," + decimal.Parse(txttotalamt.Text) + "," +
decimal.Parse(roundoff_amount.Text) + "," + decimal.Parse(txtnet_total.Text) +
",'A', '" + txtremark.Text + "','" + txtip.Text + "')";

db.ExecuteOrcl(sql);
MessageBox.Show("The following Product Having Invoice No." +
txtip.Text + " has been succesfully added as New Purchase");
cmdrecord.Enabled = false;

}
else
{
for (int i = 0; i < DataGridView1.Rows.Count ; i++)

269

{
cmdcancel.Enabled = true;
sql = "insert into Cash_Sale_detail values('" + txtNumber.Text +
"'," + DataGridView1.Rows[i].Cells["Material_Code"].Value + ",'" +
DataGridView1.Rows[i].Cells["Batch"].Value + "'," +
DataGridView1.Rows[i].Cells["issqty"].Value + "," +
DataGridView1.Rows[i].Cells["Amount"].Value + ",'" +
DataGridView1.Rows[i].Cells["receipt_no"].Value + "')";

db.ExecuteOrcl(sql);
}
sql = "insert into
Cash_Sale_master(Bill_NO,opd_no,Doc_Id,User_Id,Bill_Date,Total_amount,Roun
doff_amount,Net_amount,status,Remarks)values('" + txtNumber.Text + "','" +
txtopd.Text + "','" + ComboBox1.Text + "','" + txtuser_id.Text + "','" + txtdate.Text
+ "'," + decimal.Parse(txttotalamt.Text) + "," +
decimal.Parse(roundoff_amount.Text) + "," + decimal.Parse(txtnet_total.Text) +
",'A', '" + txtremark.Text + "')";
db.ExecuteOrcl(sql);
MessageBox.Show("The following Product Having Invoice No." +
txtip.Text + " has been succesfully added as New Purchase");
cmdrecord.Enabled = false;
}
}
else
{
if (patient_type == "IP")
{

270

txtNumber.Text = "BILL1400000001";
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
cmdcancel.Enabled = true;
sql = "insert into Cash_Sale_detail values('" + txtNumber.Text +
"'," + DataGridView1.Rows[i].Cells["Material_Code"].Value + ",'" +
DataGridView1.Rows[i].Cells["Batch"].Value + "'," +
DataGridView1.Rows[i].Cells["issqty"].Value + "," +
DataGridView1.Rows[i].Cells["Amount"].Value + ",'" +
DataGridView1.Rows[i].Cells["receipt_no"].Value + "')";
db.ExecuteOrcl(sql);
}

sql = "insert into


Cash_Sale_master(Bill_NO,opd_no,Doc_Id,User_Id,Bill_Date,Total_amount,Roun
doff_amount,Net_amount,status,Remarks,ip_no)values('" + txtNumber.Text + "','"
+ txtopd.Text + "','" + ComboBox1.Text + "','" + txtuser_id.Text + "','" +
txtdate.Text + "'," + decimal.Parse(txttotalamt.Text) + "," +
decimal.Parse(roundoff_amount.Text) + "," + decimal.Parse(txtnet_total.Text) +
",'A', '" + txtremark.Text + "','" + txtip.Text + "')";
db.ExecuteOrcl(sql);

}
else
{
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
cmdcancel.Enabled = true;

271

sql = "insert into Cash_Sale_detail values('" + txtNumber.Text +


"'," + DataGridView1.Rows[i].Cells["Material_Code"].Value + ",'" +
DataGridView1.Rows[i].Cells["Batch"].Value + "'," +
DataGridView1.Rows[i].Cells["issqty"].Value + "," +
DataGridView1.Rows[i].Cells["Amount"].Value + ",'" +
DataGridView1.Rows[i].Cells["receipt_no"].Value + "')";

db.ExecuteOrcl(sql);
}
sql = "insert into
Cash_Sale_master(Bill_NO,opd_no,Doc_Id,User_Id,Bill_Date,Total_amount,Roun
doff_amount,Net_amount,status,Remarks)values('" + txtNumber.Text + "','" +
txtopd.Text + "','" + ComboBox1.Text + "','" + txtuser_id.Text + "','" + txtdate.Text
+ "'," + decimal.Parse(txttotalamt.Text) + "," +
decimal.Parse(roundoff_amount.Text) + "," + decimal.Parse(txtnet_total.Text) +
",'A', '" + txtremark.Text + "')";

db.ExecuteOrcl(sql);
MessageBox.Show("The following Product Having Invoice No." +
txtip.Text + " has been succesfully added as New Purchase");
cmdrecord.Enabled = false;
}
}
}
public void prod_search()
{
string str = txtmname.Text + "%";
sql = "select
p.p_nm,p.p_type,s.p_id,s.batch,s.total_qty,p.power,pr.ACTUAL_MRP_UNIT,pr.mr
p_unit,pr.exp,pr.mfg,s.receipt_no from product p,sales_stock s,purchase_detail

272

pr where p.p_id=s.p_id and s.p_id=pr.p_id and s.batch=pr.batch and


s.receipt_no=pr.receipt_no and p.p_nm like '" + str + "'";

ds = new DataSet();
ds = db.getDataTable(sql);
dataGridView3.Visible = true;
btncan_item.Visible = true;
btnaccept_item.Visible = true;

dataGridView3.DataSource = ds.Tables[0];

public void patient_search()


{
if (patient_type == "IP")
{
string str = "%" + txtpat_name.Text + "%";
sql = "select
p.pat_name,a.ip_no,a.opd_no,a.ward_no,a.bed,p.sex,p.age from
ADMISSION_DETAIL a,PATIENT_DETAIL p where a.opd_no=p.opd_no and
p.pat_name like '" + str + "'";
ds = new DataSet();

ds = db.getDataTable(sql);
panel1.Visible = true;

273

dataGridView2.DataSource = ds.Tables[0];
dataGridView2.Columns["pat_name"].HeaderCell.Value = "Patient
Name";
dataGridView2.Columns["ip_no"].HeaderCell.Value = "IP No.";
dataGridView2.Columns["opd_no"].HeaderCell.Value = "OPD No.";
dataGridView2.Columns["ward_no"].HeaderCell.Value = "Ward No";
}
else if (patient_type == "OPD")
{

string str = "%" + txtpat_name.Text + "%";

sql = "select p.pat_name,p.opd_no,p.ip_no,p.sex,p.age from


patient_detail p where p.pat_name like'" + str + "'";

ds = new DataSet();

ds = db.getDataTable(sql);
panel1.Visible = true;
dataGridView2.Visible = true;
dataGridView2.DataSource = ds.Tables[0];
}
else
{
MessageBox.Show("Wrong Choice");
}

274

public void load_grid()


{
if (txtcode.Text != "" && txtmname.Text != "" && txtqty_issued.Text != "")
{

if (((int.Parse(txtqty_issued.Text)) <= (int.Parse(txtstock.Text)) &&


(int.Parse(txtqty_issued.Text) != 0)))
{
decimal d = 0;

DataGridView1.Rows.Add(int.Parse(txtcode.Text), txtmname.Text,
txttype.Text, txtbatch_no.Text, decimal.Parse(txtmrp.Text),
decimal.Parse(txtactmrp.Text), int.Parse(txtqty_issued.Text),
int.Parse(txtstock.Text), decimal.Parse(txtamount.Text), txtpower.Text,
txtmfg.Text, txtexp.Text, rec);
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
d=d+
Convert.ToDecimal(DataGridView1.Rows[i].Cells[8].Value);

txttotalamt.Text = d.ToString();
string content = txttotalamt.Text;

string[] str = content.Split('.');

275

foreach (string word in str)


{
roundoff_amount.Text = "." + word.ToString();
}
txtnet_total.Text = (Math.Round(double.Parse(txttotalamt.Text),
0)).ToString();
}
txtstock.Text = (int.Parse(txtstock.Text) int.Parse(txtqty_issued.Text)).ToString();

}
else
{
MessageBox.Show("Cannot Transfer");
}
}
else
{
MessageBox.Show("please enter your detail");
}

}
private void cmdadd_Click(object sender, EventArgs e)
{
load_grid();

276

txtcode.Focus();
}

private void txtqty_issued_Leave(object sender, EventArgs e)


{
if (txtqty_issued.Text != "" && int.Parse(txtqty_issued.Text) != 0)
{

if (int.Parse(txtqty_issued.Text) <= int.Parse(txtstock.Text) &&


int.Parse(txtqty_issued.Text) != 0)
{
txtamount.Text = (decimal.Parse(txtactmrp.Text) *
int.Parse(txtqty_issued.Text)).ToString();
}
else
{
MessageBox.Show("Cannot Issue");
}

}
else
{
MessageBox.Show("Enter Quantity to be issued");
}

277

private void ComboBox1_DropDown(object sender, EventArgs e)


{
sql = "select Doc_Id,Doc_Name from Doctor";

ds = new DataSet();
ds = db.getDataTable(sql);
dataGridView4.DataSource = ds.Tables[0];

dataGridView4.Visible = true;
}

private void dataGridView4_Click(object sender, EventArgs e)


{
try
{
textBox1.Text =
dataGridView4.SelectedRows[0].Cells[0].Value.ToString();
ComboBox1.Text =
dataGridView4.SelectedRows[0].Cells[1].Value.ToString();
dataGridView4.Visible = false;
}
catch
{
MessageBox.Show("please select A ROW");

278

}
}
private void cmddone_Click(object sender, EventArgs e)
{
this.Close();
}
private void Cash_Sales_Bill_Only_New_Load(object sender, EventArgs e)
{

private void txtqty_issued_TextChanged(object sender, EventArgs e)


{
if (System.Text.RegularExpressions.Regex.IsMatch(txtqty_issued.Text,
"[^0-9]"))
{
MessageBox.Show("Please enter a number");
txtqty_issued.Text = "";
}
}

private void txtmname_Leave(object sender, EventArgs e)


{
prod_search();

279

private void txtpat_name_Leave(object sender, EventArgs e)


{
patient_search();
}
private void btnaccept_item_Click(object sender, EventArgs e)
{
try
{
int i = dataGridView3.Rows.IndexOf(dataGridView3.CurrentRow);
txtmname.Text =
dataGridView3.SelectedRows[0].Cells[0].Value.ToString();
txtcode.Text =
dataGridView3.SelectedRows[0].Cells[2].Value.ToString();
txttype.Text =
dataGridView3.SelectedRows[0].Cells[1].Value.ToString();
txtbatch_no.Text =
dataGridView3.SelectedRows[0].Cells[3].Value.ToString();
txtstock.Text =
dataGridView3.SelectedRows[0].Cells[4].Value.ToString();
txtpower.Text =
dataGridView3.SelectedRows[0].Cells[5].Value.ToString();
txtactmrp.Text =
dataGridView3.SelectedRows[0].Cells[6].Value.ToString();
txtmrp.Text =
dataGridView3.SelectedRows[0].Cells[7].Value.ToString();

280

txtexp.Text =
dataGridView3.SelectedRows[0].Cells[8].Value.ToString();

txtmfg.Text =
dataGridView3.SelectedRows[0].Cells[9].Value.ToString();

rec = dataGridView3.SelectedRows[0].Cells[10].Value.ToString();
dataGridView3.Visible = false;
btncan_item.Visible = false;
btnaccept_item.Visible = false;
}
catch
{
MessageBox.Show("please select a Row");
}
}

private void cmdaccept_pat_Click(object sender, EventArgs e)


{
try
{
if (patient_type == "IP")
{

int i = dataGridView2.Rows.IndexOf(dataGridView2.CurrentRow);

281

m_name.Text = dataGridView2.Rows[i].Cells[0].Value.ToString();
txtip.Text = dataGridView2.Rows[i].Cells[1].Value.ToString();
txtopd.Text = dataGridView2.Rows[i].Cells[2].Value.ToString();
txtward.Text = dataGridView2.Rows[i].Cells[3].Value.ToString();
txtbed.Text = dataGridView2.Rows[i].Cells[4].Value.ToString();
txtsex.Text = dataGridView2.Rows[i].Cells[5].Value.ToString();
txtage.Text = dataGridView2.Rows[i].Cells[6].Value.ToString();
panel1.Visible = false;
}

else if (patient_type == "OPD")


{

int i = dataGridView2.Rows.IndexOf(dataGridView2.CurrentRow);
string str = "";
string str1 =
Convert.ToString(dataGridView2.Rows[i].Cells["ip_no"].Value);
if (str == str1)
{
m_name.Text = dataGridView2.Rows[i].Cells[0].Value.ToString();

txtopd.Text = dataGridView2.Rows[i].Cells[1].Value.ToString();
txtsex.Text = dataGridView2.Rows[i].Cells[3].Value.ToString();
txtage.Text = dataGridView2.Rows[i].Cells[4].Value.ToString();

282

panel1.Visible = false;
}
else
{
MessageBox.Show("please select OPD");
}
}

else
{
MessageBox.Show("Please select a Row");
}
}
catch
{
MessageBox.Show("Please select a Row");
}
}
private void btncan_pat_detail_Click(object sender, EventArgs e)
{
txtopd.Text = "";
txtpat_name.Text = "";
txtip.Text = "";
m_name.Text = "";

283

txtbed.Text = "";
txtage.Text = "";
txtsex.Text = "";
txtward.Text = "";
panel1.Visible = false;
dataGridView2.Visible = false;
}

private void btncan_item_Click(object sender, EventArgs e)


{
txtcode.Text = "";
txtmname.Text = "";
txtbatch_no.Text = "";
txttype.Text = "";
txtqoh.Text = "";
txtamount.Text = "";
txtstock.Text = "";
txtqty_issued.Text = "";
txtpower.Text = "";
txtactmrp.Text = "";
txtmrp.Text = "";
dataGridView3.Visible = false;
}
}
}

284

Department Issue List

285

CODE OF DEPARTMENT ISSUE LIST

namespace KURJI
{
public partial class Department_Issue_List : Form
{
string sql;
database db = new database();
DataSet ds;

286

public Department_Issue_List()
{
InitializeComponent();
}
public void department_issue_list()
{
sql = "select
m.dp_issue_no,m.issue_date,d.dep_name,m.dep_id,m.net_amount,m.status
from department_issue_master m,department d where m.dep_id=d.dep_id
and issue_date between '" + datefrom.Text + "'and '" + dateto.Text + "' order
by m.dp_issue_no";
ds = new DataSet();

ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
dataGridView1.DataSource = ds.Tables[0];
txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();
decimal d = 0;
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
d=d+
Convert.ToDecimal(dataGridView1.Rows[i].Cells[4].Value);
}

287

TextBox2.Text = d.ToString();
}
else
{
MessageBox.Show("Data Not Found");
}
}
private void Department_Issue_List_Load(object sender, EventArgs e)
{

private void btnshow_Click(object sender, EventArgs e)


{
department_issue_list();
}

private void btnnew_Click(object sender, EventArgs e)


{
Department_issue_New f = new Department_issue_New();
f.Show();
}
public void display()
{
if (dataGridView1.Rows.Count > 0)

288

{
int i;
i = dataGridView1.Rows.IndexOf(dataGridView1.CurrentRow);

string bill =
dataGridView1.Rows[dataGridView1.Rows[i].Index].Cells[0].Value.ToString();
string depid =
dataGridView1.Rows[dataGridView1.Rows[i].Index].Cells[3].Value.ToString();

Department_Issue_Display f = new
Department_Issue_Display(bill, depid);
f.Show();
}
else
{
MessageBox.Show("Cannot Display");
}
}
private void btndis_Click(object sender, EventArgs e)
{
display();
}

private void btndone_Click(object sender, EventArgs e)


{

289

this.Close();
}

private void dataGridView1_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{

}
}
}

290

Department Issue New

291

292

CODE OF DEPARTMENT ISSUE NEW

namespace KURJI
{
public partial class Department_issue_New : Form
{
DataSet ds;
database db = new database();
string sql;
string str1,str2,total_receipt;
int f=0;

public Department_issue_New()
{
InitializeComponent();
txtuser_id .Text =UserAccess.C_User;
}

293

private void m_name_TextChanged(object sender, EventArgs e)


{
string str = "%" + m_name.Text + "%";
sql = "select dep_id,dep_name from department where (dep_id like '" +
str + "') or (dep_name like '" + str + "')";

ds = new DataSet();

ds = db.getDataTable(sql);

panel1.Visible = true;

dataGridView2.DataSource = ds.Tables[0];
}
private void cmdaccept_Click(object sender, EventArgs e)
{
try
{
int i = dataGridView2.Rows.IndexOf(dataGridView2.CurrentRow);
txtip.Text = dataGridView2.Rows[i].Cells[0].Value.ToString();
m_name.Text = dataGridView2.Rows[i].Cells[1].Value.ToString();
panel1.Visible = false;
}
catch
{

294

MessageBox.Show("please select a Row");


}

}
public void load_grid()
{
if (txtcode.Text != "" && txtname.Text != "" && txtqty_issued.Text != "")
{
if (((int.Parse(txtqty_issued.Text)) <= (int.Parse(txtstock.Text)) &&
(int.Parse(txtqty_issued.Text) != 0)))
{
decimal d = 0;
MessageBox.Show(total_receipt);
DataGridView1.Rows.Add(int.Parse(txtcode.Text), txtname.Text,
txttype.Text, txtbatch_no.Text, decimal.Parse(txtmrp.Text),
decimal.Parse(txtactmrp.Text), int.Parse(txtstock.Text),
int.Parse(txtqty_issued.Text), decimal.Parse(txtamount.Text), txtpower.Text,
txtmfg.Text, txtexp.Text, total_receipt);
MessageBox.Show(total_receipt);

for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)


{
d=d+
Convert.ToDecimal(DataGridView1.Rows[i].Cells[8].Value);

txttotalamt.Text = d.ToString();

295

string content = txttotalamt.Text;

string[] str = content.Split('.');

foreach (string word in str)


{

txtroundoff.Text = "." + word.ToString();

}
txtnet_total.Text = (Math.Round(double.Parse(txttotalamt.Text),
0)).ToString();
}
txtstock.Text = (int.Parse(txtstock.Text) int.Parse(txtqty_issued.Text)).ToString();

}
else
{
MessageBox.Show("Cannot Transfer");
}
}
else

296

{
MessageBox.Show("please enter your detail");
}
}

private void cmdadd_Click(object sender, EventArgs e)


{

load_grid();
}
private void cmdrecord_Click(object sender, EventArgs e)
{
if (m_name.Text != "" && txtip.Text != "" && remarks.Text != "" &&
DataGridView1 .Rows.Count >1)
{
sql = "select * from department_issue_details";
ds = new DataSet();

ds = db.getDataTable(sql);
int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

297

string str4 = ds.Tables[0].Rows[j]["dp_issue_no"].ToString();

string str1 = str4.Substring(4, 10);

string str3 = str4.Substring(0, 4);


MessageBox.Show(str3);

int l = int.Parse(str1) + 1;

MessageBox.Show(l.ToString());

txtNumber.Text = str3 + Convert.ToString(l);


for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
{
cmdcancel.Enabled = true;
sql = "insert into department_issue_details values('" +
txtNumber.Text + "'," + DataGridView1.Rows[i].Cells["Material_Code"].Value + ",'"
+ DataGridView1.Rows[i].Cells["Batch"].Value + "'," +
DataGridView1.Rows[i].Cells["issqty"].Value + "," +
DataGridView1.Rows[i].Cells["Amount"].Value + ",'" +
DataGridView1.Rows[i].Cells["receipt_no"].Value + "')";

db.ExecuteOrcl(sql);

298

sql = "insert into


department_issue_master(Dp_ISSUE_NO,issue_Date,Remarks,issued_by,Total_a
mount,Roundoff_amount,Net_amount,status,dep_id)values('" + txtNumber.Text
+ "','" + txtdate.Text + "','" + remarks.Text + "','" + txtuser_id.Text + "'," +
decimal.Parse(txttotalamt.Text) + "," + decimal.Parse(txtroundoff.Text) + "," +
decimal.Parse(txtnet_total.Text) + ",'ISSUE','" + txtip.Text + "')";

db.ExecuteOrcl(sql);
MessageBox.Show("The following Product Having Invoice No." +
txtip.Text + " has been succesfully added as New Purchase");
cmdrecord.Enabled = false;

}
else
{

txtNumber.Text = "DPIS1400000001";
for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
{
cmdcancel.Enabled = true;
sql = "insert into department_issue_details values('" +
txtNumber.Text + "'," + DataGridView1.Rows[i].Cells["material_code"].Value + ",'"

299

+ DataGridView1.Rows[i].Cells["batch"].Value + "'," +
DataGridView1.Rows[i].Cells["issqty"].Value + "," +
DataGridView1.Rows[i].Cells["Amount"].Value + ",'" +
DataGridView1.Rows[i].Cells["receipt_no"].Value + "')";

db.ExecuteOrcl(sql);
}

sql = "insert into


department_issue_master(Dp_ISSUE_NO,issue_Date,Remarks,issued_by,Total_a
mount,Roundoff_amount,Net_amount,status,dep_id)values('" + txtNumber.Text
+ "','" + txtdate.Text + "','" + remarks.Text + "','" + txtuser_id.Text + "'," +
decimal.Parse(txttotalamt.Text) + "," + decimal.Parse(txtroundoff.Text) + "," +
decimal.Parse(txtnet_total.Text) + ",'ISSUE','" + txtip.Text + "')";
db.ExecuteOrcl(sql);

}
update_sales();
}
else
{
MessageBox.Show("please enter your detail");
}
}
public void update_sales()
{
Int32 sqty = 0;

300

for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)


{
sqty =
Convert.ToInt32(DataGridView1.Rows[i].Cells["stock_qty"].Value) Convert.ToInt32(DataGridView1.Rows[i].Cells["issqty"].Value);
sql = "update sales_stock set total_qty= " + sqty + " where p_id= " +
DataGridView1.Rows[i].Cells["Material_Code"].Value + " and batch= '" +
DataGridView1.Rows[i].Cells["Batch"].Value + "'";

db.ExecuteOrcl(sql);
}
}
public void cal_amount()
{
if (txtqty_issued.Text != "" && int.Parse(txtqty_issued.Text) != 0)
{

if (int.Parse(txtqty_issued.Text) <= int.Parse(txtstock.Text) &&


int.Parse(txtqty_issued.Text) != 0)
{
txtamount.Text = (decimal.Parse(txtactmrp.Text) *
int.Parse(txtqty_issued.Text)).ToString();
}
else
{
MessageBox.Show("Cannot Issue");
}

301

}
else
{
MessageBox.Show("Enter Quantity to be issued");
}
}
private void txtqty_issued_Leave(object sender, EventArgs e)
{
cal_amount();

}
private void txtqty_issued_TextChanged(object sender, EventArgs e)
{
if (Regex.IsMatch(txtqty_issued.Text, "[^0-9]"))
{
MessageBox.Show("please enter a number");
txtqty_issued.Text = "";

}
private void textBox5_Leave(object sender, EventArgs e)
{
string str = txtname.Text + "%";

302

sql = "select
p.p_nm,p.p_type,s.p_id,s.batch,s.total_qty,p.power,pr.ACTUAL_MRP_UNIT,pr.mr
p_unit,pr.exp,pr.mfg,s.receipt_no from product p,sales_stock s,purchase_detail
pr where p.p_id=s.p_id and s.p_id=pr.p_id and s.batch=pr.batch and
s.receipt_no=pr.receipt_no and p.p_nm like '" + str + "'";

ds = new DataSet();
ds = db.getDataTable(sql);
dataGridView3.Visible = true;
btncanitem.Visible = true;
btnacceptitem.Visible = true;
dataGridView3.DataSource = ds.Tables[0];
}
private void cmddone_Click(object sender, EventArgs e)
{
this.Close();
}

private void Department_issue_New_Load(object sender, EventArgs e)


{

private void btncandep_Click(object sender, EventArgs e)


{
m_name.Text = "";

303

txtip.Text = "";
panel1.Visible = false;
}

private void btncanitem_Click(object sender, EventArgs e)


{
txtname.Text = "";
txtcode.Text = "";
dataGridView3.Visible = false;
btncanitem.Visible = false;
btnacceptitem.Visible = false;
}

private void btnacceptitem_Click(object sender, EventArgs e)


{
try
{
int i = 0;
i = dataGridView3.Rows.IndexOf(dataGridView3.CurrentRow);
txtname.Text =
dataGridView3.SelectedRows[0].Cells[0].Value.ToString();
txttype.Text =
dataGridView3.SelectedRows[0].Cells[1].Value.ToString();
txtcode.Text =
dataGridView3.SelectedRows[0].Cells[2].Value.ToString();

304

txtbatch_no.Text =
dataGridView3.SelectedRows[0].Cells[3].Value.ToString();
txtstock.Text =
dataGridView3.SelectedRows[0].Cells[4].Value.ToString();
txtpower.Text =
dataGridView3.SelectedRows[0].Cells[5].Value.ToString();
txtactmrp.Text =
dataGridView3.SelectedRows[0].Cells[6].Value.ToString();
txtmrp.Text =
dataGridView3.SelectedRows[0].Cells[7].Value.ToString();
txtexp.Text =
dataGridView3.SelectedRows[0].Cells[8].Value.ToString();
txtmfg.Text =
dataGridView3.SelectedRows[0].Cells[9].Value.ToString();
MessageBox.Show(dataGridView3.SelectedRows[0].Cells[10].Value.ToString());
total_receipt =
dataGridView3.SelectedRows[0].Cells[10].Value.ToString();
dataGridView3.Visible = false;
btncanitem.Visible = false;
btnacceptitem.Visible = false;
}
catch
{
MessageBox.Show("please select a Row");
}
}
}

305

306

Ip Issue List

307

308

CODE OF INPATIENT ISSUE LIST

namespace KURJI
{
public partial class Ip_Issue_Lists : Form
{
database db = new database();
public Ip_Issue_Lists()
{
InitializeComponent();
}
public void list()
{
string sql = "select
m.ip_issue_no,p.Pat_name,m.issue_date,m.net_amount,a.opd_no,m.ip_no from
Inpatient_issue_master m,Patient_Detail p,Admission_Detail a where
a.opd_no=p.opd_no and issue_date between '" + datefrom.Text + "'and'" +
dateto.Text + "'";
DataSet ds = new DataSet();
ds = db.getDataTable(sql);

309

int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
dataGridView1.DataSource = ds.Tables[0];
txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();
decimal d = 0;
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
d = d + Convert.ToDecimal(dataGridView1.Rows[i].Cells[3].Value);
}
TxtTotalAmt.Text = d.ToString();
}
else
{
MessageBox.Show("Data Not Found");
}

}
private void Showbtn_Click(object sender, EventArgs e)
{
list();
}

private void Displaybtn_Click(object sender, EventArgs e)

310

{
if (dataGridView1.Rows.Count > 0)
{

int i;
i = dataGridView1.Rows.IndexOf(dataGridView1.CurrentRow);

string str1 =
dataGridView1.Rows[dataGridView1.Rows[i].Index].Cells[0].Value.ToString();

MessageBox.Show(str1);
Inpatient_Issue_Display f = new Inpatient_Issue_Display(str1);
f.Show();
}
else
{
MessageBox.Show("Cannot Display, First Show Records");
}

private void btnnew_Click(object sender, EventArgs e)


{

311

Inpatient_Issue_New k = new Inpatient_Issue_New();


k.Show();
}

private void Ip_Issue_Lists_Load(object sender, EventArgs e)


{

private void Donebtn_Click(object sender, EventArgs e)


{
this.Close();
}

}
}

312

Ip Issue New

313

CODE OF INPATIENT ISSUE NEW

namespace KURJI
{
public partial class Inpatient_Issue_New : Form
{
string sql;
database db=new database();
DataSet ds;
string rec,str1;

public Inpatient_Issue_New()
{
InitializeComponent();

314

txtuser_id.Text = UserAccess.C_User;
}
private void TextBox7_TextChanged(object sender, EventArgs e)
{
string str = "%"+ m_name.Text + "%";

sql = "select p.pat_name,a.ip_no,a.ward_no,a.bed,p.sex,p.age from


ADMISSION_DETAIL a,PATIENT_DETAIL p where a.opd_no=p.opd_no and
p.pat_name like '"+str+"'";
ds = new DataSet();

ds = db.getDataTable(sql);
panel1.Visible = true;
dataGridView2.DataSource = ds.Tables[0];

}
private void cmdaccept_Click_1(object sender, EventArgs e)
{
try
{
int i = dataGridView2.Rows.IndexOf(dataGridView2.CurrentRow);
m_name.Text = dataGridView2.Rows[i].Cells[0].Value.ToString();
txtip.Text = dataGridView2.Rows[i].Cells[1].Value.ToString();
txtward.Text = dataGridView2.Rows[i].Cells[2].Value.ToString();
txtbed.Text = dataGridView2.Rows[i].Cells[3].Value.ToString();
txtsex.Text = dataGridView2.Rows[i].Cells[4].Value.ToString();

315

txtage.Text = dataGridView2.Rows[i].Cells[5].Value.ToString();
panel1.Visible = false;
}
catch
{
MessageBox.Show("please select a Row ");

}
}
private void button2_Click_1(object sender, EventArgs e)
{
try
{
int i = 0;
i = dataGridView3.Rows.IndexOf(dataGridView3.CurrentRow);
txtname.Text =
dataGridView3.SelectedRows[0].Cells[0].Value.ToString();
txttype.Text =
dataGridView3.SelectedRows[0].Cells[1].Value.ToString();
txtcode.Text =
dataGridView3.SelectedRows[0].Cells[2].Value.ToString();
txtbatch_no.Text =
dataGridView3.SelectedRows[0].Cells[3].Value.ToString();
txtstock.Text =
dataGridView3.SelectedRows[0].Cells[4].Value.ToString();
txtpower.Text =
dataGridView3.SelectedRows[0].Cells[5].Value.ToString();

316

txtactmrp.Text =
dataGridView3.SelectedRows[0].Cells[6].Value.ToString();
txtmrp.Text =
dataGridView3.SelectedRows[0].Cells[7].Value.ToString();
txtexp.Text =
dataGridView3.SelectedRows[0].Cells[8].Value.ToString();
txtmfg.Text =
dataGridView3.SelectedRows[0].Cells[9].Value.ToString();
rec = dataGridView3.SelectedRows[0].Cells[10].Value.ToString();
dataGridView3.Visible = false;
button1.Visible = false;
button2.Visible = false;
}
catch
{
MessageBox.Show("please select a Row");

private void txtqty_issued_Leave(object sender, EventArgs e)


{
if (txtqty_issued.Text != "" && int.Parse (txtqty_issued .Text)!=0)
{

317

if (int.Parse(txtqty_issued.Text) <= int.Parse(txtstock.Text) &&


int.Parse(txtqty_issued.Text) != 0)
{
txtamount.Text = (decimal.Parse(txtactmrp.Text) *
int.Parse(txtqty_issued.Text)).ToString();
}
else
{
MessageBox.Show("Cannot Issue");
}

}
else
{
MessageBox.Show("Enter Quantity to be issued");
}

private void cmdadd_Click(object sender, EventArgs e)


{

if (txtname.Text != "" && txtcode .Text!="" && txtqty_issued.Text !="")


{
if (((int.Parse(txtqty_issued.Text)) <= (int.Parse(txtstock.Text)) &&
(int.Parse(txtqty_issued.Text) != 0)))

318

{
decimal d = 0;
MessageBox.Show(str1);
DataGridView1.Rows.Add(int.Parse(txtcode.Text), txtname.Text,
txttype.Text, txtbatch_no.Text, decimal.Parse(txtmrp.Text),
decimal.Parse(txtactmrp.Text), int.Parse(txtqty_issued.Text),
int.Parse(txtstock.Text), decimal.Parse(txtamount.Text), txtpower.Text,
txtmfg.Text, txtexp.Text, rec);
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
d=d+
Convert.ToDecimal(DataGridView1.Rows[i].Cells[8].Value);

txttotalamt.Text = d.ToString();
string content = txttotalamt.Text;

string[] str = content.Split('.');

foreach (string word in str)


{
roundoff_amount.Text = "." + word.ToString();
}
txtnet_total.Text = (Math.Round(double.Parse(txttotalamt.Text),
0)).ToString();
}
txtstock.Text = (int.Parse(txtstock.Text) int.Parse(txtqty_issued.Text)).ToString();

319

}
else
{
MessageBox.Show("Cannot Transfer");
}

}
else
{
MessageBox.Show("please enter your detail");
}
}
private void cmdrecord_Click_1(object sender, EventArgs e)
{
if (txtremark.Text != "" && m_name.Text != "" && txtdate.Text != "" &&
txtdoc_id.Text != "" && DataGridView1.Rows.Count > 1)
{

insert_ip_issue();
update_sales();
}
else
{

320

MessageBox.Show("please enter your detail");


}
}

public void update_sales()


{
Int32 sqty = 0;
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
sqty = Convert.ToInt32(DataGridView1.Rows[i].Cells["stockqty"].Value)
- Convert.ToInt32(DataGridView1.Rows[i].Cells["issqty"].Value);
sql = "update sales_stock set total_qty= " + sqty + " where p_id= " +
DataGridView1.Rows[i].Cells["Material_Code"].Value + " and batch= '" +
DataGridView1.Rows[i].Cells["Batch"].Value + "'";
db.ExecuteOrcl(sql);
}
}
public void insert_ip_issue()
{
sql = "select * from inpatient_issue_detail";
ds = new DataSet();

ds = db.getDataTable(sql);
int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

321

if (p > 0)
{

string str4 = ds.Tables[0].Rows[j]["ip_issue_no"].ToString();

string str1 = str4.Substring(4, 10);

string str3 = str4.Substring(0, 4);


MessageBox.Show(str3);

int l = int.Parse(str1) + 1;

MessageBox.Show(l.ToString());

txtNumber.Text = str3 + Convert.ToString(l);


for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
cmdcancel.Enabled = true;
sql = "insert into inpatient_issue_detail values('" +
txtNumber.Text + "'," + DataGridView1.Rows[i].Cells["Material_Code"].Value + ",'"
+ DataGridView1.Rows[i].Cells["Batch"].Value + "'," +
DataGridView1.Rows[i].Cells["issqty"].Value + "," +
DataGridView1.Rows[i].Cells["Amount"].Value + ",'" +
DataGridView1.Rows[i].Cells["receipt_no"].Value + "')";

322

db.ExecuteOrcl(sql);

sql = "insert into


inpatient_issue_master(ip_issue_no,issue_Date,ip_no,Prescribed_by,Remarks,iss
ued_by,Total_amount,Roundoff_amount,Net_amount,status)values('" +
txtNumber.Text + "','" + txtdate.Text + "','" + txtip.Text + "','" + txtdoc_id.Text + "','"
+ txtremark.Text + "','" + txtuser_id.Text + "'," + decimal.Parse(txttotalamt.Text) +
"," + decimal.Parse(roundoff_amount.Text) + "," +
decimal.Parse(txtnet_total.Text) + ",'ISSUE' )";

db.ExecuteOrcl(sql);
MessageBox.Show("The following Product Having Invoice No." +
txtip.Text + " has been succesfully added as New Purchase");
cmdrecord.Enabled = false;

}
else
{

txtNumber.Text = "IPIS1400000001";

323

for (int i = 0; i < DataGridView1.Rows.Count; i++)


{
cmdcancel.Enabled = true;
sql = "insert into inpatient_issue_detail values('" +
txtNumber.Text + "'," + DataGridView1.Rows[i].Cells["Material_Code"].Value + ",'"
+ DataGridView1.Rows[i].Cells["Batch"].Value + "'," +
DataGridView1.Rows[i].Cells["issqty"].Value + "," +
DataGridView1.Rows[i].Cells["Amount"].Value + ",'" +
DataGridView1.Rows[i].Cells["receipt_no"].Value + "')";

db.ExecuteOrcl(sql);

sql = "insert into


inpatient_issue_master(ip_issue_no,issue_Date,ip_no,Prescribed_by,Remarks,iss
ued_by,Total_amount,Roundoff_amount,Net_amount,status)values('" +
txtNumber.Text + "','" + txtdate.Text + "','" + txtip.Text + "','" +txtdoc_id.Text+"','"+
txtremark.Text + "','" + txtuser_id.Text + "'," + decimal.Parse(txttotalamt.Text) +
"," + decimal.Parse(roundoff_amount.Text) + "," +
decimal.Parse(txtnet_total.Text) + ",'ISSUE' )";
db.ExecuteOrcl(sql);

}
}

private void cmddone_Click(object sender, EventArgs e)


{

324

this.Close();
}
private void txtname_Leave(object sender, EventArgs e)
{
string str = txtname.Text + "%";
sql = "select
p.p_nm,p.p_type,s.p_id,s.batch,s.total_qty,p.power,pr.ACTUAL_MRP_UNIT,pr.mr
p_unit,pr.exp,pr.mfg,s.receipt_no from product p,sales_stock s,purchase_detail
pr where p.p_id=s.p_id and s.p_id=pr.p_id and s.batch=pr.batch and
s.receipt_no=pr.receipt_no and p.p_nm like '" + str + "'";

ds = new DataSet();
ds = db.getDataTable(sql);
dataGridView3.Visible = true;
button1.Visible = true;
button2.Visible = true;
dataGridView3.DataSource = ds.Tables[0];
}

private void ComboBox1_DropDown(object sender, EventArgs e)


{
sql = "select Doc_Id,Doc_Name from Doctor";

ds = new DataSet();
ds = db.getDataTable(sql);

325

dataGridView4.DataSource = ds.Tables[0];

dataGridView4.Visible = true;
}

private void dataGridView4_Click(object sender, EventArgs e)


{
try
{
txtdoc_id.Text =
dataGridView4.SelectedRows[0].Cells[0].Value.ToString();
cmbdoc_name.Text =
dataGridView4.SelectedRows[0].Cells[1].Value.ToString();
dataGridView4.Visible = false;
}
catch
{
MessageBox.Show("Please Select a Row");
}
}

private void Inpatient_Issue_New_Load(object sender, EventArgs e)


{

}
}

326

327

Inpatient Return List

328

329

CODE OF INPATIENT RETURN LIST

namespace KURJI
{
public partial class Inpatient_Return_Lists : Form
{
string sql;
database db = new database();
DataSet ds;

public Inpatient_Return_Lists()
{
InitializeComponent();

}
public void list()
{

330

sql = "select
m.Ip_return_no,ipm.ip_no,m.ip_issue_no,m.net_amount,m.return_date from
Ip_Return_master m,Inpatient_Issue_Master ipm where
ipm.ip_issue_no=m.ip_issue_no and m.return_date between'" + datefrom.Text +
"' and '" +dateto.Text + "'order by m.ip_return_no ";

ds = new DataSet();
ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
DataGridView1.DataSource = ds.Tables[0];
txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();
decimal d = 0;
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
d = d + Convert.ToDecimal(DataGridView1.Rows[i].Cells[3].Value);
}
txttotal_amount.Text = d.ToString();
}
else
{
MessageBox.Show("Data Not Found");
}
}

331

private void btnshow_Click(object sender, EventArgs e)


{
list();
}

private void btnnew_Click(object sender, EventArgs e)


{
Inpatient_Return_New f = new Inpatient_Return_New();
f.Show();
}

private void btndisplay_Click(object sender, EventArgs e)


{

if (DataGridView1.Rows.Count > 0)
{

int i;
i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);

string str1 =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells[0].Value.ToString();

Inpatient_Return_Display f = new Inpatient_Return_Display(str1);

332

f.Show();
}
else
{
MessageBox.Show("Cannot Display, First Show Records");
}

}
private void txtbill_Leave(object sender, EventArgs e)
{
sql = "select
m.Ip_return_no,ipm.ip_issue_no,m.net_amount,m.return_date,ipm.ip_no from
Inpatient_issue_Master ipm,Ip_Return_master m where
m.ip_issue_no=ipm.ip_issue_no and m.ip_issue_no='"+txtbill.Text+"'";

ds = new DataSet();
ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
MessageBox.Show(c.ToString());
if (c > 0)
{
DataGridView1.DataSource = ds.Tables[0];
}
else
{
MessageBox.Show("No Record Found");

333

}
private void Inpatient_Return_Lists_Load(object sender, EventArgs e)
{

}
}
}

334

Inpatient Return New

335

336

CODE OF INPATIENT RETURN NEW

namespace KURJI
{
public partial class Inpatient_Return_New : Form
{
string sql;
database db=new database();

DataSet ds1;
DataSet ds = new DataSet();
int f = 0,amt=0;
decimal s = 0;

public Inpatient_Return_New()
{
InitializeComponent();
}

337

public void search_bill()


{
sql = "select
m.ip_no,ad.opd_no,p.pat_name,p.sex,p.age,ad.ward_no,ad.bed,m.issued_by,m.t
otal_amount,m.roundoff_amount,m.net_amount from Patient_Detail
p,Admission_Detail ad,Inpatient_Issue_Master m where m.ip_no=ad.ip_no and
p.ip_no=m.ip_no and m.ip_issue_no='" + txtbill_number.Text + "'";
ds = new DataSet();
ds = db.getDataTable(sql);
int i = ds.Tables[0].Rows.Count;
if (i > 0)
{
MessageBox.Show("In");
txtip.Text = ds.Tables[0].Rows[0]["ip_no"].ToString();
txtopd.Text = ds.Tables[0].Rows[0]["opd_no"].ToString();
txtward.Text = ds.Tables[0].Rows[0]["ward_no"].ToString();
txtage.Text = ds.Tables[0].Rows[0]["age"].ToString();
txtpname.Text = ds.Tables[0].Rows[0]["pat_name"].ToString();
txtsex.Text = ds.Tables[0].Rows[0]["sex"].ToString();
txtuser_id.Text = ds.Tables[0].Rows[0]["issued_by"].ToString();
txttotal_amount.Text = ds.Tables[0].Rows[0]
["total_amount"].ToString();
txtrdf_amount.Text = ds.Tables[0].Rows[0]
["roundoff_amount"].ToString();
txtnet_amount.Text = ds.Tables[0].Rows[0]["net_amount"].ToString();

338

txtbed.Text = ds.Tables[0].Rows[0]["bed"].ToString();
sql = "select
p.p_nm,d.p_id,d.batch,d.qty_issued,p.p_type,p.power,pr.mrp_unit,pr.actual_mrp
_unit,pr.mfg,pr.exp,d.amount,pr.receipt_no from Product p,Purchase_Detail
pr,Inpatient_Issue_Detail d where p.p_id=d.p_id and pr.p_id=d.p_id and
pr.batch=d.batch and pr.receipt_no=d.receipt_no and d.ip_issue_no='" +
txtbill_number.Text + "'";
ds = new DataSet();
ds = db.getDataTable(sql);
DataGridView1.DataSource = ds.Tables[0];

}
else
{
MessageBox.Show("Incorrect Bill");
}
}
private void txtbill_number_Leave(object sender, EventArgs e)
{
search_bill();
}

private void btnrecord_Click(object sender, EventArgs e)


{

if (txtbill_number.Text == "")
{

339

MessageBox.Show("Please Enter Bill Number");


}
else if (txtremarks.Text == "")
{
MessageBox.Show("Please Enter Remarks");
}
else
{
sql = "select p_id,batch,total_qty from sales_stock";
ds1 = new DataSet();

ds1 = db.getDataTable(sql);
int c = ds1.Tables[0].Rows.Count;
MessageBox.Show(c.ToString());

if (c > 0)
{
s = 0;
sql = "Select ip_return_no from Ip_RETURN_MASTER order by
ip_return_no";

ds = new DataSet();

ds = db.getDataTable(sql);

340

int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

string str4 = ds.Tables[0].Rows[j]["ip_return_no"].ToString();


MessageBox.Show(str4);

string str1 = str4.Substring(4, 10);

string str3 = str4.Substring(0, 4);


MessageBox.Show(str3);

int l = int.Parse(str1) + 1;

MessageBox.Show(l.ToString());

txtNumber.Text = str3 + Convert.ToString(l);


update_stock(c);

341

else
{
txtNumber.Text = "IPRN1400000001";
update_stock(c);
}
}

public void cal_amount()


{
int qty = 0, i = 0;
try
{
i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);
DataGridView1.Rows[i].Cells[1].Value = "";
if (Regex.IsMatch(DataGridView1.Rows[i].Cells[0].Value.ToString(),
"[^0-9]"))
{
MessageBox.Show("please enter a number");
DataGridView1.Rows[i].Cells[0].Value = "";

342

}
else
{
MessageBox.Show("Hello");
qty = Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value);
if (qty > 0 && qty <=
Convert.ToInt32(DataGridView1.Rows[i].Cells[5].Value))
{

decimal d =
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value) *
Convert.ToDecimal(DataGridView1.Rows[i].Cells["actual_mrp_unit"].Value);
DataGridView1.Rows[i].Cells[1].Value = d;

decimal sum = 0;
for (int c = 0; c < DataGridView1.Rows.Count - 1; c++)
{

if (Convert.ToString(DataGridView1.Rows[c].Cells[1].Value) !=
"")
{
sum = sum +
Convert.ToDecimal(DataGridView1.Rows[c].Cells[1].Value);
MessageBox.Show(sum.ToString());

343

}
txttotal_amount.Text = sum.ToString();
string content = sum.ToString();

string[] str = content.Split('.');

foreach (string word in str)


{

txtrdf_amount.Text = "." + word.ToString();

}
txtnet_amount.Text = Math.Round(double.Parse(sum.ToString()),
0).ToString();
txttotal_amount.Text = sum.ToString();
}
else
{
MessageBox.Show("Cannot Return This much Quantity");
DataGridView1.Rows[i].Cells[0].Value = "";
DataGridView1.Rows[i].Cells[0].Value = "";
}
}
}

344

catch (Exception ex)


{
MessageBox.Show(ex.ToString());
}
}
private void DataGridView1_CellLeave(object sender,
DataGridViewCellEventArgs e)
{
cal_amount();
}
public void update_stock(int c)
{
for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
{
MessageBox.Show("For Loop1");
MessageBox.Show(c.ToString());
for (int x = 0; x < c; x++)
{
MessageBox.Show("For Loop2");
Int32 pid = Convert.ToInt32(ds1.Tables[0].Rows[x]["p_id"]);
string batch = Convert.ToString(ds1.Tables[0].Rows[x]["batch"]);
Int32 qty = Convert.ToInt32(ds1.Tables[0].Rows[x]["total_qty"]);
MessageBox.Show(qty.ToString());

string st = Convert.ToString(DataGridView1.Rows[i].Cells[0].Value);

345

string str1 =
Convert.ToString(DataGridView1.Rows[i].Cells[1].Value);
MessageBox.Show(st);
MessageBox.Show(str1);

if (Convert.ToString(DataGridView1.Rows[i].Cells[0].Value) != "" &&


Convert.ToString(DataGridView1.Rows[i].Cells[1].Value) != "")
{
MessageBox.Show("hai");
amt = 1;
string stbatch =
Convert.ToString(DataGridView1.Rows[i].Cells[4].Value);
MessageBox.Show(batch + pid);
if ((pid == Convert.ToInt32(DataGridView1.Rows[i].Cells[3].Value)
&& (stbatch == batch)))
{
f = 1;
s=s+
Convert.ToDecimal(DataGridView1.Rows[i].Cells[1].Value);
MessageBox.Show(s.ToString());
sql = "insert into
Ip_Return_Detail(ip_return_no,p_id,batch,return_qty,receipt_no,total_amount)
values('" + txtNumber.Text + "'," +
Convert.ToInt32(DataGridView1.Rows[i].Cells[3].Value) + ",'" +
DataGridView1.Rows[i].Cells[4].Value + "'," +
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value) + ",'" +
DataGridView1.Rows[i].Cells[13].Value + "'," +
Convert.ToDecimal(DataGridView1.Rows[i].Cells[1].Value) + ")";
db.ExecuteOrcl(sql);

346

qty = qty +
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value);
MessageBox.Show(qty.ToString());
sql = "update sales_stock set total_qty=" + qty + " where
p_id=" + pid + "and batch='" + batch + "'";
db.ExecuteOrcl(sql);
}

}
}

}
if (amt == 1)
{
MessageBox.Show("Hello Master");

txttotal_amount.Text = s.ToString();
txtnet_amount.Text = s.ToString();
sql = "insert into
Ip_return_master(ip_return_no,return_date,user_id,remarks,total_amount,roun
doff_amount,net_amount,ip_issue_no) values('" + txtNumber.Text + "','" +
txtdate.Text + "','" + txtuser_id.Text + "','" + txtremarks.Text + "'," +
decimal.Parse(txttotal_amount.Text) + "," + decimal.Parse(txtrdf_amount.Text) +
"," + decimal.Parse(txtnet_amount.Text) + ",'" + txtbill_number.Text + "')";

db.ExecuteOrcl(sql);
}

347

}
private void Inpatient_Return_New_Load(object sender, EventArgs e)
{

private void btndone_Click(object sender, EventArgs e)


{
this.Close();
}

348

Department Return List

349

350

CODE OF DEPARTMENT RETURN LIST

namespace KURJI
{
public partial class Department_Return_List : Form
{
database db = new database();
public Department_Return_List()
{
InitializeComponent();
}

351

public void show_list()


{
string sql = "select
d.dep_name,m.dep_id,m.dp_return_no,m.dp_return_date,dm.dp_issue_no,m.tot
al_amount from Department_Return_Master m,Department
d,Department_Issue_Master dm where m.dep_id=d.dep_id and
dm.dp_issue_no=m.dp_issue_no and m.dp_return_date between'" + txtfrom.Text
+ "'and'" + txtto.Text + "' order by m.dp_return_no";
DataSet ds = new DataSet();
ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;

if (c > 0)
{
DataGridView1.DataSource = ds.Tables[0];
bill_no_from.Text = ds.Tables[0].Rows[0][2].ToString();
bill_no_to .Text = ds.Tables[0].Rows[c - 1][2].ToString();
decimal d = 0;
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
d = d + Convert.ToDecimal(DataGridView1.Rows[i].Cells[5].Value);
}
txttotal_amount.Text = d.ToString();
}
else
{
MessageBox.Show("Data Not Found");

352

}
}
private void btnshow_Click(object sender, EventArgs e)
{

show_list();
}
private void Department_Return_List_Load(object sender, EventArgs e)
{

}
public void bill_search()
{
string sql = "select
d.dep_name,m.dep_id,m.dp_return_no,m.dp_return_date,dm.dp_issue_no,m.tot
al_amount,dm.dp_issue_no from Department_Return_Master m,Department
d,Department_Issue_Master dm where m.dep_id=d.dep_id and
dm.dp_issue_no=m.dp_issue_no and dm.dp_issue_no='" + txtbill.Text + "' order
by m.dp_return_no";

DataSet ds = new DataSet();


ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
DataGridView1.DataSource = ds.Tables[0];
bill_no_from.Text = (ds.Tables[0].Rows[0][2]).ToString();

353

bill_no_to.Text= (ds.Tables[0].Rows[c - 1][2]).ToString();


decimal d = 0;
for (int i = 0; i < DataGridView1.Rows.Count; i++)
{
d = d + Convert.ToDecimal(DataGridView1.Rows[i].Cells[5].Value);
}
txttotal_amount.Text = d.ToString();
}
else
{
MessageBox.Show(" No Record Found");
}
}
private void txtbill_Leave(object sender, EventArgs e)
{
bill_search();
}

private void btndone_Click(object sender, EventArgs e)


{
this.Close();
}

private void btnnew_Click(object sender, EventArgs e)


{

354

Department_Return_New f = new Department_Return_New();


f.Show();
}

private void btndisplay_Click(object sender, EventArgs e)


{
if (DataGridView1.Rows.Count > 0)
{
int i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);

string bill =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells[2].Value.ToString();
string depid =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells[1].Value.ToString();
Department_Return_Display f = new Department_Return_Display(bill,
depid);
f.Show();
}
else
{
MessageBox.Show("Cannot Display, First Show Records");
}
}
}
}

355

Department Return New

356

357

CODE OF DEPARTMENT RETURN NEW

namespace KURJI
{
public partial class Department_Return_New : Form
{
string str, sql;
database db = new database();

DataSet ds,ds1;
int f=0,c=0;
decimal s;
public Department_Return_New()
{
InitializeComponent();
txtuser_id.Text = UserAccess.C_User;

358

public void search_bill()


{
sql = "select
m.dep_id,d.dep_name,m.total_amount,m.roundoff_amount,m.net_amount from
Department d,Department_issue_Master m where m.dep_id=d.dep_id and
m.dp_issue_no='" + txtbill_number.Text + "'";

ds = new DataSet();
ds = db.getDataTable(sql);
int i = ds.Tables[0].Rows.Count;
if (i > 0)
{
txtdep_id.Text = ds.Tables[0].Rows[0][0].ToString();
txtdep_name.Text = ds.Tables[0].Rows[0][1].ToString();
txttotal_amount.Text = ds.Tables[0].Rows[0][2].ToString();
txtrdf_amount.Text = ds.Tables[0].Rows[0][3].ToString();
txtnet_amount.Text = ds.Tables[0].Rows[0][4].ToString();

sql = "select
p.p_nm,p.p_id,p.p_type,p.power,d.batch,d.qty_issued,d.amount,pr.mfg,pr.exp,pr
.mrp_unit,pr.actual_mrp_unit,pr.receipt_no from product p,purchase_detail
pr,department_issue_details d where p.p_id=d.p_id and d.p_id=pr.p_id and
d.batch=pr.batch and d.receipt_no=pr.receipt_no and d.dp_issue_no='" +
txtbill_number.Text + "'";

ds = new DataSet();

359

ds = db.getDataTable(sql);
DataGridView1.DataSource = ds.Tables[0];
}
else
{
MessageBox.Show("Incorrect Bill Number");
}
}
private void txtbill_number_Leave(object sender, EventArgs e)
{
search_bill();
}

public void insert_and_updatestock()


{
for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
{

for (int x = 0; x < c; x++)


{
Int32 pid = Convert.ToInt32(ds1.Tables[0].Rows[x]["p_id"]);
string batch = Convert.ToString(ds1.Tables[0].Rows[x]["batch"]);
Int32 qty = Convert.ToInt32(ds1.Tables[0].Rows[x]["total_qty"]);
MessageBox.Show(qty.ToString());

360

if (Convert.ToString(DataGridView1.Rows[i].Cells[1].Value) != "")
{
string stbatch =
Convert.ToString(DataGridView1.Rows[i].Cells[6].Value);
MessageBox.Show(batch + pid);
if ((pid == Convert.ToInt32(DataGridView1.Rows[i].Cells[3].Value)
&& (stbatch == batch)))
{
f = 1;
s=s+
Convert.ToDecimal(DataGridView1.Rows[i].Cells[1].Value);
MessageBox.Show("From OPD");
MessageBox.Show(s.ToString());
sql = "insert into
Department_Return_Detail(dp_return_no,p_id,batch,return_qty,receipt_no,total_
amount) values('" + txtNumber.Text + "'," +
Convert.ToInt32(DataGridView1.Rows[i].Cells[3].Value) + ",'" +
DataGridView1.Rows[i].Cells[6].Value + "'," +
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value) + ",'" +
DataGridView1.Rows[i].Cells[13].Value + "'," +
Convert.ToDecimal(DataGridView1.Rows[i].Cells[1].Value) + ")";

db.ExecuteOrcl(sql);
qty = qty +
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value);
MessageBox.Show(qty.ToString());
sql = "update sales_stock set total_qty=" + qty + " where
p_id=" + pid + "and batch='" + batch + "'";

361

db.ExecuteOrcl(sql);

}
}

}
MessageBox.Show(s.ToString());
txttotal_amount.Text = s.ToString();
txtnet_amount.Text = s.ToString();
sql = "insert into
department_return_master(dp_return_no,dp_return_date,remarks,total_amount
,roundoff_amount,net_amount,user_id,dep_id,dp_issue_no) values('" +
txtNumber.Text + "','" + txtdate.Text + "','" + txtremarks.Text + "'," +
decimal.Parse(txttotal_amount.Text) + "," + decimal.Parse(txtrdf_amount.Text) +
"," + decimal.Parse(txtnet_amount.Text) + ",'" + txtuser_id.Text + "','" +
txtdep_id.Text + "','" + txtbill_number.Text + "')";

db.ExecuteOrcl(sql);

}
private void DataGridView1_CellLeave(object sender,
DataGridViewCellEventArgs e)
{
int qty=0;

362

try
{
int i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);
DataGridView1.Rows[i].Cells[1].Value = "";
if
(Regex.IsMatch(DataGridView1.Rows[i].Cells[0].Value.ToString(),"[^0-9]"))
{
MessageBox.Show("please enter a number");
DataGridView1.Rows[i].Cells[0].Value = "";

}
else
{
MessageBox.Show("Hello");
qty = Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value);
if (qty > 0 && qty <=
Convert.ToInt32(DataGridView1.Rows[i].Cells[7].Value))
{

decimal d =
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value) *
Convert.ToDecimal(DataGridView1.Rows[i].Cells["actual_mrp_unit"].Value);
DataGridView1.Rows[i].Cells[1].Value = d;

decimal sum = 0;
for (int c = 0; c < DataGridView1.Rows.Count - 1; c++)

363

if (Convert.ToString(DataGridView1.Rows[c].Cells[1].Value)!=
"")
{
sum = sum +
Convert.ToDecimal(DataGridView1.Rows[c].Cells[1].Value);
MessageBox.Show(sum.ToString());

}
}
txttotal_amount.Text = sum.ToString();
string content = sum.ToString();

string[] str = content.Split('.');

foreach (string word in str)


{

txtrdf_amount.Text = "." + word.ToString();

364

txtnet_amount.Text = Math.Round(double.Parse(sum.ToString()),
0).ToString();
txttotal_amount.Text = sum.ToString();
}
else
{
MessageBox.Show("Cannot Return This much Quantity");
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void btnrecord_Click(object sender, EventArgs e)
{
if (txtbill_number.Text == "")
{
MessageBox.Show("Please Enter Bill Number");
}
else if (txtremarks.Text == "")
{
MessageBox.Show("Please Enter Remarks");
}

365

else
{
sql = "select p_id,batch,total_qty from sales_stock";
ds1 = new DataSet();

ds1 = db.getDataTable(sql);
c = ds1.Tables[0].Rows.Count;

if (c > 0)
{
s = 0;
sql = "Select dp_return_no from DEPARTMENT_RETURN_MASTER
order by dp_return_no";

ds = new DataSet();

ds = db.getDataTable(sql);

int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

366

string str4 = ds.Tables[0].Rows[j]["dp_return_no"].ToString();


MessageBox.Show(str4);

string str1 = str4.Substring(4, 10);

string str3 = str4.Substring(0, 4);


MessageBox.Show(str3);

int l = int.Parse(str1) + 1;

MessageBox.Show(l.ToString());

txtNumber.Text = str3 + Convert.ToString(l);

insert_and_updatestock();

}
else
{
txtNumber.Text = "DPRN1400000001";

insert_and_updatestock();

367

}
}

}
}

private void Department_Return_New_Load(object sender, EventArgs e)


{

private void btndone_Click(object sender, EventArgs e)


{
this.Close();
}

}
}

368

Sales Return Lists

369

CODE OF SALES RETURN LISTS

namespace KURJI
{
public partial class Sales_Return_Lists : Form
{
database db = new database();
public Sales_Return_Lists()
{
InitializeComponent();
}

370

public void sum_total()


{
decimal q = 0;
for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
{
txttotal_amount.Text = "";
q=q+
(Convert.ToDecimal(DataGridView1.Rows[i].Cells["total_amount"].Value));
}
txttotal_amount.Text = Convert.ToString(q);
q = 0;
}
public void show_list()
{
if (cmbreturn_type.Text == "IP")
{
string sql = "select
m.return_no,p.pat_name,ad.ip_no,ad.opd_no,m.return_date,csm.bill_no,m.total
_amount from Sale_Return_Master m,Admission_Detail ad,Patient_Detail
p,Cash_sale_master csm where ad.ip_no=m.ip_no and p.opd_no=m.opd_no and
csm.bill_no=m.bill_no and m.return_date between '"+datefrom.Text + "' and '"
+dateto.Text + "'order by m.return_no";

DataSet ds = new DataSet();


ds = db.getDataTable(sql);

371

int c = ds.Tables[0].Rows.Count;
if (c > 0)
{
txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();
DataGridView1.DataSource = ds.Tables[0];
sum_total();
}
else
{
MessageBox.Show("No Data Found");
}
}
else
{
string sql = "select
m.return_no,p.pat_name,m.ip_no,m.opd_no,m.return_date,csm.bill_no,m.total_
amount from Sale_Return_Master m,Admission_Detail ad,Patient_Detail
p,Cash_sale_master csm where p.opd_no=m.opd_no and csm.bill_no=m.bill_no
and m.return_date between '" +datefrom.Text + "' and '" + dateto.Text + "'";

DataSet ds = new DataSet();


ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{

372

txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();
DataGridView1.DataSource = ds.Tables[0];
sum_total();
}
else
{
MessageBox.Show("No Data Found");
}
}
}
private void btnshow_Click(object sender, EventArgs e)
{
show_list();
}
public void display()
{
if (DataGridView1.Rows.Count > 0)
{
int i;
i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);

string str1 =
DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells[0].Value.ToString();

373

if (cmbreturn_type.Text == "OPD")
{
if
(DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["ip_no"].Value.ToStrin
g() == "")
{
Sales_Return_Display f = new
Sales_Return_Display(cmbreturn_type.Text, str1);
f.Show();
}
else
{
MessageBox.Show("Refresh List");
}
}
else
{
if
(DataGridView1.Rows[DataGridView1.Rows[i].Index].Cells["ip_no"].Value.ToStrin
g() != "")
{
Sales_Return_Display f = new
Sales_Return_Display(cmbreturn_type.Text, str1);
f.Show();
}

374

else
{
MessageBox.Show("Refresh List");
}
}
}
else
{
MessageBox.Show("Cannot Display");
}
}

private void Sales_Return_Lists_Load(object sender, EventArgs e)


{

}
private void btnnew_Click(object sender, EventArgs e)
{
Sales_Return_New f = new Sales_Return_New(cmbreturn_type.Text);
f.Show();
}

private void btndisplay_Click(object sender, EventArgs e)


{
if (cmbreturn_type.Text == "OPD")

375

display();
}
else
{
display();

}
}

public void bill_search()


{
if (cmbreturn_type.Text == "IP")
{
string sql = "select
m.return_no,p.pat_name,csm.bill_no,ad.ip_no,ad.opd_no,m.return_date,m.total
_amount from Sale_Return_Master m,Admission_Detail ad,Cash_Sale_Master
csm,Patient_Detail p where csm.ip_no=m.ip_no and csm.bill_no=m.bill_no and
p.opd_no=m.opd_no and csm.bill_no='" + txtbill.Text + "'order by m.return_no";

DataSet ds = new DataSet();


ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
if (c > 0)
{

376

txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();
DataGridView1.DataSource = ds.Tables[0];
sum_total();
}
else
{
MessageBox.Show("No Data Found");
}
}
else
{
string sql = "select
m.return_no,p.pat_name,m.ip_no,m.opd_no,csm.bill_no,m.return_date,m.total_
amount from Sale_Return_Master m,Admission_Detail ad,Cash_Sale_Master
csm,Patient_Detail p where p.opd_no=m.opd_no and csm.bill_no=m.bill_no and
csm.bill_no='" + txtbill.Text + "'";

DataSet ds = new DataSet();


ds = db.getDataTable(sql);
int c = ds.Tables[0].Rows.Count;
MessageBox.Show(c.ToString());
if (c > 0)
{
txtfrom.Text = ds.Tables[0].Rows[0][0].ToString();
txtto.Text = ds.Tables[0].Rows[c - 1][0].ToString();

377

DataGridView1.DataSource = ds.Tables[0];
sum_total();
}
else
{
MessageBox.Show("No Data Found");
}
}
}

private void txtbill_Leave(object sender, EventArgs e)


{
bill_search();
}

private void btndone_Click(object sender, EventArgs e)


{
this.Close();
}

}
}

378

Sales Return New

379

380

CODE OF SALES RETURN NEW

namespace KURJI
{
public partial class Sales_Return_New : Form
{
string str,sql,str1;
database db = new database();
database db1;
DataSet ds,ds1;
int f = 0,f1=0,c=0;
decimal s = 0;
public Sales_Return_New(string returntype)
{

InitializeComponent();
str = returntype;
txtuser_id.Text = UserAccess.C_User;

381

private void txtbill_number_Leave(object sender, EventArgs e)


{
if (str == "OPD")
{

sql = "select
p.pat_name,p.sex,p.age,m.total_amount,m.roundoff_amount,m.net_amount,m.o
pd_no,m.ip_no from Patient_Detail p,Cash_Sale_Master m where
p.opd_no=m.opd_no and m.bill_no='" + txtbill_number.Text + "'";

ds = new DataSet();
ds = db.getDataTable(sql);
int x = ds.Tables[0].Rows.Count;

if (x>0 && (String.IsNullOrEmpty(ds.Tables[0].Rows[0]


["ip_no"].ToString())))
{
MessageBox.Show("Entered in the loop");

382

sql = "select
p.p_nm,d.p_id,d.batch,d.issued_qty,p.p_type,p.power,pr.mrp_unit,pr.actual_mrp
_unit,pr.mfg,pr.exp,d.amount,pr.receipt_no from Product p,Purchase_Detail
pr,Cash_Sale_Detail d where p.p_id=d.p_id and pr.p_id=d.p_id and
pr.batch=d.batch and pr.receipt_no=d.receipt_no and d.bill_no='" +
txtbill_number.Text + "'";
database db1 = new database();
DataSet ds1 = new DataSet();
ds1 = db1.getDataTable(sql);
DataGridView1.DataSource = ds1.Tables[0];
txtpname.Text = ds.Tables[0].Rows[0][0].ToString();
txtsex.Text = ds.Tables[0].Rows[0][1].ToString();
txtage.Text = ds.Tables[0].Rows[0][2].ToString();
txttotal_amount.Text = ds.Tables[0].Rows[0][3].ToString();
txtrdf_amount.Text = ds.Tables[0].Rows[0][4].ToString();
txtnet_amount.Text = ds.Tables[0].Rows[0][5].ToString();
txtopd.Text = ds.Tables[0].Rows[0][6].ToString();
}
else
{
MessageBox.Show("Incorrect Bill");
}
}
else
{

383

sql = "select
p.pat_name,ad.bed,ad.ward_no,p.sex,p.age,m.total_amount,m.roundoff_amount
,m.net_amount,m.ip_no,m.opd_no from Patient_Detail p,Cash_Sale_Master
m,admission_detail ad where p.opd_no=m.opd_no and ad.ip_no=m.ip_no and
m.bill_no='" + txtbill_number.Text + "'";

ds = new DataSet();
ds = db.getDataTable(sql);
int x = ds.Tables[0].Rows.Count;
if (x > 0)
{
sql = "select
p.p_nm,d.p_id,d.batch,d.issued_qty,p.p_type,p.power,pr.mrp_unit,pr.actual_mrp
_unit,pr.mfg,pr.exp,d.amount,pr.receipt_no from Product p,Purchase_Detail
pr,Cash_Sale_Detail d where p.p_id=d.p_id and pr.p_id=d.p_id and
pr.batch=d.batch and pr.receipt_no=d.receipt_no and d.bill_no='" +
txtbill_number.Text + "'";
database db1 = new database();
DataSet ds1 = new DataSet();
ds1 = db1.getDataTable(sql);
DataGridView1.DataSource = ds1.Tables[0];
txtpname.Text = ds.Tables[0].Rows[0][0].ToString();
txtbed.Text = ds.Tables[0].Rows[0][1].ToString();
txtward.Text = ds.Tables[0].Rows[0][2].ToString();
txtsex.Text = ds.Tables[0].Rows[0][3].ToString();
txtage.Text = ds.Tables[0].Rows[0][4].ToString();
txttotal_amount.Text = ds.Tables[0].Rows[0][5].ToString();
txtrdf_amount.Text = ds.Tables[0].Rows[0][6].ToString();

384

txtnet_amount.Text = ds.Tables[0].Rows[0][7].ToString();
txtip.Text = ds.Tables[0].Rows[0][8].ToString();
txtopd.Text = ds.Tables[0].Rows[0][9].ToString();
}
else
{
MessageBox.Show("Incorrect Bill");
}
}

private void DataGridView1_CellLeave(object sender,


DataGridViewCellEventArgs e)
{

int i = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow);
MessageBox.Show(i.ToString());

try
{
int qty = Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value);
MessageBox.Show(qty.ToString());
if (qty > 0 && qty <=
Convert.ToInt32(DataGridView1.Rows[i].Cells[5].Value))
{

385

decimal d = Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value)
* Convert.ToDecimal(DataGridView1.Rows[i].Cells["actual_mrp_unit"].Value);
DataGridView1.Rows[i].Cells[1].Value = d;
decimal sum = 0;
for (int c = 0; c < DataGridView1.Rows.Count - 1; c++)
{

if ((Convert.ToString(DataGridView1.Rows[c].Cells[0].Value)) !=
"" && (Convert.ToString(DataGridView1.Rows[c].Cells[1].Value) != ""))
{
sum = sum +
Convert.ToDecimal(DataGridView1.Rows[c].Cells[1].Value);
MessageBox.Show(sum.ToString());

}
}
string content = sum.ToString();

string[] str = content.Split('.');

foreach (string word in str)


{

txtrdf_amount.Text = "." + word.ToString();

386

txtnet_amount.Text = Math.Round(double.Parse(sum.ToString()),
0).ToString();
txttotal_amount.Text = sum.ToString();

}
else
{
MessageBox.Show("Cannot Return this much Quantity");
}
}

catch
{
MessageBox.Show("Please Select a Row");
}
}

public void insert_stockop()


{
for (int k = 0; k < DataGridView1.Rows.Count - 1; k++)
{

387

if ((Convert.ToString(DataGridView1.Rows[k].Cells[0].Value)) != "" &&


(Convert.ToString(DataGridView1.Rows[k].Cells[1].Value) != ""))
{
f1 = 1;

MessageBox.Show(s.ToString());
sql = "insert into sale_return_detail values('" + txtNumber.Text + "',"
+ Convert.ToInt32(DataGridView1.Rows[k].Cells[3].Value) + ",'" +
DataGridView1.Rows[k].Cells[4].Value + "'," +
Convert.ToInt32(DataGridView1.Rows[k].Cells[0].Value) + ",'" +
DataGridView1.Rows[k].Cells[13].Value + "'," +
Convert.ToDecimal(DataGridView1.Rows[k].Cells[1].Value) + ")";

db.ExecuteOrcl(sql);
sql = "insert into sales_stock values('" +
DataGridView1.Rows[k].Cells[13].Value + "'," +
Convert.ToInt32(DataGridView1.Rows[k].Cells[3].Value) + ",'" +
Convert.ToString(DataGridView1.Rows[k].Cells[4].Value) + "'," +
Convert.ToInt32(DataGridView1.Rows[k].Cells[0].Value) + ")";

db.ExecuteOrcl(sql);
}
}
if (f1 == 1)
{
sql = "insert into
sale_return_master(return_no,return_date,remarks,total_amount,roundoff_amo
unt,net_amount,user_id,opd_no,bill_no) values('" + txtNumber.Text + "','" +
txtdate.Text + "','" + txtremarks.Text + "'," + decimal.Parse(txttotal_amount.Text)

388

+ "," + decimal.Parse(txtrdf_amount.Text) + "," +


decimal.Parse(txtnet_amount.Text) + ",'" + txtuser_id.Text + "','" + txtopd.Text +
"','" + txtbill_number.Text + "')";
db = new database();
db.ExecuteOrcl(sql);
}
else
{
MessageBox.Show("Please enter the Quantity and Press Tab to
calculate amount");
}
}
public void insert_stocip()
{
for (int k = 0; k < DataGridView1.Rows.Count - 1; k++)
{
if ((Convert.ToString(DataGridView1.Rows[k].Cells[0].Value)) != "" &&
(Convert.ToString(DataGridView1.Rows[k].Cells[1].Value) != ""))
{
f1 = 1;

MessageBox.Show(s.ToString());
sql = "insert into sale_return_detail values('" + txtNumber.Text + "',"
+ Convert.ToInt32(DataGridView1.Rows[k].Cells[3].Value) + ",'" +
DataGridView1.Rows[k].Cells[4].Value + "'," +
Convert.ToInt32(DataGridView1.Rows[k].Cells[0].Value) + ",'" +
DataGridView1.Rows[k].Cells[13].Value + "'," +
Convert.ToDecimal(DataGridView1.Rows[k].Cells[1].Value) + ")";

389

db.ExecuteOrcl(sql);
sql = "insert into sales_stock values('" +
DataGridView1.Rows[k].Cells[13].Value + "'," +
Convert.ToInt32(DataGridView1.Rows[k].Cells[3].Value) + ",'" +
Convert.ToString(DataGridView1.Rows[k].Cells[4].Value) + "'," +
Convert.ToInt32(DataGridView1.Rows[k].Cells[0].Value) + ")";

db.ExecuteOrcl(sql);
}
}
if (f1 == 1)
{
sql = "insert into
sale_return_master(return_no,return_date,remarks,total_amount,roundoff_amo
unt,net_amount,user_id,ip_no,opd_no,bill_no) values('" + txtNumber.Text + "','" +
txtdate.Text + "','" + txtremarks.Text + "'," + decimal.Parse(txttotal_amount.Text)
+ "," + decimal.Parse(txtrdf_amount.Text) + "," +
decimal.Parse(txtnet_amount.Text) + ",'" + txtuser_id.Text + "','" + txtip.Text + "','"
+ txtopd.Text + "','" + txtbill_number.Text + "')";

db.ExecuteOrcl(sql);
}
else
{
MessageBox.Show("Please enter the Quantity and Press Tab to
calculate");
}

390

}
public void insert_cash_saleip()
{
for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
{
MessageBox.Show("hello");
MessageBox.Show(c.ToString());
for (int x = 0; x < c; x++)
{
MessageBox.Show(x.ToString());
MessageBox.Show("hello again");
Int32 pid = Convert.ToInt32(ds1.Tables[0].Rows[x]["p_id"]);
string batch = Convert.ToString(ds1.Tables[0].Rows[x]["batch"]);
Int32 qty = Convert.ToInt32(ds1.Tables[0].Rows[x]["total_qty"]);

if ((Convert.ToString(DataGridView1.Rows[i].Cells[0].Value)) != ""
&& (Convert.ToString(DataGridView1.Rows[i].Cells[1].Value) != ""))
{
MessageBox.Show("no quantity");
f1 = 1;
string str6 =
Convert.ToString(DataGridView1.Rows[i].Cells[4].Value);
if (pid == Convert.ToInt32(DataGridView1.Rows[i].Cells[3].Value)
&& (str6 == batch))
{
MessageBox.Show("matched");

391

f = 1;

MessageBox.Show(s.ToString());
sql = "insert into sale_return_detail values('" + txtNumber.Text
+ "'," + Convert.ToInt32(DataGridView1.Rows[i].Cells[3].Value) + ",'" +
DataGridView1.Rows[i].Cells[4].Value + "'," +
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value) + ",'" +
DataGridView1.Rows[i].Cells[13].Value + "'," +
Convert.ToDecimal(DataGridView1.Rows[i].Cells[1].Value) + ")";

db.ExecuteOrcl(sql);
qty = qty +
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value);
MessageBox.Show(batch);
MessageBox.Show(qty.ToString());
sql = "update sales_stock set total_qty=" + qty + " where
p_id=" + pid + "and batch='" + batch + "'";

db.ExecuteOrcl(sql);

}
if (f1 == 1)

392

{
MessageBox.Show("not inserted");
sql = "insert into
sale_return_master(return_no,return_date,remarks,total_amount,roundoff_amo
unt,net_amount,user_id,ip_no,opd_no,bill_no) values('" + txtNumber.Text + "','" +
txtdate.Text + "','" + txtremarks.Text + "'," + decimal.Parse(txttotal_amount.Text)
+ "," + decimal.Parse(txtrdf_amount.Text) + "," +
decimal.Parse(txtnet_amount.Text) + ",'" + txtuser_id.Text + "','" + txtip.Text + "','"
+ txtopd.Text + "','" + txtbill_number.Text + "')";

db.ExecuteOrcl(sql);
}
else
{
MessageBox.Show("Please enter the Quantity and Press Tab to
calculate amount");
}

}
public void insert_cash_saleop()
{
for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
{

for (int x = 0; x < c; x++)


{
Int32 pid = Convert.ToInt32(ds1.Tables[0].Rows[x]["p_id"]);

393

string batch = Convert.ToString(ds1.Tables[0].Rows[x]["batch"]);


Int32 qty = Convert.ToInt32(ds1.Tables[0].Rows[x]["total_qty"]);
MessageBox.Show(qty.ToString());

if ((Convert.ToString(DataGridView1.Rows[i].Cells[0].Value)) != ""
&& (Convert.ToString(DataGridView1.Rows[i].Cells[1].Value) != ""))
{
f1 = 1;
string str6 =
Convert.ToString(DataGridView1.Rows[i].Cells[4].Value);

if ((pid == Convert.ToInt32(DataGridView1.Rows[i].Cells[3].Value)
&& (str6 == batch)))
{
f = 1;

MessageBox.Show("From OPD");
MessageBox.Show(s.ToString());
sql = "insert into
sale_return_detail(return_no,p_id,batch,return_qty,receipt_no,total_amount)
values('" + txtNumber.Text + "'," +
Convert.ToInt32(DataGridView1.Rows[i].Cells[3].Value) + ",'" +
DataGridView1.Rows[i].Cells[4].Value + "'," +
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value) + ",'" +
DataGridView1.Rows[i].Cells[13].Value + "'," +
Convert.ToDecimal(DataGridView1.Rows[i].Cells[1].Value) + ")";

394

db.ExecuteOrcl(sql);
qty = qty +
Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value);
MessageBox.Show(qty.ToString());
sql = "update sales_stock set total_qty=" + qty + " where
p_id=" + pid + "and batch='" + batch + "'";

db.ExecuteOrcl(sql);

}
}

if (f1 == 1)
{
sql = "insert into
sale_return_master(return_no,return_date,remarks,total_amount,roundoff_amo
unt,net_amount,user_id,opd_no,bill_no) values('" + txtNumber.Text + "','" +
txtdate.Text + "','" + txtremarks.Text + "'," + decimal.Parse(txttotal_amount.Text)
+ "," + decimal.Parse(txtrdf_amount.Text) + "," +
decimal.Parse(txtnet_amount.Text) + ",'" + txtuser_id.Text + "','" + txtopd.Text +
"','" + txtbill_number.Text + "')";

395

db.ExecuteOrcl(sql);
}
else
{
MessageBox.Show("Please enter the Quantity And Press Tab to
calculate amount");
}

private void Sales_Return_New_Load(object sender, EventArgs e)


{

private void btndone_Click(object sender, EventArgs e)


{
this.Close();
}

private void btnrecord_Click(object sender, EventArgs e)


{
if (txtbill_number.Text == "")
{

396

MessageBox.Show("please enter bill no");


}
else if (txtremarks.Text == "")
{
MessageBox.Show("enter remarks");
}
else
{
sql = "select p_id,batch,total_qty from sales_stock";
ds1 = new DataSet();
db1 = new database();
ds1 = db1.getDataTable(sql);
c = ds1.Tables[0].Rows.Count;
MessageBox.Show(c.ToString());
if (c > 0)
{

if (str == "OPD")
{
sql = "Select return_no from sale_return_master order by
return_no";

ds = new DataSet();

ds = db.getDataTable(sql);

397

int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

string str4 = ds.Tables[0].Rows[j]["return_no"].ToString();


MessageBox.Show(str4);

string str1 = str4.Substring(4, 10);

string str3 = str4.Substring(0, 4);


MessageBox.Show(str3);

int l = int.Parse(str1) + 1;

MessageBox.Show(l.ToString());

txtNumber.Text = str3 + Convert.ToString(l);

insert_cash_saleop();

398

}//if p>0 closed

else
{
txtNumber.Text = "CSRN1400000001";

insert_cash_saleop();
}
}//else closed of p>0
else
{
sql = "Select return_no from sale_return_master order by
return_no";

ds = new DataSet();

ds = db.getDataTable(sql);

int p = ds.Tables[0].Rows.Count;

int j = ds.Tables[0].Rows.Count - 1;

if (p > 0)
{

399

string str4 = ds.Tables[0].Rows[j]["return_no"].ToString();

string str1 = str4.Substring(4, 10);

string str3 = str4.Substring(0, 4);


MessageBox.Show(str3);

int l = int.Parse(str1) + 1;

MessageBox.Show(l.ToString());

txtNumber.Text = str3 + Convert.ToString(l);

insert_cash_saleip();

}
else
{
txtNumber.Text = "CSRN1400000001";

insert_cash_saleip();
}

400

}
}//c closed
}
}

}
}

401

Code

Efficiency

The code is called efficient when it is easy to


understand, tested and maintained also, works properly.
The code in this software is easy to understand, tested
and

maintained

and

compact

enough

to

run

interactively on windows platform.


Each module is separately coded in order to be simple
and easily understood by other programmer. It is less
error prone. It can be easily maintained.
The care has been taken to trap the most common
error message to make the code efficient. Although
further development is in progress, the algorithm is
currently fast.
In this software at many places I have tried to
optimize the code by taking it in modules, functions and
it has been called in different place in the program.
Optimization adds compactness and accuracy to the
program and reduces the KLOC of the project.

402

The database used in this software to store


information is also optimized by carefully normalizing
tables. In particular the table is placed in separate table
spaces so that in future when the size of database
grows, there is a provision of database growth.

403

Validation Checks

All data entered into the system must be


validated to ensure accuracy. Input validation also
called edit checks can take many forms. Ideally
computer systems should not accept data that fail any
important

validation

check

to

prevent

invalid

information from entering the system. However, this can


be very difficult and invalid data often slip by the users
providing the information. It is up to the system to
identify invalid data and either make changes or notify
someone who can resolve the information problem.
There are many methods, which are commonly used to
verify data entering the system as input. Some of them
are:
Verification of Data Type:

- Some input fields

should contain only numeric data while others should


contain only alphabetic data. The fields can be edited
to make certain that only the right type of data is
recorded in each field.
Verification of Codes: - The performance of code is
checked by entering test value that whether the code
is working properly or not.
404

There are six different types of validation checks:


Completeness check,
Format check,
Range check,
Check digit check,
Consistency check and
Database check.
Every system should use at least one
validation checking for the data entered ideally.

405

Type of information
Completeness check

Used in module when


This
check
was

We checked the form

performed

by filling all the fields

several

with required data.

required to be entered

whenever

fields

were

before processing.
This

Format check
We

checked

all

the

check

was

performed on all the

fields to ensure that

fields

the data are entered of

numeric or string data.

containing

right type and in right


format.
Range check

This

All the numeric fields

performed

were checked for data

numeric

range i.e., for correct

fields.

minimum

check

was

on

all

data

and

with

all

and

maximum values.
Check digit check

Applied

Check

digits

numeric codes.

added

to

were
numeric

codes.
Consistency check
This

was

ensure

done
that

combination

of

This
to
the

was

whenever

applied
the

data

were related.

data

were valid.

406

Database check
This

was

This check was applied

applied

to

at a few places where

compare data against a

the data was available

database

to perform the check.

to

ensure

their correctness.

Testing

Unit Testing: in unit testing, I have tested the


individual unit of source code, function, and
procedure.
The goal of doing unit testing is to isolate each part of a
program and to test the module.

Integeration Testing: In the integration testing, I


have combined the individual module and tested it as
a group. The purpose of doing the integeration testing
is to verify function, performance, and reliability.
System Testing: At the end, all the individual and
dependent modules are integrated together as a whole

407

system. I tested the software as a whole and see the


work flow of it with the purpose of finding error.
For testing this project I checked on dummy data,
whether the software is operating according to the given
requirements or not.

Security Measures Taken:

Like all design activities the security plan was also


driven by the requirements that were identified during
the analysis phase in the proposed system. The three
standard steps were considered to device the security
plan.
1. Identification of threats to the system.
2. Assessment of the risk associated with the threats.
3. Creation of controls to maintain security.

408

From the software point of view I have created different


level of users with defined privileges to access the software.
The administrator (Admin) is the super user who has all
rights. He can access all modules and also create user. At
second level user is storekeeper who has just less right
than administrator.

In this project keeping the security mechanism in mind,


validation is done in such a manner so that in future if
any error occurred, then the system generated error
message is shown with the line number.

Future Scope of the project

My project is in modular nature so without any disturbance


it can be further upgraded by addition or modification of
modules without any adverse effect on the performance.
409

Since the software is created using oracle as back-end and


C# as front-end as the need increased same project with
slight modification can be easily installed on different
systems. In the future if the hierarchy of users increases
the security control system can be upgraded top become
more reliable.

CONCLUSION

410

For the first time software has been


developed

for

the

smooth

and

easy

working

of

organisation. It will not only help the official and staff of


the organization in their day-to-day working but will also
give an opportunity to know the status of any records
such as main stock, sale stock and transfer of medicine
in various department.
At this juncture of my project work, its time
to look back and analyze all my efforts and once again
think of what I have done and what I should have done.
But in this result-oriented world what matters most is
what we have done or what we have achieved finally.
I have tried to put best of my efforts and
done whatever I could but it is not necessary that
whatever I have done, despite everything, would be the
perfect one.
Anyway, working on any project gives a lot of
new information and one gains new experience. But,
working on this project was totally different as it is a
real time project about pharmacy management system.
Hardly a few percents of us actually know the broader
field of pharmacy management sytem of any hospital.

411

We simply think that, this project gives me fabulous


experience.

Bibliography
While developing my project I have taken help
from persons and also consulted with books. The books
lists are as follows:

8. OReilly.C.Sharp.5.0.in a Nutshell 5th Edition


9. Tutorialpoints.com/CSharp,codeproject.com
MSDN.microsoft.com
10.

SQL& PL/SQL for oracle 10g BLACK BOOK


(Wiley India)

412

413

You might also like