Пример #1
0
 def setAdvaData(self,reservation) :
     reservation.setAdvanceDeposit(con.toB(self.var[self.__advapay]))
     reservation.setTermOfAdvanceDeposit(con.toDate(self.var[self.__advadate]))
     if self.__resepay : reservation.setAdvancePayment(con.toB(self.var[self.__resepay]))
     if self.__resedate :
       pdate = self.var[self.__resedate]
       if pdate == None : pdate = con.today()      
       reservation.setDateofadvancePayment(con.toDate(pdate))
Пример #2
0
 def setAdvaData(self, reservation):
     reservation.setAdvanceDeposit(con.toB(self.var[self.__advapay]))
     reservation.setTermOfAdvanceDeposit(
         con.toDate(self.var[self.__advadate]))
     if self.__resepay:
         reservation.setAdvancePayment(con.toB(self.var[self.__resepay]))
     if self.__resedate:
         pdate = self.var[self.__resedate]
         if pdate == None: pdate = con.today()
         reservation.setDateofadvancePayment(con.toDate(pdate))
Пример #3
0
def dialogaction(action,var):
    cutil.printVar("testbill",action,var)
    
    if action == "testbill" :
        bname = var["billno"]
        print bname
        bb = util.BILLLIST(var).findElem(bname)
        resname = bb.getReseName()
        print resname
        RE = util.RESFORM(var).findElem(resname)
        print RE
        rlist = RE.getResDetail()
        for r in rlist:
            print r.getId()
            print type(r.getId())
            
        b = util.newBill(var)
#        b.setGensymbol(True);
        b.setPayer(bb.getPayer());
        b.setReseName(resname)
        dat = datetime.date(2010,1,2)
        b.setIssueDate(con.toDate(dat))
        for r in rlist:
           b.getPayList().add(r.getId());
        b1 = util.BILLLIST(var).addElem(b)
        assert b1 != None
        print b1.getName()    
        var["OK"] = True
Пример #4
0
def _addPayment(var):
    ROP = util.RESOP(var)
    r = util.newResAddPayment()
    quantity = var["quantity"]
    da = con.toDate(var["paymentdate"])
    descr = var["descr"]
    price = con.toB(var["price"])
    #     price = toB(1.00)
    pricelist = con.toB(var["pricefromlist"])
    total = con.toB(var["total"])
    #     total = toB(1.01)
    room = None
    guest = None
    rese = var["resename"]
    vat = var["vat"]
    serv = var["service"]
    if var[RLIST + "_lineset"]:
        room = var["roomid"]
        guest = var["guest_name"]
    if room == None:
        room = var["JDATELINE_LINE"]
    if guest == None:
        guest = util.RESFORM(var).findElem(rese).getCustomerName()
    r.setQuantity(quantity)
    r.setPrice(price)
    r.setPriceList(pricelist)
    r.setPriceTotal(total)
    r.setServDate(da)
    r.setDescription(descr)
    r.setService(serv)
    r.setGuestName(guest)
    r.setRoomName(room)
    if serv == None:
        r.setVat(vat)
    ROP.addResAddPayment(rese, r)
Пример #5
0
def __resolvePos(st, li):
    if li == None: return
    pos = 0
    if type(li) != list:
        li = [li]
    for l in li:
        pos = pos + 1
        if l == None: st.setObject(pos, None)
        elif type(l) is int or type(l) is long: st.setLong(pos, l)
        elif type(l) is float: st.setDouble(pos, l)
        elif type(l) is datetime.date:
            d = con.toDate(l)
            dsql = Date(d.getTime())
            st.setDate(pos, dsql)
        else:
            st.setString(pos, l)
def elempayment(action, var):
    cutil.printVar("elempayment", action, var)

    if action == "before" and var["JCRUD_DIALOG"] == "crud_add":
        var["paymentdate"] = cutil.today()
        b = BILLLIST(var).findElem(_getPayName(var))
        sumtotal = rutil.countTotal(var, b, rutil.getPayments(var))
        sumpay = rutil.countPayments(var, _getPayName(var))
        acc = con.minusDecimal(sumtotal, sumpay)
        if acc < 0: acc = None
        var["paymenttotal"] = acc
        cutil.setCopy(var, ["paymentdate", "paymenttotal"])

    if action == "crud_add" and not var["JCRUD_AFTERCONF"]:
        var["JYESNO_MESSAGE"] = "Do you want to add payment to this bill ?"
        var["JMESSAGE_TITLE"] = ""
        return

    if action == "crud_add" and var["JCRUD_AFTERCONF"]:
        p = util.newBillPayment()
        p.setBillName(_getPayName(var))
        p.setPaymentMethod(var["paymethod"])
        p.setDateOfPayment(con.toDate(con.today()))
        p.setPaymentTotal(con.toB(var["paymenttotal"]))
        PAYMENTOP(var).addPaymentForBill(_getPayName(var), p)
        var["JCLOSE_DIALOG"] = True
        _setChanged(var)
        return

    if action == "crud_remove" and not var["JCRUD_AFTERCONF"]:
        var["JYESNO_MESSAGE"] = "Are you sure to remove payment to this bill ?"
        var["JMESSAGE_TITLE"] = ""
        return

    if action == "crud_remove" and var["JCRUD_AFTERCONF"]:
        id = var["id"]
        PAYMENTOP(var).removePaymentForBill(_getPayName(var), id)
        _setChanged(var)
        var["JCLOSE_DIALOG"] = True
def elempayment(action,var) :  
    cutil.printVar("elempayment",action,var)
    
    if action == "before" and var["JCRUD_DIALOG"] == "crud_add" :
      var["paymentdate"] = cutil.today()
      b = BILLLIST(var).findElem(_getPayName(var))
      sumtotal = rutil.countTotal(var,b,rutil.getPayments(var))
      sumpay = rutil.countPayments(var,_getPayName(var))
      acc = con.minusDecimal(sumtotal,sumpay)
      if acc < 0 : acc = None
      var["paymenttotal"] = acc
      cutil.setCopy(var,["paymentdate","paymenttotal"])
      
    if action == "crud_add"  and not var["JCRUD_AFTERCONF"] :
      var["JYESNO_MESSAGE"] = "Do you want to add payment to this bill ?"
      var["JMESSAGE_TITLE"] = ""  
      return
      
    if action == "crud_add"  and var["JCRUD_AFTERCONF"] :
       p = util.newBillPayment()
       p.setBillName(_getPayName(var))
       p.setPaymentMethod(var["paymethod"])
       p.setDateOfPayment(con.toDate(con.today()))
       p.setPaymentTotal(con.toB(var["paymenttotal"]))
       PAYMENTOP(var).addPaymentForBill(_getPayName(var),p)       
       var["JCLOSE_DIALOG"] = True
       _setChanged(var)
       return
      
    if action == "crud_remove"  and not var["JCRUD_AFTERCONF"] :
      var["JYESNO_MESSAGE"] = "Are you sure to remove payment to this bill ?"
      var["JMESSAGE_TITLE"] = ""  
      return
  
    if action == "crud_remove"  and var["JCRUD_AFTERCONF"] :
      id = var["id"]
      PAYMENTOP(var).removePaymentForBill(_getPayName(var),id)
      _setChanged(var)
      var["JCLOSE_DIALOG"] = True                
Пример #8
0
def _createPriceList(var):
    pr = HotelPriceList()
    util.copyNameDescr(pr, var)
    pr.setFromDate(con.toDate(var["validfrom"]))
    pr.setToDate(con.toDate(var["validto"]))
    return pr
Пример #9
0
def toDate(value):
    return con.toDate(value)
Пример #10
0
def toDate(value):
    return con.toDate(value)
Пример #11
0
def _createPriceList(var):
   pr = HotelPriceList()
   util.copyNameDescr(pr,var)
   pr.setFromDate(con.toDate(var["validfrom"]))
   pr.setToDate(con.toDate(var["validto"]))
   return pr
Пример #12
0
def dialogaction(action, var):
    cutil.printVar("testresemail", action, var)

    if action == "createxml":
        R = util.ROOMLIST(var)
        C = util.CUSTOMERLIST(var)
        RES = util.RESFORM(var)

        E = util.newHotelRoom()
        E.setName("R01")
        R.addElem(E)
        CC = cust.newCustomer(var)
        CC.setDescription("I'm the customer")
        CC = C.addElem(CC)
        print CC.getName()
        dt = datetime.date(2014, 1, 2)
        dl = datetime.timedelta(1)
        #        dto = datetime.date(2010,1,5)
        #        q = rutil.createResQueryElem("R01",dfrom,dto)
        #        print q
        re = util.newResForm(var)
        re.setCustomerName(CC.getName())
        for i in range(10):
            r = util.newResAddPayment()
            r.setNoP(2)
            r.setPrice(con.toB(100.0))
            r.setPriceTotal(con.toB(100.0))
            r.setPriceList(con.toB(200.0))
            r.setRoomName("R01")
            r.setVat("7%")
            r.setResDate(con.toDate(dt))
            dt = dt + dl
            re.getResDetail().add(r)

        re = RES.addElem(re)
        print re.getName()
        s = rpdf.buildXMLReservation(var, re.getName())
        print s
        tt = pdfutil.xsltHtmlS("mailxslt/reseconfirmation.xslt", s)
        print tt
        H = hmail.HotelMail(var)
        #        H.    def sendMail(self,mtype,resname,custname,subject,content,to,froma,attachList=None,text=True):
        hh = H.sendMail(0, re.getName(), CC.getName(), "Reservation", tt,
                        "*****@*****.**", "hotel")
        assert hh != None
        var["OK"] = True

    if action == "listxml":
        H = hmail.HotelMail(var)
        li = H.getList()
        assert len(li) == 1
        for l in li:
            print l
            print l.getName()
            print l.getReseName()
        var["OK"] = True

    if action == "testfailed":
        H = hmail.HotelMail(var)
        li = H.getList()
        h = li[0]
        # should fail because to space in 'from' address
        hh = H.sendMail(0, h.getReseName(), h.getCustomerName(), "Reservation",
                        "Hi Hi - good joke", "*****@*****.**",
                        "Java hotel")
        assert hh != None
        mailName = hh.getName()
        print mailName
        M = H.getCMail(mailName)
        assert M != None
        res = M.getSendResult()
        print res
        assert res != None
        var["OK"] = True
Пример #13
0
   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"