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>";
     }
 }
Exemplo n.º 2
0
                                    <th>Cheque No</th>
                                    <th>Cheque Date</th>
                                    <th>Amount</th>
                                    <th>Received by</th>
                                    <th>Status</th>
                                    <th>Action</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php 
$slNo = 1;
?>
                                @foreach($purchaseregister as $reg)
                                    <?php 
if ($reg->type == 'Payment') {
    $sale = \App\PurchaseInvoice::where('invoice_id', '=', $reg->invoice_id)->first();
    $partyname = \App\Party::find($sale->party_id);
} else {
    $sale = \App\Expense::where('invoice_id', '=', $reg->invoice_id)->first();
}
$time = strtotime($reg->cheque_date);
$newformat = date('d', $time);
$today = date('d', time());
?>
                                    <tr>
                                        <td <?php 
if ($newformat >= $today - 2 && $newformat <= $today + 2) {
    echo "class='blink'";
}
?>
>{{$slNo}}</td>
Exemplo n.º 3
0
                </td>
            </tr>
        </table>


        <table class="col-md-12"  style="width: 100%;" >
            <tr style="border:1px solid black; background: url('../../assets/img/lightBlueBackground.jpg');">
                <td colspan="2">Received from:
                    @if($transaction->type == "Receive")
                        <?php 
$sales = \App\Sale::where('invoice_id', '=', $transaction->invoice_id)->first();
?>
                        {{$sales->party->name}}
                    @elseif($transaction->type == "Payment")
                        <?php 
$sales = \App\PurchaseInvoice::where('invoice_id', '=', $transaction->invoice_id)->first();
?>
                        {{$sales->party->name}}
                    @endif
                </td>
                <td style="border:1px solid black;" class="text-center">
                    Amount
                </td>
            </tr>
            <tr style="border:1px solid black;">
                <td colspan="2">
                    Being: {{$transaction->remarks}}<br>
                    Payment Mode: <?php 
if ($transaction->payment_method == 'Check') {
    echo 'Cheque';
} else {
 public function getDel($id)
 {
     $del = PurchaseInvoice::where('invoice_id', '=', $id)->get();
     try {
         $del[0]->deletee();
         Session::flash('message', 'Purchase Invoice has been Successfully Deleted.');
     } catch (Exception $e) {
         Session::flash('message', 'This Purchase Invoice can\'t delete because it  is used to file');
     }
     return Redirect::to('purchases/index');
 }