/// <summary> /// 计算收入和支出 20140417 /// </summary> /// <param name="line0"></param> /// <param name="item"></param> private void NewCalShourAndZhiChu(TrainLine line0, RepeaterItem item) { bool hasDianChe = false; //表示是否有发电车 Label lab1 = item.FindControl("traintype") as Label; ListControl cds = item.FindControl("cds") as ListControl; int traintype1 = int.Parse(lab1.Text); if (traintype1 == 21) { traintype1 = 2; hasDianChe = true; } ETrainType train1 = (ETrainType)(traintype1); double shouru1 = 0.0; int yz = 0, yw = 0, rw = 0, ca = 0, sy1 = 0; int totalPeople = 0; List <ZhiChuData>[] arrZc = new List <ZhiChuData> [4]; arrZc[0] = new List <ZhiChuData>(); arrZc[1] = new List <ZhiChuData>(); arrZc[2] = new List <ZhiChuData>(); arrZc[3] = new List <ZhiChuData>(); double JnFee = 0; // int cbmode = int.Parse(this.cb.selectIndex); int totalBianZhu = 18; Line.GetLineShouruAndZhiChu(train1, line0, cds.SelectedValue, totalBianZhu, out shouru1, ref yz, ref yw, ref rw, ref ca, ref sy1, out totalPeople, out arrZc[0], out arrZc[1], out arrZc[2], out arrZc[3], out JnFee, hasDianChe, true, 0, ""); //列车的收入 shouru1 = shouru1 / 10000; Label labShouRu = item.FindControl("shouru") as Label; labShouRu.Text = String.Format("{0:n0}", shouru1); //计算列车的运输总人数 Label labTotalPeople = item.FindControl("totalpeople") as Label; labTotalPeople.Text = String.Format("{0:n0}", totalPeople); //计算列车的总支出和合适的车厢编组 for (int i = 1; i <= 4; i++) { LinkButton labZhiChu = item.FindControl("zhichu" + i) as LinkButton; double sum1 = 0; String zc1 = String.Empty; foreach (ZhiChuData d1 in arrZc[i - 1]) { sum1 = sum1 + d1.ZhiChu; if (zc1 == String.Empty) { zc1 = d1.ZhiChu.ToString(); } else { zc1 = zc1 + "," + d1.ZhiChu.ToString(); } } zc1 = zc1 + "," + JnFee; sum1 = sum1 / 10000; labZhiChu.Text = String.Format("{0:n0}", sum1); labZhiChu.OnClientClick = "javascript:ShowZhiChu('" + zc1 + "');return false;"; //设置收支盈亏 Label labsz = item.FindControl("sz" + i) as Label; labsz.Text = String.Format("{0:n0}", shouru1 * SRate - sum1); //计算上座率 Label labSzr = item.FindControl("szr" + i) as Label; labSzr.Text = String.Format("{0:n0}%", 100 * sum1 / (shouru1 * SRate)); } //显示列车的合适编组 HyperLink link2 = item.FindControl("link2") as HyperLink; HyperLink link3 = item.FindControl("link3") as HyperLink; if (link2 != null) { if (int.Parse(lab1.Text) > 3 && lab1.Text != "21") { link2.Visible = false; link3.NavigateUrl = "SeeWordFile2.aspx?IsYear=1&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=0,0,0"; } else { if (lab1.Text != "21") { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=1&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2}", yz, yw, rw)); } else { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=1&TrainType=2&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2}", yz, yw, rw)); } link2.ToolTip = String.Format("最优的编组配置为:硬座{0}/ 硬卧{1}/ 软卧{2}", yz, yw, rw); link3.NavigateUrl = link2.NavigateUrl.Replace("BianZhuFenXi.aspx", "SeeWordFile.aspx"); } } Label bianzhu1 = item.FindControl("bianzhu") as Label; if (bianzhu1 != null) { bianzhu1.Text = String.Format("{0}-{1}-{2}", yz, yw, rw); } }
// 计算收入和支出 20140417 private void NewCalShourAndZhiChu(TrainLine line0, RepeaterItem item) { bool hasDianChe = false; //表示是否有发电车 bool isYearFlag = false; //表示是否是年分析的模式 if (this.isYearPage.Value == "1") { isYearFlag = true; } Label lab1 = item.FindControl("traintype") as Label; ListControl cds = item.FindControl("cds") as ListControl; int traintype1 = int.Parse(lab1.Text); if (traintype1 == 21) { traintype1 = 2; hasDianChe = true; } //25B和25K有电车(金寿吉新增) if (traintype1 == 0 || traintype1 == 1) { hasDianChe = true; } ETrainType train1 = (ETrainType)(traintype1); double shouru1 = 0.0; int yz1 = 0, yw1 = 0, rw1 = 0, ca1 = 0, sy1 = 0; int totalPeople = 0; List <ZhiChuData>[] arrZc = new List <ZhiChuData> [4]; arrZc[0] = new List <ZhiChuData>(); arrZc[1] = new List <ZhiChuData>(); arrZc[2] = new List <ZhiChuData>(); arrZc[3] = new List <ZhiChuData>(); double JnFee = 0; int totalBianZhu = 18; if (bz.SelectedIndex == 0) //表示是自动编组方式 { totalBianZhu = int.Parse(this.bzs0.SelectedValue); } //编组的选项目 if (this.bz.SelectedIndex == 1) { yz1 = int.Parse(yz.Text); yw1 = int.Parse(yw.Text); rw1 = int.Parse(rw.Text); ca1 = int.Parse(ca.Text); sy1 = int.Parse(sy.Text); } Line.GetLineShouruAndZhiChu(train1, line0, cds.SelectedValue, totalBianZhu, out shouru1, ref yz1, ref yw1, ref rw1, ref ca1, ref sy1, out totalPeople, out arrZc[0], out arrZc[1], out arrZc[2], out arrZc[3], out JnFee, hasDianChe, isYearFlag, cb.SelectedIndex, ""); //列车的收入 shouru1 = shouru1 / 10000; Label labShouRu = item.FindControl("shouru") as Label; if (isYearFlag == false) { labShouRu.Text = String.Format("{0:n2}", shouru1); //labShouRu.Text = shouru1 + ""; } else { labShouRu.Text = String.Format("{0:n0}", shouru1); } //计算列车的运输总人数 Label labTotalPeople = item.FindControl("totalpeople") as Label; labTotalPeople.Text = String.Format("{0}", totalPeople); //计算列车的总支出和合适的车厢编组 for (int i = 1; i <= 4; i++) { Label labZhiChu = item.FindControl("zhichu" + i) as Label; double sum1 = 0; String zc1 = String.Empty; foreach (ZhiChuData d1 in arrZc[i - 1]) { double t1 = d1.ZhiChu; sum1 = sum1 + t1; if (zc1 == String.Empty) { zc1 = d1.ZhiChu.ToString(); } else { zc1 = zc1 + "," + d1.ZhiChu.ToString(); } } zc1 = zc1 + "," + JnFee; if (isYearFlag == false) { labZhiChu.Text = String.Format("{0:n2}", sum1); } else { labZhiChu.Text = String.Format("{0:n0}", sum1); } //labZhiChu.OnClientClick = "javascript:ShowZhiChu('" + zc1 + "');return false;"; //设置收支盈亏 Label labsz = item.FindControl("sz" + i) as Label; if (isYearFlag == false) { labsz.Text = String.Format("{0:n2}", shouru1 * SRate - sum1); } else { labsz.Text = String.Format("{0:n0}", shouru1 * SRate - sum1); } //计算上座率 Label labSzr = item.FindControl("szr" + i) as Label; if (isYearFlag == false) { labSzr.Text = String.Format("{0:n2}%", 100 * sum1 / (shouru1 * SRate)); } else { labSzr.Text = String.Format("{0:n0}%", 100 * sum1 / (shouru1 * SRate)); } } //显示列车的合适编组 HyperLink link2 = item.FindControl("link2") as HyperLink; HyperLink link3 = item.FindControl("link3") as HyperLink; if (link2 != null) { if (int.Parse(lab1.Text) > 3 && lab1.Text != "21") { link2.Visible = false; link3.NavigateUrl = "SeeWordFile2.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=0,0,0,0,0"; } else { if (lab1.Text != "21") { if (lab1.Text == "0" || lab1.Text == "1") //表示 25B和25K { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1, ca1, sy1)); } else { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1, ca1, sy1)); } } else //表示非直供电25G { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=2&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1, ca1, sy1)); } link2.ToolTip = String.Format("最优的编组配置为:硬座{0}/ 硬卧{1}/ 软卧{2}/ 餐车{3} /宿营车{4}", yz1, yw1, rw1, ca1, sy1); link3.NavigateUrl = link2.NavigateUrl.Replace("BianZhuFenXi.aspx", "SeeWordFile.aspx"); if (this.bz.SelectedIndex == 1) { link2.NavigateUrl = "javascript:alert('提示:此功能不适合手动编组模式!');"; link2.ToolTip = String.Format("手动编组:硬座{0}/ 硬卧{1}/ 软卧{2}/ 餐车{3}/宿营车{4}", yz1, yw1, rw1, ca1, sy1); } } } Label bianzhu1 = item.FindControl("bianzhu") as Label; if (bianzhu1 != null) { bianzhu1.Text = String.Format("{0}-{1}-{2}-{3}-{4}", yz1, yw1, rw1, ca1, sy1); } }