public function fromtoday(Request $request) { $date = $request->input('submit'); $branchid = $request->input('branchid'); $fromdate = CommonController::date_format($request->input('fromdate')); $todate = CommonController::date_format($request->input('todate')); 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"); $factioyitems = DB::table('factioyitems')->join('users', 'users.id', '=', 'factioyitems.userid')->join('items', 'items.id', '=', 'factioyitems.itemsid')->whereBetween('factioyitems.created_at', array($fromdate, $todate))->where('factioyitems.userid', $branchid)->select('users.name as branchname', 'items.name as itemsname', 'factioyitems.slno')->get(); return view('factorystockview', compact('value', 'value1', 'fromdate', 'todate', 'factioyitems')); } else { if ($date == 'fromdate') { $fromdate = CommonController::date_format($request->input('fromdate')); $todate = CommonController::date_format($request->input('todate')); $factioyitems = DB::table('factioyitems')->join('users', 'users.id', '=', 'factioyitems.userid')->join('items', 'items.id', '=', 'factioyitems.itemsid')->whereBetween('factioyitems.created_at', array($fromdate, $todate))->where('factioyitems.userid', $branchid)->select('users.name as branchname', 'items.name as itemsname', 'factioyitems.slno')->get(); return view('factorystockview', compact('value', 'value1', 'fromdate', 'todate', 'factioyitems')); } } }
public function today(Request $request) { $date = Combo::callcombo('currentdate'); //print_r($date); foreach ($date as $d) { $curdate = $d->curdate; } $fromdate = CommonController::date_format($curdate); $todate = CommonController::date_format($curdate); $var = array($fromdate, $todate); $spname = "rptsales"; $value = Info::callinfo($var, $spname); //print_r($value); return view('reportsaleview', compact('value', 'fromdate', 'todate')); }
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 printpdf(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; } $date = $request->input('submit'); $id = $request->input('id'); //return '44444'; 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($id, $fromdate, $todate); if ($id == 2) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 4)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> Cash Collection A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> '; $html2 = ''; $total = 0.0; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 3) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 2)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> Cash Payment A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> '; $html2 = ''; $total = 0.0; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 4) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 6)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> Bkash A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 5) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 7)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> SAP A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 6) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 8)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> KCS A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 7) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 9)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> MBank A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 8) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 3)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> Bank Collection A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 9) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 1)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> Bank Payment A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 11) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('sales')->where('status', 1)->where('created_at', '<', $previousdate)->sum('gamount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> Sales A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Invoice No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">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 = ''; $total = $openbalance; foreach ($value as $valu) { $amount = $valu->gamount; $salesname = $valu->salesname; $name = $valu->cname; $dc = $valu->dc; $vdate = $valu->salesdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/physicalsales/print/' . $valu->id . '" target="_blank">' . $salesname . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 12) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('purchase')->where('status', 1)->where('created_at', '<', $previousdate)->sum('gross_total'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> Purchase A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Purchase No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">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 = ''; $total = $openbalance; foreach ($value as $valu) { $purchasename = $valu->purchasename; $purchasedate = $valu->purchasedate; $gross_total = $valu->gross_total; $dc = $valu->dc; $sname = $valu->sname; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $purchasedate . '</td> <td style="background-color:#ffffff;"> ' . $sname . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/purchase/pdf/' . $valu->id . '" target="_blank">' . $purchasename . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $gross_total . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $gross_total; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 13) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); // print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('employeesal')->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $fdate = date_create($curdate); $tdate = date_create($curdate); 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> Sub Ledger</h2> <h4> Salary A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Employee Name</th> <th>Description</th> <th > Particulars</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . $openbalance . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $employeename = $valu->employeename; $amount = $valu->amount; $particularsname = $valu->particularsname; $vdate = $valu->vdate; $description = $valu->description; $dc = $valu->dc; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $employeename . '</td> <td style="background-color:#ffffff;"> ' . $description . '</td> <td style="background-color:#ffffff;">' . $particularsname . '</td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="5" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { //print_r($value); $spname = "generalledger"; $value = Info::callinfo($var, $spname); //print_r($value);die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $description = $valu->description; $name = $valu->name; $dc = $valu->dc; $created_at = $valu->created_at; $openbalance = $valu->openbalance; } $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> Sub Ledger</h2> <h4> Ledger Account</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <div> <table border="1" style="width:100%; padding:20px;"> <tr> <td style="width:20%">Accounts of:</td> <td style="width:80%">' . $name . '</td> </tr> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">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 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $description = $valu->description; $name = $valu->name; $dc = $valu->dc; $created_at = $valu->created_at; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $created_at . '</td> <td style="background-color:#ffffff;">' . $description . '</td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/ledgerentry/pdf/' . $valu->id . '" target="_blank">' . $id . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table></div>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } } } } } } } } } } } } else { if ($date == 'fromdate') { $fromdate = CommonController::date_format($request->input('fromdate')); $todate = CommonController::date_format($request->input('todate')); $var = array($id, $fromdate, $todate); if ($id == 2) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 4)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> Cash Collection A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 3) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 2)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> Cash Payment A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 4) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 6)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> Bkash A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 5) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 7)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> SAP A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 6) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 8)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> KCS A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 7) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 9)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> MBank A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 8) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 3)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> Bank Collection A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 9) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('voucher')->where('type', 1)->where('vstatus', 1)->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> Bank Payment A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $amount = $valu->amount; $vnno = $valu->vnno; $name = $valu->name; $dc = $valu->dc; $vdate = $valu->vdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/voucher/pdf/' . $valu->id . '/' . $valu->type . '" target="_blank">' . $vnno . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 11) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('sales')->where('status', 1)->where('created_at', '<', $previousdate)->sum('gamount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> Sales A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Invoice No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $amount = $valu->gamount; $salesname = $valu->salesname; $name = $valu->cname; $dc = $valu->dc; $vdate = $valu->salesdate; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $name . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/physicalsales/print/' . $valu->id . '" target="_blank">' . $salesname . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 12) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); //print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('purchase')->where('status', 1)->where('created_at', '<', $previousdate)->sum('gross_total'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> Purchase A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Purchase No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $purchasename = $valu->purchasename; $purchasedate = $valu->purchasedate; $gross_total = $valu->gross_total; $dc = $valu->dc; $sname = $valu->sname; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $purchasedate . '</td> <td style="background-color:#ffffff;"> ' . $sname . '</td> <td style="background-color:#ffffff;"><a href="http://192.168.1.8/IMS/purchase/pdf/' . $valu->id . '" target="_blank">' . $purchasename . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $gross_total . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $gross_total; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { if ($id == 13) { $spname = "sub_ledger_voucher"; $value = Info::callinfo($var, $spname); // print_r($value); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } foreach ($value as $valu) { $opbalance = $valu->openbalance; } $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day")); $previousbalance = DB::table('employeesal')->where('created_at', '<', $previousdate)->sum('amount'); // echo $previousbalance; die(); $openbalance = $opbalance + $previousbalance; $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> Sub Ledger</h2> <h4> Salary A/C</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <table border="1" style="width:100%; padding:20px;"> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Employee Name</th> <th>Description</th> <th > Particulars</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $employeename = $valu->employeename; $amount = $valu->amount; $particularsname = $valu->particularsname; $vdate = $valu->vdate; $description = $valu->description; $dc = $valu->dc; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $vdate . '</td> <td style="background-color:#ffffff;"> ' . $employeename . '</td> <td style="background-color:#ffffff;"> ' . $description . '</td> <td style="background-color:#ffffff;">' . $particularsname . '</td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="5" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.pdf'); } else { //print_r($var); $spname = "generalledger"; $value = Info::callinfo($var, $spname); //print_r($value); //die(); if ($value == NULL) { echo '<h1>Data not found</h1>'; die; } //print_r($value);die(); foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $description = $valu->description; $name = $valu->name; $dc = $valu->dc; $created_at = $valu->created_at; $openbalance = $valu->openbalance; } $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> Sub Ledger</h2> <h4> Ledger Account</h4> <h4> From ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <div> <table border="1" style="width:100%; padding:20px;"> <tr> <td style="width:20%">Accounts of:</td> <td style="width:80%">' . $name . '</td> </tr> </table> <table border="1" style="background-color:lightblue; width:100%; padding:20px;"> <tr> <th > Month & Date</th> <th>Particulars</th> <th > Voucher No.</th> <th> Debit/Credit</th> <th> Amount</th> </tr> <tr> <th style="background-color:#ffffff;"> ' . date('Y-m-d', strtotime($fromdate . " - 1 day")) . '</th> <th style="background-color:#ffffff;">Opening Balance</th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;"></th> <th style="background-color:#ffffff;">' . number_format($openbalance, 2, '.', '') . '</th> <th></th> </tr>'; $html2 = ''; $total = $openbalance; foreach ($value as $valu) { $id = $valu->id; $amount = $valu->amount; $description = $valu->description; $name = $valu->name; $dc = $valu->dc; $created_at = $valu->created_at; $ht = '<tr> <td style="background-color:#ffffff;"> ' . $created_at . '</td> <td style="background-color:#ffffff;">' . $description . '</td> <td style="background-color:#ffffff;"> <a href="http://192.168.1.8/IMS/ledgerentry/pdf/' . $valu->id . '" target="_blank">' . $id . '</a></td> <td style="background-color:#ffffff;"> ' . $dc . '</td> <td style="background-color:#ffffff;"> ' . $amount . '</td> </tr>'; $html2 = $html2 . $ht; $total = $total + $amount; } $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">Total:</td><td> ' . number_format($total, 2, '.', '') . '</td></tr>'; $html5 = ''; $html6 = '</table></div>'; $html = $html1 . $html2 . $html3 . $html5 . $html6; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('subledgerentry.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 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 today(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; } //print_r($trialbalance); //die(); $date = Combo::callcombo('currentdate'); //print_r($date); foreach ($date as $d) { $curdate = $d->curdate; } $fromdate = CommonController::date_format($curdate); $todate = CommonController::date_format($curdate); $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> 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(); $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>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_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 == 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 today(Request $request) { /* $coatype= DB::table('coatype')->get(); foreach($coatype as $ctype){ echo '<b>'.$ctype->name.'</b><br>'; $coa= DB::table('coa')->where('coatypeid',$ctype->id)->get(); foreach($coa as $c){ echo $c->name.'<br>'; } } */ /* PDF::AddPage('L'); $coatype= DB::table('coatype')->get(); $html=''; foreach($coatype as $ctype){ $html1='<b>'.$ctype->name.'</b><br>'; $coa= DB::table('coa')->where('coatypeid',$ctype->id)->get(); $html2=''; foreach($coa as $c){ $html3='<span style="width:100px;">'.$c->name.'</span>total<br>'; $html2=$html2.$html3; } $html=$html.$html1.$html2; } PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('trailbalance.pdf'); die(); */ $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; } //print_r($trialbalance); //die(); $date = Combo::callcombo('currentdate'); //print_r($date); foreach ($date as $d) { $curdate = $d->curdate; } $fromdate = CommonController::date_format($curdate); $todate = CommonController::date_format($curdate); $var = array($fromdate, $todate); $fdate = date_create($curdate); $tdate = date_create($curdate); 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>Trail Balance</u></h2> <h4> ' . date_format($fdate, "d-M-Y") . ' To ' . date_format($tdate, "d-M-Y") . '</h4> </div> <div> <table border="" style="background-color:#FFFFFF; width:100%; padding:20px;"> <tr> <th> Particulars</th> <th style>Debit</th> <th style>Credit</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')->where('coa.id', '<>', 14)->where('coa.id', '<>', 15)->orderBy('coa.coatypeid', 'asc')->get(); $html2 = ''; $coatypeid_cur = -1; $totaldebit = 0; $totalcredit = 0; foreach ($trialbalance as $t) { //$instatus=DB::table('coa')-> 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; } } else { 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; } } else { if ($t->inid == 3) { //$instatus=DB::table('coa')-> $var = array($t->id, $fromdate, $todate); $spname = "todaypettycash"; $value = Info::callinfo($var, $spname); $debit = NULL; $credit = NULL; $debitCredit = 'cebit Credit'; } } } 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 == 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'; } } } // if($debit==NULL && $credit==NULL){ // $h=''; // }else{ // } } } // if($t->inid==1){ // $html2 = $html2.'<tr><td style="background-color:#ffffff;"> <b>'.$t->coatypename.'</b></td><td><b></b></td><td></td></tr>'; // }else{ // $html2 = $html2.'<tr><td style="background-color:#ffffff;"> <b>'.$t->coatypename.'</b></td><td></td><td><b></b></td></tr>'; // } if ($t->inid == 1 || $t->inid == 2) { if ($debit_total_head == 0) { $html2 = $html2 . '<tr><td style="background-color:#ffffff;"> <b>' . $t->coatypename . '</b></td><td style="background-color:#ffffff;"> </td><td style="background-color:#ffffff;"><b>' . number_format($credit_total_head, 2, '.', '') . '</b></td></tr>'; } else { if ($credit_total_head == 0) { $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><td style="background-color:#ffffff;"> </td></tr>'; } } } // if($t->inid==1){ // $html2 = $html2.'<tr><td style="background-color:#ffffff;"> <b>'.$t->coatypename.'</b></td><td><b></b></td><td></td></tr>'; // }elseif ($t->inid==2){ // $html2 = $html2.'<tr><td style="background-color:#ffffff;"> <b>'.$t->coatypename.'</b></td><td></td><td><b></b></td></tr>'; // }elseif ($t->inid==3){ // $html2 = $html2.'<tr><td style="background-color:#ffffff;"> <b></b></td><td></td><td><b></b></td></tr>'; // } } $coatypeid_cur = $t->coatypeid; $h = '<tr><td style="background-color:#ffffff;"> ' . $t->coaname . '</td><td>' . $debit . '</td><td>' . $credit . '</td></tr>'; } $html2 = $html2 . $h; $totaldebit = $totaldebit + $debit; $totalcredit = $totalcredit + $credit; } if ($totaldebit > $totalcredit) { $difftotal = $totaldebit - $totalcredit; $tdebit = $totaldebit; $tcredit = number_format($totalcredit + $difftotal, 2, '.', ''); $h4 = '<tr><td style="background-color:#ffffff;"> Diff in opening balance</td><td></td><td>' . number_format($difftotal, 2, '.', '') . '</td></tr>'; } else { if ($totaldebit < $totalcredit) { $difftotal = $totalcredit - $totaldebit; $tcredit = $totalcredit; $tdebit = number_format($totaldebit + $difftotal, 2, '.', ''); $h4 = '<tr><td style="background-color:#ffffff;"> Diff in opening balance</td><td>' . number_format($difftotal, 2, '.', '') . '</td><td></td></tr>'; } else { if ($totaldebit == $totalcredit) { $h4 = '<tr><td style="background-color:#ffffff;"> Diff in opening balance</td><td></td><td></td></tr>'; } } } $h3 = '<tr><td style="background-color:#ffffff;"> Grand Total</td><td>' . number_format($tdebit, 2, '.', '') . '</td><td>' . number_format($tcredit, 2, '.', '') . '</td> </tr>'; $html4 = '</table>'; $html = $html1 . $html2 . $h4 . $h3 . $html4; PDF::writeHTML($html, true, false, true, false, ''); PDF::Output('trailbalance.pdf'); }
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 today(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 = Combo::callcombo('currentdate'); //print_r($date); foreach ($date as $d) { $curdate = $d->curdate; } $fromdate = CommonController::date_format($curdate); $todate = CommonController::date_format($curdate); $fromdate = date("Y-m-d"); $todate = date("Y-m-d"); $var = array($fromdate, $todate); $spname = "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($todate); //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; } $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:' . $fromdate . ' To Date:' . $todate . ' </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'); }