Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') or exit('No direct script access allowed');
- class Fachada_pedido extends CI_Controller {
- public function index() {
- $this->load->view('includes/Header');
- $this->load->view('Botones');
- $data = array (
- 'data_pedido' => $this->buscarPedidos($dni)
- );
- $this->load->view('Consultar_Pedidos', $data);
- $this->load->view('includes/Footer');
- }
- public function mostrar_pedidos() {
- $dni = $this->input->post('dni');
- $this->load->view('includes/Header');
- $this->load->view('Botones');
- if ($dni) {
- $data = array (
- 'data_pedido' => $this->buscarPedidos($dni)
- );
- } else {
- $data = array (
- 'data_pedido' => array()
- );
- }
- $this->load->view('Consultar_Pedidos', $data);
- $this->load->view('includes/Footer');
- }
- public function buscarPedidos($dni) {
- $p = new Pedido();
- $c = new Cliente();
- $c->where('dni', $dni)->get();
- $p->where_related($c)->get();
- return $p;
- }
- public function realizar_pedido() {
- $this->load->view('includes/Header');
- $this->load->view('realizar_pedido');
- $this->load->view('includes/Footer');
- }
- public function obtener_precio() {
- $pr = new Producto();
- $producto = $this->input->post('producto');
- $cantidad = $this->input->post('cantidad');
- $precio_unitario = $pr->where('nombre_producto', $producto)->get()->precio;
- $precio_iva = bcadd($precio_unitario, 0.21);
- $precio_total = bcmul($precio_iva, $cantidad);
- echo '<tr>';
- echo '<td width="25%" class="text-center">' . $producto . '</td>';
- echo '<td width="25%" class="text-center">' . $cantidad . '</td>';
- echo '<td width="25%" class="text-right">' . $precio_total . '</td>';
- echo '</tr>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement