public void BindGv() { this.AspNetPager1.PageSize = NBasePage.pagesize; string person = this.txtPerson.Text.Trim(); string empty = string.Empty; string text = this.txtStartDate.Text; string text2 = this.txtEndDate.Text; string deparment = this.txtDeparment.Text.Trim(); decimal?totalAmount = null; decimal?endCash = null; string name = this.txtName.Text.Trim(); if (!string.IsNullOrEmpty(this.txtTotalAmount.Text)) { totalAmount = new decimal?(System.Convert.ToDecimal(this.txtTotalAmount.Text)); } if (!string.IsNullOrEmpty(this.txtEndCash.Text)) { endCash = new decimal?(System.Convert.ToDecimal(this.txtEndCash.Text)); } int count = CostDiary.GetCount(this.prjId, person, text, text2, empty, deparment, this.txtName.Text, this.ddlFlowState.SelectedValue, totalAmount, endCash, this.costType); DataTable diaries = CostDiary.GetDiaries(this.prjId, person, text, text2, empty, deparment, this.txtName.Text, this.ddlFlowState.SelectedValue, totalAmount, endCash, this.costType, this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex); this.AspNetPager1.RecordCount = count; this.ViewState["Diaries"] = diaries; this.gvBudget.DataSource = diaries; this.gvBudget.DataBind(); this.hfldPurchaseChecked.Value = string.Empty; if (this.gvBudget.Rows.Count > 0) { base.RegisterScript("fillTotalAmount('" + CostDiary.GetDiariesTotal(this.prjId, person, empty, name, this.ddlFlowState.SelectedValue, text, text2, deparment, this.costType, totalAmount, endCash).ToString("#,##0.000") + "');showDetails();"); return; } base.RegisterScript("showDetails();"); }
protected void BindRptContrast() { DataTable contrast = CostDiary.GetContrast(base.Request["ic"]); this.rptContrast.DataSource = contrast; this.rptContrast.DataBind(); if (contrast.Rows.Count == 0) { base.RegisterScript("$('#rptContrast tr:last-child').remove();"); } }
public void BindGv2(string prjId) { string text = new System.DateTime(1753, 1, 1).ToString(); string text2 = new System.DateTime(9999, 12, 31).ToString(); this.AspNetPager3.PageSize = NBasePage.pagesize; //string person = this.txtPerson.Text.Trim(); //string userName = string.Empty; //if (base.UserCode != "00000000") //{ // userName = WebUtil.GetUserNames(base.UserCode); //} //string text = this.txtStartDate.Text; //string text2 = this.txtEndDate.Text; //string deparment = this.txtDeparment.Text.Trim(); //string name = this.txtName.Text.Trim(); decimal?totalAmount = null; decimal?endCash = null; //if (!string.IsNullOrEmpty(this.txtTotalAmount.Text)) //{ // totalAmount = new decimal?(System.Convert.ToDecimal(this.txtTotalAmount.Text)); //} //if (!string.IsNullOrEmpty(this.txtEndCash.Text)) //{ // endCash = new decimal?(System.Convert.ToDecimal(this.txtEndCash.Text)); //} //int count = CostDiary.GetCount(this.prjId, person, text, text2, userName, deparment, this.txtName.Text, this.ddlFlowState.SelectedValue, totalAmount, endCash, this.costType); //DataTable diaries = CostDiary.GetDiaries(this.prjId, person, text, text2, userName, deparment, this.txtName.Text, this.ddlFlowState.SelectedValue, totalAmount, endCash, this.costType, this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex); int count = CostDiary.GetCount(prjId, "", text, text2, "", "", "", "", totalAmount, endCash, "P"); DataTable diaries = CostDiary.GetDiaries(prjId, "", text, text2, "", "", "", "", totalAmount, endCash, "P", this.AspNetPager3.PageSize, this.AspNetPager3.CurrentPageIndex); this.AspNetPager3.RecordCount = count; this.gvBudget.DataSource = diaries; this.gvBudget.DataBind(); //this.hfldPurchaseChecked.Value = string.Empty; if (this.gvBudget.Rows.Count > 0) { //base.RegisterScript("fillTotalAmount('" + CostDiary.GetDiariesTotal(this.prjId, person, userName, name, this.ddlFlowState.SelectedValue, text, text2, deparment, this.costType, totalAmount, endCash).ToString("#,##0.000") + "');showDetails();"); //base.RegisterScript("fillTotalAmount('" + CostDiary.GetDiariesTotal(prjId, "", text, text2, "", "", "", "", "P", totalAmount, endCash).ToString("#,##0.000") + "');showDetails();"); return; } //base.RegisterScript("showDetails();"); }
protected string Code(string signCode, int count, bool isOrgDiary) { string str; if (count.ToString().Length == 1) { str = "0000" + count; } else { if (count.ToString().Length == 2) { str = "000" + count; } else { if (count.ToString().Length == 3) { str = "00" + count; } else { if (count.ToString().Length == 4) { str = "0" + count; } else { str = count.ToString(); } } } } string text = signCode + str; int num = isOrgDiary ? OrganizationDiary.GetOrgainCostCount(text) : CostDiary.GetCostcount(text); if (num > 0) { text = this.Code(signCode, count + 1, isOrgDiary); } return(text); }
protected void SumTotal() { DataTable contrast = CostDiary.GetContrast(base.Request["ic"]); if (contrast.Rows.Count > 0) { System.Collections.Generic.Dictionary <string, decimal> dictionary = new System.Collections.Generic.Dictionary <string, decimal>(); string text = "ThisAmount"; decimal value = decimal.Parse(contrast.Compute("sum(" + text + ")", "1=1").ToString()); dictionary.Add(text, value); DataTable dataTable = contrast.Clone(); int num = -1; foreach (DataRow dataRow in contrast.Rows) { num++; if (num <= 0 || !(dataRow["CBSCode"].ToString() == contrast.Rows[num - 1]["CBSCode"].ToString())) { DataRow dataRow2 = dataTable.NewRow(); dataRow2.ItemArray = dataRow.ItemArray; dataTable.Rows.Add(dataRow2); } } decimal num2 = decimal.Parse((dataTable.Compute("SUM(MonthAmount)", "1=1") == null) ? 0m.ToString() : dataTable.Compute("SUM(MonthAmount)", "1=1").ToString()); decimal d = decimal.Parse((dataTable.Compute("SUM(MonthAlreadyAmount)", "1=1") == null) ? 0m.ToString() : dataTable.Compute("SUM(MonthAlreadyAmount)", "1=1").ToString()); dictionary["MonthAmount"] = num2; dictionary["MonthCha"] = num2 - d; if (dictionary["MonthAmount"] > 0m) { dictionary.Add("ChaLv", decimal.Round(dictionary["MonthCha"] * 100m / dictionary["MonthAmount"], 3)); } else { dictionary.Add("ChaLv", 0m); } decimal value2 = decimal.Parse(dataTable.Compute("SUM(PrjAmount)", "1=1").ToString()); dictionary.Add("PrjAmount", value2); decimal value3 = decimal.Parse(dataTable.Compute("SUM(PrjAlreadyAmount)", "1=1").ToString()); dictionary.Add("PrjAlreadyAmount", value3); this.ViewState["sum"] = dictionary; } }
protected string GetIndiaryCode(bool isOrgDiary, string prjId) { string str = "ZZJG"; if (!isOrgDiary && !string.IsNullOrEmpty(prjId)) { string prjCode = this.GetPrjCode(prjId); str = (string.IsNullOrEmpty(prjCode) ? string.Empty : prjCode.Substring(prjCode.Length - 4)); } string str2 = Common2.GetTime(System.DateTime.Now).Replace("-", ""); string text = str + str2; int count; if (isOrgDiary) { count = OrganizationDiary.GetOrgainCostCount(text) + 1; } else { count = CostDiary.GetCostcount(text) + 1; } return(this.Code(text, count, isOrgDiary)); }