/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // $company = Company::find($id); $branches = Branch::where("company_id", "=", $company->id)->get(); $stacks = Invoicingstack::where("company_id", "=", $company->id)->where("status", "=", 0)->get(); $stack2s = Invoicingstack::where("company_id", "=", $company->id)->get(); $invoice = Bill::where("company_id", "=", $company->id)->get(); $invoiceGroup = Bill::where("company_id", "=", $company->id)->groupBy("invoice_date")->get(); return View("company.companydetail", ['invGp' => $invoiceGroup, 'stacks' => $stacks, 'stack2s' => $stack2s, 'invoices' => $invoice, 'company' => $company, 'branches' => $branches, 'title' => 'Company Detail']); }
public function __construct(Branch $branch, State $state, District $district) { $this->branch = $branch->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->district = $district->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->state = $state->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); }
public function getTestDrive($id, $table) { $branches = Branch::all(); $currentGuest = Que::where('table_id', $table)->orderBy('the_time')->limit(1)->first(); if (isset($currentGuest->guest_id)) { $items = Guest::find($currentGuest->guest_id); } else { $items = null; } Storage::disk('local')->put($table . '.json', json_encode($items)); $testDriveBranches = Branch::where('position_id', 3)->get(); return view('testDrive.index')->with(['branches' => $branches, 'file' => $table . '.json', 'table' => $table, 'branche' => $id, 'testDriveBranches' => $testDriveBranches]); }
public function supprimer() { if (\Request::ajax()) { $numbers = substr(\Input::get('boxes'), 0, -1); $ids = explode(',', $numbers); $ids = array_unique($ids); foreach ($ids as $id) { $b = Branch::where('user_id', \Auth::user()->id)->where('id', $id)->first(); $b->delete(); } } }
public function __construct(IssueVoucher $issuevoucher, Branch $branch, Validator $validator) { $this->issuevoucher = $issuevoucher->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->branch = $branch->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->validator = $validator; }
Actions <i class="fa fa-angle-down "></i> </a> <ul class="dropdown-menu menu_actions"> <li><a id="delete-ts" href="#"><i class="fa fa-trash-o"></i>Supprimer</a></li> <!--<li><a href="#"><i class="fa fa-archive"></i>Archiver</a></li>--> </ul> </div> <div class="btn-group hidden-phone"> <a data-toggle="dropdown" href="#" class="btn mini blue"> Trier par branche <i class="fa fa-angle-down "></i> </a> <ul class="br-action dropdown-menu menu_actions"> <?php $branches = \App\Branch::where('user_id', \Auth::user()->id)->get(); ?> @foreach($branches as $b) <li><a href="#">{{ $b->nom_branche }}</a></li> @endforeach </ul> </div> </div> <ul class="unstyled inbox-pagination liste_arrow"> <li>
public function getBranches() { $branches = Branch::where('status', '=', 'Activate')->get(); return $branches; }
public function trierparbranche() { if (\Request::ajax()) { $branch_id = \Input::get('branch_id'); $branches = Branch::where('user_id', \Auth::user()->id)->where('id', $branch_id)->first(); foreach ($branches->classrooms as $branch) { if ($branch->niveau) { $niveau = \Auth::user()->leslevels()->where('id', $branch->niveau)->first()->niveau; } else { $niveau = '--'; } if ($branch->branche) { $branche = \Auth::user()->branches()->where('id', $branch->branche)->first()->nom_branche; } else { $branche = '--'; } echo '<tr> <td class="no-print"><div class="minimal single-row"> <div class="checkbox_liste "> <input type="checkbox" value="' . $branch->id . ' " name="select[]"> </div> </div></td> <td> ' . $branch->nom_classe . ' </td> <td> ' . $branch->code_classe . '</td> <td> ' . $branch->capacite_classe . ' élèves</td> <td>' . $branch->children()->CurrentYear()->count() . '</td> <td> ' . $niveau . '</td> <td>' . $branche . '</td> <td class="no-print"> <a href="' . action('ClassroomsController@delete', [$branch]) . '" class="actions_icons delete-classe"> <i class="fa fa-trash-o liste_icons"></i></a> <!--<a href="#"><i class="fa fa-archive liste_icons"></i> </a>--> </td> <td class="no-print"><a href="' . action('ClassroomsController@indexelc', [$branch]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } }
public function __construct(Godown $godown, Branch $branch, Party $party) { $this->branch = $branch->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->party = $party->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->godown = $godown->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); }
public function generateInvoice(Request $request, $id = "") { $input = $request->all(); $company = !empty($id) ? Company::find($id) : Company::find($input['company_id']); $ArrMain = []; // print_r($input); if (count($input) > 0) { //allow room for invoice to be processed for recent uploaded and date range $stacks = Invoicingstack::where("company_id", "=", $company->id)->where("status", "=", 0)->get(); // var_dump("ok ok"); } else { $stacks = Invoicingstack::where("company_id", "=", $company->id)->where("status", "=", 0)->get(); } //$input['id']=$id; $total = 0; $bill = new Bill(); $invoiceno = ""; if (count($stacks) > 0) { $bill_no = $bill->genInvoiceNo($company->id) > 0 ? $bill->genInvoiceNo($company->id) : "01"; $invoiceno = !empty($input['inv_no']) && $input['inv_no'] != "" ? "RJLEX/" . strtoupper(substr($company->name, 0, 3)) . "/" . $input['inv_no'] : "RJLEX/" . strtoupper(substr($company->name, 0, 3)) . "/" . str_pad($bill_no, 3, "0", STR_PAD_LEFT); $bill->invoice_no = $invoiceno; $bill->created_at = date("Y-m-d H:i:s"); $bill->updated_at = date("Y-m-d H:i:s"); $bill->company_id = $company->id; $bill->invoice_date = date("Y-m-d H:i:s"); $check = Bill::where("invoice_no", "=", $invoiceno)->pluck("invoice_no"); if (!empty($check)) { echo "Invoice number already existing in database"; exit; } $bill->save(); //$invoiceno = "RJLEX/".strtoupper(substr($company->name,0,3))."/".$bill->genInvoiceNo(); } $dateFrom = "2000-01-01"; $dateTo = "2000-01-01"; $objPHPExcel = new \PHPExcel(); $m = 0; $s = 0; foreach ($stacks as $stack) { // Create a new worksheet called “My Data” $s++; $sheetName = "RJLEX_" . strtoupper(substr($company->name, 0, 3)) . "_" . $bill_no; $siteName = Branch::where("id", "=", $stack->site_id)->pluck("name"); $myWorkSheet = new \PHPExcel_Worksheet($objPHPExcel, $siteName); $objPHPExcel->addSheet($myWorkSheet, $m); /**/ $objPHPExcel->setActiveSheetIndex($m); $m++; $site = ""; $siteName = ""; $description = ""; $printNo = 0; $copyNo = 0; /** * For each loop of the invoicing table, * compute the cost of each print job and populate/create * the invoice detail table */ $a3Arr = []; $a4Arr = []; $sumNoPagesA3Color = 0; //+= $minvoice->number_of_pages; $sumAmountA3Color = 0; //$amount; $sumNoPagesA4Color = 0; // $minvoice->number_of_pages; $sumAmountA4Color = 0; //$amount; $sumNoPagesA3Mono = 0; // $minvoice->number_of_pages; $sumAmountA3Mono = 0; $sumNoPagesA4Mono = 0; //0 $minvoice->number_of_pages; $sumAmountA4Mono = 0; //$amount; $sumTotal = 0; $unitCostA3Mono = 0; $unitCostA4Mono = 0; $unitCostA3Color = 0; $unitCostA4Color = 0; $x = 1; $p = 1; if (count($input) > 0) { $invoicing = DB::table("invoicing")->where("stack_id", "=", $stack->id)->get(); //->where("final_date",">=",$input['date_from'])->where("final_date","<=","date_to") } else { $invoicing = DB::table("invoicing")->where("stack_id", "=", $stack->id)->get(); } //$dateFrom = DB::table("invoicing")->where("stack_id","=",$stack->id)->max('final_date'); //DB::table("invoicing")->where() //$dateTo = DB::table("invoicing")->where("stack_id","=",$stack->id)->min('final_date'); foreach ($invoicing as $minvoice) { //One Location in loop $froDate = new \DateTime("2000-01-01"); $toDate = new \DateTime("2000-01-01"); if ($x == 1) { //$dateFrom = new \DateTime($minvoice->final_date); //$dateTo = new \DateTime($minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('A' . $x, "SITE"); $objPHPExcel->getActiveSheet()->setCellValue('B' . $x, "User ID"); $objPHPExcel->getActiveSheet()->setCellValue('C' . $x, "Submit IP"); $objPHPExcel->getActiveSheet()->setCellValue('D' . $x, "Print Job Name"); $objPHPExcel->getActiveSheet()->setCellValue('E' . $x, "Submit Date"); $objPHPExcel->getActiveSheet()->setCellValue('F' . $x, "Final Date"); $objPHPExcel->getActiveSheet()->setCellValue('G' . $x, "Final Action"); $objPHPExcel->getActiveSheet()->setCellValue('H' . $x, "Final Site"); $objPHPExcel->getActiveSheet()->setCellValue('I' . $x, "Number of Pages"); $objPHPExcel->getActiveSheet()->setCellValue('J' . $x, "Cost Per Page"); $objPHPExcel->getActiveSheet()->setCellValue('K' . $x, "Total Cost"); $objPHPExcel->getActiveSheet()->setCellValue('L' . $x, "Release IP"); $objPHPExcel->getActiveSheet()->setCellValue('M' . $x, "Release User"); $objPHPExcel->getActiveSheet()->setCellValue('N' . $x, "Release Method"); $objPHPExcel->getActiveSheet()->setCellValue('O' . $x, "Print Job Color"); $objPHPExcel->getActiveSheet()->setCellValue('P' . $x, "Print Job Duplex"); $objPHPExcel->getActiveSheet()->setCellValue('Q' . $x, "Print Job Paper Size"); $objPHPExcel->getActiveSheet()->setCellValue('R' . $x, "Release Model"); $objPHPExcel->getActiveSheet()->setCellValue('S' . $x, "Release Model Type"); $objPHPExcel->getActiveSheet()->setCellValue('T' . $x, "Rrelease Host Name"); } //$date = date_create_from_format("Y-m-d H:i:s",$minvoice->final_date); if (isset($input['date_from'])) { $dateFrom = $input['date_from']; } else { /*$froDate = $dateFrom; if( (int)$date->getTimestamp() <= (int)$froDate->getTimestamp() ){ $dateFrom = new \DateTime($minvoice->final_date); }*/ } if (isset($input['date_to'])) { $dateTo = $input['date_to']; } else { /*$toDate = $dateTo; if( (int)$date->getTimestamp() >= (int)$toDate->getTimestamp() ){ $dateTo = new \DateTime($minvoice->final_date); }*/ } $site = Branch::where("id", "=", $minvoice->site)->pluck("name"); $a3Arr[] = ""; $a4Arr[] = ""; // if($minvoice->job_paper_size == "A3"){} $paperid = DB::table("papers")->where("name", $minvoice->job_paper_size)->pluck("id"); if (strtolower($minvoice->final_action) == "p" || strtolower($minvoice->final_action) == "c") { //check if action type is print /** * check if colored or mono */ $p++; if (strtolower($minvoice->device_type) == "c") { if (strtolower($minvoice->job_color) == "y") { if ($minvoice->job_paper_size == "A3" || ($minvoice->job_paper_size == "Tabloid" || $minvoice->job_paper_size == "Ledger")) { if (strtolower($minvoice->device_name) == 'lexmark x925' || strtolower($minvoice->device_name) == 'lexmark x950' || strtolower($minvoice->device_name) == 'lexmark x950de' || strtolower($minvoice->device_name) == 'lexmark x792de' || strtolower($minvoice->device_name) == 'lexmark cx510de') { $cost = Price::where("job_id", 1)->where("job_type", "color")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA3Color += $minvoice->number_of_pages; $sumAmountA3Color += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA3Color = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "Y"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } elseif (strtolower($minvoice->device_name) == 'lexmark x860') { # else if Lexmark X860 (a mono A3 printer) //|| strtolower($minvoice->device_name) == 'lexmark x860de' $cost = Price::where("job_id", 1)->where("job_type", "mono")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA3Mono += $minvoice->number_of_pages; $sumAmountA3Mono += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA3Mono = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "N"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } else { # otherwise its an A4 job for color not A3 as may be indicated in datafile but A4 $cost = Price::where("job_id", 1)->where("job_type", "color")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA4Color += $minvoice->number_of_pages; $sumAmountA4Color += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA4Color = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "Y"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } } else { $cost = Price::where("job_id", 1)->where("job_type", "color")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA4Color += $minvoice->number_of_pages; $sumAmountA4Color += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA4Color = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "Y"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } } elseif (strtolower($minvoice->job_color) == "n") { if ($minvoice->job_paper_size == "A3" || ($minvoice->job_paper_size == "Tabloid" || $minvoice->job_paper_size == "Ledger")) { //&& if (strtolower($minvoice->device_name) == 'lexmark mx860') { //de $cost = Price::where("job_id", 1)->where("job_type", "mono")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA3Mono += $minvoice->number_of_pages; $sumAmountA3Mono += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA3Mono = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "N"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } elseif (strtolower($minvoice->device_name) == 'lexmark x925' || strtolower($minvoice->device_name) == 'lexmark x950' || strtolower($minvoice->device_name) == 'lexmark x950de' || strtolower($minvoice->device_name) == 'lexmark x792de' || strtolower($minvoice->device_name) == 'lexmark cx510de') { $cost = Price::where("job_id", 1)->where("job_type", "mono")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA3Mono += $minvoice->number_of_pages; $sumAmountA3Mono += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA3Mono = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "N"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } else { # otherwise its an A4 job for mono not A3 as may be indicated in datafile /** Print is a mono device*/ $cost = Price::where("job_id", 1)->where("job_type", "mono")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA4Mono += $minvoice->number_of_pages; $sumAmountA4Mono += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA4Mono = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "N"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } } else { $cost = Price::where("job_id", 1)->where("job_type", "mono")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA4Mono += $minvoice->number_of_pages; $sumAmountA4Mono += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA4Mono = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "N"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } } } elseif (strtolower($minvoice->device_type) == "m") { if ($minvoice->job_paper_size == "A3" || ($minvoice->job_paper_size == "Tabloid" || $minvoice->job_paper_size == "Ledger")) { #if device type is a mono and paper is A3 if (strtolower($minvoice->device_name) == 'lexmark mx860') { #de we need to be sure its an lexmark mx860de device $cost = Price::where("job_id", 1)->where("job_type", "mono")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA3Mono += $minvoice->number_of_pages; $sumAmountA3Mono += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA3Mono = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "N"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } elseif (strtolower($minvoice->device_name) == 'lexmark x654de' || strtolower($minvoice->device_name) == 'lexmark x654' || (strtolower($minvoice->device_name) == 'lexmark t656' || strtolower($minvoice->device_name) == 'lexmark t656de')) { # otherwise its an A4 job for mono not A3 as may be indicated in script $paperid = DB::table("papers")->where("name", "A4")->pluck("id"); $cost = Price::where("job_id", 1)->where("job_type", "mono")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA4Mono += $minvoice->number_of_pages; $sumAmountA4Mono += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA4Mono = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "N"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, "A4"); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } } else { $cost = Price::where("job_id", 1)->where("job_type", "mono")->where("paper_id", $paperid)->pluck("price"); $amount = $cost * $minvoice->number_of_pages; $sumNoPagesA4Mono += $minvoice->number_of_pages; $sumAmountA4Mono += $amount; //not longer neccessory because cumulated pages could be multiplied by the unit cost $unitCostA4Mono = $cost; $objPHPExcel->getActiveSheet()->setCellValue('A' . $p, $site); $objPHPExcel->getActiveSheet()->setCellValue('B' . $p, $minvoice->user); $objPHPExcel->getActiveSheet()->setCellValue('C' . $p, $minvoice->ip); $objPHPExcel->getActiveSheet()->setCellValue('D' . $p, $minvoice->job_title); $objPHPExcel->getActiveSheet()->setCellValue('E' . $p, $minvoice->submit_date); $objPHPExcel->getActiveSheet()->setCellValue('F' . $p, $minvoice->final_date); $objPHPExcel->getActiveSheet()->setCellValue('G' . $p, $minvoice->final_action); $objPHPExcel->getActiveSheet()->setCellValue('H' . $p, $minvoice->final_site); $objPHPExcel->getActiveSheet()->setCellValue('I' . $p, $minvoice->number_of_pages); $objPHPExcel->getActiveSheet()->setCellValue('J' . $p, $cost); $objPHPExcel->getActiveSheet()->setCellValue('K' . $p, $amount); $objPHPExcel->getActiveSheet()->setCellValue('L' . $p, $minvoice->release_ip); $objPHPExcel->getActiveSheet()->setCellValue('M' . $p, $minvoice->release_user); $objPHPExcel->getActiveSheet()->setCellValue('N' . $p, $minvoice->release_method); $objPHPExcel->getActiveSheet()->setCellValue('O' . $p, "N"); // $objPHPExcel->getActiveSheet()->setCellValue('P' . $p, $minvoice->print_job_duplex); //duplex $objPHPExcel->getActiveSheet()->setCellValue('Q' . $p, $minvoice->job_paper_size); $objPHPExcel->getActiveSheet()->setCellValue('R' . $p, $minvoice->device_name); $objPHPExcel->getActiveSheet()->setCellValue('S' . $p, $minvoice->device_type); $objPHPExcel->getActiveSheet()->setCellValue('T' . $p, $minvoice->device_host); } } $printNo++; } $x++; } //End of invoicing loop $b = $p + 5; $sumAmountA3Color = $sumNoPagesA3Color * $unitCostA3Color; $sumAmountA3Mono = $sumNoPagesA3Mono * $unitCostA3Mono; $sumAmountA4Color = $sumNoPagesA4Color * $unitCostA4Color; $sumAmountA4Mono = $sumNoPagesA4Mono * $unitCostA4Mono; /** * Sum total of all net * amounts */ $sumTotal += $sumAmountA4Mono; $sumTotal += $sumAmountA3Mono; $sumTotal += $sumAmountA4Color; $sumTotal += $sumAmountA3Color; $a3Arr = ["a3mono" => ["nopages" => $sumNoPagesA3Mono, "unitcost" => $unitCostA3Mono, "netamount" => $sumAmountA3Mono], "a3color" => ["nopages" => $sumNoPagesA3Color, "unitcost" => $unitCostA3Color, "netamount" => $sumAmountA3Color]]; if ($sumNoPagesA3Mono > 0) { DB::table("invoice_detail")->insert(['invoice_id' => $bill->id, 'branch_id' => $minvoice->site, 'location' => $site, 'un_identity' => 'A3 Mono', 'description' => "Print / Copy Mono A3", 'no_of_pages' => $sumNoPagesA3Mono, 'cost_per_page' => $unitCostA3Mono, 'paper_size' => "A3", 'amount' => $sumAmountA3Mono, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]); } if ($sumNoPagesA3Color > 0) { DB::table("invoice_detail")->insert(['invoice_id' => $bill->id, 'branch_id' => $minvoice->site, 'location' => $site, 'un_identity' => 'A3 Color', 'description' => "Print / Copy Color A3", 'no_of_pages' => $sumNoPagesA3Color, 'cost_per_page' => $unitCostA3Color, 'paper_size' => "A3", 'amount' => $sumAmountA3Color, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]); } if ($sumNoPagesA4Mono > 0) { DB::table("invoice_detail")->insert(['invoice_id' => $bill->id, 'branch_id' => $minvoice->site, 'location' => $site, 'un_identity' => 'A4 Mono', 'description' => "Print / Copy Mono A4", 'no_of_pages' => $sumNoPagesA4Mono, 'cost_per_page' => $unitCostA4Mono, 'paper_size' => "A4", 'amount' => $sumAmountA4Mono, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]); } if ($sumNoPagesA4Color > 0) { DB::table("invoice_detail")->insert(['invoice_id' => $bill->id, 'branch_id' => $minvoice->site, 'location' => $site, 'un_identity' => 'A4 Color', 'description' => "Print / Copy Color A4", 'no_of_pages' => $sumNoPagesA4Color, 'cost_per_page' => $unitCostA4Color, 'paper_size' => "A4", 'amount' => $sumAmountA4Color, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]); } $a4Arr = ["a4mono" => ["nopages" => $sumNoPagesA4Mono, "unitcost" => $unitCostA4Mono, "netamount" => $sumAmountA4Mono], "a4color" => ["nopages" => $sumNoPagesA4Color, "unitcost" => $unitCostA4Color, "netamount" => $sumAmountA4Color]]; array_push($ArrMain, ["site" => $site, "a4" => $a4Arr, "a3" => $a3Arr, "sumTotal" => $sumTotal]); $total += $sumTotal; $stack->status = 1; $stack->update(); } // End of stack loop if (isset($input['date_from']) && isset($input['date_to'])) { $duration = date_format(date_create($input['date_from']), "d M. Y") . " - " . date_format(date_create($input['date_to']), "d M. Y"); } else { // $duration = date_format($dateFrom ,"d M. Y") ." - ". date_format($dateTo,"d M. Y"); } define('BUDGETS_DIR', public_path() . "/invoicexlxs/"); // I define this in a constants.php file $pdfPath = ""; if (!is_dir(BUDGETS_DIR)) { mkdir(BUDGETS_DIR, 0755, true); } $fileurl = "RJLEX_" . strtoupper(substr($company->name, 0, 3)) . "_" . date("Y-M-d") . "_" . time(); $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007"); $objWriter->save(BUDGETS_DIR . $fileurl . ".xlsx"); $outputName = $fileurl . ".pdf"; // str_random is a [Laravel helper](http://laravel.com/docs/helpers#strings) $pdfPath = BUDGETS_DIR . $outputName; $bill->pdf_url = $outputName; // File::put($pdfPath, PDF::loadView($pdf, 'A4', 'portrait')->output()); $bill->subtotal = $total; $bill->tax = 5 / 100 * $total; $bill->total = $total + $bill->tax; $bill->invoice_date = date("Y-m-d H:i:s"); $bill->duration = $duration; $bill->file_url = $fileurl . ".xlsx"; $bill->update(); $input["invoice"] = $bill; $invoiceItems = DB::table("invoice_detail")->where("invoice_id", $bill->id)->groupBy("location")->get(); $input["invoiceItems"] = $invoiceItems; //$pdf = new PDF($dompdf, $config, $app['files'], $app['view']); $pdf = App::make('dompdf.wrapper'); //$pdf->set_base_path(public_path()."/bootstrap");->download($outputName) $pdf->loadView('invoicing.invoicepdf', $input)->setPaper('a4')->setOrientation('landscape')->save($pdfPath); //return $pdf->download($outputName); return View("invoicing.invoice", ["companies" => Company::all(), 'invoice' => $bill, "total" => $total, "company" => $company, "branches" => Branch::where("company_id", $company->id)->get(), "invoiceDatum" => $ArrMain, "title" => "Invoice"]); }
foreach ($invoices as $invoice) { if ($inv->invoice_date == $invoice->invoice_date) { echo " <li>\n <i class='fa fa-file-text bg-blue'></i>\n <div class='timeline-item'>\n <span class='time'><i class='fa fa-clock-o'></i>" . date_format(date_create($invoice->created_at), "H:i ") . "</span>\n <h3 class='timeline-header'><a href='#'>Invoice</a> generated for " . $invoice->duration . "</h3>\n <div class='timeline-body'>"; echo " <div class='row'>\n <!-- accepted payments column -->\n <div class='col-xs-6'>\n <p><h3>Invoice ID: {$invoice->invoice_no}</h3></p>\n <p>Generated to {$company->name}</p>\n </div><!-- /.col -->\n <div class='col-xs-6'>\n <!-- <p class='lead'>Amount Due 2/22/2014</p>-->\n <div class='table-responsive'>\n <table class='table'>\n <tr>\n <th style='width:50%'>Subtotal:</th>\n <td>₦" . number_format($invoice->subtotal, 2, '.', ',') . "</td>\n </tr>\n <tr>\n <th style='width:50%'>5% VAT:</th>\n <td>₦" . number_format($invoice->tax, 2, '.', ',') . "</td>\n </tr>\n <tr>\n <th>Total:</th>\n <td>₦" . number_format($invoice->total, 2, '.', ',') . "</td>\n </tr>\n </table>\n </div>\n </div>"; echo "</div>\n <div class='timeline-footer'>"; ?> <a href='{{url()}}/invoicexlxs/{{$invoice->file_url}}' class='btn bg-green btn-xs'><i class='fa fa-download'></i> Download Report</a> <?php echo "<a href='" . url() . "/invoicing/print/" . $invoice->id . "' target='_blank' class='btn btn-primary btn-xs'> <i class='fa fa-file-o'></i> View Invoice</a>\n <a class='delLink btn btn-danger btn-xs btn-inv-del' dname='{$invoice->duration}' url='/invoicing/deleteinvoice/{$invoice->id}' data-target='#myDelete' data-toggle='modal'><i class='fa fa-trash'></i> Delete</a>\n </div>\n </div>\n </li>"; $invoiceStack = \App\Invoicingstack::where("company_id", "=", $invoice->company_id)->where("created_at", "=", $invoice->created_at)->get(); foreach ($invoiceStack as $stack) { if (date_format(date_create($inv->invoice_date), "M") == date_format(date_create($stack->created_at), "M")) { echo "<li>\n <i class='fa fa-upload bg-green'></i>\n <div class='timeline-item'>\n <span class='time'><i class='fa fa-clock-o'></i>" . date_format(date_create($stack->created_at), "H:i") . "</span>\n <h3 class='timeline-header'><a href='#'>File Uploaded For </a>"; echo \App\Branch::where("id", $stack->site_id)->pluck("name"); echo "</h3>\n <div class='timeline-body'>\n <a href=''><i class='fa fa-file-excel-o'></i> {$stack->file_url}</a>\n </div>\n </div>\n </li>"; } } } } } } ?> </ul> </div><!-- /.tab-pane --> <div class="tab-pane" id="settings"> <div class="box">
public function __construct(IssueLoadingSlip $issueloadingslip, Branch $branch, Validator $validator) { $this->issueloadingslip = $issueloadingslip->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->branch = $branch->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->validator = $validator; }