From 0f954ba6a1542e33b75eaa33f6c13846f98c6ebd Mon Sep 17 00:00:00 2001 From: Babak Alizadeh Date: Wed, 20 Aug 2025 16:56:14 +0000 Subject: [PATCH] bug fix in hesabdariDoc and buy list invoices --- .../src/Controller/HesabdariDocController.php | 17 +++---- webUI/src/views/acc/buy/list.vue | 50 +++++++++---------- webUI/src/views/acc/rfsell/list.vue | 0 3 files changed, 31 insertions(+), 36 deletions(-) mode change 100755 => 100644 webUI/src/views/acc/rfsell/list.vue diff --git a/hesabixCore/src/Controller/HesabdariDocController.php b/hesabixCore/src/Controller/HesabdariDocController.php index 048477f..109b81e 100644 --- a/hesabixCore/src/Controller/HesabdariDocController.php +++ b/hesabixCore/src/Controller/HesabdariDocController.php @@ -7,6 +7,7 @@ use App\Entity\HesabdariRow; use App\Entity\HesabdariTable; use App\Service\Access; use App\Service\Extractor; +use App\Service\Provider; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; @@ -19,12 +20,14 @@ class HesabdariDocController extends AbstractController private $em; private $access; private $extractor; + private $provider; - public function __construct(EntityManagerInterface $em, Access $access, Extractor $extractor) + public function __construct(EntityManagerInterface $em, Access $access, Extractor $extractor, Provider $provider) { $this->em = $em; $this->access = $access; $this->extractor = $extractor; + $this->provider = $provider; } #[Route('/hesabdari/tables', name: 'get_hesabdari_tables', methods: ['GET'])] @@ -103,7 +106,7 @@ class HesabdariDocController extends AbstractController $doc->setDate($data['date']); $doc->setDateSubmit((string) time()); $doc->setType('doc'); - $doc->setCode($this->generateDocCode($accessData['bid'])); + $doc->setCode($this->provider->getAccountingCode($accessData['bid'], 'accounting')); $totalBd = 0; $totalBs = 0; @@ -190,13 +193,5 @@ class HesabdariDocController extends AbstractController return new JsonResponse($this->extractor->operationSuccess(['id' => $doc->getId()], 'سند با موفقیت ویرایش شد')); } - private function generateDocCode($business): string - { - $lastDoc = $this->em->getRepository(HesabdariDoc::class)->findOneBy( - ['bid' => $business], - ['code' => 'DESC'] - ); - $newCode = $lastDoc ? ((int) $lastDoc->getCode() + 1) : 1; - return (string) $newCode; - } + } \ No newline at end of file diff --git a/webUI/src/views/acc/buy/list.vue b/webUI/src/views/acc/buy/list.vue index be2cf87..0d7d585 100755 --- a/webUI/src/views/acc/buy/list.vue +++ b/webUI/src/views/acc/buy/list.vue @@ -273,31 +273,31 @@ export default defineComponent({ data() { return { currentTab: 'approved', - printModal: false, - printOptions: { - pays: true, - note: true, - bidInfo: true, - taxInfo: true, - discountInfo: true, - selectedPrintCode: 0, - paper: 'A4-L' - }, - paperSizes: [ - { title: 'A4 عمودی', value: 'A4' }, - { title: 'A4 افقی', value: 'A4-L' }, - { title: 'A5 عمودی', value: 'A5' }, - { title: 'A5 افقی', value: 'A5-L' }, - ], + printModal: false, + printOptions: { + pays: true, + note: true, + bidInfo: true, + taxInfo: true, + discountInfo: true, + selectedPrintCode: 0, + paper: 'A4-L' + }, + paperSizes: [ + { title: 'A4 عمودی', value: 'A4' }, + { title: 'A4 افقی', value: 'A4-L' }, + { title: 'A5 عمودی', value: 'A5' }, + { title: 'A5 افقی', value: 'A5-L' }, + ], business: { requireTwoStepApproval: false, approvers: { buyInvoice: null } }, currentUser: { email: '', owner: false }, - sumSelected: 0, - sumTotal: 0, - itemsSelected: [], - searchValue: '', - types: [], + sumSelected: 0, + sumTotal: 0, + itemsSelected: [], + searchValue: '', + types: [], loading: false, - items: [], + items: [], itemsApproved: [], itemsPending: [], total: 0, @@ -731,9 +731,9 @@ export default defineComponent({ const item = this.items.find(item => item.code === code); if (item && item.amount) { if (typeof item.amount === "string") { - this.sumSelected += parseInt(item.amount.replaceAll(",", "")); - } else { - this.sumSelected += item.amount; + this.sumSelected += parseInt(item.amount.replaceAll(",", "")); + } else { + this.sumSelected += item.amount; } } } diff --git a/webUI/src/views/acc/rfsell/list.vue b/webUI/src/views/acc/rfsell/list.vue old mode 100755 new mode 100644