Merge pull request 'price paid by customer and purchase history' (#9) from paulcortezl5 into main

Reviewed-on: #9
pull/10/head
paul 1 year ago
commit fe4abb0936

@ -160,6 +160,7 @@
<th>Category</th>
<th>Model No.</th>
<th>Price</th>
<th>Purchase Price</th>
<th>Transaction Type</th>
<th>Date</th>
</thead>
@ -285,7 +286,8 @@
"<td>"+data.invoiceNum+"</td>" +
"<td>"+data.catCode+"</td>" +
"<td>"+data.modelno+"</td>" +
"<td>"+data.price+"</td>" +
"<td>"+data.price+"</td>" +
"<td>"+(parseFloat(data.cash) + parseFloat(data.dollar) + parseFloat(data.creditCard) + parseFloat(data.checque))+"</td>" +
"<td>"+data.transType+"</td>" +
"<td>"+data.transDate+"</td>" +
"</tr>";

@ -236,6 +236,31 @@
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<label for="dtCustomerPurchaseList">Customer Purchase History</label>
<div class="table-responsive">
<table id="dtCustomerPurchaseList" class="table table-bordered table-striped">
<thead>
<th>No</th>
<th>Record ID</th>
<th>Transaction ID</th>
<th>Branch</th>
<th>Invoice</th>
<th>Category</th>
<th>Model No.</th>
<th>Price</th>
<th>Purchase Price</th>
<th>Transaction Type</th>
<th>Date</th>
</thead>
<tbody id="dtCustomerPurchaseListBody">
<tr><td colspan="10">No data</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
@ -466,6 +491,42 @@
$("#txtCustomer").val($(customer).data("customername"));
$("#txtCustomerName").val($(customer).data("customername"));
$("#mdlCustomer").modal('hide');
$("#dtCustomerPurchaseListBody").html('<tr><td colspan="10">Loading data. Please wait.</td></tr>');
var dtCustomerPurchaseListBodyHtml = "";
$.get("/salesCustomerSearch", {s:$(customer).data("customerid")}, function(data){
if(data["success"])
{
var i = 1;
data["data"].forEach(function(data)
{
dtCustomerPurchaseListBodyHtml += "<tr>" +
"<td>"+i+"</td>" +
"<td>"+data.recordID+"</td>" +
"<td>"+data.transID+"</td>" +
"<td>"+data.brCode+"</td>" +
"<td>"+data.invoiceNum+"</td>" +
"<td>"+data.catCode+"</td>" +
"<td>"+data.modelno+"</td>" +
"<td>"+data.price+"</td>" +
"<td>"+(parseFloat(data.cash) + parseFloat(data.dollar) + parseFloat(data.creditCard) + parseFloat(data.checque))+"</td>" +
"<td>"+data.transType+"</td>" +
"<td>"+data.transDate+"</td>" +
"</tr>";
i++;
});
$("#dtCustomerPurchaseListBody").html(dtCustomerPurchaseListBodyHtml);
}
else
{
$("#dtCustomerPurchaseListBody").html('<tr><td colspan="10">No purchase record.</td></tr>');
}
}, "json");
}
function errorMessage(msg)

Loading…
Cancel
Save