public function searchreturn(Request $request) { $profile = Companyprofile::get(); if ($request->input('slno') != NUll) { $factioyitems = DB::table('factioyitems')->where('slno', $request->input('slno'))->first(); $factioyitems->salesid; $fiall = DB::table('factioyitems')->join('sales', 'sales.id', '=', 'factioyitems.salesid')->join('customers', 'customers.id', '=', 'sales.customerid')->join('items', 'items.id', '=', 'factioyitems.itemsid')->select('customers.name as cname', 'factioyitems.slno', 'customers.preaddress', 'customers.phone', 'sales.name as salesname', 'sales.created_at as salesdate', 'items.name as itemsname')->where('salesid', $factioyitems->salesid)->get(); //$var = array($pslno); //$spname="searchreturn"; //$value=Info::callinfo($var,$spname); // print_r($fiall); //$profile=Companyprofile::get(); return view('searchreturn2', compact('profile', 'fiall')); } else { $profile = Companyprofile::get(); return view('searchreturn')->with('profile', $profile); } }
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'); }
public function datewise(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; } $check_data = $request->input('submit'); $employee_id = $request->input('employee_id'); if ($check_data == 'today') { $current_date = date("Y-m-d"); if ($employee_id == 0) { $employee_salary = Employeesalary::get_today_all_employee_salary($current_date); } else { if ($employee_id != -1 && $employee_id != 0) { $employee_salary = Employeesalary::get_today_employee_salary($current_date, $employee_id); } } } else { if ($check_data == 'fromdate') { $fromdate = $request->input('fromdate'); $todate = $request->input('todate'); $fromdate = date('Y-m-d', strtotime($fromdate)); $todate_view = date('Y-m-d', strtotime($todate)); $todate = date('Y-m-d', strtotime($todate . " + 1 day")); if ($employee_id == 0) { $employee_salary = Employeesalary::get_from_to_all_employee_salary($fromdate, $todate); } else { if ($employee_id != -1 && $employee_id != 0) { $employee_salary = Employeesalary::get_from_to_employee_salary($fromdate, $todate, $employee_id); } } } } //print_r($employee_salary); if (count($employee_salary) > 0) { //$fdate=date_create($vdate); //$tdate=date_create($vdate); 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>Employee Report</u></h2> <h4> '; if ($check_data == 'today') { $html1 = $html1 . $current_date . ' To ' . $current_date . '</h4>'; } else { if ($check_data == 'fromdate') { $html1 = $html1 . $fromdate . ' To ' . $todate_view . '</h4>'; } } $html1 = $html1 . '</div> <div> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th style="width:15%">Serial No.</th> <th>Employee Name</th> <th>Particulars</th> <th>Description</th> <th>Amount</th> </tr>'; $html2 = ''; $i = 1; foreach ($employee_salary as $valu) { $html = '<tr><td style="background-color:#ffffff;width:15%;"> ' . $i . '</td> <td style="background-color:#ffffff;">' . $valu->ename . '</td> <td style="background-color:#ffffff;">' . $valu->pname . '</td> <td style="background-color:#ffffff;">' . $valu->description . '</td> <td style="background-color:#ffffff;">' . $valu->amount . '</td></tr>'; $html2 = $html2 . $html; $i++; } $html3 = '</table></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('employeesalary.pdf'); } else { echo 'No Information are Found.'; } }
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 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 pdf(Request $request, $id, $type, $status) { //echo $id.$type.$status; $voucher = DB::table('voucher')->where('id', $id)->first(); //print_r($voucher); $vnno = $voucher->vnno; $amount = $voucher->amount; $sid = $voucher->sid; $cid = $voucher->cid; $type = $voucher->type; $vdate = $voucher->vdate; //echo '<br>'; $vouchercontra = DB::table('vouchercontra')->where('vid', $voucher->id)->first(); //print_r($vouchercontra); $vid = $vouchercontra->vid; $baccid = $vouchercontra->baccid; $checkno = $vouchercontra->checkno; $cashid = $vouchercontra->cashid; $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; } if ($status == 1) { $date = date_create($vdate); PDF::AddPage(); $bname = DB::table('bankinfo')->where('id', $baccid)->first(); $brancename = DB::table('bankaccount')->where('id', $baccid)->first(); $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> <h2> <u>Cash Contra</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vnno . '</td> <td></td> <td>Manual V. No:' . $type . '</td> </tr> <tr> <td>Bank Name:</td> <td></td> <td>Branch Name:' . $brancename->branchname . '</td> </tr> <tr> <td>A/C No.' . $brancename->name . '</td> <td></td> <td>Check No.' . $checkno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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>'; $bname = DB::table('bankaccount')->where('id', $baccid)->pluck('name'); $coa = DB::table('coa')->where('id', 1)->first(); $bcode = DB::table('bankaccount')->where('id', $baccid)->pluck('code'); $html2 = ' <tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $coa->name . '</td> <td style="background-color:#ffffff;"> ' . $coa->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;"> ' . $bname . '</td> <td style="background-color:#ffffff;"> ' . $bcode . '</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></div><div></div> <div 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('contravouchar.pdf'); } else { if ($status == 2) { $date = date_create($vdate); PDF::AddPage(); $bname = DB::table('bankinfo')->where('id', $baccid)->first(); $brancename = DB::table('bankaccount')->where('id', $baccid)->first(); $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> <h2> <u>Bank Contra</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vnno . '</td> <td></td> <td>Manual V. No:' . $type . '</td> </tr> <tr> <td>Bank Name:</td> <td></td> <td>Branch Name:' . $brancename->branchname . '</td> </tr> <tr> <td>A/C No.' . $brancename->name . '</td> <td></td> <td>Check No.' . $checkno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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>'; $bname = DB::table('bankaccount')->where('id', $baccid)->pluck('name'); $coa = DB::table('coa')->where('id', 1)->first(); $bcode = DB::table('bankaccount')->where('id', $baccid)->pluck('code'); $html2 = ' <tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $bname . '</td> <td style="background-color:#ffffff;"> ' . $bcode . '</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></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('contravouchar.pdf'); } else { if ($status == 3) { $date = date_create($vdate); PDF::AddPage(); $bname = DB::table('bankinfo')->where('id', $baccid)->first(); $brancename = DB::table('bankaccount')->where('id', $baccid)->first(); $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> <h2> <u>Bank To Bank Contra</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vnno . '</td> <td></td> <td>Manual V. No:' . $type . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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>'; $bname = DB::table('bankaccount')->where('id', $baccid)->pluck('name'); $cash = DB::table('bankaccount')->where('id', $cashid)->pluck('name'); $ccode = DB::table('bankaccount')->where('id', $cashid)->pluck('code'); $bcode = DB::table('bankaccount')->where('id', $baccid)->pluck('code'); $html2 = ' <tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $bname . '</td> <td style="background-color:#ffffff;"> ' . $bcode . '</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;"> ' . $cash . '</td> <td style="background-color:#ffffff;"> ' . $ccode . '</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></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('contravouchar.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 printtoken(Request $request, $pid) { $profile = Companyprofile::get(); //print_r($profile); foreach ($profile as $com) { $id = $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($pid); $spname = "viewsales"; $value = Info::callinfo($var, $spname); foreach ($value as $valu) { $id = $valu->id; $sailname = $valu->sname; $salesdate = $valu->salesdate; $cusname = $valu->cname; $phone = $valu->phone; $preaddress = $valu->preaddress; } //$pdate=date_create($purchasedate); //$sdate=date_create($suppliersbilldate); $spname1 = "salesdetailsview"; $value1 = Info::callinfo($var, $spname1); $spname2 = "challanitem"; $value2 = Info::callinfo($var, $spname2); $value3 = Info::callinfo($var, $spname2); $sum = 0; foreach ($value1 as $valu) { $a = $valu->amount; $sum = $sum + $a; } PDF::AddPage('P', 'A5'); $html1 = ' <p></p> <div> <table> <tr> <td style="width:85% font-size:30%"> <h2>' . $cname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> <h2> <u>Gate Pass</u></h2> </table> </div> <div></div> <div> <table border="0" style="width:100%"> <tr> <td>No:<u>' . $sailname . '</u></td> <td> Date:<u>' . $salesdate . '</u></td> </tr> <tr> <td>Name:' . $cusname . '</td> </tr> <tr> <td>Address:' . $preaddress . '</td> </tr> </table> </div> <div> <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th style="width:15%;"> SI No</th> <th style="width:50%;"> Description</th> <th> Quantity</th> </tr>'; $html2 = ''; $i = 1; $total = 0; foreach ($value1 as $valu) { $html = '<tr><td style="background-color:#ffffff;"> ' . $i . '</td> <td style="background-color:#ffffff;"> (' . $valu->icode . ')' . $valu->iname . '</td> <td style="background-color:#ffffff;"> ' . $valu->quantity . '</td> </tr>'; $html2 = $html2 . $html; $i++; $total = $total + $valu->quantity; } $html3 = '<tr><td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"> Total:</td> <td style="background-color:#ffffff;"> ' . number_format($total, 2, '.', '') . '</td> </tr></table></div> <div> </div> <div class="col-md-12" style=" background-color: #ffffff;color:#000000;"> <h3> Received By Approved By </h3> </div>'; $html = $html1 . $html2 . $html3; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('token.pdf'); }
public function fromtodaycashview(Request $request, $fromdate, $todate) { $profile = Companyprofile::get(); //print_r($profile); foreach ($profile as $com) { $id = $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($fromdate, $todate); //print_r($var); $spname = "totalcashview"; $value = Info::callinfo($var, $spname); //print_r($value); die(); 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>Total Cash</h3></u></div> <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th style="width:10%"> ID</th> <th>Voucher NO.</th> <th>Voucher Date</th> <th style="width:25%">Customer Name</th> <th>Amount</th> </tr> '; $html2 = ''; $i = 1; $sum = 0; foreach ($value as $valu) { $html = '<tr><td style="background-color:#ffffff;"> ' . $i . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $valu->vnno . '</a></td> <td style="background-color:#ffffff;">' . $valu->vdate . '</td> <td style="background-color:#ffffff;">' . $valu->name . '</td> <td style="background-color:#ffffff;">' . $valu->amount . '</td></tr>'; $html2 = $html2 . $html; $i++; $sum = $sum + $valu->amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">'; $html4 = ''; $html5 = 'Total:</td><td style="background-color:#ffffff;">' . number_format($sum, 2, '.', '') . '</td></tr>'; $html6 = '</table></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 . $html4 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('sales.pdf'); }
public function pdf(Request $request, $id, $type) { //echo $id.$type; $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; } if ($type == 1) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $bname = $v->bname; $branchname = $v->branchname; $accno = $v->accno; $checkno = $v->checkno; $vdate = $v->vdate; $baid = $v->baid; $sid = $v->sid; $bacode = $v->bacode; $scode = $v->scode; } $date = date_create($vdate); 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> <h2> <u>Bank Payment Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Bank Name:' . $bname . '</td> <td></td> <td>Branch Name:' . $branchname . '</td> </tr> <tr> <td>A/C No.' . $accno . '</td> <td></td> <td>Check No.' . $checkno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $sname = DB::table('suppliers')->where('id', $sid)->pluck('name'); $bname = DB::table('bankaccount')->where('id', $baid)->pluck('name'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $sname . '</td> <td style="background-color:#ffffff;">' . $scode . '</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;"> ' . $bname . '</td> <td style="background-color:#ffffff;"> ' . $bacode . '</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></div><div></div> <div 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('vbp.pdf'); } else { if ($type == 2) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $sid = $v->sid; $scode = $v->scode; $vdate = $v->vdate; } $date = date_create($vdate); 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> <h2> <u>Payment Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Unit/Place:</td> <td></td> <td>Manual V. No.</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $sname = DB::table('suppliers')->where('id', $sid)->pluck('name'); $cashname = DB::table('coa')->where('id', 1)->pluck('name'); $cashcode = DB::table('coa')->where('id', 1)->pluck('code'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $sname . '</td> <td style="background-color:#ffffff;">' . $scode . '</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;"> ' . $cashname . '</td> <td style="background-color:#ffffff;">' . $cashcode . '</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></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('vbpp.pdf'); } else { if ($type == 3) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $bname = $v->bname; $branchname = $v->branchname; $accno = $v->accno; $checkno = $v->checkno; $vdate = $v->vdate; $baid = $v->baid; $cid = $v->cid; $bacode = $v->bacode; $ccode = $v->ccode; } $date = date_create($vdate); 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> <h2> <u>Bank Receive Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Bank Name:' . $bname . '</td> <td></td> <td>Branch Name:' . $branchname . '</td> </tr> <tr> <td>A/C No.' . $accno . '</td> <td></td> <td>Check No.' . $checkno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $cname = DB::table('customers')->where('id', $cid)->pluck('name'); $bname = DB::table('bankaccount')->where('id', $baid)->pluck('name'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $bname . '</td> <td style="background-color:#ffffff;">' . $bacode . '</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;"> ' . $cname . '</td> <td style="background-color:#ffffff;">' . $ccode . '</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></div><div></div> <div 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('vbp.pdf'); } else { if ($type == 4) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $cid = $v->cid; $ccode = $v->ccode; $vdate = $v->vdate; } $date = date_create($vdate); 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> <h2> <u>Receive Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $cname = DB::table('customers')->where('id', $cid)->pluck('name'); $cashname = DB::table('coa')->where('id', 1)->pluck('name'); $cashcode = DB::table('coa')->where('id', 1)->pluck('code'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $cashname . '</td> <td style="background-color:#ffffff;">' . $cashcode . '</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;"> ' . $cname . '</td> <td style="background-color:#ffffff;"> ' . $ccode . '</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></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('vbpp.pdf'); } else { if ($type == 5) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $bname = $v->bname; $baname = $v->baname; $branchname = $v->branchname; $checkno = $v->checkno; $vdate = $v->vdate; $baid = $v->baid; $bacode = $v->bacode; } $date = date_create($vdate); 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> <h2> <u>Contra Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Bank Name:' . $bname . '</td> <td></td> <td>Branch Name:' . $branchname . '</td> </tr> <tr> <td>A/C No.' . $baname . '</td> <td></td> <td>Check No.' . $checkno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $cashname = DB::table('coa')->where('id', 1)->pluck('name'); $cashcode = DB::table('coa')->where('id', 1)->pluck('code'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $cashname . '</td> <td style="background-color:#ffffff;">' . $cashcode . '</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;"> ' . $baname . '</td> <td style="background-color:#ffffff;">' . $bacode . '</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></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('vbp.pdf'); } else { if ($type == 6) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $cid = $v->cid; $ccode = $v->ccode; $vdate = $v->vdate; } $date = date_create($vdate); 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> <h2> <u>bKash Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $cname = DB::table('customers')->where('id', $cid)->pluck('name'); $cashname = DB::table('coa')->where('id', 1)->pluck('name'); $cashcode = DB::table('coa')->where('id', 1)->pluck('code'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $cashname . '</td> <td style="background-color:#ffffff;">' . $cashcode . '</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;"> ' . $cname . '</td> <td style="background-color:#ffffff;"> ' . $ccode . '</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></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('vbpp.pdf'); } else { if ($type == 7) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $cid = $v->cid; $ccode = $v->ccode; $vdate = $v->vdate; } $date = date_create($vdate); 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> <h2> <u>SAP Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $cname = DB::table('customers')->where('id', $cid)->pluck('name'); $cashname = DB::table('coa')->where('id', 1)->pluck('name'); $cashcode = DB::table('coa')->where('id', 1)->pluck('code'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $cashname . '</td> <td style="background-color:#ffffff;">' . $cashcode . '</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;"> ' . $cname . '</td> <td style="background-color:#ffffff;"> ' . $ccode . '</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></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('vbpp.pdf'); } else { if ($type == 8) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $cid = $v->cid; $ccode = $v->ccode; $vdate = $v->vdate; } $date = date_create($vdate); 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> <h2> <u>KCS Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $cname = DB::table('customers')->where('id', $cid)->pluck('name'); $cashname = DB::table('coa')->where('id', 1)->pluck('name'); $cashcode = DB::table('coa')->where('id', 1)->pluck('code'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $cashname . '</td> <td style="background-color:#ffffff;">' . $cashcode . '</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;"> ' . $cname . '</td> <td style="background-color:#ffffff;"> ' . $ccode . '</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></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('vbpp.pdf'); } else { if ($type == 9) { $var = array($id, $type); $spname = "voucher"; $value = Info::callinfo($var, $spname); //print_r($value); foreach ($value as $v) { $vrno = $v->vrno; $mvno = $v->mvno; $amount = $v->amount; $cid = $v->cid; $ccode = $v->ccode; $vdate = $v->vdate; } $date = date_create($vdate); 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> <h2> <u>MBank Voucher</u></h2> <table border="0" style="width:100%"> <tr> <td>Voucher No:' . $vrno . '</td> <td></td> <td>Manual V. No:' . $mvno . '</td> </tr> <tr> <td>Month:' . date_format($date, " F,Y") . '</td> <td></td> <td>Date:' . $vdate . '</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:30%;"> Head of Accounts</th> <th style="width:20%"> A/C Code</th> <th> DR(BDT)</th> <th> CR(BDT)</th> </tr>'; $cname = DB::table('customers')->where('id', $cid)->pluck('name'); $cashname = DB::table('coa')->where('id', 1)->pluck('name'); $cashcode = DB::table('coa')->where('id', 1)->pluck('code'); $html2 = '<tr> <td style="background-color:#ffffff;"> 1</td> <td style="background-color:#ffffff;"> ' . $cashname . '</td> <td style="background-color:#ffffff;">' . $cashcode . '</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;"> ' . $cname . '</td> <td style="background-color:#ffffff;">' . $ccode . '</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></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('vbpp.pdf'); } } } } } } } } } }
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 = "rptpurchase"; $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 Purchases</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="width:10%">Serial No.</th> <th>Supplier Name</th> <th>Purchases Bill No.</th> <th>Purchases Bill Date</th> <th>Supplier Bill No.</th> <th>Supplier Bill Date</th> <th>Amount</th> </tr>'; $html2 = ''; $i = 1; $total = 0.0; foreach ($value as $valu) { $html = '<tr><td style="background-color:#ffffff;"> ' . $i . '</td> <td style="background-color:#ffffff;">' . $valu->suppliersname . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/purchase/pdf/' . $valu->id . '" target="_blank">' . $valu->name . '</a></td> <td style="background-color:#ffffff;">' . $valu->purchasedate . '</td> <td style="background-color:#ffffff;">' . $valu->suppliersbillno . '</td> <td style="background-color:#ffffff;">' . $valu->suppliersbilldate . '</td> <td style="background-color:#ffffff;">' . $valu->amount . '</td> </tr>'; $html2 = $html2 . $html; $i++; $total = $total + $valu->amount; } $html3 = '<tr><td colspan="5"></td><td>Total</td><td>' . number_format($total, 2, '.', '') . '</td></tr></table></div>'; $html = $html1 . $html2 . $html3; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('purchases.pdf'); }
public function index() { $c = Companyprofile::get(); //print_r($c); return view('createcompanyprofile')->with('profile', $c); }
public function bankbook(Request $request) { $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; } $date = $request->input('submit'); $baccid = $request->input('baccid'); 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($baccid, $fromdate, $todate); //print_r($var); $spname = "bankbook"; $value = Info::callinfo($var, $spname); //print_r($value);die(); $b = DB::table('bankaccount')->where('id', $baccid)->first(); //$openbalance=$b->openbalance; $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $debitbalance = DB::table('bankbook')->join('voucher', 'voucher.id', '=', 'bankbook.vid')->where('bankbook.dc', 1)->where('voucher.vstatus', 1)->where('bankbook.baccid', $baccid)->where('bankbook.created_at', '<=', $previousdate)->sum('bankbook.amount'); //echo $debitbalance; die(); $creditbalance = DB::table('bankbook')->join('voucher', 'voucher.id', '=', 'bankbook.vid')->where('bankbook.dc', 0)->where('voucher.vstatus', 1)->where('bankbook.baccid', $baccid)->where('bankbook.created_at', '<=', $previousdate)->sum('bankbook.amount'); $openbalance = $b->openbalance + $debitbalance - $creditbalance; $bid = $b->bankid; $bank = DB::table('bankinfo')->where('id', $bid)->first(); 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>' . $cname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h2> <u>Account Statement</u></h2> <table border="0" style="width:100%"> <tr> <td>Bank Name:' . $bank->name . '</td> <td></td> <td>Opening Date:' . $b->opendate . '</td> </tr> <tr> <td>Current Deposite:' . $b->openbalance . '</td> <td></td> <td>Expire Date:' . $b->exdate . '</td> </tr> <tr> <td>A/C Number:' . $b->name . '</td> <td></td> <td>Interest Rate:' . $b->rate . '</td> </tr> <tr> <td>From:' . $fromdate . ' To ' . $todate . '</td> <td></td> <td>Currency:BDT</td> </tr> </table> </div> <div> <table border="1" style="width:100%; padding:20px;"> <tr> <td style="width:20%">Accounts Code:</td> <td style="width:80%">' . $b->code . '</td> </tr> <tr> <td style="width:20%">Accounts of:</td> <td style="width:80%">' . $b->name . '(' . $bank->name . ')</td> </tr> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Date</th> <th>Particulars</th> <th > Supplier Name</th> <th > Customer Name</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;">Balance B/F</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th> ' . number_format($openbalance, 2, '.', '') . '</th> </tr>'; $html2 = ''; $balance = $openbalance; $debit = $balance; $credit = 0; foreach ($value as $v) { if ($v->type == 5) { $h1 = '<tr> <td style="background-color:#ffffff;"> ' . $v->created_at . '</td> <td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->sname . '</a></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->cname . '</a></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '/' . $v->status . '">' . $v->vnno . '</a></td>'; } else { $h1 = '<tr> <td style="background-color:#ffffff;"> ' . $v->created_at . '</td> <td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->sname . '</a></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->cname . '</a></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->vnno . '</a></td>'; } if ($v->type == 1) { $balance = $balance - $v->amount; //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = '<td style="background-color:#ffffff;"> </td> <td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $credit = $credit + $v->amount; } else { if ($v->type == 3) { $balance = $balance + $v->amount; //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = '<td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td style="background-color:#ffffff;"> </td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $debit = $debit + $v->amount; } else { if ($v->type == 5) { if ($v->status == 1) { $balance = $balance + $v->amount; //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = '<td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td style="background-color:#ffffff;"> </td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $debit = $debit + $v->amount; } else { if ($v->status == 2) { $balance = $balance - $v->amount; //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = ' <td style="background-color:#ffffff;"> </td> <td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $credit = $credit + $v->amount; } else { if ($v->status == 3) { //$s = DB::table('suppliers')->where('id',$v->sid)->first(); if ($v->dc == 1) { $balance = $balance + $v->amount; $h2 = '<td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td style="background-color:#ffffff;"></td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; } else { if ($v->dc == 0) { $balance = $balance - $v->amount; $h2 = '<td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; } } $debit = $debit + $v->amount; } } } } } } $h = $h1 . $h2; $html2 = $html2 . $h; } $total = $debit - $credit; $h3 = ''; $html2 = $html2 . $h3; $html3 = '</table></div> <div> </div>'; $html = $html1 . $html2 . $html3; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('vbp.pdf'); } else { if ($date == 'fromdate') { $fromdate = CommonController::date_format($request->input('fromdate')); $todate = CommonController::date_format($request->input('todate')); $var = array($baccid, $fromdate, $todate); $spname = "bankbook"; $value = Info::callinfo($var, $spname); $b = DB::table('bankaccount')->where('id', $baccid)->first(); $openbalance = $b->openbalance; $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $debitbalance = DB::table('bankbook')->join('voucher', 'voucher.id', '=', 'bankbook.vid')->where('bankbook.dc', 1)->where('voucher.vstatus', 1)->where('bankbook.baccid', $baccid)->where('bankbook.created_at', '<=', $previousdate)->sum('bankbook.amount'); //echo $debitbalance; die(); $creditbalance = DB::table('bankbook')->join('voucher', 'voucher.id', '=', 'bankbook.vid')->where('bankbook.dc', 0)->where('voucher.vstatus', 1)->where('bankbook.baccid', $baccid)->where('bankbook.created_at', '<=', $previousdate)->sum('bankbook.amount'); $openbalance = $b->openbalance + $debitbalance - $creditbalance; $bid = $b->bankid; $bank = DB::table('bankinfo')->where('id', $bid)->first(); 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>' . $cname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h2> <u>Account Statement</u></h2> <table border="0" style="width:100%"> <tr> <td>Bank Name:' . $bank->name . '</td> <td></td> <td>Opening Date:' . $b->opendate . '</td> </tr> <tr> <td>Current Deposite:' . $b->openbalance . '</td> <td></td> <td>Expire Date:' . $b->exdate . '</td> </tr> <tr> <td>A/C Number:' . $b->name . '</td> <td></td> <td>Interest Rate:' . $b->rate . '</td> </tr> <tr> <td>From:' . $fromdate . ' To ' . $todate . '</td> <td></td> <td>Currency:BDT</td> </tr> </table> </div> <div> <table border="1" style="width:100%; padding:20px;"> <tr> <td style="width:20%">Accounts Code:</td> <td style="width:80%">' . $b->code . '</td> </tr> <tr> <td style="width:20%">Accounts of:</td> <td style="width:80%">' . $b->name . '(' . $bank->name . ')</td> </tr> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Date</th> <th>Particulars</th> <th > Supplier Name</th> <th > Customer Name</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;">Balance B/F</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th> ' . number_format($openbalance, 2, '.', '') . '</th> </tr>'; $html2 = ''; $balance = $openbalance; $debit = $balance; $credit = 0; foreach ($value as $v) { if ($v->type == 5) { $h1 = '<tr> <td style="background-color:#ffffff;"> ' . $v->created_at . '</td> <td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->sname . '</a></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->cname . '</a></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '/' . $v->status . '">' . $v->vnno . '</a></td>'; } else { $h1 = '<tr> <td style="background-color:#ffffff;"> ' . $v->created_at . '</td> <td style="background-color:#ffffff;"></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->sname . '</a></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->cname . '</a></td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->vnno . '</a></td>'; } if ($v->type == 1) { $balance = $balance - $v->amount; if ($balance == NULL) { echo "<h1>No Data Found</h1>"; die; } else { //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = '<td style="background-color:#ffffff;"> </td> <td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $credit = $credit + $v->amount; } } else { if ($v->type == 3) { $balance = $balance + $v->amount; if ($balance == NULL) { echo "<h1>No Data Found</h1>"; die; } else { //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = '<td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td style="background-color:#ffffff;"> </td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $debit = $debit + $v->amount; } } else { if ($v->type == 5) { if ($v->status == 1) { $balance = $balance + $v->amount; if ($balance == NULL) { echo "<h1>No Data Found</h1>"; die; } else { //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = '<td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td style="background-color:#ffffff;"> </td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $debit = $debit + $v->amount; } } else { if ($v->status == 2) { $balance = $balance - $v->amount; if ($balance == NULL) { echo "<h1>No Data Found</h1>"; die; } else { //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = ' <td style="background-color:#ffffff;"> </td> <td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $credit = $credit + $v->amount; } } else { if ($v->status == 3) { $balance = $balance + $v->amount; if ($balance == NULL) { echo "<h1>No Data Found</h1>"; die; } else { //$s = DB::table('suppliers')->where('id',$v->sid)->first(); $h2 = '<td style="background-color:#ffffff;"> ' . $v->amount . '</td> <td style="background-color:#ffffff;"></td> <td> ' . number_format($balance, 2, '.', '') . '</td> </tr>'; $debit = $debit + $v->amount; } } } } } } } $h = $h1 . $h2; $html2 = $html2 . $h; } $total = $debit - $credit; $h3 = '<tr> <td colspan="5" align="right" style="background-color:#ffffff;">Total</td> <td style="background-color:#ffffff;">' . number_format($debit, 2, '.', '') . '</td> <td style="background-color:#ffffff;"> ' . number_format($credit, 2, '.', '') . '</td> <td style="background-color:#ffffff;"> ' . number_format($total, 2, '.', '') . '</td> </tr>'; $html2 = $html2 . $h3; $html3 = '</table></div> <div> </div>'; $html = $html1 . $html2 . $html3; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('vbp.pdf'); } } }
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(); //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>'; } } } }
public function printcollection() { $profile = Companyprofile::get(); foreach ($profile as $com) { $id = $com->id; $cname = $com->name; $address = $com->address; $tele = $com->telephone; $mobile = $com->mobile; $email = $com->email; $url = $com->url; $file = $com->file; } $spname = "todaycollection"; $c = Combo::callcombo($spname); $spname3 = "todaycash"; $c5 = Combo::callcombo($spname3); $spname4 = "todaybankcollection"; $c6 = Combo::callcombo($spname4); $spname5 = "todaycashcollection"; $c7 = Combo::callcombo($spname5); $spname6 = "todaybkashcollection"; $c8 = Combo::callcombo($spname6); $spsap = "todaysapcollection"; $csap = Combo::callcombo($spsap); $spkcs = "todaykcscollection"; $ckcs = Combo::callcombo($spkcs); $spmbank = "todaymbankcollection"; $cmbank = Combo::callcombo($spmbank); foreach ($c6 as $cc) { $totalbankcash = $cc->cash; } foreach ($c7 as $ccc) { $totalhandcash = $ccc->cash; } foreach ($c8 as $ccc) { $totalbkash = $ccc->cash; } foreach ($csap as $ccc) { $totalsap = $ccc->cash; } foreach ($ckcs as $ccc) { $totalkcs = $ccc->cash; } foreach ($cmbank as $ccc) { $totalmbank = $ccc->cash; } $sum = 0; foreach ($c as $p) { $a = $p->amount; $sum = $sum + $a; } PDF::AddPage('L'); $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> <h2> <u>Statement of Daily Collection</u></h2><h4><br> Date: ' . date("d/m/Y") . ' To ' . date("d/m/Y") . '</h4> </div> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th style="width:3%;">SL</th> <th style="width:10%;">Name</th> <th style="width:12%;">Present Address</th> <th>Amount</th> <th style="width:7%;">Voucher No.</th> <th>Bank Amount</th> <th>Cash</th> <th>BKash</th> <th>SAP</th> <th>KCS</th> <th>MBank</th> <th>Total</th> </tr>'; $html2 = ''; $i = 1; $sum = 0; foreach ($c as $p) { if ($p->type == 3) { $bankamount = $p->amount; $cashamount = ''; $bkash = ''; $sap = ''; $kcs = ''; $mbank = ''; } else { if ($p->type == 4) { $bankamount = ''; $cashamount = $p->amount; $bkash = ''; $sap = ''; $kcs = ''; $mbank = ''; } else { if ($p->type == 6) { $bankamount = ''; $cashamount = ''; $bkash = $p->amount; $sap = ''; $kcs = ''; $mbank = ''; } else { if ($p->type == 7) { $bankamount = ''; $cashamount = ''; $bkash = ''; $sap = $p->amount; $kcs = ''; $mbank = ''; } else { if ($p->type == 8) { $bankamount = ''; $cashamount = ''; $bkash = ''; $sap = ''; $kcs = $p->amount; $mbank = ''; } else { if ($p->type == 9) { $bankamount = ''; $cashamount = ''; $bkash = ''; $sap = ''; $kcs = ''; $mbank = $p->amount; } } } } } } $html = '<tr><td style="background-color:#ffffff;">' . $i . '</td> <td style="background-color:#ffffff;">' . $p->name . '</td> <td style="background-color:#ffffff;">' . $p->preaddress . '</td> <td style="background-color:#ffffff;">' . $p->amount . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $p->id . '/' . $p->type . '" target="_blank">' . $p->vnno . '</a></td> <td style="background-color:#ffffff;">' . $bankamount . '</td> <td style="background-color:#ffffff;">' . $cashamount . '</td> <td style="background-color:#ffffff;">' . $bkash . '</td> <td style="background-color:#ffffff;">' . $sap . '</td> <td style="background-color:#ffffff;">' . $kcs . '</td> <td style="background-color:#ffffff;">' . $mbank . '</td> <td style="background-color:#ffffff;">' . $p->amount . '</td> </tr>'; $html2 = $html2 . $html; $i++; $sum = $sum + $p->amount; } $html3 = '<tr><td colspan="5" align="right" style="background-color:#ffffff;">'; $html4 = ''; $html5 = 'Total:</td> <td style="background-color:#ffffff;">' . $totalbankcash . '</td> <td style="background-color:#ffffff;">' . $totalhandcash . '</td> <td style="background-color:#ffffff;">' . $totalbkash . '</td> <td style="background-color:#ffffff;">' . $totalsap . '</td> <td style="background-color:#ffffff;">' . $totalkcs . '</td> <td style="background-color:#ffffff;">' . $totalmbank . '</td> <td style="background-color:#ffffff;">' . number_format($sum, 2, '.', '') . '</td></tr>'; $html6 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord(number_format($sum, 2, '.', '')) . ' Taka Only</h4></div> <div> </div> <div class="col-md-12" style=" background-color: #ffffff;color:#000000;"> <h3> Prepared By Checked By Approved By </h3> </div>'; $html = $html1 . $html2 . $html3 . $html4 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('vp.pdf'); }
public function fromtoday(Request $request) { $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; } $fromdate = CommonController::date_format($request->input('fromdate')); $todate = CommonController::date_format($request->input('todate')); $var = array($fromdate, $todate); // $var = array($fromdate,$todate); $spname = "rptcash"; $value = Info::callinfo($var, $spname); //print_r($value); //die(); foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; } //print_r($value);die(); $var1 = array($fromdate); //print_r($var1);die(); $spname1 = "totalcashcollection"; $value1 = Info::callinfo($var1, $spname1); //print_r($value1);die(); foreach ($value1 as $valu) { //$id=$valu->id; $opening_balance = $valu->cash; } $fdate = date_create($fromdate); $tdate = date_create($todate); $coa = DB::table('coa')->where('id', 1)->first(); $coabalance = $coa->openbalance; //echo $coabalance; $openbalance = $opening_balance + $coabalance; 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>' . $cname . '</h2> ' . $address . ' <br>Tel:' . $tele . ',Mobile:' . $mobile . ' <br>E-mail:' . $email . ' <br>' . $url . ' </td> </tr> </table> </div> <div> <h3> <u>Cash A/C Book</h3></u></div> <div><strong>From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . ' </strong></div></div> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th> Date</th> <th>Particulars</th> <th>Vch Type</th> <th>Vch No</th> <th>Debit</th> <th>Credit</th> </tr> <tr> <td style="background-color:#ffffff;"></td> <td colspan="3" style="background-color:#ffffff;">Opening Balance</td> <td style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</td> <td style="background-color:#ffffff;"></td> </tr>'; $html2 = ''; $i = 1; $dtotal = $openbalance; $ctotal = 0; foreach ($value as $valu) { if (substr($valu->vnno, 0, 1) == 'v') { //$vnno='Voucher'; $voucher = DB::table('voucher')->where('id', $valu->id)->first(); if ($voucher->type == 2) { $vnno = 'Cash Payment A/C'; $type = 'Payment'; $damount = NULL; $camount = $valu->amount; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } else { if ($voucher->type == 4) { $vnno = 'Cash Collection A/C'; $type = 'Receipt'; $damount = $valu->amount; $camount = NULL; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } else { if ($voucher->type == 5) { if ($voucher->status == 1) { $vnno = 'Cash Contra A/C'; $type = 'Receipt Contra'; $damount = $valu->amount; $camount = NULL; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } else { if ($voucher->status == 2) { $vnno = 'Bank Contra A/C'; $type = 'Payment Contra'; $damount = NULL; $camount = $valu->amount; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } } } else { if ($voucher->type == 6) { $vnno = 'bKash Collection A/C'; $coa = DB::table('coa')->where('id', 4)->first(); if ($coa->increasetypeid == 1) { $type = 'Receipt'; $damount = $valu->amount; $camount = NULL; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } else { if ($coa->increasetypeid == 2) { $type = 'Payment'; $damount = NULL; $camount = $valu->amount; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } } } else { if ($voucher->type == 7) { $vnno = 'SAP Collection A/C'; $coa = DB::table('coa')->where('id', 5)->first(); if ($coa->increasetypeid == 1) { $type = 'Receipt'; $damount = $valu->amount; $camount = NULL; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } else { if ($coa->increasetypeid == 2) { $type = 'Payment'; $damount = NULL; $camount = $valu->amount; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } } } else { if ($voucher->type == 8) { $vnno = 'KCS Collection A/C'; $coa = DB::table('coa')->where('id', 6)->first(); if ($coa->increasetypeid == 1) { $type = 'Receipt'; $damount = $valu->amount; $camount = NULL; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } else { if ($coa->increasetypeid == 2) { $type = 'Payment'; $camount = $valu->amount; $damount = NULL; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } } } else { if ($voucher->type == 9) { $vnno = 'MBank Collection A/C'; $coa = DB::table('coa')->where('id', 7)->first(); if ($coa->increasetypeid == 1) { $type = 'Receipt'; $damount = $valu->amount; $camount = NULL; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } else { if ($coa->increasetypeid == 2) { $type = 'Payment'; $camount = $valu->amount; $damount = NULL; $link = 'http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type; } } } } } } } } } } else { $pettycash = DB::table('pettycash')->where('id', $valu->id)->first(); $coa = DB::table('coa')->where('id', $pettycash->particular)->first(); $vnno = $coa->name; if ($coa->increasetypeid == 1) { $type = 'Receipt'; $damount = $valu->amount; $camount = NULL; } else { if ($coa->increasetypeid == 2) { $type = 'Payment'; $damount = NULL; $camount = $valu->amount; } } $link = 'http://192.168.1.8/IMS/ledgerentry/pdf/' . $valu->id; } $html = '<tr><td style="background-color:#ffffff;"> ' . $valu->created_at . '</td> <td style="background-color:#ffffff;">' . $vnno . '</td> <td style="background-color:#ffffff;">' . $type . '</td> <td style="background-color:#ffffff;"><a href="' . $link . '">' . $valu->vnno . '</a></td> <td style="background-color:#ffffff;">' . $damount . '</td> <td style="background-color:#ffffff;">' . $camount . '</td> </tr>'; $html2 = $html2 . $html; $i++; $dtotal = $dtotal + $damount; $ctotal = $ctotal + $camount; } $html3 = '<tr> <td></td> <td colspan="3" >Total</td> <td>' . number_format($dtotal, 2, '.', '') . '</td> <td>' . number_format($ctotal, 2, '.', '') . '</td> </tr> <tr> <td style="background-color:#ffffff;"></td> <td colspan="4" style="background-color:#ffffff;">Closing Balance</td> <td style="background-color:#ffffff;">' . number_format($dtotal - $ctotal, 2, '.', '') . '</td> </tr> <tr> <td></td> <td colspan="3" >Sub Total</td> <td>' . number_format($dtotal, 2, '.', '') . '</td> <td>' . number_format($ctotal + $dtotal - $ctotal, 2, '.', '') . '</td> </tr> </table></div>'; $html = $html1 . $html2 . $html3; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('cash.pdf'); }