mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Minor improvements to CSV exports
This commit is contained in:
parent
bcd9ad5478
commit
871122d1ba
@ -814,7 +814,7 @@ ORDER BY clients.id;
|
|||||||
{
|
{
|
||||||
$client = Client::withTrashed()->find($_client->id);
|
$client = Client::withTrashed()->find($_client->id);
|
||||||
|
|
||||||
$invoice_balance = $client->invoices()->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance');
|
$invoice_balance = $client->invoices()->where('is_deleted', false)->whereIn('status_id', [2,3])->sum('balance');
|
||||||
|
|
||||||
$ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
|
$ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
|
||||||
|
|
||||||
@ -850,7 +850,7 @@ ORDER BY clients.id;
|
|||||||
$this->wrong_paid_to_dates = 0;
|
$this->wrong_paid_to_dates = 0;
|
||||||
|
|
||||||
foreach (Client::where('is_deleted', 0)->where('clients.updated_at', '>', now()->subDays(2))->cursor() as $client) {
|
foreach (Client::where('is_deleted', 0)->where('clients.updated_at', '>', now()->subDays(2))->cursor() as $client) {
|
||||||
$invoice_balance = $client->invoices()->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance');
|
$invoice_balance = $client->invoices()->where('is_deleted', false)->whereIn('status_id', [2,3])->sum('balance');
|
||||||
$ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
|
$ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
|
||||||
|
|
||||||
if ($ledger && number_format($ledger->balance, 4) != number_format($client->balance, 4)) {
|
if ($ledger && number_format($ledger->balance, 4) != number_format($client->balance, 4)) {
|
||||||
|
@ -72,6 +72,12 @@ class BaseExport
|
|||||||
foreach($this->input['report_keys'] as $value){
|
foreach($this->input['report_keys'] as $value){
|
||||||
$key = array_search ($value, $this->entity_keys);
|
$key = array_search ($value, $this->entity_keys);
|
||||||
|
|
||||||
|
$key = str_replace("item.", "", $key);
|
||||||
|
$key = str_replace("invoice.", "", $key);
|
||||||
|
$key = str_replace("client.", "", $key);
|
||||||
|
$key = str_replace("contact.", "", $key);
|
||||||
|
|
||||||
|
|
||||||
$header[] = ctrans("texts.{$key}");
|
$header[] = ctrans("texts.{$key}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,46 @@ class ClientExport extends BaseExport
|
|||||||
'email' => 'contact.email',
|
'email' => 'contact.email',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'client.address1',
|
||||||
|
'client.address2',
|
||||||
|
'client.balance',
|
||||||
|
'client.city',
|
||||||
|
'client.country_id',
|
||||||
|
'client.credit_balance',
|
||||||
|
'client.custom_value1',
|
||||||
|
'client.custom_value2',
|
||||||
|
'client.custom_value3',
|
||||||
|
'client.custom_value4',
|
||||||
|
'client.id_number',
|
||||||
|
'client.industry_id',
|
||||||
|
'client.last_login',
|
||||||
|
'client.name',
|
||||||
|
'client.number',
|
||||||
|
'client.paid_to_date',
|
||||||
|
'client.phone',
|
||||||
|
'client.postal_code',
|
||||||
|
'client.private_notes',
|
||||||
|
'client.public_notes',
|
||||||
|
'client.shipping_address1',
|
||||||
|
'client.shipping_address2',
|
||||||
|
'client.shipping_city',
|
||||||
|
'client.shipping_country_id',
|
||||||
|
'client.shipping_postal_code',
|
||||||
|
'client.shipping_state',
|
||||||
|
'client.state',
|
||||||
|
'client.vat_number',
|
||||||
|
'client.website',
|
||||||
|
// 'client.currency',
|
||||||
|
'contact.first_name',
|
||||||
|
'contact.last_name',
|
||||||
|
'contact.phone',
|
||||||
|
'contact.custom_value1',
|
||||||
|
'contact.custom_value2',
|
||||||
|
'contact.custom_value3',
|
||||||
|
'contact.custom_value4',
|
||||||
|
'contact.email',
|
||||||
|
];
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'client.country_id',
|
'client.country_id',
|
||||||
'client.shipping_country_id',
|
'client.shipping_country_id',
|
||||||
@ -105,6 +145,9 @@ class ClientExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -74,6 +74,49 @@ class ContactExport extends BaseExport
|
|||||||
'email' => 'contact.email',
|
'email' => 'contact.email',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'client.address1',
|
||||||
|
'client.address2',
|
||||||
|
'client.balance',
|
||||||
|
'client.city',
|
||||||
|
'client.country_id',
|
||||||
|
'client.credit_balance',
|
||||||
|
'client.custom_value1',
|
||||||
|
'client.custom_value2',
|
||||||
|
'client.custom_value3',
|
||||||
|
'client.custom_value4',
|
||||||
|
'client.id_number',
|
||||||
|
'client.industry_id',
|
||||||
|
'client.last_login',
|
||||||
|
'client.name',
|
||||||
|
'client.number',
|
||||||
|
'client.paid_to_date',
|
||||||
|
'client.phone',
|
||||||
|
'client.postal_code',
|
||||||
|
'client.private_notes',
|
||||||
|
'client.public_notes',
|
||||||
|
'client.shipping_address1',
|
||||||
|
'client.shipping_address2',
|
||||||
|
'client.shipping_city',
|
||||||
|
'client.shipping_country_id',
|
||||||
|
'client.shipping_postal_code',
|
||||||
|
'client.shipping_state',
|
||||||
|
'client.state',
|
||||||
|
'client.vat_number',
|
||||||
|
'client.website',
|
||||||
|
'client.currency',
|
||||||
|
'contact.first_name',
|
||||||
|
'contact.last_name',
|
||||||
|
'contact.phone',
|
||||||
|
'contact.custom_value1',
|
||||||
|
'contact.custom_value2',
|
||||||
|
'contact.custom_value3',
|
||||||
|
'contact.custom_value4',
|
||||||
|
'contact.email',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'client.country_id',
|
'client.country_id',
|
||||||
'client.shipping_country_id',
|
'client.shipping_country_id',
|
||||||
@ -101,6 +144,9 @@ class ContactExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
@ -115,7 +161,6 @@ class ContactExport extends BaseExport
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return $this->csv->toString();
|
return $this->csv->toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,45 @@ class CreditExport extends BaseExport
|
|||||||
'currency' => 'currency'
|
'currency' => 'currency'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'amount',
|
||||||
|
'balance',
|
||||||
|
'client_id',
|
||||||
|
'custom_surcharge1',
|
||||||
|
'custom_surcharge2',
|
||||||
|
'custom_surcharge3',
|
||||||
|
'custom_surcharge4',
|
||||||
|
'country_id',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'date',
|
||||||
|
'discount',
|
||||||
|
'due_date',
|
||||||
|
'exchange_rate',
|
||||||
|
'footer',
|
||||||
|
'invoice_id',
|
||||||
|
'number',
|
||||||
|
'paid_to_date',
|
||||||
|
'partial',
|
||||||
|
'partial_due_date',
|
||||||
|
'po_number',
|
||||||
|
'private_notes',
|
||||||
|
'public_notes',
|
||||||
|
'status_id',
|
||||||
|
'tax_name1',
|
||||||
|
'tax_name2',
|
||||||
|
'tax_name3',
|
||||||
|
'tax_rate1',
|
||||||
|
'tax_rate2',
|
||||||
|
'tax_rate3',
|
||||||
|
'terms',
|
||||||
|
'total_taxes',
|
||||||
|
'currency'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'country',
|
'country',
|
||||||
'client',
|
'client',
|
||||||
@ -97,6 +136,9 @@ class CreditExport extends BaseExport
|
|||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
$query = Credit::query()
|
$query = Credit::query()
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->with('client')->where('company_id', $this->company->id)
|
->with('client')->where('company_id', $this->company->id)
|
||||||
|
@ -39,6 +39,14 @@ class DocumentExport extends BaseExport
|
|||||||
'created_at' => 'created_at',
|
'created_at' => 'created_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'record_type',
|
||||||
|
'record_name',
|
||||||
|
'name',
|
||||||
|
'type',
|
||||||
|
'created_at',
|
||||||
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
|
|
||||||
];
|
];
|
||||||
@ -62,6 +70,9 @@ class DocumentExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -63,6 +63,40 @@ class ExpenseExport extends BaseExport
|
|||||||
'invoice' => 'invoice_id',
|
'invoice' => 'invoice_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'amount',
|
||||||
|
'category_id',
|
||||||
|
'client_id',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'currency_id',
|
||||||
|
'date',
|
||||||
|
'exchange_rate',
|
||||||
|
'foreign_amount',
|
||||||
|
'invoice_currency_id',
|
||||||
|
'payment_date',
|
||||||
|
'number',
|
||||||
|
'payment_type_id',
|
||||||
|
'private_notes',
|
||||||
|
'project_id',
|
||||||
|
'public_notes',
|
||||||
|
'tax_amount1',
|
||||||
|
'tax_amount2',
|
||||||
|
'tax_amount3',
|
||||||
|
'tax_name1',
|
||||||
|
'tax_name2',
|
||||||
|
'tax_name3',
|
||||||
|
'tax_rate1',
|
||||||
|
'tax_rate2',
|
||||||
|
'tax_rate3',
|
||||||
|
'transaction_reference',
|
||||||
|
'vendor_id',
|
||||||
|
'invoice_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'client',
|
'client',
|
||||||
'currency',
|
'currency',
|
||||||
@ -92,6 +126,9 @@ class ExpenseExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -66,6 +66,43 @@ class InvoiceExport extends BaseExport
|
|||||||
'currency' => 'client_id'
|
'currency' => 'client_id'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'amount',
|
||||||
|
'balance',
|
||||||
|
'client_id',
|
||||||
|
'custom_surcharge1',
|
||||||
|
'custom_surcharge2',
|
||||||
|
'custom_surcharge3',
|
||||||
|
'custom_surcharge4',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'date',
|
||||||
|
'discount',
|
||||||
|
'due_date',
|
||||||
|
'exchange_rate',
|
||||||
|
'footer',
|
||||||
|
'number',
|
||||||
|
'paid_to_date',
|
||||||
|
'partial',
|
||||||
|
'partial_due_date',
|
||||||
|
'po_number',
|
||||||
|
'private_notes',
|
||||||
|
'public_notes',
|
||||||
|
'status_id',
|
||||||
|
'tax_name1',
|
||||||
|
'tax_name2',
|
||||||
|
'tax_name3',
|
||||||
|
'tax_rate1',
|
||||||
|
'tax_rate2',
|
||||||
|
'tax_rate3',
|
||||||
|
'terms',
|
||||||
|
'total_taxes',
|
||||||
|
'client_id'
|
||||||
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'country',
|
'country',
|
||||||
'client',
|
'client',
|
||||||
@ -92,6 +129,9 @@ class InvoiceExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -85,6 +85,61 @@ class InvoiceItemExport extends BaseExport
|
|||||||
'invoice4' => 'item.custom_value4',
|
'invoice4' => 'item.custom_value4',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'amount',
|
||||||
|
'balance',
|
||||||
|
'client_id',
|
||||||
|
'custom_surcharge1',
|
||||||
|
'custom_surcharge2',
|
||||||
|
'custom_surcharge3',
|
||||||
|
'custom_surcharge4',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'date',
|
||||||
|
'discount',
|
||||||
|
'due_date',
|
||||||
|
'exchange_rate',
|
||||||
|
'footer',
|
||||||
|
'number',
|
||||||
|
'paid_to_date',
|
||||||
|
'partial',
|
||||||
|
'partial_due_date',
|
||||||
|
'po_number',
|
||||||
|
'private_notes',
|
||||||
|
'public_notes',
|
||||||
|
'status_id',
|
||||||
|
'tax_name1',
|
||||||
|
'tax_name2',
|
||||||
|
'tax_name3',
|
||||||
|
'tax_rate1',
|
||||||
|
'tax_rate2',
|
||||||
|
'tax_rate3',
|
||||||
|
'terms',
|
||||||
|
'total_taxes',
|
||||||
|
// 'currency_id',
|
||||||
|
'item.quantity',
|
||||||
|
'item.cost',
|
||||||
|
'item.product_key',
|
||||||
|
'item.product_cost',
|
||||||
|
'item.notes',
|
||||||
|
'item.discount',
|
||||||
|
'item.is_amount_discount',
|
||||||
|
'item.tax_rate1',
|
||||||
|
'item.tax_rate2',
|
||||||
|
'item.tax_rate3',
|
||||||
|
'item.tax_name1',
|
||||||
|
'item.tax_name2',
|
||||||
|
'item.tax_name3',
|
||||||
|
'item.line_total',
|
||||||
|
'item.gross_line_total',
|
||||||
|
'item.custom_value1',
|
||||||
|
'item.custom_value2',
|
||||||
|
'item.custom_value3',
|
||||||
|
'item.custom_value4',
|
||||||
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'client',
|
'client',
|
||||||
'currency',
|
'currency',
|
||||||
@ -109,6 +164,9 @@ class InvoiceItemExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = ksort($this->all_keys);
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -54,6 +54,28 @@ class PaymentExport extends BaseExport
|
|||||||
'vendor' => 'vendor_id',
|
'vendor' => 'vendor_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'amount',
|
||||||
|
'applied',
|
||||||
|
'client_id',
|
||||||
|
'currency_id',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'date',
|
||||||
|
'exchange_currency_id',
|
||||||
|
'gateway_type_id',
|
||||||
|
'number',
|
||||||
|
'private_notes',
|
||||||
|
'project_id',
|
||||||
|
'refunded',
|
||||||
|
'status_id',
|
||||||
|
'transaction_reference',
|
||||||
|
'type_id',
|
||||||
|
'vendor_id',
|
||||||
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'vendor',
|
'vendor',
|
||||||
'status',
|
'status',
|
||||||
@ -83,6 +105,9 @@ class PaymentExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -52,6 +52,26 @@ class ProductExport extends BaseExport
|
|||||||
'tax_name3' => 'tax_name3',
|
'tax_name3' => 'tax_name3',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'project_id',
|
||||||
|
'vendor_id',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'product_key',
|
||||||
|
'notes',
|
||||||
|
'cost',
|
||||||
|
'price',
|
||||||
|
'quantity',
|
||||||
|
'tax_rate1',
|
||||||
|
'tax_rate2',
|
||||||
|
'tax_rate3',
|
||||||
|
'tax_name1',
|
||||||
|
'tax_name2',
|
||||||
|
'tax_name3',
|
||||||
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'vendor',
|
'vendor',
|
||||||
'project',
|
'project',
|
||||||
@ -76,6 +96,9 @@ class ProductExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -67,6 +67,44 @@ class QuoteExport extends BaseExport
|
|||||||
'invoice' => 'invoice_id',
|
'invoice' => 'invoice_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'amount',
|
||||||
|
'balance',
|
||||||
|
'client_id',
|
||||||
|
'custom_surcharge1',
|
||||||
|
'custom_surcharge2',
|
||||||
|
'custom_surcharge3',
|
||||||
|
'custom_surcharge4',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'date',
|
||||||
|
'discount',
|
||||||
|
'due_date',
|
||||||
|
'exchange_rate',
|
||||||
|
'footer',
|
||||||
|
'number',
|
||||||
|
'paid_to_date',
|
||||||
|
'partial',
|
||||||
|
'partial_due_date',
|
||||||
|
'po_number',
|
||||||
|
'private_notes',
|
||||||
|
'public_notes',
|
||||||
|
'status_id',
|
||||||
|
'tax_name1',
|
||||||
|
'tax_name2',
|
||||||
|
'tax_name3',
|
||||||
|
'tax_rate1',
|
||||||
|
'tax_rate2',
|
||||||
|
'tax_rate3',
|
||||||
|
'terms',
|
||||||
|
'total_taxes',
|
||||||
|
'client_id',
|
||||||
|
'invoice_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'client',
|
'client',
|
||||||
'currency',
|
'currency',
|
||||||
@ -92,6 +130,9 @@ class QuoteExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -85,6 +85,61 @@ class QuoteItemExport extends BaseExport
|
|||||||
'invoice4' => 'item.custom_value4',
|
'invoice4' => 'item.custom_value4',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'amount',
|
||||||
|
'balance',
|
||||||
|
'client_id',
|
||||||
|
'custom_surcharge1',
|
||||||
|
'custom_surcharge2',
|
||||||
|
'custom_surcharge3',
|
||||||
|
'custom_surcharge4',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'date',
|
||||||
|
'discount',
|
||||||
|
'due_date',
|
||||||
|
'exchange_rate',
|
||||||
|
'footer',
|
||||||
|
'number',
|
||||||
|
'paid_to_date',
|
||||||
|
'partial',
|
||||||
|
'partial_due_date',
|
||||||
|
'po_number',
|
||||||
|
'private_notes',
|
||||||
|
'public_notes',
|
||||||
|
'status_id',
|
||||||
|
'tax_name1',
|
||||||
|
'tax_name2',
|
||||||
|
'tax_name3',
|
||||||
|
'tax_rate1',
|
||||||
|
'tax_rate2',
|
||||||
|
'tax_rate3',
|
||||||
|
'terms',
|
||||||
|
'total_taxes',
|
||||||
|
'currency_id',
|
||||||
|
'item.quantity',
|
||||||
|
'item.cost',
|
||||||
|
'item.product_key',
|
||||||
|
'item.product_cost',
|
||||||
|
'item.notes',
|
||||||
|
'item.discount',
|
||||||
|
'item.is_amount_discount',
|
||||||
|
'item.tax_rate1',
|
||||||
|
'item.tax_rate2',
|
||||||
|
'item.tax_rate3',
|
||||||
|
'item.tax_name1',
|
||||||
|
'item.tax_name2',
|
||||||
|
'item.tax_name3',
|
||||||
|
'item.line_total',
|
||||||
|
'item.gross_line_total',
|
||||||
|
'item.custom_value1',
|
||||||
|
'item.custom_value2',
|
||||||
|
'item.custom_value3',
|
||||||
|
'item.custom_value4',
|
||||||
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'client',
|
'client',
|
||||||
'currency',
|
'currency',
|
||||||
@ -109,6 +164,9 @@ class QuoteItemExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -68,6 +68,44 @@ class RecurringInvoiceExport extends BaseExport
|
|||||||
'project' => 'project_id',
|
'project' => 'project_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'amount',
|
||||||
|
'balance',
|
||||||
|
'client_id',
|
||||||
|
'custom_surcharge1',
|
||||||
|
'custom_surcharge2',
|
||||||
|
'custom_surcharge3',
|
||||||
|
'custom_surcharge4',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'date',
|
||||||
|
'discount',
|
||||||
|
'due_date',
|
||||||
|
'exchange_rate',
|
||||||
|
'footer',
|
||||||
|
'number',
|
||||||
|
'paid_to_date',
|
||||||
|
'partial',
|
||||||
|
'partial_due_date',
|
||||||
|
'po_number',
|
||||||
|
'private_notes',
|
||||||
|
'public_notes',
|
||||||
|
'status_id',
|
||||||
|
'tax_name1',
|
||||||
|
'tax_name2',
|
||||||
|
'tax_name3',
|
||||||
|
'tax_rate1',
|
||||||
|
'tax_rate2',
|
||||||
|
'tax_rate3',
|
||||||
|
'terms',
|
||||||
|
'total_taxes',
|
||||||
|
'client_id',
|
||||||
|
'vendor_id',
|
||||||
|
'project_id',
|
||||||
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'country',
|
'country',
|
||||||
'client',
|
'client',
|
||||||
@ -96,6 +134,9 @@ class RecurringInvoiceExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -52,6 +52,23 @@ class TaskExport extends BaseExport
|
|||||||
'client' => 'client_id',
|
'client' => 'client_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected array $all_keys = [
|
||||||
|
'start_date',
|
||||||
|
'end_date',
|
||||||
|
'duration',
|
||||||
|
'rate',
|
||||||
|
'number',
|
||||||
|
'description',
|
||||||
|
'custom_value1',
|
||||||
|
'custom_value2',
|
||||||
|
'custom_value3',
|
||||||
|
'custom_value4',
|
||||||
|
'status_id',
|
||||||
|
'project_id',
|
||||||
|
'invoice_id',
|
||||||
|
'client_id',
|
||||||
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
'status',
|
'status',
|
||||||
'project',
|
'project',
|
||||||
@ -83,6 +100,10 @@ class TaskExport extends BaseExport
|
|||||||
//load the CSV document from a string
|
//load the CSV document from a string
|
||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
|
|
||||||
|
if(count($this->input['report_keys']) == 0)
|
||||||
|
$this->input['report_keys'] = $this->all_keys;
|
||||||
|
|
||||||
//insert the header
|
//insert the header
|
||||||
$this->csv->insertOne($this->buildHeader());
|
$this->csv->insertOne($this->buildHeader());
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
|
|
||||||
class Csv extends BaseImport implements ImportInterface
|
class Csv extends BaseImport implements ImportInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
public array $entity_count = [];
|
public array $entity_count = [];
|
||||||
|
|
||||||
public function import(string $entity)
|
public function import(string $entity)
|
||||||
|
@ -69,6 +69,8 @@ class CSVIngest implements ShouldQueue {
|
|||||||
|
|
||||||
MultiDB::setDb( $this->company->db );
|
MultiDB::setDb( $this->company->db );
|
||||||
|
|
||||||
|
set_time_limit(0);
|
||||||
|
|
||||||
$engine = $this->bootEngine($this->import_type);
|
$engine = $this->bootEngine($this->import_type);
|
||||||
|
|
||||||
foreach ( [ 'client', 'product', 'invoice', 'payment', 'vendor', 'expense' ] as $entity ) {
|
foreach ( [ 'client', 'product', 'invoice', 'payment', 'vendor', 'expense' ] as $entity ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user