def _ListOfBills(var) : rese = rutil.getReseName(var) assert rese != None bList = util.RESOP(var).findBillsForReservation(rese) seq = [] pli = rutil.getPayments(var) sumtotal = 0.0 footerpayments = 0.0 sumsell = 0.0 CU = util.CUSTOMERLIST(var) for b in bList : C = cbill.BILLCALC(var,b) C.calc() bName = b.getName() assert bName != None payer = b.getPayer() customer = CU.findElem(payer) assert customer != None da = b.getIssueDate() tot = C.getTotal() sell = C.getCharge() paysum = C.getPayment() sumtotal = cutil.addDecimal(sumtotal,tot) footerpayments = cutil.addDecimal(footerpayments,paysum) sumsell = cutil.addDecimal(sumsell,sell) ma = { "billname" : bName, "billtotal" : tot, "payments" : paysum, "sell" : sell } cust.toCustomerVar(ma,customer,"payer_") seq.append(ma) cutil.setJMapList(var,BILLIST,seq) cutil.setFooter(var,BILLIST,"billtotal",sumtotal) cutil.setFooter(var,BILLIST,"payments",footerpayments) cutil.setFooter(var,BILLIST,"sell",sumsell)
def modifyAdvaData(self,resename = None) : if resename == None : resename = rutil.getReseName(self.var) R = util.RESFORM(self.var) reservation = R.findElem(resename) self.setAdvaData(reservation) R.changeElem(reservation) cutil.JOURNAL(self.var).addJournalElem(util.JOURNAL_CHANGEADVANCEPAYMENT,None,resename)
def modifyAdvaData(self, resename=None): if resename == None: resename = rutil.getReseName(self.var) R = util.RESFORM(self.var) reservation = R.findElem(resename) self.setAdvaData(reservation) R.changeElem(reservation) cutil.JOURNAL(self.var).addJournalElem( util.JOURNAL_CHANGEADVANCEPAYMENT, None, resename)
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 dialogaction(action, var): cutil.printVar("modif rese", action, var) if action == "before": (rename, resroom, resday) = rparam.XMLtoroomday(var["JUPDIALOG_START"]) cutil.setCopy(var, "resename") rutil.setReseName(var, rename) rparam.setStartParam(var) if action == "modifrese" or action == "modifstay": xml = rparam.getStartParam(var) (resname, resroom, resday) = rparam.XMLtoroomday(xml) if action == "modifrese": diallaunch.modifreservationroom(var, resroom, resday) else: diallaunch.staydetails(var, resroom, resday) if action == "aftercheckin": rutil.afterCheckIn(var) if action == "staybalance": diallaunch.staycalculation(var, rutil.getReseName(var)) if action == "disclosurechange" and var["disclosureopen"] and var[ "disclosureid"] == "adddvancepayment": A = Ad(var) A.setValReseName(rutil.getReseName(var)) if action == "disclosurechange" and var["disclosureopen"] and var[ "disclosureid"] == "confirmnotconfirmed": confirm.createC(var, P).setResNameToVar(rutil.getReseName(var)) if action == "signalchange" and var[ "changefield"] == "p_advance_percent" and var["changeafterfocus"]: A = Ad(var) A.calculateAdvanceAmount() if action == "saveconfirm" and var["JYESANSWER"]: confirm.createC(var, P).changeReservation(rutil.getReseName(var)) rutil.refreshPanel(var) if action == "saveadva": A = Ad(var) if not A.validate(): return var["JYESNO_MESSAGE"] = "@saveadva" var["JAFTERDIALOG_ACTION"] = "saveadvaafterquestion" if action == "saveadvaafterquestion" and var["JYESANSWER"]: A = Ad(var) A.modifyAdvaData() rutil.refreshPanel(var) if action == "sendmail": rese = rutil.getReseName(var) diallaunch.confirmationmail(var, rese) if action == "cancelres" and var["JYESANSWER"]: util.RESOP(var).changeStatusToCancel(rutil.getReseName(var)) var["JCLOSE_DIALOG"] = True rutil.refreshPanel(var)
def listaction(action, var): cutil.printVar("list action", action, var) if action == "before": billname = var["JUPDIALOG_START"] var["blob_billname"] = billname cutil.setCopy(var, "blob_billname") B = _constructB(billname) B.readBlobList(var) # test # li = var["JLIST_MAP"][LIST] # print li # for l in li : print l if action == "edit": cutil.setChangeEditMode(var, LIST, "blob_comment") if action == "editlistrowaction": if var["JLIST_EDIT_ACTION_" + LIST] == "REMOVE": var["JYESNO_MESSAGE"] = "@blobremovequestion" var["JMESSAGE_TITLE"] = "@Confirm" var["JAFTERDIALOG_ACTION"] = "removeyesno" if action == "removeyesno": if var["JYESANSWER"]: billname = var["blob_billname"] pdf_id = var["id"] B = _constructB(billname) B.removeOneBlob(var, pdf_id) var["JLIST_EDIT_ACTIONOK_" + LIST] = True else: var["JLIST_EDIT_ACTIONOK_" + LIST] = False if action == "columnchangeaction" and not var["JLIST_EDIT_BEFORE"]: billname = var["blob_billname"] pdf_id = var["id"] B = _constructB(billname) B.changeBlobComment(var, pdf_id, var["blob_comment"]) if action == "pdfdownload": # diallaunch.pdfdownload(var,listbl.constructPDFBLOB(var,var["blob_key"])) cdial.downloadObj(var, var["blob_comment"], FILENAME, [BREG, var["blob_key"]]) if action == "send": custname = var["payer_name"] resename = rutil.getReseName(var) blobid = listbl.constructPDFBLOB(var, var["blob_key"]) diallaunch.sendpdfmail(var, resename, custname, blobid)
def _listOfPayments(var) : rese = rutil.getReseName(var) li = util.RESOP(var).getResAddPaymentList(rese) seq = [] sum = util.SUMBDECIMAL() CU = util.CUSTOMERLIST(var) for e in li : g = e.getGuestName() customer = CU.findElem(g) assert customer != None map = { "roomid" : e.getRoomName(), "total" : e.getPriceTotal(), "price" : e.getPrice(), "servdescr" : e.getDescription(), "quantity" : e.getQuantity() } cust.toCustomerVar(map,customer,"guest_") seq.append(map) sum.add(e.getPriceTotal()) cutil.setJMapList(var,"paymentlist",seq) cutil.setFooter(var,"paymentlist","total",sum.sum)
def dialogaction(action,var) : cutil.printVar("modif rese",action,var) if action == "before" : (rename,resroom,resday) = rparam.XMLtoroomday(var["JUPDIALOG_START"]) cutil.setCopy(var,"resename") rutil.setReseName(var,rename) rparam.setStartParam(var) if action == "modifrese" or action == "modifstay" : xml = rparam.getStartParam(var) (resname,resroom,resday) = rparam.XMLtoroomday(xml) if action == "modifrese" : diallaunch.modifreservationroom(var,resroom,resday) else : diallaunch.staydetails(var,resroom,resday) if action == "aftercheckin" : rutil.afterCheckIn(var) if action == "staybalance" : diallaunch.staycalculation(var,rutil.getReseName(var)) if action == "disclosurechange" and var["disclosureopen"] and var["disclosureid"] == "adddvancepayment" : A = Ad(var) A.setValReseName(rutil.getReseName(var)) if action == "disclosurechange" and var["disclosureopen"] and var["disclosureid"] == "confirmnotconfirmed" : confirm.createC(var,P).setResNameToVar(rutil.getReseName(var)) if action == "signalchange" and var["changefield"] == "p_advance_percent" and var["changeafterfocus"] : A = Ad(var) A.calculateAdvanceAmount() if action == "saveconfirm" and var["JYESANSWER"] : confirm.createC(var,P).changeReservation(rutil.getReseName(var)) rutil.refreshPanel(var) if action == "saveadva" : A = Ad(var) if not A.validate() : return var["JYESNO_MESSAGE"] = "@saveadva" var["JAFTERDIALOG_ACTION"] = "saveadvaafterquestion" if action == "saveadvaafterquestion" and var["JYESANSWER"] : A = Ad(var) A.modifyAdvaData() rutil.refreshPanel(var) if action == "sendmail" : rese = rutil.getReseName(var) diallaunch.confirmationmail(var,rese) if action == "cancelres" and var["JYESANSWER"] : util.RESOP(var).changeStatusToCancel(rutil.getReseName(var)) var["JCLOSE_DIALOG"] = True rutil.refreshPanel(var)
def _addPayment(var, billName, total, paymentmethod): r = util.RESFORM(var).findElem(rutil.getReseName(var)) RR = resstat.getResStatusR(var, r) li = [] if RR.advancepaymentleft > 0: payment = min(total, RR.advancepaymentleft) li.append((payment, True)) total = con.minusDecimal(total, payment) if total > 0: li.append((total, False)) for l in li: p = util.newBillPayment() p.setBillName(billName) p.setPaymentMethod(paymentmethod) p.setDateOfPayment(cutil.toDate(cutil.today())) p.setPaymentTotal(con.toB(l[0])) if (l[1]): p.setAdvancepayment(True) util.PAYMENTOP(var).addPaymentForBill(billName, p)
def _addPayment(var,billName,total,paymentmethod): r = util.RESFORM(var).findElem(rutil.getReseName(var)) RR = resstat.getResStatusR(var,r) li = [] if RR.advancepaymentleft > 0 : payment = min(total,RR.advancepaymentleft) li.append((payment,True)) total = con.minusDecimal(total,payment) if total > 0 : li.append((total,False)) for l in li : p = util.newBillPayment() p.setBillName(billName) p.setPaymentMethod(paymentmethod) p.setDateOfPayment(cutil.toDate(cutil.today())) p.setPaymentTotal(con.toB(l[0])) if (l[1]) : p.setAdvancepayment(True) util.PAYMENTOP(var).addPaymentForBill(billName,p)
def _createPosList(var) : pli = rutil.getPayments(var) P = cbill.PAID(var,rutil.getReseName(var)) L1 = cbill.BILLPOSADD(var,LIST) L2 = cbill.BILLPOSADD(var,NOPAID) # list of bills sumf = 0.0 for r in pli : idp = r.getId() if P.onList(idp) : ma = { "billed" : True } else : ma = { "billed" : False } L2.addMa( { "add" : True },r,idp) L1.addMa(ma,r,idp) L1.close() L2.close() cutil.setChangeEditMode(var,NOPAID,["add"])
def _listOfPayments(var): rese = rutil.getReseName(var) li = util.RESOP(var).getResAddPaymentList(rese) seq = [] sum = util.SUMBDECIMAL() CU = util.CUSTOMERLIST(var) for e in li: g = e.getGuestName() customer = CU.findElem(g) assert customer != None map = { "roomid": e.getRoomName(), "total": e.getPriceTotal(), "price": e.getPrice(), "servdescr": e.getDescription(), "quantity": e.getQuantity() } cust.toCustomerVar(map, customer, "guest_") seq.append(map) sum.add(e.getPriceTotal()) cutil.setJMapList(var, "paymentlist", seq) cutil.setFooter(var, "paymentlist", "total", sum.sum)
def _ListOfBills(var): rese = rutil.getReseName(var) assert rese != None bList = util.RESOP(var).findBillsForReservation(rese) seq = [] pli = rutil.getPayments(var) sumtotal = 0.0 footerpayments = 0.0 sumsell = 0.0 CU = util.CUSTOMERLIST(var) for b in bList: C = cbill.BILLCALC(var, b) C.calc() bName = b.getName() assert bName != None payer = b.getPayer() customer = CU.findElem(payer) assert customer != None da = b.getIssueDate() tot = C.getTotal() sell = C.getCharge() paysum = C.getPayment() sumtotal = cutil.addDecimal(sumtotal, tot) footerpayments = cutil.addDecimal(footerpayments, paysum) sumsell = cutil.addDecimal(sumsell, sell) ma = { "billname": bName, "billtotal": tot, "payments": paysum, "sell": sell } cust.toCustomerVar(ma, customer, "payer_") seq.append(ma) cutil.setJMapList(var, BILLIST, seq) cutil.setFooter(var, BILLIST, "billtotal", sumtotal) cutil.setFooter(var, BILLIST, "payments", footerpayments) cutil.setFooter(var, BILLIST, "sell", sumsell)
def showstay(action, var): cutil.printVar("show stay", action, var) if action == "before": rbefore.setvarBefore(var) # after _listOfPayments(var) _ListOfBills(var) _setChangedFalse(var) PA = reseparam.RESPARAM(rutil.getReseName(var)) PA.setParam(var) PA.copyParam(var) if var["billlistwaschanged"]: _setChangedFalse(var) _ListOfBills(var) if action == "crud_readlist" and var["JLIST_NAME"] == BILLIST: _ListOfBills(var) if action == "afterbill" and var["JUPDIALOG_BUTTON"] == "acceptdocument": _ListOfBills(var) if action == "payerdetail": cust.showCustomerDetails(var, var["payer_name"]) if action == "changetoreserv" and var["JYESANSWER"]: res = getReservForDay(var) resname = res[0].getResId() R = util.RESOP(var) R.changeStatusToReserv(resname) a = cutil.createArrayList() R.setResGuestList(resname, a) var["JCLOSE_DIALOG"] = True var["JREFRESH_DATELINE_reservation"] = "" if action == "addpayment": var["JUP_DIALOG"] = "?addpayment.xml" var["JAFTERDIALOG_ACTION"] = "afteraddpayment" if action == "paymentslist": assert var["billname"] != None var["JUP_DIALOG"] = "?listofpayment.xml" var["JAFTERDIALOG_ACTION"] = "afterlistpayments" var["JUPDIALOG_START"] = var["billname"] if action == "printbill" and var[BILLIST + "_lineset"]: var["JUP_DIALOG"] = "?billprint.xml" var["JUPDIALOG_START"] = var["billname"] if action == "afteraddpayment" and var["JUPDIALOG_BUTTON"] == "addpayment": _listOfPayments(var) if action == "guestdesc": var["JAFTERDIALOG_ACTION"] = "acceptdetails" cust.showCustomerDetailstoActive(var, var[CUST + "name"]) if action == "acceptdetails" and var["JUPDIALOG_BUTTON"] == "acceptask": xml = var["JUPDIALOG_RES"] util.xmlToVar(var, xml, cust.getCustFieldIdAll(), CUST) cutil.setCopy(var, cust.getCustFieldIdAll(), None, CUST) name = var[CUST + "name"] resename = rutil.getReseName(var) util.RESFORM(var).changeCustName(resename, name) if action == "guestdetail": cust.showCustomerDetails(var, var["guest_name"]) if action == "listpdf" and var[BILLIST + "_lineset"]: var["JUP_DIALOG"] = "?pdflist.xml" var["JUPDIALOG_START"] = var["billname"]
def doaction(action,var) : cutil.printVar("create bill",action,var) if action == "before" : _createPosList(var) # payer rese = rutil.getReseName(var) R = util.RESFORM(var) r = R.findElem(rese) payername = r.getCustomerName() cust.setCustData(var,payername,PAY) var["paynow"] = True cutil.setCopy(var,["paynow","paymethod",DOCTYPE]) var["paymethod"] = util.HOTELDEFADATA().getDataH(3) var[DOCTYPE] = util.HOTELDEFADATA().getDataH(5) RR = resstat.getResStatusR(var,r) var["advance_pay_left"] = RR.advancepaymentleft var["advance_pay"] = RR.advancepayment cutil.setCopy(var,["advance_pay","advance_pay_left"]) if action == "guestdetail" : cust.showCustomerDetails(var,var["guest_name"]) if action == "columnchangeaction" : total = var["total"] footerf = var["JFOOTER_billlist_total"] if var["add"] : footerf = cutil.addDecimal(footerf,total) else : footerf = cutil.minusDecimal(footerf,total) cutil.setFooter(var,"billlist","total",footerf) if action == "accept" : pli = [] for m in var["JLIST_MAP"][NOPAID] : if m["add"] : pli.append(m["idp"]) if len(pli) == 0 : var["JERROR_MESSAGE"] = "@nothingischecked" return if var["paynow"] : if cutil.checkEmpty(var,["paymethod"]): return if not var["paynow"] : if cutil.checkEmpty(var,["paymethod","paymentdate"]): return cust.saveCustomerData(var,var["payer_name"],PAY) xml = rpdf.buildXMLForStay(var,rutil.getReseName(var),var["payer_name"],pli) diallaunch.displayDocument(var,xml) if action == "acceptdocument" and var["JUPDIALOG_BUTTON"] == "accept" : util.HOTELDEFADATA().putDataH(3,var["paymethod"]) util.HOTELDEFADATA().putDataH(5,var[DOCTYPE]) xml = var["JUPDIALOG_RES"] H = HOTELBILLSAVE(var,xml) if H.doTransRes() : var["JCLOSE_DIALOG"] = True if action == "payerdetails" : var["JAFTERDIALOG_ACTION"] = "acceptdetails" cust.customerDetailsActive(var,PAY) if action == "acceptdetails" and var["JUPDIALOG_BUTTON"] == "accept" : xml = var["JUPDIALOG_RES"] util.xmlToVar(var,xml,CLIST,PAY) cutil.setCopy(var,CLIST,None,PAY)
def __init__(self,var,xml) : paym = None if var["paynow"] : paym = var["paymethod"] cbill.HOTELBILLSAVE.__init__(self,var,rutil.getReseName(var),var["payer_name"],xml,paym)
def showstay(action,var): cutil.printVar("show stay",action,var) if action == "before" : rbefore.setvarBefore(var) # after _listOfPayments(var) _ListOfBills(var) _setChangedFalse(var) PA = reseparam.RESPARAM(rutil.getReseName(var)) PA.setParam(var) PA.copyParam(var) if var["billlistwaschanged"] : _setChangedFalse(var) _ListOfBills(var) if action == "crud_readlist" and var["JLIST_NAME"] == BILLIST : _ListOfBills(var) if action == "afterbill" and var["JUPDIALOG_BUTTON"] == "acceptdocument" : _ListOfBills(var) if action == "payerdetail" : cust.showCustomerDetails(var,var["payer_name"]) if action == "changetoreserv" and var["JYESANSWER"] : res = getReservForDay(var) resname = res[0].getResId() R = util.RESOP(var) R.changeStatusToReserv(resname) a = cutil.createArrayList() R.setResGuestList(resname,a) var["JCLOSE_DIALOG"] = True var["JREFRESH_DATELINE_reservation"] = "" if action == "addpayment" : var["JUP_DIALOG"]="?addpayment.xml" var["JAFTERDIALOG_ACTION"] = "afteraddpayment" if action == "paymentslist" : assert var["billname"] != None var["JUP_DIALOG"]="?listofpayment.xml" var["JAFTERDIALOG_ACTION"] = "afterlistpayments" var["JUPDIALOG_START"] = var["billname"] if action == "printbill" and var[BILLIST + "_lineset"] : var["JUP_DIALOG"]="?billprint.xml" var["JUPDIALOG_START"] = var["billname"] if action == "afteraddpayment" and var["JUPDIALOG_BUTTON"] == "addpayment" : _listOfPayments(var) if action == "guestdesc" : var["JAFTERDIALOG_ACTION"] = "acceptdetails" cust.showCustomerDetailstoActive(var,var[CUST+"name"]) if action == "acceptdetails" and var["JUPDIALOG_BUTTON"] == "acceptask" : xml = var["JUPDIALOG_RES"] util.xmlToVar(var,xml,cust.getCustFieldIdAll(),CUST) cutil.setCopy(var,cust.getCustFieldIdAll(),None,CUST) name = var[CUST+"name"] resename = rutil.getReseName(var) util.RESFORM(var).changeCustName(resename,name) if action == "guestdetail" : cust.showCustomerDetails(var,var["guest_name"]) if action == "listpdf" and var[BILLIST + "_lineset"] : var["JUP_DIALOG"]="?pdflist.xml" var["JUPDIALOG_START"] = var["billname"]
def _newRese(var) : return rutil.getReseName(var) == None
def run(self,var) : # validate (under transaction !) if not _checkAvailibity(var) : return A = advarese.createAdvaRese(var) if not A.validate() : return # customer firstly service = var["roomservice"] pricelist = var["roompricelist"] D.putDataH(30,service) D.putDataH(31,pricelist) custo = cust.customerFromVar(var,CUST) R = util.CUSTOMERLIST(var) name = var["cust_name"] if not cutil.emptyS(name) : custo.setName(name) R.changeElem(custo) else : # custo.setGensymbol(True); name = R.addElem(custo).getName() cust.saveDefaCustomer(var,CUST) # --- customer added resename = rutil.getReseName(var) reservation = util.newResForm(var) if resename : reservation.setName(resename) # else : reservation.setGensymbol(True); reservation.setCustomerName(name) # advance A = advarese.createAdvaRese(var) A.setAdvaData(reservation) # -- service = var["roomservice"] nop = var["nop"] reselist = reservation.getResDetail() rlist = var["JLIST_MAP"][RESLIST] for re in rlist : (listprice,listpricechild,listpriceextra) = rutil.getPriceList(var,re["rlist_roompricelist"],re["rlist_roomservice"]) r = util.newResAddPayment() r.setRoomName(re["resroomname"]) r.setService(re["rlist_roomservice"]) r.setResDate(con.toDate(re["resday"])) r.setPerperson(re["rlist_serviceperperson"]) r.setPriceListName(re["rlist_roompricelist"]) r.setNoP(re["rline_nop"]) r.setPrice(con.toB(re["rlist_priceperson"])) r.setPriceList(listprice) util.setIntField(re,"rlist_noc",lambda v : r.setNoChildren(v)) r.setPriceChildren(con.toB(re["rlist_pricechildren"])) r.setPriceListChildren(listpricechild) util.setIntField(re,"rlist_noe",lambda v : r.setNoExtraBeds(v)) r.setPriceExtraBeds(con.toB(re["rlist_priceextra"])) r.setPriceListExtraBeds(listpriceextra) r.setPriceTotal(con.toB(re["rlist_pricetotal"])) reselist.add(r) RFORM = util.RESFORM(var) if resename : RFORM.changeElem(reservation) else : resename = RFORM.addElem(reservation).getName() reseparam.RESPARAM(resename).saveParam(var) # confirmed/not confirmed confirm.createC(var).changeReservation(resename) var["JCLOSE_DIALOG"] = True var["JREFRESH_DATELINE_reservation"] = "" var["JUPDIALOG_START"] = resename var["JUP_DIALOG"]="?sentconfirmationquestion.xml"
def reseraction(action,var): cutil.printVar("reseraction",action,var) if action == "aftercheckin" : rutil.afterCheckIn(var) if action == "signalchange" and var["changeafterfocus"]: if var["changefield"] == "serviceperperson" : _setAfterPerPerson(var) if var["changefield"] == "roomservice" : if not _okServiceForRoom(var) : return _setAfterServiceName(var) _setAfterPriceList(var) if var["changefield"] == "roompricelist" : if not _okServiceForRoom(var) or not _okPriceList(var) : return _setAfterPriceList(var) if var["changefield"] == "advance_percent" : if not cutil.validatePercent(var,"advance_percent") : return _calculateAdvanceAmount(var,var["advance_total"]) if action=="before" : rbefore.setvarBefore(var) if not _newRese(var) : cutil.hideButton(var,"checkin",False) cust.enableCust(var,CUST,False) _setAfterPriceList(var) PA = reseparam.RESPARAM(rutil.getReseName(var)) PA.setParam(var) PA.copyParam(var) else : cutil.hideButton(var,"detailreservation",True) _setPriceAndService(var) _setAfterPriceList(var) _setAfterServiceName(var) _setAfterPerPerson(var) _createListOfDays(var,True) confirm.createC(var).setDefaToVar() reseparam.RESPARAM().copyParam(var) # -------------------- # customer # -------------------- if action == "acceptdetails" and (var["JUPDIALOG_BUTTON"] == "accept" or var["JUPDIALOG_BUTTON"] == "acceptask"): xml = var["JUPDIALOG_RES"] util.xmlToVar(var,xml,cust.getCustFieldIdAll(),CUST) cutil.setCopy(var,cust.getCustFieldIdAll(),None,CUST) if not _newRese(var) : name = var[CUST+"name"] resename = rutil.getReseName(var) util.RESFORM(var).changeCustName(resename,name) if action=="custdetails" : var["JAFTERDIALOG_ACTION"] = "acceptdetails" if _newRese(var) : cust.customerDetailsActive(var,CUST) else : cust.showCustomerDetailstoActive(var,var[CUST+"name"]) # -------------------- # -- add reservation # -------------------- if action == "checkaval" : if not _okServiceForRoom(var) or not _okPriceList(var) : return _checkRese(var) reseparam.RESPARAM().copyParam(var) # ------------------ # reservation # ------------------ if action == "askforreservation" : if not _checkCurrentRese(var) : return PA = reseparam.RESPARAM() diff = PA.diffP(var) if diff != None : xml = PA.diffAsXML(var,diff) var["JUPDIALOG_START"] = xml var["JUP_DIALOG"]="?reserchange.xml" var["JAFTERDIALOG_ACTION"] = "continuereservation" return var["JYESNO_MESSAGE"] = M("MAKERESERVATIONASK") var["JMESSAGE_TITLE"] = "" var["JAFTERDIALOG_ACTION"] = "makereservation" if (action == "makereservation" and var["JYESANSWER"]) or (action == "continuereservation" and var["JUPDIALOG_BUTTON"] == "accept") : TRAN = MAKERESE(var) TRAN.doTrans() # ----------------------- # additional reservation # ----------------------- if action == "morereservation" : l = var["JLIST_MAP"][RESLIST] xml = xmlutil.toXML({},l) var["JUPDIALOG_START"] = xml var["JUP_DIALOG"]="?searchrooms.xml" var["JAFTERDIALOG_ACTION"] = "morereservationaccept" if action == "morereservationaccept" and var["JUPDIALOG_BUTTON"] == "toresrese" : arese = var["resename"] var["JUPDIALOG_START"] = var["JUPDIALOG_RES"] rbefore.setvarBefore(var) # restore reservation name var["resename"] = arese _setAfterPriceList(var) _checkRese(var,False) reseparam.RESPARAM().copyParam(var) # ------------------------ # modify detail reservation # ------------------------ if action == "detailreservationaccept" and var["JUPDIALOG_BUTTON"] == "accept" : xml = var["JUPDIALOG_RES"] (rmap,li) = xmlutil.toMapFiltrDialL(xml,var["J_DIALOGNAME"],RESLIST) RELIST.initsum() for l in li : RELIST.addsum(l) RELIST.removePricesFromMap(l) l["avail"] = True RELIST.tofooter(var) cutil.setJMapList(var,RESLIST,li) if action == "detailreservation" : l = var["JLIST_MAP"][RESLIST] xml = xmlutil.toXML({},l) var["JUPDIALOG_START"] = xml var["JUP_DIALOG"]="?modifreservation.xml" var["JAFTERDIALOG_ACTION"] = "detailreservationaccept"