Exemplo n.º 1
0
        /// <summary>
        /// 得到明细
        /// </summary>
        /// <param name="ChargeCode">操作员代码</param>
        /// <param name="feeType"></param>
        /// <returns></returns>
        public DataTable GetDetailCharge(string ChargeCode, string feeType)
        {
            try
            {
                IchargeListDao icLD = DaoFactory.GetObject <IchargeListDao>(typeof(ChargeListDao));
                IcostDao       icD  = DaoFactory.GetObject <IcostDao>(typeof(CostDao));
                icLD.oleDb = oleDb;
                icD.oleDb  = oleDb;

                if (feeType.Trim() == "正常")
                {
                    return(icLD.GetDetailCharge(ChargeCode, 0));
                }
                else if (feeType.Trim() == "退费")
                {
                    return(icLD.GetDetailCharge(ChargeCode, 1));
                }
                else if (feeType.Trim() == "结补")
                {
                    return(icD.GetDetailCharge(ChargeCode, 0));
                }
                else if (feeType.Trim() == "结退")
                {
                    return(icD.GetDetailCharge(ChargeCode, 1));
                }
                return(null);
            }
            catch (System.Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 病人结算费用
        /// </summary>
        /// <param name="patlistid"></param>
        /// <returns></returns>
        public PatFee GetPatCostFee()
        {
            try
            {
                PatFee patFee = new PatFee();

                IchargeListDao icLD = DaoFactory.GetObject <IchargeListDao>(typeof(ChargeListDao));
                icLD.oleDb = oleDb;
                IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao));
                ipD.oleDb = oleDb;
                IcostDao icD = DaoFactory.GetObject <IcostDao>(typeof(CostDao));
                icD.oleDb = oleDb;

                //得到中结后的累计预交金
                patFee.chargeFee = Convert.ToDecimal(icLD.GetNoCostAll_Fee(this.PatListID).ToString("0.00"));

                //得到所有记账处方未结算的费用
                patFee.costFee = Convert.ToDecimal(ipD.GetNoCostAll_Fee(this.PatListID).ToString("0.00"));

                //string patientCode = OP_PatientObject.GetPatInfo(patlistid).PatientCode;
                //优惠
                patFee.faoverFee = 0;//Convert.ToDecimal(zy_chargelist.ZY_PresMaster_GetfaoverAll_Fee(patlistid, patientCode, patFee.costFee).ToString("0.00"));
                //农合
                patFee.villageFee = Convert.ToDecimal(icD.GetvillageAll_Fee(this.PatListID).ToString("0.00"));
                //自付
                patFee.selfFee = patFee.costFee - (patFee.faoverFee + patFee.villageFee);
                //余额
                patFee.surplusFee = patFee.chargeFee - patFee.selfFee;
                //补收
                patFee.receiveFee = patFee.surplusFee < 0 ? (0 - patFee.surplusFee) : 0;
                //应退
                patFee.retreatFee = patFee.surplusFee >= 0 ? patFee.surplusFee : 0;


                patFee.surplusFee = Convert.ToDecimal(patFee.surplusFee.ToString("0.00"));
                patFee.receiveFee = Convert.ToDecimal(patFee.receiveFee.ToString("0.00"));
                patFee.retreatFee = Convert.ToDecimal(patFee.retreatFee.ToString("0.00"));
                return(patFee);
            }
            catch (System.Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 得到现金和pos金额分别多少
        /// </summary>
        /// <param name="ChargeCode">操作员代码</param>
        /// <param name="type">类别(0,全部.1,预交金.2,结算.)</param>
        /// <returns></returns>
        public decimal[] GetMenoyAndPosFee(string ChargeCode, int type)
        {
            IchargeListDao icLD = DaoFactory.GetObject <IchargeListDao>(typeof(ChargeListDao));
            IcostDao       icD  = DaoFactory.GetObject <IcostDao>(typeof(CostDao));

            icLD.oleDb = oleDb;
            icD.oleDb  = oleDb;

            try
            {
                if (type == 0)
                {
                    decimal[] dec  = new decimal[5];
                    decimal[] dec1 = new decimal[5];
                    dec     = icLD.GetMenoyAndPosFee(ChargeCode);
                    dec1    = icD.GetMenoyAndPosFee(ChargeCode);
                    dec[0] += dec1[0];
                    dec[1] += dec1[1];
                    dec[2] += dec1[2];
                    dec[3] += dec1[3];
                    dec[4] += dec1[4];
                    return(dec);
                }
                else if (type == 1)
                {
                    return(icLD.GetMenoyAndPosFee(ChargeCode));
                }
                else if (type == 2)
                {
                    return(icD.GetMenoyAndPosFee(ChargeCode));
                }
                return(null);
            }
            catch (System.Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 得到新预交金票据号
 /// </summary>
 /// <param name="date">日期</param>
 /// <returns></returns>
 public string GetBillNo(DateTime date)
 {
     try
     {
         IchargeListDao icLD = DaoFactory.GetObject <IchargeListDao>(typeof(ChargeListDao));
         icLD.oleDb = oleDb;
         string datestr  = date.ToString("yyyyMMdd");
         string datestr2 = icLD.GetNewBillNo(date);
         if (datestr2.Length == 1)
         {
             datestr2 = "00" + datestr2;
         }
         else if (datestr2.Length == 2)
         {
             datestr2 = "0" + datestr2;
         }
         return(datestr + datestr2);
     }
     catch (System.Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 交款
        /// </summary>
        /// <param name="type">交款类型(1预交金,2结算费用,3全部)</param>
        /// <param name="empID">交款人ID</param>
        /// <returns></returns>
        public int[] SaveAccount(int type, string empID)
        {
            try
            {
                int[] AccountsID = new int[2];
                AccountsID[0] = -1;
                AccountsID[1] = -1;

                oleDb.BeginTransaction();


                IchargeListDao icLD = DaoFactory.GetObject <IchargeListDao>(typeof(ChargeListDao));
                IcostDao       icD  = DaoFactory.GetObject <IcostDao>(typeof(CostDao));
                icLD.oleDb = oleDb;
                icD.oleDb  = oleDb;

                if (type == 1)
                {
                    ZY_Account zyAccount = new ZY_Account();
                    zyAccount.AccountType = 0;//预交金
                    zyAccount.AccountCode = empID;
                    zyAccount.LastDate    = GetLastTime();
                    DataTable dt = GetAllCharge(empID);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["typename"].ToString() == "正常")
                        {
                            zyAccount.WTicketFee = Convert.ToDecimal(dt.Rows[i]["tol_fee"]);
                            zyAccount.WTicketNum = Convert.ToInt32(dt.Rows[i]["count"]);
                        }
                        else if (dt.Rows[i]["typename"].ToString() == "退费")
                        {
                            zyAccount.BTicketFee = Convert.ToDecimal(dt.Rows[i]["tol_fee"]);
                            zyAccount.BTicketNum = Convert.ToInt32(dt.Rows[i]["count"]);
                        }
                    }
                    decimal[] dec = GetMenoyAndPosFee(empID, type);
                    zyAccount.Total_Fee   = dec[0] + dec[1];
                    zyAccount.Cash_Fee    = dec[0];
                    zyAccount.POS_Fee     = dec[1];
                    zyAccount.AccountCode = empID;
                    zyAccount.AccountDate = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                    BindEntity <ZY_Account> .CreateInstanceDAL(oleDb).Add(zyAccount);

                    AccountsID[0] = zyAccount.AccountID;
                    icLD.UpdateAccount(zyAccount.AccountCode, zyAccount.AccountID);
                }
                else if (type == 2)
                {
                    ZY_Account zyAccount = new ZY_Account();
                    zyAccount.AccountType = 1;//结算
                    zyAccount.AccountCode = empID;
                    zyAccount.LastDate    = GetLastTime();
                    DataTable dt = GetAllCost(empID);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["typename"].ToString() == "结补")
                        {
                            zyAccount.WTicketFee = Convert.ToDecimal(dt.Rows[i]["tol_fee"]);
                            zyAccount.WTicketNum = Convert.ToInt32(dt.Rows[i]["count"]);
                        }
                        else if (dt.Rows[i]["typename"].ToString() == "结退")
                        {
                            zyAccount.BTicketFee = Convert.ToDecimal(dt.Rows[i]["tol_fee"]);
                            zyAccount.BTicketNum = Convert.ToInt32(dt.Rows[i]["count"]);
                        }
                    }
                    decimal[] dec = GetMenoyAndPosFee(empID, type);
                    zyAccount.Total_Fee   = dec[0] + dec[1];
                    zyAccount.Cash_Fee    = dec[0];
                    zyAccount.POS_Fee     = dec[1];
                    zyAccount.AccountCode = empID;
                    zyAccount.AccountDate = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                    zyAccount.CostFee     = dec[2];
                    zyAccount.FaoverFee   = dec[3];
                    BindEntity <ZY_Account> .CreateInstanceDAL(oleDb).Add(zyAccount);

                    AccountsID[1] = zyAccount.AccountID;
                    icD.UpdateAccount(zyAccount.AccountCode, zyAccount.AccountID);
                }
                else
                {
                    ZY_Account zyAccount = new ZY_Account();
                    zyAccount.AccountType = 0;//预交金
                    zyAccount.AccountCode = empID;
                    zyAccount.LastDate    = GetLastTime();
                    DataTable dt = GetAllCharge(empID);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["typename"].ToString() == "正常")
                        {
                            zyAccount.WTicketFee = Convert.ToDecimal(dt.Rows[i]["tol_fee"]);
                            zyAccount.WTicketNum = Convert.ToInt32(dt.Rows[i]["count"]);
                        }
                        else if (dt.Rows[i]["typename"].ToString() == "退费")
                        {
                            zyAccount.BTicketFee = Convert.ToDecimal(dt.Rows[i]["tol_fee"]);
                            zyAccount.BTicketNum = Convert.ToInt32(dt.Rows[i]["count"]);
                        }
                    }
                    decimal[] dec = GetMenoyAndPosFee(empID, 1);
                    zyAccount.Total_Fee   = dec[0] + dec[1];
                    zyAccount.Cash_Fee    = dec[0];
                    zyAccount.POS_Fee     = dec[1];
                    zyAccount.AccountCode = empID;
                    zyAccount.AccountDate = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                    BindEntity <ZY_Account> .CreateInstanceDAL(oleDb).Add(zyAccount);

                    AccountsID[0] = zyAccount.AccountID;
                    icLD.UpdateAccount(zyAccount.AccountCode, zyAccount.AccountID);

                    zyAccount             = new ZY_Account();
                    zyAccount.AccountType = 1;//结算
                    zyAccount.AccountCode = empID;
                    zyAccount.LastDate    = GetLastTime();
                    dt = GetAllCost(empID);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["typename"].ToString() == "结补")
                        {
                            zyAccount.WTicketFee = Convert.ToDecimal(dt.Rows[i]["tol_fee"]);
                            zyAccount.WTicketNum = Convert.ToInt32(dt.Rows[i]["count"]);
                        }
                        else if (dt.Rows[i]["typename"].ToString() == "结退")
                        {
                            zyAccount.BTicketFee = Convert.ToDecimal(dt.Rows[i]["tol_fee"]);
                            zyAccount.BTicketNum = Convert.ToInt32(dt.Rows[i]["count"]);
                        }
                    }
                    dec = GetMenoyAndPosFee(empID, 2);
                    zyAccount.Total_Fee   = dec[0] + dec[1];
                    zyAccount.Cash_Fee    = dec[0];
                    zyAccount.POS_Fee     = dec[1];
                    zyAccount.AccountCode = empID;
                    zyAccount.AccountDate = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                    zyAccount.CostFee     = dec[2];
                    zyAccount.FaoverFee   = dec[3];
                    BindEntity <ZY_Account> .CreateInstanceDAL(oleDb).Add(zyAccount);

                    AccountsID[1] = zyAccount.AccountID;
                    icD.UpdateAccount(zyAccount.AccountCode, zyAccount.AccountID);
                }
                //oleDb.StoreProcedureName = "";
                //oleDb.Coding = "";
                oleDb.CommitTransaction();
                return(AccountsID);
            }
            catch (System.Exception e)
            {
                oleDb.RollbackTransaction();
                throw new Exception(e.Message);
            }
        }