0% found this document useful (0 votes)
18 views4 pages

SQL Tables for Invoicing System

The document contains SQL commands for creating multiple tables related to purchase and sale transactions, including `purchase_invoice`, `purchase_details`, `purchase_order`, and `sale_order`. It also includes PHP code for generating invoice bills, calculating totals, and displaying receipt information. The code captures user input for product details and computes gross prices, GST amounts, and grand totals.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

SQL Tables for Invoicing System

The document contains SQL commands for creating multiple tables related to purchase and sale transactions, including `purchase_invoice`, `purchase_details`, `purchase_order`, and `sale_order`. It also includes PHP code for generating invoice bills, calculating totals, and displaying receipt information. The code captures user input for product details and computes gross prices, GST amounts, and grand totals.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CREATE TABLE `purchase_invoice`(

`bill_serial` INT(9) NOT NULL AUTO_INCREMENT ,


`bill_uidn` BIGINT(14) NOT NULL ,
`bill_date` DATE NOT NULL ,
`bill_time` DATE NOT NULL ,
`customer` VARCHAR(32) NOT NULL ,
`mobile` VARCHAR(14) NOT NULL ,
`bill_amount` MEDIUMINT(6) NOT NULL ,
`gstr_amount` MEDIUMINT(6) NOT NULL ,
`disc_amount` MEDIUMINT(6) NOT NULL ,
`paid_amount` INT(8) NOT NULL ,
`paid_mode` TINYINT(1) NOT NULL ,
`staff_code` MEDIUMINT(6) NOT NULL ,
PRIMARY KEY (`bill_serial`)) ENGINE = InnoDB;

CREATE TABLE `purchase_details` (


`item_serial` BIGINT(12) NOT NULL AUTO_INCREMENT ,
`bill_serial` INT(9) NOT NULL ,
`item_name` VARCHAR(20) NOT NULL ,
`item_price` MEDIUMINT(6) NOT NULL ,
`item_qnty` TINYINT(2) NOT NULL ,
`item_disc` TINYINT(2) NOT NULL ,
`gstr_rate` TINYINT(2) NOT NULL ,
PRIMARY KEY (`item_serial`)) ENGINE = InnoDB;

CREATE TABLE `purchase_order` (


`item_serial` INT(9) NOT NULL AUTO_INCREMENT ,
`order_uidn` BIGINT(14) NOT NULL ,
`item_name` VARCHAR(20) NOT NULL ,
`item_price` MEDIUMINT(6) NOT NULL ,
`item_qnty` TINYINT(2) NOT NULL ,
`item_disc` TINYINT(2) NOT NULL ,
`gstr_rate` TINYINT(2) NOT NULL ,
`item_status` TINYINT(1) NOT NULL ,
PRIMARY KEY (`item_serial`)) ENGINE = InnoDB;

CREATE TABLE `sale_order` (


`order_uidn` INT(6) NOT NULL AUTO_INCREMENT ,
`order_date` DATE NOT NULL ,
`order_time` TIME NOT NULL ,
`customer_name` VARCHAR(20) NOT NULL ,
`mobile_number` VARCHAR(10) NOT NULL ,
`bill_amount` INT(6) NOT NULL ,
`gstr_amount` INT(6) NOT NULL ,
`disc_amount` INT(6) NOT NULL ,
`paid_amountPaid_` INT(8) NOT NULL ,
`Paid_type` TINYINT(1) NOT NULL ,
`order_status` TINYINT(1) NOT NULL ,
PRIMARY KEY (`order_uidn`)) ENGINE = InnoDB;

CREATE TABLE `student_practice`.`member_details` (


`firm_uidn` INT(6) NOT NULL AUTO_INCREMENT ,
`firm_name` VARCHAR(63) NOT NULL ,
`firm_short` VARCHAR(15) NULL ,
`firm_site` VARCHAR(63) NOT NULL ,
`firm_area` VARCHAR(63) NULL ,
<?php
// invoice bill

date_default_timezone_set("Asia/Calcutta");
$bill_date= date("m-n-Y") ; // date "year-month-day"
$bill_time =date("H:i"); // time "Hour : Minute :
Second Am/Pm)
$bill_number=date("ymnhi").rand(100,999); // 2505072122 + random
number from 100 to 999

$total=30;
$amount =1800;
// > >= < <= == !=

if($total >= 75)


{ echo "Dist";}
else if($total>=60)
{ echo "1st";}
else if($total>=45)
{ echo "2nd";}
else if($total>=33)
{ echo "3rd";}
else{ echo "Fail";}

/*
$total_gst_amount=0;
$sub_total=0;
$total_Amount=0;
*/

?>
`firm_web1` VARCHAR(20) NULL ,
`firm_page` VARCHAR(20) NULL ,
`firm_email` VARCHAR(20) NULL ,
`firm_help` VARCHAR(20) NULL ,
`firm_phone` VARCHAR(10) NOT NULL ,
`firm_mobile` VARCHAR(10) NULL ,
`firm_gstin` VARCHAR(15) NULL ,
`firm_state` VARCHAR(18) NULL ,
`firm_bankn` VARCHAR(18) NULL ,
`firm_accnt` VARCHAR(16) NULL ,
`firm_branch` VARCHAR(18) NULL ,
`firm_ifscn` VARCHAR(11) NULL ,
`firm_type` TINYINT(1) NOT NULL ,
`firm_status` TINYINT(1) NOT NULL ,
PRIMARY KEY (`firm_uidn`)) ENGINE = InnoDB;
<?php
// invoice bill

date_default_timezone_set("Asia/Calcutta");
$bill_date= date("m-n-Y") ; // date "year-month-day"
$bill_time =date("H:i"); // time "Hour : Minute :
Second Am/Pm)
$bill_number=date("ymnhi").rand(100,999); // 2505072122 + random
number from 100 to 999

$sub_total_amount=0;
$sub_gst_amount =0;

echo "\n Receipt No. : ".$bill_number;


echo "\n Date : ".$bill_date;
echo "\t\t Time : ".$bill_time. "\n";
$user_name = (string)readline("Full Name : ");
echo "\n Enter The Following Information \n";
$item_name = (string)readline("Product Name : ");
$cost_price = (int)readline('Price : ');
$item_qnty = (int)readline('Quantity : ');
$gst_rate = (float)readline('GSt Rate : ');

$gross_price = $cost_price * $item_qnty;


$gst_amount = ($gross_price * $gst_rate ) / 100 ;
$total_price = $gross_price + $gst_amount;
$sub_total_amount = $sub_total_amount + $gross_price;
$sub_gst_amount = $sub_gst_amount + $gst_amount;

echo "Gross Price : " . $gross_price ."<br>".


"GST Amount : " . $gst_amount."<br>".
"Total Price : " . $total_price . "<br>".
"---------------------------------------". "<br>";

$grand_total_amount = $sub_total_amount + $sub_gst_amount;


echo "Gross Total Amount : " . $sub_total_amount . "<br>".
"Total GST Amount : " . $sub_gst_amount . "<br>".
"Grand Total Amount : " . $grand_total . "<br>";

/*
$total_gst_amount=0;
$sub_total=0;
$total_Amount=0;
*/

?>

You might also like