﻿//--------------------------------------------------------------------------CapitalGridinit
var dsCapital;
var SouthCapitalForm;
//查资金
function QueryCapitalGridinit()
{
//查可开数量
   var formReader=new Ext.data.JsonReader({},[
                   {name:'TradingDay',type:'string'},
                   {name:'AccountID',type:'string'},
                   {name:'dangQianQuanYi',type:'float'},
                   {name:'Available',type:'float'},
                   {name:'WithdrawQuota',type:'float'},   
                   {name:'CloseProfit',type:'float'},
                   {name:'PositionProfit',type:'float'},   
                   {name:'Commission',type:'float'},
                   {name:'CurrMargin',type:'float'},
                   {name:'FrozenCash',type:'float'},
                   {name:'FrozenMargin',type:'float'},
                   {name:'FrozenCommission',type:'float'}
                   ,{name:'Deposit',type:'float'}  
                   ,{name:'Withdraw',type:'float'}  
                   ,{name:'CashIn',type:'float'}  
                   ,{name:'PreDeposit',type:'float'}  
                   ,{name:'Reserve',type:'float'}  
                   ,{name:'Credit',type:'float'}  
                   ,{name:'Mortgage',type:'float'}  
                   ]);
                   
 dsCapital = new Ext.data.Store({
    proxy:new Ext.data.HttpProxy({url:'QueryData/QueryCapital.aspx',timeout:300000//五分钟 
    }),
    reader:formReader
    });   
    
    SouthCapitalForm = new Ext.form.FormPanel({
            layout:'column',
            labelAlign: 'left',
            title: 'form',
            split: true,//添加分割线是否可以改变该panel的大小

		    minSize: 40,//设置拖动的最小拖动值

    	    maxSize: 800,//设置拖动的最大拖动值

		    collapsible:true,//是否让panel能自动缩放
		    collapseMode:'mini',//在分割线处出现按钮
            labelWidth: 100,
            border:0,
            frame:true,
            header:false,
             width: 420,//Ext.lib.Dom.getViewportWidth()*2/5,
            autoScroll:true,
            region: 'west',
            layoutConfig:{
                columns:2
                //columnWidth :400
              },
           // reader:formReader,
            //url:'QueryData/QueryCapital.aspx',

            items: [  
                         //item1
                        {
                            columnWidth:.5,
                            height:300,
                            border:0,
                            layout:'form',
                            items:[
                                        {   xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '交易日',
                                            id:'TradingDay',
                                            width:100
                                            ,readOnly:true
                                      }
                                      ,{    xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '当前权益',
                                            id:'dangQianQuanYi'
                                            //,decimalPrecision:2
                                            ,width:100
                                            ,readOnly:true
                                      }
                                      ,{    xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '可用资金'
                                            //,decimalPrecision:2
                                            ,id:'Available',
                                            width:100
                                            ,readOnly:true
                                      }
                                      ,{    xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '平仓盈亏',
                                            id:'CloseProfit'
                                            //,decimalPrecision:2
                                            ,width:100
                                            ,readOnly:true
                                      }
                                      ,{    xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '手续费',
                                            id:'Commission',
                                            width:100
                                            //,decimalPrecision:2
                                            ,readOnly:true
                                       }
                                       ,{   xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '当前保证金总额',
                                            id:'CurrMargin',
                                            width:100
                                            //,decimalPrecision:2
                                            ,readOnly:true
                                        }   
                                       ,{   xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '冻结保证金',
                                            id:'FrozenMargin',
                                            width:100
                                            //,decimalPrecision:2
                                            ,readOnly:true
                                        }
                                       ,{   xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '入金金额',
                                            id:'Deposit',
                                            width:100
                                            //,decimalPrecision:2
                                            ,readOnly:true
                                        }
                                        ,{  xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '资金差额',
                                            id:'CashIn',
                                            width:100
                                            //,decimalPrecision:2
                                            ,readOnly:true
                                        }   
                                        ,{  xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '上次存款额',
                                            id:'PreDeposit',
                                            width:100
                                            //,decimalPrecision:2
                                            ,readOnly:true
                                        }       
                                       ,{   xtype:"textfield",
                                            triggerAction: 'all',
                                            fieldLabel: '信用额度',
                                            id:'Credit',
                                            width:100
                                            //,decimalPrecision:2
                                            ,readOnly:true
                                        }         
                                      ]                
                             },
                              //item2
                                {   columnWidth:.5,
                                     height:300,
                                    layout:'form',
                                    defaultType:'textfield',
                                    border:0,
                                    items:[  
                                             {  xtype:"textfield",
                                                triggerAction: 'all',
                                                fieldLabel: '投资者账号',
                                                id:'AccountID',
                                                width:100
                                                ,readOnly:true
                                             }                                      
//                                            ,{  xtype:"textfield",
//                                                hideLabel:true,
//                                                hidden:true
//                                             }
                                            ,{  xtype:"textfield",
                                                triggerAction: 'all',
                                                fieldLabel: '可取资金',
                                                id:'WithdrawQuota',
                                                width:100
                                                //,decimalPrecision:2
                                                ,readOnly:true
                                              }
                                             , 
                                              { xtype:"textfield",
                                                triggerAction: 'all',
                                                fieldLabel: '持仓盈亏',
                                                id:'PositionProfit',
                                                width:100
                                                //,decimalPrecision:2
                                                ,readOnly:true
                                              }
//                                             ,{ xtype:"textfield",
//                                                hideLabel:true,
//                                                hidden:true
//                                              }
                                             ,{ xtype:"textfield",
                                                triggerAction: 'all',
                                                fieldLabel: '冻结资金',
                                                id:'FrozenCash',
                                                width:100
                                                //,decimalPrecision:2
                                                ,readOnly:true
                                               }
                                              ,{ xtype:"textfield",
                                                triggerAction: 'all',
                                                fieldLabel: '冻结手续费',
                                                id:'FrozenCommission',
                                                width:100
                                                //,decimalPrecision:2
                                                ,readOnly:true
                                                }
                                             ,{ xtype:"textfield",
                                                triggerAction: 'all',
                                                fieldLabel: '出金金额',
                                                id:'Withdraw',
                                                width:100
                                                //,decimalPrecision:2
                                                ,readOnly:true
                                                }       
//                                               ,{ xtype:"textfield",
//                                                  hideLabel:true,
//                                                  hidden:true
//                                                }
                                              ,{    xtype:"textfield",
                                                    triggerAction: 'all',
                                                    fieldLabel: '基本准备金',
                                                    id:'Reserve',
                                                    width:100
                                                    //,decimalPrecision:2
                                                    ,readOnly:true
                                                }
                                                ,{   xtype:"textfield",
                                                    triggerAction: 'all',
                                                    fieldLabel: '质押金额',
                                                    id:'Mortgage',
                                                    width:100
                                                    //,decimalPrecision:2
                                                    ,readOnly:true
                                                }
                                                
                                            ]
                                }
                
                ]
 });     
                
                
var tabQueryCapital=QueryTabs.add({
        id:'TabQueryCapital',
        title:'资金',
        layout:'fit',
        tbar:
		[{
                xtype:'button'
                ,text:'查询'				                    
                ,scope:this
                ,pressed:true 
                ,handler:function(){    
                     if(!CheckActionTime()) return;                              
                    QueryUserCapital();
                }
		      }],
        items:[SouthCapitalForm]
        });
        //QueryTabs.activate(tabQueryCapital);
        
}
