Beispiel #1
0
def edit(client_pk=None):
    """
    edits the company information
    :return:
    """
    form = NewClientForm(request.form)
    if 'company' in session:
        company = Company(pk=session['company'])
    else:
        return redirect(url_for('company.new'))
    if request.method == 'POST' and form.validate():
        information = {'name': form.name.data,
                    'phone_number': form.phone_number.data,
                    'address': form.address.data}
        company.change_information(**information)
        #
        # store company PK, we'll have to get the company each time we
        # would like to view it
        # can probably store this in flask login as well, possibly
        #
        session['company'] = company.data.pk
        return redirect(url_for('company.home'))
    form.name.data = company.data.name
    form.address.data = company.data.address
    form.phone_number.data = company.data.phone_number
    return render_template('company/edit.html', form=form)
Beispiel #2
0
def createDummy():

    connect(config.db_name_test)

    today = datetime.today()

    company1 = Company()
    company1.idx = '93920'
    company1.name = '달수네'
    company1.save()

    company2 = Company()
    company2.idx = '99910'
    company2.name = '말수네'
    company2.save()

    recruit1 = Recruit()
    recruit1.idx = '1'
    recruit1.memo = 'The idx is 1'
    recruit1.end = today + timedelta(-3)
    recruit1.save()

    recruit2 = Recruit()
    recruit2.idx = '2'
    recruit2.memo = 'The idx is 2'
    recruit2.end = today + timedelta(0)
    recruit2.save()

    recruit3 = Recruit()
    recruit3.idx = '3'
    recruit3.memo = 'The idx is 3'
    recruit3.end = today + timedelta(3)
    recruit3.save()

    recruit4 = Recruit()
    recruit4.idx = '4'
    recruit4.title = "permanent recruit"
    recruit4.memo = 'The idx is 4'
    recruit4.end = None
    recruit4.save()
Beispiel #3
0
def home():
    form = ClientSearchForm(request.form)
    if current_user.is_authenticated():
        session['company'] = current_user.company.pk
    if not 'company' in session:
        return redirect(url_for('company.new'))
    try:
        company = Company.get(Company.pk == session['company'])
    except Company.DoesNotExist:
        session.pop('company')
        flash("Sorry, it seems you were trying to access an invalid company.")
        return url_for('company.new')
    return render_template('company/home.html', company=company, form=form)
Beispiel #4
0
def edit():
    """
    edits the company information
    :return:
    """
    form = NewCompanyForm(request.form)
    if 'company' in session:
        company = Company.get(Company.pk == session['company'])
    else:
        return redirect(url_for('company.new'))
    if request.method == 'POST' and form.validate():
        information = {'name': form.name.data,
                       'phone_number': form.phone_number.data,
                       'address': form.address.data}
        query = Company().update(**information).where(Company.pk == company.pk)
        query.execute()
        session['company'] = company.pk
        return redirect(url_for('company.home'))
    form.name.data = company.name
    form.address.data = company.address
    form.phone_number.data = company.phone_number
    return render_template('company/edit.html', form=form)
Beispiel #5
0
def removeDummy():

    Recruit.drop_collection()
    Company.drop_collection()
Beispiel #6
0
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 10 16:11:37 2017

@author: Frank
"""
import os
from db import ProjectInfo, Finance, Company, Project, HumanResource

project_info = ProjectInfo()
company = Company(os.path.join(os.getcwd(), 'db\\公司.xlsx'))
human = HumanResource(os.path.join(os.getcwd(), 'db\\员工.xlsx'))
finance = Finance(os.path.join(os.getcwd(), 'db\\财务.xlsx'))
projects_done = Project(os.path.join(os.getcwd(), 'db\\往期工程.xlsx'))
projects_being = Project(os.path.join(os.getcwd(), 'db\\正在建设项目.xlsx'))

db = {}
db['project_info'] = project_info
db['company'] = company
db['project_members'] = {}
db['human'] = human
db['finance'] = finance
db['projects_done'] = projects_done
db['projects_being'] = projects_being
db['公司信息路径'] = os.path.join(os.getcwd(), 'db')
db['人员证件路径'] = os.path.join(os.getcwd(), 'img\\证件\\人员')
db['公司证件路径'] = os.path.join(os.getcwd(), 'img\\证件\\公司')

PATH = ['公司信息路径', '人员证件路径', '公司证件路径']

POSITION = [
Beispiel #7
0
 def tearDownClass(cls):
     Recruit.drop_collection()
     Company.drop_collection()