本文整理汇总了PHP中Purchase::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Purchase::getDate方法的具体用法?PHP Purchase::getDate怎么用?PHP Purchase::getDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Purchase
的用法示例。
在下文中一共展示了Purchase::getDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeCommission
public function executeCommission(sfWebRequest $request)
{
$requestparams = $request->getParameter("invoice");
$day = $requestparams["date"]["day"];
$month = $requestparams["date"]["month"];
$year = $requestparams["date"]["year"];
//if no date, date is today. else date is date given
if (!$year or !$month or !$day) {
$date = MyDateTime::today();
} else {
$date = new MyDateTime($year, $month, $day, 0, 0, 0);
}
$invoice = new Invoice();
$invoice->setDate($date->getstartofmonth()->tomysql());
$purchase = new Purchase();
$purchase->setDate($date->getendofmonth()->tomysql());
$this->date = $date;
$this->form = new InvoiceForm($invoice);
$this->toform = new PurchaseForm($purchase);
//set up an array of employees indexed by employee id
$this->rawemployees = Doctrine_Query::create()->from('Employee e')->where('e.commission > 0 ')->execute();
$this->employees = array();
foreach ($this->rawemployees as $employee) {
$this->employees[$employee->getId()] = $employee;
}
$this->empinvoices = array();
foreach ($this->employees as $employee) {
$this->empinvoices[$employee->getId()] = Doctrine_Query::create()->from('Invoice i, i.Employee e, i.Invoicedetail id, id.Product p')->where('i.salesman_id=' . $employee->getId())->andwhere('i.date >= "' . $invoice->getDate() . '"')->andwhere('i.date <= "' . $purchase->getDate() . '"')->orWhere('i.technician_id=' . $employee->getId())->andwhere('i.date >= "' . $invoice->getDate() . '"')->andwhere('i.date <= "' . $purchase->getDate() . '"')->orderBy('i.invno')->execute();
}
$commissiontotals = array();
foreach ($this->empinvoices as $empid => $employeedata) {
$totalcommission = 0;
foreach ($employeedata as $invoice) {
if ($invoice->getStatus() == "Paid") {
$totalcommission += $invoice->getCommissionTotal($this->employees[$empid]);
}
}
$commissiontotals[$empid] = $totalcommission;
}
$this->commissiontotals = $commissiontotals;
$this->grandtotalcommission = 0;
foreach ($commissiontotals as $total) {
$this->grandtotalcommission += $total;
}
}
示例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;
}