Resolve "Add inventory column to Job Order Details Report" #1684

Merged
korina.cordero merged 4 commits from 759-add-inventory-column-to-job-order-details-report into 746-resq-2-0-final 2023-09-05 20:00:37 +00:00
4 changed files with 40 additions and 2 deletions

View file

@ -813,6 +813,7 @@ class ReportController extends Controller
'Plate Number',
'SKU',
'Serial Number',
'Inventory',
'Invoice/DR No.',
'Existing Battery',
'Rider Name',
@ -1932,6 +1933,9 @@ class ReportController extends Controller
$fac_hub_coord_lat = $fac_hub->getCoordinates()->getLatitude();
}
// get inventory count
$inventory = $jo->getInventoryCount();
// find date and time when JO was assigned a hub
$datetime_hub_assign_jo = '';
$date_hub_assign_jo = '';
@ -2254,6 +2258,7 @@ class ReportController extends Controller
$plate_number,
$sku,
$serial,
$inventory,
$jo->getORName(),
$existing_batt,
$rider_name,

View file

@ -429,6 +429,12 @@ class JobOrder
*/
protected $cust_location;
// inventory count of hub at time of hub assignment
/**
* @ORM\Column(type="smallint")
*/
protected $inventory_count;
public function __construct()
{
$this->date_create = new DateTime();
@ -453,6 +459,8 @@ class JobOrder
$this->phone_mobile = '';
$this->will_wait = WillingToWaitContent::WILLING_TO_WAIT;
$this->inventory_count = 0;
}
public function getID()
@ -1217,4 +1225,16 @@ class JobOrder
{
return $this->cust_location;
}
public function setInventoryCount($inventory_count)
{
$this->inventory_count = $inventory_count;
return $this;
}
public function getInventoryCount()
{
return $this->inventory_count;
}
}

View file

@ -1009,7 +1009,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setCallerClassification($caller_class)
->setEmergencyType($etype)
->setOwnershipType($owner_type)
->setCustomerLocation($cust_location);
->setCustomerLocation($cust_location)
->setInventoryCount($req->request->get('hub_inv_count', 0));
// validate
$errors = $this->validator->validate($obj);
@ -1641,6 +1642,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setEmergencyType($etype)
->setOwnershipType($owner_type)
->setCustomerLocation($cust_location)
->setInventoryCount($req->request->get('hub_inv_count', 0))
->clearRider();
if ($user != null)

View file

@ -794,7 +794,7 @@
</tr>
{% for hub in hubs %}
<tr data-lat="{{ hub.hub.getCoordinates.getLatitude }}" data-lng="{{ hub.hub.getCoordinates.getLongitude }}" data-id="{{ hub.hub.getID }}"{{ obj.getHub and obj.getHub.getID == hub.hub.getID ? ' class="m-table__row--primary"' }}>
<tr data-lat="{{ hub.hub.getCoordinates.getLatitude }}" data-lng="{{ hub.hub.getCoordinates.getLongitude }}" data-id="{{ hub.hub.getID }}" data-invcount={{ hub.inventory }}{{ obj.getHub and obj.getHub.getID == hub.hub.getID ? ' class="m-table__row--primary"' }}>
<td>{{ hub.hub.getName }}</td>
<td>{{ hub.hub.getBranch }}</td>
<!--<td class="text-right">{{ hub.distance ? hub.distance : '-' }}</td>
@ -1377,6 +1377,9 @@ $(function() {
{% if mode in ['update-processing', 'update-reassign-hub'] %}
// add selected hub to data
fields['hub'] = selectedHub;
// add inventory count of selected hub to data
fields['hub_inv_count'] = selectedHubInvCount;
{% endif %}
{% if mode in ['update-assigning', 'update-reassign-rider'] %}
@ -1840,11 +1843,13 @@ $(function() {
{% if mode in ['update-processing', 'update-reassign-hub'] %}
var selectedHub = '{{ obj.getHub ? obj.getHub.getID : "" }}';
var selectedHubInvCount = 0;
$("#hubs-table tbody tr").click(function() {
var id = $(this).data('id');
var lat = $(this).data('lat');
var lng = $(this).data('lng');
var inv_count = $(this).data('invcount');
if (id != selectedHub) {
// highlight this row, set hub value
@ -1855,6 +1860,9 @@ $(function() {
// set value
selectedHub = id;
// set value for inventory count
selectedHubInvCount = inv_count;
// center the map
osm_hmap.flyTo(L.latLng(lat, lng));
} else {
@ -1863,6 +1871,9 @@ $(function() {
// remove id value
selectedHub = '';
// reset inventory count
selectedHubInvCount = 0;
}
});
{% endif %}