/* Decoded by unphp.net */ user->is_admin()) { redirect("user/login"); } } public function index() { $zona_waktu = 3600 * $this->system->set["zona_waktu"]; $date = Date("d-m-Y"); $param["produk"] = 0; $param["pembelian"] = 0; $param["penjualan"] = 0; $param["margin"] = 0; $addsql = ''; $addsql .= " where a.tr_tanggal >= '" . (strtotime($date . " 00:00:00") - $zona_waktu) . "' and a.tr_tanggal <= '" . (strtotime($date . " 23:59:59") - $zona_waktu) . "' "; $param["produk"] = $this->get_data("select distinct b.op_produk from transaksi a join voucher b on a.vo_id = b.vo_id\xa group by b.op_produk")->num_rows(); $param["pembelian"] = $this->get_data("select sum(a.tr_harga2-a.tr_income) as pembelian from transaksi a \xa join voucher b on a.vo_id = b.vo_id and\xa a.tr_status_pembayaran = 'sukses' and a.tr_status = 'sukses' \xa {$addsql}")->row()->pembelian; $param["penjualan"] = $this->get_data("select sum(a.tr_harga2) as penjualan \xa from transaksi a join voucher b on a.vo_id = b.vo_id and a.tr_status_pembayaran = 'sukses' and a.tr_status = 'sukses' {$addsql}")->row()->penjualan; $param["margin"] = $this->get_data("select sum(a.tr_income) as margin from transaksi a join voucher b on a.vo_id = b.vo_id and \xa a.tr_status_pembayaran = 'sukses' and a.tr_status = 'sukses' \xa {$addsql}")->row()->margin; $this->load->view("admin/rekap_baru/index", $param); } public function detail_produk() { $type = "view"; $addsql = ''; $from_date = ''; $to_date = ''; if ($this->input->get("from_date") && $this->input->get("to_date")) { $zona_waktu = 3600 * $this->system->set["zona_waktu"]; $from_date = $this->input->get("from_date"); $to_date = $this->input->get("to_date"); $addsql .= " and a.tr_tanggal >= '" . (strtotime($from_date . " 00:00:00") - $zona_waktu) . "' "; $addsql .= " and a.tr_tanggal <= '" . (strtotime($to_date . " 23:59:59") - $zona_waktu) . "' "; } if ($this->input->get("type") == "json") { $type = "json"; } $param["from_date"] = $from_date; $param["to_date"] = $to_date; $param["datas"] = $this->get_data("select \xa b.op_produk,\xa sum(a.tr_harga2 - a.tr_income) as pembelian, sum(a.tr_harga2) as penjualan,\xa sum(a.tr_income) as margin\xa from transaksi a join voucher b on a.vo_id = b.vo_id where a.tr_status_pembayaran = 'sukses' and a.tr_status = 'sukses' \xa {$addsql} group by b.op_produk\xa order by b.op_produk")->result(); if ($type == "view") { $this->load->view("admin/rekap_baru/detail_produk", $param); } if ($type == "json") { foreach ($param["datas"] as $row) { $alt = $row->op_produk; $row->op_produk = @$this->system->produk->{$alt}->nama; } print_r(json_encode($param["datas"])); } } public function detail_voucher($op_produk) { $type = "view"; $addsql = ''; $from_date = ''; $to_date = ''; if ($this->input->get("from_date") && $this->input->get("to_date")) { $zona_waktu = 3600 * $this->system->set["zona_waktu"]; $from_date = $this->input->get("from_date"); $to_date = $this->input->get("to_date"); $addsql .= " and a.tr_tanggal >= '" . (strtotime($from_date . " 00:00:00") - $zona_waktu) . "' "; $addsql .= " and a.tr_tanggal <= '" . (strtotime($to_date . " 23:59:59") - $zona_waktu) . "' "; } if ($this->input->get("type") == "json") { $type = "json"; } $param["op_produk"] = $op_produk; $param["from_date"] = $from_date; $param["to_date"] = $to_date; $param["datas"] = $this->get_data("select \xa b.op_produk, c.op_nama,\xa sum(a.tr_harga2 - a.tr_income) as pembelian, sum(a.tr_harga2) as penjualan,\xa sum(a.tr_income) as margin \xa from transaksi a \xa join voucher b on a.vo_id = b.vo_id join operator c on a.op_id = c.op_id\xa where a.tr_status_pembayaran = 'sukses' and a.tr_status = 'sukses' and b.op_produk = '" . $op_produk . "' {$addsql}\xa group by b.op_produk,c.op_nama order by b.op_produk,c.op_nama ?>