コード例 #1
0
 /**
  * chiffre d'affaire non-encaissé du mois en cours
  *
  * @param Company $c
  * @param integer $year
  * @param integer $month
  *
  * @return Ambigous <\Doctrine\ORM\mixed, mixed, multitype:,
  *         \Doctrine\DBAL\Driver\Statement, \Doctrine\Common\Cache\mixed>
  */
 public function caNotEncByCompanyInYearMonth(Company $c, $year, $month)
 {
     $qb = $this->createQueryBuilder('sv')->select('sum(sv.balanceNet)')->join('sv.sale', 's')->join('s.account', 'a')->join('a.company', 'c')->join('s.monthlyBalance', 'm')->where('c.id = :id')->andWhere('m.year = :year')->andWhere('m.month = :month')->andWhere('(s.transactionStatus = :status1 OR s.transactionStatus = :status2)')->andWhere('s.paymentType = :paymentType')->setParameter('id', $c->getId())->setParameter('year', \intval($year))->setParameter('month', \intval($month))->setParameter('status1', Transaction::STATUS_DONE)->setParameter('status2', Transaction::STATUS_PENDING)->setParameter('paymentType', Transaction::PTYPE_NA);
     $query = $qb->getQuery();
     $res = $query->getSingleScalarResult();
     if (null == $res) {
         $res = 0;
     }
     return $res;
 }
コード例 #2
0
ファイル: NewTForm.php プロジェクト: sasedev/acf-expert
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->company = $options['company'];
     $companyId = $this->company->getId();
     $builder->add('company', EntityidType::class, array('label' => 'CompanyUser.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) use($companyId) {
         return $br->createQueryBuilder('c')->where('c.id = :id')->setParameter('id', $companyId)->orderBy('c.corporateName', 'ASC');
     }, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
     $builder->add('user', EntityType::class, array('label' => 'CompanyUser.user.label', 'class' => 'AcfDataBundle:User', 'query_builder' => function (UserRepository $ur) use($companyId) {
         $alreadyUsers = $ur->createQueryBuilder('u')->select('u.id')->join('u.companies', 'c')->where('c.id = :id')->setParameter('id', $companyId)->getQuery()->execute();
         if (count($alreadyUsers) != 0) {
             return $ur->createQueryBuilder('u')->where('u.id NOT IN (:ulist)')->setParameter('ulist', $alreadyUsers)->orderBy('u.username', 'ASC');
         } else {
             return $ur->createQueryBuilder('u')->orderBy('u.username', 'ASC');
         }
     }, 'choice_label' => 'fullName', 'multiple' => false, 'by_reference' => true, 'required' => true));
     $builder->add('editCompanyinfos', ChoiceType::class, array('label' => 'CompanyUser.editCompanyinfos.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addAddresses', ChoiceType::class, array('label' => 'CompanyUser.addAddresses.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editAddresses', ChoiceType::class, array('label' => 'CompanyUser.editAddresses.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('deleteAddresses', ChoiceType::class, array('label' => 'CompanyUser.deleteAddresses.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addPhones', ChoiceType::class, array('label' => 'CompanyUser.addPhones.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editPhones', ChoiceType::class, array('label' => 'CompanyUser.editPhones.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('deletePhones', ChoiceType::class, array('label' => 'CompanyUser.deletePhones.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addFrames', ChoiceType::class, array('label' => 'CompanyUser.addFrames.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editFrames', ChoiceType::class, array('label' => 'CompanyUser.editFrames.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('deleteFrames', ChoiceType::class, array('label' => 'CompanyUser.deleteFrames.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addDocs', ChoiceType::class, array('label' => 'CompanyUser.addDocs.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editDocs', ChoiceType::class, array('label' => 'CompanyUser.editDocs.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('deleteDocs', ChoiceType::class, array('label' => 'CompanyUser.deleteDocs.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addSuppliers', ChoiceType::class, array('label' => 'CompanyUser.addSuppliers.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editSuppliers', ChoiceType::class, array('label' => 'CompanyUser.editSuppliers.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('deleteSuppliers', ChoiceType::class, array('label' => 'CompanyUser.deleteSuppliers.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addCustomers', ChoiceType::class, array('label' => 'CompanyUser.addCustomers.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editCustomers', ChoiceType::class, array('label' => 'CompanyUser.editCustomers.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('deleteCustomers', ChoiceType::class, array('label' => 'CompanyUser.deleteCustomers.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addSales', ChoiceType::class, array('label' => 'CompanyUser.addSales.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editSales', ChoiceType::class, array('label' => 'CompanyUser.editSales.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('deleteSales', ChoiceType::class, array('label' => 'CompanyUser.deleteSales.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addBuys', ChoiceType::class, array('label' => 'CompanyUser.addBuys.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editBuys', ChoiceType::class, array('label' => 'CompanyUser.editBuys.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('deleteBuys', ChoiceType::class, array('label' => 'CompanyUser.deleteBuys.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addDocgroupComptables', ChoiceType::class, array('label' => 'CompanyUser.addDocgroupComptables.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editDocgroupComptables', ChoiceType::class, array('label' => 'CompanyUser.editDocgroupComptables.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addDocgroupBanks', ChoiceType::class, array('label' => 'CompanyUser.addDocgroupBanks.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editDocgroupBanks', ChoiceType::class, array('label' => 'CompanyUser.editDocgroupBanks.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addDocgroupJuridics', ChoiceType::class, array('label' => 'CompanyUser.addDocgroupJuridics.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editDocgroupJuridics', ChoiceType::class, array('label' => 'CompanyUser.editDocgroupJuridics.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addDocgroupFiscals', ChoiceType::class, array('label' => 'CompanyUser.addDocgroupFiscals.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editDocgroupFiscals', ChoiceType::class, array('label' => 'CompanyUser.editDocgroupFiscals.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addDocgroupPersos', ChoiceType::class, array('label' => 'CompanyUser.addDocgroupPersos.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editDocgroupPersos', ChoiceType::class, array('label' => 'CompanyUser.editDocgroupPersos.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('addDocgroupSysts', ChoiceType::class, array('label' => 'CompanyUser.addDocgroupSysts.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('editDocgroupSysts', ChoiceType::class, array('label' => 'CompanyUser.editDocgroupSysts.label', 'choices_as_values' => true, 'choices' => CompanyUser::choiceTF(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
 }
コード例 #3
0
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->company = $options['company'];
     if (null == $this->company) {
         $builder->add('docs', EntityType::class, array('label' => 'Docgroupbank.docs.label', 'class' => 'AcfDataBundle:Doc', 'query_builder' => function (DocRepository $dr) {
             return $dr->createQueryBuilder('d')->orderBy('d.originalName', 'ASC');
         }, 'choice_label' => 'originalName', 'multiple' => true, 'by_reference' => false, 'required' => false));
     } else {
         $companyId = $this->company->getId();
         $builder->add('docs', EntityType::class, array('label' => 'Docgroupbank.docs.label', 'class' => 'AcfDataBundle:Doc', 'query_builder' => function (DocRepository $dr) use($companyId) {
             return $dr->createQueryBuilder('d')->join('d.company', 'c')->where('c.id = :cid')->orderBy('d.originalName', 'ASC')->setParameter('cid', $companyId);
         }, 'choice_label' => 'originalName', 'multiple' => true, 'by_reference' => false, 'required' => false));
     }
 }
コード例 #4
0
ファイル: NewTForm.php プロジェクト: sasedev/acf-expert
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->company = $options['company'];
     if (null == $this->company) {
         $builder->add('company', EntityType::class, array('label' => 'Customer.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) {
             return $br->createQueryBuilder('c')->orderBy('c.corporateName', 'ASC');
         }, 'choice_label' => 'corporateName', 'multiple' => false, 'by_reference' => true, 'required' => true));
     } else {
         $companyId = $this->company->getId();
         $builder->add('company', EntityidType::class, array('label' => 'Customer.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) use($companyId) {
             return $br->createQueryBuilder('c')->where('c.id = :id')->setParameter('id', $companyId)->orderBy('c.corporateName', 'ASC');
         }, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
     }
     $builder->add('fileName', FileType::class, array('label' => 'Doc.fileName.label', 'multiple' => true));
     $builder->add('description', TextareaType::class, array('label' => 'Doc.description.label', 'required' => false));
 }
コード例 #5
0
ファイル: NewTForm.php プロジェクト: sasedev/acf-expert
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->company = $options['company'];
     $companyId = $this->company->getId();
     $builder->add('company', EntityidType::class, array('label' => 'CompanyAdmin.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) use($companyId) {
         return $br->createQueryBuilder('c')->where('c.id = :id')->setParameter('id', $companyId)->orderBy('c.corporateName', 'ASC');
     }, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
     $builder->add('user', EntityType::class, array('label' => 'CompanyAdmin.user.label', 'class' => 'AcfDataBundle:User', 'query_builder' => function (UserRepository $ur) use($companyId) {
         $alreadyUsers = $ur->createQueryBuilder('u')->select('u.id')->join('u.admCompanies', 'c')->where('c.id = :id')->setParameter('id', $companyId)->getQuery()->execute();
         if (count($alreadyUsers) != 0) {
             return $ur->createQueryBuilder('u')->where('u.id NOT IN (:ulist)')->setParameter('ulist', $alreadyUsers)->orderBy('u.username', 'ASC');
         } else {
             return $ur->createQueryBuilder('u')->orderBy('u.username', 'ASC');
         }
     }, 'choice_label' => 'fullName', 'multiple' => false, 'by_reference' => true, 'required' => true));
 }
コード例 #6
0
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('physicaltype', ChoiceType::class, array('label' => 'Company.physicaltype.label', 'choices_as_values' => true, 'choices' => Company::choicePhysicaltype(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('cin', TextType::class, array('label' => 'Company.cin.label', 'required' => false));
     $builder->add('passport', TextType::class, array('label' => 'Company.passport.label', 'required' => false));
     $builder->add('commercialRegister', TextType::class, array('label' => 'Company.commercialRegister.label', 'required' => false));
     $builder->add('commercialRegisterBureau', TextType::class, array('label' => 'Company.commercialRegisterBureau.label', 'required' => false));
     $builder->add('customsCode', TextType::class, array('label' => 'Company.customsCode.label', 'required' => false));
 }
コード例 #7
0
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->selfUrl = $options['selfUrl'];
     $this->company = $options['company'];
     $selfUrl = $this->selfUrl;
     if (null == $this->company) {
         $builder->add('parent', EntityType::class, array('label' => 'Docgroupbank.parent.label', 'class' => 'AcfDataBundle:Docgroupbank', 'query_builder' => function (DocgroupbankRepository $dgr) use($selfUrl) {
             $qb = $dgr->createQueryBuilder('d')->where('d.pageUrlFull NOT LIKE :url');
             $qb->setParameter('url', $selfUrl . '%');
             return $qb->addOrderBy('d.pageUrlFull', 'ASC');
         }, 'choice_label' => 'pageUrlFull', 'multiple' => false, 'by_reference' => true, 'required' => false, 'placeholder' => 'Options.choose', 'empty_data' => null));
     } else {
         $companyId = $this->company->getId();
         $builder->add('parent', EntityType::class, array('label' => 'Docgroupbank.parent.label', 'class' => 'AcfDataBundle:Docgroupbank', 'query_builder' => function (DocgroupbankRepository $dgr) use($selfUrl, $companyId) {
             $qb = $dgr->createQueryBuilder('d')->join('d.company', 'c')->where('c.id = :cid')->andWhere('d.pageUrlFull NOT LIKE :url');
             $qb->setParameter('url', $selfUrl . '%');
             $qb->setParameter('cid', $companyId);
             return $qb->addOrderBy('d.pageUrlFull', 'ASC');
         }, 'choice_label' => 'pageUrlFull', 'multiple' => false, 'by_reference' => true, 'required' => false, 'placeholder' => 'Options.choose', 'empty_data' => null));
     }
 }
コード例 #8
0
ファイル: NewTForm.php プロジェクト: sasedev/acf-expert
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  *
  * @return null
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('ref', TextType::class, array('label' => 'Company.ref.label'));
     $builder->add('corporateName', TextType::class, array('label' => 'Company.corporateName.label'));
     $builder->add('type', EntityType::class, array('label' => 'Company.type.label', 'class' => 'AcfDataBundle:CompanyType', 'query_builder' => function (CompanyTypeRepository $ctr) {
         return $ctr->createQueryBuilder('ct')->orderBy('ct.label', 'ASC');
     }, 'choice_label' => 'label', 'multiple' => false, 'by_reference' => true, 'required' => true));
     $builder->add('sectors', EntityType::class, array('label' => 'Company.sectors.label', 'class' => 'AcfDataBundle:Sector', 'query_builder' => function (SectorRepository $sr) {
         return $sr->createQueryBuilder('s')->orderBy('s.label', 'ASC');
     }, 'choice_label' => 'label', 'multiple' => true, 'by_reference' => true, 'required' => false));
     $builder->add('tribunal', TextType::class, array('label' => 'Company.tribunal.label', 'required' => false));
     $builder->add('fisc', TextType::class, array('label' => 'Company.fisc.label'));
     $builder->add('cnss', TextType::class, array('label' => 'Company.cnss.label', 'required' => false));
     $builder->add('cnssBureau', TextType::class, array('label' => 'Company.cnssBureau.label', 'required' => false));
     $builder->add('physicaltype', ChoiceType::class, array('label' => 'Company.physicaltype.label', 'choices_as_values' => true, 'choices' => Company::choicePhysicaltype(), 'expanded' => true, 'attr' => array('choice_label_trans' => true)));
     $builder->add('cin', TextType::class, array('label' => 'Company.cin.label', 'required' => false));
     $builder->add('passport', TextType::class, array('label' => 'Company.passport.label', 'required' => false));
     $builder->add('customsCode', TextType::class, array('label' => 'Company.customsCode.label', 'required' => false));
     $builder->add('commercialRegister', TextType::class, array('label' => 'Company.commercialRegister.label', 'required' => false));
     $builder->add('commercialRegisterBureau', TextType::class, array('label' => 'Company.commercialRegisterBureau.label', 'required' => false));
     $builder->add('actionvn', NumberType::class, array('label' => 'Company.actionvn.label'));
     $builder->add('phone', TextType::class, array('label' => 'Company.phone.label', 'required' => false));
     $builder->add('mobile', TextType::class, array('label' => 'Company.mobile.label', 'required' => false));
     $builder->add('fax', TextType::class, array('label' => 'Company.fax.label', 'required' => false));
     $builder->add('email', EmailType::class, array('label' => 'Company.email.label', 'required' => false));
     $builder->add('streetNum', IntegerType::class, array('label' => 'Company.streetNum.label', 'scale' => 0, 'required' => false));
     $builder->add('address', TextareaType::class, array('label' => 'Company.address.label', 'required' => false));
     $builder->add('address2', TextareaType::class, array('label' => 'Company.address2.label', 'required' => false));
     $builder->add('town', TextType::class, array('label' => 'Company.town.label', 'required' => false));
     $builder->add('zipCode', TextType::class, array('label' => 'Company.zipCode.label', 'required' => false));
     $builder->add('country', CountryType::class, array('label' => 'Company.country.label', 'required' => false, 'placeholder' => 'Options.choose', 'empty_data' => null));
     $builder->add('otherInfos', TextareaType::class, array('label' => 'Company.otherInfos.label', 'required' => false));
     $builder->add('clone', EntityType::class, array('label' => 'Company.clone.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $cr) {
         return $cr->createQueryBuilder('c')->orderBy('c.corporateName', 'ASC');
     }, 'choice_label' => 'corporateName', 'multiple' => false, 'by_reference' => true, 'required' => false, 'mapped' => false));
 }
コード例 #9
0
 /**
  * Get Query for All Entities
  *
  * @param null|Company $c
  *
  * @return \Doctrine\ORM\Query
  */
 public function getAllQuery(Company $c = null)
 {
     if (null == $c) {
         $qb = $this->createQueryBuilder('d')->orderBy('d.pageUrlFull', 'ASC');
     } else {
         $qb = $this->createQueryBuilder('d')->join('d.company', 'c')->where('c.id = :id')->orderBy('d.pageUrlFull', 'ASC')->setParameter('id', $c->getId());
     }
     $query = $qb->getQuery();
     return $query;
 }
コード例 #10
0
 /**
  * Get Query for All Entities
  *
  * @param Company $c
  *
  * @return \Doctrine\ORM\Query
  */
 public function getAllYearByCompanyQuery(Company $c)
 {
     $qb = $this->createQueryBuilder('m')->select('m.year')->distinct()->join('m.company', 'c')->where('c.id = :id')->groupBy('m.year')->orderBy('m.year', 'DESC')->setParameter('id', $c->getId());
     $query = $qb->getQuery();
     return $query;
 }
コード例 #11
0
 protected function traceEntity(Company $cloneCompany, Company $company)
 {
     $curUser = $this->getSecurityTokenStorage()->getToken()->getUser();
     $trace = new Trace();
     $trace->setActionId($company->getId());
     $trace->setActionType(Trace::AT_UPDATE);
     $trace->setUserId($curUser->getId());
     $trace->setCompanyId($company->getId());
     $trace->setUserFullname($curUser->getFullName());
     if (!$this->hasRole('ROLE_SUPERADMIN')) {
         if (!$this->hasRole('ROLE_ADMIN')) {
             $trace->setUserType(Trace::UT_CLIENT);
         } else {
             $trace->setUserType(Trace::UT_ADMIN);
         }
     } else {
         $trace->setUserType(Trace::UT_SUPERADMIN);
     }
     $tableBegin = ': <br><table class="table table-bordered table-condensed table-hover table-striped">';
     $tableBegin .= '<thead><tr><th class="text-left">' . $this->translate('Entity.field') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.oldVal') . '</th>';
     $tableBegin .= '<th class="text-left">' . $this->translate('Entity.newVal') . '</th></tr></thead><tbody>';
     $tableEnd = '</tbody></table>';
     $trace->setActionEntity(Trace::AE_COMPANY);
     $msg = '';
     if ($cloneCompany->getRef() != $company->getRef()) {
         $msg .= '<tr><td>' . $this->translate('Company.ref.label') . '</td><td>';
         if ($cloneCompany->getRef() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getRef();
         }
         $msg .= '</td><td>';
         if ($company->getRef() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getRef();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCorporateName() != $company->getCorporateName()) {
         $msg .= '<tr><td>' . $this->translate('Company.corporateName.label') . '</td><td>';
         if ($cloneCompany->getCorporateName() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCorporateName();
         }
         $msg .= '</td><td>';
         if ($company->getCorporateName() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCorporateName();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getType() != $company->getType()) {
         $msg .= '<tr><td>' . $this->translate('Company.type.label') . '</td><td>';
         if ($cloneCompany->getType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getType()->getLabel();
         }
         $msg .= '</td><td>';
         if ($company->getType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getType()->getLabel();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getTribunal() != $company->getTribunal()) {
         $msg .= '<tr><td>' . $this->translate('Company.tribunal.label') . '</td><td>';
         if ($cloneCompany->getTribunal() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getTribunal();
         }
         $msg .= '</td><td>';
         if ($company->getTribunal() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getTribunal();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getFisc() != $company->getFisc()) {
         $msg .= '<tr><td>' . $this->translate('Company.fisc.label') . '</td><td>';
         if ($cloneCompany->getFisc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getFisc();
         }
         $msg .= '</td><td>';
         if ($company->getFisc() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getFisc();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCommercialRegister() != $company->getCommercialRegister()) {
         $msg .= '<tr><td>' . $this->translate('Company.commercialRegister.label') . '</td><td>';
         if ($cloneCompany->getCommercialRegister() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCommercialRegister();
         }
         $msg .= '</td><td>';
         if ($company->getCommercialRegister() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCommercialRegister();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCommercialRegisterBureau() != $company->getCommercialRegisterBureau()) {
         $msg .= '<tr><td>' . $this->translate('Company.commercialRegisterBureau.label') . '</td><td>';
         if ($cloneCompany->getCommercialRegisterBureau() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCommercialRegisterBureau();
         }
         $msg .= '</td><td>';
         if ($company->getCommercialRegisterBureau() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCommercialRegisterBureau();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCnss() != $company->getCnss()) {
         $msg .= '<tr><td>' . $this->translate('Company.cnss.label') . '</td><td>';
         if ($cloneCompany->getCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCnss();
         }
         $msg .= '</td><td>';
         if ($company->getCnss() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCnss();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCnssBureau() != $company->getCnssBureau()) {
         $msg .= '<tr><td>' . $this->translate('Company.cnssBureau.label') . '</td><td>';
         if ($cloneCompany->getCnssBureau() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCnssBureau();
         }
         $msg .= '</td><td>';
         if ($company->getCnssBureau() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCnssBureau();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getPhysicalType() != $company->getPhysicalType()) {
         $msg .= '<tr><td>' . $this->translate('Company.physicalType.label') . '</td><td>';
         if ($cloneCompany->getPhysicalType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Company.physicalType.' . $cloneCompany->getPhysicalType());
         }
         $msg .= '</td><td>';
         if ($company->getPhysicalType() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $this->translate('Company.physicalType.' . $company->getPhysicalType());
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCin() != $company->getCin()) {
         $msg .= '<tr><td>' . $this->translate('Company.cin.label') . '</td><td>';
         if ($cloneCompany->getCin() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCin();
         }
         $msg .= '</td><td>';
         if ($company->getCin() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCin();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getPassport() != $company->getPassport()) {
         $msg .= '<tr><td>' . $this->translate('Company.passport.label') . '</td><td>';
         if ($cloneCompany->getPassport() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getPassport();
         }
         $msg .= '</td><td>';
         if ($company->getPassport() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getPassport();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCustomsCode() != $company->getCustomsCode()) {
         $msg .= '<tr><td>' . $this->translate('Company.customsCode.label') . '</td><td>';
         if ($cloneCompany->getCustomsCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCustomsCode();
         }
         $msg .= '</td><td>';
         if ($company->getCustomsCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCustomsCode();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getActionvn() != $company->getActionvn()) {
         $msg .= '<tr><td>' . $this->translate('Company.actionvn.label') . '</td><td>';
         if ($cloneCompany->getActionvn() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getActionvn();
         }
         $msg .= '</td><td>';
         if ($company->getActionvn() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getActionvn();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getStreetNum() != $company->getStreetNum()) {
         $msg .= '<tr><td>' . $this->translate('Company.streetNum.label') . '</td><td>';
         if ($cloneCompany->getStreetNum() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getStreetNum();
         }
         $msg .= '</td><td>';
         if ($company->getStreetNum() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getStreetNum();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getAddress() != $company->getAddress()) {
         $msg .= '<tr><td>' . $this->translate('Company.address.label') . '</td><td>';
         if ($cloneCompany->getAddress() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getAddress();
         }
         $msg .= '</td><td>';
         if ($company->getAddress() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getAddress();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getAddress2() != $company->getAddress2()) {
         $msg .= '<tr><td>' . $this->translate('Company.address2.label') . '</td><td>';
         if ($cloneCompany->getAddress2() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getAddress2();
         }
         $msg .= '</td><td>';
         if ($company->getAddress2() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getAddress2();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getTown() != $company->getTown()) {
         $msg .= '<tr><td>' . $this->translate('Company.town.label') . '</td><td>';
         if ($cloneCompany->getTown() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getTown();
         }
         $msg .= '</td><td>';
         if ($company->getTown() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getTown();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getZipCode() != $company->getZipCode()) {
         $msg .= '<tr><td>' . $this->translate('Company.zipCode.label') . '</td><td>';
         if ($cloneCompany->getZipCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getZipCode();
         }
         $msg .= '</td><td>';
         if ($company->getZipCode() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getZipCode();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getCountry() != $company->getCountry()) {
         $msg .= '<tr><td>' . $this->translate('Company.country.label') . '</td><td>';
         if ($cloneCompany->getCountry() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getCountry();
         }
         $msg .= '</td><td>';
         if ($company->getCountry() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getCountry();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getPhone() != $company->getPhone()) {
         $msg .= '<tr><td>' . $this->translate('Company.phone.label') . '</td><td>';
         if ($cloneCompany->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getPhone();
         }
         $msg .= '</td><td>';
         if ($company->getPhone() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getPhone();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getMobile() != $company->getMobile()) {
         $msg .= '<tr><td>' . $this->translate('Company.mobile.label') . '</td><td>';
         if ($cloneCompany->getMobile() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getMobile();
         }
         $msg .= '</td><td>';
         if ($company->getMobile() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getMobile();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getFax() != $company->getFax()) {
         $msg .= '<tr><td>' . $this->translate('Company.fax.label') . '</td><td>';
         if ($cloneCompany->getFax() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getFax();
         }
         $msg .= '</td><td>';
         if ($company->getFax() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getFax();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getEmail() != $company->getEmail()) {
         $msg .= '<tr><td>' . $this->translate('Company.email.label') . '</td><td>';
         if ($cloneCompany->getEmail() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getEmail();
         }
         $msg .= '</td><td>';
         if ($company->getEmail() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getEmail();
         }
         $msg .= '</td></tr>';
     }
     if ($cloneCompany->getOtherInfos() != $company->getOtherInfos()) {
         $msg .= '<tr><td>' . $this->translate('Company.otherInfos.label') . '</td><td>';
         if ($cloneCompany->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $cloneCompany->getOtherInfos();
         }
         $msg .= '</td><td>';
         if ($company->getOtherInfos() == null) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= $company->getOtherInfos();
         }
         $msg .= '</td></tr>';
     }
     if (\count(\array_diff($company->getSectors()->toArray(), $cloneCompany->getSectors()->toArray())) != 0 || \count(\array_diff($cloneCompany->getSectors()->toArray(), $company->getSectors()->toArray())) != 0) {
         $msg .= '<tr><td>' . $this->translate('Company.sectors.label') . '</td><td>';
         if (\count($cloneCompany->getSectors()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($cloneCompany->getSectors() as $sector) {
                 $msg .= '<li>' . $sector->getLabel() . '</li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td><td>';
         if (\count($company->getSectors()) == 0) {
             $msg .= '<span class="label label-warning">' . $this->translate('_NA') . '</span>';
         } else {
             $msg .= '<ul>';
             foreach ($company->getSectors() as $sector) {
                 $msg .= '<li>' . $sector->getLabel() . '</li>';
             }
             $msg .= '<ul>';
         }
         $msg .= '</td></tr>';
     }
     if ($msg != '') {
         $msg = $tableBegin . $msg . $tableEnd;
         $trace->setMsg($this->translate('Company.traceEdit', array('%company%' => $company->getCorporateName())) . $msg);
         $trace->setDtCrea(new \DateTime('now'));
         $em = $this->getEntityManager();
         $em->persist($trace);
         $em->flush();
     }
 }
コード例 #12
0
 /**
  * Get Query for All Entities
  *
  * @param Company $company
  * @param boolean $showall
  *
  * @return \Doctrine\ORM\Query
  */
 public function getAllByCompanyQuery(Company $company, $showall = true)
 {
     $qb = $this->createQueryBuilder('t')->where('t.companyId = :companyId')->orderBy('t.dtCrea', 'ASC')->addOrderBy('t.actionType', 'ASC')->addOrderBy('t.actionEntity', 'ASC')->setParameter('companyId', $company->getId());
     if ($showall == false) {
         $qb->andWhere('t.actionEntity NOT IN (:entities)');
         $qb->setParameter('entities', array(Trace::AE_DOCGROUPSYST, Trace::AE_DOCGROUPAUDIT, Trace::AE_SHAREHOLDER, Trace::AE_PILOT, Trace::AE_CUSER, Trace::AE_CADMIN));
     }
     return $qb->getQuery();
 }
コード例 #13
0
ファイル: BuyRepository.php プロジェクト: sasedev/acf-expert
 /**
  * All count
  *
  * @param Company $c
  * @param CompanyNature $cn
  *
  * @return Ambigous <\Doctrine\ORM\mixed, mixed, multitype:,
  *         \Doctrine\DBAL\Driver\Statement, \Doctrine\Common\Cache\mixed>
  */
 public function updateCompanyNatureNullByCompany(Company $c, CompanyNature $cn)
 {
     $rsm = new ResultSetMapping();
     $qb = $this->getEntityManager()->createNativeQuery('UPDATE acf_transactions SET nature_id =  ? FROM acf_transactions AS t INNER JOIN acf_company_mbalances AS m ON m.id = t.mbalance_id  WHERE m.company_id = ?  AND t.nature_id IS NULL AND t.transactiontype = ?', $rsm);
     $qb->setParameter(1, $cn->getId());
     $qb->setParameter(2, $c->getId());
     $qb->setParameter(3, Transaction::TTYPE_BUY);
     $qb->execute();
 }
コード例 #14
0
ファイル: User.php プロジェクト: sasedev/acf-expert
 /**
  * Add company
  *
  * @param Company $company
  *
  * @return User
  */
 public function addAdmCompany(Company $company)
 {
     $this->admCompanies[] = $company;
     $company->addAdmin($this);
     return $this;
 }
コード例 #15
0
ファイル: Sector.php プロジェクト: sasedev/acf-expert
 /**
  * Add company
  *
  * @param Company $company
  *
  * @return Sector
  */
 public function addCompany(Company $company)
 {
     $this->companies[] = $company;
     $company->addSector($this);
     return $this;
 }
コード例 #16
0
 /**
  * Get Query for All Entities
  *
  * @param Company $company
  *
  * @return \Doctrine\ORM\Query
  */
 public function getAllByCompanyQuery(Company $company)
 {
     $qb = $this->createQueryBuilder('cu')->join('cu.company', 'c')->where('c.id = :id')->orderBy('cu.dtCrea', 'ASC')->setParameter('id', $company->getId());
     $query = $qb->getQuery();
     return $query;
 }
コード例 #17
0
 /**
  * Get Query for All Entities
  *
  * @param Company $c
  *
  * @return \Doctrine\ORM\Query
  */
 public function getAllByCompanyQuery(Company $c)
 {
     $qb = $this->createQueryBuilder('cf')->join('cf.company', 'c')->where('c.id = :id')->orderBy('cf.lastName', 'ASC')->addOrderBy('cf.firstName', 'ASC')->setParameter('id', $c->getId());
     $query = $qb->getQuery();
     return $query;
 }