Merge branch 'master' of https://source.hesabix.ir/morrning/hesabixCore
This commit is contained in:
commit
8ff15b1e67
|
@ -134,16 +134,6 @@ class ApprovalController extends AbstractController
|
||||||
$entityManager->persist($payment);
|
$entityManager->persist($payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
|
||||||
'doc' => $document
|
|
||||||
]);
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$row->setIsPreview(false);
|
|
||||||
$row->setIsApproved(true);
|
|
||||||
$row->setApprovedBy($user);
|
|
||||||
$entityManager->persist($row);
|
|
||||||
}
|
|
||||||
|
|
||||||
$entityManager->persist($document);
|
$entityManager->persist($document);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
|
@ -227,16 +217,6 @@ class ApprovalController extends AbstractController
|
||||||
$entityManager->persist($payment);
|
$entityManager->persist($payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
|
||||||
'doc' => $document
|
|
||||||
]);
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$row->setIsPreview(false);
|
|
||||||
$row->setIsApproved(true);
|
|
||||||
$row->setApprovedBy($user);
|
|
||||||
$entityManager->persist($row);
|
|
||||||
}
|
|
||||||
|
|
||||||
$entityManager->persist($document);
|
$entityManager->persist($document);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
|
@ -313,16 +293,6 @@ class ApprovalController extends AbstractController
|
||||||
$entityManager->persist($payment);
|
$entityManager->persist($payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
|
||||||
'doc' => $document
|
|
||||||
]);
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$row->setIsPreview(true);
|
|
||||||
$row->setIsApproved(false);
|
|
||||||
$row->setApprovedBy(null);
|
|
||||||
$entityManager->persist($row);
|
|
||||||
}
|
|
||||||
|
|
||||||
$entityManager->persist($document);
|
$entityManager->persist($document);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ use App\Entity\HesabdariDoc;
|
||||||
use App\Entity\PluginTaxInvoice;
|
use App\Entity\PluginTaxInvoice;
|
||||||
use App\Dto\TaxSettingsDto;
|
use App\Dto\TaxSettingsDto;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
use App\Entity\User;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
class TaxSettingsController extends AbstractController
|
class TaxSettingsController extends AbstractController
|
||||||
|
@ -34,6 +35,45 @@ class TaxSettingsController extends AbstractController
|
||||||
return $sandboxMode ? 'https://sandboxrc.tax.gov.ir/' : 'https://tp.tax.gov.ir/';
|
return $sandboxMode ? 'https://sandboxrc.tax.gov.ir/' : 'https://tp.tax.gov.ir/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getTaxSettings(EntityManagerInterface $em, int $businessId, User $user): array
|
||||||
|
{
|
||||||
|
$perm = $em->getRepository(Permission::class)->findOneBy([
|
||||||
|
'bid' => $businessId,
|
||||||
|
'user' => $user
|
||||||
|
]);
|
||||||
|
|
||||||
|
$business = $em->getRepository(Business::class)->find($businessId);
|
||||||
|
|
||||||
|
if ($business->getOwner() == $user) {
|
||||||
|
$repo = $em->getRepository(PluginTaxsettingsKey::class);
|
||||||
|
$entity = $repo->findOneBy(['business_id' => $businessId]);
|
||||||
|
|
||||||
|
$settings = [
|
||||||
|
'taxMemoryId' => $entity ? $entity->getTaxMemoryId() : '',
|
||||||
|
'economicCode' => $entity ? $entity->getEconomicCode() : '',
|
||||||
|
'privateKey' => $entity ? $entity->getPrivateKey() : '',
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
if (!$perm || !$perm->isPlugTaxSettings()) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'شما دسترسی لازم را ندارید.'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$repo = $em->getRepository(PluginTaxsettingsKey::class);
|
||||||
|
$entity = $repo->findOneBy(['business_id' => $businessId]);
|
||||||
|
|
||||||
|
$settings = [
|
||||||
|
'taxMemoryId' => $entity ? $entity->getTaxMemoryId() : '',
|
||||||
|
'economicCode' => $entity ? $entity->getEconomicCode() : '',
|
||||||
|
'privateKey' => $entity ? $entity->getPrivateKey() : '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $settings;
|
||||||
|
}
|
||||||
|
|
||||||
#[Route('/api/plugins/tax/settings/get', name: 'plugin_tax_settings_get', methods: ['GET'])]
|
#[Route('/api/plugins/tax/settings/get', name: 'plugin_tax_settings_get', methods: ['GET'])]
|
||||||
public function plugin_tax_settings_get(EntityManagerInterface $em, Access $access): JsonResponse
|
public function plugin_tax_settings_get(EntityManagerInterface $em, Access $access): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -45,40 +85,7 @@ class TaxSettingsController extends AbstractController
|
||||||
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
$perm = $em->getRepository(Permission::class)->findOneBy([
|
$settings = $this->getTaxSettings($em, $businessId, $user);
|
||||||
'bid' => $businessId,
|
|
||||||
'user' => $user
|
|
||||||
]);
|
|
||||||
|
|
||||||
$business = $em->getRepository(Business::class)->find($businessId);
|
|
||||||
|
|
||||||
if ($business->getOwner() == $user) {
|
|
||||||
$repo = $em->getRepository(PluginTaxsettingsKey::class);
|
|
||||||
$entity = $repo->findOneBy(['business_id' => $businessId]);
|
|
||||||
|
|
||||||
$settings = [
|
|
||||||
'taxMemoryId' => $entity ? $entity->getTaxMemoryId() : '',
|
|
||||||
'economicCode' => $entity ? $entity->getEconomicCode() : '',
|
|
||||||
'privateKey' => $entity ? $entity->getPrivateKey() : '',
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
if (!$perm || !$perm->isPlugTaxSettings()) {
|
|
||||||
return $this->json([
|
|
||||||
'success' => false,
|
|
||||||
'message' => 'شما دسترسی لازم را ندارید.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$repo = $em->getRepository(PluginTaxsettingsKey::class);
|
|
||||||
$entity = $repo->findOneBy(['business_id' => $businessId]);
|
|
||||||
|
|
||||||
$settings = [
|
|
||||||
'taxMemoryId' => $entity ? $entity->getTaxMemoryId() : '',
|
|
||||||
'economicCode' => $entity ? $entity->getEconomicCode() : '',
|
|
||||||
'privateKey' => $entity ? $entity->getPrivateKey() : '',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return $this->json($settings);
|
return $this->json($settings);
|
||||||
}
|
}
|
||||||
|
@ -777,7 +784,6 @@ class TaxSettingsController extends AbstractController
|
||||||
|
|
||||||
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$userId = $user instanceof \App\Entity\User ? $user->getId() : null;
|
|
||||||
|
|
||||||
$taxInvoiceRepo = $em->getRepository(PluginTaxInvoice::class);
|
$taxInvoiceRepo = $em->getRepository(PluginTaxInvoice::class);
|
||||||
$taxInvoice = $taxInvoiceRepo->findOneBy([
|
$taxInvoice = $taxInvoiceRepo->findOneBy([
|
||||||
|
@ -801,10 +807,9 @@ class TaxSettingsController extends AbstractController
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$repo = $em->getRepository(PluginTaxsettingsKey::class);
|
$taxSettings = $this->getTaxSettings($em, $businessId, $user);
|
||||||
$taxSettings = $repo->findOneBy(['business_id' => $businessId, 'user_id' => $userId]);
|
|
||||||
|
|
||||||
if (!$taxSettings || !$taxSettings->getPrivateKey() || !$taxSettings->getTaxMemoryId()) {
|
if (!$taxSettings['privateKey'] || !$taxSettings['taxMemoryId']) {
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => 'تنظیمات مالیاتی تکمیل نشده است. لطفاً ابتدا تنظیمات را تکمیل کنید.'
|
'message' => 'تنظیمات مالیاتی تکمیل نشده است. لطفاً ابتدا تنظیمات را تکمیل کنید.'
|
||||||
|
@ -812,8 +817,8 @@ class TaxSettingsController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$username = $taxSettings->getTaxMemoryId();
|
$username = $taxSettings['taxMemoryId'];
|
||||||
$privateKey = $taxSettings->getPrivateKey();
|
$privateKey = $taxSettings['privateKey'];
|
||||||
|
|
||||||
if (!$username || !$privateKey) {
|
if (!$username || !$privateKey) {
|
||||||
return $this->json([
|
return $this->json([
|
||||||
|
@ -872,7 +877,7 @@ class TaxSettingsController extends AbstractController
|
||||||
throw new \Exception($validationResult['message']);
|
throw new \Exception($validationResult['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoiceDto = $this->buildInvoiceDto($invoice, $moadian, $taxSettings->getEconomicCode());
|
$invoiceDto = $this->buildInvoiceDto($invoice, $moadian, $taxSettings['economicCode']);
|
||||||
if (!$invoiceDto) {
|
if (!$invoiceDto) {
|
||||||
throw new \Exception('خطا در آمادهسازی فاکتور: خطا در ساخت DTO فاکتور');
|
throw new \Exception('خطا در آمادهسازی فاکتور: خطا در ساخت DTO فاکتور');
|
||||||
}
|
}
|
||||||
|
@ -1004,12 +1009,10 @@ class TaxSettingsController extends AbstractController
|
||||||
|
|
||||||
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$userId = $user instanceof \App\Entity\User ? $user->getId() : null;
|
|
||||||
|
|
||||||
$repo = $em->getRepository(PluginTaxsettingsKey::class);
|
$taxSettings = $this->getTaxSettings($em, $businessId, $user);
|
||||||
$taxSettings = $repo->findOneBy(['business_id' => $businessId, 'user_id' => $userId]);
|
|
||||||
|
|
||||||
if (!$taxSettings || !$taxSettings->getPrivateKey() || !$taxSettings->getTaxMemoryId()) {
|
if (!$taxSettings['privateKey'] || !$taxSettings['taxMemoryId']) {
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => 'تنظیمات مالیاتی تکمیل نشده است. لطفاً ابتدا تنظیمات را تکمیل کنید.'
|
'message' => 'تنظیمات مالیاتی تکمیل نشده است. لطفاً ابتدا تنظیمات را تکمیل کنید.'
|
||||||
|
@ -1017,8 +1020,8 @@ class TaxSettingsController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$username = $taxSettings->getTaxMemoryId();
|
$username = $taxSettings['taxMemoryId'];
|
||||||
$privateKey = $taxSettings->getPrivateKey();
|
$privateKey = $taxSettings['privateKey'];
|
||||||
$taxOrgPublicKey = '';
|
$taxOrgPublicKey = '';
|
||||||
$taxOrgKeyId = '';
|
$taxOrgKeyId = '';
|
||||||
|
|
||||||
|
@ -1359,12 +1362,10 @@ class TaxSettingsController extends AbstractController
|
||||||
|
|
||||||
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$userId = $user instanceof \App\Entity\User ? $user->getId() : null;
|
|
||||||
|
|
||||||
$repo = $em->getRepository(PluginTaxsettingsKey::class);
|
$taxSettings = $this->getTaxSettings($em, $businessId, $user);
|
||||||
$taxSettings = $repo->findOneBy(['business_id' => $businessId, 'user_id' => $userId]);
|
|
||||||
|
|
||||||
if (!$taxSettings || !$taxSettings->getPrivateKey() || !$taxSettings->getTaxMemoryId()) {
|
if (!$taxSettings['privateKey'] || !$taxSettings['taxMemoryId']) {
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => 'تنظیمات مالیاتی تکمیل نشده است. لطفاً ابتدا تنظیمات را تکمیل کنید.'
|
'message' => 'تنظیمات مالیاتی تکمیل نشده است. لطفاً ابتدا تنظیمات را تکمیل کنید.'
|
||||||
|
@ -1372,8 +1373,8 @@ class TaxSettingsController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$username = $taxSettings->getTaxMemoryId();
|
$username = $taxSettings['taxMemoryId'];
|
||||||
$privateKey = $taxSettings->getPrivateKey();
|
$privateKey = $taxSettings['privateKey'];
|
||||||
|
|
||||||
if (!$username || !$privateKey) {
|
if (!$username || !$privateKey) {
|
||||||
return $this->json([
|
return $this->json([
|
||||||
|
@ -1482,7 +1483,7 @@ class TaxSettingsController extends AbstractController
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoiceDto = $this->buildInvoiceDto($invoice, $moadian, $taxSettings->getEconomicCode());
|
$invoiceDto = $this->buildInvoiceDto($invoice, $moadian, $taxSettings['economicCode']);
|
||||||
if (!$invoiceDto) {
|
if (!$invoiceDto) {
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
|
@ -1581,12 +1582,10 @@ class TaxSettingsController extends AbstractController
|
||||||
|
|
||||||
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$userId = $user instanceof \App\Entity\User ? $user->getId() : null;
|
|
||||||
|
|
||||||
$repo = $em->getRepository(PluginTaxsettingsKey::class);
|
$taxSettings = $this->getTaxSettings($em, $businessId, $user);
|
||||||
$taxSettings = $repo->findOneBy(['business_id' => $businessId, 'user_id' => $userId]);
|
|
||||||
|
|
||||||
if (!$taxSettings || !$taxSettings->getPrivateKey() || !$taxSettings->getTaxMemoryId()) {
|
if (!$taxSettings['privateKey'] || !$taxSettings['taxMemoryId']) {
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => 'تنظیمات مالیاتی تکمیل نشده است. لطفاً ابتدا تنظیمات را تکمیل کنید.'
|
'message' => 'تنظیمات مالیاتی تکمیل نشده است. لطفاً ابتدا تنظیمات را تکمیل کنید.'
|
||||||
|
|
|
@ -1137,15 +1137,6 @@ class SellController extends AbstractController
|
||||||
$hesabdariRow->setBd(0);
|
$hesabdariRow->setBd(0);
|
||||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '61']);
|
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '61']);
|
||||||
$hesabdariRow->setRef($ref);
|
$hesabdariRow->setRef($ref);
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$hesabdariRow->setIsPreview(true);
|
|
||||||
$hesabdariRow->setIsApproved(false);
|
|
||||||
$hesabdariRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$hesabdariRow->setIsPreview(false);
|
|
||||||
$hesabdariRow->setIsApproved(true);
|
|
||||||
$hesabdariRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
$entityManager->persist($hesabdariRow);
|
$entityManager->persist($hesabdariRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1175,15 +1166,6 @@ class SellController extends AbstractController
|
||||||
$hesabdariRow->setBd($totalDiscount);
|
$hesabdariRow->setBd($totalDiscount);
|
||||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '104']);
|
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '104']);
|
||||||
$hesabdariRow->setRef($ref);
|
$hesabdariRow->setRef($ref);
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$hesabdariRow->setIsPreview(true);
|
|
||||||
$hesabdariRow->setIsApproved(false);
|
|
||||||
$hesabdariRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$hesabdariRow->setIsPreview(false);
|
|
||||||
$hesabdariRow->setIsApproved(true);
|
|
||||||
$hesabdariRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
$entityManager->persist($hesabdariRow);
|
$entityManager->persist($hesabdariRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,16 +1190,6 @@ class SellController extends AbstractController
|
||||||
$hesabdariRow->setDiscountType($item['showPercentDiscount'] ? 'percent' : 'fixed');
|
$hesabdariRow->setDiscountType($item['showPercentDiscount'] ? 'percent' : 'fixed');
|
||||||
$hesabdariRow->setDiscountPercent($item['discountPercent'] ?? 0);
|
$hesabdariRow->setDiscountPercent($item['discountPercent'] ?? 0);
|
||||||
|
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$hesabdariRow->setIsPreview(true);
|
|
||||||
$hesabdariRow->setIsApproved(false);
|
|
||||||
$hesabdariRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$hesabdariRow->setIsPreview(false);
|
|
||||||
$hesabdariRow->setIsApproved(true);
|
|
||||||
$hesabdariRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '53']);
|
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '53']);
|
||||||
$hesabdariRow->setRef($ref);
|
$hesabdariRow->setRef($ref);
|
||||||
|
|
||||||
|
@ -1251,15 +1223,6 @@ class SellController extends AbstractController
|
||||||
$taxRow->setBd(0);
|
$taxRow->setBd(0);
|
||||||
$taxRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '33']);
|
$taxRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '33']);
|
||||||
$taxRow->setRef($taxRef);
|
$taxRow->setRef($taxRef);
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$taxRow->setIsPreview(true);
|
|
||||||
$taxRow->setIsApproved(false);
|
|
||||||
$taxRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$taxRow->setIsPreview(false);
|
|
||||||
$taxRow->setIsApproved(true);
|
|
||||||
$taxRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
$entityManager->persist($taxRow);
|
$entityManager->persist($taxRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,16 +1240,6 @@ class SellController extends AbstractController
|
||||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '3']);
|
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '3']);
|
||||||
$hesabdariRow->setRef($ref);
|
$hesabdariRow->setRef($ref);
|
||||||
|
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$hesabdariRow->setIsPreview(true);
|
|
||||||
$hesabdariRow->setIsApproved(false);
|
|
||||||
$hesabdariRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$hesabdariRow->setIsPreview(false);
|
|
||||||
$hesabdariRow->setIsApproved(true);
|
|
||||||
$hesabdariRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($params['customer']) || $params['customer'] == '') {
|
if (!isset($params['customer']) || $params['customer'] == '') {
|
||||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
@ -1365,15 +1318,6 @@ class SellController extends AbstractController
|
||||||
$bankRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '5']);
|
$bankRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '5']);
|
||||||
$bankRow->setRef($bankRef);
|
$bankRow->setRef($bankRef);
|
||||||
$bankRow->setBank($entityManager->getRepository(BankAccount::class)->find($payment['bank']));
|
$bankRow->setBank($entityManager->getRepository(BankAccount::class)->find($payment['bank']));
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$bankRow->setIsPreview(true);
|
|
||||||
$bankRow->setIsApproved(false);
|
|
||||||
$bankRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$bankRow->setIsPreview(false);
|
|
||||||
$bankRow->setIsApproved(true);
|
|
||||||
$bankRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
$entityManager->persist($bankRow);
|
$entityManager->persist($bankRow);
|
||||||
} elseif ($payment['type'] === 'cashdesk') {
|
} elseif ($payment['type'] === 'cashdesk') {
|
||||||
// دریافت از طریق صندوق
|
// دریافت از طریق صندوق
|
||||||
|
@ -1387,15 +1331,6 @@ class SellController extends AbstractController
|
||||||
$cashdeskRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '121']);
|
$cashdeskRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '121']);
|
||||||
$cashdeskRow->setRef($cashdeskRef);
|
$cashdeskRow->setRef($cashdeskRef);
|
||||||
$cashdeskRow->setCashdesk($entityManager->getRepository(Cashdesk::class)->find($payment['cashdesk']));
|
$cashdeskRow->setCashdesk($entityManager->getRepository(Cashdesk::class)->find($payment['cashdesk']));
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$cashdeskRow->setIsPreview(true);
|
|
||||||
$cashdeskRow->setIsApproved(false);
|
|
||||||
$cashdeskRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$cashdeskRow->setIsPreview(false);
|
|
||||||
$cashdeskRow->setIsApproved(true);
|
|
||||||
$cashdeskRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
$entityManager->persist($cashdeskRow);
|
$entityManager->persist($cashdeskRow);
|
||||||
} elseif ($payment['type'] === 'salary') {
|
} elseif ($payment['type'] === 'salary') {
|
||||||
// دریافت از طریق تنخواه گردان
|
// دریافت از طریق تنخواه گردان
|
||||||
|
@ -1409,15 +1344,6 @@ class SellController extends AbstractController
|
||||||
$salaryRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '122']);
|
$salaryRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '122']);
|
||||||
$salaryRow->setRef($salaryRef);
|
$salaryRow->setRef($salaryRef);
|
||||||
$salaryRow->setSalary($entityManager->getRepository(Salary::class)->find($payment['salary']));
|
$salaryRow->setSalary($entityManager->getRepository(Salary::class)->find($payment['salary']));
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$salaryRow->setIsPreview(true);
|
|
||||||
$salaryRow->setIsApproved(false);
|
|
||||||
$salaryRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$salaryRow->setIsPreview(false);
|
|
||||||
$salaryRow->setIsApproved(true);
|
|
||||||
$salaryRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
$entityManager->persist($salaryRow);
|
$entityManager->persist($salaryRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1432,15 +1358,7 @@ class SellController extends AbstractController
|
||||||
$receiveRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '3']);
|
$receiveRef = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => '3']);
|
||||||
$receiveRow->setRef($receiveRef);
|
$receiveRow->setRef($receiveRef);
|
||||||
$receiveRow->setPerson($person);
|
$receiveRow->setPerson($person);
|
||||||
if ($TwoStepApproval) {
|
|
||||||
$receiveRow->setIsPreview(true);
|
|
||||||
$receiveRow->setIsApproved(false);
|
|
||||||
$receiveRow->setApprovedBy(null);
|
|
||||||
} else {
|
|
||||||
$receiveRow->setIsPreview(false);
|
|
||||||
$receiveRow->setIsApproved(true);
|
|
||||||
$receiveRow->setApprovedBy($this->getUser());
|
|
||||||
}
|
|
||||||
$entityManager->persist($receiveRow);
|
$entityManager->persist($receiveRow);
|
||||||
|
|
||||||
$entityManager->persist($paymentDoc);
|
$entityManager->persist($paymentDoc);
|
||||||
|
|
|
@ -68,7 +68,7 @@ class StoreroomController extends AbstractController
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
return $this->json(['result'=>-1,'message'=>'فایل ارسال نشده است'], 400);
|
return $this->json(['result'=>-1,'message'=>'فایل ارسال نشده است'], 400);
|
||||||
}
|
}
|
||||||
// Store securely in var/storage
|
|
||||||
$stored = $storage->store($file, (string)$acc['bid']->getId(), 'storeroom_attachments');
|
$stored = $storage->store($file, (string)$acc['bid']->getId(), 'storeroom_attachments');
|
||||||
|
|
||||||
$archive = new ArchiveFile();
|
$archive = new ArchiveFile();
|
||||||
|
|
|
@ -368,48 +368,4 @@ class HesabdariRow
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Approval fields
|
|
||||||
#[ORM\Column(nullable: true)]
|
|
||||||
private ?bool $isPreview = null;
|
|
||||||
|
|
||||||
#[ORM\Column(nullable: true)]
|
|
||||||
private ?bool $isApproved = null;
|
|
||||||
|
|
||||||
#[ORM\ManyToOne]
|
|
||||||
#[ORM\JoinColumn(nullable: true)]
|
|
||||||
private ?User $approvedBy = null;
|
|
||||||
|
|
||||||
public function isPreview(): ?bool
|
|
||||||
{
|
|
||||||
return $this->isPreview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setIsPreview(?bool $isPreview): static
|
|
||||||
{
|
|
||||||
$this->isPreview = $isPreview;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isApproved(): ?bool
|
|
||||||
{
|
|
||||||
return $this->isApproved;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setIsApproved(?bool $isApproved): static
|
|
||||||
{
|
|
||||||
$this->isApproved = $isApproved;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getApprovedBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->approvedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setApprovedBy(?User $approvedBy): static
|
|
||||||
{
|
|
||||||
$this->approvedBy = $approvedBy;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 110 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2 KiB |
Binary file not shown.
Loading…
Reference in a new issue