public function getPurchaseInvoiceDropDown() { $purchaseInvoices = $this->getPurchasesInvoice(); $array = array(); foreach ($purchaseInvoices as $invoice) { $purchaseDetail = PurchaseInvoiceDetail::where('detail_invoice_id', '=', $invoice->invoice_id)->first(); if ($purchaseDetail) { $array[$invoice->invoice_id] = $invoice->invoice_id; } } return $array; }
public function getPartydue($party_id) { $partySales = PurchaseInvoice::where('party_id', '=', $party_id)->where('status', '!=', 'Completed')->get(); if (count($partySales) > 0) { $totalAmount = 0; $totalPrice = 0; foreach ($partySales as $sale) { $saleDetails = PurchaseInvoiceDetail::where('detail_invoice_id', '=', $sale->invoice_id)->get(); $transactions = Transaction::where('invoice_id', '=', $sale->invoice_id)->where('payment_method', '=', 'Check')->where('type', '=', 'Payment')->where('cheque_status', '=', 1)->get(); foreach ($saleDetails as $saleDetail) { $totalPrice = $totalPrice + $saleDetail->price * $saleDetail->quantity; } foreach ($transactions as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } $transactions2 = Transaction::where('invoice_id', '=', $sale->invoice_id)->where('type', '=', 'Payment')->where('payment_method', '!=', 'Check')->get(); foreach ($transactions2 as $transaction) { $totalAmount = $totalAmount + $transaction->amount; } } $due = $totalPrice - $totalAmount; echo "<p3 style='color: red;font-size: 114%; margin-left: 32px;'>Due is {$due}</p3>"; } else { echo "<p3 style='color: blue;font-size: 114%; margin-left: 32px; '>No Due</p3>"; } }
public function getDeletepurchasedetail($id) { $purchaseDetail = PurchaseInvoiceDetail::find($id); $purchaseDetail->delete(); Session::flash('message', 'Purchase Detail Successfully Deleted'); return Redirect::to('purchases/index'); }
<tr> <th>SL</th> <th>Invoice Id</th> <th>Party</th> <th>Status</th> <th>Created By</th> <th>Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($purchases as $purchase ) <?php $hasDetails = \App\PurchaseInvoiceDetail::where('detail_invoice_id', '=', $purchase->invoice_id)->get(); ?> @if(count($hasDetails) > 0) <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$purchase->invoice_id}}</td> <td>{{$purchase->party->name}}</td> @if($purchase->status == 'Activate') <td><span class="label label-sm label-danger">Due</span></td> @elseif($purchase->status == 'Partial') <td><span class="label label-sm label-warning">Partial</span></td> @elseif($purchase->status == 'Completed') <td><span class="label label-sm label-success">Completed</span></td>