<?php 


if(count(get_included_files()) ==1) exit("Direct access not permitted.");?>
<?php
class DatabaseFunctions{
private $db_name;
    
private $tbl_ctmcd;
private $tbl_area;
private $tbl_chk;
private $tbl_factors;
private $tbl_gps;
private $tbl_gps_users;
private $tbl_kol;
private $tbl_maser;
private $tbl_naghd;
private $tbl_newsalsefactor;
private $tbl_prc;
private $tbl_report;
private $tbl_report_resualt;
private $tbl_setting;
private $tbl_tafseal;
private $tbl_users;
private $tbl_lasttot;
private $tbl_visitor_hasab;
private $tbl_visitor_kala;
private $tbl_cmps;


private $connectionss;
  
private $db = array("db_host" => 'localhost', "db_user" => 'root', "db_pass" => '');
 
    function __construct($db){
        $this -> db_name = 'shirazsa_prctest';
 
        $this -> tbl_ctmcd = "tbl_ctmcd";
        
        $this -> tbl_area = "area";
        $this -> tbl_chk = "chk";
        $this -> tbl_factors = "factors";
        $this -> tbl_gps = "gps";
        $this -> tbl_gps_users = "gps_users";
        $this -> tbl_kol = "kol";
        $this -> tbl_maser = "maser";
        $this -> tbl_naghd = "naghd";
        $this -> tbl_newsalsefactor = "newsalsefactor";
        $this -> tbl_prc = "prc";
        $this -> tbl_report = "report";
        $this -> tbl_report_resualt = "report_resualt";
        $this -> tbl_setting = "setting";
        $this -> tbl_tafseal = "tafseal";
        $this -> tbl_users = "users";
        $this -> tbl_lasttot = "lasttot";
        $this -> tbl_visitor_hasab = "visitor_hasab";
        $this -> tbl_visitor_kala = "visitor_kala";
        $this -> tbl_cmps = "cmps";
        
 
        $this -> connectionss = OdbcSimulator::getConnection(); 
        
   }
    
       
	function getConnection(){
		return $this -> connectionss;
	}

    
    //Get All Tables
    
    function convertinput($data){return iconv("UTF-8", "Windows-1256", $data);}
	function convertinputreversed($data){return iconv("Windows-1256","UTF-8", $data);}
	function convertdate($data){
		     $mdate = new DateTime($data);
                    return $mdate -> format("Ymd");
					}
    
    function chkusevalstore($uone, $utwo){

 
        $completeList=  array();
        $counter = 0;
        
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC chkuseval  @uname = $uone , @upass = $utwo");
        if(!$result){
              die("Failed To Fetch chkuseval");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                $bowl = array(
                    
                    "uid" => $this -> convertinput(OdbcSimulator::odbc_result($result, "ucid"))
                );
                
                  array_push($completeList, $bowl["uid"]);  
              }
            
        }
 
        return $completeList;
            
        
    }  
	
	    
    function chkuseval($uone, $utwo){

 
        $completeList=  array();
        $counter = 0;
        
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC chkuseval @status = '1', @uname = $uone , @upass = $utwo");
        if(!$result){
               die("Failed To Fetch chkusevalz  ");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                $bowl = array(
                    
                    "uid" => $this -> convertinput(OdbcSimulator::odbc_result($result, "ucid"))
                );
                
                  array_push($completeList, $bowl["uid"]);  
              }
            
        }
 
        return $completeList;
            
        
    }
	
	
    function isuseexi($uone, $utwo){

        $completeList= false;
        $counter = 0;
 
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC isuseexi @uname = $uone , @upass = $utwo");
        if(!$result){
              die("Failed To Fetch isuseexi");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                $completeList= true;
                 
              }
            
        }
        
     
        return $completeList;
            
        
    }
    function addvaluse($us,$pas){
        $cnrId = "asdw_".bin2hex(openssl_random_pseudo_bytes(10));
        $ust = "1";
        
      $isvaliduser = $this -> isuseexi($us, $pas);
        
      if(!$isvaliduser){ 
          
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addvaluse @uname = $us , @upass = $pas, @ucid = $cnrId, @status = $ust");
        if(!$result){
              die("Failed To Fetch addvaluse");
         }else{
            
             return !$isvaliduser;
            
         }
            
        }else{
            
            return $isvaliduser;
            
        }
 
  
    }   
    function updatevaluses($us,$pas,$st,$npas,$nus){

        
        $isvaliduser = $this -> isuseexi($us, $pas);
        
       if($isvaliduser){
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatevaluses @status = $st,@uname = $nus , @upass = $npas,@uname = $us , @upass = $pas");
        if(!$result){
              die("Failed To Fetch updatevaluses");
         }else{
            
             return $isvaliduser;
            
        }
           
       }else{

         return $isvaliduser;
           
       }
        
        
       
        
  
    }
    
    //NEWS
    function checkfornews($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
        
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkfornews @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkfornews");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }   
 
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatenews($matn,$radif,$idpayment,$wi,$us,$pas){

        
       $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
        
          $matn = $this -> convertinput($matn);
          $radif = $this -> convertinput($radif);
          $idpayment = $this -> convertinput($idpayment);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatenews @rowi = $wi, @ucid = $ucd, @matn = N'".$matn."', @radif = $radif, @idpayment = $idpayment");
           
         if(!$result){
              die("Failed To Fetch updatenews");
         }   
 
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addnews($matn,$radif,$idpayment,$wi,$us,$pas){ 
	
	

        
        $valdata = $this -> chkusevalstore($us, $pas);

        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
          $matn = $this -> convertinput($matn);
          $radif = $this -> convertinput($radif);
          $idpayment = $this -> convertinput($idpayment);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addnews @rowi = $wi, @ucid = $ucd, @matn = N'".$matn."', @radif = $radif, @idpayment = $idpayment");
           
         if(!$result){
              die("Failed To Fetch addnews");
         }   

           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletenews($us,$pas,$wi){
        $cj=false;
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletenews @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletenews");
         }
 
       
       }
        
        
        
        
    }
	    
    
    
    //Categories
    function handleCategories($nam,$wi,$us,$pas){

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
          $ucd = $valdata[0];
        
          $nam = $this -> convertinput($nam);
          $wi = $this -> convertinput($wi);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC handleCategories @rowi = $wi, @ucid = $ucd, @nam = N'".$nam."'");
           
         if(!$result){
              die("Failed To Fetch handleKalaGroup");
         }   
 
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function deleteCategories($us,$pas,$wi){
        $cj=false;
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deleteCategories @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deleteCategories");
         }
 
       
       }
        
        
        
        
    }
    
     
 
            
    //Brands
    function handleBrands($nam,$wi,$us,$pas){

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
          $ucd = $valdata[0];
        
          $nam = $this -> convertinput($nam);
          $wi = $this -> convertinput($wi);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC handleBrands @rowi = $wi, @ucid = $ucd, @nam = N'".$nam."'");
		// $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC handleBrands @rowi = $wi, @ucid = $ucd, @nam = 'asd'");  
           
         if(!$result){
              die("Failed To Fetch handleBrands");
         }   
 
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function deleteBrands($us,$pas,$wi){
        $cj=false;
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deleteBrands @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deleteBrands");
         }
 
       
       }
        
        
        
        
    }
    
     
 
        
    
    //KalaGroup
    function handleKalaGroup($nam,$groupcode,$picpath,$wi,$us,$pas){

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
          $ucd = $valdata[0];
        
          $nam = $this -> convertinput($nam);
          $groupcode = $this -> convertinput($groupcode);
          $picpath = $this -> convertinput($picpath);
          $wi = $this -> convertinput($wi);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC handleKalaGroup @rowi = $wi, @ucid = $ucd, @nam = N'".$nam."', @groupcode = N'".$groupcode."', @picpath = $picpath");
           
         if(!$result){
              die("Failed To Fetch handleKalaGroup");
         }   
 
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function deleteKalaGroup($us,$pas,$wi){
        $cj=false;
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletekalagroup @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deleteKalaGroup");
         }
 
       
       }
        
        
        
        
    }
    
     
    
        
    //Messages
    function handlemessages($matn,$dat,$idvisitor,$wi,$us,$pas){

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
          $ucd = $valdata[0];
        
          $matn = $this -> convertinput($matn);
          $dat = $this -> convertinput($dat);
          $idvisitor = $this -> convertinput($idvisitor);
          $wi = $this -> convertinput($wi);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC handlemessages @rowi = $wi, @ucid = $ucd, @matn = N'".$matn."', @dat = N'".$dat."', @idvisitor = $idvisitor");
           
         if(!$result){
              die("Failed To Fetch handlemessages");
         }   
 
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function deletemessages($us,$pas,$wi){
        $cj=false;
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletemessages @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletemessages");
         }
 
       
       }
        
        
        
        
    }
    
        
        
    //Area
    function checkforarea($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
        
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforarea @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforarea");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }   
 
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatearea($area_nam,$stut,$area_cod,$precod_area,$wi,$us,$pas){

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
        
          $area_nam = $this -> convertinput($area_nam);
          $stut = $this -> convertinput($stut);
          $area_cod = $this -> convertinput($area_cod);
          $precod_area = $this -> convertinput($precod_area);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatearea @rowi = $wi, @ucid = $ucd, @area_nam = N'".$area_nam."', @stut = $stut, @area_cod = $area_cod, @precod_area = $precod_area");
           
         if(!$result){
              die("Failed To Fetch updatearea");
         }   
 
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
	
    function addarea($area_nam,$stut,$area_cod,$precod_area,$wi,$us,$pas){ 
	
	

        
        $valdata = $this -> chkuseval($us, $pas);

        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
          $area_nam = $this -> convertinput($area_nam);
          $stut = $this -> convertinput($stut);
          $area_cod = $this -> convertinput($area_cod);
          $precod_area = $this -> convertinput($precod_area);
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addarea @rowi = $wi, @ucid = $ucd, @area_nam = N'".$area_nam."', @stut = $stut, @area_cod = $area_cod, @precod_area = $precod_area");
           
         if(!$result){
              die("Failed To Fetch addarea");
         }   

           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletearea($us,$pas,$wi){
        $cj=false;
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletearea @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletearea");
         }
 
       
       }
        
        
        
        
    }
    
    
    //CHK       
    function checkforchk($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforchk @ucid = $ucd, @rowi = $wi");
         if(!$result){
              die("Failed To Fetch checkforarea");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }   
  
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatechk($sh, $mab, $nowdate, $paydate, $idcast, $sharh, $bank, $numfacto, $totid, $stut, $idbank, $idcstt, $idfax, $shhasab, $travel, $exitdate, $idtafseal, $idts, $tz, $idkarpardaz, $fn_stut, $idoutput, $rec_nam, $city, $chk_stut, $del_chk_stut, $idvosuli, $knam, $faxbank, $idcsttnam, $yad, $d_sms, $id_daryaft, $esterdad, $ebtal,$wi,$us,$pas){
        

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
        
         $sh = $this -> convertinput($sh);
         $mab = $this -> convertinput($mab);
         $nowdate = $this -> convertinput($nowdate);
         $paydate = $this -> convertinput($paydate);
         $idcast = $this -> convertinput($idcast);
         $sharh = $this -> convertinput($sharh); 
         $bank = $this -> convertinput($bank);
         $numfacto = $this -> convertinput($numfacto);
         $totid = $this -> convertinput($totid);
         $stut = $this -> convertinput($stut);
         $idbank = $this -> convertinput($idbank);
         $idcstt = $this -> convertinput($idcstt);
         $idfax = $this -> convertinput($idfax);
         $shhasab = $this -> convertinput($shhasab);
         $travel = $this -> convertinput($travel);
         $exitdate = $this -> convertinput($exitdate);
         $idtafseal = $this -> convertinput($idtafseal);
         $idts = $this -> convertinput($idts);
         $tz = $this -> convertinput($tz);
         $idkarpardaz = $this -> convertinput($idkarpardaz);
         $fn_stut = $this -> convertinput($fn_stut);
         $idoutput = $this -> convertinput($idoutput);
         $rec_nam = $this -> convertinput($rec_nam);
         $city = $this -> convertinput($city);
         $chk_stut = $this -> convertinput($chk_stut);
         $del_chk_stut = $this -> convertinput($del_chk_stut);
         $idvosuli = $this -> convertinput($idvosuli);
         $knam = $this -> convertinput($knam);
         $faxbank = $this -> convertinput($faxbank);
         $idcsttnam = $this -> convertinput($idcsttnam);
         $yad = $this -> convertinput($yad);
         $d_sms = $this -> convertinput($d_sms);
         $id_daryaft = $this -> convertinput($id_daryaft);
         $esterdad = $this -> convertinput($esterdad);
         $ebtal = $this -> convertinput($ebtal);
         
         	
		 $idcstt = (strlen($idcstt) == 0) ? 'null': $idcstt;
		 $tz = (strlen($tz) == 0) ?  'null' : $tz;
		 $rec_nam = (strlen($rec_nam) == 0) ?  'null' : $rec_nam;
		 $city = (strlen($city) == 0) ?  'null' : $city;
		 $chk_stut = (strlen($chk_stut) == 0) ?  'null' : $chk_stut;
		 $yad = (strlen($yad) == 0) ?  'null' : $yad;
		 $id_daryaft = (strlen($id_daryaft) == 0) ?  'null' : $id_daryaft;
		 
		 $nowdate = $this -> convertdate($nowdate);   
		 $paydate = $this -> convertdate($paydate);   
		 $exitdate = $this -> convertdate($exitdate);   
		   	 
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatechk  @sh = N'".$sh."',  @mab = $mab,  @nowdate = '".$nowdate."',  @paydate = '".$paydate."',  @idcast = $idcast,  @sharh = N'".$sharh."',  @bank = N'".$bank."',  @numfacto = N'".$numfacto."',  @totid = $totid,  @stut = $stut,  @idbank = $idbank,  @idcstt = ".$idcstt.",  @idfax = $idfax,  @shhasab = N'".$shhasab."',  @travel = $travel,  @exitdate = '".$exitdate."',  @idtafseal = $idtafseal,  @idts = $idts,  @tz = ".$tz.",  @idkarpardaz = $idkarpardaz,  @fn_stut = $fn_stut,  @idoutput = $idoutput,  @rec_nam = N'".$rec_nam."',  @city = N'".$city."',  @chk_stut = N'".$chk_stut."',  @del_chk_stut = $del_chk_stut,  @idvosuli = $idvosuli,  @knam = N'".$knam."',  @faxbank = N'".$faxbank."',  @idcsttnam = N'".$idcsttnam."',  @yad = N'".$yad."',  @d_sms = $d_sms,  @id_daryaft = ".$id_daryaft.",  @esterdad = $esterdad,  @ebtal = $ebtal, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatechk");
         }      

           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addchk($sh, $mab, $nowdate, $paydate, $idcast, $sharh, $bank, $numfacto, $totid, $stut, $idbank, $idcstt, $idfax, $shhasab, $travel, $exitdate, $idtafseal, $idts, $tz, $idkarpardaz, $fn_stut, $idoutput, $rec_nam, $city, $chk_stut, $del_chk_stut, $idvosuli, $knam, $faxbank, $idcsttnam, $yad, $d_sms, $id_daryaft, $esterdad, $ebtal,$wi,$us,$pas){ 
        

        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
          $sh = $this -> convertinput($sh);
         $mab = $this -> convertinput($mab);
         $nowdate = $this -> convertinput($nowdate);
          $paydate = $this -> convertinput($paydate);
          $idcast = $this -> convertinput($idcast);
         $sharh = $this -> convertinput($sharh); 
        $bank = $this -> convertinput($bank);
         $numfacto = $this -> convertinput($numfacto);
        $totid = $this -> convertinput($totid);
         $stut = $this -> convertinput($stut);
         $idbank = $this -> convertinput($idbank);
          $idcstt = $this -> convertinput($idcstt);
         $idfax = $this -> convertinput($idfax);
         $shhasab = $this -> convertinput($shhasab);
        $travel = $this -> convertinput($travel);
        $exitdate = $this -> convertinput($exitdate);
        $idtafseal = $this -> convertinput($idtafseal);
        $idts = $this -> convertinput($idts);
       $tz = $this -> convertinput($tz);
          $idkarpardaz = $this -> convertinput($idkarpardaz);
         $fn_stut = $this -> convertinput($fn_stut);
        $idoutput = $this -> convertinput($idoutput);
        $rec_nam = $this -> convertinput($rec_nam);
        $city = $this -> convertinput($city);
        $chk_stut = $this -> convertinput($chk_stut);
        $del_chk_stut = $this -> convertinput($del_chk_stut);
        $idvosuli = $this -> convertinput($idvosuli);
       $knam = $this -> convertinput($knam);
          $faxbank = $this -> convertinput($faxbank);
         $idcsttnam = $this -> convertinput($idcsttnam);
          $yad = $this -> convertinput($yad);
         $d_sms = $this -> convertinput($d_sms);
         $id_daryaft = $this -> convertinput($id_daryaft);
          $esterdad = $this -> convertinput($esterdad);
        $ebtal = $this -> convertinput($ebtal);   
           
		

		 $idcstt = (strlen($idcstt) == 0) ? 'null': $idcstt;
		 $tz = (strlen($tz) == 0) ?  'null' : $tz;
		 $rec_nam = (strlen($rec_nam) == 0) ?  'null' : $rec_nam;
		 $city = (strlen($city) == 0) ?  'null' : $city;
		 $chk_stut = (strlen($chk_stut) == 0) ?  'null' : $chk_stut;
		 $yad = (strlen($yad) == 0) ?  'null' : $yad;
		 $id_daryaft = (strlen($id_daryaft) == 0) ?  'null' : $id_daryaft;
		 
		 $nowdate = $this -> convertdate($nowdate);   
		 $paydate = $this -> convertdate($paydate);   
		 $exitdate = $this -> convertdate($exitdate);   
		   
		   
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addchk  @sh = N'".$sh."',  @mab = $mab,  @nowdate = '".$nowdate."',  @paydate = '".$paydate."',  @idcast = $idcast,  @sharh = N'".$sharh."',  @bank = N'".$bank."',  @numfacto = N'".$numfacto."',  @totid = $totid,  @stut = $stut,  @idbank = $idbank,  @idcstt = ".$idcstt.",  @idfax = $idfax,  @shhasab = N'".$shhasab."',  @travel = $travel,  @exitdate = '".$exitdate."',  @idtafseal = $idtafseal,  @idts = $idts,  @tz = ".$tz.",  @idkarpardaz = $idkarpardaz,  @fn_stut = $fn_stut,  @idoutput = $idoutput,  @rec_nam = N'".$rec_nam."',  @city = N'".$city."',  @chk_stut = N'".$chk_stut."',  @del_chk_stut = $del_chk_stut,  @idvosuli = $idvosuli,  @knam = N'".$knam."',  @faxbank = N'".$faxbank."',  @idcsttnam = N'".$idcsttnam."',  @yad = N'".$yad."',  @d_sms = $d_sms,  @id_daryaft = ".$id_daryaft.",  @esterdad = $esterdad,  @ebtal = $ebtal, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addchk");
         }      
 
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletechk($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletechk @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletechk");
         }

       }

    }
    
    
    //FACTORS    
    function checkforfactors($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
        
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforfactors @ucid = $ucd, @rowi = $wi");
         if(!$result){
              die("Failed To Fetch checkforfactors");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }      
 
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatefactors($cod_cast, $tasvieh, $day_numb, $usernam, $factorid, $count_kala, $yad, $dat ,$wi,$us,$pas){
        

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
        
        $cod_cast = $this -> convertinput($cod_cast);   
        $tasvieh = $this -> convertinput($tasvieh);   
        $day_numb = $this -> convertinput($day_numb);   
        $usernam = $this -> convertinput($usernam);   
        $factorid = $this -> convertinput($factorid);   
        $count_kala = $this -> convertinput($count_kala);   
        $yad = $this -> convertinput($yad);   
        $dat = $this -> convertinput($dat);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatefactors  @cod_cast = $cod_cast, @tasvieh = $tasvieh, @day_numb = $day_numb, @usernam = $usernam, @factorid = $factorid, @count_kala = $count_kala, @yad = $yad, @dat = $dat, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatefactors");
         }         
 
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addfactors($cod_cast, $tasvieh, $day_numb, $usernam, $factorid, $count_kala, $yad, $dat ,$wi,$us,$pas){ 
        

        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
         
        $cod_cast = $this -> convertinput($cod_cast);   
        $tasvieh = $this -> convertinput($tasvieh);   
        $day_numb = $this -> convertinput($day_numb);   
        $usernam = $this -> convertinput($usernam);   
        $factorid = $this -> convertinput($factorid);   
        $count_kala = $this -> convertinput($count_kala);   
        $yad = $this -> convertinput($yad);   
        $dat = $this -> convertinput($dat); 
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addfactors  @cod_cast = $cod_cast, @tasvieh = $tasvieh, @day_numb = $day_numb, @usernam = $usernam, @factorid = $factorid, @count_kala = $count_kala, @yad = $yad, @dat = $dat, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addfactors");
         }        
 
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletefactors($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
         $ucd = $valdata[0];
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletefactors @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletefactors");
         }
       
       }
 
    }  
    
    
    //GPS
    function checkforgps($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
        
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforgps @ucid = $ucd, @rowi = $wi");
         if(!$result){
              die("Failed To Fetch checkforgps");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }         
 
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updategps($idcast, $x, $y, $p1, $dat, $wi, $us, $pas){
        

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
        
        $idcast = $this -> convertinput($idcast);   
        $x = $this -> convertinput($x);   
        $y = $this -> convertinput($y);   
        $p1 = $this -> convertinput($p1);   
        $dat = $this -> convertinput($dat);   
           
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updategps  @idcast = $idcast, @x = $x, @y = $y, @p1 = $p1, @dat = $dat, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updategps");
         }           
 
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addgps($idcast, $x, $y, $p1, $dat, $wi, $us, $pas){ 
        
          

        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
        $idcast = $this -> convertinput($idcast);   
        $x = $this -> convertinput($x);   
        $y = $this -> convertinput($y);   
        $p1 = $this -> convertinput($p1);   
        $dat = $this -> convertinput($dat);   
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addgps  @idcast = $idcast, @x = $x, @y = $y, @p1 = $p1, @dat = $dat, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addgps");
         }           

           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletegps($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletegps @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletegps");
         }
 
       }
 
        
    }  
    
    
    
    //GpsUsers
    function checkforgpsusers($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforgpsusers @ucid = $ucd, @rowi = $wi");
         if(!$result){
              die("Failed To Fetch checkforgpsusers");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }         
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updategpsusers($sharkatnam, $pass, $wi, $us, $pas){
        

        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 
         $sharkatnam = $this -> convertinput($sharkatnam);  
         $pass = $this -> convertinput($pass);  
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updategpsusers  @sharkatnam = $sharkatnam, @pass = $pass, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updategpsusers");
         }     
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addgpsusers($sharkatnam, $pass, $wi, $us, $pas){ 
        
          

        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
         $sharkatnam = $this -> convertinput($sharkatnam);  
         $pass = $this -> convertinput($pass);  
          
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addgpsusers  @sharkatnam = $sharkatnam, @pass = $pass, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addgpsusers");
         }     
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletegpsusers($us,$pas,$wi){
        $cj=false;

        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletegpsusers @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletegpsusers");
         }
       
       
       }
        
        
        
        
    }  
    
     
    //KOL
    function checkforkol($us,$pas,$wi){
        $cj=false;
   
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforkol @ucid = $ucd, @rowi = $wi");
         if(!$result){
              die("Failed To Fetch checkforkol");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }         
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatekol($idkol, $sharh, $stut, $koltypeid, $lockstut, $taraztypeid, $idold, $is_cast, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 
         $idkol = $this -> convertinput($idkol);  
         $sharh = $this -> convertinput($sharh);  
         $stut = $this -> convertinput($stut);  
         $koltypeid = $this -> convertinput($koltypeid);  
         $lockstut = $this -> convertinput($lockstut);  
         $taraztypeid = $this -> convertinput($taraztypeid);  
         $idold = $this -> convertinput($idold);  
         $is_cast = $this -> convertinput($is_cast);  
           
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatekol  @idkol = $idkol, @sharh = $sharh, @stut = $stut, @koltypeid = $koltypeid, @lockstut = $lockstut, @taraztypeid = $taraztypeid, @idold = $idold, @is_cast = $is_cast, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatekol");
         }        
           
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addkol($idkol, $sharh, $stut, $koltypeid, $lockstut, $taraztypeid, $idold, $is_cast, $wi, $us, $pas){ 
        
          
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 
         $idkol = $this -> convertinput($idkol);  
         $sharh = $this -> convertinput($sharh);  
         $stut = $this -> convertinput($stut);  
         $koltypeid = $this -> convertinput($koltypeid);  
         $lockstut = $this -> convertinput($lockstut);  
         $taraztypeid = $this -> convertinput($taraztypeid);  
         $idold = $this -> convertinput($idold);  
         $is_cast = $this -> convertinput($is_cast);  
                   
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addkol  @idkol = $idkol, @sharh = $sharh, @stut = $stut, @koltypeid = $koltypeid, @lockstut = $lockstut, @taraztypeid = $taraztypeid, @idold = $idold, @is_cast = $is_cast, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addkol");
         }    
           
           return true;
           
           
           
           
       }else{
           
           return false;
       }
        

  
    }
    function deletekol($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletegpsusers @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletegpsusers");
         }
       
       
       }
        
        
        
        
    }  

    //LASTOT
    function checkforlasttot($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforlasttot @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforlasttot");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }         
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatelasttot($idcast, $mand, $tsh, $datz, $sum1, $sum2, $sum3, $sum4, $ref, $refranking, $dattasvie, $trans , $factors , $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
  
           $idcast = $this -> convertinput($idcast);  
           $mand = $this -> convertinput($mand);  
           $tsh = $this -> convertinput($tsh);  
           $datz = $this -> convertinput($datz);  
           $sum1 = $this -> convertinput($sum1);  
           $sum2 = $this -> convertinput($sum2);  
           $sum3 = $this -> convertinput($sum3);  
           $sum4 = $this -> convertinput($sum4);  
           $ref = $this -> convertinput($ref);  
           $refranking = $this -> convertinput($refranking);  
           $dattasvie = $this -> convertinput($dattasvie);  
           $trans = $this -> convertinput($trans);  
           $factors = $this -> convertinput($factors);  
		   
         $dattasviez = (strlen($dattasvie) == 0) ? 'null': $this -> convertdate($dattasvie);
		 $datz = $this -> convertdate($datz);
		   
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatelasttot @idcast = $idcast, @mand = $mand, @tsh = N'".$tsh."', @dat = N'".$datz."', @sum1 = $sum1, @sum2 = $sum2, @sum3 = $sum3, @sum4 = $sum4, @ref = $ref, @refranking = $refranking, @dattasvie = N'".$dattasviez."', @trans = $trans, @factors = $factors, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatelasttot");
         }        
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addlasttot($idcast, $mand, $tsh, $datz, $sum1, $sum2, $sum3, $sum4, $ref, $ref_ranking, $dat_tasvie, $trans, $factors, $wi, $us, $pas){ 
        
          
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
           $idcast = $this -> convertinput($idcast);  
           $mand = $this -> convertinput($mand);  
           $tsh = $this -> convertinput($tsh);  
           $datz = $this -> convertinput($datz);  
           $sum1 = $this -> convertinput($sum1);  
           $sum2 = $this -> convertinput($sum2);  
           $sum3 = $this -> convertinput($sum3);  
           $sum4 = $this -> convertinput($sum4);  
           $ref = $this -> convertinput($ref);  
           $refranking = $this -> convertinput($ref_ranking);  
           $dattasvie = $this -> convertinput($dat_tasvie);  
           $trans = $this -> convertinput($trans);  
           $factors = $this -> convertinput($factors);  
          
         $dattasviez = (strlen($dattasvie) == 0) ? 'null': $this -> convertdate($dattasvie);
		 $datz = $this -> convertdate($datz);
         $result = odbc_exec($this -> getConnection(), "EXEC addlasttot @idcast = $idcast, @mand = $mand, @tsh = N'".$tsh."', @dat = N'".$datz."', @sum1 = $sum1, @sum2 = $sum2, @sum3 = $sum3, @sum4 = $sum4, @ref = $ref, @refranking = $refranking, @dattasvie = '".$dattasviez."', @trans = $trans, @factors = $factors, @rowi = $wi, @ucid = $ucd");
       
         if(!$result){
              die("Failed To Fetch addlasttot");
         }  
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletelasttot($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
			 
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletelasttot @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletelasttot");
         }
       
       
       }
        
        
        
        
    }  
    
    
    //Maser
    function checkformaser($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkformaser @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkformaser");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }       
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatemaser($maser_nam, $area_id, $stut, $visitor_id, $precod_maser, $wi, $us, $pas){
        
  
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
        $maser_nam = $this -> convertinput($maser_nam);  
        $area_id = $this -> convertinput($area_id);  
        $stut = $this -> convertinput($stut);  
        $visitor_id = $this -> convertinput($visitor_id);  
        $precod_maser = $this -> convertinput($precod_maser);  
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatemaser @maser_nam = N'".$maser_nam."', @area_id = $area_id, @stut = $stut, @visitor_id = $visitor_id, @precod_maser = $precod_maser, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatemaser");
         }       
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addmaser($maser_nam, $area_id, $stut, $visitor_id, $precod_maser, $wi, $us, $pas){ 
        
          
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
        $maser_nam = $this -> convertinput($maser_nam);  
        $area_id = $this -> convertinput($area_id);  
        $stut = $this -> convertinput($stut);  
        $visitor_id = $this -> convertinput($visitor_id);  
        $precod_maser = $this -> convertinput($precod_maser);   
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addmaser @maser_nam = N'".$maser_nam."', @area_id = $area_id, @stut = $stut, @visitor_id = $visitor_id, @precod_maser = $precod_maser, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addmaser");
         }
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletemaser($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletemaser @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletemaser");
         }
       
       
       }
        
        
        
        
    } 

    
        
    
    //Naghd
    function checkfornaghd($us,$pas,$wi){
        $cj=false;
  
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkfornaghd @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkfornaghd");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }       
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatenaghd($numfact, $idsanad, $bas, $bed, $dat, $stut, $sharh, $sstut, $yad, $idcast, $idcuruser, $curusernam, $lastrec, $idchk, $idpc, $firstrec, $idkol, $idmoin, $idtafseal, $item, $radifid, $takh, $mand, $tsh, $idsaz, $idbank, $salbon, $sarmaya, $pay, $nowdate, $edit, $date_edit, $iduser_edit, $idvisitor, $idvosuli, $rec_date, $rec_nam, $del_naghd_stut, $idoutput, $radifid_pakhsh, $bank_asi, $mab_taid, $yad_bank, $fdate, $edate, $mand_tasvie, $monprice, $koltype, $idrel, $shresid, $efte, $mand2, $tsh2, $radifid2, $send_sms, $id_tasvie, $id_daryaft, $id_sanadtmp_eft, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
         
          $numfact = $this -> convertinput($numfact);     
          $idsanad = $this -> convertinput($idsanad);     
          $bas = $this -> convertinput($bas);     
          $bed = $this -> convertinput($bed);     
          $dat = $this -> convertinput($dat);     
          $stut = $this -> convertinput($stut);     
          $sharh = $this -> convertinput($sharh);     
          $sstut = $this -> convertinput($sstut);     
          $yad = $this -> convertinput($yad);     
          $idcast = $this -> convertinput($idcast);     
          $idcuruser = $this -> convertinput($idcuruser);     
          $curusernam = $this -> convertinput($curusernam);     
          $lastrec = $this -> convertinput($lastrec);     
          $idchk = $this -> convertinput($idchk);     
          $idpc = $this -> convertinput($idpc);     
          $firstrec = $this -> convertinput($firstrec);     
          $idkol = $this -> convertinput($idkol);     
          $idmoin = $this -> convertinput($idmoin);     
          $idtafseal = $this -> convertinput($idtafseal);     
          $item = $this -> convertinput($item);     
          $radifid = $this -> convertinput($radifid);     
          $takh = $this -> convertinput($takh);     
          $mand = $this -> convertinput($mand);     
          $tsh = $this -> convertinput($tsh);     
          $idsaz = $this -> convertinput($idsaz);     
          $idbank = $this -> convertinput($idbank);     
          $salbon = $this -> convertinput($salbon);     
          $sarmaya = $this -> convertinput($sarmaya);     
          $pay = $this -> convertinput($pay);     
          $nowdate = $this -> convertinput($nowdate);     
          $edit = $this -> convertinput($edit);     
          $date_edit = $this -> convertinput($date_edit);     
          $iduser_edit = $this -> convertinput($iduser_edit);     
          $idvisitor = $this -> convertinput($idvisitor);     
          $idvosuli = $this -> convertinput($idvosuli);     
          $rec_date = $this -> convertinput($rec_date);     
          $rec_nam = $this -> convertinput($rec_nam);     
          $del_naghd_stut = $this -> convertinput($del_naghd_stut);     
          $idoutput = $this -> convertinput($idoutput);     
          $radifid_pakhsh = $this -> convertinput($radifid_pakhsh);     
          $bank_asi = $this -> convertinput($bank_asi);     
          $mab_taid = $this -> convertinput($mab_taid);     
          $yad_bank = $this -> convertinput($yad_bank);     
          $fdate = $this -> convertinput($fdate);     
          $edate = $this -> convertinput($edate);     
          $mand_tasvie = $this -> convertinput($mand_tasvie);     
          $monprice = $this -> convertinput($monprice);     
          $koltype = $this -> convertinput($koltype);     
          $idrel = $this -> convertinput($idrel);     
          $shresid = $this -> convertinput($shresid);     
          $efte = $this -> convertinput($efte);     
          $mand2 = $this -> convertinput($mand2);     
          $tsh2 = $this -> convertinput($tsh2);     
          $radifid2 = $this -> convertinput($radifid2);     
          $send_sms = $this -> convertinput($send_sms);     
          $id_tasvie = $this -> convertinput($id_tasvie);     
          $id_daryaft = $this -> convertinput($id_daryaft);     
          $id_sanadtmp_eft = $this -> convertinput($id_sanadtmp_eft);   
           
           
		   $dat = $this -> convertdate($dat);     
		   $nowdate = $this -> convertdate($nowdate);  
		   $date_edit = $this -> convertdate($date_edit);  
		   $rec_date = $this -> convertdate($rec_date);  
		   $fdate = $this -> convertdate($fdate);     
		   $edate = $this -> convertdate($edate);
		   
		   
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatenaghd @numfact = N'".$numfact."', @idsanad = $idsanad, @bas = $bas, @bed = $bed, @dat = '".$dat."', @stut = $stut, @sharh = N'".$sharh."', @sstut = $sstut, @yad = N'".$yad."', @idcast = $idcast, @idcuruser = $idcuruser, @curusernam = N'".$curusernam."', @lastrec = $lastrec, @idchk = $idchk, @idpc = $idpc, @firstrec = $firstrec, @idkol = $idkol, @idmoin = $idmoin, @idtafseal = $idtafseal, @item = $item, @radifid = $radifid, @takh = $takh, @mand = $mand, @tsh = N'".$tsh."', @idsaz = $idsaz, @idbank = $idbank, @salbon = $salbon, @sarmaya = $sarmaya, @pay = $pay, @nowdate = '".$nowdate."', @edit = $edit, @date_edit = '".$date_edit."', @iduser_edit = $iduser_edit, @idvisitor = $idvisitor, @idvosuli = $idvosuli, @rec_date = '".$rec_date."', @rec_nam = N'".$rec_nam."', @del_naghd_stut = $del_naghd_stut, @idoutput = $idoutput, @radifid_pakhsh = $radifid_pakhsh, @bank_asi = $bank_asi, @mab_taid = $mab_taid, @yad_bank = N'".$yad_bank."', @fdate = '".$fdate."', @edate = '".$edate."', @mand_tasvie = $mand_tasvie, @monprice = $monprice, @koltype = $koltype, @idrel = $idrel, @shresid = N'".$shresid."', @efte = $efte, @mand2 = $mand2, @tsh2 = N'".$tsh2."', @radifid2 = $radifid2, @send_sms = $send_sms, @id_tasvie = $id_tasvie, @id_daryaft = $id_daryaft, @id_sanadtmp_eft = $id_sanadtmp_eft, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatenaghd");
         }       
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addnaghd($numfact, $idsanad, $bas, $bed, $dat, $stut, $sharh, $sstut, $yad, $idcast, $idcuruser, $curusernam, $lastrec, $idchk, $idpc, $firstrec, $idkol, $idmoin, $idtafseal, $item, $radifid, $takh, $mand, $tsh, $idsaz, $idbank, $salbon, $sarmaya, $pay, $nowdate, $edit, $date_edit, $iduser_edit, $idvisitor, $idvosuli, $rec_date, $rec_nam, $del_naghd_stut, $idoutput, $radifid_pakhsh, $bank_asi, $mab_taid, $yad_bank, $fdate, $edate, $mand_tasvie, $monprice, $koltype, $idrel, $shresid, $efte, $mand2, $tsh2, $radifid2, $send_sms, $id_tasvie, $id_daryaft, $id_sanadtmp_eft, $wi, $us, $pas){ 
        
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
          $numfact = $this -> convertinput($numfact);     
          $idsanad = $this -> convertinput($idsanad);     
          $bas = $this -> convertinput($bas);     
          $bed = $this -> convertinput($bed);     
          $dat = $this -> convertinput($dat);     
          $stut = $this -> convertinput($stut);     
          $sharh = $this -> convertinput($sharh);     
          $sstut = $this -> convertinput($sstut);     
          $yad = $this -> convertinput($yad);     
          $idcast = $this -> convertinput($idcast);     
          $idcuruser = $this -> convertinput($idcuruser);     
          $curusernam = $this -> convertinput($curusernam);     
          $lastrec = $this -> convertinput($lastrec);     
          $idchk = $this -> convertinput($idchk);     
          $idpc = $this -> convertinput($idpc);     
          $firstrec = $this -> convertinput($firstrec);     
          $idkol = $this -> convertinput($idkol);     
          $idmoin = $this -> convertinput($idmoin);     
          $idtafseal = $this -> convertinput($idtafseal);     
          $item = $this -> convertinput($item);     
          $radifid = $this -> convertinput($radifid);     
          $takh = $this -> convertinput($takh);     
          $mand = $this -> convertinput($mand);     
          $tsh = $this -> convertinput($tsh);     
          $idsaz = $this -> convertinput($idsaz);     
          $idbank = $this -> convertinput($idbank);     
          $salbon = $this -> convertinput($salbon);     
          $sarmaya = $this -> convertinput($sarmaya);     
          $pay = $this -> convertinput($pay);     
          $nowdate = $this -> convertinput($nowdate);     
          $edit = $this -> convertinput($edit);     
          $date_edit = $this -> convertinput($date_edit);     
          $iduser_edit = $this -> convertinput($iduser_edit);     
          $idvisitor = $this -> convertinput($idvisitor);     
          $idvosuli = $this -> convertinput($idvosuli);     
          $rec_date = $this -> convertinput($rec_date);     
          $rec_nam = $this -> convertinput($rec_nam);     
          $del_naghd_stut = $this -> convertinput($del_naghd_stut);     
          $idoutput = $this -> convertinput($idoutput);     
          $radifid_pakhsh = $this -> convertinput($radifid_pakhsh);     
          $bank_asi = $this -> convertinput($bank_asi);     
          $mab_taid = $this -> convertinput($mab_taid);     
          $yad_bank = $this -> convertinput($yad_bank);     
          $fdate = $this -> convertinput($fdate);     
          $edate = $this -> convertinput($edate);     
          $mand_tasvie = $this -> convertinput($mand_tasvie);     
          $monprice = $this -> convertinput($monprice);     
          $koltype = $this -> convertinput($koltype);     
          $idrel = $this -> convertinput($idrel);     
          $shresid = $this -> convertinput($shresid);     
          $efte = $this -> convertinput($efte);     
          $mand2 = $this -> convertinput($mand2);     
          $tsh2 = $this -> convertinput($tsh2);     
          $radifid2 = $this -> convertinput($radifid2);     
          $send_sms = $this -> convertinput($send_sms);     
          $id_tasvie = $this -> convertinput($id_tasvie);     
          $id_daryaft = $this -> convertinput($id_daryaft);     
          $id_sanadtmp_eft = $this -> convertinput($id_sanadtmp_eft);   
           
           
		   $dat = $this -> convertdate($dat);     
		   $nowdate = $this -> convertdate($nowdate);  
		   $date_edit = $this -> convertdate($date_edit);  
		   $rec_date = $this -> convertdate($rec_date);  
		   $fdate = $this -> convertdate($fdate);     
		   $edate = $this -> convertdate($edate);
           
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addnaghd @numfact = N'".$numfact."', @idsanad = $idsanad, @bas = $bas, @bed = $bed, @dat = '".$dat."', @stut = $stut, @sharh = N'".$sharh."', @sstut = $sstut, @yad = N'".$yad."', @idcast = $idcast, @idcuruser = $idcuruser, @curusernam = N'".$curusernam."', @lastrec = $lastrec, @idchk = $idchk, @idpc = $idpc, @firstrec = $firstrec, @idkol = $idkol, @idmoin = $idmoin, @idtafseal = $idtafseal, @item = $item, @radifid = $radifid, @takh = $takh, @mand = $mand, @tsh = N'".$tsh."', @idsaz = $idsaz, @idbank = $idbank, @salbon = $salbon, @sarmaya = $sarmaya, @pay = $pay, @nowdate = '".$nowdate."', @edit = $edit, @date_edit = '".$date_edit."', @iduser_edit = $iduser_edit, @idvisitor = $idvisitor, @idvosuli = $idvosuli, @rec_date = '".$rec_date."', @rec_nam = N'".$rec_nam."', @del_naghd_stut = $del_naghd_stut, @idoutput = $idoutput, @radifid_pakhsh = $radifid_pakhsh, @bank_asi = $bank_asi, @mab_taid = $mab_taid, @yad_bank = N'".$yad_bank."', @fdate = '".$fdate."', @edate = '".$edate."', @mand_tasvie = $mand_tasvie, @monprice = $monprice, @koltype = $koltype, @idrel = $idrel, @shresid = N'".$shresid."', @efte = $efte, @mand2 = $mand2, @tsh2 = N'".$tsh2."', @radifid2 = $radifid2, @send_sms = $send_sms, @id_tasvie = $id_tasvie, @id_daryaft = $id_daryaft, @id_sanadtmp_eft = $id_sanadtmp_eft, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addnaghd");
         }   
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletenaghd($us,$pas,$wi){
        $cj=false;
   
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletenaghd @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletenaghd");
         }
       
       
       }
        
        
        
        
    } 
    
	
    
    
    
    //MainFPrc
    function checkforMainFPrc($us,$pas,$wi){
		
        $cj=false;
  
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkfornaghd @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch mainFPrc");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }       
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updateMainFPrc($cod, $numb, $idcast, $price, $box, $pric, $numfacto, $dat, $stut, $idtot, $mainid, $idanbar, $CNS, $IDBUY, $QMAND, $CPS, $COMBUY, $ptk, $wi, $tp, $qmandidbay, $transanbar, $dayt, $mont, $yeart, $bayt, $sealt, $sodt, $ag, $yad, $radifid, $per_ma, $per_av, $vi_numb, $id_sefaresh, $confirm_forush, $mab_ma, $mab_av, $giftriali, $ptk_gr, $giftriali_gr, $idprc, $per_visitor,
                       $lastpric, $add1, $add2, $add3, $takh1, $takh2, $takh3, $add4, $idtaf1, $idtaf2, $idtaf3, $idtaf4, $takh4, $ag_gift, $price_gift, $idmfprc_main, $tasvie, $mand_tasvie, $ptype, $avg_pric, $anbarg,
                       $euprice, $exp_dat, $use_bay, $use_bay_numb, $efte, $numb2, $takh_bay, $numb_out, $TransCostType, $TransCostPer, $TransCostVal, $giftriali_mar, $rial_ptk_mar, $price_gift_mar,
                       $id_rules, $takh_tasvia, $add_tasvia, $rowi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
         
$cod = $this -> convertinput($cod);       
$numb = $this -> convertinput($numb); 
$idcast = $this -> convertinput($idcast); 
$price = $this -> convertinput($price); 
$box = $this -> convertinput($box); 
$pric = $this -> convertinput($pric); 
$numfacto = $this -> convertinput($numfacto); 
$dat = $this -> convertinput($dat); 
$stut = $this -> convertinput($stut); 
$idtot = $this -> convertinput($idtot); 
$mainid = $this -> convertinput($mainid); 
$idanbar = $this -> convertinput($idanbar); 
$CNS = $this -> convertinput($CNS); 
$IDBUY = $this -> convertinput($IDBUY); 
$QMAND = $this -> convertinput($QMAND); 
$CPS = $this -> convertinput($CPS); 
$COMBUY = $this -> convertinput($COMBUY); 
$ptk = $this -> convertinput($ptk); 
$wi = $this -> convertinput($wi); 
$tp = $this -> convertinput($tp); 
$qmandidbay = $this -> convertinput($qmandidbay); 
$transanbar = $this -> convertinput($transanbar); 
$dayt = $this -> convertinput($dayt); 
$mont = $this -> convertinput($mont); 
$yeart = $this -> convertinput($yeart); 
$bayt = $this -> convertinput($bayt); 
$sealt = $this -> convertinput($sealt); 
$sodt = $this -> convertinput($sodt); 
$ag = $this -> convertinput($ag); 
$yad = $this -> convertinput($yad); 
$radifid = $this -> convertinput($radifid); 
$per_ma = $this -> convertinput($per_ma); 
$per_av = $this -> convertinput($per_av); 
$vi_numb = $this -> convertinput($vi_numb); 
$id_sefaresh = $this -> convertinput($id_sefaresh); 
$confirm_forush = $this -> convertinput($confirm_forush); 
$mab_ma = $this -> convertinput($mab_ma); 
$mab_av = $this -> convertinput($mab_av); 
$giftriali = $this -> convertinput($giftriali); 
$ptk_gr = $this -> convertinput($ptk_gr); 
$giftriali_gr = $this -> convertinput($giftriali_gr); 
$idprc = $this -> convertinput($idprc); 
$per_visitor = $this -> convertinput($per_visitor); 
$lastpric = $this -> convertinput($lastpric); 
$add1 = $this -> convertinput($add1); 
$add2 = $this -> convertinput($add2); 
$add3 = $this -> convertinput($add3); 
$takh1 = $this -> convertinput($takh1); 
$takh2 = $this -> convertinput($takh2); 
$takh3 = $this -> convertinput($takh3); 
$add4 = $this -> convertinput($add4); 
$idtaf1 = $this -> convertinput($idtaf1); 
$idtaf2 = $this -> convertinput($idtaf2); 
$idtaf3 = $this -> convertinput($idtaf3); 
$idtaf4 = $this -> convertinput($idtaf4); 
$takh4 = $this -> convertinput($takh4); 
$ag_gift = $this -> convertinput($ag_gift); 
$price_gift = $this -> convertinput($price_gift); 
$idmfprc_main = $this -> convertinput($idmfprc_main); 
$tasvie = $this -> convertinput($tasvie); 
$mand_tasvie = $this -> convertinput($mand_tasvie); 
$ptype = $this -> convertinput($ptype); 
$avg_pric = $this -> convertinput($avg_pric); 
$anbarg = $this -> convertinput($anbarg); 
$euprice = $this -> convertinput($euprice); 
$exp_dat = $this -> convertinput($exp_dat); 
$use_bay = $this -> convertinput($use_bay); 
$use_bay_numb = $this -> convertinput($use_bay_numb); 
$efte = $this -> convertinput($efte); 
$numb2 = $this -> convertinput($numb2); 
$takh_bay = $this -> convertinput($takh_bay); 
$numb_out = $this -> convertinput($numb_out); 
$TransCostType = $this -> convertinput($TransCostType); 
$TransCostPer = $this -> convertinput($TransCostPer); 
$TransCostVal = $this -> convertinput($TransCostVal); 
$giftriali_mar = $this -> convertinput($giftriali_mar); 
$rial_ptk_mar = $this -> convertinput($rial_ptk_mar); 
$price_gift_mar = $this -> convertinput($price_gift_mar); 
$id_rules = $this -> convertinput($id_rules); 
$takh_tasvia = $this -> convertinput($takh_tasvia); 
$add_tasvia = $this -> convertinput($add_tasvia); 
    
$dat = $this -> convertdate($dat);  
$exp_dat = $this -> convertdate($exp_dat);
           
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatemainfprc @cod = $cod, @numb = $numb, @idcast = $idcast, @price = $price, @box = $box, @pric = $pric, @numfacto = N'".$numfacto."', @dat = '".$dat."', @stut = $stut, @idtot = $idtot, @mainid = $mainid, @idanbar = $idanbar, 
                                                     @CNS = $CNS, @IDBUY = $IDBUY, @QMAND = $QMAND, @CPS = $CPS, @COMBUY = $COMBUY, @ptk = $ptk, @wi = $wi, @tp = $tp, @qmandidbay = $qmandidbay, @transanbar = $transanbar, @dayt = N'".$dayt."', @mont = N'".$mont."', 
                                                     @yeart = N'".$yeart."', @bayt = $bayt, @sealt = $sealt, @sodt = $sodt, @ag = $ag, @yad = N'".$yad."', @radifid = $radifid, @per_ma = $per_ma, @per_av = $per_av, @vi_numb = N'".$vi_numb."', @id_sefaresh = $id_sefaresh, 
                                                     @confirm_forush = $confirm_forush, @mab_ma = $mab_ma, @mab_av = $mab_av, @giftriali = $giftriali, @ptk_gr = $ptk_gr, @giftriali_gr = $giftriali_gr, @idprc = $idprc, @per_visitor = $per_visitor, 
                                                     @lastpric = $lastpric, @add1 = $add1, @add2 = $add2, @add3 = $add3, @takh1 = $takh1, @takh2 = $takh2, @takh3 = $takh3, @add4 = $add4, @idtaf1 = $idtaf1, @idtaf2 = $idtaf2, @idtaf3 = $idtaf3, 
                                                     @idtaf4 = $idtaf4, @takh4 = $takh4, @ag_gift = $ag_gift, @price_gift = $price_gift, @idmfprc_main = $idmfprc_main, @tasvie = $tasvie, @mand_tasvie = $mand_tasvie, @ptype = $ptype, @avg_pric = $avg_pric, 
                                                     @anbarg = $anbarg, @euprice = $euprice, @exp_dat = '".$exp_dat."', @use_bay = $use_bay, @use_bay_numb = $use_bay_numb, @efte = $efte, @numb2 = $numb2, @takh_bay = $takh_bay, @numb_out = $numb_out, 
                                                     @TransCostType = $TransCostType, @TransCostPer = $TransCostPer, @TransCostVal = $TransCostVal, @giftriali_mar = $giftriali_mar, @rial_ptk_mar = $rial_ptk_mar, @price_gift_mar = $price_gift_mar, 
                                                     @id_rules = $id_rules, @takh_tasvia = $takh_tasvia, @add_tasvia = $add_tasvia, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatenaghd");
         }       
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addMainFPrc($cod, $numb, $idcast, $price, $box, $pric, $numfacto, $dat, $stut, $idtot, $mainid, $idanbar, $CNS, $IDBUY, $QMAND, $CPS, $COMBUY, $ptk, $wi, $tp, $qmandidbay, $transanbar, $dayt, $mont, $yeart, $bayt, $sealt, $sodt, $ag, $yad, $radifid, $per_ma, $per_av, $vi_numb, $id_sefaresh, $confirm_forush, $mab_ma, $mab_av, $giftriali, $ptk_gr, $giftriali_gr, $idprc, $per_visitor,
                       $lastpric, $add1, $add2, $add3, $takh1, $takh2, $takh3, $add4, $idtaf1, $idtaf2, $idtaf3, $idtaf4, $takh4, $ag_gift, $price_gift, $idmfprc_main, $tasvie, $mand_tasvie, $ptype, $avg_pric, $anbarg,
                       $euprice, $exp_dat, $use_bay, $use_bay_numb, $efte, $numb2, $takh_bay, $numb_out, $TransCostType, $TransCostPer, $TransCostVal, $giftriali_mar, $rial_ptk_mar, $price_gift_mar,
                       $id_rules, $takh_tasvia, $add_tasvia, $rowi, $us, $pas){ 
        
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
		 
$cod = $this -> convertinput($cod);       
$numb = $this -> convertinput($numb); 
$idcast = $this -> convertinput($idcast); 
$price = $this -> convertinput($price); 
$box = $this -> convertinput($box); 
$pric = $this -> convertinput($pric); 
$numfacto = $this -> convertinput($numfacto); 
$dat = $this -> convertinput($dat); 
$stut = $this -> convertinput($stut); 
$idtot = $this -> convertinput($idtot); 
$mainid = $this -> convertinput($mainid); 
$idanbar = $this -> convertinput($idanbar); 
$CNS = $this -> convertinput($CNS); 
$IDBUY = $this -> convertinput($IDBUY); 
$QMAND = $this -> convertinput($QMAND); 
$CPS = $this -> convertinput($CPS); 
$COMBUY = $this -> convertinput($COMBUY); 
$ptk = $this -> convertinput($ptk); 
$wi = $this -> convertinput($wi); 
$tp = $this -> convertinput($tp); 
$qmandidbay = $this -> convertinput($qmandidbay); 
$transanbar = $this -> convertinput($transanbar); 
$dayt = $this -> convertinput($dayt); 
$mont = $this -> convertinput($mont); 
$yeart = $this -> convertinput($yeart); 
$bayt = $this -> convertinput($bayt); 
$sealt = $this -> convertinput($sealt); 
$sodt = $this -> convertinput($sodt); 
$ag = $this -> convertinput($ag); 
$yad = $this -> convertinput($yad); 
$radifid = $this -> convertinput($radifid); 
$per_ma = $this -> convertinput($per_ma); 
$per_av = $this -> convertinput($per_av); 
$vi_numb = $this -> convertinput($vi_numb); 
$id_sefaresh = $this -> convertinput($id_sefaresh); 
$confirm_forush = $this -> convertinput($confirm_forush); 
$mab_ma = $this -> convertinput($mab_ma); 
$mab_av = $this -> convertinput($mab_av); 
$giftriali = $this -> convertinput($giftriali); 
$ptk_gr = $this -> convertinput($ptk_gr); 
$giftriali_gr = $this -> convertinput($giftriali_gr); 
$idprc = $this -> convertinput($idprc); 
$per_visitor = $this -> convertinput($per_visitor); 
$lastpric = $this -> convertinput($lastpric); 
$add1 = $this -> convertinput($add1); 
$add2 = $this -> convertinput($add2); 
$add3 = $this -> convertinput($add3); 
$takh1 = $this -> convertinput($takh1); 
$takh2 = $this -> convertinput($takh2); 
$takh3 = $this -> convertinput($takh3); 
$add4 = $this -> convertinput($add4); 
$idtaf1 = $this -> convertinput($idtaf1); 
$idtaf2 = $this -> convertinput($idtaf2); 
$idtaf3 = $this -> convertinput($idtaf3); 
$idtaf4 = $this -> convertinput($idtaf4); 
$takh4 = $this -> convertinput($takh4); 
$ag_gift = $this -> convertinput($ag_gift); 
$price_gift = $this -> convertinput($price_gift); 
$idmfprc_main = $this -> convertinput($idmfprc_main); 
$tasvie = $this -> convertinput($tasvie); 
$mand_tasvie = $this -> convertinput($mand_tasvie); 
$ptype = $this -> convertinput($ptype); 
$avg_pric = $this -> convertinput($avg_pric); 
$anbarg = $this -> convertinput($anbarg); 
$euprice = $this -> convertinput($euprice); 
$exp_dat = $this -> convertinput($exp_dat); 
$use_bay = $this -> convertinput($use_bay); 
$use_bay_numb = $this -> convertinput($use_bay_numb); 
$efte = $this -> convertinput($efte); 
$numb2 = $this -> convertinput($numb2); 
$takh_bay = $this -> convertinput($takh_bay); 
$numb_out = $this -> convertinput($numb_out); 
$TransCostType = $this -> convertinput($TransCostType); 
$TransCostPer = $this -> convertinput($TransCostPer); 
$TransCostVal = $this -> convertinput($TransCostVal); 
$giftriali_mar = $this -> convertinput($giftriali_mar); 
$rial_ptk_mar = $this -> convertinput($rial_ptk_mar); 
$price_gift_mar = $this -> convertinput($price_gift_mar); 
$id_rules = $this -> convertinput($id_rules); 
$takh_tasvia = $this -> convertinput($takh_tasvia); 
$add_tasvia = $this -> convertinput($add_tasvia); 
    
$dat = $this -> convertdate($dat);  
$exp_dat = $this -> convertdate($exp_dat);
	
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addmainfprc @cod = $cod, @numb = $numb, @idcast = $idcast, @price = $price, @box = $box, @pric = $pric, @numfacto = N'".$numfacto."', @dat = '".$dat."', @stut = $stut, @idtot = $idtot, @mainid = $mainid, @idanbar = $idanbar, 
                                                     @CNS = $CNS, @IDBUY = $IDBUY, @QMAND = $QMAND, @CPS = $CPS, @COMBUY = $COMBUY, @ptk = $ptk, @wi = $wi, @tp = $tp, @qmandidbay = $qmandidbay, @transanbar = $transanbar, @dayt = N'".$dayt."', @mont = N'".$mont."', 
                                                     @yeart = N'".$yeart."', @bayt = $bayt, @sealt = $sealt, @sodt = $sodt, @ag = $ag, @yad = N'".$yad."', @radifid = $radifid, @per_ma = $per_ma, @per_av = $per_av, @vi_numb = N'".$vi_numb."', @id_sefaresh = $id_sefaresh, 
                                                     @confirm_forush = $confirm_forush, @mab_ma = $mab_ma, @mab_av = $mab_av, @giftriali = $giftriali, @ptk_gr = $ptk_gr, @giftriali_gr = $giftriali_gr, @idprc = $idprc, @per_visitor = $per_visitor, 
                                                     @lastpric = $lastpric, @add1 = $add1, @add2 = $add2, @add3 = $add3, @takh1 = $takh1, @takh2 = $takh2, @takh3 = $takh3, @add4 = $add4, @idtaf1 = $idtaf1, @idtaf2 = $idtaf2, @idtaf3 = $idtaf3, 
                                                     @idtaf4 = $idtaf4, @takh4 = $takh4, @ag_gift = $ag_gift, @price_gift = $price_gift, @idmfprc_main = $idmfprc_main, @tasvie = $tasvie, @mand_tasvie = $mand_tasvie, @ptype = $ptype, @avg_pric = $avg_pric, 
                                                     @anbarg = $anbarg, @euprice = $euprice, @exp_dat = '".$exp_dat."', @use_bay = $use_bay, @use_bay_numb = $use_bay_numb, @efte = $efte, @numb2 = $numb2, @takh_bay = $takh_bay, @numb_out = $numb_out, 
                                                     @TransCostType = $TransCostType, @TransCostPer = $TransCostPer, @TransCostVal = $TransCostVal, @giftriali_mar = $giftriali_mar, @rial_ptk_mar = $rial_ptk_mar, @price_gift_mar = $price_gift_mar, 
                                                     @id_rules = $id_rules, @takh_tasvia = $takh_tasvia, @add_tasvia = $add_tasvia, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addmainfprc");
         }   
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deleteMainFPrc($us,$pas,$wi){
        $cj=false;
   
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletemainfprc @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletenaghd");
         }
       
       
       }
        
        
        
        
    } 
    
	
    


    
    
    //NewSalseFactor
    function checkfornewsalsefactor($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkfornewsalsefactor @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkfornewsalsefactor");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        } 
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }   
    function updatenewsalsefactor($cod_cast, $tasvieh, $day_numb, $cod_kala, $numb, $price, $usernam, $factorid, $part, $yad, $trans, $unic_id, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
        $cod_cast = $this -> convertinput($cod_cast);   
        $tasvieh = $this -> convertinput($tasvieh);   
        $day_numb = $this -> convertinput($day_numb);   
        $cod_kala = $this -> convertinput($cod_kala);   
        $numb = $this -> convertinput($numb);   
        $price = $this -> convertinput($price);   
        $usernam = $this -> convertinput($usernam);   
        $factorid = $this -> convertinput($factorid);   
        $part = $this -> convertinput($part);   
        $yad = $this -> convertinput($yad);   
        $trans = $this -> convertinput($trans);   
        $unic_id = $this -> convertinput($unic_id);   
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatenewsalsefactor @cod_cast = $cod_cast, @tasvieh = $tasvieh, @day_numb = $day_numb, @cod_kala = $cod_kala, @numb = $numb, @price = $price, @usernam = $usernam, @factorid = $factorid, @part = $part, @yad = $yad, @trans = $trans, @unic_id = $unic_id, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatenewsalsefactor");
         }    
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addnewsalsefactor($cod_cast, $tasvieh, $day_numb, $cod_kala, $numb, $price, $usernam, $factorid, $part, $yad, $trans, $unic_id, $wi, $us, $pas){ 
        
          
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
        $cod_cast = $this -> convertinput($cod_cast);   
        $tasvieh = $this -> convertinput($tasvieh);   
        $day_numb = $this -> convertinput($day_numb);   
        $cod_kala = $this -> convertinput($cod_kala);   
        $numb = $this -> convertinput($numb);   
        $price = $this -> convertinput($price);   
        $usernam = $this -> convertinput($usernam);   
        $factorid = $this -> convertinput($factorid);   
        $part = $this -> convertinput($part);   
        $yad = $this -> convertinput($yad);   
        $trans = $this -> convertinput($trans);   
        $unic_id = $this -> convertinput($unic_id);      
           
 
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addnewsalsefactor @cod_cast = $cod_cast, @tasvieh = $tasvieh, @day_numb = $day_numb, @cod_kala = $cod_kala, @numb = $numb, @price = $price, @usernam = $usernam, @factorid = $factorid, @part = $part, @yad = $yad, @trans = $trans, @unic_id = $unic_id, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addnewsalsefactor");
         }      
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletenewsalsefactor($us,$pas,$wi){
        $cj=false;
   
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
 
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletenewsalsefactor @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletenewsalsefactor");
         }
       
       
       }
        
        
        
        
    } 
            

    
    //PRC
    function checkforprc($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforprc @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforprc");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        } 
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }   
    function updateprc($nam, $unit, $unit2, $numb, $box, $price, $pv, $pric, $stut, $unam, $price1, $pv1, $price2, $pv2, $mainid, $idanbar, $prictmp, $numbtmp, $wi, $tp, $barcod, $err_numb, $minnumb, $vi_numb, $ptk, $lowprice, $hightprice, $groupid, $vpercent, $f_j, $per_ma, $per_av, $calc_chk, $price3, $pv3, $price4, $pv4, $price5, $pv5, $id_ma_av, $producer_id, $lastpric, $add1, $add2, $add3, $add4, $takh1, $takh2, $takh3, $takh4, $use_tozih1, $use_tozih2, $avg_price, $ptk_tozih1, $ptk_tozih2, $black_list, $unit3, $numb2, $daynumb, $trans, $ver, $pricemasraf,$pic_path,$ver_update,$yad, $rwi, $us, $pas){ 
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
        
        $nam = $this -> convertinput($nam);   
$unit = $this -> convertinput($unit);   
$unit2 = $this -> convertinput($unit2);   
$numb = $this -> convertinput($numb);   
$box = $this -> convertinput($box);   
$price = $this -> convertinput($price);   
$pv = $this -> convertinput($pv);   
$pric = $this -> convertinput($pric);   
$stut = $this -> convertinput($stut);   
$unam = $this -> convertinput($unam);   
$price1 = $this -> convertinput($price1);   
$pv1 = $this -> convertinput($pv1);   
$price2 = $this -> convertinput($price2);   
$pv2 = $this -> convertinput($pv2);   
$mainid = $this -> convertinput($mainid);   
$idanbar = $this -> convertinput($idanbar);   
$prictmp = $this -> convertinput($prictmp);   
$numbtmp = $this -> convertinput($numbtmp);   
$wi = $this -> convertinput($wi);   
$tp = $this -> convertinput($tp);   
$barcod = $this -> convertinput($barcod);   
$err_numb = $this -> convertinput($err_numb);   
$minnumb = $this -> convertinput($minnumb);   
$vi_numb = $this -> convertinput($vi_numb);   
$ptk = $this -> convertinput($ptk);   
$lowprice = $this -> convertinput($lowprice);   
$hightprice = $this -> convertinput($hightprice);   
$groupid = $this -> convertinput($groupid);   
$vpercent = $this -> convertinput($vpercent);   
$f_j = $this -> convertinput($f_j);   
$per_ma = $this -> convertinput($per_ma);   
$per_av = $this -> convertinput($per_av);   
$calc_chk = $this -> convertinput($calc_chk);   
$price3 = $this -> convertinput($price3);   
$pv3 = $this -> convertinput($pv3);   
$price4 = $this -> convertinput($price4);   
$pv4 = $this -> convertinput($pv4);   
$price5 = $this -> convertinput($price5);   
$pv5 = $this -> convertinput($pv5);   
$id_ma_av = $this -> convertinput($id_ma_av);   
$producer_id = $this -> convertinput($producer_id);   
$lastpric = $this -> convertinput($lastpric);   
$add1 = $this -> convertinput($add1);   
$add2 = $this -> convertinput($add2);   
$add3 = $this -> convertinput($add3);   
$add4 = $this -> convertinput($add4);   
$takh1 = $this -> convertinput($takh1);  
$takh2 = $this -> convertinput($takh2);   
$takh3 = $this -> convertinput($takh3);   
$takh4 = $this -> convertinput($takh4);   
$use_tozih1 = $this -> convertinput($use_tozih1);   
$use_tozih2 = $this -> convertinput($use_tozih2);   
$avg_price = $this -> convertinput($avg_price);   
$ptk_tozih1 = $this -> convertinput($ptk_tozih1);   
$ptk_tozih2 = $this -> convertinput($ptk_tozih2);   
$black_list = $this -> convertinput($black_list);   
$unit3 = $this -> convertinput($unit3);   
$numb2 = $this -> convertinput($numb2);   
$daynumb = $this -> convertinput($daynumb);   
$trans = $this -> convertinput($trans);   
$ver = $this -> convertinput($ver);   
$pricemasraf = $this -> convertinput($pricemasraf);   
$pic_path = $this -> convertinput($pic_path);   
$ver_update = $this -> convertinput($ver_update);   
$yad = $this -> convertinput($yad);      
           
           
        $numb2 = (strlen($numb2) == 0) ? 'null' : $numb2;   
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updateprc @rowi = $rwi, @ucid = $ucd, @nam = N'".$nam."', @unit = N'".$unit."', @unit2 = N'".$unit2."', @numb = $numb, @box = $box, @price = $price, @pv = $pv, @pric = $pric, @stut = $stut, @unam = N'".$unam."', @price1 = $price1, @pv1 = $pv1, @price2 = $price2, @pv2 = $pv2, @mainid = $mainid, @idanbar = $idanbar, @prictmp = $prictmp, @numbtmp = $numbtmp, @wi = $wi, @tp = $tp, @barcod = $barcod, @err_numb = $err_numb, @minnumb = $minnumb, @vi_numb = N'".$vi_numb."', @ptk = $ptk, @lowprice = $lowprice, @hightprice = $hightprice, @groupid = $groupid, @vpercent = $vpercent, @f_j = $f_j, @per_ma = $per_ma, @per_av = $per_av, @calc_chk = $calc_chk, @price3 = $price3, @pv3 = $pv3, @price4 = $price4, @pv4 = $pv4, @price5 = $price5, @pv5 = $pv5, @id_ma_av = $id_ma_av, @producer_id = $producer_id, @add1 = $add1, @add2 = $add2, @add3 = $add3, @add4 = $add4, @takh1 = $takh1, @takh2 = $takh2, @takh3 = $takh3, @takh4 = $takh4, @use_tozih1 = $use_tozih1, @use_tozih2 = $use_tozih2, @avg_pric = $avg_price, @ptk_tozih1 = $ptk_tozih1, @ptk_tozih2 = $ptk_tozih2, @black_list = $black_list, @unit3 = N'".$unit3."', @numb2 = ".$numb2.", @daynumb = $daynumb, @trans = $trans, @ver = $ver, @pricemasraf = $pricemasraf,@pic_path = N'".$pic_path."',@ver_update = $ver_update,@yad = N'".$yad."'");
           
         if(!$result){
              die("Failed To Fetch updateprc");
         }       
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addprc($nam, $unit, $unit2, $numb, $box, $price, $pv, $pric, $stut, $unam, $price1, $pv1, $price2, $pv2, $mainid, $idanbar, $prictmp, $numbtmp, $wi, $tp, $barcod, $err_numb, $minnumb, $vi_numb, $ptk, $lowprice, $hightprice, $groupid, $vpercent, $f_j, $per_ma, $per_av, $calc_chk, $price3, $pv3, $price4, $pv4, $price5, $pv5, $id_ma_av, $producer_id, $lastpric, $add1, $add2, $add3, $add4, $takh1, $takh2, $takh3, $takh4, $use_tozih1, $use_tozih2, $avg_price, $ptk_tozih1, $ptk_tozih2, $black_list, $unit3, $numb2, $daynumb, $trans, $ver, $pricemasraf,$pic_path,$ver_update,$yad, $rwi, $us, $pas){ 
        
          
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
 $nam = $this -> convertinput($nam);   
$unit = $this -> convertinput($unit);   
$unit2 = $this -> convertinput($unit2);   
$numb = $this -> convertinput($numb);   
$box = $this -> convertinput($box);   
$price = $this -> convertinput($price);   
$pv = $this -> convertinput($pv);   
$pric = $this -> convertinput($pric);   
$stut = $this -> convertinput($stut);   
$unam = $this -> convertinput($unam);   
$price1 = $this -> convertinput($price1);   
$pv1 = $this -> convertinput($pv1);   
$price2 = $this -> convertinput($price2);   
$pv2 = $this -> convertinput($pv2);   
$mainid = $this -> convertinput($mainid);   
$idanbar = $this -> convertinput($idanbar);   
$prictmp = $this -> convertinput($prictmp);   
$numbtmp = $this -> convertinput($numbtmp);   
$wi = $this -> convertinput($wi);   
$tp = $this -> convertinput($tp);   
$barcod = $this -> convertinput($barcod);   
$err_numb = $this -> convertinput($err_numb);   
$minnumb = $this -> convertinput($minnumb);   
$vi_numb = $this -> convertinput($vi_numb);   
$ptk = $this -> convertinput($ptk);   
$lowprice = $this -> convertinput($lowprice);   
$hightprice = $this -> convertinput($hightprice);   
$groupid = $this -> convertinput($groupid);   
$vpercent = $this -> convertinput($vpercent);   
$f_j = $this -> convertinput($f_j);   
$per_ma = $this -> convertinput($per_ma);   
$per_av = $this -> convertinput($per_av);   
$calc_chk = $this -> convertinput($calc_chk);   
$price3 = $this -> convertinput($price3);   
$pv3 = $this -> convertinput($pv3);   
$price4 = $this -> convertinput($price4);   
$pv4 = $this -> convertinput($pv4);   
$price5 = $this -> convertinput($price5);   
$pv5 = $this -> convertinput($pv5);   
$id_ma_av = $this -> convertinput($id_ma_av);   
$producer_id = $this -> convertinput($producer_id);   
$lastpric = $this -> convertinput($lastpric);   
$add1 = $this -> convertinput($add1);   
$add2 = $this -> convertinput($add2);   
$add3 = $this -> convertinput($add3);   
$add4 = $this -> convertinput($add4);   
$takh1 = $this -> convertinput($takh1);  
$takh2 = $this -> convertinput($takh2);   
$takh3 = $this -> convertinput($takh3);   
$takh4 = $this -> convertinput($takh4);   
$use_tozih1 = $this -> convertinput($use_tozih1);   
$use_tozih2 = $this -> convertinput($use_tozih2);   
$avg_price = $this -> convertinput($avg_price);   
$ptk_tozih1 = $this -> convertinput($ptk_tozih1);   
$ptk_tozih2 = $this -> convertinput($ptk_tozih2);   
$black_list = $this -> convertinput($black_list);   
$unit3 = $this -> convertinput($unit3);   
$numb2 = $this -> convertinput($numb2);   
$daynumb = $this -> convertinput($daynumb);   
$trans = $this -> convertinput($trans);   
$ver = $this -> convertinput($ver);   
$pricemasraf = $this -> convertinput($pricemasraf);   
$pic_path = $this -> convertinput($pic_path);   
$ver_update = $this -> convertinput($ver_update);   
$yad = $this -> convertinput($yad);   
           
           

		$numb2 = (strlen($numb2) == 0) ? 'null' : $numb2;
  $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addprc  @rowi = $rwi, @ucid = $ucd, @nam = N'".$nam."', @unit = N'".$unit."', @unit2 = N'".$unit2."', @numb = $numb, @box = $box, @price = $price, @pv = $pv, @pric = $pric, @stut = $stut, @unam = N'".$unam."', @price1 = $price1, @pv1 = $pv1, @price2 = $price2, @pv2 = $pv2, @mainid = $mainid, @idanbar = $idanbar, @prictmp = $prictmp, @numbtmp = $numbtmp, @wi = $wi, @tp = $tp, @barcod = $barcod, @err_numb = $err_numb, @minnumb = $minnumb, @vi_numb = N'".$vi_numb."', @ptk = $ptk, @lowprice = $lowprice, @hightprice = $hightprice, @groupid = $groupid, @vpercent = $vpercent, @f_j = $f_j, @per_ma = $per_ma, @per_av = $per_av, @calc_chk = $calc_chk, @price3 = $price3, @pv3 = $pv3, @price4 = $price4, @pv4 = $pv4, @price5 = $price5, @pv5 = $pv5, @id_ma_av = $id_ma_av, @producer_id = $producer_id, @add1 = $add1, @add2 = $add2, @add3 = $add3, @add4 = $add4, @takh1 = $takh1, @takh2 = $takh2, @takh3 = $takh3, @takh4 = $takh4, @use_tozih1 = $use_tozih1, @use_tozih2 = $use_tozih2, @avg_pric = $avg_price, @ptk_tozih1 = $ptk_tozih1, @ptk_tozih2 = $ptk_tozih2, @black_list = $black_list, @unit3 = N'".$unit3."', @numb2 = ".$numb2.", @daynumb = $daynumb, @trans = $trans, @ver = $ver, @pricemasraf = $pricemasraf,@pic_path = N'".$pic_path."',@ver_update = $ver_update,@yad = N'".$yad."'");
           
         if(!$result){
              die("Failed To Fetch addprc");
         }   
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
	

	
    function checkforprc_two($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforprc @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforprc");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        } 
           
           
       }else{
           
           return $cj;
           
       }
        
        
    } 
	
 function updateprc_two($nam, $unit, $unit2, $numb, $box, $price,$stut, $unam, $price1,$price2,$mainid, $idanbar,$ptk, $price3,$price4,$pic_path,$pic,$kala_group,$ver,$rwi,$f_j,$groupid,$groupid2, $us, $pas){ 
        
 
        
       $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
        
       
$nam = $this -> convertinput($nam);   
$unit = $this -> convertinput($unit);   
$unit2 = $this -> convertinput($unit2);   
$numb = $this -> convertinput($numb);   
$box = $this -> convertinput($box);   
$price = $this -> convertinput($price);   
$stut = $this -> convertinput($stut);   
$unam = $this -> convertinput($unam);   
$price1 = $this -> convertinput($price1);  
$price2 = $this -> convertinput($price2);
$mainid = $this -> convertinput($mainid);   
$idanbar = $this -> convertinput($idanbar);    
$ptk = $this -> convertinput($ptk);     
$price3 = $this -> convertinput($price3); 
$price4 = $this -> convertinput($price4);   
$pic_path = $this -> convertinput($pic_path);   
$pic = $this -> convertinput($pic);    
$kala_group = $this -> convertinput($kala_group);   
$f_j = $this -> convertinput($f_j);   
$ver = $this -> convertinput($ver);   
$groupid2 = $this -> convertinput($groupid2);   	
$groupid = $this -> convertinput($groupid);             
   
           
           
         
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updateprc  @rowi = $rwi, @ucid = $ucd, @nam = N'".$nam."', @unit = N'".$unit."', @unit2 = N'".$unit2."', @numb = $numb, @box = $box, @price = $price, @stut = $stut, @unam = N'".$unam."', @price1 = $price1, @price2 = $price2, @mainid = $mainid, @idanbar = $idanbar, @ptk = $ptk, @price3 = $price3, @price4 = $price4,@pic_path = N'".$pic_path."',@pic = N'".$pic."',@kalagroup_nam = N'".$kala_group."', @f_j = $f_j, @groupid2 = $groupid2, @groupid = $groupid, @ver = $ver");
           
         if(!$result){
              die("Failed To Fetch updateprc");
         }       
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
	

function addprc_two($nam, $unit, $unit2, $numb, $box, $price,$stut, $unam, $price1,$price2,$mainid, $idanbar,$ptk, $price3,$price4,$pic_path,$pic,$kala_group,$ver,$rwi,$f_j,$groupid,$groupid2, $us, $pas){ 
        
          
 
        
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
$nam = $this -> convertinput($nam);   
$unit = $this -> convertinput($unit);   
$unit2 = $this -> convertinput($unit2);   
$numb = $this -> convertinput($numb);   
$box = $this -> convertinput($box);   
$price = $this -> convertinput($price);   
$stut = $this -> convertinput($stut);   
$unam = $this -> convertinput($unam);   
$price1 = $this -> convertinput($price1);  
$price2 = $this -> convertinput($price2);
$mainid = $this -> convertinput($mainid);   
$idanbar = $this -> convertinput($idanbar);    
$ptk = $this -> convertinput($ptk);     
$price3 = $this -> convertinput($price3); 
$price4 = $this -> convertinput($price4);   
$pic_path = $this -> convertinput($pic_path);   
$pic = $this -> convertinput($pic);    
$kala_group = $this -> convertinput($kala_group);   
$f_j = $this -> convertinput($f_j);   
$groupid2 = $this -> convertinput($groupid2);   	
$groupid = $this -> convertinput($groupid);  
$ver_update = $this -> convertinput($ver);   
           
           

		$numb2 = (strlen($numb2) == 0) ? 'null' : $numb2;
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addprc  @rowi = $rwi, @ucid = $ucd, @nam = N'".$nam."', @unit = N'".$unit."', @unit2 = N'".$unit2."', @numb = $numb, @box = $box, @price = $price, @stut = $stut, @unam = N'".$unam."', @price1 = $price1, @price2 = $price2, @mainid = $mainid, @idanbar = $idanbar, @ptk = $ptk, @price3 = $price3, @price4 = $price4,@pic_path = N'".$pic_path."',@pic = N'".$pic."',@kalagroup_nam = N'".$kala_group."', @f_j = $f_j,@groupid2 = $groupid2,@groupid = $groupid,@ver = $ver");
           
         if(!$result){
              die("Failed To Fetch addprc");
         }   
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
	











    function deleteprc_two($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deleteprc @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deleteprc");
         }
       
       
       }
        
        
        
        
    } 
       
    





    function deleteprc($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deleteprc @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deleteprc");
         }
       
       
       }
        
        
        
        
    } 
       
    
    
    //Report
    function checkforreport($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforreport @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforreport");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        } 
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }   
    function updatereport($sharh, $wi, $us, $pas){
        
         
        
   
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
  
            $sharh = $this -> convertinput($sharh); 
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatereport @sharh = N'".$sharh."', @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatereport");
         }       
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addreport($sharh, $wi, $us, $pas){ 
        
 
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
        $sharh = $this -> convertinput($sharh); 
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addreport @sharh = N'".$sharh."', @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addreport");
         } 
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletereport($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletereport @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletereport");
         }
       
       
       }
        
        
        
        
    } 
   
    
    //ReportForResult
    function checkforreportresualt($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforreportresualt @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforreportresualt");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        } 
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }   
    function updatereportresualt($sharh, $idv, $idreport, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
          
         $sharh = $this -> convertinput($sharh);    
         $idv = $this -> convertinput($idv);    
         $idreport = $this -> convertinput($idreport);    
         $idv = (strlen($idv) == 0) ? 'null' : $idv;  
         $idreport = (strlen($idreport) == 0) ? 'null' : $idreport;   
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatereportresult @sharh = N'".$sharh."', @idv = ".$idv.", @idreport = ".$idreport.", @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatereportresualt");
         }     
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addreportresualt($sharh, $idv, $idreport, $wi, $us, $pas){ 
        
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
         $sharh = $this -> convertinput($sharh);    
         $idv = $this -> convertinput($idv);    
         $idreport = $this -> convertinput($idreport); 
         $idv = (strlen($idv) == 0) ? 'null' : $idv;  
         $idreport = (strlen($idreport) == 0) ? 'null' : $idreport;  
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addreportresult @sharh = N'".$sharh."', @idv = ".$idv.", @idreport = ".$idreport.", @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addreportresualt");
         }     
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletereportresualt($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletereportresualt @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletereportresualt");
         }
       
       
       }
        
        
        
        
    } 
         
    
         
    
    
   //Settings2
    function checkforsetting_two($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforsetting @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforsetting");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }   
    function updatesetting_two($gfs1, $gfs2, $gfs3, $gfs4, $gfs5, $gfs6, $gfs7, $gfs8, $gfs9, $gfs10,$wi, $us, $pas){
        
 
        
       $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 
         $gfs1 = $this -> convertinput($gfs1);    
         $gfs2 = $this -> convertinput($gfs2);    
         $gfs3 = $this -> convertinput($gfs3);    
         $gfs4 = $this -> convertinput($gfs4);    
         $gfs5 = $this -> convertinput($gfs5);    
         $gfs6 = $this -> convertinput($gfs6);    
         $gfs7 = $this -> convertinput($gfs7);    
         $gfs8 = $this -> convertinput($gfs8);    
         $gfs9 = $this -> convertinput($gfs9);    
         $gfs10 = $this -> convertinput($gfs10);    
                   
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatesetting @gfs1 = $gfs1, @gfs2 = $gfs2, @gfs3 = $gfs3, @gfs4 = $gfs4, @gfs5 = $gfs5, @gfs6 = $gfs6, @gfs7 = $gfs7, @gfs8 = $gfs8, @gfs9 = $gfs9, @gfs10 = $gfs10, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatesetting");
         }     
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addsetting_two($gfs1, $gfs2, $gfs3, $gfs4, $gfs5, $gfs6, $gfs7, $gfs8, $gfs9, $gfs10, $wi, $us, $pas){ 
        
        
 
        
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
         $gfs1 = $this -> convertinput($gfs1);    
         $gfs2 = $this -> convertinput($gfs2);    
         $gfs3 = $this -> convertinput($gfs3);    
         $gfs4 = $this -> convertinput($gfs4);    
         $gfs5 = $this -> convertinput($gfs5);    
         $gfs6 = $this -> convertinput($gfs6);    
         $gfs7 = $this -> convertinput($gfs7);    
         $gfs8 = $this -> convertinput($gfs8);    
         $gfs9 = $this -> convertinput($gfs9);    
         $gfs10 = $this -> convertinput($gfs10);     
           
           
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addsetting @gfs1 = $gfs1, @gfs2 = $gfs2, @gfs3 = $gfs3, @gfs4 = $gfs4, @gfs5 = $gfs5, @gfs6 = $gfs6, @gfs7 = $gfs7, @gfs8 = $gfs8, @gfs9 = $gfs9, @gfs10 = $gfs10, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addsetting");
         }
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletesetting_two($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletesetting @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletesetting");
         }
       
       
       }
        
        
        
        
    } 
      
        
    	


    
   //Settings
    function checkforsetting($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforsetting @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforsetting");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }   
    function updatesetting($gfs1, $gfs2, $gfs3, $gfs4, $gfs5, $gfs6, $gfs7, $gfs8, $gfs9, $gfs10, $gfs11, $gfs12, $gfs13, $gfs14, $gfs15, $gfs16, $gfs17, $gfs18, $gfs19, $gfs20, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 
         $gfs1 = $this -> convertinput($gfs1);    
         $gfs2 = $this -> convertinput($gfs2);    
         $gfs3 = $this -> convertinput($gfs3);    
         $gfs4 = $this -> convertinput($gfs4);    
         $gfs5 = $this -> convertinput($gfs5);    
         $gfs6 = $this -> convertinput($gfs6);    
         $gfs7 = $this -> convertinput($gfs7);    
         $gfs8 = $this -> convertinput($gfs8);    
         $gfs9 = $this -> convertinput($gfs9);    
         $gfs10 = $this -> convertinput($gfs10);    
         $gfs11 = $this -> convertinput($gfs11);    
         $gfs12 = $this -> convertinput($gfs12);    
         $gfs13 = $this -> convertinput($gfs13);    
         $gfs14 = $this -> convertinput($gfs14);    
         $gfs15 = $this -> convertinput($gfs15);    
         $gfs16 = $this -> convertinput($gfs16);    
         $gfs17 = $this -> convertinput($gfs17);    
         $gfs18 = $this -> convertinput($gfs18);    
         $gfs19 = $this -> convertinput($gfs19);    
         $gfs20 = $this -> convertinput($gfs20);    
                   
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatesetting @gfs1 = $gfs1, @gfs2 = $gfs2, @gfs3 = $gfs3, @gfs4 = $gfs4, @gfs5 = $gfs5, @gfs6 = $gfs6, @gfs7 = $gfs7, @gfs8 = $gfs8, @gfs9 = $gfs9, @gfs10 = $gfs10, @gfs11 = $gfs11, @gfs12 = $gfs12, @gfs13 = $gfs13, @gfs14 = $gfs14, @gfs15 = $gfs15, @gfs16 = $gfs16, @gfs17 = $gfs17, @gfs18 = $gfs18, @gfs19 = $gfs19, @gfs20 = $gfs20, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatesetting");
         }     
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
    function addsetting($gfs1, $gfs2, $gfs3, $gfs4, $gfs5, $gfs6, $gfs7, $gfs8, $gfs9, $gfs10, $gfs11, $gfs12, $gfs13, $gfs14, $gfs15, $gfs16, $gfs17, $gfs18, $gfs19, $gfs20, $wi, $us, $pas){ 
        
        
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
         $gfs1 = $this -> convertinput($gfs1);    
         $gfs2 = $this -> convertinput($gfs2);    
         $gfs3 = $this -> convertinput($gfs3);    
         $gfs4 = $this -> convertinput($gfs4);    
         $gfs5 = $this -> convertinput($gfs5);    
         $gfs6 = $this -> convertinput($gfs6);    
         $gfs7 = $this -> convertinput($gfs7);    
         $gfs8 = $this -> convertinput($gfs8);    
         $gfs9 = $this -> convertinput($gfs9);    
         $gfs10 = $this -> convertinput($gfs10);    
         $gfs11 = $this -> convertinput($gfs11);    
         $gfs12 = $this -> convertinput($gfs12);    
         $gfs13 = $this -> convertinput($gfs13);    
         $gfs14 = $this -> convertinput($gfs14);    
         $gfs15 = $this -> convertinput($gfs15);    
         $gfs16 = $this -> convertinput($gfs16);    
         $gfs17 = $this -> convertinput($gfs17);    
         $gfs18 = $this -> convertinput($gfs18);    
         $gfs19 = $this -> convertinput($gfs19);    
         $gfs20 = $this -> convertinput($gfs20);     
           
           
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addsetting @gfs1 = $gfs1, @gfs2 = $gfs2, @gfs3 = $gfs3, @gfs4 = $gfs4, @gfs5 = $gfs5, @gfs6 = $gfs6, @gfs7 = $gfs7, @gfs8 = $gfs8, @gfs9 = $gfs9, @gfs10 = $gfs10, @gfs11 = $gfs11, @gfs12 = $gfs12, @gfs13 = $gfs13, @gfs14 = $gfs14, @gfs15 = $gfs15, @gfs16 = $gfs16, @gfs17 = $gfs17, @gfs18 = $gfs18, @gfs19 = $gfs19, @gfs20 = $gfs20, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addsetting");
         }
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletesetting($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletesetting @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletesetting");
         }
       
       
       }
        
        
        
        
    } 
      
    
    //Tafseal
    function checkfortafseal($us,$pas,$wi){
        $cj=false;
   
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkfortafseal @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkfortafseal");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }   
	
    function updatetafseal($idkol, $tafseal, $idmoin, $nam, $adr, $tel, $fax, $dat, $stut, $unam, $pricetype, $subcast, $subchk, $cr, $idgroup, $isf, $cod, $sh, $yad, $daystut, $locks, $idbank, $cr2, $monid, $idnaghd_edit, $ctrl1, $ctrl2, $ctrl_av_ma, $nonaghd_bas, $nonaghd_bed, $ctrl_mprc, $idpersonel, $p_visitor, $ctrl_avma_bay, $ctrl_avma_sell, $ctrl_haz1, $ctrl_haz2, $ctrl_haz3, $ctrl_haz4, $lockstut, $shopname, $black_list, $max_notasvie, $cr_koli, $yad_blacklist, $kart_bank, $trans, $nam2, $ver, $ctrl_out, $CoVisitor, $IsDistributor, $IsCollector, $IsDriver, $IsStoreKeeper, $IsStMng, $ver2, $ver_update, $bima_taf, $per_bima, $bima_taf_haz, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
          $idkol = $this -> convertinput($idkol);   
$tafseal = $this -> convertinput($tafseal);   
$idmoin = $this -> convertinput($idmoin);   
$nam = $this -> convertinput($nam);   
$adr = $this -> convertinput($adr);   
$tel = $this -> convertinput($tel);   
$fax = $this -> convertinput($fax);   
$dat = $this -> convertinput($dat);   
$stut = $this -> convertinput($stut);   
$unam = $this -> convertinput($unam);   
$pricetype = $this -> convertinput($pricetype);   
$subcast = $this -> convertinput($subcast);   
$subchk = $this -> convertinput($subchk);   
$cr = $this -> convertinput($cr);   
$idgroup = $this -> convertinput($idgroup);   
$isf = $this -> convertinput($isf);   
$cod = $this -> convertinput($cod);   
$sh = $this -> convertinput($sh);   
$yad = $this -> convertinput($yad);   
$daystut = $this -> convertinput($daystut);   
$locks = $this -> convertinput($locks);   
$idbank = $this -> convertinput($idbank);   
$cr2 = $this -> convertinput($cr2);   
$monid = $this -> convertinput($monid);   
$idnaghd_edit = $this -> convertinput($idnaghd_edit);   
$ctrl1 = $this -> convertinput($ctrl1);   
$ctrl2 = $this -> convertinput($ctrl2);   
$ctrl_av_ma = $this -> convertinput($ctrl_av_ma);   
$nonaghd_bas = $this -> convertinput($nonaghd_bas);   
$nonaghd_bed = $this -> convertinput($nonaghd_bed);   
$ctrl_mprc = $this -> convertinput($ctrl_mprc);   
$idpersonel = $this -> convertinput($idpersonel);   
$p_visitor = $this -> convertinput($p_visitor);   
$ctrl_avma_bay = $this -> convertinput($ctrl_avma_bay);   
$ctrl_avma_sell = $this -> convertinput($ctrl_avma_sell);   
$ctrl_haz1 = $this -> convertinput($ctrl_haz1);   
$ctrl_haz2 = $this -> convertinput($ctrl_haz2);   
$ctrl_haz3 = $this -> convertinput($ctrl_haz3);   
$ctrl_haz4 = $this -> convertinput($ctrl_haz4);   
$lockstut = $this -> convertinput($lockstut);   
$shopname = $this -> convertinput($shopname);   
$black_list = $this -> convertinput($black_list);   
$max_notasvie = $this -> convertinput($max_notasvie);   
$cr_koli = $this -> convertinput($cr_koli);   
$yad_blacklist = $this -> convertinput($yad_blacklist);   
$kart_bank = $this -> convertinput($kart_bank);   
$trans = $this -> convertinput($trans);   
$nam2 = $this -> convertinput($nam2);   
$ver = $this -> convertinput($ver);   
$ctrl_out = $this -> convertinput($ctrl_out);   
$CoVisitor = $this -> convertinput($CoVisitor);   
$IsDistributor = $this -> convertinput($IsDistributor);   
$IsCollector = $this -> convertinput($IsCollector);   
$IsDriver = $this -> convertinput($IsDriver);   
$IsStoreKeeper = $this -> convertinput($IsStoreKeeper);   
$IsStMng = $this -> convertinput($IsStMng);   
$ver2 = $this -> convertinput($ver2);   
$ver_update = $this -> convertinput($ver_update);   
$bima_taf = $this -> convertinput($bima_taf);   
$per_bima = $this -> convertinput($per_bima);   
$bima_taf_haz = $this -> convertinput($bima_taf_haz); 
           
		   
		//$adr = (strlen($adr) == 0) ? 'null': $adr;
		 $tel = (strlen($tel) == 0) ? 0: $tel;
		 $fax = (strlen($fax) == 0) ? 'null': $fax;
		 //$dat = (strlen($dat) == 0) ? 'null': $this -> convertdate($dat);
		 
		 $sh = (strlen($sh) == 0) ? 'null': $sh;
		 $yad = (strlen($yad) == 0) ? 'null': $yad;
		 $daystut = (strlen($daystut) == 0) ? 'null': $daystut;
		 $yad_blacklist = (strlen($yad_blacklist) == 0) ? 'null': $yad_blacklist;
		 
		 $dat = $this -> convertdate($dat);  
		       
		   
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatetafseal  @idkol = $idkol, @tafseal = $tafseal, @idmoin = $idmoin, @nam = N'".$nam."', @adr = N'".$adr."', @tel = N'".$tel."', @fax = N'".$fax."', @dat = '".$dat."', @stut = $stut, @unam = N'".$unam."', @pricetype = $pricetype, @subcast = $subcast, @subchk = $subchk, @cr = $cr, @idgroup = $idgroup, @isf = $isf, @cod = N'".$cod."', @sh = N'".$sh."', @yad = N'".$yad."', @daystut = ".$daystut.", @locks = $locks, @idbank = $idbank, @cr2 = $cr2, @monid = $monid, @idnaghd_edit = $idnaghd_edit, @ctrl1 = $ctrl1, @ctrl2 = $ctrl2, @ctrl_av_ma = $ctrl_av_ma, @nonaghd_bas = $nonaghd_bas, @nonaghd_bed = $nonaghd_bed, @ctrl_mprc = $ctrl_mprc, @idpersonel = $idpersonel, @p_visitor = $p_visitor, @ctrl_avma_bay = $ctrl_avma_bay, @ctrl_avma_sell = $ctrl_avma_sell, @ctrl_haz1 = $ctrl_haz1, @ctrl_haz2 = $ctrl_haz2, @ctrl_haz3 = $ctrl_haz3, @ctrl_haz4 = $ctrl_haz4, @lockstut = $lockstut, @shopname = N'".$shopname."', @black_list = $black_list, @max_notasvie = $max_notasvie, @cr_koli = $cr_koli, @yad_blacklist = N'".$yad_blacklist."', @kart_bank = $kart_bank, @trans = $trans, @nam2 = N'".$nam2."', @ver = $ver, @ctrl_out = $ctrl_out, @CoVisitor = $CoVisitor, @IsDistributor = $IsDistributor, @IsCollector = $IsCollector, @IsDriver = $IsDriver, @IsStoreKeeper = $IsStoreKeeper, @IsStMng = $IsStMng, @ver2 = $ver2, @ver_update = $ver_update, @bima_taf = $bima_taf, @per_bima = $per_bima, @bima_taf_haz = $bima_taf_haz, @rowi = $wi, @ucid =$ucd");
           
         if(!$result){
              die("Failed To Fetch updatetafseal");
         }    
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
	
    function addtafseal($idkol, $tafseal, $idmoin, $nam, $adr, $tel, $fax, $dat, $stut, $unam, $pricetype, $subcast, $subchk, $cr, $idgroup, $isf, $cod, $sh, $yad, $daystut, $locks, $idbank, $cr2, $monid, $idnaghd_edit, $ctrl1, $ctrl2, $ctrl_av_ma, $nonaghd_bas, $nonaghd_bed, $ctrl_mprc, $idpersonel, $p_visitor, $ctrl_avma_bay, $ctrl_avma_sell, $ctrl_haz1, $ctrl_haz2, $ctrl_haz3, $ctrl_haz4, $lockstut, $shopname, $black_list, $max_notasvie, $cr_koli, $yad_blacklist, $kart_bank, $trans, $nam2, $ver, $ctrl_out, $CoVisitor, $IsDistributor, $IsCollector, $IsDriver, $IsStoreKeeper, $IsStMng, $ver2, $ver_update, $bima_taf, $per_bima, $bima_taf_haz, $wi, $us, $pas){ 
        
 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
          $idkol = $this -> convertinput($idkol);   
$tafseal = $this -> convertinput($tafseal);   
$idmoin = $this -> convertinput($idmoin);   
$nam = $this -> convertinput($nam);   
$adr = $this -> convertinput($adr);   
$tel = $this -> convertinput($tel);   
$fax = $this -> convertinput($fax);   
$dat = $this -> convertinput($dat);   
$stut = $this -> convertinput($stut);   
$unam = $this -> convertinput($unam);   
$pricetype = $this -> convertinput($pricetype);   
$subcast = $this -> convertinput($subcast);   
$subchk = $this -> convertinput($subchk);   
$cr = $this -> convertinput($cr);   
$idgroup = $this -> convertinput($idgroup);   
$isf = $this -> convertinput($isf);   
$cod = $this -> convertinput($cod);   
$sh = $this -> convertinput($sh);   
$yad = $this -> convertinput($yad);   
$daystut = $this -> convertinput($daystut);   
$locks = $this -> convertinput($locks);   
$idbank = $this -> convertinput($idbank);   
$cr2 = $this -> convertinput($cr2);   
$monid = $this -> convertinput($monid);   
$idnaghd_edit = $this -> convertinput($idnaghd_edit);   
$ctrl1 = $this -> convertinput($ctrl1);   
$ctrl2 = $this -> convertinput($ctrl2);   
$ctrl_av_ma = $this -> convertinput($ctrl_av_ma);   
$nonaghd_bas = $this -> convertinput($nonaghd_bas);   
$nonaghd_bed = $this -> convertinput($nonaghd_bed);   
$ctrl_mprc = $this -> convertinput($ctrl_mprc);   
$idpersonel = $this -> convertinput($idpersonel);   
$p_visitor = $this -> convertinput($p_visitor);   
$ctrl_avma_bay = $this -> convertinput($ctrl_avma_bay);   
$ctrl_avma_sell = $this -> convertinput($ctrl_avma_sell);   
$ctrl_haz1 = $this -> convertinput($ctrl_haz1);   
$ctrl_haz2 = $this -> convertinput($ctrl_haz2);   
$ctrl_haz3 = $this -> convertinput($ctrl_haz3);   
$ctrl_haz4 = $this -> convertinput($ctrl_haz4);   
$lockstut = $this -> convertinput($lockstut);   
$shopname = $this -> convertinput($shopname);   
$black_list = $this -> convertinput($black_list);   
$max_notasvie = $this -> convertinput($max_notasvie);   
$cr_koli = $this -> convertinput($cr_koli);   
$yad_blacklist = $this -> convertinput($yad_blacklist);   
$kart_bank = $this -> convertinput($kart_bank);   
$trans = $this -> convertinput($trans);   
$nam2 = $this -> convertinput($nam2);   
$ver = $this -> convertinput($ver);   
$ctrl_out = $this -> convertinput($ctrl_out);   
$CoVisitor = $this -> convertinput($CoVisitor);   
$IsDistributor = $this -> convertinput($IsDistributor);   
$IsCollector = $this -> convertinput($IsCollector);   
$IsDriver = $this -> convertinput($IsDriver);   
$IsStoreKeeper = $this -> convertinput($IsStoreKeeper);   
$IsStMng = $this -> convertinput($IsStMng);   
$ver2 = $this -> convertinput($ver2);   
$ver_update = $this -> convertinput($ver_update);   
$bima_taf = $this -> convertinput($bima_taf);   
$per_bima = $this -> convertinput($per_bima);   
$bima_taf_haz = $this -> convertinput($bima_taf_haz);
           
           
		 //$adr = (strlen($adr) == 0) ? 'null': $adr;
		 $tel = (strlen($tel) == 0) ? 123: $tel;
		 $fax = (strlen($fax) == 0) ? 456: $fax;
		 //$dat = (strlen($dat) == 0) ? 'null': $this -> convertdate($dat);
		 
		 $sh = (strlen($sh) == 0) ? 'null': $sh;
		 $yad = (strlen($yad) == 0) ? 'null': $yad;
		 $daystut = (strlen($daystut) == 0) ? 'null': $daystut;
		 $yad_blacklist = (strlen($yad_blacklist) == 0) ? 'null': $yad_blacklist;
		 
		$dat = $this -> convertdate($dat);  
		   
 $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addtafseal @idkol = $idkol, @tafseal = $tafseal, @idmoin = $idmoin, @nam = N'".$nam."', @adr = N'".$adr."', @tel = N'".$tel."', @fax = N'".$fax."', @dat = '".$dat."', @stut = $stut, @unam = N'".$unam."', @pricetype = $pricetype, @subcast = $subcast, @subchk = $subchk, @cr = $cr, @idgroup = $idgroup, @isf = $isf, @cod = N'".$cod."', @sh = N'".$sh."', @yad = N'".$yad."', @daystut = ".$daystut.", @locks = $locks, @idbank = $idbank, @cr2 = $cr2, @monid = $monid, @idnaghd_edit = $idnaghd_edit, @ctrl1 = $ctrl1, @ctrl2 = $ctrl2, @ctrl_av_ma = $ctrl_av_ma, @nonaghd_bas = $nonaghd_bas, @nonaghd_bed = $nonaghd_bed, @ctrl_mprc = $ctrl_mprc, @idpersonel = $idpersonel, @p_visitor = $p_visitor, @ctrl_avma_bay = $ctrl_avma_bay, @ctrl_avma_sell = $ctrl_avma_sell, @ctrl_haz1 = $ctrl_haz1, @ctrl_haz2 = $ctrl_haz2, @ctrl_haz3 = $ctrl_haz3, @ctrl_haz4 = $ctrl_haz4, @lockstut = $lockstut, @shopname = N'".$shopname."', @black_list = $black_list, @max_notasvie = $max_notasvie, @cr_koli = $cr_koli, @yad_blacklist = N'".$yad_blacklist."', @kart_bank = $kart_bank, @trans = $trans, @nam2 = N'".$nam2."', @ver = $ver, @ctrl_out = $ctrl_out, @CoVisitor = $CoVisitor, @IsDistributor = $IsDistributor, @IsCollector = $IsCollector, @IsDriver = $IsDriver, @IsStoreKeeper = $IsStoreKeeper, @IsStMng = $IsStMng, @ver2 = $ver2, @ver_update = $ver_update, @bima_taf = $bima_taf, @per_bima = $per_bima, @bima_taf_haz = $bima_taf_haz, @rowi = $wi, @ucid =$ucd");
           
         if(!$result){
              die("Failed To Fetch addtafseal");
         }  
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
	

    function checkfortafseal_two($us,$pas,$wi){
        $cj=false;
   
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkfortafseal @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkfortafseal");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }   	
	





    function addtafseal_two($idkol, $tafseal, $idmoin, $nam, $adr, $tel, $fax, $dat, $stut, $unam, $pricetype, $subcast, $yad_blacklist, $nam2, $ver, $wi, $us, $pas){ 
        
 
        
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
$idkol = $this -> convertinput($idkol);   
$tafseal = $this -> convertinput($tafseal);   
$idmoin = $this -> convertinput($idmoin);   
$nam = $this -> convertinput($nam);   
$adr = $this -> convertinput($adr);   
$tel = $this -> convertinput($tel);   
$fax = $this -> convertinput($fax);   
$dat = $this -> convertinput($dat);   
$stut = $this -> convertinput($stut);   
$unam = $this -> convertinput($unam);   
$pricetype = $this -> convertinput($pricetype);   
$subcast = $this -> convertinput($subcast);
$yad_blacklist = $this -> convertinput($yad_blacklist);
$nam2 = $this -> convertinput($nam2);
$ver = $this -> convertinput($ver);
           
           
		 //$adr = (strlen($adr) == 0) ? 'null': $adr;
		 $tel = (strlen($tel) == 0) ? 123: $tel;
		 $fax = (strlen($fax) == 0) ? 456: $fax;
		 //$dat = (strlen($dat) == 0) ? 'null': $this -> convertdate($dat);
		 
		 $yad_blacklist = (strlen($yad_blacklist) == 0) ? 'null': $yad_blacklist;
		 
		$dat = $this -> convertdate($dat);  
		   
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addtafseal @idkol = $idkol, @tafseal = $tafseal, @idmoin = $idmoin, @nam = N'".$nam."', @adr = N'".$adr."', @tel = N'".$tel."', @fax = N'".$fax."', @dat = '".$dat."', @stut = $stut, @unam = N'".$unam."', @pricetype = $pricetype, @subcast = $subcast, @yad_blacklist = N'".$yad_blacklist."',@nam2 = N'".$nam2."',@ver = $ver,@rowi = $wi, @ucid =$ucd");
           
         if(!$result){
              die("Failed To Fetch addtafseal");
         }  
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }


 	
    function updatetafseal_two($idkol, $tafseal, $idmoin, $nam, $adr, $tel, $fax, $dat, $stut, $unam, $pricetype, $subcast, $yad_blacklist, $nam2, $ver, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
$idkol = $this -> convertinput($idkol);   
$tafseal = $this -> convertinput($tafseal);   
$idmoin = $this -> convertinput($idmoin);   
$nam = $this -> convertinput($nam);   
$adr = $this -> convertinput($adr);   
$tel = $this -> convertinput($tel);   
$fax = $this -> convertinput($fax);   
$dat = $this -> convertinput($dat);   
$stut = $this -> convertinput($stut);   
$unam = $this -> convertinput($unam);   
$pricetype = $this -> convertinput($pricetype);   
$subcast = $this -> convertinput($subcast);
$yad_blacklist = $this -> convertinput($yad_blacklist);
$nam2 = $this -> convertinput($nam2);
$ver = $this -> convertinput($ver);


		 //$adr = (strlen($adr) == 0) ? 'null': $adr;
		 $tel = (strlen($tel) == 0) ? 123: $tel;
		 $fax = (strlen($fax) == 0) ? 456: $fax;
		 //$dat = (strlen($dat) == 0) ? 'null': $this -> convertdate($dat);
		 
		 $yad_blacklist = (strlen($yad_blacklist) == 0) ? 'null': $yad_blacklist;
		 
		$dat = $this -> convertdate($dat);  
		     
		   
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatetafseal  @idkol = $idkol, @tafseal = $tafseal, @idmoin = $idmoin, @nam = N'".$nam."', @adr = N'".$adr."', @tel = N'".$tel."', @fax = N'".$fax."', @dat = '".$dat."', @stut = $stut, @unam = N'".$unam."', @pricetype = $pricetype, @subcast = $subcast, @yad_blacklist = N'".$yad_blacklist."',@nam2 = N'".$nam2."',@ver = $ver,@rowi = $wi, @ucid =$ucd");
           
         if(!$result){
              die("Failed To Fetch updatetafseal");
         }    
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }



    function deletetafseal_two($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkusevalstore($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletetafseal @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletetafseal");
         }
       
       
       }
        
        
        
        
    } 
     

    function deletetafseal($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletetafseal @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletetafseal");
         }
       
       
       }
        
        
        
        
    } 
     
    
    //Users
    function checkforusers($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforusers @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforusers");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }    
    function updateusers($nam, $pass, $stut, $wi, $us, $pas){
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 
           
       $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updateusers @nam = $nam, @pass = $pass, @stut = $stut, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updateusers");
         }     
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    } 
    function addusers($nam, $pass, $stut, $wi, $us, $pas){ 

 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
          
       $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addusers @nam = $nam, @pass = $pass, @stut = $stut, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addusers");
         }
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deleteusers($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deleteusers @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deleteusers");
         }
       
       
       }
        
        
        
        
    } 
    
    
    //VisitorHesab
    function checkforvisitorhasab($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforvisitorhasab @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforvisitorhasab");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }    
    function updatevisitorhasab($idtafseal, $idvisitor, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
$idtafseal = $this -> convertinput($idtafseal);   
$idvisitor = $this -> convertinput($idvisitor);   
           
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatevisitorhasab @idtafseal = $idtafseal, @idvisitor = $idvisitor, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatevisitorhasab");
         }   
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    } 
    function addvisitorhasab($idtafseal, $idvisitor, $wi, $us, $pas){ 

 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 $idtafseal = $this -> convertinput($idtafseal);   
$idvisitor = $this -> convertinput($idvisitor);   
           
       $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addvisitorhasab @idtafseal = $idtafseal, @idvisitor = $idvisitor, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addvisitorhasab");
         }    
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletevisitorhasab($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletevisitorhasab @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletevisitorhasab");
         }
       
       
       }
        
        
        
        
    } 
        
    
    //VisitorHesab
    function checkforvisitorkala($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforvisitorkala @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforvisitorkala");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatevisitorkala($idp, $idprc, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 
         $idp = $this -> convertinput($idp);   
         $idprc = $this -> convertinput($idprc);      
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatevisitorkala @idp = $idp, @idprc = $idprc, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatevisitorkala");
         }    
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }    
    function addvisitorkala($idp, $idprc, $wi, $us, $pas){ 

 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
         $idp = $this -> convertinput($idp);   
         $idprc = $this -> convertinput($idprc);   
          
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addvisitorkala @idp = $idp, @idprc = $idprc, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addvisitorkala");
         }  
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletevisitorkala($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletevisitorkala @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletevisitorkala");
         }
       
       
       }
        
        
        
        
    }
	

     function checkforvisitorMasir($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforvisitormasir @ucid = $ucd, @rowi = $wi");
        if(!$result){
              die("Failed To Fetch checkforvisitormasir");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        }
           
           
       }else{
           
           return $cj;
           
       }
        
        
    }
    function updatevisitormasir($idvisitor, $idmasir, $wi, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
 
         $idvisitor = $this -> convertinput($idvisitor);   
         $idmasir = $this -> convertinput($idmasir);      
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC updatevisitormasir @idvisitor = $idvisitor, @idmasir = $idmasir, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch updatevisitormasir");
         }    
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }    
    function addvisitormasir($idvisitor, $idmasir, $wi, $us, $pas){ 

 
        
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
       
         $idvisitor = $this -> convertinput($idvisitor);   
         $idmasir = $this -> convertinput($idmasir);   
          
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addvisitormasir @idvisitor = $idvisitor, @idmasir = $idmasir, @rowi = $wi, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch addvisitormasir");
         }  
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
    function deletevisitormasir($us,$pas,$wi){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
         $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletevisitormasir @ucid = $ucd, @rowi = $wi");
           
         if(!$result){
              die("Failed To Fetch deletevisitormasir");
         }
       
       
       }
        
        
        
        
    } 
 
	

    function getAllFactors($que){
		
        $result = OdbcSimulator::odbc_exec($this->getConnection(), $que);
        $resarr = array(); 
        $resro = array();  
        if($result){

            while (OdbcSimulator::odbc_fetch_row($result)){
                
                $temp = array(

                    "id" => $this -> convertinput(OdbcSimulator::odbc_result($result, "id")),
                    "cod_cast" => $this -> convertinput(OdbcSimulator::odbc_result($result, "cod_cast")),
                    "tasvieh" => $this -> convertinput(OdbcSimulator::odbc_result($result, "tasvieh")),
                    "day_numb" => $this -> convertinput(OdbcSimulator::odbc_result($result, "day_numb")),
                    "usernam" => $this -> convertinput(OdbcSimulator::odbc_result($result, "usernam")),
                    "factorid" => $this -> convertinput(OdbcSimulator::odbc_result($result, "factorid")),
                    "count_kala" => $this -> convertinput(OdbcSimulator::odbc_result($result, "count_kala")),
                    "yad" => $this -> convertinput(OdbcSimulator::odbc_result($result, "yad")),
                    "dat" => $this -> convertinput(OdbcSimulator::odbc_result($result, "dat"))
                );

                  array_push($resro, $temp);  
              }

            
        }
 
             array_push($resarr, array("getfactors" => $resro));
             return json_encode($resarr, JSON_UNESCAPED_UNICODE);
		 
		 
	}
    function getAllNewsalesFactors($que){
		
        $result = OdbcSimulator::odbc_exec($this->getConnection(), $que);
        $resarr = array(); 
        $resro = array();  
        if($result){

            while (OdbcSimulator::odbc_fetch_row($result)){
                
                $temp = array(
                    "cod_cast" => $this -> convertinput(OdbcSimulator::odbc_result($result, "cod_cast")),
                    "tasvieh" => $this -> convertinput(OdbcSimulator::odbc_result($result, "tasvieh")),
                    "day_numb" => $this -> convertinput(OdbcSimulator::odbc_result($result, "day_numb")),
                    "cod_kala" => $this -> convertinput(OdbcSimulator::odbc_result($result, "cod_kala")),
                    "numb" => $this -> convertinput(OdbcSimulator::odbc_result($result, "numb")),
                    "price" => $this -> convertinput(OdbcSimulator::odbc_result($result, "price")),
                    "usernam" => $this -> convertinput(OdbcSimulator::odbc_result($result, "usernam")),
                    "factorid" => $this -> convertinput(OdbcSimulator::odbc_result($result, "factorid")),
                    "part" => $this -> convertinput(OdbcSimulator::odbc_result($result, "part")),
                    "yad" => $this -> convertinputreversed(OdbcSimulator::odbc_result($result, "yad")),
                    "trans" => $this -> convertinput(OdbcSimulator::odbc_result($result, "trans")),
                    "unic_id" => $this -> convertinput(OdbcSimulator::odbc_result($result, "unic_id")),
					"fdis" => $this -> convertinput(OdbcSimulator::odbc_result($result, "fdis")),
					"pdis" => $this -> convertinput(OdbcSimulator::odbc_result($result, "pdis")),
                    "count_kala" => $this -> convertinput(OdbcSimulator::odbc_result($result, "count_kala"))
                );

                  array_push($resro, $temp);  
              }

            
        }
 
             array_push($resarr, array("getnewsalesfactors" => $resro));
             return json_encode($resarr, JSON_UNESCAPED_UNICODE);
		 
		 
	}
    
        
	function setFactorsFlag($que){
		$result = OdbcSimulator::odbc_exec($this->getConnection(), $que);
	}
	   
	function setNewSalesFactorsFlag($que){
		$result = OdbcSimulator::odbc_exec($this->getConnection(), $que);
	}
	
		   
	function setNewReportRequestFlag($que){
		$result = OdbcSimulator::odbc_exec($this->getConnection(), $que);
	}
	
			
	   	 
    function prepareAddGPS($gps,$p1,$p2){
        
       $resro = 'False';
       $result= json_decode($gps,true);			 
		
		for($i=0;$i<sizeof($result);$i++){
			
			    $idc  = $result[$i]['idc'];
                $x     = $result[$i]['x'];
                $y    = $result[$i]['y'];
                $tempQu = "EXEC gps_sp @idcast = $idc , @x = $x , @y = $y , @p1 = $p1 , @p2 = $p2";
                $resro = $this->addGPSToHost($tempQu);
			
		}

            $rs2= 'resualt = True';	
			return $rs2;
			 
			 
        
     }

    function addGPSToHost($que){
 
        $result = OdbcSimulator::odbc_exec($this->getConnection(), $que);
       // return $result;
        
     }
	
       
	  function getGpsWithCode($que){
 
        $result = OdbcSimulator::odbc_exec($this->getConnection(), $que);
        $resarr = array(); 
        $resro = array();  
        if($result){

            while (OdbcSimulator::odbc_fetch_row($result)){
                
                $temp = array(
                    
                    "idcast" => $this -> convertinput(OdbcSimulator::odbc_result($result, "idcast")), 
                    "x" => $this -> convertinput(OdbcSimulator::odbc_result($result, "x")), 
                    "y" => $this -> convertinput(OdbcSimulator::odbc_result($result, "y"))
                );
                
                  array_push($resro, $temp);  
              }

            
        }
		
		     $jsn = json_encode($resro, JSON_UNESCAPED_UNICODE);
		
		      $jsn = '{"getgpswithcod":' . $jsn . '}';
              return $jsn;
 

        
     }
	
	function getAllNewReportRequests($que){
		
        $result = OdbcSimulator::odbc_exec($this->getConnection(), $que);
        $resarr = array(); 
        $resro = array();  
        if($result){

            while (OdbcSimulator::odbc_fetch_row($result)){
                

                $temp = array(
                    "id_user" => $this -> convertinput(OdbcSimulator::odbc_result($result, "id_user")),
                    "reqdate" => $this -> convertinput(OdbcSimulator::odbc_result($result, "dat_request")),
                    "reqtime" => $this -> convertinput(OdbcSimulator::odbc_result($result, "time_request")),
                    "dat1" => $this -> convertinput(OdbcSimulator::odbc_result($result, "dat1")),
                    "dat2" => $this -> convertinput(OdbcSimulator::odbc_result($result, "dat2")),
                    "idcast" => $this -> convertinput(OdbcSimulator::odbc_result($result, "idcast")),
                    "idkala" => $this -> convertinput(OdbcSimulator::odbc_result($result, "idkala")),
                    "idarea" => $this -> convertinput(OdbcSimulator::odbc_result($result, "idarea")),
                    "idmaser" => $this -> convertinput(OdbcSimulator::odbc_result($result, "idmaser")),
                    "idvisitor" => $this -> convertinput(OdbcSimulator::odbc_result($result, "idvisitor")),
                    "id_report" => $this -> convertinput(OdbcSimulator::odbc_result($result, "id_report")),
					"id_request" => $this -> convertinput(OdbcSimulator::odbc_result($result, "id"))
                );

                  array_push($resro, $temp);  
              }

            
        }
 
             array_push($resarr, array("requests" => $resro));
             return json_encode($resarr, JSON_UNESCAPED_UNICODE);
		 
		 
	}
	

	
    //ReportForResultwithgraph
    function checkforreportresualtwithgraph($us,$pas,$idreport,$id_request){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforreportresualtwithgraph @ucid = $ucd, @idreport = $idreport, @id_request = $id_request");
        if(!$result){
              die("Failed To Fetch checkforreportresualtwithgraph");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $cj = true;
                 
              }
            
            return $cj;
        } 
           
           
       }else{
           
           return $cj;
           
       }
        
        
    } 
	

    function checkforreportresualtwithgraphCount($us,$pas,$idreport,$id_request){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
           
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC checkforreportresualtwithgraph @ucid = $ucd, @idreport = $idreport, @id_request = $id_request");
        if(!$result){
              die("Failed To Fetch checkforreportresualtwithgraph");
         }else{
            
             while (OdbcSimulator::odbc_fetch_row($result)){
                
                 $counter = $counter + 1;
                 
              }
            
            return $counter;
        } 
           
           
       }else{
           
           return $counter;
           
       }
        
        
    } 
	
    function updatereportresualtwithgraphstatustonores($requestid, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
            
         $requestid = $this -> convertinput($requestid);   
		 
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC set_flag_reportrequest_no_ressult @id_request = $requestid, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch set_flag_reportrequest_ready");
         }     
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
	
		
    function updatereportresualtwithgraphstatus($requestid, $us, $pas){
        
 
        
       $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
            
         $requestid = $this -> convertinput($requestid);   
		 
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC set_flag_reportrequest_ready @id_request = $requestid, @ucid = $ucd");
           
         if(!$result){
              die("Failed To Fetch set_flag_reportrequest_ready");
         }     
           
           return true;
           
       }else{
           
           return false;
           
       }
        

        
    }
	
	
	
    function addreportresualtwithgraph($iduser,$idreport,$id_request,$type,$col1,$col2,$col3, $col4, $col5,$col6,$col7,$col8,$col9,$col10,$gcol1,$gcol2,$gcol3,$gcol4,$dcol5,$gcol6,$gxt,$gyt, $us, $pas){ 
        
 
        
        
		
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
           
         $ucd = $valdata[0];
           
         $iduser = $this -> convertinput($iduser);    
         $idreport = $this -> convertinput($idreport);    
         $id_request = $this -> convertinput($id_request);    
		  $type = $this -> convertinput($type);     
         $col1 = $this -> convertinput($col1);    
         $col2 = $this -> convertinput($col2);    
         $col3 = $this -> convertinput($col3);    
         $col4 = $this -> convertinput($col4);    
         $col5 = $this -> convertinput($col5);    
         $col6 = $this -> convertinput($col6);    
         $col7 = $this -> convertinput($col7);    
         $col8 = $this -> convertinput($col8);    
         $col9 = $this -> convertinput($col9);    
         $col10 = $this -> convertinput($col10);    
         $gcol1 = $this -> convertinput($gcol1);    
         $gcol2 = $this -> convertinput($gcol2);    
         $gcol3 = $this -> convertinput($gcol3);    
         $gcol4 = $this -> convertinput($gcol4);    
         $gcol5 = $this -> convertinput($gcol5);    
         $gcol6 = $this -> convertinput($gcol6);   
		   $gxt = $this -> convertinput($gxt);   
		   $gyt = $this -> convertinput($gyt);   
		 
		 $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC addreportresultwithgraph @iduser = ".$iduser.", @idreport = ".$idreport.", @id_request = ".$id_request.",@type = ".$type.", @col1 = N'".$col1."', @col2 = N'".$col2."', @col3 = N'".$col3."', @col4 = N'".$col4."', @col5 = N'".$col5."', @col6 = N'".$col6."', @col7 = N'".$col7."', @col8 = N'".$col8."', @col9 = N'".$col9."', @col10 = N'".$col10."', @gcol1 = N'".$gcol1."', @gcol2 = N'".$gcol2."', @gcol3 = N'".$gcol3."', @gcol4 = N'".$gcol4."', @gcol5 = N'".$gcol5."', @gcol6 = N'".$gcol6."', @gxt = N'".$gxt."', @gyt = N'".$gyt."', @ucid = $ucd");
		 
         
           
         if(!$result){
              die("Failed To Fetch addreportresultwithgraph");
         }     
           
           return true;
           
       }else{
           
           return false;
       }
        

  
    }
	
    function deletereportresualtwithgraph($us,$pas,$idreport,$id_request){
        $cj=false;
 
        $completeList=  array();
        $counter = 0;
        
        $valdata = $this -> chkuseval($us, $pas);
        
       if(!is_null($valdata) && is_array($valdata) && (sizeof($valdata) === 1)){
        
        $ucd = $valdata[0];
       
             
        $result = OdbcSimulator::odbc_exec($this->getConnection(), "EXEC deletereportresultwithgraph @ucid = $ucd, @idreport = $idreport, @id_request = $id_request");
           
         if(!$result){
              die("Failed To Fetch deletereportresultwithgraph");
         }
       
       
       }
        
        
        
        
    } 
         
    
         
	

    
}
?>