def onReportToday(self, e): count, income, cost, sale, profit = [ otf.bill_int_to_str(i) for i in dbf.GetTodayReport()] with wx.MessageDialog(self.mv, f"Tổng số lượt khám: {count}\n" f"Tổng thu: {income}\n\n" f"Tiền thuốc vốn: {cost}\n" f"Tiền thuốc bán ra: {sale}\n" f"Lời từ thuốc: {profit}", "Báo cáo hôm nay") as dlg: dlg.ShowModal()
def onEraseDrug(self, e): d = self.drugpicker.drugWH try: assert d is not None self.d_list.Remove(d) except AssertionError: pass finally: self.drugpicker.Clear() self.total_cost.ChangeValue( otf.bill_int_to_str(setting['cong_kham_benh'] + self.d_list.total_drug_price))
def clearVisitInfo(self): self.group_label_2.Label = 'Thông tin lượt khám' self.dt_label.Label = "" self.note.ChangeValue("") self.diag.ChangeValue("") self.weight.ChangeValue('0') self.days.ChangeValue('2') self.total_cost.ChangeValue( otf.bill_int_to_str(setting["cong_kham_benh"])) self.followup.Selection = 0 self.d_list.Clear() self.drugpicker.Clear()
def _createTotalCost(self): def on_bill(e): val = int("".join(w.Value.split("."))) w.ChangeValue(otf.bill_int_to_str(val)) w.SetInsertionPointEnd() def _kill_focus(e): if w.Value == '': w.ChangeValue('0') w = wx.TextCtrl(self, value=otf.bill_int_to_str(setting['cong_kham_benh'])) w.Bind(wx.EVT_CHAR, otf.only_nums) w.Bind(wx.EVT_TEXT, on_bill) w.Bind(wx.EVT_KILL_FOCUS, _kill_focus) return w
def updateVisitInfo(self): def _dt_to_label(p_dt): return ' ' * 20 + 'Giờ khám: {}:{} ngày {} tháng {} năm {}'.\ format(str(p_dt.hour).rjust(2, '0'), str(p_dt.minute).rjust(2, '0'), p_dt.day, p_dt.month, p_dt.year) v = self.Parent.visit self.group_label_2.Label =\ f'Thông tin lượt khám (Mã lượt khám: {v.id})' self.dt_label.Label = _dt_to_label(v.exam_date) self.note.ChangeValue(v.note) self.diag.ChangeValue(v.diag) self.weight.ChangeValue(str(v.weight)) self.days.ChangeValue(str(v.days)) self.drugpicker.Clear() self.d_list.Update(v.linedrugs) self.total_cost.ChangeValue(otf.bill_int_to_str(v.bill)) self.followup.ChangeValue(v.followup)
def onSamplePrescriptionbtn(self, e): with SamplePrescriptionDialog(self.Parent) as dlg: if dlg.ShowModal() == wx.ID_APPLY: ps, _ = dlg.get_selected_sample_prescription() self.d_list.Clear() for i in ps.samplelinedrugs: self.drugpicker.drugWH = i.drug self.times.ChangeValue(str(i.times)) self.dosage_per.ChangeValue(i.dosage_per) self.usage_unit.Label = i.drug.usage_unit self.sale_unit.Label = i.drug.sale_unit self._calc_quantity(None) kwargs = { "d": self.drugpicker.drugWH, "times": self.times.Value, "dosage_per": self.dosage_per.Value, "quantity": self.quantity.Value, "usage": self.usage.Value } self.d_list.Add_or_Update(**kwargs) self.total_cost.ChangeValue( otf.bill_int_to_str(setting['cong_kham_benh'] + self.d_list.total_drug_price))
def onSaveDrug(self, e): kwargs = { "d": self.drugpicker.drugWH, "times": self.times.Value, "dosage_per": self.dosage_per.Value, "quantity": self.quantity.Value, "usage": self.usage.Value } try: assert self.drugpicker.drugWH is not None assert self.dosage_per.Value != '' assert int(self.times.Value) assert int(self.quantity.Value) self.d_list.Add_or_Update(**kwargs) except AssertionError: pass finally: self.drugpicker.Clear() self.drugpicker.SetFocus() self.total_cost.ChangeValue( otf.bill_int_to_str(setting['cong_kham_benh'] + self.d_list.total_drug_price))
def on_bill(e): val = int("".join(w.Value.split("."))) w.ChangeValue(otf.bill_int_to_str(val)) w.SetInsertionPointEnd()