예제 #1
0
파일: alerters.py 프로젝트: omerbach/samm
    def coverage(coverageOf, requestParameters):

        return Alerter.GetTemplateContent(
            'web/templates/reports/coverage_report.html',
            None,
            {
                # general fields
                'date': datetime.date.today().strftime("%d/%m/%Y"),
                'company_name': utils.config.companyName,
                'company_mail': utils.config.companyMail,
                'company_mail_debts': utils.config.companyMailDebts,
                'company_web_site': utils.config.companyWebSite,
                'company_phone': utils.config.companyPhone,
                'company_fax': utils.config.companyFax,
                'company_address': utils.config.companyAddress,
                'current_month': int(datetime.datetime.now().month),
                'current_year': int(datetime.datetime.now().year),
                # specific fields
                'executionType': Alerter.getExecutionDesc(
                    requestParameters.mode),
                'coverageOf': coverageOf,
                # special fields (with !)
                'company_logo': utils.CustomerSignature()
            })
예제 #2
0
파일: alerters.py 프로젝트: omerbach/samm
    def report(requestParameters,
               tenants,
               buildingNum,
               columns_toolTips=[],
               values_classes=[],
               total=None):

        return Alerter.GetTemplateContent(
            'web/templates/reports/executive_report.html',
            None,
            {
                # general fields
                'date':
                datetime.date.today().strftime("%d/%m/%Y"),
                'company_name':
                utils.config.companyName,
                'company_mail':
                utils.config.companyMail,
                'company_mail_debts':
                utils.config.companyMailDebts,
                'company_web_site':
                utils.config.companyWebSite,
                'company_phone':
                utils.config.companyPhone,
                'company_fax':
                utils.config.companyFax,
                'company_address':
                utils.config.companyAddress,
                'current_month':
                int(datetime.datetime.now().month),
                'current_year':
                int(datetime.datetime.now().year),
                # specific fields
                'customerTemplatesDir':
                requestParameters.customerTemplatesDir,
                'executionType':
                Alerter.getExecutionDesc(requestParameters.mode),
                'tenants':
                tenants,
                'buildingsNumber':
                buildingNum,
                'tenantsNumber':
                len(tenants),
                'year':
                requestParameters.year,
                'months':
                utils.HebrewMonths(','.join([
                    str(month) for month in requestParameters.reportingMonths
                ])),
                'total':
                total,
                'columns_toolTips':
                columns_toolTips,
                'values_classes':
                values_classes,
                'formats':
                requestParameters.formats,
                # special fields (with !)
                'company_logo':
                utils.CustomerSignature(),
                # functions
                'Number':
                int,
                'Commafy':
                utils.Commafy,
                'UnCommafy':
                utils.UnCommafy,
                'Monthify':
                utils.Monthify
            })
예제 #3
0
파일: alerters.py 프로젝트: omerbach/samm
    def FormatBillboardTemplate(customerTemplatesDir,
                                description='',
                                building='',
                                year=int(datetime.datetime.now().year),
                                tenants=[]):

        template = 'billboard.htm'

        debtsTenantsTableTemplate = 'web/tenants_tables/debts_tenants_table.html'
        paymentsTenantsTableTemplate = 'web/tenants_tables/payments_tenants_table.html'
        generalTenantsTableTemplate = 'web/tenants_tables/general_tenants_table.html'

        debtsTenantsTable = Alerter.GetTemplateContent(
            debtsTenantsTableTemplate, None,
            {'tenants': tenants
             }) if os.path.exists(debtsTenantsTableTemplate) else None
        paymentsTenantsTable = Alerter.GetTemplateContent(
            paymentsTenantsTableTemplate, None,
            {'tenants': tenants
             }) if os.path.exists(paymentsTenantsTableTemplate) else None
        generalTenantsTable = Alerter.GetTemplateContent(
            generalTenantsTableTemplate, None,
            {'tenants': tenants
             }) if os.path.exists(generalTenantsTableTemplate) else None

        billBoardMessage = Alerter.GetTemplateContent(
            os.path.join(customerTemplatesDir, template),
            None,
            {
                # general fields
                'date':
                datetime.date.today().strftime("%d/%m/%Y"),
                'company_name':
                utils.config.companyName,
                'company_mail':
                utils.config.companyMail,
                'company_mail_debts':
                utils.config.companyMailDebts,
                'company_web_site':
                utils.config.companyWebSite,
                'company_phone':
                utils.config.companyPhone,
                'company_fax':
                utils.config.companyFax,
                'company_address':
                utils.config.companyAddress,
                'previous_month':
                '%02d' % 12 if int(datetime.datetime.now().month) == 1 else
                int(datetime.datetime.now().month) - 1,
                'current_month':
                '%02d' % int(datetime.datetime.now().month),
                'next_month':
                '%02d' % 1 if int(datetime.datetime.now().month) == 12 else
                int(datetime.datetime.now().month) + 1,
                'previous_year':
                int(datetime.datetime.now().year) - 1,
                'current_year':
                int(datetime.datetime.now().year),
                'next_year':
                int(datetime.datetime.now().year) + 1,
                # specific fields
                'description':
                description,
                'building':
                building,
                'year':
                year,
                # special fields (with !)
                'company_logo':
                utils.CustomerSignature(),
                'debts_tenants_table':
                debtsTenantsTable,
                'payments_tenants_table':
                paymentsTenantsTable,
                'general_tenants_table':
                generalTenantsTable,
                # functions
                'Commafy':
                utils.Commafy,
                'UnCommafy':
                utils.UnCommafy,
                'Monthify':
                utils.Monthify
            })
        return billBoardMessage
예제 #4
0
파일: alerters.py 프로젝트: omerbach/samm
    def FormatAlertTemplate(path,
                            templateStr,
                            description='',
                            building='',
                            name='',
                            appartment='',
                            months='',
                            year=int(datetime.datetime.now().year),
                            payment=0,
                            debt=0,
                            previousDebt=0,
                            totalDebt=0,
                            mails=[],
                            phones=[],
                            comment="",
                            general="",
                            event="",
                            occasional="",
                            subject="",
                            monthsCount="",
                            tenant_name="",
                            tenant_phones="",
                            professional_name="",
                            worker_name="",
                            service_request_id="",
                            service_request_description="",
                            parking_debt=0,
                            previous_debt_2012=0,
                            special=0):

        if not path and not templateStr:
            return ''

        alertTemplateContent = Alerter.GetTemplateContent(
            path,
            templateStr,
            {
                # general fields
                'date':
                datetime.date.today().strftime("%d/%m/%Y"),
                'company_name':
                utils.config.companyName,
                'company_mail':
                utils.config.companyMail,
                'company_mail_debts':
                utils.config.companyMailDebts,
                'company_web_site':
                utils.config.companyWebSite,
                'company_phone':
                utils.config.companyPhone,
                'company_fax':
                utils.config.companyFax,
                'company_address':
                utils.config.companyAddress,
                'previous_month':
                '%02d' % 12 if int(datetime.datetime.now().month) == 1 else
                int(datetime.datetime.now().month) - 1,
                'current_month':
                '%02d' % int(datetime.datetime.now().month),
                'next_month':
                '%02d' % 1 if int(datetime.datetime.now().month) == 12 else
                int(datetime.datetime.now().month) + 1,
                'previous_year':
                int(datetime.datetime.now().year) - 1,
                'current_year':
                int(datetime.datetime.now().year),
                'next_year':
                int(datetime.datetime.now().year) + 1,
                # specific fields
                'comment':
                comment,
                'general':
                general,
                'event':
                event,
                'message':
                occasional,
                'subject':
                subject,
                'description':
                description,
                'building':
                building,
                'name':
                name,
                # in case appartment is str in hebrew
                'appartment':
                appartment.encode('utf-8'),
                'months':
                utils.HebrewMonths(months),
                'year':
                int(year),
                'phones':
                ', '.join(phones),
                'mails':
                ', '.join(mails),
                'payment0':
                payment,
                'payment':
                utils.Commafy(payment),
                'payment2':
                utils.Commafy(payment * 2),
                'payment3':
                utils.Commafy(payment * 3),
                'payment4':
                utils.Commafy(payment * 4),
                'payment5':
                utils.Commafy(payment * 5),
                'payment6':
                utils.Commafy(payment * 6),
                'payment7':
                utils.Commafy(payment * 7),
                'payment8':
                utils.Commafy(payment * 8),
                'payment9':
                utils.Commafy(payment * 9),
                'payment10':
                utils.Commafy(payment * 10),
                'payment11':
                utils.Commafy(payment * 11),
                'payment12':
                utils.Commafy(payment * 12),
                'debt':
                utils.Commafy(debt),
                'previous_debt':
                utils.Commafy(previousDebt),
                'total_debt':
                utils.Commafy(totalDebt),
                'months_count':
                monthsCount,
                # special fields (with !)
                'company_logo':
                utils.CustomerSignature(),
                'personal_signature':
                utils.CompanySignature(),
                # functions
                'Number':
                int,
                'Commafy':
                utils.Commafy,
                'UnCommafy':
                utils.UnCommafy,
                'Monthify':
                utils.Monthify,
                'tenant_name':
                tenant_name,
                'tenant_phones':
                tenant_phones,
                'professional_name':
                professional_name,
                'worker_name':
                worker_name,
                'service_request_id':
                service_request_id,
                'service_request_description':
                service_request_description,
                'parking_debt':
                parking_debt,
                'previous_debt_2012':
                previous_debt_2012,
                'special':
                utils.Commafy(special)
            })

        return alertTemplateContent
예제 #5
0
파일: creditSms.py 프로젝트: omerbach/samm
# -*- coding: utf8 -*-  
import datetime
import utils
import os

import sms
import utils
import alerters

smsProvider = eval('sms.%s()' % utils.config.smsProvider)
credit = smsProvider.credit()
t = str(datetime.datetime.now().time().replace(microsecond=0))
d = str(datetime.date.today())

message = alerters.Alerter.GetTemplateContent('web/templates/reports/sms_report.html',
                                              {'d': d,
                                               't': t,
                                               'sms_credit': utils.Commafy(credit),
                                               'sms_password': utils.config.smsPassword,
                                               'sms_mail': utils.config.smsMail,
                                               'sms_web_site': utils.config.smsWebSite(),
                                               'company_logo': utils.CustomerSignature()})

title = 'יתרת_סמסים'.decode('utf-8') + '.html'
with file(title, 'wb') as fpo:
    fpo.write(message.encode('utf-8'))
os.startfile(title)

예제 #6
0
# -*- coding: utf8 -*-
import time
import datetime
import os

import bottle
import utils

authorized, expiry = utils.Authorize()

formattedExpiry = time.strftime('%Y-%m-%d', time.localtime(expiry))

if authorized:
    message = bottle.template('web/templates/reports/license_report',
                              date=formattedExpiry,
                              company_name=utils.config.companyName,
                              expiry=formattedExpiry)
else:
    message = bottle.template(
        'web/templates/errors/error_customer_not_approved',
        date=datetime.date.today().strftime("%d/%m/%Y"),
        company_name=utils.config.companyName,
        company_web_site=utils.config.companyWebSite,
        company_logo=utils.CustomerSignature())

title = 'license.html'
with file(title, 'wb') as fpo:
    fpo.write(message.encode('utf-8'))
os.startfile(title)