def get(self): getUsr=verify.verifyUsr(self) if (getUsr!=None): if(unicode(getUsr.key()) in verify.getList([u'Работники',u'Администраторы'])): self.doSmf(getUsr) elif(unicode(getUsr.key()) in verify.getList([u'Внешние службы'])): self.forServ(getUsr) else: self.redirect('/') else: self.redirect('/')
def get(self): getUsr = verify.verifyUsr(self) if (getUsr != None): if (unicode(getUsr.key()) in verify.getList([u'Работники', u'Администраторы'])): self.doSmf(getUsr) elif (unicode(getUsr.key()) in verify.getList([u'Внешние службы'])): self.forServ(getUsr) else: self.redirect('/') else: self.redirect('/')
def doSmf(self, cUsr): self.response.out.write(u""" <html> <head> %s </head> <body> %s <div class="titlePg">Группы:</div> <table> """ % (lcncss.style, lcncss.beg(cUsr.surname))) grps = db.GqlQuery('SELECT * FROM Group') for gr in grps: self.response.out.write("<tr><td>%s</td></tr>" % (gr.name)) self.response.out.write(u"""</table> <hr>""") if (unicode(cUsr.key()) in verify.getList([u'Администраторы'])): self.response.out.write( u"""<form method="post" action="/groups/add"> Добавить группу:<br> Название: <input name="name"> <input type="submit" value="Добавить"> </form>""") self.response.out.write(u"""%s</body></html>""" % lcncss.Mtempl.end)
def post(self): cUsr=verify.verifyUsr(self) if (cUsr!=None): if(unicode(cUsr.key()) in verify.getList([u'Администраторы'])): self.doSmf() else: self.redirect('/groups')
def doSmf(self,cUsr): self.response.out.write(u""" <html> <head> %s </head> <body> %s <div class="titlePg">Группы:</div> <table> """%(lcncss.style,lcncss.beg(cUsr.surname))) grps=db.GqlQuery('SELECT * FROM Group') for gr in grps: self.response.out.write("<tr><td>%s</td></tr>"% (gr.name)) self.response.out.write(u"""</table> <hr>""") if(unicode(cUsr.key()) in verify.getList([u'Администраторы'])): self.response.out.write(u"""<form method="post" action="/groups/add"> Добавить группу:<br> Название: <input name="name"> <input type="submit" value="Добавить"> </form>""") self.response.out.write(u"""%s</body></html>"""%lcncss.Mtempl.end)
def doSmf(self, cUsr): self.response.out.write(u"""<html><head>%s <script src="/script/jquery-1.5.2.min.js"></script> </head><body>%s<div class="titlePg">План закупок оборудования:</div>""" % (lcncss.style, lcncss.beg(cUsr.surname))) peqs = db.GqlQuery('SELECT * FROM PlanEq') self.response.out.write(u"""<table border="1"> <tr><th></th><th>Название</th><th>Колличество</th><th>Комментарий</th><th>Ответственные</th></tr>""" ) for peq in peqs: crOrd = "" delPg = "" if (cUsr.key() == peq.respWk.key()): crOrd = u"<a href=\"/planeq/to-order?kplan=%s\">(Создать заявку)</a>" % peq.key( ) delPg = u"""<input type="button" onclick=\"javascript:(function(){ $.post('/planeq/del',{pkey: '%s'}); window.location.href='/planeq'; })()\" value="X">""" % peq.key() self.response.out.write( u"<tr><td>%s</td> <td>%s %s</td> <td>%s</td><td>%s</td>" % (delPg, peq.equipment.name, crOrd, peq.quantity, peq.comment)) self.response.out.write( "<td><a href=\"/workers/workerPg?wkey=%s\">%s</a></td></tr>" % (peq.respWk.key(), peq.respWk.surname)) if (unicode(cUsr.key()) in verify.getList([u'Администраторы', u'Работники'])): self.response.out.write( u'</table><br/><input type="button" onclick="javascript:location.href=\'/pgplaneqadd\'" value="Добавить оборудование в план"> ' ) self.response.out.write(u"""%s</body></html>""" % lcncss.Mtempl.end)
def get(self): cUsr=verify.verifyUsr(self) if (cUsr!=None): if(unicode(cUsr.key()) in verify.getList([u'Администраторы',u'Работники'])): self.doSmf() else: self.redirect('/')
def post(self): cUsr = verify.verifyUsr(self) if (cUsr != None): if (unicode(cUsr.key()) in verify.getList([u'Администраторы'])): self.doSmf() else: self.redirect('/groups')
def doSmf(self,cUsr): self.response.out.write(u"""<html><head>%s <script src="/script/jquery-1.5.2.min.js"></script> </head><body>%s<div class="titlePg">План закупок оборудования:</div>"""%(lcncss.style,lcncss.beg(cUsr.surname))) peqs=db.GqlQuery('SELECT * FROM PlanEq') self.response.out.write(u"""<table border="1"> <tr><th></th><th>Название</th><th>Колличество</th><th>Комментарий</th><th>Ответственные</th></tr>""") for peq in peqs: crOrd="" delPg="" if (cUsr.key()==peq.respWk.key() ): crOrd=u"<a href=\"/planeq/to-order?kplan=%s\">(Создать заявку)</a>"%peq.key() delPg=u"""<input type="button" onclick=\"javascript:(function(){ $.post('/planeq/del',{pkey: '%s'}); window.location.href='/planeq'; })()\" value="X">"""%peq.key() self.response.out.write(u"<tr><td>%s</td> <td>%s %s</td> <td>%s</td><td>%s</td>" % (delPg,peq.equipment.name,crOrd,peq.quantity,peq.comment)) self.response.out.write("<td><a href=\"/workers/workerPg?wkey=%s\">%s</a></td></tr>" % (peq.respWk.key(),peq.respWk.surname)) if(unicode(cUsr.key()) in verify.getList([u'Администраторы',u'Работники'])): self.response.out.write(u'</table><br/><input type="button" onclick="javascript:location.href=\'/pgplaneqadd\'" value="Добавить оборудование в план"> ') self.response.out.write(u"""%s</body></html>"""%lcncss.Mtempl.end)
def post(self): cUsr = verify.verifyUsr(self) if cUsr != None: if unicode(cUsr.key()) in verify.getList([u"Администраторы", u"Работники", u"Внешние службы"]): self.doSmf(cUsr) else: self.redirect("/")
def get(self): cUsr = verify.verifyUsr(self) if (cUsr != None): if (unicode(cUsr.key()) in verify.getList([u'Администраторы', u'Работники'])): self.doSmf() else: self.redirect('/')
def doSmf(self,cUsr): wk=db.get(self.request.get('wkey')) if(cUsr.key()==wk.key() or (unicode(cUsr.key()) in verify.getList([u'Администраторы']))): wk.surname=self.request.get('surname') wk.patronymic=self.request.get('patronymic') wk.name=self.request.get('name') wk.email=self.request.get('email') wk.phone=self.request.get('phone') wk.put() if(unicode(cUsr.key()) in verify.getList([u'Администраторы',u'Работники'])): gr_wk=db.GqlQuery('SELECT * FROM UsrGroup WHERE user=:worker',worker=wk) db.delete(gr_wk) lst_k_grps=self.request.get('groups').split(':') if(len(lst_k_grps)==1 and lst_k_grps[0]==u""): lst_k_grps=[] for kgrp in lst_k_grps: ugrp=UsrGroup(user=wk,group=db.get(kgrp)) ugrp.put() self.redirect('/workers')
def get(self): cUsr=verify.verifyUsr(self) if (cUsr!=None): _ord=db.get(self.request.get('kord')) end=db.GqlQuery('SELECT * FROM Endorsment WHERE order=:order and submiter=:sbm',order=_ord,sbm=cUsr) if (cUsr.key()==_ord.respWk.key() or (end.count()>0 and verify.verifyRightEndors(cUsr,end[0]))): self.doSmf(cUsr) elif (unicode(cUsr.key()) in verify.getList([u'Работники',u'Внешние службы'])): self.showAll(cUsr) else: self.redirect('/')
def doSmf(self, cUsr): self.response.out.write(u"""<html><head>%s</head><body>%s <div class="titlePg">Список плательщиков:</div> <table border="1"> <tr><th>Плательщик</th></tr> """%(lcncss.style,lcncss.beg(cUsr.surname))) prs=db.GqlQuery('SELECT * FROM Payer') for pr in prs: self.response.out.write("<tr><td>%s</td></tr>"%(pr.name)) self.response.out.write(u"""</table>""") if(unicode(cUsr.key()) in verify.getList([u'Администраторы',u'Работники'])): self.response.out.write(u"""<form method="post" action="/payer/add"> </br>Добавить плательщика:</br> Название: <input name="name"> <input type="submit" value="Добавить"> </form>""") self.response.out.write(u"""%s</body></html>"""%lcncss.Mtempl.end)
def doSmf(self,cUsr): self.response.out.write(u"""<html><head>%s</head><body>%s <div class="titlePg">Список оборудования:</div><table border="1">"""%(lcncss.style,lcncss.beg(cUsr.surname))) eqs=db.GqlQuery('SELECT * FROM Equipment') for eq in eqs: self.response.out.write("<tr><td>%s</td></tr>" % (eq.name)) self.response.out.write(u"""</table></br>""") if(unicode(cUsr.key()) in verify.getList([u'Администраторы',u'Работники'])): self.response.out.write(u""" <form method="post" action="/equipment/add"> Добавить оборудование:</br> <input name="name" size="50"><input type="submit" value="Добавить"> </form>""") self.response.out.write(u""" %s</body></html>"""%lcncss.Mtempl.end)
def get(self): cUsr = verify.verifyUsr(self) if (cUsr != None): _ord = db.get(self.request.get('kord')) end = db.GqlQuery( 'SELECT * FROM Endorsment WHERE order=:order and submiter=:sbm', order=_ord, sbm=cUsr) if (cUsr.key() == _ord.respWk.key() or (end.count() > 0 and verify.verifyRightEndors(cUsr, end[0]))): self.doSmf(cUsr) elif (unicode(cUsr.key()) in verify.getList([u'Работники', u'Внешние службы'])): self.showAll(cUsr) else: self.redirect('/')
def doSmf(self, cUsr): self.response.out.write( u"""<html><head>%s</head><body>%s <div class="titlePg">Список плательщиков:</div> <table border="1"> <tr><th>Плательщик</th></tr> """ % (lcncss.style, lcncss.beg(cUsr.surname))) prs = db.GqlQuery('SELECT * FROM Payer') for pr in prs: self.response.out.write("<tr><td>%s</td></tr>" % (pr.name)) self.response.out.write(u"""</table>""") if (unicode(cUsr.key()) in verify.getList([u'Администраторы', u'Работники'])): self.response.out.write( u"""<form method="post" action="/payer/add"> </br>Добавить плательщика:</br> Название: <input name="name"> <input type="submit" value="Добавить"> </form>""") self.response.out.write(u"""%s</body></html>""" % lcncss.Mtempl.end)
def doSmf(self, cUsr): self.response.out.write( u"""<html><head>%s</head><body>%s <div class="titlePg">Список оборудования:</div><table border="1">""" % (lcncss.style, lcncss.beg(cUsr.surname))) eqs = db.GqlQuery('SELECT * FROM Equipment') for eq in eqs: self.response.out.write("<tr><td>%s</td></tr>" % (eq.name)) self.response.out.write(u"""</table></br>""") if (unicode(cUsr.key()) in verify.getList([u'Администраторы', u'Работники'])): self.response.out.write(u""" <form method="post" action="/equipment/add"> Добавить оборудование:</br> <input name="name" size="50"><input type="submit" value="Добавить"> </form>""") self.response.out.write(u""" %s</body></html>""" % lcncss.Mtempl.end)
def doSmf(self,cUsr): self.response.out.write(u"""<html><head>%s <script src="/script/jquery-1.5.2.min.js"></script> <script src="/script/my.js"></script> <script type="text/javascript"> $(document).ready( function() { $('select[name=eqid]').change(function() { changeEn('select[name=eqid]','#eqname') } ) } ); </script> </head><body>%s <div class="titlePg"> Добавить оборудование в план:</div> <table> <tr><td>Оборудование:</td> <td><SELECT style="width: 200px;" name="eqid">"""%(lcncss.style,lcncss.beg(cUsr.surname))) eqs=db.GqlQuery('SELECT * FROM Equipment ORDER BY name') for eq in eqs: self.response.out.write(u" <OPTION VALUE=\"%s\">%s"%(eq.key(),eq.name)) self.response.out.write(u" <OPTION VALUE=\"none\">----Ввести своё----") self.response.out.write(u'</SELECT>') self.response.out.write(u'<br/><div style="width:110px;"></div><textarea id="eqname" name="eqname" style="width:200px;height:100;" DISABLED></textarea></td></tr>') self.response.out.write(u'<tr><td>Ответственный:</td>') self.response.out.write(u'<td><SELECT name=\"resp\">') wks=db.GqlQuery('SELECT * FROM Worker ORDER BY surname') for wk in wks: if(unicode(cUsr.key()) in verify.getList([u'Администраторы']) and unicode(wk.key()) in verify.getList([u'Ответственные']) ): self.response.out.write(u"<OPTION value=\"%s\">%s</br>"%(wk.key(),wk.surname)) elif(unicode(cUsr.key()) in verify.getList([u'Ответственные']) and wk.key()==cUsr.key()): self.response.out.write(u"<OPTION value=\"%s\">%s</br>"%(wk.key(),wk.surname)) self.response.out.write(u'</SELECT></td></tr>') self.response.out.write(u""" <tr><td>Количество:</td><td><input name="quant"></td></tr> <tr><td>Коментарий:</td><td><input name="comment"></td></tr></table> <input value="Добавить" type="button" onclick="javascript:(function(){ str='/planeq/add?'; if($('select[name=eqid]')[0].value=='none') { str=str+'eqname='+$('#eqname')[0].value; } else { sl=document.getElementsByName('eqid'); str=str+'eqid='+sl[0].value; } inp=document.getElementsByName('quant'); str=str+'&quant='+inp[0].value; inp=document.getElementsByName('comment'); str=str+'&comment='+inp[0].value+'&resp='; str=str+document.getElementsByName('resp')[0].value; window.location.href=str})()"> """) self.response.out.write("""%s</body></html> """%(lcncss.Mtempl.end))
def doSmf(self,cUsr): _ord=db.get(self.request.get('kord')) self.response.out.write(u"""<html><head>%s <script src="/script/jquery-1.5.2.min.js"></script> <script src="/script/my.js"></script> <script type="text/javascript"> $(document).ready( function() { $('.dis').attr('disabled',true); submCh=$('#submCh').remove(); $('#enbtn').click( function() { $('.dis').attr('disabled',false); $('#enbtn').replaceWith(submCh); } ); var price='' var calc = function(){ $('#cost')[0].value=($('input[name=price]')[0].value*$('#quant')[0].value).toFixed(3); } $('input[name=price]').keyup(calc); $('#quant').keyup(calc); } ); </script> <script>equipment='%s';</script> </head><body>%s<div class="titlePg">Правка заявки</div><table>"""%(lcncss.style,_ord.equipment.key(),lcncss.beg(cUsr.surname))) self.response.out.write(u"<tr><td>Оборудование: </td><td>%s</td></tr>"%_ord.equipment.name) self.response.out.write(u"<tr><td>Количество:</td> <td><input class=\"dis\" id=\"quant\" value=\"%s\"></td></tr>"%_ord.quantity) self.response.out.write(u"<tr><td>Цена(руб.):</td> <td><input class=\"dis\" name=\"price\" value=\"%s\"></td></tr>"%_ord.price) self.response.out.write(u"<tr><td>Стоимость:</td> <td><input DISABLED id=\"cost\" value=\"%s\"></td></tr>"%(_ord.quantity*_ord.price)) self.response.out.write(u"<tr><td>Поставщик:</td> <td><SELECT class=\"dis\" name=\"vendor\">") vds =db.GqlQuery("SELECT * FROM Vendor") for vd in vds: if(vd.key()==_ord.vendor.key()): self.response.out.write(u"<OPTION SELECTED value=\"%s\">%s\n"%(vd.key(),vd.name)) else: self.response.out.write(u"<OPTION value=\"%s\">%s"%(vd.key(),vd.name)) self.response.out.write(u"</SELECT></td></tr>") self.response.out.write(u"""<tr><td>Статус заявки:</td> <td><SELECT class=\"dis\" name=\"status\">""") if(_ord.status==0): self.response.out.write(u"""<OPTION SELECTED value=\"0\">Черновик <OPTION value=\"1\">На одобрение</SELECT></td></tr>""") elif (_ord.status==1): self.response.out.write(u""" <OPTION value=\"0\">Черновик <OPTION SELECTED value=\"1\">На одобрение</SELECT></td></tr>""") elif (_ord.status==2): self.response.out.write(u""" <OPTION value=\"0\">Черновик <OPTION SELECTED value=\"2\">Одобрена</SELECT></td></tr>""") elif (_ord.status==3): self.response.out.write(u""" <OPTION value=\"0\">Черновик <OPTION SELECTED value=\"3\">Исполнена</SELECT></td></tr>""") self.response.out.write(u"""<tr><td>Дата поставки:</td> <td><input class=\"dis\" name=\"dateVend\" value=\"%s\"></td></tr>"""%_ord.dateVend) self.response.out.write(u"<tr><td>Плательщик:</td> <td><SELECT class=\"dis\" name=\"payer\">") prs =db.GqlQuery("SELECT * FROM Payer") for pr in prs: if(pr.key()==_ord.payer.key()): self.response.out.write(u"<OPTION SELECTED value=\"%s\">%s"%(pr.key(),pr.name)) else: self.response.out.write(u"<OPTION value=\"%s\">%s"%(pr.key(),pr.name)) self.response.out.write(u"</SELECT></td></tr>") self.response.out.write(u"""<tr><td>Тип оплаты:</td><td><SELECT class=\"dis\" name="tpaymnt">""") tps=db.GqlQuery("SELECT * FROM TypePayment") for tp in tps: if(tp.key()==_ord.typePayment.key()): self.response.out.write(u"<OPTION SELECTED value=\"%s\">%s"%(tp.key(),tp.name)) else: self.response.out.write(u"<OPTION value=\"%s\">%s"%(tp.key(),tp.name)) self.response.out.write(u"""</SELECT></td></tr> <tr><td>Тех.здание:<br/> (укажите ссылку на документ ТЗ):<br/> <a href="https://docs.google.com">https://docs.google.com</> </td> <td><input class="dis" name="tz" value="%s"></br><a href="%s">%s</a></td></tr>"""%(_ord.tz,_ord.tz,_ord.tz)) #опциональное self.response.out.write(u"<tr><td>Ответственные:</td> <td>%s</td></tr></table>"%workers.getLnkToProfile(_ord.respWk)) self.response.out.write(u'Утверждают:</br>') wks=db.GqlQuery('SELECT * FROM Worker ORDER BY surname') ends=db.GqlQuery('SELECT * FROM Endorsment WHERE order=:order',order=_ord) e=None for _wk in wks: tmp=False allEnd=True sbm="" for end in ends: if(end.submit==False): allEnd=False if (_wk.key()==end.submiter.key()): if (end.submit==True): sbm=u"(Одобрил)" if(verify.verifyRightEndors(cUsr,end) and end.submit==False): e=end tmp=True break if(tmp==True): if(_wk.key()!=_ord.respWk.key()): if(unicode(_wk.key()) in verify.getList([u'Работники'])): self.response.out.write(u"<input class=\"dis\" CHECKED type=\"checkbox\" name=\"submiters\" value=\"%s\">%s %s</br>"%(_wk.key(),workers.getLnkToProfile(_wk),sbm)) else: if(_wk.key()!=_ord.respWk.key()): if(unicode(_wk.key()) in verify.getList([u'Работники'])): self.response.out.write(u"<input class=\"dis\" type=\"checkbox\" name=\"submiters\" value=\"%s\">%s</br>"%(_wk.key(),workers.getLnkToProfile(_wk))) if(cUsr.key()==_ord.respWk.key()): if(_ord.status==0 or _ord.status==1): self.response.out.write(u"<div class=\"notice\">Уважаемые коллеги! если заявка находится на одобрении и вы решили изменить какие-то данные то все \"Подтверждения\" на закупку будут сброшены. </div>") self.response.out.write(u"<input id=\"enbtn\"type=\"button\" name=\"enable\" value=\"Разблокировать для изменения\">") self.response.out.write(u"""<div id="submCh"><input type="button" value="Принять изменения" onclick="javascript: (function(){ if($('select[name=status]')[0].value==1 && $('input[name=price]')[0].value=='') alert('Введите цену'); else if($('select[name=status]')[0].value==1 && $('input[name=dateVend]')[0].value=='') alert('Введите дату поставки'); else if($('select[name=status]')[0].value==1 && $('input[name=tz]')[0].value=='') alert('Введите ccылку на ТЗ'); else if(!checkCount('submiters')) alert('Отметте кто утверждает заявку'); else { window.location.href='/order/update?ord=%s'+'&quant='+document.getElementById('quant').value+'&price='+document.getElementsByName('price')[0].value+'&vendor='+document.getElementsByName('vendor')[0].value+'&status='+document.getElementsByName('status')[0].value+'&date='+document.getElementsByName('dateVend')[0].value+'&payer='+document.getElementsByName('payer')[0].value+'&tpay='+document.getElementsByName('tpaymnt')[0].value+'&tz='+document.getElementsByName('tz')[0].value+'&resp=%s'+'&ends='+getList('submiters') } })()">"""%(_ord.key(),_ord.respWk.key())) self.response.out.write(u"""<input type="button" value="Удалить заявку" onclick="javascript:window.location.href='/order/dell?ord=%s';" > </div>"""%(_ord.key())) elif(_ord.status==2): self.response.out.write(u"""<input type="button" value="Исполнена" onclick="javascript:window.location.href='/order/tohist?ord=%s';" > """%(_ord.key())) self.response.out.write(u"""<input type="button" value="Удалить заявку" onclick="javascript:window.location.href='/order/dell?ord=%s';" > """%(_ord.key())) if(e): self.response.out.write(u"<input type=\"button\" name=\"endsmnt\" value=\"Одобрить\" onclick=\"javascript:window.location.href='/order/submit?endsmnt=%s'\">"%(e.key())) self.response.out.write(u"""%s</body></html>"""%(lcncss.Mtempl.end))
def doSmf(self, cUsr): _ord = db.get(self.request.get('kord')) self.response.out.write( u"""<html><head>%s <script src="/script/jquery-1.5.2.min.js"></script> <script src="/script/my.js"></script> <script type="text/javascript"> $(document).ready( function() { $('.dis').attr('disabled',true); submCh=$('#submCh').remove(); $('#enbtn').click( function() { $('.dis').attr('disabled',false); $('#enbtn').replaceWith(submCh); } ); var price='' var calc = function(){ $('#cost')[0].value=($('input[name=price]')[0].value*$('#quant')[0].value).toFixed(3); } $('input[name=price]').keyup(calc); $('#quant').keyup(calc); } ); </script> <script>equipment='%s';</script> </head><body>%s<div class="titlePg">Правка заявки</div><table>""" % (lcncss.style, _ord.equipment.key(), lcncss.beg(cUsr.surname))) self.response.out.write( u"<tr><td>Оборудование: </td><td>%s</td></tr>" % _ord.equipment.name) self.response.out.write( u"<tr><td>Количество:</td> <td><input class=\"dis\" id=\"quant\" value=\"%s\"></td></tr>" % _ord.quantity) self.response.out.write( u"<tr><td>Цена(руб.):</td> <td><input class=\"dis\" name=\"price\" value=\"%s\"></td></tr>" % _ord.price) self.response.out.write( u"<tr><td>Стоимость:</td> <td><input DISABLED id=\"cost\" value=\"%s\"></td></tr>" % (_ord.quantity * _ord.price)) self.response.out.write( u"<tr><td>Поставщик:</td> <td><SELECT class=\"dis\" name=\"vendor\">" ) vds = db.GqlQuery("SELECT * FROM Vendor") for vd in vds: if (vd.key() == _ord.vendor.key()): self.response.out.write(u"<OPTION SELECTED value=\"%s\">%s\n" % (vd.key(), vd.name)) else: self.response.out.write(u"<OPTION value=\"%s\">%s" % (vd.key(), vd.name)) self.response.out.write(u"</SELECT></td></tr>") self.response.out.write( u"""<tr><td>Статус заявки:</td> <td><SELECT class=\"dis\" name=\"status\">""" ) if (_ord.status == 0): self.response.out.write(u"""<OPTION SELECTED value=\"0\">Черновик <OPTION value=\"1\">На одобрение</SELECT></td></tr>""") elif (_ord.status == 1): self.response.out.write(u""" <OPTION value=\"0\">Черновик <OPTION SELECTED value=\"1\">На одобрение</SELECT></td></tr>""") elif (_ord.status == 2): self.response.out.write(u""" <OPTION value=\"0\">Черновик <OPTION SELECTED value=\"2\">Одобрена</SELECT></td></tr>""") elif (_ord.status == 3): self.response.out.write(u""" <OPTION value=\"0\">Черновик <OPTION SELECTED value=\"3\">Исполнена</SELECT></td></tr>""") self.response.out.write( u"""<tr><td>Дата поставки:</td> <td><input class=\"dis\" name=\"dateVend\" value=\"%s\"></td></tr>""" % _ord.dateVend) self.response.out.write( u"<tr><td>Плательщик:</td> <td><SELECT class=\"dis\" name=\"payer\">" ) prs = db.GqlQuery("SELECT * FROM Payer") for pr in prs: if (pr.key() == _ord.payer.key()): self.response.out.write(u"<OPTION SELECTED value=\"%s\">%s" % (pr.key(), pr.name)) else: self.response.out.write(u"<OPTION value=\"%s\">%s" % (pr.key(), pr.name)) self.response.out.write(u"</SELECT></td></tr>") self.response.out.write( u"""<tr><td>Тип оплаты:</td><td><SELECT class=\"dis\" name="tpaymnt">""" ) tps = db.GqlQuery("SELECT * FROM TypePayment") for tp in tps: if (tp.key() == _ord.typePayment.key()): self.response.out.write(u"<OPTION SELECTED value=\"%s\">%s" % (tp.key(), tp.name)) else: self.response.out.write(u"<OPTION value=\"%s\">%s" % (tp.key(), tp.name)) self.response.out.write(u"""</SELECT></td></tr> <tr><td>Тех.здание:<br/> (укажите ссылку на документ ТЗ):<br/> <a href="https://docs.google.com">https://docs.google.com</> </td> <td><input class="dis" name="tz" value="%s"></br><a href="%s">%s</a></td></tr>""" % (_ord.tz, _ord.tz, _ord.tz)) #опциональное self.response.out.write( u"<tr><td>Ответственные:</td> <td>%s</td></tr></table>" % workers.getLnkToProfile(_ord.respWk)) self.response.out.write(u'Утверждают:</br>') wks = db.GqlQuery('SELECT * FROM Worker ORDER BY surname') ends = db.GqlQuery('SELECT * FROM Endorsment WHERE order=:order', order=_ord) e = None for _wk in wks: tmp = False allEnd = True sbm = "" for end in ends: if (end.submit == False): allEnd = False if (_wk.key() == end.submiter.key()): if (end.submit == True): sbm = u"(Одобрил)" if (verify.verifyRightEndors(cUsr, end) and end.submit == False): e = end tmp = True break if (tmp == True): if (_wk.key() != _ord.respWk.key()): if (unicode(_wk.key()) in verify.getList([u'Работники'])): self.response.out.write( u"<input class=\"dis\" CHECKED type=\"checkbox\" name=\"submiters\" value=\"%s\">%s %s</br>" % (_wk.key(), workers.getLnkToProfile(_wk), sbm)) else: if (_wk.key() != _ord.respWk.key()): if (unicode(_wk.key()) in verify.getList([u'Работники'])): self.response.out.write( u"<input class=\"dis\" type=\"checkbox\" name=\"submiters\" value=\"%s\">%s</br>" % (_wk.key(), workers.getLnkToProfile(_wk))) if (cUsr.key() == _ord.respWk.key()): if (_ord.status == 0 or _ord.status == 1): self.response.out.write( u"<div class=\"notice\">Уважаемые коллеги! если заявка находится на одобрении и вы решили изменить какие-то данные то все \"Подтверждения\" на закупку будут сброшены. </div>" ) self.response.out.write( u"<input id=\"enbtn\"type=\"button\" name=\"enable\" value=\"Разблокировать для изменения\">" ) self.response.out.write( u"""<div id="submCh"><input type="button" value="Принять изменения" onclick="javascript: (function(){ if($('select[name=status]')[0].value==1 && $('input[name=price]')[0].value=='') alert('Введите цену'); else if($('select[name=status]')[0].value==1 && $('input[name=dateVend]')[0].value=='') alert('Введите дату поставки'); else if($('select[name=status]')[0].value==1 && $('input[name=tz]')[0].value=='') alert('Введите ccылку на ТЗ'); else if(!checkCount('submiters')) alert('Отметте кто утверждает заявку'); else { window.location.href='/order/update?ord=%s'+'&quant='+document.getElementById('quant').value+'&price='+document.getElementsByName('price')[0].value+'&vendor='+document.getElementsByName('vendor')[0].value+'&status='+document.getElementsByName('status')[0].value+'&date='+document.getElementsByName('dateVend')[0].value+'&payer='+document.getElementsByName('payer')[0].value+'&tpay='+document.getElementsByName('tpaymnt')[0].value+'&tz='+document.getElementsByName('tz')[0].value+'&resp=%s'+'&ends='+getList('submiters') } })()">""" % (_ord.key(), _ord.respWk.key())) self.response.out.write( u"""<input type="button" value="Удалить заявку" onclick="javascript:window.location.href='/order/dell?ord=%s';" > </div>""" % (_ord.key())) elif (_ord.status == 2): self.response.out.write( u"""<input type="button" value="Исполнена" onclick="javascript:window.location.href='/order/tohist?ord=%s';" > """ % (_ord.key())) self.response.out.write( u"""<input type="button" value="Удалить заявку" onclick="javascript:window.location.href='/order/dell?ord=%s';" > """ % (_ord.key())) if (e): self.response.out.write( u"<input type=\"button\" name=\"endsmnt\" value=\"Одобрить\" onclick=\"javascript:window.location.href='/order/submit?endsmnt=%s'\">" % (e.key())) self.response.out.write(u"""%s</body></html>""" % (lcncss.Mtempl.end))
def doSmf(self,cUsr): pl=db.get(self.request.get('kplan')) self.response.out.write(u"""<html><head>%s <script src="/script/jquery-1.5.2.min.js"></script> <script src="/script/my.js"></script> <script type="text/javascript">equipment='%s'; $(document).ready(function() { var price='' var calc = function(){ $('input[name=cost]')[0].value=($('input[name=price]')[0].value*$('input[name=quant]')[0].value).toFixed(3); } $('input[name=price]').keyup(calc); $('input[name=quant]').keyup(calc); $('select[name=vendor]').change(function() { changeEn('select[name=vendor]','#newVn') } ) $('select[name=payer]').change(function() { changeEn('select[name=payer]','#newPr') } ) } ); </script> </head><body>%s <div class="titlePg">Создание заявки</div><table>"""%(lcncss.style,pl.equipment.key(),lcncss.beg(cUsr.surname))) self.response.out.write(u"<tr><td>Оборудование: </td><td>%s</td></tr>"%pl.equipment.name) self.response.out.write(u"<tr><td>Количество:</td> <td><input name=\"quant\" value=\"%s\"></td></tr>"%pl.quantity) self.response.out.write(u"<tr><td>Цена(руб.):</td> <td><input name=\"price\"></td></tr>") self.response.out.write(u"<tr><td>Стоимость:</td> <td><input DISABLED name=\"cost\"></td></tr>") self.response.out.write(u"<tr><td>Поставщик:</td> <td><SELECT name=\"vendor\">") vds =db.GqlQuery("SELECT * FROM Vendor") for vd in vds: self.response.out.write(u"<OPTION value=\"%s\">%s"%(vd.key(),vd.name)) self.response.out.write(u" <OPTION VALUE=\"none\">----Ввести своё----") self.response.out.write(u"</SELECT><br/><input id=\"newVn\" DISABLED></td></tr>") self.response.out.write(u"""<tr><td>Статус заявки:</td> <td><SELECT name=\"status\"> <OPTION value=\"0\">Черновик <OPTION value=\"1\">На одобрение</SELECT></td></tr> <tr><td>Дата поставки:</td> <td><input name=\"dateVend\"></td></tr>""") self.response.out.write(u"<tr><td>Плательщик:</td> <td><SELECT name=\"payer\">") prs =db.GqlQuery("SELECT * FROM Payer") for pr in prs: self.response.out.write(u"<OPTION value=\"%s\">%s"%(pr.key(),pr.name)) self.response.out.write(u" <OPTION VALUE=\"none\">----Ввести своё----") self.response.out.write(u"</SELECT><br/><input id=\"newPr\" DISABLED></td></tr>") self.response.out.write(u"""<tr><td>Тип оплаты:</td><td><SELECT name="tpaymnt">""") tps=db.GqlQuery("SELECT * FROM TypePayment") for tp in tps: self.response.out.write(u"<OPTION value=\"%s\">%s"%(tp.key(),tp.name)) self.response.out.write(u"""</SELECT></td></tr> <tr><td>Тех.здание:<br/> (укажите ссылку на документ ТЗ):<br/> <a href="https://docs.google.com">https://docs.google.com</> </td> <td><input name="tz"></td></tr>""") #опциональное self.response.out.write(u"<tr><td>Ответственный:</td> <td>%s</td></tr></table>"%pl.respWk.surname) self.response.out.write(u'Утверждают:</br>') wks=db.GqlQuery('SELECT * FROM Worker ORDER BY surname') for _wk in wks: if(_wk.key()!=pl.respWk.key() and unicode(_wk.key()) in verify.getList([u'Работники'])): self.response.out.write(u"<input type=\"checkbox\" name=\"submiters\" value=\"%s\">%s</br>"%(_wk.key(),_wk.surname)) self.response.out.write(u"""<input type="button" value="Создать" onclick="javascript:(function(){ if($('select[name=status]')[0].value==1 && $('input[name=price]')[0].value=='') alert('Введите цену'); else if($('select[name=status]')[0].value==1 && $('input[name=dateVend]')[0].value=='') alert('Введите дату поставки'); else if($('select[name=status]')[0].value==1 && $('input[name=tz]')[0].value=='') alert('Введите ccылку на ТЗ'); else if(!checkCount('submiters')) alert('Отметте кто утверждает заявку'); else { var str='/order/add?eqipm='+equipment+'&quant='+document.getElementsByName('quant')[0].value+'&price='+document.getElementsByName('price')[0].value.replace(',','.')+'&status='+document.getElementsByName('status')[0].value+'&date='+document.getElementsByName('dateVend')[0].value+'&tpay='+document.getElementsByName('tpaymnt')[0].value+'&tz='+document.getElementsByName('tz')[0].value+'&resp=%s'+'&ends='+getList('submiters'); if($('select[name=vendor]')[0].value=='none') { str=str+'&vdname='+$('#newVn')[0].value; } else { str=str+'&vendor='+$('select[name=vendor]')[0].value; } if($('select[name=payer]')[0].value=='none') { str=str+'&prname='+$('#newPr')[0].value; } else { str=str+'&payer='+$('select[name=payer]')[0].value; } $.post('/planeq/del',{pkey: '%s'}); window.location.href=str; } })()">%s</body></html>"""%(pl.respWk.key(),pl.key(), lcncss.Mtempl.end))
def doSmf(self, cUsr): pl = db.get(self.request.get('kplan')) self.response.out.write( u"""<html><head>%s <script src="/script/jquery-1.5.2.min.js"></script> <script src="/script/my.js"></script> <script type="text/javascript">equipment='%s'; $(document).ready(function() { var price='' var calc = function(){ $('input[name=cost]')[0].value=($('input[name=price]')[0].value*$('input[name=quant]')[0].value).toFixed(3); } $('input[name=price]').keyup(calc); $('input[name=quant]').keyup(calc); $('select[name=vendor]').change(function() { changeEn('select[name=vendor]','#newVn') } ) $('select[name=payer]').change(function() { changeEn('select[name=payer]','#newPr') } ) } ); </script> </head><body>%s <div class="titlePg">Создание заявки</div><table>""" % (lcncss.style, pl.equipment.key(), lcncss.beg(cUsr.surname))) self.response.out.write( u"<tr><td>Оборудование: </td><td>%s</td></tr>" % pl.equipment.name) self.response.out.write( u"<tr><td>Количество:</td> <td><input name=\"quant\" value=\"%s\"></td></tr>" % pl.quantity) self.response.out.write( u"<tr><td>Цена(руб.):</td> <td><input name=\"price\"></td></tr>") self.response.out.write( u"<tr><td>Стоимость:</td> <td><input DISABLED name=\"cost\"></td></tr>" ) self.response.out.write( u"<tr><td>Поставщик:</td> <td><SELECT name=\"vendor\">") vds = db.GqlQuery("SELECT * FROM Vendor") for vd in vds: self.response.out.write(u"<OPTION value=\"%s\">%s" % (vd.key(), vd.name)) self.response.out.write(u" <OPTION VALUE=\"none\">----Ввести своё----") self.response.out.write( u"</SELECT><br/><input id=\"newVn\" DISABLED></td></tr>") self.response.out.write( u"""<tr><td>Статус заявки:</td> <td><SELECT name=\"status\"> <OPTION value=\"0\">Черновик <OPTION value=\"1\">На одобрение</SELECT></td></tr> <tr><td>Дата поставки:</td> <td><input name=\"dateVend\"></td></tr>""") self.response.out.write( u"<tr><td>Плательщик:</td> <td><SELECT name=\"payer\">") prs = db.GqlQuery("SELECT * FROM Payer") for pr in prs: self.response.out.write(u"<OPTION value=\"%s\">%s" % (pr.key(), pr.name)) self.response.out.write(u" <OPTION VALUE=\"none\">----Ввести своё----") self.response.out.write( u"</SELECT><br/><input id=\"newPr\" DISABLED></td></tr>") self.response.out.write( u"""<tr><td>Тип оплаты:</td><td><SELECT name="tpaymnt">""") tps = db.GqlQuery("SELECT * FROM TypePayment") for tp in tps: self.response.out.write(u"<OPTION value=\"%s\">%s" % (tp.key(), tp.name)) self.response.out.write(u"""</SELECT></td></tr> <tr><td>Тех.здание:<br/> (укажите ссылку на документ ТЗ):<br/> <a href="https://docs.google.com">https://docs.google.com</> </td> <td><input name="tz"></td></tr>""") #опциональное self.response.out.write( u"<tr><td>Ответственный:</td> <td>%s</td></tr></table>" % pl.respWk.surname) self.response.out.write(u'Утверждают:</br>') wks = db.GqlQuery('SELECT * FROM Worker ORDER BY surname') for _wk in wks: if (_wk.key() != pl.respWk.key() and unicode(_wk.key()) in verify.getList([u'Работники'])): self.response.out.write( u"<input type=\"checkbox\" name=\"submiters\" value=\"%s\">%s</br>" % (_wk.key(), _wk.surname)) self.response.out.write( u"""<input type="button" value="Создать" onclick="javascript:(function(){ if($('select[name=status]')[0].value==1 && $('input[name=price]')[0].value=='') alert('Введите цену'); else if($('select[name=status]')[0].value==1 && $('input[name=dateVend]')[0].value=='') alert('Введите дату поставки'); else if($('select[name=status]')[0].value==1 && $('input[name=tz]')[0].value=='') alert('Введите ccылку на ТЗ'); else if(!checkCount('submiters')) alert('Отметте кто утверждает заявку'); else { var str='/order/add?eqipm='+equipment+'&quant='+document.getElementsByName('quant')[0].value+'&price='+document.getElementsByName('price')[0].value.replace(',','.')+'&status='+document.getElementsByName('status')[0].value+'&date='+document.getElementsByName('dateVend')[0].value+'&tpay='+document.getElementsByName('tpaymnt')[0].value+'&tz='+document.getElementsByName('tz')[0].value+'&resp=%s'+'&ends='+getList('submiters'); if($('select[name=vendor]')[0].value=='none') { str=str+'&vdname='+$('#newVn')[0].value; } else { str=str+'&vendor='+$('select[name=vendor]')[0].value; } if($('select[name=payer]')[0].value=='none') { str=str+'&prname='+$('#newPr')[0].value; } else { str=str+'&payer='+$('select[name=payer]')[0].value; } $.post('/planeq/del',{pkey: '%s'}); window.location.href=str; } })()">%s</body></html>""" % (pl.respWk.key(), pl.key(), lcncss.Mtempl.end))
def doSmf(self,cUsr): self.response.out.write(u"""<html> <head> <script src="/script/jquery-1.5.2.min.js"></script> <script src="/script/my.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#sbm').click( function() { if(checkmail($('#email')[0].value)) {$('form')[0].submit();} } ); }) </script> %s</head> <body>%s"""%(lcncss.style,lcncss.beg(cUsr.surname))) wks=db.GqlQuery('SELECT * FROM Worker ORDER BY surname') self.response.out.write(u'<div class="titlePg">Список сотрудников лаборатории:</div>') self.response.out.write('<table border="1">') self.response.out.write(u""" <tr><th>Фамилия</th><th>Имя</th><th>Отчество</th><th>E-mail</th><th>Телефон</th> </tr> """) for wk in wks: self.response.out.write("<tr><td><a href=\"/workers/workerPg?wkey=%s\">%s</a></td><td>%s</td><td>%s</td><td><a href=\"mailto:%s\">%s</a></td><td>%s</td>"%(wk.key(),wk.surname,wk.name,wk.patronymic,wk.email,wk.email,wk.phone)) if(unicode(cUsr.key()) in verify.getList([u'Администраторы'])): self.response.out.write("<td>%s</td>"%(wk.passwd)) self.response.out.write("</tr>") self.response.out.write('</table></br>') if(unicode(cUsr.key()) in verify.getList([u'Администраторы'])): self.response.out.write(u""" <form method="post" action="/workers/add"> <div>Добавить сотрудника</div> <div> <div style="float:left;line-height:26px;"> Фамилия: </br> Имя:</br> Отчество:</br> E-mail:</br> Телефон:</br> </div> <div> <input name="surname"></br> <input name="name"></br> <input name="patronymic"></br> <input id="email" name="email"></br> <input name="phone"></br> </div> </div> <input id="sbm" type="button" value="Добавить"> </form>""") self.response.out.write("""%s</body></html>"""%lcncss.Mtempl.end)
def doSmf(self,cUsr): _wk=db.get(self.request.get('wkey')) self.response.out.write("""<html> <head> %s <script src="/script/jquery-1.5.2.min.js"></script> <script src="/script/my.js"></script> <script type="text/javascript"> $(document).ready( function() { $("#sbm").click(function() { var lst = getList('group'); var frm = $('<form method="post" action="/workers/worker/update">' +'<input name="wkey" value="%s">' +'<input name="surname" value="'+$('#surname')[0].value+'">' +'<input name="name" value="'+$('#name')[0].value+'">' +'<input name="patronymic" value="'+ $('#patronymic')[0].value +'">' +'<input name="email" value="'+$('#email')[0].value+'">' +'<input name="phone" value="'+$('#phone')[0].value+'">' +'<input name="groups" value="'+lst+'"></form>'); if(checkmail($('#email')[0].value)){ $('body').append(frm); frm.submit();} } ) }); </script> </head> <body>%s"""%(lcncss.style,_wk.key(),lcncss.beg(cUsr.surname))) self.response.out.write(u"<div class=\"titlePg\">Данные сотрудника</div>") self.response.out.write(u""" <div> <div style="float:left; height:100%; line-height:26px;"> Фамилия: </br> Имя:</br> Отчество:</br> E-mail:</br> Телефон:</br> </div>""") self.response.out.write(u"""<div> <input id="surname" name="surname" value="%s"></br> <input id="name" name="name" value="%s"></br> <input id="patronymic" name="patronymic" value="%s"></br> <input id="email" name="email" value="%s"></br> <input id="phone" name="phone" value="%s"></br> </div>"""%(_wk.surname,_wk.name,_wk.patronymic,_wk.email,_wk.phone)) self.response.out.write(u"Выбрать группы:<br/>") grps = db.GqlQuery('SELECT * FROM Group ORDER BY name') usr_grps=db.GqlQuery('SELECT * FROM UsrGroup WHERE user=:usr',usr=_wk) for grp in grps: tmp=False for usr_grp in usr_grps: if (grp.key()==usr_grp.group.key()): tmp=True break if(tmp==True): self.response.out.write(u"<input DISABLED CHECKED type=\"checkbox\" name=\"group\" value=\"%s\">%s</br>"%(grp.key(),grp.name)) else: self.response.out.write(u"<input DISABLED type=\"checkbox\" name=\"group\" value=\"%s\">%s</br>"%(grp.key(),grp.name)) if(unicode(cUsr.key()) in verify.getList([u'Администраторы']) or cUsr.key()==_wk.key()): self.response.out.write(u"""<input id="sbm" type="button" value="Принять изменения" style="float:left;">""") if(unicode(cUsr.key()) in verify.getList([u'Администраторы'])): self.response.out.write(u"<script type=\"text/javascript\">$('input[name=group]').attr('disabled',false);</script>") self.response.out.write(u"<span style=\"float:left;width:120px;\"> </span><input name=\"wk\" type=\"button\" value=\"Сбросить пароль\" onclick=\"javascript:window.location.href='/worker/gen-reset?wk=%s'\"\></div>"%(_wk.key())) self.response.out.write("""%s</body></html>"""%lcncss.Mtempl.end)
def doSmf(self, cUsr): self.response.out.write(u"""<html><head>%s <script src="/script/jquery-1.5.2.min.js"></script> <script src="/script/my.js"></script> <script type="text/javascript"> $(document).ready( function() { $('select[name=eqid]').change(function() { changeEn('select[name=eqid]','#eqname') } ) } ); </script> </head><body>%s <div class="titlePg"> Добавить оборудование в план:</div> <table> <tr><td>Оборудование:</td> <td><SELECT style="width: 200px;" name="eqid">""" % (lcncss.style, lcncss.beg(cUsr.surname))) eqs = db.GqlQuery('SELECT * FROM Equipment ORDER BY name') for eq in eqs: self.response.out.write(u" <OPTION VALUE=\"%s\">%s" % (eq.key(), eq.name)) self.response.out.write(u" <OPTION VALUE=\"none\">----Ввести своё----") self.response.out.write(u'</SELECT>') self.response.out.write( u'<br/><div style="width:110px;"></div><textarea id="eqname" name="eqname" style="width:200px;height:100;" DISABLED></textarea></td></tr>' ) self.response.out.write(u'<tr><td>Ответственный:</td>') self.response.out.write(u'<td><SELECT name=\"resp\">') wks = db.GqlQuery('SELECT * FROM Worker ORDER BY surname') for wk in wks: if (unicode(cUsr.key()) in verify.getList([u'Администраторы']) and unicode(wk.key()) in verify.getList([u'Ответственные'])): self.response.out.write(u"<OPTION value=\"%s\">%s</br>" % (wk.key(), wk.surname)) elif (unicode(cUsr.key()) in verify.getList([u'Ответственные']) and wk.key() == cUsr.key()): self.response.out.write(u"<OPTION value=\"%s\">%s</br>" % (wk.key(), wk.surname)) self.response.out.write(u'</SELECT></td></tr>') self.response.out.write(u""" <tr><td>Количество:</td><td><input name="quant"></td></tr> <tr><td>Коментарий:</td><td><input name="comment"></td></tr></table> <input value="Добавить" type="button" onclick="javascript:(function(){ str='/planeq/add?'; if($('select[name=eqid]')[0].value=='none') { str=str+'eqname='+$('#eqname')[0].value; } else { sl=document.getElementsByName('eqid'); str=str+'eqid='+sl[0].value; } inp=document.getElementsByName('quant'); str=str+'&quant='+inp[0].value; inp=document.getElementsByName('comment'); str=str+'&comment='+inp[0].value+'&resp='; str=str+document.getElementsByName('resp')[0].value; window.location.href=str})()"> """) self.response.out.write("""%s</body></html> """ % (lcncss.Mtempl.end))