|
20 | 20 | use Modules\Invoice\Emails\SendPaymentReceivedMail;
|
21 | 21 | use Modules\Invoice\Emails\SendPendingInvoiceMail;
|
22 | 22 | use Modules\Invoice\Entities\Invoice;
|
23 |
| -use Modules\Invoice\Entities\LedgerAccount; |
24 | 23 | use Modules\Invoice\Exports\MonthlyGSTTaxReportExport;
|
25 | 24 | use Modules\Invoice\Exports\TaxReportExport;
|
26 | 25 | use Modules\Invoice\Exports\YearlyInvoiceReportExport;
|
@@ -629,14 +628,14 @@ public function createInvoice($client, $project, $term, $periodStartDate, $perio
|
629 | 628 |
|
630 | 629 | if ($project) {
|
631 | 630 | if (optional($project->client->billingDetails)->service_rate_term == config('client.service-rate-terms.per_resource.slug')) {
|
632 |
| - $amount = $project->getResourceBillableAmount() + $project->getTotalLedgerAmount(); |
| 631 | + $amount = $project->getResourceBillableAmount(); |
633 | 632 | } else {
|
634 | 633 | $amount = $project->getBillableAmountForTerm($monthsToSubtract, $periodStartDate, $periodEndDate) + optional($project->client->billingDetails)->bank_charges;
|
635 | 634 | $gst = $project->getTaxAmountForTerm($monthsToSubtract, $periodStartDate, $periodEndDate);
|
636 | 635 | }
|
637 | 636 | } else {
|
638 | 637 | if (optional($client->billingDetails)->service_rate_term == config('client.service-rate-terms.per_resource.slug')) {
|
639 |
| - $amount = $client->getResourceBasedTotalAmount() + $client->getClientProjectsTotalLedgerAmount(); |
| 638 | + $amount = $client->getResourceBasedTotalAmount(); |
640 | 639 | } else {
|
641 | 640 | $amount = $client->getBillableAmountForTerm($monthsToSubtract, $client->clientLevelBillingProjects, $periodStartDate, $periodEndDate) + optional($client->billingDetails)->bank_charges;
|
642 | 641 | $gst = $client->getTaxAmountForTerm($monthsToSubtract, $client->clientLevelBillingProjects, $periodStartDate, $periodEndDate);
|
@@ -734,50 +733,6 @@ public function clientCurrency($clientId)
|
734 | 733 | return Client::find($clientId, 'id')->currency;
|
735 | 734 | }
|
736 | 735 |
|
737 |
| - public function getLedgerAccountData(array $data) |
738 |
| - { |
739 |
| - $clients = Client::with('projects')->orderBy('name')->get(); |
740 |
| - $client = Client::find($data['client_id'] ?? null); |
741 |
| - $project = Project::find($data['project_id'] ?? null); |
742 |
| - |
743 |
| - return [ |
744 |
| - 'clients' => $clients, |
745 |
| - 'client' => $client, |
746 |
| - 'project' => $project, |
747 |
| - 'ledgerAccountData' => $project ? $project->ledgerAccounts->toArray() : ($client ? $client->ledgerAccounts->toArray() : []), |
748 |
| - ]; |
749 |
| - } |
750 |
| - |
751 |
| - public function storeLedgerAccountData(array $data) |
752 |
| - { |
753 |
| - $project = Project::find($data['project_id'] ?? null); |
754 |
| - $client = Client::find($data['client_id'] ?? null); |
755 |
| - |
756 |
| - if (! $client) { |
757 |
| - return; |
758 |
| - } |
759 |
| - |
760 |
| - if ($project) { |
761 |
| - $ledgerAccountsIdToDelete = LedgerAccount::where('project_id', $project->id)->pluck('id')->toArray(); |
762 |
| - } else { |
763 |
| - $ledgerAccountsIdToDelete = LedgerAccount::where('client_id', $client->id)->pluck('id')->toArray(); |
764 |
| - } |
765 |
| - |
766 |
| - foreach ($data['ledger_account_data'] as $ledgerAccountData) { |
767 |
| - if ($ledgerAccountData['id'] == null) { |
768 |
| - LedgerAccount::create($ledgerAccountData); |
769 |
| - continue; |
770 |
| - } |
771 |
| - |
772 |
| - $ledgerAccount = LedgerAccount::find($ledgerAccountData['id']); |
773 |
| - $ledgerAccount->update($ledgerAccountData); |
774 |
| - $index = array_search($ledgerAccount->id, $ledgerAccountsIdToDelete); |
775 |
| - unset($ledgerAccountsIdToDelete[$index]); |
776 |
| - } |
777 |
| - |
778 |
| - LedgerAccount::destroy($ledgerAccountsIdToDelete); |
779 |
| - } |
780 |
| - |
781 | 736 | public function updateScheduledInvoice($invoice)
|
782 | 737 | {
|
783 | 738 | $project = $invoice->project;
|
|
0 commit comments