def makeExcel(self, dt, recordMapList, totalList, name):

        dt = StringOperationLib.mid(dt, 1, 7)
        ym = DateUtilLib.getYmFormatJapanese(dt)
        name = StringOperationLib.replace(name, " ", "")

        excel = PythonExcelLib()
        excel.setPageA4

        excel.rename('月間作業実績報告書')

        #タイトル等共通部分
        self.setCommon(excel, ym, name)

        #勤怠表の項目名
        self.setTimeRecordTitle(excel)

        #勤怠表
        lastRow = self.setTimeRecordValue(excel, recordMapList)

        #合計行
        self.setTimeRecordTotalValue(excel, totalList, copy(lastRow))

        #押印欄等
        self.setOtherArea(excel, copy(lastRow))

        #体裁
        self.setFormat(excel, copy(lastRow))

        excel.save(Config.getConf('TimeRecordAutoDLinfo', 'download_path') + '本社提出用_' + ym + '勤怠表_' + name + '.xlsx')

        #オブジェクト解放
        del excel
Esempio n. 2
0
 def getDateFormatJapanese(date):
     year = StringOperationLib.toString(StringOperationLib.left(date,
                                                                4)) + '年'
     month = StringOperationLib.toString(
         StringOperationLib.toInt(StringOperationLib.mid(date, 6, 2))) + '月'
     day = StringOperationLib.toString(
         StringOperationLib.toInt(StringOperationLib.right(date, 2))) + '日'
     return year + month + day
    def run(self):

        self.writeLog('処理開始')

        date = self.getForm('-date')

        if date == '':
            self.writeLog('parameter:-date is not set')
            return

        #前回データを削除
        self.deleteLastSessionData()

        #処理する社員情報を取得
        employeeList = self.getEmployeeList()
        dt = DateUtilLib.toDateTimeDate(date)
        dt = StringOperationLib.toString(DateUtilLib.getDateIntervalMonth(dt, -1))

        targetYm = StringOperationLib.mid(dt, 1, dt.rfind('-'))

        #ループ内
        for i in range(len(employeeList)):

            userId = StringOperationLib.toString(employeeList[i][EmployeeDao.COL_ID])
            name = StringOperationLib.toString(employeeList[i][EmployeeDao.COL_NAME])
            loginId = StringOperationLib.toString(employeeList[i][EmployeeDao.COL_LOGIN_ID])

            self.writeLog('処理対象社員名 : ' + name)

            #個人ディレクトリを作成
            employeeDir = self.makeEmployeeDir(name)

            #データを取得
            trafficList = self.getExpensesList(userId, targetYm, '1')
            expensesList = self.getExpensesList(userId, targetYm, '2')

            #1件でもあれば、精算書を作成
            if len(trafficList) > 0:
                self.makeTrafficExcel(targetYm, trafficList, name, employeeDir)
            if len(expensesList) > 0:
                self.makeExpensesExcel(targetYm, expensesList, name, employeeDir)

            #領収書ファイルがあれば、コピー
            self.copyReceiptFile(targetYm, loginId, employeeDir)

        #Zipにまとめる
        self.makeZipFile()

        #メール送信
        self.sendCostManage(targetYm)

        self.writeLog('処理完了')

        return
    def sendTimeSheet(self, dt):

        dt = StringOperationLib.mid(dt, 1, 7)
        ym = DateUtilLib.getYmFormatJapanese(dt)

        mail = SendMailLib()

        mail.setMailFrom(Config.getConf('MAILinfo', 'admin_mail_from'))
        mail.setMailTo(Config.getConf('TimeRecordAutoDLinfo', 'kanri_mail'))
        mail.setMailSubject('【自動送信】' + ym + '勤怠表')
        mail.setMailText(ym + '分の勤怠表を送付します。')
        mail.setAttach(Config.getConf('TimeRecordAutoDLinfo', 'output_path') + 'time_sheet.zip')

        mail.send()