1582 lines
52 KiB
PHP
Executable File
1582 lines
52 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Controllers\BaseController;
|
|
|
|
use App\Models\Dashboard_model;
|
|
|
|
use App\Models\Assetdetails_model;
|
|
use App\Models\Batchcard_model;
|
|
use App\Models\Cashbook_model;
|
|
use App\Models\Companydetails_model;
|
|
use App\Models\Config_model;
|
|
use App\Models\Costcenter_model;
|
|
use App\Models\Department_model;
|
|
use App\Models\Employeedetails_model;
|
|
use App\Models\Emppaydate_model;
|
|
use App\Models\Inwardgateregister_model;
|
|
use App\Models\Login_model;
|
|
use App\Models\Monthlypay_model;
|
|
use App\Models\Mrir_model;
|
|
use App\Models\Payroll_model;
|
|
use App\Models\Purchaseorder_model;
|
|
use App\Models\Quality_model;
|
|
use App\Models\Rawmaterialdetails_model;
|
|
use App\Models\Requistion_model;
|
|
use App\Models\Store_model;
|
|
use App\Models\Storerequistion_model;
|
|
use App\Models\Supplier_model;
|
|
use App\Models\User_model;
|
|
use App\Models\Zohobook_api_model;
|
|
|
|
/**
|
|
* Module : report
|
|
* Report Class to control all Report related operations.
|
|
* @author : Saravana kumar
|
|
* @version : 1.1
|
|
* @since : 10 Jun 2017
|
|
* @example : Revised at 15th april 2024
|
|
*/
|
|
class Report extends BaseController
|
|
{
|
|
protected $dahsboard_Model;
|
|
protected $session;
|
|
protected $logger;
|
|
/**
|
|
* This is default constructor of the class
|
|
*/
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->dahsboard_Model = new Dashboard_model();
|
|
|
|
$this->isLoggedIn();
|
|
$this->session = session();
|
|
$this->logger = service('logger');
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$this->global['pageTitle'] = 'Reports list ';
|
|
$this->loadViews("reportslink", $this->global, [], NULL);
|
|
}
|
|
|
|
public function pending_report()
|
|
{
|
|
$this->global['pageTitle'] = 'Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$frm = $this->request->getPost('from_date');
|
|
$t = $this->request->getPost('to_date');
|
|
$agf = $this->request->getPost('aging_from');
|
|
$agt = $this->request->getPost('aging_to');
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['pending_list'] = $this->dahsboard_Model->req_list($fa, $aa, $m, $frm, $t, $agf, $agt);
|
|
//print_r($data);
|
|
}
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
//print_r($data);
|
|
|
|
|
|
|
|
$this->loadviews("report_pendingreqst", $this->global, $data, NULL);
|
|
}
|
|
public function releasedPO()
|
|
{
|
|
$this->global['pageTitle'] = 'Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$frm = $this->request->getPost('from_date');
|
|
$t = $this->request->getPost('to_date');
|
|
$agf = $this->request->getPost('total_order_value_From');
|
|
$agt = $this->request->getPost('total_order_value_To');
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['rel_po'] = $this->dahsboard_Model->report_relpo($fa, $aa, $m, $frm, $t, $agf, $agt);
|
|
//print_r($data);
|
|
|
|
|
|
|
|
}
|
|
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
|
|
$this->loadviews("Report_POreleased", $this->global, $data, NULL);
|
|
}
|
|
public function openorderPO()
|
|
{
|
|
$this->global['pageTitle'] = 'Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$frm = $this->request->getPost('from_date');
|
|
$t = $this->request->getPost('to_date');
|
|
$agf = $this->request->getPost('total_order_value_From');
|
|
$agt = $this->request->getPost('total_order_value_To');
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['open_po'] = $this->dahsboard_Model->report_openpending($fa, $aa, $m, $frm, $t, $agf, $agt);
|
|
//print_r($data);
|
|
|
|
|
|
|
|
}
|
|
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
|
|
|
|
$this->loadviews("Report_openorder", $this->global, $data, NULL);
|
|
}
|
|
public function TotalOrd()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
if ($this->request->getPost('financialyear')) {
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['Total'] = $this->dahsboard_Model->report_total($fa, $aa);
|
|
}
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
|
|
$this->loadviews("Report_totalorders", $this->global, $data, NULL);
|
|
}
|
|
public function ccr()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
|
|
if ($this->request->getPost('financialyear')) {
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['ccrpt'] = $this->dahsboard_Model->report_ccr($fa, $aa);
|
|
}
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
|
|
|
|
$this->loadviews("Report_costcenter", $this->global, $data, NULL);
|
|
|
|
|
|
//print_r($data);
|
|
|
|
}
|
|
public function MM_Supplier()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
|
|
|
|
$data['mms'] = $this->dahsboard_Model->report_MMSupplier();
|
|
|
|
|
|
|
|
$this->loadviews("Report_Material_Master_SupplierWise", $this->global, $data, NULL);
|
|
}
|
|
public function MM_Item()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
|
|
|
|
$data['mmi'] = $this->dahsboard_Model->report_MMItem();
|
|
$this->loadviews("Report_Material_Master_ItemWise", $this->global, $data, NULL);
|
|
}
|
|
public function MM_ReceiptValue()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$data['month'] = $m;
|
|
$data['financialyear'] = $ab;
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['mmr'] = $this->dahsboard_Model->report_MMReceiptValue($fa, $aa, $m);
|
|
}
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
$this->loadviews("Report_Material_Master_ReceiptValue", $this->global, $data, NULL);
|
|
}
|
|
public function purchase()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$prod = $this->request->getPost('item_name');
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$frm = $this->request->getPost('from_date');
|
|
$t = $this->request->getPost('to_date');
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['purchase'] = $this->dahsboard_Model->report_purchase($cname, $prod, $fa, $aa, $m, $frm, $t);
|
|
|
|
$data['cname'] = $cname;
|
|
$data['prod'] = $prod;
|
|
$data['ab'] = $ab;
|
|
$data['m'] = $m;
|
|
$data['frm'] = $frm;
|
|
$data['t'] = $t;
|
|
|
|
}
|
|
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
|
|
$this->loadviews("Report_purchase", $this->global, $data, NULL);
|
|
}
|
|
public function link_purchase()
|
|
{
|
|
if ($this->request->getPost('btn_submit')) {
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
//$this->request->getPost('btn_submit');
|
|
$cname = $this->request->getPost('client_name');
|
|
$prod = $this->request->getPost('item_name');
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$frm = $this->request->getPost('from_date');
|
|
$t = $this->request->getPost('to_date');
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['purchase'] = $this->dahsboard_Model->report_purchase($cname, $prod, $fa, $aa, $m, $frm, $t);
|
|
} else {
|
|
$this->global['pageTitle'] = 'Reports';
|
|
//$this->request->getPost('btn_submit');
|
|
$cname = $this->request->getVar('cname');
|
|
$prod = $this->request->getVar('prod');
|
|
$ab = $this->request->getVar('ab');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getVar('month');
|
|
$frm = $this->request->getVar('frm');
|
|
$t = $this->request->getVar('t');
|
|
$sid = $this->request->getVar('sid');
|
|
$mid = $this->request->getVar('mid');
|
|
$d = $this->request->getVar('d');
|
|
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['purchase'] = $this->dahsboard_Model->report_purchase_link($cname, $prod, $fa, $aa, $m, $frm, $t, $sid, $mid, $d);
|
|
}
|
|
|
|
|
|
|
|
$this->loadviews("Report_purchase", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function year_wise()
|
|
{
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
|
|
if ($this->request->getPost('financialyear')) {
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$a = substr((string)$ab, 0, -5);
|
|
$b = substr((string)$ab, 5, 5);
|
|
$data['year'] = $this->dahsboard_Model->report_year_wise($a, $b);
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
//$this->loadviews("Report_year_wise",$this->global,$data, NULL);
|
|
}
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
|
|
|
|
$this->loadviews("Report_year_wise", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function month_wise()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
|
|
$month = $this->request->getVar('dat');
|
|
$mon = date("F", strtotime($month));
|
|
//print_r($month);
|
|
$data['mont'] = $mon;
|
|
$data['month'] = $this->dahsboard_Model->report_month_wise($month);
|
|
|
|
|
|
$this->loadviews("Report_month_wise", $this->global, $data, NULL);
|
|
}
|
|
public function year_wise_total()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
$uri = service('uri');
|
|
$last = $uri->getTotalSegments();
|
|
$month = $uri->getSegment($last);
|
|
$a = substr($month, 0, -5);
|
|
$b = substr($month, 5, 5);
|
|
//print_r($month);
|
|
$data['year'] = $month;
|
|
$data['ytotal'] = $this->dahsboard_Model->report_year_wise_total($a, $b);
|
|
|
|
|
|
$this->loadviews("Report_year_wise_total", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function purchase_supplier()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$frm = $this->request->getPost('from_date');
|
|
$t = $this->request->getPost('to_date');
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['spurchse'] = $this->dahsboard_Model->report_supplier($cname, $fa, $aa, $m, $frm, $t);
|
|
}
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
|
|
|
|
$this->loadviews("Report_supplier", $this->global, $data, NULL);
|
|
}
|
|
public function consolidate()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['spurchse'] = $this->dahsboard_Model->report_consolidate($cname, $fa, $aa);
|
|
}
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
|
|
|
|
$this->loadviews("Report_consolidate", $this->global, $data, NULL);
|
|
}
|
|
public function consolidate_month()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
//$this->request->getPost('btn_submit');
|
|
$sid = $this->request->getVar('sid');
|
|
$mid = $this->request->getVar('mid');
|
|
$cname = $this->request->getVar('cname');
|
|
$prod = $this->request->getVar('prod');
|
|
//$mat = $this->request->getVar('mid');
|
|
$m = $this->request->getVar('m');
|
|
$ab = $this->request->getVar('ab');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['spurchse'] = $this->dahsboard_Model->consolidate_month($m, $sid, $mid, $fa, $aa);
|
|
// print_r( $data['spurchse']);
|
|
|
|
$this->loadviews("Report_consolidate_m", $this->global, $data, NULL);
|
|
}
|
|
public function consolidate_year()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
//$this->request->getPost('btn_submit');
|
|
$sid = $this->request->getVar('sid');
|
|
$mid = $this->request->getVar('mid');
|
|
$cname = $this->request->getVar('cname');
|
|
$prod = $this->request->getVar('prod');
|
|
//$mat = $this->request->getVar('mid');
|
|
$ab = $this->request->getVar('ab');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['spurchse'] = $this->dahsboard_Model->consolidate_year($sid, $mid, $fa, $aa);
|
|
// print_r( $data['spurchse']);
|
|
|
|
$this->loadviews("Report_consolidate_y", $this->global, $data, NULL);
|
|
}
|
|
public function cumulative()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
//print_r($prod);
|
|
|
|
$data['cum'] = $this->dahsboard_Model->report_cumulative();
|
|
|
|
|
|
$this->loadviews("Report_cumulative", $this->global, $data, NULL);
|
|
}
|
|
public function cum_month()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
$uri = service('uri');
|
|
$last = $uri->getSegments();
|
|
|
|
$sup = $last[3];
|
|
$mat = $last[4];
|
|
//print_r($prod);
|
|
|
|
$data['cum_month'] = $this->dahsboard_Model->report_cum_month($sup, $mat);
|
|
$this->loadviews("Report_cumulative_month", $this->global, $data, NULL);
|
|
}
|
|
public function cum_year()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
$uri = service('uri');
|
|
$last = $uri->getSegments();
|
|
|
|
$sup = $last[3];
|
|
$mat = $last[4];
|
|
|
|
//print_r($sup);
|
|
|
|
$data['cum_year'] = $this->dahsboard_Model->report_cum_year($sup, $mat);
|
|
$this->loadviews("Report_cumulative_year", $this->global, $data, NULL);
|
|
}
|
|
public function cum_day()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
$uri = service('uri');
|
|
$last = $uri->getSegments();
|
|
|
|
$sup = $last[3];
|
|
$mat = $last[4];
|
|
//print_r($prod);
|
|
|
|
$data['cum_day'] = $this->dahsboard_Model->report_cum_day($sup, $mat);
|
|
$this->loadviews("Report_cumulative_day", $this->global, $data, NULL);
|
|
}
|
|
|
|
|
|
|
|
function Viewfiles()
|
|
{
|
|
|
|
$PO = $this->request->getPost('id');
|
|
//$PONO= substr($PO,10);
|
|
//echo $PONO; die;
|
|
$split_id = explode('-', (string)$PO, 2);
|
|
$PONO = $split_id[1];
|
|
$data = $this->dahsboard_Model->getfile($PONO);
|
|
|
|
echo json_encode($data);
|
|
}
|
|
|
|
function Viewnormaligrfiles()
|
|
{
|
|
|
|
$igr = $this->request->getPost('id');
|
|
$PONO = $this->request->getPost('id1');
|
|
|
|
|
|
// $PONO= substr($PO,5);
|
|
//echo $PONO; die;
|
|
|
|
$igrfile = $this->dahsboard_Model->getfiles($igr, $PONO);
|
|
// $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
|
|
$billfile = $this->dahsboard_Model->viewIGRFile1($igr, $PONO);
|
|
|
|
$data = array_merge($igrfile, $billfile);
|
|
|
|
// print_r( $data);die;
|
|
|
|
echo json_encode($data);
|
|
}
|
|
|
|
public function ipurchase()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward PO Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$data['client_name'] = $cname;
|
|
$prod = $this->request->getPost('item_name');
|
|
$data['item_name'] = $prod;
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$cat = $this->request->getVar('cat');
|
|
$data['cat'] = $cat;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$data['month'] = $m;
|
|
$frm = $this->request->getPost('from_date');
|
|
$data['frm'] = $frm;
|
|
$t = $this->request->getPost('to_date');
|
|
$data['t'] = $t;
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
// $data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['purchase'] = $this->dahsboard_Model->ireport_purchase($cname, $prod, $fa, $aa, $m, $frm, $t, $cat);
|
|
$data['cashbookdatas'] = $this->dahsboard_Model->report_inwardcashbook($cname, $fa, $aa, $m, $frm, $t, $cat);
|
|
}
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
|
|
$this->loadviews("Report_purchase_inward", $this->global, $data, NULL);
|
|
}
|
|
public function ilink_purchase()
|
|
{
|
|
if ($this->request->getPost('btn_submit')) {
|
|
|
|
$this->global['pageTitle'] = 'Inward PO Reports';
|
|
//$this->request->getPost('btn_submit');
|
|
$cname = $this->request->getPost('client_name');
|
|
$data['client_name'] = $cname;
|
|
$prod = $this->request->getPost('item_name');
|
|
$data['item_name'] = $prod;
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$data['month'] = $m;
|
|
$frm = $this->request->getPost('from_date');
|
|
$data['frm'] = $frm;
|
|
$t = $this->request->getPost('to_date');
|
|
$data['t'] = $t;
|
|
|
|
$sid = $this->request->getVar('sid');
|
|
$mid = $this->request->getVar('mid');
|
|
$d = $this->request->getVar('d');
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['purchase'] = $this->dahsboard_Model->ireport_purchase($cname, $prod, $fa, $aa, $m, $frm, $t, $sid, $mid, $d);
|
|
} else {
|
|
$this->global['pageTitle'] = 'Inward PO Reports';
|
|
//$this->request->getPost('btn_submit');
|
|
$cat = $this->request->getVar('cat');
|
|
$cname = $this->request->getVar('cname');
|
|
$data['client_name'] = $cname;
|
|
$prod = $this->request->getVar('prod');
|
|
$data['item_name'] = $prod;
|
|
$ab = $this->request->getVar('ab');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getVar('m');
|
|
$data['month'] = $m;
|
|
$frm = $this->request->getVar('frm');
|
|
$data['frm'] = $frm;
|
|
$t = $this->request->getVar('t');
|
|
$data['t'] = $t;
|
|
$sid = $this->request->getVar('sid');
|
|
$mid = $this->request->getVar('mid');
|
|
$d = $this->request->getVar('d');
|
|
$da = $this->request->getVar('da');
|
|
$po = $this->request->getVar('po');
|
|
|
|
//print_r($m);die();
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['purchase'] = $this->dahsboard_Model->ireport_purchase_link($cname, $prod, $fa, $aa, $m, $frm, $t, $sid, $mid, $d, $cat, $da, $po);
|
|
}
|
|
|
|
$this->loadviews("Report_purchase_inward", $this->global, $data, NULL);
|
|
}
|
|
public function iattach()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Summary';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$data['client_name'] = $cname;
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$data['month'] = $m;
|
|
$frm = $this->request->getPost('from_date');
|
|
$data['from_date'] = $frm;
|
|
$t = $this->request->getPost('to_date');
|
|
$data['to_date'] = $t;
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['purchase'] = $this->dahsboard_Model->ireport_attachment($cname, $fa, $aa, $m, $frm, $t);
|
|
}
|
|
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
// if($this->DEPCode == MANAGEMENT)
|
|
// {
|
|
$this->loadviews("Report_attach_inward", $this->global, $data, NULL);
|
|
// }
|
|
|
|
// else
|
|
// {
|
|
// $this->loadViews("access", $this->global, $data, NULL);
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
public function iyear_wise()
|
|
{
|
|
$this->global['pageTitle'] = 'Inward Reports - Yearwise ';
|
|
|
|
|
|
if ($this->request->getPost('financialyear')) {
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$a = substr((string)$ab, 0, -5);
|
|
$b = substr((string)$ab, 5, 5);
|
|
$data['year'] = $this->dahsboard_Model->ireport_year_wise($a, $b);
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
|
|
//$this->loadviews("Report_year_wise",$this->global,$data, NULL);
|
|
}
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
|
|
|
|
|
|
$this->loadviews("Report_year_wise_inward", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function imonth_wise()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Monthwise';
|
|
|
|
|
|
$month = $this->request->getVar('dat');
|
|
$mon = date("F", strtotime($month));
|
|
//print_r($month);
|
|
$data['mont'] = $mon;
|
|
$data['month'] = $this->dahsboard_Model->ireport_month_wise($month);
|
|
$this->loadviews("Report_month_wise_inward", $this->global, $data, NULL);
|
|
}
|
|
public function iyear_wise_total($year)
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Yearwise';
|
|
$a = substr($year, 0, -5);
|
|
$b = substr($year, 5, 5);
|
|
$data['year'] = $year;
|
|
$data['ytotal'] = $this->dahsboard_Model->ireport_year_wise_total($a, $b);
|
|
$this->loadviews("Report_year_wise_total_inward", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function ipurchase_supplier()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Supplierwise';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$data['client_name'] = $cname;
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
$data['month'] = $m;
|
|
$frm = $this->request->getPost('from_date');
|
|
$data['frm'] = $frm;
|
|
$t = $this->request->getPost('to_date');
|
|
$data['t'] = $t;
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['spurchse'] = $this->dahsboard_Model->ireport_supplier($cname, $fa, $aa, $m, $frm, $t);
|
|
}
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
|
|
|
|
|
|
$this->loadviews("Report_supplier_inward", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function iconsolidate()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Consolidate';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$data['client_name'] = $cname;
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['spurchse'] = $this->dahsboard_Model->ireport_consolidate($cname, $fa, $aa);
|
|
}
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
|
|
$this->loadviews("Report_consolidate_inward", $this->global, $data, NULL);
|
|
}
|
|
public function i_consolidate_month()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Consolidate-Monthwise';
|
|
//$this->request->getPost('btn_submit');
|
|
$sid = $this->request->getVar('sid');
|
|
$mid = $this->request->getVar('mid');
|
|
$cname = $this->request->getVar('cname');
|
|
$data['client_name'] = $cname;
|
|
$prod = $this->request->getVar('prod');
|
|
$data['item_name'] = $prod;
|
|
//$mat = $this->request->getVar('mid');
|
|
$m = $this->request->getVar('m');
|
|
$data['month'] = $m;
|
|
$ab = $this->request->getVar('ab');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['spurchse'] = $this->dahsboard_Model->i_consolidate_month($m, $sid, $mid, $fa, $aa);
|
|
// print_r( $data['spurchse']);
|
|
|
|
$this->loadviews("Report_consolidate_month_inward", $this->global, $data, NULL);
|
|
}
|
|
public function i_consolidate_year()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Consolidate-Yearwise';
|
|
//$this->request->getPost('btn_submit');
|
|
$sid = $this->request->getVar('sid');
|
|
$mid = $this->request->getVar('mid');
|
|
$cname = $this->request->getVar('cname');
|
|
$data['client_name'] = $cname;
|
|
$prod = $this->request->getVar('prod');
|
|
$data['item_name'] = $prod;
|
|
//$mat = $this->request->getVar('mid');
|
|
$ab = $this->request->getVar('ab');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['spurchse'] = $this->dahsboard_Model->i_consolidate_year($sid, $mid, $fa, $aa);
|
|
// print_r( $data['spurchse']);
|
|
|
|
$this->loadviews("Report_consolidate_year_inward", $this->global, $data, NULL);
|
|
// }
|
|
// else
|
|
// {
|
|
// $this->loadViews("access", $this->global, $data, NULL);
|
|
// }
|
|
|
|
}
|
|
public function icumulative()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Cumulative ';
|
|
|
|
//print_r($prod);
|
|
|
|
$data['cum'] = $this->dahsboard_Model->ireport_cumulative();
|
|
|
|
|
|
$this->loadviews("Report_cumulative_inward", $this->global, $data, NULL);
|
|
}
|
|
public function icum_month($sup,$mat)
|
|
{
|
|
$this->global['pageTitle'] = 'Inward Reports - Cumulative-Monthwise';
|
|
$data['cum_month'] = $this->dahsboard_Model->ireport_cum_month($sup, $mat);
|
|
$this->loadviews("Report_cumulative_month_inward", $this->global, $data, NULL);
|
|
}
|
|
public function icum_year($sup,$mat)
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Cumulative-Yearwise ';
|
|
$data['cum_year'] = $this->dahsboard_Model->ireport_cum_year($sup, $mat);
|
|
$this->loadviews("Report_cumulative_year_inward", $this->global, $data, NULL);
|
|
}
|
|
public function icum_day($sup,$mat)
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Cumulative-Daywise ';
|
|
$data['cum_day'] = $this->dahsboard_Model->ireport_cum_day($sup, $mat);
|
|
$this->loadviews("Report_cumulative_day_inward", $this->global, $data, NULL);
|
|
}
|
|
public function rawi_cumulative()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Cumulative Category-Wise';
|
|
|
|
//print_r($prod);
|
|
|
|
$data['cum'] = $this->dahsboard_Model->rawi_report_cumulative();
|
|
|
|
|
|
$this->loadviews("Report_cumulative_raw", $this->global, $data, NULL);
|
|
}
|
|
public function rawi_cum_year()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Cumulative Year-Category-Wise';
|
|
//$mat=$this->request->getVar('mid');
|
|
$cat = $this->request->getVar('cat');
|
|
//print_r($sup);
|
|
|
|
$data['cum_year'] = $this->dahsboard_Model->rawi_report_cum_year($cat);
|
|
$this->loadviews("Report_cumulative_year_raw", $this->global, $data, NULL);
|
|
}
|
|
public function rawi_cum_month()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Report - Cumulative Month-Category-Wise';
|
|
//$mat=$this->request->getVar('mid');
|
|
$cat = $this->request->getVar('cat');
|
|
|
|
//print_r($prod);
|
|
|
|
$data['cum_month'] = $this->dahsboard_Model->rawi_report_cum_month($cat);
|
|
$this->loadviews("Report_cumulative_month_raw", $this->global, $data, NULL);
|
|
}
|
|
public function rawi_cum_day()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Cumulative Daily-Category-Wise';
|
|
//$mat=$this->request->getVar('mid');
|
|
$cat = $this->request->getVar('cat');
|
|
//print_r($prod);
|
|
|
|
$data['cum_day'] = $this->dahsboard_Model->rawi_report_cum_day($cat);
|
|
$this->loadviews("Report_cumulative_day_raw", $this->global, $data, NULL);
|
|
}
|
|
public function rawi_consolidate()
|
|
{
|
|
|
|
$this->global['pageTitle'] = ' Inward Report - Consolidate ';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$data['client_name'] = $cname;
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->category();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['spurchse'] = $this->dahsboard_Model->rawi_report_consolidate($cname, $fa, $aa);
|
|
}
|
|
$data['material'] = $this->dahsboard_Model->category();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
|
|
$this->loadviews("Report_consolidate_raw", $this->global, $data, NULL);
|
|
}
|
|
public function rawi_consolidate_month()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Consolidate Month-Wise';
|
|
//$this->request->getPost('btn_submit');
|
|
$cat = $this->request->getVar('cat');
|
|
$sup = $this->request->getVar('sup');
|
|
//$mat = $this->request->getVar('mid');
|
|
$m = $this->request->getVar('m');
|
|
$ab = $this->request->getVar('ab');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['spurchse'] = $this->dahsboard_Model->rawi_consolidate_month($m, $cat, $sup, $fa, $aa);
|
|
// print_r( $data['spurchse']);
|
|
|
|
$this->loadviews("Report_consolidate_month", $this->global, $data, NULL);
|
|
}
|
|
public function rawi_consolidate_year()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Inward Reports - Consolidate Year-Wise';
|
|
//$this->request->getPost('btn_submit');
|
|
$cat = $this->request->getVar('cat');
|
|
$sup = $this->request->getVar('sup');
|
|
//$mat = $this->request->getVar('mid');
|
|
$ab = $this->request->getVar('ab');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
//$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
|
|
$data['finyear'] = $this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
|
|
$data['spurchse'] = $this->dahsboard_Model->rawi_consolidate_year($cat, $sup, $fa, $aa);
|
|
// print_r( $data['spurchse']);
|
|
|
|
$this->loadviews("Report_consolidate_year", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function pending_purchase()
|
|
{
|
|
$headline = '';
|
|
$pending_purchase_details = [];
|
|
|
|
if ($this->request->getMethod(true) === 'POST' && $this->request->getPost('btn_submit')) {
|
|
|
|
$cname = $this->request->getPost('client_name');
|
|
$data['client_name'] = $cname;
|
|
$prod = $this->request->getPost('item_name');
|
|
$data['item_name'] = $prod;
|
|
$frm = $this->request->getPost('from_date');
|
|
$data['from_date'] = $frm;
|
|
$t = $this->request->getPost('to_date');
|
|
$data['to_date'] = $t;
|
|
$m = $this->request->getPost('month');
|
|
$data['month'] = $m;
|
|
$purchaseorder_number = $this->request->getPost('purchaseorder_number');
|
|
$data['purchaseorder_number'] = $purchaseorder_number;
|
|
$ab = $this->request->getPost('financialyear');
|
|
$data['financialyear'] = $ab;
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
|
|
$headline .= (isset($cname) && !empty($cname)) ? $cname . ' ' : '';
|
|
$headline .= (isset($prod) && !empty($prod)) ? $prod . ' ' : '';
|
|
$headline .= (isset($ab) && !empty($ab)) ? '(' . $ab . ') ' : '';
|
|
$headline .= (isset($m) && !empty($m)) ? '(' . $m . ') ' : '';
|
|
$headline .= ((isset($frm) && isset($t)) && (!empty($frm) && !empty($t))) ? $frm . '-to-' . $t : '';
|
|
$headline .= (isset($purchaseorder_number) && !empty($purchaseorder_number)) ? '(' . $purchaseorder_number . ') ' : '';
|
|
$pending_purchase_details = $this->dahsboard_Model->pending_purchase($cname, $prod, $fa, $aa, $m, $frm, $t, $purchaseorder_number);
|
|
}
|
|
$data['pono'] = $this->dahsboard_Model->purchase_order_list();
|
|
$data['material'] = $this->dahsboard_Model->material_name();
|
|
$data['cust'] = $this->dahsboard_Model->customer_name();
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$data['headline'] = $headline;
|
|
$data['ppurchse'] = $pending_purchase_details;
|
|
|
|
// Load the view
|
|
$this->global['pageTitle'] = 'Reports';
|
|
$this->loadviews("Report_pending_purchase", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function monthly_gst()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
|
|
$m = $this->request->getPost('month');
|
|
$frm = $this->request->getPost('from_date');
|
|
$t = $this->request->getPost('to_date');
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
//print_r($prod);
|
|
|
|
$data['monthly_gst_purchase'] = $this->dahsboard_Model->monthly_gst_purchase($m, $frm, $t, $fa, $aa);
|
|
$data['monthly_gst_sales'] = $this->dahsboard_Model->monthly_gst_sales($m, $frm, $t, $fa, $aa);
|
|
}
|
|
$data['finyear'] = $this->dahsboard_Model->report_finyear();
|
|
$this->loadviews("Report_monthly_gst", $this->global, $data, NULL);
|
|
//print_r($data);die();
|
|
}
|
|
public function monthly_gst_table()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
|
|
$m = $this->request->getVar('m');
|
|
$frm = $this->request->getVar('frm');
|
|
$t = $this->request->getVar('t');
|
|
$ab = $this->request->getVar('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
// print_r($frm);
|
|
// print_r($t);
|
|
// print_r($m);die();
|
|
|
|
$data['monthly_gst_purchase'] = $this->dahsboard_Model->purchase_gst($m, $frm, $t, $fa, $aa);
|
|
$data['monthly_gst_sales'] = $this->dahsboard_Model->sales_gst($m, $frm, $t, $fa, $aa);
|
|
|
|
|
|
$this->loadviews("Report_monthly_gst_table", $this->global, $data, NULL);
|
|
//print_r($data);die();
|
|
}
|
|
/*******************Performance report start **************/
|
|
public function getFinancialStartDate()
|
|
{
|
|
|
|
|
|
|
|
$CURMONTH = date('n');
|
|
$CURYEAR = date('Y');
|
|
$FINYEAR = 0;
|
|
if ($CURMONTH >= 4) {
|
|
$FINYEAR = $CURYEAR;
|
|
} else {
|
|
$FINYEAR = $CURYEAR - 1;
|
|
}
|
|
|
|
$dateInString = $FINYEAR . '-4-1';
|
|
$result = date_create($dateInString);
|
|
// print_r($result);
|
|
|
|
return $result;
|
|
}
|
|
|
|
|
|
/*this function uesd to finance EndDate */
|
|
public function getFinancialEndDate()
|
|
{
|
|
$CURMONTH = date('n');
|
|
$CURYEAR = date('Y');
|
|
$FINYEAR = 0;
|
|
if ($CURMONTH < 4) {
|
|
$FINYEAR = $CURYEAR;
|
|
} else {
|
|
$FINYEAR = $CURYEAR + 1;
|
|
}
|
|
|
|
$dateInString = $FINYEAR . '-3-31';
|
|
$result = date_create($dateInString);
|
|
|
|
|
|
// print_r($result);
|
|
return $result;
|
|
}
|
|
|
|
|
|
public function per()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Reports';
|
|
|
|
|
|
$ab = $this->request->getPost('financialyear');
|
|
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
$m = $this->request->getPost('month');
|
|
|
|
//print_r($prod);
|
|
|
|
$data['fy'] = $this->dahsboard_Model->fy();
|
|
$data['per'] = $this->dahsboard_Model->per($fa, $aa, $m);
|
|
$cur_month = date('M');
|
|
//echo $cur_month;
|
|
if ($cur_month == $m) {
|
|
|
|
$cur_date = date('d');
|
|
} else {
|
|
|
|
$cur_date = date('t', strtotime((string)$m));
|
|
}
|
|
$data['cur_month'] = $cur_date;
|
|
|
|
$CURMONTH = date('m');
|
|
$CURDATE = date('d');
|
|
$CURYEAR = date('Y');
|
|
$EmpID = '';
|
|
$empId = $this->dahsboard_Model->get_employee();
|
|
foreach ($empId as $Employee) {
|
|
|
|
$day = array();
|
|
|
|
$DateofJoiningInString = $Employee->DateofJoining;
|
|
$DateofJoining = date_create($DateofJoiningInString);
|
|
// print_r($DateofJoining);
|
|
// $doj_month = date_format($DateofJoining, "n");
|
|
// $doj_year = date_format($DateofJoining, "Y");
|
|
// $doj_day = date_format($DateofJoining, "j");
|
|
$doj_month = format_date($DateofJoining, 0, 'n');
|
|
$doj_year = format_date($DateofJoining, 0, 'Y');
|
|
$doj_day = format_date($DateofJoining, 0, 'j');
|
|
|
|
|
|
$finStart = $this->getFinancialStartDate();
|
|
$finEnd = $this->getFinancialEndDate();
|
|
|
|
$JoinedMonth = date_format($DateofJoining, "n");
|
|
//print_r($JoinedMonth);echo "1285<br/>";
|
|
// print_r($finStart);print_r($finEnd);
|
|
//print $JoinedMonth;
|
|
|
|
if ($DateofJoining >= $finStart && $DateofJoining <= $finEnd) {
|
|
$JoinedMonthAttendance = $this->dahsboard_Model->getAllAttendances($EmpID, $JoinedMonth);
|
|
$joinedMonthDaysCount = cal_days_in_month(CAL_GREGORIAN, $doj_month, $doj_year);
|
|
|
|
if ($CURMONTH == $doj_month && $CURYEAR == $doj_year) {
|
|
$joinedMonthWorkingDayCount = $CURDATE - $doj_day + 1;
|
|
} else {
|
|
$joinedMonthWorkingDayCount = $joinedMonthDaysCount - $doj_day + 1;
|
|
}
|
|
|
|
$joinedMonthDays = 0;
|
|
for ($j = $doj_day; $j <= $joinedMonthDaysCount; $j++) {
|
|
$weekdays[] = 'WH' . $j;
|
|
}
|
|
foreach ($JoinedMonthAttendance as $day) {
|
|
foreach ($day as $key => $value) {
|
|
foreach ($weekdays as $weeks) {
|
|
if ($weeks == $key) {
|
|
if ($value != 0) {
|
|
// echo $value;
|
|
$joinedMonthDays++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//echo $joinedMonthDays;die;
|
|
|
|
$result = $this->dahsboard_Model->attendanceyear($EmpID, $JoinedMonth + 1);
|
|
|
|
//print_r($result);
|
|
$yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH);
|
|
$TotalNoofDays = $result[0]->TotalWorkingDays;
|
|
$DaysWorked = $result[0]->DaysWorked;
|
|
|
|
// echo $TotalNoofDays;
|
|
// echo $DaysWorked;die;
|
|
$values = 0;
|
|
$values = array();
|
|
$weekdays = array();
|
|
$date = date('d');
|
|
|
|
$Work = array_sum($weekdays);
|
|
|
|
for ($j = 1; $j <= $date; $j++) {
|
|
$weekdays[] = 'WH' . $j;
|
|
}
|
|
$totalhours = 0;
|
|
foreach ($yearabs as $day) {
|
|
foreach ($day as $key => $value) {
|
|
foreach ($weekdays as $weeks) {
|
|
if ($weeks == $key) {
|
|
if ($value != 0) {
|
|
//$values++;
|
|
//$totalhours = array_sum($value);
|
|
$values[] = $value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$DaysWorked = 0;
|
|
|
|
$totalhours = array_sum($values);
|
|
|
|
$values = $totalhours / 8;
|
|
//print_r($totalhours);
|
|
|
|
if ($CURMONTH == $doj_month && $CURYEAR == $doj_year) {
|
|
$TotalNoofDays = $TotalNoofDays + $joinedMonthWorkingDayCount;
|
|
$DaysWorked = $joinedMonthDays;
|
|
} else {
|
|
$TotalNoofDays = $TotalNoofDays + $CURDATE + $joinedMonthWorkingDayCount;
|
|
$DaysWorked = $DaysWorked + $joinedMonthDays + $values;
|
|
}
|
|
|
|
|
|
|
|
|
|
$final_res = round(($DaysWorked / $TotalNoofDays) * 100);
|
|
// echo "------";
|
|
//echo $final_res;exit();
|
|
$workeds[] = $DaysWorked;
|
|
$yeardata[] = $final_res;
|
|
$totaldays[] = $TotalNoofDays;
|
|
} else {
|
|
$EmpID = $Employee->EmpID;
|
|
$result = $this->dahsboard_Model->attendanceyear($EmpID, 4);
|
|
$yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH);
|
|
$TotalNoofDays = $result[0]->TotalWorkingDays;
|
|
$DaysWorked = $result[0]->DaysWorked;
|
|
|
|
|
|
$values = 0;
|
|
$values = array();
|
|
$weekdays = array();
|
|
$date = date('d');
|
|
|
|
$Work = array_sum($weekdays);
|
|
|
|
for ($j = 1; $j <= $date; $j++) {
|
|
$weekdays[] = 'WH' . $j;
|
|
}
|
|
foreach ($yearabs as $day) {
|
|
foreach ($day as $key => $value) {
|
|
foreach ($weekdays as $weeks) {
|
|
if ($weeks == $key) {
|
|
if ($value != 0) {
|
|
|
|
$values[] = $value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$totalhours = array_sum($values);
|
|
|
|
$values = $totalhours / 8;
|
|
|
|
$TotalNoofDays = $TotalNoofDays + $CURDATE;
|
|
$DaysWorked = $DaysWorked + $values;
|
|
$final_res = round(($DaysWorked / $TotalNoofDays) * 100);
|
|
// echo "------";
|
|
//echo $final_res;exit();
|
|
$workeds[] = $DaysWorked;
|
|
$yeardata[] = $final_res;
|
|
$totaldays[] = $TotalNoofDays;
|
|
//print_r($data);
|
|
|
|
}
|
|
}
|
|
$data['dayworked'] = $workeds;
|
|
$data['yearpercentage'] = $yeardata;
|
|
$data['yeardays'] = $totaldays;
|
|
//print_r($data['workeds']);echo"<br/>asdasd";die;
|
|
|
|
// print_r( $data['spurchse']);
|
|
|
|
$this->loadviews("report_emp", $this->global, $data, NULL);
|
|
}
|
|
/***************End *************/
|
|
public function cashbook()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Cashbook - Cashbook Reports - ';
|
|
|
|
$data['gettoptotal1'] = $this->dahsboard_Model->gettoptotal();
|
|
$data['getTotalServicePoCount'] = $this->dahsboard_Model->getTotalServicePoCount();
|
|
$data['getTotalimportPoCount'] = $this->dahsboard_Model->getTotalimportPoCount();
|
|
$data['getTotalcapitalPoCount'] = $this->dahsboard_Model->getTotalcapitalPoCount();
|
|
$data['getTotalrevenuePoCount'] = $this->dahsboard_Model->getTotalrevenuePoCount();
|
|
$data['cashbook'] = $this->dahsboard_Model->cashbook();
|
|
|
|
$data['dailyIncomeExpense'] = $this->dahsboard_Model->today_data();
|
|
$data['monthlyIncomeExpense'] = $this->dahsboard_Model->monthwise_data();
|
|
$data['yearlyIncomeExpense'] = $this->dahsboard_Model->yearwise_data();
|
|
|
|
$data['gettoptotal1'] = $this->dahsboard_Model->gettoptotal();
|
|
$data['tdy'] = $this->dahsboard_Model->today();
|
|
//echo ($data['tdy']);
|
|
$data['Indiancurrency'] = $this->dahsboard_Model->INRSymbol();
|
|
//print_r($data['gettoptotal1']);
|
|
// $data['monthlywiseincome']=$this->dahsboard_Model->monthwise_data_income();
|
|
// $data['monthlywiseexpense']=$this->dahsboard_Model->monthwise_data_expense();
|
|
// $data['todayincome']=$this->dahsboard_Model->today_data_income();
|
|
// $data['todayexpense']=$this->dahsboard_Model->today_data_expense();
|
|
|
|
$currentdate = get_current_date();
|
|
$yesterday = format_date($currentdate,"-1 day",'Y-m-d');
|
|
$month = format_date($currentdate, 0,'m');
|
|
$year = format_date($currentdate, 0,'y');
|
|
|
|
$premonth = $month - 1;
|
|
$premonth = $premonth < 10 ? '0' . $premonth : '' . $premonth;
|
|
$premonth = $premonth == '00' ? '12' : $premonth;
|
|
$yearvalue = $premonth == '12' ? $year - 1 : $year;
|
|
$preyear = $yearvalue - 1;
|
|
|
|
$data['yearlybalances'] = $this->dahsboard_Model->getYearlyOpeningAmt($yearvalue);
|
|
$lastdate = cal_days_in_month(CAL_GREGORIAN, $premonth, $yearvalue);
|
|
$dateformat = '20' . $yearvalue . '-' . $premonth . '-' . $lastdate;
|
|
$data['monthlybalances'] = $this->dahsboard_Model->getMonthlyOpeningAmt($dateformat);
|
|
$data['yesterdaybalances'] = $this->dahsboard_Model->getDailyOpeningAmt($yesterday);
|
|
|
|
$this->loadviews("reportcashbook", $this->global, $data, NULL);
|
|
}
|
|
|
|
public function monthexpenses()
|
|
{
|
|
$monthyearvalue = $this->request->getPost('monthyear');
|
|
$this->global['pageTitle'] = ' Cashbook - Cashbook Monthly Reports';
|
|
|
|
if ($monthyearvalue == '') {
|
|
|
|
$data['monthyearvalue'] = '';
|
|
} else {
|
|
|
|
$data['monthyearvalue'] = $monthyearvalue;
|
|
$monthyear = explode("-", (string)$monthyearvalue);
|
|
|
|
$month = $monthyear[0];
|
|
$year = $monthyear[1];
|
|
|
|
$premonth = $monthyear[0] - 1;
|
|
$premonth = $premonth < 10 ? '0' . $premonth : '' . $premonth;
|
|
$premonth = $premonth == '00' ? '12' : $premonth;
|
|
$yearvalue = $premonth == '12' ? $year - 1 : $year;
|
|
$lastdate = cal_days_in_month(CAL_GREGORIAN, $premonth, $yearvalue);
|
|
$dateformat = $yearvalue . '-' . $premonth . '-' . $lastdate;
|
|
$data['monthlybalances'] = $this->dahsboard_Model->getMonthlyOpeningAmt($dateformat);
|
|
$data['monthlyreport'] = $this->dahsboard_Model->monthexpensereport($month, $year);
|
|
}
|
|
|
|
$this->loadviews("cashbookmonthlyexpenses", $this->global, $data, NULL);
|
|
}
|
|
public function yearexpenses()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Cashbook - Cashbook Yearly Reports';
|
|
|
|
$data['financialyear'] = $this->dahsboard_Model->cashbookfinyear();
|
|
|
|
$fyear = $this->request->getPost('financialyear');
|
|
|
|
if ($fyear == '') {
|
|
|
|
$data['fyears'] = '';
|
|
} else {
|
|
|
|
$data['fyears'] = $fyear;
|
|
|
|
$fa = substr((string)$fyear, 0, -5);
|
|
$aa = substr((string)$fyear, 5, 5);
|
|
|
|
$finyear = explode("-", (string)$fyear);
|
|
|
|
$prev_year = $finyear[0];
|
|
|
|
$data['yearlyreport'] = $this->dahsboard_Model->yearexpensereport($fa, $aa);
|
|
|
|
$data['yearlybalances'] = $this->dahsboard_Model->getYearlyOpeningAmt($prev_year);
|
|
}
|
|
$this->loadviews("cashbookyearlyexpenses", $this->global, $data, NULL);
|
|
}
|
|
public function cashbookdepartment()
|
|
{
|
|
$this->global['pageTitle'] = 'Cashbook - department - ';
|
|
|
|
if (!empty($this->request->getVar('sid'))) {
|
|
$sid = $this->request->getVar('sid');
|
|
} else {
|
|
$sid = '';
|
|
}
|
|
if (!empty($this->request->getVar('d'))) {
|
|
$d = $this->request->getVar('d');
|
|
} else {
|
|
$d = '';
|
|
}
|
|
$c = $this->request->getVar('c');
|
|
$finyear = $this->request->getVar('finyear');
|
|
$fy = substr($finyear, 0, -5);
|
|
$ty = substr($finyear, 5, 5);
|
|
|
|
if ($c == 'PAYMENT') {
|
|
|
|
$data['departmentwise'] = $this->dahsboard_Model->departmentwise($sid, $d, $c, $fy, $ty);
|
|
$data['Indiancurrency'] = $this->dahsboard_Model->INRSymbol();
|
|
$this->loadviews("cashbookmonthlydep", $this->global, $data, NULL);
|
|
} else {
|
|
$data['departmentwise'] = $this->dahsboard_Model->departmentwise($sid, $d, $c, $fy, $ty);
|
|
$data['Indiancurrency'] = $this->dahsboard_Model->INRSymbol();
|
|
$this->loadviews("cashbookmonthlyexp", $this->global, $data, NULL);
|
|
}
|
|
}
|
|
public function cashbookdepartmentexp()
|
|
{
|
|
$sid = $this->request->getVar('sid');
|
|
$d = $this->request->getVar('d');
|
|
$c = $this->request->getVar('c');
|
|
$this->global['pageTitle'] = 'Cashbook - department - ';
|
|
$data['departmentwise'] = $this->dahsboard_Model->departmentwise($sid, $d, $c);
|
|
$data['Indiancurrency'] = $this->dahsboard_Model->INRSymbol();
|
|
//print_r($data['departmentwise']);
|
|
$this->loadviews("cashbookmonthlyexp", $this->global, $data, NULL);
|
|
}
|
|
//for cashbook menu link//
|
|
// public function cashbookmonthmenu()
|
|
// {
|
|
|
|
// $this->global['pageTitle'] = 'Cashbook monthly ';
|
|
// $data['yearmonthwise']=$this->dahsboard_Model->yearmonthwise();
|
|
// $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol();
|
|
// //print_r($data['departmentwise']);
|
|
// $this->loadviews("cashbookyearmonthwise",$this->global,$data, NULL);
|
|
// }
|
|
public function yearmonthwise()
|
|
{
|
|
$sid = $this->request->getVar('sid');
|
|
$this->global['pageTitle'] = 'Cashbook - yearmonthwise - ';
|
|
$data['yearmonthwise'] = $this->dahsboard_Model->yearmonthwise($sid);
|
|
$data['Indiancurrency'] = $this->dahsboard_Model->INRSymbol();
|
|
//print_r($data['departmentwise']);
|
|
$this->loadviews("cashbookyearmonthwise", $this->global, $data, NULL);
|
|
}
|
|
|
|
//this function used to today menu option//
|
|
public function Viewtoday()
|
|
{
|
|
$this->global['pageTitle'] = 'Cashbook - viewtoday ';
|
|
$data['tdy'] = $this->dahsboard_Model->today();
|
|
|
|
$currentdate = get_current_date();
|
|
$yesterday = format_date($currentdate,"-1 day",'Y-m-d');
|
|
|
|
$data['yesterdaybalances'] = $this->dahsboard_Model->getDailyOpeningAmt($yesterday);
|
|
$data['Indiancurrency'] = $this->dahsboard_Model->INRSymbol();
|
|
$this->loadviews("cashbooktoday", $this->global, $data, NULL);
|
|
}
|
|
public function depmenu()
|
|
{
|
|
$this->global['pageTitle'] = 'Cashbook - AllReport ';
|
|
$fdate = $this->request->getPost('from_date');
|
|
$tdate = $this->request->getPost('to_date');
|
|
$finyear = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$finyear, 0, -5);
|
|
$aa = substr((string)$finyear, 5, 5);
|
|
$data['depmenu'] = $this->dahsboard_Model->departmentmenu($fdate, $tdate, $fa, $aa);
|
|
$data['financialyear'] = $this->dahsboard_Model->cashbookfinyear();
|
|
$data['Indiancurrency'] = $this->dahsboard_Model->INRSymbol();
|
|
$this->loadviews("cashbookall", $this->global, $data, NULL);
|
|
}
|
|
public function cashbookmenudepartment()
|
|
{
|
|
$sid = $this->request->getVar('sid');
|
|
|
|
$this->global['pageTitle'] = 'Cashbook - department - ';
|
|
$data['menudepartmentwise'] = $this->dahsboard_Model->menudepartmentwise($sid);
|
|
$data['Indiancurrency'] = $this->dahsboard_Model->INRSymbol();
|
|
//print_r($data['departmentwise']);
|
|
$this->loadviews("cashbookdepday", $this->global, $data, NULL);
|
|
}
|
|
public function cashbook_cumulative_report()
|
|
{
|
|
$this->global['pageTitle'] = 'Cashbook Cumulative - Report';
|
|
$data['datas'] = $this->dahsboard_Model->report_cumulative_cashbook();
|
|
$this->loadviews("cashbook_cumulative_report", $this->global, $data, NULL);
|
|
}
|
|
|
|
// public function cashbook_month_cumulative_reported1()
|
|
// {
|
|
|
|
// $this->global['pageTitle'] = 'Cashbook Cumulative(Monthwise) - report ';
|
|
|
|
// if (date('m') >= 4) {
|
|
// $yearl = date('Y').'-'.(date('Y')+1);
|
|
// } else {
|
|
// $yearl = (date('Y')-1).'-'.date('Y');
|
|
// }
|
|
// $ab=$yearl;
|
|
// $fa=substr((string)$ab,0,-5);
|
|
// $aa=substr((string)$ab,5,5);
|
|
|
|
|
|
// $data['datas'] = $this->dahsboard_Model->report_cumulative_month_cashbook();
|
|
// $this->loadviews("cashbook_cumulative_month_report1",$this->global,$data, NULL);
|
|
|
|
// }
|
|
|
|
public function cashbook_month_cumulative_report()
|
|
{
|
|
$this->global['pageTitle'] = 'Cashbook Cumulative(Monthwise) - Report';
|
|
if ($this->request->getPost('btn_submit')) {
|
|
$cname = $this->request->getPost('client_name');
|
|
$ab = $this->request->getPost('financialyear');
|
|
$fa = substr((string)$ab, 0, -5);
|
|
$aa = substr((string)$ab, 5, 5);
|
|
|
|
$data['accountname'] = $this->dahsboard_Model->accountname();
|
|
$data['finyear'] = $this->dahsboard_Model->cashbook_finyear();
|
|
// $data['spurchse']=$this->dahsboard_Model->rawi_report_consolidate($cname,$fa,$aa);
|
|
$data['datas'] = $this->dahsboard_Model->report_cumulative_month_cashbook($cname, $fa, $aa);
|
|
}
|
|
|
|
$data['accountname'] = $this->dahsboard_Model->accountname();
|
|
$data['finyear'] = $this->dahsboard_Model->cashbook_finyear();
|
|
|
|
$this->loadviews("cashbook_cumulative_month_report", $this->global, $data, NULL);
|
|
}
|
|
}
|