Пример #1
0
        protected string StrWhere()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
            string          FatherCode = ed.DecryptText(Request.QueryString["FatherCode"].ToString());
            //班组or厂内
            string PS_BZ = "";

            switch (FatherCode)
            {
            case "TEAM_CONTRACT": PS_BZ = " AND GS_TYPE = '直接人工' or GS_TYPE LIKE '%一%'";
                LabelName.Text          = "直接人工实际费用明细";
                break;

            case "FAC_CONTRACT": PS_BZ = " AND GS_TYPE != '直接人工' and GS_TYPE NOT LIKE '%一%'";
                LabelName.Text         = "厂内分包实际费用明细";
                break;

            default: break;
            }

            string ENGID    = ContractNo;
            string strwhere = " 1=1 ";

            strwhere += " and GS_TSAID= '" + ENGID + "' and GS_TSAID!=''";
            strwhere += PS_BZ;
            ViewState["strwhere"] = strwhere;
            return(strwhere);
        }
        protected void BindTitle()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
            string          FatherCode = ed.DecryptText(Request.QueryString["FatherCode"].ToString());
            string          sql_title  = "select FATHER_NAME from YS_COST_BUDGET_NAME where FATHER_CODE='" + FatherCode + "' ";

            System.Data.DataTable dt_title = DBCallCommon.GetDTUsingSqlText(sql_title);
            if (dt_title.Rows.Count > 0)
            {
                lbl_fathername.Text = dt_title.Rows[0][0].ToString().Trim();   //绑定标题
            }

            string sql_total_BG = "select YS_" + FatherCode + " from YS_COST_BUDGET where YS_TSA_ID='" + ContractNo + "'";

            //获取预算总费用
            System.Data.DataTable dt_total_BG = DBCallCommon.GetDTUsingSqlText(sql_total_BG);
            if (dt_total_BG.Rows.Count > 0)
            {
                string total_BG   = dt_total_BG.Rows[0][0].ToString();
                float  total_BG_f = (total_BG == "" ? 0 : Convert.ToSingle(total_BG));
                lbl_total_BG.Text = total_BG_f.ToString("N2");
            }

            BindData(ContractNo, FatherCode);
        }
Пример #3
0
        protected string GetStrWhere()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
            string          FatherCode = ed.DecryptText(Request.QueryString["FatherCode"].ToString());

            string ENGID = ContractNo;

            string strwhere = " 1=1 ";

            strwhere += " and PIC_ENGID = '" + ENGID + "' and PIC_ENGID!=''";
            strwhere += "and [totalstate] = '4'";
            ViewState["strwhere"] = strwhere;
            return(strwhere);
        }
        protected void BindTitle()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["CONTRACTNO"].ToString());
            string          FatherCode = ed.DecryptText(Request.QueryString["FatherCode"].ToString());
            string          sql_title  = "select FATHER_NAME from YS_COST_BUDGET_NAME where FATHER_CODE='" + FatherCode + "' ";

            System.Data.DataTable dt_title = DBCallCommon.GetDTUsingSqlText(sql_title);
            if (dt_title.Rows.Count > 0)
            {
                lbl_fathername.Text = dt_title.Rows[0][0].ToString().Trim();   //绑定标题
            }

            BindData(ContractNo, FatherCode);
        }
        protected void bind_ddl()
        {
            Encrypt_Decrypt ed = new Encrypt_Decrypt();

            ContractNo   = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
            lbl_con.Text = ContractNo;
            string sql_title = "select PCON_ENGNAME,PCON_ENGTYPE from TBPM_CONPCHSINFO where PCON_BCODE='" + ContractNo + "' ";

            System.Data.DataTable dt_title = DBCallCommon.GetDTUsingSqlText(sql_title);
            if (dt_title.Rows.Count > 0)
            {
                lbl_project.Text  = dt_title.Rows[0][0].ToString().Trim();
                lbl_engineer.Text = dt_title.Rows[0][1].ToString().Trim();
            }
            //string type = (ViewState["type"].ToString() == "1" ? " and [YS_XS_Finished] ='1'" : " and YS_XS_Finished is null");
            //string sqltext_people = "select distinct YS_ADDNAME,YS_ADDNAME from View_YS_COST_BUDGET_REAL where 1=1 " +type;
            //string sqltext_PJ = "SELECT DISTINCT PCON_PJNAME ,PCON_PJNAME FROM View_YS_COST_BUDGET_REAL where 1=1" +type;
            //string sqltext_ENG = "SELECT DISTINCT PCON_ENGNAME,PCON_ENGNAME FROM View_YS_COST_BUDGET_REAL where 1=1" +type;
            string sqltext_EQ = "SELECT PCON_EQNAME,PCON_EQNAME FROM View_YS_COST_BUDGET_REAL where 1=1 and YS_CONTRACT_NO='" + ContractNo + "' ";


            //DBCallCommon.FillDroplist(dpl_people, sqltext_people);
            //DBCallCommon.FillDroplist(ddl_project, sqltext_PJ);
            //DBCallCommon.FillDroplist(ddl_engineer, sqltext_ENG);
            DBCallCommon.FillDroplist(ddl_task, sqltext_EQ);
        }
        protected void GridView1_onrowdatabound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string          ContractNo  = Request.QueryString["ContractNo"].ToString();
                string          FatherCode  = Request.QueryString["FatherCode"].ToString();
                Encrypt_Decrypt ed          = new Encrypt_Decrypt();
                string          FatherCode1 = ed.DecryptText(FatherCode);
                switch (FatherCode1)
                {
                case "PRODUCT_OUT":
                case "OUT_LAB_MAR": e.Row.Attributes.Add("ondblclick", "PurOUT('" + ContractNo + "','" + FatherCode + "')"); break;

                case "FERROUS_METAL":
                case "PURCHASE_PART":
                case "MACHINING_PART":
                case "PAINT_COATING":
                case "ELECTRICAL":
                case "OTHERMAT_COST": e.Row.Attributes.Add("ondblclick", "PurMAR('" + ContractNo + "','" + FatherCode + "')"); break;

                case "TEAM_CONTRACT":
                case "FAC_CONTRACT": e.Row.Attributes.Add("ondblclick", "PurLABOR('" + ContractNo + "','" + FatherCode + "')"); break;

                default: break;
                }
                e.Row.Attributes["style"] = "Cursor:hand";
                e.Row.Attributes.Add("title", "双击查看原始数据");
            }
        }
Пример #7
0
        protected void bindtitle()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
            string          sql_amount = "select 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_AMOUNT_B,YS_MAR_AMOUNT AS YS_AMOUNT_0 FROM View_YS_COST_BUDGET_ORDER WHERE PCON_SCH='" + ContractNo + "'";

            System.Data.DataTable dt_amount = DBCallCommon.GetDTUsingSqlText(sql_amount);
            if (dt_amount.Rows.Count > 0)
            {
                double ys_amount_b         = dt_amount.Rows[0][0].ToString() == "" ? 0 : Convert.ToDouble(dt_amount.Rows[0][0].ToString());
                double ys_amount_o         = dt_amount.Rows[0][1].ToString() == "" ? 0 : Convert.ToDouble(dt_amount.Rows[0][1].ToString());
                double ys_amount_b_million = Math.Round(ys_amount_b / 10000, 1);
                double ys_amount_o_million = Math.Round(ys_amount_o / 10000, 1);
                lab_YS_AMOUNT_B.Text = ys_amount_b_million.ToString() + "万";
                lab_YS_AMOUNT_O.Text = ys_amount_o_million.ToString() + "万";
                if (ys_amount_o > 0.9 * ys_amount_b && ys_amount_o < ys_amount_b * 1.0)
                {
                    lab_YS_AMOUNT_O.BackColor = System.Drawing.Color.PeachPuff;
                }
                if (ys_amount_o > ys_amount_b * 1.0)
                {
                    lab_YS_AMOUNT_O.BackColor = System.Drawing.Color.Yellow;
                }
            }
        }
Пример #8
0
        protected string GetStrCondition()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
            string          FatherCode = ed.DecryptText(Request.QueryString["FatherCode"].ToString());
            string          mar        = "";

            switch (FatherCode)
            {
            case "FERROUS_METAL": mar = "01.07"; break;

            case "PURCHASE_PART": mar = "01.11"; break;

            case "MACHINING_PART": mar = "01.08"; break;

            case "PAINT_COATING": mar = "01.15"; break;

            case "ELECTRICAL": mar = "01.18"; break;

            default: break;
            }

            if (FatherCode != "OTHERMAT_COST")
            {
                string strwhere = " 1=1 and TSAID='" + ContractNo + "' ";
                strwhere += "and MaterialCode like '" + mar + "%'";
                ViewState["strwhere"] = strwhere;
                return(strwhere);
            }

            else
            {
                string strwhere = " 1=1 and TSAID='" + ContractNo + "' ";
                strwhere += " and MaterialCode not like '01.07%' " +
                            " and MaterialCode not like '01.11%' " +
                            " and MaterialCode not like '01.08%' " +
                            " and MaterialCode not like '01.15%' " +
                            " and MaterialCode not like '01.18%' ";
                ViewState["strwhere"] = strwhere;
                return(strwhere);
            }
        }
Пример #9
0
        protected void GridView1_onrowdatabound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string budget     = e.Row.Cells[5].Text.ToString().Trim();
                float  budget_num = (budget == "&nbsp;" ? 0 : Convert.ToSingle(budget));

                string real     = e.Row.Cells[8].Text.ToString().Trim();
                float  real_num = (real == "&nbsp;" ? 0 : Convert.ToSingle(real));

                if (real_num > budget_num * 0.9 && real_num < budget_num)         //超过预算90%
                {
                    e.Row.Cells[8].BackColor = System.Drawing.Color.PeachPuff;
                }
                else if (real_num > budget_num)        //超过预算
                {
                    e.Row.Cells[8].BackColor = System.Drawing.Color.Yellow;
                }

                string          ContractNo  = Request.QueryString["ContractNo"].ToString();
                string          FatherCode  = Request.QueryString["FatherCode"].ToString();
                Encrypt_Decrypt ed          = new Encrypt_Decrypt();
                string          FatherCode1 = ed.DecryptText(FatherCode);
                string          mar_code    = "";
                switch (FatherCode1)
                {
                case "FERROUS_METAL": mar_code = "01.07"; break;

                case "PURCHASE_PART": mar_code = "01.11"; break;

                case "MACHINING_PART": mar_code = "01.08"; break;

                case "PAINT_COATING": mar_code = "01.15"; break;

                case "ELECTRICAL": mar_code = "01.18"; break;

                case "OTHERMAT_COST": mar_code = "other"; break;

                default: break;
                }
                string mar_name = e.Row.Cells[2].Text.ToString();
                if (FatherCode1 != "OUT_LAB_MAR")
                {
                    e.Row.Attributes.Add("ondblclick", "PurMAR('" + ContractNo + "','" + mar_code + "','" + mar_name + "')");
                    e.Row.Attributes["style"] = "Cursor:hand";
                    e.Row.Attributes.Add("title", "双击查看原始数据");
                }
            }
        }
Пример #10
0
        //protected string check_ddl_YS()
        //{
        //    Encrypt_Decrypt ed = new Encrypt_Decrypt();
        //    string ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
        //    string Mar_code = Request.QueryString["Marcode"].ToString();
        //    string str_ys_name = "";
        //    if (Mar_code=="01.07")
        //    {
        //        if (ddl_YS_name.SelectedItem.Text.ToString()=="定尺板")
        //        {
        //            if (DropDownList_mar_type.SelectedItem.Text.ToString()!="定尺板")
        //            {
        //                str_ys_name = " and PO_MASHAPE='定尺板'";
        //            }
        //        }
        //        else
        //            if (ddl_YS_name.SelectedItem.Text.ToString() == "轨道系统")
        //            {
        //                str_ys_name = " and marnm like '%轨道%'";
        //            }
        //            else if (ddl_YS_name.SelectedItem.Text.ToString() == "普通材料")
        //        {
        //            str_ys_name = "  and charindex('轨道',marnm)=0  and PO_MASHAPE!='定尺板'";
        //        }
        //    }
        //    if (Mar_code=="01.11"||Mar_code=="01.08")
        //    {
        //            str_ys_name = "  and charindex('" + ddl_YS_name.SelectedItem.Text.ToString() + "',marnm)>0 ";
        //            string sql_contain = "select YS_Product_Name from TBBD_Product_type where YS_Product_Tag='1' " +
        //                        "and charindex('-',YS_Product_Code)>0 and YS_Product_Name like '%" + ddl_YS_name.SelectedItem.Text.ToString() + "%' " +
        //                        "and YS_Product_Name!='" + ddl_YS_name.SelectedItem.Text.ToString() + "'";
        //            System.Data.DataTable dt_contain = DBCallCommon.GetDTUsingSqlText(sql_contain);
        //            for (int s = 0; s < dt_contain.Rows.Count; s++)
        //            {
        //                str_ys_name += " and charindex('" + dt_contain.Rows[s]["YS_Product_Name"] + "',marnm)=0";
        //            }
        //    }
        //    if (Mar_code=="other")
        //    {
        //            string sql_mar_type = "select YS_Product_Code from TBBD_Product_type where YS_Product_Name='" + ddl_YS_name.SelectedItem.Text.ToString() + "'";
        //            System.Data.DataTable dt_mar_type = DBCallCommon.GetDTUsingSqlText(sql_mar_type);
        //            if (dt_mar_type.Rows.Count > 0)
        //            {
        //                str_ys_name += " and marid like '" + dt_mar_type.Rows[0][0].ToString() + "%'";
        //            }
        //    }
        //    return str_ys_name;
        //}

        //protected void bind_ddl_YSname()
        //{
        //    Encrypt_Decrypt ed = new Encrypt_Decrypt();
        //    string ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
        //    string Mar_code = Request.QueryString["Marcode"].ToString();
        //    string name_type = "";
        //    switch (Mar_code)
        //    {
        //        case "01.07": name_type = "FERROUS_METAL"; break;
        //        case "01.11": name_type = "PURCHASE_PART"; break;
        //        case "01.08": name_type = "MACHINING_PART"; break;
        //        case "01.15": name_type = "PAINT_COATING"; break;
        //        case "01.18": name_type = "ELECTRICAL"; break;
        //        case "other": name_type = "OTHERMAT_COST"; break;
        //        default: break;
        //    }
        //    string sql_YS_NAME = "select distinct YS_NAME,YS_NAME from YS_COST_BUDGET_DETAIL where YS_CONTRACT_NO='" + ContractNo + "' and YS_FATHER='" + name_type + "' and YS_NAME!='其它'";
        //    DBCallCommon.FillDroplist(ddl_YS_name, sql_YS_NAME);
        //}

        protected void bind_ddl_mar()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
            string          Mar_code   = Request.QueryString["Marcode"].ToString();

            switch (Mar_code)
            {
            case "01.07": YS_NAME.Text = "黑色金属"; break;

            case "01.11": YS_NAME.Text = "外购件"; break;

            case "01.08": YS_NAME.Text = "加工件"; break;

            case "01.15": YS_NAME.Text = "油漆涂料"; break;

            case "01.18": YS_NAME.Text = "电气电料"; break;

            case "other": YS_NAME.Text = "其他材料费"; break;

            default: break;
            }
            string sql_where = " engid='" + ContractNo + "'";

            //获取材料ID
            if (Mar_code != "other")
            {
                sql_where += " and marid like '" + Mar_code + "%'";
            }
            else
            {
                sql_where += " and charindex(substring(marid,1,5),'01.07.01.08.01.11.01.15.01.18')=0";
            }
            string sqltext_mar_type = "SELECT DISTINCT isnull(PO_MASHAPE,'无') ,PO_MASHAPE FROM View_TBPC_PURORDERDETAIL_PLAN_TOTAL where " + sql_where;

            DBCallCommon.FillDroplist(DropDownList_mar_type, sqltext_mar_type);
        }
Пример #11
0
        protected string GetStrWhere()
        {
            Encrypt_Decrypt ed         = new Encrypt_Decrypt();
            string          ContractNo = ed.DecryptText(Request.QueryString["ContractNo"].ToString());
            string          strwhere   = " engid='" + ContractNo + "'";
            string          Mar_code   = Request.QueryString["Marcode"].ToString();
            string          nowtime    = System.DateTime.Now.ToString("yyyy-MM-dd");
            string          Mar_name   = Request.QueryString["Marname"].ToString();

            //获取材料ID
            if (Mar_code != "other")
            {
                strwhere += " and marid like '" + Mar_code + "%'";
            }
            else
            {
                strwhere += " and charindex(substring(marid,1,5),'01.07.01.08.01.11.01.15.01.18')=0";
            }
            if (rab_daohuo.SelectedIndex != 0)     //全部
            {
                if (rab_daohuo.SelectedIndex == 1) //未提交
                {
                    strwhere += "  and totalstate='0' and totalcstate='0' and detailcstate='0'";
                }
                if (rab_daohuo.SelectedIndex == 2)//未到货
                {
                    strwhere += " and detailstate='1' and recgdnum=0 and detailcstate='0'";
                }
                if (rab_daohuo.SelectedIndex == 3)//逾期未到货
                {
                    strwhere += " and detailstate='1' and recgdnum=0 and detailcstate='0' and cgtimerq<'" + nowtime + "'";
                }
                if (rab_daohuo.SelectedIndex == 4)//部分到货
                {
                    strwhere += " and detailstate='1' and recgdnum<zxnum and recgdnum>0 and detailcstate='0'";
                }
                if (rab_daohuo.SelectedIndex == 5)//已到货
                {
                    strwhere += " and (detailstate='3' or detailstate='2') and detailcstate='0'";
                }
                if (rab_daohuo.SelectedIndex == 6)//逾期到货
                {
                    strwhere += " and (detailstate='3' or detailstate='2') and detailcstate='0' and recdate>cgtimerq";
                }
                if (rab_daohuo.SelectedIndex == 7)//已关闭
                {
                    strwhere += " and detailcstate='1'";
                }
            }
            if (tb_orderno.Text != "")//订单编号
            {
                string   str_orderid = tb_orderno.Text.ToString();
                string[] sArray      = str_orderid.Split('-');
                strwhere = strwhere + " and (orderno like '%" + sArray[0].ToString() + "%'";
                for (int i = 1; i < sArray.Length; i++)
                {
                    strwhere = strwhere + " or orderno like '%" + sArray[i].ToString() + "%'";
                }
                strwhere = strwhere + " )";
            }
            if (tb_ptc.Text.Trim() != "")//计划跟踪号
            {
                strwhere = strwhere + " and ptcode like '%" + tb_ptc.Text.Trim() + "%'";
            }
            if (DropDownList_mar_type.SelectedIndex != 0)
            {
                strwhere = strwhere + " and PO_MASHAPE='" + DropDownList_mar_type.SelectedItem.Text + "'";
            }
            if (DropDownList_check_result.SelectedIndex != 0)
            {
                if (DropDownList_check_result.SelectedItem.Text == "未报检")
                {
                    strwhere = strwhere + " and PO_CGFS= '——'";
                }
                else
                {
                    strwhere = strwhere + " and PO_CGFS = '" + DropDownList_check_result.SelectedItem.Text + "'";
                }
            }
            if (Mar_name != "其它")
            {
                if (Mar_code == "01.07")
                {
                    if (Mar_name == "定尺板")
                    {
                        strwhere += " and PO_MASHAPE='定尺板'";
                    }
                    else
                    if (Mar_name == "轨道系统")
                    {
                        strwhere = strwhere + " and marnm like '%轨道%'";
                    }
                    else
                    if (Mar_name == "普通材料")
                    {
                        strwhere = strwhere + "  and charindex('轨道',marnm)=0  and PO_MASHAPE!='定尺板'";
                    }
                }
                if (Mar_code == "01.11" || Mar_code == "01.08")
                {
                    strwhere = strwhere + "  and charindex('" + Mar_name + "',marnm)>0 ";
                    //string sql_contain = "select YS_Product_Name from TBBD_Product_type where YS_Product_Tag='1' " +
                    //            "and charindex('-',YS_Product_Code)>0 and YS_Product_Name like '%" + Mar_name + "%' " +
                    //            "and YS_Product_Name!='" + Mar_name + "'";
                    //System.Data.DataTable dt_contain = DBCallCommon.GetDTUsingSqlText(sql_contain);
                    //for (int s = 0; s < dt_contain.Rows.Count; s++)
                    //{
                    //    strwhere += " and charindex('" + dt_contain.Rows[s]["YS_Product_Name"] + "',marnm)=0";
                    //}
                }
                if (Mar_code == "other")
                {
                    string sql_mar_type = "select YS_CODE from YS_COST_BUDGET_DETAIL where YS_NAME='" + Mar_name + "'";
                    System.Data.DataTable dt_mar_type = DBCallCommon.GetDTUsingSqlText(sql_mar_type);
                    if (dt_mar_type.Rows.Count > 0)
                    {
                        strwhere += " and marid like '" + dt_mar_type.Rows[0][0].ToString() + "%'";
                    }
                }
            }
            else
            {
                if (Mar_code == "01.11" || Mar_code == "01.08")
                {
                    string sql_mar_type = "select YS_NAME from YS_COST_BUDGET_DETAIL where YS_TSA_ID='" + ContractNo + "' and YS_CODE like '" + Mar_code + "%'";
                    System.Data.DataTable dt_mar_type = DBCallCommon.GetDTUsingSqlText(sql_mar_type);
                    for (int i = 0; i < dt_mar_type.Rows.Count; i++)
                    {
                        string sql_ctamount = "select marnm from View_TBPC_PURORDERDETAIL_PLAN_TOTAL where engid='" + ContractNo + "' and marid like '" + Mar_code + "%'";
                        sql_ctamount += " and charindex('" + dt_mar_type.Rows[i][0].ToString() + "',marnm)>0";
                        //string sql_contain = "select YS_Product_Name from TBBD_Product_type where YS_Product_Tag='1' " +
                        //        "and charindex('-',YS_Product_Code)>0 and YS_Product_Name like '%" + dt_mar_type.Rows[i][0].ToString() + "%' " +
                        //        "and YS_Product_Name!='" + dt_mar_type.Rows[i][0].ToString() + "'";
                        //System.Data.DataTable dt_contain = DBCallCommon.GetDTUsingSqlText(sql_contain);
                        //for (int s = 0; s < dt_contain.Rows.Count; s++)
                        //{
                        //    sql_ctamount += " and charindex('" + dt_contain.Rows[s]["YS_Product_Name"] + "',marnm)=0";
                        //}
                        strwhere += " and marnm not in (" + sql_ctamount + ")";
                    }

                    //string sql_contain = "select YS_Product_Name from TBBD_Product_type where YS_Product_Tag='1' " +
                    //            "and charindex('-',YS_Product_Code)>0 and YS_Product_Name like '%" + Mar_name + "%' " +
                    //            "and YS_Product_Name!='" + Mar_name + "'";
                    //System.Data.DataTable dt_contain = DBCallCommon.GetDTUsingSqlText(sql_contain);
                    //string str_where_other="";
                    //for (int i = 0; i < dt_mar_type.Rows.Count;i++ )
                    //{
                    //    str_where_other+=" and charindex('" + dt_mar_type.Rows[i]["YS_NAME"] + "',YS_Product_Name)=0";
                    //    strwhere += " and charindex('" + dt_mar_type.Rows[i]["YS_NAME"] + "',marnm)=0";
                    //}
                    //string sql_mar_type_other = "select YS_Product_Name from TBBD_Product_type where YS_Product_Code like '"+Mar_code+"%'";
                    //sql_mar_type_other += str_where_other;
                    //System.Data.DataTable dt_mar_type_other = DBCallCommon.GetDTUsingSqlText(sql_mar_type_other);
                    //for (int j = 0; j < dt_mar_type_other.Rows.Count;j++ )
                    //{
                    //    if (j == 0)
                    //    {
                    //        strwhere += " and ( charindex('" + dt_mar_type_other.Rows[j]["YS_Product_Name"] + "',marnm)>0";
                    //    }
                    //    else
                    //        if (j == (dt_mar_type_other.Rows.Count - 1))
                    //    {
                    //        strwhere += " or charindex('" + dt_mar_type_other.Rows[j]["YS_Product_Name"] + "',marnm)>0 )";
                    //    }
                    //        else
                    //        {
                    //            strwhere += " or charindex('" + dt_mar_type_other.Rows[j]["YS_Product_Name"] + "',marnm)>0";
                    //        }
                    //}
                }
                else
                if (Mar_code == "other")
                {
                    string sql_type = "select YS_CODE from YS_COST_BUDGET_DETAIL where YS_TSA_ID='" + ContractNo + "' and YS_FATHER='OTHERMAT_COST' and YS_CODE!='other'";
                    System.Data.DataTable dt_type = DBCallCommon.GetDTUsingSqlText(sql_type);
                    //string str_type_other = "";
                    for (int i = 0; i < dt_type.Rows.Count; i++)
                    {
                        //str_type_other += " and charindex('" + dt_type.Rows[i]["YS_CODE"] + "',YS_Product_Code)=0";
                        strwhere += " and charindex('" + dt_type.Rows[i]["YS_CODE"] + "',marid)=0";
                    }
                    //string sql_type_other = "select YS_Product_Code from TBBD_Product_type where YS_Product_FatherCode='Other'";
                    //sql_type_other += str_type_other;
                    //System.Data.DataTable dt_type_other = DBCallCommon.GetDTUsingSqlText(sql_type_other);
                    //for (int j = 0; j < dt_type_other.Rows.Count; j++)
                    //{
                    //    if (j == 0)
                    //    {
                    //        strwhere += " and ( charindex('" + dt_type_other.Rows[j]["YS_Product_Code"] + "',marid)>0";
                    //    }
                    //    else if (j == (dt_type_other.Rows.Count - 1))
                    //    {
                    //        strwhere += " or charindex('" + dt_type_other.Rows[j]["YS_Product_Code"] + "',marid)>0 )";
                    //    }
                    //    else
                    //    {
                    //        strwhere += " or charindex('" + dt_type_other.Rows[j]["YS_Product_Code"] + "',marid)>0";
                    //    }
                    //}
                }
            }
            return(strwhere);
        }
Пример #12
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++;
            }
        }