本文整理汇总了PHP中invoice::save方法的典型用法代码示例。如果您正苦于以下问题:PHP invoice::save方法的具体用法?PHP invoice::save怎么用?PHP invoice::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invoice
的用法示例。
在下文中一共展示了invoice::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addInvoice
/**
* Add Invoice
*/
public function addInvoice($customer_id)
{
// Validation Rules
$validator = Validator::make(['customer_id' => $customer_id], ['customer_id' => 'integer']);
// If Validation Fails
if ($validator->fails()) {
return redirect('/customers')->withErrors($validator->messages()->toArray());
}
// Start a new invoice model
$invoice = new invoice();
// Edit Properties
$invoice->customer_id = $customer_id;
$invoice_id = $invoice->save();
// Redirect to the invoice profile
return redirect('/invoice/' . $invoice_id);
}
示例2: foreach
foreach ($invoiceItemIDs as $iiID) {
$status = $_POST["invoiceItemStatus"][$iiID];
if ($status || $_POST["changeTransactionStatus"]) {
$_POST["changeTransactionStatus"] and $status = $_POST["changeTransactionStatus"];
if ($status) {
$ii = new invoiceItem();
$ii->set_id($iiID);
$ii->select();
$ii->create_transaction($_POST["invoiceItemAmountPaid"][$iiID], $invoice->get_value("tfID"), $status);
}
}
}
if (!$TPL["message"]) {
$invoice->change_status($direction);
}
$invoice->save();
$invoiceID = $invoice->get_id();
$TPL["message_good"][] = "Invoice saved.";
alloc_redirect($TPL["url_alloc_invoice"] . "invoiceID=" . $invoiceID . $extra);
}
} else {
if ($_POST["delete"] && $invoice->get_value("invoiceStatus") == "edit") {
if ($invoiceItemIDs) {
$db = new db_alloc();
$q = prepare("DELETE FROM transaction WHERE invoiceItemID in (%s)", $invoiceItemIDs);
$db->query($q);
$q = prepare("DELETE FROM invoiceItem WHERE invoiceItemID in (%s)", $invoiceItemIDs);
$db->query($q);
}
// should probablg delete/unlink the pdf docs
$invoice->delete();
示例3: prepare
function save_to_invoice($invoiceID = false)
{
if ($this->get_value("clientID")) {
$invoiceID and $extra = prepare(" AND invoiceID = %d", $invoiceID);
$client = $this->get_foreign_object("client");
$db = new db_alloc();
$q = prepare("SELECT * FROM invoice WHERE clientID = %d AND invoiceStatus = 'edit' " . $extra, $this->get_value("clientID"));
$db->query($q);
// Create invoice
if (!$db->next_record()) {
$invoice = new invoice();
$invoice->set_value("clientID", $this->get_value("clientID"));
$invoice->set_value("invoiceDateFrom", $this->get_min_date());
$invoice->set_value("invoiceDateTo", $this->get_max_date());
$invoice->set_value("invoiceNum", invoice::get_next_invoiceNum());
$invoice->set_value("invoiceName", $client->get_value("clientName"));
$invoice->set_value("invoiceStatus", "edit");
$invoice->save();
$invoiceID = $invoice->get_id();
// Use existing invoice
} else {
$invoiceID = $db->f("invoiceID");
}
// Add invoiceItem and add expense form transactions to invoiceItem
if ($_POST["split_invoice"]) {
invoiceEntity::save_invoice_expenseFormItems($invoiceID, $this->get_id());
} else {
invoiceEntity::save_invoice_expenseForm($invoiceID, $this->get_id());
}
}
}
示例4: max
function update_invoice_dates($invoiceID)
{
$db = new db_alloc();
$db->query(prepare("SELECT max(iiDate) AS maxDate, min(iiDate) AS minDate\n FROM invoiceItem\n WHERE invoiceID=%d", $invoiceID));
$db->next_record();
$invoice = new invoice();
$invoice->set_id($invoiceID);
$invoice->select();
$invoice->set_value("invoiceDateFrom", $db->f("minDate"));
$invoice->set_value("invoiceDateTo", $db->f("maxDate"));
return $invoice->save();
}
示例5: invoice
#echo "<br>Checking row: ".print_r($row,1);
$invoice = new invoice();
$invoice->set_id($row["templateInvoiceID"]);
$invoice->select();
$i = new invoice();
$i->set_value("invoiceRepeatID", $row["invoiceRepeatID"]);
$i->set_value("invoiceRepeatDate", $row["invoiceDate"]);
$i->set_value("invoiceNum", invoice::get_next_invoiceNum());
$i->set_value("clientID", $invoice->get_value("clientID"));
$i->set_value("projectID", $invoice->get_value("projectID"));
$i->set_value("invoiceName", $invoice->get_value("invoiceName"));
$i->set_value("invoiceStatus", "edit");
$i->set_value("invoiceDateTo", $row["invoiceDate"]);
$i->set_value("currencyTypeID", $invoice->get_value("currencyTypeID"));
$i->set_value("maxAmount", $invoice->get_value("maxAmount"));
$i->save();
#echo "<br>Created invoice: ".$i->get_id();
$q = prepare("SELECT * FROM invoiceItem WHERE invoiceID = %d", $invoice->get_id());
$id2 = $db->query($q);
while ($item = $db->row($id2)) {
$ii = new invoiceItem();
$ii->currency = $i->get_value("currencyTypeID");
$ii->set_value("invoiceID", $i->get_id());
$ii->set_value("iiMemo", $item["iiMemo"]);
$ii->set_value("iiUnitPrice", page::money($ii->currency, $item["iiUnitPrice"], "%mo"));
$ii->set_value("iiAmount", page::money($ii->currency, $item["iiAmount"], "%mo"));
$ii->set_value("iiQuantity", $item["iiQuantity"]);
$ii->save();
#echo "<br>Created invoice item: ".$ii->get_id();
}
if ($row["message"]) {