class form_quote_sheet { public $id; public $config; public $validation; public $reasons; public $sign_counter; public $department; public $status_table; public $status_id; public $qid; public function __construct($context) { $this->id = $context['id']; $this->status_table = $context['status_table']; $this->status_id = $context['status']; $this->department_id = $context['dept_id']; $this->sign_counter = 0; } public function set() { global $database; $id = $this->id; $status_id = $this->status_id; //$database->debug = true; $this->client_type = 1; if(!empty($id)) { $request = common_quotes::get_quotes_details($id); //bug::bug_array('',$request); $this->company_id = $request['client_id']; $this->client_id = $request['client_id']; $this->qid = $request['id']; $this->company_name = common_clients::get_client_name($request['client_id']); $this->primary_location_id = $request['primary_location_id']; $this->location_id = $request['primary_location_id']; $location_details = common_ref_client::get_client_location($this->primary_location_id); $this->address = $location_details['address']; $this->suburb = $location_details['suburb']; $this->state = $location_details['state']; $this->post_code = $location_details['post_code']; $this->first_name = $request['first_name']; $this->last_name = $request['last_name']; $this->phone = $request['phone']; $this->email = $request['email']; $this->job_tag = $request['job_tag']; $this->job_number = $request['job_number']; $this->job_name = $request['job_name']; $this->description = $request['description']; $this->phone = $request['phone']; $this->sitesurvey_notes = $request['sitesurvey_notes']; $this->qualification_notes = $request['qualification_notes']; $this->production_notes = $request['production_notes']; $this->management_notes = $request['management_notes']; $this->finance_notes = $request['finance_notes']; $this->visualmockup_notes = $request['visualmockup_notes']; $this->flag = $request['flag']; $this->status = $request['dqstatus']; /* $this->jobtypes= unserialize($request['jobtype']); if(is_array($this->jobtypes)) { foreach($this->jobtypes as $k ) { $newk = explode('=>',$k); $this->$newk[0] = $newk[1]; $this->config{$newk[0]} = array("id"=> $id,"value"=> $newk[1], "input_name" => $newk[0], "name" => $newk[0],"rule" => ""); } } */ } if($_POST['Submit'] == "Save") { $this->address = $this->address; $this->post_code = $this->post_code; $this->state = $this->state; $this->suburb = $this->suburb; $this->country = $this->country; $this->phone = $this->phone; $this->first_name = $_POST['first_name']; $this->last_name = $_POST['last_name']; $this->email = $_POST['email']; $this->client_id = $_POST['client_id']; $this->location_id = $_POST['location_id']; $this->primary_location_id = $this->primary_location_id; $this->job_number = $this->job_number; $this->job_tag = $this->job_tag; $this->description = $this->description; $this->job_type = $_POST['jobtype']; $this->company = $this->company; $this->sitesurvey_notes =$this->sitesurvey_notes; $this->qualification_notes =$this->qualification_notes; $this->production_notes =$this->production_notes; $this->management_notes =$this->management_notes; $this->finance_notes =$this->finance_notes; $this->visualmockup_notes =$this->visualmockup_notes; $this->flag =$this->flag; $this->status = $request['status']; foreach($_POST as $post => $pp){ if (preg_match("/jobtype/i", $post)) { //echo $post; $this->$post = $pp; } } foreach($_POST as $sign => $ss){ if (preg_match("/signtype/i", $sign)) { //echo $post; $this->$sign = $ss; } } if($this->sign_counter > 0){ $this->reasons .= "Required at least one"; } } /* $this->config['address'] = array("id"=> $id,"value"=> $this->address, "input_name" => "address", "name" => "Address","rule" => "required"); $this->config['post_code'] = array("id"=> $id,"value"=> $this->post_code, "input_name" => "post_code", "name" => "Post Code","rule" => "required|integer|exact_length[4]"); $this->config['state'] = array("id"=> $id,"value"=> $this->state, "input_name" => "state", "name" => "State","rule" => "required"); $this->config['suburb'] = array("id"=> $id,"value"=> $this->suburb, "input_name" => "suburb", "name" => "Suburb","rule" => "required"); $this->config['first_name'] = array("id"=> $id,"value"=> $this->first_name, "input_name" => "first_name", "name" => "First Name","rule" => "required"); $this->config['last_name'] = array("id"=> $id,"value"=> $this->last_name, "input_name" => "last_name", "name" => "Last Name","rule" => "required"); $this->config['phone'] = array("id"=> $id,"value"=> $this->phone, "input_name" => "phone", "name" => "Phone","rule" => "required"); $this->config['email'] = array("id"=> $id,"value"=> $this->email, "input_name" => "email", "name" => "Email","rule" => "valid_email"); $this->config['location_id'] = array("id"=> $id,"value"=> $this->location_id, "input_name" => "location_id", "name" => "Address","rule" => "required"); $this->config['job_number'] = array("id"=> $id,"value"=> $this->job_number, "input_name" => "job_number", "name" => "Job Number","rule" => "required"); $this->config['description'] = array("id"=> $id,"value"=> $this->description, "input_name" => "description", "name" => "Description","rule" => "required"); $this->config['jobtype_id'] = array("id"=> $id,"value"=> $this->jobtype_id, "input_name" => "jobtype_id", "name" => "Job Type ID","rule" => ""); */ $this->config['sitesurvey_notes'] = array("id"=> $id,"value"=> $this->sitesurvey_notes, "input_name" => "sitesurvey_notes", "name" => "Site Survey Notes","rule" => ""); $this->config['qualification_notes'] = array("id"=> $id,"value"=> $this->qualification_notes, "input_name" => "qualification_notes", "name" => "Qualification Notes","rule" => ""); $this->config['production_notes'] = array("id"=> $id,"value"=> $this->production_notes, "input_name" => "production_notes", "name" => "Production Notes","rule" => ""); $this->config['management_notes'] = array("id"=> $id,"value"=> $this->management_notes, "input_name" => "management_notes", "name" => "Management Notes","rule" => ""); $this->config['finance_notes'] = array("id"=> $id,"value"=> $this->finance_notes, "input_name" => "finance_notes", "name" => "Finance Notes","rule" => ""); $this->config['visualmockup_notes'] = array("id"=> $id,"value"=> $this->visualmockup_notes, "input_name" => "visualmockup_notes", "name" => "Visual Art Mockup Notes","rule" => ""); $this->config['client_id'] = array("id"=> $id,"value"=> $this->client_id, "input_name" => "client_id", "name" => "Client","rule" => "required"); $this->config['status'] = array("id"=> $id,"value"=> $this->status, "input_name" => "status", "name" => "Status","rule" => ""); foreach($_POST as $post => $pp){ if (preg_match("/jobtype/i", $post)) { //echo $post; $this->config{$post} = array("id"=> $id,"value"=> $pp, "input_name" => $post, "name" => $post,"rule" => ""); } } foreach($_POST as $sign => $ss){ if (preg_match("/signtype/i", $sign)) { //echo $post; $this->config{$sign} = array("id"=> $id,"value"=> $ss, "input_name" => $sign, "name" => $sign,"rule" => "required"); } } self::run_validation(); } public function run_validation() { $static_function = (($_POST['Submit'] == "")) ? "initial" : "validate"; /*if(isset($_POST['Submit'])) { if($this->create_new_client == 1) { if($this->client_type == 1) $this->validation['new_company_name'] = validation::$static_function($this->config['new_company_name']); $this->validation['location_id'] = validation::initial($this->config['location_id']); } else { $this->validation['new_company_name'] = validation::initial($this->config['new_company_name']); $this->validation['client_id'] = validation::$static_function($this->config['client_id']); $this->validation['location_id'] = validation::$static_function($this->config['location_id']); } } else { $this->validation['new_company_name'] = validation::$static_function($this->config['new_company_name']); $this->validation['client_id'] = validation::$static_function($this->config['client_id']); $this->validation['location_id'] = validation::$static_function($this->config['location_id']); } */ $this->validation['job_number'] = validation::$static_function($this->config['job_number']); $this->validation['description'] = validation::$static_function($this->config['description']); $this->validation['client_id'] = validation::initial($this->config['client_id']); $this->validation['sitesurvey_notes'] = validation::$static_function($this->config['sitesurvey_notes']); $this->validation['qualification_notes'] = validation::$static_function($this->config['qualification_notes']); $this->validation['production_notes'] = validation::$static_function($this->config['production_notes']); $this->validation['management_notes'] = validation::$static_function($this->config['management_notes']); $this->validation['finance_notes'] = validation::$static_function($this->config['finance_notes']); $this->validation['visualmockup_notes'] = validation::$static_function($this->config['visualmockup_notes']); /* $this->validation['address'] = validation::$static_function($this->config['address']); $this->validation['post_code'] = validation::$static_function($this->config['post_code']); $this->validation['state'] = validation::$static_function($this->config['state']); $this->validation['suburb'] = validation::$static_function($this->config['suburb']); $this->validation['first_name'] = validation::$static_function($this->config['first_name']); $this->validation['last_name'] = validation::$static_function($this->config['last_name']); $this->validation['phone'] = validation::$static_function($this->config['phone']); $this->validation['email'] = validation::$static_function($this->config['email']); */ foreach($_POST as $post => $pp){ if (preg_match("/jobtype/i", $post)) { //echo $post; $this->validation{$post} = validation::$static_function($this->config{$post}); } } foreach($_POST as $sign => $ss){ if (preg_match("/signtype/i", $sign)) { //echo $post; $this->sign_counter++; $this->validation{$sign} = validation::$static_function($this->config{$sign}); } } $this->validation['jobtype_id'] = validation::$static_function($this->config['jobtype_id']); $this->validation['status'] = validation::$static_function($this->config['status']); $this->reasons = validation::formalise($this->validation); } public function view() { global $database; $id = $this->id; $qid = $this->qid; $flag = $this->flag; $status_table = $this->status_table; $status_id = $this->status; $department_id = $this->department_id; $location_id = $this->location_id; $primary_location_id = $this->primary_location_id; $client_id = $this->client_id; $qualification_notes = $this->qualification_notes; $company_name = $this->company_name; $job_number = $this->job_number; $company_id = $this->company_id; $address = $this->address; $suburb = $this->suburb; $state = $this->state; $post_code = $this->post_code; $job_name = $this->job_name; $description = $this->description; $description = nl2br( stripslashes( htmlentities( $description, ENT_QUOTES, 'UTF-8' ) ) ); $phone = $this->phone; $fax = $this->fax; $jobtypes=$this->jobtypes; $options = array("class" => "medium"); ?>
Number of Sites | $config['value']='1'; $validation['input_name']='site_number'; echo forms::input_text($config,$validation,$text_options_small ); ?> |
Costing Component |
Cost |
Artwork | $ $config['value']=number_format($results['artwork_total'],2); $validation['input_name']='artwork_total'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
Permits/Survey | $ $config['value']=number_format($results['permit_total'],2); $validation['input_name']='permit_total'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
Labour (inc. Metro Install In House Labour) | $ $config['value']=number_format($results['labour_total'],2); $validation['input_name']='labour_total'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
Material | $ //get values from quotes_materials table //$sql = "SELECT SUM(total) as total FROM quotes_materials WHERE quote_id = '$id'"; //$materials = $database->getRow($sql); $materials = common_materials::get_total($id); $config['value']=number_format($materials,2); $validation['input_name']='materials_total'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
Delivery | $ $config['value']=number_format($results['delivery_total'],2); $validation['input_name']='delivery_total'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
External Installation | $ $config['value']=number_format($results['install_total'],2); $validation['input_name']='install_total'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
Alternate Sub Contractor installation Cost | $ $config['value']=number_format($results['subcontractor_cost'],2); $validation['input_name']='subcontractor_cost'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
Sub Total | $ $config['value']=number_format($results['sub_total']+$materials,2); $validation['input_name']='sub_total'; $text_options_small_readonly['style'] = "border:0; text-align:right;background:#fed5b9;width:120px"; echo forms::input_text($config,$validation,$text_options_small_readonly); ?> |
Mark Up $config['value']=$results['mark_up_rate'] ; $validation['input_name']='mark_up_rate'; $text_options_small_readonly['style'] = "border:0; text-align:right;background:#efefef;"; echo forms::input_text($config,$validation,$text_options_smalls); ?> | $ $config['value']=number_format($results['mark_up'],0); $validation['input_name']='mark_up'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
Plus GST | $ $config['value']=number_format($results['gst'],2); $validation['input_name']='gst'; echo forms::input_text($config,$validation,$text_options_smalls_readonly); ?> |
Total Sales Price | $ $config['value']=ceil($results['total_sales_price']); $validation['input_name']='total_sales_price'; $text_options_small_readonly['style'] = "border:0; text-align:right;background:#fed5b9;font-weight:bold;width:120px;"; echo forms::input_text($config,$validation,$text_options_small_readonly); ?> |