Update on dashboard

Provide view for last ordered qty of item
pull/10/head
paulcortez 1 year ago
parent 3048633841
commit 424c098780

@ -1328,6 +1328,7 @@ class Pages extends CI_controller
$this->load->model("BranchItemLedger"); $this->load->model("BranchItemLedger");
$this->load->model("ItemLedger"); $this->load->model("ItemLedger");
$this->load->model("ItemInquiryLog"); $this->load->model("ItemInquiryLog");
$this->load->model("StockReceivingView");
$result = $this->Items->getItemInfoByModelNo($this->input->post("modelno")); $result = $this->Items->getItemInfoByModelNo($this->input->post("modelno"));
$row = $result->row(); $row = $result->row();
@ -1337,6 +1338,9 @@ class Pages extends CI_controller
$resultKWH = $this->ItemLedger->getItemLedgerOfKWHByItemcode($row->itemcode); $resultKWH = $this->ItemLedger->getItemLedgerOfKWHByItemcode($row->itemcode);
$kwhRow = $resultKWH->row(); $kwhRow = $resultKWH->row();
$resultKWHStockReceived = $this->StockReceivingView->getDtlDataByItemcode($row->itemcode);
$kwhStockReceivedRow = $resultKWHStockReceived->row();
// Log searched item // Log searched item
$this->ItemInquiryLog->itemcode = $row->itemcode; $this->ItemInquiryLog->itemcode = $row->itemcode;
$this->ItemInquiryLog->modelno = $row->modelno; $this->ItemInquiryLog->modelno = $row->modelno;
@ -1355,7 +1359,7 @@ class Pages extends CI_controller
} }
if($result->num_rows() > 0) if($result->num_rows() > 0)
echo json_encode(array("success"=>true, "data" => $row, "htmlTable" => $htmlTable, "KWHData" => $kwhRow)); echo json_encode(array("success"=>true, "data" => $row, "htmlTable" => $htmlTable, "KWHData" => $kwhRow, "KWHStockReceived" => $kwhStockReceivedRow));
else else
echo json_encode(array("success"=>false, "data" => "No Record")); echo json_encode(array("success"=>false, "data" => "No Record"));
} }

@ -0,0 +1,22 @@
<?php
class StockReceivingView extends CI_Model
{
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function getHdrDataByTransID($transID)
{
return $this->db->get_where("stockreceivinghdr", array("transid"=>$transID))->order_by("transid", "DESC");
}
public function getDtlDataByItemcode($itemcode)
{
return $this->db->get_where("stockreceivingdtl", array("itemcode"=>$itemcode));
}
}

@ -325,7 +325,7 @@
' </div><!-- /.box -->'; ' </div><!-- /.box -->';
} }
function showIteminquiredInformation(data, htmlTable, KWHData) function showIteminquiredInformation(data, htmlTable, KWHData, KWHStockReceived)
{ {
return '<div class="box">' + return '<div class="box">' +
' <div class="box-header with-border">' + ' <div class="box-header with-border">' +
@ -363,7 +363,7 @@
' </table>' + ' </table>' +
' </div>' + ' </div>' +
' </div>' + ' </div>' +
' <p>Beginning Quantity in Warehouse: ' + ((Number(KWHData["beginningqty"]) === 0) ? KWHData["inqty"] : KWHData["beginningqty"]) + '</p>' + ' <p>Beginning quantity: ' + KWHStockReceived["qty"] + '</p>' +
' <h3>Quantity Remaining in Warehouse: ' + KWHData["endingqty"] + '</h3>' + ' <h3>Quantity Remaining in Warehouse: ' + KWHData["endingqty"] + '</h3>' +
' </div>' + ' </div>' +
' </div>'; ' </div>';
@ -400,7 +400,7 @@
modelno: $("#txtModelNoInquiry").val() modelno: $("#txtModelNoInquiry").val()
}, function(data) { }, function(data) {
if (data["success"] == true) { if (data["success"] == true) {
$("#resultContainerStoreInquiry").prepend(showIteminquiredInformation(data["data"], data["htmlTable"], data["KWHData"])); $("#resultContainerStoreInquiry").prepend(showIteminquiredInformation(data["data"], data["htmlTable"], data["KWHData"], data["KWHStockReceived"]));
} else { } else {
$("#resultContainerStoreInquiry").prepend(errorMessage(data["data"])); $("#resultContainerStoreInquiry").prepend(errorMessage(data["data"]));
} }

Loading…
Cancel
Save