void dgvMaterials_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["parts_code"].Value)))
     {
         dgvMaterials.Rows[e.RowIndex].Cells["retreat_num"].Value = ControlsConfig.SetNewValue(dgvMaterials.Rows[e.RowIndex].Cells["retreat_num"].Value, 1);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 根据预约单Id获取相应的详细信息
        /// </summary>
        /// <param name="strRId">预约单reserv_id值</param>
        private void GetReservData(string strRId)
        {
            #region 基本信息
            //SetBtnStatus(WindowStatus.View);
            DataTable dt = DBHelper.GetTable("维修返修单预览", "tb_maintain_back_repair", "*", string.Format(" repair_id='{0}'", strRId), "", "");
            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["repair_no"])))
                {
                    labMaintain_noS.Text = CommonCtrl.IsNullToString(dr["repair_no"]);//返修单号
                }
                else
                {
                    labMaintain_noS.Text = string.Empty;
                }
                string strReTime = CommonCtrl.IsNullToString(dr["reception_time"]);//接待日期
                if (!string.IsNullOrEmpty(strReTime))
                {
                    labReceptionTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labReceptionTimeS.Text = string.Empty;
                }
                labCustomNOS.Text     = CommonCtrl.IsNullToString(dr["customer_code"]);                                                                               //客户编码
                labCustomNameS.Text   = CommonCtrl.IsNullToString(dr["customer_name"]);                                                                               //客户名称
                labCarNOS.Text        = CommonCtrl.IsNullToString(dr["vehicle_no"]);                                                                                  //车牌号
                labCarTypeS.Text      = GetVmodel(CommonCtrl.IsNullToString(dr["vehicle_model"]));                                                                    //车型
                labCarBrandS.Text     = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"]));                                                                   //车辆品牌
                labVINS.Text          = CommonCtrl.IsNullToString(dr["vehicle_vin"]);                                                                                 //VIN
                labEngineNoS.Text     = CommonCtrl.IsNullToString(dr["engine_type"]);                                                                                 //发动机号
                labturnerS.Text       = CommonCtrl.IsNullToString(dr["turner"]);                                                                                      //车厂编码
                labContactS.Text      = CommonCtrl.IsNullToString(dr["linkman"]);                                                                                     //联系人
                labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["linkman_mobile"]);                                                                              //联系人手机
                labOrderStatusS.Text  = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["document_status"]))); //单据状态
                labBlamePersonS.Text  = CommonCtrl.IsNullToString(dr["repairer_name"]);                                                                               //返修负责人
                labMilS.Text          = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["mileage"]))?CommonCtrl.IsNullToString(dr["mileage"]) + "Km":"";           //行驶里程
                labSendPersonS.Text   = CommonCtrl.IsNullToString(dr["driver_name"]);                                                                                 //报修人
                labSendPhoneS.Text    = CommonCtrl.IsNullToString(dr["driver_mobile"]);                                                                               //报修人手机
                labRepairDescS.Text   = CommonCtrl.IsNullToString(dr["repair_describe"]);                                                                             //故障原因
                labOpinionS.Text      = CommonCtrl.IsNullToString(dr["dispose_opinion"]);                                                                             //处理意见
                labResultS.Text       = CommonCtrl.IsNullToString(dr["dispose_result"]);                                                                              //处理结果
                labDepartS.Text       = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_id"]));                                                                   //部门
                labAttnS.Text         = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_opid"]));                                                            //经办人
                labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]);                                                                                 //创建人
                string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]);                                                                                  //创建时间
                if (!string.IsNullOrEmpty(strCreateTime))
                {
                    labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labCreateTimeS.Text = string.Empty;
                }
                labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]);   //最后编辑人
                string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间
                if (!string.IsNullOrEmpty(strFinallyTime))
                {
                    labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFinallyTimeS.Text = string.Empty;
                }


                string strStatus = CommonCtrl.IsNullToString(dr["document_status"]);//单据状态
                if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString())
                {
                    //已提交状态屏蔽提交、编辑、删除按钮
                    base.btnSubmit.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
                {
                    //已审核时屏蔽提交、审核、编辑、删除按钮
                    base.btnSubmit.Enabled     = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
                {
                    //审核没通过时屏蔽审核按钮
                    base.btnVerify.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
                {
                    base.btnActivation.Caption = "激活";
                    base.btnSubmit.Enabled     = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                }
                #endregion

                #region 底部datagridview数据

                #region 维修项目数据
                //维修项目数据
                DataTable dpt = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");
                if (dpt.Rows.Count > 0)
                {
                    if (dpt.Rows.Count > dgvproject.Rows.Count)
                    {
                        dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1);
                    }
                    for (int i = 0; i < dpt.Rows.Count; i++)
                    {
                        DataRow dpr = dpt.Rows[i];
                        dgvproject.Rows[i].Cells["item_id"].Value                 = CommonCtrl.IsNullToString(dpr["item_id"]);
                        dgvproject.Rows[i].Cells["three_warranty"].Value          = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否";
                        dgvproject.Rows[i].Cells["man_hour_type"].Value           = CommonCtrl.IsNullToString(dpr["man_hour_type"]);
                        dgvproject.Rows[i].Cells["item_no"].Value                 = CommonCtrl.IsNullToString(dpr["item_no"]);
                        dgvproject.Rows[i].Cells["item_name"].Value               = CommonCtrl.IsNullToString(dpr["item_name"]);
                        dgvproject.Rows[i].Cells["item_type"].Value               = CommonCtrl.IsNullToString(dpr["item_type"]);
                        dgvproject.Rows[i].Cells["man_hour_quantity"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_quantity"]), 1);
                        dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]), 2);
                        dgvproject.Rows[i].Cells["remarks"].Value                 = CommonCtrl.IsNullToString(dpr["remarks"]);
                        dgvproject.Rows[i].Cells["sum_money_goods"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["sum_money_goods"]), 2);
                    }
                }
                #endregion

                #region 维修用料数据
                //维修用料数据
                DataTable dmt = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");
                if (dmt.Rows.Count > 0)
                {
                    if (dmt.Rows.Count > dgvMaterials.Rows.Count)
                    {
                        dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1);
                    }
                    for (int i = 0; i < dmt.Rows.Count; i++)
                    {
                        DataRow dmr = dmt.Rows[i];
                        dgvMaterials.Rows[i].Cells["material_id"].Value = CommonCtrl.IsNullToString(dmr["material_id"]);
                        dgvMaterials.Rows[i].Cells["parts_code"].Value  = CommonCtrl.IsNullToString(dmr["parts_code"]);
                        dgvMaterials.Rows[i].Cells["parts_name"].Value  = CommonCtrl.IsNullToString(dmr["parts_name"]);
                        dgvMaterials.Rows[i].Cells["norms"].Value       = CommonCtrl.IsNullToString(dmr["norms"]);
                        dgvMaterials.Rows[i].Cells["unit"].Value        = CommonCtrl.IsNullToString(dmr["unit"]);
                        dgvMaterials.Rows[i].Cells["quantity"].Value    = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["quantity"]), 1);
                        dgvMaterials.Rows[i].Cells["unit_price"].Value  = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["unit_price"]), 2);
                        dgvMaterials.Rows[i].Cells["sum_money"].Value   = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["sum_money"]), 2);
                        dgvMaterials.Rows[i].Cells["drawn_no"].Value    = CommonCtrl.IsNullToString(dmr["drawn_no"]);
                        //dgvMaterials.Rows[i].Cells["vehicle_model"].Value = CommonCtrl.IsNullToString(dmr["vehicle_model"]);
                        dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value  = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否";
                        dgvMaterials.Rows[i].Cells["Mremarks"].Value         = CommonCtrl.IsNullToString(dmr["remarks"]);
                        dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否";
                    }
                }
                #endregion

                #region 其他项目收费数据
                ////其他项目收费数据
                DataTable dot = DBHelper.GetTable("其他项目收费数据", "tb_maintain_other_toll", "*", string.Format(" maintain_id='{0}'", strRId), "", "");
                if (dot.Rows.Count > 0)
                {
                    if (dot.Rows.Count > dgvOther.Rows.Count)
                    {
                        dgvOther.Rows.Add(dot.Rows.Count - dgvOther.Rows.Count + 1);
                    }
                    for (int i = 0; i < dot.Rows.Count; i++)
                    {
                        DataRow dor = dot.Rows[i];
                        dgvOther.Rows[i].Cells["toll_id"].Value    = CommonCtrl.IsNullToString(dor["toll_id"]);
                        dgvOther.Rows[i].Cells["Osum_money"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dor["sum_money"]), 2);
                        dgvOther.Rows[i].Cells["Oremarks"].Value   = CommonCtrl.IsNullToString(dor["remarks"]);
                        dgvOther.Rows[i].Cells["cost_types"].Value = GetDicName(CommonCtrl.IsNullToString(dor["cost_types"]));
                    }
                }
                #endregion
                //附件信息数据
                ucAttr.TableName         = "tb_maintain_back_repair";
                ucAttr.TableNameKeyValue = strRId;
                ucAttr.BindAttachment();
                #endregion
            }
            else
            {
                #region
                labAttnS.Text         = string.Empty;
                labCarBrandS.Text     = string.Empty;
                labCarNOS.Text        = string.Empty;
                labCarTypeS.Text      = string.Empty;
                labturnerS.Text       = string.Empty;
                labContactPhoneS.Text = string.Empty;
                labContactS.Text      = string.Empty;
                labCreatePersonS.Text = string.Empty;
                labCreateTimeS.Text   = string.Empty;
                labCustomNameS.Text   = string.Empty;
                labCustomNOS.Text     = string.Empty;
                labDepartS.Text       = string.Empty;
                labEngineNoS.Text     = string.Empty;
                labFinallyPerS.Text   = string.Empty;
                labFinallyTimeS.Text  = string.Empty;
                labVINS.Text          = string.Empty;
                labBlamePersonS.Text  = string.Empty; //返修负责人
                labMilS.Text          = string.Empty; //进站里程
                labSendPersonS.Text   = string.Empty; //送车人
                labSendPhoneS.Text    = string.Empty; //送车人手机
                labRepairDescS.Text   = string.Empty; //故障原因
                labOpinionS.Text      = string.Empty; //处理意见
                labResultS.Text       = string.Empty; //处理结果
                #endregion
            }
        }
        private void GetRepairInfo()
        {
            DataTable dt = DBHelper.GetTable("维修单详情", "tb_maintain_info a left join tb_maintain_settlement_info b on a.maintain_id=b.maintain_id ", "*", string.Format(" a.maintain_id='{0}'", strRepairId), "", "");

            if (dt.Rows.Count > 0)
            {
                #region 基本信息
                DataRow dr = dt.Rows[0];
                labMaintain_noS.Text = CommonCtrl.IsNullToString(dr["maintain_no"]); //维修单号
                string strReTime = CommonCtrl.IsNullToString(dr["reception_time"]);  //接待时间
                if (!string.IsNullOrEmpty(strReTime))
                {
                    labRTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labRTimeS.Text = string.Empty;
                }
                labCustomNOS.Text     = CommonCtrl.IsNullToString(dr["customer_code"]);                //客户编码
                labCustomNameS.Text   = CommonCtrl.IsNullToString(dr["customer_name"]);                //客户名称
                labContactS.Text      = CommonCtrl.IsNullToString(dr["linkman"]);                      //联系人
                labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]);              //联系人电话
                labCarNOS.Text        = CommonCtrl.IsNullToString(dr["vehicle_no"]);                   //车牌号
                labCarTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_model"]));    //车型
                labCarBrandS.Text     = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"]));    //车辆品牌
                labVINS.Text          = CommonCtrl.IsNullToString(dr["vehicle_vin"]);                  //VIN
                labEngineNoS.Text     = CommonCtrl.IsNullToString(dr["engine_no"]);                    //发动机号
                labColorS.Text        = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_color"]));    //颜色
                labDriverS.Text       = CommonCtrl.IsNullToString(dr["driver_name"]);                  //司机
                labDriverPhoneS.Text  = CommonCtrl.IsNullToString(dr["driver_mobile"]);                //司机手机
                labRepTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["maintain_type"]));    //维修类别
                labPayTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["maintain_payment"])); //维修付费方式
                labMlS.Text           = CommonCtrl.IsNullToString(dr["oil_into_factory"]);             //进场油量
                labMilS.Text          = CommonCtrl.IsNullToString(dr["travel_mileage"]);               //行驶里程
                labDescS.Text         = CommonCtrl.IsNullToString(dr["fault_describe"]);               //故障描述
                labRemarkS.Text       = CommonCtrl.IsNullToString(dr["remark"]);                       //备注
                if (CommonCtrl.IsNullToString(dr["orders_source"]) == "3")
                {
                    labStatusS.Text = "维修单结算" + DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"])));;
                }
                else
                {
                    if (CommonCtrl.IsNullToString(dr["info_status"]) != Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
                    {
                        labStatusS.Text = "接待" + DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"])));
                    }
                    else
                    {
                        labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumDispatchStatus), int.Parse(CommonCtrl.IsNullToString(dr["dispatch_status"])));//单据状态
                    }
                }

                labDepartS.Text       = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"]));      //部门
                labAttnS.Text         = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_name"])); //经办人
                labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]);                      //创建人
                string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]);                       //创建时间
                if (!string.IsNullOrEmpty(strCreateTime))
                {
                    labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labCreateTimeS.Text = string.Empty;
                }
                labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]);   //最后编辑人
                string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间
                if (!string.IsNullOrEmpty(strFinallyTime))
                {
                    labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFinallyTimeS.Text = string.Empty;
                }
                labmaintain_manS.Text = CommonCtrl.IsNullToString(dr["maintain_man"]);//服务顾问

                #region 会员信息
                string strMemnerID = CommonCtrl.IsNullToString(dr["member_id"]);//会员信息Id
                if (!string.IsNullOrEmpty(strMemnerID))
                {
                    DataTable dct = DBHelper.GetTable("获取会员信息", "tb_customer", "member_number,member_class,accessories_discount,workhours_discount", " is_member='1' and cust_id='" + strMemnerID + "'", "", "");
                    labMemberNoS.Text    = CommonCtrl.IsNullToString(dr["member_number"]);        //会员卡号
                    labMemberGradeS.Text = CommonCtrl.IsNullToString(dr["member_class"]);         //会员等级
                    labMemberPZkS.Text   = CommonCtrl.IsNullToString(dr["workhours_discount"]);   //会员项目折扣
                    labMemberLZkS.Text   = CommonCtrl.IsNullToString(dr["accessories_discount"]); //会员用料折扣
                }
                else
                {
                    labMemberNoS.Text    = string.Empty; //会员卡号
                    labMemberGradeS.Text = string.Empty; //会员等级
                    labMemberPZkS.Text   = string.Empty; //会员项目折扣
                    labMemberLZkS.Text   = string.Empty;
                }
                #endregion
                labGshkS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_sum_money"]), 2);   //工时货款
                labGsslS.Text       = CommonCtrl.IsNullToString(dr["man_hour_tax_rate"]);                                   //工时税率
                labGsseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_tax_rate"]), 2);    //工时税额
                labGssjhjS.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_sum"]), 2);         //工时税价合计
                labPjhkS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_sum_money"]), 2);    //配件货款
                labPjslS.Text       = CommonCtrl.IsNullToString(dr["fitting_tax_rate"]);                                    //配件税率
                labPjseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_tax_cost"]), 2);     //配件税额
                labPjsjhjS.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_sum"]), 2);          //配件税价合计
                labQtflS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_sum_money"]), 2); //其他项目费用
                QtslS.Text          = CommonCtrl.IsNullToString(dr["other_item_tax_rate"]);                                 //其他项目税率
                labQtseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_tax_cost"]), 2);  //其他项目税额
                labQthjS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_sum"]), 2);       //其他项目价税合计
                labYH.Text          = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["privilege_cost"]), 2);       //优惠费用
                labShould.Text      = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["should_sum"]), 2);           //应收总额
                labReceive.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["received_sum"]), 2);         //实收总额
                labDebt.Text        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["debt_cost"]), 2);            //欠款金额
                labInvoiceType.Text = CommonCtrl.IsNullToString(dr["make_invoice_type"]);                                   //开票类型
                labPayment.Text     = CommonCtrl.IsNullToString(dr["payment_terms"]);                                       //结算方式
                labSetAccount.Text  = CommonCtrl.IsNullToString(dr["settlement_account"]);                                  //结算账户
                labSetCompany.Text  = CommonCtrl.IsNullToString(dr["settle_company"]);                                      //结算单位
                #endregion

                #region 底部datagridview数据

                #region 维修项目数据
                //维修项目数据
                decimal   dcPmoney = 0;
                DataTable dpt      = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}'", strRepairId), "", "");;
                if (dpt.Rows.Count > 0)
                {
                    if (dpt.Rows.Count > dgvproject.Rows.Count)
                    {
                        dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1);
                    }
                    for (int i = 0; i < dpt.Rows.Count; i++)
                    {
                        DataRow dpr = dpt.Rows[i];
                        dgvproject.Rows[i].Cells["item_id"].Value                 = CommonCtrl.IsNullToString(dpr["item_id"]);
                        dgvproject.Rows[i].Cells["three_warranty"].Value          = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否";
                        dgvproject.Rows[i].Cells["man_hour_type"].Value           = CommonCtrl.IsNullToString(dpr["man_hour_type"]);
                        dgvproject.Rows[i].Cells["item_no"].Value                 = CommonCtrl.IsNullToString(dpr["item_no"]);
                        dgvproject.Rows[i].Cells["item_name"].Value               = CommonCtrl.IsNullToString(dpr["item_name"]);
                        dgvproject.Rows[i].Cells["item_type"].Value               = CommonCtrl.IsNullToString(dpr["item_type"]);
                        dgvproject.Rows[i].Cells["man_hour_quantity"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_quantity"]), 1);
                        dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]), 2);
                        dgvproject.Rows[i].Cells["remarks"].Value                 = CommonCtrl.IsNullToString(dpr["remarks"]);
                        dgvproject.Rows[i].Cells["sum_money_goods"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["sum_money_goods"]), 2);
                        dgvproject.Rows[i].Cells["member_discount"].Value         = CommonCtrl.IsNullToString(dpr["member_discount"]);
                        dgvproject.Rows[i].Cells["member_price"].Value            = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_price"]), 2);
                        dgvproject.Rows[i].Cells["member_sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_sum_money"]), 2);
                    }
                }
                #endregion

                #region 维修用料数据
                //维修用料数据
                decimal   dcMmoney = 0;
                DataTable dmt      = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}'", strRepairId), "", "");
                if (dmt.Rows.Count > 0)
                {
                    if (dmt.Rows.Count > dgvMaterials.Rows.Count)
                    {
                        dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1);
                    }
                    for (int i = 0; i < dmt.Rows.Count; i++)
                    {
                        DataRow dmr = dmt.Rows[i];
                        dgvMaterials.Rows[i].Cells["material_id"].Value      = CommonCtrl.IsNullToString(dmr["material_id"]);
                        dgvMaterials.Rows[i].Cells["parts_code"].Value       = CommonCtrl.IsNullToString(dmr["parts_code"]);
                        dgvMaterials.Rows[i].Cells["parts_name"].Value       = CommonCtrl.IsNullToString(dmr["parts_name"]);
                        dgvMaterials.Rows[i].Cells["norms"].Value            = CommonCtrl.IsNullToString(dmr["norms"]);
                        dgvMaterials.Rows[i].Cells["unit"].Value             = CommonCtrl.IsNullToString(dmr["unit"]);
                        dgvMaterials.Rows[i].Cells["quantity"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["quantity"]), 1);
                        dgvMaterials.Rows[i].Cells["unit_price"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["unit_price"]), 2);
                        dgvMaterials.Rows[i].Cells["Mmember_discount"].Value = CommonCtrl.IsNullToString(dmr["member_discount"]);
                        dgvMaterials.Rows[i].Cells["Mmember_price"].Value    = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["member_price"]), 2);
                        dgvMaterials.Rows[i].Cells["sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["sum_money"]), 2);
                        dgvMaterials.Rows[i].Cells["drawn_no"].Value         = CommonCtrl.IsNullToString(dmr["drawn_no"]);
                        dgvMaterials.Rows[i].Cells["vehicle_brand"].Value    = CommonCtrl.IsNullToString(dmr["vehicle_brand"]);
                        dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value  = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否";
                        dgvMaterials.Rows[i].Cells["Mremarks"].Value         = CommonCtrl.IsNullToString(dmr["remarks"]);
                        dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否";
                    }
                }
                #endregion

                #region 其他项目收费数据
                //其他项目收费数据
                decimal   doMmoney = 0;
                DataTable dot      = DBHelper.GetTable("其他项目收费数据", "tb_maintain_other_toll", "*", string.Format(" maintain_id='{0}'", strRepairId), "", "");
                if (dot.Rows.Count > 0)
                {
                    if (dot.Rows.Count > dgvOther.Rows.Count)
                    {
                        dgvOther.Rows.Add(dot.Rows.Count - dgvOther.Rows.Count + 1);
                    }
                    for (int i = 0; i < dot.Rows.Count; i++)
                    {
                        DataRow dor = dot.Rows[i];
                        dgvOther.Rows[i].Cells["toll_id"].Value    = CommonCtrl.IsNullToString(dor["toll_id"]);
                        dgvOther.Rows[i].Cells["Osum_money"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dor["sum_money"]), 2);
                        dgvOther.Rows[i].Cells["Oremarks"].Value   = CommonCtrl.IsNullToString(dor["remarks"]);
                        dgvOther.Rows[i].Cells["cost_types"].Value = GetDicName(CommonCtrl.IsNullToString(dor["cost_types"]));
                    }
                }

                #endregion

                #region 附件信息数据
                //附件信息数据
                ucAttr.TableName         = "tb_maintain_info";
                ucAttr.TableNameKeyValue = strRepairId;
                ucAttr.BindAttachment();
                #endregion
                #endregion
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 根据领料单Id获取相应的详细信息
        /// </summary>
        /// <param name="strRId">领料单Id值</param>
        /// <param name="strRId">领料单详情Id值</param>
        private void GetRescueData(string strRId, string strDRId)
        {
            #region 基本信息
            //SetBtnStatus(WindowStatus.View);
            DataTable dt = DBHelper.GetTable("领料退货单预览", "tb_maintain_refund_material", "*", string.Format(" refund_id='{0}'", strRId), "", "");
            if (dt.Rows.Count > 0)
            {
                #region 维修表信息
                DataRow dr = dt.Rows[0];
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["refund_no"])))
                {
                    labMaterialNoS.Text = CommonCtrl.IsNullToString(dr["refund_no"]);//退料单号
                }
                else
                {
                    labMaterialNoS.Text = string.Empty;
                }

                strFetchTime = CommonCtrl.IsNullToString(dr["refund_time"]);  //退料时间
                if (!string.IsNullOrEmpty(strFetchTime))
                {
                    labFetchTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFetchTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFetchTimeS.Text = string.Empty;
                }
                labCustomNOS.Text     = CommonCtrl.IsNullToString(dr["customer_code"]);                                                                           //客户编码
                labCustomNameS.Text   = CommonCtrl.IsNullToString(dr["customer_name"]);                                                                           //客户名称
                labContactS.Text      = CommonCtrl.IsNullToString(dr["linkman"]);                                                                                 //联系人
                labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]);                                                                         //联系人电话
                labCarNOS.Text        = CommonCtrl.IsNullToString(dr["vehicle_no"]);                                                                              //车牌号
                labCarTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_model"]));                                                               //车型
                labStatusS.Text       = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"]))); //单据状态
                labDepartS.Text       = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"]));                                                             //部门
                labAttnS.Text         = GetSetJBName(CommonCtrl.IsNullToString(dr["responsible_name"]));                                                          //经办人
                labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]);                                                                             //创建人
                labFetchOpidS.Text    = GetSetName(CommonCtrl.IsNullToString(dr["fetch_opid"]));                                                                  //退料人
                labRemarkS.Text       = CommonCtrl.IsNullToString(dr["remarks"]);                                                                                 //备注
                string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]);                                                                              //创建时间
                if (!string.IsNullOrEmpty(strCreateTime))
                {
                    labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labCreateTimeS.Text = string.Empty;
                }
                labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]);   //最后编辑人
                string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间
                if (!string.IsNullOrEmpty(strFinallyTime))
                {
                    labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFinallyTimeS.Text = string.Empty;
                }

                strStatus = CommonCtrl.IsNullToString(dr["info_status"]);//单据状态
                if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString())
                {
                    //已提交状态屏蔽提交、编辑、删除按钮
                    base.btnSubmit.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
                {
                    //已审核时屏蔽提交、审核、编辑、删除按钮
                    base.btnSubmit.Enabled     = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
                {
                    //审核没通过时屏蔽审核按钮
                    base.btnVerify.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
                {
                    base.btnActivation.Caption = "激活";
                    base.btnSubmit.Enabled     = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                }
                #endregion
                #endregion

                #region 领料信息
                DataTable dlt = DBHelper.GetTable("领料数据", "tb_maintain_refund_material_detai", "*", string.Format(" refund_id='{0}'", strRId), "", "");
                if (dlt.Rows.Count > 0)
                {
                    if (dlt.Rows.Count > dgvMaterials.Rows.Count)
                    {
                        dgvMaterials.Rows.Add(dlt.Rows.Count - dgvMaterials.Rows.Count + 1);
                    }
                    for (int i = 0; i < dlt.Rows.Count; i++)
                    {
                        DataRow dor = dlt.Rows[i];
                        dgvMaterials.Rows[i].Cells["parts_code"].Value       = CommonCtrl.IsNullToString(dor["parts_code"]);
                        dgvMaterials.Rows[i].Cells["parts_name"].Value       = CommonCtrl.IsNullToString(dor["parts_name"]);
                        dgvMaterials.Rows[i].Cells["unit"].Value             = CommonCtrl.IsNullToString(dor["unit"]);
                        dgvMaterials.Rows[i].Cells["quantity"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dor["retreat_num"]), 1);
                        dgvMaterials.Rows[i].Cells["warehouse"].Value        = GetWarehouseName(CommonCtrl.IsNullToString(dor["warehouse"]));
                        dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dor["whether_imported"]) == "1" ? "是" : "否";
                        dgvMaterials.Rows[i].Cells["drawn_no"].Value         = CommonCtrl.IsNullToString(dor["drawn_no"]);
                        dgvMaterials.Rows[i].Cells["vehicle_brand"].Value    = CommonCtrl.IsNullToString(dor["vehicle_brand"]);
                        dgvMaterials.Rows[i].Cells["Mremarks"].Value         = CommonCtrl.IsNullToString(dor["remarks"]);
                        dgvMaterials.Rows[i].Cells["material_id"].Value      = CommonCtrl.IsNullToString(dor["material_id"]);
                    }
                }
                #endregion
            }
            else
            {
                #region 没有数据时全部显示为空
                labAttnS.Text         = string.Empty;
                labCarNOS.Text        = string.Empty;
                labCarTypeS.Text      = string.Empty;
                labContactPhoneS.Text = string.Empty;
                labContactS.Text      = string.Empty;
                labCreatePersonS.Text = string.Empty;
                labCreateTimeS.Text   = string.Empty;
                labCustomNameS.Text   = string.Empty;
                labCustomNOS.Text     = string.Empty;
                labDepartS.Text       = string.Empty;
                labFinallyPerS.Text   = string.Empty;
                labFinallyTimeS.Text  = string.Empty;
                labStatusS.Text       = string.Empty;
                labRemarkS.Text       = string.Empty;
                #endregion
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 根据预约单Id获取相应的详细信息
        /// </summary>
        /// <param name="strRId">预约单reserv_id值</param>
        private void GetReservData(string strRId)
        {
            #region 基本信息
            //SetBtnStatus(WindowStatus.View);
            DataTable dt = DBHelper.GetTable("维修接待单预览", "tb_maintain_info", "*", string.Format(" maintain_id='{0}'", strRId), "", "");
            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["maintain_no"])))
                {
                    labMaintain_noS.Text = CommonCtrl.IsNullToString(dr["maintain_no"]);//维修单号
                }
                else
                {
                    labMaintain_noS.Text = string.Empty;
                }
                string strReTime = CommonCtrl.IsNullToString(dr["reception_time"]);//接待时间
                if (!string.IsNullOrEmpty(strReTime))
                {
                    labRTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labRTimeS.Text = string.Empty;
                }
                labCustomNOS.Text     = CommonCtrl.IsNullToString(dr["customer_code"]);                //客户编码
                labCustomNameS.Text   = CommonCtrl.IsNullToString(dr["customer_name"]);                //客户名称
                labContactS.Text      = CommonCtrl.IsNullToString(dr["linkman"]);                      //联系人
                labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]);              //联系人电话
                labCarNOS.Text        = CommonCtrl.IsNullToString(dr["vehicle_no"]);                   //车牌号
                labCarTypeS.Text      = GetVmodel(CommonCtrl.IsNullToString(dr["vehicle_model"]));     //车型
                labCarBrandS.Text     = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"]));    //车辆品牌
                labVINS.Text          = CommonCtrl.IsNullToString(dr["vehicle_vin"]);                  //VIN
                labEngineNoS.Text     = CommonCtrl.IsNullToString(dr["engine_no"]);                    //发动机号
                labturnerS.Text       = CommonCtrl.IsNullToString(dr["turner"]);                       //车厂编码
                labDriverS.Text       = CommonCtrl.IsNullToString(dr["driver_name"]);                  //司机
                labDriverPhoneS.Text  = CommonCtrl.IsNullToString(dr["driver_mobile"]);                //司机手机
                labRepTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["maintain_type"]));    //维修类别
                labPayTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["maintain_payment"])); //维修付费方式
                string strInTime = CommonCtrl.IsNullToString(dr["completion_time"]);                   //预计完工时间
                if (!string.IsNullOrEmpty(strInTime))
                {
                    labSuTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strInTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labSuTimeS.Text = string.Empty;
                }
                labMlS.Text   = !String.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["oil_into_factory"]))?CommonCtrl.IsNullToString(dr["oil_into_factory"]) + "%":""; //进场油量
                labMilS.Text  = !String.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["travel_mileage"]))?CommonCtrl.IsNullToString(dr["travel_mileage"]) + "Km":"";    //行驶里程
                labDescS.Text = CommonCtrl.IsNullToString(dr["fault_describe"]);                                                                                     //故障描述

                #region 会员信息
                string strMemnerID = CommonCtrl.IsNullToString(dr["customer_id"]);//会员信息Id
                GetMemberInfo(strMemnerID);
                #endregion

                labRemarkS.Text = CommonCtrl.IsNullToString(dr["remark"]);                                                                                  //备注
                labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"]))); //单据状态
                //labMoney.Text = CommonCtrl.IsNullToString(dr["maintain_payment"]);//欠款余额
                labDepartS.Text       = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_id"]));                                                         //部门
                labAttnS.Text         = GetSetName(CommonCtrl.IsNullToString(dr["responsible_opid"]));                                                      //经办人
                labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]);                                                                       //创建人
                string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]);                                                                        //创建时间
                if (!string.IsNullOrEmpty(strCreateTime))
                {
                    labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labCreateTimeS.Text = string.Empty;
                }
                labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]);   //最后编辑人
                string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间
                if (!string.IsNullOrEmpty(strFinallyTime))
                {
                    labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFinallyTimeS.Text = string.Empty;
                }

                strStatus = CommonCtrl.IsNullToString(dr["info_status"]); //单据状态
                if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString())
                {
                    //已提交状态屏蔽提交、编辑、删除按钮
                    base.btnSubmit.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
                {
                    //已审核时屏蔽提交、审核、编辑、删除按钮
                    base.btnSubmit.Enabled     = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
                {
                    //审核没通过时屏蔽审核按钮
                    base.btnVerify.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
                {
                    base.btnActivation.Caption = "激活";
                    base.btnSubmit.Enabled     = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                }
                strBeforOrderId = CommonCtrl.IsNullToString(dr["before_orderId"]);
                strBeforSource  = CommonCtrl.IsNullToString(dr["orders_source"]);
                #endregion

                #region 底部datagridview数据

                #region 维修项目数据
                //维修项目数据
                decimal   dcPmoney = 0;
                DataTable dpt      = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");;
                if (dpt.Rows.Count > 0)
                {
                    if (dpt.Rows.Count > dgvproject.Rows.Count)
                    {
                        dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1);
                    }
                    for (int i = 0; i < dpt.Rows.Count; i++)
                    {
                        DataRow dpr = dpt.Rows[i];
                        dgvproject.Rows[i].Cells["item_id"].Value                 = CommonCtrl.IsNullToString(dpr["item_id"]);
                        dgvproject.Rows[i].Cells["three_warranty"].Value          = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否";
                        dgvproject.Rows[i].Cells["man_hour_type"].Value           = CommonCtrl.IsNullToString(dpr["man_hour_type"]);
                        dgvproject.Rows[i].Cells["item_no"].Value                 = CommonCtrl.IsNullToString(dpr["item_no"]);
                        dgvproject.Rows[i].Cells["item_name"].Value               = CommonCtrl.IsNullToString(dpr["item_name"]);
                        dgvproject.Rows[i].Cells["item_type"].Value               = CommonCtrl.IsNullToString(dpr["item_type"]);
                        dgvproject.Rows[i].Cells["man_hour_quantity"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_quantity"]), 1);
                        dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]), 2);
                        dgvproject.Rows[i].Cells["remarks"].Value                 = CommonCtrl.IsNullToString(dpr["remarks"]);
                        dgvproject.Rows[i].Cells["sum_money_goods"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["sum_money_goods"]), 2);
                        dgvproject.Rows[i].Cells["member_discount"].Value         = CommonCtrl.IsNullToString(dpr["member_discount"]);
                        dgvproject.Rows[i].Cells["member_price"].Value            = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_price"]), 2);
                        dgvproject.Rows[i].Cells["member_sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_sum_money"]), 2);
                    }
                    foreach (DataGridViewRow dgvr in dgvproject.Rows)
                    {
                        dcPmoney += Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money_goods"].Value)) ? dgvr.Cells["sum_money_goods"].Value : 0);
                    }
                    labAssessS.Text = dcPmoney.ToString();
                }
                #endregion

                #region 维修用料数据
                //维修用料数据
                decimal   dcMmoney = 0;
                DataTable dmt      = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");
                if (dmt.Rows.Count > 0)
                {
                    if (dmt.Rows.Count > dgvMaterials.Rows.Count)
                    {
                        dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1);
                    }
                    for (int i = 0; i < dmt.Rows.Count; i++)
                    {
                        DataRow dmr = dmt.Rows[i];
                        dgvMaterials.Rows[i].Cells["material_id"].Value      = CommonCtrl.IsNullToString(dmr["material_id"]);
                        dgvMaterials.Rows[i].Cells["parts_code"].Value       = CommonCtrl.IsNullToString(dmr["parts_code"]);
                        dgvMaterials.Rows[i].Cells["parts_name"].Value       = CommonCtrl.IsNullToString(dmr["parts_name"]);
                        dgvMaterials.Rows[i].Cells["norms"].Value            = CommonCtrl.IsNullToString(dmr["norms"]);
                        dgvMaterials.Rows[i].Cells["unit"].Value             = CommonCtrl.IsNullToString(dmr["unit"]);
                        dgvMaterials.Rows[i].Cells["quantity"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["quantity"]), 1);
                        dgvMaterials.Rows[i].Cells["unit_price"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["unit_price"]), 2);
                        dgvMaterials.Rows[i].Cells["Mmember_discount"].Value = CommonCtrl.IsNullToString(dmr["member_discount"]);
                        dgvMaterials.Rows[i].Cells["Mmember_price"].Value    = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["member_price"]), 2);
                        dgvMaterials.Rows[i].Cells["sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["sum_money"]), 2);
                        dgvMaterials.Rows[i].Cells["drawn_no"].Value         = CommonCtrl.IsNullToString(dmr["drawn_no"]);
                        dgvMaterials.Rows[i].Cells["vehicle_brand"].Value    = CommonCtrl.IsNullToString(dmr["vehicle_brand"]);
                        dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value  = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否";
                        dgvMaterials.Rows[i].Cells["Mremarks"].Value         = CommonCtrl.IsNullToString(dmr["remarks"]);
                        dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否";
                    }
                    foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                    {
                        dcMmoney += Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money"].Value)) ? dgvr.Cells["sum_money"].Value : 0);
                    }
                    labLAssessS.Text = dcMmoney.ToString();
                }
                #endregion

                #region 其他项目收费数据
                //其他项目收费数据
                decimal   doMmoney = 0;
                DataTable dot      = DBHelper.GetTable("其他项目收费数据", "tb_maintain_other_toll", "*", string.Format(" maintain_id='{0}'", strRId), "", "");
                if (dot.Rows.Count > 0)
                {
                    if (dot.Rows.Count > dgvOther.Rows.Count)
                    {
                        dgvOther.Rows.Add(dot.Rows.Count - dgvOther.Rows.Count + 1);
                    }
                    for (int i = 0; i < dot.Rows.Count; i++)
                    {
                        DataRow dor = dot.Rows[i];
                        dgvOther.Rows[i].Cells["toll_id"].Value    = CommonCtrl.IsNullToString(dor["toll_id"]);
                        dgvOther.Rows[i].Cells["Osum_money"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dor["sum_money"]), 2);
                        dgvOther.Rows[i].Cells["Oremarks"].Value   = CommonCtrl.IsNullToString(dor["remarks"]);
                        dgvOther.Rows[i].Cells["cost_types"].Value = GetDicName(CommonCtrl.IsNullToString(dor["cost_types"]));
                    }
                    foreach (DataGridViewRow dgvr in dgvOther.Rows)
                    {
                        doMmoney += Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["Osum_money"].Value)) ? dgvr.Cells["Osum_money"].Value : 0);
                    }
                    labOAssessS.Text = doMmoney.ToString();
                }
                labTotalS.Text = (dcPmoney + dcMmoney + doMmoney).ToString();
                #endregion

                #region 附件信息数据
                //附件信息数据
                ucAttr.TableName         = "tb_maintain_info";
                ucAttr.TableNameKeyValue = strRId;
                ucAttr.BindAttachment();
                #endregion
                #endregion
            }
            else
            {
                #region 没有数据时全部显示为空
                labMaintain_noS.Text  = string.Empty;
                labRTimeS.Text        = string.Empty;
                labAttnS.Text         = string.Empty;
                labCarBrandS.Text     = string.Empty;
                labCarNOS.Text        = string.Empty;
                labCarTypeS.Text      = string.Empty;
                labturnerS.Text       = string.Empty;
                labContactPhoneS.Text = string.Empty;
                labContactS.Text      = string.Empty;
                labCreatePersonS.Text = string.Empty;
                labCreateTimeS.Text   = string.Empty;
                labCustomNameS.Text   = string.Empty;
                labCustomNOS.Text     = string.Empty;
                labDepartS.Text       = string.Empty;
                labDescS.Text         = string.Empty;
                labDriverPhoneS.Text  = string.Empty;
                labDriverS.Text       = string.Empty;
                labEngineNoS.Text     = string.Empty;
                labFinallyPerS.Text   = string.Empty;
                labFinallyTimeS.Text  = string.Empty;
                labPayTypeS.Text      = string.Empty;
                labRemarkS.Text       = string.Empty;
                labRepTypeS.Text      = string.Empty;
                labStatusS.Text       = string.Empty;
                labVINS.Text          = string.Empty;
                labMlS.Text           = string.Empty;
                labMilS.Text          = string.Empty;
                labMemberNoS.Text     = string.Empty;
                labMemberGradeS.Text  = string.Empty;
                labMemberPZkS.Text    = string.Empty;
                labMemberLZkS.Text    = string.Empty;
                #endregion
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 根据预约单Id获取相应的详细信息
        /// </summary>
        /// <param name="strRId">预约单reserv_id值</param>
        private void GetReservData(string strRId)
        {
            #region 基本信息
            //SetBtnStatus(WindowStatus.View);
            DataTable dt = DBHelper.GetTable("预约单预览", "tb_maintain_reservation", "*", string.Format(" reserv_id='{0}'", strRId), "", "");
            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["reservation_no"])))
                {
                    labReserveNoS.Text = CommonCtrl.IsNullToString(dr["reservation_no"]);//预约单号
                }
                else
                {
                    labReserveNoS.Text = string.Empty;
                }
                string strReTime = CommonCtrl.IsNullToString(dr["reservation_date"]);//预约日期
                if (!string.IsNullOrEmpty(strReTime))
                {
                    labReTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labReTimeS.Text = string.Empty;
                }
                string strInTime = CommonCtrl.IsNullToString(dr["maintain_time"]);//预约进场日期
                if (!string.IsNullOrEmpty(strInTime))
                {
                    labInTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strInTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labInTimeS.Text = string.Empty;
                }
                labRepPersonS.Text      = CommonCtrl.IsNullToString(dr["reservation_man"]);                                                                             //预约人
                labRepPersonPhoneS.Text = CommonCtrl.IsNullToString(dr["reservation_mobile"]);                                                                          //预约人手机
                labYesS.Text            = CommonCtrl.IsNullToString(dr["whether_greet"]) == "1"?"是":"否";                                                                //是否接车
                labAddressS.Text        = CommonCtrl.IsNullToString(dr["greet_site"]);                                                                                  //接车地址
                labDescS.Text           = CommonCtrl.IsNullToString(dr["fault_describe"]);                                                                              //故障描述
                labCustomNOS.Text       = CommonCtrl.IsNullToString(dr["customer_code"]);                                                                               //客户编码
                labCustomNameS.Text     = CommonCtrl.IsNullToString(dr["customer_name"]);                                                                               //客户名称
                labCarNOS.Text          = CommonCtrl.IsNullToString(dr["vehicle_no"]);                                                                                  //车牌号
                labCarTypeS.Text        = GetVmodel(CommonCtrl.IsNullToString(dr["vehicle_model"]));                                                                    //车型
                labCarBrandS.Text       = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"]));                                                                   //车辆品牌
                labVINS.Text            = CommonCtrl.IsNullToString(dr["vehicle_vin"]);                                                                                 //VIN
                labEngineNoS.Text       = CommonCtrl.IsNullToString(dr["engine_type"]);                                                                                 //发动机号
                labColorS.Text          = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_color"]));                                                                   //颜色
                labRepTypeS.Text        = GetDicName(CommonCtrl.IsNullToString(dr["maintain_type"]));                                                                   //维修类别
                labPayTypeS.Text        = GetDicName(CommonCtrl.IsNullToString(dr["maintain_payment"]));                                                                //维修付费方式
                labContactS.Text        = CommonCtrl.IsNullToString(dr["linkman"]);                                                                                     //联系人
                labContactPhoneS.Text   = CommonCtrl.IsNullToString(dr["link_man_mobile"]);                                                                             //联系人手机
                labRemarkS.Text         = CommonCtrl.IsNullToString(dr["remark"]);                                                                                      //备注
                labStatusS.Text         = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["document_status"]))); //单据状态
                //labMoney.Text = CommonCtrl.IsNullToString(dr["maintain_payment"]);//欠款余额
                labDepartS.Text       = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"]));                                                                   //部门
                labAttnS.Text         = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_opid"]));                                                              //经办人
                labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]);                                                                                   //创建人
                string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]);                                                                                    //创建时间
                if (!string.IsNullOrEmpty(strCreateTime))
                {
                    labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labCreateTimeS.Text = string.Empty;
                }
                labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]);   //最后编辑人
                string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间
                if (!string.IsNullOrEmpty(strFinallyTime))
                {
                    labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFinallyTimeS.Text = string.Empty;
                }
                strStatus = CommonCtrl.IsNullToString(dr["document_status"]);//单据状态
                if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString())
                {
                    //已提交状态屏蔽提交、编辑、删除按钮
                    base.btnSubmit.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
                {
                    //已审核时屏蔽提交、审核、编辑、删除按钮
                    base.btnSubmit.Enabled     = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
                {
                    //审核没通过时屏蔽审核按钮
                    base.btnVerify.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
                {
                    base.btnActivation.Caption = "激活";
                    base.btnSubmit.Enabled     = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                }

                #endregion

                #region 底部datagridview数据

                #region 维修项目数据
                //维修项目数据
                DataTable dpt = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");
                if (dpt.Rows.Count > 0)
                {
                    if (dpt.Rows.Count > dgvproject.Rows.Count)
                    {
                        dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1);
                    }
                    for (int i = 0; i < dpt.Rows.Count; i++)
                    {
                        DataRow dpr = dpt.Rows[i];
                        dgvproject.Rows[i].Cells["item_id"].Value                 = CommonCtrl.IsNullToString(dpr["item_id"]);
                        dgvproject.Rows[i].Cells["three_warranty"].Value          = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否";
                        dgvproject.Rows[i].Cells["man_hour_type"].Value           = CommonCtrl.IsNullToString(dpr["man_hour_type"]);
                        dgvproject.Rows[i].Cells["item_no"].Value                 = CommonCtrl.IsNullToString(dpr["item_no"]);
                        dgvproject.Rows[i].Cells["item_name"].Value               = CommonCtrl.IsNullToString(dpr["item_name"]);
                        dgvproject.Rows[i].Cells["item_type"].Value               = CommonCtrl.IsNullToString(dpr["item_type"]);
                        dgvproject.Rows[i].Cells["man_hour_quantity"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_quantity"]), 1);
                        dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]), 2);
                        dgvproject.Rows[i].Cells["remarks"].Value                 = CommonCtrl.IsNullToString(dpr["remarks"]);
                        dgvproject.Rows[i].Cells["sum_money"].Value               = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["sum_money"]), 2);
                    }
                }
                #endregion

                #region 维修用料数据
                //维修用料数据
                DataTable dmt = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");
                if (dmt.Rows.Count > 0)
                {
                    if (dmt.Rows.Count > dgvMaterials.Rows.Count)
                    {
                        dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1);
                    }
                    for (int i = 0; i < dmt.Rows.Count; i++)
                    {
                        DataRow dmr = dmt.Rows[i];
                        dgvMaterials.Rows[i].Cells["material_id"].Value      = CommonCtrl.IsNullToString(dmr["material_id"]);
                        dgvMaterials.Rows[i].Cells["parts_code"].Value       = CommonCtrl.IsNullToString(dmr["parts_code"]);
                        dgvMaterials.Rows[i].Cells["parts_name"].Value       = CommonCtrl.IsNullToString(dmr["parts_name"]);
                        dgvMaterials.Rows[i].Cells["norms"].Value            = CommonCtrl.IsNullToString(dmr["norms"]);
                        dgvMaterials.Rows[i].Cells["unit"].Value             = CommonCtrl.IsNullToString(dmr["unit"]);
                        dgvMaterials.Rows[i].Cells["quantity"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["quantity"]), 1);
                        dgvMaterials.Rows[i].Cells["unit_price"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["unit_price"]), 2);
                        dgvMaterials.Rows[i].Cells["Msum_money"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["sum_money"]), 2);
                        dgvMaterials.Rows[i].Cells["drawn_no"].Value         = CommonCtrl.IsNullToString(dmr["drawn_no"]);
                        dgvMaterials.Rows[i].Cells["vehicle_model"].Value    = CommonCtrl.IsNullToString(dmr["vehicle_model"]);
                        dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value  = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否";
                        dgvMaterials.Rows[i].Cells["Mremarks"].Value         = CommonCtrl.IsNullToString(dmr["remarks"]);
                        dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否";
                    }
                }
                #endregion
                #endregion
            }
            else
            {
                #region 置空
                labAddressS.Text        = string.Empty;
                labAttnS.Text           = string.Empty;
                labCarBrandS.Text       = string.Empty;
                labCarNOS.Text          = string.Empty;
                labCarTypeS.Text        = string.Empty;
                labColorS.Text          = string.Empty;
                labContactPhoneS.Text   = string.Empty;
                labContactS.Text        = string.Empty;
                labCreatePersonS.Text   = string.Empty;
                labCreateTimeS.Text     = string.Empty;
                labCustomNameS.Text     = string.Empty;
                labCustomNOS.Text       = string.Empty;
                labDepartS.Text         = string.Empty;
                labDescS.Text           = string.Empty;
                labMoney.Text           = "0.00";
                labEngineNoS.Text       = string.Empty;
                labFinallyPerS.Text     = string.Empty;
                labFinallyTimeS.Text    = string.Empty;
                labInTimeS.Text         = string.Empty;
                labPayTypeS.Text        = string.Empty;
                labRemarkS.Text         = string.Empty;
                labRepPersonPhoneS.Text = string.Empty;
                labRepPersonS.Text      = string.Empty;
                labRepTypeS.Text        = string.Empty;
                labReserveNoS.Text      = string.Empty;
                labReTimeS.Text         = string.Empty;
                labStatusS.Text         = string.Empty;
                labVINS.Text            = string.Empty;
                labYesS.Text            = string.Empty;
                #endregion
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 根据预约单Id获取相应的详细信息
        /// </summary>
        /// <param name="strRId">预约单reserv_id值</param>
        private void GetReservData(string strRId)
        {
            #region 基本信息
            //SetBtnStatus(WindowStatus.View);
            DataTable dt = DBHelper.GetTable("维修结算单预览", "tb_maintain_settlement_info a left join tb_maintain_info b on a.maintain_id=b.maintain_id ", "*", string.Format(" a.maintain_id='{0}'", strRId), "", "");
            if (dt.Rows.Count > 0)
            {
                #region 维修表信息
                DataRow dr = dt.Rows[0];
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["maintain_no"])))
                {
                    labMaintain_noS.Text = CommonCtrl.IsNullToString(dr["maintain_no"]);//维修单号
                }
                else
                {
                    labMaintain_noS.Text = string.Empty;
                }
                labCustomNOS.Text     = CommonCtrl.IsNullToString(dr["customer_code"]);                                                                                      //客户编码
                labCustomNameS.Text   = CommonCtrl.IsNullToString(dr["customer_name"]);                                                                                      //客户名称
                labContactS.Text      = CommonCtrl.IsNullToString(dr["linkman"]);                                                                                            //联系人
                labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]);                                                                                    //联系人电话
                labCarNOS.Text        = CommonCtrl.IsNullToString(dr["vehicle_no"]);                                                                                         //车牌号
                labCarTypeS.Text      = GetVmodel(CommonCtrl.IsNullToString(dr["vehicle_model"]));                                                                           //车型
                labCarBrandS.Text     = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"]));                                                                          //车辆品牌
                labVINS.Text          = CommonCtrl.IsNullToString(dr["vehicle_vin"]);                                                                                        //VIN
                labEngineNoS.Text     = CommonCtrl.IsNullToString(dr["engine_no"]);                                                                                          //发动机号
                labDriverS.Text       = CommonCtrl.IsNullToString(dr["driver_name"]);                                                                                        //司机
                labDriverPhoneS.Text  = CommonCtrl.IsNullToString(dr["driver_mobile"]);                                                                                      //司机手机
                labRepTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["maintain_type"]));                                                                          //维修类别
                labPayTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["maintain_payment"]));                                                                       //维修付费方式
                labMlS.Text           = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["oil_into_factory"]))?CommonCtrl.IsNullToString(dr["oil_into_factory"]) + "%":""; //进场油量
                labMilS.Text          = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["travel_mileage"]))?CommonCtrl.IsNullToString(dr["travel_mileage"]) + "Km":"";    //行驶里程
                labYHyyS.Text         = CommonCtrl.IsNullToString(dr["favorable_reason"]);                                                                                   //优惠原因
                #region 会员信息
                string strMemnerID = CommonCtrl.IsNullToString(dr["member_id"]);                                                                                             //会员信息Id
                if (!string.IsNullOrEmpty(strMemnerID))
                {
                    DataTable dct = DBHelper.GetTable("获取会员信息", "tb_customer", "member_number,member_class,accessories_discount,workhours_discount", " is_member='1' and cust_id='" + strMemnerID + "'", "", "");
                    labMemberNoS.Text    = CommonCtrl.IsNullToString(dr["member_number"]);        //会员卡号
                    labMemberGradeS.Text = CommonCtrl.IsNullToString(dr["member_class"]);         //会员等级
                    labMemberPZkS.Text   = CommonCtrl.IsNullToString(dr["workhours_discount"]);   //会员项目折扣
                    labMemberLZkS.Text   = CommonCtrl.IsNullToString(dr["accessories_discount"]); //会员用料折扣
                }
                else
                {
                    labMemberNoS.Text    = string.Empty; //会员卡号
                    labMemberGradeS.Text = string.Empty; //会员等级
                    labMemberPZkS.Text   = string.Empty; //会员项目折扣
                    labMemberLZkS.Text   = string.Empty;
                }
                #endregion

                labRemarkS.Text = CommonCtrl.IsNullToString(dr["remark"]);                                                                                  //备注
                labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"]))); //单据状态
                //labMoney.Text = CommonCtrl.IsNullToString(dr["maintain_payment"]);//欠款余额
                labDepartS.Text       = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"]));                                                       //部门
                labAttnS.Text         = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_name"]));                                                  //经办人
                labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]);                                                                       //创建人
                string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]);                                                                        //创建时间
                if (!string.IsNullOrEmpty(strCreateTime))
                {
                    labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labCreateTimeS.Text = string.Empty;
                }
                labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]);   //最后编辑人
                string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间
                if (!string.IsNullOrEmpty(strFinallyTime))
                {
                    labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFinallyTimeS.Text = string.Empty;
                }

                strStatus = CommonCtrl.IsNullToString(dr["info_status"]);//单据状态
                if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Balance).ToString())
                {
                    //已结算状态屏蔽结算、编辑、删除按钮
                    base.btnBalance.Enabled    = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
                {
                    //已审核时屏蔽结算、审核、编辑、删除按钮
                    base.btnBalance.Enabled    = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
                {
                    //审核没通过时屏蔽审核按钮
                    base.btnVerify.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
                {
                    base.btnActivation.Caption = "激活";
                    base.btnBalance.Enabled    = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                }
                #endregion

                #region 结算表信息
                labGshkS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_sum_money"]), 2);   //工时货款
                labGsslS.Text       = CommonCtrl.IsNullToString(dr["man_hour_tax_rate"]);                                   //工时税率
                labGsseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_tax_cost"]), 2);    //工时税额
                labGssjhjS.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_sum"]), 2);         //工时价税合计
                labPjhkS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_sum_money"]), 2);    //配件货款
                labPjslS.Text       = CommonCtrl.IsNullToString(dr["fitting_tax_rate"]);                                    //配件税率
                labPjseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_tax_cost"]), 2);     //配件税额
                labPjsjhjS.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_sum"]), 2);          //配件价税合计
                labQtflS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_sum_money"]), 2); //其他项目费用
                labQtslS.Text       = CommonCtrl.IsNullToString(dr["other_item_tax_rate"]);                                 //其他项目税率
                labQtseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_tax_cost"]), 2);  //其他项目税额
                labQthjS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_sum"]), 2);       //其他项目价税合计
                labYH.Text          = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["privilege_cost"]), 2);       //优惠费用
                labShould.Text      = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["should_sum"]), 2);           //应收总额
                labReceive.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["received_sum"]), 2);         //实收总额
                labDebt.Text        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["debt_cost"]), 2);            //欠款金额
                labInvoiceType.Text = GetDicName(CommonCtrl.IsNullToString(dr["make_invoice_type"]));                       //开票类型
                labPayment.Text     = GetPaymentName(CommonCtrl.IsNullToString(dr["payment_terms"]));                       //结算方式
                labSetAccount.Text  = GetSetName(CommonCtrl.IsNullToString(dr["settlement_account"]));                      //结算账户
                labSetCompany.Text  = GetComName(CommonCtrl.IsNullToString(dr["settle_company"]));                          //结算单位
                string strReTime = CommonCtrl.IsNullToString(dr["create_time"]);                                            //结算时间
                if (!string.IsNullOrEmpty(strReTime))
                {
                    labBalanceTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labBalanceTimeS.Text = string.Empty;
                }
                string strBYTime = CommonCtrl.IsNullToString(dr["maintain_time"]);//建议保养日期
                if (!string.IsNullOrEmpty(strBYTime))
                {
                    labBYTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strBYTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labBYTimeS.Text = string.Empty;
                }
                #endregion

                #endregion

                #region 底部datagridview数据

                #region 维修项目数据
                //维修项目数据
                decimal   dcPmoney = 0;
                DataTable dpt      = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");;
                if (dpt.Rows.Count > 0)
                {
                    if (dpt.Rows.Count > dgvproject.Rows.Count)
                    {
                        dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1);
                    }
                    for (int i = 0; i < dpt.Rows.Count; i++)
                    {
                        DataRow dpr = dpt.Rows[i];
                        dgvproject.Rows[i].Cells["item_id"].Value                 = CommonCtrl.IsNullToString(dpr["item_id"]);
                        dgvproject.Rows[i].Cells["three_warranty"].Value          = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否";
                        dgvproject.Rows[i].Cells["man_hour_type"].Value           = CommonCtrl.IsNullToString(dpr["man_hour_type"]);
                        dgvproject.Rows[i].Cells["item_no"].Value                 = CommonCtrl.IsNullToString(dpr["item_no"]);
                        dgvproject.Rows[i].Cells["item_name"].Value               = CommonCtrl.IsNullToString(dpr["item_name"]);
                        dgvproject.Rows[i].Cells["item_type"].Value               = CommonCtrl.IsNullToString(dpr["item_type"]);
                        dgvproject.Rows[i].Cells["man_hour_quantity"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_quantity"]), 1);
                        dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]), 2);
                        dgvproject.Rows[i].Cells["remarks"].Value                 = CommonCtrl.IsNullToString(dpr["remarks"]);
                        dgvproject.Rows[i].Cells["sum_money_goods"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["sum_money_goods"]), 2);
                        dgvproject.Rows[i].Cells["member_discount"].Value         = CommonCtrl.IsNullToString(dpr["member_discount"]);
                        dgvproject.Rows[i].Cells["member_price"].Value            = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_price"]), 2);
                        dgvproject.Rows[i].Cells["member_sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_sum_money"]), 2);
                    }
                    foreach (DataGridViewRow dgvr in dgvproject.Rows)
                    {
                        dcPmoney += Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money_goods"].Value)) ? dgvr.Cells["sum_money_goods"].Value : 0);
                    }
                }
                #endregion

                #region 维修用料数据
                //维修用料数据
                decimal   dcMmoney = 0;
                DataTable dmt      = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}'and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");
                if (dmt.Rows.Count > 0)
                {
                    if (dmt.Rows.Count > dgvMaterials.Rows.Count)
                    {
                        dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1);
                    }
                    for (int i = 0; i < dmt.Rows.Count; i++)
                    {
                        DataRow dmr = dmt.Rows[i];
                        dgvMaterials.Rows[i].Cells["material_id"].Value      = CommonCtrl.IsNullToString(dmr["material_id"]);
                        dgvMaterials.Rows[i].Cells["parts_code"].Value       = CommonCtrl.IsNullToString(dmr["parts_code"]);
                        dgvMaterials.Rows[i].Cells["parts_name"].Value       = CommonCtrl.IsNullToString(dmr["parts_name"]);
                        dgvMaterials.Rows[i].Cells["norms"].Value            = CommonCtrl.IsNullToString(dmr["norms"]);
                        dgvMaterials.Rows[i].Cells["unit"].Value             = CommonCtrl.IsNullToString(dmr["unit"]);
                        dgvMaterials.Rows[i].Cells["quantity"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["quantity"]), 1);
                        dgvMaterials.Rows[i].Cells["unit_price"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["unit_price"]), 2);
                        dgvMaterials.Rows[i].Cells["Mmember_discount"].Value = CommonCtrl.IsNullToString(dmr["member_discount"]);
                        dgvMaterials.Rows[i].Cells["Mmember_price"].Value    = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["member_price"]), 2);
                        dgvMaterials.Rows[i].Cells["sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["sum_money"]), 2);
                        dgvMaterials.Rows[i].Cells["drawn_no"].Value         = CommonCtrl.IsNullToString(dmr["drawn_no"]);
                        dgvMaterials.Rows[i].Cells["vehicle_brand"].Value    = CommonCtrl.IsNullToString(dmr["vehicle_brand"]);
                        dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value  = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否";
                        dgvMaterials.Rows[i].Cells["Mremarks"].Value         = CommonCtrl.IsNullToString(dmr["remarks"]);
                        dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否";
                    }
                    foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                    {
                        dcMmoney += Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money"].Value)) ? dgvr.Cells["sum_money"].Value : 0);
                    }
                }
                #endregion

                #region 其他项目收费数据
                //其他项目收费数据
                decimal   doMmoney = 0;
                DataTable dot      = DBHelper.GetTable("其他项目收费数据", "tb_maintain_other_toll", "*", string.Format(" maintain_id='{0}'", strRId), "", "");
                if (dot.Rows.Count > 0)
                {
                    if (dot.Rows.Count > dgvOther.Rows.Count)
                    {
                        dgvOther.Rows.Add(dot.Rows.Count - dgvOther.Rows.Count + 1);
                    }
                    for (int i = 0; i < dot.Rows.Count; i++)
                    {
                        DataRow dor = dot.Rows[i];
                        dgvOther.Rows[i].Cells["toll_id"].Value    = CommonCtrl.IsNullToString(dor["toll_id"]);
                        dgvOther.Rows[i].Cells["Osum_money"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dor["sum_money"]), 2);
                        dgvOther.Rows[i].Cells["Oremarks"].Value   = CommonCtrl.IsNullToString(dor["remarks"]);
                        dgvOther.Rows[i].Cells["cost_types"].Value = GetDicName(CommonCtrl.IsNullToString(dor["cost_types"]));
                    }
                    foreach (DataGridViewRow dgvr in dgvOther.Rows)
                    {
                        doMmoney += Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["Osum_money"].Value)) ? dgvr.Cells["Osum_money"].Value : 0);
                    }
                }

                #endregion

                #region 附件信息数据
                //附件信息数据
                ucAttr.TableName         = "tb_maintain_info";
                ucAttr.TableNameKeyValue = strRId;
                ucAttr.BindAttachment();
                #endregion
                #endregion
            }
            else
            {
                #region 没有数据时全部显示为空
                labMaintain_noS.Text  = string.Empty;
                labAttnS.Text         = string.Empty;
                labCarBrandS.Text     = string.Empty;
                labCarNOS.Text        = string.Empty;
                labCarTypeS.Text      = string.Empty;
                labContactPhoneS.Text = string.Empty;
                labContactS.Text      = string.Empty;
                labCreatePersonS.Text = string.Empty;
                labCreateTimeS.Text   = string.Empty;
                labCustomNameS.Text   = string.Empty;
                labCustomNOS.Text     = string.Empty;
                labDepartS.Text       = string.Empty;
                labDriverPhoneS.Text  = string.Empty;
                labDriverS.Text       = string.Empty;
                labEngineNoS.Text     = string.Empty;
                labFinallyPerS.Text   = string.Empty;
                labFinallyTimeS.Text  = string.Empty;
                labPayTypeS.Text      = string.Empty;
                labRemarkS.Text       = string.Empty;
                labRepTypeS.Text      = string.Empty;
                labStatusS.Text       = string.Empty;
                labVINS.Text          = string.Empty;
                labMlS.Text           = string.Empty;
                labMilS.Text          = string.Empty;
                labMemberNoS.Text     = string.Empty;
                labMemberGradeS.Text  = string.Empty;
                labMemberPZkS.Text    = string.Empty;
                labMemberLZkS.Text    = string.Empty;
                #endregion
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 根据救援单Id获取相应的详细信息
        /// </summary>
        /// <param name="strRId">救援单Id值</param>
        private void GetRescueData(string strRId)
        {
            #region 基本信息
            //SetBtnStatus(WindowStatus.View);
            DataTable dt = DBHelper.GetTable("救援单预览", "tb_maintain_rescue_info", "*", string.Format(" rescue_id='{0}'", strRId), "", "");
            if (dt.Rows.Count > 0)
            {
                #region 维修表信息
                DataRow dr = dt.Rows[0];
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["rescue_no"])))
                {
                    labMaintain_noS.Text = CommonCtrl.IsNullToString(dr["rescue_no"]);//救援单号
                }
                else
                {
                    labMaintain_noS.Text = string.Empty;
                }

                string strMakeTime = CommonCtrl.IsNullToString(dr["make_time"]); //制单时间
                if (!string.IsNullOrEmpty(strMakeTime))
                {
                    labMakeOrderTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strMakeTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labMakeOrderTimeS.Text = string.Empty;
                }

                labCustomNOS.Text     = CommonCtrl.IsNullToString(dr["customer_code"]);                                                                               //客户编码
                labCustomNameS.Text   = CommonCtrl.IsNullToString(dr["customer_name"]);                                                                               //客户名称
                labContactS.Text      = CommonCtrl.IsNullToString(dr["linkman"]);                                                                                     //联系人
                labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["linkman_mobile"]);                                                                              //联系人电话
                labCarNOS.Text        = CommonCtrl.IsNullToString(dr["vehicle_no"]);                                                                                  //车牌号
                labCarTypeS.Text      = GetVmodel(CommonCtrl.IsNullToString(dr["vehicle_model"]));                                                                    //车型
                labCarBrandS.Text     = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"]));                                                                   //车辆品牌
                labVINS.Text          = CommonCtrl.IsNullToString(dr["vehicle_vin"]);                                                                                 //VIN
                labturnerS.Text       = CommonCtrl.IsNullToString(dr["turner"]);                                                                                      //车厂编码
                labEngineNoS.Text     = CommonCtrl.IsNullToString(dr["engine_type"]);                                                                                 //发动机号
                labDriverS.Text       = CommonCtrl.IsNullToString(dr["driver_name"]);                                                                                 //司机
                labDriverPhoneS.Text  = CommonCtrl.IsNullToString(dr["driver_mobile"]);                                                                               //司机手机
                labMilsS.Text         = CommonCtrl.IsNullToString(dr["rescue_mileage"]);                                                                              //救援里程
                labStatusS.Text       = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["document_status"]))); //单据状态
                labDepartS.Text       = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"]));                                                                 //部门
                labAttnS.Text         = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_opid"]));                                                            //经办人
                labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]);                                                                                 //创建人
                string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]);                                                                                  //创建时间
                if (!string.IsNullOrEmpty(strCreateTime))
                {
                    labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labCreateTimeS.Text = string.Empty;
                }
                labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]);   //最后编辑人
                string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间
                if (!string.IsNullOrEmpty(strFinallyTime))
                {
                    labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFinallyTimeS.Text = string.Empty;
                }

                strStatus = CommonCtrl.IsNullToString(dr["document_status"]);//单据状态
                if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Balance).ToString())
                {
                    //已结算状态屏蔽结算、编辑、删除按钮
                    base.btnBalance.Enabled    = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
                {
                    //已审核时屏蔽结算、审核、编辑、删除按钮
                    base.btnBalance.Enabled    = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                    base.btnDelete.Enabled     = false;
                    base.btnActivation.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
                {
                    //审核没通过时屏蔽审核按钮
                    base.btnVerify.Enabled = false;
                }
                else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
                {
                    base.btnActivation.Caption = "激活";
                    base.btnBalance.Enabled    = false;
                    base.btnVerify.Enabled     = false;
                    base.btnEdit.Enabled       = false;
                }
                #endregion

                #region 救援信息
                labGshkS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_sum_money"]), 2);   //工时货款
                labGsslS.Text       = CommonCtrl.IsNullToString(dr["man_hour_tax_rate"]);                                   //工时税率
                labGsseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_tax_cost"]), 2);    //工时税额
                labGssjhjS.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_sum"]), 2);         //工时价税合计
                labPjhkS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_sum_money"]), 2);    //配件货款
                labPjslS.Text       = CommonCtrl.IsNullToString(dr["fitting_tax_rate"]);                                    //配件税率
                labPjseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_tax_cost"]), 2);     //配件税额
                labPjsjhjS.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_sum"]), 2);          //配件价税合计
                labQtflS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_sum_money"]), 2); //其他项目费用
                labQtslS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_tax_rate"]), 2);  //其他项目税率
                labQtseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_tax_cost"]), 2);  //其他项目税额
                labQthjS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_sum"]), 2);       //其他项目价税合计
                labYH.Text          = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["privilege_cost"]), 2);       //优惠费用
                labShould.Text      = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["should_sum"]), 2);           //应收总额
                labReceive.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["received_sum"]), 2);         //实收总额
                labDebt.Text        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["debt_cost"]), 2);            //欠款金额
                labInvoiceType.Text = GetDicName(CommonCtrl.IsNullToString(dr["make_invoice_type"]));                       //开票类型
                labPayment.Text     = GetPaymentName(CommonCtrl.IsNullToString(dr["payment_terms"]));                       //结算方式
                labSetAccount.Text  = GetSetName(CommonCtrl.IsNullToString(dr["settlement_account"]));                      //结算账户
                labSetCompany.Text  = GetComName(CommonCtrl.IsNullToString(dr["settle_company"]));                          //结算单位
                string strStartTime = CommonCtrl.IsNullToString(dr["depart_time"]);                                         //出发时间
                if (!string.IsNullOrEmpty(strStartTime))
                {
                    labStartTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strStartTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labStartTimeS.Text = string.Empty;
                }
                string strEndTime = CommonCtrl.IsNullToString(dr["arrive_time"]);//到达时间
                if (!string.IsNullOrEmpty(strEndTime))
                {
                    labEndTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strEndTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labEndTimeS.Text = string.Empty;
                }
                string strReturnTime = CommonCtrl.IsNullToString(dr["back_time"]);//返回时间
                if (!string.IsNullOrEmpty(strReturnTime))
                {
                    labReturnTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReturnTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labReturnTimeS.Text = string.Empty;
                }

                labDefaultDescS.Text = CommonCtrl.IsNullToString(dr["fault_describe"]); //故障描述
                labRemarkS.Text      = CommonCtrl.IsNullToString(dr["remarks"]);        //备注
                #endregion

                #endregion

                #region 底部datagridview数据

                #region 维修项目数据
                //维修项目数据
                decimal   dcPmoney = 0;
                DataTable dpt      = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");;
                if (dpt.Rows.Count > 0)
                {
                    if (dpt.Rows.Count > dgvproject.Rows.Count)
                    {
                        dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1);
                    }
                    for (int i = 0; i < dpt.Rows.Count; i++)
                    {
                        DataRow dpr = dpt.Rows[i];
                        dgvproject.Rows[i].Cells["item_id"].Value                 = CommonCtrl.IsNullToString(dpr["item_id"]);
                        dgvproject.Rows[i].Cells["three_warranty"].Value          = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否";
                        dgvproject.Rows[i].Cells["man_hour_type"].Value           = CommonCtrl.IsNullToString(dpr["man_hour_type"]);
                        dgvproject.Rows[i].Cells["item_no"].Value                 = CommonCtrl.IsNullToString(dpr["item_no"]);
                        dgvproject.Rows[i].Cells["item_name"].Value               = CommonCtrl.IsNullToString(dpr["item_name"]);
                        dgvproject.Rows[i].Cells["item_type"].Value               = CommonCtrl.IsNullToString(dpr["item_type"]);
                        dgvproject.Rows[i].Cells["man_hour_quantity"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_quantity"]), 1);
                        dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]), 2);
                        dgvproject.Rows[i].Cells["remarks"].Value                 = CommonCtrl.IsNullToString(dpr["remarks"]);
                        dgvproject.Rows[i].Cells["sum_money_goods"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["sum_money_goods"]), 2);
                        dgvproject.Rows[i].Cells["member_discount"].Value         = CommonCtrl.IsNullToString(dpr["member_discount"]);
                        dgvproject.Rows[i].Cells["member_price"].Value            = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_price"]), 2);
                        dgvproject.Rows[i].Cells["member_sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_sum_money"]), 2);
                    }
                    foreach (DataGridViewRow dgvr in dgvproject.Rows)
                    {
                        dcPmoney += Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money_goods"].Value)) ? dgvr.Cells["sum_money_goods"].Value : 0);
                    }
                }
                #endregion

                #region 维修用料数据
                //维修用料数据
                decimal   dcMmoney = 0;
                DataTable dmt      = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", "");
                if (dmt.Rows.Count > 0)
                {
                    if (dmt.Rows.Count > dgvMaterials.Rows.Count)
                    {
                        dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1);
                    }
                    for (int i = 0; i < dmt.Rows.Count; i++)
                    {
                        DataRow dmr = dmt.Rows[i];
                        dgvMaterials.Rows[i].Cells["material_id"].Value      = CommonCtrl.IsNullToString(dmr["material_id"]);
                        dgvMaterials.Rows[i].Cells["parts_code"].Value       = CommonCtrl.IsNullToString(dmr["parts_code"]);
                        dgvMaterials.Rows[i].Cells["parts_name"].Value       = CommonCtrl.IsNullToString(dmr["parts_name"]);
                        dgvMaterials.Rows[i].Cells["norms"].Value            = CommonCtrl.IsNullToString(dmr["norms"]);
                        dgvMaterials.Rows[i].Cells["unit"].Value             = CommonCtrl.IsNullToString(dmr["unit"]);
                        dgvMaterials.Rows[i].Cells["quantity"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["quantity"]), 1);
                        dgvMaterials.Rows[i].Cells["unit_price"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["unit_price"]), 2);
                        dgvMaterials.Rows[i].Cells["Mmember_discount"].Value = CommonCtrl.IsNullToString(dmr["member_discount"]);
                        dgvMaterials.Rows[i].Cells["Mmember_price"].Value    = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["member_price"]), 2);
                        dgvMaterials.Rows[i].Cells["sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["sum_money"]), 2);
                        dgvMaterials.Rows[i].Cells["drawn_no"].Value         = CommonCtrl.IsNullToString(dmr["drawn_no"]);
                        dgvMaterials.Rows[i].Cells["vehicle_brand"].Value    = CommonCtrl.IsNullToString(dmr["vehicle_brand"]);
                        dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value  = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否";
                        dgvMaterials.Rows[i].Cells["Mremarks"].Value         = CommonCtrl.IsNullToString(dmr["remarks"]);
                        dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否";
                    }
                    foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                    {
                        dcMmoney += Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money"].Value)) ? dgvr.Cells["sum_money"].Value : 0);
                    }
                }
                #endregion

                #region 其他项目收费数据
                //其他项目收费数据
                DataTable dot = DBHelper.GetTable("其他项目收费数据", "tb_maintain_other_toll", "*", string.Format(" maintain_id='{0}'", strRId), "", "");
                if (dot.Rows.Count > 0)
                {
                    if (dot.Rows.Count > dgvOther.Rows.Count)
                    {
                        dgvOther.Rows.Add(dot.Rows.Count - dgvOther.Rows.Count + 1);
                    }
                    for (int i = 0; i < dot.Rows.Count; i++)
                    {
                        DataRow dor = dot.Rows[i];
                        dgvOther.Rows[i].Cells["toll_id"].Value    = CommonCtrl.IsNullToString(dor["toll_id"]);
                        dgvOther.Rows[i].Cells["Osum_money"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dor["sum_money"]), 2);
                        dgvOther.Rows[i].Cells["Oremarks"].Value   = CommonCtrl.IsNullToString(dor["remarks"]);
                        dgvOther.Rows[i].Cells["cost_types"].Value = GetDicName(CommonCtrl.IsNullToString(dor["cost_types"]));
                    }
                }

                #endregion

                #region 救援人员信息
                DataTable drpt = DBHelper.GetTable("救援人员数据", "tb_maintain_rescue_worker", "*", string.Format(" maintain_id='{0}'", strRId), "", "");
                if (drpt.Rows.Count > 0)
                {
                    dgvRescuePerson.DataSource = drpt;
                }
                #endregion

                #region 附件信息数据
                //附件信息数据
                ucAttr.TableName         = "tb_maintain_rescue_info";
                ucAttr.TableNameKeyValue = strRId;
                ucAttr.BindAttachment();
                #endregion
                #endregion
            }
            else
            {
                #region 没有数据时全部显示为空
                labMaintain_noS.Text  = string.Empty;
                labAttnS.Text         = string.Empty;
                labCarBrandS.Text     = string.Empty;
                labCarNOS.Text        = string.Empty;
                labCarTypeS.Text      = string.Empty;
                labContactPhoneS.Text = string.Empty;
                labContactS.Text      = string.Empty;
                labCreatePersonS.Text = string.Empty;
                labCreateTimeS.Text   = string.Empty;
                labCustomNameS.Text   = string.Empty;
                labCustomNOS.Text     = string.Empty;
                labDepartS.Text       = string.Empty;
                labDriverPhoneS.Text  = string.Empty;
                labDriverS.Text       = string.Empty;
                labEngineNoS.Text     = string.Empty;
                labFinallyPerS.Text   = string.Empty;
                labFinallyTimeS.Text  = string.Empty;
                labStatusS.Text       = string.Empty;
                labVINS.Text          = string.Empty;
                labRescueTypeS.Text   = string.Empty;
                labServerCarNoS.Text  = string.Empty;
                labStartTimeS.Text    = string.Empty;
                labEndTimeS.Text      = string.Empty;
                labReturnTimeS.Text   = string.Empty;
                labMilsS.Text         = string.Empty;
                labRescuPlaceS.Text   = string.Empty;
                labInvoiceType.Text   = string.Empty;
                labSetAccount.Text    = string.Empty;
                labSetCompany.Text    = string.Empty;
                labDefaultDescS.Text  = string.Empty;
                labRemarkS.Text       = string.Empty;
                #endregion
            }
        }