Пример #1
0
    def getToSubm(self, caption, sb, subm):
        rnd_id = random.randrange(20000000)
        ends_sb = db.GqlQuery(
            "SELECT * FROM Endorsment WHERE submiter=:submiter AND submit=:submit",
            submiter=sb,
            submit=subm)

        self.response.out.write(u"""%s(%s)""" % (caption, ends_sb.count()))
        self.response.out.write(
            u"""<input type="button" id="btn%s" onclick="op_cl('%s')" value="Развернуть">"""
            % (rnd_id, rnd_id))

        self.response.out.write(u"""<div id="%s" style="display:none;">""" %
                                (rnd_id))
        self.response.out.write(
            u"""<table border="1"><tr><th>Наименование</th><th>Количество</th><th>Цена(руб.)</th><th>Стоимость</th><th>Поставщик</th><th>Дата поставки</th><th>Ответственные</th><th>Одобрено</th></tr>"""
        )

        for _end_sb in ends_sb:
            _ord = _end_sb.order
            if (_ord.status > 0):
                self.response.out.write(u"<tr>")
                self.response.out.write(
                    "<td><a href=\"/order/update-pg?kord=%s\">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>"
                    %
                    (_ord.key(), nameCut(_ord.equipment.name), _ord.quantity,
                     _ord.price, _ord.quantity * _ord.price, _ord.vendor.name,
                     _ord.dateVend, workers.getLnkToProfile(_ord.respWk)))
                ends = db.GqlQuery(
                    "SELECT * FROM Endorsment WHERE order=:order", order=_ord)
                self.response.out.write("<td><table>")

                for e in ends:
                    mstr = "<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\" onclick=\"javascript:window.location.href=\\\'/order/submit?endsmnt=%s\\\'\">" % (
                        str(e.key()), str(e.key()))
                    if (e.submit == True):
                        mstr = "<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\"CHECKED DISABLED>" % (
                            e.key())
                    elif (sb.key() != e.submiter.key()):
                        mstr = "<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\"DISABLED>" % (
                            e.key())

                    self.response.out.write(
                        "<tr><td>%s</td><td>%s</td></tr>" %
                        (workers.getLnkToProfile(e.submiter), mstr))

                self.response.out.write("</table></td></tr>")
        self.response.out.write("</table>")
        self.response.out.write("</div>")
Пример #2
0
	def getToSubm(self,caption,sb,subm):
		rnd_id=random.randrange(20000000)
		ends_sb=db.GqlQuery("SELECT * FROM Endorsment WHERE submiter=:submiter AND submit=:submit",submiter=sb,submit=subm)
		
		self.response.out.write(u"""%s(%s)"""%(caption,ends_sb.count()))
		self.response.out.write(u"""<input type="button" id="btn%s" onclick="op_cl('%s')" value="Развернуть">"""%(rnd_id,rnd_id))
		
		self.response.out.write(u"""<div id="%s" style="display:none;">"""%(rnd_id))		
		self.response.out.write(u"""<table border="1"><tr><th>Наименование</th><th>Количество</th><th>Цена(руб.)</th><th>Стоимость</th><th>Поставщик</th><th>Дата поставки</th><th>Ответственные</th><th>Одобрено</th></tr>""")
		
		for _end_sb in ends_sb:
			_ord=_end_sb.order
			if (_ord.status>0):
				self.response.out.write(u"<tr>")
				self.response.out.write("<td><a href=\"/order/update-pg?kord=%s\">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>"%(_ord.key(),nameCut(_ord.equipment.name),_ord.quantity,_ord.price,_ord.quantity*_ord.price,_ord.vendor.name,_ord.dateVend,workers.getLnkToProfile(_ord.respWk)))
				ends=db.GqlQuery("SELECT * FROM Endorsment WHERE order=:order",order=_ord)
				self.response.out.write("<td><table>")
			
				for e in ends:
					mstr="<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\" onclick=\"javascript:window.location.href=\\\'/order/submit?endsmnt=%s\\\'\">"%(str(e.key()),str(e.key()))
					if(e.submit==True):
						mstr="<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\"CHECKED DISABLED>"%(e.key())
					elif(sb.key()!=e.submiter.key()):
						mstr="<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\"DISABLED>"%(e.key())
						
					self.response.out.write("<tr><td>%s</td><td>%s</td></tr>"%(workers.getLnkToProfile(e.submiter),mstr))
			
				self.response.out.write("</table></td></tr>")
		self.response.out.write("</table>")
		self.response.out.write("</div>")	
Пример #3
0
	def getMyRough(self,caption,wk,stat): # рисует таблицу для заданного пользователя и статуса заявки
		
		rnd_id=random.randrange(20000000)
		
		ords=db.GqlQuery('SELECT * FROM Order WHERE status=:status AND respWk=:respWk',respWk=wk,status=stat)
		
		self.response.out.write(u"""%s(%s)"""%(caption,ords.count()))
		self.response.out.write(u"""<input type="button" id="btn%s" onclick="op_cl('%s')" value="Развернуть">"""%(rnd_id,rnd_id))
		
		self.response.out.write(u"""<div id="%s" style="display:none;">"""%(rnd_id))
		self.response.out.write(u"""<table border="1"><tr><th>Наименование</th><th>Количество</th><th>Цена(руб.)</th><th>Стоимость</th><th>Поставщик</th><th>Дата поставки</th><th>Ответственные</th><th>Одобрено</th></tr>""")
			
		for _ord in ords:
			self.response.out.write(u"<tr>")
			self.response.out.write("<td><a href=\"/order/update-pg?kord=%s\">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>"%(_ord.key(),nameCut(_ord.equipment.name),_ord.quantity,_ord.price,_ord.quantity*_ord.price,_ord.vendor.name,_ord.dateVend,workers.getLnkToProfile(_ord.respWk)))
			ends=db.GqlQuery("SELECT * FROM Endorsment WHERE order=:order",order=_ord)
			self.response.out.write("<td><table>")
			
			for e in ends:
				mstr="<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\" DISABLED >"%(e.key())
				if(e.submit==True):
					mstr="<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\"CHECKED DISABLED>"%(e.key())
					
				self.response.out.write("<tr><td>%s</td><td>%s</td></tr>"%(workers.getLnkToProfile(e.submiter),mstr))
			
			self.response.out.write("</table></td></tr>")
		self.response.out.write("</table>")
		self.response.out.write("</div>")
Пример #4
0
    def getMyRough(
            self, caption, wk, stat
    ):  # рисует таблицу для заданного пользователя и статуса заявки

        rnd_id = random.randrange(20000000)

        ords = db.GqlQuery(
            'SELECT * FROM Order WHERE status=:status AND respWk=:respWk',
            respWk=wk,
            status=stat)

        self.response.out.write(u"""%s(%s)""" % (caption, ords.count()))
        self.response.out.write(
            u"""<input type="button" id="btn%s" onclick="op_cl('%s')" value="Развернуть">"""
            % (rnd_id, rnd_id))

        self.response.out.write(u"""<div id="%s" style="display:none;">""" %
                                (rnd_id))
        self.response.out.write(
            u"""<table border="1"><tr><th>Наименование</th><th>Количество</th><th>Цена(руб.)</th><th>Стоимость</th><th>Поставщик</th><th>Дата поставки</th><th>Ответственные</th><th>Одобрено</th></tr>"""
        )

        for _ord in ords:
            self.response.out.write(u"<tr>")
            self.response.out.write(
                "<td><a href=\"/order/update-pg?kord=%s\">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>"
                % (_ord.key(), nameCut(_ord.equipment.name), _ord.quantity,
                   _ord.price, _ord.quantity * _ord.price, _ord.vendor.name,
                   _ord.dateVend, workers.getLnkToProfile(_ord.respWk)))
            ends = db.GqlQuery("SELECT * FROM Endorsment WHERE order=:order",
                               order=_ord)
            self.response.out.write("<td><table>")

            for e in ends:
                mstr = "<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\" DISABLED >" % (
                    e.key())
                if (e.submit == True):
                    mstr = "<input type=\"checkbox\" name=\"endsmnt\" value=\"%s\"CHECKED DISABLED>" % (
                        e.key())

                self.response.out.write(
                    "<tr><td>%s</td><td>%s</td></tr>" %
                    (workers.getLnkToProfile(e.submiter), mstr))

            self.response.out.write("</table></td></tr>")
        self.response.out.write("</table>")
        self.response.out.write("</div>")
Пример #5
0
	def showAll(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>
			</head><body>%s<div class="titlePg">Заявка</div><table>"""%(lcncss.style,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>%s</td></tr>"%_ord.quantity)
		
		self.response.out.write(u"<tr><td>Цена(руб.):</td> <td>%s</td></tr>"%_ord.price)
		self.response.out.write(u"<tr><td>Стоимость:</td> <td>%s</td></tr>"%(_ord.quantity*_ord.price))

		self.response.out.write(u"<tr><td>Поставщик:</td> <td>%s</td></tr>"%_ord.vendor.name)
		self.response.out.write(u"""<tr><td>Статус заявки:</td><td>""")

		if(_ord.status==0):
			self.response.out.write(u"""Черновик</td></tr>""")
		elif (_ord.status==1):
			self.response.out.write(u"""На одобрении</td></tr>""")
		elif (_ord.status==2):
			self.response.out.write(u"""Одобрена</td></tr>""")		
		elif (_ord.status==3):
			self.response.out.write(u"""Исполнена</td></tr>""")			
		self.response.out.write(u"""<tr><td>Дата поставки:</td> <td>%s</td></tr>"""%_ord.dateVend)
		
		self.response.out.write(u"<tr><td>Плательщик:</td> <td>%s</td></tr>"%_ord.payer.name)
	
		
		self.response.out.write(u"""<tr><td>Тип оплаты:</td><td>%s</td></tr>	"""%_ord.typePayment.name)
		self.response.out.write(u"""
				<tr><td>Тех.здание:				
				</td> <td><a href="%s">%s</a></td></tr>"""%(_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)
	
		
		
		for end in ends:
				if (end.submit==True):
				 	self.response.out.write(u"<input class=\"dis\" DISABLED CHECKED type=\"checkbox\" name=\"submiters\" >%s</br>"%( workers.getLnkToProfile(end.submiter)))		
				else:
					self.response.out.write(u"<input class=\"dis\" DISABLED CHECKED type=\"checkbox\" name=\"submiters\" >%s</br>"%( workers.getLnkToProfile(end.submiter)))		
				
		
			
		self.response.out.write(u"""%s</body></html>"""%(lcncss.Mtempl.end))
Пример #6
0
	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))
Пример #7
0
    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))
Пример #8
0
    def showAll(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>
			</head><body>%s<div class="titlePg">Заявка</div><table>""" %
                                (lcncss.style, 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>%s</td></tr>" %
                                _ord.quantity)

        self.response.out.write(u"<tr><td>Цена(руб.):</td> <td>%s</td></tr>" %
                                _ord.price)
        self.response.out.write(u"<tr><td>Стоимость:</td> <td>%s</td></tr>" %
                                (_ord.quantity * _ord.price))

        self.response.out.write(u"<tr><td>Поставщик:</td> <td>%s</td></tr>" %
                                _ord.vendor.name)
        self.response.out.write(u"""<tr><td>Статус заявки:</td><td>""")

        if (_ord.status == 0):
            self.response.out.write(u"""Черновик</td></tr>""")
        elif (_ord.status == 1):
            self.response.out.write(u"""На одобрении</td></tr>""")
        elif (_ord.status == 2):
            self.response.out.write(u"""Одобрена</td></tr>""")
        elif (_ord.status == 3):
            self.response.out.write(u"""Исполнена</td></tr>""")
        self.response.out.write(
            u"""<tr><td>Дата поставки:</td> <td>%s</td></tr>""" %
            _ord.dateVend)

        self.response.out.write(u"<tr><td>Плательщик:</td> <td>%s</td></tr>" %
                                _ord.payer.name)

        self.response.out.write(
            u"""<tr><td>Тип оплаты:</td><td>%s</td></tr>	""" %
            _ord.typePayment.name)
        self.response.out.write(u"""
				<tr><td>Тех.здание:				
				</td> <td><a href="%s">%s</a></td></tr>""" %
                                (_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)

        for end in ends:
            if (end.submit == True):
                self.response.out.write(
                    u"<input class=\"dis\" DISABLED CHECKED type=\"checkbox\" name=\"submiters\" >%s</br>"
                    % (workers.getLnkToProfile(end.submiter)))
            else:
                self.response.out.write(
                    u"<input class=\"dis\" DISABLED CHECKED type=\"checkbox\" name=\"submiters\" >%s</br>"
                    % (workers.getLnkToProfile(end.submiter)))

        self.response.out.write(u"""%s</body></html>""" % (lcncss.Mtempl.end))