progress in cheque part
This commit is contained in:
parent
a1d75df349
commit
d09149f916
|
@ -340,10 +340,13 @@ class AdminController extends AbstractController
|
|||
$resp['fromNum'] = $registryMGR->get('sms', 'fromNum');
|
||||
$resp['sharefaktor'] = $registryMGR->get('sms', 'sharefaktor');
|
||||
$resp['plan'] = $registryMGR->get('sms', 'plan');
|
||||
$resp['chequeInput'] = $registryMGR->get('sms', 'chequeInput');
|
||||
$resp['passChequeInput'] = $registryMGR->get('sms', 'passChequeInput');
|
||||
$resp['rejectChequeInput'] = $registryMGR->get('sms', 'rejectChequeInput');
|
||||
$resp['plugRepservice'] = [
|
||||
'get' => $registryMGR->get('sms', 'plugRepserviceStateGet'),
|
||||
'getback' => $registryMGR->get('sms', 'plugRepserviceStateGetback'),
|
||||
'repired' => $registryMGR->get('sms', 'plugRepserviceStateRepaired'),
|
||||
'repaired' => $registryMGR->get('sms', 'plugRepserviceStateRepaired'),
|
||||
'unrepaired' => $registryMGR->get('sms', 'plugRepserviceStateUnrepired'),
|
||||
'creating' => $registryMGR->get('sms', 'plugRepserviceStateCreating'),
|
||||
'created' => $registryMGR->get('sms', 'plugRepserviceStateCreated')
|
||||
|
@ -352,6 +355,9 @@ class AdminController extends AbstractController
|
|||
'sharefaktor' => $registryMGR->get('sms', 'plugAccproSharefaktor'),
|
||||
'storeroomSmsOther' => $registryMGR->get('sms', 'plugAccproStoreroomSmsOther'),
|
||||
'storeroomSmsBarbari' => $registryMGR->get('sms', 'plugAccproStoreroomSmsBarbari'),
|
||||
'chequeInput' => $registryMGR->get('sms', 'plugAccproChequeInput'),
|
||||
'passChequeInput' => $registryMGR->get('sms', 'plugAccproPassChequeInput'),
|
||||
'rejectChequeInput' => $registryMGR->get('sms', 'plugAccproRejectChequeInput')
|
||||
];
|
||||
return $this->json($resp);
|
||||
}
|
||||
|
@ -389,12 +395,18 @@ class AdminController extends AbstractController
|
|||
$registryMGR->update('sms', 'sharefaktor', $params['sharefaktor']);
|
||||
if (array_key_exists('plan', $params))
|
||||
$registryMGR->update('sms', 'plan', $params['plan']);
|
||||
if (array_key_exists('chequeInput', $params))
|
||||
$registryMGR->update('sms', 'chequeInput', $params['chequeInput']);
|
||||
if (array_key_exists('passChequeInput', $params))
|
||||
$registryMGR->update('sms', 'passChequeInput', $params['passChequeInput']);
|
||||
if (array_key_exists('rejectChequeInput', $params))
|
||||
$registryMGR->update('sms', 'rejectChequeInput', $params['rejectChequeInput']);
|
||||
|
||||
if (array_key_exists('plugRepservice', $params)) {
|
||||
if (array_key_exists('get', $params['plugRepservice']))
|
||||
$registryMGR->update('sms', 'plugRepserviceStateGet', $params['plugRepservice']['get']);
|
||||
if (array_key_exists('repired', $params['plugRepservice']))
|
||||
$registryMGR->update('sms', 'plugRepserviceStateRepaired', $params['plugRepservice']['repired']);
|
||||
if (array_key_exists('repaired', $params['plugRepservice']))
|
||||
$registryMGR->update('sms', 'plugRepserviceStateRepaired', $params['plugRepservice']['repaired']);
|
||||
if (array_key_exists('unrepaired', $params['plugRepservice']))
|
||||
$registryMGR->update('sms', 'plugRepserviceStateUnrepired', $params['plugRepservice']['unrepaired']);
|
||||
if (array_key_exists('getback', $params['plugRepservice']))
|
||||
|
@ -411,6 +423,12 @@ class AdminController extends AbstractController
|
|||
$registryMGR->update('sms', 'plugAccproStoreroomSmsBarbari', $params['plugAccpro']['storeroomSmsBarbari']);
|
||||
if (array_key_exists('storeroomSmsOther', $params['plugAccpro']))
|
||||
$registryMGR->update('sms', 'plugAccproStoreroomSmsOther', $params['plugAccpro']['storeroomSmsOther']);
|
||||
if (array_key_exists('chequeInput', $params['plugAccpro']))
|
||||
$registryMGR->update('sms', 'plugAccproChequeInput', $params['plugAccpro']['chequeInput']);
|
||||
if (array_key_exists('passChequeInput', $params['plugAccpro']))
|
||||
$registryMGR->update('sms', 'plugAccproPassChequeInput', $params['plugAccpro']['passChequeInput']);
|
||||
if (array_key_exists('rejectChequeInput', $params['plugAccpro']))
|
||||
$registryMGR->update('sms', 'plugAccproRejectChequeInput', $params['plugAccpro']['rejectChequeInput']);
|
||||
}
|
||||
|
||||
return $this->json(JsonResp::success());
|
||||
|
|
|
@ -7,117 +7,123 @@ use App\Entity\Cheque;
|
|||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\HesabdariRow;
|
||||
use App\Entity\HesabdariTable;
|
||||
use App\Entity\Person;
|
||||
use App\Service\Log;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\Access;
|
||||
use App\Service\Explore;
|
||||
use App\Service\JsonResp;
|
||||
use App\Service\Provider;
|
||||
use App\Service\SMS;
|
||||
use App\Service\PluginService;
|
||||
use App\Service\RegistryMGR;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class ChequeController extends AbstractController
|
||||
{
|
||||
#[Route('/api/cheque/list', name: 'app_cheque_list')]
|
||||
public function app_accounting_insert(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
||||
public function app_accounting_insert(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if(!$acc)
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$chequesInput = $entityManager->getRepository(Cheque::class)->findBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'type'=>'input'
|
||||
'bid' => $acc['bid'],
|
||||
'type' => 'input'
|
||||
]);
|
||||
$chequesOutput = $entityManager->getRepository(Cheque::class)->findBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'type'=>'output'
|
||||
'bid' => $acc['bid'],
|
||||
'type' => 'output'
|
||||
]);
|
||||
return $this->json([
|
||||
'input'=>Explore::SerializeCheques(array_reverse($chequesInput)),
|
||||
'output'=>Explore::SerializeCheques(array_reverse($chequesOutput))
|
||||
'input' => Explore::SerializeCheques(array_reverse($chequesInput)),
|
||||
'output' => Explore::SerializeCheques(array_reverse($chequesOutput))
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/api/cheque/list/forpay', name: 'app_cheque_list_for_pay')]
|
||||
public function app_cheque_list_for_pay(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
||||
public function app_cheque_list_for_pay(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if(!$acc)
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$cheques = $entityManager->getRepository(Cheque::class)->findBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'type'=>'input',
|
||||
'locked'=>false,
|
||||
'bid' => $acc['bid'],
|
||||
'type' => 'input',
|
||||
'locked' => false,
|
||||
]);
|
||||
|
||||
|
||||
return $this->json(
|
||||
Explore::SerializeCheques(array_reverse($cheques)),
|
||||
);
|
||||
}
|
||||
|
||||
#[Route('/api/cheque/info/{id}', name: 'app_cheque_info')]
|
||||
public function app_cheque_info(string $id, Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
||||
public function app_cheque_info(string $id, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if(!$acc)
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$cheque = $entityManager->getRepository(Cheque::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'id'=>$id
|
||||
'bid' => $acc['bid'],
|
||||
'id' => $id
|
||||
]);
|
||||
if(!$cheque)
|
||||
if (!$cheque)
|
||||
throw $this->createNotFoundException('cheque not found');
|
||||
return $this->json(Explore::SerializeCheque($cheque));
|
||||
}
|
||||
|
||||
#[Route('/api/cheque/reject/{id}', name: 'app_cheque_reject')]
|
||||
public function app_cheque_reject(string $id, Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
||||
public function app_cheque_reject(string $id, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if(!$acc)
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$cheque = $entityManager->getRepository(Cheque::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'id'=>$id
|
||||
'bid' => $acc['bid'],
|
||||
'id' => $id
|
||||
]);
|
||||
if(!$cheque)
|
||||
if (!$cheque)
|
||||
throw $this->createNotFoundException('cheque not found');
|
||||
$cheque->setStatus('برگشت خورده');
|
||||
$cheque->setRejected(true);
|
||||
$log->insert('بانکداری','چک شماره شماره ' . $cheque->getNumber() . ' به برگشت خورده تغییر یافت. ',$this->getUser(),$request->headers->get('activeBid'));
|
||||
$log->insert('بانکداری', 'چک شماره شماره ' . $cheque->getNumber() . ' به برگشت خورده تغییر یافت. ', $this->getUser(), $request->headers->get('activeBid'));
|
||||
$entityManager->persist($cheque);
|
||||
$entityManager->flush();
|
||||
return $this->json(['result'=>'ok']);
|
||||
return $this->json(['result' => 'ok']);
|
||||
}
|
||||
|
||||
#[Route('/api/cheque/pass/{id}', name: 'app_cheque_pass')]
|
||||
public function app_cheque_pass(string $id,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
||||
public function app_cheque_pass(string $id, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if(!$acc)
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(! array_key_exists('bank',$params) || ! array_key_exists('date',$params))
|
||||
if (! array_key_exists('bank', $params) || ! array_key_exists('date', $params))
|
||||
$this->createNotFoundException();
|
||||
$cheque = $entityManager->getRepository(Cheque::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'type'=>'input',
|
||||
'bid' => $acc['bid'],
|
||||
'type' => 'input',
|
||||
'id' => $id
|
||||
]);
|
||||
$bank = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['bank']['code']
|
||||
]);
|
||||
if(!$cheque || !$bank)
|
||||
if (!$cheque || !$bank)
|
||||
throw $this->createNotFoundException();
|
||||
if($cheque->isLocked())
|
||||
if ($cheque->isLocked())
|
||||
throw $this->createAccessDeniedException('cheque operation not permitted');
|
||||
|
||||
//edit cheque info
|
||||
|
@ -136,7 +142,7 @@ class ChequeController extends AbstractController
|
|||
$hesabdariDoc->setDateSubmit(time());
|
||||
$hesabdariDoc->setDate($params['date']);
|
||||
$hesabdariDoc->setType('pass_cheque');
|
||||
$hesabdariDoc->setCode($provider->getAccountingCode($acc['bid'],'accounting'));
|
||||
$hesabdariDoc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||
$hesabdariDoc->setDes($params['des']);
|
||||
$hesabdariDoc->setAmount($cheque->getAmount());
|
||||
$entityManager->persist($hesabdariDoc);
|
||||
|
@ -148,7 +154,7 @@ class ChequeController extends AbstractController
|
|||
$hesabdariRow1->setPerson($cheque->getPerson());
|
||||
$hesabdariRow1->setYear($acc['year']);
|
||||
$hesabdariRow1->setBs($cheque->getAmount());
|
||||
$hesabdariRow1->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>3]));
|
||||
$hesabdariRow1->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 3]));
|
||||
$hesabdariRow1->setBd(0);
|
||||
$hesabdariRow1->setBid($acc['bid']);
|
||||
$hesabdariRow1->setDes('پاس شدن چک و انتقال به بانک');
|
||||
|
@ -160,21 +166,297 @@ class ChequeController extends AbstractController
|
|||
$hesabdariRow2->setBank($bank);
|
||||
$hesabdariRow2->setYear($acc['year']);
|
||||
$hesabdariRow2->setBs(0);
|
||||
$hesabdariRow2->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>5]));
|
||||
$hesabdariRow2->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 5]));
|
||||
$hesabdariRow2->setBd($cheque->getAmount());
|
||||
$hesabdariRow2->setBid($acc['bid']);
|
||||
$hesabdariRow2->setDes('پاس شدن چک و انتقال به بانک');
|
||||
$entityManager->persist($hesabdariRow2);
|
||||
$entityManager->flush();
|
||||
$log->insert(
|
||||
'حسابداری','ثبت چک پاس شده شماره ' . $cheque->getNumber() . ' و ثبت واریز به بانک ' . $bank->getName(),
|
||||
'حسابداری',
|
||||
'ثبت چک پاس شده شماره ' . $cheque->getNumber() . ' و ثبت واریز به بانک ' . $bank->getName(),
|
||||
$this->getUser(),
|
||||
$acc['bid']->getId(),
|
||||
$hesabdariDoc
|
||||
);
|
||||
|
||||
return $this->json([
|
||||
'result'=>'ok'
|
||||
'result' => 'ok'
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/api/cheque/modify/input/{id}', name: 'app_cheque_modify_input')]
|
||||
public function app_cheque_modify_input(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate, SMS $SMS, PluginService $pluginService, RegistryMGR $registryMGR, string $id = '0'): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if ($id == '0') {
|
||||
$cheque = new Cheque;
|
||||
$cheque->setLocked(false);
|
||||
$cheque->setDateSubmit(time());
|
||||
$cheque->setDateStamp(time());
|
||||
$cheque->setSubmitter($this->getUser());
|
||||
$cheque->setBid($acc['bid']);
|
||||
$cheque->setStatus('پاس نشده');
|
||||
$cheque->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 125]));
|
||||
} else {
|
||||
$cheque = $entityManager->getRepository(Cheque::class)->findOneBy(['id' => $id, 'bid' => $acc['bid']]);
|
||||
if (!$cheque)
|
||||
throw $this->createNotFoundException('cheque not found');
|
||||
if ($cheque->isRejected() || $cheque->getStatus() === 'پاس شده')
|
||||
throw $this->createAccessDeniedException('امکان ویرایش این چک وجود ندارد');
|
||||
}
|
||||
$cheque->setNumber($params['number']);
|
||||
if (!is_numeric($params['amount'])) {
|
||||
throw new \Exception('مبلغ باید عددی باشد');
|
||||
}
|
||||
$cheque->setAmount(strpos($params['amount'], '.') === false ? (int)$params['amount'] : (float)$params['amount']);
|
||||
$cheque->setType('input');
|
||||
$cheque->setBankoncheque($params['bankoncheque']);
|
||||
$cheque->setPerson($entityManager->getRepository(Person::class)->findOneBy(['id' => $params['person']['code'], 'bid' => $acc['bid']]));
|
||||
$cheque->setSayadNum($params['sayadNumber']);
|
||||
$cheque->setDate($params['date']);
|
||||
$cheque->setDes($params['description']);
|
||||
$entityManager->persist($cheque);
|
||||
|
||||
// ارسال پیامک در صورت درخواست
|
||||
if (isset($params['sendSms']) && $params['sendSms'] == true) {
|
||||
$person = $cheque->getPerson();
|
||||
if ($person && $person->getMobile()) {
|
||||
if ($pluginService->isActive('accpro', $acc['bid']) && $person->getMobile() != '' && $acc['bid']->getTel()) {
|
||||
$SMS->sendByBalance(
|
||||
[$person->getNikename(), $cheque->getNumber(), number_format($cheque->getAmount()), $cheque->getBankoncheque(), $cheque->getDate(), $acc['bid']->getName(), $acc['bid']->getName()],
|
||||
$registryMGR->get('sms', 'plugAccproChequeInput'),
|
||||
$person->getMobile(),
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
3
|
||||
);
|
||||
} else {
|
||||
$SMS->sendByBalance(
|
||||
[$person->getNikename(), $cheque->getNumber(), number_format($cheque->getAmount()), $cheque->getBankoncheque(), $cheque->getDate(), $acc['bid']->getName(), $acc['bid']->getName()],
|
||||
$registryMGR->get('sms', 'chequeInput'),
|
||||
$person->getMobile(),
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
2
|
||||
);
|
||||
}
|
||||
$log->insert(
|
||||
'بانکداری',
|
||||
'ارسال پیامک به ' . $person->getNikename() . ' برای چک شماره ' . $cheque->getNumber(),
|
||||
$this->getUser(),
|
||||
$acc['bid']->getId()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// اگر چک موجود است، سند حسابداری قبلی را پیدا و بهروزرسانی میکنیم
|
||||
if ($id != '0') {
|
||||
$hesabdariRow = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
|
||||
'cheque' => $cheque,
|
||||
'bid' => $acc['bid']
|
||||
]);
|
||||
$hesabdariDoc = $hesabdariRow ? $hesabdariRow->getDoc() : null;
|
||||
|
||||
if ($hesabdariDoc) {
|
||||
// حذف سطرهای حسابداری قبلی
|
||||
$oldRows = $hesabdariDoc->getHesabdariRows();
|
||||
foreach ($oldRows as $row) {
|
||||
$entityManager->remove($row);
|
||||
}
|
||||
} else {
|
||||
$hesabdariDoc = new HesabdariDoc;
|
||||
}
|
||||
} else {
|
||||
$hesabdariDoc = new HesabdariDoc;
|
||||
}
|
||||
|
||||
$hesabdariDoc->setBid($acc['bid']);
|
||||
$hesabdariDoc->setSubmitter($this->getUser());
|
||||
$hesabdariDoc->setYear($acc['year']);
|
||||
$hesabdariDoc->setMoney($acc['money']);
|
||||
$hesabdariDoc->setDateSubmit(time());
|
||||
$hesabdariDoc->setType('modify_cheque');
|
||||
$hesabdariDoc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||
$hesabdariDoc->setDate($params['date']);
|
||||
$hesabdariDoc->setDes($params['description']);
|
||||
$hesabdariDoc->setAmount($cheque->getAmount());
|
||||
$entityManager->persist($hesabdariDoc);
|
||||
$entityManager->persist($hesabdariDoc);
|
||||
|
||||
|
||||
|
||||
// ایجاد سطرهای حسابداری جدید
|
||||
$hesabdariRow1 = new HesabdariRow;
|
||||
$hesabdariRow1->setDoc($hesabdariDoc);
|
||||
$hesabdariRow1->setCheque($cheque);
|
||||
$hesabdariRow1->setPerson($cheque->getPerson());
|
||||
$hesabdariRow1->setYear($acc['year']);
|
||||
$hesabdariRow1->setBs($cheque->getAmount());
|
||||
$hesabdariRow1->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 125]));
|
||||
$hesabdariRow1->setBd(0);
|
||||
$hesabdariRow1->setBid($acc['bid']);
|
||||
$hesabdariRow1->setCheque($cheque);
|
||||
$hesabdariRow1->setDes('دریافت چک شماره ' . $cheque->getNumber() . ' از ' . $cheque->getPerson()->getNikename());
|
||||
$entityManager->persist($hesabdariRow1);
|
||||
|
||||
$hesabdariRow2 = new HesabdariRow;
|
||||
$hesabdariRow2->setDoc($hesabdariDoc);
|
||||
$hesabdariRow2->setCheque($cheque);
|
||||
$hesabdariRow2->setBank($cheque->getBank());
|
||||
$hesabdariRow2->setYear($acc['year']);
|
||||
$hesabdariRow2->setBs(0);
|
||||
$hesabdariRow2->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 126]));
|
||||
$hesabdariRow2->setBd($cheque->getAmount());
|
||||
$hesabdariRow2->setBid($acc['bid']);
|
||||
$hesabdariRow2->setCheque($cheque);
|
||||
$hesabdariRow2->setDes('دریافت چک شماره ' . $cheque->getNumber() . ' از ' . $cheque->getPerson()->getNikename());
|
||||
$entityManager->persist($hesabdariRow2);
|
||||
|
||||
$entityManager->flush();
|
||||
|
||||
$log->insert(
|
||||
'بانکداری',
|
||||
'دریافت چک شماره ' . $cheque->getNumber() . ' بانک ' . $cheque->getBankoncheque() . ' از ' . $cheque->getPerson()->getNikename(),
|
||||
$this->getUser(),
|
||||
$acc['bid']->getId(),
|
||||
$hesabdariDoc
|
||||
);
|
||||
return $this->json(['result' => 'ok']);
|
||||
}
|
||||
|
||||
#[Route('/api/cheque/input/get/{id}', name: 'app_cheque_input_get')]
|
||||
public function app_cheque_input_get(string $id, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$cheque = $entityManager->getRepository(Cheque::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'id' => $id
|
||||
]);
|
||||
|
||||
if (!$cheque)
|
||||
throw $this->createNotFoundException('چک مورد نظر یافت نشد');
|
||||
|
||||
$chequeData = [
|
||||
'id' => $cheque->getId(),
|
||||
'number' => $cheque->getNumber(),
|
||||
'amount' => $cheque->getAmount(),
|
||||
'type' => $cheque->getType(),
|
||||
'status' => $cheque->getStatus(),
|
||||
'bankoncheque' => $cheque->getBankoncheque(),
|
||||
'sayadNumber' => $cheque->getSayadNum(),
|
||||
'dueDate' => $cheque->getPayDate(),
|
||||
'description' => $cheque->getDes(),
|
||||
'locked' => $cheque->isLocked(),
|
||||
'rejected' => $cheque->isRejected(),
|
||||
'dateSubmit' => $cheque->getDateSubmit(),
|
||||
'dateStamp' => $cheque->getDateStamp(),
|
||||
'person' => [
|
||||
'id' => $cheque->getPerson()->getId(),
|
||||
'name' => $cheque->getPerson()->getNikename()
|
||||
],
|
||||
'bank' => $cheque->getBank() ? [
|
||||
'id' => $cheque->getBank()->getId(),
|
||||
'name' => $cheque->getBank()->getName(),
|
||||
'code' => $cheque->getBank()->getCode()
|
||||
] : null
|
||||
];
|
||||
|
||||
return $this->json($chequeData);
|
||||
}
|
||||
|
||||
#[Route('/api/cheque/unreject/{id}', name: 'app_cheque_unreject')]
|
||||
public function app_cheque_unreject(string $id, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$cheque = $entityManager->getRepository(Cheque::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'id' => $id
|
||||
]);
|
||||
|
||||
if (!$cheque)
|
||||
throw $this->createNotFoundException('چک مورد نظر یافت نشد');
|
||||
|
||||
if (!$cheque->isRejected())
|
||||
throw $this->createAccessDeniedException('این چک برگشت نخورده است');
|
||||
|
||||
$cheque->setStatus('پاس نشده');
|
||||
$cheque->setRejected(false);
|
||||
|
||||
$log->insert(
|
||||
'بانکداری',
|
||||
'رفع برگشت چک شماره ' . $cheque->getNumber() . ' از ' . $cheque->getPerson()->getNikename(),
|
||||
$this->getUser(),
|
||||
$acc['bid']->getId()
|
||||
);
|
||||
|
||||
$entityManager->persist($cheque);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->json(['result' => 'ok']);
|
||||
}
|
||||
|
||||
#[Route('/api/cheque/input/delete/{id}', name: 'app_cheque_input_delete')]
|
||||
public function app_cheque_input_delete(string $id, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cheque');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$cheque = $entityManager->getRepository(Cheque::class)->findOneBy(['bid' => $request->headers->get('activeBid'), 'id' => $id]);
|
||||
if (!$cheque) {
|
||||
throw new NotFoundHttpException('چک مورد نظر یافت نشد');
|
||||
}
|
||||
|
||||
if ($cheque->isLocked() || $cheque->isRejected()) {
|
||||
throw new AccessDeniedException('امکان حذف این چک وجود ندارد');
|
||||
}
|
||||
|
||||
$hesabdariRow = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
|
||||
'cheque' => $cheque,
|
||||
'bid' => $acc['bid']
|
||||
]);
|
||||
$hesabdariDoc = $hesabdariRow ? $hesabdariRow->getDoc() : null;
|
||||
if ($hesabdariDoc) {
|
||||
// حذف سطرهای حسابداری
|
||||
$oldRows = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc' => $hesabdariDoc]);
|
||||
foreach ($oldRows as $row) {
|
||||
$entityManager->remove($row);
|
||||
}
|
||||
|
||||
// بهروزرسانی لاگهای مرتبط با سند
|
||||
$logs = $entityManager->getRepository(\App\Entity\Log::class)->findBy(['doc' => $hesabdariDoc]);
|
||||
foreach ($logs as $logEntry) {
|
||||
$logEntry->setDoc(null);
|
||||
$entityManager->persist($logEntry);
|
||||
}
|
||||
|
||||
// حذف سند حسابداری
|
||||
$code = $hesabdariDoc->getCode();
|
||||
$entityManager->remove($hesabdariDoc);
|
||||
}
|
||||
$entityManager->remove($cheque);
|
||||
$entityManager->flush();
|
||||
|
||||
$log->insert(
|
||||
'بانکداری',
|
||||
'حذف چک شماره ' . $cheque->getNumber() . ' از ' . $cheque->getPerson()->getNikename() . ' و سند حسابداری ' . $code,
|
||||
$this->getUser(),
|
||||
$request->headers->get('activeBid')
|
||||
);
|
||||
|
||||
return $this->json(['result' => 'ok']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -482,9 +482,7 @@ export default {
|
|||
transactionFilters: null,
|
||||
sortBy: null
|
||||
});
|
||||
|
||||
console.log('پاسخ API:', response.data);
|
||||
|
||||
|
||||
if (response.data && Array.isArray(response.data)) {
|
||||
this.items = response.data;
|
||||
this.totalItems = response.data.length;
|
||||
|
|
|
@ -666,8 +666,16 @@ const fa_lang = {
|
|||
sms_settings_repservice_get: "دریافت کالا",
|
||||
sms_settings_repservice_repired: "اعلام تعمیر",
|
||||
sms_settings_repservice_unrepaired: "اعلام غیر قابل تعمیر",
|
||||
sms_settings_repservice_getback: "تخویل کالا",
|
||||
sms_settings_repservice_getback: "تحویل کالا",
|
||||
sms_settings_repservice_creating: "در حال ساخت",
|
||||
sms_settings_repservice_repaired: "تعمیر شده",
|
||||
sms_settings_repservice_repaired_accpro: "تعمیر شده",
|
||||
sms_settings_cheque_input: "دریافت چک",
|
||||
sms_settings_pass_cheque_input: "واگذاری چک",
|
||||
sms_settings_plug_accpro_cheque_input: "دریافت چک",
|
||||
sms_settings_plug_accpro_pass_cheque_input: "واگذاری چک",
|
||||
sms_settings_reject_cheque_input: "برگشت چک",
|
||||
sms_settings_plug_accpro_reject_cheque_input: "برگشت چک",
|
||||
app_site: "آدرس اینترفیس(رابط کاربری)",
|
||||
keywords: "کلیدواژهها با کاما (,) از هم جدا شوند",
|
||||
zarinpal_api: "کد API زرینپال",
|
||||
|
|
|
@ -575,6 +575,12 @@ const router = createRouter({
|
|||
component: () =>
|
||||
import('../views/acc/cheque/list.vue'),
|
||||
},
|
||||
{
|
||||
path: 'cheque/transfer/:id',
|
||||
name: 'cheque_transfer',
|
||||
component: () =>
|
||||
import('../views/acc/cheque/transfer.vue'),
|
||||
},
|
||||
{
|
||||
path: 'buy/mod/:id?',
|
||||
name: 'buy_mod',
|
||||
|
|
|
@ -9,6 +9,18 @@
|
|||
</v-tooltip>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<v-tooltip text="اطلاع رسانی پیامک به مشتری" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<div v-bind="props" class="d-flex align-center">
|
||||
<v-switch v-model="form.sendSms" hide-details color="primary" class="mx-2">
|
||||
<template v-slot:label>
|
||||
<v-icon icon="mdi-message-text" :color="form.sendSms ? 'primary' : 'grey'"></v-icon>
|
||||
</template>
|
||||
</v-switch>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</v-tooltip>
|
||||
<v-tooltip :text="$route.params.id ? 'ویرایش' : 'ثبت'" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" color="success" @click="submitForm" :loading="loading" icon="mdi-content-save" />
|
||||
|
@ -31,7 +43,7 @@
|
|||
</v-col>
|
||||
|
||||
<v-col cols="12" md="6">
|
||||
<v-text-field v-model="form.bankName" label="نام بانک" :rules="[v => !!v || 'نام بانک الزامی است']"
|
||||
<v-text-field v-model="form.bankoncheque" label="نام بانک" :rules="[v => !!v || 'نام بانک الزامی است']"
|
||||
required></v-text-field>
|
||||
</v-col>
|
||||
|
||||
|
@ -40,6 +52,11 @@
|
|||
required></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" md="6">
|
||||
<v-text-field v-model="form.sayadNumber" label="شماره صیاد" :rules="[v => !!v || 'شماره صیاد الزامی است']"
|
||||
required></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" md="6">
|
||||
<Hdatepicker v-model="form.dueDate" label="تاریخ سررسید" :rules="[v => !!v || 'تاریخ سررسید الزامی است']"
|
||||
required></Hdatepicker>
|
||||
|
@ -58,6 +75,7 @@
|
|||
<script>
|
||||
import Hdatepicker from '@/components/forms/Hdatepicker.vue'
|
||||
import Hpersonsearch from '@/components/forms/Hpersonsearch.vue'
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
components: {
|
||||
Hdatepicker,
|
||||
|
@ -68,10 +86,13 @@ export default {
|
|||
loading: false,
|
||||
form: {
|
||||
chequeNumber: '',
|
||||
bankName: '',
|
||||
bankoncheque: '',
|
||||
amount: '',
|
||||
dueDate: '',
|
||||
description: ''
|
||||
description: '',
|
||||
sayadNumber: '',
|
||||
personId: null,
|
||||
sendSms: localStorage.getItem('chequeSendSms') === 'true' || false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -80,12 +101,34 @@ export default {
|
|||
async submitForm() {
|
||||
try {
|
||||
this.loading = true
|
||||
// ذخیره تنظیمات در localStorage
|
||||
localStorage.setItem('chequeSendSms', this.form.sendSms)
|
||||
if (this.$route.params.id) {
|
||||
// ویرایش چک
|
||||
await this.$axios.put(`/api/cheques/${this.$route.params.id}`, this.form)
|
||||
await axios.put(`/api/cheque/modify/input/${this.$route.params.id}`, {
|
||||
number: this.form.chequeNumber,
|
||||
amount: this.form.amount,
|
||||
date: this.form.dueDate,
|
||||
person: { code: this.form.personId },
|
||||
sayadNumber: this.form.sayadNumber,
|
||||
date: this.form.dueDate,
|
||||
description: this.form.description,
|
||||
bankoncheque: this.form.bankoncheque,
|
||||
sendSms: this.form.sendSms
|
||||
})
|
||||
} else {
|
||||
// ثبت چک جدید
|
||||
await this.$axios.post('/api/cheques', this.form)
|
||||
await axios.post('/api/cheque/modify/input', {
|
||||
number: this.form.chequeNumber,
|
||||
amount: this.form.amount,
|
||||
date: this.form.dueDate,
|
||||
person: { code: this.form.personId },
|
||||
sayadNumber: this.form.sayadNumber,
|
||||
date: this.form.dueDate,
|
||||
description: this.form.description,
|
||||
bankoncheque: this.form.bankoncheque,
|
||||
sendSms: this.form.sendSms
|
||||
})
|
||||
}
|
||||
this.$router.push('/acc/cheque/list')
|
||||
} catch (error) {
|
||||
|
@ -99,10 +142,25 @@ export default {
|
|||
async created() {
|
||||
if (this.$route.params.id) {
|
||||
try {
|
||||
const response = await this.$axios.get(`/api/cheques/${this.$route.params.id}`)
|
||||
this.form = response.data
|
||||
const response = await axios.get(`/api/cheque/input/get/${this.$route.params.id}`)
|
||||
const chequeData = response.data
|
||||
this.form = {
|
||||
chequeNumber: chequeData.number,
|
||||
bankoncheque: chequeData.bankoncheque,
|
||||
amount: chequeData.amount,
|
||||
dueDate: chequeData.dueDate,
|
||||
description: chequeData.description,
|
||||
sayadNumber: chequeData.sayadNumber,
|
||||
personId: chequeData.person.id,
|
||||
sendSms: chequeData.sendSms || false
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
await Swal.fire({
|
||||
text: 'خطا در دریافت اطلاعات چک',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'قبول'
|
||||
})
|
||||
this.$router.push('/acc/cheque/list')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</v-tabs>
|
||||
</template>
|
||||
<v-spacer />
|
||||
<v-menu v-if="1===2">
|
||||
<v-menu>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" color="primary" variant="text" icon="mdi-plus" />
|
||||
</template>
|
||||
|
@ -44,6 +44,23 @@
|
|||
</v-menu>
|
||||
</v-toolbar>
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar.show"
|
||||
:color="snackbar.color"
|
||||
:timeout="3000"
|
||||
>
|
||||
{{ snackbar.text }}
|
||||
<template v-slot:actions>
|
||||
<v-btn
|
||||
color="white"
|
||||
variant="text"
|
||||
@click="snackbar.show = false"
|
||||
>
|
||||
بستن
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
|
||||
<v-window v-model="tab">
|
||||
<v-window-item value="input">
|
||||
<v-text-field class="pt-1" v-model="searchValueInput" prepend-inner-icon="mdi-magnify" label="جست و جو"
|
||||
|
@ -53,11 +70,51 @@
|
|||
density="comfortable" class="elevation-1" :header-props="{ class: 'custom-header' }">
|
||||
<template v-slot:item.operation="{ item }">
|
||||
<div class="d-flex">
|
||||
<pass-check v-if="!item.locked" :windows-state="passChequeWindowsState" :id="item.id" />
|
||||
<v-btn v-if="!item.rejected && !item.locked" icon variant="text" color="error" size="small"
|
||||
@click="rejectCheque(item.id)" title="برگشت چک">
|
||||
<v-icon>mdi-arrow-left</v-icon>
|
||||
</v-btn>
|
||||
<v-menu>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" icon variant="text" size="small" color="error">
|
||||
<v-icon>mdi-menu</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item v-if="!item.rejected && item.status !== 'پاس شده'" @click="$router.push(`/acc/cheque/input/${item.id}`)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="primary">mdi-pencil</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>ویرایش چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!item.locked && !item.rejected" @click="deleteCheque(item)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="error">mdi-delete</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>حذف چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!item.locked" @click="openPassDialog(item.id)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="success">mdi-bank-check</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>پاس کردن چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="item.rejected" @click="unrejectCheque(item)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="success">mdi-arrow-right</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>رفع برگشت</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-else-if="!item.locked" @click="rejectCheque(item)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="error">mdi-arrow-left</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>برگشت چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!item.locked && !item.rejected" @click="$router.push(`/acc/cheque/transfer/${item.id}`)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="info">mdi-account-arrow-right</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>واگذاری چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -77,11 +134,51 @@
|
|||
show-index density="comfortable" class="elevation-1" :header-props="{ class: 'custom-header' }">
|
||||
<template v-slot:item.operation="{ item }">
|
||||
<div class="d-flex">
|
||||
<pass-check v-if="!item.locked" :windows-state="passChequeWindowsState" :id="item.id" />
|
||||
<v-btn v-if="!item.rejected && !item.locked" icon variant="text" color="error" size="small"
|
||||
@click="rejectCheque(item.id)" title="برگشت چک">
|
||||
<v-icon>mdi-arrow-left</v-icon>
|
||||
</v-btn>
|
||||
<v-menu>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" icon variant="text" size="small" color="error">
|
||||
<v-icon>mdi-menu</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item v-if="!item.rejected && item.status !== 'پاس شده'" @click="$router.push(`/acc/cheque/input/${item.id}`)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="primary">mdi-pencil</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>ویرایش چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!item.locked && !item.rejected" @click="deleteCheque(item)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="error">mdi-delete</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>حذف چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!item.locked" @click="openPassDialog(item.id)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="success">mdi-bank-check</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>پاس کردن چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="item.rejected" @click="unrejectCheque(item)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="success">mdi-arrow-right</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>رفع برگشت</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-else-if="!item.locked" @click="rejectCheque(item)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="error">mdi-arrow-left</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>برگشت چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!item.locked && !item.rejected" @click="$router.push(`/acc/cheque/transfer/${item.id}`)">
|
||||
<template v-slot:prepend>
|
||||
<v-icon color="info">mdi-account-arrow-right</v-icon>
|
||||
</template>
|
||||
<v-list-item-title>واگذاری چک</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -93,32 +190,150 @@
|
|||
</v-data-table>
|
||||
</v-window-item>
|
||||
</v-window>
|
||||
|
||||
<!-- دیالوگ پاس کردن چک -->
|
||||
<v-dialog v-model="passDialog" max-width="500px">
|
||||
<v-card>
|
||||
<v-toolbar color="toolbar" title="پاس کردن چک">
|
||||
<template v-slot:append>
|
||||
<v-tooltip text="ثبت" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" color="success" :loading="passLoading" @click="passCheque" icon="mdi-content-save" />
|
||||
</template>
|
||||
</v-tooltip>
|
||||
<v-tooltip text="بستن" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" icon="mdi-close" variant="text" @click="closePassDialog" />
|
||||
</template>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card-text class="pt-4">
|
||||
<v-form @submit.prevent="passCheque">
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<Hdatepicker
|
||||
v-model="passDate"
|
||||
label="تاریخ"
|
||||
:min="year.start"
|
||||
:max="year.end"
|
||||
required
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-select
|
||||
v-model="bankSelected"
|
||||
:items="banks"
|
||||
item-title="name"
|
||||
item-value="id"
|
||||
label="بانک"
|
||||
:rules="[v => !!v || 'انتخاب بانک الزامی است']"
|
||||
required
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
v-model="passDescription"
|
||||
label="توضیحات"
|
||||
variant="outlined"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-switch
|
||||
v-model="sendPassSms"
|
||||
color="primary"
|
||||
label="ارسال پیامک اطلاعرسانی به مشتری"
|
||||
hide-details
|
||||
></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<!-- دیالوگ تایید حذف چک -->
|
||||
<v-dialog v-model="deleteDialog" max-width="400px">
|
||||
<v-card>
|
||||
<v-card-title class="text-h5 d-flex align-center">
|
||||
<v-icon color="error" class="ml-2">mdi-alert-circle</v-icon>
|
||||
هشدار
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<div class="text-subtitle-1 mb-2">آیا از حذف این چک اطمینان دارید؟</div>
|
||||
<div class="text-body-2 text-error">
|
||||
<v-icon color="error" size="small" class="ml-1">mdi-information</v-icon>
|
||||
این عملیات غیر قابل بازگشت است
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" variant="text" @click="confirmDelete">
|
||||
<v-icon start>mdi-delete</v-icon>
|
||||
حذف
|
||||
</v-btn>
|
||||
<v-btn color="primary" variant="text" @click="deleteDialog = false">
|
||||
<v-icon start>mdi-close</v-icon>
|
||||
انصراف
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<!-- دیالوگ تایید برگشت چک -->
|
||||
<v-dialog v-model="rejectDialog" max-width="400px">
|
||||
<v-card>
|
||||
<v-toolbar color="toolbar" title="تایید برگشت چک">
|
||||
<template v-slot:append>
|
||||
<v-tooltip text="بستن" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" icon="mdi-close" variant="text" @click="rejectDialog = false" />
|
||||
</template>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card-text>
|
||||
<div class="text-subtitle-1 mb-2">آیا از برگشت این چک اطمینان دارید؟</div>
|
||||
<v-switch
|
||||
v-model="sendSms"
|
||||
color="primary"
|
||||
label="ارسال پیامک اطلاعرسانی به مشتری"
|
||||
hide-details
|
||||
class="mt-4"
|
||||
></v-switch>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" variant="text" @click="confirmReject">
|
||||
<v-icon start>mdi-arrow-left</v-icon>
|
||||
برگشت چک
|
||||
</v-btn>
|
||||
<v-btn color="primary" variant="text" @click="rejectDialog = false">
|
||||
<v-icon start>mdi-close</v-icon>
|
||||
انصراف
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import Swal from "sweetalert2";
|
||||
import { ref } from "vue";
|
||||
import passCheck from "../component/cheque/passCheck.vue";
|
||||
import Hdatepicker from '@/components/forms/Hdatepicker.vue';
|
||||
|
||||
export default {
|
||||
name: "list",
|
||||
components: {
|
||||
passCheck
|
||||
},
|
||||
watch: {
|
||||
'passChequeWindowsState.submited'(newValue) {
|
||||
this.passChequeWindowsState.submited = false;
|
||||
if (newValue) {
|
||||
this.loadData();
|
||||
}
|
||||
}
|
||||
Hdatepicker
|
||||
},
|
||||
data: () => ({
|
||||
tab: 'input',
|
||||
passChequeWindowsState: {
|
||||
submited: false
|
||||
},
|
||||
loading: ref(true),
|
||||
searchValueInput: '',
|
||||
searchValueOutput: '',
|
||||
|
@ -135,7 +350,33 @@ export default {
|
|||
{ title: "وضعیت", key: "status", width: "150", sortable: true },
|
||||
{ title: "تاریخ وصول", key: "date", width: "150" },
|
||||
{ title: "توضیحات", key: "des", width: "150" },
|
||||
]
|
||||
],
|
||||
// متغیرهای مربوط به پاس کردن چک
|
||||
passDialog: false,
|
||||
passLoading: false,
|
||||
passDate: '',
|
||||
bankSelected: null,
|
||||
passDescription: '',
|
||||
banks: [],
|
||||
year: {
|
||||
start: '',
|
||||
end: '',
|
||||
now: ''
|
||||
},
|
||||
selectedChequeId: null,
|
||||
snackbar: {
|
||||
show: false,
|
||||
text: '',
|
||||
color: 'success'
|
||||
},
|
||||
// متغیرهای مربوط به حذف چک
|
||||
deleteDialog: false,
|
||||
selectedChequeForDelete: null,
|
||||
// متغیرهای مربوط به برگشت چک
|
||||
rejectDialog: false,
|
||||
selectedChequeForReject: null,
|
||||
sendSms: true,
|
||||
sendPassSms: true,
|
||||
}),
|
||||
methods: {
|
||||
getStatusColor(status) {
|
||||
|
@ -164,32 +405,150 @@ export default {
|
|||
this.loading = false;
|
||||
});
|
||||
},
|
||||
rejectCheque(id) {
|
||||
this.loading = true;
|
||||
axios.post('/api/cheque/info/' + id).then(() => {
|
||||
this.loading = false;
|
||||
Swal.fire({
|
||||
title: "آیا برای تغییر وضعیت چک به برگشتی مطمئن هستید؟",
|
||||
icon: "question",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
showCancelButton: true,
|
||||
showCloseButton: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
this.loading = true;
|
||||
axios.post('/api/cheque/reject/' + id).then(() => {
|
||||
this.loading = false;
|
||||
Swal.fire({
|
||||
title: "وضعیت چک تغییر یافت",
|
||||
icon: "success",
|
||||
confirmButtonText: "بله",
|
||||
});
|
||||
this.loadData();
|
||||
});
|
||||
}
|
||||
async rejectCheque(item) {
|
||||
this.selectedChequeForReject = item;
|
||||
this.rejectDialog = true;
|
||||
},
|
||||
async confirmReject() {
|
||||
try {
|
||||
this.loading = true;
|
||||
await axios.post(`/api/cheque/reject/${this.selectedChequeForReject.id}`, {
|
||||
sendSms: this.sendSms
|
||||
});
|
||||
});
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'ثبت برگشت چک با موفقیت انجام شد',
|
||||
color: 'success'
|
||||
};
|
||||
this.loadData();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'خطا در ثبت برگشت چک',
|
||||
color: 'error'
|
||||
};
|
||||
} finally {
|
||||
this.loading = false;
|
||||
this.rejectDialog = false;
|
||||
this.selectedChequeForReject = null;
|
||||
this.sendSms = true;
|
||||
}
|
||||
},
|
||||
async unrejectCheque(item) {
|
||||
try {
|
||||
this.loading = true;
|
||||
await axios.post(`/api/cheque/unreject/${item.id}`);
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'رفع برگشت چک با موفقیت انجام شد',
|
||||
color: 'success'
|
||||
};
|
||||
this.loadData();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'خطا در رفع برگشت چک',
|
||||
color: 'error'
|
||||
};
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// متدهای مربوط به پاس کردن چک
|
||||
async openPassDialog(id) {
|
||||
this.selectedChequeId = id;
|
||||
this.passDialog = true;
|
||||
await this.loadPassData();
|
||||
},
|
||||
closePassDialog() {
|
||||
this.passDialog = false;
|
||||
this.bankSelected = null;
|
||||
this.passDescription = '';
|
||||
this.sendPassSms = true;
|
||||
},
|
||||
async loadPassData() {
|
||||
try {
|
||||
this.passLoading = true;
|
||||
const [banksResponse, yearResponse] = await Promise.all([
|
||||
axios.post('/api/bank/list'),
|
||||
axios.post('/api/year/get')
|
||||
]);
|
||||
|
||||
this.banks = banksResponse.data;
|
||||
this.year = yearResponse.data;
|
||||
this.passDate = yearResponse.data.now;
|
||||
} catch (error) {
|
||||
console.error('خطا در بارگذاری اطلاعات:', error);
|
||||
} finally {
|
||||
this.passLoading = false;
|
||||
}
|
||||
},
|
||||
async passCheque() {
|
||||
if (!this.bankSelected) {
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'بانک انتخاب نشده است',
|
||||
color: 'error'
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.passLoading = true;
|
||||
await axios.post(`/api/cheque/pass/${this.selectedChequeId}`, {
|
||||
bank: this.bankSelected,
|
||||
date: this.passDate,
|
||||
des: this.passDescription,
|
||||
sendSms: this.sendPassSms
|
||||
});
|
||||
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'ثبت وصول چک با موفقیت ثبت شد',
|
||||
color: 'success'
|
||||
};
|
||||
|
||||
this.closePassDialog();
|
||||
this.loadData();
|
||||
} catch (error) {
|
||||
console.error('خطا در ثبت اطلاعات:', error);
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'خطا در ثبت اطلاعات',
|
||||
color: 'error'
|
||||
};
|
||||
} finally {
|
||||
this.passLoading = false;
|
||||
}
|
||||
},
|
||||
async deleteCheque(item) {
|
||||
this.selectedChequeForDelete = item;
|
||||
this.deleteDialog = true;
|
||||
},
|
||||
async confirmDelete() {
|
||||
try {
|
||||
this.loading = true;
|
||||
await axios.post(`/api/cheque/input/delete/${this.selectedChequeForDelete.id}`);
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'حذف چک با موفقیت انجام شد',
|
||||
color: 'success'
|
||||
};
|
||||
this.loadData();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'خطا در حذف چک',
|
||||
color: 'error'
|
||||
};
|
||||
} finally {
|
||||
this.loading = false;
|
||||
this.deleteDialog = false;
|
||||
this.selectedChequeForDelete = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
|
@ -202,4 +561,7 @@ export default {
|
|||
.v-data-table {
|
||||
direction: rtl;
|
||||
}
|
||||
.bg-primary-light {
|
||||
background-color: var(--v-primary-lighten1);
|
||||
}
|
||||
</style>
|
209
webUI/src/views/acc/cheque/transfer.vue
Normal file
209
webUI/src/views/acc/cheque/transfer.vue
Normal file
|
@ -0,0 +1,209 @@
|
|||
<template>
|
||||
<v-toolbar color="toolbar" title="واگذاری چک">
|
||||
<template v-slot:prepend>
|
||||
<v-tooltip :text="$t('dialog.back')" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" @click="$router.back()" class="d-none d-sm-flex" variant="text"
|
||||
icon="mdi-arrow-right" />
|
||||
</template>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<v-tooltip text="ثبت واگذاری" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn color="success" v-bind="props" @click="submitForm" :loading="loading" variant="text"
|
||||
icon="mdi-content-save" />
|
||||
</template>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-toolbar>
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-expansion-panels>
|
||||
<v-expansion-panel>
|
||||
<v-expansion-panel-title>
|
||||
<v-icon start>mdi-information</v-icon>
|
||||
اطلاعات چک
|
||||
</v-expansion-panel-title>
|
||||
<v-expansion-panel-text>
|
||||
<v-row>
|
||||
<v-col cols="12" sm="6">
|
||||
<div class="text-subtitle-2 text-medium-emphasis">شماره چک</div>
|
||||
<div class="text-body-1 text-primary">{{ chequeInfo.number }}</div>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<div class="text-subtitle-2 text-medium-emphasis">کد صیاد</div>
|
||||
<div class="text-body-1 text-primary">{{ chequeInfo.sayadNum }}</div>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<div class="text-subtitle-2 text-medium-emphasis">مبلغ ({{ activeMoneyShortName }})</div>
|
||||
<div class="text-body-1 text-primary">{{ $filters.formatNumber(chequeInfo.amount) }}</div>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<div class="text-subtitle-2 text-medium-emphasis">تاریخ</div>
|
||||
<div class="text-body-1 text-primary">{{ chequeInfo.datePay }}</div>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<div class="text-subtitle-2 text-medium-emphasis">پرداخت کننده</div>
|
||||
<div class="text-body-1 text-primary">{{ chequeInfo.person?.nikename }}</div>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<div class="text-subtitle-2 text-medium-emphasis">بانک</div>
|
||||
<div class="text-body-1 text-primary">{{ chequeInfo.chequeBank }}</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-expansion-panel-text>
|
||||
</v-expansion-panel>
|
||||
</v-expansion-panels>
|
||||
|
||||
<v-form @submit.prevent="submitForm" class="mt-4">
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-select v-model="selectedPerson" :items="persons" item-title="name" item-value="id"
|
||||
label="شخص گیرنده" :rules="[v => !!v || 'انتخاب شخص گیرنده الزامی است']" required />
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<Hdatepicker v-model="transferDate" label="تاریخ واگذاری" :min="year.start" :max="year.end"
|
||||
required />
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-text-field v-model="description" label="توضیحات" variant="outlined" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<v-snackbar v-model="snackbar.show" :color="snackbar.color" :timeout="3000">
|
||||
{{ snackbar.text }}
|
||||
<template v-slot:actions>
|
||||
<v-btn color="white" variant="text" @click="snackbar.show = false">
|
||||
بستن
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import Hdatepicker from '@/components/forms/Hdatepicker.vue';
|
||||
|
||||
export default {
|
||||
name: "cheque-transfer",
|
||||
components: {
|
||||
Hdatepicker
|
||||
},
|
||||
data: () => ({
|
||||
loading: false,
|
||||
selectedPerson: null,
|
||||
transferDate: '',
|
||||
description: '',
|
||||
persons: [],
|
||||
year: {
|
||||
start: '',
|
||||
end: '',
|
||||
now: ''
|
||||
},
|
||||
snackbar: {
|
||||
show: false,
|
||||
text: '',
|
||||
color: 'success'
|
||||
},
|
||||
chequeInfo: {
|
||||
number: '',
|
||||
sayadNum: '',
|
||||
amount: 0,
|
||||
datePay: '',
|
||||
person: {
|
||||
nikename: ''
|
||||
},
|
||||
chequeBank: ''
|
||||
}
|
||||
}),
|
||||
computed: {
|
||||
activeMoneyShortName() {
|
||||
return window.localStorage.getItem('activeMoneyShortName') || '';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async loadData() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const [personsResponse, yearResponse, chequeResponse] = await Promise.all([
|
||||
axios.post('/api/person/list'),
|
||||
axios.post('/api/year/get'),
|
||||
axios.post(`/api/cheque/input/get/${this.$route.params.id}`)
|
||||
]);
|
||||
|
||||
this.persons = personsResponse.data.items;
|
||||
this.year = yearResponse.data;
|
||||
this.transferDate = yearResponse.data.now;
|
||||
this.chequeInfo = {
|
||||
number: chequeResponse.data.number,
|
||||
sayadNum: chequeResponse.data.sayadNumber,
|
||||
amount: chequeResponse.data.amount,
|
||||
datePay: chequeResponse.data.dueDate,
|
||||
person: {
|
||||
nikename: chequeResponse.data.person.name
|
||||
},
|
||||
chequeBank: chequeResponse.data.bankoncheque
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('خطا در بارگذاری اطلاعات:', error);
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'خطا در بارگذاری اطلاعات',
|
||||
color: 'error'
|
||||
};
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
async submitForm() {
|
||||
if (!this.selectedPerson) {
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'لطفا شخص گیرنده را انتخاب کنید',
|
||||
color: 'error'
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.loading = true;
|
||||
await axios.post(`/api/cheque/transfer/${this.$route.params.id}`, {
|
||||
personId: this.selectedPerson,
|
||||
date: this.transferDate,
|
||||
description: this.description
|
||||
});
|
||||
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'واگذاری چک با موفقیت ثبت شد',
|
||||
color: 'success'
|
||||
};
|
||||
|
||||
setTimeout(() => {
|
||||
this.$router.push('/acc/cheque/list');
|
||||
}, 1500);
|
||||
} catch (error) {
|
||||
console.error('خطا در ثبت اطلاعات:', error);
|
||||
this.snackbar = {
|
||||
show: true,
|
||||
text: 'خطا در ثبت اطلاعات',
|
||||
color: 'error'
|
||||
};
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
this.loadData();
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,144 +1,193 @@
|
|||
<script lang="ts">
|
||||
import axios from 'axios';
|
||||
import {defineComponent,ref} from 'vue'
|
||||
import Swal from "sweetalert2";
|
||||
import { defineComponent, ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import Swal from 'sweetalert2'
|
||||
import Hdatepicker from '@/components/forms/Hdatepicker.vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: "passCheck",
|
||||
props:{
|
||||
id: Number,
|
||||
windowsState: Object,
|
||||
name: 'PassCheck',
|
||||
components: {
|
||||
Hdatepicker
|
||||
},
|
||||
data:()=>{return {
|
||||
loading:ref(true),
|
||||
banks : [],
|
||||
modal:'',
|
||||
bankSelected: null,
|
||||
des:'',
|
||||
passDate:'',
|
||||
year:{
|
||||
start:'',
|
||||
end:'',
|
||||
now:''
|
||||
}
|
||||
}},
|
||||
methods:{
|
||||
loadData(){
|
||||
axios.post('/api/bank/list').then((response) => {
|
||||
this.banks = response.data;
|
||||
this.isLoading = false;
|
||||
});
|
||||
|
||||
//load year
|
||||
axios.post('/api/year/get').then((response)=>{
|
||||
this.year = response.data;
|
||||
this.passDate = response.data.now;
|
||||
});
|
||||
this.loading = false;
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
save(){
|
||||
if(this.bankSelected == '' || this.bankSelected == null){
|
||||
Swal.fire({
|
||||
text:'بانک انتخاب نشده است',
|
||||
icon: 'success',
|
||||
confirmButtonText: 'قبول'
|
||||
})
|
||||
}
|
||||
else{
|
||||
this.loading = true;
|
||||
axios.post('/api/cheque/pass/' + this.$props.id,{
|
||||
bank:this.bankSelected,
|
||||
date:this.passDate,
|
||||
des:this.des
|
||||
}).then((response) => {
|
||||
Swal.fire({
|
||||
text:'ثبت وصول چک با موفقیت ثبت شد.',
|
||||
icon: 'success',
|
||||
confirmButtonText: 'قبول'
|
||||
}).then((result)=>{
|
||||
this.submitedDoc = response.data.doc;
|
||||
let btnClose = document.getElementById('pass-check-btn-close');
|
||||
btnClose.click();
|
||||
this.$props.windowsState.submited = true;
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
windowsState: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
beforeMount(){
|
||||
this.loadData();
|
||||
setup(props) {
|
||||
const dialog = ref(false)
|
||||
const loading = ref(false)
|
||||
const banks = ref([])
|
||||
const bankSelected = ref(null)
|
||||
const des = ref('')
|
||||
const passDate = ref('')
|
||||
const year = ref({
|
||||
start: '',
|
||||
end: '',
|
||||
now: ''
|
||||
})
|
||||
|
||||
const loadData = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
const [banksResponse, yearResponse] = await Promise.all([
|
||||
axios.post('/api/bank/list'),
|
||||
axios.post('/api/year/get')
|
||||
])
|
||||
|
||||
banks.value = banksResponse.data
|
||||
year.value = yearResponse.data
|
||||
passDate.value = yearResponse.data.now
|
||||
} catch (error) {
|
||||
console.error('خطا در بارگذاری اطلاعات:', error)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const openDialog = () => {
|
||||
dialog.value = true
|
||||
loadData()
|
||||
}
|
||||
|
||||
const closeDialog = () => {
|
||||
dialog.value = false
|
||||
bankSelected.value = null
|
||||
des.value = ''
|
||||
}
|
||||
|
||||
const save = async () => {
|
||||
if (!bankSelected.value) {
|
||||
await Swal.fire({
|
||||
text: 'بانک انتخاب نشده است',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'قبول'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
await axios.post(`/api/cheque/pass/${props.id}`, {
|
||||
bank: bankSelected.value,
|
||||
date: passDate.value,
|
||||
des: des.value
|
||||
})
|
||||
|
||||
await Swal.fire({
|
||||
text: 'ثبت وصول چک با موفقیت ثبت شد.',
|
||||
icon: 'success',
|
||||
confirmButtonText: 'قبول'
|
||||
})
|
||||
|
||||
if (props.windowsState) {
|
||||
props.windowsState.submited = true
|
||||
}
|
||||
closeDialog()
|
||||
} catch (error) {
|
||||
console.error('خطا در ثبت اطلاعات:', error)
|
||||
await Swal.fire({
|
||||
text: 'خطا در ثبت اطلاعات',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'قبول'
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
dialog,
|
||||
loading,
|
||||
banks,
|
||||
bankSelected,
|
||||
des,
|
||||
passDate,
|
||||
year,
|
||||
save,
|
||||
openDialog,
|
||||
closeDialog
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openDialog() {
|
||||
this.dialog = true
|
||||
this.loadData()
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialog = false
|
||||
this.bankSelected = null
|
||||
this.des = ''
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Button trigger modal -->
|
||||
<a type="button" class="btn btn-sm btn-link text-primary" title="پاس کردن چک" data-bs-toggle="modal" data-bs-target="#modal-pass-check" >
|
||||
<i class="fa fa-money-bill-trend-up pe-1"></i>
|
||||
</a>
|
||||
<v-dialog v-model="dialog" max-width="500px" @click:outside="closeDialog">
|
||||
<v-card>
|
||||
<v-toolbar color="toolbar" title="پاس کردن چک">
|
||||
<template v-slot:append>
|
||||
<v-tooltip text="ثبت" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" color="success" :loading="loading" @click="save" icon="mdi-content-save" />
|
||||
</template>
|
||||
</v-tooltip>
|
||||
<v-tooltip text="بستن" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" icon="mdi-close" variant="text" @click="closeDialog" />
|
||||
</template>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-toolbar>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="modal-pass-check" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-primary-light text-white">
|
||||
<h1 class="modal-title fs-5" id="staticBackdropLabel">پاس کردن چک</h1>
|
||||
<div class="block-options">
|
||||
<button type="button" id="pass-check-btn-close" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 mb-2">
|
||||
<div class="form-control">
|
||||
<label class="form-label">تاریخ</label>
|
||||
<date-picker
|
||||
class=""
|
||||
v-model="passDate"
|
||||
format="jYYYY/jMM/jDD"
|
||||
display-format="jYYYY/jMM/jDD"
|
||||
:min="year.start"
|
||||
:max="year.end"
|
||||
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 mb-2">
|
||||
<div class="form-control">
|
||||
<label class="form-label">بانک</label>
|
||||
<v-cob
|
||||
dir="rtl"
|
||||
:options="banks"
|
||||
label="name"
|
||||
v-model="bankSelected"
|
||||
>
|
||||
<template #no-options="{ search, searching, loading }">
|
||||
نتیجهای یافت نشد!
|
||||
</template>
|
||||
</v-cob>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 mb-2">
|
||||
<div class="form-control">
|
||||
<label class="form-label">توضیحات</label>
|
||||
<input type="text" class="form-control" v-model="des" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer float-end align-end">
|
||||
<button :disabled="loading" type="button" class="btn btn-success" @click="save()">
|
||||
<i class="fa fa-save pe-2" />
|
||||
ثبت
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<v-card-text class="pt-4">
|
||||
<v-form @submit.prevent="save">
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<Hdatepicker
|
||||
v-model="passDate"
|
||||
label="تاریخ"
|
||||
:min="year.start"
|
||||
:max="year.end"
|
||||
required
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-select
|
||||
v-model="bankSelected"
|
||||
:items="banks"
|
||||
item-title="name"
|
||||
item-value="id"
|
||||
label="بانک"
|
||||
:rules="[v => !!v || 'انتخاب بانک الزامی است']"
|
||||
required
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
v-model="des"
|
||||
label="توضیحات"
|
||||
variant="outlined"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.bg-primary-light {
|
||||
background-color: var(--v-primary-lighten1);
|
||||
}
|
||||
</style>
|
|
@ -33,6 +33,9 @@ export default defineComponent({
|
|||
f2a: '',
|
||||
ticketReplay: '',
|
||||
ticketRec: '',
|
||||
chequeInput: '',
|
||||
passChequeInput: '',
|
||||
rejectChequeInput: '',
|
||||
fromNum: '',
|
||||
sharefaktor: '',
|
||||
username: '',
|
||||
|
@ -49,7 +52,10 @@ export default defineComponent({
|
|||
plugAccpro: {
|
||||
sharefaktor: '',
|
||||
storeroomSmsBarbari: '',
|
||||
storeroomSmsOther: ''
|
||||
storeroomSmsOther: '',
|
||||
chequeInput: '',
|
||||
passChequeInput: '',
|
||||
rejectChequeInput: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +95,7 @@ export default defineComponent({
|
|||
<v-spacer></v-spacer>
|
||||
</v-toolbar>
|
||||
<v-container class="pa-0">
|
||||
<v-card :loading="loading ? 'red' : null" :disabled="loading">
|
||||
<v-card :loading="loading ? 'red' : false" :disabled="loading">
|
||||
<v-card-text class="">
|
||||
<h4 class="text-primary">اطلاعات اپراتور پیامک</h4>
|
||||
<v-row class="mb-2">
|
||||
|
@ -101,12 +107,12 @@ export default defineComponent({
|
|||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_username')"
|
||||
v-model="form.username" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.username > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.username) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_password')"
|
||||
v-model="form.password" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => form.password > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.password) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_token')"
|
||||
|
@ -122,37 +128,52 @@ export default defineComponent({
|
|||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_f2a')" v-model="form.f2a"
|
||||
type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.f2a > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.f2a) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_rec_password')"
|
||||
v-model="form.recPassword" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => form.recPassword > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.recPassword) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_change_password')"
|
||||
v-model="form.changePassword" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => form.changePassword > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.changePassword) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_rec_ticket')"
|
||||
v-model="form.ticketRec" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => form.ticketRec > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.ticketRec) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_replay_ticket')"
|
||||
v-model="form.ticketReplay" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => form.ticketReplay > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.ticketReplay) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_wallet_pay')"
|
||||
v-model="form.walletpay" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => form.walletpay > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.walletpay) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_share_faktor')"
|
||||
v-model="form.sharefaktor" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => form.sharefaktor > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.sharefaktor) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_cheque_input')"
|
||||
v-model="form.chequeInput" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => Number(form.chequeInput) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_pass_cheque_input')"
|
||||
v-model="form.passChequeInput" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => Number(form.passChequeInput) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_reject_cheque_input')"
|
||||
v-model="form.rejectChequeInput" type="text" prepend-inner-icon="mdi-text"
|
||||
:rules="[() => Number(form.rejectChequeInput) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<h4 class="text-primary">افزونه حسابداری پیشرفته</h4>
|
||||
|
@ -160,17 +181,32 @@ export default defineComponent({
|
|||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_share_faktor_accpro')"
|
||||
v-model="form.plugAccpro.sharefaktor" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.plugAccpro.sharefaktor > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.plugAccpro.sharefaktor) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_storeroom_other')"
|
||||
v-model="form.plugAccpro.storeroomSmsOther" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.plugAccpro.storeroomSmsOther > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.plugAccpro.storeroomSmsOther) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_storeroom_barbari')"
|
||||
v-model="form.plugAccpro.storeroomSmsBarbari" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.plugAccpro.storeroomSmsBarbari > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.plugAccpro.storeroomSmsBarbari) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_plug_accpro_cheque_input')"
|
||||
v-model="form.plugAccpro.chequeInput" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => Number(form.plugAccpro.chequeInput) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_pass_cheque_input')"
|
||||
v-model="form.plugAccpro.passChequeInput" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => Number(form.plugAccpro.passChequeInput) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_reject_cheque_input')"
|
||||
v-model="form.plugAccpro.rejectChequeInput" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => Number(form.plugAccpro.rejectChequeInput) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<h4 class="text-primary">افزونه تعمیرکاران</h4>
|
||||
|
@ -178,27 +214,27 @@ export default defineComponent({
|
|||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_repservice_get')"
|
||||
v-model="form.plugRepservice.get" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.plugRepservice.get > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.plugRepservice.get) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_repservice_repired')"
|
||||
v-model="form.plugRepservice.repired" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.plugRepservice.repired > 0 || $t('validator.required')]"></v-text-field>
|
||||
v-model="form.plugRepservice.repaired" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => Number(form.plugRepservice.repaired) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_repservice_unrepaired')"
|
||||
v-model="form.plugRepservice.unrepaired" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.plugRepservice.unrepaired > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.plugRepservice.unrepaired) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_repservice_getback')"
|
||||
v-model="form.plugRepservice.getback" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.plugRepservice.getback > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.plugRepservice.getback) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="4">
|
||||
<v-text-field class="" hide-details="auto" :label="$t('pages.manager.sms_settings_repservice_creating')"
|
||||
v-model="form.plugRepservice.creating" type="text" prepend-inner-icon="mdi-card-text"
|
||||
:rules="[() => form.plugRepservice.creating > 0 || $t('validator.required')]"></v-text-field>
|
||||
:rules="[() => Number(form.plugRepservice.creating) > 0 || $t('validator.required')]"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="12">
|
||||
<v-btn type="submit" @click="submit()" color="primary" prepend-icon="mdi-content-save" :loading="loading">
|
||||
|
|
Loading…
Reference in a new issue