本文整理匯總了PHP中Docs::findOne方法的典型用法代碼示例。如果您正苦於以下問題:PHP Docs::findOne方法的具體用法?PHP Docs::findOne怎麽用?PHP Docs::findOne使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Docs
的用法示例。
在下文中一共展示了Docs::findOne方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ini
private function ini()
{
if ($this->valuedate == null) {
$this->valuedate = Record::writeDate(time());
}
if (!$this->ini) {
$this->_precision = Yii::$app->params['precision'];
$item = Item::findByPk($this->item_id, $this->valuedate);
if (is_null($item)) {
$this->iVatRate = 0;
} else {
$this->iVatRate = $item->vat;
}
//for vat resons...
//if ($this->rate == 0) {
$this->rate = Currates::GetRate($this->currency_id, $this->valuedate);
//}
if ($this->doc_rate == 0) {
$doc = Docs::findOne($this->doc_id);
$this->doc_rate = Currates::GetRate($doc->currency_id, $this->valuedate);
}
$this->ini != $this->ini;
}
}
示例2: refnumDocsLink
public function refnumDocsLink()
{
$str = '';
$array = explode(",", $this->refnum1);
foreach ($array as $docid) {
$doc = Docs::findOne($docid);
if ($doc !== null) {
$str .= Html::a(Html::encode(Yii::t('app', $doc->docType->name) . " #" . $doc->docnum), yii\helpers\BaseUrl::base() . "/docs/view/{$docid}");
} else {
$str .= $docid;
}
$str .= ",";
//echo $docid;
}
return rtrim($str, ",");
}
示例3: saveRef
public function saveRef($id, $total)
{
$str = $this->refnum;
//save new values
$sum = 0;
$tmp = explode(",", rtrim($str, ","));
foreach ($tmp as $id) {
//lets do this
//if($id==$this->id){
// throw new \Exception(Yii::t('app','You cannot save doc as a refnum'));
//}
$doc = Docs::findOne((int) $id);
if ($doc !== null) {
$sum += $doc->total;
//adam: need to multi currency!
if ($sum <= $total) {
$doc->refstatus = Docs::STATUS_CLOSED;
} else {
$doc->refstatus = Docs::STATUS_OPEN;
}
$doc->refnum = $id;
$doc->save();
}
}
//$this->refnum=$str;
}