Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_Report_Penjualan() {
- // VARIABEL
- $faktur=$this->input->get('nofaktur');
- $nota=$this->input->get('notaref');
- $unit=$this->input->get('unit');
- $customer=$this->input->get('customer');
- $status=$this->input->get('status');
- $operator=$this->input->get('operator');
- $typebayar=$this->input->get('typebayar');
- $fromdate=$this->input->get('fromdate');
- $todate=$this->input->get('todate');
- // QUERY REPORT
- $this->db->select('a.*,b.customer_name,c.location_name,d.operator_name');
- $this->db->from('TRANSACTION_HISTORY a');
- $this->db->join('CUSTOMER b','a.customer_id=b.customer_id');
- $this->db->join('LOCATION c','a.location_id=c.location_id');
- $this->db->join('OPERATOR d','a.operator_id=d.operator_id');
- //$this->db->or_where('transaction_type','Sell');
- if(!empty($fromdate) && !empty($todate)){
- $this->db->where("CONVERT(VARCHAR(10),transaction_date,120) >='$fromdate'
- AND CONVERT(VARCHAR(10),transaction_date,120) <='$todate'");
- }
- if(!empty($unit)){
- $this->db->where('a.location_id',$unit);
- }
- if(!empty($customer)){
- $this->db->where('a.customer_id',$customer);
- }
- if(!empty($status)) {
- $this->db->where('transaction_status',$status);
- }
- if(!empty($operator)) {
- $this->db->where('a.operator_id',$operator);
- }
- if(!empty($typebayar)) {
- $this->db->where('transaction_payment_type',$typebayar);
- }
- if(!empty($nota)) {
- $this->db->where('transaction_ref_note',$nota);
- }
- if(!empty($faktur)) {
- $this->db->where('transaction_number',$faktur);
- }
- $this->db->order_by('transaction_date','DESC');
- $query = $this->db->get();
- return $query->result();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement