本文整理汇总了PHP中invoice::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP invoice::insert方法的具体用法?PHP invoice::insert怎么用?PHP invoice::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invoice
的用法示例。
在下文中一共展示了invoice::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recur
public function recur()
{
$invoice = invoice::select($this->id);
$ni = new invoice();
$ni->biller_id = $invoice['biller_id'];
$ni->customer_id = $invoice['customer_id'];
$ni->type_id = $invoice['type_id'];
$ni->preference_id = $invoice['preference_id'];
//$ni->date = $invoice['date_original'];
$ni->date = date('Y-m-d');
$ni->custom_field1 = $invoice['custom_field1'];
$ni->custom_field2 = $invoice['custom_field2'];
$ni->custom_field3 = $invoice['custom_field3'];
$ni->custom_field4 = $invoice['custom_field4'];
$ni->note = $invoice['note'];
$ni_id = $ni->insert();
//insert each line item
foreach ($invoice['invoice_items'] as $key => $value)
{
$nii = new invoice();
$nii->invoice_id=$ni_id;
$nii->quantity=$invoice['invoice_items'][$key]['quantity'];
$nii->product_id=$invoice['invoice_items'][$key]['product_id'];
$nii->unit_price=$invoice['invoice_items'][$key]['unit_price'];
$nii->tax_amount=$invoice['invoice_items'][$key]['tax_amount'];
$nii->gross_total=$invoice['invoice_items'][$key]['gross_total'];
$nii->description=$invoice['invoice_items'][$key]['description'];
$nii->total=$invoice['invoice_items'][$key]['total'];
$nii->tax=$invoice['invoice_items'][$key]['tax'];
$nii_id = $nii->insert_item();
}
return $ni_id;
}
示例2: recur
public function recur()
{
$invoice = $this->select($this->id, $this->domain_id);
$ni = new invoice();
$ni->domain_id = $invoice['domain_id'];
// Next Index is obtained during insert
// $ni->index_id = $invoice['index_id'];
$ni->biller_id = $invoice['biller_id'];
$ni->customer_id = $invoice['customer_id'];
$ni->type_id = $invoice['type_id'];
$ni->preference_id = $invoice['preference_id'];
//$ni->date = $invoice['date_original'];
// Use todays date
$ni->date = date('Y-m-d');
$ni->custom_field1 = $invoice['custom_field1'];
$ni->custom_field2 = $invoice['custom_field2'];
$ni->custom_field3 = $invoice['custom_field3'];
$ni->custom_field4 = $invoice['custom_field4'];
$ni->note = $invoice['note'];
$ni_id = $ni->insert();
//insert each line item
$nii = new invoice();
$nii->invoice_id = $ni_id;
$nii->domain_id = $ni->domain_id;
foreach ($invoice['invoice_items'] as $k => $v) {
$nii->quantity = $v['quantity'];
$nii->product_id = $v['product_id'];
$nii->unit_price = $v['unit_price'];
$nii->tax_amount = $v['tax_amount'];
$nii->gross_total = $v['gross_total'];
$nii->description = $v['description'];
$nii->total = $v['total'];
$nii->attribute = $v['attribute'];
$nii->tax = $v['tax'];
$nii_id = $nii->insert_item();
}
return $ni_id;
}