|
|
|
@@ -10,6 +10,7 @@ |
|
|
|
|
|
|
|
namespace Biukop; |
|
|
|
use XeroPHP\Models\Accounting\Address; |
|
|
|
use XeroPHP\Models\Accounting\Payment; |
|
|
|
|
|
|
|
require_once(dirname(__FILE__) . '/autoload.php'); |
|
|
|
require_once (ABSPATH . 'wp-includes/pluggable.php'); |
|
|
|
@@ -166,11 +167,48 @@ class AcareOffice{ |
|
|
|
header("Content-type: text/csv"); |
|
|
|
header("Content-Disposition:attachment; filename=$filename"); |
|
|
|
header("Content-Type: application/force-download"); |
|
|
|
|
|
|
|
|
|
|
|
//readfile(dirname(__FILE__) . "/img/circle.png"); |
|
|
|
$clients_in = "'" . implode("','", $clients) . "'"; |
|
|
|
$sql = "SELECT * from $this->table_name WHERE client in ($clients_in) and start >='$start 00:00:00' and start<='$finish 23:59:59'"; |
|
|
|
$results = $wpdb->get_results($sql); |
|
|
|
|
|
|
|
$csv_header = "RegistrationNumber,NDISNumber,SupportsDeliveredFrom,SupportsDeliveredTo,SupportNumber,ClaimReference,Quantity,Hours,UnitPrice,GSTCode,AuthorisedBy,ParticipantApproved,InKindFundingProgram,ClaimType,CancellationReason\n"; |
|
|
|
echo "$csv_header" . print_r($clients, true) . print_r($_POST, true); |
|
|
|
echo $csv_header; |
|
|
|
foreach($results as $r) |
|
|
|
{ |
|
|
|
echo $this->ndis_csv_line($r); |
|
|
|
} |
|
|
|
//echo $sql; |
|
|
|
exit(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private function ndis_csv_line($record) |
|
|
|
{ |
|
|
|
$str = ""; |
|
|
|
|
|
|
|
$registration = "4500000"; |
|
|
|
$ndisnumber = $this->get_client_ndis_account($record->client); |
|
|
|
$date = new \DateTime($record->start); |
|
|
|
$start = $date->format("Y-m-d"); |
|
|
|
$date = new \Datetime($record->finish); |
|
|
|
$finish = $date->format("Y-m-d"); |
|
|
|
$quantity = 0; |
|
|
|
$hours = 0; |
|
|
|
$unitprice = 0; |
|
|
|
$authorizedby="helen"; |
|
|
|
$participant_approved = ""; |
|
|
|
$in_kind_program =""; |
|
|
|
$ClaimType = "";// standard; |
|
|
|
$CancellationReason=""; |
|
|
|
return "$registration,$ndisnumber,$start,$finish,$record->tos,REC_{$record->id},$quantity,$hours,$unitprice,P1,$authorizedby,$participant_approved,$in_kind_program,$ClaimType,$CancellationReason\n"; |
|
|
|
} |
|
|
|
|
|
|
|
private function get_client_ndis_account($client) |
|
|
|
{ |
|
|
|
$user = get_user_by('login', $client); |
|
|
|
return get_user_meta($user->ID,'account',true); |
|
|
|
} |
|
|
|
|
|
|
|
//init database |