diff --git a/netforce_clinic/actions/clinic_report_hd_madical.xml b/netforce_clinic/actions/clinic_report_hd_medical.xml
similarity index 73%
rename from netforce_clinic/actions/clinic_report_hd_madical.xml
rename to netforce_clinic/actions/clinic_report_hd_medical.xml
index 4101bef..09b0345 100644
--- a/netforce_clinic/actions/clinic_report_hd_madical.xml
+++ b/netforce_clinic/actions/clinic_report_hd_medical.xml
@@ -1,8 +1,8 @@
                                                                                                          
     Medical Report Summary
     report                                                                        
-    clinic.report.hd.madical
-    report_hd_madical                                                      
-    report_hd_madical                                                         
+    clinic.report.hd.medical
+    report_hd_medical                                                      
+    report_hd_medical                                                         
     clinic_menu                                                                  
   
diff --git a/netforce_clinic/actions/clinic_report_hd_payment.xml b/netforce_clinic/actions/clinic_report_hd_payment.xml
new file mode 100644
index 0000000..54ad850
--- /dev/null
+++ b/netforce_clinic/actions/clinic_report_hd_payment.xml
@@ -0,0 +1,8 @@
+                                                                                                         
+    Payment Report Summary
+    report                                                                        
+    clinic.report.hd.payment
+    report_hd_payment                                                      
+    report_hd_payment                                                         
+    clinic_menu                                                                  
+  
diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml
index 2246fdd..70a49bd 100644
--- a/netforce_clinic/layouts/clinic_menu.xml
+++ b/netforce_clinic/layouts/clinic_menu.xml
@@ -29,8 +29,10 @@
         
         
-        
-
+        
+
+        
+
"
diff --git a/netforce_clinic/layouts/clinic_report_hd_detail.xml b/netforce_clinic/layouts/clinic_report_hd_detail.xml
index b07f88c..a16cb78 100644
--- a/netforce_clinic/layouts/clinic_report_hd_detail.xml
+++ b/netforce_clinic/layouts/clinic_report_hd_detail.xml
@@ -1,10 +1,12 @@
diff --git a/netforce_clinic/layouts/clinic_report_hd_madical.xml b/netforce_clinic/layouts/clinic_report_hd_medical.xml
similarity index 57%
rename from netforce_clinic/layouts/clinic_report_hd_madical.xml
rename to netforce_clinic/layouts/clinic_report_hd_medical.xml
index fcd40ac..e8244f7 100644
--- a/netforce_clinic/layouts/clinic_report_hd_madical.xml
+++ b/netforce_clinic/layouts/clinic_report_hd_medical.xml
@@ -1,3 +1,3 @@
-
diff --git a/netforce_clinic/layouts/clinic_report_hd_payment.xml b/netforce_clinic/layouts/clinic_report_hd_payment.xml
new file mode 100644
index 0000000..fb6e72e
--- /dev/null
+++ b/netforce_clinic/layouts/clinic_report_hd_payment.xml
@@ -0,0 +1,12 @@
+
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py
index b628548..e90dbd6 100644
--- a/netforce_clinic/models/__init__.py
+++ b/netforce_clinic/models/__init__.py
@@ -33,7 +33,7 @@ from . import gen_visit
 from . import gen_visit_line
 from . import report_hd_detail
 from . import report_hd_summary
-from . import report_hd_madical
+from . import report_hd_medical
 from . import input_data
 from . import fin_setting
 from . import import_data_mg
@@ -43,4 +43,5 @@ from . import translate
 from . import payment
 from . import account_payment
 from . import account_invoice
+from . import report_hd_payment
 from . import personal_categ
diff --git a/netforce_clinic/models/report_hd_detail.py b/netforce_clinic/models/report_hd_detail.py
index d218e18..08054e2 100644
--- a/netforce_clinic/models/report_hd_detail.py
+++ b/netforce_clinic/models/report_hd_detail.py
@@ -1,7 +1,7 @@
 import time
 
 from netforce.model import Model, fields, get_model
-#from netforce.access import get_active_company
+
 
 class ReportHDDetail(Model):
     _name="clinic.report.hd.detail"
@@ -15,6 +15,8 @@ class ReportHDDetail(Model):
         "date_from": fields.Date("From"),
         "date_to": fields.Date("To"),
         "cycle_id": fields.Many2One("clinic.cycle","Cycle"),
+        "type": fields.Selection([("mg","Medical Goverment"),("sc","Social Security"),("nhso","NHSO (30B)"),("personal","Personal"),("other","Other")],"Type"),
+    
     }
 
     _defaults={
@@ -38,20 +40,14 @@ class ReportHDDetail(Model):
 
         date_from=time.strftime("%Y-%m-%d")
         date_to=time.strftime("%Y-%m-%d")
-        # print('date_from ',date_from)
+
         defaults=context.get("defaults")
         if defaults:
             if defaults.get("date_from"):
                 date_from=defaults['date_from']           
             if defaults.get("date_to"):
                 date_to=defaults['date_to']
-        # date_to=context['date_to']
-        # default => key => dataults
-        # date_from=context['date_from']
-        # print(context['date_from'])
-        #'2014-10-13'
-        # print('date_from ',date_from)
-        # print('date_to ',date_to)
+        
         PATIENT_TYPE={
             "mg":"Medical Government",
             "sc":"Social Security",
@@ -84,7 +80,11 @@ class ReportHDDetail(Model):
                 dom.append([
                     'doctor_id','=',obj.doctor_id.id,
                 ])
-
+            if obj.type_id:
+                dom.append([
+                    'type','=',obj.type_id.name,
+                ])
+            
         dom.append(['time_start', ">=", date_from+" 00:00:00"])
         dom.append(['time_stop',"<=", date_to+" 23:59:59"])        
         lines=[]
@@ -92,10 +92,13 @@ class ReportHDDetail(Model):
         index=0
         no_patient=0
         for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"):
+            
+            for total in get_model("clinic.hd.case.line").search_browse([]):
+                total_fee=total.price or ""
+            
+            dialyzer_number=hd_case.dlz_id.id or ""    
             patient_type=hd_case.patient_id.type
             patient_type=PATIENT_TYPE.get(patient_type)
-            #dialyzer_name=hd_case.dialyzers.id
-            #dialyzer_name=DIALYZER_NAME.get(dialyzer_name)
             cycle_name=hd_case.cycle_id.name or ""
             show_cycle=False
             if not cycle_name in cycles:
@@ -122,14 +125,18 @@ class ReportHDDetail(Model):
             vals={
                 'show_cycle': show_cycle,
                 'cycle' : cycle_name,
-                'patient': hd_case.patient_id.name,
+                'patient_id': hd_case.patient_id.id,
+                'patient_name': hd_case.patient_id.name,
                 'patient_type' : patient_type,
                 'no_patient': 0,
-                'doctor' : hd_case.doctor_id.name,
-                'total' : hd_case.total,
+                'doctor_id': hd_case.doctor_id.id,
+                'doctor_name' : hd_case.doctor_id.name,
+                'total' : total_fee,
+                'hd_case_id' : hd_case.id,
                 'rc_no' : hd_case.number,
-                'dialyzer_name' : 'DZ-xxx',
-                'nurse' : hd_case.nurse_id.name,
+                'dialyzer_number' : dialyzer_number,
+                'nurse_id': hd_case.nurse_id.id,
+                'nurse_name' : hd_case.nurse_id.name,
             }
             lines.append(vals)
 
diff --git a/netforce_clinic/models/report_hd_madical.py b/netforce_clinic/models/report_hd_madical.py
deleted file mode 100644
index c2de473..0000000
--- a/netforce_clinic/models/report_hd_madical.py
+++ /dev/null
@@ -1,158 +0,0 @@
-import time
-
-from datetime import datetime
-from calendar import monthrange
-from netforce.model import Model,fields,get_model
-
-class ReportHDMadical(Model):
-    _name="clinic.report.hd.madical"
-    _string="Hemodialysis Report Madical Summary"
-    _transient=True
-    
-    _fields={
-        "date": fields.Date("Month", required=True),
-    }
-
-    _defaults={
-        'date': lambda *a: time.strftime("%Y-%m-%d"),
-    }
-    
-    def get_report_data(self,ids,context={}):
-        
-        for item in get_model("company").search_browse([]):
-            company_name=item.name
-
-        date=datetime.now().strftime("%Y-%m-%d")
-        #datemonth=datetime.now().strftime("%m")
-        if ids:
-            obj=self.browse(ids)[0]
-            date=obj.date
-        year=int(date[0:4])
-        month=int(date[5:7])
-        month_str=datetime.strptime(date,'%Y-%m-%d').strftime("%B")
-        
-        next_month = str(month + 1)
-        if next_month == 13:
-            next_month = 12
-        #next_month_str=datetime.strptime(next_month,'%m').strftime("%B")
-        previous_month = str(month - 1)
-        if previous_month == 0:
-            previous_month = 12
-        #previous_month_str=datetime.strptime(previous_month,'%m').strftime("%B")
-        
-        #madical=get_model("clinic.hd.case.gm.line").search_browse()
-        #patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
-        
-        weekday, total_day=monthrange(year, month)
-        time_start='2014-%s-01 00:00:00'%(month)
-        time_stop='2014-%s-%s 23:59:59'%(month,total_day)
-        
-        dom=[]
-        dom.append(['state','=','completed'])
-        dom.append(['time_start','>=',time_start])
-        dom.append(['time_stop','<=',time_stop])
-        #hd_cases=get_model("clinic.hd.case.gm.line").search_browse(dom)
-        
-        lines=[
-            {
-                'madical' : 'H4',
-                'sc': '437',
-                'uc': '',
-                'buy' : '4',
-                'total' : '441',
-            },
-            {
-                'madical' : 'H2',
-                'sc': '',
-                'uc': '',
-                'buy' : '',
-                'total' : '',
-            },
-            {
-                'madical' : 'Epr4',
-                'sc': '216',
-                'uc': '',
-                'buy' : '',
-                'total' : '216',
-            },
-            {
-                'madical' : 'Epr2',
-                'sc': '',
-                'uc': '',
-                'buy' : '',
-                'total' : '',
-            },
-            {
-                'madical' : 'Epk4',
-                'sc': '70',
-                'uc': '',
-                'buy' : '',
-                'total' : '70',
-            },
-            {
-                'madical' : 'Epk2',
-                'sc': '',
-                'uc': '',
-                'buy' : '',
-                'total' : '',
-            },
-            {
-                'madical' : 'Epg4',
-                'sc': '98',
-                'uc': '',
-                'buy' : '',
-                'total' : '98',
-            },
-            {
-                'madical' : 'Epg2',
-                'sc': '',
-                'uc': '',
-                'buy' : '',
-                'total' : '',
-            },
-            {
-                'madical' : 'Rng4',
-                'sc': '34',
-                'uc': '',
-                'buy' : '9',
-                'total' : '43',
-            },
-            {
-                'madical' : 'Rng2',
-                'sc': '',
-                'uc': '',
-                'buy' : '',
-                'total' : '',
-            },
-            {
-                'madical' : 'Epi4',
-                'sc': '264',
-                'uc': '',
-                'buy' : '9',
-                'total' : '43',
-            },
-            {
-                'madical' : 'Epi2',
-                'sc': '',
-                'uc': '',
-                'buy' : '',
-                'total' : '',
-            },
-            {
-                'madical' : 'Vnf',
-                'sc': '',
-                'uc': '',
-                'buy' : '',
-                'total' : '',
-            },
-        ]
-
-        data={
-            'month': month_str,
-            'year': year,
-            'lines': lines,
-            'company_name': company_name,
-        }
-        return data
-
-ReportHDMadical.register()
diff --git a/netforce_clinic/models/report_hd_medical.py b/netforce_clinic/models/report_hd_medical.py
new file mode 100644
index 0000000..777e820
--- /dev/null
+++ b/netforce_clinic/models/report_hd_medical.py
@@ -0,0 +1,77 @@
+import time
+
+from datetime import datetime
+from calendar import monthrange
+from netforce.model import Model,fields,get_model
+
+class ReportHDMedical(Model):
+    _name="clinic.report.hd.medical"
+    _string="Hemodialysis Report Medical Summary"
+    _transient=True
+    
+    _fields={
+        "date": fields.Date("Month", required=True),
+    }
+
+    _defaults={
+        'date': lambda *a: time.strftime("%Y-%m-%d"),
+    }
+    
+    def get_report_data(self,ids,context={}):
+        
+        for item in get_model("company").search_browse([]):
+            company_name=item.name
+
+        date=datetime.now().strftime("%Y-%m-%d")
+        #datemonth=datetime.now().strftime("%m")
+        if ids:
+            obj=self.browse(ids)[0]
+            date=obj.date
+        year=int(date[0:4])
+        month=int(date[5:7])
+        month_str=datetime.strptime(date,'%Y-%m-%d').strftime("%B")
+        
+        #dom=[]
+        #dom.append(['fee_type','=','mg'])
+
+        weekday, total_day=monthrange(year, month)
+        time_start='2014-%s-01 00:00:00'%(month)
+        time_stop='2014-%s-%s 23:59:59'%(month,total_day)
+        
+        dom=[]
+        dom.append(['state','=','completed'])
+        dom.append(['time_start','>=',time_start])
+        dom.append(['time_stop','<=',time_stop])
+        
+        lines=[]
+        index=0
+        for product in get_model("product").search_browse(['type','=','stock']):
+            product_id=product.id or ""
+            product_code=product.code or ""
+            product_name=product.name or ""
+            product_amount=len(str(product_code))
+            #total=len(str(product_amount))
+            
+            index+=1
+            vals={
+                'product_code' : product_code,
+                'medical' : product_name,
+                'mg' : '-',
+                'uc' : '-',
+                'sc' : '-',
+                'buy' : '-',
+                'amount' : product_amount,
+                'product_id': product_id,
+            }
+            lines.append(vals)
+            
+            
+        data={
+            'month': month_str,
+            'year': year,
+            'lines': lines,
+            'company_name': company_name,
+        }
+        return data
+
+ReportHDMedical.register()
diff --git a/netforce_clinic/models/report_hd_payment.py b/netforce_clinic/models/report_hd_payment.py
new file mode 100644
index 0000000..f8969f2
--- /dev/null
+++ b/netforce_clinic/models/report_hd_payment.py
@@ -0,0 +1,174 @@
+import time
+
+from netforce.model import Model, fields, get_model
+
+
+class ReportHDPayment(Model):
+    _name="clinic.report.hd.payment"
+    _string="Hemodialysis Report Payment"
+    _transient=True
+    
+    _fields={
+        "patient_id" : fields.Many2One("clinic.patient","Patient"),
+        "doctor_id" : fields.Many2One("clinic.doctor","Doctor"),
+        "nurse_id" : fields.Many2One("clinic.nurse","Nurse"),
+        "date_from": fields.Date("From"),
+        "date_to": fields.Date("To"),
+        "cycle_id": fields.Many2One("clinic.cycle","Cycle"),
+        "type": fields.Selection([("mg","Medical Goverment"),("sc","Social Security"),("nhso","NHSO (30B)"),("personal","Personal"),("other","Other")],"Type"),
+    
+    }
+
+    _defaults={
+        'date_from': lambda *a: time.strftime("%Y-%m-%d"),
+        'date_to': lambda *a: time.strftime("%Y-%m-%d"),
+    }
+
+    _order="cycle_id desc"
+    
+    
+    def get_report_data(self,ids,context={}):
+        
+        # company_id=get_active_company
+        # comp=get_model("company").browse(company_id)
+        # context=> dict
+        # inside context => keys => defaults => type => dict
+        # dict => key: value => '', 1, [], {}
+        # context['default'] => defaults(dict) => key => inside key => value => '2014-10-22'
+        for item in get_model("company").search_browse([]):
+            company_name=item.name
+
+        date_from=time.strftime("%Y-%m-%d")
+        date_to=time.strftime("%Y-%m-%d")
+
+        defaults=context.get("defaults")
+        if defaults:
+            if defaults.get("date_from"):
+                date_from=defaults['date_from']           
+            if defaults.get("date_to"):
+                date_to=defaults['date_to']
+        
+        PATIENT_TYPE={
+            "mg":"Medical Government",
+            "sc":"Social Security",
+            "nhso":"NHSO (30฿)",
+            "personal": "Personal",
+            "others": "Others",
+        }
+        
+        dom=[]
+        dom.append(['state','=','completed'])
+        if ids:
+            obj=self.browse(ids)[0]
+            if obj.date_from:
+                date_from=obj.date_from
+            if obj.date_to:
+                date_to=obj.date_to
+            if obj.cycle_id:
+                dom.append([
+                    'cycle_id','=',obj.cycle_id.id,
+                ])
+            if obj.patient_id:
+                dom.append([
+                    'patient_id','=',obj.patient_id.id,
+                ])
+            if obj.nurse_id:
+                dom.append([
+                    'nurse_id','=',obj.nurse_id.id,
+                ])
+            if obj.doctor_id:
+                dom.append([
+                    'doctor_id','=',obj.doctor_id.id,
+                ])
+            if obj.type_id:
+                dom.append([
+                    'type','=',obj.type_id.id,
+                ])
+            
+        dom.append(['time_start', ">=", date_from+" 00:00:00"])
+        dom.append(['time_stop',"<=", date_to+" 23:59:59"])        
+        lines=[]
+        cycles=[]
+        index=0
+        no_patient=0
+        for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"):
+            #print('='*50)
+            #for line in hd_case.line:
+            #    dialyzer_id=line.dialyzer_id
+            #    if dialyzer_id:
+            #        dialyzer_number=line.number or ""
+            #        print(dialyzer_number)
+
+            #print('='*50)
+            patient_type=hd_case.patient_id.type
+            patient_type=PATIENT_TYPE.get(patient_type)
+            #dialyzer=get_model("clinic.dialyzer").search_browse([])
+            cycle_name=hd_case.cycle_id.name or ""
+            show_cycle=False
+            if not cycle_name in cycles:
+                cycles.append(cycle_name)
+                show_cycle=True
+                vals={
+                    'color': 'success',
+                    'show_cycle': False,
+                    'cycle' : "",
+                    'patient': "",
+                    'no_patient': no_patient,
+                    'patient_type' : "",
+                    'doctor' : "",
+                    'total' : "",
+                    'rc_no' : "",
+                    'dialyzer_name' : "",
+                    'nurse' : "",
+                }
+                lines.append(vals)
+                no_patient=1
+            else:
+                no_patient+=1
+            index+=1
+            vals={
+                'show_cycle': show_cycle,
+                'cycle' : cycle_name,
+                'patient_id': hd_case.patient_id.id,
+                'patient_name': hd_case.patient_id.name,
+                'patient_type' : patient_type,
+                'no_patient': 0,
+                'doctor_id': hd_case.doctor_id.id,
+                'doctor_name' : hd_case.doctor_id.name,
+                'total' : hd_case.total,
+                'hd_case_id' : hd_case.id,
+                'rc_no' : hd_case.number,
+                'dialyzer_number' : 'DZ-XXXX',
+                'nurse_id': hd_case.nurse_id.id,
+                'nurse_name' : hd_case.nurse_id.name,
+            }
+            lines.append(vals)
+
+        # XXX
+        if lines:
+            vals={
+                'color': 'success',
+                'show_cycle': False,
+                'cycle' : "",
+                'patient': "",
+                'no_patient': no_patient,
+                'patient_type' : "",
+                'doctor' : "",
+                'total' : "",
+                'rc_no' : "",
+                'dialyzer_name' : "",
+                'nurse' : "",
+            }
+            lines.append(vals)
+            #XXX
+            del lines[0] 
+        data={
+            'lines': lines,
+            'same_date': date_from==date_to,
+            'date_from': date_from,
+            'date_to': date_to,
+            'company_name': company_name,
+        }
+        return data
+
+ReportHDPayment.register()
diff --git a/netforce_clinic/models/report_hd_summary.py b/netforce_clinic/models/report_hd_summary.py
index bcbf3d0..64b357e 100644
--- a/netforce_clinic/models/report_hd_summary.py
+++ b/netforce_clinic/models/report_hd_summary.py
@@ -19,9 +19,6 @@ class ReportHDSummary(Model):
     }
     
     def get_report_data(self,ids,context={}):
-        # company_id=get_active_company
-        # company_name=get_model("company").search("name")
-        # company_name=get_model("company").search_browse()
         for item in get_model("company").search_browse([]):
             company_name=item.name
 
@@ -51,11 +48,6 @@ class ReportHDSummary(Model):
         time_start='2014-%s-01'%(month) # 2014-10-20
         time_stop='2014-%s-%s'%(month,total_day)
 
-        dom=[]
-        dom.append(['time_start','>=',time_start])
-        dom.append(['time_stop','<=',time_stop])  
-        
-        
         dom=[]
         dom.append(['type','=','mg'])  
         patients_mg=len(get_model("clinic.patient").search(dom))
@@ -67,14 +59,15 @@ class ReportHDSummary(Model):
         patients_nhso=len(get_model("clinic.patient").search(dom))
         dom.append(['type','=','pn'])
         patients_pn=len(get_model("clinic.patient").search(dom))
-        
+        #New Patients
+        #dom.append(['type','=','All'])
         patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
-        #new_patients=len(patients)
-    
+        
         dom=[]
         dom.append(['state','=','completed'])
         dom.append(['time_start','>=',time_start])
         dom.append(['time_stop','<=',time_stop])
+
         cur_total_case=len(get_model("clinic.hd.case").search(dom))
 
         weekday, prev_total_day=monthrange(year, previous_month)
diff --git a/netforce_clinic/reports/report_hd_detail.xlsx b/netforce_clinic/reports/report_hd_detail.xlsx
index f8cb902..1e67ae7 100644
Binary files a/netforce_clinic/reports/report_hd_detail.xlsx and b/netforce_clinic/reports/report_hd_detail.xlsx differ
diff --git a/netforce_clinic/reports/report_hd_medical.xlsx b/netforce_clinic/reports/report_hd_medical.xlsx
new file mode 100644
index 0000000..7e3b942
Binary files /dev/null and b/netforce_clinic/reports/report_hd_medical.xlsx differ
diff --git a/netforce_clinic/reports/report_hd_madical.xlsx b/netforce_clinic/reports/report_hd_payment.xlsx
similarity index 100%
rename from netforce_clinic/reports/report_hd_madical.xlsx
rename to netforce_clinic/reports/report_hd_payment.xlsx
diff --git a/netforce_clinic/templates/report_hd_detail.hbs b/netforce_clinic/templates/report_hd_detail.hbs
index 19b18ad..5985b4b 100644
--- a/netforce_clinic/templates/report_hd_detail.hbs
+++ b/netforce_clinic/templates/report_hd_detail.hbs
@@ -9,7 +9,7 @@
     {{/if}}
     
 
-