<?php

class WhtPaymentTax {

	/*************************************************
	/ This function add new WhtPaymentTax
	*************************************************/
	
	public static function AddWhtPaymentTax($data) {
		global $db;
				
		$id = $db->query_insert(TABLE_WHT_PAYMENT_EXPENSE, $data);
		if($db->affected_rows > 0){
			//$db->query_insert("vrs_logs", $data);
			return $id;
		}else{
			return false;
		}
	
	} // AddPayment

	/*************************************************
	/ This function update WhtPaymentTax
	*************************************************/
	
	public static function UpdateWhtPaymentTax($pid,$data) {
		global $db;
				
		$id = $db->query_update(TABLE_WHT_PAYMENT_EXPENSE,$data,"id='$pid'");
		
		if($db->affected_rows > 0){
			//$db->query_insert("vrs_logs", $data);
			
			return $id;
		}else{
			return $id;
		}
	
	} // UpdatePayment


	public static function GetWhtPaymentTaxSetupById($id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_WHT_PAYMENT_EXPENSE." WHERE id ='$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
   //   echo '<pre>';
//print_r($rows);  // Print the result (array or object)
//echo '</pre>';
	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//Payment

	public static function GetWhtPaymentTaxSetupByNumber($number) {

		global $db;
		$query = "SELECT * from ".TABLE_WHT_PAYMENT_EXPENSE." WHERE payment_no ='$number'";
		//print($query);exit;
		$rows = $db->query_first($query);

		if($db->affected_rows > 0){

			return $rows;
		}else{

			return false;
		}
	}//Payment
	
	/**********************************************************
	/ This function will return Payment
	**********************************************************/
		
	public static function GetWhtPaymentTaxList($filter="",$pageno="null",$pagesize="null") {
	
		global $db;
		$query = "SELECT * from ".TABLE_WHT_PAYMENT_EXPENSE." ". $filter;
		//print($query);
		$rows = $db->fetch_all_array($query,$pageno,$pagesize);
      
        //echo '<pre>';
      //  print_r($rows);  // Print the result (array or object)
      //  echo '</pre>';
	
			if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//Payment

	
public static function DeleteWhtPaymentTax($id) {
    global $db;
    $query = "DELETE FROM " . TABLE_WHT_PAYMENT_EXPENSE . " WHERE id = '$id'";
    $db->query($query);

    if ($db->affected_rows > 0) {
        return true;
    } else {
        return false;
    }
}


	public static function GetNumRows() { global $db; return $db->GetNumRows(); }
	public static function GetNumberOfPages() { global $db; return $db->GetNumberOfPages(); }
		
	
}

?>
