1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Updates for client reports

This commit is contained in:
David Bomba 2024-04-23 12:45:43 +10:00
parent de7bd17a5e
commit 4921eadc89
6 changed files with 93 additions and 7 deletions

View File

@ -41,7 +41,6 @@ class ClientExport extends BaseExport
'balance' => 'client.balance',
'city' => 'client.city',
'country' => 'client.country_id',
'credit_balance' => 'client.credit_balance',
'custom_value1' => 'client.custom_value1',
'custom_value2' => 'client.custom_value2',
'custom_value3' => 'client.custom_value3',
@ -229,6 +228,18 @@ class ClientExport extends BaseExport
$entity['client.classification'] = ctrans("texts.{$client->classification}") ?? '';
}
if (in_array('client.industry_id', $this->input['report_keys']) && isset($client->industry_id)) {
$entity['client.industry_id'] = ctrans("texts.industry_{$client->industry->name}") ?? '';
}
if (in_array('client.country_id', $this->input['report_keys']) && isset($client->country_id)) {
$entity['client.country_id'] = $client->country->full_name;
}
if (in_array('client.shipping_country_id', $this->input['report_keys']) && isset($client->shipping_country_id)) {
$entity['client.shipping_country_id'] = $client->shipping_country->full_name;
}
return $entity;
}

View File

@ -70,7 +70,7 @@ class EmailController extends BaseController
/** @var \App\Models\User $user */
$user = auth()->user();
if ($request->cc_email && (Ninja::isSelfHost() || $user->account->isPaidHostedClient())) {
if ($request->cc_email && (Ninja::isSelfHost() || $user->account->isPremium())) {
foreach($request->cc_email as $email) {
$mo->cc[] = new Address($email);

View File

@ -251,7 +251,7 @@ return render('gateways.paypal.ppcp.card', $data);
nlog($response);
$data = [
'payment_type' => $this->getPaymentMethod($this->gateway_type_id),
'payment_type' => $this->getPaymentMethod($request->gateway_type_id),
'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
'transaction_reference' => $response['purchase_units'][0]['payments']['captures'][0]['id'],
'gateway_type_id' => $this->gateway_type_id,

View File

@ -76,7 +76,7 @@ class BankTransfer
/**
* Resolve the bank type based on the currency
*
* @return void
* @return array
*/
private function resolveBankType()
{
@ -85,6 +85,7 @@ class BankTransfer
'EUR' => ['type' => 'eu_bank_transfer', 'eu_bank_transfer' => ['country' => $this->stripe->client->country->iso_3166_2]],
'JPY' => ['type' => 'jp_bank_transfer'],
'MXN' => ['type' => 'mx_bank_transfer'],
'USD' => ['type' => 'us_bank_transfer'],
};
}
@ -133,6 +134,7 @@ class BankTransfer
'gbp' => $data['bank_details'] = $this->formatDataforUk($pi),
'eur' => $data['bank_details'] = $this->formatDataforEur($pi),
'jpy' => $data['bank_details'] = $this->formatDataforJp($pi),
'usd' => $data['bank_details'] = $this->formatDataforUs($pi),
};
$payment = $this->processSuccesfulRedirect($pi);
@ -233,6 +235,28 @@ class BankTransfer
}
/**
*
* @param PaymentIntent $pi
* @return array
*/
public function formatDataforUs(PaymentIntent $pi): array
{
return [
'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->aba->bank_name,
'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->aba->account_number,
'bank_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->aba->bank_name,
'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->aba->routing_number,
'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
'description' => $pi->description,
'gateway' => $this->stripe->company_gateway,
'currency' => $pi->next_action->display_bank_transfer_instructions->currency,
];
}
/**
* processSuccesfulRedirect
*

View File

@ -271,7 +271,8 @@ class StripePaymentDriver extends BaseDriver
(in_array($this->client->country->iso_3166_2, ['FR', 'IE', 'NL', 'DE', 'ES']) && $this->client->currency()->code == 'EUR') ||
($this->client->country->iso_3166_2 == 'JP' && $this->client->currency()->code == 'JPY') ||
($this->client->country->iso_3166_2 == 'MX' && $this->client->currency()->code == 'MXN') ||
($this->client->country->iso_3166_2 == 'GB' && $this->client->currency()->code == 'GBP')
($this->client->country->iso_3166_2 == 'GB' && $this->client->currency()->code == 'GBP') ||
($this->client->country->iso_3166_2 == 'US' && $this->client->currency()->code == 'USD')
)
) {
$types[] = GatewayType::DIRECT_DEBIT;

View File

@ -172,7 +172,7 @@
@elseif($bank_details['currency'] == 'eur')
<dt class="text-sm font-medium leading-5 text-gray-500">
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.account_name') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
@ -214,7 +214,57 @@
{{ ctrans('texts.stripe_direct_debit_details') }}
</dd>
@endif
@elseif($bank_details['currency'] == 'usd')
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.bank_name') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $bank_details['bank_name'] }}
</dd>
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.account_number') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $bank_details['account_number'] }}
</dd>
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.routing_number') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $bank_details['sort_code'] }}
</dd>
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.reference') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $bank_details['reference'] }}
</dd>
<dt class="text-sm font-medium leading-5 text-gray-500">
Network
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
ACH / Domestic Wire US
</dd>
<dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.balance_due') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $bank_details['amount'] }}
</dd>
<dt class="text-sm font-medium leading-5 text-gray-500">
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ ctrans('texts.stripe_direct_debit_details') }}
</dd>
@endif
</div>
</div>