| private $html = ''; | private $html = ''; | ||||
| private $ndis_table; | private $ndis_table; | ||||
| private $tos =[]; | private $tos =[]; | ||||
| private $current_year = 2020; | |||||
| public function __construct(int $year=2019) { | public function __construct(int $year=2019) { | ||||
| global $wpdb; | global $wpdb; | ||||
| if ( $year == "2019"){ | |||||
| $now = new \DateTime(); | |||||
| //$year = (int)($now->format("Y")); | |||||
| } | |||||
| $this->ndis_table = $wpdb->prefix . 'acare_ndis_price'; | $this->ndis_table = $wpdb->prefix . 'acare_ndis_price'; | ||||
| $sql = "SELECT * FROM {$this->ndis_table} WHERE year=$year"; //for this year | |||||
| $sql = "SELECT * FROM {$this->ndis_table}"; //for this year | |||||
| $results = $wpdb->get_results($sql); | $results = $wpdb->get_results($sql); | ||||
| $this->tos =[]; | $this->tos =[]; | ||||
| $html = ' <select>'; | $html = ' <select>'; | ||||
| foreach($results as $r){ | foreach($results as $r){ | ||||
| $this->tos[$r->code] = $r; | |||||
| $this->tos[$r->id] = $r; | |||||
| $html .= sprintf('<option value="%d" data-ndis="%s" data-level="%d" data-year="%d" data-unit="%s" data-price="%.2f" data-ot="%s">%.2f - %s %s %s</option>', | |||||
| $html .= sprintf('<option value="%d" data-ndis="%s" data-level="%d" data-year="%d" data-unit="%s" data-price="%.2f" data-ot="%s">$%.2f -(date:%d)- %s %s %s</option>', | |||||
| $r->id, | $r->id, | ||||
| $r->code, | $r->code, | ||||
| $r->level, | $r->level, | ||||
| (float) $r->price, | (float) $r->price, | ||||
| $r->ot, | $r->ot, | ||||
| (float) $r->price, | (float) $r->price, | ||||
| $r->year, | |||||
| $r->name, | $r->name, | ||||
| $this->get_level((int) $r->level), | $this->get_level((int) $r->level), | ||||
| $r->ot | $r->ot |
| }); | }); | ||||
| if (matches.length != 1){ | if (matches.length != 1){ | ||||
| $(selector).find('.bstart').addClass("error"); | $(selector).find('.bstart').addClass("error"); | ||||
| $(selector).find(".bstart_err").html("No matching Job"); | |||||
| $(selector).find(".bstart_err").html("No matched driving Job"); | |||||
| ensure_visible(selector); | ensure_visible(selector); | ||||
| console.warn("1 driving job has more than 1 matching", $(selector).attr('id'), matches); | console.warn("1 driving job has more than 1 matching", $(selector).attr('id'), matches); | ||||
| return false; | return false; |
| $in_kind_program = $this->get_client_in_kind_program($record->client); | $in_kind_program = $this->get_client_in_kind_program($record->client); | ||||
| $ClaimType = "";// standard; | $ClaimType = "";// standard; | ||||
| $CancellationReason=""; | $CancellationReason=""; | ||||
| return "$registration,$ndisnumber,$start,$finish,$record->tos,REC_{$record->id},$quantity,$hours,$unitprice,$GST,$authorizedby,$participant_approved,$in_kind_program,$ClaimType,$CancellationReason\n"; | |||||
| $SupportNumber = $this->get_ndis_price()->get_tos_ndis_code($record->tos); | |||||
| return "$registration,$ndisnumber,$start,$finish,$SupportNumber,REC_{$record->id},$quantity,$hours,$unitprice,$GST,$authorizedby,$participant_approved,$in_kind_program,$ClaimType,$CancellationReason\n"; | |||||
| } | } | ||||
| private function get_client_ndis_account($client) | private function get_client_ndis_account($client) |