/// <summary> /// /// </summary> public NumberField.Builder NumberField(NumberField component) { #if MVC component.ViewContext = this.HtmlHelper != null ? this.HtmlHelper.ViewContext : null; #endif return(new NumberField.Builder(component)); }
/// <summary> /// /// </summary> /// <returns></returns> public override string XGetDesignTimeHtml() { StringWriter writer = new StringWriter(CultureInfo.CurrentCulture); HtmlTextWriter htmlWriter = new HtmlTextWriter(writer); NumberField c = (NumberField)this.Control; string width = (c.Width != Unit.Empty) ? " width: {0};".FormatWith((c.Grow && c.GrowMin.Value > c.Width.Value) ? c.GrowMin.ToString() : c.Width.ToString()) : ""; string height = (c.Height != Unit.Empty) ? " height: {0};".FormatWith(c.Height.ToString()) : ""; object[] args = new object[7]; args[0] = c.ClientID; args[1] = c.Text.IsEmpty() ? c.EmptyText : c.Text; args[2] = c.InputType.ToString().ToLower(); args[3] = width; args[4] = height; args[5] = c.StyleSpec; args[6] = "x-form-text x-form-field x-form-num-field " + ((c.Text.IsEmpty()) ? "x-form-empty-field " : "") + c.Cls; LiteralControl ctrl = new LiteralControl(string.Format(this.Html, args)); ctrl.RenderControl(htmlWriter); return(writer.ToString()); }
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(); //} }
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); }
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(); } }
/// <summary> /// /// </summary> public NumberField.Builder NumberField(NumberField component) { return(new NumberField.Builder(component)); }
/// <summary> /// Lấy fieldname và giá trị /// </summary> /// <param name="control"></param> /// <param name="value"></param> /// <returns></returns> private string GetFieldName(Ext.Net.Component control, ref object value) { switch (control.ToString()) { case "Ext.Net.TextField": Ext.Net.TextField txtControl = (Ext.Net.TextField)control; value = txtControl.Text; if (!txtControl.ID.Contains("_")) { return(""); } else { return(txtControl.ID.Substring(txtControl.ID.IndexOf("_") + 1)); } case "Ext.Net.Hidden": Ext.Net.Hidden hdfControl = (Ext.Net.Hidden)control; value = hdfControl.Text; if (!hdfControl.ID.Contains("_")) { return(""); } else { return(hdfControl.ID.Substring(hdfControl.ID.IndexOf("_") + 1)); } case "Ext.Net.Checkbox": Ext.Net.Checkbox chk = (Ext.Net.Checkbox)control; value = chk.Checked == true ? 1 : 0; if (!chk.ID.Contains("_")) { return(""); } else { return(chk.ID.Substring(chk.ID.IndexOf("_") + 1)); } case "Ext.Net.DateField": Ext.Net.DateField dfDate = (Ext.Net.DateField)control; if (!SoftCore.Util.GetInstance().IsDateNull(dfDate.SelectedDate)) { value = dfDate.SelectedDate.Month + "/" + dfDate.SelectedDate.Day + "/" + dfDate.SelectedDate.Year; } else { value = ""; } if (!dfDate.ID.Contains("_")) { return(""); } else { return(dfDate.ID.Substring(dfDate.ID.IndexOf("_") + 1)); } case "Ext.Net.NumberField": Ext.Net.NumberField nbf = (Ext.Net.NumberField)control; value = nbf.Text; if (!nbf.ID.Contains("_")) { return(""); } else { return(nbf.ID.Substring(nbf.ID.IndexOf("_") + 1)); } case "Ext.Net.ComboBox": Ext.Net.ComboBox cbBox = (Ext.Net.ComboBox)control; value = cbBox.SelectedItem.Value; if (!cbBox.ID.Contains("_")) { return(""); } else { return(cbBox.ID.Substring(cbBox.ID.IndexOf("_") + 1)); } case "Ext.Net.SpinnerField": Ext.Net.SpinnerField spinnerField = (Ext.Net.SpinnerField)control; value = spinnerField.Text; if (!spinnerField.ID.Contains("_")) { return(""); } else { return(spinnerField.ID.Substring(spinnerField.ID.IndexOf("_") + 1)); } case "Ext.Net.TextArea": Ext.Net.TextArea txtArea = (Ext.Net.TextArea)control; value = txtArea.Text; if (!txtArea.ID.Contains("_")) { return(""); } else { return(txtArea.ID.Substring(txtArea.ID.IndexOf("_") + 1)); } case "Ext.Net.Container": Ext.Net.Container cContainer = (Ext.Net.Container)control; GetChildControl(cContainer); break; case "Ext.Net.FieldSet": Ext.Net.FieldSet fieldSet = (Ext.Net.FieldSet)control; GetChildControl(fieldSet); break; case "Ext.Net.HtmlEditor": Ext.Net.HtmlEditor htmlEditor = (Ext.Net.HtmlEditor)control; value = htmlEditor.Text; if (!htmlEditor.ID.Contains("_")) { return(""); } else { return(htmlEditor.ID.Substring(htmlEditor.ID.IndexOf("_") + 1)); } } return(""); }
public void FillPanelswithFields(Panel[] panels, DataTable dtContent, DataTable dtProperty, string IDField, string ValueField, string[] customTitle, string Kod) { //foreach (Panel panel in panels) //{ // panel.Items.Clear(); // panel.Items.u // //panel.ClearContent(); //} if (panels.Length == 1) { //destroyFirst(panels[0]); } for (int i = 0; i < dtProperty.Rows.Count; i++) { string fieldTitle, fieldType, fieldId, fieldCls = " ", changeFn = null, changeHnd = null; Boolean readOnly = false, hidden = false, protcted = false; int LabelWidth = 0, flex = 0; if (CommonFunctions.ContainColumn("DATA_TYPE", dtProperty)) { fieldType = dtProperty.Rows[i]["DATA_TYPE"].ToString().Trim(); if (!(new[] { "String", "Integer", "Decimal", "DateTime" }.Contains(fieldType))) { fieldType = "String"; } } else { fieldType = "String"; } if (CommonFunctions.ContainColumn("COMPONENT_ID", dtProperty)) { fieldId = dtProperty.Rows[i]["COMPONENT_ID"].ToString().Trim(); if (string.IsNullOrEmpty(fieldId)) { fieldId = "Field" + i.ToString(); } } else { fieldId = "EmptyField" + i.ToString(); } if (CommonFunctions.ContainColumn("TITLE", dtProperty)) { fieldTitle = dtProperty.Rows[i]["TITLE"].ToString().Trim(); } else { fieldTitle = fieldId; } IDictionary <string, object> obj = new Dictionary <string, object>(); string[] propertyArray = Regex.Split(dtProperty.Rows[i]["PROPERTIES"].ToString(), ";"); foreach (string s in propertyArray) { if (s.Contains(":")) { string[] substring = Regex.Split(s, ":"); string temp1 = substring[0]; string temp2 = substring[1]; obj.Add(temp1, temp2); } else { obj.Add(s, true); } } if (obj.Count > 0) { if (obj.ContainsKey("ReadOnly")) { readOnly = true; } if (obj.ContainsKey("Hidden")) { hidden = true; } if (obj.ContainsKey("Protected")) { protcted = true; } if (obj.ContainsKey("Flex")) { flex = CommonFunctions.ConvertToInteger(obj["Flex"].ToString()); } if (obj.ContainsKey("FieldCls")) { fieldCls = obj["FieldCls"].ToString(); } if (obj.ContainsKey("ListenersChangeFn")) { changeFn = obj["ListenersChangeFn"].ToString().Trim(); } if (obj.ContainsKey("ListenersChangeHandler")) { changeHnd = obj["ListenersChangeHandler"].ToString().Trim(); } if (obj.ContainsKey("LabelWidth")) { if (!Int32.TryParse(obj["LabelWidth"].ToString(), out LabelWidth)) { //hata ver } } if (obj.ContainsKey("CustomTitlePos")) { int CustomTitleArrayID = CommonFunctions.ConvertToInteger(obj["CustomTitlePos"].ToString()); if (customTitle.Length > CustomTitleArrayID) { if (!string.IsNullOrEmpty(customTitle[CustomTitleArrayID])) { fieldTitle = customTitle[CustomTitleArrayID]; } } } } string idofValue = " "; int indexofValue = -1; string resultValue = " "; indexofValue = CommonFunctions.getIndexOfString(dtContent, IDField, fieldId); if (indexofValue == -1) { if (TryGetId(fieldId, out idofValue)) { indexofValue = CommonFunctions.getIndexOfString(dtContent, IDField, idofValue); } else { //hata ver bulunamadı } } if (indexofValue > -1) { resultValue = dtContent.Rows[indexofValue][ValueField].ToString(); } if (!string.IsNullOrEmpty(Kod)) { fieldId += Kod.Trim(); } if (fieldType.ToUpper() == "Integer".ToUpper() || fieldType.ToUpper() == "Decimal".ToUpper()) { if (fieldType.ToUpper() == "Decimal".ToUpper()) { resultValue = resultValue.Replace(".", ","); } Ext.Net.NumberField tempNumberField = new Ext.Net.NumberField(); tempNumberField.ItemID = dtProperty.Rows[i]["ID"].ToString(); tempNumberField.ID = fieldId; tempNumberField.CustomConfig.Add(new ConfigItem("tablePropertyId", dtProperty.Rows[i]["ID"].ToString(), ParameterMode.Value)); tempNumberField.CustomConfig.Add(new ConfigItem("resetValue", "0", ParameterMode.Value)); tempNumberField.MinValue = 0; if (fieldType == "Integer") { tempNumberField.AllowDecimals = false; int outInt = 0; if (Int32.TryParse(resultValue, out outInt)) { /*ConfigItem: resetValue*/ tempNumberField.CustomConfig[1].Value = resultValue; } else { outInt = 0; //hata ver } tempNumberField.SetValue(outInt); } else { tempNumberField.AllowDecimals = true; tempNumberField.DecimalPrecision = 2; Decimal outDecimal = 0; if (Decimal.TryParse(resultValue, out outDecimal)) { /*ConfigItem: resetValue*/ tempNumberField.CustomConfig[1].Value = resultValue; } else { outDecimal = 0; //hata ver } tempNumberField.SetValue(outDecimal); } if (fieldCls != " ") { tempNumberField.FieldCls = fieldCls; } tempNumberField.Step = 1; tempNumberField.FieldLabel = fieldTitle; if (LabelWidth > 0) { tempNumberField.LabelWidth = LabelWidth; } if (flex > 0) { tempNumberField.Flex = flex; } tempNumberField.ReadOnly = readOnly; tempNumberField.Hidden = hidden; if (!string.IsNullOrEmpty(changeFn)) { tempNumberField.Listeners.Change.Fn = changeFn; } if (!string.IsNullOrEmpty(changeHnd)) { tempNumberField.Listeners.Change.Handler = changeHnd; } string[] strArry = new string[1] { "['change']" }; tempNumberField.ValidateOnChange = true; tempNumberField.CheckChangeEvents = strArry; if (panels.Length == 1) { panels[0].Add(tempNumberField); } else { int panelIndex = searchComponentArrayById(panels, dtProperty.Rows[i]["PARENT_ID"].ToString().Trim()); if (panelIndex > -1) { panels[panelIndex].Add(tempNumberField); } else { //Hata yaz } } } else if (fieldType.ToUpper() == "DateTime".ToUpper()) { DateTime dateValue; Ext.Net.DateField tempDateField = new Ext.Net.DateField(); if (resultValue == null || resultValue.Trim().Length == 0) { dateValue = new DateTime(1900, 1, 1, 0, 0, 0); } else { try { dateValue = Convert.ToDateTime(resultValue); } catch (Exception ex) { dateValue = new DateTime(1900, 1, 1, 0, 0, 0); //hata ver } } if (fieldCls != " ") { tempDateField.FieldCls = fieldCls; } tempDateField.ItemID = dtProperty.Rows[i]["ID"].ToString(); tempDateField.ID = fieldId; tempDateField.CustomConfig.Add(new ConfigItem("tablePropertyId", dtProperty.Rows[i]["ID"].ToString(), ParameterMode.Value)); tempDateField.FieldLabel = fieldTitle; if (LabelWidth > 0) { tempDateField.LabelWidth = LabelWidth; } tempDateField.ReadOnly = readOnly; tempDateField.Hidden = hidden; tempDateField.Value = dateValue; if (!string.IsNullOrEmpty(changeFn)) { tempDateField.Listeners.Change.Fn = changeFn; } if (!string.IsNullOrEmpty(changeHnd)) { tempDateField.Listeners.Change.Handler = changeHnd; } if (flex > 0) { tempDateField.Flex = flex; } if (panels.Length == 1) { panels[0].Add(tempDateField); } else { int panelIndex = searchComponentArrayById(panels, dtProperty.Rows[i]["PARENT_ID"].ToString().Trim()); if (panelIndex > -1) { panels[panelIndex].Add(tempDateField); } else { //Hata yaz } } } else { Ext.Net.TextField tempTextField = new Ext.Net.TextField(); tempTextField.ID = fieldId; tempTextField.ItemID = dtProperty.Rows[i]["ID"].ToString(); tempTextField.CustomConfig.Add(new ConfigItem("tablePropertyId", dtProperty.Rows[i]["ID"].ToString(), ParameterMode.Value)); tempTextField.FieldLabel = fieldTitle; if (LabelWidth > 0) { tempTextField.LabelWidth = LabelWidth; } tempTextField.ReadOnly = readOnly; tempTextField.Hidden = hidden; tempTextField.Value = resultValue; if (!string.IsNullOrEmpty(changeFn)) { tempTextField.Listeners.Change.Fn = changeFn; } if (!string.IsNullOrEmpty(changeHnd)) { tempTextField.Listeners.Change.Handler = changeHnd; string[] strArry = new string[1] { "['change']" }; tempTextField.ValidateOnChange = true; tempTextField.CheckChangeEvents = strArry; } if (fieldCls != " ") { tempTextField.FieldCls = fieldCls; } if (flex > 0) { tempTextField.Flex = flex; } if (panels.Length == 1) { panels[0].Add(tempTextField); } else { int panelIndex = searchComponentArrayById(panels, dtProperty.Rows[i]["PARENT_ID"].ToString().Trim()); if (panelIndex > -1) { panels[panelIndex].Add(tempTextField); } else { //Hata yaz } } } } }
private void InitComponents() { #region Button and Toolbar bool display = (Status == "Open" || Status == "") ? true : false; btnSave = new Button { ID = "btnSave", Icon = Icon.Disk, Text = "Lưu", ToolTip = "Save", Visible = display }; btnDeleteCard = new Button { ID = "btnDeleteCard", Icon = Icon.Delete, Text = "Xóa", ToolTip = "Delete", Visible = display }; topBar = new Toolbar { ID = "topBar", Items = { btnSave, btnDeleteCard }, Visible = display }; #endregion Button and Toolbar #region Batch and Key txtBatch = new Ext.Net.Hidden { Name = "Batch", LabelWidth = 150, Anchor = "100%", FieldLabel = "Batch", ID = "txtBatch" }; txtKey = new Ext.Net.Hidden { DataIndex = "UID", Name = "UID", LabelWidth = 150, Anchor = "100%", FieldLabel = "UID", ID = "txtKey" }; #endregion Batch and Key #region cboNo cboNo = new ComboBoxLookup { DataIndex = "No", Name = "No", LabelWidth = 150, Anchor = "100%", FieldLabel = "No.", ID = "cboNo", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "No", FieldTitle = "No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 250 }, new LookupFormatData { FieldName = "Base_Unit_of_Measure", FieldTitle = "Base Unit of Measure", ColWidth = 150 }, new LookupFormatData { FieldName = "Unit_Cost", FieldTitle = "Unit Cost", ColWidth = 120 } }, idProperty = "No", DisplayField = "No", ValueField = "No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemNo" }; #endregion cboNo #region cboType cboType = new ComboBox { DataIndex = "Type", Name = "Type", LabelWidth = 150, Anchor = "100%", FieldLabel = "Type", ID = "cboType", SelectOnFocus = true, AllowBlank = false, ReadOnly = true, Items = { new ListItem { Text = "G/L Account", Value = "G/L Account" }, new ListItem { Text = "Item", Value = "Item" }, } }; #endregion cboType #region cboAction_Message cboAction_Message = new ComboBox { DataIndex = "Action_Message", Name = "Action_Message", LabelWidth = 150, Anchor = "100%", FieldLabel = "Action Message", ID = "cboAction_Message", SelectOnFocus = true, ReadOnly = true, //Items = { // new ListItem {Text="", Value="" }, // new ListItem {Text="New", Value="New" }, // new ListItem {Text="Change Qty.", Value="Change Qty." }, // new ListItem {Text="Reschedule", Value="Reschedule" }, // new ListItem {Text="Resched. & Chg. Qty.", Value="Resched. & Chg. Qty." }, // new ListItem {Text="Cancel", Value="Cancel" }, //} Store = { new Store { Data = ActionMessage, AutoDataBind = true, Model = { new Model { Fields = { new ModelField { Name = "value" }, new ModelField { Name = "text" }, new ModelField { Name = "displaytext" } } } } } } }; #endregion cboAction_Message #region Accept Action Message and Description cboAccept_Action_Message = new Checkbox { DataIndex = "Accept_Action_Message", Name = "Accept_Action_Message", LabelWidth = 150, Anchor = "100%", FieldLabel = "Accept Action Message", ID = "cboAccept_Action_Message", ReadOnly = true }; txtDescription = new TextField { DataIndex = "Description", Name = "Description", LabelWidth = 150, Anchor = "100%", FieldLabel = "Description", ID = "txtDescription", ReadOnly = true }; txtRemark = new TextField { DataIndex = "Remark", Name = "Remark", LabelWidth = 150, Anchor = "100%", FieldLabel = "Remark", ID = "txtRemark", ReadOnly = false }; #endregion Accept Action Message and Description #region cboLocation_Code cboLocation_Code = new ComboBoxLookup { DataIndex = "Location_Code", Name = "Location_Code", LabelWidth = 150, Anchor = "100%", FieldLabel = "Location Code", ID = "cboLocation_Code", SelectOnFocus = true, AllowBlank = true, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/LocationListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Code", FieldTitle = "Code", ColWidth = 100 }, new LookupFormatData { FieldName = "Name", FieldTitle = "Name", ColWidth = 150 } }, idProperty = "Code", DisplayField = "Code", ValueField = "Code", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.Location" }; #endregion cboLocation_Code #region Original_Quantity and Quantity txtOriginal_Quantity = new NumberField { DataIndex = "Original_Quantity", Name = "Original_Quantity", LabelWidth = 150, Anchor = "100%", FieldLabel = "Original Quantity", ID = "txtOriginal_Quantity", MinValue = 0, MaxValue = 1000000, ReadOnly = true }; //1.000.000 txtQuantity = new TextField { DataIndex = "Quantity", Name = "Quantity", LabelWidth = 150, Anchor = "100%", FieldLabel = "Quantity", ID = "txtQuantity", MaskRe = @"/[0-9\.]/", }; #endregion Original_Quantity and Quantity #region cboUnit_of_Measure_Code cboUnit_of_Measure_Code = new ComboBoxLookup { DataIndex = "Unit_of_Measure_Code", Name = "Unit_of_Measure_Code", LabelWidth = 150, Anchor = "100%", FieldLabel = "Unit of Measure Code", ID = "cboUnit_of_Measure_Code", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/UOMHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Code", FieldTitle = "Code", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 150 }, new LookupFormatData { FieldName = "Qty_per_Unit_of_Measure", FieldTitle = "Qty per Unit of Measure", ColWidth = 150 } }, idProperty = "Code", DisplayField = "Code", ValueField = "Code", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.UOM" }; #endregion txtUnit_of_Measure_Code #region Direct_Unit_Cost and Due_Date txtDirect_Unit_Cost = new TextField { DataIndex = "Direct_Unit_Cost", Name = "txtDirect_Unit_Cost", LabelWidth = 150, Anchor = "100%", FieldLabel = "Direct Unit Cost", ID = "txtDirect_Unit_Cost", ReadOnly = true }; txtDue_Date = new DateField { DataIndex = "Due_Date", Name = "Due_Date", LabelWidth = 150, Anchor = "100%", FieldLabel = "Due Date", ID = "txtDue_Date", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy" }; #endregion Direct_Unit_Cost and Due_Date #region cboVendor_No cboVendor_No = new ComboBoxLookup { DataIndex = "Vendor_No", Name = "Vendor_No", LabelWidth = 150, Anchor = "100%", FieldLabel = "Vendor No.", ID = "cboVendor_No", ReadOnly = true, AllowBlank = true, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemVendorCatalogHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Vendor_No", FieldTitle = "Vendor No", ColWidth = 100 }, new LookupFormatData { FieldName = "Vendor_Item_No", FieldTitle = "Vendor Item No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Lead_Time_Calculation", FieldTitle = "Lead Time Calculation", ColWidth = 150 } }, idProperty = "Vendor_No", DisplayField = "Vendor_No", ValueField = "Vendor_No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemVendorCatalog" }; #endregion cboVendor_No #region cboUOMHandler //cboUOMHandler = new ComboBoxLookup { // DataIndex = "Unit_of_Measure_Code", // Name = "Unit_of_Measure_Code", // LabelWidth = 150, // Anchor = "100%", // FieldLabel = "UOM", // ID = "cboUOMHandler", // ReadOnly = false, // AllowBlank = false, // MsgTarget = MessageTarget.Side, // ProxyUrl = "../../../Handler/UOMHandler.ashx", // DataTemplete = { // new LookupFormatData{FieldName = "Code", FieldTitle = "Code", ColWidth = 100}, // new LookupFormatData{FieldName = "Description", FieldTitle = "Description", ColWidth = 100}, // new LookupFormatData{FieldName = "Qty_per_Unit_of_Measure", FieldTitle = "Qty per Unit of Measure", ColWidth = 200, Format="N0"}, // }, // idProperty = "Unit_of_Measure_Code", // DisplayField = "Unit_of_Measure_Code", // ValueField = "Unit_of_Measure_Code", // PageSize = 5, // CurCompany = GlobalVariable.CompanyName, // SCOPE = "GLX.Lookup.UOM" //}; //cboUOMHandler.Store.Primary.Parameters.AddRange(new Ext.Net.StoreParameter[] { // new Ext.Net.StoreParameter{Name = "type", Value = String.Format("2|3"), Mode = ParameterMode.Value}, //}); #endregion cboUOMHandler #region Vendor_Item_No txtVendor_Item_No = new TextField { DataIndex = "Vendor_Item_No", Name = "Vendor_Item_No", LabelWidth = 150, Anchor = "100%", FieldLabel = "Vendor Item No", ID = "txtVendor_Item_No", ReadOnly = true }; #endregion Vendor_Item_No #region cboReplenishment_System cboReplenishment_System = new ComboBox { DataIndex = "Replenishment_System", Name = "Replenishment_System", LabelWidth = 150, Anchor = "100%", FieldLabel = "Replenishment System", ID = "cboReplenishment_System", ReadOnly = true, Store = { new Store { Data = ReplenishmentSystem, AutoDataBind = true, Model = { new Model { Fields = { new ModelField { Name = "value" }, new ModelField { Name = "text" }, new ModelField { Name = "displaytext" } } } } } } //Items = { // new ListItem { Text="Purchase", Value="Purchase"}, // new ListItem { Text="Prod. Order", Value="Prod. Order"}, // new ListItem { Text="Transfer", Value="Transfer"}, // new ListItem { Text="Assembly", Value="Assembly"} //} }; #endregion cboReplenishment_System #region cboNo cboNo = new ComboBoxLookup { DataIndex = "No", Name = "No", LabelWidth = 150, Anchor = "100%", FieldLabel = "No.", ID = "cboNo", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "No", FieldTitle = "No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 250 }, new LookupFormatData { FieldName = "Base_Unit_of_Measure", FieldTitle = "Base Unit of Measure", ColWidth = 150 }, new LookupFormatData { FieldName = "Unit_Cost", FieldTitle = "Unit Cost", ColWidth = 120 } }, idProperty = "No", DisplayField = "No", ValueField = "No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemNo" }; #endregion cboNo TextAreaChangeLogComment = new TextArea { Flex = 1, ID = "TextAreaChangeLogComment", ReadOnly = true }; hiddenConverted = new Ext.Net.Hidden { DataIndex = "Converted", Name = "Converted", ID = "hiddenConverted" }; hiddenStatus = new Ext.Net.Hidden { DataIndex = "Status", Name = "Status", ID = "hiddenStatus" }; #region frmHeader frmHeader = new FormPanel { Header = false, Region = Region.North, Icon = Ext.Net.Icon.ApplicationForm, Border = true, ID = "frmHeader", TrackResetOnLoad = true, Layout = "Hbox", Items = { new Panel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 10 10", Border = false, //Items = { txtKey, txtBatch, cboType, cboNo, cboAction_Message, cboAccept_Action_Message, txtDescription, cboLocation_Code } //txtOriginal_Quantity Items ={ txtKey, txtBatch, hiddenConverted, hiddenStatus, cboNo, txtDescription, txtRemark, cboUnit_of_Measure_Code, txtDirect_Unit_Cost, cboLocation_Code, txtQuantity, txtDue_Date }//txtOriginal_Quantity, cboType, cboAction_Message, cboAccept_Action_Message, }, } }; frmComment = new FormPanel { ID = "frmComment", Title = "Comment", Icon = Icon.Comments, Border = false, Region = Region.South, Layout = "Fit", Height = 150, Items = { TextAreaChangeLogComment } }; #endregion frmHeader #region Windows this.ID = "winCard"; this.Maximizable = false; this.Minimizable = false; this.CloseAction = CloseAction.Destroy; this.Icon = Icon.ApplicationEdit; this.TopBar.Add(topBar); this.Layout = "Border"; this.Items.AddRange( new ItemsCollection <Ext.Net.AbstractComponent> { this.frmHeader, frmComment } ); #endregion Windows }
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(); //} }