Ejemplo n.º 1
0
 private List<JFModel> GetPhoneList(List<CustomerStayModel> listSource)
 {
     mJf = new JFModel();
     mJf.CatList = listCat;
     var query = (from p in listSource select p.MainRoomId).Distinct();
     foreach (int nMainId in query)
     {
         if (nMainId > 0)
         {
             var qTeamRoom = listSource.Where(c => c.MainRoomId == nMainId);
             List<CustomerStayModel> listChangeRomCustomerStay = new List<CustomerStayModel>();
             foreach (CustomerStayModel mcs in qTeamRoom)
             {
                 if (listJf.Where(c => c.PhoneNo == mcs.RoomInfo.RoomPhone).Count() > 0)
                 {
                     continue;
                 }
                 mJf.CommonInfo.StartDate = mcs.CommonInfo.StartDate;
                 if (mcs.ConSumeDetailList.Where(c => c.GoodsInfo.Type == 'R').Count() == 0)
                 {
                     mJf.PhoneNoGroup += cmn.MakeGroup(mcs.RoomInfo.RoomPhone);
                 }
                 else
                 {
                     listChangeRomCustomerStay.Add(mcs);
                 }
             }
             if (mJf.PhoneNoGroup != "")
             {
                 mJf.CommonInfo.EndDate = dtmNow;
                 listJf.AddRange(hml.GetPhoneList(mJf, dtmNow));
             }
             if (cmn.CheckEOF(listChangeRomCustomerStay))
             {
                 foreach (CustomerStayModel mcs in listChangeRomCustomerStay)
                 {
                     if (listJf.Where(c => c.PhoneNo == mcs.RoomInfo.RoomPhone).Count() > 0)
                     {
                         continue;
                     }
                     mJf.CommonInfo.StartDate = mcs.CommonInfo.StartDate;
                     mJf.CommonInfo.EndDate = dtmNow;
                     mJf.PhoneNoGroup = cmn.MakeGroup(mcs.RoomInfo.RoomPhone);
                     listJf.AddRange(hml.GetPhoneList(mJf, dtmNow));
                 }
             }
         }
         else
         {
             var qRooms = listSource.Where(c => c.MainRoomId == nMainId);
             foreach (CustomerStayModel mcs in qRooms)
             {
                 if (listJf.Where(c => c.PhoneNo == mcs.RoomInfo.RoomPhone).Count() > 0)
                 {
                     continue;
                 }
                 mJf.CommonInfo.StartDate = mcs.CommonInfo.StartDate;
                 mJf.CommonInfo.EndDate = dtmNow;
                 mJf.PhoneNoGroup = cmn.MakeGroup(mcs.RoomInfo.RoomPhone);
                 listJf.AddRange(hml.GetPhoneList(mJf, dtmNow));
             }
         }
     }
     return listJf;
 }
Ejemplo n.º 2
0
        private void BindConsumeDetail(List<CustomerStayModel> listSource)
        {
            dgvConsumeDetail.Rows.Clear();
            if (cmn.CheckEOF(listSysParameter))
            {
                //double dt = 0.0;
                dTotal = 0.0;
                int i = 0;
                if (IsCountPhone)
                {
                    listJf = GetPhoneList(listSource);
                }
                foreach (CustomerStayModel mCustomerStayTmp in listSource)
                {
                    dgvConsumeDetail.Rows.Add();
                    dgvConsumeDetail.Rows[i].Cells["RoomNo"].Value = mCustomerStayTmp.RoomInfo.RoomNo;
                    dgvConsumeDetail.Rows[i].Cells["ConsumeName"].Value = "房间费";
                    dgvConsumeDetail.Rows[i].Cells["UnitPrice"].Value = mCustomerStayTmp.RoomRate;

                    #region 结账时,统计房间使用时间需按照开房类型以及结账时间来计算.

                    RoomStayType eRst = mCustomerStayTmp.RoomStayType.Equals('D') ? RoomStayType.Day : RoomStayType.Hour;
                    dgvConsumeDetail.Rows[i].Cells["Number"].Value = hml.GetCustomerStayDays(mCustomerStayTmp.CommonInfo.StartDate, dtmNow, dtmNow, eRst, listSysParameter);
                    //单项目时,只计算房价,不计算消费的商品费用.

                    dgvConsumeDetail.Rows[i].Cells["TotalMoney"].Value = hml.GetTotalRates(mCustomerStayTmp, null, listSysParameter, dtmNow, 0.0);
                    dTotal += double.Parse(dgvConsumeDetail.Rows[i].Cells["TotalMoney"].Value.ToString());
                    #endregion

                    dgvConsumeDetail.Rows[i].Cells["Unit"].Value = eRst == RoomStayType.Day ? "天" : "小时";
                    dgvConsumeDetail.Rows[i].Cells["ConsumeDate"].Value = mCustomerStayTmp.CommonInfo.CreateDate;
                    dgvConsumeDetail.Rows[i].Cells["CreateUserName"].Value = mCustomerStayTmp.CommonInfo.CreateUserName;

                    #region 商品消费明细

                    if (cmn.CheckEOF(mCustomerStayTmp.ConSumeDetailList))
                    {
                        for (int j = 0; j < mCustomerStayTmp.ConSumeDetailList.Count; j++)
                        {
                            dgvConsumeDetail.Rows.Add();
                            dgvConsumeDetail.Rows[i + 1].Cells["RoomNo"].Value = mCustomerStayTmp.RoomInfo.RoomNo;
                            dgvConsumeDetail.Rows[i + 1].Cells["ConsumeName"].Value = mCustomerStayTmp.ConSumeDetailList[j].GoodsInfo.GoodsName;
                            dgvConsumeDetail.Rows[i + 1].Cells["UnitPrice"].Value = mCustomerStayTmp.ConSumeDetailList[j].UnitPrice;
                            dgvConsumeDetail.Rows[i + 1].Cells["Unit"].Value = mCustomerStayTmp.ConSumeDetailList[j].GoodsInfo.GoodsUnit;
                            dgvConsumeDetail.Rows[i + 1].Cells["Number"].Value = mCustomerStayTmp.ConSumeDetailList[j].Number;
                            dgvConsumeDetail.Rows[i + 1].Cells["TotalMoney"].Value = mCustomerStayTmp.ConSumeDetailList[j].Total;
                            dgvConsumeDetail.Rows[i + 1].Cells["ConsumeDate"].Value = mCustomerStayTmp.ConSumeDetailList[j].CommonInfo.CreateDate.ToString("yyyy-MM-dd HH:mm:ss");
                            dgvConsumeDetail.Rows[i + 1].Cells["CreateUserName"].Value = mCustomerStayTmp.ConSumeDetailList[j].CommonInfo.CreateUserName;
                            dTotal += mCustomerStayTmp.ConSumeDetailList[j].Total;
                            i++;
                        }
                    }

                    #endregion

                    i++;
                    if (IsCountPhone)
                    {
                        #region 话费明细

                        var query = listJf.Where(c => c.PhoneNo == mCustomerStayTmp.RoomInfo.RoomPhone);
                        double dPhone = 0.0;
                        if (query.Count() > 0)
                        {
                            dPhone = hml.GetPhoneJF(query.ToList(), listCat);
                        }
                        else
                        {
                            JFModel mEmptyJf = new JFModel();
                            mEmptyJf.PhoneNo = mCustomerStayTmp.RoomInfo.RoomPhone;
                            listJf.Add(mEmptyJf);
                        }

                        if (dPhone > 0)
                        {
                            dgvConsumeDetail.Rows.Add();
                            dgvConsumeDetail.Rows[i].Cells["RoomNo"].Value = mCustomerStayTmp.RoomInfo.RoomNo;
                            dgvConsumeDetail.Rows[i].Cells["ConsumeName"].Value = "电话费";
                            dgvConsumeDetail.Rows[i].Cells["UnitPrice"].Value = "";
                            dgvConsumeDetail.Rows[i].Cells["TotalMoney"].Value = dPhone;
                            dTotal += dPhone;
                            i++;
                        }

                        #endregion
                    }
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取电话清单
 /// </summary>
 /// <param name="mcs"></param>
 /// <param name="IsCountJF"></param>
 private void GetCustomerStayJF(CustomerStayModel mcs,bool IsCountJF)
 {
     if (IsCountPhone)
     {
         JFModel mJf = new JFModel();
         mJf.CommonInfo.StartDate = mcs.CommonInfo.StartDate;
         mJf.CommonInfo.EndDate = cmn.DateBaseDate;
         mJf.PhoneNoGroup = cmn.MakeGroup(mcs.RoomInfo.RoomPhone);
         mJf.CatList = listCat;
         listJf = hml.GetPhoneList(mJf, mJf.CommonInfo.EndDate);
     }
 }
Ejemplo n.º 4
0
 public List<JFModel> GetPhoneList(JFModel mJf, DateTime dtmNow)
 {
     ObjectControls oCtrl = new ObjectControls();
     oCtrl.Add(MCtrl.ByPhone);
     oCtrl.Add(MCtrl.ByStartDate);
     mJf.PhoneNoGroup = Cmn.RemoveLastDou(mJf.PhoneNoGroup);
     return bPhone.GetPhoneDetail(mJf, oCtrl, dtmNow);
 }
Ejemplo n.º 5
0
 private double GetPhoneRate(JFModel mJf,List<PhoneCatModel>listCat)
 {
     try
     {
         if (mJf.FreeId != 0)
         {
             var query = listCat.Where(c => c.CatId == mJf.OpCat).FirstOrDefault();
             if (query.CatId > 0)
             {
                 double dMinutes = mJf.CommonInfo.EndDate.Subtract(mJf.CommonInfo.StartDate).TotalMinutes;
                 if (dMinutes - Math.Truncate(dMinutes) > 0)
                 {
                     dMinutes = Math.Truncate(dMinutes) + 1;
                 }
                 return query.CatRate * dMinutes;
             }
         }
         return 0.0;
     }
     catch(Exception err)
     {
         throw err;
     }
 }
Ejemplo n.º 6
0
 public byte[] GetPhoteDetail(byte[] bytJf, byte[] bytCtrl, DateTime dtmNow)
 {
     JFModel mJf = (JFModel)cmn.DeserializeObject(bytJf);
     ObjectControls oCtrl = (ObjectControls)cmn.DeserializeObject(bytCtrl);
     if (dtmNow < mJf.CommonInfo.StartDate)
     {
         return cmn.SerializeObject(new List<JFModel>());
     }
     DateTime dtEndDate = dtmNow <= mJf.CommonInfo.EndDate ? dtmNow : mJf.CommonInfo.EndDate;
     List<JFModel> listJFModel = new List<JFModel>();
     for (DateTime dt = mJf.CommonInfo.StartDate.Date; dt.Date <= dtEndDate.Date; )
     {
         string sql = "";
         for (DateTime dtTmp = dt.Date; dtTmp < dt.Date.AddDays(2); )
         {
             string sTableName = "DW" + dtTmp.ToString("yyyyMMdd");
             if (dtTmp.Date < dtmNow.Date)
             {
                 if (CheckTableExist(sTableName))
                 {
                     if (dtTmp.Date != dt.Date)
                     {
                         sql += " UNION ALL ";
                     }
                     sql += @"SELECT A.OPNO,CONVERT(CHAR(100),DATEADD(SS,A.STARTTIME,'19940101'),20) START_DATE,
                                     CONVERT(CHAR(100),DATEADD(SS,A.ENDTIME,'19940101'),20) END_DATE,
                                     A.FREEID,A.OPCAT,A.LINKNO,B.JF_TYPE,C.SERCATNAME
                     FROM " + sTableName + @" A,JFJF_ID B,JFSERCATID C
                     WHERE 1=1 AND A.FREEID=B.JF_ID AND A.OPCAT=C.SERCAT ";
                     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByPhone) && oCtrl.Append(ref sql, " AND OPNO IN (" + mJf.PhoneNoGroup + ")"));
                     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByStartDate) && oCtrl.Append(ref sql,
                      " AND CONVERT(CHAR(100),DATEADD(SS,STARTTIME,'19940101'),20) >= " + DBHelper.SQL(mJf.CommonInfo.StartDate)
                     + " AND CONVERT(CHAR(100),DATEADD(SS,ENDTIME,'19940101'),20) <= " + DBHelper.SQL(dtEndDate)));
                 }
             }
             else if (dtTmp.Date == dtmNow.Date)
             {
                 if (!sql.Trim().Equals(""))
                 {
                     sql += " UNION ALL ";
                 }
                 sql += @"SELECT A.OPNO,CONVERT(CHAR(100),DATEADD(SS,A.STARTTIME,'19940101'),20) START_DATE,
                                     CONVERT(CHAR(100),DATEADD(SS,A.ENDTIME,'19940101'),20) END_DATE,
                                     A.FREEID,A.OPCAT,A.LINKNO,B.JF_TYPE,C.SERCATNAME
                     FROM ZXJHD A,JFJF_ID B,JFSERCATID C
                     WHERE 1=1 AND A.FREEID=B.JF_ID AND A.OPCAT=C.SERCAT ";
                 oCtrl.Helper(oCtrl.Exsit(MCtrl.ByPhone) && oCtrl.Append(ref sql, " AND OPNO IN (" + mJf.PhoneNoGroup + ")"));
                 oCtrl.Helper(oCtrl.Exsit(MCtrl.ByStartDate) && oCtrl.Append(ref sql,
                  " AND CONVERT(CHAR(100),DATEADD(SS,STARTTIME,'19940101'),20) >= " + DBHelper.SQL(mJf.CommonInfo.StartDate)
                 + " AND CONVERT(CHAR(100),DATEADD(SS,ENDTIME,'19940101'),20)<= " + DBHelper.SQL(dtEndDate)));
             }
             dtTmp = dtTmp.AddDays(1);
         }
         if (string.IsNullOrEmpty(sql))
         {
             dt = dt.Date < dtEndDate.Date.AddDays(-2) ? dt.AddDays(2) : dt.AddDays(1);
             continue;
         }
         sdr = ExecuteReader(sql);
         using (sdr)
         {
             while (sdr.Read())
             {
                 JFModel jfmodel = new JFModel();
                 jfmodel.PhoneNo = dbhelper.ToString(sdr["OPNO"]);
                 jfmodel.CommonInfo.StartDate = dbhelper.ToDateTime(sdr["START_DATE"]);
                 jfmodel.CommonInfo.EndDate = dbhelper.ToDateTime(sdr["END_DATE"]);
                 jfmodel.FreeId = dbhelper.ToInt32(sdr["FREEID"]);
                 jfmodel.FreeDesc = dbhelper.ToString(sdr["JF_TYPE"]);
                 jfmodel.OpCat = dbhelper.ToInt32(sdr["OPCAT"]);
                 jfmodel.OpCatDesc = dbhelper.ToString(sdr["SERCATNAME"]);
                 jfmodel.LinkNo = dbhelper.ToString(sdr["LINKNO"]);
                 listJFModel.Add(jfmodel);
             }
         }
         dt = dt.Date < dtEndDate.Date.AddDays(-2) ? dt.AddDays(2) : dt.AddDays(1);
     }
     return cmn.SerializeObject(listJFModel);
 }
Ejemplo n.º 7
0
 public List<JFModel> GetPhoneDetail(JFModel mJf, ObjectControls oCtrl, DateTime dtmNow)
 {
     return (List<JFModel>)Cmn.DeserializeObject(jfs.GetPhoteDetail(Cmn.SerializeObject(mJf), Cmn.SerializeObject(oCtrl), dtmNow));
 }