From 9bd9b6313d035f1b30e159ba080f957eb088254c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 29 Apr 2018 09:01:15 +0300 Subject: [PATCH] Working on client statements --- ...llel-NIX's conflicted copy 2018-04-29).php | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 app/Jobs/Client/GenerateStatementData (hillel-NIX's conflicted copy 2018-04-29).php diff --git a/app/Jobs/Client/GenerateStatementData (hillel-NIX's conflicted copy 2018-04-29).php b/app/Jobs/Client/GenerateStatementData (hillel-NIX's conflicted copy 2018-04-29).php deleted file mode 100644 index 7c868722e87f..000000000000 --- a/app/Jobs/Client/GenerateStatementData (hillel-NIX's conflicted copy 2018-04-29).php +++ /dev/null @@ -1,61 +0,0 @@ -client = $client; - $this->options = $options; - } - - /** - * Execute the job. - * - * @return void - */ - public function handle() - { - $client = $this->client; - $account = $client->account; - - $options = $this->options; - $statusId = intval($options['status_id']); - $startDate = $options['start_date']; - $endDate = $options['end_date']; - - $invoice = $account->createInvoice(ENTITY_INVOICE); - $invoice->client = $client; - $invoice->date_format = $account->date_format ? $account->date_format->format_moment : 'MMM D, YYYY'; - - $invoices = Invoice::scope() - ->with(['client']) - ->invoices() - ->whereClientId($client->id) - ->whereIsPublic(true) - ->orderBy('invoice_date', 'asc'); - - if ($statusId == INVOICE_STATUS_PAID) { - $invoices->where('invoice_status_id', '=', INVOICE_STATUS_PAID); - } elseif ($statusId == INVOICE_STATUS_UNPAID) { - $invoices->where('invoice_status_id', '!=', INVOICE_STATUS_PAID); - } - - if ($statusId == INVOICE_STATUS_PAID || ! $statusId) { - $invoices->where('invoice_date', '>=', $startDate) - ->where('invoice_date', '<=', $endDate); - } - - $invoice->invoice_items = $invoices->get(); - - return json_encode($invoice); - } - - private function getInvoices() - { - - } -}