<? 
 if($_SESSION['page'] == '5' and $_SESSION['section'] == '1') 
 	{ 

			
			if ($_GET['stat'] == 'savepayment') { 
			
					$payment_date		= $_POST['payment_date'];
					$payment_where		= $_POST['payment_where'];
					$receipt			= $_POST['receipt'];
					$invoice 			= $_POST['invoice'];
					$amount 			= $_POST['amount'];
					$note		   		= $_POST['note'];
					$payment_type 		= $_POST['payment_type'];
					$status				= $_POST['status'];
					$collected			= $_POST['collected'];
					
				if ($_POST['status'] == "1" )
					{	
						$collected = $collected+$amount ;
					 	mysql_query("UPDATE ".$dcm_table_start."case SET collected = $collected where case_id = ".$_POST['case_id']);
					}
				
				
				 mysql_query("UPDATE ".$dcm_table_start."call_payment SET payment_date = '$payment_date' , payment_where = $payment_where , receipt = '$receipt' , invoice = '$invoice' , amount = $amount , note = '$note' , payment_type = $payment_type , status = $status  where pid = ".$_SESSION['5_1_pid']);
				 
				header("Location: index.php"); 
			
			}
			
			
	}
?>