<?php
 namespace Modules\Documents\ImportedDocuments\SplitByInvoiceSign; class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $form = \Engine\Form\General::create(); $form->setStyle('width', '250'); $fieldset = \Engine\Form\Container\Fieldset::create($this->lang['index']['form']['fieldset']); $form->addContainer($fieldset); $impDocumentEnt = \Entity\ImportedDocument::select($this->values['id']); $currency = $impDocumentEnt->docCurrency; $undistributedAmount = $impDocumentEnt->docValue - ( $this->values['positiveInvoicesTotal'] + $this->values['negativeInvoicesTotal'] ) ; $this->values['positiveInvoicesIds'] = (array)$this->values['positiveInvoicesIds']; $this->values['negativeInvoicesIds'] = (array)$this->values['negativeInvoicesIds']; $fld = new \Engine\Form\Input\Label(null, null, null); $fld->setDetails( $this->lang['index']['form']['label1']); $fld->setStyle("noLabel", true); $fieldset->addElement($fld); $fld = new \Engine\Form\Input\Label(null, null, null); $fld->setDetails( sprintf( $this->lang['index']['form']['label2'], $this->values['id'], $impDocumentEnt->docValue.' '.$currency, count($this->values['positiveInvoicesIds']), count($this->values['negativeInvoicesIds']) ) ); $fld->setStyle("noLabel", true); $fieldset->addElement($fld); if ($this->values['positiveInvoicesIds']) { $fld = new \Engine\Form\Input\Label($this->lang['index']['form']['posInvoicesLabel'], null, null); $fld->setDetails( $this->values['positiveInvoicesTotal'] . ' ' . $currency . ' : ' . implode(', ', $this->values['positiveInvoicesIds']) ) ; $fieldset->addElement($fld); } if ($this->values['negativeInvoicesIds']) { $fld = new \Engine\Form\Input\Label($this->lang['index']['form']['negInvoicesLabel'], null, null); $fld->setDetails( $this->values['negativeInvoicesTotal'] . ' ' . $currency . ' : ' . implode(', ', $this->values['negativeInvoicesIds']) ) ; $fieldset->addElement($fld); } if (round($undistributedAmount, 2)) { $fld = new \Engine\Form\Input\Label($this->lang['index']['form']['undistrbAmtLabel'], null, null); $fld->setDetails( $undistributedAmount . ' ' . $currency ) ; $fld->setTooltip( $this->lang['index']['form']['undistrbAmtTooltip'] ) ; $fieldset->addElement($fld); } $form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1)); return $form; } } 