<?php
/* 
 * Author   : Ferry / 31-03-2015 / Preference for Service and Expense
 * 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:230px; background-color:#F8F8F8;">
        <div title="" style="padding:10px;overflow:auto;" data-options="selected:true" >				
            <div class="preference_menu">
                <ul>
                    <!--<li><a href="<?php echo site_url('setup/preference_account'); ?>" style="border-top:none;"><img src="<?php echo base_url(); ?>assets/custom/icons/clipboard-invoice.png" alt=""/><span>P/L Account</span></a></li>-->	
                    <li><a href="<?php echo site_url('setup/preference_item'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/clipboard-invoice.png" alt=""/><span>Item Account</span></a></li>	
                    <li><a href="<?php echo site_url('setup/preference_sales'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/moneys.png" alt=""/><span>Sales Account</span></a></li>                   				   
                    <li><a href="<?php echo site_url('setup/preference_purchases'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/sticky-notes.png" alt=""/><span>Purchases Account</span></a></li>	
                    <li><a href="<?php echo site_url('setup/preference_services'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/calculator.png" alt=""/><span><b>Expense Account</b></span></a></li>
                    <li><a href="<?php echo site_url('setup/preference_advances'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/calculator.png" alt=""/><span>Adv. Payment Account</span></a></li>
                    <li><a href="<?php echo site_url('setup/preference_expense'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/calculator.png" alt=""/><span>Cash-Bon Account</span></a></li>
                    <li><a href="<?php echo site_url('setup/preference_others'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/money-coin.png" alt=""/><span>Others Account</span></a></li> 
                    <li><a href="<?php echo site_url('setup/preference_approval'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/property.png" alt=""/><span>Sales Approval Limit</span></a></li>
                    <li><a href="<?php echo site_url('setup/preference_miscellaneous'); ?>"><img src="<?php echo base_url(); ?>assets/custom/icons/folder-stand.png" alt=""/><span>Miscellaneous</span></a></li>
                </ul>
            </div>	
        </div>
    </div>
    
    <div data-options="region:'center',fit:false,plain:true, border:false" style="background:#eee;">
        <div id="wrapptabs" name="" class="easyui-tabs">
            <!--Awal View Service Category-->
            <div id="tab_service_group" title="Expense Category" border="false" style="padding:1px 0 1px 0;background:#EEE;">
                <div style="float:left;padding-left:5px;margin-bottom:5px;width:1116px;height:526px;background:#FFF;border:#95B8E7 1px solid;">
                    <div style="overflow:hidden;padding:1px;">
                        <form id="service_category" method="post" class="preference_form">
                            <label>								
                                <div style="margin:0px 0px 10px">
                                    <table id="dtg_category" class="easyui-edatagrid" title="" iconCls="icon-save" rownumbers="true" toolbar="#toolbar_cat" fitColumns="true" singleSelect="true" style="width:1090px;height:469px"
                                        > 
                                        <thead>
                                            <tr>
                                                <th field="SvcCategoryName" width="200" data-options="align:'left',halign:'center'">Category Name</th>
                                                <th field="SvcCategoryDesc" width="355" data-options="align:'left',halign:'center'">Description</th>
                                                <th field="SvcCategoryID" width="55"data-options="align:'center',halign:'center'" hidden>Category ID</th>							
                                                <th field="SvcCategoryType" width="55"data-options="align:'center',halign:'center'" hidden>ModusType</th>							
                                            </tr>
                                        </thead>
                                    </table>

                                    <div id="toolbar_cat">
                                        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="load_category_popup(1);">New </a>
                                        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="load_category_popup(2);">Edit</a>
                                        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="delete_category();">Delete </a>
                                    </div>                                    
                                </div>				
                            </label> <br />
                        </form>
                    </div>			
                </div>

                <div style="padding:5px;text-align:right;width:1110px;">
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-save" onclick="save_category();">Save</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton  form-button" iconCls="icon-cancel" onclick="">Cancel</a>
                </div>	
            </div>
            <!--Akhir View Service Category-->
            
            <!--Awal View Service Detail-->
            <div id="tab_service_detail" title="Expense Detail" style="padding:1px 0 1px 0;background:#EEE;">
                <div style="float:left;padding-left:5px;margin-bottom:5px;width:1116px;height:526px;background:#FFF;border:#95B8E7 1px solid;">
                    <div style="overflow:hidden;padding:1px;">
                        <form id="service_detail" method="post" class="preference_form">
                                    <table id="dtg_detail" class="easyui-edatagrid" title="" iconCls="icon-save" rownumbers="true" toolbar="#toolbar_det" fitColumns="true" singleSelect="true" style="width:1090px;height:469px"
                                    > 
        
                                   
                                        <thead>
                                            <tr>
                                                <th field="SvcDetailName" width="200" data-options="align:'left',halign:'center'">Detail Name</th>
                                                <th field="SvcDetailDesc" width="150" data-options="align:'left',halign:'center'">Description</th>
                                                <th field="SvcDetailUnit" width="30"data-options="align:'center',halign:'center'">Item Unit</th>	
                                                <th field="SvcDetailTax" width="30"data-options="align:'center',halign:'center'">PPh23</th>							
                                                <th field="SvcDetailID" width="55"data-options="align:'center',halign:'center'" hidden>Detail ID</th>							
                                                <th field="SvcDetailType" width="55"data-options="align:'center',halign:'center'" hidden>ModusType</th>	
                                                <th field="SvcCategoryName" width="100"data-options="align:'left',halign:'center'" >Category Name</th>	
                                                <th field="SvcCategoryID" width="100"data-options="align:'left',halign:'center'" hidden>Category ID</th>							
                                            </tr>
                                        </thead>
                                    </table>
                                    
                                    <div id="toolbar_det">
                                        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="load_detail_popup(1);">New </a>
                                        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="load_detail_popup(2);">Edit</a>
                                        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="delete_detail();">Delete </a>
                                    </div>
                        </form>
                    </div>
                </div>

                <div style="padding:5px;text-align:right;width:1110px;">
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-save" onclick="save_detail();">Save</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-cancel" onclick="">Cancel</a>
                </div>	
            </div>
            <!--Akhir View Service Detail-->

            <!--Awal View Service Account-->
            <div id="tab_service_account" title="Expense Account" style="padding:1px 0 1px 0;background:#EEE;">
                <div style="float:left;padding-left:5px;margin-bottom:5px;width:1115px;height:600px;background:#FFF;border:#95B8E7 1px solid;">
                    <div style="overflow:hidden;padding:1px;">
                        <form id="service_account" class="preference_form">
                            <table width="100%" cellspacing="1" cellpadding="1">
                                <tr>
                                    <td valign="middle"><b>Expense Group</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_svc_catdetail_account" name="cbo_svc_catdetail_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'SvcCategoryID',
                                                textField:'SvcCategoryName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/ajax_service_category'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                
                                <tr><td colspan='3'>&nbsp;</td></tr>
                                <tr><td colspan='3'>&nbsp;</td></tr>
                                <tr><td colspan='3'>&nbsp;</td></tr>
                                <tr><td colspan='3'>&nbsp;</td></tr>

                                <tr>
                                    <td valign="middle"><b>Sales Service</b></td>

                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_sales_expense" name="cbo_sales_expense" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/SalesExpense'
                                            ">
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td valign="middle"><b>Sales Advance</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_sales_advance" name="cbo_sales_advance" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/SalesAdvance'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td valign="middle"><b>Sales Invoice Discount</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_sales_sinv_discount" name="cbo_sales_sinv_discount" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/SalesInvDiscount'
                                            ">
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td valign="middle"><b>Sales Receipt Discount</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_sales_srec_discount" name="cbo_sales_srec_discount" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/SalesRecDiscount'
                                            ">
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td valign="middle"><b>Sales Unbilled (Owing)</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_sales_unbilled" name="cbo_sales_unbilled" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/SalesUnbilled'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                <!--
                                	Tambahan baru sales taxable
                                	Tgl 15/01/2016
                                    fachri
                                -->
                                <tr>
                                    <td valign="middle"><b>Sales Taxable PPn 10</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                    	<select id="cbo_sales_tax_ppn" name="cbo_sales_tax_ppn" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/TaxablePPnSales'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td valign="middle"><b>Sales Freight Expense</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                    	<select id="cbo_freight_sales" name="cbo_freight_sales" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/FreightSales'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                <!-------------------------------------------End-------------------------------------->
                                <tr><td colspan="3"><hr/></td></tr>

                                <tr>
                                    <td valign="middle"><b>Purchase Expense</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                       	<select id="cbo_expense_account" name="cbo_expense_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/ExpenseAccount'
                                            ">
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td valign="middle"><b>Purchase Advance</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_advance_account" name="cbo_advance_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/AdvanceAccount'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td valign="middle"><b>Purchase Invoice Discount</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_pinv_discount_account" name="cbo_pinv_discount_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/InvoiceDiscount'
                                            ">
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td valign="middle"><b>Purchase Payment Discount</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_ppay_discount_account" name="cbo_ppay_discount_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/PaymentDiscount'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td valign="middle"><b>Purchase Unbilled (Owing)</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                         <select id="cbo_unbilled_account" name="cbo_unbilled_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/UnbilledAccount'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                <!--
                                	Tambahan baru purchase taxable
                                	Tgl 15/01/2016
                                    fachri
                                -->
                                <tr>
                                    <td valign="middle"><b>Purchase Taxable PPn 10</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                    	<select id="cbo_purchase_tax_ppn" name="cbo_purchase_tax_ppn" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/TaxablePPnPurchase'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                
                                 <tr>
                                    <td valign="middle"><b>Purchase Freight Expense</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                    	<select id="cbo_freight_purchase" name="cbo_freight_purchase" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/FreightPurchase'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                <!-------------------------------------------End-------------------------------------->

                                <tr><td colspan="3"><hr/></td></tr>

                                <tr>
                                    <td valign="middle"><b>Taxable PPh 23</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_taxpph23_account" name="cbo_taxpph23_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/TaxPPh23Account'
                                            ">
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td valign="middle"><b>Taxable PPh 21</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_taxpph21_account" name="cbo_taxpph21_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/TaxPPh21Account'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td valign="middle"><b>Realized Gained / Loss</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_realized_account" name="cbo_realized_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/RealizedAccount'
                                            ">
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td valign="middle"><b>Unrealized Gained / Loss</b></td>
                                    
                                    <td width="650" height="15" align="left" valign="middle">
                                        <select id="cbo_unrealized_account" name="cbo_unrealized_account" class="easyui-combobox" style="width:651px;" required
                                            data-options = "
                                                valueField:'AccountNumber',
                                                textField:'AccountName',
                                                url:'<?php echo base_url(); ?>setup/preference_services/UnRealizedAccount'
                                            ">
                                        </select>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>			
                </div>

                <div style="padding:5px;text-align:right;width:1110px;">
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-save" onclick="save_account();">Save</a>
                    <!--<a id="save_account" href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-save" >Save</a>-->
                    <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-cancel" onclick="">Cancel</a>
                </div>	
            </div>
            <!--Akhir View Service Account-->
        </div>		
    </div>
</div>

<!-- Batas Awal Dialog Service Detail Adding -->
<div id="dlg_detail_add" class="easyui-dialog" style="width:700px;height:260px;padding:10px;" closed="true" buttons="#dlg_detail_add_button" data-options="modal:true">
    <form id="frm_detail_add" method="post" novalidate>
        <input type="hidden" name="SvcDetailID" id="hdn_det_id_add" value="0"/>
        <input type="hidden" name="SvcCategoryName" id="SvcCategoryName_Add"/>
        <input type="hidden" name="SvcCategoryID" id="SvcCategoryID_Add"/>
        
        <table width="100%" cellpadding="2" cellspacing="0">
            <tr>
            	<td width='120'><b>Category</b></td>
                <td width='10'>:</td>
                <td align="left">
                	<select id="cbo_service_catdetail" name="cbo_service_catdetail" class="easyui-combobox" style="width:470px;" required
                        data-options = "
                            valueField:'SvcCategoryID',
                            textField:'SvcCategoryName',
                            url:'<?php echo base_url(); ?>setup/preference_services/ajax_service_category'
                        ">
                    </select>
                </td>
            </tr>
            <tr>
                <td width='120'><b>Item Name</b></td>
                <td width='10'>:</td>

                <td align="left">
                    <input id="txt_det_name_add" name="txt_det_name_add" placeholder="< Item Expense Detail Name >" style="width:470px;height:20px; border:1px solid #ccc;" MAXLENGTH="30" required>
                </td>
            </tr>

            <tr>
                <td valign="top"><b>Description</b></td>
                <td valign="top">:</td>
                
                <td align="left">
                    <textarea id="txa_det_desc_add" name="txa_det_desc_add" placeholder="< Item Expense Detail Description >" rows="4" style="resize:none;width:466px;white-space:normal;"></textarea>
                </td>
            </tr>
			<tr>
                <td width='120'><b>Item Unit</b></td>
                <td width='10'>:</td>

                <td align="left">
                    <input id="txa_det_unit_add" name="txa_det_unit_add" maxlength="5" placeholder="< Item Expense Unit >" style="width:470px;height:20px; border:1px solid #ccc;">
                </td>
            </tr>
            <tr>
                <td valign="top"><b>PPh 23</b></td>
                <td valign="top">:</td>
                
                <td align="left">
                    <input type="radio" name="rdo_det_pph23_add" value="1" checked/> Yes
                    <input type="radio" name="rdo_det_pph23_add" value="0"/> No 
                </td>
            </tr>
            
            
        </table>
    </form>
</div>

<!-- Dialog Button -->
<div id="dlg_detail_add_button" style="border:none;">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="modify_detail_popup(1);">Add Item</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_detail_add').dialog('close');">Cancel</a>
</div>
<!-- Batas Akhir Dialog Service Detail Adding -->

<!-- Batas Awal Dialog Service Detail Editing -->
<div id="dlg_detail_edit" class="easyui-dialog" style="width:700px;height:260px;padding:10px;" closed="true" buttons="#dlg_detail_edit_button" data-options="modal:true">
    <form id="frm_detail_edit" method="post" novalidate>
        <input type="hidden" name="SvcDetailID" id="hdn_det_id_edit"/>
        <input type="hidden" name="SvcDetailType" id="hdn_det_type_edit"/>
		<input type="hidden" name="SvcCategoryName" id="SvcCategoryName_Edit"/>
        <input type="hidden" name="SvcCategoryID" id="SvcCategoryID_Edit"/>
        
        <table width="100%" cellpadding="2" cellspacing="0">
            <tr>
            	<td width='120'><b>Category</b></td>
                <td width='10'>:</td>
                <td align="left">
                	<select id="SvcCategoryID" name="SvcCategoryID" class="easyui-combobox" style="width:470px;" required
                        data-options = "
                            valueField:'SvcCategoryID',
                            textField:'SvcCategoryName',
                            url:'<?php echo base_url(); ?>setup/preference_services/ajax_service_category'
                        ">
                    </select>
                </td>
            </tr>
            
            <tr>
        	<td width="120"><b>Item Name</b></td>
                <td width="10">:</td>
                
                <td align="left">
                    <input id="txt_det_name_edit" name="SvcDetailName" placeholder="< Item Expense Detail Name >" style="width:470px; height:20px; border:1px solid #ccc" MAXLENGTH="30">
                </td>
            </tr>

            <tr>
        	<td valign="top"><b>Description</b></td>
                <td valign="top">:</td>

                <td align="left">
                    <textarea id="txa_det_desc_edit" name="SvcDetailDesc" placeholder="< Item Expense Detail Description >" rows="4" style="width:466px;resize:none;white-space:normal;"></textarea>
                </td>
            </tr>
			<tr>
                <td width='120'><b>Item Unit</b></td>
                <td width='10'>:</td>

                <td align="left">
                    <input id="txt_item_unit" name="SvcDetailUnit" maxlength="5" placeholder="< Item Expense Unit >" style="width:470px;height:20px; border:1px solid #ccc;">
                </td>
            </tr>
           
            <tr>
                <td valign="top"><b>PPh 23</b></td>
                <td valign="top">:</td>
                
                <td align="left">
                    <input type="radio" name="rdo_det_pph23_edit" value="1"/> Yes
                    <input type="radio" name="rdo_det_pph23_edit" value="0"/> No 
                </td>
            </tr>
            
        </table>
    </form>
</div>

<!-- Dialog Service Detail Editing Button -->
<div id="dlg_detail_edit_button" style="border:none;">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="modify_detail_popup(2);">Edit Item</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_detail_edit').dialog('close');">Cancel</a>
</div>
<!-- Batas Akhir Dialog Service Detail Editing -->

<!-- Batas Awal Dialog Services Category Adding -->
<div id="dlg_category_add" class="easyui-dialog" style="width:650px; height:190px; padding: 10px" closed="true" buttons="#dlg_category_add_button" data-options="modal:true">
    <form id="frm_service_category_add" method="post" novalidate>
        <input type="hidden" name="SvcCategoryID" id="hdn_cat_id_add" value="0"/>
        
        <table width="100%" cellpadding="2" cellspacing="0">
            <tr>
                <td width='120'><b>Category Name</b></td>
                <td width='10'>:</td>
                
                <td align="left">
                    <input id="txt_cat_name_add" name="txt_cat_name_add" placeholder="< Item Expense Category Name >" style="width:470px; height:20px; border:1px solid #ccc" required MAXLENGTH="30">
                </td>
            </tr>

            <tr>
                <td width='120'><b>Description</b></td>
                <td width='10'>:</td>
                
                <td align="left">
                    <textarea id="txa_cat_desc_add" name="txa_cat_desc_add" placeholder="< Item Expense Category Description >" rows="4" style="resize:none;width:466px;white-space:normal;"></textarea>
                </td>
            </tr>            
        </table>
    </form>
</div>

<!-- Dialog Service Category Button -->
<div id="dlg_category_add_button" style="border:none;">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="modify_category_popup(1);">Add Item</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_category_add').dialog('close');">Cancel</a>
</div>
<!-- Batas Akhir Dialog Service Catagory -->

<!-- Batas Awal Dialog Services Category Editing -->
<div id="dlg_category_edit" class="easyui-dialog" style="width:650px; height:190px; padding: 10px" closed="true" buttons="#dlg_category_edit_button" data-options="modal:true">
    <form id="frm_category_edit" method="post" novalidate>
        <input type="hidden" name="SvcCategoryID" id="hdn_cat_id_edit"/>
        <input type="hidden" name="SvcCategoryType" id="hdn_cat_type_edit"/>
        
        <table width="100%" cellpadding="2" cellspacing="0">
            <tr>
                <td width='120'><b>Category Name</b></td>
                <td width='10'>:</td>
                
                <td align="left">
                    <input id="txt_cat_name_edit" name="SvcCategoryName" placeholder="< Item Expense Category Name >" style="width:470px; height:20px; border:1px solid #ccc" required MAXLENGTH="30">
                </td>
            </tr>

            <tr>
                <td width='120'><b>Description</b></td>
                <td width='10'>:</td>
                
                <td align="left">
                    <textarea id="txa_cat_desc_edit" name="SvcCategoryDesc" placeholder="< Item Expense Category Description >" rows="4" style="resize:none;width:466px;white-space:normal;"></textarea>
                </td>
            </tr>            
        </table>
    </form>
</div>

<!-- Dialog Service Category Editing Button -->
<div id="dlg_category_edit_button" style="border:none;">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="modify_category_popup(2);">Edit Item</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_category_edit').dialog('close');">Cancel</a>
</div>
<!-- Batas Akhir Dialog Service Catagory editing -->

<script>
    $('#cbo_service_catdetail').combobox({
        onSelect: function(rec){			
            $('#SvcCategoryID_Add').val(rec.SvcCategoryID);
			$('#SvcCategoryName_Add').val(rec.SvcCategoryName);
        }
    });
  	
	$('#SvcCategoryID').combobox({
        onSelect: function(rec){			
            $('#SvcCategoryID_Edit').val(rec.SvcCategoryID);
			$('#SvcCategoryName_Edit').val(rec.SvcCategoryName);
        }
    });
	
	 $(function(){
		var dg_detail = $('#dtg_detail').datagrid({remoteFilter:true,type:'post',url:'<?php echo base_url(); ?>setup/preference_services/ajax_service_detail'});
		$('#dtg_detail').datagrid('enableFilter');
		
		var dg_group = $('#dtg_category').datagrid({remoteFilter:true,type:'post',url:'<?php echo base_url(); ?>setup/preference_services/ajax_service_category'});
		$('#dtg_category').datagrid('enableFilter');
	});
		
    $('#cbo_svc_catdetail_account').combobox({
        onSelect: function(rec){			
            var category_id = rec.SvcCategoryID;

            if(category_id !== 0){
                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/sales_list_expense_account",
                    data    : "category_id= " + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_sales_expense").combobox('select', result.AccountNumber);
//                        $('#hdn_sales_expense').val(result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/sales_list_advance_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_sales_advance").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/sales_list_sinv_discount_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_sales_sinv_discount").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/sales_list_srec_discount_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_sales_srec_discount").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/sales_list_unbilled_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_sales_unbilled").combobox('select', result.AccountNumber);
                    }
                });
				
				/*
					Tambahan baru di sales taxable ppn 10, tgl 15/01/2016
				*/
				$.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/sales_list_taxableppn10_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_sales_tax_ppn").combobox('select', result.AccountNumber);
                    }
                });
				
				$.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/sales_list_freight_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_freight_sales").combobox('select', result.AccountNumber);
                    }
                });
				/*
					=============================End==================================
				*/
				
                //--------------------------------------Batas Sales-----------------------------------------//

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_expense_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_expense_account").combobox('select', result.AccountNumber);
                    }
                });
                
                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_advance_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_advance_account").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_pinv_disc_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_pinv_discount_account").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_ppay_disc_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_ppay_discount_account").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_unbilled_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_unbilled_account").combobox('select', result.AccountNumber);
                    }
                });
				
				/*
					Tambahan baru di purchase taxable ppn 10, tgl 15/01/2016
				*/
				$.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/purchase_list_taxableppn10_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_purchase_tax_ppn").combobox('select', result.AccountNumber);
                    }
                });
				
				$.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/purchase_list_freight_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_freight_purchase").combobox('select', result.AccountNumber);
                    }
                });
				/*
					=============================End==================================
				*/
				
                //-------------------------------------Batas Purchase----------------------------------------//
                
                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_taxpph23_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_taxpph23_account").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_taxpph21_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_taxpph21_account").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_realized_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_realized_account").combobox('select', result.AccountNumber);
                    }
                });

                $.ajax({
                    type    : "POST",
                    url     : "<?php echo base_url(); ?>setup/preference_services/combo_list_unrealized_account",
                    data    : "category_id=" + category_id,
                    cache   : false,
                    success : function(result){
                        var result = eval('('+result+')');
                        $("#cbo_unrealized_account").combobox('select', result.AccountNumber);
                    }
                });
                //-----------------------------------Batas Tax && Realized-------------------------------------//
            }
        }
    });

    function load_category_popup(modus_type){
        if(modus_type == 1){
            modal_open('New Item Expense Category', 'dlg_category_add');
        }
        else {
            var row = $('#dtg_category').datagrid('getSelected');

            if(row){
                $('#dlg_category_edit').dialog('open').dialog('setTitle', 'Edit Item Expense Category');
                $('#frm_category_edit').form('load',row);
            }
        }
    }
    
    function modify_category_popup(modus_type){
        if(modus_type == 1){
            category_id     = $('#hdn_cat_id_add').val();
            category_name   = $('#txt_cat_name_add').val().trim();
            category_desc   = $('#txa_cat_desc_add').val().trim();
            action_type     = modus_type;
        }
        else{
            category_id     = $('#hdn_cat_id_edit').val();
            category_name   = $('#txt_cat_name_edit').val().trim();
            category_desc   = $('#txa_cat_desc_edit').val().trim();
            action_type     = $('#hdn_cat_type_edit').val();
        }
        
        if(category_name != ''){
            confirm_category(category_id, category_name, category_desc, modus_type, action_type);            
        }
        else{
            $.messager.alert('Warning','Item Expense Category Name tidak boleh kosong','error');
        }
    }

    function confirm_category(category_id, category_name, category_desc, modus_type, action_type){
        var url             = base_url + 'setup/preference_services/check_category_name';
        
        var i               = $('#dtg_category').datagrid('getRows');
        var detail          = JSON.stringify(i);

        var selectedrow     = $('#dtg_category').datagrid('getSelected');
        var row_index       = $('#dtg_category').datagrid('getRowIndex', selectedrow);

        $.post(url, {detail:detail, category_id:category_id, category_name:category_name, modus_type:modus_type}, function(result){
            if (result.status == true){
                if(result.flag == true){
                    $.messager.alert('Warning', result.message, 'error');
                }
                else {
                    modify_category(row_index, category_name, category_desc, modus_type, action_type);
                }                    
            } 
            else {                
                if(result.flag == true){
                    $.messager.alert('Warning', result.message, 'error');
                }
                else {
                    modify_category(row_index, category_name, category_desc, modus_type, action_type);
                }   
            }
        },'json');            
    }

    function modify_category(row_index, category_name, category_desc, modus_type, action_type){
        if(modus_type == 1){
            $('#dtg_category').datagrid('appendRow',{
                SvcCategoryName : category_name,
                SvcCategoryDesc : category_desc,
                SvcCategoryType : modus_type,
                SvcCategoryID   : 0
            });

            $('#txt_cat_name_add').val('');
            $('#txa_cat_desc_add').val('');
            modal_close('dlg_category_add');
        }
        else{
            modus_type = action_type == 1 ? 1 : modus_type;

            $('#dtg_category').datagrid('updateRow',{
               index:row_index,
               row: {
                   SvcCategoryName  : category_name,
                   SvcCategoryDesc  : category_desc,
                   SvcCategoryType  : modus_type
               }
            });

            $('#txt_cat_name_edit').val('');
            $('#txa_cat_desc_edit').val('');
            modal_close('dlg_category_edit');
        }
    }

    function delete_category(){        
        var url             = base_url + 'setup/preference_services/delete_category';

        var selectedrow     = $('#dtg_category').datagrid('getSelected');
        var row_index       = $('#dtg_category').datagrid('getRowIndex', selectedrow);
        
        var svc_category_id = selectedrow.SvcCategoryID;

        $.messager.confirm('Confirmation :', 'Anda yakin, Anda ingin menghapus item "' + selectedrow.SvcCategoryName + '"',  
            function(r){
                if (r){
                    $('#dtg_category').datagrid('deleteRow', row_index);
                    
                    $.post(url, {svc_category_id:svc_category_id}, function(result){
                        if (result.status == true){
                            $.messager.alert('Success',result.message,'info',function(){
                                location.reload();						                    
                            });				
                        } 
                        else {
                            $.messager.alert('Failed',result.message,'error',function(){
                                location.reload();						                    
                            });				
                        }
                    },'json');
                }
            }
	);        
    }

    function load_detail_popup(modus_type){
        if(modus_type == 1){
			modal_open('New Item Expense Detail', 'dlg_detail_add');
		}
		else {
			var row = $('#dtg_detail').datagrid('getSelected');

			if(row){
				if(row.SvcDetailTax == 'Yes'){
					$("input[value='1']").prop('checked',true);
				}
				else{
					$("input[value='0']").prop('checked',true);
				}
				
				$('#dlg_detail_edit').dialog('open').dialog('setTitle', 'Edit Item Expense Detail');
				$('#frm_detail_edit').form('load',row);
			}
		}
    }

    function modify_detail_popup(modus_type){
        if(modus_type == 1){
            detail_id       = $('#hdn_det_id_add').val();
            detail_name     = $('#txt_det_name_add').val().trim();
            detail_desc     = $('#txa_det_desc_add').val().trim();
			detail_unit     = $('#txa_det_unit_add').val().trim();
            detail_pph23    = $('input[name="rdo_det_pph23_add"]:checked').val();
			group_name      = $('#SvcCategoryName_Add').val().trim();
			group_id      	= $('#SvcCategoryID_Add').val().trim();
            action_type     = modus_type;            
        }
        else{
            detail_id       = $('#hdn_det_id_edit').val();
            detail_name     = $('#txt_det_name_edit').val().trim();
            detail_desc     = $('#txa_det_desc_edit').val().trim();
			detail_unit     = $('#txt_item_unit').val().trim();
            detail_pph23    = $('input[name="rdo_det_pph23_edit"]:checked').val();
			group_name      = $('#SvcCategoryName_Edit').val().trim();
			group_id      = $('#SvcCategoryID_Edit').val().trim();
            action_type     = $('#hdn_det_type_edit').val();            
        }

        if(detail_name != ''){
            pph23_status    = detail_pph23 == 0 ? 'No' : 'Yes';
            confirm_detail(detail_id, detail_name, detail_desc, detail_unit, pph23_status, modus_type, action_type,group_name,group_id);            
        }
        else{
            $.messager.alert('Warning','Item Expense Detail Name tidak boleh kosong','error');
        }
    }

    function confirm_detail(detail_id, detail_name, detail_desc, detail_unit, pph23_status, modus_type, action_type,group_name,group_id){
        var url             = base_url + 'setup/preference_services/check_detail_name';
        
        var i               = $('#dtg_detail').datagrid('getRows');
        var detail          = JSON.stringify(i);

        var selectedrow     = $('#dtg_detail').datagrid('getSelected');
        var row_index       = $('#dtg_detail').datagrid('getRowIndex', selectedrow);

        $.post(url, {detail:detail, detail_id:detail_id, detail_name:detail_name, modus_type:modus_type, detail_unit:detail_unit}, function(result){
            if (result.status == true){
                if(result.flag == true){
                    $.messager.alert('Warning', result.message, 'error');
                }
                else {
                    $.messager.confirm('Confirmation :', result.message, function(r){
                        if(r){
                            modify_detail(row_index, detail_name, detail_desc, pph23_status, modus_type, action_type, detail_unit,group_name,group_id);
                        }
                    });
                }                    
            } 
            else {                
                modify_detail(row_index, detail_name, detail_desc, pph23_status, modus_type, action_type, detail_unit,group_name,group_id);
            }
        },'json');            
    }
    
    function modify_detail(row_index, detail_name, detail_desc, pph23_status, modus_type, action_type, detail_unit,group_name,group_id){
        if(modus_type == 1){
            $('#dtg_detail').edatagrid('appendRow',{
                SvcDetailName   : detail_name,
                SvcDetailDesc   : detail_desc,
                SvcDetailTax    : pph23_status,
				SvcDetailUnit   : detail_unit,
                SvcDetailType   : modus_type,
                SvcDetailID     : 0,
				SvcCategoryName : group_name,
				SvcCategoryID : group_id
            });

            $('#txt_det_name_add').val('');
            $('#txa_det_desc_add').val('');
            modal_close('dlg_detail_add');
        }
        else{
            modus_type = action_type == 1 ? 1 : modus_type;

            $('#dtg_detail').datagrid('updateRow',{
                index   : row_index,
                row     : {SvcDetailName   : detail_name,
                           SvcDetailDesc   : detail_desc,
						   SvcDetailUnit   : detail_unit,
                           SvcDetailTax    : pph23_status,
                           SvcDetailType   : modus_type,
						   SvcCategoryName : group_name,
						   SvcCategoryID : group_id}
            });

            $('#txt_det_name_edit').val('');
            $('#txa_det_desc_edit').val('');
			$('#txt_item_unit').val('');
            modal_close('dlg_detail_edit');
        }
    }    
    
    function delete_detail(){        
        var url             = base_url + 'setup/preference_services/delete_detail';

        var selectedrow     = $('#dtg_detail').datagrid('getSelected');
        var row_index       = $('#dtg_detail').datagrid('getRowIndex', selectedrow);
        
        var svc_detail_id   = selectedrow.SvcDetailID;

        $.messager.confirm('Confirmation :', 'Anda yakin, Anda ingin menghapus item "' + selectedrow.SvcDetailName + '"',  
            function(r){
                if (r){
                    $('#dtg_detail').datagrid('deleteRow', row_index);

                    $.post(url, {svc_detail_id:svc_detail_id}, function(result){
                        if (result.status == true){
                            $.messager.alert('Success',result.message,'info',function(){
//                                location.reload();						                    
                            });				
                        } 
                        else {
                            $.messager.alert('Failed',result.message,'error',function(){
                                location.reload();						                    
                            });				
                        }
                    },'json');
                }
            }
        );        
    }

    function save_category() {
        var url         = base_url + 'setup/preference_services/modify_category';

        var i           = $('#dtg_category').datagrid('getRows');
        var detail      = JSON.stringify(i);
        
        $.post(url, {detail:detail}, function(result){
            if (result.status == true){
                $.messager.alert('Success',result.message,'info',function(){
                    location.reload();
                });
            } 
            else {                
                $.messager.alert('Error',result.message,'error',function(){
                    location.reload();
                });
            }
        },'json');            
    }

    function save_detail() {
        var url             = base_url + 'setup/preference_services/modify_detail';
        var item            = $('#dtg_detail').datagrid('getRows');
        var detail          = JSON.stringify(item);
        
		$.post(url, {detail:detail}, function(result){
			if (result.status == true){
				$.messager.alert('Success',result.message,'info',function(){
					location.reload();
				});
			} 
			else {                
				$.messager.alert('Error',result.message,'error',function(){
					location.reload();
				});
			}
		},'json'); 
    }
    
    function save_account() {
        var url                 = base_url + 'setup/preference_services/modify_account';
	var category_id         = $("#cbo_svc_catdetail_account").combobox('getValue');

        var sales_expense       = $('#cbo_sales_expense').combobox('getValue');
        var sales_advance       = $('#cbo_sales_advance').combobox('getValue');
        var sales_inv_disc      = $('#cbo_sales_sinv_discount').combobox('getValue');
        var sales_rec_disc      = $('#cbo_sales_srec_discount').combobox('getValue');
        var sales_unbilled      = $('#cbo_sales_unbilled').combobox('getValue');
		var sales_taxable      = $('#cbo_sales_tax_ppn').combobox('getValue');
		var sales_freight      = $('#cbo_freight_sales').combobox('getValue');
        
        var expense_account     = $('#cbo_expense_account').combobox('getValue');
        var advance_account     = $('#cbo_advance_account').combobox('getValue');
        var pinv_disc_account   = $('#cbo_pinv_discount_account').combobox('getValue');
        var ppay_disc_account   = $('#cbo_ppay_discount_account').combobox('getValue');
        var unbilled_account    = $('#cbo_unbilled_account').combobox('getValue');
		var purchase_taxable    = $('#cbo_purchase_tax_ppn').combobox('getValue');
		var purchase_freight    = $('#cbo_freight_purchase').combobox('getValue');
        
        var taxpph23_account    = $('#cbo_taxpph23_account').combobox('getValue');
        var taxpph21_account    = $('#cbo_taxpph21_account').combobox('getValue');
        var realized_account    = $('#cbo_realized_account').combobox('getValue');
        var unrealized_account  = $('#cbo_unrealized_account').combobox('getValue');

        if(category_id == '' ){
            $.messager.alert('Warning','Expense Group tidak boleh kosong','error');
        }
        else{
            $.post(url, {category_id:category_id, taxpph23_account:taxpph23_account, taxpph21_account:taxpph21_account, realized_account:realized_account, unrealized_account :unrealized_account,
                         sales_expense:sales_expense, sales_advance:sales_advance, sales_inv_disc:sales_inv_disc, sales_rec_disc:sales_rec_disc, sales_unbilled:sales_unbilled, 
                         expense_account:expense_account, advance_account:advance_account, pinv_disc_account:pinv_disc_account, ppay_disc_account:ppay_disc_account, unbilled_account:unbilled_account, sales_taxable:sales_taxable, purchase_taxable:purchase_taxable, sales_freight:sales_freight, purchase_freight:purchase_freight}, 
                function(result){
                    if (result.status == true){
                        $.messager.alert('Success',result.message,'info',function(){
                            location.reload();
                        });
                    } 
                    else {                
                        $.messager.alert('Error',result.message,'error',function(){
                            location.reload();
                        });
                    }
                },
            'json');            
        }
    }

//    $("#save_account").click(function() {	
//	var category_id     = $("#cbo_svc_catdetail_account").combobox('getValue');
//
//        if(category_id == 0) {
//            $.messager.alert('Warning','Silahkan pilih Expense Group terlebih dahulu','warning');
//            return false;
//        } 
//        else{
//            $("#service_account").submit();	
//        }
//    });
</script>