dev
parent
c835f4a811
commit
1edcbbea35
|
@ -11,7 +11,7 @@
|
||||||
<!--<field name="staff_type" required="1" span="2"/>-->
|
<!--<field name="staff_type" required="1" span="2"/>-->
|
||||||
</group>
|
</group>
|
||||||
<foot replace="Run Report">
|
<foot replace="Run Report">
|
||||||
<button string="PDF Summany" type="success" method="wizard_report_summany" icon="print"/>
|
<button string="PDF Summary" type="success" method="wizard_report_summary" icon="print"/>
|
||||||
<button string="PDF Details" type="success" method="wizard_report_details" icon="print"/>
|
<button string="PDF Details" type="success" method="wizard_report_details" icon="print"/>
|
||||||
<button string="PDF Items" type="success" method="wizard_report_items" icon="print"/>
|
<button string="PDF Items" type="success" method="wizard_report_items" icon="print"/>
|
||||||
</foot>
|
</foot>
|
||||||
|
|
|
@ -10,4 +10,7 @@
|
||||||
<field name="product_id" span="2"/>
|
<field name="product_id" span="2"/>
|
||||||
<field name="reimbursable" span="2"/>
|
<field name="reimbursable" span="2"/>
|
||||||
<field name="pay_type" attrs='{"invisible":[["reimbursable","=","yes"]]}' span="2"/>
|
<field name="pay_type" attrs='{"invisible":[["reimbursable","=","yes"]]}' span="2"/>
|
||||||
|
<foot string="Export XLS" position="after">
|
||||||
|
<button string="Export PDF" type="success" method="get_report_data_pdf" icon="print" convert="pdf"/>
|
||||||
|
</foot>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -17,4 +17,5 @@ from . import clinic_setting
|
||||||
#from . import validate_cycle_item
|
#from . import validate_cycle_item
|
||||||
#from . import update_line_amount
|
#from . import update_line_amount
|
||||||
#from . import revise
|
#from . import revise
|
||||||
from . import add_patient_moves
|
#from . import add_patient_moves #XXX do not run it again!!!
|
||||||
|
from . import check_patient
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
from netforce.model import get_model
|
||||||
|
from netforce import migration
|
||||||
|
from netforce.access import set_active_user, get_active_user, set_active_company, get_active_company
|
||||||
|
import collections
|
||||||
|
|
||||||
|
class Migration(migration.Migration):
|
||||||
|
_name="check.patient"
|
||||||
|
_version="2.12.8"
|
||||||
|
|
||||||
|
def migrate(salf):
|
||||||
|
set_active_company(1)
|
||||||
|
set_active_user(1)
|
||||||
|
totals={}
|
||||||
|
context={
|
||||||
|
'active_test': False,
|
||||||
|
}
|
||||||
|
for pt in get_model('clinic.patient').search_browse([], context=context):
|
||||||
|
key=(pt.number, pt.card_no, pt.walkin)
|
||||||
|
#key=(pt.hn_no)
|
||||||
|
totals.setdefault(key,{
|
||||||
|
'count': 0,
|
||||||
|
'pid': pt.id,
|
||||||
|
'pname': pt.name,
|
||||||
|
})
|
||||||
|
totals[key]['count']+=1
|
||||||
|
|
||||||
|
for k in sorted(totals.keys()):
|
||||||
|
hn_no, card_no, walkin = k
|
||||||
|
pt=totals[k]
|
||||||
|
if pt['count'] > 1:
|
||||||
|
#hn_no, card_no, walkin = k
|
||||||
|
print(k, pt)
|
||||||
|
return
|
||||||
|
|
||||||
|
user_id=get_active_user()
|
||||||
|
company_id=get_active_company()
|
||||||
|
count=0
|
||||||
|
lines_hn=[]
|
||||||
|
lines_pid=[]
|
||||||
|
lines_h=[]
|
||||||
|
lines_p=[]
|
||||||
|
print('start check patients.')
|
||||||
|
for pat in get_model('clinic.patient').search_browse([]):
|
||||||
|
lines_hn.append(pat.hn_no)
|
||||||
|
lines_pid.append(pat.card_no)
|
||||||
|
count+=1
|
||||||
|
print('count : %d'%(count))
|
||||||
|
total_hn = [item for item, count in collections.Counter(lines_hn).items() if count > 1]
|
||||||
|
total_pid = [item for item, count in collections.Counter(lines_pid).items() if count > 1]
|
||||||
|
count=0
|
||||||
|
for total in total_hn:
|
||||||
|
for line in get_model('clinic.patient').search_browse(['hn_no','=',total]):
|
||||||
|
data = '%d : %s'%(line.id,line.hn_no)
|
||||||
|
lines_h.append(data)
|
||||||
|
count+=1
|
||||||
|
print('#%d : id=%d, name=%s %s, hn_no=%s'%(count,line.id,line.first_name,line.last_name,line.hn_no))
|
||||||
|
print("")
|
||||||
|
print("*"*100)
|
||||||
|
print("")
|
||||||
|
count=0
|
||||||
|
for total in total_pid:
|
||||||
|
for line in get_model('clinic.patient').search_browse(['card_no','=',total]):
|
||||||
|
data = '%d : %s'%(line.id,line.card_no)
|
||||||
|
lines_p.append(data)
|
||||||
|
count+=1
|
||||||
|
print('#%d : id=%d, name=%s %s, pid=%s'%(count,line.id,line.first_name,line.last_name,line.card_no))
|
||||||
|
print('check patients : Done!')
|
||||||
|
return True
|
||||||
|
|
||||||
|
Migration.register()
|
|
@ -46,7 +46,7 @@ class AccountPayment(Model):
|
||||||
'next': {
|
'next': {
|
||||||
'name': 'report_clinic_payment_form',
|
'name': 'report_clinic_payment_form',
|
||||||
'refer_id': hd_case_id,
|
'refer_id': hd_case_id,
|
||||||
'payment_id': obj.id,
|
'payment_ids': ids,
|
||||||
'convert': 'pdf',
|
'convert': 'pdf',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1321,7 +1321,10 @@ class HDCase(Model):
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
if not obj.payments:
|
if not obj.payments:
|
||||||
raise Exception("Receipt not found!")
|
raise Exception("Receipt not found!")
|
||||||
for payment in obj.payments:
|
payment_ids=[]
|
||||||
|
if context.get('payment_ids'):
|
||||||
|
payment_ids=eval(context['payment_ids'])
|
||||||
|
for payment in get_model('account.payment').browse(payment_ids):
|
||||||
context['payment_id']=payment.id
|
context['payment_id']=payment.id
|
||||||
data=self.get_report_payment_data(context=context)
|
data=self.get_report_payment_data(context=context)
|
||||||
limit_item=9
|
limit_item=9
|
||||||
|
|
|
@ -272,7 +272,7 @@ class Patient(Model):
|
||||||
'dispose': False,
|
'dispose': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
_sql_constraints=("clinic_patient_key_uniq","unique(name_check)","name should be unique"),
|
_sql_constraints=("clinic_patient_key_uniq","unique(number,card_no,walkin)","HN, Card and Walkin should be unique"),
|
||||||
|
|
||||||
def check_idcard(self,card_type,idcard=''):
|
def check_idcard(self,card_type,idcard=''):
|
||||||
res=True
|
res=True
|
||||||
|
|
|
@ -61,6 +61,19 @@ class ReportHDCaseExpenseSummary(Model):
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def get_report_data_pdf(self,ids,context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
return {
|
||||||
|
"next": {
|
||||||
|
"type": "report_odt2",
|
||||||
|
"model": self._name,
|
||||||
|
"template": "report_hdcase_expense_summary_pdf",
|
||||||
|
"refer_id": obj.id,
|
||||||
|
"method": "get_report_data",
|
||||||
|
"convert": "pdf",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
company_id=get_active_company()
|
company_id=get_active_company()
|
||||||
company=get_model("company").browse(company_id)
|
company=get_model("company").browse(company_id)
|
||||||
|
|
|
@ -56,15 +56,15 @@ class ReportLaborCost(Model):
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def wizard_report_summany(self,ids,context={}):
|
def wizard_report_summary(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
return {
|
return {
|
||||||
"next": {
|
"next": {
|
||||||
"type": "report_odt2",
|
"type": "report_odt2",
|
||||||
"model": self._name,
|
"model": self._name,
|
||||||
"template": "report_wizard_labor_cost_summany",
|
"template": "report_wizard_labor_cost_summary",
|
||||||
"refer_id": obj.id,
|
"refer_id": obj.id,
|
||||||
"method": "get_report_wizard_summany",
|
"method": "get_report_wizard_summary",
|
||||||
"convert": "pdf",
|
"convert": "pdf",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class ReportLaborCost(Model):
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_report_wizard_summany(self,ids,context={}):
|
def get_report_wizard_summary(self,ids,context={}):
|
||||||
obj=[]
|
obj=[]
|
||||||
if ids:
|
if ids:
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
@ -100,13 +100,14 @@ class ReportLaborCost(Model):
|
||||||
lc_vals={
|
lc_vals={
|
||||||
'date': obj.date_form,
|
'date': obj.date_form,
|
||||||
'period_id': obj.period_id.id,
|
'period_id': obj.period_id.id,
|
||||||
'date_from': obj.date_form,
|
'date_from': obj.date_from,
|
||||||
'date_to': obj.date_to,
|
'date_to': obj.date_to,
|
||||||
'cycle_id': obj.cycle_id.id or None,
|
'cycle_id': obj.cycle_id.id or None,
|
||||||
'branch_id': obj.branch_id.id or None,
|
'branch_id': obj.branch_id.id or None,
|
||||||
'report_type': 'cross',
|
'report_type': 'cross',
|
||||||
'department_id': obj.department_id.id or None,
|
'department_id': obj.department_id.id or None,
|
||||||
}
|
}
|
||||||
|
print(lc_vals)
|
||||||
lc_id=get_model('clinic.report.labor.cost').create(lc_vals)
|
lc_id=get_model('clinic.report.labor.cost').create(lc_vals)
|
||||||
lc_data=get_model('clinic.report.labor.cost').get_report_data([lc_id])
|
lc_data=get_model('clinic.report.labor.cost').get_report_data([lc_id])
|
||||||
#data['lc_data'].append(lc_data) # END STEP 1
|
#data['lc_data'].append(lc_data) # END STEP 1
|
||||||
|
@ -120,6 +121,7 @@ class ReportLaborCost(Model):
|
||||||
}
|
}
|
||||||
pages1.append(data)
|
pages1.append(data)
|
||||||
t2=datetime.now()
|
t2=datetime.now()
|
||||||
|
#import pdb; pdb.set_trace()
|
||||||
print('step 1 : ',t2-t1)
|
print('step 1 : ',t2-t1)
|
||||||
|
|
||||||
#STEP 2
|
#STEP 2
|
||||||
|
|
|
@ -30,8 +30,8 @@ class Visit(Model):
|
||||||
res[obj.id]={
|
res[obj.id]={
|
||||||
'cycle_color': color,
|
'cycle_color': color,
|
||||||
'sequence': '%s-%s'%(obj.time_start[0:10],cycle.sequence), #date-sequence
|
'sequence': '%s-%s'%(obj.time_start[0:10],cycle.sequence), #date-sequence
|
||||||
'patient_name': patient_id.name,
|
'patient_name': patient.name,
|
||||||
'patient_type_id': patient_id.type_id.id,
|
'patient_type_id': patient.type_id.id,
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ class Visit(Model):
|
||||||
'note': fields.Text('Note'),
|
'note': fields.Text('Note'),
|
||||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||||
'manual': fields.Boolean("Manual Tempolary Visit"),
|
'manual': fields.Boolean("Manual Tempolary Visit"),
|
||||||
"patient_name": fields.Char("Patient Name", function="_get_all", store=True, search=True),
|
"patient_name": fields.Char("Patient Name", function="_get_all", function_multi=True, store=True, search=True),
|
||||||
"patient_type_id": fields.Char("Patient Type", function="_get_all", store=True, search=True),
|
"patient_type_id": fields.Char("Patient Type", function="_get_all", function_multi=True, store=True, search=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_number(self,context={}):
|
def _get_number(self,context={}):
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue