Exemplo n.º 1
0
 /**
  * Show the form for dispatching the resource to the bench.
  *
  * @return Response
  */
 public function dispatch($id)
 {
     $topupRequest = TopupRequest::find($id);
     $batches = Receipt::where('commodity_id', '=', $topupRequest->commodity_id)->lists('batch_no', 'id');
     $users = User::where('id', '!=', Auth::user()->id)->lists('name', 'id');
     return View::make('issue.create')->with('topupRequest', $topupRequest)->with('users', $users)->with('batches', $batches);
 }
Exemplo n.º 2
0
 public function popoverReceiptPreview($receipt_id)
 {
     $r = Receipt::where('id', $receipt_id)->first();
     $data['transaction'] = Receipt::buildReceipt($receipt_id);
     $data['created_date'] = ng_date_format($r->created_at);
     $data['created_time'] = ng_time_format($r->created_at);
     $data['sales_person'] = istr::title(User::where('id', $r->user_id)->first()->name);
     $data['total_amount_due'] = format_money($r->receipt_worth);
     $data['total_amount_tendered'] = format_money($r->amount_tendered);
     $data['change'] = format_money($r->change);
     $s = Salelog::where('receipt_id', $receipt_id)->get()->toArray();
     //$s = Salelog::where('receipt_id', $receipt_id)->get();
     $data['items'] = $s;
     //tt($data['items']->discount);
     //$data['items']->unitprice = $data['items']->unitprice - (($data['items']->unitprice / 100) * (($data['items']->discount > 0) ? $data['items']->discount : 1 ));
     //tt($data['items']);
     return View::make('admin.quick_receipt_preview', $data);
 }
 public function getReport()
 {
     $input = Input::all();
     $v = Validator::make(Input::All(), array('property_name' => 'required', 'from_date' => 'required', 'to_date' => 'required', 'type' => 'required', 'houseIDReport' => 'required', 'agent_id' => 'required'));
     if ($v->passes()) {
         $propertyid = Input::get('property_name');
         $from_date = Input::get('from_date');
         $to_date = Input::get('to_date');
         $type = Input::get('type');
         $houseID = Input::get('houseIDReport');
         $start_day = date("Y-m-d H:i:s", strtotime($from_date));
         $end_day = date("Y-m-d H:i:s", strtotime($to_date));
         $agent_id = Input::get('agent_id');
         $billedusr = User::find($agent_id);
         $hisBalance = $billedusr->credit_balance;
         $newBalance = $hisBalance - 3;
         $billedusr->credit_balance = $newBalance;
         $billedusr->save();
         $billstatement = new Statement();
         $billstatement->type = "Report Generation";
         $billstatement->amount = 3;
         $billstatement->save();
         if ($houseID === "All Report") {
             $sumReceipts = Receipt::whereBetween('created_at', array($start_day, $end_day))->where('propertyid', $propertyid)->sum('amountpaid');
             $sumInvoiceBalance = Invoice::whereBetween('created_at', array($start_day, $end_day))->where('propertyid', $propertyid)->sum('balance');
             $sumInvoicePaid = Invoice::whereBetween('created_at', array($start_day, $end_day))->where('propertyid', $propertyid)->sum('amountpaid');
             $sumRefundPaid = Invoice::where('propertyid', $propertyid)->where('type', '=', 'refund')->sum('amountpaid');
             $invoiceUn = Invoice::list('houseID');
             $unitsUnpaid = House::whereIn('name', $invoiceUn)->count();
             $sumInvoice = $sumInvoiceBalance + $sumInvoicePaid;
             $noteSum = array('error' => false, 'type' => "All", 'sumRefund' => $sumRefundPaid, 'unitsUnpaid' => $unitsUnpaid, 'sumInvoice' => $sumInvoice, 'sumReceipt' => $sumReceipts);
         } else {
             $sumReceipts = Receipt::where('houseID', $houseID)->whereBetween('created_at', array($start_day, $end_day))->sum('amountpaid');
             $sumInvoiceBalance = Invoice::where('houseID', $houseID)->whereBetween('created_at', array($start_day, $end_day))->sum('balance');
             $sumInvoicePaid = Invoice::where('houseID', $houseID)->whereBetween('created_at', array($start_day, $end_day))->sum('amountpaid');
             $sumInvoice = $sumInvoiceBalance + $sumInvoicePaid;
             $noteSum = array('error' => false, 'type' => "House", 'sumInvoice' => $sumInvoice, 'sumReceipt' => $sumReceipts);
         }
         return $noteSum;
     }
     $notePE = array('error' => true, 'message' => 'Ensure that all the fields are set');
     return $notePE;
 }
Exemplo n.º 4
0
 Route::get('redirect/back', array('as' => 'redirect/back'), function () {
     return Redirect::back();
 });
 Route::get('payments-totenant', array('as' => 'payments-totenant', 'uses' => 'BillController@selectToPay'));
 Route::get('api/preports', array('as' => 'api/preports', 'uses' => 'PaymentController@Reports'));
 Route::post('api/spreport', array('as' => 'api/spreport', 'uses' => 'PaymentController@getFilteredReport'));
 Route::get('api/dropdown', array('as' => 'api/dropdown', function () {
     $properties = Property::lists('name');
     return $properties;
 }));
 Route::get('ninvoice', array('as' => 'ninvoice', function () {
     $invoices = Invoice::where('agent_id', '=', Sentry::getUser()->id)->where('balance', '>', 0)->with('invoicedetail')->orderBy('id', 'desc')->get();
     return $invoices;
 }));
 Route::get('nreceipts', array('as' => 'nreceipts', function () {
     $invoices = Receipt::where('agent_id', '=', Sentry::getUser()->id)->where('amountpaid', '>', 0)->orderBy('id', 'desc')->get();
     return $invoices;
 }));
 Route::get('nrefunds', array('as' => 'nrefunds', function () {
     $invoices = Invoice::where('agent_id', '=', Sentry::getUser()->id)->where('type', '=', 'refund')->with('invoicedetail')->orderBy('id', 'desc')->get();
     return $invoices;
 }));
 Route::get('api/property/{id}', array('as' => 'api/property', 'uses' => 'HousController@getHouses'));
 Route::get('api/receipts/{id}', array('as' => 'api/receipts', 'uses' => 'HousController@getRHouses'));
 Route::get('api/refunds/{id}', array('as' => 'api/refunds', 'uses' => 'HousController@getRfunds'));
 //select tenant to pay
 Route::get('tenant-selected/{id}', array('as' => 'tenant-selected', 'uses' => 'BillController@tenantSelected'));
 Route::get('refund-selected/{id}', array('as' => 'refund-selected', 'uses' => 'BillController@refundSelected'));
 Route::post('refund-tenant', array('as' => 'refund-tenant', 'uses' => 'BillController@refundStore'));
 //select unit
 Route::get('unit/{id}', array('as' => 'create-house', 'uses' => 'HousController@create'));