csh_write_off_date.lview 3.01 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
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <script type="text/javascript"><![CDATA[
			function csh513_confirm_write(){
			    if (!$('csh513_write_off_date_ds').validate()){
			        return;
			    }
			    var write_off_date = $('csh513_write_off_date_ds').getAt(0).get('write_off_date');
			    write_off_date = Leaf.formatDate(write_off_date);
			    var records = $('csh_transaction_receipt_write_off_result_ds').getSelected();
			    var submitData = [];
                var new_data ={};
                for (var i = 0;i < records.length;i++) {
            		new_data={'_status'		 :'insert',
            		         'transaction_id':records[i].get('transaction_id'),
            		         'write_off_date':write_off_date,
            		         'session_id':'${/session/@session_id}'};
                    submitData.push(new_data);
                }
                var url;
                if ('${/parameter/@type}'=='pre'){
                    url = $('csh513_write_off_pre_link').getUrl();
                }else if('${/parameter/@type}'=='auto'){
                    url = $('csh513_auto_write_off_link').getUrl();
                }else if('${/parameter/@type}'=='pre_reverse'){
                    url = $('csh513_pre_reverse_link').getUrl();
                }
                Leaf.showConfirm('${l:PROMPT}', '确定?', function() {
                    var detail_mask = Ext.getBody();
                    Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                    Leaf.request({
                        url: url+'?write_off_date='+write_off_date,
                        para: submitData,
                        success: function() {
                            Leaf.SideBar.show({
                                msg: '操作成功',
                                duration: 2000
                            });
                            Leaf.Masker.unmask(detail_mask);
                            $('csh513_set_write_off_date_link_winid').close();
                            $('csh_transaction_receipt_write_off_result_ds').query();
                        },
                        error: function(){
                            $('csh513_set_write_off_date_link_winid').close();
                            Leaf.Masker.unmask(detail_mask);
                        },
                        failure: function(){
                            $('csh513_set_write_off_date_link_winid').close();
                           Leaf.Masker.unmask(detail_mask);
                        },
                        scope: this
                    });
                }, function() {
                    return;
                }, null, null);
			}
		]]></script>
        <a:screenTopToolbar>
            <a:gridButton click="csh513_confirm_write" text="确认"/>
        </a:screenTopToolbar>
        <a:form>
            <a:datePicker name="write_off_date" bindTarget="csh513_write_off_date_ds" prompt="核销日期" width="90"/>
        </a:form>
    </a:view>
</a:screen>