<?php
/*	
 * Author   : Ferry / Tanggal   : 22-06-2015	
 * Revisi   : 
 */
?>

<div id="cc" class="easyui-layout" data-options="fit:true, border:false">
    <div data-options="region:'west',split:true, border:true" title="" style="width:270px; background-color:#F8F8F8;">
        <div title="" style="padding:10px;overflow:auto;" data-options="selected:true" >
            <b>Report Category :</b>
	
            <div class="indextoreport_menu">
                <ul>
                <?php
					foreach ($report_menu as $row_report){
				?>
                    <li><a href="<?php echo site_url($row_report->MenuLink); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/report.png" alt=""/> <span><b><?php echo $row_report->MenuLabel;?></b></span></a></li>	
                <?php
                    }
                ?>
                </ul>
            </div>	
        </div>
    </div>
	
    <div data-options="region:'center',fit:true,plain:true, border:false" style="background-color:#eee;">
        <div id="form-wrapper" class="easyui-panel" border="false" style="width:928%;height:570px; background:#eee;">
            
            <div style="overflow:hidden;padding:10px;">
                <b>Report Detail :</b>

                <div class="indextoreport_menu">
                    <ul>
                        <?php
                        foreach ($group_sub_report as $row_sub_report) {
                            ?>
                            <li><a href="javascript:void(0)" onClick="<?php echo $row_sub_report->MenuLink; ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/<?php echo $row_sub_report->Icon; ?>.png" alt=""/> <span><?php echo $row_sub_report->MenuLabel; ?></span></a></li>
                            <?php
                        }
                        ?>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- -------------------------------------------------------------Dialog Profit n Loss Standard--------------------------------------------------------------- -->
<div id="dialog_date_period" class="easyui-dialog" style="width:450px;height:200px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-date-button">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Date Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Branch</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200" colspan="5">
                        <select name="cmb_branch_pps" id="cmb_branch_pps" class="easyui-combobox" style="width:200px;height:22px" data-options="
                            value :'<?=$this->session->userdata("branch");?>',
                            valueField: 'BranchCode',
                            textField: 'BranchName',
                            editable : false,
                            url: '<?=base_url();?>report/Index_financial_statement/list_branch_bycompany',
                            ">
                        </select>
                    </td>
                </tr>
                
                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Begin Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td><input type="text" name="txt_begin_date" id="txt_begin_date" class="easyui-datebox" required="required" value="today" style="width:100px;height:20px" editable="false" /></td>
                </tr>

                <tr>
                    <td width='20'></td>
                    <td width="70" align='left'><b>End Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td><input type="text" name="txt_end_date" id="txt_end_date" class="easyui-datebox" required="required" value="today" style="width:100px;height:20px" editable="false" /></td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-date-button" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="profit_loss_report();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_date_period');">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------Batas Profit n Loss Standard--------------------------------------------------------------- -->

<!-- -------------------------------------------------------------Dialog Profit n Loss Multi Period--------------------------------------------------------------- -->
<div id="dialog_pl_multi" class="easyui-dialog" style="width:450px;height:200px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-date-button">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" >                
                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Branch</b></td>
                    <td width="10"><b>:</b></td>

                    <td colspan="2">
                        <select name="cmb_branch_ppm" id="cmb_branch_ppm" class="easyui-combobox" style="width:200px;height:22px" data-options="
                            value :'<?=$this->session->userdata("branch");?>',
                            valueField: 'BranchCode',
                            textField: 'BranchName',
                            editable : false,
                            url: '<?=base_url();?>report/Index_financial_statement/list_branch_bycompany',
                            ">
                        </select>
                    </td>
                </tr>
                
                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Begin Period</b></td>
                    <td width="10"><b>:</b></td>
                    <td><input name="txt_begin_month" id="txt_begin_month" class="easyui-numberspinner" required="required" style="width:50px;height:20px" /></td>
                    <td align="left"><input name="txt_begin_year" id="txt_begin_year" class="easyui-numberspinner" required="required" style="width:150px;height:20px" /></td>
                </tr>

                <tr>
                    <td width='20'></td>
                    <td width="100" align='left'><b>End Period</b></td>
                    <td width="10"><b>:</b></td>
                    <td><input name="txt_end_month" id="txt_end_month" class="easyui-numberspinner" required="required" style="width:50px;height:20px" /></td>
                    <td align="left"><input name="txt_end_year" id="txt_end_year" class="easyui-numberspinner" required="required" style="width:150px;height:20px" /></td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-date-button" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="profit_loss_multi_period();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_pl_multi');">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------Batas Dialog Profit n Loss Multi Period--------------------------------------------------------------- -->

<!-- -------------------------------------------------------------Dialog Profit n Loss Compare Period--------------------------------------------------------------- -->
<div id="dialog_pl_compare" class="easyui-dialog" style="width:550px;height:220px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-date-button-compare">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Compare Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Branch</b></td>
                    <td width="10"><b>:</b></td>

                    <td colspan="5">
                        <select name="cmb_branch_ppc" id="cmb_branch_ppc" class="easyui-combobox" style="width:200px;height:22px" data-options="
                            value :'<?=$this->session->userdata("branch");?>',
                            valueField: 'BranchCode',
                            textField: 'BranchName',
                            editable : false,
                            url: '<?=base_url();?>report/Index_financial_statement/list_branch_bycompany',
                            ">
                        </select>
                    </td>
                </tr>
                
                <tr>
                    <td width='50'></td>
                    <td colspan width="100" align='left'><b>Begin Period</b></td>
                    <td width="10"><b>:</b></td>
                    <td><input type="text" name="txt_begin_date_1" id="txt_begin_date_1" class="easyui-datebox" required="required" value="today" style="width:90px;height:20px" editable="false" /></td>

                    <td width='50'></td>
                    <td colspan width="100" align='left'><b>Begin Period</b></td>
                    <td width="10"><b>:</b></td>
                    <td><input type="text" name="txt_begin_date_2" id="txt_begin_date_2" class="easyui-datebox" required="required" value="today" style="width:90px;height:20px" editable="false" /></td>
                </tr>

                <tr>
                    <td width='50'></td>
                    <td width="70" align='left'><b>End Period</b></td>
                    <td width="10"><b>:</b></td>
                    <td><input type="text" name="txt_end_date_1" id="txt_end_date_1" class="easyui-datebox" required="required" value="today" style="width:90px;height:20px" editable="false" /></td>

                    <td width='50'></td>
                    <td width="70" align='left'><b>End Period</b></td>
                    <td width="10"><b>:</b></td>
                    <td><input type="text" name="txt_end_date_1" id="txt_end_date_2" class="easyui-datebox" required="required" value="today" style="width:90px;height:20px" editable="false" /></td>
                </tr>
            </table>
        </div>
    
    <div id="dialog-date-button-compare" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="profit_loss_compare_period();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_pl_compare')">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------Batas Dialog Profit n Loss Compare Period--------------------------------------------------------------- -->

<!-- -------------------------------------------------------------Dialog Profit n Loss Standard--------------------------------------------------------------- -->
<div id="dialog_pl_consolidation" class="easyui-dialog" style="width:450px;height:200px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-date-button-console">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Date Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                <tr><td>&nbsp;</td></tr>
                <tr><td>&nbsp;</td></tr>
                
                <tr>
                    <td width='100'></td>
                    <td colspan width="100" align='left'><b>Begin Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td><input type="text" name="txt_begin_date_console" id="txt_begin_date_console" class="easyui-datebox" required="required" value="today" style="width:100px;height:20px" editable="false" /></td>
                </tr>

                <tr>
                    <td width='100'></td>
                    <td width="70" align='left'><b>End Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td><input type="text" name="txt_end_date_console" id="txt_end_date_console" class="easyui-datebox" required="required" value="today" style="width:100px;height:20px" editable="false" /></td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-date-button-console" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="profit_loss_consolidation_period();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_pl_consolidation');">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------Batas Profit n Loss Standard--------------------------------------------------------------- -->

<!------------------------------------------------------------- BALANCESHEET ---------------------------------------------------------------------!>

<!-- -------------------------------------------------------------Batas Awal Month Period--------------------------------------------------------------- -->
<div id="dialog_month_period" class="easyui-dialog" style="width:450px;height:200px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-month-button">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Month Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                
                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Branch</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200">
                        <select name="cmb_branch_cbo" id="cmb_branch_cbo" class="easyui-combobox" style="width:200px;height:22px" data-options="
                            value :'<?=$this->session->userdata("branch");?>',
                            valueField: 'BranchCode',
                            textField: 'BranchName',
                            editable : false,
                            url: '<?=base_url();?>report/Index_financial_statement/list_branch_bycompany',
                            ">
                        </select>
                    </td>
                </tr>

                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200">
                        <select name="cbo_period_month" id="cbo_period_month" class="easyui-combobox" style="width:200px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <td width='20'></td>
                    <td width="70" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="nsp_period_year" id="nsp_period_year" class="easyui-numberspinner" style="width:200px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-month-button" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="balance_sheet_standard_report();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_month_period');">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------Batas Akhir Month Period--------------------------------------------------------------- -->

<!-- -------------------------------------------------------------Balance Sheet Multi Period--------------------------------------------------------------- -->
<div id="dialog_multi_balance_period" class="easyui-dialog" style="width:550px;height:220px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-multi-balance-button">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Month Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                
                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Branch</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200" colspan="5">
                        <select name="cmb_branch_bm" id="cmb_branch_bm" class="easyui-combobox" style="width:200px;height:22px" data-options="
                            value :'<?=$this->session->userdata("branch");?>',
                            valueField: 'BranchCode',
                            textField: 'BranchName',
                            editable : false,
                            url: '<?=base_url();?>report/Index_financial_statement/list_branch_bycompany',
                            ">
                        </select>
                    </td>
                </tr>

                <tr>
                    <td width='100'></td>
                    <td colspan width="250" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="180">
                        <select name="Bfrom_multi_month" id="Bfrom_multi_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>

                    <td width='180'></td>
                    <td colspan width="250" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200">
                        <select name="Bend_multi_month" id="Bend_multi_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <td width='100'></td>
                    <td width="200" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="Bfrom_multi_year" id="Bfrom_multi_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>

                    <td width='100'></td>
                    <td width="200" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="Bend_multi_year" id="Bend_multi_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-multi-balance-button" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="balance_sheet_multi_report();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_multi_balance_period');">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------Balance Sheet Multi Period--------------------------------------------------------------- -->

<!-- -------------------------------------------------------------Balance Sheet Multi Consolidation Period--------------------------------------------------------------- -->
<div id="dialog_multi_consolidation_balance_period" class="easyui-dialog" style="width:550px;height:220px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-multi-consolidation-balance-button">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Month Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                <tr><td>&nbsp;</td></tr>
                <tr><td>&nbsp;</td></tr>
                
                <tr>
                    <td width='100'></td>
                    <td colspan width="250" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="180">
                        <select name="Bfrom_multi_consolidation_month" id="Bfrom_multi_consolidation_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>

                    <td width='180'></td>
                    <td colspan width="250" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200">
                        <select name="Bend_multi_consolidation_month" id="Bend_multi_consolidation_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <td width='100'></td>
                    <td width="200" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="Bfrom_multi_consolidation_year" id="Bfrom_multi_consolidation_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>

                    <td width='100'></td>
                    <td width="200" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="Bend_multi_consolidation_year" id="Bend_multi_consolidation_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-multi-consolidation-balance-button" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="balance_sheet_multi_consolidation_report();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_multi_consolidation_balance_period');">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------Balance Sheet Multi Consolidation Period--------------------------------------------------------------- -->

<!-- -------------------------------------------------------------Balance Sheet Compare Period--------------------------------------------------------------- -->
<div id="dialog_compare_balance_period" class="easyui-dialog" style="width:550px;height:220px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-compare-balance-button">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Month Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                <tr>
                    <td width='20'></td>
                    <td colspan width="100" align='left'><b>Branch</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200" colspan="5">
                        <select name="cmb_branch_bc" id="cmb_branch_bc" class="easyui-combobox" style="width:200px;height:22px" data-options="
                            value :'<?=$this->session->userdata("branch");?>',
                            valueField: 'BranchCode',
                            textField: 'BranchName',
                            editable : false,
                            url: '<?=base_url();?>report/Index_financial_statement/list_branch_bycompany',
                            ">
                        </select>
                    </td>
                </tr>
                
                <tr>
                    <td width='100'></td>
                    <td colspan width="250" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="180">
                        <select name="Bfrom_compare_month" id="Bfrom_compare_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>

                    <td width='180'></td>
                    <td colspan width="250" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200">
                        <select name="Bend_compare_month" id="Bend_compare_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <td width='100'></td>
                    <td width="200" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="Bfrom_compare_year" id="Bfrom_compare_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>

                    <td width='100'></td>
                    <td width="200" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="Bend_compare_year" id="Bend_compare_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-compare-balance-button" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="balance_sheet_compare_report();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_compare_balance_period');">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------Balance Sheet Compare Period--------------------------------------------------------------- -->

<!-- -------------------------------------------------------------Balance Sheet Compare consolidation Period--------------------------------------------------------------- -->
<div id="dialog_compare_consolidation_balance_period" class="easyui-dialog" style="width:550px;height:220px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-compare-consolidation-balance-button">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Month Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                <tr><td>&nbsp;</td></tr>
                <tr><td>&nbsp;</td></tr>
                
                <tr>
                    <td width='100'></td>
                    <td colspan width="250" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="180">
                        <select name="Bfrom_compare_consolidation_month" id="Bfrom_compare_consolidation_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>

                    <td width='180'></td>
                    <td colspan width="250" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200">
                        <select name="Bend_compare_consolidation_month" id="Bend_compare_consolidation_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <td width='100'></td>
                    <td width="200" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="Bfrom_compare_consolidation_year" id="Bfrom_compare_consolidation_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>

                    <td width='100'></td>
                    <td width="200" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="Bend_compare_consolidation_year" id="Bend_compare_consolidation_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-compare-consolidation-balance-button" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="balance_sheet_compare_consolidation_report();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_compare_consolidation_balance_period');">Cancel</a>
    </div>
</div>
<!-- -------------------------------------------------------------end Balance Sheet Compare consolidation Period--------------------------------------------------------------- -->

<!-- -------------------------------------------------------------End Balance Sheet Consolidation Period--------------------------------------------------------------- -->
<div id="dialog_consolidation_period" class="easyui-dialog" style="width:450px;height:200px;background-color:#F8F8F8;padding:0px;" closed="true" data-options="modal:true, iconCls:'icon-edit'" buttons="#dialog-consolidation-balance-button">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'north',border:false" style="padding:0px;background-color:#F8F8F8;padding-bottom:0px;">
            <table width="100%" cellpadding="3" cellspacing="0">                
                <tr  align='bottom'>
                    <td width="50"><b>Select Month Period</b></td>
                    <td width="10" align='left'><b>:</b></td>
                    <td width='100'></td>
                </tr>
            </table>
        </div>

        <div data-options="region:'south',border:false" style="padding:0px;padding-bottom:0px;">
            <table width="100%" cellpadding="0" cellspacing="2">                
                <tr><td>&nbsp;</td></tr>
                <tr><td>&nbsp;</td></tr>
                
                <tr>
                    <td width='100'></td>
                    <td colspan width="100" align='left'><b>Month Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="200">
                        <select name="b_consolidation_month" id="b_consolidation_month" class="easyui-combobox" style="width:100px;height:22px">
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <td width='100'></td>
                    <td width="70" align='left'><b>Year Period</b></td>
                    <td width="10"><b>:</b></td>

                    <td width="100" style="padding-right:4px;">
                        <input name="b_consolidation_year" id="b_consolidation_year" class="easyui-numberspinner" style="width:100px;height:22px" data-options="min:2012,max:new Date().getFullYear()" value="<?php echo date("Y");?>">
                    </td>
                </tr>
            </table>
        </div>
    </form>
    
    <div id="dialog-consolidation-balance-button" style="border:none;">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="balance_sheet_consolidation_report();">&nbsp; OK &nbsp; &nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog_consolidation_period');">Cancel</a>
    </div>
</div>
<!-- ------------------------------------------------------------- End Balance Sheet Consolidation Period --------------------------------------------------------------- -->

<script type="text/javascript">	

    $(document).ready(function(){
        var date_now    = new Date();
        var month_now   = date_now.getMonth() + 1;
        var year_end    = date_now.getFullYear();
        var year_begin  = 1970;

        $('#txt_begin_year').numberspinner({
            min: year_begin,
            max: year_end,
            value : year_end,
            editable: false
        });
        $('#txt_begin_month').numberspinner({
            min: 1,
            max: 12,
            value : (month_now - 2),
            editable: false
        });

        $('#txt_end_year').numberspinner({
            min: year_begin,
            max: year_end,
            value : year_end,
            editable: false
        });
        $('#txt_end_month').numberspinner({
            min: 1,
            max: 12,
            value : month_now,
            editable: false
        });
    });


    function choose_date(){
        $('#txt_begin_date').datebox('setValue', '<?= date('d-m-Y') ?>');
        $('#txt_end_date').datebox('setValue', '<?= date('d-m-Y') ?>');
        
        modal_open('Profit & Loss Standard', 'dialog_date_period');
    }

    function choose_month(){
        $('#cbo_period_month').combobox('setValue', '<?= date('m') ?>');
        $('#nsp_period_year').val('<?= date('Y') ?>');
        
        modal_open('Month Period', 'dialog_month_period');
    }

    function profit_loss_report(){
        date_begin  = $('#txt_begin_date').datebox('getValue');
        date_end    = $('#txt_end_date').datebox('getValue');
        BranchCode      = $('#cmb_branch_pps').combobox('getValue');
        BranchCode      = BranchCode.replace(/\//g,"__");
        BranchCode      = BranchCode.replace(/-/g,"_");

        var arr_start_date  = date_begin.split('-'); 
        var start_date      = new Date(arr_start_date[2]+' '+arr_start_date[1]+' '+arr_start_date[0]);
        var arr_end_date    = date_end.split('-'); 
        var end_date        = new Date(arr_end_date[2]+' '+arr_end_date[1]+' '+arr_end_date[0]);

        var startDate   = Date.parse(start_date);
        var endDate     = Date.parse(end_date);

        if(endDate > startDate){
            parent.tab_add('Profit & Loss Standard Report', '<?= "report/index_financial_statement/preview_profit_loss_standard/" ?>' + date_begin + '/' + date_end + '/' + BranchCode,'icon-preview');
            modal_close('dialog_date_period');
        }else{
            $.messager.alert('Warning','Begin Period harus lebih besar dari end period.','error');
        }
    }

    function pl_multi_period(){
        modal_open('Profit & Loss Multi Period', 'dialog_pl_multi');
    }

    function pl_compare_period(){
        modal_open('Profit & Loss Compare Period', 'dialog_pl_compare');
    }

    function pl_consolidation_period(){
        modal_open('Profit & Loss Consolidation Period', 'dialog_pl_consolidation');
    }

    function balance_compare_month(){

        $('#Bfrom_compare_month').combobox('setValue','<?= date('m') ?>');
        $('#Bfrom_compare_year').numberspinner('setValue','<?= date('Y') ?>');
        $('#Bend_compare_month').combobox('setValue','<?= date('m') ?>');
        $('#Bend_compare_year').numberspinner('setValue','<?= date('Y') ?>');

        modal_open('Balance Sheet Compare Period', 'dialog_compare_balance_period');
    }

    function balance_compare_consolidation_period(){
        $('#Bfrom_compare_consolidation_month').combobox('setValue','<?= date('m') ?>');
        $('#Bfrom_compare_consolidation_year').numberspinner('setValue','<?= date('Y') ?>');
        $('#Bend_compare_consolidation_month').combobox('setValue','<?= date('m') ?>');
        $('#Bend_compare_consolidation_year').numberspinner('setValue','<?= date('Y') ?>');

        modal_open('Balance Sheet Compare Consolidation Period', 'dialog_compare_consolidation_balance_period');
    }

    function balance_consolidation_period(){
        $('#b_consolidation_month').combobox('setValue','<?= date('m') ?>');
        $('#b_consolidation_year').numberspinner('setValue','<?= date('Y') ?>');

        modal_open('Balance Sheet Consolidation Period', 'dialog_consolidation_period');
    }

    function balance_multi_period(){
        $('#Bfrom_multi_month').combobox('setValue','<?= date('m') ?>');
        $('#Bfrom_multi_year').numberspinner('setValue','<?= date('Y') ?>');
        $('#Bend_multi_month').combobox('setValue','<?= date('m') ?>');
        $('#Bend_multi_year').numberspinner('setValue','<?= date('Y') ?>');

        modal_open('Balance Sheet Multi Period', 'dialog_multi_balance_period');
    }

    function balance_multi_consolidation_period(){
        $('#Bfrom_multi_consolidation_month').combobox('setValue','<?= date('m') ?>');
        $('#Bfrom_multi_consolidation_year').numberspinner('setValue','<?= date('Y') ?>');
        $('#Bend_multi_consolidation_month').combobox('setValue','<?= date('m') ?>');
        $('#Bend_multi_consolidation_year').numberspinner('setValue','<?= date('Y') ?>');

        modal_open('Balance Sheet Multi Consolidation Period', 'dialog_multi_consolidation_balance_period');
    }

    function profit_loss_multi_period(){
        month_begin = $('#txt_begin_month').numberspinner('getValue');
        month_end   = $('#txt_end_month').numberspinner('getValue');
        year_begin  = $('#txt_begin_year').numberspinner('getValue');
        year_end    = $('#txt_end_year').numberspinner('getValue');

        var start_date      = new Date(year_begin+' '+month_begin);
        var end_date        = new Date(year_end+' '+month_end);

        var startDate   = Date.parse(start_date);
        var endDate     = Date.parse(end_date);

        BranchCode      = $('#cmb_branch_ppm').combobox('getValue');
        BranchCode      = BranchCode.replace(/\//g,"__");
        BranchCode      = BranchCode.replace(/-/g,"_");

        if(endDate > startDate){
            parent.tab_add('Profit & Loss Multi Period Report', '<?= "report/index_financial_statement/preview_profit_loss_multi_period/" ?>' + month_begin + '/' + year_begin + '/' + month_end + '/' + year_end +'/'+ BranchCode,'icon-preview');
            modal_close('dialog_pl_multi');
        }else{
            $.messager.alert('Warning','Begin Period harus lebih besar dari end period.','error');
        }
    }

    function profit_loss_compare_period(){
        txt_begin_date_1    = $('#txt_begin_date_1').datebox('getValue');
        txt_end_date_1      = $('#txt_end_date_1').datebox('getValue');
        txt_begin_date_2    = $('#txt_begin_date_2').datebox('getValue');
        txt_end_date_2      = $('#txt_end_date_2').datebox('getValue');
        BranchCode      = $('#cmb_branch_ppc').combobox('getValue');
        BranchCode      = BranchCode.replace(/\//g,"__");
        BranchCode      = BranchCode.replace(/-/g,"_");
        
        parent.tab_add('Profit & Loss Compare Period Report', '<?= "report/index_financial_statement/preview_profit_loss_compare_period/" ?>' + txt_begin_date_1 + '/' + txt_end_date_1 + '/' + txt_begin_date_2 + '/' + txt_end_date_2 + '/' + BranchCode,'icon-preview');
        modal_close('dialog_pl_compare');
    }

    function profit_loss_consolidation_period(){
        date_begin  = $('#txt_begin_date_console').datebox('getValue');
        date_end    = $('#txt_end_date_console').datebox('getValue');

        var arr_start_date  = date_begin.split('-'); 
        var start_date      = new Date(arr_start_date[2]+' '+arr_start_date[1]+' '+arr_start_date[0]);
        var arr_end_date    = date_end.split('-'); 
        var end_date        = new Date(arr_end_date[2]+' '+arr_end_date[1]+' '+arr_end_date[0]);

        var startDate   = Date.parse(start_date);
        var endDate     = Date.parse(end_date);

        if(endDate > startDate){
            parent.tab_add('Profit & Loss Consolidation Report', '<?= "report/index_financial_statement/preview_profit_loss_consolidation_period/" ?>' + date_begin + '/' + date_end,'icon-preview');
            modal_close('dialog_date_period');
        }else{
            $.messager.alert('Warning','Begin Period harus lebih besar dari end period.','error');
        }
    }
    
    function balance_sheet_standard_report(){
        month_period    = $('#cbo_period_month').combobox('getValue');
        BranchCode      = $('#cmb_branch_cbo').combobox('getValue');
        BranchCode      = BranchCode.replace(/\//g,"__");
        BranchCode      = BranchCode.replace(/-/g,"_");
        year_period     = $('#nsp_period_year').val();
        
        parent.tab_add('Balance Sheet Standard Report', '<?= "report/index_financial_statement/preview_balance_sheet_standard_report/" ?>' + month_period + '/' + year_period +'/'+ BranchCode,'icon-preview');
        modal_close('dialog_month_period');
    }

    function balance_sheet_compare_report(){
        txt_month_from      = $('#Bfrom_compare_month').combobox('getValue');
        txt_year_from       = $('#Bfrom_compare_year').numberspinner('getValue');
        txt_month_end       = $('#Bend_compare_month').combobox('getValue');
        txt_year_end        = $('#Bend_compare_year').numberspinner('getValue');
        BranchCode          = $('#cmb_branch_bc').combobox('getValue');
        BranchCode          = BranchCode.replace(/\//g,"__");
        BranchCode          = BranchCode.replace(/-/g,"_");
        
        parent.tab_add('Balance Sheet Compare Period Report', '<?= "report/index_financial_statement/preview_balancesheet_compare_period/" ?>' + txt_month_from + '/' + txt_year_from + '/' + txt_month_end + '/' + txt_year_end +'/'+ BranchCode,'icon-preview');
        modal_close('dialog_compare_balance_period');
    }

    function balance_sheet_compare_consolidation_report(){
        txt_month_from      = $('#Bfrom_compare_consolidation_month').combobox('getValue');
        txt_year_from       = $('#Bfrom_compare_consolidation_year').numberspinner('getValue');
        txt_month_end       = $('#Bend_compare_consolidation_month').combobox('getValue');
        txt_year_end        = $('#Bend_compare_consolidation_year').numberspinner('getValue');
        
        parent.tab_add('Balance Sheet Compare Consolidation Period', '<?= "report/index_financial_statement/preview_balancesheet_compare_consolidation_period/" ?>' + txt_month_from + '/' + txt_year_from + '/' + txt_month_end + '/' + txt_year_end,'icon-preview');
        modal_close('dialog_compare_consolidation_balance_period');
    }

    function balance_sheet_multi_report(){
        txt_month_from      = $('#Bfrom_multi_month').combobox('getValue');
        txt_year_from       = $('#Bfrom_multi_year').numberspinner('getValue');
        txt_month_end       = $('#Bend_multi_month').combobox('getValue');
        txt_year_end        = $('#Bend_multi_year').numberspinner('getValue');

        var start_date      = new Date(txt_year_from+' '+txt_month_from);
        var end_date        = new Date(txt_year_end+' '+txt_month_end);

        var startDate   = Date.parse(start_date);
        var endDate     = Date.parse(end_date);

        BranchCode      = $('#cmb_branch_bm').combobox('getValue');
        BranchCode      = BranchCode.replace(/\//g,"__");
        BranchCode      = BranchCode.replace(/-/g,"_");

        if(endDate > startDate){
            parent.tab_add('Balance Sheet Multi Period Report', '<?= "report/index_financial_statement/preview_balancesheet_multi_period/" ?>' + txt_month_from + '/' + txt_year_from + '/' + txt_month_end + '/' + txt_year_end + '/'+ BranchCode,'icon-preview');
            modal_close('dialog_multi_balance_period');
        }else{
            $.messager.alert('Warning','Begin Period harus lebih besar dari end period.','error');
        }
    }

    function balance_sheet_multi_consolidation_report(){
        txt_month_from      = $('#Bfrom_multi_consolidation_month').combobox('getValue');
        txt_year_from       = $('#Bfrom_multi_consolidation_year').numberspinner('getValue');
        txt_month_end       = $('#Bend_multi_consolidation_month').combobox('getValue');
        txt_year_end        = $('#Bend_multi_consolidation_year').numberspinner('getValue');

        var start_date      = new Date(txt_year_from+' '+txt_month_from);
        var end_date        = new Date(txt_year_end+' '+txt_month_end);

        var startDate   = Date.parse(start_date);
        var endDate     = Date.parse(end_date);

        if(endDate > startDate){
            parent.tab_add('Balance Sheet Multi Consolidation Period', '<?= "report/index_financial_statement/preview_balancesheet_multi_consolidation_period/" ?>' + txt_month_from + '/' + txt_year_from + '/' + txt_month_end + '/' + txt_year_end,'icon-preview');
            modal_close('dialog_multi_consolidation_balance_period');
        }else{
            $.messager.alert('Warning','Begin Period harus lebih besar dari end period.','error');
        }
    }

    function balance_sheet_consolidation_report(){
        month   = $('#b_consolidation_month').combobox('getValue');
        year    = $('#b_consolidation_year').numberspinner('getValue');

        parent.tab_add('Balance Sheet Consolidation Period Report', '<?= "report/index_financial_statement/preview_balancesheet_consolidation_period/" ?>' + month + '/' + year,'icon-preview');
        modal_close('dialog_consolidation_period');
    }

</script>