Advertisement
fadlyshafa

Untitled

Apr 5th, 2020
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.65 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. class Jurnal_report extends CI_Controller
  4. {
  5.     function __construct() {
  6.         parent::__construct();
  7.         $this->load->model('reports_model');
  8.         $this->load->model('workorder_model');
  9.         $this->load->model('log_model');
  10.         $this->load->model('Warehouses_products_model');
  11.         $this->load->model('Sales_model');
  12.         $this->load->model('sales_return_model');
  13.         $this->load->model('Customer_model');
  14.         $this->load->model('Supplier_model');
  15.     }
  16.  
  17.     public function sales_list(){
  18.         $data['data'] = $this->Sales_model->getSales2()->get()->result();
  19.         // echo '<pre>' . var_export($data, true) . '</pre>';
  20.         // die;
  21.         $this->load->view('jurnal_report/sales_list',$data);
  22.     }
  23.  
  24.     public function sales_customer(){
  25.         $data['customer'] = $this->Customer_model->getCustomerSales();
  26.         $data['awal'] = date('Y-m-d');
  27.         $data['akhir'] = date('Y-m-d');
  28.         $data['is_filter'] = 0;
  29.         // echo '<pre>' . var_export($data, true) . '</pre>';
  30.         // die;
  31.         $this->load->view('jurnal_report/sales_customer',$data);
  32.     }
  33.  
  34.     public function sales_customer_filter(){
  35.         $data['customer'] = $this->Customer_model->getCustomerSales();
  36.         $data['awal'] = $this->input->post('awal');
  37.         $data['akhir'] = $this->input->post('akhir');
  38.         $data['is_filter'] = 1;
  39.         // echo '<pre>' . var_export($data, true) . '</pre>';
  40.         // die;
  41.         $this->load->view('jurnal_report/sales_customer',$data);
  42.     }
  43.  
  44.     public function sales_by_products(){
  45.         $data['data'] = $this->Sales_model->getSalesByProduct();
  46.         $data['product'] = $this->Sales_model->getProducts2();
  47.         $this->load->view('jurnal_report/sales_by_products',$data);
  48.     }
  49.  
  50.     public function customer_balance(){
  51.         $data['data'] = $this->Customer_model->get_sales_customer();
  52.         $data['awal'] = date('Y-m-d');
  53.         $data['akhir'] = date('Y-m-d');
  54.         $data['is_filter'] = 0;
  55.         // echo '<pre>' . var_export($data, true) . '</pre>';
  56.         // die;
  57.         $this->load->view('jurnal_report/customer_balance',$data);
  58.     }
  59.  
  60.     public function customer_balance_filter(){
  61.         $data['awal'] = date('Y-m-d',strtotime($this->input->post('awal')));
  62.         $data['akhir'] = date('Y-m-d',strtotime($this->input->post('akhir')));
  63.         $data['data'] = $this->Customer_model->get_sales_customer_filter($awal,$akhir);
  64.         $data['is_filter'] = 1;
  65.         // echo '<pre>' . var_export($data, true) . '</pre>';
  66.         // die;
  67.         $this->load->view('jurnal_report/customer_balance',$data);
  68.     }
  69.  
  70.     public function sales_by_product_report()
  71.     {
  72.         $product_id = $this->input->post('product');
  73.         $start_date =  $this->input->post('start_date');
  74.         $end_date = $this->input->post('end_date');
  75.         if($this->input->post('submit') == "Submit"){
  76.             $data = $this->Sales_model->getSalesByProduct($product_id,$start_date,$end_date);
  77.             $data['product'] = $this->Sales_model->getProducts2();
  78.             $this->load->view('jurnal_report/sales_by_products',$data);
  79.         }
  80.     }
  81.  
  82.     public function purchase_list(){
  83.         $filter = null;
  84.         if(isset($_GET['filter'])) {
  85.           if ($_GET['filter'] != null) {
  86.             $filter = $_GET['filter'];
  87.           }
  88.         }
  89.        
  90.         // get all purchase record and display list
  91.         $data['data'] = $this->reports_model->getPurchase($filter);
  92.         $data['awal'] = date('Y-m-d');
  93.         $data['akhir'] = date('Y-m-d');
  94.         $data['is_filter'] = 0;
  95.         $this->load->view('jurnal_report/purchase_list',$data);
  96.     }
  97.  
  98.     public function purchase_list_filter(){
  99.         $filter = null;
  100.         if(isset($_GET['filter'])) {
  101.           if ($_GET['filter'] != null) {
  102.             $filter = $_GET['filter'];
  103.           }
  104.         }
  105.        
  106.         // get all purchase record and display list
  107.         $data['awal'] = date('Y-m-d',strtotime($this->input->post('awal')));
  108.         $data['akhir'] = date('Y-m-d',strtotime($this->input->post('akhir')));
  109.         $data['data'] = $this->reports_model->getPurchase_filter($data['awal'],$data['akhir']);
  110.         $data['is_filter'] = 1;
  111.         $this->load->view('jurnal_report/purchase_list',$data);
  112.     }
  113.  
  114.     public function purchase_by_vendor(){
  115.         $data['data'] = $this->Supplier_model->purchase_by_vendor();
  116.         $data['awal'] = date('Y-m-d');
  117.         $data['akhir'] = date('Y-m-d');
  118.         $data['is_filter'] = 0;
  119.         // echo '<pre>' . var_export($data, true) . '</pre>';
  120.         // die;
  121.         $this->load->view('jurnal_report/purchase_by_vendor',$data);
  122.     }
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement