Académique Documents
Professionnel Documents
Culture Documents
in
ACKNOWLEDGEMENT
Through this column we wish to acknowledge our deep appreciation for the guidance rendered by Mr.Anindya Kishore Basu Sarbadhikary, respected faculty member of ARDENT COLLABORATION. His constant encouraging guidance, invaluable help and good wishes guided the project work to this stand. His assistance has been a thorough boost in improving our work to a finer extent. We are also grateful to all the faculty members and staffs of ARDENT COLLABORATION for constant help.
OBJECTIVE
The objective of our project is to make a computerized system to manage and control the resources and activities of ORDER SUPPLY so that the management of the ordering and delivering system of any company can be done in an efficient and smooth manner.
The various modules or tables that are associated with this system are described as follows:
ITEM : This table contains the various information regarding the items
like the specific item id, item name and the stock number.
RATE : This table has the foreign key relationship with item table
through item id. This table also contains the rate of any particular item.
ORDER : Order table contains the order number, client number, item
id, order quantity, order date i.e. the order related all sort of details.
CONTEXT DIAGRAM
ENTITY-RELATIONSHIP DIAGRAM
Itemid
Itemname
clname
Item
Stock Ordno Clno
Address
Client
Phno
Order
Is sold by Itemid Is place dby
Quantity Is sold by
Ord_dt
clnam e
Rate
Invoice
Rate
Order details
Ordno
Itemname
TECHNICAL DETAILS
HARDWARE REQUIREMENTS:
1. Standard Desktop PC. (256MB RAM, 1 GB Free Space)
2. Printer
SOFTWARE REQUIREMENTS:
BACKEND TOOL:
Oracle 9i (SQL - PL/SQL)
DATABASES
1. ITEM Name -------------------------------ITEMID ITEMNAME STOCK 2. RATE Name -------------------------------ITEMID RATE 3. CLIENT Name Null? ------------------------------------------------CLNO NOT NULL CLNAME ADDRESS PHNO 4. ORDER Name -------------------------------ORDNO CLNO ITEMID QUANTITY Null? -----------------NOT NULL Type -----------------------VARCHAR2 VARCHAR2 VARCHAR2 NUMBER Type -----------------------VARCHAR2 VARCHAR2 VARCHAR2 NUMBER Null? -----------------NOT NULL Type -----------------------VARCHAR2 NUMBER Null? -----------------NOT NULL Type -----------------------VARCHAR2 VARCHAR2 NUMBER
5. INVOICE Name -------------------------------INVNO CLNAME ITEMNAME QUANTITY RATE ABS_AMT DEL_DT ORDNO Null? -----------------NOT NULL Type -----------------------VARCHAR2 VARCHAR2 VARCHAR2 NUMBER NUMBER NUMBER DATE VARCHAR2
6. ORD_DETAILS Name -------------------------------ORDNO REMARKS Null? -----------------NOT NULL Type -----------------------VARCHAR2 VARCHAR2
DATA DICTIONARY
ITEM : Details = ITEMID + ITEMNAME + STOCK. Updated Details =
ITEMID = string. ITEMNAME = string. STOCK = digit+digit+up to 20digit.
Updated Details =
ORDER :
Details =
ORDNO + CLNO + ITEMID + QUANTITY+ ORD_DT ORDNO = string. CLNO = string. ITEMID = string. QUANTITY = digit+digit+........up to 20digit. ORD_DT = date.
Updated Details =
INVOICE : Details =
INVNO + CLNAME + ITEMNAME + QUANTITY +RATE + ABS_AMT + DEL_DT + ORDNO
Updated Details =
INVNO = string. CLNAME = string. ITEMNAME = string. QUANTITY = digit+digit+........up to 20digit. RATE = digit+digit+........up to 20digit. ABS_AMT = digit+digit+........up to 20digit. DEL_DT = date. ORDNO = string.
Updated Details =
SQL-PL/SQL CODE
TABLE CREATION :
ITEM: create table item(itemid varchar2(20) primary key,itemname varchar2(20),stock number); RATE: create table rate(itemid varchar2(20) references item(item),rate number); CLIENT: create table client(clno varchar2(20) primary key,clname varchar2(20),address varchar2(50),phno number2(20)); ORDER: create table order(ordno varchar2(20) primary key,clno varchar2(20),itemid varchar2(20),quantity number,ord_dt date); INVOICE: create table invoice(invno varchar2(20),clname varchar2(20),itemname varchar2(20),quantity number,rate number,abs_amt number,del_dt date,ordno varchar2(20)); ORDER_DET:
ABHISHEK CHOUDHARY Technology Sharing www.tech4urhelp.blogspot.in create table ord_details(ordno varchar2(20),remarks varchar2(100));
SEQUENCE CREATION :
create sequence seitem start with 1 increment by 1; create sequence seclient start with 1 increment by 1; create sequence seorder start with 1 increment by 1; create sequence seinvoice start with 1 increment by 1;
tr_order.sql
create or replace trigger tr_order before insert on order for each row declare ch varchar2(40); begin select lpad(to_char(seorder.nextval),4,0) into ch from dual; :new.ordno:='C'||ch; end;
tr_client.sql
create or replace trigger tr_client before insert on client for each row declare ch varchar2(40); begin select lpad(to_char(seclient.nextval),4,0) into ch from dual;
tr_invoice.sql
create or replace trigger tr_invoice before insert on invoice for each row declare ch varchar2(40); begin select lpad(to_char(seinvoice.nextval),4,0) into ch from dual; :new.invno:='IN'||ch; end;
tr2_item.sql
create or replace trigger tr2_order after insert on order for each row declare vstock item.stock%type; vrate rate.rate%type; vname client.name%type; vitemname item.itemname%type; begin select stock into vstock from item where itemid=:new.itemid; if vstock>=:new.quantity then insert into ordr_det values(:new.ordno,'ORDER SUCCESSFULLY PLACED'); update item set stock=vstock-:new.quantity where itemid=:new.itemid; select rate into vrate from rate where itemid=:new.itemid; select itemname into vitemname from item where itemid=:new.itemid; select name into vname from client where clno=:new.clno; if vname==null then insert into client (name,address,phnno) values ('&name','&address',&phnno); select name into vname from client where clno=:new.clno; end if; insert into invoice (clname,itemname,quantity,rate,abs_amt,del_dt,ordno) values(vname,vitemname,:new.quantity,vrate,:new.quantity*vrate, sysdate+7, :new.ordno); else insert into ordr_det values(:new.ordno,'ORDER CANCELLED'); end if; end;