text:
<?php
defined('BASEPATH') or exit ('No direct script access allowed');

// po.php Chris Dart Mar 6, 2015 7:12:38 PM chrisdart@cerebratorium.com
class PO extends MY_Controller
{

    function __construct()
    {
        parent::__construct();
        $this->load->model("po_model", "po");
        $this->load->model("item_model", "item");
    }

    function index()
    {
        $this->search();
    }

    function search()
    {
        $this->load->model("vendor_model", "vendor");
        $vendors = $this->vendor->get_all("vendor");
        $data ["vendors"] = get_keyed_pairs($vendors, array(
            "id",
            "name"
        ), TRUE);
        $methods = $this->po->get_distinct("method");
        $data ["methods"] = get_keyed_pairs($methods, array(
            "method",
            "method"
        ));
        $payment_types = $this->po->get_distinct("payment_type");
        $data ["payment_types"] = get_keyed_pairs($payment_types, array(
            "payment_type",
            "payment_type"
        ));
        $categories = $this->po->get_distinct("category");
        $data ["categories"] = get_keyed_pairs($categories, array(
            "category",
            "category"
        ));
        $users = $this->ion_auth->users()->result();
        $data ["users"] = get_keyed_pairs($users, array(
            "id",
            "first_name"
        ), TRUE);
        $data ["target"] = "po/search";
        $data ["title"] = "Search Purchase Orders";
        $data ["po"] = FALSE;
        $variables = array(
            "vendor_id",
            "po",
            "method",
            "po_date",
            "payment_type",
            "category",
            "orderer_id",
            "billing_contact",
            "description",
            "sku",
            "quote",
            "has_attachment",
        );

        $where = NULL;
        foreach ($variables as $variable) {
            if ($my_variable = $this->input->get($variable)) {
                $where [$variable] = $my_variable;
                bake_cookie($variable, $my_variable);
            } else {
                burn_cookie($variable, $my_variable);
            }
        }
        $date_range = array();
        if ($start_date = $this->input->get("start_date")) {
            $date_range ["start_date"] = $start_date;
        }
        if ($end_date = $this->input->get("end_date")) {
            $date_range ["end_date"] = $end_date;
        }
        $data ["refine"] = FALSE;
        $pos = array();
        if ($this->input->get("is_search")) { // active search has been submitted

            $pos = $this->po->search($where, $date_range);
            $this->load->model("item_model", "item");
            foreach ($pos as $po) {
                $po->items = $this->item->get_for_po($po->id);
            }
            $data ["refine"] = TRUE;
        }
        $data ['pos'] = NULL;
        if (count($pos) > 0) {
            $data ['pos'] = $pos;
        }

        if ($this->input->get("ajax") == 1) {
            $this->load->view("page/modal", $data);
        } else {
            $this->load->view("page/index", $data);
        }
    }

    function view($po)
    {
        $order = $this->po->get_by_po($po);
        if ($order) {
            $this->load->model("vendor_model", "vendor");
            $this->load->model("file_model", "file");
            $order->items = $this->item->get_for_po($order->id);
            $order->vendor = $this->vendor->get($order->vendor_id);
            $order->files = $this->file->get_for_entity('po', $order->id);
            $data ["order"] = $order;
            if ($this->input->get("print") == 1) {
                $data ["target"] = "po/print";
            } else {
                $data ["target"] = "po/view";
            }
            $this->load->model("asset_model", "asset");
            $data ["assets"] = $this->asset->get_by_po($po);
            $data ["title"] = "FSMN PO# e-$po";
            $this->load->view("page/index", $data);
        } else {
            show_error("No such page");
        }
    }

    function create($vendor_id = FALSE)
    {
        $this->load->model("vendor_model", "vendor");
        $vendors = $this->vendor->get_all("vendor");
        $data ["vendors"] = get_keyed_pairs($vendors, array(
            "id",
            "name"
        ));
        $methods = $this->po->get_distinct("method");
        $data ["methods"] = get_keyed_pairs($methods, array(
            "method",
            "method"
        ));
        $payment_types = $this->po->get_distinct("payment_type");
        $data ["payment_types"] = get_keyed_pairs($payment_types, array(
            "payment_type",
            "payment_type"
        ));
        $categories = $this->po->get_distinct("category");
        $data ["categories"] = get_keyed_pairs($categories, array(
            "category",
            "category"
        ));
        $data ["target"] = "po/edit";
        $data ["action"] = "insert";
        $data ["title"] = "Create a Purchase Order";
        $data ["po"] = $this->po->get_next();
        $data ["vendor_id"] = $vendor_id;

        if ($this->input->get("ajax") == 1) {
            $this->load->view("page/modal", $data);
        } else {
            $this->load->view("page/index", $data);
        }
    }

    function insert()
    {
        $id = $this->po->insert();
        $po = $this->po->get($id)->po;

        redirect("po/view/$po");
    }

    function edit($id)
    {
        $this->load->model("vendor_model", "vendor");
        $vendors = $this->vendor->get_all("vendor");
        $data ["vendors"] = get_keyed_pairs($vendors, array(
            "id",
            "name"
        ));
        $methods = $this->po->get_distinct("method");
        $data ["methods"] = get_keyed_pairs($methods, array(
            "method",
            "method"
        ));
        $payment_types = $this->po->get_distinct("payment_type");
        $data ["payment_types"] = get_keyed_pairs($payment_types, array(
            "payment_type",
            "payment_type"
        ));
        $categories = $this->po->get_distinct("category");
        $data ["categories"] = get_keyed_pairs($categories, array(
            "category",
            "category"
        ));
        $order = $this->po->get($id);
        $data ["po"] = $order;

        $data ["target"] = "po/edit";
        $data ["title"] = sprintf("Editing PO #%s", $order->po);
        $data ["action"] = "update";
        $data ["vendor_id"] = NULL;
        if ($this->input->get("ajax") == 1) {
            $this->load->view("page/modal", $data);
        } else {
            $this->load->view("page/index", $data);
        }
    }

    function update()
    {
        $id = $this->input->post("id");
        $this->po->update($id);
        $po = $this->po->get($this->input->post("id"))->po;
        redirect("po/view/$po");
    }

    function update_value()
    {
        $id = $this->input->post("id");
        $value = $this->input->post("value");
        if (is_array($value)) {
            $value = implode(",", $value);
        }
        $values = array(
            $this->input->post("field") => $value
        );
        $this->po->update($id, $values);
        $title = "";
        echo json_encode(array(
            "value" => $value,
            "title" => $title
        ));
    }

    function request_approval($id = FALSE)
    {
        $this->load->model("user_model", "user");
        $approvers = $this->user->get_group_members(4);
        // approvers cannot approve their own POs.
        foreach ($approvers as $key => $approver) {
            if ($approver->id == $this->ion_auth->get_user_id()) {
                unset ($approvers [$key]);
            }
        }
        if ($id) {
            $data ["target"] = "po/approval";
            $data ["title"] = "Request Approval";
            $data ["id"] = $id;
            $data ['approvers'] = get_keyed_pairs($approvers, array(
                "id",
                "user"
            ));
            if ($this->input->get("ajax")) {
                $this->load->view("page/modal", $data);
            } else {
                $this->load->view("page/index", $data);
            }
        } elseif ($id = $this->input->post("id")) {
            $this->load->model("vendor_model", "vendor");
            $approver_id = $this->input->post("approver_id");
            $this->po->update($id, array(
                "approver_id" => $approver_id
            ));
            $po = $this->po->get($id);
            $note = $this->input->post("note");
            $po->vendor = $this->vendor->get($po->vendor_id);
            $this->_notify("approval_request", $po, $note);
            $this->session->set_flashdata("warning", sprintf("The approval request has been sent to %s at %s", $po->approver, $po->approver_email));
            redirect("po/view/$po->po");
        }
    }

    function grant_approval($id)
    {
        $po = $this->po->get($id);
        // user must be an approver and they must be the requested approver on this PO.
        if ($this->ion_auth->get_user_id() == $po->approver_id && $this->ion_auth->in_group(4)) {
            $this->po->update($id, array(
                "approved" => 1
            ));
            $this->_notify("approval_granted", $po);
            $this->_notify("business_office", $po);
            $this->session->set_flashdata("warning", "This PO has been approved and the requester and business office have both been notified");
        } else {
            $this->session->set_flashdata("warning", "You are not authorized to approve this purchase order.");
        }
        redirect("po/view/$po->po");
    }

    function modify()
    {
        if ($id = $this->input->post('id')) {
            $po = $this->po->get($id);
            $values = array(
                'approved' => '',
                'approver_id' => '',
            );
            $this->po->update($id, $values);
            echo base_url('po/view/' . $po->po);
        }

    }

    function complete(){
        if($id = $this->input->post('id')){
            $po = $this->po->get($id);
            $values = array('complete'=>1);
            $this->po->update($id, $values);
            echo base_url('po/view/' . $po->po);
        }else{
            $this->session->set_flashdata('warning','No ID was provided to update a purchase order record');
            redirect('po');
        }
    }

    function po_exists($po)
    {
        if ($this->po->get_by_po($po)) {
            $output = TRUE;
        } else {
            $output = FALSE;
        }
        echo $output;
    }

    function _notify($target, $po, $note = NULL)
    {
        switch ($target) {
            case "business_office" :
                $this->email->to("bookkeeper@fsmn.org,businessoffice@fsmn.org");
                $this->email->from($po->user_email);
                $subject = sprintf("Purchase Order %s Has Been Approved", $po->po);
                break;
            case "approval_request" :
                $subject = sprintf("IMPORTANT: Purchase Order %s Needs Your Approval", $po->po);
                $this->email->from($po->user_email);
                if (base_url() == "https://inventory/") {
                    $this->email->to("chrisd@fsmn.org");
                } else {
                    $this->email->to($po->approver_email);
                }
                $this->email->cc($po->user_email);

                break;
            case "approval_granted" :
                $subject = sprintf("Purchase Order %s Approval Has Been Granted.", $po->po);
                $this->email->from($po->approver_email);
                $this->email->to($po->user_email);
                $this->email->cc($po->approver_email);
                break;
        }
        $message = $this->load->view("po/email/$target", array(
            "po" => $po, "note" => $note,
        ), TRUE);
        //$this->email->set_header ( "Disposition-Notification-To", $po->user_email );
        $this->email->subject($subject);
        $this->email->message($message);
        $this->email->send();
    }

    function delete()
    {
        if ($id = $this->input->post("id")) {

            $po = $this->po->get($id);
            $this->po->delete($id);
            $data ["target"] = "po/delete";
            $data ["title"] = "PO $po->po Deleted";
            $data ["po"] = $po;
            $this->load->view("page/modal", $data);
        }
    }
}


text:
GDFR (feat. Sage the Gemini & Lookas)
GDFR (feat. Sage The Gemini and Lookas)
GDFR (feat. Sage The Gemini and Lookas )
Turn Around Part 2
Only One Flo [Part 1]
R.O.O.T.S.
Snack (feat. E-40 & Sage The Gemini)
Pop Dance Hits
Pop Dance Party
R&B Superclub Throwback Party
Urban Beatmakerz
About Flo Rida
This MC from (where else?) Florida makes dance-laced, club-friendly hip-hop-pop, with an emphasis on smash singles like 2007's "Low," 2009's Dead Or Alive-sampling "Right Round" and 2011's pop-doused "Good Feeling." Rachel Devitt
Gorilla Zoe, Hurricane Chris, Jason Derulo, Juan Magan, LMFAO, Will.i.am
This MC from (where else?) Florida makes dance-laced, club-friendly hip-hop-pop, with an emphasis on smash singles like 2007's "Low," 2009's Dead Or Alive-sampling "Right Round" and 2011's pop-doused "Good Feeling."
Rachel Devitt
Hitmakers
Southern Rap/Hip-Hop
In My Mind Part 3 (feat. Georgi Kay)
Ibiza Sunset Chillout
100 Greatest 10s: The Best Songs of Last Decade
Mar De Colores (Versión Extendida)

redpajama_set_name: RedPajamaCommonCrawl


A study in Denmark has found that a mom's diet of more fish during the pregnancy (so long as it's not tuna sashimi and other sushi) and breastfeeding a baby longer are linked to better physical and cognitive development in infants.
"The children whose mothers ate the most fish during pregnancy were more likely to have better motor and cognitive skills. For example, among mothers who ate the least fish, 5.7% of their children had the lowest developmental scores at 18 months, compared with only 3.7% of children whose mothers had the highest fish intake. Compared with women who ate the least fish, women with the highest fish intake (about 60 grams - 2 ounces - per day on average) had children 25% more likely to have higher developmental scores at 6 months and almost 30% more likely to have higher scores at 18 months. "
Now, isn't it lucky that fish is super abundant here in the Philippines? Sure, gone are the days when they're cheaper than other meats (because they no longer are, even the lowly galunggong already costs over P100/kilo... except maybe in the provinces where they are caught) but it's still really great that we've been blessed with such an abundance of fresh water and salt water fish. They even throw away giant tuna caught in Calapan because there isn't means available to trade them in Manila in place just yet.
So Moms... eat fish! I know fish is one of the more common aversions during pregnancy but that usually lasts for up to the first trmester only. Plus, you can make do with fresh water fish like milkfish and tilapia. Or you can be creative in cooking up your fish.
nd as always, breastfeed, breastfeed, breastfeed!


Our black steel splashbacks are constructed from top quality surface coated steel. This creates a scratch resistant, heatproof, solid black, semi-gloss finish.
Large selection of standard sizes & upstands available.
Edges folded neatly around MRMDF core to provide a solid look bit with the benefit of easy installation.
Please note, these splashbacks can be cut using a standard tile cutter / jigsaw. Bespoke sizes are available, please contact us for a quote.