progress in bank card

This commit is contained in:
Hesabix 2025-08-24 14:38:06 +00:00
parent ee5d644358
commit 189bf9fbdd
4 changed files with 471 additions and 112 deletions

View file

@ -64,7 +64,16 @@ class BankController extends AbstractController
} }
$data->setBalance($bd - $bs); $data->setBalance($bd - $bs);
} }
return $this->json($provider->ArrayEntity2Array($datas, 0)); $result = [];
foreach ($datas as $data) {
$bankData = $provider->ArrayEntity2Array([$data], 0)[0];
if (isset($data->tempData)) {
$bankData['bs'] = $data->tempData['bs'];
$bankData['bd'] = $data->tempData['bd'];
}
$result[] = $bankData;
}
return $this->json($result);
} }
#[Route('/api/bank/search', name: 'app_bank_search')] #[Route('/api/bank/search', name: 'app_bank_search')]
@ -115,14 +124,28 @@ class BankController extends AbstractController
->getQuery() ->getQuery()
->getResult(); ->getResult();
foreach ($items as $item) { foreach ($items as $item) {
$bs += $item->getBs(); $bs += (float) $item->getBs();
$bd += $item->getBd(); $bd += (float) $item->getBd();
} }
$data->setBalance($bd - $bs); $data->setBalance($bd - $bs);
// اضافه کردن مقادیر به array برای انتقال به frontend
$data->tempData = [
'bs' => $bs,
'bd' => $bd
];
} }
$result = [];
foreach ($datas as $data) {
$bankData = $provider->ArrayEntity2Array([$data], 0)[0];
if (isset($data->tempData)) {
$bankData['bs'] = $data->tempData['bs'];
$bankData['bd'] = $data->tempData['bd'];
}
$result[] = $bankData;
}
return $this->json([ return $this->json([
'items' => $provider->ArrayEntity2Array($datas, 0), 'items' => $result,
'total' => count($datas) 'total' => count($datas)
]); ]);
} }
@ -203,15 +226,15 @@ class BankController extends AbstractController
throw $this->createNotFoundException(); throw $this->createNotFoundException();
} }
$data->setBid($acc['bid']); $data->setBid($acc['bid']);
$data->setname($params['name']); $data->setName($params['name'] ?? '');
$data->setDes($params['des']); $data->setDes($params['des'] ?? null);
$data->setOwner($params['owner']); $data->setOwner($params['owner'] ?? null);
$data->setAccountNum($params['accountNum']); $data->setAccountNum($params['accountNum'] ?? null);
$data->setCardNum($params['cardNum']); $data->setCardNum($params['cardNum'] ?? null);
$data->setShaba($params['shaba']); $data->setShaba($params['shaba'] ?? null);
$data->setShobe($params['shobe']); $data->setShobe($params['shobe'] ?? null);
$data->setPosNum($params['posNum']); $data->setPosNum($params['posNum'] ?? null);
$data->setMobileInternetBank($params['mobileInternetbank']); $data->setMobileInternetBank($params['mobileInternetbank'] ?? null);
$entityManager->persist($data); $entityManager->persist($data);
$entityManager->flush(); $entityManager->flush();
$log->insert('بانک', 'حساب بانکی با نام ' . $params['name'] . ' افزوده/ویرایش شد.', $this->getUser(), $request->headers->get('activeBid')); $log->insert('بانک', 'حساب بانکی با نام ' . $params['name'] . ' افزوده/ویرایش شد.', $this->getUser(), $request->headers->get('activeBid'));
@ -283,8 +306,8 @@ class BankController extends AbstractController
->getResult(); ->getResult();
foreach ($items as $item) { foreach ($items as $item) {
$bs += $item->getBs(); $bs += (float) $item->getBs();
$bd += $item->getBd(); $bd += (float) $item->getBd();
} }
return $this->json([ return $this->json([

View file

@ -19,6 +19,7 @@ const en_lang = {
presell_info: "Presell Information", presell_info: "Presell Information",
financial_info: "Financial Information", financial_info: "Financial Information",
invoice_items: "Invoice Items", invoice_items: "Invoice Items",
bank_selection: 'Select Bank',
}, },
app:{ app:{
name:"Hesabix", name:"Hesabix",
@ -102,6 +103,102 @@ const en_lang = {
warranty_system: 'Warranty System', warranty_system: 'Warranty System',
warranty_serials: 'Warranty Serials', warranty_serials: 'Warranty Serials',
business_switcher: 'Switch Business', business_switcher: 'Switch Business',
bankaccounts_transactions: 'Bank Account Transactions',
banks: 'Banks',
banks_account: 'Bank Account',
banks_accounts: 'Bank Accounts',
bank_label: 'Banking',
}, },
pages: {
bank_card: {
title: 'Bank Account Card',
bank_info: 'Bank Information',
account_status: 'Account Status',
transactions: 'Transactions',
no_results: 'No results found!',
no_data: 'No data to display',
no_items_selected: 'No items selected.',
accounting_code: 'Accounting Code',
bank_name: 'Bank Name',
card_number: 'Card Number',
account_number: 'Account Number',
shaba_number: 'Shaba Number',
owner: 'Account Owner',
branch: 'Branch',
pos_number: 'POS Number',
internet_bank_phone: 'Internet Bank Phone',
description: 'Description',
balance: 'Balance',
accounting_balance: 'Accounting Balance',
credit: 'Credit',
debit: 'Debit',
deposit: 'Deposit',
withdrawal: 'Withdrawal',
creditor: 'Creditor',
debtor: 'Debtor',
settled: 'Settled',
accounting_status: 'Accounting Status',
detail: 'Detail',
settlement: 'Settlement',
running_balance: 'Running Balance',
available_balance: 'Available Balance',
sell_invoice: 'Sales Invoice',
buy_invoice: 'Purchase Invoice',
return_buy: 'Purchase Return',
return_sell: 'Sales Return',
payment: 'Payment',
receipt: 'Receipt',
cost: 'Cost',
income: 'Income',
sell_receive: 'Sales Receipt',
buy_send: 'Purchase Payment',
reject_cheque: 'Cheque Rejection',
modify_cheque: 'Cheque Registration',
modify_cheque_output: 'Cheque Receipt',
pass_cheque: 'Cheque Transfer',
transfer_cheque: 'Cheque Transfer',
transfer: 'Transfer',
accounting_doc: 'Accounting Document',
calculation: 'Calculation',
open_balance: 'Opening Balance'
},
person_card: {
title: 'Person Account Card',
account_card: 'Account Card',
account_status: 'Account Status',
transactions: 'Transactions',
no_bank_accounts: 'No bank accounts registered.',
no_results: 'No results found!',
no_data: 'No data to display',
no_items_selected: 'No items selected.',
accounting_code: 'Accounting Code',
balance: 'Balance',
accounting_balance: 'Accounting Balance',
credit: 'Credit',
debit: 'Debit',
deposit: 'Deposit',
withdrawal: 'Withdrawal',
creditor: 'Creditor',
debtor: 'Debtor',
settled: 'Settled',
sell_invoice: 'Sales Invoice',
buy_invoice: 'Purchase Invoice',
return_buy: 'Purchase Return',
return_sell: 'Sales Return',
payment: 'Payment',
receipt: 'Receipt',
cost: 'Cost',
income: 'Income',
sell_receive: 'Sales Receipt',
buy_send: 'Purchase Payment',
detail: 'Detail',
reject_cheque: 'Cheque Rejection',
modify_cheque: 'Cheque Registration',
modify_cheque_output: 'Cheque Receipt',
pass_cheque: 'Cheque Transfer',
settlement: 'Settlement',
running_balance: 'Running Balance'
}
}
}; };
export default en_lang export default en_lang

View file

@ -332,6 +332,7 @@ const fa_lang = {
"share_social": "اشتراک‌گذاری در شبکه‌های اجتماعی", "share_social": "اشتراک‌گذاری در شبکه‌های اجتماعی",
"invoice_link": "پیوند فاکتور", "invoice_link": "پیوند فاکتور",
banks_accounts: 'حساب‌های بانکی', banks_accounts: 'حساب‌های بانکی',
bank_selection: 'انتخاب بانک',
add: 'افزودن', add: 'افزودن',
confirm: 'قبول', confirm: 'قبول',
attach_download: 'دریافت فایل ضمیمه', attach_download: 'دریافت فایل ضمیمه',
@ -839,6 +840,8 @@ const fa_lang = {
"accounting_balance": "تراز حسابداری", "accounting_balance": "تراز حسابداری",
"credit": "بستانکار", "credit": "بستانکار",
"debit": "بدهکار", "debit": "بدهکار",
"deposit": "واریز",
"withdrawal": "برداشت",
"creditor": "بستانکار", "creditor": "بستانکار",
"debtor": "بدهکار", "debtor": "بدهکار",
"settled": "تسویه‌شده", "settled": "تسویه‌شده",
@ -858,7 +861,66 @@ const fa_lang = {
"modify_cheque_output": "دریافت چک", "modify_cheque_output": "دریافت چک",
"pass_cheque": "واگذاری چک", "pass_cheque": "واگذاری چک",
"settlement": "تشخیص", "settlement": "تشخیص",
"running_balance": "باقی‌مانده" "running_balance": "تراز",
"available_balance": "موجودی",
"transfer": "انتقال",
"accounting_doc": "سند حسابداری",
"calculation": "محاسبه",
"open_balance": "تراز افتتاحیه",
"walletPay": "پرداخت کیف پول"
},
"bank_card": {
"title": "کارت حساب بانک",
"bank_info": "اطلاعات بانک",
"account_status": "وضعیت حساب",
"transactions": "تراکنش‌ها",
"no_results": "نتیجه‌ای یافت نشد!",
"no_data": "اطلاعاتی برای نمایش وجود ندارد",
"no_items_selected": "هیچ آیتمی انتخاب نشده است.",
"accounting_code": "کد حسابداری",
"bank_name": "نام بانک",
"card_number": "شماره کارت",
"account_number": "شماره حساب",
"shaba_number": "شماره شبا",
"owner": "صاحب حساب",
"branch": "شعبه",
"pos_number": "شماره دستگاه پوز",
"internet_bank_phone": "تلفن اینترنت بانک",
"description": "توضیحات",
"balance": "تراز",
"accounting_balance": "تراز حسابداری",
"credit": "بستانکار",
"debit": "بدهکار",
"deposit": "واریز",
"withdrawal": "برداشت",
"creditor": "بستانکار",
"debtor": "بدهکار",
"settled": "تسویه‌شده",
"accounting_status": "وضعیت حسابداری",
"detail": "تفضیل",
"settlement": "تشخیص",
"running_balance": "باقی‌مانده",
"available_balance": "موجودی",
"sell_invoice": "فاکتور فروش",
"buy_invoice": "فاکتور خرید",
"return_buy": "برگشت از خرید",
"return_sell": "برگشت از فروش",
"payment": "دریافت",
"receipt": "پرداخت",
"cost": "هزینه",
"income": "درآمد",
"sell_receive": "دریافت فاکتور فروش",
"buy_send": "پرداخت فاکتور فروش",
"reject_cheque": "برگشت چک",
"modify_cheque": "ثبت چک",
"modify_cheque_output": "دریافت چک",
"pass_cheque": "واگذاری چک",
"transfer_cheque": "واگذاری چک",
"transfer": "انتقال",
"accounting_doc": "سند حسابداری",
"calculation": "محاسبه",
"open_balance": "تراز افتتاحیه",
"walletPay": "پرداخت کیف پول"
}, },
dashboard: { dashboard: {
admin_area: "ناحیه مدیریت", admin_area: "ناحیه مدیریت",

View file

@ -1,14 +1,12 @@
<template> <template>
<v-toolbar color="toolbar" :title="$t('drawer.bankaccounts_transactions')"> <v-toolbar color="toolbar" dense flat>
<template v-slot:prepend> <v-btn icon @click="$router.back()" class="d-none d-md-flex">
<v-tooltip :text="$t('dialog.back')" location="bottom"> <v-icon>mdi-arrow-right</v-icon>
<template v-slot:activator="{ props }"> </v-btn>
<v-btn v-bind="props" @click="$router.back()" class="d-none d-sm-flex" variant="text" <v-toolbar-title class="text-primary-dark">
icon="mdi-arrow-right" /> {{ $t('drawer.bankaccounts_transactions') }}
</template> </v-toolbar-title>
</v-tooltip> <v-spacer />
</template>
<v-spacer></v-spacer>
<v-menu> <v-menu>
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn v-bind="props" icon="" color="red"> <v-btn v-bind="props" icon="" color="red">
@ -52,107 +50,208 @@
</v-list> </v-list>
</v-menu> </v-menu>
</v-toolbar> </v-toolbar>
<v-row class="pa-1">
<v-col cols="12" sm="12" md="12"> <v-container fluid class="pa-4">
<v-card :loading="loading"> <!-- انتخاب بانک -->
<v-card-text> <v-row dense>
<v-row class=""> <v-col cols="12" md="12">
<v-col cols="12" sm="12" md="12"> <v-autocomplete v-model="selectedObjectItem" :items="objectItems" item-title="name" item-value="code"
<small class="mb-2">بانک</small> return-object :label="$t('dialog.bank_selection')" dense hide-details prepend-inner-icon="mdi-bank"
<v-cob dir="rtl" :options="objectItems" label="name" v-model="selectedObjectItem" :loading="loading" @update:model-value="updateRoute" class="rounded-lg elevation-2">
@option:selected="updateRoute(selectedObjectItem.code)"> <template v-slot:no-data>
<template #no-options="{ search, searching, loading }"> {{ $t('pages.bank_card.no_results') }}
نتیجهای یافت نشد!
</template> </template>
</v-cob> <template v-slot:item="{ props, item }">
<v-list-item v-bind="props">
<v-list-item-title>
<v-icon small left>mdi-bank</v-icon>
{{ item.raw.name }}
</v-list-item-title>
<v-list-item-subtitle>
<v-row dense>
<v-col cols="6">
<v-icon small left>mdi-credit-card</v-icon>
{{ item.raw.cardNum || 'بدون کارت' }}
</v-col> </v-col>
<v-col cols="12" sm="12" md="4"> <v-col cols="6">
<div class="fw-bold mb-2">کد حسابداری: <small class="text-primary">{{ selectedObjectItem.code }}</small> <v-icon small left>mdi-account</v-icon>
</div> {{ item.raw.owner || 'نامشخص' }}
<div class="fw-bold mb-2">نام : <small class="text-primary">{{ selectedObjectItem.name }}</small></div>
<div class="fw-bold mb-2">شماره کارت: <small class="text-primary">{{ selectedObjectItem.cardNum
}}</small>
</div>
</v-col>
<v-col cols="12" sm="12" md="4">
<div class="fw-bold mb-2">شبا: <small class="text-primary">{{ selectedObjectItem.shaba }}</small></div>
<div class="fw-bold mb-2">صاحب حساب: <small class="text-primary">{{ selectedObjectItem.owner }}</small>
</div>
<div class="fw-bold mb-2">تلفن اینترنت بانک: <small class="text-primary">{{
selectedObjectItem.mobileInternetBank }}</small></div>
</v-col>
<v-col cols="12" sm="12" md="4">
<div class="fw-bold mb-2">شماره دستگاه پوز: <small class="text-primary">{{ selectedObjectItem.posNum
}}</small></div>
<div class="fw-bold mb-2">شعبه: <small class="text-primary">{{ selectedObjectItem.shobe }}</small></div>
<div class="fw-bold mb-2">توضیحات: <small class="text-primary">{{ selectedObjectItem.des }}</small>
</div>
</v-col> </v-col>
</v-row> </v-row>
</v-list-item-subtitle>
</v-list-item>
</template>
</v-autocomplete>
</v-col>
</v-row>
<!-- کارت اطلاعات بانک -->
<v-row dense>
<v-col cols="12" md="6">
<v-card flat outlined class="rounded-lg elevation-2">
<v-toolbar color="primary-dark" dense flat class="rounded-t-lg">
<v-toolbar-title class="text-white">
{{ $t('pages.bank_card.bank_info') }}
<small class="text-info-light" v-if="selectedObjectItem">{{ selectedObjectItem.name }}</small>
</v-toolbar-title>
</v-toolbar>
<v-card-text class="pa-2">
<div class="text-subtitle-2">{{ $t('pages.bank_card.accounting_code') }}: <span class="text-primary">{{
selectedObjectItem.code || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.bank_name') }}: <span class="text-primary">{{
selectedObjectItem.name || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.card_number') }}: <span class="text-primary">{{
selectedObjectItem.cardNum || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.account_number') }}: <span class="text-primary">{{
selectedObjectItem.accountNum || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.shaba_number') }}: <span class="text-primary">{{
selectedObjectItem.shaba || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.owner') }}: <span class="text-primary">{{
selectedObjectItem.owner || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.branch') }}: <span class="text-primary">{{
selectedObjectItem.shobe || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.pos_number') }}: <span class="text-primary">{{
selectedObjectItem.posNum || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.internet_bank_phone') }}: <span class="text-primary">{{
selectedObjectItem.mobileInternetBank || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.description') }}: <span class="text-primary">{{
selectedObjectItem.des || '-' }}</span></div>
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-col> </v-col>
<v-col cols="12" sm="12" md="12"> <v-col cols="12" md="6">
<v-text-field :loading="loading" color="green" class="mb-0 pt-0 rounded-0" hide-details="auto" density="compact" <v-card flat outlined class="rounded-lg elevation-2">
:placeholder="$t('dialog.search_txt')" v-model="searchValue" type="text" clearable> <v-toolbar color="primary-dark" dense flat class="rounded-t-lg">
<template v-slot:prepend-inner> <v-toolbar-title class="text-white">
<v-tooltip location="bottom" :text="$t('dialog.search')"> {{ $t('pages.bank_card.account_status') }}
<template v-slot:activator="{ props }"> <small class="text-info-light" v-if="selectedObjectItem">{{ selectedObjectItem.name }}</small>
<v-icon v-bind="props" color="danger" icon="mdi-magnify"></v-icon> </v-toolbar-title>
</template> </v-toolbar>
</v-tooltip> <v-card-text class="pa-2">
</template> <div class="text-subtitle-2">
</v-text-field> {{ $t('pages.bank_card.accounting_status') }}:
<EasyDataTable table-class-name="customize-table" show-index alternating v-model:items-selected="itemsSelected" <span :class="{
:search-value="searchValue" :headers="headers" :items="items" theme-color="#1d90ff" 'text-success': selectedObjectItem.balance > 0,
header-text-direction="center" body-text-direction="center" rowsPerPageMessage="تعداد سطر" 'text-danger': selectedObjectItem.balance < 0,
emptyMessage="اطلاعاتی برای نمایش وجود ندارد" rowsOfPageSeparatorMessage="از" :loading="loading"> 'text-dark': selectedObjectItem.balance == 0
<template #item-operation="{ code }"> }">
<router-link class="text-success" :to="'/acc/accounting/view/' + code"> {{ selectedObjectItem.balance > 0 ? $t('pages.bank_card.creditor') : selectedObjectItem.balance < 0 ?
<i class="fa fa-eye px-1"></i> $t('pages.bank_card.debtor') : $t('pages.bank_card.settled') }} </span>
</router-link> </div>
</template> <div class="text-subtitle-2">{{ $t('pages.bank_card.withdrawal') }}: <span class="text-primary">{{
</EasyDataTable> $filters.formatNumber(selectedObjectItem.bs) || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.deposit') }}: <span class="text-primary">{{
$filters.formatNumber(selectedObjectItem.bd) || '-' }}</span></div>
<div class="text-subtitle-2">{{ $t('pages.bank_card.accounting_balance') }}: <span class="text-primary">{{
$filters.formatNumber(selectedObjectItem.balance) || '-' }}</span></div>
<v-divider class="my-2" />
</v-card-text>
</v-card>
</v-col> </v-col>
</v-row> </v-row>
<!-- جدول تراکنشها -->
<v-row dense>
<v-col cols="12">
<v-data-table v-model="itemsSelected" :headers="headers" :items="items" :search="searchValue" :loading="loading"
show-select dense :items-per-page="25" class="elevation-2 rounded-lg" :header-props="{ class: 'custom-header' }">
<template v-slot:top>
<v-toolbar flat dense color="grey-lighten-4" class="rounded-t-lg">
<v-toolbar-title class="text-subtitle-1">{{ $t('pages.bank_card.transactions') }}</v-toolbar-title>
<v-spacer></v-spacer>
<v-text-field v-model="searchValue" dense hide-details
prepend-inner-icon="mdi-magnify" />
</v-toolbar>
</template>
<template v-slot:item.operation="{ item }">
<v-btn variant="plain" icon size="small" :to="'/acc/accounting/view/' + item.code" color="success">
<v-icon small>mdi-eye</v-icon>
</v-btn>
</template>
<template v-slot:item.code="{ item }">
{{ $filters.formatNumber(item.code) }}
</template>
<template v-slot:item.type="{ item }">
<v-btn variant="plain" text size="small" :to="getTypeRoute(item.type, item.code)" class="text-none">
{{ getTypeLabel(item.type) }}
</v-btn>
</template>
<template v-slot:item.bd="{ item }">
{{ $filters.formatNumber(item.bd) }}
</template>
<template v-slot:item.bs="{ item }">
{{ $filters.formatNumber(item.bs) }}
</template>
<template v-slot:item.settlement="{ item }">
<v-chip
:color="item.settlement === 'بستانکار' ? 'success' : item.settlement === 'بدهکار' ? 'error' : item.settlement === 'تسویه‌شده' ? 'info' : 'default'"
size="small"
variant="outlined"
>
{{ item.settlement }}
</v-chip>
</template>
<template v-slot:item.balance="{ item }">
<span :class="{
'text-success': -item.balance > 0,
'text-danger': -item.balance < 0,
'text-dark': item.balance == 0
}">
{{ $filters.formatNumber(-item.balance) }}
</span>
</template>
<template v-slot:no-data>
{{ $t('pages.bank_card.no_data') }}
</template>
</v-data-table>
</v-col>
</v-row>
</v-container>
<v-overlay :value="loading" contained class="align-center justify-center">
<v-progress-circular indeterminate size="64" />
</v-overlay>
</template> </template>
<script> <script>
import axios from "axios"; import axios from "axios";
import Swal from "sweetalert2"; import Swal from "sweetalert2";
import { ref } from "vue";
export default { export default {
name: "card", name: "card",
data: () => { data() {
return { return {
searchValue: '', searchValue: '',
itemsSelected: [], itemsSelected: [],
items: [], items: [],
selectedObjectItem: { selectedObjectItem: { balance: 0, bs: 0, bd: 0 },
id: '',
code: 0,
name: '',
},
items: [],
objectItems: [], objectItems: [],
loading: true, loading: ref(false),
headers: [ headers: [
{ text: "عملیات", value: "operation" }, { title: this.$t('dialog.operation'), key: "operation", align: "center", sortable: false },
{ text: "تاریخ", value: "date", 'sortable': true }, { title: this.$t('dialog.type'), key: "type", align: "center", sortable: true },
{ text: "شرح", value: "des" }, { title: this.$t('dialog.invoice_num'), key: "code", align: "center", sortable: true },
{ text: "تفضیل", value: "ref", 'sortable': true }, { title: this.$t('dialog.date'), key: "date", align: "center", sortable: true },
{ text: "واریز", value: "bd", 'sortable': true }, { title: this.$t('app.body'), key: "des", align: "center" },
{ text: "برداشت", value: "bs", 'sortable': true }, { title: this.$t('pages.bank_card.detail'), key: "ref", align: "center", sortable: true },
] { title: this.$t('pages.bank_card.deposit'), key: "bd", align: "center", sortable: true },
} { title: this.$t('pages.bank_card.withdrawal'), key: "bs", align: "center", sortable: true },
{ title: this.$t('pages.bank_card.settlement'), key: "settlement", align: "center", sortable: true },
{ title: this.$t('pages.bank_card.available_balance'), key: "balance", align: "center", sortable: true },
],
};
}, },
mounted() { mounted() {
this.loadData(); this.loadData();
}, },
methods: { methods: {
updateRoute(id) { updateRoute(selectedItem) {
this.$router.push(id); if (selectedItem && selectedItem.code) {
this.$router.push(`/acc/banks/card/view/${selectedItem.code}`);
this.loadData(); this.loadData();
this.loadBankBalance();
}
}, },
loadData() { loadData() {
this.loading = true; this.loading = true;
@ -168,10 +267,20 @@ export default {
}); });
} else { } else {
this.selectedObjectItem = response.data[0]; this.selectedObjectItem = response.data[0];
this.loadObject(this.selectedObjectItem.code);
} }
this.loadObject(this.selectedObjectItem.code);
this.loadBankBalance();
}); });
}, },
loadBankBalance() {
if (this.selectedObjectItem && this.selectedObjectItem.code) {
axios.get(`/api/bank/balance/${this.selectedObjectItem.code}`).then((response) => {
this.selectedObjectItem.bs = parseFloat(response.data.credit) || 0;
this.selectedObjectItem.bd = parseFloat(response.data.debit) || 0;
this.selectedObjectItem.balance = parseFloat(response.data.balance) || 0;
});
}
},
loadObject(id) { loadObject(id) {
this.loading = true; this.loading = true;
axios.post('/api/accounting/rows/search', axios.post('/api/accounting/rows/search',
@ -188,6 +297,56 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
getTypeRoute(type, code) {
const routes = {
sell: '/acc/sell/view/',
buy: '/acc/buy/view/',
rfbuy: '/acc/rfbuy/view/',
rfsell: '/acc/rfsell/view/',
person_send: '/acc/accounting/view/',
person_receive: '/acc/accounting/view/',
cost: '/acc/accounting/view/',
income: '/acc/accounting/view/',
sell_receive: '/acc/accounting/view/',
buy_send: '/acc/accounting/view/',
reject_cheque: '/acc/accounting/view/',
modify_cheque: '/acc/accounting/view/',
modify_cheque_output: '/acc/accounting/view/',
pass_cheque: '/acc/accounting/view/',
transfer_cheque: '/acc/accounting/view/',
transfer: '/acc/accounting/view/',
doc: '/acc/accounting/view/',
calc: '/acc/accounting/view/',
open_balance: '/acc/accounting/view/',
walletPay: '/acc/accounting/view/',
};
return routes[type] + code;
},
getTypeLabel(type) {
const labels = {
sell: this.$t('pages.bank_card.sell_invoice'),
buy: this.$t('pages.bank_card.buy_invoice'),
rfbuy: this.$t('pages.bank_card.return_buy'),
rfsell: this.$t('pages.bank_card.return_sell'),
person_send: this.$t('pages.bank_card.payment'),
person_receive: this.$t('pages.bank_card.receipt'),
cost: this.$t('pages.bank_card.cost'),
income: this.$t('pages.bank_card.income'),
sell_receive: this.$t('pages.bank_card.sell_receive'),
buy_send: this.$t('pages.bank_card.buy_send'),
reject_cheque: this.$t('pages.bank_card.reject_cheque'),
modify_cheque: this.$t('pages.bank_card.modify_cheque'),
pass_cheque: this.$t('pages.bank_card.pass_cheque'),
modify_cheque_output: this.$t('pages.bank_card.modify_cheque_output'),
transfer_cheque: this.$t('pages.bank_card.transfer_cheque'),
transfer: this.$t('pages.bank_card.transfer'),
doc: this.$t('pages.bank_card.accounting_doc'),
calc: this.$t('pages.bank_card.calculation'),
open_balance: this.$t('pages.bank_card.open_balance'),
walletPay: this.$t('pages.bank_card.walletPay'),
};
return labels[type] || type;
},
excellOutput(AllItems = true) { excellOutput(AllItems = true) {
if (AllItems) { if (AllItems) {
this.loading = true; this.loading = true;
@ -233,7 +392,7 @@ export default {
var fileLink = document.createElement('a'); var fileLink = document.createElement('a');
fileLink.href = fileURL; fileLink.href = fileURL;
fileLink.setAttribute('download', 'persons-list.xlsx'); fileLink.setAttribute('download', 'bank-card-view.xlsx');
document.body.appendChild(fileLink); document.body.appendChild(fileLink);
fileLink.click(); fileLink.click();
}) })
@ -278,10 +437,28 @@ export default {
} }
} }
} }
}, },
} }
} }
</script> </script>
<style scoped></style> <style scoped>
.custom-header {
background-color: #f5f5f5 !important;
font-weight: 600 !important;
}
.v-data-table {
border-radius: 8px;
overflow: hidden;
}
.v-card {
transition: all 0.3s ease;
}
.v-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}
</style>