How to make HALF PRICE REPORTS without Database PHP

Hi im a trainee in my work as a front end web dev for POS Company.
I am a facing a problem on how i Display the half price reports in reciept, without a database. idk why they dont have database on it, but that is the task that i need to do. can anyone give me an idea? thankyou.

`

 public function half_price_rep($asJson=false){
            $print_str = $this->print_header();
            $user = $this->session->userdata('user');
            $time = $this->site_model->get_db_now();
            $post = $this->set_post();
            $curr = $this->search_current();

           

            $trans = $this->trans_sales($post['args'],$curr);
            $sales = $trans['sales'];
            // $breakdown = $this->payment_breakdown_sales($sales['settled']['ids'],$curr);

            $ids = $sales['settled']['ids'];

            
            
            $this->cashier_model->db = $this->load->database('default', TRUE);
            // $payments = $this->cashier_model->get_all_trans_sales_payments(null,array("trans_sales_payments.sales_id"=>$ids,"trans_sales_payments.pos_id"=>TERMINAL_ID));
            $breakdown = $this->cashier_model->get_all_trans_sales_payments(null,array("trans_sales_payments.sales_id"=>$ids));
            

            $title_name = "Half Price Reports";
            $print_str .= align_center($title_name,PAPER_WIDTH," ")."\r\n";
            $print_str .= align_center("TERMINAL ".$post['terminal'],PAPER_WIDTH," ")."\r\n";
            $print_str .= "Item Code"."\r\n" ;
            $print_str .= "Item Name"."\r\n" ;
            $print_str .= "Item Price"."\r\n" ;
           
  
        
            $print_str .= append_chars('Printed On','right',11," ").append_chars(": ".date2SqlDateTime($time),'right',19," ")."\r\n";
            $print_str .= append_chars('Printed BY','right',11," ").append_chars(": ".$user['full_name'],'right',19," ")."\r\n";
            $print_str .= PAPER_LINE."\r\n";
            $print_str .= align_center(sql2DateTime($post['from'])." - ".sql2DateTime($post['to']),38," ")."\r\n";
            if($post['employee'] != "All")
                $print_str .= align_center($post['employee'],38," ")."\r\n";
            $print_str .= PAPER_LINE."\r\n";
            // $print_str .= "\r\n";
            $all_total = 0;
            $all_ctr = 0;
            }`

all i need is to fetch in recipt all the half price that happen on that day. and it arrange on
item_code-------item_name--------qty---------price.

I try to divide all the item that 20% but it cant. the only option i need is to call a help :(.
thankyou

  • You said they don’t have database…. then please explain this line: $this->cashier_model->db = $this->load->database('default', TRUE);

    – 




  • 1

    Ok – so you don’t have a database, but the data has to come from somewhere, and we’re not in your head, or the head of the people who tasked you with this. You’ll need to go back to your colleagues and ask them.

    – 

  • Hello sir Ken lee. that code is to call a all item data, not a specific data base for half price. its a referrence for me. im very sorry. Hello sir tangentially Perpendicular, Im to nervous to ask a senior dev because i think that they are too busy and i think that they dont have time to teach me on this. so the only way is to ask a random programmer on this platform, to give me a suggestion on my case. im very sorry.

    – 

  • All of that doesn’t change the fact that we currently have way too little information here, to be able to help you. And if you are a trainee, then the company should train you.

    – 

Leave a Comment