Esempio n. 1
0
 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 edit(Request $request, $id)
 {
     if ($request->method() == 'POST') {
         $id = $request->input('id');
         $m = Employeeinfo::find($id);
         $m->name = $request->input('name');
         $m->designation = $request->input('designation');
         $m->joindate = CommonController::date_format($request->input('joindate'));
         $m->preaddress = $request->input('preaddress');
         $m->peraddress = $request->input('peraddress');
         $m->salary = $request->input('salary');
         $m->employeetype = $request->input('employeetype');
         $m->uid = $request->input('uid');
         if (Input::file('file')->isValid()) {
             $d = 'uploads';
             $e = Input::file('file')->getClientOriginalExtension();
             $f = rand(11111, 99999) . '.' . $e;
             Input::file('file')->move($d, $f);
         }
         $m->file = $f;
         $m->userid = $request->input('userid');
         $m->save();
         return Redirect('employee');
     }
     $data['employee'] = Employeeinfo::find($id);
     return view('editemployee', $data);
 }
 public function __construct()
 {
     $this->middleware('auth');
     $permission = \App\Http\Controllers\Common\CommonController::check_permission('measurementgroup');
     if ($permission == 0) {
         echo 'This url is not found.';
         die;
         return redirect('/home');
     }
 }
Esempio n. 4
0
 public function fromtoday(Request $request)
 {
     $fromdate = CommonController::date_format($request->input('fromdate'));
     $todate = CommonController::date_format($request->input('todate'));
     $var = array($fromdate, $todate);
     //print_r($var);
     $spname = "rptsales";
     $value = Info::callinfo($var, $spname);
     //print_r($value);
     return view('reportsaleview', compact('value', 'fromdate', 'todate'));
 }
 public function edit(Request $request, $id)
 {
     if ($request->method() == 'POST') {
         $id = $request->input('id');
         $b = Employeesalary::find($id);
         $b->eid = $request->input('ename');
         $b->pid = $request->input('pname');
         $b->amount = $request->input('amount');
         $b->vdate = CommonController::date_format($request->input('vdate'));
         $b->description = $request->input('description');
         $b->save();
         return Redirect('employeesal');
     }
     $data['employeesal'] = Employeesalary::find($id);
     return view('editemployeesal', $data);
 }
Esempio n. 6
0
 public function edit(Request $request, $id)
 {
     if ($request->method() == 'POST') {
         $id = $request->input('id');
         $b = Bankaccount::find($id);
         $b->code = $request->input('code');
         $b->name = $request->input('name');
         $b->accotitle = $request->input('accotitle');
         $b->bankid = $request->input('bankid');
         $b->branchname = $request->input('branchname');
         $b->opendate = CommonController::date_format($request->input('opendate'));
         $b->exdate = CommonController::date_format($request->input('exdate'));
         $b->rate = $request->input('rate');
         $b->openbalance = $request->input('openbalance');
         $b->save();
         return Redirect('bankaccount');
     }
     $data['bankaccount'] = Bankaccount::find($id);
     $ba = Bankinfo::get();
     return view('editbankaccount', $data)->with('bankinfo', $ba);
 }
Esempio n. 7
0
    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>
					    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<u>Statement of Daily Collection</u></h2><h4><br>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						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>&nbsp;&nbsp;&nbsp; Prepared By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;						
						  Checked By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


						Approved By
						  </h3>
						
						
							
						</div>';
        $html = $html1 . $html2 . $html3 . $html4 . $html5 . $html6;
        PDF::writeHTML($html, true, false, true, false, '');
        PDF::Output('vp.pdf');
    }
Esempio n. 8
0
    public function pdf(Request $request, $pid)
    {
        $profile = Companyprofile::get();
        foreach ($profile as $com) {
            $cid = $com->id;
            $cname = $com->name;
            $aaddress = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        $var = array($pid);
        $spname = "viewpurchase";
        $value = Info::callinfo($var, $spname);
        foreach ($value as $valu) {
            $pname = $valu->pname;
            $purchasedate = $valu->purchasedate;
            $sname = $valu->sname;
            $address = $valu->address;
            $challanno = $valu->challanno;
            $suppliersbillno = $valu->suppliersbillno;
            $suppliersbilldate = $valu->suppliersbilldate;
            $discount = $valu->discount;
            $others_exp = $valu->others_exp;
            $gross_total = $valu->gross_total;
            $status = $valu->status;
        }
        $pdate = date_create($purchasedate);
        $sdate = date_create($suppliersbilldate);
        $spname1 = "purchasedetailsview";
        $value1 = Info::callinfo($var, $spname1);
        $sum = 0;
        foreach ($value1 as $valu) {
            $a = $valu->amount;
            $sum = $sum + $a;
        }
        PDF::AddPage();
        $html1 = '<p></p>
										
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $aaddress . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
						
						  <div>';
        $hst = '<h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						  &nbsp;&nbsp;<u>PURCHASE VOUCHER</u></h2>';
        $hex = '<table border="0" style="width:100%">
								 <tr>
										
										<td>Supplier Name:' . $sname . '</td>
										<td></td>
										<td>Voucher No:' . $pname . '</td>
										
									</tr>
									<tr>
									
										<td>Bill No:' . $suppliersbillno . '</td>
										<td></td>
										<td>Challan No:' . $challanno . '</td>
										
									</tr>
									<tr>
									
										<td>Address:' . $address . '</td>
										<td></td>
										<td>Purchase Date:' . date_format($pdate, "d/m/Y") . '</td>
										
									</tr>
									
									
								
								</table> 
							</div>
							<div>
						
						
					<table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">
					  <tr>
						<th>Item Name</th>
						<th>Quantity</th>
						<th>Measurement Unit</th>
						<th>Rate</th>
						<th>Amount</th>
					  </tr>';
        $html1 = $html1 . $hst . $hex;
        $html2 = '';
        foreach ($value1 as $valu) {
            $html = '<tr><td style="background-color:#ffffff;">' . $valu->iname . '</td>
				<td style="background-color:#ffffff;">' . $valu->quantity . '</td>
				<td style="background-color:#ffffff;">' . $valu->mname . '</td>
				<td style="background-color:#ffffff;">' . $valu->rate . '</td>
				<td style="background-color:#ffffff;">' . $valu->amount . '</td></tr>';
            $html2 = $html2 . $html;
        }
        $html3 = '<tr><td colspan="4" align="right" style="background-color:#ffffff;">';
        $html4 = '';
        $html5 = 'Sub Total:</td><td style="background-color:#ffffff;">' . number_format($sum, 2, '.', '') . '</td></tr>';
        $html6 = '
		      <tr><td colspan="4" align="right" style="background-color:#ffffff;">Discount:</td><td style="background-color:#ffffff;">' . number_format($discount, 2, '.', '') . '</td></tr>';
        $html7 = '
		       <tr><td colspan="4" align="right" style="background-color:#ffffff;">Others Exp.:</td><td style="background-color:#ffffff;">' . number_format($others_exp, 2, '.', '') . '</td></tr>';
        $html8 = '
		       <tr><td colspan="4" align="right" style="background-color:#ffffff;">Gross Total:</td><td style="background-color:#ffffff;">' . number_format($gross_total, 2, '.', '') . '</td></tr>';
        $html9 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord(number_format($gross_total, 2, '.', '')) . ' Taka Only</h4></div>
					<div>
					
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
        $html = $html1 . $html2 . $html3 . $html4 . $html5 . $html6 . $html7 . $html8 . $html9;
        PDF::writeHTML($html, true, false, true, false, '');
        PDF::Output('purchase.pdf');
    }
    public function pdf(Request $request, $id)
    {
        $profile = Companyprofile::get();
        foreach ($profile as $com) {
            $cid = $com->id;
            $cname = $com->name;
            $aaddress = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        $var = array($id);
        $spname = "ledgerentry";
        $value = Info::callinfo($var, $spname);
        //print_r($value);
        foreach ($value as $valu) {
            $id = $valu->id;
            $amount = $valu->amount;
            $description = $valu->description;
            $name = $valu->name;
            $code = $valu->code;
            $created_at = $valu->created_at;
        }
        $date = date_create($created_at);
        PDF::AddPage();
        $html1 = '
				<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $aaddress . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Ledger Voucher</u></h2>
								 <table border="0" style="width:100%">
									<tr>
										
										<td>Accounts Name:' . $name . '</td>
										<td></td>
										<td>Manual V. No:7</td>
										
									</tr>
									

								
									<tr>
								   
									<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $created_at . '</td>
									</tr>
									<tr>
								   
									<td>Description:' . $description . '</td>
										<td></td>
										<td></td>
									</tr>
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:35%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:15%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
        $coa = DB::table('coa')->where('id', 1)->first();
        $html2 = '
			<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $name . '</td>
				<td style="background-color:#ffffff;">' . $code . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $coa->name . '</td>
				<td style="background-color:#ffffff;">' . $coa->code . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
		
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
        $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div>
					
						</div>
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
        $html = $html1 . $html2 . $html3;
        PDF::writeHTML($html, true, false, true, false, '');
        PDF::Output('ledgerentry.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>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									SUPPLIER A/C</h2>
						 <h4>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
									Ledger Account</h4>	
                         <h4>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
								' . date_format($fdate, "d-M-Y") . '&nbsp;&nbsp;' . 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 >&nbsp;Month & Date</th>
				<th>Particulars</th>
				
				<th >&nbsp;Voucher Type</th>
				<th >&nbsp;Voucher No.</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Debit</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Credit</th>
				<th>&nbsp;&nbsp;Balance</th>
			  </tr>
			  <tr>
				<th style="background-color:#ffffff;">&nbsp;' . 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;">&nbsp;' . $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;">&nbsp;<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;">&nbsp;<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;">&nbsp;</td>
					<td style="background-color:#ffffff;">&nbsp;' . $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;">&nbsp;' . $debit . '</td>
					<td style="background-color:#ffffff;">&nbsp;</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>&nbsp;&nbsp;' . 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>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									SUPPLIER A/C</h2>
						 <h4>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
									Ledger Account</h4>	
                         <h4>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
								' . date_format($fdate, "d-M-Y") . '&nbsp;&nbsp;' . 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 >&nbsp;Month & Date</th>
				<th>Particulars</th>
				
				<th >&nbsp;Voucher Type</th>
				<th >&nbsp;Voucher No.</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Debit</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Credit</th>
				<th>&nbsp;&nbsp;Balance</th>
			  </tr>
			  <tr>
				<th style="background-color:#ffffff;">&nbsp;' . 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;">&nbsp;' . $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;">&nbsp;<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;">&nbsp;<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;">&nbsp;</td>
					<td style="background-color:#ffffff;">&nbsp;' . $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;">&nbsp;' . $debit . '</td>
					<td style="background-color:#ffffff;">&nbsp;</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>&nbsp;&nbsp;' . 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>';
                }
            }
        }
    }
Esempio n. 11
0
    public function challan(Request $request, $pid)
    {
        $profile = Companyprofile::get();
        //print_r($profile);
        foreach ($profile as $com) {
            $id = $com->id;
            $cname = $com->name;
            $address = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        $var = array($pid);
        $spname = "viewsales";
        $value = Info::callinfo($var, $spname);
        foreach ($value as $valu) {
            $id = $valu->id;
            $sailname = $valu->sname;
            $salesdate = $valu->salesdate;
            $cusname = $valu->cname;
            $phone = $valu->phone;
            $preaddress = $valu->preaddress;
        }
        //$pdate=date_create($purchasedate);
        //$sdate=date_create($suppliersbilldate);
        $spname1 = "salesdetailsview";
        $value1 = Info::callinfo($var, $spname1);
        $spname2 = "challanitem";
        $value2 = Info::callinfo($var, $spname2);
        $value3 = Info::callinfo($var, $spname2);
        //print_r($var); die();
        $sum = 0;
        foreach ($value1 as $valu) {
            $a = $valu->amount;
            $sum = $sum + $a;
        }
        PDF::AddPage();
        $html1 = '
			<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
		
		<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;
						<u>CHALLAN</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Customer Name:' . $cusname . '</td>
										<td></td>
										<td>Voucher No:' . $sailname . '</td>
										
									</tr>
									<tr>
									
										<td>Address:' . $preaddress . '</td>
										<td></td>
										<td>Date:' . $salesdate . '</td>
										
									</tr>
										<tr>
									
										<td>Mobile No:' . $phone . '</td>
										<td></td>
										<td></td>
										
									</tr>
									
								
								</table> 
							</div>
		
		  <div> 
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">		
			  <tr>
				<th style="width:15%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SI No</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Code</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;Description</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quantity</th>
				
			  </tr>';
        $html2 = '';
        $i = 1;
        $total = 0;
        foreach ($value1 as $valu) {
            $html = '<tr><td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $i . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $valu->icode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;' . $valu->iname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $valu->quantity . '</td>
				
				</tr>';
            $html2 = $html2 . $html;
            $i++;
            $total = $total + $valu->quantity;
        }
        $html3 = '<tr><td colspan="3" align="right" style="background-color:#ffffff;">';
        $html4 = '';
        $html5 = 'Total:</td><td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $total . '</td></tr>';
        $html6 = '<tr><td colspan="4">';
        $html7 = '';
        foreach ($value3 as $v) {
            $factioyitems = DB::table('factioyitems')->where('itemsid', $v->id)->where('salesid', $id)->get();
            //print_r($factioyitems);
            $h = '<span style="color:green;">' . $id . $v->id . $v->name . '</span>(';
            $h1 = '';
            foreach ($factioyitems as $f) {
                $h2 = '' . $f->slno . ',';
                $h1 = $h1 . $h2;
            }
            $h3 = ')<br>';
            $html = $h . $h1 . $h3;
            $html7 = $html7 . $html;
        }
        $html8 = '</td></tr>';
        $html9 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord(number_format($total, 2, '.', '')) . ' Pcs Only</h4></div>
		
					<div>
					

						</div>
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
        $html = $html1 . $html2 . $html3 . $html4 . $html5 . $html6 . $html7 . $html8 . $html9;
        PDF::writeHTML($html, true, false, true, false, '');
        PDF::Output('challan.pdf');
    }
    public function fromtoday(Request $request)
    {
        $profile = Companyprofile::get();
        //print_r($profile);
        foreach ($profile as $com) {
            $id = $com->id;
            $coname = $com->name;
            $address = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        $date = $request->input('submit');
        $cid = $request->input('cid');
        if ($date == 'today') {
            $date = Combo::callcombo('currentdate');
            //print_r($date);
            foreach ($date as $d) {
                $curdate = $d->curdate;
            }
            $fromdate = CommonController::date_format($curdate);
            $todate = CommonController::date_format($curdate);
            $fromdate = date("Y-m-d");
            $todate = date("Y-m-d");
            $var = array($cid, $fromdate, $todate);
            //print_r($var);
            //die();
            if ($cid == 0) {
                $spname = "customersledgerall";
            } else {
                $spname = "customersledger";
            }
            $value = Info::callinfo($var, $spname);
            /*if($value==NULL)
            		   echo "No data found";
            	   else
            		print_r($value);
            		die();
            		*/
            //$value=Info::callinfo($var,$spname);
            //print_r($value);
            $c = DB::table('customers')->where('id', $cid)->first();
            //$c = DB::table('customersledger')->where('id',$cid)->first();
            $previousdate = date('Y-m-d', strtotime($fromdate . " - 1 day"));
            $debitbalance = DB::table('customersledger')->select('customersledger.id', 'customersledger.rv', 'customersledger.sv', 'customers.name as cname', 'customers.code as ccode', 'customersledger.amount', 'customersledger.created_at')->join('customers', 'customersledger.cid', '=', 'customers.id')->where('customersledger.rv', '<>', 0)->where('customersledger.cid', $cid)->where('customersledger.created_at', '<=', $previousdate)->sum('customersledger.amount');
            //->get();
            //print_r($debitbalance);
            $creditbalance = DB::table('customersledger')->select('customersledger.id', 'customersledger.rv', 'customersledger.sv', 'customers.name as cname', 'customers.code as ccode', 'customersledger.amount', 'customersledger.created_at')->join('customers', 'customersledger.cid', '=', 'customers.id')->where('customersledger.sv', '<>', 0)->where('customersledger.cid', $cid)->where('customersledger.created_at', '<=', $previousdate)->sum('customersledger.amount');
            //->get();
            //print_r($creditbalance);
            $openbalance = $c->openbalance + $debitbalance - $creditbalance;
            //echo $openbalance;
            //$bid=$b->bankid;
            $name_code = DB::table('customersledger')->select('customers.name as cname', 'customers.code as ccode', 'customersledger.created_at', 'voucher.vstatus', 'voucher.vnno as rvoucher', 'voucher.type as vtype', 'sales.status as sstatus', 'sales.name as svoucher')->join('customers', 'customersledger.cid', '=', 'customers.id')->join('voucher', 'customersledger.rv', '=', 'voucher.id')->join('sales', 'customersledger.sv', '=', 'sales.id')->where('customersledger.cid', $cid)->where('sales.customerid', $cid)->where('voucher.cid', $cid)->where('customersledger.created_at', $todate)->get();
            foreach ($name_code as $valu) {
                $ccode = $valu->ccode;
                $cname = $valu->cname;
            }
            foreach ($value as $valu) {
                $ccode = $valu->ccode;
                $cname = $valu->cname;
            }
            /*
            			if($name_code==null)
            echo "Data Not Found";
            			else
            			print_r($name_code);
            			
            			die();
            */
            PDF::AddPage('A4');
            $html1 = ' 
								<p></p>
					<div>
						<table>
							<tr>
								<td style="width:20%">
									<img src="uploads/' . $file . '" alt="logo" height="150";>
								</td>
								<td style="width:85% font-size:30%">
								<h2>' . $coname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
								</td>
							</tr>

						</table>	
					</div>
					<div>

					   <h2>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									CUSTOMER A/C</h2>
						 <h4>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
									Ledger Account</h4>	
                         <h4>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				
								</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 >&nbsp;Month & Date</th>
				<th>Particulars</th>
				
				<th >&nbsp;Voucher Type</th>
				<th >&nbsp;Voucher No.</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Debit</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Credit</th>
				<th>&nbsp;&nbsp;Balance</th>
			  </tr>
			  <tr>
				<th style="background-color:#ffffff;">&nbsp;' . 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;">&nbsp;' . $valu->created_at . '</td>
					<td style="background-color:#ffffff;">' . $acc . '</td>
				';
                    if ($valu->rvoucher != NULL) {
                        $h6 = '<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Receipt</td>';
                    } else {
                        $h6 = '<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sales</td>';
                    }
                    if ($valu->rvoucher != NULL) {
                        $h5 = '<td style="background-color:#ffffff;">&nbsp;<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;">&nbsp;<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;">&nbsp;' . $debit . '</td>
					<td style="background-color:#ffffff;">&nbsp;</td>';
                        //$debit=$debit+$valu->amount;
                    }
                    if ($valu->rvoucher != NULL) {
                        $credit = $valu->amount;
                        $h1 = '<td style="background-color:#ffffff;">&nbsp;</td>
					<td style="background-color:#ffffff;">&nbsp;' . $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>&nbsp;&nbsp;</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>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									CUSTOMER A/C</h2>
						 <h4>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
									Ledger Account</h4>	
                         <h4>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				
								' . date_format($fdate, "d-M-Y") . '&nbsp;&nbsp;' . 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 >&nbsp;Month & Date</th>
				<th>Particulars</th>
				
				<th >&nbsp;Voucher Type</th>
				<th >&nbsp;Voucher No.</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Debit</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Credit</th>
				<th>&nbsp;&nbsp;Balance</th>
			  </tr>
			  <tr>
				<th style="background-color:#ffffff;">&nbsp;' . 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;">&nbsp;' . $valu->created_at . '</td>
					<td style="background-color:#ffffff;">' . $acc . '</td>
					';
                            if ($valu->rvoucher != NULL) {
                                $h6 = '<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Receipt</td>';
                            } else {
                                $h6 = '<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sales</td>';
                            }
                            if ($valu->rvoucher != NULL) {
                                $h5 = '<td style="background-color:#ffffff;">&nbsp;<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;">&nbsp;<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;">&nbsp;' . $debit . '</td>
					<td style="background-color:#ffffff;">&nbsp;</td>';
                                //$debit=$debit+$valu->amount;
                            }
                            if ($valu->rvoucher != NULL) {
                                $credit = $valu->amount;
                                $ctotal = $ctotal + $credit;
                                $debit = 0.0;
                                $h1 = '<td style="background-color:#ffffff;">&nbsp;</td>
					<td style="background-color:#ffffff;">&nbsp;' . $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>&nbsp;&nbsp;' . 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>';
                }
            }
        }
    }
Esempio n. 13
0
    public function fromtoday(Request $request)
    {
        $profile = Companyprofile::get();
        foreach ($profile as $com) {
            $cid = $com->id;
            $cname = $com->name;
            $aaddress = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        $fromdate = CommonController::date_format($request->input('fromdate'));
        $todate = CommonController::date_format($request->input('todate'));
        $var = array($fromdate, $todate);
        // $var = array($fromdate,$todate);
        $fdate = date_create($fromdate);
        $tdate = date_create($todate);
        PDF::AddPage();
        $html1 = '<p></p>
				<div>
						<table>
							<tr>
								<td style="width:20%">
									<img src="uploads/' . $file . '" alt="logo" height="150";>
								</td>
								<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $aaddress . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
								</td>
							</tr>

						</table>
				</div>
			
					
					<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<u>Balance Sheet</u></h2>
						<h4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								' . date_format($fdate, "d-M-Y") . '&nbsp;To&nbsp;' . date_format($tdate, "d-M-Y") . '</h4>
								 
								 
							</div>

		  <table border="0" style="background-color:#FFFFFF; padding:20px;">	
			  <tr><td>				
			  	<table border="0" style="background-color:#FFFFFF; padding:20px;">	
				  <tr>
				    <th><b>Assets</b></th> 
				   	
					<th style></th>
				   </tr>';
        $trialbalance = DB::table('coa')->join('coatype', 'coatype.id', '=', 'coa.coatypeid')->select('coa.id as id', 'coa.name as coaname', 'coa.coatypeid', 'coatype.name as coatypename', 'coa.increasetypeid as inid')->orderBy('coa.coatypeid', 'asc')->get();
        $html2 = '';
        $coatypeid_cur = -1;
        $total_debit = 0;
        foreach ($trialbalance as $t) {
            if ($t->inid == 1) {
                $var = array($t->id, $fromdate, $todate);
                $spname = "todaypettycash";
                $value = Info::callinfo($var, $spname);
                foreach ($value as $valu) {
                    //$debit='Debit';
                    $debit = $valu->cash;
                    $credit = NULL;
                }
                $total_debit = $total_debit + $debit;
            } else {
                if ($t->inid == 3) {
                    $var = array($t->id, $fromdate, $todate);
                    $spname = "todaypettycash";
                    $value = Info::callinfo($var, $spname);
                    $debit = NULL;
                    $credit = NULL;
                    $debitCredit = 'cebit Credit';
                }
            }
            if ($t->inid == 1 || $t->inid == 3) {
                if ($debit == NULL && $credit == NULL) {
                    $h = '';
                } else {
                    if ($coatypeid_cur != $t->coatypeid) {
                        $debit_total_head = 0;
                        // $credit_total_head = 0;
                        foreach ($trialbalance as $tr) {
                            if ($tr->coatypeid == $t->coatypeid) {
                                if ($tr->inid == 1) {
                                    $var = array($tr->id, $fromdate, $todate);
                                    $spname = "todaypettycash";
                                    $value = Info::callinfo($var, $spname);
                                    foreach ($value as $valu) {
                                        //$debit='Debit';
                                        $debit_head = $valu->cash;
                                        $credit_head = NULL;
                                    }
                                    $debit_total_head = $debit_total_head + $debit_head;
                                } else {
                                    if ($tr->inid == 3) {
                                        $var = array($tr->id, $fromdate, $todate);
                                        $spname = "todaypettycash";
                                        $value = Info::callinfo($var, $spname);
                                        $debit_head = NULL;
                                        $credit_head = NULL;
                                        $debitCredit = 'cebit Credit';
                                    }
                                }
                            }
                        }
                        // $var = array($t->coatypeid,$fromdate,$todate);
                        // $spname="totalpettycash";
                        // $value=Info::callinfo($var,$spname);
                        // foreach($value as $vs){
                        // 	$amount=$vs->cash;
                        // }
                        // if($t->inid==1){
                        $html2 = $html2 . '<tr><td style="background-color:#ffffff;"><b>' . $t->coatypename . '</b></td><td style="background-color:#ffffff;"><b>' . number_format($debit_total_head, 2, '.', '') . '</b></td></tr>';
                        // }else{
                        // $html2 = $html2.'<tr><td style="background-color:#ffffff;">&nbsp;&nbsp;<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>&nbsp;&nbsp;<b>Liabilities</b></th> 
					<th style></th>
				   </tr>';
        $trialbalance = DB::table('coa')->join('coatype', 'coatype.id', '=', 'coa.coatypeid')->select('coa.id as id', 'coa.name as coaname', 'coa.coatypeid', 'coatype.name as coatypename', 'coa.increasetypeid as inid')->orderBy('coa.coatypeid', 'asc')->get();
        //print_r($trialbalance);
        /// die();
        $html2 = '';
        $coatypeid_cur = -1;
        $total_credit = 0;
        foreach ($trialbalance as $t) {
            if ($t->inid == 2) {
                $var = array($t->id, $fromdate, $todate);
                $spname = "todaypettycash";
                $value = Info::callinfo($var, $spname);
                foreach ($value as $valu) {
                    $debit = NULL;
                    //$credit='Credit';
                    $credit = $valu->cash;
                }
                $total_credit = $total_credit + $credit;
            } else {
                if ($t->inid == 3) {
                    $var = array($t->id, $fromdate, $todate);
                    $spname = "todaypettycash";
                    $value = Info::callinfo($var, $spname);
                    $debit = NULL;
                    $credit = NULL;
                    $debitCredit = 'cebit Credit';
                }
            }
            if ($t->inid == 2 || $t->inid == 3) {
                if ($debit == NULL && $credit == NULL) {
                    $h = '';
                } else {
                    if ($coatypeid_cur != $t->coatypeid) {
                        // $debit_total_head = 0;
                        $credit_total_head = 0;
                        foreach ($trialbalance as $tr) {
                            if ($tr->coatypeid == $t->coatypeid) {
                                //    if($tr->inid==1){
                                // 	$var = array($tr->id,$fromdate,$todate);
                                // 	$spname="todaypettycash";
                                // 	$value=Info::callinfo($var,$spname);
                                // 	foreach($value as $valu){
                                // 	//$debit='Debit';
                                // 	$debit_head=$valu->cash;
                                // 	$credit_head=NULL;
                                // 	}
                                // 	$debit_total_head = $debit_total_head + $debit_head;
                                // }
                                if ($tr->inid == 2) {
                                    $var = array($tr->id, $fromdate, $todate);
                                    $spname = "todaypettycash";
                                    $value = Info::callinfo($var, $spname);
                                    foreach ($value as $valu) {
                                        $debit_head = NULL;
                                        //$credit='Credit';
                                        $credit_head = $valu->cash;
                                    }
                                    $credit_total_head = $credit_total_head + $credit_head;
                                } else {
                                    if ($tr->inid == 3) {
                                        $var = array($tr->id, $fromdate, $todate);
                                        $spname = "todaypettycash";
                                        $value = Info::callinfo($var, $spname);
                                        $debit_head = NULL;
                                        $credit_head = NULL;
                                        $debitCredit = 'cebit Credit';
                                    }
                                }
                            }
                        }
                        // $var = array($t->coatypeid,$fromdate,$todate);
                        // $spname="totalpettycash";
                        // $value=Info::callinfo($var,$spname);
                        // foreach($value as $vs){
                        // 	$amount=$vs->cash;
                        // }
                        //  if($t->inid==1){
                        $html2 = $html2 . '<tr><td style="background-color:#ffffff;">&nbsp;&nbsp;<b>' . $t->coatypename . '</b></td><td style="background-color:#ffffff;">&nbsp;&nbsp;<b>' . number_format($credit_total_head, 2, '.', '') . '</b></td></tr>';
                        // }else{
                        // $html2 = $html2.'<tr><td style="background-color:#ffffff;">&nbsp;&nbsp;<b>'.$t->coatypename.'</b></td><td></td></tr>';
                        // }
                    }
                    $coatypeid_cur = $t->coatypeid;
                    $h = '<tr><td style="background-color:#ffffff;">&nbsp;&nbsp;' . $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;">&nbsp;&nbsp;<b>Diff. in Opening Balances</b></td>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<b>' . number_format($total_credit - $total_debit, 2, '.', '') . '</b></td>
 						</tr>
 						<tr>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<b>Total</b></td>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<b>' . number_format($total_credit, 2, '.', '') . '</b></td>
 						</tr>';
        } else {
            $html5 = $html5 . '
 						<tr>
 							<td></td>
 							<td></td>
 						</tr>
 						<tr>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<b>Total</b></td>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<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;">&nbsp;&nbsp;<b>Diff. in Opening Balances</b></td>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<b>' . number_format($total_debit - $total_credit, 2, '.', '') . '</b></td>
 						</tr>
 						<tr>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<b>Total</b></td>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<b>' . number_format($total_debit, 2, '.', '') . '</b></td>
 						</tr>';
        } else {
            $html5 = $html5 . '
 						<tr>
 							<td></td>
 							<td></td>
 						</tr>
 						<tr>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<b>Total</b></td>
 							<td style="background-color:#ffffff;">&nbsp;&nbsp;<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');
    }
Esempio n. 14
0
    public function pdf(Request $request, $id, $type)
    {
        //echo $id.$type;
        $profile = Companyprofile::get();
        foreach ($profile as $com) {
            $cid = $com->id;
            $cname = $com->name;
            $address = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        if ($type == 1) {
            $var = array($id, $type);
            $spname = "voucher";
            $value = Info::callinfo($var, $spname);
            //print_r($value);
            foreach ($value as $v) {
                $vrno = $v->vrno;
                $mvno = $v->mvno;
                $amount = $v->amount;
                $bname = $v->bname;
                $branchname = $v->branchname;
                $accno = $v->accno;
                $checkno = $v->checkno;
                $vdate = $v->vdate;
                $baid = $v->baid;
                $sid = $v->sid;
                $bacode = $v->bacode;
                $scode = $v->scode;
            }
            $date = date_create($vdate);
            PDF::AddPage();
            $html1 = '
				<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Bank Payment Voucher</u></h2>
								 <table border="0" style="width:100%">
									<tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
										
										<td>Bank Name:' . $bname . '</td>
										<td></td>
										<td>Branch Name:' . $branchname . '</td>
										
									</tr>
									<tr>
										<td>A/C No.' . $accno . '</td>
										<td></td>
										<td>Check No.' . $checkno . '</td>
										
									  </tr>
									<tr>
								   
									<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
									</tr>
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
            $sname = DB::table('suppliers')->where('id', $sid)->pluck('name');
            $bname = DB::table('bankaccount')->where('id', $baid)->pluck('name');
            $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $sname . '</td>
				<td style="background-color:#ffffff;">' . $scode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $bname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $bacode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
            $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
            $html = $html1 . $html2 . $html3;
            PDF::writeHTML($html, true, false, true, false, '');
            PDF::Output('vbp.pdf');
        } else {
            if ($type == 2) {
                $var = array($id, $type);
                $spname = "voucher";
                $value = Info::callinfo($var, $spname);
                //print_r($value);
                foreach ($value as $v) {
                    $vrno = $v->vrno;
                    $mvno = $v->mvno;
                    $amount = $v->amount;
                    $sid = $v->sid;
                    $scode = $v->scode;
                    $vdate = $v->vdate;
                }
                $date = date_create($vdate);
                PDF::AddPage();
                $html1 = '
				<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
					
					<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Payment Voucher</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
										<td>Unit/Place:</td>
										<td></td>
										<td>Manual V. No.</td>
										
									</tr>
									
									<tr>
								   
									<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
									</tr>
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                $sname = DB::table('suppliers')->where('id', $sid)->pluck('name');
                $cashname = DB::table('coa')->where('id', 1)->pluck('name');
                $cashcode = DB::table('coa')->where('id', 1)->pluck('code');
                $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $sname . '</td>
				<td style="background-color:#ffffff;">' . $scode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cashname . '</td>
				<td style="background-color:#ffffff;">' . $cashcode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                $html = $html1 . $html2 . $html3;
                PDF::writeHTML($html, true, false, true, false, '');
                PDF::Output('vbpp.pdf');
            } else {
                if ($type == 3) {
                    $var = array($id, $type);
                    $spname = "voucher";
                    $value = Info::callinfo($var, $spname);
                    //print_r($value);
                    foreach ($value as $v) {
                        $vrno = $v->vrno;
                        $mvno = $v->mvno;
                        $amount = $v->amount;
                        $bname = $v->bname;
                        $branchname = $v->branchname;
                        $accno = $v->accno;
                        $checkno = $v->checkno;
                        $vdate = $v->vdate;
                        $baid = $v->baid;
                        $cid = $v->cid;
                        $bacode = $v->bacode;
                        $ccode = $v->ccode;
                    }
                    $date = date_create($vdate);
                    PDF::AddPage();
                    $html1 = '<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Bank Receive Voucher</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
										<td>Bank Name:' . $bname . '</td>
										<td></td>
										<td>Branch Name:' . $branchname . '</td>
										
									</tr>
									<tr>
										<td>A/C No.' . $accno . '</td>
										<td></td>
										<td>Check No.' . $checkno . '</td>
										
									  </tr>
									<tr>
								   
									<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
									</tr>
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                    $cname = DB::table('customers')->where('id', $cid)->pluck('name');
                    $bname = DB::table('bankaccount')->where('id', $baid)->pluck('name');
                    $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $bname . '</td>
				<td style="background-color:#ffffff;">' . $bacode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cname . '</td>
				<td style="background-color:#ffffff;">' . $ccode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                    $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                    $html = $html1 . $html2 . $html3;
                    PDF::writeHTML($html, true, false, true, false, '');
                    PDF::Output('vbp.pdf');
                } else {
                    if ($type == 4) {
                        $var = array($id, $type);
                        $spname = "voucher";
                        $value = Info::callinfo($var, $spname);
                        //print_r($value);
                        foreach ($value as $v) {
                            $vrno = $v->vrno;
                            $mvno = $v->mvno;
                            $amount = $v->amount;
                            $cid = $v->cid;
                            $ccode = $v->ccode;
                            $vdate = $v->vdate;
                        }
                        $date = date_create($vdate);
                        PDF::AddPage();
                        $html1 = ' <p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Receive Voucher</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
									
										<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
										
									</tr>
									
								
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                        $cname = DB::table('customers')->where('id', $cid)->pluck('name');
                        $cashname = DB::table('coa')->where('id', 1)->pluck('name');
                        $cashcode = DB::table('coa')->where('id', 1)->pluck('code');
                        $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cashname . '</td>
				<td style="background-color:#ffffff;">' . $cashcode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $ccode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                        $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                        $html = $html1 . $html2 . $html3;
                        PDF::writeHTML($html, true, false, true, false, '');
                        PDF::Output('vbpp.pdf');
                    } else {
                        if ($type == 5) {
                            $var = array($id, $type);
                            $spname = "voucher";
                            $value = Info::callinfo($var, $spname);
                            //print_r($value);
                            foreach ($value as $v) {
                                $vrno = $v->vrno;
                                $mvno = $v->mvno;
                                $amount = $v->amount;
                                $bname = $v->bname;
                                $baname = $v->baname;
                                $branchname = $v->branchname;
                                $checkno = $v->checkno;
                                $vdate = $v->vdate;
                                $baid = $v->baid;
                                $bacode = $v->bacode;
                            }
                            $date = date_create($vdate);
                            PDF::AddPage();
                            $html1 = '<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Contra Voucher</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
										<td>Bank Name:' . $bname . '</td>
										<td></td>
										<td>Branch Name:' . $branchname . '</td>
										
									</tr>
									<tr>
										<td>A/C No.' . $baname . '</td>
										<td></td>
										<td>Check No.' . $checkno . '</td>
										
									  </tr>
									<tr>
								   
									<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
									</tr>
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                            $cashname = DB::table('coa')->where('id', 1)->pluck('name');
                            $cashcode = DB::table('coa')->where('id', 1)->pluck('code');
                            $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cashname . '</td>
				<td style="background-color:#ffffff;">' . $cashcode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $baname . '</td>
				<td style="background-color:#ffffff;">' . $bacode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                            $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                            $html = $html1 . $html2 . $html3;
                            PDF::writeHTML($html, true, false, true, false, '');
                            PDF::Output('vbp.pdf');
                        } else {
                            if ($type == 6) {
                                $var = array($id, $type);
                                $spname = "voucher";
                                $value = Info::callinfo($var, $spname);
                                //print_r($value);
                                foreach ($value as $v) {
                                    $vrno = $v->vrno;
                                    $mvno = $v->mvno;
                                    $amount = $v->amount;
                                    $cid = $v->cid;
                                    $ccode = $v->ccode;
                                    $vdate = $v->vdate;
                                }
                                $date = date_create($vdate);
                                PDF::AddPage();
                                $html1 = '<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>bKash Voucher</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
									
										<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
										
									</tr>
									
								
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                                $cname = DB::table('customers')->where('id', $cid)->pluck('name');
                                $cashname = DB::table('coa')->where('id', 1)->pluck('name');
                                $cashcode = DB::table('coa')->where('id', 1)->pluck('code');
                                $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cashname . '</td>
				<td style="background-color:#ffffff;">' . $cashcode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $ccode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                                $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                                $html = $html1 . $html2 . $html3;
                                PDF::writeHTML($html, true, false, true, false, '');
                                PDF::Output('vbpp.pdf');
                            } else {
                                if ($type == 7) {
                                    $var = array($id, $type);
                                    $spname = "voucher";
                                    $value = Info::callinfo($var, $spname);
                                    //print_r($value);
                                    foreach ($value as $v) {
                                        $vrno = $v->vrno;
                                        $mvno = $v->mvno;
                                        $amount = $v->amount;
                                        $cid = $v->cid;
                                        $ccode = $v->ccode;
                                        $vdate = $v->vdate;
                                    }
                                    $date = date_create($vdate);
                                    PDF::AddPage();
                                    $html1 = '<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>SAP Voucher</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
									
										<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
										
									</tr>
									
								
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                                    $cname = DB::table('customers')->where('id', $cid)->pluck('name');
                                    $cashname = DB::table('coa')->where('id', 1)->pluck('name');
                                    $cashcode = DB::table('coa')->where('id', 1)->pluck('code');
                                    $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cashname . '</td>
				<td style="background-color:#ffffff;">' . $cashcode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $ccode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                                    $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                                    $html = $html1 . $html2 . $html3;
                                    PDF::writeHTML($html, true, false, true, false, '');
                                    PDF::Output('vbpp.pdf');
                                } else {
                                    if ($type == 8) {
                                        $var = array($id, $type);
                                        $spname = "voucher";
                                        $value = Info::callinfo($var, $spname);
                                        //print_r($value);
                                        foreach ($value as $v) {
                                            $vrno = $v->vrno;
                                            $mvno = $v->mvno;
                                            $amount = $v->amount;
                                            $cid = $v->cid;
                                            $ccode = $v->ccode;
                                            $vdate = $v->vdate;
                                        }
                                        $date = date_create($vdate);
                                        PDF::AddPage();
                                        $html1 = '<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>KCS Voucher</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
									
										<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
										
									</tr>
									
								
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                                        $cname = DB::table('customers')->where('id', $cid)->pluck('name');
                                        $cashname = DB::table('coa')->where('id', 1)->pluck('name');
                                        $cashcode = DB::table('coa')->where('id', 1)->pluck('code');
                                        $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cashname . '</td>
				<td style="background-color:#ffffff;">' . $cashcode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $ccode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                                        $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                                        $html = $html1 . $html2 . $html3;
                                        PDF::writeHTML($html, true, false, true, false, '');
                                        PDF::Output('vbpp.pdf');
                                    } else {
                                        if ($type == 9) {
                                            $var = array($id, $type);
                                            $spname = "voucher";
                                            $value = Info::callinfo($var, $spname);
                                            //print_r($value);
                                            foreach ($value as $v) {
                                                $vrno = $v->vrno;
                                                $mvno = $v->mvno;
                                                $amount = $v->amount;
                                                $cid = $v->cid;
                                                $ccode = $v->ccode;
                                                $vdate = $v->vdate;
                                            }
                                            $date = date_create($vdate);
                                            PDF::AddPage();
                                            $html1 = '<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>MBank Voucher</u></h2>
								 <table border="0" style="width:100%">
								 <tr>
										
										<td>Voucher No:' . $vrno . '</td>
										<td></td>
										<td>Manual V. No:' . $mvno . '</td>
										
									</tr>
									<tr>
									
										<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
										
									</tr>
									
								
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:30%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:20%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                                            $cname = DB::table('customers')->where('id', $cid)->pluck('name');
                                            $cashname = DB::table('coa')->where('id', 1)->pluck('name');
                                            $cashcode = DB::table('coa')->where('id', 1)->pluck('code');
                                            $html2 = '<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cashname . '</td>
				<td style="background-color:#ffffff;">' . $cashcode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cname . '</td>
				<td style="background-color:#ffffff;">' . $ccode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                                            $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                                            $html = $html1 . $html2 . $html3;
                                            PDF::writeHTML($html, true, false, true, false, '');
                                            PDF::Output('vbpp.pdf');
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    public function pdf(Request $request, $pid)
    {
        $profile = Companyprofile::get();
        //print_r($profile);
        foreach ($profile as $com) {
            $id = $com->id;
            $cname = $com->name;
            $address = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        $var = array($pid);
        $spname = "viewsales";
        $value = Info::callinfo($var, $spname);
        foreach ($value as $valu) {
            $id = $valu->id;
            $sailname = $valu->sname;
            $salesdate = $valu->salesdate;
            $cusname = $valu->cname;
            $phone = $valu->phone;
            $preaddress = $valu->preaddress;
        }
        //$pdate=date_create($purchasedate);
        //$sdate=date_create($suppliersbilldate);
        $spname1 = "salesdetailsview";
        $value1 = Info::callinfo($var, $spname1);
        $sum = 0;
        foreach ($value1 as $valu) {
            $a = $valu->amount;
            $sum = $sum + $a;
        }
        PDF::AddPage();
        $html1 = '
			<p></p>
					<div>
						<table>
							<tr>
								<td style="width:20%">
									<img src="uploads/' . $file . '" alt="logo" height="150";>
								</td>
								<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
								</td>
							</tr>

						</table>	
					</div><div>
					<table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
			   <th>SI No</th>
				<th>Item Name</th>
				<th>Quantity</th>
				<th>Measurement Unit</th>
				<th>Rate</th>
				<th>Amount</th>
			  </tr>';
        $html2 = '';
        $i = 1;
        $sum = 0;
        foreach ($value1 as $valu) {
            $html = '<tr><td>' . $i . '</td>
				<td style="background-color:#ffffff;">' . $valu->iname . '</td>
				<td style="background-color:#ffffff;">' . $valu->quantity . '</td>
				<td style="background-color:#ffffff;">' . $valu->mname . '</td>
				<td style="background-color:#ffffff;">' . $valu->rate . '</td>
				<td style="background-color:#ffffff;">' . $valu->amount . '</td></tr>';
            $html2 = $html2 . $html;
            $i++;
            $sum = $sum + $valu->amount;
        }
        $html3 = '<tr><td colspan="5" align="right">';
        $html4 = '';
        $html5 = 'Total:</td><td style="background-color:#ffffff;">' . number_format($sum, 2, '.', '') . '</td></tr>';
        $html6 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($sum) . ' Taka Only</h4></div>
		                  <div></div>
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
        $html = $html1 . $html2 . $html3 . $html4 . $html5 . $html6;
        PDF::writeHTML($html, true, false, true, false, '');
        PDF::Output('sales.pdf');
    }
Esempio n. 16
0
    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>
						
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<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 >&nbsp;Date</th>
				<th>Particulars</th>
				<th >&nbsp;Supplier Name</th>
				<th >&nbsp;Customer Name</th>
				<th >&nbsp;Voucher No</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Debit</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Credit</th>
				<th>&nbsp;&nbsp;Balance</th>
			  </tr>
			  <tr>
				<th style="background-color:#ffffff;">&nbsp;' . 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>&nbsp;&nbsp;' . 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;">&nbsp;' . $v->created_at . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;<a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->sname . '</a></td>
				<td style="background-color:#ffffff;">&nbsp;<a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->cname . '</a></td>
				<td style="background-color:#ffffff;">&nbsp;<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;">&nbsp;' . $v->created_at . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;<a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->sname . '</a></td>
				<td style="background-color:#ffffff;">&nbsp;<a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->cname . '</a></td>
				<td style="background-color:#ffffff;">&nbsp;<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;">&nbsp;&nbsp;</td>
					<td style="background-color:#ffffff;">&nbsp;&nbsp;' . $v->amount . '</td>
					
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;' . $v->amount . '</td>
					<td style="background-color:#ffffff;">&nbsp;&nbsp;</td>
					
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;' . $v->amount . '</td>
					<td style="background-color:#ffffff;">&nbsp;&nbsp;</td>
					
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;</td>
					<td style="background-color:#ffffff;">&nbsp;&nbsp;' . $v->amount . '</td>
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;' . $v->amount . '</td>
						<td style="background-color:#ffffff;"></td>
						<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;' . $v->amount . '</td>
						<td>&nbsp;&nbsp;' . 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>
						
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<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 >&nbsp;Date</th>
				<th>Particulars</th>
				<th >&nbsp;Supplier Name</th>
				<th >&nbsp;Customer Name</th>
				<th >&nbsp;Voucher No</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Debit</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;Credit</th>
				<th>&nbsp;&nbsp;Balance</th>
			  </tr>
			  <tr>
				<th style="background-color:#ffffff;">&nbsp;' . 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>&nbsp;&nbsp;' . 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;">&nbsp;' . $v->created_at . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;<a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->sname . '</a></td>
				<td style="background-color:#ffffff;">&nbsp;<a href="http://192.168.1.8/IMS/contravoucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->cname . '</a></td>
				<td style="background-color:#ffffff;">&nbsp;<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;">&nbsp;' . $v->created_at . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;<a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->sname . '</a></td>
				<td style="background-color:#ffffff;">&nbsp;<a href="http://192.168.1.8/IMS/voucher/pdf/' . $v->vid . '/' . $v->type . '">' . $v->cname . '</a></td>
				<td style="background-color:#ffffff;">&nbsp;<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;">&nbsp;&nbsp;</td>
					<td style="background-color:#ffffff;">&nbsp;&nbsp;' . $v->amount . '</td>
					
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;' . $v->amount . '</td>
					<td style="background-color:#ffffff;">&nbsp;&nbsp;</td>
					
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;' . $v->amount . '</td>
					<td style="background-color:#ffffff;">&nbsp;&nbsp;</td>
					
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;</td>
					<td style="background-color:#ffffff;">&nbsp;&nbsp;' . $v->amount . '</td>
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;' . $v->amount . '</td>
					<td style="background-color:#ffffff;"></td>
					<td>&nbsp;&nbsp;' . 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;">&nbsp;&nbsp;' . number_format($credit, 2, '.', '') . '</td>
				<td    style="background-color:#ffffff;">&nbsp;&nbsp;' . 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');
            }
        }
    }
Esempio n. 17
0
    public function pdf(Request $request, $id, $type, $status)
    {
        //echo $id.$type.$status;
        $voucher = DB::table('voucher')->where('id', $id)->first();
        //print_r($voucher);
        $vnno = $voucher->vnno;
        $amount = $voucher->amount;
        $sid = $voucher->sid;
        $cid = $voucher->cid;
        $type = $voucher->type;
        $vdate = $voucher->vdate;
        //echo '<br>';
        $vouchercontra = DB::table('vouchercontra')->where('vid', $voucher->id)->first();
        //print_r($vouchercontra);
        $vid = $vouchercontra->vid;
        $baccid = $vouchercontra->baccid;
        $checkno = $vouchercontra->checkno;
        $cashid = $vouchercontra->cashid;
        $profile = Companyprofile::get();
        foreach ($profile as $com) {
            $cid = $com->id;
            $cname = $com->name;
            $address = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        if ($status == 1) {
            $date = date_create($vdate);
            PDF::AddPage();
            $bname = DB::table('bankinfo')->where('id', $baccid)->first();
            $brancename = DB::table('bankaccount')->where('id', $baccid)->first();
            $html1 = '
				<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Cash Contra</u></h2>
								 <table border="0" style="width:100%">
									<tr>
										
										<td>Voucher No:' . $vnno . '</td>
										<td></td>
										<td>Manual V. No:' . $type . '</td>
										
									</tr>
									<tr>
										
										<td>Bank Name:</td>
										<td></td>
										<td>Branch Name:' . $brancename->branchname . '</td>
										
									</tr>
									<tr>
										<td>A/C No.' . $brancename->name . '</td>
										<td></td>
										<td>Check No.' . $checkno . '</td>
										
									  </tr>
									<tr>
								   
									<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
									</tr>
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:35%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:15%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
            $bname = DB::table('bankaccount')->where('id', $baccid)->pluck('name');
            $coa = DB::table('coa')->where('id', 1)->first();
            $bcode = DB::table('bankaccount')->where('id', $baccid)->pluck('code');
            $html2 = '
			<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $coa->name . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $coa->code . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $bname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $bcode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
		
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
            $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						
						<div style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
            $html = $html1 . $html2 . $html3;
            PDF::writeHTML($html, true, false, true, false, '');
            PDF::Output('contravouchar.pdf');
        } else {
            if ($status == 2) {
                $date = date_create($vdate);
                PDF::AddPage();
                $bname = DB::table('bankinfo')->where('id', $baccid)->first();
                $brancename = DB::table('bankaccount')->where('id', $baccid)->first();
                $html1 = '
				<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Bank Contra</u></h2>
								 <table border="0" style="width:100%">
									<tr>
										
										<td>Voucher No:' . $vnno . '</td>
										<td></td>
										<td>Manual V. No:' . $type . '</td>
										
									</tr>
									<tr>
										
										<td>Bank Name:</td>
										<td></td>
										<td>Branch Name:' . $brancename->branchname . '</td>
										
									</tr>
									<tr>
										<td>A/C No.' . $brancename->name . '</td>
										<td></td>
										<td>Check No.' . $checkno . '</td>
										
									  </tr>
									<tr>
								   
									<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
									</tr>
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:35%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:15%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                $bname = DB::table('bankaccount')->where('id', $baccid)->pluck('name');
                $coa = DB::table('coa')->where('id', 1)->first();
                $bcode = DB::table('bankaccount')->where('id', $baccid)->pluck('code');
                $html2 = '
			<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $bname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $bcode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $coa->name . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $coa->code . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
		
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                $html = $html1 . $html2 . $html3;
                PDF::writeHTML($html, true, false, true, false, '');
                PDF::Output('contravouchar.pdf');
            } else {
                if ($status == 3) {
                    $date = date_create($vdate);
                    PDF::AddPage();
                    $bname = DB::table('bankinfo')->where('id', $baccid)->first();
                    $brancename = DB::table('bankaccount')->where('id', $baccid)->first();
                    $html1 = '
				<p></p>
				<div>
					<table>
						<tr>
							<td style="width:20%">
								<img src="uploads/' . $file . '" alt="logo" height="150";>
							</td>
							<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
							</td>
						</tr>

					</table>	
				</div>
				<div>
					             <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Bank To Bank Contra</u></h2>
								 <table border="0" style="width:100%">
									<tr>
										
										<td>Voucher No:' . $vnno . '</td>
										<td></td>
										<td>Manual V. No:' . $type . '</td>
										
									</tr>
									
									
									<tr>
								   
									<td>Month:' . date_format($date, " F,Y") . '</td>
										<td></td>
										<td>Date:' . $vdate . '</td>
									</tr>
								</table> 
							</div>
					
					
			
			
				
		
		  <div> </div>
		  <table border="1 solid" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th style="width:10%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SL</th>
				<th style="width:35%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Head of Accounts</th>
				<th style="width:15%">&nbsp;&nbsp;&nbsp;&nbsp;A/C Code</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;DR(BDT)</th>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;CR(BDT)</th>
			  </tr>';
                    $bname = DB::table('bankaccount')->where('id', $baccid)->pluck('name');
                    $cash = DB::table('bankaccount')->where('id', $cashid)->pluck('name');
                    $ccode = DB::table('bankaccount')->where('id', $cashid)->pluck('code');
                    $bcode = DB::table('bankaccount')->where('id', $baccid)->pluck('code');
                    $html2 = '
			<tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $bname . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $bcode . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;"></td>
			  </tr>
			  <tr>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $cash . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $ccode . '</td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>
		
			   <tr>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;"></td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total:</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
				<td style="background-color:#ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;' . $amount . '</td>
			  </tr>';
                    $html3 = '</table><h4>Amount in word:' . CommonController::convertNumberToWord($amount) . ' Taka Only</h4></div>
						<div></div>
					<div></div><div></div>
						<div class="col-md-12"  style=" background-color: #ffffff;color:#000000;">
						<h3>&nbsp;&nbsp;&nbsp; Received By
		                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												
						  Prepared By
						  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						


						Approved By
						  </h3>
						
						
							
						</div>';
                    $html = $html1 . $html2 . $html3;
                    PDF::writeHTML($html, true, false, true, false, '');
                    PDF::Output('contravouchar.pdf');
                }
            }
        }
    }
Esempio n. 18
0
    public function fromtoday(Request $request)
    {
        $profile = Companyprofile::get();
        foreach ($profile as $com) {
            $cid = $com->id;
            $cname = $com->name;
            $address = $com->address;
            $tele = $com->telephone;
            $mobile = $com->mobile;
            $email = $com->email;
            $url = $com->url;
            $file = $com->file;
        }
        $fromdate = CommonController::date_format($request->input('fromdate'));
        $todate = CommonController::date_format($request->input('todate'));
        $var = array($fromdate, $todate);
        // $var = array($fromdate,$todate);
        $spname = "rptcash";
        $value = Info::callinfo($var, $spname);
        //print_r($value);
        //die();
        foreach ($value as $valu) {
            $id = $valu->id;
            $amount = $valu->amount;
        }
        //print_r($value);die();
        $var1 = array($fromdate);
        //print_r($var1);die();
        $spname1 = "totalcashcollection";
        $value1 = Info::callinfo($var1, $spname1);
        //print_r($value1);die();
        foreach ($value1 as $valu) {
            //$id=$valu->id;
            $opening_balance = $valu->cash;
        }
        $fdate = date_create($fromdate);
        $tdate = date_create($todate);
        $coa = DB::table('coa')->where('id', 1)->first();
        $coabalance = $coa->openbalance;
        //echo $coabalance;
        $openbalance = $opening_balance + $coabalance;
        PDF::AddPage('A4');
        $html1 = '
			
			<p></p>
					<div>
						<table>
							<tr>
								<td style="width:20%">
									<img src="uploads/' . $file . '" alt="logo" height="150";>
								</td>
								<td style="width:85% font-size:30%">
								<h2>' . $cname . '</h2>
								
								' . $address . '
									<br>Tel:' . $tele . ',Mobile:' . $mobile . '
									<br>E-mail:' . $email . '
									<br>' . $url . '
								 
								</td>
							</tr>

						</table>	
					</div>
			

<div>

<h3>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u>Cash A/C Book</h3></u></div>
<div><strong>From&nbsp;' . date_format($fdate, "d-M-Y") . '&nbsp;To&nbsp;' . date_format($tdate, "d-M-Y") . ' </strong></div></div>
<table border="1" style="background-color:lightblue; width:100%; padding:20px;">	
			  <tr>
				<th>&nbsp;&nbsp;&nbsp;&nbsp;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;">&nbsp;&nbsp;&nbsp;&nbsp;' . $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');
    }