<?php include("parent/callMe.php"); ?>



<tr id="pro_row">
<td>
<input type="hidden" name="incOrder[]" value="<?php echo $_REQUEST['vocherIncr'];?>">
</td>
<td >   

<select name="Debitaccount_name[]" id="accountDebit" class="form-control" style="">

<option value="">Select Debit Account</option>
<?php



if($_REQUEST['voucherType']!='')

{ 

if ($_REQUEST['voucherType']=='3') {

$branchID=$_SESSION['branch'];
$sql = "SELECT * FROM  eduportal_accounts_finance_bank_details WHERE branch_id='$branchID'";
$secondLevel = $m->query($sql);

foreach($secondLevel as $secondLevel_val)
{

$m->where("coa_id_fk ", $secondLevel_val['account_id']);
$m->where("branch_id ", $_SESSION['branch']);
$accountBalance = $m->get("eduportal_branch_account_opening_balances");


if(is_array($secondLevel_val)){
?>
<option value="<?php echo $secondLevel_val['account_id ']; ?>"><?php echo trim(utf8_encode_all($secondLevel_val['last_account_code']." (".$secondLevel_val['last_level_account_name'].")"." ( Balance ".$accountBalance[0]['current_balance'].")")); ?></option>


<?php  } } } else {


$voucherType=$_REQUEST['voucherType'];

$sql = "SELECT * FROM  eduportal_account_debit_credit WHERE voucher_type_id='$voucherType' and transection_type='debit'";
$secondLevel = $m->query($sql);


//print_r($sql);
if($secondLevel[0]>0){
foreach($secondLevel as $secondLevel_val)
{

$m->where("coa_id_fk ", $secondLevel_val['account_id']);
$m->where("branch_id ", $_SESSION['branch']);
$WorkAssignList = $m->get("eduportal_branch_account_opening_balances");

if ($WorkAssignList[0]['coa_id_fk']==NULL) {
continue;
}

$m->where("coa_id ", $WorkAssignList[0]['coa_id_fk']);
$accountName = $m->get("eduportal_chart_of_accounts");


if(is_array($secondLevel_val)){
?>
<option value="<?php echo $WorkAssignList[0]['coa_id_fk']; ?>"><?php echo trim(utf8_encode_all($accountName[0]['account_title']." (".$accountName[0]['account_code'].")"." ( Balance ".$WorkAssignList[0]['current_balance'].")")); ?></option>





<?php } } } } } ?>

</select>

</td>


<td>  
<input type="text" name="debit[]"  autocomplete="off"  onkeyup="getDebitbalance(this.value)" placeholder="Debit Amount" class="form-control"/>

</td>


<td>
<select name="Creditaccount_name[]" id="accountCredit" class="form-control" style="">

<option value="">Select Credit Account</option>
<?php




if ($_REQUEST['voucherType']=='1') {

  $branchID=$_SESSION['branch'];
  $sql = "SELECT * FROM  eduportal_accounts_finance_bank_details WHERE branch_id='$branchID'";
  $secondLevel = $m->query($sql);


foreach($secondLevel as $secondLevel_val)
{

$m->where("coa_id_fk ", $secondLevel_val['account_id']);
$m->where("branch_id ", $_SESSION['branch']);
$accountBalance = $m->get("eduportal_branch_account_opening_balances");


if(is_array($secondLevel_val)){
?>
<option value="<?php echo $secondLevel_val['finance_account_id']; ?>"><?php echo trim(utf8_encode_all($secondLevel_val['last_account_code']." (".$secondLevel_val['last_level_account_name'].")"." ( Balance ".$accountBalance[0]['current_balance'].")")); ?></option>

<?php } } } else {



$voucherType=$_REQUEST['voucherType'];

$sql = "SELECT * FROM  eduportal_account_debit_credit WHERE voucher_type_id='$voucherType' and transection_type='credit'";
$secondLevel = $m->query($sql);

//print_r($secondLevel);
if($secondLevel[0]>0){
foreach($secondLevel as $secondLevel_val)
{

  $m->where("coa_id_fk ", $secondLevel_val['account_id']);
  $m->where("branch_id ", $_SESSION['branch']);
  $WorkAssignList = $m->get("eduportal_branch_account_opening_balances");

if ($WorkAssignList[0]['coa_id_fk']==NULL) {
    continue;
  }

$m->where("coa_id ", $WorkAssignList[0]['coa_id_fk']);
$accountName = $m->get("eduportal_chart_of_accounts");

if(is_array($secondLevel_val)){
?>
<option value="<?php echo $WorkAssignList[0]['coa_id_fk']; ?>"><?php echo trim(utf8_encode_all($accountName[0]['account_title']." (".$accountName[0]['account_code'].")"." ( Balance ".$WorkAssignList[0]['current_balance'].")")); ?></option>

<?php } } } } ?>

</select>                

</td>



<td>
<input type="text" name="credit[]"  autocomplete="off"  onkeyup="getCreditbalance(this.value)" value=""  maxlength="100" placeholder="Credit Amount" class="form-control"/>
</td>


<td>  

<input type="text" min="0" name="Debitnarration[]"  autocomplete="off" id="AccountNarration" placeholder="Narration" value="" class="form-control" />

</td>

<!-- <td>
<input type="text" min="0" name="Creditnarration[]"  autocomplete="off" id="tutionfee<?php echo $j; ?>" placeholder="Narration" class="form-control" /> 

</td> -->


</tr>





