?
Current Path : /home1/savoy/public_html/savoyglobal.net/sec/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/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/scripts/jquery.autocomplete.js"></script> <script type="text/javascript"> $(document).ready(function() { suggestBatch('#batch'); $('#stud_details').css('display','none'); suggestStudent('#student'); $('.stk_table').on('keyup', 'input.chek_stock', function () { stock_qnty(); }) }); function stock_qnty() { var $tbody = $('.stk_table').find('tbody'); var total = 0; $tbody.find('tr').each(function (o, i) { var $tr = $(i); var qnt = $tr.find('.chek_stock').val() != "" ? $tr.find('.chek_stock').val() : 0; var tot_qty = parseInt(qnt); total += tot_qty; }); var stock=$('#stock_qntity').val(); if(stock < total) { $('#submit_btn').attr("disabled", true); alert('Entered Quantity must be less than current stock'); } else { $('#submit_btn').removeAttr("disabled"); } } 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="row-fluid"> <div class="tab-pane " id="tab_2"> <div class="portlet box blue"> <div class="portlet-title"> <div class="caption"><i class="icon-reorder"></i>Creating New Stock Utilization</div> <div class="tools"> <a href="#" onclick="viewdata('inventory','viewininventorysearch','search_sale','view_sale','<?= $_SESSION['pagenum']; ?>')" class="remove"></a> </div> </div> <div class="portlet-body form"> <!-- BEGIN FORM--> <?php $attributes = array('id' => 'validateform', 'class' => 'form-horizontal validate'); $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); echo form_open('inventory/addininventory/insert_sale/view_sale/1', $attributes); ?> <h3>Stock Utilization Details </h3> <div class="row-fluid"> <div class="span6 "> <div class="control-group"> <label class="control-label">Batch</label> <div class="controls"><span class="text bold"> <?= $batch_no ?> <input type="hidden" name="batch_id" id="batch_id" value="<?= $batch; ?>"/></span> </div> </div> </div> <div class="span6 "> <div class="control-group"> <label class="control-label">Inventory Type</label> <div class="controls"><span class="text bold"> <?= $inventory ?> <input type="hidden" name="inventory_id" id="inventory_id" value="<?= $inventory_type; ?>"/> <input type="hidden" name="stock_qntity" id="stock_qntity" value="<?=$this->inventorymodel->get_stock($inventory_type)?>"/></span> </div> </div> </div> </div> <div class="row-fluid"> <div class="span6 "> <div class="control-group"> <label class="control-label">Stock Utilization Date</label> <div class="controls"> <input name="sale_date" id="sale_date" class="required calfocus" type="text" value="" /> </div> </div> </div> </div> <div class="portlet box blue"> <div class="portlet-title"> <div class="caption"><i class="icon-check"></i> Stock Utilization Details of students</div> </div> <?php if (count($students) > 0) { $k = 1; ?> <div class="portlet-body" id="load_student_div"> <div class="row-fluid"> <div class="control-group"> <table class="table table-striped table-hover table-bordered stk_table" id="sample_5" style="background-color: white;"> <thead> <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 chek_stock" 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 chek_stock" 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 chek_stock" 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> <?php $k++; ?> </div> <div class="form-actions"> <input type="hidden" name="tab_name" value="sale"/> <input type="hidden" name="resfunction" value="search_sale"/> <button type="submit" onclick="addformdata('validateform')" id="submit_btn" class="btn blue"><i class="icon-ok"></i> Save</button> <button type="button" onclick="viewdata('inventory','viewininventorysearch','search_sale','view_sale','<?= $_SESSION['pagenum']; ?>')" class="btn">Cancel</button> </div> <?php echo form_close(); } ?> <!-- END FORM--> </div> </div> </div> </div>