echo $row["id"];
        ?>
"><?php 
        echo $row["caption"];
        ?>
 &nbsp;</a></div>
    <div class="rws-column rws-bigsection"><?php 
        echo $row["account_no"];
        ?>
 &nbsp;</div>
    <div class="rws-column"><?php 
        echo $array_product_type[$row["product_type"]];
        ?>
 &nbsp;</div>
    <div class="rws-column"><?php 
        echo togetfieldvalue($row['bank'], 'tbl_banks', 'bank');
        ?>
 &nbsp;</div>
    <div class="rws-column"><?php 
        if ($row['status'] == "1") {
            echo '<span class="gtaccepted">Verified</span>';
        } elseif ($row['status'] == "2") {
            echo '<span  class="gtrejected">Not Verified</span>';
        } else {
            echo '<span  class="gtpending">Pending</span>';
        }
        ?>
 &nbsp;</div>   
    <div class="rws-column"><?php 
        echo togetofferstatus($row["id"], $_SESSION['GTUserID'], $array_statuso2, $array_statuso);
        ?>
    }
}
$j = 1;
$search_txt = $_POST["search_txt"];
if ($search_txt != "") {
    $nquery = " AND (`registerfirstname` LIKE '%{$search_txt}%' OR `registerlastname` LIKE '%{$search_txt}%' OR `registercompanyname`  LIKE '%{$search_txt}%'  OR `registerlocationtowncity`  LIKE '%{$search_txt}%'  OR `registerpostcode`  LIKE '%{$search_txt}%'  OR `registeremail`  LIKE '%{$search_txt}%' ) ";
}
$query = "SELECT t1.*,t2.id as ac_id,t2.account,t2.balance,t2.bank,t2.status,t2.alert,t2.account_no,t2.\ndate_opened,t2.date_closed,t2.dateofbirth,t2.pancard,t2.note, t2.product_type, t2.caption, t2.unikdueid,\n t2.add_date as account_date FROM `tbl_userdetails` as t1 INNER JOIN `tbl_accounts` as t2 ON t1.id=t2.userid\n  WHERE t2.bank=" . $_SESSION['banid'] . $nquery;
$rs = mysql_query_with_throw($query);
$perpage = 20;
$currentpage = $_REQUEST['currentpage'] ? $_REQUEST['currentpage'] : '1';
$startrecord = ($currentpage - 1) * $perpage;
$totalrows = mysql_num_rows($rs);
$result = mysql_query_with_throw($query . " ORDER BY t2.add_date DESC LIMIT {$startrecord}, {$perpage}") or die(mysql_error());
$rand2 = mt_rand(1000, 9999);
$filenamenew = str_replace(' ', '-', togetfieldvalue($_SESSION['bid'] - 1, 'tbl_banks', 'bank')) . '-User-Account-Data-' . $rand2 . "-" . date('d-m-Y') . ".csv";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ADMIN CONSOLE // <?php 
echo $sitename;
?>
 Website</title>
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/theme.default.css" type="text/css" media="screen" /> 
<link href="<?php 
echo $baseurl;
<?php

checklogin();
$lockstatus = togetfieldvalue($_SESSION['GTUserID'], 'tbl_userdetails', 'lock');
if ($lockstatus == 0) {
    if (isset($_POST['button'])) {
        $_SESSION['myForm'] = $_POST;
        $firstname = addslashes($_POST["firstname"]);
        $middlename = addslashes($_POST["middlename"]);
        $lastname = addslashes($_POST["lastname"]);
        $email = $_POST["email"];
        $password = addslashes($_POST["password"]);
        $mobile = addslashes($_POST["mobile"]);
        $address1 = addslashes($_POST["address1"]);
        $address2 = addslashes($_POST["address2"]);
        $city = addslashes($_POST["city"]);
        $state = addslashes($_POST["state"]);
        $country = addslashes($_POST["country"]);
        $pincode = addslashes($_POST["pincode"]);
        $phone = addslashes($_POST["phone"]);
        $errors = array();
        //Initialize error array
        // Name
        if (empty($_POST['firstname'])) {
            $errors[] = "First Name field can't be blank!";
        }
        if (empty($_POST['lastname'])) {
            $errors[] = "Last Name field can't be blank!";
        }
        // Email
        if (empty($_POST['email'])) {
                  <td align="left" class="head2"><?php 
echo $admin->account_no;
?>
</td>
                </tr>
                <tr>
                  <td height="30" align="left" class="blackbold">Account Type</td>
                  <td align="left" class="head2"><?php 
echo $array_product_type[$admin->product_type];
?>
</td>
                </tr>
                <tr>
                  <td height="30" align="left" class="blackbold">Creditor</td>
                  <td align="left" class="head2"><?php 
echo togetfieldvalue($admin->bank, 'tbl_banks', 'bank');
?>
</td>
                </tr>
                
                <tr>
                  <td height="30" align="left" class="blackbold">Principal</td>
                  <td align="left" class="head2">Rs. <?php 
echo moneyFormatIndia($admin->principal);
?>
</td>
                </tr>
                <tr>
                  <td height="30" align="left" class="blackbold">Interest</td>
                  <td align="left" class="head2">Rs. <?php 
echo moneyFormatIndia($admin->interest);
        $finalstart = $_POST["start_date"] . ' 00:00:00';
        $finalend = $_POST["end_date"] . ' 00:00:00';
        $nquery .= " AND (t1.add_date BETWEEN '{$finalstart}' AND '{$finalend}') ";
    }
    if ($_SESSION['adminType'] == 'sub-admin') {
        $nquery .= " and t1.subadmin= " . $_SESSION['aid'];
    }
    $queryrws = "SELECT t1.firstname, t1.middlename, t1.lastname, t1.email, t1.mobile, t1.city, t1.state, t1.source, t1.sourcebank, t1.type, t4.full_name as owner, t1.contact_method, DATE_FORMAT(t1.add_date, '%d %M %Y %I:%i:%S') as \n   Register_Date, IFNULL(t2.total_account,0) as total_account FROM tbl_userdetails AS t1 LEFT JOIN (SELECT userid, COUNT(*) AS total_account FROM tbl_accounts GROUP BY userid ) AS t2 ON t1.id = t2.userid left join tbl_admin as t4 on t1.owner=t4.id WHERE t1.id > 0 " . $nquery . ' ORDER BY t1.add_date';
    $result_add = mysql_query_with_throw($queryrws);
    while ($row = mysql_fetch_assoc($result_add)) {
        $firstname = addslashes($row["firstname"]);
        $middlename = addslashes($row["middlename"]);
        $lastname = addslashes($row["lastname"]);
        $email = $row["email"];
        $mobile = $row["mobile"];
        $city = $row["city"];
        $state = $row["state"];
        $Register_Date = $row["Register_Date"];
        $total_account = $row["total_account"];
        $source = addslashes($array_source[$row["source"]]);
        $type = addslashes($array_custype[$row["type"]]);
        $owner = $row["owner"];
        $contact_method = addslashes($array_conmethod[$row["contact_method"]]);
        $sourcebank = togetfieldvalue($row["sourcebank"], 'tbl_banks', 'bank');
        $insert_query = mysql_query_with_throw("INSERT INTO `tbl_userexport_main` (`Firstname`, `Middlename`, `Lastname`, `Email`, `Mobile`, `City`, `State`, `Register_Date`, `Source`, `Source_Bank`, `Type`, `Owner`, `Contact_Method` , `total_account`) VALUES ('{$firstname}', '{$middlename}', '{$lastname}', '{$email}', '{$mobile}', '{$city}', '{$state}', '{$Register_Date}', '{$source}', '{$sourcebank}', '{$type}', '{$owner}', '{$contact_method}', '{$total_account}')");
    }
    $export_query = "SELECT * FROM `tbl_userexport_main`";
    $rand2 = mt_rand(1000, 9999);
    $filenamenew = 'CMD-User-List-' . $rand2 . "-" . date('d-m-Y') . ".csv";
    exportMysqlToCsv($export_query, $filenamenew);
}
	   <tr>
        <td colspan="2" align="left" valign="middle">Great going! Your dues account has beed added successfully to clearmydues. You should receive verification confirmation within 48 hours. You can start settling once that happens.</td>
        </tr>
        <tr>
        <td height="1" colspan="2" align="left" valign="middle" bgcolor="#e5e5e5"></td>
        </tr>  
      <tr>
        <td width="227" height="30" align="left" valign="middle"><span style="color: #FFFFFF"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#333333"> Account Name:</font></span></td>
        <td width="406" height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000;">' . stripslashes($account) . '</font></td>
      </tr>
        <tr>
        <td height="1" colspan="2" align="left" valign="middle" bgcolor="#e5e5e5"></td>
        </tr>  
      <tr>
        <td height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#333333;"> Creditor:</font></td>
        <td height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">' . togetfieldvalue($bank, 'tbl_banks', 'bank') . '</font></td>
      </tr>      
      <tr>
        <td height="1" colspan="2" align="left" valign="middle" bgcolor="#e5e5e5"></td>
      </tr>
	  <tr>
        <td height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#333333;"> Product Type:</font></td>
        <td height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">' . $array_product_type[$product_type] . '</font></td>
      </tr>      
      <tr>
        <td height="1" colspan="2" align="left" valign="middle" bgcolor="#e5e5e5"></td>
      </tr>	  
	  <tr>
        <td height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#333333;"> Account Number:</font></td>
        <td height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">' . stripslashes($account_no) . '</font></td>
      </tr>      
 $bank = $_POST["bank"];
 if ($start_date != "" && $end_date != "") {
     $finalstart = $_POST["start_date_n"] . ' 00:00:00';
     $finalend = $_POST["end_date_n"] . ' 00:00:00';
     $nquery .= " AND (t1.add_date BETWEEN '{$finalstart}' AND '{$finalend}') ";
 }
 if ($bank != "") {
     $nquery .= " AND (t1.bank = '{$bank}') ";
 }
 if ($_SESSION['adminType'] == 'sub-admin') {
     $nquery .= " AND t2.subadmin= " . $_SESSION['aid'];
 }
 $queryrws = "SELECT t1.id, t1.userid, t1.payin, t1.account, t1.bank, t1.product_type, t1.account_no, DATE_FORMAT(t1.date_opened, '%d %M %Y') as date_opened, DATE_FORMAT(t1.date_closed, '%d %M %Y') as date_closed, DATE_FORMAT(t1.dateofbirth, '%d %M %Y') as dateofbirth, t1.pancard, t1.principal, t1.interest, t1.balance, t1.other_charges, DATE_FORMAT(t1.last_payment_date, '%d %M %Y') as last_payment_date, t1.last_payment_done, t1.unikdueid, t1.caption, t1.status, t1.cibil_status, t1.case_type, t1.account_source, DATE_FORMAT(t1.add_date, '%d %M %Y %I:%i:%S') as account_creation_date, t2.firstname, t2.middlename, t2.lastname, t2.email, t2.mobile, t2.phone, t2.source, t2.type, t2.owner FROM tbl_accounts AS t1 INNER JOIN  tbl_userdetails AS t2 ON t1.userid = t2.id WHERE t1.id > 0 " . $nquery . ' ORDER BY t1.add_date';
 $result_add = mysql_query_with_throw($queryrws);
 while ($row = mysql_fetch_assoc($result_add)) {
     $bank = addslashes(togetfieldvalue($row["bank"], 'tbl_banks', 'bank'));
     $account = addslashes($row["account"]);
     $product_type = addslashes(togetaccounttypevalue($row["product_type"]));
     $account_no = $row["account_no"];
     $date_opened = $row["date_opened"];
     $date_closed = $row["date_closed"];
     $dateofbirth = $row["dateofbirth"];
     $pancard = $row["pancard"];
     $principal = $row["principal"];
     $interest = $row["interest"];
     $balance = $row["balance"];
     $other_charges = $row["other_charges"];
     $last_payment_date = $row["last_payment_date"];
     $last_payment_done = $row["last_payment_done"];
     $unikdueid = $row["unikdueid"];
     $caption = addslashes($row["caption"]);
function togetlistaccounbyuser($userid)
{
    $query = "SELECT id,caption,bank FROM `tbl_accounts` WHERE `userid` = {$userid}";
    $rs = mysql_query_with_throw($query);
    if (mysql_num_rows($rs) > 0) {
        $string = '<select id="accountdetails" name="accountdetails" onchange="selectaccountdetails(this.value);">';
        while ($row = mysql_fetch_assoc($rs)) {
            $id = $row["id"];
            $account = $row["caption"];
            $bank = $row["bank"];
            $string .= '<option value="' . $id . '">' . $account . ' &raquo; ' . togetfieldvalue($bank, 'tbl_banks', 'bank') . '</option>';
        }
        $string .= '<option value="addnewaccount">+ Add New</option></select>';
    } else {
        $string = "";
    }
    return $string;
}
    ?>
 </td>
          <td  height="30"><?php 
    echo moneyFormatIndia($row1['principal']);
    ?>
 </td>
          <td  height="30"><?php 
    echo todisplay($array_asource, 'ad_asource[' . $row1['id'] . ']', 'Please Select', togetfieldvalue($row1['id'], "tbl_accounts", "account_source"));
    ?>
</td>
          <td  height="30"><?php 
    echo todisplay($array_cibil, 'ad_acibil[' . $row1['id'] . ']', 'Please Select', togetfieldvalue($row1['id'], "tbl_accounts", "cibil_status"));
    ?>
</td>
          <td><?php 
    echo todisplay($array_case, 'ad_case[' . $row1['id'] . ']', 'Please Select', togetfieldvalue($row1['id'], "tbl_accounts", "case_type"));
    ?>
</td>
           <input name="rws_case[<?php 
    echo $row1['id'];
    ?>
]" type="hidden" value="<?php 
    echo $row1['case_type'];
    ?>
" />
           <input name="rws_acid[<?php 
    echo $row1['id'];
    ?>
]" type="hidden" value="<?php 
    echo $row1['id'];
    ?>
<div class="gt-fields">
	<div class="gt-label">Account Type<span class="error">*</span></div>
    <div class="gt-formfields"><?php 
    echo $array_product_type[$_SESSION['myForm']['product_type']];
    ?>
</div>
</div>
<!-- Field Content Ends -->

<div class="gt-fields">
	<div class="gt-label">Creditor<span class="error">*</span></div>
    <div class="gt-formfields"><?php 
    if ($_SESSION['myForm']['otherbank'] != "") {
        echo $_SESSION['myForm']['otherbank'];
    } else {
        echo togetfieldvalue($_SESSION['myForm']['bank'], 'tbl_banks', 'bank');
    }
    ?>
</div>
</div>


<!-- Field Content Ends -->

<div class="gt-fullfields">
	<div class="gt-label">Notes for Creditor</div>
    <div class="gt-formfields"><?php 
    echo stripslashes($_SESSION['myForm']['notes']);
    ?>
</div>
</div>