Пример #1
0
        /// <summary>
        /// 正式结算
        /// </summary>
        /// <param name="BudgetaryChargeInfos">预算信息</param>
        /// <param name="prescriptions">要结算的处方,该处方对象经过预算方法处理</param>
        /// <returns>true:结算成功,false:结算失败</returns>
        public override bool Charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
        {
            MSAccessDb.BeginTrans( );

            try
            {
                for (int chargeCount = 0; chargeCount < BudgetaryChargeInfos.Length; chargeCount++)
                {
                    //if ( BindEntity<MZ_CostMaster>.CreateInstanceDAL( oleDb ).Exists( BudgetaryChargeInfos[chargeCount].ChargeID ) )
                    if (MSAccessDb.Exists("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + BudgetaryChargeInfos[chargeCount].ChargeID))
                    {
                        HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster( );
                        //chargeBill = BindEntity<MZ_CostMaster>.CreateInstanceDAL( oleDb ).GetModel( BudgetaryChargeInfos[chargeCount].ChargeID );
                        chargeBill             = (MZ_CostMaster)MSAccessDb.GetModel("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + BudgetaryChargeInfos[chargeCount].ChargeID, typeof(MZ_CostMaster));
                        chargeBill.Self_Fee    = BudgetaryChargeInfos[chargeCount].SelfFee;
                        chargeBill.Village_Fee = BudgetaryChargeInfos[chargeCount].VillageFee;
                        chargeBill.Favor_Fee   = BudgetaryChargeInfos[chargeCount].FavorFee;
                        chargeBill.Pos_Fee     = BudgetaryChargeInfos[chargeCount].PosFee;
                        chargeBill.Money_Fee   = BudgetaryChargeInfos[chargeCount].CashFee;
                        chargeBill.Self_Tally  = BudgetaryChargeInfos[chargeCount].SelfTally;
                        chargeBill.Ticket_Flag = 0;
                        chargeBill.CostDate    = DateTime.Now;
                        chargeBill.Record_Flag = 0;
                        string perfCode = "";
                        chargeBill.TicketNum  = InvoiceManager.GetBillNumber(OPDBillKind.门诊收费发票, OperatorId, false, out perfCode);
                        chargeBill.TicketCode = perfCode;//BudgetaryChargeInfos[chargeCount].InvoiceNO;

                        BudgetaryChargeInfos[chargeCount].InvoiceSerialNO = Convert.ToInt32(chargeBill.TicketNum);
                        BudgetaryChargeInfos[chargeCount].InvoiceNO       = chargeBill.TicketNum;
                        BudgetaryChargeInfos[chargeCount].PerfChar        = perfCode;
                        BudgetaryChargeInfos[chargeCount].ChargeDate      = chargeBill.CostDate;

                        MSAccessDb.UpdateRecord(chargeBill);

                        //更新处方表收费标识
                        //List<MZ_PresMaster> lstPresMaster = BindEntity<MZ_PresMaster>.CreateInstanceDAL( oleDb ).GetListArray( HIS.BLL.Tables.mz_presmaster.COSTMASTERID + " = " + BudgetaryChargeInfos[chargeCount].ChargeID );
                        List <MZ_PresMaster> lstPresMaster = MSAccessDb.GetListArray <MZ_PresMaster>("MZ_PRESMASTER", Tables.mz_presmaster.COSTMASTERID + " = " + BudgetaryChargeInfos[chargeCount].ChargeID);
                        if (lstPresMaster.Count == 0)
                        {
                            throw new Exception("没有找到要结算的处方,请确认是否已被人收费");
                        }
                        foreach (MZ_PresMaster mz_presmaster in lstPresMaster)
                        {
                            if (mz_presmaster.Charge_Flag == 0)
                            {
                                mz_presmaster.Charge_Flag = 1;
                                mz_presmaster.TicketCode  = perfCode;
                                mz_presmaster.TicketNum   = chargeBill.TicketNum;
                                mz_presmaster.ChargeCode  = OperatorId.ToString( );
                                //BindEntity<MZ_PresMaster>.CreateInstanceDAL( oleDb ).Update( mz_presmaster );
                                MSAccessDb.UpdateRecord(mz_presmaster);
                            }
                            else
                            {
                                throw new Exception("该处方已被其他收费员收费!");
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("没有找到结算号的记录!");
                    }
                }
                MSAccessDb.CommitTrans( );
            }
            catch (Exception err)
            {
                MSAccessDb.RollbackTrans( );
                throw new Exception("正式结算发生错误!");
            }
            //发票对象
            try
            {
                ChargeInvoicies = new Invoice[BudgetaryChargeInfos.Length];
                for (int i = 0; i < BudgetaryChargeInfos.Length; i++)
                {
                    ChargeInvoicies[i] = new Invoice(BudgetaryChargeInfos[i].PerfChar, BudgetaryChargeInfos[i].InvoiceNO, OPDBillKind.门诊收费发票);
                }
            }
            catch (Exception err)
            {
                throw new Exception("收费成功,但生成发票对象失败!");
            }
            return(true);
        }
Пример #2
0
        private bool _charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
        {
            try
            {
                for (int chargeCount = 0; chargeCount < BudgetaryChargeInfos.Length; chargeCount++)
                {
                    if (MSAccessDb.Exists("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + BudgetaryChargeInfos[chargeCount].ChargeID))
                    {
                        HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster( );
                        chargeBill             = (MZ_CostMaster)MSAccessDb.GetModel("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + BudgetaryChargeInfos[chargeCount].ChargeID, typeof(MZ_CostMaster));
                        chargeBill.Self_Fee    = BudgetaryChargeInfos[chargeCount].SelfFee;
                        chargeBill.Village_Fee = BudgetaryChargeInfos[chargeCount].VillageFee;
                        chargeBill.Favor_Fee   = BudgetaryChargeInfos[chargeCount].FavorFee;
                        chargeBill.Pos_Fee     = BudgetaryChargeInfos[chargeCount].PosFee;
                        chargeBill.Money_Fee   = BudgetaryChargeInfos[chargeCount].CashFee;
                        chargeBill.Ticket_Flag = 0;
                        chargeBill.CostDate    = DateTime.Now;
                        chargeBill.Record_Flag = 0;
                        string perfCode = "";
                        chargeBill.TicketNum  = InvoiceManager.GetBillNumber(OPDBillKind.门诊收费发票, OperatorId, false, out perfCode);
                        chargeBill.TicketCode = perfCode;

                        BudgetaryChargeInfos[chargeCount].InvoiceSerialNO = Convert.ToInt32(chargeBill.TicketNum);
                        BudgetaryChargeInfos[chargeCount].ChargeDate      = chargeBill.CostDate;
                        MSAccessDb.UpdateRecord(chargeBill);  //更新结算表
                        //更新处方表收费标识
                        HIS.Model.MZ_PresMaster presMaster = new HIS.Model.MZ_PresMaster( );

                        //presMaster = BindEntity<HIS.Model.MZ_PresMaster>.CreateInstanceDAL( oleDb ).GetModel( BudgetaryChargeInfos[chargeCount].PrescriptionID );
                        presMaster = (MZ_PresMaster)MSAccessDb.GetModel("MZ_PRESMASTER",
                                                                        Tables.mz_presmaster.PRESMASTERID + "=" + BudgetaryChargeInfos[chargeCount].PrescriptionID,
                                                                        typeof(MZ_PresMaster));
                        if (presMaster.Charge_Flag == 0)
                        {
                            presMaster.Charge_Flag   = 1;
                            presMaster.RoungingMoney = presMaster.Total_Fee - BudgetaryChargeInfos[chargeCount].TotalFee;
                            presMaster.Total_Fee     = BudgetaryChargeInfos[chargeCount].TotalFee;
                            presMaster.TicketCode    = BudgetaryChargeInfos[chargeCount].InvoiceNO;
                            presMaster.TicketNum     = chargeBill.TicketNum;
                            presMaster.CostMasterID  = BudgetaryChargeInfos[chargeCount].ChargeID;
                            presMaster.ChargeCode    = OperatorId.ToString( );
                            //BindEntity<HIS.Model.MZ_PresMaster>.CreateInstanceDAL( oleDb ).Update( presMaster );
                            MSAccessDb.UpdateRecord(presMaster);
                        }
                        else
                        {
                            throw new Exception("该处方已被其他收费员收费!");
                        }
                    }
                    else
                    {
                        throw new Exception("没有找到结算号的记录!");
                    }
                }

                //生成发票
                ChargeInvoicies = new BaseInvoice[BudgetaryChargeInfos.Length];
                for (int i = 0; i < BudgetaryChargeInfos.Length; i++)
                {
                    ChargeInvoicies[i] = new Invoice(BudgetaryChargeInfos[i].PerfChar, BudgetaryChargeInfos[i].InvoiceNO, OPDBillKind.门诊收费发票);
                }
                return(true);
            }

            catch (Exception err)
            {
                throw err;
            }
        }