public function gettabs($id)
 {
     $entity = $this->getDoctrine()->getRepository('SoftoneBundle:Product')->find($id);
     if ($id == 0 and @$entity->id == 0) {
         $entity = new Product();
     }
     $customer = $this->getDoctrine()->getRepository('SoftoneBundle:Customer')->find(1);
     echo $entity->getGroupedDiscount($customer);
     $entity->updatetecdoc();
     $fields["title"] = array("label" => "Title", "required" => true, "className" => "col-md-6 col-sm-6");
     $fields["erpCode"] = array("label" => "Erp Code", "required" => true, "className" => "col-md-6 col-sm-6");
     $fields["tecdocSupplierId"] = array("label" => "Tecdoc Supplier", "required" => true, "className" => "col-md-6", 'type' => "select", 'datasource' => array('repository' => 'SoftoneBundle:TecdocSupplier', 'name' => 'supplier', 'value' => 'id'));
     $fields["tecdocCode"] = array("label" => "Tecdoc Code", "required" => true, "className" => "col-md-6");
     $fields["supplierId"] = array("label" => "Supplier", "className" => "col-md-6", 'type' => "select", "required" => true, 'datasource' => array('repository' => 'SoftoneBundle:SoftoneSupplier', 'name' => 'title', 'value' => 'id'));
     $fields["supplierCode"] = array("label" => "Supplier Code", "className" => "col-md-6", "required" => true);
     $fields["itemPricew"] = array("label" => "Wholesale Price", "className" => "col-md-3", "required" => true);
     $fields["itemPricer"] = array("label" => "Retail Price", "className" => "col-md-3", "required" => true);
     $fields["itemMarkupw"] = array("label" => "Wholesale Markup", "className" => "col-md-3", "required" => true);
     $fields["itemMarkupr"] = array("label" => "Retail Markup", "className" => "col-md-3", "required" => true);
     $forms = $this->getFormLyFields($entity, $fields);
     if ($id > 0 and count($entity) > 0) {
         $entity2 = $this->getDoctrine()->getRepository('SoftoneBundle:Product')->find($id);
         $entity2->setReference("");
         $fields2["reference"] = array("label" => "Erp Code", "className" => "synafiacode col-md-12");
         $forms2 = $this->getFormLyFields($entity2, $fields2);
         $dtparams[] = array("name" => "ID", "index" => 'id', "active" => "active");
         $dtparams[] = array("name" => "Title", "index" => 'title');
         $dtparams[] = array("name" => "Code", "index" => 'erpCode');
         $dtparams[] = array("name" => "Price", "index" => 'itemPricew01');
         $params['dtparams'] = $dtparams;
         $params['id'] = $dtparams;
         $params['url'] = '/product/getrelation/' . $id;
         $params['key'] = 'gettabs_' . $id;
         $params["ctrl"] = 'ctrlgettabs';
         $params["app"] = 'appgettabs';
         $datatables[] = $this->contentDatatable($params);
     }
     $tabs[] = array("title" => "General", "datatables" => array(), "form" => $forms, "content" => '', "index" => $this->generateRandomString(), 'search' => 'text', "active" => true);
     if ($id > 0 and count($entity) > 0) {
         $tabs[] = array("title" => "Retaltions", "datatables" => $datatables, "form" => $forms2, "content" => '', "index" => $this->generateRandomString(), 'search' => 'text', "active" => true);
     }
     foreach ($tabs as $tab) {
         $this->addTab($tab);
     }
     $json = $this->tabs();
     return $json;
 }