public function run() { $listPublisher = PublisherBaseModel::where('status', 3)->lists('id'); $faker = Faker\Factory::create(); for ($i = 0; $i < 1000; $i++) { $create = $faker->dateTimeThisMonth(); DB::table('publisher_site')->insert(array('name' => $faker->domainWord, 'publisher_id' => $faker->randomElement($listPublisher), 'created_at' => $create, 'updated_at' => $create)); } }
public function getPublisher() { if (Session::get('reviewPid')) { return PublisherBaseModel::find(Session::get('reviewPid')); } else { if ($this->user) { return $this->user->publisher; } else { return FALSE; } } }
/** * function name: paymentRequest * @return mixed */ public function paymentRequest($page = 1) { $pubInfo = Sentry::getUser(); $uid = $pubInfo->id; $paymentReq = new PaymentRequestBaseModel(); $publisher = new PublisherBaseModel(); $item = $publisher->getItem($uid); if (!$item) { return Redirect::to($this->moduleURL . 'show-list'); } $this->data['routeExport'] = "ToolsPublisher"; $options = array(); if (Request::ajax()) { $dataPaging['items'] = $paymentReq->getItems($item->id, ITEM_PER_PAGE, $page)->lists('id', 'amount', 'created_at'); return Response::json($dataPaging); } else { $dataPaging['items'] = $paymentReq->getItems($item->id, ITEM_PER_PAGE, $page); $this->data['listItems'] = View::make('advertiser_manager.publisher_advertiser_manager.paymentRequestPaging', $dataPaging); } $this->layout->content = View::make('advertiser_manager.publisher_advertiser_manager.showPaymentRequest', $this->data); }
public function getPdf() { $datemonth = Input::get('datemonth'); if ($datemonth) { if ($datemonth != null) { $datemonth >= 1 && $datemonth <= 9 ? $month = '0' . $datemonth : ($month = $datemonth); $flight = new FlightWebsiteBaseModel(); $start_date = date('Y', time()) . '-' . $month . '-01'; $end_date = date('Y', time()) . '-' . $month . '-' . date('t', strtotime($start_date)); $idpublisher = $this->getPublisher()->id; // get Campagin da chay $camend = $flight->join('campaign', 'campaign.id', '=', 'flight.campaign_id')->join('flight', 'flight.id', '=', 'flight_website.flight_id')->where('campaign.start_date', '>=', $start_date)->where('campaign.end_date', '<=', $end_date)->where('flight_website.website_id', '=', $idpublisher)->select(array('campaign.name as campaignname', 'campaign.start_date', 'campaign.end_date', 'campaign.sale_order_tax', 'flight_website.*'))->get(); $camend = $this->sumEarnings($camend, $start_date, $end_date); pr($camend, 1); //$camend = $this->sumEarnings($camend, $start_date, $end_date); //// get Campagin dang chay $camrun = $flight->join('campaign', 'campaign.id', '=', 'flight.campaign_id')->join('flight', 'flight.id', '=', 'flight_website.flight_id')->where('campaign.start_date', '<', $end_date)->where('campaign.end_date', '>', date("Y-m-d", time()))->where('flight_website.website_id', '=', $idpublisher)->select(array('campaign.name as campaignname', 'campaign.start_date', 'campaign.end_date', 'campaign.sale_order_tax', 'flight_website.*'))->get(); if (count($camrun) == 0 && count($camend) == 0) { $_SESSION['error'] = "No data"; return Redirect::to($this->moduleURL . 'get-invoice'); } $camrun = $this->sumEarnings($camrun, $start_date, $end_date); $publisher = PublisherBaseModel::find($idpublisher); $param['datemonth'] = $datemonth; $param['camend'] = $camend; $param['mont'] = $start_date; $param['camrun'] = $camrun; $param['publisher'] = $publisher; $param['pinetech'] = ConfigBaseModel::find(1); if ($param['pinetech'] == null) { $pinetech = new stdClass(); $pinetech->name = "N/A"; $pinetech->address = "N/A"; $pinetech->state = "N/A"; $pinetech->city = "N/A"; $pinetech->country = "N/A"; $param['pinetech'] = $pinetech; } $pdf = PDF::loadView('getInvoicePdf', $param)->setPaper('a4')->setWarnings(false); $file = "Invoice_" . $publisher->id . "_" . $publisher->company . "_" . date('M_Y', strtotime($start_date)) . '.pdf'; return $pdf->download($file); } else { return Redirect::to($this->moduleURL . 'get-invoice'); } } else { return Redirect::to($this->moduleURL . 'get-invoice'); } }
public function exportExcelPaymentDetail($id) { $model = new PaymentRequestDetailBaseModel(); $data['data'] = $model->getItemsByPaymentRequestId($id); if (count($data['data']) > 0) { $data['publisher'] = $data['data']['0']->publisher; if ($data['publisher']) { $pid = $data['publisher']->id; $data['pubName'] = PublisherBaseModel::getPublisherName($pid); } else { $data['pubName'] = ''; } return $model->exportExcel($data); } else { return Redirect::to($this->moduleURL . 'payment-request/waiting'); } }
public function getListPublisher($keyword, $id) { $model = new PublisherBaseModel(); if ($id > 0) { $this->data['listPublisher'] = $model->where('id', $id)->where('status', 3)->get(); } else { $this->data['listPublisher'] = $model->searchByCapital($keyword); } return View::make('listPublisher', $this->data)->render(); }