コード例 #1
0
 /**
  * リスト6.18:簡単なテストコード
  * リスト6.19:Filesystem クラスをモックしたテストコード
  * は書籍を参照ください
  *
  * リスト6.20:戻り値をシミュレート
  */
 public function testOutput()
 {
     // ファイル内に書き込まれる文字の長さをテスト
     $filesystemMock = \Mockery::mock('Illuminate\\Filesystem\\Filesystem');
     $content = 'report';
     $filesystemMock->shouldReceive('put')->with('report.txt', $content)->once()->andReturn(mb_strlen($content));
     $report = new \App\Report($filesystemMock);
     $this->assertSame(6, $report->output());
 }
コード例 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(App\Lista::class, 200)->create();
     $all_lists = App\Lista::all();
     $report_count = App\Report::all()->count();
     foreach ($all_lists as $list) {
         $list->report_id = rand(1, $report_count);
         $list->save();
     }
 }
コード例 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $all_reports = App\Report::all();
     $list_count = App\Lista::all()->count();
     //$lists_num = range(1, $list_count);
     foreach ($all_reports as $report) {
         for ($i = 1; $i <= rand(1, 5); $i++) {
             // $report->lists()->attach(array_pop($range));
             $lists_num = range(1, $list_count);
             $rand_key = array_rand($lists_num);
             $report->lists()->attach($lists_num[1]);
             unset($lists_num[$rand_key]);
         }
     }
 }
コード例 #4
0
                        </tr>
                        </thead>
                        <tbody>
                        <?php 
$grandTotalStockIn = 0;
$grandTotalStockOut = 0;
$grandTotalStockWastage = 0;
$grandTotalStockBf = 0;
$grandTotalStockInBf = 0;
$grandTotalBalance = 0;
?>

                        @foreach($results as $result )
                            <?php 
$stocks = new \App\Report();
$sub_category = new \App\SubCategory();
$sub_categoryName = \App\SubCategory::find($result->subCategory);
$bfIn = $stocks->getStockBf($product_type, $date1, $result->product_id);
$bfOut = $stocks->getStockBfOut($product_type, $date1, $result->product_id);
$stockIn = $stocks->getStockIn($product_type, $date1, $date2, $result->product_id);
$stockOut = $stocks->getStockOut($product_type, $date1, $date2, $result->product_id);
$wastage = $stocks->getStockWastage($product_type, $date1, $date2, $result->product_id);
$bf = $bfIn[0]->stockBf - $bfOut[0]->stockBfOut;
$totalIn = $bf + $stockIn[0]->stockIn;
$balance = $totalIn - $stockOut[0]->stockOut;
?>

                            <tr class="odd gradeX">

                                <td>{{$result->pName.'('.$result->category.')'.'('.$sub_categoryName->name.')'}}</td>
コード例 #5
0
                            <th>Total Sale</th>
                            <th>Total Payment </th>
                            <th>Due</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php 
$totalSale = 0;
$totalPayment = 0;
$totalDue = 0;
?>

                        @foreach($results as $result )
                            <?php 
$party = \App\Party::find($result->party);
$reports = new \App\Report();
$payment = $reports->getPaymentForSalesDueReport($date1, $date2, $result->party);
?>
                            <tr class="odd gradeX">
                                <td>{{$result->date}}</td>
                                <td>{{$party->name}}</td>
                                <td>{{$result->totalSale}}</td>
                                <td>
                                    @if($payment[0]->totalPayment)
                                        {{$payment[0]->totalPayment}}
                                    @else
                                         {{0}}
                                    @endif
                                </td>
                                <td>{{$result->totalSale - $payment[0]->totalPayment}}</td>
コード例 #6
0
                            <th>Total Sale</th>
                            <th>Total Payment </th>
                            <th>Due</th>

                        </tr>
                        </thead>
                        <tbody>
                        <?php 
$totalSale = 0;
$totalPayment = 0;
$totalDue = 0;
?>

                        @foreach($results as $result )
                            <?php 
$reports = new \App\Report();
$payment = $reports->getPaymentForPurchaseReport($date1, $date2, $result->invoice);
?>

                            <tr class="odd gradeX">
                                <td>{{$result->date}}</td>
                                <td>{{$result->invoice}}</td>
                                <td>{{$result->totalSale}}</td>
                                <td>
                                    @if($payment[0]->totalPayment)
                                        {{$payment[0]->totalPayment}}
                                    @else
                                         {{0}}
                                    @endif
                                </td>
                                <td>{{$result->totalSale - $payment[0]->totalPayment}}</td>
コード例 #7
0
                            <th>Total Sale</th>
                            <th>Total Payment </th>
                            <th>Due</th>

                        </tr>
                        </thead>
                        <tbody>
                        <?php 
$totalSale = 0;
$totalPayment = 0;
$totalDue = 0;
?>

                        @foreach($results as $result )
                            <?php 
$reports = new \App\Report();
$payment = $reports->getPaymentForSalesReport($date1, $date2, $result->invoice);
?>

                            <tr class="odd gradeX">
                                <td>{{$result->date}}</td>
                                <td>{{$result->invoice}}</td>
                                <td>{{$result->totalSale}}</td>
                                <td>
                                    @if($payment[0]->totalPayment)
                                        {{$payment[0]->totalPayment}}
                                    @else
                                         {{0}}
                                    @endif
                                </td>
                                <td>{{$result->totalSale - $payment[0]->totalPayment}}</td>
コード例 #8
0
ファイル: PostController.php プロジェクト: bbig979/shoppyst
 public function reportAPI($id)
 {
     $post = \App\Post::find($id);
     $report = new \App\Report();
     $report->reportee_id = $post->user_id;
     $report->reporter_id = \Auth::user()->id;
     $report->post_id = $id;
     $report->content = 'Report Post';
     $report->save();
 }
コード例 #9
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $tag_ids = [];
     $users = [];
     $nodes = [];
     static::nodeRecurse($nodes);
     for ($a = 1; $a <= 5; $a++) {
         $tag = new \App\Tag();
         $faker->seed($a + 10);
         $tag->name = $faker->word;
         $tag->save();
         $tag_ids[] = $tag->id;
     }
     $faker->unique(true);
     for ($b = 1; $b <= 20; $b++) {
         $user = new \App\User();
         $faker->seed($a);
         $user->name = $faker->unique()->userName;
         $user->email = $faker->unique()->email;
         $user->password = $faker->password;
         $user->save();
         $users[] = $user;
     }
     foreach ($users as $user) {
         $faker->seed($user->id);
         if ($faker->boolean(40)) {
             // Author
             $author = new \App\Author();
             $author->user()->associate($user);
             $author->name = $faker->name;
             $author->save();
             if ($faker->boolean(50)) {
                 $number_of_likes = $faker->numberBetween(1, count($users));
                 $faker->unique(true);
                 for ($c = 1; $c <= $number_of_likes; $c++) {
                     $like = new \App\Like();
                     $user_key = $faker->unique()->randomElement(array_keys($users));
                     $like->user()->associate($users[$user_key]);
                     $like->likeable()->associate($author);
                     $like->save();
                 }
             }
             if ($faker->boolean(20)) {
                 $number_of_reports = $faker->numberBetween(1, round(count($users) / 3));
                 $faker->unique(true);
                 for ($d = 1; $d <= $number_of_reports; $d++) {
                     $report = new \App\Report();
                     $user_key = $faker->unique()->randomElement(array_keys($users));
                     $report->user()->associate($users[$user_key]);
                     $report->save();
                     $report->authors()->attach($author);
                 }
             }
             if ($faker->boolean(75)) {
                 // At leat 1 article
                 $article_count = $faker->numberBetween(1, 15);
                 for ($e = 1; $e < $article_count; $e++) {
                     $article = new \App\Article();
                     $article->author()->associate($author);
                     $article->title = $faker->sentence($faker->numberBetween(3, 10));
                     $article->body = $faker->paragraphs($faker->numberBetween(2, 8), true);
                     $article->node()->associate($faker->randomElement($nodes));
                     $article->save();
                     $article->tags()->sync($faker->randomElements($tag_ids, $faker->numberBetween(0, min(3, count($tag_ids)))));
                     if ($faker->boolean(10)) {
                         $number_of_reports = $faker->numberBetween(1, round(count($users) / 3));
                         $faker->unique(true);
                         for ($f = 1; $f <= $number_of_reports; $f++) {
                             $report = new \App\Report();
                             $user_key = $faker->unique()->randomElement(array_keys($users));
                             $report->user()->associate($users[$user_key]);
                             $report->save();
                             $report->articles()->attach($article);
                         }
                     }
                     if ($faker->boolean(90)) {
                         $review = new \App\Review();
                         $user_key = $faker->randomElement(array_keys($users));
                         $review->user()->associate($users[$user_key]);
                         $review->reviewable()->associate($article);
                         $review->save();
                     }
                     if ($faker->boolean(69)) {
                         $number_of_likes = $faker->numberBetween(1, count($users));
                         $faker->unique(true);
                         for ($g = 1; $g <= $number_of_likes; $g++) {
                             $like = new \App\Like();
                             $user_key = $faker->unique()->randomElement(array_keys($users));
                             $like->user()->associate($users[$user_key]);
                             $like->likeable()->associate($article);
                             $like->save();
                         }
                     }
                 }
                 if ($faker->boolean(70)) {
                     // At leat 1 comment
                     $comment_count = $faker->numberBetween(1, 20);
                     for ($h = 1; $h < $comment_count; $h++) {
                         $comment = new \App\Comment();
                         $comment->article()->associate($article);
                         $comment->user()->associate($user);
                         $comment->body = $faker->paragraph(4, true);
                         $comment->save();
                         if ($faker->boolean(15)) {
                             $number_of_reports = $faker->numberBetween(1, round(count($users) / 3));
                             $faker->unique(true);
                             for ($i = 1; $i <= $number_of_reports; $i++) {
                                 $report = new \App\Report();
                                 $user_key = $faker->unique()->randomElement(array_keys($users));
                                 $report->user()->associate($users[$user_key]);
                                 $report->save();
                                 $report->comments()->attach($comment);
                             }
                         }
                         if ($faker->boolean(90)) {
                             $review = new \App\Review();
                             $user_key = $faker->randomElement(array_keys($users));
                             $review->user()->associate($users[$user_key]);
                             $review->reviewable()->associate($comment);
                             $review->save();
                         }
                         if ($faker->boolean(60)) {
                             $number_of_likes = $faker->numberBetween(1, count($users));
                             $faker->unique(true);
                             for ($j = 1; $j <= $number_of_likes; $j++) {
                                 $like = new \App\Like();
                                 $user_key = $faker->unique()->randomElement(array_keys($users));
                                 $like->user()->associate($users[$user_key]);
                                 $like->likeable()->associate($comment);
                                 $like->save();
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #10
0
                        <tr>
                            <th>#</th>
                            <th>Branch Name</th>
                            <th>Total StocktIn</th>
                            <th>Total StocktOut</th>
                            <th>Total StocktTransfer</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php 
$slNo = 1;
?>
                        @foreach($stocksBranch as $stockBranch)
                            <?php 
$branchs = \App\Branch::find($stockBranch->branch);
$reports = new \App\Report();
$stockIn = $reports->getStockInTotal($stockBranch->branch);
$stockOut = $reports->getStockOutTotal($stockBranch->branch);
$stockTransfer = $reports->getStockTransferTotal($stockBranch->branch);
?>
                            <tr>
                                <td>{{$slNo}}</td>
                                <td>{{$branchs->name}}</td>
                                <td>{{$stockIn[0]->totalStockIn}}</td>
                                <td>{{$stockOut[0]->totalStockOut}}</td>
                                <td>{{$stockTransfer[0]->totalStockTransfer}}</td>
                            </tr>
                            <?php 
$slNo++;
?>
                        @endforeach
コード例 #11
0
                            <th style="text-align: right;">Total Purchase</th>
                            <th style="text-align: right;">Total Payment </th>
                            <th style="text-align: right;">Due</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php 
$totalSale = 0;
$totalPayment = 0;
$totalDue = 0;
?>

                        @foreach($results as $result )
                            <?php 
$party = \App\Party::find($result->party);
$reports = new \App\Report();
$payment = $reports->getPaymentForPurchaseDueReport($date1, $date2, $result->party);
?>
                            <tr class="odd gradeX">
                                <td>{{$party->name}}</td>
                                <td style="text-align: right;">{{$result->totalSale}}</td>
                                <td style="text-align: right;">
                                    @if($payment[0]->totalPayment)
                                        {{$payment[0]->totalPayment}}
                                    @else
                                         {{0}}
                                    @endif
                                </td>
                                <td style="text-align: right;">{{$result->totalSale - $payment[0]->totalPayment}}</td>

コード例 #12
0
?>
                <?php 
$values = array();
$count = 0;
$count2 = 0;
?>
                        @foreach($results as $result )
                            <?php 
$reports = new \App\Report();
$results2 = $reports->getBalanceTransferForFromAccount($result->fromAccount);
$fromAccount = \App\NameOfAccount::find($result->fromAccount);
?>

                            @foreach($results2 as $result2 )
                                <?php 
$reports = new \App\Report();
$results3 = $reports->getBalanceTransferForToAccount($result->fromAccount, $result2->toAccount);
$remainingAmount = $result2->fromAmount - $results3[0]->toAmount;
$toAccount = \App\NameOfAccount::find($result2->toAccount);
?>
                                @if($remainingAmount > 0)
                                <?php 
for ($i = 0; $i < $count; $i++) {
    $from = $values[$i]["from"];
    $to = $values[$i]["to"];
    //var_dump($from." ".$to);
    if ($from == $fromAccount->name && $to == $toAccount->name) {
        $count2 = 1;
    }
}
?>
コード例 #13
0
ファイル: UserController.php プロジェクト: bbig979/shoppyst
 public function reportAPI($slug)
 {
     $reportee = \App\User::where('slug', $slug)->first();
     $report = new \App\Report();
     $report->reportee_id = $reportee->id;
     $report->reporter_id = \Auth::user()->id;
     $report->content = 'Report User';
     $report->save();
 }