function export_xls() { ini_set('memory_limit', '-1'); require "../assets/export-xls.class.modif.php"; $filename = 'LIST_INDIVIDUAL_' . date('Ymd_His') . '.xls'; $xls = new ExportXLS($filename); $header[] = "NO"; $header[] = "INDIVIDUAL CODE"; $header[] = "CAMPAIGN"; $header[] = "MOP ID"; $header[] = "FIRSTNAME"; $header[] = "LASTNAME"; $header[] = "NICKNAME"; $header[] = "SEX"; $header[] = "DAY OF BIRTH"; $header[] = "ID TYPE"; $header[] = "ID NUMBER"; $header[] = "TELEPHONE"; $header[] = "EMAIL"; $header[] = "FB"; $header[] = "TW"; $header[] = "ADDRESS"; $header[] = "CITY"; $header[] = "POS CODE"; $header[] = "BRAND"; $header[] = "BRAND 2"; $header[] = "SOURCE TYPE"; $header[] = "SOURCE USER"; $header[] = "SOURCE EMAIL"; $header[] = "SURVEY DATE"; $header[] = "UPLOAD DATE"; $header[] = "ENTRY DATE"; $header[] = "VERIFIKASI DATE"; $header[] = "REFERRED BY"; $header[] = "DRN NUMBER"; $header[] = "STATUS VERIFIKASI"; $header[] = "AGE"; $xls->addHeader($header); $result = $this->mdl_individual->export()->result(); $i = 1; foreach ($result as $r) { $row[] = $i++; $row[] = $r->id; $row[] = $r->campaign_id; $row[] = $r->mop_id; $row[] = $r->firstname; $row[] = $r->lastname; $row[] = $r->nickname; $row[] = $r->sex; $row[] = format_tanggal_excel($r->dob); $row[] = $r->id_type; $row[] = $r->id_number; $row[] = $r->tlp; $row[] = $r->email; $row[] = $r->fb; $row[] = $r->tw; $row[] = $r->address; $row[] = $r->city; $row[] = $r->pos_code; $row[] = $r->brand; $row[] = $r->brand_; $row[] = $r->source_type; $row[] = $this->mdl_sba->get_sba_name($r->source_user); $row[] = $r->source_user; $row[] = format_tanggal_excel($r->survey_date); $row[] = format_tanggal_excel($r->upload_date); $row[] = format_tanggal_excel($r->entry_date); $row[] = format_tanggal_excel($r->verifikasi_date); $row[] = $r->referred; $row[] = $r->drn_number; $row[] = $r->status_verifikasi; $row[] = get_age($r->dob); $xls->addRow($row); unset($row); } $xls->sendFile(); }
$query=mysqlquery("select * from vl_forms_clinicalrequest where date(created)>='$from' and date(created)<='$to' order by created"); } else { $query=mysqlquery("select * from vl_forms_clinicalrequest order by created"); } if(mysqlnumrows($query)) { //header $header=array(); $header[]="Form Number"; $header[]="Reference Number"; $header[]="Destination Facility"; $header[]="Date Dispatched"; $header[]="Received from Facility"; $header[]="Date Received"; $header[]="Date Created"; $xls->addHeader($header); //iterations while($q=mysqlfetcharray($query)) { //variables $formNumber=0; $formNumber=$q["formNumber"]; $refNumber=0; $refNumber=$q["refNumber"]; $facilityID=0; $facilityID=getDetailedTableInfo2("vl_forms_clinicalrequest_dispatch","refNumber='$q[refNumber]' limit 1","facilityID"); $facility=0; $facility=($facilityID?getDetailedTableInfo2("vl_facilities","id='$facilityID' limit 1","facility"):"N/A"); $dateDispatched=0; $dateDispatched=($facilityID?getRawFormattedDateLessDay(getDetailedTableInfo2("vl_forms_clinicalrequest_dispatch","refNumber='$q[refNumber]' limit 1","dispatchDate")):"N/A"); $receivedFacilityID=0; $receivedFacilityID=getDetailedTableInfo2("vl_samples","formNumber='$formNumber' limit 1","facilityID");