-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgst_r1.php
151 lines (146 loc) · 5.89 KB
/
gst_r1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html>
<head>
<link href="css/bootstrap.css" rel="stylesheet">
<script src="jquery-1.11.3.min.js"></script>
<script src="dist/jquery.validate.js"></script>
<script>
$(document).ready(function () {
$("#myForm1").validate()
})
</script>
</head>
<body>
<?php
include "connection.php";
include "user_header.php";
$s="select * from public_signup WHERE email='".$_SESSION["username"]."'";
$result = mysqli_query($conn,$s);
$row = mysqli_fetch_array($result);
?>
<div class="container">
<table class="table table-responsive table-bordered">
<form action="" method="post">
<tr>
<th style="text-align: center" colspan="13"><h1>Form GST R-1</h1></th>
</tr>
<tr>
<td colspan="13">Details of outward supplies</td>
</tr>
<tr>
<th>1</th>
<td colspan="2">GSTIN</td>
<td colspan="10"><?php echo $row[6] ?></td>
</tr>
<tr>
<th>2</th>
<td colspan="2">Name of the taxable person</td>
<td colspan="10"><?php echo $row[5] ?></td>
</tr>
<tr>
<th>3</th>
<td colspan="2">Aggregate Turnover of the Taxable Person in the Previous Financial Year</td>
<td colspan="10"><input class="form-control" name="turnover" type="text"></td>
</tr>
<tr>
<th>4</th>
<td colspan="2">Period:</td>
<td colspan="10">
FROM <input class="form-control" name="from" id="from" type="date"> TO <input
class="form-control" name="to" id="to" type="date">
<input type="submit" value="Go" class="btn btn-success">
</td>
</tr>
</form>
<tr>
<th>5</th>
<th colspan="12">Taxable Outward Supplies to a Registered Person</th>
</tr>
<tr>
<th>GSTIN/UIN</th>
<td colspan="6">Invoice</td>
<td colspan="2">IGST</td>
<td colspan="2">CGST</td>
<td colspan="2">SGST</td>
</tr>
<tr>
<th></th>
<th>No.</th>
<th>Date</th>
<th>Value</th>
<th>Goods/Services</th>
<th>HSN/SAC</th>
<th>Taxable value</th>
<th>Rate</th>
<th>Amount</th>
<th>Rate</th>
<th>Amount</th>
<th>Rate</th>
<th>Amount</th>
</tr>
<?php
if (isset($_REQUEST['from']) && isset($_REQUEST['to'])) {
$from = $_REQUEST['from'];
$to = $_REQUEST['to'];
$bill = "select * from bill where email='" . $username . "' and bill_date between '" . $from . "' and '" . $to . "'";
$bill_result = mysqli_query($conn, $bill);
while ($bill_row = mysqli_fetch_array($bill_result)) {
$products="select count(id) as id from bill_details where bill_id=".$bill_row[0];
$products_result=mysqli_query($conn,$products);
$products_row=mysqli_fetch_array($products_result);
$row_count=$products_row['id'];
$bill_detail="SELECT * FROM products LEFT JOIN items ON items.id=products.tax_id RIGHT JOIN bill_details ON bill_details.product_id=products.product_id WHERE bill_id= ".$bill_row[0]." LIMIT 0,1 ";
$bill_detail_result=mysqli_query($conn,$bill_detail);
$bill_detail_row=mysqli_fetch_array($bill_detail_result);
?>
<tr>
<td <?php if($row_count>1) { ?>rowspan="<?php echo $row_count ?>" <?php } ?>></td>
<td <?php if($row_count>1) { ?>rowspan="<?php echo $row_count ?>" <?php } ?>><?php echo $bill_row[0]; ?></td>
<td <?php if($row_count>1) { ?>rowspan="<?php echo $row_count ?>" <?php } ?>><?php echo $bill_row['bill_date']; ?></td>
<td <?php if($row_count>1) { ?>rowspan="<?php echo $row_count ?>" <?php } ?>><?php echo $bill_row['total']; ?></td>
<td <?php if($row_count>1) { ?>rowspan="<?php echo $row_count ?>" <?php } ?>>Goods</td>
<td><?php echo $bill_detail_row['HSN_Code']; ?></td>
<td><?php echo $bill_detail_row['selling_price']; ?></td>
<td><?php echo $bill_detail_row['iGST']; ?></td>
<td><?php echo ($bill_detail_row['iGST']*$bill_detail_row['selling_price'])/100; ?></td>
<td><?php echo $bill_detail_row['CGST']; ?></td>
<td><?php echo ($bill_detail_row['CGST']*$bill_detail_row['selling_price'])/100; ?></td>
<td><?php echo $bill_detail_row['SGST']; ?></td>
<td><?php echo ($bill_detail_row['SGST']*$bill_detail_row['selling_price'])/100; ?></td>
</tr>
<?php
$num=1;
$tax="SELECT * FROM products LEFT JOIN items ON items.id=products.tax_id RIGHT JOIN bill_details ON bill_details.product_id=products.product_id WHERE bill_id= ".$bill_row[0];
$tax_result=mysqli_query($conn,$tax);
$ar=array();
while ($tax_row=mysqli_fetch_array($tax_result))
{
$ar[$num]=$tax_row;
$num++;
}
for($i=1;$i<$row_count;$i++)
{
//echo "<br>".$ar[$i]['iGST']."<br>";
?>
<tr>
<td><?php echo $ar[$i]['HSN_Code']; ?></td>
<td><?php echo $ar[$i]['selling_price']; ?></td>
<td><?php echo $ar[$i]['iGST']; ?></td>
<td><?php echo ($ar[$i]['iGST']*$ar[$i]['selling_price'])/100; ?></td>
<td><?php echo $ar[$i]['CGST']; ?></td>
<td><?php echo ($ar[$i]['CGST']*$ar[$i]['selling_price'])/100; ?></td>
<td><?php echo $ar[$i]['SGST']; ?></td>
<td><?php echo ($ar[$i]['SGST']*$ar[$i]['selling_price'])/100; ?></td>
</tr>
<?php
}
}
}
?>
</table>
</div>
<?php
include 'footer.php';
?>
</body>
</html>