0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: edit_acc_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; include( "../lib/config.php"); include_once("../model/defaults_mdl.php"); require_once "../model/defaultValues_mdl.php"; $p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; $acc_id=$_GET['id']; if(isset($_POST['Update'])) { $acc_id=@$_POST['txtaccid']; } $sql="select * from account where user_id='$u_id' and project_id='$p_id' and account_id='$acc_id'"; $sql1=mysql_query($sql); while($row=mysql_fetch_array($sql1)) { //1 $accname=$row['account_name']; $groupname=$row['group_name']; }//1 $sql="select * from accgroup where user_id='$u_id' and project_id='$p_id' "; $sql=mysql_query($sql); $i=0; while($row=mysql_fetch_array($sql)) { $acc_group=$row['groupname']; $i=$i+1; $acc_group_array[$i]=$acc_group; } $groupname_restore=@$_POST['cmbgroup']; $g_name=$acc_group_array[$groupname_restore]; if(isset($_POST['Update'])) { //2 $error_flag=0; $editaccname=@$_POST['txtaccount']; $editaccid=@$_POST['txtaccid']; //---------Null---/ if($editaccname=="") { $error['accountname_null']="Please Enter accountname"; $error_flag=1; } $sql="select * from account where user_id='$u_id' and project_id='$p_id' and account_name='$accountname_restore' and group_name='$g_name'"; mysql_query($sql); if (mysql_affected_rows()>0) { $error['account_exist']="Account name under this head already exist"; $error_flag=1; } //Checking default accounts. Not allow to edit or delete $result=Common::defaultaccount_check($editaccname,$acc_head,$acc_head_count); if($result=="True") { $message="Sorry. This is default account head. You cannot delete it."; $error_flag=1; } if($error_flag==1) { include("edit_acc.php"); exit(); } else { //$result=Project::updateaccount($editaccid,$editaccname,$g_name); //updated acc //updated groupname //id // groupname from db $resul_finance=Common::editfinance_account($editaccname,$g_name,$editaccid,$accname,$groupname); if ($resul_finance=="True") { $message="Updation Completed successfully.."; $url=$server_ip."/USER/search_acc.php?message=$message"; echo "<script>window.location='$url'</script>"; } else { $message="Updation Failed.."; $url=$server_ip."/USER/search_acc.php?message=$message"; echo "<script>window.location='$url'</script>"; } } } ?>