acr_invoice_apply_detail.lview 13.5 KB
Newer Older
1 2 3 4 5 6 7 8 9
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-7-15 下午04:39:15  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:view>
10 11 12 13
        <a:link id="acr_invoice_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
                modelaction="update"/>
        <a:link id="acr610_invoice_detail_link"
                url="${/request/@context_path}/modules/acr/ACR610/acr_invoice_detail_readonly.lview"/>
liyuan.chen's avatar
liyuan.chen committed
14 15 16
        <a:link id="acr610_detail_submit_link" model="acr.ACR610.acr_invoice_apply_detail" modelaction="update"/>
        <a:link id="attachment_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="attachment_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
niminmin's avatar
niminmin committed
17 18
        <a:link id="${/parameter/@layout_code}_con_cashflow_wirte_off_detail_link"
                url="${/request/@context_path}/modules/acr/ACR610/con_cashflow_wirte_off_detail.lview"/>
19 20
        <script><![CDATA[

liyuan.chen's avatar
liyuan.chen committed
21 22
        function lock_current_detail_window() {
            Leaf.Masker.mask($('${/parameter/@winId}').wrap, '${l:HLS.EXECUTING}');
23 24
        }

liyuan.chen's avatar
liyuan.chen committed
25 26
        function unlock_current_detail_window() {
            Leaf.Masker.unmask($('${/parameter/@winId}').wrap);
27 28
        }

liyuan.chen's avatar
liyuan.chen committed
29 30
        function acr610_invoice_detail_exit() {
            $('${/parameter/@winId}').close();
31 32
        }

liyuan.chen's avatar
liyuan.chen committed
33 34
        function acr610_invoice_detail_query() {
            $('acr610_invoice_detail_result_ds').query();
35 36
        }

liyuan.chen's avatar
liyuan.chen committed
37 38
        function acr610_invoice_detail_reset() {
            $('acr610_invoice_detail_query_ds').reset();
39 40
        }

liyuan.chen's avatar
liyuan.chen committed
41
        function acr610_invoice_detail_submit() {
42
            Leaf.showConfirm('提示', '您确认提交吗', function () {
liyuan.chen's avatar
liyuan.chen committed
43
                lock_current_detail_window();
44
                Leaf.request({
liyuan.chen's avatar
liyuan.chen committed
45
                    url: $('acr610_detail_submit_link').getUrl(),
46
                    para: {
liyuan.chen's avatar
liyuan.chen committed
47
                        invoice_apply_id: '${/parameter/@invoice_apply_id}'
48 49 50 51 52 53
                    },
                    success: function () {
                        Leaf.SideBar.show({
                            msg: '提交成功',
                            duration: 3000
                        });
liyuan.chen's avatar
liyuan.chen committed
54 55
                        unlock_current_detail_window();
                        acr610_invoice_detail_exit();
56 57
                    },
                    failure: function () {
liyuan.chen's avatar
liyuan.chen committed
58
                        unlock_current_detail_window();
59 60
                    },
                    error: function () {
liyuan.chen's avatar
liyuan.chen committed
61
                        unlock_current_detail_window();
62 63 64 65 66 67
                    },
                    scope: this
                });
            });
        }

niminmin's avatar
niminmin committed
68 69
        function acr610_detail_grid_readonly(record_id, invoice_hd_wfl_id) {
            var currency_reocrd = $('acr610_invoice_detail_result_ds').findById(record_id);
liyuan.chen's avatar
liyuan.chen committed
70 71 72 73 74 75 76 77 78 79 80 81
            var param = currency_reocrd.data;
            param['winid'] = 'confirm_invoice_detail_win';
            param['document_id'] = invoice_hd_wfl_id;
            param['url_title'] = '${l:ACR.INVOICE_DETAIL}';
            param['function_code'] = 'ACR610R';
            param['function_usage'] = 'QUERY';
            param['maintain_type'] = 'READONLY';
            hls_doc_get_layout_code('acr_invoice_get_layout_code_link_id', param, 'acr610_invoice_detail_link');

        }

        function acr610_detail_upload_window(file_id) {
82
            if (file_id) {
liyuan.chen's avatar
liyuan.chen committed
83 84 85 86 87 88 89 90
                var url = $('attachment_uploadFile_id').getUrl() + '?table_name=ACR_INVOICE_APPLY&header_id=' + file_id;
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'acr_apply_cdd_attachtment_upload_id',
                    width: 850,
                    height: 400
                });
91
            } else {
liyuan.chen's avatar
liyuan.chen committed
92
                Leaf.showMessage('${l:HLS.PROMPT}', '无法上传,请联系管理员!');
93
            }
liyuan.chen's avatar
liyuan.chen committed
94
        }
95

liyuan.chen's avatar
liyuan.chen committed
96
        function acr610_detail_renderer(value, record, name) {
niminmin's avatar
niminmin committed
97
            debugger;
liyuan.chen's avatar
liyuan.chen committed
98
            if (name == 'document_number') {
99
                return '<a href="javascript:acr610_detail_grid_readonly(' + record.id + ',' + record.get('invoice_hd_wfl_id') + ');">' + value + '</a>';
100
            }
101
            if (name == 'attachment') {
102 103 104 105 106
                    if (record.get('invoice_kind') == '0') {
                        if (record.get('paid_byother_flag') == 'T') {
                            if (record.get('guarantor_name_duty') != 'Y' || record.get('guarantor_name_duty') == 'NULL') {
                                return '<a href="javascript:acr610_detail_upload_window(' + record.get('file_id') + ')">附件</a>';
                            }
niminmin's avatar
niminmin committed
107
                        }
108 109 110 111 112 113
                    } else if (record.get('invoice_kind') == '2') {
                        if (record.get('paid_byother_sum_flag') > 0) {
                            var current_record = $('acr610_invoice_detail_result_ds').getAt(0);
                            if (current_record.id == record.id) {
                                return '<a href="javascript:acr610_detail_upload_window(' + record.get('file_id') + ')">附件</a>';
                            }
niminmin's avatar
niminmin committed
114
                        }
115
                    }
liyuan.chen's avatar
liyuan.chen committed
116
            }
niminmin's avatar
niminmin committed
117 118 119 120 121 122 123 124 125
            if (name == 'received_amount') {
                debugger;
                if ((!Leaf.isEmpty(value) && value > 0)&&record.get('cf_item') != '9') {
                    return '<a href="javascript:csh_write_off_detail(' + record.id + ',' + record.get('invoice_hd_id') + ');">' + Leaf.formatMoney(value) + '</a>';
                } else {
                    return Leaf.formatMoney(value);
                }

            }
liyuan.chen's avatar
liyuan.chen committed
126 127 128 129

        }

        function acr610_detail_formatMoney(value, record, name) {
niminmin's avatar
niminmin committed
130
            return Leaf.formatMoney(value);
131 132
        }

133 134 135
        function sumFunction_foot(data, name) {
            if (name == 'journal_month') {
                return '<font color=red>' + '合计' + '</font>';
niminmin's avatar
niminmin committed
136
            } else if (name == 'total_amount' || name == 'net_amount' || name == 'tax_amount' || name == 'received_amount') {
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
                return colum_caculateTotal(data, name);
            }
        }

        function colum_caculateTotal(data, name) {
            var total = 0;
            var length = data.length;
            var value = 0;
            for (var i = 0; i < length; i++) {
                if (Ext.isEmpty(data[i].get(name))) {
                    value = 0;
                } else {
                    value = data[i].get(name);
                }
                total = plus(total, value);
            }
            return '<font color=red>' + Leaf.formatMoney(total) + '</font>';
        }

niminmin's avatar
niminmin committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
        function csh_write_off_detail(record_id, invoice_hd_id) {
            var url = $('${/parameter/@layout_code}_con_cashflow_wirte_off_detail_link').getUrl();
            var record = $('acr610_invoice_detail_result_ds').findById(record_id);
            if (record) {
                var win = new Leaf.Window({
                    id: 'acr610WFL_con_cashflow_wirte_off_detail_window',
                    url: url,
                    params: {
                        cashflow_id: record.get('cashflow_id'),
                        invoice_hd_id: invoice_hd_id,
                        winid: 'acr610WFL_con_cashflow_wirte_off_detail_window'
                    },
                    draggable: true,
                    fullScreen: true
                });
            }
        }

174 175 176
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        <a:dataSets>
liyuan.chen's avatar
liyuan.chen committed
177
            <a:dataSet id="acr610_ipaid_byother_flag_ds" lookupCode="PAID_BYOTHER_FLAG"/>
178 179 180
            <a:dataSet id="acr610_invoice_apply_basic_ds" autoQuery="true" fetchAll="true"
                       model="acr.ACR610.acr_invoice_apply_query"
                       queryUrl="${/request/@context_path}/autocrud/acr.ACR610.acr_invoice_apply_query/query?invoice_apply_id=${/parameter/@invoice_apply_id}">
liyuan.chen's avatar
liyuan.chen committed
181 182 183 184 185
                <a:fields>
                    <a:field name="invoice_apply_num"/>
                    <a:field name="invoice_apply_user_n"/>
                    <a:field name="invoice_apply_date"/>
                </a:fields>
186
            </a:dataSet>
liyuan.chen's avatar
liyuan.chen committed
187
            <a:dataSet id="acr610_invoice_detail_query_ds">
188
                <a:fields>
liyuan.chen's avatar
liyuan.chen committed
189 190 191
                    <a:field name="contract_number"/>
                    <a:field name="bp_code"/>
                    <a:field name="journal_month"/>
192 193
                    <a:field name="paid_byother_flag_n" displayField="code_value_name"
                             options="acr610_ipaid_byother_flag_ds"
liyuan.chen's avatar
liyuan.chen committed
194
                             returnField="paid_byother_flag" valueField="code_value"/>
195 196
                </a:fields>
            </a:dataSet>
197 198 199 200
            <a:dataSet id="acr610_invoice_detail_result_ds" autoQuery="true" fetchAll="true"
                       model="acr.ACR610.acr_invoice_apply_detail"
                       queryUrl="${/request/@context_path}/autocrud/acr.ACR610.acr_invoice_apply_detail/query?invoice_apply_id=${/parameter/@invoice_apply_id}"
                       queryDataSet="acr610_invoice_detail_query_ds"
liyuan.chen's avatar
liyuan.chen committed
201
                       selectable="false"/>
202 203 204 205
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
liyuan.chen's avatar
liyuan.chen committed
206 207 208 209
                <a:toolbarButton click="acr610_invoice_detail_exit" text="HLS.EXIT"/>
                <a:toolbarButton click="acr610_invoice_detail_query" text="HLS.QUERY"/>
                <a:toolbarButton click="acr610_invoice_detail_reset" text="HLS.RESET"/>
                <a:toolbarButton click="acr610_invoice_detail_submit" text="HLS.SUBMIT"/>
210
            </a:screenTopToolbar>
liyuan.chen's avatar
liyuan.chen committed
211
            <a:form marginWidth="200" padding="0" title="查询条件">
212
                <a:hBox labelSeparator=" ">
213 214
                    <a:textField name="contract_number" bindTarget="acr610_invoice_detail_query_ds" prompt="合同编号"
                                 width="135"/>
liyuan.chen's avatar
liyuan.chen committed
215
                    <a:textField name="bp_code" bindTarget="acr610_invoice_detail_query_ds" prompt="客户编号" width="135"/>
216 217 218 219
                    <a:textField name="journal_month" bindTarget="acr610_invoice_detail_query_ds" prompt="税款所属期"
                                 width="135" emptyText="YYYY-MM"/>
                    <a:comboBox name="paid_byother_flag_n" bindTarget="acr610_invoice_detail_query_ds" prompt="担保支付"
                                width="135"/>
220
                </a:hBox>
liyuan.chen's avatar
liyuan.chen committed
221 222
            </a:form>
            <a:form marginWidth="200" padding="0" title="基本信息">
223
                <a:hBox labelSeparator=" ">
224 225 226 227 228 229
                    <a:textField name="invoice_apply_num" bindTarget="acr610_invoice_apply_basic_ds" prompt="申请编号"
                                 width="135" readOnly="true"/>
                    <a:textField name="invoice_apply_user_n" bindTarget="acr610_invoice_apply_basic_ds" prompt="申请人"
                                 width="135" readOnly="true"/>
                    <a:textField name="invoice_apply_date" bindTarget="acr610_invoice_apply_basic_ds" prompt="申请时间"
                                 width="135" readOnly="true"/>
230 231
                </a:hBox>
            </a:form>
liyuan.chen's avatar
liyuan.chen committed
232
            <a:grid id="acr610_invoice_detail_grid_ds" bindTarget="acr610_invoice_detail_result_ds" marginHeight="250"
233 234
                    marginWidth="30" navBar="true">
                <a:columns>
235 236
                    <a:column name="document_number" lock="true" prompt="单据编号" align="center"
                              renderer="acr610_detail_renderer" width="120"/>
liyuan.chen's avatar
liyuan.chen committed
237 238 239 240
                    <a:column name="contract_number" prompt="合同编号" align="center" width="100"/>
                    <a:column name="bp_code" prompt="客户编号" align="center" width="100"/>
                    <a:column name="bp_name" prompt="客户名称" align="center" width="100"/>
                    <a:column name="times" prompt="租期" align="center" width="60"/>
241 242
                    <a:column name="journal_month" prompt="税款所属期" align="center" width="120"
                              footerRenderer="sumFunction_foot"/>
liyuan.chen's avatar
liyuan.chen committed
243
                    <a:column name="tax_type_rate" prompt="税率" align="right" width="60"/>
244 245 246 247 248 249
                    <a:column name="total_amount" prompt="开票金额" footerRenderer="sumFunction_foot"
                              renderer="acr610_detail_formatMoney" align="right" width="100"/>
                    <a:column name="net_amount" prompt="不含税金额" footerRenderer="sumFunction_foot"
                              renderer="acr610_detail_formatMoney" align="right" width="100"/>
                    <a:column name="tax_amount" prompt="税额" footerRenderer="sumFunction_foot"
                              renderer="acr610_detail_formatMoney" align="right" width="100"/>
liyuan.chen's avatar
liyuan.chen committed
250
                    <a:column name="paid_byother_flag_n" prompt="担保支付" align="center" width="100"/>
niminmin's avatar
niminmin committed
251 252 253
                    <a:column name="received_amount" prompt="核销金额" footerRenderer="sumFunction_foot"
                              renderer="acr610_detail_renderer" align="right" width="100"/>
                    <a:column name="write_off_max_date" prompt="核销日期" align="center" width="90"/>
liyuan.chen's avatar
liyuan.chen committed
254
                    <a:column name="journal_num" prompt="增值税凭证号" align="center" width="100"/>
255
                    <a:column name="guarantor_name_duty" prompt="担保人履行担保义务" hidden="true"/>
256 257
                    <a:column name="attachment" prompt="担保代付协议" align="center" width="100"
                              renderer="acr610_detail_renderer"/>
258 259 260 261 262
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>