start working on cheques part

This commit is contained in:
Hesabix 2024-02-14 18:26:11 +00:00
parent c6fb18001f
commit ebca717c49
5 changed files with 48 additions and 1 deletions

View file

@ -213,6 +213,7 @@ class BusinessController extends AbstractController
$perms->setSell(true); $perms->setSell(true);
$perms->setCost(true); $perms->setCost(true);
$perms->setIncome(true); $perms->setIncome(true);
$perms->setCheque(true);
$perms->setReport(true); $perms->setReport(true);
$perms->setAccounting(true); $perms->setAccounting(true);
$perms->setLog(true); $perms->setLog(true);
@ -382,6 +383,7 @@ class BusinessController extends AbstractController
'settings'=>true, 'settings'=>true,
'persons'=>true, 'persons'=>true,
'commodity'=>true, 'commodity'=>true,
'cheque'=>true,
'getpay'=>true, 'getpay'=>true,
'store'=>true, 'store'=>true,
'bank'=>true, 'bank'=>true,
@ -423,6 +425,7 @@ class BusinessController extends AbstractController
'cost'=>$perm->isCost(), 'cost'=>$perm->isCost(),
'income'=>$perm->isIncome(), 'income'=>$perm->isIncome(),
'buy'=>$perm->isBuy(), 'buy'=>$perm->isBuy(),
'cheque'=>$perm->isCheque(),
'sell'=>$perm->isSell(), 'sell'=>$perm->isSell(),
'accounting'=>$perm->isAccounting(), 'accounting'=>$perm->isAccounting(),
'report'=>$perm->isReport(), 'report'=>$perm->isReport(),
@ -489,6 +492,7 @@ class BusinessController extends AbstractController
$perm->setStore($params['store']); $perm->setStore($params['store']);
$perm->setCost($params['cost']); $perm->setCost($params['cost']);
$perm->setIncome($params['income']); $perm->setIncome($params['income']);
$perm->setCheque($params['cheque']);
$perm->setAccounting($params['accounting']); $perm->setAccounting($params['accounting']);
$perm->setReport($params['report']); $perm->setReport($params['report']);
$perm->setPermission($params['permission']); $perm->setPermission($params['permission']);

View file

@ -58,4 +58,18 @@ class BuyController extends AbstractController
return $this->json(ServiceExplore::ExploreBuyDoc($doc)); return $this->json(ServiceExplore::ExploreBuyDoc($doc));
} }
#[Route('/api/buy/get/invoices/list', name: 'app_buy_get_invoices_list')]
public function app_buy_get_invoices_list(Request $request,Access $access,Log $log,EntityManagerInterface $entityManager, string $code): JsonResponse
{
$acc = $access->hasRole('buy');
if(!$acc)
throw $this->createAccessDeniedException();
$invoices = $entityManager->getRepository(HesabdariDoc::class)->findBy([
'bid'=>$acc['bid'],
'year'=>$acc['year'],
'type'=>'buy'
]);
return $this->json(ServiceExplore::ExploreBuyDocsList($invoices));
}
} }

View file

@ -178,8 +178,10 @@ class HesabdariController extends AbstractController
elseif($params['type'] == 'cost') $roll='cost'; elseif($params['type'] == 'cost') $roll='cost';
elseif($params['type'] == 'income') $roll='income'; elseif($params['type'] == 'income') $roll='income';
elseif($params['type'] == 'buy') $roll='buy'; elseif($params['type'] == 'buy') $roll='buy';
elseif($params['type'] == 'buy_rfb') $roll='buy';
elseif($params['type'] == 'transfer') $roll='transfer'; elseif($params['type'] == 'transfer') $roll='transfer';
elseif($params['type'] == 'sell') $roll='sell'; elseif($params['type'] == 'sell') $roll='sell';
elseif($params['type'] == 'sell_rbs') $roll='buy';
elseif($params['type'] == 'all') $roll='accounting'; elseif($params['type'] == 'all') $roll='accounting';
else else
$this->createNotFoundException(); $this->createNotFoundException();
@ -216,7 +218,7 @@ class HesabdariController extends AbstractController
'amount'=>$item->getAmount(), 'amount'=>$item->getAmount(),
'submitter'=> $item->getSubmitter()->getFullName(), 'submitter'=> $item->getSubmitter()->getFullName(),
]; ];
if($params['type'] == 'buy' || $params['type'] == 'sell'){ if($params['type'] == 'sell_rbs' || $params['type'] == 'buy_rfb' || $params['type'] == 'buy' || $params['type'] == 'sell'){
$mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item,'person'); $mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item,'person');
$temp['person'] = ''; $temp['person'] = '';
if($mainRow) if($mainRow)

View file

@ -102,6 +102,9 @@ class Permission
#[ORM\Column(nullable: true)] #[ORM\Column(nullable: true)]
private ?bool $archiveView = null; private ?bool $archiveView = null;
#[ORM\Column(nullable: true)]
private ?bool $cheque = null;
public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;
@ -454,4 +457,16 @@ class Permission
return $this; return $this;
} }
public function isCheque(): ?bool
{
return $this->cheque;
}
public function setCheque(?bool $cheque): static
{
$this->cheque = $cheque;
return $this;
}
} }

View file

@ -193,4 +193,16 @@ class Explore{
]; ];
} }
public static function ExploreBuyDocsList(array $items){
$result = [];
foreach($items as $item){
$result[] = [
'id'=>$item->getId(),
'date'=>$item->getDate(),
'des'=>$item->getDes(),
];
}
return $result;
}
} }