<?php
	include_once('config.php');   
    if(!isset($_SESSION['custId'])) 
    {
         header("Location: ".ROOTPATH."/");
         die;
    }  

         
		  
		 if(isset($_POST['submitLogin']))
         {      
                $stmt=$conn->prepare("update pw__rabills  set  recordingD=:recordingD,RaBillNO=:RaBillNO,vourchar=:vourchar,dpayment=:dpayment,amtwork=:amtwork,costofBit=:costofBit,royalty=:royalty,clause38=:clause38,netpayment=:netpayment,eightPer=:eightPer where id=:id");
                $stmt->bindValue(':recordingD', $_POST['recordingD'] , PDO::PARAM_STR); 
                $stmt->bindValue(':RaBillNO', $_POST['RaBillNO'] , PDO::PARAM_STR); 
                $stmt->bindValue(':vourchar', $_POST['vourchar'] , PDO::PARAM_STR);  
                $stmt->bindValue(':dpayment', $_POST['dpayment'] , PDO::PARAM_STR);  
                $stmt->bindValue(':amtwork', $_POST['amtwork'] , PDO::PARAM_STR);  
                $stmt->bindValue(':costofBit', $_POST['costofBit']  , PDO::PARAM_STR);  
                $stmt->bindValue(':royalty', $_POST['royalty'] , PDO::PARAM_STR);  
                $stmt->bindValue(':clause38', $_POST['clause38'] , PDO::PARAM_STR);  
                $stmt->bindValue(':netpayment',$_POST['netpayment']   , PDO::PARAM_STR);  
                $stmt->bindValue(':eightPer', $_POST['eightPer'] , PDO::PARAM_STR);  
				$stmt->bindValue(':id', $_REQUEST['id'] , PDO::PARAM_STR);  
                $stmt->execute();    
				$_SESSION['Radded'] = 1;
                header("Location: editRa.php?id=".$_REQUEST['id']);
                die;
         }
         
        
		
		
				
		if(isset($_POST['RaBillNo']))
		{
			
			
				 
				$stmt=$conn->prepare("select  *  from    pw__comp where  custId=:custId  and randNo=:randNo and RaBillNO1=:RaBillNO1 ");   
				$stmt->bindValue(':custId', $_SESSION['custId'] , PDO::PARAM_STR); 
				$stmt->bindValue(':randNo', $_POST['randNo'] , PDO::PARAM_STR); 
				$stmt->bindValue(':RaBillNO1', $_POST['ra'] , PDO::PARAM_STR); 
				 
				$stmt->execute();   
				$FinalResult = $stmt->fetchAll(PDO::FETCH_OBJ); 
				
				 
				
				$calCadta = 0;
					foreach($FinalResult as $mpp)
						$calCadta += $mpp->qtyamt; 
						
				echo $calCadta;
				die;    
		}		
		 
		 
		$stmt=$conn->prepare("select  *  from    pw__rabills where  id=:id ");   
		$stmt->bindValue(':id', $_REQUEST['id'], PDO::PARAM_STR); 
		$stmt->execute();   
		$pw__newage = $stmt->fetch(PDO::FETCH_OBJ); 

include_once("view/editRa.php");
?>