Пример #1
0
 private void dgvproject_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     frmWorkHours frmHours = new frmWorkHours();
     DialogResult result = frmHours.ShowDialog();
     if (result == DialogResult.OK)
     {
         dgvproject.Rows[e.RowIndex].Cells["item_no"].Value = frmHours.strProjectNum;
         dgvproject.Rows[e.RowIndex].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
         dgvproject.Rows[e.RowIndex].Cells["item_name"].Value = frmHours.strProjectName;
         dgvproject.Rows[e.RowIndex].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
         dgvproject.Rows[e.RowIndex].Cells["remarks"].Value = frmHours.strRemark;
         dgvproject.Rows[e.RowIndex].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
         string strPzk = !string.IsNullOrEmpty(txtMemberPZk.Caption) ? txtMemberPZk.Caption : "10";
         //会员折扣
         dgvproject.Rows[e.RowIndex].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
         //会员工时费
         dgvproject.Rows[e.RowIndex].Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice)?frmHours.strQuotaPrice:"0") * (Convert.ToDecimal(strPzk) / 10));
         if (CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value) != "0")
         {
             //折扣额
             dgvproject.Rows[e.RowIndex].Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice)?frmHours.strQuotaPrice:"0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value) : "0"));
         }
         else
         {
             dgvproject.Rows[e.RowIndex].Cells["member_sum_money"].Value = "0";
         }
         //if (frmHours.strWhoursType == "2")//定额
         //{
         //    dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].Value = "";
         //    //dgvproject.Columns["man_hour_quantity"].ReadOnly = true;
         //    if (dgvproject.Rows[e.RowIndex].Cells["member_price"].Value.ToString() != "0")
         //    {
         //        dgvproject.Rows[e.RowIndex].Cells["sum_money_goods"].Value = Convert.ToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value.ToString());
         //    }
         //    else
         //    {
         //        dgvproject.Rows[e.RowIndex].Cells["sum_money_goods"].Value = Convert.ToString(dgvproject.Rows[e.RowIndex].Cells["man_hour_norm_unitprice"].Value.ToString());
         //    }
         //}
         //else
         //{
         //    //工时
         //    dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
         //    //dgvproject.Columns["man_hour_quantity"].ReadOnly = false;
         //    if (dgvproject.Rows[e.RowIndex].Cells["member_price"].Value.ToString() != "0")
         //    {
         //        dgvproject.Rows[e.RowIndex].Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(frmHours.strWhoursNum) * Convert.ToDecimal(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value.ToString()));
         //    }
         //    else
         //    {
         //        dgvproject.Rows[e.RowIndex].Cells["sum_money_goods"].Value = dgvproject.Rows[e.RowIndex].Cells["man_hour_norm_unitprice"].Value;
         //    }
         //}
         dgvproject.Rows[e.RowIndex].Cells["OldItem_id"].Value = frmHours.strWhours_id;
         dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
         dgvproject.Rows[e.RowIndex].Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum)?frmHours.strWhoursNum:"0") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value) : "0"));
         dgvproject.Rows.Add(1);
     }
 }
        private void tsmadd_Click(object sender, EventArgs e)
        {
            if (tabControlEx1.SelectedIndex == 0)
            {
                //特殊维修项目
                frmWorkHours fm = new frmWorkHours();
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    int rowindex = dgvprojrct.Rows.Add();
                    DataGridViewRow gvr = dgvprojrct.Rows[rowindex];
                    gvr.Cells["project_num"].Value = fm.strProjectNum;
                    gvr.Cells["project_name"].Value = fm.strProjectName;
                    gvr.Cells["quota_price"].Value = fm.strQuotaPrice;
                    gvr.Cells["service_project_id"].Value = fm.strWhours_id;
                    gvr.Cells["project_service_project_discount"].Value = "";
                    gvr.Cells["project_discount_price"].Value = "";
                    gvr.Cells["project_remark"].Value = "";
                    gvr.Cells["setInfo_projrct_id"].Value = "";
                }
            }
            else
            {
                //特殊配件
                frmParts fm = new frmParts();
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    DataGridViewRow gvr = dgvparts.Rows[dgvparts.Rows.Add()];
                    gvr.Cells["ser_parts_code"].Value = fm.PartsCode;
                    gvr.Cells["parts_name"].Value = fm.PartsName;
                    gvr.Cells["ref_out_price"].Value = fm.ref_out_price;
                    gvr.Cells["parts_id"].Value = fm.PartsID;

                    gvr.Cells["parts_discount"].Value = "";
                    gvr.Cells["discount_price"].Value = "";
                    gvr.Cells["remark"].Value = "";
                    gvr.Cells["setInfo_parts_id"].Value = "";
                }
            }
        }
        private void dgvproject_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {

            frmWorkHours frmHours = new frmWorkHours();
            DialogResult result = frmHours.ShowDialog();
            if (result == DialogResult.OK)
            {
                dcPmoney = 0;
                dgvproject.Rows[e.RowIndex].Cells["colCheck"].Value = true;
                dgvproject.Rows[e.RowIndex].Cells["item_no"].Value = frmHours.strProjectNum;
                dgvproject.Rows[e.RowIndex].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                dgvproject.Rows[e.RowIndex].Cells["item_name"].Value = frmHours.strProjectName;
                dgvproject.Rows[e.RowIndex].Cells["remarks"].Value = frmHours.strRemark;
                dgvproject.Rows[e.RowIndex].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "10";
                //工时单价
                dgvproject.Rows[e.RowIndex].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
                //会员折扣
                dgvproject.Rows[e.RowIndex].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
                //会员工时费
                dgvproject.Rows[e.RowIndex].Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") * (Convert.ToDecimal(strPzk) / 10));
                if (CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value) != "0")
                {
                    //折扣额
                    dgvproject.Rows[e.RowIndex].Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value) : "0"));
                }
                else
                {
                    dgvproject.Rows[e.RowIndex].Cells["member_sum_money"].Value = "0";
                }
                dgvproject.Rows[e.RowIndex].Cells["OldItem_id"].Value = frmHours.strWhours_id;
                dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
                dgvproject.Rows[e.RowIndex].Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value) : "0"));
                dcPmoney = 0;
                foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                {
                    if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money"].Value)))
                    {
                        dcPmoney += Convert.ToDecimal(dgvr.Cells["sum_money"].Value);
                    }
                }
                txtHSumMoney.Caption = dcHmoney.ToString();//工时货款
                txtHTaxCost.Caption = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(txtHSumMoney.Caption.Trim()) ? txtHSumMoney.Caption.Trim() : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(txtHTaxRate.Caption.Trim()) ? txtHTaxRate.Caption.Trim() : "0"));//工时税额
                txtHSum.Caption = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(txtHSumMoney.Caption.Trim()) ? txtHSumMoney.Caption.Trim() : "0") + Convert.ToDecimal(!string.IsNullOrEmpty(txtHTaxCost.Caption.Trim()) ? txtHTaxCost.Caption.Trim() : "0"));//工时价税合计
                txtShouldSum.Caption = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(txtHSum.Caption.Trim()) ? txtHSum.Caption.Trim() : "0") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFSum.Caption.Trim()) ? txtFSum.Caption.Trim() : "0") + Convert.ToDecimal(!string.IsNullOrEmpty(txtOSum.Caption.Trim()) ? txtOSum.Caption.Trim() : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(txtPrivilegeCost.Caption.Trim()) ? txtPrivilegeCost.Caption.Trim() : "0"));//应收总额
                dgvproject.Rows.Add(1);
            }
        }
 private void editProject_Click(object sender, EventArgs e)
 {
     try
     {
         int intCurrentIndex = dgvproject.CurrentRow.Index;
         if (intCurrentIndex >= 0)
         {
             string strItemNo = CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["item_no"].Value);
             if (!string.IsNullOrEmpty(strItemNo))
             {
                 frmWorkHours frmHours = new frmWorkHours();
                 DialogResult result = frmHours.ShowDialog();
                 if (result == DialogResult.OK)
                 {
                     if (listProject.Contains(frmHours.strProjectNum) && frmHours.strWhoursType != "1")
                     {
                         MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         return;
                     }
                     dgvproject.Rows[intCurrentIndex].Cells["item_no"].Value = frmHours.strProjectNum;
                     dgvproject.Rows[intCurrentIndex].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                     dgvproject.Rows[intCurrentIndex].Cells["item_name"].Value = frmHours.strProjectName;
                     dgvproject.Rows[intCurrentIndex].Cells["man_hour_norm_unitprice"].Value = Math.Round((Convert.ToDecimal(frmHours.strQuotaPrice)), 2).ToString("0.00");
                     dgvproject.Rows[intCurrentIndex].Cells["remarks"].Value = frmHours.strRemark;
                     dgvproject.Rows[intCurrentIndex].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                     dgvproject.Rows[intCurrentIndex].Cells["man_hour_norm_unitprice"].ReadOnly = CommonCtrl.IsNullToString(frmHours.strWhoursType) == "1" ? true : false;
                     string strPzk = !string.IsNullOrEmpty(labMemberPZkS.Text) ? labMemberPZkS.Text.Replace("%", "") : "100";
                     #region 验证是否存在特殊项目
                     string strPdic = DBHelper.GetSingleValue("获取特殊项目折扣", "tb_CustomerSer_member_setInfo_projrct", "service_project_discount", "setInfo_id='" + strSetInfoid + "' and service_project_id='" + frmHours.strWhours_id + "' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", "");
                     if (!string.IsNullOrEmpty(strPdic))
                     {
                         strPzk = strPdic;
                     }
                     #endregion
                     //会员折扣
                     dgvproject.Rows[intCurrentIndex].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk));
                     //会员工时费
                     dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0.00") * (Convert.ToDecimal(strPzk) / 100)), 2).ToString("0.00");
                     if (CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value) != "0.00")
                     {
                         //折扣额
                         dgvproject.Rows[intCurrentIndex].Cells["member_sum_money"].Value = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0.00") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value) : "0.00")), 2).ToString("0.00");
                     }
                     else
                     {
                         dgvproject.Rows[intCurrentIndex].Cells["member_sum_money"].Value = "0.00";
                     }
                     dgvproject.Rows[intCurrentIndex].Cells["whours_id"].Value = frmHours.strWhours_id;
                     dgvproject.Rows[intCurrentIndex].Cells["man_hour_quantity"].Value = Math.Round((Convert.ToDecimal(frmHours.strWhoursNum)), 1).ToString("0.0");
                     dgvproject.Rows[intCurrentIndex].Cells["sum_money_goods"].Value = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0.00") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value) : "0.00")), 2).ToString("0.00");
                     dgvproject.Rows[intCurrentIndex].Cells["three_warranty"].Value = "否";
                     dgvproject.Rows[intCurrentIndex].Cells["data_source"].Value = frmHours.strData_source;
                     dgvproject.Rows[intCurrentIndex].Cells["three_warranty"].ReadOnly = frmHours.strData_source == Convert.ToInt32(DataSources.EnumDataSources.SELFBUILD).ToString() ? true : false;
                     dcHmoney = 0;
                     foreach (DataGridViewRow dgvr in dgvproject.Rows)
                     {
                         if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money_goods"].Value)))
                         {
                             dcHmoney += Convert.ToDecimal(dgvr.Cells["sum_money_goods"].Value);
                         }
                     }
                     txtHSumMoney.Caption = Math.Round(dcHmoney, 2).ToString("0.00");//工时货款
                     txtHTaxCost.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSumMoney.Caption.Trim()) ? txtHSumMoney.Caption.Trim() : "0.00") * Convert.ToDecimal(!string.IsNullOrEmpty(txtHTaxRate.Caption.Trim()) ? txtHTaxRate.Caption.Trim() : "0.00") / 100), 2).ToString("0.00");//工时税额
                     txtHSum.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSumMoney.Caption.Trim()) ? txtHSumMoney.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtHTaxCost.Caption.Trim()) ? txtHTaxCost.Caption.Trim() : "0.00")), 2).ToString("0.00");//工时价税合计
                     txtShouldSum.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSum.Caption.Trim()) ? txtHSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFSum.Caption.Trim()) ? txtFSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtOSum.Caption.Trim()) ? txtOSum.Caption.Trim() : "0")), 2).ToString("0.00");//应收总额
                     strShouldSum = Math.Round(Convert.ToDecimal(txtShouldSum.Caption), 2).ToString("0.00");
                     txtReceivedSum.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSum.Caption.Trim()) ? txtHSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFSum.Caption.Trim()) ? txtFSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtOSum.Caption.Trim()) ? txtOSum.Caption.Trim() : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(txtPrivilegeCost.Caption.Trim()) ? txtPrivilegeCost.Caption.Trim() : "0.00")), 2).ToString("0.00");//实收总额
                     listProject.Remove(strItemNo);
                     foreach (DataGridViewRow dgvr in dgvproject.Rows)
                     {
                         string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
                         if (!string.IsNullOrEmpty(strPCode) && !listProject.Contains(strPCode))
                         {
                             listProject.Add(strPCode);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
Пример #5
0
 private void editProject_Click(object sender, EventArgs e)
 {
      try
     {
         if (strProjectSattus != "3" && strProjectSattus != "5")
         {
             int intCurrentIndex = dgvproject.CurrentRow.Index;
             if (intCurrentIndex >= 0)
             {
                 string strItemNo = CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["item_no"].Value);
                 if (!string.IsNullOrEmpty(strItemNo))
                 {
                     frmWorkHours frmHours = new frmWorkHours();
                     DialogResult result = frmHours.ShowDialog();
                     if (result == DialogResult.OK)
                     {
                         if (listProject.Contains(frmHours.strProjectNum) && frmHours.strWhoursType != "1")
                         {
                             MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                             return;
                         }
                         dgvproject.Rows[intCurrentIndex].Cells["colCheck"].Value = true;
                         dgvproject.Rows[intCurrentIndex].Cells["item_no"].Value = frmHours.strProjectNum;
                         dgvproject.Rows[intCurrentIndex].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                         dgvproject.Rows[intCurrentIndex].Cells["item_name"].Value = frmHours.strProjectName;
                         dgvproject.Rows[intCurrentIndex].Cells["remarks"].Value = frmHours.strRemark;
                         dgvproject.Rows[intCurrentIndex].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                         dgvproject.Rows[intCurrentIndex].Cells["man_hour_norm_unitprice"].ReadOnly = CommonCtrl.IsNullToString(frmHours.strWhoursType) == "1" ? true : false;
                         dgvproject.Rows[intCurrentIndex].Cells["item_id"].Value = "NewId";
                         string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "100";
                         #region 验证是否存在特殊项目
                         string strPdic = DBHelper.GetSingleValue("获取特殊项目折扣", "tb_CustomerSer_member_setInfo_projrct", "service_project_discount", "setInfo_id='" + strSetInfoid + "' and service_project_id='" + frmHours.strWhours_id + "' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", "");
                         if (!string.IsNullOrEmpty(strPdic))
                         {
                             strPzk = strPdic;
                         }
                         #endregion
                         //工时单价
                         dgvproject.Rows[intCurrentIndex].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
                         //会员折扣
                         dgvproject.Rows[intCurrentIndex].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk));
                         //会员工时费
                         dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") * (Convert.ToDecimal(strPzk) / 100));
                         if (dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value.ToString() != "0")
                         {
                             //折扣额
                             dgvproject.Rows[intCurrentIndex].Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value) : "0"));
                         }
                         else
                         {
                             dgvproject.Rows[intCurrentIndex].Cells["member_sum_money"].Value = "0";
                         }
                         dgvproject.Rows[intCurrentIndex].Cells["whours_id"].Value = frmHours.strWhours_id;
                         dgvproject.Rows[intCurrentIndex].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
                         dgvproject.Rows[intCurrentIndex].Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["member_price"].Value) : "0"));
                         //新添加数据维修进度设置为未分配工时
                         dgvproject.Rows[intCurrentIndex].Cells["repair_progress"].Value = DataSources.GetDescription(typeof(DataSources.EnumProjectDisStatus), Convert.ToInt64(DataSources.EnumProjectDisStatus.NotStartWork));//项目状态 CommonCtrl.IsNullToString(dpr["repair_progress"]);                       
                         dgvproject.Rows[intCurrentIndex].Cells["three_warranty"].Value = "否";
                         dgvproject.Rows[intCurrentIndex].Cells["data_source"].Value = frmHours.strData_source;
                         dgvproject.Rows[intCurrentIndex].Cells["three_warranty"].ReadOnly = frmHours.strData_source == Convert.ToInt32(DataSources.EnumDataSources.SELFBUILD).ToString() ? true : false;
                         listProject.Remove(strItemNo);
                         foreach (DataGridViewRow dgvr in dgvproject.Rows)
                         {
                             string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
                             if (!string.IsNullOrEmpty(strPCode) && !listProject.Contains(strPCode))
                             {
                                 listProject.Add(strPCode);
                             }
                         }
                     }
                 }
             }
         }
     }
      catch (Exception ex)
      {
          HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
      }
 }
Пример #6
0
 private void dgvproject_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (strProjectSattus != "3" && strProjectSattus != "6")
         {
             int intProws = e.RowIndex;//当前行的索引
             frmWorkHours frmHours = new frmWorkHours();
             DialogResult result = frmHours.ShowDialog();
             if (result == DialogResult.OK)
             {
                 if (listProject.Contains(frmHours.strProjectNum))
                 {
                     MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     return;
                 }
                 for (int i = 0; i <= intProws; i++)
                 {
                     if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["item_no"].Value)))
                     {
                         dgvproject.Rows[i].Cells["colCheck"].Value = true;
                         dgvproject.Rows[i].Cells["item_no"].Value = frmHours.strProjectNum;
                         dgvproject.Rows[i].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                         dgvproject.Rows[i].Cells["item_name"].Value = frmHours.strProjectName;
                         dgvproject.Rows[i].Cells["remarks"].Value = frmHours.strRemark;
                         dgvproject.Rows[i].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                         dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].ReadOnly = CommonCtrl.IsNullToString(frmHours.strWhoursType) == "1" ? true : false;
                         dgvproject.Rows[i].Cells["item_id"].Value = "NewId";
                         string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "10";
                         //工时单价
                         dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
                         //会员折扣
                         dgvproject.Rows[i].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
                         //会员工时费
                         dgvproject.Rows[i].Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") * (Convert.ToDecimal(strPzk) / 10));
                         if (CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) != "0")
                         {
                             //折扣额
                             dgvproject.Rows[i].Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) : "0"));
                         }
                         else
                         {
                             dgvproject.Rows[i].Cells["member_sum_money"].Value = "0";
                         }
                         dgvproject.Rows[i].Cells["whours_id"].Value = frmHours.strWhours_id;
                         dgvproject.Rows[i].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
                         dgvproject.Rows[i].Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) : "0"));
                         //新添加数据维修进度设置为未分配工时
                         dgvproject.Rows[i].Cells["repair_progress"].Value = DataSources.GetDescription(typeof(DataSources.EnumProjectDisStatus), Convert.ToInt64(DataSources.EnumProjectDisStatus.NotStartWork));//项目状态 CommonCtrl.IsNullToString(dpr["repair_progress"]);                       
                         dgvproject.Rows[i].Cells["three_warranty"].Value = "否";
                         dgvproject.Rows.Add(1);
                         break;
                     }
                 }
             }
             foreach (DataGridViewRow dgvr in dgvproject.Rows)
             {
                 string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
                 if (!string.IsNullOrEmpty(strPCode) && !listProject.Contains(strPCode))
                 {
                     listProject.Add(strPCode);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
 private void addProject_Click(object sender, EventArgs e)
 {
     frmWorkHours frmHours = new frmWorkHours();
     DialogResult result = frmHours.ShowDialog();
     if (result == DialogResult.OK)
     {
         dgvproject.CurrentRow.Cells["project_num"].Value = frmHours.strProjectNum;
         dgvproject.CurrentRow.Cells["repair_type"].Value = GetDicName(frmHours.strRepairType);
         dgvproject.CurrentRow.Cells["project_name"].Value = frmHours.strProjectName;
         dgvproject.CurrentRow.Cells["whours_price"].Value = frmHours.strQuotaPrice;
         dgvproject.CurrentRow.Cells["remark"].Value = frmHours.strRemark;
         dgvproject.CurrentRow.Cells["whours_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
         dgvproject.Rows.Add(1);
         listProject.Add(frmHours.strProjectNum);
     }
 }
        private void dgvproject_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                int intProws = e.RowIndex;//当前行的索引               
                frmWorkHours frmHours = new frmWorkHours();
                DialogResult result = frmHours.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (listProject.Contains(frmHours.strProjectNum))
                    {
                        MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    for (int i = 0; i <= intProws; i++)
                    {
                        if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["item_no"].Value)))
                        {
                            dgvproject.Rows[i].Cells["item_no"].Value = frmHours.strProjectNum;
                            dgvproject.Rows[i].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                            dgvproject.Rows[i].Cells["item_name"].Value = frmHours.strProjectName;
                            dgvproject.Rows[i].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                            dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].ReadOnly = CommonCtrl.IsNullToString(frmHours.strWhoursType) == "1" ? true : false;
                            dgvproject.Rows[i].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
                            dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value =frmHours.strQuotaPrice;
                            dgvproject.Rows[i].Cells["remarks"].Value = frmHours.strRemark;
                            dgvproject.Rows[i].Cells["whours_id"].Value = frmHours.strWhours_id;
                            dgvproject.Rows[i].Cells["sum_money"].Value =(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0.00"));
                            dgvproject.Rows[i].Cells["three_warranty"].Value = "否";
                            dgvproject.Rows.Add(1);
                            break;
                        }
                    }

                }
                foreach (DataGridViewRow dgvr in dgvproject.Rows)
                {
                    string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
                    if (!string.IsNullOrEmpty(strPCode) && !listProject.Contains(strPCode))
                    {
                        listProject.Add(strPCode);
                    }
                }
            }
            catch (Exception ex)
            {
                HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
            }
        }
        private void dgvproject_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
           
            frmWorkHours frmHours = new frmWorkHours();
            DialogResult result = frmHours.ShowDialog();
            NewMethod(frmHours, result);
            //if (result == DialogResult.OK)
            //{
            //    dgvproject.Rows[e.RowIndex].Cells["project_num"].Value = frmHours.strProjectNum;
            //    dgvproject.Rows[e.RowIndex].Cells["repair_type"].Value = GetDicName(frmHours.strRepairType);
            //    dgvproject.Rows[e.RowIndex].Cells["project_name"].Value = frmHours.strProjectName;
            //    dgvproject.Rows[e.RowIndex].Cells["whours_price"].Value = frmHours.strQuotaPrice;
            //    dgvproject.Rows[e.RowIndex].Cells["remark"].Value = frmHours.strRemark;
            //    dgvproject.Rows[e.RowIndex].Cells["whours_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
            //    dgvproject.Rows.Add(1);
            //    listProject.Add(frmHours.strProjectNum);
            //}

        }
 private void addProject_Click(object sender, EventArgs e)
 {
     frmWorkHours frmHours = new frmWorkHours();
     DialogResult result = frmHours.ShowDialog();
     NewMethod(frmHours, result);
 }
 private void dgvproject_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int intProws = e.RowIndex;//当前行的索引
         frmWorkHours frmHours = new frmWorkHours();
         DialogResult result = frmHours.ShowDialog();
         if (result == DialogResult.OK)
         {
             if (listProject.Contains(frmHours.strProjectNum))
             {
                 MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             dcPmoney = 0;
             for (int i = 0; i <= intProws; i++)
             {
                 if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["item_no"].Value)))
                 {
                     dgvproject.Rows[i].Cells["colCheck"].Value = true;
                     dgvproject.Rows[i].Cells["item_no"].Value = frmHours.strProjectNum;
                     dgvproject.Rows[i].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                     dgvproject.Rows[i].Cells["item_name"].Value = frmHours.strProjectName;
                     dgvproject.Rows[i].Cells["remarks"].Value = frmHours.strRemark;
                     dgvproject.Rows[i].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                     dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].ReadOnly = CommonCtrl.IsNullToString(frmHours.strWhoursType) == "1" ? true : false;
                     string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "10";
                     //工时单价
                     dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = Math.Round((Convert.ToDecimal(frmHours.strQuotaPrice)), 2).ToString("0.00");
                     //会员折扣
                     dgvproject.Rows[i].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
                     //会员工时费
                     dgvproject.Rows[i].Cells["member_price"].Value = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0.00") * (Convert.ToDecimal(strPzk) / 10)), 2).ToString("0.00");
                     if (CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) != "0.00")
                     {
                         //折扣额
                         dgvproject.Rows[i].Cells["member_sum_money"].Value = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0.00") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) : "0.00")), 2).ToString("0.00");
                     }
                     else
                     {
                         dgvproject.Rows[i].Cells["member_sum_money"].Value = "0.00";
                     }
                     dgvproject.Rows[i].Cells["whours_id"].Value = frmHours.strWhours_id;
                     dgvproject.Rows[i].Cells["man_hour_quantity"].Value = Math.Round((Convert.ToDecimal(frmHours.strWhoursNum)), 1).ToString("0.0");
                     dgvproject.Rows[i].Cells["sum_money_goods"].Value = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0.00") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) : "0.00")), 2).ToString("0.00");
                     dgvproject.Rows[i].Cells["three_warranty"].Value = "否";
                     dcPmoney = 0;
                     foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                     {
                         if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money"].Value)))
                         {
                             dcPmoney += Convert.ToDecimal(dgvr.Cells["sum_money"].Value);
                         }
                     }
                     txtHSumMoney.Caption = Math.Round(dcHmoney, 2).ToString("0.00");//工时货款
                     txtHTaxCost.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSumMoney.Caption.Trim()) ? txtHSumMoney.Caption.Trim() : "0.00") * Convert.ToDecimal(!string.IsNullOrEmpty(txtHTaxRate.Caption.Trim()) ? txtHTaxRate.Caption.Trim() : "0.00") / 100), 2).ToString("0.00");//工时税额
                     txtHSum.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSumMoney.Caption.Trim()) ? txtHSumMoney.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtHTaxCost.Caption.Trim()) ? txtHTaxCost.Caption.Trim() : "0.00")), 2).ToString("0.00");//工时价税合计
                     txtShouldSum.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSum.Caption.Trim()) ? txtHSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFSum.Caption.Trim()) ? txtFSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtOSum.Caption.Trim()) ? txtOSum.Caption.Trim() : "0.00") - Convert.ToDecimal(!string.IsNullOrEmpty(txtPrivilegeCost.Caption.Trim()) ? txtPrivilegeCost.Caption.Trim() : "0.00")), 2).ToString("0.00");//应收总额
                     strShouldSum = txtShouldSum.Caption;
                     dgvproject.Rows.Add(1);
                     break;
                 }
             }
         }
         foreach (DataGridViewRow dgvr in dgvproject.Rows)
         {
             string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
             if (!string.IsNullOrEmpty(strPCode) && !listProject.Contains(strPCode))
             {
                 listProject.Add(strPCode);
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
        private void editProject_Click(object sender, EventArgs e)
        {
            try
            {
                int intCurrentIndex = dgvproject.CurrentRow.Index;
                if (intCurrentIndex >= 0)
                {
                    string strItemNo = CommonCtrl.IsNullToString(dgvproject.Rows[intCurrentIndex].Cells["item_no"].Value);
                    if (!string.IsNullOrEmpty(strItemNo))
                    {
                        frmWorkHours frmHours = new frmWorkHours();
                        DialogResult result = frmHours.ShowDialog();
                        if (result == DialogResult.OK)
                        {
                            if (listProject.Contains(frmHours.strProjectNum) && frmHours.strWhoursType != "1")
                            {
                                MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                            dgvproject.Rows[intCurrentIndex].Cells["item_no"].Value = frmHours.strProjectNum;
                            dgvproject.Rows[intCurrentIndex].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                            dgvproject.Rows[intCurrentIndex].Cells["item_name"].Value = frmHours.strProjectName;
                            dgvproject.Rows[intCurrentIndex].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                            dgvproject.Rows[intCurrentIndex].Cells["man_hour_norm_unitprice"].ReadOnly = CommonCtrl.IsNullToString(frmHours.strWhoursType) == "1" ? true : false;
                            dgvproject.Rows[intCurrentIndex].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
                            dgvproject.Rows[intCurrentIndex].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
                            dgvproject.Rows[intCurrentIndex].Cells["remarks"].Value = frmHours.strRemark;
                            dgvproject.Rows[intCurrentIndex].Cells["whours_id"].Value = frmHours.strWhours_id;
                            dgvproject.Rows[intCurrentIndex].Cells["sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0"));
                            dgvproject.Rows[intCurrentIndex].Cells["three_warranty"].Value = "否";
                            dgvproject.Rows[intCurrentIndex].Cells["data_source"].Value = frmHours.strData_source;
                            dgvproject.Rows[intCurrentIndex].Cells["data_source"].ReadOnly = frmHours.strData_source == Convert.ToInt32(DataSources.EnumDataSources.SELFBUILD).ToString() ? true : false;
                            listProject.Remove(strItemNo);
                        }
                        foreach (DataGridViewRow dgvr in dgvproject.Rows)
                        {
                            string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
                            if (!string.IsNullOrEmpty(strPCode) && !listProject.Contains(strPCode))
                            {
                                listProject.Add(strPCode);
                            }
                        }
                    }

                }
            }
            catch(Exception ex)
            {
                HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
            }
        }
Пример #13
0
 private void addProject_Click(object sender, EventArgs e)
 {
     if (strProjectSattus != "3" && strProjectSattus != "6")
     {
         foreach (DataGridViewRow dgvr in dgvproject.Rows)
         {
             string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
             if (!string.IsNullOrEmpty(strPCode))
             {
                 listProject.Add(strPCode);
             }
         }
         frmWorkHours frmHours = new frmWorkHours();
         DialogResult result = frmHours.ShowDialog();
         if (result == DialogResult.OK)
         {
             if (listProject.Contains(frmHours.strProjectNum))
             {
                 MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             dgvproject.CurrentRow.Cells["colCheck"].Value = true;
             dgvproject.CurrentRow.Cells["item_no"].Value = frmHours.strProjectNum;
             dgvproject.CurrentRow.Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
             dgvproject.CurrentRow.Cells["item_name"].Value = frmHours.strProjectName;
             dgvproject.CurrentRow.Cells["remarks"].Value = frmHours.strRemark;
             dgvproject.CurrentRow.Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
             dgvproject.CurrentRow.Cells["item_id"].Value = "NewId";
             string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "10";
             //工时单价
             dgvproject.CurrentRow.Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
             //会员折扣
             dgvproject.CurrentRow.Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
             //会员工时费
             dgvproject.CurrentRow.Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") * (Convert.ToDecimal(strPzk) / 10));
             if (dgvproject.CurrentRow.Cells["member_price"].Value.ToString() != "0")
             {
                 //折扣额
                 dgvproject.CurrentRow.Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value) : "0"));
             }
             else
             {
                 dgvproject.CurrentRow.Cells["member_sum_money"].Value = "0";
             }
             dgvproject.CurrentRow.Cells["OldItem_id"].Value = frmHours.strWhours_id;
             dgvproject.CurrentRow.Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
             dgvproject.CurrentRow.Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value) : "0"));
             //新添加数据维修进度设置为未派工
             dgvproject.CurrentRow.Cells["repair_progress"].Value = DataSources.GetDescription(typeof(DataSources.EnumProjectDisStatus), Convert.ToInt64(DataSources.EnumProjectDisStatus.NotWork));//项目状态 CommonCtrl.IsNullToString(dpr["repair_progress"]);                       
             dgvproject.Rows.Add(1);
         }
     }
 }
 private void dgvproject_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     frmWorkHours frmHours = new frmWorkHours();
     DialogResult result = frmHours.ShowDialog();
     if (result == DialogResult.OK)
     {
         dgvproject.Rows[e.RowIndex].Cells["item_no"].Value = frmHours.strProjectNum;
         dgvproject.Rows[e.RowIndex].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
         dgvproject.Rows[e.RowIndex].Cells["item_name"].Value = frmHours.strProjectName;
         dgvproject.Rows[e.RowIndex].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
         //if (frmHours.strWhoursType == "2")//定额
         //{
         //    dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].Value = "";
         //    //dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].ReadOnly = true;
         //}
         //else
         //{
         //    //工时
         //    dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
         //    //dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].ReadOnly = false;
         //}
         dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
         dgvproject.Rows[e.RowIndex].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
         dgvproject.Rows[e.RowIndex].Cells["remarks"].Value = frmHours.strRemark;
         dgvproject.Rows[e.RowIndex].Cells["OldItem_id"].Value = frmHours.strWhours_id;
         dgvproject.Rows[e.RowIndex].Cells["sum_money"].Value = Convert.ToString(Convert.ToDecimal(frmHours.strWhoursNum) * Convert.ToDecimal(frmHours.strQuotaPrice));
         dgvproject.Rows.Add(1);
     }
 }
        private void addProject_Click(object sender, EventArgs e)
        {
            try
            {
                int intProws = dgvproject.CurrentRow.Index;//当前行的索引
                frmWorkHours frmHours = new frmWorkHours();
                DialogResult result = frmHours.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (listProject.Contains(frmHours.strProjectNum))
                    {
                        MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    for (int i = 0; i <= intProws; i++)
                    {
                        if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["item_no"].Value)))
                        {
                            dgvproject.Rows[i].Cells["item_no"].Value = frmHours.strProjectNum;
                            dgvproject.Rows[i].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                            dgvproject.Rows[i].Cells["item_name"].Value = frmHours.strProjectName;
                            dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
                            dgvproject.Rows[i].Cells["remarks"].Value = frmHours.strRemark;
                            dgvproject.Rows[i].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                            dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].ReadOnly = CommonCtrl.IsNullToString(frmHours.strWhoursType) == "1" ? true : false;
                            string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "10";
                            //工时单价
                            dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
                            //会员折扣
                            dgvproject.Rows[i].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
                            //会员工时费
                            dgvproject.Rows[i].Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(frmHours.strQuotaPrice) * (Convert.ToDecimal(strPzk) / 10));
                            if (dgvproject.Rows[i].Cells["member_price"].Value.ToString() != "0")
                            {
                                //折扣额
                                dgvproject.Rows[i].Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(frmHours.strQuotaPrice) - Convert.ToDecimal(dgvproject.Rows[i].Cells["member_price"].Value));
                            }
                            else
                            {
                                dgvproject.Rows[i].Cells["member_sum_money"].Value = "0";
                            }
                            dgvproject.Rows[i].Cells["whours_id"].Value = frmHours.strWhours_id;
                            dgvproject.Rows[i].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
                            dgvproject.Rows[i].Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(frmHours.strWhoursNum) * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) : "0"));
                            dgvproject.Rows[i].Cells["three_warranty"].Value = "否";
                            dgvproject.Rows.Add(1);
                            break;
                        }
                    }
                }
                foreach (DataGridViewRow dgvr in dgvproject.Rows)
                {
                    string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
                    if (!string.IsNullOrEmpty(strPCode) && !listProject.Contains(strPCode))
                    {
                        listProject.Add(strPCode);
                    }
                }
            }
            catch (Exception ex)
            {
                HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);

            }
        }
Пример #16
0
 private void addProject_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow dgvr in dgvproject.Rows)
     {
         string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
         if (!string.IsNullOrEmpty(strPCode))
         {
             listProject.Add(strPCode);
         }
     }
     frmWorkHours frmHours = new frmWorkHours();
     DialogResult result = frmHours.ShowDialog();
     if (result == DialogResult.OK)
     {
         if (listProject.Contains(frmHours.strProjectNum))
         {
             MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         dgvproject.CurrentRow.Cells["item_no"].Value = frmHours.strProjectNum;
         dgvproject.CurrentRow.Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
         dgvproject.CurrentRow.Cells["item_name"].Value = frmHours.strProjectName;
         dgvproject.CurrentRow.Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
         dgvproject.CurrentRow.Cells["remarks"].Value = frmHours.strRemark;
         dgvproject.CurrentRow.Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
         string strPzk = !string.IsNullOrEmpty(txtMemberPZk.Caption) ? txtMemberPZk.Caption : "10";
         //会员折扣
         dgvproject.CurrentRow.Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
         //会员工时费
         dgvproject.CurrentRow.Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") * (Convert.ToDecimal(strPzk) / 10));
         if (CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value) != "0")
         {
             //折扣额
             dgvproject.CurrentRow.Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value) : "0"));
         }
         else
         {
             dgvproject.CurrentRow.Cells["member_sum_money"].Value = "0";
         }
         dgvproject.CurrentRow.Cells["OldItem_id"].Value = frmHours.strWhours_id;
         dgvproject.CurrentRow.Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
         dgvproject.CurrentRow.Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.CurrentRow.Cells["member_price"].Value) : "0"));
         dgvproject.Rows.Add(1);
     }
 }
Пример #17
0
 private void txtProjectCode_ChooserClick(object sender, EventArgs e)
 {
     frmWorkHours frmHours = new frmWorkHours();
     DialogResult result = frmHours.ShowDialog();
     if (result == DialogResult.OK)
     {
         txtProjectCode.Text = frmHours.strProjectNum;
         txtProjectName.Caption = frmHours.strProjectName;
         txtPRepairType.Caption = GetDicName(frmHours.strRepairType);
     }
 }
Пример #18
0
 private void dgvproject_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (strProjectSattus != "3" && strProjectSattus != "6")
     {
         frmWorkHours frmHours = new frmWorkHours();
         DialogResult result = frmHours.ShowDialog();
         if (result == DialogResult.OK)
         {
             dgvproject.Rows[e.RowIndex].Cells["colCheck"].Value = true;
             dgvproject.Rows[e.RowIndex].Cells["item_no"].Value = frmHours.strProjectNum;
             dgvproject.Rows[e.RowIndex].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
             dgvproject.Rows[e.RowIndex].Cells["item_name"].Value = frmHours.strProjectName;
             dgvproject.Rows[e.RowIndex].Cells["remarks"].Value = frmHours.strRemark;
             dgvproject.Rows[e.RowIndex].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
             dgvproject.Rows[e.RowIndex].Cells["item_id"].Value = "NewId";
             string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "10";
             //工时单价
             dgvproject.Rows[e.RowIndex].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
             //会员折扣
             dgvproject.Rows[e.RowIndex].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
             //会员工时费
             dgvproject.Rows[e.RowIndex].Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice)?frmHours.strQuotaPrice:"0") * (Convert.ToDecimal(strPzk) / 10));
             if (dgvproject.Rows[e.RowIndex].Cells["member_price"].Value.ToString() != "0")
             {
                 //折扣额
                 dgvproject.Rows[e.RowIndex].Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice)?frmHours.strQuotaPrice:"0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value) : "0"));
             }
             else
             {
                 dgvproject.Rows[e.RowIndex].Cells["member_sum_money"].Value = "0";
             }
             dgvproject.Rows[e.RowIndex].Cells["OldItem_id"].Value = frmHours.strWhours_id;
             dgvproject.Rows[e.RowIndex].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
             dgvproject.Rows[e.RowIndex].Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum)?frmHours.strWhoursNum:"0") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[e.RowIndex].Cells["member_price"].Value) : "0"));
             dgvproject.Rows.Add(1);
         }
     }
 }  
Пример #19
0
        private void addProject_Click(object sender, EventArgs e)
        {
            try
            {
                int intProws = dgvproject.CurrentRow.Index;//当前行的索引
                frmWorkHours frmHours = new frmWorkHours();
                DialogResult result = frmHours.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (listProject.Contains(frmHours.strProjectNum) && frmHours.strWhoursType != "1")
                    {
                        MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    for (int i = 0; i <= intProws; i++)
                    {
                        if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["item_no"].Value)))
                        {
                            dgvproject.Rows[i].Cells["item_no"].Value = frmHours.strProjectNum;
                            dgvproject.Rows[i].Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
                            dgvproject.Rows[i].Cells["item_name"].Value = frmHours.strProjectName;
                            dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
                            dgvproject.Rows[i].Cells["remarks"].Value = frmHours.strRemark;
                            dgvproject.Rows[i].Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
                            dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].ReadOnly = CommonCtrl.IsNullToString(frmHours.strWhoursType) == "1" ? true : false;
                            string strPzk = !string.IsNullOrEmpty(txtMemberPZk.Caption) ? txtMemberPZk.Caption : "100";
                            #region 验证是否存在特殊项目
                            string strPdic = DBHelper.GetSingleValue("获取特殊项目折扣", "tb_CustomerSer_member_setInfo_projrct", "service_project_discount", "setInfo_id='" + strSetInfoid + "' and service_project_id='" + frmHours.strWhours_id + "' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", "");
                            if (!string.IsNullOrEmpty(strPdic))
                            {
                                strPzk = strPdic;
                            }
                            #endregion
                            //会员折扣
                            dgvproject.Rows[i].Cells["member_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk));
                            //会员工时费
                            dgvproject.Rows[i].Cells["member_price"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") * (Convert.ToDecimal(strPzk) / 100));
                            if (CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) != "0")
                            {
                                //折扣额
                                dgvproject.Rows[i].Cells["member_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strQuotaPrice) ? frmHours.strQuotaPrice : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) : "0"));
                            }
                            else
                            {
                                dgvproject.Rows[i].Cells["member_sum_money"].Value = "0";
                            }
                            dgvproject.Rows[i].Cells["whours_id"].Value = frmHours.strWhours_id;
                            dgvproject.Rows[i].Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
                            dgvproject.Rows[i].Cells["sum_money_goods"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(frmHours.strWhoursNum) ? frmHours.strWhoursNum : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value)) ? CommonCtrl.IsNullToString(dgvproject.Rows[i].Cells["member_price"].Value) : "0"));
                            dgvproject.Rows[i].Cells["three_warranty"].Value = "否";
                            dgvproject.Rows[i].Cells["data_source"].Value = frmHours.strData_source;
                            dgvproject.Rows[i].Cells["three_warranty"].ReadOnly = frmHours.strData_source == Convert.ToInt32(DataSources.EnumDataSources.SELFBUILD).ToString() ? true : false;
                            dgvproject.Rows.Add(1);
                            break;
                        }
                    }
                }
                foreach (DataGridViewRow dgvr in dgvproject.Rows)
                {
                    string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
                    if (!string.IsNullOrEmpty(strPCode) && !listProject.Contains(strPCode))
                    {
                        listProject.Add(strPCode);
                    }
                }
            }
            catch (Exception ex)
            {
                HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);

            }
        }
        private void InitDataGridCellFormatting()   //初始化数据表格
        {
            try
            {
                #region 维修项目数据表格设置
                dgv_tb_maintain_three_guaranty_item.ReadOnly = false;
                dgv_tb_maintain_three_guaranty_item.Rows.Add(3);
                dgv_tb_maintain_three_guaranty_item.AllowUserToAddRows = true;
                drtxt1_item_no.ReadOnly = true;
                drtxt1_item_type.ReadOnly = true;
                drtxt1_item_name.ReadOnly = true;
                drtxt1_man_hour_type.ReadOnly = true;
                drtxt1_man_hour_quantity.ReadOnly = false;
                drtxt1_man_hour_unitprice.ReadOnly = true;
                drtxt1_sum_money.ReadOnly = false;
                drtxt1_remarks.ReadOnly = false;

                dgv_tb_maintain_three_guaranty_item.CellClick += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (args.RowIndex == -1 || args.ColumnIndex == -1) return;
                    string msg;
                    if (dgv_tb_maintain_three_guaranty_item.Columns[args.ColumnIndex] != drtxt1_item_no) return;
                    var frm = new frmWorkHours();
                    var result = frm.ShowDialog();
                    if (result != DialogResult.OK) return;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_no"].Value = frm.strProjectNum;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_type"].Value = UIAssistants.GetDicName(frm.strRepairType);
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_name"].Value = frm.strProjectName;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Value = frm.strWhoursType == "1" ? "工时" : "定额";
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Tag = frm.strWhoursChange;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Value = frm.strWhoursNum;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Tag = frm.strWhoursNum;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_unitprice"].Value = frm.strQuotaPrice;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_remarks"].Value = frm.strRemark;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_sum_money"].Value = Convert.ToString(Convert.ToDecimal(frm.strWhoursNum) * Convert.ToDecimal(String.IsNullOrEmpty(frm.strQuotaPrice) ? "0" : frm.strQuotaPrice));
                };
                dgv_tb_maintain_three_guaranty_item.CellEndEdit += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_no"].Value == null) return;
                    //if (dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Value.ToString() == "工时")
                    //{
                    if (dgv_tb_maintain_three_guaranty_item.Columns[args.ColumnIndex] != drtxt1_man_hour_quantity && dgv_tb_maintain_three_guaranty_item.Columns[args.ColumnIndex] != drtxt1_man_hour_unitprice) return;

                    var strNum = dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Value != null ? dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Value.ToString() : "0";
                    var strMoney = dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_unitprice"].Value != null ? dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_unitprice"].Value.ToString() : "0";
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_sum_money"].Value = Convert.ToString(Convert.ToDecimal(strNum == "" ? "0" : strNum) * Convert.ToDecimal(strMoney == "" ? "0" : strMoney));
                    //}
                    //else
                    //{
                    //    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Value = "";
                    //    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_sum_money"].Value = "0";
                    //}
                };
                dgv_tb_maintain_three_guaranty_item.CellBeginEdit +=
                    delegate(object sender, DataGridViewCellCancelEventArgs args)
                    {
                        if (dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_no"].Value == null) return;
                        if (dgv_tb_maintain_three_guaranty_item.Columns[args.ColumnIndex] != drtxt1_man_hour_quantity) return;
                        if (dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Tag !=
                            null &&
                            dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Tag
                                .ToString() == "0")
                        {
                            args.Cancel = true;
                        }

                    };
                #endregion

                #region 维修用料数据表格设置
                dgv_tb_maintain_three_matrial_detail.Dock = DockStyle.Fill;
                dgv_tb_maintain_three_matrial_detail.ReadOnly = false;
                dgv_tb_maintain_three_matrial_detail.Rows.Add(3);
                dgv_tb_maintain_three_matrial_detail.AllowUserToAddRows = true;
                drtxt2_depot_code.ReadOnly = true;
                drtxt2_parts_code.ReadOnly = true;
                drtxt2_parts_name.ReadOnly = true;
                drtxt2_norms.ReadOnly = true;
                drtxt2_unit.ReadOnly = true;
                drtxt2_is_import.ReadOnly = true;
                drtxt2_parts_source.ReadOnly = true;
                drtxt2_redeploy_no.ReadOnly = true;
                drtxt2_quantity.ReadOnly = false;
                drtxt2_unit_price.ReadOnly = true;
                drtxt2_sum_money.ReadOnly = true;
                drtxt2_parts_source.ReadOnly = false;
                drtxt2_redeploy_no.ReadOnly = true;
                drtxt2_remarks.ReadOnly = false;

                CommonCtrl.BindComboBoxByDictionarr(drtxt2_parts_source, "new_parts_source_yt");

                dgv_tb_maintain_three_matrial_detail.CellClick += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (args.RowIndex == -1) return;
                    if (
                        String.IsNullOrEmpty(
                            CommonCtrl.IsNullToString(
                                dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells[drtxt2_parts_source.Name]
                                    .Value)))
                    {
                        dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells[drtxt2_parts_source.Name]
                            .Value = "677BCEA4-8E61-4224-AE6F-C8D1EA9E7C8A";
                    }
                    if (dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] == drtxt2_quantity || dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] == drtxt2_remarks || dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] == drtxt2_parts_source) return;
                    var frmPart = new frmParts();
                    var result = frmPart.ShowDialog();
                    if (result != DialogResult.OK) return;
                    var strPId = frmPart.PartsID;
                    var dpt = DBHelper.GetTable("", "v_parts", string.Format("*,{0} price2a1", EncryptByDB.GetDesFieldValue("price2a")), " parts_id='" + strPId + "'", "", "");
                    if (dpt.Rows.Count <= 0) return;
                    var dpr = dpt.Rows[0];
                    //dgv_tb_maintain_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_depot_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]); //车厂编码 unknow
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_depot_code"].Value = CommonCtrl.IsNullToString(dpr["car_parts_code"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit"].Value = CommonCtrl.IsNullToString(dpr["sales_unit_name"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_is_import"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_quantity"].Value = "1";
                    if (Convert.ToDouble(CommonCtrl.IsNullToString(dpr["retail"])) <= 300)
                    {
                        dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit_price"].Value = Convert.ToDouble(CommonCtrl.IsNullToString(dpr["price2a1"]))*1.17;
                    }
                    else
                    {
                        dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit_price"].Value = Convert.ToDouble(CommonCtrl.IsNullToString(dpr["price2a1"])) * 1.12;
                    }
                    //dgv_tb_maintain_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_redeploy_no"].Value = CommonCtrl.IsNullToString(dpr["highest_out_price"]);   //三包调件号 unknow
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_remarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
                };
                dgv_tb_maintain_three_matrial_detail.CellEndEdit += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_parts_code"].Value == null) return;
                    if (dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] != drtxt2_quantity &&
                        dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] != drtxt2_unit_price) return;
                    var strNum = dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_quantity"].Value != null ? dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_quantity"].Value.ToString() : "0";
                    var strUMoney = dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit_price"].Value != null ? dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit_price"].Value.ToString() : "0";
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_sum_money"].Value = Convert.ToString(Convert.ToDecimal(strNum == "" ? "0" : strNum) * Convert.ToDecimal(strUMoney == "" ? "0" : strUMoney));
                };
                #endregion
            }
            catch (Exception)
            {
                
            }
        }
 private void addProject_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow dgvr in dgvproject.Rows)
     {
         string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["item_no"].Value);
         if (!string.IsNullOrEmpty(strPCode))
         {
             listProject.Add(strPCode);
         }
     }
     frmWorkHours frmHours = new frmWorkHours();
     DialogResult result = frmHours.ShowDialog();
     if (result == DialogResult.OK)
     {
         if (listProject.Contains(frmHours.strProjectNum))
         {
             MessageBoxEx.Show("此维修项目已存在,请选择其他维修项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         dgvproject.CurrentRow.Cells["item_no"].Value = frmHours.strProjectNum;
         dgvproject.CurrentRow.Cells["item_type"].Value = GetDicName(frmHours.strRepairType);
         dgvproject.CurrentRow.Cells["item_name"].Value = frmHours.strProjectName;
         dgvproject.CurrentRow.Cells["man_hour_type"].Value = frmHours.strWhoursType == "1" ? "工时" : "定额";
         dgvproject.CurrentRow.Cells["man_hour_quantity"].Value = frmHours.strWhoursNum;
         dgvproject.CurrentRow.Cells["man_hour_norm_unitprice"].Value = frmHours.strQuotaPrice;
         dgvproject.CurrentRow.Cells["remarks"].Value = frmHours.strRemark;
         dgvproject.CurrentRow.Cells["OldItem_id"].Value = frmHours.strWhours_id;
         dgvproject.CurrentRow.Cells["sum_money"].Value = Convert.ToString(Convert.ToDecimal(frmHours.strWhoursNum) * Convert.ToDecimal(frmHours.strQuotaPrice));
         dgvproject.Rows.Add(1);
     }
 }