mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Performance improvements for PDF rendering (#3556)
* Performance improvements for PDF generation * CS Fixer * Performance improvements for PDF generate * Fixes for tests
This commit is contained in:
parent
669507f995
commit
9cb7996a2e
@ -466,70 +466,70 @@ class CompanySettings extends BaseSettings
|
||||
private static function getEntityVariableDefaults()
|
||||
{
|
||||
$variables = [
|
||||
'client_details' => (object)[
|
||||
'$client.name' => ctrans('texts.client_name'),
|
||||
'$client.id_number' => ctrans('texts.id_number'),
|
||||
'$client.vat_number' => ctrans('texts.vat_number'),
|
||||
'$client.address1' => ctrans('texts.address1'),
|
||||
'$client.address2' => ctrans('texts.address2'),
|
||||
'$client.city_state_postal' => ctrans('texts.city_state_postal'),
|
||||
'$client.country' => ctrans('texts.country'),
|
||||
'$client.email' => ctrans('texts.email'),
|
||||
'client_details' => [
|
||||
'$client.name',
|
||||
'$client.id_number',
|
||||
'$client.vat_number',
|
||||
'$client.address1',
|
||||
'$client.address2',
|
||||
'$client.city_state_postal',
|
||||
'$client.country',
|
||||
'$contact.email',
|
||||
],
|
||||
'company_details' => (object)[
|
||||
'$company.company_name' => ctrans('texts.company_name'),
|
||||
'$company.id_number' => ctrans('texts.id_number'),
|
||||
'$company.vat_number' => ctrans('texts.vat_number'),
|
||||
'$company.website' => ctrans('texts.website'),
|
||||
'$company.email' => ctrans('texts.email'),
|
||||
'$company.phone' => ctrans('texts.phone'),
|
||||
'company_details' => [
|
||||
'$company.company_name',
|
||||
'$company.id_number',
|
||||
'$company.vat_number',
|
||||
'$company.website',
|
||||
'$company.email',
|
||||
'$company.phone',
|
||||
],
|
||||
'company_address' => (object)[
|
||||
'$company.address1' => ctrans('texts.address1'),
|
||||
'$company.address2' => ctrans('texts.address2'),
|
||||
'$company.city_state_postal' => ctrans('texts.city_state_postal'),
|
||||
'$company.country' => ctrans('texts.country'),
|
||||
'company_address' => [
|
||||
'$company.address1',
|
||||
'$company.address2',
|
||||
'$company.city_state_postal',
|
||||
'$company.country',
|
||||
],
|
||||
'invoice_details' => (object)[
|
||||
'$invoice.invoice_number' => ctrans('texts.invoice_number'),
|
||||
'$invoice.po_number' => ctrans('texts.po_number'),
|
||||
'$invoice.invoice_date' => ctrans('texts.invoice_date'),
|
||||
'$invoice.due_date' => ctrans('texts.due_date'),
|
||||
'$invoice.balance_due' => ctrans('texts.balance_due'),
|
||||
'$invoice.invoice_total' => ctrans('texts.invoice_total'),
|
||||
'invoice_details' => [
|
||||
'$invoice.invoice_number',
|
||||
'$invoice.po_number',
|
||||
'$invoice.invoice_date',
|
||||
'$invoice.due_date',
|
||||
'$invoice.balance_due',
|
||||
'$invoice.invoice_total',
|
||||
],
|
||||
'quote_details' => (object)[
|
||||
'$quote.quote_number' => ctrans('texts.quote_number'),
|
||||
'$quote.po_number' => ctrans('texts.po_number'),
|
||||
'$quote.quote_date' => ctrans('texts.quote_date'),
|
||||
'$quote.valid_until' => ctrans('texts.valid_until'),
|
||||
'$quote.balance_due' => ctrans('texts.balance_due'),
|
||||
'$quote.quote_total' => ctrans('texts.quote_total'),
|
||||
'quote_details' => [
|
||||
'$quote.quote_number',
|
||||
'$quote.po_number',
|
||||
'$quote.quote_date',
|
||||
'$quote.valid_until',
|
||||
'$quote.balance_due',
|
||||
'$quote.quote_total',
|
||||
],
|
||||
'credit_details' => (object)[
|
||||
'$credit.credit_number' => ctrans('texts.credit_number'),
|
||||
'$credit.po_number' => ctrans('texts.po_number'),
|
||||
'$credit.credit_date' => ctrans('texts.credit_date'),
|
||||
'$credit.credit_balance' => ctrans('texts.credit_balance'),
|
||||
'$credit.credit_amount' => ctrans('texts.credit_amount'),
|
||||
'credit_details' => [
|
||||
'$credit.credit_number',
|
||||
'$credit.po_number',
|
||||
'$credit.credit_date',
|
||||
'$credit.credit_balance',
|
||||
'$credit.credit_amount',
|
||||
],
|
||||
'product_columns' => (object)[
|
||||
'$product.product_key' => ctrans('texts.product_key'),
|
||||
'$product.notes' => ctrans('texts.notes'),
|
||||
'$product.cost' => ctrans('texts.cost'),
|
||||
'$product.quantity' => ctrans('texts.quantity'),
|
||||
'$product.discount' => ctrans('texts.discount'),
|
||||
'$product.tax_name1' => ctrans('texts.tax_name1'),
|
||||
'$product.line_total' => ctrans('texts.line_total'),
|
||||
'product_columns' => [
|
||||
'$product.product_key',
|
||||
'$product.notes',
|
||||
'$product.cost',
|
||||
'$product.quantity',
|
||||
'$product.discount',
|
||||
'$product.tax_name1',
|
||||
'$product.line_total',
|
||||
],
|
||||
'task_columns' => (object)[
|
||||
'$task.product_key' => ctrans('texts.product_key'),
|
||||
'$task.notes' => ctrans('texts.notes'),
|
||||
'$task.cost' => ctrans('texts.cost'),
|
||||
'$task.quantity' => ctrans('texts.quantity'),
|
||||
'$task.discount' => ctrans('texts.discount'),
|
||||
'$task.tax_name1' => ctrans('texts.tax_name1'),
|
||||
'$task.line_total' => ctrans('texts.line_total'),
|
||||
'task_columns' =>[
|
||||
'$task.product_key',
|
||||
'$task.notes',
|
||||
'$task.cost',
|
||||
'$task.quantity',
|
||||
'$task.discount',
|
||||
'$task.tax_name1',
|
||||
'$task.line_total',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -89,30 +89,22 @@ class Designer
|
||||
|
||||
public function getIncludes()
|
||||
{
|
||||
$this->setDesign($this->getSection('includes'));
|
||||
|
||||
return $this;
|
||||
return $this->getSection('includes');
|
||||
}
|
||||
|
||||
public function getHeader()
|
||||
{
|
||||
$this->setDesign($this->getSection('header'));
|
||||
|
||||
return $this;
|
||||
return $this->getSection('header');
|
||||
}
|
||||
|
||||
public function getFooter()
|
||||
{
|
||||
$this->setDesign($this->getSection('footer'));
|
||||
|
||||
return $this;
|
||||
return $this->getSection('footer');
|
||||
}
|
||||
|
||||
public function getBody()
|
||||
{
|
||||
$this->setDesign($this->getSection('body'));
|
||||
|
||||
return $this;
|
||||
return $this->getSection('body');
|
||||
}
|
||||
|
||||
public function getHtml():string
|
||||
@ -148,6 +140,7 @@ class Designer
|
||||
|
||||
private function exportVariables()
|
||||
{
|
||||
//$s = microtime(true);
|
||||
$company = $this->entity->company;
|
||||
|
||||
$this->exported_variables['$app_url'] = $this->entity->generateAppUrl();
|
||||
@ -178,7 +171,7 @@ class Designer
|
||||
if (strlen($this->exported_variables['$product_table_body']) == 0) {
|
||||
$this->exported_variables['$product_table_header'] = '';
|
||||
}
|
||||
|
||||
//\Log::error("Exporting variables took = ".(microtime(true)-$s));
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -186,8 +179,10 @@ class Designer
|
||||
{
|
||||
$output = '';
|
||||
|
||||
foreach (array_keys($input_variables) as $value) {
|
||||
$output .= $variables[$value];
|
||||
foreach (array_values($input_variables) as $value) {
|
||||
if (array_key_exists($value, $variables)) {
|
||||
$output .= $variables[$value];
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
@ -198,9 +193,11 @@ class Designer
|
||||
$output = '';
|
||||
|
||||
foreach (array_keys($input_variables) as $value) {
|
||||
$tmp = str_replace("</span>", "_label</span>", $variables[$value]);
|
||||
//$output .= $variables[$value];
|
||||
$output .= $tmp;
|
||||
if (array_key_exists($value, $variables)) {
|
||||
$tmp = str_replace("</span>", "_label</span>", $variables[$value]);
|
||||
|
||||
$output .= $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
@ -217,15 +214,15 @@ class Designer
|
||||
'$client.city_state_postal' => '<p>$client.city_state_postal</p>',
|
||||
'$client.postal_city_state' => '<p>$client.postal_city_state</p>',
|
||||
'$client.country' => '<p>$client.country</p>',
|
||||
'$client.email' => '<p>$client.email</p>',
|
||||
'$client.client1' => '<p>$client1</p>',
|
||||
'$client.client2' => '<p>$client2</p>',
|
||||
'$client.client3' => '<p>$client3</p>',
|
||||
'$client.client4' => '<p>$client4</p>',
|
||||
'$client.contact1' => '<p>$contact1</p>',
|
||||
'$client.contact2' => '<p>$contact2</p>',
|
||||
'$client.contact3' => '<p>$contact3</p>',
|
||||
'$client.contact4' => '<p>$contact4</p>',
|
||||
'$contact.email' => '<p>$client.email</p>',
|
||||
'$client.custom1' => '<p>$client.custom1</p>',
|
||||
'$client.custom2' => '<p>$client.custom2</p>',
|
||||
'$client.custom3' => '<p>$client.custom3</p>',
|
||||
'$client.custom4' => '<p>$client.custom4</p>',
|
||||
'$contact.contact1' => '<p>$contact.custom1</p>',
|
||||
'$contact.contact2' => '<p>$contact.custom2</p>',
|
||||
'$contact.contact3' => '<p>$contact.custom3</p>',
|
||||
'$contact.contact4' => '<p>$contact.custom4</p>',
|
||||
];
|
||||
|
||||
return $this->processCustomFields($company, $data);
|
||||
@ -269,21 +266,21 @@ class Designer
|
||||
private function invoiceDetails(Company $company)
|
||||
{
|
||||
$data = [
|
||||
'$invoice.invoice_number' => '<span>$invoice.number_label</span><span>$invoice.number</span>',
|
||||
'$invoice.po_number' => '<span>$invoice.po_number_label</span><span>$invoice.po_number</span>',
|
||||
'$invoice.invoice_date' => '<span>$invoice.date_label</span><span>$invoice.date</span>',
|
||||
'$invoice.due_date' => '<span>$invoice.due_date_label</span><span>$invoice.due_date</span>',
|
||||
'$invoice.balance_due' => '<span>$invoice.balance_due_label</span><span>$invoice.balance_due</span>',
|
||||
'$invoice.invoice_total' => '<span>$invoice.total_label</span><span>$invoice.total</span>',
|
||||
'$invoice.partial_due' => '<span>$invoice.partial_due_label</span><span>$invoice.partial_due</span>',
|
||||
'$invoice.invoice1' => '<span>$invoice1_label</span><span>$invoice1</span>',
|
||||
'$invoice.invoice2' => '<span>$invoice2_label</span><span>$invoice2</span>',
|
||||
'$invoice.invoice3' => '<span>$invoice3_label</span><span>$invoice3</span>',
|
||||
'$invoice.invoice4' => '<span>$invoice4_label</span><span>$invoice4</span>',
|
||||
'$invoice.surcharge1' => '<span>$surcharge1_label</span><span>$surcharge1</span>',
|
||||
'$invoice.surcharge2' => '<span>$surcharge2_label</span><span>$surcharge2</span>',
|
||||
'$invoice.surcharge3' => '<span>$surcharge3_label</span><span>$surcharge3</span>',
|
||||
'$invoice.surcharge4' => '<span>$surcharge4_label</span><span>$surcharge4</span>',
|
||||
'$invoice.number' => '<span>$invoice.number_label: $invoice.number</span>',
|
||||
'$invoice.po_number' => '<span>$invoice.po_number_label: $invoice.po_number</span>',
|
||||
'$invoice.date' => '<span>$invoice.date_label: $invoice.date</span>',
|
||||
'$invoice.due_date' => '<span>$invoice.due_date_label: $invoice.due_date</span>',
|
||||
'$invoice.balance_due' => '<span>$invoice.balance_due_label: $invoice.balance_due</span>',
|
||||
'$invoice.total' => '<span>$invoice.total_label: $invoice.total</span>',
|
||||
'$invoice.partial_due' => '<span>$invoice.partial_due_label: $invoice.partial_due</span>',
|
||||
'$invoice.custom1' => '<span>$invoice1_label: $invoice.custom1</span>',
|
||||
'$invoice.custom2' => '<span>$invoice2_label: $invoice.custom2</span>',
|
||||
'$invoice.custom3' => '<span>$invoice3_label: $invoice.custom3</span>',
|
||||
'$invoice.custom4' => '<span>$invoice4_label: $invoice.custom4</span>',
|
||||
'$surcharge1' => '<span>$surcharge1_label: $surcharge1</span>',
|
||||
'$surcharge2' => '<span>$surcharge2_label: $surcharge2</span>',
|
||||
'$surcharge3' => '<span>$surcharge3_label: $surcharge3</span>',
|
||||
'$surcharge4' => '<span>$surcharge4_label: $surcharge4</span>',
|
||||
];
|
||||
|
||||
return $this->processCustomFields($company, $data);
|
||||
|
@ -99,14 +99,15 @@ class SetupController extends Controller
|
||||
*/
|
||||
public function checkDB(): Response
|
||||
{
|
||||
if (Account::count() == 0) {}
|
||||
if (Account::count() == 0) {
|
||||
}
|
||||
|
||||
// test db - > /setup/check_db (POST) please send array of DB variables - response 200/success or 400 [message]
|
||||
// test mail -> /setup/check_mail (POST) please send array of MAIL xvariables - response 200/success or 400 [message]
|
||||
|
||||
$randomStatus = rand(0, 1);
|
||||
|
||||
if($randomStatus) {
|
||||
if ($randomStatus) {
|
||||
return response([], 200);
|
||||
}
|
||||
|
||||
@ -120,14 +121,15 @@ class SetupController extends Controller
|
||||
*/
|
||||
public function checkMail(): Response
|
||||
{
|
||||
if (Account::count() == 0) {}
|
||||
if (Account::count() == 0) {
|
||||
}
|
||||
|
||||
// test db - > /setup/check_db (POST) please send array of DB variables - response 200/success or 400 [message]
|
||||
// test mail -> /setup/check_mail (POST) please send array of MAIL variables - response 200/success or 400 [message]
|
||||
|
||||
$randomStatus = rand(0, 1);
|
||||
|
||||
if($randomStatus) {
|
||||
if ($randomStatus) {
|
||||
return response([], 200);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,6 @@ class Kernel extends HttpKernel
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\StartupCheck::class,
|
||||
\App\Http\Middleware\QueryLogging::class,
|
||||
],
|
||||
|
||||
|
@ -46,6 +46,5 @@ class ShowTemplateRequest extends Request
|
||||
|
||||
public function message()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -74,47 +74,22 @@ class CreateQuotePdf implements ShouldQueue
|
||||
|
||||
App::setLocale($this->contact->preferredLocale());
|
||||
|
||||
$path = $this->quote->client->quote_filepath();
|
||||
$path = $this->quote->client->quote_filepath();
|
||||
|
||||
$design = Design::find($this->decodePrimaryKey($this->quote->client->getSetting('quote_design_id')));
|
||||
$design = Design::find($this->decodePrimaryKey($this->quote->client->getSetting('quote_design_id')));
|
||||
|
||||
$designer = new Designer($this->quote, $design, $this->quote->client->getSetting('pdf_variables'), 'quote');
|
||||
$designer = new Designer($this->quote, $design, $this->quote->client->getSetting('pdf_variables'), 'quote');
|
||||
|
||||
//todo - move this to the client creation stage so we don't keep hitting this unnecessarily
|
||||
Storage::makeDirectory($path, 0755);
|
||||
|
||||
//\Log::error($html);
|
||||
|
||||
$all_pages_header = $settings->all_pages_header;
|
||||
$all_pages_footer = $settings->all_pages_footer;
|
||||
|
||||
$quote_number = $this->quote->number;
|
||||
|
||||
|
||||
// if($all_pages_header && $all_pages_footer){
|
||||
// $all_pages_header = $designer->init()->getHeader()->getHtml();
|
||||
// $all_pages_footer = $designer->init()->getFooter()->getHtml();
|
||||
// $design_body = $designer->init()->getBody()->getHtml();
|
||||
// $quote_number = "header_and_footer";
|
||||
// }
|
||||
// elseif($all_pages_header){
|
||||
// $all_pages_header = $designer->init()->getHeader()->getHtml();
|
||||
// $design_body = $designer->init()->getBody()->getFooter()->getHtml();
|
||||
// $quote_number = "header_only";
|
||||
// }
|
||||
// elseif($all_pages_footer){
|
||||
// $all_pages_footer = $designer->init()->getFooter()->getHtml();
|
||||
// $design_body = $designer->init()->getHeader()->getBody()->getHtml();
|
||||
// $quote_number = "footer_only";
|
||||
// }
|
||||
// else{
|
||||
$design_body = $designer->build()->getHtml();
|
||||
|
||||
|
||||
|
||||
|
||||
//get invoice design
|
||||
// $html = $this->generateInvoiceHtml($design_body, $this->quote, $this->contact);
|
||||
$html = $this->generateEntityHtml($designer, $this->quote, $this->contact);
|
||||
|
||||
$pdf = $this->makePdf($all_pages_header, $all_pages_footer, $html);
|
||||
@ -122,8 +97,6 @@ class CreateQuotePdf implements ShouldQueue
|
||||
|
||||
$instance = Storage::disk($this->disk)->put($file_path, $pdf);
|
||||
|
||||
//$instance= Storage::disk($this->disk)->path($file_path);
|
||||
//
|
||||
return $file_path;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,6 @@ class TemplateEngine
|
||||
]);
|
||||
|
||||
$this->body = $converter->convertToHtml($this->body);
|
||||
|
||||
}
|
||||
|
||||
private function entityValues()
|
||||
@ -145,7 +144,6 @@ class TemplateEngine
|
||||
]);
|
||||
|
||||
$this->body = $converter->convertToHtml($this->body);
|
||||
|
||||
}
|
||||
|
||||
private function renderTemplate()
|
||||
|
@ -45,13 +45,15 @@ trait MakesInvoiceHtml
|
||||
$labels = $entity->makeLabels();
|
||||
$values = $entity->makeValues($contact);
|
||||
|
||||
$designer->build();
|
||||
|
||||
$data = [];
|
||||
$data['entity'] = $entity;
|
||||
$data['lang'] = $client->preferredLocale();
|
||||
$data['includes'] = $designer->init()->getIncludes()->getHtml();
|
||||
$data['header'] = $designer->init()->getHeader()->getHtml();
|
||||
$data['body'] = $designer->init()->getBody()->getHtml();
|
||||
$data['footer'] = $designer->init()->getFooter()->getHtml();
|
||||
$data['includes'] = $designer->getIncludes();
|
||||
$data['header'] = $designer->getHeader();
|
||||
$data['body'] = $designer->getBody();
|
||||
$data['footer'] = $designer->getFooter();
|
||||
|
||||
$html = view('pdf.stub', $data)->render();
|
||||
|
||||
|
@ -125,6 +125,12 @@ trait MakesInvoiceValues
|
||||
|
||||
$settings = $this->client->getMergedSettings();
|
||||
|
||||
if (!$contact) {
|
||||
$contact = $this->client->primary_contact()->first();
|
||||
}
|
||||
|
||||
$calc = $this->calc();
|
||||
|
||||
$data = [];
|
||||
$data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||
$data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => ''];
|
||||
@ -170,26 +176,26 @@ trait MakesInvoiceValues
|
||||
$data['$entity_number'] = &$data['$number'];
|
||||
|
||||
//$data['$paid_to_date'] = ;
|
||||
$data['$invoice.discount'] = ['value' => Number::formatMoney($this->calc()->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')];
|
||||
$data['$invoice.discount'] = ['value' => Number::formatMoney($calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')];
|
||||
$data['$discount'] = &$data['$invoice.discount'];
|
||||
$data['$subtotal'] = ['value' => Number::formatMoney($this->calc()->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')];
|
||||
$data['$subtotal'] = ['value' => Number::formatMoney($calc->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')];
|
||||
$data['$invoice.subtotal'] = &$data['$subtotal'];
|
||||
$data['$invoice.balance_due'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')];
|
||||
$data['$quote.balance_due'] = &$data['$invoice.balance_due'];
|
||||
$data['$balance_due'] = &$data['$invoice.balance_due'];
|
||||
$data['$invoice.partial_due'] = ['value' => Number::formatMoney($this->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')];
|
||||
$data['$total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.total')];
|
||||
$data['$total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.total')];
|
||||
$data['$quote.total'] = &$data['$total'];
|
||||
$data['$invoice.total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.invoice_total')];
|
||||
$data['$invoice.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.invoice_total')];
|
||||
$data['$invoice.amount'] = &$data['$total'];
|
||||
$data['$quote.amount'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')];
|
||||
$data['$credit.total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')];
|
||||
$data['$quote.amount'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')];
|
||||
$data['$credit.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')];
|
||||
$data['$credit.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
||||
$data['$credit.amount'] = &$data['$credit.total'];
|
||||
|
||||
$data['$balance'] = ['value' => Number::formatMoney($this->calc()->getBalance(), $this->client) ?: ' ', 'label' => ctrans('texts.balance')];
|
||||
$data['$balance'] = ['value' => Number::formatMoney($calc->getBalance(), $this->client) ?: ' ', 'label' => ctrans('texts.balance')];
|
||||
$data['$invoice.balance'] = &$data['$balance'];
|
||||
$data['$taxes'] = ['value' => Number::formatMoney($this->calc()->getItemTotalTaxes(), $this->client) ?: ' ', 'label' => ctrans('texts.taxes')];
|
||||
$data['$taxes'] = ['value' => Number::formatMoney($calc->getItemTotalTaxes(), $this->client) ?: ' ', 'label' => ctrans('texts.taxes')];
|
||||
$data['$invoice.taxes'] = &$data['$taxes'];
|
||||
|
||||
$data['$invoice.custom1'] = ['value' => $this->custom_value1 ?: ' ', 'label' => $this->makeCustomField('invoice1')];
|
||||
@ -210,7 +216,7 @@ trait MakesInvoiceValues
|
||||
$data['$quote_no'] = &$data['$quote.number'];
|
||||
$data['$quote.quote_no'] = &$data['$quote.number'];
|
||||
$data['$quote.valid_until'] = ['value' => $this->due_date, 'label' => ctrans('texts.valid_until')];
|
||||
$data['$credit_amount'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_amount')];
|
||||
$data['$credit_amount'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_amount')];
|
||||
$data['$credit_balance'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.credit_balance')];
|
||||
;
|
||||
$data['$credit_number'] = &$data['$number'];
|
||||
@ -239,7 +245,7 @@ trait MakesInvoiceValues
|
||||
$data['$website'] = ['value' => $this->client->present()->website() ?: ' ', 'label' => ctrans('texts.website')];
|
||||
$data['$phone'] = ['value' => $this->client->present()->phone() ?: ' ', 'label' => ctrans('texts.phone')];
|
||||
$data['$country'] = ['value' => isset($this->client->country->name) ? $this->client->country->name : 'No Country Set', 'label' => ctrans('texts.country')];
|
||||
$data['$email'] = ['value' => isset($this->client->primary_contact()->first()->email) ? $this->client->primary_contact()->first()->email : 'no contact email on record', 'label' => ctrans('texts.email')];
|
||||
$data['$email'] = ['value' => isset($contact) ? $contact->email : 'no contact email on record', 'label' => ctrans('texts.email')];
|
||||
$data['$client_name'] = ['value' => $this->present()->clientName() ?: ' ', 'label' => ctrans('texts.client_name')];
|
||||
$data['$client.name'] = &$data['$client_name'];
|
||||
$data['$client.address1'] = &$data['$address1'];
|
||||
@ -257,16 +263,17 @@ trait MakesInvoiceValues
|
||||
$data['$client.country'] = &$data['$country'];
|
||||
$data['$client.email'] = &$data['$email'];
|
||||
|
||||
if (!$contact) {
|
||||
$contact = $this->client->primary_contact()->first();
|
||||
}
|
||||
|
||||
$data['$contact.full_name'] = ['value' => $contact->present()->name(), 'label' => ctrans('texts.name')];
|
||||
$data['$contact.email'] = ['value' => $contact->email, 'label' => ctrans('texts.email')];
|
||||
$data['$contact.phone'] = ['value' => $contact->phone, 'label' => ctrans('texts.phone')];
|
||||
|
||||
$data['$contact_name'] =
|
||||
$data['$contact.name'] = ['value' => isset($contact) ? $contact->present()->name() : 'no contact name on record', 'label' => ctrans('texts.contact_name')];
|
||||
$data['$contact1'] = ['value' => isset($contact) ? $contact->custom_value1 : ' ', 'label' => $this->makeCustomField('contact1')];
|
||||
$data['$contact2'] = ['value' => isset($contact) ? $contact->custom_value2 : ' ', 'label' => $this->makeCustomField('contact1')];
|
||||
$data['$contact3'] = ['value' => isset($contact) ? $contact->custom_value3 : ' ', 'label' => $this->makeCustomField('contact1')];
|
||||
$data['$contact4'] = ['value' => isset($contact) ? $contact->custom_value4 : ' ', 'label' => $this->makeCustomField('contact1')];
|
||||
$data['$contact.custom1'] = ['value' => isset($contact) ? $contact->custom_value1 : ' ', 'label' => $this->makeCustomField('contact1')];
|
||||
$data['$contact.custom2'] = ['value' => isset($contact) ? $contact->custom_value2 : ' ', 'label' => $this->makeCustomField('contact1')];
|
||||
$data['$contact.custom3'] = ['value' => isset($contact) ? $contact->custom_value3 : ' ', 'label' => $this->makeCustomField('contact1')];
|
||||
$data['$contact.custom4'] = ['value' => isset($contact) ? $contact->custom_value4 : ' ', 'label' => $this->makeCustomField('contact1')];
|
||||
|
||||
$data['$company.city_state_postal'] = ['value' => $this->company->present()->cityStateZip($settings->city, $settings->state, $settings->postal_code, false) ?: ' ', 'label' => ctrans('texts.city_state_postal')];
|
||||
$data['$company.postal_city_state'] = ['value' => $this->company->present()->cityStateZip($settings->city, $settings->state, $settings->postal_code, true) ?: ' ', 'label' => ctrans('texts.postal_city_state')];
|
||||
@ -373,7 +380,7 @@ trait MakesInvoiceValues
|
||||
$table_header = '<tr>';
|
||||
|
||||
foreach ($columns as $key => $column) {
|
||||
$table_header .= '<td class="table_header_td_class">' . $key . '_label</td>';
|
||||
$table_header .= '<td class="table_header_td_class">' . $column . '_label</td>';
|
||||
}
|
||||
|
||||
$table_header .= '</tr>';
|
||||
@ -411,7 +418,7 @@ trait MakesInvoiceValues
|
||||
$table_row = '<tr>';
|
||||
|
||||
foreach ($default_columns as $key => $column) {
|
||||
$table_row .= '<td class="table_header_td_class">' . $key . '</td>';
|
||||
$table_row .= '<td class="table_header_td_class">' . $column . '</td>';
|
||||
}
|
||||
|
||||
$table_row .= '</tr>';
|
||||
|
25
resources/views/index/index.blade.php
Normal file
25
resources/views/index/index.blade.php
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Invoice Ninja</title>
|
||||
<meta name="report_errors" content="{{ $report_errors }}">
|
||||
</head>
|
||||
<body style="background-color:#888888;">
|
||||
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('/flutter_service_worker.js');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="main.dart.js" type="application/javascript"></script>
|
||||
|
||||
<center style="font-family:Tahoma,Geneva,sans-serif;font-size:28px;color:white;padding-top:100px">
|
||||
Loading...
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace Tests\Integration;
|
||||
|
||||
use App\Jobs\Invoice\MarkInvoicePaid;
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Models\Invoice;
|
||||
@ -15,7 +14,6 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @covers App\Services\Invoice\MarkInvoicePaid
|
||||
*/
|
||||
class MarkInvoicePaidTest extends TestCase
|
||||
{
|
||||
|
@ -18,8 +18,7 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\MockAccountData;
|
||||
use Tests\TestCase;
|
||||
|
||||
/** @test
|
||||
/** @covers App\Services\Ledger\LedgerService */
|
||||
/** @test*/
|
||||
|
||||
class UpdateCompanyLedgerTest extends TestCase
|
||||
{
|
||||
@ -35,7 +34,6 @@ class UpdateCompanyLedgerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @covers App\Jobs\Company\UpdateCompanyLedgerWithPayment
|
||||
*/
|
||||
public function testPaymentIsPresentInLedger()
|
||||
{
|
||||
@ -52,7 +50,6 @@ class UpdateCompanyLedgerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @covers App\Jobs\Company\UpdateCompanyLedgerWithInvoice
|
||||
*/
|
||||
public function testInvoiceIsPresentInLedger()
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class PdfVariablesTest extends TestCase
|
||||
|
||||
$this->settings = CompanySettings::defaults();
|
||||
}
|
||||
|
||||
/*
|
||||
public function testPdfVariableDefaults()
|
||||
{
|
||||
$pdf_variables = $this->settings->pdf_variables;
|
||||
@ -35,7 +35,6 @@ class PdfVariablesTest extends TestCase
|
||||
|
||||
public function testReplaceSampleHeaderText()
|
||||
{
|
||||
/* this flattens the multi dimensional array so we can do a single str_replace */
|
||||
$pdf_variables = iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($this->settings->pdf_variables)));
|
||||
|
||||
//\Log::error(print_r($pdf_variables,1));
|
||||
@ -46,4 +45,7 @@ class PdfVariablesTest extends TestCase
|
||||
|
||||
$this->assertEquals($replaced_header_text, '<tr><td>Client Name</td><td>Product</td><td>Line Total</td></tr>');
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user