public function getChangeStatus($status, $id) { $branch = Branch::find($id); if ($branch['status'] == $status) { $branch->status = $status == 'Activate' ? 'Deactivate' : 'Activate'; $branch->save(); } return new JsonResponse(array('id' => $branch['id'], 'status' => $branch['status'])); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit(Request $request) { $branch = Branch::find($request['branchId']); $branch->name = $request['branchName']; $branch->location = $request['branchLocation']; $branch->delivery_charge = $request['delivery_charge']; if ($branch->save()) { $returnData = array('status' => 'ok', 'message' => 'Branch edited', 'branch' => $branch, 'code' => 200); return Response::json($returnData, 200); } else { $returnData = array('status' => 'fail', 'message' => 'Branch not edited', 'code' => 500); return Response::json($returnData, 200); } }
<td>{{$fromAccount->name}}</td> <td>{{$toBranch->name}}</td> <td>{{$toAccount->name}}</td> <td style="text-align: right;">{{$result->amount}}</td> <td>{{$result->remarks}}</td> <td>{{$user->name}}</td> </tr> <?php $total = $total + $result->amount; ?> @endforeach @foreach($results2 as $result ) <?php $user = \App\User::find($result->user_id); $fromBranch = \App\Branch::find($result->fromBranch); $toBranch = \App\Branch::find($result->toBranch); $fromAccount = \App\NameOfAccount::find($result->fromAccount); $toAccount = \App\NameOfAccount::find($result->toAccount); ?> <tr class="odd gradeX"> <td>{{$result->date}}</td> <td>{{$fromBranch->name}}</td> <td>{{$fromAccount->name}}</td> <td>{{$toBranch->name}}</td> <td>{{$toAccount->name}}</td> <td style="text-align: right;">{{$result->amount}}</td> <td>{{$result->remarks}}</td> <td>{{$user->name}}</td> </tr> <?php
<th width="">Product Type</th> <th width="">Product Name</th> <th width="">Price</th> <th width="">Quantity</th> <th width="">Remarks</th> <th width="">Action</th> </tr> </thead> @foreach($saleDetails as $saleDetail) <?php $branch = new \App\Branch(); $stocks = new \App\StockInfo(); $stockName = \App\StockInfo::find($saleDetail->stock_info_id); $branchName = \App\Branch::find($saleDetail->branch_id); ?> <tr> <td> {{ $stockName->name }}</td> <td> {{ $saleDetail->product_type }}</td> <td> {{ $saleDetail->product->name }}</td> <td> {{ $saleDetail->price }}</td> <td> {{ $saleDetail->quantity }}</td> <td> @if($saleDetail->remarks) {{ $saleDetail->remarks }} @else {{"Not Available"}} @endif </td> <td> <input type="button" style="width:63px;" value="delete" class="btn red deleteSaleDetail" rel={{$saleDetail->id}} /></td>
private function saleDetailConvertToArray($salesDetails) { $array = array(); $stockName = StockInfo::find($salesDetails->stock_info_id); $branchName = Branch::find($salesDetails->branch_id); $array['id'] = $salesDetails->id; $array['branch_id'] = $branchName->name; $array['stock_info_id'] = $stockName->name; $array['product_type'] = $salesDetails->product_type; $array['product_id'] = $salesDetails->product->name; $array['price'] = $salesDetails->price; $array['quantity'] = $salesDetails->quantity; $array['remarks'] = $salesDetails->remarks; return $array; }
<th>Quantity</th> <th>Amount</th> <th>Remarks</th> <th>Action</th> </tr> </thead> <tbody> <?php $total = 0; ?> @foreach($purchaseInvoiceDetails as $purchaseInvoiceDetail ) <?php $stocks = new \App\StockInfo(); $branch = new \App\Branch(); $stockName = \App\StockInfo::find($purchaseInvoiceDetail->stock_info_id); $branchName = \App\Branch::find($purchaseInvoiceDetail->branch_id); $categoryName = \App\Category::find($purchaseInvoiceDetail->product->category_id); $subCategoryName = \App\SubCategory::find($purchaseInvoiceDetail->product->sub_category_id); ?> <tr class="odd gradeX"> <td>{{$branchName->name}}</td> <td>{{$stockName->name}}</td> <td>{{$purchaseInvoiceDetail->product_type}}</td> <td>{{$purchaseInvoiceDetail->product->name.'('.$categoryName->name.')'.'('.$subCategoryName->name.')'}}</td> <td>{{$purchaseInvoiceDetail->price}}</td> <td>{{$purchaseInvoiceDetail->quantity}}</td> <td>{{$purchaseInvoiceDetail->quantity * $purchaseInvoiceDetail->price}}</td> <td> @if($purchaseInvoiceDetail->remarks) {{ $purchaseInvoiceDetail->remarks }} @else
<!-- BEGIN PAGE TITLE & BREADCRUMB--> <h3 class="page-title"> Stock Search Result </h3> </div> </div> <div class="row"> <div class="col-md-12"> <!-- BEGIN EXAMPLE TABLE PORTLET--> <div class="portlet box light-grey"> <div class="portlet-title"> <?php $branch = \App\Branch::find($branch); ?> <div class="caption"><i class="fa fa-reorder"></i> Stock Search Result for {{$branch->name}}</div> <div class="actions"> <a class="btn blue" href="/entry">Back</a> </div> </div> <div class="portlet-body"> @if($results) <table class="table table-striped table-bordered table-hover" id="stock_search_result_table"> <thead style="background-color:royalblue"> <tr> <th>Product Name</th>
<?php use App\Institution; use App\UserLevel; use App\Worker; use App\Branch; $worker = Worker::find(Auth::user()->TypeId); $branch = Branch::find($worker->BranchId); $regimen = json_decode($branch->DefaultExpenses)->regimen; $permissions = json_decode(UserLevel::find(Auth::user()->UserLevel)->Permissions); ?> <script> var maxDiscount = {{ $permissions->permissions->sales->discount->limit }}; var regimen = "{{ $regimen }}"; </script> <script src="{{ URL::to('/') }}/js/ventas.js"></script> @include('mortuary.forms.payTab') @include('mortuary.forms.createClientInstitutionForm') @include('mortuary.forms.serviceForm') @include('mortuary.forms.cremationForm') @include('mortuary.forms.reservationForm') @include('mortuary.forms.contractForm') <div class="main hideable hide" id="ventas"> <div class="main-inner"> <div class="container"> <div class="row"> <div class="span6"> <div class="row-fluid form-horizontal"> <div class="control-group span12"> <label class="control-label" for="salesClient">Cliente:</label> <div class="controls">
private function purchaseInvoiceDetailConvertToArray($purchaseInvoiceDetails) { $array = array(); $stockName = StockInfo::find($purchaseInvoiceDetails->stock_info_id); $branchName = Branch::find($purchaseInvoiceDetails->branch_id); $array['id'] = $purchaseInvoiceDetails->id; $array['branch_id'] = $branchName->name; $array['stock_info_id'] = $stockName->name; $array['product_type'] = $purchaseInvoiceDetails->product_type; $categoryName = \App\Category::find($purchaseInvoiceDetails->product->category_id); $subCategoryName = \App\SubCategory::find($purchaseInvoiceDetails->product->sub_category_id); $array['product_id'] = $purchaseInvoiceDetails->product->name . '(' . $categoryName->name . ')' . '(' . $subCategoryName->name . ')'; $array['price'] = $purchaseInvoiceDetails->price; $array['quantity'] = $purchaseInvoiceDetails->quantity; $array['remarks'] = $purchaseInvoiceDetails->remarks; return $array; }
<tr> <th width="">Branch Name</th> <th width="">Party Name</th> <th width="">Product Name</th> <th width="">Quantity</th> <th width="">Remarks</th> <th width="">Action</th> </tr> </thead> <tbody> </tbody> @if($stockRequisition) <?php $branchName = \App\Branch::find($stockRequisition->branch_id); ?> <tr> <td>{{$branchName->name}}</td> <td>{{$stockRequisition->party->name}}</td> <td>{{$stockRequisition->product->name}}</td> <td>{{$stockRequisition->requisition_quantity}}</td> <td>{{$stockRequisition->remarks}}</td> <td><input type="button" id="deleteRequisition" style="width:70px;" value="delete" class="btn red deleteRequisition" rel="{{ $stockRequisition->id }}" ></td> </tr> @endif <tr class="clone_"> <td> <div class="form-group">
<?php use App\AIOrder; use App\AIOrderBreakdown; use App\Provider; use App\Branch; use App\Stock; // Get the provider and branch. $provider = Provider::find($order['ProviderId']); $branch = Branch::find($order['BranchId']); function getName($code, $branchId) { // Get product. $product = Stock::where('Code', '=', $code)->where('BranchId', '=', $branchId)->first(); return $product->Description; } ?> <p>{{ $provider->Name }},</p> <p>Les enviamos el siguiente correo para realizar una orden a su empresa para los siguientes productos:</p> <table width="600" align="center" style="border:1px solid black;"> <thead> <tr><th>Descripcion</th><th>Cantidad</th></tr> </thead> <tbody> @foreach($breakdown as $product) <tr><td style="text-align:center;">{{ getName($product['Code'], $branch->Id) }}</td><td style="text-align:center;">{{ $product['Quantity'] }}</td></tr> @endforeach </tbody> </table> <p>Por favor enviar los productos a {{ $branch->Name }} ubicados en {{ $branch->Address }}. Recuerde responder a este correo con la palabra: Recibido. Esto es para permitirnos saber de que han recibido la orden exitosamente.</p> <p>Se despide cordialmente,</p>
/** * Function that saves default expenses. * * @return Response */ public function saveDefaultExpenses() { // Validate Input. $validator = Validator::make(Input::all(), array('electricity' => 'required', 'water' => 'required', 'phone' => 'required', 'rent' => 'required', 'government' => 'required', 'depreciation' => 'required', 'taxes' => 'required', 'security' => 'required', 'regimen' => 'required')); if ($validator->fails()) { return response()->json(['error' => 'Informacion incompleta!']); } // Check that user is part of authorized staff. if (Auth::user()->Type != 1) { // If they are unauthorized no point in returning anything. return response()->json(array()); } // Get user branch. $branch = Branch::find(Worker::find(Auth::user()->TypeId)->BranchId); // Get expenses. $expenses = array('electricity' => Input::get('electricity'), 'water' => Input::get('water'), 'phone' => Input::get('phone'), 'rent' => Input::get('rent'), 'government' => Input::get('government'), 'depreciation' => Input::get('depreciation'), 'taxes' => Input::get('taxes'), 'security' => Input::get('security'), 'regimen' => Input::get('regimen')); $branch->DefaultExpenses = json_encode($expenses); $branch->save(); $response['state'] = 'Success'; $response['message'] = 'Gastos guardados exitosamente!'; return response()->json($response); }
<th>Cheque Date</th> <th>Amount</th> <th>Received By</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($register as $reg ) <?php $sale = \App\Sale::where('invoice_id', '=', $reg->invoice_id)->first(); $partyname = \App\Party::find($sale->party_id); $brnachName = \App\Branch::find($reg->branch_id); ?> <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$partyname->name}}</td> <td>{{$reg->cheque_bank}}</td> <td>{{$brnachName->name}}</td> <td>{{$reg->cheque_no}}</td> <td>{{$reg->cheque_date}}</td> <td>{{$reg->amount}}</td> <td>{{$reg->user->username}}</td> @if($reg->cheque_status == 1) <td class="party-status"><span class="label label-sm label-success">Completed</span></td>
<th>Branch Name</th> <th>Name</th> <th>Category</th> <th>Balance</th> <th>Created By</th> <th >Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($accountNames as $accountName) <?php $accounts = \App\AccountCategory::find($accountName->account_category_id); $branch = \App\Branch::find($accountName->branch_id); ?> <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$branch->name}}</td> <td>{{$accountName->name}}</td> <td>{{$accounts->name}}</td> <td>{{$accountName->opening_balance}}</td> <td>{{$accountName->user->username}}</td> <td> <a class="btn blue btn-sm editAccountName" data-toggle="modal" data-target="#ajax2" href="{{URL::to('accountnames/edit',$accountName->id )}}" > <i class="fa fa-edit"></i> Edit Account Name</a> <a class="btn red btn-sm" href="{{ URL::to('accountnames/delete',$accountName->id)}}"
<a href="{{URL::to('dashboard')}}">Home</a> <i class="fa fa-angle-right"></i> </li> <li><a href="#" >Profile</a></li> <div class="actions" style="float: right;margin-top: -7px;"> <a class="btn blue" href="{{ URL::to('edit/'. $profile->id) }}">Update Profile</a> </div> </ul> <!-- END PAGE TITLE & BREADCRUMB--> </div> </div> <div class="col-md-16"> <?php $branch = \App\Branch::find($profile->branch_id); ?> <b>Name: </b>{{$profile->name}}<br><br> <b>Email:</b>{{$profile->email}}<br><br> <b>UserName: </b>{{$profile->username}}<br><br> <b>Branch: </b>{{$branch->name}}<br><br> <b>Phone: </b>{{$profile->phone}}<br><br> <b>Role: </b> @if($profile->role == 'admin') Admin @elseif($profile->role == 'manager') Stock InCharge @else Office Manager @endif <br><br> <b>Address: </b>{{$profile->address}}
/** * Function that makes a reservation. * * @return Response */ public function makeReservation() { // Validate Input. $validator = Validator::make(Input::all(), array('items' => 'required', 'institution' => 'required', 'discount' => 'required', 'reservationAmount' => 'required')); if ($validator->fails()) { return response()->json(['error' => 'No se envio la informacion completa!']); } // Check that user is part of authorized staff. if (Auth::user()->Type != 1) { // If they are unauthorized no point in returning anything. return response()->json(['state' => 'Unauthorized']); } // Get user branch. $worker = Worker::find(Auth::user()->TypeId); $userBranch = $worker->BranchId; $reservationPrice = 0; $branch = Branch::find($userBranch); // Get the user's cashbox. $cashbox = Cashbox::where('UserId', '=', Auth::user()->Id)->where('Close', '=', NULL)->first(); // Check that we actually have a cashbox open. if (!$cashbox) { $response['state'] = 'Error'; $response['error'] = 'La caja no esta abierta o por lo tanto no se puede realizar la reservacion!'; return response()->json($response); } // Check discount is not greater than what user is allowed. $permissions = json_decode(UserLevel::find(Auth::user()->UserLevel)->Permissions); if (Input::get('discount') > $permissions->permissions->sales->discount->limit) { // Check if we have an auth code we can use. if (Input::get('authCode') == 0) { $response['state'] = 'Error'; $response['error'] = 'No tiene permiso para otorgar este descuento!'; return response()->json($response); } $request = Request::find(Input::get('authCode')); if ($request->Used == 1) { $response['state'] = 'Error'; $response['error'] = 'No tiene permiso para otorgar este descuento!'; return response()->json($response); } if ($request->Amount != Input::get('discount')) { $response['state'] = 'Error'; $response['error'] = 'No tiene permiso para otorgar este descuento!'; return response()->json($response); } $request->Used = 1; $request->save(); } // Get client. $client = Client::where('Cedula', '=', Input::get('client'))->first(); // Get institution if defined. $institution; if (Input::get('institution') != 0) { $institution = Institution::find(Input::get('institution')); if (!$institution) { $response['state'] = 'Error'; $response['error'] = 'La institucion definida no fue encontrada en el sistema!'; return response()->json($response); } } // Loop through products and services and get prices. $items = json_decode(Input::get('items')); foreach ($items as $code => $info) { // Check if it is a product. $product = Stock::where('Code', '=', $code)->where('BranchId', '=', $userBranch)->first(); if (!$product) { // Check if it is a service. $service = Service::where('Code', '=', $code)->where('BranchId', '=', $userBranch)->first(); if (!$service) { $response['state'] = 'Error'; $response['error'] = 'No se reconocio uno de los productos o servicios!'; return response()->json($response); } // Add price to total of quotation. $reservationPrice += $service->Price * $info->quantity; } else { // Add price to total of quotation. $reservationPrice += $product->Price * $info->quantity; } } $subTotal = $reservationPrice; $discount = $reservationPrice * (Input::get('discount') / 100); // Give discount. $reservationPrice = $reservationPrice * (1 - Input::get('discount') / 100); // Calculate tax if required. $tax = 0; if (json_decode($branch->DefaultExpenses)->regimen == 'cuotageneral') { if (Input::get('institution') != 0) { if (!$institution->Excempt) { $tax = $salePrice * 0.15; } } else { if (!$client || !$client->Excempt) { $tax = $salePrice * 0.15; } } } // Save client information. $clientInfo = array(); if (Input::get('institution') != 0) { // Save institution information. $clientInfo = array('Name' => $institution->Name, 'Address' => $institution->Address, 'Id' => $institution->RUC); } else { // Save institution information. if ($client) { $clientInfo = array('Name' => $client->Name, 'Address' => $client->Address, 'Id' => $client->Cedula); } } // Get reservation info. $config = Configuration::find(0); // Check that the deposit covers the minimum. if (Input::get('reservationAmount') < $config->Dollar * $config->MinimumReservation) { $response['state'] = 'Error'; $response['error'] = 'El deposito minimo para realizar la reservacion es de ' . $config->Dollar * $config->MinimumReservation . ' Cordobas o ' . $config->MinimumReservation . ' Dolares Americanos.'; return response()->json($response); } // Make Reservation. $reservation; if (Input::get('institution') != 0) { // Creditor Type 1 = Client, 2 = Institution. $reservation = Reservation::create(array('WorkerId' => $worker->Id, 'Value' => $reservationPrice, 'Discount' => Input::get('discount'), 'Tax' => $tax, 'CreditorId' => Input::get('institution'), 'CreditorType' => 2, 'TransactionId' => 0, 'State' => 'fresh', 'Life' => $config->ReservationLife, 'Deposit' => Input::get('reservationAmount'))); } else { if (!$client) { $reservation = Reservation::create(array('WorkerId' => $worker->Id, 'Value' => $reservationPrice, 'Discount' => Input::get('discount'), 'Tax' => $tax, 'CreditorId' => 0, 'CreditorType' => 1, 'TransactionId' => 0, 'State' => 'fresh', 'Life' => $config->ReservationLife, 'Deposit' => Input::get('reservationAmount'))); } else { $reservation = Reservation::create(array('WorkerId' => $worker->Id, 'Value' => $reservationPrice, 'Discount' => Input::get('discount'), 'Tax' => $tax, 'CreditorId' => $client->Id, 'CreditorType' => 1, 'TransactionId' => 0, 'State' => 'fresh', 'Life' => $config->ReservationLife, 'Deposit' => Input::get('reservationAmount'))); } } // Now that the reservation has been created, create the transaction for it. $transaction = CashboxTransaction::create(array('CashboxId' => $cashbox->Id, 'DateTime' => date('Y-m-d H:i:s'), 'Type' => 9, 'Amount' => Input::get('reservationAmount'), 'Reason' => 'Deposito de Reservacion: ' . $reservation->Id . '.')); $reservation->TransactionId = $transaction->Id; $reservation->save(); // Loop through items and add them to Reservation Breakdown. foreach ($items as $code => $info) { // Check if product. $product = Stock::where('Code', '=', $code)->where('BranchId', '=', $userBranch)->first(); if (!$product) { // Get service cost. $service = Service::where('Code', '=', $code)->where('BranchId', '=', $userBranch)->first(); ReservationBreakdown::create(array('ReservationId' => $reservation->Id, 'Code' => $code, 'Quantity' => $info->quantity, 'Price' => $service->Price)); } else { ReservationBreakdown::create(array('ReservationId' => $reservation->Id, 'Code' => $code, 'Quantity' => $info->quantity, 'Price' => $product->Price)); } } // Return success message and return quotation information. $response['state'] = 'Success'; $response['reservationInfo'] = array('SubTotal' => $subTotal, 'Discount' => $discount, 'Tax' => $tax, 'Total' => $reservationPrice + $tax, 'ReservationId' => $reservation->Id, 'Date' => date('d/m/Y'), 'Life' => $config->ReservationLife, 'Deposit' => Input::get('reservationAmount')); $response['clientInfo'] = $clientInfo; return response()->json($response); }
private function stockDetailConvertToArray($stockDetails) { $array = array(); $stockName = StockInfo::find($stockDetails->stock_info_id); $tostockName = StockInfo::find($stockDetails->to_stock_info_id); //var_dump($stockDetails->to_stock_info_id); die(); $branchName = Branch::find($stockDetails->branch_id); $array['id'] = $stockDetails->id; $array['branch_id'] = $branchName->name; $array['stock_info_id'] = $stockName->name; $array['product_type'] = $stockDetails->product_type; $productsName = Product::find($stockDetails->product_id); $category = $productsName->category->name; $subCategoryName = ''; if ($productsName->sub_category_id) { $subCategory = SubCategory::find($productsName->sub_category_id); $subCategoryName = '(' . $subCategory->name . ')'; } $array['product_id'] = $stockDetails->product->name . ' (' . $category . ') ' . $subCategoryName; if ($tostockName != null) { $array['to_stock_info_id'] = $tostockName->name; } $array['entry_type'] = $stockDetails->entry_type; $array['product_quantity'] = $stockDetails->quantity; $array['remarks'] = $stockDetails->remarks; $array['consignment_name'] = $stockDetails->consignment_name; return $array; }
public function addMarketOrder(Request $request) { $metaData = MetaData::where('meta_key', 'server_status')->first(); if ($metaData['meta_value'] == 0) { $errorData = array('status' => 'fail', 'message' => 'Sorry! Server is closed. Please try later.', 'code' => '422'); return Response::json($errorData, 200); } try { $productType = Product::find($request['productTypeId']); if ($productType->type == 0 && $productType->lot_size * $request['lot'] < 25000) { $returnData = array('status' => 'fail', 'message' => 'Sorry! Invalid requist. Please try retail symbol.', 'code' => '422'); return Response::json($returnData, 200); } if ($productType->type == 1 && $productType->lot_size * $request['lot'] >= 25000) { $returnData = array('status' => 'fail', 'message' => 'Sorry! Invalid requist. Please try wholesale symbol.', 'code' => '422'); return Response::json($returnData, 200); } $stock = Stock::where('productTypeId', $request['productTypeId'])->where('branchId', $request['branchId'])->first(); $branch = Branch::find($request['branchId']); $stock->quantity = AddProduct::where('stockId', $stock->id)->where('added', 1)->sum('quantity') - AddProduct::where('stockId', $stock->id)->where('added', 0)->sum('quantity'); if ($stock->quantity < $productType->lot_size * $request['lot']) { $returnData = array('status' => 'fail', 'message' => 'Sorry! Insufficient stock. Please try low quantity.', 'code' => '422'); return Response::json($returnData, 200); } else { $login = Login::where('remember_token', '=', $request->header('token'))->where('status', '=', '1')->where('login_from', '=', $request->ip())->first(); $clientStock = new ClientStock(); $clientStock->type = 1; $clientStock->price = 4800; $clientStock->memberId = $login->member_id; $clientStock->stockId = $stock->id; $clientStock->amount = $productType->lot_size * $request['lot']; $clientStock->status = 0; $clientStock->commission = $productType->commision * $request['lot']; $clientStock->margin = $productType->margin * $request['lot']; $clientStock->delivery_charge = $productType->lot_size * $request['lot'] / 10 * $branch->delivery_charge; $clientStock->cost = $clientStock->amount / 10 * $clientStock->price; $clientStock->remaining_cost = $clientStock->cost - $clientStock->margin; $date = strtotime("+7 day"); $clientStock->delivery_date = date('Y-m-d', $date); $clientStock->ticket = $this->ticket_generate(); $clientStock->save(); $account = new Account(); $account->memberId = $login->member_id; $account->addedBy = $login->member_id; $account->type = 0; $account->amount = $clientStock->margin + $clientStock->commission; $account->ticket = $clientStock->ticket; $account->save(); $returnData = array('status' => 'ok', 'code' => '200', 'clientStock' => $clientStock, 'account' => $account); return Response::json($returnData, 200); } } catch (\Exception $e) { return $e->getMessage(); } }
<?php use App\Sale; use App\Client; use App\Institution; use App\CashReceipt; use App\Transport; use App\Branch; // Get the sale. $creditDue = Sale::find($sale['Id']); // Get the branch. $branch = Branch::find($creditDue->BranchId); // Get the creditor. $creditor = null; if ($sale->CreditorType == 1) { $creditor = Client::find($sale->CreditorId); } else { $creditor = Institution::find($sale->CreditorId); } // Get the transport request. $paymentCollection = Transport::find($transport['Id']); $payments = CashReceipt::where('Type', '=', 2)->where('TypeId', '=', $sale->Id)->get(); $totalDue = $creditDue->Value + $creditDue->Tax; foreach ($payments as $payment) { $totalDue -= $payment->Value; } ?> <p>{{ $creditor->Name }},</p> <p>Les enviamos el siguiente correo para dejarles saber que el {{ $transport->Date }} estaremos llegando a recoger el pago de la factura numero {{ $sale->Id }}. El total pendiente es de C$ {{ $totalDue }}.</p> <p>Si por algun motivo no podra pagar ese dia puede reprogramar nuestra visita respondiendo a este correo de la siguiente manera:</p> <p>Reprogramar:{{ date('Y-m-d', strtotime("+5 days")) }}</p>
<th>Account Category</th> <th>Account Name</th> <th>Payment Method</th> <th>Cheque No</th> <th>Amount</th> <th>Remarks</th> <th>Action</th> </tr> </thead> <tbody> <?php $totalTransaction = 0; ?> @foreach($expenseTransactions as $expenseTransaction ) <?php $branch = \App\Branch::find($expenseTransaction->branch_id); ?> <tr class="odd gradeX"> <td>{{\App\Transaction::convertDate($expenseTransaction->created_at)}}</td> <td>{{$branch->name}}</td> <td>{{$expenseTransaction->accountCategory->name}}</td> <td>{{$expenseTransaction->accountName->name}}</td> <td>{{$expenseTransaction->payment_method}}</td> <td>{{$expenseTransaction->cheque_no}}</td> <td>{{$expenseTransaction->amount}}</td> <td> @if($expenseTransaction->remarks) {{ $expenseTransaction->remarks }} @else {{"Not Available"}} @endif
<th>Particular</th> <th>Purpose</th> <th>Amount</th> <th>Remarks</th> <th>Status</th> <th>Created</th> <th>Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($expenseAll as $expense ) <?php $branch = \App\Branch::find($expense->branch_id); $transaction = \App\Transaction::where('invoice_id', '=', $expense->invoice_id)->first(); ?> <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$branch->name}}</td> <td>{{$expense->invoice_id}}</td> <td>{{$expense->category}}</td> @if($expense->particular) <td>{{$expense->particular}}</td> @else <td>{{"Not Available"}}</td> @endif
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // $validator = \Validator::make($request->all(), ['name' => 'required', 'city' => 'required']); if ($validator->fails()) { return response()->json(array('status' => 500, 'monolog' => array('title' => 'errors', 'message' => implode($validator->errors()->all(), '<br>')))); } $branch = Branch::find($id); $branch->name = $request->name; // find province, country $city = \App\City::where('city_name', $request->city)->first(); $branch->city = $request->city; $branch->province = $city->province->province_name; $branch->country = $city->province->country->nicename; $branch->manager = $request->manager; $branch->save(); return response()->json(array('status' => 200, 'monolog' => array('title' => 'success', 'message' => 'object has been updated'))); }
<th class="numeric">Req Qty</th> <th class="numeric">Issued</th> <th class="numeric">Remaining</th> <th>Remarks</th> <th>Created By</th> <!-- <th>Status</th>--> <th>Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($requisitions as $requisition ) <?php $branchName = \App\Branch::find($requisition->branch_id); $subCategory = \App\SubCategory::find($requisition->product->sub_category_id); $subCategoryName = '(' . $subCategory->name . ')'; ?> <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$branchName->name}}</td> <td>{{$requisition->product->name."(".$requisition->product->category->name.")".$subCategoryName}}</td> <td>{{$requisition->party->name}}</td> <td>{{$requisition->requisition_id}}</td> <td class="numeric">{{$requisition->requisition_quantity}}</td> <td class="numeric">{{$requisition->issued_quantity}}</td> <td class="numeric">{{$requisition->requisition_quantity-$requisition->issued_quantity}}</td>
<tr> <th>Branch</th> <th>Product</th> <th>Req Qty</th> <th>Issued</th> <th>Remaining</th> <th>Date</th> <th>Remarks</th> <th>Created By</th> </tr> </thead> <tbody> @foreach($results as $result ) <?php $branchName = \App\Branch::find($result->branchId); $categoryName = \App\Category::find($result->cId); $subCategoryName = \App\SubCategory::find($result->sId); ?> <tr class="odd gradeX"> <td>{{$branchName->name}}</td> <td>{{$result->pName.'('.$categoryName->name.')'.'('.$subCategoryName->name.')'}}</td> <td style="text-align: right;">{{$result->requisition_quantity}}</td> <td style="text-align: right;">{{$result->issued_quantity}}</td> <td style="text-align: right;">{{$result->requisition_quantity-$result->issued_quantity}}</td> <td>{{$result->created_at}}</td> <td>{{$result->remarks}}</td> <td>{{$result->uName}}</td> </tr> @endforeach </tbody>
<?php use App\Branch; use App\Worker; use App\UserLevel; use App\Configuration; // Get current branch. $branch = Branch::find(Worker::find(Auth::user()->TypeId)->BranchId); $levels = UserLevel::all(); $config = Configuration::find(0); ?> <script src="{{ URL::to('/') }}/js/admin/configuration.js"></script> <div class="hideable hide" id="configuracion"> <div class="subnavbar"> <div class="subnavbar-inner"> <div class="container"> <ul class="mainnav eirene-subnav"> <li class="active"><a href="#configuracion-expenses"><i class="icon-money"></i><span>Gastos Fijos</span></a></li> <li><a href="#configuracion-permissions"><i class="icon-key"></i><span>Permisos para Usuarios</span> </a></li> <li><a href="#configuracion-general"><i class="icon-list-alt"></i><span>Configuracion General</span> </a></li> </ul> </div> <!-- /container --> </div> <!-- /subnavbar-inner --> </div> <div class="container"> <div class="row v-offset-2"> </div> <div class="main sub-hideable" id="configuracion-expenses"> <div class="main-inner">
private function requisitionInfoConvertToArray($requisitions) { $array = array(); $branchName = Branch::find($requisitions->branch_id); $array['id'] = $requisitions->id; $array['branch'] = $branchName->name; $array['product'] = $requisitions->product->name; $array['party'] = $requisitions->party->name; $array['quantity'] = $requisitions->requisition_quantity; $array['remarks'] = $requisitions->remarks; return $array; }
@section('content') <div class="row"> <div class="col-md-12"> <!-- BEGIN PAGE TITLE & BREADCRUMB--> <h3 class="page-title"> Sales Due Report </h3> </div> </div> <div class="row"> <div class="col-md-12"> <?php $branches = \App\Branch::find($branch_id); ?> <!-- BEGIN EXAMPLE TABLE PORTLET--> <div class="portlet box light-grey"> <div class="portlet-title"> <div class="caption"><i class="fa fa-reorder"></i>Sales Due Report of Products for {{$branches->name}}</div> <div class="actions"> <a class="btn btn-sm blue hidden-print" onclick="javascript:window.print();">Print <i class="fa fa-print"></i></a> </div> </div> <div class="portlet-body"> <table class="table table-striped table-bordered table-hover" id="stock_products_report_table">
<script> function closeModal() { /*$('#sale').modal('hide'); $('body').removeClass('modal-open'); $('.modal-backdrop').hide();*/ $("#sale").modal('hide').on('hidden.bs.modal', functionThatEndsUpDestroyingTheDOM); $('.modal-backdrop').hide(); } </script> <div class="modal-dialog shape"> <div class="modal-content"> <div class="modal-header"> <button type="button" onclick="closeModal()" class="close" data-dismiss="modal" aria-hidden="true"></button> <?php $branch = new \App\Branch(); $branchName = \App\Branch::find($stock->branch_id); ?> <h3>Stock Detail for {{$branchName->name}}</h3> <?php $stockdetails = \App\StockDetail::where('invoice_id', '=', $stock->invoice_id)->first(); $stockName = \App\StockInfo::find($stockdetails->stock_info_id); ?> <h4>Branch Name : <?php echo $branchName->name; ?> </h4> <h4>Stock Name : <?php echo $stockName->name; ?> </h4>
<th>UserName</th> <th>Role</th> <th>Gender</th> <th>Branch</th> <th>Address</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($users as $user ) <?php $branchName = \App\Branch::find($user->branch_id); ?> <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$user->name}}</td> <td>{{$user->email}}</td> <td>{{$user->username}}</td> <td>{{$user->role}}</td> @if($user->sex == "m") <td>Male</td> @else <td>Female</td> @endif
/** * Function that gets contract payments table. * * @return Response */ public function contractInfo() { // Validate Input. $validator = Validator::make(Input::all(), array('id' => 'required')); if ($validator->fails()) { return response()->json(['error' => 'No se recibieron los datos necesarios!']); } // Check that user is part of authorized staff. if (Auth::user()->Type != 1) { $response['state'] = 'No Autorizado'; $response['error'] = 'Usuario no autorizado!'; return response()->json($response); } // Get user branch. $worker = Worker::find(Auth::user()->TypeId); $userBranch = $worker->BranchId; // Get the contract. $contract = Contract::find(Input::get('id')); // Get the breakdown of the contract. $contractBreakdown = ContractBreakdown::where('ContractId', '=', $contract->Id)->get(); $contractServices = array(); foreach ($contractBreakdown as $breakdown) { // Try getting the product. $product = Stock::where('Code', '=', $breakdown->Code)->where('BranchId', '=', $userBranch)->first(); if (!$product) { // If it's not a product it's a service. $service = Service::where('Code', '=', $breakdown->Code)->where('BranchId', '=', $userBranch)->first(); array_push($contractServices, array('quantity' => $breakdown->Quantity, 'note' => $service->Note)); } else { array_push($contractServices, array('quantity' => $breakdown->Quantity, 'note' => $product->Description)); } } // Get the branch. $branch = Branch::find($userBranch); // Get the client's information. $client = Client::find($contract->ClientId); // Get the configuration information. $config = Configuration::find(0); // Now prepare all the information to be returned to user. $response['state'] = 'Success'; $response['name'] = $client->Name; $response['ocupation'] = $client->Ocupation; $response['address'] = $client->Address; $response['cedula'] = $client->Cedula; $response['debt'] = $contract->Debt; $response['span'] = floor($contract->Debt / $contract->Quota); $response['quota'] = $contract->Quota; $response['interval'] = $contract->QuotaInterval; $response['paymentDates'] = explode(',', $contract->PaymentDates); $response['startDate'] = $contract->StartDate; $response['createDate'] = date('Y-m-d', strtotime($contract->Created)); $response['interest'] = $contract->Interest; $response['branchAddress'] = $branch->Address; $response['cityCoverage'] = $config->CityCoverage; $response['contractServices'] = $contractServices; // Return response. return response()->json($response); }