private void btnSearch_Click(object sender, EventArgs e) { string sSql = string.Empty; if (chkDate.Checked) { sSql += $@" and DATEDIFF(dd,CreateDate,'{dtpBegin.Value}')<=0 and DATEDIFF(dd,CreateDate,'{dtpEnd.Value}')>=0"; } if (!string.IsNullOrEmpty(cmbEmployees.Text) && !cmbEmployees.Text.Equals(@"全部")) { sSql += $@" and DocID = '{cmbEmployees.SelectedValue}'"; } if (!string.IsNullOrEmpty(txtKeys.Text.Trim())) { sSql += $@" and (Diagnosis like '%{txtKeys.Text.Trim()}%' or PatName like '%{txtKeys.Text.Trim()}%')"; } dgvServePats.AutoGenerateColumns = false; DataTable dtTable = ErpServer.GetPrescription(sSql).Tables[0]; dgvServePats.DataSource = dtTable; decimal inCost = 0, outPrice = 0; for (int i = 0; i < dtTable.Rows.Count; i++) { inCost += dtTable.Rows[i]["MedCost"].SafeDbValue <decimal>(); outPrice += dtTable.Rows[i]["MedPrice"].SafeDbValue <decimal>(); } lblNum.Text = @"数量:" + dtTable.Rows.Count; lblMoneySum.Text = @"总成本:" + inCost + @" " + @"总售价:" + outPrice + @" " + @"总利润:" + (outPrice - inCost); dtTable.Dispose(); }
private void dgvPlan_Click(object sender, EventArgs e) { if (dgvPlan.CurrentRow != null) { string sSql = $@" and a.SignId= '{dgvPlan.CurrentRow.Cells["SignId"].Value}'"; DataTable dtTable = ErpServer.GetMedPlans(sSql).Tables[0]; dgvDetail.AutoGenerateColumns = false; dgvDetail.DataSource = dtTable; } }
/// <summary> /// 获取员工信息 /// </summary> /// <param name="key"></param> /// <returns></returns> public DataTable GetEmployeeInfo(string key) { string sSql = string.Empty; if (!string.IsNullOrEmpty(key)) { sSql += $@" and (DocName like '%{key}%' or DocID like '%{key}%')"; } return(ErpServer.GetEmployeeInfo(sSql).Tables[0]); }
public bool AddTreatment(Treatment treatment) { return(ErpServer.AddTreatment(treatment)); //using (DataClassesDataContext dataClasses = new DataClassesDataContext()) //{ // dataClasses.Treatment.InsertOnSubmit(treatment); // dataClasses.SubmitChanges(); // return true; //}; }
private void tsmDelete_Click(object sender, EventArgs e) { if (dgvDetail.CurrentRow != null) { if (ErpServer.DeletePlanMed(dgvDetail.CurrentRow.Cells["ID"].Value.ToString())) { MessageBox.Show(@"删除成功!"); dgvDetail.Rows.Remove(dgvDetail.CurrentRow); } } }
private void tmsDeletePro_Click(object sender, EventArgs e) { if (dgvPlan.CurrentRow != null) { if (ErpServer.DeletePlan(dgvPlan.CurrentRow.Cells["SignID"].Value.ToString())) { MessageBox.Show(@"删除成功!"); dgvPlan.Rows.Remove(dgvPlan.CurrentRow); } } }
private void 除药品ToolStripMenuItem_Click(object sender, EventArgs e) { if (dgvMedicine.CurrentRow == null) { MessageBox.Show(@"请选择需要操作的药品!"); return; } if (MessageBox.Show(@"确定删除该药品?", @"消息", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { MessageBox.Show(ErpServer.DeleteMedicine(dgvMedicine.CurrentRow.Cells["MedID"].Value.ToString()) ? @"删除成功!" : @"删除失败!"); btnSearch_Click(null, null); } }
private void cmbStyle_SelectedIndexChanged(object sender, EventArgs e) { cmbMedicines.DataSource = null; if (cmbStyle.SelectedValue != null) { string sSql = $@" and MedTypeID = '{cmbStyle.SelectedValue}'"; DataTable dtMedicines = ErpServer.GetMedInfo(sSql, CommonInfo.ConfigStyle.药品类别.SafeDbValue <int>()).Tables[0]; DataRow drRow = dtMedicines.NewRow(); drRow["MedID"] = @"-1"; drRow["MedName"] = @"全部"; dtMedicines.Rows.InsertAt(drRow, 0); cmbMedicines.DataSource = dtMedicines; cmbMedicines.ValueMember = @"MedID"; cmbMedicines.DisplayMember = @"MedName"; } }
private void btnSearch_Click(object sender, EventArgs e) { string sSql = @" and newRow = 1"; if (!string.IsNullOrEmpty(cmbEmployees.Text) && !cmbEmployees.Text.Equals(@"全部")) { sSql += $@" and b.DocName = '{cmbEmployees.Text}'"; } if (!string.IsNullOrEmpty(cmbPlan.Text) && !cmbPlan.Text.Equals(@"全部")) { sSql += $@" and a.StyleName = '{cmbPlan.Text}'"; } DataTable dtTable = ErpServer.GetMedPlans(sSql).Tables[0]; dgvPlan.AutoGenerateColumns = false; dgvPlan.DataSource = dtTable; }
private void btnSave_Click(object sender, EventArgs e) { if (!txtNewPass.Text.Equals(txtRetry.Text)) { MessageBox.Show(@"两次输入的密码不一致!"); return; } if (ErpServer.UpdatePassWord(txtNewPass.Text, Information.CurrentUser.Id)) { MessageBox.Show(@"修改成功"); this.Close(); } else { MessageBox.Show(@"修改失败"); } }
private void btnSearch_Click(object sender, EventArgs e) { string sSql = string.Empty; if (!string.IsNullOrEmpty(cmbStyle.Text) && !cmbStyle.Text.Equals(@"全部")) { sSql += $@" and MedTypeID = '{cmbStyle.SelectedValue}'"; } if (!string.IsNullOrEmpty(txtKeys.Text)) { sSql += $@" and (MedName like '%{txtKeys.Text}%' or MedID like '%{txtKeys.Text}%' or MedSpellFirst like '%{txtKeys.Text}%') "; } DataTable drTable = ErpServer.GetMedcine(sSql).Tables[0]; dgvMedicine.AutoGenerateColumns = false; dgvMedicine.DataSource = drTable; lblMedSum.Text = @"药品总数量:" + drTable.Rows.Count; }
private void btnSearch_Click(object sender, EventArgs e) { string sSql = string.Empty; if (chkDate.Checked) { sSql += $@" and (DATEDIFF(dd,OperateTime,'{dtpBegin.Value}')<=0 and DATEDIFF(dd,OperateTime,'{dtpEnd.Value}')>=0)"; } if (chkInMed.Checked) { sSql += $@" and OperType = '药品进货'"; } dgvShow.AutoGenerateColumns = false; DataTable dtMedIndo = ErpServer.GetMedBuyInfo(sSql).Tables[0]; dgvShow.DataSource = dtMedIndo; lblSum.Text = "总数:" + dtMedIndo.Rows.Count; dtMedIndo.Dispose(); }
private void btnDelete_Click(object sender, EventArgs e) { if (dgvEmployee.CurrentRow != null) { if (ErpServer.DeleteEmp(dgvEmployee.CurrentRow.Cells["DocID"].Value.ToString().Trim())) { MessageBox.Show(@"删除成功!"); dgvEmployee.Rows.Remove(dgvEmployee.CurrentRow); } else { MessageBox.Show(@"删除失败,检查后重试!"); } } else { MessageBox.Show(@"请选择需要删除的员工!"); } }
private void btnSearch_Click(object sender, EventArgs e) { try { string sSql = string.Empty; if (chkDate.Checked) { sSql += $@" and DATEDIFF(dd,LookDate,'{dtpBegin.Value}')<=0 and DATEDIFF(dd,LookDate,'{dtpEnd.Value}')>=0"; } if (!string.IsNullOrEmpty(cmbEmployees.Text) && !cmbEmployees.Text.Equals(@"全部")) { sSql += $@" and DoctorID = '{cmbEmployees.SelectedValue}'"; } if (!string.IsNullOrEmpty(cmbPations.Text) && !cmbPations.Text.Equals(@"全部")) { sSql += $@" and PatID = '{cmbPations.SelectedValue}'"; } if (!string.IsNullOrEmpty(cmbStyle.Text) && !cmbStyle.Text.Equals(@"全部")) { sSql += $@" and SignID = '{cmbStyle.SelectedValue}'"; } if (!string.IsNullOrEmpty(cmbMedicines.Text) && !cmbMedicines.Text.Equals(@"全部")) { sSql += $@" and MedID = '{cmbMedicines.SelectedValue}'"; } if (!string.IsNullOrEmpty(txtKey.Text.Trim())) { sSql += $@" and (PatName like '%{txtKey.Text.Trim()}%' or DocName like '%{txtKey.Text.Trim()}%' or MedName like '%{txtKey.Text.Trim()}%' or MedSpellFirst like '%{txtKey.Text.Trim()}%')"; } DataTable dtMedTable = ErpServer.GetMedOutInfo(sSql).Tables[0]; dgvMedsInfo.AutoGenerateColumns = false; dgvMedsInfo.DataSource = dtMedTable; lblMoneySum.Text = @"数量:" + dtMedTable.Rows.Count; dtMedTable.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnSearch_Click(object sender, EventArgs e) { dgvMedicine.DataSource = null; string sSql = string.Empty; if (chkDate.Checked) { sSql += $@" and DATEDIFF(dd,InDate,'{dtpBegin.Value}') <=0 and DATEDIFF(dd,InDate,'{dtpEnd.Value}') >=0"; } if (!string.IsNullOrEmpty(cmbStyle.Text) && !cmbStyle.Text.Equals(@"全部")) { sSql += $@" and MedTypeID = '{cmbStyle.SelectedValue}'"; } if (!string.IsNullOrEmpty(txtKeys.Text)) { sSql += $@" and (MedName like '%{txtKeys.Text}%' or MedSpellFirst like '%{txtKeys.Text}%')"; } DataTable drInMed = ErpServer.GetInMedDataSet(sSql).Tables[0]; dgvMedicine.AutoGenerateColumns = false; dgvMedicine.DataSource = drInMed; lblSum.Text = @"数量:" + drInMed.Rows.Count; drInMed.Dispose(); }
/// <summary> /// 新增修改 /// </summary> /// <param name="patient"></param> /// <param name="medLog"></param> /// <returns></returns> public bool InsertOrUpdatePation(Patient patient, MedLog medLog) { return(ErpServer.InsertOrUpdatePation(patient, medLog)); }
private void InitiData() { try { //主界面控件各类事件 Image.GetThumbnailImageAbort callBack = new Image.GetThumbnailImageAbort(ThumbnailCallback); picShow.Image = Resources.MedicalLogo.GetThumbnailImage(picShow.Width, picShow.Height, callBack, IntPtr.Zero); this.Closing += (sender, args) => Application.Exit(); tsmSettingMenues.DropDownOpened += (sender, args) => tsmSettingMenues.ForeColor = Color.Black; tsmSettingMenues.DropDownClosed += (sender, args) => tsmSettingMenues.ForeColor = Color.White; //权限 tmsLookPat.Enabled = Information.UsePower.ContainsKey(CommonInfo.UserPowers.门诊处方.SafeDbValue <int>()); tsmCheckSetting.Enabled = Information.UsePower.ContainsKey(CommonInfo.UserPowers.检查费调整.SafeDbValue <int>()); tsmSetting.Enabled = Information.UsePower.ContainsKey(CommonInfo.UserPowers.基础设置.SafeDbValue <int>()); tsmThemes.Enabled = Information.UsePower.ContainsKey(CommonInfo.UserPowers.主题变换.SafeDbValue <int>()); tsmPws.Enabled = Information.UsePower.ContainsKey(CommonInfo.UserPowers.密码修改.SafeDbValue <int>()); //加载底部信息栏 JsonRead jsonRead = new JsonRead(); try { string weatherAddress = CallWebPage.CallWeb("http://www.weather.com.cn/data/cityinfo/101040100.html", 60000, Encoding.UTF8); Weather weather = jsonRead.JsonReadInfo(weatherAddress); lblWeather.Text = "城市: " + weather.city + " 天气: " + weather.weather + " 温度: " + weather.temp1 + "-" + weather.temp2; } catch { } lblWelcome.Text = @"欢迎 " + Information.CurrentUser.Name + " " + Information.CurrentUser.DutyName + " "; //提示到期、库存少的药品 DataTable drInMed = ErpServer.GetInMedDataSet(null).Tables[0]; string StockMedicines = string.Empty; string DueDateMedicines = string.Empty; DataRow[] rowsStock = drInMed.Select("Quantity <= 30");//库存少于30 for (int i = 0; i < rowsStock.Length; i++) { StockMedicines += ", " + rowsStock[i]["MedName"].ToString(); } DataRow[] rowsDate = drInMed.Select($@"DueDate <= '{DateTime.Now}'");//药品到了保质期 for (int i = 0; i < rowsStock.Length; i++) { DueDateMedicines += ", " + rowsStock[i]["MedName"].ToString(); } string medicinesInfo = string.Empty; if (!string.IsNullOrEmpty(DueDateMedicines)) { medicinesInfo += "库存少于30的药品:" + DueDateMedicines; } if (!string.IsNullOrEmpty(DueDateMedicines)) { medicinesInfo += "\r\n" + "到了保质期的药品:" + DueDateMedicines; } if (!string.IsNullOrEmpty(medicinesInfo)) { MessageBox.Show(medicinesInfo, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Error); } drInMed.Dispose(); //时间实时刷新 timer1.Start(); } catch (Exception ex) { MessageBox.Show("主界面初始化数据加载失败!" + ex.ToString()); } }
public DataSet GetConfigInfo(int typeID) { return(ErpServer.GetConfigInfo(typeID)); }
public static bool InsertMedicine(Medicine medicine) { return(ErpServer.InsertMedicine(medicine)); }
public static bool InsertInMed(AddMedicine addMedicine) { return(ErpServer.InsertInMed(addMedicine)); }
public bool AddExamine(ExaminePrice examinePrice) { return(ErpServer.AddExamine(examinePrice)); }
/// <summary> /// 删除 /// </summary> /// <param name="patient"></param> /// <returns></returns> public bool DeletePationes(string key) { return(ErpServer.DeletePationes(key)); }
public DataTable GetExamineInfo() { return(ErpServer.GetExamineInfo().Tables[0]); }
private void SaveEmp() { if (string.IsNullOrEmpty(txtID.Text) || string.IsNullOrEmpty(txtName.Text) || string.IsNullOrEmpty(txtPassword.Text) || string.IsNullOrEmpty(cmbDuty.Text)) { MessageBox.Show(@"请完善人员全部信息!"); return; } try { List <EmpPower> lstEmp = new List <EmpPower>(); foreach (TreeNode treeNode in twPower.Nodes)//第一级节点 { if (treeNode.Checked) { EmpPower empPowers = new EmpPower(); empPowers.DocID = txtID.Text.Trim(); empPowers.PowerID = treeNode.Name; lstEmp.Add(empPowers); } foreach (TreeNode item in treeNode.Nodes)//第二级节点 { if (item.Checked) { EmpPower empPowers = new EmpPower(); empPowers.DocID = txtID.Text.Trim(); empPowers.PowerID = item.Name; lstEmp.Add(empPowers); } foreach (TreeNode item1 in item.Nodes)//第三级节点 { if (item1.Checked) { EmpPower empPowers = new EmpPower(); empPowers.DocID = txtID.Text.Trim(); empPowers.PowerID = item1.Name; lstEmp.Add(empPowers); } } } } if (lstEmp.Count == 0) { MessageBox.Show(@"请勾选该员工的权限后保存!"); return; } ErpServer.DeletePower(txtID.Text);//删除权限 Doctor doctor = new Doctor(); doctor.Id = txtID.Text; doctor.Name = txtName.Text; doctor.PassWord = txtPassword.Text; doctor.Gender = cmbGender.Text; doctor.DocAge = txtAge.Text; doctor.PhoneNumber = txtPhoneNum.Text; doctor.DutyId = cmbDuty.SelectedValue.ToString(); if (ErpServer.InsertEmpInfo(doctor, lstEmp)) { MessageBox.Show(@"保存成功!"); this.Close(); } else { MessageBox.Show(@"保存失败,检查后重试!"); } } catch (Exception ex) { MessageBox.Show(@"年龄、电话号码都为纯数字,请检查!" + ex); return; } }
/// <summary> /// 查询 /// </summary> /// <param name="sKey"></param> /// <returns></returns> public DataTable GetPationes(string sKey) { return(ErpServer.GetPationes(sKey).Tables[0]); }
public DataTable GetEmpPower(string EmpId) { return(ErpServer.GetEmpPower(EmpId).Tables[0]); }