<?php
namespace App\Service\Finance;
use Symfony\Contracts\Translation\TranslatorInterface;
use App\Service\Kernel\KernelService;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Finance\Lead;
use App\Entity\Finance\Proposal;
use App\Entity\Finance\ProposalElement;
use App\Entity\CMS\CMSVacancy;
use App\Service\Kernel\DMSService;
use App\Entity\Finance\SalesCondition;
/**
* Description of LeadService
*
*/
class ProposalService {
private $TranslatorInterface;
private $entityManager;
private $kernel_service;
private $dMSService;
public function __construct(TranslatorInterface $translator, EntityManagerInterface $entityManager,
KernelService $kernel_service,
DMSService $dMSService) {
$this->TranslatorInterface = $translator;
$this->entityManager = $entityManager;
$this->kernel_service = $kernel_service;
$this->dMSService = $dMSService;
}
public function createProposal($subject, $type, $proposedOn, $contactPerson, $client, $endClient, $comment, $lead=null, $open, $owner, $interview, $interviewDate, $interviewComment, $employee, $intakeprice, $unitprice, $externalId=null, $organization)
{
$entityManager = $this->entityManager;
$dmsservice = $this->dMSService;
$proposal = new Proposal();
$proposalElement = new ProposalElement();
//$date = new DateTime($dateString);
$proposal->setOrganization($organization);
$proposal->setSubject($subject);
$proposal->setType($type);
$proposal->setProposedOn($proposedOn);
$proposal->setContactPerson($contactPerson);
$proposal->setClient($client);
$proposal->setEndClient($endClient);
$proposal->setOwner($owner);
$proposal->setComment($comment);
$proposal->setOrganization($organization);
$proposal->setOpen($open);
$proposal->setLead($lead);
$proposal->setInterview($interview);
$proposal->setInterviewDate($interviewDate);
$proposal->setInterviewComment($interviewComment);
$proposal->setState(0);
$proposal->setExternalid($externalId);
$entityManager->persist($proposal);
$entityManager->flush();
$proposalElement->setEmployee($employee);
$proposalElement->setIntakePrice($intakeprice);
$proposalElement->setUnitPrice($unitprice);
$proposalElement->setState(0);
$proposalElement->setQuantity(0);
$proposalElement->setProposal($proposal);
$entityManager->persist($proposalElement);
$entityManager->flush();
return $proposal;
}
}