def generateNakl(order, order_date, order_price, request, t): template_filename = 'torg12_0.xls' fullname = str('ООО санаторий "Хопровские зори"') vendor = str('КПП 581701001 ') + fullname + str(' Пензенская обл., п.Колышлей, ул.Лесная 1а') if order.patient.address is None: client = order.patient.fio() else: client = order.patient.fio() + ',' + order.patient.address dir = gavnetso.getEmployerByRoleNameAndDate('Директор', order.start_date).__unicode__() gb = gavnetso.getEmployerByRoleNameAndDate('Главный бухгалтер', order.start_date).__unicode__() kassir = gavnetso.getEmployerByRoleNameAndDate('Кассир', order.start_date).__unicode__() rub = numeral.rubles(float(order_price), True) tel = {'PORTRAIT': False, 'NUMPAGES': 1, 'PIZDEZ': fullname, 'NUMBER': order.code, 'FILENAME': 'nakladnaya-' + str(order.code), 'CLIENT': client, 'VENDOR': vendor, 'DIRECTOR': dir, 'GBUH': gb, 'KASSIR': kassir, 'SP': rub, 'DATE': order_date, 'QTYSUM': 1, 'AMOUNTSUM': order_price, 'AMOUNTNDSSUM': order_price, 'ALLAMOUNTSUM': order_price, 'TOVAR': t} return fill_excel_template(template_filename, tel, request)
def generate_pko(request, client, code, ed, price, putevka, sd): template_filename = 'prih_order1.xls' fullname = 'ООО санаторий "Хопровские зори"' gb = gavnetso.getEmployerByRoleNameAndDate('Главный бухгалтер', sd).__unicode__() kassir = gavnetso.getEmployerByRoleNameAndDate('Кассир', sd).__unicode__() delt = ed - sd days = delt.days + 1 tovar = 'Пут. сан.-кур. на ' + str(days) + ' дней c ' + str(sd) + ' по ' + str(ed) + '№ ' + str(putevka) tel = {'NUMPAGES': 1, 'FULLNAME': fullname, 'NUMBER': code, 'FILENAME': 'pko-' + str(code), 'CLIENT': client, 'GBUH': gb, 'KASSIR': kassir, 'PRICE': price, 'DATE': sd.strftime('%d.%m.%Y'), 'DESCRIPTION': tovar} return fill_excel_template(template_filename, tel, request)