def _createResData(var,new): service = var["roomservice"] if cutil.emptyS(service) : return None pricelist = var["roompricelist"] if cutil.emptyS(pricelist) : return None roomname = var["name"] date = var["datecol"] resdays = var["resdays"] dl = datetime.timedelta(1) dt = date sum = util.SUMBDECIMAL() if new : list = [] else : list = var["JLIST_MAP"][RESLIST] sum.add(var["JFOOTER_reslist_rlist_pricetotal"]) resnop = var["resnop"] perperson = var["serviceperperson"] priceroom = var["respriceperroom"] priceperson = var["respriceperson"] pricechildren = None priceextra = None resnoc = var["resnochildren"] if resnoc : pricechildren = var["respricechildren"] resextra = var["resnoextrabeds"] if resextra : priceextra = var["respriceextrabeds"] price = rutil.calculatePrice(perperson,resnop,resnoc,resextra,priceperson,pricechildren,priceextra,priceroom) query = cutil.createArrayList() RES = util.RESOP(var) qelem = rutil.createResQueryElem(roomname,date,con.incDays(date,resdays)) query.add(qelem) rList = RES.queryReservation(query) allavail = True resename = rutil.getReseName(var) for i in range(resdays) : # price = pPrice.getPrice() avail = True for re in rList : rdata = re.getResDate() if con.eqDate(dt,rdata) : if resename == None or resename != re.getResId() : avail = allavail = False map = { "avail" : avail, "resroomname" : roomname, "resday" : dt, "rlist_pricetotal" : price, "rline_nop" : resnop,"rlist_priceperson" : priceperson, "rlist_noc" : resnoc, "rlist_pricechildren" : pricechildren, "rlist_noe" : resextra, "rlist_priceextra" : priceextra, "rlist_serviceperperson" : perperson, "rlist_roomservice" : service, "rlist_roompricelist" : pricelist} list.append(map) dt = dt + dl sum.add(price) return [list,sum.sum,allavail]
def eqDate(d1, d2): return con.eqDate(d1, d2)
def reservationaction(action, var): cutil.printVar("reservation", action, var) if action == "before": list = _getList(var) var["JDATELINE_MAP"] = {"reservation": {"linedef": list}} if action == "datelineaction": (room, day) = rutil.getRoomDateFromVar(var) R = util.RESOP(var) RO = util.ROOMLIST(var) RFORM = util.RESFORM(var) services = RO.getRoomServices(room) if len(services) == 0: var['JERROR_MESSAGE'] = "@noserviceassigned" var['JMESSAGE_TITLE'] = "@incompleteconfiguration" return li = util.getServicesForRoom(var, room) if li == None: var['JERROR_MESSAGE'] = "@nopricelistforthisservice" var['JMESSAGE_TITLE'] = "@incompleteconfiguration" return res = rutil.getReservForDay(var, room, day) if res.isEmpty(): diallaunch.newreservation(var, room, day, 1, 1) else: ares = res.get(0) resid = ares.getResId() (room, day) = rutil.getRoomDateFromVar(var) diallaunch.reservationdialogaction(var, resid, room, day) if action == "datelinevalues": seq = var["JDATELINE_QUERYLIST"] vals = [] query = cutil.createArrayList() R = util.RESOP(var) RFORM = util.RESFORM(var) for s in seq: dfrom = s["JDATELINE_FROM"] dto = s["JDATELINE_TO"] name = s["name"] q = rutil.createResQueryElem(name, dfrom, dto) query.add(q) resList = R.queryReservation(query) vals = [] dl = datetime.timedelta(1) for s in seq: dfrom = s["JDATELINE_FROM"] dto = s["JDATELINE_TO"] name = s["name"] dt = dfrom prevres = None prevmap = None while dt <= dto: resid = None for ans in resList: aname = ans.getRoomName() dres = ans.getResDate() if con.eqDate(dt, dres) and aname == name: resid = ans.getResId() break if resid != None: if resid == prevres: prevmap["colspan"] = prevmap["colspan"] + 1 else: if prevmap: vals.append(prevmap) rform = RFORM.findElem(resid) sta = resstat.getResStatus(var, rform) form = "resroom" map = { "name": name, "datecol": dt, "colspan": 1, "form": form, "0": _resInfo(var, resid), "1": resstat.COLORS[sta], "hint": "@" + resstat.getStatusS(sta) } prevmap = map prevres = resid dt = dt + dl if prevmap: vals.append(prevmap) var["JDATELINE_MAP"] = {"reservation": {"values": vals}}
def reservationaction(action,var): cutil.printVar("reservation",action,var) if action == "before" : list = _getList(var) var["JDATELINE_MAP"] = {"reservation" : { "linedef" : list}} if action == "datelineaction" : (room,day) = rutil.getRoomDateFromVar(var) R = util.RESOP(var) RO = util.ROOMLIST(var) RFORM = util.RESFORM(var) services = RO.getRoomServices(room) if len(services) == 0 : var['JERROR_MESSAGE'] = "@noserviceassigned" var['JMESSAGE_TITLE'] = "@incompleteconfiguration" return li = util.getServicesForRoom(var,room) if li == None : var['JERROR_MESSAGE'] = "@nopricelistforthisservice" var['JMESSAGE_TITLE'] = "@incompleteconfiguration" return res = rutil.getReservForDay(var,room,day) if res.isEmpty() : diallaunch.newreservation(var,room,day,1,1) else : ares = res.get(0) resid = ares.getResId() (room,day) = rutil.getRoomDateFromVar(var) diallaunch.reservationdialogaction(var,resid,room,day) if action == "datelinevalues" : seq = var["JDATELINE_QUERYLIST"] vals = [] query=cutil.createArrayList() R = util.RESOP(var) RFORM = util.RESFORM(var) for s in seq : dfrom = s["JDATELINE_FROM"] dto = s["JDATELINE_TO"] name = s["name"] q = rutil.createResQueryElem(name,dfrom,dto) query.add(q) resList = R.queryReservation(query) vals = [] dl = datetime.timedelta(1) for s in seq : dfrom = s["JDATELINE_FROM"] dto = s["JDATELINE_TO"] name = s["name"] dt = dfrom prevres = None prevmap = None while dt <= dto : resid = None for ans in resList : aname = ans.getRoomName() dres = ans.getResDate() if con.eqDate(dt,dres) and aname == name : resid = ans.getResId() break if resid != None : if resid == prevres : prevmap["colspan"] = prevmap["colspan"] + 1 else : if prevmap : vals.append(prevmap) rform = RFORM.findElem(resid) sta = resstat.getResStatus(var,rform) form = "resroom" map = {"name" : name, "datecol" : dt,"colspan" : 1, "form" : form, "0" : _resInfo(var,resid), "1" : resstat.COLORS[sta], "hint" : "@" + resstat.getStatusS(sta) } prevmap = map prevres = resid dt = dt + dl if prevmap : vals.append(prevmap) var["JDATELINE_MAP"] = {"reservation" : { "values" : vals}}