Skip to content

Commit 8388f33

Browse files
committedJan 9, 2025·
ledger account feature removed
1 parent 7d62b41 commit 8388f33

File tree

12 files changed

+55
-367
lines changed

12 files changed

+55
-367
lines changed
 

‎Modules/Client/Entities/Client.php

-27
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Modules\Client\Entities\Scopes\ClientGlobalScope;
1111
use Modules\Client\Entities\Traits\HasHierarchy;
1212
use Modules\Invoice\Entities\Invoice;
13-
use Modules\Invoice\Entities\LedgerAccount;
1413
use Modules\Invoice\Services\InvoiceService;
1514
use Modules\Project\Entities\Project;
1615
use Modules\Prospect\Entities\Prospect;
@@ -352,32 +351,6 @@ public function getBccEmailsAttribute()
352351
return substr_replace($bccEmails, '', -1);
353352
}
354353

355-
public function ledgerAccounts()
356-
{
357-
return $this->hasMany(LedgerAccount::class);
358-
}
359-
360-
public function ledgerAccountsOnlyCredit()
361-
{
362-
return $this->hasMany(LedgerAccount::class)->whereNotNull('credit');
363-
}
364-
365-
public function ledgerAccountsOnlyDebit()
366-
{
367-
return $this->hasMany(LedgerAccount::class)->whereNotNull('debit');
368-
}
369-
370-
public function getClientProjectsTotalLedgerAmount($quarter = null)
371-
{
372-
$amount = 0;
373-
374-
foreach ($this->clientLevelBillingProjects as $project) {
375-
$amount += $project->getTotalLedgerAmount($quarter);
376-
}
377-
378-
return $amount;
379-
}
380-
381354
public function getResourceBasedTotalAmount()
382355
{
383356
$amount = 0;

‎Modules/Invoice/Entities/LedgerAccount.php

-39
This file was deleted.

‎Modules/Invoice/Http/Controllers/InvoiceController.php

-14
Original file line numberDiff line numberDiff line change
@@ -203,20 +203,6 @@ public function yearlyInvoiceReportExport(Request $request)
203203
return $this->service->yearlyInvoiceReportExport($filters, $request);
204204
}
205205

206-
public function ledgerAccountsIndex(Request $request)
207-
{
208-
$data = $this->service->getLedgerAccountData($request->all());
209-
210-
return view('invoice::ledger-accounts.index')->with($data);
211-
}
212-
213-
public function storeLedgerAccountData(Request $request)
214-
{
215-
$this->service->storeLedgerAccountData($request->all());
216-
217-
return redirect()->back()->with('status', 'Data saved successfully.');
218-
}
219-
220206
public function createCustomInvoice()
221207
{
222208
return view('invoice::create-custom-invoice', $this->service->create());

‎Modules/Invoice/Resources/views/index.blade.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class="ml-2"
151151
@endif
152152
</a>
153153
</td>
154-
154+
155155
<td class="text-center">
156156
{{ $invoice->sent_on->format(config('invoice.default-date-format')) }}</td>
157157
<td
@@ -196,7 +196,7 @@ class="{{ $invoice->shouldHighlighted() ? 'font-weight-bold text-danger' : '' }}
196196
$index++;
197197
$currencySymbol = config('constants.currency.' . $client->currency . '.symbol');
198198
if ($client->hasCustomInvoiceTemplate()) {
199-
$amount = $currencySymbol . ($client->getResourceBasedTotalAmount() + $client->getClientProjectsTotalLedgerAmount($quarter));
199+
$amount = $currencySymbol . ($client->getResourceBasedTotalAmount());
200200
} else {
201201
$amount = $currencySymbol . $client->getTotalPayableAmountForTerm($monthToSubtract, $client->clientLevelBillingProjects);
202202
}
@@ -284,11 +284,9 @@ class="{{ $invoice->shouldHighlighted() ? 'font-weight-bold text-danger' : '' }}
284284
@endif
285285
@php
286286
$index++;
287-
287+
288288
$currencySymbol = config('constants.currency.' . $project->client->currency . '.symbol');
289-
if ($project->hasCustomInvoiceTemplate()) {
290-
$amount = $currencySymbol . $project->getTotalLedgerAmount($quarter);
291-
} elseif (optional($project->client->billingDetails)->service_rate_term == config('client.service-rate-terms.per_resource.slug')) {
289+
if (optional($project->client->billingDetails)->service_rate_term == config('client.service-rate-terms.per_resource.slug')) {
292290
$amount = $currencySymbol . $project->getResourceBillableAmount();
293291
} else {
294292
$amount = $currencySymbol . $project->getTotalPayableAmountForTerm($monthToSubtract);
@@ -414,7 +412,7 @@ class="{{ $invoice->shouldHighlighted() ? 'font-weight-bold text-danger' : '' }}
414412
{{ config('constants.finance.scheduled-invoice.status.' . $invoice->currentStatus. '.title') }}
415413
</div>
416414
</td>
417-
</tr>
415+
</tr>
418416
@endforeach
419417
@else
420418
<tr>
@@ -423,7 +421,7 @@ class="{{ $invoice->shouldHighlighted() ? 'font-weight-bold text-danger' : '' }}
423421
@endif
424422
</tbody>
425423
</table>
426-
424+
427425
@endif
428426
</div>
429427
@if (request()->invoice_status == 'ready' || $invoiceStatus == 'ready')

‎Modules/Invoice/Resources/views/ledger-accounts/index.blade.php

-151
This file was deleted.

‎Modules/Invoice/Resources/views/render/custom-invoice-template-1.blade.php

+7-31
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
border-collapse: collapse;
6565
}
6666
.table-padding {
67-
padding-left: 7%;
67+
padding-left: 7%;
6868
padding-right: 7%;
6969
}
7070
.fz-14 {
@@ -154,7 +154,7 @@
154154
</div>
155155
</td>
156156
<td>
157-
{{ $client->country->currency_symbol . ($project->getResourceBillableAmount() + $project->getTotalLedgerAmount($quarter)) }}
157+
{{ $client->country->currency_symbol . ($project->getResourceBillableAmount()) }}
158158
</td>
159159
</tr>
160160
<tr></tr>
@@ -173,7 +173,7 @@
173173
</div>
174174
</td>
175175
<td>
176-
{{ $client->country->currency_symbol . ($client->getResourceBasedTotalAmount() + $client->getClientProjectsTotalLedgerAmount($quarter)) }}
176+
{{ $client->country->currency_symbol . ($client->getResourceBasedTotalAmount()) }}
177177
</td>
178178
</tr>
179179
<tr>
@@ -188,7 +188,7 @@
188188
<tr>
189189
<td class="font-weight-bold">
190190
<div class="font-weight-bold fz-14">
191-
{{ '(' . strtoupper(App\Helpers\DecimalToWordsHelper::convertDecimalToWords(($client->getResourceBasedTotalAmount() + $client->getClientProjectsTotalLedgerAmount($quarter)), config('constants.currency.' . $client->country->currency . '.name'))) . ')' }}
191+
{{ '(' . strtoupper(App\Helpers\DecimalToWordsHelper::convertDecimalToWords($client->getResourceBasedTotalAmount(), config('constants.currency.' . $client->country->currency . '.name'))) . ')' }}
192192
</div>
193193
</td>
194194
</tr>
@@ -251,49 +251,25 @@
251251
</td>
252252
</tr>
253253
@endforeach
254-
@foreach ($projects as $project)
255-
@foreach ($project->ledgerAccountsOnlyCredit()->quarter($quarter)->get() as $ledgerAccountRow )
256-
<tr>
257-
<td class="p-5 w-70p">
258-
{{ $ledgerAccountRow->particulars }}
259-
</td>
260-
<td class="p-5 text-right">
261-
{{ $client->country->currency_symbol . $ledgerAccountRow->credit }}
262-
</td>
263-
</tr>
264-
@endforeach
265-
@endforeach
266254
<tr class="font-weight-bold">
267255
<td class="p-5 w-70p">
268256
{{ __('Total: ') }}
269257
</td>
270258
<td class="p-5 text-right">
271-
{{ $client->country->currency_symbol . ($client->getResourceBasedTotalAmount() + $client->ledgerAccountsOnlyCredit->sum('credit')) }}
259+
{{ $client->country->currency_symbol . ($client->getResourceBasedTotalAmount()) }}
272260
</td>
273261
</tr>
274-
@foreach ($projects as $project)
275-
@foreach ($project->ledgerAccountsOnlyDebit()->quarter($quarter)->get() as $ledgerAccountRow)
276-
<tr>
277-
<td class="p-5 w-70p">
278-
{{ $ledgerAccountRow->particulars }}
279-
</td>
280-
<td class="p-5 text-right">
281-
{{ __('-') . $client->country->currency_symbol . $ledgerAccountRow->debit }}
282-
</td>
283-
</tr>
284-
@endforeach
285-
@endforeach
286262
<tr class="font-weight-bold">
287263
<td class="p-5 w-70p">
288264
{{ __('Balance: ') }}
289265
</td>
290266
<td class="p-5 text-right">
291-
{{ $client->country->currency_symbol . ($client->getResourceBasedTotalAmount() + $client->getClientProjectsTotalLedgerAmount($quarter)) }}
267+
{{ $client->country->currency_symbol . ($client->getResourceBasedTotalAmount()) }}
292268
</td>
293269
</tr>
294270
</tbody>
295271
</table>
296272
</div>
297273
</div>
298274
</body>
299-
</html>
275+
</html>

0 commit comments

Comments
 (0)
Please sign in to comment.