Grid多行tbar

来源:互联网 发布:常州淘宝模特兼职 编辑:程序博客网 时间:2024/05/22 18:01

//第二行ToolBar

        varSecondToolBar = new Ext.Toolbar({

           items:[

                '<fontstyle="line-height:25px;color:blue;">参数指定:</font>',

                '<fontstyle="line-height:25px;">所属月份:</font>',

                new Ext.form.CustomDateField({id: 'btnBlongMonth', width: 90, format: 'Y-m', emptyText: '请指定月份', disabled: true, selectOnFocus: true,

                   setValueFn: function (value) {

                       AddBelongMonthToGridStore(value);

                   }

               }),

                '<fontstyle="line-height:25px;margin-left:10px;">计算日期:</font>',

                new Ext.form.CustomDateField({id: 'btnCalcuteDate', width: 100, format: 'Y-m-d', emptyText: '请指定日期', disabled: true, selectOnFocus: true,

                   setValueFn: function (value) {

                       AddCalcuteDateToGridStore(value);

                   }

               }),

               {

                    text: '上传统一附件',

                   id: 'btnUploadFile',

                    tooltip: '<fontstyle="color:blue;line-height:25px;">上传当前批次下所有雇员计算薪酬与税费需要的附件,

<br />请先在薪酬计算名单中钩选使用相同附件的雇员,<br />如雇员没有附件,可不指定!</font>',

                   iconCls: 'SalaryStructure_Upload',

                   style: 'margin-left:10px;margin-right:10px;',

                   disabled: true,

                   handler: function () {

                       var winUpload = new Ext.Window({

                            title: '上传统一附件',

                            id: 'winUpload',width: 500, height: 300, closable: true,

                            resizable: true,minimizable: true, maximizable: true,

                            closeAction:'close',

                            layout: 'fit',

                            html: '<iframesrc=\'UploadUniteFile\' style=\'width:100%; height:100%;\'frameborder=\'0\'></iframe>',

                            listeners: {

                                'beforeclose':function (p) {

                                   GetTheSelectedData();

                                }

                            }

                       });

                       winUpload.show();

                   }

               },

                '指定模版:',

               TemplateSearchBox,

               '-',

                '<fontstyle="line-height:25px;color:blue;">任务操作:</font>',

               new Ext.Button({

                    text: '校验数据',

                   iconCls: 'SalaryStructure_Check',

                   style:'margin-right:5px;',

                   handler: function () {

                       var Flag = 1;

                       var ErrText = "";

                        //1:有无数据

                        if (store.getCount() ==0) { Flag *= 0; ErrText += "还没有添加雇员到薪酬计算名单中;<br />"; }

                        //2:是否指定所属月份

                        if(Ext.getCmp("btnBlongMonth").getRawValue() == "") { Flag *=0; ErrText += "还没有指定“所属月份”;<br />"; }

                        //3:是否指定计算日期

                        if(Ext.getCmp("btnCalcuteDate").getRawValue() == "") { Flag*= 0; ErrText += "还没有指定“计算日期”;<br />"; }

                        //4:是否指定了工资模板

                        if(Ext.get("txtTemplateID").dom.value == "") { Flag *= 0;ErrText += "还没有选择工资模板;<br />"; }

 

                       if (Flag == 1) {

                            //第一步校验OK

                           Ext.MessageBox.show({

                                title: '提示',

                                msg: '<fontstyle="color:red;line-height:25px;">你指定当前批次的用于计算薪酬的模板为:

<b>[' +Ext.getCmp("txtTemplateName").getRawValue() + ']</b><br/>如果正确,请点击[]<br />不正确,请点击[]</font>',

                                buttons:Ext.MessageBox.YESNO,

                                fn: function(result) {

                                    if (result== 'yes') {

                                       CheckDataForReady();

                                    }

                                }

                            });

                       }

                       else {

                           Ext.MessageBox.alert("注意","<font style='color:red;line-height:25px;'>" + ErrText +"</font>");

                       }

                   }

               }),

               '-',

               new Ext.Button({

                   id: 'btnStarMission',

                    text: '提交任务',

                   iconCls: 'SalaryStructure_Next',

                   disabled: true,

                   style: 'text-align:right; float:right;margin-left:5px;',

                   handler:function(){

                       StarMission();

                   }

               })

            ]

        });

 

var grid = new Ext.grid.GridPanel({

           title: '<font style=\'color:red;\'><b>薪酬计算名单</b></font>',

           store: store,

           height: windowHeight - 30,

           applyTo: 'grid',

           border: false,

            cm:new Ext.grid.ColumnModel([

            newExt.grid.RowNumberer(),

               sm,

                { header: "公司ID", width: 100, sortable: true, dataIndex: 'CMID', hidden:true },

                { header: "公司编号", width: 100, sortable: true, dataIndex: 'CMSN', hidden: true},

                { header: "公司简称", width: 150, sortable: true, dataIndex: 'CMShortName' },

                { header: "雇员ID", width: 100, sortable: true, dataIndex: 'ID', id: 'ID',hidden: true },

                { header: "雇员编号", width: 75, sortable: true, dataIndex: 'NO' },

                { header: "雇员姓名", width: 100, sortable: true, dataIndex: 'Name' },

                { header: "身份证号码", width: 150, sortable: true, dataIndex: 'DocumentNO' },

                { header: "合作ID", width: 150, sortable: true, dataIndex: 'HZID', hidden:true },

                { header: "合作编号", width: 150, sortable: true, dataIndex: 'HZSN', hidden: true},

                { header: "合作方式", width: 100, sortable: true, dataIndex: 'HZNAME' },

                { header: "工资所属月份", width: 100, sortable: true, dataIndex: 'BlongMonth' },

                { header: "工资计算日期", width: 100, sortable: true, dataIndex: 'CalcuteDate' },

                { header: "客户附件", width: 150, sortable: true, dataIndex: 'FileID' },

           //{ header: "发放次数", width: 75, sortable: true,dataIndex: 'SalaryCount' },

                {header: "批次号", width: 150, sortable: true, dataIndex: 'BatchNumber' },

                { header: "校验", width: 50, sortable: true, dataIndex: 'Check',

                   renderer: function (value) {

                       //return value;

                        if(value=='true'){return "<img src='@Url.Content("~/Content/themes/SalaryStructure/BatchEntry_CheckOK.png")' />"; }

                       else{return"<img src='@Url.Content("~/Content/themes/SalaryStructure/BatchEntry_CheckFalse.gif")' />"; }

                   }

               },

               { header:"错误信息", width: 150, sortable: true, dataIndex:'ErrText' },

               { header:"数据记录ID", width: 150, sortable: true, dataIndex:'RecordID' },

               { header:"模板名称", width: 150, sortable: true, dataIndex:'TemplateName' }

           //{ header: "模板ID", width: 150, sortable:true, dataIndex: 'TemplateID' }

            ]),

           tbar: [

               '<fontstyle="line-height:25px;color:blue;">任务类型:</font>',

               OrderType,

               '-',

               '<fontstyle="line-height:25px;color:blue;">当前批次号:</font>',

               newExt.form.TextField({

                    id:'txtBatchNumber',

                   width: 150,

                    readOnly:true,

                    style:'top:1px;'

               }),

               newExt.Button({

                    id:'btnGetBatchNumber',

                   //text: '生成批次号',

                   tooltip:'<fontstyle="color:Red;line-height:25px;">重新生成一个新的批次号</font>',

                   //minWidth: 100,

                    iconCls:'SalaryStructure_BatchNum',

                    handler:function () {

                       GetTheBatchNumber();

                   }

               }),

               '-','<fontstyle="line-height:25px;color:blue;">雇员操作:</font>',

               {

                    id:'btnAddEmployee',

                   text:'手工添加雇员',

                   tooltip:'<fontstyle="color:green;line-height:25px;">从每间公司的雇员列表中,<br />选中至少一名雇员,<br />添加到薪酬计算名单中!</font>',

                    iconCls:'SalaryStructure_Add',

                    disabled:true,

                    handler:function () {

                       var AddWin =new Ext.Window({

                            title:'添加工资/计税任务雇员',

                            id:'AddWindow',

                            width: 750,

                            height: 300,

                            closable:true,

                            modal:true,

                            closeAction:'close',

                            layout:'fit',

                            html:"<iframe id='EmployeeAddiFrame'src='EmployeeAddTemplate' style='width:100%; height:100%;'frameborder='0'></iframe>",

                            buttons: [

                                {

                                    text:'确定',

                                    iconCls:'SalaryStructure_Success',

                                    handler:function () {

                                       //取数

                                       var emStore = window.document.getElementById("EmployeeAddiFrame").contentWindow.GetData();

                                       if (emStore.length > 0) {

                                           AddDataToGridStore(emStore);

                                           AddBatchNumberToGridStore();

 

                                           Ext.getCmp("btnBlongMonth").enable();

                                           Ext.getCmp("btnCalcuteDate").enable();

                                           Ext.getCmp("btnUploadFile").enable();

                                           Ext.getCmp("txtTemplateName").enable();

 

                                           Ext.getCmp("txtCount").setValue(emStore.length);

                                        }

                                       else {

                                           Ext.getCmp("btnBlongMonth").disable();

                                           Ext.getCmp("btnCalcuteDate").disable();

                                           Ext.getCmp("btnUploadFile").disable();

                                           Ext.getCmp("txtTemplateName").disable();

 

                                           Ext.getCmp("txtCount").setValue("0");

                                        }

                                       AddWin.close();

                                    }

                                }

                            ]

                       });

                       AddWin.show();

                       AddWin.setSize(750, 300);

                   }

               }, {

                    id:'btnImportExcel',

                   text:'通过Excel导入雇员',

                   tooltip:'<fontstyle="color:green;line-height:25px;">通过Excel导入大批量的雇员名单,

<br />导入模版可以从右侧菜单的<br /><b>[薪酬服务部]->[工资模版管理]</b>中下载</font>',

                    iconCls:'SalaryStructure_Leading-in',

                    handler:function () {

                       var BatchAddWin =new Ext.Window({

                            title:'<fontstyle="color:red;line-height:20px;">通过Excel导入雇员</font>',

                            iconCls:'SalaryStructure_Leading-in',

                            closeAction:'hide',

                            modal:true,

                            id:'BatchAddWindow',

                            width: 450,

                            height: 200,

                            closable:true,

                            layout:'fit',

                            html:'<iframeid=\'BatchEmployeeAddiFrame\' src=\'BatchEmployeeAddTemplate\'style=\'width:100%; height:100%;\' frameborder=\'0\'></iframe>',

                            listeners:{

                               'beforehide':function(p){

                                   var n = Ext.getDom("UploadFilePath").value;

                                   SetBatchData();

                                   //store4.load({ params: { file: n} });

                                }

                            }

                       });

                       BatchAddWin.show();

                       BatchAddWin.setSize(450,200);

                   }

               },

               '-',

               DeleteOneEmployee,

               '-',

               ClearAllData

            ],

            sm:sm,

           stripeRows:true,

           bbar: [

               '<fontstyle="line-height:25px;color:red;">总共</font>',

               newExt.form.TextField({ cls:'textwidth', id:'txtCount',style:'margin-left:5px;margin-right:5px; top:0px;',readOnly:true }),

               new Ext.form.Label({ text: '', cls: 'labelcolor' })

            ]

        });

 

 

 

SecondToolBar.render(grid.tbar);