620 lines
18 KiB
PHP
620 lines
18 KiB
PHP
<?php
|
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
/*
|
|
* InvoicePlane
|
|
*
|
|
* @author InvoicePlane Developers & Contributors
|
|
* @copyright Copyright (c) 2012 - 2017 InvoicePlane.com
|
|
* @license https://invoiceplane.com/license.txt
|
|
* @link https://invoiceplane.com
|
|
*/
|
|
|
|
/**
|
|
* Class Reports
|
|
*/
|
|
class Reports extends Admin_Controller
|
|
{
|
|
/**
|
|
* Reports constructor.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->load->model('mdl_reports');
|
|
}
|
|
|
|
public function sales_by_client()
|
|
{
|
|
$this->load->model('invoices/mdl_items');
|
|
$this->load->model('invoices/mdl_invoices');
|
|
|
|
if ($this->input->post('btn_subm')) {
|
|
|
|
|
|
$ab=$this->input->post('financialyear');
|
|
$a=substr($ab,0,-5);
|
|
$b=substr($ab,5,5);
|
|
$c=$this->input->post('month');
|
|
$client=$this->input->post('client_name');
|
|
$data = array(
|
|
'from_date' => $this->input->post('from_date'),
|
|
'to_date' => $this->input->post('to_date'),
|
|
'results' => $this->mdl_reports->sales_by_client($this->input->post('from_date'), $this->input->post('to_date'),$a,$b,$c,$client),
|
|
|
|
);
|
|
|
|
$html = $this->load->view('reports/sales_by_client', $data, true);
|
|
}
|
|
$data = array(
|
|
|
|
'result' => $this->mdl_items->fiscalYear(),
|
|
'customer' => $this->mdl_items->customer(),
|
|
//'months' => $this->mdl_items->selectmonth()
|
|
);
|
|
$html = $this->load->view('reports/sales_by_client', $data, true);
|
|
$this->layout->buffer('content', 'reports/sales_by_client_index')->render();
|
|
}
|
|
|
|
public function payment_history()
|
|
{
|
|
if ($this->input->post('btn_submit')) {
|
|
$data = array(
|
|
'results' => $this->mdl_reports->payment_history($this->input->post('from_date'), $this->input->post('to_date')),
|
|
'from_date' => $this->input->post('from_date'),
|
|
'to_date' => $this->input->post('to_date'),
|
|
);
|
|
|
|
$html = $this->load->view('reports/payment_history', $data, true);
|
|
|
|
$this->load->helper('mpdf');
|
|
|
|
pdf_create($html, trans('payment_history'), true);
|
|
}
|
|
if ($this->input->post('btn_subm')) {
|
|
$data = array(
|
|
'results' => $this->mdl_reports->payment_history($this->input->post('from_date'), $this->input->post('to_date')),
|
|
'from_date' => $this->input->post('from_date'),
|
|
'to_date' => $this->input->post('to_date'),
|
|
);
|
|
|
|
$html = $this->load->view('reports/payment_history', $data, true);
|
|
|
|
$this->load->helper('mpdf');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->layout->buffer('content', 'reports/payment_history_index')->render();
|
|
}
|
|
|
|
public function invoice_aging()
|
|
{
|
|
//$this->load->model('invoices/mdl_items');
|
|
|
|
if ($this->input->post('btn_submit')) {
|
|
$data = array(
|
|
'results' => $this->mdl_reports->invoice_aging()
|
|
);
|
|
|
|
$html = $this->load->view('reports/invoice_aging', $data, true);
|
|
|
|
$this->load->helper('mpdf');
|
|
pdf_create($html, trans('invoice_aging'), true);
|
|
|
|
//echo $html;exit;
|
|
|
|
}
|
|
|
|
$data = array(
|
|
'results' => $this->mdl_reports->invoice_aging(),
|
|
//'result' => $this->mdl_items->fiscalYear()
|
|
);
|
|
|
|
$html = $this->load->view('reports/invoice_aging', $data, true);
|
|
|
|
$this->layout->buffer('content', 'reports/invoice_aging_index')->render();
|
|
}
|
|
|
|
|
|
public function sales_by_year()
|
|
{
|
|
|
|
if ($this->input->post('btn_submit')) {
|
|
$data = array(
|
|
'results' => $this->mdl_reports->sales_by_year($this->input->post('from_date'), $this->input->post('to_date')),
|
|
'from_date' => $this->input->post('from_date'),
|
|
'to_date' => $this->input->post('to_date'),
|
|
);
|
|
|
|
$html = $this->load->view('reports/sales_by_year', $data, true);
|
|
|
|
$this->load->helper('mpdf');
|
|
|
|
pdf_create($html, trans('sales_by_date'), true);
|
|
}
|
|
if ($this->input->post('btn_subm')) {
|
|
$data = array(
|
|
'results' => $this->mdl_reports->sales_by_year($this->input->post('from_date'), $this->input->post('to_date')),
|
|
'from_date' => $this->input->post('from_date'),
|
|
'to_date' => $this->input->post('to_date'),
|
|
);
|
|
|
|
$html = $this->load->view('reports/sales_by_year', $data, true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
$this->layout->buffer('content', 'reports/sales_by_year_index')->render();
|
|
}
|
|
public function sales()
|
|
{
|
|
$this->load->model('invoices/mdl_items');
|
|
if ($this->input->post('btn_submit')) {
|
|
|
|
$cust = $this->input->post('client_name');
|
|
$prod = $this->input->post('item_name');
|
|
$ab=$this->input->post('financialyear');
|
|
$a=substr($ab,0,-5);
|
|
$b=substr($ab,5,5);
|
|
$c=$this->input->post('month');
|
|
$from = $this->input->post('from_date');
|
|
$to = $this->input->post('to_date');
|
|
$data = array(
|
|
|
|
'cname' => $this->input->get('client_name'),
|
|
'fin' => $this->input->get('ab'),
|
|
'm' => $this->input->get('month'),
|
|
'frm' => $this->input->get('from_date'),
|
|
't' => $this->input->get('to_date'),
|
|
'datec' => $this->input->get('d'),
|
|
'dmon' => $this->input->get('dmon'),
|
|
'item_name' => $this->mdl_items->item_name(),
|
|
'customer' => $this->mdl_items->customer(),
|
|
'results' => $this->mdl_reports->sales($cust,$prod,$a,$b,$c,$from,$to),
|
|
|
|
);
|
|
|
|
$html = $this->load->view('reports/sales', $data, true);
|
|
}
|
|
|
|
$data = array(
|
|
'from_date' => $this->input->post('from_date'),
|
|
'to_date' => $this->input->post('to_date'),
|
|
'customer' => $this->mdl_items->customer(),
|
|
'result' => $this->mdl_items->fiscalYear(),
|
|
'item_name' => $this->mdl_items->item_name(),
|
|
);
|
|
$html = $this->load->view('reports/sales', $data, true);
|
|
$this->layout->buffer('content', 'reports/sales');
|
|
$this->layout->render();
|
|
}
|
|
public function year_wise()
|
|
{
|
|
$this->load->model('invoices/mdl_items');
|
|
|
|
if ($this->input->post('btn_submit')) {
|
|
|
|
$ab=$this->input->post('financialyear');
|
|
$a=substr($ab,0,-5);
|
|
$b=substr($ab,5,5);
|
|
//echo $b;die();
|
|
$data = array(
|
|
'results' => $this->mdl_items->year_wise($a,$b)
|
|
);
|
|
|
|
$html = $this->load->view('reports/year_wise_pdf', $data, true);
|
|
|
|
|
|
// $this->layout->buffer('content', 'reports/year_wise')->render();
|
|
|
|
//echo $html;exit;
|
|
|
|
}
|
|
$data = array(
|
|
// 'results' => $this->mdl_items->year_wise(),
|
|
'result' => $this->mdl_items->fiscalYear()
|
|
);
|
|
|
|
$html = $this->load->view('reports/year_wise', $data, true);
|
|
|
|
|
|
$this->layout->buffer('content', 'reports/year_wise')->render();
|
|
}
|
|
public function month_wise()
|
|
{
|
|
$this->load->model('invoices/mdl_items');
|
|
|
|
|
|
//if ($this->input->post('btn_submit'))
|
|
$last = $this->input->get('date');
|
|
//$last = $this->input->get('date');
|
|
//$last = $this->uri->total_segments();
|
|
// $month=$this->uri->segment($last);
|
|
// $new = date("m",strtotime($month));
|
|
// echo $last;die();
|
|
//echo $data;
|
|
$data = array(
|
|
'results' => $this->mdl_items->month_wise($last)
|
|
|
|
);
|
|
|
|
$html = $this->load->view('reports/month_wise', $data, true);
|
|
|
|
|
|
$this->layout->buffer('content', 'reports/month_wise')->render();
|
|
}
|
|
public function year_wise_total()
|
|
{
|
|
$this->load->model('invoices/mdl_items');
|
|
|
|
|
|
//if ($this->input->post('btn_submit'))
|
|
$last = $this->uri->total_segments();
|
|
$month=$this->uri->segment($last);
|
|
|
|
$a=substr($month,0,-5);
|
|
$b=substr($month,5,5);
|
|
|
|
//echo $b;die();
|
|
$data = array(
|
|
//'res' => $this->input->post('year'),
|
|
'results' => $this->mdl_items->year_wise_total($a,$b)
|
|
|
|
);
|
|
|
|
$html = $this->load->view('reports/year_wise_total', $data, true);
|
|
|
|
|
|
$this->layout->buffer('content', 'reports/year_wise_total')->render();
|
|
}
|
|
public function selectmonth()
|
|
{
|
|
//echo 'hi';
|
|
$this->load->model('invoices/mdl_items');
|
|
|
|
|
|
$ab=$this->input->post('ab');
|
|
$a=substr($ab,0,-5);
|
|
$b=substr($ab,5,5);
|
|
//echo $a;die();
|
|
|
|
|
|
|
|
$results = $this->mdl_items->selectmonth($a,$b);
|
|
$d=json_encode($results);
|
|
echo $d;
|
|
|
|
|
|
}
|
|
public function cumulative_report()
|
|
{
|
|
$data['year'] = $this->mdl_reports->cumulative_report();
|
|
|
|
$html = $this->load->view('reports/cumulative_report', $data, true);
|
|
|
|
$this->layout->buffer('content', 'reports/cumulative_report')->render();
|
|
}
|
|
|
|
public function cumulative_report_year()
|
|
{
|
|
|
|
|
|
$last = $this->uri->segment_array();
|
|
|
|
$clientid = $last[3];
|
|
if(!empty($last[4])){
|
|
$productid = $last[4];
|
|
}else {$productid = null;}
|
|
|
|
|
|
$data['year'] = $this->mdl_reports->cumulative_report_year($clientid,$productid);
|
|
|
|
$html = $this->load->view('reports/cumulative_report_year', $data, true);
|
|
|
|
$this->layout->buffer('content', 'reports/cumulative_report_year')->render();
|
|
}
|
|
|
|
public function cumulative_report_month()
|
|
{
|
|
|
|
$last = $this->uri->segment_array();
|
|
|
|
$clientid = $last[3];
|
|
if(!empty($last[4])){
|
|
$productid = $last[4];
|
|
}else {$productid = null;}
|
|
$data['year'] = $this->mdl_reports->cumulative_report_month($clientid,$productid);
|
|
|
|
$html = $this->load->view('reports/cumulative_report_month', $data, true);
|
|
|
|
$this->layout->buffer('content', 'reports/cumulative_report_month')->render();
|
|
}
|
|
|
|
public function cumulative_report_day()
|
|
{
|
|
|
|
$last = $this->uri->segment_array();
|
|
|
|
$clientid = $last[3];
|
|
if(!empty($last[4])){
|
|
$productid = $last[4];
|
|
}else {$productid = null;}
|
|
$data['year'] = $this->mdl_reports->cumulative_report_day($clientid,$productid);
|
|
$html = $this->load->view('reports/cumulative_report_day', $data, true);
|
|
|
|
$this->layout->buffer('content', 'reports/cumulative_report_day')->render();
|
|
}
|
|
public function link_sales()
|
|
{
|
|
|
|
$this->load->model('invoices/mdl_items');
|
|
if ($this->input->post('btn_submit')) {
|
|
|
|
|
|
$cname = $this->input->post('client_name');
|
|
$prod = $this->input->post('item_name');
|
|
$ab=$this->input->post('financialyear');
|
|
$fa=substr($ab,0,-5);
|
|
$aa=substr($ab,5,5);
|
|
$m=$this->input->post('month');
|
|
$frm = $this->input->post('from_date');
|
|
$t = $this->input->post('to_date');
|
|
$datec = $this->input->get('d');
|
|
$dmon = $this->input->get('dmon');
|
|
|
|
// echo $from;
|
|
// echo $to;die();
|
|
$data = array(
|
|
'cname' => $this->input->get('client_name'),
|
|
'fin' => $this->input->get('ab'),
|
|
'm' => $this->input->get('month'),
|
|
'frm' => $this->input->get('from_date'),
|
|
't' => $this->input->get('to_date'),
|
|
'datec' => $this->input->get('d'),
|
|
'dmon' => $this->input->get('dmon'),
|
|
'from_date' => $this->input->post('from_date'),
|
|
'to_date' => $this->input->post('to_date'),
|
|
'customer' => $this->mdl_items->customer(),
|
|
'result' => $this->mdl_items->fiscalYear(),
|
|
'item_name' => $this->mdl_items->item_name(),
|
|
'results' => $this->mdl_reports->sales_l($cname,$fa,$aa,$m,$frm,$t,$prod,$datec,$dmon),
|
|
|
|
);
|
|
|
|
$html = $this->load->view('reports/sales', $data, true);
|
|
}
|
|
else{
|
|
$cname = $this->input->get('client_name');
|
|
$cid = $this->input->get('client_id');
|
|
$fin = $this->input->get('ab');
|
|
$fa=substr($fin,0,-5);
|
|
$aa=substr($fin,5,5);
|
|
$m = $this->input->get('month');
|
|
$frm = $this->input->get('from_date');
|
|
$t = $this->input->get('to_date');
|
|
$datec = $this->input->get('d');
|
|
$dmon = $this->input->get('dmon');
|
|
$prod = $this->input->get('item_name');
|
|
|
|
$data = array(
|
|
'cname' => $this->input->get('client_name'),
|
|
'fin' => $this->input->get('ab'),
|
|
'm' => $this->input->get('month'),
|
|
'frm' => $this->input->get('from_date'),
|
|
't' => $this->input->get('to_date'),
|
|
'datec' => $this->input->get('d'),
|
|
'dmon' => $this->input->get('dmon'),
|
|
'from_date' => $this->input->post('from_date'),
|
|
'to_date' => $this->input->post('to_date'),
|
|
'customer' => $this->mdl_items->customer(),
|
|
'result' => $this->mdl_items->fiscalYear(),
|
|
'item_name' => $this->mdl_items->item_name(),
|
|
'results' => $this->mdl_reports->sales_l($cname,$fa,$aa,$m,$frm,$t,$prod,$datec,$dmon,$cid),
|
|
);
|
|
|
|
$html = $this->load->view('reports/sales', $data, true);
|
|
}
|
|
$this->layout->buffer('content', 'reports/sales');
|
|
$this->layout->render();
|
|
}
|
|
public function consolidate_sales()
|
|
{
|
|
$this->load->model('invoices/mdl_items');
|
|
if ($this->input->post('btn_submit')) {
|
|
$cname = $this->input->post('client_name');
|
|
$ab=$this->input->post('financialyear');
|
|
$fa=substr($ab,0,-5);
|
|
$aa=substr($ab,5,5);
|
|
$data['customer'] = $this->mdl_items->customer();
|
|
$data['result'] = $this->mdl_items->fiscalYear();
|
|
$data['results'] = $this->mdl_reports->consolidate_sales($fa,$aa,$cname);
|
|
$html = $this->load->view('reports/consolidate_sales', $data, true);
|
|
}
|
|
$data['customer'] = $this->mdl_items->customer();
|
|
$data['result'] = $this->mdl_items->fiscalYear();
|
|
$html = $this->load->view('reports/consolidate_sales', $data, true);
|
|
|
|
$this->layout->buffer('content', 'reports/consolidate_sales')->render();
|
|
}
|
|
|
|
|
|
|
|
//this function used to all invoice controller---Rajasekar--
|
|
public function all_invoice()
|
|
{
|
|
|
|
if ($this->input->post('btn_submit')) {
|
|
$ab=$this->input->post('financialyear');
|
|
$fa=substr($ab,0,-5);
|
|
$aa=substr($ab,5,5);
|
|
$m=$this->input->post('month');
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
//echo $b;die();
|
|
$data = array(
|
|
'results' => $this->mdl_reports->all_invoice($fa,$aa,$m)
|
|
);
|
|
|
|
}
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
$html = $this->load->view('reports/all_invoice', $data, true);
|
|
$this->layout->buffer('content', 'reports/all_invoice')->render();
|
|
}
|
|
|
|
|
|
|
|
|
|
public function gstin_wise()
|
|
{
|
|
if ($this->input->post('btn_submit')) {
|
|
$ab=$this->input->post('financialyear');
|
|
$fa=substr($ab,0,-5);
|
|
$aa=substr($ab,5,5);
|
|
$m=$this->input->post('month');
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
$data = array(
|
|
'results' => $this->mdl_reports->gstin_wise($fa,$aa,$m)
|
|
);
|
|
|
|
}
|
|
//$data['gstin'] = $this->mdl_reports->gstin_wise($fa,$aa,$m);
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
|
|
$html = $this->load->view('reports/gstin_wise', $data, true);
|
|
|
|
$this->layout->buffer('content', 'reports/gstin_wise')->render();
|
|
}
|
|
|
|
public function hsn_wise()
|
|
{
|
|
if ($this->input->post('btn_submit')) {
|
|
$ab=$this->input->post('financialyear');
|
|
$fa=substr($ab,0,-5);
|
|
//echo $fa;
|
|
$aa=substr($ab,5,5);
|
|
//echo $aa;
|
|
$m=$this->input->post('month');
|
|
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
|
|
$data = array(
|
|
'results' => $this->mdl_reports->hsn_wise($fa,$aa,$m)
|
|
);
|
|
}
|
|
|
|
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
$html = $this->load->view('reports/hsn_wise', $data, true);
|
|
|
|
$this->layout->buffer('content', 'reports/hsn_wise')->render();
|
|
}
|
|
|
|
|
|
|
|
|
|
public function customer_wise()
|
|
{
|
|
|
|
$ab=$this->input->post('financialyear');
|
|
//echo $ab;
|
|
$fa=substr($ab,0,-5);
|
|
//echo $fa;
|
|
$aa=substr($ab,5,5);
|
|
//echo $aa;
|
|
$m=$this->input->post('month');
|
|
|
|
$fin= $this->input->get('ab');
|
|
//echo $ab;
|
|
$by=substr($fin,0,-6);
|
|
//echo $by;
|
|
$ay=substr($fin,5,4);
|
|
//echo $ay;
|
|
$cname= $this->input->get('client_id');
|
|
//echo $cname;
|
|
$month= $this->input->get('m');
|
|
|
|
$data['customerized'] = $this->mdl_reports->customer_wise($fa,$aa,$m,$by,$ay,$month,$cname);
|
|
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
|
|
$html = $this->load->view('reports/customer_wise',$data, true);
|
|
|
|
$this->layout->buffer('content','reports/customer_wise')->render();
|
|
}
|
|
|
|
public function hsn_san()
|
|
{
|
|
|
|
|
|
$ab=$this->input->post('financialyear');
|
|
$fa=substr($ab,0,-5);
|
|
$aa=substr($ab,5,5);
|
|
$m=$this->input->post('month');
|
|
|
|
$fin= $this->input->get('ab');
|
|
$by=substr($fin,0,-6);
|
|
$ay=substr($fin,5,4);
|
|
$month= $this->input->get('m');
|
|
$hsncode= $this->input->get('HSN_code');
|
|
|
|
|
|
$data['hsnsan'] = $this->mdl_reports->hsn_san($fa,$aa,$m,$by,$ay,$month,$hsncode);
|
|
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
|
|
$html = $this->load->view('reports/hsn_san',$data, true);
|
|
|
|
$this->layout->buffer('content','reports/hsn_san')->render();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//this function used to deliver Performance --rajasekar
|
|
|
|
public function deliver_perform()
|
|
{
|
|
|
|
|
|
if ($this->input->post('btn_submit')) {
|
|
|
|
|
|
$ab=$this->input->post('financialyear');
|
|
//echo $ab;
|
|
$fa=substr($ab,0,-5);
|
|
//echo $fa;
|
|
$aa=substr($ab,5,5);
|
|
//echo $aa;
|
|
$m=$this->input->post('month');
|
|
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
|
|
|
|
|
|
$data = array(
|
|
'results' => $this->mdl_reports->deliver_perform($fa,$aa,$m)
|
|
);
|
|
}
|
|
|
|
|
|
|
|
|
|
$data['fin'] = $this->mdl_reports->fincalYear();
|
|
|
|
$html = $this->load->view('reports/deliver_perform',$data, true);
|
|
|
|
$this->layout->buffer('content','reports/deliver_perform')->render();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} |