Advertisement
fadlyshafa

Untitled

May 6th, 2020
1,109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 39.53 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. require_once APPPATH .'/../vendor/autoload.php';
  4. class Jurnal_report extends CI_Controller
  5. {
  6.     function __construct() {
  7.         parent::__construct();
  8.         $this->load->model('reports_model');
  9.         $this->load->model('workorder_model');
  10.         $this->load->model('warehouse_model');
  11.         $this->load->model('log_model');
  12.         $this->load->model('Warehouses_products_model');
  13.         $this->load->model('Sales_model');
  14.         $this->load->model('sales_return_model');
  15.         $this->load->model('Customer_model');
  16.         $this->load->model('Supplier_model');
  17.         $this->load->model('Accountcategory_model');
  18.         $this->load->model('Expense_model');
  19.         $this->load->model('Expense_category_model');
  20.         $this->load->model('purchase_model');
  21.         $this->load->model('quotation_model');
  22.  
  23.     }
  24.  
  25.     public function sales_list(){
  26.         $data['data'] = $this->Sales_model->getSales2()->get()->result();
  27.         $data['url_pdf'] = base_url('jurnal_report/sales_list_pdf');
  28.         // echo '<pre>' . var_export($data, true) . '</pre>';
  29.         // die;
  30.         $this->load->view('jurnal_report/sales_list',$data);
  31.     }
  32.  
  33.     public function sales_list_pdf(){
  34.  
  35.         ob_start();
  36.         $html = ob_get_clean();
  37.         $html = utf8_encode($html);
  38.  
  39.         $data['data'] = $this->Sales_model->getSales2()->get()->result();
  40.         // echo '<pre>' . var_export($data, true) . '</pre>';
  41.         // die;
  42.         $html = $this->load->view('jurnal_report/sales_list_pdf',$data, true);
  43.  
  44.         $mpdf = new \Mpdf\Mpdf();
  45.         $mpdf->allow_charset_conversion = true;
  46.         $mpdf->charset_in = 'UTF-8';
  47.         $mpdf->WriteHTML($html);
  48.         $mpdf->Output('pdf', 'I');
  49.     }
  50.  
  51.     public function sales_customer(){
  52.         $data['customer'] = $this->Customer_model->getCustomerSales();
  53.         $data['awal'] = date('Y-m-d');
  54.         $data['akhir'] = date('Y-m-d');
  55.         $data['is_filter'] = 0;
  56.         $data['url_pdf'] = base_url('jurnal_report/sales_customer_pdf');
  57.         // echo '<pre>' . var_export($data, true) . '</pre>';
  58.         // die;
  59.         $this->load->view('jurnal_report/sales_customer',$data);
  60.     }
  61.  
  62.     public function sales_customer_filter(){
  63.         $data['customer'] = $this->Customer_model->getCustomerSales();
  64.         $data['awal'] = $this->input->post('awal');
  65.         $data['akhir'] = $this->input->post('akhir');
  66.         $data['is_filter'] = 1;
  67.         $data['url_pdf'] = base_url('jurnal_report/sales_customer_pdf_filter/'.$data['awal'].'/'.$data[
  68.     'akhir']);
  69.         // echo '<pre>' . var_export($data, true) . '</pre>';
  70.         // die;
  71.         $this->load->view('jurnal_report/sales_customer',$data);
  72.     }
  73.  
  74.     public function sales_customer_pdf(){
  75.  
  76.         ob_start();
  77.         $html = ob_get_clean();
  78.         $html = utf8_encode($html);
  79.  
  80.         $data['customer'] = $this->Customer_model->getCustomerSales();
  81.         $data['awal'] = date('Y-m-d');
  82.         $data['akhir'] = date('Y-m-d');
  83.         $data['is_filter'] = 0;
  84.         // echo '<pre>' . var_export($data, true) . '</pre>';
  85.         // die;
  86.         $html = $this->load->view('jurnal_report/sales_customer_pdf',$data, true);
  87.  
  88.         $mpdf = new \Mpdf\Mpdf();
  89.         $mpdf->allow_charset_conversion = true;
  90.         $mpdf->charset_in = 'UTF-8';
  91.         $mpdf->WriteHTML($html);
  92.         $mpdf->Output('pdf', 'I');
  93.     }
  94.  
  95.     public function sales_customer_pdf_filter($awal, $akhir){
  96.  
  97.         ob_start();
  98.         $html = ob_get_clean();
  99.         $html = utf8_encode($html);
  100.  
  101.         $data['customer'] = $this->Customer_model->getCustomerSales();
  102.         $data['awal'] = date('Y-m-d',strtotime($awal));
  103.         $data['akhir'] = date('Y-m-d',strtotime($akhir));
  104.         $data['is_filter'] = 1;
  105.         // echo '<pre>' . var_export($data, true) . '</pre>';
  106.         // die;
  107.         $html = $this->load->view('jurnal_report/sales_customer_pdf',$data, true);
  108.  
  109.         $mpdf = new \Mpdf\Mpdf();
  110.         $mpdf->allow_charset_conversion = true;
  111.         $mpdf->charset_in = 'UTF-8';
  112.         $mpdf->WriteHTML($html);
  113.         $mpdf->Output('pdf', 'I');
  114.     }
  115.  
  116.     public function sales_by_products(){
  117.         $data['data'] = $this->Sales_model->getSalesByProduct();
  118.         $data['awal'] = date('Y-m-d');
  119.         $data['akhir'] = date('Y-m-d');
  120.         $data['is_filter'] = 0;
  121.         $data['url_pdf'] = base_url('jurnal_report/sales_by_products_pdf');
  122.         $data['product'] = $this->Sales_model->getProducts2();
  123.         // echo '<pre>' . var_export($data, true) . '</pre>';
  124.         // die;
  125.         $this->load->view('jurnal_report/sales_by_products',$data);
  126.     }
  127.  
  128.     public function sales_by_products_filter(){
  129.  
  130.         $data['awal'] = $this->input->post('awal');
  131.         $data['akhir'] = $this->input->post('akhir');
  132.         $data['data'] = $this->Sales_model->getSalesByProduct_filter($data['awal'], $data['akhir']);
  133.         $data['is_filter'] = 1;
  134.         $data['url_pdf'] = base_url('jurnal_report/sales_by_products_pdf_filter/'.$data['awal'].'/'.$data['akhir']);
  135.         $data['product'] = $this->Sales_model->getProducts2();
  136.         $this->load->view('jurnal_report/sales_by_products',$data);
  137.     }
  138.  
  139.     public function sales_by_products_pdf(){
  140.  
  141.         ob_start();
  142.         $html = ob_get_clean();
  143.         $html = utf8_encode($html);
  144.  
  145.         $data['data'] = $this->Sales_model->getSalesByProduct();
  146.         $data['awal'] = date('Y-m-d');
  147.         $data['akhir'] = date('Y-m-d');
  148.         $data['is_filter'] = 0;
  149.         $data['product'] = $this->Sales_model->getProducts2();
  150.         // echo '<pre>' . var_export($data, true) . '</pre>';
  151.         // die;
  152.         $html = $this->load->view('jurnal_report/sales_by_products_pdf',$data, true);
  153.  
  154.         $mpdf = new \Mpdf\Mpdf();
  155.         $mpdf->allow_charset_conversion = true;
  156.         $mpdf->charset_in = 'UTF-8';
  157.         $mpdf->WriteHTML($html);
  158.         $mpdf->Output('pdf', 'I');
  159.     }
  160.  
  161.     public function sales_by_products_pdf_filter($awal,$akhir){
  162.  
  163.         ob_start();
  164.         $html = ob_get_clean();
  165.         $html = utf8_encode($html);
  166.  
  167.         $data['awal'] = date('Y-m-d',strtotime($awal));
  168.         $data['akhir'] = date('Y-m-d',strtotime($akhir));
  169.         $data['data'] = $this->Sales_model->getSalesByProduct_filter($data['awal'], $data['akhir']);
  170.         $data['is_filter'] = 1;
  171.         $data['product'] = $this->Sales_model->getProducts2();
  172.  
  173.         $html = $this->load->view('jurnal_report/sales_by_products_pdf',$data, true);
  174.  
  175.         $mpdf = new \Mpdf\Mpdf();
  176.         $mpdf->allow_charset_conversion = true;
  177.         $mpdf->charset_in = 'UTF-8';
  178.         $mpdf->WriteHTML($html);
  179.         $mpdf->Output('pdf', 'I');
  180.     }
  181.  
  182.     public function customer_balance(){
  183.         $data['data'] = $this->Customer_model->get_sales_customer();
  184.         $data['awal'] = date('Y-m-d');
  185.         $data['akhir'] = date('Y-m-d');
  186.         $data['is_filter'] = 0;
  187.         $data['url_pdf'] = base_url('jurnal_report/customer_balance_pdf');
  188.         // echo '<pre>' . var_export($data, true) . '</pre>';
  189.         // die;
  190.         $this->load->view('jurnal_report/customer_balance',$data);
  191.     }
  192.  
  193.     public function customer_balance_filter(){
  194.         $data['awal'] = date('Y-m-d',strtotime($this->input->post('awal')));
  195.         $data['akhir'] = date('Y-m-d',strtotime($this->input->post('akhir')));
  196.         $data['data'] = $this->Customer_model->get_sales_customer_filter($awal,$akhir);
  197.         $data['is_filter'] = 1;
  198.         // echo '<pre>' . var_export($data, true) . '</pre>';
  199.         // die;
  200.         $this->load->view('jurnal_report/customer_balance',$data);
  201.     }
  202.  
  203.     public function customer_balance_pdf(){
  204.  
  205.         ob_start();
  206.         $html = ob_get_clean();
  207.         $html = utf8_encode($html);
  208.  
  209.         $data['data'] = $this->Customer_model->get_sales_customer();
  210.         $data['awal'] = date('Y-m-d');
  211.         $data['akhir'] = date('Y-m-d');
  212.         $data['is_filter'] = 0;
  213.         // echo '<pre>' . var_export($data, true) . '</pre>';
  214.         // die;
  215.         $html = $this->load->view('jurnal_report/customer_balance_pdf',$data, true);
  216.  
  217.         $mpdf = new \Mpdf\Mpdf();
  218.         $mpdf->allow_charset_conversion = true;
  219.         $mpdf->charset_in = 'UTF-8';
  220.         $mpdf->WriteHTML($html);
  221.         $mpdf->Output('pdf', 'I');
  222.     }
  223.  
  224.     public function sales_by_product_report()
  225.     {
  226.         $product_id = $this->input->post('product');
  227.         $start_date =  $this->input->post('start_date');
  228.         $end_date = $this->input->post('end_date');
  229.         if($this->input->post('submit') == "Submit"){
  230.             $data = $this->Sales_model->getSalesByProduct($product_id,$start_date,$end_date);
  231.             $data['product'] = $this->Sales_model->getProducts2();
  232.             $this->load->view('jurnal_report/sales_by_products',$data);
  233.         }
  234.     }
  235.  
  236.     public function purchase_list(){
  237.         $filter = null;
  238.         if(isset($_GET['filter'])) {
  239.           if ($_GET['filter'] != null) {
  240.             $filter = $_GET['filter'];
  241.         }
  242.     }
  243.  
  244.         // get all purchase record and display list
  245.     $data['data'] = $this->reports_model->getPurchase($filter);
  246.     $data['awal'] = date('Y-m-d');
  247.     $data['akhir'] = date('Y-m-d');
  248.     $data['url_pdf'] = base_url('jurnal_report/purchase_list_pdf');
  249.     $data['is_filter'] = 0;
  250.     $this->load->view('jurnal_report/purchase_list',$data);
  251. }
  252.  
  253. public function purchase_list_filter(){
  254.     $filter = null;
  255.     if(isset($_GET['filter'])) {
  256.       if ($_GET['filter'] != null) {
  257.         $filter = $_GET['filter'];
  258.     }
  259. }
  260.  
  261.         // get all purchase record and display list
  262. $data['awal'] = date('Y-m-d',strtotime($this->input->post('awal')));
  263. $data['akhir'] = date('Y-m-d',strtotime($this->input->post('akhir')));
  264. $data['url_pdf'] = base_url('jurnal_report/purchase_list_filter_pdf/'.$data['awal'].'/'.$data['akhir']);
  265. $data['data'] = $this->reports_model->getPurchase_filter($data['awal'],$data['akhir']);
  266. $data['is_filter'] = 1;
  267. $this->load->view('jurnal_report/purchase_list',$data);
  268. }
  269.  
  270. public function purchase_list_pdf(){
  271.  
  272.     ob_start();
  273.     $html = ob_get_clean();
  274.     $html = utf8_encode($html);
  275.  
  276.     $filter = null;
  277.     if(isset($_GET['filter'])) {
  278.       if ($_GET['filter'] != null) {
  279.         $filter = $_GET['filter'];
  280.     }
  281. }
  282.  
  283.         // get all purchase record and display list
  284. $data['data'] = $this->reports_model->getPurchase($filter);
  285. $data['awal'] = date('Y-m-d');
  286. $data['akhir'] = date('Y-m-d');
  287. $data['is_filter'] = 0;
  288. $html = $this->load->view('jurnal_report/purchase_list_pdf',$data, true);
  289.  
  290. $mpdf = new \Mpdf\Mpdf();
  291. $mpdf->allow_charset_conversion = true;
  292. $mpdf->charset_in = 'UTF-8';
  293. $mpdf->WriteHTML($html);
  294. $mpdf->Output('pdf', 'I');
  295. }
  296.  
  297. public function purchase_list_filter_pdf($awal, $akhir){
  298.  
  299.     ob_start();
  300.     $html = ob_get_clean();
  301.     $html = utf8_encode($html);
  302.     $filter = null;
  303.  
  304.     if(isset($_GET['filter'])) {
  305.       if ($_GET['filter'] != null) {
  306.         $filter = $_GET['filter'];
  307.     }
  308. }
  309.  
  310.         // get all purchase record and display list
  311. $data['awal'] = date('Y-m-d',strtotime($awal));
  312. $data['akhir'] = date('Y-m-d',strtotime($akhir));
  313. $data['data'] = $this->reports_model->getPurchase_filter($data['awal'],$data['akhir']);
  314. $data['is_filter'] = 1;
  315.  
  316. $html = $this->load->view('jurnal_report/purchase_list_pdf',$data, true);
  317.  
  318. $mpdf = new \Mpdf\Mpdf();
  319. $mpdf->allow_charset_conversion = true;
  320. $mpdf->charset_in = 'UTF-8';
  321. $mpdf->WriteHTML($html);
  322. $mpdf->Output('pdf', 'I');
  323. }
  324.  
  325. public function purchase_by_vendor(){
  326.     $data['data'] = $this->Supplier_model->purchase_by_vendor();
  327.     $data['vendor'] = $this->Supplier_model->purchase_by_vendor();
  328.     $data['awal'] = date('Y-m-d');
  329.     $data['akhir'] = date('Y-m-d');
  330.     $data['url_pdf'] = base_url('jurnal_report/purchase_by_vendor_pdf');
  331.     $data['is_filter'] = 0;
  332.         // echo '<pre>' . var_export($data, true) . '</pre>';
  333.         // die;
  334.     $this->load->view('jurnal_report/purchase_by_vendor',$data);
  335. }
  336.  
  337. public function purchase_by_vendor_filter(){
  338.     $data['vendor'] = $this->Supplier_model->purchase_by_vendor();
  339.     $supp = $this->input->post('vendor');
  340.  
  341.     $data['awal'] = date('Y-m-d',strtotime($this->input->post('awal')));
  342.     $data['akhir'] = date('Y-m-d',strtotime($this->input->post('akhir')));
  343.     $data['url_pdf'] = base_url('jurnal_report/purchase_by_vendor_pdf_filter/'.$data['awal'].'/'.$data['akhir'].'/'.$supp);
  344.     $data['data'] = $this->Supplier_model->purchase_by_vendor_filter($data['awal'],$data['akhir'], $supp);
  345.     $data['is_filter'] = 1;
  346.         // echo '<pre>' . var_export($data, true) . '</pre>';
  347.         // die;
  348.     $this->load->view('jurnal_report/purchase_by_vendor',$data);
  349. }
  350.  
  351. public function purchase_by_vendor_pdf() {
  352.  
  353.  
  354.    ob_start();
  355.    $html = ob_get_clean();
  356.    $html = utf8_encode($html);
  357.  
  358.    $data['data'] = $this->Supplier_model->purchase_by_vendor();
  359.    $data['vendor'] = $this->Supplier_model->purchase_by_vendor();
  360.    $data['awal'] = date('Y-m-d');
  361.    $data['akhir'] = date('Y-m-d');
  362.    $data['is_filter'] = 0;
  363.  
  364.    $html = $this->load->view('jurnal_report/purchase_by_vendor_pdf', $data, true);
  365.  
  366.    $mpdf = new \Mpdf\Mpdf();
  367.    $mpdf->allow_charset_conversion = true;
  368.    $mpdf->charset_in = 'UTF-8';
  369.    $mpdf->WriteHTML($html);
  370.    $mpdf->Output('pdf', 'I');
  371.  
  372. }
  373.  
  374. public function purchase_by_vendor_pdf_filter($awal, $akhir) {
  375.  
  376.  
  377.    ob_start();
  378.    $html = ob_get_clean();
  379.    $html = utf8_encode($html);
  380.  
  381.    // $data['vendor'] = $this->Supplier_model->purchase_by_vendor();
  382.    // $supp = $this->input->post('vendor');
  383.  
  384.    $data['awal'] = date('Y-m-d',strtotime($awal));
  385.    $data['akhir'] = date('Y-m-d',strtotime($akhir));
  386.    $data['data'] = $this->purchase_model->getPurchaseBySupplier_filterPDF($data['awal'],$data['akhir']);
  387.    $data['is_filter'] = 1;
  388.  
  389.    $html = $this->load->view('jurnal_report/purchase_by_vendor_pdf', $data, true);
  390.  
  391.    $mpdf = new \Mpdf\Mpdf();
  392.    $mpdf->allow_charset_conversion = true;
  393.    $mpdf->charset_in = 'UTF-8';
  394.    $mpdf->WriteHTML($html);
  395.    $mpdf->Output('pdf', 'I');
  396.  
  397. }
  398.  
  399. public function purchase_by_product(){
  400.     $data['data'] = $this->Supplier_model->purchase_by_product();
  401.     $data['awal'] = date('Y-m-d');
  402.     $data['akhir'] = date('Y-m-d');
  403.     $data['is_filter'] = 0;
  404.     $data['url_pdf'] = base_url('jurnal_report/purchase_by_product_pdf');
  405.         // echo '<pre>' . var_export($data, true) . '</pre>';
  406.         // die;
  407.     $this->load->view('jurnal_report/purchase_by_product',$data);
  408. }
  409.  
  410. public function purchase_by_product_filter(){
  411.     $data['awal'] = date('Y-m-d',strtotime($this->input->post('awal')));
  412.     $data['akhir'] = date('Y-m-d',strtotime($this->input->post('akhir')));
  413.     $data['data'] = $this->Supplier_model->purchase_by_product_filter($data['awal'],$data['akhir']);
  414.     $data['is_filter'] = 1;
  415.     $data['url_pdf'] = base_url('jurnal_report/purchase_by_product_pdf_filter/'.$data['awal'].'/'.$data['akhir']);
  416.         // echo '<pre>' . var_export($data, true) . '</pre>';
  417.         // die;
  418.     $this->load->view('jurnal_report/purchase_by_product',$data);
  419. }
  420.  
  421. public function purchase_by_product_pdf(){
  422.  
  423.     ob_start();
  424.     $html = ob_get_clean();
  425.     $html = utf8_encode($html);
  426.  
  427.     $data['data'] = $this->Supplier_model->purchase_by_product();
  428.     $data['awal'] = date('Y-m-d');
  429.     $data['akhir'] = date('Y-m-d');
  430.     $data['is_filter'] = 0;
  431.         // echo '<pre>' . var_export($data, true) . '</pre>';
  432.         // die;
  433.     $html = $this->load->view('jurnal_report/purchase_by_product_pdf', $data, true);
  434.  
  435.     $mpdf = new \Mpdf\Mpdf();
  436.     $mpdf->allow_charset_conversion = true;
  437.     $mpdf->charset_in = 'UTF-8';
  438.     $mpdf->WriteHTML($html);
  439.     $mpdf->Output('pdf', 'I');
  440. }
  441.  
  442. public function purchase_by_product_pdf_filter($awal, $akhir){
  443.  
  444.     ob_start();
  445.     $html = ob_get_clean();
  446.     $html = utf8_encode($html);
  447.  
  448.     $data['awal'] = date('Y-m-d',strtotime($awal));
  449.     $data['akhir'] = date('Y-m-d',strtotime($akhir));
  450.     $data['data'] = $this->Supplier_model->purchase_by_product_filter($data['awal'],$data['akhir']);
  451.     $data['is_filter'] = 1;
  452.         // echo '<pre>' . var_export($data, true) . '</pre>';
  453.         // die;
  454.     $html = $this->load->view('jurnal_report/purchase_by_product_pdf', $data, true);
  455.  
  456.     $mpdf = new \Mpdf\Mpdf();
  457.     $mpdf->allow_charset_conversion = true;
  458.     $mpdf->charset_in = 'UTF-8';
  459.     $mpdf->WriteHTML($html);
  460.     $mpdf->Output('pdf', 'I');
  461. }
  462.  
  463.  
  464. public function warehouse_balance(){
  465.         // $data = $this->db->select()
  466.         //         ->from('purchases p')
  467.         //         ->join('expense e','e.reference_no = p.purchase_id','left')
  468.         //         ->where('p.total - e.amount != ',0)
  469.         //         ->get()->result();
  470.     $data['data'] = $this->db->query("SELECT p.reference_no,p.date,p.total - e.amount as hasil,p.total as nominal_po,e.amount,sp.supplier_name from purchases p inner join expense e on e.reference_no = p.purchase_id left join suppliers sp on sp.supplier_id=p.supplier_id where p.total - e.amount != 0")->result();
  471.     $data['awal'] = date('Y-m-d');
  472.     $data['akhir'] = date('Y-m-d');
  473.         // echo '<pre>' . var_export($data, true) . '</pre>';
  474.         // die;
  475.     $this->load->view('jurnal_report/warehouse_balance',$data);
  476. }
  477.  
  478. public function inventory_summary() {
  479.     //get all product details to display list
  480.     // $id_produk = $this->input
  481.     $data['data'] = $this->reports_model->getProducts2();
  482.     $data['produk'] = $this->reports_model->getProducts2();
  483.     $data['is_filter'] = 0;
  484.     $data['url_pdf'] = base_url('jurnal_report/inventory_summary_pdf');
  485.  
  486.     for ($i=0; $i < count($data['data']) ; $i++) {
  487.  
  488.       if ($data['data'][$i]->product_grouping != NULL) {
  489.        $arlist = json_encode(unserialize($data['data'][$i]->list));
  490.        $arlist = json_decode($arlist);
  491.        $max = array();
  492.        for ($ilist = 0; $ilist < count($arlist); $ilist++) {
  493.  
  494.         $qtyp = $this->db->select('quantity')->from('products')->where('product_id', $arlist[$ilist]->pl)->get()->result()[0]->quantity;
  495.         @$count = ($qtyp / intval($arlist[$ilist]->ql));
  496.         array_push($max, $count);
  497.     }
  498.     $min = min($max);
  499.     $data['data'][$i]->quantity = intval($min);
  500. }
  501. }
  502. $this->load->view('jurnal_report/inventory_summary', $data);
  503. }
  504.  
  505. public function inventory_summary_filter() {
  506.     //get all product details to display list
  507.     $id_produk = $this->input->post('produk');
  508.     $data['data'] = $this->reports_model->getProducts2_filter($id_produk);
  509.     $data['produk'] = $this->reports_model->getProducts2();
  510.     $data['is_filter'] = 1;
  511.     $data['url_pdf'] = base_url('jurnal_report/inventory_summary_pdf_filter/'.$id_produk);
  512.  
  513.     for ($i=0; $i < count($data['data']) ; $i++) {
  514.  
  515.       if ($data['data'][$i]->product_grouping != NULL) {
  516.        $arlist = json_encode(unserialize($data['data'][$i]->list));
  517.        $arlist = json_decode($arlist);
  518.        $max = array();
  519.        for ($ilist = 0; $ilist < count($arlist); $ilist++) {
  520.  
  521.         $qtyp = $this->db->select('quantity')->from('products')->where('product_id', $arlist[$ilist]->pl)->get()->result()[0]->quantity;
  522.         @$count = ($qtyp / intval($arlist[$ilist]->ql));
  523.         array_push($max, $count);
  524.     }
  525.     $min = min($max);
  526.     $data['data'][$i]->quantity = intval($min);
  527. }
  528. }
  529. $this->load->view('jurnal_report/inventory_summary', $data);
  530. }
  531.  
  532. public function inventory_summary_pdf() {
  533.  
  534.     ob_start();
  535.     $html = ob_get_clean();
  536.     $html = utf8_encode($html);
  537.     //get all product details to display list
  538.     // $id_produk = $this->input
  539.     $data['data'] = $this->reports_model->getProducts2();
  540.     $data['produk'] = $this->reports_model->getProducts2();
  541.     $data['is_filter'] = 0;
  542.  
  543.     for ($i=0; $i < count($data['data']) ; $i++) {
  544.  
  545.       if ($data['data'][$i]->product_grouping != NULL) {
  546.        $arlist = json_encode(unserialize($data['data'][$i]->list));
  547.        $arlist = json_decode($arlist);
  548.        $max = array();
  549.        for ($ilist = 0; $ilist < count($arlist); $ilist++) {
  550.  
  551.         $qtyp = $this->db->select('quantity')->from('products')->where('product_id', $arlist[$ilist]->pl)->get()->result()[0]->quantity;
  552.         @$count = ($qtyp / intval($arlist[$ilist]->ql));
  553.         array_push($max, $count);
  554.     }
  555.     $min = min($max);
  556.     $data['data'][$i]->quantity = intval($min);
  557. }
  558. }
  559. $html = $this->load->view('jurnal_report/inventory_summary_pdf', $data, true);
  560.  
  561.     $mpdf = new \Mpdf\Mpdf();
  562.     $mpdf->allow_charset_conversion = true;
  563.     $mpdf->charset_in = 'UTF-8';
  564.     $mpdf->WriteHTML($html);
  565.     $mpdf->Output('pdf', 'I');
  566. }
  567.  
  568. public function inventory_summary_pdf_filter($produk) {
  569.  
  570.     ob_start();
  571.     $html = ob_get_clean();
  572.     $html = utf8_encode($html);
  573.  
  574.     //get all product details to display list
  575.     $id_produk = $produk;
  576.     $data['data'] = $this->reports_model->getProducts2_filter($id_produk);
  577.     $data['produk'] = $this->reports_model->getProducts2();
  578.     $data['is_filter'] = 1;
  579.  
  580.     for ($i=0; $i < count($data['data']) ; $i++) {
  581.  
  582.       if ($data['data'][$i]->product_grouping != NULL) {
  583.        $arlist = json_encode(unserialize($data['data'][$i]->list));
  584.        $arlist = json_decode($arlist);
  585.        $max = array();
  586.        for ($ilist = 0; $ilist < count($arlist); $ilist++) {
  587.  
  588.         $qtyp = $this->db->select('quantity')->from('products')->where('product_id', $arlist[$ilist]->pl)->get()->result()[0]->quantity;
  589.         @$count = ($qtyp / intval($arlist[$ilist]->ql));
  590.         array_push($max, $count);
  591.     }
  592.     $min = min($max);
  593.     $data['data'][$i]->quantity = intval($min);
  594. }
  595. }
  596. $html = $this->load->view('jurnal_report/inventory_summary_pdf', $data, true);
  597.  
  598.     $mpdf = new \Mpdf\Mpdf();
  599.     $mpdf->allow_charset_conversion = true;
  600.     $mpdf->charset_in = 'UTF-8';
  601.     $mpdf->WriteHTML($html);
  602.     $mpdf->Output('pdf', 'I');
  603. }
  604.  
  605. public function warehouse_stock_qty()
  606. {
  607.         //get all product details to display list
  608.     $data['data'] = $this->warehouse_model->getProducts();
  609.         // print_r(var_dump($this->db->last_query()));
  610.     $data['category'] = $this->reports_model->getCategory();
  611.     $data['url_pdf'] = base_url('jurnal_report/warehouse_stock_qty_pdf');
  612.     $this->load->view('jurnal_report/warehouse_stock_qty',$data);
  613. }
  614.  
  615. public function warehouse_stock_qty_pdf()
  616. {
  617.     ob_start();
  618.     $html = ob_get_clean();
  619.     $html = utf8_encode($html);
  620.  
  621.         //get all product details to display list
  622.     $data['data'] = $this->warehouse_model->getProducts();
  623.         // print_r(var_dump($this->db->last_query()));
  624.     $data['category'] = $this->reports_model->getCategory();
  625.  
  626.     $html = $this->load->view('jurnal_report/warehouse_stock_qty_pdf', $data, true);
  627.  
  628.     $mpdf = new \Mpdf\Mpdf();
  629.     $mpdf->allow_charset_conversion = true;
  630.     $mpdf->charset_in = 'UTF-8';
  631.     $mpdf->WriteHTML($html);
  632.     $mpdf->Output('pdf', 'I');
  633. }
  634.  
  635.  
  636. public function aged_payable(){
  637.  
  638.     $data['data'] = $this->db->select('s.supplier_name,sum(p.total) as total,pt.due_date')
  639.                     ->from('suppliers s')
  640.                     ->join('purchases p','p.supplier_id = s.supplier_id')
  641.                     ->join('purchase_termin pt','pt.purchase_id = p.purchase_id','left')
  642.                     ->group_by('p.supplier_id')
  643.                     ->get()->result();
  644.  
  645.     $data['awal'] = date('Y-m-d');
  646.     $data['akhir'] = date('Y-m-d');
  647.     $data['is_filter'] = 0;
  648.     $data['url_pdf'] = base_url('jurnal_report/aged_payable_pdf');
  649.         // echo '<pre>' . var_export($data, true) . '</pre>';
  650.         // die;
  651.     $this->load->view('jurnal_report/aged_payable',$data);
  652. }
  653.  
  654. public function aged_payable_pdf(){
  655.  
  656.     ob_start();
  657.     $html = ob_get_clean();
  658.     $html = utf8_encode($html);
  659.  
  660.     $data['data'] = $this->Accountcategory_model->getAccountCategory();
  661.     $data['awal'] = date('Y-m-d');
  662.     $data['akhir'] = date('Y-m-d');
  663.     $data['is_filter'] = 0;
  664.         // echo '<pre>' . var_export($data, true) . '</pre>';
  665.         // die;
  666.     $html = $this->load->view('jurnal_report/aged_payable_pdf', $data, true);
  667.  
  668.     $mpdf = new \Mpdf\Mpdf();
  669.     $mpdf->allow_charset_conversion = true;
  670.     $mpdf->charset_in = 'UTF-8';
  671.     $mpdf->WriteHTML($html);
  672.     $mpdf->Output('pdf', 'I');
  673. }
  674.  
  675. public function expense_list()
  676. {  
  677.     $data['expense'] = $this->Expense_model->getExpense();
  678.     $data['awal'] = date('Y-m-d');
  679.     $data['akhir'] = date('Y-m-d');
  680.     $data['is_filter'] = 0;
  681.     $data['url_pdf'] = base_url('jurnal_report/expense_list_pdf');
  682.         // echo "<pre>";
  683.         // print_r($data);
  684.         // exit();
  685.     $this->load->view('jurnal_report/expense_list',$data);
  686. }
  687.  
  688. public function expense_list_filter()
  689. {
  690.     $data['awal'] = $this->input->post('awal');
  691.     $data['akhir'] = $this->input->post('akhir');  
  692.     $data['expense'] = $this->Expense_model->getExpense_filter($data['awal'], $data['akhir']);
  693.     $data['is_filter'] = 1;
  694.     $data['url_pdf'] = base_url('jurnal_report/expense_list_pdf_filter/'.$data['awal'].'/'.$data['akhir']);
  695.         // echo "<pre>";
  696.         // print_r($data);
  697.         // exit();
  698.     $this->load->view('jurnal_report/expense_list',$data);
  699. }
  700.  
  701. public function expense_list_pdf(){
  702.  
  703.    ob_start();
  704.    $html = ob_get_clean();
  705.    $html = utf8_encode($html);
  706.  
  707.    $data['expense'] = $this->Expense_model->getExpense();
  708.    $data['awal'] = date('Y-m-d');
  709.    $data['akhir'] = date('Y-m-d');
  710.    $data['is_filter'] = 0;
  711.         // echo "<pre>";
  712.         // print_r($data);
  713.         // exit();
  714.    $html = $this->load->view('jurnal_report/expense_list_pdf',$data, true);
  715.  
  716.    $mpdf = new \Mpdf\Mpdf();
  717.    $mpdf->allow_charset_conversion = true;
  718.    $mpdf->charset_in = 'UTF-8';
  719.    $mpdf->WriteHTML($html);
  720.    $mpdf->Output('pdf', 'I');
  721. }
  722.  
  723. public function expense_list_pdf_filter($awal, $akhir)
  724. {
  725.     ob_start();
  726.     $html = ob_get_clean();
  727.     $html = utf8_encode($html);
  728.  
  729.     $data['awal'] = date('Y-m-d',strtotime($awal));
  730.     $data['akhir'] = date('Y-m-d',strtotime($akhir));  
  731.     $data['expense'] = $this->Expense_model->getExpense_filter($data['awal'], $data['akhir']);
  732.     $data['is_filter'] = 1;
  733.         // echo "<pre>";
  734.         // print_r($data);
  735.         // exit();
  736.     $html = $this->load->view('jurnal_report/expense_list_pdf',$data, true);
  737.  
  738.     $mpdf = new \Mpdf\Mpdf();
  739.     $mpdf->allow_charset_conversion = true;
  740.     $mpdf->charset_in = 'UTF-8';
  741.     $mpdf->WriteHTML($html);
  742.     $mpdf->Output('pdf', 'I');
  743. }
  744.  
  745. public function expense_details(){
  746.     $data['expense'] = $this->Expense_category_model->getExpenseCategory();
  747.     $data['awal'] = date('Y-m-d');
  748.     $data['akhir'] = date('Y-m-d');
  749.     $data['is_filter'] = 0;
  750.     $data['url_pdf'] = base_url('jurnal_report/expense_details_pdf');
  751.         // echo '<pre>' . var_export($data, true) . '</pre>';
  752.         // die;
  753.     $this->load->view('jurnal_report/expense_details',$data);
  754. }
  755.  
  756. public function expense_details_filter(){
  757.     $data['expense'] = $this->Expense_category_model->getExpenseCategory();
  758.     $data['awal'] = $this->input->post('awal');
  759.     $data['akhir'] = $this->input->post('akhir');
  760.     $data['is_filter'] = 1;
  761.     $data['url_pdf'] = base_url('jurnal_report/expense_details_pdf_filter/'.$data['awal'].'/'.$data['akhir']);
  762.         // echo '<pre>' . var_export($data, true) . '</pre>';
  763.         // die;
  764.     $this->load->view('jurnal_report/expense_details',$data);
  765. }
  766.  
  767. public function expense_details_pdf(){
  768.  
  769.     ob_start();
  770.     $html = ob_get_clean();
  771.     $html = utf8_encode($html);
  772.  
  773.     $data['expense'] = $this->Expense_category_model->getExpenseCategory();
  774.     $data['awal'] = date('Y-m-d');
  775.     $data['akhir'] = date('Y-m-d');
  776.     $data['is_filter'] = 0;
  777.         // echo '<pre>' . var_export($data, true) . '</pre>';
  778.         // die;
  779.     $html = $this->load->view('jurnal_report/expense_details_pdf',$data, true);
  780.  
  781.     $mpdf = new \Mpdf\Mpdf();
  782.     $mpdf->allow_charset_conversion = true;
  783.     $mpdf->charset_in = 'UTF-8';
  784.     $mpdf->WriteHTML($html);
  785.     $mpdf->Output('pdf', 'I');
  786. }
  787.  
  788. public function expense_details_pdf_filter($awal, $akhir){
  789.  
  790.     ob_start();
  791.     $html = ob_get_clean();
  792.     $html = utf8_encode($html);
  793.  
  794.     $data['expense'] = $this->Expense_category_model->getExpenseCategory();
  795.     $data['awal'] = date('Y-m-d',strtotime($awal));
  796.     $data['akhir'] = date('Y-m-d',strtotime($akhir));
  797.     $data['is_filter'] = 1;
  798.         // echo '<pre>' . var_export($data, true) . '</pre>';
  799.         // die;
  800.     $html = $this->load->view('jurnal_report/expense_details_pdf',$data, true);
  801.  
  802.     $mpdf = new \Mpdf\Mpdf();
  803.     $mpdf->allow_charset_conversion = true;
  804.     $mpdf->charset_in = 'UTF-8';
  805.     $mpdf->WriteHTML($html);
  806.     $mpdf->Output('pdf', 'I');
  807. }
  808.  
  809.  
  810. public function inventory_valuation(){
  811.     $data['stock_in'] = $this->db->select('sum(ii.qty) as total_qty,sum(p.price) as total_price')
  812.     ->from('inventory_items ii')
  813.     ->join('products p','p.product_id=ii.product_id','left')
  814.     ->get()->result();
  815.  
  816.     $data['stock_out'] = $this->db->select('sum(si.quantity) as total_qty,sum(si.price) as total_price')
  817.     ->from('sales_items si')
  818.     ->get()->result();
  819.  
  820.     $data['saldo_awal'] = $this->db->select('sum(wp.quantity) as total_qty,sum(p.price) as total_price')
  821.     ->from('warehouses_products wp')
  822.     ->join('products p','p.product_id = wp.product_id','left')
  823.     ->get()
  824.     ->result();
  825.     $data['awal'] = date('Y-m-d');
  826.     $data['akhir'] = date('Y-m-d');
  827.     $data['url_pdf'] = base_url('jurnal_report/inventory_valuation_pdf');
  828.  
  829.         // $data['expense'] = $this->Expense_category_model->getExpenseCategory();
  830.         // $data['awal'] = $this->input->post('awal');
  831.         // $data['akhir'] = $this->input->post('akhir');
  832.         // $data['is_filter'] = 0;
  833.         // echo '<pre>' . var_export($stock_out, true) . '</pre>';
  834.         // die;
  835.     $this->load->view('jurnal_report/inventory_valuation',$data);
  836. }
  837.  
  838. public function inventory_valuation_pdf(){
  839.  
  840.     ob_start();
  841.     $html = ob_get_clean();
  842.     $html = utf8_encode($html);
  843.  
  844.     $data['stock_in'] = $this->db->select('sum(ii.qty) as total_qty,sum(p.price) as total_price')
  845.     ->from('inventory_items ii')
  846.     ->join('products p','p.product_id=ii.product_id','left')
  847.     ->get()->result();
  848.  
  849.     $data['stock_out'] = $this->db->select('sum(si.quantity) as total_qty,sum(si.price) as total_price')
  850.     ->from('sales_items si')
  851.     ->get()->result();
  852.  
  853.     $data['saldo_awal'] = $this->db->select('sum(wp.quantity) as total_qty,sum(p.price) as total_price')
  854.     ->from('warehouses_products wp')
  855.     ->join('products p','p.product_id = wp.product_id','left')
  856.     ->get()
  857.     ->result();
  858.     $data['awal'] = date('Y-m-d');
  859.     $data['akhir'] = date('Y-m-d');
  860.  
  861.         // $data['expense'] = $this->Expense_category_model->getExpenseCategory();
  862.         // $data['awal'] = $this->input->post('awal');
  863.         // $data['akhir'] = $this->input->post('akhir');
  864.         // $data['is_filter'] = 0;
  865.         // echo '<pre>' . var_export($stock_out, true) . '</pre>';
  866.         // die;
  867.     $html = $this->load->view('jurnal_report/inventory_valuation_pdf',$data, true);
  868.  
  869.     $mpdf = new \Mpdf\Mpdf();
  870.     $mpdf->allow_charset_conversion = true;
  871.     $mpdf->charset_in = 'UTF-8';
  872.     $mpdf->WriteHTML($html);
  873.     $mpdf->Output('pdf', 'I');
  874. }
  875.  
  876. public function warehouse_item_valuation(){
  877.     $data['warehouse'] = $this->db->get('warehouse')->result();
  878.  
  879.     $data['stock_in'] = $this->db->select('sum(ii.qty) as total_qty,sum(p.price) as total_price')
  880.     ->from('inventory_items ii')
  881.     ->join('products p','p.product_id=ii.product_id','left')
  882.     ->get()->result();
  883.  
  884.     $data['stock_out'] = $this->db->select('sum(si.quantity) as total_qty,sum(si.price) as total_price')
  885.     ->from('sales_items si')
  886.     ->get()->result();
  887.  
  888.     $data['saldo_awal'] = $this->db->select('sum(wp.quantity) as total_qty,sum(p.price) as total_price')
  889.     ->from('warehouses_products wp')
  890.     ->join('products p','p.product_id = wp.product_id','left')
  891.     ->get()
  892.     ->result();
  893.     $data['awal'] = date('Y-m-d');
  894.     $data['akhir'] = date('Y-m-d');
  895.     $data['url_pdf'] = base_url('jurnal_report/warehouse_item_valuation_pdf');
  896.  
  897.         // $data['expense'] = $this->Expense_category_model->getExpenseCategory();
  898.         // $data['awal'] = $this->input->post('awal');
  899.         // $data['akhir'] = $this->input->post('akhir');
  900.         // $data['is_filter'] = 0;
  901.         // echo '<pre>' . var_export($stock_out, true) . '</pre>';
  902.         // die;
  903.     $this->load->view('jurnal_report/warehouse_item_valuation',$data);
  904. }
  905.  
  906. public function warehouse_item_valuation_pdf(){
  907.  
  908.     ob_start();
  909.     $html = ob_get_clean();
  910.     $html = utf8_encode($html);
  911.  
  912.     $data['warehouse'] = $this->db->get('warehouse')->result();
  913.  
  914.     $data['stock_in'] = $this->db->select('sum(ii.qty) as total_qty,sum(p.price) as total_price')
  915.     ->from('inventory_items ii')
  916.     ->join('products p','p.product_id=ii.product_id','left')
  917.     ->get()->result();
  918.  
  919.     $data['stock_out'] = $this->db->select('sum(si.quantity) as total_qty,sum(si.price) as total_price')
  920.     ->from('sales_items si')
  921.     ->get()->result();
  922.  
  923.     $data['saldo_awal'] = $this->db->select('sum(wp.quantity) as total_qty,sum(p.price) as total_price')
  924.     ->from('warehouses_products wp')
  925.     ->join('products p','p.product_id = wp.product_id','left')
  926.     ->get()
  927.     ->result();
  928.     $data['awal'] = date('Y-m-d');
  929.     $data['akhir'] = date('Y-m-d');
  930.     $data['url_pdf'] = base_url('jurnal_report/warehouse_item_valuation_pdf');
  931.  
  932.         // $data['expense'] = $this->Expense_category_model->getExpenseCategory();
  933.         // $data['awal'] = $this->input->post('awal');
  934.         // $data['akhir'] = $this->input->post('akhir');
  935.         // $data['is_filter'] = 0;
  936.         // echo '<pre>' . var_export($stock_out, true) . '</pre>';
  937.         // die;
  938.     $html = $this->load->view('jurnal_report/warehouse_item_valuation_pdf',$data, true);
  939.  
  940.     $mpdf = new \Mpdf\Mpdf();
  941.     $mpdf->allow_charset_conversion = true;
  942.     $mpdf->charset_in = 'UTF-8';
  943.     $mpdf->WriteHTML($html);
  944.     $mpdf->Output('pdf', 'I');
  945. }
  946.  
  947. public function inventory_details(){
  948.     $data['awal'] = date('Y-m-d');
  949.     $data['akhir'] = date('Y-m-d');
  950.     $data['url_pdf'] = base_url('jurnal_report/inventory_details_pdf');
  951.  
  952.     $data['data'] = $this->db->get('stock_out')->result();
  953.  
  954.     $this->load->view('jurnal_report/inventory_details',$data);
  955. }
  956.  
  957. public function inventory_details_pdf(){
  958.  
  959.     ob_start();
  960.     $html = ob_get_clean();
  961.     $html = utf8_encode($html);
  962.    
  963.     $data['awal'] = date('Y-m-d');
  964.     $data['akhir'] = date('Y-m-d');
  965.  
  966.     $data['data'] = $this->db->get('stock_out')->result();
  967.  
  968.     $html = $this->load->view('jurnal_report/inventory_details_pdf',$data, true);
  969.  
  970.     $mpdf = new \Mpdf\Mpdf();
  971.     $mpdf->allow_charset_conversion = true;
  972.     $mpdf->charset_in = 'UTF-8';
  973.     $mpdf->WriteHTML($html);
  974.     $mpdf->Output('pdf', 'I');
  975. }
  976.  
  977. public function purchase_delivery(){
  978.     $data['supplier'] = $this->Supplier_model->getSuppliers();
  979.     $data['awal'] = date('Y-m-d');
  980.     $data['akhir'] = date('Y-m-d');
  981.     $data['is_filter'] = 0;
  982.     $data['url_pdf'] = base_url('jurnal_report/purchase_delivery_pdf');
  983.  
  984.     $this->load->view('jurnal_report/purchase_delivery', $data);
  985. }
  986.  
  987. public function purchase_delivery_filter(){
  988.     $data['supplier'] = $this->Supplier_model->getSuppliers();
  989.     $data['awal'] = $this->input->post('awal');
  990.     $data['akhir'] = $this->input->post('akhir');
  991.     $data['is_filter'] = 1;
  992.     $this->load->view('jurnal_report/purchase_delivery', $data);
  993. }
  994.  
  995. public function purchase_delivery_pdf(){
  996.  
  997.     ob_start();
  998.     $html = ob_get_clean();
  999.     $html = utf8_encode($html);
  1000.  
  1001.     $data['supplier'] = $this->Supplier_model->getSuppliers();
  1002.     $data['awal'] = date('Y-m-d');
  1003.     $data['akhir'] = date('Y-m-d');
  1004.     $data['is_filter'] = 0;
  1005.  
  1006.     $html = $this->load->view('jurnal_report/purchase_delivery_pdf',$data, true);
  1007.  
  1008.     $mpdf = new \Mpdf\Mpdf();
  1009.     $mpdf->allow_charset_conversion = true;
  1010.     $mpdf->charset_in = 'UTF-8';
  1011.     $mpdf->WriteHTML($html);
  1012.     $mpdf->Output('pdf', 'I');
  1013. }
  1014.  
  1015. public function sales_delivery(){
  1016.     $data['customer'] = $this->Customer_model->getCustomers();
  1017.     $data['url_pdf'] = base_url('jurnal_report/sales_delivery_pdf');
  1018.     $this->load->view('jurnal_report/sales_delivery', $data);
  1019. }
  1020.  
  1021. public function sales_delivery_pdf(){
  1022.     ob_start();
  1023.     $html = ob_get_clean();
  1024.     $html = utf8_encode($html);
  1025.  
  1026.     $data['customer'] = $this->Customer_model->getCustomers();
  1027.  
  1028.     $html = $this->load->view('jurnal_report/sales_delivery_pdf',$data, true);
  1029.  
  1030.     $mpdf = new \Mpdf\Mpdf();
  1031.     $mpdf->allow_charset_conversion = true;
  1032.     $mpdf->charset_in = 'UTF-8';
  1033.     $mpdf->WriteHTML($html);
  1034.     $mpdf->Output('pdf', 'I');
  1035. }
  1036.  
  1037. public function purchase_completion(){
  1038.     $filter = null;
  1039.     if(isset($_GET['filter'])) {
  1040.       if ($_GET['filter'] != null) {
  1041.         $filter = $_GET['filter'];
  1042.     }
  1043. }
  1044.         // get all purchase record and display list
  1045. $data['data'] = $this->purchase_model->getPurchaseCompletion($filter);
  1046. $data['awal'] = date('Y-m-d');
  1047. $data['akhir'] = date('Y-m-d');
  1048. $data['is_filter'] = 0;
  1049. $data['url_pdf'] = base_url('jurnal_report/purchase_completion_pdf');
  1050.         // print_r(var_dump($this->db->last_query()));
  1051. $this->load->view('jurnal_report/purchase_completion',$data);
  1052. }
  1053.  
  1054. public function purchase_completion_filter(){
  1055.     $filter = null;
  1056.     if(isset($_GET['filter'])) {
  1057.       if ($_GET['filter'] != null) {
  1058.         $filter = $_GET['filter'];
  1059.     }
  1060. }
  1061.         // get all purchase record and display list
  1062. $data['awal'] = $this->input->post('awal');
  1063. $data['akhir'] = $this->input->post('akhir');
  1064. $data['data'] = $this->purchase_model->getPurchaseCompletion($filter);
  1065. $data['is_filter'] = 1;
  1066.         // print_r(var_dump($this->db->last_query()));
  1067. $this->load->view('jurnal_report/purchase_completion',$data);
  1068. }
  1069.  
  1070. public function purchase_completion_pdf(){
  1071.  
  1072.     ob_start();
  1073.     $html = ob_get_clean();
  1074.     $html = utf8_encode($html);
  1075.  
  1076.     $filter = null;
  1077.     if(isset($_GET['filter'])) {
  1078.       if ($_GET['filter'] != null) {
  1079.         $filter = $_GET['filter'];
  1080.     }
  1081. }
  1082.         // get all purchase record and display list
  1083. $data['data'] = $this->purchase_model->getPurchaseCompletion($filter);
  1084. $data['awal'] = date('Y-m-d');
  1085. $data['akhir'] = date('Y-m-d');
  1086. $data['is_filter'] = 0;
  1087.         // print_r(var_dump($this->db->last_query()));
  1088. $html = $this->load->view('jurnal_report/purchase_completion_pdf',$data, true);
  1089.  
  1090. $mpdf = new \Mpdf\Mpdf();
  1091. $mpdf->allow_charset_conversion = true;
  1092. $mpdf->charset_in = 'UTF-8';
  1093. $mpdf->WriteHTML($html);
  1094. $mpdf->Output('pdf', 'I');
  1095. }
  1096.  
  1097. public function sales_completion() {
  1098.     // get all sales to display list
  1099.     $filter = null;
  1100.     if(isset($_GET['filter'])) {
  1101.       if ($_GET['filter'] != null) {
  1102.         $filter = $_GET['filter'];
  1103.     }
  1104. }
  1105. $data['quotation'] = $this->quotation_model->getQuotation();
  1106. $data['data'] = $this->Sales_model->getSales($filter);
  1107. $data['url_pdf'] = base_url('jurnal_report/sales_completion_pdf');
  1108.      // print_r(var_dump($this->db->last_query()));
  1109. $this->load->view('jurnal_report/sales_completion', $data);
  1110. }
  1111.  
  1112. public function sales_completion_pdf() {
  1113.  
  1114.     ob_start();
  1115.     $html = ob_get_clean();
  1116.     $html = utf8_encode($html);
  1117.  
  1118.     // get all sales to display list
  1119.     $filter = null;
  1120.     if(isset($_GET['filter'])) {
  1121.       if ($_GET['filter'] != null) {
  1122.         $filter = $_GET['filter'];
  1123.     }
  1124. }
  1125. $data['quotation'] = $this->quotation_model->getQuotation();
  1126. $data['data'] = $this->Sales_model->getSales($filter);
  1127.      // print_r(var_dump($this->db->last_query()));
  1128. $html = $this->load->view('jurnal_report/sales_completion_pdf',$data, true);
  1129.  
  1130. $mpdf = new \Mpdf\Mpdf();
  1131. $mpdf->allow_charset_conversion = true;
  1132. $mpdf->charset_in = 'UTF-8';
  1133. $mpdf->WriteHTML($html);
  1134. $mpdf->Output('pdf', 'I');
  1135. }
  1136.  
  1137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement