Example #1
0
        /// <summary>
        /// 获得发票信息
        /// </summary>
        protected virtual void QueryBalances()
        {
            string invoiceNo = this.tbInvoiceNo.Text.Trim();

            this.Clear();
            invoiceNo   = invoiceNo.PadLeft(12, '0');
            comBalances = outpatientManager.QueryBalancesSameInvoiceCombNOByInvoiceNO(invoiceNo);
            if (comBalances == null)
            {
                MessageBox.Show("获得发票信息出错!" + outpatientManager.Err);
                currentBalance = null;

                return;
            }
            if (comBalances.Count == 0)
            {
                MessageBox.Show("您输入的发票号码不存在,请查证再输入");
                currentBalance = null;
                this.tbInvoiceNo.SelectAll();
                this.tbInvoiceNo.Focus();

                return;
            }

            Balance balanceInfo = comBalances[0] as Balance;

            if (balanceInfo.Patient.Pact.ID != "01")
            {
                MessageBox.Show("不是现金患者,不能打印");
                return;
            }

            decimal totCost = 0, ownCost = 0, payCost = 0, pubCost = 0;

            if (comBalances.Count > 1)
            {
                bool   isSelect = false;
                string SeqNo    = "";
                foreach (Balance balance in comBalances)
                {
                    if (SeqNo == "")
                    {
                        SeqNo = balance.CombNO;

                        continue;
                    }
                    else
                    {
                        if (SeqNo != balance.CombNO)
                        {
                            isSelect = true;
                        }
                    }
                }

                if (isSelect)
                {
                    Neusoft.HISFC.Components.OutpatientFee.Controls.ucInvoiceSelect ucSelect = new Neusoft.HISFC.Components.OutpatientFee.Controls.ucInvoiceSelect();

                    ucSelect.Add(comBalances);

                    Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(ucSelect);

                    Neusoft.HISFC.Models.Fee.Outpatient.Balance selectInvoice = ucSelect.SelectedBalance;
                    if (selectInvoice == null || selectInvoice.Invoice.ID == null || selectInvoice.Invoice.ID == "")
                    {
                        MessageBox.Show("您没有选择发票,请重新输入选择!");
                        currentBalance = null;
                        this.tbInvoiceNo.SelectAll();
                        this.tbInvoiceNo.Focus();

                        return;
                    }

                    comBalances = outpatientManager.QueryBalancesByInvoiceSequence(selectInvoice.CombNO);
                    if (comBalances == null)
                    {
                        MessageBox.Show("获得发票信息出错!" + outpatientManager.Err);
                        currentBalance = null;
                        this.tbInvoiceNo.SelectAll();
                        this.tbInvoiceNo.Focus();

                        return;
                    }
                }
                string tempInvoiceNO = "";
                foreach (Balance balance in comBalances)
                {
                    tempInvoiceNO += balance.Invoice.ID + "\n";
                    totCost       += balance.FT.TotCost;
                    ownCost       += balance.FT.OwnCost;
                    payCost       += balance.FT.PayCost;
                    pubCost       += balance.FT.PubCost;
                }

                MessageBox.Show("该发票共应" + comBalances.Count + "张!分别为: \n" + tempInvoiceNO + "\n请把以上发票都收回!");
            }
            else
            {
                string tempInvoiceNO = "";
                foreach (Balance balance in comBalances)
                {
                    tempInvoiceNO += balance.Invoice.ID + "\n";
                    totCost       += balance.FT.TotCost;
                    ownCost       += balance.FT.OwnCost;
                    payCost       += balance.FT.PayCost;
                    pubCost       += balance.FT.PubCost;
                }
            }

            currentBalance = (comBalances[0] as Balance).Clone();
            if (currentBalance.CancelType != Neusoft.HISFC.Models.Base.CancelTypes.Valid)
            {
                MessageBox.Show("您输入的发票号码已经作废,请查证再输入");
                currentBalance = null;
                this.tbInvoiceNo.SelectAll();
                this.tbInvoiceNo.Focus();

                return;
            }

            this.tbInvoiceNo.Text = currentBalance.Invoice.ID;
            this.tbPName.Text     = currentBalance.Patient.Name;

            Neusoft.HISFC.Models.Base.Employee employee = this.managerIntegrate.GetEmployeeInfo(currentBalance.BalanceOper.ID);
            if (employee == null)
            {
                MessageBox.Show("获得当前发票操作员信息失败!" + this.managerIntegrate.Err);
            }

            this.tbOperName.Text = employee.Name;
            this.tbPactInfo.Text = currentBalance.Patient.Pact.Name;


            this.tbTotCost.Text = totCost.ToString();
            this.tbOwnCost.Text = ownCost.ToString();
            this.tbPayCost.Text = payCost.ToString();
            this.tbPubCost.Text = pubCost.ToString();

            this.tbInvoiceDate.Text = currentBalance.BalanceOper.OperTime.ToString();

            if (!FillBalanceLists(currentBalance.CombNO))
            {
                MessageBox.Show("获得发票明细信息出错!" + outpatientManager.Err);

                return;
            }

            comFeeItemLists = outpatientManager.QueryFeeItemListsByInvoiceSequence(currentBalance.CombNO);
            if (comFeeItemLists == null)
            {
                MessageBox.Show("获得患者费用明细出错!");

                return;
            }

            this.btOk.Focus();
        }