<!--
Author 		  : Tagor
Last update   : 18/08/2014
Desc          : Form Roll Over
-->
<div id="dlg_rollover" name="dlg_rollover" class="easyui-dialog" Title="Job Cost Roll Over" data-options="closed:true,modal:true" style="width:720px;background-color:#D5CDFF;padding-top:5px;">
	<form id="fm_roll_over" name="fm_roll_over" method="post">
    <fieldset>
		<table>
		<tr>
            <td style="width:160px;"><b>Batch No.</b></td>
            <td>
             <select name="cmb_roll_over" class="easyui-combogrid" id="cmb_roll_over" required="required" style="width:200px;height:20px" 
                    data-options="
                        editable:false,
                        panelWidth: 300,
                        idField: 'JCostAccount',
                        textField: 'JCostNumber',
                        
                        url: '<?php echo base_url(); ?><?php echo"activities/rol_over"; ?>/get_no_job_cos',
                        columns: [[
                        {
                            field:'JCostNumber',title:'Batch Number',width:190}
                        ]],
                        fitColumns: true
                        
                    ">
            </select>
               
            </td>
        </tr>
        <tr>
            <td><b>Date</b></td>
            <td><input type="text" id="txt_date" name="txt_date" readonly value="" style="width:251px;background-color:#E6E6E6;" /></td>
        </tr>
        <tr>
            <td><b>Job Cost Account</b></td>
            <td>
                <input type="text" id="txt_jobcostaccountno" name="txt_jobcostaccountno" readonly value="" style="width:251px;background-color:#E6E6E6;" />
            </td>
            <td colspan="2"><input type="text" id="txt_jobcostaccountnodesc" name="txt_jobcostaccountnodesc" readonly value="" style="width:251px;background-color:#E6E6E6;" /></td>
        </tr>
        <tr>
            <td><b>Description</b></td>
            <td colspan="3">
                <input type="text" id="txt_jobcostdesc" name="txt_jobcostdesc" readonly value="" style="width:508px;background-color:#E6E6E6;" />
            </td>
        </tr>
        <tr>
            <td><b>Total Job Cost</b></td>
            <td>
            	<input type="text" name="txt_totaljobcost" id="txt_totaljobcost" class="easyui-numberbox" style="text-align:right;" 
                                            data-options="precision:2,decimalSeparator:',',groupSeparator:'.'" readonly/>
            </td>
        </tr>
		</table>
	</fieldset>
	
	<table style="margin:0px 10px 0px;">
    <tr>
        <td valign="top" style="width:160px;padding-top:5px;"><b>Roll Over Type</b></td>
        <td valign="top" width="246px">
            <fieldset style="width:230px;">
                <input type="radio" id="rdo_toaccount" name="rdo_rollovertype" /> To Account <br />
            </fieldset>
        </td>
        <td valign="top" style="padding-top:5px;"><b style="margin-left:0px;">Roll Over Date</b></td>
        <td valign="top">&nbsp;<input type="text" id="" name="txt_rolloverdate" class="easyui-datebox" style="width:155px;" /></td>
    </tr>
	</table>
    </form>
    <br />
	
    <table id="tt_rollover" class="easyui-datagrid" 
    	style="height:150px;" 
    	data-options="scrollAble:true,singleSelect:true,onDblClickCell:onDblClickCellRollOver,method:'post'"
    >
        <thead>
        <tr>
            <th field="ItemNo" width="200" data-options="align:'left',halign:'center'">Account No.</th>			
            <th field="ItemDescription" width="250" data-options="align:'left',halign:'center'">Account Name</th>			
            <th field="ItemQuantity" width="200" data-options="align:'left',halign:'center'">Department</th>	
        </tr>
        </thead>
    </table>
	
	<div>
		<a href="javascript:void(0)" id="" name="" class="easyui-linkbutton" iconCls="icon-cancel" onclick="modal_close('dlg_rollover')" style="margin:10px 3px 5px;float:right;">Cancel</a>
		<a href="javascript:void(0)" id="" name="" class="easyui-linkbutton" iconCls="icon-ok" style="margin:10px 3px 5px;float:right;">OK</a>
	</div>
</div>

<!--
Author 		  : Tagor
Last update   : 18/08/2014
Desc          : popup Form search item
-->
<div id="dlg_searchitem" name="" class="easyui-dialog" title="Item" style="width:750px;height:420px;max-width:800px;padding:10px" 
		data-options="onResize:function(){$(this).dialog('center');},closed:true,singleSelect:true">
	<span>
		Search By : 
	</span>
	<a href="javascript:void(0)" id="btn_itemnew" name="btn_itemnew" disabled class="easyui-linkbutton">New Item</a>
	<br />
	
	<input type="text" id="txt_filteritemno" name="txt_filteritemno" onkeyup="doItemSearch()" style="width:279px;margin-top:5px;" />
	<input type="text" id="txt_filteritemdesc" name="txt_filteritemdesc" onkeyup="doItemSearch()" style="width:397px;margin-top:5px;" /><br /><br />
	
	<table id="dg_item" class="easyui-datagrid" 
    	style="width:700px;height:250px"
        url="<?php echo base_url(); ?>activities/rol_over/ajax/<?php echo $this->session->userdata('company');?>" 
		data-options="singleSelect:true,url:'',method:'post',scrolAble:true,onDblClickRow:onDblClickRowItem"
    >
		<thead>
        <tr>
            <th data-options="field:'ItemNo',width:240">Item No</th>
            <th data-options="field:'ItemDescription',width:395">Item Description</th>
        </tr>
		</thead>
	</table>
</div>
<script type="text/javascript">
	$('#cmb_roll_over').combogrid({
		onSelect: function(rowIndex, rowData){	
			$('#txt_jobcostaccountno').val(rowData.JCostAccount); 
			$('#txt_jobcostaccountnodesc').val(rowData.AccountName); 
			$('#txt_date').val(rowData.JCostDate); 
			$('#txt_jobcostdesc').val(rowData.JCostDesc);
			$('#txt_totaljobcost').numberbox('setValue',rowData.JCostSubTotal);
		}
    });
</script>