<?php 	include_once('../../config.php');   	
		include_once(ABS_PATH.'/admin/login_check.php');    
 
                 
                            
                                        
                			if(isset($_POST['PssSub']))
                			{     
                			    
                			    
                			    echo 'WORK IN PROGRESS <pre>'; print_r($_POST);
                			    
                			    die;
                			    
                               
                			     
                			    if(trim($_POST['pdddF'])=="Ram2008#")
                			    { 
                			          
                			        
                                    $stmt=$conn->prepare("select *  from UI__UpiManage   where typ=2");  
                                    $stmt->execute();      
                                    $RstUxd = $stmt->fetch(PDO::FETCH_OBJ); 
                                    
                                    $myIdset = $_POST['PyId']; 
                                    if($_POST['payselect']==1)
                                    {      
                                         
                                        $stmt=$conn->prepare("select  * from  UI__TxnFailUsers where id=:id  ");  
                                        $stmt->bindValue(':id', $myIdset , PDO::PARAM_STR);
                                        $stmt->execute(); 
                                        $Mydetails = $stmt->fetch(PDO::FETCH_OBJ);
                                        

                                        $stmt =  $conn->prepare("select phm from  UI__Rgst  where  cuurentId=:cuurentId     ");   
    									$stmt->bindValue(':cuurentId', $Mydetails->custId, PDO::PARAM_STR); 
    									$stmt->execute();  
    									$phm = $stmt->fetch(PDO::FETCH_OBJ);   
    								 
									          
    								    $stmt =  $conn->prepare("select accName from  UI__AddAccount  where  custId=:custId  and accno=:accno and  ifsc=:ifsc   ");   
    									$stmt->bindValue(':custId', $Mydetails->custId, PDO::PARAM_STR);
    									$stmt->bindValue(':accno', $Mydetails->accno , PDO::PARAM_STR);
    									$stmt->bindValue(':ifsc', $Mydetails->ifsc , PDO::PARAM_STR);
    									$stmt->execute(); 
    									$AccDetails = $stmt->fetch(PDO::FETCH_OBJ);    
									
                                        $Remail =  "dailypay2024@gmail.com";
                                        $Rd =  "ztw35i";  
                                        $access_token = '{"email":"'.$Remail.'","password":"'.$Rd.'"}'; 
                                        $ch = curl_init('https://api.pay2all.in/token');                                             
                                        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
                                        curl_setopt($ch, CURLOPT_POSTFIELDS, $access_token);                                                                  
                                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
                                        curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
                                        'x-tera-tenant-region: IN', 
                                        'Content-Type: application/json', 
                                        'Content-Length: ' . strlen($access_token))                                                                       
                                        );       																		 
                                        $response = curl_exec($ch); 
                                        $json_response = json_decode($response);   
                                        $RechargeAccess_token = $json_response->access_token; 
                                        $beneficiary_ifsc = $Mydetails->ifsc;
                                         
                                           
                                        $client_id = mt_rand(100000, 999999);
                                        $amount=round($Mydetails->amt-$deduction);
                                        $beneficiary_accountno = $account=$Mydetails->accno;
                                        $beneficiary_name =  $AccDetails->accName;  
                                        
                                        if($beneficiary_accountno=="6445319288")
                                        $beneficiary_name = "AARTI KACHARE";       
												    
												    
                                        $data_string = '{"mobile_number": "'.$phm->phm.'","amount": "'.$amount.'","beneficiary_name": "'.$beneficiary_name.'","account_number": "'.$beneficiary_accountno.'","ifsc": "'.$beneficiary_ifsc.'","channel_id": "2","client_id": "'.$client_id.'","provider_id": "143"}';   
                                         
                                        //$res=makeMoneyTransferUsingAPI($data_string); 
                                        ///$res = '{"status":0,"status_id":1,"orderid":"","utr":"325509637242","report_id":7758190,"message":"Success"}';// for success status_id  ==1
                                          
                                        $ch = curl_init();
                                        curl_setopt($ch, CURLOPT_URL, 'https://api.pay2all.in/v1/payout/transfer');
                                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
                                        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
                                        curl_setopt($ch, CURLOPT_POST, 1);
                                        $headers = array();
                                        $headers[] = "Accept: application/json";
                                        $headers[] = "Authorization: Bearer ".$RechargeAccess_token;
                                        $headers[] = "Content-Type: application/json";
                                        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                                        $res = curl_exec($ch); 
                                        
                                       
                                         
                                        
                                        $stmt=$conn->prepare("insert into UI__MoneY(Uid,request,response,Tdate) values(:Uid,:request,:calBack,:Tdate)"); 
                                        $stmt->bindValue(':Uid',  $Mydetails->custId , PDO::PARAM_STR);    
                                        $stmt->bindValue(':request', $data_string , PDO::PARAM_INT);    
                                        $stmt->bindValue(':calBack', $res , PDO::PARAM_INT);    
                                        $stmt->bindValue(':Tdate',  date("d-M-Y H:i") , PDO::PARAM_STR);     
                                        $stmt->execute(); 

                                        $Data = json_decode($res); 
                                        
                                        if($Data->utr)
                                        $UTR = $Data->utr;
                                        else
                                        $UTR = "";  
                                        
                                        if (array_key_exists("status_id",$Data))
                                        {
                                        if(($Data->status_id==0) || ($Data->status_id==1))
                                        {
                                        $moneytransfer_status='Success';
                                        $status=1;
                                        $_SESSION['moneytransfer_success'.$rand_no]=1;
                                        }
                                        else if(($Data->status_id==2) || ($Data->status_id==4))
                                        {
                                        $moneytransfer_status='Fail';
                                        $status=0;
                                        
                                        
                                        /*
                                            
                                         if($Mydetails->amt <=1000)
                                            $deduction = 15;
                                        else
                                             $deduction = ($Mydetails->amt*1.5)/100;
                                         
                                          
											$_POST['userid'] = $Mydetails->custId;
                    				        $_POST['fund'] =  round($Mydetails->amt+$deduction);
                    				        
                    				       
                    				         
                                            $stmt=$conn->prepare("select  amt,availableFund from  UI__Fundtransfer   where userid=:cuurentId order by id desc");  
                                            $stmt->bindValue(':cuurentId', $_POST['userid'] , PDO::PARAM_STR);
                                            $stmt->execute();  
                                            
                                            if($stmt->rowCount() > 0)
                                            {
                                               $AllUsers = $stmt->fetch(PDO::FETCH_OBJ); 
                                               $totalAvaib = $AllUsers->availableFund+$_POST['fund'];  
                                            } 
                                            
                                			$stmt=$conn->prepare("insert into  UI__Fundtransfer (userid,Tdate,amt,availableFund,refunded) values(:userid,:Tdate,:amt,:availableFund,1)    "); 
                                            $stmt->bindValue(':userid',$_POST['userid'], PDO::PARAM_STR); 
                                            $stmt->bindValue(':Tdate',date("d-M-Y H:i"), PDO::PARAM_STR); 
                                            $stmt->bindValue(':amt',$_POST['fund'], PDO::PARAM_STR);  
                                            $stmt->bindValue(':availableFund', $totalAvaib , PDO::PARAM_STR);  
                                            $stmt->execute(); 
                                             
                                            
                                            $stmt=$conn->prepare("select *  from UI__DailyROIGene    where custId=:sId     ");   
                                            $stmt->bindValue(':sId',  $_POST['userid'] , PDO::PARAM_INT);  
                                            $stmt->execute(); 
                                            $XUI__DailyROIGene = $stmt->fetchAll(PDO::FETCH_OBJ);  
                                            
                                            $Tamnt = 0;
                                            foreach($XUI__DailyROIGene as $xx)
                                            {
                                            $Tamnt +=$xx->amount;
                                            }      
                                            
                                            
                                            $stmt=$conn->prepare("select Tamt  from UI__Bns    where Rid =:sId   ");   
                                            $stmt->bindValue(':sId',  $_POST['userid'] , PDO::PARAM_INT);  
                                            $stmt->execute(); 
                                            $UI__Bns = $stmt->fetchAll(PDO::FETCH_OBJ); 
                                            
                                            $LevelI = 0;
                                            foreach($UI__Bns as $dddm)
                                            {
                                            $LevelI +=$dddm->Tamt;
                                            }
                                            
                                            
                                            $stmt=$conn->prepare("select Amt   from UI__Tpm where TopUpId=:refId   ");   
                                            $stmt->bindValue(':refId',  $_POST['userid'] , PDO::PARAM_INT);  
                                            $stmt->execute(); 
                                            $MdirectB = $stmt->fetchAll(PDO::FETCH_OBJ);  
                                            
                                            $directIncome = 0;
                                            foreach($MdirectB as $dmm)
                                            $directIncome += $dmm->Amt;                
                                            
                                            
                                            
                                            
                                            $stmt=$conn->prepare("select *  from UI__WithDraw    where userid=:sId and (accept=1 ||accept=2)  ");   
                                            $stmt->bindValue(':sId', $_POST['userid'] , PDO::PARAM_INT);  
                                            $stmt->execute(); 
                                            $UI__WithDraw = $stmt->fetchAll(PDO::FETCH_OBJ); 
                                            
                                            
                                            $totalWithdrwa = 0;
                                            foreach($UI__WithDraw as $tl)
                                            {
                                            $totalWithdrwa +=$tl->amt;
                                            }
                                            
                                              
                                            $stmt=$conn->prepare("select availableFund from UI__Fundtransfer  where  userid=:userid  order by id desc  ");   
                                            $stmt->bindValue(':userid',  $_POST['userid'] , PDO::PARAM_INT);  
                                            $stmt->execute(); 
                                            $UI__Fundtransfer = $stmt->fetch(PDO::FETCH_OBJ);   
                                            
                                               
                                            $PAYWAllet =  ($Tamnt+$LevelI+$directIncome+$UI__Fundtransfer->availableFund)-($totalWithdrwa);      
                                            $stmt=$conn->prepare("insert into  UI__DebitCredit (custId,addDel,availableBal,Tdate,type,Intype,byw) values(:custId,:addDel,:availableBal,:Tdate,:type,'Refunded','NA')"); 
                                            $stmt->bindValue(':custId',$_POST['userid'], PDO::PARAM_STR); 
                                            $stmt->bindValue(':addDel',$_POST['fund'], PDO::PARAM_STR); 
                                            $stmt->bindValue(':availableBal',$PAYWAllet, PDO::PARAM_STR);  
                                            $stmt->bindValue(':Tdate', date("d-M-Y H:i") , PDO::PARAM_STR);  
                                            $stmt->bindValue(':type', 1 , PDO::PARAM_STR);   
                                            $stmt->execute();     
                                            $LastIntId = $conn->lastInsertId();
                                            
                                            $stmt=$conn->prepare("select id from UI__Rgst  where  cuurentId=:cuurentId    ");   
                                            $stmt->bindValue(':cuurentId',  $_POST['userid'] , PDO::PARAM_STR);  
                                            $stmt->execute(); 
                                            $UIid = $stmt->fetch(PDO::FETCH_OBJ);   
                                            
                                            $amount = password_hash(($PAYWAllet),PASSWORD_DEFAULT);  
                                            $stmt =  $conn->prepare("update _pkCc__ set bl1=:bl1,tm=:tm where Uxd=:Uxd "); 
                                            $stmt->bindValue(':bl1', $amount, PDO::PARAM_STR); 
                                            $stmt->bindValue(':tm', date("d-M-Y H:i"), PDO::PARAM_STR); 
                                            $stmt->bindValue(':Uxd', $UIid->id, PDO::PARAM_STR);  
                                            $stmt->execute();   
                                            
                                            $stmt=$conn->prepare("select * from UI__Rgst  where  cuurentId=:cuurentId  ");   
                                            $stmt->bindValue(':cuurentId',  $_POST['userid'] , PDO::PARAM_STR);  
                                            $stmt->execute();
                                            $UI__Rgst = $stmt->fetch(PDO::FETCH_OBJ);     	
                                            
                                            
                                            $stmt=$conn->prepare("insert into UI__Receipt(type,bank,mobile,email,amountPaid,Tid,status,Tdate,custId,cdId,Topay,TopayName) values(:type,:bank,:mobile,:email,:amountPaid,:Tid,:status,:Tdate,:custId,:cdId,:Topay,:TopayName)"); 
                                            $stmt->bindValue(':type',   11 , PDO::PARAM_STR);   
                                            $stmt->bindValue(':bank',  "Refunded" , PDO::PARAM_STR);   
                                            $stmt->bindValue(':mobile', $UI__Rgst->phm, PDO::PARAM_STR);
                                            $stmt->bindValue(':email', $UI__Rgst->eml , PDO::PARAM_STR); 
                                            $stmt->bindValue(':amountPaid', $_POST['fund']  , PDO::PARAM_STR); 
                                            $stmt->bindValue(':Tid', mt_rand(1234552,23555), PDO::PARAM_STR); 
                                            $stmt->bindValue(':status', 1 , PDO::PARAM_STR); 
                                            $stmt->bindValue(':Tdate', date("d-M-Y H:i") , PDO::PARAM_STR);      
                                            $stmt->bindValue(':custId', $_POST['userid'], PDO::PARAM_STR);  
                                            $stmt->bindValue(':cdId', $LastIntId  , PDO::PARAM_STR); 
                                            $stmt->bindValue(':Topay',  $_POST['userid'] , PDO::PARAM_STR); 
                                            $stmt->bindValue(':TopayName',  $_POST['userid'] , PDO::PARAM_STR);     
                                            $stmt->execute();    
                				       
                                        
                                        
                                            
                                            $stmt=$conn->prepare("update UI__TxnFailUsers set UTR=:UTR,status=1  where id=:id  ");  
                                            $stmt->bindValue(':UTR', "XXX" , PDO::PARAM_STR);
                                            $stmt->bindValue(':id', $myIdset , PDO::PARAM_STR);
                                            $stmt->execute();
                                        
                                            */    
                                        
                                        }
                                        else if($Data->status_id==3)
                                        {
                                        $moneytransfer_status='Pending'; 
                                        $status=2; 
                                        }  
                                        
                                        if(!empty($Data->orderid))
                                        {
                                        $orderid=$Data->orderid;   
                                        $Dataorderid = $Data->orderid;
                                        $Datareport_id = $Data->report_id;
                                        }else 
                                        {
                                        $errorMsg = $Data->message;
                                        $Dataorderid = '';
                                        $Datareport_id = '';
                                        $orderid = ''; 
                                        }
                                        
                                        }else
                                        {
                                        $moneytransfer_status='Fail';
                                        $status=0;  
                                        $errorMsg = "Error in transaction";
                                        $Dataorderid = '';
                                        $Datareport_id = '';
                                        $orderid = '';    
                                        }  
                                         
                                        if( ($status==1) || ($status==2) ) 
                                        {
                                            $Datareport_id = mt_rand(3455456,45455);
                                        }else
                                            $Datareport_id = mt_rand(3455456,45455);
                                            
                                        if($status!=0) 
                                        {
                                        $stmt=$conn->prepare("update UI__TxnFailUsers set UTR=:UTR,paidDateTime=:paidDateTime,status=1  where id=:id  ");  
                                        $stmt->bindValue(':UTR', $Datareport_id , PDO::PARAM_STR);
                                        $stmt->bindValue(':paidDateTime', date("d-M-Y H:i") , PDO::PARAM_STR);
                                        $stmt->bindValue(':id', $myIdset , PDO::PARAM_STR);  
                                        $stmt->execute();
                                        }
                                        
                                        $stmt=$conn->prepare("select  impnft from  UI__TxnFailUsers where id=:id  ");  
                                        $stmt->bindValue(':id', $myIdset , PDO::PARAM_STR);
                                        $stmt->execute(); 
                                        $Mydetails = $stmt->fetch(PDO::FETCH_OBJ);
                                        
                                        if($Mydetails->impnft==0)   
                                        {
                                            header("Location: ".ROOTPATH."/admin/usereReqt/UsdtxnFaild.php");   
                                            die;
                                        }
                                        else
                                        {
                                            header("Location: payout-manage.php");
                                            die;
                                        }       
									}
									
									else if($_POST['payselect']==3)
									{   
									   
									    $stmt =  $conn->prepare("select * from  UI__TxnFailUsersPay2   where  id=:id     ");   
    									$stmt->bindValue(':id', $myIdset , PDO::PARAM_STR); 
    									$stmt->execute();  
    									$UI__TxnFailUsersPay2 = $stmt->fetch(PDO::FETCH_OBJ);   
    									
    									$stmt =  $conn->prepare("select * from  UI__Rgst   where  cuurentId=:cuurentId     ");   
    									$stmt->bindValue(':cuurentId', $UI__TxnFailUsersPay2->custId , PDO::PARAM_STR); 
    									$stmt->execute();  
    									$phm = $stmt->fetch(PDO::FETCH_OBJ);   
    								  
									          
    								    $stmt =  $conn->prepare("select accName from  UI__AddAccount  where  custId=:custId  and accno=:accno and  ifsc=:ifsc   ");   
										$stmt->bindValue(':custId', $UI__TxnFailUsersPay2->custId , PDO::PARAM_STR);
										$stmt->bindValue(':accno', $UI__TxnFailUsersPay2->accno , PDO::PARAM_STR);
										$stmt->bindValue(':ifsc', $UI__TxnFailUsersPay2->ifsc , PDO::PARAM_STR);
    									$stmt->execute(); 
    									$AccDetails = $stmt->fetch(PDO::FETCH_OBJ);  
    									
    									// 
									 
										$beneficiary_name =  $AccDetails->accName;   
                                        $Remail =  "RdVFLtRb83jLrxM5mafitjRW6Gp4zbfiwYXfhr6FEg6n3w4RQXfC9pNkhEMd";
                                        $email =  $phm->eml; 
                                        $customer_mobile =  $phm->phm; 
                                        $amount = ($_POST['amount']-$deduction) ; 
                                        $ifsc_code =  $_POST['ifsc'];
                                        $ClientId =  mt_rand(100000, 999999);  
                                        $account_number = $_POST['accountNo'];  
                                        $access_token = '{"api_token":"'.$Remail.'","email":"'.$email.'","beneficiary_name":"'.$beneficiary_name.'","mobile_number":"'.$customer_mobile.'","amount":"'.$amount.'","ifsc_code":"'.$ifsc_code.'","client_id":"'.$ClientId.'","account_number":"'.$account_number.'","channel_id":"2"}';
                                         
                                        
                                        
                                        $ch = curl_init('https://grappay.com/api/payout/v2/transfer-now');                                             
                                        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
                                        curl_setopt($ch, CURLOPT_POSTFIELDS, $access_token);                                                                  
                                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
                                        curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
                                        'x-tera-tenant-region: IN', 
                                        'Content-Type: application/json', 
                                        'Content-Length: ' . strlen($access_token))                                                                       
                                        );       																		 
                                        $response = curl_exec($ch);  
                                         
                                        
                                        $stmt=$conn->prepare("insert into UI__MoneY(Uid,response,Tdate,request) values(:Uid,:calBack,:Tdate,:request)"); 
                                        $stmt->bindValue(':Uid',  $_SESSION['userId'] , PDO::PARAM_STR);    
                                        $stmt->bindValue(':calBack', $response.":: GrepPay" , PDO::PARAM_INT);    
                                        $stmt->bindValue(':Tdate',  date("d-M-Y H:i") , PDO::PARAM_STR);     
                                        $stmt->bindValue(':request',  $access_token , PDO::PARAM_STR);     
                                        
                                        
                                        $stmt->execute();  
                                        $Data = json_decode($response);  
                                       
                                       
                                        if($Data->utr)
                                            $UTR = $Data->utr;
                                        else
                                            $UTR = "";  
                                        
                                        if (array_key_exists("status_id",$Data))
                                        {
                                        if(($Data->status_id==0) || ($Data->status_id==1))
                                        {
                                        $moneytransfer_status='Success';
                                        $status=1;
                                        $_SESSION['moneytransfer_success'.$rand_no]=1;
                                        }
                                        else if(($Data->status_id==2) || ($Data->status_id==4))
                                        {
                                        $moneytransfer_status='Fail';
                                        $status=0;   
                                        }
                                        else if($Data->status_id==3)
                                        {
                                        $moneytransfer_status='Pending'; 
                                        $status=2; 
                                        $UTR = "Sys_".rand(34345,134423);
                                        }  
                                        
                                        if(!empty($Data->orderid))
                                        {
                                        $orderid=$Data->orderid;   
                                        $Dataorderid = $Data->orderid;
                                        $Datareport_id = $Data->report_id;
                                        }else 
                                        {
                                        $errorMsg = $Data->message;
                                        $Dataorderid = '';
                                        $Datareport_id = '';
                                        $orderid = ''; 
                                        }
                                        
                                        }else
                                        {
                                        $moneytransfer_status='Fail';
                                        $status=0;  
                                        $errorMsg = "Error in transaction";
                                        $Dataorderid = '';
                                        $Datareport_id = '';
                                        $orderid = '';    
                                        }  
                                         
                                        $status = 0; 
                                        if($Data->status=='pending')  
                                        {
                                              $UTR = "Sys_".rand(34345,134423);
                                              $statusUp = 0;
                                              $status = 1;
                                        }
                                              
                                        if( ($status==1) || ($status==2) ) 
                                        {
                                            $Datareport_id = mt_rand(3455456,45455);
                                        }else
                                            $Datareport_id = mt_rand(3455456,45455);
                                            
                                           
                                            
                                        if($status!=0) 
                                        {     
                                            $stmt=$conn->prepare("insert into UI__TxnFailUsersPay2(custId,Tdate,amt,type,accno,ifsc,holder,cdId,UTR,acceptStats,paidDateTime,client_id,impnft,status) values(:custId,:Tdate,:amt,:type,:accno,:ifsc,:holder,:cdId,:UTR,:acceptStats,:paidDateTime,:client_id,1,:status) ");    
                                            $stmt->bindValue(':custId',  $_SESSION['userId'], PDO::PARAM_STR);
                                            $stmt->bindValue(':Tdate',  date("d-M-Y H:i"), PDO::PARAM_STR);
                                            $stmt->bindValue(':amt',  ($_POST['amount']-$deduction) , PDO::PARAM_STR);
                                            $stmt->bindValue(':type',  1, PDO::PARAM_STR);  
                                            $stmt->bindValue(':accno',  $_POST['accountNo'] , PDO::PARAM_STR);  
                                            $stmt->bindValue(':ifsc',  $_POST['ifsc'] , PDO::PARAM_STR);  
                                            $stmt->bindValue(':holder',  $_POST['rname_'] , PDO::PARAM_STR);  
                                            $stmt->bindValue(':cdId',  $_SESSION['LastIntId'] , PDO::PARAM_STR);
                                            $stmt->bindValue(':UTR',  $UTR , PDO::PARAM_STR);
                                            $stmt->bindValue(':acceptStats',  date("d-M-Y H:i") , PDO::PARAM_STR);
                                            $stmt->bindValue(':paidDateTime',  date("d-M-Y H:i") , PDO::PARAM_STR);
                                            $stmt->bindValue(':client_id',  $ClientId , PDO::PARAM_STR);  
                                            $stmt->bindValue(':status',  $statusUp , PDO::PARAM_STR);
                                            $stmt->execute();    
                                        }else
                                        {
                                            
                                            $stmt=$conn->prepare("insert into UI__TxnFailUsersPay2(custId,Tdate,amt,type,accno,ifsc,holder,cdId,client_id,impnft) values(:custId,:Tdate,:amt,:type,:accno,:ifsc,:holder,:cdId,:client_id,1) ");    
                                            $stmt->bindValue(':custId',  $_SESSION['userId'], PDO::PARAM_STR);
                                            $stmt->bindValue(':Tdate',  date("d-M-Y H:i"), PDO::PARAM_STR);
                                            $stmt->bindValue(':amt',  ($_POST['amount']-$deduction) , PDO::PARAM_STR);
                                            $stmt->bindValue(':type',  1, PDO::PARAM_STR);  
                                            $stmt->bindValue(':accno',  $_POST['accountNo'] , PDO::PARAM_STR);  
                                            $stmt->bindValue(':ifsc',  $_POST['ifsc'] , PDO::PARAM_STR);  
                                            $stmt->bindValue(':holder',  $_POST['rname_'] , PDO::PARAM_STR);  
                                            $stmt->bindValue(':cdId',  $_SESSION['LastIntId'] , PDO::PARAM_STR); 
                                            $stmt->bindValue(':client_id',  $ClientId , PDO::PARAM_STR);  
                                            $stmt->execute();  
                                        }  
									    
									}
									
								 
                			    }
            			} 
                        
                       
?>