<?php
require "../commonincludefiles.php";

$objStudentDocumentMgmt = new StudentDocumentMgmt();

$i = 0;
$order_field = "";
$order_type = "ASC";
$where = "";

if (isset($_REQUEST['branch_hidden']) && $_REQUEST['branch_hidden'] != "") {
    $branch_id=Escape($_REQUEST['branch_hidden']);
    $where .= " AND sd.branch_id = " .$branch_id . "";
}

if (isset($_REQUEST['student_hidden']) && $_REQUEST['student_hidden'] != "") {
    $where .= " AND sd.student_id = " . Escape($_REQUEST['student_hidden']). "";
}


// Retrieve records from the database with the specified conditions
$rs = $objStudentDocumentMgmt->getAllRecords($branch_id, 0, 0, $where, $order_field, $order_type);



$total = dbRows($rs);

$DocumentData = array("count" => $total, "data" => array());

while ($row = dbArray($rs)) {
    $temparray = array(
        "studentdocument_id" => $row["studentdocument_id"],
        "student_id" => $row["student_id"],
        "doc_id" => $row["doc_id"],
       "branch_id"  => $row["branch_id"],
        "document_name" => $row["document_name"],
        "noofdocument" => $row["noofdocument"],
        "docrecive_date" => $row["docrecive_date"]
    );

    $DocumentData["data"][$i] = $temparray;
    $i++;
}

echo json_encode($DocumentData);
?>