public function display(Info $qdn, $view) { $this->qdn = $qdn->with('InvolvePerson')->first(); $this->view = $view; if (Gate::allows('mod-qdn', $this->qdn->slug)) { return $this->view(); } return $this->redirectHome(); }
public function init() { $siteinfo = Info::siteInfo(); $this->getView()->title = $siteinfo['title']; $this->getView()->params['keywords'] = explode(',', $siteinfo['keywords']); $this->getView()->params['description'] = $siteinfo['description']; }
public function edit() { if ($this->validate()) { return parent::updateSiteinfo(['title', 'keywords', 'description'], $this); } return false; }
private function status() { $closure = Info::withClosure($this->qdn->slug)->closure; if ($this->isApproverComplete($closure) && $this->qdn->status == 'Q.a. Verification') { throw new Exception("QDN signatories is not yet complete and the status is already Q.a. Verification" . __LINE__ . " of " . __FILE__); } return $this->isApproverComplete($closure); }
/** * @return static */ protected function byAnnual() { $annualQdn = collect(Info::fromYear($this->year()))->reduce(function ($carry, $index) { return $carry + [$index->month - 1 => round($index->count / 4)]; }, []); return collect([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])->map(function ($value, $index) use($annualQdn) { return collect($annualQdn)->get($index, 0); }, []); }
public function fire($qdn) { Activity::log("Approved {$qdn['info']->control_id} : {$qdn['info']->discrepancy_category} and commented - {$qdn['request']->ApproverMessage}"); Event::fire(new ApprovalNotificationEvent($qdn['info'], $qdn['request']->ApproverMessage)); //flash success alert message $closure = Info::withClosure($qdn['info']->slug)->closure; $msg = $closure->other_department && $closure->production && $closure->quality_assurance && $closure->process_engineering ? 'Successfully updated! Issued QDN is now subject for QA Verification!' : 'Successfully updated! Issued QDN still waiting for other approvers!'; Flash::success($msg); }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $view->with('charts', [['heading' => 'QDN METRICS <br> ', 'id' => 'modalQdnMetrics', 'title' => '', 'graph' => 'qdnMetricsGraph', 'table' => 'qdnMetricsTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ', 'id' => 'pod', 'title' => '', 'graph' => 'podGraph', 'table' => 'podTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( FAILURE MODE )', 'id' => 'failureModeModal', 'title' => 'Pareto of Discrepancy - FAILURE MODE ', 'graph' => 'failureModeGraph', 'table' => 'failureModeTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( ASSEMBLY )', 'id' => 'assemblyModal', 'title' => 'Pareto of Discrepancy - ASSEMBLY ', 'graph' => 'assemblyGraph', 'table' => 'assemblyTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( ENVIRONMENT )', 'id' => 'environmentModal', 'title' => 'Pareto of Discrepancy - ENVIRONMENT ', 'graph' => 'environmentGraph', 'table' => 'environmentTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( MACHINE )', 'id' => 'machineModal', 'title' => 'Pareto of Discrepancy - MACHINE ', 'graph' => 'machineGraph', 'table' => 'machineTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( MAN )', 'id' => 'manModal', 'title' => 'Pareto of Discrepancy - MAN ', 'graph' => 'manGraph', 'table' => 'manTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( MATERIAL )', 'id' => 'materialModal', 'title' => 'Pareto of Discrepancy - MATERIAL ', 'graph' => 'materialGraph', 'table' => 'materialTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( METHOD / PROCESS )', 'id' => 'processModal', 'title' => 'Pareto of Discrepancy - METHOD / PROCESS ', 'graph' => 'processGraph', 'table' => 'processTable']]); $dt = Carbon::now('Asia/Manila'); $today = Info::where(DB::raw('DATE_FORMAT(created_at, "%m-%d-%Y")'), "=", $dt->format('m-d-Y'))->count(); $month = Info::where(DB::raw('MONTH(created_at)'), "=", $dt->month)->where(DB::raw('YEAR(created_at)'), "=", $dt->year)->count(); $week = Info::where(DB::raw('WEEK(created_at)'), "=", $dt->weekOfYear)->count(); $year = Info::where(DB::raw('YEAR(created_at)'), "=", $dt->year)->count(); $view->with('counts', [[$today, 'today-col', 'Issued today :', 'today', 'text-today'], [$week, 'week-col', 'Issued this week :', 'week', 'text-week'], [$month, 'month-col', 'Issued this month :', 'month', 'text-month'], [$year, 'year-col', 'Issued this year :', 'year', 'text-year']]); $yearOption = Info::select(DB::raw('YEAR(created_at) as year'))->groupBy('year')->get()->toArray(); $view->with('months', ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']); $view->with('years', array_flatten($yearOption)); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Info::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'images', $this->images])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'fanpagefb', $this->fanpagefb])->andFilterWhere(['like', 'skype', $this->skype])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phonenumber', $this->phonenumber])->andFilterWhere(['like', 'andress', $this->andress])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'website', $this->website]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params = []) { $query = Info::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => self::ITEMS_PER_PAGE], 'sort' => ['attributes' => ['key' => ['asc' => ['message' => SORT_ASC], 'desc' => ['message' => SORT_DESC]], 'value' => ['asc' => ['value' => SORT_ASC], 'desc' => ['value' => SORT_DESC]], 'clientEmail' => ['asc' => [ClientUsers::tableName() . '.email' => SORT_ASC], 'desc' => [ClientUsers::tableName() . '.email' => SORT_DESC]]]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->joinWith(['client' => function (ActiveQuery $query) { $query->andFilterWhere(['like', ClientUsers::tableName() . '.email', $this->clientEmail]); }]); $query->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'value', $this->value]); return $dataProvider; }
public function actionIndex() { $code = \Yii::$app->request->get('code'); $do = \Yii::$app->request->get('do'); if ($do && in_array($do, ['add'])) { return $this->{$code}($do); } switch ($code) { case 'info': $model = new InfoForm(); if ($model->load(\Yii::$app->request->post()) && $model->edit()) { return $this->redirect('/user/site'); } break; default: break; } $info = Info::siteInfo(); $menu = $this->getMenuByCode($code ? $code : 'info'); return $this->render('/user/site', ['menu' => $menu, 'info' => $info]); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('infos')->delete(); $faker = \Faker\Factory::create(); foreach (range(1, 20) as $index) { $employee = Employee::all(); $originator = $employee->random(); $close_by = Employee::where('station', 'quality assurance')->first(); $issuedTo = $employee->random(); $major = 'major'; $year = Carbon::now('Asia/Manila')->format('y'); $info = Info::create(['control_id' => $year . "-" . sprintf("%'.04d", $index), 'customer' => $faker->randomElement(array_flatten(Option::all('customer')->toArray())), 'package_type' => $faker->firstNameFemale, 'device_name' => $faker->address, 'lot_id_number' => $faker->randomDigit, 'lot_quantity' => $faker->randomNumber(4), 'job_order_number' => $faker->randomElement(['0', '1', '2']), 'machine' => $faker->randomElement(['at01', 'at02', 'at03', 'at04', 'at05']), 'station' => $faker->randomElement(['pl1', 'pl2', 'pl3', 'pl4', 'pl5']), 'created_at' => $faker->dateTimeThisMonth, 'major' => $major, 'disposition' => $faker->randomElement(['use as is', 'ncmr#', 'rework', 'split lot', 'shutdown', 'shipback']), 'problem_description' => $faker->paragraph(2), 'failure_mode' => $faker->randomelement(['assembly', 'environment', 'machine', 'man', 'material', 'method / process']), 'discrepancy_category' => $faker->randomelement(['MISSING UNIT(S)', 'LOW YIELD', 'WRONG TRANSACTION', 'CANT CREATE', 'FOREIGN MATERIAL', 'WRONG MERGING', 'DATECODE DISCREPANCY', 'MARKING PROBLEM', 'MIXED DEVICE', 'BENT LEAD', 'LEAD CONTAMINATION', 'LEAD DISCOLORATION', 'LEAD COPLANARITY']), 'quantity' => $faker->randomNumber(4)]); CauseOfDefect::create(['info_id' => $info->id, 'cause_of_defect' => $faker->randomElement(['PRODUCTION', 'PROCESS', 'MAINTENANCE', 'FACILITIES', 'QUALITY ASSURANCE', 'OTHERS']), 'cause_of_defect_description' => $faker->paragraph(2), 'objective_evidence' => 'N/A']); ContainmentAction::create(['info_id' => $info->id, 'what' => $faker->paragraph(2), 'who' => $faker->name('male' | 'female'), 'objective_evidence' => 'N/A', 'created_at' => $info->created_at]); CorrectiveAction::create(['info_id' => $info->id, 'what' => $faker->paragraph(2), 'who' => $faker->name('male' | 'female'), 'objective_evidence' => 'N/A', 'created_at' => $info->created_at]); PreventiveAction::create(['info_id' => $info->id, 'what' => $faker->paragraph(2), 'who' => $faker->name('male' | 'female'), 'objective_evidence' => 'N/A', 'created_at' => $info->created_at]); QdnCycle::create(['info_id' => $info->id, 'cycle_time' => '24', 'production_cycle_time' => '24', 'process_engineering_cycle_time' => '24', 'quality_assurance_cycle_time' => '24', 'other_department_cycle_time' => '24', 'created_at' => $info->created_at]); InvolvePerson::create(['info_id' => $info->id, 'station' => $originator->station, 'originator_id' => $originator->user_id, 'originator_name' => $originator->name, 'receiver_id' => $issuedTo->user_id, 'receiver_name' => $issuedTo->name, 'created_at' => $info->created_at]); Closure::create(['info_id' => $info->id, 'containment_action_taken' => $faker->randomElement(['yes', 'no']), 'corrective_action_taken' => $faker->randomElement(['yes', 'no']), 'close_by' => $close_by->name, 'date_sign' => Carbon::parse($info->created_at)->addDay(), 'production' => $employee->where('department', 'production')->random()->name, 'process_engineering' => $employee->where('department', 'process_engineering')->random()->name, 'quality_assurance' => $employee->where('department', 'quality_assurance')->random()->name, 'other_department' => $employee->where('department', 'other_department')->random()->name, 'status' => 'Closed', 'created_at' => $info->created_at]); } }
public function today(Request $request) { $date = Combo::callcombo('currentdate'); //print_r($date); foreach ($date as $d) { $curdate = $d->curdate; } $fromdate = CommonController::date_format($curdate); $todate = CommonController::date_format($curdate); //$fromdate=date("Y-m-d"); // $todate=date("Y-m-d"); $var = array($fromdate, $todate); $spname = "rptfactorypurchase"; $value = Info::callinfo($var, $spname); //print_r($value); //echo '<br>'; $spname = "rptfactioyitems"; $value1 = Info::callinfo($var, $spname); //print_r($value1); //echo '<br>'; return view('fstockview', compact('value', 'value1', 'fromdate', 'todate')); }
public function index() { $now = new \DateTime('now'); $month = $now->format('m'); $c = Purchase::get(); $c1 = Physicalsale::get(); $var = array($month); $spname = "salesreport"; $c2 = Info::callinfo($var, $spname); $var1 = array($month - 1); $spname1 = "salesreportp"; $c3 = Info::callinfo($var1, $spname1); $spname2 = "todaysales"; $c4 = Combo::callcombo($spname2); $spname3 = "todaycash"; $c5 = Combo::callcombo($spname3); $spname4 = "todaybankcollection"; $c6 = Combo::callcombo($spname4); $spname5 = "todaycashcollection"; $c7 = Combo::callcombo($spname5); $spname6 = "todaycontracollection"; $c8 = Combo::callcombo($spname6); $spbkash = "todaybkashcollection"; $bkash = Combo::callcombo($spbkash); $spsap = "todaysapcollection"; $sap = Combo::callcombo($spsap); $spkcs = "todaykcscollection"; $kcs = Combo::callcombo($spkcs); $spmbank = "todaymbankcollection"; $mbank = Combo::callcombo($spmbank); // print_r($c4); $sales_info = Sale::orderBy('created_at', 'desc')->take(5)->get(); $purchase_info = Purchase::orderBy('created_at', 'desc')->take(5)->get(); $bankaccount_info = Bankaccount::orderBy('created_at', 'desc')->take(5)->get(); return view('home', compact('c', 'c1', 'c2', 'c3', 'sales_info', 'purchase_info', 'bankaccount_info', 'c4', 'c5', 'c6', 'c7', 'c8', 'bkash', 'sap', 'kcs', 'mbank')); }
protected function findModel($id) { if (($model = Info::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function pdf(Request $request, $pid) { $profile = Companyprofile::get(); foreach ($profile as $com) { $cid = $com->id; $cname = $com->name; $aaddress = $com->address; $tele = $com->telephone; $mobile = $com->mobile; $email = $com->email; $url = $com->url; $file = $com->file; } $var = array($pid); $spname = "viewpurchase"; $value = Info::callinfo($var, $spname); foreach ($value as $valu) { $pname = $valu->pname; $purchasedate = $valu->purchasedate; $sname = $valu->sname; $address = $valu->address; $challanno = $valu->challanno; $suppliersbillno = $valu->suppliersbillno; $suppliersbilldate = $valu->suppliersbilldate; $discount = $valu->discount; $others_exp = $valu->others_exp; $gross_total = $valu->gross_total; $status = $valu->status; } $pdate = date_create($purchasedate); $sdate = date_create($suppliersbilldate); $spname1 = "purchasedetailsview"; $value1 = Info::callinfo($var, $spname1); $sum = 0; foreach ($value1 as $valu) { $a = $valu->amount; $sum = $sum + $a; } PDF::AddPage(); $html1 = '<p></p> <div> <table> <tr> <td style="width:20%"> <img src="uploads/' . $file . '" alt="logo" height="150";> </td> <td style="width:85% font-size:30%"> <h2>' . $cname . '</h2> ' . $aaddress . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div>'; $hst = '<h2> <u>PURCHASE VOUCHER</u></h2>'; $hex = '<table border="0" style="width:100%"> <tr> <td>Supplier Name:' . $sname . '</td> <td></td> <td>Voucher No:' . $pname . '</td> </tr> <tr> <td>Bill No:' . $suppliersbillno . '</td> <td></td> <td>Challan No:' . $challanno . '</td> </tr> <tr> <td>Address:' . $address . '</td> <td></td> <td>Purchase Date:' . date_format($pdate, "d/m/Y") . '</td> </tr> </table> </div> <div> <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th>Item Name</th> <th>Quantity</th> <th>Measurement Unit</th> <th>Rate</th> <th>Amount</th> </tr>'; $html1 = $html1 . $hst . $hex; $html2 = ''; foreach ($value1 as $valu) { $html = '<tr><td style="background-color:#ffffff;">' . $valu->iname . '</td> <td style="background-color:#ffffff;">' . $valu->quantity . '</td> <td style="background-color:#ffffff;">' . $valu->mname . '</td> <td style="background-color:#ffffff;">' . $valu->rate . '</td> <td style="background-color:#ffffff;">' . $valu->amount . '</td></tr>'; $html2 = $html2 . $html; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">'; $html4 = ''; $html5 = 'Sub Total:</td><td style="background-color:#ffffff;">' . number_format($sum, 2, '.', '') . '</td></tr>'; $html6 = ' <tr><td colspan="4" align="right" style="background-color:#ffffff;">Discount:</td><td style="background-color:#ffffff;">' . number_format($discount, 2, '.', '') . '</td></tr>'; $html7 = ' <tr><td colspan="4" align="right" style="background-color:#ffffff;">Others Exp.:</td><td style="background-color:#ffffff;">' . number_format($others_exp, 2, '.', '') . '</td></tr>'; $html8 = ' <tr><td colspan="4" align="right" style="background-color:#ffffff;">Gross Total:</td><td style="background-color:#ffffff;">' . number_format($gross_total, 2, '.', '') . '</td></tr>'; $html9 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord(number_format($gross_total, 2, '.', '')) . ' Taka Only</h4></div> <div> <div class="col-md-12" style=" background-color: #ffffff;color:#000000;"> <h3> Received By Prepared By Approved By </h3> </div>'; $html = $html1 . $html2 . $html3 . $html4 . $html5 . $html6 . $html7 . $html8 . $html9; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('purchase.pdf'); }
public function fromtoday(Request $request) { $profile = Companyprofile::get(); foreach ($profile as $com) { $cid = $com->id; $cname = $com->name; $aaddress = $com->address; $tele = $com->telephone; $mobile = $com->mobile; $email = $com->email; $url = $com->url; $file = $com->file; } $fromdate = CommonController::date_format($request->input('fromdate')); $todate = CommonController::date_format($request->input('todate')); $var = array($fromdate, $todate); // $var = array($fromdate,$todate); $fdate = date_create($fromdate); $tdate = date_create($todate); PDF::AddPage(); $html1 = '<p></p> <div> <table> <tr> <td style="width:20%"> <img src="uploads/' . $file . '" alt="logo" height="150";> </td> <td style="width:85% font-size:30%"> <h2>' . $cname . '</h2> ' . $aaddress . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h2> <u>Balance Sheet</u></h2> <h4> ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="0" style="background-color:#FFFFFF; padding:20px;"> <tr><td> <table border="0" style="background-color:#FFFFFF; padding:20px;"> <tr> <th><b>Assets</b></th> <th style></th> </tr>'; $trialbalance = DB::table('coa')->join('coatype', 'coatype.id', '=', 'coa.coatypeid')->select('coa.id as id', 'coa.name as coaname', 'coa.coatypeid', 'coatype.name as coatypename', 'coa.increasetypeid as inid')->orderBy('coa.coatypeid', 'asc')->get(); $html2 = ''; $coatypeid_cur = -1; $total_debit = 0; foreach ($trialbalance as $t) { if ($t->inid == 1) { $var = array($t->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); foreach ($value as $valu) { //$debit='Debit'; $debit = $valu->cash; $credit = NULL; } $total_debit = $total_debit + $debit; } else { if ($t->inid == 3) { $var = array($t->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); $debit = NULL; $credit = NULL; $debitCredit = 'cebit Credit'; } } if ($t->inid == 1 || $t->inid == 3) { if ($debit == NULL && $credit == NULL) { $h = ''; } else { if ($coatypeid_cur != $t->coatypeid) { $debit_total_head = 0; // $credit_total_head = 0; foreach ($trialbalance as $tr) { if ($tr->coatypeid == $t->coatypeid) { if ($tr->inid == 1) { $var = array($tr->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); foreach ($value as $valu) { //$debit='Debit'; $debit_head = $valu->cash; $credit_head = NULL; } $debit_total_head = $debit_total_head + $debit_head; } else { if ($tr->inid == 3) { $var = array($tr->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); $debit_head = NULL; $credit_head = NULL; $debitCredit = 'cebit Credit'; } } } } // $var = array($t->coatypeid,$fromdate,$todate); // $spname="totalpettycash"; // $value=Info::callinfo($var,$spname); // foreach($value as $vs){ // $amount=$vs->cash; // } // if($t->inid==1){ $html2 = $html2 . '<tr><td style="background-color:#ffffff;"><b>' . $t->coatypename . '</b></td><td style="background-color:#ffffff;"><b>' . number_format($debit_total_head, 2, '.', '') . '</b></td></tr>'; // }else{ // $html2 = $html2.'<tr><td style="background-color:#ffffff;"> <b>'.$t->coatypename.'</b></td><td></td><td><b>'.$amount.'</b></td></tr>'; // } } $coatypeid_cur = $t->coatypeid; $h = '<tr><td style="background-color:#ffffff;">' . $t->coaname . '</td><td>' . $debit . '</td></tr>'; } $html2 = $html2 . $h; } } $html4 = '</table></td>'; $html = $html1 . $html2 . $html4; $html1 = $html . '<td> <table border="0" style="background-color:#FFFFFF; padding:20px;"> <tr> <th> <b>Liabilities</b></th> <th style></th> </tr>'; $trialbalance = DB::table('coa')->join('coatype', 'coatype.id', '=', 'coa.coatypeid')->select('coa.id as id', 'coa.name as coaname', 'coa.coatypeid', 'coatype.name as coatypename', 'coa.increasetypeid as inid')->orderBy('coa.coatypeid', 'asc')->get(); //print_r($trialbalance); /// die(); $html2 = ''; $coatypeid_cur = -1; $total_credit = 0; foreach ($trialbalance as $t) { if ($t->inid == 2) { $var = array($t->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); foreach ($value as $valu) { $debit = NULL; //$credit='Credit'; $credit = $valu->cash; } $total_credit = $total_credit + $credit; } else { if ($t->inid == 3) { $var = array($t->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); $debit = NULL; $credit = NULL; $debitCredit = 'cebit Credit'; } } if ($t->inid == 2 || $t->inid == 3) { if ($debit == NULL && $credit == NULL) { $h = ''; } else { if ($coatypeid_cur != $t->coatypeid) { // $debit_total_head = 0; $credit_total_head = 0; foreach ($trialbalance as $tr) { if ($tr->coatypeid == $t->coatypeid) { // if($tr->inid==1){ // $var = array($tr->id,$fromdate,$todate); // $spname="todaypettycash"; // $value=Info::callinfo($var,$spname); // foreach($value as $valu){ // //$debit='Debit'; // $debit_head=$valu->cash; // $credit_head=NULL; // } // $debit_total_head = $debit_total_head + $debit_head; // } if ($tr->inid == 2) { $var = array($tr->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); foreach ($value as $valu) { $debit_head = NULL; //$credit='Credit'; $credit_head = $valu->cash; } $credit_total_head = $credit_total_head + $credit_head; } else { if ($tr->inid == 3) { $var = array($tr->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); $debit_head = NULL; $credit_head = NULL; $debitCredit = 'cebit Credit'; } } } } // $var = array($t->coatypeid,$fromdate,$todate); // $spname="totalpettycash"; // $value=Info::callinfo($var,$spname); // foreach($value as $vs){ // $amount=$vs->cash; // } // if($t->inid==1){ $html2 = $html2 . '<tr><td style="background-color:#ffffff;"> <b>' . $t->coatypename . '</b></td><td style="background-color:#ffffff;"> <b>' . number_format($credit_total_head, 2, '.', '') . '</b></td></tr>'; // }else{ // $html2 = $html2.'<tr><td style="background-color:#ffffff;"> <b>'.$t->coatypename.'</b></td><td></td></tr>'; // } } $coatypeid_cur = $t->coatypeid; $h = '<tr><td style="background-color:#ffffff;"> ' . $t->coaname . '</td><td>' . $credit . '</td></tr>'; } $html2 = $html2 . $h; } } $html4 = '</table></td></tr>'; $html5 = '<tr> <td> <table>'; if ($total_debit < $total_credit) { $html5 = $html5 . ' <tr> <td style="background-color:#ffffff;"> <b>Diff. in Opening Balances</b></td> <td style="background-color:#ffffff;"> <b>' . number_format($total_credit - $total_debit, 2, '.', '') . '</b></td> </tr> <tr> <td style="background-color:#ffffff;"> <b>Total</b></td> <td style="background-color:#ffffff;"> <b>' . number_format($total_credit, 2, '.', '') . '</b></td> </tr>'; } else { $html5 = $html5 . ' <tr> <td></td> <td></td> </tr> <tr> <td style="background-color:#ffffff;"> <b>Total</b></td> <td style="background-color:#ffffff;"> <b>' . number_format($total_debit, 2, '.', '') . '</b></td> </tr>'; } $html5 = $html5 . '</table> </td> <td> <table>'; if ($total_debit > $total_credit) { $html5 = $html5 . ' <tr> <td style="background-color:#ffffff;"> <b>Diff. in Opening Balances</b></td> <td style="background-color:#ffffff;"> <b>' . number_format($total_debit - $total_credit, 2, '.', '') . '</b></td> </tr> <tr> <td style="background-color:#ffffff;"> <b>Total</b></td> <td style="background-color:#ffffff;"> <b>' . number_format($total_debit, 2, '.', '') . '</b></td> </tr>'; } else { $html5 = $html5 . ' <tr> <td></td> <td></td> </tr> <tr> <td style="background-color:#ffffff;"> <b>Total</b></td> <td style="background-color:#ffffff;"> <b>' . number_format($total_credit, 2, '.', '') . '</b></td> </tr>'; } $html5 = $html5 . '</table> </td> </tr> </table>'; $html = $html1 . $html2 . $html4 . $html5; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('balancesheet.pdf'); }
public function pdf(Request $request, $id) { $profile = Companyprofile::get(); foreach ($profile as $com) { $cid = $com->id; $cname = $com->name; $aaddress = $com->address; $tele = $com->telephone; $mobile = $com->mobile; $email = $com->email; $url = $com->url; $file = $com->file; } $var = array($id); $spname = "ledgerentry"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $description = $valu->description; $name = $valu->name; $code = $valu->code; $created_at = $valu->created_at; } $date = date_create($created_at); PDF::AddPage(); $html1 = ' <p></p> <div> <table> <tr> <td style="width:20%"> <img src="uploads/' . $file . '" alt="logo" height="150";> </td> <td style="width:85% font-size:30%"> <h2>' . $cname . '</h2> ' . $aaddress . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h2> <u>Ledger Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Accounts Name:' . $name . '</td> <td></td> <td>Manual V. No:7</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $created_at . '</td> </tr> <tr> <td>Description:' . $description . '</td> <td></td> <td></td> </tr> </table> </div> <div> </div> <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th style="width:10%;"> SL</th> <th style="width:35%;"> Head of Accounts</th> <th style="width:15%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $coa = DB::table('coa')->where('id', 1)->first(); $html2 = ' <tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;">' . $code . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> <td style="background-color:#ffffff;"></td> </tr> <tr> <td style="background-color:#ffffff;"> 2</td> <td style="background-color:#ffffff;"> ' . $coa->name . '</td> <td style="background-color:#ffffff;">' . $coa->code . '</td> <td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr> <tr> <td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"> Total:</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div> <div> </div> <div class="col-md-12" style=" background-color: #ffffff;color:#000000;"> <h3> Received By Prepared By Approved By </h3> </div>'; $html = $html1 . $html2 . $html3; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('ledgerentry.pdf'); }
/** * Provides json response for select2 plugin */ public function actionGetSelectionById() { self::selectionById(Info::className(), 'name'); }
public function qdnData(Request $request) { return view('home.qdnData')->with('tbl', Info::issuedFrom($request->setDate)); }
public function fromtoday(Request $request) { $profile = Companyprofile::get(); //print_r($profile); foreach ($profile as $com) { $id = $com->id; $coname = $com->name; $address = $com->address; $tele = $com->telephone; $mobile = $com->mobile; $email = $com->email; $url = $com->url; $file = $com->file; } $date = $request->input('submit'); $cid = $request->input('sid'); if ($date == 'today') { $date = Combo::callcombo('currentdate'); //print_r($date); foreach ($date as $d) { $curdate = $d->curdate; } $fromdate = CommonController::date_format($curdate); $todate = CommonController::date_format($curdate); $fromdate = date("Y-m-d"); $todate = date("Y-m-d"); $var = array($cid, $fromdate, $todate); //print_r($var); if ($cid == 0) { $spname = "suppliersledgerall"; } else { $spname = "suppliersledger"; } $value = Info::callinfo($var, $spname); //print_r($value); //die(); foreach ($value as $valu) { $ccode = $valu->scode; $cname = $valu->sname; } //print_r($value);die(); $fdate = date_create($fromdate); $tdate = date_create($todate); if ($value != NULL) { $date = date('Y-m-d', strtotime($fromdate . " - 1 day")); $v = array($cid, $date); $s = "customerbalance"; $cvalue = Info::callinfo($v, $s); //print_r($cvalue); if ($cvalue != NULL) { //print_r($cvalue); } if ($cid == 0) { $openbalance = DB::table('suppliers')->sum('openbalance'); $cname = 'All Suppliers A/C'; // echo $openbalance; } else { $suppliers = DB::table('suppliers')->where('id', $cid)->first(); $openbalance = $suppliers->openbalance; } PDF::AddPage('A4'); $html1 = ' <p></p> <div> <table> <tr> <td style="width:20%"> <img src="uploads/' . $file . '" alt="logo" height="150";> </td> <td style="width:85% font-size:30%"> <h2>' . $coname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h2> SUPPLIER A/C</h2> <h4> Ledger Account</h4> <h4> ' . date_format($fdate, "d-M-Y") . ' ' . date_format($tdate, "d-M-Y") . '</h4> </div> <div> <table border="1" style="width:100%; padding:20px;"> <tr> <td style="width:20%">Accounts Code:</td> <td style="width:80%">' . $ccode . '</td> </tr> <tr> <td style="width:20%">Accounts of:</td> <td style="width:80%">' . $cname . '</td> </tr> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher Type</th> <th > Voucher No.</th> <th> Debit</th> <th> Credit</th> <th> Balance</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;" colspan="3">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . $openbalance . '</th> <th></th> </tr>'; $html2 = ''; $i = 1; $sum = 0; $credit = 0; $debit = 0; $ob = $openbalance; $ctotal = 0; $dtotal = 0; foreach ($value as $valu) { if ($valu->vstatus == 1 or $valu->pustatus == 1) { if ($valu->vid != NULL) { if ($valu->vtype == 1) { $acc = 'By BANK A/C'; } else { if ($valu->vtype == 2) { $acc = 'By CASH A/C'; } } } else { if ($valu->sid != NULL) { $acc = 'To PURCHASE A/C'; } } $html = '<tr> <td style="background-color:#ffffff;"> ' . $valu->created_at . '</td> <td style="background-color:#ffffff;">' . $acc . '</td> '; if ($valu->pavoucher != NULL) { $h6 = '<td style="background-color:#ffffff;">Payment</td>'; } else { $h6 = '<td style="background-color:#ffffff;">Purchase</td>'; } if ($valu->pavoucher != NULL) { $h5 = '<td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->vid . '/' . $valu->vtype . '" target="_blank">' . $valu->pavoucher . '</a></td>'; } else { $h5 = '<td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/purchase/pdf/' . $valu->puid . '" target="_blank">' . $valu->puvoucher . '</a></td>'; } if ($valu->puvoucher != NULL) { $credit = $valu->amount; //$dtotal=$dtotal+$debit; $ctotal = $ctotal + $credit; $debit = 0.0; $h1 = '<td style="background-color:#ffffff;"> </td> <td style="background-color:#ffffff;"> ' . $credit . '</td>'; //$debit=$debit+$valu->amount; } if ($valu->pavoucher != NULL) { $debit = $valu->amount; //$ctotal=$ctotal+$credit; $dtotal = $dtotal + $debit; $credit = 0.0; $h1 = '<td style="background-color:#ffffff;"> ' . $debit . '</td> <td style="background-color:#ffffff;"> </td>'; //$credit=$credit+$valu->amount; } $ob = $ob + $credit - $debit; $h3 = '<td>' . number_format($ob, 2, '.', '') . '</td></tr>'; $htmll = $html . $h6 . $h5 . $h1 . $h3; $html2 = $html2 . $htmll; } $i++; $sum = $sum + $valu->amount; } $subtotal = $openbalance + $ctotal - $dtotal; $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;"></td><td>' . number_format($dtotal, 2, '.', '') . '</td><td>' . $ctotal . '</td><td>' . number_format($subtotal, 2, '.', '') . '</td></tr>'; $html5 = '<tr><td colspan="6" align="right" style="background-color:#ffffff;">Closing Balance:</td><td> ' . number_format($ob, 2, '.', '') . '</td></tr>'; $html6 = '</table></div>'; //$html4='DEBIT:'.$debit.'CRedit:'.$credit.''; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('suppliersledger.pdf'); } else { echo '<h1 style="color:red;">No data found<h1>'; } } else { if ($date == 'fromdate') { //echo $cid; die(); $fromdate = CommonController::date_format($request->input('fromdate')); $todate = CommonController::date_format($request->input('todate')); //$fromdate=date("Y-m-d"); //$todate=date("Y-m-d"); $var = array($cid, $fromdate, $todate); //print_r($var); if ($cid == 0) { $spname = "suppliersledgerall"; } else { $spname = "suppliersledger"; } $value = Info::callinfo($var, $spname); //print_r($value); //die(); foreach ($value as $valu) { $ccode = $valu->scode; $cname = $valu->sname; } //print_r($value);die(); $fdate = date_create($fromdate); $tdate = date_create($todate); if ($value != NULL) { $date = date('Y-m-d', strtotime($fromdate . " - 1 day")); $v = array($cid, $date); $s = "customerbalance"; $cvalue = Info::callinfo($v, $s); //print_r($cvalue); if ($cvalue != NULL) { //print_r($cvalue); } if ($cid == 0) { $openbalance = DB::table('suppliers')->sum('openbalance'); $cname = 'All Suppliers A/C'; // echo $openbalance; } else { $suppliers = DB::table('suppliers')->where('id', $cid)->first(); $openbalance = $suppliers->openbalance; } PDF::AddPage('A4'); $html1 = ' <p></p> <div> <table> <tr> <td style="width:20%"> <img src="uploads/' . $file . '" alt="logo" height="150";> </td> <td style="width:85% font-size:30%"> <h2>' . $coname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h2> SUPPLIER A/C</h2> <h4> Ledger Account</h4> <h4> ' . date_format($fdate, "d-M-Y") . ' ' . date_format($tdate, "d-M-Y") . '</h4> </div> <div> <table border="1" style="width:100%; padding:20px;"> <tr> <td style="width:20%">Accounts Code:</td> <td style="width:80%">' . $ccode . '</td> </tr> <tr> <td style="width:20%">Accounts of:</td> <td style="width:80%">' . $cname . '</td> </tr> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher Type</th> <th > Voucher No.</th> <th> Debit</th> <th> Credit</th> <th> Balance</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;" colspan="3">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . $openbalance . '</th> <th></th> </tr>'; $html2 = ''; $i = 1; $sum = 0; $credit = 0; $debit = 0; $ob = $openbalance; $ctotal = 0; $dtotal = 0; foreach ($value as $valu) { if ($valu->vstatus == 1 or $valu->pustatus == 1) { if ($valu->vid != NULL) { if ($valu->vtype == 1) { $acc = 'By BANK A/C'; } else { if ($valu->vtype == 2) { $acc = 'By CASH A/C'; } } } else { if ($valu->sid != NULL) { $acc = 'To PURCHASE A/C'; } } $html = '<tr> <td style="background-color:#ffffff;"> ' . $valu->created_at . '</td> <td style="background-color:#ffffff;">' . $acc . '</td> '; if ($valu->pavoucher != NULL) { $h6 = '<td style="background-color:#ffffff;">Payment</td>'; } else { $h6 = '<td style="background-color:#ffffff;">Purchase</td>'; } if ($valu->pavoucher != NULL) { $h5 = '<td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->vid . '/' . $valu->vtype . '" target="_blank">' . $valu->pavoucher . '</a></td>'; } else { $h5 = '<td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/purchase/pdf/' . $valu->puid . '" target="_blank">' . $valu->puvoucher . '</a></td>'; } if ($valu->puvoucher != NULL) { $credit = $valu->amount; //$dtotal=$dtotal+$debit; $ctotal = $ctotal + $credit; $debit = 0.0; $h1 = '<td style="background-color:#ffffff;"> </td> <td style="background-color:#ffffff;"> ' . $credit . '</td>'; //$debit=$debit+$valu->amount; } if ($valu->pavoucher != NULL) { $debit = $valu->amount; //$ctotal=$ctotal+$credit; $dtotal = $dtotal + $debit; $credit = 0.0; $h1 = '<td style="background-color:#ffffff;"> ' . $debit . '</td> <td style="background-color:#ffffff;"> </td>'; //$credit=$credit+$valu->amount; } $ob = $ob + $credit - $debit; $h3 = '<td>' . number_format($ob, 2, '.', '') . '</td></tr>'; $htmll = $html . $h6 . $h5 . $h1 . $h3; $html2 = $html2 . $htmll; } $i++; $sum = $sum + $valu->amount; } $subtotal = $openbalance + $ctotal - $dtotal; $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;"></td><td>' . number_format($dtotal, 2, '.', '') . '</td><td>' . $ctotal . '</td><td>' . number_format($subtotal, 2, '.', '') . '</td></tr>'; $html5 = '<tr><td colspan="6" align="right" style="background-color:#ffffff;">Closing Balance:</td><td> ' . number_format($ob, 2, '.', '') . '</td></tr>'; $html6 = '</table></div>'; //$html4='DEBIT:'.$debit.'CRedit:'.$credit.''; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('suppliersledger.pdf'); } else { echo '<h1 style="color:red;">No data found<h1>'; } } } }
public function index() { JavaScript::put(['yearNow' => $this->year(), 'link' => ['status' => route('getQdnLinkAndData'), 'ajax' => route('ajax'), 'qdn_data' => route('qdn_data')]]); return view('admin.pages.index')->with(['ave' => $this->qdn->failureModeAve(), 'qdn' => Info::recentPost(), 'count' => $this->qdn->failureModeCount()]); }
public function getInfo() { return $this->hasOne(Info::className(), ['oid' => 'id']); }
private function filterInfo($request) { return '' != $request->text ? Info::filterWithText($request) : Info::filterWithOutText($request); }
/** * @return \yii\db\ActiveQuery */ public function getInfos() { return $this->hasMany(Info::className(), ['C_ID' => 'C_ID']); }
public function printpdf(Request $request, $fromtoday, $today) { $profile = Companyprofile::get(); foreach ($profile as $com) { $cid = $com->id; $cname = $com->name; $address = $com->address; $tele = $com->telephone; $mobile = $com->mobile; $email = $com->email; $url = $com->url; $file = $com->file; } $var = array($fromtoday, $today); $spname = "rptsales"; $value = Info::callinfo($var, $spname); //print_r($value); PDF::AddPage(); $html1 = ' <p></p> <div> <table> <tr> <td style="width:20%"> <img src="uploads/' . $file . '" alt="logo" height="150";> </td> <td style="width:85% font-size:30%"> <h2>' . $cname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h3> <u>Reports on Sales</h3></u></div> <div><strong> From Date:' . $fromtoday . ' To Date:' . $today . ' </strong></div></div> <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th style="">Serial No.</th> <th style="">Customer Name</th> <th>Voucher No.</th> <th>Sales Date</th> <th>Gross Total</th> <th>Previous Due</th> <th>Present Balance</th> <th>Type</th> </tr>'; $html2 = ''; $i = 1; $sum = 0; foreach ($value as $valu) { if ($valu->previousdue <= 0) { $previousdue = ' '; } else { $previousdue = $valu->previousdue; } if ($valu->presentbalance <= 0) { $presentbalance = ' '; } else { $presentbalance = $valu->presentbalance; } $html = '<tr><td style="background-color:#ffffff;"> ' . $i . '</td> <td style="background-color:#ffffff;">' . $valu->cname . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/physicalsales/print/' . $valu->id . '" target="_blank">' . $valu->name . '</a></td> <td style="background-color:#ffffff;">' . $valu->salesdate . '</td> <td style="background-color:#ffffff;">' . $valu->gamount . '</td> <td style="background-color:#ffffff;">' . $previousdue . '</td> <td style="background-color:#ffffff;">' . $presentbalance . '</td>'; if ($valu->presentbalance <= 0) { $d = '<td style="background-color:#ffffff; color:green">Cash</td>'; } else { $d = '<td style="background-color:#ffffff; color:red">Due</td>'; } $e = '</tr>'; $html2 = $html2 . $html . $d . $e; $i++; $sum = $sum + $valu->gamount; } $hl1 = '<tr> <td colspan="4" >Grant Total</td> <td>' . number_format($sum, 2, '.', '') . '</td> <td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"></td> </tr>'; $html2 = $html2 . $hl1; $html3 = '</table></div>'; $html = $html1 . $html2 . $html3; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('sales.pdf'); }
public static function last() { return Info::orderBy('id', 'desc')->first(); }
protected function isTopContributor($station) { return Info::getTopContributorByStation() == $station; }
$var = array($p->id); $spname = "salesanalyst"; $value = Info::callinfo($var, $spname); foreach ($value as $v) { $samount = $v->amount; echo $samount . '-'; } $sum = $sum + $samount; echo $sum; ?> </td> <td class="center"> <?php $var = array($p->cid); $spname = "cashanalyst"; $value = Info::callinfo($var, $spname); foreach ($value as $v) { $camount = $v->amount; echo $camount; } ?> </td> <td class="center"> <?php $damount = $sum - $camount; if ($damount > 0) { echo $damount; } ?> </td>
public function actionInfo() { $info = file_get_contents('php://input'); if ($info = json_decode($info, true)) { foreach ($info as $key => $value) { $model = Info::findOne(['key' => $key, 'client_id' => $this->client_user->id]); if (!$model instanceof Info) { $model = new Info(); } $model->key = $key; $model->value = $value; if ($this->client_user instanceof ClientUsers) { $model->client_id = $this->client_user->id; } $model->save(); } } else { throw new HttpException(400, 'Invalid info'); } }
public function fromtoday(Request $request) { $profile = Companyprofile::get(); //print_r($profile); foreach ($profile as $com) { $id = $com->id; $coname = $com->name; $address = $com->address; $tele = $com->telephone; $mobile = $com->mobile; $email = $com->email; $url = $com->url; $file = $com->file; } $date = $request->input('submit'); $cid = $request->input('cid'); if ($date == 'today') { $date = Combo::callcombo('currentdate'); //print_r($date); foreach ($date as $d) { $curdate = $d->curdate; } $fromdate = CommonController::date_format($curdate); $todate = CommonController::date_format($curdate); $fromdate = date("Y-m-d"); $todate = date("Y-m-d"); $var = array($cid, $fromdate, $todate); //print_r($var); //die(); if ($cid == 0) { $spname = "customersledgerall"; } else { $spname = "customersledger"; } $value = Info::callinfo($var, $spname); /*if($value==NULL) echo "No data found"; else print_r($value); die(); */ //$value=Info::callinfo($var,$spname); //print_r($value); $c = DB::table('customers')->where('id', $cid)->first(); //$c = DB::table('customersledger')->where('id',$cid)->first(); $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $debitbalance = DB::table('customersledger')->select('customersledger.id', 'customersledger.rv', 'customersledger.sv', 'customers.name as cname', 'customers.code as ccode', 'customersledger.amount', 'customersledger.created_at')->join('customers', 'customersledger.cid', '=', 'customers.id')->where('customersledger.rv', '<>', 0)->where('customersledger.cid', $cid)->where('customersledger.created_at', '<=', $previousdate)->sum('customersledger.amount'); //->get(); //print_r($debitbalance); $creditbalance = DB::table('customersledger')->select('customersledger.id', 'customersledger.rv', 'customersledger.sv', 'customers.name as cname', 'customers.code as ccode', 'customersledger.amount', 'customersledger.created_at')->join('customers', 'customersledger.cid', '=', 'customers.id')->where('customersledger.sv', '<>', 0)->where('customersledger.cid', $cid)->where('customersledger.created_at', '<=', $previousdate)->sum('customersledger.amount'); //->get(); //print_r($creditbalance); $openbalance = $c->openbalance + $debitbalance - $creditbalance; //echo $openbalance; //$bid=$b->bankid; $name_code = DB::table('customersledger')->select('customers.name as cname', 'customers.code as ccode', 'customersledger.created_at', 'voucher.vstatus', 'voucher.vnno as rvoucher', 'voucher.type as vtype', 'sales.status as sstatus', 'sales.name as svoucher')->join('customers', 'customersledger.cid', '=', 'customers.id')->join('voucher', 'customersledger.rv', '=', 'voucher.id')->join('sales', 'customersledger.sv', '=', 'sales.id')->where('customersledger.cid', $cid)->where('sales.customerid', $cid)->where('voucher.cid', $cid)->where('customersledger.created_at', $todate)->get(); foreach ($name_code as $valu) { $ccode = $valu->ccode; $cname = $valu->cname; } foreach ($value as $valu) { $ccode = $valu->ccode; $cname = $valu->cname; } /* if($name_code==null) echo "Data Not Found"; else print_r($name_code); die(); */ PDF::AddPage('A4'); $html1 = ' <p></p> <div> <table> <tr> <td style="width:20%"> <img src="uploads/' . $file . '" alt="logo" height="150";> </td> <td style="width:85% font-size:30%"> <h2>' . $coname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h2> CUSTOMER A/C</h2> <h4> Ledger Account</h4> <h4> </h4> </div> <div> <table border="1" style="width:100%; padding:20px;"> <tr> <td style="width:20%">Accounts Code:</td> <td style="width:80%">' . $ccode . '</td> </tr> <tr> <td style="width:20%">Accounts of:</td> <td style="width:80%">' . $cname . '</td> </tr> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher Type</th> <th > Voucher No.</th> <th> Debit</th> <th> Credit</th> <th> Balance</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;" colspan="3">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . $openbalance . '</th> <th></th> </tr>'; $html2 = ''; $i = 1; foreach ($value as $valu) { if ($valu->vstatus == 1 or $valu->sstatus == 1) { if ($valu->vid != NULL) { if ($valu->vtype == 3) { $acc = 'By BANK A/C'; } else { if ($valu->vtype == 4) { $acc = 'By CASH A/C'; } else { if ($valu->vtype == 6) { $acc = 'By BKash'; } else { if ($valu->vtype == 7) { $acc = 'By SAP'; } else { if ($valu->vtype == 8) { $acc = 'By KCS'; } else { if ($valu->vtype == 9) { $acc = 'By MBank'; } } } } } } } else { if ($valu->sid != NULL) { $acc = 'To SALES A/C'; } } $html = '<tr> <td style="background-color:#ffffff;"> ' . $valu->created_at . '</td> <td style="background-color:#ffffff;">' . $acc . '</td> '; if ($valu->rvoucher != NULL) { $h6 = '<td style="background-color:#ffffff;"> Receipt</td>'; } else { $h6 = '<td style="background-color:#ffffff;"> Sales</td>'; } if ($valu->rvoucher != NULL) { $h5 = '<td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->vid . '/' . $valu->vtype . '" target="_blank">' . $valu->rvoucher . '</a></td>'; } else { $h5 = '<td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/physicalsales/print/' . $valu->sid . '" target="_blank">' . $valu->svoucher . '</a></td>'; } if ($valu->svoucher != NULL) { $debit = $valu->amount; $h1 = '<td style="background-color:#ffffff;"> ' . $debit . '</td> <td style="background-color:#ffffff;"> </td>'; //$debit=$debit+$valu->amount; } if ($valu->rvoucher != NULL) { $credit = $valu->amount; $h1 = '<td style="background-color:#ffffff;"> </td> <td style="background-color:#ffffff;"> ' . $credit . '</td>'; //$credit=$credit+$valu->amount; } $h3 = '<td>' . number_format($openbalance, 2, '.', '') . '</td></tr>'; $htmll = $html . $h6 . $h5 . $h1 . $h3; $html2 = $html2 . $htmll; } $i++; //$sum=$sum+$valu->amount; } //$subtotal=($openbalance+$dtotal)-$ctotal; $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;"></td><td>' . number_format($debitbalance, 2, '.', '') . '</td><td>' . number_format($creditbalance, 2, '.', '') . '</td><td>subtotal</td></tr>'; $html5 = '<tr><td colspan="6" align="right" style="background-color:#ffffff;">Closing Balance:</td><td> </td></tr>'; $html6 = '</table></div>'; //$html4='DEBIT:'.$debit.'CRedit:'.$credit.''; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('customersledger.pdf'); } else { if ($date == 'fromdate') { //echo $cid; die(); $fromdate = CommonController::date_format($request->input('fromdate')); $todate = CommonController::date_format($request->input('todate')); $var = array($cid, $fromdate, $todate); //print_r($var); if ($cid == 0) { $spname = "customersledgerall"; } else { $spname = "customersledger"; } $value = Info::callinfo($var, $spname); //print_r($value); //die(); foreach ($value as $valu) { $ccode = $valu->ccode; $cname = $valu->cname; } //print_r($value);die(); $fdate = date_create($fromdate); $tdate = date_create($todate); if ($value != NULL) { $date = date('Y-m-d', strtotime($fromdate . " - 1 day")); $v = array($cid, $date); $s = "customerbalance"; $cvalue = Info::callinfo($v, $s); //print_r($cvalue); if ($cvalue != NULL) { //print_r($cvalue); } if ($cid == 0) { $openbalance = DB::table('customers')->sum('openbalance'); $cname = 'All Customers A/C'; // echo $openbalance; } else { $customers = DB::table('customers')->where('id', $cid)->first(); $openbalance = $customers->openbalance; } PDF::AddPage('A4'); $html1 = ' <p></p><p></p> <div> <table> <tr> <td style="width:20%"> <img src="uploads/' . $file . '" alt="logo" height="150";> </td> <td style="width:85% font-size:30%"> <h2>' . $coname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h2> CUSTOMER A/C</h2> <h4> Ledger Account</h4> <h4> ' . date_format($fdate, "d-M-Y") . ' ' . date_format($tdate, "d-M-Y") . '</h4> </div> <div> <table border="1" style="width:100%; padding:20px;"> <tr> <td style="width:20%">Accounts Code:</td> <td style="width:80%">' . $ccode . '</td> </tr> <tr> <td style="width:20%">Accounts of:</td> <td style="width:80%">' . $cname . '</td> </tr> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher Type</th> <th > Voucher No.</th> <th> Debit</th> <th> Credit</th> <th> Balance</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;" colspan="3">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . $openbalance . '</th> <th></th> </tr>'; $html2 = ''; $i = 1; $sum = 0; $credit = 0; $debit = 0; $ob = $openbalance; $dtotal = 0; $ctotal = 0; foreach ($value as $valu) { if ($valu->vstatus == 1 or $valu->sstatus == 1) { if ($valu->vid != NULL) { if ($valu->vtype == 3) { $acc = 'By BANK A/C'; } else { if ($valu->vtype == 4) { $acc = 'By CASH A/C'; } else { if ($valu->vtype == 6) { $acc = 'By BKash'; } else { if ($valu->vtype == 7) { $acc = 'By SAP'; } else { if ($valu->vtype == 8) { $acc = 'By KCS'; } else { if ($valu->vtype == 9) { $acc = 'By MBank'; } } } } } } } else { if ($valu->sid != NULL) { $acc = 'To SALES A/C'; } } $html = '<tr> <td style="background-color:#ffffff;"> ' . $valu->created_at . '</td> <td style="background-color:#ffffff;">' . $acc . '</td> '; if ($valu->rvoucher != NULL) { $h6 = '<td style="background-color:#ffffff;"> Receipt</td>'; } else { $h6 = '<td style="background-color:#ffffff;"> Sales</td>'; } if ($valu->rvoucher != NULL) { $h5 = '<td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->vid . '/' . $valu->vtype . '" target="_blank">' . $valu->rvoucher . '</a></td>'; } else { $h5 = '<td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/physicalsales/print/' . $valu->sid . '" target="_blank">' . $valu->svoucher . '</a></td>'; } if ($valu->svoucher != NULL) { $debit = $valu->amount; $dtotal = $dtotal + $debit; $credit = 0.0; $h1 = '<td style="background-color:#ffffff;"> ' . $debit . '</td> <td style="background-color:#ffffff;"> </td>'; //$debit=$debit+$valu->amount; } if ($valu->rvoucher != NULL) { $credit = $valu->amount; $ctotal = $ctotal + $credit; $debit = 0.0; $h1 = '<td style="background-color:#ffffff;"> </td> <td style="background-color:#ffffff;"> ' . $credit . '</td>'; //$credit=$credit+$valu->amount; } $ob = $ob + $debit - $credit; $h3 = '<td>' . number_format($ob, 2, '.', '') . '</td></tr>'; $htmll = $html . $h6 . $h5 . $h1 . $h3; $html2 = $html2 . $htmll; } $i++; $sum = $sum + $valu->amount; } $subtotal = $openbalance + $dtotal - $ctotal; $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;"></td><td>' . number_format($dtotal, 2, '.', '') . '</td><td>' . number_format($ctotal, 2, '.', '') . '</td><td>' . number_format($subtotal, 2, '.', '') . '</td></tr>'; $html5 = '<tr><td colspan="6" align="right" style="background-color:#ffffff;">Closing Balance:</td><td> ' . number_format($subtotal, 2, '.', '') . '</td></tr>'; $html6 = '</table></div>'; //$html4='DEBIT:'.$debit.'CRedit:'.$credit.''; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('customersledger.pdf'); } else { echo '<h1 style="color:red;">No data found<h1>'; } } } }