Advertisement
Guest User

Untitled

a guest
Nov 15th, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. <?php
  2. $upto_date = '00-00-0000';
  3.                    
  4. function is_customer($kb){
  5.     global $debit_total, $upto_date;
  6.     $id = $kb['id'];
  7.     $customer = mysql_query("SELECT * FROM customer WHERE id = '$id' ");
  8.     if(mysql_num_rows($customer) ==1 ){
  9.         $cu = mysql_fetch_assoc($customer);
  10.              $temp = $cu['grand_total'];       
  11.              $str = str_replace(array('.', ','), '' , $temp);
  12.              $debit_total = $debit_total + $str;
  13.              
  14.             $temp_date = strtotime($cu['date']);
  15.             $temp_upto = strtotime($upto_date);
  16.            
  17.              echo "DATE: " . $temp_date . "UPTO: " . $upto_date;
  18.              if($temp_date <= $temp_upto){
  19.                 echo "<tr id='highlight'>";
  20.             }else{
  21.                 echo "<tr>";
  22.                 }
  23.                
  24. ?>
  25.  
  26. <?php
  27. function is_reciept($kb){
  28.     global $credit_total, $discount_total, $gr_total;
  29.     $id = $kb['id'];
  30.     $reciept = mysql_query("SELECT * FROM receipt WHERE id = '$id' ");
  31.     if(mysql_num_rows($reciept) ==1 ){
  32.         $re = mysql_fetch_assoc($reciept); 
  33.        
  34.         global $upto_date;
  35.         if(empty($re['upto'])){
  36.             $upto_date = '00-00-0000'; 
  37.         }else{
  38.             $upto_date = strtotime($re['upto']);
  39.             }
  40.            
  41.         $temp = $re['received_amount'];        
  42.         $str = str_replace(array('.', ','), '' , $temp);
  43.         $credit_total = $credit_total + $str;
  44.        
  45.         $temp = $re['discount_amount'];        
  46.         $str = str_replace(array('.', ','), '' , $temp);
  47.         $discount_total = $discount_total + $temp;
  48.        
  49.         $temp = $re['gr_amount'];      
  50.         $str = str_replace(array('.', ','), '' , $temp);
  51.         $gr_total = $gr_total + $temp;
  52. ?>
  53.  
  54. //BOTH OF THESE FUNCTION ARE CALLED REPEATEDLY BECAUSE THEY ARE IN A LOOP.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement