<?php
require_once('functions.php');

//$user=$_SESSION['user'];
require_once('mysql.php');
	

$typ=mysqli_real_escape_string($dbc,trim($_POST['typ']));
$amnt=mysqli_real_escape_string($dbc,trim($_POST['amnt']));

$sal=mysqli_real_escape_string($dbc,trim($_POST['gg']));
 //echo $m;
// $dv=$qty*$price;
// $fjk="select type from x_report where id='$sal'";
  //  $gpp=mysqli_query($dbc,$fjk);
	//$tot=mysqli_fetch_array($gpp);
	  // $tota=$tot['total_p'];
	   //$typ=$tot['type'];
	  // $fjk="select cust from x_report where receipt='$m' and type='$typ'";
      //$fo=mysqli_query($dbc,$fjk);
	   // $rew=mysqli_fetch_array($fo);
		 //  $di=$rew['cust'];
	      // $vcc="update accounts set debt =debt-'$tota' where id='$di' limit 1"; 
		  //$up=mysqli_query($dbc,$vcc);
 
   
	 //   $vc="update accounts set debt =debt+'$dv' where id='$di' limit 1"; 
	//	  $up=mysqli_query($dbc,$vc);
		 // $ji="update x_report set amount=amount-'$tota' where receipt='$m' and type='$typ' limit 1";
		   //  $xe=mysqli_query($dbc,$ji);
			$jii="update x_report set amount='$amnt', type='$typ' where id='$sal' limit 1";
		    $xee=mysqli_query($dbc,$jii);
			// $sa="update sales set qty='$qty', price='$price',total_p='$dv', prof='$dv' p_name='$p' where sale_id='$sal' limit 1";
  // $kiu=mysqli_query($dbc,$sa);
//	 $pdu= "update ledgers set debit='$dv', qty='$qty', price='$price' where invoice='$m' and description='$p' and debit>0";
	 
  //$sql=mysqli_query($dbc,$pdu);	
//$pd= "update ledgers set credit='$dv', qty='$qty' ,price='$price' where invoice='$m' and description='$p' and credit>0";
	 
  //$sqd=mysqli_query($dbc,$pd);	

mysqli_close($dbc);
  header("location: sale_r.php");
	
?>