mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-07 07:17:43 -04:00
Update Detailed Reports. Add payment type to Specific Customer.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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') . '\'
|
||||
|
||||
@@ -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') . '\'
|
||||
|
||||
@@ -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') . '\'
|
||||
|
||||
@@ -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') . '\'
|
||||
|
||||
69
application/views/reports/specific_customer_input.php
Normal file
69
application/views/reports/specific_customer_input.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php $this->load->view("partial/header"); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
dialog_support.init("a.modal-dlg");
|
||||
</script>
|
||||
|
||||
|
||||
<div id="page_title"><?php echo $this->lang->line('reports_report_input'); ?></div>
|
||||
|
||||
<?php
|
||||
if(isset($error))
|
||||
{
|
||||
echo "<div class='alert alert-dismissible alert-danger'>".$error."</div>";
|
||||
}
|
||||
?>
|
||||
|
||||
<?php echo form_open('#', array('id'=>'item_form', 'enctype'=>'multipart/form-data', 'class'=>'form-horizontal')); ?>
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('reports_date_range'), 'report_date_range_label', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<div class="col-xs-3">
|
||||
<?php echo form_input(array('name'=>'daterangepicker', 'class'=>'form-control input-sm', 'id'=>'daterangepicker')); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm" id="report_specific_input_data">
|
||||
<?php echo form_label($specific_input_name, 'specific_input_name_label', array('class'=>'required control-label col-xs-2')); ?>
|
||||
<div class="col-xs-3">
|
||||
<?php echo form_dropdown('specific_input_data', $specific_input_data, '', 'id="specific_input_data" class="form-control"'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required control-label col-xs-2')); ?>
|
||||
<div id='report_sale_type' class="col-xs-3">
|
||||
<?php echo form_dropdown('sale_type',$sale_type_options, 'complete', 'id="input_type" class="form-control"'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('reports_payment_type'), 'reports_payment_type_label', array('class'=>'required control-label col-xs-2')); ?>
|
||||
<div class="col-xs-3">
|
||||
<?php echo form_dropdown('payment_type', $payment_type, '', 'id="input_payment_type" class="form-control"'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
echo form_button(array(
|
||||
'name'=>'generate_report',
|
||||
'id'=>'generate_report',
|
||||
'content'=>$this->lang->line('common_submit'),
|
||||
'class'=>'btn btn-primary btn-sm')
|
||||
);
|
||||
?>
|
||||
<?php echo form_close(); ?>
|
||||
|
||||
<?php $this->load->view("partial/footer"); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
<?php $this->load->view('partial/daterangepicker'); ?>
|
||||
|
||||
$("#generate_report").click(function()
|
||||
{
|
||||
window.location = [window.location, start_date, end_date, $('#specific_input_data').val(), $("#input_type").val(), $('#input_payment_type').val() || 0].join("/");
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user