?
Current Path : /home1/savoy/public_html/savoyglobal.net/sec_old/application/views/inventory/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/sec_old/application/views/inventory/add_sale.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); $this->load->view('documentreadyfunctions'); ?> <script src="<?= base_url() ?>assets/js/jquery.autocomplete.js"></script> <script type="text/javascript"> $(document).ready(function() { suggestBatch('#batch'); $('#stud_details').css('display','none'); suggestStudent('#student'); }); function check_allotted_qty(divid) { var alloted_qty_old= parseInt($('#alloted_qty_old'+divid).val()); var alloted_qty= parseInt($('#alloted_qty'+divid).val()); if(alloted_qty>alloted_qty_old) alert('Qty should be less than allotted Qty') } function check_qty(qty,divid) { var qtnty=parseInt(qty) var tr_index= $('#'+divid).closest('tr').index(); var inventory_type= $('#inventory_id'+tr_index).val(); if(inventory_type!='') { $.ajax({ type: "POST", url: "<?= site_url() ?>/inventory/check_qty/"+inventory_type, success: function(msg) { var qty1= parseInt(msg) if(qty1<qtnty) { alert("Stock is not available") } }}); } } function get_sale_total_prize(divid) { var tr_index= $('#'+divid).closest('tr').index(); var tr_index1=tr_index+1; var qty= $('#inventory_qty'+tr_index1).val() var prize= $('#inventory_amount'+tr_index1).val() var discount= $('#inventory_discount'+tr_index1).val() alert(qty); var flag=1; if(qty=='' || prize=='' || discount=='') { flag=0; } if(flag==1) { var qtnty=parseInt(qty) var prize1=parseFloat(prize) var discount1=parseFloat(discount) var total=prize1*qtnty-discount1; $('#inventory_total'+tr_index1).val(total) } else $('#inventory_total'+tr_index1).val('0') } function check_availability(val,divid) { var flag=0; var tr_index= $('#'+divid).closest('tr').index(); var inventory =$('#inventory_id'+tr_index).val(); if(val==inventory) flag=1; if(flag==1) { alert('Already Added'); } } function clear_info(){ $('#batch').removeAttr('readonly'); $('#batch').val(''); $('#inventory_id').removeAttr('disabled'); } </script> <div class="icons_main"> <div class="icons"> <img src="<?= base_url() ?>assets/images/back.png" title="Back" class="clickimage" onclick="viewdata('inventory','viewininventorysearch','search_sale','view_sale','<?= $_SESSION['pagenum']; ?>')" alt="Back" align = "center" width="32" height="32" /> </div> <div class="icons_caption"> <h4>Creating New Stock Utilization</h4> </div> </div> <?php $inventory = $this->mastermodel->get_single_field_value('inventory', 'inventory_type', 'inventory_id', $inventory_type); $batch_no = $this->mastermodel->get_single_field_value('batch', 'batch_no', 'batch_id', $batch); $attributes = array('id' => 'validateform', 'class' => 'validate'); echo form_open('inventory/addininventory/insert_sale/view_sale/1', $attributes); ?> <div class="grid_12" > <div class="box"style="width: 60%;float: none;margin: 0 auto;"> <div class="header main">Stock Utilization Details </div> <div class="content no-padding"> <div class="section _100"> <label>Batch</label> <div class="single_page"> <?= $batch_no ?> <input type="hidden" name="batch_id" id="batch_id" value="<?= $batch; ?>"/> </div> </div> <div class="section _100"> <label>Inventory Type</label> <div class="single_page"> <?= $inventory ?> <input type="hidden" name="inventory_id" id="inventory_id" value="<?= $inventory_type; ?>"/> </div> </div> <div class="section _100"> <label>Stock Utilization Date</label> <div> <input name="sale_date" id="sale_date" class="required calfocus" type="text" value="" /> </div> </div> </div> </div> </div> <?php if (count($students) > 0) { $k = 1; ?> <div id="load_student_div" > <div class="grid_12" > <div class="box"> <div class="content no-padding"> <div class="header main"> Stock Utilization Details of students</div> <table class="table" id="stud_sub"> <thead id="stud_sub_head"> <tr> <th>Sl No</th> <th>Student</th> <th>Reg No</th> <th>Gender</th> <th>Nationality</th> <th>Status</th> <th>Alloted Qty</th> <th>To be Allotted</th> </tr> </thead> <tbody> <?php // $html1 = ''; $html = ''; $active = count($students) - (count($cancelled_student) + count($deactivate_student)); $slno1 = $active + 1; $slno2 = $active + count($cancelled_student) + 1; $i = 1; $stud = array(); foreach ($students as $list) { $stud[] = $list['student_id']; if (in_array($list['student_id'], $cancelled_student)) { $allocate_qty = 0; if (isset($inventodry_alloted[$inventory_type][$list['student_id']])) $allocate_qty = $inventodry_alloted[$inventory_type][$list['student_id']]; $status = 'Cancelled'; $html = '<tr class="cancelled_tr"> <td>' . $slno2++ . '</td> <td>' . $list['first_name'] . " " . $list['last_name'] . ' <input type="hidden" value="' . $list['student_id'] . '" name="student_id' . $list['student_id'] . '" id="student_id' . $list['student_id'] . '"/> </td> <td>' . $list['reg_no'] . '</td> <td>' . $list['gender'] . '</td> <td>' . $list['nationality'] . '</td> <td>' . $status . '</td> <td><input class="num_only" type="text" value="' . $allocate_qty . '" name="alloted_qty' . $list['student_id'] . '" id="alloted_qty' . $list['student_id'] . '" style="width: 150px;" onblur="check_allotted_qty(' . $list['student_id'] . ')" /> <input class="num_only" type="hidden" value="' . $allocate_qty . '" name="alloted_qty_old' . $list['student_id'] . '" id="alloted_qty_old' . $list['student_id'] . '" style="width: 150px;" /></td></td> <td><input class="num_only" type="text" value="" name="inventory_qty' . $list['student_id'] . '" id="inventory_qty' . $list['student_id'] . '" style="width: 150px;"/></td> </tr>' . $html; $slno2++; } elseif (in_array($list['student_id'], $deactivate_student)) { $status = 'Deactivated'; $allocate_qty = 0; if (isset($inventodry_alloted[$inventory_type][$list['student_id']])) $allocate_qty = $inventodry_alloted[$inventory_type][$list['student_id']]; $html1 = '<tr class="deactivated_tr"> <td>' . $slno1++ . '</td> <td>' . $list['first_name'] . " " . $list['last_name'] . ' <input type="hidden" value="' . $list['student_id'] . '" name="student_id' . $list['student_id'] . '" id="student_id' . $list['student_id'] . '"/> </td> <td>' . $list['reg_no'] . '</td> <td>' . $list['gender'] . '</td> <td>' . $list['nationality'] . '</td> <td>' . $status . '</td> <td><input class="num_only" type="text" value="' . $allocate_qty . '" name="alloted_qty' . $list['student_id'] . '" id="alloted_qty' . $list['student_id'] . '" style="width: 150px;" onblur="check_allotted_qty(' . $list['student_id'] . ')"/> <input class="num_only" type="hidden" value="' . $allocate_qty . '" name="alloted_qty_old' . $list['student_id'] . '" id="alloted_qty_old' . $list['student_id'] . '" style="width: 150px;" /></td> <td><input class="num_only" type="text" value="" name="inventory_qty' . $list['student_id'] . '" id="inventory_qty' . $list['student_id'] . '" style="width: 150px;"/></td> </tr>' . $html1; $slno1++; ; } else { $allocate_qty = 0; if (isset($inventodry_alloted[$inventory_type][$list['student_id']])) $allocate_qty = $inventodry_alloted[$inventory_type][$list['student_id']]; $status = 'Active'; ?> <tr> <td><?= $i ?></td> <td> <?= $list['first_name'] . " " . $list['last_name'] ?> <input type="hidden" value="<?= $list['student_id'] ?>" name="student_id<?= $list['student_id'] ?>" id="student_id<?= $list['student_id'] ?>"/> </td> <td><?= $list['reg_no'] ?></td> <td><?= $list['gender'] ?></td> <td><?= $list['nationality'] ?></td> <td><?= $status ?></td> <td> <input class="num_only" type="text" value="<?= $allocate_qty ?>" name="alloted_qty<?= $list['student_id'] ?>" id="alloted_qty<?= $list['student_id'] ?>" style="width: 150px;" onblur="check_allotted_qty('<?= $list['student_id'] ?>')"/> <input class="num_only" type="hidden" value="<?= $allocate_qty ?>" name="alloted_qty_old<?= $list['student_id'] ?>" id="alloted_qty_old<?= $list['student_id'] ?>" style="width: 150px;" /> </td> <td><input class="num_only" type="text" value="" name="inventory_qty<?= $list['student_id'] ?>" id="inventory_qty<?= $list['student_id'] ?>" style="width: 150px;"/></td> </tr> <?php $i++; } } echo $html1; echo $html; ?> </tbody> </table> <input type="hidden" name="student_id_list" id="student_id_list" value="<?= implode(',', $stud) ?>"/> </div> </div> </div> </div> <?php $k++; ?> <div class="grid_12" > <div class="box"> <div class="actions"> <div class="actions-left"> <input type="reset"> </div> <div class="actions-right"> <button type="submit" id="submit" class="clickimage" onclick="addformdata('validateform')">Save</button> </div> </div> </div> </div> <?php echo form_close(); } ?>