def ChkInput(self): # 入力チェック KubunName = [u"区分名", u"当初", u"中間", u"追加"] # エラーMSG表示用 LblMsg = "" ErrFlg = True Nengetu = self.request.cookies.get('Nengetu') # 年(12月の場合本当は前年だけどどうせ31日 for Ctr in range(1, 4): # 1~3 if self.request.get('TxtHizuke' + str(Ctr)) != "": # 日付チェック Hizuke = Nengetu[0:5] # yyyy/ Hizuke += str(self.request.get('TxtHizuke' + str(Ctr))) # dd/mm if common.CheckDate(self, Hizuke) == False: # 日付としてNG? LblMsg = KubunName[Ctr] + u"仮払い日付が正しくありません。" break # チェック中断 if self.request.get('TxtKingaku' + str(Ctr)) != "": # 金額チェック Kingaku = str(self.request.get('TxtKingaku' + str(Ctr))) if Kingaku.isdigit() == False: # 数値じゃねぇ! LblMsg = KubunName[Ctr] + u"仮払い金額が正しくありません。" break # チェック中断 else: # ループ終了→エラー無し ErrFlg = False return (ErrFlg, LblMsg)
def ChkInput(self): # 入力チェック ErrFlg = True LblMsg = "" if common.CheckTime(self,self.request.get('TxtZikoku_S')) == False: LblMsg = "開始時刻が正しくありません。(HH:MM)" elif common.CheckTime(self,self.request.get('TxtZikoku_E')) == False: LblMsg = "終了時刻が正しくありません。(HH:MM)" elif common.CheckDate(self,self.request.get('TxtBirthDay')) == False: LblMsg = "生年月日が正しくありません。(yyyy/mm/dd)" elif common.CheckDate(self,self.request.get('TxtZyusinKibou1')) == False: LblMsg = "受診希望日1件目が正しくありません。(yyyy/mm/dd)" elif common.CheckDate(self,self.request.get('TxtZyusinKibou2')) == False: LblMsg = "受診希望日2件目が正しくありません。(yyyy/mm/dd)" elif common.CheckDate(self,self.request.get('TxtZyusinKibou3')) == False: LblMsg = "受診希望日3件目が正しくありません。(yyyy/mm/dd)" else: ErrFlg = False return (ErrFlg,LblMsg)
def ChkInput(self): # 入力チェック ErrFlg = True LblMsg = "" if self.request.get('TxtHizuke') == "": LblMsg = "日付が未入力です。" elif common.CheckDate(self,self.request.get('TxtHizuke')) == False: LblMsg = "日付が正しくありません。" else: ErrFlg = False return (ErrFlg,LblMsg)
def post(self): user = users.get_current_user() # ログオン確認 if MstUser().ChkUser(user.email()) == False: self.redirect(users.create_logout_url(self.request.uri)) return LblMsg = "" Key = self.request.cookies.get('Key', '') # CooKie取得 KanzyaID = self.request.cookies.get('KanzyaID', '') # CooKie取得 ErrFlg, LblMsg = self.ChkInput() # 入力チェック if ErrFlg == False: # エラー無し self.DBSet() self.redirect("/Yasukawa220/?KanzyaID=" + KanzyaID) # 一覧に戻る return Rec = {} ParaNames = self.request.arguments() for ParaName in ParaNames: # 前画面項目引き渡し Rec[ParaName] = self.request.get(ParaName) Rec["ByoumeiCD"] = int(Rec["ByoumeiCD"]) if Rec["Hizuke"] != "": if common.CheckDate(self, self.request.get('Hizuke')) == True: Rec["Hizuke"] = datetime.datetime.strptime( Rec["Hizuke"], '%Y/%m/%d') template_values = { 'Kihon': DatKihon().GetRec(KanzyaID), 'Rec': Rec, 'MstByoumei': MstByoumei().GetAll(), 'LblMsg': LblMsg } path = os.path.join(os.path.dirname(__file__), 'Yasukawa225.html') self.response.out.write(template.render(path, template_values))
def SetTitle(self, WorkSheet, Nengetu): # 固定部分セット Hizuke = u"平成" + str(datetime.datetime.now().year - 1988) + u"年" Hizuke += str(datetime.datetime.now().month) + u"月" Hizuke += str(datetime.datetime.now().day) + u"日" Style = self.SetStyle("THIN", "THIN", "THIN", "THIN", xlwt.Alignment.VERT_CENTER, xlwt.Alignment.HORZ_CENTER) WorkSheet.write(0, 67, Hizuke) WorkSheet.write_merge(0, 0, 2, 3, u"当初仮払金額", Style) WorkSheet.write_merge(0, 0, 27, 31, u"中間仮払金額", Style) WorkSheet.write_merge(0, 0, 53, 55, u"追加仮払", Style) WorkSheet.write_merge(1, 2, 1, 1, u"患者番号", Style) WorkSheet.write(1, 2, u"名前", Style) WorkSheet.write(2, 2, u"あいうえお順", Style) WorkSheet.write(1, 3, u"", Style) WorkSheet.write(2, 3, u"", Style) Row = 1 StyleYellow = self.SetStyle("THIN", "THIN", "THIN", "THIN", xlwt.Alignment.VERT_CENTER, xlwt.Alignment.HORZ_CENTER) pattern = xlwt.Pattern() pattern.pattern = xlwt.Pattern.SOLID_PATTERN pattern.pattern_fore_colour = xlwt.Style.colour_map['yellow'] StyleYellow.pattern = pattern for i in range(1, 32): # 日付 # 日付チェック Hizuke = Nengetu + "/" + "%02d" % i if common.CheckDate(self, Hizuke) == False: # yyyy/mm/ + 日付 break # 当月終了 Col = 2 + (i * 2) if datetime.datetime.strptime(Hizuke, '%Y/%m/%d').weekday() == 6: # 日曜日 WorkSheet.write_merge(Row, Row, Col, Col + 1, str(i), StyleYellow) WorkSheet.write(Row + 1, Col, "AM", StyleYellow) WorkSheet.write(Row + 1, Col + 1, "PM", StyleYellow) else: WorkSheet.write_merge(Row, Row, Col, Col + 1, str(i), Style) WorkSheet.write(Row + 1, Col, "AM", Style) WorkSheet.write(Row + 1, Col + 1, "PM", Style) # 灰色背景色 StyleLG = self.SetStyle("THIN", "THIN", "THIN", "THIN", xlwt.Alignment.VERT_CENTER, xlwt.Alignment.HORZ_CENTER) pattern = xlwt.Pattern() pattern.pattern = xlwt.Pattern.SOLID_PATTERN pattern.pattern_fore_colour = xlwt.Style.colour_map['gray25'] StyleLG.pattern = pattern Col = 0 for i in range(1, 34): # 行番号 Row = 1 + (i * 2) if i % 2 == 0: WorkSheet.write_merge(Row, Row + 1, Col, Col, str(i), Style) else: WorkSheet.write_merge(Row, Row + 1, Col, Col, str(i), StyleLG) Col = 1 Row = 69 WorkSheet.write_merge(Row, Row + 3, Col, Col, u"日計", Style) WorkSheet.write(73, Col, u"累計", Style) WorkSheet.write_merge(74, 74, Col, Col + 1, u"病棟担当者押印か署名", Style) Col = 3 WorkSheet.write_merge(74, 74, Col, Col, u"", Style) for i in range(1, 32): # 日付 # 日付チェック Hizuke = Nengetu + "/" + "%02d" % i if common.CheckDate(self, Hizuke) == False: # yyyy/mm/ + 日付 break # 当月終了 Col = 2 + (i * 2) WorkSheet.write_merge(74, 74, Col, Col + 1, u"", Style) Col = 1 WorkSheet.write_merge(75, 75, Col, Col + 12, u"* 10日、20日(土日祝の場合は前後でします)に事務所からチェックに伺います。", Style) Col = 2 WorkSheet.write(69, Col, u"男性本数計", Style) WorkSheet.write(70, Col, u"女性本数計", Style) WorkSheet.write(71, Col, u"本数合計", Style) WorkSheet.write(72, Col, u"出勤金額", Style) WorkSheet.write(73, Col, u"当日残高", Style) return