public function jsonGetArticleAction()
 {
     if ($this->request->isPost() && $this->request->isXmlHttpRequest()) {
         $article = $this->articleService->getArticleById($this->request->getPost()->articleId);
         if ($article) {
             /* @var $article \Application\Entity\Article */
             $result = array('name' => $article->getName(), 'code' => $article->getCode(), 'uom' => $article->getUom() ? $article->getUom()->getId() : '', 'price' => $article->getSalesPrice(), 'quantity' => $article->getQuantity(), 'description' => $article->getDescription());
             return new JsonModel($result);
         }
     }
     return $this->response;
 }
 public function assembleInvoiceRowsArrayFromPost(array $data)
 {
     $invoiceRows = array();
     foreach ($data['names'] as $key => $value) {
         $vat = $this->settingsService->getVatById($data['vatIds'][$key]);
         $uom = $this->settingsService->getUomById($data['uomIds'][$key]);
         $article = $this->articleService->getArticleById($data['articleIds'][$key]);
         $rowArray = array('rowId' => $data['rowIds'][$key], 'description' => $data['rowIds'][$key], 'name' => $value, 'price' => $data['prices'][$key], 'quantity' => $data['quantities'][$key], 'selectedVat' => $vat, 'selectedArticle' => $article, 'selectedUom' => $uom, 'total' => $data['totals'][$key], 'vatAmount' => $data['vatAmounts'][$key], 'vatValue' => $data['vatValues'][$key]);
         $invoiceRows[] = $rowArray;
     }
     return $invoiceRows;
 }
Beispiel #3
0
    $form->setTranslator($sm->get('Translator'));
    return $form;
}, 'Application\\Form\\Customer' => function (ServiceManager $sm) {
    $form = new CustomerForm();
    $form->setTranslator($sm->get('Translator'));
    return $form;
}, 'Application\\Form\\Supplier' => function (ServiceManager $sm) {
    $form = new SupplierForm();
    $form->setTranslator($sm->get('Translator'));
    return $form;
}, 'Application\\Form\\VatUom' => function (ServiceManager $sm) {
    $form = new VatUomForm();
    $form->setTranslator($sm->get('Translator'));
    return $form;
}, 'Application\\Service\\Article' => function (ServiceManager $sm) {
    $service = new ArticleService();
    $service->setSettingsService($sm->get('Application\\Service\\Settings'));
    return $service;
}, 'Application\\Service\\Bank' => function (ServiceManager $sm) {
    $service = new BankService();
    $service->setInvoiceService($sm->get('Application\\Service\\Invoice'));
    return $service;
}, 'Application\\Service\\Customer' => function (ServiceManager $sm) {
    $service = new CustomerService();
    return $service;
}, 'Application\\Service\\Invoice' => function (ServiceManager $sm) {
    $service = new InvoiceService();
    $service->setCustomerService($sm->get('Application\\Service\\Customer'));
    $service->setSettingsService($sm->get('Application\\Service\\Settings'));
    $service->setArticleService($sm->get('Application\\Service\\Article'));
    $service->setCompanyService($sm->get('Application\\Service\\Company'));