//{32553EB6-EF4D-4c61-A63A-17B3C850FC51}
        private void fpSpread1_SelectionChanged(object sender, FarPoint.Win.Spread.SelectionChangedEventArgs e)
        {
            int row = this.fpSpread1_Sheet1.ActiveRowIndex;

            if (this.fpSpread1_Sheet1.RowCount == 0)
            {
                return;
            }

            //{F26216A3-5256-40e8-BB6D-3D1C51B5F4BE} 通过1,2,3,4,5选择 20100102 yoyi++
            int curViewportTop = this.fpSpread1.GetViewportTopRow(0);

            this.fpSpread1_Sheet1.StartingRowNumber = 0 - curViewportTop + 1;

            string itemCode = this.fpSpread1_Sheet1.Cells[row, (int)Cols.ItemCode].Text;

            if (string.IsNullOrEmpty(itemCode))
            {
                return;
            }

            // GetDisplaySI(itemCode);

            string drugFlag = this.fpSpread1_Sheet1.Cells[row, (int)Cols.DrugFlag].Text;

            if (drugFlag.Trim() == "4")//协定处方
            {
                this.neuGroupBox1.Visible = true;
                this.neuGroupBox1.Width   = 233;

                List <Neusoft.HISFC.Models.Pharmacy.Nostrum> drugCombList = this.pharmacyIntegrage.QueryNostrumDetail(itemCode);
                if (drugCombList == null)
                {
                    MessageBox.Show("获得药品协议处方明细出错!" + this.pharmacyIntegrage.Err);

                    return;
                }

                this.neuSpread1_Sheet1.RowCount = 0;
                this.neuSpread1_Sheet1.RowCount = drugCombList.Count;

                for (int i = 0; i < drugCombList.Count; i++)
                {
                    Neusoft.HISFC.Models.Pharmacy.Nostrum n = drugCombList[i];

                    this.neuSpread1_Sheet1.Cells[i, 0].Text = n.Item.Name;
                    this.neuSpread1_Sheet1.Cells[i, 1].Text = n.Item.Price.ToString();
                    this.neuSpread1_Sheet1.Cells[i, 2].Text = n.Qty.ToString();
                }
            }
            else
            {
                this.neuGroupBox1.Visible = false;
                this.neuGroupBox1.Width   = 0;
            }
        }
示例#2
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <returns></returns>
        protected int AddNewNostrumDetail()
        {
            if (this.tvNostrumList.SelectedNode.Tag == null)
            {
                MessageBox.Show("请选择所要维护的项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(-1);
            }

            if (this.IsCanEdit() == false)          //不允许进行编辑
            {
                return(-1);
            }

            Neusoft.HISFC.Models.Pharmacy.Item selectItem = (Neusoft.HISFC.Models.Pharmacy.Item) this.tvNostrumList.SelectedNode.Tag;
            string pcode  = selectItem.ID;
            string pname  = selectItem.Name + "[" + selectItem.Specs + "]";
            string itemID = this.fsDrugListSheet.GetText(this.fsDrugListSheet.ActiveRowIndex, 3);

            //判断是否存在该药品
            if (this.IsNewLineExists(pcode, itemID))
            {
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("组套明细已经存在改处方项目"));
                return(-1);
            }

            Neusoft.HISFC.Models.Pharmacy.Item detailItem = this.itemManager.GetItem(itemID);
            if (detailItem == null)
            {
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("根据药品编码获取药品明细信息发生错误  ") + this.itemManager.Err);
                return(-1);
            }

            Neusoft.HISFC.Models.Pharmacy.Nostrum nostrum = new Neusoft.HISFC.Models.Pharmacy.Nostrum();
            nostrum.ID   = pcode;
            nostrum.Name = pname;

            nostrum.Item = detailItem;

            nostrum.Qty = NConvert.ToDecimal(1);

            nostrum.IsValid = true;
            nostrum.SortNO  = 1;

            //从药品列表添加到处方列表中
            CreateNewLineInFpDetails(nostrum);

            this.fsNostrumDetail.Focus();
            this.fsNostrumDetailSheet.ActiveColumnIndex = (int)NostrumDetailColumn.ColQty;

            return(1);
        }
示例#3
0
        /// <summary>
        /// 在协定处方列表中加入一列
        /// </summary>
        /// <param name="info"></param>
        private void CreateNewLineInFpDetails(Neusoft.HISFC.Models.Pharmacy.Nostrum info)
        {
            this.fsNostrumDetailSheet.Rows.Add(0, 1);

            this.fsNostrumDetailSheet.SetText(0, (int)NostrumDetailColumn.ColID, info.ID);
            this.fsNostrumDetailSheet.SetText(0, (int)NostrumDetailColumn.ColItemID, info.Item.ID);
            this.fsNostrumDetailSheet.SetText(0, (int)NostrumDetailColumn.ColName, info.Name);
            this.fsNostrumDetailSheet.SetText(0, (int)NostrumDetailColumn.ColItemName, info.Item.Name);
            this.fsNostrumDetailSheet.SetText(0, (int)NostrumDetailColumn.ColQty, info.Qty.ToString());
            this.fsNostrumDetailSheet.SetText(0, (int)NostrumDetailColumn.ColUnit, info.Item.MinUnit);
            this.fsNostrumDetailSheet.SetValue(0, (int)NostrumDetailColumn.ColValid, info.IsValid);
            this.fsNostrumDetailSheet.SetText(0, (int)NostrumDetailColumn.ColSortNO, info.SortNO.ToString());
            this.fsNostrumDetailSheet.SetValue(0, (int)NostrumDetailColumn.ColFlug, 1);


            this.fsNostrumDetailSheet.SetValue(0, (int)NostrumDetailColumn.ColPriceR, info.Item.PriceCollection.RetailPrice);
            this.fsNostrumDetailSheet.SetValue(0, (int)NostrumDetailColumn.ColPriceP, info.Item.PriceCollection.PurchasePrice);

            this.fsNostrumDetailSheet.SetValue(0, (int)NostrumDetailColumn.ColSumR, Math.Round(info.Item.PriceCollection.RetailPrice * info.Qty / info.Item.PackQty, 2));

            this.fsNostrumDetailSheet.SetValue(0, (int)NostrumDetailColumn.ColSumP, Math.Round(info.Item.PriceCollection.PurchasePrice * info.Qty / info.Item.PackQty, 2));
        }
示例#4
0
        /// <summary>
        /// 保存和更新协定处方信息
        /// </summary>
        private void SaveButtonHandler()
        {
            if (this.fsNostrumDetailSheet.Rows.Count == 0)
            {
                return;
            }

            if (this.IsCanEdit() == false)          //不允许进行编辑
            {
                return;
            }

            if (MessageBox.Show("请确认已录入的信息是否正确?保存后将不能再进行修改", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            //更新cell值
            this.fsNostrumDetail.StopCellEditing();

            //{AB3CDE46-C95D-4a6f-96FF-E970F8C84523}防止数量输入过大
            if (this.ValidNum() == false)
            {
                return;
            }


            //用于插入的协定处方列表
            List <Neusoft.HISFC.Models.Pharmacy.Nostrum> lstNostrumInsert = new List <Neusoft.HISFC.Models.Pharmacy.Nostrum>();
            //用于更新的协定处方列表
            List <Neusoft.HISFC.Models.Pharmacy.Nostrum> lstNostrumUpdate = new List <Neusoft.HISFC.Models.Pharmacy.Nostrum>();
            //协定处方ID
            string nostrumID = "";

            #region 将协定处方的详细信息列表转化为实体

            for (int i = 0, j = this.fsNostrumDetailSheet.Rows.Count; i < j; i++)
            {
                Neusoft.HISFC.Models.Pharmacy.Nostrum nostrum = new Neusoft.HISFC.Models.Pharmacy.Nostrum();
                nostrum.ID            = this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColID).Trim();
                nostrum.Item.ID       = this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColItemID).Trim();
                nostrum.Name          = this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColName).Trim().Split('[')[0].ToString();
                nostrum.Item.Name     = this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColItemName).Trim();
                nostrum.Item.Specs    = this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColName).Trim().Split('[')[1].Split(']')[0].ToString();
                nostrum.Qty           = NConvert.ToDecimal(this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColQty).Trim());
                nostrum.Item.MinUnit  = this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColUnit).Trim();
                nostrum.IsValid       = NConvert.ToBoolean(this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColValid).Trim());
                nostrum.SortNO        = NConvert.ToInt32(this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColSortNO));
                nostrum.Oper.ID       = Neusoft.FrameWork.Management.Connection.Operator.ID;
                nostrum.Oper.OperTime = itemManager.GetDateTimeFromSysDateTime();

                //如果是新插入的列放入插入列表
                if (NConvert.ToInt32(this.fsNostrumDetailSheet.GetText(i, (int)NostrumDetailColumn.ColFlug)) == 1)
                {
                    lstNostrumInsert.Add(nostrum);
                }
                //如果是已有的列放入更新列表
                else
                {
                    lstNostrumUpdate.Add(nostrum);
                }

                nostrumID = nostrum.ID;
            }
            #endregion

            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
            itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            try
            {
                //插入新添的数据
                for (int i = 0, j = lstNostrumInsert.Count; i < j; i++)
                {
                    if (itemManager.InsertNostrum(lstNostrumInsert[i]) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("保存数据失败") + itemManager.Err);
                        return;
                    }
                }

                //更新已有的数据
                for (int i = 0, j = lstNostrumUpdate.Count; i < j; i++)
                {
                    if (itemManager.UpdateNostrum(lstNostrumUpdate[i]) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("保存数据失败") + itemManager.Err);
                        return;
                    }
                }
                //对新增药品更新价格
                if (this.itemManager.UpdateNostrumPrice(nostrumID) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("保存数据失败") + this.itemManager.Err);
                    return;
                }

                Neusoft.FrameWork.Management.PublicTrans.Commit();
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("保存数据成功"));

                for (int i = 0, j = this.fsDrugListSheet.RowCount; i < j; i++)
                {
                    this.fsNostrumDetailSheet.SetValue(0, (int)NostrumDetailColumn.ColFlug, 0);
                }
            }
            catch
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();;
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("保存数据失败"));
            }

            this.tvNostrumList.SelectedNode = this.tvNostrumList.Nodes[0];
        }