input->post('txtsearch');
$sdata = preg_replace('/[^A-Za-z0-9]/', '', $sdata);
$sql = "select c.id,c.p_id,c.case_id_code,sum(o.opd_fee_amount) as OPD_Amount,sum(i.net_amount) as Invoice_Amount,
c.insurance_company_name,c.p_name,p.p_code,c.date_registration,insurance_card_name,
(case c.status when 0 then 'Pending'
when 1 then 'Ready for submission'
when 2 then 'Submitted'
when 3 then 'Payment Done'
else 'Other' end) as str_status,
Date_Format(c.date_registration,'%d-%m-%Y') as date_registration_in
from (organization_case_master c join patient_master p on c.p_id=p.id )
left join opd_master o on c.id=o.insurance_case_id
left join invoice_master i on c.id=i.insurance_case_id
group by c.id ";
if($sdata!='')
{
$sql.=" WHERE case_id_code = '".$sdata."' or p_name like '%".$sdata."%' or
p_code = '".$sdata." order by c.id desc limit 20";
}else
{
$sql.=" order by c.id desc limit 20";
}
$query = $this->db->query($sql);
$data['searchdata']= $query->result();
$this->load->view('Invoice/Case_List',$data);
}
public function search_all()
{
$this->load->view('Invoice/case_list_all');
}
public function case_invoice($casecode,$print=0,$caseid=0,$med_include=1)
{
if($caseid<1)
{
$sql="select * from organization_case_master where case_id_code='".$casecode."'";
}else{
$sql="select * from organization_case_master where id='".$caseid."'";
}
$query = $this->db->query($sql);
$data['orgcase']= $query->result();
$pno=$data['orgcase'][0]->p_id;
$caseid=$data['orgcase'][0]->id;
$this->db->query("CALL p_org_update(".$caseid.")");
$sql="select *,if(gender=1,'Male','Female') as xgender,
GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
$query = $this->db->query($sql);
$data['person_info']= $query->result();
$ins_comp_id=$data['orgcase'][0]->insurance_id;
$inc_card_id=$data['orgcase'][0]->insurance_card_id;
$sql="select * from hc_insurance_card where id=".$inc_card_id;
$query = $this->db->query($sql);
$data['hc_insurance_card']= $query->result();
$sql="select * from hc_insurance where id=".$ins_comp_id;
$query = $this->db->query($sql);
$data['insurance']= $query->result();
//$sql="select * from v_case_invoice v
// where v.id=".$caseid." order by Charge_type,Adate ";
//$query = $this->db->query($sql);
//$data['showinvoice']= $query->result();
$sql="select * from v_case_invoice_1 v
where v.id=".$caseid." order by Charge_type,Adate ";
$query = $this->db->query($sql);
$data['showinvoice1']= $query->result();
$sql="select * from v_case_invoice_2 v
where v.id=".$caseid." order by Charge_type,Adate ";
$query = $this->db->query($sql);
$data['showinvoice2']= $query->result();
//$sql="select sum(amount) as GTotal from v_case_invoice v
// where v.id=".$caseid." ";
//$query = $this->db->query($sql);
//$data['invoiceGtotal']= $query->result();
$sql="select m.*,m.id as med_id
from invoice_med_master m join ipd_master p join organization_case_master o
on m.ipd_id=p.id and p.case_id=o.id and m.ipd_credit=1 and m.ipd_credit_type=1
where o.id=".$caseid." ";
$query = $this->db->query($sql);
$data['MedInvoice_data']= $query->result();
$sql="select sum(m.net_amount) as Med_Amount,o.id ,count(m.id) as no_inv
from invoice_med_master m join ipd_master p join organization_case_master o
on m.ipd_id=p.id and p.case_id=o.id and m.ipd_credit=1 and m.ipd_credit_type=1
where o.id=".$caseid." group by o.id ";
$query = $this->db->query($sql);
$data['MedInvoice']= $query->result();
if(count($data['MedInvoice'])==0)
{
$sql="select m.* ,m.id as med_id
from invoice_med_master m join organization_case_master o
on m.case_id=o.id and m.case_credit=1
where o.id=".$caseid." ";
$query = $this->db->query($sql);
$data['MedInvoice_data']= $query->result();
$sql="select sum(m.net_amount) as Med_Amount,o.id ,count(m.id) as no_inv
from invoice_med_master m join organization_case_master o
on m.case_id=o.id and m.case_credit=1
where o.id=".$caseid." group by o.id ";
$query = $this->db->query($sql);
$data['MedInvoice']= $query->result();
}
$data['med_include']=$med_include;
$sql="select p.* ,date_format(payment_date,'%d-%m-%Y') as str_date,
if(credit_debit=0,if(payment_mode=1,'CASH','BANK'),if(payment_mode=1,'CASH RETURN','BANK RETURN')) as Pay_mode
from payment_history p
where p.payof_type=3 and p.payof_id=$caseid";
$query = $this->db->query($sql);
$data['payment_history']= $query->result();
if($print>0)
{
$this->load->library('m_pdf');
$file_name='Org_Invoice_-'.$casecode.'-'.date('Ymdhis').".pdf";
$filepath=$file_name;
$this->m_pdf->curlAllowUnsafeSslRequests = true;
$this->m_pdf->useSubstitutions = false;
$print_content=$this->load->view('Invoice/caseinvoice_print_V',$data,TRUE);
//echo $print_content;
$this->m_pdf->pdf->WriteHTML($print_content);
//download it.
$this->m_pdf->pdf->Output($filepath,"I");
}else{
$this->load->view('Invoice/caseinvoice_V',$data);
}
}
public function case_invoice_ipd($caseid)
{
$sql="select * from organization_case_master where id='".$caseid."'";
$query = $this->db->query($sql);
$data['orgcase']= $query->result();
$pno=$data['orgcase'][0]->p_id;
$caseid=$data['orgcase'][0]->id;
$this->db->query("CALL p_org_update(".$caseid.")");
$sql="select *,if(gender=1,'Male','Female') as xgender,
GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
$query = $this->db->query($sql);
$data['person_info']= $query->result();
$ins_comp_id=$data['orgcase'][0]->insurance_id;
$inc_card_id=$data['orgcase'][0]->insurance_card_id;
$sql="select * from hc_insurance_card where id=".$inc_card_id;
$query = $this->db->query($sql);
$data['hc_insurance_card']= $query->result();
$sql="select * from hc_insurance where id=".$ins_comp_id;
$query = $this->db->query($sql);
$data['insurance']= $query->result();
//$sql="select * from v_case_invoice v
// where v.id=".$caseid." order by Charge_type,Adate ";
//$query = $this->db->query($sql);
//$data['showinvoice']= $query->result();
$sql="select * from v_case_invoice_1 v
where v.id=".$caseid." order by Charge_type,Adate ";
$query = $this->db->query($sql);
$data['showinvoice1']= $query->result();
$sql="select * from v_case_invoice_2 v
where v.id=".$caseid." order by Charge_type,Adate ";
$query = $this->db->query($sql);
$data['showinvoice2']= $query->result();
$this->load->view('Invoice/caseinvoice_ipd_V',$data);
}
public function ORG_info(){
$org_no = $this->input->post('input_org_no');
$sql="select * from organization_case_master
where case_type=0 and case_id_code='$org_no' ";
$query = $this->db->query($sql);
$data_org= $query->result();
if(count($data_org)>0)
{
$UHID=$data_org[0]->p_id;
$sql="select * from patient_master_exten where id='$UHID' ";
$query = $this->db->query($sql);
$data_person= $query->result();
$Patient_id=$data_person[0]->id;
$Patient_info=$data_person[0]->p_code.'/'.$data_person[0]->p_fname.' '.$data_person[0]->p_relative.' '.$data_person[0]->p_rname.' /Age :'.$data_person[0]->str_age;
$org_info=$Patient_info.'/'.$data_org[0]->insurance_company_name.
'/Reg.:'.$data_org[0]->insurance_no_1.'/Reg.Dt:'.$data_org[0]->date_registration;
$org_id=$data_org[0]->id;
}else{
$org_id=0;
$org_info='';
}
$rvar=array(
'org_id' =>$org_id,
'org_info'=>$org_info
);
$encode_data = json_encode($rvar);
echo $encode_data;
}
public function update_itemrateqty()
{
$item_type_id=$this->input->post('item_type_id');
$item_id=$this->input->post('item_id');
$rate=$this->input->post('rate');
$orgcode=$this->input->post('orgcode');
$insurance_id=$this->input->post('insurance_id');
$master_item_id=$this->input->post('master_item_id');
$sql="select * from invoice_item
where id=".$item_id." ";
$query = $this->db->query($sql);
$invoice_item= $query->result();
$qty=0;
if(count($invoice_item)>0)
{
$qty=$invoice_item[0]->item_qty;
}
$this->load->model('invoice_M');
$amount_value=$qty * $rate;
$data['update_invoice_item'] = array(
'item_qty' => $qty,
'item_rate' => $rate,
'item_amount' => $amount_value,
'org_code' => $orgcode
);
$inser_id=$this->invoice_M->update_item( $data['update_invoice_item'],$item_id);
$this->load->model('item_M');
$data['update_insurance_item'] = array(
'hc_items_id' => $master_item_id,
'hc_insurance_id' => $insurance_id,
'amount1' => $amount_value,
'code' => $orgcode
);
/*
$sql="select * from hc_items_insurance where hc_items_id=".$master_item_id." and hc_insurance_id=".$insurance_id;
$query = $this->db->query($sql);
$chkitem= $query->result();
if($insurance_id>2)
{
if(count($chkitem)>0 )
{
$insDone=$this->item_M->update_in_item( $data['update_insurance_item'],$chkitem[0]->id);
}else{
$insDone=$this->item_M->insert_in_item( $data['update_insurance_item']);
}
}
*/
$sql="select * from invoice_item where id=".$item_id;
$query = $this->db->query($sql);
$data['invoiceitem']= $query->result();
$invoice_id=0;
if(count($data['invoiceitem'])>0)
{
$invoice_id=$data['invoiceitem'][0]->inv_master_id;
}
$sql="select i.*,t.group_desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
$query = $this->db->query($sql);
$data['invoiceDetails']= $query->result();
$sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
$query = $this->db->query($sql);
$data['invoiceGtotal']= $query->result();
$sql="select *,(case payment_mode when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'IPD Credit' when 4 then 'Org. Credit' else 'Pending' end) as Payment_type_str from invoice_master where id=".$invoice_id;
$query = $this->db->query($sql);
$data['invoice_master']= $query->result();
$discount_amount=$data['invoice_master'][0]->discount_amount ;
$correction_amount=$data['invoice_master'][0]->correction_amount ;
$total_amount=$data['invoiceGtotal'][0]->Gtotal;
$net_amount=$total_amount-$discount_amount;
$net_amount=$net_amount-$correction_amount;
$balance_amount=$net_amount;
$dataupdate = array(
'total_amount' => $total_amount,
'net_amount' => $net_amount
);
$this->load->model('Invoice_M');
$this->Invoice_M->update($dataupdate,$invoice_id);
}
public function update_status()
{
if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
$this->load->model('Ocasemaster_M');
$case_id=$this->input->post('caseid');
$user = $this->ion_auth->user()->row();
$user_id = $user->id;
$user_name = $user->first_name.''. $user->last_name;
$sql="select * from organization_case_master where id='".$case_id."'";
$query = $this->db->query($sql);
$case_master= $query->result();
$log=$case_master[0]->log.'\nUpdate Status:'.$this->input->post('status').'-Upd By:'.$user_name.'['.$user_id.']'.date('d/m/Y H:m:s');
$status=$this->input->post('status');
$org_submit_date= str_to_MysqlDate($this->input->post('org_submit_date'));
$data = array(
'status'=> $status,
'log'=>$log,
);
if($status==1)
{
$data['org_submit_date']=$org_submit_date;
}
$this->Ocasemaster_M->update( $data,$case_id);
}
public function org_contingent_update()
{
if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
$user = $this->ion_auth->user()->row();
$user_id = $user->id;
$user_name = $user->first_name.''. $user->last_name;
$htmldata=$this->input->post('HTMLData');
$case_id=$this->input->post('case_id');
$this->load->model('Ocasemaster_M');
$data['master'] = array(
'contingent_bill' => $htmldata,
'contingent_update_by' => $user_name
);
$case_id=$this->input->post('case_id');
$this->Ocasemaster_M->update($data['master'],$case_id);
$rvar=array(
'update' =>'1',
'msg' => 'Update Done '.$case_id
);
$encode_data = json_encode($rvar);
echo $encode_data;
}
public function case_invoice_print($caseid)
{
$sql="select * from organization_case_master where id=".$caseid;
$query = $this->db->query($sql);
$data['orgcase']= $query->result();
$pno=$data['orgcase'][0]->p_id;
$sql="select *,if(gender=1,'Male','Female') as xgender,
GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
$query = $this->db->query($sql);
$data['person_info']= $query->result();
$ins_comp_id=$data['orgcase'][0]->insurance_id;
$inc_card_id=$data['orgcase'][0]->insurance_card_id;
$sql="select * from hc_insurance_card where id=".$inc_card_id;
$query = $this->db->query($sql);
$data['hc_insurance_card']= $query->result();
$sql="select * from hc_insurance where id=".$ins_comp_id;
$query = $this->db->query($sql);
$data['insurance']= $query->result();
$sql="select * from v_case_invoice v
where v.id=".$caseid." order by s_Date ";
$query = $this->db->query($sql);
$data['showinvoice']= $query->result();
$sql="select sum(amount) as GTotal from v_case_invoice v
where v.id=".$caseid." ";
$query = $this->db->query($sql);
$data['invoiceGtotal']= $query->result();
$this->load->view('Invoice/caseinvoice_V',$data);
}
public function getCaseTable()
{
$requestData= $_REQUEST;
$columns = array(
// datatable column index => database column name
0 =>'case_id_code',
1 => 'Reg_No',
2 => 'p_f_info',
3 => 'date_registration',
4=> 'insurance_card_name',
5=> 'insurance_company_name',
6=> 'str_status'
);
// getting total number records without any search
$sql_f_all = "select c.id,c.p_id,c.case_id_code,Concat(c.insurance_no,'/',c.insurance_no_1) as Reg_No,
c.insurance_company_name,Concat(c.p_name,'
','[',p_code,if(i.id is null,'',concat('/',i.ipd_code)),']') as p_f_info,p.p_code,
c.date_registration,c.insurance_card_name,c.status,
(case c.status when 0 then 'Pending'
when 1 then 'Ready for submission'
when 2 then 'submitted' else 'Other' end) as str_status,c.insurance_id,
Date_Format(c.date_registration,'%d-%m-%Y') as date_registration_in ,i.ipd_code ";
$sql_count="Select count(*) as no_rec ";
$sql_from=" from ((organization_case_master c join patient_master p on c.p_id=p.id )
left join ipd_master i on c.id=i.case_id and p.id=i.p_id) ";
$total_sql=$sql_count.$sql_from;
$query = $this->db->query($total_sql);
$data['total_rec']= $query->result();
$totalData=$data['total_rec'][0]->no_rec;
$totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
$sql_where=" WHERE c.case_type=0 ";
$sql_where_flag=0;
// getting records as per search parameters
if( !empty($requestData['columns'][0]['search']['value']) ){ //CaseCode-InsuranceCard-ClaimNo
$sql_where.=" AND case_id_code LIKE '%".$requestData['columns'][0]['search']['value']."' ";
$sql_where_flag=1;
}
if( !empty($requestData['columns'][1]['search']['value']) ){ //p_code-P-Name
$sql_where.=" AND ( p.p_fname LIKE '%".$requestData['columns'][1]['search']['value']."%' ";
$sql_where.=" OR p.mphone1 LIKE '".$requestData['columns'][1]['search']['value']."' ";
$sql_where.=" OR i.ipd_code LIKE '%".$requestData['columns'][1]['search']['value']."' ";
$sql_where.=" OR p_code LIKE '%".$requestData['columns'][1]['search']['value']."' )";
$sql_where_flag=1;
}
if( !empty($requestData['columns'][2]['search']['value']) ){ //insurance_card_name
$sql_where.=" AND c.insurance_card_name LIKE '%".$requestData['columns'][2]['search']['value']."%' ";
$sql_where_flag=1;
}
//if( !empty($requestData['columns'][3]['search']['value']) ){ //insurance_company_name
// $sql_where.=" AND insurance_company_name LIKE '%".$requestData['columns'][3]['search']['value']."%' ";
// $sql_where_flag=1;
//}
if( !empty($requestData['columns'][3]['search']['value'])){ //insurance_card_name
if($requestData['columns'][3]['search']['value'] < 0){
$sql_where.=" AND c.insurance_id not in (1,2,53,63) ";
$sql_where_flag=1;}
if($requestData['columns'][3]['search']['value']>0){
$sql_where.=" AND c.insurance_id = '".$requestData['columns'][3]['search']['value']."' ";
$sql_where_flag=1;}
}
if( !empty($requestData['columns'][4]['search']['value']) ){ //insurance_company_name
$sql_where.=" AND ( c.insurance_no LIKE '".$requestData['columns'][4]['search']['value']."%' ";
$sql_where.=" OR c.insurance_no_1 LIKE '".$requestData['columns'][4]['search']['value']."%' ) ";
$sql_where_flag=1;
}
if( !empty($requestData['columns'][5]['search']['value'])){ //insurance_card_name
$sql_where.=" AND c.status = '".$requestData['columns'][5]['search']['value']."' ";
$sql_where_flag=1;
}
$total_filer_sql=$sql_count.$sql_from.$sql_where;
$query = $this->db->query($total_filer_sql);
$data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
$totalFiltered=$data['total_rec_filter'][0]->no_rec;
$sql_order=" group by c.id ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
$Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
$query = $this->db->query($Result_sql);
$rdata= $query->result_array();
$output = array(
"draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
"recordsTotal" => intval( $totalData ), // total number of records
"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
"data" => array(),
"sql" => $Result_sql
);
foreach($rdata as $aRow)
{
$row = array();
foreach($columns as $col)
{
$row[] = $aRow[$col];
}
$output['data'][] = $row;
}
echo json_encode($output); // send data as json format
}
public function contingent_bill($caseid,$print=0)
{
$sql="select * from organization_case_master where id='".$caseid."'";
$query = $this->db->query($sql);
$data['orgcase']= $query->result();
$pno=$data['orgcase'][0]->p_id;
$caseid=$data['orgcase'][0]->id;
$claim_id=$data['orgcase'][0]->insurance_no_1;
$sql="select *,if(gender=1,'Male','Female') as xgender,
GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
$query = $this->db->query($sql);
$data['person_info']= $query->result();
$ins_comp_id=$data['orgcase'][0]->insurance_id;
$inc_card_id=$data['orgcase'][0]->insurance_card_id;
$sql="select * from hc_insurance_card where id=".$inc_card_id;
$query = $this->db->query($sql);
$data['hc_insurance_card']= $query->result();
$sql="select * from hc_insurance where id=".$ins_comp_id;
$query = $this->db->query($sql);
$data['insurance']= $query->result();
$content=$data['orgcase'][0]->contingent_bill;
if($print==1)
{
//echo $content;
$page_head="";
$content=$page_head.$content;
//create_report_pdf($content,'Report_1.pdf');
$this->load->library('m_pdf');
$file_name="Report-".date('Ymdhis').".pdf";
$filepath=$file_name;
$this->m_pdf->pdf->WriteHTML($content);
$this->m_pdf->pdf->Output($filepath,"I");
}else{
$this->load->view('Invoice/Org_Contingent_bill',$data);
}
}
public function create_contingent_bill($caseid)
{
$sql="select * from organization_case_master where id='".$caseid."'";
$query = $this->db->query($sql);
$data['orgcase']= $query->result();
$pno=$data['orgcase'][0]->p_id;
$caseid=$data['orgcase'][0]->id;
$claim_id=$data['orgcase'][0]->insurance_no_1;
$sql="select *,if(gender=1,'Male','Female') as xgender,
GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
$query = $this->db->query($sql);
$data['person_info']= $query->result();
$ins_comp_id=$data['orgcase'][0]->insurance_id;
$inc_card_id=$data['orgcase'][0]->insurance_card_id;
$sql="select * from hc_insurance_card where id=".$inc_card_id;
$query = $this->db->query($sql);
$data['hc_insurance_card']= $query->result();
$sql="select * from hc_insurance where id=".$ins_comp_id;
$query = $this->db->query($sql);
$data['insurance']= $query->result();
$sql="select * from v_case_invoice v
where v.id=".$caseid." order by Charge_type,Adate ";
$query = $this->db->query($sql);
$data['showinvoice']= $query->result();
$sql="select sum(amount) as GTotal from v_case_invoice v
where v.id=".$caseid." ";
$query = $this->db->query($sql);
$data['invoiceGtotal']= $query->result();
$content="";
$content.='
Name of Hospital : ".H_Name."
"; $content.='| Voucher No. ______________________________ | Date : ……………………… | |
| Amount of allotment : | Rs.…………………………… | |
| Amount expended and for which bills have already been submitted for payment : | Rs.…………………………… | |
| Balance of allotment excliding the amount of this bills : | Rs.…………………………… | |
Expenditure an account of : Treatment/ Super Treatment/ Special investigation / Consultant fee
'; $content.='| In respect of Name of Patient: '.strtoupper($data['orgcase'][0]->p_name).' | ';
$content.='Relation : '.strtoupper($data['orgcase'][0]->relation_with_cardholder).' | '; $content.='Service No.: '.strtoupper($data['orgcase'][0]->insurance_no_2).' | '; $content.='
| ESM Name : ".strtoupper($data['orgcase'][0]->insurance_card_name).' | '; $content.="ECHS CARD No. : ".strtoupper($data['orgcase'][0]->insurance_no).' | '; $content.="Rank : ".strtoupper($data['orgcase'][0]->card_remark).' | '; $content.='
Authority:
';
$content.='Government of India letter No. 24 (3)/03/US/(WE)/D (Res) (i) dated 08 Sep 2003
';
$content.='Government of India letter No. 24 (8)/03/US/(WE)/D (Res) dated 19 Dec 2003
';
$content.='Central Organization ECHS Letter NoB/49773/AG/ECHS dated 25 May 2004.
| Sr.No. | Date | Details of Expenditure | Number or Quantity | Rate | Per | Amount | |
|---|---|---|---|---|---|---|---|
| '.$srno.' | '.date('Y-m-d').' | OPD | '.$opd[0]->rate.' | '.$opd[0]->item_qty.' | '.$opd[0]->rate.' | CGHS | '.$opd[0]->tamount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | Package :'.$row->package_name.' | '.$row->package_Amount.' | 1 | '.$row->package_Amount.' | CGHS | '.$row->package_Amount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | '.$row->item_name.' | '.$row->item_rate.' | '.$row->unit.' | '.$row->item_rate.' | CGHS | '.$row->tamount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | '.$row->item_name.' | '.$row->item_rate.' | '.$row->unit.' | '.$row->item_rate.' | CGHS | '.$row->tamount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | '.$row->item_name.' | '.$row->item_rate.' | '.$row->unit.' | '.$row->item_rate.' | CGHS | '.$row->tamount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | '.$row->item_name.' | '.$row->item_rate.' | '.$row->unit.' | '.$row->item_rate.' | CGHS | '.$row->tamount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | '.$row->item_name.' | '.$row->item_rate.' | '.$row->unit.' | '.$row->item_rate.' | CGHS | '.$row->tamount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | '.$row->item_name.' | '.$row->item_rate.' | '.$row->unit.' | '.$row->item_rate.' | CGHS | '.$row->tamount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | '.$row->item_name.' | '.$row->item_rate.' | '.$row->unit.' | '.$row->item_rate.' | CGHS | '.$row->tamount.' | '; $tbody.="
| '.$srno.' | '.date('Y-m-d').' | Medicine | '.$data['MedInvoice'][0]->Med_Amount.' | '.$data['MedInvoice'][0]->no_inv.' | '.$data['MedInvoice'][0]->Med_Amount.' | '.$data['MedInvoice'][0]->Med_Amount.' | '; $tbody.='|
| Gross Total | '.Round($total_gross_bill,0).' | ||||||
| '.$IPDMaster[0]->charge1.' | '.$IPDMaster[0]->chargeamount1.' | '; $tbody.='||||||
| '.$IPDMaster[0]->charge2.' | '.$IPDMaster[0]->chargeamount2.' | '; $tbody.='||||||
| '.$IPDMaster[0]->Discount_Remark.' | '.$IPDMaster[0]->Discount.' | '; $tbody.='||||||
| '.$IPDMaster[0]->Discount_Remark2.' | '.$IPDMaster[0]->Discount3.' | '; $tbody.='||||||
| '.$IPDMaster[0]->Discount_Remark3.' | '.$IPDMaster[0]->Discount3.' | '; $tbody.='||||||
| Net Total | '.Round($total_gross_bill,0).' | ||||||
Net Amount due(In words) : Rs. ".number_to_word(Round($total_gross_bill,0))."
"; $content.="| Date : ...................... | Pre Received Payment | ||
| From : ...................... | ..................... |
Certified that
';
$content.='
| Vetted and Recommended / Not Recommended | Sig of OIC ECHS Polyclinic | |
Date : ...................... Place: ...................... | ..................... |