public function Execute() { $conn = \ZCL\DB\DB::getConnect(); $store_id = $this->headerdata['store_id']; $item = \ZippyERP\ERP\Entity\Item::getSumItem(); $stock = \ZippyERP\ERP\Entity\Stock::getStock($store_id, $item->item_id, 1, true); $discont = 0; //скидки 704 счет $date = new Carbon(); $date->setTimestamp($this->document_date); $end = $date->endOfMonth()->getTimestamp(); $begin = $date->startOfMonth()->getTimestamp(); $sql = " select coalesce(abs(sum(amount)),0) from erp_account_subconto where amount < 0 and account_id=285 and extcode = {$store_id} and document_date <= " . $conn->DBDate($end); $tm = $conn->GetOne($sql); //торговая наценка на конец периода //остатки на конец периода $sql = " select coalesce(sum(quantity),0) AS quantity,coalesce(price,0) as price from erp_account_subconto sc join erp_store_stock st on sc.stock_id = st.stock_id where store_id = {$store_id} and date(document_date) <= " . $conn->DBDate($end); $row = $conn->GetRow($sql); $ost = $row['quantity'] / 1000; $ost = $ost * $row['price']; if ($ost == 0) { return; } //выручка $sql = " select coalesce(abs(sum(amount)),0) from erp_account_subconto where amount < 0 and account_id=702 and extcode = {$store_id} and date(document_date) <= " . $conn->DBDate($end) . " and date(document_date) >= " . $conn->DBDate($begin); $saled = $conn->GetOne($sql); //выручка сданная в кассу $k = ($tm - $discont) / ($ost - $discont); $sb = (1 - $k) * $saled; //себестоимость // списываем наценку Entry::AddEntry("285", "282", $saled - $sb, $this->document_id, $this->document_date); // себестоимость реализации Entry::AddEntry("902", "282", $sb, $this->document_id, $this->document_date); $item = \ZippyERP\ERP\Entity\Item::getSumItem(); $stockto = \ZippyERP\ERP\Entity\Stock::getStock($store_id, $item->item_id, 1, true); $sc = new SubConto($this, 282, 0 - $saled); $sc->setStock($stockto->stock_id); $sc->setQuantity(0 - $saled * 1000); //цена единицы товара - 1 копейка. $sc->save(); // НДС $nds = H::nds(true); Entry::AddEntry("702", "641", $saled * $nds, $this->document_id, $this->document_date); return true; }
public function Execute() { $ret = 0; $cost = 0; foreach ($this->detaildata as $value) { $stock = \ZippyERP\ERP\Entity\Stock::load($value['stock_id']); $ret = $ret + $stock->price - $stock->partion; $cost = $cost + $stock->partion; $sc = new SubConto($this, 282, 0 - $value['quantity'] / 1000 * $stock->price); $sc->setStock($stock->stock_id); $sc->setQuantity(0 - $value['quantity']); $sc->save(); } // списываем наценку Entry::AddEntry("285", "282", $ret, $this->document_id, $this->document_date); $sc = new SubConto($this, 285, $ret); $sc->setExtCode($this->headerdata["store"]); $sc->save(); // себестоимость реализации Entry::AddEntry("902", "282", $cost, $this->document_id, $this->document_date); //налоговые обязательства if ($this->headerdata['totalnds'] > 0) { Entry::AddEntry("702", "643", $this->headerdata['totalnds'], $this->document_id, $this->document_date); } return true; }
public function Execute() { $conn = \ZCL\DB\DB::getConnect(); $conn->StartTrans(); $employee_id = $this->headerdata["employee"]; $expensetype = $this->headerdata['expensetype']; if ($expensetype == 201 || $expensetype == 22 || $expensetype == 281) { foreach ($this->detaildata as $value) { //поиск записи о товаре на складе $stock = \ZippyERP\ERP\Entity\Stock::getStock($this->headerdata['store'], $value['item_id'], $value['price'], true); $sc = new SubConto($this, $expensetype, $value['quantity'] / 1000 * $stock->price); $sc->setStock($stock->stock_id); $sc->setQuantity($value['quantity']); $sc->save(); } Entry::AddEntry($expensetype, "372", $this->headerdata['total'] - $this->headerdata['totalnds'], $this->document_id, $this->document_date); //налоговый кредит if ($this->headerdata['totalnds'] > 0) { Entry::AddEntry("644", "372", $this->headerdata['totalnds'], $this->document_id, $this->document_date); } } else { Entry::AddEntry($expensetype, "372", $this->headerdata["expenseamount"], $this->document_id, $this->document_date); $sc = new SubConto($this, 372, 0 - $this->headerdata["expenseamount"]); $sc->setEmployee($employee_id); $sc->save(); } $conn->CompleteTrans(); return true; }
public function Execute() { $conn = \ZCL\DB\DB::getConnect(); $conn->StartTrans(); $total = $this->headerdata['total']; $customer_id = $this->headerdata["customer"]; // \ZippyERP\ERP\Entity\Customer::AddActivity($customer_id, 0 - $total, $this->document_id); if ($this->headerdata['cash'] == true) { $cash = MoneyFund::getCash(); \ZippyERP\ERP\Entity\Entry::AddEntry("30", "36", $total, $this->document_id, $cash->id, $customer_id); $sc = new SubConto($this, 36, 0 - $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 30, $total); $sc->setMoneyfund($cash->id); // $sc->save(); } if ($this->headerdata['totalnds'] > 0) { Entry::AddEntry("703", "643", $this->headerdata['totalnds'], $this->document_id, $this->document_date); } Entry::AddEntry("36", "703", $total, $this->document_id, $this->document_date); $sc = new SubConto($this, 36, $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $conn->CompleteTrans(); return true; }
public function Execute() { $total = $this->headerdata['total']; $customer_id = $this->headerdata["customer"]; if ($this->headerdata['cash'] == true) { $cash = MoneyFund::getCash(); Entry::AddEntry("63", "30", $total, $this->document_id, $this->document_date); $sc = new SubConto($this, 63, $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 30, $total); $sc->setMoneyfund($cash->id); // $sc->save(); } if ($this->headerdata['totalnds'] > 0) { $total = $total - $this->headerdata['totalnds']; Entry::AddEntry("644", "63", $this->headerdata['totalnds'], $this->document_id, 0, $customer_id); $sc = new SubConto($this, 63, 0 - $this->headerdata['totalnds']); $sc->setCustomer($customer_id); $sc->save(); $sc = new SubConto($this, 644, $this->headerdata['totalnds']); $sc->setExtCode(TAX_NDS); //$sc->save(); } Entry::AddEntry("91", "63", $total, $this->document_id, $this->document_date); $sc = new SubConto($this, 63, 0 - $value); $sc->setCustomer($customer_id); $sc->save(); return true; }
public function Execute() { $mf = MoneyFund::getCash(); $optype = $this->headerdata['optype']; if ($optype == self::TYPEOP_CUSTOMER) { $ret = Entry::AddEntry(63, 30, $this->headerdata['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 63, $this->headerdata['amount']); $sc->setCustomer($this->headerdata['opdetail']); $sc->save(); } if ($optype == self::TYPEOP_CASH) { $ret = Entry::AddEntry(372, 30, $this->headerdata['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 372, $this->headerdata['amount']); $sc->setEmployee($this->headerdata['opdetail']); $sc->save(); } if ($optype == self::TYPEOP_BANK) { $ret = Entry::AddEntry(31, 30, $this->headerdata['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 31, $this->headerdata['amount']); $sc->setMoneyfund($this->headerdata['opdetail']); $sc->save(); } //касса $sc = new SubConto($this, 30, 0 - $this->headerdata['amount']); $sc->setMoneyfund($this->headerdata['opdetail']); $sc->save(); return true; }
public function Execute() { $acc702 = Account::load("702"); $s702 = $acc702->getSaldo($this->document_date); Entry::AddEntry(702, 79, abs($s702), $this->document_id, $this->document_date); $acc902 = Account::load("902"); $s902 = $acc902->getSaldo($this->document_date); Entry::AddEntry(79, 902, abs($s902), $this->document_id, $this->document_date); return true; }
public function Execute() { $conn = \ZCL\DB\DB::getConnect(); $conn->StartTrans(); $types = array(); //аналитика foreach ($this->detaildata as $item) { $stock = \ZippyERP\ERP\Entity\Stock::getStock($this->headerdata['store'], $item['item_id'], $item['partion'], true); $sc = new SubConto($this, $item['type'], 0 - $item['partion'] * ($item['quantity'] / 1000)); $sc->setStock($stock->stock_id); $sc->setQuantity(0 - $item['quantity']); $sc->save(); //группируем по синтетическим счетам if ($types[$item['type']] > 0) { $types[$item['type']]['amount'] = $types[$item['type']] + $item['price'] * ($item['quantity'] / 1000); $types[$item['type']]['pamount'] = $types[$item['type']] + $item['partion'] * ($item['quantity'] / 1000); $types[$item['type']]['namount'] = $types[$item['type']] + $item['nds']; } else { $types[$item['type']]['amount'] = $item['pricends'] * ($item['quantity'] / 1000); $types[$item['type']]['pamount'] = $item['partion'] * ($item['quantity'] / 1000); $types[$item['type']]['namount'] = $item['nds']; } } foreach ($types as $acc => $value) { if ($acc == 281) { Entry::AddEntry("902", "281", $value['pamount'], $this->document_id, $this->document_date); Entry::AddEntry("36", "702", $value['amount'], $this->document_id, $this->document_date); if ($this->headerdata['isnds'] > 0) { Entry::AddEntry("702", "643", $value['namount'], $this->document_id, $this->document_date); } } if ($acc == 26) { Entry::AddEntry("902", "26", $value['pamount'], $this->document_id, $this->document_date); Entry::AddEntry("36", "701", $value['amount'], $this->document_id, $this->document_date); if ($this->headerdata['isnds'] > 0) { Entry::AddEntry("701", "643", $value['namount'], $this->document_id, $this->document_date); } } $sc = new SubConto($this, 36, $value['amount']); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); } if ($this->headerdata['cash'] == true) { $cash = MoneyFund::getCash(); \ZippyERP\ERP\Entity\Entry::AddEntry("30", "36", $total, $this->document_id, $cash->id, $customer_id); $sc = new SubConto($this, 36, 0 - $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 30, $total); $sc->setMoneyfund($cash->id); // $sc->save(); } $conn->CompleteTrans(); return true; }
public function Execute() { $conn = \ZCL\DB\DB::getConnect(); $conn->StartTrans(); $ret = 0; // торговая наценка $amount = 0; foreach ($this->detaildata as $value) { //приниммаем на склад $stockto = Stock::getStock($this->headerdata['storeto'], $value['item_id'], $value['partion'], true); $sc = new SubConto($this, $value['type'], $value['quantity'] / 1000 * $stockto->price); $sc->setStock($stockto->stock_id); $sc->setQuantity($value['quantity']); $sc->save(); $store = Store::load($this->headerdata['storefrom']); if ($store->store_type == Store::STORE_TYPE_RET) { //розница $stockfrom = Stock::getFirst("store_id={$this->headerdata['storefrom']} and item_id={$value['item_id']} and price={$value['price']} and partion={$value['partion']} and closed <> 1"); if ($stockfrom == null) { return false; } $sc = new SubConto($this, 282, 0 - $value['quantity'] / 1000 * $stockfrom->price); $sc->setStock($stockfrom->stock_id); $sc->setQuantity(0 - $value['quantity']); $sc->save(); $ret += $value['quantity'] / 1000 * ($value['price'] - $value['partion']); $amount += $value['quantity'] / 1000 * $value['partion']; } if ($store->store_type == Store::STORE_TYPE_RET_SUM) { //розница суммовой учет //специальный товар для cуммового учета $item = \ZippyERP\ERP\Entity\Item::getSumItem(); $stockfrom = Stock::getStock($this->headerdata['storefrom'], $item->item_id, 1, true); $sc = new SubConto($this, 282, 0 - $value['quantity'] * $value['price']); //цена единицы товара = 1 копейка. $sc->setStock($stockfrom->stock_id); $sc->setQuantity(0 - $value['quantity'] * $value['price']); //цена единицы товара - 1 копейка. $sc->save(); $ret += $value['quantity'] / 1000 * ($value['price'] - $value['partion']); $amount += $value['quantity'] / 1000 * $value['partion']; } } if ($amount > 0) { // розница Entry::AddEntry(281, 282, $amount, $this->document_id, $this->document_date); Entry::AddEntry(285, 282, $ret, $this->document_id, $this->document_date); $sc = new SubConto($this, 285, $ret); $sc->setExtCode($store->store_id); $sc->save(); } $conn->CompleteTrans(); return true; }
public function Execute() { foreach ($this->detaildata as $value) { if ($value['noentry'] === 'true') { //не выполнять проводки continue; } if ($value['optype'] == self::OUT) { Entry::AddEntry('63', "31", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 63, $value['amount']); $sc->setCustomer($value['customer']); $sc->save(); $sc = new SubConto($this, 31, 0 - $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->save(); } if ($value['optype'] == self::IN) { Entry::AddEntry('31', "36", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 36, 0 - $value['amount']); $sc->setCustomer($value['customer']); $sc->save(); $sc = new SubConto($this, 31, $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->save(); } if ($value['optype'] == self::TAX) { //Entry::AddEntry('643', "644", $value['amount'], $this->document_id, $this->document_date); Entry::AddEntry('643', "31", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 643, $value['amount']); $sc->setCustomer($value['customer']); $sc->save(); $sc = new SubConto($this, 31, 0 - $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->setExtCode($value['tax']); // код налога $sc->save(); } if ($value['optype'] == self::CASHIN) { $cash = MoneyFund::getCash(); Entry::AddEntry('30', "31", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 31, 0 - $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->save(); } if ($value['optype'] == self::CASHOUT) { $cash = MoneyFund::getCash(); Entry::AddEntry('31', "30", $value['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 31, $value['amount']); $sc->setMoneyfund($this->headerdata['bankaccount']); $sc->save(); } // $this->AddConnectedDoc($value['doc']); } }
public function Execute() { $accarr = unserialize(base64_decode($this->headerdata['entry'])); foreach ($accarr as $entry) { Entry::AddEntry($entry->acc_d, $entry->acc_c, $entry->amount, $this->document_id, $this->document_date); } //ТМЦ $itemarr = unserialize(base64_decode($this->headerdata['item'])); if (is_array($itemarr)) { foreach ($itemarr as $item) { $stock = Stock::getStock($item->store_id, $item->item_id, $item->price, true); $acc = explode('_', $item->op); $sc = new SubConto($this, $acc[0], $acc[1] == 'd' ? $item->qty / 1000 * $stock->price : 0 - $item->qty / 1000 * $stock->price); $sc->setStock($stock->stock_id); $sc->setQuantity($acc[1] == 'd' ? $item->qty : 0 - $item->qty); $sc->save(); } } //сотрудники (лицевые счета) $emparr = unserialize(base64_decode($this->headerdata['emp'])); if (count($emparr) > 0) { foreach ($emparr as $emp) { $val = $emp->val; $acc = explode('_', $emp->op); $sc = new SubConto($this, $acc[0], $acc[1] == 'd' ? $val : 0 - $val); $sc->setEmployee($emp->employee_id); $sc->save(); } } //контрагенты (взаиморасчеты) $carr = unserialize(base64_decode($this->headerdata['c'])); if (count($carr) > 0) { foreach ($carr as $c) { $val = $c->val; $acc = explode('_', $c->op); $sc = new SubConto($this, $acc[0], $acc[1] == 'd' ? $val : 0 - $val); $sc->setCustomer($c->customer_id); $sc->save(); } } //денежные счета $farr = unserialize(base64_decode($this->headerdata['f'])); if (count($farr) > 0) { foreach ($farr as $f) { $val = $f->val; $acc = explode('_', $f->op); $sc = new SubConto($this, $acc[0], $acc[1] == 'd' ? $val : 0 - $val); $sc->setMoneyfund($f->id); $sc->save(); } } }
public function Execute() { $diff = $this->headerdata['summa'] - $this->headerdata['actual']; Entry::AddEntry("282", "285", $diff, $this->document_id, $cash->id, $customer_id); $sc = new SubConto($this, 282, $diff); $sc->setStock($this->headerdata["stock_id"]); $sc->setQuantity($diff); $sc->save(); $sc = new SubConto($this, 285, 0 - $diff); $sc->setExtCode($this->headerdata["store_id"]); $sc->save(); return true; }
public function Execute() { $types = array(); //аналитика foreach ($this->detaildata as $item) { $stock = \ZippyERP\ERP\Entity\Stock::getStock($this->headerdata['store'], $item['item_id'], $item['price'], true); $sc = new SubConto($this, $item['type'], $item['amount'] - $item['nds']); $sc->setStock($stock->stock_id); $sc->setQuantity($item['quantity']); $sc->save(); //группируем по синтетическим счетам if ($types[$item['type']] > 0) { $types[$item['type']] = $types[$item['type']] + $item['amount'] - $item['nds']; } else { $types[$item['type']] = $item['amount'] - $item['nds']; } } foreach ($types as $acc => $value) { Entry::AddEntry($acc, "63", $value, $this->document_id, $this->document_date); $sc = new SubConto($this, 63, 0 - $value); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); } $total = $this->headerdata['total']; if ($this->headerdata['cash'] == true) { $cash = MoneyFund::getCash(); Entry::AddEntry("63", "30", $total, $this->document_id, $this->document_date); $sc = new SubConto($this, 63, $total); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 30, 0 - $total); $sc->setMoneyfund($cash->id); // $sc->save(); } //налоговый кредит if ($this->headerdata['totalnds'] > 0) { Entry::AddEntry("644", "63", $this->headerdata['totalnds'], $this->document_id, $this->document_date); $sc = new SubConto($this, 63, 0 - $this->headerdata['totalnds']); $sc->setCustomer($this->headerdata["customer"]); $sc->save(); $sc = new SubConto($this, 644, $this->headerdata['totalnds']); $sc->setExtCode(TAX_NDS); //$sc->save(); } return true; }
public function Execute() { $cash = MoneyFund::getCash(); $ret = ""; $optype = $this->headerdata['optype']; if ($optype == self::TYPEOP_CUSTOMER) { $ret = Entry::AddEntry(30, 36, $this->headerdata['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 36, 0 - $this->headerdata['amount']); $sc->setCustomer($this->headerdata['opdetail']); $sc->save(); } if ($optype == self::TYPEOP_CASH) { $ret = Entry::AddEntry(30, 372, $this->headerdata['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 372, 0 - $this->headerdata['amount']); $sc->setEmployee($this->headerdata['opdetail']); $sc->save(); } if ($optype == self::TYPEOP_BANK) { $ret = Entry::AddEntry(30, 31, $this->headerdata['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 31, 0 - $this->headerdata['amount']); $sc->setMoneyfund($this->headerdata['opdetail']); $sc->save(); } if ($optype == self::TYPEOP_RET) { $store_id = $this->headerdata['opdetail']; // магазин $ret = Entry::AddEntry(30, 702, $this->headerdata['amount'], $this->document_id, $this->document_date); $sc = new SubConto($this, 702, 0 - $this->headerdata['amount']); $sc->setExtCode($this->headerdata['opdetail']); $sc->save(); $store = \ZippyERP\ERP\Entity\Store::load($store_id); if ($store->store_type == \ZippyERP\ERP\Entity\Store::STORE_TYPE_RET_SUM) { $nds = \ZippyERP\ERP\Helper::nds(true); Entry::AddEntry(702, 643, $nds * $this->headerdata['amount'], $this->document_id, $this->document_date); } } //касса $sc = new SubConto($this, 30, $this->headerdata['amount']); $sc->setMoneyfund($cash->id); $sc->save(); if (strlen($ret) > 0) { throw new \Exception($ret); } return true; }
public function Execute() { $diffall = 0; foreach ($this->detaildata as $value) { $diffall = $diffall + $value['quantity'] / 1000 * ($value['newprice'] - $value['price']); $stock = Stock::load($value["stock_id"]); $newstock = Stock::getStock($stock->store_id, $stock->item_id, $value['newprice'], true); $sc = new SubConto($this, 282, 0 - $value['quantity'] / 1000 * $stock->price); $sc->setStock($stock->stock_id); $sc->setQuantity(0 - $value['quantity']); $sc->save(); $sc = new SubConto($this, 282, $value['quantity'] / 1000 * $newstock->price); $sc->setStock($newstock->stock_id); $sc->setQuantity($value['quantity']); $sc->save(); } Entry::AddEntry("282", "285", $diffall, $this->document_id, $cash->id, $customer_id); $sc = new SubConto($this, 285, 0 - $diffall); $sc->setExtCode($this->headerdata["store"]); $sc->save(); return true; }
public function setDoc(\ZippyERP\ERP\Entity\Doc\Document $doc) { $this->_doc = $doc; // получение екзамеляра конкретного документа с данными $type = Helper::getMetaType($doc->type_id); $class = "\\ZippyERP\\ERP\\Entity\\Doc\\" . $type['meta_name']; $doc = $class::load($doc->document_id); // проверяем поддержку экспорта $exportlist = $doc->supportedExport(); $this->word->setVisible(in_array(Document::EX_WORD, $exportlist)); $this->excel->setVisible(in_array(Document::EX_EXCEL, $exportlist)); $this->xml->setVisible(in_array(Document::EX_XML_GNAU, $exportlist)); // генерация печатной формы $html = $doc->generateReport(); if (strlen($html) == 0) { // $this->owner->setError("Не найден шаблон печатной формы"); // return; $html = "<h4>Печатная форма не задана</h4>"; $this->print->setVisible(false); $this->html->setVisible(false); $this->word->setVisible(false); $this->excel->setVisible(false); } $this->preview->setText($html, true); Session::getSession()->printform = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>"; $filename = $type['meta_name']; //экспорт в xml формат $xml = $doc->export(Document::EX_XML_GNAU); if (is_array($xml) > 0) { Session::getSession()->xmlform = $xml['content']; $filename = $xml['filename']; } $reportpage = "ZippyERP/ERP/Pages/ShowDoc"; $this->print->pagename = $reportpage; $this->print->params = array('print', $filename); $this->html->pagename = $reportpage; $this->html->params = array('html', $filename); $this->word->pagename = $reportpage; $this->word->params = array('doc', $filename); $this->excel->pagename = $reportpage; $this->excel->params = array('xls', $filename); $this->xml->pagename = $reportpage; $this->xml->params = array('xml', $filename); $this->updateDocs(); $this->_entries = \ZippyERP\ERP\Entity\Entry::find('document_id=' . $this->_doc->document_id); $this->dw_entrylist->Reload(); $this->_statelist = $this->_doc->getLogList(); $this->dw_statelist->Reload(); $this->updateFiles(); $this->updateMessages(); $this->detuser->setText($this->_doc->userlogin); $this->detcreated->setText(date('Y-m-d H:i', $this->_doc->created)); $this->detupdated->setText(date('Y-m-d H:i', $this->_doc->updated)); $this->detnotes->setText($this->_doc->notes); }
public function getItems($start, $count, $sortfield = null, $asc = null) { return Entry::find($this->getWhere(), "document_date", "desc"); }