sdic_acr_invoice_query.lview 14.5 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-11-16 上午9:15:56  
    $Revision: 1.0  
    $Purpose: 待开票查询
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query model="sdic.SDIC001.acr_due_date" rootPath="due_date"/>
    </a:init-procedure>
    <a:view>
        <a:link id="sdic_acr_invoice_pre_query_id" model="sdic.SDIC001.sdic_acr_invoice" modelaction="update"/>
        <a:link id="acr_invoice_info_upload_link_id" url="${/request/@context_path}/modules/sdic/SDIC001/acr_invoice_info_upload.lview"/>
        <a:link id="acr_invoce_line_maintain_lin_id" url="${/request/@context_path}/modules/sdic/SDIC001/sdic_acr_invoice_line_detail.lview"/>
        <a:link id="sdic_acr_invoice_check_report_id" model="sdic.SDIC001.sdic_acr_invoice" modelaction="execute"/>
        <a:link id="hn_acr_invoice_info_print_link_id" url="${/request/@context_path}/modules/sdic/SDIC001/hn_acr_invoice_info_print.lview"/>
        <script type="text/javascript"><![CDATA[
             function acr_invoice_confirm_export(){
    	        $('sdic_acr_invoice_grid')._export();
    	    }
            
			function acr_invoice_info_query(){
			    Leaf.Masker.mask($('sdic_acr_invoice_grid').wrap, '${l:HLS.SAVING}');
			           Leaf.request({
                        url: $('sdic_acr_invoice_pre_query_id').getUrl(),
                        //para: saveData,
                        success: function(res) {
                           Leaf.Masker.unmask ($('sdic_acr_invoice_grid' ).wrap);
                           $('acr_invoice_info_ds').query();
                         
                        },
                        failure: function() {
                             Leaf.Masker.unmask ($('sdic_acr_invoice_grid' ).wrap);
                        },
                        error: function() {
                             Leaf.Masker.unmask ($('sdic_acr_invoice_grid' ).wrap);
                        },
                        scope: this
                    });
			    
			}
			
			 function percentRender(value, record, name) {
              if(!Ext.isEmpty(value)){
                return Leaf.formatMoney(mul(100,value))+'%';
              }
            }
            
            function acr_invoice_confirm_import(){
                var url_l = $('acr_invoice_info_upload_link_id').getUrl();
                 var win = new Leaf.Window({
                        id: 'acr_invoice_info_handle_win',
                        url: url_l,
                        params: {
                            'winid': 'acr_invoice_info_handle_win',
                            'session_id': '${/session/@session_id}',
                            'parent_ds_id': 'acr_invoice_info_ds'
                        },
                        title: '发票清单导入',
                        width: 630,
                        height: 290
                    });
                    win.on('close', function() {
                        $('acr_invoice_info_ds').query();
                    });
            }
            
            function winOpen_acr_line(record_id){
                 var record = $('acr_invoice_info_ds').findById(record_id);
                if (record.get('invoice_id')) {
                    var url;
                       url = $('acr_invoce_line_maintain_lin_id').getUrl() ;
                    var win = new Leaf.Window({
                        url: url,
                        params:{
                           invoice_id: record.get('invoice_id'),
                           winid:'acr_invoce_line_maintain_line_win_id'
                        },
                        title: '发票明细',
                        id: 'acr_invoce_line_maintain_line_win_id',
                        width: 1050,
                        height: 500
                    });
            
                    win.on('close', function() {
                        $('acr_invoice_info_ds').query();
                    });
                }
            }
            
            function update_acr_line(value, record, name){
                 if (!record.isNew) {
                    return '<a href="javascript:winOpen_acr_line(\'' + record.id + '\')">' + '发票录入' + '</a>';
                }
            }
            
            function invoiceSumInfo(data,name){
                if (name == 'tax_registry_num') {
                         return '<font color=red>' +'合计:'+ '</font>'; 
                   }else if (name == 'net_due_amount'){
                         return colum_caculateTotal(data,name); 
                   }else if(name == 'vat_due_amount'){
                         return colum_caculateTotal(data,name); 
                   }else if(name == 'due_amount'){
                         return colum_caculateTotal(data,name); 
                   }else if(name=='price'){
                         return colum_caculateTotal(data,name); 
                   }else if(name=='done_invoice_amount'){
                         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>';
                
            }
            
            function acr_invoice_word_print(){
                var records=$('acr_invoice_info_ds').getSelected();
                var invoice_id_str='';
                if(records.length<1){
                     Leaf.showMessage('提示', '请选择要打印的单据!');
                     return;
                }
                for (var i=0;i<records.length;i++){
                    if(i==0){
                         invoice_id_str=invoice_id_str+records[i].get('invoice_id');
                         
                    }else{
                        invoice_id_str=invoice_id_str+','+records[i].get('invoice_id');
                    }
                }
                Leaf.Masker.mask(Ext.getBody(), '正在执行...');
                Leaf.request({
                        url: $('sdic_acr_invoice_check_report_id').getUrl(),
                        para: {
                            'invoice_id_str':invoice_id_str
                        },
                        success: function(res) {
                           //Leaf.Masker.unmask(Ext.getBody());
                           var templt_name = 'hntc_acr_invoce_info_booking_report.xml';
                            var url = $('hn_acr_invoice_info_print_link_id').getUrl() + '?templt_name=' + templt_name+'&invoice_id_str='+invoice_id_str;
                            var form = document.createElement("form");
                            form.target = "word_export_window";
                            form.method = "post";
                            form.action = url;
                            var iframe = Ext.get('word_export_window') || new Ext.Template('<iframe id ="word_export_window" name="word_export_window" style="position:absolute;left:-10000px;top:-10000px;width:1px;height:1px;display:none"></iframe>').insertFirst(document.body, {}, true);
                            document.body.appendChild(form);
                            form.submit();
                            Ext.fly(form).remove();
                            Leaf.Masker.unmask(Ext.getBody());
         
                        },
                        failure: function() {
                             Leaf.Masker.unmask (Ext.getBody());
                        },
                        error: function() {
                             Leaf.Masker.unmask (Ext.getBody());
                        },
                        scope: this
                    });
            }
		]]></script>
        <a:dataSets>
            <a:dataSet id="yes_no_ds" lookupCode="YES_NO"/>
            <a:dataSet id="vat_type_ds" lookupCode="ACR_INVOICE_VAT_TYPE"/>
            <a:dataSet id="query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="virtual_con_number"/>
                    <a:field name="document_number"/>
                    <a:field name="invoice_number"/>
                    <a:field name="invoice_bp_bank_account"/>
                    <a:field name="invoice_date_from"/>
                    <a:field name="invoice_date_to"/>
                    <a:field name="import_flag"/>
                    <a:field name="done_flag"/>
                    <a:field name="bp_name"/>
                    <a:field name="vat_type"/>
                    <a:field name="due_date_from" defaultValue="${/model/due_date/record/@due_date_from}"/>
                    <a:field name="due_date_to" defaultValue="${/model/due_date/record/@due_date_to}"/>
                    <a:field name="import_flag_desc" displayField="code_value_name" options="yes_no_ds" returnField="import_flag" valueField="code_value"/>
                    <a:field name="vat_type_desc" displayField="code_value_name" options="vat_type_ds" returnField="vat_type" valueField="code_value"/>
                    <a:field name="done_flag_desc" displayField="code_value_name" options="yes_no_ds" returnField="done_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="acr_invoice_info_ds" autoPageSize="true" autoQuery="true" model="sdic.SDIC001.sdic_acr_invoice" queryDataSet="query_ds" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="invoice_date" datatype="java.util.Date"/>
                    <a:field name="due_date" datatype="java.util.Date"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="acr_invoice_info_query" text="HLS.QUERY"/>
                <a:gridButton click="acr_invoice_confirm_export" text="导出"/>
                <a:gridButton click="acr_invoice_word_print" text="开票信息委托单打印"/>
                <!-- <a:gridButton click="acr_invoice_confirm_import" text="导入"/> -->
            </a:screenTopToolbar>
            <a:form bindTarget="query_ds" column="4" marginWidth="50" title="查询条件">
                <a:textField name="document_number" bindTarget="query_ds" prompt="单据编号"/>
                <a:textField name="virtual_con_number" bindTarget="query_ds" prompt="合同号"/>
                <a:textField name="bp_name" bindTarget="query_ds" prompt="购货单位"/>
                <a:textField name="invoice_number" bindTarget="query_ds" prompt="发票号"/>
                <a:textField name="invoice_bp_bank_account" bindTarget="query_ds" prompt="账号"/>
                <a:datePicker name="due_date_from" bindTarget="query_ds" prompt="应付日期从"/>
                <a:datePicker name="due_date_to" bindTarget="query_ds" prompt="应付日期到"/>
                <!-- <a:comboBox name="import_flag_desc" bindTarget="query_ds" prompt="是否已导入"/> -->
                <a:comboBox name="vat_type_desc" bindTarget="query_ds" prompt="税种"/>
                <a:comboBox name="done_flag_desc" bindTarget="query_ds" prompt="是否完成"/>
            </a:form>
            <a:grid id="sdic_acr_invoice_grid" bindTarget="acr_invoice_info_ds" marginHeight="200" marginWidth="50" navBar="true">
                <a:columns>
                    <a:column name="document_number" lock="true" prompt="单据编号"/>
                    <a:column name="virtual_con_number" lock="true" prompt="合同编号" width="150"/>
                    <a:column name="bp_name" lock="true" prompt="购货单位" width="180"/>
                    <a:column name="due_date" align="center" lock="true" prompt="应付日期" renderer="Leaf.formatDate"/>
                    <a:column name="tax_registry_num" prompt="纳税人识别号" width="120"/>
                    <a:column name="invoice_bp_address_phone_num" prompt="地址" width="180"/>
                    <a:column name="invoice_phone_number" prompt="电话"/>
                    <a:column name="invoice_bank" prompt="开户行"/>
                    <a:column name="invoice_bp_bank_account" prompt="账号" width="130"/>
                    <a:column name="cf_item_desc" prompt="货物或应税劳务名称" width="130"/>
                    <a:column name="specification" align="center" prompt="规格型号" width="80"/>
                    <a:column name="uom" align="center" prompt="单位" width="80"/>
                    <a:column name="quantity" align="center" prompt="数量" width="80"/>
                    <a:column name="price" align="right" footerRenderer="invoiceSumInfo" prompt="单价" renderer="Leaf.formatMoney"/>
                    <a:column name="net_due_amount" align="right" footerRenderer="invoiceSumInfo" prompt="金额" renderer="Leaf.formatMoney"/>
                    <!-- <a:column name="vat_type_desc" align="center" prompt="税种" width="80"/> -->
                    <a:column name="invoice_kind_des" align="center" prompt="发票种类" width="120"/>
                    <a:column name="vat_rate" prompt="税率" renderer="percentRender"/>
                    <a:column name="vat_due_amount" align="right" footerRenderer="invoiceSumInfo" prompt="税额" renderer="Leaf.formatMoney"/>
                    <a:column name="due_amount" align="right" footerRenderer="invoiceSumInfo" prompt="价税合计" renderer="Leaf.formatMoney"/>
                    <a:column name="done_invoice_amount" align="right" footerRenderer="invoiceSumInfo" prompt="已开发票合计" renderer="Leaf.formatMoney"/>
                    <!--  <a:column name="times" align="center" prompt="期数"/> -->
                    <a:column name="billing_times" prompt="已开票期数" width="100"/>
                    <a:column name="billing_amount" align="right" prompt="已开票金额" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="not_billing_times" prompt="未开票期数" width="120"/>
                    <a:column name="not_billing_amount" align="right" prompt="未开票金额" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="line_detail" align="center" prompt="发票录入" renderer="update_acr_line"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>