/**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('vatInfo', ChoiceType::class, array('label' => 'SecondaryVat.vatInfo.label', 'choices_as_values' => true, 'choices' => SecondaryVat::choiceVatInfo(), 'attr' => array('choice_label_trans' => true)));
     $builder->add('vat', NumberType::class, array('label' => 'SecondaryVat.vat.label'));
     $builder->add('balanceTtc', NumberType::class, array('label' => 'SecondaryVat.balanceTtc.label'));
     $builder->add('balanceNet', NumberType::class, array('label' => 'SecondaryVat.balanceNet.label'));
 }
Esempio n. 2
0
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->sale = $options['sale'];
     if (null == $this->sale) {
         $builder->add('sale', EntityType::class, array('label' => 'SecondatVat.sale.label', 'class' => 'AcfDataBundle:Sale', 'query_builder' => function (SaleRepository $sr) {
             return $sr->createQueryBuilder('s')->orderBy('s.number', 'ASC');
         }, 'choice_label' => 'number', 'multiple' => false, 'by_reference' => true, 'required' => true));
     } else {
         $saleId = $this->sale->getId();
         $builder->add('sale', EntityidType::class, array('label' => 'SecondatVat.sale.label', 'class' => 'AcfDataBundle:Sale', 'query_builder' => function (SaleRepository $sr) use($saleId) {
             return $sr->createQueryBuilder('s')->where('s.id = :id')->setParameter('id', $saleId)->orderBy('s.number', 'ASC');
         }, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
     }
     $builder->add('vat', NumberType::class, array('label' => 'SecondaryVat.vat.label'));
     $builder->add('balanceTtc', NumberType::class, array('label' => 'SecondaryVat.balanceTtc.label'));
     $builder->add('balanceNet', NumberType::class, array('label' => 'SecondaryVat.balanceNet.label'));
     $builder->add('vatInfo', ChoiceType::class, array('label' => 'SecondaryVat.vatInfo.label', 'choices_as_values' => true, 'choices' => SecondaryVat::choiceVatInfo(), 'attr' => array('choice_label_trans' => true)));
 }