当前位置: 首页>>代码示例>>PHP>>正文


PHP Carbon::startOfMonth方法代码示例

本文整理汇总了PHP中Carbon\Carbon::startOfMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::startOfMonth方法的具体用法?PHP Carbon::startOfMonth怎么用?PHP Carbon::startOfMonth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Carbon\Carbon的用法示例。


在下文中一共展示了Carbon::startOfMonth方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: scopeInMonth

 /**
  * @param        $query
  * @param Carbon $date
  */
 public function scopeInMonth($query, Carbon $date)
 {
     $date->startOfMonth();
     $end = clone $date;
     $end->endOfMonth();
     $query->where('reports.time', '>=', $date->format('Y-m-d 00:00:00'));
     $query->where('reports.time', '<=', $end->format('Y-m-d 23:59:59'));
 }
开发者ID:JC5,项目名称:marauder,代码行数:12,代码来源:Report.php

示例2: Execute

 public function Execute()
 {
     $conn = \ZCL\DB\DB::getConnect();
     $store_id = $this->headerdata['store_id'];
     $item = \ZippyERP\ERP\Entity\Item::getSumItem();
     $stock = \ZippyERP\ERP\Entity\Stock::getStock($store_id, $item->item_id, 1, true);
     $discont = 0;
     //скидки  704  счет
     $date = new Carbon();
     $date->setTimestamp($this->document_date);
     $end = $date->endOfMonth()->getTimestamp();
     $begin = $date->startOfMonth()->getTimestamp();
     $sql = " select coalesce(abs(sum(amount)),0) from erp_account_subconto where amount < 0  and account_id=285 and  extcode  = {$store_id} and  document_date  <= " . $conn->DBDate($end);
     $tm = $conn->GetOne($sql);
     //торговая  наценка на  конец периода
     //остатки на  конец периода
     $sql = " select coalesce(sum(quantity),0) AS quantity,coalesce(price,0) as price  from erp_account_subconto sc join erp_store_stock  st on sc.stock_id = st.stock_id where    store_id = {$store_id} and date(document_date) <= " . $conn->DBDate($end);
     $row = $conn->GetRow($sql);
     $ost = $row['quantity'] / 1000;
     $ost = $ost * $row['price'];
     if ($ost == 0) {
         return;
     }
     //выручка
     $sql = " select coalesce(abs(sum(amount)),0) from erp_account_subconto where amount < 0  and account_id=702 and  extcode  = {$store_id} and date(document_date) <= " . $conn->DBDate($end) . " and date(document_date) >= " . $conn->DBDate($begin);
     $saled = $conn->GetOne($sql);
     //выручка сданная в кассу
     $k = ($tm - $discont) / ($ost - $discont);
     $sb = (1 - $k) * $saled;
     //себестоимость
     // списываем  наценку
     Entry::AddEntry("285", "282", $saled - $sb, $this->document_id, $this->document_date);
     // себестоимость реализации
     Entry::AddEntry("902", "282", $sb, $this->document_id, $this->document_date);
     $item = \ZippyERP\ERP\Entity\Item::getSumItem();
     $stockto = \ZippyERP\ERP\Entity\Stock::getStock($store_id, $item->item_id, 1, true);
     $sc = new SubConto($this, 282, 0 - $saled);
     $sc->setStock($stockto->stock_id);
     $sc->setQuantity(0 - $saled * 1000);
     //цена  единицы  товара - 1 копейка.
     $sc->save();
     // НДС
     $nds = H::nds(true);
     Entry::AddEntry("702", "641", $saled * $nds, $this->document_id, $this->document_date);
     return true;
 }
开发者ID:Niqpue,项目名称:zippyerp,代码行数:46,代码来源:trademargin.php

示例3: getDefaultJsOptions

 /**
  * Returns default javascript options
  *
  * Available options:
  * @see https://github.com/dangrossman/bootstrap-daterangepicker#options
  *
  * @return array
  */
 protected function getDefaultJsOptions()
 {
     $carbon = new Carbon();
     $prev_month = Carbon::now()->startOfMonth()->subWeek();
     $today = Carbon::now();
     $res = ['format' => 'YYYY-MM-DD', 'ranges' => ['previous_month' => ['Previous month (' . $prev_month->format('F') . ')', [$prev_month->startOfMonth()->format('Y-m-d'), $prev_month->endOfMonth()->format('Y-m-d')]], 'current_month' => ['Cur. month (' . date('F') . ')', [$carbon->startOfMonth()->format('Y-m-d'), $carbon->endOfMonth()->format('Y-m-d')]], 'last_week' => ['This Week', [$carbon->startOfWeek()->format('Y-m-d'), $carbon->endOfWeek()->format('Y-m-d')]], 'last_14' => ['Last 14 days', [Carbon::now()->subDays(13)->format('Y-m-d'), $today->format('Y-m-d')]]]];
     // will not set dates when '' passed but set default date when null passed
     if ($this->getStartValue()) {
         $res['startDate'] = $this->getStartValue();
     }
     if ($this->getEndValue()) {
         $res['endDate'] = $this->getEndValue();
     }
     return $res;
 }
开发者ID:aamirchaudhary,项目名称:Grids,代码行数:23,代码来源:DateRangePicker.php

示例4: getStartDateForPeriod

 /**
  * @param string $period
  *
  * @return Carbon
  */
 public function getStartDateForPeriod($period)
 {
     $start = new Carbon();
     switch ($period) {
         default:
         case 'month':
             $start->startOfDay();
             $start->subMonth();
             break;
         case 'year':
             $start->startOfMonth();
             $start->subYear();
             break;
     }
     return $start;
 }
开发者ID:JC5,项目名称:marauder,代码行数:21,代码来源:ChartHelper.php

示例5: getDefaultJsOptions

 /**
  * Returns default javascript options
  *
  * Available options:
  * @see https://github.com/dangrossman/bootstrap-daterangepicker#options
  *
  * @return array
  */
 protected function getDefaultJsOptions()
 {
     $carbon = new Carbon();
     $prev_month = Carbon::now()->startOfMonth()->subWeek();
     $today = Carbon::now();
     return ['format' => 'YYYY-MM-DD', 'ranges' => ['previous_month' => ['Previous month (' . $prev_month->format('F') . ')', [$prev_month->startOfMonth()->format('Y-m-d'), $prev_month->endOfMonth()->format('Y-m-d')]], 'current_month' => ['Cur. month (' . date('F') . ')', [$carbon->startOfMonth()->format('Y-m-d'), $carbon->endOfMonth()->format('Y-m-d')]], 'last_week' => ['This Week', [$carbon->startOfWeek()->format('Y-m-d'), $carbon->endOfWeek()->format('Y-m-d')]], 'last_14' => ['Last 14 days', [Carbon::now()->subDays(13)->format('Y-m-d'), $today->format('Y-m-d')]]], 'startDate' => $this->getStartValue(), 'endDate' => $this->getEndValue()];
 }
开发者ID:creativify,项目名称:Grids,代码行数:15,代码来源:DateRangePicker.php

示例6: scopeThismonth

 public function scopeThismonth($query)
 {
     $carbon = new Carbon();
     return $query->whereBetween(DB::raw('date(task_date)'), [$carbon->startOfMonth()->format('y-m-d'), $carbon->endOfMonth()->format('Y-m-d')])->get();
 }
开发者ID:ashraf2033,项目名称:maintainit,代码行数:5,代码来源:Task.php

示例7: each

echo $dtBerlin->toAtomString() . "\n";
echo $dtBerlin->toCookieString() . "\n";
echo $dtBerlin->toRssString() . "\n";
$dtBerlin->setToStringFormat('l jS \\of F Y');
echo $dtBerlin . "\n";
echo (int) $dtBerlin->isLeapYear() . "\n";
// is* range of functions test
printf("Is yesterday? %s\n", $dtBerlin->isYesterday() ? "yes" : "no");
printf("Is a Thursday? %s\n", $dtBerlin->isThursday() ? "yes" : "no");
printf("Is in the future? %s\n", $dtBerlin->isFuture() ? "yes" : "no");
printf("Is a leap year? %s\n", $dtBerlin->isLeapYear() ? "yes" : "no");
// first and last of the month
printf("First of the month %s\n", $dtBerlin->firstOfMonth());
printf("Last of the month %s\n", $dtBerlin->lastOfMonth());
// nthOf* function test
printf("Start of the month %s\n", $dtBerlin->startOfMonth());
printf("End of the month %s\n", $dtBerlin->endOfMonth());
printf("End of the decade %s\n", $dtBerlin->endOfDecade());
// Date manipulation
print $dtBerlin->addHours(5)->addDays(2)->addWeeks(1)->addMonths(3);
print $dtBerlin->subMonths(8)->subHours(7);
// Find UK Bank Holidays
$dtLondon = CitcoCarbon::today('Europe/London');
list($date, $name) = each($dtLondon->nextBankHoliday());
printf("The next bank holiday is %s on %s\n", $name, $date);
foreach ($dtLondon->getBankHolidays([2016, 2017]) as $date => $name) {
    printf("The next bank holiday is %s on %s\n", $name, $date);
}
// Find end of the current financial year
$fyCalculator = new Calculator(7, 1);
/* FY starts on July 1 */
开发者ID:settermjd,项目名称:carbon-experiments,代码行数:31,代码来源:index.php

示例8: each

echo $dtBerlin->toAtomString() . "\n";
echo $dtBerlin->toCookieString() . "\n";
echo $dtBerlin->toRssString() . "\n";
$dtBerlin->setToStringFormat('l jS \\of F Y');
echo $dtBerlin . "\n";
echo (int) $dtBerlin->isLeapYear() . "\n";
// is* range of functions test
echo "Is yesterday? " . ($dtBerlin->isYesterday() ? "yes" : "no") . PHP_EOL;
echo "Is a Thursday? " . ($dtBerlin->isThursday() ? "yes" : "no") . PHP_EOL;
echo "Is in the future? " . ($dtBerlin->isFuture() ? "yes" : "no") . PHP_EOL;
echo "Is a leap year? " . ($dtBerlin->isLeapYear() ? "yes" : "no") . PHP_EOL;
// first and last of the month
echo "First of the month " . $dtBerlin->firstOfMonth() . PHP_EOL;
echo "Last of the month " . $dtBerlin->lastOfMonth() . PHP_EOL;
// nthOf* function test
echo "Start of the month ", $dtBerlin->startOfMonth() . PHP_EOL;
echo "End of the month ", $dtBerlin->endOfMonth() . PHP_EOL;
echo "End of the decade ", $dtBerlin->endOfDecade() . PHP_EOL;
// Date manipulation
echo $dtBerlin->addHours(5)->addDays(2)->addWeeks(1)->addMonths(3) . PHP_EOL;
echo $dtBerlin->subMonths(8)->subHours(7) . PHP_EOL;
// Find UK Bank Holidays
$dtLondon = CitcoCarbon::today('Europe/London');
list($date, $name) = each($dtLondon->nextBankHoliday());
printf("The next bank holiday is %s on %s\n", $name, $date);
foreach ($dtLondon->getBankHolidays([2016, 2017]) as $date => $name) {
    printf("The next bank holiday is %s on %s\n", $name, $date);
}
// Find end of the current financial year
$fyCalculator = new Calculator(7, 1);
/* FY starts on July 1 */
开发者ID:omerida,项目名称:carbon-experiments,代码行数:31,代码来源:index.php

示例9: getDefaultJsOptions

 /**
  * Returns default javascript options
  *
  * Available options:
  * @see https://github.com/dangrossman/bootstrap-daterangepicker#options
  *
  * @return array
  */
 protected function getDefaultJsOptions()
 {
     $carbon = new Carbon();
     $prev_month = Carbon::now()->startOfMonth()->subWeek();
     $today = Carbon::today();
     $yesterday = Carbon::yesterday();
     $res = ['format' => 'YYYY-MM-DD', 'ranges' => ['Today' => [$today->format('Y-m-d'), $today->format('Y-m-d')], 'Previous Day' => [$yesterday->format('Y-m-d'), $yesterday->format('Y-m-d')], 'This Week' => [$carbon->startOfWeek()->format('Y-m-d'), $carbon->endOfWeek()->format('Y-m-d')], 'This Month (' . date('F') . ')' => [$carbon->startOfMonth()->format('Y-m-d'), $carbon->endOfMonth()->format('Y-m-d')], 'Previous Month (' . $prev_month->format('F') . ')' => [$prev_month->startOfMonth()->format('Y-m-d'), $prev_month->endOfMonth()->format('Y-m-d')]]];
     $res['opens'] = 'left';
     // will not set dates when '' passed but set default date when null passed
     if ($this->getStartValue()) {
         $res['startDate'] = $this->getStartValue();
     }
     if ($this->getEndValue()) {
         $res['endDate'] = $this->getEndValue();
     }
     return $res;
 }
开发者ID:prolificrohit,项目名称:Grids,代码行数:25,代码来源:DateRangePicker.php


注:本文中的Carbon\Carbon::startOfMonth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。