some progress in accpro
This commit is contained in:
parent
fce0952df3
commit
dc066b0f5f
|
@ -13,6 +13,7 @@ use App\Entity\HesabdariRow;
|
|||
use App\Entity\HesabdariTable;
|
||||
use App\Entity\InvoiceType;
|
||||
use App\Entity\Person;
|
||||
use App\Entity\PrintOptions;
|
||||
use App\Entity\StoreroomTicket;
|
||||
use App\Service\Printers;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
@ -179,7 +180,7 @@ class BuyController extends AbstractController
|
|||
}
|
||||
//set amount of document
|
||||
$doc->setAmount($sumTax + $sumTotal - $params['discountAll'] + $params['transferCost']);
|
||||
//set person seller
|
||||
//set person buyer
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes('فاکتور خرید');
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
|
@ -193,7 +194,7 @@ class BuyController extends AbstractController
|
|||
$hesabdariRow->setRef($ref);
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['seller']['code']
|
||||
'code' => $params['buyer']['code']
|
||||
]);
|
||||
if (!$person)
|
||||
return $this->json($extractor->paramsNotSend());
|
||||
|
@ -330,6 +331,69 @@ class BuyController extends AbstractController
|
|||
return $this->json($dataTemp);
|
||||
}
|
||||
|
||||
#[Route('/api/buy/posprinter/invoice', name: 'app_buy_posprinter_invoice')]
|
||||
public function app_buy_posprinter_invoice(Printers $printers, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('buy');
|
||||
if (!$acc) throw $this->createAccessDeniedException();
|
||||
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['code']
|
||||
]);
|
||||
if (!$doc) throw $this->createNotFoundException();
|
||||
$pdfPid = 0;
|
||||
if ($params['pdf']) {
|
||||
$pdfPid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/buy.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc'=>$doc,
|
||||
'rows'=>$doc->getHesabdariRows(),
|
||||
'printInvoice'=>$params['posPrint'],
|
||||
'printcashdeskRecp'=>$params['posPrintRecp'],
|
||||
]),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ($params['posPrint'] == true) {
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/justSell.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
true
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastSellInvoice");
|
||||
}
|
||||
if ($params['posPrintRecp'] == true) {
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/cashdesk.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
true
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastSellCashdesk");
|
||||
}
|
||||
|
||||
return $this->json(['id' => $pdfPid]);
|
||||
}
|
||||
|
||||
#[Route('/api/buy/print/invoice', name: 'app_buy_print_invoice')]
|
||||
public function app_buy_print_invoice(Printers $printers, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
|
@ -353,13 +417,40 @@ class BuyController extends AbstractController
|
|||
if ($item->getPerson()) {
|
||||
$person = $item->getPerson();
|
||||
} elseif ($item->getRef()->getCode() == 104) {
|
||||
$discount = $item->getBs();
|
||||
} elseif ($item->getRef()->getCode() == 90) {
|
||||
$transfer = $item->getBd();
|
||||
$discount = $item->getBd();
|
||||
} elseif ($item->getRef()->getCode() == 61) {
|
||||
$transfer = $item->getBs();
|
||||
}
|
||||
}
|
||||
$pdfPid = 0;
|
||||
if ($params['pdf']) {
|
||||
$printOptions = [
|
||||
'bidInfo' => true,
|
||||
'pays' =>true,
|
||||
'taxInfo' =>true,
|
||||
'discountInfo' =>true,
|
||||
'note' =>true
|
||||
];
|
||||
if(array_key_exists('printOptions',$params)){
|
||||
if(array_key_exists('bidInfo',$params['printOptions'])){
|
||||
$printOptions['bidInfo'] = $params['printOptions']['bidInfo'];
|
||||
}
|
||||
if(array_key_exists('pays',$params['printOptions'])){
|
||||
$printOptions['pays'] = $params['printOptions']['pays'];
|
||||
}
|
||||
if(array_key_exists('taxInfo',$params['printOptions'])){
|
||||
$printOptions['taxInfo'] = $params['printOptions']['taxInfo'];
|
||||
}
|
||||
if(array_key_exists('discountInfo',$params['printOptions'])){
|
||||
$printOptions['discountInfo'] = $params['printOptions']['discountInfo'];
|
||||
}
|
||||
if(array_key_exists('note',$params['printOptions'])){
|
||||
$printOptions['note'] = $params['printOptions']['note'];
|
||||
}
|
||||
}
|
||||
$note = '';
|
||||
$printSettings = $entityManager->getRepository(PrintOptions::class)->findOneBy(['bid'=>$acc['bid']]);
|
||||
if($printSettings){$note = $printSettings->getSellNoteString();}
|
||||
$pdfPid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
|
@ -370,7 +461,9 @@ class BuyController extends AbstractController
|
|||
'person' => $person,
|
||||
'printInvoice' => $params['printers'],
|
||||
'discount' => $discount,
|
||||
'transfer' => $transfer
|
||||
'transfer' => $transfer,
|
||||
'printOptions'=> $printOptions,
|
||||
'note'=> $note
|
||||
]),
|
||||
false
|
||||
);
|
||||
|
@ -379,14 +472,14 @@ class BuyController extends AbstractController
|
|||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/justBuy.html.twig', [
|
||||
$this->renderView('pdf/posPrinters/justSell.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
false
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastBuyInvoice");
|
||||
$printers->addFile($pid, $acc, "fastSellInvoice");
|
||||
}
|
||||
return $this->json(['id' => $pdfPid]);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,30 @@ class PrintersController extends AbstractController
|
|||
$temp['sell']['note'] = $settings->isSellNote();
|
||||
$temp['sell']['noteString'] = $settings->getSellNoteString();
|
||||
$temp['sell']['pays'] = $settings->isSellPays();
|
||||
|
||||
$temp['buy']['id'] = $settings->getId();
|
||||
$temp['buy']['bidInfo'] = $settings->isBuyBidInfo();
|
||||
$temp['buy']['taxInfo'] = $settings->isBuyTaxInfo();
|
||||
$temp['buy']['discountInfo'] = $settings->isBuyDiscountInfo();
|
||||
$temp['buy']['note'] = $settings->isBuyNote();
|
||||
$temp['buy']['noteString'] = $settings->getBuyNoteString();
|
||||
$temp['buy']['pays'] = $settings->isBuyPays();
|
||||
|
||||
$temp['rfbuy']['id'] = $settings->getId();
|
||||
$temp['rfbuy']['bidInfo'] = $settings->isRfbuyBidInfo();
|
||||
$temp['rfbuy']['taxInfo'] = $settings->isRfbuyTaxInfo();
|
||||
$temp['rfbuy']['discountInfo'] = $settings->isRfbuyDiscountInfo();
|
||||
$temp['rfbuy']['note'] = $settings->isRfbuyNote();
|
||||
$temp['rfbuy']['noteString'] = $settings->getRfbuyNoteString();
|
||||
$temp['rfbuy']['pays'] = $settings->isRfbuyPays();
|
||||
|
||||
$temp['rfsell']['id'] = $settings->getId();
|
||||
$temp['rfsell']['bidInfo'] = $settings->isRfsellBidInfo();
|
||||
$temp['rfsell']['taxInfo'] = $settings->isRfsellTaxInfo();
|
||||
$temp['rfsell']['discountInfo'] = $settings->isRfsellDiscountInfo();
|
||||
$temp['rfsell']['note'] = $settings->isRfsellNote();
|
||||
$temp['rfsell']['noteString'] = $settings->getRfsellNoteString();
|
||||
$temp['rfsell']['pays'] = $settings->isRfsellPays();
|
||||
return $this->json($temp);
|
||||
}
|
||||
|
||||
|
@ -79,6 +103,28 @@ class PrintersController extends AbstractController
|
|||
$settings->setSellNote($params['sell']['note']);
|
||||
$settings->setSellNoteString($params['sell']['noteString']);
|
||||
$settings->setSellPays($params['sell']['pays']);
|
||||
|
||||
$settings->setBuyBidInfo($params['buy']['bidInfo']);
|
||||
$settings->setBuyTaxInfo($params['buy']['taxInfo']);
|
||||
$settings->setBuyDiscountInfo($params['buy']['discountInfo']);
|
||||
$settings->setBuyNote($params['buy']['note']);
|
||||
$settings->setBuyNoteString($params['buy']['noteString']);
|
||||
$settings->setBuyPays($params['buy']['pays']);
|
||||
|
||||
$settings->setRfbuyBidInfo($params['rfbuy']['bidInfo']);
|
||||
$settings->setRfbuyTaxInfo($params['rfbuy']['taxInfo']);
|
||||
$settings->setRfbuyDiscountInfo($params['rfbuy']['discountInfo']);
|
||||
$settings->setRfbuyNote($params['rfbuy']['note']);
|
||||
$settings->setRfbuyNoteString($params['rfbuy']['noteString']);
|
||||
$settings->setRfbuyPays($params['rfbuy']['pays']);
|
||||
|
||||
$settings->setRfsellBidInfo($params['rfsell']['bidInfo']);
|
||||
$settings->setRfsellTaxInfo($params['rfsell']['taxInfo']);
|
||||
$settings->setRfsellDiscountInfo($params['rfsell']['discountInfo']);
|
||||
$settings->setRfsellNote($params['rfsell']['note']);
|
||||
$settings->setRfsellNoteString($params['rfsell']['noteString']);
|
||||
$settings->setRfsellPays($params['rfsell']['pays']);
|
||||
|
||||
$entityManager->persist($settings);
|
||||
$entityManager->flush();
|
||||
$log->insert('تنظیمات چاپ', 'تنظیمات چاپ به روز رسانی شد.', $this->getUser(), $acc['bid']->getId());
|
||||
|
|
|
@ -5,8 +5,17 @@ namespace App\Controller;
|
|||
use App\Service\Log;
|
||||
use App\Service\Access;
|
||||
use App\Service\Explore;
|
||||
use App\Entity\Commodity;
|
||||
use App\Service\Provider;
|
||||
use App\Service\Extractor;
|
||||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\HesabdariRow;
|
||||
use App\Entity\HesabdariTable;
|
||||
use App\Entity\InvoiceType;
|
||||
use App\Entity\Person;
|
||||
use App\Entity\PrintOptions;
|
||||
use App\Entity\StoreroomTicket;
|
||||
use App\Service\Printers;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
@ -54,6 +63,409 @@ class RfbuyController extends AbstractController
|
|||
if (!$doc)
|
||||
throw $this->createNotFoundException();
|
||||
|
||||
return $this->json(Explore::ExploreRfbuyDoc($doc));
|
||||
return $this->json(Explore::ExploreSellDoc($doc));
|
||||
}
|
||||
|
||||
#[Route('/api/rfbuy/mod', name: 'app_rfbuy_mod')]
|
||||
public function app_rfbuy_mod(Provider $provider, Extractor $extractor, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('plugAccproRfbuy');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
if (!array_key_exists('update', $params)) {
|
||||
return $this->json($extractor->paramsNotSend());
|
||||
}
|
||||
if ($params['update'] != '') {
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'year' => $acc['year'],
|
||||
'code' => $params['update']
|
||||
]);
|
||||
if (!$doc) return $this->json($extractor->notFound());
|
||||
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'doc' => $doc
|
||||
]);
|
||||
foreach ($rows as $row)
|
||||
$entityManager->remove($row);
|
||||
} else {
|
||||
$doc = new HesabdariDoc();
|
||||
$doc->setBid($acc['bid']);
|
||||
$doc->setYear($acc['year']);
|
||||
$doc->setDateSubmit(time());
|
||||
$doc->setType('rfbuy');
|
||||
$doc->setSubmitter($this->getUser());
|
||||
$doc->setMoney($acc['bid']->getMoney());
|
||||
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||
}
|
||||
if($params['transferCost'] != 0){
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes('حمل و نقل کالا');
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBs($params['transferCost']);
|
||||
$hesabdariRow->setBd(0);
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code' => '61' // transfer cost income
|
||||
]);
|
||||
$hesabdariRow->setRef($ref);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
}
|
||||
if($params['discountAll'] != 0){
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes('تخفیف فاکتور');
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBs(0);
|
||||
$hesabdariRow->setBd($params['discountAll']);
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code' => '104' // سایر هزینه های پخش و برگشت از خرید
|
||||
]);
|
||||
$hesabdariRow->setRef($ref);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
}
|
||||
$doc->setDes($params['des']);
|
||||
$doc->setDate($params['date']);
|
||||
$sumTax = 0;
|
||||
$sumTotal = 0;
|
||||
foreach ($params['rows'] as $row) {
|
||||
$sumTax += $row['tax'];
|
||||
$sumTotal += $row['sumWithoutTax'];
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes($row['des']);
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBs($row['sumWithoutTax'] + $row['tax']);
|
||||
$hesabdariRow->setBd(0);
|
||||
$hesabdariRow->setDiscount($row['discount']);
|
||||
$hesabdariRow->setTax($row['tax']);
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code' => '53' // rfbuy commodity
|
||||
]);
|
||||
$hesabdariRow->setRef($ref);
|
||||
$row['count'] = str_replace(',', '', $row['count']);
|
||||
$commodity = $entityManager->getRepository(Commodity::class)->findOneBy([
|
||||
'id' => $row['commodity']['id'],
|
||||
'bid' => $acc['bid']
|
||||
]);
|
||||
if (!$commodity)
|
||||
return $this->json($extractor->paramsNotSend());
|
||||
$hesabdariRow->setCommodity($commodity);
|
||||
$hesabdariRow->setCommdityCount($row['count']);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
}
|
||||
//set amount of document
|
||||
$doc->setAmount($sumTax + $sumTotal - $params['discountAll'] + $params['transferCost']);
|
||||
//set person buyer
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes('فاکتور برگشت از خرید');
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBs(0);
|
||||
$hesabdariRow->setBd($sumTax + $sumTotal + $params['transferCost'] - $params['discountAll']);
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code' => '3' // persons
|
||||
]);
|
||||
$hesabdariRow->setRef($ref);
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['buyer']['code']
|
||||
]);
|
||||
if (!$person)
|
||||
return $this->json($extractor->paramsNotSend());
|
||||
$hesabdariRow->setPerson($person);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
|
||||
//set tax info
|
||||
|
||||
$entityManager->persist($doc);
|
||||
$entityManager->flush();
|
||||
$log->insert(
|
||||
'حسابداری',
|
||||
'سند حسابداری شماره ' . $doc->getCode() . ' ثبت / ویرایش شد.',
|
||||
$this->getUser(),
|
||||
$request->headers->get('activeBid'),
|
||||
$doc
|
||||
);
|
||||
return $this->json($extractor->operationSuccess());
|
||||
}
|
||||
|
||||
#[Route('/api/rfbuy/label/change', name: 'app_rfbuy_label_change')]
|
||||
public function app_rfbuy_label_change(Request $request, Access $access, Extractor $extractor, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('plugAccproRfbuy');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
if ($params['label'] != 'clear') {
|
||||
$label = $entityManager->getRepository(InvoiceType::class)->findOneBy([
|
||||
'code' => $params['label']['code'],
|
||||
'type' => 'rfbuy'
|
||||
]);
|
||||
if (!$label) return $this->json($extractor->notFound());
|
||||
}
|
||||
foreach ($params['items'] as $item) {
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'year' => $acc['year'],
|
||||
'code' => $item['code']
|
||||
]);
|
||||
if (!$doc) return $this->json($extractor->notFound());
|
||||
if ($params['label'] != 'clear') {
|
||||
$doc->setInvoiceLabel($label);
|
||||
$entityManager->persist($doc);
|
||||
$log->insert(
|
||||
'حسابداری',
|
||||
' تغییر برچسب فاکتور شماره ' . $doc->getCode() . ' به ' . $label->getLabel(),
|
||||
$this->getUser(),
|
||||
$acc['bid']->getId(),
|
||||
$doc
|
||||
);
|
||||
} else {
|
||||
$doc->setInvoiceLabel(null);
|
||||
$entityManager->persist($doc);
|
||||
$log->insert(
|
||||
'حسابداری',
|
||||
' حذف برچسب فاکتور شماره ' . $doc->getCode(),
|
||||
$this->getUser(),
|
||||
$acc['bid']->getId(),
|
||||
$doc
|
||||
);
|
||||
}
|
||||
}
|
||||
$entityManager->flush();
|
||||
return $this->json($extractor->operationSuccess());
|
||||
}
|
||||
|
||||
#[Route('/api/rfbuy/docs/search', name: 'app_rfbuy_docs_search')]
|
||||
public function app_rfbuy_docs_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('plugAccproRfbuy');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid' => $acc['bid'],
|
||||
'year' => $acc['year'],
|
||||
'type' => 'rfbuy'
|
||||
], [
|
||||
'id' => 'DESC'
|
||||
]);
|
||||
|
||||
$dataTemp = [];
|
||||
foreach ($data as $item) {
|
||||
$temp = [
|
||||
'id' => $item->getId(),
|
||||
'dateSubmit' => $item->getDateSubmit(),
|
||||
'date' => $item->getDate(),
|
||||
'type' => $item->getType(),
|
||||
'code' => $item->getCode(),
|
||||
'des' => $item->getDes(),
|
||||
'amount' => $item->getAmount(),
|
||||
'submitter' => $item->getSubmitter()->getFullName(),
|
||||
];
|
||||
$mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item, 'person');
|
||||
$temp['person'] = '';
|
||||
if ($mainRow)
|
||||
$temp['person'] = Explore::ExplorePerson($mainRow->getPerson());
|
||||
|
||||
$temp['label'] = null;
|
||||
if ($item->getInvoiceLabel()) {
|
||||
$temp['label'] = [
|
||||
'code' => $item->getInvoiceLabel()->getCode(),
|
||||
'label' => $item->getInvoiceLabel()->getLabel()
|
||||
];
|
||||
}
|
||||
|
||||
$temp['relatedDocsCount'] = count($item->getRelatedDocs());
|
||||
$pays = 0;
|
||||
foreach ($item->getRelatedDocs() as $relatedDoc) {
|
||||
$pays += $relatedDoc->getAmount();
|
||||
}
|
||||
$temp['relatedDocsPays'] = $pays;
|
||||
|
||||
foreach ($item->getHesabdariRows() as $item) {
|
||||
if ($item->getRef()->getCode() == '104') {
|
||||
$temp['discountAll'] = $item->getBd();
|
||||
} elseif ($item->getRef()->getCode() == '61') {
|
||||
$temp['transferCost'] = $item->getBs();
|
||||
}
|
||||
}
|
||||
if(!array_key_exists('discountAll',$temp)) $temp['discountAll'] = 0;
|
||||
if(!array_key_exists('transferCost',$temp)) $temp['transferCost'] = 0;
|
||||
$dataTemp[] = $temp;
|
||||
}
|
||||
return $this->json($dataTemp);
|
||||
}
|
||||
|
||||
#[Route('/api/rfbuy/posprinter/invoice', name: 'app_rfbuy_posprinter_invoice')]
|
||||
public function app_rfbuy_posprinter_invoice(Printers $printers, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('plugAccproRfbuy');
|
||||
if (!$acc) throw $this->createAccessDeniedException();
|
||||
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['code']
|
||||
]);
|
||||
if (!$doc) throw $this->createNotFoundException();
|
||||
$pdfPid = 0;
|
||||
if ($params['pdf']) {
|
||||
$pdfPid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/rfbuy.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc'=>$doc,
|
||||
'rows'=>$doc->getHesabdariRows(),
|
||||
'printInvoice'=>$params['posPrint'],
|
||||
'printcashdeskRecp'=>$params['posPrintRecp'],
|
||||
]),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ($params['posPrint'] == true) {
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/justSell.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
true
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastSellInvoice");
|
||||
}
|
||||
if ($params['posPrintRecp'] == true) {
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/cashdesk.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
true
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastSellCashdesk");
|
||||
}
|
||||
|
||||
return $this->json(['id' => $pdfPid]);
|
||||
}
|
||||
|
||||
#[Route('/api/rfbuy/print/invoice', name: 'app_rfbuy_print_invoice')]
|
||||
public function app_rfbuy_print_invoice(Printers $printers, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('plugAccproRfbuy');
|
||||
if (!$acc) throw $this->createAccessDeniedException();
|
||||
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['code']
|
||||
]);
|
||||
if (!$doc) throw $this->createNotFoundException();
|
||||
$person = null;
|
||||
$discount = 0;
|
||||
$transfer = 0;
|
||||
foreach ($doc->getHesabdariRows() as $item) {
|
||||
if ($item->getPerson()) {
|
||||
$person = $item->getPerson();
|
||||
} elseif ($item->getRef()->getCode() == 104) {
|
||||
$discount = $item->getBd();
|
||||
} elseif ($item->getRef()->getCode() == 61) {
|
||||
$transfer = $item->getBs();
|
||||
}
|
||||
}
|
||||
$pdfPid = 0;
|
||||
if ($params['pdf']) {
|
||||
$printOptions = [
|
||||
'bidInfo' => true,
|
||||
'pays' =>true,
|
||||
'taxInfo' =>true,
|
||||
'discountInfo' =>true,
|
||||
'note' =>true
|
||||
];
|
||||
if(array_key_exists('printOptions',$params)){
|
||||
if(array_key_exists('bidInfo',$params['printOptions'])){
|
||||
$printOptions['bidInfo'] = $params['printOptions']['bidInfo'];
|
||||
}
|
||||
if(array_key_exists('pays',$params['printOptions'])){
|
||||
$printOptions['pays'] = $params['printOptions']['pays'];
|
||||
}
|
||||
if(array_key_exists('taxInfo',$params['printOptions'])){
|
||||
$printOptions['taxInfo'] = $params['printOptions']['taxInfo'];
|
||||
}
|
||||
if(array_key_exists('discountInfo',$params['printOptions'])){
|
||||
$printOptions['discountInfo'] = $params['printOptions']['discountInfo'];
|
||||
}
|
||||
if(array_key_exists('note',$params['printOptions'])){
|
||||
$printOptions['note'] = $params['printOptions']['note'];
|
||||
}
|
||||
}
|
||||
$note = '';
|
||||
$printSettings = $entityManager->getRepository(PrintOptions::class)->findOneBy(['bid'=>$acc['bid']]);
|
||||
if($printSettings){$note = $printSettings->getSellNoteString();}
|
||||
$pdfPid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/printers/rfbuy.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
'person' => $person,
|
||||
'printInvoice' => $params['printers'],
|
||||
'discount' => $discount,
|
||||
'transfer' => $transfer,
|
||||
'printOptions'=> $printOptions,
|
||||
'note'=> $note
|
||||
]),
|
||||
false
|
||||
);
|
||||
}
|
||||
if ($params['printers'] == true) {
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/justSell.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
false
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastSellInvoice");
|
||||
}
|
||||
return $this->json(['id' => $pdfPid]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,19 @@ namespace App\Controller;
|
|||
|
||||
use App\Service\Log;
|
||||
use App\Service\Access;
|
||||
use App\Service\Explore;
|
||||
use App\Entity\Commodity;
|
||||
use App\Service\Provider;
|
||||
use App\Service\Extractor;
|
||||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\HesabdariRow;
|
||||
use App\Entity\HesabdariTable;
|
||||
use App\Entity\InvoiceType;
|
||||
use App\Entity\Person;
|
||||
use App\Entity\PrintOptions;
|
||||
use App\Entity\StoreroomTicket;
|
||||
use App\Service\Printers;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use App\Service\Explore as ServiceExplore;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
@ -55,6 +64,423 @@ class RfsellController extends AbstractController
|
|||
if(!$doc)
|
||||
throw $this->createNotFoundException();
|
||||
|
||||
return $this->json(ServiceExplore::ExploreRfsellDoc($doc));
|
||||
return $this->json(Explore::ExploreBuyDoc($doc));
|
||||
}
|
||||
|
||||
#[Route('/api/rfsell/get/invoices/list', name: 'app_rfsell_get_invoices_list')]
|
||||
public function app_rfsell_get_invoices_list(Request $request,Access $access,Log $log,EntityManagerInterface $entityManager, string $code): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('plugAccproRfsell');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$invoices = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'year'=>$acc['year'],
|
||||
'type'=>'rfsell'
|
||||
]);
|
||||
return $this->json(Explore::ExploreBuyDocsList($invoices));
|
||||
}
|
||||
|
||||
#[Route('/api/rfsell/mod', name: 'app_rfsell_mod')]
|
||||
public function app_rfsell_mod(Provider $provider, Extractor $extractor, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('plugAccproRfsell');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
if (!array_key_exists('update', $params)) {
|
||||
return $this->json($extractor->paramsNotSend());
|
||||
}
|
||||
if ($params['update'] != '') {
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'year' => $acc['year'],
|
||||
'code' => $params['update']
|
||||
]);
|
||||
if (!$doc) return $this->json($extractor->notFound());
|
||||
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'doc' => $doc
|
||||
]);
|
||||
foreach ($rows as $row)
|
||||
$entityManager->remove($row);
|
||||
} else {
|
||||
$doc = new HesabdariDoc();
|
||||
$doc->setBid($acc['bid']);
|
||||
$doc->setYear($acc['year']);
|
||||
$doc->setDateSubmit(time());
|
||||
$doc->setType('rfsell');
|
||||
$doc->setSubmitter($this->getUser());
|
||||
$doc->setMoney($acc['bid']->getMoney());
|
||||
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||
}
|
||||
if($params['transferCost'] != 0){
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes('حمل و نقل کالا');
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBd($params['transferCost']);
|
||||
$hesabdariRow->setBs(0);
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code' => '90' // transfer cost income
|
||||
]);
|
||||
$hesabdariRow->setRef($ref);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
}
|
||||
if($params['discountAll'] != 0){
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes('تخفیف فاکتور');
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBd(0);
|
||||
$hesabdariRow->setBs($params['discountAll']);
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code' => '104' // سایر هزینه های پخش و خرید
|
||||
]);
|
||||
$hesabdariRow->setRef($ref);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
}
|
||||
$doc->setDes($params['des']);
|
||||
$doc->setDate($params['date']);
|
||||
$sumTax = 0;
|
||||
$sumTotal = 0;
|
||||
foreach ($params['rows'] as $row) {
|
||||
$sumTax += $row['tax'];
|
||||
$sumTotal += $row['sumWithoutTax'];
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes($row['des']);
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBd($row['sumWithoutTax'] + $row['tax']);
|
||||
$hesabdariRow->setBs(0);
|
||||
$hesabdariRow->setDiscount($row['discount']);
|
||||
$hesabdariRow->setTax($row['tax']);
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code' => '120' // commodity
|
||||
]);
|
||||
$hesabdariRow->setRef($ref);
|
||||
$row['count'] = str_replace(',', '', $row['count']);
|
||||
$commodity = $entityManager->getRepository(Commodity::class)->findOneBy([
|
||||
'id' => $row['commodity']['id'],
|
||||
'bid' => $acc['bid']
|
||||
]);
|
||||
if (!$commodity)
|
||||
return $this->json($extractor->paramsNotSend());
|
||||
$hesabdariRow->setCommodity($commodity);
|
||||
$hesabdariRow->setCommdityCount($row['count']);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
}
|
||||
//set amount of document
|
||||
$doc->setAmount($sumTax + $sumTotal - $params['discountAll'] + $params['transferCost']);
|
||||
//set person buyer
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setDes('فاکتور برگشت از فروش');
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBd(0);
|
||||
$hesabdariRow->setBs($sumTax + $sumTotal + $params['transferCost'] - $params['discountAll']);
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code' => '3' // persons
|
||||
]);
|
||||
$hesabdariRow->setRef($ref);
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['buyer']['code']
|
||||
]);
|
||||
if (!$person)
|
||||
return $this->json($extractor->paramsNotSend());
|
||||
$hesabdariRow->setPerson($person);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
|
||||
//set tax info
|
||||
|
||||
$entityManager->persist($doc);
|
||||
$entityManager->flush();
|
||||
$log->insert(
|
||||
'حسابداری',
|
||||
'سند حسابداری شماره ' . $doc->getCode() . ' ثبت / ویرایش شد.',
|
||||
$this->getUser(),
|
||||
$request->headers->get('activeBid'),
|
||||
$doc
|
||||
);
|
||||
return $this->json($extractor->operationSuccess());
|
||||
}
|
||||
|
||||
#[Route('/api/rfsell/label/change', name: 'app_rfsell_label_change')]
|
||||
public function app_rfsell_label_change(Request $request, Access $access, Extractor $extractor, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('plugAccproRfsell');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
if ($params['label'] != 'clear') {
|
||||
$label = $entityManager->getRepository(InvoiceType::class)->findOneBy([
|
||||
'code' => $params['label']['code'],
|
||||
'type' => 'rfsell'
|
||||
]);
|
||||
if (!$label) return $this->json($extractor->notFound());
|
||||
}
|
||||
foreach ($params['items'] as $item) {
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'year' => $acc['year'],
|
||||
'code' => $item['code']
|
||||
]);
|
||||
if (!$doc) return $this->json($extractor->notFound());
|
||||
if ($params['label'] != 'clear') {
|
||||
$doc->setInvoiceLabel($label);
|
||||
$entityManager->persist($doc);
|
||||
$log->insert(
|
||||
'حسابداری',
|
||||
' تغییر برچسب فاکتور شماره ' . $doc->getCode() . ' به ' . $label->getLabel(),
|
||||
$this->getUser(),
|
||||
$acc['bid']->getId(),
|
||||
$doc
|
||||
);
|
||||
} else {
|
||||
$doc->setInvoiceLabel(null);
|
||||
$entityManager->persist($doc);
|
||||
$log->insert(
|
||||
'حسابداری',
|
||||
' حذف برچسب فاکتور شماره ' . $doc->getCode(),
|
||||
$this->getUser(),
|
||||
$acc['bid']->getId(),
|
||||
$doc
|
||||
);
|
||||
}
|
||||
}
|
||||
$entityManager->flush();
|
||||
return $this->json($extractor->operationSuccess());
|
||||
}
|
||||
|
||||
#[Route('/api/rfsell/docs/search', name: 'app_rfsell_docs_search')]
|
||||
public function app_rfsell_docs_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('plugAccproRfsell');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid' => $acc['bid'],
|
||||
'year' => $acc['year'],
|
||||
'type' => 'rfsell'
|
||||
], [
|
||||
'id' => 'DESC'
|
||||
]);
|
||||
|
||||
$dataTemp = [];
|
||||
foreach ($data as $item) {
|
||||
$temp = [
|
||||
'id' => $item->getId(),
|
||||
'dateSubmit' => $item->getDateSubmit(),
|
||||
'date' => $item->getDate(),
|
||||
'type' => $item->getType(),
|
||||
'code' => $item->getCode(),
|
||||
'des' => $item->getDes(),
|
||||
'amount' => $item->getAmount(),
|
||||
'submitter' => $item->getSubmitter()->getFullName(),
|
||||
];
|
||||
$mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item, 'person');
|
||||
$temp['person'] = '';
|
||||
if ($mainRow)
|
||||
$temp['person'] = Explore::ExplorePerson($mainRow->getPerson());
|
||||
|
||||
$temp['label'] = null;
|
||||
if ($item->getInvoiceLabel()) {
|
||||
$temp['label'] = [
|
||||
'code' => $item->getInvoiceLabel()->getCode(),
|
||||
'label' => $item->getInvoiceLabel()->getLabel()
|
||||
];
|
||||
}
|
||||
|
||||
$temp['relatedDocsCount'] = count($item->getRelatedDocs());
|
||||
$pays = 0;
|
||||
foreach ($item->getRelatedDocs() as $relatedDoc) {
|
||||
$pays += $relatedDoc->getAmount();
|
||||
}
|
||||
$temp['relatedDocsPays'] = $pays;
|
||||
|
||||
foreach ($item->getHesabdariRows() as $item) {
|
||||
if ($item->getRef()->getCode() == '104') {
|
||||
$temp['discountAll'] = $item->getBd();
|
||||
} elseif ($item->getRef()->getCode() == '90') {
|
||||
$temp['transferCost'] = $item->getBs();
|
||||
}
|
||||
}
|
||||
if(!array_key_exists('discountAll',$temp)) $temp['discountAll'] = 0;
|
||||
if(!array_key_exists('transferCost',$temp)) $temp['transferCost'] = 0;
|
||||
$dataTemp[] = $temp;
|
||||
}
|
||||
return $this->json($dataTemp);
|
||||
}
|
||||
|
||||
#[Route('/api/rfsell/posprinter/invoice', name: 'app_rfsell_posprinter_invoice')]
|
||||
public function app_rfsell_posprinter_invoice(Printers $printers, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('plugAccproRfsell');
|
||||
if (!$acc) throw $this->createAccessDeniedException();
|
||||
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['code']
|
||||
]);
|
||||
if (!$doc) throw $this->createNotFoundException();
|
||||
$pdfPid = 0;
|
||||
if ($params['pdf']) {
|
||||
$pdfPid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/rfsell.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc'=>$doc,
|
||||
'rows'=>$doc->getHesabdariRows(),
|
||||
'printInvoice'=>$params['posPrint'],
|
||||
'printcashdeskRecp'=>$params['posPrintRecp'],
|
||||
]),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ($params['posPrint'] == true) {
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/justSell.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
true
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastSellInvoice");
|
||||
}
|
||||
if ($params['posPrintRecp'] == true) {
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/cashdesk.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
true
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastSellCashdesk");
|
||||
}
|
||||
|
||||
return $this->json(['id' => $pdfPid]);
|
||||
}
|
||||
|
||||
#[Route('/api/rfsell/print/invoice', name: 'app_rfsell_print_invoice')]
|
||||
public function app_rfsell_print_invoice(Printers $printers, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
|
||||
$acc = $access->hasRole('plugAccproRfsell');
|
||||
if (!$acc) throw $this->createAccessDeniedException();
|
||||
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid' => $acc['bid'],
|
||||
'code' => $params['code']
|
||||
]);
|
||||
if (!$doc) throw $this->createNotFoundException();
|
||||
$person = null;
|
||||
$discount = 0;
|
||||
$transfer = 0;
|
||||
foreach ($doc->getHesabdariRows() as $item) {
|
||||
if ($item->getPerson()) {
|
||||
$person = $item->getPerson();
|
||||
} elseif ($item->getRef()->getCode() == 104) {
|
||||
$discount = $item->getBd();
|
||||
} elseif ($item->getRef()->getCode() == 61) {
|
||||
$transfer = $item->getBs();
|
||||
}
|
||||
}
|
||||
$pdfPid = 0;
|
||||
if ($params['pdf']) {
|
||||
$printOptions = [
|
||||
'bidInfo' => true,
|
||||
'pays' =>true,
|
||||
'taxInfo' =>true,
|
||||
'discountInfo' =>true,
|
||||
'note' =>true
|
||||
];
|
||||
if(array_key_exists('printOptions',$params)){
|
||||
if(array_key_exists('bidInfo',$params['printOptions'])){
|
||||
$printOptions['bidInfo'] = $params['printOptions']['bidInfo'];
|
||||
}
|
||||
if(array_key_exists('pays',$params['printOptions'])){
|
||||
$printOptions['pays'] = $params['printOptions']['pays'];
|
||||
}
|
||||
if(array_key_exists('taxInfo',$params['printOptions'])){
|
||||
$printOptions['taxInfo'] = $params['printOptions']['taxInfo'];
|
||||
}
|
||||
if(array_key_exists('discountInfo',$params['printOptions'])){
|
||||
$printOptions['discountInfo'] = $params['printOptions']['discountInfo'];
|
||||
}
|
||||
if(array_key_exists('note',$params['printOptions'])){
|
||||
$printOptions['note'] = $params['printOptions']['note'];
|
||||
}
|
||||
}
|
||||
$note = '';
|
||||
$printSettings = $entityManager->getRepository(PrintOptions::class)->findOneBy(['bid'=>$acc['bid']]);
|
||||
if($printSettings){$note = $printSettings->getSellNoteString();}
|
||||
$pdfPid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/printers/rfsell.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
'person' => $person,
|
||||
'printInvoice' => $params['printers'],
|
||||
'discount' => $discount,
|
||||
'transfer' => $transfer,
|
||||
'printOptions'=> $printOptions,
|
||||
'note'=> $note
|
||||
]),
|
||||
false
|
||||
);
|
||||
}
|
||||
if ($params['printers'] == true) {
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/posPrinters/justSell.html.twig', [
|
||||
'bid' => $acc['bid'],
|
||||
'doc' => $doc,
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
]),
|
||||
false
|
||||
);
|
||||
$printers->addFile($pid, $acc, "fastSellInvoice");
|
||||
}
|
||||
return $this->json(['id' => $pdfPid]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,60 @@ class PrintOptions
|
|||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $sellNoteString = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $buyBidInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $buyTaxInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $buyDiscountInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $buyNote = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $buyNoteString = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $buyPays = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfbuyBidInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfbuyTaxInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfbuyDiscountInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfbuyNote = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $RfbuyNoteString = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfBuyPays = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfsellBidInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfsellTaxInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfsellDiscountInfo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfsellNote = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $RfsellNoteString = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $RfsellPays = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
|
@ -124,4 +178,220 @@ class PrintOptions
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isBuyBidInfo(): ?bool
|
||||
{
|
||||
return $this->buyBidInfo;
|
||||
}
|
||||
|
||||
public function setBuyBidInfo(bool $buyBidInfo): static
|
||||
{
|
||||
$this->buyBidInfo = $buyBidInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isBuyTaxInfo(): ?bool
|
||||
{
|
||||
return $this->buyTaxInfo;
|
||||
}
|
||||
|
||||
public function setBuyTaxInfo(?bool $buyTaxInfo): static
|
||||
{
|
||||
$this->buyTaxInfo = $buyTaxInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isBuyDiscountInfo(): ?bool
|
||||
{
|
||||
return $this->buyDiscountInfo;
|
||||
}
|
||||
|
||||
public function setBuyDiscountInfo(?bool $buyDiscountInfo): static
|
||||
{
|
||||
$this->buyDiscountInfo = $buyDiscountInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isBuyNote(): ?bool
|
||||
{
|
||||
return $this->buyNote;
|
||||
}
|
||||
|
||||
public function setBuyNote(?bool $buyNote): static
|
||||
{
|
||||
$this->buyNote = $buyNote;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBuyNoteString(): ?string
|
||||
{
|
||||
return $this->buyNoteString;
|
||||
}
|
||||
|
||||
public function setBuyNoteString(?string $buyNoteString): static
|
||||
{
|
||||
$this->buyNoteString = $buyNoteString;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isBuyPays(): ?bool
|
||||
{
|
||||
return $this->buyPays;
|
||||
}
|
||||
|
||||
public function setBuyPays(?bool $buyPays): static
|
||||
{
|
||||
$this->buyPays = $buyPays;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfbuyBidInfo(): ?bool
|
||||
{
|
||||
return $this->RfbuyBidInfo;
|
||||
}
|
||||
|
||||
public function setRfbuyBidInfo(?bool $RfbuyBidInfo): static
|
||||
{
|
||||
$this->RfbuyBidInfo = $RfbuyBidInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfbuyTaxInfo(): ?bool
|
||||
{
|
||||
return $this->RfbuyTaxInfo;
|
||||
}
|
||||
|
||||
public function setRfbuyTaxInfo(?bool $RfbuyTaxInfo): static
|
||||
{
|
||||
$this->RfbuyTaxInfo = $RfbuyTaxInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfbuyDiscountInfo(): ?bool
|
||||
{
|
||||
return $this->RfbuyDiscountInfo;
|
||||
}
|
||||
|
||||
public function setRfbuyDiscountInfo(?bool $RfbuyDiscountInfo): static
|
||||
{
|
||||
$this->RfbuyDiscountInfo = $RfbuyDiscountInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfbuyNote(): ?bool
|
||||
{
|
||||
return $this->RfbuyNote;
|
||||
}
|
||||
|
||||
public function setRfbuyNote(?bool $RfbuyNote): static
|
||||
{
|
||||
$this->RfbuyNote = $RfbuyNote;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRfbuyNoteString(): ?string
|
||||
{
|
||||
return $this->RfbuyNoteString;
|
||||
}
|
||||
|
||||
public function setRfbuyNoteString(?string $RfbuyNoteString): static
|
||||
{
|
||||
$this->RfbuyNoteString = $RfbuyNoteString;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfBuyPays(): ?bool
|
||||
{
|
||||
return $this->RfBuyPays;
|
||||
}
|
||||
|
||||
public function setRfBuyPays(?bool $RfBuyPays): static
|
||||
{
|
||||
$this->RfBuyPays = $RfBuyPays;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfsellBidInfo(): ?bool
|
||||
{
|
||||
return $this->RfsellBidInfo;
|
||||
}
|
||||
|
||||
public function setRfsellBidInfo(?bool $RfsellBidInfo): static
|
||||
{
|
||||
$this->RfsellBidInfo = $RfsellBidInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfsellTaxInfo(): ?bool
|
||||
{
|
||||
return $this->RfsellTaxInfo;
|
||||
}
|
||||
|
||||
public function setRfsellTaxInfo(?bool $RfsellTaxInfo): static
|
||||
{
|
||||
$this->RfsellTaxInfo = $RfsellTaxInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfsellDiscountInfo(): ?bool
|
||||
{
|
||||
return $this->RfsellDiscountInfo;
|
||||
}
|
||||
|
||||
public function setRfsellDiscountInfo(?bool $RfsellDiscountInfo): static
|
||||
{
|
||||
$this->RfsellDiscountInfo = $RfsellDiscountInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfsellNote(): ?bool
|
||||
{
|
||||
return $this->RfsellNote;
|
||||
}
|
||||
|
||||
public function setRfsellNote(?bool $RfsellNote): static
|
||||
{
|
||||
$this->RfsellNote = $RfsellNote;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRfsellNoteString(): ?string
|
||||
{
|
||||
return $this->RfsellNoteString;
|
||||
}
|
||||
|
||||
public function setRfsellNoteString(?string $RfsellNoteString): static
|
||||
{
|
||||
$this->RfsellNoteString = $RfsellNoteString;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRfsellPays(): ?bool
|
||||
{
|
||||
return $this->RfsellPays;
|
||||
}
|
||||
|
||||
public function setRfsellPays(?bool $RfsellPays): static
|
||||
{
|
||||
$this->RfsellPays = $RfsellPays;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,6 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<head>
|
||||
<style>
|
||||
@page {
|
||||
margin: 3%;
|
||||
margin-header: 0;
|
||||
margin-footer: 0;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -20,7 +14,7 @@
|
|||
border: 1px solid black;
|
||||
}
|
||||
.item {
|
||||
height: 40px;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
@ -35,7 +29,7 @@
|
|||
<img src="{{ "/api/avatar/get/file/" ~ bid.avatar}}" width="65"/>
|
||||
</td>
|
||||
<td style="width:60%; text-align:center">
|
||||
<h3 class="">فاکتور خرید کالا و خدمات</h3>
|
||||
<h3 class="">صورتحساب خرید کالا و خدمات</h3>
|
||||
</td>
|
||||
<td style="width:20%">
|
||||
<h4>
|
||||
|
@ -51,6 +45,8 @@
|
|||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
{% if printOptions.bidInfo %}
|
||||
|
||||
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
|
||||
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
|
||||
<b style="color:white;">خریدار</b>
|
||||
|
@ -67,7 +63,8 @@
|
|||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b> شناسه ملی:
|
||||
<b>
|
||||
شناسه ملی:
|
||||
</b>
|
||||
{{ bid.shenasemeli }}
|
||||
</p>
|
||||
|
@ -114,6 +111,9 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
|
||||
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
|
||||
<b style="color:white;">فروشنده</b>
|
||||
|
@ -186,8 +186,12 @@
|
|||
<th class="text-white">شرح</th>
|
||||
<th class="text-white">تعداد / مقدار</th>
|
||||
<th class="text-white">مبلغ واحد</th>
|
||||
{% if printOptions.discountInfo %}
|
||||
<th class="text-white">تخفیف</th>
|
||||
{% endif %}
|
||||
{% if printOptions.taxInfo %}
|
||||
<th class="text-white">مالیات</th>
|
||||
{% endif %}
|
||||
<th class="text-white">مبلغ کل</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -209,10 +213,14 @@
|
|||
{{ item.commdityCount }}
|
||||
{{ item.commodity.unit.name }}
|
||||
</td>
|
||||
<td class="center item">{{ ((item.bd - item.tax + item.discount) / item.commdityCount) | number_format }}</td>
|
||||
<td class="center item">{{ ((item.bs - item.tax + item.discount) / item.commdityCount) | number_format }}</td>
|
||||
{% if printOptions.discountInfo %}
|
||||
<td class="center item">{{ item.discount | number_format }}</td>
|
||||
{% endif %}
|
||||
{% if printOptions.taxInfo %}
|
||||
<td class="center item">{{ item.tax | number_format}}</td>
|
||||
<td class="center item">{{ item.bd| number_format }}</td>
|
||||
{% endif %}
|
||||
<td class="center item">{{ item.bs| number_format }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@ -223,44 +231,63 @@
|
|||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr class="stimol">
|
||||
<td class="item">
|
||||
<td class="item" style="width:70%;padding:1%">
|
||||
<h4>
|
||||
توضیحات:
|
||||
{{doc.des}}
|
||||
<br>
|
||||
{% if (doc.relatedDocs | length != 0) and (printOptions.pays == true) %}
|
||||
<h4 class="">
|
||||
پرداختها:
|
||||
</h4>
|
||||
<ul class="">
|
||||
{% for item in doc.relatedDocs%}
|
||||
<li class="">
|
||||
{{item.date}} - {{ item.amount | number_format }} - {{ item.des }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if printOptions.note == true %}
|
||||
<h4 class="">
|
||||
یاداشت:
|
||||
</h4>
|
||||
<ul class="">
|
||||
<li class="">
|
||||
{{note}}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</h4>
|
||||
</td>
|
||||
<td class="item" style="width:15%;padding:1%">
|
||||
<h4>
|
||||
تخفیف:
|
||||
{{discount | number_format}}
|
||||
</h4>
|
||||
</td>
|
||||
<td class="item">
|
||||
<h4>
|
||||
مالیات:
|
||||
{{taxAll | number_format}}
|
||||
</h4>
|
||||
</td>
|
||||
<td class="item">
|
||||
<h4>
|
||||
حمل و نقل:
|
||||
{{transfer | number_format}}
|
||||
</h4>
|
||||
</td>
|
||||
<td class="item">
|
||||
<h4>
|
||||
جمع کل:
|
||||
{{doc.amount | number_format}}
|
||||
مبلغ کل بدون تخفیف:
|
||||
{{ (doc.amount + discount) | number_format}}
|
||||
</h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="stimol">
|
||||
<td class="item" colspan="4">
|
||||
<h4>
|
||||
توضیحات:
|
||||
{{doc.des}}
|
||||
جمع کل قابل پرداخت:
|
||||
{{ doc.amount | number_format }}
|
||||
</h4>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:100%;margin-top:20px;text-align:center;">
|
||||
<div style="width:40%;margin-top:0px;text-align:center;float:left;">
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr class="">
|
||||
|
|
311
hesabixCore/templates/pdf/printers/rfbuy.html.twig
Normal file
311
hesabixCore/templates/pdf/printers/rfbuy.html.twig
Normal file
|
@ -0,0 +1,311 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fa" direction="rtl"></html>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<head>
|
||||
<style>
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.text-white {
|
||||
color: white;
|
||||
}
|
||||
.stimol td,
|
||||
.stimol th {
|
||||
border: 1px solid black;
|
||||
}
|
||||
.item {
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="direction:rtl; width:100%">
|
||||
<div class="block-content pt-1 pb-3 d-none d-sm-block">
|
||||
<div class="c-print container-xl">
|
||||
<div class="tg-wrap" style="width:100%; border:1px solid black;border-radius: 8px;">
|
||||
<table class="rounded" style="width:100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width:20%">
|
||||
<img src="{{ "/api/avatar/get/file/" ~ bid.avatar}}" width="65"/>
|
||||
</td>
|
||||
<td style="width:60%; text-align:center">
|
||||
<h3 class="">صورتحساب برگشت از خرید کالا و خدمات</h3>
|
||||
</td>
|
||||
<td style="width:20%">
|
||||
<h4>
|
||||
<b>تاریخ:</b>
|
||||
{{ doc.date }}</h4>
|
||||
<br/>
|
||||
<h4>
|
||||
<b>شماره:</b>
|
||||
{{ doc.code }}</h4>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
{% if printOptions.bidInfo %}
|
||||
|
||||
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
|
||||
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
|
||||
<b style="color:white;">خریدار</b>
|
||||
</div>
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr style="text-align:center;">
|
||||
<td class="">
|
||||
<p>
|
||||
<b>نام:
|
||||
</b>
|
||||
{{ bid.legalName }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>
|
||||
شناسه ملی:
|
||||
</b>
|
||||
{{ bid.shenasemeli }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>شماره ثبت:
|
||||
</b>
|
||||
{{ bid.shomaresabt }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>شماره اقتصادی:
|
||||
</b>
|
||||
{{ bid.codeeghtesadi }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>تلفن / نمابر:</b>
|
||||
{{ bid.tel }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="" colspan="1">
|
||||
<p>
|
||||
<b>کد پستی:</b>
|
||||
{{ bid.postalcode }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="" colspan="3">
|
||||
<p>
|
||||
<b>آدرس:
|
||||
</b>
|
||||
استان
|
||||
{{ bid.ostan }}، شهر
|
||||
{{ bid.shahrestan }}،
|
||||
{{ bid.address }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
|
||||
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
|
||||
<b style="color:white;">فروشنده</b>
|
||||
</div>
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr style="text-align:center;">
|
||||
<td class="">
|
||||
<p>
|
||||
<b>نام:
|
||||
</b>
|
||||
{{ person.nikename }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b> شناسه ملی:
|
||||
</b>
|
||||
{{ person.shenasemeli }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>شماره ثبت:
|
||||
</b>
|
||||
{{ person.sabt }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>شماره اقتصادی:
|
||||
</b>
|
||||
{{ person.codeeghtesadi }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>تلفن / نمابر:</b>
|
||||
{{ person.tel }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="" colspan="1">
|
||||
<p>
|
||||
<b>کد پستی:</b>
|
||||
{{ person.postalcode }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="" colspan="3">
|
||||
<p>
|
||||
<b>آدرس:
|
||||
</b>
|
||||
استان
|
||||
{{ person.ostan }}، شهر
|
||||
{{ person.shahr }}،
|
||||
{{ person.address }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:100%;margin-top:5px;text-align:center;">
|
||||
<table style="width:100%;">
|
||||
<thead>
|
||||
<tr class="stimol" style="background-color:gray;">
|
||||
<th class="text-white" style="width:80px">ردیف</th>
|
||||
<th class="text-white">کالا/خدمات</th>
|
||||
<th class="text-white">شرح</th>
|
||||
<th class="text-white">تعداد / مقدار</th>
|
||||
<th class="text-white">مبلغ واحد</th>
|
||||
{% if printOptions.discountInfo %}
|
||||
<th class="text-white">تخفیف</th>
|
||||
{% endif %}
|
||||
{% if printOptions.taxInfo %}
|
||||
<th class="text-white">مالیات</th>
|
||||
{% endif %}
|
||||
<th class="text-white">مبلغ کل</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set taxAll = 0 %}
|
||||
{% set rowIndex = 0 %}
|
||||
{% for item in rows%}
|
||||
{% if item.commodity %}
|
||||
{% set taxAll = taxAll + item.tax %}
|
||||
{% set rowIndex = rowIndex + 1 %}
|
||||
<tr class="stimol">
|
||||
<td class="center item">{{rowIndex}}</td>
|
||||
<td class="center item">
|
||||
{{ item.commodity.code }}
|
||||
-
|
||||
{{ item.commodity.name }}</td>
|
||||
<td class="center item">{{ item.des }}</td>
|
||||
<td class="center item">
|
||||
{{ item.commdityCount }}
|
||||
{{ item.commodity.unit.name }}
|
||||
</td>
|
||||
<td class="center item">{{ ((item.bs - item.tax + item.discount) / item.commdityCount) | number_format }}</td>
|
||||
{% if printOptions.discountInfo %}
|
||||
<td class="center item">{{ item.discount | number_format }}</td>
|
||||
{% endif %}
|
||||
{% if printOptions.taxInfo %}
|
||||
<td class="center item">{{ item.tax | number_format}}</td>
|
||||
{% endif %}
|
||||
<td class="center item">{{ item.bs| number_format }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:100%;margin-top:0px;text-align:center;">
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr class="stimol">
|
||||
<td class="item" style="width:70%;padding:1%">
|
||||
<h4>
|
||||
توضیحات:
|
||||
{{doc.des}}
|
||||
<br>
|
||||
{% if (doc.relatedDocs | length != 0) and (printOptions.pays == true) %}
|
||||
<h4 class="">
|
||||
پرداختها:
|
||||
</h4>
|
||||
<ul class="">
|
||||
{% for item in doc.relatedDocs%}
|
||||
<li class="">
|
||||
{{item.date}} - {{ item.amount | number_format }} - {{ item.des }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if printOptions.note == true %}
|
||||
<h4 class="">
|
||||
یاداشت:
|
||||
</h4>
|
||||
<ul class="">
|
||||
<li class="">
|
||||
{{note}}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</h4>
|
||||
</td>
|
||||
<td class="item" style="width:15%;padding:1%">
|
||||
<h4>
|
||||
تخفیف:
|
||||
{{discount | number_format}}
|
||||
</h4>
|
||||
<h4>
|
||||
مالیات:
|
||||
{{taxAll | number_format}}
|
||||
</h4>
|
||||
<h4>
|
||||
حمل و نقل:
|
||||
{{transfer | number_format}}
|
||||
</h4>
|
||||
<h4>
|
||||
مبلغ کل بدون تخفیف:
|
||||
{{ (doc.amount + discount) | number_format}}
|
||||
</h4>
|
||||
<h4>
|
||||
جمع کل قابل پرداخت:
|
||||
{{ doc.amount | number_format }}
|
||||
</h4>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:40%;margin-top:0px;text-align:center;float:left;">
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr class="">
|
||||
<td class="center" style="height:90px">
|
||||
<h4>
|
||||
مهر و امضا خریدار
|
||||
</h4>
|
||||
</td>
|
||||
<td class="center" style="height:90px">
|
||||
<h4>
|
||||
مهر و امضا فروشنده:
|
||||
</h4>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body></div></body></html>
|
||||
|
311
hesabixCore/templates/pdf/printers/rfsell.html.twig
Normal file
311
hesabixCore/templates/pdf/printers/rfsell.html.twig
Normal file
|
@ -0,0 +1,311 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fa" direction="rtl"></html>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<head>
|
||||
<style>
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.text-white {
|
||||
color: white;
|
||||
}
|
||||
.stimol td,
|
||||
.stimol th {
|
||||
border: 1px solid black;
|
||||
}
|
||||
.item {
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="direction:rtl; width:100%">
|
||||
<div class="block-content pt-1 pb-3 d-none d-sm-block">
|
||||
<div class="c-print container-xl">
|
||||
<div class="tg-wrap" style="width:100%; border:1px solid black;border-radius: 8px;">
|
||||
<table class="rounded" style="width:100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width:20%">
|
||||
<img src="{{ "/api/avatar/get/file/" ~ bid.avatar}}" width="65"/>
|
||||
</td>
|
||||
<td style="width:60%; text-align:center">
|
||||
<h3 class="">صورتحساب برگشت از فروش کالا و خدمات</h3>
|
||||
</td>
|
||||
<td style="width:20%">
|
||||
<h4>
|
||||
<b>تاریخ:</b>
|
||||
{{ doc.date }}</h4>
|
||||
<br/>
|
||||
<h4>
|
||||
<b>شماره:</b>
|
||||
{{ doc.code }}</h4>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
{% if printOptions.bidInfo %}
|
||||
|
||||
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
|
||||
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
|
||||
<b style="color:white;">فروشنده</b>
|
||||
</div>
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr style="text-align:center;">
|
||||
<td class="">
|
||||
<p>
|
||||
<b>نام:
|
||||
</b>
|
||||
{{ bid.legalName }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>
|
||||
شناسه ملی:
|
||||
</b>
|
||||
{{ bid.shenasemeli }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>شماره ثبت:
|
||||
</b>
|
||||
{{ bid.shomaresabt }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>شماره اقتصادی:
|
||||
</b>
|
||||
{{ bid.codeeghtesadi }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>تلفن / نمابر:</b>
|
||||
{{ bid.tel }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="" colspan="1">
|
||||
<p>
|
||||
<b>کد پستی:</b>
|
||||
{{ bid.postalcode }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="" colspan="3">
|
||||
<p>
|
||||
<b>آدرس:
|
||||
</b>
|
||||
استان
|
||||
{{ bid.ostan }}، شهر
|
||||
{{ bid.shahrestan }}،
|
||||
{{ bid.address }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
|
||||
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
|
||||
<b style="color:white;">خریدار</b>
|
||||
</div>
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr style="text-align:center;">
|
||||
<td class="">
|
||||
<p>
|
||||
<b>نام:
|
||||
</b>
|
||||
{{ person.nikename }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b> شناسه ملی:
|
||||
</b>
|
||||
{{ person.shenasemeli }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>شماره ثبت:
|
||||
</b>
|
||||
{{ person.sabt }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>شماره اقتصادی:
|
||||
</b>
|
||||
{{ person.codeeghtesadi }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="center">
|
||||
<p>
|
||||
<b>تلفن / نمابر:</b>
|
||||
{{ person.tel }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="" colspan="1">
|
||||
<p>
|
||||
<b>کد پستی:</b>
|
||||
{{ person.postalcode }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="" colspan="3">
|
||||
<p>
|
||||
<b>آدرس:
|
||||
</b>
|
||||
استان
|
||||
{{ person.ostan }}، شهر
|
||||
{{ person.shahr }}،
|
||||
{{ person.address }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:100%;margin-top:5px;text-align:center;">
|
||||
<table style="width:100%;">
|
||||
<thead>
|
||||
<tr class="stimol" style="background-color:gray;">
|
||||
<th class="text-white" style="width:80px">ردیف</th>
|
||||
<th class="text-white">کالا/خدمات</th>
|
||||
<th class="text-white">شرح</th>
|
||||
<th class="text-white">تعداد / مقدار</th>
|
||||
<th class="text-white">مبلغ واحد</th>
|
||||
{% if printOptions.discountInfo %}
|
||||
<th class="text-white">تخفیف</th>
|
||||
{% endif %}
|
||||
{% if printOptions.taxInfo %}
|
||||
<th class="text-white">مالیات</th>
|
||||
{% endif %}
|
||||
<th class="text-white">مبلغ کل</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set taxAll = 0 %}
|
||||
{% set rowIndex = 0 %}
|
||||
{% for item in rows%}
|
||||
{% if item.commodity %}
|
||||
{% set taxAll = taxAll + item.tax %}
|
||||
{% set rowIndex = rowIndex + 1 %}
|
||||
<tr class="stimol">
|
||||
<td class="center item">{{rowIndex}}</td>
|
||||
<td class="center item">
|
||||
{{ item.commodity.code }}
|
||||
-
|
||||
{{ item.commodity.name }}</td>
|
||||
<td class="center item">{{ item.des }}</td>
|
||||
<td class="center item">
|
||||
{{ item.commdityCount }}
|
||||
{{ item.commodity.unit.name }}
|
||||
</td>
|
||||
<td class="center item">{{ ((item.bs - item.tax + item.discount) / item.commdityCount) | number_format }}</td>
|
||||
{% if printOptions.discountInfo %}
|
||||
<td class="center item">{{ item.discount | number_format }}</td>
|
||||
{% endif %}
|
||||
{% if printOptions.taxInfo %}
|
||||
<td class="center item">{{ item.tax | number_format}}</td>
|
||||
{% endif %}
|
||||
<td class="center item">{{ item.bs| number_format }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:100%;margin-top:0px;text-align:center;">
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr class="stimol">
|
||||
<td class="item" style="width:70%;padding:1%">
|
||||
<h4>
|
||||
توضیحات:
|
||||
{{doc.des}}
|
||||
<br>
|
||||
{% if (doc.relatedDocs | length != 0) and (printOptions.pays == true) %}
|
||||
<h4 class="">
|
||||
پرداختها:
|
||||
</h4>
|
||||
<ul class="">
|
||||
{% for item in doc.relatedDocs%}
|
||||
<li class="">
|
||||
{{item.date}} - {{ item.amount | number_format }} - {{ item.des }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if printOptions.note == true %}
|
||||
<h4 class="">
|
||||
یاداشت:
|
||||
</h4>
|
||||
<ul class="">
|
||||
<li class="">
|
||||
{{note}}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</h4>
|
||||
</td>
|
||||
<td class="item" style="width:15%;padding:1%">
|
||||
<h4>
|
||||
تخفیف:
|
||||
{{discount | number_format}}
|
||||
</h4>
|
||||
<h4>
|
||||
مالیات:
|
||||
{{taxAll | number_format}}
|
||||
</h4>
|
||||
<h4>
|
||||
حمل و نقل:
|
||||
{{transfer | number_format}}
|
||||
</h4>
|
||||
<h4>
|
||||
مبلغ کل بدون تخفیف:
|
||||
{{ (doc.amount + discount) | number_format}}
|
||||
</h4>
|
||||
<h4>
|
||||
جمع کل قابل پرداخت:
|
||||
{{ doc.amount | number_format }}
|
||||
</h4>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:40%;margin-top:0px;text-align:center;float:left;">
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr class="">
|
||||
<td class="center" style="height:90px">
|
||||
<h4>
|
||||
مهر و امضا خریدار
|
||||
</h4>
|
||||
</td>
|
||||
<td class="center" style="height:90px">
|
||||
<h4>
|
||||
مهر و امضا فروشنده:
|
||||
</h4>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</body></div></body></html>
|
||||
|
Loading…
Reference in a new issue