Ejemplo n.º 1
0
        void controller_AfterBudgetEndEvent(object sender, AfterBudgetEndArgs e)
        {
            if (e.Success)
            {
                //向用户展示结算信息
                FrmChargeInfo frmChargeInfo = new FrmChargeInfo(e.TotalBugetInfo);
                if (frmChargeInfo.ShowDialog( ) == DialogResult.Cancel)
                {
                    e.ChargeController.CancelCharge( );
                    return;
                }

                //防止在允许收手工录入医保支付或农合补偿金额情况下结算多张处方,
                if (frmChargeInfo.ReturnChargeInfo.VillageFee > 0 &&
                    e.BudgetInfos.Length > 1 && Convert.ToInt16(HIS.MZ_BLL.OPDParamter.Parameters["002"]) == 0)
                {
                    MessageBox.Show("如果是手工录入的农合补偿金额,每次只能结算一张处方!", "", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return;
                }
                HIS.MZ_BLL.ChargeInfo[] chargeInfos = e.BudgetInfos;
                e.ChargeController.SetChargeInfoPay(ref chargeInfos, frmChargeInfo.ReturnChargeInfo.VillageFee,
                                                    frmChargeInfo.ReturnChargeInfo.PosFee,
                                                    frmChargeInfo.ReturnChargeInfo.CashFee,
                                                    frmChargeInfo.ReturnChargeInfo.SelfTally);
                e.BudgetInfos = chargeInfos;
                frmPreviousInfo.ActiveGetMoney = frmChargeInfo.ActPay.ToString(decimalFormat);
                frmPreviousInfo.ReturnMoney    = frmChargeInfo.ReturnMoney.ToString(decimalFormat);
                controller.Balance(e);
            }
            else
            {
                MessageBox.Show(e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// 预算
        /// </summary>
        public void Budget()
        {
            OutPatient patient = PatientConvert.ConvertPatient((UIOutPatient)formView.Patient);

            Prescription[] prescriptions = GetPrescriptionsFromDataTable();

            List <Prescription> lstPrescription = new List <Prescription>( );

            for (int i = 0; i < prescriptions.Length; i++)
            {
                if (prescriptions[i].Selected)
                {
                    lstPrescription.Add(prescriptions[i]);
                }
            }
            prescriptions = lstPrescription.ToArray( );

            HIS.MZ_BLL.ChargeControl chargeController = new ChargeControl(patient, formView.CurrentEmployeeId);

            AfterBudgetEndArgs e = new AfterBudgetEndArgs( );

            e.ChargeController = chargeController;
            try
            {
                ChargeInfo[] chargeInfos = chargeController.Budget(prescriptions);
                e.BudgetInfos = chargeInfos;
                ChargeInfo chargeInfo = new ChargeInfo( );
                for (int i = 0; i < chargeInfos.Length; i++)
                {
                    chargeInfo.TotalFee   += chargeInfos[i].TotalFee;
                    chargeInfo.FavorFee   += chargeInfos[i].FavorFee;
                    chargeInfo.SelfFee    += chargeInfos[i].SelfFee;
                    chargeInfo.VillageFee += chargeInfos[i].VillageFee;
                }
                e.TotalBugetInfo = chargeInfo;
                e.Prescriptions  = prescriptions;
                e.Success        = true;
            }
            catch (Exception err)
            {
                e.Success = false;
                e.Message = err.Message;
            }

            if (AfterBudgetEndEvent != null)
            {
                AfterBudgetEndEvent(this, e);
            }
        }
        /// <summary>
        /// 结算
        /// </summary>
        /// <param name="e">预算的消息参数</param>
        public void Balance(AfterBudgetEndArgs e)
        {
            Invoice[]           invoicies;
            ChargeInfo[]        chargeInfos = e.BudgetInfos;
            AfterBalanceEndArgs even        = new AfterBalanceEndArgs( );

            try
            {
                bool ret = e.ChargeController.Charge(chargeInfos, e.Prescriptions, out invoicies);
                even.Success     = ret;
                even.Invoices    = invoicies;
                even.BalanceInfo = e.TotalBugetInfo;
            }
            catch (Exception err)
            {
                even.Success = false;
                even.Cancel  = true;
                even.Message = err.Message;
            }


            if (AfterBalanceEndEvent != null)
            {
                AfterBalanceEndEvent(this, even);
            }

            try
            {
                string perfChar         = "";
                string currentInvoiceNo = HIS.MZ_BLL.InvoiceManager.GetBillNumber(OPDBillKind.门诊收费发票, formView.CurrentEmployeeId, true, out perfChar);
                formView.InvoicePerfChar  = perfChar;
                formView.CurrentInvoiceNo = currentInvoiceNo;
            }
            catch (Exception err)
            {
                throw err;
            }
        }