From 49d60313f6fb6a8b4f43a076dc35d002579aea01 Mon Sep 17 00:00:00 2001 From: odiea Date: Sun, 11 Feb 2018 12:24:48 -0700 Subject: [PATCH] Update Detailed Reports. Add payment type to Specific Customer. --- application/controllers/Reports.php | 46 ++++++++++--- application/language/en-GB/reports_lang.php | 1 + application/language/en-US/reports_lang.php | 1 + application/models/reports/Detailed_sales.php | 1 + .../models/reports/Specific_customer.php | 1 + .../models/reports/Specific_discount.php | 1 + .../models/reports/Specific_employee.php | 1 + .../views/reports/specific_customer_input.php | 69 +++++++++++++++++++ 8 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 application/views/reports/specific_customer_input.php diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 3e5cb5529..e5312e651 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -780,22 +780,41 @@ class Reports extends Secure_Controller public function specific_customer_input() { $data = array(); - $data['specific_input_name'] = $this->lang->line('reports_customer'); - + $data['specific_input_name'] = $this->lang->line('reports_customer'); $customers = array(); foreach($this->Customer->get_all()->result() as $customer) { - $customers[$customer->person_id] = $this->xss_clean($customer->first_name . ' ' . $customer->last_name); + if(isset($customer->company_name)) + { + $customers[$customer->person_id] = $this->xss_clean($customer->first_name . ' ' . $customer->last_name. ' ' . ' [ '.$customer->company_name.' ] '); + } + else + { + $customers[$customer->person_id] = $this->xss_clean($customer->first_name . ' ' . $customer->last_name); + } } $data['specific_input_data'] = $customers; $data['sale_type_options'] = $this->get_sale_type_options(); - $this->load->view('reports/specific_input', $data); + $data['payment_type'] = $this->get_payment_type(); + $this->load->view('reports/specific_customer_input', $data); } + + public function get_payment_type() + { + $payment_type = array( 'all' => $this->lang->line('common_none_selected_text'), + 'cash' => $this->lang->line('sales_cash'), + 'due' => $this->lang->line('sales_due'), + 'check' => $this->lang->line('sales_check'), + 'credit' => $this->lang->line('sales_credit'), + 'debit' => $this->lang->line('sales_debit'), + 'invoices' => $this->lang->line('sales_invoice')); + return $payment_type; + } - public function specific_customer($start_date, $end_date, $customer_id, $sale_type) + public function specific_customer($start_date, $end_date, $customer_id, $sale_type, $payment_type) { - $inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type); + $inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type, 'payment_type' => $payment_type); $this->load->model('reports/Specific_customer'); $model = $this->Specific_customer; @@ -823,7 +842,7 @@ class Reports extends Secure_Controller } $summary_data[] = $this->xss_clean(array( - 'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')), + 'id' => $row['sale_id'], 'type_code' => $row['type_code'], 'sale_date' => $row['sale_date'], 'quantity' => to_quantity_decimals($row['items_purchased']), @@ -865,10 +884,20 @@ class Reports extends Secure_Controller } $customer_info = $this->Customer->get_info($customer_id); + if(!empty($customer_info->company_name)) + { + $customer_name ='[ '.$customer_info->company_name.' ]'; + } + else + { + $customer_name = $customer_info->company_name; + } + $data = array( 'title' => $this->xss_clean($customer_info->first_name . ' ' . $customer_info->last_name . ' ' . $this->lang->line('reports_report')), 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $headers, + 'editable' => 'sales', 'summary_data' => $summary_data, 'details_data' => $details_data, 'details_data_rewards' => $details_data_rewards, @@ -924,7 +953,7 @@ class Reports extends Secure_Controller } $summary_data[] = $this->xss_clean(array( - 'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')), + 'id' => $row['sale_id'], 'type_code' => $row['type_code'], 'sale_date' => $row['sale_date'], 'quantity' => to_quantity_decimals($row['items_purchased']), @@ -970,6 +999,7 @@ class Reports extends Secure_Controller 'title' => $this->xss_clean($employee_info->first_name . ' ' . $employee_info->last_name . ' ' . $this->lang->line('reports_report')), 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $headers, + 'editable' => 'sales', 'summary_data' => $summary_data, 'details_data' => $details_data, 'details_data_rewards' => $details_data_rewards, diff --git a/application/language/en-GB/reports_lang.php b/application/language/en-GB/reports_lang.php index aa8c52b07..b3bbe16fe 100644 --- a/application/language/en-GB/reports_lang.php +++ b/application/language/en-GB/reports_lang.php @@ -7,6 +7,7 @@ $lang["reports_categories_summary_report"] = "Categories Summary Report"; $lang["reports_category"] = "Category"; $lang["reports_code_canceled"] = "CNL"; $lang["reports_code_invoice"] = "INV"; +$lang["reports_code_pos"] = "POS"; $lang["reports_code_quote"] = "Q"; $lang["reports_code_return"] = "RET"; $lang["reports_code_type"] = "Type"; diff --git a/application/language/en-US/reports_lang.php b/application/language/en-US/reports_lang.php index 80a5ba773..7ecbbd89f 100644 --- a/application/language/en-US/reports_lang.php +++ b/application/language/en-US/reports_lang.php @@ -7,6 +7,7 @@ $lang["reports_categories_summary_report"] = "Categories Summary Report"; $lang["reports_category"] = "Category"; $lang["reports_code_canceled"] = "CNL"; $lang["reports_code_invoice"] = "INV"; +$lang["reports_code_pos"] = "POS"; $lang["reports_code_quote"] = "Q"; $lang["reports_code_return"] = "RET"; $lang["reports_code_type"] = "Type"; diff --git a/application/models/reports/Detailed_sales.php b/application/models/reports/Detailed_sales.php index 95f7dae12..47c619592 100644 --- a/application/models/reports/Detailed_sales.php +++ b/application/models/reports/Detailed_sales.php @@ -70,6 +70,7 @@ class Detailed_sales extends Report { $this->db->select('sale_id, MAX(CASE + WHEN sale_type = ' . SALE_TYPE_POS . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_pos') . '\' WHEN sale_type = ' . SALE_TYPE_INVOICE . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_invoice') . '\' WHEN sale_type = ' . SALE_TYPE_WORK_ORDER . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_work_order') . '\' WHEN sale_type = ' . SALE_TYPE_QUOTE . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_quote') . '\' diff --git a/application/models/reports/Specific_customer.php b/application/models/reports/Specific_customer.php index 7ec5ab0df..b27ffbe5d 100644 --- a/application/models/reports/Specific_customer.php +++ b/application/models/reports/Specific_customer.php @@ -48,6 +48,7 @@ class Specific_customer extends Report { $this->db->select('sale_id, MAX(CASE + WHEN sale_type = ' . SALE_TYPE_POS . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_pos') . '\' WHEN sale_type = ' . SALE_TYPE_INVOICE . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_invoice') . '\' WHEN sale_type = ' . SALE_TYPE_WORK_ORDER . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_work_order') . '\' WHEN sale_type = ' . SALE_TYPE_QUOTE . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_quote') . '\' diff --git a/application/models/reports/Specific_discount.php b/application/models/reports/Specific_discount.php index 797a9485f..922702238 100755 --- a/application/models/reports/Specific_discount.php +++ b/application/models/reports/Specific_discount.php @@ -49,6 +49,7 @@ class Specific_discount extends Report { $this->db->select('sale_id, MAX(CASE + WHEN sale_type = ' . SALE_TYPE_POS . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_pos') . '\' WHEN sale_type = ' . SALE_TYPE_INVOICE . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_invoice') . '\' WHEN sale_type = ' . SALE_TYPE_WORK_ORDER . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_work_order') . '\' WHEN sale_type = ' . SALE_TYPE_QUOTE . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_quote') . '\' diff --git a/application/models/reports/Specific_employee.php b/application/models/reports/Specific_employee.php index 4d8f0a3ce..91a651b7f 100644 --- a/application/models/reports/Specific_employee.php +++ b/application/models/reports/Specific_employee.php @@ -48,6 +48,7 @@ class Specific_employee extends Report { $this->db->select('sale_id, MAX(CASE + WHEN sale_type = ' . SALE_TYPE_POS . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_pos') . '\' WHEN sale_type = ' . SALE_TYPE_INVOICE . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_invoice') . '\' WHEN sale_type = ' . SALE_TYPE_WORK_ORDER . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_work_order') . '\' WHEN sale_type = ' . SALE_TYPE_QUOTE . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_quote') . '\' diff --git a/application/views/reports/specific_customer_input.php b/application/views/reports/specific_customer_input.php new file mode 100644 index 000000000..a55b65aa1 --- /dev/null +++ b/application/views/reports/specific_customer_input.php @@ -0,0 +1,69 @@ +load->view("partial/header"); ?> + + + + +
lang->line('reports_report_input'); ?>
+ +".$error.""; +} +?> + +'item_form', 'enctype'=>'multipart/form-data', 'class'=>'form-horizontal')); ?> +
+ lang->line('reports_date_range'), 'report_date_range_label', array('class'=>'control-label col-xs-2 required')); ?> +
+ 'daterangepicker', 'class'=>'form-control input-sm', 'id'=>'daterangepicker')); ?> +
+
+ +
+ 'required control-label col-xs-2')); ?> +
+ +
+
+ +
+ lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required control-label col-xs-2')); ?> +
+ +
+
+ +
+ lang->line('reports_payment_type'), 'reports_payment_type_label', array('class'=>'required control-label col-xs-2')); ?> +
+ +
+
+ + 'generate_report', + 'id'=>'generate_report', + 'content'=>$this->lang->line('common_submit'), + 'class'=>'btn btn-primary btn-sm') + ); + ?> + + +load->view("partial/footer"); ?> + +