inv_payment_detail.lview 5.51 KB
Newer Older
38823's avatar
38823 committed
1 2 3 4 5 6 7 8 9 10 11 12 13
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: 38823
    $Date: 2023-12-21
    $Revision: 1.0
    $purpose: 付款凭证审批明细
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script"
          customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
    </a:init-procedure>
    <a:view>
        <a:link id="save_detail_link" model="inv.inv100.payment_detail_save" modelaction="update"/>
18083's avatar
18083 committed
14 15
        <a:link id="journal_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="journal_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
38823's avatar
38823 committed
16
        <script type="text/javascript"><![CDATA[
38823's avatar
38823 committed
17 18 19 20 21 22 23 24 25 26 27
        $L.onReady(function(){
            debugger;
            if("${/parameter/@function_usage}"=='QUERY'){
                if(document.getElementById('${/parameter/@layout_code}_user_button1')){
                    document.getElementById("${/parameter/@layout_code}_user_button1").style.display = "none";
                }
                if(document.getElementById('${/parameter/@layout_code}_exit')){
                    document.getElementById("${/parameter/@layout_code}_exit").style.display = "none";
                }
            }
        });
38823's avatar
38823 committed
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
        //自定义保存
        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            debugger;
            var ds_id =get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_journal_header');
            var record = $(ds_id).getCurrentRecord();
            var invoiceSeries = record.get('invoice_series');
            Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
            Leaf.request({
                url: $('save_detail_link').getUrl(),
                para: {
                    payment_journal_id: "${/parameter/@payment_journal_id}",
                    invoice_series: invoiceSeries
                },
                success: function(res) {
                    Leaf.SideBar.show({
                        msg: '${l:HLS.SUBMIT_SUCCESS}',
                        duration: 2000
                    });
                    Leaf.Masker.unmask(Ext.getBody());
                },
                failure: function() {
                    Leaf.Masker.unmask(Ext.getBody());
                },
                error: function() {
                    Leaf.Masker.unmask(Ext.getBody());
                },
                scope: this
            });
        };
18083's avatar
18083 committed
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

          function upload_voucher_file(id,name,record_id,item_code) {
                 var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                if (item_code=='INVOICE') {
                 var url = $('journal_uploadFile_id').getUrl() + '?table_name=INVOICE&header_id=' + record_id;
                }else if(item_code=='PAYMENT_REQUEST_LETTER'){
                 var url = $('journal_uploadFile_id').getUrl() + '?table_name=PAYMENT_REQUEST_LETTER&header_id=' + record_id;
                }else if(item_code=='OTHERS'){
                 var url = $('journal_uploadFile_id').getUrl() + '?table_name=OTHERS&header_id=' + record_id;
               }else if(item_code=='PAYMENT_APPROVAL_PROCESS'){
                 var url = $('journal_uploadFile_id').getUrl() + '?table_name=PAYMENT_APPROVAL_PROCESS&header_id=' + record_id;
               }else if(item_code=='SBO_JOURNAL_PDF'){
                var url = $('journal_uploadFile_id').getUrl() + '?table_name=SBO_JOURNAL_PDF&header_id=' + record_id;
            }
                 var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'csh_attachment_uploadFile_id',
                    width: 850,
                    height: 400
                    });
                  win.on('close', function () {
                    record.ds.query();
                });

            }

         window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) {
             window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
             if (name == 'attachment'){
               return '<a href=javascript:upload_voucher_file(\''+record.id+'\',\''+ name + '\',\'' +record.get('journal_header_id')+'\',\'' + record.get('item_code')+'\')>附件上传</a>';
             } else if (name == 'attach_file_name') {
              if (value != null) {
             var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
             var str = value.split(';;');
             var url = '';
             for (var i = 0; i < str.length; i++) {
                 var temp = str[i].split('--');
                 if (!Leaf.isEmpty(temp[0])) {
                     var file_name = temp[0].toUpperCase();
                     var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
18083's avatar
18083 committed
98
                    if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
18083's avatar
18083 committed
99 100 101 102 103 104 105 106 107 108 109 110
                         url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
                     } else {
                         url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                     }
                 }
             }
             return url;

         }

            }
                };
38823's avatar
38823 committed
111 112 113 114
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>