<section class="panel">
    <header class="panel-heading clearfix panel-theame">
        <i class="fa fa-tasks"></i> TOP MODEL ORDER TAKING REPORT
    </header>
    <div class="panel-body">
        <div id="div_master_report_leadlist">
            <ul class="clearfix form-ul material"> 
                <li class="col-sm-2">
                    <?php echo CHtml::dropdownList('topmodel_report_year',date('Y'),Order::getyear(),array('class' => '','data-label'=>'Year'));?>
                </li>
                <li class="col-sm-2">
                    <?php echo CHtml::dropdownList('topmodel_report_month', '', Order::getmonths(),array('class' => '','data-label'=>'Month'));?>
                </li>
                <li class="col-sm-2">
                    <?php echo CHtml::dropdownList('topmodel_report_type', 'Q', ['Q'=>'Quantity','A'=>'Amount'],array('class' => '','data-label'=>'Type'));?>
                </li>
                <li class="col-sm-2">
                    <?php echo CHtml::dropdownList('topmodel_ch_status', '', [0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4'],array('data-label' => 'Status',
                    'multiple' => 'multiple',// Enable multiselect
                    'class' => 'multiple', // Add Select2 class
                    'data-placeholder' => '-Select-', // Placeholder
                    'data-search' => true, // Placeholder
                    //'size' => 5, // Number of visible options in the box
                    ));?>
                </li>
            </ul>
        </div>
        <div class='btn-wrap text-center'> 
            <button onclick="exceltopmodel();return false;" class='plan-save-btn btn btn-theme' target="_blank"><i class="fa fa-file-excel-o"></i> &nbsp;Current FY</button>
            <button onclick="exceltopmodelfuture();return false;" class='plan-save-btn btn btn-theme' target="_blank"><i class="fa fa-file-excel-o"></i> &nbsp;Next FY</button>
        </div>
        <div class="panel-body">
            <div style="display:none;" id="div_topmodel_load_content">
            </div>
        </div>
    </div>
</section>
<?php $cs = Yii::app()->getClientScript(); 

//Excel done by jisha on 25-6-2025
$cs->registerScript("exceltopmodel", "function exceltopmodel(){
    var us_year = $('#topmodel_report_year').val(); 
    var us_month = $('#topmodel_report_month').val();
    var us_type = $('#topmodel_report_type').val();
    var ch_status = $('#topmodel_ch_status').val();
    if(us_year>0 && us_month >0){
        if(us_type=='Q')
        window.open($('#liveSite').val()+'index.php?r=ordertakingreport/ExcelTopmodelQty&future_type=0&us_year='+us_year+'&us_month='+us_month+'&ch_status='+ch_status+'', '_blank');
        else
        window.open($('#liveSite').val()+'index.php?r=ordertakingreport/ExceltopmodelAmt&future_type=0&us_year='+us_year+'&us_month='+us_month+'&ch_status='+ch_status+'', '_blank');
        
    }else{
        t8.error('Please Select Month and Year');
    }
}", CClientScript::POS_HEAD);
$cs->registerScript("exceltopmodelfuture", "function exceltopmodelfuture(){
    var us_year = $('#topmodel_report_year').val(); 
    var us_month = $('#topmodel_report_month').val();
    var us_type = $('#topmodel_report_type').val();
    var ch_status = $('#topmodel_ch_status').val();
    if(us_year>0 && us_month >0){
        if(us_type=='Q')
        window.open($('#liveSite').val()+'index.php?r=ordertakingreport/ExcelTopmodelQty&future_type=1&us_year='+us_year+'&us_month='+us_month+'&ch_status='+ch_status+'', '_blank');
        else
        window.open($('#liveSite').val()+'index.php?r=ordertakingreport/ExceltopmodelAmt&future_type=1&us_year='+us_year+'&us_month='+us_month+'&ch_status='+ch_status+'', '_blank');
        
    }else{
        t8.error('Please Select Month and Year');
    }
}", CClientScript::POS_HEAD);