acr_invoice_delivery.lview 16 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhuxianfei
    $Date: 2018-07-12 下午2:20:47
    $Revision: 1.0
    $Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="t1.function_code = ${/parameter/@function_code}"
                       model="acr.ACR519.default_function_name" rootPath="default_function_name"/>
        <a:model-query model="acr.ACR519.acr_delivery_import_batch_id" rootPath="batch_id"/>
    </a:init-procedure>
    <a:view>
        <a:link id="acr_invoice_delivery_save_link" model="acr.ACR519.acr_invoice_delivery_grid"
                modelaction="batch_update"/>
        <a:link id="acr_delivery_upload_link"
                url="${/request/@context_path}/modules/acr/ACR519/acr_delivery_import.lview"/>
        <a:link id="invoice_attachment_uploadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <script type="text/javascript"><![CDATA[
        function acr_invoice_delivery_ds_query() {
            $('acr_invoice_delivery_ds').query();
        }

        function acr_invoice_delivery_query_ds_reset() {
            $('acr_invoice_delivery_query_ds').reset();
        }

        function acr_invoice_delivery_ds_submit() {
            var records = $('acr_invoice_delivery_ds').getSelected();
            for (i = 0; i < records.length; i++) {
                records[i].set('express_status', 'TRANSFERRED');
                records[i].set('_status', 'update');
            }
            $('acr_invoice_delivery_ds').submit();
            $('acr_invoice_delivery_ds').query();
        }

        function acr_invoice_delivery_ds_hand() {
            var records = $('acr_invoice_delivery_ds').getSelected();
            for (i = 0; i < records.length; i++) {
                records[i].set('express_status', 'RECEIVED');
                records[i].set('_status', 'update');
            }
            $('acr_invoice_delivery_ds').submit();
            $('acr_invoice_delivery_ds').query();
        }

        function acr_invoice_delivery_ds_send() {
            var records = $('acr_invoice_delivery_ds').getSelected();
            for (i = 0; i < records.length; i++) {
                records[i].set('express_status', 'SEND_OFF');
                records[i].set('_status', 'update');
            }
            $('acr_invoice_delivery_ds').submit();
            $('acr_invoice_delivery_ds').query();
        }

        function acr_invoice_delivery_ds_export() {
            $('acr_invoice_grid')._export('xlsx', '${/model/default_function_name/record/@function_name}');
        }

        function acr_invoice_delivery_ds_save() {

            var records = $('acr_invoice_delivery_ds').getSelected();
            if (records.length == 0) {
                Leaf.showMessage('${l:PROMPT}', '请至少选择一条数据进行保存!');
                return;
            }
            var post_data = [];
            for (var i = 0; i < records.length; i++) {
                post_data.push({
                    'transfer_time': records[i].get('transfer_time'),
                    'recipient': records[i].get('recipient'),
                    'express_date': records[i].get('express_date'),
                    'express_num': records[i].get('express_num'),
                    'express_to': records[i].get('express_to'),
                    'invoice_hd_id': records[i].get('invoice_hd_id'),
                    '_status': 'update'
                });
            }
            Leaf.request({
                url: $('acr_invoice_delivery_save_link').getUrl(),
                para: post_data,
                success: function () {
                    $('acr_invoice_delivery_ds').query();
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    //Leaf.showMessage('${l:PROMPT}', '保存成功!');
                }, failure: function () {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                },
                error: function () {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                },
                scope: this
            });
        }

        /*
         function load_handle_func() {

         var query_ds = $('acr_invoice_delivery_ds');
         var contract_id = '${/parameter/@contract_id}';
         query_ds.setQueryParameter('contract_id', contract_id);
         query_ds.query();
         }
         */


        function acr_invoice_delivery_ds_import() {
            var win = new Leaf.Window({
                id: 'acr_delivery_upload_link_winId',
                url: $('acr_delivery_upload_link').getUrl(),
                params: {
                    batch_id: '${/model/batch_id/record/@batch_id}',
                    group_code:'REPAYMENT',
                    winId: 'acr_delivery_upload_link_winId'
                },
                title: '交接单导入',
                fullScreen: true,
                draggable: true
            });
            win.on('close', function () {
                $('contract_doc_result_ds').query();
            });
        }
        function acr_invoice_delivery_ds_import_2() {
            var win = new Leaf.Window({
                id: 'acr_delivery_upload_link_winId',
                url: $('acr_delivery_upload_link').getUrl(),
                params: {
                    batch_id: '${/model/batch_id/record/@batch_id}',
                    group_code:'TAX',
                    winId: 'acr_delivery_upload_link_winId'
                },
                title: '交接单导入',
                fullScreen: true,
                draggable: true
            });
            win.on('close', function () {
                $('contract_doc_result_ds').query();
            });
        }

        //pdf附件
        function downloadPdf(val, rec, name) {
            if (rec.get('ele_invoice_status') == 'DOWNLOAD') {
                return '<a href=javascript:detail_upload_window(' + rec.get('ele_invoice_hd_id') + ')>pdf附件</a>';
            }
        }

        function detail_upload_window(id) {
            var url = $('invoice_attachment_uploadFile_id').getUrl() + '?table_name=ACR_ELE_INVOICE_HD&header_id=' + id;
            var win = new Leaf.Window({
                url: url,
                title: '${l:HLS.SUPPORTING_DOCUMENT}',
                id: 'invoice_attachment_uploadFile_id_win',
                width: 850,
                height: 400
            });
            win.on('close', function () {
            });
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="express_status_ds" lookupCode="ACR520_EXPESS_STATUS"/>
            <a:dataSet id="division_name_ds" loadData="true" model="basic.hls_division_for_lov"/>
            <a:dataSet id="billing_way_ds" lookupCode="DS_INVOICE_CATEGORY"/>
            <a:dataSet id="acr_invoice_delivery_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_number"/>
                    <a:field name="product_name"/>
                    <a:field name="division_n" displayField="description" options="division_name_ds"
                             returnField="division" valueField="division"/>
                    <a:field name="billing_way_n" displayField="code_value_name" options="billing_way_ds"
                                                 returnField="billing_way" valueField="code_value"/>
                    <a:field name="__async__"  defaultValue="Y" prompt="异步导出"/>
                </a:fields>


            </a:dataSet>
            <a:dataSet id="acr_invoice_delivery_ds" autoPageSize="true" autoQuery="false"
                       model="acr.ACR519.acr_invoice_delivery" queryDataSet="acr_invoice_delivery_query_ds"
                       queryUrl="${/request/@context_path}/autocrud/acr.ACR519.acr_invoice_delivery/query?contract_id=${/parameter/@contract_id}"
                       selectable="true"
                       submitUrl="${/request/@context_path}/autocrud/acr.ACR519.acr_invoice_delivery/batch_update">
                <a:fields>
                    <a:field name="invoice_hd_id"/>
                    <a:field name="description_l"/>
                    <a:field name="express_status"/>
                    <a:field name="express_status_n" displayField="code_value_name" options="express_status_ds"
                             returnField="express_status" valueField="code_value"/>
                    <a:field name="transfer_time"/>
                    <a:field name="recipient"/>
                    <a:field name="express_date"/>
                    <a:field name="express_num"/>
                    <a:field name="express_to"/>
                </a:fields>
                <a:events>
                    <a:event name="submit" handler="acr_invoice_delivery_ds_query"/>
                    <!--<a:event name="load" handler="load_handle_func"/>-->
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="acr_invoice_delivery_ds_query" text="HAP_QUERY"/>
                <a:gridButton click="acr_invoice_delivery_query_ds_reset" text="HLS.RESET"/>
                <a:gridButton click="acr_invoice_delivery_ds_export" text="导出"/>
                <a:gridButton click="acr_invoice_delivery_ds_save" text="保存"/>
                <a:gridButton click="acr_invoice_delivery_ds_submit" text="已转交"/>
                <a:gridButton click="acr_invoice_delivery_ds_hand" text="已接收"/>
                <a:gridButton click="acr_invoice_delivery_ds_send" text="已邮寄"/>
                <a:gridButton click="acr_invoice_delivery_ds_import" text="交接单导入-收款组"/>
                <a:gridButton click="acr_invoice_delivery_ds_import_2" text="交接单导入-税务组"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="130" labelwidth="150" title="销项发票交接">

                <!--  <a:textField name="invoice_number" bindTarget="acr_invoice_delivery_query_ds"
                               prompt="ACR.INVOICE_NUMBER"/>-->

                <a:textField name="invoice_number_from" bindTarget="acr_invoice_delivery_query_ds"
                             prompt="发票号码从"/>
                <a:textField name="invoice_number_to" bindTarget="acr_invoice_delivery_query_ds"
                             prompt="TO"/>
                <a:datePicker name="invoice_date_from" bindTarget="acr_invoice_delivery_query_ds"
                              prompt="ACR519.INVOICE_DATE_FROM"/>
                <a:datePicker name="invoice_date_to" bindTarget="acr_invoice_delivery_query_ds"
                              prompt="TO"/>
                <a:textField name="contract_number" bindTarget="acr_invoice_delivery_query_ds" prompt="合同编号"/>
                <a:textField name="bp_name" bindTarget="acr_invoice_delivery_query_ds" prompt="HLS.CUSTOMER_NAME"/>
                <!-- <a:textField name="product_name" bindTarget="acr_invoice_delivery_query_ds" prompt="货物名称"/>-->
                <!-- <a:numberField name="times" allowDecimals="false" bindTarget="acr_invoice_delivery_query_ds" prompt="HLS.TIMES"/> -->
                <!-- <a:numberField name="total_amount" bindTarget="acr_invoice_delivery_query_ds"
                                prompt="ACR.TOTAL_AMOUNT"/>-->
                <a:comboBox name="division_n" bindTarget="acr_invoice_delivery_query_ds" prompt="产品线"/>
                <a:datePicker name="transfer_time" bindTarget="acr_invoice_delivery_query_ds"
                              prompt="转交时间"/>
                <a:textField name="bp_agent_name"  bindTarget="acr_invoice_delivery_query_ds" prompt="代理商" />

                <a:datePicker name="express_date"  bindTarget="acr_invoice_delivery_query_ds" prompt="邮寄时间" />

                <a:textField name="express_num"  bindTarget="acr_invoice_delivery_query_ds" prompt="快递单号" />

                <a:textField name="pattern"  bindTarget="acr_invoice_delivery_query_ds" prompt="机型" />

                <a:textField name="machine_number"  bindTarget="acr_invoice_delivery_query_ds" prompt="机号" />

                <a:comboBox name="billing_way_n" bindTarget="acr_invoice_delivery_query_ds" prompt="发票类型"/>

            </a:form>
            <a:grid id="acr_invoice_grid" bindTarget="acr_invoice_delivery_ds" marginHeight="215" marginWidth="50"
                    navBar="true">
                <a:columns>
                    <a:column name="contract_number" prompt="合同编号" width="150" align="center"/>
                    <a:column name="bp_agent_name" prompt="代理商" width="100"/>
                    <a:column name="billing_way_n" prompt="发票类型" width="100"/>
                    <a:column name="invoice_number" prompt="ACR.INVOICE_NUMBER" align="center" width="150"/>
                    <a:column name="vat_invoice_code" prompt="发票代码" align="center" width="150"/>
                    <a:column name="cf_item_n" prompt="现金流描述" align="center" width="150"/>
                    <a:column name="division_n" prompt="产品线" width="80" align="center"/>
                    <a:column name="machine_number" prompt="机号" width="100" align="center"/>
                    <a:column name="invoice_date" prompt="ACR521.INVOICE_DATE" align="center" width="100"/>
                    <a:column name="bp_name" align="center" prompt="HLS.CUSTOMER_NAME" width="180"/>
                    <!-- <a:column name="product_name" align="center" prompt="货物名称" width="200"/>-->
                    <!--  <a:column name="times" align="center" prompt="ACR521.TENANCY_TERM" width="60"/>-->
                    <a:column name="total_amount" align="right" prompt="HLS.AMOUNT" renderer="Leaf.formatMoney"
                              width="100"/>
                    <a:column name="invoice_title" prompt="发票抬头"/>
                    <a:column name="invoice_kind_n" align="center" prompt="发票种类" width="120"/>
                    <a:column name="transfer_time" renderer="Leaf.formatDate" editor="datePicker_e" align="center"
                              prompt="已转交时间" width="100"/>
                    <a:column name="recipient" editor="textField_e" align="center" prompt="已签收人" width="100"/>
                    <a:column name="express_date" renderer="Leaf.formatDate" editor="datePicker_e" align="center"
                              prompt="已邮寄时间" width="100"/>
                    <a:column name="express_num" editor="textField_e" align="center" prompt="邮寄快递单号" width="100"/>
                    <a:column name="express_to" editor="textField_e" align="center" prompt="接收人" width="100"/>
                    <!-- <a:column  name="description_l"  editor="textArea_e"  prompt="备注" width="400"    /> -->
                    <a:column name="pattern" align="center" prompt="机型" width="100"/>
                    <a:column name="machine_number" align="center" prompt="机号" width="100"/>
                    <a:column name="express_status_n" align="center" prompt="状态" width="100"/>
                    <a:column name="download" prompt="电子发票下载" renderer="downloadPdf" align="center"/>
                </a:columns>
                <a:editors>
                    <a:textArea id="textArea_e"/>
                    <a:datePicker id="datePicker_e"/>
                    <a:textField id="textField_e"/>
                </a:editors>
            </a:grid>

            <script type="text/javascript"><![CDATA[

            /*  Leaf.onReady(init);
              function init() {
                  var skip_flag = '${/parameter/@skip_flag}';
                  if (skip_flag = 'Y') {
                      var query_ds = $('acr_invoice_delivery_ds');
                      var contract_id = '${/parameter/@contract_id}';
                      query_ds.setQueryParameter('contract_id', contract_id);
                      query_ds.query();
                  }
              }*/

            ]]></script>
        </a:screenBody>
    </a:view>
</a:screen>