예제 #1
0
def copy_data_to_backup():
    if settings.SERVER_ENVIRONMENT == 'production':
        # https://<your_username>:<your_password>@commcarehq.cloudant.com/commcarehq
        prod_couchdb_connection = 'https://{username}:{password}@commcarehq.cloudant.com/{database}'.format(
            username=settings.COUCH_USERNAME,
            password=settings.COUCH_PASSWORD,
            database=settings.COUCH_DATABASE_NAME,
        )
        guinea_couchdb_connection = 'https://{username}:{password}@commcarehq.cloudant.com/{database}'.format(
            username=settings.COUCH_USERNAME,
            password=settings.COUCH_PASSWORD,
            database=GUINEA_CONTACT_TRACING_DATABASE,
        )
        last_update = BackupRecord.objects.order_by('last_update')[0].last_update

        call_command('copy_domain',
                     prod_couchdb_connection,
                     GUINEA_CONTACT_TRACING_DOMAIN,
                     guinea_couchdb_connection,
                     **{'since': unicode(last_update)})

        # A dumb soft assert to make sure I see this working
        _assert = soft_assert(to='{}@{}'.format('tsheffels', 'dimagi.com'),
                              notify_admins=False,
                              exponential_backoff=False)
        _assert(False)

        successful_insert = BackupRecord(last_update=date.now())
        successful_insert.save()
예제 #2
0
def date_period(frequency, anniversary, now=None):
    """
    Retrieve a date period given a day of month.
    
    For example, if the period is month:15 and now is equal
    to 2012-11-22 then this method will return the following:
    
        (date(2012, 11, 15), date(2012, 12, 14)) 
    
    Other examples:
        monthly:1 with now 2012-12-1 would return: (date(2012, 11, 1), date(2012, 12, 1))
    
    @param now: A date used to determine some point within a date period.
    @return tuple with date start and stop dates.
    @raise MaxAnniversaryDayError
    @raise DateFrequencyError
    """
    if frequency != DATE_FREQUENCY_MONTHLY:
        raise DateFrequencyError("Only monthly date frequency is supported - not '%s'" % (frequency))
    
    if anniversary > 28:
        raise MaxAnniversaryDayError("'%s' is greater than maximum allowed anniversary day 28." % anniversary)
    
    if not now:
        now = date.now()
   
    if now.day >= anniversary:
        start = date(now.year, now.month, anniversary)
        stop = start + relativedelta(months=+1) + relativedelta(days=-1)
    else:
        stop = date(now.year, now.month, anniversary)
        start = stop + relativedelta(months=-1)
        stop = stop  + relativedelta(days=-1)
    return (start, stop,)
예제 #3
0
def insert_record():
    firstname = request.args.get('firstname')
    lastname = request.args.get('lastname')
    sid = request.args.get('sid')

    insert = open('students.log', 'a')
    date = datetime.now()
    insert_val = '' + str(
        date) + '-' + firstname + '-' + lastname + '-' + sid + '\n'
    insert.write(insert_val)

    log = open('calls.log', 'a')
    log_val = '' + str(date) + '-' + request.path + '\n'
    log.write(log_val)

    insert.close()

    output = [{
        "user": {
            "name": firstname + ' ' + lastname,
            "student no": sid,
            "created": str(date.now())
        }
    }]
    return jsonify(output)
예제 #4
0
 def get_timestamp(self):
     """
     This function gets the timestamp for a transaction
     """
     if self.timestamps is None:
         self.timestamps = date.now()
     return self.timestamps
예제 #5
0
	def store(self, update_timestamp=True):
		if not self.created:
			self.created = datetime.now()
		if not self.published:
			self.published = date.now()
		if update_timestamp or not self.modified:
			self.modified = datetime.now()
		schema.Document.store(self, db)
def get_datepicker_buttons(poll):
    """Get the buttons for the datepicker."""
    current_date = poll.current_date
    if current_date is None:
        current_date = date.now()
        poll.current_date = current_date

    buttons = []

    ignore_payload = f'{CallbackType.ignore.value}:0:0'

    # Add headline
    headline = f'{calendar.month_name[current_date.month]} {current_date.year}'
    buttons.append(
        [InlineKeyboardButton(headline, callback_data=ignore_payload)])

    # Create the week-day column description
    row = []
    for day in ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]:
        row.append(InlineKeyboardButton(day, callback_data=ignore_payload))
    buttons.append(row)

    # Iterate through all days and create respective buttons
    calendar_month = calendar.monthcalendar(current_date.year,
                                            current_date.month)
    for week in calendar_month:
        row = []
        for day in week:
            # Format the text. The currently chosen day should be surrounded by brackets e.g (26)
            day_text = day
            if day > 0:
                this_date = date(year=current_date.year,
                                 month=current_date.month,
                                 day=day)
                if this_date == current_date:
                    day_text = f'({day})'

            # Only create real buttons for actual days of the month
            if (day == 0):
                row.append(
                    InlineKeyboardButton(" ", callback_data=ignore_payload))
            else:
                day_date = date(current_date.year, current_date.month, day)
                payload = f'{CallbackType.set_date.value}:{poll.id}:{day_date.isoformat()}'
                row.append(
                    InlineKeyboardButton(day_text, callback_data=payload))

        buttons.append(row)

    previous_payload = f'{CallbackType.previous_month.value}:{poll.id}:0'
    next_payload = f'{CallbackType.next_month.value}:{poll.id}:0'
    buttons.append([
        InlineKeyboardButton('<', callback_data=previous_payload),
        InlineKeyboardButton('>', callback_data=next_payload),
    ])

    return buttons
예제 #7
0
def next_date_for_day(frequency, day, now=None):
    if frequency != DATE_FREQUENCY_MONTHLY:
        raise DateFrequencyError("Only monthly date frequency is supported - not '%s'" % (frequency))

    if not now:
        now = date.now()
    
    if now.day == day:
        return now

    return date_period(frequency, day, now)[1]
def voto(anoNasc):
    from datetime import date
    idade = date.now().year - anoNasc
    voto = f'Com {idade} anos: '
    if 16 <= idade < 18 or idade > 65:
        voto += "VOTO OPCIONAL"
    elif 18 <= idade <= 65:
        voto += "VOTO OBRIGATÓRIO"
    else:
        voto += "NÃO VOTA"
    return voto
예제 #9
0
def mail_send_mail(mail):
    ##Envia os emails
    if not mail.sended:
        mail_to,subject, message, reply_to = (mail_to,mail.assunto,mail.message,mail.mail_to)
        text_content = html_content = mail.conteudo

        sended = mail.send(mail_to,subject,message,
                           attachments = [mail.Attachment(f.arquivo) for f in mail.attachments] )
        if sended:
            mail.update_record(sended=sended,data_envio=date.now())

    return mail.sended
예제 #10
0
def maa_out():
	# Make the soup, real quick
	quMath_url = "http://www.maa.org/news/rss.xml"
	page_html = urllib2.urlopen(quMath_url) 
	soup = BeautifulSoup(page_html,"html.parser")

	# list of titles,urls,and blurbs
	titles = []
	urList = []
	blurbs = []

	# puts titles and urls into respective lists
	for art in soup.find_all('item'):
		titles.append(art.find('title').text)
		urList.append(art.find('link').text)
#		blurbs.append(art.find('p').text)
#		print art.find('description').find('p').text

	# dates
	dates = []
	# goes into each url that was found
	# and extracts the date
	for i in range(len(urList)):
		art_html = urllib2.urlopen(urList[i])
		mini_soup = BeautifulSoup(art_html,"html.parser")

		for date in mini_soup.find_all('span',{'class':'date-display-single'}):
			# gets the date and if it fails,
			# give it the current date
			try:
				dates.append(parse(date.string))
			except:
				dates.append(date.now())


	# blurbs couldn't be extracted so a generic
	# MAA description was inserted for MAA articles
	for i in range (len(titles)):     
		blurbs.append("News from the Mathematical Association of America.")

	# dictionary containing article info
	articleInfo= {'title': None, 'url': None, 'blurb': None, 'date': None, 'shares': None}
	articlesDictList= []
	# puts values into array of dictionaries
	for i in range(len(titles)):
		articleInfo["title"] = titles[i]
		articleInfo["url"] = urList[i]
		articleInfo["blurb"] = blurbs[i]
		articleInfo["date"] = dates[i]
		articlesDictList.append(articleInfo.copy())
		
	# returns list of articles in dic format
	return articlesDictList
예제 #11
0
def RentBooks(username):
    con2 = sqlite3.connect('library.db')
    c = con2.cursor()
    c.execute(
        "SELECT Book_name,Rented_Date FROM booksDB WHERE Rented_Date='NULL'")
    c.execute(
        "UPDATE booksDB set [Rented_Date]= (:date1), [Rented_to]=(:uname)", {
            'date1': date.now(),
            'uname': username
        })
    print("You have rented the book succesfully")
    con2.commit()
    con2.close()
예제 #12
0
파일: date.py 프로젝트: niteoweb/multitrac
def get_abs_month(abs_month, abs_year=None):
    """docstring for set_abs_month"""
    if not abs_year:
        abs_year = date.now().year

    midnight = time.min

    firstday = date(abs_year, abs_month)
    firstday = datetime.combine(firstday, midnight)

    lastday = date(abs_year, abs_month + 1)
    lastday = datetime.combine(lastday, midnight)

    return firstday, lastday
예제 #13
0
def complex_transaction(description, author, splits, valid_date=None):
    if valid_date is None:
        valid_date = date.now()
    objects = []
    new_transaction = Transaction(
        description=description,
        author=author,
        valid_date=valid_date
    )
    objects.append(new_transaction)
    objects.extend(
        Split(amount=amount, account=account, transaction=new_transaction)
        for (account, amount) in splits
    )
    session.session.add_all(objects)
예제 #14
0
 def validator(self, postData):
     errors = {}
     if len(postData['task']) < 1:
         errors['task'] = "Enter a tasks."
     if len(postData['status'])<1:
         errors['status']="Enter a status"
     if len(postData['date']) < 1:
         errors['date'] = "Enter a Data."
     elif postData['date'] < str(date.now()):
         errors['date'] = "Date must be in the future."
     if len(postData['time']) < 1:
         errors['time'] = "Enter a Time."
     elif postData['time'] < str(time.now()):
         errors['time'] = "time must be in the future."
     return errors
예제 #15
0
#!/usr/bin/env python3

import logging
from datetime import date

logging.basicConfig(filename='example.log', level=logging.DEBUG)
logging.debug('This is the debug message')
logging.warning('Watch out!')  # will print a message to the console
logging.info('I told you so')  # will not print anything
print(date.now())

예제 #16
0
 def is_online(self):
     if ((self.start < date.now()) and (date.now() < self.end)):
         return True
     return False
def update_created_at(obj):
    if type(object) is list:
        for o in obj:
            o.created_at = date.now()
예제 #18
0
#!/bin/python3
###
# ---
# filename: todoDict.py
# date-created: 2018-03-23
# description: Create dict for todo instead of plain md then export as md
# ---

from datetime import date, time



# Timestamps
timestart = date.now()
pause = date.now()
unpause = date.now()
timedone = date.now()


statuscodes = {}
dates = {}
marks = {}
items = {}

marks = dict( ['undone': '- [ ] '], ['done': '- [X] '] )

dates = dict( ['date-created': 'timestart'], ['date-completed': 'timedone'], ['deactivate': 'pause'], ['reactivate': 'unpause'] )

statuscodes = dict( ['status': 'initialized', 'active', 'complete', 'inprogress', 'blocked', 'inactive', 'planning', 'scheduled', 'dependent-task'] )

areas = dict( ['area': 'family', '
예제 #19
0
def statement_of_accounts_list_view(request):
    credits_status = ClientCreditStatus.objects.all()

    context = {'credits_status': credits_status, 'date': date.now()}

    return render(request, 'sales/statement_of_accounts.html', context)
예제 #20
0
 def clean_date(self):
     date = self.cleaned_data['date']
     if date.date() < date.now(tz=pytz.timezone("Europe/Paris")).date():
         raise forms.ValidationError("The date cannot be in the past!")
     return date
예제 #21
0
def in_the_future(value):
    return value > date.now()
예제 #22
0
 def handle(self, *args, **options):
     billings = Billing.objects.filter(next_bill__lte=date.now(), active=True)
     for billing in billings:
         billing.bill()
예제 #23
0
 def is_active(self) -> bool:
     return self.valid_from <= date.now() <= self.valid_until
예제 #24
0
파일: Logger.py 프로젝트: Solonarv/CellWars
 def __init__(self, bufsize = 5):
     # Open file in overwrite mode
     self.logfile = open("cellwars-log-" + date.now().isoformat("-") + ".log", 'w')
     self.bufsize = bufsize
     self.buffer = []
예제 #25
0
 def __init__(self):
     self.created_at = date.now()
     self.modified_at = date.now()
예제 #26
0
 def _get_status(self):
     # Lấy datetime hiện tại theo định dạng mà các trường time được lưu trữ trong cơ sở dữ liệu
     now = dt.now().strftime('%d-%m-%y %H:%M:%S')
예제 #27
0
def make_docx():

    conditions = {}
    subtotals = []
    total = {}

    rtype = 5
    error = 0

    ttl_clr_prc_lst = []

    tbl_1_par_list = []
    tbl_1_par_list_cnr = []


    def get_cur_tmp(currency):
        if currency == 'RUB': result = u'''{:,.2f}р.'''
        if currency == 'RUR': result = u'''{:,.2f}р.'''
        if currency == 'USD': result = u'''${:,.2f}'''
        if currency == 'EUR': result = u'''{:,.2f}€'''
        return result

    def add_tbl_line_srvs(msg, prc_tpe):

        item_index = 1
        ttl_clr_prc_lst = []

        if prc_tpe == 'travel': adt_prc = total['Travel Price']
        if prc_tpe == 'total': adt_prc = total['Total Price']

        for subtotal in subtotals:
            for item in subtotal['items']:
                if item['Local Name'] != '':

                    row_cls_1_1 = doc_tbl_1.add_row().cells

                    tbl_str_1_1_x0 = str(item_index)
                    tbl_str_1_1_x1 = str(item['partnumber'])
                    tbl_str_1_1_x2 = u'{ru_descr}'.format(ru_descr=item['Local Name'])
                    tbl_str_1_1_x3 = str(float(item['Local Price']))
                    tbl_str_1_1_x4 = str(int(item['QTY']))
                    tbl_str_1_1_x5 = str(float(tbl_str_1_1_x3) * float(tbl_str_1_1_x4))

                    ttl_clr_prc_lst.append(float(tbl_str_1_1_x5))

                    row_cls_1_1[0].text = tbl_str_1_1_x0
                    row_cls_1_1[1].text = tbl_str_1_1_x1
                    row_cls_1_1[2].text = tbl_str_1_1_x2
                    row_cls_1_1[3].text = crc_fmt.format(float(tbl_str_1_1_x3))
                    row_cls_1_1[4].text = tbl_str_1_1_x4
                    row_cls_1_1[5].text = crc_fmt.format(float(tbl_str_1_1_x5))

                    tbl_1_par_1 = row_cls_1_1[3].paragraphs
                    tbl_1_par_2 = row_cls_1_1[4].paragraphs
                    tbl_1_par_3 = row_cls_1_1[5].paragraphs

                    for par in tbl_1_par_1: tbl_1_par_list.append(par)
                    for par in tbl_1_par_3: tbl_1_par_list.append(par)
                    for par in tbl_1_par_2: tbl_1_par_list_cnr.append(par)

                    item_index = item_index + 1

                if item['Local Name'] == '':

                    row_cls_1_1 = doc_tbl_1.add_row().cells

                    tbl_str_1_1_x0 = str(item_index)
                    tbl_str_1_1_x1 = str(item['partnumber'])
                    tbl_str_1_1_x2 = u'{en_descr}'.format(en_descr=item['Description'])
                    tbl_str_1_1_x3 = str(float(item['Local Price']))
                    tbl_str_1_1_x4 = str(int(item['QTY']))
                    tbl_str_1_1_x5 = str(float(tbl_str_1_1_x3) * float(tbl_str_1_1_x4))

                    ttl_clr_prc_lst.append(float(tbl_str_1_1_x5))

                    row_cls_1_1[0].text = tbl_str_1_1_x0
                    row_cls_1_1[1].text = tbl_str_1_1_x1
                    row_cls_1_1[2].text = tbl_str_1_1_x2
                    row_cls_1_1[3].text = crc_fmt.format(float(tbl_str_1_1_x3))
                    row_cls_1_1[4].text = tbl_str_1_1_x4
                    row_cls_1_1[5].text = crc_fmt.format(float(tbl_str_1_1_x5))

                    tbl_1_par_1 = row_cls_1_1[3].paragraphs
                    tbl_1_par_2 = row_cls_1_1[4].paragraphs
                    tbl_1_par_3 = row_cls_1_1[5].paragraphs

                    for par in tbl_1_par_1: tbl_1_par_list.append(par)
                    for par in tbl_1_par_3: tbl_1_par_list.append(par)
                    for par in tbl_1_par_2: tbl_1_par_list_cnr.append(par)

                    item_index = item_index + 1

        row_cls_1_2 = doc_tbl_1.add_row().cells

        tbl_str_1_2_x2 = str(msg)
        tbl_str_1_2_x3 = float(adt_prc)

        ttl_clr_prc_lst.append(float(tbl_str_1_2_x3))

        row_cls_1_2[0].text = str(item_index)
        row_cls_1_2[1].text = 'srv'

        try:
            row_cls_1_2[2].text = '{msg} ({target})'.format(msg=tbl_str_1_2_x2,
                                                            target=u''.join(conditions['Work location']))
        except UnicodeDecodeError:
            row_cls_1_2[2].text = '{msg} ({target})'.format(msg=tbl_str_1_2_x2,
                                                            target=conditions['Work location'])
        except:
            row_cls_1_2[2].text = '{msg} ({target})'.format(msg=tbl_str_1_2_x2,
                                                            target='Work location')

        row_cls_1_2[3].text = crc_fmt.format(float(tbl_str_1_2_x3))
        row_cls_1_2[4].text = '1'
        row_cls_1_2[5].text = crc_fmt.format(float(tbl_str_1_2_x3))

        tbl_1_par_12 = row_cls_1_2[3].paragraphs
        tbl_1_par_22 = row_cls_1_2[4].paragraphs
        tbl_1_par_32 = row_cls_1_2[5].paragraphs

        for par in tbl_1_par_12: tbl_1_par_list.append(par)
        for par in tbl_1_par_32: tbl_1_par_list.append(par)
        for par in tbl_1_par_22: tbl_1_par_list_cnr.append(par)

        item_index = item_index + 1

        return item_index, ttl_clr_prc_lst

    # M A K E   D O C X   C O M M E R C I A L   O F F E R

    try:
        document = Document()
        crc_fmt = get_cur_tmp(conditions['Calculation currency'])

        # json_string = result

        pic_par_1 = document.add_paragraph()
        run_pic_1 = pic_par_1.add_run()

        # M A K E   T I T L E   P A G E

        ctr_num = u'''ХХХХХХХХ'''  # contract	- number
        ctr_dte = str(date.today())  # jobcalc - get_date_string()	# contract	- creation date

        cmr_dsc = u'''ООО "Company"'''  # customer	- company name
        cmr_nme = u'''Алексей Алексеевич'''  # customer	- contract person
        cmr_phn = u'''7-499-000-11-22'''  # customer	- contract person phone
        cmr_eml = u'''*****@*****.**'''  # customer	- contract person e-mail

        slr_pos = u'''Менеджер'''  # se seller	- position
        slr_nme = u'''Лапавекпне Н.'''  # seller	- name
        slr_phn = u'''7-495-777-99-90'''  # seller	- phone
        slr_eml = u'''*****@*****.**'''  # seller	- e-mail

        # C O N T R A C T   I N F O R M A T I O N
        ctr_num = '589659765'  # contract	- number
        ctr_dte = str(date.today())  # jobcalc - get_date_string()	# contract	- creation date
        ctr_mod = '488-2'  # contract	- qid modification ex: 488-2

        cmr_dsc = 'unassigned_customer_organisation'  # customer	- company name
        cmr_nme = 'unassigned_customer_name'  # customer	- contract person
        cmr_phn = 'unassigned_customer_phone'  # customer	- contract person phone
        cmr_eml = 'unassigned_customer_email'  # customer	- contract person e-mail

        cmr_del_adr = 'unassigned_customer_delivery_address'  # customer	- delivery address
        cmr_del_phn = 'unassigned_customer_delivery_phone'  # customer	- delivery phone
        cmr_del_eml = 'unassigned_customer_delivery_email'  # customer	- delivery email

        slr_pos = 'unassigned_seller_position'  # se seller	- position
        slr_nme = 'unassigned_seller_name'  # se seller	- name
        slr_phn = 'unassigned_seller_phone'  # se seller	- phone
        slr_eml = 'unassigned_seller_email'  # se seller	- e-mail

        ttl_str_0 = u''''''
        ttl_str_1 = u'''КП №{ctr_num}'''.format(ctr_num=ctr_num)
        ttl_str_2 = u''' '''
        ttl_str_3 = u'''Заказчик: {cmr_dsc}\rКонтактное лицо: {cmr_nme}\rТел.: {cmr_phn}\rE-mail: {cmr_eml}\rДата: {ctr_dte}'''.format(
            cmr_dsc=cmr_dsc, cmr_nme=cmr_nme, cmr_phn=cmr_phn, cmr_eml=cmr_eml, ctr_dte=ctr_dte)
        ttl_str_4 = u''''''
        ttl_str_5 = u'''С уважением,\r{slr_pos}'''.format(slr_pos=slr_pos)
        ttl_str_6 = u'''{slr_nme}\r{slr_phn}\r{slr_eml}'''.format(slr_nme=slr_nme, slr_phn=slr_phn, slr_eml=slr_eml,)
        ttl_str_7 = u'''Настоящее технико-коммерческое предложение (план) не может рассматриваться как оферта'''
        ttl_emp_0 = document.add_paragraph()  # Blank line
        ttl_emp_1 = document.add_paragraph()  # Blank line
        ttl_par_1 = document.add_paragraph()  # Commercial Offer ... #Number ...
        ttl_par_2 = document.add_paragraph()  # Blank line
        ttl_emp_2 = document.add_paragraph()  # Blank line
        ttl_emp_3 = document.add_paragraph()  # Blank line
        ttl_par_3 = document.add_paragraph()  # Customer ... Contact Person ... Contact Phone ... Contact e-mail ... Date ...
        ttl_emp_4 = document.add_paragraph()  # Blank line
        ttl_par_4 = document.add_paragraph()  # Company SE Offer to you ...
        ttl_emp_5 = document.add_paragraph()  # Blank line
        ttl_par_5 = document.add_paragraph()  # Kind regards ... Seller Position
        ttl_par_6 = document.add_paragraph()  # Seller Name ... Seller Phone ...
        ttl_emp_6 = document.add_paragraph()  # Blank line
        ttl_par_7 = document.add_paragraph()  # This technical commercial offer cant be ...

        run_ttl_1 = ttl_par_1.add_run(ttl_str_1)  # Service contract ...
        run_ttl_2 = ttl_par_2.add_run(ttl_str_2)  # Technical Commercial Offer ... #Opti ...
        run_ttl_3 = ttl_par_3.add_run(ttl_str_3)  # Customer ... Contact Person ... Contact Phone ... Contact e-mail ...
        run_ttl_4 = ttl_par_4.add_run(ttl_str_4)  # Company SE Offer to you ...
        run_ttl_5 = ttl_par_5.add_run(ttl_str_5)  # Kind regards ... Seller Position ...
        run_ttl_6 = ttl_par_6.add_run(ttl_str_6)  # Seller Name ... Seller Phone ...
        run_ttl_7 = ttl_par_7.add_run(ttl_str_7)  # This technical commercial offer cant be ...

        run_emp_0 = ttl_emp_0.add_run(ttl_str_0)
        run_emp_1 = ttl_emp_1.add_run(ttl_str_0)
        run_emp_2 = ttl_emp_2.add_run(ttl_str_0)
        run_emp_3 = ttl_emp_3.add_run(ttl_str_0)
        run_emp_4 = ttl_emp_4.add_run(ttl_str_0)
        run_emp_5 = ttl_emp_5.add_run(ttl_str_0)
        run_emp_6 = ttl_emp_6.add_run(ttl_str_0)

        document.add_page_break()

        hed_str_1 = u'''1. ОБЩИЕ ПОЛОЖЕНИЯ И СРОКИ ДЕЙСТВИЯ'''

        doc_hed_1 = document.add_heading('', 0)
        doc_par_10 = document.add_paragraph()
        doc_par_11 = document.add_paragraph()

        hed_str_2 = u'''2. ПОСТАВКА, ОСУЩЕСТВЛЯЕМАЯ ОAO "..."'''
        par_str_2 = u'''ОAO "..." предлагает в данном технико-коммерческом предложении следующие материалы:'''

        doc_hed_2 = document.add_heading('', 0)
        doc_par_2 = document.add_paragraph()

        tbl_str_1_00 = u'''№'''
        tbl_str_1_01 = u'''Артикул'''
        tbl_str_1_02 = u'''Описание'''
        tbl_str_1_03 = u'''Цена за ед.\nв руб.'''
        tbl_str_1_04 = u'''Кол-во'''
        tbl_str_1_05 = u'''Стоимость в руб.\nбез НДС'''

        doc_tbl_1 = document.add_table(rows=1, cols=6, style='Table Grid')

        doc_tbl_1.cell(0, 0).text = tbl_str_1_00
        doc_tbl_1.cell(0, 1).text = tbl_str_1_01
        doc_tbl_1.cell(0, 2).text = tbl_str_1_02
        doc_tbl_1.cell(0, 3).text = tbl_str_1_03
        doc_tbl_1.cell(0, 4).text = tbl_str_1_04
        doc_tbl_1.cell(0, 5).text = tbl_str_1_05

        item_index = 1

        if conditions['Request type'] == 'Services':

            #	CHECK SKU TYPES

            _abstract = 0
            _service = 0
            _device = 0
            _both = 0
            _contract = 0

            for subtotal in subtotals:
                for item in subtotal['items']:
                    if item['sku_type'] == 'abstract': _abstract = _abstract + 1
                    if item['sku_type'] == 'service': _service = _service + 1
                    if item['sku_type'] == 'device': _device = _device + 1
                    if item['sku_type'] == 'both': _both = _both + 1
                    if item['sku_type'] == 'contract': _contract = _contract + 1

            #	ONLY SERVICES
            if (_abstract == 0) and (_service != 0) and (_device == 0) and (_both == 0) and (_contract == 0):
                item_index, ttl_clr_prc_lst = add_tbl_line_srvs(u'Региональная надбавка', 'travel')
            #	ONLY BOTH
            elif (_abstract == 0) and (_service == 0) and (_device == 0) and (_both != 0) and (_contract == 0):
                item_index, ttl_clr_prc_lst = add_tbl_line_srvs(u'Услуги по установке/замене комплектующих', 'total')
            #	MIX - SERVICES & BOTH
            elif (_abstract == 0) and (_service != 0) and (_device == 0) and (_both != 0) and (_contract == 0):
                item_index, ttl_clr_prc_lst = add_tbl_line_srvs(u'Региональная надбавка', 'travel')
            #	OTHER CASES
            else:
                item_index, ttl_clr_prc_lst = add_tbl_line_srvs(u'Услуги по установке/замене комплектующих', 'total')

		if conditions['Request type'] == 'Diagnostics':
			for subtotal in subtotals:
				for item in subtotal['items']:

					row_cls_1_1 = doc_tbl_1.add_row().cells

					tbl_str_1_1_x0 = str(item_index)
					tbl_str_1_1_x1 	= str(item['partnumber'])
					tbl_str_1_1_x2 	= u'Диагностика оборудования ({en_descr})'.format(en_descr = item['Description'])
					tbl_str_1_1_x3 	= str(total['work Price'])
					tbl_str_1_1_x4 	= str(int(item['QTY']))
					tbl_str_1_1_x5 	= str(float(tbl_str_1_1_x3) * float(tbl_str_1_1_x4))

					ttl_clr_prc_lst.append(float(tbl_str_1_1_x5))  # price list for final price

					row_cls_1_1[0].text = tbl_str_1_1_x0
					row_cls_1_1[1].text = tbl_str_1_1_x1
					row_cls_1_1[2].text = tbl_str_1_1_x2
					row_cls_1_1[3].text = crc_fmt.format(float(tbl_str_1_1_x3))
					row_cls_1_1[4].text = tbl_str_1_1_x4
					row_cls_1_1[5].text = crc_fmt.format(float(tbl_str_1_1_x5))

					tbl_1_par_1 = row_cls_1_1[3].paragraphs
					tbl_1_par_2 = row_cls_1_1[4].paragraphs
					tbl_1_par_3 = row_cls_1_1[5].paragraphs

					for par in tbl_1_par_1: 	tbl_1_par_list.append(par)
					for par in tbl_1_par_3: 	tbl_1_par_list.append(par)
					for par in tbl_1_par_2: 	tbl_1_par_list_cnr.append(par)

					item_index = item_index + 1

			row_cls_1_2 	= doc_tbl_1.add_row().cells

			tbl_str_1_2_x2 	= u'Региональная надбавка'
			tbl_str_1_2_x3 	= float(total['Travel Price'])

			ttl_clr_prc_lst.append(float(tbl_str_1_2_x3))

			row_cls_1_2[0].text = str(item_index)
			row_cls_1_2[1].text = 'srv'

            try:
                row_cls_1_2[2].text = '{msg} ({target})'.format(msg = tbl_str_1_2_x2, target = u''.join(conditions['Work location'] ))
            except UnicodeDecodeError:
                row_cls_1_2[2].text = '{msg} ({target})'.format(msg = tbl_str_1_2_x2, target = conditions['Work location'])
            except:
                row_cls_1_2[2].text = '{msg} ({target})'.format(msg = tbl_str_1_2_x2, target = 'Work location')

            row_cls_1_2[3].text = crc_fmt.format(float(tbl_str_1_2_x3))
            row_cls_1_2[4].text = '1'
			row_cls_1_2[5].text = crc_fmt.format(float(tbl_str_1_2_x3))

			tbl_1_par_12 = row_cls_1_2[3].paragraphs
			tbl_1_par_22 = row_cls_1_2[4].paragraphs
			tbl_1_par_32 = row_cls_1_2[5].paragraphs

			for par in tbl_1_par_12: tbl_1_par_list.append(par)
			for par in tbl_1_par_32: tbl_1_par_list.append(par)
            for par in tbl_1_par_22: tbl_1_par_list_cnr.append(par)

        if ((conditions['Request type'] == 'Simple') or (conditions['Request type'] == 'Solutions') or
                (conditions['Request type'] == 'Batteries')):
            if str(subtotals[0]['Equipment Family']) != 'srv':
                for subtotal in subtotals:
                    for item in subtotal['items']:

                        row_cls_1_1 = doc_tbl_1.add_row().cells

                        tbl_str_1_1_x0 = str(item_index)
                        tbl_str_1_1_x1 = str(item['partnumber'])
                        tbl_str_1_1_x2 = u'{ru_descr} ({en_descr})'.format(ru_descr=item['Local Name'],
                                                                           en_descr=item['Description'])
                        tbl_str_1_1_x3 = str(item['Local Price'])
                        tbl_str_1_1_x4 = str(int(item['QTY']))
                        tbl_str_1_1_x5 = str(float(tbl_str_1_1_x3) * float(tbl_str_1_1_x4))

                        ttl_clr_prc_lst.append(float(tbl_str_1_1_x5))

                        row_cls_1_1[0].text = tbl_str_1_1_x0
                        row_cls_1_1[1].text = tbl_str_1_1_x1
                        row_cls_1_1[2].text = tbl_str_1_1_x2
                        row_cls_1_1[3].text = crc_fmt.format(float(tbl_str_1_1_x3))
                        row_cls_1_1[4].text = tbl_str_1_1_x4
                        row_cls_1_1[5].text = crc_fmt.format(float(tbl_str_1_1_x5))

                        tbl_1_par_1 = row_cls_1_1[3].paragraphs
                        tbl_1_par_2 = row_cls_1_1[4].paragraphs
                        tbl_1_par_3 = row_cls_1_1[5].paragraphs

                        for par in tbl_1_par_1: tbl_1_par_list.append(par)
                        for par in tbl_1_par_3: tbl_1_par_list.append(par)
                        for par in tbl_1_par_2: tbl_1_par_list_cnr.append(par)

                        item_index = item_index + 1

            row_cls_1_2 = doc_tbl_1.add_row().cells

            tbl_str_1_2_x2 = u'Услуги по установке/замене комплектующих'
            tbl_str_1_2_x3 = float(total['Total Price'])

            ttl_clr_prc_lst.append(float(tbl_str_1_2_x3))

            row_cls_1_2[0].text = str(item_index)
            row_cls_1_2[1].text = 'srv'

            try:
                row_cls_1_2[2].text = '{msg} ({target})'.format(msg=tbl_str_1_2_x2,
                                                                target=u''.join(conditions['Work location']))
            except UnicodeDecodeError:
                row_cls_1_2[2].text = '{msg} ({target})'.format(msg=tbl_str_1_2_x2, target=conditions['Work location'])
            except:
                row_cls_1_2[2].text = '{msg} ({target})'.format(msg=tbl_str_1_2_x2, target='Work location')

            row_cls_1_2[3].text = crc_fmt.format(float(tbl_str_1_2_x3))
            row_cls_1_2[4].text = '1'
            row_cls_1_2[5].text = crc_fmt.format(float(tbl_str_1_2_x3))

            tbl_1_par_12 = row_cls_1_2[3].paragraphs
            tbl_1_par_22 = row_cls_1_2[4].paragraphs
            tbl_1_par_32 = row_cls_1_2[5].paragraphs

            for par in tbl_1_par_12: tbl_1_par_list.append(par)
            for par in tbl_1_par_32: tbl_1_par_list.append(par)
            for par in tbl_1_par_22: tbl_1_par_list_cnr.append(par)

        # P A R T   3

        hed_str_4 = u'''Примечания'''
        # M A K E  T A B L E   2

        tbl_str_2_00 = u'''Итого, руб без НДС'''
        tbl_str_2_10 = u'''НДС (18%)'''
        tbl_str_2_20 = u'''Итого, руб с НДС (18%)'''

        ttl_clr_prc = 0
        ttl_vat_prc = 0

        for clr_prc in ttl_clr_prc_lst:
            ttl_clr_prc = clr_prc + ttl_clr_prc

        ttl_vat_prc = ttl_clr_prc * 1.18

        tbl_str_2_01 = str(ttl_clr_prc)
        tbl_str_2_11 = str(float(ttl_vat_prc) - float(ttl_clr_prc))
        tbl_str_2_21 = str(float(ttl_vat_prc))

        tbl_str_2_01 = crc_fmt.format(float(tbl_str_2_01))
        tbl_str_2_11 = crc_fmt.format(float(tbl_str_2_11))
        tbl_str_2_21 = crc_fmt.format(float(tbl_str_2_21))

        doc_tbl_2 = document.add_table(rows=3, cols=2, style='Table Grid')

        doc_tbl_2.cell(0, 0).text = tbl_str_2_00

        doc_tbl_2.cell(1, 0).text = tbl_str_2_10
        doc_tbl_2.cell(2, 0).text = tbl_str_2_20

        doc_tbl_2.cell(0, 1).text = tbl_str_2_01
        doc_tbl_2.cell(1, 1).text = tbl_str_2_11
        doc_tbl_2.cell(2, 1).text = tbl_str_2_21

        tbl_2_par_list = []

        for row in range(0, 3):
            tbl_2_par = doc_tbl_2.cell(row, 1).paragraphs

            for par in tbl_2_par:
                tbl_2_par_list.append(par)

        doc_hed_4 = document.add_heading('', 1)
        doc_par_41 = document.add_paragraph()
        doc_par_42 = document.add_paragraph()
        doc_par_43 = document.add_paragraph()
        doc_par_44 = document.add_paragraph()
        doc_par_45 = document.add_paragraph()

        run_hed_4 = doc_hed_4.add_run(hed_str_4)
        run_par_41 = doc_par_41.add_run(par_str_41)
        run_par_42 = doc_par_42.add_run(par_str_42)
        run_par_43 = doc_par_43.add_run(par_str_43)
        run_par_44 = doc_par_44.add_run(par_str_44)
        run_par_45 = doc_par_45.add_run(par_str_45)

        document.add_page_break()

        # A N N E X   1

        anx1_hed_0 = document.add_heading('', 0)
        anx1_par_0 = document.add_paragraph()
        anx1_par_00 = document.add_paragraph()
        anx1_par_01 = document.add_paragraph()
        anx1_par_02 = document.add_paragraph()
        anx1_par_03 = document.add_paragraph()
        anx1_par_04 = document.add_paragraph()
        anx1_hed_1 = document.add_heading('', 1)
        anx1_par_11 = document.add_paragraph()
        anx1_par_12 = document.add_paragraph()
        anx1_hed_2 = document.add_heading('', 1)
        anx1_par_20 = document.add_paragraph()
        anx1_par_21 = document.add_paragraph()
        anx1_par_22 = document.add_paragraph()
        anx1_par_23 = document.add_paragraph()
        anx1_par_24 = document.add_paragraph()
        anx1_par_25 = document.add_paragraph()
        anx1_par_26 = document.add_paragraph()
        anx1_par_27 = document.add_paragraph()
        anx1_par_28 = document.add_paragraph()
        anx1_par_29 = document.add_paragraph()
        anx1_hed_3 = document.add_heading('', 1)
        anx1_par_30 = document.add_paragraph()
        anx1_par_31 = document.add_paragraph()
        anx1_par_32 = document.add_paragraph()
        anx1_par_33 = document.add_paragraph()
        anx1_hed_4 = document.add_heading('', 1)
        anx1_par_41 = document.add_paragraph()
        anx1_par_42 = document.add_paragraph()
        anx1_par_43 = document.add_paragraph()
        anx1_hed_5 = document.add_heading('', 1)
        anx1_par_51 = document.add_paragraph()
        anx1_par_52 = document.add_paragraph()
        anx1_par_53 = document.add_paragraph()
        anx1_hed_6 = document.add_heading('', 1)
        anx1_par_61 = document.add_paragraph()
        anx1_par_62 = document.add_paragraph()
        anx1_par_63 = document.add_paragraph()
        anx1_par_64 = document.add_paragraph()
        anx1_par_65 = document.add_paragraph()
        anx1_hed_7 = document.add_heading('', 1)
        anx1_par_71 = document.add_paragraph()
        anx1_par_72 = document.add_paragraph()
        anx1_par_73 = document.add_paragraph()
        anx1_hed_8 = document.add_heading('', 1)
        anx1_par_81 = document.add_paragraph()
        anx1_par_82 = document.add_paragraph()

        anx1_run_hed_0 = anx1_hed_0.add_run(anx1_hed_str_0)
        anx1_run_hed_1 = anx1_hed_1.add_run(anx1_hed_str_1)
        anx1_run_hed_2 = anx1_hed_2.add_run(anx1_hed_str_2)
        anx1_run_hed_3 = anx1_hed_3.add_run(anx1_hed_str_3)
        anx1_run_hed_4 = anx1_hed_4.add_run(anx1_hed_str_4)
        anx1_run_hed_5 = anx1_hed_5.add_run(anx1_hed_str_5)
        anx1_run_hed_6 = anx1_hed_6.add_run(anx1_hed_str_6)
        anx1_run_hed_7 = anx1_hed_7.add_run(anx1_hed_str_7)
        anx1_run_hed_8 = anx1_hed_8.add_run(anx1_hed_str_8)

        anx1_run_nme_1 = anx1_par_01.add_run(anx1_run_nme_1)
        anx1_run_nme_2 = anx1_par_02.add_run(anx1_run_nme_2)
        anx1_run_nme_3 = anx1_par_03.add_run(anx1_run_nme_3)
        anx1_run_nme_4 = anx1_par_04.add_run(anx1_run_nme_4)

        anx1_run_par_00 = anx1_par_00.add_run(anx1_par_str_00)
        anx1_run_par_01 = anx1_par_01.add_run(anx1_par_str_01)
        anx1_run_par_02 = anx1_par_02.add_run(anx1_par_str_02)
        anx1_run_par_03 = anx1_par_03.add_run(anx1_par_str_03)
        anx1_run_par_04 = anx1_par_04.add_run(anx1_par_str_04)

        anx1_run_par_11 = anx1_par_11.add_run(anx1_par_str_11)
        anx1_run_par_12 = anx1_par_12.add_run(anx1_par_str_12)
        anx1_run_par_20 = anx1_par_20.add_run(anx1_par_str_20)
        anx1_run_par_21 = anx1_par_21.add_run(anx1_par_str_21)
        anx1_run_par_22 = anx1_par_22.add_run(anx1_par_str_22)
        anx1_run_par_23 = anx1_par_23.add_run(anx1_par_str_23)
        anx1_run_par_24 = anx1_par_24.add_run(anx1_par_str_24)
        anx1_run_par_25 = anx1_par_25.add_run(anx1_par_str_25)
        anx1_run_par_26 = anx1_par_26.add_run(anx1_par_str_26)
        anx1_run_par_27 = anx1_par_27.add_run(anx1_par_str_27)
        anx1_run_par_28 = anx1_par_28.add_run(anx1_par_str_28)
        anx1_run_par_29 = anx1_par_29.add_run(anx1_par_str_29)
        anx1_run_par_30 = anx1_par_30.add_run(anx1_par_str_30)
        anx1_run_par_31 = anx1_par_31.add_run(anx1_par_str_31)
        anx1_run_par_32 = anx1_par_32.add_run(anx1_par_str_32)
        anx1_run_par_33 = anx1_par_33.add_run(anx1_par_str_33)
        anx1_run_par_41 = anx1_par_41.add_run(anx1_par_str_41)
        anx1_run_par_42 = anx1_par_42.add_run(anx1_par_str_42)
        anx1_run_par_43 = anx1_par_43.add_run(anx1_par_str_43)
        anx1_run_par_51 = anx1_par_51.add_run(anx1_par_str_51)
        anx1_run_par_52 = anx1_par_52.add_run(anx1_par_str_52)
        anx1_run_par_53 = anx1_par_53.add_run(anx1_par_str_53)
        anx1_run_par_61 = anx1_par_61.add_run(anx1_par_str_61)
        anx1_run_par_62 = anx1_par_62.add_run(anx1_par_str_62)
        anx1_run_par_63 = anx1_par_63.add_run(anx1_par_str_63)
        anx1_run_par_64 = anx1_par_64.add_run(anx1_par_str_64)
        anx1_run_par_65 = anx1_par_65.add_run(anx1_par_str_65)
        anx1_run_par_71 = anx1_par_71.add_run(anx1_par_str_71)
        anx1_run_par_72 = anx1_par_72.add_run(anx1_par_str_72)
        anx1_run_par_73 = anx1_par_73.add_run(anx1_par_str_73)
        anx1_run_par_81 = anx1_par_81.add_run(anx1_par_str_81)
        anx1_run_par_82 = anx1_par_82.add_run(anx1_par_str_82)

        document.add_page_break()

        # A N N E X   2

        anx2_str_0 = u''''''
        anx2_hed_str_0 = u'''10'''
        anx2_hed_str_1 = u'''1'''
        anx2_hed_str_2 = u'''2'''
        anx2_hed_str_3 = u'''3'''
        anx2_hed_str_4 = u'''4'''
        anx2_hed_str_5 = u'''5'''
        anx2_hed_str_6 = u'''6'''
        anx2_hed_str_7 = u'''7'''

        anx2_par_str_00 = u'''Следующие термины имеют в данном документе следующее значение:'''
        anx2_run_nme_1 = u''''''
        anx2_run_nme_2 = u'''Товар'''
        anx2_run_nme_3 = u'''Клиент'''
        anx2_run_nme_4 = u'''Заказ'''

        anx2_par_str_01 = ''
        anx2_par_str_02 = ''
        anx2_par_str_03 = ''

        anx2_hed_0 = document.add_heading('', 0)
        anx2_par_0 = document.add_paragraph()
        anx2_par_00 = document.add_paragraph()
        anx2_par_01 = document.add_paragraph()
        anx2_par_02 = document.add_paragraph()
        anx2_par_03 = document.add_paragraph()
        anx2_par_04 = document.add_paragraph()
        anx2_hed_1 = document.add_heading('', 1)
        anx2_par_11 = document.add_paragraph('')
        anx2_par_12 = document.add_paragraph()
        anx2_hed_2 = document.add_heading('', 1)
        anx2_par_21 = document.add_paragraph()
        anx2_par_22 = document.add_paragraph()
        anx2_par_23 = document.add_paragraph()
        anx2_par_24 = document.add_paragraph()
        anx2_par_25 = document.add_paragraph()
        anx2_par_26 = document.add_paragraph()
        anx2_hed_3 = document.add_heading('', 1)
        anx2_par_31 = document.add_paragraph()
        anx2_par_32 = document.add_paragraph()
        anx2_par_33 = document.add_paragraph()
        anx2_par_34 = document.add_paragraph()
        anx2_par_35 = document.add_paragraph()
        anx2_hed_4 = document.add_heading('', 1)
        anx2_par_41 = document.add_paragraph()
        anx2_par_42 = document.add_paragraph()
        anx2_par_43 = document.add_paragraph()
        anx2_par_44 = document.add_paragraph()
        anx2_hed_5 = document.add_heading('', 1)
        anx2_par_51 = document.add_paragraph()
        anx2_par_52 = document.add_paragraph()
        anx2_par_53 = document.add_paragraph()
        anx2_par_54 = document.add_paragraph()
        anx2_par_55 = document.add_paragraph()
        anx2_par_56 = document.add_paragraph()
        anx2_hed_6 = document.add_heading('', 1)
        anx2_par_61 = document.add_paragraph()
        anx2_par_62 = document.add_paragraph()
        anx2_par_63 = document.add_paragraph()
        anx2_par_64 = document.add_paragraph()
        anx2_hed_7 = document.add_heading('', 1)
        anx2_par_71 = document.add_paragraph()
        anx2_par_72 = document.add_paragraph()

        anx2_run_hed_0 = anx2_hed_0.add_run(anx2_hed_str_0)
        anx2_run_hed_1 = anx2_hed_1.add_run(anx2_hed_str_1)
        anx2_run_hed_2 = anx2_hed_2.add_run(anx2_hed_str_2)
        anx2_run_hed_3 = anx2_hed_3.add_run(anx2_hed_str_3)
        anx2_run_hed_4 = anx2_hed_4.add_run(anx2_hed_str_4)
        anx2_run_hed_5 = anx2_hed_5.add_run(anx2_hed_str_5)
        anx2_run_hed_6 = anx2_hed_6.add_run(anx2_hed_str_6)
        anx2_run_hed_7 = anx2_hed_7.add_run(anx2_hed_str_7)

        anx2_run_nme_1 = anx2_par_01.add_run(anx2_run_nme_1)
        anx2_run_nme_2 = anx2_par_02.add_run(anx2_run_nme_2)
        anx2_run_nme_3 = anx2_par_03.add_run(anx2_run_nme_3)
        anx2_run_nme_4 = anx2_par_04.add_run(anx2_run_nme_4)

        anx2_run_par_00 = anx2_par_00.add_run(anx2_str_0)
        anx2_run_par_00 = anx2_par_00.add_run(anx2_par_str_00)
        anx2_run_par_01 = anx2_par_01.add_run(anx2_par_str_01)
        anx2_run_par_02 = anx2_par_02.add_run(anx2_par_str_02)
        anx2_run_par_03 = anx2_par_03.add_run(anx2_par_str_03)
        anx2_run_par_04 = anx2_par_04.add_run(anx2_par_str_04)

        anx2_run_par_11 = anx2_par_11.add_run(anx2_par_str_11)
        anx2_run_par_12 = anx2_par_12.add_run(anx2_par_str_12)
        anx2_run_par_21 = anx2_par_21.add_run(anx2_par_str_21)
        anx2_run_par_22 = anx2_par_22.add_run(anx2_par_str_22)
        anx2_run_par_23 = anx2_par_23.add_run(anx2_par_str_23)
        anx2_run_par_24 = anx2_par_24.add_run(anx2_par_str_24)
        anx2_run_par_25 = anx2_par_25.add_run(anx2_par_str_25)
        anx2_run_par_26 = anx2_par_26.add_run(anx2_par_str_26)
        anx2_run_par_31 = anx2_par_31.add_run(anx2_par_str_31)
        anx2_run_par_32 = anx2_par_32.add_run(anx2_par_str_32)
        anx2_run_par_33 = anx2_par_33.add_run(anx2_par_str_33)
        anx2_run_par_34 = anx2_par_34.add_run(anx2_par_str_34)
        anx2_run_par_35 = anx2_par_35.add_run(anx2_par_str_35)
        anx2_run_par_41 = anx2_par_41.add_run(anx2_par_str_41)
        anx2_run_par_42 = anx2_par_42.add_run(anx2_par_str_42)
        anx2_run_par_43 = anx2_par_43.add_run(anx2_par_str_43)
        anx2_run_par_44 = anx2_par_44.add_run(anx2_par_str_44)
        anx2_run_par_51 = anx2_par_51.add_run(anx2_par_str_51)
        anx2_run_par_52 = anx2_par_52.add_run(anx2_par_str_52)
        anx2_run_par_53 = anx2_par_53.add_run(anx2_par_str_53)
        anx2_run_par_54 = anx2_par_54.add_run(anx2_par_str_54)
        anx2_run_par_55 = anx2_par_55.add_run(anx2_par_str_55)
        anx2_run_par_56 = anx2_par_56.add_run(anx2_par_str_56)
        anx2_run_par_61 = anx2_par_61.add_run(anx2_par_str_61)
        anx2_run_par_62 = anx2_par_62.add_run(anx2_par_str_62)
        anx2_run_par_63 = anx2_par_63.add_run(anx2_par_str_63)
        anx2_run_par_64 = anx2_par_64.add_run(anx2_par_str_64)
        anx2_run_par_71 = anx2_par_71.add_run(anx2_par_str_71)
        anx2_run_par_72 = anx2_par_72.add_run(anx2_par_str_72)

        # M A K E   D O C U M E N T   F O R M A T T I N G

        run_ttl_1.bold = False
        run_ttl_2.bold = False
        run_ttl_3.bold = True
        run_ttl_4.bold = False
        run_ttl_5.bold = False
        run_ttl_6.bold = True
        run_ttl_7.bold = False

        run_hed_4.bold = False
        anx1_run_hed_0.bold = False
        anx1_run_hed_1.bold = False
        anx1_run_hed_2.bold = False
        anx1_run_hed_3.bold = False
        anx1_run_hed_4.bold = False
        anx1_run_hed_5.bold = False
        anx1_run_hed_6.bold = False
        anx1_run_hed_7.bold = False
        anx1_run_hed_8.bold = False

        anx2_run_hed_0.bold = False
        anx2_run_hed_1.bold = False
        anx2_run_hed_2.bold = False
        anx2_run_hed_3.bold = False
        anx2_run_hed_4.bold = False
        anx2_run_hed_5.bold = False
        anx2_run_hed_6.bold = False
        anx2_run_hed_7.bold = False

        anx1_run_nme_1.underline = True
        anx1_run_nme_2.underline = True
        anx1_run_nme_3.underline = True
        anx1_run_nme_4.underline = True
        anx2_run_nme_1.underline = True
        anx2_run_nme_2.underline = True
        anx2_run_nme_3.underline = True
        anx2_run_nme_4.underline = True

        ttl_emp_fnt_0 = run_emp_0.font
        ttl_emp_fnt_1 = run_emp_1.font
        ttl_emp_fnt_2 = run_emp_2.font
        ttl_emp_fnt_3 = run_emp_3.font
        ttl_emp_fnt_4 = run_emp_4.font
        ttl_emp_fnt_5 = run_emp_5.font
        ttl_emp_fnt_6 = run_emp_6.font

        ttl_par_fnt_1 = run_ttl_1.font
        ttl_par_fnt_2 = run_ttl_2.font
        ttl_par_fnt_3 = run_ttl_3.font
        ttl_par_fnt_4 = run_ttl_4.font
        ttl_par_fnt_5 = run_ttl_5.font
        ttl_par_fnt_6 = run_ttl_6.font
        ttl_par_fnt_7 = run_ttl_7.font

        doc_hed_fnt_1 = run_hed_1.font
        doc_hed_fnt_2 = run_hed_2.font
        doc_hed_fnt_4 = run_hed_4.font

        doc_par_fnt_10 = run_par_10.font
        doc_par_fnt_11 = run_par_11.font
        doc_par_fnt_2 = run_par_2.font
        doc_par_fnt_41 = run_par_41.font
        doc_par_fnt_42 = run_par_42.font
        doc_par_fnt_43 = run_par_43.font
        doc_par_fnt_44 = run_par_44.font
        doc_par_fnt_45 = run_par_45.font

        anx1_hed_fnt_0 = anx1_run_hed_0.font
        anx1_hed_fnt_1 = anx1_run_hed_1.font
        anx1_hed_fnt_2 = anx1_run_hed_2.font
        anx1_hed_fnt_3 = anx1_run_hed_3.font
        anx1_hed_fnt_4 = anx1_run_hed_4.font
        anx1_hed_fnt_5 = anx1_run_hed_5.font
        anx1_hed_fnt_6 = anx1_run_hed_6.font
        anx1_hed_fnt_7 = anx1_run_hed_7.font
        anx1_hed_fnt_8 = anx1_run_hed_8.font

        anx1_par_fnt_00 = anx1_run_par_00.font
        anx1_par_fnt_01 = anx1_run_par_01.font
        anx1_par_fnt_02 = anx1_run_par_02.font
        anx1_par_fnt_03 = anx1_run_par_03.font
        anx1_par_fnt_04 = anx1_run_par_04.font
        anx1_nme_fnt_01 = anx1_run_nme_1.font
        anx1_nme_fnt_02 = anx1_run_nme_2.font
        anx1_nme_fnt_03 = anx1_run_nme_3.font
        anx1_nme_fnt_04 = anx1_run_nme_4.font
        anx1_par_fnt_11 = anx1_run_par_11.font
        anx1_par_fnt_12 = anx1_run_par_12.font
        anx1_par_fnt_20 = anx1_run_par_20.font
        anx1_par_fnt_21 = anx1_run_par_21.font
        anx1_par_fnt_22 = anx1_run_par_22.font
        anx1_par_fnt_23 = anx1_run_par_23.font
        anx1_par_fnt_24 = anx1_run_par_24.font
        anx1_par_fnt_25 = anx1_run_par_25.font
        anx1_par_fnt_26 = anx1_run_par_26.font
        anx1_par_fnt_27 = anx1_run_par_27.font
        anx1_par_fnt_28 = anx1_run_par_28.font
        anx1_par_fnt_29 = anx1_run_par_29.font
        anx1_par_fnt_30 = anx1_run_par_30.font
        anx1_par_fnt_31 = anx1_run_par_31.font
        anx1_par_fnt_32 = anx1_run_par_32.font
        anx1_par_fnt_33 = anx1_run_par_33.font
        anx1_par_fnt_41 = anx1_run_par_41.font
        anx1_par_fnt_42 = anx1_run_par_42.font
        anx1_par_fnt_43 = anx1_run_par_43.font
        anx1_par_fnt_51 = anx1_run_par_51.font
        anx1_par_fnt_52 = anx1_run_par_52.font
        anx1_par_fnt_53 = anx1_run_par_53.font
        anx1_par_fnt_61 = anx1_run_par_61.font
        anx1_par_fnt_62 = anx1_run_par_62.font
        anx1_par_fnt_63 = anx1_run_par_63.font
        anx1_par_fnt_64 = anx1_run_par_64.font
        anx1_par_fnt_65 = anx1_run_par_65.font
        anx1_par_fnt_71 = anx1_run_par_71.font
        anx1_par_fnt_72 = anx1_run_par_72.font
        anx1_par_fnt_73 = anx1_run_par_73.font
        anx1_par_fnt_81 = anx1_run_par_81.font
        anx1_par_fnt_82 = anx1_run_par_82.font

        anx2_hed_fnt_0 = anx2_run_hed_0.font
        anx2_hed_fnt_1 = anx2_run_hed_1.font
        anx2_hed_fnt_2 = anx2_run_hed_2.font
        anx2_hed_fnt_3 = anx2_run_hed_3.font
        anx2_hed_fnt_4 = anx2_run_hed_4.font
        anx2_hed_fnt_5 = anx2_run_hed_5.font
        anx2_hed_fnt_6 = anx2_run_hed_6.font
        anx2_hed_fnt_7 = anx2_run_hed_7.font

        anx2_par_fnt_00 = anx2_run_par_00.font
        anx2_par_fnt_01 = anx2_run_par_01.font
        anx2_par_fnt_02 = anx2_run_par_02.font
        anx2_par_fnt_03 = anx2_run_par_03.font
        anx2_par_fnt_04 = anx2_run_par_04.font
        anx2_nme_fnt_01 = anx2_run_nme_1.font
        anx2_nme_fnt_02 = anx2_run_nme_2.font
        anx2_nme_fnt_03 = anx2_run_nme_3.font
        anx2_nme_fnt_04 = anx2_run_nme_4.font
        anx2_par_fnt_11 = anx2_run_par_11.font
        anx2_par_fnt_12 = anx2_run_par_12.font
        anx2_par_fnt_21 = anx2_run_par_21.font
        anx2_par_fnt_22 = anx2_run_par_22.font
        anx2_par_fnt_23 = anx2_run_par_23.font
        anx2_par_fnt_24 = anx2_run_par_24.font
        anx2_par_fnt_25 = anx2_run_par_25.font
        anx2_par_fnt_26 = anx2_run_par_26.font
        anx2_par_fnt_31 = anx2_run_par_31.font
        anx2_par_fnt_32 = anx2_run_par_32.font
        anx2_par_fnt_33 = anx2_run_par_33.font
        anx2_par_fnt_34 = anx2_run_par_34.font
        anx2_par_fnt_35 = anx2_run_par_35.font
        anx2_par_fnt_41 = anx2_run_par_41.font
        anx2_par_fnt_42 = anx2_run_par_42.font
        anx2_par_fnt_43 = anx2_run_par_43.font
        anx2_par_fnt_44 = anx2_run_par_44.font
        anx2_par_fnt_51 = anx2_run_par_51.font
        anx2_par_fnt_52 = anx2_run_par_52.font
        anx2_par_fnt_53 = anx2_run_par_53.font
        anx2_par_fnt_54 = anx2_run_par_54.font
        anx2_par_fnt_55 = anx2_run_par_55.font
        anx2_par_fnt_56 = anx2_run_par_56.font
        anx2_par_fnt_61 = anx2_run_par_61.font
        anx2_par_fnt_62 = anx2_run_par_62.font
        anx2_par_fnt_63 = anx2_run_par_63.font
        anx2_par_fnt_64 = anx2_run_par_64.font
        anx2_par_fnt_71 = anx2_run_par_71.font
        anx2_par_fnt_72 = anx2_run_par_72.font

        ttl_emp_s = [ttl_emp_0, ttl_emp_1, ttl_emp_2, ttl_emp_3, ttl_emp_4, ttl_emp_5, ttl_emp_6, ]
        doc_hed_s = [doc_hed_1, doc_hed_2, doc_hed_4, ]
        anx1_hed_s = [anx1_hed_0, anx1_hed_1, anx1_hed_2, anx1_hed_3, anx1_hed_4, anx1_hed_5, anx1_hed_6, anx1_hed_7,
                      anx1_hed_8, ]
        anx2_hed_s = [anx2_hed_0, anx2_hed_1, anx2_hed_2, anx2_hed_3, anx2_hed_4, anx2_hed_5, anx2_hed_6, anx2_hed_7, ]
        ttl_par_s = [ttl_par_1, ttl_par_1, ttl_par_3, ttl_par_4, ttl_par_5, ttl_par_6, ttl_par_7, ]
        doc_par_s = [doc_par_10, doc_par_11, doc_par_2, doc_par_41, doc_par_42, doc_par_43, doc_par_44, doc_par_45, ]
        anx1_par_s = [anx1_par_00, anx1_par_01, anx1_par_02, anx1_par_03, anx1_par_04, anx1_par_11, anx1_par_12,
                      anx1_par_20, anx1_par_21, anx1_par_22, anx1_par_23,
                      anx1_par_24, anx1_par_25, anx1_par_26, anx1_par_27, anx1_par_28, anx1_par_29, anx1_par_30,
                      anx1_par_31, anx1_par_32, anx1_par_33, anx1_par_41,
                      anx1_par_42, anx1_par_43, anx1_par_51, anx1_par_52, anx1_par_53, anx1_par_61, anx1_par_62,
                      anx1_par_63, anx1_par_64, anx1_par_65, anx1_par_71, anx1_par_72,
                      anx1_par_73, anx1_par_81, anx1_par_82, anx1_par_0	]
		anx2_par_s 			= [ anx2_par_00, anx2_par_01, anx2_par_02, anx2_par_03, anx2_par_04,
                      anx2_par_11, anx2_par_12, anx2_par_21, anx2_par_22, anx2_par_23, anx2_par_24,
									  anx2_par_25, anx2_par_26, anx2_par_31, anx2_par_32, anx2_par_33,
                      anx2_par_34, anx2_par_35, anx2_par_41, anx2_par_42, anx2_par_43, anx2_par_44,
									  anx2_par_51, anx2_par_52, anx2_par_53, anx2_par_54, anx2_par_55,
                      anx2_par_56, anx2_par_61, anx2_par_62, anx2_par_63, anx2_par_64, anx2_par_71,
									  anx2_par_72, anx2_par_0																																]

		ttl_emp_fnt_s		= [ ttl_emp_fnt_0, ttl_emp_fnt_1, ttl_emp_fnt_2, ttl_emp_fnt_3, ttl_emp_fnt_4 ]
		doc_hed_fnt_s		= [ doc_hed_fnt_1, doc_hed_fnt_2, doc_hed_fnt_4, ]
		anx1_hed_fnt_s		= [ anx1_hed_fnt_0, anx1_hed_fnt_1, anx1_hed_fnt_2, anx1_hed_fnt_3,
                                  anx1_hed_fnt_4, anx1_hed_fnt_5,	anx1_hed_fnt_6]
		anx2_hed_fnt_s		= [ anx2_hed_fnt_0, anx2_hed_fnt_1, anx2_hed_fnt_2, anx2_hed_fnt_3, anx2_hed_fnt_4,
                                  anx2_hed_fnt_5, anx2_hed_fnt_7]

		for cell in doc_tbl_1.columns[0].cells : cell.width = Cm(0.8)
		for cell in doc_tbl_1.colums[1].cells : cell.width = Cm(3.0)
		for cell in doc_tbl_1.coluns[2].cells : cell.width = Cm(6.4)
		for cell in doc_tbl_1.columns[3].cells : cell.width = Cm(2.7)
		for cell in doc_tbl_1.columns[4].cells : cell.width = Cm(1.1)
		for cell in doc_tbl_1.columns[5].cells : cell.width = Cm(3.2)

		for cell in doc_tbl_2.columns[0].cells : cell.width = Cm(10.2)
		for cell in doc_tbl_2.columns[1].cells : cell.width = Cm(7.0)

		for section in document.sections:
			section.top_margin	= Cm(2.0)
			section.bottom_margin= Cm(2.0)
			section.left_margin	= Cm(3.0)
			section.righargin= Cm(1.5)

		style = document.styles['Normal']
		font = style.font
		font.name = 'Calibri'
		font.size = Pt(11)

		# jobcalc - get_date_string()
		now = date.now()
		date = '{y}.{m}.{d}'.format(y = now.year, m =now.month, d = now.day)
		time = '{h}.{m}.{s}'.forat(h = now.hour, m = now.minute, s = now.second)
예제 #28
0
import datetime

datetime_object = datetime.datetime.now()
print(datetime_object)

d2 = datetime.date.today()
print(d2)

print(dir(datetime.datetime))

# example 3 : Date object to represent a date
d3 = datetime.date(2019, 4, 13)
print(d3)

from datetime import date

a = date(2019, 4, 13)
print(a)

# Example 4 : Get current date
from datetime import date

d3 = date.now()
예제 #29
0
    '-': lambda l, r: float(l) - float(r),  # ['-', 1, 2]
    '*': lambda l, r: float(l) * float(r),  # ['*', 1, 2]
    '%': f_mod,  # ['%', 14, 10]
    'mod': f_mod,  # ['mod', '@n', 10]
    '/': lambda l, r: (l * 1.0) / r,  # ['/', 1, 2]
    '!': lambda expr: not expr,  # ['!', ['true']]
    'not': lambda val: not val,  # ['not', ['true']]
    '&&': f_all,  # ['&&', [], [], ...]
    'and': f_all,  # ['and', [], [], ...]
    '::': f_any,  # ['::', [], [], ...]
    '||': f_any,
    'or': f_any,  # ['or', [], [], ...]
    'if': lambda c, t, f: t if c else f,# ['if', 'cond', 'true', 'false']
    'true': lambda: True,  # ['true']
    'false': lambda: False,  # ['false']
    'date': lambda date: date.strptime(date, '%Y-%m-%d'),# ['date', '2010-01-01']
    'today': lambda: date.today(),  # ['today']
    'time': lambda time: date.strptime(time, '%Y-%m-%d %H:%M:%S'),  # ['time', '2010-01-01 10:10:05']
    'now': lambda: date.now(),  # ['now']
    'append': lambda l, r: to_string(r) + to_string(l),  # ['append', 'world', 'hello ']
    'prepend': lambda l, r: to_string(l) + to_string(r),  # ['prepend', 'hello  ', 'world']
    'match': f_match, # ['match', /a/, 'abc']
    'in': in_f,  # ['in', '1,2,3,5..10,20..24', '@n']
    'within': within_f,  # ['within', '0..3', '@n']
    'replace': f_replace,
    'count': len,  # ['count', '@genders']
    'all': lambda of, value: all([el == value for el in of]),  # ['all', '@genders', 'male']
    'any': lambda of, value: any([el == value for el in of])  # ['any', '@genders', 'female']
}

예제 #30
0
""" Module used to contain logic for main loop used to populate database with
    scraped data at regular intervals"""

from time import sleep
from datetime import date

from database import DatabaseManager
from webscraper import ScrapingManager

db = DatabaseManager()
scraper = ScrapingManager(db)

while True:
    """ Open loop to record daily statistics """

    today = date.now()

    games = scraper.get_all_games_for_date(today.year, today.month, today.day)

    for game in games:
        scraper.execute_game_data_collection(game)

    scraper.commit_staged_data()

    sleep(3600 * 4)  # Wait four hours
예제 #31
0
파일: Logger.py 프로젝트: Solonarv/CellWars
 def log(self, level, msg):
     self.buffer.append((date.now(), level, msg))
     print("%s [%s]: %s" % self.buffer[-1])
     if(len(self.buffer) >= self.bufsize):
         self.flush()
예제 #32
0
                try:
                    for line in f:
                        dic = {}
                        dic["data"] = line[:8]
                        dic["orcamento"] = line[8:12]
                        dic["projeto"] = line[12:16]
                        dic["fatutamento"] = float(
                            line[16:-1])  # por causa do \n
                        listData.append(dic)

                    print(
                        f"{datetime.now().strftime('%H:%M:%S')} Carga Concluída"
                    )
                except Exception as e:
                    flog = open(
                        r"LOG" + date.now().strftime('%Y%m%d') + ".txt", "a+")
                    flog.write(
                        f"Erro as {datetime.now().strftime('%H:%M:%S')} : \n Ao carregar o arquivo: {e} \n\n"
                    )
                    flog.close()

                print(
                    f"{datetime.now().strftime('%H:%M:%S')} Iniciando Insert")
                registroErro = []
                for item in listData:
                    try:
                        cursor.execute(
                            "INSERT INTO ATIVIDADE_02(DATA, ID_ORCAMENTO, ID_PROJETO, FATURAMENTO) VALUES (?, ?, ?, ?)",
                            item["data"][:4] + "-" + item["data"][4:6] + "-" +
                            item["data"][6:], item["orcamento"],
                            item["projeto"], item["fatutamento"])
예제 #33
0
def update_created_at(obj):
    if type(object) is list:
        for o in obj:
            o.created_at = date.now()
예제 #34
0
from datetime import date
from classes import BB, initialize

if __name__ == "__main__":
    timestamps = [1000, 1045, 1145, 1245, 1330, 1430, 1530, 1630]
    y = initialize()
    y.set_opt()
    x = BB()
    x.login()
    day = date.today().strftime("%A")
    rn = int(date.now().strftime("%H%M"))
    print("You logged in on " + str(day) + " at " + str(rn) + " hours !")
    x.begin(day, rn)
    k = input("Press any key to exit...")