<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Partners extends MY_Controller {

    function __construct() {
        parent::__construct();
    }

    function index()
    {

       $data['template'] = 'reports/reports_partners_view';
       $this->load->view('template',$data);
    }
    function customers()
    {
         $data['customer'] = $this->common->getAll('CUSTOMERS');
         $data['template'] = 'reports/partners/customer_view';
       $this->load->view('template',$data);
    }
    public function printcustomers() {

           $this->load->library('session');
            $customers = $this->session->userdata('CUSTOMERS');
            $array_items = array('CUSTOMERS' => '');
            $this->session->unset_userdata($array_items);

         $this->load->helper('dompdf');
	       $this->load->helper('file');
        $this->load->model('reports/partners_model');
        $this->load->model('settings/companyinfo_model');

        $data['reportdata'] = $this->partners_model->getcustomers($customers);

        $data['companyinfo'] = $this->companyinfo_model->getcompanyinfo('1');

          $this->load->model('reports/report_model');
        $data['columns'] = $this->report_model->getcolumns('CUSTOMERS');
        $data['reporttitle'] = 'Customers';
        $html = $this->load->view('reports/report_template1_print', $data, true);
        echo $html;
        //pdf_create($html, 'CUSTOMERS', false);

    }
       function setparamsinsessionforcustomers()
    {
       $this->load->library('session');
       $this->session->set_userdata('CUSTOMERS',  $this->input->post('CUSTOMERS'));
       return 1;
    }
 function customerdefaulting()
    {
        
       $data['template'] = 'reports/partners/customerdefaulting_view';
       $this->load->view('template',$data);
     
    }
    public function printcustomerdefaulting() {

           $this->load->helper('dompdf');
	$this->load->helper('file');
        $this->load->model('reports/partners_model');
        $this->load->model('settings/companyinfo_model');
        $data['reportdata'] = $this->partners_model->getcustomerdefaulting();
       //$data['customerdefault'] = $this->partners_model->getcustomerdefaulting($customers);

        $data['companyinfo'] = $this->companyinfo_model->getcompanyinfo('1');

         $this->load->model('reports/report_model');
        $data['columns'] = $this->report_model->getcolumns('CUSTOMERSDEFAULTING');
        $data['reporttitle'] = 'Customerdefaulting';
        $html = $this->load->view('reports/report_template1_print', $data, true);
        echo $html;
            // pdf_create($html, 'CUSTOMERS', false);

    }
 function customerdiary()
    {
        $data['template'] = 'reports/partners/customerdiary_view';
       $this->load->view('template',$data);
    }
    public function printcustomerdiary() {

           $this->load->library('session');
              $customers = $this->session->userdata('CUSTOMERS');
               $datefrom = $this->session->userdata('DATEFROM');
                  $dateto = $this->session->userdata('DATETO');
                  $array_items = array('CUSTOMERS' => '','DATEFROM' => '','DATETO' => '');
                $this->session->unset_userdata($array_items);

        $this->load->helper('dompdf');
	$this->load->helper('file');
        $this->load->model('reports/partners_model');
        $this->load->model('settings/companyinfo_model');

  $data['reportdata'] = $this->partners_model->getcustomerdiary($customers,$datefrom,$dateto);
  $data['companyinfo'] = $this->companyinfo_model->getcompanyinfo('1');
  $this->load->model('reports/report_model');
        $data['columns'] = $this->report_model->getcolumns('CUSTOMERDIARY');
        $data['reporttitle'] = 'Customer diary';
        $html = $this->load->view('reports/report_template1_print', $data, true);
        echo $html;
   //pdf_create($html, 'CUSTOMERS', false);
    }
  function setparamsinsessionforcustomerdiary()
    {
       $this->load->library('session');
       $this->session->set_userdata('CUSTOMERS',  $this->input->post('CUSTOMERS'));
        $this->session->set_userdata('DATEFROM',  $this->input->post('DATEFROM'));
        $this->session->set_userdata('DATETO',  $this->input->post('DATETO'));
       return 1;
    }
     function suppliers()
    {
         $data['template'] = 'reports/partners/supplier_view';
       $this->load->view('template',$data);
    }
    public function printsuppliers()
    {
           $this->load->library('session');
              $suppliers = $this->session->userdata('SUPPLIERS');
            $array_items = array('SUPPLIERS' => '');
            $this->session->unset_userdata($array_items);

           $this->load->helper('dompdf');
	$this->load->helper('file');
        $this->load->model('reports/partners_model');
        $this->load->model('settings/companyinfo_model');
        $data['reportdata'] = $this->partners_model->getsuppliers($suppliers);
        $data['companyinfo'] = $this->companyinfo_model->getcompanyinfo('1');
        $this->load->model('reports/report_model');
        $data['columns'] = $this->report_model->getcolumns('SUPPLIERS');
        $data['reporttitle'] = 'Suppliers';
        $html = $this->load->view('reports/report_template1_print', $data, true);
        echo $html;
            // pdf_create($html, 'SUPPLIERS', false);

    }
       function setparamsinsessionforsuppliers()
    {
       $this->load->library('session');
       $this->session->set_userdata('SUPPLIERS',  $this->input->post('SUPPLIERS'));
       return 1;
    }
 function supplierdefaulting()
    {
      
         $data['template'] = 'reports/partners/supplierdefaulting_view';
       $this->load->view('template',$data);
    }
    public function printsupplierdefaulting() {

           $this->load->helper('dompdf');
	$this->load->helper('file');
        $this->load->model('reports/partners_model');
        $this->load->model('settings/companyinfo_model');
$data['reportdata'] = $this->partners_model->gesupplierdefaulting();
        $data['companyinfo'] = $this->companyinfo_model->getcompanyinfo('1');
          $this->load->model('reports/report_model');
        $data['columns'] = $this->report_model->getcolumns('SUPPLIERDEFAULTING');
        $data['reporttitle'] = 'supplierdefaulting';
        $html = $this->load->view('reports/report_template1_print', $data, true);
        echo $html;
            // pdf_create($html, 'SUPPLIERS', false);
    }
     function supplierdiary()
    {
  
        $data['template'] = 'reports/partners/supplierdiary_view';
       $this->load->view('template',$data);
    }
    public function printsupplierdiary() {

           $this->load->library('session');
              $suppliers = $this->session->userdata('SUPPLIERS');
               $datefrom = $this->session->userdata('DATEFROM');
                  $dateto = $this->session->userdata('DATETO');
                  $array_items = array('SUPPLIERS' => '','DATEFROM' => '','DATETO' => '');
                $this->session->unset_userdata($array_items);

        $this->load->helper('dompdf');
	$this->load->helper('file');
        $this->load->model('reports/partners_model');
        $this->load->model('settings/companyinfo_model');

  $data['reportdata'] = $this->partners_model->getsupplierdiary($suppliers,$datefrom,$dateto);
  $data['companyinfo'] = $this->companyinfo_model->getcompanyinfo('1');
     $this->load->model('reports/report_model');
        $data['columns'] = $this->report_model->getcolumns('SUPPLIERDIARY');
        $data['reporttitle'] = 'Supplier Diary';
        $html = $this->load->view('reports/report_template1_print', $data, true);
  echo $html;
   //pdf_create($html, 'CUSTOMERS', false);
    }
  function setparamsinsessionforsupplierdiary()
    {
       $this->load->library('session');
       $this->session->set_userdata('SUPPLIERS',  $this->input->post('SUPPLIERS'));
        $this->session->set_userdata('DATEFROM',  $this->input->post('DATEFROM'));
        $this->session->set_userdata('DATETO',  $this->input->post('DATETO'));
       return 1;
    }
       function supplierdiarydetails()
    {
  
        $data['template'] = 'reports/partners/supplierdiarydet_view';
       $this->load->view('template',$data);
    }
      public function printsupplierdiarydetails() {

           $this->load->library('session');
              $suppliers = $this->session->userdata('SUPPLIERS');
               $datefrom = $this->session->userdata('DATEFROM');
                  $dateto = $this->session->userdata('DATETO');
                  $array_items = array('SUPPLIERS' => '','DATEFROM' => '','DATETO' => '');
                $this->session->unset_userdata($array_items);

        $this->load->helper('dompdf');
	$this->load->helper('file');
        $this->load->model('reports/partners_model');
        $this->load->model('settings/companyinfo_model');

  $data['reportdata'] = $this->partners_model->getsupplierdiarydet($suppliers,$datefrom,$dateto);
  $data['companyinfo'] = $this->companyinfo_model->getcompanyinfo('1');
   $this->load->model('reports/report_model');
        $data['columns'] = $this->report_model->getcolumns('SUPPLIERDIARYDET');
        $data['reporttitle'] = 'Supplier Diary Details ';
        $html = $this->load->view('reports/report_template1_print', $data, true);
        echo $html;
   //pdf_create($html, 'SUPPLIERS', false);
    }
  function setparamsinsessionforsupplierdiarydetails()
    {
       $this->load->library('session');
       $this->session->set_userdata('SUPPLIERS',  $this->input->post('SUPPLIERS'));
        $this->session->set_userdata('DATEFROM',  $this->input->post('DATEFROM'));
        $this->session->set_userdata('DATETO',  $this->input->post('DATETO'));
       return 1;
    }
    }