//protected void btnModify_OnClick(object sender, EventArgs e)
        //{
        //    string YS_CONTRACT_NO = "";
        //    string CONTRACT_NO = "";
        //    foreach (GridViewRow grow in GridView1.Rows)
        //    {
        //        System.Web.UI.WebControls.CheckBox ckb = (System.Web.UI.WebControls.CheckBox)grow.FindControl("CheckBox1");
        //        if (ckb.Checked)
        //        {
        //            CONTRACT_NO = ((HiddenField)grow.FindControl("hdfMP_ID")).Value.ToString();
        //            Encrypt_Decrypt ed = new Encrypt_Decrypt();
        //            YS_CONTRACT_NO = ed.EncryptText(CONTRACT_NO);
        //            break;
        //        }
        //    }
        //    if (YS_CONTRACT_NO != "")
        //    {
        //        string sql_fin = "select YS_XS_Finished from TBPM_CONPCHSINFO where PCON_BCODE='" + CONTRACT_NO + "'";
        //        System.Data.DataTable dt_fin = DBCallCommon.GetDTUsingSqlText(sql_fin);
        //        if (dt_fin.Rows.Count > 0)
        //        {
        //            if (dt_fin.Rows[0][0].ToString() == "1")
        //            {
        //                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('该合同已完成结算!');", true);
        //                return;
        //            }
        //            else
        //            {
        //                try
        //                {
        //                    string sql = DBCallCommon.GetStringValue("connectionStrings");
        //                    sql += "Asynchronous Processing=true;";
        //                    SqlConnection sqlConn = new SqlConnection(sql);
        //                    sqlConn.Open();
        //                    SqlCommand sqlCmd = new SqlCommand("YS_COST_REAL_PROCEDURE", sqlConn);
        //                    sqlCmd.CommandType = CommandType.StoredProcedure;
        //                    sqlCmd.CommandTimeout = 0;
        //                    sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue;			//增加返回值参数@retVal
        //                    IAsyncResult result = sqlCmd.BeginExecuteNonQuery();
        //                    sqlCmd.EndExecuteNonQuery(result);
        //                    sqlConn.Close();

        //                }
        //                catch (Exception)
        //                {
        //                    throw;
        //                }
        //                string sql1 = "update TBPM_CONPCHSINFO set YS_XS_Finished='1',YS_Finshtime=GETDATE() where PCON_BCODE='" + CONTRACT_NO + "'";
        //                DBCallCommon.ExeSqlText(sql1);
        //                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('合同结算成功!');", true);
        //                UCPaging1.CurrentPage = 1;
        //                InitVar();
        //                GetTechRequireData();
        //            }
        //        }
        //    }
        //    else
        //    {
        //        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择要修改的行!!!');", true);
        //    }
        //}

        protected void btn_ShowTask_OnClick(object sender, EventArgs e)
        {
            string YS_CONTRACT_NO = "";
            string CONTRACT_NO    = "";

            foreach (GridViewRow grow in GridView1.Rows)
            {
                System.Web.UI.WebControls.CheckBox ckb = (System.Web.UI.WebControls.CheckBox)grow.FindControl("CheckBox1");
                if (ckb.Checked)
                {
                    CONTRACT_NO = ((HiddenField)grow.FindControl("hdfMP_ID")).Value.ToString();
                    Encrypt_Decrypt ed = new Encrypt_Decrypt();
                    YS_CONTRACT_NO = ed.EncryptText(CONTRACT_NO);
                    break;
                }
            }
            if (YS_CONTRACT_NO != "")
            {
                string URL = "YS_Cost_Budget_A_M.aspx?ContractNo=" + YS_CONTRACT_NO;
                Response.Redirect(URL);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择要查看的行!!!');", true);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 跳转到预算明细页面
        /// </summary>
        /// <param name="operate">操作参数</param>
        /// <param name="contractno">合同号</param>
        /// <returns></returns>
        protected string GetEncodeUrl(string operate, string contractno)
        {
            string          url = "";
            Encrypt_Decrypt ed  = new Encrypt_Decrypt();

            url = "YS_Cost_Budget_Audit.aspx?action=" + ed.EncryptText(operate) + "&ContractNo=" + ed.EncryptText(contractno) + "&User=null";
            return(url);
        }
Esempio n. 3
0
        protected void GridView1_onrowdatabound(object sender, GridViewRowEventArgs e)
        {
            String controlId = ((GridView)sender).ClientID;
            String uniqueId  = "";

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                uniqueId = String.Format("{0}{1}", controlId, e.Row.RowIndex);
                e.Row.Attributes.Add("onclick", String.Format("SelectRow('{0}', this);", uniqueId));
                //e.Row.Attributes.Add("onclick", "ItemOver(this)");  //单击行变色
                string lbl_CONTRACT_NO = ((Label)e.Row.FindControl("lbl_YS_CONTRACT_NO")).Text.ToString();
                string lbl_TSA_ID      = ((Label)e.Row.FindControl("lbl_YS_TSA_ID")).Text.ToString();
                e.Row.Cells[1].Attributes.Add("ondblclick", "ShowContract('" + lbl_CONTRACT_NO + "')");
                e.Row.Cells[1].Attributes.Add("title", "双击关联合同信息!");

                Encrypt_Decrypt ed          = new Encrypt_Decrypt();
                string          TSA_ID      = ed.EncryptText(lbl_TSA_ID);
                string          CONTRACT_NO = ed.EncryptText(lbl_CONTRACT_NO);
                string[]        fathername  = { "FERROUS_METAL", "PURCHASE_PART", "MACHINING_PART", "PAINT_COATING", "ELECTRICAL", "OTHERMAT_COST", "TEAM_CONTRACT", "FAC_CONTRACT", "PRODUCT_OUT" };
                //for (int i = 0; i < fathername.Length; i++)
                //{
                //    e.Row.Cells[i + 5].Attributes.Add("ondblclick", "PurMarView('" + TSA_ID + "','" + ed.EncryptText(fathername[i]) + "')");
                //    e.Row.Cells[i + 5].Attributes["style"] = "Cursor:hand";
                //    e.Row.Cells[i + 5].Attributes.Add("title", "双击查看明细");
                //}
                if (Session["UserDeptID"].ToString() == "08")
                {
                    string lab_JSstate  = ((Label)e.Row.FindControl("lab_JSstate")).Text.ToString();
                    string lab_Finstate = ((Label)e.Row.FindControl("lab_Finstate")).Text.ToString();
                    if (lab_JSstate == "可结算")
                    {
                        e.Row.Cells[0].BackColor = System.Drawing.Color.Red;
                    }
                }
            }
        }
        protected void GridView1_onrowdatabound(object sender, GridViewRowEventArgs e)
        {
            String controlId = ((GridView)sender).ClientID;
            String uniqueId  = "";

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                uniqueId = String.Format("{0}{1}", controlId, e.Row.RowIndex);
                e.Row.Attributes.Add("onclick", String.Format("SelectRow('{0}', this);", uniqueId));
                e.Row.Attributes.Add("onclick", "ItemOver(this)");  //单击行变色
                //string lbl_CONTRACT_NO = ((System.Web.UI.WebControls.Label)e.Row.FindControl("lbl_YS_CONTRACT_NO")).Text.ToString();
                string lbl_pcon_sch = ((System.Web.UI.WebControls.Label)e.Row.FindControl("lbl_pcon_sch")).Text.ToString();
                //e.Row.Cells[1].Attributes.Add("ondblclick", "ShowContract('" + lbl_CONTRACT_NO + "')");//第二格,即合同号上添加双击事件
                //e.Row.Cells[1].Attributes.Add("title", "双击关联合同信息!");

                Encrypt_Decrypt ed = new Encrypt_Decrypt();
                //string CONTRACT_NO = ed.EncryptText(lbl_CONTRACT_NO);
                string   PCON_SCH   = ed.EncryptText(lbl_pcon_sch);
                string[] fathername = { "FERROUS_METAL", "PURCHASE_PART", "CASTING_FORGING", "PAINT_COATING", "ELECTRICAL", "OTHERMAT_COST", "MATERIAL_COST", "TEAM_CONTRACT", "FAC_CONTRACT", "PRODUCT_OUT" };
                // 利润总额和净利润的红黄预警
                //string[] fathername_profit = { "PROFIT"};
                //for (int m = 0; m < fathername_profit.Length; m++)
                //{
                //    //标签提示
                //    double percent_O_B = ((HiddenField)e.Row.FindControl("hidden_" + fathername_profit[m])).Value.ToString() == "" ? 0 : Convert.ToDouble(((HiddenField)e.Row.FindControl("hidden_" + fathername_profit[m])).Value.ToString());//订单完成百分比
                //    double db_Budget = Math.Round((((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername_profit[m])).Text.ToString()) == "" ? 0 : Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername_profit[m])).Text.ToString()) / 10000, 1);//预算费用
                //    double db_Order = Math.Round((((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername_profit[m] + "_R")).Text.ToString()) == "" ? 0 : Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername_profit[m] + "_R")).Text.ToString()) / 10000, 1);//实际费用
                //    double db_pass = Math.Round(db_Order - db_Budget, 1);
                //    if (db_pass > 0)
                //    {
                //        e.Row.Cells[m + 8].Attributes["style"] = "Cursor:hand";
                //        if (m == 0)
                //        {
                //            e.Row.Cells[m + 8].Attributes.Add("title", "毛利润达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,高出预算" + db_pass.ToString() + "万");
                //        }
                //        else
                //        {
                //            e.Row.Cells[m + 8].Attributes.Add("title", "净利润达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,高出预算" + db_pass.ToString() + "万");
                //        }
                //    }
                //    else
                //    {
                //        db_pass = Math.Abs(db_pass);
                //        if (m == 0)
                //        {
                //            e.Row.Cells[m + 8].Attributes.Add("title", "毛利润达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                //        }
                //        else
                //        {
                //            e.Row.Cells[m + 8].Attributes.Add("title", "净利润达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                //        }
                //    }
                //    //红黄预警
                //    if (percent_O_B < 0)
                //    {
                //        e.Row.Cells[m + 8].BackColor = System.Drawing.Color.Yellow;
                //    }
                //    else
                //    {
                //        percent_O_B = Math.Abs(percent_O_B);
                //        if (percent_O_B > 1.0 && percent_O_B < 1.1)
                //        {
                //            e.Row.Cells[m + 8].BackColor = System.Drawing.Color.PeachPuff;
                //        }
                //        if (percent_O_B < 1.0)
                //        {
                //            e.Row.Cells[m + 8].BackColor = System.Drawing.Color.Yellow;
                //        }
                //    }
                //}
                //红黄预警
                for (int i = 0; i < fathername.Length; i++)
                {
                    double percent_O_B = ((HiddenField)e.Row.FindControl("hidden_" + fathername[i])).Value.ToString() == "" ? 0 : Convert.ToDouble(((HiddenField)e.Row.FindControl("hidden_" + fathername[i])).Value.ToString());
                    percent_O_B = Math.Abs(percent_O_B);
                    if (percent_O_B > 0.9 && percent_O_B < 1.0)
                    {
                        e.Row.Cells[i + 3].BackColor = System.Drawing.Color.PeachPuff;
                    }
                    if (percent_O_B > 1.0)
                    {
                        e.Row.Cells[i + 3].BackColor = System.Drawing.Color.Yellow;
                    }
                }
                for (int j = 3; j < 13; j++)  //添加双击查看明细、红黄预警、进度显示
                {
                    //if (j < 21)
                    //{
                    double percent_O_B = ((HiddenField)e.Row.FindControl("hidden_" + fathername[j - 3])).Value.ToString() == "" ? 0 : Convert.ToDouble(((HiddenField)e.Row.FindControl("hidden_" + fathername[j - 3])).Value.ToString());                                                                        //订单完成百分比
                    double db_Budget   = Math.Round((((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 3])).Text.ToString()) == "" ? 0 : Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 3])).Text.ToString()) / 10000, 2);               //预算费用
                    double db_Order    = Math.Round((((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 3] + "_R")).Text.ToString()) == "" ? 0 : Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 3] + "_R")).Text.ToString()) / 10000, 2); //实际费用
                    double db_pass     = Math.Round(db_Order - db_Budget, 2);
                    if (j < 10)
                    {
                        //e.Row.Cells[j].Attributes.Add("ondblclick", "PurMarView('" + PCON_SCH + "','" + ed.EncryptText(fathername[j - 9]) + "')");
                        e.Row.Cells[j].Attributes["style"] = "Cursor:hand";
                        if (db_pass > 0)
                        {
                            e.Row.Cells[j].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超出预算" + db_pass.ToString() + "万");
                            //e.Row.Cells[j + 10].Attributes.Add("ondblclick", "PurMarView('" + PCON_SCH + "','" + ed.EncryptText(fathername[j - 9]) + "')");
                            e.Row.Cells[j + 10].Attributes["style"] = "Cursor:hand";
                            e.Row.Cells[j + 10].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超出预算" + db_pass.ToString() + "万");
                        }
                        else
                        {
                            db_pass = Math.Abs(db_pass);
                            e.Row.Cells[j].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                            //e.Row.Cells[j + 10].Attributes.Add("ondblclick", "PurMarView('" + PCON_SCH + "','" + ed.EncryptText(fathername[j - 9]) + "')");
                            e.Row.Cells[j + 10].Attributes["style"] = "Cursor:hand";
                            e.Row.Cells[j + 10].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超出预算" + db_pass.ToString() + "万");
                        }
                    }
                    else
                    {
                        if (db_pass > 0)
                        {
                            e.Row.Cells[j].Attributes["style"] = "Cursor:hand";
                            e.Row.Cells[j].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超出预算" + db_pass.ToString() + "万");
                        }
                        else
                        {
                            db_pass = Math.Abs(db_pass);
                            e.Row.Cells[j].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        protected void GridView1_onrowdatabound(object sender, GridViewRowEventArgs e)
        {
            String controlId = ((GridView)sender).ClientID;
            String uniqueId  = "";

            string[] fathername = { "MAR_AMOUNT", "FERROUS_METAL", "PURCHASE_PART", "MACHINING_PART", "PAINT_COATING", "ELECTRICAL", "OTHERMAT_COST" };
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                uniqueId = String.Format("{0}{1}", controlId, e.Row.RowIndex);
                e.Row.Attributes.Add("onclick", String.Format("SelectRow('{0}', this);", uniqueId));
                //双击合同号,查看合同详细信息
                string lbl_CONTRACT_NO = ((System.Web.UI.WebControls.Label)e.Row.FindControl("lbl_YS_CONTRACT_NO")).Text.ToString();
                string lbl_pcon_sch    = ((System.Web.UI.WebControls.Label)e.Row.FindControl("lbl_pcon_sch")).Text.ToString();
                e.Row.Cells[1].Attributes.Add("ondblclick", "ShowContract('" + lbl_CONTRACT_NO + "')");//第二格,即合同号上添加双击事件
                e.Row.Cells[1].Attributes.Add("title", "双击关联合同信息!");

                Encrypt_Decrypt ed          = new Encrypt_Decrypt();
                string          CONTRACT_NO = ed.EncryptText(lbl_CONTRACT_NO);
                string          PCON_SCH    = ed.EncryptText(lbl_pcon_sch);
                //红黄预警
                for (int i = 0; i < fathername.Length; i++)
                {
                    string per         = ((HiddenField)e.Row.FindControl("hidden_" + fathername[i])).Value.ToString();
                    double percent_O_B = Convert.ToDouble(((HiddenField)e.Row.FindControl("hidden_" + fathername[i])).Value.ToString());
                    if (percent_O_B > 0.9 && percent_O_B < 1.0)
                    {
                        e.Row.Cells[i + 5].BackColor = System.Drawing.Color.PeachPuff;
                    }
                    if (percent_O_B > 1.0)
                    {
                        e.Row.Cells[i + 5].BackColor = System.Drawing.Color.Yellow;
                    }
                }
                //双击查看详细
                for (int j = 5; j < 12; j++)
                {
                    double percent_O_B = Convert.ToDouble(((HiddenField)e.Row.FindControl("hidden_" + fathername[j - 5])).Value.ToString());                                               //订单完成百分比
                    double db_Budget   = Math.Round(Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 5])).Text.ToString()) / 10000, 1);        //预算费用
                    double db_Order    = Math.Round(Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 5] + "_O")).Text.ToString()) / 10000, 1); //订单费用
                    double db_pass     = Math.Round(db_Order - db_Budget, 1);
                    if (j < 6)
                    {
                        if (db_pass > 0)
                        {
                            //e.Row.Cells[j].Attributes.Add("ondblclick", "PurMarView_Amount('" + PCON_SCH + "')");
                            e.Row.Cells[j].Attributes["style"] = "Cursor:hand";
                            e.Row.Cells[j].Attributes.Add("title", "订单达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超额" + db_pass.ToString() + "万,双击查看材料总额明细");
                        }
                        else
                        {
                            //e.Row.Cells[j].Attributes.Add("ondblclick", "PurMarView_Amount('" + PCON_SCH + "')");
                            e.Row.Cells[j].Attributes["style"] = "Cursor:hand";
                            e.Row.Cells[j].Attributes.Add("title", "订单达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,未超额,双击查看材料总额明细");
                        }
                    }
                    else
                    {
                        //e.Row.Cells[j].Attributes.Add("ondblclick", "PurMarView('" + PCON_SCH + "','" + ed.EncryptText(fathername[j - 5]) + "')");
                        e.Row.Cells[j].Attributes["style"] = "Cursor:hand";
                        if (db_pass > 0)
                        {
                            e.Row.Cells[j].Attributes.Add("title", "订单达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超额" + db_pass.ToString() + "万");
                        }
                        else
                        {
                            db_pass = Math.Abs(db_pass);
                            e.Row.Cells[j].Attributes.Add("title", "订单达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,未超额");
                        }
                    }
                }
            }
        }
        protected void GridView1_onrowdatabound(object sender, GridViewRowEventArgs e)
        {
            String controlId = ((GridView)sender).ClientID;
            String uniqueId  = "";

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                uniqueId = String.Format("{0}{1}", controlId, e.Row.RowIndex);
                e.Row.Attributes.Add("onclick", String.Format("SelectRow('{0}', this);", uniqueId));
                //e.Row.Attributes.Add("onclick", "ItemOver(this)");  //单击行变色
                string lbl_CONTRACT_NO = ((System.Web.UI.WebControls.Label)e.Row.FindControl("lbl_YS_CONTRACT_NO")).Text.ToString();
                //string lbl_pcon_sch = ((System.Web.UI.WebControls.Label)e.Row.FindControl("lbl_pcon_sch")).Text.ToString();
                e.Row.Cells[1].Attributes.Add("ondblclick", "ShowContract('" + lbl_CONTRACT_NO + "')");//第二格,即合同号上添加双击事件
                e.Row.Cells[1].Attributes.Add("title", "双击关联合同信息!");

                //结算时间预警
                string   hidden_deadtime = ((HiddenField)e.Row.FindControl("hidden_YS_Deadtime")).Value.ToString();
                DateTime deadtime        = Convert.ToDateTime(hidden_deadtime);
                DateTime Nowtime         = DateTime.Now;
                TimeSpan d1 = Nowtime.Subtract(deadtime);
                int      d2 = d1.Days;
                if (d2 <= 7 && Nowtime < deadtime)
                {
                    e.Row.Cells[0].BackColor = System.Drawing.Color.Orange;
                }

                //结算时间报警
                string sql_fin = "select [GS_TIME],[CNFB_TIME],[WX_TIME] from [View_YS_CON_TIME] where [YS_CONTRACT_NO]='" + lbl_CONTRACT_NO + "'";
                System.Data.DataTable dt_fin = DBCallCommon.GetDTUsingSqlText(sql_fin);
                if (dt_fin.Rows.Count > 0)
                {
                    string gs   = dt_fin.Rows[0][0].ToString();
                    string cnfb = dt_fin.Rows[0][1].ToString();
                    string wx   = dt_fin.Rows[0][2].ToString();
                    if (gs != "")
                    {
                        DateTime gstime = Convert.ToDateTime(gs);
                        if (gstime > deadtime)
                        {
                            e.Row.Cells[0].BackColor = System.Drawing.Color.Red;
                        }
                    }
                    if (cnfb != "")
                    {
                        DateTime cnfbtime = Convert.ToDateTime(cnfb);
                        if (cnfbtime > deadtime)
                        {
                            e.Row.Cells[0].BackColor = System.Drawing.Color.Red;
                        }
                    }
                    if (wx != "")
                    {
                        DateTime wxtime = Convert.ToDateTime(wx);
                        if (wxtime > deadtime)
                        {
                            e.Row.Cells[0].BackColor = System.Drawing.Color.Red;
                        }
                    }
                }



                Encrypt_Decrypt ed          = new Encrypt_Decrypt();
                string          CONTRACT_NO = ed.EncryptText(lbl_CONTRACT_NO);
                //string PCON_SCH = ed.EncryptText(lbl_pcon_sch);
                string[] fathername = { "MATERIAL_COST", "TEAM_CONTRACT", "FAC_CONTRACT", "PRODUCT_OUT", "TRANS_COST", "FERROUS_METAL", "PURCHASE_PART", "CASTING_FORGING", "PAINT_COATING", "ELECTRICAL", "OTHERMAT_COST" };
                // 利润总额和净利润的红黄预警
                string[] fathername_profit = { "PROFIT" };
                for (int m = 0; m < fathername_profit.Length; m++)
                {
                    //标签提示
                    double percent_O_B = ((HiddenField)e.Row.FindControl("hidden_" + fathername_profit[m])).Value.ToString() == "" ? 0 : Convert.ToDouble(((HiddenField)e.Row.FindControl("hidden_" + fathername_profit[m])).Value.ToString());                                                                        //订单完成百分比
                    double db_Budget   = Math.Round((((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername_profit[m])).Text.ToString()) == "" ? 0 : Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername_profit[m])).Text.ToString()) / 10000, 2);               //预算费用
                    double db_Order    = Math.Round((((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername_profit[m] + "_R")).Text.ToString()) == "" ? 0 : Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername_profit[m] + "_R")).Text.ToString()) / 10000, 2); //实际费用
                    double db_pass     = Math.Round(db_Order - db_Budget, 2);
                    if (db_pass > 0)
                    {
                        e.Row.Cells[m + 8].Attributes["style"] = "Cursor:hand";
                        if (m == 0)
                        {
                            e.Row.Cells[m + 8].Attributes.Add("title", "毛利润达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,高出预算" + db_pass.ToString() + "万");
                        }
                        else
                        {
                            e.Row.Cells[m + 8].Attributes.Add("title", "净利润达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,高出预算" + db_pass.ToString() + "万");
                        }
                    }
                    else
                    {
                        db_pass = Math.Abs(db_pass);
                        if (m == 0)
                        {
                            e.Row.Cells[m + 8].Attributes.Add("title", "毛利润达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                        }
                        else
                        {
                            e.Row.Cells[m + 8].Attributes.Add("title", "净利润达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                        }
                    }
                    //红黄预警
                    if (percent_O_B < 0)
                    {
                        e.Row.Cells[m + 8].BackColor = System.Drawing.Color.Yellow;
                    }
                    else
                    {
                        percent_O_B = Math.Abs(percent_O_B);
                        if (percent_O_B > 1.0)
                        {
                            e.Row.Cells[m + 8].BackColor = System.Drawing.Color.Yellow;
                        }
                        if (percent_O_B < 1.0 && percent_O_B > 0.9)
                        {
                            e.Row.Cells[m + 8].BackColor = System.Drawing.Color.PeachPuff;
                        }
                    }
                }
                //红黄预警
                for (int i = 0; i < fathername.Length; i++)
                {
                    double percent_O_B = ((HiddenField)e.Row.FindControl("hidden_" + fathername[i])).Value.ToString() == "" ? 0 : Convert.ToDouble(((HiddenField)e.Row.FindControl("hidden_" + fathername[i])).Value.ToString());
                    percent_O_B = Math.Abs(percent_O_B);
                    if (percent_O_B > 0.9 && percent_O_B < 1.0)
                    {
                        e.Row.Cells[i + 9].BackColor = System.Drawing.Color.PeachPuff;
                    }
                    if (percent_O_B > 1.0)
                    {
                        e.Row.Cells[i + 9].BackColor = System.Drawing.Color.Yellow;
                    }
                }
                for (int j = 9; j < 20; j++)  //添加双击查看明细、红黄预警、进度显示
                {
                    //if (j < 21)
                    //{
                    double percent_O_B = ((HiddenField)e.Row.FindControl("hidden_" + fathername[j - 9])).Value.ToString() == "" ? 0 : Convert.ToDouble(((HiddenField)e.Row.FindControl("hidden_" + fathername[j - 9])).Value.ToString());                                                                        //订单完成百分比
                    double db_Budget   = Math.Round((((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 9])).Text.ToString()) == "" ? 0 : Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 9])).Text.ToString()) / 10000, 2);               //预算费用
                    double db_Order    = Math.Round((((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 9] + "_R")).Text.ToString()) == "" ? 0 : Convert.ToDouble(((System.Web.UI.WebControls.Label)e.Row.FindControl("lab_" + fathername[j - 9] + "_R")).Text.ToString()) / 10000, 2); //实际费用
                    double db_pass     = Math.Round(db_Order - db_Budget, 2);
                    if (j < 20)
                    {
                        //e.Row.Cells[j].Attributes.Add("ondblclick", "PurMarView('" + PCON_SCH + "','" + ed.EncryptText(fathername[j - 9]) + "')");
                        e.Row.Cells[j].Attributes["style"] = "Cursor:hand";
                        if (db_pass > 0)
                        {
                            e.Row.Cells[j].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超出预算" + db_pass.ToString() + "万");
                            //e.Row.Cells[j + 12].Attributes.Add("ondblclick", "PurMarView('" + PCON_SCH + "','" + ed.EncryptText(fathername[j - 9]) + "')");
                            e.Row.Cells[j + 12].Attributes["style"] = "Cursor:hand";
                            e.Row.Cells[j + 12].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超出预算" + db_pass.ToString() + "万");
                        }
                        else
                        {
                            db_pass = Math.Abs(db_pass);
                            e.Row.Cells[j].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                            //e.Row.Cells[j + 12].Attributes.Add("ondblclick", "PurMarView('" + PCON_SCH + "','" + ed.EncryptText(fathername[j - 9]) + "')");
                            e.Row.Cells[j + 12].Attributes["style"] = "Cursor:hand";
                            e.Row.Cells[j + 12].Attributes.Add("title", "实际费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                        }
                    }
                    else
                    {
                        if (db_pass > 0)
                        {
                            e.Row.Cells[j].Attributes["style"] = "Cursor:hand";
                            e.Row.Cells[j].Attributes.Add("title", "费用达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,超出预算" + db_pass.ToString() + "万");
                        }
                        else
                        {
                            db_pass = Math.Abs(db_pass);
                            e.Row.Cells[j].Attributes.Add("title", "订单达到" + db_Order.ToString() + "万,达预算" + (100 * percent_O_B).ToString() + "%,低于预算" + db_pass.ToString() + "万");
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        protected void BindData()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());

            string[] fathername     = { "FERROUS_METAL", "PURCHASE_PART", "MACHINING_PART", "PAINT_COATING", "ELECTRICAL", "OTHERMAT_COST" };
            string[] mar_name       = { "黑色金属", "外购件", "加工件", "油漆涂料", "电气电料", "其他材料费" };
            string   sql_mar_amount = "select Convert(decimal(16,2), YS_FERROUS_METAL_BG*1.17) as YS_FERROUS_METAL_BG,YS_FERROUS_METAL," +
                                      "Convert(decimal(16,2), YS_PURCHASE_PART_BG*1.17) as YS_PURCHASE_PART_BG,YS_PURCHASE_PART," +
                                      "Convert(decimal(16,2), YS_MACHINING_PART_BG*1.17) as YS_MACHINING_PART_BG,YS_MACHINING_PART," +
                                      "Convert(decimal(16,2), YS_PAINT_COATING_BG*1.17) as YS_PAINT_COATING_BG,YS_PAINT_COATING," +
                                      "Convert(decimal(16,2), YS_ELECTRICAL_BG*1.17) as YS_ELECTRICAL_BG,YS_ELECTRICAL," +
                                      "Convert(decimal(16,2), YS_OTHERMAT_COST_BG*1.17) as YS_OTHERMAT_COST_BG,YS_OTHERMAT_COST," +
                                      "Convert(decimal(16,2),(YS_FERROUS_METAL_BG+YS_PURCHASE_PART_BG+YS_MACHINING_PART_BG+YS_PAINT_COATING_BG+YS_ELECTRICAL_BG+YS_OTHERMAT_COST_BG)*1.17) AS YS_MAR_AMOUNT_BG," +
                                      "(YS_FERROUS_METAL+YS_PURCHASE_PART+YS_MACHINING_PART+YS_PAINT_COATING+YS_ELECTRICAL+YS_OTHERMAT_COST) AS YS_MAR_AMOUNT," +
                                      "Convert(decimal(16,2), 100*(YS_FERROUS_METAL/(YS_FERROUS_METAL_BG*1.17+1))) as YS_FERROUS_METAL_BG_percent," +
                                      "Convert(decimal(16,2), 100*(YS_PURCHASE_PART/(YS_PURCHASE_PART_BG*1.17+1))) as YS_PURCHASE_PART_BG_percent," +
                                      "Convert(decimal(16,2), 100*(YS_MACHINING_PART/(YS_MACHINING_PART_BG*1.17+1))) as YS_MACHINING_PART_BG_percent," +
                                      "Convert(decimal(16,2), 100*(YS_PAINT_COATING/(YS_PAINT_COATING_BG*1.17+1))) as YS_PAINT_COATING_BG_percent," +
                                      "Convert(decimal(16,2), 100*(YS_ELECTRICAL/(YS_ELECTRICAL_BG*1.17+1))) as YS_ELECTRICAL_BG_percent," +
                                      "Convert(decimal(16,2), 100*(YS_OTHERMAT_COST/(YS_OTHERMAT_COST_BG*1.17+1))) as YS_OTHERMAT_COST_BG_percent," +
                                      "Convert(decimal(16,2), 100*((YS_FERROUS_METAL+YS_PURCHASE_PART+YS_MACHINING_PART+YS_PAINT_COATING+YS_ELECTRICAL+YS_OTHERMAT_COST)/((YS_FERROUS_METAL_BG+YS_PURCHASE_PART_BG+YS_MACHINING_PART_BG+YS_PAINT_COATING_BG+YS_ELECTRICAL_BG+YS_OTHERMAT_COST_BG)*1.17+1))) from View_YS_COST_BUDGET_ORDER where PCON_SCH='" + ContractNo + "'";

            System.Data.DataTable dt_mar_amount = DBCallCommon.GetDTUsingSqlText(sql_mar_amount);
            string CONTRACT_NO = ed.EncryptText(ContractNo);

            CreateNewRow(7);
            int i = 0;

            foreach (RepeaterItem Item in tbpc_otherpurbillRepeater.Items)
            {
                switch (i)
                {
                case 0:
                    ((Label)Item.FindControl("lab_YS_NAME")).Text           = "黑色金属";
                    ((Label)Item.FindControl("lab_YS_MAR_BG")).Text         = dt_mar_amount.Rows[0][0].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR")).Text            = dt_mar_amount.Rows[0][1].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR_Percent")).Text    = dt_mar_amount.Rows[0][14].ToString() + "%";
                    ((HyperLink)Item.FindControl("Hpl_detail")).NavigateUrl = "../YS_Data/YS_Cost_Budget_O_M_Detail.aspx?ContractNo=" + CONTRACT_NO + "&FatherCode=" + ed.EncryptText("FERROUS_METAL") + "";
                    break;

                case 1:
                    ((Label)Item.FindControl("lab_YS_NAME")).Text           = "外购件";
                    ((Label)Item.FindControl("lab_YS_MAR_BG")).Text         = dt_mar_amount.Rows[0][2].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR")).Text            = dt_mar_amount.Rows[0][3].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR_Percent")).Text    = dt_mar_amount.Rows[0][15].ToString() + "%";
                    ((HyperLink)Item.FindControl("Hpl_detail")).NavigateUrl = "../YS_Data/YS_Cost_Budget_O_M_Detail.aspx?ContractNo=" + CONTRACT_NO + "&FatherCode=" + ed.EncryptText("PURCHASE_PART") + "";
                    break;

                case 2:
                    ((Label)Item.FindControl("lab_YS_NAME")).Text           = "加工件";
                    ((Label)Item.FindControl("lab_YS_MAR_BG")).Text         = dt_mar_amount.Rows[0][4].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR")).Text            = dt_mar_amount.Rows[0][5].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR_Percent")).Text    = dt_mar_amount.Rows[0][16].ToString() + "%";
                    ((HyperLink)Item.FindControl("Hpl_detail")).NavigateUrl = "../YS_Data/YS_Cost_Budget_O_M_Detail.aspx?ContractNo=" + CONTRACT_NO + "&FatherCode=" + ed.EncryptText("MACHINING_PART") + "";
                    break;

                case 3:
                    ((Label)Item.FindControl("lab_YS_NAME")).Text           = "油漆涂料";
                    ((Label)Item.FindControl("lab_YS_MAR_BG")).Text         = dt_mar_amount.Rows[0][6].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR")).Text            = dt_mar_amount.Rows[0][7].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR_Percent")).Text    = dt_mar_amount.Rows[0][17].ToString() + "%";
                    ((HyperLink)Item.FindControl("Hpl_detail")).NavigateUrl = "../YS_Data/YS_Cost_Budget_O_M_Detail.aspx?ContractNo=" + CONTRACT_NO + "&FatherCode=" + ed.EncryptText("PAINT_COATING") + "";
                    break;

                case 4:
                    ((Label)Item.FindControl("lab_YS_NAME")).Text           = "电气电料";
                    ((Label)Item.FindControl("lab_YS_MAR_BG")).Text         = dt_mar_amount.Rows[0][8].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR")).Text            = dt_mar_amount.Rows[0][9].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR_Percent")).Text    = dt_mar_amount.Rows[0][18].ToString() + "%";
                    ((HyperLink)Item.FindControl("Hpl_detail")).NavigateUrl = "../YS_Data/YS_Cost_Budget_O_M_Detail.aspx?ContractNo=" + CONTRACT_NO + "&FatherCode=" + ed.EncryptText("ELECTRICAL") + "";
                    break;

                case 5:
                    ((Label)Item.FindControl("lab_YS_NAME")).Text           = "其他材料费";
                    ((Label)Item.FindControl("lab_YS_MAR_BG")).Text         = dt_mar_amount.Rows[0][10].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR")).Text            = dt_mar_amount.Rows[0][11].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR_Percent")).Text    = dt_mar_amount.Rows[0][19].ToString() + "%";
                    ((HyperLink)Item.FindControl("Hpl_detail")).NavigateUrl = "../YS_Data/YS_Cost_Budget_O_M_Detail.aspx?ContractNo=" + CONTRACT_NO + "&FatherCode=" + ed.EncryptText("OTHERMAT_COST") + "";
                    break;

                case 6:
                    ((Label)Item.FindControl("lab_YS_NAME")).Text           = "合计";
                    ((Label)Item.FindControl("lab_YS_MAR_BG")).Text         = dt_mar_amount.Rows[0][12].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR")).Text            = dt_mar_amount.Rows[0][13].ToString();
                    ((Label)Item.FindControl("lab_YS_MAR_Percent")).Text    = dt_mar_amount.Rows[0][20].ToString() + "%";
                    ((HyperLink)Item.FindControl("Hpl_detail")).NavigateUrl = "";
                    ((Label)Item.FindControl("check_look")).Text            = "";
                    ((Image)Item.FindControl("Image1")).Visible             = false;
                    break;

                default: break;
                }
                i++;
            }
        }