Example #1
0
 public function doclistOnRow($row)
 {
     $item = $row->getDataItem();
     $supplier = Customer::load($item->intattr1);
     $item = $item->cast();
     $row->add(new Label('number', $item->document_number));
     $row->add(new Label('date', date('d-m-Y', $item->document_date)));
     $row->add(new Label('supplier', $supplier ? $supplier->customer_name : ""));
     $row->add(new Label('amount', $item->amount > 0 ? H::fm($item->amount) : ""));
     $row->add(new Label('payment', $item->intattr2 > 0 ? H::fm($item->intattr2) : ""));
     $row->add(new Label('state', Document::getStateName($item->state)));
     $row->add(new ClickLink('show'))->setClickHandler($this, 'showOnClick');
     $row->add(new ClickLink('edit'))->setClickHandler($this, 'editOnClick');
     //закрытый период
     if ($item->updated < strtotime("2013-01-01")) {
         $row->edit->setVisible(false);
         $row->cancel->setVisible(false);
     }
 }
Example #2
0
 public function doclistOnRow($row)
 {
     $item = $row->getDataItem();
     $item = $item->cast();
     $row->add(new Label('name', $item->meta_desc));
     $row->add(new Label('number', $item->document_number));
     $row->add(new Label('date', date('d-m-Y', $item->document_date)));
     $row->add(new Label('amount', $item->amount > 0 ? H::fm($item->amount) : ""));
     $row->add(new Label('state', Document::getStateName($item->state)));
     // $row->add(new Label('created', date('d-m-Y', $item->created)));
     $row->add(new ClickLink('show'))->setClickHandler($this, 'showOnClick');
     $row->add(new ClickLink('edit'))->setClickHandler($this, 'editOnClick');
     $row->add(new ClickLink('cancel'))->setClickHandler($this, 'cancelOnClick');
     $row->add(new ClickLink('delete'))->setClickHandler($this, 'deleteOnClick');
     $user = System::getUser();
     $row->delete->setVisible($user->userlogin == 'admin' || ($user->user_id = $item->user_id));
     if ($item->state == Document::STATE_EXECUTED || $item->state == Document::STATE_CLOSED) {
         $row->delete->setVisible(false);
         $row->edit->setVisible(false);
         $row->cancel->setVisible(true);
     } else {
         $row->edit->setVisible(true);
         $row->cancel->setVisible(false);
     }
     //спписок документов   которые   могут  быть созданы  на  основании  текущего
     $basedon = $row->add(new Label('basedon'));
     $basedonlist = $item->getRelationBased();
     if (count($basedonlist) == 0) {
         $basedon->setVisible(false);
     } else {
         $list = "";
         foreach ($basedonlist as $doctype => $docname) {
             $list .= "<li><a href=\"/?p=ZippyERP/ERP/Pages/Doc/" . $doctype . "&arg=/0/{$item->document_id}\">{$docname}</a></li>";
         }
         $basedon = $row->add(new Label('basedlist'))->setText($list, true);
     }
     //закрытый период
     if ($item->updated < strtotime("2013-01-01")) {
         $row->edit->setVisible(false);
         $row->cancel->setVisible(false);
     }
 }