-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions-inv.php
706 lines (605 loc) · 28 KB
/
functions-inv.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
<?php
/* Change Description of Inventory */
function change_description_of_inventory($mySforceConnection, $id, $descr){
$records[0] = new SObject();
$records[0]->Id = $id;
$records[0]->fields = array(
'TrackIT__Description__c' => $descr,
);
$records[0]->type = 'TrackIT__Inventory__c';
$response = $mySforceConnection->update($records);
}
/**
*
*/
function change_quantity_location_of_inventory($mySforceConnection, $inv_id, $location_id, $quant, $restock, $optimal, $max_quant ){
// get TrackIT__Inv_Location__c.Id
$query = "SELECT Id FROM TrackIT__Inv_Location__c WHERE TrackIT__Inventory__c='" . $inv_id . "' AND TrackIT__Location__c='" . $location_id . "'";
$response = $mySforceConnection->query($query);
foreach ($response as $loi_record) {
$sObject = new SObject($loi_record);
}
//update new quant
$records[0] = new SObject();
$records[0]->Id = $sObject->Id;
$records[0]->fields = array(
'TrackIT__Quantity__c' => $quant,
'Restock_Point__c' => $restock,
'Optimal_Quantity__c' => $optimal,
'Max_Storage_Capacity__c' => $max_quant,
);
$records[0]->type = 'TrackIT__Inv_Location__c';
$response = $mySforceConnection->update($records);
}
/**
*
*/
function deduct_inv_from_location($mySforceConnection, $inv_id, $location_id, $job_id, $quant){
$records = array();
$records[0] = new SObject();
$records[0]->fields = array(
'Inventory__c' => $inv_id,
'Location__c' => $location_id,
'Job__c' => $job_id,
'Quantity_Used__c' => $quant
);
$records[0]->type = 'Job_Inventory_Consumption__c';
$response = $mySforceConnection->create($records);
}
/**
*
*/
function keep_inv_location($mySforceConnection, $loi_id){
$records[0] = new SObject();
$records[0]->Id = $loi_id;
$records[0]->fields = array(
'Temporary_Location__c' => 'false'
);
$records[0]->type = 'TrackIT__Inv_Location__c';
$response = $mySforceConnection->update($records);
}
/**
*
*/
function unassign_inv_location($mySforceConnection, $loi_id){
$ids = array($loi_id);
$response = $mySforceConnection->delete($ids);
}
/**
*
*/
function assign_inv_location($mySforceConnection, $inv_id, $assign_id, $quant, $restock, $optimal, $max){
$records = array();
$records[0] = new SObject();
$records[0]->fields = array(
'TrackIT__Inventory__c' => $inv_id,
'TrackIT__Location__c' => $assign_id,
'TrackIT__Quantity__c' => $quant,
'Restock_Point__c' => $restock,
'Optimal_Quantity__c' => $optimal,
'Max_Storage_Capacity__c' => $max
);
$records[0]->type = 'TrackIT__Inv_Location__c';
$response = $mySforceConnection->create($records);
}
/**
*
*/
function temp_move_inv_location($mySforceConnection, $inv_id, $assign_id, $quant){
$records = array();
$records[0] = new SObject();
$records[0]->fields = array(
'TrackIT__Inventory__c' => $inv_id,
'TrackIT__Location__c' => $assign_id,
'TrackIT__Quantity__c' => $quant,
'Restock_Point__c' => 0,
'Optimal_Quantity__c' => 0,
'Max_Storage_Capacity__c' => 0,
'Temporary_Location__c' => 'true'
);
$records[0]->type = 'TrackIT__Inv_Location__c';
$response = $mySforceConnection->create($records);
}
/**
*
*/
function nonassigned_inv_locations($mySforceConnection, $inv_id){
//get locations it is assigned to
$query_assignedlocations = "SELECT Id, TrackIT__Location__r.Id, TrackIT__Location__r.Name
FROM TrackIT__Inv_Location__c
WHERE TrackIT__Inventory__c = '" . $inv_id . "'
AND isDeleted = false";
$response_assignedlocations = $mySforceConnection->query($query_assignedlocations);
$array_assignedlocations = array();
foreach ($response_assignedlocations as $record_assignedlocations) {
if(!is_null($record_assignedlocations)){
$sObject_assignedlocations = new SObject($record_assignedlocations);
array_push($array_assignedlocations, $sObject_assignedlocations->fields->TrackIT__Location__r->Id);
}
}
//get all locations
$query_all = "SELECT Id, Name from TrackIT__Location__c ORDER BY Name DESC";
$response_all = $mySforceConnection->query($query_all);
$arrayLocations = [];
foreach ($response_all as $record_all) {
$sObject_all = new SObject($record_all);
$arrayLocations[$sObject_all->Id] = $sObject_all->fields->Name;
}
//print_r($array_assignedlocations);
//return options of locations not assigned
echo "<option value='0'>Assign to A Location:</option>";
foreach($arrayLocations as $id=>$name){
if(!in_array($id, $array_assignedlocations)){
echo "<option value='$id'>$name</option>";
}
}
//return $options;
}
/**
*
*/
function get_locations_assigned_inv($mySforceConnection, $inv_id, $location_id){
$query = "SELECT Id, Name, TrackIT__Location__r.Name, TrackIT__Location__r.Id, TrackIT__Quantity__c
FROM TrackIT__Inv_Location__c
WHERE TrackIT__Inventory__r.Id = '" . $inv_id . "'
AND isDeleted = false
AND TrackIT__Location__r.Id != '" . $location_id . "'
";
$response = $mySforceConnection->query($query);
echo "<option value='0'>Choose Location to Move To:</option>";
foreach ($response as $record) {
$loi = new SObject($record);
$location_r = new SObject($loi->fields->TrackIT__Location__r);
if($location_id != $location_r->Id){
?>
<option value='<?php echo $loi->Id; ?>' data-quant='<?php echo $loi->fields->TrackIT__Quantity__c; ?>'>
<?php echo $location_r->fields->Name; ?>
</option>
<?php
}
}
}
/**
*
*/
function move_inv($mySforceConnection, $inv_id, $quant, $orig_loc_id, $orig_quant, $new_loc_id, $to_quant){
$new_to_quant = $to_quant + $quant;
$new_from_quant = $orig_quant - $quant;
bdump($new_to_quant."|".$new_from_quant."|".$orig_loc_id."|".$new_loc_id);
$from_records[0] = new SObject();
$from_records[0]->Id = $orig_loc_id;
$from_records[0]->fields = array(
'TrackIT__Quantity__c' => $new_from_quant
);
$from_records[0]->type = 'TrackIT__Inv_Location__c';
$from_response = $mySforceConnection->update($from_records);
$to_records[0] = new SObject();
$to_records[0]->Id = $new_loc_id;
$to_records[0]->fields = array(
'TrackIT__Quantity__c' => $new_to_quant
);
$to_records[0]->type = 'TrackIT__Inv_Location__c';
$to_response = $mySforceConnection->update($to_records);
}
/**
*
*/
function move_restock($mySforceConnection, $inv_id, $from_loid, $to_loid, $quant_restock, $curr_to_quant, $curr_from_quant){
$new_to_quant = $curr_to_quant + $quant_restock;
$new_from_quant = $curr_from_quant - $quant_restock;
$from_records[0] = new SObject();
$from_records[0]->Id = $from_loid;
$from_records[0]->fields = array(
'TrackIT__Quantity__c' => $new_from_quant
);
$from_records[0]->type = 'TrackIT__Inv_Location__c';
$from_response = $mySforceConnection->update($from_records);
$to_records[0] = new SObject();
$to_records[0]->Id = $to_loid;
$to_records[0]->fields = array(
'TrackIT__Quantity__c' => $new_to_quant
);
$to_records[0]->type = 'TrackIT__Inv_Location__c';
$to_response = $mySforceConnection->update($to_records);
}
/**
*
*/
function restock_from($mySforceConnection, $inv_id, $loc_id, $this_loi_id){
$query = "SELECT Id, TrackIT__Location__r.Name, TrackIT__Location__r.Id, TrackIT__Quantity__c
FROM TrackIT__Inv_Location__c
WHERE TrackIT__Inventory__r.Id = '" . $inv_id . "'
AND TrackIT__Location__r.Id != '" . $loc_id . "'
AND TrackIT__Quantity__c > 0
AND isDeleted = false
";
$response = $mySforceConnection->query($query);
foreach ($response as $record) {
$loi = new SObject($record);
$loc_r = new SObject($loi->fields->TrackIT__Location__r);
echo "<a href='#'
class='btn_restockFrom blue_button hide_restockFrom'
data-inv_id='" . $inv_id . "'
data-max='" . $loi->fields->TrackIT__Quantity__c . "'
data-loid='" . $loi->Id . "'
data-to_loi_id='" . $this_loi_id . "'
data-from_loc_name='" . $loc_r->fields->Name . "'
>" . $loc_r->fields->Name . " ( " . $loi->fields->TrackIT__Quantity__c . " )
</a>
";
}
}
/**
* MAIN QUERY FOR DISPLAY
*/
/* Query Inv by Location */
function query_inv_by_location($mySforceConnection, $location_id){
$query = "SELECT Id, TrackIT__Quantity__c, Restock_Point__c, Optimal_Quantity__c, Max_Storage_Capacity__c, TrackIT__Inventory__r.Name, TrackIT__Inventory__r.Id, TrackIT__Inventory__r.Image_for_ListView__c, TrackIT__Inventory__r.TrackIT__Description__c, Temporary_Location__c, TrackIT__Inventory__r.Indiv_Unit_of_Measurement_Description__c, TrackIT__Location__r.Name, TrackIT__Location__r.Id
FROM TrackIT__Inv_Location__c
WHERE isDeleted = false";
if($location_id != 'all'){
$query .= " AND TrackIT__Location__c = '" . $location_id . "' ORDER BY TrackIT__Inventory__r.Name ASC";
}
$response = $mySforceConnection->query($query);
loop_inventory($mySforceConnection, $response, $location_id);
}
/**
*
*/
/* Main Display Inventory */
function loop_inventory($mySforceConnection, $response, $location){
$ploJobs = '';
if('all' !== $location){
$arrayJobs = get_job_list($mySforceConnection);
foreach($arrayJobs as $jobId => $jobName){
$ploJobs .= "<option value='" . $jobId . "'>" . $jobName . "</option>";
}
}
$arrayLocs = get_location_list($mySforceConnection);
$ploLocs = '';
foreach($arrayLocs as $locId => $locName){
if($location != $locId){
$ploLocs .= "<option value='" . $locId . "'>" . $locName . "</option>";
}
}
/* initiate inv object */
$inv = (object) [
'loi_id' => '',
'loi_quant' => 0.0,
'loi_restock' => 0.0,
'loi_opt' => 0.0,
'loi_max' => 0.0,
'loi_temp' => false,
'loi_quant_all' => 0.0,
'loi_restock_all' => 0.0,
'loi_opt_all' => 0.0,
'loi_max_all' => 0.0,
'inv_name' => '',
'inv_id' => '',
'inv_img' => '',
'inv_descr' => '',
'inv_unit' => '',
'loc_name' => '',
'loc_id' => ''
];
$inv_each = (object)[
'quant' => 0.0,
'restock' => 0.0,
'opt' => 0.0,
'max' => 0.0,
'loc_id' => '',
'loc_name' => ''
];
$array_inv_each = array();
$flag_skip_first = true;
foreach ($response as $record) {
/* Current query results
stdClass Object (
[TrackIT__Quantity__c] => 0.0
[Restock_Point__c] => 5.0
[Optimal_Quantity__c] => 10.0
[Max_Storage_Capacity__c] => 10.0
[Temporary_Location__c] => false
[TrackIT__Inventory__r] => SObject Object (
[type] => TrackIT__Inventory__c
[fields] => stdClass Object (
[Name] => 14in Cut Off Saw Blade Concrete
[Id] => a3S1U000000ifVkUAI
[Image_for_ListView__c] => https:15967603796241673962168537898168.jpg
[TrackIT__Description__c] => [Indiv_Unit_of_Measurement_Description__c] =>
) [Id] => a3S1U000000ifVkUAI
)
[TrackIT__Location__r] => SObject Object (
[type] => TrackIT__Location__c
[fields] => stdClass Object (
[Name] => Office
[Id] => a3W1U000000iso9UAA
)
[Id] => a3W1U000000iso9UAA
)
)*/
$loi = new SObject($record);
$inv_r = new SObject($loi->fields->TrackIT__Inventory__r);
$loc = new SObject($loi->fields->TrackIT__Location__r);
/* Combine Inv in all Locations */
if(!isset($inv) || $inv->inv_id != $inv_r->fields->Id){ // initiate new inv
if(!$flag_skip_first){
display_inv_record($inv, $array_inv_each, $location, $ploJobs, $ploLocs);
}
$inv->loi_id = $loi->Id;
$inv->loi_quant = $loi->fields->TrackIT__Quantity__c;
$inv->loi_restock = $loi->fields->Restock_Point__c;
$inv->loi_opt = $loi->fields->Optimal_Quantity__c;
$inv->loi_max = $loi->fields->Max_Storage_Capacity__c;
$inv->loi_temp = $loi->fields->Temporary_Location__c;
$inv->loi_quant_all = $loi->fields->TrackIT__Quantity__c;
$inv->loi_restock_all = $loi->fields->Restock_Point__c;
$inv->loi_opt_all = $loi->fields->Optimal_Quantity__c;
$inv->loi_max_all = $loi->fields->Max_Storage_Capacity__c;
$inv->inv_name = $inv_r->fields->Name;
$inv->inv_id = $inv_r->fields->Id;
$inv->inv_img = $inv_r->fields->Image_for_ListView__c;
$inv->inv_descr = $inv_r->fields->TrackIT__Description__c;
$inv->inv_unit = $inv_r->fields->Indiv_Unit_of_Measurement_Description__c;
$inv->loc_name = $loc->fields->Name;
$inv->loc_id = $loc->fields->Id;
$array_inv_each = array();
}else{
//new record same inv
//aggregate
$inv->loi_quant_all += $loi->fields->TrackIT__Quantity__c;
$inv->loi_restock_all += $loi->fields->Restock_Point__c;
$inv->loi_opt_all += $loi->fields->Optimal_Quantity__c;
$inv->loi_max_all += $loi->fields->Max_Storage_Capacity__c;
}
$inv_each = (object)[
'quant' => 0.0,
'restock' => 0.0,
'opt' => 0.0,
'max' => 0.0,
'loc_id' => '',
'loc_name' => ''
];
// add loi
$inv_each->quant = $loi->fields->TrackIT__Quantity__c;
$inv_each->restock = $loi->fields->Restock_Point__c;
$inv_each->opt = $loi->fields->Optimal_Quantity__c;
$inv_each->max = $loi->fields->Max_Storage_Capacity__c;
$inv_each->loc_id = $loc->fields->Id;
$inv_each->loc_name = $loc->fields->Name;
array_push($array_inv_each, $inv_each);
$flag_skip_first = false;
}
}
function display_inv_record($inv, $array_inv_each, $location, $ploJobs, $ploLocs){
bdump($inv);
if(isset($_SESSION['fulfillment']) && $_SESSION['fulfillment']){
$filter_fulfillment = 0;
foreach($array_inv_each as $loinv){
if($loinv->quant <= $loinv->restock){
$filter_fulfillment = 1;
}
}
}else{
$filter_fulfillment = 1;
}
if($filter_fulfillment){
echo "<div class='inv_record'>"; // BEGIN div.inv_record
echo "<div class='inv_name'>" . $inv->inv_name . "</div>";
if(!empty($inv->inv_descr)){
echo "<div class='inv_name'>" . $inv->inv_descr . "</div>";
}
echo "<div class='inv_image_container'><img class='inv_image' src='" . $inv->inv_img . "' /></div>";
// Temporary Location
if('all' != $location && 'true' == $inv->loi_temp){
?>
<a class='btn_red_outline<?php echo ('MNGR' == $_SESSION['role']) ? " btn_keepinvlocation' href='#'" : "'"; ?> data-id='<?php echo $inv->inv_id; ?>' data-loi='<?php echo $inv->loi_id; ?>'>Temporary <?php echo ('MNGR' == $_SESSION['role']) ? ' <br />(Click to Keep or<br /> Unassign Below)' : ''; ?></a>
<?php
}
// Quantities
echo "<div class='inv_quantity'><table class='table_quants'>";
if('all' != $location){
echo "<tr><td>Unit: </td><td>" . $inv->inv_unit . "</td></tr>";
echo "<tr style='border:1px solid black;'><td>Current Quantity: </td><td class='inv_curr_quant' data-id='" . $inv->inv_id . "' data-quant='" . $inv->loi_quant . "'>" . $inv->loi_quant . "</td></tr>";
echo "<tr><td>Restock Point: </td><td>" . $inv->loi_restock . "</td></tr>";
echo "<tr><td>Optimal Quantity: </td><td>" . $inv->loi_opt . "</td></tr>";
echo "<tr><td>Max Quantity: </td><td>" . $inv->loi_max . "</td></tr>";
if($inv->loi_quant <= $inv->loi_restock){
echo "<tr style='border:1px solid red;'><td style='color:red; text-align:right;'>NEEDS: </td><td>" . ($inv->loi_opt - $inv->loi_quant) . "</td></tr>";
}
}else{
echo "<tr><td>Unit: </td><td>" . $inv->inv_unit . "</td></tr>";
foreach($array_inv_each as $each_loi){
echo "<tr style='border:1px solid black;'><td>" . $each_loi->loc_name . ":</td><td>" . $each_loi->quant . "</td></tr>";
if($each_loi->quant <= $each_loi->restock){
echo "<tr style='border:1px solid red;'><td style='color:red; text-align:right;'>" . $each_loi->loc_name . " NEEDS:</td><td>" . ($each_loi->opt - $each_loi->quant) . "</td></tr>";
}
}
}
echo "</table></div>";
if('all' != $location){
echo "<div class='inv_use hide_drawer hide_changequants' data-id='" . $inv->inv_id . "'>
<div class='used' data-id='" . $inv->inv_id . "'>
<input type='text' class='consumeQuant' data-id='" . $inv->inv_id . "' placeholder='# USED'/>
<label class='lbl_consumeJob' style='display:none;' data-id='" . $inv->inv_id . "' >Select Job Used on to <br />Deduct from Inventory:</label>
<select class='consumeJob' data-id='" . $inv->inv_id . "' data-location='" . $location . "' data-current='" . $inv->loi_quant . "' ><option value='0'>Choose:</option>" .
$ploJobs .
"</select>
</div>
</div>";
}
//echo "<div class='inv_barcode'><img src='".get_inventory_barcode($record['Name'])."' /></div>";
//echo "<a class='inv_button' href='https://thundernj.lightning.force.com/lightning/r/TrackIT__Inventory__c/".$record['Id']."/view?iospref=web'>Web</a>";
if('CREW' != $_SESSION['role']){ // BEGIN drawer
?>
<div class='openDrawerBtns hide_drawer' data-id='<?php echo $inv->inv_id; ?>'>
<a href='#' class='openAdminDrawer btnOpenDrawer' data-id='<?php echo $inv->inv_id; ?>'>⋮</a>
<!-- a href='#' class='openMoreDrawer btnOpenDrawer' data-id='<?php echo $inv->inv_id; ?>'>?</!-->
</div>
<div class='admin_drawer' data-id='<?php echo $inv->inv_id; ?>'>
<!-- BEGIN Change description -->
<input type='text'
class='changeDescription hide_assign2location hide_changequants hide_moveinv'
data-id='<?php echo $inv->inv_id; ?>'
placeholder='Change Description'
/>
<a href='#'
class='btn_changeDescription'
style='display:none;'
data-id='<?php echo $inv->inv_id; ?>'
data-location='<?php echo $location; ?>' >
Change Description
</a>
<!-- END Change description -->
<?php
if('all' != $location){ // BEGIN allow quant change
?>
<a href='#'
class='btn_displaychangequants blue_button hide_changequants hide_changeDescription hide_moveinv'
data-id='<?php echo $inv->inv_id; ?>'
data-location='<?php echo $location; ?>'>
Change Quantities
</a>
<div class='frm_changequants' style='display:none; border-bottom:1px solid black;' data-id='<?php echo $inv->inv_id; ?>'>
<label>Current Quantity:</label>
<input type='text'
class='quant_changequants input_text'
data-id='<?php echo $inv->inv_id; ?>'
value='<?php echo $inv->loi_quant; ?>'
/>
<label>Restock Point::</label>
<input type='text'
class='restock_changequants input_text'
data-id='<?php echo $inv->inv_id; ?>'
value='<?php echo $inv->loi_restock; ?>'
/>
<label>Optimal Quantity:</label>
<input type='text'
class='optimal_changequants input_text'
data-id='<?php echo $inv->inv_id; ?>'
value='<?php echo $inv->loi_opt; ?>'
/>
<label>Max Quantity:</label>
<input type='text'
class='max_changequants input_text'
data-id='<?php echo $inv->inv_id; ?>'
value='<?php echo $inv->loi_max; ?>'
/>
<a href='#'
class='btn_changequants blue_button'
data-id='<?php echo $inv->inv_id; ?>'
data-location='<?php echo $location; ?>'>
Save Quantities
</a>
</div>
<?php
} // END allow quant change
if('all' != $location){ // BEGIN move-inv
?>
<a href='#'
class='btn_moveinv blue_button hide_assign2location hide_changeDescription hide_changequants hide_moveinv'
data-id='<?php echo $inv->inv_id; ?>'
data-loc_id='<?php echo $location; ?>'
>
Move # from This Location
</a>
<div class='frm_moveinv hide_assign2location hide_changeDescription hide_changequants hide_moveinv' data-id='<?php echo $inv->inv_id; ?>' style='display:none; border-bottom:1px solid black;'>
<input type='number'
class='quant_moveinv input_text'
data-id='<?php echo $inv->inv_id; ?>'
placeholder='Max <?php echo $inv->loi_quant; ?>'
/>
<select class="location_moveinv input_select" data-id="<?php echo $inv->inv_id; ?>" data-orig_quant="<?php echo $inv->loi_quant; ?>" data-orig_loc_id="<?php echo $inv->loi_id; ?>">
<option value='0'>Choose Location to Move to...</option>
</select>
</div>
<?php
} // END allow move-inv
if('all' != $location){ // BEGIN RESTOCK
?>
<a href='#'
class='btn_restock blue_button hide_assign2location hide_changeDescription hide_moveinv'
data-id='<?php echo $inv->inv_id; ?>'
data-loc_id='<?php echo $location; ?>'
data-this_loi_id='<?php echo $inv->loi_id; ?>'
>
Restock
</a>
<div class='frm_restock' data-id='<?php echo $inv->inv_id; ?>' style='display:none; border-bottom:1px solid black;'>
<p style='font-size:20px;' class='p_restockFrom' data-id='<?php echo $inv->inv_id; ?>'>Restock From (Max):</p>
<div class='restockFrom' data-id='<?php echo $inv->inv_id; ?>'></div>
</div>
<?php
} // END Restock
if('all' == $location){ // BEGIN assign to a location
?>
<a href='#'
class='btn_assign2newlocation blue_button hide_assign2location hide_changeDescription hide_moveinv'
data-id='<?php echo $inv->inv_id; ?>' >
Assign to a New Location
</a>
<div class='frm_assign2location' data-id='<?php echo $inv->inv_id; ?>' style='display:none; border-bottom:1px solid black;'>
<input type='text'
class='assign_quant input_text'
data-id='<?php echo $inv->inv_id; ?>' placeholder='Quantity'
/>
<input type='text'
class='assign_restock input_text'
data-id='<?php echo $inv->inv_id; ?>' placeholder='Restock Point'
/>
<input type='text'
class='assign_optimal input_text'
data-id='<?php echo $inv->inv_id; ?>' placeholder='Optimal Quantity'
/>
<input type='text'
class='assign_max input_text'
data-id='<?php echo $inv->inv_id; ?>' placeholder='Max Capacity'
/>
<select class="select_assign2location input_select" data-id="<?php echo $inv->inv_id; ?>">
</select>
</div>
<a href='#'
class='btn_movetemplocation blue_button hide_assign2location hide_changeDescription hide_moveinv'
data-id='<?php echo $inv->inv_id; ?>' >
Move to a Location Temporarily
</a>
<div class='frm_movetemplocation' data-id='<?php echo $inv->inv_id; ?>' style='display:none; border-bottom:1px solid black;'>
<input type='text'
class='assign_movetemplocation input_text'
data-id='<?php echo $inv->inv_id; ?>' placeholder='Quantity'
/>
<select class="select_movetemplocation input_select" data-id="<?php echo $inv->inv_id; ?>">
</select>
</div>
<?php
}else{
?>
<a href='#'
class='btn_unassignLocation blue_button hide_changequants hide_changeDescription hide_moveinv'
data-loi='<?php echo $inv->loi_id; ?>'
data-id="<?php echo $inv->inv_id; ?>">
Unassign This Location
</a>
<?php
} // END assign to a location
?>
<a class='btn_OpenSFApp' href='salesforce1://sObject/<?php echo $inv->inv_id; ?>/view'>Open in Salesforce App</a>
<!-- BEGIN Replace Photo -->
<div class='hide_changequants hide_changeDescription hide_assign2location hide_moveinv' data-id="<?php echo $inv->inv_id; ?>">
<form method="post" enctype="multipart/form-data" name="formUploadFile" id='frmReplacePicture_<?php echo $inv->inv_id; ?>' data-id='<?php echo $inv->inv_id; ?>' >
<label for="replPic_<?php echo $inv->inv_id; ?>" class='lbl_replacePicture'>
<img src='uploads/rotate-camera-icon.png' style="display:block; margin:0 auto;"/>
Replace Picture
<input type="file" id = "replPic_<?php echo $inv->inv_id; ?>" class='replacePicture' name="file" style="display:none;" data-id='<?php echo $inv->inv_id; ?>' onchange="replacePicture('<?php echo $inv->inv_id; ?>');" >
</label>
<input type='hidden' name='auth' value='legit' />
<input type='hidden' name='id' value='<?php echo $inv->inv_id; ?>' />
</form>
</div>
<!-- END Replace Photo -->
</div> <!-- END .admin_drawer -->
<?php
} // END drawer
echo "</div>"; // END div.inv_record
}
}