From 60507c462680a0863cffd6e08809f3391ecd145f Mon Sep 17 00:00:00 2001 From: Babak Alizadeh Date: Thu, 22 May 2025 08:06:42 +0000 Subject: [PATCH] progress in ghesta submit docs --- .../src/Controller/HesabdariController.php | 28 ++++- webUI/src/views/acc/plugins/ghesta/view.vue | 4 +- .../src/views/acc/storeroom/io/ticketList.vue | 116 ++++++++++++++++-- 3 files changed, 138 insertions(+), 10 deletions(-) diff --git a/hesabixCore/src/Controller/HesabdariController.php b/hesabixCore/src/Controller/HesabdariController.php index a9fb44a..8d08bb9 100644 --- a/hesabixCore/src/Controller/HesabdariController.php +++ b/hesabixCore/src/Controller/HesabdariController.php @@ -14,6 +14,8 @@ use App\Entity\Log as EntityLog; use App\Entity\Money; use App\Entity\PayInfoTemp; use App\Entity\Person; +use App\Entity\PlugGhestaDoc; +use App\Entity\PlugGhestaItem; use App\Entity\PlugNoghreOrder; use App\Entity\Salary; use App\Entity\StoreroomTicket; @@ -471,6 +473,21 @@ class HesabdariController extends AbstractController } $doc->setAmount($amount); $entityManager->persist($doc); + + //check ghesta + if (array_key_exists('ghestaId', $params)) { + $ghesta = $entityManager->getRepository(PlugGhestaDoc::class)->find($params['ghestaId']); + if ($ghesta) { + $ghestaItem = $entityManager->getRepository(PlugGhestaItem::class)->findOneBy([ + 'doc' => $ghesta, + 'num' => $params['ghestaNum'] + ]); + if ($ghestaItem) { + $ghestaItem->setHesabdariDoc($doc); + $entityManager->persist($ghestaItem); + } + } + } $entityManager->flush(); $log->insert( 'حسابداری', @@ -583,6 +600,13 @@ class HesabdariController extends AbstractController foreach ($doc->getNotes() as $note) { $entityManager->remove($note); } + + //check ghesta items + $ghestaItems = $entityManager->getRepository(PlugGhestaItem::class)->findBy(['hesabdariDoc' => $doc]); + foreach ($ghestaItems as $ghestaItem) { + $ghestaItem->setHesabdariDoc(null); + $entityManager->persist($ghestaItem); + } $entityManager->remove($doc); $entityManager->flush(); $log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid')); @@ -819,13 +843,13 @@ class HesabdariController extends AbstractController if ($this->hasChild($entityManager, $node)) { $temp[$node->getCode()] = [ 'text' => $node->getName(), - 'id' => $node->getCode(), + 'id' => $node->getCode() ?? $node->getId(), 'children' => $this->getFilteredChildsLabel($entityManager, $node, $business), ]; } else { $temp[$node->getCode()] = [ 'text' => $node->getName(), - 'id' => $node->getCode(), + 'id' => $node->getCode() ?? $node->getId(), ]; } $temp[$node->getCode()]['is_public'] = $nodeBid === null; diff --git a/webUI/src/views/acc/plugins/ghesta/view.vue b/webUI/src/views/acc/plugins/ghesta/view.vue index 5bbf960..e42cf55 100644 --- a/webUI/src/views/acc/plugins/ghesta/view.vue +++ b/webUI/src/views/acc/plugins/ghesta/view.vue @@ -616,7 +616,9 @@ export default { type: 'sell_receive', update: null, rows, - related: this.invoice.code + related: this.invoice.code, + ghestaId: this.$route.params.id, + ghestaNum: this.selectedItem.num, }) if (response.data.result === 1) { diff --git a/webUI/src/views/acc/storeroom/io/ticketList.vue b/webUI/src/views/acc/storeroom/io/ticketList.vue index d441934..45aec1f 100644 --- a/webUI/src/views/acc/storeroom/io/ticketList.vue +++ b/webUI/src/views/acc/storeroom/io/ticketList.vue @@ -38,6 +38,14 @@ mdi-file-import حواله‌های ورود + + mdi-swap-horizontal + حواله‌های انتقال + + + mdi-delete-empty + ضایعات + @@ -122,6 +130,88 @@ + + + + + + + + + + + + + + + + + + @@ -197,15 +287,19 @@ interface Header { const loading = ref(false); const inputItems = ref([]); const outputItems = ref([]); +const transferItems = ref([]); +const wasteItems = ref([]); const inputSearchValue = ref(''); const outputSearchValue = ref(''); +const transferSearchValue = ref(''); +const wasteSearchValue = ref(''); const activeTab = ref('output'); const showColumnDialog = ref(false); // دیالوگ‌ها const deleteDialog = ref({ show: false, - type: null as 'input' | 'output' | null, + type: null as 'input' | 'output' | 'transfer' | 'waste' | null, code: null as string | null }); @@ -267,13 +361,17 @@ const formatNumber = (value: string | number) => { const loadData = async () => { loading.value = true; try { - const [inputResponse, outputResponse] = await Promise.all([ + const [inputResponse, outputResponse, transferResponse, wasteResponse] = await Promise.all([ axios.post('/api/storeroom/tickets/list/input'), - axios.post('/api/storeroom/tickets/list/output') + axios.post('/api/storeroom/tickets/list/output'), + axios.post('/api/storeroom/tickets/list/transfer'), + axios.post('/api/storeroom/tickets/list/waste') ]); inputItems.value = inputResponse.data; outputItems.value = outputResponse.data; - } catch (error) { + transferItems.value = transferResponse.data; + wasteItems.value = wasteResponse.data; + } catch (error: any) { console.error('Error loading data:', error); snackbar.value = { show: true, @@ -286,7 +384,7 @@ const loadData = async () => { }; // حذف حواله -const deleteTicket = (type: 'input' | 'output', code: string) => { +const deleteTicket = (type: 'input' | 'output' | 'transfer' | 'waste', code: string) => { deleteDialog.value = { show: true, type, @@ -307,8 +405,12 @@ const confirmDelete = async () => { if (type === 'input') { inputItems.value = inputItems.value.filter(item => item.code !== code); - } else { + } else if (type === 'output') { outputItems.value = outputItems.value.filter(item => item.code !== code); + } else if (type === 'transfer') { + transferItems.value = transferItems.value.filter(item => item.code !== code); + } else { + wasteItems.value = wasteItems.value.filter(item => item.code !== code); } snackbar.value = { @@ -316,7 +418,7 @@ const confirmDelete = async () => { message: 'حواله انبار حذف شد.', color: 'success' }; - } catch (error) { + } catch (error: any) { console.error('Error deleting ticket:', error); snackbar.value = { show: true,