<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/

// +----------------------------------------------------------------------+

// | PHP version 4/5                                                      |

// +----------------------------------------------------------------------+

// | Copyright (c) 2004-2010 ARMIA INC                                    |

// +----------------------------------------------------------------------+

// | This source file is a part of iScripts VistaCart                     |

// +----------------------------------------------------------------------+

// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |

// +----------------------------------------------------------------------+

class State extends AppModel

{

   var $name = 'State';

  // var $belongsTo = 'Country'; 

      function updateAllTax($cid,$tname,$tval)
	  {
		$Db = ConnectionManager::getDataSource($this->useDbConfig);
		$cattbl = $Db->fullTableName('states');	
		$res=$this->query("UPDATE ".$cattbl." set tax_name='".$tname."',tax_rate='".$tval."' where country_id='".$cid."'");
		return true;
       }
	   function updateTax($cid,$code,$tname,$tval)
	  {
		$Db = ConnectionManager::getDataSource($this->useDbConfig);
		$cattbl = $Db->fullTableName('states');	
		$res=$this->query("UPDATE ".$cattbl." set tax_name='".$tname."',tax_rate='".$tval."' where country_id='".$cid."' AND code='".$code."'");
		//$res=$this->query("UPDATE ".$cattbl." set tax_name='',tax_rate='' where country_id='".$cid."' AND code <>'".$code."'");
		return true;
       }   

}

?>