<?php include("config.php");







$dresult=mysql_query("select * from income WHERE id='$_POST[id]' limit 1");



$drow=mysql_fetch_array($dresult);







mysql_query("delete from bank_deposit WHERE id='$drow[chid]'");





$cdate=dtformat($_POST[cdate]);



$a=substr("$cdate",0,4);



$b=substr("$cdate",5,2);



$dt=$a.$b;







$r = mysql_query("SHOW TABLE STATUS LIKE 'bank_deposit' ");



$row = mysql_fetch_array($r);



$auto_increment = $row['Auto_increment'];







mysql_query("update income set cost_type='$_POST[cost_type]',pt='$_POST[pt]',onagof='$_POST[onagof]',amount='$_POST[amount]',cdate='$cdate',comments='$_POST[comments]',dt='$dt' ,voucher='$_POST[voucher]' , pay_methode='$_POST[pay_methode]', chid='$auto_increment' , acc_no='$_POST[acc_no]' WHERE id='$_POST[id]'");











if($_POST[pay_methode] == 'Paid By'){







$cdate=$tdate;



$a=substr("$cdate",0,4);



$b=substr("$cdate",5,2);



$dt=$a.$b;







mysql_query("insert into bank_deposit(client, acc_no, dsno ,amount ,cdate ,comments ,dt )VALUES('0','$_POST[acc_no]', '', '$_POST[amount]', '$cdate', '$_POST[comments]', '$dt')");



}











header("location:add_income.php");



?>