public function OnDetail($saved = false, $id = 0) { $contact = Contact::load($this->contactdetail->getItem()->contact_id); $this->employeedetail->editcontact->setText($contact->fullname); $this->employeedetail->editcontact->setKey($contact->contact_id); $this->contactdetail->setVisible(false); $this->employeedetail->setVisible(true); if ($saved) { //обновляем данные сотрудника из контакта $this->employeetable->employeelist->Reload(); $this->employeedetail->opencontact->setVisible(true); $this->employeedetail->showcontact->setVisible(true); $this->employeedetail->addcontact->setVisible(false); } }
public function OnNewContactform($sender) { $contact_id = $sender->choicecontact->getKey(); if ($contact_id > 0) { $contact = Contact::load($contact_id); $newc = $this->_customer->contact_id == -1; //создается контрагент if ($newc) { $this->_customer->contact_id = $contact_id; $this->_customer->customer_name = "ЧП " . $contact->firstname; $this->_customer->Save(); } $contact->customer_id = $this->_customer->customer_id; $contact->Save(); $this->editcontacts->contactlist->Reload(); if ($newc) { $this->editcontacts->setVisible(false); $this->customerdetail->setVisible(true); $this->customerdetail->editcustomername->setText($this->_customer->customer_name); $this->customertable->customerlist->Reload(); } $sender->choicecontact->setText(''); $sender->choicecontact->setKey(0); } }