Exemplo n.º 1
0
        private void ShowInfo(string _oid)
        {
            rptEmployee0.Visible = false;
            liemployee0.Visible  = false;
            BLL.Order bll = new BLL.Order();
            DataSet   ds  = bll.GetList(0, "o_id='" + _oid + "'", "o_addDate desc");

            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                JscriptMsg("订单不存在!", "");
                return;
            }
            DataRow dr = ds.Tables[0].Rows[0];

            labOwner.Text   = new MettingSys.BLL.department().getAreaText(dr["op_area"].ToString()) + "," + dr["op_number"] + "," + dr["op_name"];
            txtCusName.Text = dr["c_name"].ToString();
            hCusId.Value    = dr["c_id"].ToString();
            List <Model.Contacts> contactlist = new BLL.Contacts().getList("co_cid=" + hCusId.Value + "", " co_flag desc,co_id asc");

            if (contactlist != null)
            {
                ddlcontact.DataSource     = contactlist;
                ddlcontact.DataTextField  = "co_name";
                ddlcontact.DataValueField = "co_id";
                ddlcontact.DataBind();
            }
            ddlcontact.SelectedValue       = dr["o_coid"].ToString();
            txtPhone.Text                  = dr["co_number"].ToString();
            ddlcontractPrice.SelectedValue = dr["o_contractPrice"].ToString();
            txtsDate.Text                  = ConvertHelper.toDate(dr["o_sdate"]).Value.ToString("yyyy-MM-dd");
            txteDate.Text                  = ConvertHelper.toDate(dr["o_edate"]).Value.ToString("yyyy-MM-dd");
            txtAddress.Text                = dr["o_address"].ToString();
            txtContent.Text                = dr["o_content"].ToString();
            txtContract.Text               = dr["o_contractContent"].ToString();
            txtRemark.Text                 = dr["o_remarks"].ToString();
            ddlfStatus.SelectedValue       = dr["o_status"].ToString();
            //ddldstatus.SelectedValue = dr["o_dstatus"].ToString();
            ddlpushStatus.SelectedValue = dr["o_isPush"].ToString();
            labFlag.Text          = Common.BusinessDict.checkStatus()[Utils.ObjToByte(dr["o_flag"])];
            ddlflag.SelectedValue = dr["o_flag"].ToString();
            labLockStatus.Text    = Common.BusinessDict.lockStatus()[Utils.ObjToByte(dr["o_lockStatus"])];
            labfinanceCost.Text   = dr["o_financeCust"].ToString();
            txtCost.Text          = dr["o_financeCust"].ToString();
            finCost = Utils.StrToDecimal(dr["o_financeCust"].ToString(), 0);
            ddllockstatus.SelectedValue = dr["o_lockStatus"].ToString();
            labFinRemarks.Text          = dr["o_finRemarks"].ToString();
            txtFinRemark.Text           = dr["o_finRemarks"].ToString();
            labStatusTime.Text          = Utils.ObjectToStr(dr["o_statusTime"]) == "" ? "" : Utils.StrToDateTime(Utils.ObjectToStr(dr["o_statusTime"])).ToString("yyyy-MM-dd HH:mm:ss");

            #region 归属地
            string placeStr = dr["o_place"].ToString();
            if (!string.IsNullOrEmpty(placeStr))
            {
                Dictionary <string, string> areaDic      = new BLL.department().getAreaDict();
                Dictionary <string, string> orderAreaDic = new Dictionary <string, string>();
                string[] list = placeStr.Split(',');
                foreach (string item in list)
                {
                    if (areaDic.ContainsKey(item))
                    {
                        orderAreaDic.Add(item, areaDic[item]);
                    }
                }
                rptAreaList.DataSource = orderAreaDic;
                rptAreaList.DataBind();
            }
            #endregion

            #region 人员
            DataTable pdt = bll.GetPersonList(0, "op_oid='" + _oid + "'", "op_id asc").Tables[0];
            if (pdt != null && pdt.Rows.Count > 0)
            {
                rptEmployee1.DataSource = pdt.Select("op_type=2");
                rptEmployee1.DataBind();

                rptEmployee2.DataSource = pdt.Select("op_type=3");
                rptEmployee2.DataBind();

                rptEmployee3.DataSource = pdt.Select("op_type=4");
                rptEmployee3.DataBind();

                rptEmployee4.DataSource = pdt.Select("op_type=5");
                rptEmployee4.DataBind();

                liplace.Visible          = false;
                liemployee1.Visible      = false;
                liemployee2.Visible      = false;
                liemployee3.Visible      = false;
                liemployee4.Visible      = false;
                uploadDiv.Visible        = false;
                uploadDiv2.Visible       = false;
                btnSave.Visible          = false;
                btnDstatus.Visible       = false;
                btnFlag.Visible          = false;
                btnLockstatus.Visible    = false;
                btnUpdateCost.Visible    = false;
                btnUnBusinessPay.Visible = false;
                btnReceiptPay.Visible    = false;
                btnFinRemark.Visible     = false;
                //btnPay.Visible = false;
                btnInvoince.Visible = false;
                //btnExcelIn.Visible = false;
                btnSharing.Visible = false;
                trFile.Visible     = false;
                #region 根据当前登录账户显示不同按钮
                DataRow[] drs1       = pdt.Select("op_type=1 and op_number='" + manager.user_name + "'"); //业务员
                DataRow[] drs2       = pdt.Select("op_type=2 and op_number='" + manager.user_name + "'"); //业务报账人员
                DataRow[] drs3       = pdt.Select("op_type=3 and op_number='" + manager.user_name + "'"); //业务策划人员
                DataRow[] drs4       = pdt.Select("op_type=4 and op_number='" + manager.user_name + "'"); //业务执行人员
                DataRow[] drs6       = pdt.Select("op_type=5 and op_number='" + manager.user_name + "'"); //业务设计人员
                bool      showDetail = false;

                if (drs4.Length > 0)
                {
                    isExecutiver             = true;
                    showDetail               = true;
                    uploadDiv.Visible        = true;
                    btnUnBusinessPay.Visible = true;
                    btnReceiptPay.Visible    = true;
                    //btnPay.Visible = true;
                    btnInvoince.Visible = true;
                    //btnExcelIn.Visible = true;
                }
                if (drs3.Length > 0 || drs6.Length > 0)
                {
                    showDetail         = true;
                    uploadDiv.Visible  = true;
                    uploadDiv2.Visible = true;
                    btnDstatus.Visible = true;
                    trFile.Visible     = true;
                    if (drs3.Length > 0)
                    {
                        ddldstatus.SelectedValue = drs3[0]["op_dstatus"].ToString();
                    }
                    else if (drs6.Length > 0)
                    {
                        ddldstatus.SelectedValue = drs6[0]["op_dstatus"].ToString();
                    }
                }
                if (drs2.Length > 0)
                {
                    isExecutiver             = false;
                    showDetail               = true;
                    liplace.Visible          = true;
                    liemployee2.Visible      = true;
                    liemployee3.Visible      = true;
                    liemployee4.Visible      = true;
                    uploadDiv.Visible        = true;
                    uploadDiv2.Visible       = true;
                    btnUnBusinessPay.Visible = true;
                    btnReceiptPay.Visible    = true;
                    btnSave.Visible          = true;
                    //btnPay.Visible = true;
                    btnInvoince.Visible = true;
                    //btnExcelIn.Visible = true;
                    trFile.Visible = true;
                }
                if (drs1.Length > 0)
                {
                    isExecutiver             = false;
                    showDetail               = true;
                    liplace.Visible          = true;
                    liemployee1.Visible      = true;
                    liemployee2.Visible      = true;
                    liemployee3.Visible      = true;
                    liemployee4.Visible      = true;
                    uploadDiv.Visible        = true;
                    uploadDiv2.Visible       = true;
                    btnSave.Visible          = true;
                    btnUnBusinessPay.Visible = true;
                    btnReceiptPay.Visible    = true;
                    //btnPay.Visible = true;
                    btnInvoince.Visible = true;
                    //btnExcelIn.Visible = true;
                    trFile.Visible = true;
                }
                DataRow[] drs5 = pdt.Select("op_type=1");
                //判断是否含有查看本区域数据的权限
                if (new BLL.permission().checkHasPermission(manager, "0602") && (drs5[0]["op_area"].ToString() == manager.area || Utils.ObjectToStr(dr["o_place"]).IndexOf(manager.area) > -1))
                {
                    showDetail     = true;
                    trFile.Visible = true;
                }
                string groupArea = new BLL.department().getGroupArea();//总部

                //判断是否是本区域,且含有财务基本权限
                if ((drs5[0]["op_area"].ToString() == manager.area || groupArea == manager.area) && new BLL.permission().checkHasPermission(manager, "0401"))
                {
                    showDetail               = true;
                    trFile.Visible           = true;
                    btnUnBusinessPay.Visible = true;
                    btnReceiptPay.Visible    = true;
                    uploadDiv2.Visible       = true;
                    //btnPay.Visible = true;
                    btnInvoince.Visible = true;
                    //btnExcelIn.Visible = true;
                }
                //判断是否含有查看本区域审批权限
                if (drs5[0]["op_area"].ToString() == manager.area && new BLL.permission().checkHasPermission(manager, "0603"))
                {
                    trFile.Visible  = true;
                    showDetail      = true;
                    btnFlag.Visible = true;
                }
                //
                if (groupArea == manager.area)
                {
                    if (new BLL.permission().checkHasPermission(manager, "0401"))
                    {
                        showDetail     = true;
                        trFile.Visible = true;
                    }
                    if (new BLL.permission().checkHasPermission(manager, "0405"))
                    {
                        showDetail            = true;
                        btnLockstatus.Visible = true;
                        btnUpdateCost.Visible = true;
                        trFile.Visible        = true;
                    }
                }
                if (new BLL.permission().checkHasPermission(manager, "0401"))
                {
                    btnFinRemark.Visible = true;
                    if (!Utils.StrToBool(dr["o_lockStatus"].ToString(), false))
                    {
                        btnSharing.Visible = true;
                    }
                }
                //以上都没有权限的,不能查看订单详细
                if (!showDetail)
                {
                    string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\")";
                    Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
                    Response.End();
                }
                #endregion
            }
            #endregion

            if (dr["o_lockStatus"].ToString() == "1")
            {
                liplace.Visible          = false;
                liemployee1.Visible      = false;
                liemployee2.Visible      = false;
                liemployee3.Visible      = false;
                liemployee4.Visible      = false;
                uploadDiv.Visible        = false;
                uploadDiv2.Visible       = false;
                btnSave.Visible          = false;
                btnDstatus.Visible       = false;
                btnFlag.Visible          = false;
                btnUpdateCost.Visible    = false;
                btnUnBusinessPay.Visible = false;
                btnReceiptPay.Visible    = false;
                //btnPay.Visible = false;
                btnInvoince.Visible = true;
                //btnExcelIn.Visible = false;
            }

            #region 活动文件
            DataTable fdt = bll.GetFileList(0, "f_oid='" + _oid + "'", "f_addDate asc,f_id asc").Tables[0];
            if (fdt != null && fdt.Rows.Count > 0)
            {
                rptAlbumList.DataSource = fdt.Select("f_type=1");
                rptAlbumList.DataBind();

                rptAlbumList2.DataSource = fdt.Select("f_type=2");
                rptAlbumList2.DataBind();
            }
            #endregion

            string sqlwhere = "";
            #region 执行备用金借款明细
            if (isExecutiver)
            {
                sqlwhere = " and uba_PersonNum='" + manager.user_name + "'";
            }
            DataSet unBusinessData = new BLL.unBusinessApply().GetList(0, "uba_oid='" + _oid + "' " + sqlwhere + "", "uba_addDate desc,uba_id desc");
            if (unBusinessData != null && unBusinessData.Tables[0].Rows.Count > 0)
            {
                rptunBusinessList.DataSource = unBusinessData;
                rptunBusinessList.DataBind();
            }
            #endregion

            #region 应收付
            DataTable natureData = new BLL.finance().getNature(_oid, isExecutiver ? manager.user_name : "");
            if (natureData != null && natureData.Rows.Count > 0)
            {
                rptNature.DataSource = natureData;
                rptNature.DataBind();
            }

            #endregion

            #region 发票
            if (isExecutiver)
            {
                sqlwhere = " and inv_personNum='" + manager.user_name + "'";
            }
            DataTable invoiceData = new BLL.invoices().GetList(0, "inv_oid='" + _oid + "' " + sqlwhere + "", "inv_addDate desc,inv_id desc").Tables[0];
            if (invoiceData != null && invoiceData.Rows.Count > 0)
            {
                foreach (DataRow inv in invoiceData.Rows)
                {
                    if (inv["inv_flag1"].ToString() != "1" && inv["inv_flag2"].ToString() != "1" && inv["inv_flag3"].ToString() != "1")
                    {
                        requestMoney += Utils.StrToDecimal(inv["inv_money"].ToString(), 0);
                    }
                    if (Utils.StrToBool(inv["inv_isConfirm"].ToString(), false))
                    {
                        confirmMoney += Utils.StrToDecimal(inv["inv_money"].ToString(), 0);
                    }
                }
                rptInvoiceList.DataSource = invoiceData;
                rptInvoiceList.DataBind();
            }
            #endregion

            #region 已收付款
            if (isExecutiver)
            {
                sqlwhere = " and rpd_personNum='" + manager.user_name + "'";
            }
            DataTable rpData = new BLL.ReceiptPayDetail().GetList(0, "rpd_oid='" + _oid + "'", "rpd_type desc,rpd_adddate desc,rpd_id desc").Tables[0];
            if (rpData != null && rpData.Rows.Count > 0)
            {
                rptList.DataSource = rpData;
                rptList.DataBind();
            }
            #endregion

            #region 结算汇总
            if (!isExecutiver)//执行人员不可查看
            {
                DataTable collectData = bll.getOrderCollect(_oid);
                if (collectData != null && collectData.Rows.Count > 0)
                {
                    foreach (DataRow inv in collectData.Rows)
                    {
                        finProfit += Utils.StrToDecimal(inv["profit"].ToString(), 0);
                        if (inv["fin_type"].ToString() == "True")
                        {
                            fin1 += Utils.StrToDecimal(inv["finMoney"].ToString(), 0);
                        }
                        else
                        {
                            fin0 += Utils.StrToDecimal(inv["finMoney"].ToString(), 0);
                        }
                    }

                    rptCollect.DataSource = collectData;
                    rptCollect.DataBind();
                }
            }
            #endregion
        }