improve report pdf

conv_bal
watcha.h@almacom.co.th 2015-06-17 22:27:15 +07:00
parent 2c3f578cc6
commit 776859f7bf
5 changed files with 19 additions and 16 deletions

View File

@ -24,9 +24,10 @@ class ReportCycleItem(Model):
def default_get(self,field_names=None,context={},**kw): def default_get(self,field_names=None,context={},**kw):
defaults=context.get("defaults",{}) defaults=context.get("defaults",{})
date=defaults.get('date',time.strftime("%Y-%m-%d")) date=defaults.get('date',time.strftime("%Y-%m-%d"))
year,month=time.strftime("%Y-%m").split("-") #year,month=time.strftime("%Y-%m").split("-")
date_from=defaults.get('date_from','%s-%s-01'%(year,month)) datenow=time.strftime("%Y-%m-%d")
date_to=defaults.get('date_to','%s-%s-01'%(year,month)) date_from=defaults.get('date_from',datenow)
date_to=defaults.get('date_to',datenow)
branch_id=defaults.get('branch_id') branch_id=defaults.get('branch_id')
if branch_id: if branch_id:
branch_id=int(branch_id) branch_id=int(branch_id)
@ -63,6 +64,7 @@ class ReportCycleItem(Model):
branch_id=defaults.get("branch_id") branch_id=defaults.get("branch_id")
department_id=defaults.get("department_id") department_id=defaults.get("department_id")
ptype_id=defaults.get("ptype_id") ptype_id=defaults.get("ptype_id")
print('date_from ', date_from)
month=date_from.split("-")[1] month=date_from.split("-")[1]
cycle_id=None cycle_id=None
if ids: if ids:
@ -122,9 +124,14 @@ class ReportCycleItem(Model):
dpt=hdcase.department_id dpt=hdcase.department_id
dlz_use=hdcase.dlz_use or 0 dlz_use=hdcase.dlz_use or 0
dlz_drop=False dlz_drop=False
if dlz_use==hdcase.dlz_max: #if dlz_use==hdcase.dlz_max:
dlz_use="%sทิ้ง"%dlz_use #dlz_use="%sทิ้ง"%dlz_use
dlz_drop=True #dlz_drop=True
for dlz_line in hdcase.dialyzers:
dlz=dlz_line.dialyzer_id
if dlz.state in ('drop','expire'):
dlz_use="%sทิ้ง"%dlz_use
dlz_drop=True
cancel=False cancel=False
row_color='' row_color=''
if hdcase.state not in ('paid', 'waiting_payment'): if hdcase.state not in ('paid', 'waiting_payment'):
@ -146,7 +153,7 @@ class ReportCycleItem(Model):
'date': hdcase.date, 'date': hdcase.date,
'epo': hdcase.epo, 'epo': hdcase.epo,
'mdc': hdcase.mdc, 'mdc': hdcase.mdc,
'mdc_name': hdcase.mdc_name, 'mdc_name': hdcase.mdc_name or hdcase.epo,
'fee': abs(hdcase.fee), 'fee': abs(hdcase.fee),
'dlz_name': hdcase.dlz_name, 'dlz_name': hdcase.dlz_name,
'dlz_use': dlz_use, 'dlz_use': dlz_use,

View File

@ -4,7 +4,7 @@ import urllib.parse as urllib
from datetime import datetime from datetime import datetime
from calendar import monthrange from calendar import monthrange
from netforce.model import Model, fields, get_model from netforce.model import Model, fields, get_model
from netforce.access import get_active_company from netforce.access import get_active_company, get_active_user
from . import utils from . import utils
@ -271,7 +271,10 @@ class ReportHDCaseSummary(Model):
plines=medicals['plines'] plines=medicals['plines']
prod_titles=medicals['prod_titles'] prod_titles=medicals['prod_titles']
date_print=time.strftime("%m/%d/%Y %H:%M:%S") date_print=time.strftime("%m/%d/%Y %H:%M:%S")
user_id=get_active_user()
user=get_model('base.user').browse(user_id)
data={ data={
'user_name': user.name,
'hdcase_type': hdcase_type, 'hdcase_type': hdcase_type,
'branch_id': branch_id, 'branch_id': branch_id,
'department_id': department_id, 'department_id': department_id,

View File

@ -1,7 +1,7 @@
<center> <center>
<h3>{{company_name}}</h3> <h3>{{company_name}}</h3>
<h4> <h4>
ะหว่างวันที่ {{date_from}} ถึง {{date_to}} ายชื่อผู้ป่วยระหว่างวันที่ {{date_from}} ถึง {{date_to}}
</h4> </h4>
</center> </center>
<table class="table table-condensed table-striped" style="margin-bottom:0px;"> <table class="table table-condensed table-striped" style="margin-bottom:0px;">
@ -12,14 +12,10 @@
<th>ชื่อ-สกุล</th> <th>ชื่อ-สกุล</th>
<th>แพทย์</th> <th>แพทย์</th>
<th>สิทธ์</th> <th>สิทธ์</th>
<!--
<th style="text-align:right">จ.น.เงิน</th>
-->
<th style="text-align:left">ยาฉีด</th> <th style="text-align:left">ยาฉีด</th>
<th>DZ</th> <th>DZ</th>
<th>N/U</th> <th>N/U</th>
<th>พยาบาล</th> <th>พยาบาล</th>
<!--<th>หมายเหตุ</th>-->
</thead> </thead>
<tbody> <tbody>
{{#each lines }} {{#each lines }}
@ -53,9 +49,6 @@
<td><a href="/ui#name=clinic_patient&active_id={{pid}}&mode=form">{{pname}}</a></td> <td><a href="/ui#name=clinic_patient&active_id={{pid}}&mode=form">{{pname}}</a></td>
<td><a href="/ui#name=clinic_staff&active_id={{did}}&mode=form">{{dname}}</a></td> <td><a href="/ui#name=clinic_staff&active_id={{did}}&mode=form">{{dname}}</a></td>
<td><a href="/ui#name=clinic_patient_type&active_id={{tid}}&mode=form">{{tname}}</a></td> <td><a href="/ui#name=clinic_patient_type&active_id={{tid}}&mode=form">{{tname}}</a></td>
<!--
<td style="text-align:right">{{currency fee zero=""}}</td>
-->
<td style="text-align:left">{{mdc_name}}</td> <td style="text-align:left">{{mdc_name}}</td>
<td><a href="/ui#name=clinic_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_name}}</a></td> <td><a href="/ui#name=clinic_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_name}}</a></td>
<td>{{dlz_use}}</td> <td>{{dlz_use}}</td>