123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- using System.IO;
- using LYFZ.ComponentLibrary;
- using LYFZ.Helper;
- using System.Web.UI.WebControls;
- using Newtonsoft.Json;
- namespace LYFZ.Software.MainBusiness.HospitalTrackingSystem
- {
- public partial class IntentionsSelect : LYFZ.Software.UI.HospitalTrackingSystem.IntentionsSelect
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpSystemLogs slogbll = new BLL.BLL_ErpSystemLogs();
- LYFZ.BLL.BLL_ErpHospitalClient ambll = new BLL.BLL_ErpHospitalClient();
- LYFZ.BLL.BLL_ErpHospitalDispatchDoor hddbll = new BLL.BLL_ErpHospitalDispatchDoor();
- public IntentionsSelect()
- {
- this.btnClose.Click += btnClose_Click;
- this.btnDelete.Click += btnDelete_Click;
- this.btnSelect.Click += btnSelect_Click;
- this.btnTexting.Click += btnTexting_Click;
- this.btnExport.Click += btnExport_Click;
- this.Shown += IntentionsSelect_Shown;
- this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
- this.dgvData.CellDoubleClick += dgvShow_CellDoubleClick;
- this.dgvData.ColumnHeaderMouseClick += DgvData_ColumnHeaderMouseClick;
- this.btnWhole.Click += btnWhole_Click;
- this.bntConditions.Click += bntConditions_Click;
- this.btnClientServiceAnPai.Click += btnClientServiceAnPai_Click;
- this.tabControlEx1.SelectedIndexChanged += tabControlEx1_SelectedIndexChanged;
- this.textBoxEx1.KeyPress += textBoxEx1_KeyPress;
- this.checkBoxEx1.CheckedChanged += checkBoxEx1_CheckedChanged;
- this.checkBoxEx2.CheckedChanged += checkBoxEx2_CheckedChanged;
- //this.dgvData.RowsAdded += dgvData_RowsAdded;
- this.Resize += IntentionsSelect_Resize;
- this.btnImport.Click += btnImport_Click;
- this.btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.Delete);
- this.btnTexting.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.SMSSend);
- this.btnWhole.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.RemindedSet);
- this.btnExport.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.DataExport);
- LYFZ.BLL.BLL_ErpCompanyInfo bllCompany = new BLL.BLL_ErpCompanyInfo();
- DataTable dt = bllCompany.GetAllList().Tables[0];
- ComboBoxItem item = new ComboBoxItem()
- {
- Name = "全部",
- Value = ""
- };
- cbxCompanyList.Items.Add(item);
- foreach(DataRow dr in dt.Rows)
- {
- item = new ComboBoxItem() {
- Name = dr["Company_Name"].ToString(),
- Value = dr["Company_DividedShop"].ToString()
- };
- cbxCompanyList.Items.Add(item);
- }
- cbxCompanyList.SelectedIndex = 0;
- }
- // BMK ldkfad
- private void DgvData_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) // 右键列头;
- {
- if (e.Button == MouseButtons.Right)
- {
- this.dgvData.conMenu.Items.Clear();
- ToolStripMenuItem item = new ToolStripMenuItem();
- item.Text = "设置标题";
- item.Tag = "SetColumnShow";
- item.Name = "SetColumnShow";
- this.dgvData.conMenu.Items.Add(item);
- // this.dgvData.conMenu.Show(MousePosition.X, MousePosition.Y);//弹出操作菜单
- this.dgvData.conMenu.ItemClicked -= ConMenu_ItemClicked;
- this.dgvData.conMenu.ItemClicked += ConMenu_ItemClicked;
- // this.dgvData.conMenu.Show();
- if (!this.dgvData.conMenu.Visible)
- {
- this.dgvData.conMenu.Show(MousePosition.X, MousePosition.Y);//弹出操作菜单
- }
- }
- }
- private void ConMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- ToolStripItem item = e.ClickedItem;
- if (item.Name.Trim() == "SetColumnShow")
- {
- string strEnabled = "";
- if (this.dgvData.Columns.Contains("拍摄状态"))
- {
- strEnabled = "拍摄状态";
- }
- if (LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ShowDataGridViewSetColumn(this.dgvData, StrEnabled: strEnabled))
- {
- this.PublicFunctionRows();
- }
- }
- }
- void IntentionsSelect_Resize(object sender, EventArgs e)
- {
- switch (this.panelEx14.Location.Y)
- {
- case 1: this.flowLayoutPanel1.Height = 36; break;
- case 33: this.flowLayoutPanel1.Height = 68; break;
- }
- }
- Dictionary<string, string> DictData = new Dictionary<string, string>();
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void IntentionsSelect_Shown(object sender, EventArgs e)
- {
- bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(
- VersionControl.VersionFunctionEnum.医院跟踪系统意向单查询);
- if (!b)
- {
- this.Close();
- return;
- }
- //this.tabPage_ExpiredExpected.Parent = null;
- this.PublicFunctionRows();
- this.Settings();
- this.cbxusert.TextFindTag("不限条件");
- List<Control> hideControls=new List<Control>();
- hideControls.Add(btnTexting);
- LYFZ.Software.MainBusiness.VersionControl.StaticVersion.BindVersionShowHideControl(VersionControl.VersionFunctionEnum.短信管理医院跟踪短信, hideControls,null,null);
- }
- /// <summary>
- /// 导入按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnImport_Click(object sender, EventArgs e)
- {
- ImportExcel frm = new ImportExcel();
- frm.ShowDialog();
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 预产期选中事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void checkBoxEx2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.checkBoxEx2.Checked == true)
- { this.checkBoxEx1.Checked = false; }
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 宝宝生日选中事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void checkBoxEx1_CheckedChanged(object sender, EventArgs e)
- {
- if (this.checkBoxEx1.Checked == true)
- { this.checkBoxEx2.Checked = false; }
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 显示数字
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void textBoxEx1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 导出按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnExport_Click(object sender, EventArgs e)
- {
- if (dgvData.Rows.Count > 0)
- {
- string StrWhere = GetWhereStr();
- SaveFileDialog saveFile = new SaveFileDialog();
- saveFile.FileName = "意向单查询";
- saveFile.Title = "导出数据报表文件";
- saveFile.Filter = "EXECL文件(*.xls) |*.xls |文本文件(*.txt) |*.txt |所有文件(*.*) |*.*";
- saveFile.FilterIndex = 1;
- DialogResult drst = saveFile.ShowDialog();
- if (drst == DialogResult.No || drst == DialogResult.Cancel || drst == DialogResult.No || drst == DialogResult.Abort)
- { return; }
- bool IsExport = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
-
- DataTable dt = orbll.GetView_Custom("View_HospitalContact", StrWhere: StrWhere, ShowColumnName: GetColumnFilde(), filedOrder: "来单批号").Tables[0];
- DataTable dtContact = orbll.GetView_Custom(" select Hcr_Number as 来单批号, dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Hcr_CallTime)) as 通话时间, Hcr_CallDuration as 通话时长, Hcr_Homeaddress as 具体事项, Hcr_CallStaff as 通话人员, Hcr_CallMode as 通话方式, dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Hcr_RemindTime)) as 下次提醒时间, Hcr_Remarks as 沟通备注 from tb_ErpHospitalContactRecord ").Tables[0];
-
- if (dt.Rows.Count > 0)
- {
- dt.Columns.Remove("ID");
- dt.Columns.Remove("录入时间查询");
- dt.Columns.Remove("订单客户");
- dt.Columns.Add("通话时间");
- dt.Columns.Add("通话时长");
- dt.Columns.Add("具体事项");
- dt.Columns.Add("通话人员");
- dt.Columns.Add("通话方式");
- dt.Columns.Add("下次提醒时间");
- dt.Columns.Add("沟通备注");
- List<dynamic> dtJson = JsonConvert.DeserializeObject<List<dynamic>>(JsonConvert.SerializeObject(dt));
- int intIndex = 0;
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- DataRow[] drList = dtContact.Select(" 来单批号 = '" + dt.Rows[i]["来单批号"] + "' ");
- if(drList.Length>0)
- {
- for(int j=0;j< drList.Length;j++)
- {
- if(j==0)
- {
- ((dynamic)dtJson[i + intIndex]).通话时间 = drList[j]["通话时间"].ToString();
- ((dynamic)dtJson[i + intIndex]).通话时长 = drList[j]["通话时长"].ToString();
- ((dynamic)dtJson[i + intIndex]).具体事项 = drList[j]["具体事项"].ToString();
- ((dynamic)dtJson[i + intIndex]).通话人员 = drList[j]["通话人员"].ToString();
- ((dynamic)dtJson[i + intIndex]).通话方式 = drList[j]["通话方式"].ToString();
- ((dynamic)dtJson[i + intIndex]).下次提醒时间 = drList[j]["下次提醒时间"].ToString();
- ((dynamic)dtJson[i + intIndex]).沟通备注 = drList[j]["沟通备注"].ToString();
- }
- else
- {
- intIndex++;
- dynamic dyObj = new System.Dynamic.ExpandoObject();
- dyObj.通话时间 = drList[j]["通话时间"].ToString();
- dyObj.通话时长 = drList[j]["通话时长"].ToString();
- dyObj.具体事项 = drList[j]["具体事项"].ToString();
- dyObj.通话人员 = drList[j]["通话人员"].ToString();
- dyObj.通话方式 = drList[j]["通话方式"].ToString();
- dyObj.下次提醒时间 = drList[j]["下次提醒时间"].ToString();
- dyObj.沟通备注 = drList[j]["沟通备注"].ToString();
- dtJson.Insert(i + intIndex, dyObj);
-
- }
- }
- }
- }
- dt = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(dtJson),
- typeof(DataTable)) as DataTable;
- try
- {
- //this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- //{
- // IsExport = LYFZ.Command.Command_ExportExcel.DataTable2Sheet(saveFile.FileName.Trim(), dt, "Sheet1", IsCoveredExistingFile: true);
- //}));
- IsExport = LYFZ.WinAPI.CustomPublicMethod.DataGridViewToExcel(saveFile.FileName.Trim(), dt, null, backgroundWorker);
- }
- catch
- { }
- if (IsExport)
- { MessageBoxCustom.Show("导出成功!"); }
- else
- { MessageBoxCustom.Show("导出失败!"); }
- }
- });
- }
- else
- { MessageBoxCustom.Show("没有数据可导出"); return; }
- }
- /// <summary>
- /// 多条件查询按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void bntConditions_Click(object sender, EventArgs e)
- {
- this.DictData.Clear();
- ConditionsInquiry frm = new ConditionsInquiry();
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.DictData = frm.DictDataArray;
- this.txtQuery.Text = "";
- this.PublicFunctionRows();
- }
- }
- /// <summary>
- /// 安排客服
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClientServiceAnPai_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count > 0)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ClientServiceTaskAnPaiSmallForm frm = new DoorCityProcess.SetSmallForm.ClientServiceTaskAnPaiSmallForm();
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ClientServiceAnPai(this.dgvData, LYFZ.EnumPublic.ClientServiceTaskType.意向跟踪, frm.model, LYFZ.EnumPublic.ClientServiceTaskItem.医院意向);
- }
- }
- }
- /// <summary>
- /// 选项卡事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void tabControlEx1_SelectedIndexChanged(object sender, EventArgs e)
- {
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_All":
- this.txtStatistic.Visible = true;
- break;
- default:
- this.txtStatistic.Visible = false;
- break;
- }
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_NotComplete":
- this.btnClientServiceAnPai.Enabled = true;
- break;
- default:
- this.btnClientServiceAnPai.Enabled = false;
- break;
- }
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 双击未完成事件
- /// </summary>
- /// <param name="e"></param>
- void dgvShow_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
- {
- if (this.dgvData.SelectedRows != null && this.dgvData.SelectedRows.Count > 0)
- {
- IntentionsEntered frm = new IntentionsEntered();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.StrOrdNumber = this.dgvData.CurrentRow.Cells["来单批号"].Value.ToString();
- frm.Owner = this;
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.PublicFunctionRows(); }
- }
- }
- }
- /// <summary>
- /// 创建行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
- {
- if (this.dgvData.Columns.Contains("生日类型"))
- {
- if (this.dgvData.Rows[e.RowIndex].Cells["生日类型"].Value.ToString().Trim() == "预产期")
- { this.dgvData.Rows[e.RowIndex].Cells["宝宝性别"].Value = ""; }
- }
- }
- /// <summary>
- /// 设置下拉框
- /// </summary>
- void Settings()
- {
- if (this.cbxusert.Nodes.Count > 0)
- { this.cbxusert.Nodes.Clear(); }
- System.Windows.Forms.TreeNode root = null;
- DataTable dt = orbll.GetView_Custom("tb_ErpHospitalRemindSettings", ShowColumnName: "ID,Hrs_RemindName,Hrs_RemindDays,Hrs_StartState").Tables[0];
- this.cbxusert.Nodes.Add("不限条件");
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- if (dt.Rows[i]["Hrs_StartState"].ToString() == "0")
- {
- root = new System.Windows.Forms.TreeNode();
- root.Text = dt.Rows[i]["Hrs_RemindName"].ToString();
- root.Tag = dt.Rows[i]["ID"].ToString();
- this.cbxusert.Nodes.Add(root);
- }
- }
- }
- /// <summary>
- /// 提醒设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnWhole_Click(object sender, EventArgs e)
- {
- RemindSet frm = new RemindSet();
- frm.StrRemindSetLoadType = RemindSet.RemindSetLoadType.医院跟踪今日提醒;
- frm.ShowDialog();
- if (frm.ok)
- {
- string StrText = this.cbxusert.Text.Trim();
- this.Settings();
- this.cbxusert.TextFindTag(StrText);
- }
- }
- /// <summary>
- /// 发送短信按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnTexting_Click(object sender, EventArgs e)
- {
- LYFZ.Software.UI.SMSManagement.SmsSend.FrmSendSms frm = new UI.SMSManagement.SmsSend.FrmSendSms();
- if (dgvData.SelectedRows == null || dgvData.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选择要发送短信的客人!"); return; }
- string Sj1 = "";
- string User_Telephone = "";
- LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms sendSms = new SMSManagement.SmsSend.FrmSendSms();
- for (int i = 0; i < dgvData.SelectedRows.Count; i++)
- {
- User_Telephone = dgvData.SelectedRows[i].Cells["本人手机"].Value.ToString();
- //检查手机合法性
- if (!string.IsNullOrEmpty(User_Telephone))
- {
- string ret = LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(User_Telephone);
- if (ret.Trim().Length <= 0)
- { Sj1 += User_Telephone + ","; }
- else if (dgvData.SelectedRows.Count == 1)
- { MessageBoxCustom.Show("手机号无效:" + ret); return; }
- }
- }
- sendSms.Phone = Sj1.Trim(',');
- sendSms.ShowDialog();
- }
- /// <summary>
- /// 查询按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSelect_Click(object sender, EventArgs e)
- {
- this.DictData.Clear();
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 删除按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows != null && this.dgvData.SelectedRows.Count > 0)
- {
- if (this.dgvData.CurrentRow != null)
- {
- if (this.dgvData.SelectedRows.Count > 0)
- {
- if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- LYFZ.Model.Model_ErpHospitalClient model = ambll.GetModel(Convert.ToInt32(dgvData.CurrentRow.Cells["ID"].Value));
- List<LYFZ.Helper.CommandInfo> clist = new List<CommandInfo>();
- clist.Add(ambll.GetDeleteCommandInfo("ID", "=", dgvData.CurrentRow.Cells["ID"].Value));
- DataTable dt = orbll.GetView_Custom("tb_ErpHospitalDispatchDoor", StrWhere: "Hdr_Number = '" + model.Hct_Oddnumber + "'", ShowColumnName: "ID").Tables[0];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- clist.Add(hddbll.GetDeleteCommandInfo("ID", "=", dt.Rows[i]["ID"]));
- }
- string strContent = "ID:" + model.ID + ",来单批号为:" + model.Hct_Oddnumber + ",客户姓名为:" + model.Hct_CustomerName + ",本人手机:" + model.Hct_MyselfMobile;
- if (!String.IsNullOrEmpty(model.Hct_HusbandMobile))
- {
- strContent += ",老公手机:" + model.Hct_HusbandMobile;
- }
- if (!String.IsNullOrEmpty(model.Hct_BabyName))
- {
- strContent += ",宝贝姓名:" + model.Hct_BabyName;
- }
- clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.删除医院跟踪客户, strContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name, StrInfoID: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID())));
- //if (ambll.Delete())
- if (clist.Count > 0)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- MessageBoxCustom.Show("删除成功!");
- //LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除医院跟踪客户, "删除医院跟踪客户,ID为:" + dgvData.CurrentRow.Cells["ID"].Value + ",客户姓名为:" + dgvData.CurrentRow.Cells["客户姓名"].Value + "", LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
- this.PublicFunctionRows();
- }
- else
- { MessageBoxCustom.Show("删除失败!"); }
- }
- }
- }
- }
- }
- else
- { MessageBoxCustom.Show("请选择你要删除的数据!"); }
- }
- /// <summary>
- /// 关闭窗体
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClose_Click(object sender, EventArgs e)
- {
- if (MessageBoxCustom.Show("你确定要关闭吗?", "关闭提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- { this.Close(); }
- }
- /// <summary>
- /// 创建行
- /// </summary>
- private void PublicFunctionRows()
- {
- this.UcPagerEx1.PageCurrent = 1;
- this.UcPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
- this.UcPagerEx1.Bind();
- if (this.tabControlEx1.SelectedTab.Name.Trim() == "tabPage_All")
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- DataTable dt = orbll.GetView_Custom("View_HospitalContact", StrWhere: GetWhereStr(), ShowColumnName: "订单客户").Tables[0];
- if (dt.Rows.Count > 0)
- {
- this.txtStatistic.Text = "总录入数量:" +
- dt.Rows.Count + " 成交数量:" +
- dt.Select("订单客户 = 1").Length + " 未成交数量:" +
- dt.Select("订单客户 = 0").Length + " 已流失:" +
- dt.Select("订单客户 = 2").Length + " 成交百分比:" +
- Convert.ToDouble(dt.Select("订单客户 = 1").Length) / Convert.ToDouble(dt.Rows.Count) + "%";
- }
- else
- {
- this.txtStatistic.Text = "总录入数量:0 成交数量:0 未成交数量:0 已流失:0 成交百分比:0%";
- }
- }
- }
- /// <summary>
- /// 未成交分页数据
- /// </summary>
- /// <param name="e"></param>
- /// <returns></returns>
- int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
- {
- DataTable dt = new DataTable();
- LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
- string tabName = "View_HospitalContact";
-
- if ((DictData.ContainsKey("StrGHUser") && DictData["StrGHUser"].Length > 0) || (DictData.ContainsKey("StrGHStartTime") && DictData["StrGHStartTime"].Length > 0) || (DictData.ContainsKey("StrGHEndTime") && DictData["StrGHEndTime"].Length > 0))
- {
- tabName += " inner join tb_ErpHospitalDispatchDoor on View_HospitalContact.来单批号 = tb_ErpHospitalDispatchDoor.Hdr_Number ";
- }
-
- pageData.TableName = tabName;
- pageData.PageIndex = this.UcPagerEx1.PageCurrent;
- pageData.PageSize = this.UcPagerEx1.PageSize;
- pageData.QueryCondition = GetWhereStr();
- pageData.QueryFieldName = this.GetColumnFilde();
- pageData.OrderStr = "来单批号";
- pageData.OrderType = 1;
- string strHideField = "ID,录入时间查询,订单客户";
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- dt = pageData.QueryDataTableByPage(this.UcPagerEx1.PageSize, this.UcPagerEx1.PageCurrent, this.GetColumnFilde(), tabName, GetWhereStr()).Tables[0];
- dt.Columns.Remove("RowNumber");
- });
- try
- {
- this.dgvData.DataSource(dt, strHideField: strHideField);
- }
- catch
- { }
- try
- {
- this.UcPagerEx1.TbDataSource = dt;
- }
- catch { }
- if (pageData.QueryFieldName.Contains("自家地址") )
- this.dgvData.Columns["自家地址"].Width = 200;
- if (pageData.QueryFieldName.Contains("婆家地址"))
- this.dgvData.Columns["婆家地址"].Width = 200;
- if (pageData.QueryFieldName.Contains("娘家地址"))
- this.dgvData.Columns["娘家地址"].Width = 200;
- this.dgvData.ClearSelection();
- return pageData.TotalCount;
- }
- /// <summary>
- /// 获取要查询的字段名
- /// </summary>
- /// <returns></returns>
- string GetColumnFilde()
- {
- #if IGNORE
- return "ID,来单批号,客户姓名,宝宝姓名,宝宝性别,生日类型,[宝宝生日/预产期],是否农历,宝宝年龄,宝宝天数,怀孕天数,本人手机,老公姓名,老公手机,发送来单短信,喂养方式,客户区域,客户类别,订单客户,业务种类,业务意向,来单医院,门市,发片状态,发片日期,发片人员,完成状态,完成日期,完成人员,取件状态,取件日期,取件人员,备注,录入时间,录入时间查询,录入者,自家地址,婆家地址,娘家地址";
- #else
- string strGuidName = LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0047.ToString().Trim();
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- string strDefaultColumn = "ID,来单批号,客户姓名,宝宝姓名,宝宝性别,生日类型,[宝宝生日/预产期],是否农历,宝宝年龄,宝宝天数,怀孕天数,本人手机,老公姓名,老公手机,发送来单短信,喂养方式,客户区域,客户类别,门市,订单客户,业务种类,业务意向,来单医院,发片状态,发片日期,发片人员,完成状态,完成日期,完成人员,取件状态,取件日期,取件人员,备注,录入时间,录入时间查询,录入者,自家地址,婆家地址,娘家地址";
-
- // 加载数据库中的记录;
- Dictionary<string, string> dictColumns =
- LYFZ.DAL.DAL_GridViewDisplayIndex.GetGridViewShowColumns(strUserID, strGuidName, strDefaultColumn);
- this.dgvData.dgvGuidName = strGuidName;
- this.dgvData.dgvCurrentColumnOriginalSet = strDefaultColumn;
- this.dgvData.dgvUserEmployeeID = strUserID;
- this.dgvData.AllowUserToOrderColumns = true;
- this.dgvData.dgvFixedHideColumn = "ID,录入时间查询,订单客户,来单批号,客户姓名,宝宝姓名,宝宝性别,本人手机,来单医院";
- this.dgvData.dictShowColumName = dictColumns;
- string strColumnShow = "";
- foreach (var key in dictColumns )
- {
- if (key.Key.Contains("宝宝生日/预产期"))
- {
- strColumnShow += "[宝宝生日/预产期],";
- }
- else if (key.Key.Contains("ID"))
- {
- strColumnShow += "View_HospitalContact.ID,";
- }
- else
- {
- strColumnShow += key.Key + ",";
- }
- }
- return strColumnShow.TrimEnd(',');
- #endif
- }
- /// <summary>
- /// 查询条件
- /// </summary>
- /// <returns></returns>
- private string GetWhereStr()
- {
- string StrWhere = " 1=1 ";
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_NotComplete": StrWhere += " and 订单客户 = '0' And ((Hct_BirthdayType = 1 And Hct_BabyBirthday >= '" + SDateTime.Now + "') or Hct_BirthdayType = 0)"; break;
- case "tabPage_OrderOK": StrWhere += " and 订单客户 = '1' "; break;
- case "tabPage_LostOK": StrWhere += " and 订单客户 = '2' "; break;
- case "tabPage_ExpiredExpected": StrWhere += " and 订单客户 = '0' And Hct_BirthdayType = 1 And Hct_BabyBirthday < '" + SDateTime.Now + "'"; break;
- }
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_OrderOK":
- case "tabPage_LostOK": break;
- default:
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.Client_ShowAllIntentClient))
- { StrWhere += " And Hct_CreateName = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID + "'"; }
- break;
- }
- if (!string.IsNullOrEmpty(this.txtQuery.Text.Trim()))
- {
- StrWhere += "and (客户姓名 like'%" +
- this.txtQuery.Text.Trim() +
- "%' or 宝宝姓名 like'%" +
- this.txtQuery.Text.Trim() +
- "%' or dbo.fn_ChineseToSpell(客户姓名) like '%" +
- this.txtQuery.Text.Trim() +
- "%' or dbo.fn_ChineseToSpell(宝宝姓名) like '%" +
- this.txtQuery.Text.Trim() +
- "%' or 本人手机 like '%" +
- this.txtQuery.Text.Trim() +
- "%' or 老公手机 like '%" +
- this.txtQuery.Text.Trim() +
- "%' or 老公姓名 like '%" +
- this.txtQuery.Text.Trim() + "%')";
- }
- if (DictData.ContainsKey("StrClientClass") && DictData["StrClientClass"].Length > 0)
- { StrWhere += " and 客户类别 = '" + DictData["StrClientClass"].Trim() + "'"; }
- if (DictData.ContainsKey("StrIntent") && DictData["StrIntent"].Length > 0)
- { StrWhere += " and 业务意向 = '" + DictData["StrIntent"].Trim() + "'"; }
- if (DictData.ContainsKey("StrClientName") && DictData["StrClientName"].Length > 0)
- { StrWhere += " and 客户姓名 like '%" + DictData["StrClientName"].Trim() + "%'"; }
- if (DictData.ContainsKey("StrClientPhone") && DictData["StrClientPhone"].Length > 0)
- { StrWhere += " and 本人手机 like'%" + DictData["StrClientPhone"].ToString().Trim() + "%' or 老公手机 like '%" + DictData["StrClientPhone"].ToString().Trim() + "%'"; }
- if (DictData.ContainsKey("StrRegion") && DictData["StrRegion"].Length > 0)
- { StrWhere += " and 客户区域 = '" + DictData["StrRegion"].Trim() + "'"; }
- if (DictData.ContainsKey("StrRetail") && DictData["StrRetail"].Length > 0)
- { StrWhere += " and 门市 = '" + DictData["StrRetail"].Trim() + "'"; }
- if (DictData.ContainsKey("StrHospital") && DictData["StrHospital"].Length > 0)
- { StrWhere += " and 来单医院 = '" + DictData["StrHospital"].Trim() + "'"; }
- if (DictData.ContainsKey("StrSpecies") && DictData["StrSpecies"].Length > 0)
- { StrWhere += " and 业务种类 = '" + DictData["StrSpecies"].Trim() + "'"; }
- if (DictData.ContainsKey("StrOrderNumber") && DictData["StrOrderNumber"].Length > 0)
- { StrWhere += " and 来单批号 = '" + DictData["StrOrderNumber"].Trim() + "'"; }
- if (DictData.ContainsKey("StrSendStatus") && DictData["StrSendStatus"].Length > 0)
- { StrWhere += " and 发片状态 = '" + DictData["StrSendStatus"].Trim() + "'"; }
- if (DictData.ContainsKey("StrCompleteStatus") && DictData["StrCompleteStatus"].Length > 0)
- { StrWhere += " and 完成状态 = '" + DictData["StrCompleteStatus"].Trim() + "'"; }
- if (DictData.ContainsKey("StrPickupStatus") && DictData["StrPickupStatus"].Length > 0)
- { StrWhere += " and 取件状态 = '" + DictData["StrPickupStatus"].Trim() + "'"; }
- if (DictData.ContainsKey("StrAddress") && DictData["StrAddress"].Length > 0)
- { StrWhere += " and (自家地址 like '%" + DictData["StrAddress"].Trim() + "%' or 娘家地址 like '%" + DictData["StrAddress"].Trim() + "%' or 婆家地址 like '%" + DictData["StrAddress"].Trim() + "%')"; }
- if (DictData.ContainsKey("StrBornInStart") && DictData["StrBornInStart"].Length > 0 && DictData.ContainsKey("StrBornInEnd") && DictData["StrBornInEnd"].Length > 0)
- { StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("convert(datetime,[宝宝生日/预产期],120)", DictData["StrBornInStart"], DictData["StrBornInEnd"]); }
- if (DictData.ContainsKey("StrBirthdayStart") && DictData["StrBirthdayStart"].Length > 0 && DictData.ContainsKey("StrBirthdayEnd") && DictData["StrBirthdayEnd"].Length > 0)
- { StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("今年生日日期", DictData["StrBirthdayStart"], DictData["StrBirthdayEnd"]); }
- if (DictData.ContainsKey("StrCreateStart") && DictData["StrCreateStart"].Length > 0 && DictData.ContainsKey("StrCreateEnd") && DictData["StrCreateEnd"].Length > 0)
- { StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("录入时间查询", DictData["StrCreateStart"], DictData["StrCreateEnd"]); }
- #region 通话人员;
- if ( DictData.ContainsKey("strCommunicationPersonnel") && DictData["strCommunicationPersonnel"].Length > 0 )
- {
- StrWhere += " and [来单批号] in (select max([Hcr_Number]) FROM [tb_ErpHospitalContactRecord] where Hcr_CallStaff = '" + DictData["strCommunicationPersonnel"].ToString() + "' group by Hcr_Number)";
- }
- #endregion
- #region 上门时间 上门人员
- if (DictData.ContainsKey("StrGHStartTime") && DictData["StrGHStartTime"].Length > 0 && DictData.ContainsKey("StrGHEndTime") && DictData["StrGHEndTime"].Length > 0)
- { StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Hdr_DoorTime", DictData["StrGHStartTime"], DictData["StrGHEndTime"]); }
-
- if(DictData.ContainsKey("StrGHUser") && DictData["StrGHUser"].Length > 0)
- {
- StrWhere += " and ( Hdr_DoorPersonOne = '"+ DictData["StrGHUser"] + "' or Hdr_DoorPersonTwo = '" + DictData["StrGHUser"] + "' or Hdr_DoorPersonThree = '" + DictData["StrGHUser"] + "' or Hdr_DoorPersonFour = '" + DictData["StrGHUser"] + "' ) ";
- }
- if((DictData.ContainsKey("StrGHUser") && DictData["StrGHUser"].Length > 0) || (DictData.ContainsKey("StrGHStartTime") && DictData["StrGHStartTime"].Length > 0) || (DictData.ContainsKey("StrGHEndTime") && DictData["StrGHEndTime"].Length > 0))
- {
- StrWhere += " and Hdr_HomeState = 1 ";
- }
- #endregion
- if (this.checkBoxEx1.Checked == true)
- { StrWhere += " and 生日类型='宝宝生日'"; }
- else if (this.checkBoxEx2.Checked == true)
- { StrWhere += " and 生日类型='预产期'"; }
- if (textBoxEx1.Text.Trim() != "" && this.cbxusert.Text.Trim() != "" && this.cbxusert.Text.Trim() != "不限条件")
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- DataTable dt = orbll.GetView_Custom("tb_ErpHospitalRemindSettings", StrWhere: "ID ='" + cbxusert.Tag.ToString() + "'", ShowColumnName: "Hrs_RemindDays,Hrs_RemindConditions").Tables[0];
- int Strds = Convert.ToInt32(this.textBoxEx1.Text.Trim());//近x天
- //string Strrr = this.cbxusert.Text.Trim();
- int RemindDays = Convert.ToInt32(dt.Rows[0]["Hrs_RemindDays"].ToString());
- int Strde = RemindDays - Convert.ToInt32(Strds);
- if (dt.Rows[0]["Hrs_RemindConditions"].ToString() == "0")
- {
- StrWhere += " and 宝宝天数 <='" + dt.Rows[0]["Hrs_RemindDays"].ToString() + "' and 宝宝天数>= '" + Strde + "'";
- }
- else if (dt.Rows[0]["Hrs_RemindConditions"].ToString() == "1")
- {
- StrWhere += " and 怀孕天数 >=" + (280 - (Strds + RemindDays)).ToString() + " and 怀孕天数 <=" + (280 - RemindDays).ToString();
- }
- }
- if (!string.IsNullOrEmpty((cbxCompanyList.SelectedItem as ComboBoxItem).Value))
- {
- if(StrWhere!="")
- {
- StrWhere += " and ";
- }
- StrWhere += " Hct_DividedShop = '" + (cbxCompanyList.SelectedItem as ComboBoxItem).Value + "' ";
- }
- StrWhere = "(" + StrWhere + ") or (门市 = '') ";
- return StrWhere;
- }
- }
- class ComboBoxItem {
- public string Name { get; set; }
- public string Value { get; set; }
- public override string ToString()
- {
- return Name;
- }
- }
- }
|