本文整理汇总了PHP中Invoice::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::where方法的具体用法?PHP Invoice::where怎么用?PHP Invoice::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
* GET /accountreceivables/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
$invoices = Invoice::with('invoicedetail')->find($id);
if ($invoices->type === "to tenant") {
$total = $invoices->invoicedetail->rent + $invoices->invoicedetail->water + $invoices->invoicedetail->electricity + $invoices->invoicedetail->security + $invoices->invoicedetail->service + $invoices->invoicedetail->garbage;
} elseif ($invoices->type === "refund") {
$total = $invoices->invoicedetail->rentD + $invoices->invoicedetail->waterD + $invoices->invoicedetail->electricityD + $invoices->invoicedetail->g_repairs + $invoices->invoicedetail->transport_cost + $invoices->invoicedetail->o_bills + $invoices->invoicedetail->storage_fees + $invoices->invoicedetail->fixed_unit;
} elseif ($invoices->type === "deposits") {
$total = $invoices->invoicedetail->rentD + $invoices->invoicedetail->waterD + $invoices->invoicedetail->electricityD + $invoices->invoicedetail->g_repairs + $invoices->invoicedetail->transport_cost + $invoices->invoicedetail->o_bills + $invoices->invoicedetail->storage_fees + $invoices->invoicedetail->fixed_unit + $invoices->invoicedetail->rent;
}
$houseid = $invoices->id;
$hid = $invoices->houseID;
$housename = House::where('id', $hid)->pluck('name');
$propertyid = House::where('id', $hid)->pluck('propertyID');
$propertyname = Property::where('id', $propertyid)->pluck('name');
$allbal = Invoice::where('houseID', $hid)->sum('balance');
if ($invoices->amountpaid <= 0) {
$outstandingbal = $allbal;
} else {
$outstandingbal = $allbal - $invoices->balance;
}
$balance = $invoices->balance;
if ($outstandingbal == $invoices->balance) {
$amountdue = $invoices->balance;
} else {
$amountdue = $invoices->balance + $outstandingbal;
}
$title = "Print Invoice";
return View::make('backend.code.invoice.show', compact('invoices', 'housename', 'title', 'outstandingbal', 'propertyname', 'invoicedetails', 'total', 'balance', 'amountdue'));
}
示例2: index
/**
* Display a listing of the resource.
* GET /invoices
*
* @return Response
*/
public function index()
{
$user = Auth::user()->id;
// Grab all the user invoices
$invoices = $this->invoice->where('user_id', $user)->get();
$tax_rates = TaxRate::where('user_id', $user)->get();
$items = $this->invoice->item;
//Include deleted invoices
if (Input::get('withTrashed')) {
} else {
if (Input::get('onlyTrashed')) {
$invoices = $this->invoice->onlyTrashed()->where('user_id', $user)->get();
}
}
return View::make('invoices.index', compact('invoices', 'tax_rates'));
}
示例3: getInvoices
public function getInvoices()
{
$invoices = Invoice::where('account_id', Auth::user()->account_id)->where('branch_id', Session::get('branch_id'))->select('public_id', 'invoice_status_id', 'client_id', 'invoice_number', 'invoice_date', 'importe_total', 'branch_name')->orderBy('public_id', 'DESC')->get();
foreach ($invoices as $key => $invoice) {
$invoice_razon = Client::where('account_id', Auth::user()->account_id)->select('name')->where('id', $invoice->client_id)->first();
$invoice->razon = $invoice_razon->name;
$estado = InvoiceStatus::where('id', $invoice->invoice_status_id)->first();
$invoice->estado = $estado->name;
$invoice->accion = "<a class='btn btn-primary btn-xs' data-task='view' href='factura/{$invoice->public_id}' style='text-decoration:none;color:white;'><i class='glyphicon glyphicon-eye-open'></i></a> <a class='btn btn-warning btn-xs' href='copia/{$invoice->public_id}' style='text-decoration:none;color:white;'><i class='glyphicon glyphicon-duplicate'></i></a>";
}
$invoiceJson = ['data' => $invoices];
return Response::json($invoiceJson);
}
示例4: amendInvoice
public static function amendInvoice($booking)
{
$total = Booking::getTotalBookingAmount($booking);
$invoice = Invoice::where('booking_id', $booking->id)->first();
if ($invoice) {
$invoice->count = ++$invoice->count;
$invoice->amount = $total;
$invoice->save();
return true;
} else {
$invoiceData = array('amount' => $total, 'booking_id' => $booking->id);
Invoice::create($invoiceData);
return false;
}
}
示例5: showReceipt
public function showReceipt($id)
{
$receipts = Receipt::find($id);
$hid = $receipts->houseID;
$housename = $hid;
$propertyid = House::where('name', $hid)->pluck('propertyID');
$propertyname = Property::where('id', $propertyid)->pluck('name');
$inid = $receipts->invoiceID;
$allbal = Invoice::where('houseID', $hid)->sum('balance');
$current_bal = Invoice::where('id', $inid)->pluck('balance');
$outstandingbal = $allbal - $current_bal;
$amountdue = $allbal;
$balance = $receipts->balance;
return View::make('backend.code.invoice.showr', compact('receipts', 'amountdue', 'housename', 'outstandingbal', 'propertyname', 'invoicedetails', 'total', 'balance', 'amountdue'));
}
示例6: next_invoice_number
/**
* Get next invoice number
*/
public static function next_invoice_number($type, $days)
{
$last = Invoice::where('type', $type)->where('days', $days)->orderBy('number', 'DESC')->first();
if ($last) {
return $last->number + 1;
} else {
return 1;
}
}
示例7: save
private function save($publicId = null)
{
$action = Input::get('action');
$entityType = Input::get('entityType');
if ($action == 'archive' || $action == 'delete' || $action == 'mark') {
return InvoiceController::bulk($entityType);
}
$input = json_decode(Input::get('data'));
$invoice = $input->invoice;
if (Utils::isAdmin()) {
$branch_id = $input->invoice->branch_id;
$branch = Branch::where('account_id', '=', Auth::user()->account_id)->where('public_id', $branch_id)->first();
// $branch = DB::table('branches')->where('id',$branch_id)->first();
} else {
$branch = Auth::user()->branch;
$branch_id = $branch->id;
$branch = DB::table('branches')->where('id', $branch_id)->first();
}
$today = new DateTime('now');
$today = $today->format('Y-m-d');
$datelimit = DateTime::createFromFormat('Y-m-d', $branch->deadline);
$datelimit = $datelimit->format('Y-m-d');
$valoresPrimera = explode("-", $datelimit);
$valoresSegunda = explode("-", $today);
$diaPrimera = $valoresPrimera[2];
$mesPrimera = $valoresPrimera[1];
$anyoPrimera = $valoresPrimera[0];
$diaSegunda = $valoresSegunda[2];
$mesSegunda = $valoresSegunda[1];
$anyoSegunda = $valoresSegunda[0];
$a = gregoriantojd($mesPrimera, $diaPrimera, $anyoPrimera);
$b = gregoriantojd($mesSegunda, $diaSegunda, $anyoSegunda);
$errorS = "Expiró la fecha límite de " . $branch->name;
if ($a - $b < 0) {
Session::flash('error', $errorS);
return Redirect::to("{$entityType}s/create")->withInput();
} else {
$last_invoice = Invoice::where('account_id', '=', Auth::user()->account_id)->first();
if ($last_invoice) {
$yesterday = $last_invoice->invoice_date;
$today = date("Y-m-d", strtotime($invoice->invoice_date));
$errorD = "La fecha de la factura es incorrecta";
$yesterday = new DateTime($yesterday);
$today = new DateTime($today);
if ($yesterday > $today) {
Session::flash('error', $errorD);
return Redirect::to("{$entityType}s/create")->withInput();
}
}
if ($errors = $this->invoiceRepo->getErrors($invoice)) {
Session::flash('error', trans('texts.invoice_error'));
return Redirect::to("{$entityType}s/create")->withInput()->withErrors($errors);
} else {
$this->taxRateRepo->save($input->tax_rates);
$clientData = (array) $invoice->client;
$clientData['branch'] = $branch->id;
$client = $this->clientRepo->save($invoice->client->public_id, $clientData);
$invoiceData = (array) $invoice;
$invoiceData['branch_id'] = $branch->id;
$invoiceData['client_id'] = $client->id;
$invoiceData['client_nit'] = $client->nit;
$invoiceData['client_name'] = $client->name;
$invoiceData['action'] = $action;
$invoice = $this->invoiceRepo->save($publicId, $invoiceData, $entityType);
$account = Auth::user()->account;
// if ($account->invoice_taxes != $input->invoice_taxes
// || $account->invoice_item_taxes != $input->invoice_item_taxes
// || $account->invoice_design_id != $input->invoice->invoice_design_id)
// {
// $account->invoice_taxes = $input->invoice_taxes;
// $account->invoice_item_taxes = $input->invoice_item_taxes;
// $account->invoice_design_id = $input->invoice->invoice_design_id;
// $account->save();
// }
$client->load('contacts');
$sendInvoiceIds = [];
foreach ($client->contacts as $contact) {
if ($contact->send_invoice || count($client->contacts) == 1) {
$sendInvoiceIds[] = $contact->id;
}
}
foreach ($client->contacts as $contact) {
$invitation = Invitation::scope()->whereContactId($contact->id)->whereInvoiceId($invoice->id)->first();
if (in_array($contact->id, $sendInvoiceIds) && !$invitation) {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $contact->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
} else {
if (!in_array($contact->id, $sendInvoiceIds) && $invitation) {
$invitation->delete();
}
}
}
$invoice_date = date("d/m/Y", strtotime($invoice->invoice_date));
require_once app_path() . '/includes/BarcodeQR.php';
// $ice = $invoice->amount-$invoice->fiscal;
$desc = $invoice->subtotal - $invoice->amount;
$subtotal = number_format($invoice->subtotal, 2, '.', '');
//.........这里部分代码省略.........
示例8: obtenerFacturas
/**
* Funcion utilizada por ajax
*
* @param int $client_id
* @return facturas
*/
public function obtenerFacturas($client_id)
{
$facturas = Invoice::where('account_id', Auth::user()->account_id)->where('client_id', $client_id)->where('balance', '>', '0')->select('id', 'invoice_number', 'importe_total', 'balance')->get();
$respuesta = get_object_vars($facturas);
return Response::json($facturas);
}
示例9: export
public function export()
{
$fecha = explode(" ", Input::get('date'));
$vec = ["Ene" => '01', "Feb" => '02', "Mar" => '03', "Abr" => '04', "May" => '05', "Jun" => '06', "Jul" => '07', "Ago" => '08', "Sep" => '09', "Oct" => '10', "Nov" => '11', "Dic" => '12'];
$date = $fecha[1] . "-" . $vec[substr($fecha[0], 0, 3)];
$output = fopen('php://output', 'w') or Utils::fatalError();
header('Content-Type:application/txt');
header('Content-Disposition:attachment;filename=export.txt');
$invoices = Invoice::where('account_id', Auth::user()->account_id)->where("invoice_number", "!=", "")->where("invoice_number", "!=", 0)->where('invoice_date', 'LIKE', $date . '%')->get();
$p = "|";
$sw = true;
$num = 1;
foreach ($invoices as $i) {
$sw = false;
if ($i->invoice_status_id == 6) {
$i->client_nit = 0;
$i->client_name = "ANULADA";
$i->importe_total = "0.00";
$i->importe_neto = "0.00";
//$i->control_code="0";
$i->discount = "0.00";
$status = "A";
} else {
$status = "V";
}
// $datos = $i->invoice_number.$i->client_nit.$p.$i->client_name.$p.$p.$i->account_nit.$p.$i->invoice_date.$p.$i->importe_total.$p.$i->importe_ice.$p.$i->importe_exento.$p.$i->importe_neto.$p.$i->debito_fiscal.$p.$status.$p.$i->control_code."\r\n";
$fecha = date("d/m/Y", strtotime($i->invoice_date));
$fecha = \DateTime::createFromFormat('Y-m-d', $i->invoice_date);
if ($fecha == null) {
$fecha = $i->invoice_date;
} else {
$fecha = $fecha->format('d/m/Y');
}
//$doc =TypeDocumentBranch::where('branch_id',$i->branch_id)->orderBy('id','desc')->first();
$tipo = TypeDocument::where('id', $i->javascript)->first();
//echo $tipo->master_id."<br>";
$cuenta = Account::where('id', Auth::user()->account_id)->select('currency_id')->first();
$dolar = Invoice::where('account_id', Auth::user()->account_id)->select('sfc')->where('id', $i->id)->where('branch_id', $i->branch_id)->first();
if ($cuenta->currency_id == 2) {
$i->importe_total = $i->importe_total * $dolar->sfc;
$i->importe_total = number_format((double) $i->importe_total, 2, '.', '');
$i->importe_neto = $i->importe_neto * $dolar->sfc;
$i->importe_neto = number_format((double) $i->importe_neto, 2, '.', '');
$i->discount = $i->discount * $dolar->sfc;
$i->discount = number_format((double) $i->discount, 2, '.', '');
}
if ($tipo->master_id == 1 || $tipo->master_id == 4) {
$debito = $i->importe_neto * 0.13;
$debito = number_format((double) $debito, 2, '.', '');
$datos = "3" . $p . $num . $p . $fecha . $p . $i->invoice_number . $p . $i->number_autho . $p . $status . $p . $i->client_nit . $p . $i->client_name . $p . $i->importe_total . $p . $i->importe_ice . $p . $i->importe_exento . $p . "0.00" . $p . $i->importe_total . $p . $i->discount . $p . $i->importe_neto . $p . $debito . $p . $i->control_code . "\r\n";
}
if ($tipo->master_id == 3) {
$datos = "3" . $p . $num . $p . $fecha . $p . $i->invoice_number . $p . $i->number_autho . $p . $status . $p . $i->client_nit . $p . $i->client_name . $p . $i->importe_total . $p . $i->importe_ice . $p . $i->importe_exento . $p . $i->importe_neto . $p . $i->importe_total . $p . $i->discount . $p . "0.00" . $p . "0.00" . $p . $i->control_code . "\r\n";
}
$num++;
//echo $i->invoice_number."<br>";
fputs($output, $datos);
$datos = null;
}
//return 0;
if ($sw) {
fputs($output, "No se encontraron ventas en este periodo: " . Input::get('date'));
}
fclose($output);
exit;
}
示例10: getReport
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;
}
示例11: enviarCorreoFactura
public function enviarCorreoFactura($min = 0, $max = 0)
{
//todotix http
$min = Input::get('min');
$max = Input::get('max');
$branch = 1;
$cuenta = Account::where('domain', 'roy')->where('id', 1)->first();
$invoices = Invoice::where('account_id', $cuenta->id)->where('branch_id', $branch)->where('public_id', '>=', $min)->where('public_id', '<=', $max)->get();
$count = 1;
foreach ($invoices as $key => $invoice) {
$client = Client::where('id', $invoice->client_id)->select('name', 'business_name', 'nit')->first();
if (filter_var($client->name, FILTER_VALIDATE_EMAIL)) {
$this->sendInvoiceByMailLocal($client->name, $client->business_name, $invoice->id, $invoice->invoice_date, $client->nit);
echo $count . " " . $client->name . " " . $invoice->control_code . " " . $invoice->invoice_number . "<br>";
sleep(0.2);
$count = $count + 1;
}
}
}
示例12: Actualizar
public function Actualizar()
{
if ($this->id) {
if (empty($this->fv_error_message)) {
$facturas = Invoice::where('branch_id', $this->id)->where('account_id', $this->account_id)->first();
//si no tienen facturas seguir
if (!$facturas) {
$usuarios = UserBranch::getUsersBranch($this->id, $this->account_id);
// si no tiene usuarios asignados y no tiene facturas puede hacer los cambios --esto es para de baja necesito descansar XD
// if(!$usuarios)
// {
$this->account_id = $this->account_id ? $this->account->id : $this->fv_account_id;
$this->name = $this->fv_name;
$this->number_branch = $this->fv_number_branch;
$this->address2 = $this->fv_address2;
$this->address1 = $this->fv_address1;
$this->work_phone = $this->fv_workphone;
$this->city = $this->fv_city;
$this->state = $this->fv_state;
$this->deadline = $this->fv_deadline;
$this->key_dosage = $this->fv_key_dossage;
$this->economic_activity = $this->fv_economic_activity;
$this->number_process = $this->fv_number_process;
$this->number_autho = $this->fv_nummber_autho;
$this->law = $this->fv_law;
$this->type_third = $this->getType_thrird();
$this->invoice_number_counter = 1;
$this->save();
//verificar los nuevos asignados
//aplicando algorimo de asignacion
foreach (TypeDocumentBranch::where('branch_id', $this->id)->get() as $type_document_branch) {
# code...
$type_document_branch->delete();
}
foreach ($this->fv_type_documents_branch as $type_document_nuevos) {
# code...
//TODO: acabar esta parte de la consulta me falta la asignacion XD ...... :()
$existeAsignado = TypeDocumentBranch::withTrashed()->where('branch_id', $this->id)->where('type_document_id', $type_document_nuevos)->first();
if ($existeAsignado) {
$existeAsignado->restore();
} else {
$tipo = new TypeDocumentBranch();
$tipo->branch_id = $this->id;
$tipo->type_document_id = $type_document_nuevos;
$tipo->save();
}
}
$this->fv_error_message = "Registro Actualizado";
return true;
// }
// $this->fv_error_message = $this->fv_error_message . ' debe reasignar a los usuarios de esta sucursal <br>';
// return false;
}
//si tiene facturas hay que verificar la fecha actual sea mayor a la fecha limite
$this->name = $this->fv_name;
$this->address2 = $this->fv_address2;
$this->address1 = $this->fv_address1;
$this->work_phone = $this->fv_workphone;
$this->city = $this->fv_city;
$this->state = $this->fv_state;
$fecha_actual = new DateTime("now");
$fecha_limite = new DateTime($this->deadline);
if ($fecha_actual > $fecha_limite) {
$this->number_branch = $this->fv_number_branch;
//docificaciones y numero de invoicce nada masXD
$this->deadline = $this->fv_deadline;
$this->key_dosage = $this->fv_key_dossage;
$this->economic_activity = $this->fv_economic_activity;
$this->number_process = $this->fv_number_process;
$this->number_autho = $this->fv_nummber_autho;
$this->law = $this->fv_law;
$this->type_third = $this->getType_thrird();
//colocamos la sucursal en 1 de nuevo
$this->invoice_number_counter = 1;
}
$this->save();
//modificacion
foreach (TypeDocumentBranch::where('branch_id', $this->id) as $type_document_branch) {
# code...
$type_document_branch->delete();
}
foreach ($this->fv_type_documents_branch as $type_document_nuevos) {
# code...
//TODO: acabar esta parte de la consulta me falta la asignacion XD ...... :()
$existeAsignado = TypeDocumentBranch::withTrashed()->where('branch_id', $this->id)->where('type_document_id', $type_document_nuevos)->first();
if ($existeAsignado) {
$existeAsignado->restore();
} else {
$tipo = new TypeDocumentBranch();
$tipo->branch_id = $this->id;
$tipo->type_document_id = $type_document_nuevos;
$tipo->save();
}
}
$this->fv_error_message = "Registro Actualizado";
return true;
}
}
$this->fv_error_message = $this->fv_error_message . ' Sucursal ' . ERROR_NULL . '<br>';
return false;
//.........这里部分代码省略.........
示例13: setAmount
public function setAmount($amount)
{
if (is_null($amount)) {
$this->fv_amount = "Factura " . ERROR_NULL . "<br>";
return;
}
$credit = Credit::where('account_id', $this->getAccountId())->where('client_id', $this->getClientId())->get();
$invoice = Invoice::where('id', $this->getInvoiceId())->first();
$credito = 0;
foreach ($credit as $cre) {
$credito += $cre->balance;
}
//echo $amount." - ".$credito;
if ($credito < $amount && $this->getPaymentTypeId() == 2) {
$this->fv_amount = "No tiene suficiente crédito para realizar este pago.";
return;
}
if ($invoice->balance < $amount) {
$this->fv_amount = "No es posible pagar mas de lo adeudado.";
return;
}
if ($amount <= 0) {
$this->fv_amount = "El monto no puede ser menor o igual a 0";
return;
}
$this->fv_amount = null;
$this->amount = $amount;
return $this;
}
示例14: excel
public function excel()
{
//print_r(Input::get('excel'));
//return 0;
//return View::make('factura.import');
$dir = "files/excel/";
$fecha = base64_encode("excel" . date('d/m/Y-H:m:i'));
$file_name = $fecha;
//return $file_name;
$file = Input::file('excel');
$destinationPath = 'files/excel/';
// If the uploads fail due to file system, you can try doing public_path().'/uploads'
$filename = $file_name;
//str_random(12);
//$filename = $file->getClientOriginalName();
//$extension =$file->getClientOriginalExtension();
$upload_success = Input::file('excel')->move($destinationPath, $filename);
// if( $upload_success ) {
// return Response::json('success', 200);
// } else {
// return Response::json('error', 400);
// }
// return 0;
$results = Excel::selectSheetsByIndex(0)->load($dir . $file_name)->get();
$factura = array();
$groups = array();
//shattering file gotten
$nit = "";
foreach ($results as $key => $res) {
$dato = [];
//$nit = "";
foreach ($res as $r) {
if ($r != "") {
array_push($dato, $r);
}
}
//$nit = $dato[0];
if ($dato) {
if ($nit == $dato[0]) {
array_push($groups, $dato);
} else {
if ($groups) {
$bbr = ['id' => $groups[0][0], 'nit' => $groups[0][1], 'nota' => $groups[0][5]];
$products = array();
foreach ($groups as $gru) {
$pro['product_key'] = $gru[2];
$pro['description'] = $gru[3];
$pro['cost'] = $gru[4];
array_push($products, $pro);
}
$bbr['products'] = $products;
array_push($factura, $bbr);
}
$groups = array();
$nit = $dato[0];
array_push($groups, $dato);
}
}
}
if ($groups) {
$bbr = ['id' => $groups[0][0], 'nit' => $groups[0][1], 'nota' => $groups[0][5]];
$products = array();
foreach ($groups as $gru) {
$pro['product_key'] = $gru[2];
$pro['description'] = $gru[3];
$pro['cost'] = $gru[4];
array_push($products, $pro);
}
$bbr['products'] = $products;
array_push($factura, $bbr);
}
$returnable = $this->validateShatterExcel($factura);
if ($returnable != "") {
Session::flash('error', $returnable);
return View::make('factura.import');
}
//echo $returnable;
//return 0;
$cont = 0;
foreach ($factura as $fac) {
$this->saveLote($fac);
$cont++;
}
Session::flash('message', 'Se importaron ' . $cont . ' facturas exitósamente');
$invoices = Invoice::where('account_id', Auth::user()->account_id)->where('branch_id', Session::get('branch_id'))->orderBy('public_id', 'DESC')->get();
return View::make('factura.index', array('invoices' => $invoices));
return 0;
}
示例15: pagoCliente
public function pagoCliente($client_id, $invoice_id)
{
$client = Client::where('id', $client_id)->first();
$invoice = Invoice::where('id', $invoice_id)->first();
$dato = ['now' => date('d/m/Y'), 'cliente' => $client->name, 'client_id' => $client->id, 'factura' => 'Factura #' . $invoice->invoice_number . ' Importe Total ' . $invoice->importe_total . '(' . $invoice->balance . ')', 'invoice_id' => $invoice->id, 'amount' => $invoice->balance];
return View::make('pagos.createCustom', $dato);
}