Fixed a logical error in itemwise_report_with_payment_method
This commit is contained in:
parent
f36d3fbd1e
commit
f30d6db2b7
@ -618,12 +618,16 @@ public function itemwise_report_data_with_payment_method($f_date = null, $t_date
|
||||
COUNT(invoiceitems.product) AS item_count,
|
||||
SUM(invoiceitems.quantity * invoiceitems.unit_price) AS total_cost,
|
||||
invoice.payment_method,
|
||||
DATE_FORMAT(books.publication_date, "%d-%m-%Y") AS book_publication_date');
|
||||
DATE_FORMAT(invoice.invoice_date, "%d-%m-%Y") AS invoice_date');
|
||||
$builder->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left');
|
||||
$builder->join('books', 'books.book_id = invoiceitems.product', 'left');
|
||||
$builder->where('invoice.isactive', 1);
|
||||
$builder->where('invoice.invoice_type', 1);
|
||||
$builder->where('books.isactive', 1);
|
||||
if ($f_date !== null && $t_date !== null) {
|
||||
$builder->where('invoice_date >=', $f_date)
|
||||
->where('invoice_date <=', $t_date);
|
||||
}
|
||||
$builder->groupBy(['books.publishers_code', 'books.title', 'invoice.payment_method']);
|
||||
|
||||
$query = $builder->get();
|
||||
@ -656,7 +660,7 @@ public function itemwise_report_data_with_payment_method($f_date = null, $t_date
|
||||
'book_name' => $row['book_name'],
|
||||
'item_count' => $row['item_count'],
|
||||
'total_cost' => $row['total_cost'],
|
||||
'book_publication_date' => $row['book_publication_date'],
|
||||
'invoice_date' => $row['invoice_date'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<th><b>Item Count</b></th>
|
||||
<th><b>Total Cost</b></th>
|
||||
<th><b>Payment method</b></th>
|
||||
<th><b>Published Date</b></th>
|
||||
<th><b>Invoice Date</b></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -50,7 +50,7 @@
|
||||
<td><?= $book->item_count ?></td>
|
||||
<td><?= number_format($book->total_cost, 2) ?></td>
|
||||
<td><?= $row->payment_method ?></td>
|
||||
<td><?= $book->book_publication_date ?></td>
|
||||
<td><?= $book->invoice_date ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user