/**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('transactionStatus', ChoiceType::class, array('label' => 'Sale.transactionStatus.label', 'choices_as_values' => true, 'choices' => Sale::choiceTransactionStatus(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('dtPayment', DateType::class, array('label' => 'Sale.dtPayment.label', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd'));
 }
Exemplo n.º 2
0
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->mbsale = $options['monthlybalance'];
     if (null == $this->mbsale) {
         $builder->add('monthlyBalance', EntityType::class, array('label' => 'Sale.monthlyBalance.label', 'class' => 'AcfDataBundle:MBSale', 'query_builder' => function (MBSaleRepository $mbsr) {
             return $mbsr->createQueryBuilder('mbs')->orderBy('mbs.ref', 'ASC');
         }, 'choice_label' => 'ref', 'multiple' => false, 'by_reference' => true, 'required' => true));
     } else {
         $mbsaleId = $this->mbsale->getId();
         $builder->add('monthlyBalance', EntityidType::class, array('label' => 'Sale.monthlyBalance.label', 'class' => 'AcfDataBundle:MBSale', 'query_builder' => function (MBSaleRepository $mbsr) use($mbsaleId) {
             return $mbsr->createQueryBuilder('mbs')->where('mbs.id = :id')->setParameter('id', $mbsaleId)->orderBy('mbs.ref', 'ASC');
         }, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
     }
     $builder->add('dtActivation', DateType::class, array('label' => 'Sale.dtActivation.label', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd'));
     $builder->add('bill', TextType::class, array('label' => 'Sale.bill.label'));
     if (null == $this->mbsale) {
         $builder->add('relation', EntityType::class, array('label' => 'Sale.relation.label', 'class' => 'AcfDataBundle:Customer', 'query_builder' => function (CustomerRepository $sr) {
             return $sr->createQueryBuilder('s')->orderBy('s.label', 'ASC');
         }, 'choice_label' => 'label', 'multiple' => false, 'by_reference' => true, 'required' => true));
     } else {
         $companyId = $this->mbsale->getCompany()->getId();
         $builder->add('relation', EntityType::class, array('label' => 'Sale.relation.label', 'class' => 'AcfDataBundle:Customer', 'query_builder' => function (CustomerRepository $sr) use($companyId) {
             return $sr->createQueryBuilder('s')->join('s.company', 'c')->where('c.id = :cid')->setParameter('cid', $companyId)->orderBy('s.label', 'ASC');
         }, 'choice_label' => 'label', 'multiple' => false, 'by_reference' => true, 'required' => true));
     }
     $builder->add('label', TextType::class, array('label' => 'Sale.label.label'));
     $builder->add('devise', CurrencyType::class, array('label' => 'Sale.devise.label'));
     $builder->add('conversionRate', NumberType::class, array('label' => 'Sale.conversionRate.label'));
     $builder->add('vat', NumberType::class, array('label' => 'Sale.vat.label'));
     $builder->add('stamp', NumberType::class, array('label' => 'Sale.stamp.label'));
     $builder->add('balanceTtc', NumberType::class, array('label' => 'Sale.balanceTtc.label'));
     $builder->add('balanceNet', NumberType::class, array('label' => 'Sale.balanceNet.label'));
     $builder->add('vatDevise', NumberType::class, array('label' => 'Sale.vatDevise.label'));
     $builder->add('stampDevise', NumberType::class, array('label' => 'Sale.stampDevise.label'));
     $builder->add('balanceTtcDevise', NumberType::class, array('label' => 'Sale.balanceTtcDevise.label'));
     $builder->add('balanceNetDevise', NumberType::class, array('label' => 'Sale.balanceNetDevise.label'));
     $builder->add('vatInfo', ChoiceType::class, array('label' => 'Sale.vatInfo.label', 'choices_as_values' => true, 'choices' => Sale::choiceVatInfo(), 'attr' => array('choice_label_trans' => true)));
     $builder->add('regime', ChoiceType::class, array('label' => 'Sale.regime.label', 'choices_as_values' => true, 'choices' => Sale::choiceRegime(), 'attr' => array('choice_label_trans' => true)));
     if (null == $this->mbsale) {
         $builder->add('withholding', EntityType::class, array('label' => 'Sale.withholding.label', 'class' => 'AcfDataBundle:Withholding', 'query_builder' => function (WithholdingRepository $wr) {
             return $wr->createQueryBuilder('w')->orderBy('w.label', 'ASC');
         }, 'choice_label' => 'label', 'multiple' => false, 'by_reference' => true, 'required' => true));
     } else {
         $companyId = $this->mbsale->getCompany()->getId();
         $builder->add('withholding', EntityType::class, array('label' => 'Sale.withholding.label', 'class' => 'AcfDataBundle:Withholding', 'query_builder' => function (WithholdingRepository $wr) use($companyId) {
             return $wr->createQueryBuilder('w')->join('w.company', 'c')->where('c.id = :cid')->setParameter('cid', $companyId)->orderBy('w.label', 'ASC');
         }, 'choice_label' => 'label', 'multiple' => false, 'by_reference' => true, 'required' => true));
     }
     $builder->add('paymentType', ChoiceType::class, array('label' => 'Sale.paymentType.label', 'choices_as_values' => true, 'choices' => Sale::choicePaymentType(), 'attr' => array('choice_label_trans' => true)));
     $builder->add('transactionStatus', ChoiceType::class, array('label' => 'Sale.transactionStatus.label', 'choices_as_values' => true, 'choices' => Sale::choiceTransactionStatus(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('dtPayment', DateType::class, array('label' => 'Sale.dtPayment.label', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd'));
     if (null == $this->mbsale) {
         $builder->add('account', EntityType::class, array('label' => 'Sale.account.label', 'class' => 'AcfDataBundle:Account', 'query_builder' => function (AccountRepository $ar) {
             return $ar->createQueryBuilder('a')->orderBy('a.label', 'ASC');
         }, 'choice_label' => 'label', 'multiple' => false, 'by_reference' => true, 'required' => true));
     } else {
         $companyId = $this->mbsale->getCompany()->getId();
         $builder->add('account', EntityType::class, array('label' => 'Sale.account.label', 'class' => 'AcfDataBundle:Account', 'query_builder' => function (AccountRepository $ar) use($companyId) {
             return $ar->createQueryBuilder('a')->join('a.company', 'c')->where('c.id = :cid')->setParameter('cid', $companyId)->orderBy('a.label', 'ASC');
         }, 'choice_label' => 'label', 'multiple' => false, 'by_reference' => true, 'required' => true));
     }
     $builder->add('docs', CollectionType::class, array('label' => 'Sale.docs.label', 'entry_type' => SaleDocTForm::class, 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'mapped' => false, 'constraints' => new Valid()));
     $builder->add('secondaryVats', CollectionType::class, array('label' => 'Sale.secondaryVats.label', 'entry_type' => SaleSecondaryVatTForm::class, 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'mapped' => false));
     $builder->add('otherInfos', TextareaType::class, array('label' => 'Sale.otherInfos.label', 'required' => false));
     $builder->add('validated', ChoiceType::class, array('label' => 'Sale.validated.label', 'choices_as_values' => true, 'choices' => Sale::choiceValidated(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
 }