<?php
use \common\libs\MyLib;
?>
<form id="theFrm">
    <input type="hidden" name="id" value="<?=$info->id?>">
    <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
        <tr>
            <td align="center" colspan="7" height="25" class="bg_tr">支出信息</td>
        </tr>
        <tr>
            <td height="25" class="bg_tr">录入日期</td>
            <td colspan="6" height="25" class="td_bg">
                <input name="record_date" id="record_date" class="Wdate" type="text" value="<?=$info->record_date?>" onClick="WdatePicker()">
            </td>
        </tr>
        <tr>
            <td height="25" class="bg_tr">所属大类</td>
            <td height="25" class="td_bg">
                <select name="class_id">
                    <option value="0">请选择</option>
                    <?php
                    foreach($class_list as $class_info) {
                        echo '<option value="'.$class_info->id.'"';
                        if($info->class_id == $class_info->id)
                            echo ' selected ';
                        echo '>'.$class_info->name.'</option>';
                    }
                    ?>
                </select>
            </td>
            <td height="25" class="bg_tr">项目</td>
            <td height="25" class="td_bg">
                <input type="text" name="title" value="<?=$info->title?>" typeof="width:100">
            </td>
        </tr>
        <tr>
            <td height="25" class="bg_tr">单价</td>
            <td height="25" class="td_bg">
                <input type="text" name="price" value="<?=$info->price?>" typeof="width:100">
            </td>
            <td height="25" class="bg_tr">数量</td>
            <td height="25" class="td_bg">
                <input type="text" name="num" value="<?=$info->num?>" typeof="width:100">
            </td>
        </tr>
        <tr>
            <td height="25" class="bg_tr">备注</td>
            <td colspan="3" height="25" class="td_bg">
                <textarea name="note" style="width:100%; height: 60px;"><?=$info->note?></textarea>
            </td>
        </tr>
    </table>
    <div align="center">
        <input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/>
        &nbsp;&nbsp;
        <input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
    </div>
</form>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
    $(function () {
        //提交按钮
        $("#submit-btn").click(function(){
            if(confirm('是否确认提交?')) {
                var params = $("#theFrm").serialize();
                $.post('/finance/caiwu-zc-save',params,function(obj){
                    alert(obj.msg);
                    if(obj.success) {
                        $('#back-btn').click();
                    }
                },'json');
            }
        });

        //返回按钮
        $('#back-btn').click(function(){
            window.location.href='/finance/caiwu-zc-list?<?=$back_params?>';
        });
    })
</script>
