Esempio n. 1
0
 /**
  * Display a listing of payments
  *
  * @return Response
  */
 public function index()
 {
     $payments = Payment::all();
     $erporders = Erporder::all();
     $erporderitems = Erporderitem::all();
     return View::make('payments.index', compact('payments', 'erporderitems', 'erporders'));
 }
Esempio n. 2
0
 public function payments()
 {
     $payments = Payment::all();
     $erporders = Erporder::all();
     $erporderitems = Erporderitem::all();
     $organization = Organization::find(1);
     $pdf = PDF::loadView('erpreports.paymentsReport', compact('payments', 'erporders', 'erporderitems', 'organization'))->setPaper('a4')->setOrientation('potrait');
     return $pdf->stream('Payment List.pdf');
 }
Esempio n. 3
0
 public function filters($offset = 0)
 {
     $this->load->helpers('date');
     $string = '%' . $this->input->post('estudiante') . '%';
     $usuario = $this->input->post('user_id');
     $fecha_desde = $this->input->post('fecha_desde');
     $fecha_hasta = $this->input->post('fecha_hasta');
     $condiciones = 'anulado = ?';
     $valores[] = 0;
     if ($string != '%%') {
         $condiciones .= " AND CONCAT(students.apellido,' ', students.nombre) LIKE ?";
         $valores[] = $string;
     }
     if ($usuario > 0) {
         /*if($condiciones != ''){
         		$condiciones .= " AND ";
         		}*/
         $condiciones .= " AND user_id = ?";
         $valores[] = $usuario;
     }
     if ($fecha_desde != '') {
         $fecha_desde = mdate('%Y-%m-%d', normal_to_unix($fecha_desde));
         if ($fecha_hasta != '') {
             $fecha_hasta = mdate('%Y-%m-%d', normal_to_unix($fecha_hasta));
         } else {
             $fecha_hasta = date('Y-m-d');
         }
         /*if($condiciones != ''){
         		$condiciones .= " AND ";
         		}*/
         $condiciones .= " AND fecha BETWEEN ? AND ?";
         $valores[] = $fecha_desde;
         $valores[] = $fecha_hasta;
     }
     $conditions = array_merge(array($condiciones), $valores);
     $config['base_url'] = site_url('pagos/index');
     $config['total_rows'] = Payment::count(array('joins' => array('student'), 'conditions' => $conditions));
     $config['per_page'] = '10';
     $config['num_links'] = '10';
     $config['first_link'] = '← primero';
     $config['last_link'] = 'último →';
     $this->load->library('pagination', $config);
     $pagos = array();
     $pagos = Payment::all(array('joins' => array('student'), 'conditions' => $conditions, 'limit' => $config['per_page'], 'offset' => $offset));
     $this->table->set_heading('Fecha', 'Nro Comprobante', 'Estudiante', 'Importe', 'Usuario', 'Acciones');
     foreach ($pagos as $pago) {
         $this->table->add_row($pago->fecha->format('d/m/Y'), $pago->nro_comprobante, $pago->student->apellido . ' ' . $pago->student->nombre, $pago->importe, $pago->user->apellido . ' ' . $pago->user->nombre, anchor('pagos/ver/' . $pago->id, img('static/img/icon/doc_lines.png'), 'class="tipwe" title="Ver detalles pago"') . ' ' . anchor('pagos/editar/' . $pago->id, img('static/img/icon/pencil.png'), 'class="tipwe" title="Editar pago"') . ' ' . anchor('pagos/eliminar/' . $pago->id, img('static/img/icon/trash.png'), 'class="tipwe eliminar" title="Eliminar pago"'));
     }
     echo $this->table->generate();
     echo '<div class="pagination">';
     echo $this->pagination->create_links();
     echo '</div>';
 }
Esempio n. 4
0
 /**
  * Display a listing of payments
  *
  * @return Response
  */
 public function index()
 {
     /*
     		$payments = DB::table('payments')
     ->join('erporders', 'payments.erporder_id', '=', 'erporders.id')
     ->join('erporderitems', 'payments.erporder_id', '=', 'erporderitems.erporder_id')
     ->join('clients', 'erporders.client_id', '=', 'clients.id')
     ->join('items', 'erporderitems.item_id', '=', 'items.id')
     ->select('clients.name as client','items.name as item','payments.amount_paid as amount','payments.date as date','payments.erporder_id as erporder_id','payments.id as id','erporders.order_number as order_number')
     ->get();
     */
     $erporders = Erporder::all();
     $erporderitems = Erporderitem::all();
     $paymentmethods = Paymentmethod::all();
     $payments = Payment::all();
     return View::make('payments.index', compact('payments', 'erporderitems', 'erporders', 'paymentmethods'));
 }
 public function getPaymentsList()
 {
     $data = Input::all();
     //        dd($data);
     if (Input::get('search')) {
         $validator = Validator::make($data, array('from_date' => 'required|date', 'to_date' => 'required|date'));
         if ($validator->fails()) {
             return Redirect::back()->with($validator->errors());
         }
         $from = Input::get('from_date');
         $to = Input::get('to_date');
         $payments = Payment::where('payment_date_time', '>=', $from)->where('payment_date_time', '<=', $to)->get();
         //            dd($payments);
     } else {
         $payments = Payment::all();
     }
     return View::make('payments.index', compact('payments', 'from', 'to'));
 }
Esempio n. 6
0
 /**
  * @before _secure
  */
 public function affiliates()
 {
     $this->seo(array("title" => "Billing"));
     $view = $this->getActionView();
     $start = RM::get("start", date("Y-m-d", strtotime('-60 day')));
     $end = RM::get("end", date("Y-m-d", strtotime('now')));
     $query = ['utype' => 'publisher', 'org_id' => $this->org->_id];
     $payments = \Payment::all($query);
     $page = RM::get("page", 1);
     $limit = RM::get("limit", 10);
     $property = RM::get("property");
     $value = RM::get("value");
     if ($property) {
         $query["{$property} = ?"] = $value;
     } else {
         $query['created'] = Db::dateQuery($start, $end);
     }
     $invoices = \Invoice::all($query);
     $view->set('invoices', $invoices)->set('payments', $payments)->set('active', Invoice::count(['utype' => 'publisher', 'org_id' => $this->org->_id, "live = ?" => 1]))->set('inactive', Invoice::count(['utype' => 'publisher', 'org_id' => $this->org->_id, "live = ?" => 0]))->set('start', $start)->set('end', $end);
 }
Esempio n. 7
0
 /**
  * Display a listing of payments
  *
  * @return Response
  */
 public function index()
 {
     $payments = Payment::all();
     return View::make('payments.index', compact('payments'));
 }
Esempio n. 8
0
 /**
  * @before _secure
  */
 public function account()
 {
     $this->seo(array("title" => "Account"));
     $view = $this->getActionView();
     $invoices = \Invoice::all(['user_id = ?' => $this->user->_id], ['start', 'end', 'amount', 'live', 'created']);
     $payments = \Payment::all(['user_id = ?' => $this->user->_id], ['type', 'amount', 'meta', 'live', 'created']);
     $user = $this->user;
     $view->set("errors", []);
     if (RM::type() == 'POST') {
         $action = RM::post('action', '');
         switch ($action) {
             case 'account':
                 $fields = ['name', 'phone', 'currency', 'username'];
                 foreach ($fields as $f) {
                     $user->{$f} = RM::post($f);
                 }
                 $user->save();
                 $view->set('message', 'Account Info updated!!');
                 break;
             case 'password':
                 $old = RM::post('password');
                 $new = RM::post('npassword');
                 $view->set($user->updatePassword($old, $new));
                 break;
             case 'bank':
                 $user->getMeta()['bank'] = ['name' => RM::post('account_bank', ''), 'ifsc' => RM::post('account_code', ''), 'account_no' => RM::post('account_number', ''), 'account_owner' => RM::post('account_owner', '')];
                 $user->save();
                 $view->set('message', 'Bank Info Updated!!');
                 break;
             case 'payout':
                 $user->getMeta()['payout'] = ['paypal' => RM::post('paypal', ''), 'payquicker' => RM::post('payquicker', ''), 'payoneer' => RM::post('payoneer', ''), 'paytm' => RM::post('paytm', ''), 'mobicash' => RM::post('mobicash', ''), 'easypaisa' => RM::post('easypaisa', '')];
                 $user->save();
                 $view->set('message', 'Payout Info Updated!!');
                 break;
             case 'custom':
                 $output = Shared\Services\User::customFields($user, $this->org);
                 if (!$output['success']) {
                     return $view->set($output);
                 }
                 $user->save();
                 $view->set('user', $user);
                 $view->set('message', 'Custom field updated!!');
                 break;
             default:
                 $this->_postback('add');
                 break;
         }
         $this->setUser($user);
     }
     if (RM::type() === 'DELETE') {
         $this->_postback('delete');
     }
     $this->_postback('show');
     $afields = Meta::search('customField', $this->org);
     $view->set('afields', $afields)->set("invoices", $invoices)->set("payments", $payments);
 }