//print_r($row); } /* if units are <= 100 then charge Rs 1 rupee/unit if units are > 100 && <= 200 then charge Rs 2 rupee/unit if units are > 200 && <= 300 then charge Rs 3 rupee/unit if units are > 300then charge Rs 7 rupee/unit if($units > 100){ */ //echo netPriceCals(301); echo calculate_bill(1500); ?>
return $bill; } $sel_qry = 'select *, sum(total_units) as ttl_units from usage_data where invoice_flag=0 group by consumer_id LIMIT 101'; $exec_qry = mysql_query($sel_qry) or die('Error, ' . $sel_qry . mysql_error()); $invoice_completed = array(); while($data = mysql_fetch_assoc($exec_qry)) { $cons_id = $data['consumer_id']; echo '<tr>'; echo '<td>' . $cons_id. '</td>' ; //echo '<td>' . $data['start_date']. '</td>' ; //echo '<td>' . $data['end_date']. '</td>' ; echo '<td>' . $data['meter_reading_start']. '</td>' ; echo '<td>' . $data['meter_reading_end']. '</td>' ; echo '<td>' . $data['ttl_units']. '</td>' ; echo '<td>₹ ' . calculate_bill($data['ttl_units']). '</td>' ; echo '</tr>'; //echo '<pre>'; //print_r($data); } ?> </tbody> </table> </div> <!-- end of Tables --> </div> </div> </div>