This commit is contained in:
jekkos
2015-09-12 20:16:46 +02:00
14 changed files with 198 additions and 7 deletions

View File

@@ -50,6 +50,8 @@ $route['reports/(graphical_:any)/(:any)/(:any)'] = "reports/$1/$2/$3";
$route['reports/graphical_:any'] = "reports/date_input";
$route['reports/(inventory_:any)/(:any)'] = "reports/$1/$2";
$route['reports/inventory_:any'] = "reports/excel_export";
$route['reports/inventory_summary'] = "reports/inventory_summary_input";
$route['reports/(inventory_summary)/(:any)/(:any)/(:any)'] = "reports/$1/$2/$3/$4";
$route['reports/(detailed_sales)/(:any)/(:any)/(:any)'] = "reports/$1/$2/$3$/$4";
$route['reports/detailed_sales'] = "reports/date_input_sales";

View File

@@ -972,15 +972,38 @@ class Reports extends Secure_area
$this->load->view("reports/tabular",$data);
}
function inventory_summary($export_excel=0)
function inventory_summary_input()
{
$data = array();
$this->load->model('reports/Inventory_Summary');
$model = $this->Inventory_Summary;
$data['item_count'] = $model->getItemCountDropdownArray();
$stock_locations = $this->Stock_locations->get_allowed_locations();
$stock_locations['all'] = $this->lang->line('reports_all');
$data['stock_locations'] = array_reverse($stock_locations, TRUE);
$this->load->view("reports/inventory_summary_input", $data);
}
function inventory_summary($export_excel=0, $location_id = 'all', $item_count = 'all')
{
$this->load->model('reports/Inventory_summary');
$model = $this->Inventory_summary;
$tabular_data = array();
$report_data = $model->getData(array());
$report_data = $model->getData(array('location_id'=>$location_id,'item_count'=>$item_count));
foreach($report_data as $row)
{
$tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level'],$row['location_name']);
$tabular_data[] = array($row['name'],
$row['item_number'],
$row['description'],
$row['quantity'],
$row['reorder_level'],
$row['location_name'],
to_currency($row['cost_price']),
to_currency($row['unit_price']),
to_currency($row['sub_total_value']));
}
$data = array(
@@ -988,7 +1011,7 @@ class Reports extends Secure_area
"subtitle" => '',
"headers" => $model->getDataColumns(),
"data" => $tabular_data,
"summary_data" => $model->getSummaryData(array()),
"summary_data" => $model->getSummaryData($report_data),
"export_excel" => $export_excel
);

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "Total";
$lang["reports_type"] = "Type";
$lang["reports_welcome_message"] = "Welcome to the reports panel. Please select a report to view.";
$lang["reports_yesterday"] = "Yesterday";
$lang["reports_item_count"] = "Filter Item Count";
$lang["reports_cost_price"] = "Cost Price";
$lang["reports_unit_price"] = "Retail Price";
$lang["reports_sub_total_value"] = "Sub Total";
$lang["reports_total_inventory_value"] = "Total Inventory Value";
$lang["reports_zero_and_less"] = "Zero and less";
$lang["reports_more_than_zero"] = "More than zero";

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "Total";
$lang["reports_type"] = "Tipo";
$lang["reports_welcome_message"] = "Bienvenido(a) al panel de reportes. Selecciona un reporte para verlo.";
$lang["reports_yesterday"] = "Ayer";
$lang["reports_item_count"] = "";
$lang["reports_cost_price"] = "Precio de Compra";
$lang["reports_unit_price"] = "Precio de Venta";
$lang["reports_sub_total_value"] = "Subtotal";
$lang["reports_total_inventory_value"] = "";
$lang["reports_zero_and_less"] = "";
$lang["reports_more_than_zero"] = "";

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "Total";
$lang["reports_type"] = "Type";
$lang["reports_welcome_message"] = "Bienvenue à la page des rapports. Veuillez sélectionner un rapport à visualiser.";
$lang["reports_yesterday"] = "Hier";
$lang["reports_item_count"] = "";
$lang["reports_cost_price"] = "Prix de Gros";
$lang["reports_unit_price"] = "Prix au Détail";
$lang["reports_sub_total_value"] = "Sous-Total";
$lang["reports_total_inventory_value"] = "";
$lang["reports_zero_and_less"] = "";
$lang["reports_more_than_zero"] = "";

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "Total";
$lang["reports_type"] = "Tipe";
$lang["reports_welcome_message"] = "Selamat Datang ke panel laporan. Silakan pilih laporan untuk melihat/cetak.";
$lang["reports_yesterday"] = "Kemarin";
$lang["reports_item_count"] = "";
$lang["reports_cost_price"] = "Harga Pokok";
$lang["reports_unit_price"] = "Harga Jual";
$lang["reports_sub_total_value"] = "Sub Total";
$lang["reports_total_inventory_value"] = "Total Nilai Persediaan";
$lang["reports_zero_and_less"] = "Stok habis dan minus";
$lang["reports_more_than_zero"] = "Stok belum habis";

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "Totaal";
$lang["reports_type"] = "Type";
$lang["reports_welcome_message"] = "Welkom bij de rapporten. Selecteer hier een rapport.";
$lang["reports_yesterday"] = "Gisteren";
$lang["reports_item_count"] = "";
$lang["reports_cost_price"] = "Aankoopprijs";
$lang["reports_unit_price"] = "Verkoopprijs";
$lang["reports_sub_total_value"] = "Subtotaal";
$lang["reports_total_inventory_value"] = "";
$lang["reports_zero_and_less"] = "";
$lang["reports_more_than_zero"] = "";

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "сумма";
$lang["reports_type"] = "тип";
$lang["reports_welcome_message"] = "Добро пожаловать в панель отчетов. Пожалуйста, выберите отчет для просмотра.";
$lang["reports_yesterday"] = "вчера";
$lang["reports_item_count"] = "";
$lang["reports_cost_price"] = "Оптовая Цена";
$lang["reports_unit_price"] = "Розничная Цена";
$lang["reports_sub_total_value"] = "промежуточный итог";
$lang["reports_total_inventory_value"] = "";
$lang["reports_zero_and_less"] = "";
$lang["reports_more_than_zero"] = "";

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "ยอดรวม";
$lang["reports_type"] = "ชนิด";
$lang["reports_welcome_message"] = "ยินดีต้อนรับเข้าสู่รายงาน. โปรดเลือกชนิดของรายงาน.";
$lang["reports_yesterday"] = "เมื่อวานนี้";
$lang["reports_item_count"] = "";
$lang["reports_cost_price"] = "ราคาทุน";
$lang["reports_unit_price"] = "ราคาขาย";
$lang["reports_sub_total_value"] = "ยอดรวมหักภาษี ";
$lang["reports_total_inventory_value"] = "";
$lang["reports_zero_and_less"] = "";
$lang["reports_more_than_zero"] = "";

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "Toplam";
$lang["reports_type"] = "Tür";
$lang["reports_welcome_message"] = "Rapor paneline hoş geldiniz. Görmek istediğiniz raporu seçiniz.";
$lang["reports_yesterday"] = "Dün";
$lang["reports_item_count"] = "Filter Stok Habis/Belum Habis/Minus";
$lang["reports_cost_price"] = "Maliyet Fiyatı";
$lang["reports_unit_price"] = "Satış Fiyatı";
$lang["reports_sub_total_value"] = "Ara Toplam";
$lang["reports_total_inventory_value"] = "";
$lang["reports_zero_and_less"] = "";
$lang["reports_more_than_zero"] = "";

View File

@@ -95,3 +95,10 @@ $lang["reports_total"] = "總計";
$lang["reports_type"] = "類型";
$lang["reports_welcome_message"] = "歡迎使用報表系統。請選擇要查看的報表。";
$lang["reports_yesterday"] = "昨天";
$lang["reports_item_count"] = "";
$lang["reports_cost_price"] = "成本價";
$lang["reports_unit_price"] = "單價";
$lang["reports_sub_total_value"] = "小計";
$lang["reports_total_inventory_value"] = "";
$lang["reports_zero_and_less"] = "";
$lang["reports_more_than_zero"] = "";

View File

@@ -9,7 +9,15 @@ class Inventory_summary extends Report
public function getDataColumns()
{
return array($this->lang->line('reports_item_name'), $this->lang->line('reports_item_number'), $this->lang->line('reports_description'), $this->lang->line('reports_count'), $this->lang->line('reports_reorder_level'), $this->lang->line('reports_stock_location'));
return array($this->lang->line('reports_item_name'),
$this->lang->line('reports_item_number'),
$this->lang->line('reports_description'),
$this->lang->line('reports_count'),
$this->lang->line('reports_reorder_level'),
$this->lang->line('reports_stock_location'),
$this->lang->line('reports_cost_price'),
$this->lang->line('reports_unit_price'),
$this->lang->line('reports_sub_total_value'));
}
public function getData(array $inputs)
@@ -17,16 +25,55 @@ class Inventory_summary extends Report
$this->db->from('items');
$this->db->join('item_quantities','items.item_id=item_quantities.item_id');
$this->db->join('stock_locations','item_quantities.location_id=stock_locations.location_id');
$this->db->select('name, item_number, reorder_level, item_quantities.quantity, description, location_name');
$this->db->select('name, item_number, reorder_level, item_quantities.quantity, description, location_name, cost_price, unit_price, (cost_price*quantity) as sub_total_value');
$this->db->where('items.deleted', 0);
// should be corresponding to values Inventory_summary::getItemCountDropdownArray() returns...
if($inputs['item_count'] == 'zero_and_less')
{
$this->db->where('quantity <=', 0);
}
elseif($inputs['item_count'] == 'more_than_zero')
{
$this->db->where('quantity >', 0);
}
if($inputs['location_id'] != 'all')
{
$this->db->where('item_quantities.location_id',$inputs['location_id']);
}
$this->db->order_by('name');
return $this->db->get()->result_array();
}
/**
* calulcates the total value of the given inventory summary by summing all sub_total_values (see Inventory_summary::getData())
*
* @param array $inputs expects the reports-data-array which Inventory_summary::getData() returns
* @return array
*/
public function getSummaryData(array $inputs)
{
return array();
$return = array('total_inventory_value' => 0);
foreach($inputs as $input)
{
$return['total_inventory_value'] += $input['sub_total_value'];
}
return $return;
}
/**
* returns the array for the dropdown-element item-count in the form for the inventory summary-report
*
* @return array
*/
public function getItemCountDropdownArray()
{
return array(
'all' => $this->lang->line('reports_all'),
'zero_and_less' => $this->lang->line('reports_zero_and_less'),
'more_than_zero' => $this->lang->line('reports_more_than_zero'));
}
}
?>

View File

@@ -0,0 +1,49 @@
<?php $this->load->view("partial/header"); ?>
<div id="page_title" style="margin-bottom:8px;"><?php echo $this->lang->line('reports_report_input'); ?></div>
<?php
if(isset($error))
{
echo "<div class='error_message'>".$error."</div>";
}
?>
<div>
Export to Excel: <input type="radio" name="export_excel" id="export_excel_yes" value='1' /> Yes
<input type="radio" name="export_excel" id="export_excel_no" value='0' checked='checked' /> No
</div>
<?php echo form_label($this->lang->line('reports_stock_location'), 'reports_stock_location_label', array('class'=>'required')); ?>
<div id='report_stock_location'>
<?php echo form_dropdown('stock_location',$stock_locations,'all','id="location_id"'); ?>
</div>
<?php echo form_label($this->lang->line('reports_item_count'), 'reports_item_count_label', array('class'=>'required')); ?>
<div id='report_item_count'>
<?php echo form_dropdown('item_count',$item_count,'all','id="item_count"'); ?>
</div>
<?php
echo form_button(array(
'name'=>'generate_report',
'id'=>'generate_report',
'content'=>$this->lang->line('common_submit'),
'class'=>'submit_button')
);
?>
<?php $this->load->view("partial/footer"); ?>
<script type="text/javascript" language="javascript">
$(document).ready(function()
{
$("#generate_report").click(function()
{
var export_excel = 0;
if ($("#export_excel_yes").attr('checked'))
{
export_excel = 1;
}
window.location = window.location+'/' + export_excel + '/' + $("#location_id").val() + '/' + $("#item_count").val();
});
});
</script>

View File

@@ -94,3 +94,10 @@ reports_total,Totaal,Total,Total,Total,總計,сумма,ยอดรวม,Topl
reports_type,Type,Tipo,Type,Type,類型,тип,ชนิด,Tür,Tipe
reports_welcome_message,Welkom bij de rapporten. Selecteer hier een rapport.,Bienvenido(a) al panel de reportes. Selecciona un reporte para verlo.,Welcome to the reports panel. Please select a report to view.,Bienvenue à la page des rapports. Veuillez sélectionner un rapport à visualiser.,歡迎使用報表系統。請選擇要查看的報表。,"Добро пожаловать в панель отчетов. Пожалуйста, выберите отчет для просмотра.",ยินดีต้อนรับเข้าสู่รายงาน. โปรดเลือกชนิดของรายงาน.,Rapor paneline hoş geldiniz. Görmek istediğiniz raporu seçiniz.,Selamat Datang ke panel laporan. Silakan pilih laporan untuk melihat/cetak.
reports_yesterday,Gisteren,Ayer,Yesterday,Hier,昨天,вчера,เมื่อวานนี้,Dün,Kemarin
reports_item_count,,,Filter Item Count,,,,,Filter Stok Habis/Belum Habis/Minus
reports_cost_price,Aankoopprijs,Precio de Compra,Cost Price,Prix de Gros,成本價,Оптовая Цена,ราคาทุน,Maliyet Fiyatı,Harga Pokok
reports_unit_price,Verkoopprijs,Precio de Venta,Retail Price,Prix au Détail,單價,Розничная Цена,ราคาขาย,Satış Fiyatı,Harga Jual
reports_sub_total_value,Subtotaal,Subtotal,Sub Total,Sous-Total,小計,промежуточный итог,ยอดรวมหักภาษี ,Ara Toplam,Sub Total
reports_total_inventory_value,,,Total Inventory Value,,,,,,Total Nilai Persediaan
reports_zero_and_less,,,Zero and less,,,,,,Stok habis dan minus
reports_more_than_zero,,,More than zero,,,,,,Stok belum habis
1 label nl-BE es en fr zh ru th tr id
94 reports_type Type Tipo Type Type 類型 тип ชนิด Tür Tipe
95 reports_welcome_message Welkom bij de rapporten. Selecteer hier een rapport. Bienvenido(a) al panel de reportes. Selecciona un reporte para verlo. Welcome to the reports panel. Please select a report to view. Bienvenue à la page des rapports. Veuillez sélectionner un rapport à visualiser. 歡迎使用報表系統。請選擇要查看的報表。 Добро пожаловать в панель отчетов. Пожалуйста, выберите отчет для просмотра. ยินดีต้อนรับเข้าสู่รายงาน. โปรดเลือกชนิดของรายงาน. Rapor paneline hoş geldiniz. Görmek istediğiniz raporu seçiniz. Selamat Datang ke panel laporan. Silakan pilih laporan untuk melihat/cetak.
96 reports_yesterday Gisteren Ayer Yesterday Hier 昨天 вчера เมื่อวานนี้ Dün Kemarin
97 reports_item_count Filter Item Count Filter Stok Habis/Belum Habis/Minus
98 reports_cost_price Aankoopprijs Precio de Compra Cost Price Prix de Gros 成本價 Оптовая Цена ราคาทุน Maliyet Fiyatı Harga Pokok
99 reports_unit_price Verkoopprijs Precio de Venta Retail Price Prix au Détail 單價 Розничная Цена ราคาขาย Satış Fiyatı Harga Jual
100 reports_sub_total_value Subtotaal Subtotal Sub Total Sous-Total 小計 промежуточный итог ยอดรวมหักภาษี Ara Toplam Sub Total
101 reports_total_inventory_value Total Inventory Value Total Nilai Persediaan
102 reports_zero_and_less Zero and less Stok habis dan minus
103 reports_more_than_zero More than zero Stok belum habis