Beispiel #1
0
        /// <summary>
        /// 结算病人
        /// </summary>
        /// <param name="zyCostM">结算主表</param>
        /// <param name="zyCostOList">结算汇总记录</param>
        /// <param name="zyPatL">病人类表对象</param>
        /// <returns></returns>
        public void CostPat(ZY_CostMaster zyCostM, List <ZY_CostOrder> zyCostOList, ZY_PatList zyPatL)
        {
            try
            {
                if (OP_ZYConfigSetting.GetConfigValue("005") == 0)
                {
                    string perfCode    = "";
                    string strticketno = InvoiceManager.InvoiceManager.GetBillNumber(Convert.ToInt32(zyCostM.ChargeCode), false, out perfCode);
                    zyCostM.TicketCode = perfCode + strticketno;
                }

                oleDb.BeginTransaction();
                //中结处理预交金(以前所有正常预交金全识为中结状态,新增一条新的预交金)

                //添加一条结算信息

                BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Add(zyCostM);

                //添加结算汇总表



                for (int i = 0; i < zyCostOList.Count; i++)
                {
                    zyCostOList[i].CostID = zyCostM.CostMasterID;

                    BindEntity <ZY_CostOrder> .CreateInstanceDAL(oleDb).Add(zyCostOList[i]);
                }
                //更新所有处方记录的结算ID

                IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao));
                ipD.oleDb = oleDb;
                ipD.AlterCostID(zyCostM.PatListID, zyCostM.CostMasterID, zyCostM.Ntype);

                if (zyCostM.Ntype != 1)//add zenghao
                {
                    //更改住院病人登记表病人类型为4,5 出院结算 出院欠费结算

                    BindEntity <ZY_PatList> .CreateInstanceDAL(oleDb).Update(zyPatL);
                }

                //一起更新标识
                string strWhere = "DELETE_FLAG = 0 and PATLISTID =" + zyPatL.PatListID;
                //string str1 = Tables.zy_chargelist.RECORD_FLAG + oleDb.EuqalTo() + "3";//不修改记录状态
                string str2 = "DELETE_FLAG =" + zyCostM.CostMasterID;
                BindEntity <ZY_ChargeList> .CreateInstanceDAL(oleDb).Update(strWhere, str2);


                oleDb.CommitTransaction();
            }
            catch (System.Exception e)
            {
                oleDb.RollbackTransaction();
                throw new Exception(e.Message);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 检测是否可以取消结算
 /// </summary>
 /// <param name="zyCostM"></param>
 /// <returns></returns>
 public bool Check_CanelCostPat(ZY_CostMaster zyCostM)
 {
     //如果已经交款,(不允许取消中途结算、出院结算可以取消但不能再交预交金,必须马上重新结清费用办出院,
     //如果病人还需要继续住院,则必须重新办入院)
     if (zyCostM.Ntype == 1 && zyCostM.AccountID != 0)
     {
         return(false);
     }
     return(true);
 }
Beispiel #3
0
        /// <summary>
        /// 重打发票
        /// </summary>
        /// <param name="CostMasterID">结算ID</param>
        /// <param name="TicketNO">发票号</param>
        /// <param name="CostCode">结算人代码</param>
        /// <param name="CostDate">结算日期</param>
        /// <returns></returns>
        public int Again_Ticket(int CostMasterID, string TicketNO, string CostCode, DateTime CostDate)
        {
            IcostDao icD = DaoFactory.GetObject <IcostDao>(typeof(CostDao));

            icD.oleDb = oleDb;
            IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao));

            ipD.oleDb = oleDb;

            try
            {
                oleDb.BeginTransaction();

                ZY_CostMaster zyCostM = BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).GetModel(CostMasterID);

                ZY_CostMaster zyCostMM = new ZY_CostMaster();
                //1Copy
                zyCostMM = (ZY_CostMaster)zyCostM.Clone();

                //zy_CostM.Update(zyCostM.CostMasterID, 1);
                string strwhere   = "COSTMASTERID =" + CostMasterID;
                string fieldvalue = "RECORD_FLAG = 1";
                BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Update(strwhere, fieldvalue);

                //3add冲帐记录
                zyCostM.Total_Fee    = 0 - zyCostM.Total_Fee;
                zyCostM.Deptosit_Fee = 0 - zyCostM.Deptosit_Fee;
                zyCostM.Self_Fee     = 0 - zyCostM.Self_Fee;
                zyCostM.Village_Fee  = 0 - zyCostM.Village_Fee;
                zyCostM.Village_Fee  = 0 - zyCostM.Village_Fee;
                zyCostM.Reality_Fee  = 0 - zyCostM.Reality_Fee;
                zyCostM.Pos_Fee      = 0 - zyCostM.Pos_Fee;
                zyCostM.Money_Fee    = 0 - zyCostM.Money_Fee;
                zyCostM.Record_Flag  = 2;
                zyCostM.OldID        = zyCostM.CostMasterID;
                zyCostM.AccountID    = 0;//add zenghao

                //zy_CostM.Add(zyCostM);
                BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Add(zyCostM);

                //4add新的重打记录
                zyCostMM.TicketNum  = GetNewTicketNO(CostDate);
                zyCostMM.TicketCode = TicketNO;
                zyCostMM.ChargeCode = CostCode;
                zyCostMM.CostDate   = CostDate;
                zyCostMM.AccountID  = 0;//add zenghao
                BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Add(zyCostMM);

                //更改处方结算标志
                ipD.AlterCostID(CostMasterID, zyCostMM.CostMasterID);

                //5update 结算汇总记录

                icD.UpdateCostMID(CostMasterID, zyCostMM.CostMasterID);

                oleDb.CommitTransaction();
                return(zyCostMM.CostMasterID);
            }
            catch (System.Exception e)
            {
                oleDb.RollbackTransaction();
                return(0);

                throw new Exception(e.Message);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 取消结算
        /// </summary>
        /// <param name="zyCostM"></param>
        /// <returns></returns>
        public void CanelCostPat(ZY_CostMaster zyCostM)
        {
            try
            {
                oleDb.BeginTransaction();
                //更改处方结算标志
                IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao));
                ipD.oleDb = oleDb;
                IcostDao icD = DaoFactory.GetObject <IcostDao>(typeof(CostDao));
                icD.oleDb = oleDb;
                IpatListDao ipLD = DaoFactory.GetObject <IpatListDao>(typeof(PatListDao));
                ipLD.oleDb = oleDb;


                ipD.AlterCostID(zyCostM.CostMasterID, 0);

                //修改结算表的记录标识1,为被退(外面添加收费人代码和取消结算时间)


                icD.UpdateRecord_Flag(zyCostM.CostMasterID, 1);
                //删除所有结算汇总表的记录||update 新增对应多的付记录,不然在交款表按发票项目分类金额不对
                string strWhere = "COSTID =" + zyCostM.CostMasterID;
                //BindEntity<ZY_CostOrder>.CreateInstanceDAL(oleDb).Delete(strWhere); update zenghao 20090826
                List <ZY_CostOrder> zy_coList = BindEntity <ZY_CostOrder> .CreateInstanceDAL(oleDb).GetListArray(strWhere);


                //如果为取消中途结算,预交金的处理
                //if (zyCostM.Ntype == 1)//?  出院结算取消也把ID修改回去
                //{
                strWhere = "DELETE_FLAG =" + zyCostM.CostMasterID;
                //string str1 = Tables.zy_chargelist.RECORD_FLAG + oleDb.EuqalTo() + "3";
                string str2 = "DELETE_FLAG = 0";
                BindEntity <ZY_ChargeList> .CreateInstanceDAL(oleDb).Update(strWhere, str2);

                //}

                //添加一条红冲记录,记录标识为2,红冲


                zyCostM.Total_Fee       = 0 - zyCostM.Total_Fee;
                zyCostM.Deptosit_Fee    = 0 - zyCostM.Deptosit_Fee;
                zyCostM.Self_Fee        = 0 - zyCostM.Self_Fee;
                zyCostM.Village_Fee     = 0 - zyCostM.Village_Fee;
                zyCostM.Favor_Fee       = 0 - zyCostM.Favor_Fee;
                zyCostM.Reality_Fee     = 0 - zyCostM.Reality_Fee;
                zyCostM.Pos_Fee         = 0 - zyCostM.Pos_Fee;
                zyCostM.Money_Fee       = 0 - zyCostM.Money_Fee;
                zyCostM.WorkUnit_Fee    = 0 - zyCostM.WorkUnit_Fee;
                zyCostM.NotWorkUnit_Fee = 0 - zyCostM.NotWorkUnit_Fee;
                zyCostM.Record_Flag     = 2;
                zyCostM.OldID           = zyCostM.CostMasterID;
                zyCostM.AccountID       = 0; //add zenghao
                zyCostM.CostDate        = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;

                BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).Add(zyCostM);

                //取消结算,结算明细表插付记录
                for (int i = 0; i < zy_coList.Count; i++)
                {
                    zy_coList[i].CostID    = zyCostM.CostMasterID;
                    zy_coList[i].Total_Fee = 0 - zy_coList[i].Total_Fee;
                    BindEntity <ZY_CostOrder> .CreateInstanceDAL(oleDb).Add(zy_coList[i]);
                }

                //更改住院病人登记表病人类型为3,出院未结算

                if (zyCostM.Ntype == 1)//如果是中途结算
                {
                    ipLD.AlterPatType(zyCostM.PatListID, 2);
                }
                else
                {
                    ipLD.AlterPatType(zyCostM.PatListID, 3);
                }

                oleDb.CommitTransaction();
            }
            catch (System.Exception e)
            {
                oleDb.RollbackTransaction();
                throw new Exception(e.Message);
            }
        }