/// <summary> /// 根据库存添加科室数据 /// </summary> /// <param name="info"></param> /// <returns></returns> private int AddDeptData(Neusoft.HISFC.Models.Pharmacy.Storage info, decimal storeQty, bool isDetail) { if (isDetail) { int iDetailIndex = this.neuSpread1_Sheet2.Rows.Count; this.neuSpread1_Sheet2.AddRows(iDetailIndex, 1); this.neuSpread1_Sheet2.Cells[iDetailIndex, 0].Text = info.StockDept.Name; //药房名称 this.neuSpread1_Sheet2.Cells[iDetailIndex, 1].Text = info.Item.Name; //药品名称 this.neuSpread1_Sheet2.Cells[iDetailIndex, 2].Text = info.Item.Specs; //药品规格 this.neuSpread1_Sheet2.Cells[iDetailIndex, 3].Text = info.BatchNO; //药品批号 this.neuSpread1_Sheet2.Cells[iDetailIndex, 4].Text = this.GetDivQty(storeQty, info.Item.PackQty, info.Item.PackUnit, info.Item.MinUnit); } else { int iTotIndex = this.neuSpread1_Sheet1.Rows.Count; this.neuSpread1_Sheet1.AddRows(iTotIndex, 1); this.neuSpread1_Sheet1.Cells[iTotIndex, 0].Text = info.StockDept.Name; this.neuSpread1_Sheet1.Cells[iTotIndex, 1].Text = info.Item.Name; this.neuSpread1_Sheet1.Cells[iTotIndex, 2].Text = info.Item.Specs; this.neuSpread1_Sheet1.Cells[iTotIndex, 3].Text = this.GetDivQty(storeQty, info.Item.PackQty, info.Item.PackUnit, info.Item.MinUnit); } return(1); }
/// <summary> /// 将数据加入数据表 /// </summary> /// <param name="storage">库存数据</param> /// <returns>成功返回1 失败返回-1</returns> protected int AddDataToDataTable(Neusoft.HISFC.Models.Pharmacy.Storage storage) { DataRow row = this.dtDeptPreStock.NewRow(); try { row["药品名称"] = storage.Item.Name; row["规格"] = storage.Item.Specs; row["零售价"] = storage.Item.PriceCollection.RetailPrice; if (storage.Producer.ID != "") { row["生产厂家"] = this.produceHelper.GetName(storage.Producer.ID); } row["实际库存"] = storage.StoreQty; row["原预扣量"] = storage.PreOutQty; row["预扣库存"] = storage.PreOutQty; row["单位"] = storage.Item.MinUnit; row["药品编码"] = storage.Item.ID; row["拼音码"] = storage.Item.NameCollection.SpellCode; row["五笔码"] = storage.Item.NameCollection.WBCode; row["自定义码"] = storage.Item.UserCode; } catch (Exception ex) { MessageBox.Show(Language.Msg("根据库存信息对数据行进行赋值时发生错误!") + ex.Message); return(-1); } this.dtDeptPreStock.Rows.Add(row); return(1); }
/// <summary> /// 添加合计/小计信息 /// </summary> /// <param name="info"></param> /// <param name="storeQty"></param> /// <param name="isDetail"></param> /// <returns></returns> private void AddDeptTotData(Neusoft.HISFC.Models.Pharmacy.Storage info, decimal storeQty) { int iDetailIndex = this.neuSpread1_Sheet2.Rows.Count; this.neuSpread1_Sheet2.AddRows(iDetailIndex, 1); this.neuSpread1_Sheet2.Cells[iDetailIndex, 3].Text = "小计数量"; this.neuSpread1_Sheet2.Cells[iDetailIndex, 4].Text = this.GetDivQty(storeQty, info.Item.PackQty, info.Item.PackUnit, info.Item.MinUnit); }
/// <summary> /// 检查库存 /// </summary> /// <param name="iCheck"></param> /// <param name="itemID"></param> /// <param name="itemName"></param> /// <param name="deptCode"></param> /// <param name="qty"></param> /// <returns></returns> public static bool CheckPharmercyItemStock(int iCheck, string itemID, string itemName, string deptCode, decimal qty) { //Neusoft.HISFC.Manager.Item manager = new Neusoft.HISFC.BizLogic.Pharmacy.Item(); //Neusoft.HISFC.Models.Pharmacy.item item = null; //. Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaManager = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy(); Neusoft.HISFC.Models.Pharmacy.Storage phaItem = null; switch (iCheck) { case 0: phaItem = phaManager.GetItemForInpatient(deptCode, itemID); if (phaItem == null) { return(true); } if (qty > Neusoft.FrameWork.Function.NConvert.ToDecimal(phaItem.StoreQty)) { return(false); } break; case 1: phaItem = phaManager.GetItemForInpatient(deptCode, itemID); if (phaItem == null) { return(true); } if (qty > Neusoft.FrameWork.Function.NConvert.ToDecimal(phaItem.StoreQty)) { if (MessageBox.Show("药品【" + itemName + "】的库存不够!是否继续执行!", "提示库存不足", MessageBoxButtons.OKCancel) == DialogResult.OK) { return(true); } else { return(false); } } break; case 2: break; default: return(true); } return(true); }
/// <summary> /// 向FarPoint内加入数据 /// 添加了货位好的显示 /// add by zengft 2007-4-30 /// </summary> /// <param name="item">药品实体</param> public void AddData(Neusoft.HISFC.Models.Pharmacy.Item item, string deptCode) { if (item == null) { return; } //add by zengft 2007-4-30 Neusoft.HISFC.BizLogic.Pharmacy.Item itm = new Neusoft.HISFC.BizLogic.Pharmacy.Item(); Neusoft.HISFC.Models.Pharmacy.Storage s = new Neusoft.HISFC.Models.Pharmacy.Storage(); s = itm.GetStockInfoByDrugCode(deptCode, item.ID); //end add int iRow = this.fpSpread1_Sheet1.Rows.Count; this.fpSpread1_Sheet1.Rows.Add(iRow, 1); this.fpSpread1_Sheet1.Cells[iRow, (int)ColEnum.ColTradeName].Text = item.Name; this.fpSpread1_Sheet1.Cells[iRow, (int)ColEnum.ColSpecs].Text = item.Specs; if (item.PackQty == 0) { item.PackQty = 1; } if (item.Type.ID == "C") { this.fpSpread1_Sheet1.Cells[iRow, (int)ColEnum.ColPrice].Text = System.Math.Round((item.PriceCollection.RetailPrice / item.PackQty), 4).ToString(); } else { this.fpSpread1_Sheet1.Cells[iRow, (int)ColEnum.ColPrice].Text = System.Math.Round((item.PriceCollection.RetailPrice / item.PackQty), 2).ToString(); } if (IsClinic) { if (item.SplitType.Equals(0)) { this.fpSpread1_Sheet1.Cells[iRow, (int)ColEnum.ColUnit].Text = item.MinUnit; } else { this.fpSpread1_Sheet1.Cells[iRow, (int)ColEnum.ColUnit].Text = item.PackUnit; } } else { this.fpSpread1_Sheet1.Cells[iRow, (int)ColEnum.ColUnit].Text = item.MinUnit; } this.fpSpread1_Sheet1.Rows[iRow].Tag = item; this.fpSpread1_Sheet1.Cells[iRow, (int)ColEnum.ColPlace].Text = s.PlaceNO; }
/// <summary> /// 将数据加入DataTable /// </summary> /// <param name="storage"></param> /// <returns></returns> private void AddDataToTable(Neusoft.HISFC.Models.Pharmacy.Storage storage) { DataRow dr = this.dt.NewRow(); dr["药品编码"] = storage.Item.ID; dr["商品名称"] = storage.Item.Name; dr["规格"] = storage.Item.Specs; dr["拼音码"] = storage.Item.NameCollection.SpellCode; dr["五笔码"] = storage.Item.NameCollection.WBCode; dr["自定义码"] = storage.Item.NameCollection.UserCode; this.dt.Rows.Add(dr); }
/// <summary> /// 根据药品编码与批次号加入入库退库信息 /// </summary> /// <param name="drugNO"></param> /// <param name="groupNO"></param> /// <returns></returns> protected virtual int AddInData(string drugNO, int groupNO) { if (this.hsInData.ContainsKey(drugNO + groupNO)) { MessageBox.Show(Language.Msg("该药品已添加")); return(0); } ArrayList alDetail = this.itemManager.QueryStorageList(this.phaInManager.DeptInfo.ID, drugNO, groupNO); if (alDetail == null || alDetail.Count == 0) { MessageBox.Show(Language.Msg("未获取有效的库存明细信息" + this.itemManager.Err)); return(-1); } Neusoft.HISFC.Models.Pharmacy.Storage storage = alDetail[0] as Neusoft.HISFC.Models.Pharmacy.Storage; Neusoft.HISFC.Models.Pharmacy.Input input = new Neusoft.HISFC.Models.Pharmacy.Input(); input.StockDept = storage.StockDept; //库存科室 input.TargetDept = this.phaInManager.TargetDept; //目标科室 input.Company = this.phaInManager.TargetDept; input.Item = storage.Item; input.GroupNO = storage.GroupNO; input.Quantity = storage.StoreQty; //入库量 = 库存量 input.BatchNO = storage.BatchNO; input.ValidTime = storage.ValidTime; input.PlaceNO = storage.PlaceNO; input.InvoiceNO = storage.InvoiceNO; input.Producer = storage.Producer; input.Memo = storage.Memo; input.PrivType = this.phaInManager.PrivType.ID; //入库类型 input.SystemType = this.phaInManager.PrivType.Memo; //系统类型 if (this.AddDataToTable(input) == 1) { this.hsInData.Add(this.GetKey(input), input); } this.SetFormat(); this.SetFocusSelect(); return(1); }
/// <summary> /// 判断零售价的一致性 /// </summary> /// <param name="deptCode">科室编码</param> /// <param name="item">药品项目信息</param> /// <returns></returns> public static bool JudgePriceConsinstency(string deptCode, Neusoft.HISFC.Models.Pharmacy.Item item) { Neusoft.HISFC.BizLogic.Pharmacy.Item itemManager = new Neusoft.HISFC.BizLogic.Pharmacy.Item(); Neusoft.HISFC.Models.Pharmacy.Storage sourceStorage = itemManager.GetStockInfoByDrugCode(deptCode, item.ID); if (sourceStorage == null) { MessageBox.Show(Language.Msg("获取源科室库存汇总信息发生错误") + itemManager.Err); return(false); } if (sourceStorage.Item.ID != "") { if (sourceStorage.Item.PriceCollection.RetailPrice != item.PriceCollection.RetailPrice) { return(false); } } return(true); }
/// <summary> /// 价格判断处理 /// </summary> public static int SetPrice(string deptCode, string drugCode, ref Neusoft.HISFC.Models.Pharmacy.Item item) { //取药品字典信息 Neusoft.HISFC.BizLogic.Pharmacy.Item itemManager = new Neusoft.HISFC.BizLogic.Pharmacy.Item(); Neusoft.HISFC.Models.Pharmacy.Storage storage = itemManager.GetStockInfoByDrugCode(deptCode, drugCode); if (storage == null) { MessageBox.Show(Language.Msg("获取科室库存汇总信息发生错误") + itemManager.Err); return(-1); } if (storage.Item.ID != "") { if (item.PriceCollection.RetailPrice != storage.Item.PriceCollection.RetailPrice) { MessageBox.Show(Language.Msg("请注意!" + item.Name + " 该药品已进行过单科调价。"), "", MessageBoxButtons.OK, MessageBoxIcon.Information); } item.PriceCollection.RetailPrice = storage.Item.PriceCollection.RetailPrice; } return(1); }
/// <summary> /// 获取散包装货位号 /// </summary> private static string GetStaticPlaceNO(string deptCode, string drugCode) { return(""); if (hsStaticPlaceNO.ContainsKey(deptCode + drugCode)) { return(hsStaticPlaceNO[deptCode + drugCode].ToString()); } else { Neusoft.HISFC.Models.Pharmacy.Storage storage = itemManager.GetStockInfoByDrugCode(deptCode, drugCode); if (storage == null) { return(""); } hsStaticPlaceNO.Add(deptCode + drugCode, storage.Memo); //hsDosage.Add(drugCode, dosageHelper.GetName(storage.Item.DosageForm.ID)); return(storage.Memo); } }
/// <summary> /// 显示库存数量 /// </summary> /// <param name="drugCode"></param> /// <returns></returns> public int SetValue(string drugCode) { this.storeArrayList = this.itemManager.QueryStoreDeptList(drugCode); if (storeArrayList == null) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg(this.itemManager.Err)); return(-1); } decimal littleTotStorage = 0; //小计总数量 decimal pactNum = 1; decimal totStorage = 0; string privDeptCode = string.Empty; string minUnit = ""; string pactUnit = ""; //就一条信息 if (this.storeArrayList.Count == 1) { #region 添加一条信息进行处理 Neusoft.HISFC.Models.Pharmacy.Storage info = this.storeArrayList[0] as Neusoft.HISFC.Models.Pharmacy.Storage; //添加明细 this.AddDeptData(info, info.StoreQty, false); this.AddDeptData(info, info.StoreQty, true); //添加小计 this.AddDeptTotData(info, info.StoreQty); #endregion } else { #region 存在多条信息 Neusoft.HISFC.Models.Pharmacy.Storage privStorage = null; foreach (Neusoft.HISFC.Models.Pharmacy.Storage info in this.storeArrayList) { this.Text = info.Item.Name + "[" + info.Item.Specs + "] - 各药房库存分布"; minUnit = info.Item.MinUnit; pactUnit = info.Item.PackUnit; pactNum = info.Item.PackQty; #region 换科室了(第一条不处理) 添加小计数量 if (privDeptCode != info.StockDept.ID && privDeptCode != string.Empty) { //添加明细的小计 this.AddDeptTotData(info, littleTotStorage); //添加汇总信息 this.AddDeptData(privStorage, littleTotStorage, false); littleTotStorage = 0; } #endregion littleTotStorage += info.StoreQty; totStorage += info.StoreQty; privDeptCode = info.StockDept.ID; //添加明细信息 this.AddDeptData(info, info.StoreQty, true); privStorage = info.Clone(); } //添加明细的小计 this.AddDeptTotData(privStorage, littleTotStorage); //添加汇总信息 this.AddDeptData(privStorage, littleTotStorage, false); #endregion } if (this.neuSpread1_Sheet2.RowCount > 0) { this.neuSpread1_Sheet2.AddRows(this.neuSpread1_Sheet2.RowCount, 1); this.neuSpread1_Sheet2.Cells[this.neuSpread1_Sheet2.RowCount - 1, 3].Text = "合计数量"; //药品批号 this.neuSpread1_Sheet2.Cells[this.neuSpread1_Sheet2.RowCount - 1, 4].Text = this.GetDivQty(totStorage, pactNum, pactUnit, minUnit); this.neuSpread1_Sheet1.AddRows(this.neuSpread1_Sheet1.RowCount, 1); this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, 2].Text = "合计数量"; //药品批号 this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, 3].Text = this.GetDivQty(totStorage, pactNum, pactUnit, minUnit); } return(1); }
/// <summary> /// 打印 /// </summary> /// <param name="sender"></param> /// <param name="neuObject"></param> /// <returns></returns> protected override int OnPrint(object sender, object neuObject) { //this.neuPanel7.Dock = DockStyle.Top; //int iHeight = 200; //DialogResult dr = MessageBox.Show("是否只打印选择的数据,选“否”则打印全部!", "打印提示", MessageBoxButtons.YesNoCancel); //if (dr == DialogResult.Yes) //{ // for (int i = 0; i < this.fpDrugList.RowCount; i++) // { // if (this.fpDrugList.IsSelected(i, 0) == false) // { // this.fpDrugList.Rows[i].Visible = false; // } // iHeight = iHeight + 20; // } //} //else if (dr == DialogResult.No) //{ // for (int i = 0; i < this.fpDrugList.RowCount; i++) // { // iHeight = iHeight + 20; // } //} //else //{ // return 1; //} //this.neuPanel7.Height = iHeight; //Neusoft.FrameWork.WinForms.Classes.Print printObj = new Neusoft.FrameWork.WinForms.Classes.Print(); //Neusoft.HISFC.Models.Base.PageSize ps = new Neusoft.HISFC.Models.Base.PageSize("", this.neuPanel7.Width, iHeight); //printObj.SetPageSize(ps); //printObj.IsDataAutoExtend = false; //printObj.PrintPreview(10, 10, this.neuPanel7); //this.neuPanel7.Dock = DockStyle.Fill; //return base.OnPrint(sender, neuObject); //if (this.lbTitle.Text == "明细") //{ #region donggq--20101123--{CA546AEB-3968-48ea-9CAE-D03832216326} if (string.IsNullOrEmpty(this.txtCaseNO.Text) && string.IsNullOrEmpty(this.txtFilter.Text)) { if (this.printInterface == null) { InitPrintInterface(); } ArrayList drugList = null; this.billClass.User01 = "NurseType"; //{31607136-EF3D-46af-A2F9-EE96F6F9209C} if (this.rbRetail.Checked) //{CC985758-A2AE-41da-9394-34AFCEB0E30E} { drugList = this.drugItem.QueryApplyOutListDetailByBillClassCode(this.tvSelectType.SelectedNode.Tag.ToString(), this.tvSelectType.SelectedNode.Parent.Tag.ToString(), this.dtpStartDate.Value.Date.ToString(), this.dtpEndDate.Value.Date.AddDays(1).ToString(), "2"); this.billClass.PrintType.ID = "D"; } else if (this.rbTotal.Checked) { drugList = this.drugItem.QueryApplyOutListTotByBillClassCode(this.tvSelectType.SelectedNode.Tag.ToString(), this.tvSelectType.SelectedNode.Parent.Tag.ToString(), this.dtpStartDate.Value.Date.ToString(), this.dtpEndDate.Value.Date.AddDays(1).ToString(), "2"); this.billClass.PrintType.ID = "T"; } if (drugList != null) { foreach (Neusoft.HISFC.Models.Pharmacy.ApplyOut outObj in drugList) { Neusoft.HISFC.Models.Pharmacy.Storage storage = drugItem.GetStockInfoByDrugCode(outObj.StockDept.Name, outObj.Item.ID); Neusoft.HISFC.Models.Pharmacy.Item itemObj = drugItem.GetItem(outObj.Item.ID); outObj.PlaceNO = storage.PlaceNO; outObj.Item.UserCode = itemObj.UserCode; } if (this.printInterface != null) { this.printInterface.AddAllData(drugList, this.billClass); this.printInterface.Preview(); } } } else { Neusoft.FrameWork.WinForms.Classes.Print p = new Neusoft.FrameWork.WinForms.Classes.Print(); p.PrintPage(0, 30, this.neuPanel7); } #endregion //} return(1); }