Example #1
0
 protected function getDatatableColumns($entityType, $hideClient)
 {
     return [['client_name', function ($model) {
         if (!Client::canViewItemByOwner($model->client_user_id)) {
             return Utils::getClientDisplayName($model);
         }
         return $model->client_public_id ? link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model))->toHtml() : '';
     }, !$hideClient], ['created_at', function ($model) {
         return link_to("tasks/{$model->public_id}/edit", Task::calcStartTime($model))->toHtml();
     }], ['time_log', function ($model) {
         return Utils::formatTime(Task::calcDuration($model));
     }], ['description', function ($model) {
         return $model->description;
     }], ['invoice_number', function ($model) {
         return self::getStatusLabel($model);
     }]];
 }
 protected function getDatatableColumns($entityType, $hideClient)
 {
     return [['client_name', function ($model) {
         if (!Client::canViewItemByOwner($model->client_user_id)) {
             return Utils::getClientDisplayName($model);
         }
         return $model->client_public_id ? link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model))->toHtml() : '';
     }, !$hideClient], ['amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id) . '<span ' . Utils::getEntityRowClass($model) . '/>';
     }], ['balance', function ($model) {
         return Utils::formatMoney($model->balance, $model->currency_id, $model->country_id);
     }], ['credit_date', function ($model) {
         return Utils::fromSqlDate($model->credit_date);
     }], ['private_notes', function ($model) {
         return $model->private_notes;
     }]];
 }
 protected function getDatatableColumns($entityType, $hideClient)
 {
     return [['vendor_name', function ($model) {
         if ($model->vendor_public_id) {
             if (!Vendor::canViewItemByOwner($model->vendor_user_id)) {
                 return $model->vendor_name;
             }
             return link_to("vendors/{$model->vendor_public_id}", $model->vendor_name)->toHtml();
         } else {
             return '';
         }
     }], ['client_name', function ($model) {
         if ($model->client_public_id) {
             if (!Client::canViewItemByOwner($model->client_user_id)) {
                 return Utils::getClientDisplayName($model);
             }
             return link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model))->toHtml();
         } else {
             return '';
         }
     }], ['expense_date', function ($model) {
         if (!Expense::canEditItemByOwner($model->user_id)) {
             return Utils::fromSqlDate($model->expense_date);
         }
         return link_to("expenses/{$model->public_id}/edit", Utils::fromSqlDate($model->expense_date))->toHtml();
     }], ['amount', function ($model) {
         // show both the amount and the converted amount
         if ($model->exchange_rate != 1) {
             $converted = round($model->amount * $model->exchange_rate, 2);
             return Utils::formatMoney($model->amount, $model->expense_currency_id) . ' | ' . Utils::formatMoney($converted, $model->invoice_currency_id);
         } else {
             return Utils::formatMoney($model->amount, $model->expense_currency_id);
         }
     }], ['public_notes', function ($model) {
         return $model->public_notes != null ? substr($model->public_notes, 0, 100) : '';
     }], ['expense_status_id', function ($model) {
         return self::getStatusLabel($model->invoice_id, $model->should_be_invoiced);
     }]];
 }
 protected function getDatatableColumns($entityType, $hideClient)
 {
     return [['invoice_number', function ($model) {
         if (!Invoice::canEditItemByOwner($model->invoice_user_id)) {
             return $model->invoice_number;
         }
         return link_to("invoices/{$model->invoice_public_id}/edit", $model->invoice_number, ['class' => Utils::getEntityRowClass($model)])->toHtml();
     }], ['client_name', function ($model) {
         if (!Client::canViewItemByOwner($model->client_user_id)) {
             return Utils::getClientDisplayName($model);
         }
         return $model->client_public_id ? link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model))->toHtml() : '';
     }, !$hideClient], ['transaction_reference', function ($model) {
         return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>';
     }], ['payment_type', function ($model) {
         return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? $model->gateway_name : '');
     }], ['amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
     }], ['payment_date', function ($model) {
         return Utils::dateToString($model->payment_date);
     }]];
 }
 protected function getDatatableColumns($entityType, $hideClient)
 {
     return [['invoice_number', function ($model) use($entityType) {
         if (!Invoice::canEditItem($model)) {
             return $model->invoice_number;
         }
         return link_to("{$entityType}s/{$model->public_id}/edit", $model->invoice_number, ['class' => Utils::getEntityRowClass($model)])->toHtml();
     }], ['client_name', function ($model) {
         if (!Client::canViewItemByOwner($model->client_user_id)) {
             return Utils::getClientDisplayName($model);
         }
         return link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model))->toHtml();
     }, !$hideClient], ['invoice_date', function ($model) {
         return Utils::fromSqlDate($model->invoice_date);
     }], ['amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
     }], ['balance', function ($model) {
         return $model->partial > 0 ? trans('texts.partial_remaining', ['partial' => Utils::formatMoney($model->partial, $model->currency_id, $model->country_id), 'balance' => Utils::formatMoney($model->balance, $model->currency_id, $model->country_id)]) : Utils::formatMoney($model->balance, $model->currency_id, $model->country_id);
     }, $entityType == ENTITY_INVOICE], ['due_date', function ($model) {
         return Utils::fromSqlDate($model->due_date);
     }], ['invoice_status_name', function ($model) use($entityType) {
         return $model->quote_invoice_id ? link_to("invoices/{$model->quote_invoice_id}/edit", trans('texts.converted'))->toHtml() : self::getStatusLabel($entityType, $model);
     }]];
 }