本文整理汇总了PHP中Purchase::setDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Purchase::setDate方法的具体用法?PHP Purchase::setDate怎么用?PHP Purchase::setDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Purchase
的用法示例。
在下文中一共展示了Purchase::setDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeGeneratePurchase
public function executeGeneratePurchase(sfWebRequest $request)
{
$invoice = Doctrine_Query::create()->from('Invoice i')->where('i.id = ' . $request->getParameter('id'))->fetchOne();
//create purchase
$purchase = new Purchase();
$purchase->setDate(date("Y-m-d"));
$purchase->setPono(date('h:i:s a'));
$purchase->save();
//create purchase details
foreach ($invoice->getInvoicedetail() as $invdetail) {
$purchdetail = new PurchaseDetail();
$purchdetail->setPurchaseId($purchase->getId());
$purchdetail->setProductId($invdetail->getProductId());
$purchdetail->setDescription($invdetail->getProduct()->getName());
$purchdetail->setQty($invdetail->getQty());
$purchdetail->setPrice(0);
$purchdetail->setTotal(0);
$purchdetail->setUnittotal(0);
$purchdetail->save();
$purchdetail->updateStockentry();
}
$this->redirect("purchase/view?id=" . $purchase->getId());
}
示例2: executeDsrmulti
public function executeDsrmulti(sfWebRequest $request)
{
$requestparams = $request->getParameter("invoice");
$day = $requestparams["date"]["day"];
$month = $requestparams["date"]["month"];
$year = $requestparams["date"]["year"];
$invoice = new Invoice();
if (!$day or !$month or !$year) {
$invoice->setDate(MyDate::today());
} else {
$invoice->setDate($year . "-" . $month . "-" . $day);
}
$requestparams = $request->getParameter("purchase");
$day = $requestparams["date"]["day"];
$month = $requestparams["date"]["month"];
$year = $requestparams["date"]["year"];
$purchase = new Purchase();
if (!$day or !$month or !$year) {
$purchase->setDate(MyDate::today());
} else {
$purchase->setDate($year . "-" . $month . "-" . $day);
}
$this->form = new InvoiceForm($invoice);
$this->toform = new PurchaseForm($purchase);
$this->purchases = PurchaseTable::fetchByDateRange($invoice->getDate(), $purchase->getDate());
$this->events = EventTable::fetchByDatenParentclass($purchase->getDate(), "Purchase");
$this->cashsales = 0;
$this->chequesales = 0;
$this->creditsales = 0;
$this->cashother = 0;
$this->chequeother = 0;
$this->creditother = 0;
$this->cashtotal = 0;
$this->chequetotal = 0;
$this->credittotal = 0;
$this->deducttotal = 0;
foreach ($this->purchases as $purchase) {
if ($purchase->getStatus() != "Cancelled") {
$this->cashsales += $purchase->getCash();
$this->chequesales += $purchase->getCheque();
$this->creditsales += $purchase->getCredit();
$this->cashtotal += $purchase->getCash();
$this->chequetotal += $purchase->getCheque();
$this->credittotal += $purchase->getCredit();
//$this->deducttotal+=$purchase->getDsrdeduction();
}
}
foreach ($this->events as $event) {
$purchase = $event->getParent();
if ($purchase->getStatus() != "Cancelled") {
$this->cashother += $event->getDetail("cashamt");
$this->chequeother += $event->getDetail("chequeamt");
$this->creditother += $event->getDetail("creditamt");
$this->cashtotal += $event->getDetail("cashamt");
$this->chequetotal += $event->getDetail("chequeamt");
$this->credittotal += $event->getDetail("creditamt");
$this->deducttotal += $event->getDetail3();
}
}
$this->total = $this->cashtotal + $this->chequetotal + $this->credittotal;
}