- 1 <?php
- 2
- 3 include("includes/db.php");
- 4 $query=mysqli_query($con,"SELECT * from vouchers ");
- 5 $rowcount=mysqli_num_rows($query);
- 6
- 7 ?>
- 8 <h3>Count of Voucher Values </h3>
- 9 <?php
- 10
- 11 $sum=0;
- 12 $hun=0;
- 13 $twohun=0;
- 14 $threehun=0;
- 15 $thous=0;
- 16 for($i=1;$i<=$rowcount;$i++)
- 17 {
- 18
- 19 $row=mysqli_fetch_array($query);
- 20 $sum += $row["v_value"]; // calulating the sum of voucher value
- 21
- 22
- 23 if($row["v_value"]=="100") // for calulating total number 100 values if function
- 24 {
- 25 $hun++; //adding count of 100
- 26 }
- 27
- 28 if ($row["v_value"]=="300") // for calulating total number 300 values if function
- 29 {
- 30 $twohun++; //adding count of 300
- 31 }
- 32
- 33 if ($row["v_value"]=="500") // for calulating total number 500 values if function
- 34 {
- 35 $threehun++; //adding count of 500
- 36 }
- 37
- 38 if ($row["v_value"]=="1000") // for calulating total number 1000 values if function
- 39 {
- 40 $thous++; //adding count of 1000
- 41 }
- 42 ?>
- 43
- 44 <?php
- 45 }
- 46 ?>
- 47
- 48 </table>
- 49 <table border="1" align="center" id="example" class="display" style="width:20% ;">
- 50 <tr>
- 51 <td>Z-100</td>
- 52 <td>Z-300</td>
- 53 <td>Z-500</td>
- 54 <td>Z-1000</td>
- 55 </tr>
- 56 <tr>
- 57 <td><?php echo $hun; ?></td> <?php // showing value of 100?>
- 58 <td><?php echo $twohun; ?></td> <?php // showing value of 300?>
- 59 <td><?php echo $threehun; ?></td> <?php // showing value of 500?>
- 60 <td><?php echo $thous; ?></td> <?php // showing value of 1000?>
- 61 </tr>
- 62 </table>
- 63 <?php
- 64
- 65 $query=mysqli_query($con,"select * from purchased");
- 66 $rowcount=mysqli_num_rows($query);
- 67 $hun=0;
- 68 $fivhun=0;
- 69 $threehun=0;
- 70 $thous=0;
- 71 $z100=0;
- 72 $z300=0;
- 73 $z500=0;
- 74 $z1000=0;
- 75 $t100=0;
- 76 $t300=0;
- 77 $t500=0;
- 78 $t1000=0;
- 79 $j100=0;
- 80 $j300=0;
- 81 $j500=0;
- 82 $j1000=0;
- 83
- 84
- 85 ?>
- 86 <h3>Count of vouchers sold</h3>
- 87 <table border="1" align="center" id="example" class="display" style="width:50% ;text-align: center;" >
- 88 <tr>
- 89 <td>Z-100</td>
- 90 <td>Z-300</td>
- 91 <td>Z-500</td>
- 92 <td>Z-1000</td>
- 93 <td>T-100</td>
- 94 <td>T-300</td>
- 95 <td>T-500</td>
- 96 <td>T-1000</td>
- 97 <td>J-100</td>
- 98 <td>J-300</td>
- 99 <td>J-500</td>
- 100 <td>J-1000</td>
- 101 </tr>
- 102
- 103
- 104 <?php
- 105 for($i=1;$i<=$rowcount;$i++)
- 106 {
- 107 $row=mysqli_fetch_array($query);
- 108 if($row["item_name"]=="Zong-100" )
- 109 {
- 110 $z100+= $row["quantity"];
- 111 }
- 112
- 113 if($row["item_name"]=="Zong-300" )
- 114 {
- 115 $z300+= $row["quantity"];
- 116 }
- 117
- 118 if($row["item_name"]=="Zong-500")
- 119 {
- 120 $z500+= $row["quantity"];
- 121 }
- 122
- 123 if($row["item_name"]=="Zong-1000" )
- 124 {
- 125 $z1000+= $row["quantity"];
- 126 }
- 127
- 128
- 129 if($row["item_name"]=="Telenor-100" )
- 130 {
- 131 $t100+= $row["quantity"];
- 132 }
- 133
- 134
- 135 if($row["item_name"]=="Telenor-300" )
- 136 {
- 137 $t300+= $row["quantity"];
- 138 }
- 139
- 140
- 141 if($row["item_name"]=="Telenor-500" )
- 142 {
- 143 $t500+= $row["quantity"];
- 144 }
- 145
- 146
- 147 if($row["item_name"]=="Telenor-1000" )
- 148 {
- 149 $t1000+= $row["quantity"];
- 150 }
- 151
- 152
- 153 if($row["item_name"]=="Jazz-100" )
- 154 {
- 155 $j100+= $row["quantity"];
- 156 }
- 157
- 158
- 159 if($row["item_name"]=="Jazz-300" )
- 160 {
- 161 $j300+= $row["quantity"];
- 162 }
- 163
- 164
- 165 if($row["item_name"]=="Jazz-500" )
- 166 {
- 167 $j500+= $row["quantity"];
- 168 }
- 169
- 170
- 171 if($row["item_name"]=="Jazz-1000" )
- 172 {
- 173 $j1000+= $row["quantity"];
- 174 }
- 175
- 176
- 177 ?>
- 178 <tr>
- 179 <td><?php echo $z100; ?></td> <?php // showing value of 100?>
- 180 <td><?php echo $z300; ?></td> <?php // showing value of 300?>
- 181 <td><?php echo $z500; ?></td> <?php // showing value of 500?>
- 182 <td><?php echo $z1000; ?></td> <?php // showing value of 1000?>
- 183
- 184 <td><?php echo $t100; ?></td> <?php // showing value of 100?>
- 185 <td><?php echo $t300; ?></td> <?php // showing value of 300?>
- 186 <td><?php echo $t500; ?></td> <?php // showing value of 500?>
- 187 <td><?php echo $t1000; ?></td> <?php // showing value of 1000?>
- 188 <td><?php echo $j100; ?></td> <?php // showing value of 100?>
- 189 <td><?php echo $j300; ?></td> <?php // showing value of 300?>
- 190 <td><?php echo $j500; ?></td> <?php // showing value of 500?>
- 191 <td><?php echo $j1000; ?></td> <?php // showing value of 1000?>
- 192 </tr>
- 193
- 194 <?php
- 195 }
- 196
- 197 ?>
- 198
- 199
- 200 </table>