<?php  use Cake\ORM\TableRegistry;
    $bproducts = TableRegistry::get('Branches'); 
    $uproducts = TableRegistry::get('Users');
    $brproducts = TableRegistry::get('Brokers');  	
?>

<STYLE type="text/css">
    .tableTd {
        border-width: 0.5pt;
        border: 0.5px solid;
    }
    .tableTdContent{
        border-width: 0.5pt;
        border: 0.5px solid;
    }
    #titles{
        font-weight: bolder;
        background-color:#ccc;
    }

    table {
        border-spacing:0;
        border-collapse: collapse;
    }

    table th,table td {
        font-size: 10px;
    }




</STYLE>

<div class="">
    <h3><?= __('Date Range Wise Brokerage Reconciliation Data') ?></h3>
    <table cellpadding="0" cellspacing="0">
        <thead>
        	<tr>
			<th class="tableTd" scope="col" colspan="3"><b>
			  <div style="clear: both;">Report: Brokerage Reconciliation Data</div>
			</th>			  
			<th class="tableTd" scope="col" colspan="2"><b>
			  	  
			  <?php 
			  if($customer_name != '')
			  {
				
				echo 'Investor Name :'.$customer_name;
			  }
			  else{
			  echo 'Investor Name : all' ;
			  }
			  
			  ?></b>
			</th>
			<th class="tableTd" scope="col" colspan="2"><b>
			  
			 
			  
			  <?php 
			 
                 if($companyname != ''){
                           echo 'Company Name :'.$companyname;
						   }
						   else{
                    echo 'Company Name : all';
                 }
                  ?></b></th>
              <th class="tableTd" scope="col" colspan="3"><b>
			  <?php 
			 
                 if($datedform != '' && $datedto != '' ){
                             echo 'Date :  '.$dated2;
						   echo ' - '.$dated1; 
                          // echo 'Date :  '. $datedform;
						   //echo ' - '.$datedto;     
						   }
						   else{
                     echo 'Date : all' ;
                 }
                  ?></b></th>
				  				 
				  </tr>
            <tr>
                <th class="tableTd" style="width:40px;" scope="col">Sr No</th>
                <th class="tableTd" scope="col">Investor Name</th>
				<th class="tableTd" scope="col">Company Name</th>
				<th class="tableTd" scope="col">Institution Name</th>
                <th class="tableTd" scope="col">Investment Date</th>
				<th class="tableTd" scope="col">Investment Amount</th>
				<th class="tableTd" scope="col">Tenure</th>
				<th class="tableTd" scope="col">Maturity Date</th>
				<th class="tableTd" scope="col">Branch User</th>
				<th class="tableTd" scope="col">Brokerage</th>

            </tr>
        </thead>
        <tbody>
            <?php   $srlno = 1;
            $j=1;
            foreach ($mdatas as $mdata): if(!$mdata->branch_id > 0){ $trstyl = "style='background:#dbefec;'";$tdstyl = "style='color:#000;'"; }else{$trstyl = "style='background:none;'";$tdstyl = "style='color:#000;'";} ?>
            <tr <?= $trstyl ?>>
                <td class="tableTdContent" <?= $tdstyl ?>><?= $srlno ?><?php $srlno++; ?></td>
                <td class="tableTdContent" <?= $tdstyl ?>><?= h($mdata->customer_name) ?></td>
				<td class="tableTdContent" <?= $tdstyl ?>><?= $filenames[h($mdata->csvid)] ?></td>
                <td class="tableTdContent" <?= $tdstyl ?>>
                    <?php
                    echo h($mdata->institution_name);
                    ?>
                </td>
                <td class="tableTdContent" <?= $tdstyl ?>><?= h($mdata->application_date) ?></td>
				<td class="tableTdContent" <?= $tdstyl ?>><?= h($mdata->investment_amount) ?></td>
				<td class="tableTdContent" <?= $tdstyl ?>><?= h($mdata->period) ?></td>
				<td class="tableTdContent" <?= $tdstyl ?>><?= h($mdata->maturity_date) ?></td>
			    <td class="tableTdContent">
					<?php
					echo !empty($branches[$mdata->branch_id]) ? $branches[$mdata->branch_id] :'';
					?>
	            </td>

				 <td class="tableTdContent">
				    <?php
                    $reconciltion_options = recnilationOptions();
                    echo !empty($reconciltion_options[$mdata->reconciliation]) ? $reconciltion_options[$mdata->reconciliation] :'';
                    ?>
                </td>

              </tr>
            <?php $j++;
            endforeach; ?>
        </tbody>
    </table>

</div>
