Exemplo n.º 1
0
 internal void EnsureHeaderColumn(GridView item, HeaderColumn column)
 {
     if (column.Component.Count > 0)
     {
         this.EnsureHeaderControl(item, column.Component[0]);
     }
 }
Exemplo n.º 2
0
        void Columns_AfterItemAdd(HeaderColumn item)
        {
            if (item.Component.Count > 0 && this.ParentGrid != null)
            {
                this.ParentGrid.EnsureHeaderColumn(this, item);
            }

            item.Component.AfterItemAdd += Component_AfterItemAdd;
        }
Exemplo n.º 3
0
        void Columns_AfterItemAdd(HeaderColumn item)
        {
            if (item.Component.Count > 0 && this.ParentGrid != null)
            {
                this.ParentGrid.EnsureHeaderColumn(this, item);
            }

            item.Component.AfterItemAdd += Component_AfterItemAdd;
        }
Exemplo n.º 4
0
 internal void EnsureHeaderColumn(GridView item, HeaderColumn column)
 {
     if (column.Component.Count > 0)
     {
         this.EnsureHeaderControl(item, column.Component[0]);
     }
 }
Exemplo n.º 5
0
        protected void LoadData(DataTable dt, bool CheckCopy)
        {
            string ID = dt.Rows[0]["RequestID"].ToString();
            cs.DBCommand dbc = new cs.DBCommand();
            //cbxOwner.SelectedItem.Value = dt.Rows[0]["PersonID"].ToString();
            
            if (CheckCopy)//根据Copy判断是否需要判断Copy状态
            {
                if (Request.QueryString["Copy"] != null)
                {
                    if (Request.QueryString["Copy"].ToString() == "T")//Copy而已,作为新增
                    {
                        hdTravelRequestID.Value = "";
                        hdTravelRequestNo.Value = "";
                        if (Request.QueryString["CopyType"] != null)
                        {
                            if (Request.QueryString["CopyType"].ToString() == "A")
                            {
                                if (dt.Rows[0]["ReportFile"].ToString() != "")
                                {
                                    linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString();
                                    linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString();
                                    hdReport.Value = dt.Rows[0]["ReportFile"].ToString();
                                }
                                if (dt.Rows[0]["Attach"].ToString() != "")
                                {
                                    linkScanFile.Text = dt.Rows[0]["Attach"].ToString();
                                    linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString();
                                    hdScanFile.Value = dt.Rows[0]["Attach"].ToString();
                                }
                            }
                        }
                    }
                    else
                    {
                        ErrorHandle("Data Error.");
                    }
                }
                else
                {
                    //labelOwner.Text = dt.Rows[0]["Person"].ToString();
                    //hdOwner.Value = dt.Rows[0]["Person"].ToString();
                    //hdOwnerID.Value = dt.Rows[0]["PersonID"].ToString();
                    //labelStation.Text = dt.Rows[0]["Station"].ToString();
                    //labelDepartment.Text = dt.Rows[0]["Department"].ToString();
                    //获取该人币种
                    //LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt.Rows[0]["Station"].ToString());
                    //hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt.Rows[0]["Station"].ToString()), 3);

                    //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString());
                    //if (ds1.Tables[0].Rows.Count == 1)
                    //{
                    //    DataTable dt1 = ds1.Tables[0];
                    //    LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["stationCode"].ToString());
                    //    hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt1.Rows[0]["stationCode"].ToString()), 3);
                    //    DataTable dttemp = new DataTable();
                    //    string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'";
                    //    dttemp = dbc.GetData("eReimbursement", sqltemp);
                    //    if (dttemp.Rows.Count > 0)
                    //    {
                    //        LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dttemp.Rows[0]["Station"].ToString());
                    //        hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dttemp.Rows[0]["Station"].ToString()), 3);
                    //    }
                    //}
                    //else
                    //{
                    //    ErrorHandle("Data Error."); return;
                    //}

                    hdTravelRequestID.Value = ID;
                    hdTravelRequestNo.Value = dt.Rows[0]["No"].ToString();
                    if (dt.Rows[0]["ReportFile"].ToString() != "")
                    {
                        linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString();
                        linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString();
                        hdReport.Value = dt.Rows[0]["ReportFile"].ToString();
                    }
                    if (dt.Rows[0]["Attach"].ToString() != "")
                    {
                        linkScanFile.Text = dt.Rows[0]["Attach"].ToString();
                        linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString();
                        hdScanFile.Value = dt.Rows[0]["Attach"].ToString();
                    }
                    X.AddScript("btnExport.enable();");
                }
            }
            else
            {
                //labelOwner.Text = dt.Rows[0]["Person"].ToString();
                //hdOwner.Value = dt.Rows[0]["Person"].ToString();
                //hdOwnerID.Value = dt.Rows[0]["PersonID"].ToString();
                //labelStation.Text = dt.Rows[0]["Station"].ToString();
                //labelDepartment.Text = dt.Rows[0]["Department"].ToString();
                //获取该人币种
                //LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt.Rows[0]["Station"].ToString());
                //hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt.Rows[0]["Station"].ToString()), 3);

                //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString());
                //if (ds1.Tables[0].Rows.Count == 1)
                //{
                //    DataTable dt1 = ds1.Tables[0];
                //    LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["stationCode"].ToString());
                //    hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt1.Rows[0]["stationCode"].ToString()), 3);
                //    DataTable dttemp = new DataTable();
                //    string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'";
                //    dttemp = dbc.GetData("eReimbursement", sqltemp);
                //    if (dttemp.Rows.Count > 0)
                //    {
                //        LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dttemp.Rows[0]["Station"].ToString());
                //        hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dttemp.Rows[0]["Station"].ToString()), 3);
                //    }
                //}
                //else
                //{
                //    ErrorHandle("Data Error."); return;
                //}

                hdTravelRequestID.Value = ID;
                hdTravelRequestNo.Value = dt.Rows[0]["No"].ToString();
                if (dt.Rows[0]["ReportFile"].ToString() != "")
                {
                    linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString();
                    linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString();
                    hdReport.Value = dt.Rows[0]["ReportFile"].ToString();
                }
                if (dt.Rows[0]["Attach"].ToString() != "")
                {
                    linkScanFile.Text = dt.Rows[0]["Attach"].ToString();
                    linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString();
                    hdScanFile.Value = dt.Rows[0]["Attach"].ToString();
                }
            }
            //Radio1.Checked = dt.Rows[0]["Budget"].ToString() == "1" ? true : false;
            //Radio2.Checked = dt.Rows[0]["Budget"].ToString() != "1" ? true : false;
            //cbxBudget.SelectedItem.Value = dt.Rows[0]["Budget"].ToString() == "1" ? "YES" : "NO";

            
            ////获取该人币种
            //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString());
            //if (ds1.Tables[0].Rows.Count == 1)
            //{
            //    DataTable dt1 = ds1.Tables[0];
            //    LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["CostCenter"].ToString());

            //    DataTable dttemp = new DataTable();
            //    string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'";
            //    dttemp = dbc.GetData("eReimbursement", sqltemp);
            //    if (dttemp.Rows.Count > 0)
            //    {
            //        LabelCurrency.Text = dttemp.Rows[0]["Currency"].ToString();
            //    }
            //}
            //else
            //{
            //    ErrorHandle("Data Error."); return;
            //}

            //载入已经保存的基本信息
            labelOwner.Text = dt.Rows[0]["Person"].ToString();
            hdOwner.Value = dt.Rows[0]["Person"].ToString();
            hdOwnerID.Value = dt.Rows[0]["PersonID"].ToString();
            labelStation.Text = dt.Rows[0]["Station"].ToString();
            labelDepartment.Text = dt.Rows[0]["Department"].ToString();

            //组合数据
            DataTable dtnew = new DataTable();
            Store2.Reader[0].Fields.Add("Category", RecordFieldType.String);
            dtnew.Columns.Add("Category", typeof(String));
            dtnew.Columns.Add("TotalP", typeof(String));
            dtnew.Columns.Add("TotalC", typeof(String));
            //默认12行
            for (int i = 0; i < 12; i++)
            {
                DataRow dr = dtnew.NewRow();
                dtnew.Rows.Add(dr);
            }
            //默认第一列是标题
            dtnew.Rows[0][0] = "1. Air Ticket - Int'l";
            dtnew.Rows[1][0] = "Air Ticket - Domestic";
            dtnew.Rows[2][0] = "2. Hotel Bill";
            dtnew.Rows[3][0] = "3. Meals";
            dtnew.Rows[4][0] = "4. Entertainment";
            dtnew.Rows[5][0] = "5. Car Rental/Transportation";
            dtnew.Rows[6][0] = "6. Communication";
            dtnew.Rows[7][0] = "7. Local Trip Allowance";
            dtnew.Rows[8][0] = "8. Overseas Trip Allowance";
            dtnew.Rows[9][0] = "9. Airport Tax/Travel Insurance";
            dtnew.Rows[10][0] = "10. Others";
            dtnew.Rows[11][0] = "Total";

            string sqlf = "select distinct Tocity from ETraveleDetail where [No]='" + ID + "'";
            DataTable dtf = dbc.GetData("eReimbursement", sqlf);
            string sqld = "select * from ETraveleDetail where [No]='" + ID + "' order by id";
            DataTable dtall = new DataTable();
            dtall = dbc.GetData("eReimbursement", sqld);
            LabelCurrency.Text = dtall.Rows[0]["Cur"].ToString();//读取费用明细中的本地币种显示
            //140226 显示预算
            DataTable dtbudget = new DataTable();
            dtbudget.Columns.Add("EName", typeof(System.String));
            dtbudget.Columns.Add("Type", typeof(System.String));
            dtbudget.Columns.Add("Current", typeof(System.Decimal));
            dtbudget.Columns.Add("PU", typeof(System.Decimal));
            dtbudget.Columns.Add("PB", typeof(System.Decimal));
            dtbudget.Columns.Add("PPercent", typeof(System.Decimal));
            dtbudget.Columns.Add("DU", typeof(System.Decimal));
            dtbudget.Columns.Add("DB", typeof(System.Decimal));
            dtbudget.Columns.Add("DPercent", typeof(System.Decimal));
            dtbudget.Columns.Add("SU", typeof(System.Decimal));
            dtbudget.Columns.Add("SB", typeof(System.Decimal));
            dtbudget.Columns.Add("SPercent", typeof(System.Decimal));
            //StoreBudget添加Field
            StoreBudget.Reader[0].Fields.Add("EName", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("Type", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("Current", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("PU", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("PB", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("PPercent", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("DU", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("DB", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("DPercent", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("SU", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("SB", RecordFieldType.String);
            StoreBudget.Reader[0].Fields.Add("SPercent", RecordFieldType.String);
            //取得预算日期
            string sqlA = "select convert(varchar(10),min(Tdate0),111) as BudgetDate from ETraveleDetail where No='" + ID + "'";
            DataTable dtA = dbc.GetData("eReimbursement", sqlA);
            //取得4大类合计
            //string sqlB = "select sum(T1) as T1,sum(T2) as T2,sum(T3) as T3,sum(T4) as T4 from (select case when AccountCode='62012000' then isnull(Pamount,0)+isnull(Camount,0) else 0 end as [T1],case when AccountCode='62010900' then isnull(Pamount,0)+isnull(Camount,0) else 0 end as [T2],case when AccountCode='62011900' then isnull(Pamount,0)+isnull(Camount,0) else 0 end as [T3],case when AccountCode='62010500' then isnull(Pamount,0)+isnull(Camount,0) else 0 end as [T4] from ETraveleDetail where No=" + ID + ") t";
            string sqlB = "select sum(isnull(Pamount,0)+isnull(Camount,0)) as Amount,'62010900' as Type from ETraveleDetail where No=" + ID + " and AccountCode='62012000' union all select sum(isnull(Pamount,0)+isnull(Camount,0)) as Amount,'62011900' as Type from ETraveleDetail where No=" + ID + " and AccountCode='62010900' union all select sum(isnull(Pamount,0)+isnull(Camount,0)) as Amount,'62010500' as Type from ETraveleDetail where No=" + ID + " and AccountCode='62011900' union all select sum(isnull(Pamount,0)+isnull(Camount,0)) as Amount,'62012000' as Type from ETraveleDetail where No=" + ID + " and AccountCode='62010500'";
            DataTable dtB = dbc.GetData("eReimbursement", sqlB);
            //取得传递预算的参数
            string userid = dt.Rows[0]["PersonID"].ToString();
            string dpt = dt.Rows[0]["Department"].ToString();
            string ostation = dt.Rows[0]["CostCenter"].ToString();//预算站点,与基本信息中的CostCenter一致(Station2)
            string tstation = ostation;//Etravel表中的Station2,目前与预算站点一致,不允许更改
            string year = Convert.ToDateTime(dtA.Rows[0]["BudgetDate"].ToString()).Year.ToString();
            string month = Convert.ToDateTime(dtA.Rows[0]["BudgetDate"].ToString()).Month.ToString();
            string accountcode = "";
            for (int g = 0; g < dtB.Rows.Count; g++)
            {
                if (Convert.ToDecimal(dtB.Rows[g]["Amount"].ToString()) != 0)
                {
                    DataRow dr = dtbudget.NewRow();
                    dr["Current"] = Convert.ToDecimal(dtB.Rows[g]["Amount"].ToString());
                    dr["Type"] = dtB.Rows[g]["Type"].ToString();
                    accountcode = dtB.Rows[g]["Type"].ToString();
                    DataTable dtC = new DataTable();
                    dtC = Comm.RtnEB(userid, dpt, ostation, tstation, accountcode, year, month);
                    for (int i = 0; i < dtC.Rows.Count; i++)
                    {
                        if (dtC.Rows[i]["Type"].ToString() == "全年个人")
                        {
                            dr["PU"] = Convert.ToDecimal(dtC.Rows[i]["Used"].ToString());
                            dr["PB"] = Convert.ToDecimal(dtC.Rows[i]["Budget"].ToString());
                        }
                        else if (dtC.Rows[i]["Type"].ToString() == "全年部门")
                        {
                            dr["DU"] = Convert.ToDecimal(dtC.Rows[i]["Used"].ToString());
                            dr["DB"] = Convert.ToDecimal(dtC.Rows[i]["Budget"].ToString());
                        }
                        else if (dtC.Rows[i]["Type"].ToString() == "全年站点")
                        {
                            dr["SU"] = Convert.ToDecimal(dtC.Rows[i]["Used"].ToString());
                            dr["SB"] = Convert.ToDecimal(dtC.Rows[i]["Budget"].ToString());
                        }
                    }
                    dtbudget.Rows.Add(dr);
                }
            }
            //计算%,取得名称
            for (int i = 0; i < dtbudget.Rows.Count; i++)
            {
                if (Convert.ToDecimal(dtbudget.Rows[i]["PB"].ToString()) != 0)//如果Budget不为0,则计算%
                {
                    dtbudget.Rows[i]["PPercent"] = System.Math.Round(Convert.ToDecimal(dtbudget.Rows[i]["PU"].ToString()) / Convert.ToDecimal(dtbudget.Rows[i]["PB"].ToString()), 4) * 100;
                }
                if (Convert.ToDecimal(dtbudget.Rows[i]["DB"].ToString()) != 0)//如果Budget不为0,则计算%
                {
                    dtbudget.Rows[i]["DPercent"] = System.Math.Round(Convert.ToDecimal(dtbudget.Rows[i]["DU"].ToString()) / Convert.ToDecimal(dtbudget.Rows[i]["DB"].ToString()), 4) * 100;
                }
                if (Convert.ToDecimal(dtbudget.Rows[i]["SB"].ToString()) != 0)//如果Budget不为0,则计算%
                {
                    dtbudget.Rows[i]["SPercent"] = System.Math.Round(Convert.ToDecimal(dtbudget.Rows[i]["SU"].ToString()) / Convert.ToDecimal(dtbudget.Rows[i]["SB"].ToString()), 4) * 100;
                }
                if (dtbudget.Rows[i]["Type"].ToString()=="62010900")
                {
                    dtbudget.Rows[i]["EName"] = "Travel expense";
                }
                else if (dtbudget.Rows[i]["Type"].ToString() == "62011900")
                {
                    dtbudget.Rows[i]["EName"] = "Entertainment";
                }
                else if (dtbudget.Rows[i]["Type"].ToString() == "62010500")
                {
                    dtbudget.Rows[i]["EName"] = "Transportation";
                }
                else if (dtbudget.Rows[i]["Type"].ToString() == "62012000")
                {
                    dtbudget.Rows[i]["EName"] = "Communication";
                }
            }
            
            bool PB = false, DB = false, SB = false;
            for (int i = 0; i < dtbudget.Rows.Count; i++)
            {
                if (Convert.ToDecimal(dtbudget.Rows[i]["PB"].ToString()) != 0)//是否显示个人预算列
                {
                    PB = true;
                }
                if (Convert.ToDecimal(dtbudget.Rows[i]["DB"].ToString()) != 0)//是否显示部门预算列
                {
                    DB = true;
                }
                if (Convert.ToDecimal(dtbudget.Rows[i]["SB"].ToString()) != 0)//是否显示站点预算列
                {
                    SB = true;
                }
            }
            //添加数据列
            var cm = GridPanelBudget.ColumnModel;
            cm.Columns.Add(new Column
            {
                DataIndex = "EName",
                Header = "Expense Item",
                Sortable = false,
                Resizable = false,
                MenuDisabled = true,
                Width = 100
            });
            cm.Columns.Add(new Column
            {
                DataIndex = "Current",
                Header = "Current",
                Renderer = new Renderer { Fn = "GetNumber" },
                Sortable = false,
                Resizable = false,
                MenuDisabled = true,
                Width = 100
            });
            //显示个人预算部分
            if (PB)
            {
                cm.Columns.Add(new Column
                {
                    DataIndex = "PU",
                    Header = "Personal Used",
                    Renderer = new Renderer { Fn = "GetNumber" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
                cm.Columns.Add(new Column
                {
                    DataIndex = "PB",
                    Header = "Personal Budget",
                    Renderer = new Renderer { Fn = "GetNumber" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
                cm.Columns.Add(new Column
                {
                    DataIndex = "PPercent",
                    Header = "%(Used/Budget)",
                    Renderer = new Renderer { Fn = "GetNumberPercent" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
            }
            if (DB)
            {
                cm.Columns.Add(new Column
                {
                    DataIndex = "DU",
                    Header = "Department Used",
                    Renderer = new Renderer { Fn = "GetNumber" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
                cm.Columns.Add(new Column
                {
                    DataIndex = "DB",
                    Header = "Department Budget",
                    Renderer = new Renderer { Fn = "GetNumber" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
                cm.Columns.Add(new Column
                {
                    DataIndex = "DPercent",
                    Header = "%(Used/Budget)",
                    Renderer = new Renderer { Fn = "GetNumberPercent" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
            }
            if (SB)
            {
                cm.Columns.Add(new Column
                {
                    DataIndex = "SU",
                    Header = "Unit Used",
                    Renderer = new Renderer { Fn = "GetNumber" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
                cm.Columns.Add(new Column
                {
                    DataIndex = "SB",
                    Header = "Unit Budget",
                    Renderer = new Renderer { Fn = "GetNumber" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
                cm.Columns.Add(new Column
                {
                    DataIndex = "SPercent",
                    Header = "%(Used/Budget)",
                    Renderer = new Renderer { Fn = "GetNumberPercent" },
                    Sortable = false,
                    Resizable = false,
                    MenuDisabled = true,
                    Width = 100
                });
            }
            StoreBudget.DataSource = dtbudget;
            StoreBudget.DataBind();
            //
            if (dtf.Rows.Count == 1)
            {
                
                for (int i = 0; i < dtall.Rows.Count; i++)
                {
                    if (i % 11 == 0)
                    {
                        string colname = "Station_" + (i / 11).ToString() + "_P";
                        Store2.Reader[0].Fields.Add(colname, RecordFieldType.String);
                        dtnew.Columns.Add(colname, typeof(String));
                        colname = "Station_" + (i / 11).ToString() + "_C";
                        Store2.Reader[0].Fields.Add(colname, RecordFieldType.String);
                        dtnew.Columns.Add(colname, typeof(String));
                    }
                    dtnew.Rows[i % 11][3 + i / 11 * 2] = dtall.Rows[i]["Pamount"].ToString();
                    dtnew.Rows[i % 11][3 + i / 11 * 2 + 1] = dtall.Rows[i]["Camount"].ToString();
                    //列合计
                    string df = dtnew.Rows[11][3 + i / 11 * 2].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2].ToString();
                    string cf = dtall.Rows[i]["Pamount"].ToString() == "" ? "0" : dtall.Rows[i]["Pamount"].ToString();
                    dtnew.Rows[11][3 + i / 11 * 2] = Convert.ToDecimal(df) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df) + Convert.ToDecimal(cf)).ToString();

                    string bf = dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString();
                    string af = dtall.Rows[i]["Camount"].ToString() == "" ? "0" : dtall.Rows[i]["Camount"].ToString();
                    dtnew.Rows[11][3 + i / 11 * 2 + 1] = Convert.ToDecimal(bf) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf) + Convert.ToDecimal(af)).ToString();
                    //行合计
                    string df1 = dtnew.Rows[i % 11][1].ToString() == "" ? "0" : dtnew.Rows[i % 11][1].ToString();
                    dtnew.Rows[i % 11][1] = Convert.ToDecimal(df1) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df1) + Convert.ToDecimal(cf)).ToString();
                    string bf1 = dtnew.Rows[i % 11][2].ToString() == "" ? "0" : dtnew.Rows[i % 11][2].ToString();
                    dtnew.Rows[i % 11][2] = Convert.ToDecimal(bf1) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf1) + Convert.ToDecimal(af)).ToString();
                    //总合计
                    string tf = dtnew.Rows[11][1].ToString() == "" ? "0" : dtnew.Rows[11][1].ToString();
                    dtnew.Rows[11][1] = Convert.ToDecimal(tf) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(tf) + Convert.ToDecimal(cf)).ToString();
                    string ff = dtnew.Rows[11][2].ToString() == "" ? "0" : dtnew.Rows[11][2].ToString();
                    dtnew.Rows[11][2] = Convert.ToDecimal(ff) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(ff) + Convert.ToDecimal(af)).ToString();
                }
                dtnew.Columns.Add("Station_1_P", typeof(String));
                dtnew.Columns.Add("Station_1_C", typeof(String));
                Store2.Reader[0].Fields.Add("Station_1_P", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("Station_1_C", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String);

                Store2.DataSource = dtnew;
                Store2.DataBind();

                var TitleCol = new Column();
                TitleCol.DataIndex = "Category";
                TitleCol.Sortable = false;
                TitleCol.Resizable = false;
                TitleCol.MenuDisabled = true;
                TitleCol.Width = 180;
                this.GridPanel2.ColumnModel.Columns.Add(TitleCol);

                var Title1 = new Ext.Net.Label();
                Title1.Text = "Destination:";
                HeaderColumn hcTitle1 = new HeaderColumn();
                hcTitle1.Component.Add(Title1);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1);

                var Title2 = new Ext.Net.Label();
                Title2.Text = "Cost Center:";
                HeaderColumn hcTitle2 = new HeaderColumn();
                hcTitle2.Component.Add(Title2);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2);

                var Title3 = new Ext.Net.Label();
                Title3.Text = "Travel Period:";
                HeaderColumn hcTitle3 = new HeaderColumn();
                hcTitle3.Component.Add(Title3);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3);

                int colc = dtall.Rows.Count / 11;
                for (int i = 0; i < colc; i++)//准备复制已有信息
                {
                    string fieldPName = "Station_" + i.ToString() + "_P";
                    string fieldCName = "Station_" + i.ToString() + "_C";

                    var txtP = new Ext.Net.NumberField();
                    //txtP.Listeners.Blur.Fn = "Cal";
                    var colP = new Column();
                    colP.Header = "Person Pay";
                    colP.DataIndex = fieldPName;
                    colP.Sortable = false;
                    colP.Resizable = false;
                    colP.MenuDisabled = true;
                    colP.Width = 110;
                    colP.Editor.Add(txtP);
                    this.GridPanel2.ColumnModel.Columns.Add(colP);

                    var txtC = new Ext.Net.NumberField();
                    //txtC.Listeners.Blur.Fn = "Cal";
                    var colC = new Column();
                    colC.Header = "Company Pay";
                    colC.DataIndex = fieldCName;
                    colC.Sortable = false;
                    colC.Resizable = false;
                    colC.MenuDisabled = true;
                    colC.Width = 110;
                    colC.Editor.Add(txtC);
                    this.GridPanel2.ColumnModel.Columns.Add(colC);

                    var Station = new Ext.Net.TextField();
                    Station.Text = dtall.Rows[i * 11]["Tocity"].ToString();
                    HeaderColumn hcStation = new HeaderColumn();
                    hcStation.Component.Add(Station);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation);

                    var Button = new Ext.Net.Button();
                    Button.Text = "Remove";
                    Button.Listeners.Click.Handler = "removecol(this," + i.ToString() + ");";
                    Button.Listeners.Click.Delay = 50;
                    HeaderColumn hcButton = new HeaderColumn();
                    hcButton.Component.Add(Button);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton);

                    var CostCenter = new Ext.Net.TextField();
                    CostCenter.Disabled = true;
                    CostCenter.EmptyText = "Station Code";
                    CostCenter.Text = dtall.Rows[i * 11]["TSation"].ToString();
                    HeaderColumn hcCostCenter = new HeaderColumn();
                    hcCostCenter.Component.Add(CostCenter);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter);

                    //HeaderColumn hcCostCenter1 = new HeaderColumn();
                    //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1);
                    var ButtonGetSum = new Ext.Net.Button();
                    ButtonGetSum.Text = "Calculate";
                    ButtonGetSum.Listeners.Click.Handler = "GetSum();";
                    ButtonGetSum.Listeners.Click.Delay = 50;
                    HeaderColumn hcButtonGetSum = new HeaderColumn();
                    hcButtonGetSum.Component.Add(ButtonGetSum);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum);

                    var datefrom = new DateField();
                    string dtfroms = dtall.Rows[i * 11]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate0"].ToString()).ToString("yyyy/MM/dd");
                    datefrom.SetValue(dtfroms);
                    datefrom.EmptyText = "yyyy/MM/dd";
                    datefrom.Format = "yyyy/MM/dd";
                    HeaderColumn Date1 = new HeaderColumn();
                    Date1.Component.Add(datefrom);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1);

                    var dateto = new DateField();
                    string datetos = dtall.Rows[i * 11]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate"].ToString()).ToString("yyyy/MM/dd");
                    dateto.SetValue(datetos);
                    dateto.EmptyText = "yyyy/MM/dd";
                    dateto.Format = "yyyy/MM/dd";
                    HeaderColumn Date2 = new HeaderColumn();
                    Date2.Component.Add(dateto);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2);
                }

                var txtP1 = new Ext.Net.NumberField();
                //txtP1.Listeners.Blur.Fn = "Cal";
                //txtP1.Listeners.Blur.Delay = 50;
                var colP1 = new Column();
                colP1.Header = "Person Pay";
                colP1.DataIndex = "Station_1_P";
                colP1.Sortable = false;
                colP1.Resizable = false;
                colP1.MenuDisabled = true;
                colP1.Width = 110;
                colP1.Locked = true;
                colP1.Editor.Add(txtP1);
                colP1.Hidden = true;
                this.GridPanel2.ColumnModel.Columns.Add(colP1);

                var txtC1 = new Ext.Net.NumberField();
                //txtC1.Listeners.Blur.Fn = "Cal";
                //txtC1.Listeners.Blur.Delay = 50;
                var colC1 = new Column();
                colC1.Header = "Company Pay";
                colC1.DataIndex = "Station_1_C";
                colC1.Sortable = false;
                colC1.Resizable = false;
                colC1.MenuDisabled = true;
                colC1.Width = 110;
                colC1.Locked = true;
                colC1.Editor.Add(txtC1);
                colC1.Hidden = true;
                this.GridPanel2.ColumnModel.Columns.Add(colC1);

                var TotalP = new Ext.Net.TextField();
                TotalP.ReadOnly = true;
                TotalP.Cls = "custom-row";
                var colTotalP = new Column();
                colTotalP.DataIndex = "TotalP";
                colTotalP.Sortable = false;
                colTotalP.Resizable = false;
                colTotalP.MenuDisabled = true;
                colTotalP.Width = 110;
                colTotalP.Locked = true;
                colTotalP.Editor.Add(TotalP);
                this.GridPanel2.ColumnModel.Columns.Add(colTotalP);

                var TotalC = new Ext.Net.TextField();
                TotalC.ReadOnly = true;
                TotalC.Cls = "custom-row";
                var colTotalC = new Column();
                colTotalC.DataIndex = "TotalC";
                colTotalC.Sortable = false;
                colTotalC.Resizable = false;
                colTotalC.MenuDisabled = true;
                colTotalC.Width = 110;
                colTotalC.Locked = true;
                colTotalC.Editor.Add(TotalC);
                this.GridPanel2.ColumnModel.Columns.Add(colTotalC);

                var Station1 = new Ext.Net.TextField();
                HeaderColumn hcStation1 = new HeaderColumn();
                hcStation1.Component.Add(Station1);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation1);

                var CostCenter0 = new Ext.Net.TextField();
                CostCenter0.Disabled = true;
                CostCenter0.EmptyText = "Station Code";
                HeaderColumn hcCostCenter0 = new HeaderColumn();
                hcCostCenter0.Component.Add(CostCenter0);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter0);

                HeaderColumn hcDate3 = new HeaderColumn();
                var Date3 = new DateField();
                Date3.EmptyText = "yyyy/MM/dd";
                Date3.Format = "yyyy/MM/dd";
                //Date3.SetValue("2013/11/1");
                hcDate3.Component.Add(Date3);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate3);


                var Button1 = new Ext.Net.Button();
                Button1.Text = "Remove";
                Button1.Listeners.Click.Handler = "removecol(this,1);";
                Button1.Listeners.Click.Delay = 50;
                HeaderColumn hcButton1 = new HeaderColumn();
                hcButton1.Component.Add(Button1);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton1);

                var ButtonGetSum1 = new Ext.Net.Button();
                ButtonGetSum1.Text = "Calculate";
                ButtonGetSum1.Listeners.Click.Handler = "GetSum();";
                ButtonGetSum1.Listeners.Click.Delay = 50;
                HeaderColumn hcButtonGetSum1 = new HeaderColumn();
                hcButtonGetSum1.Component.Add(ButtonGetSum1);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum1);

                HeaderColumn hcDate4 = new HeaderColumn();
                var Date4 = new DateField();
                Date4.EmptyText = "yyyy/MM/dd";
                Date4.Format = "yyyy/MM/dd";
                //Date4.SetValue("2013/11/2");
                hcDate4.Component.Add(Date4);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate4);

                HeaderColumn hcTotal1 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1);

                HeaderColumn hcTotal3 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3);

                var TitleTotalP = new Ext.Net.Label();
                TitleTotalP.Text = "Total(Person)";
                TitleTotalP.Cls = "custom-row";
                HeaderColumn hcTitleTotalP = new HeaderColumn();
                hcTitleTotalP.Component.Add(TitleTotalP);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP);

                HeaderColumn hcTotal2 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2);

                HeaderColumn hcTotal4 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4);

                var TitleTotalC = new Ext.Net.Label();
                TitleTotalC.Text = "Total(Comp)";
                TitleTotalC.Cls = "custom-row";
                HeaderColumn hcTitleTotalC = new HeaderColumn();
                hcTitleTotalC.Component.Add(TitleTotalC);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC);

                X.AddScript("GridPanel2.colModel.setHidden(3, true);GridPanel2.colModel.setHidden(4, true);Store2.removeField('Station_1_P');Store2.removeField('Station_1_C');");
            }
            else
            {
                //string sqld = "select * from ETraveleDetail where [No]='" + ID + "' order by id";
                //DataTable dtall = new DataTable();
                //dtall = dbc.GetData("eReimbursement", sqld);
                for (int i = 0; i < dtall.Rows.Count; i++)
                {
                    if (i % 11 == 0)
                    {
                        string colname = "Station_" + (i / 11).ToString() + "_P";
                        Store2.Reader[0].Fields.Add(colname, RecordFieldType.String);
                        dtnew.Columns.Add(colname, typeof(String));
                        colname = "Station_" + (i / 11).ToString() + "_C";
                        Store2.Reader[0].Fields.Add(colname, RecordFieldType.String);
                        dtnew.Columns.Add(colname, typeof(String));
                    }
                    dtnew.Rows[i % 11][3 + i / 11 * 2] = dtall.Rows[i]["Pamount"].ToString();
                    dtnew.Rows[i % 11][3 + i / 11 * 2 + 1] = dtall.Rows[i]["Camount"].ToString();
                    //列合计
                    string df = dtnew.Rows[11][3 + i / 11 * 2].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2].ToString();
                    string cf = dtall.Rows[i]["Pamount"].ToString() == "" ? "0" : dtall.Rows[i]["Pamount"].ToString();
                    dtnew.Rows[11][3 + i / 11 * 2] = Convert.ToDecimal(df) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df) + Convert.ToDecimal(cf)).ToString();

                    string bf = dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString();
                    string af = dtall.Rows[i]["Camount"].ToString() == "" ? "0" : dtall.Rows[i]["Camount"].ToString();
                    dtnew.Rows[11][3 + i / 11 * 2 + 1] = Convert.ToDecimal(bf) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf) + Convert.ToDecimal(af)).ToString();
                    //行合计
                    string df1 = dtnew.Rows[i % 11][1].ToString() == "" ? "0" : dtnew.Rows[i % 11][1].ToString();
                    dtnew.Rows[i % 11][1] = Convert.ToDecimal(df1) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df1) + Convert.ToDecimal(cf)).ToString();
                    string bf1 = dtnew.Rows[i % 11][2].ToString() == "" ? "0" : dtnew.Rows[i % 11][2].ToString();
                    dtnew.Rows[i % 11][2] = Convert.ToDecimal(bf1) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf1) + Convert.ToDecimal(af)).ToString();
                    //总合计
                    string tf = dtnew.Rows[11][1].ToString() == "" ? "0" : dtnew.Rows[11][1].ToString();
                    dtnew.Rows[11][1] = Convert.ToDecimal(tf) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(tf) + Convert.ToDecimal(cf)).ToString();
                    string ff = dtnew.Rows[11][2].ToString() == "" ? "0" : dtnew.Rows[11][2].ToString();
                    dtnew.Rows[11][2] = Convert.ToDecimal(ff) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(ff) + Convert.ToDecimal(af)).ToString();
                }
                Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String);

                Store2.DataSource = dtnew;
                Store2.DataBind();

                var TitleCol = new Column();
                TitleCol.DataIndex = "Category";
                TitleCol.Sortable = false;
                TitleCol.Resizable = false;
                TitleCol.MenuDisabled = true;
                TitleCol.Width = 180;
                this.GridPanel2.ColumnModel.Columns.Add(TitleCol);

                var Title1 = new Ext.Net.Label();
                Title1.Text = "Destination:";
                HeaderColumn hcTitle1 = new HeaderColumn();
                hcTitle1.Component.Add(Title1);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1);

                var Title2 = new Ext.Net.Label();
                Title2.Text = "Cost Center:";
                HeaderColumn hcTitle2 = new HeaderColumn();
                hcTitle2.Component.Add(Title2);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2);

                var Title3 = new Ext.Net.Label();
                Title3.Text = "Travel Period:";
                HeaderColumn hcTitle3 = new HeaderColumn();
                hcTitle3.Component.Add(Title3);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3);

                int colc = dtall.Rows.Count / 11;
                for (int i = 0; i < colc; i++)//准备复制已有信息
                {
                    string fieldPName = "Station_" + i.ToString() + "_P";
                    //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float);
                    //Store2.Reader[0].Fields.Add(fieldPName, RecordFieldType.Float);
                    //this.Store2.AddField(field1, columncount);
                    string fieldCName = "Station_" + i.ToString() + "_C";
                    //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float);
                    //Store2.Reader[0].Fields.Add(fieldCName, RecordFieldType.Float);

                    var txtP = new Ext.Net.NumberField();
                    //txtP.Listeners.Blur.Fn = "Cal";
                    var colP = new Column();
                    colP.Header = "Person Pay";
                    colP.DataIndex = fieldPName;
                    colP.Sortable = false;
                    colP.Resizable = false;
                    colP.MenuDisabled = true;
                    colP.Width = 110;
                    colP.Editor.Add(txtP);
                    this.GridPanel2.ColumnModel.Columns.Add(colP);

                    var txtC = new Ext.Net.NumberField();
                    //txtC.Listeners.Blur.Fn = "Cal";
                    var colC = new Column();
                    colC.Header = "Company Pay";
                    colC.DataIndex = fieldCName;
                    colC.Sortable = false;
                    colC.Resizable = false;
                    colC.MenuDisabled = true;
                    colC.Width = 110;
                    colC.Editor.Add(txtC);
                    this.GridPanel2.ColumnModel.Columns.Add(colC);

                    var Station = new Ext.Net.TextField();
                    Station.Text = dtall.Rows[i * 11]["Tocity"].ToString();
                    HeaderColumn hcStation = new HeaderColumn();
                    hcStation.Component.Add(Station);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation);

                    var Button = new Ext.Net.Button();
                    Button.Text = "Remove";
                    Button.Listeners.Click.Handler = "removecol(this," + i.ToString() + ");";
                    Button.Listeners.Click.Delay = 50;
                    HeaderColumn hcButton = new HeaderColumn();
                    hcButton.Component.Add(Button);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton);

                    var CostCenter = new Ext.Net.TextField();
                    CostCenter.Disabled = true;
                    CostCenter.EmptyText = "Station Code";
                    CostCenter.Text = dtall.Rows[i * 11]["TSation"].ToString();
                    HeaderColumn hcCostCenter = new HeaderColumn();
                    hcCostCenter.Component.Add(CostCenter);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter);

                    //HeaderColumn hcCostCenter1 = new HeaderColumn();
                    //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1);
                    var ButtonGetSum = new Ext.Net.Button();
                    ButtonGetSum.Text = "Calculate";
                    ButtonGetSum.Listeners.Click.Handler = "GetSum();";
                    ButtonGetSum.Listeners.Click.Delay = 50;
                    HeaderColumn hcButtonGetSum = new HeaderColumn();
                    hcButtonGetSum.Component.Add(ButtonGetSum);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum);

                    var datefrom = new DateField();
                    string dtfroms = dtall.Rows[i * 11]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate0"].ToString()).ToString("yyyy/MM/dd");
                    datefrom.SetValue(dtfroms);
                    datefrom.EmptyText = "yyyy/MM/dd";
                    datefrom.Format = "yyyy/MM/dd";
                    HeaderColumn Date1 = new HeaderColumn();
                    Date1.Component.Add(datefrom);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1);

                    var dateto = new DateField();
                    string datetos = dtall.Rows[i * 11]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate"].ToString()).ToString("yyyy/MM/dd");
                    dateto.SetValue(datetos);
                    dateto.EmptyText = "yyyy/MM/dd";
                    dateto.Format = "yyyy/MM/dd";
                    HeaderColumn Date2 = new HeaderColumn();
                    Date2.Component.Add(dateto);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2);
                }

                var TotalP = new Ext.Net.TextField();
                TotalP.ReadOnly = true;
                TotalP.Cls = "custom-row";
                var colTotalP = new Column();
                colTotalP.DataIndex = "TotalP";
                colTotalP.Sortable = false;
                colTotalP.Resizable = false;
                colTotalP.MenuDisabled = true;
                colTotalP.Width = 110;
                colTotalP.Locked = true;
                colTotalP.Editor.Add(TotalP);
                this.GridPanel2.ColumnModel.Columns.Add(colTotalP);

                var TotalC = new Ext.Net.TextField();
                TotalC.ReadOnly = true;
                TotalC.Cls = "custom-row";
                var colTotalC = new Column();
                colTotalC.DataIndex = "TotalC";
                colTotalC.Sortable = false;
                colTotalC.Resizable = false;
                colTotalC.MenuDisabled = true;
                colTotalC.Width = 110;
                colTotalC.Locked = true;
                colTotalC.Editor.Add(TotalC);
                this.GridPanel2.ColumnModel.Columns.Add(colTotalC);

                HeaderColumn hcTotal1 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1);

                HeaderColumn hcTotal2 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2);

                HeaderColumn hcTotal3 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3);

                HeaderColumn hcTotal4 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4);

                var TitleTotalP = new Ext.Net.Label();
                TitleTotalP.Text = "Total(Person)";
                TitleTotalP.Cls = "custom-row";
                HeaderColumn hcTitleTotalP = new HeaderColumn();
                hcTitleTotalP.Component.Add(TitleTotalP);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP);

                var TitleTotalC = new Ext.Net.Label();
                TitleTotalC.Text = "Total(Comp)";
                TitleTotalC.Cls = "custom-row";
                HeaderColumn hcTitleTotalC = new HeaderColumn();
                hcTitleTotalC.Component.Add(TitleTotalC);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC);
            }
            //根据语言设置
            //string sqlp = "";
            //if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
            //{
            //    sqlp += ",[COAName]=t2.ADes";
            //}
            //else
            //{
            //    sqlp += ",[COAName]=t2.SAccountName";
            //}

            //string detailsql = "select t1.* from ETraveleDetail t1 where t1.No='" + ID + "' order by DetailCode";
            //DataTable dtdetail = new DataTable();
            //dtdetail = dbc.GetData("eReimbursement", detailsql);
            //DataTable dtnew = new DataTable();
            //dtnew.Columns.Add("DetailID", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Tocity", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("AccountCode", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Cur", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Pamount", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Camount", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("TSation", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Tdate", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Tdate0", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Type", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Department1", System.Type.GetType("System.String"));
            //for (int i = 0; i < dtdetail.Rows.Count; i++)
            //{
            //    DataRow dr = dtnew.NewRow();
            //    dr["DetailID"] = dtdetail.Rows[i]["ID"].ToString();
            //    dr["Tocity"] = dtdetail.Rows[i]["Tocity"].ToString();
            //    dr["AccountCode"] = dtdetail.Rows[i]["AccountCode"].ToString();
            //    dr["Cur"] = dtdetail.Rows[i]["Cur"].ToString();
            //    dr["Pamount"] = dtdetail.Rows[i]["Pamount"].ToString();
            //    dr["Camount"] = dtdetail.Rows[i]["Camount"].ToString();
            //    dr["TSation"] = dtdetail.Rows[i]["TSation"].ToString();
            //    dr["Tdate"] = dtdetail.Rows[i]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["Tdate"].ToString()).ToString("yyyy/MM/dd");
            //    dr["Tdate0"] = dtdetail.Rows[i]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["Tdate0"].ToString()).ToString("yyyy/MM/dd");
            //    dr["Type"] = hdStatus.Value.ToString();//传递给子页面以判断按钮状态 0:允许修改,允许上传;1:不允许修改,允许上传;2:全不允许
            //    dr["Department1"] = dtdetail.Rows[i]["Department1"].ToString();
            //    dtnew.Rows.Add(dr);
            //}
            //Store3.DataSource = dtnew;
            //Store3.DataBind();
            ////txtSum.Text = (psum + csum).ToString("#,##0.00"); hdSum.Value = (psum + csum).ToString();
            ////txtPersonalSum.Text = psum.ToString("#,##0.00"); hdPamountSum.Value = psum.ToString();
            ////txtCompanySum.Text = csum.ToString("#,##0.00"); hdCamountSum.Value = csum.ToString();
            //txtRemark.Text = dt.Rows[0]["Remark"].ToString();
            //if (dt.Rows[0]["CCMailList"].ToString() != "")
            //{
            //    ToolTipCC.Html = dt.Rows[0]["CCMailList"].ToString().Replace(",", "<br />");
            //    DataTable dtCCMailList = new DataTable();
            //    dtCCMailList.Columns.Add("Email", typeof(String));
            //    for (int i = 0; i < dt.Rows[0]["CCMailList"].ToString().Split(',').Length; i++)
            //    {
            //        DataRow dr = dtCCMailList.NewRow();
            //        dr["Email"] = dt.Rows[0]["CCMailList"].ToString().Split(',')[i];
            //        dtCCMailList.Rows.Add(dr);
            //    }
            //    StoreCCList.DataSource = dtCCMailList;
            //    StoreCCList.DataBind();
            //}
        }
Exemplo n.º 6
0
        public void AddCol(string StoreData, string header0string, string header1string, string header2string, string DSTN, string LeaveDate1, string LeaveDate2)
        {
            StoreSubmitDataEventArgs eSubmit = new StoreSubmitDataEventArgs(StoreData, null);
            XmlNode xml = eSubmit.Xml;
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml.InnerXml);
            int dtcol = doc.SelectNodes("records").Item(0).SelectNodes("record").Item(0).ChildNodes.Count;
            int colc = (dtcol - 3) / 2;
            DataTable dt = new DataTable();

            Store2.Reader[0].Fields.Add("Category", RecordFieldType.String);
            dt.Columns.Add(doc.SelectNodes("records").Item(0).SelectNodes("record").Item(0).ChildNodes[0].Name, typeof(String));
            for (int i = 0; i < (dtcol - 3) / 2; i++)
            {
                Store2.Reader[0].Fields.Add("Station_" + i.ToString() + "_P", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("Station_" + i.ToString() + "_C", RecordFieldType.String);
                dt.Columns.Add("Station_" + i.ToString() + "_P", typeof(String));
                dt.Columns.Add("Station_" + i.ToString() + "_C", typeof(String));
            }
            string fieldPNameNew = "Station_" + colc.ToString() + "_P";
            Store2.Reader[0].Fields.Add(fieldPNameNew, RecordFieldType.String);
            string fieldCNameNew = "Station_" + colc.ToString() + "_C";
            Store2.Reader[0].Fields.Add(fieldCNameNew, RecordFieldType.String);
            dt.Columns.Add(fieldPNameNew, typeof(String));
            dt.Columns.Add(fieldCNameNew, typeof(String));
            //合计列
            Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String);
            Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String);
            dt.Columns.Add("TotalP", typeof(String));
            dt.Columns.Add("TotalC", typeof(String));
            //decimal row0Psum = 0, row0Csum = 0, row1Psum = 0, row1Csum = 0, row2Psum = 0, row2Csum = 0, row3Psum = 0, row3Csum = 0, row4Psum = 0, row4Csum = 0, row5Psum = 0, row5Csum = 0, row6Psum = 0, row6Csum = 0, row7Psum = 0, row7Csum = 0, row8Psum = 0, row8Csum = 0, row9Psum = 0, row9Csum = 0, row10Psum = 0, row10Csum = 0;

            for (int i = 0; i < doc.SelectNodes("records").Item(0).SelectNodes("record").Count - 1; i++)
            {
                DataRow dr = dt.NewRow();
                dt.Rows.Add(dr);
                for (int j = 0; j < dtcol - 3; j++)
                {
                    string wr = doc.SelectNodes("records").Item(0).SelectNodes("record").Item(i).ChildNodes[j].InnerText;
                    dt.Rows[i][j] = doc.SelectNodes("records").Item(0).SelectNodes("record").Item(i).ChildNodes[j].InnerText;
                }
            }
            dt.Rows.Add(dt.NewRow());
            dt.Rows[11][0] = "Total";
            for (int i = 0; i < 11; i++)
            {
                for (int j = 1; j < dtcol - 3; j++)
                {
                    if (j % 2 == 1)
                    {
                        dt.Rows[i][dtcol - 1] = (Convert.ToDecimal(dt.Rows[i][dtcol - 1].ToString() == "" ? "0" : dt.Rows[i][dtcol - 1].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[i][dtcol - 1].ToString() == "" ? "0" : dt.Rows[i][dtcol - 1].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString();
                        dt.Rows[11][dtcol - 1] = (Convert.ToDecimal(dt.Rows[11][dtcol - 1].ToString() == "" ? "0" : dt.Rows[11][dtcol - 1].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[11][dtcol - 1].ToString() == "" ? "0" : dt.Rows[11][dtcol - 1].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString();
                    }
                    else
                    {
                        dt.Rows[i][dtcol] = (Convert.ToDecimal(dt.Rows[i][dtcol].ToString() == "" ? "0" : dt.Rows[i][dtcol].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[i][dtcol].ToString() == "" ? "0" : dt.Rows[i][dtcol].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString();
                        dt.Rows[11][dtcol] = (Convert.ToDecimal(dt.Rows[11][dtcol].ToString() == "" ? "0" : dt.Rows[11][dtcol].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[11][dtcol].ToString() == "" ? "0" : dt.Rows[11][dtcol].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString();
                    }
                    dt.Rows[11][j] = (Convert.ToDecimal(dt.Rows[11][j].ToString() == "" ? "0" : dt.Rows[11][j].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[11][j].ToString() == "" ? "0" : dt.Rows[11][j].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString();
                }
            }

            Store2.DataSource = dt;
            Store2.DataBind();

            var TitleCol = new Column();
            TitleCol.DataIndex = "Category";
            TitleCol.Sortable = false;
            TitleCol.Resizable = false;
            TitleCol.MenuDisabled = true;
            TitleCol.Width = 180;
            this.GridPanel2.ColumnModel.Columns.Add(TitleCol);

            var Title1 = new Ext.Net.Label();
            Title1.Text = "Destination:";
            HeaderColumn hcTitle1 = new HeaderColumn();
            hcTitle1.Component.Add(Title1);
            this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1);

            var Title2 = new Ext.Net.Label();
            Title2.Text = "Cost Center:";
            HeaderColumn hcTitle2 = new HeaderColumn();
            hcTitle2.Component.Add(Title2);
            this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2);

            var Title3 = new Ext.Net.Label();
            Title3.Text = "Travel Period:";
            HeaderColumn hcTitle3 = new HeaderColumn();
            hcTitle3.Component.Add(Title3);
            this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3);
            //取得出差站点列表
            DataSet GetCityInfo = DIMERCO.SDK.Utilities.LSDK.GetCityInfo("", 8000);
            DataTable dtstation = GetCityInfo.Tables[0];
            //取得成本中心列表
            DataSet GetCCInfo = DIMERCO.SDK.Utilities.LSDK.getCostCenterBYStationCode("", 8000);
            DataTable dtCC = GetCCInfo.Tables[0];
            for (int i = 0; i < colc; i++)//准备复制已有信息
            {
                string fieldPName = "Station_" + i.ToString() + "_P";
                //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float);
                //Store2.Reader[0].Fields.Add(fieldPName, RecordFieldType.Float);
                //this.Store2.AddField(field1, columncount);
                string fieldCName = "Station_" + i.ToString() + "_C";
                //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float);
                //Store2.Reader[0].Fields.Add(fieldCName, RecordFieldType.Float);

                var txtP = new Ext.Net.NumberField();
                //txtP.Listeners.Blur.Fn = "Cal";
                var colP = new Column();
                colP.Header = "Person Pay";
                colP.DataIndex = fieldPName;
                colP.Sortable = false;
                colP.Resizable = false;
                colP.MenuDisabled = true;
                colP.Width = 110;
                colP.Editor.Add(txtP);
                this.GridPanel2.ColumnModel.Columns.Add(colP);

                var txtC = new Ext.Net.NumberField();
                //txtC.Listeners.Blur.Fn = "Cal";
                var colC = new Column();
                colC.Header = "Company Pay";
                colC.DataIndex = fieldCName;
                colC.Sortable = false;
                colC.Resizable = false;
                colC.MenuDisabled = true;
                colC.Width = 110;
                colC.Editor.Add(txtC);
                this.GridPanel2.ColumnModel.Columns.Add(colC);

                var Station = new Ext.Net.TextField();
                if (header0string.Split(',')[i] != "NA")
                {
                    Station.Text = header0string.Split(',')[i];
                }
                HeaderColumn hcStation = new HeaderColumn();
                hcStation.Component.Add(Station);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation);


                var Button = new Ext.Net.Button();
                Button.Text = "Remove";
                Button.Listeners.Click.Handler = "removecol(this," + i.ToString() + ");";
                Button.Listeners.Click.Delay = 50;
                HeaderColumn hcButton = new HeaderColumn();
                hcButton.Component.Add(Button);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton);

                var CostCenter = new Ext.Net.TextField();
                CostCenter.Disabled = true;
                CostCenter.EmptyText = "Station Code";
                if (header1string.Split(',')[i] != "NA")
                {
                    CostCenter.Text = header1string.Split(',')[i];
                }
                HeaderColumn hcCostCenter = new HeaderColumn();
                hcCostCenter.Component.Add(CostCenter);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter);

                var ButtonGetSum = new Ext.Net.Button();
                ButtonGetSum.Text = "Calculate";
                ButtonGetSum.Listeners.Click.Handler = "GetSum();";
                ButtonGetSum.Listeners.Click.Delay = 50;
                HeaderColumn hcButtonGetSum = new HeaderColumn();
                hcButtonGetSum.Component.Add(ButtonGetSum);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum);

                var datefrom = new DateField();
                if (header2string.Split(',')[i * 2] != "NA")
                {
                    datefrom.SetValue(header2string.Split(',')[i * 2]);
                }
                datefrom.EmptyText = "yyyy/MM/dd";
                datefrom.Format = "yyyy/MM/dd";
                HeaderColumn Date1 = new HeaderColumn();
                Date1.Component.Add(datefrom);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1);

                var dateto = new DateField();
                if (header2string.Split(',')[i * 2 + 1] != "NA")
                {
                    dateto.SetValue(header2string.Split(',')[i * 2 + 1]);
                }
                dateto.EmptyText = "yyyy/MM/dd";
                dateto.Format = "yyyy/MM/dd";
                HeaderColumn Date2 = new HeaderColumn();
                Date2.Component.Add(dateto);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2);
            }



            var txtPNew = new Ext.Net.NumberField();
            //txtPNew.Listeners.Blur.Fn = "Cal";
            var colPNew = new Column();
            colPNew.Header = "Person Pay";
            colPNew.DataIndex = fieldPNameNew;
            colPNew.Sortable = false;
            colPNew.Resizable = false;
            colPNew.MenuDisabled = true;
            colPNew.Width = 110;
            colPNew.Editor.Add(txtPNew);
            this.GridPanel2.ColumnModel.Columns.Add(colPNew);

            var txtCNew = new Ext.Net.NumberField();
            //txtCNew.Listeners.Blur.Fn = "Cal";
            var colCNew = new Column();
            colCNew.Header = "Company Pay";
            colCNew.DataIndex = fieldCNameNew;
            colCNew.Sortable = false;
            colCNew.Resizable = false;
            colCNew.MenuDisabled = true;
            colCNew.Width = 110;
            colCNew.Editor.Add(txtCNew);
            this.GridPanel2.ColumnModel.Columns.Add(colCNew);

            var TotalP = new Ext.Net.TextField();
            TotalP.ReadOnly = true;
            TotalP.Cls = "custom-row";
            var colTotalP = new Column();
            colTotalP.DataIndex = "TotalP";
            colTotalP.Sortable = false;
            colTotalP.Resizable = false;
            colTotalP.MenuDisabled = true;
            colTotalP.Width = 110;
            colTotalP.Locked = true;
            colTotalP.Editor.Add(TotalP);
            this.GridPanel2.ColumnModel.Columns.Add(colTotalP);

            var TotalC = new Ext.Net.TextField();
            TotalC.ReadOnly = true;
            TotalC.Cls = "custom-row";
            var colTotalC = new Column();
            colTotalC.DataIndex = "TotalC";
            colTotalC.Sortable = false;
            colTotalC.Resizable = false;
            colTotalC.MenuDisabled = true;
            colTotalC.Width = 110;
            colTotalC.Locked = true;
            colTotalC.Editor.Add(TotalC);
            this.GridPanel2.ColumnModel.Columns.Add(colTotalC);

            var StationNew = new Ext.Net.TextField();
            StationNew.Text = DSTN;
            HeaderColumn hcStationNew = new HeaderColumn();
            hcStationNew.Component.Add(StationNew);
            this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStationNew);


            var ButtonNew = new Ext.Net.Button();
            ButtonNew.Text = "Remove";
            ButtonNew.Listeners.Click.Handler = "removecol(this," + colc.ToString() + ");";
            ButtonNew.Listeners.Click.Delay = 50;
            HeaderColumn hcButtonNew = new HeaderColumn();
            hcButtonNew.Component.Add(ButtonNew);
            this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButtonNew);

            HeaderColumn hcTotal1 = new HeaderColumn();
            this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1);

            HeaderColumn hcTotal2 = new HeaderColumn();
            this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2);

            var CostCenterNew = new Ext.Net.TextField();
            CostCenterNew.Disabled = true;
            CostCenterNew.EmptyText = "Station Code";
            HeaderColumn hcCostCenterNew = new HeaderColumn();
            hcCostCenterNew.Component.Add(CostCenterNew);
            this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenterNew);


            //HeaderColumn hcCostCenter1New = new HeaderColumn();
            //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1New);
            var ButtonGetSumNew = new Ext.Net.Button();
            ButtonGetSumNew.Text = "Calculate";
            ButtonGetSumNew.Listeners.Click.Handler = "GetSum();";
            ButtonGetSumNew.Listeners.Click.Delay = 50;
            HeaderColumn hcButtonGetSumNew = new HeaderColumn();
            hcButtonGetSumNew.Component.Add(ButtonGetSumNew);
            this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSumNew);

            HeaderColumn hcTotal3 = new HeaderColumn();
            this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3);

            HeaderColumn hcTotal4 = new HeaderColumn();
            this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4);

            var dateFromNew = new DateField();
            dateFromNew.EmptyText = "yyyy/MM/dd";
            dateFromNew.Format = "yyyy/MM/dd";
            dateFromNew.SetValue(LeaveDate1);
            HeaderColumn Date1New = new HeaderColumn();
            Date1New.Component.Add(dateFromNew);
            this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1New);

            var datetoNew = new DateField();
            datetoNew.EmptyText = "yyyy/MM/dd";
            datetoNew.Format = "yyyy/MM/dd";
            datetoNew.SetValue(LeaveDate2);
            HeaderColumn Date2New = new HeaderColumn();
            Date2New.Component.Add(datetoNew);
            this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2New);

            var TitleTotalP = new Ext.Net.Label();
            TitleTotalP.Text = "Total(Person)";
            TitleTotalP.Cls = "custom-row";
            HeaderColumn hcTitleTotalP = new HeaderColumn();
            hcTitleTotalP.Component.Add(TitleTotalP);
            this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP);

            var TitleTotalC = new Ext.Net.Label();
            TitleTotalC.Text = "Total(Comp)";
            TitleTotalC.Cls = "custom-row";
            HeaderColumn hcTitleTotalC = new HeaderColumn();
            hcTitleTotalC.Component.Add(TitleTotalC);
            this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC);

            //HeaderColumn hcTotal5 = new HeaderColumn();
            //this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTotal5);

            //HeaderColumn hcTotal6 = new HeaderColumn();
            //this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTotal6);
            this.GridPanel2.Render();
            //Store store2 = this.GridPanel2.GetStore();



            //this.GridPanel2.RefreshView();
            GridPanel2.Reconfigure();
            //string last = (dtcol - 1).ToString();
            //string sf = "$(\"#\"+$('#GridPanel2 .x-grid3-col-" + last + " input')[0].id).css('font-weight','bold')";
            //X.AddScript(sf);
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //string station = ""; string department = "";
            //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList("A0182");
            //if (ds1.Tables[0].Rows.Count == 1)
            //{
            //    DataTable dt1 = ds1.Tables[0];
            //    station = dt1.Rows[0]["stationCode"].ToString();
            //    department = dt1.Rows[0]["CRPDepartmentName"].ToString();
            //}
            if (!X.IsAjaxRequest)
            {
                
                //判断登录状态
                cs.DBCommand dbc = new cs.DBCommand();
                if (Request.Cookies.Get("eReimUserID") == null)
                {
                    X.AddScript("loginWindow.show();Panel1.disable();");
                    return;
                }
                else
                {
                    hdUser.Value = Request.Cookies.Get("eReimUserID").Value;
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Request.Cookies.Get("eReimUserName").Value + "');", true);
                    X.AddScript("loginWindow.hide();Panel1.enable();");


                    if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                    {
                        ResourceManager1.Locale = "zh-CN";
                    }
                    else
                    {
                        ResourceManager1.Locale = "en-US";
                    }
                }

                //hdStatus.Value = "0";

                if (Request.QueryString["ID"] != null)//判断链接地址是否正确
                {
                    string ID = Request.QueryString["ID"].ToString();
                    System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$");
                    if (reg1.IsMatch(ID))
                    {
                        string sql = "select * from V_Eflow_ETravel where RequestID='" + ID + "' and [Type]='T' and (Active=1 or Active=2)";

                        DataTable dt = new DataTable();
                        dt = dbc.GetData("eReimbursement", sql);

                        if (dt != null && dt.Rows.Count == 1)
                        {

                            if (Request.Cookies.Get("eReimUserID").Value == dt.Rows[0]["PersonID"].ToString())//本人
                            {
                                ////准备下拉菜单内容
                                //Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value);
                                //cbxOwner.Items.Add(li);
                                //string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'";
                                //DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                                //int itemcount = 0;
                                //for (int j = 0; j < dtitem.Rows.Count; j++)
                                //{
                                //    string sqlpara = sqlitem;
                                //    if (dtitem.Rows[j][5].ToString() != "")
                                //    {
                                //        sqlpara += " and getdate()>='" + dtitem.Rows[j][5].ToString() + "' ";
                                //    }
                                //    if (dtitem.Rows[j][6].ToString() != "")
                                //    {
                                //        sqlpara += " and getdate()<='" + dtitem.Rows[j][6].ToString() + "' ";
                                //    }
                                //    DataTable dtitem1 = dbc.GetData("eReimbursement", sqlpara);
                                //    for (int m = 0; m < dtitem1.Rows.Count; m++)
                                //    {
                                //        li = new Ext.Net.ListItem(dtitem.Rows[m][1].ToString(), dtitem.Rows[m][2].ToString());
                                //        cbxOwner.Items.Add(li);
                                //        itemcount++;
                                //    }
                                //}
                                //更改按钮状态
                                if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                {
                                    if (Request.QueryString["Copy"] != null)
                                    {
                                        if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                        {
                                            X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();");
                                        }
                                        else
                                        {
                                            ErrorHandle("Data Error.");
                                        }
                                    }
                                    else//已申请数据
                                    {
                                        string app = "";
                                        if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                        {
                                            Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString();
                                            //读取当前状态,显示在下方文本框内

                                            if (dt.Rows[0]["Status"].ToString() == "1")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "2")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "3")
                                            {
                                                app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }

                                            if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                            {
                                                //hdStatus.Value = "2";
                                                app += ". 完成.";
                                                X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                            }
                                            else//待审批
                                            {
                                                //hdStatus.Value = "1";
                                                X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();");
                                            }

                                        }
                                        else
                                        {
                                            Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString();
                                            //读取当前状态,显示在下方文本框内

                                            if (dt.Rows[0]["Status"].ToString() == "1")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "2")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }
                                            else if (dt.Rows[0]["Status"].ToString() == "3")
                                            {
                                                app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                            }

                                            if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                            {
                                                //hdStatus.Value = "2";
                                                app += ". Complete.";
                                                X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                            }
                                            else//待审批
                                            {
                                                //hdStatus.Value = "1";
                                                X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();");
                                            }
                                        }
                                        labelInfo.Text = app;
                                    }
                                }
                                else//草稿
                                {
                                    if (Request.QueryString["Copy"] != null)
                                    {
                                        if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                        {
                                            X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();");
                                        }
                                        else
                                        {
                                            ErrorHandle("Data Error.");
                                        }
                                    }
                                    else
                                    {
                                        if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                        {
                                            Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString();
                                        }
                                        else
                                        {
                                            Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString();
                                        }

                                        X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();");
                                    }
                                }
                                //载入通用数据
                                LoadData(dt, true);
                            }
                            else
                            {
                                //判断是否为代理人
                                bool isagent = false;//记录Session["UserID"]是否为代理人
                                string sqlagent = "select * from Eagent where [St]=1 and [OwnerID]='" + dt.Rows[0]["PersonID"].ToString() + "' and getdate()<=Edate and getdate()>=Bdate";
                                DataTable dtagent = dbc.GetData("eReimbursement", sqlagent);
                                for (int g = 0; g < dtagent.Rows.Count; g++)
                                {
                                    if (Request.Cookies.Get("eReimUserID").Value == dtagent.Rows[g]["PAgentID"].ToString())
                                    {
                                        isagent = true;
                                        break;
                                    }
                                }
                                if (isagent)//代理人访问
                                {
                                    //Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString());
                                    //cbxOwner.Items.Add(li);
                                    //更改按钮状态
                                    if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                    {
                                        if (Request.QueryString["Copy"] != null)
                                        {
                                            if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                            {
                                                X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();");
                                            }
                                            else
                                            {
                                                ErrorHandle("Data Error.");
                                            }
                                        }
                                        else
                                        {
                                            string app = "";
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    //hdStatus.Value = "2";
                                                    app += ". 完成.";
                                                    X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                                }
                                                else//待审批
                                                {
                                                    //hdStatus.Value = "1";
                                                    X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();");
                                                }

                                            }
                                            else
                                            {
                                                Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    //hdStatus.Value = "2";
                                                    app += ". Complete.";
                                                    X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                                }
                                                else//待审批
                                                {
                                                    //hdStatus.Value = "1";
                                                    X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();");
                                                }
                                            }
                                            labelInfo.Text = app;
                                        }
                                    }
                                    else//草稿
                                    {
                                        if (Request.QueryString["Copy"] != null)
                                        {
                                            if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增
                                            {
                                                X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();");
                                            }
                                            else
                                            {
                                                ErrorHandle("Data Error.");
                                            }
                                        }
                                        else
                                        {
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString();
                                            }
                                            else
                                            {
                                                Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString();
                                            }
                                            X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();");
                                        }
                                    }
                                    //载入通用数据
                                    LoadData(dt, true);
                                }
                                else//判断是否有跨站权限
                                {

                                    bool hasright = false;
                                    string getright = "select * from StationRole where UserID='" + Request.Cookies.Get("eReimUserID").Value + "'";
                                    DataTable dtright = dbc.GetData("eReimbursement", getright);
                                    for (int j = 0; j < dtright.Rows.Count; j++)
                                    {
                                        string[] dd = dtright.Rows[j]["Stations"].ToString().Split(',');
                                        for (int i = 0; i < dd.Length; i++)
                                        {
                                            if (dd[i] == dt.Rows[0]["Station"].ToString())//有权限
                                            {
                                                hasright = true;
                                                break;
                                            }
                                        }
                                    }
                                    if (hasright)
                                    {
                                        //Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString());
                                        //cbxOwner.Items.Add(li);
                                        //更改按钮状态
                                        if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单
                                        {
                                            string app = "";
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    //hdStatus.Value = "2";
                                                    app += ". 完成.";
                                                    X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                                }
                                                else//待审批
                                                {
                                                    //hdStatus.Value = "1";
                                                    X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();");
                                                }

                                            }
                                            else
                                            {
                                                Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString();
                                                //读取当前状态,显示在下方文本框内

                                                if (dt.Rows[0]["Status"].ToString() == "1")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString();
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "2")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }
                                                else if (dt.Rows[0]["Status"].ToString() == "3")
                                                {
                                                    app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                    app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm");
                                                }

                                                if (dt.Rows[0]["Active"].ToString() == "2")//已完成
                                                {
                                                    //hdStatus.Value = "2";
                                                    app += ". Complete.";
                                                    X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();");
                                                }
                                                else//待审批
                                                {
                                                    //hdStatus.Value = "1";
                                                    X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();");
                                                }
                                            }
                                            labelInfo.Text = app;
                                        }
                                        else//草稿
                                        {
                                            if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                                            {
                                                Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString();
                                            }
                                            else
                                            {
                                                Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString();
                                            }

                                            //X.AddScript("btnSaveAndSend.enable();");
                                        }
                                        //hdStatus.Value = "2";//不允许传递到子页面时修改或者上传
                                        X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();");
                                        //无需判断Copy
                                        //载入通用数据
                                        LoadData(dt, false);
                                    }
                                    else
                                    {
                                        ErrorHandle("No right.");
                                    }
                                }
                            }
                        }
                        else
                        {
                            ErrorHandle("Data Error.");
                        }
                    }
                    else
                    {
                        ErrorHandle("Data Error.");
                    }
                }
                else//新增申请
                {
                    ////准备下拉菜单内容
                    //Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value);
                    //cbxOwner.Items.Add(li);
                    //string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'";
                    //DataTable dtitem = dbc.GetData("eReimbursement", sqlitem);
                    //for (int j = 0; j < dtitem.Rows.Count; j++)
                    //{
                    //    string sqlpara = sqlitem;
                    //    bool d1 = true;
                    //    bool d2 = false;
                    //    if (dtitem.Rows[j][5].ToString() != "")
                    //    {
                    //        //sqlpara += " and getdate()>='" + dtitem.Rows[j]["Bdate"].ToString() + "' ";
                    //        if (DateTime.Now >= Convert.ToDateTime(dtitem.Rows[j][5].ToString()))
                    //        {
                    //            d1 = true;
                    //        }
                    //        else
                    //        {
                    //            d1 = false;
                    //        }
                    //    }
                    //    if (dtitem.Rows[j][6].ToString() != "")
                    //    {
                    //        //sqlpara += " and getdate()<='" + dtitem.Rows[j]["Edate"].ToString() + "' ";
                    //        if (DateTime.Now <= Convert.ToDateTime(dtitem.Rows[j][6].ToString()))
                    //        {
                    //            d2 = true;
                    //        }
                    //        else
                    //        {
                    //            d2 = false;
                    //        }
                    //    }
                    //    if (d1 && d2)
                    //    {
                    //        li = new Ext.Net.ListItem(dtitem.Rows[j]["Owner"].ToString(), dtitem.Rows[j]["OwnerID"].ToString());
                    //        cbxOwner.Items.Add(li);
                    //    }
                    //}
                    ////新增记录时,默认为登录用户
                    //cbxOwner.SelectedItem.Value = Request.Cookies.Get("eReimUserID").Value;
                    //cbxOwner.SelectedItem.Text = Request.Cookies.Get("eReimUserName").Value;
                    //hdOwner.Value = Request.Cookies.Get("eReimUserName").Value;
                    //hdOwnerID.Value = Request.Cookies.Get("eReimUserID").Value;
                    //labelOwner.Text = Request.Cookies.Get("eReimUserName").Value;

                    //labelStation.Text = Request.Cookies.Get("eReimStation").Value;
                    //labelDepartment.Text = Request.Cookies.Get("eReimDepartment").Value;
                    //LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(Request.Cookies.Get("eReimCostCenter").Value);
                    //LabelText.Text = "Please load eLeave Data.";
                    

                    ////检查是否已经为该申请人设置过审批人
                    //string sqlCheckFlow = "";
                    //sqlCheckFlow = "select * from GroupFlow where [Type]!=2 and GID=(select GID from GroupUsers where UserID='" + Request.Cookies.Get("eReimUserID").Value + "')";
                    //DataTable dtGroupFlowData = dbc.GetData("eReimbursement", sqlCheckFlow);
                    //if (dtGroupFlowData.Rows.Count < 1)
                    //{
                    //    if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
                    //    {
                    //        ErrorHandle("请先设置审批人.");
                    //    }
                    //    else
                    //    {
                    //        ErrorHandle("Not set Approve flow,please contact with Local MIS.");
                    //    }
                    //    return;
                    //}
                    X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();");
                    DataTable dttest = new DataTable();
                    Store2.Reader[0].Fields.Add("Category", RecordFieldType.String);
                    dttest.Columns.Add("Category", typeof(String));
                    string fieldPName = "Station_0_P";
                    Store2.Reader[0].Fields.Add(fieldPName, RecordFieldType.String);
                    string fieldCName = "Station_0_C";
                    Store2.Reader[0].Fields.Add(fieldCName, RecordFieldType.String);
                    dttest.Columns.Add("Station_0_P", typeof(String));
                    dttest.Columns.Add("Station_0_C", typeof(String));
                    //
                    Store2.Reader[0].Fields.Add("Station_1_P", RecordFieldType.String);
                    Store2.Reader[0].Fields.Add("Station_1_C", RecordFieldType.String);
                    dttest.Columns.Add("Station_1_P", typeof(String));
                    dttest.Columns.Add("Station_1_C", typeof(String));

                    //合计列
                    Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String);
                    Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String);
                    dttest.Columns.Add("TotalP", typeof(String));
                    dttest.Columns.Add("TotalC", typeof(String));

                    DataRow dr = dttest.NewRow();
                    dr[0] = "1. Air Ticket - Int'l";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "Air Ticket - Domestic";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "2. Hotel Bill";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "3. Meals";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "4. Entertainment";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "5. Car Rental/Transportation";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "6. Communication";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "7. Local Trip Allowance";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "8. Overseas Trip Allowance";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "9. Airport Tax/Travel Insurance";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "10. Others";
                    dttest.Rows.Add(dr);

                    dr = dttest.NewRow();
                    dr[0] = "Total";
                    dttest.Rows.Add(dr);

                    Store2.DataSource = dttest;
                    Store2.DataBind();


                    var TitleCol = new Column();
                    TitleCol.DataIndex = "Category";
                    TitleCol.Sortable = false;
                    TitleCol.Resizable = false;
                    TitleCol.MenuDisabled = true;
                    TitleCol.Width = 180;
                    this.GridPanel2.ColumnModel.Columns.Add(TitleCol);

                    var txtP = new Ext.Net.NumberField();
                    //txtP.Listeners.Blur.Fn = "Cal";
                    //txtP.Listeners.Blur.Delay = 50;
                    var colP = new Column();
                    colP.Header = "Person Pay";
                    colP.DataIndex = fieldPName;
                    colP.Sortable = false;
                    colP.Resizable = false;
                    colP.MenuDisabled = true;
                    colP.Width = 110;
                    colP.Locked = true;
                    colP.Editor.Add(txtP);
                    this.GridPanel2.ColumnModel.Columns.Add(colP);

                    var txtC = new Ext.Net.NumberField();
                    //txtC.Listeners.Blur.Fn = "Cal";
                    //txtC.Listeners.Blur.Delay = 50;
                    var colC = new Column();
                    colC.Header = "Company Pay";
                    colC.DataIndex = fieldCName;
                    colC.Sortable = false;
                    colC.Resizable = false;
                    colC.MenuDisabled = true;
                    colC.Width = 110;
                    colP.Locked = true;
                    colC.Editor.Add(txtC);
                    this.GridPanel2.ColumnModel.Columns.Add(colC);
                    //
                    var txtP1 = new Ext.Net.NumberField();
                    //txtP1.Listeners.Blur.Fn = "Cal";
                    //txtP1.Listeners.Blur.Delay = 50;
                    var colP1 = new Column();
                    colP1.Header = "Person Pay";
                    colP1.DataIndex = "Station_1_P";
                    colP1.Sortable = false;
                    colP1.Resizable = false;
                    colP1.MenuDisabled = true;
                    colP1.Width = 110;
                    colP1.Locked = true;
                    colP1.Editor.Add(txtP1);
                    colP1.Hidden = true;
                    this.GridPanel2.ColumnModel.Columns.Add(colP1);

                    var txtC1 = new Ext.Net.NumberField();
                    //txtC1.Listeners.Blur.Fn = "Cal";
                    //txtC1.Listeners.Blur.Delay = 50;
                    var colC1 = new Column();
                    colC1.Header = "Company Pay";
                    colC1.DataIndex = "Station_1_C";
                    colC1.Sortable = false;
                    colC1.Resizable = false;
                    colC1.MenuDisabled = true;
                    colC1.Width = 110;
                    colC1.Locked = true;
                    colC1.Editor.Add(txtC1);
                    colC1.Hidden = true;
                    this.GridPanel2.ColumnModel.Columns.Add(colC1);
                    //
                    var TotalP = new Ext.Net.TextField();
                    TotalP.ReadOnly = true;
                    var colTotalP = new Column();
                    colTotalP.DataIndex = "TotalP";
                    colTotalP.Sortable = false;
                    colTotalP.Resizable = false;
                    colTotalP.MenuDisabled = true;
                    colTotalP.Width = 110;
                    colTotalP.Locked = true;
                    colTotalP.Editor.Add(TotalP);
                    this.GridPanel2.ColumnModel.Columns.Add(colTotalP);

                    var TotalC = new Ext.Net.TextField();
                    TotalC.ReadOnly = true;
                    var colTotalC = new Column();
                    colTotalC.DataIndex = "TotalC";
                    colTotalC.Sortable = false;
                    colTotalC.Resizable = false;
                    colTotalC.MenuDisabled = true;
                    colTotalC.Width = 110;
                    colTotalC.Locked = true;
                    colTotalC.Editor.Add(TotalC);
                    this.GridPanel2.ColumnModel.Columns.Add(colTotalC);

                    var Title1 = new Ext.Net.Label();
                    Title1.Text = "Destination:";
                    HeaderColumn hcTitle1 = new HeaderColumn();
                    hcTitle1.Component.Add(Title1);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1);

                    var Station = new Ext.Net.TextField();
                    HeaderColumn hcStation = new HeaderColumn();
                    hcStation.Component.Add(Station);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation);
                    //var Station = new Ext.Net.ComboBox();
                    //Station.DisplayField = "CityCode";
                    //Station.ValueField = "CityCode";
                    //Station.TypeAhead = true;
                    //Station.ForceSelection = true;
                    //Station.MinChars = 2;
                    //Station.Mode = DataLoadMode.Local;
                    //var storeStation = new Ext.Net.Store();
                    //storeStation.Reader.Add(new Ext.Net.JsonReader());
                    //DataSet GetCityInfo = DIMERCO.SDK.Utilities.LSDK.GetCityInfo("", 8000);
                    //DataTable dtstation = GetCityInfo.Tables[0];
                    //storeStation.Reader[0].Fields.Add("CityCode", RecordFieldType.String);
                    //Station.Store.Add(storeStation);
                    //storeStation.DataSource = dtstation;
                    //storeStation.DataBind();
                    //HeaderColumn hcStation = new HeaderColumn();
                    //hcStation.Component.Add(Station);
                    //this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation);

                    var Button = new Ext.Net.Button();
                    Button.Text = "Remove";
                    Button.Listeners.Click.Handler = "removecol(this,0);";
                    Button.Listeners.Click.Delay = 50;
                    HeaderColumn hcButton = new HeaderColumn();
                    hcButton.Component.Add(Button);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton);
                    //
                    var Station1 = new Ext.Net.TextField();
                    HeaderColumn hcStation1 = new HeaderColumn();
                    hcStation1.Component.Add(Station1);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation1);
                    //var Station1 = new Ext.Net.ComboBox();
                    //Station1.DisplayField = "CityCode";
                    //Station1.ValueField = "CityCode";
                    //Station1.TypeAhead = true;
                    //Station1.MinChars = 2;
                    //Station1.ForceSelection = true;
                    //Station1.Mode = DataLoadMode.Local;
                    //var storeStation1 = new Ext.Net.Store();
                    //storeStation1.Reader.Add(new Ext.Net.JsonReader());
                    //DataTable dtStation1 = new DataTable();
                    //dtStation1.Columns.Add("CityCode", typeof(String));
                    //for (int i = 0; i < 20; i++)
                    //{
                    //    DataRow dr2 = dtStation1.NewRow();
                    //    if (i < 5)
                    //    {
                    //        dr2[0] = "CN" + i.ToString();
                    //    }
                    //    else if (i >= 5 && i < 10)
                    //    {
                    //        dr2[0] = "GCR" + i.ToString();
                    //    }
                    //    else
                    //    {
                    //        dr2[0] = "CRP" + i.ToString();
                    //    }
                    //    dtStation1.Rows.Add(dr2);
                    //}
                    //storeStation1.Reader[0].Fields.Add("CityCode", RecordFieldType.String);
                    //Station1.Store.Add(storeStation1);
                    //storeStation1.DataSource = dtstation;
                    //storeStation1.DataBind();
                    //HeaderColumn hcStation1 = new HeaderColumn();
                    //hcStation1.Component.Add(Station1);
                    //this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation1);

                    var Button1 = new Ext.Net.Button();
                    Button1.Text = "Remove";
                    Button1.Listeners.Click.Handler = "removecol(this,1);";
                    Button1.Listeners.Click.Delay = 50;
                    HeaderColumn hcButton1 = new HeaderColumn();
                    hcButton1.Component.Add(Button1);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton1);
                    //
                    HeaderColumn hcTotal1 = new HeaderColumn();
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1);

                    HeaderColumn hcTotal2 = new HeaderColumn();
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2);


                    var Title2 = new Ext.Net.Label();
                    Title2.Text = "Cost Center:";
                    HeaderColumn hcTitle2 = new HeaderColumn();
                    hcTitle2.Component.Add(Title2);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2);

                    var CostCenter = new Ext.Net.TextField();
                    CostCenter.Disabled = true;
                    CostCenter.EmptyText = "Station Code";
                    HeaderColumn hcCostCenter = new HeaderColumn();
                    hcCostCenter.Component.Add(CostCenter);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter);
                    //var CostCenter = new Ext.Net.ComboBox();
                    //CostCenter.DisplayField = "StationCode";
                    //CostCenter.ValueField = "StationCode";
                    //CostCenter.TypeAhead = true;
                    //CostCenter.ForceSelection = true;
                    //CostCenter.MinChars = 2;
                    //CostCenter.Mode = DataLoadMode.Local;
                    //var storeCostCenter = new Ext.Net.Store();
                    //storeCostCenter.Reader.Add(new Ext.Net.JsonReader());
                    //DataSet GetCostCenterInfo = DIMERCO.SDK.Utilities.LSDK.getCostCenterBYStationCode("", 8000);
                    //DataTable dtCostCenter = GetCostCenterInfo.Tables[0];
                    //storeCostCenter.Reader[0].Fields.Add("StationCode", RecordFieldType.String);
                    //CostCenter.Store.Add(storeCostCenter);
                    //storeCostCenter.DataSource = dtCostCenter;
                    //storeCostCenter.DataBind();
                    //HeaderColumn hcCostCenter = new HeaderColumn();
                    //hcCostCenter.Component.Add(CostCenter);
                    //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter);

                    //HeaderColumn hcCostCenter1 = new HeaderColumn();
                    //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1);
                    var ButtonGetSum = new Ext.Net.Button();
                    ButtonGetSum.Text = "Calculate";
                    ButtonGetSum.Listeners.Click.Handler = "GetSum();";
                    ButtonGetSum.Listeners.Click.Delay = 50;
                    HeaderColumn hcButtonGetSum = new HeaderColumn();
                    hcButtonGetSum.Component.Add(ButtonGetSum);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum);
                    //
                    var CostCenter0 = new Ext.Net.TextField();
                    CostCenter0.Disabled = true;
                    CostCenter0.EmptyText = "Station Code";
                    HeaderColumn hcCostCenter0 = new HeaderColumn();
                    hcCostCenter0.Component.Add(CostCenter0);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter0);
                    //var CostCenter1 = new Ext.Net.ComboBox();
                    //CostCenter1.DisplayField = "StationCode";
                    //CostCenter1.ValueField = "StationCode";
                    //CostCenter1.TypeAhead = true;
                    //CostCenter1.ForceSelection = true;
                    //CostCenter1.MinChars = 2;
                    //CostCenter1.Mode = DataLoadMode.Local;
                    //var storeCostCenter1 = new Ext.Net.Store();
                    //storeCostCenter1.Reader.Add(new Ext.Net.JsonReader());
                    //storeCostCenter1.Reader[0].Fields.Add("StationCode", RecordFieldType.String);
                    //CostCenter1.Store.Add(storeCostCenter1);
                    //storeCostCenter1.DataSource = dtCostCenter;
                    //storeCostCenter1.DataBind();
                    //HeaderColumn hcCostCenter1 = new HeaderColumn();
                    //hcCostCenter1.Component.Add(CostCenter1);
                    //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1);

                    //HeaderColumn hcCostCenter01 = new HeaderColumn();
                    //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter01);
                    var ButtonGetSum1 = new Ext.Net.Button();
                    ButtonGetSum1.Text = "Calculate";
                    ButtonGetSum1.Listeners.Click.Handler = "GetSum();";
                    ButtonGetSum1.Listeners.Click.Delay = 50;
                    HeaderColumn hcButtonGetSum1 = new HeaderColumn();
                    hcButtonGetSum1.Component.Add(ButtonGetSum1);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum1);
                    //
                    HeaderColumn hcTotal3 = new HeaderColumn();
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3);

                    HeaderColumn hcTotal4 = new HeaderColumn();
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4);

                    var Title3 = new Ext.Net.Label();
                    Title3.Text = "Travel Period:";
                    HeaderColumn hcTitle3 = new HeaderColumn();
                    hcTitle3.Component.Add(Title3);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3);

                    HeaderColumn hcDate1 = new HeaderColumn();
                    var Date1 = new DateField();
                    Date1.EmptyText = "yyyy/MM/dd";
                    Date1.Format = "yyyy/MM/dd";
                    //Date1.SetValue("2013/11/1");
                    hcDate1.Component.Add(Date1);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate1);

                    HeaderColumn hcDate2 = new HeaderColumn();
                    var Date2 = new DateField();
                    Date2.EmptyText = "yyyy/MM/dd";
                    Date2.Format = "yyyy/MM/dd";
                    //Date2.SetValue("2013/11/2");
                    hcDate2.Component.Add(Date2);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate2);
                    //
                    HeaderColumn hcDate3 = new HeaderColumn();
                    var Date3 = new DateField();
                    Date3.EmptyText = "yyyy/MM/dd";
                    Date3.Format = "yyyy/MM/dd";
                    //Date3.SetValue("2013/11/1");
                    hcDate3.Component.Add(Date3);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate3);

                    HeaderColumn hcDate4 = new HeaderColumn();
                    var Date4 = new DateField();
                    Date4.EmptyText = "yyyy/MM/dd";
                    Date4.Format = "yyyy/MM/dd";
                    //Date4.SetValue("2013/11/2");
                    hcDate4.Component.Add(Date4);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate4);
                    //

                    //HeaderColumn hcTotal5 = new HeaderColumn();
                    //this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTotal5);

                    //HeaderColumn hcTotal6 = new HeaderColumn();
                    //this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTotal6);

                    var TitleTotalP = new Ext.Net.Label();
                    TitleTotalP.Text = "Total(Person)";
                    TitleTotalP.Cls = "custom-row";
                    HeaderColumn hcTitleTotalP = new HeaderColumn();
                    hcTitleTotalP.Component.Add(TitleTotalP);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP);

                    var TitleTotalC = new Ext.Net.Label();
                    TitleTotalC.Text = "Total(Comp)";
                    TitleTotalC.Cls = "custom-row";
                    HeaderColumn hcTitleTotalC = new HeaderColumn();
                    hcTitleTotalC.Component.Add(TitleTotalC);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC);

                    X.AddScript("GridPanel2.colModel.setHidden(3, true);GridPanel2.colModel.setHidden(4, true);Store2.removeField('Station_1_P');Store2.removeField('Station_1_C');");
                }
                //DataSet dsdep = DIMERCO.SDK.Utilities.LSDK.getCRPDepartment();
                //DataTable dtdep = new DataTable();
                //dtdep.Columns.Add(new DataColumn("Depart", typeof(String)));
                //for (int i = 0; i < dsdep.Tables[0].Rows.Count; i++)
                //{
                //    DataRow dr = dtdep.NewRow();
                //    dr[0] = dsdep.Tables[0].Rows[i][2].ToString();
                //    dtdep.Rows.Add(dr);
                //}
                //StoreDepartment.DataSource = dtdep;
                //StoreDepartment.DataBind();

            }
        }
Exemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 public HeaderColumn.Builder HeaderColumn(HeaderColumn component)
 {
     return(new HeaderColumn.Builder(component));
 }
Exemplo n.º 9
0
        protected void LoadData(DataTable dt, bool CheckCopy)
        {
            string ID = dt.Rows[0]["RequestID"].ToString();
            cs.DBCommand dbc = new cs.DBCommand();
            //cbxOwner.SelectedItem.Value = dt.Rows[0]["PersonID"].ToString();
            
            if (CheckCopy)//根据Copy判断是否需要判断Copy状态
            {
                if (Request.QueryString["Copy"] != null)
                {
                    if (Request.QueryString["Copy"].ToString() == "T")//Copy而已,作为新增
                    {
                        hdTravelRequestID.Value = "";
                        hdTravelRequestNo.Value = "";
                        if (Request.QueryString["CopyType"] != null)
                        {
                            if (Request.QueryString["CopyType"].ToString() == "A")
                            {
                                if (dt.Rows[0]["ReportFile"].ToString() != "")
                                {
                                    linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString();
                                    linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString();
                                    hdReport.Value = dt.Rows[0]["ReportFile"].ToString();
                                }
                                if (dt.Rows[0]["Attach"].ToString() != "")
                                {
                                    linkScanFile.Text = dt.Rows[0]["Attach"].ToString();
                                    linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString();
                                    hdScanFile.Value = dt.Rows[0]["Attach"].ToString();
                                }
                            }
                        }
                    }
                    else
                    {
                        ErrorHandle("Data Error.");
                    }
                }
                else
                {
                    labelOwner.Text = dt.Rows[0]["Person"].ToString();
                    hdOwner.Value = dt.Rows[0]["Person"].ToString();
                    hdOwnerID.Value = dt.Rows[0]["PersonID"].ToString();
                    labelStation.Text = dt.Rows[0]["Station"].ToString();
                    labelDepartment.Text = dt.Rows[0]["Department"].ToString();
                    //获取该人币种
                    DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString());
                    if (ds1.Tables[0].Rows.Count == 1)
                    {
                        DataTable dt1 = ds1.Tables[0];
                        LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["stationCode"].ToString());
                        hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt1.Rows[0]["stationCode"].ToString()), 3);
                        DataTable dttemp = new DataTable();
                        string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'";
                        dttemp = dbc.GetData("eReimbursement", sqltemp);
                        if (dttemp.Rows.Count > 0)
                        {
                            LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dttemp.Rows[0]["Station"].ToString());
                            hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dttemp.Rows[0]["Station"].ToString()), 3);
                        }
                    }
                    else
                    {
                        ErrorHandle("Data Error."); return;
                    }

                    hdTravelRequestID.Value = ID;
                    hdTravelRequestNo.Value = dt.Rows[0]["No"].ToString();
                    if (dt.Rows[0]["ReportFile"].ToString() != "")
                    {
                        linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString();
                        linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString();
                        hdReport.Value = dt.Rows[0]["ReportFile"].ToString();
                    }
                    if (dt.Rows[0]["Attach"].ToString() != "")
                    {
                        linkScanFile.Text = dt.Rows[0]["Attach"].ToString();
                        linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString();
                        hdScanFile.Value = dt.Rows[0]["Attach"].ToString();
                    }
                    X.AddScript("btnExport.enable();");
                }
            }
            else
            {
                labelOwner.Text = dt.Rows[0]["Person"].ToString();
                hdOwner.Value = dt.Rows[0]["Person"].ToString();
                hdOwnerID.Value = dt.Rows[0]["PersonID"].ToString();
                labelStation.Text = dt.Rows[0]["Station"].ToString();
                labelDepartment.Text = dt.Rows[0]["Department"].ToString();
                //获取该人币种
                DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString());
                if (ds1.Tables[0].Rows.Count == 1)
                {
                    DataTable dt1 = ds1.Tables[0];
                    LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["stationCode"].ToString());
                    hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt1.Rows[0]["stationCode"].ToString()), 3);
                    DataTable dttemp = new DataTable();
                    string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'";
                    dttemp = dbc.GetData("eReimbursement", sqltemp);
                    if (dttemp.Rows.Count > 0)
                    {
                        LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dttemp.Rows[0]["Station"].ToString());
                        hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dttemp.Rows[0]["Station"].ToString()), 3);
                    }
                }
                else
                {
                    ErrorHandle("Data Error."); return;
                }

                hdTravelRequestID.Value = ID;
                hdTravelRequestNo.Value = dt.Rows[0]["No"].ToString();
                if (dt.Rows[0]["ReportFile"].ToString() != "")
                {
                    linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString();
                    linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString();
                    hdReport.Value = dt.Rows[0]["ReportFile"].ToString();
                }
                if (dt.Rows[0]["Attach"].ToString() != "")
                {
                    linkScanFile.Text = dt.Rows[0]["Attach"].ToString();
                    linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString();
                    hdScanFile.Value = dt.Rows[0]["Attach"].ToString();
                }
            }
            Radio1.Checked = dt.Rows[0]["Budget"].ToString() == "1" ? true : false;
            Radio2.Checked = dt.Rows[0]["Budget"].ToString() != "1" ? true : false;
            //cbxBudget.SelectedItem.Value = dt.Rows[0]["Budget"].ToString() == "1" ? "YES" : "NO";

            
            ////获取该人币种
            //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString());
            //if (ds1.Tables[0].Rows.Count == 1)
            //{
            //    DataTable dt1 = ds1.Tables[0];
            //    LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["CostCenter"].ToString());

            //    DataTable dttemp = new DataTable();
            //    string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'";
            //    dttemp = dbc.GetData("eReimbursement", sqltemp);
            //    if (dttemp.Rows.Count > 0)
            //    {
            //        LabelCurrency.Text = dttemp.Rows[0]["Currency"].ToString();
            //    }
            //}
            //else
            //{
            //    ErrorHandle("Data Error."); return;
            //}
            //组合数据
            DataTable dtnew = new DataTable();
            Store2.Reader[0].Fields.Add("Category", RecordFieldType.String);
            dtnew.Columns.Add("Category", typeof(String));
            dtnew.Columns.Add("TotalP", typeof(String));
            dtnew.Columns.Add("TotalC", typeof(String));
            //默认12行
            for (int i = 0; i < 12; i++)
            {
                DataRow dr = dtnew.NewRow();
                dtnew.Rows.Add(dr);
            }
            //默认第一列是标题
            dtnew.Rows[0][0] = "1. Air Ticket - Int'l";
            dtnew.Rows[1][0] = "Air Ticket - Domestic";
            dtnew.Rows[2][0] = "2. Hotel Bill";
            dtnew.Rows[3][0] = "3. Meals";
            dtnew.Rows[4][0] = "4. Entertainment";
            dtnew.Rows[5][0] = "5. Car Rental/Transportation";
            dtnew.Rows[6][0] = "6. Communication";
            dtnew.Rows[7][0] = "7. Local Trip Allowance";
            dtnew.Rows[8][0] = "8. Overseas Trip Allowance";
            dtnew.Rows[9][0] = "9. Airport Tax/Travel Insurance";
            dtnew.Rows[10][0] = "10. Others";
            dtnew.Rows[11][0] = "Total";

            string sqlf = "select distinct Tocity from ETraveleDetail where [No]='" + ID + "'";
            DataTable dtf = dbc.GetData("eReimbursement", sqlf);
            string sqld = "select * from ETraveleDetail where [No]='" + ID + "' order by id";
            DataTable dtall = new DataTable();
            dtall = dbc.GetData("eReimbursement", sqld);
            //140226 显示预算
            DataTable dtbudget = new DataTable();
            dtbudget.Columns.Add("COACode", typeof(System.String));
            dtbudget.Columns.Add("COACode", typeof(System.String));

            //
            if (dtf.Rows.Count == 1)
            {
                
                for (int i = 0; i < dtall.Rows.Count; i++)
                {
                    if (i % 11 == 0)
                    {
                        string colname = "Station_" + (i / 11).ToString() + "_P";
                        Store2.Reader[0].Fields.Add(colname, RecordFieldType.String);
                        dtnew.Columns.Add(colname, typeof(String));
                        colname = "Station_" + (i / 11).ToString() + "_C";
                        Store2.Reader[0].Fields.Add(colname, RecordFieldType.String);
                        dtnew.Columns.Add(colname, typeof(String));
                    }
                    dtnew.Rows[i % 11][3 + i / 11 * 2] = dtall.Rows[i]["Pamount"].ToString();
                    dtnew.Rows[i % 11][3 + i / 11 * 2 + 1] = dtall.Rows[i]["Camount"].ToString();
                    //列合计
                    string df = dtnew.Rows[11][3 + i / 11 * 2].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2].ToString();
                    string cf = dtall.Rows[i]["Pamount"].ToString() == "" ? "0" : dtall.Rows[i]["Pamount"].ToString();
                    dtnew.Rows[11][3 + i / 11 * 2] = Convert.ToDecimal(df) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df) + Convert.ToDecimal(cf)).ToString();

                    string bf = dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString();
                    string af = dtall.Rows[i]["Camount"].ToString() == "" ? "0" : dtall.Rows[i]["Camount"].ToString();
                    dtnew.Rows[11][3 + i / 11 * 2 + 1] = Convert.ToDecimal(bf) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf) + Convert.ToDecimal(af)).ToString();
                    //行合计
                    string df1 = dtnew.Rows[i % 11][1].ToString() == "" ? "0" : dtnew.Rows[i % 11][1].ToString();
                    dtnew.Rows[i % 11][1] = Convert.ToDecimal(df1) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df1) + Convert.ToDecimal(cf)).ToString();
                    string bf1 = dtnew.Rows[i % 11][2].ToString() == "" ? "0" : dtnew.Rows[i % 11][2].ToString();
                    dtnew.Rows[i % 11][2] = Convert.ToDecimal(bf1) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf1) + Convert.ToDecimal(af)).ToString();
                    //总合计
                    string tf = dtnew.Rows[11][1].ToString() == "" ? "0" : dtnew.Rows[11][1].ToString();
                    dtnew.Rows[11][1] = Convert.ToDecimal(tf) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(tf) + Convert.ToDecimal(cf)).ToString();
                    string ff = dtnew.Rows[11][2].ToString() == "" ? "0" : dtnew.Rows[11][2].ToString();
                    dtnew.Rows[11][2] = Convert.ToDecimal(ff) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(ff) + Convert.ToDecimal(af)).ToString();
                }
                dtnew.Columns.Add("Station_1_P", typeof(String));
                dtnew.Columns.Add("Station_1_C", typeof(String));
                Store2.Reader[0].Fields.Add("Station_1_P", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("Station_1_C", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String);

                Store2.DataSource = dtnew;
                Store2.DataBind();

                var TitleCol = new Column();
                TitleCol.DataIndex = "Category";
                TitleCol.Sortable = false;
                TitleCol.Resizable = false;
                TitleCol.MenuDisabled = true;
                TitleCol.Width = 180;
                this.GridPanel2.ColumnModel.Columns.Add(TitleCol);

                var Title1 = new Ext.Net.Label();
                Title1.Text = "Location:";
                HeaderColumn hcTitle1 = new HeaderColumn();
                hcTitle1.Component.Add(Title1);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1);

                var Title2 = new Ext.Net.Label();
                Title2.Text = "Cost Center:";
                HeaderColumn hcTitle2 = new HeaderColumn();
                hcTitle2.Component.Add(Title2);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2);

                var Title3 = new Ext.Net.Label();
                Title3.Text = "Travel Period:";
                HeaderColumn hcTitle3 = new HeaderColumn();
                hcTitle3.Component.Add(Title3);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3);

                int colc = dtall.Rows.Count / 11;
                for (int i = 0; i < colc; i++)//准备复制已有信息
                {
                    string fieldPName = "Station_" + i.ToString() + "_P";
                    string fieldCName = "Station_" + i.ToString() + "_C";

                    var txtP = new Ext.Net.NumberField();
                    //txtP.Listeners.Blur.Fn = "Cal";
                    var colP = new Column();
                    colP.Header = "Person Pay";
                    colP.DataIndex = fieldPName;
                    colP.Sortable = false;
                    colP.Resizable = false;
                    colP.MenuDisabled = true;
                    colP.Width = 110;
                    colP.Editor.Add(txtP);
                    this.GridPanel2.ColumnModel.Columns.Add(colP);

                    var txtC = new Ext.Net.NumberField();
                    //txtC.Listeners.Blur.Fn = "Cal";
                    var colC = new Column();
                    colC.Header = "Company Pay";
                    colC.DataIndex = fieldCName;
                    colC.Sortable = false;
                    colC.Resizable = false;
                    colC.MenuDisabled = true;
                    colC.Width = 110;
                    colC.Editor.Add(txtC);
                    this.GridPanel2.ColumnModel.Columns.Add(colC);

                    var Station = new Ext.Net.TextField();
                    Station.Text = dtall.Rows[i * 11]["Tocity"].ToString();
                    HeaderColumn hcStation = new HeaderColumn();
                    hcStation.Component.Add(Station);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation);

                    var Button = new Ext.Net.Button();
                    Button.Text = "Remove";
                    Button.Listeners.Click.Handler = "removecol(this," + i.ToString() + ");";
                    Button.Listeners.Click.Delay = 50;
                    HeaderColumn hcButton = new HeaderColumn();
                    hcButton.Component.Add(Button);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton);

                    var CostCenter = new Ext.Net.TextField();
                    CostCenter.EmptyText = "Station Code";
                    CostCenter.Text = dtall.Rows[i * 11]["TSation"].ToString();
                    HeaderColumn hcCostCenter = new HeaderColumn();
                    hcCostCenter.Component.Add(CostCenter);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter);

                    //HeaderColumn hcCostCenter1 = new HeaderColumn();
                    //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1);
                    var ButtonGetSum = new Ext.Net.Button();
                    ButtonGetSum.Text = "Calculate";
                    ButtonGetSum.Listeners.Click.Handler = "GetSum();";
                    ButtonGetSum.Listeners.Click.Delay = 50;
                    HeaderColumn hcButtonGetSum = new HeaderColumn();
                    hcButtonGetSum.Component.Add(ButtonGetSum);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum);

                    var datefrom = new DateField();
                    string dtfroms = dtall.Rows[i * 11]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate0"].ToString()).ToString("yyyy/MM/dd");
                    datefrom.SetValue(dtfroms);
                    datefrom.EmptyText = "yyyy/MM/dd";
                    datefrom.Format = "yyyy/MM/dd";
                    HeaderColumn Date1 = new HeaderColumn();
                    Date1.Component.Add(datefrom);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1);

                    var dateto = new DateField();
                    string datetos = dtall.Rows[i * 11]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate"].ToString()).ToString("yyyy/MM/dd");
                    dateto.SetValue(datetos);
                    dateto.EmptyText = "yyyy/MM/dd";
                    dateto.Format = "yyyy/MM/dd";
                    HeaderColumn Date2 = new HeaderColumn();
                    Date2.Component.Add(dateto);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2);
                }

                var txtP1 = new Ext.Net.NumberField();
                //txtP1.Listeners.Blur.Fn = "Cal";
                //txtP1.Listeners.Blur.Delay = 50;
                var colP1 = new Column();
                colP1.Header = "Person Pay";
                colP1.DataIndex = "Station_1_P";
                colP1.Sortable = false;
                colP1.Resizable = false;
                colP1.MenuDisabled = true;
                colP1.Width = 110;
                colP1.Locked = true;
                colP1.Editor.Add(txtP1);
                colP1.Hidden = true;
                this.GridPanel2.ColumnModel.Columns.Add(colP1);

                var txtC1 = new Ext.Net.NumberField();
                //txtC1.Listeners.Blur.Fn = "Cal";
                //txtC1.Listeners.Blur.Delay = 50;
                var colC1 = new Column();
                colC1.Header = "Company Pay";
                colC1.DataIndex = "Station_1_C";
                colC1.Sortable = false;
                colC1.Resizable = false;
                colC1.MenuDisabled = true;
                colC1.Width = 110;
                colC1.Locked = true;
                colC1.Editor.Add(txtC1);
                colC1.Hidden = true;
                this.GridPanel2.ColumnModel.Columns.Add(colC1);

                var TotalP = new Ext.Net.TextField();
                TotalP.ReadOnly = true;
                TotalP.Cls = "custom-row";
                var colTotalP = new Column();
                colTotalP.DataIndex = "TotalP";
                colTotalP.Sortable = false;
                colTotalP.Resizable = false;
                colTotalP.MenuDisabled = true;
                colTotalP.Width = 110;
                colTotalP.Locked = true;
                colTotalP.Editor.Add(TotalP);
                this.GridPanel2.ColumnModel.Columns.Add(colTotalP);

                var TotalC = new Ext.Net.TextField();
                TotalC.ReadOnly = true;
                TotalC.Cls = "custom-row";
                var colTotalC = new Column();
                colTotalC.DataIndex = "TotalC";
                colTotalC.Sortable = false;
                colTotalC.Resizable = false;
                colTotalC.MenuDisabled = true;
                colTotalC.Width = 110;
                colTotalC.Locked = true;
                colTotalC.Editor.Add(TotalC);
                this.GridPanel2.ColumnModel.Columns.Add(colTotalC);

                var Station1 = new Ext.Net.TextField();
                HeaderColumn hcStation1 = new HeaderColumn();
                hcStation1.Component.Add(Station1);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation1);

                var CostCenter0 = new Ext.Net.TextField();
                CostCenter0.EmptyText = "Station Code";
                HeaderColumn hcCostCenter0 = new HeaderColumn();
                hcCostCenter0.Component.Add(CostCenter0);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter0);

                HeaderColumn hcDate3 = new HeaderColumn();
                var Date3 = new DateField();
                Date3.EmptyText = "yyyy/MM/dd";
                Date3.Format = "yyyy/MM/dd";
                //Date3.SetValue("2013/11/1");
                hcDate3.Component.Add(Date3);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate3);


                var Button1 = new Ext.Net.Button();
                Button1.Text = "Remove";
                Button1.Listeners.Click.Handler = "removecol(this,1);";
                Button1.Listeners.Click.Delay = 50;
                HeaderColumn hcButton1 = new HeaderColumn();
                hcButton1.Component.Add(Button1);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton1);

                var ButtonGetSum1 = new Ext.Net.Button();
                ButtonGetSum1.Text = "Calculate";
                ButtonGetSum1.Listeners.Click.Handler = "GetSum();";
                ButtonGetSum1.Listeners.Click.Delay = 50;
                HeaderColumn hcButtonGetSum1 = new HeaderColumn();
                hcButtonGetSum1.Component.Add(ButtonGetSum1);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum1);

                HeaderColumn hcDate4 = new HeaderColumn();
                var Date4 = new DateField();
                Date4.EmptyText = "yyyy/MM/dd";
                Date4.Format = "yyyy/MM/dd";
                //Date4.SetValue("2013/11/2");
                hcDate4.Component.Add(Date4);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate4);

                HeaderColumn hcTotal1 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1);

                HeaderColumn hcTotal3 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3);

                var TitleTotalP = new Ext.Net.Label();
                TitleTotalP.Text = "Total(Person)";
                TitleTotalP.Cls = "custom-row";
                HeaderColumn hcTitleTotalP = new HeaderColumn();
                hcTitleTotalP.Component.Add(TitleTotalP);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP);

                HeaderColumn hcTotal2 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2);

                HeaderColumn hcTotal4 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4);

                var TitleTotalC = new Ext.Net.Label();
                TitleTotalC.Text = "Total(Comp)";
                TitleTotalC.Cls = "custom-row";
                HeaderColumn hcTitleTotalC = new HeaderColumn();
                hcTitleTotalC.Component.Add(TitleTotalC);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC);

                X.AddScript("GridPanel2.colModel.setHidden(3, true);GridPanel2.colModel.setHidden(4, true);Store2.removeField('Station_1_P');Store2.removeField('Station_1_C');");
            }
            else
            {
                //string sqld = "select * from ETraveleDetail where [No]='" + ID + "' order by id";
                //DataTable dtall = new DataTable();
                //dtall = dbc.GetData("eReimbursement", sqld);
                for (int i = 0; i < dtall.Rows.Count; i++)
                {
                    if (i % 11 == 0)
                    {
                        string colname = "Station_" + (i / 11).ToString() + "_P";
                        Store2.Reader[0].Fields.Add(colname, RecordFieldType.String);
                        dtnew.Columns.Add(colname, typeof(String));
                        colname = "Station_" + (i / 11).ToString() + "_C";
                        Store2.Reader[0].Fields.Add(colname, RecordFieldType.String);
                        dtnew.Columns.Add(colname, typeof(String));
                    }
                    dtnew.Rows[i % 11][3 + i / 11 * 2] = dtall.Rows[i]["Pamount"].ToString();
                    dtnew.Rows[i % 11][3 + i / 11 * 2 + 1] = dtall.Rows[i]["Camount"].ToString();
                    //列合计
                    string df = dtnew.Rows[11][3 + i / 11 * 2].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2].ToString();
                    string cf = dtall.Rows[i]["Pamount"].ToString() == "" ? "0" : dtall.Rows[i]["Pamount"].ToString();
                    dtnew.Rows[11][3 + i / 11 * 2] = Convert.ToDecimal(df) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df) + Convert.ToDecimal(cf)).ToString();

                    string bf = dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString();
                    string af = dtall.Rows[i]["Camount"].ToString() == "" ? "0" : dtall.Rows[i]["Camount"].ToString();
                    dtnew.Rows[11][3 + i / 11 * 2 + 1] = Convert.ToDecimal(bf) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf) + Convert.ToDecimal(af)).ToString();
                    //行合计
                    string df1 = dtnew.Rows[i % 11][1].ToString() == "" ? "0" : dtnew.Rows[i % 11][1].ToString();
                    dtnew.Rows[i % 11][1] = Convert.ToDecimal(df1) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df1) + Convert.ToDecimal(cf)).ToString();
                    string bf1 = dtnew.Rows[i % 11][2].ToString() == "" ? "0" : dtnew.Rows[i % 11][2].ToString();
                    dtnew.Rows[i % 11][2] = Convert.ToDecimal(bf1) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf1) + Convert.ToDecimal(af)).ToString();
                    //总合计
                    string tf = dtnew.Rows[11][1].ToString() == "" ? "0" : dtnew.Rows[11][1].ToString();
                    dtnew.Rows[11][1] = Convert.ToDecimal(tf) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(tf) + Convert.ToDecimal(cf)).ToString();
                    string ff = dtnew.Rows[11][2].ToString() == "" ? "0" : dtnew.Rows[11][2].ToString();
                    dtnew.Rows[11][2] = Convert.ToDecimal(ff) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(ff) + Convert.ToDecimal(af)).ToString();
                }
                Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String);
                Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String);

                Store2.DataSource = dtnew;
                Store2.DataBind();

                var TitleCol = new Column();
                TitleCol.DataIndex = "Category";
                TitleCol.Sortable = false;
                TitleCol.Resizable = false;
                TitleCol.MenuDisabled = true;
                TitleCol.Width = 180;
                this.GridPanel2.ColumnModel.Columns.Add(TitleCol);

                var Title1 = new Ext.Net.Label();
                Title1.Text = "Location:";
                HeaderColumn hcTitle1 = new HeaderColumn();
                hcTitle1.Component.Add(Title1);
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1);

                var Title2 = new Ext.Net.Label();
                Title2.Text = "Cost Center:";
                HeaderColumn hcTitle2 = new HeaderColumn();
                hcTitle2.Component.Add(Title2);
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2);

                var Title3 = new Ext.Net.Label();
                Title3.Text = "Travel Period:";
                HeaderColumn hcTitle3 = new HeaderColumn();
                hcTitle3.Component.Add(Title3);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3);

                int colc = dtall.Rows.Count / 11;
                for (int i = 0; i < colc; i++)//准备复制已有信息
                {
                    string fieldPName = "Station_" + i.ToString() + "_P";
                    //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float);
                    //Store2.Reader[0].Fields.Add(fieldPName, RecordFieldType.Float);
                    //this.Store2.AddField(field1, columncount);
                    string fieldCName = "Station_" + i.ToString() + "_C";
                    //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float);
                    //Store2.Reader[0].Fields.Add(fieldCName, RecordFieldType.Float);

                    var txtP = new Ext.Net.NumberField();
                    //txtP.Listeners.Blur.Fn = "Cal";
                    var colP = new Column();
                    colP.Header = "Person Pay";
                    colP.DataIndex = fieldPName;
                    colP.Sortable = false;
                    colP.Resizable = false;
                    colP.MenuDisabled = true;
                    colP.Width = 110;
                    colP.Editor.Add(txtP);
                    this.GridPanel2.ColumnModel.Columns.Add(colP);

                    var txtC = new Ext.Net.NumberField();
                    //txtC.Listeners.Blur.Fn = "Cal";
                    var colC = new Column();
                    colC.Header = "Company Pay";
                    colC.DataIndex = fieldCName;
                    colC.Sortable = false;
                    colC.Resizable = false;
                    colC.MenuDisabled = true;
                    colC.Width = 110;
                    colC.Editor.Add(txtC);
                    this.GridPanel2.ColumnModel.Columns.Add(colC);

                    var Station = new Ext.Net.TextField();
                    Station.Text = dtall.Rows[i * 11]["Tocity"].ToString();
                    HeaderColumn hcStation = new HeaderColumn();
                    hcStation.Component.Add(Station);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation);

                    var Button = new Ext.Net.Button();
                    Button.Text = "Remove";
                    Button.Listeners.Click.Handler = "removecol(this," + i.ToString() + ");";
                    Button.Listeners.Click.Delay = 50;
                    HeaderColumn hcButton = new HeaderColumn();
                    hcButton.Component.Add(Button);
                    this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton);

                    var CostCenter = new Ext.Net.TextField();
                    CostCenter.EmptyText = "Station Code";
                    CostCenter.Text = dtall.Rows[i * 11]["TSation"].ToString();
                    HeaderColumn hcCostCenter = new HeaderColumn();
                    hcCostCenter.Component.Add(CostCenter);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter);

                    //HeaderColumn hcCostCenter1 = new HeaderColumn();
                    //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1);
                    var ButtonGetSum = new Ext.Net.Button();
                    ButtonGetSum.Text = "Calculate";
                    ButtonGetSum.Listeners.Click.Handler = "GetSum();";
                    ButtonGetSum.Listeners.Click.Delay = 50;
                    HeaderColumn hcButtonGetSum = new HeaderColumn();
                    hcButtonGetSum.Component.Add(ButtonGetSum);
                    this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum);

                    var datefrom = new DateField();
                    string dtfroms = dtall.Rows[i * 11]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate0"].ToString()).ToString("yyyy/MM/dd");
                    datefrom.SetValue(dtfroms);
                    datefrom.EmptyText = "yyyy/MM/dd";
                    datefrom.Format = "yyyy/MM/dd";
                    HeaderColumn Date1 = new HeaderColumn();
                    Date1.Component.Add(datefrom);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1);

                    var dateto = new DateField();
                    string datetos = dtall.Rows[i * 11]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate"].ToString()).ToString("yyyy/MM/dd");
                    dateto.SetValue(datetos);
                    dateto.EmptyText = "yyyy/MM/dd";
                    dateto.Format = "yyyy/MM/dd";
                    HeaderColumn Date2 = new HeaderColumn();
                    Date2.Component.Add(dateto);
                    this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2);
                }

                var TotalP = new Ext.Net.TextField();
                TotalP.ReadOnly = true;
                TotalP.Cls = "custom-row";
                var colTotalP = new Column();
                colTotalP.DataIndex = "TotalP";
                colTotalP.Sortable = false;
                colTotalP.Resizable = false;
                colTotalP.MenuDisabled = true;
                colTotalP.Width = 110;
                colTotalP.Locked = true;
                colTotalP.Editor.Add(TotalP);
                this.GridPanel2.ColumnModel.Columns.Add(colTotalP);

                var TotalC = new Ext.Net.TextField();
                TotalC.ReadOnly = true;
                TotalC.Cls = "custom-row";
                var colTotalC = new Column();
                colTotalC.DataIndex = "TotalC";
                colTotalC.Sortable = false;
                colTotalC.Resizable = false;
                colTotalC.MenuDisabled = true;
                colTotalC.Width = 110;
                colTotalC.Locked = true;
                colTotalC.Editor.Add(TotalC);
                this.GridPanel2.ColumnModel.Columns.Add(colTotalC);

                HeaderColumn hcTotal1 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1);

                HeaderColumn hcTotal2 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2);

                HeaderColumn hcTotal3 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3);

                HeaderColumn hcTotal4 = new HeaderColumn();
                this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4);

                var TitleTotalP = new Ext.Net.Label();
                TitleTotalP.Text = "Total(Person)";
                TitleTotalP.Cls = "custom-row";
                HeaderColumn hcTitleTotalP = new HeaderColumn();
                hcTitleTotalP.Component.Add(TitleTotalP);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP);

                var TitleTotalC = new Ext.Net.Label();
                TitleTotalC.Text = "Total(Comp)";
                TitleTotalC.Cls = "custom-row";
                HeaderColumn hcTitleTotalC = new HeaderColumn();
                hcTitleTotalC.Component.Add(TitleTotalC);
                this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC);
            }
            string aa = "";
            //140226




            //根据语言设置
            //string sqlp = "";
            //if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn")
            //{
            //    sqlp += ",[COAName]=t2.ADes";
            //}
            //else
            //{
            //    sqlp += ",[COAName]=t2.SAccountName";
            //}

            //string detailsql = "select t1.* from ETraveleDetail t1 where t1.No='" + ID + "' order by DetailCode";
            //DataTable dtdetail = new DataTable();
            //dtdetail = dbc.GetData("eReimbursement", detailsql);
            //DataTable dtnew = new DataTable();
            //dtnew.Columns.Add("DetailID", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Tocity", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("AccountCode", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Cur", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Pamount", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Camount", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("TSation", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Tdate", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Tdate0", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Type", System.Type.GetType("System.String"));
            //dtnew.Columns.Add("Department1", System.Type.GetType("System.String"));
            //for (int i = 0; i < dtdetail.Rows.Count; i++)
            //{
            //    DataRow dr = dtnew.NewRow();
            //    dr["DetailID"] = dtdetail.Rows[i]["ID"].ToString();
            //    dr["Tocity"] = dtdetail.Rows[i]["Tocity"].ToString();
            //    dr["AccountCode"] = dtdetail.Rows[i]["AccountCode"].ToString();
            //    dr["Cur"] = dtdetail.Rows[i]["Cur"].ToString();
            //    dr["Pamount"] = dtdetail.Rows[i]["Pamount"].ToString();
            //    dr["Camount"] = dtdetail.Rows[i]["Camount"].ToString();
            //    dr["TSation"] = dtdetail.Rows[i]["TSation"].ToString();
            //    dr["Tdate"] = dtdetail.Rows[i]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["Tdate"].ToString()).ToString("yyyy/MM/dd");
            //    dr["Tdate0"] = dtdetail.Rows[i]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["Tdate0"].ToString()).ToString("yyyy/MM/dd");
            //    dr["Type"] = hdStatus.Value.ToString();//传递给子页面以判断按钮状态 0:允许修改,允许上传;1:不允许修改,允许上传;2:全不允许
            //    dr["Department1"] = dtdetail.Rows[i]["Department1"].ToString();
            //    dtnew.Rows.Add(dr);
            //}
            //Store3.DataSource = dtnew;
            //Store3.DataBind();
            ////txtSum.Text = (psum + csum).ToString("#,##0.00"); hdSum.Value = (psum + csum).ToString();
            ////txtPersonalSum.Text = psum.ToString("#,##0.00"); hdPamountSum.Value = psum.ToString();
            ////txtCompanySum.Text = csum.ToString("#,##0.00"); hdCamountSum.Value = csum.ToString();
            //txtRemark.Text = dt.Rows[0]["Remark"].ToString();
            //if (dt.Rows[0]["CCMailList"].ToString() != "")
            //{
            //    ToolTipCC.Html = dt.Rows[0]["CCMailList"].ToString().Replace(",", "<br />");
            //    DataTable dtCCMailList = new DataTable();
            //    dtCCMailList.Columns.Add("Email", typeof(String));
            //    for (int i = 0; i < dt.Rows[0]["CCMailList"].ToString().Split(',').Length; i++)
            //    {
            //        DataRow dr = dtCCMailList.NewRow();
            //        dr["Email"] = dt.Rows[0]["CCMailList"].ToString().Split(',')[i];
            //        dtCCMailList.Rows.Add(dr);
            //    }
            //    StoreCCList.DataSource = dtCCMailList;
            //    StoreCCList.DataBind();
            //}
        }